@carbonenginejs/runtime 0.1.0-alpha.4 → 0.1.0-alpha.5

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 (384) hide show
  1. package/dist/global/blue/BlueClasses.js +200 -0
  2. package/dist/global/blue/BlueClasses.js.map +1 -0
  3. package/dist/global/blue/IBlueClasses.js +79 -0
  4. package/dist/global/blue/IBlueClasses.js.map +1 -0
  5. package/dist/global/blue/IBlueDynamicResourceConstructor.js +16 -0
  6. package/dist/global/blue/IBlueDynamicResourceConstructor.js.map +1 -1
  7. package/dist/global/blue/blue.js +8 -2
  8. package/dist/global/blue/blue.js.map +1 -1
  9. package/dist/global/blue/index.js +2 -0
  10. package/dist/global/blue/index.js.map +1 -1
  11. package/dist/global/consts/index.js +0 -1
  12. package/dist/global/consts/index.js.map +1 -1
  13. package/dist/global/consts/renderContext/formats.js +26 -25
  14. package/dist/global/consts/renderContext/formats.js.map +1 -1
  15. package/dist/{trinityal/Tr2BitmapDimensions.js → global/imageio/BitmapDimensions.js} +19 -15
  16. package/dist/global/imageio/BitmapDimensions.js.map +1 -0
  17. package/dist/global/imageio/Cutout.js +28 -0
  18. package/dist/global/imageio/Cutout.js.map +1 -0
  19. package/dist/global/imageio/HostBitmap.js +1106 -0
  20. package/dist/global/imageio/HostBitmap.js.map +1 -0
  21. package/dist/global/imageio/ImageIOResult.js +99 -0
  22. package/dist/global/imageio/ImageIOResult.js.map +1 -0
  23. package/dist/global/imageio/ImageUtility.js +205 -0
  24. package/dist/global/imageio/ImageUtility.js.map +1 -0
  25. package/dist/global/imageio/LoadParameters.js +86 -0
  26. package/dist/global/imageio/LoadParameters.js.map +1 -0
  27. package/dist/global/imageio/Metadata.js +22 -0
  28. package/dist/global/imageio/Metadata.js.map +1 -0
  29. package/dist/global/imageio/index.js +8 -0
  30. package/dist/global/{consts/webgpu → imageio}/index.js.map +1 -1
  31. package/dist/global/index.js +2 -1
  32. package/dist/global/index.js.map +1 -1
  33. package/dist/global/math/color.js +1 -1
  34. package/dist/global/math/color.js.map +1 -1
  35. package/dist/global/schema/CjsSchema.js +8 -0
  36. package/dist/global/schema/CjsSchema.js.map +1 -1
  37. package/dist/index.js +12 -4
  38. package/dist/index.js.map +1 -1
  39. package/dist/resource/CjsResMan.js +47 -7
  40. package/dist/resource/CjsResMan.js.map +1 -1
  41. package/dist/resource/Tr2LightProfileRes.js +37 -0
  42. package/dist/resource/Tr2LightProfileRes.js.map +1 -1
  43. package/dist/resource/format/CjsByteWriter.js +46 -46
  44. package/dist/resource/format/CjsByteWriter.js.map +1 -1
  45. package/dist/resource/format/CjsFormat.js +7 -8
  46. package/dist/resource/format/CjsFormat.js.map +1 -1
  47. package/dist/resource/format/CjsFormatStore.js +8 -8
  48. package/dist/resource/format/CjsFormatStore.js.map +1 -1
  49. package/dist/resource/format/CjsGeometryFormat.js +114 -0
  50. package/dist/resource/format/CjsGeometryFormat.js.map +1 -0
  51. package/dist/resource/format/CjsImageFormat.js +282 -0
  52. package/dist/resource/format/CjsImageFormat.js.map +1 -0
  53. package/dist/resource/format/CjsResourceProbe.js +12 -48
  54. package/dist/resource/format/CjsResourceProbe.js.map +1 -1
  55. package/dist/resource/format/CjsStringTable.js +37 -37
  56. package/dist/resource/format/CjsStringTable.js.map +1 -1
  57. package/dist/resource/format/carbonEffect/CjsCarbonEffectReader.js +10 -10
  58. package/dist/resource/format/carbonEffect/CjsCarbonEffectReader.js.map +1 -1
  59. package/dist/resource/format/carbonEffect/CjsCarbonEffectWriter.js +37 -37
  60. package/dist/resource/format/carbonEffect/CjsCarbonEffectWriter.js.map +1 -1
  61. package/dist/resource/format/carbonEffect/carbonEffectBackendBlock.js +35 -7
  62. package/dist/resource/format/carbonEffect/carbonEffectBackendBlock.js.map +1 -1
  63. package/dist/resource/format/index.js +3 -1
  64. package/dist/resource/format/index.js.map +1 -1
  65. package/dist/resource/formats/black/CjsBlackFormat.js +130 -137
  66. package/dist/resource/formats/black/CjsBlackFormat.js.map +1 -1
  67. package/dist/resource/formats/bnk/CjsBnkFormat.js +12 -19
  68. package/dist/resource/formats/bnk/CjsBnkFormat.js.map +1 -1
  69. package/dist/resource/formats/bnk/core/helpers.js +1 -3
  70. package/dist/resource/formats/bnk/core/helpers.js.map +1 -1
  71. package/dist/resource/formats/cmf/CjsCmfFormat.js +19 -82
  72. package/dist/resource/formats/cmf/CjsCmfFormat.js.map +1 -1
  73. package/dist/resource/formats/cmf/core/constants.js +1 -2
  74. package/dist/resource/formats/cmf/core/constants.js.map +1 -1
  75. package/dist/resource/formats/{stl/core/targets.js → cmf/core/flatShared.js} +9 -8
  76. package/dist/resource/formats/cmf/core/flatShared.js.map +1 -0
  77. package/dist/resource/formats/cmf/core/helpers.js +13 -13
  78. package/dist/resource/formats/cmf/core/helpers.js.map +1 -1
  79. package/dist/resource/formats/cmf/core/writer.js +24 -24
  80. package/dist/resource/formats/cmf/core/writer.js.map +1 -1
  81. package/dist/resource/formats/dds/CjsDdsFormat.js +134 -17
  82. package/dist/resource/formats/dds/CjsDdsFormat.js.map +1 -1
  83. package/dist/resource/formats/dds/core/helpers.js +125 -40
  84. package/dist/resource/formats/dds/core/helpers.js.map +1 -1
  85. package/dist/resource/formats/dxbc/CjsDxbcFormat.js +14 -16
  86. package/dist/resource/formats/dxbc/CjsDxbcFormat.js.map +1 -1
  87. package/dist/resource/formats/dxbc/core/{container.js → DxbcContainer.js} +2 -2
  88. package/dist/resource/formats/dxbc/core/DxbcContainer.js.map +1 -0
  89. package/dist/resource/formats/dxbc/core/{errors.js → DxbcReadError.js} +1 -1
  90. package/dist/resource/formats/dxbc/core/DxbcReadError.js.map +1 -0
  91. package/dist/resource/formats/dxbc/core/DxbcReader.js +1 -1
  92. package/dist/resource/formats/dxbc/core/DxbcReader.js.map +1 -1
  93. package/dist/resource/formats/dxbc/core/{program.js → DxbcShaderProgram.js} +2 -2
  94. package/dist/resource/formats/dxbc/core/DxbcShaderProgram.js.map +1 -0
  95. package/dist/resource/formats/dxbc/core/{signature.js → DxbcSignatureChunk.js} +2 -2
  96. package/dist/resource/formats/dxbc/core/DxbcSignatureChunk.js.map +1 -0
  97. package/dist/resource/formats/dxbc/core/decoder.js +2 -2
  98. package/dist/resource/formats/dxbc/core/decoder.js.map +1 -1
  99. package/dist/resource/formats/dxbc/core/helpers.js +3 -3
  100. package/dist/resource/formats/dxbc/core/helpers.js.map +1 -1
  101. package/dist/resource/formats/fbx/CjsFbxFormat.js +18 -20
  102. package/dist/resource/formats/fbx/CjsFbxFormat.js.map +1 -1
  103. package/dist/resource/formats/flac/CjsFlacFormat.js +7 -13
  104. package/dist/resource/formats/flac/CjsFlacFormat.js.map +1 -1
  105. package/dist/resource/formats/fsd/32/CjsFsd32Format.js +29 -29
  106. package/dist/resource/formats/fsd/32/CjsFsd32Format.js.map +1 -1
  107. package/dist/resource/formats/fsd/64/CjsFsd64Format.js +3 -3
  108. package/dist/resource/formats/fsd/64/CjsFsd64Format.js.map +1 -1
  109. package/dist/resource/formats/fsd/64/core/CjsFsd64Binary.js +23 -23
  110. package/dist/resource/formats/fsd/64/core/CjsFsd64Binary.js.map +1 -1
  111. package/dist/resource/formats/fsd/64/core/CjsFsd64Reader.js +8 -8
  112. package/dist/resource/formats/fsd/64/core/CjsFsd64Reader.js.map +1 -1
  113. package/dist/resource/formats/fsd/CjsFsdFormat.js +23 -23
  114. package/dist/resource/formats/fsd/CjsFsdFormat.js.map +1 -1
  115. package/dist/resource/formats/gif/CjsGifFormat.js +24 -15
  116. package/dist/resource/formats/gif/CjsGifFormat.js.map +1 -1
  117. package/dist/resource/formats/gltf/CjsGltfFormat.js +33 -98
  118. package/dist/resource/formats/gltf/CjsGltfFormat.js.map +1 -1
  119. package/dist/resource/formats/gltf/core/helpers.js +3 -12
  120. package/dist/resource/formats/gltf/core/helpers.js.map +1 -1
  121. package/dist/resource/formats/gr2/CjsGr2Format.js +27 -91
  122. package/dist/resource/formats/gr2/CjsGr2Format.js.map +1 -1
  123. package/dist/resource/formats/hlsl/CjsHlslFormat.js +22 -25
  124. package/dist/resource/formats/hlsl/CjsHlslFormat.js.map +1 -1
  125. package/dist/resource/formats/hlsl/core/carbonDescriptionToRuntime.js +1 -1
  126. package/dist/resource/formats/hlsl/core/carbonDescriptionToRuntime.js.map +1 -1
  127. package/dist/resource/formats/hlsl/core/tr2/shader/HlslEffectStageInput.js +3 -3
  128. package/dist/resource/formats/hlsl/core/tr2/shader/HlslEffectStageInput.js.map +1 -1
  129. package/dist/resource/formats/ies/CjsIESFormat.js +29 -29
  130. package/dist/resource/formats/ies/CjsIESFormat.js.map +1 -1
  131. package/dist/resource/formats/jpeg/CjsJpegFormat.js +24 -15
  132. package/dist/resource/formats/jpeg/CjsJpegFormat.js.map +1 -1
  133. package/dist/resource/formats/jpeg/core/helpers.js +3 -5
  134. package/dist/resource/formats/jpeg/core/helpers.js.map +1 -1
  135. package/dist/resource/formats/jpeg/core/jpeg.js +58 -58
  136. package/dist/resource/formats/jpeg/core/jpeg.js.map +1 -1
  137. package/dist/resource/formats/jsonl/CjsJsonlFormat.js +3 -3
  138. package/dist/resource/formats/jsonl/CjsJsonlFormat.js.map +1 -1
  139. package/dist/resource/formats/mp3/CjsMp3Format.js +7 -14
  140. package/dist/resource/formats/mp3/CjsMp3Format.js.map +1 -1
  141. package/dist/resource/formats/mp3/core/helpers.js +3 -5
  142. package/dist/resource/formats/mp3/core/helpers.js.map +1 -1
  143. package/dist/resource/formats/mp4/CjsMp4Format.js +7 -13
  144. package/dist/resource/formats/mp4/CjsMp4Format.js.map +1 -1
  145. package/dist/resource/formats/mp4/core/helpers.js +3 -5
  146. package/dist/resource/formats/mp4/core/helpers.js.map +1 -1
  147. package/dist/resource/formats/obj/CjsObjFormat.js +92 -157
  148. package/dist/resource/formats/obj/CjsObjFormat.js.map +1 -1
  149. package/dist/resource/formats/obj/core/helpers.js +5 -113
  150. package/dist/resource/formats/obj/core/helpers.js.map +1 -1
  151. package/dist/resource/formats/ogg/CjsOggFormat.js +7 -14
  152. package/dist/resource/formats/ogg/CjsOggFormat.js.map +1 -1
  153. package/dist/resource/formats/pickle/CjsPickleFormat.js +7 -12
  154. package/dist/resource/formats/pickle/CjsPickleFormat.js.map +1 -1
  155. package/dist/resource/formats/pickle/core/CjsPickleProtocol0Reader.js +7 -7
  156. package/dist/resource/formats/pickle/core/CjsPickleProtocol0Reader.js.map +1 -1
  157. package/dist/resource/formats/pickle/core/CjsPickleProtocol4Reader.js +7 -7
  158. package/dist/resource/formats/pickle/core/CjsPickleProtocol4Reader.js.map +1 -1
  159. package/dist/resource/formats/png/CjsPngFormat.js +40 -15
  160. package/dist/resource/formats/png/CjsPngFormat.js.map +1 -1
  161. package/dist/resource/formats/png/core/helpers.js +4 -6
  162. package/dist/resource/formats/png/core/helpers.js.map +1 -1
  163. package/dist/resource/formats/red/CjsRedFormat.js +22 -28
  164. package/dist/resource/formats/red/CjsRedFormat.js.map +1 -1
  165. package/dist/resource/formats/schemabound/CjsSchemaBoundFormat.js +3 -7
  166. package/dist/resource/formats/schemabound/CjsSchemaBoundFormat.js.map +1 -1
  167. package/dist/resource/formats/schemabound/core/schemaBoundValues.js +5 -0
  168. package/dist/resource/formats/schemabound/core/schemaBoundValues.js.map +1 -1
  169. package/dist/resource/formats/sqlite/CjsSqliteFormat.js +4 -9
  170. package/dist/resource/formats/sqlite/CjsSqliteFormat.js.map +1 -1
  171. package/dist/resource/formats/static/CjsStaticFormat.js +4 -4
  172. package/dist/resource/formats/static/CjsStaticFormat.js.map +1 -1
  173. package/dist/resource/formats/stl/CjsStlFormat.js +39 -104
  174. package/dist/resource/formats/stl/CjsStlFormat.js.map +1 -1
  175. package/dist/resource/formats/stl/core/helpers.js +5 -19
  176. package/dist/resource/formats/stl/core/helpers.js.map +1 -1
  177. package/dist/resource/formats/tga/CjsTgaFormat.js +26 -15
  178. package/dist/resource/formats/tga/CjsTgaFormat.js.map +1 -1
  179. package/dist/resource/formats/tga/core/helpers.js +3 -5
  180. package/dist/resource/formats/tga/core/helpers.js.map +1 -1
  181. package/dist/resource/formats/vta/CjsVtaFormat.js +8 -15
  182. package/dist/resource/formats/vta/CjsVtaFormat.js.map +1 -1
  183. package/dist/resource/formats/wav/CjsWavFormat.js +7 -14
  184. package/dist/resource/formats/wav/CjsWavFormat.js.map +1 -1
  185. package/dist/resource/formats/wav/core/helpers.js +3 -5
  186. package/dist/resource/formats/wav/core/helpers.js.map +1 -1
  187. package/dist/resource/formats/webgl/CjsWebglFormat.js +103 -105
  188. package/dist/resource/formats/webgl/CjsWebglFormat.js.map +1 -1
  189. package/dist/resource/formats/webgl/core/{errors.js → WebglReadError.js} +1 -1
  190. package/dist/resource/formats/webgl/core/WebglReadError.js.map +1 -0
  191. package/dist/resource/formats/webgl/core/effectPackage.js +1 -1
  192. package/dist/resource/formats/webgl/core/effectPackage.js.map +1 -1
  193. package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js +3 -3
  194. package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
  195. package/dist/resource/formats/webgl/core/glsl/{DxbcGlslHelpers.js → DxbcGlslHelperRegistry.js} +2 -2
  196. package/dist/resource/formats/webgl/core/glsl/DxbcGlslHelperRegistry.js.map +1 -0
  197. package/dist/resource/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js +1 -1
  198. package/dist/resource/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js.map +1 -1
  199. package/dist/resource/formats/webgl/core/glslBackendBlock.js +1 -1
  200. package/dist/resource/formats/webgl/core/glslBackendBlock.js.map +1 -1
  201. package/dist/resource/formats/webgl/core/helpers.js.map +1 -1
  202. package/dist/resource/formats/webgpu/CjsWebgpuFormat.js +28 -29
  203. package/dist/resource/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
  204. package/dist/resource/formats/webgpu/core/{errors.js → WebgpuReadError.js} +1 -1
  205. package/dist/resource/formats/webgpu/core/WebgpuReadError.js.map +1 -0
  206. package/dist/resource/formats/webgpu/core/carbonWebgpu/validateContainer.js +1 -1
  207. package/dist/resource/formats/webgpu/core/carbonWebgpu/validateContainer.js.map +1 -1
  208. package/dist/resource/formats/webgpu/core/helpers.js +1 -1
  209. package/dist/resource/formats/webgpu/core/helpers.js.map +1 -1
  210. package/dist/resource/formats/webgpu/core/ir/lowerDxbcToIr.js +1 -1
  211. package/dist/resource/formats/webgpu/core/ir/lowerDxbcToIr.js.map +1 -1
  212. package/dist/resource/formats/webgpu/core/wgsl/buildWgslSet.js +18 -6
  213. package/dist/resource/formats/webgpu/core/wgsl/buildWgslSet.js.map +1 -1
  214. package/dist/resource/formats/webgpu/core/wgsl/lowerBindingLayout.js +39 -13
  215. package/dist/resource/formats/webgpu/core/wgsl/lowerBindingLayout.js.map +1 -1
  216. package/dist/resource/formats/webgpu/core/wgsl/lowerCreateHistogramsComputeProgram.js +16 -14
  217. package/dist/resource/formats/webgpu/core/wgsl/lowerCreateHistogramsComputeProgram.js.map +1 -1
  218. package/dist/resource/formats/webm/CjsWebmFormat.js +8 -13
  219. package/dist/resource/formats/webm/CjsWebmFormat.js.map +1 -1
  220. package/dist/resource/formats/webm/core/helpers.js +3 -5
  221. package/dist/resource/formats/webm/core/helpers.js.map +1 -1
  222. package/dist/resource/formats/webp/CjsWebpFormat.js +8 -12
  223. package/dist/resource/formats/webp/CjsWebpFormat.js.map +1 -1
  224. package/dist/resource/formats/wem/CjsWemFormat.js +9 -17
  225. package/dist/resource/formats/wem/CjsWemFormat.js.map +1 -1
  226. package/dist/resource/formats/wem/core/bitStream.js +35 -35
  227. package/dist/resource/formats/wem/core/bitStream.js.map +1 -1
  228. package/dist/resource/formats/wem/core/helpers.js +1 -3
  229. package/dist/resource/formats/wem/core/helpers.js.map +1 -1
  230. package/dist/resource/formats/yaml/CjsYamlFormat.js +28 -37
  231. package/dist/resource/formats/yaml/CjsYamlFormat.js.map +1 -1
  232. package/dist/resource/imageio/ImageIO.js +142 -0
  233. package/dist/resource/imageio/ImageIO.js.map +1 -0
  234. package/dist/resource/imageio/index.js +17 -0
  235. package/dist/resource/imageio/index.js.map +1 -0
  236. package/dist/resource/index.js +7 -0
  237. package/dist/resource/index.js.map +1 -1
  238. package/dist/resource/shader/reflection/Tr2EffectResource.js +24 -2
  239. package/dist/resource/shader/reflection/Tr2EffectResource.js.map +1 -1
  240. package/dist/resource/shader/reflection/Tr2Pass.js +76 -5
  241. package/dist/resource/shader/reflection/Tr2Pass.js.map +1 -1
  242. package/dist/resource/texture/CjsTextureArrayConstructor.js +97 -0
  243. package/dist/resource/texture/CjsTextureArrayConstructor.js.map +1 -0
  244. package/dist/resource/texture/CjsTexturePackConstructor.js +160 -0
  245. package/dist/resource/texture/CjsTexturePackConstructor.js.map +1 -0
  246. package/dist/resource/texture/CjsTexturePipelineStepArray.js +72 -0
  247. package/dist/resource/texture/CjsTexturePipelineStepArray.js.map +1 -0
  248. package/dist/resource/texture/CjsTexturePipelineStepConvert.js +73 -0
  249. package/dist/resource/texture/CjsTexturePipelineStepConvert.js.map +1 -0
  250. package/dist/resource/texture/CjsTexturePipelineStepPack.js +71 -0
  251. package/dist/resource/texture/CjsTexturePipelineStepPack.js.map +1 -0
  252. package/dist/resource/texture/CjsTexturePipelineStepResize.js +123 -0
  253. package/dist/resource/texture/CjsTexturePipelineStepResize.js.map +1 -0
  254. package/dist/resource/texture/SolidColorTextureConstructor.js +11 -1
  255. package/dist/resource/texture/SolidColorTextureConstructor.js.map +1 -1
  256. package/dist/resource/texture/Tr2ImageRes.js +100 -68
  257. package/dist/resource/texture/Tr2ImageRes.js.map +1 -1
  258. package/dist/resource/texture/Tr2TexturePipeline.js +45 -25
  259. package/dist/resource/texture/Tr2TexturePipeline.js.map +1 -1
  260. package/dist/resource/texture/Tr2TexturePipelineStepCompress.js +34 -1
  261. package/dist/resource/texture/Tr2TexturePipelineStepCompress.js.map +1 -1
  262. package/dist/resource/texture/Tr2TexturePipelineStepGenerateMips.js +30 -3
  263. package/dist/resource/texture/Tr2TexturePipelineStepGenerateMips.js.map +1 -1
  264. package/dist/resource/texture/Tr2TexturePipelineStepLimitSize.js +81 -1
  265. package/dist/resource/texture/Tr2TexturePipelineStepLimitSize.js.map +1 -1
  266. package/dist/resource/texture/Tr2TexturePipelineStepLoad.js +36 -1
  267. package/dist/resource/texture/Tr2TexturePipelineStepLoad.js.map +1 -1
  268. package/dist/resource/texture/Tr2TexturePipelineStepPack.js +146 -24
  269. package/dist/resource/texture/Tr2TexturePipelineStepPack.js.map +1 -1
  270. package/dist/resource/texture/TriTextureRes.js +151 -29
  271. package/dist/resource/texture/TriTextureRes.js.map +1 -1
  272. package/dist/resource/texture/index.js +7 -0
  273. package/dist/resource/texture/index.js.map +1 -1
  274. package/dist/resource/texture/registerTextureResources.js +83 -0
  275. package/dist/resource/texture/registerTextureResources.js.map +1 -0
  276. package/dist/resource/texture/solidColorTexture.js +10 -19
  277. package/dist/resource/texture/solidColorTexture.js.map +1 -1
  278. package/dist/sof/EveSOF.js +39 -7
  279. package/dist/sof/EveSOF.js.map +1 -1
  280. package/dist/trinity/core/Tr2GpuResourcePool/Tr2GpuResourcePool.js +2 -2
  281. package/dist/trinity/core/Tr2GpuResourcePool/Tr2GpuResourcePool.js.map +1 -1
  282. package/dist/trinity/core/Tr2ImageIOHelpers.js +80 -17
  283. package/dist/trinity/core/Tr2ImageIOHelpers.js.map +1 -1
  284. package/dist/trinity/core/Tr2RenderUtils.js +1 -1
  285. package/dist/trinity/core/Tr2TextureArray/Tr2TextureArray.js +49 -62
  286. package/dist/trinity/core/Tr2TextureArray/Tr2TextureArray.js.map +1 -1
  287. package/dist/trinity/core/Tr2TextureReference.js +114 -0
  288. package/dist/trinity/core/Tr2TextureReference.js.map +1 -0
  289. package/dist/trinity/core/device/Tr2DepthStencil.js +2 -2
  290. package/dist/trinity/core/device/Tr2DepthStencil.js.map +1 -1
  291. package/dist/trinity/core/device/Tr2RingBuffer/Tr2RingBuffer.js +1 -1
  292. package/dist/trinity/core/index.js +1 -0
  293. package/dist/trinity/core/index.js.map +1 -1
  294. package/dist/trinity/core/lighting/Tr2LightManager.js +5 -4
  295. package/dist/trinity/core/lighting/Tr2LightManager.js.map +1 -1
  296. package/dist/trinity/core/procedural/GradientTextureConstructor.js +5 -4
  297. package/dist/trinity/core/procedural/GradientTextureConstructor.js.map +1 -1
  298. package/dist/trinity/core/procedural/gradientTexture.js +10 -13
  299. package/dist/trinity/core/procedural/gradientTexture.js.map +1 -1
  300. package/dist/trinity/core/volumetrics/Tr2VolumetricsRenderer.js +1 -1
  301. package/dist/trinity/core/volumetrics/Tr2VolumetricsRenderer.js.map +1 -1
  302. package/dist/trinity/eve/EveImpactOverlay.js +102 -50
  303. package/dist/trinity/eve/EveImpactOverlay.js.map +1 -1
  304. package/dist/trinity/eve/EveModularObjectModifier.js +9 -18
  305. package/dist/trinity/eve/EveModularObjectModifier.js.map +1 -1
  306. package/dist/trinity/eve/attachment/turrets/EveTurretSet.js +175 -157
  307. package/dist/trinity/eve/attachment/turrets/EveTurretSet.js.map +1 -1
  308. package/dist/trinity/eve/attachment/turrets/EveTurretTarget.js +100 -83
  309. package/dist/trinity/eve/attachment/turrets/EveTurretTarget.js.map +1 -1
  310. package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMesh.js +26 -20
  311. package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMesh.js.map +1 -1
  312. package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshes.js +368 -179
  313. package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshes.js.map +1 -1
  314. package/dist/trinity/eve/child/EveChildMesh.js +242 -234
  315. package/dist/trinity/eve/child/EveChildMesh.js.map +1 -1
  316. package/dist/trinity/eve/child/EveChildTurret.js +57 -16
  317. package/dist/trinity/eve/child/EveChildTurret.js.map +1 -1
  318. package/dist/trinity/eve/child/EveSpaceObjectChild.js +28 -1
  319. package/dist/trinity/eve/child/EveSpaceObjectChild.js.map +1 -1
  320. package/dist/trinity/eve/index.js +2 -2
  321. package/dist/trinity/eve/overlays/EveDamageOverlay.js +5 -1
  322. package/dist/trinity/eve/overlays/EveDamageOverlay.js.map +1 -1
  323. package/dist/trinity/eve/scene/EveSpaceScene.js +234 -233
  324. package/dist/trinity/eve/scene/EveSpaceScene.js.map +1 -1
  325. package/dist/trinity/eve/scene/EveSpaceSceneRenderDriver.js +2 -0
  326. package/dist/trinity/eve/scene/EveSpaceSceneRenderDriver.js.map +1 -1
  327. package/dist/trinity/eve/spaceObject/EveSpaceObject2.js +492 -437
  328. package/dist/trinity/eve/spaceObject/EveSpaceObject2.js.map +1 -1
  329. package/dist/trinity/generated/index.js +0 -1
  330. package/dist/trinity/generated/index.js.map +1 -1
  331. package/dist/trinity/generated/trinityCore/index.js +0 -1
  332. package/dist/trinity/generated/trinityCore/index.js.map +1 -1
  333. package/dist/trinity/index.js +3 -3
  334. package/dist/trinity/particle/emitter/Tr2GpuSharedEmitter.js +10 -1
  335. package/dist/trinity/particle/emitter/Tr2GpuSharedEmitter.js.map +1 -1
  336. package/dist/trinity/shader/Tr2DataTextureManager.js +152 -66
  337. package/dist/trinity/shader/Tr2DataTextureManager.js.map +1 -1
  338. package/dist/trinity/shader/Tr2Material.js +1 -1
  339. package/dist/trinityal/Tr2HalHelperStructures/Tr2TextureSubresource.js +5 -5
  340. package/dist/trinityal/Tr2HalHelperStructures/Tr2TextureSubresource.js.map +1 -1
  341. package/dist/trinityal/index.js +1 -1
  342. package/dist/trinityal/stub/Tr2RenderContextALStub/Tr2RenderContextALStub.js +2 -2
  343. package/dist/trinityal/stub/Tr2RenderContextALStub/Tr2RenderContextALStub.js.map +1 -1
  344. package/dist/trinityal/stub/Tr2SwapChainALStub.js +45 -45
  345. package/dist/trinityal/stub/Tr2SwapChainALStub.js.map +1 -1
  346. package/dist/trinityal/stub/Tr2TextureALStub.js +170 -170
  347. package/dist/trinityal/stub/Tr2TextureALStub.js.map +1 -1
  348. package/dist/trinityal/webgpu/CjsWebgpuDevice.js +234 -164
  349. package/dist/trinityal/webgpu/CjsWebgpuDevice.js.map +1 -1
  350. package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js +7 -0
  351. package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js.map +1 -1
  352. package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js +78 -14
  353. package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js.map +1 -1
  354. package/dist/trinityal/webgpu/core/CjsWebgpuUtils.js +94 -0
  355. package/dist/trinityal/webgpu/core/CjsWebgpuUtils.js.map +1 -0
  356. package/dist/trinityal/webgpu/internal.js +1 -0
  357. package/dist/trinityal/webgpu/internal.js.map +1 -1
  358. package/docs/global/reference/classes/README.md +90 -0
  359. package/docs/resource/concepts/format-capabilities.md +3 -3
  360. package/docs/resource/formats/README.md +1 -1
  361. package/docs/resource/reference/classes/core.md +31 -1
  362. package/docs/resource/reference/classes/formats.md +7 -7
  363. package/docs/resource/reference/classes/resources.md +76 -16
  364. package/docs/trinity/reference/classes/generated.md +0 -10
  365. package/docs/trinity/reference/classes/trinity-core.md +1692 -1682
  366. package/docs/trinityal/reference/classes/README.md +0 -10
  367. package/docs/trinityal/webgpu/reference/classes/README.md +276 -266
  368. package/package.json +4 -3
  369. package/dist/global/consts/webgpu/index.js +0 -2
  370. package/dist/global/consts/webgpu/textureFormats.js +0 -180
  371. package/dist/global/consts/webgpu/textureFormats.js.map +0 -1
  372. package/dist/resource/formats/dxbc/core/container.js.map +0 -1
  373. package/dist/resource/formats/dxbc/core/errors.js.map +0 -1
  374. package/dist/resource/formats/dxbc/core/program.js.map +0 -1
  375. package/dist/resource/formats/dxbc/core/signature.js.map +0 -1
  376. package/dist/resource/formats/stl/core/targets.js.map +0 -1
  377. package/dist/resource/formats/webgl/core/errors.js.map +0 -1
  378. package/dist/resource/formats/webgl/core/glsl/DxbcGlslHelpers.js.map +0 -1
  379. package/dist/resource/formats/webgpu/core/errors.js.map +0 -1
  380. package/dist/resource/texture/texturePipelineBehavior.js +0 -332
  381. package/dist/resource/texture/texturePipelineBehavior.js.map +0 -1
  382. package/dist/trinity/generated/trinityCore/Tr2TextureReference.js +0 -40
  383. package/dist/trinity/generated/trinityCore/Tr2TextureReference.js.map +0 -1
  384. package/dist/trinityal/Tr2BitmapDimensions.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"CjsFormat.js","sources":["../../../../src/resource/format/CjsFormat.js"],"sourcesContent":["import { MediaType, PayloadType } from \"#consts/media\";\n\nconst OUTPUT_ROLE_RUNTIME = \"runtime\";\nconst OUTPUT_ROLE_DEBUG = \"debug\";\nconst READ_MODE_SYNC = \"sync\";\nconst READ_MODE_ASYNC = \"async\";\n\n/**\n * Decorator-free base for every concrete format facade.\n *\n * The format subpaths must remain directly importable from authored source, so\n * this base deliberately does not import the decorated CjsResourceProbe model.\n * Formats return plain support reports; CjsResourceProbe.from() is the optional\n * resource-layer normalization boundary.\n */\nexport class CjsFormat\n{\n options = {};\n\n /**\n * Create a format facade with caller-owned default options.\n * @param {object|null} [options] Default read options.\n */\n constructor(options = null)\n {\n this.options = { ...(options || {}) };\n }\n\n /** Apply caller-provided instance defaults. */\n SetValues(values = null)\n {\n this.options = { ...this.options, ...(values || {}) };\n return this;\n }\n\n /** Return caller-provided instance defaults. */\n GetValues()\n {\n return { ...this.options };\n }\n\n /** Read through the concrete instance implementation. */\n Read(_input, _options = null)\n {\n const error = new Error(`${this.constructor.name}.Read is not implemented.`);\n error.code = \"CJS_FORMAT_READ_NOT_IMPLEMENTED\";\n throw error;\n }\n\n /** Async instance read; synchronous readers inherit this exact fallback. */\n async ReadAsync(input, options = null)\n {\n return this.Read(input, options);\n }\n\n /** Inspect with the instance's normalized options when available. */\n Inspect(input, options = null)\n {\n const values = this.GetValues(options || {});\n return this.constructor.inspect(input, values);\n }\n\n /** Return the cheap, unverified support report for this instance profile. */\n GetSupport(input, options = null)\n {\n const values = this.GetValues(options || {});\n return this.constructor.getSupport(input, values);\n }\n\n /** Exercise one exact output through the real asynchronous read path. */\n VerifySupport(input, options = null)\n {\n const values = this.GetValues(options || {});\n return this.constructor.verifySupport(input, values);\n }\n\n /**\n * Static read boundary. Concrete formats normally override this; the base\n * fallback supports the few formats implemented only as instance readers.\n */\n static read(input, options = null)\n {\n const reader = new this(options || {});\n if (reader.Read === CjsFormat.prototype.Read)\n {\n const error = new Error(`${this.name}.read is not implemented.`);\n error.code = \"CJS_FORMAT_READ_NOT_IMPLEMENTED\";\n throw error;\n }\n return reader.Read(input, options || {});\n }\n\n /** Async read boundary used by support verification and resource loading. */\n static async readAsync(input, options = null)\n {\n if (Object.hasOwn(this, \"read\")) return this.read(input, options || {});\n const reader = new this(options || {});\n return reader.ReadAsync(input, options || {});\n }\n\n /**\n * Synchronous structural metadata accessor.\n *\n * Inspection answers what the input is. It does not claim that any decoder\n * output works in the current environment.\n */\n static inspect(_input, _options = null)\n {\n const error = new Error(`${this.name}.inspect is not implemented.`);\n error.code = \"CJS_FORMAT_INSPECT_NOT_IMPLEMENTED\";\n throw error;\n }\n\n /** Cheap synchronous identification used only for route selection. */\n static is(input, options = null)\n {\n try\n {\n if (Object.hasOwn(this, \"probeSupport\"))\n {\n return recognizesProbe(this.probeSupport(input, options || {}));\n }\n this.inspect(input, options || {});\n return true;\n }\n catch\n {\n return false;\n }\n }\n\n /**\n * Format-specific cheap support probe hook.\n *\n * Concrete formats may override this with header/environment reasoning. The\n * public getSupport() method normalizes its result into the uniform contract.\n */\n static probeSupport(input, options = null)\n {\n try\n {\n return {\n format: this.id,\n source: typeof input === \"string\" ? \"path\" : \"buffer\",\n recognized: true,\n metadata: this.inspect(input, options || {}),\n reason: \"Container structure recognized.\"\n };\n }\n catch (error)\n {\n return {\n format: this.id,\n source: typeof input === \"string\" ? \"path\" : \"buffer\",\n recognized: false,\n metadata: null,\n reason: error?.message || \"Input was not recognized.\",\n errors: [ error?.message || \"Input was not recognized.\" ]\n };\n }\n }\n\n /**\n * Cheap synchronous output support report.\n *\n * This is advisory: it may use headers, structure, and current environment\n * features, but never claims that the decoder ran. Every output entry is\n * therefore returned with verified:false.\n */\n static getSupport(input, options = null)\n {\n const values = options && typeof options === \"object\" ? options : {};\n let report;\n try\n {\n report = this.probeSupport(input, values);\n }\n catch (error)\n {\n report = {\n format: this.id,\n source: typeof input === \"string\" ? \"path\" : \"buffer\",\n recognized: false,\n reason: error?.message || \"Support probe failed.\",\n errors: [ error?.message || \"Support probe failed.\" ]\n };\n }\n return normalizeSupportReport(this, report, values);\n }\n\n /**\n * Prove one exact output by exercising the real asynchronous reader.\n *\n * This is an explicit diagnostic/capability operation. Normal resource\n * loading calls readAsync() once and treats its successful result as proof;\n * it must not verify and then decode the same payload a second time.\n */\n static async verifySupport(input, options = null)\n {\n const values = options && typeof options === \"object\" ? options : {};\n const report = this.getSupport(input, values);\n const capability = this.getOutputCapability(report.output);\n\n if (!capability)\n {\n const message = report.output\n ? `${this.name} declares no output ${JSON.stringify(report.output)}.`\n : `${this.name} declares no verifiable default output.`;\n return {\n ...report,\n supported: false,\n verified: true,\n reason: message,\n error: {\n name: \"Error\",\n code: \"CJS_FORMAT_OUTPUT_UNDECLARED\",\n message\n }\n };\n }\n\n try\n {\n await this.readAsync(input, { ...values, emit: capability.output });\n return freezeVerification(report, capability, true, null);\n }\n catch (error)\n {\n return freezeVerification(report, capability, false, error);\n }\n }\n\n /** Return the canonical declaration for one output selector. */\n static getOutputCapability(output = null)\n {\n if (!output)\n {\n return Object.values(this.outputs).find(entry => entry.default) || null;\n }\n const normalized = String(output).toLowerCase();\n return Object.values(this.outputs).find(entry =>\n entry.output.toLowerCase() === normalized) || null;\n }\n\n /**\n * Whether this format can be written, optionally from one named input.\n *\n * @param {string} [input] Payload name, or omitted for \"at all\".\n * @returns {boolean} True when a matching input is declared.\n */\n static canWrite(input = null)\n {\n return this.getInputCapability(input) !== null;\n }\n\n /** Look up one declared write input, or the default when none is named. */\n static getInputCapability(input = null)\n {\n if (!input)\n {\n return Object.values(this.inputs).find(entry => entry.default) || null;\n }\n const normalized = String(input).toLowerCase();\n return Object.values(this.inputs).find(entry =>\n entry.input.toLowerCase() === normalized) || null;\n }\n\n /**\n * Freeze and validate one format's authoritative input map.\n *\n * Mirrors `defineOutputs`, including the one-default rule: a format that can\n * be written from several payloads still has one obvious answer to \"write\n * this\", and leaving that to argument order is how a caller ends up writing\n * the wrong thing silently.\n *\n * `lossy` is declared rather than inferred. It is the fact a caller most\n * needs before choosing a writer - a converter that reaches for JPEG to save\n * space and destroys an alpha channel it needed has made a mistake nothing\n * downstream can detect.\n */\n static defineInputs(definitions = {})\n {\n if (!definitions || typeof definitions !== \"object\" || Array.isArray(definitions))\n {\n throw new TypeError(\"CjsFormat.defineInputs requires an object map.\");\n }\n\n const inputs = {};\n let defaults = 0;\n for (const [ input, definition ] of Object.entries(definitions))\n {\n if (!input || !definition || typeof definition !== \"object\" || Array.isArray(definition))\n {\n throw new TypeError(\"Each format input requires a non-empty name and descriptor.\");\n }\n const writeMode = definition.writeMode || READ_MODE_SYNC;\n if (![ READ_MODE_SYNC, READ_MODE_ASYNC ].includes(writeMode))\n {\n throw new TypeError(`Format input ${input} has invalid writeMode ${JSON.stringify(writeMode)}.`);\n }\n if (definition.default === true) defaults++;\n inputs[input] = {\n input,\n payloadType: definition.payloadType || input,\n writeMode,\n lossy: definition.lossy === true,\n default: definition.default === true,\n options: [ ...(definition.options || []) ]\n };\n }\n if (defaults > 1) throw new TypeError(\"A format may declare only one default input.\");\n if (Object.keys(inputs).length > 0 && defaults !== 1)\n {\n throw new TypeError(\"A format with inputs must declare exactly one default input.\");\n }\n return Object.freeze(inputs);\n }\n\n /** Freeze and validate one format's authoritative output map. */\n static defineOutputs(definitions = {})\n {\n if (!definitions || typeof definitions !== \"object\" || Array.isArray(definitions))\n {\n throw new TypeError(\"CjsFormat.defineOutputs requires an object map.\");\n }\n\n const outputs = {};\n let defaults = 0;\n for (const [ output, definition ] of Object.entries(definitions))\n {\n if (!output || !definition || typeof definition !== \"object\" || Array.isArray(definition))\n {\n throw new TypeError(\"Each format output requires a non-empty name and descriptor.\");\n }\n const role = definition.role || OUTPUT_ROLE_RUNTIME;\n const readMode = definition.readMode || READ_MODE_SYNC;\n if (![ OUTPUT_ROLE_RUNTIME, OUTPUT_ROLE_DEBUG ].includes(role))\n {\n throw new TypeError(`Format output ${output} has invalid role ${JSON.stringify(role)}.`);\n }\n if (![ READ_MODE_SYNC, READ_MODE_ASYNC ].includes(readMode))\n {\n throw new TypeError(`Format output ${output} has invalid readMode ${JSON.stringify(readMode)}.`);\n }\n if (definition.default === true) defaults++;\n const probes = definition.probes ?? definition.probe ?? output;\n outputs[output] = {\n output,\n payloadType: definition.payloadType || output,\n role,\n readMode,\n decoded: definition.decoded === true,\n passthrough: definition.passthrough === true,\n default: definition.default === true,\n probes: (Array.isArray(probes) ? probes : [ probes ]).map(String),\n requires: [ ...(definition.requires || []) ]\n };\n }\n if (defaults > 1) throw new TypeError(\"A format may declare only one default output.\");\n if (Object.keys(outputs).length > 0 && defaults !== 1)\n {\n throw new TypeError(\"A format with outputs must declare exactly one default output.\");\n }\n return outputs;\n }\n\n /** Assert the canonical format surface without requiring optional outputs. */\n static validateContract(Constructor)\n {\n if (typeof Constructor !== \"function\" || !(Constructor.prototype instanceof CjsFormat))\n {\n throw new TypeError(\"CjsFormat.validateContract requires a CjsFormat subclass.\");\n }\n if (typeof Constructor.id !== \"string\" || !Constructor.id)\n {\n throw new TypeError(`${Constructor.name} must declare a non-empty id.`);\n }\n if (!Array.isArray(Constructor.mediaTypes) || Constructor.mediaTypes.length === 0)\n {\n throw new TypeError(`${Constructor.name} must declare non-empty mediaTypes.`);\n }\n for (const mediaType of Constructor.mediaTypes)\n {\n if (!Object.values(MediaType).includes(mediaType))\n {\n throw new TypeError(`${Constructor.name} media type ${JSON.stringify(mediaType)} is not canonical.`);\n }\n }\n if (!Array.isArray(Constructor.extensions))\n {\n throw new TypeError(`${Constructor.name} must declare extensions.`);\n }\n if (!Constructor.outputs || typeof Constructor.outputs !== \"object\"\n || Array.isArray(Constructor.outputs))\n {\n throw new TypeError(`${Constructor.name} must declare outputs.`);\n }\n if (typeof Constructor.requestResponseType !== \"string\" || !Constructor.requestResponseType)\n {\n throw new TypeError(`${Constructor.name} must declare a requestResponseType.`);\n }\n if (Constructor.worker !== null)\n {\n if (!Constructor.worker || typeof Constructor.worker !== \"object\")\n {\n throw new TypeError(`${Constructor.name}.worker must be null or a descriptor object.`);\n }\n if (typeof Constructor.worker.module !== \"string\" || !Constructor.worker.module\n || typeof Constructor.worker.exportName !== \"string\" || !Constructor.worker.exportName\n || !Array.isArray(Constructor.worker.outputTypes))\n {\n throw new TypeError(`${Constructor.name}.worker has an invalid execution descriptor.`);\n }\n for (const output of Constructor.worker.outputTypes)\n {\n if (!Constructor.getOutputCapability(output))\n {\n throw new TypeError(`${Constructor.name}.worker names undeclared output ${JSON.stringify(output)}.`);\n }\n }\n if (Constructor.worker.defaultOutput && !Constructor.getOutputCapability(Constructor.worker.defaultOutput))\n {\n throw new TypeError(`${Constructor.name}.worker names an undeclared default output.`);\n }\n }\n for (const retired of [ \"type\", \"inputTypes\", \"outputTypes\", \"debugOutputTypes\", \"implementationStatus\" ])\n {\n if (Object.hasOwn(Constructor, retired))\n {\n throw new TypeError(`${Constructor.name} must not declare retired static ${retired}.`);\n }\n }\n let defaults = 0;\n for (const [ output, capability ] of Object.entries(Constructor.outputs))\n {\n if (capability.output !== output)\n {\n throw new TypeError(`${Constructor.name} output ${output} has a mismatched descriptor.`);\n }\n if (capability.default) defaults++;\n }\n if (Object.keys(Constructor.outputs).length > 0 && defaults !== 1)\n {\n throw new TypeError(`${Constructor.name} must declare exactly one default output.`);\n }\n }\n\n static Type = MediaType;\n static MediaType = MediaType;\n static OutputType = Object.freeze({\n AUDIO: PayloadType.AUDIO,\n CMF: \"cmf\",\n DOCUMENT: \"document\",\n GR2: \"gr2\",\n IMAGE: PayloadType.IMAGE,\n JSON: \"json\",\n MEDIA: \"media\",\n METADATA: \"metadata\",\n OGG: \"ogg\",\n PAYLOAD: \"payload\",\n PCM: \"pcm\",\n RAW: PayloadType.RAW,\n RGBA: \"rgba\",\n RUNTIME: \"runtime\",\n SCHEMA: PayloadType.SCHEMA,\n SHADER: PayloadType.SHADER,\n SHARED: \"shared\",\n TEXTURE: PayloadType.TEXTURE,\n VIDEO: PayloadType.VIDEO\n });\n\n static id = \"\";\n static mediaTypes = Object.freeze([]);\n static extensions = Object.freeze([]);\n static outputs = Object.freeze({});\n /**\n * What this format can be written FROM, empty when it cannot be written.\n *\n * The counterpart of `outputs`, and empty by default so that declaring a\n * writer is a deliberate act and every existing format keeps saying \"read\n * only\" without being touched. A caller asks `canWrite()` rather than\n * probing for a `write` method, because the presence of a function is not a\n * contract - it says nothing about what payload it takes or whether the\n * result is lossy.\n */\n static inputs = Object.freeze({});\n static requestResponseType = \"arraybuffer\";\n static worker = null;\n}\n\nfunction normalizeSupportReport(Format, rawReport, options)\n{\n const raw = typeof rawReport === \"boolean\"\n ? { recognized: rawReport, supported: rawReport }\n : rawReport && typeof rawReport === \"object\" ? rawReport : {};\n const requested = options.emit ?? null;\n const capability = Format.getOutputCapability(requested);\n const legacyVariants = Array.isArray(raw.variants) ? raw.variants : [];\n const rawPositive = raw.supported === true\n || raw.supported === \"full\"\n || raw.supported === \"partial\";\n const recognized = raw.recognized === true\n || (raw.recognized !== false && (raw.metadata != null || rawPositive));\n\n const outputs = Object.values(Format.outputs).map(entry =>\n {\n const variant = findLegacyVariant(entry, legacyVariants);\n const supported = variant\n ? variant.supported === true\n : recognized && (legacyVariants.length === 0 ? raw.supported !== false && raw.supported !== \"none\" : false);\n return {\n ...entry,\n supported,\n verified: false,\n codec: variant?.codec || \"\",\n reason: variant?.reason\n || raw.reason\n || (supported ? \"Output appears usable from structural evidence.\" : \"Output was not supported by the structural probe.\"),\n requires: [ ...(variant?.requires || entry.requires) ]\n };\n });\n\n const selected = capability\n ? outputs.find(entry => entry.output === capability.output) || null\n : null;\n // The declared default is consulted BEFORE falling back to declaration\n // order. `default: true` is the format stating which output it wants asked\n // for, so ignoring it here meant a probe had to repeat that choice by hand as\n // `preferredOutput` — and a format whose outputs are all `role: \"debug\"`\n // (webp, gif) otherwise resolved to whichever happened to be declared first.\n // An explicit `raw.preferredOutput` still wins, because that is the probe\n // reporting a per-input decision rather than a standing preference.\n const preferredOutput = resolvePreferredOutput(raw.preferredOutput, outputs)\n || outputs.find(entry => entry.supported && entry.role === OUTPUT_ROLE_RUNTIME)?.output\n || outputs.find(entry => entry.supported && entry.default)?.output\n || outputs.find(entry => entry.supported)?.output\n || \"\";\n\n return {\n format: Format.id || raw.format || Format.name,\n source: raw.source || options.source || \"buffer\",\n recognized,\n output: capability?.output || (requested == null ? \"\" : String(requested)),\n supported: selected?.supported === true,\n verified: false,\n preferredOutput,\n reason: selected?.reason || raw.reason || (recognized ? \"Input recognized.\" : \"Input not recognized.\"),\n metadata: raw.metadata ?? null,\n capability: selected,\n outputs: outputs,\n warnings: [ ...(raw.warnings || []) ],\n errors: [ ...(raw.errors || []) ],\n error: null\n };\n}\n\nfunction recognizesProbe(report)\n{\n if (report === true) return true;\n if (!report || typeof report !== \"object\" || report.recognized === false) return false;\n return report.recognized === true\n || report.supported === true\n || report.supported === \"full\"\n || report.supported === \"partial\"\n || report.metadata != null;\n}\n\nfunction findLegacyVariant(capability, variants)\n{\n const probes = new Set(capability.probes.map(value => value.toLowerCase()));\n const matches = variants.filter(variant =>\n {\n for (const value of [ variant?.output, variant?.kind, variant?.payloadType ])\n {\n if (value != null && probes.has(String(value).toLowerCase())) return true;\n }\n return false;\n });\n const output = capability.output.toLowerCase();\n return matches.find(variant => String(variant?.output || \"\").toLowerCase() === output)\n || matches.find(variant => String(variant?.kind || \"\").toLowerCase() === output)\n || matches.find(variant => String(variant?.payloadType || \"\").toLowerCase() === output)\n || matches.find(variant => variant.supported === true)\n || matches[0]\n || null;\n}\n\nfunction resolvePreferredOutput(preferredOutput, outputs)\n{\n if (!preferredOutput) return \"\";\n const normalized = String(preferredOutput).toLowerCase();\n const direct = outputs.find(entry => entry.output.toLowerCase() === normalized);\n return direct?.output || \"\";\n}\n\nfunction freezeVerification(report, capability, supported, error)\n{\n const errorReport = error ? serializeError(error) : null;\n const outputs = report.outputs.map(entry => entry.output === capability.output\n ? {\n ...entry,\n supported,\n verified: true,\n reason: supported ? \"The real asynchronous read path completed successfully.\" : errorReport.message\n }\n : entry);\n return {\n ...report,\n recognized: supported ? true : report.recognized,\n supported,\n verified: true,\n reason: supported ? \"The real asynchronous read path completed successfully.\" : errorReport.message,\n capability: outputs.find(entry => entry.output === capability.output) || null,\n outputs: outputs,\n errors: errorReport ? [ ...report.errors, errorReport.message ] : report.errors,\n error: errorReport\n };\n}\n\nfunction serializeError(error)\n{\n const details = {};\n for (const [ key, value ] of Object.entries(error || {}))\n {\n if ([ \"name\", \"code\", \"message\", \"cause\" ].includes(key)) continue;\n details[key] = value;\n }\n return {\n name: error?.name || \"Error\",\n code: error?.code || \"CJS_FORMAT_VERIFY_FAILED\",\n message: error?.message || String(error),\n details: details,\n cause: error?.cause\n ? {\n name: error.cause.name || \"Error\",\n code: error.cause.code || \"\",\n message: error.cause.message || String(error.cause)\n }\n : null\n };\n}\n\nexport const CjsFormatOutputRole = Object.freeze({\n RUNTIME: OUTPUT_ROLE_RUNTIME,\n DEBUG: OUTPUT_ROLE_DEBUG\n});\n\nexport const CjsFormatReadMode = Object.freeze({\n SYNC: READ_MODE_SYNC,\n ASYNC: READ_MODE_ASYNC\n});\n\nexport default CjsFormat;\n"],"names":["OUTPUT_ROLE_RUNTIME","OUTPUT_ROLE_DEBUG","READ_MODE_SYNC","READ_MODE_ASYNC","CjsFormat","options","constructor","SetValues","values","GetValues","Read","_input","_options","error","Error","name","code","ReadAsync","input","Inspect","inspect","GetSupport","getSupport","VerifySupport","verifySupport","read","reader","prototype","readAsync","Object","hasOwn","is","recognizesProbe","probeSupport","format","id","source","recognized","metadata","reason","message","errors","report","normalizeSupportReport","capability","getOutputCapability","output","JSON","stringify","supported","verified","emit","freezeVerification","outputs","find","entry","default","normalized","String","toLowerCase","canWrite","getInputCapability","inputs","defineInputs","definitions","Array","isArray","TypeError","defaults","definition","entries","writeMode","includes","payloadType","lossy","keys","length","freeze","defineOutputs","role","readMode","probes","probe","decoded","passthrough","map","requires","validateContract","Constructor","mediaTypes","mediaType","MediaType","extensions","requestResponseType","worker","module","exportName","outputTypes","defaultOutput","retired","Type","OutputType","AUDIO","PayloadType","CMF","DOCUMENT","GR2","IMAGE","MEDIA","METADATA","OGG","PAYLOAD","PCM","RAW","RGBA","RUNTIME","SCHEMA","SHADER","SHARED","TEXTURE","VIDEO","Format","rawReport","raw","requested","legacyVariants","variants","rawPositive","variant","findLegacyVariant","codec","selected","preferredOutput","resolvePreferredOutput","warnings","Set","value","matches","filter","kind","has","direct","errorReport","serializeError","details","key","cause","CjsFormatOutputRole","DEBUG","CjsFormatReadMode","SYNC","ASYNC"],"mappings":";;AAEA,MAAMA,mBAAmB,GAAG,SAAS;AACrC,MAAMC,iBAAiB,GAAG,OAAO;AACjC,MAAMC,cAAc,GAAG,MAAM;AAC7B,MAAMC,eAAe,GAAG,OAAO;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,SAAS,CACtB;EACEC,OAAO,GAAG,EAAE;;AAEZ;AACF;AACA;AACA;AACEC,EAAAA,WAAWA,CAACD,OAAO,GAAG,IAAI,EAC1B;IACE,IAAI,CAACA,OAAO,GAAG;MAAE,IAAIA,OAAO,IAAI,EAAE;KAAG;AACvC,EAAA;;AAEA;AACAE,EAAAA,SAASA,CAACC,MAAM,GAAG,IAAI,EACvB;IACE,IAAI,CAACH,OAAO,GAAG;MAAE,GAAG,IAAI,CAACA,OAAO;MAAE,IAAIG,MAAM,IAAI,EAAE;KAAG;AACrD,IAAA,OAAO,IAAI;AACb,EAAA;;AAEA;AACAC,EAAAA,SAASA,GACT;IACE,OAAO;AAAE,MAAA,GAAG,IAAI,CAACJ;KAAS;AAC5B,EAAA;;AAEA;AACAK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,CAAC7C,KAAK,CAAC;AACxCmI,IAAAA,OAAO,EAAEA,OAAO;AAChBE,IAAAA,KAAK,EAAErI,KAAK,EAAEqI,KAAK,GACf;AACAnI,MAAAA,IAAI,EAAEF,KAAK,CAACqI,KAAK,CAACnI,IAAI,IAAI,OAAO;AACjCC,MAAAA,IAAI,EAAEH,KAAK,CAACqI,KAAK,CAAClI,IAAI,IAAI,EAAE;MAC5BwB,OAAO,EAAE3B,KAAK,CAACqI,KAAK,CAAC1G,OAAO,IAAIkB,MAAM,CAAC7C,KAAK,CAACqI,KAAK;AACpD,KAAC,GACC;GACL;AACH;MAEaC,mBAAmB,GAAGtH,MAAM,CAACgD,MAAM,CAAC;AAC/CsC,EAAAA,OAAO,EAAEnH,mBAAmB;AAC5BoJ,EAAAA,KAAK,EAAEnJ;AACT,CAAC;MAEYoJ,iBAAiB,GAAGxH,MAAM,CAACgD,MAAM,CAAC;AAC7CyE,EAAAA,IAAI,EAAEpJ,cAAc;AACpBqJ,EAAAA,KAAK,EAAEpJ;AACT,CAAC;;;;"}
