taglib-wasm 2.3.0 → 2.3.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 (633) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +70 -64
  3. package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/assertClassBrand.js +7 -0
  4. package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/checkPrivateRedeclaration.js +6 -0
  5. package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/classPrivateFieldGet2.js +7 -0
  6. package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/classPrivateFieldInitSpec.js +7 -0
  7. package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/classPrivateFieldSet2.js +7 -0
  8. package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/defineProperty.js +12 -0
  9. package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/toPrimitive.js +14 -0
  10. package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/toPropertyKey.js +9 -0
  11. package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/typeof.js +11 -0
  12. package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/usingCtx.js +57 -0
  13. package/dist/_virtual/_rolldown/runtime.js +13 -0
  14. package/dist/bwf/bext.d.ts.map +1 -0
  15. package/dist/bwf/bext.js +119 -0
  16. package/dist/{src/constants → constants}/additional-properties.d.ts.map +1 -1
  17. package/dist/constants/additional-properties.js +270 -0
  18. package/dist/constants/basic-properties.d.ts.map +1 -0
  19. package/dist/constants/basic-properties.js +128 -0
  20. package/dist/constants/complex-properties.d.ts.map +1 -0
  21. package/dist/constants/complex-properties.js +1 -0
  22. package/dist/constants/format-mappings.d.ts.map +1 -0
  23. package/dist/constants/format-mappings.js +58 -0
  24. package/dist/{src/constants → constants}/general-extended-properties.d.ts.map +1 -1
  25. package/dist/constants/general-extended-properties.js +272 -0
  26. package/dist/constants/index.d.ts.map +1 -0
  27. package/dist/constants/index.js +5 -0
  28. package/dist/{src/constants → constants}/properties.d.ts +1 -1
  29. package/dist/constants/properties.d.ts.map +1 -0
  30. package/dist/constants/properties.js +105 -0
  31. package/dist/constants/property-types.d.ts.map +1 -0
  32. package/dist/constants/property-types.js +1 -0
  33. package/dist/{src/constants → constants}/specialized-properties.d.ts.map +1 -1
  34. package/dist/constants/specialized-properties.js +335 -0
  35. package/dist/{src/constants → constants}/utilities.d.ts +1 -1
  36. package/dist/constants/utilities.d.ts.map +1 -0
  37. package/dist/constants/utilities.js +50 -0
  38. package/dist/constants.d.ts.map +1 -0
  39. package/dist/constants.js +5 -0
  40. package/dist/{src/deno-compile.d.ts → deno-compile.d.ts} +4 -2
  41. package/dist/deno-compile.d.ts.map +1 -0
  42. package/dist/deno-compile.js +109 -0
  43. package/dist/disc-folder.d.ts +4 -4
  44. package/dist/disc-folder.d.ts.map +1 -1
  45. package/dist/disc-folder.js +596 -544
  46. package/dist/errors/base.d.ts.map +1 -0
  47. package/dist/errors/base.js +66 -0
  48. package/dist/errors/classes.d.ts.map +1 -0
  49. package/dist/errors/classes.js +164 -0
  50. package/dist/errors/guards.d.ts.map +1 -0
  51. package/dist/errors/guards.js +26 -0
  52. package/dist/errors/index.d.ts.map +1 -0
  53. package/dist/errors/index.js +4 -0
  54. package/dist/errors.d.ts.map +1 -0
  55. package/dist/errors.js +5 -0
  56. package/dist/file-utils/copy-and-find.d.ts.map +1 -0
  57. package/dist/file-utils/copy-and-find.js +107 -0
  58. package/dist/file-utils/export-operations.d.ts.map +1 -0
  59. package/dist/file-utils/export-operations.js +84 -0
  60. package/dist/file-utils/import-operations.d.ts.map +1 -0
  61. package/dist/file-utils/import-operations.js +109 -0
  62. package/dist/file-utils/index.d.ts.map +1 -0
  63. package/dist/file-utils/index.js +5 -0
  64. package/dist/file-utils/mime-detection.d.ts.map +1 -0
  65. package/dist/file-utils/mime-detection.js +44 -0
  66. package/dist/folder-api/album-corroborate.d.ts.map +1 -0
  67. package/dist/folder-api/album-corroborate.js +35 -0
  68. package/dist/folder-api/album-discs.d.ts.map +1 -0
  69. package/dist/folder-api/album-discs.js +119 -0
  70. package/dist/folder-api/album-grouping.d.ts.map +1 -0
  71. package/dist/folder-api/album-grouping.js +161 -0
  72. package/dist/folder-api/album-identity.d.ts.map +1 -0
  73. package/dist/folder-api/album-identity.js +165 -0
  74. package/dist/folder-api/album-types.d.ts.map +1 -0
  75. package/dist/folder-api/album-types.js +1 -0
  76. package/dist/folder-api/directory-walker.d.ts.map +1 -0
  77. package/dist/folder-api/directory-walker.js +27 -0
  78. package/dist/folder-api/file-processors.d.ts.map +1 -0
  79. package/dist/folder-api/file-processors.js +52 -0
  80. package/dist/folder-api/folder-disc.d.ts.map +1 -0
  81. package/dist/folder-api/folder-disc.js +166 -0
  82. package/dist/folder-api/folder-operations.d.ts.map +1 -0
  83. package/dist/folder-api/folder-operations.js +69 -0
  84. package/dist/folder-api/index.d.ts.map +1 -0
  85. package/dist/{src/folder-api → folder-api}/index.js +1 -8
  86. package/dist/folder-api/scan-for-albums.d.ts.map +1 -0
  87. package/dist/folder-api/scan-for-albums.js +25 -0
  88. package/dist/folder-api/scan-operations.d.ts.map +1 -0
  89. package/dist/folder-api/scan-operations.js +79 -0
  90. package/dist/folder-api/types.d.ts.map +1 -0
  91. package/dist/folder-api/types.js +21 -0
  92. package/dist/folder.d.ts +1 -1
  93. package/dist/folder.d.ts.map +1 -1
  94. package/dist/folder.js +7 -2
  95. package/dist/global.d.js +1 -0
  96. package/dist/index.browser.d.ts +29 -30
  97. package/dist/index.browser.d.ts.map +1 -1
  98. package/dist/index.browser.js +4101 -4478
  99. package/dist/index.d.ts +26 -26
  100. package/dist/index.d.ts.map +1 -1
  101. package/dist/index.js +40 -185
  102. package/dist/msgpack/decoder.d.ts.map +1 -0
  103. package/dist/msgpack/decoder.js +177 -0
  104. package/dist/msgpack/encoder.d.ts.map +1 -0
  105. package/dist/msgpack/encoder.js +211 -0
  106. package/dist/msgpack/index.d.ts.map +1 -0
  107. package/dist/msgpack/index.js +5 -0
  108. package/dist/{src/msgpack → msgpack}/types.d.ts +1 -1
  109. package/dist/msgpack/types.d.ts.map +1 -0
  110. package/dist/msgpack/types.js +13 -0
  111. package/dist/msgpack/utils.d.ts.map +1 -0
  112. package/dist/msgpack/utils.js +116 -0
  113. package/dist/rating.d.ts +1 -1
  114. package/dist/rating.d.ts.map +1 -1
  115. package/dist/rating.js +2 -2
  116. package/dist/runtime/deno-detect.d.ts.map +1 -0
  117. package/dist/runtime/deno-detect.js +12 -0
  118. package/dist/{src/runtime → runtime}/detector.d.ts +2 -0
  119. package/dist/runtime/detector.d.ts.map +1 -0
  120. package/dist/runtime/detector.js +173 -0
  121. package/dist/runtime/loader-types.d.ts.map +1 -0
  122. package/dist/runtime/loader-types.js +23 -0
  123. package/dist/runtime/module-loader-browser.d.ts.map +1 -0
  124. package/dist/runtime/module-loader-browser.js +33 -0
  125. package/dist/runtime/module-loader.d.ts.map +1 -0
  126. package/dist/runtime/module-loader.js +119 -0
  127. package/dist/runtime/platform-io.d.ts.map +1 -0
  128. package/dist/runtime/platform-io.js +153 -0
  129. package/dist/runtime/unified-loader/index.d.ts.map +1 -0
  130. package/dist/{src/runtime → runtime}/unified-loader/index.js +1 -7
  131. package/dist/runtime/unified-loader/loader.d.ts.map +1 -0
  132. package/dist/runtime/unified-loader/loader.js +64 -0
  133. package/dist/runtime/unified-loader/module-loading.d.ts.map +1 -0
  134. package/dist/runtime/unified-loader/module-loading.js +90 -0
  135. package/dist/runtime/unified-loader/module-selection.d.ts.map +1 -0
  136. package/dist/runtime/unified-loader/module-selection.js +25 -0
  137. package/dist/runtime/unified-loader/types.d.ts.map +1 -0
  138. package/dist/runtime/unified-loader/types.js +24 -0
  139. package/dist/runtime/wasi-adapter/adapter.d.ts.map +1 -0
  140. package/dist/runtime/wasi-adapter/adapter.js +114 -0
  141. package/dist/runtime/wasi-adapter/audio-properties.d.ts.map +1 -0
  142. package/dist/runtime/wasi-adapter/audio-properties.js +120 -0
  143. package/dist/runtime/wasi-adapter/file-handle.d.ts.map +1 -0
  144. package/dist/runtime/wasi-adapter/file-handle.js +181 -0
  145. package/dist/runtime/wasi-adapter/handle-state.d.ts.map +1 -0
  146. package/dist/runtime/wasi-adapter/handle-state.js +48 -0
  147. package/dist/runtime/wasi-adapter/index.d.ts.map +1 -0
  148. package/dist/{src/runtime → runtime}/wasi-adapter/index.js +1 -3
  149. package/dist/runtime/wasi-adapter/mp4-items.d.ts.map +1 -0
  150. package/dist/runtime/wasi-adapter/mp4-items.js +97 -0
  151. package/dist/runtime/wasi-adapter/path-open.d.ts.map +1 -0
  152. package/dist/runtime/wasi-adapter/path-open.js +101 -0
  153. package/dist/runtime/wasi-adapter/property-surface.d.ts.map +1 -0
  154. package/dist/runtime/wasi-adapter/property-surface.js +96 -0
  155. package/dist/runtime/wasi-adapter/structured-fields.d.ts.map +1 -0
  156. package/dist/runtime/wasi-adapter/structured-fields.js +144 -0
  157. package/dist/runtime/wasi-adapter/tag-keys.d.ts.map +1 -0
  158. package/dist/runtime/wasi-adapter/tag-keys.js +65 -0
  159. package/dist/runtime/wasi-adapter/wasm-io.d.ts.map +1 -0
  160. package/dist/runtime/wasi-adapter/wasm-io.js +154 -0
  161. package/dist/runtime/wasi-fs-deno.d.ts.map +1 -0
  162. package/dist/runtime/wasi-fs-deno.js +25 -0
  163. package/dist/runtime/wasi-fs-node.d.ts.map +1 -0
  164. package/dist/runtime/wasi-fs-node.js +58 -0
  165. package/dist/runtime/wasi-fs-provider.d.ts.map +1 -0
  166. package/dist/runtime/wasi-fs-provider.js +1 -0
  167. package/dist/runtime/wasi-host-loader.d.ts.map +1 -0
  168. package/dist/runtime/wasi-host-loader.js +101 -0
  169. package/dist/runtime/wasi-host.d.ts.map +1 -0
  170. package/dist/runtime/wasi-host.js +199 -0
  171. package/dist/runtime/wasi-memory.d.ts.map +1 -0
  172. package/dist/runtime/wasi-memory.js +179 -0
  173. package/dist/runtime/wasmer-sdk-loader/types.d.ts.map +1 -0
  174. package/dist/runtime/wasmer-sdk-loader/types.js +15 -0
  175. package/dist/simple/batch-operations.d.ts.map +1 -0
  176. package/dist/simple/batch-operations.js +245 -0
  177. package/dist/simple/checksum-operations.d.ts.map +1 -0
  178. package/dist/simple/checksum-operations.js +28 -0
  179. package/dist/simple/config.d.ts.map +1 -0
  180. package/dist/simple/config.js +17 -0
  181. package/dist/simple/index.d.ts.map +1 -0
  182. package/dist/simple/index.js +8 -0
  183. package/dist/simple/picture-operations.d.ts.map +1 -0
  184. package/dist/simple/picture-operations.js +132 -0
  185. package/dist/simple/tag-operations.d.ts.map +1 -0
  186. package/dist/simple/tag-operations.js +125 -0
  187. package/dist/simple/with-audio-file.d.ts.map +1 -0
  188. package/dist/simple/with-audio-file.js +28 -0
  189. package/dist/simple.browser.d.ts +2 -2
  190. package/dist/simple.browser.d.ts.map +1 -1
  191. package/dist/simple.browser.js +3404 -3692
  192. package/dist/simple.d.ts +1 -1
  193. package/dist/simple.d.ts.map +1 -1
  194. package/dist/simple.js +8 -2
  195. package/dist/taglib/audio-file-base.d.ts.map +1 -0
  196. package/dist/taglib/audio-file-base.js +166 -0
  197. package/dist/taglib/audio-file-bwf.d.ts.map +1 -0
  198. package/dist/taglib/audio-file-bwf.js +33 -0
  199. package/dist/taglib/audio-file-checksum.d.ts.map +1 -0
  200. package/dist/taglib/audio-file-checksum.js +90 -0
  201. package/dist/taglib/audio-file-impl.d.ts.map +1 -0
  202. package/dist/taglib/audio-file-impl.js +234 -0
  203. package/dist/taglib/audio-file-interface.d.ts.map +1 -0
  204. package/dist/taglib/audio-file-interface.js +1 -0
  205. package/dist/taglib/auto-dispose.d.ts.map +1 -0
  206. package/dist/taglib/auto-dispose.js +34 -0
  207. package/dist/taglib/embind-adapter.d.ts.map +1 -0
  208. package/dist/taglib/embind-adapter.js +137 -0
  209. package/dist/taglib/extra-state-registry.d.ts.map +1 -0
  210. package/dist/taglib/extra-state-registry.js +72 -0
  211. package/dist/{src/taglib → taglib}/id3v2-frames.d.ts +0 -1
  212. package/dist/taglib/id3v2-frames.d.ts.map +1 -0
  213. package/dist/taglib/id3v2-frames.js +25 -0
  214. package/dist/taglib/index.d.ts.map +1 -0
  215. package/dist/taglib/index.js +7 -0
  216. package/dist/taglib/load-audio-data.d.ts.map +1 -0
  217. package/dist/taglib/load-audio-data.js +54 -0
  218. package/dist/taglib/media-ranges.d.ts.map +1 -0
  219. package/dist/taglib/media-ranges.js +309 -0
  220. package/dist/taglib/metadata-extent.d.ts.map +1 -0
  221. package/dist/taglib/metadata-extent.js +394 -0
  222. package/dist/taglib/mp4-item-names.d.ts.map +1 -0
  223. package/dist/taglib/mp4-item-names.js +14 -0
  224. package/dist/taglib/mutable-tag-impl.d.ts.map +1 -0
  225. package/dist/taglib/mutable-tag-impl.js +81 -0
  226. package/dist/taglib/mutable-tag.d.ts.map +1 -0
  227. package/dist/taglib/mutable-tag.js +1 -0
  228. package/dist/taglib/save-reconstruct.d.ts.map +1 -0
  229. package/dist/taglib/save-reconstruct.js +53 -0
  230. package/dist/taglib/taglib-class.d.ts.map +1 -0
  231. package/dist/taglib/taglib-class.js +146 -0
  232. package/dist/taglib-wrapper.js +1 -1
  233. package/dist/taglib.d.ts.map +1 -0
  234. package/dist/taglib.js +7 -0
  235. package/dist/types/audio-formats.d.ts.map +1 -0
  236. package/dist/types/audio-formats.js +6 -0
  237. package/dist/types/bwf.d.ts.map +1 -0
  238. package/dist/types/bwf.js +1 -0
  239. package/dist/types/chapters.d.ts.map +1 -0
  240. package/dist/types/chapters.js +1 -0
  241. package/dist/types/config.d.ts.map +1 -0
  242. package/dist/types/config.js +1 -0
  243. package/dist/types/format-property-keys.d.ts.map +1 -0
  244. package/dist/types/format-property-keys.js +1 -0
  245. package/dist/types/index.d.ts.map +1 -0
  246. package/dist/types/index.js +9 -0
  247. package/dist/types/metadata-mappings.d.ts.map +1 -0
  248. package/dist/types/metadata-mappings.js +323 -0
  249. package/dist/types/pictures.d.ts.map +1 -0
  250. package/dist/types/pictures.js +79 -0
  251. package/dist/types/tags.d.ts.map +1 -0
  252. package/dist/types/tags.js +1 -0
  253. package/dist/types.d.ts.map +1 -0
  254. package/dist/types.js +5 -0
  255. package/dist/utils/file.d.ts.map +1 -0
  256. package/dist/utils/file.js +43 -0
  257. package/dist/utils/mirror-fields.d.ts.map +1 -0
  258. package/dist/utils/mirror-fields.js +107 -0
  259. package/dist/utils/node-fs.d.ts.map +1 -0
  260. package/dist/utils/node-fs.js +36 -0
  261. package/dist/utils/path.d.ts.map +1 -0
  262. package/dist/utils/path.js +52 -0
  263. package/dist/utils/rating.d.ts.map +1 -0
  264. package/dist/utils/rating.js +150 -0
  265. package/dist/utils/tag-mapping.d.ts.map +1 -0
  266. package/dist/utils/tag-mapping.js +207 -0
  267. package/dist/utils/write.d.ts.map +1 -0
  268. package/dist/utils/write.js +18 -0
  269. package/dist/version.d.ts +2 -0
  270. package/dist/version.d.ts.map +1 -0
  271. package/dist/version.js +4 -0
  272. package/dist/wasm.d.ts.map +1 -0
  273. package/dist/wasm.js +1 -0
  274. package/dist/web-utils/canvas.d.ts.map +1 -0
  275. package/dist/web-utils/canvas.js +97 -0
  276. package/dist/web-utils/data-url.d.ts.map +1 -0
  277. package/dist/web-utils/data-url.js +54 -0
  278. package/dist/web-utils/dom-integration.d.ts.map +1 -0
  279. package/dist/web-utils/dom-integration.js +105 -0
  280. package/dist/web-utils/index.d.ts.map +1 -0
  281. package/dist/web-utils/index.js +4 -0
  282. package/dist/web.browser.d.ts +5 -5
  283. package/dist/web.browser.d.ts.map +1 -1
  284. package/dist/web.browser.js +3168 -3411
  285. package/dist/web.d.ts +1 -1
  286. package/dist/web.d.ts.map +1 -1
  287. package/dist/web.js +5 -2
  288. package/package.json +131 -96
  289. package/dist/src/bwf/bext.d.ts.map +0 -1
  290. package/dist/src/bwf/bext.js +0 -126
  291. package/dist/src/constants/additional-properties.js +0 -204
  292. package/dist/src/constants/basic-properties.d.ts.map +0 -1
  293. package/dist/src/constants/basic-properties.js +0 -89
  294. package/dist/src/constants/complex-properties.d.ts.map +0 -1
  295. package/dist/src/constants/complex-properties.js +0 -0
  296. package/dist/src/constants/format-mappings.d.ts.map +0 -1
  297. package/dist/src/constants/format-mappings.js +0 -54
  298. package/dist/src/constants/general-extended-properties.js +0 -254
  299. package/dist/src/constants/index.d.ts.map +0 -1
  300. package/dist/src/constants/index.js +0 -4
  301. package/dist/src/constants/properties.d.ts.map +0 -1
  302. package/dist/src/constants/properties.js +0 -95
  303. package/dist/src/constants/property-types.d.ts.map +0 -1
  304. package/dist/src/constants/property-types.js +0 -0
  305. package/dist/src/constants/specialized-properties.js +0 -223
  306. package/dist/src/constants/utilities.d.ts.map +0 -1
  307. package/dist/src/constants/utilities.js +0 -33
  308. package/dist/src/constants.d.ts.map +0 -1
  309. package/dist/src/constants.js +0 -1
  310. package/dist/src/deno-compile.d.ts.map +0 -1
  311. package/dist/src/deno-compile.js +0 -75
  312. package/dist/src/errors/base.d.ts.map +0 -1
  313. package/dist/src/errors/base.js +0 -49
  314. package/dist/src/errors/classes.d.ts.map +0 -1
  315. package/dist/src/errors/classes.js +0 -170
  316. package/dist/src/errors/guards.d.ts.map +0 -1
  317. package/dist/src/errors/guards.js +0 -39
  318. package/dist/src/errors/index.d.ts.map +0 -1
  319. package/dist/src/errors/index.js +0 -39
  320. package/dist/src/errors.d.ts.map +0 -1
  321. package/dist/src/errors.js +0 -1
  322. package/dist/src/file-utils/copy-and-find.d.ts.map +0 -1
  323. package/dist/src/file-utils/copy-and-find.js +0 -89
  324. package/dist/src/file-utils/export-operations.d.ts.map +0 -1
  325. package/dist/src/file-utils/export-operations.js +0 -40
  326. package/dist/src/file-utils/import-operations.d.ts.map +0 -1
  327. package/dist/src/file-utils/import-operations.js +0 -42
  328. package/dist/src/file-utils/index.d.ts.map +0 -1
  329. package/dist/src/file-utils/index.js +0 -26
  330. package/dist/src/file-utils/mime-detection.d.ts.map +0 -1
  331. package/dist/src/file-utils/mime-detection.js +0 -45
  332. package/dist/src/folder-api/album-corroborate.d.ts.map +0 -1
  333. package/dist/src/folder-api/album-corroborate.js +0 -36
  334. package/dist/src/folder-api/album-discs.d.ts.map +0 -1
  335. package/dist/src/folder-api/album-discs.js +0 -122
  336. package/dist/src/folder-api/album-grouping.d.ts.map +0 -1
  337. package/dist/src/folder-api/album-grouping.js +0 -118
  338. package/dist/src/folder-api/album-identity.d.ts.map +0 -1
  339. package/dist/src/folder-api/album-identity.js +0 -151
  340. package/dist/src/folder-api/album-types.d.ts.map +0 -1
  341. package/dist/src/folder-api/album-types.js +0 -0
  342. package/dist/src/folder-api/directory-walker.d.ts.map +0 -1
  343. package/dist/src/folder-api/directory-walker.js +0 -35
  344. package/dist/src/folder-api/file-processors.d.ts.map +0 -1
  345. package/dist/src/folder-api/file-processors.js +0 -63
  346. package/dist/src/folder-api/folder-disc.d.ts.map +0 -1
  347. package/dist/src/folder-api/folder-disc.js +0 -169
  348. package/dist/src/folder-api/folder-operations.d.ts.map +0 -1
  349. package/dist/src/folder-api/folder-operations.js +0 -54
  350. package/dist/src/folder-api/index.d.ts.map +0 -1
  351. package/dist/src/folder-api/scan-for-albums.d.ts.map +0 -1
  352. package/dist/src/folder-api/scan-for-albums.js +0 -20
  353. package/dist/src/folder-api/scan-operations.d.ts.map +0 -1
  354. package/dist/src/folder-api/scan-operations.js +0 -77
  355. package/dist/src/folder-api/types.d.ts.map +0 -1
  356. package/dist/src/folder-api/types.js +0 -21
  357. package/dist/src/msgpack/decoder.d.ts.map +0 -1
  358. package/dist/src/msgpack/decoder.js +0 -215
  359. package/dist/src/msgpack/encoder.d.ts.map +0 -1
  360. package/dist/src/msgpack/encoder.js +0 -249
  361. package/dist/src/msgpack/index.d.ts.map +0 -1
  362. package/dist/src/msgpack/index.js +0 -56
  363. package/dist/src/msgpack/types.d.ts.map +0 -1
  364. package/dist/src/msgpack/types.js +0 -12
  365. package/dist/src/msgpack/utils.d.ts.map +0 -1
  366. package/dist/src/msgpack/utils.js +0 -134
  367. package/dist/src/runtime/deno-detect.d.ts.map +0 -1
  368. package/dist/src/runtime/deno-detect.js +0 -6
  369. package/dist/src/runtime/detector.d.ts.map +0 -1
  370. package/dist/src/runtime/detector.js +0 -181
  371. package/dist/src/runtime/loader-types.d.ts.map +0 -1
  372. package/dist/src/runtime/loader-types.js +0 -10
  373. package/dist/src/runtime/module-loader-browser.d.ts.map +0 -1
  374. package/dist/src/runtime/module-loader-browser.js +0 -37
  375. package/dist/src/runtime/module-loader.d.ts.map +0 -1
  376. package/dist/src/runtime/module-loader.js +0 -119
  377. package/dist/src/runtime/platform-io.d.ts.map +0 -1
  378. package/dist/src/runtime/platform-io.js +0 -188
  379. package/dist/src/runtime/unified-loader/index.d.ts.map +0 -1
  380. package/dist/src/runtime/unified-loader/loader.d.ts.map +0 -1
  381. package/dist/src/runtime/unified-loader/loader.js +0 -84
  382. package/dist/src/runtime/unified-loader/module-loading.d.ts.map +0 -1
  383. package/dist/src/runtime/unified-loader/module-loading.js +0 -122
  384. package/dist/src/runtime/unified-loader/module-selection.d.ts.map +0 -1
  385. package/dist/src/runtime/unified-loader/module-selection.js +0 -41
  386. package/dist/src/runtime/unified-loader/types.d.ts.map +0 -1
  387. package/dist/src/runtime/unified-loader/types.js +0 -25
  388. package/dist/src/runtime/wasi-adapter/adapter.d.ts.map +0 -1
  389. package/dist/src/runtime/wasi-adapter/adapter.js +0 -130
  390. package/dist/src/runtime/wasi-adapter/audio-properties.d.ts.map +0 -1
  391. package/dist/src/runtime/wasi-adapter/audio-properties.js +0 -102
  392. package/dist/src/runtime/wasi-adapter/file-handle.d.ts.map +0 -1
  393. package/dist/src/runtime/wasi-adapter/file-handle.js +0 -197
  394. package/dist/src/runtime/wasi-adapter/handle-state.d.ts.map +0 -1
  395. package/dist/src/runtime/wasi-adapter/handle-state.js +0 -58
  396. package/dist/src/runtime/wasi-adapter/index.d.ts.map +0 -1
  397. package/dist/src/runtime/wasi-adapter/mp4-items.d.ts.map +0 -1
  398. package/dist/src/runtime/wasi-adapter/mp4-items.js +0 -80
  399. package/dist/src/runtime/wasi-adapter/path-open.d.ts.map +0 -1
  400. package/dist/src/runtime/wasi-adapter/path-open.js +0 -76
  401. package/dist/src/runtime/wasi-adapter/property-surface.d.ts.map +0 -1
  402. package/dist/src/runtime/wasi-adapter/property-surface.js +0 -104
  403. package/dist/src/runtime/wasi-adapter/structured-fields.d.ts.map +0 -1
  404. package/dist/src/runtime/wasi-adapter/structured-fields.js +0 -139
  405. package/dist/src/runtime/wasi-adapter/tag-keys.d.ts.map +0 -1
  406. package/dist/src/runtime/wasi-adapter/tag-keys.js +0 -46
  407. package/dist/src/runtime/wasi-adapter/wasm-io.d.ts.map +0 -1
  408. package/dist/src/runtime/wasi-adapter/wasm-io.js +0 -257
  409. package/dist/src/runtime/wasi-fs-deno.d.ts.map +0 -1
  410. package/dist/src/runtime/wasi-fs-deno.js +0 -26
  411. package/dist/src/runtime/wasi-fs-node.d.ts.map +0 -1
  412. package/dist/src/runtime/wasi-fs-node.js +0 -66
  413. package/dist/src/runtime/wasi-fs-provider.d.ts.map +0 -1
  414. package/dist/src/runtime/wasi-fs-provider.js +0 -0
  415. package/dist/src/runtime/wasi-host-loader.d.ts.map +0 -1
  416. package/dist/src/runtime/wasi-host-loader.js +0 -114
  417. package/dist/src/runtime/wasi-host.d.ts.map +0 -1
  418. package/dist/src/runtime/wasi-host.js +0 -202
  419. package/dist/src/runtime/wasi-memory.d.ts.map +0 -1
  420. package/dist/src/runtime/wasi-memory.js +0 -197
  421. package/dist/src/runtime/wasmer-sdk-loader/types.d.ts.map +0 -1
  422. package/dist/src/runtime/wasmer-sdk-loader/types.js +0 -12
  423. package/dist/src/simple/batch-operations.d.ts.map +0 -1
  424. package/dist/src/simple/batch-operations.js +0 -186
  425. package/dist/src/simple/checksum-operations.d.ts.map +0 -1
  426. package/dist/src/simple/checksum-operations.js +0 -7
  427. package/dist/src/simple/config.d.ts.map +0 -1
  428. package/dist/src/simple/config.js +0 -18
  429. package/dist/src/simple/index.d.ts.map +0 -1
  430. package/dist/src/simple/index.js +0 -60
  431. package/dist/src/simple/picture-operations.d.ts.map +0 -1
  432. package/dist/src/simple/picture-operations.js +0 -68
  433. package/dist/src/simple/tag-operations.d.ts.map +0 -1
  434. package/dist/src/simple/tag-operations.js +0 -90
  435. package/dist/src/simple/with-audio-file.d.ts.map +0 -1
  436. package/dist/src/simple/with-audio-file.js +0 -39
  437. package/dist/src/taglib/audio-file-base.d.ts.map +0 -1
  438. package/dist/src/taglib/audio-file-base.js +0 -187
  439. package/dist/src/taglib/audio-file-bwf.d.ts.map +0 -1
  440. package/dist/src/taglib/audio-file-bwf.js +0 -41
  441. package/dist/src/taglib/audio-file-checksum.d.ts.map +0 -1
  442. package/dist/src/taglib/audio-file-checksum.js +0 -77
  443. package/dist/src/taglib/audio-file-impl.d.ts.map +0 -1
  444. package/dist/src/taglib/audio-file-impl.js +0 -317
  445. package/dist/src/taglib/audio-file-interface.d.ts.map +0 -1
  446. package/dist/src/taglib/audio-file-interface.js +0 -0
  447. package/dist/src/taglib/auto-dispose.d.ts.map +0 -1
  448. package/dist/src/taglib/auto-dispose.js +0 -13
  449. package/dist/src/taglib/embind-adapter.d.ts.map +0 -1
  450. package/dist/src/taglib/embind-adapter.js +0 -141
  451. package/dist/src/taglib/extra-state-registry.d.ts.map +0 -1
  452. package/dist/src/taglib/extra-state-registry.js +0 -78
  453. package/dist/src/taglib/id3v2-frames.d.ts.map +0 -1
  454. package/dist/src/taglib/id3v2-frames.js +0 -42
  455. package/dist/src/taglib/index.d.ts.map +0 -1
  456. package/dist/src/taglib/index.js +0 -41
  457. package/dist/src/taglib/load-audio-data.d.ts.map +0 -1
  458. package/dist/src/taglib/load-audio-data.js +0 -51
  459. package/dist/src/taglib/media-ranges.d.ts.map +0 -1
  460. package/dist/src/taglib/media-ranges.js +0 -192
  461. package/dist/src/taglib/metadata-extent.d.ts.map +0 -1
  462. package/dist/src/taglib/metadata-extent.js +0 -189
  463. package/dist/src/taglib/mp4-item-names.d.ts.map +0 -1
  464. package/dist/src/taglib/mp4-item-names.js +0 -4
  465. package/dist/src/taglib/mutable-tag-impl.d.ts.map +0 -1
  466. package/dist/src/taglib/mutable-tag-impl.js +0 -88
  467. package/dist/src/taglib/mutable-tag.d.ts.map +0 -1
  468. package/dist/src/taglib/mutable-tag.js +0 -0
  469. package/dist/src/taglib/save-reconstruct.d.ts.map +0 -1
  470. package/dist/src/taglib/save-reconstruct.js +0 -43
  471. package/dist/src/taglib/taglib-class.d.ts.map +0 -1
  472. package/dist/src/taglib/taglib-class.js +0 -195
  473. package/dist/src/taglib.d.ts.map +0 -1
  474. package/dist/src/taglib.js +0 -1
  475. package/dist/src/types/audio-formats.d.ts.map +0 -1
  476. package/dist/src/types/audio-formats.js +0 -6
  477. package/dist/src/types/bwf.d.ts.map +0 -1
  478. package/dist/src/types/bwf.js +0 -0
  479. package/dist/src/types/chapters.d.ts.map +0 -1
  480. package/dist/src/types/chapters.js +0 -0
  481. package/dist/src/types/config.d.ts.map +0 -1
  482. package/dist/src/types/config.js +0 -0
  483. package/dist/src/types/format-property-keys.d.ts.map +0 -1
  484. package/dist/src/types/format-property-keys.js +0 -0
  485. package/dist/src/types/index.d.ts.map +0 -1
  486. package/dist/src/types/index.js +0 -8
  487. package/dist/src/types/metadata-mappings.d.ts.map +0 -1
  488. package/dist/src/types/metadata-mappings.js +0 -252
  489. package/dist/src/types/pictures.d.ts.map +0 -1
  490. package/dist/src/types/pictures.js +0 -64
  491. package/dist/src/types/tags.d.ts.map +0 -1
  492. package/dist/src/types/tags.js +0 -0
  493. package/dist/src/types.d.ts.map +0 -1
  494. package/dist/src/types.js +0 -1
  495. package/dist/src/utils/file.d.ts.map +0 -1
  496. package/dist/src/utils/file.js +0 -52
  497. package/dist/src/utils/mirror-fields.d.ts.map +0 -1
  498. package/dist/src/utils/mirror-fields.js +0 -75
  499. package/dist/src/utils/node-fs.d.ts.map +0 -1
  500. package/dist/src/utils/node-fs.js +0 -22
  501. package/dist/src/utils/path.d.ts.map +0 -1
  502. package/dist/src/utils/path.js +0 -36
  503. package/dist/src/utils/rating.d.ts.map +0 -1
  504. package/dist/src/utils/rating.js +0 -73
  505. package/dist/src/utils/tag-mapping.d.ts.map +0 -1
  506. package/dist/src/utils/tag-mapping.js +0 -214
  507. package/dist/src/utils/write.d.ts.map +0 -1
  508. package/dist/src/utils/write.js +0 -17
  509. package/dist/src/version.d.ts +0 -2
  510. package/dist/src/version.d.ts.map +0 -1
  511. package/dist/src/version.js +0 -4
  512. package/dist/src/wasm.d.ts.map +0 -1
  513. package/dist/src/wasm.js +0 -0
  514. package/dist/src/web-utils/canvas.d.ts.map +0 -1
  515. package/dist/src/web-utils/canvas.js +0 -60
  516. package/dist/src/web-utils/data-url.d.ts.map +0 -1
  517. package/dist/src/web-utils/data-url.js +0 -34
  518. package/dist/src/web-utils/dom-integration.d.ts.map +0 -1
  519. package/dist/src/web-utils/dom-integration.js +0 -53
  520. package/dist/src/web-utils/index.d.ts.map +0 -1
  521. package/dist/src/web-utils/index.js +0 -21
  522. /package/dist/{src/bwf → bwf}/bext.d.ts +0 -0
  523. /package/dist/{src/constants → constants}/additional-properties.d.ts +0 -0
  524. /package/dist/{src/constants → constants}/basic-properties.d.ts +0 -0
  525. /package/dist/{src/constants → constants}/complex-properties.d.ts +0 -0
  526. /package/dist/{src/constants → constants}/format-mappings.d.ts +0 -0
  527. /package/dist/{src/constants → constants}/general-extended-properties.d.ts +0 -0
  528. /package/dist/{src/constants → constants}/index.d.ts +0 -0
  529. /package/dist/{src/constants → constants}/property-types.d.ts +0 -0
  530. /package/dist/{src/constants → constants}/specialized-properties.d.ts +0 -0
  531. /package/dist/{src/constants.d.ts → constants.d.ts} +0 -0
  532. /package/dist/{src/errors → errors}/base.d.ts +0 -0
  533. /package/dist/{src/errors → errors}/classes.d.ts +0 -0
  534. /package/dist/{src/errors → errors}/guards.d.ts +0 -0
  535. /package/dist/{src/errors → errors}/index.d.ts +0 -0
  536. /package/dist/{src/errors.d.ts → errors.d.ts} +0 -0
  537. /package/dist/{src/file-utils → file-utils}/copy-and-find.d.ts +0 -0
  538. /package/dist/{src/file-utils → file-utils}/export-operations.d.ts +0 -0
  539. /package/dist/{src/file-utils → file-utils}/import-operations.d.ts +0 -0
  540. /package/dist/{src/file-utils → file-utils}/index.d.ts +0 -0
  541. /package/dist/{src/file-utils → file-utils}/mime-detection.d.ts +0 -0
  542. /package/dist/{src/folder-api → folder-api}/album-corroborate.d.ts +0 -0
  543. /package/dist/{src/folder-api → folder-api}/album-discs.d.ts +0 -0
  544. /package/dist/{src/folder-api → folder-api}/album-grouping.d.ts +0 -0
  545. /package/dist/{src/folder-api → folder-api}/album-identity.d.ts +0 -0
  546. /package/dist/{src/folder-api → folder-api}/album-types.d.ts +0 -0
  547. /package/dist/{src/folder-api → folder-api}/directory-walker.d.ts +0 -0
  548. /package/dist/{src/folder-api → folder-api}/file-processors.d.ts +0 -0
  549. /package/dist/{src/folder-api → folder-api}/folder-disc.d.ts +0 -0
  550. /package/dist/{src/folder-api → folder-api}/folder-operations.d.ts +0 -0
  551. /package/dist/{src/folder-api → folder-api}/index.d.ts +0 -0
  552. /package/dist/{src/folder-api → folder-api}/scan-for-albums.d.ts +0 -0
  553. /package/dist/{src/folder-api → folder-api}/scan-operations.d.ts +0 -0
  554. /package/dist/{src/folder-api → folder-api}/types.d.ts +0 -0
  555. /package/dist/{src/msgpack → msgpack}/decoder.d.ts +0 -0
  556. /package/dist/{src/msgpack → msgpack}/encoder.d.ts +0 -0
  557. /package/dist/{src/msgpack → msgpack}/index.d.ts +0 -0
  558. /package/dist/{src/msgpack → msgpack}/utils.d.ts +0 -0
  559. /package/dist/{src/runtime → runtime}/deno-detect.d.ts +0 -0
  560. /package/dist/{src/runtime → runtime}/loader-types.d.ts +0 -0
  561. /package/dist/{src/runtime → runtime}/module-loader-browser.d.ts +0 -0
  562. /package/dist/{src/runtime → runtime}/module-loader.d.ts +0 -0
  563. /package/dist/{src/runtime → runtime}/platform-io.d.ts +0 -0
  564. /package/dist/{src/runtime → runtime}/unified-loader/index.d.ts +0 -0
  565. /package/dist/{src/runtime → runtime}/unified-loader/loader.d.ts +0 -0
  566. /package/dist/{src/runtime → runtime}/unified-loader/module-loading.d.ts +0 -0
  567. /package/dist/{src/runtime → runtime}/unified-loader/module-selection.d.ts +0 -0
  568. /package/dist/{src/runtime → runtime}/unified-loader/types.d.ts +0 -0
  569. /package/dist/{src/runtime → runtime}/wasi-adapter/adapter.d.ts +0 -0
  570. /package/dist/{src/runtime → runtime}/wasi-adapter/audio-properties.d.ts +0 -0
  571. /package/dist/{src/runtime → runtime}/wasi-adapter/file-handle.d.ts +0 -0
  572. /package/dist/{src/runtime → runtime}/wasi-adapter/handle-state.d.ts +0 -0
  573. /package/dist/{src/runtime → runtime}/wasi-adapter/index.d.ts +0 -0
  574. /package/dist/{src/runtime → runtime}/wasi-adapter/mp4-items.d.ts +0 -0
  575. /package/dist/{src/runtime → runtime}/wasi-adapter/path-open.d.ts +0 -0
  576. /package/dist/{src/runtime → runtime}/wasi-adapter/property-surface.d.ts +0 -0
  577. /package/dist/{src/runtime → runtime}/wasi-adapter/structured-fields.d.ts +0 -0
  578. /package/dist/{src/runtime → runtime}/wasi-adapter/tag-keys.d.ts +0 -0
  579. /package/dist/{src/runtime → runtime}/wasi-adapter/wasm-io.d.ts +0 -0
  580. /package/dist/{src/runtime → runtime}/wasi-fs-deno.d.ts +0 -0
  581. /package/dist/{src/runtime → runtime}/wasi-fs-node.d.ts +0 -0
  582. /package/dist/{src/runtime → runtime}/wasi-fs-provider.d.ts +0 -0
  583. /package/dist/{src/runtime → runtime}/wasi-host-loader.d.ts +0 -0
  584. /package/dist/{src/runtime → runtime}/wasi-host.d.ts +0 -0
  585. /package/dist/{src/runtime → runtime}/wasi-memory.d.ts +0 -0
  586. /package/dist/{src/runtime → runtime}/wasmer-sdk-loader/types.d.ts +0 -0
  587. /package/dist/{src/simple → simple}/batch-operations.d.ts +0 -0
  588. /package/dist/{src/simple → simple}/checksum-operations.d.ts +0 -0
  589. /package/dist/{src/simple → simple}/config.d.ts +0 -0
  590. /package/dist/{src/simple → simple}/index.d.ts +0 -0
  591. /package/dist/{src/simple → simple}/picture-operations.d.ts +0 -0
  592. /package/dist/{src/simple → simple}/tag-operations.d.ts +0 -0
  593. /package/dist/{src/simple → simple}/with-audio-file.d.ts +0 -0
  594. /package/dist/{src/taglib → taglib}/audio-file-base.d.ts +0 -0
  595. /package/dist/{src/taglib → taglib}/audio-file-bwf.d.ts +0 -0
  596. /package/dist/{src/taglib → taglib}/audio-file-checksum.d.ts +0 -0
  597. /package/dist/{src/taglib → taglib}/audio-file-impl.d.ts +0 -0
  598. /package/dist/{src/taglib → taglib}/audio-file-interface.d.ts +0 -0
  599. /package/dist/{src/taglib → taglib}/auto-dispose.d.ts +0 -0
  600. /package/dist/{src/taglib → taglib}/embind-adapter.d.ts +0 -0
  601. /package/dist/{src/taglib → taglib}/extra-state-registry.d.ts +0 -0
  602. /package/dist/{src/taglib → taglib}/index.d.ts +0 -0
  603. /package/dist/{src/taglib → taglib}/load-audio-data.d.ts +0 -0
  604. /package/dist/{src/taglib → taglib}/media-ranges.d.ts +0 -0
  605. /package/dist/{src/taglib → taglib}/metadata-extent.d.ts +0 -0
  606. /package/dist/{src/taglib → taglib}/mp4-item-names.d.ts +0 -0
  607. /package/dist/{src/taglib → taglib}/mutable-tag-impl.d.ts +0 -0
  608. /package/dist/{src/taglib → taglib}/mutable-tag.d.ts +0 -0
  609. /package/dist/{src/taglib → taglib}/save-reconstruct.d.ts +0 -0
  610. /package/dist/{src/taglib → taglib}/taglib-class.d.ts +0 -0
  611. /package/dist/{src/taglib.d.ts → taglib.d.ts} +0 -0
  612. /package/dist/{src/types → types}/audio-formats.d.ts +0 -0
  613. /package/dist/{src/types → types}/bwf.d.ts +0 -0
  614. /package/dist/{src/types → types}/chapters.d.ts +0 -0
  615. /package/dist/{src/types → types}/config.d.ts +0 -0
  616. /package/dist/{src/types → types}/format-property-keys.d.ts +0 -0
  617. /package/dist/{src/types → types}/index.d.ts +0 -0
  618. /package/dist/{src/types → types}/metadata-mappings.d.ts +0 -0
  619. /package/dist/{src/types → types}/pictures.d.ts +0 -0
  620. /package/dist/{src/types → types}/tags.d.ts +0 -0
  621. /package/dist/{src/types.d.ts → types.d.ts} +0 -0
  622. /package/dist/{src/utils → utils}/file.d.ts +0 -0
  623. /package/dist/{src/utils → utils}/mirror-fields.d.ts +0 -0
  624. /package/dist/{src/utils → utils}/node-fs.d.ts +0 -0
  625. /package/dist/{src/utils → utils}/path.d.ts +0 -0
  626. /package/dist/{src/utils → utils}/rating.d.ts +0 -0
  627. /package/dist/{src/utils → utils}/tag-mapping.d.ts +0 -0
  628. /package/dist/{src/utils → utils}/write.d.ts +0 -0
  629. /package/dist/{src/wasm.d.ts → wasm.d.ts} +0 -0
  630. /package/dist/{src/web-utils → web-utils}/canvas.d.ts +0 -0
  631. /package/dist/{src/web-utils → web-utils}/data-url.d.ts +0 -0
  632. /package/dist/{src/web-utils → web-utils}/dom-integration.d.ts +0 -0
  633. /package/dist/{src/web-utils → web-utils}/index.d.ts +0 -0
