@carbonenginejs/runtime-resource 0.20.0 → 0.22.0

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 (306) hide show
  1. package/NOTICE +6 -0
  2. package/dist/CjsResMan.js +1374 -1318
  3. package/dist/CjsResMan.js.map +1 -1
  4. package/dist/format/CjsFormat.js +393 -164
  5. package/dist/format/CjsFormat.js.map +1 -1
  6. package/dist/format/CjsFormatStore.js +315 -0
  7. package/dist/format/CjsFormatStore.js.map +1 -0
  8. package/dist/format/CjsResourceProbe.js +66 -234
  9. package/dist/format/CjsResourceProbe.js.map +1 -1
  10. package/dist/format/payloadContract.js +47 -6
  11. package/dist/format/payloadContract.js.map +1 -1
  12. package/dist/formats/black/CjsBlackFormat.js +23 -6
  13. package/dist/formats/black/CjsBlackFormat.js.map +1 -1
  14. package/dist/formats/bnk/CjsBnkFormat.js +122 -120
  15. package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
  16. package/dist/formats/bnk/core/helpers.js +5 -15
  17. package/dist/formats/bnk/core/helpers.js.map +1 -1
  18. package/dist/formats/cmf/CjsCmfFormat.js +31 -14
  19. package/dist/formats/cmf/CjsCmfFormat.js.map +1 -1
  20. package/dist/formats/dds/CjsDdsFormat.js +29 -19
  21. package/dist/formats/dds/CjsDdsFormat.js.map +1 -1
  22. package/dist/formats/dds/core/helpers.js +4 -5
  23. package/dist/formats/dds/core/helpers.js.map +1 -1
  24. package/dist/formats/dxbc/CjsDxbcFormat.js +15 -13
  25. package/dist/formats/dxbc/CjsDxbcFormat.js.map +1 -1
  26. package/dist/formats/fbx/CjsFbxFormat.js +27 -19
  27. package/dist/formats/fbx/CjsFbxFormat.js.map +1 -1
  28. package/dist/formats/fbx/core/helpers.js +4 -4
  29. package/dist/formats/fbx/core/helpers.js.map +1 -1
  30. package/dist/formats/flac/CjsFlacFormat.js +19 -17
  31. package/dist/formats/flac/CjsFlacFormat.js.map +1 -1
  32. package/dist/formats/flac/core/helpers.js +5 -11
  33. package/dist/formats/flac/core/helpers.js.map +1 -1
  34. package/dist/formats/fsd/32/CjsFsd32Format.js +55 -0
  35. package/dist/formats/fsd/32/CjsFsd32Format.js.map +1 -0
  36. package/dist/formats/fsd/32/index.js +2 -0
  37. package/dist/formats/fsd/32/index.js.map +1 -0
  38. package/dist/formats/fsd/64/CjsFsd64Format.js +119 -0
  39. package/dist/formats/fsd/64/CjsFsd64Format.js.map +1 -0
  40. package/dist/formats/fsd/64/core/CjsFsd64Binary.js +393 -0
  41. package/dist/formats/fsd/64/core/CjsFsd64Binary.js.map +1 -0
  42. package/dist/formats/fsd/64/core/CjsFsd64Reader.js +138 -0
  43. package/dist/formats/fsd/64/core/CjsFsd64Reader.js.map +1 -0
  44. package/dist/formats/fsd/64/core/CjsFsd64SchemaDecoder.js +389 -0
  45. package/dist/formats/fsd/64/core/CjsFsd64SchemaDecoder.js.map +1 -0
  46. package/dist/formats/fsd/64/core/CjsFsd64SchemaReader.js +43 -0
  47. package/dist/formats/fsd/64/core/CjsFsd64SchemaReader.js.map +1 -0
  48. package/dist/formats/fsd/64/core/fsd64Records.js +60 -0
  49. package/dist/formats/fsd/64/core/fsd64Records.js.map +1 -0
  50. package/dist/formats/fsd/64/index.js +7 -0
  51. package/dist/formats/fsd/64/index.js.map +1 -0
  52. package/dist/formats/fsd/64/readers/CjsFsd64ReaderSetCharacterStaticData.js +33 -0
  53. package/dist/formats/fsd/64/readers/CjsFsd64ReaderSetCharacterStaticData.js.map +1 -0
  54. package/dist/formats/fsd/64/readers/CjsFsd64SchemaAgentTypes.js +35 -0
  55. package/dist/formats/fsd/64/readers/CjsFsd64SchemaAgentTypes.js.map +1 -0
  56. package/dist/formats/fsd/64/readers/CjsFsd64SchemaAgentsInSpace.js +50 -0
  57. package/dist/formats/fsd/64/readers/CjsFsd64SchemaAgentsInSpace.js.map +1 -0
  58. package/dist/formats/fsd/64/readers/CjsFsd64SchemaAncestries.js +75 -0
  59. package/dist/formats/fsd/64/readers/CjsFsd64SchemaAncestries.js.map +1 -0
  60. package/dist/formats/fsd/64/readers/CjsFsd64SchemaArchetypes.js +57 -0
  61. package/dist/formats/fsd/64/readers/CjsFsd64SchemaArchetypes.js.map +1 -0
  62. package/dist/formats/fsd/64/readers/CjsFsd64SchemaAudioMetadata.js +201 -0
  63. package/dist/formats/fsd/64/readers/CjsFsd64SchemaAudioMetadata.js.map +1 -0
  64. package/dist/formats/fsd/64/readers/CjsFsd64SchemaBloodlines.js +73 -0
  65. package/dist/formats/fsd/64/readers/CjsFsd64SchemaBloodlines.js.map +1 -0
  66. package/dist/formats/fsd/64/readers/CjsFsd64SchemaCategories.js +53 -0
  67. package/dist/formats/fsd/64/readers/CjsFsd64SchemaCategories.js.map +1 -0
  68. package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterAvatarBehaviors.js +44 -0
  69. package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterAvatarBehaviors.js.map +1 -0
  70. package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterColorLocations.js +38 -0
  71. package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterColorLocations.js.map +1 -0
  72. package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterColorNames.js +34 -0
  73. package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterColorNames.js.map +1 -0
  74. package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterModifierLocations.js +34 -0
  75. package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterModifierLocations.js.map +1 -0
  76. package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterPortraitResources.js +44 -0
  77. package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterPortraitResources.js.map +1 -0
  78. package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterResources.js +81 -0
  79. package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterResources.js.map +1 -0
  80. package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterSculptingLocations.js +34 -0
  81. package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterSculptingLocations.js.map +1 -0
  82. package/dist/formats/fsd/64/readers/CjsFsd64SchemaCompressibleTypes.js +41 -0
  83. package/dist/formats/fsd/64/readers/CjsFsd64SchemaCompressibleTypes.js.map +1 -0
  84. package/dist/formats/fsd/64/readers/CjsFsd64SchemaContrabandTypes.js +63 -0
  85. package/dist/formats/fsd/64/readers/CjsFsd64SchemaContrabandTypes.js.map +1 -0
  86. package/dist/formats/fsd/64/readers/CjsFsd64SchemaControlTowerResources.js +76 -0
  87. package/dist/formats/fsd/64/readers/CjsFsd64SchemaControlTowerResources.js.map +1 -0
  88. package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationActivities.js +38 -0
  89. package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationActivities.js.map +1 -0
  90. package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationRoleGroups.js +74 -0
  91. package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationRoleGroups.js.map +1 -0
  92. package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationRoles.js +59 -0
  93. package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationRoles.js.map +1 -0
  94. package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaAttributeCategories.js +46 -0
  95. package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaAttributeCategories.js.map +1 -0
  96. package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaAttributes.js +133 -0
  97. package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaAttributes.js.map +1 -0
  98. package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaEffects.js +236 -0
  99. package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaEffects.js.map +1 -0
  100. package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaUnits.js +60 -0
  101. package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaUnits.js.map +1 -0
  102. package/dist/formats/fsd/64/readers/CjsFsd64SchemaDynamicItemAttributes.js +95 -0
  103. package/dist/formats/fsd/64/readers/CjsFsd64SchemaDynamicItemAttributes.js.map +1 -0
  104. package/dist/formats/fsd/64/readers/CjsFsd64SchemaEpicArcs.js +106 -0
  105. package/dist/formats/fsd/64/readers/CjsFsd64SchemaEpicArcs.js.map +1 -0
  106. package/dist/formats/fsd/64/readers/CjsFsd64SchemaExpertSystems.js +86 -0
  107. package/dist/formats/fsd/64/readers/CjsFsd64SchemaExpertSystems.js.map +1 -0
  108. package/dist/formats/fsd/64/readers/CjsFsd64SchemaFactions.js +117 -0
  109. package/dist/formats/fsd/64/readers/CjsFsd64SchemaFactions.js.map +1 -0
  110. package/dist/formats/fsd/64/readers/CjsFsd64SchemaGraphicIds.js +70 -0
  111. package/dist/formats/fsd/64/readers/CjsFsd64SchemaGraphicIds.js.map +1 -0
  112. package/dist/formats/fsd/64/readers/CjsFsd64SchemaGraphicMaterialSets.js +173 -0
  113. package/dist/formats/fsd/64/readers/CjsFsd64SchemaGraphicMaterialSets.js.map +1 -0
  114. package/dist/formats/fsd/64/readers/CjsFsd64SchemaGroups.js +77 -0
  115. package/dist/formats/fsd/64/readers/CjsFsd64SchemaGroups.js.map +1 -0
  116. package/dist/formats/fsd/64/readers/CjsFsd64SchemaIcons.js +62 -0
  117. package/dist/formats/fsd/64/readers/CjsFsd64SchemaIcons.js.map +1 -0
  118. package/dist/formats/fsd/64/readers/CjsFsd64SchemaMarketGroups.js +63 -0
  119. package/dist/formats/fsd/64/readers/CjsFsd64SchemaMarketGroups.js.map +1 -0
  120. package/dist/formats/fsd/64/readers/CjsFsd64SchemaMetaGroups.js +86 -0
  121. package/dist/formats/fsd/64/readers/CjsFsd64SchemaMetaGroups.js.map +1 -0
  122. package/dist/formats/fsd/64/readers/CjsFsd64SchemaNpcCorporationDivisions.js +72 -0
  123. package/dist/formats/fsd/64/readers/CjsFsd64SchemaNpcCorporationDivisions.js.map +1 -0
  124. package/dist/formats/fsd/64/readers/CjsFsd64SchemaNpcCorporations.js +326 -0
  125. package/dist/formats/fsd/64/readers/CjsFsd64SchemaNpcCorporations.js.map +1 -0
  126. package/dist/formats/fsd/64/readers/CjsFsd64SchemaPaperdolls.js +279 -0
  127. package/dist/formats/fsd/64/readers/CjsFsd64SchemaPaperdolls.js.map +1 -0
  128. package/dist/formats/fsd/64/readers/CjsFsd64SchemaRaces.js +64 -0
  129. package/dist/formats/fsd/64/readers/CjsFsd64SchemaRaces.js.map +1 -0
  130. package/dist/formats/fsd/64/readers/CjsFsd64SchemaSchoolMap.js +40 -0
  131. package/dist/formats/fsd/64/readers/CjsFsd64SchemaSchoolMap.js.map +1 -0
  132. package/dist/formats/fsd/64/readers/CjsFsd64SchemaSchools.js +113 -0
  133. package/dist/formats/fsd/64/readers/CjsFsd64SchemaSchools.js.map +1 -0
  134. package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkillPlans.js +130 -0
  135. package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkillPlans.js.map +1 -0
  136. package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentCategories.js +38 -0
  137. package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentCategories.js.map +1 -0
  138. package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentPointValues.js +45 -0
  139. package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentPointValues.js.map +1 -0
  140. package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentRarities.js +44 -0
  141. package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentRarities.js.map +1 -0
  142. package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponents.js +163 -0
  143. package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponents.js.map +1 -0
  144. package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotCategories.js +37 -0
  145. package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotCategories.js.map +1 -0
  146. package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotConfigurations.js +77 -0
  147. package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotConfigurations.js.map +1 -0
  148. package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotNames.js +37 -0
  149. package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotNames.js.map +1 -0
  150. package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlots.js +74 -0
  151. package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlots.js.map +1 -0
  152. package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrTierThresholds.js +44 -0
  153. package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrTierThresholds.js.map +1 -0
  154. package/dist/formats/fsd/64/readers/CjsFsd64SchemaStationOperations.js +120 -0
  155. package/dist/formats/fsd/64/readers/CjsFsd64SchemaStationOperations.js.map +1 -0
  156. package/dist/formats/fsd/64/readers/CjsFsd64SchemaStationServices.js +49 -0
  157. package/dist/formats/fsd/64/readers/CjsFsd64SchemaStationServices.js.map +1 -0
  158. package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeDogma.js +73 -0
  159. package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeDogma.js.map +1 -0
  160. package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeLists.js +122 -0
  161. package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeLists.js.map +1 -0
  162. package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeMaterials.js +83 -0
  163. package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeMaterials.js.map +1 -0
  164. package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypes.js +194 -0
  165. package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypes.js.map +1 -0
  166. package/dist/formats/fsd/64/readers/index.js +58 -0
  167. package/dist/formats/fsd/64/readers/index.js.map +1 -0
  168. package/dist/formats/fsd/CjsFsdFormat.js +62 -0
  169. package/dist/formats/fsd/CjsFsdFormat.js.map +1 -0
  170. package/dist/formats/fsd/index.js +9 -0
  171. package/dist/formats/fsd/index.js.map +1 -0
  172. package/dist/formats/gif/CjsGifFormat.js +26 -16
  173. package/dist/formats/gif/CjsGifFormat.js.map +1 -1
  174. package/dist/formats/gif/core/helpers.js +6 -18
  175. package/dist/formats/gif/core/helpers.js.map +1 -1
  176. package/dist/formats/gltf/CjsGltfFormat.js +25 -13
  177. package/dist/formats/gltf/CjsGltfFormat.js.map +1 -1
  178. package/dist/formats/gr2/CjsGr2Format.js +27 -6
  179. package/dist/formats/gr2/CjsGr2Format.js.map +1 -1
  180. package/dist/formats/hlsl/CjsHlslFormat.js +20 -16
  181. package/dist/formats/hlsl/CjsHlslFormat.js.map +1 -1
  182. package/dist/formats/hlsl/core/analysis.js +1 -1
  183. package/dist/formats/index.js +5 -0
  184. package/dist/formats/index.js.map +1 -1
  185. package/dist/formats/jpeg/CjsJpegFormat.js +26 -19
  186. package/dist/formats/jpeg/CjsJpegFormat.js.map +1 -1
  187. package/dist/formats/jpeg/core/helpers.js +6 -15
  188. package/dist/formats/jpeg/core/helpers.js.map +1 -1
  189. package/dist/formats/jpeg/core/jpeg.js +0 -3
  190. package/dist/formats/jpeg/core/jpeg.js.map +1 -1
  191. package/dist/formats/mp3/CjsMp3Format.js +19 -19
  192. package/dist/formats/mp3/CjsMp3Format.js.map +1 -1
  193. package/dist/formats/mp3/core/helpers.js +5 -11
  194. package/dist/formats/mp3/core/helpers.js.map +1 -1
  195. package/dist/formats/mp4/CjsMp4Format.js +20 -19
  196. package/dist/formats/mp4/CjsMp4Format.js.map +1 -1
  197. package/dist/formats/mp4/core/helpers.js +6 -15
  198. package/dist/formats/mp4/core/helpers.js.map +1 -1
  199. package/dist/formats/obj/CjsObjFormat.js +25 -12
  200. package/dist/formats/obj/CjsObjFormat.js.map +1 -1
  201. package/dist/formats/ogg/CjsOggFormat.js +26 -17
  202. package/dist/formats/ogg/CjsOggFormat.js.map +1 -1
  203. package/dist/formats/ogg/core/helpers.js +5 -16
  204. package/dist/formats/ogg/core/helpers.js.map +1 -1
  205. package/dist/formats/pickle/CjsPickleFormat.js +64 -5
  206. package/dist/formats/pickle/CjsPickleFormat.js.map +1 -1
  207. package/dist/formats/png/CjsPngFormat.js +28 -19
  208. package/dist/formats/png/CjsPngFormat.js.map +1 -1
  209. package/dist/formats/png/core/helpers.js +5 -14
  210. package/dist/formats/png/core/helpers.js.map +1 -1
  211. package/dist/formats/red/CjsRedFormat.js +19 -5
  212. package/dist/formats/red/CjsRedFormat.js.map +1 -1
  213. package/dist/formats/schemabound/CjsSchemaBoundFormat.js +48 -38
  214. package/dist/formats/schemabound/CjsSchemaBoundFormat.js.map +1 -1
  215. package/dist/formats/sqlite/CjsSqliteFormat.js +49 -41
  216. package/dist/formats/sqlite/CjsSqliteFormat.js.map +1 -1
  217. package/dist/formats/static/CjsStaticFormat.js +15 -57
  218. package/dist/formats/static/CjsStaticFormat.js.map +1 -1
  219. package/dist/formats/static/staticContainers.js +6 -6
  220. package/dist/formats/static/staticContainers.js.map +1 -1
  221. package/dist/formats/stl/CjsStlFormat.js +25 -12
  222. package/dist/formats/stl/CjsStlFormat.js.map +1 -1
  223. package/dist/formats/tga/CjsTgaFormat.js +26 -19
  224. package/dist/formats/tga/CjsTgaFormat.js.map +1 -1
  225. package/dist/formats/tga/core/helpers.js +7 -22
  226. package/dist/formats/tga/core/helpers.js.map +1 -1
  227. package/dist/formats/wav/CjsWavFormat.js +26 -19
  228. package/dist/formats/wav/CjsWavFormat.js.map +1 -1
  229. package/dist/formats/wav/core/helpers.js +7 -16
  230. package/dist/formats/wav/core/helpers.js.map +1 -1
  231. package/dist/formats/webgl/CjsWebglFormat.js +11 -13
  232. package/dist/formats/webgl/CjsWebglFormat.js.map +1 -1
  233. package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js +31 -1
  234. package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
  235. package/dist/formats/webgl/core/readGlslEffectContainer.js +8 -8
  236. package/dist/formats/webgl/core/readGlslEffectContainer.js.map +1 -1
  237. package/dist/formats/webgpu/CjsWebgpuFormat.js +11 -5
  238. package/dist/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
  239. package/dist/formats/webm/CjsWebmFormat.js +20 -19
  240. package/dist/formats/webm/CjsWebmFormat.js.map +1 -1
  241. package/dist/formats/webm/core/helpers.js +6 -15
  242. package/dist/formats/webm/core/helpers.js.map +1 -1
  243. package/dist/formats/webp/CjsWebpFormat.js +19 -17
  244. package/dist/formats/webp/CjsWebpFormat.js.map +1 -1
  245. package/dist/formats/webp/core/helpers.js +5 -11
  246. package/dist/formats/webp/core/helpers.js.map +1 -1
  247. package/dist/formats/wem/CjsWemFormat.js +128 -141
  248. package/dist/formats/wem/CjsWemFormat.js.map +1 -1
  249. package/dist/formats/wem/core/helpers.js +1 -114
  250. package/dist/formats/wem/core/helpers.js.map +1 -1
  251. package/dist/formats/wem/core/{resolve.js → probeCodecSupport.js} +11 -18
  252. package/dist/formats/wem/core/probeCodecSupport.js.map +1 -0
  253. package/dist/formats/yaml/CjsYamlFormat.js +20 -5
  254. package/dist/formats/yaml/CjsYamlFormat.js.map +1 -1
  255. package/dist/generated/index.js +2 -0
  256. package/dist/generated/index.js.map +1 -0
  257. package/dist/generated/resources/Tr2RaycastGeometryRes.js +34 -0
  258. package/dist/generated/resources/Tr2RaycastGeometryRes.js.map +1 -0
  259. package/dist/generated/resources/index.js +2 -0
  260. package/dist/generated/resources/index.js.map +1 -0
  261. package/dist/index.js +3 -1
  262. package/dist/index.js.map +1 -1
  263. package/dist/resource/CjsResource.js +134 -0
  264. package/dist/resource/CjsResource.js.map +1 -1
  265. package/dist/resource/ResourceRequirement.js +42 -0
  266. package/dist/resource/ResourceRequirement.js.map +1 -0
  267. package/dist/resource/Tr2LightProfileRes.js +2 -1
  268. package/dist/resource/Tr2LightProfileRes.js.map +1 -1
  269. package/dist/resource/geometry/TriGeometryRes.js +34 -7
  270. package/dist/resource/geometry/TriGeometryRes.js.map +1 -1
  271. package/dist/resource/geometry/granny/Tr2GrannyStateRes.js +184 -7
  272. package/dist/resource/geometry/granny/Tr2GrannyStateRes.js.map +1 -1
  273. package/dist/resource/geometry/granny/TriGrannyRes.js +20 -8
  274. package/dist/resource/geometry/granny/TriGrannyRes.js.map +1 -1
  275. package/dist/resource/index.js +1 -0
  276. package/dist/resource/index.js.map +1 -1
  277. package/dist/resource/resourceBoundary.js +24 -1
  278. package/dist/resource/resourceBoundary.js.map +1 -1
  279. package/dist/resource/shader/Tr2EffectRes.js +2 -1
  280. package/dist/resource/shader/Tr2EffectRes.js.map +1 -1
  281. package/dist/resource/texture/CjsTextureArrayRes.js +2 -1
  282. package/dist/resource/texture/CjsTextureArrayRes.js.map +1 -1
  283. package/dist/resource/texture/Tr2ImageRes.js +2 -1
  284. package/dist/resource/texture/Tr2ImageRes.js.map +1 -1
  285. package/dist/resource/texture/TriTextureRes.js +40 -2
  286. package/dist/resource/texture/TriTextureRes.js.map +1 -1
  287. package/docs/architecture.md +121 -116
  288. package/docs/concepts/format-capabilities.md +90 -0
  289. package/docs/formats/README.md +14 -6
  290. package/docs/formats/fsd.md +104 -0
  291. package/docs/formats/gr2.md +1 -1
  292. package/docs/formats/hlsl/reference/api.md +6 -4
  293. package/docs/formats/provenance.md +18 -0
  294. package/docs/formats/schemabound.md +10 -4
  295. package/docs/formats/static.md +26 -26
  296. package/docs/formats/webgpu/reference/api.md +4 -3
  297. package/docs/reference/classes/core.md +22 -2
  298. package/docs/reference/classes/formats.md +643 -1
  299. package/docs/reference/classes/resources.md +463 -453
  300. package/docs/reference/queues.md +205 -194
  301. package/docs/roadmap.md +14 -18
  302. package/format-notices/fsd/LICENSE +21 -0
  303. package/format-notices/fsd/NOTICE +11 -0
  304. package/package.json +70 -64
  305. package/dist/formats/wem/core/resolve.js.map +0 -1
  306. package/docs/concepts/format-type-resolution.md +0 -79
