@utilix-tech/sdk 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,132 @@
1
+ type ImageFormat = 'png' | 'jpeg' | 'gif' | 'webp' | 'bmp';
2
+ interface ImageInfo {
3
+ format: ImageFormat;
4
+ width: number;
5
+ height: number;
6
+ bitDepth?: number;
7
+ colorType?: string;
8
+ hasAlpha?: boolean;
9
+ }
10
+ interface ImageInfoError {
11
+ error: string;
12
+ }
13
+ /**
14
+ * Read image format, dimensions, and basic color info straight from file
15
+ * bytes — no decoding, no image library, no canvas. Supports PNG, JPEG,
16
+ * GIF, WebP, and BMP.
17
+ */
18
+ declare function readImageInfo(bytes: Uint8Array): ImageInfo | ImageInfoError;
19
+ interface ExifData {
20
+ make?: string;
21
+ model?: string;
22
+ software?: string;
23
+ orientation?: number;
24
+ orientationLabel?: string;
25
+ dateTime?: string;
26
+ dateTimeOriginal?: string;
27
+ exposureTime?: string;
28
+ fNumber?: number;
29
+ isoSpeed?: number;
30
+ focalLength?: number;
31
+ gpsLatitude?: number;
32
+ gpsLongitude?: number;
33
+ tagCount: number;
34
+ }
35
+ interface ExifError {
36
+ error: string;
37
+ }
38
+ /**
39
+ * Read common EXIF tags (make, model, orientation, timestamps, exposure
40
+ * settings, GPS coordinates) directly from a JPEG's APP1 segment. Only
41
+ * JPEG is supported: PNG, WebP, and other formats don't carry EXIF the
42
+ * same way and are rejected with an error.
43
+ */
44
+ declare function readExifData(bytes: Uint8Array): ExifData | ExifError;
45
+ interface PdfMetadata {
46
+ version: string | null;
47
+ pageCount: number | null;
48
+ title: string | null;
49
+ author: string | null;
50
+ subject: string | null;
51
+ keywords: string | null;
52
+ creator: string | null;
53
+ producer: string | null;
54
+ creationDate: string | null;
55
+ modDate: string | null;
56
+ encrypted: boolean;
57
+ }
58
+ interface PdfMetadataError {
59
+ error: string;
60
+ }
61
+ /**
62
+ * Read PDF metadata (title, author, dates, page count, encryption flag)
63
+ * straight from the file's trailer/Info dictionary and page tree — no
64
+ * pdf.js or other PDF rendering library required.
65
+ */
66
+ declare function readPdfMetadata(bytes: Uint8Array): PdfMetadata | PdfMetadataError;
67
+ interface WavInfo {
68
+ audioFormat: number;
69
+ audioFormatLabel: string;
70
+ channels: number;
71
+ sampleRate: number;
72
+ byteRate: number;
73
+ blockAlign: number;
74
+ bitsPerSample: number;
75
+ dataSize: number;
76
+ durationSeconds: number;
77
+ fileSize: number;
78
+ }
79
+ interface WavInfoError {
80
+ error: string;
81
+ }
82
+ /**
83
+ * Read a WAV file's RIFF/fmt/data chunk headers to report sample rate,
84
+ * channel count, bit depth, and duration, without decoding any audio
85
+ * samples. Only the canonical RIFF/WAVE container is supported (not the
86
+ * rarer RF64 variant used for files over 4GB).
87
+ */
88
+ declare function readWavInfo(bytes: Uint8Array): WavInfo | WavInfoError;
89
+ interface Id3Tags {
90
+ version: string;
91
+ title?: string;
92
+ artist?: string;
93
+ album?: string;
94
+ year?: string;
95
+ genre?: string;
96
+ comment?: string;
97
+ trackNumber?: string;
98
+ frameCount?: number;
99
+ }
100
+ interface Id3TagsError {
101
+ error: string;
102
+ }
103
+ /**
104
+ * Read ID3 tags (title, artist, album, year, genre, comment, track number)
105
+ * directly from an MP3 file's bytes, without any audio-decoding library.
106
+ * Prefers an ID3v2.3/2.4 header at the start of the file; falls back to a
107
+ * classic ID3v1/1.1 128-byte trailer if no ID3v2 text frames are found.
108
+ * ID3v2.2 tags are detected but their 3-character frame IDs are not decoded.
109
+ */
110
+ declare function readId3Tags(bytes: Uint8Array): Id3Tags | Id3TagsError;
111
+
112
+ type media_ExifData = ExifData;
113
+ type media_ExifError = ExifError;
114
+ type media_Id3Tags = Id3Tags;
115
+ type media_Id3TagsError = Id3TagsError;
116
+ type media_ImageFormat = ImageFormat;
117
+ type media_ImageInfo = ImageInfo;
118
+ type media_ImageInfoError = ImageInfoError;
119
+ type media_PdfMetadata = PdfMetadata;
120
+ type media_PdfMetadataError = PdfMetadataError;
121
+ type media_WavInfo = WavInfo;
122
+ type media_WavInfoError = WavInfoError;
123
+ declare const media_readExifData: typeof readExifData;
124
+ declare const media_readId3Tags: typeof readId3Tags;
125
+ declare const media_readImageInfo: typeof readImageInfo;
126
+ declare const media_readPdfMetadata: typeof readPdfMetadata;
127
+ declare const media_readWavInfo: typeof readWavInfo;
128
+ declare namespace media {
129
+ export { type media_ExifData as ExifData, type media_ExifError as ExifError, type media_Id3Tags as Id3Tags, type media_Id3TagsError as Id3TagsError, type media_ImageFormat as ImageFormat, type media_ImageInfo as ImageInfo, type media_ImageInfoError as ImageInfoError, type media_PdfMetadata as PdfMetadata, type media_PdfMetadataError as PdfMetadataError, type media_WavInfo as WavInfo, type media_WavInfoError as WavInfoError, media_readExifData as readExifData, media_readId3Tags as readId3Tags, media_readImageInfo as readImageInfo, media_readPdfMetadata as readPdfMetadata, media_readWavInfo as readWavInfo };
130
+ }
131
+
132
+ export { type ExifData as E, type Id3Tags as I, type PdfMetadata as P, type WavInfo as W, type ExifError as a, type Id3TagsError as b, type ImageFormat as c, type ImageInfo as d, type ImageInfoError as e, type PdfMetadataError as f, type WavInfoError as g, readId3Tags as h, readImageInfo as i, readPdfMetadata as j, readWavInfo as k, media as m, readExifData as r };
@@ -256,6 +256,25 @@ interface PassiveVoiceResult {
256
256
  * "was written", "is being reviewed", "were quickly approved by the team".
257
257
  */
258
258
  declare function detectPassiveVoice(text: string): PassiveVoiceResult;
259
+ interface ReadabilityResult {
260
+ wordCount: number;
261
+ sentenceCount: number;
262
+ syllableCount: number;
263
+ complexWordCount: number;
264
+ avgWordsPerSentence: number;
265
+ avgSyllablesPerWord: number;
266
+ fleschReadingEase: number;
267
+ fleschKincaidGrade: number;
268
+ gunningFog: number;
269
+ readingLevel: string;
270
+ }
271
+ /**
272
+ * Score pasted text with Flesch Reading Ease, Flesch-Kincaid Grade Level,
273
+ * and Gunning Fog Index, using a heuristic syllable counter (vowel-group
274
+ * counting with common English spelling adjustments) rather than a
275
+ * dictionary lookup, so scores are an estimate rather than exact.
276
+ */
277
+ declare function scoreReadability(text: string): ReadabilityResult;
259
278
 
260
279
  type text_AsciiFont = AsciiFont;
261
280
  type text_AsciiOptions = AsciiOptions;
@@ -283,6 +302,7 @@ type text_ParsedTable = ParsedTable;
283
302
  type text_PassiveVoiceMatch = PassiveVoiceMatch;
284
303
  type text_PassiveVoiceResult = PassiveVoiceResult;
285
304
  type text_PassiveVoiceSentence = PassiveVoiceSentence;
305
+ type text_ReadabilityResult = ReadabilityResult;
286
306
  type text_ReadabilityScore = ReadabilityScore;
287
307
  type text_SlugSeparator = SlugSeparator;
288
308
  type text_TableOptions = TableOptions;
@@ -330,6 +350,7 @@ declare const text_parseTableData: typeof parseTableData;
330
350
  declare const text_readabilityScore: typeof readabilityScore;
331
351
  declare const text_renderMarkdown: typeof renderMarkdown;
332
352
  declare const text_romanToNumber: typeof romanToNumber;
353
+ declare const text_scoreReadability: typeof scoreReadability;
333
354
  declare const text_sentenceCount: typeof sentenceCount;
334
355
  declare const text_slugify: typeof slugify;
335
356
  declare const text_slugifyAll: typeof slugifyAll;
@@ -339,7 +360,7 @@ declare const text_textToMorse: typeof textToMorse;
339
360
  declare const text_unescapeString: typeof unescapeString;
340
361
  declare const text_wordFrequency: typeof wordFrequency;
341
362
  declare namespace text {
342
- export { type text_AsciiFont as AsciiFont, type text_AsciiOptions as AsciiOptions, text_CASE_FORMATS as CASE_FORMATS, type text_CaseFormat as CaseFormat, type text_ConvertOptions as ConvertOptions, text_DEFAULT_CONVERT_OPTIONS as DEFAULT_CONVERT_OPTIONS, type text_DiffFile as DiffFile, type text_DiffHunk as DiffHunk, type text_DiffLine as DiffLine, type text_DiffResult as DiffResult, type text_DiffType as DiffType, type text_DiffViewerLine as DiffViewerLine, text_ESCAPE_MODES as ESCAPE_MODES, type text_EscapeMode as EscapeMode, text_LINE_OPS as LINE_OPS, type text_LineOp as LineOp, type text_LineType as LineType, type text_LoremUnit as LoremUnit, text_MORSE_CODE as MORSE_CODE, type text_MarkdownResult as MarkdownResult, type text_MorseOptions as MorseOptions, type text_ParsedDiff as ParsedDiff, type text_ParsedTable as ParsedTable, type text_PassiveVoiceMatch as PassiveVoiceMatch, type text_PassiveVoiceResult as PassiveVoiceResult, type text_PassiveVoiceSentence as PassiveVoiceSentence, type text_ReadabilityScore as ReadabilityScore, type text_SlugSeparator as SlugSeparator, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, text_addBorder as addBorder, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_centerText as centerText, text_convertAll as convertAll, text_convertCase as convertCase, text_countWords as countWords, text_csvToHtml as csvToHtml, text_csvToMarkdown as csvToMarkdown, text_detectDelimiter as detectDelimiter, text_detectPassiveVoice as detectPassiveVoice, text_diffLines as diffLines, text_diffLinesSimple as diffLinesSimple, text_diffStats as diffStats, text_escapeAll as escapeAll, text_escapeString as escapeString, text_extractHeadings as extractHeadings, text_formatReadingTime as formatReadingTime, text_generate as generate, text_generateDiff as generateDiff, text_generateHtmlTable as generateHtmlTable, text_generateMarkdownTable as generateMarkdownTable, text_generateParagraphs as generateParagraphs, text_generateSentences as generateSentences, text_generateWords as generateWords, text_getAvailableFonts as getAvailableFonts, text_getMorseForChar as getMorseForChar, text_getMorseTiming as getMorseTiming, text_htmlToMarkdown as htmlToMarkdown, text_isValidMorse as isValidMorse, text_markdownToHtml as markdownToHtml, text_morseToText as morseToText, text_numberToOrdinal as numberToOrdinal, text_numberToRoman as numberToRoman, text_numberToWords as numberToWords, text_ordinalWords as ordinalWords, text_parseDiff as parseDiff, text_parseTableData as parseTableData, text_readabilityScore as readabilityScore, text_renderMarkdown as renderMarkdown, text_romanToNumber as romanToNumber, text_sentenceCount as sentenceCount, text_slugify as slugify, text_slugifyAll as slugifyAll, text_syllableCount as syllableCount, text_textToAscii as textToAscii, text_textToMorse as textToMorse, text_unescapeString as unescapeString, text_wordFrequency as wordFrequency };
363
+ export { type text_AsciiFont as AsciiFont, type text_AsciiOptions as AsciiOptions, text_CASE_FORMATS as CASE_FORMATS, type text_CaseFormat as CaseFormat, type text_ConvertOptions as ConvertOptions, text_DEFAULT_CONVERT_OPTIONS as DEFAULT_CONVERT_OPTIONS, type text_DiffFile as DiffFile, type text_DiffHunk as DiffHunk, type text_DiffLine as DiffLine, type text_DiffResult as DiffResult, type text_DiffType as DiffType, type text_DiffViewerLine as DiffViewerLine, text_ESCAPE_MODES as ESCAPE_MODES, type text_EscapeMode as EscapeMode, text_LINE_OPS as LINE_OPS, type text_LineOp as LineOp, type text_LineType as LineType, type text_LoremUnit as LoremUnit, text_MORSE_CODE as MORSE_CODE, type text_MarkdownResult as MarkdownResult, type text_MorseOptions as MorseOptions, type text_ParsedDiff as ParsedDiff, type text_ParsedTable as ParsedTable, type text_PassiveVoiceMatch as PassiveVoiceMatch, type text_PassiveVoiceResult as PassiveVoiceResult, type text_PassiveVoiceSentence as PassiveVoiceSentence, type text_ReadabilityResult as ReadabilityResult, type text_ReadabilityScore as ReadabilityScore, type text_SlugSeparator as SlugSeparator, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, text_addBorder as addBorder, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_centerText as centerText, text_convertAll as convertAll, text_convertCase as convertCase, text_countWords as countWords, text_csvToHtml as csvToHtml, text_csvToMarkdown as csvToMarkdown, text_detectDelimiter as detectDelimiter, text_detectPassiveVoice as detectPassiveVoice, text_diffLines as diffLines, text_diffLinesSimple as diffLinesSimple, text_diffStats as diffStats, text_escapeAll as escapeAll, text_escapeString as escapeString, text_extractHeadings as extractHeadings, text_formatReadingTime as formatReadingTime, text_generate as generate, text_generateDiff as generateDiff, text_generateHtmlTable as generateHtmlTable, text_generateMarkdownTable as generateMarkdownTable, text_generateParagraphs as generateParagraphs, text_generateSentences as generateSentences, text_generateWords as generateWords, text_getAvailableFonts as getAvailableFonts, text_getMorseForChar as getMorseForChar, text_getMorseTiming as getMorseTiming, text_htmlToMarkdown as htmlToMarkdown, text_isValidMorse as isValidMorse, text_markdownToHtml as markdownToHtml, text_morseToText as morseToText, text_numberToOrdinal as numberToOrdinal, text_numberToRoman as numberToRoman, text_numberToWords as numberToWords, text_ordinalWords as ordinalWords, text_parseDiff as parseDiff, text_parseTableData as parseTableData, text_readabilityScore as readabilityScore, text_renderMarkdown as renderMarkdown, text_romanToNumber as romanToNumber, text_scoreReadability as scoreReadability, text_sentenceCount as sentenceCount, text_slugify as slugify, text_slugifyAll as slugifyAll, text_syllableCount as syllableCount, text_textToAscii as textToAscii, text_textToMorse as textToMorse, text_unescapeString as unescapeString, text_wordFrequency as wordFrequency };
343
364
  }
344
365
 
345
- export { generateHtmlTable as $, type AsciiFont as A, convertAll as B, CASE_FORMATS as C, DEFAULT_CONVERT_OPTIONS as D, ESCAPE_MODES as E, convertCase as F, countWords as G, csvToHtml as H, csvToMarkdown as I, detectDelimiter as J, detectPassiveVoice as K, LINE_OPS as L, MORSE_CODE as M, diffLines as N, diffLinesSimple as O, type ParsedDiff as P, diffStats as Q, type ReadabilityScore as R, type SlugSeparator as S, type TableOptions as T, escapeAll as U, escapeString as V, type WordCountResult as W, extractHeadings as X, formatReadingTime as Y, generate as Z, generateDiff as _, type AsciiOptions as a, generateMarkdownTable as a0, generateParagraphs as a1, generateSentences as a2, generateWords as a3, getAvailableFonts as a4, getMorseForChar as a5, getMorseTiming as a6, htmlToMarkdown as a7, isValidMorse as a8, markdownToHtml as a9, morseToText as aa, numberToOrdinal as ab, numberToRoman as ac, numberToWords as ad, ordinalWords as ae, parseDiff as af, parseTableData as ag, readabilityScore as ah, renderMarkdown as ai, romanToNumber as aj, sentenceCount as ak, slugify as al, slugifyAll as am, syllableCount as an, textToAscii as ao, textToMorse as ap, unescapeString as aq, wordFrequency as ar, type CaseFormat as b, type ConvertOptions as c, type DiffFile as d, type DiffHunk as e, type DiffLine as f, type DiffResult as g, type DiffType as h, type DiffViewerLine as i, type EscapeMode as j, type LineOp as k, type LineType as l, type LoremUnit as m, type MarkdownResult as n, type MorseOptions as o, type ParsedTable as p, type PassiveVoiceMatch as q, type PassiveVoiceResult as r, type PassiveVoiceSentence as s, text as t, type TextAnalysis as u, addBorder as v, analyzeText as w, applyOp as x, applyOps as y, centerText as z };
366
+ export { generateDiff as $, type AsciiFont as A, centerText as B, CASE_FORMATS as C, DEFAULT_CONVERT_OPTIONS as D, ESCAPE_MODES as E, convertAll as F, convertCase as G, countWords as H, csvToHtml as I, csvToMarkdown as J, detectDelimiter as K, LINE_OPS as L, MORSE_CODE as M, detectPassiveVoice as N, diffLines as O, type ParsedDiff as P, diffLinesSimple as Q, type ReadabilityResult as R, type SlugSeparator as S, type TableOptions as T, diffStats as U, escapeAll as V, type WordCountResult as W, escapeString as X, extractHeadings as Y, formatReadingTime as Z, generate as _, type AsciiOptions as a, generateHtmlTable as a0, generateMarkdownTable as a1, generateParagraphs as a2, generateSentences as a3, generateWords as a4, getAvailableFonts as a5, getMorseForChar as a6, getMorseTiming as a7, htmlToMarkdown as a8, isValidMorse as a9, markdownToHtml as aa, morseToText as ab, numberToOrdinal as ac, numberToRoman as ad, numberToWords as ae, ordinalWords as af, parseDiff as ag, parseTableData as ah, readabilityScore as ai, renderMarkdown as aj, romanToNumber as ak, scoreReadability as al, sentenceCount as am, slugify as an, slugifyAll as ao, syllableCount as ap, textToAscii as aq, textToMorse as ar, unescapeString as as, wordFrequency as at, type CaseFormat as b, type ConvertOptions as c, type DiffFile as d, type DiffHunk as e, type DiffLine as f, type DiffResult as g, type DiffType as h, type DiffViewerLine as i, type EscapeMode as j, type LineOp as k, type LineType as l, type LoremUnit as m, type MarkdownResult as n, type MorseOptions as o, type ParsedTable as p, type PassiveVoiceMatch as q, type PassiveVoiceResult as r, type PassiveVoiceSentence as s, text as t, type ReadabilityScore as u, type TextAnalysis as v, addBorder as w, analyzeText as x, applyOp as y, applyOps as z };
@@ -256,6 +256,25 @@ interface PassiveVoiceResult {
256
256
  * "was written", "is being reviewed", "were quickly approved by the team".
257
257
  */
258
258
  declare function detectPassiveVoice(text: string): PassiveVoiceResult;
259
+ interface ReadabilityResult {
260
+ wordCount: number;
261
+ sentenceCount: number;
262
+ syllableCount: number;
263
+ complexWordCount: number;
264
+ avgWordsPerSentence: number;
265
+ avgSyllablesPerWord: number;
266
+ fleschReadingEase: number;
267
+ fleschKincaidGrade: number;
268
+ gunningFog: number;
269
+ readingLevel: string;
270
+ }
271
+ /**
272
+ * Score pasted text with Flesch Reading Ease, Flesch-Kincaid Grade Level,
273
+ * and Gunning Fog Index, using a heuristic syllable counter (vowel-group
274
+ * counting with common English spelling adjustments) rather than a
275
+ * dictionary lookup, so scores are an estimate rather than exact.
276
+ */
277
+ declare function scoreReadability(text: string): ReadabilityResult;
259
278
 
260
279
  type text_AsciiFont = AsciiFont;
261
280
  type text_AsciiOptions = AsciiOptions;
@@ -283,6 +302,7 @@ type text_ParsedTable = ParsedTable;
283
302
  type text_PassiveVoiceMatch = PassiveVoiceMatch;
284
303
  type text_PassiveVoiceResult = PassiveVoiceResult;
285
304
  type text_PassiveVoiceSentence = PassiveVoiceSentence;
305
+ type text_ReadabilityResult = ReadabilityResult;
286
306
  type text_ReadabilityScore = ReadabilityScore;
287
307
  type text_SlugSeparator = SlugSeparator;
288
308
  type text_TableOptions = TableOptions;
@@ -330,6 +350,7 @@ declare const text_parseTableData: typeof parseTableData;
330
350
  declare const text_readabilityScore: typeof readabilityScore;
331
351
  declare const text_renderMarkdown: typeof renderMarkdown;
332
352
  declare const text_romanToNumber: typeof romanToNumber;
353
+ declare const text_scoreReadability: typeof scoreReadability;
333
354
  declare const text_sentenceCount: typeof sentenceCount;
334
355
  declare const text_slugify: typeof slugify;
335
356
  declare const text_slugifyAll: typeof slugifyAll;
@@ -339,7 +360,7 @@ declare const text_textToMorse: typeof textToMorse;
339
360
  declare const text_unescapeString: typeof unescapeString;
340
361
  declare const text_wordFrequency: typeof wordFrequency;
341
362
  declare namespace text {
342
- export { type text_AsciiFont as AsciiFont, type text_AsciiOptions as AsciiOptions, text_CASE_FORMATS as CASE_FORMATS, type text_CaseFormat as CaseFormat, type text_ConvertOptions as ConvertOptions, text_DEFAULT_CONVERT_OPTIONS as DEFAULT_CONVERT_OPTIONS, type text_DiffFile as DiffFile, type text_DiffHunk as DiffHunk, type text_DiffLine as DiffLine, type text_DiffResult as DiffResult, type text_DiffType as DiffType, type text_DiffViewerLine as DiffViewerLine, text_ESCAPE_MODES as ESCAPE_MODES, type text_EscapeMode as EscapeMode, text_LINE_OPS as LINE_OPS, type text_LineOp as LineOp, type text_LineType as LineType, type text_LoremUnit as LoremUnit, text_MORSE_CODE as MORSE_CODE, type text_MarkdownResult as MarkdownResult, type text_MorseOptions as MorseOptions, type text_ParsedDiff as ParsedDiff, type text_ParsedTable as ParsedTable, type text_PassiveVoiceMatch as PassiveVoiceMatch, type text_PassiveVoiceResult as PassiveVoiceResult, type text_PassiveVoiceSentence as PassiveVoiceSentence, type text_ReadabilityScore as ReadabilityScore, type text_SlugSeparator as SlugSeparator, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, text_addBorder as addBorder, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_centerText as centerText, text_convertAll as convertAll, text_convertCase as convertCase, text_countWords as countWords, text_csvToHtml as csvToHtml, text_csvToMarkdown as csvToMarkdown, text_detectDelimiter as detectDelimiter, text_detectPassiveVoice as detectPassiveVoice, text_diffLines as diffLines, text_diffLinesSimple as diffLinesSimple, text_diffStats as diffStats, text_escapeAll as escapeAll, text_escapeString as escapeString, text_extractHeadings as extractHeadings, text_formatReadingTime as formatReadingTime, text_generate as generate, text_generateDiff as generateDiff, text_generateHtmlTable as generateHtmlTable, text_generateMarkdownTable as generateMarkdownTable, text_generateParagraphs as generateParagraphs, text_generateSentences as generateSentences, text_generateWords as generateWords, text_getAvailableFonts as getAvailableFonts, text_getMorseForChar as getMorseForChar, text_getMorseTiming as getMorseTiming, text_htmlToMarkdown as htmlToMarkdown, text_isValidMorse as isValidMorse, text_markdownToHtml as markdownToHtml, text_morseToText as morseToText, text_numberToOrdinal as numberToOrdinal, text_numberToRoman as numberToRoman, text_numberToWords as numberToWords, text_ordinalWords as ordinalWords, text_parseDiff as parseDiff, text_parseTableData as parseTableData, text_readabilityScore as readabilityScore, text_renderMarkdown as renderMarkdown, text_romanToNumber as romanToNumber, text_sentenceCount as sentenceCount, text_slugify as slugify, text_slugifyAll as slugifyAll, text_syllableCount as syllableCount, text_textToAscii as textToAscii, text_textToMorse as textToMorse, text_unescapeString as unescapeString, text_wordFrequency as wordFrequency };
363
+ export { type text_AsciiFont as AsciiFont, type text_AsciiOptions as AsciiOptions, text_CASE_FORMATS as CASE_FORMATS, type text_CaseFormat as CaseFormat, type text_ConvertOptions as ConvertOptions, text_DEFAULT_CONVERT_OPTIONS as DEFAULT_CONVERT_OPTIONS, type text_DiffFile as DiffFile, type text_DiffHunk as DiffHunk, type text_DiffLine as DiffLine, type text_DiffResult as DiffResult, type text_DiffType as DiffType, type text_DiffViewerLine as DiffViewerLine, text_ESCAPE_MODES as ESCAPE_MODES, type text_EscapeMode as EscapeMode, text_LINE_OPS as LINE_OPS, type text_LineOp as LineOp, type text_LineType as LineType, type text_LoremUnit as LoremUnit, text_MORSE_CODE as MORSE_CODE, type text_MarkdownResult as MarkdownResult, type text_MorseOptions as MorseOptions, type text_ParsedDiff as ParsedDiff, type text_ParsedTable as ParsedTable, type text_PassiveVoiceMatch as PassiveVoiceMatch, type text_PassiveVoiceResult as PassiveVoiceResult, type text_PassiveVoiceSentence as PassiveVoiceSentence, type text_ReadabilityResult as ReadabilityResult, type text_ReadabilityScore as ReadabilityScore, type text_SlugSeparator as SlugSeparator, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, text_addBorder as addBorder, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_centerText as centerText, text_convertAll as convertAll, text_convertCase as convertCase, text_countWords as countWords, text_csvToHtml as csvToHtml, text_csvToMarkdown as csvToMarkdown, text_detectDelimiter as detectDelimiter, text_detectPassiveVoice as detectPassiveVoice, text_diffLines as diffLines, text_diffLinesSimple as diffLinesSimple, text_diffStats as diffStats, text_escapeAll as escapeAll, text_escapeString as escapeString, text_extractHeadings as extractHeadings, text_formatReadingTime as formatReadingTime, text_generate as generate, text_generateDiff as generateDiff, text_generateHtmlTable as generateHtmlTable, text_generateMarkdownTable as generateMarkdownTable, text_generateParagraphs as generateParagraphs, text_generateSentences as generateSentences, text_generateWords as generateWords, text_getAvailableFonts as getAvailableFonts, text_getMorseForChar as getMorseForChar, text_getMorseTiming as getMorseTiming, text_htmlToMarkdown as htmlToMarkdown, text_isValidMorse as isValidMorse, text_markdownToHtml as markdownToHtml, text_morseToText as morseToText, text_numberToOrdinal as numberToOrdinal, text_numberToRoman as numberToRoman, text_numberToWords as numberToWords, text_ordinalWords as ordinalWords, text_parseDiff as parseDiff, text_parseTableData as parseTableData, text_readabilityScore as readabilityScore, text_renderMarkdown as renderMarkdown, text_romanToNumber as romanToNumber, text_scoreReadability as scoreReadability, text_sentenceCount as sentenceCount, text_slugify as slugify, text_slugifyAll as slugifyAll, text_syllableCount as syllableCount, text_textToAscii as textToAscii, text_textToMorse as textToMorse, text_unescapeString as unescapeString, text_wordFrequency as wordFrequency };
343
364
  }
344
365
 
345
- export { generateHtmlTable as $, type AsciiFont as A, convertAll as B, CASE_FORMATS as C, DEFAULT_CONVERT_OPTIONS as D, ESCAPE_MODES as E, convertCase as F, countWords as G, csvToHtml as H, csvToMarkdown as I, detectDelimiter as J, detectPassiveVoice as K, LINE_OPS as L, MORSE_CODE as M, diffLines as N, diffLinesSimple as O, type ParsedDiff as P, diffStats as Q, type ReadabilityScore as R, type SlugSeparator as S, type TableOptions as T, escapeAll as U, escapeString as V, type WordCountResult as W, extractHeadings as X, formatReadingTime as Y, generate as Z, generateDiff as _, type AsciiOptions as a, generateMarkdownTable as a0, generateParagraphs as a1, generateSentences as a2, generateWords as a3, getAvailableFonts as a4, getMorseForChar as a5, getMorseTiming as a6, htmlToMarkdown as a7, isValidMorse as a8, markdownToHtml as a9, morseToText as aa, numberToOrdinal as ab, numberToRoman as ac, numberToWords as ad, ordinalWords as ae, parseDiff as af, parseTableData as ag, readabilityScore as ah, renderMarkdown as ai, romanToNumber as aj, sentenceCount as ak, slugify as al, slugifyAll as am, syllableCount as an, textToAscii as ao, textToMorse as ap, unescapeString as aq, wordFrequency as ar, type CaseFormat as b, type ConvertOptions as c, type DiffFile as d, type DiffHunk as e, type DiffLine as f, type DiffResult as g, type DiffType as h, type DiffViewerLine as i, type EscapeMode as j, type LineOp as k, type LineType as l, type LoremUnit as m, type MarkdownResult as n, type MorseOptions as o, type ParsedTable as p, type PassiveVoiceMatch as q, type PassiveVoiceResult as r, type PassiveVoiceSentence as s, text as t, type TextAnalysis as u, addBorder as v, analyzeText as w, applyOp as x, applyOps as y, centerText as z };
366
+ export { generateDiff as $, type AsciiFont as A, centerText as B, CASE_FORMATS as C, DEFAULT_CONVERT_OPTIONS as D, ESCAPE_MODES as E, convertAll as F, convertCase as G, countWords as H, csvToHtml as I, csvToMarkdown as J, detectDelimiter as K, LINE_OPS as L, MORSE_CODE as M, detectPassiveVoice as N, diffLines as O, type ParsedDiff as P, diffLinesSimple as Q, type ReadabilityResult as R, type SlugSeparator as S, type TableOptions as T, diffStats as U, escapeAll as V, type WordCountResult as W, escapeString as X, extractHeadings as Y, formatReadingTime as Z, generate as _, type AsciiOptions as a, generateHtmlTable as a0, generateMarkdownTable as a1, generateParagraphs as a2, generateSentences as a3, generateWords as a4, getAvailableFonts as a5, getMorseForChar as a6, getMorseTiming as a7, htmlToMarkdown as a8, isValidMorse as a9, markdownToHtml as aa, morseToText as ab, numberToOrdinal as ac, numberToRoman as ad, numberToWords as ae, ordinalWords as af, parseDiff as ag, parseTableData as ah, readabilityScore as ai, renderMarkdown as aj, romanToNumber as ak, scoreReadability as al, sentenceCount as am, slugify as an, slugifyAll as ao, syllableCount as ap, textToAscii as aq, textToMorse as ar, unescapeString as as, wordFrequency as at, type CaseFormat as b, type ConvertOptions as c, type DiffFile as d, type DiffHunk as e, type DiffLine as f, type DiffResult as g, type DiffType as h, type DiffViewerLine as i, type EscapeMode as j, type LineOp as k, type LineType as l, type LoremUnit as m, type MarkdownResult as n, type MorseOptions as o, type ParsedTable as p, type PassiveVoiceMatch as q, type PassiveVoiceResult as r, type PassiveVoiceSentence as s, text as t, type ReadabilityScore as u, type TextAnalysis as v, addBorder as w, analyzeText as x, applyOp as y, applyOps as z };
@@ -1064,6 +1064,23 @@ function envToExport(input) {
1064
1064
  function validateEnvKey(key) {
1065
1065
  return /^[A-Za-z_][A-Za-z0-9_]*$/.test(key);
1066
1066
  }
1067
+ function diffEnvExample(envInput, exampleInput) {
1068
+ const envParsed = parseEnv(envInput);
1069
+ if (envParsed.errors.length > 0) {
1070
+ return { error: `.env: ${envParsed.errors.map((e) => `Line ${e.line}: ${e.message}`).join("; ")}` };
1071
+ }
1072
+ const exampleParsed = parseEnv(exampleInput);
1073
+ if (exampleParsed.errors.length > 0) {
1074
+ return { error: `.env.example: ${exampleParsed.errors.map((e) => `Line ${e.line}: ${e.message}`).join("; ")}` };
1075
+ }
1076
+ const envKeys = new Set(envParsed.entries.map((e) => e.key));
1077
+ const exampleValues = new Map(exampleParsed.entries.map((e) => [e.key, e.value]));
1078
+ const missingInExample = [...envKeys].filter((k) => !exampleValues.has(k)).sort();
1079
+ const missingInEnv = [...exampleValues.keys()].filter((k) => !envKeys.has(k)).sort();
1080
+ const emptyValueInExample = [...exampleValues.entries()].filter(([k, v]) => envKeys.has(k) && v === "").map(([k]) => k).sort();
1081
+ const keysInBoth = [...envKeys].filter((k) => exampleValues.has(k)).length;
1082
+ return { missingInExample, missingInEnv, emptyValueInExample, keysInBoth };
1083
+ }
1067
1084
  function validateNdjson(input) {
1068
1085
  const rawLines = input.split("\n");
1069
1086
  const lines = [];
@@ -1125,6 +1142,7 @@ function jsonArrayToNdjson(input) {
1125
1142
 
1126
1143
  exports.csvToJson = csvToJson;
1127
1144
  exports.detectDelimiter = detectDelimiter;
1145
+ exports.diffEnvExample = diffEnvExample;
1128
1146
  exports.envToExport = envToExport;
1129
1147
  exports.envToJson = envToJson;
1130
1148
  exports.formatNdjson = formatNdjson;
@@ -1 +1 @@
1
- export { C as CsvParseResult, E as EnvEntry, a as EnvParseResult, I as IniSection, N as NdjsonLineResult, b as NdjsonValidateResult, P as ParseOptions, c as ParsedIni, T as TomlFormatResult, V as ValidationResult, X as XmlFormatResult, e as XmlToJsonOptions, f as csvToJson, g as detectDelimiter, h as envToExport, i as envToJson, j as formatNdjson, k as formatToml, l as formatXml, m as getSection, n as getSectionNames, o as getTomlStats, p as getXmlStats, q as getYamlStats, r as iniToJson, s as jsonArrayToNdjson, t as jsonToIni, u as jsonToToml, v as jsonToXml, w as minifyNdjson, x as minifyToml, y as minifyXml, z as ndjsonToJsonArray, A as parseCsv, B as parseEnv, D as parseIni, F as parseXmlToObject, G as stringifyIni, H as toCsvString, J as tomlToJson, K as validateEnvKey, L as validateIni, M as validateNdjson, O as validateToml, Q as validateXml, R as validateYaml, S as xmlToJson } from '../data-CakDxAcT.cjs';
1
+ export { C as CsvParseResult, E as EnvDiffError, a as EnvDiffResult, b as EnvEntry, c as EnvParseResult, I as IniSection, N as NdjsonLineResult, e as NdjsonValidateResult, P as ParseOptions, f as ParsedIni, T as TomlFormatResult, V as ValidationResult, X as XmlFormatResult, g as XmlToJsonOptions, h as csvToJson, i as detectDelimiter, j as diffEnvExample, k as envToExport, l as envToJson, m as formatNdjson, n as formatToml, o as formatXml, p as getSection, q as getSectionNames, r as getTomlStats, s as getXmlStats, t as getYamlStats, u as iniToJson, v as jsonArrayToNdjson, w as jsonToIni, x as jsonToToml, y as jsonToXml, z as minifyNdjson, A as minifyToml, B as minifyXml, D as ndjsonToJsonArray, F as parseCsv, G as parseEnv, H as parseIni, J as parseXmlToObject, K as stringifyIni, L as toCsvString, M as tomlToJson, O as validateEnvKey, Q as validateIni, R as validateNdjson, S as validateToml, U as validateXml, W as validateYaml, Y as xmlToJson } from '../data-D8XTI7Du.cjs';
@@ -1 +1 @@
1
- export { C as CsvParseResult, E as EnvEntry, a as EnvParseResult, I as IniSection, N as NdjsonLineResult, b as NdjsonValidateResult, P as ParseOptions, c as ParsedIni, T as TomlFormatResult, V as ValidationResult, X as XmlFormatResult, e as XmlToJsonOptions, f as csvToJson, g as detectDelimiter, h as envToExport, i as envToJson, j as formatNdjson, k as formatToml, l as formatXml, m as getSection, n as getSectionNames, o as getTomlStats, p as getXmlStats, q as getYamlStats, r as iniToJson, s as jsonArrayToNdjson, t as jsonToIni, u as jsonToToml, v as jsonToXml, w as minifyNdjson, x as minifyToml, y as minifyXml, z as ndjsonToJsonArray, A as parseCsv, B as parseEnv, D as parseIni, F as parseXmlToObject, G as stringifyIni, H as toCsvString, J as tomlToJson, K as validateEnvKey, L as validateIni, M as validateNdjson, O as validateToml, Q as validateXml, R as validateYaml, S as xmlToJson } from '../data-CakDxAcT.js';
1
+ export { C as CsvParseResult, E as EnvDiffError, a as EnvDiffResult, b as EnvEntry, c as EnvParseResult, I as IniSection, N as NdjsonLineResult, e as NdjsonValidateResult, P as ParseOptions, f as ParsedIni, T as TomlFormatResult, V as ValidationResult, X as XmlFormatResult, g as XmlToJsonOptions, h as csvToJson, i as detectDelimiter, j as diffEnvExample, k as envToExport, l as envToJson, m as formatNdjson, n as formatToml, o as formatXml, p as getSection, q as getSectionNames, r as getTomlStats, s as getXmlStats, t as getYamlStats, u as iniToJson, v as jsonArrayToNdjson, w as jsonToIni, x as jsonToToml, y as jsonToXml, z as minifyNdjson, A as minifyToml, B as minifyXml, D as ndjsonToJsonArray, F as parseCsv, G as parseEnv, H as parseIni, J as parseXmlToObject, K as stringifyIni, L as toCsvString, M as tomlToJson, O as validateEnvKey, Q as validateIni, R as validateNdjson, S as validateToml, U as validateXml, W as validateYaml, Y as xmlToJson } from '../data-D8XTI7Du.js';
@@ -1,2 +1,2 @@
1
- export { csvToJson, detectDelimiter, envToExport, envToJson, formatNdjson, formatToml, formatXml, getSection, getSectionNames, getTomlStats, getXmlStats, getYamlStats, iniToJson, jsonArrayToNdjson, jsonToIni, jsonToToml, jsonToXml, minifyNdjson, minifyToml, minifyXml, ndjsonToJsonArray, parseCsv, parseEnv, parseIni, parseXmlToObject, stringifyIni, toCsvString, tomlToJson, validateEnvKey, validateIni, validateNdjson, validateToml, validateXml, validateYaml, xmlToJson } from '../chunk-DNCOIO5N.js';
1
+ export { csvToJson, detectDelimiter, diffEnvExample, envToExport, envToJson, formatNdjson, formatToml, formatXml, getSection, getSectionNames, getTomlStats, getXmlStats, getYamlStats, iniToJson, jsonArrayToNdjson, jsonToIni, jsonToToml, jsonToXml, minifyNdjson, minifyToml, minifyXml, ndjsonToJsonArray, parseCsv, parseEnv, parseIni, parseXmlToObject, stringifyIni, toCsvString, tomlToJson, validateEnvKey, validateIni, validateNdjson, validateToml, validateXml, validateYaml, xmlToJson } from '../chunk-TINQFTLO.js';
2
2
  import '../chunk-MLKGABMK.js';
@@ -457,7 +457,274 @@ function readPdfMetadata(bytes) {
457
457
  encrypted
458
458
  };
459
459
  }
460
+ var AUDIO_FORMAT_LABELS = {
461
+ 1: "PCM",
462
+ 3: "IEEE float",
463
+ 6: "A-law",
464
+ 7: "mu-law",
465
+ 65534: "Extensible"
466
+ };
467
+ function readAscii4(bytes, offset) {
468
+ return String.fromCharCode(bytes[offset], bytes[offset + 1], bytes[offset + 2], bytes[offset + 3]);
469
+ }
470
+ function readWavInfo(bytes) {
471
+ if (bytes.length < 12) return { error: "File is too small to be a valid WAV file" };
472
+ if (readAscii4(bytes, 0) !== "RIFF") return { error: 'Not a RIFF file (missing "RIFF" header)' };
473
+ if (readAscii4(bytes, 8) !== "WAVE") return { error: 'Not a WAVE file (missing "WAVE" format marker)' };
474
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
475
+ const fileSize = view.getUint32(4, true) + 8;
476
+ let offset = 12;
477
+ let fmt = null;
478
+ let dataSize = null;
479
+ while (offset + 8 <= bytes.length) {
480
+ const chunkId = readAscii4(bytes, offset);
481
+ const chunkSize = view.getUint32(offset + 4, true);
482
+ const dataOffset = offset + 8;
483
+ if (chunkId === "fmt ") {
484
+ if (dataOffset + 16 > bytes.length) return { error: 'Truncated "fmt " chunk' };
485
+ fmt = {
486
+ audioFormat: view.getUint16(dataOffset, true),
487
+ channels: view.getUint16(dataOffset + 2, true),
488
+ sampleRate: view.getUint32(dataOffset + 4, true),
489
+ byteRate: view.getUint32(dataOffset + 8, true),
490
+ blockAlign: view.getUint16(dataOffset + 12, true),
491
+ bitsPerSample: view.getUint16(dataOffset + 14, true)
492
+ };
493
+ } else if (chunkId === "data") {
494
+ dataSize = Math.min(chunkSize, bytes.length - dataOffset);
495
+ }
496
+ offset = dataOffset + chunkSize + chunkSize % 2;
497
+ if (fmt && dataSize !== null) break;
498
+ }
499
+ if (!fmt) return { error: 'No "fmt " chunk found in this WAV file' };
500
+ if (dataSize === null) return { error: 'No "data" chunk found in this WAV file' };
501
+ if (fmt.byteRate <= 0) return { error: 'Invalid byte rate in "fmt " chunk' };
502
+ const durationSeconds = Math.round(dataSize / fmt.byteRate * 1e3) / 1e3;
503
+ return {
504
+ audioFormat: fmt.audioFormat,
505
+ audioFormatLabel: AUDIO_FORMAT_LABELS[fmt.audioFormat] ?? `Unknown (0x${fmt.audioFormat.toString(16)})`,
506
+ channels: fmt.channels,
507
+ sampleRate: fmt.sampleRate,
508
+ byteRate: fmt.byteRate,
509
+ blockAlign: fmt.blockAlign,
510
+ bitsPerSample: fmt.bitsPerSample,
511
+ dataSize,
512
+ durationSeconds,
513
+ fileSize
514
+ };
515
+ }
516
+ var ID3V1_GENRES = [
517
+ "Blues",
518
+ "Classic Rock",
519
+ "Country",
520
+ "Dance",
521
+ "Disco",
522
+ "Funk",
523
+ "Grunge",
524
+ "Hip-Hop",
525
+ "Jazz",
526
+ "Metal",
527
+ "New Age",
528
+ "Oldies",
529
+ "Other",
530
+ "Pop",
531
+ "R&B",
532
+ "Rap",
533
+ "Reggae",
534
+ "Rock",
535
+ "Techno",
536
+ "Industrial",
537
+ "Alternative",
538
+ "Ska",
539
+ "Death Metal",
540
+ "Pranks",
541
+ "Soundtrack",
542
+ "Euro-Techno",
543
+ "Ambient",
544
+ "Trip-Hop",
545
+ "Vocal",
546
+ "Jazz+Funk",
547
+ "Fusion",
548
+ "Trance",
549
+ "Classical",
550
+ "Instrumental",
551
+ "Acid",
552
+ "House",
553
+ "Game",
554
+ "Sound Clip",
555
+ "Gospel",
556
+ "Noise",
557
+ "AlternRock",
558
+ "Bass",
559
+ "Soul",
560
+ "Punk",
561
+ "Space",
562
+ "Meditative",
563
+ "Instrumental Pop",
564
+ "Instrumental Rock",
565
+ "Ethnic",
566
+ "Gothic",
567
+ "Darkwave",
568
+ "Techno-Industrial",
569
+ "Electronic",
570
+ "Pop-Folk",
571
+ "Eurodance",
572
+ "Dream",
573
+ "Southern Rock",
574
+ "Comedy",
575
+ "Cult",
576
+ "Gangsta",
577
+ "Top 40",
578
+ "Christian Rap",
579
+ "Pop/Funk",
580
+ "Jungle",
581
+ "Native American",
582
+ "Cabaret",
583
+ "New Wave",
584
+ "Psychedelic",
585
+ "Rave",
586
+ "Showtunes",
587
+ "Trailer",
588
+ "Lo-Fi",
589
+ "Tribal",
590
+ "Acid Punk",
591
+ "Acid Jazz",
592
+ "Polka",
593
+ "Retro",
594
+ "Musical",
595
+ "Rock & Roll",
596
+ "Hard Rock"
597
+ ];
598
+ function readSynchsafeUInt32(bytes, offset) {
599
+ return (bytes[offset] & 127) << 21 | (bytes[offset + 1] & 127) << 14 | (bytes[offset + 2] & 127) << 7 | bytes[offset + 3] & 127;
600
+ }
601
+ function readUInt32BE(bytes, offset) {
602
+ return (bytes[offset] << 24 | bytes[offset + 1] << 16 | bytes[offset + 2] << 8 | bytes[offset + 3]) >>> 0;
603
+ }
604
+ function decodeId3Text(frameBytes) {
605
+ if (frameBytes.length === 0) return "";
606
+ const encodingByte = frameBytes[0];
607
+ const content = frameBytes.subarray(1);
608
+ let out = "";
609
+ if (encodingByte === 3) {
610
+ out = Buffer.from(content).toString("utf8");
611
+ } else if (encodingByte === 1 || encodingByte === 2) {
612
+ let little = encodingByte === 1;
613
+ let start = 0;
614
+ if (encodingByte === 1 && content.length >= 2) {
615
+ if (content[0] === 255 && content[1] === 254) {
616
+ little = true;
617
+ start = 2;
618
+ } else if (content[0] === 254 && content[1] === 255) {
619
+ little = false;
620
+ start = 2;
621
+ }
622
+ }
623
+ for (let i = start; i + 1 < content.length; i += 2) {
624
+ const code = little ? content[i] | content[i + 1] << 8 : content[i] << 8 | content[i + 1];
625
+ if (code === 0) break;
626
+ out += String.fromCharCode(code);
627
+ }
628
+ } else {
629
+ for (const b of content) {
630
+ if (b === 0) break;
631
+ out += String.fromCharCode(b);
632
+ }
633
+ }
634
+ return out.replace(/\0+$/, "").trim();
635
+ }
636
+ function readId3v2(bytes) {
637
+ if (bytes.length < 10 || bytes[0] !== 73 || bytes[1] !== 68 || bytes[2] !== 51) return null;
638
+ const majorVersion = bytes[3];
639
+ const revision = bytes[4];
640
+ const tagSize = readSynchsafeUInt32(bytes, 6);
641
+ const version = `ID3v2.${majorVersion}.${revision}`;
642
+ if (majorVersion !== 3 && majorVersion !== 4) {
643
+ return { version, frames: {}, frameCount: 0 };
644
+ }
645
+ const frames = {};
646
+ let offset = 10;
647
+ const end = Math.min(10 + tagSize, bytes.length);
648
+ let frameCount = 0;
649
+ while (offset + 10 <= end) {
650
+ const frameId = String.fromCharCode(bytes[offset], bytes[offset + 1], bytes[offset + 2], bytes[offset + 3]);
651
+ if (frameId === "\0\0\0\0") break;
652
+ const frameSize = majorVersion === 4 ? readSynchsafeUInt32(bytes, offset + 4) : readUInt32BE(bytes, offset + 4);
653
+ const frameStart = offset + 10;
654
+ if (frameSize <= 0 || frameStart + frameSize > bytes.length) break;
655
+ const frameBytes = bytes.subarray(frameStart, frameStart + frameSize);
656
+ if (frameId[0] === "T" && frameId !== "TXXX") {
657
+ frames[frameId] = decodeId3Text(frameBytes);
658
+ } else if (frameId === "COMM" && frameBytes.length > 4) {
659
+ const rebuilt = new Uint8Array(frameBytes.length - 3);
660
+ rebuilt[0] = frameBytes[0];
661
+ rebuilt.set(frameBytes.subarray(4), 1);
662
+ const decoded = decodeId3Text(rebuilt);
663
+ const parts = decoded.split("\0");
664
+ frames["COMM"] = (parts[parts.length - 1] || decoded).trim();
665
+ }
666
+ frameCount++;
667
+ offset = frameStart + frameSize;
668
+ }
669
+ return { version, frames, frameCount };
670
+ }
671
+ function readId3v1(bytes) {
672
+ if (bytes.length < 128) return null;
673
+ const start = bytes.length - 128;
674
+ if (String.fromCharCode(bytes[start], bytes[start + 1], bytes[start + 2]) !== "TAG") return null;
675
+ const readField = (offset, length) => {
676
+ let s = "";
677
+ for (let i = 0; i < length; i++) {
678
+ const b = bytes[start + offset + i];
679
+ if (b === 0) break;
680
+ s += String.fromCharCode(b);
681
+ }
682
+ return s.trim();
683
+ };
684
+ const title = readField(3, 30);
685
+ const artist = readField(33, 30);
686
+ const album = readField(63, 30);
687
+ const year = readField(93, 4);
688
+ const isV11 = bytes[start + 125] === 0 && bytes[start + 126] !== 0;
689
+ const comment = readField(97, isV11 ? 28 : 30);
690
+ const genreIndex = bytes[start + 127];
691
+ const genre = ID3V1_GENRES[genreIndex] ?? `Unknown (${genreIndex})`;
692
+ const result = { genre };
693
+ if (title) result.title = title;
694
+ if (artist) result.artist = artist;
695
+ if (album) result.album = album;
696
+ if (year) result.year = year;
697
+ if (comment) result.comment = comment;
698
+ if (isV11) result.trackNumber = String(bytes[start + 126]);
699
+ return result;
700
+ }
701
+ function readId3Tags(bytes) {
702
+ const v2 = readId3v2(bytes);
703
+ const v1 = readId3v1(bytes);
704
+ if (v2 && Object.keys(v2.frames).length > 0) {
705
+ const f = v2.frames;
706
+ const result = { version: v2.version, frameCount: v2.frameCount };
707
+ if (f["TIT2"]) result.title = f["TIT2"];
708
+ if (f["TPE1"]) result.artist = f["TPE1"];
709
+ if (f["TALB"]) result.album = f["TALB"];
710
+ const year = f["TYER"] || f["TDRC"];
711
+ if (year) result.year = year;
712
+ if (f["TCON"]) result.genre = f["TCON"];
713
+ if (f["COMM"]) result.comment = f["COMM"];
714
+ if (f["TRCK"]) result.trackNumber = f["TRCK"];
715
+ return result;
716
+ }
717
+ if (v1) {
718
+ return { version: v1.trackNumber !== void 0 ? "ID3v1.1" : "ID3v1", ...v1 };
719
+ }
720
+ if (v2) {
721
+ return { error: `Unsupported ID3 tag version: ${v2.version} (only ID3v2.3, ID3v2.4, and ID3v1/1.1 are supported)` };
722
+ }
723
+ return { error: "No ID3v1 or ID3v2.3/2.4 tags found in this file" };
724
+ }
460
725
 
461
726
  exports.readExifData = readExifData;
727
+ exports.readId3Tags = readId3Tags;
462
728
  exports.readImageInfo = readImageInfo;
463
729
  exports.readPdfMetadata = readPdfMetadata;
730
+ exports.readWavInfo = readWavInfo;
@@ -1 +1 @@
1
- export { E as ExifData, a as ExifError, I as ImageFormat, b as ImageInfo, c as ImageInfoError, P as PdfMetadata, d as PdfMetadataError, r as readExifData, e as readImageInfo, f as readPdfMetadata } from '../media-CHaBS1dI.cjs';
1
+ export { E as ExifData, a as ExifError, I as Id3Tags, b as Id3TagsError, c as ImageFormat, d as ImageInfo, e as ImageInfoError, P as PdfMetadata, f as PdfMetadataError, W as WavInfo, g as WavInfoError, r as readExifData, h as readId3Tags, i as readImageInfo, j as readPdfMetadata, k as readWavInfo } from '../media-C3ZvGyKc.cjs';
@@ -1 +1 @@
1
- export { E as ExifData, a as ExifError, I as ImageFormat, b as ImageInfo, c as ImageInfoError, P as PdfMetadata, d as PdfMetadataError, r as readExifData, e as readImageInfo, f as readPdfMetadata } from '../media-CHaBS1dI.js';
1
+ export { E as ExifData, a as ExifError, I as Id3Tags, b as Id3TagsError, c as ImageFormat, d as ImageInfo, e as ImageInfoError, P as PdfMetadata, f as PdfMetadataError, W as WavInfo, g as WavInfoError, r as readExifData, h as readId3Tags, i as readImageInfo, j as readPdfMetadata, k as readWavInfo } from '../media-C3ZvGyKc.js';
@@ -1,2 +1,2 @@
1
- export { readExifData, readImageInfo, readPdfMetadata } from '../chunk-FXBB7O5A.js';
1
+ export { readExifData, readId3Tags, readImageInfo, readPdfMetadata, readWavInfo } from '../chunk-GUUYEIU6.js';
2
2
  import '../chunk-MLKGABMK.js';