1
+ {"version":3,"file":"CjsFormat.js","sources":["../../../../src/resource/format/CjsFormat.js"],"sourcesContent":["import { MediaType, PayloadType } from \"#consts/media\";\n\nconst OUTPUT_ROLE_RUNTIME = \"runtime\";\nconst OUTPUT_ROLE_DEBUG = \"debug\";\nconst READ_MODE_SYNC = \"sync\";\nconst READ_MODE_ASYNC = \"async\";\n\n/**\n * Decorator-free base for every concrete format facade.\n *\n * The format subpaths must remain directly importable from authored source, so\n * this base carries no decorators. Formats return plain support reports;\n * CjsResourceProbe.from() is the optional resource-layer normalization.\n */\nexport class CjsFormat\n{\n options = {};\n\n /**\n * Create a format facade with caller-owned default options.\n * @param {object|null} [options] Default read options.\n */\n constructor(options = null)\n {\n this.options = { ...(options || {}) };\n }\n\n /** Apply caller-provided instance defaults. */\n SetValues(values = null)\n {\n this.options = { ...this.options, ...(values || {}) };\n return this;\n }\n\n /** Return caller-provided instance defaults. */\n GetValues()\n {\n return { ...this.options };\n }\n\n /** Read through the concrete instance implementation. */\n Read(_input, _options = null)\n {\n const error = new Error(`${this.constructor.name}.Read is not implemented.`);\n error.code = \"CJS_FORMAT_READ_NOT_IMPLEMENTED\";\n throw error;\n }\n\n /** Async instance read; synchronous readers inherit this exact fallback. */\n async ReadAsync(input, options = null)\n {\n return this.Read(input, options);\n }\n\n /** Inspect with the instance's normalized options when available. */\n Inspect(input, options = null)\n {\n const values = this.GetValues(options || {});\n return this.constructor.inspect(input, values);\n }\n\n /** Return the cheap, unverified support report for this instance profile. */\n GetSupport(input, options = null)\n {\n const values = this.GetValues(options || {});\n return this.constructor.getSupport(input, values);\n }\n\n /** Exercise one exact output through the real asynchronous read path. */\n VerifySupport(input, options = null)\n {\n const values = this.GetValues(options || {});\n return this.constructor.verifySupport(input, values);\n }\n\n /**\n * Static read boundary. Concrete formats normally override this; the base\n * fallback supports the few formats implemented only as instance readers.\n */\n static read(input, options = null)\n {\n const reader = new this(options || {});\n if (reader.Read === CjsFormat.prototype.Read)\n {\n const error = new Error(`${this.name}.read is not implemented.`);\n error.code = \"CJS_FORMAT_READ_NOT_IMPLEMENTED\";\n throw error;\n }\n return reader.Read(input, options || {});\n }\n\n /** Async read boundary used by support verification and resource loading. */\n static async readAsync(input, options = null)\n {\n if (Object.hasOwn(this, \"read\")) return this.read(input, options || {});\n const reader = new this(options || {});\n return reader.ReadAsync(input, options || {});\n }\n\n /**\n * Synchronous structural metadata accessor.\n *\n * Inspection answers what the input is. It does not claim that any decoder\n * output works in the current environment.\n */\n static inspect(_input, _options = null)\n {\n const error = new Error(`${this.name}.inspect is not implemented.`);\n error.code = \"CJS_FORMAT_INSPECT_NOT_IMPLEMENTED\";\n throw error;\n }\n\n /** Cheap synchronous identification used only for route selection. */\n static is(input, options = null)\n {\n try\n {\n if (Object.hasOwn(this, \"probeSupport\"))\n {\n return recognizesProbe(this.probeSupport(input, options || {}));\n }\n this.inspect(input, options || {});\n return true;\n }\n catch\n {\n return false;\n }\n }\n\n /**\n * Format-specific cheap support probe hook.\n *\n * Concrete formats may override this with header/environment reasoning. The\n * public getSupport() method normalizes its result into the uniform contract.\n */\n static probeSupport(input, options = null)\n {\n try\n {\n return {\n format: this.id,\n source: typeof input === \"string\" ? \"path\" : \"buffer\",\n recognized: true,\n metadata: this.inspect(input, options || {}),\n reason: \"Container structure recognized.\"\n };\n }\n catch (error)\n {\n return {\n format: this.id,\n source: typeof input === \"string\" ? \"path\" : \"buffer\",\n recognized: false,\n metadata: null,\n reason: error?.message || \"Input was not recognized.\",\n errors: [ error?.message || \"Input was not recognized.\" ]\n };\n }\n }\n\n /**\n * Cheap synchronous output support report.\n *\n * This is advisory: it may use headers, structure, and current environment\n * features, but never claims that the decoder ran. Every output entry is\n * therefore returned with verified:false.\n */\n static getSupport(input, options = null)\n {\n const values = options && typeof options === \"object\" ? options : {};\n let report;\n try\n {\n report = this.probeSupport(input, values);\n }\n catch (error)\n {\n report = {\n format: this.id,\n source: typeof input === \"string\" ? \"path\" : \"buffer\",\n recognized: false,\n reason: error?.message || \"Support probe failed.\",\n errors: [ error?.message || \"Support probe failed.\" ]\n };\n }\n return normalizeSupportReport(this, report, values);\n }\n\n /**\n * Prove one exact output by exercising the real asynchronous reader.\n *\n * This is an explicit diagnostic/capability operation. Normal resource\n * loading calls readAsync() once and treats its successful result as proof;\n * it must not verify and then decode the same payload a second time.\n */\n static async verifySupport(input, options = null)\n {\n const values = options && typeof options === \"object\" ? options : {};\n const report = this.getSupport(input, values);\n const capability = this.getOutputCapability(report.output);\n\n if (!capability)\n {\n const message = report.output\n ? `${this.name} declares no output ${JSON.stringify(report.output)}.`\n : `${this.name} declares no verifiable default output.`;\n return {\n ...report,\n supported: false,\n verified: true,\n reason: message,\n error: {\n name: \"Error\",\n code: \"CJS_FORMAT_OUTPUT_UNDECLARED\",\n message\n }\n };\n }\n\n try\n {\n await this.readAsync(input, { ...values, emit: capability.output });\n return freezeVerification(report, capability, true, null);\n }\n catch (error)\n {\n return freezeVerification(report, capability, false, error);\n }\n }\n\n /** Return the canonical declaration for one output selector. */\n static getOutputCapability(output = null)\n {\n if (!output)\n {\n return Object.values(this.outputs).find(entry => entry.default) || null;\n }\n const normalized = String(output).toLowerCase();\n return Object.values(this.outputs).find(entry =>\n entry.output.toLowerCase() === normalized) || null;\n }\n\n /**\n * Whether this format can be written, optionally from one named input.\n *\n * @param {string} [input] Payload name, or omitted for \"at all\".\n * @returns {boolean} True when a matching input is declared.\n */\n static canWrite(input = null)\n {\n return this.getInputCapability(input) !== null;\n }\n\n /** Look up one declared write input, or the default when none is named. */\n static getInputCapability(input = null)\n {\n if (!input)\n {\n return Object.values(this.inputs).find(entry => entry.default) || null;\n }\n const normalized = String(input).toLowerCase();\n return Object.values(this.inputs).find(entry =>\n entry.input.toLowerCase() === normalized) || null;\n }\n\n /**\n * Freeze and validate one format's authoritative input map.\n *\n * Mirrors `defineOutputs`, including the one-default rule: a format that can\n * be written from several payloads still has one obvious answer to \"write\n * this\", and leaving that to argument order is how a caller ends up writing\n * the wrong thing silently.\n *\n * `lossy` is declared rather than inferred. It is the fact a caller most\n * needs before choosing a writer - a converter that reaches for JPEG to save\n * space and destroys an alpha channel it needed has made a mistake nothing\n * downstream can detect.\n */\n static defineInputs(definitions = {})\n {\n if (!definitions || typeof definitions !== \"object\" || Array.isArray(definitions))\n {\n throw new TypeError(\"CjsFormat.defineInputs requires an object map.\");\n }\n\n const inputs = {};\n let defaults = 0;\n for (const [ input, definition ] of Object.entries(definitions))\n {\n if (!input || !definition || typeof definition !== \"object\" || Array.isArray(definition))\n {\n throw new TypeError(\"Each format input requires a non-empty name and descriptor.\");\n }\n const writeMode = definition.writeMode || READ_MODE_SYNC;\n if (![ READ_MODE_SYNC, READ_MODE_ASYNC ].includes(writeMode))\n {\n throw new TypeError(`Format input ${input} has invalid writeMode ${JSON.stringify(writeMode)}.`);\n }\n if (definition.default === true) defaults++;\n inputs[input] = {\n input,\n payloadType: definition.payloadType || input,\n writeMode,\n lossy: definition.lossy === true,\n default: definition.default === true,\n options: [ ...(definition.options || []) ]\n };\n }\n if (defaults > 1) throw new TypeError(\"A format may declare only one default input.\");\n if (Object.keys(inputs).length > 0 && defaults !== 1)\n {\n throw new TypeError(\"A format with inputs must declare exactly one default input.\");\n }\n return inputs;\n }\n\n /** Freeze and validate one format's authoritative output map. */\n static defineOutputs(definitions = {})\n {\n if (!definitions || typeof definitions !== \"object\" || Array.isArray(definitions))\n {\n throw new TypeError(\"CjsFormat.defineOutputs requires an object map.\");\n }\n\n const outputs = {};\n let defaults = 0;\n for (const [ output, definition ] of Object.entries(definitions))\n {\n if (!output || !definition || typeof definition !== \"object\" || Array.isArray(definition))\n {\n throw new TypeError(\"Each format output requires a non-empty name and descriptor.\");\n }\n const role = definition.role || OUTPUT_ROLE_RUNTIME;\n const readMode = definition.readMode || READ_MODE_SYNC;\n if (![ OUTPUT_ROLE_RUNTIME, OUTPUT_ROLE_DEBUG ].includes(role))\n {\n throw new TypeError(`Format output ${output} has invalid role ${JSON.stringify(role)}.`);\n }\n if (![ READ_MODE_SYNC, READ_MODE_ASYNC ].includes(readMode))\n {\n throw new TypeError(`Format output ${output} has invalid readMode ${JSON.stringify(readMode)}.`);\n }\n if (definition.default === true) defaults++;\n const probes = definition.probes ?? definition.probe ?? output;\n outputs[output] = {\n output,\n payloadType: definition.payloadType || output,\n role,\n readMode,\n decoded: definition.decoded === true,\n passthrough: definition.passthrough === true,\n default: definition.default === true,\n probes: (Array.isArray(probes) ? probes : [ probes ]).map(String),\n requires: [ ...(definition.requires || []) ]\n };\n }\n if (defaults > 1) throw new TypeError(\"A format may declare only one default output.\");\n if (Object.keys(outputs).length > 0 && defaults !== 1)\n {\n throw new TypeError(\"A format with outputs must declare exactly one default output.\");\n }\n return outputs;\n }\n\n /** Assert the canonical format surface without requiring optional outputs. */\n static validateContract(Constructor)\n {\n if (typeof Constructor !== \"function\" || !(Constructor.prototype instanceof CjsFormat))\n {\n throw new TypeError(\"CjsFormat.validateContract requires a CjsFormat subclass.\");\n }\n if (typeof Constructor.id !== \"string\" || !Constructor.id)\n {\n throw new TypeError(`${Constructor.name} must declare a non-empty id.`);\n }\n if (!Array.isArray(Constructor.mediaTypes) || Constructor.mediaTypes.length === 0)\n {\n throw new TypeError(`${Constructor.name} must declare non-empty mediaTypes.`);\n }\n for (const mediaType of Constructor.mediaTypes)\n {\n if (!Object.values(MediaType).includes(mediaType))\n {\n throw new TypeError(`${Constructor.name} media type ${JSON.stringify(mediaType)} is not canonical.`);\n }\n }\n if (!Array.isArray(Constructor.extensions))\n {\n throw new TypeError(`${Constructor.name} must declare extensions.`);\n }\n if (!Constructor.outputs || typeof Constructor.outputs !== \"object\"\n || Array.isArray(Constructor.outputs))\n {\n throw new TypeError(`${Constructor.name} must declare outputs.`);\n }\n if (typeof Constructor.requestResponseType !== \"string\" || !Constructor.requestResponseType)\n {\n throw new TypeError(`${Constructor.name} must declare a requestResponseType.`);\n }\n if (Constructor.worker !== null)\n {\n if (!Constructor.worker || typeof Constructor.worker !== \"object\")\n {\n throw new TypeError(`${Constructor.name}.worker must be null or a descriptor object.`);\n }\n if (typeof Constructor.worker.module !== \"string\" || !Constructor.worker.module\n || typeof Constructor.worker.exportName !== \"string\" || !Constructor.worker.exportName\n || !Array.isArray(Constructor.worker.outputTypes))\n {\n throw new TypeError(`${Constructor.name}.worker has an invalid execution descriptor.`);\n }\n for (const output of Constructor.worker.outputTypes)\n {\n if (!Constructor.getOutputCapability(output))\n {\n throw new TypeError(`${Constructor.name}.worker names undeclared output ${JSON.stringify(output)}.`);\n }\n }\n if (Constructor.worker.defaultOutput && !Constructor.getOutputCapability(Constructor.worker.defaultOutput))\n {\n throw new TypeError(`${Constructor.name}.worker names an undeclared default output.`);\n }\n }\n for (const retired of [ \"type\", \"inputTypes\", \"outputTypes\", \"debugOutputTypes\", \"implementationStatus\" ])\n {\n if (Object.hasOwn(Constructor, retired))\n {\n throw new TypeError(`${Constructor.name} must not declare retired static ${retired}.`);\n }\n }\n let defaults = 0;\n for (const [ output, capability ] of Object.entries(Constructor.outputs))\n {\n if (capability.output !== output)\n {\n throw new TypeError(`${Constructor.name} output ${output} has a mismatched descriptor.`);\n }\n if (capability.default) defaults++;\n }\n if (Object.keys(Constructor.outputs).length > 0 && defaults !== 1)\n {\n throw new TypeError(`${Constructor.name} must declare exactly one default output.`);\n }\n }\n\n static Type = MediaType;\n static MediaType = MediaType;\n static OutputType = Object.freeze({\n AUDIO: PayloadType.AUDIO,\n CMF: \"cmf\",\n DOCUMENT: \"document\",\n GR2: \"gr2\",\n IMAGE: PayloadType.IMAGE,\n JSON: \"json\",\n MEDIA: \"media\",\n METADATA: \"metadata\",\n OGG: \"ogg\",\n PAYLOAD: \"payload\",\n PCM: \"pcm\",\n RAW: PayloadType.RAW,\n RGBA: \"rgba\",\n RUNTIME: \"runtime\",\n SCHEMA: PayloadType.SCHEMA,\n SHADER: PayloadType.SHADER,\n SHARED: \"shared\",\n TEXTURE: PayloadType.TEXTURE,\n VIDEO: PayloadType.VIDEO\n });\n\n static id = \"\";\n static mediaTypes = [];\n static extensions = [];\n static outputs = {};\n /**\n * What this format can be written FROM, empty when it cannot be written.\n *\n * The counterpart of `outputs`, and empty by default so that declaring a\n * writer is a deliberate act and every existing format keeps saying \"read\n * only\" without being touched. A caller asks `canWrite()` rather than\n * probing for a `write` method, because the presence of a function is not a\n * contract - it says nothing about what payload it takes or whether the\n * result is lossy.\n */\n static inputs = {};\n static requestResponseType = \"arraybuffer\";\n static worker = null;\n}\n\nfunction normalizeSupportReport(Format, rawReport, options)\n{\n const raw = typeof rawReport === \"boolean\"\n ? { recognized: rawReport, supported: rawReport }\n : rawReport && typeof rawReport === \"object\" ? rawReport : {};\n const requested = options.emit ?? null;\n const capability = Format.getOutputCapability(requested);\n const legacyVariants = Array.isArray(raw.variants) ? raw.variants : [];\n const rawPositive = raw.supported === true\n || raw.supported === \"full\"\n || raw.supported === \"partial\";\n const recognized = raw.recognized === true\n || (raw.recognized !== false && (raw.metadata != null || rawPositive));\n\n const outputs = Object.values(Format.outputs).map(entry =>\n {\n const variant = findLegacyVariant(entry, legacyVariants);\n const supported = variant\n ? variant.supported === true\n : recognized && (legacyVariants.length === 0 ? raw.supported !== false && raw.supported !== \"none\" : false);\n return {\n ...entry,\n supported,\n verified: false,\n codec: variant?.codec || \"\",\n reason: variant?.reason\n || raw.reason\n || (supported ? \"Output appears usable from structural evidence.\" : \"Output was not supported by the structural probe.\"),\n requires: [ ...(variant?.requires || entry.requires) ]\n };\n });\n\n const selected = capability\n ? outputs.find(entry => entry.output === capability.output) || null\n : null;\n // The declared default is consulted BEFORE falling back to declaration\n // order. `default: true` is the format stating which output it wants asked\n // for, so ignoring it here meant a probe had to repeat that choice by hand as\n // `preferredOutput` — and a format whose outputs are all `role: \"debug\"`\n // (webp, gif) otherwise resolved to whichever happened to be declared first.\n // An explicit `raw.preferredOutput` still wins, because that is the probe\n // reporting a per-input decision rather than a standing preference.\n const preferredOutput = resolvePreferredOutput(raw.preferredOutput, outputs)\n || outputs.find(entry => entry.supported && entry.role === OUTPUT_ROLE_RUNTIME)?.output\n || outputs.find(entry => entry.supported && entry.default)?.output\n || outputs.find(entry => entry.supported)?.output\n || \"\";\n\n return {\n format: Format.id || raw.format || Format.name,\n source: raw.source || options.source || \"buffer\",\n recognized,\n output: capability?.output || (requested == null ? \"\" : String(requested)),\n supported: selected?.supported === true,\n verified: false,\n preferredOutput,\n reason: selected?.reason || raw.reason || (recognized ? \"Input recognized.\" : \"Input not recognized.\"),\n metadata: raw.metadata ?? null,\n capability: selected,\n outputs: outputs,\n warnings: [ ...(raw.warnings || []) ],\n errors: [ ...(raw.errors || []) ],\n error: null\n };\n}\n\nfunction recognizesProbe(report)\n{\n if (report === true) return true;\n if (!report || typeof report !== \"object\" || report.recognized === false) return false;\n return report.recognized === true\n || report.supported === true\n || report.supported === \"full\"\n || report.supported === \"partial\"\n || report.metadata != null;\n}\n\nfunction findLegacyVariant(capability, variants)\n{\n const probes = new Set(capability.probes.map(value => value.toLowerCase()));\n const matches = variants.filter(variant =>\n {\n for (const value of [ variant?.output, variant?.kind, variant?.payloadType ])\n {\n if (value != null && probes.has(String(value).toLowerCase())) return true;\n }\n return false;\n });\n const output = capability.output.toLowerCase();\n return matches.find(variant => String(variant?.output || \"\").toLowerCase() === output)\n || matches.find(variant => String(variant?.kind || \"\").toLowerCase() === output)\n || matches.find(variant => String(variant?.payloadType || \"\").toLowerCase() === output)\n || matches.find(variant => variant.supported === true)\n || matches[0]\n || null;\n}\n\nfunction resolvePreferredOutput(preferredOutput, outputs)\n{\n if (!preferredOutput) return \"\";\n const normalized = String(preferredOutput).toLowerCase();\n const direct = outputs.find(entry => entry.output.toLowerCase() === normalized);\n return direct?.output || \"\";\n}\n\nfunction freezeVerification(report, capability, supported, error)\n{\n const errorReport = error ? serializeError(error) : null;\n const outputs = report.outputs.map(entry => entry.output === capability.output\n ? {\n ...entry,\n supported,\n verified: true,\n reason: supported ? \"The real asynchronous read path completed successfully.\" : errorReport.message\n }\n : entry);\n return {\n ...report,\n recognized: supported ? true : report.recognized,\n supported,\n verified: true,\n reason: supported ? \"The real asynchronous read path completed successfully.\" : errorReport.message,\n capability: outputs.find(entry => entry.output === capability.output) || null,\n outputs: outputs,\n errors: errorReport ? [ ...report.errors, errorReport.message ] : report.errors,\n error: errorReport\n };\n}\n\nfunction serializeError(error)\n{\n const details = {};\n for (const [ key, value ] of Object.entries(error || {}))\n {\n if ([ \"name\", \"code\", \"message\", \"cause\" ].includes(key)) continue;\n details[key] = value;\n }\n return {\n name: error?.name || \"Error\",\n code: error?.code || \"CJS_FORMAT_VERIFY_FAILED\",\n message: error?.message || String(error),\n details: details,\n cause: error?.cause\n ? {\n name: error.cause.name || \"Error\",\n code: error.cause.code || \"\",\n message: error.cause.message || String(error.cause)\n }\n : null\n };\n}\n\nexport const CjsFormatOutputRole = Object.freeze({\n RUNTIME: OUTPUT_ROLE_RUNTIME,\n DEBUG: OUTPUT_ROLE_DEBUG\n});\n\nexport const CjsFormatReadMode = Object.freeze({\n SYNC: READ_MODE_SYNC,\n ASYNC: READ_MODE_ASYNC\n});\n\nexport default CjsFormat;\n"],"names":["OUTPUT_ROLE_RUNTIME","OUTPUT_ROLE_DEBUG","READ_MODE_SYNC","READ_MODE_ASYNC","CjsFormat","options","constructor","SetValues","values","GetValues","Read","_input","_options","error","Error","name","code","ReadAsync","input","Inspect","inspect","GetSupport","getSupport","VerifySupport","verifySupport","read","reader","prototype","readAsync","Object","hasOwn","is","recognizesProbe","probeSupport","format","id","source","recognized","metadata","reason","message","errors","report","normalizeSupportReport","capability","getOutputCapability","output","JSON","stringify","supported","verified","emit","freezeVerification","outputs","find","entry","default","normalized","String","toLowerCase","canWrite","getInputCapability","inputs","defineInputs","definitions","Array","isArray","TypeError","defaults","definition","entries","writeMode","includes","payloadType","lossy","keys","length","defineOutputs","role","readMode","probes","probe","decoded","passthrough","map","requires","validateContract","Constructor","mediaTypes","mediaType","MediaType","extensions","requestResponseType","worker","module","exportName","outputTypes","defaultOutput","retired","Type","OutputType","freeze","AUDIO","PayloadType","CMF","DOCUMENT","GR2","IMAGE","MEDIA","METADATA","OGG","PAYLOAD","PCM","RAW","RGBA","RUNTIME","SCHEMA","SHADER","SHARED","TEXTURE","VIDEO","Format","rawReport","raw","requested","legacyVariants","variants","rawPositive","variant","findLegacyVariant","codec","selected","preferredOutput","resolvePreferredOutput","warnings","Set","value","matches","filter","kind","has","direct","errorReport","serializeError","details","key","cause","CjsFormatOutputRole","DEBUG","CjsFormatReadMode","SYNC","ASYNC"],"mappings":";;AAEA,MAAMA,mBAAmB,GAAG,SAAS;AACrC,MAAMC,iBAAiB,GAAG,OAAO;AACjC,MAAMC,cAAc,GAAG,MAAM;AAC7B,MAAMC,eAAe,GAAG,OAAO;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,SAAS,CACtB;EACEC,OAAO,GAAG,EAAE;;AAEZ;AACF;AACA;AACA;AACEC,EAAAA,WAAWA,C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AGT,KAAK;AACtB,EAAA;EACA,OAAO;AACLzH,IAAAA,IAAI,EAAEF,KAAK,EAAEE,IAAI,IAAI,OAAO;AAC5BC,IAAAA,IAAI,EAAEH,KAAK,EAAEG,IAAI,IAAI,0BAA0B;IAC/CwB,OAAO,EAAE3B,KAAK,EAAE2B,OAAO,IAAIkB,MAAM,CAAC7C,KAAK,CAAC;AACxCmI,IAAAA,OAAO,EAAEA,OAAO;AAChBE,IAAAA,KAAK,EAAErI,KAAK,EAAEqI,KAAK,GACf;AACAnI,MAAAA,IAAI,EAAEF,KAAK,CAACqI,KAAK,CAACnI,IAAI,IAAI,OAAO;AACjCC,MAAAA,IAAI,EAAEH,KAAK,CAACqI,KAAK,CAAClI,IAAI,IAAI,EAAE;MAC5BwB,OAAO,EAAE3B,KAAK,CAACqI,KAAK,CAAC1G,OAAO,IAAIkB,MAAM,CAAC7C,KAAK,CAACqI,KAAK;AACpD,KAAC,GACC;GACL;AACH;MAEaC,mBAAmB,GAAGtH,MAAM,CAACwE,MAAM,CAAC;AAC/Cc,EAAAA,OAAO,EAAEnH,mBAAmB;AAC5BoJ,EAAAA,KAAK,EAAEnJ;AACT,CAAC;MAEYoJ,iBAAiB,GAAGxH,MAAM,CAACwE,MAAM,CAAC;AAC7CiD,EAAAA,IAAI,EAAEpJ,cAAc;AACpBqJ,EAAAA,KAAK,EAAEpJ;AACT,CAAC;;;;"}
@@ -123,7 +123,7 @@ class CjsFormatRoute {
123
123
  * routing policy.
124
124
  */
125
125
  class CjsFormatStore {
126
- #byExtension = new Map();
126
+ _byExtension = new Map();
127
127
 
128
128
  /**
129
129
  * Register a format, by default under every extension it declares.
@@ -180,8 +180,8 @@ class CjsFormatStore {
180
180
  // worst of both outcomes: the caller believes the format is reachable.
181
181
  throw new TypeError(`CjsFormatStore.Register cannot route ${Format.name || "a format"} ` + `under ${JSON.stringify(extension)}, which is not an extension.`);
182
182
  }
183
- const existing = this.#byExtension.get(key);
184
- if (!existing) this.#byExtension.set(key, [route]);else if (!existing.some(entry => isSameRoute(entry, route))) existing.push(route);
183
+ const existing = this._byExtension.get(key);
184
+ if (!existing) this._byExtension.set(key, [route]);else if (!existing.some(entry => isSameRoute(entry, route))) existing.push(route);
185
185
  }
186
186
  return this;
187
187
  }
@@ -209,7 +209,7 @@ class CjsFormatStore {
209
209
  * @returns {CjsFormatRoute[]} A copy; the store's own order is not exposed for mutation.
210
210
  */
211
211
  Get(extension) {
212
- return [...(this.#byExtension.get(normalizeResourceExtension(extension)) || [])];
212
+ return [...(this._byExtension.get(normalizeResourceExtension(extension)) || [])];
213
213
  }
214
214
 
215
215
  /**
@@ -219,7 +219,7 @@ class CjsFormatStore {
219
219
  * @returns {boolean}
220
220
  */
221
221
  Has(extension) {
222
- return this.#byExtension.has(normalizeResourceExtension(extension));
222
+ return this._byExtension.has(normalizeResourceExtension(extension));
223
223
  }
224
224
 
225
225
  /**
@@ -248,7 +248,7 @@ class CjsFormatStore {
248
248
  * @returns {CjsFormatRoute|null} The chosen route.
249
249
  */
250
250
  Resolve(extension, data, options = null) {
251
- let candidates = this.#byExtension.get(normalizeResourceExtension(extension)) || [];
251
+ let candidates = this._byExtension.get(normalizeResourceExtension(extension)) || [];
252
252
  const output = options?.output || null;
253
253
  if (output) {
254
254
  candidates = candidates.filter(route => route.output === output || route.output === null && routeDeclaresOutput(route, output));
@@ -265,12 +265,12 @@ class CjsFormatStore {
265
265
 
266
266
  /** Every extension the store can route, sorted. */
267
267
  Extensions() {
268
- return [...this.#byExtension.keys()].sort();
268
+ return [...this._byExtension.keys()].sort();
269
269
  }
270
270
 
271
271
  /** Forget every registration. */
272
272
  Clear() {
273
- this.#byExtension.clear();
273
+ this._byExtension.clear();
274
274
  return this;
275
275
  }
276
276
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CjsFormatStore.js","sources":["../../../../src/resource/format/CjsFormatStore.js"],"sourcesContent":["import { normalizeResourceExtension } from \"#utils/path\";\n\n/**\n * One registered route: an extension, the format that reads it, the reader to\n * call, and the output to ask for.\n *\n * The unit is deliberately not a bare format class. A format class does not\n * answer the question \"how is this file read\", because three separate things\n * can vary independently and every one of them is live in this package:\n *\n * - **Several formats under one extension.** `.static` is read by both\n * `CjsStaticFormat` and `CjsSchemaBoundFormat`, and only content tells them\n * apart.\n * - **Several readers on one format, chosen by CONTENT.** `CjsGr2Format` reads\n * `.gr2` and `.gsf` through the same `readRawInput`, because they are the\n * same Granny container — the suffix only denotes what the root object holds.\n * `read` projects geometry and `readGsf` projects a state machine, and\n * `isGsf` is what actually tells them apart. The extension is a hint, not the\n * discriminator, which is why a route may carry its own `accepts` probe.\n * - **Several outputs from one reader.** `CjsDdsFormat` declares `texture`,\n * `image`, and `rgba` capability descriptors in `outputs` off a single\n * `read`, selected by `options.emit`.\n *\n * ccpwgl mapped one extension to one constructor and stopped, which is why\n * every one of those cases has to be hardcoded at a call site there. Naming the\n * route makes them registration data instead - and the resource that reads a\n * `.gsf` no longer has to know that the method is called `readGsf`.\n */\nclass CjsFormatRoute\n{\n /**\n * Create one immutable format routing choice.\n * @param {typeof CjsFormat} Format Format facade constructor.\n * @param {object} [options] Reader, output, probe, and display-name options.\n */\n constructor(Format, options = {})\n {\n this.Format = Format;\n this.read = options.read || \"read\";\n this.output = options.output || null;\n this.accepts = options.accepts || null;\n this.name = options.name || `${Format.name || \"format\"}.${this.read}`;\n\n if (typeof Format[this.read] !== \"function\")\n {\n throw new TypeError(\n `${Format.name || \"format\"} has no reader named ${JSON.stringify(this.read)}. `\n + \"A route names the entry point to call, so a misspelling here would \"\n + \"otherwise surface as a failed load of the first matching file.\"\n );\n }\n if (this.accepts !== null\n && typeof this.accepts !== \"function\"\n && typeof Format[this.accepts] !== \"function\")\n {\n throw new TypeError(\n `${Format.name || \"format\"} has no probe named ${JSON.stringify(this.accepts)}. `\n + \"A route's probe is what separates two readers over one container, so \"\n + \"a missing one would silently route every file to the first route.\"\n );\n }\n if (this.output && typeof Format.getOutputCapability === \"function\"\n && !Format.getOutputCapability(this.output))\n {\n throw new TypeError(\n `${Format.name || \"format\"} does not declare the output `\n + `${JSON.stringify(this.output)}; it declares `\n + `${Object.keys(Format.outputs || {}).map(value => JSON.stringify(value)).join(\", \")}.`\n );\n }\n this;\n }\n\n /**\n * Whether this route recognises the data.\n *\n * The route's own probe answers when it has one, and it is the only thing\n * that can separate two readers over ONE container. `Format.is` says\n * \"yes, this is a Granny file\" for both a `.gr2` and a `.gsf`, because it is\n * — the question it answers is about the container, not about which\n * projection applies. `isGsf` is the question that matters there.\n *\n * Falling back to `Format.is` is right when the routes belong to\n * different formats, which is the `.static` case.\n *\n * A route with no probe at all answers yes: the extension already selected\n * it, and a format is entitled to reject its own file later with a better\n * message than a probe could give. A probe that throws has declined rather\n * than failed — probes read headers of files they may not own.\n */\n Accepts(data)\n {\n if (data === undefined) return true;\n const probe = typeof this.accepts === \"function\"\n ? this.accepts\n : this.accepts\n ? this.Format[this.accepts]\n : this.Format.is;\n if (typeof probe !== \"function\") return true;\n try { return isPositiveProbe(probe.call(this.Format, data)); }\n catch { return false; }\n }\n\n /**\n * Read data through this route.\n *\n * The registered output is applied as `emit` unless the caller names one,\n * which is what makes \"which representation of a DDS do we want\" a\n * registration decision rather than something every call site repeats.\n *\n * @param {*} data Source data.\n * @param {object|null} [options] Reader options; `emit` overrides the route's output.\n * @returns {*} Whatever the reader returns.\n */\n Read(data, options = null)\n {\n const values = { ...(options || {}) };\n if (this.output && values.emit === undefined) values.emit = this.output;\n return this.Format[this.read](data, values);\n }\n}\n\n/**\n * The link between a resource and the formats that can populate it.\n *\n * WHY THIS EXISTS RATHER THAN A RESOURCE IMPORTING ITS FORMATS. ccpwgl's\n * `Tw2TextureRes` imports its five texture formats directly, and that is a\n * reasonable shape for a bundled application. It is the wrong shape for a\n * library: every format here is an explicitly tree-shakeable subpath, so a\n * consumer that pulls in one texture resource must not thereby drag in DDS,\n * PNG, JPEG, TGA, GIF and WebP. A resource that imports its formats destroys\n * that, quietly and permanently.\n *\n * So nobody imports anybody. The composing application registers the routes it\n * actually wants, and both the manager and a resource loading itself ask the\n * store. That is also what makes \"which formats exist\" a property of the\n * composed application rather than a list baked into the loader.\n *\n * WHAT THE STORE DOES NOT OWN: which resource class a file becomes. That is\n * `CjsResMan.RegisterExtension`'s Handler, and duplicating it here would make\n * two registries disagree about one question. The store answers how bytes are\n * read; the manager answers what they become.\n *\n * ORDER IS THE CALLER'S. Registration order is retained per extension, because\n * where several routes answer for one suffix the caller's ordering is the\n * routing policy.\n */\nexport class CjsFormatStore\n{\n #byExtension = new Map();\n\n /**\n * Register a format, by default under every extension it declares.\n *\n * `Format.extensions` is a CONVENIENCE, not the routing authority. It exists\n * so a composition root can register a pile of formats without restating\n * what each one reads, and that is the whole of its job. The caller may name\n * extensions instead, and then the declaration is not consulted at all — a\n * format reading a suffix its author never anticipated is a deployment's\n * business, not the format's.\n *\n * That is also the only way to reach `webgl`, `webgpu` and `dxbc` through a\n * store. They declare nothing because their inputs are logical names rather\n * than file suffixes, which is a statement about what they read, not a bar on\n * an application routing a suffix to one of them.\n *\n * The second argument may be the extensions alone, or a route:\n *\n * ```js\n * store.Register(CjsPngFormat); // as declared\n * store.Register(CjsGr2Format, { extensions: \".gsf\", read: \"readGsf\" });\n * store.Register(CjsDdsFormat, { extensions: \".dds\", output: \"texture\" });\n * ```\n *\n * Registering the same route twice under one extension is a no-op, so a\n * composition root may register defensively. Two routes over the same format\n * that differ in reader or output are NOT duplicates — that is the whole\n * point of naming them.\n *\n * @param {Function} Format Format class.\n * @param {string|string[]|object|null} [options] Extensions, or a route descriptor.\n * @returns {CjsFormatStore} This store.\n */\n Register(Format, options = null)\n {\n if (typeof Format !== \"function\")\n {\n throw new TypeError(\"CjsFormatStore.Register requires a format class.\");\n }\n\n const settings = options === null || options === undefined\n ? {}\n : (typeof options === \"string\" || Array.isArray(options))\n ? { extensions: options }\n : options;\n\n const supplied = settings.extensions === undefined || settings.extensions === null\n ? null\n : Array.isArray(settings.extensions) ? settings.extensions : [ settings.extensions ];\n const declared = supplied || Format.extensions;\n if (!Array.isArray(declared) || declared.length === 0)\n {\n const name = Format.name || \"format\";\n const error = new Error(\n `${name} declares no extensions and none were supplied, so there is `\n + \"nothing to route it under. Pass the extensions this application \"\n + \"wants it to read: Register(Format, \\\".ext\\\"). Formats whose inputs \"\n + \"are logical names rather than file suffixes - webgl, webgpu, dxbc - \"\n + \"declare none, and are usually used directly instead.\"\n );\n error.code = \"CJS_FORMAT_STORE_NO_EXTENSIONS\";\n throw error;\n }\n\n const route = new CjsFormatRoute(Format, settings);\n for (const extension of declared)\n {\n const key = normalizeResourceExtension(extension);\n if (!key)\n {\n // An empty key would register silently and route nothing, which is the\n // worst of both outcomes: the caller believes the format is reachable.\n throw new TypeError(\n `CjsFormatStore.Register cannot route ${Format.name || \"a format\"} `\n + `under ${JSON.stringify(extension)}, which is not an extension.`\n );\n }\n const existing = this.#byExtension.get(key);\n if (!existing) this.#byExtension.set(key, [ route ]);\n else if (!existing.some(entry => isSameRoute(entry, route))) existing.push(route);\n }\n return this;\n }\n\n /**\n * Register several formats in caller order.\n *\n * An entry is either a format class, which registers under what it declares,\n * or a `[Format, extensionsOrRoute]` pair.\n *\n * @param {Iterable<Function|[Function, string|string[]|object]>} formats\n * @returns {CjsFormatStore} This store.\n */\n RegisterAll(formats)\n {\n for (const entry of formats || [])\n {\n if (Array.isArray(entry)) this.Register(entry[0], entry[1]);\n else this.Register(entry);\n }\n return this;\n }\n\n /**\n * Every route registered for an extension, in registration order.\n *\n * @param {string} extension\n * @returns {CjsFormatRoute[]} A copy; the store's own order is not exposed for mutation.\n */\n Get(extension)\n {\n return [ ...(this.#byExtension.get(normalizeResourceExtension(extension)) || []) ];\n }\n\n /**\n * Whether anything is registered for an extension.\n *\n * @param {string} extension\n * @returns {boolean}\n */\n Has(extension)\n {\n return this.#byExtension.has(normalizeResourceExtension(extension));\n }\n\n /**\n * The route that should read this data.\n *\n * Three filters apply in order, and each exists because something in this\n * package needs it:\n *\n * 1. **Extension** narrows to the routes registered for the suffix.\n * 2. **Output**, when the caller wants a particular representation, narrows\n * further and pins that output onto an otherwise unpinned route. A caller\n * asking for `texture` must not be handed the route registered to decode\n * the same file to `rgba`; resource requirements select classes instead.\n * 3. **Content** separates what remains, because with several candidates left\n * nothing else can. With exactly one the data is not consulted at all: the\n * extension already decided, and the format is entitled to reject its own\n * file with a better message than a probe could produce.\n *\n * Returns `null` rather than guessing when nothing matches, so the caller\n * reports what it could not read instead of handing bytes to a reader that\n * never claimed them.\n *\n * @param {string} extension\n * @param {*} [data] Data to probe when more than one route remains.\n * @param {object|null} [options] May carry `output` to select a representation.\n * @returns {CjsFormatRoute|null} The chosen route.\n */\n Resolve(extension, data, options = null)\n {\n let candidates = this.#byExtension.get(normalizeResourceExtension(extension)) || [];\n\n const output = options?.output || null;\n if (output)\n {\n candidates = candidates.filter(route => route.output === output\n || (route.output === null && routeDeclaresOutput(route, output)));\n // A requested output nothing was registered for is a miss, not a reason\n // to fall back to a route that produces something else entirely.\n if (candidates.length === 0) return null;\n candidates = candidates.map(route => pinRouteOutput(route, output));\n }\n\n if (candidates.length === 0) return null;\n if (candidates.length === 1) return candidates[0];\n if (data === undefined) return candidates[0];\n\n return candidates.find(route => route.Accepts(data)) || null;\n }\n\n /** Every extension the store can route, sorted. */\n Extensions()\n {\n return [ ...this.#byExtension.keys() ].sort();\n }\n\n /** Forget every registration. */\n Clear()\n {\n this.#byExtension.clear();\n return this;\n }\n}\n\n/**\n * Whether two routes are the same registration.\n *\n * Same format but a different reader or output is a DIFFERENT route, which is\n * how one format serves `.gr2` and `.gsf`, or serves `.dds` as both a\n * compressed texture and decoded RGBA.\n */\nfunction isSameRoute(left, right)\n{\n return left.Format === right.Format\n && left.read === right.read\n && left.output === right.output\n && left.accepts === right.accepts;\n}\n\n/**\n * Accept only the canonical boolean routing verdict.\n *\n * Requiring literal true prevents a stale report object from becoming an\n * accidental match merely because objects are truthy.\n *\n * @param {*} report A routing verdict.\n * @returns {boolean}\n */\nfunction isPositiveProbe(report)\n{\n return report === true;\n}\n\n/** Whether an unpinned route's format can produce the requested output. */\nfunction routeDeclaresOutput(route, output)\n{\n return typeof route.Format.getOutputCapability === \"function\"\n ? route.Format.getOutputCapability(output) !== null\n : Object.hasOwn(route.Format.outputs || {}, output);\n}\n\n/** Return a route that applies the output which selected an unpinned route. */\nfunction pinRouteOutput(route, output)\n{\n if (route.output === output) return route;\n return new CjsFormatRoute(route.Format, {\n read: route.read,\n output,\n accepts: route.accepts,\n name: route.name\n });\n}\n\nexport { CjsFormatRoute };\nexport default CjsFormatStore;\n"],"names":["CjsFormatRoute","constructor","Format","options","read","output","accepts","name","TypeError","JSON","stringify","getOutputCapability","Object","keys","outputs","map","value","join","Accepts","data","undefined","probe","is","isPositiveProbe","call","Read","values","emit","CjsFormatStore","Map","Register","settings","Array","isArray","extensions","supplied","declared","length","error","Error","code","route","extension","key","normalizeResourceExtension","existing","get","set","some","entry","isSameRoute","push","RegisterAll","formats","Get","Has","has","Resolve","candidates","filter","routeDeclaresOutput","pinRouteOutput","find","Extensions","sort","Clear","clear","left","right","report","hasOwn"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,cAAc,CACpB;AACE;AACF;AACA;AACA;AACA;AACEC,EAAAA,WAAWA,CAACC,MAAM,EAAEC,OAAO,GAAG,EAAE,EAChC;IACE,IAAI,CAACD,MAAM,GAAGA,MAAM;AACpB,IAAA,IAAI,CAACE,IAAI,GAAGD,OAAO,CAACC,IAAI,IAAI,MAAM;AAClC,IAAA,IAAI,CAACC,MAAM,GAAGF,OAAO,CAACE,MAAM,IAAI,IAAI;AACpC,IAAA,IAAI,CAACC,OAAO,GAAGH,OAAO,CAACG,OAAO,IAAI,IAAI;AACtC,IAAA,IAAI,CAACC,IAAI,GAAGJ,OAAO,CAACI,IAAI,IAAI,CA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CAAC7B,KAAK,CAACvC,MAAM,CAACY,OAAO,IAAI,EAAE,EAAET,MAAM,CAAC;AACvD;;AAEA;AACA,SAASwD,cAAcA,CAACpB,KAAK,EAAEpC,MAAM,EACrC;AACE,EAAA,IAAIoC,KAAK,CAACpC,MAAM,KAAKA,MAAM,EAAE,OAAOoC,KAAK;AACzC,EAAA,OAAO,IAAIzC,cAAc,CAACyC,KAAK,CAACvC,MAAM,EAAE;IACtCE,IAAI,EAAEqC,KAAK,CAACrC,IAAI;IAChBC,MAAM;IACNC,OAAO,EAAEmC,KAAK,CAACnC,OAAO;IACtBC,IAAI,EAAEkC,KAAK,CAAClC;AACd,GAAC,CAAC;AACJ;;;;"}
1
+ {"version":3,"file":"CjsFormatStore.js","sources":["../../../../src/resource/format/CjsFormatStore.js"],"sourcesContent":["import { normalizeResourceExtension } from \"#utils/path\";\n\n/**\n * One registered route: an extension, the format that reads it, the reader to\n * call, and the output to ask for.\n *\n * The unit is deliberately not a bare format class. A format class does not\n * answer the question \"how is this file read\", because three separate things\n * can vary independently and every one of them is live in this package:\n *\n * - **Several formats under one extension.** `.static` is read by both\n * `CjsStaticFormat` and `CjsSchemaBoundFormat`, and only content tells them\n * apart.\n * - **Several readers on one format, chosen by CONTENT.** `CjsGr2Format` reads\n * `.gr2` and `.gsf` through the same `readRawInput`, because they are the\n * same Granny container — the suffix only denotes what the root object holds.\n * `read` projects geometry and `readGsf` projects a state machine, and\n * `isGsf` is what actually tells them apart. The extension is a hint, not the\n * discriminator, which is why a route may carry its own `accepts` probe.\n * - **Several outputs from one reader.** `CjsDdsFormat` declares `texture`,\n * `image`, and `rgba` capability descriptors in `outputs` off a single\n * `read`, selected by `options.emit`.\n *\n * ccpwgl mapped one extension to one constructor and stopped, which is why\n * every one of those cases has to be hardcoded at a call site there. Naming the\n * route makes them registration data instead - and the resource that reads a\n * `.gsf` no longer has to know that the method is called `readGsf`.\n */\nclass CjsFormatRoute\n{\n /**\n * Create one immutable format routing choice.\n * @param {typeof CjsFormat} Format Format facade constructor.\n * @param {object} [options] Reader, output, probe, and display-name options.\n */\n constructor(Format, options = {})\n {\n this.Format = Format;\n this.read = options.read || \"read\";\n this.output = options.output || null;\n this.accepts = options.accepts || null;\n this.name = options.name || `${Format.name || \"format\"}.${this.read}`;\n\n if (typeof Format[this.read] !== \"function\")\n {\n throw new TypeError(\n `${Format.name || \"format\"} has no reader named ${JSON.stringify(this.read)}. `\n + \"A route names the entry point to call, so a misspelling here would \"\n + \"otherwise surface as a failed load of the first matching file.\"\n );\n }\n if (this.accepts !== null\n && typeof this.accepts !== \"function\"\n && typeof Format[this.accepts] !== \"function\")\n {\n throw new TypeError(\n `${Format.name || \"format\"} has no probe named ${JSON.stringify(this.accepts)}. `\n + \"A route's probe is what separates two readers over one container, so \"\n + \"a missing one would silently route every file to the first route.\"\n );\n }\n if (this.output && typeof Format.getOutputCapability === \"function\"\n && !Format.getOutputCapability(this.output))\n {\n throw new TypeError(\n `${Format.name || \"format\"} does not declare the output `\n + `${JSON.stringify(this.output)}; it declares `\n + `${Object.keys(Format.outputs || {}).map(value => JSON.stringify(value)).join(\", \")}.`\n );\n }\n this;\n }\n\n /**\n * Whether this route recognises the data.\n *\n * The route's own probe answers when it has one, and it is the only thing\n * that can separate two readers over ONE container. `Format.is` says\n * \"yes, this is a Granny file\" for both a `.gr2` and a `.gsf`, because it is\n * — the question it answers is about the container, not about which\n * projection applies. `isGsf` is the question that matters there.\n *\n * Falling back to `Format.is` is right when the routes belong to\n * different formats, which is the `.static` case.\n *\n * A route with no probe at all answers yes: the extension already selected\n * it, and a format is entitled to reject its own file later with a better\n * message than a probe could give. A probe that throws has declined rather\n * than failed — probes read headers of files they may not own.\n */\n Accepts(data)\n {\n if (data === undefined) return true;\n const probe = typeof this.accepts === \"function\"\n ? this.accepts\n : this.accepts\n ? this.Format[this.accepts]\n : this.Format.is;\n if (typeof probe !== \"function\") return true;\n try { return isPositiveProbe(probe.call(this.Format, data)); }\n catch { return false; }\n }\n\n /**\n * Read data through this route.\n *\n * The registered output is applied as `emit` unless the caller names one,\n * which is what makes \"which representation of a DDS do we want\" a\n * registration decision rather than something every call site repeats.\n *\n * @param {*} data Source data.\n * @param {object|null} [options] Reader options; `emit` overrides the route's output.\n * @returns {*} Whatever the reader returns.\n */\n Read(data, options = null)\n {\n const values = { ...(options || {}) };\n if (this.output && values.emit === undefined) values.emit = this.output;\n return this.Format[this.read](data, values);\n }\n}\n\n/**\n * The link between a resource and the formats that can populate it.\n *\n * WHY THIS EXISTS RATHER THAN A RESOURCE IMPORTING ITS FORMATS. ccpwgl's\n * `Tw2TextureRes` imports its five texture formats directly, and that is a\n * reasonable shape for a bundled application. It is the wrong shape for a\n * library: every format here is an explicitly tree-shakeable subpath, so a\n * consumer that pulls in one texture resource must not thereby drag in DDS,\n * PNG, JPEG, TGA, GIF and WebP. A resource that imports its formats destroys\n * that, quietly and permanently.\n *\n * So nobody imports anybody. The composing application registers the routes it\n * actually wants, and both the manager and a resource loading itself ask the\n * store. That is also what makes \"which formats exist\" a property of the\n * composed application rather than a list baked into the loader.\n *\n * WHAT THE STORE DOES NOT OWN: which resource class a file becomes. That is\n * `CjsResMan.RegisterExtension`'s Handler, and duplicating it here would make\n * two registries disagree about one question. The store answers how bytes are\n * read; the manager answers what they become.\n *\n * ORDER IS THE CALLER'S. Registration order is retained per extension, because\n * where several routes answer for one suffix the caller's ordering is the\n * routing policy.\n */\nexport class CjsFormatStore\n{\n _byExtension = new Map();\n\n /**\n * Register a format, by default under every extension it declares.\n *\n * `Format.extensions` is a CONVENIENCE, not the routing authority. It exists\n * so a composition root can register a pile of formats without restating\n * what each one reads, and that is the whole of its job. The caller may name\n * extensions instead, and then the declaration is not consulted at all — a\n * format reading a suffix its author never anticipated is a deployment's\n * business, not the format's.\n *\n * That is also the only way to reach `webgl`, `webgpu` and `dxbc` through a\n * store. They declare nothing because their inputs are logical names rather\n * than file suffixes, which is a statement about what they read, not a bar on\n * an application routing a suffix to one of them.\n *\n * The second argument may be the extensions alone, or a route:\n *\n * ```js\n * store.Register(CjsPngFormat); // as declared\n * store.Register(CjsGr2Format, { extensions: \".gsf\", read: \"readGsf\" });\n * store.Register(CjsDdsFormat, { extensions: \".dds\", output: \"texture\" });\n * ```\n *\n * Registering the same route twice under one extension is a no-op, so a\n * composition root may register defensively. Two routes over the same format\n * that differ in reader or output are NOT duplicates — that is the whole\n * point of naming them.\n *\n * @param {Function} Format Format class.\n * @param {string|string[]|object|null} [options] Extensions, or a route descriptor.\n * @returns {CjsFormatStore} This store.\n */\n Register(Format, options = null)\n {\n if (typeof Format !== \"function\")\n {\n throw new TypeError(\"CjsFormatStore.Register requires a format class.\");\n }\n\n const settings = options === null || options === undefined\n ? {}\n : (typeof options === \"string\" || Array.isArray(options))\n ? { extensions: options }\n : options;\n\n const supplied = settings.extensions === undefined || settings.extensions === null\n ? null\n : Array.isArray(settings.extensions) ? settings.extensions : [ settings.extensions ];\n const declared = supplied || Format.extensions;\n if (!Array.isArray(declared) || declared.length === 0)\n {\n const name = Format.name || \"format\";\n const error = new Error(\n `${name} declares no extensions and none were supplied, so there is `\n + \"nothing to route it under. Pass the extensions this application \"\n + \"wants it to read: Register(Format, \\\".ext\\\"). Formats whose inputs \"\n + \"are logical names rather than file suffixes - webgl, webgpu, dxbc - \"\n + \"declare none, and are usually used directly instead.\"\n );\n error.code = \"CJS_FORMAT_STORE_NO_EXTENSIONS\";\n throw error;\n }\n\n const route = new CjsFormatRoute(Format, settings);\n for (const extension of declared)\n {\n const key = normalizeResourceExtension(extension);\n if (!key)\n {\n // An empty key would register silently and route nothing, which is the\n // worst of both outcomes: the caller believes the format is reachable.\n throw new TypeError(\n `CjsFormatStore.Register cannot route ${Format.name || \"a format\"} `\n + `under ${JSON.stringify(extension)}, which is not an extension.`\n );\n }\n const existing = this._byExtension.get(key);\n if (!existing) this._byExtension.set(key, [ route ]);\n else if (!existing.some(entry => isSameRoute(entry, route))) existing.push(route);\n }\n return this;\n }\n\n /**\n * Register several formats in caller order.\n *\n * An entry is either a format class, which registers under what it declares,\n * or a `[Format, extensionsOrRoute]` pair.\n *\n * @param {Iterable<Function|[Function, string|string[]|object]>} formats\n * @returns {CjsFormatStore} This store.\n */\n RegisterAll(formats)\n {\n for (const entry of formats || [])\n {\n if (Array.isArray(entry)) this.Register(entry[0], entry[1]);\n else this.Register(entry);\n }\n return this;\n }\n\n /**\n * Every route registered for an extension, in registration order.\n *\n * @param {string} extension\n * @returns {CjsFormatRoute[]} A copy; the store's own order is not exposed for mutation.\n */\n Get(extension)\n {\n return [ ...(this._byExtension.get(normalizeResourceExtension(extension)) || []) ];\n }\n\n /**\n * Whether anything is registered for an extension.\n *\n * @param {string} extension\n * @returns {boolean}\n */\n Has(extension)\n {\n return this._byExtension.has(normalizeResourceExtension(extension));\n }\n\n /**\n * The route that should read this data.\n *\n * Three filters apply in order, and each exists because something in this\n * package needs it:\n *\n * 1. **Extension** narrows to the routes registered for the suffix.\n * 2. **Output**, when the caller wants a particular representation, narrows\n * further and pins that output onto an otherwise unpinned route. A caller\n * asking for `texture` must not be handed the route registered to decode\n * the same file to `rgba`; resource requirements select classes instead.\n * 3. **Content** separates what remains, because with several candidates left\n * nothing else can. With exactly one the data is not consulted at all: the\n * extension already decided, and the format is entitled to reject its own\n * file with a better message than a probe could produce.\n *\n * Returns `null` rather than guessing when nothing matches, so the caller\n * reports what it could not read instead of handing bytes to a reader that\n * never claimed them.\n *\n * @param {string} extension\n * @param {*} [data] Data to probe when more than one route remains.\n * @param {object|null} [options] May carry `output` to select a representation.\n * @returns {CjsFormatRoute|null} The chosen route.\n */\n Resolve(extension, data, options = null)\n {\n let candidates = this._byExtension.get(normalizeResourceExtension(extension)) || [];\n\n const output = options?.output || null;\n if (output)\n {\n candidates = candidates.filter(route => route.output === output\n || (route.output === null && routeDeclaresOutput(route, output)));\n // A requested output nothing was registered for is a miss, not a reason\n // to fall back to a route that produces something else entirely.\n if (candidates.length === 0) return null;\n candidates = candidates.map(route => pinRouteOutput(route, output));\n }\n\n if (candidates.length === 0) return null;\n if (candidates.length === 1) return candidates[0];\n if (data === undefined) return candidates[0];\n\n return candidates.find(route => route.Accepts(data)) || null;\n }\n\n /** Every extension the store can route, sorted. */\n Extensions()\n {\n return [ ...this._byExtension.keys() ].sort();\n }\n\n /** Forget every registration. */\n Clear()\n {\n this._byExtension.clear();\n return this;\n }\n}\n\n/**\n * Whether two routes are the same registration.\n *\n * Same format but a different reader or output is a DIFFERENT route, which is\n * how one format serves `.gr2` and `.gsf`, or serves `.dds` as both a\n * compressed texture and decoded RGBA.\n */\nfunction isSameRoute(left, right)\n{\n return left.Format === right.Format\n && left.read === right.read\n && left.output === right.output\n && left.accepts === right.accepts;\n}\n\n/**\n * Accept only the canonical boolean routing verdict.\n *\n * Requiring literal true prevents a stale report object from becoming an\n * accidental match merely because objects are truthy.\n *\n * @param {*} report A routing verdict.\n * @returns {boolean}\n */\nfunction isPositiveProbe(report)\n{\n return report === true;\n}\n\n/** Whether an unpinned route's format can produce the requested output. */\nfunction routeDeclaresOutput(route, output)\n{\n return typeof route.Format.getOutputCapability === \"function\"\n ? route.Format.getOutputCapability(output) !== null\n : Object.hasOwn(route.Format.outputs || {}, output);\n}\n\n/** Return a route that applies the output which selected an unpinned route. */\nfunction pinRouteOutput(route, output)\n{\n if (route.output === output) return route;\n return new CjsFormatRoute(route.Format, {\n read: route.read,\n output,\n accepts: route.accepts,\n name: route.name\n });\n}\n\nexport { CjsFormatRoute };\nexport default CjsFormatStore;\n"],"names":["CjsFormatRoute","constructor","Format","options","read","output","accepts","name","TypeError","JSON","stringify","getOutputCapability","Object","keys","outputs","map","value","join","Accepts","data","undefined","probe","is","isPositiveProbe","call","Read","values","emit","CjsFormatStore","_byExtension","Map","Register","settings","Array","isArray","extensions","supplied","declared","length","error","Error","code","route","extension","key","normalizeResourceExtension","existing","get","set","some","entry","isSameRoute","push","RegisterAll","formats","Get","Has","has","Resolve","candidates","filter","routeDeclaresOutput","pinRouteOutput","find","Extensions","sort","Clear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,IAAI,CAAClE,MAAM,KAAKmE,KAAK,CAACnE,MAAM,IAC9BkE,IAAI,CAAChE,IAAI,KAAKiE,KAAK,CAACjE,IAAI,IACxBgE,IAAI,CAAC/D,MAAM,KAAKgE,KAAK,CAAChE,MAAM,IAC5B+D,IAAI,CAAC9D,OAAO,KAAK+D,KAAK,CAAC/D,OAAO;AACrC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASiB,eAAeA,CAAC+C,MAAM,EAC/B;EACE,OAAOA,MAAM,KAAK,IAAI;AACxB;;AAEA;AACA,SAAST,mBAAmBA,CAACnB,KAAK,EAAErC,MAAM,EAC1C;AACE,EAAA,OAAO,OAAOqC,KAAK,CAACxC,MAAM,CAACS,mBAAmB,KAAK,UAAU,GACzD+B,KAAK,CAACxC,MAAM,CAACS,mBAAmB,CAACN,MAAM,CAAC,KAAK,IAAI,GACjDO,MAAM,CAAC2D,MAAM,CAAC7B,KAAK,CAACxC,MAAM,CAACY,OAAO,IAAI,EAAE,EAAET,MAAM,CAAC;AACvD;;AAEA;AACA,SAASyD,cAAcA,CAACpB,KAAK,EAAErC,MAAM,EACrC;AACE,EAAA,IAAIqC,KAAK,CAACrC,MAAM,KAAKA,MAAM,EAAE,OAAOqC,KAAK;AACzC,EAAA,OAAO,IAAI1C,cAAc,CAAC0C,KAAK,CAACxC,MAAM,EAAE;IACtCE,IAAI,EAAEsC,KAAK,CAACtC,IAAI;IAChBC,MAAM;IACNC,OAAO,EAAEoC,KAAK,CAACpC,OAAO;IACtBC,IAAI,EAAEmC,KAAK,CAACnC;AACd,GAAC,CAAC;AACJ;;;;"}
@@ -0,0 +1,114 @@
1
+ import { CjsFormat } from './CjsFormat.js';
2
+
3
+ /**
4
+ * The base of every geometry format (gr2, cmf, fbx, obj, stl, gltf): the
5
+ * geometry media type and the node-class registry that lets a caller hydrate a
6
+ * read into its own constructors instead of plain JSON.
7
+ *
8
+ * Not Carbon: Carbon reads geometry straight into Tr2GeometryRes and has no
9
+ * per-format class registry. The registry was copied into each format before
10
+ * this base existed (/docs/projects/geometry-format-overlap.md).
11
+ *
12
+ * A subclass supplies:
13
+ * - `static id` and `static classKeys`, the node keys `classes` may name;
14
+ * - `_classes`, the current map, which its `SetValues` merges `classes` into.
15
+ */
16
+ class CjsGeometryFormat extends CjsFormat {
17
+ static mediaTypes = ["geometry"];
18
+
19
+ /** Node key -> constructor; replaced, never mutated, so a copy handed out stays stable. */
20
+ _classes = {};
21
+
22
+ /**
23
+ * Throw unless `key` is one of `classKeys`.
24
+ *
25
+ * @param {string} key Node class key.
26
+ * @param {readonly string[]} classKeys The keys a format accepts.
27
+ * @param {string} readerName Format name used in thrown errors.
28
+ */
29
+ static validateClassKey(key, classKeys, readerName) {
30
+ if (!classKeys.includes(key)) {
31
+ throw new Error(`${readerName}: unknown class key ${JSON.stringify(key)}; expected one of ${classKeys.join(", ")}`);
32
+ }
33
+ }
34
+
35
+ /**
36
+ * Throw unless `key` is valid and `Class` is a constructor.
37
+ *
38
+ * @param {string} key Node class key.
39
+ * @param {Function} Class Candidate constructor.
40
+ * @param {readonly string[]} classKeys The keys a format accepts.
41
+ * @param {string} readerName Format name used in thrown errors.
42
+ */
43
+ static validateClass(key, Class, classKeys, readerName) {
44
+ CjsGeometryFormat.validateClassKey(key, classKeys, readerName);
45
+ if (typeof Class !== "function") {
46
+ throw new TypeError(`${readerName}: class ${JSON.stringify(key)} must be a constructor`);
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Set several node-class constructors.
52
+ *
53
+ * @param {object} [classes] Node class key -> constructor.
54
+ * @returns {this} This format profile.
55
+ */
56
+ SetClasses(classes = {}) {
57
+ return this.SetValues({
58
+ classes
59
+ });
60
+ }
61
+
62
+ /**
63
+ * Set one node-class constructor, or delete it with a nullish Class.
64
+ *
65
+ * @param {string} type Node class key.
66
+ * @param {Function|null|undefined} Class Constructor, or nullish to delete.
67
+ * @returns {this} This format profile.
68
+ */
69
+ SetClass(type, Class) {
70
+ const {
71
+ classKeys,
72
+ id
73
+ } = this.constructor;
74
+ if (Class === null || Class === undefined) {
75
+ CjsGeometryFormat.validateClassKey(type, classKeys, id);
76
+ const classes = {
77
+ ...this._classes
78
+ };
79
+ delete classes[type];
80
+ this._classes = classes;
81
+ return this;
82
+ }
83
+ CjsGeometryFormat.validateClass(type, Class, classKeys, id);
84
+ return this.SetValues({
85
+ classes: {
86
+ [type]: Class
87
+ }
88
+ });
89
+ }
90
+
91
+ /**
92
+ * The constructor registered for a node class key, if any.
93
+ *
94
+ * @param {string} type Node class key.
95
+ * @returns {Function|undefined} The constructor.
96
+ */
97
+ GetClass(type) {
98
+ CjsGeometryFormat.validateClassKey(type, this.constructor.classKeys, this.constructor.id);
99
+ return this._classes[type];
100
+ }
101
+
102
+ /**
103
+ * Whether a constructor is registered for a node class key.
104
+ *
105
+ * @param {string} type Node class key.
106
+ * @returns {boolean} True when one is.
107
+ */
108
+ HasClass(type) {
109
+ return !!this.GetClass(type);
110
+ }
111
+ }
112
+
113
+ export { CjsGeometryFormat };
114
+ //# sourceMappingURL=CjsGeometryFormat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CjsGeometryFormat.js","sources":["../../../../src/resource/format/CjsGeometryFormat.js"],"sourcesContent":["import { CjsFormat } from \"./CjsFormat.js\";\n\n/**\n * The base of every geometry format (gr2, cmf, fbx, obj, stl, gltf): the\n * geometry media type and the node-class registry that lets a caller hydrate a\n * read into its own constructors instead of plain JSON.\n *\n * Not Carbon: Carbon reads geometry straight into Tr2GeometryRes and has no\n * per-format class registry. The registry was copied into each format before\n * this base existed (/docs/projects/geometry-format-overlap.md).\n *\n * A subclass supplies:\n * - `static id` and `static classKeys`, the node keys `classes` may name;\n * - `_classes`, the current map, which its `SetValues` merges `classes` into.\n */\nexport class CjsGeometryFormat extends CjsFormat\n{\n\n static mediaTypes = [ \"geometry\" ];\n\n /** Node key -> constructor; replaced, never mutated, so a copy handed out stays stable. */\n _classes = {};\n\n /**\n * Throw unless `key` is one of `classKeys`.\n *\n * @param {string} key Node class key.\n * @param {readonly string[]} classKeys The keys a format accepts.\n * @param {string} readerName Format name used in thrown errors.\n */\n static validateClassKey(key, classKeys, readerName)\n {\n if (!classKeys.includes(key))\n {\n throw new Error(`${readerName}: unknown class key ${JSON.stringify(key)}; expected one of ${classKeys.join(\", \")}`);\n }\n }\n\n /**\n * Throw unless `key` is valid and `Class` is a constructor.\n *\n * @param {string} key Node class key.\n * @param {Function} Class Candidate constructor.\n * @param {readonly string[]} classKeys The keys a format accepts.\n * @param {string} readerName Format name used in thrown errors.\n */\n static validateClass(key, Class, classKeys, readerName)\n {\n CjsGeometryFormat.validateClassKey(key, classKeys, readerName);\n if (typeof Class !== \"function\")\n {\n throw new TypeError(`${readerName}: class ${JSON.stringify(key)} must be a constructor`);\n }\n }\n\n /**\n * Set several node-class constructors.\n *\n * @param {object} [classes] Node class key -> constructor.\n * @returns {this} This format profile.\n */\n SetClasses(classes = {})\n {\n return this.SetValues({ classes });\n }\n\n /**\n * Set one node-class constructor, or delete it with a nullish Class.\n *\n * @param {string} type Node class key.\n * @param {Function|null|undefined} Class Constructor, or nullish to delete.\n * @returns {this} This format profile.\n */\n SetClass(type, Class)\n {\n const { classKeys, id } = this.constructor;\n if (Class === null || Class === undefined)\n {\n CjsGeometryFormat.validateClassKey(type, classKeys, id);\n const classes = { ...this._classes };\n delete classes[type];\n this._classes = classes;\n return this;\n }\n\n CjsGeometryFormat.validateClass(type, Class, classKeys, id);\n return this.SetValues({ classes: { [type]: Class } });\n }\n\n /**\n * The constructor registered for a node class key, if any.\n *\n * @param {string} type Node class key.\n * @returns {Function|undefined} The constructor.\n */\n GetClass(type)\n {\n CjsGeometryFormat.validateClassKey(type, this.constructor.classKeys, this.constructor.id);\n return this._classes[type];\n }\n\n /**\n * Whether a constructor is registered for a node class key.\n *\n * @param {string} type Node class key.\n * @returns {boolean} True when one is.\n */\n HasClass(type)\n {\n return !!this.GetClass(type);\n }\n\n}\n"],"names":["CjsGeometryFormat","CjsFormat","mediaTypes","_classes","validateClassKey","key","classKeys","readerName","includes","Error","JSON","stringify","join","validateClass","Class","TypeError","SetClasses","classes","SetValues","SetClass","type","id","constructor","undefined","GetClass","HasClass"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,iBAAiB,SAASC,SAAS,CAChD;AAEE,EAAA,OAAOC,UAAU,GAAG,CAAE,UAAU,CAAE;;AAElC;EACAC,QAAQ,GAAG,EAAE;;AAEb;AACF;AACA;AACA;AACA;AACA;AACA;AACE,EAAA,OAAOC,gBAAgBA,CAACC,GAAG,EAAEC,SAAS,EAAEC,UAAU,EAClD;AACE,IAAA,IAAI,CAACD,SAAS,CAACE,QAAQ,CAACH,GAAG,CAAC,EAC5B;MACE,MAAM,IAAII,KAAK,CAAC,CAAA,EAAGF,UAAU,CAAA,oBAAA,EAAuBG,IAAI,CAACC,SAAS,CAACN,GAAG,CAAC,CAAA,kBAAA,EAAqBC,SAAS,CAACM,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AACrH,IAAA;AACF,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAOC,aAAaA,CAACR,GAAG,EAAES,KAAK,EAAER,SAAS,EAAEC,UAAU,EACtD;IACEP,iBAAiB,CAACI,gBAAgB,CAACC,GAAG,EAAEC,SAAS,EAAEC,UAAU,CAAC;AAC9D,IAAA,IAAI,OAAOO,KAAK,KAAK,UAAU,EAC/B;AACE,MAAA,MAAM,IAAIC,SAAS,CAAC,CAAA,EAAGR,UAAU,CAAA,QAAA,EAAWG,IAAI,CAACC,SAAS,CAACN,GAAG,CAAC,wBAAwB,CAAC;AAC1F,IAAA;AACF,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACEW,EAAAA,UAAUA,CAACC,OAAO,GAAG,EAAE,EACvB;IACE,OAAO,IAAI,CAACC,SAAS,CAAC;AAAED,MAAAA;AAAQ,KAA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