@@ -1,224 +1,453 @@
1
1
  import { MediaType, PayloadType } from '@carbonenginejs/runtime-utils/media';
2
- import { CjsResourceProbe as _CjsResourceProbe } from './CjsResourceProbe.js';
3
2
 
4
- /**
5
- * Base class for format readers that defines the static
6
- * `read`/`readAsync`/`isSupported`/`resolveType` contract and instance
7
- * option handling that concrete format packages implement.
3
+ const OUTPUT_ROLE_RUNTIME = "runtime";
4
+ const OUTPUT_ROLE_DEBUG = "debug";
5
+ const READ_MODE_SYNC = "sync";
6
+ const READ_MODE_ASYNC = "async";
7
+
8
+ /**
9
+ * Decorator-free base for every concrete format facade.
10
+ *
11
+ * The format subpaths must remain directly importable from authored source, so
12
+ * this base deliberately does not import the decorated CjsResourceProbe model.
13
+ * Formats return plain support reports; CjsResourceProbe.from() is the optional
14
+ * resource-layer normalization boundary.
8
15
  */
9
16
  class CjsFormat {
10
17
  options = {};
18
+ constructor(options = null) {
19
+ this.options = {
20
+ ...(options || {})
21
+ };
22
+ }
23
+
24
+ /** Apply caller-provided instance defaults. */
25
+ SetValues(values = null) {
26
+ this.options = {
27
+ ...this.options,
28
+ ...(values || {})
29
+ };
30
+ return this;
31
+ }
32
+
33
+ /** Return caller-provided instance defaults. */
34
+ GetValues() {
35
+ return {
36
+ ...this.options
37
+ };
38
+ }
39
+
40
+ /** Read through the concrete instance implementation. */
41
+ Read(_input, _options = null) {
42
+ const error = new Error(`${this.constructor.name}.Read is not implemented.`);
43
+ error.code = "CJS_FORMAT_READ_NOT_IMPLEMENTED";
44
+ throw error;
45
+ }
46
+
47
+ /** Async instance read; synchronous readers inherit this exact fallback. */
48
+ async ReadAsync(input, options = null) {
49
+ return this.Read(input, options);
50
+ }
51
+
52
+ /** Inspect with the instance's normalized options when available. */
53
+ Inspect(input, options = null) {
54
+ const values = typeof this.GetValues === "function" ? this.GetValues(options || {}) : options || {};
55
+ return this.constructor.inspect(input, values);
56
+ }
57
+
58
+ /** Return the cheap, unverified support report for this instance profile. */
59
+ GetSupport(input, options = null) {
60
+ const values = typeof this.GetValues === "function" ? this.GetValues(options || {}) : options || {};
61
+ return this.constructor.getSupport(input, values);
62
+ }
11
63
 
12
- /**
13
- * Convenience factory for simple format helpers.
14
- * Keep this lightweight so format classes can stay pure-reader implementations.
15
- *
16
- * @param {*} input
17
- * @param {object} options
18
- * @returns {Promise<*>|*}
64
+ /** Exercise one exact output through the real asynchronous read path. */
65
+ VerifySupport(input, options = null) {
66
+ const values = typeof this.GetValues === "function" ? this.GetValues(options || {}) : options || {};
67
+ return this.constructor.verifySupport(input, values);
68
+ }
69
+
70
+ /**
71
+ * Static read boundary. Concrete formats normally override this; the base
72
+ * fallback supports the few formats implemented only as instance readers.
19
73
  */
20
74
  static read(input, options = null) {
21
75
  const reader = new this(options || {});
76
+ if (reader.Read === CjsFormat.prototype.Read) {
77
+ const error = new Error(`${this.name}.read is not implemented.`);
78
+ error.code = "CJS_FORMAT_READ_NOT_IMPLEMENTED";
79
+ throw error;
80
+ }
22
81
  return reader.Read(input, options || {});
23
82
  }
24
83
 
25
- /**
26
- * Async convenience factory for format readers.
27
- *
28
- * @param {*} input
29
- * @param {object} options
30
- * @returns {Promise<*>}
31
- */
84
+ /** Async read boundary used by support verification and resource loading. */
32
85
  static async readAsync(input, options = null) {
86
+ if (Object.hasOwn(this, "read")) return this.read(input, options || {});
33
87
  const reader = new this(options || {});
34
88
  return reader.ReadAsync(input, options || {});
35
89
  }
36
90
 
37
- /**
38
- * Canonical support probe entrypoint.
39
- * Returns a probe report including compressed/raw capability variants when implemented.
40
- *
41
- * @param {*} input
42
- * @param {object} options
43
- * @returns {CjsResourceProbe}
44
- */
45
- static isSupported(input, options = null) {
46
- const source = typeof input === "string" ? "path" : "buffer";
47
- const formatName = this.name ? this.name.replace(/^Cjs/u, "").replace(/Format$/u, "").toLowerCase() : "format";
48
- return _CjsResourceProbe.createUnsupported(formatName, "No probe implementation.", {
49
- source,
50
- ...options
51
- });
52
- }
53
-
54
- /**
55
- * Alias for canonical naming.
56
- *
57
- * @param {*} input
58
- * @param {object} options
59
- * @returns {CjsResourceProbe}
60
- */
61
- static inspect(input, options = null) {
62
- return this.isSupported(input, options);
63
- }
64
-
65
- /**
66
- * Content-verified type/route resolution (optional per format).
67
- * Contract: docs/concepts/format-type-resolution.md.
68
- *
69
- * Where inspect()/isSupported() report what the container CLAIMS,
70
- * resolveType() performs one bounded asynchronous content check (magic, a
71
- * first frame/block, a setup header) and reports what the reader has
72
- * evidence it can actually decode. Overrides return a CjsResourceProbe
73
- * with `verified: true` and declared/resolved/mismatch evidence in
74
- * `metadata`; `preferred` names the resolved decode route. A caller-forced
75
- * emit always wins over a resolution, and this base implementation - the
76
- * zero-extra-work path for formats without an override - delegates to
77
- * isSupported() with `verified` false so an unverified result never
78
- * changes a route.
79
- *
80
- * @param {*} input Bytes (or path where the format supports it).
81
- * @param {object|null} options Format options.
82
- * @returns {Promise<CjsResourceProbe>} Probe report; content-verified only when overridden.
91
+ /**
92
+ * Synchronous structural metadata accessor.
93
+ *
94
+ * Inspection answers what the input is. It does not claim that any decoder
95
+ * output works in the current environment.
83
96
  */
84
- static async resolveType(input, options = null) {
85
- const report = _CjsResourceProbe.from(this.isSupported(input, options));
86
- report.verified = false;
87
- return report;
97
+ static inspect(_input, _options = null) {
98
+ const error = new Error(`${this.name}.inspect is not implemented.`);
99
+ error.code = "CJS_FORMAT_INSPECT_NOT_IMPLEMENTED";
100
+ throw error;
88
101
  }
89
102
 
90
- /** Creates a CjsFormat with caller-provided reader configuration. */
91
- constructor(options = null) {
92
- this.options = {
93
- ...(options || {})
94
- };
103
+ /** Cheap synchronous identification used only for route selection. */
104
+ static is(input, options = null) {
105
+ try {
106
+ if (Object.hasOwn(this, "probeSupport")) {
107
+ return recognizesProbe(this.probeSupport(input, options || {}));
108
+ }
109
+ this.inspect(input, options || {});
110
+ return true;
111
+ } catch {
112
+ return false;
113
+ }
95
114
  }
96
115
 
97
- /** Applies supported format options for the resource format configuration. */
98
- SetValues(values = null) {
99
- if (!values || typeof values !== "object") {
100
- return this;
101
- }
102
- if (Object.prototype.hasOwnProperty.call(values, "options")) {
103
- this.options = {
104
- ...(values.options || {})
116
+ /**
117
+ * Format-specific cheap support probe hook.
118
+ *
119
+ * Concrete formats may override this with header/environment reasoning. The
120
+ * public getSupport() method normalizes its result into the uniform contract.
121
+ */
122
+ static probeSupport(input, options = null) {
123
+ try {
124
+ return {
125
+ format: this.id,
126
+ source: typeof input === "string" ? "path" : "buffer",
127
+ recognized: true,
128
+ metadata: this.inspect(input, options || {}),
129
+ reason: "Container structure recognized."
105
130
  };
106
- } else {
107
- this.options = {
108
- ...this.options,
109
- ...values
131
+ } catch (error) {
132
+ return {
133
+ format: this.id,
134
+ source: typeof input === "string" ? "path" : "buffer",
135
+ recognized: false,
136
+ metadata: null,
137
+ reason: error?.message || "Input was not recognized.",
138
+ errors: [error?.message || "Input was not recognized."]
110
139
  };
111
140
  }
112
- return this;
113
141
  }
114
142
 
115
- /**
116
- * Returns a copy of the current format options for the resource format
117
- * configuration.
143
+ /**
144
+ * Cheap synchronous output support report.
145
+ *
146
+ * This is advisory: it may use headers, structure, and current environment
147
+ * features, but never claims that the decoder ran. Every output entry is
148
+ * therefore returned with verified:false.
118
149
  */
119
- GetValues() {
120
- return {
121
- options: {
122
- ...this.options
123
- }
124
- };
150
+ static getSupport(input, options = null) {
151
+ const values = options && typeof options === "object" ? options : {};
152
+ let report;
153
+ try {
154
+ report = this.probeSupport(input, values);
155
+ } catch (error) {
156
+ report = {
157
+ format: this.id,
158
+ source: typeof input === "string" ? "path" : "buffer",
159
+ recognized: false,
160
+ reason: error?.message || "Support probe failed.",
161
+ errors: [error?.message || "Support probe failed."]
162
+ };
163
+ }
164
+ return normalizeSupportReport(this, report, values);
125
165
  }
126
166
 
127
- /**
128
- * Initializes the format with the supplied values and context for the resource
129
- * format configuration.
167
+ /**
168
+ * Prove one exact output by exercising the real asynchronous reader.
169
+ *
170
+ * This is an explicit diagnostic/capability operation. Normal resource
171
+ * loading calls readAsync() once and treats its successful result as proof;
172
+ * it must not verify and then decode the same payload a second time.
130
173
  */
131
- Initialize(values = null) {
132
- return this.SetValues(values || {});
174
+ static async verifySupport(input, options = null) {
175
+ const values = options && typeof options === "object" ? options : {};
176
+ const report = this.getSupport(input, values);
177
+ const capability = this.getOutputCapability(report.output);
178
+ if (!capability) {
179
+ const message = report.output ? `${this.name} declares no output ${JSON.stringify(report.output)}.` : `${this.name} declares no verifiable default output.`;
180
+ return Object.freeze({
181
+ ...report,
182
+ supported: false,
183
+ verified: true,
184
+ reason: message,
185
+ error: Object.freeze({
186
+ name: "Error",
187
+ code: "CJS_FORMAT_OUTPUT_UNDECLARED",
188
+ message
189
+ })
190
+ });
191
+ }
192
+ try {
193
+ await this.readAsync(input, {
194
+ ...values,
195
+ emit: capability.output
196
+ });
197
+ return freezeVerification(report, capability, true, null);
198
+ } catch (error) {
199
+ return freezeVerification(report, capability, false, error);
200
+ }
133
201
  }
134
202
 
135
- /**
136
- * Primary instance read entrypoint for synchronous readers.
137
- * Implementations may override with async handling in readAsync only if needed.
138
- */
139
- Read(input, options = null) {
140
- throw new Error(`${this.constructor.name}.Read must be implemented by a format package.`);
203
+ /** Return the canonical declaration for one output selector. */
204
+ static getOutputCapability(output = null) {
205
+ if (!output) {
206
+ return Object.values(this.outputs).find(entry => entry.default) || null;
207
+ }
208
+ const normalized = String(output).toLowerCase();
209
+ return Object.values(this.outputs).find(entry => entry.output.toLowerCase() === normalized) || null;
141
210
  }
142
211
 
143
- /**
144
- * Primary async read entrypoint for asynchronous readers.
145
- * Defaults to sync Read for compatibility.
146
- */
147
- async ReadAsync(input, options = null) {
148
- return this.Read(input, options);
212
+ /** Freeze and validate one format's authoritative output map. */
213
+ static defineOutputs(definitions = {}) {
214
+ if (!definitions || typeof definitions !== "object" || Array.isArray(definitions)) {
215
+ throw new TypeError("CjsFormat.defineOutputs requires an object map.");
216
+ }
217
+ const outputs = {};
218
+ let defaults = 0;
219
+ for (const [output, definition] of Object.entries(definitions)) {
220
+ if (!output || !definition || typeof definition !== "object" || Array.isArray(definition)) {
221
+ throw new TypeError("Each format output requires a non-empty name and descriptor.");
222
+ }
223
+ const role = definition.role || OUTPUT_ROLE_RUNTIME;
224
+ const readMode = definition.readMode || READ_MODE_SYNC;
225
+ if (![OUTPUT_ROLE_RUNTIME, OUTPUT_ROLE_DEBUG].includes(role)) {
226
+ throw new TypeError(`Format output ${output} has invalid role ${JSON.stringify(role)}.`);
227
+ }
228
+ if (![READ_MODE_SYNC, READ_MODE_ASYNC].includes(readMode)) {
229
+ throw new TypeError(`Format output ${output} has invalid readMode ${JSON.stringify(readMode)}.`);
230
+ }
231
+ if (definition.default === true) defaults++;
232
+ const probes = definition.probes ?? definition.probe ?? output;
233
+ outputs[output] = Object.freeze({
234
+ output,
235
+ payloadType: definition.payloadType || output,
236
+ role,
237
+ readMode,
238
+ decoded: definition.decoded === true,
239
+ passthrough: definition.passthrough === true,
240
+ default: definition.default === true,
241
+ probes: Object.freeze((Array.isArray(probes) ? probes : [probes]).map(String)),
242
+ requires: Object.freeze([...(definition.requires || [])])
243
+ });
244
+ }
245
+ if (defaults > 1) throw new TypeError("A format may declare only one default output.");
246
+ if (Object.keys(outputs).length > 0 && defaults !== 1) {
247
+ throw new TypeError("A format with outputs must declare exactly one default output.");
248
+ }
249
+ return Object.freeze(outputs);
149
250
  }
150
251
 
151
- /**
152
- * Canonical package-family group names - the shared vocabulary object from
153
- * runtime-utils (kb: runtime-utils owns cross-package media vocabulary).
154
- * Same object identity as `@carbonenginejs/runtime-utils/media` MediaType,
155
- * so tokens can never drift between packages.
156
- */
252
+ /** Assert the canonical format surface without requiring optional outputs. */
253
+ static validateContract(Constructor) {
254
+ if (typeof Constructor !== "function" || !(Constructor.prototype instanceof CjsFormat)) {
255
+ throw new TypeError("CjsFormat.validateContract requires a CjsFormat subclass.");
256
+ }
257
+ if (typeof Constructor.id !== "string" || !Constructor.id) {
258
+ throw new TypeError(`${Constructor.name} must declare a non-empty id.`);
259
+ }
260
+ if (!Array.isArray(Constructor.mediaTypes) || Constructor.mediaTypes.length === 0 || !Object.isFrozen(Constructor.mediaTypes)) {
261
+ throw new TypeError(`${Constructor.name} must declare frozen non-empty mediaTypes.`);
262
+ }
263
+ for (const mediaType of Constructor.mediaTypes) {
264
+ if (!Object.values(MediaType).includes(mediaType)) {
265
+ throw new TypeError(`${Constructor.name} media type ${JSON.stringify(mediaType)} is not canonical.`);
266
+ }
267
+ }
268
+ if (!Array.isArray(Constructor.extensions) || !Object.isFrozen(Constructor.extensions)) {
269
+ throw new TypeError(`${Constructor.name} must declare frozen extensions.`);
270
+ }
271
+ if (!Constructor.outputs || typeof Constructor.outputs !== "object" || Array.isArray(Constructor.outputs) || !Object.isFrozen(Constructor.outputs)) {
272
+ throw new TypeError(`${Constructor.name} must declare frozen outputs.`);
273
+ }
274
+ if (typeof Constructor.requestResponseType !== "string" || !Constructor.requestResponseType) {
275
+ throw new TypeError(`${Constructor.name} must declare a requestResponseType.`);
276
+ }
277
+ if (Constructor.worker !== null) {
278
+ if (!Constructor.worker || typeof Constructor.worker !== "object" || !Object.isFrozen(Constructor.worker)) {
279
+ throw new TypeError(`${Constructor.name}.worker must be null or a frozen descriptor.`);
280
+ }
281
+ if (typeof Constructor.worker.module !== "string" || !Constructor.worker.module || typeof Constructor.worker.exportName !== "string" || !Constructor.worker.exportName || !Array.isArray(Constructor.worker.outputTypes) || !Object.isFrozen(Constructor.worker.outputTypes)) {
282
+ throw new TypeError(`${Constructor.name}.worker has an invalid execution descriptor.`);
283
+ }
284
+ for (const output of Constructor.worker.outputTypes) {
285
+ if (!Constructor.getOutputCapability(output)) {
286
+ throw new TypeError(`${Constructor.name}.worker names undeclared output ${JSON.stringify(output)}.`);
287
+ }
288
+ }
289
+ if (Constructor.worker.defaultOutput && !Constructor.getOutputCapability(Constructor.worker.defaultOutput)) {
290
+ throw new TypeError(`${Constructor.name}.worker names an undeclared default output.`);
291
+ }
292
+ }
293
+ for (const retired of ["type", "inputTypes", "outputTypes", "debugOutputTypes", "implementationStatus"]) {
294
+ if (Object.hasOwn(Constructor, retired)) {
295
+ throw new TypeError(`${Constructor.name} must not declare retired static ${retired}.`);
296
+ }
297
+ }
298
+ let defaults = 0;
299
+ for (const [output, capability] of Object.entries(Constructor.outputs)) {
300
+ if (!Object.isFrozen(capability)) {
301
+ throw new TypeError(`${Constructor.name} output capabilities must be frozen.`);
302
+ }
303
+ if (capability.output !== output) {
304
+ throw new TypeError(`${Constructor.name} output ${output} has a mismatched descriptor.`);
305
+ }
306
+ if (capability.default) defaults++;
307
+ }
308
+ if (Object.keys(Constructor.outputs).length > 0 && defaults !== 1) {
309
+ throw new TypeError(`${Constructor.name} must declare exactly one default output.`);
310
+ }
311
+ }
157
312
  static Type = MediaType;
158
-
159
- /**
160
- * Canonical media-type groups used by format registration - the shared
161
- * runtime-utils MediaType object (see Type above).
162
- */
163
313
  static MediaType = MediaType;
164
-
165
- /**
166
- * Canonical output-type tokens used by format emit contracts. Shared
167
- * payload ROLES come from runtime-utils PayloadType; the remaining tokens
168
- * (cmf/gr2/json/pcm/rgba/shared/objJson) are format-emit names owned by
169
- * their formats and enumerated here for discoverability only.
170
- */
171
314
  static OutputType = Object.freeze({
172
315
  AUDIO: PayloadType.AUDIO,
173
316
  CMF: "cmf",
317
+ DOCUMENT: "document",
174
318
  GR2: "gr2",
175
319
  IMAGE: PayloadType.IMAGE,
176
320
  JSON: "json",
321
+ MEDIA: "media",
322
+ METADATA: "metadata",
323
+ OGG: "ogg",
324
+ PAYLOAD: "payload",
177
325
  PCM: "pcm",
178
326
  RAW: PayloadType.RAW,
179
327
  RGBA: "rgba",
328
+ RUNTIME: "runtime",
180
329
  SCHEMA: PayloadType.SCHEMA,
181
330
  SHADER: PayloadType.SHADER,
182
331
  SHARED: "shared",
183
332
  TEXTURE: PayloadType.TEXTURE,
184
- VIDEO: PayloadType.VIDEO,
185
- OBJ_JSON: "objJson"
333
+ VIDEO: PayloadType.VIDEO
186
334
  });
187
- static type = Object.freeze([]);
335
+ static id = "";
188
336
  static mediaTypes = Object.freeze([]);
189
- static inputTypes = Object.freeze([]);
190
- static outputTypes = Object.freeze([]);
191
- static debugOutputTypes = Object.freeze(["json", "raw"]);
192
-
193
- /**
194
- * Optional browser-worker module declaration.
195
- *
196
- * Concrete formats opt in with their exact `import.meta.url`, export name,
197
- * and optional clone-safe output restrictions.
198
- */
337
+ static extensions = Object.freeze([]);
338
+ static outputs = Object.freeze({});
339
+ static requestResponseType = "arraybuffer";
199
340
  static worker = null;
200
-
201
- /**
202
- * Asserts that a format class declares the metadata required for
203
- * registration and routing.
204
- *
205
- * @param {typeof CjsFormat} Constructor
206
- * @returns {void}
207
- */
208
- static validateContract(Constructor) {
209
- if (!Constructor) {
210
- throw new TypeError("CjsFormat.validateContract requires a format class.");
211
- }
212
- const hasOutput = Array.isArray(Constructor.outputTypes) && Constructor.outputTypes.length > 0;
213
- const hasInput = Array.isArray(Constructor.inputTypes) && Constructor.inputTypes.length > 0;
214
- const hasMedia = Array.isArray(Constructor.mediaTypes) && Constructor.mediaTypes.length > 0;
215
- const hasType = Array.isArray(Constructor.type) && Constructor.type.length > 0;
216
- const hasDebug = Array.isArray(Constructor.debugOutputTypes) && Constructor.debugOutputTypes.length > 0;
217
- if (!hasType || !hasMedia || !hasInput || !hasOutput || !hasDebug) {
218
- throw new TypeError(`Format contract missing metadata: type:${hasType} mediaTypes:${hasMedia} inputTypes:${hasInput} outputTypes:${hasOutput} debugOutputTypes:${hasDebug}`);
341
+ }
342
+ function normalizeSupportReport(Format, rawReport, options) {
343
+ const raw = typeof rawReport === "boolean" ? {
344
+ recognized: rawReport,
345
+ supported: rawReport
346
+ } : rawReport && typeof rawReport === "object" ? rawReport : {};
347
+ const requested = options.emit ?? null;
348
+ const capability = Format.getOutputCapability(requested);
349
+ const legacyVariants = Array.isArray(raw.variants) ? raw.variants : [];
350
+ const rawPositive = raw.supported === true || raw.supported === "full" || raw.supported === "partial";
351
+ const recognized = raw.recognized === true || raw.recognized !== false && (raw.metadata != null || rawPositive);
352
+ const outputs = Object.values(Format.outputs).map(entry => {
353
+ const variant = findLegacyVariant(entry, legacyVariants);
354
+ const supported = variant ? variant.supported === true : recognized && (legacyVariants.length === 0 ? raw.supported !== false && raw.supported !== "none" : false);
355
+ return Object.freeze({
356
+ ...entry,
357
+ supported,
358
+ verified: false,
359
+ codec: variant?.codec || "",
360
+ reason: variant?.reason || raw.reason || (supported ? "Output appears usable from structural evidence." : "Output was not supported by the structural probe."),
361
+ requires: Object.freeze([...(variant?.requires || entry.requires)])
362
+ });
363
+ });
364
+ const selected = capability ? outputs.find(entry => entry.output === capability.output) || null : null;
365
+ const preferredOutput = resolvePreferredOutput(raw.preferredOutput, outputs) || outputs.find(entry => entry.supported && entry.role === OUTPUT_ROLE_RUNTIME)?.output || outputs.find(entry => entry.supported)?.output || "";
366
+ return Object.freeze({
367
+ format: Format.id || raw.format || Format.name,
368
+ source: raw.source || options.source || "buffer",
369
+ recognized,
370
+ output: capability?.output || (requested == null ? "" : String(requested)),
371
+ supported: selected?.supported === true,
372
+ verified: false,
373
+ preferredOutput,
374
+ reason: selected?.reason || raw.reason || (recognized ? "Input recognized." : "Input not recognized."),
375
+ metadata: raw.metadata ?? null,
376
+ capability: selected,
377
+ outputs: Object.freeze(outputs),
378
+ warnings: Object.freeze([...(raw.warnings || [])]),
379
+ errors: Object.freeze([...(raw.errors || [])]),
380
+ error: null
381
+ });
382
+ }
383
+ function recognizesProbe(report) {
384
+ if (report === true) return true;
385
+ if (!report || typeof report !== "object" || report.recognized === false) return false;
386
+ return report.recognized === true || report.supported === true || report.supported === "full" || report.supported === "partial" || report.metadata != null;
387
+ }
388
+ function findLegacyVariant(capability, variants) {
389
+ const probes = new Set(capability.probes.map(value => value.toLowerCase()));
390
+ const matches = variants.filter(variant => {
391
+ for (const value of [variant?.output, variant?.kind, variant?.payloadType]) {
392
+ if (value != null && probes.has(String(value).toLowerCase())) return true;
219
393
  }
394
+ return false;
395
+ });
396
+ const output = capability.output.toLowerCase();
397
+ return matches.find(variant => String(variant?.output || "").toLowerCase() === output) || matches.find(variant => String(variant?.kind || "").toLowerCase() === output) || matches.find(variant => String(variant?.payloadType || "").toLowerCase() === output) || matches.find(variant => variant.supported === true) || matches[0] || null;
398
+ }
399
+ function resolvePreferredOutput(preferredOutput, outputs) {
400
+ if (!preferredOutput) return "";
401
+ const normalized = String(preferredOutput).toLowerCase();
402
+ const direct = outputs.find(entry => entry.output.toLowerCase() === normalized);
403
+ return direct?.output || "";
404
+ }
405
+ function freezeVerification(report, capability, supported, error) {
406
+ const errorReport = error ? serializeError(error) : null;
407
+ const outputs = report.outputs.map(entry => entry.output === capability.output ? Object.freeze({
408
+ ...entry,
409
+ supported,
410
+ verified: true,
411
+ reason: supported ? "The real asynchronous read path completed successfully." : errorReport.message
412
+ }) : entry);
413
+ return Object.freeze({
414
+ ...report,
415
+ recognized: supported ? true : report.recognized,
416
+ supported,
417
+ verified: true,
418
+ reason: supported ? "The real asynchronous read path completed successfully." : errorReport.message,
419
+ capability: outputs.find(entry => entry.output === capability.output) || null,
420
+ outputs: Object.freeze(outputs),
421
+ errors: errorReport ? Object.freeze([...report.errors, errorReport.message]) : report.errors,
422
+ error: errorReport
423
+ });
424
+ }
425
+ function serializeError(error) {
426
+ const details = {};
427
+ for (const [key, value] of Object.entries(error || {})) {
428
+ if (["name", "code", "message", "cause"].includes(key)) continue;
429
+ details[key] = value;
220
430
  }
431
+ return Object.freeze({
432
+ name: error?.name || "Error",
433
+ code: error?.code || "CJS_FORMAT_VERIFY_FAILED",
434
+ message: error?.message || String(error),
435
+ details: Object.freeze(details),
436
+ cause: error?.cause ? Object.freeze({
437
+ name: error.cause.name || "Error",
438
+ code: error.cause.code || "",
439
+ message: error.cause.message || String(error.cause)
440
+ }) : null
441
+ });
221
442
  }
443
+ const CjsFormatOutputRole = Object.freeze({
444
+ RUNTIME: OUTPUT_ROLE_RUNTIME,
445
+ DEBUG: OUTPUT_ROLE_DEBUG
446
+ });
447
+ const CjsFormatReadMode = Object.freeze({
448
+ SYNC: READ_MODE_SYNC,
449
+ ASYNC: READ_MODE_ASYNC
450
+ });
222
451
 
223
- export { CjsFormat };
452
+ export { CjsFormat, CjsFormatOutputRole, CjsFormatReadMode };
224
453
  //# sourceMappingURL=CjsFormat.js.map