@feedmepos/mf-media 2.0.1 → 2.0.2-dev.1
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/dist/{AiStudio-2cced8ce.js → AiStudio-6f993b76.js} +74 -74
- package/dist/AssetLibrary-4168fa7a.js +350 -0
- package/dist/app.js +181 -160
- package/dist/{media-picker-1cd70533.js → media-picker-fdef87dc.js} +1467 -1449
- package/dist/src/api/businesses.d.ts +9 -0
- package/dist/src/app.d.ts +21 -0
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/AssetLibrary-b9219b4e.js +0 -306
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as j, computed as S, resolveComponent as E, openBlock as m, createElementBlock as h, createElementVNode as s, normalizeStyle as ee, createVNode as k, toDisplayString as u, unref as a, createCommentVNode as U, normalizeClass as V, createTextVNode as ae, createBlock as G, Fragment as D, renderList as N, mergeModels as H, useModel as q, renderSlot as ne, withCtx as te, ref as B, withDirectives as ie, vModelText as le, onMounted as re } from "vue";
|
|
2
2
|
import { defineStore as de, storeToRefs as ce } from "pinia";
|
|
3
3
|
import { useI18n as L, useCoreStore as ue } from "@feedmepos/mf-common";
|
|
4
4
|
import { useDialog as me, useSnackbar as fe } from "@feedmepos/ui-library";
|
|
5
|
-
import {
|
|
6
|
-
const
|
|
5
|
+
import { d as W, p as pe, e as ve, i as xe } from "./media-picker-fdef87dc.js";
|
|
6
|
+
const ge = { class: "rounded-xl border border-fm-color-neutral-gray-200 bg-white overflow-hidden" }, ye = ["src", "alt"], be = {
|
|
7
7
|
key: 1,
|
|
8
8
|
class: "absolute inset-0 flex flex-col items-center justify-center gap-4 p-12 text-center"
|
|
9
9
|
}, he = { class: "text-xs font-semibold" }, _e = { class: "text-xs text-fm-color-typo-secondary line-clamp-3" }, $e = {
|
|
@@ -18,7 +18,7 @@ const ye = { class: "rounded-xl border border-fm-color-neutral-gray-200 bg-white
|
|
|
18
18
|
}, Ce = { class: "flex-1 text-xs text-fm-color-typo-secondary truncate" }, Fe = ["title"], Se = ["title"], Re = ["title"], Ee = {
|
|
19
19
|
key: 1,
|
|
20
20
|
class: "flex justify-end px-8 py-8"
|
|
21
|
-
}, K = "w-32 h-32 rounded-md flex items-center justify-center text-fm-color-typo-secondary hover:bg-fm-color-neutral-gray-100", Be = /* @__PURE__ */
|
|
21
|
+
}, K = "w-32 h-32 rounded-md flex items-center justify-center text-fm-color-typo-secondary hover:bg-fm-color-neutral-gray-100", Be = /* @__PURE__ */ j({
|
|
22
22
|
__name: "StudioImageCard",
|
|
23
23
|
props: {
|
|
24
24
|
item: {},
|
|
@@ -27,12 +27,12 @@ const ye = { class: "rounded-xl border border-fm-color-neutral-gray-200 bg-white
|
|
|
27
27
|
},
|
|
28
28
|
emits: ["preview", "variant", "discard", "save"],
|
|
29
29
|
setup(e, { emit: x }) {
|
|
30
|
-
const t = e, l = x, { t: r } = L(), v = S(() => t.item.status === "success" && !!t.item.url),
|
|
30
|
+
const t = e, l = x, { t: r } = L(), v = S(() => t.item.status === "success" && !!t.item.url), g = S(() => t.item.status === "failed"), w = S(() => t.ratio.replace("x", " / ")), n = S(
|
|
31
31
|
() => t.item.width && t.item.height ? `${t.item.width}×${t.item.height}` : ""
|
|
32
32
|
);
|
|
33
33
|
return ($, b) => {
|
|
34
34
|
const C = E("FmIcon"), T = E("FmCircularProgress"), F = E("FmButton");
|
|
35
|
-
return m(), h("div",
|
|
35
|
+
return m(), h("div", ge, [
|
|
36
36
|
s("div", {
|
|
37
37
|
class: "relative bg-fm-color-neutral-gray-100",
|
|
38
38
|
style: ee({ aspectRatio: w.value })
|
|
@@ -42,7 +42,7 @@ const ye = { class: "rounded-xl border border-fm-color-neutral-gray-200 bg-white
|
|
|
42
42
|
src: e.item.url,
|
|
43
43
|
class: "w-full h-full object-cover",
|
|
44
44
|
alt: n.value
|
|
45
|
-
}, null, 8,
|
|
45
|
+
}, null, 8, ye)) : g.value ? (m(), h("div", be, [
|
|
46
46
|
k(C, {
|
|
47
47
|
name: "error_outline",
|
|
48
48
|
size: "md"
|
|
@@ -61,7 +61,7 @@ const ye = { class: "rounded-xl border border-fm-color-neutral-gray-200 bg-white
|
|
|
61
61
|
s("span", Ce, u(n.value), 1),
|
|
62
62
|
s("button", {
|
|
63
63
|
type: "button",
|
|
64
|
-
class:
|
|
64
|
+
class: V(K),
|
|
65
65
|
title: a(r)("media.studio.preview"),
|
|
66
66
|
onClick: b[0] || (b[0] = (f) => l("preview"))
|
|
67
67
|
}, [
|
|
@@ -72,7 +72,7 @@ const ye = { class: "rounded-xl border border-fm-color-neutral-gray-200 bg-white
|
|
|
72
72
|
], 8, Fe),
|
|
73
73
|
s("button", {
|
|
74
74
|
type: "button",
|
|
75
|
-
class:
|
|
75
|
+
class: V(K),
|
|
76
76
|
title: a(r)("media.studio.variant"),
|
|
77
77
|
onClick: b[1] || (b[1] = (f) => l("variant"))
|
|
78
78
|
}, [
|
|
@@ -83,7 +83,7 @@ const ye = { class: "rounded-xl border border-fm-color-neutral-gray-200 bg-white
|
|
|
83
83
|
], 8, Se),
|
|
84
84
|
s("button", {
|
|
85
85
|
type: "button",
|
|
86
|
-
class:
|
|
86
|
+
class: V(K),
|
|
87
87
|
title: a(r)("media.studio.discard"),
|
|
88
88
|
onClick: b[2] || (b[2] = (f) => l("discard"))
|
|
89
89
|
}, [
|
|
@@ -99,7 +99,7 @@ const ye = { class: "rounded-xl border border-fm-color-neutral-gray-200 bg-white
|
|
|
99
99
|
disabled: e.item.saved,
|
|
100
100
|
onClick: b[3] || (b[3] = (f) => l("save"))
|
|
101
101
|
}, null, 8, ["label", "disabled"])
|
|
102
|
-
])) :
|
|
102
|
+
])) : g.value ? (m(), h("div", Ee, [
|
|
103
103
|
k(F, {
|
|
104
104
|
label: a(r)("media.studio.retry"),
|
|
105
105
|
variant: "tertiary",
|
|
@@ -113,7 +113,7 @@ const ye = { class: "rounded-xl border border-fm-color-neutral-gray-200 bg-white
|
|
|
113
113
|
}), ze = { class: "flex flex-col gap-12" }, Pe = { class: "flex items-center gap-12" }, Ue = { class: "flex-1 min-w-0 flex flex-col gap-4" }, Oe = { class: "text-sm font-semibold line-clamp-2" }, Ae = { class: "text-xs text-fm-color-typo-secondary" }, De = {
|
|
114
114
|
key: 0,
|
|
115
115
|
class: "flex items-center gap-4 text-xs font-semibold"
|
|
116
|
-
}, Me = { class: "grid gap-16 grid-cols-[repeat(auto-fill,minmax(min(240px,100%),1fr))]" }, Ne = /* @__PURE__ */
|
|
116
|
+
}, Me = { class: "grid gap-16 grid-cols-[repeat(auto-fill,minmax(min(240px,100%),1fr))]" }, Ne = /* @__PURE__ */ j({
|
|
117
117
|
__name: "StudioBatch",
|
|
118
118
|
props: {
|
|
119
119
|
batch: {}
|
|
@@ -122,7 +122,7 @@ const ye = { class: "rounded-xl border border-fm-color-neutral-gray-200 bg-white
|
|
|
122
122
|
setup(e, { emit: x }) {
|
|
123
123
|
const t = e, l = x, { t: r } = L(), v = S(
|
|
124
124
|
() => t.batch.items.some((n) => n.status === "pending" || n.status === "processing")
|
|
125
|
-
),
|
|
125
|
+
), g = S(
|
|
126
126
|
() => !!(t.batch.params.refAssetId || t.batch.params.refTmpToken)
|
|
127
127
|
), w = S(() => {
|
|
128
128
|
const n = {
|
|
@@ -130,7 +130,7 @@ const ye = { class: "rounded-xl border border-fm-color-neutral-gray-200 bg-white
|
|
|
130
130
|
ratio: t.batch.params.ratio,
|
|
131
131
|
count: t.batch.items.length
|
|
132
132
|
};
|
|
133
|
-
return
|
|
133
|
+
return g.value ? r("media.studio.batchMetaRef", { ...n, strength: t.batch.params.refStrength ?? 55 }) : r("media.studio.batchMeta", n);
|
|
134
134
|
});
|
|
135
135
|
return (n, $) => {
|
|
136
136
|
const b = E("FmCircularProgress"), C = E("FmButton");
|
|
@@ -157,7 +157,7 @@ const ye = { class: "rounded-xl border border-fm-color-neutral-gray-200 bg-white
|
|
|
157
157
|
key: T.taskId,
|
|
158
158
|
item: T,
|
|
159
159
|
ratio: e.batch.params.ratio,
|
|
160
|
-
"from-ref":
|
|
160
|
+
"from-ref": g.value,
|
|
161
161
|
onPreview: (F) => l("preview", T),
|
|
162
162
|
onVariant: $[1] || ($[1] = (F) => l("variant")),
|
|
163
163
|
onDiscard: (F) => l("discard", T),
|
|
@@ -167,14 +167,14 @@ const ye = { class: "rounded-xl border border-fm-color-neutral-gray-200 bg-white
|
|
|
167
167
|
]);
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
|
-
}),
|
|
170
|
+
}), Ve = [
|
|
171
171
|
"none",
|
|
172
172
|
"photo",
|
|
173
173
|
"flatlay",
|
|
174
174
|
"studio",
|
|
175
175
|
"warm",
|
|
176
176
|
"illus"
|
|
177
|
-
],
|
|
177
|
+
], je = ["1x1", "4x3", "3x4", "16x9"], Le = [1, 2, 4];
|
|
178
178
|
function J(e) {
|
|
179
179
|
return `/media-v1/businesses/${e}/generations`;
|
|
180
180
|
}
|
|
@@ -207,7 +207,7 @@ async function Ye(e, x) {
|
|
|
207
207
|
const Ke = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p-16 rounded-xl border border-fm-color-neutral-gray-200 bg-white sticky top-0 self-start" }, We = { class: "flex flex-col gap-8" }, Je = { class: "flex items-baseline gap-8" }, Qe = { class: "text-sm font-semibold" }, Xe = { class: "text-xs text-fm-color-typo-tertiary" }, Ze = { class: "grid grid-cols-2 gap-8" }, et = ["onClick"], tt = { class: "flex items-center gap-8" }, st = { class: "text-sm font-semibold" }, ot = { class: "text-xs text-fm-color-typo-secondary" }, at = { class: "flex flex-col gap-8" }, nt = {
|
|
208
208
|
key: 0,
|
|
209
209
|
class: "flex items-center gap-8 px-8 py-8 rounded-lg bg-[#FFF7F0]"
|
|
210
|
-
}, it = { class: "text-xs" }, lt = { class: "flex flex-col gap-8" }, rt = { class: "text-sm font-semibold" }, dt = { class: "flex flex-wrap gap-4" }, ct = { class: "flex flex-col gap-8" }, ut = { class: "text-sm font-semibold" }, mt = { class: "grid grid-cols-2 gap-8" }, ft = ["onClick"], pt = { class: "text-fm-color-typo-secondary" }, vt = { class: "flex flex-col gap-8" }, xt = { class: "text-sm font-semibold" },
|
|
210
|
+
}, it = { class: "text-xs" }, lt = { class: "flex flex-col gap-8" }, rt = { class: "text-sm font-semibold" }, dt = { class: "flex flex-wrap gap-4" }, ct = { class: "flex flex-col gap-8" }, ut = { class: "text-sm font-semibold" }, mt = { class: "grid grid-cols-2 gap-8" }, ft = ["onClick"], pt = { class: "text-fm-color-typo-secondary" }, vt = { class: "flex flex-col gap-8" }, xt = { class: "text-sm font-semibold" }, gt = { class: "flex gap-8" }, yt = ["onClick"], bt = { class: "flex flex-col gap-8 sticky bottom-0 bg-white pt-12" }, ht = { class: "text-xs text-fm-color-typo-tertiary text-center" }, _t = "border-[--fm-color-brand-primary,#FF7823] bg-[#FFF7F0]", $t = "border-fm-color-neutral-gray-200 bg-white", kt = /* @__PURE__ */ j({
|
|
211
211
|
__name: "StudioControls",
|
|
212
212
|
props: /* @__PURE__ */ H({
|
|
213
213
|
busy: { type: Boolean },
|
|
@@ -224,7 +224,7 @@ const Ke = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
224
224
|
}),
|
|
225
225
|
emits: /* @__PURE__ */ H(["generate"], ["update:prompt", "update:style", "update:ratio", "update:count"]),
|
|
226
226
|
setup(e, { emit: x }) {
|
|
227
|
-
const t = e, l = q(e, "prompt"), r = q(e, "style"), v = q(e, "ratio"),
|
|
227
|
+
const t = e, l = q(e, "prompt"), r = q(e, "style"), v = q(e, "ratio"), g = q(e, "count"), w = x, { t: n } = L(), $ = ["hero", "banner", "social", "menu"], b = {
|
|
228
228
|
hero: "restaurant",
|
|
229
229
|
banner: "campaign",
|
|
230
230
|
social: "photo_camera",
|
|
@@ -240,13 +240,13 @@ const Ke = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
240
240
|
), T = S(
|
|
241
241
|
() => {
|
|
242
242
|
var o;
|
|
243
|
-
return (o = C.value.find((
|
|
243
|
+
return (o = C.value.find((y) => y.prompt === l.value)) == null ? void 0 : o.key;
|
|
244
244
|
}
|
|
245
245
|
), F = S(() => /\[[^\]]+\]/.test(l.value)), f = S(() => l.value.trim().length > 0 && !t.busy);
|
|
246
246
|
function i(o) {
|
|
247
247
|
return o ? _t : $t;
|
|
248
248
|
}
|
|
249
|
-
return (o,
|
|
249
|
+
return (o, y) => {
|
|
250
250
|
const _ = E("FmIcon"), z = E("FmTextarea"), O = E("FmChip"), Y = E("FmButton");
|
|
251
251
|
return m(), h("div", Ke, [
|
|
252
252
|
s("div", We, [
|
|
@@ -258,7 +258,7 @@ const Ke = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
258
258
|
(m(!0), h(D, null, N(C.value, (d) => (m(), h("button", {
|
|
259
259
|
key: d.key,
|
|
260
260
|
type: "button",
|
|
261
|
-
class:
|
|
261
|
+
class: V(["flex flex-col items-start gap-4 p-12 rounded-lg border text-left", i(T.value === d.key)]),
|
|
262
262
|
onClick: (M) => l.value = d.prompt
|
|
263
263
|
}, [
|
|
264
264
|
s("span", tt, [
|
|
@@ -275,7 +275,7 @@ const Ke = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
275
275
|
s("div", at, [
|
|
276
276
|
k(z, {
|
|
277
277
|
modelValue: l.value,
|
|
278
|
-
"onUpdate:modelValue":
|
|
278
|
+
"onUpdate:modelValue": y[0] || (y[0] = (d) => l.value = d),
|
|
279
279
|
label: a(n)("media.studio.prompt"),
|
|
280
280
|
placeholder: e.hasRef ? a(n)("media.studio.promptPlaceholderRef") : a(n)("media.studio.promptPlaceholder"),
|
|
281
281
|
"max-length": 500,
|
|
@@ -293,7 +293,7 @@ const Ke = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
293
293
|
s("div", lt, [
|
|
294
294
|
s("span", rt, u(a(n)("media.studio.style")), 1),
|
|
295
295
|
s("div", dt, [
|
|
296
|
-
(m(!0), h(D, null, N(a(
|
|
296
|
+
(m(!0), h(D, null, N(a(Ve), (d) => (m(), G(O, {
|
|
297
297
|
key: d,
|
|
298
298
|
label: a(n)(`media.studio.styles.${d}`),
|
|
299
299
|
selected: r.value === d,
|
|
@@ -306,10 +306,10 @@ const Ke = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
306
306
|
s("div", ct, [
|
|
307
307
|
s("span", ut, u(a(n)("media.studio.ratio")), 1),
|
|
308
308
|
s("div", mt, [
|
|
309
|
-
(m(!0), h(D, null, N(a(
|
|
309
|
+
(m(!0), h(D, null, N(a(je), (d) => (m(), h("button", {
|
|
310
310
|
key: d,
|
|
311
311
|
type: "button",
|
|
312
|
-
class:
|
|
312
|
+
class: V(["flex items-center justify-center gap-4 h-40 rounded-lg border text-xs font-semibold", i(v.value === d)]),
|
|
313
313
|
onClick: (M) => v.value = d
|
|
314
314
|
}, [
|
|
315
315
|
s("span", null, u(d), 1),
|
|
@@ -319,13 +319,13 @@ const Ke = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
319
319
|
]),
|
|
320
320
|
s("div", vt, [
|
|
321
321
|
s("span", xt, u(a(n)("media.studio.count")), 1),
|
|
322
|
-
s("div",
|
|
322
|
+
s("div", gt, [
|
|
323
323
|
(m(!0), h(D, null, N(a(Le), (d) => (m(), h("button", {
|
|
324
324
|
key: d,
|
|
325
325
|
type: "button",
|
|
326
|
-
class:
|
|
327
|
-
onClick: (M) =>
|
|
328
|
-
}, " × " + u(d), 11,
|
|
326
|
+
class: V(["flex-1 h-40 rounded-lg border text-sm font-semibold", i(g.value === d)]),
|
|
327
|
+
onClick: (M) => g.value = d
|
|
328
|
+
}, " × " + u(d), 11, yt))), 128))
|
|
329
329
|
])
|
|
330
330
|
]),
|
|
331
331
|
s("div", bt, [
|
|
@@ -335,7 +335,7 @@ const Ke = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
335
335
|
variant: "primary",
|
|
336
336
|
size: "md",
|
|
337
337
|
disabled: !f.value,
|
|
338
|
-
onClick:
|
|
338
|
+
onClick: y[1] || (y[1] = (d) => w("generate"))
|
|
339
339
|
}, null, 8, ["label", "disabled"]),
|
|
340
340
|
s("span", ht, u(a(n)("media.studio.disclaimer")), 1)
|
|
341
341
|
])
|
|
@@ -345,7 +345,7 @@ const Ke = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
345
345
|
}), It = {
|
|
346
346
|
key: 0,
|
|
347
347
|
class: "flex h-[560px]"
|
|
348
|
-
}, wt = { class: "flex-1 min-w-0 flex items-center justify-center bg-black p-16" }, Tt = ["src", "alt"], Ct = { class: "w-[300px] flex-shrink-0 flex flex-col gap-12 p-16 overflow-y-auto" }, Ft = { class: "flex items-start justify-between gap-8" }, St = { class: "fm-typo-en-title-sm-600" }, Rt = ["title"], Et = { class: "text-sm font-semibold break-words" }, Bt = { class: "text-xs text-fm-color-typo-secondary" }, zt = /* @__PURE__ */
|
|
348
|
+
}, wt = { class: "flex-1 min-w-0 flex items-center justify-center bg-black p-16" }, Tt = ["src", "alt"], Ct = { class: "w-[300px] flex-shrink-0 flex flex-col gap-12 p-16 overflow-y-auto" }, Ft = { class: "flex items-start justify-between gap-8" }, St = { class: "fm-typo-en-title-sm-600" }, Rt = ["title"], Et = { class: "text-sm font-semibold break-words" }, Bt = { class: "text-xs text-fm-color-typo-secondary" }, zt = /* @__PURE__ */ j({
|
|
349
349
|
__name: "StudioPreviewDialog",
|
|
350
350
|
props: {
|
|
351
351
|
item: {},
|
|
@@ -354,7 +354,7 @@ const Ke = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
354
354
|
emits: ["close", "save", "variant"],
|
|
355
355
|
setup(e, { emit: x }) {
|
|
356
356
|
const t = e, l = x, { t: r } = L();
|
|
357
|
-
return (v,
|
|
357
|
+
return (v, g) => {
|
|
358
358
|
const w = E("FmIcon"), n = E("FmButton"), $ = E("FmDialog");
|
|
359
359
|
return m(), G($, {
|
|
360
360
|
"model-value": !!t.item,
|
|
@@ -362,7 +362,7 @@ const Ke = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
362
362
|
"max-height": "560px",
|
|
363
363
|
"content-class": "!p-0 studio-preview-dialog-content",
|
|
364
364
|
"close-button": !1,
|
|
365
|
-
"onUpdate:modelValue":
|
|
365
|
+
"onUpdate:modelValue": g[3] || (g[3] = (b) => !b && l("close"))
|
|
366
366
|
}, {
|
|
367
367
|
default: te(() => [
|
|
368
368
|
t.item ? (m(), h("div", It, [
|
|
@@ -380,7 +380,7 @@ const Ke = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
380
380
|
type: "button",
|
|
381
381
|
class: "w-32 h-32 rounded-lg bg-fm-color-neutral-gray-100 flex items-center justify-center flex-shrink-0",
|
|
382
382
|
title: a(r)("media.library.cancelButton"),
|
|
383
|
-
onClick:
|
|
383
|
+
onClick: g[0] || (g[0] = (b) => l("close"))
|
|
384
384
|
}, [
|
|
385
385
|
k(w, {
|
|
386
386
|
name: "close",
|
|
@@ -390,19 +390,19 @@ const Ke = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
390
390
|
]),
|
|
391
391
|
s("span", Et, u(t.prompt), 1),
|
|
392
392
|
s("span", Bt, u(t.item.width) + "×" + u(t.item.height), 1),
|
|
393
|
-
|
|
393
|
+
g[4] || (g[4] = s("div", { class: "flex-1" }, null, -1)),
|
|
394
394
|
k(n, {
|
|
395
395
|
label: a(r)("media.studio.variant"),
|
|
396
396
|
variant: "tertiary",
|
|
397
397
|
size: "md",
|
|
398
|
-
onClick:
|
|
398
|
+
onClick: g[1] || (g[1] = (b) => l("variant"))
|
|
399
399
|
}, null, 8, ["label"]),
|
|
400
400
|
k(n, {
|
|
401
401
|
label: t.item.saved ? a(r)("media.studio.saved") : a(r)("media.studio.save"),
|
|
402
402
|
variant: "primary",
|
|
403
403
|
size: "md",
|
|
404
404
|
disabled: t.item.saved,
|
|
405
|
-
onClick:
|
|
405
|
+
onClick: g[2] || (g[2] = (b) => l("save"))
|
|
406
406
|
}, null, 8, ["label", "disabled"])
|
|
407
407
|
])
|
|
408
408
|
])) : U("", !0)
|
|
@@ -414,13 +414,13 @@ const Ke = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
414
414
|
}), Pt = { class: "flex flex-col gap-8" }, Ut = { class: "flex items-baseline gap-8" }, Ot = { class: "text-sm font-semibold" }, At = { class: "text-xs text-fm-color-typo-tertiary" }, Dt = {
|
|
415
415
|
key: 0,
|
|
416
416
|
class: "flex items-center gap-8 p-8 rounded-lg border border-fm-color-neutral-gray-200"
|
|
417
|
-
}, Mt = ["src"], Nt = { class: "flex-1 text-xs truncate" },
|
|
417
|
+
}, Mt = ["src"], Nt = { class: "flex-1 text-xs truncate" }, Vt = { class: "flex gap-8" }, jt = { class: "text-xs text-fm-color-typo-tertiary" }, Lt = {
|
|
418
418
|
key: 2,
|
|
419
419
|
class: "text-xs text-[--fm-color-typo-critical,#FF3B30]"
|
|
420
420
|
}, qt = {
|
|
421
421
|
key: 3,
|
|
422
422
|
class: "flex flex-col gap-4"
|
|
423
|
-
}, Gt = { class: "flex items-baseline gap-8" }, Ht = { class: "text-xs font-semibold" }, Yt = { class: "text-xs font-semibold" }, Kt = { class: "text-xs text-fm-color-typo-secondary" }, Wt = /* @__PURE__ */
|
|
423
|
+
}, Gt = { class: "flex items-baseline gap-8" }, Ht = { class: "text-xs font-semibold" }, Yt = { class: "text-xs font-semibold" }, Kt = { class: "text-xs text-fm-color-typo-secondary" }, Wt = /* @__PURE__ */ j({
|
|
424
424
|
__name: "StudioRefPicker",
|
|
425
425
|
props: /* @__PURE__ */ H({
|
|
426
426
|
businessId: {},
|
|
@@ -431,9 +431,9 @@ const Ke = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
431
431
|
}),
|
|
432
432
|
emits: /* @__PURE__ */ H(["change"], ["update:strength"]),
|
|
433
433
|
setup(e, { emit: x }) {
|
|
434
|
-
const t = e, l = q(e, "strength"), r = x, { t: v } = L(),
|
|
434
|
+
const t = e, l = q(e, "strength"), r = x, { t: v } = L(), g = B(!1), w = B(!1), n = B(""), $ = B(null), b = B(null), C = S(() => l.value <= 35 ? v("media.studio.refWeak") : l.value >= 70 ? v("media.studio.refStrong") : v("media.studio.refMid"));
|
|
435
435
|
function T(i) {
|
|
436
|
-
|
|
436
|
+
g.value = !1, n.value = "", $.value = { url: i.url, label: i.asset.fileName }, r("change", {
|
|
437
437
|
refAssetId: i.asset.id,
|
|
438
438
|
// null means the original was picked, and the request omits refRatio for that.
|
|
439
439
|
refRatio: i.ratio ?? void 0,
|
|
@@ -441,8 +441,8 @@ const Ke = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
441
441
|
});
|
|
442
442
|
}
|
|
443
443
|
async function F(i) {
|
|
444
|
-
var
|
|
445
|
-
const o = (
|
|
444
|
+
var y;
|
|
445
|
+
const o = (y = i.target.files) == null ? void 0 : y[0];
|
|
446
446
|
if (o) {
|
|
447
447
|
w.value = !0, n.value = "";
|
|
448
448
|
try {
|
|
@@ -462,7 +462,7 @@ const Ke = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
462
462
|
$.value = null, n.value = "", r("change", null);
|
|
463
463
|
}
|
|
464
464
|
return (i, o) => {
|
|
465
|
-
const
|
|
465
|
+
const y = E("FmButton");
|
|
466
466
|
return m(), h("div", Pt, [
|
|
467
467
|
s("div", Ut, [
|
|
468
468
|
s("span", Ot, u(a(v)("media.studio.ref")), 1),
|
|
@@ -476,22 +476,22 @@ const Ke = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
476
476
|
alt: ""
|
|
477
477
|
}, null, 8, Mt)) : U("", !0),
|
|
478
478
|
s("span", Nt, u($.value.label), 1),
|
|
479
|
-
k(
|
|
479
|
+
k(y, {
|
|
480
480
|
label: a(v)("media.studio.refClear"),
|
|
481
481
|
variant: "tertiary",
|
|
482
482
|
size: "md",
|
|
483
483
|
onClick: f
|
|
484
484
|
}, null, 8, ["label"])
|
|
485
485
|
])) : (m(), h(D, { key: 1 }, [
|
|
486
|
-
s("div",
|
|
487
|
-
k(
|
|
486
|
+
s("div", Vt, [
|
|
487
|
+
k(y, {
|
|
488
488
|
label: a(v)("media.studio.refPick"),
|
|
489
489
|
variant: "tertiary",
|
|
490
490
|
size: "md",
|
|
491
491
|
class: "flex-1",
|
|
492
|
-
onClick: o[0] || (o[0] = (_) =>
|
|
492
|
+
onClick: o[0] || (o[0] = (_) => g.value = !0)
|
|
493
493
|
}, null, 8, ["label"]),
|
|
494
|
-
k(
|
|
494
|
+
k(y, {
|
|
495
495
|
label: a(v)("media.studio.refUpload"),
|
|
496
496
|
variant: "tertiary",
|
|
497
497
|
size: "md",
|
|
@@ -511,7 +511,7 @@ const Ke = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
511
511
|
onChange: F
|
|
512
512
|
}, null, 544)
|
|
513
513
|
]),
|
|
514
|
-
s("span",
|
|
514
|
+
s("span", jt, u(a(v)("media.studio.refUploadHint")), 1)
|
|
515
515
|
], 64)),
|
|
516
516
|
n.value ? (m(), h("span", Lt, u(n.value), 1)) : U("", !0),
|
|
517
517
|
$.value ? (m(), h("div", qt, [
|
|
@@ -538,8 +538,8 @@ const Ke = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
538
538
|
s("span", Kt, u(C.value), 1)
|
|
539
539
|
])) : U("", !0),
|
|
540
540
|
k(a(pe), {
|
|
541
|
-
open:
|
|
542
|
-
"onUpdate:open": o[3] || (o[3] = (_) =>
|
|
541
|
+
open: g.value,
|
|
542
|
+
"onUpdate:open": o[3] || (o[3] = (_) => g.value = _),
|
|
543
543
|
"business-id": e.businessId,
|
|
544
544
|
"restaurant-id": e.restaurantId,
|
|
545
545
|
"allow-upload": !1,
|
|
@@ -580,7 +580,7 @@ const ts = 3e3, ss = de("mediaGeneration", () => {
|
|
|
580
580
|
const e = B([]), x = S(() => e.value.some((f) => Z(f.items)));
|
|
581
581
|
let t, l = "";
|
|
582
582
|
function r(f, i) {
|
|
583
|
-
const o = e.value.find((
|
|
583
|
+
const o = e.value.find((y) => y.batchId === f);
|
|
584
584
|
o && (o.items = Zt(o.items, i));
|
|
585
585
|
}
|
|
586
586
|
function v() {
|
|
@@ -596,37 +596,37 @@ const ts = 3e3, ss = de("mediaGeneration", () => {
|
|
|
596
596
|
x.value && v();
|
|
597
597
|
}, ts));
|
|
598
598
|
}
|
|
599
|
-
async function
|
|
599
|
+
async function g(f, i) {
|
|
600
600
|
l = f;
|
|
601
601
|
const o = await qe(f, es(i));
|
|
602
602
|
e.value.unshift({
|
|
603
603
|
batchId: o.batchId,
|
|
604
604
|
params: i,
|
|
605
|
-
items: o.items.map((
|
|
606
|
-
taskId:
|
|
607
|
-
assetId:
|
|
608
|
-
imageId:
|
|
609
|
-
status:
|
|
605
|
+
items: o.items.map((y) => ({
|
|
606
|
+
taskId: y.taskId,
|
|
607
|
+
assetId: y.assetId,
|
|
608
|
+
imageId: y.imageId,
|
|
609
|
+
status: y.status,
|
|
610
610
|
attempts: 0,
|
|
611
|
-
error:
|
|
611
|
+
error: y.error,
|
|
612
612
|
saved: !1
|
|
613
613
|
}))
|
|
614
614
|
}), v();
|
|
615
615
|
}
|
|
616
616
|
async function w(f, i) {
|
|
617
|
-
await
|
|
617
|
+
await g(f, i);
|
|
618
618
|
}
|
|
619
619
|
async function n(f, i) {
|
|
620
|
-
await
|
|
620
|
+
await g(f, { ...i.params });
|
|
621
621
|
}
|
|
622
622
|
async function $(f, i) {
|
|
623
|
-
await
|
|
623
|
+
await g(f, { ...i.params, count: 1 });
|
|
624
624
|
}
|
|
625
625
|
async function b(f, i, o) {
|
|
626
626
|
var _;
|
|
627
627
|
await ve(f, o.assetId, [Qt]);
|
|
628
|
-
const
|
|
629
|
-
|
|
628
|
+
const y = (_ = e.value.find((z) => z.batchId === i.batchId)) == null ? void 0 : _.items.find((z) => z.taskId === o.taskId);
|
|
629
|
+
y && (y.saved = !0);
|
|
630
630
|
}
|
|
631
631
|
async function C(f, i, o) {
|
|
632
632
|
await xe(f, [
|
|
@@ -637,8 +637,8 @@ const ts = 3e3, ss = de("mediaGeneration", () => {
|
|
|
637
637
|
aspectRatios: null
|
|
638
638
|
}
|
|
639
639
|
]);
|
|
640
|
-
const
|
|
641
|
-
|
|
640
|
+
const y = e.value.find((_) => _.batchId === i.batchId);
|
|
641
|
+
y && (y.items = y.items.filter((_) => _.taskId !== o.taskId), y.items.length === 0 && (e.value = e.value.filter((_) => _.batchId !== i.batchId)));
|
|
642
642
|
}
|
|
643
643
|
function T(f) {
|
|
644
644
|
l = f, x.value && v();
|
|
@@ -650,19 +650,19 @@ const ts = 3e3, ss = de("mediaGeneration", () => {
|
|
|
650
650
|
}), os = { class: "flex items-start gap-24 p-24" }, as = { class: "flex-1 min-w-0 flex flex-col gap-24" }, ns = {
|
|
651
651
|
key: 0,
|
|
652
652
|
class: "min-h-[340px] flex flex-col items-center justify-center gap-12 border-2 border-dashed border-fm-color-neutral-gray-300 rounded-2xl"
|
|
653
|
-
}, is = { class: "text-lg font-semibold" }, ls = { class: "text-sm text-fm-color-typo-secondary" }, fs = /* @__PURE__ */
|
|
653
|
+
}, is = { class: "text-lg font-semibold" }, ls = { class: "text-sm text-fm-color-typo-secondary" }, fs = /* @__PURE__ */ j({
|
|
654
654
|
__name: "AiStudio",
|
|
655
655
|
setup(e) {
|
|
656
656
|
const x = ue(), { t } = L(), l = me(), r = fe(), v = S(() => {
|
|
657
657
|
var p;
|
|
658
658
|
return ((p = x.currentBusiness.value) == null ? void 0 : p.id) ?? "";
|
|
659
|
-
}),
|
|
659
|
+
}), g = S(() => {
|
|
660
660
|
var p;
|
|
661
661
|
return (p = x.currentRestaurant.value) == null ? void 0 : p._id;
|
|
662
662
|
}), w = ss(), { batches: n, busy: $ } = ce(w);
|
|
663
663
|
re(() => w.resume(v.value));
|
|
664
664
|
const b = B(""), C = B("photo"), T = B("1x1"), F = B(2), f = B(55), i = B(null), o = S(() => !!i.value);
|
|
665
|
-
function
|
|
665
|
+
function y() {
|
|
666
666
|
var p, c, R, P;
|
|
667
667
|
return {
|
|
668
668
|
prompt: b.value,
|
|
@@ -674,7 +674,7 @@ const ts = 3e3, ss = de("mediaGeneration", () => {
|
|
|
674
674
|
refTmpToken: (R = i.value) == null ? void 0 : R.refTmpToken,
|
|
675
675
|
refStrength: i.value ? f.value : void 0,
|
|
676
676
|
refLabel: (P = i.value) == null ? void 0 : P.label,
|
|
677
|
-
restaurantId:
|
|
677
|
+
restaurantId: g.value
|
|
678
678
|
};
|
|
679
679
|
}
|
|
680
680
|
function _(p) {
|
|
@@ -691,7 +691,7 @@ const ts = 3e3, ss = de("mediaGeneration", () => {
|
|
|
691
691
|
}
|
|
692
692
|
async function Y() {
|
|
693
693
|
try {
|
|
694
|
-
await w.compose(v.value,
|
|
694
|
+
await w.compose(v.value, y());
|
|
695
695
|
} catch (p) {
|
|
696
696
|
O(p);
|
|
697
697
|
}
|
|
@@ -757,7 +757,7 @@ const ts = 3e3, ss = de("mediaGeneration", () => {
|
|
|
757
757
|
strength: f.value,
|
|
758
758
|
"onUpdate:strength": c[0] || (c[0] = (I) => f.value = I),
|
|
759
759
|
"business-id": v.value,
|
|
760
|
-
"restaurant-id":
|
|
760
|
+
"restaurant-id": g.value,
|
|
761
761
|
onChange: c[1] || (c[1] = (I) => i.value = I)
|
|
762
762
|
}, null, 8, ["strength", "business-id", "restaurant-id"])
|
|
763
763
|
]),
|