@amaster.ai/pi-video-gen 0.1.2-beta.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +196 -0
  3. package/dist/compose.d.ts +43 -0
  4. package/dist/compose.d.ts.map +1 -0
  5. package/dist/compose.js +308 -0
  6. package/dist/compose.js.map +1 -0
  7. package/dist/config.d.ts +29 -0
  8. package/dist/config.d.ts.map +1 -0
  9. package/dist/config.js +305 -0
  10. package/dist/config.js.map +1 -0
  11. package/dist/errors.d.ts +50 -0
  12. package/dist/errors.d.ts.map +1 -0
  13. package/dist/errors.js +99 -0
  14. package/dist/errors.js.map +1 -0
  15. package/dist/ffmpeg.d.ts +64 -0
  16. package/dist/ffmpeg.d.ts.map +1 -0
  17. package/dist/ffmpeg.js +292 -0
  18. package/dist/ffmpeg.js.map +1 -0
  19. package/dist/index.d.ts +3 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +837 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/jobs/store.d.ts +124 -0
  24. package/dist/jobs/store.d.ts.map +1 -0
  25. package/dist/jobs/store.js +386 -0
  26. package/dist/jobs/store.js.map +1 -0
  27. package/dist/providers/ark.d.ts +26 -0
  28. package/dist/providers/ark.d.ts.map +1 -0
  29. package/dist/providers/ark.js +178 -0
  30. package/dist/providers/ark.js.map +1 -0
  31. package/dist/providers/dashscope.d.ts +28 -0
  32. package/dist/providers/dashscope.d.ts.map +1 -0
  33. package/dist/providers/dashscope.js +200 -0
  34. package/dist/providers/dashscope.js.map +1 -0
  35. package/dist/providers/kling.d.ts +46 -0
  36. package/dist/providers/kling.d.ts.map +1 -0
  37. package/dist/providers/kling.js +245 -0
  38. package/dist/providers/kling.js.map +1 -0
  39. package/dist/providers/models.d.ts +16 -0
  40. package/dist/providers/models.d.ts.map +1 -0
  41. package/dist/providers/models.js +152 -0
  42. package/dist/providers/models.js.map +1 -0
  43. package/dist/providers/newapi.d.ts +3 -0
  44. package/dist/providers/newapi.d.ts.map +1 -0
  45. package/dist/providers/newapi.js +203 -0
  46. package/dist/providers/newapi.js.map +1 -0
  47. package/dist/providers/openrouter.d.ts +21 -0
  48. package/dist/providers/openrouter.d.ts.map +1 -0
  49. package/dist/providers/openrouter.js +169 -0
  50. package/dist/providers/openrouter.js.map +1 -0
  51. package/dist/providers/request.d.ts +4 -0
  52. package/dist/providers/request.d.ts.map +1 -0
  53. package/dist/providers/request.js +20 -0
  54. package/dist/providers/request.js.map +1 -0
  55. package/dist/providers/task.d.ts +53 -0
  56. package/dist/providers/task.d.ts.map +1 -0
  57. package/dist/providers/task.js +209 -0
  58. package/dist/providers/task.js.map +1 -0
  59. package/dist/render.d.ts +53 -0
  60. package/dist/render.d.ts.map +1 -0
  61. package/dist/render.js +480 -0
  62. package/dist/render.js.map +1 -0
  63. package/dist/text-layer.d.ts +18 -0
  64. package/dist/text-layer.d.ts.map +1 -0
  65. package/dist/text-layer.js +168 -0
  66. package/dist/text-layer.js.map +1 -0
  67. package/dist/timeline-render.d.ts +33 -0
  68. package/dist/timeline-render.d.ts.map +1 -0
  69. package/dist/timeline-render.js +1051 -0
  70. package/dist/timeline-render.js.map +1 -0
  71. package/dist/timeline.d.ts +64 -0
  72. package/dist/timeline.d.ts.map +1 -0
  73. package/dist/timeline.js +246 -0
  74. package/dist/timeline.js.map +1 -0
  75. package/dist/tts/edge-tts.d.ts +22 -0
  76. package/dist/tts/edge-tts.d.ts.map +1 -0
  77. package/dist/tts/edge-tts.js +55 -0
  78. package/dist/tts/edge-tts.js.map +1 -0
  79. package/dist/types.d.ts +161 -0
  80. package/dist/types.d.ts.map +1 -0
  81. package/dist/types.js +13 -0
  82. package/dist/types.js.map +1 -0
  83. package/package.json +93 -0
  84. package/preview.png +0 -0
  85. package/skills/video-gen/SKILL.md +284 -0
