@openclaw/whatsapp 2026.9.6 → 2026.9.7

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 (354) hide show
  1. package/assets/icon.png +0 -0
  2. package/dist/.setup/{accounts-D_NGDjCx.mjs → accounts-CtRPAQCL.mjs} +3 -9
  3. package/dist/.setup/{action-runtime-DZZFamfl.mjs → action-runtime-DeVk5V7r.mjs} +2 -2
  4. package/dist/.setup/{approval-handler.runtime-C0hzmMSj.mjs → approval-handler.runtime-CjqMlPOX.mjs} +6 -26
  5. package/dist/.setup/{approval-reactions-BnXw-UZI.mjs → approval-reactions-DiOFvb1s.mjs} +8 -14
  6. package/dist/.setup/{auth-store-Dh8a3cba.mjs → auth-store-BBonwKks.mjs} +9 -33
  7. package/dist/.setup/{channel-Bg_fS2iF.mjs → channel-CJFE0kD_.mjs} +82 -154
  8. package/dist/.setup/{channel-react-action-1iBiEnq7.mjs → channel-react-action-2r_hjLZV.mjs} +4 -8
  9. package/dist/.setup/{channel.runtime-rurG-kbr.mjs → channel.runtime-C94goLw9.mjs} +4 -4
  10. package/dist/.setup/{channel.setup-C8P5q8uD.mjs → channel.setup-CfN1UfdY.mjs} +1 -1
  11. package/dist/.setup/{connection-controller-C60mU7j7.mjs → connection-controller-CHo1oRJA.mjs} +13 -63
  12. package/dist/.setup/{creds-files-Drg3usj1.mjs → creds-files-CDATZWWM.mjs} +5 -11
  13. package/dist/.setup/{directory-config-BHPoBklt.mjs → directory-config-DUiJ5d8I.mjs} +13 -14
  14. package/dist/.setup/doctor-iMwg0Vhr.mjs +222 -0
  15. package/dist/.setup/group-config-path-DZr3ucUO.mjs +40 -0
  16. package/dist/.setup/{group-session-key-D22hYMdE.mjs → group-session-key-2-mja4OF.mjs} +3 -9
  17. package/dist/.setup/{login-2dmd1TfE.mjs → login-BFlvSh9h.mjs} +9 -11
  18. package/dist/.setup/{login-qr-CgKtO_ef.mjs → login-qr-Ayb8i25J.mjs} +29 -77
  19. package/dist/.setup/{monitor-By82ehLA.mjs → monitor-CGpV2VNN.mjs} +376 -504
  20. package/dist/.setup/{question-reactions-D3Zq9Gbn.mjs → question-reactions-CPyyi5AY.mjs} +2 -2
  21. package/dist/.setup/rolldown-runtime-BBjsoOtd.mjs +27 -0
  22. package/dist/.setup/{send-C6jDmcL9.mjs → send-BGdvf5cC.mjs} +31 -80
  23. package/dist/.setup/{send-api-B4DOt2RJ.mjs → send-api-H4AkQJjT.mjs} +45 -109
  24. package/dist/.setup/{session-errors-JuazczrA.mjs → session-errors-B8UcAnZN.mjs} +1 -4
  25. package/dist/.setup/{session.runtime-DcJuO42v.mjs → session.runtime-st1konFI.mjs} +1 -1
  26. package/dist/.setup/{setup-finalize-pGqWOiFX.mjs → setup-finalize-DmPX4EaW.mjs} +32 -70
  27. package/dist/.setup/setup-plugin-api-vJlxKzca.mjs +3 -0
  28. package/dist/.setup/{setup-surface-B9CYwDPZ.mjs → setup-surface-43fj197P.mjs} +3 -3
  29. package/dist/.setup/{shared-DVgQ8kRG.mjs → shared-DgOG5Iqr.mjs} +26 -37
  30. package/dist/.setup/{socket-close-CCVSFufF.mjs → socket-close-CT__V2fz.mjs} +80 -92
  31. package/dist/.setup/{targets-runtime-RBjx3pg_.mjs → targets-runtime-DmiqXIXO.mjs} +2 -7
  32. package/dist/action-runtime-api.js +1 -1
  33. package/dist/action-runtime.runtime.js +1 -1
  34. package/dist/agent-tools-api.js +5 -12
  35. package/dist/api.js +10 -10
  36. package/dist/auth-presence.js +1 -1
  37. package/dist/channel-plugin-api.js +1 -1
  38. package/dist/contract-api.js +2 -2
  39. package/dist/directory-contract-api.js +1 -1
  40. package/dist/doctor-contract-api.js +9 -10
  41. package/dist/light-runtime-api.js +2 -2
  42. package/dist/login-qr-runtime.js +1 -1
  43. package/dist/runtime-api.js +9 -9
  44. package/dist/setup-entry.js +1 -1
  45. package/dist/setup-plugin-api.js +1 -1
  46. package/node_modules/audio-decode/LICENSE +9 -10
  47. package/node_modules/audio-decode/README.md +16 -0
  48. package/node_modules/audio-decode/audio-decode.d.ts +2 -14
  49. package/node_modules/audio-decode/audio-decode.js +4 -92
  50. package/node_modules/audio-decode/meta.js +1 -0
  51. package/node_modules/audio-decode/node_modules/{audio-buffer → @audio/decode}/LICENSE +1 -1
  52. package/node_modules/audio-decode/node_modules/@audio/decode/audio-decode.d.ts +52 -0
  53. package/node_modules/audio-decode/node_modules/@audio/decode/audio-decode.js +242 -0
  54. package/node_modules/audio-decode/node_modules/@audio/decode/meta.js +14 -0
  55. package/node_modules/audio-decode/node_modules/@audio/decode/package.json +114 -0
  56. package/node_modules/audio-decode/node_modules/@audio/decode/readme.md +191 -0
  57. package/node_modules/audio-decode/node_modules/@audio/decode/stream.d.ts +12 -0
  58. package/node_modules/audio-decode/node_modules/@audio/decode/stream.js +1 -0
  59. package/node_modules/audio-decode/node_modules/@audio/decode/test.html +52 -0
  60. package/node_modules/audio-decode/node_modules/@audio/decode-aac/LICENSE +9 -0
  61. package/node_modules/audio-decode/node_modules/@audio/decode-aac/README.md +80 -0
  62. package/node_modules/audio-decode/node_modules/@audio/decode-aac/alac.js +326 -0
  63. package/node_modules/audio-decode/node_modules/@audio/decode-aac/audio.d.ts +15 -0
  64. package/node_modules/audio-decode/node_modules/@audio/decode-aac/audio.js +10 -0
  65. package/node_modules/audio-decode/node_modules/@audio/decode-aac/decode-aac.d.ts +24 -0
  66. package/node_modules/audio-decode/node_modules/@audio/decode-aac/decode-aac.js +452 -0
  67. package/node_modules/audio-decode/node_modules/@audio/decode-aac/meta.js +81 -0
  68. package/node_modules/audio-decode/node_modules/@audio/decode-aac/package.json +63 -0
  69. package/node_modules/audio-decode/node_modules/@audio/decode-aac/src/aac.wasm.js +0 -0
  70. package/node_modules/audio-decode/node_modules/@audio/decode-ac3/LICENSE +12 -0
  71. package/node_modules/audio-decode/node_modules/@audio/decode-ac3/LICENSE.liba52 +340 -0
  72. package/node_modules/audio-decode/node_modules/@audio/decode-ac3/README.md +41 -0
  73. package/node_modules/audio-decode/node_modules/@audio/decode-ac3/audio.d.ts +15 -0
  74. package/node_modules/audio-decode/node_modules/@audio/decode-ac3/audio.js +9 -0
  75. package/node_modules/audio-decode/node_modules/@audio/decode-ac3/decode-ac3.d.ts +20 -0
  76. package/node_modules/audio-decode/node_modules/@audio/decode-ac3/decode-ac3.js +131 -0
  77. package/node_modules/audio-decode/node_modules/@audio/decode-ac3/package.json +64 -0
  78. package/node_modules/audio-decode/node_modules/@audio/decode-ac3/src/ac3.wasm.js +0 -0
  79. package/node_modules/audio-decode/node_modules/@audio/decode-aiff/LICENSE +21 -0
  80. package/node_modules/audio-decode/node_modules/@audio/decode-aiff/README.md +46 -0
  81. package/node_modules/audio-decode/node_modules/@audio/decode-aiff/audio.d.ts +15 -0
  82. package/node_modules/audio-decode/node_modules/@audio/decode-aiff/audio.js +10 -0
  83. package/node_modules/audio-decode/node_modules/@audio/decode-aiff/decode-aiff.d.ts +16 -0
  84. package/node_modules/audio-decode/node_modules/@audio/decode-aiff/decode-aiff.js +583 -0
  85. package/node_modules/audio-decode/node_modules/@audio/decode-aiff/package.json +52 -0
  86. package/node_modules/audio-decode/node_modules/@audio/decode-amr/LICENSE +191 -0
  87. package/node_modules/audio-decode/node_modules/@audio/decode-amr/README.md +65 -0
  88. package/node_modules/audio-decode/node_modules/@audio/decode-amr/audio.d.ts +15 -0
  89. package/node_modules/audio-decode/node_modules/@audio/decode-amr/audio.js +10 -0
  90. package/node_modules/audio-decode/node_modules/@audio/decode-amr/decode-amr.d.ts +16 -0
  91. package/node_modules/audio-decode/node_modules/@audio/decode-amr/decode-amr.js +150 -0
  92. package/node_modules/audio-decode/node_modules/@audio/decode-amr/package.json +58 -0
  93. package/node_modules/audio-decode/node_modules/@audio/decode-amr/src/amr.wasm.js +0 -0
  94. package/node_modules/audio-decode/node_modules/@audio/decode-avi/LICENSE +21 -0
  95. package/node_modules/audio-decode/node_modules/@audio/decode-avi/README.md +53 -0
  96. package/node_modules/audio-decode/node_modules/@audio/decode-avi/audio.d.ts +15 -0
  97. package/node_modules/audio-decode/node_modules/@audio/decode-avi/audio.js +9 -0
  98. package/node_modules/audio-decode/node_modules/@audio/decode-avi/decode-avi.d.ts +21 -0
  99. package/node_modules/audio-decode/node_modules/@audio/decode-avi/decode-avi.js +241 -0
  100. package/node_modules/audio-decode/node_modules/@audio/decode-avi/package.json +66 -0
  101. package/node_modules/audio-decode/node_modules/@audio/decode-caf/LICENSE +21 -0
  102. package/node_modules/audio-decode/node_modules/@audio/decode-caf/README.md +48 -0
  103. package/node_modules/audio-decode/node_modules/@audio/decode-caf/audio.d.ts +15 -0
  104. package/node_modules/audio-decode/node_modules/@audio/decode-caf/audio.js +10 -0
  105. package/node_modules/audio-decode/node_modules/@audio/decode-caf/decode-caf.d.ts +16 -0
  106. package/node_modules/audio-decode/node_modules/@audio/decode-caf/decode-caf.js +238 -0
  107. package/node_modules/audio-decode/node_modules/@audio/decode-caf/package.json +53 -0
  108. package/node_modules/audio-decode/node_modules/@audio/decode-dsd/LICENSE +21 -0
  109. package/node_modules/audio-decode/node_modules/@audio/decode-dsd/README.md +73 -0
  110. package/node_modules/audio-decode/node_modules/@audio/decode-dsd/audio.d.ts +21 -0
  111. package/node_modules/audio-decode/node_modules/@audio/decode-dsd/audio.js +15 -0
  112. package/node_modules/audio-decode/node_modules/@audio/decode-dsd/decode-dsd.d.ts +29 -0
  113. package/node_modules/audio-decode/node_modules/@audio/decode-dsd/decode-dsd.js +423 -0
  114. package/node_modules/audio-decode/node_modules/@audio/decode-dsd/meta.js +40 -0
  115. package/node_modules/audio-decode/node_modules/@audio/decode-dsd/package.json +64 -0
  116. package/node_modules/audio-decode/node_modules/@audio/decode-dts/LICENSE +12 -0
  117. package/node_modules/audio-decode/node_modules/@audio/decode-dts/LICENSE.libdca +339 -0
  118. package/node_modules/audio-decode/node_modules/@audio/decode-dts/README.md +41 -0
  119. package/node_modules/audio-decode/node_modules/@audio/decode-dts/audio.d.ts +15 -0
  120. package/node_modules/audio-decode/node_modules/@audio/decode-dts/audio.js +9 -0
  121. package/node_modules/audio-decode/node_modules/@audio/decode-dts/decode-dts.d.ts +20 -0
  122. package/node_modules/audio-decode/node_modules/@audio/decode-dts/decode-dts.js +139 -0
  123. package/node_modules/audio-decode/node_modules/@audio/decode-dts/package.json +64 -0
  124. package/node_modules/audio-decode/node_modules/@audio/decode-dts/src/dts.wasm.js +0 -0
  125. package/node_modules/audio-decode/node_modules/@audio/decode-eac3/LICENSE +12 -0
  126. package/node_modules/audio-decode/node_modules/@audio/decode-eac3/LICENSE.ffmpeg +502 -0
  127. package/node_modules/audio-decode/node_modules/@audio/decode-eac3/README.md +45 -0
  128. package/node_modules/audio-decode/node_modules/@audio/decode-eac3/audio.d.ts +15 -0
  129. package/node_modules/audio-decode/node_modules/@audio/decode-eac3/audio.js +9 -0
  130. package/node_modules/audio-decode/node_modules/@audio/decode-eac3/decode-eac3.d.ts +20 -0
  131. package/node_modules/audio-decode/node_modules/@audio/decode-eac3/decode-eac3.js +124 -0
  132. package/node_modules/audio-decode/node_modules/@audio/decode-eac3/package.json +68 -0
  133. package/node_modules/audio-decode/node_modules/@audio/decode-eac3/src/eac3.wasm.js +0 -0
  134. package/node_modules/audio-decode/node_modules/@audio/decode-flac/LICENSE +25 -0
  135. package/node_modules/audio-decode/node_modules/@audio/decode-flac/README.md +23 -0
  136. package/node_modules/audio-decode/node_modules/@audio/decode-flac/audio.d.ts +15 -0
  137. package/node_modules/audio-decode/node_modules/@audio/decode-flac/audio.js +10 -0
  138. package/node_modules/audio-decode/node_modules/@audio/decode-flac/decode-flac.d.ts +18 -0
  139. package/node_modules/audio-decode/node_modules/@audio/decode-flac/decode-flac.js +3172 -0
  140. package/node_modules/audio-decode/node_modules/@audio/decode-flac/meta.js +115 -0
  141. package/node_modules/audio-decode/node_modules/@audio/decode-flac/package.json +60 -0
  142. package/node_modules/audio-decode/node_modules/@audio/decode-mod/LICENSE +23 -0
  143. package/node_modules/audio-decode/node_modules/@audio/decode-mod/LICENSE.libopenmpt +25 -0
  144. package/node_modules/audio-decode/node_modules/@audio/decode-mod/README.md +86 -0
  145. package/node_modules/audio-decode/node_modules/@audio/decode-mod/audio.d.ts +20 -0
  146. package/node_modules/audio-decode/node_modules/@audio/decode-mod/audio.js +12 -0
  147. package/node_modules/audio-decode/node_modules/@audio/decode-mod/decode-mod.d.ts +58 -0
  148. package/node_modules/audio-decode/node_modules/@audio/decode-mod/decode-mod.js +148 -0
  149. package/node_modules/audio-decode/node_modules/@audio/decode-mod/package.json +68 -0
  150. package/node_modules/audio-decode/node_modules/@audio/decode-mod/src/mod.wasm.js +0 -0
  151. package/node_modules/audio-decode/node_modules/@audio/decode-mp3/LICENSE +25 -0
  152. package/node_modules/audio-decode/node_modules/@audio/decode-mp3/README.md +20 -0
  153. package/node_modules/audio-decode/node_modules/@audio/decode-mp3/audio.d.ts +15 -0
  154. package/node_modules/audio-decode/node_modules/@audio/decode-mp3/audio.js +10 -0
  155. package/node_modules/audio-decode/node_modules/@audio/decode-mp3/decode-mp3.d.ts +16 -0
  156. package/node_modules/audio-decode/node_modules/@audio/decode-mp3/decode-mp3.js +793 -0
  157. package/node_modules/audio-decode/node_modules/@audio/decode-mp3/meta.js +143 -0
  158. package/node_modules/audio-decode/node_modules/@audio/decode-mp3/package.json +60 -0
  159. package/node_modules/audio-decode/node_modules/@audio/decode-mp4/LICENSE +21 -0
  160. package/node_modules/audio-decode/node_modules/@audio/decode-mp4/README.md +58 -0
  161. package/node_modules/audio-decode/node_modules/@audio/decode-mp4/audio.d.ts +15 -0
  162. package/node_modules/audio-decode/node_modules/@audio/decode-mp4/audio.js +9 -0
  163. package/node_modules/audio-decode/node_modules/@audio/decode-mp4/decode-mp4.d.ts +21 -0
  164. package/node_modules/audio-decode/node_modules/@audio/decode-mp4/decode-mp4.js +455 -0
  165. package/node_modules/audio-decode/node_modules/@audio/decode-mp4/package.json +74 -0
  166. package/node_modules/audio-decode/node_modules/@audio/decode-mpc/LICENSE +31 -0
  167. package/node_modules/audio-decode/node_modules/@audio/decode-mpc/LICENSE.libmpcdec +31 -0
  168. package/node_modules/audio-decode/node_modules/@audio/decode-mpc/README.md +60 -0
  169. package/node_modules/audio-decode/node_modules/@audio/decode-mpc/audio.d.ts +15 -0
  170. package/node_modules/audio-decode/node_modules/@audio/decode-mpc/audio.js +9 -0
  171. package/node_modules/audio-decode/node_modules/@audio/decode-mpc/decode-mpc.d.ts +20 -0
  172. package/node_modules/audio-decode/node_modules/@audio/decode-mpc/decode-mpc.js +158 -0
  173. package/node_modules/audio-decode/node_modules/@audio/decode-mpc/package.json +64 -0
  174. package/node_modules/audio-decode/node_modules/@audio/decode-mpc/src/mpc.wasm.js +0 -0
  175. package/node_modules/audio-decode/node_modules/@audio/decode-opus/LICENSE +25 -0
  176. package/node_modules/audio-decode/node_modules/@audio/decode-opus/LICENSE.libopus +44 -0
  177. package/node_modules/audio-decode/node_modules/@audio/decode-opus/README.md +32 -0
  178. package/node_modules/audio-decode/node_modules/@audio/decode-opus/audio.d.ts +15 -0
  179. package/node_modules/audio-decode/node_modules/@audio/decode-opus/audio.js +10 -0
  180. package/node_modules/audio-decode/node_modules/@audio/decode-opus/core.d.ts +33 -0
  181. package/node_modules/audio-decode/node_modules/@audio/decode-opus/core.js +147 -0
  182. package/node_modules/audio-decode/node_modules/@audio/decode-opus/decode-opus.d.ts +18 -0
  183. package/node_modules/audio-decode/node_modules/@audio/decode-opus/decode-opus.js +1 -0
  184. package/node_modules/audio-decode/node_modules/@audio/decode-opus/meta.js +103 -0
  185. package/node_modules/audio-decode/node_modules/@audio/decode-opus/package.json +68 -0
  186. package/node_modules/audio-decode/node_modules/@audio/decode-opus/src/decode-opus.js +2 -0
  187. package/node_modules/audio-decode/node_modules/@audio/decode-opus/src/opus.wasm.js +0 -0
  188. package/node_modules/audio-decode/node_modules/@audio/decode-qoa/LICENSE +25 -0
  189. package/node_modules/audio-decode/node_modules/@audio/decode-qoa/README.md +19 -0
  190. package/node_modules/audio-decode/node_modules/@audio/decode-qoa/audio.d.ts +15 -0
  191. package/node_modules/audio-decode/node_modules/@audio/decode-qoa/audio.js +10 -0
  192. package/node_modules/audio-decode/node_modules/@audio/decode-qoa/decode-qoa.d.ts +16 -0
  193. package/node_modules/audio-decode/node_modules/@audio/decode-qoa/decode-qoa.js +275 -0
  194. package/node_modules/audio-decode/node_modules/@audio/decode-qoa/package.json +56 -0
  195. package/node_modules/audio-decode/node_modules/@audio/decode-tta/LICENSE +21 -0
  196. package/node_modules/audio-decode/node_modules/@audio/decode-tta/LICENSE.ttadec +39 -0
  197. package/node_modules/audio-decode/node_modules/@audio/decode-tta/README.md +58 -0
  198. package/node_modules/audio-decode/node_modules/@audio/decode-tta/audio.d.ts +15 -0
  199. package/node_modules/audio-decode/node_modules/@audio/decode-tta/audio.js +9 -0
  200. package/node_modules/audio-decode/node_modules/@audio/decode-tta/decode-tta.d.ts +17 -0
  201. package/node_modules/audio-decode/node_modules/@audio/decode-tta/decode-tta.js +302 -0
  202. package/node_modules/audio-decode/node_modules/@audio/decode-tta/package.json +58 -0
  203. package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/LICENSE +25 -0
  204. package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/README.md +33 -0
  205. package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/audio.d.ts +15 -0
  206. package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/audio.js +10 -0
  207. package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/decode-vorbis.d.ts +18 -0
  208. package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/decode-vorbis.js +2984 -0
  209. package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/meta.js +102 -0
  210. package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/package.json +60 -0
  211. package/node_modules/audio-decode/node_modules/@audio/decode-wav/LICENSE +21 -0
  212. package/node_modules/audio-decode/node_modules/@audio/decode-wav/README.md +23 -0
  213. package/node_modules/audio-decode/node_modules/@audio/decode-wav/audio.d.ts +15 -0
  214. package/node_modules/audio-decode/node_modules/@audio/decode-wav/audio.js +10 -0
  215. package/node_modules/audio-decode/node_modules/@audio/decode-wav/decode-wav.d.ts +8 -0
  216. package/node_modules/audio-decode/node_modules/@audio/decode-wav/decode-wav.js +256 -0
  217. package/node_modules/audio-decode/node_modules/@audio/decode-wav/meta.js +114 -0
  218. package/node_modules/audio-decode/node_modules/@audio/decode-wav/package.json +52 -0
  219. package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/LICENSE +29 -0
  220. package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/LICENSE.wavpack +25 -0
  221. package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/README.md +41 -0
  222. package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/audio.d.ts +15 -0
  223. package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/audio.js +9 -0
  224. package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/decode-wavpack.d.ts +18 -0
  225. package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/decode-wavpack.js +140 -0
  226. package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/package.json +62 -0
  227. package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/src/wavpack.wasm.js +0 -0
  228. package/node_modules/audio-decode/node_modules/@audio/decode-webm/LICENSE +21 -0
  229. package/node_modules/audio-decode/node_modules/@audio/decode-webm/LICENSE.libopus +44 -0
  230. package/node_modules/audio-decode/node_modules/@audio/decode-webm/README.md +59 -0
  231. package/node_modules/audio-decode/node_modules/@audio/decode-webm/audio.d.ts +15 -0
  232. package/node_modules/audio-decode/node_modules/@audio/decode-webm/audio.js +10 -0
  233. package/node_modules/audio-decode/node_modules/@audio/decode-webm/decode-webm.d.ts +18 -0
  234. package/node_modules/audio-decode/node_modules/@audio/decode-webm/decode-webm.js +141 -0
  235. package/node_modules/audio-decode/node_modules/@audio/decode-webm/package.json +76 -0
  236. package/node_modules/audio-decode/node_modules/@audio/decode-webm/src/opus.wasm.js +0 -0
  237. package/node_modules/audio-decode/node_modules/@audio/decode-wma/LICENSE +12 -0
  238. package/node_modules/audio-decode/node_modules/@audio/decode-wma/README.md +74 -0
  239. package/node_modules/audio-decode/node_modules/@audio/decode-wma/audio.d.ts +15 -0
  240. package/node_modules/audio-decode/node_modules/@audio/decode-wma/audio.js +10 -0
  241. package/node_modules/audio-decode/node_modules/@audio/decode-wma/decode-wma.d.ts +33 -0
  242. package/node_modules/audio-decode/node_modules/@audio/decode-wma/decode-wma.js +516 -0
  243. package/node_modules/audio-decode/node_modules/@audio/decode-wma/package.json +57 -0
  244. package/node_modules/audio-decode/node_modules/@audio/decode-wma/src/wma.wasm.js +0 -0
  245. package/node_modules/audio-decode/package.json +37 -39
  246. package/node_modules/audio-decode/stream.d.ts +2 -0
  247. package/node_modules/audio-decode/stream.js +2 -0
  248. package/node_modules/baileys/lib/Utils/messages-media.js +1 -1
  249. package/node_modules/baileys/node_modules/file-type/package.json +1 -1
  250. package/node_modules/baileys/node_modules/file-type/readme.md +2 -0
  251. package/node_modules/baileys/node_modules/file-type/source/detectors/zip.js +9 -4
  252. package/node_modules/baileys/package.json +1 -1
  253. package/node_modules/typebox/build/compile/code.mjs +1 -2
  254. package/node_modules/typebox/build/compile/validator.mjs +5 -1
  255. package/node_modules/typebox/build/format/iri.mjs +16 -9
  256. package/node_modules/typebox/build/guard/emit.mjs +2 -2
  257. package/node_modules/typebox/build/guard/guard.d.mts +7 -5
  258. package/node_modules/typebox/build/guard/guard.mjs +14 -9
  259. package/node_modules/typebox/build/guard/index.mjs +6 -0
  260. package/node_modules/typebox/build/guard/unicode/unicode.d.mts +6 -0
  261. package/node_modules/typebox/build/guard/unicode/unicode.mjs +35 -0
  262. package/node_modules/typebox/build/guard/{string.mjs → unicode/unicode_segment.mjs} +16 -19
  263. package/node_modules/typebox/build/schema/build.mjs +2 -3
  264. package/node_modules/typebox/build/schema/engine/_pathing.d.mts +1 -0
  265. package/node_modules/typebox/build/schema/engine/_pathing.mjs +11 -0
  266. package/node_modules/typebox/build/schema/engine/_refine.mjs +13 -5
  267. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +2 -1
  268. package/node_modules/typebox/build/schema/engine/dependencies.mjs +2 -1
  269. package/node_modules/typebox/build/schema/engine/dependentSchemas.mjs +2 -1
  270. package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +1 -1
  271. package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +2 -2
  272. package/node_modules/typebox/build/schema/engine/format.mjs +9 -2
  273. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +3 -2
  274. package/node_modules/typebox/build/schema/engine/properties.mjs +3 -2
  275. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -1
  276. package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +1 -1
  277. package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +2 -2
  278. package/node_modules/typebox/build/schema/engine/ref.d.mts +1 -1
  279. package/node_modules/typebox/build/schema/engine/ref.mjs +2 -2
  280. package/node_modules/typebox/build/schema/engine/schema.mjs +24 -24
  281. package/node_modules/typebox/build/schema/parse.mjs +3 -0
  282. package/node_modules/typebox/build/schema/pointer/pointer.d.mts +1 -6
  283. package/node_modules/typebox/build/schema/pointer/pointer.mjs +47 -64
  284. package/node_modules/typebox/build/system/settings/internal.d.mts +2 -0
  285. package/node_modules/typebox/build/system/settings/internal.mjs +20 -0
  286. package/node_modules/typebox/build/system/settings/settings.d.mts +11 -0
  287. package/node_modules/typebox/build/system/settings/settings.mjs +14 -0
  288. package/node_modules/typebox/build/type/extends/inference.d.mts +1 -1
  289. package/node_modules/typebox/build/type/extends/inference.mjs +15 -2
  290. package/node_modules/typebox/build/type/extends/tuple.d.mts +2 -1
  291. package/node_modules/typebox/build/type/extends/tuple.mjs +21 -1
  292. package/node_modules/typebox/build/value/parse/parse.mjs +10 -4
  293. package/node_modules/typebox/package.json +1 -1
  294. package/node_modules/typebox/readme.md +3 -1
  295. package/package.json +6 -6
  296. package/dist/.setup/doctor-BPb-SjdE.mjs +0 -65
  297. package/dist/.setup/group-config-path-BGyzT9Lg.mjs +0 -54
  298. package/dist/.setup/normalize-DdsROMMa.mjs +0 -2
  299. package/dist/.setup/rolldown-runtime-D7D4PA-g.mjs +0 -13
  300. package/dist/.setup/runtime-group-policy-DeSRFXEV.mjs +0 -11
  301. package/dist/.setup/setup-plugin-api-2wUapweU.mjs +0 -3
  302. package/dist/.setup/text-runtime-CHl0iPYe.mjs +0 -4
  303. package/node_modules/audio-decode/.eslintrc.json +0 -43
  304. package/node_modules/audio-decode/.github/workflows/test.js.yml +0 -31
  305. package/node_modules/audio-decode/.travis.yml +0 -13
  306. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/README.md +0 -293
  307. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/dist/opus-ml-decoder.min.js +0 -11646
  308. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/dist/opus-ml-decoder.min.js.map +0 -1
  309. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/index.js +0 -8
  310. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/package.json +0 -58
  311. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/src/EmscriptenWasm.js +0 -0
  312. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/src/OpusMLDecoder.js +0 -253
  313. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/src/OpusMLDecoderWebWorker.js +0 -17
  314. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/types.d.ts +0 -77
  315. package/node_modules/audio-decode/node_modules/audio-buffer/.eslintrc.json +0 -44
  316. package/node_modules/audio-decode/node_modules/audio-buffer/.github/workflows/node.js.yml +0 -31
  317. package/node_modules/audio-decode/node_modules/audio-buffer/.travis.yml +0 -7
  318. package/node_modules/audio-decode/node_modules/audio-buffer/index.js +0 -76
  319. package/node_modules/audio-decode/node_modules/audio-buffer/package.json +0 -37
  320. package/node_modules/audio-decode/node_modules/audio-buffer/readme.md +0 -56
  321. package/node_modules/audio-decode/node_modules/node-wav/README.md +0 -35
  322. package/node_modules/audio-decode/node_modules/node-wav/file.wav +0 -0
  323. package/node_modules/audio-decode/node_modules/node-wav/index.js +0 -291
  324. package/node_modules/audio-decode/node_modules/node-wav/package.json +0 -29
  325. package/node_modules/audio-decode/node_modules/node-wav/tests/file1.wav +0 -0
  326. package/node_modules/audio-decode/node_modules/node-wav/tests/test.js +0 -66
  327. package/node_modules/audio-decode/node_modules/node-wav/x.js +0 -12
  328. package/node_modules/audio-decode/node_modules/node-wav/x.json +0 -86702
  329. package/node_modules/audio-decode/node_modules/node-wav/x.js~ +0 -13
  330. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/README.md +0 -320
  331. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/dist/ogg-opus-decoder.min.js +0 -232
  332. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/dist/ogg-opus-decoder.min.js.map +0 -1
  333. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/dist/ogg-opus-decoder.opus-ml.min.js +0 -0
  334. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/dist/ogg-opus-decoder.opus-ml.min.js.map +0 -1
  335. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/index.js +0 -8
  336. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/package.json +0 -74
  337. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/src/OggOpusDecoder.js +0 -226
  338. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/src/OggOpusDecoderWebWorker.js +0 -17
  339. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/types.d.ts +0 -37
  340. package/node_modules/audio-decode/node_modules/opus-decoder/README.md +0 -265
  341. package/node_modules/audio-decode/node_modules/opus-decoder/dist/opus-decoder.min.js +0 -232
  342. package/node_modules/audio-decode/node_modules/opus-decoder/dist/opus-decoder.min.js.map +0 -1
  343. package/node_modules/audio-decode/node_modules/opus-decoder/index.js +0 -8
  344. package/node_modules/audio-decode/node_modules/opus-decoder/package.json +0 -56
  345. package/node_modules/audio-decode/node_modules/opus-decoder/src/EmscriptenWasm.js +0 -0
  346. package/node_modules/audio-decode/node_modules/opus-decoder/src/OpusDecoder.js +0 -239
  347. package/node_modules/audio-decode/node_modules/opus-decoder/src/OpusDecoderWebWorker.js +0 -17
  348. package/node_modules/audio-decode/node_modules/opus-decoder/types.d.ts +0 -74
  349. package/node_modules/audio-decode/readme.md +0 -49
  350. package/node_modules/audio-decode/tea.yaml +0 -6
  351. package/node_modules/audio-decode/test-case.js +0 -11
  352. package/node_modules/audio-decode/test.html +0 -15
  353. package/node_modules/audio-decode/test.js +0 -107
  354. /package/node_modules/typebox/build/guard/{string.d.mts → unicode/unicode_segment.d.mts} +0 -0
