@aippy/vite-plugins 0.4.0-dev.2 → 0.4.0-dev.4
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/README.md +6 -4
- package/dist/aippy-preload/html-utils.d.ts +0 -5
- package/dist/aippy-preload/index.js +1 -1
- package/dist/aippy-preload-BjhVTEKH.js +175 -0
- package/dist/asset-constants/generator-utils.d.ts +32 -6
- package/dist/asset-constants/index.js +391 -2
- package/dist/asset-constants/wrapper-keys.d.ts +1 -0
- package/dist/generator-utils-VznlFF00.js +228 -0
- package/dist/index/index.js +2 -2
- package/package.json +3 -5
- package/dist/aippy-preload-Dhhw3O6d.js +0 -170
- package/dist/asset-constants/manifest.d.ts +0 -53
- package/dist/asset-constants-BUK7zWRd.js +0 -360
- package/dist/manifest-DQGCd9CQ.js +0 -399
- package/src/asset-constants/assets.schema.json +0 -238
|
@@ -1,399 +0,0 @@
|
|
|
1
|
-
import { promises as e } from "fs";
|
|
2
|
-
import t from "path";
|
|
3
|
-
import { parse as n } from "@babel/parser";
|
|
4
|
-
import r from "@babel/traverse";
|
|
5
|
-
import * as i from "@babel/types";
|
|
6
|
-
//#region \0@oxc-project+runtime@0.144.0/helpers/esm/typeof.js
|
|
7
|
-
function a(e) {
|
|
8
|
-
"@babel/helpers - typeof";
|
|
9
|
-
return a = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
10
|
-
return typeof e;
|
|
11
|
-
} : function(e) {
|
|
12
|
-
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
13
|
-
}, a(e);
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region \0@oxc-project+runtime@0.144.0/helpers/esm/toPrimitive.js
|
|
17
|
-
function o(e, t) {
|
|
18
|
-
if (a(e) != "object" || !e) return e;
|
|
19
|
-
var n = e[Symbol.toPrimitive];
|
|
20
|
-
if (n !== void 0) {
|
|
21
|
-
var r = n.call(e, t || "default");
|
|
22
|
-
if (a(r) != "object") return r;
|
|
23
|
-
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
24
|
-
}
|
|
25
|
-
return (t === "string" ? String : Number)(e);
|
|
26
|
-
}
|
|
27
|
-
//#endregion
|
|
28
|
-
//#region \0@oxc-project+runtime@0.144.0/helpers/esm/toPropertyKey.js
|
|
29
|
-
function s(e) {
|
|
30
|
-
var t = o(e, "string");
|
|
31
|
-
return a(t) == "symbol" ? t : t + "";
|
|
32
|
-
}
|
|
33
|
-
//#endregion
|
|
34
|
-
//#region \0@oxc-project+runtime@0.144.0/helpers/esm/defineProperty.js
|
|
35
|
-
function c(e, t, n) {
|
|
36
|
-
return (t = s(t)) in e ? Object.defineProperty(e, t, {
|
|
37
|
-
value: n,
|
|
38
|
-
enumerable: !0,
|
|
39
|
-
configurable: !0,
|
|
40
|
-
writable: !0
|
|
41
|
-
}) : e[t] = n, e;
|
|
42
|
-
}
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region src/utils/file-scanner.ts
|
|
45
|
-
async function l(n, r) {
|
|
46
|
-
let i = [];
|
|
47
|
-
try {
|
|
48
|
-
let a = await e.readdir(n, { withFileTypes: !0 });
|
|
49
|
-
for (let e of a) {
|
|
50
|
-
let a = t.join(n, e.name);
|
|
51
|
-
if (e.isDirectory()) {
|
|
52
|
-
let e = await l(a, r);
|
|
53
|
-
i.push(...e);
|
|
54
|
-
} else if (e.isFile()) {
|
|
55
|
-
let n = t.extname(e.name);
|
|
56
|
-
r.includes(n) && i.push(a);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
} catch (e) {
|
|
60
|
-
console.warn(`Warning: Failed to read directory ${n}:`, e);
|
|
61
|
-
}
|
|
62
|
-
return i;
|
|
63
|
-
}
|
|
64
|
-
function u(e, n) {
|
|
65
|
-
let r = t.relative(t.dirname(e), n).replace(/\.(ts|tsx|js|jsx|json)$/, "");
|
|
66
|
-
return r.startsWith(".") ? r : `./${r}`;
|
|
67
|
-
}
|
|
68
|
-
function d(e, n) {
|
|
69
|
-
return `@/${t.relative(n, e).replace(/\.(ts|tsx|js|jsx|json)$/, "")}`;
|
|
70
|
-
}
|
|
71
|
-
var f = class {
|
|
72
|
-
constructor() {
|
|
73
|
-
c(this, "cache", /* @__PURE__ */ new Map());
|
|
74
|
-
}
|
|
75
|
-
async read(t) {
|
|
76
|
-
if (this.cache.has(t)) return this.cache.get(t);
|
|
77
|
-
let n = await e.readFile(t, "utf-8");
|
|
78
|
-
return this.cache.set(t, n), n;
|
|
79
|
-
}
|
|
80
|
-
invalidate(e) {
|
|
81
|
-
this.cache.delete(e);
|
|
82
|
-
}
|
|
83
|
-
clear() {
|
|
84
|
-
this.cache.clear();
|
|
85
|
-
}
|
|
86
|
-
}, p = typeof r == "function" ? r : r.default;
|
|
87
|
-
function m(e) {
|
|
88
|
-
return i.isImportDefaultSpecifier(e) || i.isImportSpecifier(e) && (i.isIdentifier(e.imported, { name: "default" }) || i.isStringLiteral(e.imported, { value: "default" }));
|
|
89
|
-
}
|
|
90
|
-
function h(e) {
|
|
91
|
-
return i.isTSAsExpression(e) || i.isTSTypeAssertion(e) || i.isTSNonNullExpression(e) || i.isTSSatisfiesExpression(e) || i.isParenthesizedExpression(e);
|
|
92
|
-
}
|
|
93
|
-
function g(e) {
|
|
94
|
-
for (; h(e);) e = e.expression;
|
|
95
|
-
return e;
|
|
96
|
-
}
|
|
97
|
-
function _(e, t) {
|
|
98
|
-
let n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
99
|
-
p(e, { ImportDeclaration: (e) => {
|
|
100
|
-
if (!(!t.has(e.node.source.value) || e.node.importKind === "type")) for (let t of e.node.specifiers) {
|
|
101
|
-
if (t.importKind === "type") continue;
|
|
102
|
-
let a = e.scope.getBinding(t.local.name);
|
|
103
|
-
i.isImportNamespaceSpecifier(t) && r.add(a), m(t) && n.add(a);
|
|
104
|
-
}
|
|
105
|
-
} });
|
|
106
|
-
let a = (e, t, o = /* @__PURE__ */ new Set()) => {
|
|
107
|
-
if (e = g(e), i.isIdentifier(e)) {
|
|
108
|
-
let s = t.getBinding(e.name);
|
|
109
|
-
if (n.has(s)) return "map";
|
|
110
|
-
if (r.has(s)) return "namespace";
|
|
111
|
-
if (s?.constant && s.kind === "const" && !o.has(s) && s.path.isVariableDeclarator() && s.path.node.init) {
|
|
112
|
-
o.add(s);
|
|
113
|
-
let t = s.path.node, n = a(t.init, s.path.scope, o);
|
|
114
|
-
if (i.isIdentifier(t.id, { name: e.name })) return n;
|
|
115
|
-
if (n === "namespace" && i.isObjectPattern(t.id) && t.id.properties.find((t) => i.isObjectProperty(t) && i.isIdentifier(t.value, { name: e.name }) && (t.computed ? i.isStringLiteral(g(t.key), { value: "default" }) : i.isIdentifier(t.key, { name: "default" }) || i.isStringLiteral(t.key, { value: "default" })))) return "map";
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
if ((i.isMemberExpression(e) || i.isOptionalMemberExpression(e)) && (e.computed ? i.isStringLiteral(g(e.property), { value: "default" }) : i.isIdentifier(e.property, { name: "default" })) && a(e.object, t, o) === "namespace") return "map";
|
|
119
|
-
};
|
|
120
|
-
return (e) => {
|
|
121
|
-
for (; h(e.parent) && e.key === "expression";) e = e.parentPath;
|
|
122
|
-
let t = e.parent;
|
|
123
|
-
if ((i.isMemberExpression(t) || i.isOptionalMemberExpression(t)) && e.key === "property" && t.computed) return a(t.object, e.scope) === "map";
|
|
124
|
-
if (i.isObjectProperty(t) && e.key === "key" && i.isObjectPattern(e.parentPath.parent)) {
|
|
125
|
-
let t = e.parentPath.parentPath;
|
|
126
|
-
if (i.isVariableDeclarator(t.parent) && t.key === "id" && t.parent.init) return a(t.parent.init, e.scope) === "map";
|
|
127
|
-
if (i.isAssignmentExpression(t.parent) && t.key === "left") return a(t.parent.right, e.scope) === "map";
|
|
128
|
-
}
|
|
129
|
-
return !1;
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
function v(e, t, n) {
|
|
133
|
-
let r = n.replace(/\.json$/, ".ts"), i = d(r, t), a = u(e, r);
|
|
134
|
-
return /* @__PURE__ */ new Set([
|
|
135
|
-
i,
|
|
136
|
-
i + ".ts",
|
|
137
|
-
a,
|
|
138
|
-
a + ".ts",
|
|
139
|
-
u(e, n) + ".json",
|
|
140
|
-
"@/config/assets.json"
|
|
141
|
-
]);
|
|
142
|
-
}
|
|
143
|
-
function y(e, t, r, i) {
|
|
144
|
-
let a = n(e, {
|
|
145
|
-
sourceType: "module",
|
|
146
|
-
plugins: [
|
|
147
|
-
"typescript",
|
|
148
|
-
"jsx",
|
|
149
|
-
"decorators-legacy"
|
|
150
|
-
]
|
|
151
|
-
}), o = _(a, v(t, r, i)), s = [];
|
|
152
|
-
p(a, { StringLiteral: (e) => {
|
|
153
|
-
o(e) && s.push([e.node.start, e.node.end]);
|
|
154
|
-
} });
|
|
155
|
-
for (let [t, n] of s.sort((e, t) => t[0] - e[0])) e = e.slice(0, t) + " ".repeat(n - t) + e.slice(n);
|
|
156
|
-
return e;
|
|
157
|
-
}
|
|
158
|
-
//#endregion
|
|
159
|
-
//#region src/asset-constants/manifest.ts
|
|
160
|
-
var b = 1 << 20, x = [
|
|
161
|
-
"image",
|
|
162
|
-
"image-bg",
|
|
163
|
-
"image-sprite",
|
|
164
|
-
"image-icon",
|
|
165
|
-
"image-tile",
|
|
166
|
-
"sound",
|
|
167
|
-
"music",
|
|
168
|
-
"synth",
|
|
169
|
-
"model",
|
|
170
|
-
"animation",
|
|
171
|
-
"video",
|
|
172
|
-
"file"
|
|
173
|
-
];
|
|
174
|
-
function S(e) {
|
|
175
|
-
throw Error(`assets: ${e}`);
|
|
176
|
-
}
|
|
177
|
-
function C(e, t, n = []) {
|
|
178
|
-
(!e || typeof e != "object" || Array.isArray(e)) && S("object required");
|
|
179
|
-
let r = e;
|
|
180
|
-
return Object.keys(r).some((e) => !t.includes(e)) && S("unknown field"), n.some((e) => !(e in r) || r[e] === null) && S("required field missing"), r;
|
|
181
|
-
}
|
|
182
|
-
function w(e, t, n = !1) {
|
|
183
|
-
(typeof e != "string" || Buffer.byteLength(e) > t || /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f\uFEFF]/.test(e) || n && !e.trim()) && S("invalid bounded text");
|
|
184
|
-
}
|
|
185
|
-
function T(e, t) {
|
|
186
|
-
(typeof e != "string" || !t.includes(e)) && S("unsupported field value");
|
|
187
|
-
}
|
|
188
|
-
function E(e, t = !1) {
|
|
189
|
-
(typeof e != "number" || !Number.isFinite(e) || e <= 0 || t && !Number.isInteger(e)) && S("positive dimension/duration required");
|
|
190
|
-
}
|
|
191
|
-
function D(e) {
|
|
192
|
-
let t = C(e, [
|
|
193
|
-
"stage",
|
|
194
|
-
"code",
|
|
195
|
-
"message",
|
|
196
|
-
"retryable"
|
|
197
|
-
], [
|
|
198
|
-
"stage",
|
|
199
|
-
"code",
|
|
200
|
-
"message",
|
|
201
|
-
"retryable"
|
|
202
|
-
]);
|
|
203
|
-
w(t.stage, 128, !0), w(t.code, 128, !0), w(t.message, 4096, !0), typeof t.retryable != "boolean" && S("retryable boolean required");
|
|
204
|
-
}
|
|
205
|
-
function O(e) {
|
|
206
|
-
return typeof e.schemaVersion == "number";
|
|
207
|
-
}
|
|
208
|
-
function k(e) {
|
|
209
|
-
let t = 0, n = () => {
|
|
210
|
-
for (; /\s/.test(e[t] ?? "") && t < e.length;) t++;
|
|
211
|
-
}, r = () => {
|
|
212
|
-
let n = t++;
|
|
213
|
-
for (; t < e.length;) {
|
|
214
|
-
if (e[t] === "\\") {
|
|
215
|
-
t += 2;
|
|
216
|
-
continue;
|
|
217
|
-
}
|
|
218
|
-
if (e[t++] === "\"") return JSON.parse(e.slice(n, t));
|
|
219
|
-
}
|
|
220
|
-
return S("invalid string");
|
|
221
|
-
}, i = () => {
|
|
222
|
-
if (n(), e[t] === "{") {
|
|
223
|
-
t++, n();
|
|
224
|
-
let a = /* @__PURE__ */ new Set();
|
|
225
|
-
for (; e[t] !== "}";) {
|
|
226
|
-
let o = r();
|
|
227
|
-
if (a.has(o) && S("duplicate object key"), a.add(o), n(), t++, i(), n(), e[t] !== ",") break;
|
|
228
|
-
t++, n();
|
|
229
|
-
}
|
|
230
|
-
t++;
|
|
231
|
-
} else if (e[t] === "[") {
|
|
232
|
-
for (t++, n(); e[t] !== "]" && (i(), n(), e[t] === ",");) t++, n();
|
|
233
|
-
t++;
|
|
234
|
-
} else if (e[t] === "\"") r();
|
|
235
|
-
else for (; t < e.length && !/[\s,\]}]/.test(e[t]);) t++;
|
|
236
|
-
};
|
|
237
|
-
i();
|
|
238
|
-
}
|
|
239
|
-
function A(e) {
|
|
240
|
-
(!e || Buffer.byteLength(e) > b) && S("invalid document size");
|
|
241
|
-
let t;
|
|
242
|
-
try {
|
|
243
|
-
t = JSON.parse(e);
|
|
244
|
-
} catch {
|
|
245
|
-
S("invalid JSON syntax");
|
|
246
|
-
}
|
|
247
|
-
k(e);
|
|
248
|
-
let n = C(t, Object.keys(t));
|
|
249
|
-
if (!("schemaVersion" in n)) return Object.values(n).some((e) => typeof e != "string") && S("legacy inventory must contain URLs"), n;
|
|
250
|
-
if (C(n, [
|
|
251
|
-
"schemaVersion",
|
|
252
|
-
"artStyle",
|
|
253
|
-
"assets",
|
|
254
|
-
"planningError",
|
|
255
|
-
"legacyInventory",
|
|
256
|
-
"legacyPlaceholderKeys"
|
|
257
|
-
], [
|
|
258
|
-
"schemaVersion",
|
|
259
|
-
"artStyle",
|
|
260
|
-
"assets"
|
|
261
|
-
]), n.schemaVersion !== 1 && S("unsupported schema version"), w(n.artStyle, 2048), n.legacyInventory !== void 0 && w(n.legacyInventory, b), n.legacyPlaceholderKeys !== void 0) {
|
|
262
|
-
Array.isArray(n.legacyPlaceholderKeys) || S("legacy placeholder keys must be an array");
|
|
263
|
-
for (let e of n.legacyPlaceholderKeys) w(e, 256, !0);
|
|
264
|
-
new Set(n.legacyPlaceholderKeys).size !== n.legacyPlaceholderKeys.length && S("duplicate legacy placeholder key");
|
|
265
|
-
}
|
|
266
|
-
n.planningError !== void 0 && (D(n.planningError), n.planningError.stage !== "planning" && S("planningError stage must be planning"));
|
|
267
|
-
let r = C(n.assets, Object.keys(n.assets ?? {}));
|
|
268
|
-
for (let [e, t] of Object.entries(r)) {
|
|
269
|
-
w(e, 256, !0);
|
|
270
|
-
let n = C(t, [
|
|
271
|
-
"type",
|
|
272
|
-
"source",
|
|
273
|
-
"replaceable",
|
|
274
|
-
"description",
|
|
275
|
-
"params",
|
|
276
|
-
"generation",
|
|
277
|
-
"status",
|
|
278
|
-
"url",
|
|
279
|
-
"output",
|
|
280
|
-
"error",
|
|
281
|
-
"implementation"
|
|
282
|
-
], [
|
|
283
|
-
"type",
|
|
284
|
-
"source",
|
|
285
|
-
"replaceable",
|
|
286
|
-
"description",
|
|
287
|
-
"status"
|
|
288
|
-
]);
|
|
289
|
-
if (T(n.type, x), T(n.source, [
|
|
290
|
-
"generated",
|
|
291
|
-
"user",
|
|
292
|
-
"existing",
|
|
293
|
-
"code"
|
|
294
|
-
]), (typeof n.replaceable != "boolean" || n.replaceable !== (n.source !== "code")) && S("source/replaceable mismatch"), w(n.description, 4096, !0), T(n.status, [
|
|
295
|
-
"planned",
|
|
296
|
-
"ready",
|
|
297
|
-
"failed",
|
|
298
|
-
"skipped",
|
|
299
|
-
"degraded"
|
|
300
|
-
]), n.source === "generated") {
|
|
301
|
-
String(n.type).startsWith("image") || n.type === "sound" || n.type === "music" || S("unsupported generation type");
|
|
302
|
-
let e = C(n.generation, ["action", "prompt"], ["action", "prompt"]);
|
|
303
|
-
T(e.action, ["generate", "reuse"]), w(e.prompt, 4096, !0);
|
|
304
|
-
} else n.generation !== void 0 && S("non-generated assets cannot contain generation");
|
|
305
|
-
if ((n.type === "synth" || n.type === "animation") && n.source !== "code" && S("type requires code source"), n.url !== void 0 && (w(n.url, 4096), (typeof n.url != "string" || !M(n.url)) && S("invalid resource reference")), (n.source === "user" || n.source === "existing") && (!n.url || n.status !== "ready") && S("existing resource requires ready URL"), n.source === "generated" && n.status === "ready" && !n.url && S("ready media requires URL"), n.status === "degraded" && (n.source !== "generated" || !n.url || !n.error) && S("degraded media requires temporary URL and reason"), n.params !== void 0) {
|
|
306
|
-
let e = C(n.params, [
|
|
307
|
-
"width",
|
|
308
|
-
"height",
|
|
309
|
-
"durationSeconds",
|
|
310
|
-
"loop"
|
|
311
|
-
]);
|
|
312
|
-
for (let t of ["width", "height"]) e[t] !== void 0 && E(e[t], !0);
|
|
313
|
-
e.durationSeconds !== void 0 && E(e.durationSeconds), e.loop !== void 0 && typeof e.loop != "boolean" && S("loop boolean required");
|
|
314
|
-
}
|
|
315
|
-
if (n.output !== void 0) {
|
|
316
|
-
let e = C(n.output, [
|
|
317
|
-
"format",
|
|
318
|
-
"width",
|
|
319
|
-
"height",
|
|
320
|
-
"durationSeconds"
|
|
321
|
-
]);
|
|
322
|
-
e.format !== void 0 && w(e.format, 32);
|
|
323
|
-
for (let t of ["width", "height"]) e[t] !== void 0 && E(e[t], !0);
|
|
324
|
-
e.durationSeconds !== void 0 && E(e.durationSeconds);
|
|
325
|
-
}
|
|
326
|
-
if (n.error !== void 0 && D(n.error), n.implementation !== void 0) {
|
|
327
|
-
let e = C(n.implementation, [
|
|
328
|
-
"method",
|
|
329
|
-
"description",
|
|
330
|
-
"status",
|
|
331
|
-
"path",
|
|
332
|
-
"symbol"
|
|
333
|
-
], [
|
|
334
|
-
"method",
|
|
335
|
-
"description",
|
|
336
|
-
"status"
|
|
337
|
-
]);
|
|
338
|
-
T(e.method, [
|
|
339
|
-
"svg",
|
|
340
|
-
"canvas",
|
|
341
|
-
"css",
|
|
342
|
-
"synth",
|
|
343
|
-
"animation",
|
|
344
|
-
"three"
|
|
345
|
-
]), T(e.status, ["planned", "ready"]), w(e.description, 4096, !0), e.path !== void 0 && w(e.path, 4096), e.symbol !== void 0 && w(e.symbol, 256), e.status === "ready" && !e.path && !e.symbol && S("ready implementation requires path or symbol"), n.source === "code" && n.status !== e.status && S("code status mismatch");
|
|
346
|
-
}
|
|
347
|
-
n.source === "code" && (!n.implementation || n.url || n.output || n.error || !["planned", "ready"].includes(String(n.status))) && S("code requires implementation without media result");
|
|
348
|
-
}
|
|
349
|
-
for (let e of n.legacyPlaceholderKeys ?? []) {
|
|
350
|
-
let t = r[e];
|
|
351
|
-
(!t || t.source !== "code" || t.type !== "file" || t.url) && S("invalid legacy placeholder key");
|
|
352
|
-
}
|
|
353
|
-
return n;
|
|
354
|
-
}
|
|
355
|
-
function j(e) {
|
|
356
|
-
return Buffer.byteLength(e, "utf8") <= 4096 && [
|
|
357
|
-
"",
|
|
358
|
-
"-",
|
|
359
|
-
"--",
|
|
360
|
-
"tbd",
|
|
361
|
-
"todo",
|
|
362
|
-
"none",
|
|
363
|
-
"n/a",
|
|
364
|
-
"null",
|
|
365
|
-
"pending",
|
|
366
|
-
"not-generated",
|
|
367
|
-
"待生成",
|
|
368
|
-
"待制作"
|
|
369
|
-
].includes(e.trim().toLowerCase());
|
|
370
|
-
}
|
|
371
|
-
function M(e) {
|
|
372
|
-
if (!e || e.trim() !== e || /[\r\n\t\\]/.test(e) || e.startsWith("//") || /%(?![0-9a-f]{2})/i.test(e.split("?")[0]) || /%(?![0-9a-f]{2})/i.test(e.split("#")[1] ?? "")) return !1;
|
|
373
|
-
if (!/^[a-z][a-z0-9+.-]*:/i.test(e)) {
|
|
374
|
-
if (e.split(/[?#]/, 1)[0].split("/", 1)[0].includes(":")) return !1;
|
|
375
|
-
let t = e.split(/[?#]/, 1)[0].replace(/%([0-9a-f]{2})/gi, (e, t) => String.fromCharCode(Number.parseInt(t, 16)));
|
|
376
|
-
if (!t || t.endsWith("/") || j(t)) return !1;
|
|
377
|
-
if (t.includes("/")) return !0;
|
|
378
|
-
let n = t.lastIndexOf(".");
|
|
379
|
-
return n > 0 && n < t.length - 1;
|
|
380
|
-
}
|
|
381
|
-
if (!/^https?:\/\//i.test(e)) return !1;
|
|
382
|
-
try {
|
|
383
|
-
let t = e.slice(e.indexOf("://") + 3).split(/[/?#]/, 1)[0];
|
|
384
|
-
if (!t || t.includes("%")) return !1;
|
|
385
|
-
let n = new URL(e);
|
|
386
|
-
return ["http:", "https:"].includes(n.protocol) && !!n.hostname && !n.username && !n.password;
|
|
387
|
-
} catch {
|
|
388
|
-
return !1;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
function N(e) {
|
|
392
|
-
return O(e) ? Object.fromEntries(Object.entries(e.assets).filter(([, e]) => e.replaceable && typeof e.url == "string" && e.url.length > 0).map(([e, t]) => [e, t.url])) : { ...e };
|
|
393
|
-
}
|
|
394
|
-
function P(e) {
|
|
395
|
-
let t = e.split(/[?#]/)[0].toLowerCase();
|
|
396
|
-
return /\.(mp3|wav|ogg|m4a|aac|flac)$/.test(t) ? "sound" : /\.(mp4|webm|mov)$/.test(t) ? "video" : /\.(png|jpg|jpeg|gif|svg|webp|avif)$/.test(t) ? "image" : /\.(glb|gltf|obj)$/.test(t) ? "model" : "file";
|
|
397
|
-
}
|
|
398
|
-
//#endregion
|
|
399
|
-
export { m as a, _ as c, l as d, u as f, A as i, f as l, P as n, y as o, c as p, O as r, v as s, N as t, d as u };
|
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"title": "Aippy asset manifest",
|
|
4
|
-
"type": "object",
|
|
5
|
-
"additionalProperties": false,
|
|
6
|
-
"required": ["schemaVersion", "artStyle", "assets"],
|
|
7
|
-
"properties": {
|
|
8
|
-
"schemaVersion": { "const": 1 },
|
|
9
|
-
"artStyle": { "type": "string" },
|
|
10
|
-
"legacyInventory": { "type": "string" },
|
|
11
|
-
"legacyPlaceholderKeys": {
|
|
12
|
-
"type": "array",
|
|
13
|
-
"uniqueItems": true,
|
|
14
|
-
"items": { "type": "string", "minLength": 1 }
|
|
15
|
-
},
|
|
16
|
-
"planningError": {
|
|
17
|
-
"allOf": [
|
|
18
|
-
{ "$ref": "#/$defs/error" },
|
|
19
|
-
{ "properties": { "stage": { "const": "planning" } } }
|
|
20
|
-
]
|
|
21
|
-
},
|
|
22
|
-
"assets": {
|
|
23
|
-
"type": "object",
|
|
24
|
-
"propertyNames": { "minLength": 1 },
|
|
25
|
-
"additionalProperties": { "$ref": "#/$defs/entry" }
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"$defs": {
|
|
29
|
-
"error": {
|
|
30
|
-
"type": "object",
|
|
31
|
-
"additionalProperties": false,
|
|
32
|
-
"required": ["stage", "code", "message", "retryable"],
|
|
33
|
-
"properties": {
|
|
34
|
-
"stage": { "type": "string", "minLength": 1 },
|
|
35
|
-
"code": { "type": "string", "minLength": 1 },
|
|
36
|
-
"message": { "type": "string", "minLength": 1 },
|
|
37
|
-
"retryable": { "type": "boolean" }
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
"params": {
|
|
41
|
-
"type": "object",
|
|
42
|
-
"additionalProperties": false,
|
|
43
|
-
"properties": {
|
|
44
|
-
"width": { "type": "integer", "minimum": 1 },
|
|
45
|
-
"height": { "type": "integer", "minimum": 1 },
|
|
46
|
-
"durationSeconds": { "type": "number", "exclusiveMinimum": 0 },
|
|
47
|
-
"loop": { "type": "boolean" }
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
"output": {
|
|
51
|
-
"type": "object",
|
|
52
|
-
"additionalProperties": false,
|
|
53
|
-
"properties": {
|
|
54
|
-
"format": { "type": "string" },
|
|
55
|
-
"width": { "type": "integer", "minimum": 1 },
|
|
56
|
-
"height": { "type": "integer", "minimum": 1 },
|
|
57
|
-
"durationSeconds": { "type": "number", "exclusiveMinimum": 0 }
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
"implementation": {
|
|
61
|
-
"type": "object",
|
|
62
|
-
"additionalProperties": false,
|
|
63
|
-
"required": ["method", "description", "status"],
|
|
64
|
-
"properties": {
|
|
65
|
-
"method": {
|
|
66
|
-
"enum": ["svg", "canvas", "css", "synth", "animation", "three"]
|
|
67
|
-
},
|
|
68
|
-
"description": { "type": "string", "minLength": 1 },
|
|
69
|
-
"status": { "enum": ["planned", "ready"] },
|
|
70
|
-
"path": { "type": "string" },
|
|
71
|
-
"symbol": { "type": "string" }
|
|
72
|
-
},
|
|
73
|
-
"allOf": [
|
|
74
|
-
{
|
|
75
|
-
"if": { "properties": { "status": { "const": "ready" } } },
|
|
76
|
-
"then": {
|
|
77
|
-
"anyOf": [
|
|
78
|
-
{
|
|
79
|
-
"required": ["path"],
|
|
80
|
-
"properties": { "path": { "minLength": 1 } }
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
"required": ["symbol"],
|
|
84
|
-
"properties": { "symbol": { "minLength": 1 } }
|
|
85
|
-
}
|
|
86
|
-
]
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
]
|
|
90
|
-
},
|
|
91
|
-
"entry": {
|
|
92
|
-
"type": "object",
|
|
93
|
-
"additionalProperties": false,
|
|
94
|
-
"required": ["type", "source", "replaceable", "description", "status"],
|
|
95
|
-
"properties": {
|
|
96
|
-
"type": {
|
|
97
|
-
"enum": [
|
|
98
|
-
"image",
|
|
99
|
-
"image-bg",
|
|
100
|
-
"image-sprite",
|
|
101
|
-
"image-icon",
|
|
102
|
-
"image-tile",
|
|
103
|
-
"sound",
|
|
104
|
-
"music",
|
|
105
|
-
"synth",
|
|
106
|
-
"model",
|
|
107
|
-
"animation",
|
|
108
|
-
"video",
|
|
109
|
-
"file"
|
|
110
|
-
]
|
|
111
|
-
},
|
|
112
|
-
"source": { "enum": ["generated", "user", "existing", "code"] },
|
|
113
|
-
"replaceable": { "type": "boolean" },
|
|
114
|
-
"description": { "type": "string", "minLength": 1 },
|
|
115
|
-
"params": { "$ref": "#/$defs/params" },
|
|
116
|
-
"generation": {
|
|
117
|
-
"type": "object",
|
|
118
|
-
"additionalProperties": false,
|
|
119
|
-
"required": ["action", "prompt"],
|
|
120
|
-
"properties": {
|
|
121
|
-
"action": { "enum": ["generate", "reuse"] },
|
|
122
|
-
"prompt": { "type": "string", "minLength": 1 }
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
"status": {
|
|
126
|
-
"enum": ["planned", "ready", "failed", "skipped", "degraded"]
|
|
127
|
-
},
|
|
128
|
-
"url": { "type": "string" },
|
|
129
|
-
"output": { "$ref": "#/$defs/output" },
|
|
130
|
-
"error": { "$ref": "#/$defs/error" },
|
|
131
|
-
"implementation": { "$ref": "#/$defs/implementation" }
|
|
132
|
-
},
|
|
133
|
-
"allOf": [
|
|
134
|
-
{
|
|
135
|
-
"if": { "properties": { "source": { "const": "generated" } } },
|
|
136
|
-
"then": {
|
|
137
|
-
"required": ["generation"],
|
|
138
|
-
"properties": {
|
|
139
|
-
"replaceable": { "const": true },
|
|
140
|
-
"type": {
|
|
141
|
-
"enum": [
|
|
142
|
-
"image",
|
|
143
|
-
"image-bg",
|
|
144
|
-
"image-sprite",
|
|
145
|
-
"image-icon",
|
|
146
|
-
"image-tile",
|
|
147
|
-
"sound",
|
|
148
|
-
"music"
|
|
149
|
-
]
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
"else": { "not": { "required": ["generation"] } }
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
"if": { "properties": { "source": { "const": "code" } } },
|
|
157
|
-
"then": {
|
|
158
|
-
"required": ["implementation"],
|
|
159
|
-
"properties": {
|
|
160
|
-
"replaceable": { "const": false },
|
|
161
|
-
"status": { "enum": ["planned", "ready"] }
|
|
162
|
-
},
|
|
163
|
-
"not": {
|
|
164
|
-
"anyOf": [
|
|
165
|
-
{ "required": ["url"] },
|
|
166
|
-
{ "required": ["output"] },
|
|
167
|
-
{ "required": ["error"] }
|
|
168
|
-
]
|
|
169
|
-
},
|
|
170
|
-
"allOf": [
|
|
171
|
-
{
|
|
172
|
-
"if": { "properties": { "status": { "const": "ready" } } },
|
|
173
|
-
"then": {
|
|
174
|
-
"properties": {
|
|
175
|
-
"implementation": {
|
|
176
|
-
"properties": { "status": { "const": "ready" } }
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
"if": { "properties": { "status": { "const": "planned" } } },
|
|
183
|
-
"then": {
|
|
184
|
-
"properties": {
|
|
185
|
-
"implementation": {
|
|
186
|
-
"properties": { "status": { "const": "planned" } }
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
]
|
|
192
|
-
},
|
|
193
|
-
"else": { "properties": { "replaceable": { "const": true } } }
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
"if": {
|
|
197
|
-
"properties": { "type": { "enum": ["synth", "animation"] } }
|
|
198
|
-
},
|
|
199
|
-
"then": { "properties": { "source": { "const": "code" } } }
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
"if": {
|
|
203
|
-
"properties": { "source": { "enum": ["user", "existing"] } }
|
|
204
|
-
},
|
|
205
|
-
"then": {
|
|
206
|
-
"required": ["url"],
|
|
207
|
-
"properties": {
|
|
208
|
-
"url": { "minLength": 1 },
|
|
209
|
-
"status": { "const": "ready" }
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
"if": {
|
|
215
|
-
"properties": {
|
|
216
|
-
"source": { "const": "generated" },
|
|
217
|
-
"status": { "const": "ready" }
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
"then": {
|
|
221
|
-
"required": ["url"],
|
|
222
|
-
"properties": { "url": { "minLength": 1 } }
|
|
223
|
-
}
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
"if": { "properties": { "status": { "const": "degraded" } } },
|
|
227
|
-
"then": {
|
|
228
|
-
"required": ["url", "error"],
|
|
229
|
-
"properties": {
|
|
230
|
-
"source": { "const": "generated" },
|
|
231
|
-
"url": { "minLength": 1 }
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
]
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|