@@ -0,0 +1,308 @@
1
+ import { COPYFILE_EXCL } from 'node:constants';
2
+ import { createHash } from 'node:crypto';
3
+ import { copyFile, lstat, mkdtemp, readFile, realpath, rename, rm } from 'node:fs/promises';
4
+ import { basename, dirname, join, resolve, sep } from 'node:path';
5
+ import { resolveOutputDir } from './config.js';
6
+ import { safeBasename, VideoGenError } from './errors.js';
7
+ import { concatVideos, probeStreams, resolveFfmpeg, resolveFfprobe, } from './ffmpeg.js';
8
+ import { assertSafeId, hashFileSha256, loadComposeJob, pathIsMissing, readJsonFile, saveComposeJob, } from './jobs/store.js';
9
+ function sha256hex(content) {
10
+ return createHash('sha256').update(content).digest('hex');
11
+ }
12
+ function specFingerprint(specRaw, clipHashes) {
13
+ return sha256hex(JSON.stringify({ spec: specRaw, clipHashes }));
14
+ }
15
+ /** Manual validation with agent-fixable error messages. */
16
+ function parseComposeSpec(raw) {
17
+ let parsed;
18
+ try {
19
+ parsed = JSON.parse(raw);
20
+ }
21
+ catch {
22
+ throw new VideoGenError('compose-input.json is not valid JSON.', 'compose: spec not json');
23
+ }
24
+ const spec = parsed;
25
+ if (!spec || typeof spec !== 'object' || !Array.isArray(spec.clips)) {
26
+ throw new VideoGenError('compose-input.json must contain a "clips" array.', 'compose: no clips');
27
+ }
28
+ if (spec.clips.length < 2) {
29
+ throw new VideoGenError('compose needs at least 2 clips to concatenate. For a single clip, no compose is needed.', 'compose: too few clips');
30
+ }
31
+ if (spec.output !== undefined &&
32
+ (!spec.output || typeof spec.output !== 'object' || Array.isArray(spec.output))) {
33
+ throw new VideoGenError('output must be an object.', 'compose: bad output');
34
+ }
35
+ if (spec.output?.mode !== undefined && spec.output.mode !== 'copy') {
36
+ throw new VideoGenError(`output.mode must be "copy" (C0 only supports lossless concat; got "${spec.output.mode}").`, 'compose: bad mode');
37
+ }
38
+ const seen = new Set();
39
+ spec.clips.forEach((clip, i) => {
40
+ const where = `clips[${i}]${clip?.id ? ` ("${clip.id}")` : ''}`;
41
+ if (!clip || typeof clip !== 'object') {
42
+ throw new VideoGenError(`${where} is not an object.`, 'compose: bad clip');
43
+ }
44
+ if (typeof clip.id !== 'string') {
45
+ throw new VideoGenError(`${where}.id must be a string (JSON number/bool ids are not allowed).`, 'compose: id type');
46
+ }
47
+ assertSafeId(clip.id, 'clip');
48
+ if (seen.has(clip.id)) {
49
+ throw new VideoGenError(`Duplicate clip id "${clip.id}" — ids must be unique.`, 'compose: dup clip id');
50
+ }
51
+ seen.add(clip.id);
52
+ if (typeof clip.path !== 'string' || clip.path.trim() === '') {
53
+ throw new VideoGenError(`${where}.path is required (absolute path to an existing mp4).`, 'compose: no path');
54
+ }
55
+ });
56
+ return spec;
57
+ }
58
+ /** Compare stream info across clips and report exact differences. */
59
+ function diffStreams(probes) {
60
+ const diffs = [];
61
+ const [first, ...rest] = probes;
62
+ const base = first.streams;
63
+ for (const p of rest) {
64
+ const s = p.streams;
65
+ const mismatches = [];
66
+ if (s.videoCodec !== base.videoCodec)
67
+ mismatches.push(`codec ${base.videoCodec} vs ${s.videoCodec}`);
68
+ if (s.width !== base.width || s.height !== base.height)
69
+ mismatches.push(`resolution ${base.width}x${base.height} vs ${s.width}x${s.height}`);
70
+ if (s.fps !== base.fps)
71
+ mismatches.push(`fps ${base.fps} vs ${s.fps}`);
72
+ if (s.timebase !== base.timebase)
73
+ mismatches.push(`timebase ${base.timebase} vs ${s.timebase}`);
74
+ if (s.pixFmt !== base.pixFmt)
75
+ mismatches.push(`pix_fmt ${base.pixFmt} vs ${s.pixFmt}`);
76
+ if (s.audioLayout !== base.audioLayout)
77
+ mismatches.push(`audio ${base.audioLayout} vs ${s.audioLayout}`);
78
+ if (s.audioSampleRate !== base.audioSampleRate)
79
+ mismatches.push(`audio sample rate ${base.audioSampleRate} vs ${s.audioSampleRate}`);
80
+ if (s.audioTimebase !== base.audioTimebase)
81
+ mismatches.push(`audio timebase ${base.audioTimebase} vs ${s.audioTimebase}`);
82
+ if (s.streamCount !== base.streamCount)
83
+ mismatches.push(`stream count ${base.streamCount} vs ${s.streamCount}`);
84
+ const maxStreams = Math.max(base.streamSignatures.length, s.streamSignatures.length);
85
+ for (let i = 0; i < maxStreams; i++) {
86
+ if (s.streamSignatures[i] !== base.streamSignatures[i]) {
87
+ mismatches.push(`stream ${i} ${base.streamSignatures[i] ?? 'missing'} vs ${s.streamSignatures[i] ?? 'missing'}`);
88
+ }
89
+ }
90
+ if (mismatches.length > 0) {
91
+ diffs.push(` ${first.clip.id} ↔ ${p.clip.id}: ${mismatches.join('; ')}`);
92
+ }
93
+ }
94
+ return diffs;
95
+ }
96
+ export async function runCompose(opts) {
97
+ const outputDir = resolveOutputDir(opts.settings, opts.cwd);
98
+ // 1. job identity FIRST (realpath resolves any symlinks), spec read SECOND.
99
+ const absSpecPath = resolve(opts.cwd, opts.composeSpecPath);
100
+ const realSpecPath = await realpath(absSpecPath).catch(() => {
101
+ throw new VideoGenError('Compose spec not readable. Expected <jobDir>/compose-input.json under the video-gen output directory (.video-gen).', 'compose: spec unreadable');
102
+ });
103
+ const realOutput = await realpath(outputDir).catch(() => resolve(outputDir));
104
+ const jobDir = dirname(realSpecPath);
105
+ const realJobDir = jobDir;
106
+ const specRaw = await readFile(realSpecPath).catch(() => {
107
+ throw new VideoGenError('Compose spec not readable. Expected <jobDir>/compose-input.json under the video-gen output directory (.video-gen).', 'compose: spec unreadable');
108
+ });
109
+ const spec = parseComposeSpec(specRaw.toString('utf-8'));
110
+ if (realJobDir !== realOutput && !realJobDir.startsWith(`${realOutput}${sep}`)) {
111
+ throw new VideoGenError('The compose job directory must live under the video-gen output directory (.video-gen). Move your spec there.', 'compose: job outside outputDir');
112
+ }
113
+ const jobId = basename(jobDir);
114
+ const finalVideoPath = join(jobDir, 'final_video.mp4');
115
+ assertSafeId(jobId, 'job');
116
+ if (basename(realSpecPath) !== 'compose-input.json') {
117
+ throw new VideoGenError('The compose spec file must be named compose-input.json inside the job directory.', 'compose: spec name');
118
+ }
119
+ const release = opts.activeJobs.acquire(realJobDir);
120
+ try {
121
+ // 2. foreign-manifest guard FIRST: a directory holding a render/single
122
+ // manifest is NOT a fresh compose job — refuse before touching clips/.
123
+ {
124
+ const foreign = readJsonFile(join(jobDir, 'manifest.json'));
125
+ if (foreign && foreign.kind !== 'compose') {
126
+ throw new VideoGenError(`This directory already holds a "${foreign.kind ?? 'unknown'}" job manifest. Choose a different job directory for compose — refusing to overwrite another job's state.`, 'compose: foreign manifest');
127
+ }
128
+ }
129
+ const existing = loadComposeJob(jobDir);
130
+ if (!existing) {
131
+ const finalStat = await lstat(finalVideoPath).catch((error) => {
132
+ if (error.code === 'ENOENT')
133
+ return undefined;
134
+ throw error;
135
+ });
136
+ if (finalStat) {
137
+ throw new VideoGenError('final_video.mp4 already exists in this fresh compose job. Move it aside or choose a new job directory; refusing to replace existing files.', 'compose: final already exists');
138
+ }
139
+ }
140
+ // 2. Stage and hash inputs before publishing them. A drifted rerun never
141
+ // touches the old job's immutable clips; matching reruns verify the frozen
142
+ // bytes rather than silently repairing them.
143
+ opts.onUpdate?.('Snapshotting input clips into the job…');
144
+ const clipHashes = {};
145
+ const clipSnapshots = {};
146
+ const clipsDir = join(jobDir, 'clips');
147
+ const stagingDir = await mkdtemp(join(jobDir, '.clips-staging-'));
148
+ let fingerprint = '';
149
+ try {
150
+ for (const clip of spec.clips) {
151
+ const absClip = resolve(opts.cwd, clip.path);
152
+ const st = await lstat(absClip).catch(() => null);
153
+ if (!st?.isFile()) {
154
+ throw new VideoGenError(`Clip "${clip.id}" is not a readable regular file: ${safeBasename(clip.path)}.`, 'compose: clip unreadable');
155
+ }
156
+ const stagedPath = join(stagingDir, `${clip.id}.mp4`);
157
+ try {
158
+ await copyFile(absClip, stagedPath, COPYFILE_EXCL);
159
+ }
160
+ catch (error) {
161
+ if (error.code === 'ENOENT' &&
162
+ (await pathIsMissing(absClip))) {
163
+ throw new VideoGenError(`Clip "${clip.id}" is not readable: ${safeBasename(clip.path)}.`, 'compose: clip unreadable');
164
+ }
165
+ throw error;
166
+ }
167
+ clipHashes[clip.id] = await hashFileSha256(stagedPath, opts.signal);
168
+ }
169
+ fingerprint = specFingerprint(specRaw.toString('utf-8'), clipHashes);
170
+ if (existing && existing.fingerprint !== fingerprint) {
171
+ throw new VideoGenError('compose-input.json or one of the clips changed since this job was created. Revisions require a NEW job directory (rerunning the same path only resumes identical input).', 'compose: input drift');
172
+ }
173
+ const clipsStat = await lstat(clipsDir).catch(() => null);
174
+ if (clipsStat && (!clipsStat.isDirectory() || clipsStat.isSymbolicLink())) {
175
+ throw new VideoGenError('clips/ is not a regular directory (symlink?). Remove it and retry.', 'compose: dir invalid');
176
+ }
177
+ if (clipsStat) {
178
+ const realClips = await realpath(clipsDir);
179
+ if (!realClips.startsWith(`${realJobDir}${sep}`)) {
180
+ throw new VideoGenError('clips/ resolves outside the job directory (symlink?). Remove it and retry.', 'compose: dir escapes');
181
+ }
182
+ }
183
+ if (existing) {
184
+ for (const clip of spec.clips) {
185
+ const frozenPath = join(clipsDir, `${clip.id}.mp4`);
186
+ const frozenStat = await lstat(frozenPath).catch(() => null);
187
+ const expectedHash = existing.clipHashes[clip.id];
188
+ if (!frozenStat?.isFile() ||
189
+ !expectedHash ||
190
+ (await hashFileSha256(frozenPath, opts.signal)) !== expectedHash) {
191
+ throw new VideoGenError(`Frozen clip snapshot "${clip.id}" changed or is missing. Start a NEW job directory.`, 'compose: frozen snapshot invalid');
192
+ }
193
+ clipSnapshots[clip.id] = frozenPath;
194
+ }
195
+ }
196
+ else {
197
+ if (clipsStat) {
198
+ throw new VideoGenError('clips/ already exists in this fresh compose job. Move it aside or choose a new job directory; refusing to delete existing files.', 'compose: clips already exist');
199
+ }
200
+ await rename(stagingDir, clipsDir);
201
+ for (const clip of spec.clips) {
202
+ clipSnapshots[clip.id] = join(clipsDir, `${clip.id}.mp4`);
203
+ }
204
+ }
205
+ }
206
+ finally {
207
+ await rm(stagingDir, { recursive: true, force: true });
208
+ }
209
+ if (existing) {
210
+ if (existing.state === 'done') {
211
+ const finalStat = await lstat(finalVideoPath).catch(() => null);
212
+ if (existing.finalVideoPath !== finalVideoPath ||
213
+ !finalStat?.isFile() ||
214
+ finalStat.isSymbolicLink()) {
215
+ throw new VideoGenError('The completed manifest final video path is invalid. Restore final_video.mp4 inside the job directory or start a NEW job.', 'compose: invalid final path');
216
+ }
217
+ if ((await hashFileSha256(finalVideoPath, opts.signal)) !== existing.finalVideoHash) {
218
+ throw new VideoGenError('The cached final video changed since this compose job completed.', 'compose: final artifact changed');
219
+ }
220
+ return {
221
+ jobId,
222
+ finalVideoPath,
223
+ clipCount: spec.clips.length,
224
+ resumed: true,
225
+ };
226
+ }
227
+ opts.onUpdate?.(`Resuming compose job ${jobId} (fingerprint verified).`);
228
+ }
229
+ saveComposeJob(jobDir, {
230
+ jobId,
231
+ kind: 'compose',
232
+ state: 'concatenating',
233
+ fingerprint,
234
+ clipHashes,
235
+ updatedAt: new Date().toISOString(),
236
+ });
237
+ // 3. stream compatibility precheck via ffprobe
238
+ const ffmpeg = resolveFfmpeg(opts.settings.ffmpegPath);
239
+ if (!ffmpeg.runnable) {
240
+ throw new VideoGenError(`ffmpeg is not runnable (source tried: ${ffmpeg.source}). Install ffmpeg (brew/apt) or set pi-video-gen.ffmpegPath in GLOBAL settings.`, 'compose: ffmpeg missing');
241
+ }
242
+ const ffprobe = resolveFfprobe(opts.settings.ffmpegPath);
243
+ if (!ffprobe.runnable) {
244
+ throw new VideoGenError(`ffprobe is not runnable (source tried: ${ffprobe.source}) — required for stream compatibility prechecks.`, 'compose: ffprobe missing');
245
+ }
246
+ opts.onUpdate?.(`Probing ${spec.clips.length} clips for stream compatibility…`);
247
+ const probes = [];
248
+ for (const clip of spec.clips) {
249
+ probes.push({
250
+ clip,
251
+ streams: await probeStreams(ffprobe.path, clipSnapshots[clip.id], opts.signal),
252
+ });
253
+ }
254
+ const diffs = diffStreams(probes);
255
+ if (diffs.length > 0) {
256
+ saveComposeJob(jobDir, {
257
+ jobId,
258
+ kind: 'compose',
259
+ state: 'failed',
260
+ fingerprint,
261
+ clipHashes,
262
+ error: `stream mismatch: ${diffs.length} pair(s)`,
263
+ updatedAt: new Date().toISOString(),
264
+ });
265
+ throw new VideoGenError(`Clips are NOT stream-compatible for lossless concat:\n${diffs.join('\n')}\nResolve by re-encoding the mismatched clips to match, or ask the user how to proceed — compose will not silently transcode.`, 'compose: stream mismatch');
266
+ }
267
+ // 4. strict-copy concat (no fallback, no re-encode)
268
+ const inputs = spec.clips.map((c) => clipSnapshots[c.id]);
269
+ opts.onUpdate?.(`Concatenating ${inputs.length} clips (strict copy)…`);
270
+ try {
271
+ await concatVideos({
272
+ inputs,
273
+ outputPath: finalVideoPath,
274
+ ffmpegPath: ffmpeg.path,
275
+ signal: opts.signal,
276
+ strictCopy: true,
277
+ });
278
+ }
279
+ catch (error) {
280
+ saveComposeJob(jobDir, {
281
+ jobId,
282
+ kind: 'compose',
283
+ state: opts.signal?.aborted ? 'cancelled' : 'failed',
284
+ fingerprint,
285
+ clipHashes,
286
+ error: error instanceof Error ? error.message : 'concat failed',
287
+ updatedAt: new Date().toISOString(),
288
+ });
289
+ throw error;
290
+ }
291
+ const finalVideoHash = await hashFileSha256(finalVideoPath, opts.signal);
292
+ saveComposeJob(jobDir, {
293
+ jobId,
294
+ kind: 'compose',
295
+ state: 'done',
296
+ fingerprint,
297
+ clipHashes,
298
+ finalVideoPath,
299
+ finalVideoHash,
300
+ updatedAt: new Date().toISOString(),
301
+ });
302
+ return { jobId, finalVideoPath, clipCount: spec.clips.length, resumed: false };
303
+ }
304
+ finally {
305
+ release();
306
+ }
307
+ }
308
+ //# sourceMappingURL=compose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose.js","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,E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,WAAW;YACX,UAAU;YACV,cAAc;YACd,cAAc;YACd,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAC,CAAC;QACH,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IACjF,CAAC;YAAS,CAAC;QACT,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { ResolvedModel, ResolvedProvider, VideoApiStyle, VideoGenSettings } from './types.js';
2
+ /**
3
+ * Load `pi-video-gen` settings with the trust boundary applied:
4
+ * - untrusted project ⇒ the project layer is ignored entirely;
5
+ * - trusted project ⇒ only PROJECT_ALLOWED_KEYS are honored from the project
6
+ * layer; sensitive keys there are stripped (and reported once to stderr).
7
+ */
8
+ export declare function loadVideoGenSettings(cwd: string, projectTrusted: boolean): VideoGenSettings;
9
+ /** Resolve the provider section for a wire format against built-in defaults. */
10
+ export declare function resolveProvider(settings: VideoGenSettings, style: VideoApiStyle): ResolvedProvider;
11
+ /**
12
+ * Resolve a model id/alias (defaulting to settings.defaultModel, then
13
+ * 'seedance'). Built-in registry wins over custom provider models on conflict.
14
+ */
15
+ export declare function resolveModel(settings: VideoGenSettings, modelId?: string): ResolvedModel | null;
16
+ /** Registry view for the video_capabilities tool / `/video-gen models`. */
17
+ export declare function listModelRegistry(settings: VideoGenSettings): {
18
+ activeId: string;
19
+ activeResolved: boolean;
20
+ models: {
21
+ id: string;
22
+ aliases: string[];
23
+ provider: string;
24
+ keyReady: boolean;
25
+ }[];
26
+ };
27
+ /** Job root directory (absolute). */
28
+ export declare function resolveOutputDir(settings: VideoGenSettings, cwd: string): string;
29
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAEV,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAEjB,MAAM,YAAY,CAAC;AA+OpB;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,GAAG,gBAAgB,CAmB3F;AAED,gFAAgF;AAChF,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,gBAAgB,EAC1B,KAAK,EAAE,aAAa,GACnB,gBAAgB,CAQlB;AAsDD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAW/F;AAED,2EAA2E;AAC3E,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,GAAG;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,OAAO,CAAC;IACxB,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;CAClF,CA0BA;AAED,qCAAqC;AACrC,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhF"}