@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,1949 @@
1
+ import { p as v, m as re, o as me, q as ge, h as _e } from "./nova-color-parser-BCN_rFRN.js";
2
+ import { g as ye, e as Ie, x as ne, y as we, z as ve } from "./NovaNode-CBZ-Ol-W.js";
3
+ import { mat3 as b } from "gl-matrix";
4
+ import { r as be } from "./nova-text-paint-CcntsRjI.js";
5
+ import { isPath as Se } from "@typedworks/geometry";
6
+ import { g as Re } from "./nova-mesh-registry-B7Xz5mhU.js";
7
+ var H = /* @__PURE__ */ ((r) => (r.Web2D = "2d", r.WebGL = "webgl", r))(H || {});
8
+ let P, z;
9
+ function se(r) {
10
+ const e = typeof Intl > "u" ? void 0 : Intl.Segmenter;
11
+ if (typeof e != "function") {
12
+ P = void 0, z = void 0;
13
+ let t = 0;
14
+ const n = [];
15
+ for (const s of r) {
16
+ const i = t;
17
+ t += s.length;
18
+ const o = n[n.length - 1];
19
+ s === `
20
+ ` && o?.value === "\r" ? (o.value = `\r
21
+ `, o.end = t) : n.push({ value: s, index: i, end: t });
22
+ }
23
+ return n;
24
+ }
25
+ return (z !== e || !P) && (P = new e(void 0, { granularity: "grapheme" }), z = e), Array.from(P.segment(r), (t) => ({
26
+ value: t.segment,
27
+ index: t.index,
28
+ end: t.index + t.segment.length
29
+ }));
30
+ }
31
+ function Ne(r, e, t, n) {
32
+ if (Number.isNaN(t) || t < 0)
33
+ return "";
34
+ if ((n ?? r(e)) <= t)
35
+ return e;
36
+ const s = "...";
37
+ if (r(s) > t)
38
+ return "";
39
+ const i = se(e);
40
+ let o = 0, a = Math.max(0, i.length - 1);
41
+ for (; o < a; ) {
42
+ const c = Math.ceil((o + a) / 2), h = i[c - 1].end;
43
+ r(`${e.slice(0, h)}${s}`) <= t ? o = c : a = c - 1;
44
+ }
45
+ return `${e.slice(0, o === 0 ? 0 : i[o - 1].end)}${s}`;
46
+ }
47
+ let Be = 0;
48
+ class C {
49
+ constructor(e, t) {
50
+ this.revision = t, this._segments = Object.freeze(e.slice());
51
+ let n = 0;
52
+ for (const s of this._segments)
53
+ n += s.values.length;
54
+ this.length = n;
55
+ }
56
+ length;
57
+ _segments;
58
+ _materialized;
59
+ at(e) {
60
+ const t = e < 0 ? this.length + e : e;
61
+ if (t < 0 || t >= this.length)
62
+ return;
63
+ let n = t;
64
+ for (const s of this._segments) {
65
+ if (n < s.values.length)
66
+ return s.values[n];
67
+ n -= s.values.length;
68
+ }
69
+ }
70
+ [Symbol.iterator]() {
71
+ if (this._segments.length === 1)
72
+ return this._segments[0].values[Symbol.iterator]();
73
+ let e = 0, t = 0;
74
+ const n = {
75
+ [Symbol.iterator]: () => n,
76
+ next: () => {
77
+ for (; e < this._segments.length; ) {
78
+ const s = this._segments[e].values;
79
+ if (t < s.length)
80
+ return { done: !1, value: s[t++] };
81
+ e += 1, t = 0;
82
+ }
83
+ return { done: !0, value: void 0 };
84
+ }
85
+ };
86
+ return n;
87
+ }
88
+ forEach(e) {
89
+ let t = 0;
90
+ for (const n of this)
91
+ e(n, t), t += 1;
92
+ }
93
+ find(e) {
94
+ let t = 0;
95
+ for (const n of this) {
96
+ if (e(n, t))
97
+ return n;
98
+ t += 1;
99
+ }
100
+ }
101
+ some(e) {
102
+ let t = 0;
103
+ for (const n of this) {
104
+ if (e(n, t))
105
+ return !0;
106
+ t += 1;
107
+ }
108
+ return !1;
109
+ }
110
+ every(e) {
111
+ let t = 0;
112
+ for (const n of this) {
113
+ if (!e(n, t))
114
+ return !1;
115
+ t += 1;
116
+ }
117
+ return !0;
118
+ }
119
+ materialize() {
120
+ return this._materialized || (this._materialized = Object.freeze(Array.from(this))), this._materialized;
121
+ }
122
+ segmentSlices() {
123
+ return this._segments;
124
+ }
125
+ }
126
+ class ie {
127
+ constructor(e, t) {
128
+ this.revision = t, this._sequences = Object.freeze(e.slice());
129
+ let n = 0;
130
+ for (const s of this._sequences)
131
+ n += s.length;
132
+ this.length = n;
133
+ }
134
+ length;
135
+ _sequences;
136
+ _materialized;
137
+ at(e) {
138
+ const t = e < 0 ? this.length + e : e;
139
+ if (t < 0 || t >= this.length)
140
+ return;
141
+ let n = t;
142
+ for (const s of this._sequences) {
143
+ if (n < s.length)
144
+ return s.at(n);
145
+ n -= s.length;
146
+ }
147
+ }
148
+ [Symbol.iterator]() {
149
+ if (this._sequences.length === 1)
150
+ return this._sequences[0][Symbol.iterator]();
151
+ let e = 0, t;
152
+ const n = {
153
+ [Symbol.iterator]: () => n,
154
+ next: () => {
155
+ for (; e < this._sequences.length; ) {
156
+ t ??= this._sequences[e][Symbol.iterator]();
157
+ const s = t.next();
158
+ if (!s.done)
159
+ return s;
160
+ e += 1, t = void 0;
161
+ }
162
+ return { done: !0, value: void 0 };
163
+ }
164
+ };
165
+ return n;
166
+ }
167
+ forEach(e) {
168
+ let t = 0;
169
+ for (const n of this)
170
+ e(n, t), t += 1;
171
+ }
172
+ find(e) {
173
+ let t = 0;
174
+ for (const n of this) {
175
+ if (e(n, t))
176
+ return n;
177
+ t += 1;
178
+ }
179
+ }
180
+ some(e) {
181
+ let t = 0;
182
+ for (const n of this) {
183
+ if (e(n, t))
184
+ return !0;
185
+ t += 1;
186
+ }
187
+ return !1;
188
+ }
189
+ every(e) {
190
+ let t = 0;
191
+ for (const n of this) {
192
+ if (!e(n, t))
193
+ return !1;
194
+ t += 1;
195
+ }
196
+ return !0;
197
+ }
198
+ materialize() {
199
+ return this._materialized || (this._materialized = Object.freeze(Array.from(this))), this._materialized;
200
+ }
201
+ componentSequences() {
202
+ return this._sequences;
203
+ }
204
+ }
205
+ function xe(r) {
206
+ if (r instanceof C)
207
+ return r.segmentSlices();
208
+ if (r instanceof ie) {
209
+ const e = [];
210
+ for (const t of r.componentSequences()) {
211
+ const n = xe(t);
212
+ if (!n)
213
+ return;
214
+ e.push(...n);
215
+ }
216
+ return Object.freeze(e);
217
+ }
218
+ }
219
+ function D(r = [], e = 0, t = {}) {
220
+ const n = Object.freeze(Array.from(r));
221
+ return new C([Object.freeze({
222
+ id: t.id ?? `sequence:${e}`,
223
+ groupId: t.groupId ?? "main:root",
224
+ revision: e,
225
+ values: n
226
+ })], e);
227
+ }
228
+ function pt(r, e) {
229
+ return new ie(r, e);
230
+ }
231
+ class Te {
232
+ _namespace;
233
+ _commandId = 0;
234
+ _itemId = 0;
235
+ _handleId = 0;
236
+ _segmentId = 0;
237
+ _storageGeneration = 0;
238
+ _orderRevision = 0;
239
+ _instructionVersions = /* @__PURE__ */ new Map();
240
+ constructor(e) {
241
+ this._namespace = (++Be).toString(36);
242
+ }
243
+ nextCommandId() {
244
+ return `cmd:${this._namespace}:${(++this._commandId).toString(36)}`;
245
+ }
246
+ nextItemId() {
247
+ return `item:${this._namespace}:${(++this._itemId).toString(36)}`;
248
+ }
249
+ nextHandleId() {
250
+ return `handle:${this._namespace}:${(++this._handleId).toString(36)}`;
251
+ }
252
+ nextSegmentId(e) {
253
+ return `segment:${this._namespace}:${(++this._segmentId).toString(36)}:${e}`;
254
+ }
255
+ nextStorageGeneration() {
256
+ return this._storageGeneration += 1, this._storageGeneration;
257
+ }
258
+ nextOrderRevision() {
259
+ return this._orderRevision += 1, this._orderRevision;
260
+ }
261
+ nextInstructionVersion(e) {
262
+ const t = (this._instructionVersions.get(e) ?? 0) + 1;
263
+ return this._instructionVersions.set(e, t), t;
264
+ }
265
+ }
266
+ let ke = 0, Ce = 0;
267
+ function Oe(r, e = 0, t = D(), n = D(), s = !1) {
268
+ return Object.freeze({
269
+ id: `instructions:${(++Ce).toString(36)}:${r}`,
270
+ groupId: r,
271
+ version: e,
272
+ commands: t,
273
+ items: n,
274
+ reused: s
275
+ });
276
+ }
277
+ function Pe(r) {
278
+ return {
279
+ id: r.id,
280
+ ownerGeneration: ++ke,
281
+ ownerNodeId: r.ownerNodeId,
282
+ parentGroupId: r.parentGroupId,
283
+ layerId: r.layerId,
284
+ opacity: 1,
285
+ dirtyFlags: Ie(),
286
+ versions: ye(),
287
+ childGroupIds: [],
288
+ visible: !0,
289
+ lastCompiledVersion: 0,
290
+ lastRenderedVersion: 0
291
+ };
292
+ }
293
+ function Ae(r, e = r.childGroupIds) {
294
+ return Object.freeze({
295
+ ...r,
296
+ transform: r.transform ? b.clone(r.transform) : void 0,
297
+ clip: r.clip ? Object.freeze({ ...r.clip }) : void 0,
298
+ cachePolicy: r.cachePolicy ? Object.freeze({ ...r.cachePolicy }) : void 0,
299
+ dirtyFlags: Object.freeze({ ...r.dirtyFlags }),
300
+ versions: Object.freeze({ ...r.versions }),
301
+ chunkBounds: r.chunkBounds ? Object.freeze({ ...r.chunkBounds }) : void 0,
302
+ childGroupIds: Object.freeze(e.slice()),
303
+ bounds: r.bounds ? Object.freeze({ ...r.bounds }) : void 0
304
+ });
305
+ }
306
+ function k(r) {
307
+ return {
308
+ id: r.id,
309
+ nodeId: r.nodeId,
310
+ groupId: r.groupId,
311
+ layerId: r.layerId,
312
+ kind: r.kind,
313
+ order: r.order,
314
+ batchKey: r.batchKey,
315
+ schemaItem: r.schemaItem,
316
+ transform: r.transform,
317
+ clip: r.clip,
318
+ bounds: r.bounds
319
+ };
320
+ }
321
+ function V(r) {
322
+ switch (r.type) {
323
+ case "rect":
324
+ case "border":
325
+ case "line":
326
+ case "circle":
327
+ case "arc":
328
+ case "path":
329
+ case "polygon":
330
+ case "text":
331
+ case "icon":
332
+ case "nine-slice-image":
333
+ case "pattern-rect":
334
+ return r.type;
335
+ default:
336
+ return "custom";
337
+ }
338
+ }
339
+ function Q(r) {
340
+ if (r.type === "rect") {
341
+ const e = typeof r.styles?.background == "string" ? r.styles.background : "texture", t = r.styles?.border ? "border" : "none", n = r.styles?.radius ?? r.styles?.border?.radius ?? 0;
342
+ return `rect:${e}:${t}:${n}:${r.styles?.opacity ?? 1}`;
343
+ }
344
+ return r.type === "border" ? `border:${r.styles?.color ?? "none"}:${r.styles?.width ?? 0}:${r.styles?.opacity ?? 1}` : r.type === "text" ? `text:${r.styles?.font?.family ?? "sans"}:${r.styles?.font?.size ?? 12}:${r.styles?.font?.weight ?? "normal"}` : r.type === "icon" ? `icon:${typeof r.icon == "string" ? r.icon : "source"}` : r.type === "nine-slice-image" ? `nine-slice-image:${typeof r.image == "string" ? r.image : r.image.id}:${r.styles?.opacity ?? 1}` : r.type === "pattern-rect" ? `pattern-rect:${r.pattern.type}:${r.pattern.shape ?? "square"}:${r.pattern.color}:${r.styles?.opacity ?? 1}` : r.type;
345
+ }
346
+ function Y(r) {
347
+ if (r.type === "rect") {
348
+ const e = r.styles?.border, t = r.styles?.radius ?? e?.radius ?? 0, n = e?.width ?? 0, s = r.styles?.background;
349
+ return s && typeof s != "string" ? "texture-quad" : t > 0 || n > 0 ? "rounded-rect" : "plain-rect";
350
+ }
351
+ return r.type === "border" ? "border" : r.type === "line" ? "line" : r.type === "circle" ? "circle" : r.type === "arc" ? "arc" : r.type === "path" ? "path" : r.type === "polygon" ? "polygon" : r.type === "text" ? "text-run" : r.type === "icon" ? "icon" : r.type === "nine-slice-image" ? "nine-slice-image" : r.type === "pattern-rect" ? "pattern-rect" : "cached-group";
352
+ }
353
+ function Ee(r, e = 0) {
354
+ return {
355
+ id: r,
356
+ zIndex: e,
357
+ rootGroup: Pe({
358
+ id: `${r}:root`,
359
+ layerId: r
360
+ })
361
+ };
362
+ }
363
+ const oe = /* @__PURE__ */ new WeakMap(), ae = /* @__PURE__ */ new WeakSet();
364
+ function mt(r) {
365
+ return ae.has(r);
366
+ }
367
+ function L(r, e) {
368
+ return r !== e && r && typeof r == "object" && (Object.getPrototypeOf(r) === Object.prototype || Object.getPrototypeOf(r) === null) && Object.isFrozen(r) && Array.isArray(r.points) && ae.add(r), r;
369
+ }
370
+ const W = /* @__PURE__ */ new WeakSet(), F = /* @__PURE__ */ new WeakMap(), G = /* @__PURE__ */ new WeakMap(), gt = Object.freeze({
371
+ commit: () => {
372
+ },
373
+ abort: () => {
374
+ }
375
+ });
376
+ function O(r, e) {
377
+ return oe.set(r, e), r;
378
+ }
379
+ function Me(r) {
380
+ return oe.get(r) ?? r;
381
+ }
382
+ function X(r, e, t = {}) {
383
+ const n = R(
384
+ r,
385
+ /* @__PURE__ */ new WeakMap(),
386
+ t.freeze !== !1
387
+ );
388
+ return e && typeof n == "object" && n !== null && O(n, e), t.freeze === !1 ? n : L(n, r);
389
+ }
390
+ function E(r, e) {
391
+ const t = r.count, n = Object.getPrototypeOf(r);
392
+ if (!Number.isSafeInteger(t) || t <= 0 || n !== Object.prototype && n !== null || ce(r))
393
+ return X(r, r);
394
+ const s = /* @__PURE__ */ new WeakMap(), i = {};
395
+ s.set(r, i);
396
+ for (const o of Reflect.ownKeys(r)) {
397
+ const a = r[o], c = typeof o == "string" && Object.hasOwn(e, o) ? e[o] : void 0;
398
+ i[o] = c === void 0 ? R(a, s, !0) : ze(a, t * c, s);
399
+ }
400
+ return O(Object.freeze(i), r);
401
+ }
402
+ function _t(r, e) {
403
+ if (e) {
404
+ W.add(r);
405
+ return;
406
+ }
407
+ W.delete(r), F.delete(r);
408
+ }
409
+ function A(r, e) {
410
+ if (!W.has(r) || typeof r.revision != "number" || typeof r.staticRevision != "number")
411
+ return E(r, e);
412
+ const t = F.get(r);
413
+ if (t && t.count === r.count && t.revision === r.revision && t.staticRevision === r.staticRevision)
414
+ return t;
415
+ const n = E(r, e);
416
+ return F.set(r, n), n;
417
+ }
418
+ function $e(r, e = {}) {
419
+ const t = e.snapshotVersion, n = e.sourceIdentity === r && typeof t == "number" && Number.isFinite(t) && e.dirtyIndices === void 0;
420
+ if (!n && e.sourceIdentity === r && G.delete(r), n) {
421
+ const c = G.get(r);
422
+ if (c && c.snapshotVersion === t && c.contentVersion === e.contentVersion && c.semanticScope === e.semanticScope && c.length === r.length)
423
+ return c.snapshot;
424
+ }
425
+ const s = /* @__PURE__ */ new WeakMap(), i = r.map((c) => L(R(c, s, !0), c));
426
+ i.semanticScope = e.semanticScope, i.contentVersion = e.contentVersion, i.snapshotVersion = e.snapshotVersion, i.dirtyIndices = e.dirtyIndices === void 0 ? void 0 : R(e.dirtyIndices, s, !0);
427
+ const o = Object.freeze(i), a = O(o, e.sourceIdentity ?? r);
428
+ return n && G.set(r, {
429
+ snapshotVersion: t,
430
+ contentVersion: e.contentVersion,
431
+ semanticScope: e.semanticScope,
432
+ length: r.length,
433
+ snapshot: a
434
+ }), a;
435
+ }
436
+ function yt(r, e, t) {
437
+ const n = /* @__PURE__ */ new WeakMap(), s = r.slice();
438
+ for (const o of t.dirtyIndices)
439
+ s[o] = L(R(e[o], n, !0), e[o]);
440
+ s.semanticScope = t.semanticScope, s.contentVersion = t.contentVersion, s.dirtyIndices = R(t.dirtyIndices, n, !0);
441
+ const i = Object.freeze(s);
442
+ return O(i, t.sourceIdentity ?? e);
443
+ }
444
+ function R(r, e, t) {
445
+ if (r === null || typeof r != "object")
446
+ return r;
447
+ const n = r, s = e.get(n);
448
+ if (s !== void 0)
449
+ return s;
450
+ if (ce(r) || Se(r))
451
+ return r;
452
+ if (ArrayBuffer.isView(r))
453
+ return r instanceof DataView ? new DataView(
454
+ r.buffer.slice(r.byteOffset, r.byteOffset + r.byteLength)
455
+ ) : r.slice();
456
+ if (Array.isArray(r)) {
457
+ const a = [];
458
+ e.set(n, a);
459
+ for (const c of r)
460
+ a.push(R(c, e, t));
461
+ return t ? Object.freeze(a) : a;
462
+ }
463
+ const i = Object.getPrototypeOf(r);
464
+ if (i !== Object.prototype && i !== null)
465
+ return r;
466
+ const o = {};
467
+ e.set(n, o);
468
+ for (const a of Reflect.ownKeys(r))
469
+ o[a] = R(
470
+ r[a],
471
+ e,
472
+ t
473
+ );
474
+ return t ? Object.freeze(o) : o;
475
+ }
476
+ function ze(r, e, t) {
477
+ if (ArrayBuffer.isView(r) && !(r instanceof DataView))
478
+ return r.slice(0, e);
479
+ if (Array.isArray(r)) {
480
+ const n = Math.min(r.length, e), s = [];
481
+ for (let i = 0; i < n; i += 1)
482
+ s.push(R(r[i], t, !0));
483
+ return Object.freeze(s);
484
+ }
485
+ return R(r, t, !0);
486
+ }
487
+ function ce(r) {
488
+ return typeof r == "object" && r !== null && "__novaAssetRef" in r && r.__novaAssetRef === !0;
489
+ }
490
+ const de = /* @__PURE__ */ new WeakMap(), he = /* @__PURE__ */ new WeakMap(), M = {
491
+ x: "x",
492
+ y: "y",
493
+ width: "width",
494
+ height: "height",
495
+ color: "colors",
496
+ radius: "radii",
497
+ state: "states"
498
+ };
499
+ class Ge {
500
+ active = !0;
501
+ count;
502
+ _columns;
503
+ _changedColumns = /* @__PURE__ */ new Set();
504
+ _geometry = /* @__PURE__ */ new Set();
505
+ _paint = /* @__PURE__ */ new Set();
506
+ _onChange;
507
+ _revision = 0;
508
+ _staticRevision = 0;
509
+ _snapshot;
510
+ constructor(e) {
511
+ if (!Number.isSafeInteger(e.count) || e.count < 0)
512
+ throw new RangeError("[Nova] Batch count must be a nonnegative safe integer");
513
+ this.count = e.count, this._columns = {
514
+ x: new Float32Array(this.count),
515
+ y: new Float32Array(this.count),
516
+ width: new Float32Array(this.count).fill(1),
517
+ height: new Float32Array(this.count).fill(1),
518
+ colors: new Float32Array(this.count * 4),
519
+ radii: new Float32Array(this.count),
520
+ states: new Float32Array(this.count)
521
+ };
522
+ for (let t = 0; t < this.count; t++)
523
+ this._columns.colors[t * 4 + 3] = 1;
524
+ if (e.defaults) {
525
+ const t = J(e.defaults);
526
+ for (const [n, s] of t)
527
+ if (typeof s == "number")
528
+ this._columns[n].fill(s);
529
+ else
530
+ for (let i = 0; i < this.count; i++)
531
+ this._columns[n].set(s, i * 4);
532
+ }
533
+ e.columns && this.updateRange(0, e.columns), this._onChange = e.onChange, de.set(this, () => this._capture());
534
+ }
535
+ set(e, t) {
536
+ this._checkRange(e, 1);
537
+ const n = this._apply(e, J(t));
538
+ return n && this._onChange?.(), n;
539
+ }
540
+ updateRange(e, t) {
541
+ const n = Object.entries(t);
542
+ if (n.length === 0)
543
+ return this._checkRange(e, 0), !1;
544
+ const s = n[0][1].length;
545
+ this._checkRange(e, s);
546
+ const i = [];
547
+ for (const [a, c] of n) {
548
+ if (!Object.hasOwn(M, a) || c.length !== s)
549
+ throw new TypeError("[Nova] Batch columns must be known fields with equal lengths");
550
+ const h = M[a], f = h === "colors" ? 4 : 1, d = new Float32Array(s * f);
551
+ for (let p = 0; p < s; p++) {
552
+ const u = ue(a, c[p]);
553
+ typeof u == "number" ? d[p] = u : d.set(u, p * f);
554
+ }
555
+ i.push([h, d]);
556
+ }
557
+ let o = !1;
558
+ for (const [a, c] of i) {
559
+ const h = a === "colors" ? 4 : 1, f = this._columns[a], d = a === "x" || a === "y" || a === "width" || a === "height", p = d ? this._geometry : this._paint;
560
+ let u = !1;
561
+ for (let y = 0; y < s; y++)
562
+ for (let w = 0; w < h; w++) {
563
+ const x = (e + y) * h + w, l = c[y * h + w];
564
+ f[x] !== l && (f[x] = l, p.add(e + y), u = !0);
565
+ }
566
+ u && (this._changedColumns.add(a), this._revision += Number(d), this._staticRevision += +!d, o = !0);
567
+ }
568
+ return o && this._onChange?.(), o;
569
+ }
570
+ _checkRange(e, t) {
571
+ if (!Number.isSafeInteger(e) || !Number.isSafeInteger(t) || e < 0 || t < 0 || e > this.count - t)
572
+ throw new RangeError("[Nova] Batch update is outside its owned storage");
573
+ }
574
+ _apply(e, t) {
575
+ let n = !1, s = !1;
576
+ for (const [i, o] of t) {
577
+ const a = this._columns[i], c = typeof o == "number" ? [o] : o, h = i === "colors" ? e * 4 : e;
578
+ let f = !1;
579
+ for (let d = 0; d < c.length; d++)
580
+ a[h + d] !== c[d] && (a[h + d] = c[d], f = !0);
581
+ f && (this._changedColumns.add(i), i === "x" || i === "y" || i === "width" || i === "height" ? (n = !0, this._geometry.add(e)) : (s = !0, this._paint.add(e)));
582
+ }
583
+ return this._revision += Number(n), this._staticRevision += Number(s), n || s;
584
+ }
585
+ _capture() {
586
+ const e = this._snapshot;
587
+ if (e && this._changedColumns.size === 0)
588
+ return e;
589
+ const t = {};
590
+ for (const s of Object.keys(this._columns))
591
+ t[s] = e && !this._changedColumns.has(s) ? e[s] : this._columns[s].slice();
592
+ const n = Object.freeze({ count: this.count, ...t, revision: this._revision, staticRevision: this._staticRevision });
593
+ return O(n, this), he.set(n, {
594
+ geometryFrom: e?.revision,
595
+ paintFrom: e?.staticRevision,
596
+ geometry: Z(this._geometry),
597
+ paint: Z(this._paint)
598
+ }), this._snapshot = n, this._changedColumns.clear(), this._geometry.clear(), this._paint.clear(), n;
599
+ }
600
+ }
601
+ function It(r) {
602
+ return new Ge(r);
603
+ }
604
+ function je(r) {
605
+ return de.get(r)?.();
606
+ }
607
+ function He(r) {
608
+ return he.get(r);
609
+ }
610
+ function J(r) {
611
+ const e = Object.entries(r);
612
+ let t = 0;
613
+ for (const n of e) {
614
+ const [s, i] = n;
615
+ if (!Object.hasOwn(M, s))
616
+ throw new TypeError(`[Nova] Unknown batch field: ${s}`);
617
+ if (i === void 0)
618
+ continue;
619
+ const o = ue(s, i);
620
+ n[0] = M[s], n[1] = o, e[t++] = n;
621
+ }
622
+ return e.length = t, e;
623
+ }
624
+ function ue(r, e) {
625
+ if (r === "color") {
626
+ const t = typeof e == "string" ? v(e, 255) : void 0, n = t ? [t.r, t.g, t.b, t.a] : e;
627
+ if (!Array.isArray(n) || n.length !== 4 || !n.every((s) => typeof s == "number" && Number.isFinite(s) && s >= 0 && s <= 1))
628
+ throw new RangeError("[Nova] Batch color must be CSS color or four components in [0,1]");
629
+ return n.map(Math.fround);
630
+ }
631
+ if (typeof e != "number" || !Number.isFinite(Math.fround(e)) || (r === "width" || r === "height" || r === "radius") && e < 0)
632
+ throw new RangeError(`[Nova] Invalid batch ${r}`);
633
+ return Math.fround(e);
634
+ }
635
+ function Z(r) {
636
+ const e = [];
637
+ for (const t of [...r].sort((n, s) => n - s)) {
638
+ const n = e[e.length - 1];
639
+ n && n.end === t ? n.end++ : e.push({ start: t, end: t + 1 });
640
+ }
641
+ return e;
642
+ }
643
+ function De(r, e, t, n = 1) {
644
+ const s = r.styles?.font, i = (s?.size ?? 12) * n, o = s?.family ?? t.family, a = s?.style ?? "normal", c = s?.weight ?? "normal", h = (r.styles?.lineHeight ?? t.lineHeight) * n, f = r.text.split(/\r\n|\r|\n/), d = [];
645
+ let p = 0;
646
+ for (let u = 0; u < f.length; u += 1) {
647
+ const y = f[u].split(/(\*\*[^*]+\*\*|_[^_]+_)/g), w = [];
648
+ for (const l of y) {
649
+ if (!l)
650
+ continue;
651
+ const _ = /^\*\*.+\*\*$/.test(l), I = !_ && /^_.+_$/.test(l), m = _ ? l.slice(2, -2) : I ? l.slice(1, -1) : l, g = `${I ? "italic" : a} ${_ ? "bold" : c} ${i}px ${o}`, N = w[w.length - 1];
652
+ N?.font === g ? N.text += m : w.push({ text: m, font: g });
653
+ }
654
+ let x = 0;
655
+ for (const l of w) {
656
+ const _ = e(l.text, l.font);
657
+ d.push({ ...l, x, y: u * h, width: _ }), x += _;
658
+ }
659
+ p = Math.max(p, x);
660
+ }
661
+ return { runs: d, width: p, height: f.length * h, lineHeight: h };
662
+ }
663
+ function wt(r) {
664
+ const e = typeof r.styles?.background == "string" ? r.styles.background : void 0;
665
+ return {
666
+ fill: v(e, 0),
667
+ opacity: r.styles?.opacity ?? 1,
668
+ borderColor: v(r.styles?.border?.color, 0),
669
+ borderWidth: r.styles?.border?.width ?? 0,
670
+ borderRadius: r.styles?.radius ?? r.styles?.border?.radius ?? 0,
671
+ dashPattern: r.styles?.border?.dashPattern
672
+ };
673
+ }
674
+ function vt(r) {
675
+ return {
676
+ fill: v(void 0, 0),
677
+ opacity: r.styles?.opacity ?? 1,
678
+ borderColor: v(r.styles?.color, 255),
679
+ borderWidth: r.styles?.width ?? 1,
680
+ borderRadius: r.styles?.radius ?? 0,
681
+ dashPattern: r.styles?.dashPattern
682
+ };
683
+ }
684
+ function bt(r) {
685
+ const e = typeof r.styles?.background == "string" ? r.styles.background : void 0;
686
+ return {
687
+ fill: v(e, 0),
688
+ opacity: r.styles?.opacity ?? 1,
689
+ borderColor: v(r.styles?.border?.color, 0),
690
+ borderWidth: r.styles?.border?.width ?? 0,
691
+ borderRadius: r.radius,
692
+ dashPattern: r.styles?.border?.dashPattern
693
+ };
694
+ }
695
+ function St(r) {
696
+ return {
697
+ color: v(r.styles?.color, 255),
698
+ width: r.styles?.width ?? 1,
699
+ opacity: r.styles?.opacity ?? 1,
700
+ lineCap: r.styles?.lineCap ?? "butt"
701
+ };
702
+ }
703
+ function Rt(r) {
704
+ return {
705
+ color: v(r.styles?.color, 255),
706
+ width: r.styles?.width ?? 1,
707
+ opacity: r.styles?.opacity ?? 1,
708
+ dashPattern: r.styles?.dashPattern
709
+ };
710
+ }
711
+ function Nt(r) {
712
+ return {
713
+ fill: v(r.styles?.background, 0),
714
+ stroke: v(r.styles?.stroke, 0),
715
+ lineWidth: r.styles?.lineWidth ?? 0,
716
+ opacity: r.styles?.opacity ?? 1
717
+ };
718
+ }
719
+ function Bt(r) {
720
+ const e = r.styles?.font, t = e?.size ?? 12, n = e?.style ?? "normal", s = e?.weight ?? "normal", i = e?.family ?? "sans-serif", o = be(r);
721
+ return {
722
+ color: v(r.styles?.color, 255),
723
+ opacity: r.styles?.opacity ?? 1,
724
+ font: `${n} ${s} ${t}px ${i}`,
725
+ fontSize: t,
726
+ lineHeight: r.styles?.lineHeight ?? t,
727
+ padding: le(r.styles?.padding),
728
+ horizontalAlign: r.styles?.align?.horizontal ?? "left",
729
+ verticalAlign: r.styles?.align?.vertical ?? "top",
730
+ overflowAlign: r.styles?.align?.overflow ?? "start",
731
+ ellipsis: r.styles?.ellipsis ?? !1,
732
+ ...r.styles?.direction === void 0 ? {} : { direction: r.styles.direction },
733
+ ...o ? { paint: o } : {}
734
+ };
735
+ }
736
+ function le(r) {
737
+ if (!r)
738
+ return { left: 0, right: 0, top: 0, bottom: 0 };
739
+ if ("all" in r) {
740
+ const t = r.all ?? 0;
741
+ return { left: t, right: t, top: t, bottom: t };
742
+ }
743
+ if ("horizontal" in r || "vertical" in r)
744
+ return {
745
+ left: r.horizontal ?? 0,
746
+ right: r.horizontal ?? 0,
747
+ top: r.vertical ?? 0,
748
+ bottom: r.vertical ?? 0
749
+ };
750
+ const e = r;
751
+ return {
752
+ left: e.left ?? 0,
753
+ right: e.right ?? 0,
754
+ top: e.top ?? 0,
755
+ bottom: e.bottom ?? 0
756
+ };
757
+ }
758
+ function Ve(r) {
759
+ return r.styles?.wrap !== void 0 && r.styles.wrap !== "none";
760
+ }
761
+ function We(r, e, t = 1) {
762
+ const n = r.styles;
763
+ if (r.parser === "markdown")
764
+ throw new TypeError("Text wrapping currently requires the string parser");
765
+ if (n?.wrap !== "word" && n?.wrap !== "grapheme")
766
+ throw new TypeError("Unknown text wrapping mode");
767
+ const s = n.font?.size ?? 12, i = n.lineHeight ?? s * 1.2, o = n.maxLines ?? 1 / 0, a = le(n.padding);
768
+ if (![r.width, r.height, ...Object.values(a)].every((l) => Number.isFinite(l) && l >= 0) || ![s, i, t].every((l) => Number.isFinite(l) && l > 0) || n.maxLines !== void 0 && (!Number.isSafeInteger(o) || o <= 0))
769
+ throw new RangeError("Invalid wrapped text dimensions, font, padding or line limit");
770
+ const c = `${n.font?.style ?? "normal"} ${n.font?.weight ?? "normal"} ${s * t}px ${n.font?.family ?? "sans-serif"}`, h = Math.max(0, r.width - a.left - a.right) * t, f = Math.max(0, r.height - a.top - a.bottom) * t, d = [];
771
+ let p = !1;
772
+ if (h > 0) {
773
+ const l = r.text.split(/\r\n|\r|\n/);
774
+ for (let _ = 0; _ < l.length; _ += 1) {
775
+ const I = l[_], m = se(I);
776
+ let g = 0;
777
+ do {
778
+ if (d.length === o) {
779
+ p = !0;
780
+ break;
781
+ }
782
+ let N = g, S = Math.min(m.length, g + 1);
783
+ const $ = m[g]?.index ?? 0;
784
+ for (; S > N; ) {
785
+ if (e(I.slice($, m[S - 1].end), c) > h) {
786
+ S -= 1;
787
+ break;
788
+ }
789
+ if (N = S, S === m.length)
790
+ break;
791
+ S = Math.min(m.length, g + (S - g) * 2);
792
+ }
793
+ for (; N < S; ) {
794
+ const B = Math.ceil((N + S) / 2);
795
+ e(I.slice($, m[B - 1].end), c) <= h ? N = B : S = B - 1;
796
+ }
797
+ let T = Math.min(m.length, Math.max(g + 1, N));
798
+ if (n.wrap === "word" && T < m.length && !j(m[T].value)) {
799
+ for (let B = T - 1; B > g; B -= 1)
800
+ if (j(m[B].value)) {
801
+ T = B;
802
+ break;
803
+ }
804
+ }
805
+ const pe = m[T - 1]?.end ?? 0;
806
+ if (d.push(I.slice($, pe)), g = T, n.wrap === "word")
807
+ for (; g < m.length && j(m[g].value); )
808
+ g += 1;
809
+ } while (g < m.length);
810
+ if (p)
811
+ break;
812
+ }
813
+ }
814
+ if (p && n.ellipsis && d.length > 0) {
815
+ const l = d.length - 1, _ = d[l];
816
+ d[l] = e(`${_}...`, c) <= h ? `${_}...` : Ne((I) => e(I, c), _, h, 1 / 0);
817
+ }
818
+ const u = d.length * i * t, y = a.top * t + (n.align?.vertical === "middle" ? (f - u) / 2 : n.align?.vertical === "bottom" ? f - u : 0);
819
+ let w = 0;
820
+ return {
821
+ runs: d.map((l, _) => {
822
+ const I = e(l, c);
823
+ w = Math.max(w, I);
824
+ const m = I > h && n.align?.overflow !== "preserve" ? "left" : n.align?.horizontal, g = m === "center" ? (h - I) / 2 : m === "right" ? h - I : 0;
825
+ return { text: l, font: c, x: a.left * t + g, y: y + _ * i * t, width: I };
826
+ }),
827
+ width: w + (a.left + a.right) * t,
828
+ height: u + (a.top + a.bottom) * t,
829
+ lineHeight: i * t,
830
+ truncated: p
831
+ };
832
+ }
833
+ function j(r) {
834
+ return /^[\t\v\f ]+$/.test(r);
835
+ }
836
+ const q = Symbol("nova-render-dirty-items"), U = Symbol("nova-retained-paint-dirty");
837
+ class Fe {
838
+ itemIds = [];
839
+ _seenEpochByItemId = /* @__PURE__ */ new Map();
840
+ _epoch = 1;
841
+ _isIndexed = !1;
842
+ _hasTransformProvenance = !1;
843
+ _hasUnknownProvenance = !1;
844
+ get generation() {
845
+ return this._epoch;
846
+ }
847
+ get provenance() {
848
+ return this._hasTransformProvenance && this._hasUnknownProvenance ? "mixed" : this._hasTransformProvenance ? "transform" : this._hasUnknownProvenance ? "unknown" : "none";
849
+ }
850
+ enqueue(e) {
851
+ return this._hasUnknownProvenance = !0, this._ensureIndexed(), this._enqueue(e);
852
+ }
853
+ enqueueTransform(e) {
854
+ return this._hasTransformProvenance = !0, this._ensureIndexed(), this._enqueue(e);
855
+ }
856
+ enqueueBoundTransform(e) {
857
+ return this._hasTransformProvenance = !0, this._isIndexed ? this._enqueue(e) : (this.itemIds.push(e), !0);
858
+ }
859
+ _enqueue(e) {
860
+ return this._seenEpochByItemId.get(e) === this._epoch ? !1 : (this._seenEpochByItemId.set(e, this._epoch), this.itemIds.push(e), !0);
861
+ }
862
+ _ensureIndexed() {
863
+ if (!this._isIndexed) {
864
+ for (const e of this.itemIds)
865
+ this._seenEpochByItemId.set(e, this._epoch);
866
+ this._isIndexed = !0;
867
+ }
868
+ }
869
+ clear() {
870
+ if (this.itemIds.length = 0, this._isIndexed = !1, this._hasTransformProvenance = !1, this._hasUnknownProvenance = !1, this._epoch === Number.MAX_SAFE_INTEGER) {
871
+ this._seenEpochByItemId.clear(), this._epoch = 1;
872
+ return;
873
+ }
874
+ this._epoch += 1;
875
+ }
876
+ }
877
+ class qe {
878
+ nodeIds = [];
879
+ _seenEpochByNodeId = /* @__PURE__ */ new Map();
880
+ _epoch = 1;
881
+ enqueue(e) {
882
+ return this._seenEpochByNodeId.get(e) === this._epoch ? !1 : (this._seenEpochByNodeId.set(e, this._epoch), this.nodeIds.push(e), !0);
883
+ }
884
+ clear() {
885
+ if (this.nodeIds.length = 0, this._epoch === Number.MAX_SAFE_INTEGER) {
886
+ this._seenEpochByNodeId.clear(), this._epoch = 1;
887
+ return;
888
+ }
889
+ this._epoch += 1;
890
+ }
891
+ }
892
+ function Ue(r) {
893
+ const e = r;
894
+ return e[q] ??= new Fe(), e[q];
895
+ }
896
+ function xt(r) {
897
+ return r[q];
898
+ }
899
+ function Ke(r) {
900
+ const e = r;
901
+ return e[U] ??= new qe(), e[U];
902
+ }
903
+ function Tt(r) {
904
+ return r[U];
905
+ }
906
+ const Le = Object.freeze([]), K = /* @__PURE__ */ new WeakMap();
907
+ function fe(r, e) {
908
+ K.set(r, e?.size ? Object.freeze([...e]) : Le);
909
+ }
910
+ function kt(r) {
911
+ const e = K.get(r);
912
+ if (e)
913
+ return e;
914
+ const t = /* @__PURE__ */ new Set();
915
+ for (const n of r) {
916
+ if (n.type === "beginComposition")
917
+ for (const s of re(n.id))
918
+ t.add(s);
919
+ if (n.type === "clipPath")
920
+ for (const s of ne(n.id))
921
+ t.add(s);
922
+ if (n.type === "beginRenderTarget" || n.type === "drawRenderTarget") {
923
+ const s = n.targetId ?? n.target?.id;
924
+ s !== void 0 && t.add(s);
925
+ }
926
+ }
927
+ return fe(r, t), K.get(r);
928
+ }
929
+ let ee = 0;
930
+ function Xe() {
931
+ return ee += 1, ee;
932
+ }
933
+ function Qe() {
934
+ return {
935
+ compilerMs: 0,
936
+ backendMs: 0,
937
+ uploadMs: 0,
938
+ drawMs: 0,
939
+ drawCalls: 0,
940
+ batches: 0,
941
+ bufferDataCalls: 0,
942
+ bufferSubDataCalls: 0,
943
+ compiledGroups: 0,
944
+ commands: 0,
945
+ dirtyRangeCount: 0,
946
+ dirtyStreamRanges: 0,
947
+ fullUploads: 0,
948
+ gpuBufferCapacityBytes: 0,
949
+ items: 0,
950
+ groups: 0,
951
+ nodeRenderCalls: 0,
952
+ textRasterMs: 0,
953
+ textRasterCount: 0,
954
+ textCacheHits: 0,
955
+ textCacheMisses: 0,
956
+ textRasterDeferred: 0,
957
+ textAtlasPages: 0,
958
+ effectiveTextRasterScale: 0,
959
+ atlasUploads: 0,
960
+ uniformOnlyFrames: 0,
961
+ updatedHandles: 0,
962
+ atlasMemoryMB: 0,
963
+ cachedTextureMemoryMB: 0,
964
+ reusedGroups: 0
965
+ };
966
+ }
967
+ class Ct {
968
+ constructor(e, t, n = H.WebGL, s = {}) {
969
+ this._surfaceId = e, this._viewport = t, this._rendererType = n, this._owner = s.owner ?? new Te(e), this._storageGeneration = this._owner.nextStorageGeneration(), this._orderRevision = this._owner.nextOrderRevision(), this._mainLayer = s.mainLayer ?? Ee("main"), this._layers.push(this._mainLayer), this.addGroup(this._mainLayer.rootGroup), this._currentSegment = this._createSegment(this._mainLayer.rootGroup);
970
+ }
971
+ _groups = [];
972
+ _groupsById = /* @__PURE__ */ new Map();
973
+ _segments = [];
974
+ _targets = [];
975
+ _targetReferences;
976
+ _layers = [];
977
+ _mainLayer;
978
+ _owner;
979
+ _storageGeneration;
980
+ _orderRevision;
981
+ _currentSegment;
982
+ _order = 0;
983
+ _built = !1;
984
+ get mainLayer() {
985
+ return this._mainLayer;
986
+ }
987
+ get rootGroup() {
988
+ return this._mainLayer.rootGroup;
989
+ }
990
+ get currentGroup() {
991
+ return this._currentSegment.group;
992
+ }
993
+ nextCommandId() {
994
+ return this._assertWritable(), this._owner.nextCommandId();
995
+ }
996
+ nextItemId() {
997
+ return this._assertWritable(), this._owner.nextItemId();
998
+ }
999
+ nextHandleId() {
1000
+ return this._assertWritable(), this._owner.nextHandleId();
1001
+ }
1002
+ nextOrder() {
1003
+ return this._assertWritable(), this._order += 1, this._order;
1004
+ }
1005
+ peekOrder() {
1006
+ return this._order;
1007
+ }
1008
+ addCommand(e) {
1009
+ this._assertWritable();
1010
+ const t = {
1011
+ ...e,
1012
+ order: e.order ?? this.nextOrder()
1013
+ };
1014
+ if (t.type === "beginComposition")
1015
+ for (const n of re(t.id))
1016
+ (this._targetReferences ??= /* @__PURE__ */ new Set()).add(n);
1017
+ if (t.type === "clipPath")
1018
+ for (const n of ne(t.id))
1019
+ (this._targetReferences ??= /* @__PURE__ */ new Set()).add(n);
1020
+ if (t.type === "beginRenderTarget" || t.type === "drawRenderTarget") {
1021
+ const n = t.targetId ?? t.target?.id;
1022
+ n !== void 0 && (this._targetReferences ??= /* @__PURE__ */ new Set()).add(n);
1023
+ }
1024
+ return this._currentSegment.commands.push(t), t;
1025
+ }
1026
+ addItem(e) {
1027
+ return this._assertWritable(), this._currentSegment.items.push(e), e;
1028
+ }
1029
+ addGroup(e) {
1030
+ this._assertWritable();
1031
+ const t = this._groupsById.get(e.id);
1032
+ if (t) {
1033
+ if (t !== e)
1034
+ throw new Error(`Nova render group ${e.id} already has another identity.`);
1035
+ return t;
1036
+ }
1037
+ return this._groupsById.set(e.id, e), this._groups.push(e), e;
1038
+ }
1039
+ beginSegment(e = this.currentGroup) {
1040
+ this._assertWritable(), this.addGroup(e), this._currentSegment = this._createSegment(e);
1041
+ }
1042
+ addTarget(e) {
1043
+ return this._assertWritable(), this._targets.push(e), e;
1044
+ }
1045
+ build(e = {}) {
1046
+ this._assertWritable(), this._built = !0;
1047
+ const t = this._sealSegments(), n = new C(t.itemSlices, this._orderRevision), s = new C(t.commandSlices, this._orderRevision), i = this._createInstructionBuffers(t.commandSlices, t.itemSlices), o = /* @__PURE__ */ new Map();
1048
+ for (const u of this._groups) {
1049
+ if (!u.parentGroupId)
1050
+ continue;
1051
+ let y = o.get(u.parentGroupId);
1052
+ y || (y = [], o.set(u.parentGroupId, y)), y.includes(u.id) || y.push(u.id);
1053
+ }
1054
+ const a = this._groups.map((u) => Ae(
1055
+ u,
1056
+ o.get(u.id) ?? []
1057
+ )), c = new Map(a.map((u) => [u.id, u])), h = this._layers.map((u) => Object.freeze({
1058
+ ...u,
1059
+ rootGroup: c.get(u.rootGroup.id)
1060
+ })), f = this._targets.map((u) => Object.freeze({ ...u })), d = {
1061
+ ...Qe(),
1062
+ ...e,
1063
+ commands: s.length,
1064
+ items: n.length,
1065
+ groups: this._groups.length
1066
+ };
1067
+ fe(s, this._targetReferences);
1068
+ const p = {
1069
+ id: Xe(),
1070
+ storageGeneration: this._storageGeneration,
1071
+ orderRevision: this._orderRevision,
1072
+ patchRevision: 0,
1073
+ surfaceId: this._surfaceId,
1074
+ rendererType: this._rendererType,
1075
+ viewport: Object.freeze({ ...this._viewport }),
1076
+ layers: Object.freeze(h),
1077
+ targets: Object.freeze(f),
1078
+ groups: Object.freeze(a),
1079
+ instructionBuffers: i,
1080
+ items: n,
1081
+ commands: s,
1082
+ resourceDelta: {
1083
+ texturesCreated: 0,
1084
+ texturesUpdated: 0,
1085
+ texturesEvicted: 0,
1086
+ textRunsRasterized: 0,
1087
+ bytesUploaded: 0
1088
+ },
1089
+ metrics: d
1090
+ };
1091
+ return this._rendererType === H.WebGL && (Ue(p), Ke(p)), p;
1092
+ }
1093
+ _createSegment(e) {
1094
+ const t = {
1095
+ id: this._owner.nextSegmentId(e.id),
1096
+ group: e,
1097
+ commands: [],
1098
+ items: []
1099
+ };
1100
+ return this._segments.push(t), t;
1101
+ }
1102
+ _sealSegments() {
1103
+ const e = [], t = [];
1104
+ for (const n of this._segments) {
1105
+ const s = Object.freeze(n.commands), i = Object.freeze(n.items);
1106
+ e.push(Object.freeze({
1107
+ id: `${n.id}:commands`,
1108
+ groupId: n.group.id,
1109
+ revision: this._orderRevision,
1110
+ values: s
1111
+ })), t.push(Object.freeze({
1112
+ id: `${n.id}:items`,
1113
+ groupId: n.group.id,
1114
+ revision: this._orderRevision,
1115
+ values: i
1116
+ }));
1117
+ }
1118
+ return { commandSlices: e, itemSlices: t };
1119
+ }
1120
+ _createInstructionBuffers(e, t) {
1121
+ const n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
1122
+ for (const o of e) {
1123
+ let a = n.get(o.groupId);
1124
+ a || (a = [], n.set(o.groupId, a)), a.push(o);
1125
+ }
1126
+ for (const o of t) {
1127
+ let a = s.get(o.groupId);
1128
+ a || (a = [], s.set(o.groupId, a)), a.push(o);
1129
+ }
1130
+ const i = [];
1131
+ for (const o of this._groups) {
1132
+ const a = this._owner.nextInstructionVersion(o.id);
1133
+ i.push(Oe(
1134
+ o.id,
1135
+ a,
1136
+ new C(
1137
+ n.get(o.id) ?? [],
1138
+ this._orderRevision
1139
+ ),
1140
+ new C(
1141
+ s.get(o.id) ?? [],
1142
+ this._orderRevision
1143
+ )
1144
+ ));
1145
+ }
1146
+ return D(i, this._orderRevision, {
1147
+ id: `${this._surfaceId}:instruction-buffers:${this._storageGeneration}`,
1148
+ groupId: this.rootGroup.id
1149
+ });
1150
+ }
1151
+ _assertWritable() {
1152
+ if (this._built)
1153
+ throw new Error("NovaRenderFrameBuilder cannot mutate a built frame.");
1154
+ }
1155
+ }
1156
+ const Ye = 64;
1157
+ let te;
1158
+ class Ot {
1159
+ constructor(e, t, n, s = {}) {
1160
+ this.novaCanvas = e, this._schemaRegistry = t, this._writer = n, this._options = s;
1161
+ }
1162
+ id = "render-builder";
1163
+ capabilities = {
1164
+ canvas2d: !1,
1165
+ webgl: !1,
1166
+ schema: !0,
1167
+ rect: !0,
1168
+ border: !0,
1169
+ line: !0,
1170
+ circle: !0,
1171
+ arc: !0,
1172
+ polygon: !0,
1173
+ path: !0,
1174
+ icon: !0,
1175
+ text: !0,
1176
+ patternRects: !0,
1177
+ particles: !0,
1178
+ rectBatches: !0,
1179
+ stripeBatches: !0,
1180
+ iconBatches: !0,
1181
+ textBatches: !0,
1182
+ measureText: !0
1183
+ };
1184
+ _captureTransforms;
1185
+ _nodeStack = [];
1186
+ schema(e) {
1187
+ const t = Array.isArray(e) ? e : [e];
1188
+ if (!this._schemaBatch(e, "ordered"))
1189
+ for (const n of t)
1190
+ this._schemaItem(n);
1191
+ }
1192
+ schemaBatched(e) {
1193
+ this._schemaBatch(e, "batched") || this.schema(e);
1194
+ }
1195
+ schemaOrdered(e) {
1196
+ this._schemaBatch(e, "ordered") || this.schema(e);
1197
+ }
1198
+ save() {
1199
+ this._writer.save();
1200
+ }
1201
+ restore() {
1202
+ this._writer.restore();
1203
+ }
1204
+ clear() {
1205
+ this._writer.clear();
1206
+ }
1207
+ beginComposition(e) {
1208
+ const t = this._options.capture;
1209
+ this._writer.beginComposition(t ? {
1210
+ ...e,
1211
+ bounds: { ...e.bounds, x: e.bounds.x - t.x, y: e.bounds.y - t.y },
1212
+ mask: e.mask ? { ...e.mask, transform: this._captureTransform(e.mask.transform), sourceKey: `${t.namespace}:${e.mask.sourceKey}` } : void 0
1213
+ } : e);
1214
+ }
1215
+ endComposition() {
1216
+ this._writer.endComposition();
1217
+ }
1218
+ clipPath(e) {
1219
+ this._writer.clipPath(e);
1220
+ }
1221
+ clip(e, t, n, s) {
1222
+ this._writer.clip(e, t, n, s);
1223
+ }
1224
+ clearClip() {
1225
+ this._writer.clearClip();
1226
+ }
1227
+ markState() {
1228
+ return this._writer.markState();
1229
+ }
1230
+ restoreState(e) {
1231
+ this._writer.restoreState(e);
1232
+ }
1233
+ setTransform(e) {
1234
+ this._writer.setTransform(this._captureTransform(e));
1235
+ }
1236
+ beginRenderTarget(e, t, n, s) {
1237
+ this._writer.beginRenderTarget(e, t, n, s);
1238
+ }
1239
+ endRenderTarget() {
1240
+ this._writer.endRenderTarget();
1241
+ }
1242
+ drawRenderTarget(e, t, n, s, i) {
1243
+ s <= 0 || i <= 0 || this._writer.drawRenderTarget(e, t, n, s, i);
1244
+ }
1245
+ text(e) {
1246
+ this._schemaItem({ ...e, type: "text" });
1247
+ }
1248
+ rect(e) {
1249
+ this._schemaItem({ ...e, type: "rect" });
1250
+ }
1251
+ border(e) {
1252
+ this._schemaItem({ ...e, type: "border" });
1253
+ }
1254
+ line(e) {
1255
+ this._schemaItem({ ...e, type: "line" });
1256
+ }
1257
+ circle(e) {
1258
+ this._schemaItem({ ...e, type: "circle" });
1259
+ }
1260
+ arc(e) {
1261
+ this._schemaItem({ ...e, type: "arc" });
1262
+ }
1263
+ path(e) {
1264
+ this._schemaItem({ ...e, type: "path" });
1265
+ }
1266
+ polygon(e) {
1267
+ this._schemaItem({ ...e, type: "polygon" });
1268
+ }
1269
+ icon(e) {
1270
+ this._schemaItem({ ...e, type: "icon" });
1271
+ }
1272
+ patternRect(e) {
1273
+ this._schemaItem({ ...e, type: "pattern-rect" });
1274
+ }
1275
+ rects(e) {
1276
+ e.active === !1 || e.count <= 0 || this._writer.drawRectBatch(e);
1277
+ }
1278
+ borders(e) {
1279
+ e.active === !1 || e.count <= 0 || this._writer.drawBorderBatch(e);
1280
+ }
1281
+ timeRangeSegments(e) {
1282
+ e.active === !1 || e.count <= 0 || this._writer.drawTimeRangeSegmentBatch(e);
1283
+ }
1284
+ stripes(e) {
1285
+ e.active === !1 || e.count <= 0 || this._writer.drawStripeBatch(e);
1286
+ }
1287
+ icons(e) {
1288
+ e.active === !1 || e.count <= 0 || this._writer.drawIconBatch(e);
1289
+ }
1290
+ texts(e) {
1291
+ e.active === !1 || e.count <= 0 || this._writer.drawTextBatch(e);
1292
+ }
1293
+ meshes(e) {
1294
+ this._writer.drawMeshBatch(e);
1295
+ }
1296
+ particles(e) {
1297
+ e.active === !1 || e.count <= 0 || this._writer.drawParticles(e);
1298
+ }
1299
+ measureText(e) {
1300
+ const t = this._getMeasureContext(), n = e.styles?.direction;
1301
+ t && n !== void 0 && (t.save(), t.direction = n);
1302
+ try {
1303
+ const s = e.styles?.font, i = s?.size ?? 12, o = s?.family ?? "sans-serif", a = s?.style ?? "normal", c = s?.weight ?? "normal";
1304
+ if (t && (t.font = `${a} ${c} ${i}px ${o}`), Ve(e)) {
1305
+ const f = We(e, (d, p) => (t && (t.font = p), t?.measureText(d).width ?? d.length * i * 0.6));
1306
+ return { width: f.width, height: f.height };
1307
+ }
1308
+ if (e.parser === "markdown") {
1309
+ const f = De(e, (d, p) => (t && (t.font = p), t?.measureText(d).width ?? d.length * i * 0.6), { family: o, lineHeight: i });
1310
+ return { width: f.width, height: f.height };
1311
+ }
1312
+ return {
1313
+ width: t?.measureText(e.text).width ?? e.text.length * i * 0.6,
1314
+ height: e.styles?.lineHeight ?? i
1315
+ };
1316
+ } finally {
1317
+ t && n !== void 0 && t.restore();
1318
+ }
1319
+ }
1320
+ _getMeasureContext() {
1321
+ if (typeof navigator < "u" && navigator.userAgent.toLowerCase().includes("jsdom"))
1322
+ return null;
1323
+ try {
1324
+ return te ??= document.createElement("canvas"), te.getContext("2d");
1325
+ } catch {
1326
+ return null;
1327
+ }
1328
+ }
1329
+ cursor(e) {
1330
+ this._writer.cursor(e);
1331
+ }
1332
+ destroy() {
1333
+ }
1334
+ beginNode(e) {
1335
+ const t = this._writer.currentGroup, n = this._options.resolveNodeGroup?.(e, t) ?? {
1336
+ group: t,
1337
+ boundary: !1
1338
+ }, s = n.retained === !0;
1339
+ return this._nodeStack.push({
1340
+ id: this._writer.currentNodeId,
1341
+ transformSource: this._writer.currentNodeTransformSource,
1342
+ group: t,
1343
+ boundary: n.boundary && !s
1344
+ }), this._writer.setCurrentNode(this._options.capture ? `${this._options.capture.namespace}:${e.renderNodeId}` : e.renderNodeId, this._captureTransform(e.matrix)), this._writer.setCurrentGroup(n.group), s ? !1 : (n.boundary && this._writer.command({ type: "beginGroup" }), !0);
1345
+ }
1346
+ endNode() {
1347
+ const e = this._nodeStack.pop();
1348
+ e?.boundary && this._writer.command({ type: "endGroup" }), e && this._writer.setCurrentGroup(e.group), this._writer.setCurrentNode(e?.id ?? "surface", e?.transformSource);
1349
+ }
1350
+ _captureTransform(e) {
1351
+ const t = this._options.capture;
1352
+ if (!t)
1353
+ return e;
1354
+ this._captureTransforms ??= /* @__PURE__ */ new WeakMap();
1355
+ let n = this._captureTransforms.get(e);
1356
+ return n || (n = b.create(), this._captureTransforms.set(e, n)), b.copy(n, e), n[0] -= t.x * e[2], n[3] -= t.x * e[5], n[6] -= t.x * e[8], n[1] -= t.y * e[2], n[4] -= t.y * e[5], n[7] -= t.y * e[8], n;
1357
+ }
1358
+ _schemaItem(e) {
1359
+ if (e.active !== !1) {
1360
+ switch (e.clip !== void 0 && e.clip !== !0 && this.clip(e.clip.x, e.clip.y, e.clip.width, e.clip.height), e.type) {
1361
+ case "text":
1362
+ case "rect":
1363
+ case "border":
1364
+ case "line":
1365
+ case "circle":
1366
+ case "arc":
1367
+ case "path":
1368
+ case "polygon":
1369
+ case "icon":
1370
+ case "nine-slice-image":
1371
+ case "pattern-rect":
1372
+ this._writer.drawSchemaItem(e);
1373
+ break;
1374
+ default:
1375
+ this._schemaRegistry.renderSchemaComponent(this, e, "schema");
1376
+ break;
1377
+ }
1378
+ e.clip !== void 0 && e.clip !== !0 && this.clearClip();
1379
+ }
1380
+ }
1381
+ _schemaBatch(e, t) {
1382
+ const n = Array.isArray(e) ? e : [e], s = n.some((o) => o.active === !1) ? n.filter((o) => o.active !== !1) : n, i = Array.isArray(e) && Number.isFinite(e.contentVersion) && s.length > 0 && s.every((o) => o.type === "line" || o.type === "polygon");
1383
+ return s.length < Ye && !i || s.some((o) => V(o) === "custom") ? !1 : (this._writer.drawSchemaBatch(
1384
+ s,
1385
+ t,
1386
+ Array.isArray(e) ? e.semanticScope : void 0,
1387
+ Array.isArray(e) ? e.contentVersion : void 0,
1388
+ Array.isArray(e) && s === n ? e : void 0
1389
+ ), !0);
1390
+ }
1391
+ }
1392
+ class Pt {
1393
+ constructor(e, t = e.rootGroup, n) {
1394
+ this._frameBuilder = e, this._graph = n, this._group = t, t !== e.currentGroup && e.beginSegment(t);
1395
+ }
1396
+ _transformStack = [];
1397
+ _transformSourceStack = [];
1398
+ _clipStack = [];
1399
+ _stateMarks = [];
1400
+ _currentTransform = b.create();
1401
+ _currentTransformSource;
1402
+ _currentNodeId = "surface";
1403
+ _currentNodeTransformSource;
1404
+ _renderTargetDepth = 0;
1405
+ _group;
1406
+ get currentTransform() {
1407
+ return this._currentTransform;
1408
+ }
1409
+ get currentClip() {
1410
+ return this._clipStack.length > 0 ? this._clipStack[this._clipStack.length - 1] : null;
1411
+ }
1412
+ get currentNodeId() {
1413
+ return this._currentNodeId;
1414
+ }
1415
+ get currentNodeTransformSource() {
1416
+ return this._currentNodeTransformSource;
1417
+ }
1418
+ get currentGroup() {
1419
+ return this._group;
1420
+ }
1421
+ get hasNeutralRenderState() {
1422
+ return this._clipStack.length === 0 && this._renderTargetDepth === 0;
1423
+ }
1424
+ get _activeStateMark() {
1425
+ return this._stateMarks[this._stateMarks.length - 1];
1426
+ }
1427
+ setCurrentNode(e, t) {
1428
+ this._currentNodeId = e, this._currentNodeTransformSource = t;
1429
+ }
1430
+ setCurrentGroup(e) {
1431
+ e !== this._group && (this._group = e, this._frameBuilder.beginSegment(e));
1432
+ }
1433
+ clear() {
1434
+ return this.command({ type: "clear" });
1435
+ }
1436
+ save() {
1437
+ return this._transformStack.push(b.clone(this._currentTransform)), this._transformSourceStack.push(this._currentTransformSource), this.command({ type: "save" });
1438
+ }
1439
+ restore() {
1440
+ const e = this._activeStateMark?.transformDepth ?? 0;
1441
+ return this._transformStack.length <= e ? null : this._restoreUnsafe();
1442
+ }
1443
+ setTransform(e) {
1444
+ this._currentTransform = b.clone(e), this._currentTransformSource = e === this._currentNodeTransformSource ? this._currentNodeTransformSource : void 0;
1445
+ const t = this.command({
1446
+ type: "setTransform",
1447
+ transform: b.clone(e)
1448
+ });
1449
+ return this._graph && this._currentTransformSource && this._graph.bindTransformCommand(this._currentNodeId, this._currentTransformSource, t), t;
1450
+ }
1451
+ clip(e, t, n, s) {
1452
+ const i = { x: e, y: t, width: n, height: s };
1453
+ return this._clipStack.push(i), this.command({
1454
+ type: "clip",
1455
+ clip: i
1456
+ });
1457
+ }
1458
+ beginComposition(e) {
1459
+ this._renderTargetDepth += 1;
1460
+ const t = e.effects?.some((n) => !!me(n).outset) ? e : ge(e);
1461
+ return this.command({ type: "beginComposition", composition: Object.freeze({ ...t, bounds: Object.freeze({ ...t.bounds }), effects: t.effects ? _e(t.effects) : void 0, mask: t.mask ? Object.freeze({ ...t.mask, transform: b.clone(t.mask.transform) }) : void 0 }) });
1462
+ }
1463
+ endComposition() {
1464
+ return this._renderTargetDepth = Math.max(0, this._renderTargetDepth - 1), this.command({ type: "endComposition" });
1465
+ }
1466
+ clipPath(e) {
1467
+ const t = we(e);
1468
+ return this._clipStack.push(ve(t)), this.command({ type: "clipPath", pathClip: t });
1469
+ }
1470
+ clearClip() {
1471
+ const e = this._activeStateMark?.clipDepth ?? 0;
1472
+ return this._clipStack.length <= e ? null : this._clearClipUnsafe();
1473
+ }
1474
+ markState() {
1475
+ const e = {
1476
+ transformDepth: this._transformStack.length,
1477
+ clipDepth: this._clipStack.length
1478
+ };
1479
+ return this._stateMarks.push(e), e;
1480
+ }
1481
+ restoreState(e) {
1482
+ for (; this._clipStack.length > e.clipDepth; )
1483
+ this._clearClipUnsafe();
1484
+ for (; this._transformStack.length > e.transformDepth; )
1485
+ this._restoreUnsafe();
1486
+ const t = this._stateMarks.lastIndexOf(e);
1487
+ t >= 0 && this._stateMarks.splice(t);
1488
+ }
1489
+ beginRenderTarget(e, t, n, s = {}) {
1490
+ this._graph?.markRetainedPaintUnbound(this._currentNodeId), this._renderTargetDepth += 1;
1491
+ const i = this._frameBuilder.addTarget({
1492
+ id: e,
1493
+ kind: s.kind ?? "cache",
1494
+ width: t,
1495
+ height: n,
1496
+ dpr: s.dpr ?? 1,
1497
+ ownerGroupId: this._group.id
1498
+ });
1499
+ return this.command({
1500
+ type: "beginRenderTarget",
1501
+ target: i,
1502
+ targetId: e
1503
+ });
1504
+ }
1505
+ endRenderTarget() {
1506
+ return this._renderTargetDepth > 0 && (this._renderTargetDepth -= 1), this.command({ type: "endRenderTarget" });
1507
+ }
1508
+ drawRenderTarget(e, t, n, s, i) {
1509
+ return this._graph?.markRetainedPaintUnbound(this._currentNodeId), this.command({
1510
+ type: "drawRenderTarget",
1511
+ targetId: e,
1512
+ x: t,
1513
+ y: n,
1514
+ width: s,
1515
+ height: i
1516
+ });
1517
+ }
1518
+ drawSchemaItem(e, t = this._currentNodeId) {
1519
+ this._graph?.markRetainedPaintUnbound(t);
1520
+ const n = X(e, e, { freeze: !1 }), s = this._frameBuilder.nextOrder(), i = k({
1521
+ id: this._frameBuilder.nextItemId(),
1522
+ nodeId: t,
1523
+ groupId: this._group.id,
1524
+ layerId: this._group.layerId,
1525
+ kind: V(n),
1526
+ order: s,
1527
+ batchKey: Q(n),
1528
+ schemaItem: n,
1529
+ transform: b.clone(this._currentTransform),
1530
+ clip: this.currentClip
1531
+ });
1532
+ return this._addItem(i), this._addHandle(i, n, 0, 1, t), this.command({
1533
+ type: "drawItem",
1534
+ itemId: i.id,
1535
+ order: s
1536
+ }), i;
1537
+ }
1538
+ drawSchemaBatch(e, t = "batched", n, s, i) {
1539
+ const o = $e(e, {
1540
+ semanticScope: n,
1541
+ contentVersion: s,
1542
+ snapshotVersion: i?.snapshotVersion,
1543
+ dirtyIndices: i?.dirtyIndices,
1544
+ sourceIdentity: i ?? e
1545
+ });
1546
+ for (let c = 0; i?.itemHandles !== !1 && c < o.length; c += 1) {
1547
+ const h = o[c], f = k({
1548
+ id: this._frameBuilder.nextItemId(),
1549
+ nodeId: this._currentNodeId,
1550
+ groupId: this._group.id,
1551
+ layerId: this._group.layerId,
1552
+ kind: V(h),
1553
+ order: this._frameBuilder.peekOrder() + c + 1,
1554
+ batchKey: Q(h),
1555
+ schemaItem: h,
1556
+ transform: b.clone(this._currentTransform),
1557
+ clip: this.currentClip
1558
+ });
1559
+ this._addHandle(f, h, c, 1, this._currentNodeId);
1560
+ }
1561
+ const a = this.command({
1562
+ type: "drawSchemaBatch",
1563
+ schemaItems: o,
1564
+ schemaMode: t,
1565
+ schemaSemanticScope: n,
1566
+ schemaContentVersion: s
1567
+ });
1568
+ return this._graph && (!i || !this._graph.bindRetainedPaintSource(this._currentNodeId, i, a)) && this._graph.markRetainedPaintUnbound(this._currentNodeId), a;
1569
+ }
1570
+ drawMeshBatch(e, t = this._currentNodeId) {
1571
+ return Re(e), this._graph?.markRetainedPaintUnbound(t), this.command({ type: "drawMeshBatch", meshBatch: e, nodeId: t });
1572
+ }
1573
+ drawParticles(e, t = this._currentNodeId) {
1574
+ this._graph?.markRetainedPaintUnbound(t);
1575
+ const n = ot(e), s = this._frameBuilder.nextOrder(), i = n.kind === "sprite" ? "particle-sprite" : "particle-circle", o = k({
1576
+ id: this._frameBuilder.nextItemId(),
1577
+ nodeId: t,
1578
+ groupId: this._group.id,
1579
+ layerId: this._group.layerId,
1580
+ kind: i,
1581
+ order: s,
1582
+ batchKey: `particles:${n.kind}:${n.texture ? "texture" : "solid"}`,
1583
+ bounds: "x" in n && "y" in n && "width" in n && "height" in n ? { x: n.x, y: n.y, width: n.width, height: n.height } : void 0,
1584
+ clip: this.currentClip
1585
+ });
1586
+ return this._addItem(o), this._addParticleHandle(o, n, t, i), this.command({
1587
+ type: "drawParticles",
1588
+ itemId: o.id,
1589
+ particleBatch: n,
1590
+ order: s
1591
+ });
1592
+ }
1593
+ drawRectBatch(e, t = this._currentNodeId) {
1594
+ const n = je(e);
1595
+ n || this._graph?.markRetainedPaintUnbound(t);
1596
+ const s = n ?? st(e), i = this._frameBuilder.nextOrder(), o = k({
1597
+ id: this._frameBuilder.nextItemId(),
1598
+ nodeId: t,
1599
+ groupId: this._group.id,
1600
+ layerId: this._group.layerId,
1601
+ kind: "rect-batch",
1602
+ order: i,
1603
+ batchKey: "rect-batch:plain",
1604
+ bounds: { x: s.x[0] ?? 0, y: s.y[0] ?? 0, width: s.width[0] ?? 0, height: s.height[0] ?? 0 },
1605
+ clip: this.currentClip
1606
+ });
1607
+ this._addItem(o), this._addRectBatchHandle(o, s, t);
1608
+ const a = this.command({
1609
+ type: "drawRectBatch",
1610
+ itemId: o.id,
1611
+ rectBatch: s,
1612
+ order: i
1613
+ }), c = n ? e : He(e) ? Me(e) : void 0;
1614
+ return c && this._graph?.bindRetainedOwnedRectSource(t, c, a, o, this.hasNeutralRenderState && n !== void 0), a;
1615
+ }
1616
+ drawBorderBatch(e, t = this._currentNodeId) {
1617
+ return this._drawGenericBatch("drawBorderBatch", "border-batch", "border-batch:flat", e, t);
1618
+ }
1619
+ drawTimeRangeSegmentBatch(e, t = this._currentNodeId) {
1620
+ this._graph?.markRetainedPaintUnbound(t);
1621
+ const n = it(e), s = this._frameBuilder.nextOrder(), i = k({
1622
+ id: this._frameBuilder.nextItemId(),
1623
+ nodeId: t,
1624
+ groupId: this._group.id,
1625
+ layerId: this._group.layerId,
1626
+ kind: "time-range-segment-batch",
1627
+ order: s,
1628
+ batchKey: "time-range-segment-batch:plain",
1629
+ bounds: { x: n.viewportX, y: n.y[0] ?? 0, width: 1, height: n.height[0] ?? 0 },
1630
+ clip: this.currentClip
1631
+ });
1632
+ return this._addItem(i), this._addTimeRangeSegmentBatchHandle(i, n, t), this.command({
1633
+ type: "drawTimeRangeSegmentBatch",
1634
+ itemId: i.id,
1635
+ timeRangeSegmentBatch: n,
1636
+ order: s
1637
+ });
1638
+ }
1639
+ drawStripeBatch(e, t = this._currentNodeId) {
1640
+ return this._drawGenericBatch("drawStripeBatch", "stripe-batch", "stripe-batch:fill", e, t);
1641
+ }
1642
+ drawIconBatch(e, t = this._currentNodeId) {
1643
+ return this._drawGenericBatch("drawIconBatch", "icon-batch", "icon-batch:texture", e, t);
1644
+ }
1645
+ drawTextBatch(e, t = this._currentNodeId) {
1646
+ return this._drawGenericBatch("drawTextBatch", "text-batch", "text-batch:atlas", e, t);
1647
+ }
1648
+ cursor(e) {
1649
+ return this.command({
1650
+ type: "cursor",
1651
+ cursor: e
1652
+ });
1653
+ }
1654
+ command(e) {
1655
+ return this._frameBuilder.addCommand({
1656
+ ...e,
1657
+ id: this._frameBuilder.nextCommandId(),
1658
+ nodeId: e.nodeId ?? this._currentNodeId,
1659
+ groupId: this._group.id,
1660
+ layerId: this._group.layerId
1661
+ });
1662
+ }
1663
+ _restoreUnsafe() {
1664
+ return this._currentTransform = this._transformStack.pop() ?? b.create(), this._currentTransformSource = this._transformSourceStack.pop(), this.command({ type: "restore" });
1665
+ }
1666
+ _clearClipUnsafe() {
1667
+ return this._clipStack.pop(), this.command({ type: "clearClip" });
1668
+ }
1669
+ _addItem(e) {
1670
+ this._frameBuilder.addItem(e), this._graph && this._currentTransformSource && this._currentTransformSource === this._currentNodeTransformSource && this._graph.bindTransformItem(this._currentNodeId, this._currentTransformSource, e);
1671
+ }
1672
+ _addHandle(e, t, n, s, i) {
1673
+ if (!this._graph)
1674
+ return;
1675
+ const o = {
1676
+ id: this._frameBuilder.nextHandleId(),
1677
+ nodeId: i,
1678
+ itemId: e.id,
1679
+ groupId: e.groupId,
1680
+ layerId: e.layerId,
1681
+ streamId: `${e.groupId}:${Y(t)}`,
1682
+ streamKind: Y(t),
1683
+ offset: n,
1684
+ count: s,
1685
+ batchKey: e.batchKey,
1686
+ versions: {
1687
+ transform: 0,
1688
+ layout: 0,
1689
+ paint: 0,
1690
+ children: 0,
1691
+ resource: 0,
1692
+ cache: 0,
1693
+ visibility: 0
1694
+ },
1695
+ localBounds: "x" in t && "y" in t && "width" in t && "height" in t ? { x: t.x, y: t.y, width: t.width, height: t.height } : void 0
1696
+ };
1697
+ this._graph.addHandle(o);
1698
+ }
1699
+ _addParticleHandle(e, t, n, s) {
1700
+ if (!this._graph)
1701
+ return;
1702
+ const i = {
1703
+ id: this._frameBuilder.nextHandleId(),
1704
+ nodeId: n,
1705
+ itemId: e.id,
1706
+ groupId: e.groupId,
1707
+ layerId: e.layerId,
1708
+ streamId: `${e.groupId}:${s}`,
1709
+ streamKind: s,
1710
+ offset: 0,
1711
+ count: t.count,
1712
+ batchKey: e.batchKey,
1713
+ versions: {
1714
+ transform: 0,
1715
+ layout: 0,
1716
+ paint: t.staticRevision ?? 0,
1717
+ children: 0,
1718
+ resource: 0,
1719
+ cache: 0,
1720
+ visibility: 0
1721
+ },
1722
+ localBounds: e.bounds
1723
+ };
1724
+ this._graph.addHandle(i);
1725
+ }
1726
+ _addRectBatchHandle(e, t, n) {
1727
+ if (!this._graph)
1728
+ return;
1729
+ const s = {
1730
+ id: this._frameBuilder.nextHandleId(),
1731
+ nodeId: n,
1732
+ itemId: e.id,
1733
+ groupId: e.groupId,
1734
+ layerId: e.layerId,
1735
+ streamId: `${e.groupId}:rect-batch`,
1736
+ streamKind: "rect-batch",
1737
+ offset: 0,
1738
+ count: t.count,
1739
+ batchKey: e.batchKey,
1740
+ versions: {
1741
+ transform: 0,
1742
+ layout: t.revision ?? 0,
1743
+ paint: t.staticRevision ?? 0,
1744
+ children: 0,
1745
+ resource: 0,
1746
+ cache: 0,
1747
+ visibility: 0
1748
+ },
1749
+ localBounds: e.bounds
1750
+ };
1751
+ this._graph.addHandle(s);
1752
+ }
1753
+ _addTimeRangeSegmentBatchHandle(e, t, n) {
1754
+ if (!this._graph)
1755
+ return;
1756
+ const s = {
1757
+ id: this._frameBuilder.nextHandleId(),
1758
+ nodeId: n,
1759
+ itemId: e.id,
1760
+ groupId: e.groupId,
1761
+ layerId: e.layerId,
1762
+ streamId: `${e.groupId}:time-range-segment-batch`,
1763
+ streamKind: "time-range-segment-batch",
1764
+ offset: 0,
1765
+ count: t.count,
1766
+ batchKey: e.batchKey,
1767
+ versions: {
1768
+ transform: 0,
1769
+ layout: t.revision ?? 0,
1770
+ paint: t.staticRevision ?? 0,
1771
+ children: 0,
1772
+ resource: 0,
1773
+ cache: 0,
1774
+ visibility: 0
1775
+ },
1776
+ localBounds: e.bounds
1777
+ };
1778
+ this._graph.addHandle(s);
1779
+ }
1780
+ _drawGenericBatch(e, t, n, s, i) {
1781
+ this._graph?.markRetainedPaintUnbound(i);
1782
+ const o = at(e, s), a = this._frameBuilder.nextOrder(), c = k({
1783
+ id: this._frameBuilder.nextItemId(),
1784
+ nodeId: i,
1785
+ groupId: this._group.id,
1786
+ layerId: this._group.layerId,
1787
+ kind: t,
1788
+ order: a,
1789
+ batchKey: n,
1790
+ bounds: { x: o.x[0] ?? 0, y: o.y[0] ?? 0, width: o.width[0] ?? 0, height: o.height[0] ?? 0 },
1791
+ clip: this.currentClip
1792
+ });
1793
+ return this._addItem(c), this._addGenericBatchHandle(c, o, i, t), this.command({
1794
+ type: e,
1795
+ itemId: c.id,
1796
+ borderBatch: e === "drawBorderBatch" ? o : void 0,
1797
+ stripeBatch: e === "drawStripeBatch" ? o : void 0,
1798
+ iconBatch: e === "drawIconBatch" ? o : void 0,
1799
+ textBatch: e === "drawTextBatch" ? o : void 0,
1800
+ order: a
1801
+ });
1802
+ }
1803
+ _addGenericBatchHandle(e, t, n, s) {
1804
+ if (!this._graph)
1805
+ return;
1806
+ const i = {
1807
+ id: this._frameBuilder.nextHandleId(),
1808
+ nodeId: n,
1809
+ itemId: e.id,
1810
+ groupId: e.groupId,
1811
+ layerId: e.layerId,
1812
+ streamId: `${e.groupId}:${s}`,
1813
+ streamKind: s,
1814
+ offset: 0,
1815
+ count: t.count,
1816
+ batchKey: e.batchKey,
1817
+ versions: {
1818
+ transform: 0,
1819
+ layout: t.revision ?? 0,
1820
+ paint: t.staticRevision ?? 0,
1821
+ children: 0,
1822
+ resource: 0,
1823
+ cache: 0,
1824
+ visibility: 0
1825
+ },
1826
+ localBounds: e.bounds
1827
+ };
1828
+ this._graph.addHandle(i);
1829
+ }
1830
+ }
1831
+ const Je = {
1832
+ x: 1,
1833
+ y: 1,
1834
+ width: 1,
1835
+ height: 1,
1836
+ colors: 4,
1837
+ radii: 1,
1838
+ states: 1,
1839
+ minWidths: 1
1840
+ }, Ze = {
1841
+ startTime: 1,
1842
+ endTime: 1,
1843
+ y: 1,
1844
+ height: 1,
1845
+ colors: 4,
1846
+ styles: 4
1847
+ }, et = {
1848
+ x: 1,
1849
+ y: 1,
1850
+ width: 1,
1851
+ height: 1,
1852
+ borderWidths: 1,
1853
+ colorIndices: 1,
1854
+ opacities: 1
1855
+ }, tt = {
1856
+ x: 1,
1857
+ y: 1,
1858
+ width: 1,
1859
+ height: 1,
1860
+ fills: 1
1861
+ }, rt = {
1862
+ x: 1,
1863
+ y: 1,
1864
+ width: 1,
1865
+ height: 1,
1866
+ icons: 1
1867
+ }, nt = {
1868
+ text: 1,
1869
+ x: 1,
1870
+ y: 1,
1871
+ width: 1,
1872
+ height: 1,
1873
+ clipX: 1,
1874
+ clipY: 1,
1875
+ clipWidth: 1,
1876
+ clipHeight: 1,
1877
+ color: 1,
1878
+ font: 1,
1879
+ align: 1
1880
+ };
1881
+ function st(r) {
1882
+ return A(r, Je);
1883
+ }
1884
+ function it(r) {
1885
+ return E(r, Ze);
1886
+ }
1887
+ function ot(r) {
1888
+ return X(r, r);
1889
+ }
1890
+ function at(r, e) {
1891
+ switch (r) {
1892
+ case "drawBorderBatch":
1893
+ return A(e, et);
1894
+ case "drawStripeBatch":
1895
+ return A(e, tt);
1896
+ case "drawIconBatch":
1897
+ return A(e, rt);
1898
+ case "drawTextBatch":
1899
+ return E(e, nt);
1900
+ }
1901
+ }
1902
+ export {
1903
+ We as A,
1904
+ De as B,
1905
+ mt as C,
1906
+ Ne as D,
1907
+ xe as E,
1908
+ xt as F,
1909
+ Me as G,
1910
+ He as H,
1911
+ Tt as I,
1912
+ kt as J,
1913
+ pt as K,
1914
+ D as L,
1915
+ Xe as M,
1916
+ Ge as N,
1917
+ Ue as O,
1918
+ Ke as P,
1919
+ C as Q,
1920
+ H as R,
1921
+ fe as S,
1922
+ Te as T,
1923
+ vt as a,
1924
+ bt as b,
1925
+ St as c,
1926
+ Rt as d,
1927
+ le as e,
1928
+ Nt as f,
1929
+ wt as g,
1930
+ Bt as h,
1931
+ Oe as i,
1932
+ Pe as j,
1933
+ Ae as k,
1934
+ k as l,
1935
+ Q as m,
1936
+ Ee as n,
1937
+ It as o,
1938
+ Y as p,
1939
+ se as q,
1940
+ V as r,
1941
+ _t as s,
1942
+ Ct as t,
1943
+ Pt as u,
1944
+ Ot as v,
1945
+ gt as w,
1946
+ yt as x,
1947
+ je as y,
1948
+ Ve as z
1949
+ };