@blamnetwork/blf 1.0.0-alpha.1

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 (235) hide show
  1. package/README.md +82 -0
  2. package/dist/bitstream/enum.d.ts +6 -0
  3. package/dist/bitstream/enum.d.ts.map +1 -0
  4. package/dist/bitstream/enum.js +15 -0
  5. package/dist/bitstream/enums.d.ts +21 -0
  6. package/dist/bitstream/enums.d.ts.map +1 -0
  7. package/dist/bitstream/enums.js +31 -0
  8. package/dist/bitstream/errors.d.ts +5 -0
  9. package/dist/bitstream/errors.d.ts.map +1 -0
  10. package/dist/bitstream/errors.js +11 -0
  11. package/dist/bitstream/index.d.ts +7 -0
  12. package/dist/bitstream/index.d.ts.map +1 -0
  13. package/dist/bitstream/index.js +5 -0
  14. package/dist/bitstream/math.d.ts +28 -0
  15. package/dist/bitstream/math.d.ts.map +1 -0
  16. package/dist/bitstream/math.js +149 -0
  17. package/dist/bitstream/reader.d.ts +81 -0
  18. package/dist/bitstream/reader.d.ts.map +1 -0
  19. package/dist/bitstream/reader.js +400 -0
  20. package/dist/bitstream/writer.d.ts +56 -0
  21. package/dist/bitstream/writer.d.ts.map +1 -0
  22. package/dist/bitstream/writer.js +330 -0
  23. package/dist/blam/common/cache/index.d.ts +2 -0
  24. package/dist/blam/common/cache/index.d.ts.map +1 -0
  25. package/dist/blam/common/cache/index.js +1 -0
  26. package/dist/blam/common/cache/security_functions.d.ts +2 -0
  27. package/dist/blam/common/cache/security_functions.d.ts.map +1 -0
  28. package/dist/blam/common/cache/security_functions.js +19 -0
  29. package/dist/blam/common/index.d.ts +3 -0
  30. package/dist/blam/common/index.d.ts.map +1 -0
  31. package/dist/blam/common/index.js +2 -0
  32. package/dist/blam/common/memory/data_compress.d.ts +10 -0
  33. package/dist/blam/common/memory/data_compress.d.ts.map +1 -0
  34. package/dist/blam/common/memory/data_compress.js +28 -0
  35. package/dist/blam/common/memory/index.d.ts +2 -0
  36. package/dist/blam/common/memory/index.d.ts.map +1 -0
  37. package/dist/blam/common/memory/index.js +1 -0
  38. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_game_engine_custom_variant.d.ts +37 -0
  39. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_game_engine_custom_variant.d.ts.map +1 -0
  40. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_game_engine_custom_variant.js +125 -0
  41. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_game_engine_custom_variant_au1_settings.d.ts +14 -0
  42. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_game_engine_custom_variant_au1_settings.d.ts.map +1 -0
  43. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_game_engine_custom_variant_au1_settings.js +30 -0
  44. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_game_engine_default.d.ts +114 -0
  45. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_game_engine_default.d.ts.map +1 -0
  46. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_game_engine_default.js +292 -0
  47. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_game_engine_survival_variant.d.ts +70 -0
  48. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_game_engine_survival_variant.d.ts.map +1 -0
  49. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_game_engine_survival_variant.js +174 -0
  50. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_game_engine_traits.d.ts +10 -0
  51. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_game_engine_traits.d.ts.map +1 -0
  52. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_game_engine_traits.js +16 -0
  53. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_game_variant.d.ts +28 -0
  54. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_game_variant.d.ts.map +1 -0
  55. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_game_variant.js +109 -0
  56. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_player_traits.d.ts +56 -0
  57. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_player_traits.d.ts.map +1 -0
  58. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_player_traits.js +142 -0
  59. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_string_table.d.ts +27 -0
  60. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_string_table.d.ts.map +1 -0
  61. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_string_table.js +190 -0
  62. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/index.d.ts +10 -0
  63. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/index.d.ts.map +1 -0
  64. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/index.js +9 -0
  65. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/c_megalo_game_statistic.d.ts +10 -0
  66. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/c_megalo_game_statistic.d.ts.map +1 -0
  67. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/c_megalo_game_statistic.js +18 -0
  68. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/c_megalogamengine_map_permissions.d.ts +8 -0
  69. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/c_megalogamengine_map_permissions.d.ts.map +1 -0
  70. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/c_megalogamengine_map_permissions.js +18 -0
  71. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/c_object_filter.d.ts +13 -0
  72. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/c_object_filter.d.ts.map +1 -0
  73. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/c_object_filter.js +39 -0
  74. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/c_trigger.d.ts +34 -0
  75. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/c_trigger.d.ts.map +1 -0
  76. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/c_trigger.js +59 -0
  77. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/index.d.ts +14 -0
  78. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/index.d.ts.map +1 -0
  79. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/index.js +13 -0
  80. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/megalogamengine_actions.d.ts +393 -0
  81. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/megalogamengine_actions.d.ts.map +1 -0
  82. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/megalogamengine_actions.js +1590 -0
  83. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/megalogamengine_conditions.d.ts +49 -0
  84. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/megalogamengine_conditions.d.ts.map +1 -0
  85. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/megalogamengine_conditions.js +216 -0
  86. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/megalogamengine_references.d.ts +79 -0
  87. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/megalogamengine_references.d.ts.map +1 -0
  88. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/megalogamengine_references.js +496 -0
  89. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/megalogamengine_text.d.ts +26 -0
  90. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/megalogamengine_text.d.ts.map +1 -0
  91. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/megalogamengine_text.js +118 -0
  92. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/s_custom_game_engine_definition.d.ts +29 -0
  93. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/s_custom_game_engine_definition.d.ts.map +1 -0
  94. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/s_custom_game_engine_definition.js +116 -0
  95. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/s_game_engine_player_rating_parameters.d.ts +22 -0
  96. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/s_game_engine_player_rating_parameters.d.ts.map +1 -0
  97. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/s_game_engine_player_rating_parameters.js +54 -0
  98. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/s_user_defined_option.d.ts +22 -0
  99. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/s_user_defined_option.d.ts.map +1 -0
  100. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/s_user_defined_option.js +82 -0
  101. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/s_variable_metadata.d.ts +22 -0
  102. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/s_variable_metadata.d.ts.map +1 -0
  103. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/s_variable_metadata.js +85 -0
  104. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/s_variant_variable.d.ts +13 -0
  105. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/s_variant_variable.d.ts.map +1 -0
  106. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/s_variant_variable.js +75 -0
  107. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/index.d.ts +4 -0
  108. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/index.d.ts.map +1 -0
  109. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/index.js +3 -0
  110. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/saved_games/index.d.ts +2 -0
  111. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/saved_games/index.d.ts.map +1 -0
  112. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/saved_games/index.js +1 -0
  113. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/saved_games/saved_game_files.d.ts +66 -0
  114. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/saved_games/saved_game_files.d.ts.map +1 -0
  115. package/dist/blam/haloreach/v12065_11_08_24_1738_tu1actual/saved_games/saved_game_files.js +586 -0
  116. package/dist/blf_chunk.d.ts +41 -0
  117. package/dist/blf_chunk.d.ts.map +1 -0
  118. package/dist/blf_chunk.js +126 -0
  119. package/dist/blffile.d.ts +5 -0
  120. package/dist/blffile.d.ts.map +1 -0
  121. package/dist/blffile.js +23 -0
  122. package/dist/chunk_signature.d.ts +10 -0
  123. package/dist/chunk_signature.d.ts.map +1 -0
  124. package/dist/chunk_signature.js +47 -0
  125. package/dist/chunks/halo3/v12070_08_09_05_2031_halo3_ship/index.d.ts +4 -0
  126. package/dist/chunks/halo3/v12070_08_09_05_2031_halo3_ship/index.d.ts.map +1 -0
  127. package/dist/chunks/halo3/v12070_08_09_05_2031_halo3_ship/index.js +3 -0
  128. package/dist/chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_compressed_data.d.ts +21 -0
  129. package/dist/chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_compressed_data.d.ts.map +1 -0
  130. package/dist/chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_compressed_data.js +112 -0
  131. package/dist/chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_end_of_file.d.ts +7 -0
  132. package/dist/chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_end_of_file.d.ts.map +1 -0
  133. package/dist/chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_end_of_file.js +72 -0
  134. package/dist/chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_start_of_file.d.ts +13 -0
  135. package/dist/chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_start_of_file.d.ts.map +1 -0
  136. package/dist/chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_start_of_file.js +83 -0
  137. package/dist/chunks/haloreach/v12065_11_08_24_1738_tu1actual/index.d.ts +7 -0
  138. package/dist/chunks/haloreach/v12065_11_08_24_1738_tu1actual/index.d.ts.map +1 -0
  139. package/dist/chunks/haloreach/v12065_11_08_24_1738_tu1actual/index.js +6 -0
  140. package/dist/chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_author.d.ts +26 -0
  141. package/dist/chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_author.d.ts.map +1 -0
  142. package/dist/chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_author.js +109 -0
  143. package/dist/chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_compressed_data.d.ts +4 -0
  144. package/dist/chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_compressed_data.d.ts.map +1 -0
  145. package/dist/chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_compressed_data.js +3 -0
  146. package/dist/chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_content_header.d.ts +8 -0
  147. package/dist/chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_content_header.d.ts.map +1 -0
  148. package/dist/chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_content_header.js +78 -0
  149. package/dist/chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_game_variant.d.ts +24 -0
  150. package/dist/chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_game_variant.d.ts.map +1 -0
  151. package/dist/chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_game_variant.js +130 -0
  152. package/dist/chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_packed_game_variant.d.ts +15 -0
  153. package/dist/chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_packed_game_variant.d.ts.map +1 -0
  154. package/dist/chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_packed_game_variant.js +85 -0
  155. package/dist/decorators.d.ts +38 -0
  156. package/dist/decorators.d.ts.map +1 -0
  157. package/dist/decorators.js +68 -0
  158. package/dist/error.d.ts +4 -0
  159. package/dist/error.d.ts.map +1 -0
  160. package/dist/error.js +6 -0
  161. package/dist/index.d.ts +7 -0
  162. package/dist/index.d.ts.map +1 -0
  163. package/dist/index.js +6 -0
  164. package/dist/s_blf_header.d.ts +14 -0
  165. package/dist/s_blf_header.d.ts.map +1 -0
  166. package/dist/s_blf_header.js +113 -0
  167. package/dist/versions/halo3/v12070_08_09_05_2031_halo3_ship.d.ts +5 -0
  168. package/dist/versions/halo3/v12070_08_09_05_2031_halo3_ship.d.ts.map +1 -0
  169. package/dist/versions/halo3/v12070_08_09_05_2031_halo3_ship.js +4 -0
  170. package/dist/versions/halo3odst/v13895_09_04_27_2201_atlas_release.d.ts +5 -0
  171. package/dist/versions/halo3odst/v13895_09_04_27_2201_atlas_release.d.ts.map +1 -0
  172. package/dist/versions/halo3odst/v13895_09_04_27_2201_atlas_release.js +4 -0
  173. package/dist/versions/haloreach/v12065_11_08_24_1738_tu1actual.d.ts +10 -0
  174. package/dist/versions/haloreach/v12065_11_08_24_1738_tu1actual.d.ts.map +1 -0
  175. package/dist/versions/haloreach/v12065_11_08_24_1738_tu1actual.js +9 -0
  176. package/dist-cjs/bitstream/enum.js +19 -0
  177. package/dist-cjs/bitstream/enums.js +34 -0
  178. package/dist-cjs/bitstream/errors.js +16 -0
  179. package/dist-cjs/bitstream/index.js +29 -0
  180. package/dist-cjs/bitstream/math.js +167 -0
  181. package/dist-cjs/bitstream/reader.js +404 -0
  182. package/dist-cjs/bitstream/writer.js +334 -0
  183. package/dist-cjs/blam/common/cache/index.js +17 -0
  184. package/dist-cjs/blam/common/cache/security_functions.js +22 -0
  185. package/dist-cjs/blam/common/index.js +18 -0
  186. package/dist-cjs/blam/common/memory/data_compress.js +33 -0
  187. package/dist-cjs/blam/common/memory/index.js +17 -0
  188. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_game_engine_custom_variant.js +129 -0
  189. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_game_engine_custom_variant_au1_settings.js +34 -0
  190. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_game_engine_default.js +305 -0
  191. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_game_engine_survival_variant.js +182 -0
  192. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_game_engine_traits.js +20 -0
  193. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_game_variant.js +113 -0
  194. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_player_traits.js +151 -0
  195. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/c_string_table.js +195 -0
  196. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/index.js +25 -0
  197. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/c_megalo_game_statistic.js +22 -0
  198. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/c_megalogamengine_map_permissions.js +22 -0
  199. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/c_object_filter.js +43 -0
  200. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/c_trigger.js +63 -0
  201. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/index.js +29 -0
  202. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/megalogamengine_actions.js +1640 -0
  203. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/megalogamengine_conditions.js +224 -0
  204. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/megalogamengine_references.js +508 -0
  205. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/megalogamengine_text.js +124 -0
  206. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/s_custom_game_engine_definition.js +120 -0
  207. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/s_game_engine_player_rating_parameters.js +58 -0
  208. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/s_user_defined_option.js +87 -0
  209. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/s_variable_metadata.js +93 -0
  210. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/game/megalogamengine/s_variant_variable.js +79 -0
  211. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/index.js +19 -0
  212. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/saved_games/index.js +17 -0
  213. package/dist-cjs/blam/haloreach/v12065_11_08_24_1738_tu1actual/saved_games/saved_game_files.js +591 -0
  214. package/dist-cjs/blf_chunk.js +139 -0
  215. package/dist-cjs/blffile.js +26 -0
  216. package/dist-cjs/chunk_signature.js +52 -0
  217. package/dist-cjs/chunks/halo3/v12070_08_09_05_2031_halo3_ship/index.js +10 -0
  218. package/dist-cjs/chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_compressed_data.js +115 -0
  219. package/dist-cjs/chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_end_of_file.js +75 -0
  220. package/dist-cjs/chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_start_of_file.js +86 -0
  221. package/dist-cjs/chunks/haloreach/v12065_11_08_24_1738_tu1actual/index.js +23 -0
  222. package/dist-cjs/chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_author.js +115 -0
  223. package/dist-cjs/chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_compressed_data.js +10 -0
  224. package/dist-cjs/chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_content_header.js +81 -0
  225. package/dist-cjs/chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_game_variant.js +133 -0
  226. package/dist-cjs/chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_packed_game_variant.js +88 -0
  227. package/dist-cjs/decorators.js +75 -0
  228. package/dist-cjs/error.js +10 -0
  229. package/dist-cjs/index.js +53 -0
  230. package/dist-cjs/package.json +1 -0
  231. package/dist-cjs/s_blf_header.js +117 -0
  232. package/dist-cjs/versions/halo3/v12070_08_09_05_2031_halo3_ship.js +20 -0
  233. package/dist-cjs/versions/halo3odst/v13895_09_04_27_2201_atlas_release.js +20 -0
  234. package/dist-cjs/versions/haloreach/v12065_11_08_24_1738_tu1actual.js +25 -0
  235. package/package.json +99 -0
