@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,960 @@
1
+ import { c as tt } from "./Clip-CAN7t03k.js";
2
+ import { N as n, a as nt, w as Fe } from "./Errors-B2ekO9bZ.js";
3
+ import { b as ot, M as st, N as rt } from "./TextureLoader-CfDzdy2m.js";
4
+ import { l as it, i as Be, b as at } from "./LoaderIO-BwrM84OM.js";
5
+ import { d as Xe, Y as ct, p as lt, i as mt, u as ut } from "./Node-QfgAE2_v.js";
6
+ import { o as Ee, c as ze } from "./Options-CajE7LLJ.js";
7
+ import { G as qe } from "./GLTFResourceIO-CYJyCUTt.js";
8
+ const ft = Ee({ signal: !0, limits: !0, resolveResource: !0, decoders: !0 }), dt = Ee({ signal: !0, limits: !0, resolveResource: !0, decoders: !0, baseUrl: !0 }), ht = Ee({ draco: !0, meshopt: !0, ktx2: !0 });
9
+ function Pe(t) {
10
+ try {
11
+ return JSON.parse(new TextDecoder("utf-8", { fatal: !0 }).decode(t));
12
+ } catch (o) {
13
+ throw new n("format", "[Nova3D] glTF JSON is not valid UTF-8 JSON.", { cause: o });
14
+ }
15
+ }
16
+ function pt(t, o) {
17
+ if (t.byteLength >= 4 && new DataView(t.buffer, t.byteOffset, t.byteLength).getUint32(0, !0) === 1179937895) {
18
+ const e = new DataView(t.buffer, t.byteOffset, t.byteLength);
19
+ if (t.byteLength < 20 || e.getUint32(4, !0) !== 2 || e.getUint32(8, !0) !== t.byteLength)
20
+ throw new n("format", "[Nova3D] Invalid GLB header.");
21
+ let s = 12, h, c, y = 0;
22
+ for (; s < t.byteLength; ) {
23
+ if (s + 8 > t.byteLength)
24
+ throw new n("format", "[Nova3D] Truncated GLB chunk header.");
25
+ const g = e.getUint32(s, !0), F = e.getUint32(s + 4, !0);
26
+ if (s += 8, g % 4 !== 0 || s + g > t.byteLength)
27
+ throw new n("format", "[Nova3D] Invalid GLB chunk range.");
28
+ if (y === 0 && F !== 1313821514)
29
+ throw new n("format", "[Nova3D] GLB JSON must be the first chunk.");
30
+ if (F === 1313821514) {
31
+ if (y !== 0 || g > o)
32
+ throw new n("format", "[Nova3D] Duplicate or oversized GLB JSON.");
33
+ h = Pe(t.subarray(s, s + g));
34
+ } else if (F === 5130562) {
35
+ if (c)
36
+ throw new n("format", "[Nova3D] Duplicate GLB binary chunk.");
37
+ c = t.subarray(s, s + g);
38
+ }
39
+ s += g, y++;
40
+ }
41
+ if (h === void 0)
42
+ throw new n("format", "[Nova3D] Missing GLB JSON.");
43
+ return { json: h, binary: c };
44
+ }
45
+ if (t.byteLength > o)
46
+ throw new n("budget", "[Nova3D] glTF JSON exceeds its byte budget.");
47
+ return { json: Pe(t) };
48
+ }
49
+ function f(t, o) {
50
+ if (!t || typeof t != "object" || Array.isArray(t))
51
+ throw new n("format", `[Nova3D] Expected ${o} object.`);
52
+ return t;
53
+ }
54
+ function he(t, o, e) {
55
+ if (!Array.isArray(t) || t.length > e)
56
+ throw new n("format", `[Nova3D] Invalid or oversized ${o} array.`);
57
+ return t;
58
+ }
59
+ function b(t, o, e = Number.MAX_SAFE_INTEGER) {
60
+ if (typeof t != "number" || !Number.isSafeInteger(t) || t < 0 || t > e)
61
+ throw new n("format", `[Nova3D] Invalid ${o}.`);
62
+ return t;
63
+ }
64
+ const Ke = { 5120: 1, 5121: 1, 5122: 2, 5123: 2, 5125: 4, 5126: 4 }, gt = { SCALAR: 1, VEC2: 2, VEC3: 3, VEC4: 4, MAT4: 16 };
65
+ function wt(t, o, e) {
66
+ switch (e) {
67
+ case 5120:
68
+ return t.getInt8(o);
69
+ case 5121:
70
+ return t.getUint8(o);
71
+ case 5122:
72
+ return t.getInt16(o, !0);
73
+ case 5123:
74
+ return t.getUint16(o, !0);
75
+ case 5125:
76
+ return t.getUint32(o, !0);
77
+ case 5126:
78
+ return t.getFloat32(o, !0);
79
+ default:
80
+ throw new n("unsupported", "[Nova3D] Unsupported accessor component type.");
81
+ }
82
+ }
83
+ const vt = { 5120: Int8Array, 5121: Uint8Array, 5122: Int16Array, 5123: Uint16Array, 5125: Uint32Array, 5126: Float32Array }, yt = new Uint8Array(new Uint16Array([1]).buffer)[0] === 1;
84
+ function bt(t, o) {
85
+ switch (o) {
86
+ case 5120:
87
+ return Math.max(t / 127, -1);
88
+ case 5121:
89
+ return t / 255;
90
+ case 5122:
91
+ return Math.max(t / 32767, -1);
92
+ case 5123:
93
+ return t / 65535;
94
+ default:
95
+ return t;
96
+ }
97
+ }
98
+ function Nt(t, o, e) {
99
+ const s = f(t, "accessor"), h = typeof s.type == "string" ? s.type : "", c = b(s.componentType, "accessor componentType"), y = Ke[c], g = gt[h], F = b(s.count, "accessor count", e);
100
+ if (!y || !g || F < 1 || typeof (s.normalized ?? !1) != "boolean" || s.normalized && [5125, 5126].includes(c))
101
+ throw new n("format", "[Nova3D] Invalid accessor layout.");
102
+ const Q = new Float64Array(F * g), H = b(s.byteOffset ?? 0, "accessor byteOffset"), A = (r, _, G, J, E, X, te) => {
103
+ const j = b(r, "bufferView index", o.length - 1), U = o[j];
104
+ if (!U)
105
+ throw new n("format", "[Nova3D] Missing accessor bufferView.");
106
+ const oe = Ke[X], V = te ? U.stride ?? oe * E : oe * E;
107
+ if (!te && U.stride !== void 0 || (_ + (U.offset ?? 0)) % oe !== 0 || V < oe * E || V % oe !== 0 || _ + (J - 1) * V + oe * E > U.data.byteLength)
108
+ throw new n("format", "[Nova3D] Accessor range or alignment exceeds its bufferView.");
109
+ const re = U.data.byteOffset + _;
110
+ if (yt && re % oe === 0) {
111
+ const z = V / oe, L = new vt[X](U.data.buffer, re, (J - 1) * z + E);
112
+ if (z === E)
113
+ G.set(L);
114
+ else
115
+ for (let I = 0; I < J; I++)
116
+ for (let M = 0; M < E; M++)
117
+ G[I * E + M] = L[I * z + M];
118
+ return;
119
+ }
120
+ const le = new DataView(U.data.buffer, U.data.byteOffset, U.data.byteLength);
121
+ for (let z = 0; z < J; z++)
122
+ for (let L = 0; L < E; L++)
123
+ G[z * E + L] = wt(le, _ + z * V + L * oe, X);
124
+ };
125
+ if (s.bufferView !== void 0)
126
+ A(s.bufferView, H, Q, F, g, c, !0);
127
+ else if (H !== 0)
128
+ throw new n("format", "[Nova3D] Sparse-only accessor cannot have byteOffset.");
129
+ if (s.sparse !== void 0) {
130
+ const r = f(s.sparse, "sparse accessor"), _ = b(r.count, "sparse count", F);
131
+ if (_ < 1)
132
+ throw new n("format", "[Nova3D] Sparse count must be positive.");
133
+ const G = f(r.indices, "sparse indices"), J = f(r.values, "sparse values"), E = b(G.componentType, "sparse index type");
134
+ if (![5121, 5123, 5125].includes(E))
135
+ throw new n("format", "[Nova3D] Invalid sparse index type.");
136
+ const X = new Float64Array(_), te = new Float64Array(_ * g);
137
+ A(G.bufferView, b(G.byteOffset ?? 0, "sparse indices offset"), X, _, 1, E, !1), A(J.bufferView, b(J.byteOffset ?? 0, "sparse values offset"), te, _, g, c, !1);
138
+ for (let j = 0; j < _; j++) {
139
+ const U = X[j];
140
+ if (U >= F || j > 0 && U <= X[j - 1])
141
+ throw new n("format", "[Nova3D] Sparse indices must be strictly increasing and in range.");
142
+ Q.set(te.subarray(j * g, (j + 1) * g), U * g);
143
+ }
144
+ }
145
+ if (c === 5126) {
146
+ for (let r = 0; r < Q.length; r++)
147
+ if (!Number.isFinite(Q[r]))
148
+ throw new n("format", "[Nova3D] Non-finite accessor value.");
149
+ } else if (s.normalized)
150
+ for (let r = 0; r < Q.length; r++)
151
+ Q[r] = bt(Q[r], c);
152
+ return { values: Q, count: F, components: g, componentType: c, normalized: s.normalized === !0 };
153
+ }
154
+ function xt(t, o, e) {
155
+ const s = (h) => o ? o[h] : h;
156
+ switch (t) {
157
+ case 0:
158
+ return { topology: "points", list: null };
159
+ case 1:
160
+ if (e % 2 !== 0)
161
+ throw new n("format", "[Nova3D] glTF LINES element count must be even.");
162
+ return { topology: "lines", list: null };
163
+ case 2:
164
+ case 3: {
165
+ const h = t === 2 ? e : e - 1;
166
+ if (e < 2)
167
+ throw new n("format", "[Nova3D] glTF line strips and loops need at least two elements.");
168
+ const c = new Uint32Array(h * 2);
169
+ for (let y = 0; y < h; y++)
170
+ c[y * 2] = s(y), c[y * 2 + 1] = s((y + 1) % e);
171
+ return { topology: "lines", list: c };
172
+ }
173
+ case 4:
174
+ if (e % 3 !== 0)
175
+ throw new n("format", "[Nova3D] Triangle element count must be divisible by three.");
176
+ return { topology: "triangles", list: null };
177
+ case 5:
178
+ case 6: {
179
+ if (e < 3)
180
+ throw new n("format", "[Nova3D] glTF triangle strips and fans need at least three elements.");
181
+ const h = new Uint32Array((e - 2) * 3);
182
+ for (let c = 0; c < e - 2; c++)
183
+ t === 5 ? (h[c * 3] = s(c), h[c * 3 + 1] = s(c + 1 + c % 2), h[c * 3 + 2] = s(c + 2 - c % 2)) : (h[c * 3] = s(0), h[c * 3 + 1] = s(c + 1), h[c * 3 + 2] = s(c + 2));
184
+ return { topology: "triangles", list: h };
185
+ }
186
+ default:
187
+ throw new n("format", "[Nova3D] Unknown glTF primitive mode.");
188
+ }
189
+ }
190
+ function Tt(t, o) {
191
+ const e = t.attributes;
192
+ if (t.indices === void 0 || !e || typeof e != "object" || e.POSITION === void 0)
193
+ return o;
194
+ const s = o(t.indices), c = o(e.POSITION).count;
195
+ if (s.components !== 1 || c === 0)
196
+ return o;
197
+ const y = new Int32Array(c).fill(-1);
198
+ let g = 0;
199
+ const F = s.values;
200
+ for (let A = 0; A < F.length; A++) {
201
+ const r = F[A];
202
+ if (!(r >= 0 && r < c) || !Number.isInteger(r))
203
+ return o;
204
+ y[r] < 0 && (y[r] = g++);
205
+ }
206
+ if (g === c)
207
+ return o;
208
+ const Q = new Set(Object.values(e));
209
+ for (const A of Array.isArray(t.targets) ? t.targets : [])
210
+ if (A && typeof A == "object")
211
+ for (const r of Object.values(A))
212
+ Q.add(r);
213
+ Q.delete(t.indices);
214
+ const H = /* @__PURE__ */ new Map();
215
+ return (A) => {
216
+ let r = H.get(A);
217
+ if (r)
218
+ return r;
219
+ const _ = o(A);
220
+ if (A === t.indices) {
221
+ const G = new Float64Array(F.length);
222
+ for (let J = 0; J < F.length; J++)
223
+ G[J] = y[F[J]];
224
+ r = { ..._, values: G };
225
+ } else if (Q.has(A) && _.count === c) {
226
+ const G = _.components, J = new Float64Array(g * G);
227
+ for (let E = 0; E < c; E++) {
228
+ const X = y[E];
229
+ if (X >= 0)
230
+ for (let te = 0; te < G; te++)
231
+ J[X * G + te] = _.values[E * G + te];
232
+ }
233
+ r = { ..._, values: J, count: g };
234
+ } else
235
+ r = _;
236
+ return H.set(A, r), r;
237
+ };
238
+ }
239
+ function He(t, o, e) {
240
+ const s = f(t, "mesh primitive"), h = Tt(s, o), c = f(s.attributes, "primitive attributes"), y = s.mode ?? 4;
241
+ if (!Number.isInteger(y) || y < 0 || y > 6)
242
+ throw new n("format", "[Nova3D] Unknown glTF primitive mode.");
243
+ const g = h(c.POSITION);
244
+ if (g.components !== 3 || !(g.componentType === 5126 ? !g.normalized : [5120, 5121, 5122, 5123].includes(g.componentType)) || g.count > e)
245
+ throw new n("format", "[Nova3D] Positions require FLOAT or KHR_mesh_quantization integer VEC3 within the vertex budget.");
246
+ const F = c.NORMAL === void 0 ? void 0 : h(c.NORMAL);
247
+ if (F && (F.components !== 3 || F.count !== g.count || !(F.componentType === 5126 ? !F.normalized : [5120, 5122].includes(F.componentType) && F.normalized)))
248
+ throw new n("format", "[Nova3D] Normals require FLOAT or normalized signed 8/16-bit VEC3 matching positions.");
249
+ const Q = (d) => {
250
+ const u = c[d] === void 0 ? void 0 : h(c[d]);
251
+ if (u && (u.components !== 2 || u.count !== g.count || !(u.componentType === 5126 && !u.normalized || [5120, 5121, 5122, 5123].includes(u.componentType))))
252
+ throw new n("format", `[Nova3D] ${d} requires FLOAT or (KHR_mesh_quantization) 8/16-bit VEC2 matching positions.`);
253
+ return u;
254
+ }, H = Q("TEXCOORD_0"), A = Q("TEXCOORD_1"), r = c.COLOR_0 === void 0 ? void 0 : h(c.COLOR_0);
255
+ if (r && (r.components !== 3 && r.components !== 4 || r.count !== g.count || !(r.componentType === 5126 && !r.normalized || [5121, 5123].includes(r.componentType) && r.normalized)))
256
+ throw new n("format", "[Nova3D] COLOR_0 requires FLOAT or normalized unsigned 8/16-bit VEC3/VEC4 matching positions.");
257
+ const _ = s.indices === void 0 ? void 0 : h(s.indices);
258
+ if (_ && (_.components !== 1 || ![5121, 5123, 5125].includes(_.componentType) || _.normalized))
259
+ throw new n("format", "[Nova3D] Primitive indices must be unsigned scalar integers.");
260
+ if (_) {
261
+ const d = g.count - 1, u = _.values;
262
+ for (let D = 0; D < u.length; D++) {
263
+ const O = u[D];
264
+ (!(O >= 0 && O <= d) || !Number.isSafeInteger(O)) && b(O, "primitive index", d);
265
+ }
266
+ }
267
+ const G = xt(y, _ ? _.values : null, _?.count ?? g.count), J = G.topology, E = G.list ? { values: new Float64Array(G.list), count: G.list.length } : _, X = E?.count ?? g.count, te = (d, u, D) => {
268
+ const O = r.components;
269
+ d[u] = r.values[D * O], d[u + 1] = r.values[D * O + 1], d[u + 2] = r.values[D * O + 2], d[u + 3] = O === 4 ? r.values[D * O + 3] : 1;
270
+ }, j = c.JOINTS_0 === void 0 ? void 0 : h(c.JOINTS_0), U = c.WEIGHTS_0 === void 0 ? void 0 : h(c.WEIGHTS_0);
271
+ if (j === void 0 != (U === void 0))
272
+ throw new n("format", "[Nova3D] JOINTS_0 and WEIGHTS_0 must be paired.");
273
+ if (j && (j.components !== 4 || j.count !== g.count || ![5121, 5123].includes(j.componentType) || j.normalized || U.components !== 4 || U.count !== g.count || !(U.componentType === 5126 && !U.normalized || [5121, 5123].includes(U.componentType) && U.normalized)))
274
+ throw new n("format", "[Nova3D] Invalid skin attribute component types/counts.");
275
+ if (J !== "triangles" && (j || s.targets !== void 0))
276
+ throw new n("unsupported", "[Nova3D] Skinned or morphed glTF lines and points are not supported.");
277
+ const oe = [];
278
+ for (const d of s.targets === void 0 ? [] : he(s.targets, "morph targets", 8)) {
279
+ const u = f(d, "morph target");
280
+ if (!Object.keys(u).length || Object.keys(u).some((k) => k !== "POSITION" && k !== "NORMAL" && k !== "TANGENT"))
281
+ throw new n("unsupported", "[Nova3D] Morph targets support POSITION/NORMAL/TANGENT deltas only.");
282
+ const D = (k) => {
283
+ if (u[k] === void 0)
284
+ return;
285
+ const P = h(u[k]);
286
+ if (P.components !== 3 || P.componentType !== 5126 || P.normalized || P.count !== g.count)
287
+ throw new n("format", "[Nova3D] Morph deltas require matching FLOAT VEC3 accessors.");
288
+ return new Float32Array(P.values);
289
+ }, O = D("POSITION") ?? new Float32Array(g.count * 3), $ = D("NORMAL");
290
+ if ($ && !F)
291
+ throw new n("format", "[Nova3D] Morph NORMAL requires base NORMAL.");
292
+ oe.push({ positions: O, normals: $ });
293
+ }
294
+ const V = (d) => {
295
+ if (!j && !oe.length)
296
+ return;
297
+ const u = d ? X : g.count, D = (k) => d && E ? E.values[k] : k, O = j ? new Uint16Array(u * 4) : void 0, $ = j ? new Float32Array(u * 4) : void 0;
298
+ if (j)
299
+ for (let k = 0; k < u; k++) {
300
+ const P = D(k), Z = Array.from(U.values.subarray(P * 4, P * 4 + 4)).reduce((R, ne) => R + ne, 0);
301
+ if (!Number.isFinite(Z) || Z <= 1e-6)
302
+ throw new n("format", "[Nova3D] Imported skin weights must have a positive sum.");
303
+ for (let R = 0; R < 4; R++) {
304
+ const ne = j.values[P * 4 + R];
305
+ b(ne, "skin joint", 255), O[k * 4 + R] = ne, $[k * 4 + R] = U.values[P * 4 + R] / Z;
306
+ }
307
+ }
308
+ return { joints: O, weights: $, flatNormals: !F, targets: oe.map((k) => {
309
+ if (!d)
310
+ return k;
311
+ const P = new Float32Array(u * 3), Z = k.normals ? new Float32Array(u * 3) : void 0;
312
+ for (let R = 0; R < u; R++) {
313
+ const ne = D(R);
314
+ P.set(k.positions.subarray(ne * 3, ne * 3 + 3), R * 3), Z && Z.set(k.normals.subarray(ne * 3, ne * 3 + 3), R * 3);
315
+ }
316
+ return { positions: P, normals: Z };
317
+ }) };
318
+ }, re = r ? "linear" : void 0, le = (d, u) => {
319
+ if (!r)
320
+ return;
321
+ const D = new Float32Array(d * 4);
322
+ for (let O = 0; O < d; O++)
323
+ te(D, O * 4, u(O));
324
+ if (!ce(D))
325
+ throw new n("format", "[Nova3D] COLOR_0 exceeds finite Float32 range.");
326
+ return D;
327
+ };
328
+ if (J !== "triangles") {
329
+ const d = new Float32Array(g.values), u = F ? Ge(F) : void 0, D = H ? new Float32Array(H.values) : void 0, O = A ? new Float32Array(A.values) : void 0, $ = E ? g.count > 65535 ? new Uint32Array(E.values) : new Uint16Array(E.values) : void 0;
330
+ if (!ce(d) || D && !ce(D) || O && !ce(O))
331
+ throw new n("format", "[Nova3D] Decoded attributes exceed finite Float32 range.");
332
+ return { positions: d, normals: u, uvs: D, uvs1: O, colors: le(g.count, (k) => k), colorSpace: re, indices: $, topology: J };
333
+ }
334
+ if (F) {
335
+ const d = new Float32Array(g.values), u = Ge(F), D = c.TANGENT === void 0 ? void 0 : Dt(h(c.TANGENT), g.count), O = H ? new Float32Array(H.values) : void 0, $ = A ? new Float32Array(A.values) : void 0, k = E ? g.count > 65535 ? new Uint32Array(E.values) : new Uint16Array(E.values) : void 0;
336
+ if (!ce(d) || !ce(u) || O && !ce(O) || $ && !ce($))
337
+ throw new n("format", "[Nova3D] Decoded attributes exceed finite Float32 range.");
338
+ return { positions: d, normals: u, uvs: O, uvs1: $, tangents: D, colors: le(g.count, (P) => P), colorSpace: re, indices: k, deformation: V(!1) };
339
+ }
340
+ if (X > e)
341
+ throw new n("budget", "[Nova3D] Flat-normal expansion exceeds vertex budget.");
342
+ const z = new Float32Array(X * 3), L = new Float32Array(X * 3), I = H ? new Float32Array(X * 2) : void 0, M = A ? new Float32Array(X * 2) : void 0;
343
+ for (let d = 0; d < X; d++) {
344
+ const u = E ? E.values[d] : d;
345
+ z.set(g.values.subarray(u * 3, u * 3 + 3), d * 3), I && I.set(H.values.subarray(u * 2, u * 2 + 2), d * 2), M && M.set(A.values.subarray(u * 2, u * 2 + 2), d * 2);
346
+ }
347
+ for (let d = 0; d < X; d += 3) {
348
+ const u = d * 3, D = (d + 1) * 3, O = (d + 2) * 3, $ = z[D] - z[u], k = z[D + 1] - z[u + 1], P = z[D + 2] - z[u + 2], Z = z[O] - z[u], R = z[O + 1] - z[u + 1], ne = z[O + 2] - z[u + 2], Ne = k * ne - P * R, ie = P * Z - $ * ne, ae = $ * R - k * Z, we = Math.hypot(Ne, ie, ae), ve = we > 0 ? [Ne / we, ie / we, ae / we] : [0, 0, 0];
349
+ for (let ye = 0; ye < 3; ye++)
350
+ L.set(ve, (d + ye) * 3);
351
+ }
352
+ if (!ce(z) || !ce(L) || I && !ce(I) || M && !ce(M))
353
+ throw new n("format", "[Nova3D] Decoded flat attributes exceed finite Float32 range.");
354
+ return { positions: z, normals: L, uvs: I, uvs1: M, colors: le(X, (d) => E ? E.values[d] : d), colorSpace: re, deformation: V(!0) };
355
+ }
356
+ function ce(t) {
357
+ for (let o = 0; o < t.length; o++)
358
+ if (!Number.isFinite(t[o]))
359
+ return !1;
360
+ return !0;
361
+ }
362
+ function Dt(t, o) {
363
+ if (t.components !== 4 || t.count !== o || !(t.componentType === 5126 ? !t.normalized : [5120, 5122].includes(t.componentType) && t.normalized))
364
+ throw new n("format", "[Nova3D] TANGENT requires FLOAT or normalized signed 8/16-bit VEC4 matching positions.");
365
+ const e = new Float32Array(t.values);
366
+ for (let s = 0; s < e.length; s += 4)
367
+ e[s + 3] = e[s + 3] < 0 ? -1 : 1;
368
+ if (!ce(e))
369
+ throw new n("format", "[Nova3D] TANGENT exceeds finite Float32 range.");
370
+ return e;
371
+ }
372
+ function Ge(t) {
373
+ const o = new Float32Array(t.values);
374
+ for (let e = 0; e < o.length; e += 3) {
375
+ const s = Math.sqrt(o[e] * o[e] + o[e + 1] * o[e + 1] + o[e + 2] * o[e + 2]);
376
+ if (!Number.isFinite(s) || s < 1e-6)
377
+ throw new n("format", "[Nova3D] glTF normals must be finite and nonzero.");
378
+ Math.abs(s - 1) > 1e-6 && (o[e] /= s, o[e + 1] /= s, o[e + 2] /= s);
379
+ }
380
+ return o;
381
+ }
382
+ function At() {
383
+ return new Promise((t) => {
384
+ if (typeof MessageChannel != "function") {
385
+ setTimeout(t, 0);
386
+ return;
387
+ }
388
+ const o = new MessageChannel();
389
+ o.port1.onmessage = () => {
390
+ o.port1.close(), t();
391
+ }, o.port2.postMessage(null);
392
+ });
393
+ }
394
+ const je = /* @__PURE__ */ new Set(["KHR_materials_unlit", "KHR_lights_punctual", "KHR_draco_mesh_compression", "EXT_meshopt_compression", "KHR_texture_basisu", "KHR_texture_transform", "KHR_materials_ior", "KHR_materials_emissive_strength", "KHR_materials_clearcoat", "KHR_materials_sheen", "KHR_materials_iridescence", "KHR_materials_anisotropy", "KHR_materials_specular", "KHR_materials_transmission", "KHR_materials_volume", "KHR_mesh_quantization", "EXT_mesh_gpu_instancing"]);
395
+ function C(t, o, e = 0, s = 1) {
396
+ const h = t === void 0 ? o : t;
397
+ if (typeof h != "number" || !Number.isFinite(h) || h < e || h > s)
398
+ throw new n("format", "[Nova3D] glTF numeric property exceeds its supported range.");
399
+ return h;
400
+ }
401
+ function pe(t, o, e = 0, s = 1) {
402
+ if (t === void 0)
403
+ return [...o];
404
+ if (!Array.isArray(t) || t.length !== o.length)
405
+ throw new n("format", "[Nova3D] Invalid glTF vector.");
406
+ return t.map((h) => C(h, 0, e, s));
407
+ }
408
+ function Je(t) {
409
+ const o = me(t.extensions).KHR_texture_transform, e = o !== void 0 && f(o, "texture transform").texCoord !== void 0 ? f(o, "texture transform").texCoord : t.texCoord ?? 0;
410
+ if (e !== 0 && e !== 1)
411
+ throw new n("format", "[Nova3D] glTF textures support TEXCOORD_0 and TEXCOORD_1.");
412
+ return e;
413
+ }
414
+ function xe(t) {
415
+ if (t === void 0)
416
+ return null;
417
+ const o = f(t, "texture info"), e = Je(o), s = me(o.extensions).KHR_texture_transform;
418
+ if (s === void 0)
419
+ return e === 0 ? null : { texCoord: e };
420
+ const h = f(s, "texture transform"), c = (y, g) => pe(y, g, -65504, 65504);
421
+ return { texCoord: e, offset: c(h.offset, [0, 0]), rotation: C(h.rotation, 0, -1e6, 1e6), scale: c(h.scale, [1, 1]) };
422
+ }
423
+ function Te(t) {
424
+ return t <= 31308e-7 ? 12.92 * t : 1.055 * t ** (1 / 2.4) - 0.055;
425
+ }
426
+ function me(t) {
427
+ return t === void 0 ? {} : f(t, "extensions");
428
+ }
429
+ function ee(t, o, e) {
430
+ return t === void 0 ? [] : he(t, o, e);
431
+ }
432
+ function _t(t) {
433
+ const o = f(t, "camera");
434
+ if (o.type === "perspective") {
435
+ const e = f(o.perspective, "perspective camera"), s = C(e.znear, Number.NaN, Number.MIN_VALUE, 1e12), h = e.zfar === void 0 ? s * 1e4 : C(e.zfar, Number.NaN, s * (1 + 1e-6), 1e12);
436
+ return { type: "perspective", fov: C(e.yfov, Number.NaN, Number.MIN_VALUE, Math.PI * (1 - 1e-6)), near: s, far: h };
437
+ }
438
+ if (o.type === "orthographic") {
439
+ const e = f(o.orthographic, "orthographic camera"), s = C(e.znear, Number.NaN, 0, 1e12), h = C(e.zfar, Number.NaN, s * (1 + 1e-6) + Number.MIN_VALUE, 1e12);
440
+ return { type: "orthographic", verticalSize: 2 * C(e.ymag, Number.NaN, Number.MIN_VALUE, 1e12), near: s, far: h };
441
+ }
442
+ throw new n("format", "[Nova3D] glTF camera type must be perspective or orthographic.");
443
+ }
444
+ function It(t, o, e) {
445
+ const s = ee(t.nodes, "nodes", o.limits.maxNodes), h = new Int32Array(s.length).fill(-1), c = ee(me(t.extensions).KHR_lights_punctual === void 0 ? void 0 : f(me(t.extensions).KHR_lights_punctual, "punctual lights").lights, "lights", o.limits.maxNodes), y = ee(t.cameras, "cameras", o.limits.maxNodes).map(_t), g = s.map((H, A) => {
446
+ const r = f(H, "node"), _ = r.camera === void 0 ? void 0 : y[b(r.camera, "camera index", y.length - 1)];
447
+ let G;
448
+ if (r.matrix !== void 0) {
449
+ if (r.translation !== void 0 || r.rotation !== void 0 || r.scale !== void 0)
450
+ throw new n("format", "[Nova3D] glTF node matrix and TRS are mutually exclusive.");
451
+ G = ct(new Float32Array(pe(r.matrix, Array.from(Xe()), -Number.MAX_VALUE, Number.MAX_VALUE)));
452
+ } else {
453
+ const V = pe(r.rotation, [0, 0, 0, 1], -1, 1);
454
+ if (Math.abs(Math.hypot(...V) - 1) > 1e-3)
455
+ throw new n("format", "[Nova3D] glTF quaternion must be normalized.");
456
+ G = lt(mt(), { position: pe(r.translation, [0, 0, 0], -Number.MAX_VALUE, Number.MAX_VALUE), quaternion: V, scale: pe(r.scale, [1, 1, 1], -Number.MAX_VALUE, Number.MAX_VALUE) });
457
+ }
458
+ if (G.scale.some((V) => Math.abs(V) < 1e-12) || !Array.from(ut(G)).every(Number.isFinite))
459
+ throw new n("unsupported", "[Nova3D] Singular or non-Float32 node transforms are outside the static glTF subset.");
460
+ const J = ee(r.children, "node children", o.limits.maxNodes).map((V) => b(V, "child index", s.length - 1));
461
+ for (const V of J) {
462
+ if (V === A || h[V] !== -1)
463
+ throw new n("format", "[Nova3D] glTF graph must have unique parents.");
464
+ h[V] = A;
465
+ }
466
+ const E = r.mesh === void 0 ? void 0 : b(r.mesh, "mesh index", e - 1), X = me(r.extensions).KHR_lights_punctual;
467
+ let te;
468
+ if (X !== void 0) {
469
+ const V = f(c[b(f(X, "node light").light, "light index", c.length - 1)], "light"), re = V.type;
470
+ if (re !== "directional" && re !== "point" && re !== "spot")
471
+ throw new n("unsupported", "[Nova3D] Unsupported glTF light kind.");
472
+ const le = V.spot === void 0 ? {} : f(V.spot, "spot light"), z = C(le.innerConeAngle, 0, 0, Math.PI / 2), L = C(le.outerConeAngle, Math.PI / 4, 0, Math.PI / 2);
473
+ if (z > L || L <= 0 || L >= Math.PI / 2)
474
+ throw new n("format", "[Nova3D] Invalid glTF spot cone.");
475
+ const I = pe(V.color, [1, 1, 1]).map(Te);
476
+ te = { kind: re, color: [I[0], I[1], I[2], 1], intensity: C(V.intensity, 1, 0, 1e12), range: V.range === void 0 ? 0 : C(V.range, 0, Number.MIN_VALUE, 1e12), innerConeAngle: z, outerConeAngle: L };
477
+ }
478
+ const j = r.skin === void 0 ? void 0 : b(r.skin, "skin index", ee(t.skins, "skins", o.limits.maxNodes).length - 1);
479
+ if (j !== void 0 && E === void 0)
480
+ throw new n("format", "[Nova3D] Skin requires a mesh reference.");
481
+ const U = r.weights === void 0 ? void 0 : he(r.weights, "node weights", 8).map((V) => C(V, 0, -34028234663852886e22, 34028234663852886e22));
482
+ return { name: typeof r.name == "string" && r.name ? r.name : void 0, transform: G, children: J, mesh: E, light: te, camera: _, skin: j, weights: U };
483
+ }), F = new Uint8Array(s.length);
484
+ for (let H = 0; H < s.length; H++) {
485
+ if (F[H])
486
+ continue;
487
+ const A = [{ index: H, exit: !1 }];
488
+ for (; A.length; ) {
489
+ const r = A.pop();
490
+ if (r.exit) {
491
+ F[r.index] = 2;
492
+ continue;
493
+ }
494
+ if (F[r.index] === 1)
495
+ throw new n("format", "[Nova3D] glTF hierarchy has a cycle.");
496
+ if (F[r.index] !== 2) {
497
+ F[r.index] = 1, A.push({ ...r, exit: !0 });
498
+ for (const _ of g[r.index].children)
499
+ A.push({ index: _, exit: !1 });
500
+ }
501
+ }
502
+ }
503
+ const Q = he(t.scenes, "scenes", o.limits.maxNodes).map((H) => {
504
+ const A = ee(f(H, "scene").nodes, "scene roots", o.limits.maxNodes).map((r) => b(r, "scene root index", s.length - 1));
505
+ if (new Set(A).size !== A.length || A.some((r) => h[r] !== -1))
506
+ throw new n("format", "[Nova3D] Invalid glTF scene roots.");
507
+ return A;
508
+ });
509
+ if (!Q.length)
510
+ throw new n("format", "[Nova3D] This glTF subset requires an explicit scene.");
511
+ return { nodes: g, scenes: Q, defaultScene: b(t.scene ?? 0, "default scene", Q.length - 1) };
512
+ }
513
+ async function $e(t, o, e) {
514
+ try {
515
+ return await Ot(t, o, e);
516
+ } catch (s) {
517
+ throw nt(s);
518
+ }
519
+ }
520
+ async function Ot(t, o, e) {
521
+ e.check();
522
+ const s = new st(), h = [], c = pt(t, e.limits.maxJSONBytes), y = f(c.json, "glTF"), g = f(y.asset, "asset");
523
+ if (g.version !== "2.0" || g.minVersion !== void 0 && g.minVersion !== "2.0")
524
+ throw new n("unsupported", "[Nova3D] Only the declared glTF2.0 subset is supported.");
525
+ const F = ee(y.extensionsRequired, "required extensions", 256);
526
+ for (const L of F)
527
+ if (typeof L != "string" || !je.has(L))
528
+ throw new n("unsupported", "[Nova3D] Unknown required glTF extension.");
529
+ for (const L of ee(y.extensionsUsed, "used extensions", 256))
530
+ typeof L == "string" && !je.has(L) && h.push(Fe("unsupported", `glTF extension ${L} is not supported and was ignored.`));
531
+ for (const [L, I] of [["KHR_draco_mesh_compression", o.decoders?.draco], ["EXT_meshopt_compression", o.decoders?.meshopt], ["KHR_texture_basisu", o.decoders?.ktx2]])
532
+ if (F.includes(L) && !I)
533
+ throw new n("unsupported", "[Nova3D] A required glTF decoder was not provided.");
534
+ const Q = ee(y.meshes, "meshes", e.limits.maxParts), H = It(y, e, Q.length), A = ee(y.buffers, "buffers", e.limits.maxNodes), r = ee(y.bufferViews, "bufferViews", e.limits.maxParts * 16), _ = ee(y.accessors, "accessors", e.limits.maxParts * 16), G = /* @__PURE__ */ new Map(), J = (L) => {
535
+ const I = b(L, "buffer index", A.length - 1);
536
+ return G.has(I) || G.set(I, (async () => {
537
+ const M = f(A[I], "buffer"), d = b(M.byteLength, "buffer byteLength", e.limits.maxBufferBytes);
538
+ if (d < 1)
539
+ throw new n("format", "[Nova3D] Buffer byteLength must be positive.");
540
+ if (M.uri !== void 0) {
541
+ if (typeof M.uri != "string")
542
+ throw new n("format", "[Nova3D] Invalid buffer URI.");
543
+ const u = await e.read(M.uri, "buffer", o.baseUrl, d);
544
+ if (u.byteLength !== d)
545
+ throw new n("format", "[Nova3D] Buffer length differs from its descriptor.");
546
+ return u;
547
+ }
548
+ if (I === 0 && c.binary) {
549
+ if (c.binary.byteLength < d || c.binary.byteLength - d > 3)
550
+ throw new n("format", "[Nova3D] GLB BIN padding or byteLength is invalid.");
551
+ return e.consumeBuffer(d), c.binary.subarray(0, d);
552
+ }
553
+ throw new n("unsupported", "[Nova3D] Buffer has no readable source; a required decoder or fallback is missing.");
554
+ })()), G.get(I);
555
+ }, E = /* @__PURE__ */ new Map(), X = (L) => {
556
+ const I = b(L, "bufferView index", r.length - 1);
557
+ return E.has(I) || E.set(I, (async () => {
558
+ const M = f(r[I], "bufferView"), d = b(M.byteOffset ?? 0, "bufferView offset"), u = b(M.byteLength, "bufferView length", e.limits.maxBufferBytes), D = M.byteStride === void 0 ? void 0 : b(M.byteStride, "bufferView stride", 252);
559
+ if (u < 1 || D !== void 0 && (D < 4 || D % 4 !== 0))
560
+ throw new n("format", "[Nova3D] Invalid bufferView layout.");
561
+ const O = f(A[b(M.buffer, "bufferView buffer", A.length - 1)], "buffer");
562
+ if (d + u > b(O.byteLength, "buffer byteLength", e.limits.maxBufferBytes))
563
+ throw new n("format", "[Nova3D] bufferView exceeds its declared buffer.");
564
+ const $ = me(M.extensions).EXT_meshopt_compression;
565
+ if ($ !== void 0 && o.decoders?.meshopt) {
566
+ const P = f($, "meshopt bufferView"), Z = b(P.count, "meshopt count", e.limits.maxVertices * 16), R = b(P.byteStride, "meshopt byteStride", 256), ne = b(P.byteOffset ?? 0, "meshopt offset"), Ne = b(P.byteLength, "meshopt length", e.limits.maxBufferBytes), ie = P.mode, ae = P.filter ?? "NONE";
567
+ if (ie !== "ATTRIBUTES" && ie !== "TRIANGLES" && ie !== "INDICES" || ae !== "NONE" && ae !== "OCTAHEDRAL" && ae !== "QUATERNION" && ae !== "EXPONENTIAL" || Z < 1 || Z * R !== u || D !== void 0 && D !== R || ie === "ATTRIBUTES" && (R < 4 || R % 4 !== 0) || ie !== "ATTRIBUTES" && (![2, 4].includes(R) || ae !== "NONE") || ie === "TRIANGLES" && Z % 3 !== 0 || ae === "OCTAHEDRAL" && ![4, 8].includes(R) || ae === "QUATERNION" && R !== 8 || ae === "EXPONENTIAL" && R % 4 !== 0)
568
+ throw new n("format", "[Nova3D] Invalid meshopt mode/filter/layout.");
569
+ const we = await J(P.buffer);
570
+ if (ne + Ne > we.byteLength)
571
+ throw new n("format", "[Nova3D] Compressed view exceeds source buffer.");
572
+ e.consumeBuffer(u);
573
+ const ve = await e.wait(o.decoders.meshopt(we.slice(ne, ne + Ne), { count: Z, byteStride: R, mode: ie, filter: ae, signal: e.signal }));
574
+ if (e.check(), !(ve instanceof Uint8Array) || ve.byteLength !== u)
575
+ throw new n("format", "[Nova3D] Meshopt decoder returned the wrong byte length.");
576
+ return { data: ve.slice(), stride: D, offset: d };
577
+ }
578
+ return { data: (await J(M.buffer)).subarray(d, d + u), stride: D, offset: d };
579
+ })()), E.get(I);
580
+ }, te = [], j = /* @__PURE__ */ new Map(), U = async (L) => {
581
+ const I = b(L, "accessor index", _.length - 1), M = f(_[I], "accessor");
582
+ if (j.has(I))
583
+ return j.get(I);
584
+ const d = { SCALAR: 1, VEC2: 2, VEC3: 3, VEC4: 4, MAT4: 16 }, u = typeof M.type == "string" ? d[M.type] : 0, D = b(M.count, "accessor count", e.limits.maxVertices * 16);
585
+ if (!u || D < 1)
586
+ throw new n("format", "[Nova3D] Invalid accessor size.");
587
+ if (e.consumeAccessor(D * u * 8), M.bufferView !== void 0) {
588
+ const $ = b(M.bufferView, "accessor view", r.length - 1);
589
+ te[$] = await X($);
590
+ }
591
+ if (M.sparse !== void 0) {
592
+ const $ = f(M.sparse, "sparse accessor");
593
+ for (const k of ["indices", "values"]) {
594
+ const P = f($[k], "sparse column"), Z = b(P.bufferView, "sparse view", r.length - 1);
595
+ te[Z] = await X(Z);
596
+ }
597
+ }
598
+ const O = Nt(M, te, e.limits.maxVertices * 16);
599
+ return j.set(I, O), O;
600
+ }, oe = [], V = [], re = [], le = [], z = /* @__PURE__ */ new Set();
601
+ try {
602
+ const L = ee(y.images, "images", e.limits.maxParts), I = ee(y.textures, "textures", e.limits.maxParts), M = ee(y.samplers, "samplers", e.limits.maxParts), d = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map(), O = async (v) => {
603
+ let a = d.get(v);
604
+ if (!a) {
605
+ const i = f(L[v], "image");
606
+ if (i.uri !== void 0) {
607
+ if (typeof i.uri != "string")
608
+ throw new n("format", "[Nova3D] Invalid image URI.");
609
+ a = await e.read(i.uri, "image", o.baseUrl);
610
+ } else if (i.bufferView !== void 0)
611
+ a = (await X(i.bufferView)).data, e.consumeImageEncoded(a.byteLength);
612
+ else
613
+ throw new n("format", "[Nova3D] Image has no source.");
614
+ d.set(v, a);
615
+ }
616
+ return a;
617
+ }, $ = /* @__PURE__ */ new Map();
618
+ let k = 0;
619
+ const P = () => {
620
+ k--;
621
+ }, Z = (v) => {
622
+ let a = $.get(v);
623
+ return a || (k++, a = (async () => {
624
+ const i = f(L[v], "image");
625
+ if (i.mimeType !== void 0 && (typeof i.mimeType != "string" || !["image/png", "image/jpeg"].includes(i.mimeType)))
626
+ throw new n("unsupported", "[Nova3D] Image MIME type is outside the PNG/JPEG subset.");
627
+ const l = await O(v), m = await e.wait(ot(l, { signal: e.signal, maxEncodedBytes: e.limits.maxEncodedImageBytes, maxDecodedBytes: e.limits.maxDecodedImageBytes, maxDimension: e.limits.maxImageDimension }));
628
+ try {
629
+ e.check(), e.consumeImage(m.width * m.height * 4);
630
+ } catch (K) {
631
+ throw m.image.close(), K;
632
+ }
633
+ const w = i.mimeType ?? (l[0] === 137 && l[1] === 80 ? "image/png" : l[0] === 255 && l[1] === 216 ? "image/jpeg" : void 0);
634
+ return w === void 0 ? m : { ...m, mimeType: w };
635
+ })(), a.then(P, P), $.set(v, a), le.push(a)), a;
636
+ };
637
+ if (typeof createImageBitmap == "function") {
638
+ const v = /* @__PURE__ */ new Set(), a = (i, l) => {
639
+ if (!(l > 4 || i === null || typeof i != "object"))
640
+ for (const [m, w] of Object.entries(i)) {
641
+ const K = m.endsWith("Texture") && w !== null && typeof w == "object" ? w.index : void 0;
642
+ Number.isSafeInteger(K) ? v.add(K) : a(w, l + 1);
643
+ }
644
+ };
645
+ a(Array.isArray(y.materials) ? y.materials : [], 0);
646
+ for (const i of v) {
647
+ const l = I[i], m = l?.extensions?.KHR_texture_basisu !== void 0 && !!o.decoders?.ktx2, w = l?.source;
648
+ !m && Number.isSafeInteger(w) && w >= 0 && w < L.length && Z(w);
649
+ }
650
+ }
651
+ const R = async (v, a) => {
652
+ if (v === void 0)
653
+ return null;
654
+ const i = f(v, "texture info");
655
+ Je(i);
656
+ const l = b(i.index, "texture index", I.length - 1), m = `${l}/${a}`;
657
+ if (D.has(m))
658
+ return D.get(m);
659
+ const w = f(I[l], "texture"), K = me(w.extensions).KHR_texture_basisu, N = K !== void 0 && !!o.decoders?.ktx2, x = b(N ? f(K, "basis texture").source : w.source, "image index", L.length - 1);
660
+ f(L[x], "image");
661
+ let p;
662
+ if (N) {
663
+ const de = `${x}/${a}`;
664
+ if (!u.has(de)) {
665
+ const De = await O(x), Y = await e.wait(o.decoders.ktx2(De.slice(), { colorSpace: a, signal: e.signal, maxDecodedImageBytes: e.limits.maxDecodedImageBytes, maxImageDimension: e.limits.maxImageDimension }));
666
+ if (e.check(), !Number.isSafeInteger(Y.width) || !Number.isSafeInteger(Y.height) || Y.width < 1 || Y.height < 1 || Y.width > e.limits.maxImageDimension || Y.height > e.limits.maxImageDimension || !(Y.data instanceof Uint8Array || Y.data instanceof Float32Array) || Y.data.length !== Y.width * Y.height * 4)
667
+ throw new n("format", "[Nova3D] Image decoder returned invalid or oversized pixels.");
668
+ if (Y.colorSpace !== void 0 && Y.colorSpace !== a)
669
+ throw new n("format", "[Nova3D] KTX2 output colorSpace differs from its material role.");
670
+ e.consumeImage(Y.data.byteLength), u.set(de, { ...Y, data: Y.data.slice() });
671
+ }
672
+ p = u.get(de);
673
+ } else
674
+ p = await Z(x);
675
+ const q = w.sampler === void 0 ? {} : f(M[b(w.sampler, "sampler index", M.length - 1)], "sampler"), W = q.magFilter ?? 9729, S = q.minFilter ?? 9987, T = q.wrapS ?? 10497, B = q.wrapT ?? 10497, se = /* @__PURE__ */ new Map([[9728, "nearest"], [9729, "linear"], [9984, "nearest-mipmap-nearest"], [9985, "linear-mipmap-nearest"], [9986, "nearest-mipmap-linear"], [9987, "linear-mipmap-linear"]]), ue = /* @__PURE__ */ new Map([[33071, "clamp"], [33648, "mirror"], [10497, "repeat"]]);
676
+ if (W !== 9728 && W !== 9729 || typeof S != "number" || !se.has(S) || typeof T != "number" || typeof B != "number" || !ue.has(T) || !ue.has(B))
677
+ throw new n("format", "[Nova3D] Invalid glTF sampler enum.");
678
+ "image" in p || e.consumeImage(p.data.byteLength), e.check();
679
+ const fe = { colorSpace: a, filter: W === 9728 ? "nearest" : "linear", minFilter: se.get(S), magFilter: W === 9728 ? "nearest" : "linear", mipmaps: S >= 9984, wrapS: ue.get(T), wrapT: ue.get(B) }, ge = "image" in p ? s.createTexture({ image: p.image, ...fe }) : s.createTexture({ ...p, ...fe });
680
+ return re.push(ge), D.set(m, ge), "image" in p && (z.add(p.image), ge._mimeType = p.mimeType), ge;
681
+ }, ne = ee(y.materials, "materials", e.limits.maxParts), Ne = async (v, a) => {
682
+ const i = f(v, "material"), l = i.pbrMetallicRoughness === void 0 ? {} : f(i.pbrMetallicRoughness, "PBR material"), m = pe(l.baseColorFactor, [1, 1, 1, 1]), w = pe(i.emissiveFactor, [0, 0, 0]), K = i.alphaMode ?? "OPAQUE";
683
+ if (K !== "OPAQUE" && K !== "MASK" && K !== "BLEND" || typeof (i.doubleSided ?? !1) != "boolean")
684
+ throw new n("format", "[Nova3D] Invalid glTF material alpha/side policy.");
685
+ const N = { alphaMode: K === "OPAQUE" ? "opaque" : K === "MASK" ? "mask" : "blend", alphaCutoff: C(i.alphaCutoff, 0.5), side: i.doubleSided ? "double" : "front" }, x = a !== void 0 || me(i.extensions).KHR_materials_unlit !== void 0;
686
+ let p;
687
+ if (a === "points")
688
+ p = { type: "basic", ...N, color: [Te(m[0]), Te(m[1]), Te(m[2]), m[3]] };
689
+ else if (x)
690
+ p = { type: "basic", ...N, color: [Te(m[0]), Te(m[1]), Te(m[2]), m[3]], map: await R(l.baseColorTexture, "srgb"), mapTransform: xe(l.baseColorTexture) };
691
+ else {
692
+ const W = me(i.extensions), S = async (Ae, et) => {
693
+ const Ue = await R(Ae, et);
694
+ return Ue ? { texture: Ue, transform: xe(Ae) } : null;
695
+ }, T = (Ae) => W[Ae] === void 0 ? null : f(W[Ae], Ae), B = {}, se = T("KHR_materials_ior");
696
+ se && (B.ior = C(se.ior, 1.5, 1, 5));
697
+ const ue = T("KHR_materials_emissive_strength");
698
+ ue && (B.emissiveStrength = C(ue.emissiveStrength, 1, 0, 1e6));
699
+ const fe = T("KHR_materials_clearcoat");
700
+ fe && (B.clearcoat = { factor: C(fe.clearcoatFactor, 0), roughness: C(fe.clearcoatRoughnessFactor, 0), map: await S(fe.clearcoatTexture, "linear"), roughnessMap: await S(fe.clearcoatRoughnessTexture, "linear"), normalMap: await S(fe.clearcoatNormalTexture, "linear"), normalScale: fe.clearcoatNormalTexture === void 0 ? 1 : C(f(fe.clearcoatNormalTexture, "clearcoat normal").scale, 1, -100, 100) });
701
+ const ge = T("KHR_materials_sheen");
702
+ ge && (B.sheen = { colorFactor: pe(ge.sheenColorFactor, [0, 0, 0]), roughness: C(ge.sheenRoughnessFactor, 0), colorMap: await S(ge.sheenColorTexture, "srgb"), roughnessMap: await S(ge.sheenRoughnessTexture, "linear") });
703
+ const de = T("KHR_materials_iridescence");
704
+ de && (B.iridescence = { factor: C(de.iridescenceFactor, 0), ior: C(de.iridescenceIor, 1.3, 1, 5), thicknessRange: [C(de.iridescenceThicknessMinimum, 100, 0, 1e5), C(de.iridescenceThicknessMaximum, 400, 0, 1e5)], map: await S(de.iridescenceTexture, "linear"), thicknessMap: await S(de.iridescenceThicknessTexture, "linear") });
705
+ const De = T("KHR_materials_anisotropy");
706
+ De && (B.anisotropy = { strength: C(De.anisotropyStrength, 0), rotation: C(De.anisotropyRotation, 0, -1e3, 1e3), map: await S(De.anisotropyTexture, "linear") });
707
+ const Y = T("KHR_materials_specular");
708
+ Y && (B.specular = { factor: C(Y.specularFactor, 1), colorFactor: pe(Y.specularColorFactor, [1, 1, 1], 0, 65504), map: await S(Y.specularTexture, "linear"), colorMap: await S(Y.specularColorTexture, "srgb") });
709
+ const Oe = T("KHR_materials_transmission"), be = T("KHR_materials_volume");
710
+ Oe && (B.transmission = { factor: C(Oe.transmissionFactor, 0), map: await S(Oe.transmissionTexture, "linear"), thickness: be ? C(be.thicknessFactor, 0, 0, 1e6) : 0, thicknessMap: be ? await S(be.thicknessTexture, "linear") : null, attenuationDistance: be?.attenuationDistance === void 0 ? Number.POSITIVE_INFINITY : C(be.attenuationDistance, 1, 1e-9, 1e30), attenuationColorLinear: be ? pe(be.attenuationColor, [1, 1, 1]) : [1, 1, 1] }), p = { type: "pbr", ...N, ...B, baseColorFactor: m, metallicFactor: C(l.metallicFactor, 1), roughnessFactor: C(l.roughnessFactor, 1), emissiveFactor: w, baseColorMap: await R(l.baseColorTexture, "srgb"), metallicRoughnessMap: await R(l.metallicRoughnessTexture, "linear"), normalMap: await R(i.normalTexture, "linear"), occlusionMap: await R(i.occlusionTexture, "linear"), emissiveMap: await R(i.emissiveTexture, "srgb"), normalScale: i.normalTexture === void 0 ? 1 : C(f(i.normalTexture, "normal texture").scale, 1, 0, 65504), occlusionStrength: i.occlusionTexture === void 0 ? 1 : C(f(i.occlusionTexture, "occlusion texture").strength, 1), baseColorMapTransform: xe(l.baseColorTexture), metallicRoughnessMapTransform: xe(l.metallicRoughnessTexture), normalMapTransform: xe(i.normalTexture), occlusionMapTransform: xe(i.occlusionTexture), emissiveMapTransform: xe(i.emissiveTexture) };
711
+ }
712
+ e.check();
713
+ const q = s.createMaterial(p);
714
+ return V.push(q), q;
715
+ }, ie = /* @__PURE__ */ new Map(), ae = async (v, a = "triangles") => {
716
+ const i = v === void 0 ? -1 : b(v, "material index", ne.length - 1), l = i === -1 ? {} : ne[i], m = a === "triangles" || a === "lines" && me(f(l, "material").extensions).KHR_materials_unlit !== void 0, w = m ? `${i}` : `${i}|${a}`;
717
+ return ie.has(w) || ie.set(w, await Ne(l, m ? void 0 : a)), ie.get(w);
718
+ }, we = /* @__PURE__ */ new Set(["POSITION", "NORMAL", "TEXCOORD_0", "TEXCOORD_1", "COLOR_0", "JOINTS_0", "WEIGHTS_0"]), ve = /* @__PURE__ */ new Set();
719
+ let ye = e.limits.maxVertices, Qe = 0;
720
+ const _e = [], Ye = async (v) => {
721
+ if (++Qe > e.limits.maxParts)
722
+ throw new n("budget", "[Nova3D] Primitive budget exceeded.");
723
+ const a = f(v, "primitive"), i = me(a.extensions).KHR_draco_mesh_compression, l = f(a.attributes, "primitive attributes");
724
+ let m;
725
+ if (i !== void 0 && o.decoders?.draco) {
726
+ if (a.targets !== void 0 || l.JOINTS_0 !== void 0 || l.WEIGHTS_0 !== void 0 || l.TEXCOORD_1 !== void 0)
727
+ throw new n("unsupported", "[Nova3D] The explicit Draco adapter currently decodes static columns only.");
728
+ const w = f(i, "Draco primitive"), K = f(w.attributes, "Draco attributes"), N = {};
729
+ for (const T of Object.keys(K)) {
730
+ if (!["POSITION", "NORMAL", "TEXCOORD_0"].includes(T))
731
+ throw new n("unsupported", "[Nova3D] Draco attribute is outside the static subset.");
732
+ N[T] = b(K[T], "Draco attribute id");
733
+ }
734
+ const x = (await X(w.bufferView)).data, p = await e.wait(o.decoders.draco(x.slice(), { attributes: Object.freeze(N), signal: e.signal, maxVertices: ye, maxAccessorBytes: e.limits.maxAccessorBytes }));
735
+ if (e.check(), !(p.positions instanceof Float32Array) || p.positions.length % 3 !== 0 || p.positions.length / 3 > ye || p.topology !== void 0 && p.topology !== "triangles")
736
+ throw new n("format", "[Nova3D] Draco decoder returned invalid geometry.");
737
+ const q = f(_[b(l.POSITION, "position accessor", _.length - 1)], "position accessor");
738
+ if (p.positions.length / 3 !== q.count)
739
+ throw new n("format", "[Nova3D] Draco position count differs from metadata.");
740
+ for (const [T, B, se] of [["NORMAL", p.normals, 3], ["TEXCOORD_0", p.uvs, 2]])
741
+ if (l[T] !== void 0) {
742
+ const ue = f(_[b(l[T], "attribute accessor", _.length - 1)], "attribute accessor");
743
+ if (!B || B.length / se !== ue.count)
744
+ throw new n("format", "[Nova3D] Draco attribute count differs from metadata.");
745
+ }
746
+ if (a.indices !== void 0) {
747
+ const T = f(_[b(a.indices, "index accessor", _.length - 1)], "index accessor");
748
+ if (!p.indices || p.indices.length !== T.count)
749
+ throw new n("format", "[Nova3D] Draco index count differs from metadata.");
750
+ }
751
+ const W = /* @__PURE__ */ new Map();
752
+ for (const [T, B, se, ue] of [["POSITION", p.positions, 3, 5126], ["NORMAL", p.normals, 3, 5126], ["TEXCOORD_0", p.uvs, 2, 5126], ["INDICES", p.indices, 1, 5125]])
753
+ if (B) {
754
+ if (T === "INDICES" && !(B instanceof Uint16Array || B instanceof Uint32Array) || T !== "INDICES" && !(B instanceof Float32Array) || B.length % se !== 0)
755
+ throw new n("unsupported", "[Nova3D] Draco decoder returned unsupported columns.");
756
+ e.consumeAccessor(B.length * 8), W.set(T, { values: new Float64Array(B), count: B.length / se, components: se, componentType: ue, normalized: !1 });
757
+ }
758
+ const S = { POSITION: "POSITION" };
759
+ p.normals && (S.NORMAL = "NORMAL"), p.uvs && (S.TEXCOORD_0 = "TEXCOORD_0"), m = He({ attributes: S, indices: p.indices ? "INDICES" : void 0 }, (T) => {
760
+ const B = W.get(String(T));
761
+ if (!B)
762
+ throw new n("format", "[Nova3D] Missing decoded attribute.");
763
+ return B;
764
+ }, ye);
765
+ } else {
766
+ const w = f(a.attributes, "primitive attributes"), K = /* @__PURE__ */ new Map();
767
+ for (const N of [...Object.values(w), ...a.targets === void 0 ? [] : he(a.targets, "morph targets", 8).flatMap((x) => Object.values(f(x, "morph target"))), ...a.indices === void 0 ? [] : [a.indices]])
768
+ K.set(N, await U(N));
769
+ m = He(a, (N) => {
770
+ const x = K.get(N);
771
+ if (!x)
772
+ throw new n("format", "[Nova3D] Missing primitive accessor.");
773
+ return x;
774
+ }, ye);
775
+ }
776
+ for (const w of Object.keys(l))
777
+ (w === "TANGENT" ? m.tangents === void 0 : !we.has(w)) && ve.add(w);
778
+ return a.targets !== void 0 && he(a.targets, "morph targets", 8).some((w) => f(w, "morph target").TANGENT !== void 0) && ve.add("morph TANGENT"), ye -= m.positions.length / 3, e.consumeAccessor(2 * (m.positions.byteLength + (m.normals?.byteLength ?? 0) + (m.uvs?.byteLength ?? 0) + (m.uvs1?.byteLength ?? 0) + (m.tangents?.byteLength ?? 0) + (m.indices?.byteLength ?? 0))), m.deformation && e.consumeAccessor(2 * ((m.deformation.joints?.byteLength ?? 0) + (m.deformation.weights?.byteLength ?? 0) + m.deformation.targets.reduce((w, K) => w + K.positions.byteLength + (K.normals?.byteLength ?? 0), 0))), { primitive: a, columns: m };
779
+ }, Le = [];
780
+ let Me = performance.now(), Re = !1, Se;
781
+ try {
782
+ for (const v of Q) {
783
+ const a = f(v, "mesh"), i = he(a.primitives, "primitives", e.limits.maxParts), l = [];
784
+ Le.push(l);
785
+ for (const m of i)
786
+ l.push(await Ye(m)), k > 0 && performance.now() - Me > 1 && (await At(), Me = performance.now());
787
+ }
788
+ } catch (v) {
789
+ Re = !0, Se = v;
790
+ }
791
+ for (const v of Le) {
792
+ const a = [];
793
+ for (const { primitive: i, columns: l } of v) {
794
+ const m = await ae(i.material, l.topology);
795
+ {
796
+ const x = m._readOptions(), p = m._textureTransforms().sets;
797
+ (x.type === "pbr" ? [x.baseColorMap, x.metallicRoughnessMap, x.normalMap, x.occlusionMap, x.emissiveMap] : [x.map]).forEach((W, S) => {
798
+ if (W && !(p & 1 << S ? l.uvs1 : l.uvs))
799
+ throw new n("format", `[Nova3D] Imported mapped material requires ${p & 1 << S ? "TEXCOORD_1" : "TEXCOORD_0"}.`);
800
+ });
801
+ }
802
+ e.check();
803
+ const { deformation: w, ...K } = l, N = s.createGeometry(K);
804
+ oe.push(N), l.deformation && N._setDeformation(l.deformation), a.push({ geometry: N, material: m });
805
+ }
806
+ _e.push(a);
807
+ }
808
+ if (Re)
809
+ throw Se;
810
+ const Ie = Q.map((v, a) => {
811
+ const i = f(v, "mesh"), l = _e[a].map((w) => w.geometry._readDeformation()?.targets.length ?? 0);
812
+ if (l.some((w) => w !== l[0]))
813
+ throw new n("format", "[Nova3D] All mesh primitives must declare the same morph target count.");
814
+ const m = i.weights === void 0 ? Array.from({ length: l[0] ?? 0 }).fill(0) : he(i.weights, "mesh weights", 8).map((w) => C(w, 0, -34028234663852886e22, 34028234663852886e22));
815
+ if (m.length !== (l[0] ?? 0))
816
+ throw new n("format", "[Nova3D] Mesh weights differ from its target count.");
817
+ return Object.freeze(m);
818
+ });
819
+ for (const v of H.nodes)
820
+ if (v.weights && (v.mesh === void 0 || v.weights.length !== Ie[v.mesh].length))
821
+ throw new n("format", "[Nova3D] Node morph weights differ from its mesh targets.");
822
+ const Ce = ee(y.nodes, "nodes", e.limits.maxNodes);
823
+ for (let v = 0; v < Ce.length; v++) {
824
+ const a = me(f(Ce[v], "node").extensions).EXT_mesh_gpu_instancing;
825
+ if (a === void 0)
826
+ continue;
827
+ const i = H.nodes[v];
828
+ if (i.mesh === void 0 || i.skin !== void 0)
829
+ throw new n("format", "[Nova3D] EXT_mesh_gpu_instancing needs an unskinned mesh node.");
830
+ const l = f(f(a, "mesh instancing").attributes, "instancing attributes");
831
+ let m = -1;
832
+ const w = async (q, W, S) => {
833
+ if (l[q] === void 0)
834
+ return;
835
+ const T = await U(l[q]);
836
+ if (!(T.components === W && (T.componentType === 5126 ? !T.normalized : S && [5120, 5122].includes(T.componentType) && T.normalized)) || m >= 0 && T.count !== m)
837
+ throw new n("unsupported", `[Nova3D] Instance ${q} has an unsupported layout or count.`);
838
+ return m = T.count, T.values;
839
+ }, K = await w("TRANSLATION", 3, !1), N = await w("ROTATION", 4, !0), x = await w("SCALE", 3, !1);
840
+ if (m < 1 || m > e.limits.maxVertices)
841
+ throw new n("format", "[Nova3D] EXT_mesh_gpu_instancing needs 1 to maxVertices instances.");
842
+ const p = new Float32Array(m * 10);
843
+ for (let q = 0; q < m; q++) {
844
+ const W = q * 10;
845
+ p.set(K ? K.subarray(q * 3, q * 3 + 3) : [0, 0, 0], W), p.set(N ? N.subarray(q * 4, q * 4 + 4) : [0, 0, 0, 1], W + 3), p.set(x ? x.subarray(q * 3, q * 3 + 3) : [1, 1, 1], W + 7);
846
+ }
847
+ i.instances = p;
848
+ }
849
+ const ke = [];
850
+ for (const v of ee(y.skins, "skins", e.limits.maxNodes)) {
851
+ const a = f(v, "skin"), i = he(a.joints, "skin joints", 256).map((N) => b(N, "joint node", H.nodes.length - 1));
852
+ if (!i.length || new Set(i).size !== i.length)
853
+ throw new n("format", "[Nova3D] Skin requires1..256 unique joints.");
854
+ const l = new Float32Array(i.length * 16);
855
+ if (a.inverseBindMatrices === void 0)
856
+ for (let N = 0; N < i.length; N++)
857
+ l.set(Xe(), N * 16);
858
+ else {
859
+ const N = await U(a.inverseBindMatrices);
860
+ if (N.components !== 16 || N.componentType !== 5126 || N.normalized || N.count < i.length)
861
+ throw new n("format", "[Nova3D] Skin inverse binds require sufficient FLOAT MAT4 columns.");
862
+ l.set(N.values.subarray(0, i.length * 16));
863
+ for (let x = 0; x < i.length; x++)
864
+ if (l[x * 16 + 3] !== 0 || l[x * 16 + 7] !== 0 || l[x * 16 + 11] !== 0 || l[x * 16 + 15] !== 1)
865
+ throw new n("format", "[Nova3D] Inverse bind matrices must be affine.");
866
+ }
867
+ if (!l.every(Number.isFinite))
868
+ throw new n("format", "[Nova3D] Skin inverse binds exceed Float32.");
869
+ const m = /* @__PURE__ */ new Map();
870
+ H.nodes.forEach((N, x) => N.children.forEach((p) => m.set(p, x)));
871
+ const w = (N) => {
872
+ const x = /* @__PURE__ */ new Set();
873
+ let p = N;
874
+ for (; p !== void 0; )
875
+ x.add(p), p = m.get(p);
876
+ return x;
877
+ };
878
+ if ([...w(i[0])].find((N) => i.every((x) => w(x).has(N))) === void 0)
879
+ throw new n("format", "[Nova3D] Skin joints require a common root.");
880
+ if (a.skeleton !== void 0) {
881
+ const N = b(a.skeleton, "skin skeleton", H.nodes.length - 1);
882
+ i.every((x) => w(x).has(N)) || h.push(Fe("ignored", "glTF skin skeleton is not a common joint ancestor and was ignored."));
883
+ }
884
+ e.consumeAccessor(l.byteLength), ke.push({ joints: Object.freeze(i), inverseBindMatrices: l });
885
+ }
886
+ const Ve = [];
887
+ for (const v of ee(y.animations, "animations", e.limits.maxNodes)) {
888
+ const a = f(v, "animation"), i = he(a.samplers, "animation samplers", 1024), l = [];
889
+ let m = 0;
890
+ for (const w of he(a.channels, "animation channels", 1024)) {
891
+ const K = f(w, "animation channel"), N = f(K.target, "animation target"), x = b(N.node, "animation node", H.nodes.length - 1), p = N.path;
892
+ if (p !== "translation" && p !== "rotation" && p !== "scale" && p !== "weights")
893
+ throw new n("unsupported", "[Nova3D] Static/transform animation subset excludes this target channel.");
894
+ const q = f(i[b(K.sampler, "animation sampler", i.length - 1)], "animation sampler"), W = q.interpolation ?? "LINEAR";
895
+ if (W !== "STEP" && W !== "LINEAR" && W !== "CUBICSPLINE")
896
+ throw new n("unsupported", "[Nova3D] Unsupported animation interpolation.");
897
+ const S = await U(q.input), T = await U(q.output), B = H.nodes[x];
898
+ if (p !== "weights" && f(ee(y.nodes, "nodes", e.limits.maxNodes)[x], "node").matrix !== void 0)
899
+ throw new n("format", "[Nova3D] Animated TRS targets cannot declare matrix.");
900
+ const se = p === "weights" ? B.mesh === void 0 ? 0 : Ie[B.mesh].length : p === "rotation" ? 4 : 3;
901
+ if (se === 0)
902
+ throw new n("format", "[Nova3D] Weight animation requires morph targets.");
903
+ if (S.components !== 1 || S.componentType !== 5126 || S.normalized || T.components !== (p === "weights" ? 1 : se) || T.componentType !== 5126 || T.normalized || T.count !== S.count * (W === "CUBICSPLINE" ? 3 : 1) * (p === "weights" ? se : 1))
904
+ throw new n("format", "[Nova3D] Animation accessor layout/count differs from its channel.");
905
+ m = Math.max(m, S.values[S.values.length - 1]), e.consumeAccessor(S.values.byteLength + T.values.byteLength), l.push({ target: String(x), channel: p === "weights" ? "weights" : p === "translation" ? "position" : p === "rotation" ? "quaternion" : "scale", valueSize: se, times: S.values, values: T.values, interpolation: W === "STEP" ? "step" : W === "LINEAR" ? "linear" : "cubic-spline" });
906
+ }
907
+ e.check(), Ve.push(tt({ name: a.name, duration: m, tracks: l }));
908
+ }
909
+ e.check();
910
+ for (const v of [...ve].sort())
911
+ h.push(Fe("ignored", `glTF attribute ${v} is not used and was ignored.`));
912
+ const Ze = new rt({ ...H, meshes: _e, geometry: oe, materials: V, textures: re, animations: Ve, skins: ke, meshWeights: Ie, bitmaps: [...z] }, h);
913
+ for (const v of le)
914
+ v.then((a) => {
915
+ z.has(a.image) || a.image.close();
916
+ }, () => {
917
+ });
918
+ return Ze;
919
+ } catch (L) {
920
+ for (const I of [...V, ...oe, ...re])
921
+ I.destroy();
922
+ for (const I of le)
923
+ I.then((M) => M.image.close(), () => {
924
+ });
925
+ throw L;
926
+ }
927
+ }
928
+ function We(t, o, e) {
929
+ return ze(t, o, e), t.decoders !== void 0 && ze(t.decoders, ht, "glTF decoders"), { ...t, limits: t.limits ? { ...t.limits } : void 0, decoders: t.decoders ? { ...t.decoders } : void 0 };
930
+ }
931
+ async function kt(t, o = {}) {
932
+ const e = We(o, dt, "glTF parse"), s = new qe(e);
933
+ try {
934
+ if (typeof t == "string" && t.length > s.limits.maxJSONBytes || Be(t) && t.byteLength > s.limits.maxJSONBytes + s.limits.maxBufferBytes)
935
+ throw new n("budget", "[Nova3D] Container exceeds byte budget before copying.");
936
+ const h = typeof t == "string" ? new TextEncoder().encode(t) : Be(t) ? new Uint8Array(at(t)) : (() => {
937
+ throw new n("invalid-option", "[Nova3D] parseGLTF accepts JSON text or bytes.");
938
+ })();
939
+ if (h.byteLength > s.limits.maxJSONBytes + s.limits.maxBufferBytes)
940
+ throw new n("budget", "[Nova3D] Container exceeds byte budget.");
941
+ return await $e(h, e, s);
942
+ } finally {
943
+ s.dispose();
944
+ }
945
+ }
946
+ async function Vt(t, o = {}) {
947
+ const e = We(o, ft, "glTF load"), s = new qe(e);
948
+ try {
949
+ const h = it(t).href, c = await s.read(h, "container", void 0, s.limits.maxJSONBytes + s.limits.maxBufferBytes);
950
+ return await $e(c, { ...e, baseUrl: h }, s);
951
+ } finally {
952
+ s.dispose();
953
+ }
954
+ }
955
+ export {
956
+ ft as a,
957
+ ht as g,
958
+ Vt as l,
959
+ kt as p
960
+ };