package/dist/simple.d.ts CHANGED
@@ -18,5 +18,5 @@
18
18
  * });
19
19
  * ```
20
20
  */
21
- export * from "./src/simple/index.js";
21
+ export * from "./simple/index.js";
22
22
  //# sourceMappingURL=simple.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"simple.d.ts","sourceRoot":"","sources":["../simple.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"simple.d.ts","sourceRoot":"","sources":["../src/simple.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,cAAc,mBAAmB,CAAC"}
package/dist/simple.js CHANGED
@@ -1,2 +1,8 @@
1
- // simple.ts
2
- export * from "./src/simple/index.js";
1
+ import { PICTURE_TYPE_NAMES, PICTURE_TYPE_VALUES } from "./types/pictures.js";
2
+ import { getTagLib, setBufferMode } from "./simple/config.js";
3
+ import { applyTags, applyTagsToFile, clearTags, isValidAudioFile, readFormat, readProperties, readTags } from "./simple/tag-operations.js";
4
+ import { addPicture, applyCoverArt, applyPictures, clearPictures, findPictureByType, readCoverArt, readPictureMetadata, readPictures, replacePictureByType } from "./simple/picture-operations.js";
5
+ import { editTagsBatch, readMetadata, readMetadataBatch, readPropertiesBatch, readTagsBatch, writeTagsBatch } from "./simple/batch-operations.js";
6
+ import { readMediaChecksum } from "./simple/checksum-operations.js";
7
+ import "./simple/index.js";
8
+ export { PICTURE_TYPE_NAMES, PICTURE_TYPE_VALUES, addPicture, applyCoverArt, applyPictures, applyTags, applyTagsToFile, clearPictures, clearTags, editTagsBatch, findPictureByType, getTagLib, isValidAudioFile, readCoverArt, readFormat, readMediaChecksum, readMetadata, readMetadataBatch, readPictureMetadata, readPictures, readProperties, readPropertiesBatch, readTags, readTagsBatch, replacePictureByType, setBufferMode, writeTagsBatch };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audio-file-base.d.ts","sourceRoot":"","sources":["../../src/taglib/audio-file-base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,KAAK,EACV,eAAe,EACf,QAAQ,EACR,WAAW,EACX,WAAW,EACZ,MAAM,aAAa,CAAC;AASrB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAiBhE;;;;;GAKG;AACH,8BAAsB,iBAAiB;IAgBnC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,YAAY;IAfzC,SAAS,CAAC,UAAU,EAAE,cAAc,GAAG,IAAI,CAAC;IAC5C,SAAS,CAAC,qB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OAAO;IAIhB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAgB3C,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAoB5C,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAOhC,OAAO,IAAI,OAAO;IAIlB,OAAO,IAAI,IAAI;IASf,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI;CAGzB"}
@@ -0,0 +1,166 @@
1
+ import { fromTagLibKey, mp4AtomWireKey, mp4FreeformAtomNames, remapKeysFromTagLib, toTagLibKey } from "../constants/properties.js";
2
+ import { MetadataError, UnsupportedFormatError } from "../errors/classes.js";
3
+ import "../errors.js";
4
+ import { MP4_ITEM_NAMES_KEY } from "./mp4-item-names.js";
5
+ import { buildMutableTag } from "./mutable-tag-impl.js";
6
+ import { registerAutoDispose, unregisterAutoDispose } from "./auto-dispose.js";
7
+ import _defineProperty from "../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/defineProperty.js";
8
+ //#region src/taglib/audio-file-base.ts
9
+ let _Symbol$dispose;
10
+ const LYRICS_PROPERTY_KEY = "lyrics";
11
+ const LYRICS_WIRE_KEY = toTagLibKey(LYRICS_PROPERTY_KEY);
12
+ const EMPTY_KEY_SET = /* @__PURE__ */ new Set();
13
+ _Symbol$dispose = Symbol.dispose;
14
+ /**
15
+ * Base implementation with core read/property operations.
16
+ * Extended by AudioFileImpl to add save/picture/rating/extended methods.
17
+ *
18
+ * @internal Not exported from the public API.
19
+ */
20
+ var BaseAudioFileImpl = class {
21
+ constructor(module, fileHandle, sourcePath, originalSource, isPartiallyLoaded = false, partialLoadOptions) {
22
+ this.module = module;
23
+ _defineProperty(this, "fileHandle", void 0);
24
+ _defineProperty(this, "cachedAudioProperties", null);
25
+ _defineProperty(this, "sourcePath", void 0);
26
+ _defineProperty(this, "originalSource", void 0);
27
+ _defineProperty(this, "isPartiallyLoaded", false);
28
+ _defineProperty(this, "partialLoadOptions", void 0);
29
+ _defineProperty(this, "partialKeysAtLoad", void 0);
30
+ this.fileHandle = fileHandle;
31
+ this.sourcePath = sourcePath;
32
+ this.originalSource = originalSource;
33
+ this.isPartiallyLoaded = isPartiallyLoaded;
34
+ this.partialLoadOptions = partialLoadOptions;
35
+ this.partialKeysAtLoad = isPartiallyLoaded ? new Set(Object.keys(fileHandle.getProperties())) : void 0;
36
+ registerAutoDispose(this, fileHandle);
37
+ }
38
+ /**
39
+ * Wire-key text properties present in the partial header at load but now
40
+ * absent — the user deleted them. The partial-load reconstruct subtracts these
41
+ * from its preserve-the-original merge so a deletion persists without wiping
42
+ * frames beyond the loaded header (taglib-d14). Lyrics are excluded (they ride
43
+ * their own reconstruct path); empty for a full load.
44
+ */
45
+ partialDeletedPropertyKeys() {
46
+ if (!this.partialKeysAtLoad) return EMPTY_KEY_SET;
47
+ const current = new Set(Object.keys(this.handle.getProperties()));
48
+ const deleted = /* @__PURE__ */ new Set();
49
+ for (const key of this.partialKeysAtLoad) if (key !== LYRICS_WIRE_KEY && !current.has(key)) deleted.add(key);
50
+ return deleted;
51
+ }
52
+ get handle() {
53
+ if (!this.fileHandle) throw new MetadataError("read", "File handle has been disposed");
54
+ return this.fileHandle;
55
+ }
56
+ getFormat() {
57
+ return this.handle.getFormat();
58
+ }
59
+ isFormat(format) {
60
+ return this.getFormat() === format;
61
+ }
62
+ tag() {
63
+ return buildMutableTag(this.handle);
64
+ }
65
+ audioProperties() {
66
+ if (!this.cachedAudioProperties) this.cachedAudioProperties = this.handle.getAudioProperties() ?? null;
67
+ return this.cachedAudioProperties ?? void 0;
68
+ }
69
+ properties() {
70
+ const remapped = remapKeysFromTagLib(this.handle.getProperties());
71
+ delete remapped[LYRICS_PROPERTY_KEY];
72
+ return remapped;
73
+ }
74
+ setProperties(properties) {
75
+ const translated = {};
76
+ for (const [key, values] of Object.entries(properties)) if (values !== void 0) translated[toTagLibKey(fromTagLibKey(key))] = values;
77
+ if (!(LYRICS_WIRE_KEY in translated)) {
78
+ const existing = this.handle.getProperties()[LYRICS_WIRE_KEY];
79
+ if (existing !== void 0) translated[LYRICS_WIRE_KEY] = existing;
80
+ }
81
+ const atomNames = mp4FreeformAtomNames(Object.keys(translated));
82
+ if (atomNames.length > 0) translated[MP4_ITEM_NAMES_KEY] = atomNames;
83
+ this.handle.setProperties(translated);
84
+ }
85
+ getProperty(key) {
86
+ const wireKey = toTagLibKey(fromTagLibKey(key));
87
+ const values = this.handle.getProperties()[wireKey]?.filter((v) => v !== "");
88
+ if (values !== void 0 && values.length > 0) return values;
89
+ if (!this.isMP4()) return void 0;
90
+ const remapped = this.properties()[key]?.filter((v) => v !== "");
91
+ return remapped !== void 0 && remapped.length > 0 ? remapped : void 0;
92
+ }
93
+ setProperty(key, value) {
94
+ const wireKey = toTagLibKey(fromTagLibKey(key));
95
+ const atomNames = mp4FreeformAtomNames([wireKey]);
96
+ if (atomNames.length > 0 && this.isMP4()) {
97
+ if (value === "") {
98
+ const prior = this.handle.getMp4ItemRemovals?.() ?? [];
99
+ this.handle.setMp4ItemRemovals?.([.../* @__PURE__ */ new Set([...prior, ...atomNames])]);
100
+ if (this.module.isWasi) this.handle.setProperties({
101
+ ...this.handle.getProperties(),
102
+ [wireKey]: []
103
+ });
104
+ else {
105
+ const rest = { ...this.handle.getProperties() };
106
+ delete rest[wireKey];
107
+ this.handle.setProperties(rest);
108
+ }
109
+ return;
110
+ }
111
+ this.handle.setProperties({
112
+ ...this.handle.getProperties(),
113
+ [wireKey]: [value],
114
+ [MP4_ITEM_NAMES_KEY]: atomNames
115
+ });
116
+ return;
117
+ }
118
+ this.handle.setProperty(wireKey, value);
119
+ }
120
+ /**
121
+ * The empty-string clearing contract, named (taglib-qyw2): both backends
122
+ * remove the property when the written value is empty, and setProperty's
123
+ * wire-key normalization + MP4 freeform atom-name handling apply unchanged.
124
+ */
125
+ removeProperty(key) {
126
+ this.setProperty(key, "");
127
+ }
128
+ isMP4() {
129
+ return this.handle.isMP4();
130
+ }
131
+ getMP4Item(key) {
132
+ if (!this.isMP4()) throw new UnsupportedFormatError(this.getFormat(), ["MP4", "M4A"]);
133
+ const wireKey = mp4AtomWireKey(key);
134
+ const value = wireKey !== void 0 ? this.handle.getProperty(wireKey) : this.handle.getMP4Item(key);
135
+ return value === "" ? void 0 : value;
136
+ }
137
+ setMP4Item(key, value) {
138
+ if (!this.isMP4()) throw new UnsupportedFormatError(this.getFormat(), ["MP4", "M4A"]);
139
+ const wireKey = mp4AtomWireKey(key);
140
+ if (wireKey !== void 0) {
141
+ this.handle.setProperty(wireKey, value);
142
+ return;
143
+ }
144
+ this.handle.setMP4Item(key, value);
145
+ }
146
+ removeMP4Item(key) {
147
+ if (!this.isMP4()) throw new UnsupportedFormatError(this.getFormat(), ["MP4", "M4A"]);
148
+ this.handle.removeMP4Item(key);
149
+ }
150
+ isValid() {
151
+ return this.handle.isValid();
152
+ }
153
+ dispose() {
154
+ unregisterAutoDispose(this);
155
+ if (this.fileHandle) {
156
+ this.fileHandle.destroy();
157
+ this.fileHandle = null;
158
+ this.cachedAudioProperties = null;
159
+ }
160
+ }
161
+ [_Symbol$dispose]() {
162
+ this.dispose();
163
+ }
164
+ };
165
+ //#endregion
166
+ export { BaseAudioFileImpl };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audio-file-bwf.d.ts","sourceRoot":"","sources":["../../src/taglib/audio-file-bwf.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAc/D,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS,CAGtE;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,UAAU,GAAG,IAAI,GACtB,IAAI,CAGN;AAED,wBAAgB,OAAO,CACrB,MAAM,EAAE,UAAU,GACjB,uBAAuB,GAAG,SAAS,CAGrC;AAED,wBAAgB,OAAO,CACrB,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,uBAAuB,GAC5B,IAAI,CAGN;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAE9D;AAED,wBAAgB,OAAO,CACrB,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GAAG,IAAI,GAClB,IAAI,CAGN"}
@@ -0,0 +1,33 @@
1
+ import { decodeBext, encodeBext } from "../bwf/bext.js";
2
+ import { UnsupportedFormatError } from "../errors/classes.js";
3
+ import "../errors.js";
4
+ //#region src/taglib/audio-file-bwf.ts
5
+ const BWF_FORMATS = /* @__PURE__ */ new Set(["WAV", "FLAC"]);
6
+ function requireBwf(format) {
7
+ if (!BWF_FORMATS.has(format)) throw new UnsupportedFormatError(format, ["WAV", "FLAC"], { operation: "BWF metadata" });
8
+ }
9
+ function getBextData(handle) {
10
+ const raw = handle.getBextData();
11
+ return raw && raw.length > 0 ? raw : void 0;
12
+ }
13
+ function setBextData(handle, format, data) {
14
+ requireBwf(format);
15
+ handle.setBextData(data);
16
+ }
17
+ function getBext(handle) {
18
+ const raw = handle.getBextData();
19
+ return raw && raw.length > 0 ? decodeBext(raw) : void 0;
20
+ }
21
+ function setBext(handle, format, bext) {
22
+ requireBwf(format);
23
+ handle.setBextData(encodeBext(bext));
24
+ }
25
+ function getIxml(handle) {
26
+ return handle.getIxml();
27
+ }
28
+ function setIxml(handle, format, data) {
29
+ requireBwf(format);
30
+ handle.setIxml(data);
31
+ }
32
+ //#endregion
33
+ export { getBext, getBextData, getIxml, setBext, setBextData, setIxml };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audio-file-checksum.d.ts","sourceRoot":"","sources":["../../src/taglib/audio-file-checksum.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAG5D,MAAM,MAAM,aAAa,GACrB;IACE,MAAM,EAAE,eAAe,GAAG,MAAM,CAAC;IACjC,SAAS,EAAE,QAAQ,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;CACrB,GACD;IACE,MAAM,EAAE,qBAAqB,CAAC;IAC9B,SAAS,EAAE,KAAK,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,EAAE,CAAC;CACjB,CAAC;AAEN,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,SAAS,GAAG,KAAK,CAAC;CAC3B;AAED;mCACmC;AACnC,MAAM,MAAM,cAAc,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;AAErD,4EAA4E;AAC5E,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;AAE3D;;;;GAIG;AACH,UAAU,oBAAoB;IAC5B;sEACkE;IAClE,KAAK,EAAE,UAAU,CAAC;IAClB,qDAAqD;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ;;2DAEuD;IACvD,eAAe,EAAE,OAAO,CAAC;CAC1B;AA6FD,wBAAsB,aAAa,CACjC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,UAAU,EACd,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,aAAa,CAAC,CAgExB"}
@@ -0,0 +1,90 @@
1
+ import { MetadataError, UnsupportedFormatError } from "../errors/classes.js";
2
+ import "../errors.js";
3
+ import { flacStreamInfoMd5, mediaRanges } from "./media-ranges.js";
4
+ //#region src/taglib/audio-file-checksum.ts
5
+ /**
6
+ * @fileoverview `mediaChecksum()`: a SHA-256 of a file's *encoded media
7
+ * payload* — the bytes that are the audio, and not the tags around them — plus
8
+ * FLAC's STREAMINFO digest passthrough. Factored out of `AudioFileImpl` so the
9
+ * source rule below (what actually gets hashed) is stated exactly once.
10
+ */
11
+ /** The header window a path-mode handle reads for `basis: "pcm"`: STREAMINFO is
12
+ * a FLAC file's first metadata block, so nothing else in a 16-byte digest's
13
+ * worth of work needs reading — unless the tag in front of it is larger than
14
+ * this, which is why a window without a digest falls back to the whole file. */
15
+ const STREAMINFO_WINDOW = 65536;
16
+ /**
17
+ * The file's bytes — the checksum describes the file at its source, so the
18
+ * source wins over whatever the handle holds in memory:
19
+ *
20
+ * 1. a path is read (WASI path mode keeps nothing in memory, and a partial handle
21
+ * holds a spliced header+footer image, not the file);
22
+ * 2. a Blob/File is read (a partial File has no path — this is the only way back);
23
+ * 3. the caller's own bytes are used only when the handle could not have spliced
24
+ * them, i.e. no path, no blob, and not partial (Uint8Array/ArrayBuffer inputs
25
+ * have no partial mode by construction);
26
+ * 4. otherwise throw. That last case is real: saving a *partial* File handle drops
27
+ * both its original source and its partial flag (`audio-file-impl.ts:155-156`)
28
+ * while the in-memory bytes stay a spliced image — returning them would hash a
29
+ * truncated file and label it source: "audio-payload".
30
+ *
31
+ * The read is whole-file on purpose: ranges cannot be derived from a spliced
32
+ * image (the MPEG and MP4 walks need every frame and atom), and the digest needs
33
+ * the payload anyway — so the only extra bytes are the container's tag regions.
34
+ */
35
+ async function fileBytes(source, io) {
36
+ if (source.path) return await io.readFile(source.path);
37
+ if (source.blob) return new Uint8Array(await source.blob.arrayBuffer());
38
+ if (!source.partiallyLoaded && source.bytes.length > 0) return source.bytes;
39
+ throw new MetadataError("read", "the handle holds no file bytes and has no readable source; a partial handle that has been saved drops its source — checksum the saved path instead");
40
+ }
41
+ /** Web Crypto has no streaming digest, so the payload is materialized once —
42
+ * bounded by the payload the caller asked us to hash. The return is annotated
43
+ * because digest() takes a `BufferSource` and a bare `Uint8Array` widens to
44
+ * ArrayBufferLike (shared buffers are not a BufferSource). */
45
+ function joinRanges(bytes, ranges) {
46
+ const total = ranges.reduce((n, r) => n + r.length, 0);
47
+ const overrun = ranges.find((r) => r.offset + r.length > bytes.length);
48
+ if (overrun || total > bytes.length) throw new MetadataError("read", `range walk overran the buffer (${overrun ? `range ${overrun.offset}+${overrun.length}` : `${total} bytes`} past the ${bytes.length}-byte buffer)`);
49
+ if (ranges.length === 1) {
50
+ const only = ranges[0];
51
+ const view = bytes.subarray(only.offset, only.offset + only.length);
52
+ return view.buffer instanceof ArrayBuffer ? view : new Uint8Array(view);
53
+ }
54
+ const out = new Uint8Array(total);
55
+ let at = 0;
56
+ for (const r of ranges) {
57
+ out.set(bytes.subarray(r.offset, r.offset + r.length), at);
58
+ at += r.length;
59
+ }
60
+ return out;
61
+ }
62
+ async function mediaChecksum(source, format, io, options = {}) {
63
+ if (options.basis === "pcm") {
64
+ if (format.toUpperCase() !== "FLAC") throw new UnsupportedFormatError(format, ["FLAC"], { operation: "media checksum (basis: pcm)" });
65
+ const windowed = source.bytes.length > 0 ? source.bytes : source.path && io.readPartial ? await io.readPartial(source.path, STREAMINFO_WINDOW, 0) : void 0;
66
+ let md5 = windowed === void 0 ? void 0 : flacStreamInfoMd5(windowed);
67
+ if (md5 === void 0 && windowed !== source.bytes) md5 = flacStreamInfoMd5(await fileBytes(source, io));
68
+ if (md5 === void 0) throw new MetadataError("read", "STREAMINFO digest unavailable");
69
+ return {
70
+ source: "flac-streaminfo-md5",
71
+ algorithm: "md5",
72
+ hex: md5,
73
+ bytesHashed: 16
74
+ };
75
+ }
76
+ const bytes = await fileBytes(source, io);
77
+ const walk = mediaRanges(format, bytes);
78
+ const payload = joinRanges(bytes, walk.ranges);
79
+ const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", payload));
80
+ let hex = "";
81
+ for (const byte of digest) hex += byte.toString(16).padStart(2, "0");
82
+ return {
83
+ source: walk.kind === "ranges" ? "audio-payload" : "file",
84
+ algorithm: "sha256",
85
+ hex,
86
+ bytesHashed: payload.length
87
+ };
88
+ }
89
+ //#endregion
90
+ export { mediaChecksum };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audio-file-impl.d.ts","sourceRoot":"","sources":["../../src/taglib/audio-file-impl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,YAAY,EACZ,cAAc,EACf,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D,OAAO,KAAK,EACV,UAAU,EACV,MAAM,EACN,cAAc,EACf,MAAM,oCAAoC,CAAC;AAc5C,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,oBAAoB,EAC1B,MAAM,0BAA0B,CAAC;AAqBlC,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CASrD;AAED;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,iBAAkB,YAAW,SAAS;IACvE,OAAO,CAAC,cAAc,CAA2B;IACjD,kFAAkF;IAClF,OAAO,CAAC,QAAQ,CAAC,6BAA6B,CAAU;gBAGtD,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,cAAc,EAC1B,UAAU,CAAC,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,IAAI,EACzD,iBAAiB,GAAE,OAAe,EAClC,kBAAkB,CAAC,EAAE,WAAW;IAalC,IAAI,IAAI,OAAO;IAef,aAAa,IAAI,UAAU;IA2B3B,aAAa,CAAC,OAAO,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QAAC,EAAE,EAAE,OAAO,CAAA;KAAE;IAI1C,YAAY,CAAC,IAAI,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,OAAO,CAAC;QAAC,EAAE,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI;CAM1D"}
@@ -0,0 +1,234 @@
1
+ import { PICTURE_TYPE_NAMES, PICTURE_TYPE_VALUES } from "../types/pictures.js";
2
+ import "../types.js";
3
+ import { FileOperationError, UnsupportedFormatError, errorMessage } from "../errors/classes.js";
4
+ import "../errors.js";
5
+ import { getBext, getBextData, getIxml, setBext, setBextData, setIxml } from "./audio-file-bwf.js";
6
+ import { assertFrameBodies, assertFrameId, assertMp3, toPublicFrame } from "./id3v2-frames.js";
7
+ import { isDeno } from "../runtime/detector.js";
8
+ import { getPlatformIO } from "../runtime/platform-io.js";
9
+ import { writeFileData } from "../utils/write.js";
10
+ import { getNodeFsSync } from "../utils/node-fs.js";
11
+ import { normalized } from "../utils/rating.js";
12
+ import _defineProperty from "../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/defineProperty.js";
13
+ import { BaseAudioFileImpl } from "./audio-file-base.js";
14
+ import { mediaChecksum } from "./audio-file-checksum.js";
15
+ import { saveViaFreshHandle } from "./save-reconstruct.js";
16
+ //#region src/taglib/audio-file-impl.ts
17
+ function sortChapters(list) {
18
+ return [...list].sort((a, b) => a.startTimeMs - b.startTimeMs);
19
+ }
20
+ function inferEndTimeMs(sorted, index, trackEndMs) {
21
+ const own = sorted[index].endTimeMs;
22
+ if (own !== void 0) return own;
23
+ const next = sorted[index + 1];
24
+ return next ? next.startTimeMs : trackEndMs;
25
+ }
26
+ /** @internal Exported for unit tests (tests/node-fs-acquisition.test.ts). */
27
+ function readFileSync(path) {
28
+ if (isDeno()) return Deno.readFileSync(path);
29
+ const fs = getNodeFsSync();
30
+ if (fs) return new Uint8Array(fs.readFileSync(path));
31
+ throw new FileOperationError("read", "node:fs is unavailable in this runtime: cannot read file data from disk", path);
32
+ }
33
+ /**
34
+ * Implementation of AudioFile interface using Embind API.
35
+ *
36
+ * @internal This class is not meant to be instantiated directly.
37
+ * Use TagLib.open() to create instances.
38
+ */
39
+ var AudioFileImpl = class extends BaseAudioFileImpl {
40
+ constructor(module, fileHandle, sourcePath, originalSource, isPartiallyLoaded = false, partialLoadOptions) {
41
+ super(module, fileHandle, sourcePath, originalSource, isPartiallyLoaded, partialLoadOptions);
42
+ _defineProperty(this, "pathModeBuffer", null);
43
+ _defineProperty(this, "partiallyLoadedAtConstruction", void 0);
44
+ this.partiallyLoadedAtConstruction = isPartiallyLoaded;
45
+ }
46
+ save() {
47
+ if (this.isPartiallyLoaded && this.originalSource) throw new FileOperationError("save", "Cannot save partially loaded file directly. Use saveToFile() instead");
48
+ this.cachedAudioProperties = null;
49
+ this.pathModeBuffer = null;
50
+ return this.handle.save();
51
+ }
52
+ getFileBuffer() {
53
+ const buffer = this.handle.getBuffer();
54
+ if (buffer.length > 0) return buffer;
55
+ if (this.pathModeBuffer) return this.pathModeBuffer;
56
+ if (this.sourcePath) try {
57
+ this.pathModeBuffer = readFileSync(this.sourcePath);
58
+ return this.pathModeBuffer;
59
+ } catch (error) {
60
+ if (error instanceof FileOperationError) throw error;
61
+ throw new FileOperationError("read", `Cannot return file data: ${errorMessage(error)}`, this.sourcePath, { cause: error });
62
+ }
63
+ throw new FileOperationError("read", "No file data available: in-memory buffer is empty and no source path is set");
64
+ }
65
+ mediaChecksum(options) {
66
+ return mediaChecksum({
67
+ bytes: this.handle.getBuffer(),
68
+ ...this.sourcePath !== void 0 ? { path: this.sourcePath } : {},
69
+ ...this.originalSource instanceof Blob ? { blob: this.originalSource } : {},
70
+ partiallyLoaded: this.partiallyLoadedAtConstruction
71
+ }, this.getFormat(), getPlatformIO(), options);
72
+ }
73
+ async saveToFile(path) {
74
+ const targetPath = path ?? this.sourcePath;
75
+ if (!targetPath) throw new FileOperationError("save", "No file path available. Provide a path or open the file from a path");
76
+ if (this.isPartiallyLoaded && this.originalSource) {
77
+ await saveViaFreshHandle(this.module, this.handle, this.originalSource, targetPath, false, this.partialDeletedPropertyKeys());
78
+ this.isPartiallyLoaded = false;
79
+ this.originalSource = void 0;
80
+ } else if (this.module.isWasi && this.sourcePath && targetPath !== this.sourcePath) await saveViaFreshHandle(this.module, this.handle, this.sourcePath, targetPath, true);
81
+ else {
82
+ if (!this.save()) throw new FileOperationError("save", "Failed to save changes to in-memory buffer");
83
+ const buffer = this.handle.getBuffer();
84
+ if (buffer.length > 0) await writeFileData(targetPath, buffer);
85
+ }
86
+ this.pathModeBuffer = null;
87
+ }
88
+ getPictures() {
89
+ return this.handle.getPictures().map((pic) => ({
90
+ mimeType: pic.mimeType,
91
+ data: pic.data,
92
+ type: PICTURE_TYPE_NAMES[pic.type] ?? "Other",
93
+ ...pic.description !== void 0 ? { description: pic.description } : {}
94
+ }));
95
+ }
96
+ setPictures(pictures) {
97
+ this.handle.setPictures(pictures.map((pic) => ({
98
+ mimeType: pic.mimeType,
99
+ data: pic.data,
100
+ type: PICTURE_TYPE_VALUES[pic.type] ?? 0,
101
+ description: pic.description ?? ""
102
+ })));
103
+ }
104
+ addPicture(picture) {
105
+ this.handle.addPicture({
106
+ mimeType: picture.mimeType,
107
+ data: picture.data,
108
+ type: PICTURE_TYPE_VALUES[picture.type] ?? 0,
109
+ description: picture.description ?? ""
110
+ });
111
+ }
112
+ removePictures() {
113
+ this.handle.removePictures();
114
+ }
115
+ getChapters() {
116
+ const sorted = sortChapters(this.handle.getChapters());
117
+ const trackEndMs = this.audioProperties()?.durationMs;
118
+ return sorted.map((c, i) => {
119
+ const endTimeMs = inferEndTimeMs(sorted, i, trackEndMs);
120
+ return {
121
+ startTimeMs: c.startTimeMs,
122
+ ...endTimeMs !== void 0 ? { endTimeMs } : {},
123
+ ...c.title ? { title: c.title } : {},
124
+ ...c.id ? { id: c.id } : {},
125
+ ...c.source !== void 0 ? { source: c.source } : {}
126
+ };
127
+ });
128
+ }
129
+ setChapters(chapters, options) {
130
+ const fmt = this.getFormat();
131
+ if (fmt !== "MP3" && fmt !== "AAC" && fmt !== "MP4") throw new UnsupportedFormatError(fmt, [
132
+ "MP3",
133
+ "AAC",
134
+ "MP4"
135
+ ], { operation: "setChapters" });
136
+ const sorted = sortChapters(chapters);
137
+ const trackEndMs = this.audioProperties()?.durationMs;
138
+ const style = options?.mp4ChapterStyle ?? "quicktime";
139
+ const source = fmt === "MP4" ? style : "id3";
140
+ const raw = sorted.map((c, i) => ({
141
+ ...c.id !== void 0 ? { id: c.id } : {},
142
+ startTimeMs: c.startTimeMs,
143
+ endTimeMs: inferEndTimeMs(sorted, i, trackEndMs) ?? c.startTimeMs,
144
+ ...c.title !== void 0 ? { title: c.title } : {},
145
+ source
146
+ }));
147
+ this.handle.setChapters(raw, style);
148
+ }
149
+ getBext() {
150
+ return getBext(this.handle);
151
+ }
152
+ setBext(bext) {
153
+ setBext(this.handle, this.getFormat(), bext);
154
+ }
155
+ getBextData() {
156
+ return getBextData(this.handle);
157
+ }
158
+ setBextData(data) {
159
+ setBextData(this.handle, this.getFormat(), data);
160
+ }
161
+ getIxml() {
162
+ return getIxml(this.handle);
163
+ }
164
+ setIxml(data) {
165
+ setIxml(this.handle, this.getFormat(), data);
166
+ }
167
+ getRatings() {
168
+ return this.handle.getRatings().map((r) => ({
169
+ rating: r.rating,
170
+ ...r.email !== void 0 && r.email !== "" ? { email: r.email } : {},
171
+ ...r.counter !== 0 ? { counter: r.counter } : {}
172
+ }));
173
+ }
174
+ setRatings(ratings) {
175
+ this.handle.setRatings(ratings.map((r) => ({
176
+ rating: r.rating,
177
+ email: r.email ?? "",
178
+ counter: r.counter ?? 0
179
+ })));
180
+ }
181
+ getLyrics() {
182
+ return this.handle.getLyrics().map((l) => {
183
+ const out = { text: l.text };
184
+ if (l.description) out.description = l.description;
185
+ if (l.language) out.language = l.language;
186
+ return out;
187
+ });
188
+ }
189
+ setLyrics(lyrics) {
190
+ this.handle.setLyrics(lyrics.map((l) => ({
191
+ text: l.text,
192
+ description: l.description ?? "",
193
+ language: l.language ?? ""
194
+ })));
195
+ }
196
+ getRating() {
197
+ const ratings = this.getRatings();
198
+ return ratings.length > 0 ? normalized(ratings[0].rating) : void 0;
199
+ }
200
+ setRating(rating, email) {
201
+ this.setRatings([{
202
+ rating,
203
+ ...email !== void 0 ? { email } : {},
204
+ counter: 0
205
+ }]);
206
+ }
207
+ getId3v2Frames(id) {
208
+ assertMp3(this.getFormat());
209
+ if (id !== void 0) assertFrameId(id, "read");
210
+ return this.handle.getId3v2Frames(id ?? "").map(toPublicFrame);
211
+ }
212
+ setId3v2Frames(id, data) {
213
+ assertMp3(this.getFormat());
214
+ assertFrameId(id, "write");
215
+ assertFrameBodies(id, data);
216
+ this.handle.setId3v2Frames(id, data);
217
+ }
218
+ removeId3v2Frames(id) {
219
+ assertMp3(this.getFormat());
220
+ assertFrameId(id, "write");
221
+ this.handle.removeId3v2Frames(id);
222
+ }
223
+ hasId3Tags() {
224
+ return this.handle.hasId3Tags();
225
+ }
226
+ stripId3Tags(opts) {
227
+ this.handle.stripId3Tags({
228
+ v1: opts?.v1 ?? true,
229
+ v2: opts?.v2 ?? true
230
+ });
231
+ }
232
+ };
233
+ //#endregion
234
+ export { AudioFileImpl, readFileSync };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audio-file-interface.d.ts","sourceRoot":"","sources":["../../src/taglib/audio-file-interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,QAAQ,EACR,OAAO,EACP,WAAW,EACZ,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,KAAK,EACV,UAAU,EACV,MAAM,EACN,cAAc,EACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,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AC,OAAO,CAAC,IAAI,IAAI,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,QAAQ,CAAE,SAAQ,IAAI,CAC9D,SAAS,EACT,aAAa,GAAG,aAAa,GAAG,gBAAgB,GAAG,iBAAiB,CACrE;IACC,SAAS,IAAI,CAAC,CAAC;IAEf,eAAe,IAAI,oBAAoB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAEvD,WAAW,CAAC,CAAC,SAAS,iBAAiB,CAAC,CAAC,CAAC,EACxC,GAAG,EAAE,CAAC,GACL,OAAO,iBAAiB,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC;IAE5D,WAAW,CAAC,CAAC,SAAS,iBAAiB,CAAC,CAAC,CAAC,EACxC,GAAG,EAAE,CAAC,EACN,KAAK,EAAE,OAAO,iBAAiB,EAAE,aAAa,CAAC,CAAC,CAAC,GAChD,IAAI,CAAC;IAER,cAAc,CAAC,CAAC,SAAS,iBAAiB,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC;CAC9D"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auto-dispose.d.ts","sourceRoot":"","sources":["../../src/taglib/auto-dispose.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AA0B7C,6EAA6E;AAC7E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAE5E;AAED,+EAA+E;AAC/E,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAE1D"}
@@ -0,0 +1,34 @@
1
+ //#region src/taglib/auto-dispose.ts
2
+ /**
3
+ * Best-effort safety net for forgetful callers (taglib-t4sn).
4
+ *
5
+ * The Full API requires an explicit dispose() — via `using` or a finally
6
+ * block — but nothing enforces it, and a forgotten wrapper leaks the native
7
+ * FileHandle for the life of the process (the Wasm C++ object on Emscripten,
8
+ * file buffers on WASI). tuneup's engine worker hit exactly this in its write
9
+ * path.
10
+ *
11
+ * The registry releases the FileHandle when the wrapper becomes unreachable
12
+ * WITHOUT an explicit dispose(). Explicit dispose() remains the preferred and
13
+ * deterministic path: it unregisters first, so the finalizer never runs after
14
+ * an explicit release.
15
+ *
16
+ * Safety: the finalizer only ever fires when the wrapper is garbage, so a live
17
+ * wrapper can never observe a destroyed handle. destroy() is idempotent on
18
+ * both backends (WasiFileHandle nulls fields and sets `destroyed`; the Embind
19
+ * binding resets unique_ptrs), so even a double-destroy via the open()-failure
20
+ * path plus a later finalizer run is harmless.
21
+ */
22
+ const registry = new FinalizationRegistry((handle) => {
23
+ handle.destroy();
24
+ });
25
+ /** @internal Register `handle` for release when `target` becomes garbage. */
26
+ function registerAutoDispose(target, handle) {
27
+ registry.register(target, handle, target);
28
+ }
29
+ /** @internal Drop the pending registration for `target` (explicit dispose). */
30
+ function unregisterAutoDispose(target) {
31
+ registry.unregister(target);
32
+ }
33
+ //#endregion
34
+ export { registerAutoDispose, unregisterAutoDispose };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embind-adapter.d.ts","sourceRoot":"","sources":["../../src/taglib/embind-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAyB,cAAc,EAAE,MAAM,YAAY,CAAC;AAcxE,wEAAwE;AACxE,UAAU,gBAAgB;IACxB,KAAK,IAAI,MAAM,CAAC;IAChB,MAAM,IAAI,MAAM,CAAC;IACjB,KAAK,IAAI,MAAM,CAAC;IAChB,OAAO,IAAI,MAAM,CAAC;IAClB,KAAK,IAAI,MAAM,CAAC;IAChB,IAAI,IAAI,MAAM,CAAC;IACf,KAAK,IAAI,MAAM,CAAC;IAChB,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,CAAC,CAAC,EAAE,MA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