@@ -0,0 +1,14 @@
1
+ export declare function parse_blf_chunk_version(version: number | string): {
2
+ major: number;
3
+ minor: number;
4
+ };
5
+ export declare class s_blf_header {
6
+ signature: string;
7
+ chunk_length: number;
8
+ major: number;
9
+ minor: number;
10
+ static create(signature: string, chunk_length: number, major: number, minor: number): s_blf_header;
11
+ /** Build from a `major.minor` float (e.g. `1.1`). */
12
+ static from_version_float(signature: string, chunk_length: number, version: number): s_blf_header;
13
+ }
14
+ //# sourceMappingURL=s_blf_header.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s_blf_header.d.ts","sourceRoot":"","sources":["../src/s_blf_header.ts"],"names":[],"mappings":"AAIA,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;;;EAgB/D;AACD,qBACa,YAAY;IAEvB,SAAS,SAAM;IAGf,YAAY,SAAK;IAGjB,KAAK,SAAK;IAGV,KAAK,SAAK;IAEV,MAAM,CAAC,MAAM,CACX,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ,YAAY;IAmBf,qDAAqD;IACrD,MAAM,CAAC,kBAAkB,CACvB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,GACd,YAAY;CAIhB"}
@@ -0,0 +1,113 @@
1
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
2
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
3
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
4
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
5
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
6
+ var _, done = false;
7
+ for (var i = decorators.length - 1; i >= 0; i--) {
8
+ var context = {};
9
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
10
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
11
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
12
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13
+ if (kind === "accessor") {
14
+ if (result === void 0) continue;
15
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
16
+ if (_ = accept(result.get)) descriptor.get = _;
17
+ if (_ = accept(result.set)) descriptor.set = _;
18
+ if (_ = accept(result.init)) initializers.unshift(_);
19
+ }
20
+ else if (_ = accept(result)) {
21
+ if (kind === "field") initializers.unshift(_);
22
+ else descriptor[key] = _;
23
+ }
24
+ }
25
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
26
+ done = true;
27
+ };
28
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
29
+ var useValue = arguments.length > 2;
30
+ for (var i = 0; i < initializers.length; i++) {
31
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
32
+ }
33
+ return useValue ? value : void 0;
34
+ };
35
+ import { c } from "@craftycodie/cstruct";
36
+ import { chunkSignature } from "./chunk_signature";
37
+ import { BlfError } from "./error";
38
+ export function parse_blf_chunk_version(version) {
39
+ if (typeof version === "number") {
40
+ version = version.toString();
41
+ }
42
+ const [majorStr, minorStr = "0"] = version.split(".");
43
+ const major = Number.parseInt(majorStr, 10);
44
+ const minor = Number.parseInt(minorStr, 10);
45
+ if (Number.isNaN(major) || Number.isNaN(minor)) {
46
+ throw new BlfError(`BLF chunk version must be major.minor (e.g. "1.1"), got "${version}"`);
47
+ }
48
+ return { major, minor };
49
+ }
50
+ let s_blf_header = (() => {
51
+ let _classDecorators = [c.struct()];
52
+ let _classDescriptor;
53
+ let _classExtraInitializers = [];
54
+ let _classThis;
55
+ let _signature_decorators;
56
+ let _signature_initializers = [];
57
+ let _signature_extraInitializers = [];
58
+ let _chunk_length_decorators;
59
+ let _chunk_length_initializers = [];
60
+ let _chunk_length_extraInitializers = [];
61
+ let _major_decorators;
62
+ let _major_initializers = [];
63
+ let _major_extraInitializers = [];
64
+ let _minor_decorators;
65
+ let _minor_initializers = [];
66
+ let _minor_extraInitializers = [];
67
+ var s_blf_header = class {
68
+ static { _classThis = this; }
69
+ static {
70
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
71
+ _signature_decorators = [c.field(chunkSignature())];
72
+ _chunk_length_decorators = [c.field("u32")];
73
+ _major_decorators = [c.field("u16")];
74
+ _minor_decorators = [c.field("u16")];
75
+ __esDecorate(null, null, _signature_decorators, { kind: "field", name: "signature", static: false, private: false, access: { has: obj => "signature" in obj, get: obj => obj.signature, set: (obj, value) => { obj.signature = value; } }, metadata: _metadata }, _signature_initializers, _signature_extraInitializers);
76
+ __esDecorate(null, null, _chunk_length_decorators, { kind: "field", name: "chunk_length", static: false, private: false, access: { has: obj => "chunk_length" in obj, get: obj => obj.chunk_length, set: (obj, value) => { obj.chunk_length = value; } }, metadata: _metadata }, _chunk_length_initializers, _chunk_length_extraInitializers);
77
+ __esDecorate(null, null, _major_decorators, { kind: "field", name: "major", static: false, private: false, access: { has: obj => "major" in obj, get: obj => obj.major, set: (obj, value) => { obj.major = value; } }, metadata: _metadata }, _major_initializers, _major_extraInitializers);
78
+ __esDecorate(null, null, _minor_decorators, { kind: "field", name: "minor", static: false, private: false, access: { has: obj => "minor" in obj, get: obj => obj.minor, set: (obj, value) => { obj.minor = value; } }, metadata: _metadata }, _minor_initializers, _minor_extraInitializers);
79
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
80
+ s_blf_header = _classThis = _classDescriptor.value;
81
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
82
+ __runInitializers(_classThis, _classExtraInitializers);
83
+ }
84
+ signature = __runInitializers(this, _signature_initializers, "");
85
+ chunk_length = (__runInitializers(this, _signature_extraInitializers), __runInitializers(this, _chunk_length_initializers, 0));
86
+ major = (__runInitializers(this, _chunk_length_extraInitializers), __runInitializers(this, _major_initializers, 0));
87
+ minor = (__runInitializers(this, _major_extraInitializers), __runInitializers(this, _minor_initializers, 0));
88
+ static create(signature, chunk_length, major, minor) {
89
+ if (signature.length !== 4) {
90
+ throw new BlfError(`BLF chunk signature must be exactly 4 characters, got ${signature.length}: "${signature}"`);
91
+ }
92
+ if (!Number.isInteger(chunk_length) || chunk_length < 0) {
93
+ throw new BlfError(`BLF chunk length must be a non-negative integer, got ${chunk_length}`);
94
+ }
95
+ const header = new s_blf_header();
96
+ header.signature = signature;
97
+ header.chunk_length = chunk_length;
98
+ header.major = major;
99
+ header.minor = minor;
100
+ return header;
101
+ }
102
+ /** Build from a `major.minor` float (e.g. `1.1`). */
103
+ static from_version_float(signature, chunk_length, version) {
104
+ const { major, minor } = parse_blf_chunk_version(version);
105
+ return s_blf_header.create(signature, chunk_length, major, minor);
106
+ }
107
+ constructor() {
108
+ __runInitializers(this, _minor_extraInitializers);
109
+ }
110
+ };
111
+ return s_blf_header = _classThis;
112
+ })();
113
+ export { s_blf_header };
@@ -0,0 +1,5 @@
1
+ export * from "../../blam/common";
2
+ export * from "../../chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_compressed_data";
3
+ export * from "../../chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_end_of_file";
4
+ export * from "../../chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_start_of_file";
5
+ //# sourceMappingURL=v12070_08_09_05_2031_halo3_ship.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v12070_08_09_05_2031_halo3_ship.d.ts","sourceRoot":"","sources":["../../../src/versions/halo3/v12070_08_09_05_2031_halo3_ship.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,gFAAgF,CAAC;AAC/F,cAAc,4EAA4E,CAAC;AAC3F,cAAc,8EAA8E,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "../../blam/common";
2
+ export * from "../../chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_compressed_data";
3
+ export * from "../../chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_end_of_file";
4
+ export * from "../../chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_start_of_file";
@@ -0,0 +1,5 @@
1
+ export * from "../../blam/common";
2
+ export * from "../../chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_compressed_data";
3
+ export * from "../../chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_end_of_file";
4
+ export * from "../../chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_start_of_file";
5
+ //# sourceMappingURL=v13895_09_04_27_2201_atlas_release.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v13895_09_04_27_2201_atlas_release.d.ts","sourceRoot":"","sources":["../../../src/versions/halo3odst/v13895_09_04_27_2201_atlas_release.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,gFAAgF,CAAC;AAC/F,cAAc,4EAA4E,CAAC;AAC3F,cAAc,8EAA8E,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "../../blam/common";
2
+ export * from "../../chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_compressed_data";
3
+ export * from "../../chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_end_of_file";
4
+ export * from "../../chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_start_of_file";
@@ -0,0 +1,10 @@
1
+ export * from "../../blam/common";
2
+ export * from "../../blam/haloreach/v12065_11_08_24_1738_tu1actual";
3
+ export * from "../../chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_compressed_data";
4
+ export * from "../../chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_end_of_file";
5
+ export * from "../../chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_start_of_file";
6
+ export * from "../../chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_author";
7
+ export * from "../../chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_content_header";
8
+ export * from "../../chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_game_variant";
9
+ export * from "../../chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_packed_game_variant";
10
+ //# sourceMappingURL=v12065_11_08_24_1738_tu1actual.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v12065_11_08_24_1738_tu1actual.d.ts","sourceRoot":"","sources":["../../../src/versions/haloreach/v12065_11_08_24_1738_tu1actual.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,qDAAqD,CAAC;AACpE,cAAc,gFAAgF,CAAC;AAC/F,cAAc,4EAA4E,CAAC;AAC3F,cAAc,8EAA8E,CAAC;AAC7F,cAAc,0EAA0E,CAAC;AACzF,cAAc,kFAAkF,CAAC;AACjG,cAAc,gFAAgF,CAAC;AAC/F,cAAc,uFAAuF,CAAC"}
@@ -0,0 +1,9 @@
1
+ export * from "../../blam/common";
2
+ export * from "../../blam/haloreach/v12065_11_08_24_1738_tu1actual";
3
+ export * from "../../chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_compressed_data";
4
+ export * from "../../chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_end_of_file";
5
+ export * from "../../chunks/halo3/v12070_08_09_05_2031_halo3_ship/s_blf_chunk_start_of_file";
6
+ export * from "../../chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_author";
7
+ export * from "../../chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_content_header";
8
+ export * from "../../chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_game_variant";
9
+ export * from "../../chunks/haloreach/v12065_11_08_24_1738_tu1actual/s_blf_chunk_packed_game_variant";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isNumericEnumValue = isNumericEnumValue;
4
+ exports.assertFitsInBits = assertFitsInBits;
5
+ const errors_1 = require("./errors");
6
+ function isNumericEnumValue(enumObj, value) {
7
+ for (const member of Object.values(enumObj)) {
8
+ if (typeof member === "number" && member === value) {
9
+ return true;
10
+ }
11
+ }
12
+ return false;
13
+ }
14
+ function assertFitsInBits(name, value, size_in_bits) {
15
+ const max = (1 << size_in_bits) - 1;
16
+ if (value < 0 || value > max) {
17
+ throw new errors_1.BitstreamError(`Value ${value} for ${name} does not fit in ${size_in_bits} bits (max ${max})`);
18
+ }
19
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.e_bitstream_state = exports.e_bitstream_byte_fill_direction = exports.e_bitstream_byte_order = void 0;
4
+ var e_bitstream_byte_order;
5
+ (function (e_bitstream_byte_order) {
6
+ e_bitstream_byte_order[e_bitstream_byte_order["_bitstream_byte_order_little_endian"] = 0] = "_bitstream_byte_order_little_endian";
7
+ e_bitstream_byte_order[e_bitstream_byte_order["_bitstream_byte_order_big_endian"] = 1] = "_bitstream_byte_order_big_endian";
8
+ })(e_bitstream_byte_order || (exports.e_bitstream_byte_order = e_bitstream_byte_order = {}));
9
+ (function (e_bitstream_byte_order) {
10
+ function swap(order) {
11
+ switch (order) {
12
+ case e_bitstream_byte_order._bitstream_byte_order_little_endian:
13
+ return e_bitstream_byte_order._bitstream_byte_order_big_endian;
14
+ case e_bitstream_byte_order._bitstream_byte_order_big_endian:
15
+ return e_bitstream_byte_order._bitstream_byte_order_little_endian;
16
+ }
17
+ }
18
+ e_bitstream_byte_order.swap = swap;
19
+ })(e_bitstream_byte_order || (exports.e_bitstream_byte_order = e_bitstream_byte_order = {}));
20
+ var e_bitstream_byte_fill_direction;
21
+ (function (e_bitstream_byte_fill_direction) {
22
+ e_bitstream_byte_fill_direction[e_bitstream_byte_fill_direction["_bitstream_byte_fill_direction_msb_to_lsb"] = 0] = "_bitstream_byte_fill_direction_msb_to_lsb";
23
+ e_bitstream_byte_fill_direction[e_bitstream_byte_fill_direction["_bitstream_byte_fill_direction_lsb_to_msb"] = 1] = "_bitstream_byte_fill_direction_lsb_to_msb";
24
+ })(e_bitstream_byte_fill_direction || (exports.e_bitstream_byte_fill_direction = e_bitstream_byte_fill_direction = {}));
25
+ var e_bitstream_state;
26
+ (function (e_bitstream_state) {
27
+ e_bitstream_state[e_bitstream_state["_bitstream_state_initial"] = 0] = "_bitstream_state_initial";
28
+ e_bitstream_state[e_bitstream_state["_bitstream_state_writing"] = 1] = "_bitstream_state_writing";
29
+ e_bitstream_state[e_bitstream_state["_bitstream_state_write_finished"] = 2] = "_bitstream_state_write_finished";
30
+ e_bitstream_state[e_bitstream_state["_bitstream_state_reading"] = 3] = "_bitstream_state_reading";
31
+ e_bitstream_state[e_bitstream_state["_bitstream_state_read_only_for_consistency"] = 4] = "_bitstream_state_read_only_for_consistency";
32
+ e_bitstream_state[e_bitstream_state["_bitstream_state_read_finished"] = 5] = "_bitstream_state_read_finished";
33
+ e_bitstream_state[e_bitstream_state["k_bitstream_state_count"] = 6] = "k_bitstream_state_count";
34
+ })(e_bitstream_state || (exports.e_bitstream_state = e_bitstream_state = {}));
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BitstreamError = void 0;
4
+ exports.assert_ok = assert_ok;
5
+ class BitstreamError extends Error {
6
+ constructor(message) {
7
+ super(message);
8
+ this.name = "BitstreamError";
9
+ }
10
+ }
11
+ exports.BitstreamError = BitstreamError;
12
+ function assert_ok(condition, message) {
13
+ if (!condition) {
14
+ throw new BitstreamError(message ?? "assert_ok failed");
15
+ }
16
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.c_bitstream_writer = exports.c_bitstream_reader = exports.BitstreamError = exports.assert_ok = exports.e_bitstream_state = exports.e_bitstream_byte_order = exports.e_bitstream_byte_fill_direction = void 0;
18
+ var enums_1 = require("./enums");
19
+ Object.defineProperty(exports, "e_bitstream_byte_fill_direction", { enumerable: true, get: function () { return enums_1.e_bitstream_byte_fill_direction; } });
20
+ Object.defineProperty(exports, "e_bitstream_byte_order", { enumerable: true, get: function () { return enums_1.e_bitstream_byte_order; } });
21
+ Object.defineProperty(exports, "e_bitstream_state", { enumerable: true, get: function () { return enums_1.e_bitstream_state; } });
22
+ var errors_1 = require("./errors");
23
+ Object.defineProperty(exports, "assert_ok", { enumerable: true, get: function () { return errors_1.assert_ok; } });
24
+ Object.defineProperty(exports, "BitstreamError", { enumerable: true, get: function () { return errors_1.BitstreamError; } });
25
+ __exportStar(require("./math"), exports);
26
+ var reader_1 = require("./reader");
27
+ Object.defineProperty(exports, "c_bitstream_reader", { enumerable: true, get: function () { return reader_1.c_bitstream_reader; } });
28
+ var writer_1 = require("./writer");
29
+ Object.defineProperty(exports, "c_bitstream_writer", { enumerable: true, get: function () { return writer_1.c_bitstream_writer; } });
@@ -0,0 +1,167 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.global_up3d = exports.global_left3d = exports.global_forward3d = exports.k_pi = exports.k_real_epsilon = void 0;
4
+ exports.real_vector3d_default = real_vector3d_default;
5
+ exports.dot_product3d = dot_product3d;
6
+ exports.cross_product3d = cross_product3d;
7
+ exports.magnitude3d = magnitude3d;
8
+ exports.quantize_real = quantize_real;
9
+ exports.dequantize_real = dequantize_real;
10
+ exports.normalize3d = normalize3d;
11
+ exports.arctangent = arctangent;
12
+ exports.assert_valid_real_normal3d = assert_valid_real_normal3d;
13
+ exports.valid_real_vector3d_axes2 = valid_real_vector3d_axes2;
14
+ exports.valid_real_vector3d_axes3 = valid_real_vector3d_axes3;
15
+ exports.rotate_vector_about_axis = rotate_vector_about_axis;
16
+ exports.axes_compute_reference_internal = axes_compute_reference_internal;
17
+ exports.axes_to_angle_internal = axes_to_angle_internal;
18
+ exports.angle_to_axes_internal = angle_to_axes_internal;
19
+ const errors_1 = require("./errors");
20
+ exports.k_real_epsilon = 1e-6;
21
+ exports.k_pi = Math.PI;
22
+ exports.global_forward3d = { i: 0, j: 0, k: 1 };
23
+ exports.global_left3d = { i: 1, j: 0, k: 0 };
24
+ exports.global_up3d = { i: 0, j: 1, k: 0 };
25
+ function real_vector3d_default() {
26
+ return { i: 0, j: 0, k: 0 };
27
+ }
28
+ function dot_product3d(a, b) {
29
+ return a.i * b.i + a.j * b.j + a.k * b.k;
30
+ }
31
+ function cross_product3d(a, b, out) {
32
+ out.i = a.j * b.k - a.k * b.j;
33
+ out.j = a.k * b.i - a.i * b.k;
34
+ out.k = a.i * b.j - a.j * b.i;
35
+ }
36
+ function magnitude3d(v) {
37
+ return Math.sqrt(dot_product3d(v, v));
38
+ }
39
+ /** Matches blf_lib `quantize_real` for Reach bitstreams. */
40
+ function quantize_real(value, min_value, max_value, quantized_value_count, exact_midpoint, exact_endpoints) {
41
+ let adjusted_count = quantized_value_count;
42
+ if (exact_midpoint) {
43
+ adjusted_count -= 1;
44
+ }
45
+ if (exact_endpoints) {
46
+ if (value === min_value) {
47
+ return 0;
48
+ }
49
+ if (value === max_value) {
50
+ return adjusted_count - 1;
51
+ }
52
+ const divisor = adjusted_count - 2;
53
+ const step = (max_value - min_value) / divisor;
54
+ let temp = Math.floor((value - min_value) / step) + 1;
55
+ if (temp <= 1) {
56
+ temp = 1;
57
+ }
58
+ return temp > adjusted_count - 2 ? adjusted_count - 2 : temp;
59
+ }
60
+ const step = (max_value - min_value) / adjusted_count;
61
+ let result = Math.floor((value - min_value) / step);
62
+ if (result > adjusted_count - 1) {
63
+ result = adjusted_count - 1;
64
+ }
65
+ return result;
66
+ }
67
+ /** Matches blf_lib `dequantize_real` for Reach bitstreams. */
68
+ function dequantize_real(quantized, min_value, max_value, quantized_value_count, exact_midpoints, exact_endpoints) {
69
+ let value_count = quantized_value_count;
70
+ if (exact_midpoints) {
71
+ value_count -= 1;
72
+ }
73
+ if (exact_endpoints) {
74
+ if (quantized === 0) {
75
+ return min_value;
76
+ }
77
+ if (quantized === value_count - 1) {
78
+ return max_value;
79
+ }
80
+ const denom = value_count - 2;
81
+ const step = (max_value - min_value) / denom;
82
+ const fquant = quantized - 1;
83
+ return min_value + step * (fquant + 0.5);
84
+ }
85
+ const step = (max_value - min_value) / value_count;
86
+ return min_value + step * (quantized + 0.5);
87
+ }
88
+ function normalize3d(v) {
89
+ const mag = magnitude3d(v);
90
+ if (mag > exports.k_real_epsilon) {
91
+ v.i /= mag;
92
+ v.j /= mag;
93
+ v.k /= mag;
94
+ }
95
+ return mag;
96
+ }
97
+ function arctangent(y, x) {
98
+ return Math.atan2(y, x);
99
+ }
100
+ function assert_valid_real_normal3d(v) {
101
+ const mag = magnitude3d(v);
102
+ return Math.abs(mag - 1) <= exports.k_real_epsilon;
103
+ }
104
+ function valid_real_vector3d_axes2(a, b) {
105
+ return Math.abs(dot_product3d(a, b)) <= exports.k_real_epsilon;
106
+ }
107
+ function valid_real_vector3d_axes3(a, b, c) {
108
+ return (valid_real_vector3d_axes2(a, b) &&
109
+ valid_real_vector3d_axes2(a, c) &&
110
+ valid_real_vector3d_axes2(b, c));
111
+ }
112
+ function rotate_vector_about_axis(vector, axis, sine, cosine) {
113
+ const cross = { i: 0, j: 0, k: 0 };
114
+ cross_product3d(axis, vector, cross);
115
+ const dot = dot_product3d(axis, vector);
116
+ const one_minus_cosine = 1 - cosine;
117
+ vector.i =
118
+ vector.i * cosine + cross.i * sine + axis.i * dot * one_minus_cosine;
119
+ vector.j =
120
+ vector.j * cosine + cross.j * sine + axis.j * dot * one_minus_cosine;
121
+ vector.k =
122
+ vector.k * cosine + cross.k * sine + axis.k * dot * one_minus_cosine;
123
+ }
124
+ function axes_compute_reference_internal(up, forward_reference, left_reference) {
125
+ (0, errors_1.assert_ok)(assert_valid_real_normal3d(up));
126
+ const v10 = Math.abs(dot_product3d(up, exports.global_forward3d));
127
+ const v9 = Math.abs(dot_product3d(up, exports.global_left3d));
128
+ if (v10 >= v9) {
129
+ cross_product3d(exports.global_left3d, up, forward_reference);
130
+ }
131
+ else {
132
+ cross_product3d(up, exports.global_forward3d, forward_reference);
133
+ }
134
+ const forward_magnitude = normalize3d(forward_reference);
135
+ (0, errors_1.assert_ok)(forward_magnitude > exports.k_real_epsilon, "forward_magnitude>k_real_epsilon");
136
+ cross_product3d(up, forward_reference, left_reference);
137
+ const left_magnitude = normalize3d(left_reference);
138
+ (0, errors_1.assert_ok)(left_magnitude > exports.k_real_epsilon, "left_magnitude>k_real_epsilon");
139
+ (0, errors_1.assert_ok)(valid_real_vector3d_axes3(forward_reference, left_reference, up));
140
+ }
141
+ function axes_to_angle_internal(forward, up) {
142
+ const forward_reference = real_vector3d_default();
143
+ const left_reference = real_vector3d_default();
144
+ axes_compute_reference_internal(up, forward_reference, left_reference);
145
+ return arctangent(dot_product3d(left_reference, forward), dot_product3d(forward_reference, forward));
146
+ }
147
+ function angle_to_axes_internal(up, angle, forward) {
148
+ const forward_reference = real_vector3d_default();
149
+ const left_reference = real_vector3d_default();
150
+ axes_compute_reference_internal(up, forward_reference, left_reference);
151
+ forward.i = forward_reference.i;
152
+ forward.j = forward_reference.j;
153
+ forward.k = forward_reference.k;
154
+ let u;
155
+ let v;
156
+ if (angle === exports.k_pi || angle === -exports.k_pi) {
157
+ u = 0;
158
+ v = -1;
159
+ }
160
+ else {
161
+ u = Math.sin(angle);
162
+ v = Math.cos(angle);
163
+ }
164
+ rotate_vector_about_axis(forward, up, u, v);
165
+ normalize3d(forward);
166
+ (0, errors_1.assert_ok)(valid_real_vector3d_axes2(forward, up));
167
+ }