@feedmepos/mf-media 1.0.0 → 1.0.1-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-9f9c1203.js → AiStudio-a685be4a.js} +79 -78
- package/dist/{AssetLibrary-7609684b.js → AssetLibrary-bb6b1fb8.js} +73 -71
- package/dist/app.js +18 -18
- package/dist/media-picker-9b94d32f.js +4754 -0
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/dist/media-picker-cf281640.js +0 -4297
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as j, computed 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 {
|
|
5
|
+
import { i as W, e as pe, u as ve, f as xe } from "./media-picker-9b94d32f.js";
|
|
6
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"
|
|
@@ -15,10 +15,10 @@ const ge = { class: "rounded-xl border border-fm-color-neutral-gray-200 bg-white
|
|
|
15
15
|
}, Te = {
|
|
16
16
|
key: 0,
|
|
17
17
|
class: "flex items-center gap-4 px-8 py-8"
|
|
18
|
-
}, Ce = { class: "flex-1 text-xs text-fm-color-typo-secondary truncate" },
|
|
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
|
-
},
|
|
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,11 +27,11 @@ const ge = { 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 =
|
|
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
|
-
const C = E("FmIcon"), T = E("FmCircularProgress"),
|
|
34
|
+
const C = E("FmIcon"), T = E("FmCircularProgress"), F = E("FmButton");
|
|
35
35
|
return m(), h("div", ge, [
|
|
36
36
|
s("div", {
|
|
37
37
|
class: "relative bg-fm-color-neutral-gray-100",
|
|
@@ -61,7 +61,7 @@ const ge = { 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
|
}, [
|
|
@@ -69,10 +69,10 @@ const ge = { class: "rounded-xl border border-fm-color-neutral-gray-200 bg-white
|
|
|
69
69
|
name: "open_in_full",
|
|
70
70
|
size: "sm"
|
|
71
71
|
})
|
|
72
|
-
], 8,
|
|
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
|
}, [
|
|
@@ -80,10 +80,10 @@ const ge = { class: "rounded-xl border border-fm-color-neutral-gray-200 bg-white
|
|
|
80
80
|
name: "add_photo_alternate",
|
|
81
81
|
size: "sm"
|
|
82
82
|
})
|
|
83
|
-
], 8,
|
|
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
|
}, [
|
|
@@ -92,7 +92,7 @@ const ge = { class: "rounded-xl border border-fm-color-neutral-gray-200 bg-white
|
|
|
92
92
|
size: "sm"
|
|
93
93
|
})
|
|
94
94
|
], 8, Re),
|
|
95
|
-
k(
|
|
95
|
+
k(F, {
|
|
96
96
|
label: e.item.saved ? a(r)("media.studio.saved") : a(r)("media.studio.save"),
|
|
97
97
|
variant: "primary",
|
|
98
98
|
size: "md",
|
|
@@ -100,7 +100,7 @@ const ge = { class: "rounded-xl border border-fm-color-neutral-gray-200 bg-white
|
|
|
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
|
-
k(
|
|
103
|
+
k(F, {
|
|
104
104
|
label: a(r)("media.studio.retry"),
|
|
105
105
|
variant: "tertiary",
|
|
106
106
|
size: "md",
|
|
@@ -113,18 +113,18 @@ const ge = { 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))]" },
|
|
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: {}
|
|
120
120
|
},
|
|
121
121
|
emits: ["regenerate", "preview", "variant", "discard", "save"],
|
|
122
122
|
setup(e, { emit: x }) {
|
|
123
|
-
const t = e, l = x, { t: r } = L(), v =
|
|
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
|
-
), g =
|
|
125
|
+
), g = S(
|
|
126
126
|
() => !!(t.batch.params.refAssetId || t.batch.params.refTmpToken)
|
|
127
|
-
), w =
|
|
127
|
+
), w = S(() => {
|
|
128
128
|
const n = {
|
|
129
129
|
style: r(`media.studio.styles.${t.batch.params.style}`),
|
|
130
130
|
ratio: t.batch.params.ratio,
|
|
@@ -153,21 +153,21 @@ const ge = { class: "rounded-xl border border-fm-color-neutral-gray-200 bg-white
|
|
|
153
153
|
}, null, 8, ["label"]))
|
|
154
154
|
]),
|
|
155
155
|
s("div", Me, [
|
|
156
|
-
(m(!0), h(D, null,
|
|
156
|
+
(m(!0), h(D, null, N(e.batch.items, (T) => (m(), G(Be, {
|
|
157
157
|
key: T.taskId,
|
|
158
158
|
item: T,
|
|
159
159
|
ratio: e.batch.params.ratio,
|
|
160
160
|
"from-ref": g.value,
|
|
161
|
-
onPreview: (
|
|
162
|
-
onVariant: $[1] || ($[1] = (
|
|
163
|
-
onDiscard: (
|
|
164
|
-
onSave: (
|
|
161
|
+
onPreview: (F) => l("preview", T),
|
|
162
|
+
onVariant: $[1] || ($[1] = (F) => l("variant")),
|
|
163
|
+
onDiscard: (F) => l("discard", T),
|
|
164
|
+
onSave: (F) => l("save", T)
|
|
165
165
|
}, null, 8, ["item", "ratio", "from-ref", "onPreview", "onDiscard", "onSave"]))), 128))
|
|
166
166
|
])
|
|
167
167
|
]);
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
|
-
}),
|
|
170
|
+
}), Ve = [
|
|
171
171
|
"none",
|
|
172
172
|
"photo",
|
|
173
173
|
"flatlay",
|
|
@@ -175,22 +175,22 @@ const ge = { class: "rounded-xl border border-fm-color-neutral-gray-200 bg-white
|
|
|
175
175
|
"warm",
|
|
176
176
|
"illus"
|
|
177
177
|
], je = ["1x1", "4x3", "3x4", "16x9"], Le = [1, 2, 4];
|
|
178
|
-
function
|
|
178
|
+
function J(e) {
|
|
179
179
|
return `/media-v1/businesses/${e}/generations`;
|
|
180
180
|
}
|
|
181
181
|
async function qe(e, x) {
|
|
182
|
-
const { data: t } = await
|
|
182
|
+
const { data: t } = await W().post(J(e), x);
|
|
183
183
|
return t;
|
|
184
184
|
}
|
|
185
185
|
async function Ge(e, x) {
|
|
186
|
-
const { data: t } = await
|
|
187
|
-
`${
|
|
186
|
+
const { data: t } = await W().get(
|
|
187
|
+
`${J(e)}/${x}`
|
|
188
188
|
);
|
|
189
189
|
return t;
|
|
190
190
|
}
|
|
191
191
|
async function He(e, x) {
|
|
192
|
-
const { data: t } = await
|
|
193
|
-
`${
|
|
192
|
+
const { data: t } = await W().post(
|
|
193
|
+
`${J(e)}/ref-upload-intent`,
|
|
194
194
|
x
|
|
195
195
|
);
|
|
196
196
|
return t;
|
|
@@ -204,7 +204,7 @@ async function Ye(e, x) {
|
|
|
204
204
|
if (!t.ok)
|
|
205
205
|
throw new Error(`reference upload failed: ${t.status} ${await t.text()}`);
|
|
206
206
|
}
|
|
207
|
-
const
|
|
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
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({
|
|
@@ -229,7 +229,7 @@ const Je = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
229
229
|
banner: "campaign",
|
|
230
230
|
social: "photo_camera",
|
|
231
231
|
menu: "menu_book"
|
|
232
|
-
}, C =
|
|
232
|
+
}, C = S(
|
|
233
233
|
() => $.map((o) => ({
|
|
234
234
|
key: o,
|
|
235
235
|
icon: b[o],
|
|
@@ -237,28 +237,28 @@ const Je = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
237
237
|
desc: n(`media.studio.tpl.${o}.desc`),
|
|
238
238
|
prompt: n(`media.studio.tpl.${o}.prompt`)
|
|
239
239
|
}))
|
|
240
|
-
), T =
|
|
240
|
+
), T = S(
|
|
241
241
|
() => {
|
|
242
242
|
var o;
|
|
243
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
249
|
return (o, y) => {
|
|
250
250
|
const _ = E("FmIcon"), z = E("FmTextarea"), O = E("FmChip"), Y = E("FmButton");
|
|
251
|
-
return m(), h("div",
|
|
252
|
-
s("div",
|
|
253
|
-
s("div",
|
|
254
|
-
s("span",
|
|
255
|
-
s("span",
|
|
251
|
+
return m(), h("div", Ke, [
|
|
252
|
+
s("div", We, [
|
|
253
|
+
s("div", Je, [
|
|
254
|
+
s("span", Qe, u(a(n)("media.studio.templates")), 1),
|
|
255
|
+
s("span", Xe, u(a(n)("media.studio.templatesHint")), 1)
|
|
256
256
|
]),
|
|
257
257
|
s("div", Ze, [
|
|
258
|
-
(m(!0), h(D, null,
|
|
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, [
|
|
@@ -281,7 +281,7 @@ const Je = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
281
281
|
"max-length": 500,
|
|
282
282
|
"show-word-count": ""
|
|
283
283
|
}, null, 8, ["modelValue", "label", "placeholder"]),
|
|
284
|
-
|
|
284
|
+
F.value ? (m(), h("div", nt, [
|
|
285
285
|
k(_, {
|
|
286
286
|
name: "info",
|
|
287
287
|
size: "sm"
|
|
@@ -293,7 +293,7 @@ const Je = { 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,
|
|
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 Je = { 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,
|
|
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),
|
|
@@ -320,10 +320,10 @@ const Je = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
320
320
|
s("div", vt, [
|
|
321
321
|
s("span", xt, u(a(n)("media.studio.count")), 1),
|
|
322
322
|
s("div", gt, [
|
|
323
|
-
(m(!0), h(D, null,
|
|
323
|
+
(m(!0), h(D, null, N(a(Le), (d) => (m(), h("button", {
|
|
324
324
|
key: d,
|
|
325
325
|
type: "button",
|
|
326
|
-
class:
|
|
326
|
+
class: V(["flex-1 h-40 rounded-lg border text-sm font-semibold", i(g.value === d)]),
|
|
327
327
|
onClick: (M) => g.value = d
|
|
328
328
|
}, " × " + u(d), 11, yt))), 128))
|
|
329
329
|
])
|
|
@@ -345,7 +345,7 @@ const Je = { 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" },
|
|
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: {},
|
|
@@ -374,8 +374,8 @@ const Je = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
374
374
|
}, null, 8, Tt)
|
|
375
375
|
]),
|
|
376
376
|
s("div", Ct, [
|
|
377
|
-
s("div",
|
|
378
|
-
s("span",
|
|
377
|
+
s("div", Ft, [
|
|
378
|
+
s("span", St, u(a(r)("media.studio.preview")), 1),
|
|
379
379
|
s("button", {
|
|
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",
|
|
@@ -414,13 +414,13 @@ const Je = { 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"],
|
|
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" },
|
|
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,7 +431,7 @@ const Je = { 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(), g = B(!1), w = B(!1), n = B(""), $ = B(null), b = B(null), C =
|
|
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,
|
|
@@ -440,7 +440,7 @@ const Je = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
440
440
|
label: i.asset.fileName
|
|
441
441
|
});
|
|
442
442
|
}
|
|
443
|
-
async function
|
|
443
|
+
async function F(i) {
|
|
444
444
|
var y;
|
|
445
445
|
const o = (y = i.target.files) == null ? void 0 : y[0];
|
|
446
446
|
if (o) {
|
|
@@ -475,7 +475,7 @@ const Je = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
475
475
|
class: "w-48 h-48 rounded object-cover",
|
|
476
476
|
alt: ""
|
|
477
477
|
}, null, 8, Mt)) : U("", !0),
|
|
478
|
-
s("span",
|
|
478
|
+
s("span", Nt, u($.value.label), 1),
|
|
479
479
|
k(y, {
|
|
480
480
|
label: a(v)("media.studio.refClear"),
|
|
481
481
|
variant: "tertiary",
|
|
@@ -483,7 +483,7 @@ const Je = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
483
483
|
onClick: f
|
|
484
484
|
}, null, 8, ["label"])
|
|
485
485
|
])) : (m(), h(D, { key: 1 }, [
|
|
486
|
-
s("div",
|
|
486
|
+
s("div", Vt, [
|
|
487
487
|
k(y, {
|
|
488
488
|
label: a(v)("media.studio.refPick"),
|
|
489
489
|
variant: "tertiary",
|
|
@@ -508,7 +508,7 @@ const Je = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
508
508
|
type: "file",
|
|
509
509
|
accept: "image/jpeg,image/png,image/webp",
|
|
510
510
|
class: "hidden",
|
|
511
|
-
onChange:
|
|
511
|
+
onChange: F
|
|
512
512
|
}, null, 544)
|
|
513
513
|
]),
|
|
514
514
|
s("span", jt, u(a(v)("media.studio.refUploadHint")), 1)
|
|
@@ -535,7 +535,7 @@ const Je = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
535
535
|
{ number: !0 }
|
|
536
536
|
]
|
|
537
537
|
]),
|
|
538
|
-
s("span",
|
|
538
|
+
s("span", Kt, u(C.value), 1)
|
|
539
539
|
])) : U("", !0),
|
|
540
540
|
k(a(pe), {
|
|
541
541
|
open: g.value,
|
|
@@ -543,17 +543,18 @@ const Je = { class: "w-[320px] max-h-screen overflow-auto flex flex-col gap-16 p
|
|
|
543
543
|
"business-id": e.businessId,
|
|
544
544
|
"restaurant-id": e.restaurantId,
|
|
545
545
|
"allow-upload": !1,
|
|
546
|
+
kinds: ["image"],
|
|
546
547
|
onSelect: T
|
|
547
548
|
}, null, 8, ["open", "business-id", "restaurant-id"])
|
|
548
549
|
]);
|
|
549
550
|
};
|
|
550
551
|
}
|
|
551
|
-
}),
|
|
552
|
-
function
|
|
552
|
+
}), Jt = "ai", Qt = "ai-generated";
|
|
553
|
+
function Xt(e) {
|
|
553
554
|
return e === "success" || e === "failed";
|
|
554
555
|
}
|
|
555
556
|
function Z(e) {
|
|
556
|
-
return e.some((x) => !
|
|
557
|
+
return e.some((x) => !Xt(x.status));
|
|
557
558
|
}
|
|
558
559
|
function Zt(e, x) {
|
|
559
560
|
return e.map((t) => {
|
|
@@ -576,7 +577,7 @@ function es(e) {
|
|
|
576
577
|
};
|
|
577
578
|
}
|
|
578
579
|
const ts = 3e3, ss = de("mediaGeneration", () => {
|
|
579
|
-
const e = B([]), x =
|
|
580
|
+
const e = B([]), x = S(() => e.value.some((f) => Z(f.items)));
|
|
580
581
|
let t, l = "";
|
|
581
582
|
function r(f, i) {
|
|
582
583
|
const o = e.value.find((y) => y.batchId === f);
|
|
@@ -623,14 +624,14 @@ const ts = 3e3, ss = de("mediaGeneration", () => {
|
|
|
623
624
|
}
|
|
624
625
|
async function b(f, i, o) {
|
|
625
626
|
var _;
|
|
626
|
-
await ve(f, o.assetId, [
|
|
627
|
+
await ve(f, o.assetId, [Qt]);
|
|
627
628
|
const y = (_ = e.value.find((z) => z.batchId === i.batchId)) == null ? void 0 : _.items.find((z) => z.taskId === o.taskId);
|
|
628
629
|
y && (y.saved = !0);
|
|
629
630
|
}
|
|
630
631
|
async function C(f, i, o) {
|
|
631
632
|
await xe(f, [
|
|
632
633
|
{
|
|
633
|
-
refType:
|
|
634
|
+
refType: Jt,
|
|
634
635
|
refId: i.batchId,
|
|
635
636
|
imageId: o.imageId,
|
|
636
637
|
aspectRatios: null
|
|
@@ -642,32 +643,32 @@ const ts = 3e3, ss = de("mediaGeneration", () => {
|
|
|
642
643
|
function T(f) {
|
|
643
644
|
l = f, x.value && v();
|
|
644
645
|
}
|
|
645
|
-
function
|
|
646
|
+
function F() {
|
|
646
647
|
t !== void 0 && clearTimeout(t), t = void 0, e.value = [];
|
|
647
648
|
}
|
|
648
|
-
return { batches: e, busy: x, compose: w, regenerate: n, variantOf: $, save: b, discard: C, resume: T, reset:
|
|
649
|
+
return { batches: e, busy: x, compose: w, regenerate: n, variantOf: $, save: b, discard: C, resume: T, reset: F };
|
|
649
650
|
}), os = { class: "flex items-start gap-24 p-24" }, as = { class: "flex-1 min-w-0 flex flex-col gap-24" }, ns = {
|
|
650
651
|
key: 0,
|
|
651
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"
|
|
652
653
|
}, is = { class: "text-lg font-semibold" }, ls = { class: "text-sm text-fm-color-typo-secondary" }, fs = /* @__PURE__ */ j({
|
|
653
654
|
__name: "AiStudio",
|
|
654
655
|
setup(e) {
|
|
655
|
-
const x = ue(), { t } = L(), l = me(), r = fe(), v =
|
|
656
|
+
const x = ue(), { t } = L(), l = me(), r = fe(), v = S(() => {
|
|
656
657
|
var p;
|
|
657
658
|
return ((p = x.currentBusiness.value) == null ? void 0 : p.id) ?? "";
|
|
658
|
-
}), g =
|
|
659
|
+
}), g = S(() => {
|
|
659
660
|
var p;
|
|
660
661
|
return (p = x.currentRestaurant.value) == null ? void 0 : p._id;
|
|
661
662
|
}), w = ss(), { batches: n, busy: $ } = ce(w);
|
|
662
663
|
re(() => w.resume(v.value));
|
|
663
|
-
const b = B(""), C = B("photo"), T = B("1x1"),
|
|
664
|
+
const b = B(""), C = B("photo"), T = B("1x1"), F = B(2), f = B(55), i = B(null), o = S(() => !!i.value);
|
|
664
665
|
function y() {
|
|
665
666
|
var p, c, R, P;
|
|
666
667
|
return {
|
|
667
668
|
prompt: b.value,
|
|
668
669
|
style: C.value,
|
|
669
670
|
ratio: T.value,
|
|
670
|
-
count:
|
|
671
|
+
count: F.value,
|
|
671
672
|
refAssetId: (p = i.value) == null ? void 0 : p.refAssetId,
|
|
672
673
|
refRatio: (c = i.value) == null ? void 0 : c.refRatio,
|
|
673
674
|
refTmpToken: (R = i.value) == null ? void 0 : R.refTmpToken,
|
|
@@ -719,7 +720,7 @@ const ts = 3e3, ss = de("mediaGeneration", () => {
|
|
|
719
720
|
l.close();
|
|
720
721
|
});
|
|
721
722
|
}
|
|
722
|
-
async function
|
|
723
|
+
async function Q(p) {
|
|
723
724
|
try {
|
|
724
725
|
await w.variantOf(v.value, p);
|
|
725
726
|
} catch (c) {
|
|
@@ -734,7 +735,7 @@ const ts = 3e3, ss = de("mediaGeneration", () => {
|
|
|
734
735
|
}
|
|
735
736
|
}
|
|
736
737
|
return (p, c) => {
|
|
737
|
-
var P,
|
|
738
|
+
var P, X;
|
|
738
739
|
const R = E("FmIcon");
|
|
739
740
|
return m(), h("div", os, [
|
|
740
741
|
k(kt, {
|
|
@@ -744,15 +745,15 @@ const ts = 3e3, ss = de("mediaGeneration", () => {
|
|
|
744
745
|
"onUpdate:style": c[3] || (c[3] = (I) => C.value = I),
|
|
745
746
|
ratio: T.value,
|
|
746
747
|
"onUpdate:ratio": c[4] || (c[4] = (I) => T.value = I),
|
|
747
|
-
count:
|
|
748
|
-
"onUpdate:count": c[5] || (c[5] = (I) =>
|
|
748
|
+
count: F.value,
|
|
749
|
+
"onUpdate:count": c[5] || (c[5] = (I) => F.value = I),
|
|
749
750
|
class: "flex-shrink-0",
|
|
750
751
|
busy: a($),
|
|
751
752
|
"has-ref": o.value,
|
|
752
753
|
onGenerate: Y
|
|
753
754
|
}, {
|
|
754
755
|
default: te(() => [
|
|
755
|
-
k(
|
|
756
|
+
k(Wt, {
|
|
756
757
|
strength: f.value,
|
|
757
758
|
"onUpdate:strength": c[0] || (c[0] = (I) => f.value = I),
|
|
758
759
|
"business-id": v.value,
|
|
@@ -771,11 +772,11 @@ const ts = 3e3, ss = de("mediaGeneration", () => {
|
|
|
771
772
|
s("span", is, u(a(t)("media.studio.emptyTitle")), 1),
|
|
772
773
|
s("span", ls, u(a(t)("media.studio.emptyHint")), 1)
|
|
773
774
|
])) : U("", !0),
|
|
774
|
-
(m(!0), h(D, null,
|
|
775
|
+
(m(!0), h(D, null, N(a(n), (I) => (m(), G(Ne, {
|
|
775
776
|
key: I.batchId,
|
|
776
777
|
batch: I,
|
|
777
778
|
onRegenerate: (A) => oe(I),
|
|
778
|
-
onVariant: (A) =>
|
|
779
|
+
onVariant: (A) => Q(I),
|
|
779
780
|
onPreview: (A) => d.value = { batch: I, item: A },
|
|
780
781
|
onDiscard: (A) => se(I, A),
|
|
781
782
|
onSave: (A) => M(I, A)
|
|
@@ -783,10 +784,10 @@ const ts = 3e3, ss = de("mediaGeneration", () => {
|
|
|
783
784
|
]),
|
|
784
785
|
k(zt, {
|
|
785
786
|
item: ((P = d.value) == null ? void 0 : P.item) ?? null,
|
|
786
|
-
prompt: ((
|
|
787
|
+
prompt: ((X = d.value) == null ? void 0 : X.batch.params.prompt) ?? "",
|
|
787
788
|
onClose: c[6] || (c[6] = (I) => d.value = null),
|
|
788
789
|
onSave: c[7] || (c[7] = (I) => d.value && M(d.value.batch, d.value.item)),
|
|
789
|
-
onVariant: c[8] || (c[8] = (I) => d.value &&
|
|
790
|
+
onVariant: c[8] || (c[8] = (I) => d.value && Q(d.value.batch))
|
|
790
791
|
}, null, 8, ["item", "prompt"])
|
|
791
792
|
]);
|
|
792
793
|
};
|