@@ -0,0 +1,452 @@
1
+ /**
2
+ * AAC decoder — FAAD2 compiled to WASM
3
+ * Decodes M4A (MP4/AAC) and raw ADTS streams. M4A files carrying ALAC
4
+ * (Apple Lossless) are decoded by the pure-JS ALAC decoder instead.
5
+ *
6
+ * let { channelData, sampleRate } = await decode(m4abuf)
7
+ */
8
+
9
+ import { createALAC } from './alac.js'
10
+ import createAAC from './src/aac.wasm.js'
11
+
12
+ let _modP
13
+
14
+ async function getMod() {
15
+ if (_modP) return _modP
16
+ let p = createAAC()
17
+ _modP = p
18
+ try { return await p }
19
+ catch (e) { _modP = null; throw e }
20
+ }
21
+
22
+ /**
23
+ * Whole-file decode
24
+ * @param {Uint8Array|ArrayBuffer} src
25
+ * @returns {Promise<{channelData: Float32Array[], sampleRate: number}>}
26
+ */
27
+ export default async function decode(src) {
28
+ let buf = src instanceof Uint8Array ? src : new Uint8Array(src)
29
+ let dec = await decoder()
30
+ try {
31
+ return dec.decode(buf)
32
+ } finally {
33
+ dec.free()
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Create decoder instance.
39
+ * Without options the decoder auto-detects M4A vs ADTS from the byte stream.
40
+ * With `asc` (AudioSpecificConfig) or `alac` (ALAC magic cookie) it decodes raw access
41
+ * units delivered out-of-band by a container demuxer (MP4, Matroska, AVI): each decode()
42
+ * call takes one complete frame, or an array of frames.
43
+ * @param {{ asc?: Uint8Array, alac?: Uint8Array }} [opts]
44
+ * @returns {Promise<{decode(chunk: Uint8Array | Uint8Array[]): {channelData, sampleRate}, flush(), free()}>}
45
+ */
46
+ export async function decoder(opts) {
47
+ let dec = new AACDecoder(await getMod())
48
+ if (opts?.asc) { dec._initASC(opts.asc); dec._raw = true }
49
+ else if (opts?.alac) { dec._initALAC(opts.alac); dec._raw = true }
50
+ return dec
51
+ }
52
+
53
+ const EMPTY = Object.freeze({ channelData: [], sampleRate: 0 })
54
+
55
+ class AACDecoder {
56
+ constructor(mod) {
57
+ this.m = mod
58
+ this.h = null
59
+ this.sr = 0
60
+ this.ch = 0
61
+ this.done = false
62
+ this._ptr = 0
63
+ this._cap = 0
64
+ this._left = null
65
+ this._fileOff = 0 // absolute file offset of _left[0] (M4A streaming)
66
+ this._skip = 0 // bytes to discard from incoming data (M4A streaming, when next frame is past _left)
67
+ this._m4a = null // M4A streaming iterator: { sizes, stco, stsc, idx, ci, sInC, spc, nextOff }
68
+ this._accum = null // Uint8Array[] — M4A header accumulator
69
+ this._accumLen = 0
70
+ this._alac = null // ALAC decoder when the M4A carries Apple Lossless
71
+ this._raw = false // raw access units (config given up-front)
72
+ }
73
+
74
+ decode(data) {
75
+ if (this.done) throw Error('Decoder already freed')
76
+ if (this._raw) {
77
+ let frames = (Array.isArray(data) ? data : [data]).filter(f => f?.byteLength).map(f => f instanceof Uint8Array ? f : new Uint8Array(f))
78
+ return frames.length ? this._feedFrames(frames) : EMPTY
79
+ }
80
+ if (!data || !data.byteLength) return EMPTY
81
+
82
+ let buf = data instanceof Uint8Array ? data : new Uint8Array(data)
83
+
84
+ if (this._m4a) return this._feedM4AData(buf)
85
+ if (this.h) return this._decodeADTS(buf)
86
+ // M4A: accumulating moov+mdat header, or first chunk starts with ftyp
87
+ if (this._accum || (buf.length > 8 && buf[4] === 0x66 && buf[5] === 0x74 && buf[6] === 0x79 && buf[7] === 0x70)) {
88
+ (this._accum ??= []).push(buf)
89
+ this._accumLen += buf.length
90
+ return this._tryM4AInit()
91
+ }
92
+ return this._decodeADTS(buf)
93
+ }
94
+
95
+ flush() {
96
+ this._left = null
97
+ return EMPTY
98
+ }
99
+
100
+ free() {
101
+ if (this.done) return
102
+ this.done = true
103
+ if (this.h) {
104
+ this.m._aac_close(this.h)
105
+ this.m._aac_free_buf()
106
+ this.h = null
107
+ }
108
+ if (this._ptr) {
109
+ this.m._free(this._ptr)
110
+ this._ptr = 0
111
+ this._cap = 0
112
+ }
113
+ this._accum = null; this._accumLen = 0
114
+ this._m4a = null; this._left = null; this._alac = null
115
+ this._fileOff = 0; this._skip = 0
116
+ }
117
+
118
+ _catAccum() {
119
+ if (this._accum.length === 1) return this._accum[0]
120
+ let buf = new Uint8Array(this._accumLen), off = 0
121
+ for (let c of this._accum) { buf.set(c, off); off += c.length }
122
+ return buf
123
+ }
124
+
125
+ _tryM4AInit() {
126
+ let buf = this._catAccum()
127
+ // tables are collected per trak — a second non-audio track (e.g. a QuickTime
128
+ // chapter/text track, github #48) must not clobber the audio track's tables
129
+ let traks = [], t = null, moov = false
130
+
131
+ parseBoxes(buf, 0, buf.length, (type, data) => {
132
+ if (type === 'moov') moov = true
133
+ else if (type === 'trak') traks.push(t = {})
134
+ else if (!t) return
135
+ else if (type === 'esds') t.asc = parseEsds(data)
136
+ else if (type === 'alac') t.alacCookie = data // ALAC magic cookie: version/flags(4) + ALACSpecificConfig(24)
137
+ else if (type === 'stsz') t.stsz = parseStsz(data)
138
+ else if (type === 'stco') t.stco = parseStco(data)
139
+ else if (type === 'co64') t.stco = parseCo64(data)
140
+ else if (type === 'stsc') t.stsc = parseStsc(data)
141
+ })
142
+
143
+ // the audio track: first trak with an audio config + sample tables
144
+ let { asc, alacCookie, stsz, stco, stsc } = traks.find(t => (t.asc || t.alacCookie) && t.stsz && t.stco?.length) ?? {}
145
+ if ((!asc && !alacCookie) || !stsz || !stco?.length) {
146
+ // the whole moov is here and still no AAC/ALAC track — other codecs live in @audio/decode-mp4
147
+ if (moov) throw Error('No AAC/ALAC audio track in MP4')
148
+ return EMPTY // moov/tables not ready
149
+ }
150
+
151
+ if (alacCookie) this._initALAC(alacCookie)
152
+ else this._initASC(asc)
153
+
154
+ // Streaming: walk sample tables by absolute file offset so chunk boundaries are irrelevant.
155
+ this._accum = null; this._accumLen = 0
156
+ this._m4a = { sizes: stsz, stco, stsc, idx: 0, ci: 0, sInC: 0, spc: spcAt(0, stsc), nextOff: stco[0] }
157
+ this._left = buf
158
+ this._fileOff = 0
159
+ this._skip = 0
160
+ return this._extractM4A()
161
+ }
162
+
163
+ // ALAC (Apple Lossless) — pure JS, no FAAD2. Cookie: 24-byte ALACSpecificConfig, optionally
164
+ // preceded by version/flags (MP4 `alac` box body, 28) or the whole atom (ffmpeg extradata, 36).
165
+ _initALAC(cookie) {
166
+ this._alac = createALAC(cookie.subarray(cookie.length - 24))
167
+ this.sr = this._alac.config.sampleRate
168
+ this.ch = this._alac.config.numChannels
169
+ }
170
+
171
+ // Init WASM decoder with AudioSpecificConfig
172
+ _initASC(asc) {
173
+ let m = this.m, h = m._aac_create()
174
+ let srP = m._aac_sr_ptr(), chP = m._aac_ch_ptr()
175
+ let ptr = this._alloc(asc.length)
176
+ m.HEAPU8.set(asc, ptr)
177
+ let err = m._aac_init2(h, ptr, asc.length, srP, chP)
178
+ if (err < 0) { m._aac_close(h); throw Error('AAC init failed (code ' + err + ')') }
179
+ this.sr = m.getValue(srP, 'i32')
180
+ this.ch = m.getValue(chP, 'i8')
181
+ if (!this.ch) { m._aac_close(h); throw Error('AAC init: no channels in ASC') }
182
+ this.h = h
183
+ }
184
+
185
+ _feedM4AData(buf) {
186
+ if (this._skip > 0) {
187
+ let n = Math.min(this._skip, buf.length)
188
+ this._skip -= n
189
+ this._fileOff += n
190
+ buf = buf.subarray(n)
191
+ if (!buf.length) return EMPTY
192
+ }
193
+ this._left = append(this._left, buf)
194
+ return this._extractM4A()
195
+ }
196
+
197
+ _extractM4A() {
198
+ let st = this._m4a, frames = []
199
+ while (st.idx < st.sizes.length) {
200
+ let off = st.nextOff, sz = st.sizes[st.idx]
201
+ let bufOff = off - this._fileOff
202
+ if (bufOff + sz > this._left.length) break
203
+ if (bufOff >= 0) frames.push(this._left.subarray(bufOff, bufOff + sz))
204
+ advanceM4A(st)
205
+ }
206
+
207
+ if (st.idx < st.sizes.length) {
208
+ let nextOff = st.nextOff, end = this._fileOff + this._left.length
209
+ if (nextOff >= end) {
210
+ this._skip = nextOff - end
211
+ this._fileOff = end
212
+ this._left = null
213
+ } else if (nextOff > this._fileOff) {
214
+ this._left = this._left.subarray(nextOff - this._fileOff).slice()
215
+ this._fileOff = nextOff
216
+ }
217
+ } else {
218
+ this._left = null
219
+ }
220
+
221
+ return frames.length ? this._feedFrames(frames) : EMPTY
222
+ }
223
+
224
+ _alloc(len) {
225
+ if (len > this._cap) {
226
+ if (this._ptr) this.m._free(this._ptr)
227
+ this._cap = len
228
+ this._ptr = this.m._malloc(len)
229
+ }
230
+ return this._ptr
231
+ }
232
+
233
+ _decodeADTS(buf) {
234
+ let m = this.m
235
+
236
+ if (this._left) { buf = append(this._left, buf); this._left = null }
237
+
238
+ if (!this.h) {
239
+ if (buf.length < 7) { this._left = buf.slice(); return EMPTY }
240
+ let h = m._aac_create()
241
+ let srP = m._aac_sr_ptr(), chP = m._aac_ch_ptr()
242
+ let ptr = this._alloc(buf.length)
243
+ m.HEAPU8.set(buf, ptr)
244
+ let consumed = m._aac_init(h, ptr, buf.length, srP, chP)
245
+ if (consumed < 0) { m._aac_close(h); throw Error('ADTS init failed (code ' + consumed + ')') }
246
+ this.sr = m.getValue(srP, 'i32')
247
+ this.ch = m.getValue(chP, 'i8')
248
+ if (!this.ch) {
249
+ // not enough data to detect channels — buffer for next call
250
+ m._aac_close(h)
251
+ this._left = buf.length < 8192 ? buf.slice() : null
252
+ return EMPTY
253
+ }
254
+ this.h = h
255
+ buf = buf.subarray(consumed)
256
+ }
257
+
258
+ // extract complete ADTS frames only — never feed partial data to FAAD2
259
+ let frames = [], pos = 0
260
+ while (pos + 6 < buf.length) {
261
+ if (buf[pos] !== 0xFF || (buf[pos + 1] & 0xF6) !== 0xF0) { pos++; continue }
262
+ let flen = ((buf[pos + 3] & 0x03) << 11) | (buf[pos + 4] << 3) | (buf[pos + 5] >> 5)
263
+ if (flen < 7 || pos + flen > buf.length) break
264
+ frames.push(buf.subarray(pos, pos + flen))
265
+ pos += flen
266
+ }
267
+
268
+ if (pos < buf.length) {
269
+ let left = buf.subarray(pos)
270
+ this._left = left.length < 8192 ? left.slice() : null
271
+ }
272
+
273
+ if (!frames.length) return EMPTY
274
+ return this._feedFrames(frames)
275
+ }
276
+
277
+ _feedFrames(frames) {
278
+ if (this._alac) return this._feedALAC(frames)
279
+ let m = this.m, h = this.h
280
+ let chunks = [], totalPerCh = 0, channels = this.ch, errors = 0
281
+
282
+ for (let frame of frames) {
283
+ let ptr = this._alloc(frame.length)
284
+ m.HEAPU8.set(frame, ptr)
285
+ let out = m._aac_decode(h, ptr, frame.length)
286
+ if (!out) { errors++; continue }
287
+
288
+ let n = m._aac_samples()
289
+ let sr = m._aac_samplerate()
290
+ if (sr) this.sr = sr
291
+ let ch = m._aac_channels()
292
+ if (ch) channels = ch
293
+
294
+ let spc = n / channels
295
+ chunks.push({ data: new Float32Array(m.HEAPF32.buffer, out, n).slice(), ch: channels, spc })
296
+ totalPerCh += spc
297
+ }
298
+
299
+ if (!totalPerCh) return EMPTY
300
+
301
+ let channelData = Array.from({ length: channels }, () => new Float32Array(totalPerCh))
302
+ let pos = 0
303
+ for (let { data, ch, spc } of chunks) {
304
+ for (let c = 0; c < ch; c++) {
305
+ let out = channelData[c]
306
+ for (let s = 0; s < spc; s++) out[pos + s] = data[s * ch + c]
307
+ }
308
+ pos += spc
309
+ }
310
+
311
+ return { channelData, sampleRate: this.sr, errors }
312
+ }
313
+
314
+ _feedALAC(frames) {
315
+ let channels = this.ch, parts = [], total = 0
316
+ for (let frame of frames) {
317
+ let r = this._alac.decodeFrame(frame)
318
+ parts.push(r.channelData)
319
+ total += r.numSamples
320
+ }
321
+ if (!total) return EMPTY
322
+ let channelData = Array.from({ length: channels }, () => new Float32Array(total))
323
+ let pos = 0
324
+ for (let cd of parts) {
325
+ let n = cd[0].length
326
+ for (let c = 0; c < channels; c++) channelData[c].set(cd[c], pos)
327
+ pos += n
328
+ }
329
+ return { channelData, sampleRate: this.sr }
330
+ }
331
+ }
332
+
333
+
334
+ // ===== M4A demuxer =====
335
+
336
+ function append(left, buf) {
337
+ if (!left?.length) return buf.slice()
338
+ let merged = new Uint8Array(left.length + buf.length)
339
+ merged.set(left); merged.set(buf, left.length)
340
+ return merged
341
+ }
342
+
343
+ const CONTAINERS = new Set(['moov', 'trak', 'mdia', 'minf', 'stbl', 'udta', 'meta', 'edts', 'sinf'])
344
+
345
+ function parseBoxes(buf, start, end, cb) {
346
+ let off = start
347
+ while (off < end - 8) {
348
+ let size = r32(buf, off)
349
+ let type = String.fromCharCode(buf[off + 4], buf[off + 5], buf[off + 6], buf[off + 7])
350
+
351
+ if (size === 0) size = end - off
352
+ else if (size === 1 && off + 16 <= end) {
353
+ size = r32(buf, off + 12)
354
+ if (size < 16) break
355
+ } else if (size < 8) break
356
+
357
+ // skip mdat fast — the raw frames don't interest us here
358
+ if (type === 'mdat') { off += size; continue }
359
+ // truncated non-mdat box: tables would be garbage — wait for more data
360
+ if (off + size > end) break
361
+
362
+ let bodyOff = off + 8
363
+ if (type === 'stsd') parseSampleDesc(buf, bodyOff, size - 8, cb)
364
+ else if (CONTAINERS.has(type)) {
365
+ if (type === 'trak') cb(type, null) // track boundary — tables that follow belong to this trak
366
+ parseBoxes(buf, bodyOff + (type === 'meta' ? 4 : 0), off + size, cb)
367
+ if (type === 'moov') cb(type, null) // whole moov parsed — tables are final
368
+ }
369
+ else cb(type, buf.subarray(bodyOff, off + size))
370
+
371
+ off += size
372
+ }
373
+ }
374
+
375
+ function parseSampleDesc(buf, off, len, cb) {
376
+ let entries = r32(buf, off + 4), pos = off + 8
377
+ for (let i = 0; i < entries && pos < off + len; i++) {
378
+ let eSize = r32(buf, pos)
379
+ let eType = String.fromCharCode(buf[pos + 4], buf[pos + 5], buf[pos + 6], buf[pos + 7])
380
+ // recurse into the audio sample entry so its child boxes (esds for AAC, alac cookie for ALAC) surface.
381
+ // QuickTime sound description versions: v0 = 36-byte header, v1 adds 16 bytes, v2 declares its own size.
382
+ if (eType === 'mp4a' || eType === 'alac') {
383
+ let ver = (buf[pos + 16] << 8) | buf[pos + 17]
384
+ let head = ver === 1 ? 52 : ver === 2 ? r32(buf, pos + 36) : 36
385
+ if (eSize > head) parseBoxes(buf, pos + head, pos + eSize, cb)
386
+ }
387
+ pos += eSize
388
+ }
389
+ }
390
+
391
+ function parseEsds(data) {
392
+ let off = 4
393
+ while (off < data.length - 2) {
394
+ let tag = data[off++], len = 0, b
395
+ do { b = data[off++]; len = (len << 7) | (b & 0x7f) } while (b & 0x80 && off < data.length)
396
+ if (tag === 0x03) off += 3
397
+ else if (tag === 0x04) off += 13
398
+ else if (tag === 0x05) return data.subarray(off, off + len)
399
+ else off += len
400
+ }
401
+ return null
402
+ }
403
+
404
+ function parseStsz(data) {
405
+ let sz = r32(data, 4), n = r32(data, 8)
406
+ if (sz) return Array(n).fill(sz)
407
+ let sizes = new Array(n)
408
+ for (let i = 0; i < n; i++) sizes[i] = r32(data, 12 + i * 4)
409
+ return sizes
410
+ }
411
+
412
+ function parseStco(data) {
413
+ let n = r32(data, 4), o = new Array(n)
414
+ for (let i = 0; i < n; i++) o[i] = r32(data, 8 + i * 4)
415
+ return o
416
+ }
417
+
418
+ function parseCo64(data) {
419
+ let n = r32(data, 4), o = new Array(n)
420
+ for (let i = 0; i < n; i++) o[i] = r32(data, 8 + i * 8 + 4)
421
+ return o
422
+ }
423
+
424
+ function parseStsc(data) {
425
+ let n = r32(data, 4), e = new Array(n)
426
+ for (let i = 0; i < n; i++) e[i] = { first: r32(data, 8 + i * 12), spc: r32(data, 12 + i * 12) }
427
+ return e
428
+ }
429
+
430
+ function spcAt(ci, stsc) {
431
+ if (!stsc?.length) return 1
432
+ let spc = 1, cn = ci + 1
433
+ for (let j = stsc.length - 1; j >= 0; j--)
434
+ if (cn >= stsc[j].first) { spc = stsc[j].spc; break }
435
+ return spc
436
+ }
437
+
438
+ function advanceM4A(st) {
439
+ st.nextOff += st.sizes[st.idx]
440
+ st.idx++
441
+ st.sInC++
442
+ if (st.sInC >= st.spc && st.ci + 1 < st.stco.length) {
443
+ st.ci++
444
+ st.sInC = 0
445
+ st.spc = spcAt(st.ci, st.stsc)
446
+ st.nextOff = st.stco[st.ci]
447
+ }
448
+ }
449
+
450
+ function r32(buf, off) {
451
+ return (buf[off] << 24 | buf[off + 1] << 16 | buf[off + 2] << 8 | buf[off + 3]) >>> 0
452
+ }
@@ -0,0 +1,81 @@
1
+ /**
2
+ * M4A / MP4 metadata — iTunes-style ilst tags + cover art.
3
+ * @module @audio/decode-aac/meta
4
+ *
5
+ * import { parseMeta } from '@audio/decode-aac/meta'
6
+ * let { meta, sampleRate } = parseMeta(m4aBytes)
7
+ * // meta: { title, artist, album, year, genre, track, ..., pictures, raw }
8
+ */
9
+
10
+ const TD = new TextDecoder('utf-8')
11
+ const C = String.fromCharCode(0xA9) // © prefix used by iTunes text atoms
12
+
13
+ function r32(b, o) { return (b[o] * 0x1000000) + (b[o + 1] << 16) + (b[o + 2] << 8) + b[o + 3] }
14
+ function r16(b, o) { return (b[o] << 8) | b[o + 1] }
15
+ function typ(b, o) { return String.fromCharCode(b[o], b[o + 1], b[o + 2], b[o + 3]) }
16
+
17
+ const ILST_MAP = {
18
+ [C + 'nam']: 'title', [C + 'ART']: 'artist', aART: 'albumartist', [C + 'alb']: 'album',
19
+ [C + 'day']: 'year', [C + 'gen']: 'genre', [C + 'wrt']: 'composer', [C + 'cmt']: 'comment',
20
+ [C + 'too']: 'software', cprt: 'copyright', [C + 'lyr']: 'lyrics'
21
+ }
22
+
23
+ const CONTAINERS = new Set(['moov', 'trak', 'mdia', 'minf', 'stbl', 'udta', 'meta'])
24
+
25
+ function applyTag(name, flags, payload, meta, pictures) {
26
+ if (name === 'covr') {
27
+ let mime = flags === 14 ? 'image/png' : flags === 13 ? 'image/jpeg' : 'application/octet-stream'
28
+ pictures.push({ mime, type: 3, description: '', data: payload.slice() })
29
+ return
30
+ }
31
+ if (name === 'trkn') { if (payload.length >= 4) meta.track = String(r16(payload, 2)); return }
32
+ if (name === 'disk') { if (payload.length >= 4) meta.disc = String(r16(payload, 2)); return }
33
+ if (name === 'tmpo') { if (payload.length >= 2) meta.bpm = String(r16(payload, 0)); return }
34
+ let key = ILST_MAP[name]
35
+ if (key && meta[key] == null) meta[key] = TD.decode(payload).replace(/\0+$/, '')
36
+ }
37
+
38
+ // ilst children are tag atoms; each holds a 'data' sub-atom: type(4) + flags(4) + reserved(4) + value
39
+ function parseIlst(b, start, end, meta, pictures) {
40
+ let off = start
41
+ while (off + 8 <= end) {
42
+ let size = r32(b, off); if (size < 8) break
43
+ let name = typ(b, off + 4), aEnd = Math.min(off + size, end), p = off + 8
44
+ while (p + 16 <= aEnd) {
45
+ let dsize = r32(b, p); if (dsize < 16) break
46
+ if (typ(b, p + 4) === 'data') {
47
+ let flags = r32(b, p + 8) & 0xFFFFFF
48
+ applyTag(name, flags, b.subarray(p + 16, Math.min(p + dsize, aEnd)), meta, pictures)
49
+ break
50
+ }
51
+ p += dsize
52
+ }
53
+ off += size
54
+ }
55
+ }
56
+
57
+ function walk(b, start, end, ctx) {
58
+ let off = start
59
+ while (off + 8 <= end) {
60
+ let size = r32(b, off), type = typ(b, off + 4)
61
+ if (size === 0) size = end - off
62
+ else if (size === 1) break // 64-bit box — not expected in moov metadata
63
+ if (size < 8 || off + size > end) break
64
+ let bodyOff = off + 8
65
+ if (type === 'ilst') parseIlst(b, bodyOff, off + size, ctx.meta, ctx.pictures)
66
+ else if (type === 'stsd') walk(b, bodyOff + 8, off + size, ctx) // FullBox(4) + entryCount(4)
67
+ else if ((type === 'mp4a' || type === 'alac') && !ctx.sampleRate) ctx.sampleRate = r16(b, bodyOff + 24)
68
+ else if (CONTAINERS.has(type)) walk(b, bodyOff + (type === 'meta' ? 4 : 0), off + size, ctx)
69
+ off += size
70
+ }
71
+ }
72
+
73
+ /** Parse M4A/MP4 metadata. Returns { meta, sampleRate, markers, regions } or null. */
74
+ export function parseMeta(bytes) {
75
+ let b = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)
76
+ if (b.length < 8 || typ(b, 4) !== 'ftyp') return null
77
+ let ctx = { meta: {}, pictures: [], sampleRate: 0 }
78
+ walk(b, 0, b.length, ctx)
79
+ ctx.meta.pictures = ctx.pictures
80
+ return { meta: ctx.meta, sampleRate: ctx.sampleRate, markers: [], regions: [] }
81
+ }
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@audio/decode-aac",
3
+ "version": "1.5.0",
4
+ "description": "Decode AAC/M4A (FAAD2 WASM) and ALAC/Apple Lossless (pure JS) to PCM samples",
5
+ "type": "module",
6
+ "main": "decode-aac.js",
7
+ "types": "decode-aac.d.ts",
8
+ "exports": {
9
+ ".": "./decode-aac.js",
10
+ "./meta": "./meta.js",
11
+ "./audio": {
12
+ "types": "./audio.d.ts",
13
+ "default": "./audio.js"
14
+ },
15
+ "./package.json": "./package.json"
16
+ },
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "scripts": {
21
+ "build": "bash build.sh",
22
+ "prepack": "npm run build",
23
+ "test": "node test.js"
24
+ },
25
+ "files": [
26
+ "decode-aac.js",
27
+ "alac.js",
28
+ "meta.js",
29
+ "decode-aac.d.ts",
30
+ "src/aac.wasm.js",
31
+ "LICENSE",
32
+ "audio.js",
33
+ "audio.d.ts"
34
+ ],
35
+ "keywords": [
36
+ "aac",
37
+ "m4a",
38
+ "mp4",
39
+ "audio",
40
+ "decode",
41
+ "decoder",
42
+ "wasm",
43
+ "faad2",
44
+ "alac",
45
+ "apple lossless",
46
+ "lossless"
47
+ ],
48
+ "license": "GPL-2.0",
49
+ "author": "audiojs",
50
+ "homepage": "https://github.com/audiojs/decode/tree/master/packages/decode-aac#readme",
51
+ "bugs": "https://github.com/audiojs/decode/issues",
52
+ "repository": {
53
+ "type": "git",
54
+ "url": "git+https://github.com/audiojs/decode.git",
55
+ "directory": "packages/decode-aac"
56
+ },
57
+ "engines": {
58
+ "node": ">=18"
59
+ },
60
+ "audio": "./audio.js",
61
+ "sideEffects": false,
62
+ "funding": "https://github.com/sponsors/audiojs"
63
+ }
@@ -0,0 +1,12 @@
1
+ wma-decode - WMA audio decoder
2
+ Copyright (c) 2025 audiojs
3
+
4
+ This library is free software; you can redistribute it and/or modify it
5
+ under the terms of the GNU Lesser General Public License as published by
6
+ the Free Software Foundation; either version 2.1 of the License, or (at
7
+ your option) any later version.
8
+
9
+ This library is distributed in the hope that it will be useful, but
10
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
12
+ License for more details.