@bernierllc/content-type-audio 1.0.1 → 1.2.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.
- package/CHANGELOG.md +56 -0
- package/dist/AudioContentTypeManager.d.ts +47 -0
- package/dist/AudioContentTypeManager.d.ts.map +1 -0
- package/dist/AudioContentTypeManager.js +195 -0
- package/dist/AudioContentTypeManager.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas.d.ts +103 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +39 -0
- package/dist/schemas.js.map +1 -0
- package/dist/types.d.ts +70 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +23 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +25 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +81 -0
- package/dist/utils.js.map +1 -0
- package/jest.config.cjs +2 -2
- package/package.json +14 -12
- package/tsconfig.json +1 -0
- package/coverage/AudioContentTypeManager.ts.html +0 -799
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -161
- package/coverage/lcov-report/AudioContentTypeManager.ts.html +0 -799
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -161
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/schemas.ts.html +0 -211
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -210
- package/coverage/lcov-report/types.ts.html +0 -331
- package/coverage/lcov-report/utils.ts.html +0 -325
- package/coverage/lcov.info +0 -200
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/schemas.ts.html +0 -211
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -210
- package/coverage/types.ts.html +0 -331
- package/coverage/utils.ts.html +0 -325
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
# 1.2.0 (2025-12-25)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **ci:** add lerna version step before publish ([3d20300](https://github.com/bernierllc/tools/commit/3d203002143bf353fffafe4f8a78a99009567347))
|
|
12
|
+
* **ci:** correct jest testEnvironment paths for CI ([c47144c](https://github.com/bernierllc/tools/commit/c47144c3d78aec2be1e1454066c235c2227823fd))
|
|
13
|
+
* **ci:** fix release workflow + convert internal deps to workspace:* ([01c078b](https://github.com/bernierllc/tools/commit/01c078b49d6025f7eef750f79207a1c71c8d85dc))
|
|
14
|
+
* **jest:** move global options to root config and fix typos ([c14710c](https://github.com/bernierllc/tools/commit/c14710c11e8fc34dd7f773edf01328151564323a))
|
|
15
|
+
* **jest:** resolve Node.js v25+ localStorage SecurityError ([8ffc512](https://github.com/bernierllc/tools/commit/8ffc512805519bc5ba523bdbcd1c457e84998c9e))
|
|
16
|
+
* **route-discoverer:** Fix failing tests and achieve 90%+ test coverage ([9e5c431](https://github.com/bernierllc/tools/commit/9e5c4314bd7bfcbd38720d523b34c134473102e7))
|
|
17
|
+
* update neverhub-adapter deps to workspace:* and publish 0.1.2 ([f0e3d04](https://github.com/bernierllc/tools/commit/f0e3d04d8d4f094e3bb899ddf81e93243d16e2c2))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* autonomous pipeline builds 11 packages for content-management-suite ([d2931b5](https://github.com/bernierllc/tools/commit/d2931b5ea5de075268b9c8f078db959113a48fb7))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# 1.1.0 (2025-12-25)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* **ci:** correct jest testEnvironment paths for CI ([c47144c](https://github.com/bernierllc/tools/commit/c47144c3d78aec2be1e1454066c235c2227823fd))
|
|
34
|
+
* **ci:** fix release workflow + convert internal deps to workspace:* ([01c078b](https://github.com/bernierllc/tools/commit/01c078b49d6025f7eef750f79207a1c71c8d85dc))
|
|
35
|
+
* **jest:** move global options to root config and fix typos ([c14710c](https://github.com/bernierllc/tools/commit/c14710c11e8fc34dd7f773edf01328151564323a))
|
|
36
|
+
* **jest:** resolve Node.js v25+ localStorage SecurityError ([8ffc512](https://github.com/bernierllc/tools/commit/8ffc512805519bc5ba523bdbcd1c457e84998c9e))
|
|
37
|
+
* **route-discoverer:** Fix failing tests and achieve 90%+ test coverage ([9e5c431](https://github.com/bernierllc/tools/commit/9e5c4314bd7bfcbd38720d523b34c134473102e7))
|
|
38
|
+
* update neverhub-adapter deps to workspace:* and publish 0.1.2 ([f0e3d04](https://github.com/bernierllc/tools/commit/f0e3d04d8d4f094e3bb899ddf81e93243d16e2c2))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Features
|
|
42
|
+
|
|
43
|
+
* autonomous pipeline builds 11 packages for content-management-suite ([d2931b5](https://github.com/bernierllc/tools/commit/d2931b5ea5de075268b9c8f078db959113a48fb7))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# @bernierllc/content-type-audio
|
|
50
|
+
|
|
51
|
+
## 1.0.2
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- Updated dependencies [[`21cf207`](https://github.com/bernierllc/tools/commit/21cf207ed1e120e009f97937c4bd785add69681b)]:
|
|
56
|
+
- @bernierllc/content-type-registry@1.1.0
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ContentTypeRegistry } from '@bernierllc/content-type-registry';
|
|
3
|
+
import { AudioContentTypeConfig, AudioMetadata, AudioContentType, AudioValidationResult, PackageResult } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Audio content type manager
|
|
6
|
+
*/
|
|
7
|
+
export declare class AudioContentTypeManager {
|
|
8
|
+
private config;
|
|
9
|
+
constructor(config?: Partial<AudioContentTypeConfig>);
|
|
10
|
+
/**
|
|
11
|
+
* Register audio content type with registry
|
|
12
|
+
*/
|
|
13
|
+
register(registry: ContentTypeRegistry): void;
|
|
14
|
+
/**
|
|
15
|
+
* Get Zod schema for audio content type
|
|
16
|
+
*/
|
|
17
|
+
getSchema(): z.ZodSchema;
|
|
18
|
+
/**
|
|
19
|
+
* Validate audio content
|
|
20
|
+
*/
|
|
21
|
+
validate(content: unknown): AudioValidationResult;
|
|
22
|
+
/**
|
|
23
|
+
* Create audio content type instance
|
|
24
|
+
*/
|
|
25
|
+
create(metadata: AudioMetadata, options?: {
|
|
26
|
+
filePath?: string;
|
|
27
|
+
fileUrl?: string;
|
|
28
|
+
streamingUrl?: string;
|
|
29
|
+
}): AudioContentType;
|
|
30
|
+
/**
|
|
31
|
+
* Parse audio duration from various formats
|
|
32
|
+
*/
|
|
33
|
+
parseDuration(duration: string | number): number;
|
|
34
|
+
/**
|
|
35
|
+
* Format duration to human-readable string
|
|
36
|
+
*/
|
|
37
|
+
formatDuration(seconds: number): string;
|
|
38
|
+
/**
|
|
39
|
+
* Calculate bitrate from file size and duration
|
|
40
|
+
*/
|
|
41
|
+
calculateBitrate(fileSize: number, duration: number): number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Wrapper for validation with error handling
|
|
45
|
+
*/
|
|
46
|
+
export declare function validateAudio(manager: AudioContentTypeManager, content: unknown): PackageResult<AudioValidationResult>;
|
|
47
|
+
//# sourceMappingURL=AudioContentTypeManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AudioContentTypeManager.d.ts","sourceRoot":"","sources":["../src/AudioContentTypeManager.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,mBAAmB,EAGpB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAEL,sBAAsB,EACtB,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,aAAa,EACd,MAAM,SAAS,CAAC;AAQjB;;GAEG;AACH,qBAAa,uBAAuB;IAClC,OAAO,CAAC,MAAM,CAAyB;gBAE3B,MAAM,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC;IAapD;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,GAAG,IAAI;IAgC7C;;OAEG;IACH,SAAS,IAAI,CAAC,CAAC,SAAS;IAIxB;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,qBAAqB;IAuDjD;;OAEG;IACH,MAAM,CACJ,QAAQ,EAAE,aAAa,EACvB,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GACA,gBAAgB;IAsBnB;;OAEG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IAIhD;;OAEG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAIvC;;OAEG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;CAG7D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE,OAAO,GACf,aAAa,CAAC,qBAAqB,CAAC,CA4BtC"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (c) 2025 Bernier LLC
|
|
4
|
+
|
|
5
|
+
This file is licensed to the client under a limited-use license.
|
|
6
|
+
The client may use and modify this code *only within the scope of the project it was delivered for*.
|
|
7
|
+
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.AudioContentTypeManager = void 0;
|
|
11
|
+
exports.validateAudio = validateAudio;
|
|
12
|
+
const zod_1 = require("zod");
|
|
13
|
+
const content_type_registry_1 = require("@bernierllc/content-type-registry");
|
|
14
|
+
const schemas_1 = require("./schemas");
|
|
15
|
+
const types_1 = require("./types");
|
|
16
|
+
const utils_1 = require("./utils");
|
|
17
|
+
/**
|
|
18
|
+
* Audio content type manager
|
|
19
|
+
*/
|
|
20
|
+
class AudioContentTypeManager {
|
|
21
|
+
constructor(config) {
|
|
22
|
+
this.config = {
|
|
23
|
+
baseType: 'audio',
|
|
24
|
+
editor: 'file-upload-with-player',
|
|
25
|
+
storage: 'file',
|
|
26
|
+
publishing: 'streaming-url',
|
|
27
|
+
maxFileSize: 100 * 1024 * 1024, // 100MB
|
|
28
|
+
allowedFormats: Object.values(types_1.AudioFormat),
|
|
29
|
+
requireMetadata: false,
|
|
30
|
+
...config
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Register audio content type with registry
|
|
35
|
+
*/
|
|
36
|
+
register(registry) {
|
|
37
|
+
const definition = {
|
|
38
|
+
id: 'audio',
|
|
39
|
+
name: 'Audio',
|
|
40
|
+
description: 'Base audio content type with file upload and streaming',
|
|
41
|
+
baseType: content_type_registry_1.BaseContentType.AUDIO,
|
|
42
|
+
icon: '🎵',
|
|
43
|
+
schema: this.getSchema(),
|
|
44
|
+
editor: {
|
|
45
|
+
component: this.config.editor,
|
|
46
|
+
settings: {
|
|
47
|
+
maxFileSize: this.config.maxFileSize,
|
|
48
|
+
allowedFormats: this.config.allowedFormats,
|
|
49
|
+
requireMetadata: this.config.requireMetadata
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
storage: {
|
|
53
|
+
method: this.config.storage
|
|
54
|
+
},
|
|
55
|
+
publishing: {
|
|
56
|
+
methods: [this.config.publishing],
|
|
57
|
+
defaultMethod: this.config.publishing
|
|
58
|
+
},
|
|
59
|
+
metadata: {
|
|
60
|
+
version: '1.0.0',
|
|
61
|
+
author: 'Bernier LLC'
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
registry.register(definition);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get Zod schema for audio content type
|
|
68
|
+
*/
|
|
69
|
+
getSchema() {
|
|
70
|
+
return schemas_1.AudioContentSchema;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Validate audio content
|
|
74
|
+
*/
|
|
75
|
+
validate(content) {
|
|
76
|
+
try {
|
|
77
|
+
const schema = this.getSchema();
|
|
78
|
+
const validated = schema.parse(content);
|
|
79
|
+
// Additional validation
|
|
80
|
+
const errors = [];
|
|
81
|
+
// Check file size
|
|
82
|
+
if (this.config.maxFileSize && validated.metadata.size > this.config.maxFileSize) {
|
|
83
|
+
errors.push(`File size ${validated.metadata.size} exceeds maximum ${this.config.maxFileSize}`);
|
|
84
|
+
}
|
|
85
|
+
// Check allowed formats
|
|
86
|
+
if (this.config.allowedFormats &&
|
|
87
|
+
!this.config.allowedFormats.includes(validated.metadata.mimeType)) {
|
|
88
|
+
errors.push(`Audio format ${validated.metadata.mimeType} not allowed`);
|
|
89
|
+
}
|
|
90
|
+
// Check metadata requirements
|
|
91
|
+
if (this.config.requireMetadata && !validated.metadata.title) {
|
|
92
|
+
errors.push('Title is required');
|
|
93
|
+
}
|
|
94
|
+
if (errors.length > 0) {
|
|
95
|
+
return {
|
|
96
|
+
valid: false,
|
|
97
|
+
errors,
|
|
98
|
+
metadata: validated.metadata
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
valid: true,
|
|
103
|
+
metadata: validated.metadata
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
if (error instanceof zod_1.z.ZodError) {
|
|
108
|
+
return {
|
|
109
|
+
valid: false,
|
|
110
|
+
errors: error.errors.map((e) => `${e.path.join('.')}: ${e.message}`)
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
valid: false,
|
|
115
|
+
errors: [error instanceof Error ? error.message : 'Unknown validation error']
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Create audio content type instance
|
|
121
|
+
*/
|
|
122
|
+
create(metadata, options) {
|
|
123
|
+
const content = {
|
|
124
|
+
id: (0, utils_1.generateAudioId)(),
|
|
125
|
+
type: 'audio',
|
|
126
|
+
metadata,
|
|
127
|
+
createdAt: new Date(),
|
|
128
|
+
updatedAt: new Date()
|
|
129
|
+
};
|
|
130
|
+
if (options?.filePath) {
|
|
131
|
+
content.filePath = options.filePath;
|
|
132
|
+
}
|
|
133
|
+
if (options?.fileUrl) {
|
|
134
|
+
content.fileUrl = options.fileUrl;
|
|
135
|
+
}
|
|
136
|
+
if (options?.streamingUrl) {
|
|
137
|
+
content.streamingUrl = options.streamingUrl;
|
|
138
|
+
}
|
|
139
|
+
return content;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Parse audio duration from various formats
|
|
143
|
+
*/
|
|
144
|
+
parseDuration(duration) {
|
|
145
|
+
return (0, utils_1.parseDuration)(duration);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Format duration to human-readable string
|
|
149
|
+
*/
|
|
150
|
+
formatDuration(seconds) {
|
|
151
|
+
return (0, utils_1.formatDuration)(seconds);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Calculate bitrate from file size and duration
|
|
155
|
+
*/
|
|
156
|
+
calculateBitrate(fileSize, duration) {
|
|
157
|
+
return (0, utils_1.calculateBitrate)(fileSize, duration);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
exports.AudioContentTypeManager = AudioContentTypeManager;
|
|
161
|
+
/**
|
|
162
|
+
* Wrapper for validation with error handling
|
|
163
|
+
*/
|
|
164
|
+
function validateAudio(manager, content) {
|
|
165
|
+
try {
|
|
166
|
+
const result = manager.validate(content);
|
|
167
|
+
if (result.valid) {
|
|
168
|
+
return {
|
|
169
|
+
success: true,
|
|
170
|
+
data: result
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
const errorMessage = result.errors?.join(', ');
|
|
175
|
+
if (errorMessage) {
|
|
176
|
+
return {
|
|
177
|
+
success: false,
|
|
178
|
+
data: result,
|
|
179
|
+
error: errorMessage
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
success: false,
|
|
184
|
+
data: result
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
return {
|
|
190
|
+
success: false,
|
|
191
|
+
error: error instanceof Error ? error.message : 'Unknown error'
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=AudioContentTypeManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AudioContentTypeManager.js","sourceRoot":"","sources":["../src/AudioContentTypeManager.ts"],"names":[],"mappings":";AAAA;;;;;;EAME;;;AAwMF,sCA+BC;AArOD,6BAAwB;AACxB,6EAI2C;AAC3C,uCAA+C;AAC/C,mCAOiB;AACjB,mCAKiB;AAEjB;;GAEG;AACH,MAAa,uBAAuB;IAGlC,YAAY,MAAwC;QAClD,IAAI,CAAC,MAAM,GAAG;YACZ,QAAQ,EAAE,OAAO;YACjB,MAAM,EAAE,yBAAyB;YACjC,OAA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AO,IAAA,wBAAgB,EAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC9C,CAAC;CACF;AAxKD,0DAwKC;AAED;;GAEG;AACH,SAAgB,aAAa,CAC3B,OAAgC,EAChC,OAAgB;IAEhB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACzC,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,MAAM;aACb,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YAC/C,IAAI,YAAY,EAAE,CAAC;gBACjB,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,YAAY;iBACpB,CAAC;YACJ,CAAC;YACD,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,MAAM;aACb,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;SAChE,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { AudioFormat, type AudioMetadata, type AudioContentTypeConfig, type AudioContentType, type AudioValidationResult, type PackageResult } from './types';
|
|
2
|
+
export { AudioContentSchema, type AudioContent } from './schemas';
|
|
3
|
+
export { parseDuration, formatDuration, calculateBitrate, generateAudioId } from './utils';
|
|
4
|
+
export { AudioContentTypeManager, validateAudio } from './AudioContentTypeManager';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EACnB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,kBAAkB,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAGlE,OAAO,EACL,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,eAAe,EAChB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (c) 2025 Bernier LLC
|
|
4
|
+
|
|
5
|
+
This file is licensed to the client under a limited-use license.
|
|
6
|
+
The client may use and modify this code *only within the scope of the project it was delivered for*.
|
|
7
|
+
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.validateAudio = exports.AudioContentTypeManager = exports.generateAudioId = exports.calculateBitrate = exports.formatDuration = exports.parseDuration = exports.AudioContentSchema = exports.AudioFormat = void 0;
|
|
11
|
+
// Export types
|
|
12
|
+
var types_1 = require("./types");
|
|
13
|
+
Object.defineProperty(exports, "AudioFormat", { enumerable: true, get: function () { return types_1.AudioFormat; } });
|
|
14
|
+
// Export schemas
|
|
15
|
+
var schemas_1 = require("./schemas");
|
|
16
|
+
Object.defineProperty(exports, "AudioContentSchema", { enumerable: true, get: function () { return schemas_1.AudioContentSchema; } });
|
|
17
|
+
// Export utilities
|
|
18
|
+
var utils_1 = require("./utils");
|
|
19
|
+
Object.defineProperty(exports, "parseDuration", { enumerable: true, get: function () { return utils_1.parseDuration; } });
|
|
20
|
+
Object.defineProperty(exports, "formatDuration", { enumerable: true, get: function () { return utils_1.formatDuration; } });
|
|
21
|
+
Object.defineProperty(exports, "calculateBitrate", { enumerable: true, get: function () { return utils_1.calculateBitrate; } });
|
|
22
|
+
Object.defineProperty(exports, "generateAudioId", { enumerable: true, get: function () { return utils_1.generateAudioId; } });
|
|
23
|
+
// Export manager
|
|
24
|
+
var AudioContentTypeManager_1 = require("./AudioContentTypeManager");
|
|
25
|
+
Object.defineProperty(exports, "AudioContentTypeManager", { enumerable: true, get: function () { return AudioContentTypeManager_1.AudioContentTypeManager; } });
|
|
26
|
+
Object.defineProperty(exports, "validateAudio", { enumerable: true, get: function () { return AudioContentTypeManager_1.validateAudio; } });
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;EAME;;;AAEF,eAAe;AACf,iCAOiB;AANf,oGAAA,WAAW,OAAA;AAQb,iBAAiB;AACjB,qCAAkE;AAAzD,6GAAA,kBAAkB,OAAA;AAE3B,mBAAmB;AACnB,iCAKiB;AAJf,sGAAA,aAAa,OAAA;AACb,uGAAA,cAAc,OAAA;AACd,yGAAA,gBAAgB,OAAA;AAChB,wGAAA,eAAe,OAAA;AAGjB,iBAAiB;AACjB,qEAAmF;AAA1E,kIAAA,uBAAuB,OAAA;AAAE,wHAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AudioFormat } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Zod schema for audio content type validation
|
|
5
|
+
*/
|
|
6
|
+
export declare const AudioContentSchema: z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
type: z.ZodLiteral<"audio">;
|
|
9
|
+
metadata: z.ZodObject<{
|
|
10
|
+
filename: z.ZodString;
|
|
11
|
+
mimeType: z.ZodNativeEnum<typeof AudioFormat>;
|
|
12
|
+
size: z.ZodNumber;
|
|
13
|
+
duration: z.ZodNumber;
|
|
14
|
+
bitrate: z.ZodNumber;
|
|
15
|
+
sampleRate: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
channels: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
title: z.ZodOptional<z.ZodString>;
|
|
18
|
+
artist: z.ZodOptional<z.ZodString>;
|
|
19
|
+
album: z.ZodOptional<z.ZodString>;
|
|
20
|
+
year: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
coverArt: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
filename: string;
|
|
24
|
+
mimeType: AudioFormat;
|
|
25
|
+
size: number;
|
|
26
|
+
duration: number;
|
|
27
|
+
bitrate: number;
|
|
28
|
+
sampleRate?: number | undefined;
|
|
29
|
+
channels?: number | undefined;
|
|
30
|
+
title?: string | undefined;
|
|
31
|
+
artist?: string | undefined;
|
|
32
|
+
album?: string | undefined;
|
|
33
|
+
year?: number | undefined;
|
|
34
|
+
coverArt?: string | undefined;
|
|
35
|
+
}, {
|
|
36
|
+
filename: string;
|
|
37
|
+
mimeType: AudioFormat;
|
|
38
|
+
size: number;
|
|
39
|
+
duration: number;
|
|
40
|
+
bitrate: number;
|
|
41
|
+
sampleRate?: number | undefined;
|
|
42
|
+
channels?: number | undefined;
|
|
43
|
+
title?: string | undefined;
|
|
44
|
+
artist?: string | undefined;
|
|
45
|
+
album?: string | undefined;
|
|
46
|
+
year?: number | undefined;
|
|
47
|
+
coverArt?: string | undefined;
|
|
48
|
+
}>;
|
|
49
|
+
filePath: z.ZodOptional<z.ZodString>;
|
|
50
|
+
fileUrl: z.ZodOptional<z.ZodString>;
|
|
51
|
+
streamingUrl: z.ZodOptional<z.ZodString>;
|
|
52
|
+
createdAt: z.ZodDate;
|
|
53
|
+
updatedAt: z.ZodDate;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
id: string;
|
|
56
|
+
type: "audio";
|
|
57
|
+
metadata: {
|
|
58
|
+
filename: string;
|
|
59
|
+
mimeType: AudioFormat;
|
|
60
|
+
size: number;
|
|
61
|
+
duration: number;
|
|
62
|
+
bitrate: number;
|
|
63
|
+
sampleRate?: number | undefined;
|
|
64
|
+
channels?: number | undefined;
|
|
65
|
+
title?: string | undefined;
|
|
66
|
+
artist?: string | undefined;
|
|
67
|
+
album?: string | undefined;
|
|
68
|
+
year?: number | undefined;
|
|
69
|
+
coverArt?: string | undefined;
|
|
70
|
+
};
|
|
71
|
+
createdAt: Date;
|
|
72
|
+
updatedAt: Date;
|
|
73
|
+
filePath?: string | undefined;
|
|
74
|
+
fileUrl?: string | undefined;
|
|
75
|
+
streamingUrl?: string | undefined;
|
|
76
|
+
}, {
|
|
77
|
+
id: string;
|
|
78
|
+
type: "audio";
|
|
79
|
+
metadata: {
|
|
80
|
+
filename: string;
|
|
81
|
+
mimeType: AudioFormat;
|
|
82
|
+
size: number;
|
|
83
|
+
duration: number;
|
|
84
|
+
bitrate: number;
|
|
85
|
+
sampleRate?: number | undefined;
|
|
86
|
+
channels?: number | undefined;
|
|
87
|
+
title?: string | undefined;
|
|
88
|
+
artist?: string | undefined;
|
|
89
|
+
album?: string | undefined;
|
|
90
|
+
year?: number | undefined;
|
|
91
|
+
coverArt?: string | undefined;
|
|
92
|
+
};
|
|
93
|
+
createdAt: Date;
|
|
94
|
+
updatedAt: Date;
|
|
95
|
+
filePath?: string | undefined;
|
|
96
|
+
fileUrl?: string | undefined;
|
|
97
|
+
streamingUrl?: string | undefined;
|
|
98
|
+
}>;
|
|
99
|
+
/**
|
|
100
|
+
* Type inferred from schema
|
|
101
|
+
*/
|
|
102
|
+
export type AudioContent = z.infer<typeof AudioContentSchema>;
|
|
103
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsB7B,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
package/dist/schemas.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (c) 2025 Bernier LLC
|
|
4
|
+
|
|
5
|
+
This file is licensed to the client under a limited-use license.
|
|
6
|
+
The client may use and modify this code *only within the scope of the project it was delivered for*.
|
|
7
|
+
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.AudioContentSchema = void 0;
|
|
11
|
+
const zod_1 = require("zod");
|
|
12
|
+
const types_1 = require("./types");
|
|
13
|
+
/**
|
|
14
|
+
* Zod schema for audio content type validation
|
|
15
|
+
*/
|
|
16
|
+
exports.AudioContentSchema = zod_1.z.object({
|
|
17
|
+
id: zod_1.z.string(),
|
|
18
|
+
type: zod_1.z.literal('audio'),
|
|
19
|
+
metadata: zod_1.z.object({
|
|
20
|
+
filename: zod_1.z.string(),
|
|
21
|
+
mimeType: zod_1.z.nativeEnum(types_1.AudioFormat),
|
|
22
|
+
size: zod_1.z.number().positive(),
|
|
23
|
+
duration: zod_1.z.number().nonnegative(),
|
|
24
|
+
bitrate: zod_1.z.number().positive(),
|
|
25
|
+
sampleRate: zod_1.z.number().positive().optional(),
|
|
26
|
+
channels: zod_1.z.number().int().min(1).max(8).optional(),
|
|
27
|
+
title: zod_1.z.string().optional(),
|
|
28
|
+
artist: zod_1.z.string().optional(),
|
|
29
|
+
album: zod_1.z.string().optional(),
|
|
30
|
+
year: zod_1.z.number().int().min(1900).max(2100).optional(),
|
|
31
|
+
coverArt: zod_1.z.string().optional()
|
|
32
|
+
}),
|
|
33
|
+
filePath: zod_1.z.string().optional(),
|
|
34
|
+
fileUrl: zod_1.z.string().url().optional(),
|
|
35
|
+
streamingUrl: zod_1.z.string().url().optional(),
|
|
36
|
+
createdAt: zod_1.z.date(),
|
|
37
|
+
updatedAt: zod_1.z.date()
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":";AAAA;;;;;;EAME;;;AAEF,6BAAwB;AACxB,mCAAsC;AAEtC;;GAEG;AACU,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACxB,QAAQ,EAAE,OAAC,CAAC,MAAM,CAAC;QACjB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE;QACpB,QAAQ,EAAE,OAAC,CAAC,UAAU,CAAC,mBAAW,CAAC;QACnC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC3B,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE;QAClC,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC9B,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QAC5C,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;QACnD,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC5B,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC7B,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC5B,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;QACrD,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAChC,CAAC;IACF,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACpC,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACzC,SAAS,EAAE,OAAC,CAAC,IAAI,EAAE;IACnB,SAAS,EAAE,OAAC,CAAC,IAAI,EAAE;CACpB,CAAC,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Audio format enumeration
|
|
3
|
+
*/
|
|
4
|
+
export declare enum AudioFormat {
|
|
5
|
+
MP3 = "audio/mpeg",
|
|
6
|
+
WAV = "audio/wav",
|
|
7
|
+
AAC = "audio/aac",
|
|
8
|
+
OGG = "audio/ogg",
|
|
9
|
+
FLAC = "audio/flac",
|
|
10
|
+
M4A = "audio/mp4"
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Audio metadata interface
|
|
14
|
+
*/
|
|
15
|
+
export interface AudioMetadata {
|
|
16
|
+
filename: string;
|
|
17
|
+
mimeType: AudioFormat;
|
|
18
|
+
size: number;
|
|
19
|
+
duration: number;
|
|
20
|
+
bitrate: number;
|
|
21
|
+
sampleRate?: number;
|
|
22
|
+
channels?: number;
|
|
23
|
+
title?: string;
|
|
24
|
+
artist?: string;
|
|
25
|
+
album?: string;
|
|
26
|
+
year?: number;
|
|
27
|
+
coverArt?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Audio content type configuration
|
|
31
|
+
*/
|
|
32
|
+
export interface AudioContentTypeConfig {
|
|
33
|
+
baseType: 'audio';
|
|
34
|
+
editor: 'file-upload-with-player';
|
|
35
|
+
storage: 'file' | 'cloud' | 'custom';
|
|
36
|
+
publishing: 'streaming-url' | 'download' | 'custom';
|
|
37
|
+
maxFileSize?: number;
|
|
38
|
+
allowedFormats?: AudioFormat[];
|
|
39
|
+
requireMetadata?: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Audio content type interface
|
|
43
|
+
*/
|
|
44
|
+
export interface AudioContentType {
|
|
45
|
+
id: string;
|
|
46
|
+
type: 'audio';
|
|
47
|
+
metadata: AudioMetadata;
|
|
48
|
+
filePath?: string;
|
|
49
|
+
fileUrl?: string;
|
|
50
|
+
streamingUrl?: string;
|
|
51
|
+
createdAt: Date;
|
|
52
|
+
updatedAt: Date;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Audio validation result
|
|
56
|
+
*/
|
|
57
|
+
export interface AudioValidationResult {
|
|
58
|
+
valid: boolean;
|
|
59
|
+
errors?: string[];
|
|
60
|
+
metadata?: Partial<AudioMetadata>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Package result interface for error handling
|
|
64
|
+
*/
|
|
65
|
+
export interface PackageResult<T = unknown> {
|
|
66
|
+
success: boolean;
|
|
67
|
+
data?: T;
|
|
68
|
+
error?: string;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types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AAI,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,OAAO;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (c) 2025 Bernier LLC
|
|
4
|
+
|
|
5
|
+
This file is licensed to the client under a limited-use license.
|
|
6
|
+
The client may use and modify this code *only within the scope of the project it was delivered for*.
|
|
7
|
+
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.AudioFormat = void 0;
|
|
11
|
+
/**
|
|
12
|
+
* Audio format enumeration
|
|
13
|
+
*/
|
|
14
|
+
var AudioFormat;
|
|
15
|
+
(function (AudioFormat) {
|
|
16
|
+
AudioFormat["MP3"] = "audio/mpeg";
|
|
17
|
+
AudioFormat["WAV"] = "audio/wav";
|
|
18
|
+
AudioFormat["AAC"] = "audio/aac";
|
|
19
|
+
AudioFormat["OGG"] = "audio/ogg";
|
|
20
|
+
AudioFormat["FLAC"] = "audio/flac";
|
|
21
|
+
AudioFormat["M4A"] = "audio/mp4";
|
|
22
|
+
})(AudioFormat || (exports.AudioFormat = AudioFormat = {}));
|
|
23
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;EAME;;;AAEF;;GAEG;AACH,IAAY,WAOX;AAPD,WAAY,WAAW;IACrB,iCAAkB,CAAA;IAClB,gCAAiB,CAAA;IACjB,gCAAiB,CAAA;IACjB,gCAAiB,CAAA;IACjB,kCAAmB,CAAA;IACnB,gCAAiB,CAAA;AACnB,CAAC,EAPW,WAAW,2BAAX,WAAW,QAOtB"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse audio duration from various formats
|
|
3
|
+
* @param duration - Duration as string ("1:23:45", "23:45", "123") or number
|
|
4
|
+
* @returns Duration in seconds
|
|
5
|
+
*/
|
|
6
|
+
export declare function parseDuration(duration: string | number): number;
|
|
7
|
+
/**
|
|
8
|
+
* Format duration to human-readable string
|
|
9
|
+
* @param seconds - Duration in seconds
|
|
10
|
+
* @returns Formatted string (e.g., "1:23:45" or "23:45")
|
|
11
|
+
*/
|
|
12
|
+
export declare function formatDuration(seconds: number): string;
|
|
13
|
+
/**
|
|
14
|
+
* Calculate bitrate from file size and duration
|
|
15
|
+
* @param fileSize - File size in bytes
|
|
16
|
+
* @param duration - Duration in seconds
|
|
17
|
+
* @returns Bitrate in kbps
|
|
18
|
+
*/
|
|
19
|
+
export declare function calculateBitrate(fileSize: number, duration: number): number;
|
|
20
|
+
/**
|
|
21
|
+
* Generate unique ID for audio content
|
|
22
|
+
* @returns Unique identifier
|
|
23
|
+
*/
|
|
24
|
+
export declare function generateAudioId(): string;
|
|
25
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CA8B/D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAStD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAI3E;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC"}
|