@avis-studio/mini-app 0.1.0-beta.2 → 0.1.0-beta.3
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 +11 -1
- package/dist/{apps-dWIWlsgx.js → apps-Igq7CNCO.js} +467 -278
- package/dist/index.js +8 -8
- package/dist/react.js +12012 -11853
- package/dist/style.css +1 -1
- package/dist/types/packages/mini-app/src/apps.d.ts +7 -0
- package/dist/types/packages/mini-app/src/index.d.ts +2 -1
- package/dist/types/packages/mini-app/src/react.d.ts +0 -1
- package/dist/types/src/components/illustrations/fly-coins.d.ts +32 -0
- package/dist/types/src/components/ui/scroll-area.d.ts +5 -3
- package/dist/types/src/components/ui/tooltip.d.ts +5 -1
- package/dist/types/src/features/studio/model/app-draft.d.ts +21 -1
- package/dist/types/src/features/studio/model/app-json-schema.d.ts +27 -0
- package/dist/types/src/i18n/en-studio.d.ts +2 -0
- package/dist/types/src/i18n/en.d.ts +2 -0
- package/dist/types/src/i18n/index.d.ts +2 -0
- package/dist/types/src/rules/hover-waits-for-scroll.d.ts +10 -0
- package/dist/types/src/rules/index.d.ts +1 -0
- package/package.json +4 -3
|
@@ -6134,60 +6134,241 @@ function se(e) {
|
|
|
6134
6134
|
} : { name: "sparkle" };
|
|
6135
6135
|
}
|
|
6136
6136
|
// ../../src/features/studio/catalog/apps-config.ts
|
|
6137
|
-
function
|
|
6137
|
+
function w(e) {
|
|
6138
6138
|
if (e === "image") return ae("image-generate");
|
|
6139
6139
|
let t = ae("video-generate");
|
|
6140
6140
|
return e === "video-frames" ? t.filter((e) => e.frames) : t;
|
|
6141
6141
|
}
|
|
6142
|
+
// ../../src/features/studio/model/app-json-schema.ts
|
|
6143
|
+
var ce = "https://json-schema.org/draft/2020-12/schema", le = { anyOf: [{
|
|
6144
|
+
type: "string",
|
|
6145
|
+
format: "uri-reference"
|
|
6146
|
+
}, {
|
|
6147
|
+
type: "object",
|
|
6148
|
+
required: ["url"],
|
|
6149
|
+
properties: {
|
|
6150
|
+
url: {
|
|
6151
|
+
type: "string",
|
|
6152
|
+
format: "uri-reference"
|
|
6153
|
+
},
|
|
6154
|
+
name: { type: "string" },
|
|
6155
|
+
kind: { enum: ["image", "video"] }
|
|
6156
|
+
}
|
|
6157
|
+
}] };
|
|
6158
|
+
function T(e) {
|
|
6159
|
+
return Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0));
|
|
6160
|
+
}
|
|
6161
|
+
function E(e) {
|
|
6162
|
+
return {
|
|
6163
|
+
title: e.title,
|
|
6164
|
+
description: e.description,
|
|
6165
|
+
"x-avis-control": e.type,
|
|
6166
|
+
"x-avis-hidden": e.hidden,
|
|
6167
|
+
"x-avis-disabled": e.disabled
|
|
6168
|
+
};
|
|
6169
|
+
}
|
|
6170
|
+
function ue(e) {
|
|
6171
|
+
return e === "video" ? "video/*" : e === "image" ? "image/*" : void 0;
|
|
6172
|
+
}
|
|
6173
|
+
function de(t) {
|
|
6174
|
+
switch (t.type) {
|
|
6175
|
+
case e.Media: return T({
|
|
6176
|
+
...E(t),
|
|
6177
|
+
$ref: "#/$defs/media",
|
|
6178
|
+
"x-avis-media": ue(t.kind)
|
|
6179
|
+
});
|
|
6180
|
+
case e.Array: return t.control.type === e.Media ? T({
|
|
6181
|
+
...E(t),
|
|
6182
|
+
type: "array",
|
|
6183
|
+
items: { $ref: "#/$defs/media" },
|
|
6184
|
+
maxItems: t.maxCount,
|
|
6185
|
+
"x-avis-media": ue(t.control.kind)
|
|
6186
|
+
}) : T({
|
|
6187
|
+
...E(t),
|
|
6188
|
+
type: "array",
|
|
6189
|
+
items: {
|
|
6190
|
+
type: "string",
|
|
6191
|
+
enum: t.control.instances.map((e) => e.name)
|
|
6192
|
+
},
|
|
6193
|
+
uniqueItems: !0,
|
|
6194
|
+
maxItems: t.maxCount
|
|
6195
|
+
});
|
|
6196
|
+
case e.Enum: {
|
|
6197
|
+
let e = t.options.map((e) => e.value), n = t.defaultValue ?? e[0];
|
|
6198
|
+
return T({
|
|
6199
|
+
...E(t),
|
|
6200
|
+
type: "string",
|
|
6201
|
+
enum: t.fromModel ? void 0 : e,
|
|
6202
|
+
default: n || void 0,
|
|
6203
|
+
"x-avis-display": t.display,
|
|
6204
|
+
"x-avis-from-model": t.fromModel
|
|
6205
|
+
});
|
|
6206
|
+
}
|
|
6207
|
+
case e.Boolean: return T({
|
|
6208
|
+
...E(t),
|
|
6209
|
+
type: "boolean",
|
|
6210
|
+
default: t.defaultValue ?? !1
|
|
6211
|
+
});
|
|
6212
|
+
case e.Number: return T({
|
|
6213
|
+
...E(t),
|
|
6214
|
+
type: "number",
|
|
6215
|
+
minimum: t.min,
|
|
6216
|
+
maximum: t.max,
|
|
6217
|
+
default: t.defaultValue,
|
|
6218
|
+
"x-avis-step": t.step
|
|
6219
|
+
});
|
|
6220
|
+
case e.Color: return T({
|
|
6221
|
+
...E(t),
|
|
6222
|
+
type: "string",
|
|
6223
|
+
pattern: "^#[0-9a-fA-F]{6}$",
|
|
6224
|
+
default: t.defaultValue
|
|
6225
|
+
});
|
|
6226
|
+
case e.String: return T({
|
|
6227
|
+
...E(t),
|
|
6228
|
+
type: "string",
|
|
6229
|
+
maxLength: t.limit,
|
|
6230
|
+
"x-avis-placeholder": t.placeholder
|
|
6231
|
+
});
|
|
6232
|
+
case e.Model: {
|
|
6233
|
+
let e = w(t.models).map((e) => e.id);
|
|
6234
|
+
return T({
|
|
6235
|
+
...E(t),
|
|
6236
|
+
type: "string",
|
|
6237
|
+
enum: e.length ? e : void 0,
|
|
6238
|
+
default: e[0],
|
|
6239
|
+
"x-avis-models": t.models
|
|
6240
|
+
});
|
|
6241
|
+
}
|
|
6242
|
+
case e.ComponentInstance: return T({
|
|
6243
|
+
...E(t),
|
|
6244
|
+
type: "string",
|
|
6245
|
+
enum: t.instances.map((e) => e.name)
|
|
6246
|
+
});
|
|
6247
|
+
case e.Editor: return T({
|
|
6248
|
+
...E(t),
|
|
6249
|
+
type: "string",
|
|
6250
|
+
default: t.defaultValue,
|
|
6251
|
+
"x-avis-editor": t.editor,
|
|
6252
|
+
"x-avis-source": t.source
|
|
6253
|
+
});
|
|
6254
|
+
default: return null;
|
|
6255
|
+
}
|
|
6256
|
+
}
|
|
6257
|
+
function fe(t) {
|
|
6258
|
+
switch (t.type) {
|
|
6259
|
+
case e.Media: return !t.optional;
|
|
6260
|
+
case e.Array: return t.control.type === e.Media && !("optional" in t && t.optional);
|
|
6261
|
+
case e.String: return !!t.required;
|
|
6262
|
+
case e.Enum: return t.display === "gallery" && t.defaultValue === "";
|
|
6263
|
+
default: return !1;
|
|
6264
|
+
}
|
|
6265
|
+
}
|
|
6266
|
+
function pe(e, t) {
|
|
6267
|
+
if (!t) return e;
|
|
6268
|
+
let n = (e, t) => e && t ? { any: [e, t] } : e ?? t;
|
|
6269
|
+
return {
|
|
6270
|
+
...e,
|
|
6271
|
+
hidden: n(t.hidden, e.hidden),
|
|
6272
|
+
disabled: n(t.disabled, e.disabled)
|
|
6273
|
+
};
|
|
6274
|
+
}
|
|
6275
|
+
function me(t) {
|
|
6276
|
+
return t.flatMap((t) => {
|
|
6277
|
+
let n = t.type === e.Settings ? [...t.controls, ...t.advanced ?? []] : t.type === e.Object ? t.controls : t.type === e.Lighting ? t.controls ?? [] : null;
|
|
6278
|
+
return n ? n.map((e) => pe(e, t)) : [t];
|
|
6279
|
+
});
|
|
6280
|
+
}
|
|
6281
|
+
function he(e, t = {}) {
|
|
6282
|
+
let n = {}, r = [];
|
|
6283
|
+
for (let i of me(e)) {
|
|
6284
|
+
let e = de(i);
|
|
6285
|
+
if (!e) continue;
|
|
6286
|
+
let a = t.defaults?.[i.key];
|
|
6287
|
+
a !== void 0 && a !== "" && e.type === "string" && (e.default = a), fe(i) && (i.hidden ? e["x-avis-required"] = !0 : r.push(i.key)), n[i.key] = e;
|
|
6288
|
+
}
|
|
6289
|
+
return T({
|
|
6290
|
+
$schema: ce,
|
|
6291
|
+
"x-avis-app": t.id,
|
|
6292
|
+
title: t.title,
|
|
6293
|
+
description: t.description,
|
|
6294
|
+
type: "object",
|
|
6295
|
+
properties: n,
|
|
6296
|
+
required: r.length ? r : void 0,
|
|
6297
|
+
$defs: { media: le }
|
|
6298
|
+
});
|
|
6299
|
+
}
|
|
6142
6300
|
// ../../src/features/studio/model/app-draft.ts
|
|
6143
|
-
function
|
|
6301
|
+
function ge(e) {
|
|
6144
6302
|
return {
|
|
6145
|
-
...l(x(e), (e) =>
|
|
6303
|
+
...l(x(e), (e) => w(e)[0]?.id ?? ""),
|
|
6146
6304
|
...e.defaults
|
|
6147
6305
|
};
|
|
6148
6306
|
}
|
|
6149
|
-
function
|
|
6307
|
+
function D(e) {
|
|
6150
6308
|
let t = e.uploads ?? {};
|
|
6151
6309
|
return {
|
|
6152
6310
|
choices: e.choices,
|
|
6153
6311
|
filled: (n) => e.choices[`${n}:on`] !== "off" && Object.keys(t).some((e) => e === n || e.startsWith(`${n}:`))
|
|
6154
6312
|
};
|
|
6155
6313
|
}
|
|
6156
|
-
function
|
|
6314
|
+
function _e(e, t = "") {
|
|
6157
6315
|
let n = e.prompt.mode === "off" ? "" : t;
|
|
6158
6316
|
return {
|
|
6159
|
-
choices:
|
|
6317
|
+
choices: ge(e),
|
|
6160
6318
|
prompt: n,
|
|
6161
6319
|
promptOn: e.prompt.mode === "required" || n !== "",
|
|
6162
6320
|
uploads: {}
|
|
6163
6321
|
};
|
|
6164
6322
|
}
|
|
6165
|
-
function
|
|
6166
|
-
let i = new Set(c(x(e),
|
|
6323
|
+
function ve(e, n, r = {}) {
|
|
6324
|
+
let i = new Set(c(x(e), D({
|
|
6167
6325
|
choices: n,
|
|
6168
6326
|
uploads: r
|
|
6169
6327
|
})).filter((e) => t(e)).map((e) => e.key));
|
|
6170
6328
|
return e.media.filter((e) => i.has(e.id));
|
|
6171
6329
|
}
|
|
6172
|
-
function
|
|
6173
|
-
let r =
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6330
|
+
function ye(t, n) {
|
|
6331
|
+
let r = [];
|
|
6332
|
+
for (let e of ve(t, n.choices, n.uploads)) {
|
|
6333
|
+
let t = O(n, e.id);
|
|
6334
|
+
t.some((e) => e.status) ? r.push({
|
|
6335
|
+
key: e.id,
|
|
6336
|
+
title: e.title,
|
|
6337
|
+
problem: "uploading"
|
|
6338
|
+
}) : !e.optional && !t.length && r.push({
|
|
6339
|
+
key: e.id,
|
|
6340
|
+
title: e.title,
|
|
6341
|
+
problem: "missing"
|
|
6342
|
+
});
|
|
6343
|
+
}
|
|
6344
|
+
let i = c(x(t), D(n));
|
|
6345
|
+
for (let t of i) t.type === e.Enum && t.display === "gallery" && t.defaultValue === "" && !n.choices[t.key] && r.push({
|
|
6346
|
+
key: t.key,
|
|
6347
|
+
title: t.title,
|
|
6348
|
+
problem: "pick"
|
|
6349
|
+
});
|
|
6350
|
+
let a = i.filter((t) => t.type === e.String), o = a.find((e) => e.key === "prompt") ?? a[0];
|
|
6351
|
+
return o?.type === e.String && o.required && !n.prompt.trim() && r.push({
|
|
6352
|
+
key: "@prompt",
|
|
6353
|
+
title: o.title,
|
|
6354
|
+
problem: "prompt"
|
|
6355
|
+
}), r;
|
|
6356
|
+
}
|
|
6357
|
+
function be(e, t) {
|
|
6358
|
+
let [n] = ye(e, t);
|
|
6359
|
+
return n ? n.problem === "prompt" ? "prompt" : { upload: n.title } : null;
|
|
6179
6360
|
}
|
|
6180
|
-
function
|
|
6361
|
+
function O(e, t) {
|
|
6181
6362
|
return e.choices[`${t}:on`] === "off" ? [] : Object.entries(e.uploads).filter(([e]) => e === t || e.startsWith(`${t}:`)).sort(([e], [t]) => e.localeCompare(t, void 0, { numeric: !0 })).map(([, e]) => e);
|
|
6182
6363
|
}
|
|
6183
|
-
function
|
|
6364
|
+
function xe(e) {
|
|
6184
6365
|
let t = Math.max(0, Math.round(e)), n = (e) => String(e).padStart(2, "0"), r = Math.floor(t / 3600), i = Math.floor(t % 3600 / 60), a = t % 60;
|
|
6185
6366
|
return r > 0 ? `${r}:${n(i)}:${n(a)}` : `${n(i)}:${n(a)}`;
|
|
6186
6367
|
}
|
|
6187
|
-
function
|
|
6188
|
-
return e.status ? [] : [e.width && e.height ? `${e.width}x${e.height}` : "", e.kind === "video" && e.duration ?
|
|
6368
|
+
function Se(e) {
|
|
6369
|
+
return e.status ? [] : [e.width && e.height ? `${e.width}x${e.height}` : "", e.kind === "video" && e.duration ? xe(e.duration) : ""].filter(Boolean);
|
|
6189
6370
|
}
|
|
6190
|
-
function
|
|
6371
|
+
function Ce(e) {
|
|
6191
6372
|
let t = (t) => e.choices[`${t.split(":")[0]}:on`] === "off";
|
|
6192
6373
|
return Object.keys(e.uploads).some(t) ? {
|
|
6193
6374
|
...e,
|
|
@@ -6195,7 +6376,7 @@ function he(e) {
|
|
|
6195
6376
|
} : e;
|
|
6196
6377
|
}
|
|
6197
6378
|
// ../../src/features/marketing-apps/model-notes.ts
|
|
6198
|
-
var
|
|
6379
|
+
var we = {
|
|
6199
6380
|
"dreamina-seedance-2-0-fast": "Seedance 2.0 Fast",
|
|
6200
6381
|
"dreamina-seedance-2-0-mini": "Seedance 2.0 Mini",
|
|
6201
6382
|
"dreamina-seedance-2-5-flash": "Seedance 2.5 Flash",
|
|
@@ -6204,20 +6385,20 @@ var ge = {
|
|
|
6204
6385
|
"veo-3-1": "Veo 3.1",
|
|
6205
6386
|
"dola-seedream-5-5": "Seedream 5.5",
|
|
6206
6387
|
"gpt-image-2-5-flare": "GPT Image 2.5 Flare"
|
|
6207
|
-
},
|
|
6388
|
+
}, Te = {
|
|
6208
6389
|
lite: "Fastest and lowest cost: for drafts and quick tests.",
|
|
6209
6390
|
standard: "Balanced speed and quality: for most runs.",
|
|
6210
6391
|
pro: "Highest quality and motion detail: slower, costs more.",
|
|
6211
6392
|
"text-accurate": "Keeps words in the picture sharp and spelled right."
|
|
6212
6393
|
};
|
|
6213
|
-
function
|
|
6214
|
-
let n =
|
|
6394
|
+
function Ee([e, t]) {
|
|
6395
|
+
let n = we[e] ?? e, r = Te[t.trim().toLowerCase()];
|
|
6215
6396
|
return {
|
|
6216
6397
|
value: t,
|
|
6217
6398
|
preview: { description: r ? `${n} · ${r}` : n }
|
|
6218
6399
|
};
|
|
6219
6400
|
}
|
|
6220
|
-
function
|
|
6401
|
+
function De(e, t) {
|
|
6221
6402
|
if (e && e.trim().toLowerCase() !== "customise") return e;
|
|
6222
6403
|
let n = t.map((e) => e.label.trim());
|
|
6223
6404
|
if (n.length === 1) return n[0];
|
|
@@ -6226,13 +6407,13 @@ function ye(e, t) {
|
|
|
6226
6407
|
return r(/face|eye|hair|skin|body|build|age|gender/i) ? r(/outfit/i) ? "Appearance & outfit" : r(/style|accessor/i) ? "Appearance & style" : "Appearance" : "Style";
|
|
6227
6408
|
}
|
|
6228
6409
|
// ../../src/features/marketing-apps/engine-form.ts
|
|
6229
|
-
function
|
|
6410
|
+
function k(e, t) {
|
|
6230
6411
|
let n = e === "video" ? "MP4, MOV or WebM · Up to 100 MB" : "JPG, PNG or WebP · Up to 20 MB";
|
|
6231
6412
|
return t ? n : `Optional · ${n}`;
|
|
6232
6413
|
}
|
|
6233
|
-
var
|
|
6234
|
-
function
|
|
6235
|
-
let r = t.items[t.selected[0] ?? -1]?.label, i = [...r ? [] : [{ value:
|
|
6414
|
+
var Oe = "None";
|
|
6415
|
+
function ke(t, n) {
|
|
6416
|
+
let r = t.items[t.selected[0] ?? -1]?.label, i = [...r ? [] : [{ value: Oe }], ...t.items.map((e) => ({ value: e.label }))];
|
|
6236
6417
|
return {
|
|
6237
6418
|
type: e.Enum,
|
|
6238
6419
|
display: i.length <= 3 ? "segmented" : "select",
|
|
@@ -6243,15 +6424,15 @@ function xe(t, n) {
|
|
|
6243
6424
|
...n ? { hidden: n } : {}
|
|
6244
6425
|
};
|
|
6245
6426
|
}
|
|
6246
|
-
var
|
|
6247
|
-
function
|
|
6427
|
+
var A = (e) => e.replace(/\s*·\s*theo template$/i, " · from template"), j = (e, t) => e.nodes.find((e) => e.id === t);
|
|
6428
|
+
function M(e, t) {
|
|
6248
6429
|
return t.startsWith("params.") ? e.data.params?.[t.slice(7)] : e.data[t];
|
|
6249
6430
|
}
|
|
6250
|
-
function
|
|
6251
|
-
let r =
|
|
6252
|
-
return n === "model" ? (r?.data.modelChoices ?? []).map(([e, t]) => [e, t]) : (t.fieldOptions?.[n] ?? []).map(([e, t]) => [String(e),
|
|
6431
|
+
function N(e, t, n) {
|
|
6432
|
+
let r = j(e, t.nodeId);
|
|
6433
|
+
return n === "model" ? (r?.data.modelChoices ?? []).map(([e, t]) => [e, t]) : (t.fieldOptions?.[n] ?? []).map(([e, t]) => [String(e), A(t)]);
|
|
6253
6434
|
}
|
|
6254
|
-
var
|
|
6435
|
+
var P = (e, t) => t ? `${e.id}.${t}` : e.id, Ae = {
|
|
6255
6436
|
ratio: {
|
|
6256
6437
|
title: "Aspect ratio",
|
|
6257
6438
|
icon: "rectangle"
|
|
@@ -6276,48 +6457,48 @@ var j = (e, t) => t ? `${e.id}.${t}` : e.id, Se = {
|
|
|
6276
6457
|
title: "Output count",
|
|
6277
6458
|
icon: "copy"
|
|
6278
6459
|
}
|
|
6279
|
-
},
|
|
6460
|
+
}, je = {
|
|
6280
6461
|
"params.generateAudio": "Sound",
|
|
6281
6462
|
"params.draft": "Quality",
|
|
6282
6463
|
"params.outputFormat": "Output format"
|
|
6283
6464
|
};
|
|
6284
|
-
function
|
|
6465
|
+
function Me(e, t) {
|
|
6285
6466
|
if (!t) return;
|
|
6286
6467
|
let n = e.flow.inputs.find((e) => e.id === t.input);
|
|
6287
6468
|
if (!n) return;
|
|
6288
|
-
let r =
|
|
6469
|
+
let r = j(e, n.nodeId);
|
|
6289
6470
|
if (t.field) {
|
|
6290
|
-
let r =
|
|
6471
|
+
let r = N(e, n, t.field), i = t.values.map((e) => r.find(([t]) => t === String(e))?.[1]).filter((e) => !!e);
|
|
6291
6472
|
return {
|
|
6292
|
-
key:
|
|
6473
|
+
key: P(n, t.field),
|
|
6293
6474
|
not: i
|
|
6294
6475
|
};
|
|
6295
6476
|
}
|
|
6296
|
-
let i = t.values.map((e) => r?.data.items?.[Number(e)]?.label).filter((e) => !!e).map(
|
|
6477
|
+
let i = t.values.map((e) => r?.data.items?.[Number(e)]?.label).filter((e) => !!e).map(A);
|
|
6297
6478
|
return {
|
|
6298
|
-
key:
|
|
6479
|
+
key: P(n),
|
|
6299
6480
|
not: i
|
|
6300
6481
|
};
|
|
6301
6482
|
}
|
|
6302
|
-
var
|
|
6303
|
-
value:
|
|
6483
|
+
var Ne = (e) => (e.data.items ?? []).map((e) => ({
|
|
6484
|
+
value: A(e.label),
|
|
6304
6485
|
...e.image ? { image: e.image } : {},
|
|
6305
6486
|
...e.video ? { video: e.video } : {},
|
|
6306
6487
|
...e.group ? { group: e.group } : {}
|
|
6307
|
-
})),
|
|
6488
|
+
})), Pe = (e) => {
|
|
6308
6489
|
let t = e.data.items?.[e.data.selected?.[0] ?? -1];
|
|
6309
|
-
return t ?
|
|
6490
|
+
return t ? A(t.label) : void 0;
|
|
6310
6491
|
};
|
|
6311
|
-
function
|
|
6312
|
-
let t = e.flow.inputs.filter((t) =>
|
|
6492
|
+
function Fe(e) {
|
|
6493
|
+
let t = e.flow.inputs.filter((t) => j(e, t.nodeId)?.type === "text");
|
|
6313
6494
|
return t.find((e) => e.widget === "prompt" && e.label === "Prompt") ?? t.find((e) => e.widget === "prompt") ?? t[0];
|
|
6314
6495
|
}
|
|
6315
|
-
function
|
|
6316
|
-
let n = [], r = t.flow.inputs.find((e) => e.label === "Output" &&
|
|
6496
|
+
function Ie(t) {
|
|
6497
|
+
let n = [], r = t.flow.inputs.find((e) => e.label === "Output" && j(t, e.nodeId)?.type === "list"), i = Fe(t);
|
|
6317
6498
|
for (let a of t.flow.inputs) {
|
|
6318
|
-
let o =
|
|
6499
|
+
let o = j(t, a.nodeId);
|
|
6319
6500
|
if (!o) continue;
|
|
6320
|
-
let s =
|
|
6501
|
+
let s = Me(t, a.when), c = {
|
|
6321
6502
|
title: a.label,
|
|
6322
6503
|
...a.tip ? { description: a.tip } : {},
|
|
6323
6504
|
...s ? { hidden: s } : {}
|
|
@@ -6327,21 +6508,21 @@ function Ee(t) {
|
|
|
6327
6508
|
n.push({
|
|
6328
6509
|
...c,
|
|
6329
6510
|
type: e.Enum,
|
|
6330
|
-
key:
|
|
6511
|
+
key: P(a),
|
|
6331
6512
|
display: t ? "gallery" : a === r ? "tabs" : "segmented",
|
|
6332
6513
|
...a === r ? { hideTitle: !0 } : {},
|
|
6333
|
-
options:
|
|
6334
|
-
...t ? { defaultValue: "" } :
|
|
6514
|
+
options: Ne(o),
|
|
6515
|
+
...t ? { defaultValue: "" } : Pe(o) ? { defaultValue: Pe(o) } : {}
|
|
6335
6516
|
});
|
|
6336
6517
|
} else if (o.type === "image" || o.type === "video") {
|
|
6337
6518
|
let t = o.data.presets ?? [];
|
|
6338
6519
|
n.push({
|
|
6339
6520
|
...c,
|
|
6340
6521
|
type: e.Media,
|
|
6341
|
-
key:
|
|
6522
|
+
key: P(a),
|
|
6342
6523
|
title: a.slotTitle ?? a.label,
|
|
6343
6524
|
label: a.label,
|
|
6344
|
-
hint:
|
|
6525
|
+
hint: k(o.type, !!a.required),
|
|
6345
6526
|
...a.tip || a.description ? { description: a.tip ?? a.description } : {},
|
|
6346
6527
|
kind: o.type,
|
|
6347
6528
|
optional: !a.required,
|
|
@@ -6360,7 +6541,7 @@ function Ee(t) {
|
|
|
6360
6541
|
...c,
|
|
6361
6542
|
type: e.Object,
|
|
6362
6543
|
key: "customise",
|
|
6363
|
-
title:
|
|
6544
|
+
title: De(a.label, r),
|
|
6364
6545
|
icon: "sliders-horizontal",
|
|
6365
6546
|
summary: "count",
|
|
6366
6547
|
random: !!a.random,
|
|
@@ -6385,13 +6566,13 @@ function Ee(t) {
|
|
|
6385
6566
|
};
|
|
6386
6567
|
})
|
|
6387
6568
|
});
|
|
6388
|
-
for (let e of t) r.includes(e) || n.push(
|
|
6569
|
+
for (let e of t) r.includes(e) || n.push(ke(e, c.hidden));
|
|
6389
6570
|
} else if (o.type === "text") {
|
|
6390
6571
|
let t = a === i;
|
|
6391
6572
|
n.push({
|
|
6392
6573
|
...c,
|
|
6393
6574
|
type: e.String,
|
|
6394
|
-
key: t ? "prompt" :
|
|
6575
|
+
key: t ? "prompt" : P(a),
|
|
6395
6576
|
required: !!a.required,
|
|
6396
6577
|
placeholder: a.placeholder ?? o.data.placeholder,
|
|
6397
6578
|
limit: a.widget === "line" ? 200 : 2e3
|
|
@@ -6399,26 +6580,26 @@ function Ee(t) {
|
|
|
6399
6580
|
} else if (o.type === "imagegen" || o.type === "videogen") {
|
|
6400
6581
|
let r = a.fields ?? [];
|
|
6401
6582
|
if (r.includes("model")) {
|
|
6402
|
-
let r =
|
|
6583
|
+
let r = N(t, a, "model");
|
|
6403
6584
|
n.push({
|
|
6404
6585
|
...c,
|
|
6405
6586
|
type: e.Enum,
|
|
6406
|
-
key:
|
|
6587
|
+
key: P(a, "model"),
|
|
6407
6588
|
title: a.fieldLabels?.model || "Mode",
|
|
6408
6589
|
display: "tabs",
|
|
6409
6590
|
hideTitle: !0,
|
|
6410
|
-
options: r.map(
|
|
6591
|
+
options: r.map(Ee),
|
|
6411
6592
|
defaultValue: r.find(([e]) => e === o.data.model)?.[1]
|
|
6412
6593
|
});
|
|
6413
6594
|
}
|
|
6414
6595
|
let i = [], s = [];
|
|
6415
6596
|
for (let n of r.filter((e) => e !== "model")) {
|
|
6416
|
-
let r =
|
|
6597
|
+
let r = N(t, a, n);
|
|
6417
6598
|
if (!r.length) continue;
|
|
6418
|
-
let c = String(
|
|
6599
|
+
let c = String(M(o, n) ?? ""), l = r.find(([e]) => e === c)?.[1] ?? r[0][1], u = Ae[n], d = {
|
|
6419
6600
|
type: e.Enum,
|
|
6420
|
-
key:
|
|
6421
|
-
title: u?.title ??
|
|
6601
|
+
key: P(a, n),
|
|
6602
|
+
title: u?.title ?? je[n] ?? n,
|
|
6422
6603
|
display: u ? "menu" : "segmented",
|
|
6423
6604
|
...u ? { icon: u.icon } : {},
|
|
6424
6605
|
options: r.map(([, e]) => ({ value: e })),
|
|
@@ -6429,7 +6610,7 @@ function Ee(t) {
|
|
|
6429
6610
|
(i.length || s.length) && n.push({
|
|
6430
6611
|
...c,
|
|
6431
6612
|
type: e.Settings,
|
|
6432
|
-
key:
|
|
6613
|
+
key: P(a),
|
|
6433
6614
|
controls: i,
|
|
6434
6615
|
...s.length ? { advanced: s } : {}
|
|
6435
6616
|
});
|
|
@@ -6440,9 +6621,9 @@ function Ee(t) {
|
|
|
6440
6621
|
type: e.Button,
|
|
6441
6622
|
key: "run",
|
|
6442
6623
|
title: a
|
|
6443
|
-
}), u(
|
|
6624
|
+
}), u(Le(Ve(n)));
|
|
6444
6625
|
}
|
|
6445
|
-
function
|
|
6626
|
+
function Le(t) {
|
|
6446
6627
|
let n = (t) => t.type === e.Enum && t.key.endsWith(".model"), r = t.filter(n);
|
|
6447
6628
|
if (!r.length) return t;
|
|
6448
6629
|
let i = t.filter((e) => !n(e)), a = i.findIndex((t) => t.type === e.Enum && t.display === "tabs" && t.hideTitle && !t.key.endsWith(".model")), o = a < 0 ? 0 : a + 1;
|
|
@@ -6452,7 +6633,7 @@ function De(t) {
|
|
|
6452
6633
|
...i.slice(o)
|
|
6453
6634
|
];
|
|
6454
6635
|
}
|
|
6455
|
-
var
|
|
6636
|
+
var Re = {
|
|
6456
6637
|
length: {
|
|
6457
6638
|
title: "Duration",
|
|
6458
6639
|
icon: "timer"
|
|
@@ -6473,19 +6654,19 @@ var Oe = {
|
|
|
6473
6654
|
title: "Resolution",
|
|
6474
6655
|
icon: "high-definition"
|
|
6475
6656
|
}
|
|
6476
|
-
},
|
|
6657
|
+
}, ze = { assets: {
|
|
6477
6658
|
title: "Assets",
|
|
6478
6659
|
icon: "copy"
|
|
6479
|
-
} },
|
|
6480
|
-
function
|
|
6660
|
+
} }, Be = (e, t) => JSON.stringify(e ?? null) === JSON.stringify(t ?? null);
|
|
6661
|
+
function Ve(t) {
|
|
6481
6662
|
let n = t.filter((t) => t.type === e.Settings);
|
|
6482
6663
|
if (!n.length) return t;
|
|
6483
6664
|
let r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map(), a = (t) => t.type === e.Settings && t.controls.some((e) => e.icon === "copy");
|
|
6484
6665
|
for (let o of t) {
|
|
6485
6666
|
if (o.type !== e.Enum || o.display !== "segmented") continue;
|
|
6486
|
-
let t = o.title.trim().toLowerCase(), s =
|
|
6667
|
+
let t = o.title.trim().toLowerCase(), s = Re[t] ?? ze[t];
|
|
6487
6668
|
if (!s) continue;
|
|
6488
|
-
let c =
|
|
6669
|
+
let c = ze[t] ? n.find((e) => !a(e)) : n.find((e) => Be(e.hidden, o.hidden)) ?? n[n.length - 1];
|
|
6489
6670
|
c && (r.add(o), i.set(c, [...i.get(c) ?? [], {
|
|
6490
6671
|
...o,
|
|
6491
6672
|
...s,
|
|
@@ -6502,7 +6683,7 @@ function je(t) {
|
|
|
6502
6683
|
};
|
|
6503
6684
|
}) : t;
|
|
6504
6685
|
}
|
|
6505
|
-
function
|
|
6686
|
+
function He(e) {
|
|
6506
6687
|
let t = {};
|
|
6507
6688
|
for (let n of e.nodes) if (n.type === "props") for (let e of n.data.groups ?? []) {
|
|
6508
6689
|
let n = e.selected.map((t) => e.items[t]?.label).filter((e) => !!e);
|
|
@@ -6510,19 +6691,19 @@ function Me(e) {
|
|
|
6510
6691
|
}
|
|
6511
6692
|
return t;
|
|
6512
6693
|
}
|
|
6513
|
-
function
|
|
6694
|
+
function Ue(e, t) {
|
|
6514
6695
|
let n = structuredClone(e.nodes), r = (e) => n.find((t) => t.id === e), i = (e) => t.choices[e], a = [], o = (t, n) => {
|
|
6515
|
-
let r =
|
|
6696
|
+
let r = j(e, t.nodeId);
|
|
6516
6697
|
if (!r) return [];
|
|
6517
6698
|
if (n) {
|
|
6518
|
-
let a = i(
|
|
6519
|
-
return [
|
|
6699
|
+
let a = i(P(t, n));
|
|
6700
|
+
return [N(e, t, n).find(([, e]) => e === a)?.[0] ?? String(M(r, n) ?? "")];
|
|
6520
6701
|
}
|
|
6521
6702
|
if (r.type === "list") {
|
|
6522
|
-
let e = i(
|
|
6703
|
+
let e = i(P(t));
|
|
6523
6704
|
if (e === void 0) return t.widget === "gallery" ? [] : (r.data.selected ?? []).map(String);
|
|
6524
6705
|
let n = e.split("");
|
|
6525
|
-
return (r.data.items ?? []).map((e, t) => n.includes(
|
|
6706
|
+
return (r.data.items ?? []).map((e, t) => n.includes(A(e.label)) ? String(t) : "").filter(Boolean);
|
|
6526
6707
|
}
|
|
6527
6708
|
return [];
|
|
6528
6709
|
}, s = (t) => {
|
|
@@ -6530,7 +6711,7 @@ function Ne(e, t) {
|
|
|
6530
6711
|
if (!n) return !0;
|
|
6531
6712
|
let r = o(n, t.field);
|
|
6532
6713
|
return t.values.map(String).some((e) => r.includes(e));
|
|
6533
|
-
}, c =
|
|
6714
|
+
}, c = Fe(e);
|
|
6534
6715
|
for (let n of e.flow.inputs) {
|
|
6535
6716
|
let l = r(n.nodeId);
|
|
6536
6717
|
if (!l) continue;
|
|
@@ -6541,11 +6722,11 @@ function Ne(e, t) {
|
|
|
6541
6722
|
}
|
|
6542
6723
|
if (f) {
|
|
6543
6724
|
for (let t of n.fields ?? []) {
|
|
6544
|
-
let r = i(
|
|
6725
|
+
let r = i(P(n, t));
|
|
6545
6726
|
if (r === void 0) continue;
|
|
6546
|
-
let a =
|
|
6727
|
+
let a = N(e, n, t).find(([, e]) => e === r)?.[0];
|
|
6547
6728
|
if (a === void 0) continue;
|
|
6548
|
-
let o =
|
|
6729
|
+
let o = M(l, t), s = typeof o == "number" ? Number(a) : typeof o == "boolean" ? a === "true" : a;
|
|
6549
6730
|
t.startsWith("params.") ? u.params = {
|
|
6550
6731
|
...u.params ?? {},
|
|
6551
6732
|
[t.slice(7)]: s
|
|
@@ -6554,11 +6735,11 @@ function Ne(e, t) {
|
|
|
6554
6735
|
continue;
|
|
6555
6736
|
}
|
|
6556
6737
|
if (l.type === "list") u.selected = o(n).map(Number);
|
|
6557
|
-
else if (l.type === "text") u.text = (n === c ? t.promptOn || n.required ? t.prompt : "" : n.required || i(`${
|
|
6738
|
+
else if (l.type === "text") u.text = (n === c ? t.promptOn || n.required ? t.prompt : "" : n.required || i(`${P(n)}:on`) === "on" ? i(P(n)) ?? "" : "").trim();
|
|
6558
6739
|
else if (l.type === "image") {
|
|
6559
|
-
let e =
|
|
6740
|
+
let e = O(t, P(n)).map((e) => e.url);
|
|
6560
6741
|
u.multiple ? u.images = e : u.image = e[0] ?? "";
|
|
6561
|
-
} else if (l.type === "video") u.video =
|
|
6742
|
+
} else if (l.type === "video") u.video = O(t, P(n))[0]?.url ?? "";
|
|
6562
6743
|
else if (l.type === "props") for (let e of u.groups ?? []) {
|
|
6563
6744
|
let t = (i(`customise:${e.label}`) ?? "").split("");
|
|
6564
6745
|
e.selected = e.items.map((e, n) => t.includes(e.label) ? n : -1).filter((e) => e >= 0);
|
|
@@ -6588,99 +6769,99 @@ function Ne(e, t) {
|
|
|
6588
6769
|
};
|
|
6589
6770
|
}
|
|
6590
6771
|
// src/property-controls.ts
|
|
6591
|
-
function
|
|
6772
|
+
function We(t, n = !1) {
|
|
6592
6773
|
return t.type === e.Enum ? {
|
|
6593
6774
|
...t,
|
|
6594
6775
|
display: t.display ?? (n ? "menu" : t.options.length <= 3 ? "segmented" : "select")
|
|
6595
6776
|
} : t.type === e.Media ? {
|
|
6596
6777
|
...t,
|
|
6597
|
-
hint: t.hint ??
|
|
6778
|
+
hint: t.hint ?? k(t.kind === "video" ? "video" : "image", !t.optional)
|
|
6598
6779
|
} : t.type === e.Settings ? {
|
|
6599
6780
|
...t,
|
|
6600
|
-
controls: t.controls.map((e) =>
|
|
6781
|
+
controls: t.controls.map((e) => We(e, !0))
|
|
6601
6782
|
} : t;
|
|
6602
6783
|
}
|
|
6603
|
-
var
|
|
6604
|
-
function
|
|
6784
|
+
var Ge = Symbol.for("avis.propertyControls");
|
|
6785
|
+
function F(e) {
|
|
6605
6786
|
return (Array.isArray(e) ? [...e] : Object.entries(e).map(([e, t]) => ({
|
|
6606
6787
|
...t,
|
|
6607
6788
|
key: e
|
|
6608
|
-
}))).map((e) =>
|
|
6789
|
+
}))).map((e) => We(e));
|
|
6609
6790
|
}
|
|
6610
|
-
function
|
|
6611
|
-
let n = u(
|
|
6612
|
-
return r[
|
|
6791
|
+
function Ke(e, t) {
|
|
6792
|
+
let n = u(F(t)), r = e;
|
|
6793
|
+
return r[Ge] = n, r.propertyControls = n, e;
|
|
6613
6794
|
}
|
|
6614
|
-
function
|
|
6795
|
+
function qe(e) {
|
|
6615
6796
|
let t = e.defaultProps, n = Object.fromEntries(Object.entries(t ?? {}).filter(([, e]) => e != null).map(([e, t]) => [e, typeof t == "boolean" ? t ? "on" : "off" : String(t)]));
|
|
6616
6797
|
return {
|
|
6617
|
-
...l(
|
|
6798
|
+
...l(Je(e), () => ""),
|
|
6618
6799
|
...n
|
|
6619
6800
|
};
|
|
6620
6801
|
}
|
|
6621
|
-
function
|
|
6802
|
+
function Je(e) {
|
|
6622
6803
|
let t = e;
|
|
6623
|
-
return t[
|
|
6804
|
+
return t[Ge] ?? t.propertyControls ?? [];
|
|
6624
6805
|
}
|
|
6625
|
-
var
|
|
6626
|
-
function
|
|
6627
|
-
return
|
|
6806
|
+
var I = `${"https://avis-studio-app.stream".replace(/\/+$/, "")}/`, Ye = /^\/(v7|apps|cinema|director-studio|explore|videos)\/[^?#]+$/, Xe = /^\/mini-apps\/[^?#]+$/;
|
|
6807
|
+
function Ze(e) {
|
|
6808
|
+
return I ? Xe.test(e) ? I + e.slice(1) : Ye.test(e) ? `${I}site${e}` : null : null;
|
|
6628
6809
|
}
|
|
6629
6810
|
// ../../src/features/product-ads/model/api.ts
|
|
6630
|
-
function
|
|
6811
|
+
function Qe(e) {
|
|
6631
6812
|
let t = /* @__PURE__ */ new Map();
|
|
6632
6813
|
async function n(n, r, i) {
|
|
6633
|
-
let a =
|
|
6814
|
+
let a = nt(i), o = await e({
|
|
6634
6815
|
method: n,
|
|
6635
6816
|
path: r,
|
|
6636
|
-
body:
|
|
6817
|
+
body: it(i, t.get(a))
|
|
6637
6818
|
});
|
|
6638
6819
|
if (o.status === 400 && a) {
|
|
6639
|
-
let s =
|
|
6820
|
+
let s = rt(await at(o.clone()));
|
|
6640
6821
|
s.length && (t.set(a, /* @__PURE__ */ new Set([...t.get(a) ?? [], ...s])), o = await e({
|
|
6641
6822
|
method: n,
|
|
6642
6823
|
path: r,
|
|
6643
|
-
body:
|
|
6824
|
+
body: it(i, t.get(a))
|
|
6644
6825
|
}));
|
|
6645
6826
|
}
|
|
6646
|
-
if (!o.ok) throw Error(await
|
|
6827
|
+
if (!o.ok) throw Error(await at(o));
|
|
6647
6828
|
return o;
|
|
6648
6829
|
}
|
|
6649
|
-
let r = async (e) =>
|
|
6830
|
+
let r = async (e) => $e(await e.json().catch(() => ({})));
|
|
6650
6831
|
return {
|
|
6651
6832
|
async text(e) {
|
|
6652
6833
|
let t = await Promise.all(e.messages.map(async (e) => ({
|
|
6653
6834
|
...e,
|
|
6654
|
-
content: typeof e.content == "string" ? e.content : (await
|
|
6835
|
+
content: typeof e.content == "string" ? e.content : (await R({ content: e.content })).content
|
|
6655
6836
|
})));
|
|
6656
|
-
return
|
|
6837
|
+
return tt(await (await n("POST", "/api/v1/text/completions", {
|
|
6657
6838
|
...e,
|
|
6658
6839
|
messages: t
|
|
6659
6840
|
})).text());
|
|
6660
6841
|
},
|
|
6661
6842
|
async estimate(e, t) {
|
|
6662
|
-
let i = await r(await n("POST", `/api/v1/${e}/estimate`, await
|
|
6843
|
+
let i = await r(await n("POST", `/api/v1/${e}/estimate`, await R(t)));
|
|
6663
6844
|
if (i.estimatedUserCost === void 0 || i.estimatedUserCost === null) throw Error("AVIS: missing estimate");
|
|
6664
6845
|
let a = Number(i.estimatedUserCost);
|
|
6665
6846
|
if (!Number.isFinite(a) || a < 0) throw Error("AVIS: invalid estimate");
|
|
6666
6847
|
return a;
|
|
6667
6848
|
},
|
|
6668
6849
|
async start(e, t) {
|
|
6669
|
-
let i = await r(await n("POST", e === "image" ? "/api/v1/image/generations/async" : "/api/v1/video/generations", await
|
|
6850
|
+
let i = await r(await n("POST", e === "image" ? "/api/v1/image/generations/async" : "/api/v1/video/generations", await R(t))), a = e === "image" ? i.generationId ?? i.taskId ?? i.id : i.taskId ?? i.id;
|
|
6670
6851
|
if (typeof a != "string" || !a) throw Error("AVIS: no job id");
|
|
6671
6852
|
return a;
|
|
6672
6853
|
},
|
|
6673
6854
|
async status(e, t) {
|
|
6674
6855
|
let i = e === "image" ? `/api/v1/image/generations/async/${encodeURIComponent(t)}` : `/api/v1/video/tasks/${encodeURIComponent(t)}`;
|
|
6675
|
-
return
|
|
6856
|
+
return et(e, await r(await n("GET", i)));
|
|
6676
6857
|
}
|
|
6677
6858
|
};
|
|
6678
6859
|
}
|
|
6679
|
-
function
|
|
6860
|
+
function $e(e) {
|
|
6680
6861
|
let t = e.data;
|
|
6681
6862
|
return t && typeof t == "object" && !Array.isArray(t) ? t : e;
|
|
6682
6863
|
}
|
|
6683
|
-
function
|
|
6864
|
+
function et(e, t) {
|
|
6684
6865
|
let n = String(t.status ?? "processing"), r = [
|
|
6685
6866
|
"succeeded",
|
|
6686
6867
|
"failed",
|
|
@@ -6692,7 +6873,7 @@ function We(e, t) {
|
|
|
6692
6873
|
error: typeof t.error == "string" ? t.error : void 0
|
|
6693
6874
|
};
|
|
6694
6875
|
}
|
|
6695
|
-
function
|
|
6876
|
+
function tt(e) {
|
|
6696
6877
|
let t = [];
|
|
6697
6878
|
for (let n of e.split("\n")) {
|
|
6698
6879
|
let e = n.trim();
|
|
@@ -6705,26 +6886,26 @@ function Ge(e) {
|
|
|
6705
6886
|
} catch {
|
|
6706
6887
|
continue;
|
|
6707
6888
|
}
|
|
6708
|
-
if (i.error) throw Error(
|
|
6889
|
+
if (i.error) throw Error(L(i.error));
|
|
6709
6890
|
typeof i.delta == "string" && t.push(i.delta);
|
|
6710
6891
|
}
|
|
6711
6892
|
return t.join("").trim();
|
|
6712
6893
|
}
|
|
6713
|
-
function
|
|
6894
|
+
function nt(e) {
|
|
6714
6895
|
return e && typeof e == "object" && "model" in e ? String(e.model ?? "") : "";
|
|
6715
6896
|
}
|
|
6716
|
-
function
|
|
6897
|
+
function rt(e) {
|
|
6717
6898
|
let t = /does not support:\s*([^.]+)/i.exec(e);
|
|
6718
6899
|
return t ? t[1].split(",").map((e) => e.trim()).filter(Boolean) : [];
|
|
6719
6900
|
}
|
|
6720
|
-
function
|
|
6901
|
+
function it(e, t) {
|
|
6721
6902
|
return !t?.size || !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).filter(([e]) => !t.has(e)));
|
|
6722
6903
|
}
|
|
6723
|
-
async function
|
|
6904
|
+
async function at(e) {
|
|
6724
6905
|
let t = await e.json().catch(() => null), n = t?.errors;
|
|
6725
|
-
return Array.isArray(n) && n.length ?
|
|
6906
|
+
return Array.isArray(n) && n.length ? L(n[0]) : t?.error ? L(t.error) : typeof t?.message == "string" ? t.message : `AVIS (${e.status})`;
|
|
6726
6907
|
}
|
|
6727
|
-
function
|
|
6908
|
+
function L(e) {
|
|
6728
6909
|
if (typeof e == "string") return e;
|
|
6729
6910
|
if (e && typeof e == "object") {
|
|
6730
6911
|
let { message: t, code: n } = e;
|
|
@@ -6733,20 +6914,20 @@ function I(e) {
|
|
|
6733
6914
|
}
|
|
6734
6915
|
return "AVIS error";
|
|
6735
6916
|
}
|
|
6736
|
-
async function
|
|
6917
|
+
async function R(e) {
|
|
6737
6918
|
let t = await Promise.all(e.content.map(async (e) => {
|
|
6738
6919
|
if (e.type !== "imageUrl" && e.type !== "videoUrl") return e;
|
|
6739
6920
|
if (/^https?:/.test(e.url)) {
|
|
6740
|
-
if (e.type !== "imageUrl" || !await
|
|
6921
|
+
if (e.type !== "imageUrl" || !await st(e.url)) return e;
|
|
6741
6922
|
let { url: t, ...n } = e, r = await fetch(t);
|
|
6742
6923
|
if (!r.ok) throw Error("Cannot read selected media");
|
|
6743
6924
|
return {
|
|
6744
6925
|
...n,
|
|
6745
6926
|
type: "imageBase64",
|
|
6746
|
-
data: await
|
|
6927
|
+
data: await ct(await r.blob())
|
|
6747
6928
|
};
|
|
6748
6929
|
}
|
|
6749
|
-
let t =
|
|
6930
|
+
let t = Ze(e.url);
|
|
6750
6931
|
if (t) return {
|
|
6751
6932
|
...e,
|
|
6752
6933
|
url: t
|
|
@@ -6757,15 +6938,15 @@ async function L(e) {
|
|
|
6757
6938
|
return e.type === "videoUrl" ? {
|
|
6758
6939
|
...r,
|
|
6759
6940
|
type: "videoBase64",
|
|
6760
|
-
data: await
|
|
6941
|
+
data: await lt(a)
|
|
6761
6942
|
} : a.type === "image/svg+xml" ? {
|
|
6762
6943
|
...r,
|
|
6763
6944
|
type: "imageBase64",
|
|
6764
|
-
data: await
|
|
6945
|
+
data: await ct(a)
|
|
6765
6946
|
} : {
|
|
6766
6947
|
...r,
|
|
6767
6948
|
type: "imageBase64",
|
|
6768
|
-
data: await
|
|
6949
|
+
data: await ut(a)
|
|
6769
6950
|
};
|
|
6770
6951
|
}));
|
|
6771
6952
|
return {
|
|
@@ -6773,13 +6954,13 @@ async function L(e) {
|
|
|
6773
6954
|
content: t
|
|
6774
6955
|
};
|
|
6775
6956
|
}
|
|
6776
|
-
var
|
|
6777
|
-
function
|
|
6957
|
+
var ot = /* @__PURE__ */ new Map();
|
|
6958
|
+
function st(e) {
|
|
6778
6959
|
if (/\.svgz?(?:$|[?#])/i.test(e)) return Promise.resolve(!0);
|
|
6779
|
-
let t =
|
|
6780
|
-
return t || (t = fetch(e, { method: "HEAD" }).then((e) => (e.headers.get("content-type") ?? "").includes("svg")).catch(() => !1),
|
|
6960
|
+
let t = ot.get(e);
|
|
6961
|
+
return t || (t = fetch(e, { method: "HEAD" }).then((e) => (e.headers.get("content-type") ?? "").includes("svg")).catch(() => !1), ot.set(e, t)), t;
|
|
6781
6962
|
}
|
|
6782
|
-
async function
|
|
6963
|
+
async function ct(e, t = 2048) {
|
|
6783
6964
|
let n = URL.createObjectURL(e);
|
|
6784
6965
|
try {
|
|
6785
6966
|
let e = new Image();
|
|
@@ -6790,17 +6971,17 @@ async function Qe(e, t = 2048) {
|
|
|
6790
6971
|
URL.revokeObjectURL(n);
|
|
6791
6972
|
}
|
|
6792
6973
|
}
|
|
6793
|
-
function
|
|
6974
|
+
function lt(e) {
|
|
6794
6975
|
return new Promise((t, n) => {
|
|
6795
6976
|
let r = new FileReader();
|
|
6796
6977
|
r.onload = () => t(String(r.result)), r.onerror = () => n(/* @__PURE__ */ Error("Cannot read selected video")), r.readAsDataURL(e);
|
|
6797
6978
|
});
|
|
6798
6979
|
}
|
|
6799
|
-
async function
|
|
6980
|
+
async function ut(e, t = 2048) {
|
|
6800
6981
|
let n = await createImageBitmap(e, { imageOrientation: "from-image" }), r = Math.min(1, t / Math.max(n.width, n.height)), i = document.createElement("canvas");
|
|
6801
6982
|
return i.width = Math.round(n.width * r), i.height = Math.round(n.height * r), i.getContext("2d")?.drawImage(n, 0, 0, i.width, i.height), n.close(), e.type === "image/png" ? i.toDataURL("image/png") : i.toDataURL("image/jpeg", .92);
|
|
6802
6983
|
}
|
|
6803
|
-
var
|
|
6984
|
+
var dt = {
|
|
6804
6985
|
flow: {
|
|
6805
6986
|
name: "Character builder · Commercial Talent",
|
|
6806
6987
|
description: "Create virtual talent for ads and campaigns.",
|
|
@@ -8056,7 +8237,7 @@ var tt = {
|
|
|
8056
8237
|
}
|
|
8057
8238
|
}
|
|
8058
8239
|
]
|
|
8059
|
-
},
|
|
8240
|
+
}, ft = {
|
|
8060
8241
|
flow: {
|
|
8061
8242
|
name: "Character builder · AI Influencer",
|
|
8062
8243
|
description: "Build a virtual creator for social content.",
|
|
@@ -9569,7 +9750,7 @@ var tt = {
|
|
|
9569
9750
|
}
|
|
9570
9751
|
}
|
|
9571
9752
|
]
|
|
9572
|
-
},
|
|
9753
|
+
}, pt = {
|
|
9573
9754
|
flow: {
|
|
9574
9755
|
name: "Copy motion",
|
|
9575
9756
|
description: "Apply motion from a reference video.",
|
|
@@ -9737,7 +9918,7 @@ var tt = {
|
|
|
9737
9918
|
}
|
|
9738
9919
|
}
|
|
9739
9920
|
]
|
|
9740
|
-
},
|
|
9921
|
+
}, mt = {
|
|
9741
9922
|
flow: {
|
|
9742
9923
|
name: "Object swap",
|
|
9743
9924
|
description: "Replace an object in your footage.",
|
|
@@ -9983,7 +10164,7 @@ var tt = {
|
|
|
9983
10164
|
}
|
|
9984
10165
|
}
|
|
9985
10166
|
]
|
|
9986
|
-
},
|
|
10167
|
+
}, ht = {
|
|
9987
10168
|
flow: {
|
|
9988
10169
|
name: "Character swap",
|
|
9989
10170
|
description: "Put a new character into your footage, same performance.",
|
|
@@ -10210,7 +10391,7 @@ var tt = {
|
|
|
10210
10391
|
}
|
|
10211
10392
|
}
|
|
10212
10393
|
]
|
|
10213
|
-
},
|
|
10394
|
+
}, gt = {
|
|
10214
10395
|
schema: "avis-flow/1",
|
|
10215
10396
|
nodes: [
|
|
10216
10397
|
{
|
|
@@ -10742,7 +10923,7 @@ var tt = {
|
|
|
10742
10923
|
category: "ads",
|
|
10743
10924
|
source: "studioavis.vercel.app · Apps (2026-11-18) · tối ưu 2026-11-18 (Magnific community + giá AVIS)"
|
|
10744
10925
|
}
|
|
10745
|
-
},
|
|
10926
|
+
}, _t = {
|
|
10746
10927
|
schema: "avis-flow/1",
|
|
10747
10928
|
nodes: [
|
|
10748
10929
|
{
|
|
@@ -11488,7 +11669,7 @@ var tt = {
|
|
|
11488
11669
|
category: "ads",
|
|
11489
11670
|
source: "studioavis.vercel.app · Apps (2026-11-18) · tối ưu 2026-11-18 (Magnific community + giá AVIS)"
|
|
11490
11671
|
}
|
|
11491
|
-
},
|
|
11672
|
+
}, vt = {
|
|
11492
11673
|
schema: "avis-flow/1",
|
|
11493
11674
|
nodes: [
|
|
11494
11675
|
{
|
|
@@ -11934,7 +12115,7 @@ var tt = {
|
|
|
11934
12115
|
}],
|
|
11935
12116
|
source: "studioavis.vercel.app · Apps (2026-11-18) · tối ưu 2026-11-18 (Magnific community + giá AVIS)"
|
|
11936
12117
|
}
|
|
11937
|
-
},
|
|
12118
|
+
}, yt = {
|
|
11938
12119
|
schema: "avis-flow/1",
|
|
11939
12120
|
nodes: [
|
|
11940
12121
|
{
|
|
@@ -12432,7 +12613,7 @@ var tt = {
|
|
|
12432
12613
|
category: "ads",
|
|
12433
12614
|
source: "studioavis.vercel.app · Apps (2026-11-18) · tối ưu 2026-11-18 (Magnific community + giá AVIS)"
|
|
12434
12615
|
}
|
|
12435
|
-
},
|
|
12616
|
+
}, bt = {
|
|
12436
12617
|
schema: "avis-flow/1",
|
|
12437
12618
|
nodes: [
|
|
12438
12619
|
{
|
|
@@ -13840,10 +14021,10 @@ var tt = {
|
|
|
13840
14021
|
category: "ads",
|
|
13841
14022
|
source: "studioavis.vercel.app · Apps (2026-11-18) · tối ưu 2026-11-18 (Magnific community + giá AVIS)"
|
|
13842
14023
|
}
|
|
13843
|
-
},
|
|
14024
|
+
}, xt = "Text-accurate (GPT Image 2.5) writes the text on the assets more accurately; Standard (Seedream 5.5) is cheaper and faster.", St = "Optional. Describe the character in words; AI adds it to the prompt and keeps the sheet / portrait format.", Ct = {
|
|
13844
14025
|
"Sheet 16:9": "Sheet",
|
|
13845
14026
|
"Portrait 3:4": "Portrait"
|
|
13846
|
-
},
|
|
14027
|
+
}, wt = "Optional · a topic or a line, e.g. 3 beautiful cafés in Saigon · \"Today I'm trying…\"", Tt = {
|
|
13847
14028
|
"product-ads": { inputs: { in5: { description: "Optional. Brand name, tagline, target customers: AI uses them for the text on the assets and their tone." } } },
|
|
13848
14029
|
"reels-remake": {
|
|
13849
14030
|
inputs: {
|
|
@@ -13853,9 +14034,9 @@ var tt = {
|
|
|
13853
14034
|
},
|
|
13854
14035
|
in1: { description: "Custom only. A 4–30 s reel; the result is as long as it, in the same frame." },
|
|
13855
14036
|
in2: { description: "The person or product in the reel. Without a photo, AI makes a creator that fits the genre." },
|
|
13856
|
-
in5: { placeholder:
|
|
14037
|
+
in5: { placeholder: wt }
|
|
13857
14038
|
},
|
|
13858
|
-
placeholders: { n5:
|
|
14039
|
+
placeholders: { n5: wt }
|
|
13859
14040
|
},
|
|
13860
14041
|
"ads-remake": {
|
|
13861
14042
|
description: "Rebuild a reference ad for your brand: AI reads the reference video and your photo, then writes the prompt.",
|
|
@@ -13876,27 +14057,27 @@ var tt = {
|
|
|
13876
14057
|
description: "Pick a template in the Templates tab, then press Reuse. A picture template makes 1 picture; a video template, 1 video.",
|
|
13877
14058
|
tip: "Each template is a recipe of layout, light and type. AI reads your product photo and rewrites the recipe for your product."
|
|
13878
14059
|
},
|
|
13879
|
-
in8: { tip:
|
|
14060
|
+
in8: { tip: xt },
|
|
13880
14061
|
in5: { description: "Optional. Brand name, tagline or a line you want on it: AI uses it for the template's headline (in the language you type)." }
|
|
13881
14062
|
} },
|
|
13882
14063
|
"commercial-talent": {
|
|
13883
14064
|
inputs: {
|
|
13884
|
-
in5: { description:
|
|
14065
|
+
in5: { description: St },
|
|
13885
14066
|
in2: { defaultOn: !0 }
|
|
13886
14067
|
},
|
|
13887
14068
|
labels: {
|
|
13888
|
-
...
|
|
14069
|
+
...Ct,
|
|
13889
14070
|
"Sheet 16:9": "Character sheet"
|
|
13890
14071
|
}
|
|
13891
14072
|
},
|
|
13892
14073
|
"ai-influencer": {
|
|
13893
|
-
inputs: { in2: { description:
|
|
13894
|
-
labels:
|
|
14074
|
+
inputs: { in2: { description: St } },
|
|
14075
|
+
labels: Ct
|
|
13895
14076
|
},
|
|
13896
14077
|
"object-swap": { inputs: { in3: { description: "Optional. Left empty, AI finds what to replace from the object photo." } } }
|
|
13897
14078
|
};
|
|
13898
|
-
function
|
|
13899
|
-
let n =
|
|
14079
|
+
function Et(e, t) {
|
|
14080
|
+
let n = Tt[e];
|
|
13900
14081
|
if (!n) return t;
|
|
13901
14082
|
let r = (e) => n.labels?.[e] ?? e;
|
|
13902
14083
|
return {
|
|
@@ -13930,28 +14111,28 @@ function gt(e, t) {
|
|
|
13930
14111
|
};
|
|
13931
14112
|
}
|
|
13932
14113
|
// ../../src/features/marketing-apps/catalog.ts
|
|
13933
|
-
var
|
|
13934
|
-
"commercial-talent":
|
|
13935
|
-
"ai-influencer":
|
|
13936
|
-
"motion-transfer":
|
|
13937
|
-
"object-swap":
|
|
13938
|
-
"character-swap":
|
|
14114
|
+
var Dt = (e) => Object.fromEntries(Object.entries(e).map(([e, t]) => [e, Et(e, t)])), Ot = Dt({
|
|
14115
|
+
"commercial-talent": dt,
|
|
14116
|
+
"ai-influencer": ft,
|
|
14117
|
+
"motion-transfer": pt,
|
|
14118
|
+
"object-swap": mt,
|
|
14119
|
+
"character-swap": ht
|
|
13939
14120
|
});
|
|
13940
|
-
function
|
|
13941
|
-
return
|
|
14121
|
+
function kt(e) {
|
|
14122
|
+
return Ot[e];
|
|
13942
14123
|
}
|
|
13943
|
-
var z =
|
|
13944
|
-
"product-ads":
|
|
13945
|
-
"reels-remake":
|
|
13946
|
-
"ads-remake":
|
|
13947
|
-
"ugc-ads":
|
|
13948
|
-
"ad-templates":
|
|
14124
|
+
var z = Dt({
|
|
14125
|
+
"product-ads": gt,
|
|
14126
|
+
"reels-remake": _t,
|
|
14127
|
+
"ads-remake": vt,
|
|
14128
|
+
"ugc-ads": yt,
|
|
14129
|
+
"ad-templates": bt
|
|
13949
14130
|
});
|
|
13950
|
-
function
|
|
14131
|
+
function At(e) {
|
|
13951
14132
|
return Object.hasOwn(z, e) ? z[e] : void 0;
|
|
13952
14133
|
}
|
|
13953
14134
|
// ../../src/features/marketing-apps/catalog/input-presets.ts
|
|
13954
|
-
var
|
|
14135
|
+
var jt = { "character-swap": { in2: {
|
|
13955
14136
|
title: "Character presets",
|
|
13956
14137
|
icon: "user",
|
|
13957
14138
|
choices: [
|
|
@@ -13980,7 +14161,7 @@ var bt = { "character-swap": { in2: {
|
|
|
13980
14161
|
image: "/apps/miniapps/recast/char/stylised.jpg"
|
|
13981
14162
|
}
|
|
13982
14163
|
]
|
|
13983
|
-
} } },
|
|
14164
|
+
} } }, Mt = ["Image", "Video"], Nt = {
|
|
13984
14165
|
product: {
|
|
13985
14166
|
id: "product",
|
|
13986
14167
|
title: "Upload a product photo",
|
|
@@ -13991,7 +14172,7 @@ var bt = { "character-swap": { in2: {
|
|
|
13991
14172
|
title: "Upload your logo",
|
|
13992
14173
|
hint: "Optional · AVIS designs one if you skip this."
|
|
13993
14174
|
}
|
|
13994
|
-
},
|
|
14175
|
+
}, Pt = {
|
|
13995
14176
|
kit: {
|
|
13996
14177
|
label: "Kit",
|
|
13997
14178
|
options: [
|
|
@@ -14054,11 +14235,11 @@ var bt = { "character-swap": { in2: {
|
|
|
14054
14235
|
value: "Vietnamese"
|
|
14055
14236
|
}]
|
|
14056
14237
|
}
|
|
14057
|
-
},
|
|
14238
|
+
}, Ft = {
|
|
14058
14239
|
label: "Brand info",
|
|
14059
14240
|
placeholder: "Brand name, tagline and audience, e.g. AURICE · \"Glow, slowly.\" · women 22–35",
|
|
14060
14241
|
limit: 2e3
|
|
14061
|
-
},
|
|
14242
|
+
}, It = {
|
|
14062
14243
|
label: "Mode",
|
|
14063
14244
|
options: [{
|
|
14064
14245
|
label: "Standard",
|
|
@@ -14067,7 +14248,7 @@ var bt = { "character-swap": { in2: {
|
|
|
14067
14248
|
label: "Text-accurate",
|
|
14068
14249
|
model: "gpt-image-2-5-flare"
|
|
14069
14250
|
}]
|
|
14070
|
-
},
|
|
14251
|
+
}, Lt = ["2K", "1K"], Rt = "10 s video ad", zt = {
|
|
14071
14252
|
suffix: "Keep the exact product from the reference photo, label readable.",
|
|
14072
14253
|
ratio: "1:1"
|
|
14073
14254
|
}, B = {
|
|
@@ -14080,15 +14261,15 @@ var bt = { "character-swap": { in2: {
|
|
|
14080
14261
|
prompt: (e, t) => `A 10 second product video ad for the product in the reference photo, ${e} brand tone, smooth hero camera move, clean premium light. ${t}`.trim()
|
|
14081
14262
|
};
|
|
14082
14263
|
// ../../src/features/product-ads/model/requests.ts
|
|
14083
|
-
function
|
|
14084
|
-
let { options: n } =
|
|
14264
|
+
function Bt(e, t) {
|
|
14265
|
+
let { options: n } = Pt[e];
|
|
14085
14266
|
return (n.find((e) => e.label === t) ?? n[0]).value;
|
|
14086
14267
|
}
|
|
14087
|
-
function
|
|
14088
|
-
return Number.parseInt(
|
|
14268
|
+
function Vt(e) {
|
|
14269
|
+
return Number.parseInt(Bt("assets", e.assets), 10) || 4;
|
|
14089
14270
|
}
|
|
14090
|
-
function
|
|
14091
|
-
let { options: t } =
|
|
14271
|
+
function Ht(e) {
|
|
14272
|
+
let { options: t } = It;
|
|
14092
14273
|
return (t.find((t) => t.label === e) ?? t[0]).model;
|
|
14093
14274
|
}
|
|
14094
14275
|
function V(e, t) {
|
|
@@ -14104,26 +14285,26 @@ function V(e, t) {
|
|
|
14104
14285
|
role: t
|
|
14105
14286
|
} : n;
|
|
14106
14287
|
}
|
|
14107
|
-
function
|
|
14288
|
+
function Ut(e, t) {
|
|
14108
14289
|
let n = [e.product, e.logo].filter((e) => !!e);
|
|
14109
14290
|
return {
|
|
14110
|
-
model:
|
|
14291
|
+
model: Ht(e.mode),
|
|
14111
14292
|
content: [{
|
|
14112
14293
|
type: "text",
|
|
14113
|
-
text: `${t}\n${
|
|
14294
|
+
text: `${t}\n${zt.suffix}`
|
|
14114
14295
|
}, ...n.map((e) => V(e))],
|
|
14115
14296
|
numberOfImages: 1,
|
|
14116
14297
|
watermark: !1,
|
|
14117
14298
|
resolution: e.resolution,
|
|
14118
|
-
ratio:
|
|
14299
|
+
ratio: zt.ratio
|
|
14119
14300
|
};
|
|
14120
14301
|
}
|
|
14121
|
-
function
|
|
14302
|
+
function Wt(e) {
|
|
14122
14303
|
return {
|
|
14123
14304
|
model: B.model,
|
|
14124
14305
|
content: [{
|
|
14125
14306
|
type: "text",
|
|
14126
|
-
text: B.prompt(
|
|
14307
|
+
text: B.prompt(Bt("tone", e.tone), e.brandInfo.trim())
|
|
14127
14308
|
}, V(e.product, "referenceImage")],
|
|
14128
14309
|
duration: B.duration,
|
|
14129
14310
|
resolution: B.resolution,
|
|
@@ -14132,10 +14313,10 @@ function Nt(e) {
|
|
|
14132
14313
|
generateAudio: B.generateAudio
|
|
14133
14314
|
};
|
|
14134
14315
|
}
|
|
14135
|
-
function
|
|
14316
|
+
function Gt(e) {
|
|
14136
14317
|
return e.output === "Image" ? {
|
|
14137
14318
|
kind: "image",
|
|
14138
|
-
count:
|
|
14319
|
+
count: Vt(e)
|
|
14139
14320
|
} : e.video ? { kind: "video" } : null;
|
|
14140
14321
|
}
|
|
14141
14322
|
// ../../src/features/product-ads/model/run.ts
|
|
@@ -14144,18 +14325,18 @@ var H = class extends Error {
|
|
|
14144
14325
|
constructor(e) {
|
|
14145
14326
|
super(e.reason === "api" ? e.message : e.reason), this.failure = e;
|
|
14146
14327
|
}
|
|
14147
|
-
},
|
|
14148
|
-
function
|
|
14328
|
+
}, Kt = "Auto";
|
|
14329
|
+
function qt(e) {
|
|
14149
14330
|
return e === "Auto" ? "adaptive" : e;
|
|
14150
14331
|
}
|
|
14151
|
-
function
|
|
14332
|
+
function Jt(e, t) {
|
|
14152
14333
|
let n = /* @__PURE__ */ new Set();
|
|
14153
14334
|
return [e.replace(/\{\{\s*([\w-]+)\s*\}\}/g, (e, r) => (n.add(r), t.find((e) => e.id === r)?.values[0] ?? "")).trim(), ...t.filter((e) => !n.has(e.id)).map((e) => e.values[0])].filter(Boolean).join("\n");
|
|
14154
14335
|
}
|
|
14155
|
-
var
|
|
14156
|
-
async function
|
|
14336
|
+
var Yt = /^(?:data|blob):/;
|
|
14337
|
+
async function Xt(e, t, n, r, i = {}) {
|
|
14157
14338
|
let a = new Map(Object.entries(i.resume?.values ?? {})), o = i.resume?.pending ?? void 0, s = (e) => i.onCheckpoint?.({
|
|
14158
|
-
values: Object.fromEntries([...a].filter(([, e]) => e.every((e) => !
|
|
14339
|
+
values: Object.fromEntries([...a].filter(([, e]) => e.every((e) => !Yt.test(e)))),
|
|
14159
14340
|
pending: e
|
|
14160
14341
|
}), c = /* @__PURE__ */ new Set(), l = 0, u = i.wait ?? ((e) => new Promise((t) => setTimeout(t, e))), d = (e) => `${e}#frame`, f = (t, n) => e.edges.filter((e) => e.to.node === t.id && e.to.port === n).map((t) => ({
|
|
14161
14342
|
id: t.from.node,
|
|
@@ -14171,7 +14352,7 @@ async function zt(e, t, n, r, i = {}) {
|
|
|
14171
14352
|
}
|
|
14172
14353
|
}, m = (t) => e.flow.inputs.find((e) => e.nodeId === t.id), h = (n) => n.every((n) => {
|
|
14173
14354
|
let r = e.flow.inputs.find((e) => e.id === n);
|
|
14174
|
-
return r &&
|
|
14355
|
+
return r && O(t, r.mediaId ?? r.id).length > 0;
|
|
14175
14356
|
}), g = e.nodes.find((t) => t.id === e.flow.outputs[0].nodeId), _ = Math.max(1, Math.min(4, Number(t.choices.count) || 1)), v = 0;
|
|
14176
14357
|
async function y(e, t, r) {
|
|
14177
14358
|
let a = 0, c;
|
|
@@ -14220,7 +14401,7 @@ async function zt(e, t, n, r, i = {}) {
|
|
|
14220
14401
|
}
|
|
14221
14402
|
}
|
|
14222
14403
|
let u = l.data, x = m(l), S = [];
|
|
14223
|
-
if (l.type === "image" || l.type === "video") S = x ?
|
|
14404
|
+
if (l.type === "image" || l.type === "video") S = x ? O(t, x.mediaId ?? x.id).map((e) => e.url) : [];
|
|
14224
14405
|
else if (l.type === "text") S = [x && !h(x.lockWhen?.all ?? ["missing"]) ? t.promptOn ? t.prompt.trim() : "" : u.text ?? ""];
|
|
14225
14406
|
else if (l.type === "list") S = [(u.items?.find((e) => e.label === t.choices.output) ?? u.items?.[u.selected?.[0] ?? 0])?.value ?? ""];
|
|
14226
14407
|
else if (l.type === "props") S = [(u.groups ?? []).flatMap((e) => {
|
|
@@ -14265,7 +14446,7 @@ async function zt(e, t, n, r, i = {}) {
|
|
|
14265
14446
|
if (!a.trim()) throw Error("AVIS: empty director prompt");
|
|
14266
14447
|
S = [a];
|
|
14267
14448
|
} else {
|
|
14268
|
-
let n =
|
|
14449
|
+
let n = Jt(u.prompt ?? "", f(l, "prompt")), a = l.id === g.id ? _ : 1, o = u.modelChoices?.find(([, e]) => e === t.choices.mode)?.[0] ?? u.model, d = e.nodes.find((e) => e.type === "list")?.data.items?.find((e) => e.label === t.choices.output), m = p(["params.resolution", "resolution"], t.choices.resolution), h = l.id === g.id ? m === "1080p" && l.type === "imagegen" ? "1K" : m : void 0;
|
|
14269
14450
|
if (l.type === "imagegen") {
|
|
14270
14451
|
let e = {
|
|
14271
14452
|
model: o,
|
|
@@ -14307,7 +14488,7 @@ async function zt(e, t, n, r, i = {}) {
|
|
|
14307
14488
|
],
|
|
14308
14489
|
duration: i,
|
|
14309
14490
|
resolution: d,
|
|
14310
|
-
ratio: e ? "adaptive" :
|
|
14491
|
+
ratio: e ? "adaptive" : qt(t.choices.ratio) ?? u.ratio ?? "adaptive",
|
|
14311
14492
|
outputFormat: "mp4",
|
|
14312
14493
|
generateAudio: !0,
|
|
14313
14494
|
...u.params,
|
|
@@ -14324,9 +14505,9 @@ async function zt(e, t, n, r, i = {}) {
|
|
|
14324
14505
|
}
|
|
14325
14506
|
for (let n of e.flow.inputs) {
|
|
14326
14507
|
let i = e.nodes.find((e) => e.id === n.nodeId);
|
|
14327
|
-
if (n.required && (i.type === "image" || i.type === "video") && !
|
|
14508
|
+
if (n.required && (i.type === "image" || i.type === "video") && !O(t, n.mediaId ?? n.id).length) throw new H({ reason: "nothing" });
|
|
14328
14509
|
if (i.type === "video") {
|
|
14329
|
-
let e =
|
|
14510
|
+
let e = O(t, n.mediaId ?? n.id)[0];
|
|
14330
14511
|
if (e) {
|
|
14331
14512
|
let t = e.duration ?? await r.duration(e.url);
|
|
14332
14513
|
if (!Number.isFinite(t) || t < 4 || t > 30) throw new H({
|
|
@@ -14350,7 +14531,7 @@ async function zt(e, t, n, r, i = {}) {
|
|
|
14350
14531
|
}
|
|
14351
14532
|
}
|
|
14352
14533
|
// ../../src/features/marketing-apps/flow-controls.ts
|
|
14353
|
-
var
|
|
14534
|
+
var Zt = {
|
|
14354
14535
|
ratio: {
|
|
14355
14536
|
title: "Aspect ratio",
|
|
14356
14537
|
icon: "rectangle"
|
|
@@ -14368,11 +14549,11 @@ var Bt = {
|
|
|
14368
14549
|
icon: "gauge"
|
|
14369
14550
|
}
|
|
14370
14551
|
};
|
|
14371
|
-
function
|
|
14552
|
+
function Qt(e, t) {
|
|
14372
14553
|
let n = t?.all.map((t) => e.flow.inputs.find((e) => e.id === t)?.mediaId ?? t);
|
|
14373
14554
|
if (n?.length) return n.length === 1 ? { filled: n[0] } : { all: n.map((e) => ({ filled: e })) };
|
|
14374
14555
|
}
|
|
14375
|
-
function
|
|
14556
|
+
function $t(t, { presets: n = {} } = {}) {
|
|
14376
14557
|
let r = (e) => {
|
|
14377
14558
|
let n = t.nodes.find((t) => t.id === e);
|
|
14378
14559
|
if (!n) throw Error(`Flow input points at a missing node: ${e}`);
|
|
@@ -14402,7 +14583,7 @@ function Ht(t, { presets: n = {} } = {}) {
|
|
|
14402
14583
|
title: "Mode",
|
|
14403
14584
|
hideTitle: !0,
|
|
14404
14585
|
...s.description ? { description: s.description } : {},
|
|
14405
|
-
options: (t.modelChoices ?? []).map(
|
|
14586
|
+
options: (t.modelChoices ?? []).map(Ee),
|
|
14406
14587
|
defaultValue: t.modelChoices?.find(([e]) => e === t.model)?.[1]
|
|
14407
14588
|
});
|
|
14408
14589
|
}
|
|
@@ -14423,7 +14604,7 @@ function Ht(t, { presets: n = {} } = {}) {
|
|
|
14423
14604
|
presets: n[t.id],
|
|
14424
14605
|
label: t.label
|
|
14425
14606
|
} : {}
|
|
14426
|
-
}, s = t.required && t.description && !n[t.id] ? t.description.replace(/\s*·\s*up to \d+ \w+$/i, "").trim() : "", c =
|
|
14607
|
+
}, s = t.required && t.description && !n[t.id] ? t.description.replace(/\s*·\s*up to \d+ \w+$/i, "").trim() : "", c = k(i.type, !!t.required), l = {
|
|
14427
14608
|
type: e.Media,
|
|
14428
14609
|
hint: s ? `${s} · ${c}` : c,
|
|
14429
14610
|
kind: i.type,
|
|
@@ -14441,7 +14622,7 @@ function Ht(t, { presets: n = {} } = {}) {
|
|
|
14441
14622
|
});
|
|
14442
14623
|
}
|
|
14443
14624
|
if (l) {
|
|
14444
|
-
let n = r(l.nodeId).data.groups ?? [], a =
|
|
14625
|
+
let n = r(l.nodeId).data.groups ?? [], a = Qt(t, l.lockWhen), o = n.map((t) => {
|
|
14445
14626
|
let n = t.offWhen ? i.find((e) => e.id === l.photos?.[t.offWhen])?.mediaId : void 0, r = {
|
|
14446
14627
|
key: `customise:${t.label}`,
|
|
14447
14628
|
title: t.label,
|
|
@@ -14470,7 +14651,7 @@ function Ht(t, { presets: n = {} } = {}) {
|
|
|
14470
14651
|
let t = {
|
|
14471
14652
|
type: e.Object,
|
|
14472
14653
|
key: "customise",
|
|
14473
|
-
title:
|
|
14654
|
+
title: De(l.label, n),
|
|
14474
14655
|
icon: "sliders-horizontal",
|
|
14475
14656
|
summary: "count",
|
|
14476
14657
|
random: !!l.random,
|
|
@@ -14481,7 +14662,7 @@ function Ht(t, { presets: n = {} } = {}) {
|
|
|
14481
14662
|
}
|
|
14482
14663
|
}
|
|
14483
14664
|
if (c) {
|
|
14484
|
-
let n =
|
|
14665
|
+
let n = Qt(t, c.lockWhen);
|
|
14485
14666
|
m.push({
|
|
14486
14667
|
type: e.String,
|
|
14487
14668
|
key: "prompt",
|
|
@@ -14496,12 +14677,12 @@ function Ht(t, { presets: n = {} } = {}) {
|
|
|
14496
14677
|
type: e.Enum,
|
|
14497
14678
|
display: "menu",
|
|
14498
14679
|
key: t,
|
|
14499
|
-
...
|
|
14680
|
+
...Zt[t],
|
|
14500
14681
|
options: n.map(({ label: e }) => ({ value: e })),
|
|
14501
14682
|
defaultValue: n.find(({ value: e }) => e === r)?.label
|
|
14502
14683
|
}] : [], _ = p("ratio"), v = f.data.ratio === "adaptive" && _?.length && !_.some(({ value: e }) => e === "adaptive") ? [{
|
|
14503
14684
|
value: "adaptive",
|
|
14504
|
-
label:
|
|
14685
|
+
label: Kt
|
|
14505
14686
|
}, ..._] : _, y = d?.fieldOptions?.["params.draft"] ? [{
|
|
14506
14687
|
value: "final",
|
|
14507
14688
|
label: "Final"
|
|
@@ -14535,7 +14716,7 @@ function Ht(t, { presets: n = {} } = {}) {
|
|
|
14535
14716
|
title: C
|
|
14536
14717
|
}), u(m);
|
|
14537
14718
|
}
|
|
14538
|
-
function
|
|
14719
|
+
function en(e) {
|
|
14539
14720
|
let t = {};
|
|
14540
14721
|
for (let n of e.nodes) if (n.type === "props") for (let e of n.data.groups ?? []) {
|
|
14541
14722
|
let n = e.selected.map((t) => e.items[t]?.label).filter((e) => !!e);
|
|
@@ -14544,20 +14725,20 @@ function Ut(e) {
|
|
|
14544
14725
|
return t;
|
|
14545
14726
|
}
|
|
14546
14727
|
// ../../src/features/marketing-apps/model/engine.ts
|
|
14547
|
-
var U = 32,
|
|
14728
|
+
var U = 32, tn = 4, W = "#frame=first", nn = /* @__PURE__ */ new Set([
|
|
14548
14729
|
"llm",
|
|
14549
14730
|
"imagegen",
|
|
14550
14731
|
"videogen"
|
|
14551
|
-
]),
|
|
14552
|
-
function
|
|
14732
|
+
]), rn = (e) => nn.has(e.type), G = (e, t, n) => e.edges.filter((e) => e.to.node === t && (!n || e.to.port === n)), K = (e, t) => e.nodes.find((e) => e.id === t);
|
|
14733
|
+
function an(e, t) {
|
|
14553
14734
|
let n = e.data;
|
|
14554
14735
|
if (e.type === "text") {
|
|
14555
14736
|
let e = (n.text ?? "").trim();
|
|
14556
14737
|
return e ? [e] : [];
|
|
14557
14738
|
}
|
|
14558
|
-
return e.type === "list" ? (n.selected ?? []).map((e) => n.items?.[e]).filter((e) => e !== void 0).map((e) => e.value || e.label) : e.type === "image" ? n.multiple ? (n.images ?? []).filter(Boolean) : n.image ? [n.image] : [] : e.type === "video" ? n.video ? [n.video] : [] : e.type === "props" ?
|
|
14739
|
+
return e.type === "list" ? (n.selected ?? []).map((e) => n.items?.[e]).filter((e) => e !== void 0).map((e) => e.value || e.label) : e.type === "image" ? n.multiple ? (n.images ?? []).filter(Boolean) : n.image ? [n.image] : [] : e.type === "video" ? n.video ? [n.video] : [] : e.type === "props" ? on(e) : t.get(e.id) ?? [];
|
|
14559
14740
|
}
|
|
14560
|
-
function
|
|
14741
|
+
function on(e) {
|
|
14561
14742
|
let t = e.data.groups ?? [], n = (e) => (e.selected ?? []).map((t) => e.items[t]).filter((e) => e !== void 0), r = (e, t) => t.length ? `${e.label}: ${t.map((e) => e.value || e.label).join(", ")}` : "", i = t.filter((e) => e.fanout && n(e).length);
|
|
14562
14743
|
if (!i.length) {
|
|
14563
14744
|
let e = t.map((e) => r(e, n(e))).filter(Boolean).join("\n");
|
|
@@ -14570,7 +14751,7 @@ function Jt(e) {
|
|
|
14570
14751
|
return i ? r(t, [i[1]]) : r(t, n(t));
|
|
14571
14752
|
}).filter(Boolean).join("\n"));
|
|
14572
14753
|
}
|
|
14573
|
-
function
|
|
14754
|
+
function sn(e, t) {
|
|
14574
14755
|
let n = {};
|
|
14575
14756
|
for (let r of G(e, t.id)) {
|
|
14576
14757
|
let t = K(e, r.from.node);
|
|
@@ -14582,7 +14763,7 @@ function q(e, t, n, r) {
|
|
|
14582
14763
|
return G(e, t.id, n).flatMap((t) => {
|
|
14583
14764
|
let i = K(e, t.from.node);
|
|
14584
14765
|
if (!i) return [];
|
|
14585
|
-
let a =
|
|
14766
|
+
let a = an(i, r);
|
|
14586
14767
|
return i.type === "video" && t.from.port === "frame" && (a = a.filter((e) => !e.startsWith("data:")).map((e) => e + W)), i.type === "list" && [
|
|
14587
14768
|
"image",
|
|
14588
14769
|
"reference",
|
|
@@ -14604,7 +14785,7 @@ function J(e) {
|
|
|
14604
14785
|
}
|
|
14605
14786
|
return t;
|
|
14606
14787
|
}
|
|
14607
|
-
function
|
|
14788
|
+
function cn(e, t, n) {
|
|
14608
14789
|
let r = new Map(t.map((e, t) => [e.id, n[t] ?? ""])), i = /* @__PURE__ */ new Set(), a = (e ?? "").replace(/\{\{\s*([\w-]+)\s*\}\}/g, (e, t) => r.has(t) ? (i.add(t), r.get(t) ?? "") : e), o = t.filter((e) => !i.has(e.id) && !e.quiet).map((e) => r.get(e.id)).filter(Boolean);
|
|
14609
14790
|
return o.length && (a = (a.trim() ? `${a.trim()}\n` : "") + o.join("\n")), a.trim();
|
|
14610
14791
|
}
|
|
@@ -14612,22 +14793,22 @@ var Y = (e, t) => e.startsWith("data:") ? {
|
|
|
14612
14793
|
type: "imageBase64",
|
|
14613
14794
|
data: e,
|
|
14614
14795
|
...t ? { role: t } : {}
|
|
14615
|
-
} : V(e, t),
|
|
14796
|
+
} : V(e, t), ln = (e) => e.startsWith("data:") ? {
|
|
14616
14797
|
type: "videoBase64",
|
|
14617
14798
|
data: e
|
|
14618
14799
|
} : {
|
|
14619
14800
|
type: "videoUrl",
|
|
14620
14801
|
url: e
|
|
14621
14802
|
};
|
|
14622
|
-
function
|
|
14803
|
+
function un(e, t, n) {
|
|
14623
14804
|
let r = {
|
|
14624
14805
|
...n.data.params ?? {},
|
|
14625
|
-
...
|
|
14806
|
+
...sn(t, n)
|
|
14626
14807
|
};
|
|
14627
14808
|
for (let [t, n] of Object.entries(r)) n !== "" && n != null && (e[t] = n);
|
|
14628
14809
|
return e.draft === !0 && delete e.resolution, e.draft === !1 && delete e.draft, e;
|
|
14629
14810
|
}
|
|
14630
|
-
function
|
|
14811
|
+
function dn(e, t, n) {
|
|
14631
14812
|
let r = t.data;
|
|
14632
14813
|
if (r.enabled === !1) return [];
|
|
14633
14814
|
let i = Math.max(1, Math.min(4, Number(r.takes) || 1)), a = (e) => i === 1 ? e : e.flatMap((e) => Array.from({ length: i }, () => e));
|
|
@@ -14668,12 +14849,12 @@ function $t(e, t, n) {
|
|
|
14668
14849
|
model: r.model ?? "",
|
|
14669
14850
|
content: [{
|
|
14670
14851
|
type: "text",
|
|
14671
|
-
text:
|
|
14852
|
+
text: cn(r.prompt, i, n) || "image"
|
|
14672
14853
|
}, ...o.slice(0, 10).map((e) => Y(e))],
|
|
14673
14854
|
numberOfImages: Number(r.numberOfImages) || 1,
|
|
14674
14855
|
watermark: !1
|
|
14675
14856
|
};
|
|
14676
|
-
return r.size && r.size !== "auto" && (a.size = r.size),
|
|
14857
|
+
return r.size && r.size !== "auto" && (a.size = r.size), un(a, e, t), (a.ratio || a.resolution) && delete a.size, {
|
|
14677
14858
|
kind: "image",
|
|
14678
14859
|
body: a
|
|
14679
14860
|
};
|
|
@@ -14685,9 +14866,9 @@ function $t(e, t, n) {
|
|
|
14685
14866
|
let a = n[n.length - 1], o = [
|
|
14686
14867
|
{
|
|
14687
14868
|
type: "text",
|
|
14688
|
-
text:
|
|
14869
|
+
text: cn(r.prompt, i, n.slice(0, -1)) || "video"
|
|
14689
14870
|
},
|
|
14690
|
-
...c.slice(0, 3).map(
|
|
14871
|
+
...c.slice(0, 3).map(ln),
|
|
14691
14872
|
...a ? [Y(a, "firstFrame")] : [],
|
|
14692
14873
|
...l ? [Y(l, "lastFrame")] : [],
|
|
14693
14874
|
...s.slice(0, 9).map((e) => Y(e, "referenceImage"))
|
|
@@ -14698,7 +14879,7 @@ function $t(e, t, n) {
|
|
|
14698
14879
|
resolution: r.resolution,
|
|
14699
14880
|
ratio: r.ratio
|
|
14700
14881
|
};
|
|
14701
|
-
|
|
14882
|
+
un(u, e, t), c.length && /seedance-2-0|seedance-2-5-flash/.test(String(u.model)) && ["1080p", "4k"].includes(String(u.resolution)) && (u.resolution = "720p");
|
|
14702
14883
|
let d, f;
|
|
14703
14884
|
return u.omniReferenceTaskType === "edit" ? (u.duration = -1, u.ratio = "adaptive") : r.matchVideoDuration && c.length && (d = c[0]), r.ratio === "auto" && (u.ratio = r.ratioFallback ?? "9:16", c.length && u.omniReferenceTaskType !== "edit" && (f = c[0])), {
|
|
14704
14885
|
kind: "video",
|
|
@@ -14710,29 +14891,29 @@ function $t(e, t, n) {
|
|
|
14710
14891
|
}
|
|
14711
14892
|
return [];
|
|
14712
14893
|
}
|
|
14713
|
-
function
|
|
14894
|
+
function fn(e, t) {
|
|
14714
14895
|
let n = [], r = /* @__PURE__ */ new Set(), i = (t) => {
|
|
14715
14896
|
if (r.has(t)) return;
|
|
14716
14897
|
r.add(t);
|
|
14717
14898
|
for (let n of G(e, t)) i(n.from.node);
|
|
14718
14899
|
let a = K(e, t);
|
|
14719
|
-
a &&
|
|
14900
|
+
a && rn(a) && n.push(a);
|
|
14720
14901
|
};
|
|
14721
14902
|
return t.forEach(i), n;
|
|
14722
14903
|
}
|
|
14723
|
-
function
|
|
14904
|
+
function pn(e, t, n) {
|
|
14724
14905
|
let r = [...new Set(G(e, t.id).map((e) => e.to.port).filter((e) => !["prompt", "text"].includes(e)))];
|
|
14725
14906
|
return r.length > 0 && r.every((r) => q(e, t, r, n).every((e) => !e.values.length));
|
|
14726
14907
|
}
|
|
14727
|
-
function
|
|
14728
|
-
let n = new Set(t.map((e) => e.id)), r = {}, i = {}, a = (e) => r[e.id] ?? (
|
|
14908
|
+
function mn(e, t) {
|
|
14909
|
+
let n = new Set(t.map((e) => e.id)), r = {}, i = {}, a = (e) => r[e.id] ?? (rn(e) ? Math.max(1, +!!n.has(e.id)) : Math.max(1, an(e, /* @__PURE__ */ new Map()).length));
|
|
14729
14910
|
for (let n of t) {
|
|
14730
14911
|
let t = n.type === "llm" ? "text" : "prompt", o = G(e, n.id, t).reduce((t, r) => t * a(K(e, r.from.node) ?? n), 1);
|
|
14731
|
-
n.type === "videogen" && (o *= G(e, n.id, "firstFrame").reduce((t, r) => t * a(K(e, r.from.node) ?? n), 1)), o = Math.min(o, U), (n.data.enabled === !1 || n.data.skipIfEmpty &&
|
|
14912
|
+
n.type === "videogen" && (o *= G(e, n.id, "firstFrame").reduce((t, r) => t * a(K(e, r.from.node) ?? n), 1)), o = Math.min(o, U), (n.data.enabled === !1 || n.data.skipIfEmpty && pn(e, n, /* @__PURE__ */ new Map())) && (o = 0), o *= n.type === "imagegen" || n.type === "videogen" ? Math.max(1, Number(n.data.takes) || 1) : 1, i[n.id] = o, r[n.id] = n.type === "imagegen" ? o * (Number(n.data.numberOfImages) || 1) : n.type === "llm" && n.data.split ? o * (Number(n.data.splitHint) || 4) : o;
|
|
14732
14913
|
}
|
|
14733
14914
|
return i;
|
|
14734
14915
|
}
|
|
14735
|
-
function
|
|
14916
|
+
function hn(e, t) {
|
|
14736
14917
|
let n = [
|
|
14737
14918
|
"21:9",
|
|
14738
14919
|
"16:9",
|
|
@@ -14746,7 +14927,7 @@ function rn(e, t) {
|
|
|
14746
14927
|
return Math.abs(Math.log(n / i) - r) < Math.abs(Math.log(a / o) - r) ? t : e;
|
|
14747
14928
|
});
|
|
14748
14929
|
}
|
|
14749
|
-
async function
|
|
14930
|
+
async function gn(e, t, n, r, i = {}) {
|
|
14750
14931
|
let a = i.wait ?? ((e) => new Promise((t) => setTimeout(t, e))), o = new Map(Object.entries(i.resume?.values ?? {})), s = new Map((i.resume?.jobs ?? []).map((e) => [`${e.nodeId}:${e.call}`, e])), c = 0, l = () => i.onCheckpoint?.({
|
|
14751
14932
|
values: Object.fromEntries([...o].filter(([, e]) => e.every((e) => !/^(?:data|blob):/.test(e)))),
|
|
14752
14933
|
pending: null,
|
|
@@ -14818,7 +14999,7 @@ async function an(e, t, n, r, i = {}) {
|
|
|
14818
14999
|
}
|
|
14819
15000
|
if (a.ratioFrom && i.size) {
|
|
14820
15001
|
let t = await i.size(a.ratioFrom).catch(() => null);
|
|
14821
|
-
t && (e.ratio =
|
|
15002
|
+
t && (e.ratio = hn(t.width, t.height));
|
|
14822
15003
|
}
|
|
14823
15004
|
}
|
|
14824
15005
|
try {
|
|
@@ -14832,15 +15013,15 @@ async function an(e, t, n, r, i = {}) {
|
|
|
14832
15013
|
throw n;
|
|
14833
15014
|
}
|
|
14834
15015
|
}
|
|
14835
|
-
let p =
|
|
15016
|
+
let p = fn(e, t), m = /* @__PURE__ */ new Set(), h = null;
|
|
14836
15017
|
for (let n of p) if (!o.has(n.id)) {
|
|
14837
15018
|
if (G(e, n.id).some((e) => m.has(e.from.node))) m.add(n.id);
|
|
14838
|
-
else if (n.data.enabled === !1 || n.data.skipIfEmpty &&
|
|
15019
|
+
else if (n.data.enabled === !1 || n.data.skipIfEmpty && pn(e, n, o)) o.set(n.id, []);
|
|
14839
15020
|
else try {
|
|
14840
|
-
let r =
|
|
15021
|
+
let r = dn(e, n, o);
|
|
14841
15022
|
if (!r.length) throw Error(`Nothing to run (${n.title})`);
|
|
14842
15023
|
let a = Array(r.length), c = 0;
|
|
14843
|
-
await Promise.all(Array.from({ length: Math.min(
|
|
15024
|
+
await Promise.all(Array.from({ length: Math.min(tn, r.length) }, async () => {
|
|
14844
15025
|
for (; c < r.length;) {
|
|
14845
15026
|
let e = c++;
|
|
14846
15027
|
a[e] = await f(n, e, r[e]);
|
|
@@ -14888,7 +15069,7 @@ function Z(e, t, n) {
|
|
|
14888
15069
|
e.addEventListener(t, o, { once: !0 }), e.addEventListener("error", s, { once: !0 }), n();
|
|
14889
15070
|
});
|
|
14890
15071
|
}
|
|
14891
|
-
var
|
|
15072
|
+
var _n = {
|
|
14892
15073
|
duration: (e) => X(e, async (e) => e.duration),
|
|
14893
15074
|
firstFrame: (e) => X(e, async (e) => {
|
|
14894
15075
|
await Z(e, "seeked", () => {
|
|
@@ -14919,15 +15100,15 @@ var on = {
|
|
|
14919
15100
|
return n;
|
|
14920
15101
|
})
|
|
14921
15102
|
};
|
|
14922
|
-
function
|
|
15103
|
+
function vn(e) {
|
|
14923
15104
|
return X(e, async (e) => e.videoWidth && e.videoHeight ? {
|
|
14924
15105
|
width: e.videoWidth,
|
|
14925
15106
|
height: e.videoHeight
|
|
14926
15107
|
} : null).catch(() => null);
|
|
14927
15108
|
}
|
|
14928
15109
|
// src/apps.ts
|
|
14929
|
-
function
|
|
14930
|
-
let t = u(
|
|
15110
|
+
function yn(e) {
|
|
15111
|
+
let t = u(F(e.controls));
|
|
14931
15112
|
return {
|
|
14932
15113
|
id: e.id,
|
|
14933
15114
|
name: e.name,
|
|
@@ -14944,14 +15125,14 @@ function cn(e) {
|
|
|
14944
15125
|
function Q(e) {
|
|
14945
15126
|
return l(e, () => "");
|
|
14946
15127
|
}
|
|
14947
|
-
function
|
|
15128
|
+
function bn(t) {
|
|
14948
15129
|
return t.flatMap((t) => t.type === e.Settings ? [
|
|
14949
15130
|
t,
|
|
14950
15131
|
...t.controls,
|
|
14951
15132
|
...t.advanced ?? []
|
|
14952
15133
|
] : t.type === e.Object ? [t, ...t.controls] : t.type === e.Lighting ? [t, ...t.controls ?? []] : [t]);
|
|
14953
15134
|
}
|
|
14954
|
-
function
|
|
15135
|
+
function xn(e, t) {
|
|
14955
15136
|
return typeof e == "string" ? {
|
|
14956
15137
|
url: e,
|
|
14957
15138
|
name: t,
|
|
@@ -14962,8 +15143,8 @@ function un(e, t) {
|
|
|
14962
15143
|
kind: e.kind ?? (/\.(mp4|mov|webm)(\?|$)/i.test(e.url) ? "video" : "image")
|
|
14963
15144
|
};
|
|
14964
15145
|
}
|
|
14965
|
-
function
|
|
14966
|
-
let r =
|
|
15146
|
+
function Sn(t, n) {
|
|
15147
|
+
let r = bn(t.controls), i = new Map(r.map((e) => [e.key, e])), o = {
|
|
14967
15148
|
choices: { ...t.defaults },
|
|
14968
15149
|
prompt: "",
|
|
14969
15150
|
promptOn: !1,
|
|
@@ -14973,12 +15154,12 @@ function dn(t, n) {
|
|
|
14973
15154
|
if (r === void 0) continue;
|
|
14974
15155
|
let n = i.get(t);
|
|
14975
15156
|
n?.type === e.Media || n?.type === e.Array && n.control.type === e.Media || typeof r == "object" && !Array.isArray(r) ? (Array.isArray(r) ? r : [r]).forEach((e, n) => {
|
|
14976
|
-
|
|
14977
|
-
}) : t === "prompt" || n?.type === e.String ? (
|
|
15157
|
+
o.uploads[n === 0 ? t : `${t}:${n}`] = xn(e, `${t}-${n + 1}`);
|
|
15158
|
+
}) : Array.isArray(r) && n?.type === e.Array && n.control.type === e.ComponentInstance ? o.choices[t] = r.reduce((e, t) => a(e, String(t), { multiple: !0 }), "") : t === "prompt" || n?.type === e.String ? (o.prompt = String(r), o.promptOn = !0) : o.choices[t] = typeof r == "boolean" ? r ? "on" : "off" : String(r);
|
|
14978
15159
|
}
|
|
14979
|
-
return
|
|
15160
|
+
return Ce(o);
|
|
14980
15161
|
}
|
|
14981
|
-
function
|
|
15162
|
+
function Cn(e) {
|
|
14982
15163
|
let t = { ...e.choices };
|
|
14983
15164
|
(e.promptOn || e.prompt) && (t.prompt = e.prompt);
|
|
14984
15165
|
let n = {};
|
|
@@ -14993,17 +15174,25 @@ function fn(e) {
|
|
|
14993
15174
|
for (let [e, r] of Object.entries(n)) t[e] = r.length === 1 ? r[0] : r;
|
|
14994
15175
|
return t;
|
|
14995
15176
|
}
|
|
14996
|
-
function
|
|
15177
|
+
function wn(e) {
|
|
15178
|
+
return he(e.controls, {
|
|
15179
|
+
id: e.id,
|
|
15180
|
+
title: e.name,
|
|
15181
|
+
...e.description ? { description: e.description } : {},
|
|
15182
|
+
defaults: e.defaults
|
|
15183
|
+
});
|
|
15184
|
+
}
|
|
15185
|
+
function Tn(e, t, n) {
|
|
14997
15186
|
return e.run(t, {
|
|
14998
15187
|
...n,
|
|
14999
|
-
draft:
|
|
15188
|
+
draft: Sn(e, t)
|
|
15000
15189
|
});
|
|
15001
15190
|
}
|
|
15002
|
-
var
|
|
15191
|
+
var En = "https://avis-studio-app.stream";
|
|
15003
15192
|
function $(e) {
|
|
15004
|
-
return typeof e == "string" ? /^\/mini-apps\//.test(e) ? `${
|
|
15193
|
+
return typeof e == "string" ? /^\/mini-apps\//.test(e) ? `${En}${e}` : /^\/(apps|v7)\//.test(e) ? `${En}/site${e}` : e : Array.isArray(e) ? e.map($) : e && typeof e == "object" ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e, $(t)])) : e;
|
|
15005
15194
|
}
|
|
15006
|
-
var
|
|
15195
|
+
var Dn = {
|
|
15007
15196
|
"commercial-talent": "/v7/character/sheet-talent.webp",
|
|
15008
15197
|
"ai-influencer": "/v7/character/sheet-influencer.webp",
|
|
15009
15198
|
"motion-transfer": "/v7/recast/motion-transfer-showcase.webp",
|
|
@@ -15015,24 +15204,24 @@ var hn = {
|
|
|
15015
15204
|
"ugc-ads": "/v7/studio/ads/ugc/thumb.webp",
|
|
15016
15205
|
"ad-templates": "/apps/marketing/000f49fc5cfb.jpg"
|
|
15017
15206
|
};
|
|
15018
|
-
function
|
|
15019
|
-
let r = $(n ?
|
|
15207
|
+
function On(e, t, n) {
|
|
15208
|
+
let r = $(n ? Ie(t) : $t(t, { presets: jt[e] }));
|
|
15020
15209
|
return {
|
|
15021
15210
|
id: e,
|
|
15022
15211
|
name: t.flow.name.replace(/^.*·\s*/, ""),
|
|
15023
15212
|
...t.flow.description ? { description: t.flow.description } : {},
|
|
15024
|
-
...
|
|
15213
|
+
...Dn[e] ? { image: $(Dn[e]) } : {},
|
|
15025
15214
|
controls: r,
|
|
15026
15215
|
defaults: {
|
|
15027
15216
|
...Q(r),
|
|
15028
|
-
...n ?
|
|
15217
|
+
...n ? He(t) : en(t)
|
|
15029
15218
|
},
|
|
15030
15219
|
run: async (e, { avis: r, draft: i, onProgress: a }) => {
|
|
15031
15220
|
if (n) {
|
|
15032
|
-
let { flow: e, targets: n, missing: o } =
|
|
15221
|
+
let { flow: e, targets: n, missing: o } = Ue(t, i);
|
|
15033
15222
|
if (o.length || !n.length) throw Error(o.length ? `Fill in: ${o.join(", ")}` : "Nothing to make with these settings");
|
|
15034
|
-
let s = await
|
|
15035
|
-
size:
|
|
15223
|
+
let s = await gn(e, n, r.api, _n, {
|
|
15224
|
+
size: vn,
|
|
15036
15225
|
...a ? { onProgress: a } : {}
|
|
15037
15226
|
});
|
|
15038
15227
|
return {
|
|
@@ -15040,7 +15229,7 @@ function gn(e, t, n) {
|
|
|
15040
15229
|
usd: s.usd
|
|
15041
15230
|
};
|
|
15042
15231
|
}
|
|
15043
|
-
let o = await
|
|
15232
|
+
let o = await Xt(t, i, r.api, _n, { ...a ? { onProgress: a } : {} });
|
|
15044
15233
|
return {
|
|
15045
15234
|
urls: o.urls,
|
|
15046
15235
|
usd: o.usd
|
|
@@ -15048,5 +15237,5 @@ function gn(e, t, n) {
|
|
|
15048
15237
|
}
|
|
15049
15238
|
};
|
|
15050
15239
|
}
|
|
15051
|
-
var
|
|
15052
|
-
export {
|
|
15240
|
+
var kn = Object.fromEntries([...Object.entries(Ot).map(([e, t]) => [e, On(e, t, !1)]), ...Object.entries(z).map(([e, t]) => [e, On(e, t, !0)])]);
|
|
15241
|
+
export { n as $, F as A, ce as B, Rt as C, Ke as D, Qe as E, ye as F, se as G, w as H, _e as I, s as J, e as K, Se as L, xe as M, D as N, qe as O, be as P, u as Q, O as R, B as S, kt as T, oe as U, he as V, re as W, S as X, l as Y, p as Z, Pt as _, Tn as a, Mt as b, wn as c, fn as d, t as et, qt as f, Ft as g, Wt as h, kn as i, Ue as j, Je as k, dn as l, Gt as m, yn as n, a as nt, Q as o, Ut as p, x as q, Cn as r, c as rt, Sn as s, bn as t, i as tt, mn as u, It as v, At as w, Lt as x, Nt as y, Ce as z };
|