@agentdocumentformat/cli 0.7.2
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.
- package/LICENSE +21 -0
- package/README.md +45 -0
- package/dist/adf.mjs +162 -0
- package/dist/chunks/APEv2Parser-2CNNHMXV.mjs +22 -0
- package/dist/chunks/AiffParser-7BR4RL6G.mjs +162 -0
- package/dist/chunks/App-L5L37JI5.mjs +16747 -0
- package/dist/chunks/AsfParser-VVRSLFOM.mjs +538 -0
- package/dist/chunks/DsdiffParser-CMD4AX7A.mjs +156 -0
- package/dist/chunks/DsfParser-UOGZDS2M.mjs +94 -0
- package/dist/chunks/FlacParser-HB3T3CD4.mjs +23 -0
- package/dist/chunks/MP4Parser-66HBRUSX.mjs +973 -0
- package/dist/chunks/MatroskaParser-J3HUIMEW.mjs +579 -0
- package/dist/chunks/MpegParser-YW6LIUEW.mjs +442 -0
- package/dist/chunks/MusepackParser-PAUSXP7D.mjs +252 -0
- package/dist/chunks/OggParser-NUBV3GWC.mjs +359 -0
- package/dist/chunks/WavPackParser-WQAGT7TC.mjs +171 -0
- package/dist/chunks/WaveParser-EWLQVDX4.mjs +238 -0
- package/dist/chunks/adf-schema-JRU2BTOG.mjs +62 -0
- package/dist/chunks/build-QF5W473T.mjs +60 -0
- package/dist/chunks/chatgpt-subscription-BQGWYZXE.mjs +23 -0
- package/dist/chunks/chunk-2DIECGFL.mjs +6 -0
- package/dist/chunks/chunk-2NAP2ZF7.mjs +60 -0
- package/dist/chunks/chunk-3AT7IIP7.mjs +25696 -0
- package/dist/chunks/chunk-3GNIDM53.mjs +35 -0
- package/dist/chunks/chunk-3M4ZPOA3.mjs +1477 -0
- package/dist/chunks/chunk-4MQPTCXY.mjs +510 -0
- package/dist/chunks/chunk-5PO5PKRV.mjs +366 -0
- package/dist/chunks/chunk-5QU5VY7N.mjs +52 -0
- package/dist/chunks/chunk-5W7KES6P.mjs +436 -0
- package/dist/chunks/chunk-62NE4LG4.mjs +61 -0
- package/dist/chunks/chunk-64OKE4X3.mjs +45 -0
- package/dist/chunks/chunk-6GJ4QHRI.mjs +1278 -0
- package/dist/chunks/chunk-6VQEXLE2.mjs +144 -0
- package/dist/chunks/chunk-6XUV6EK6.mjs +41 -0
- package/dist/chunks/chunk-776TSXEP.mjs +43 -0
- package/dist/chunks/chunk-7CV2SA3H.mjs +285 -0
- package/dist/chunks/chunk-7MTRVW2U.mjs +3103 -0
- package/dist/chunks/chunk-7N2R2VCG.mjs +1434 -0
- package/dist/chunks/chunk-7T2YMTWL.mjs +374 -0
- package/dist/chunks/chunk-7XYNI52E.mjs +149 -0
- package/dist/chunks/chunk-APHX6HSV.mjs +7731 -0
- package/dist/chunks/chunk-APRU6PHC.mjs +40 -0
- package/dist/chunks/chunk-AUYKRQPJ.mjs +499 -0
- package/dist/chunks/chunk-DXWDD5XJ.mjs +136 -0
- package/dist/chunks/chunk-EWL5FG4I.mjs +39 -0
- package/dist/chunks/chunk-EYX2YLJW.mjs +117 -0
- package/dist/chunks/chunk-F5ELW46V.mjs +27 -0
- package/dist/chunks/chunk-G426FACA.mjs +49 -0
- package/dist/chunks/chunk-GEKSJHIV.mjs +2472 -0
- package/dist/chunks/chunk-HBUENVQL.mjs +570 -0
- package/dist/chunks/chunk-HPVFJYXR.mjs +112 -0
- package/dist/chunks/chunk-HWLWPXQ7.mjs +721 -0
- package/dist/chunks/chunk-I2HJYHFT.mjs +665 -0
- package/dist/chunks/chunk-I3UYSITV.mjs +68 -0
- package/dist/chunks/chunk-IC4JDZCI.mjs +3864 -0
- package/dist/chunks/chunk-IHDDCZBS.mjs +112 -0
- package/dist/chunks/chunk-IIGMZHQQ.mjs +10416 -0
- package/dist/chunks/chunk-KWFOS5WC.mjs +41 -0
- package/dist/chunks/chunk-LAZIXV2F.mjs +5290 -0
- package/dist/chunks/chunk-LFMB4PAA.mjs +10814 -0
- package/dist/chunks/chunk-M2RX3S2T.mjs +49 -0
- package/dist/chunks/chunk-M3WPIJYM.mjs +65 -0
- package/dist/chunks/chunk-NBTUWMGP.mjs +263 -0
- package/dist/chunks/chunk-NGK6PVSF.mjs +2676 -0
- package/dist/chunks/chunk-NZ7JTHEO.mjs +85 -0
- package/dist/chunks/chunk-OQN33RGQ.mjs +52 -0
- package/dist/chunks/chunk-RIX34QHC.mjs +2935 -0
- package/dist/chunks/chunk-SGUTYISF.mjs +16 -0
- package/dist/chunks/chunk-SLJ5L7PY.mjs +1473 -0
- package/dist/chunks/chunk-SLUKGXKH.mjs +68 -0
- package/dist/chunks/chunk-TMT32MXT.mjs +419 -0
- package/dist/chunks/chunk-UYY5M2PB.mjs +151 -0
- package/dist/chunks/chunk-VAUOM3IN.mjs +298 -0
- package/dist/chunks/chunk-VMHTYDH4.mjs +172 -0
- package/dist/chunks/chunk-VZS54AA5.mjs +200 -0
- package/dist/chunks/chunk-WFQUVXML.mjs +295 -0
- package/dist/chunks/chunk-X34PDRUH.mjs +809 -0
- package/dist/chunks/chunk-XNPZBLYL.mjs +33 -0
- package/dist/chunks/chunk-XX7OSWTO.mjs +157 -0
- package/dist/chunks/chunk-XYTWGHFS.mjs +600 -0
- package/dist/chunks/chunk-XYV3VCIX.mjs +336 -0
- package/dist/chunks/chunk-Y5ZLKFLE.mjs +1469 -0
- package/dist/chunks/chunk-ZJKXHM4Q.mjs +230 -0
- package/dist/chunks/cli-TCMBNZF6.mjs +1030 -0
- package/dist/chunks/commands-DTEKM4ZL.mjs +20 -0
- package/dist/chunks/daemon-ZC3FZ2P4.mjs +112449 -0
- package/dist/chunks/daemon-control-WDX7PMTC.mjs +300 -0
- package/dist/chunks/daemon-token-WRSULP7G.mjs +23 -0
- package/dist/chunks/devtools-H7CI2ZVG.mjs +85 -0
- package/dist/chunks/discord-IWDQJA7A.mjs +70588 -0
- package/dist/chunks/dist-C57KYFS2.mjs +4952 -0
- package/dist/chunks/dist-I3XBAGDL.mjs +11 -0
- package/dist/chunks/email-V4Q4VJON.mjs +58679 -0
- package/dist/chunks/environment-NX277MQG.mjs +15 -0
- package/dist/chunks/grok-subscription-4PYX7TBF.mjs +19 -0
- package/dist/chunks/layout-EPJQNFAI.mjs +22 -0
- package/dist/chunks/lib-N7FCZWKH.mjs +4038 -0
- package/dist/chunks/open-OTQDGDH5.mjs +36 -0
- package/dist/chunks/parser-JVY2PWSM.mjs +19 -0
- package/dist/chunks/pipeline-executor-BHBSJX2K.mjs +19 -0
- package/dist/chunks/react-IUIDQ5LX.mjs +11 -0
- package/dist/chunks/screen-54BUTYCW.mjs +27 -0
- package/dist/chunks/slack-3L5QTDZX.mjs +8113 -0
- package/dist/chunks/store-WR7TZJZS.mjs +32 -0
- package/dist/chunks/telegram-5ISVFBV3.mjs +14918 -0
- package/dist/chunks/terminal-O5WO7C5U.mjs +48 -0
- package/dist/chunks/theme-NORU4J74.mjs +20 -0
- package/dist/chunks/themes-F2FKU7CP.mjs +23 -0
- package/dist/chunks/token-6G3HCMNX.mjs +54 -0
- package/dist/chunks/token-util-UXYSDQIW.mjs +12 -0
- package/dist/chunks/tui-ODVYUIMT.mjs +197 -0
- package/dist/chunks/welcome-XHXFV7SH.mjs +32 -0
- package/dist/chunks/whatsapp-XSAMNGPJ.mjs +85412 -0
- package/dist/chunks/xterm-headless-YF53XWXE.mjs +3353 -0
- package/package.json +53 -0
- package/resources/wasm/coreutils.LICENSE +18 -0
- package/resources/wasm/coreutils.wasm +0 -0
|
@@ -0,0 +1,579 @@
|
|
|
1
|
+
import { createRequire as __adfCreateRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __adfFileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __adfDirname } from 'node:path';
|
|
4
|
+
const require = __adfCreateRequire(import.meta.url);
|
|
5
|
+
const __filename = __adfFileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __adfDirname(__filename);
|
|
7
|
+
import {
|
|
8
|
+
TargetType,
|
|
9
|
+
TrackType
|
|
10
|
+
} from "./chunk-EWL5FG4I.mjs";
|
|
11
|
+
import {
|
|
12
|
+
EndOfStreamError
|
|
13
|
+
} from "./chunk-HBUENVQL.mjs";
|
|
14
|
+
import {
|
|
15
|
+
BasicParser,
|
|
16
|
+
Float32_BE,
|
|
17
|
+
Float64_BE,
|
|
18
|
+
StringType,
|
|
19
|
+
UINT64_BE,
|
|
20
|
+
UINT8,
|
|
21
|
+
makeUnexpectedFileContentError
|
|
22
|
+
} from "./chunk-I2HJYHFT.mjs";
|
|
23
|
+
import {
|
|
24
|
+
require_src
|
|
25
|
+
} from "./chunk-AUYKRQPJ.mjs";
|
|
26
|
+
import "./chunk-NZ7JTHEO.mjs";
|
|
27
|
+
import {
|
|
28
|
+
__toESM
|
|
29
|
+
} from "./chunk-M2RX3S2T.mjs";
|
|
30
|
+
|
|
31
|
+
// node_modules/music-metadata/lib/matroska/MatroskaParser.js
|
|
32
|
+
var import_debug2 = __toESM(require_src(), 1);
|
|
33
|
+
|
|
34
|
+
// node_modules/music-metadata/lib/ebml/types.js
|
|
35
|
+
var DataType = {
|
|
36
|
+
string: 0,
|
|
37
|
+
uint: 1,
|
|
38
|
+
uid: 2,
|
|
39
|
+
bool: 3,
|
|
40
|
+
binary: 4,
|
|
41
|
+
float: 5
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// node_modules/music-metadata/lib/matroska/MatroskaDtd.js
|
|
45
|
+
var matroskaDtd = {
|
|
46
|
+
name: "dtd",
|
|
47
|
+
container: {
|
|
48
|
+
440786851: {
|
|
49
|
+
name: "ebml",
|
|
50
|
+
container: {
|
|
51
|
+
17030: { name: "ebmlVersion", value: DataType.uint },
|
|
52
|
+
// 5.1.1
|
|
53
|
+
17143: { name: "ebmlReadVersion", value: DataType.uint },
|
|
54
|
+
// 5.1.2
|
|
55
|
+
17138: { name: "ebmlMaxIDWidth", value: DataType.uint },
|
|
56
|
+
// 5.1.3
|
|
57
|
+
17139: { name: "ebmlMaxSizeWidth", value: DataType.uint },
|
|
58
|
+
// 5.1.4
|
|
59
|
+
17026: { name: "docType", value: DataType.string },
|
|
60
|
+
// 5.1.5
|
|
61
|
+
17031: { name: "docTypeVersion", value: DataType.uint },
|
|
62
|
+
// 5.1.6
|
|
63
|
+
17029: { name: "docTypeReadVersion", value: DataType.uint }
|
|
64
|
+
// 5.1.7
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
// Matroska segments
|
|
68
|
+
408125543: {
|
|
69
|
+
name: "segment",
|
|
70
|
+
container: {
|
|
71
|
+
// Meta Seek Information (also known as MetaSeek)
|
|
72
|
+
290298740: {
|
|
73
|
+
name: "seekHead",
|
|
74
|
+
container: {
|
|
75
|
+
19899: {
|
|
76
|
+
name: "seek",
|
|
77
|
+
multiple: !0,
|
|
78
|
+
container: {
|
|
79
|
+
21419: { name: "id", value: DataType.binary },
|
|
80
|
+
21420: { name: "position", value: DataType.uint }
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
// Segment Information
|
|
86
|
+
357149030: {
|
|
87
|
+
name: "info",
|
|
88
|
+
container: {
|
|
89
|
+
29604: { name: "uid", value: DataType.uid },
|
|
90
|
+
29572: { name: "filename", value: DataType.string },
|
|
91
|
+
3979555: { name: "prevUID", value: DataType.uid },
|
|
92
|
+
3965867: { name: "prevFilename", value: DataType.string },
|
|
93
|
+
4110627: { name: "nextUID", value: DataType.uid },
|
|
94
|
+
4096955: { name: "nextFilename", value: DataType.string },
|
|
95
|
+
2807729: { name: "timecodeScale", value: DataType.uint },
|
|
96
|
+
17545: { name: "duration", value: DataType.float },
|
|
97
|
+
17505: { name: "dateUTC", value: DataType.uint },
|
|
98
|
+
31657: { name: "title", value: DataType.string },
|
|
99
|
+
19840: { name: "muxingApp", value: DataType.string },
|
|
100
|
+
22337: { name: "writingApp", value: DataType.string }
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
// Cluster
|
|
104
|
+
524531317: {
|
|
105
|
+
name: "cluster",
|
|
106
|
+
multiple: !0,
|
|
107
|
+
container: {
|
|
108
|
+
231: { name: "timecode", value: DataType.uid },
|
|
109
|
+
22743: { name: "silentTracks ", multiple: !0 },
|
|
110
|
+
167: { name: "position", value: DataType.uid },
|
|
111
|
+
171: { name: "prevSize", value: DataType.uid },
|
|
112
|
+
160: { name: "blockGroup" },
|
|
113
|
+
163: { name: "simpleBlock" }
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
// Track
|
|
117
|
+
374648427: {
|
|
118
|
+
name: "tracks",
|
|
119
|
+
container: {
|
|
120
|
+
174: {
|
|
121
|
+
name: "entries",
|
|
122
|
+
multiple: !0,
|
|
123
|
+
container: {
|
|
124
|
+
215: { name: "trackNumber", value: DataType.uint },
|
|
125
|
+
29637: { name: "uid", value: DataType.uid },
|
|
126
|
+
131: { name: "trackType", value: DataType.uint },
|
|
127
|
+
185: { name: "flagEnabled", value: DataType.bool },
|
|
128
|
+
136: { name: "flagDefault", value: DataType.bool },
|
|
129
|
+
21930: { name: "flagForced", value: DataType.bool },
|
|
130
|
+
// extended
|
|
131
|
+
156: { name: "flagLacing", value: DataType.bool },
|
|
132
|
+
28135: { name: "minCache", value: DataType.uint },
|
|
133
|
+
28136: { name: "maxCache", value: DataType.uint },
|
|
134
|
+
2352003: { name: "defaultDuration", value: DataType.uint },
|
|
135
|
+
2306383: { name: "timecodeScale", value: DataType.float },
|
|
136
|
+
21358: { name: "name", value: DataType.string },
|
|
137
|
+
2274716: { name: "language", value: DataType.string },
|
|
138
|
+
134: { name: "codecID", value: DataType.string },
|
|
139
|
+
25506: { name: "codecPrivate", value: DataType.binary },
|
|
140
|
+
2459272: { name: "codecName", value: DataType.string },
|
|
141
|
+
3839639: { name: "codecSettings", value: DataType.string },
|
|
142
|
+
3883072: { name: "codecInfoUrl", value: DataType.string },
|
|
143
|
+
2536e3: { name: "codecDownloadUrl", value: DataType.string },
|
|
144
|
+
170: { name: "codecDecodeAll", value: DataType.bool },
|
|
145
|
+
28587: { name: "trackOverlay", value: DataType.uint },
|
|
146
|
+
// Video
|
|
147
|
+
224: {
|
|
148
|
+
name: "video",
|
|
149
|
+
container: {
|
|
150
|
+
154: { name: "flagInterlaced", value: DataType.bool },
|
|
151
|
+
21432: { name: "stereoMode", value: DataType.uint },
|
|
152
|
+
176: { name: "pixelWidth", value: DataType.uint },
|
|
153
|
+
186: { name: "pixelHeight", value: DataType.uint },
|
|
154
|
+
21680: { name: "displayWidth", value: DataType.uint },
|
|
155
|
+
21690: { name: "displayHeight", value: DataType.uint },
|
|
156
|
+
21683: { name: "aspectRatioType", value: DataType.uint },
|
|
157
|
+
3061028: { name: "colourSpace", value: DataType.uint },
|
|
158
|
+
3126563: { name: "gammaValue", value: DataType.float }
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
// Audio
|
|
162
|
+
225: {
|
|
163
|
+
name: "audio",
|
|
164
|
+
container: {
|
|
165
|
+
181: { name: "samplingFrequency", value: DataType.float },
|
|
166
|
+
30901: { name: "outputSamplingFrequency", value: DataType.float },
|
|
167
|
+
159: { name: "channels", value: DataType.uint },
|
|
168
|
+
// https://www.matroska.org/technical/specs/index.html
|
|
169
|
+
148: { name: "channels", value: DataType.uint },
|
|
170
|
+
32123: { name: "channelPositions", value: DataType.binary },
|
|
171
|
+
25188: { name: "bitDepth", value: DataType.uint }
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
// Content Encoding
|
|
175
|
+
28032: {
|
|
176
|
+
name: "contentEncodings",
|
|
177
|
+
container: {
|
|
178
|
+
25152: {
|
|
179
|
+
name: "contentEncoding",
|
|
180
|
+
container: {
|
|
181
|
+
20529: { name: "order", value: DataType.uint },
|
|
182
|
+
20530: { name: "scope", value: DataType.bool },
|
|
183
|
+
20531: { name: "type", value: DataType.uint },
|
|
184
|
+
20532: {
|
|
185
|
+
name: "contentEncoding",
|
|
186
|
+
container: {
|
|
187
|
+
16980: { name: "contentCompAlgo", value: DataType.uint },
|
|
188
|
+
16981: { name: "contentCompSettings", value: DataType.binary }
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
20533: {
|
|
192
|
+
name: "contentEncoding",
|
|
193
|
+
container: {
|
|
194
|
+
18401: { name: "contentEncAlgo", value: DataType.uint },
|
|
195
|
+
18402: { name: "contentEncKeyID", value: DataType.binary },
|
|
196
|
+
18403: { name: "contentSignature ", value: DataType.binary },
|
|
197
|
+
18404: { name: "ContentSigKeyID ", value: DataType.binary },
|
|
198
|
+
18405: { name: "contentSigAlgo ", value: DataType.uint },
|
|
199
|
+
18406: { name: "contentSigHashAlgo ", value: DataType.uint }
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
25188: { name: "bitDepth", value: DataType.uint }
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
// Cueing Data
|
|
212
|
+
475249515: {
|
|
213
|
+
name: "cues",
|
|
214
|
+
container: {
|
|
215
|
+
187: {
|
|
216
|
+
name: "cuePoint",
|
|
217
|
+
container: {
|
|
218
|
+
179: { name: "cueTime", value: DataType.uid },
|
|
219
|
+
183: {
|
|
220
|
+
name: "positions",
|
|
221
|
+
container: {
|
|
222
|
+
247: { name: "track", value: DataType.uint },
|
|
223
|
+
241: { name: "clusterPosition", value: DataType.uint },
|
|
224
|
+
21368: { name: "blockNumber", value: DataType.uint },
|
|
225
|
+
234: { name: "codecState", value: DataType.uint },
|
|
226
|
+
219: {
|
|
227
|
+
name: "reference",
|
|
228
|
+
container: {
|
|
229
|
+
150: { name: "time", value: DataType.uint },
|
|
230
|
+
151: { name: "cluster", value: DataType.uint },
|
|
231
|
+
21343: { name: "number", value: DataType.uint },
|
|
232
|
+
235: { name: "codecState", value: DataType.uint }
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
240: { name: "relativePosition", value: DataType.uint }
|
|
236
|
+
// extended
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
// Attachment
|
|
244
|
+
423732329: {
|
|
245
|
+
name: "attachments",
|
|
246
|
+
container: {
|
|
247
|
+
24999: {
|
|
248
|
+
name: "attachedFiles",
|
|
249
|
+
multiple: !0,
|
|
250
|
+
container: {
|
|
251
|
+
18046: { name: "description", value: DataType.string },
|
|
252
|
+
18030: { name: "name", value: DataType.string },
|
|
253
|
+
18016: { name: "mimeType", value: DataType.string },
|
|
254
|
+
18012: { name: "data", value: DataType.binary },
|
|
255
|
+
18094: { name: "uid", value: DataType.uid }
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
// Chapters
|
|
261
|
+
272869232: {
|
|
262
|
+
name: "chapters",
|
|
263
|
+
container: {
|
|
264
|
+
17849: {
|
|
265
|
+
name: "editionEntry",
|
|
266
|
+
container: {
|
|
267
|
+
182: {
|
|
268
|
+
name: "chapterAtom",
|
|
269
|
+
container: {
|
|
270
|
+
29636: { name: "uid", value: DataType.uid },
|
|
271
|
+
145: { name: "timeStart", value: DataType.uint },
|
|
272
|
+
146: { name: "timeEnd", value: DataType.uid },
|
|
273
|
+
152: { name: "hidden", value: DataType.bool },
|
|
274
|
+
17816: { name: "enabled", value: DataType.uid },
|
|
275
|
+
143: {
|
|
276
|
+
name: "track",
|
|
277
|
+
container: {
|
|
278
|
+
137: { name: "trackNumber", value: DataType.uid },
|
|
279
|
+
128: {
|
|
280
|
+
name: "display",
|
|
281
|
+
container: {
|
|
282
|
+
133: { name: "string", value: DataType.string },
|
|
283
|
+
17276: { name: "language ", value: DataType.string },
|
|
284
|
+
17278: { name: "country ", value: DataType.string }
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
// Tagging
|
|
296
|
+
307544935: {
|
|
297
|
+
name: "tags",
|
|
298
|
+
container: {
|
|
299
|
+
29555: {
|
|
300
|
+
name: "tag",
|
|
301
|
+
multiple: !0,
|
|
302
|
+
container: {
|
|
303
|
+
25536: {
|
|
304
|
+
name: "target",
|
|
305
|
+
container: {
|
|
306
|
+
25541: { name: "tagTrackUID", value: DataType.uid },
|
|
307
|
+
25540: { name: "tagChapterUID", value: DataType.uint },
|
|
308
|
+
25542: { name: "tagAttachmentUID", value: DataType.uid },
|
|
309
|
+
25546: { name: "targetType", value: DataType.string },
|
|
310
|
+
// extended
|
|
311
|
+
26826: { name: "targetTypeValue", value: DataType.uint },
|
|
312
|
+
// extended
|
|
313
|
+
25545: { name: "tagEditionUID", value: DataType.uid }
|
|
314
|
+
// extended
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
26568: {
|
|
318
|
+
name: "simpleTags",
|
|
319
|
+
multiple: !0,
|
|
320
|
+
container: {
|
|
321
|
+
17827: { name: "name", value: DataType.string },
|
|
322
|
+
17543: { name: "string", value: DataType.string },
|
|
323
|
+
17541: { name: "binary", value: DataType.binary },
|
|
324
|
+
17530: { name: "language", value: DataType.string },
|
|
325
|
+
// extended
|
|
326
|
+
17531: { name: "languageIETF", value: DataType.string },
|
|
327
|
+
// extended
|
|
328
|
+
17540: { name: "default", value: DataType.bool }
|
|
329
|
+
// extended
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
// node_modules/music-metadata/lib/ebml/EbmlIterator.js
|
|
342
|
+
var import_debug = __toESM(require_src(), 1);
|
|
343
|
+
var debug = (0, import_debug.default)("music-metadata:parser:ebml"), EbmlContentError = class extends makeUnexpectedFileContentError("EBML") {
|
|
344
|
+
}, ParseAction = {
|
|
345
|
+
ReadNext: 0,
|
|
346
|
+
// Continue reading the next elements
|
|
347
|
+
IgnoreElement: 2,
|
|
348
|
+
// Ignore (do not read) this element
|
|
349
|
+
SkipSiblings: 3,
|
|
350
|
+
// Skip all remaining elements at the same level
|
|
351
|
+
TerminateParsing: 4,
|
|
352
|
+
// Terminate the parsing process
|
|
353
|
+
SkipElement: 5
|
|
354
|
+
// Consider the element has read, assume position is at the next element
|
|
355
|
+
}, EbmlIterator = class {
|
|
356
|
+
/**
|
|
357
|
+
* @param {ITokenizer} tokenizer Input
|
|
358
|
+
* @param tokenizer
|
|
359
|
+
*/
|
|
360
|
+
constructor(tokenizer) {
|
|
361
|
+
this.parserMap = /* @__PURE__ */ new Map(), this.ebmlMaxIDLength = 4, this.ebmlMaxSizeLength = 8, this.tokenizer = tokenizer, this.parserMap.set(DataType.uint, (e) => this.readUint(e)), this.parserMap.set(DataType.string, (e) => this.readString(e)), this.parserMap.set(DataType.binary, (e) => this.readBuffer(e)), this.parserMap.set(DataType.uid, async (e) => this.readBuffer(e)), this.parserMap.set(DataType.bool, (e) => this.readFlag(e)), this.parserMap.set(DataType.float, (e) => this.readFloat(e));
|
|
362
|
+
}
|
|
363
|
+
async iterate(dtdElement, posDone, listener) {
|
|
364
|
+
return this.parseContainer(linkParents(dtdElement), posDone, listener);
|
|
365
|
+
}
|
|
366
|
+
async parseContainer(dtdElement, posDone, listener) {
|
|
367
|
+
let tree = {};
|
|
368
|
+
for (; this.tokenizer.position < posDone; ) {
|
|
369
|
+
let element, elementPosition = this.tokenizer.position;
|
|
370
|
+
try {
|
|
371
|
+
element = await this.readElement();
|
|
372
|
+
} catch (error) {
|
|
373
|
+
if (error instanceof EndOfStreamError)
|
|
374
|
+
break;
|
|
375
|
+
throw error;
|
|
376
|
+
}
|
|
377
|
+
let child = dtdElement.container[element.id];
|
|
378
|
+
if (child)
|
|
379
|
+
switch (listener.startNext(child)) {
|
|
380
|
+
case ParseAction.ReadNext:
|
|
381
|
+
if (element.id, debug(`Read element: name=${getElementPath(child)}{id=0x${element.id.toString(16)}, container=${!!child.container}} at position=${elementPosition}`), child.container) {
|
|
382
|
+
let res = await this.parseContainer(child, element.len >= 0 ? this.tokenizer.position + element.len : -1, listener);
|
|
383
|
+
child.multiple ? (tree[child.name] || (tree[child.name] = []), tree[child.name].push(res)) : tree[child.name] = res, await listener.elementValue(child, res, elementPosition);
|
|
384
|
+
} else {
|
|
385
|
+
let parser = this.parserMap.get(child.value);
|
|
386
|
+
if (typeof parser == "function") {
|
|
387
|
+
let value = await parser(element);
|
|
388
|
+
tree[child.name] = value, await listener.elementValue(child, value, elementPosition);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
break;
|
|
392
|
+
case ParseAction.SkipElement:
|
|
393
|
+
debug(`Go to next element: name=${getElementPath(child)}, element.id=0x${element.id}, container=${!!child.container} at position=${elementPosition}`);
|
|
394
|
+
break;
|
|
395
|
+
case ParseAction.IgnoreElement:
|
|
396
|
+
debug(`Ignore element: name=${getElementPath(child)}, element.id=0x${element.id}, container=${!!child.container} at position=${elementPosition}`), await this.tokenizer.ignore(element.len);
|
|
397
|
+
break;
|
|
398
|
+
case ParseAction.SkipSiblings:
|
|
399
|
+
debug(`Ignore remaining container, at: name=${getElementPath(child)}, element.id=0x${element.id}, container=${!!child.container} at position=${elementPosition}`), await this.tokenizer.ignore(posDone - this.tokenizer.position);
|
|
400
|
+
break;
|
|
401
|
+
case ParseAction.TerminateParsing:
|
|
402
|
+
return debug(`Terminate parsing at element: name=${getElementPath(child)}, element.id=0x${element.id}, container=${!!child.container} at position=${elementPosition}`), tree;
|
|
403
|
+
}
|
|
404
|
+
else
|
|
405
|
+
element.id === 236 ? await this.tokenizer.ignore(element.len) : (debug(`parseEbml: parent=${getElementPath(dtdElement)}, unknown child: id=${element.id.toString(16)} at position=${elementPosition}`), await this.tokenizer.ignore(element.len));
|
|
406
|
+
}
|
|
407
|
+
return tree;
|
|
408
|
+
}
|
|
409
|
+
async readVintData(maxLength) {
|
|
410
|
+
let msb = await this.tokenizer.peekNumber(UINT8), mask = 128, oc = 1;
|
|
411
|
+
for (; (msb & mask) === 0; ) {
|
|
412
|
+
if (oc > maxLength)
|
|
413
|
+
throw new EbmlContentError("VINT value exceeding maximum size");
|
|
414
|
+
++oc, mask >>= 1;
|
|
415
|
+
}
|
|
416
|
+
let id = new Uint8Array(oc);
|
|
417
|
+
return await this.tokenizer.readBuffer(id), id;
|
|
418
|
+
}
|
|
419
|
+
async readElement() {
|
|
420
|
+
let id = await this.readVintData(this.ebmlMaxIDLength), lenField = await this.readVintData(this.ebmlMaxSizeLength);
|
|
421
|
+
return lenField[0] ^= 128 >> lenField.length - 1, {
|
|
422
|
+
id: readUIntBE(id, id.length),
|
|
423
|
+
len: readUIntBE(lenField, lenField.length)
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
async readFloat(e) {
|
|
427
|
+
switch (e.len) {
|
|
428
|
+
case 0:
|
|
429
|
+
return 0;
|
|
430
|
+
case 4:
|
|
431
|
+
return this.tokenizer.readNumber(Float32_BE);
|
|
432
|
+
case 8:
|
|
433
|
+
return this.tokenizer.readNumber(Float64_BE);
|
|
434
|
+
case 10:
|
|
435
|
+
return this.tokenizer.readNumber(Float64_BE);
|
|
436
|
+
default:
|
|
437
|
+
throw new EbmlContentError(`Invalid IEEE-754 float length: ${e.len}`);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
async readFlag(e) {
|
|
441
|
+
return await this.readUint(e) === 1;
|
|
442
|
+
}
|
|
443
|
+
async readUint(e) {
|
|
444
|
+
let buf = await this.readBuffer(e);
|
|
445
|
+
return readUIntBE(buf, e.len);
|
|
446
|
+
}
|
|
447
|
+
async readString(e) {
|
|
448
|
+
return (await this.tokenizer.readToken(new StringType(e.len, "utf-8"))).replace(/\x00.*$/g, "");
|
|
449
|
+
}
|
|
450
|
+
async readBuffer(e) {
|
|
451
|
+
let buf = new Uint8Array(e.len);
|
|
452
|
+
return await this.tokenizer.readBuffer(buf), buf;
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
function readUIntBE(buf, len) {
|
|
456
|
+
return Number(readUIntBeAsBigInt(buf, len));
|
|
457
|
+
}
|
|
458
|
+
function readUIntBeAsBigInt(buf, len) {
|
|
459
|
+
let normalizedNumber = new Uint8Array(8), cleanNumber = buf.subarray(0, len);
|
|
460
|
+
try {
|
|
461
|
+
return normalizedNumber.set(cleanNumber, 8 - len), UINT64_BE.get(normalizedNumber, 0);
|
|
462
|
+
} catch {
|
|
463
|
+
return BigInt(-1);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
function linkParents(element) {
|
|
467
|
+
return element.container && Object.keys(element.container).map((id) => {
|
|
468
|
+
let child = element.container[id];
|
|
469
|
+
return child.id = Number.parseInt(id, 10), child;
|
|
470
|
+
}).forEach((child) => {
|
|
471
|
+
child.parent = element, linkParents(child);
|
|
472
|
+
}), element;
|
|
473
|
+
}
|
|
474
|
+
function getElementPath(element) {
|
|
475
|
+
let path = "";
|
|
476
|
+
return element.parent && element.parent.name !== "dtd" && (path += `${getElementPath(element.parent)}/`), path + element.name;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
// node_modules/music-metadata/lib/matroska/MatroskaParser.js
|
|
480
|
+
var debug2 = (0, import_debug2.default)("music-metadata:parser:matroska"), MatroskaParser = class extends BasicParser {
|
|
481
|
+
constructor() {
|
|
482
|
+
super(...arguments), this.seekHeadOffset = 0, this.flagUseIndexToSkipClusters = this.options.mkvUseIndex ?? !1;
|
|
483
|
+
}
|
|
484
|
+
async parse() {
|
|
485
|
+
let containerSize = this.tokenizer.fileInfo.size ?? Number.MAX_SAFE_INTEGER, matroskaIterator = new EbmlIterator(this.tokenizer);
|
|
486
|
+
debug2("Initializing DTD end MatroskaIterator"), await matroskaIterator.iterate(matroskaDtd, containerSize, {
|
|
487
|
+
startNext: (element) => {
|
|
488
|
+
switch (element.id) {
|
|
489
|
+
// case 0x1f43b675: // cluster
|
|
490
|
+
case 475249515:
|
|
491
|
+
return debug2(`Skip element: name=${element.name}, id=0x${element.id.toString(16)}`), ParseAction.IgnoreElement;
|
|
492
|
+
case 524531317:
|
|
493
|
+
if (this.flagUseIndexToSkipClusters && this.seekHead) {
|
|
494
|
+
let index = this.seekHead.seek.find((index2) => index2.position + this.seekHeadOffset > this.tokenizer.position);
|
|
495
|
+
if (index) {
|
|
496
|
+
let ignoreSize = index.position + this.seekHeadOffset - this.tokenizer.position;
|
|
497
|
+
return debug2(`Use index to go to next position, ignoring ${ignoreSize} bytes`), this.tokenizer.ignore(ignoreSize), ParseAction.SkipElement;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
return ParseAction.IgnoreElement;
|
|
501
|
+
default:
|
|
502
|
+
return ParseAction.ReadNext;
|
|
503
|
+
}
|
|
504
|
+
},
|
|
505
|
+
elementValue: async (element, value, offset) => {
|
|
506
|
+
switch (debug2(`Received: name=${element.name}, value=${value}`), element.id) {
|
|
507
|
+
case 17026:
|
|
508
|
+
this.metadata.setFormat("container", `EBML/${value}`);
|
|
509
|
+
break;
|
|
510
|
+
case 290298740:
|
|
511
|
+
this.seekHead = value, this.seekHeadOffset = offset;
|
|
512
|
+
break;
|
|
513
|
+
case 357149030:
|
|
514
|
+
{
|
|
515
|
+
let info = value, timecodeScale = info.timecodeScale ? info.timecodeScale : 1e6;
|
|
516
|
+
if (typeof info.duration == "number") {
|
|
517
|
+
let duration = info.duration * timecodeScale / 1e9;
|
|
518
|
+
await this.addTag("segment:title", info.title), this.metadata.setFormat("duration", Number(duration));
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
break;
|
|
522
|
+
case 374648427:
|
|
523
|
+
{
|
|
524
|
+
let audioTracks = value;
|
|
525
|
+
if (audioTracks?.entries) {
|
|
526
|
+
audioTracks.entries.forEach((entry) => {
|
|
527
|
+
let stream = {
|
|
528
|
+
codecName: entry.codecID.replace("A_", "").replace("V_", ""),
|
|
529
|
+
codecSettings: entry.codecSettings,
|
|
530
|
+
flagDefault: entry.flagDefault,
|
|
531
|
+
flagLacing: entry.flagLacing,
|
|
532
|
+
flagEnabled: entry.flagEnabled,
|
|
533
|
+
language: entry.language,
|
|
534
|
+
name: entry.name,
|
|
535
|
+
type: entry.trackType,
|
|
536
|
+
audio: entry.audio,
|
|
537
|
+
video: entry.video
|
|
538
|
+
};
|
|
539
|
+
this.metadata.addStreamInfo(stream);
|
|
540
|
+
});
|
|
541
|
+
let audioTrack = audioTracks.entries.filter((entry) => entry.trackType === TrackType.audio).reduce((acc, cur) => !acc || cur.flagDefault && !acc.flagDefault || cur.trackNumber < acc.trackNumber ? cur : acc, null);
|
|
542
|
+
audioTrack && (this.metadata.setFormat("codec", audioTrack.codecID.replace("A_", "")), this.metadata.setFormat("sampleRate", audioTrack.audio.samplingFrequency), this.metadata.setFormat("numberOfChannels", audioTrack.audio.channels));
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
break;
|
|
546
|
+
case 307544935:
|
|
547
|
+
{
|
|
548
|
+
let tags = value;
|
|
549
|
+
await Promise.all(tags.tag.map(async (tag) => {
|
|
550
|
+
let target = tag.target, targetType = target?.targetTypeValue ? TargetType[target.targetTypeValue] : target?.targetType ? target.targetType : "track";
|
|
551
|
+
await Promise.all(tag.simpleTags.map(async (simpleTag) => {
|
|
552
|
+
let value2 = simpleTag.string ? simpleTag.string : simpleTag.binary;
|
|
553
|
+
await this.addTag(`${targetType}:${simpleTag.name}`, value2);
|
|
554
|
+
}));
|
|
555
|
+
}));
|
|
556
|
+
}
|
|
557
|
+
break;
|
|
558
|
+
case 423732329:
|
|
559
|
+
{
|
|
560
|
+
let attachments = value;
|
|
561
|
+
await Promise.all(attachments.attachedFiles.filter((file) => file.mimeType.startsWith("image/")).map((file) => this.addTag("picture", {
|
|
562
|
+
data: file.data,
|
|
563
|
+
format: file.mimeType,
|
|
564
|
+
description: file.description,
|
|
565
|
+
name: file.name
|
|
566
|
+
})));
|
|
567
|
+
}
|
|
568
|
+
break;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
async addTag(tagId, value) {
|
|
574
|
+
await this.metadata.addTag("matroska", tagId, value);
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
export {
|
|
578
|
+
MatroskaParser
|
|
579
|
+
};
|