@feedmepos/mf-media 0.0.10-dev.3 → 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.
@@ -1,4297 +0,0 @@
1
- import { defineComponent as ce, resolveComponent as j, openBlock as x, createElementBlock as T, toDisplayString as P, unref as O, createElementVNode as b, Fragment as X, renderList as ue, normalizeClass as G, withModifiers as at, createBlock as oe, createCommentVNode as U, createVNode as N, ref as L, withDirectives as Ea, withKeys as Ra, vModelText as Sa, computed as H, withCtx as ke, createTextVNode as he, onScopeDispose as Ta, watch as ye, mergeModels as lt, useModel as Wt } from "vue";
2
- import { useI18n as de, useCoreStore as Ca } from "@feedmepos/mf-common";
3
- import { useDialog as Oa } from "@feedmepos/ui-library";
4
- function Kt(e, t) {
5
- return function() {
6
- return e.apply(t, arguments);
7
- };
8
- }
9
- const { toString: Aa } = Object.prototype, { getPrototypeOf: Se } = Object, { iterator: Ne, toStringTag: Xt } = Symbol, He = (({ hasOwnProperty: e }) => (t, a) => e.call(t, a))(Object.prototype), Fe = (e, t) => {
10
- let a = e;
11
- const n = [];
12
- for (; a != null && a !== Object.prototype; ) {
13
- if (n.indexOf(a) !== -1)
14
- return !1;
15
- if (n.push(a), He(a, t))
16
- return !0;
17
- a = Se(a);
18
- }
19
- return !1;
20
- }, Ba = (e, t) => e != null && Fe(e, t) ? e[t] : void 0, mt = ((e) => (t) => {
21
- const a = Aa.call(t);
22
- return e[a] || (e[a] = a.slice(8, -1).toLowerCase());
23
- })(/* @__PURE__ */ Object.create(null)), se = (e) => (e = e.toLowerCase(), (t) => mt(t) === e), Xe = (e) => (t) => typeof t === e, { isArray: Pe } = Array, Te = Xe("undefined");
24
- function Ce(e) {
25
- return e !== null && !Te(e) && e.constructor !== null && !Te(e.constructor) && ee(e.constructor.isBuffer) && e.constructor.isBuffer(e);
26
- }
27
- const Qt = se("ArrayBuffer");
28
- function _a(e) {
29
- let t;
30
- return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && Qt(e.buffer), t;
31
- }
32
- const Da = Xe("string"), ee = Xe("function"), Yt = Xe("number"), Oe = (e) => e !== null && typeof e == "object", Fa = (e) => e === !0 || e === !1, Ve = (e) => {
33
- if (!Oe(e))
34
- return !1;
35
- const t = Se(e);
36
- return (t === null || t === Object.prototype || Se(t) === null) && // Treat any genuine (non-Object.prototype-polluted) Symbol.toStringTag or
37
- // Symbol.iterator as evidence the value is a tagged/iterable type rather
38
- // than a plain object, while ignoring keys injected onto Object.prototype.
39
- !Fe(e, Xt) && !Fe(e, Ne);
40
- }, Na = (e) => {
41
- if (!Oe(e) || Ce(e))
42
- return !1;
43
- try {
44
- return Object.keys(e).length === 0 && Object.getPrototypeOf(e) === Object.prototype;
45
- } catch {
46
- return !1;
47
- }
48
- }, Ua = se("Date"), La = se("File"), Ia = (e) => !!(e && typeof e.uri < "u"), ja = (e) => e && typeof e.getParts < "u", Ma = se("Blob"), za = se("FileList"), Va = (e) => Oe(e) && ee(e.pipe);
49
- function qa() {
50
- return typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {};
51
- }
52
- const At = qa(), Bt = typeof At.FormData < "u" ? At.FormData : void 0, $a = (e) => {
53
- if (!e)
54
- return !1;
55
- if (Bt && e instanceof Bt)
56
- return !0;
57
- const t = Se(e);
58
- if (!t || t === Object.prototype || !ee(e.append))
59
- return !1;
60
- const a = mt(e);
61
- return a === "formdata" || // detect form-data instance
62
- a === "object" && ee(e.toString) && e.toString() === "[object FormData]";
63
- }, Ga = se("URLSearchParams"), [Ha, Ja, Wa, Ka] = [
64
- "ReadableStream",
65
- "Request",
66
- "Response",
67
- "Headers"
68
- ].map(se), Xa = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
69
- function Ue(e, t, { allOwnKeys: a = !1 } = {}) {
70
- if (e === null || typeof e > "u")
71
- return;
72
- let n, r;
73
- if (typeof e != "object" && (e = [e]), Pe(e))
74
- for (n = 0, r = e.length; n < r; n++)
75
- t.call(null, e[n], n, e);
76
- else {
77
- if (Ce(e))
78
- return;
79
- const o = a ? Object.getOwnPropertyNames(e) : Object.keys(e), s = o.length;
80
- let i;
81
- for (n = 0; n < s; n++)
82
- i = o[n], t.call(null, e[i], i, e);
83
- }
84
- }
85
- function Zt(e, t) {
86
- if (Ce(e))
87
- return null;
88
- t = t.toLowerCase();
89
- const a = Object.keys(e);
90
- let n = a.length, r;
91
- for (; n-- > 0; )
92
- if (r = a[n], t === r.toLowerCase())
93
- return r;
94
- return null;
95
- }
96
- const xe = (() => typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global)(), ea = (e) => !Te(e) && e !== xe;
97
- function ut(...e) {
98
- const { caseless: t, skipUndefined: a } = ea(this) && this || {}, n = {}, r = (o, s) => {
99
- if (s === "__proto__" || s === "constructor" || s === "prototype")
100
- return;
101
- const i = t && typeof s == "string" && Zt(n, s) || s, u = He(n, i) ? n[i] : void 0;
102
- Ve(u) && Ve(o) ? n[i] = ut(u, o) : Ve(o) ? n[i] = ut({}, o) : Pe(o) ? n[i] = o.slice() : (!a || !Te(o)) && (n[i] = o);
103
- };
104
- for (let o = 0, s = e.length; o < s; o++) {
105
- const i = e[o];
106
- if (!i || Ce(i) || (Ue(i, r), typeof i != "object" || Pe(i)))
107
- continue;
108
- const u = Object.getOwnPropertySymbols(i);
109
- for (let c = 0; c < u.length; c++) {
110
- const d = u[c];
111
- un.call(i, d) && r(i[d], d);
112
- }
113
- }
114
- return n;
115
- }
116
- const Qa = (e, t, a, { allOwnKeys: n } = {}) => (Ue(
117
- t,
118
- (r, o) => {
119
- a && ee(r) ? Object.defineProperty(e, o, {
120
- // Null-proto descriptor so a polluted Object.prototype.get cannot
121
- // hijack defineProperty's accessor-vs-data resolution.
122
- __proto__: null,
123
- value: Kt(r, a),
124
- writable: !0,
125
- enumerable: !0,
126
- configurable: !0
127
- }) : Object.defineProperty(e, o, {
128
- __proto__: null,
129
- value: r,
130
- writable: !0,
131
- enumerable: !0,
132
- configurable: !0
133
- });
134
- },
135
- { allOwnKeys: n }
136
- ), e), Ya = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), Za = (e, t, a, n) => {
137
- e.prototype = Object.create(t.prototype, n), Object.defineProperty(e.prototype, "constructor", {
138
- __proto__: null,
139
- value: e,
140
- writable: !0,
141
- enumerable: !1,
142
- configurable: !0
143
- }), Object.defineProperty(e, "super", {
144
- __proto__: null,
145
- value: t.prototype
146
- }), a && Object.assign(e.prototype, a);
147
- }, en = (e, t, a, n) => {
148
- let r, o, s;
149
- const i = {};
150
- if (t = t || {}, e == null)
151
- return t;
152
- do {
153
- for (r = Object.getOwnPropertyNames(e), o = r.length; o-- > 0; )
154
- s = r[o], (!n || n(s, e, t)) && !i[s] && (t[s] = e[s], i[s] = !0);
155
- e = a !== !1 && Se(e);
156
- } while (e && (!a || a(e, t)) && e !== Object.prototype);
157
- return t;
158
- }, tn = (e, t, a) => {
159
- e = String(e), (a === void 0 || a > e.length) && (a = e.length), a -= t.length;
160
- const n = e.indexOf(t, a);
161
- return n !== -1 && n === a;
162
- }, an = (e) => {
163
- if (!e)
164
- return null;
165
- if (Pe(e))
166
- return e;
167
- let t = e.length;
168
- if (!Yt(t))
169
- return null;
170
- const a = new Array(t);
171
- for (; t-- > 0; )
172
- a[t] = e[t];
173
- return a;
174
- }, nn = ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && Se(Uint8Array)), rn = (e, t) => {
175
- const a = (e && e[Ne]).call(e);
176
- let n;
177
- for (; (n = a.next()) && !n.done; ) {
178
- const r = n.value;
179
- t.call(e, r[0], r[1]);
180
- }
181
- }, on = (e, t) => {
182
- let a;
183
- const n = [];
184
- for (; (a = e.exec(t)) !== null; )
185
- n.push(a);
186
- return n;
187
- }, sn = se("HTMLFormElement"), ln = (e) => e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function(t, a, n) {
188
- return a.toUpperCase() + n;
189
- }), { propertyIsEnumerable: un } = Object.prototype, cn = se("RegExp"), ta = (e, t) => {
190
- const a = Object.getOwnPropertyDescriptors(e), n = {};
191
- Ue(a, (r, o) => {
192
- let s;
193
- (s = t(r, o, e)) !== !1 && (n[o] = s || r);
194
- }), Object.defineProperties(e, n);
195
- }, dn = (e) => {
196
- ta(e, (t, a) => {
197
- if (ee(e) && ["arguments", "caller", "callee"].includes(a))
198
- return !1;
199
- const n = e[a];
200
- if (ee(n)) {
201
- if (t.enumerable = !1, "writable" in t) {
202
- t.writable = !1;
203
- return;
204
- }
205
- t.set || (t.set = () => {
206
- throw Error("Can not rewrite read-only method '" + a + "'");
207
- });
208
- }
209
- });
210
- }, pn = (e, t) => {
211
- const a = {}, n = (r) => {
212
- r.forEach((o) => {
213
- a[o] = !0;
214
- });
215
- };
216
- return Pe(e) ? n(e) : n(String(e).split(t)), a;
217
- }, fn = () => {
218
- }, mn = (e, t) => e != null && Number.isFinite(e = +e) ? e : t;
219
- function gn(e) {
220
- return !!(e && ee(e.append) && e[Xt] === "FormData" && e[Ne]);
221
- }
222
- const hn = (e) => {
223
- const t = /* @__PURE__ */ new WeakSet(), a = (n) => {
224
- if (Oe(n)) {
225
- if (t.has(n))
226
- return;
227
- if (Ce(n))
228
- return n;
229
- if (!("toJSON" in n)) {
230
- t.add(n);
231
- const r = Pe(n) ? [] : {};
232
- return Ue(n, (o, s) => {
233
- const i = a(o);
234
- !Te(i) && (r[s] = i);
235
- }), t.delete(n), r;
236
- }
237
- }
238
- return n;
239
- };
240
- return a(e);
241
- }, bn = se("AsyncFunction"), yn = (e) => e && (Oe(e) || ee(e)) && ee(e.then) && ee(e.catch), aa = ((e, t) => e ? setImmediate : t ? ((a, n) => (xe.addEventListener(
242
- "message",
243
- ({ source: r, data: o }) => {
244
- r === xe && o === a && n.length && n.shift()();
245
- },
246
- !1
247
- ), (r) => {
248
- n.push(r), xe.postMessage(a, "*");
249
- }))(`axios@${Math.random()}`, []) : (a) => setTimeout(a))(typeof setImmediate == "function", ee(xe.postMessage)), vn = typeof queueMicrotask < "u" ? queueMicrotask.bind(xe) : typeof process < "u" && process.nextTick || aa, na = (e) => e != null && ee(e[Ne]), wn = (e) => e != null && Fe(e, Ne) && na(e), l = {
250
- isArray: Pe,
251
- isArrayBuffer: Qt,
252
- isBuffer: Ce,
253
- isFormData: $a,
254
- isArrayBufferView: _a,
255
- isString: Da,
256
- isNumber: Yt,
257
- isBoolean: Fa,
258
- isObject: Oe,
259
- isPlainObject: Ve,
260
- isEmptyObject: Na,
261
- isReadableStream: Ha,
262
- isRequest: Ja,
263
- isResponse: Wa,
264
- isHeaders: Ka,
265
- isUndefined: Te,
266
- isDate: Ua,
267
- isFile: La,
268
- isReactNativeBlob: Ia,
269
- isReactNative: ja,
270
- isBlob: Ma,
271
- isRegExp: cn,
272
- isFunction: ee,
273
- isStream: Va,
274
- isURLSearchParams: Ga,
275
- isTypedArray: nn,
276
- isFileList: za,
277
- forEach: Ue,
278
- merge: ut,
279
- extend: Qa,
280
- trim: Xa,
281
- stripBOM: Ya,
282
- inherits: Za,
283
- toFlatObject: en,
284
- kindOf: mt,
285
- kindOfTest: se,
286
- endsWith: tn,
287
- toArray: an,
288
- forEachEntry: rn,
289
- matchAll: on,
290
- isHTMLForm: sn,
291
- hasOwnProperty: He,
292
- hasOwnProp: He,
293
- // an alias to avoid ESLint no-prototype-builtins detection
294
- hasOwnInPrototypeChain: Fe,
295
- getSafeProp: Ba,
296
- reduceDescriptors: ta,
297
- freezeMethods: dn,
298
- toObjectSet: pn,
299
- toCamelCase: ln,
300
- noop: fn,
301
- toFiniteNumber: mn,
302
- findKey: Zt,
303
- global: xe,
304
- isContextDefined: ea,
305
- isSpecCompliantForm: gn,
306
- toJSONObject: hn,
307
- isAsyncFn: bn,
308
- isThenable: yn,
309
- setImmediate: aa,
310
- asap: vn,
311
- isIterable: na,
312
- isSafeIterable: wn
313
- }, xn = l.toObjectSet([
314
- "age",
315
- "authorization",
316
- "content-length",
317
- "content-type",
318
- "etag",
319
- "expires",
320
- "from",
321
- "host",
322
- "if-modified-since",
323
- "if-unmodified-since",
324
- "last-modified",
325
- "location",
326
- "max-forwards",
327
- "proxy-authorization",
328
- "referer",
329
- "retry-after",
330
- "user-agent"
331
- ]), kn = (e) => {
332
- const t = {};
333
- let a, n, r;
334
- return e && e.split(`
335
- `).forEach(function(o) {
336
- r = o.indexOf(":"), a = o.substring(0, r).trim().toLowerCase(), n = o.substring(r + 1).trim(), !(!a || t[a] && xn[a]) && (a === "set-cookie" ? t[a] ? t[a].push(n) : t[a] = [n] : t[a] = t[a] ? t[a] + ", " + n : n);
337
- }), t;
338
- };
339
- function Pn(e) {
340
- let t = 0, a = e.length;
341
- for (; t < a; ) {
342
- const n = e.charCodeAt(t);
343
- if (n !== 9 && n !== 32)
344
- break;
345
- t += 1;
346
- }
347
- for (; a > t; ) {
348
- const n = e.charCodeAt(a - 1);
349
- if (n !== 9 && n !== 32)
350
- break;
351
- a -= 1;
352
- }
353
- return t === 0 && a === e.length ? e : e.slice(t, a);
354
- }
355
- const En = new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+", "g"), Rn = new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+", "g");
356
- function gt(e, t) {
357
- return l.isArray(e) ? e.map((a) => gt(a, t)) : Pn(String(e).replace(t, ""));
358
- }
359
- const Sn = (e) => gt(e, En), Tn = (e) => gt(e, Rn);
360
- function ra(e) {
361
- const t = /* @__PURE__ */ Object.create(null);
362
- return l.forEach(e.toJSON(), (a, n) => {
363
- t[n] = Tn(a);
364
- }), t;
365
- }
366
- const _t = Symbol("internals");
367
- function De(e) {
368
- return e && String(e).trim().toLowerCase();
369
- }
370
- function qe(e) {
371
- return e === !1 || e == null ? e : l.isArray(e) ? e.map(qe) : Sn(String(e));
372
- }
373
- function Cn(e) {
374
- const t = /* @__PURE__ */ Object.create(null), a = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
375
- let n;
376
- for (; n = a.exec(e); )
377
- t[n[1]] = n[2];
378
- return t;
379
- }
380
- const On = (e) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());
381
- function nt(e, t, a, n, r) {
382
- if (l.isFunction(n))
383
- return n.call(this, t, a);
384
- if (r && (t = a), !!l.isString(t)) {
385
- if (l.isString(n))
386
- return t.indexOf(n) !== -1;
387
- if (l.isRegExp(n))
388
- return n.test(t);
389
- }
390
- }
391
- function An(e) {
392
- return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (t, a, n) => a.toUpperCase() + n);
393
- }
394
- function Bn(e, t) {
395
- const a = l.toCamelCase(" " + t);
396
- ["get", "set", "has"].forEach((n) => {
397
- Object.defineProperty(e, n + a, {
398
- // Null-proto descriptor so a polluted Object.prototype.get cannot turn
399
- // this data descriptor into an accessor descriptor on the way in.
400
- __proto__: null,
401
- value: function(r, o, s) {
402
- return this[n].call(this, t, r, o, s);
403
- },
404
- configurable: !0
405
- });
406
- });
407
- }
408
- class Qe {
409
- constructor(t) {
410
- t && this.set(t);
411
- }
412
- set(t, a, n) {
413
- const r = this;
414
- function o(i, u, c) {
415
- const d = De(u);
416
- if (!d)
417
- return;
418
- const p = l.findKey(r, d);
419
- (!p || r[p] === void 0 || c === !0 || c === void 0 && r[p] !== !1) && (r[p || u] = qe(i));
420
- }
421
- const s = (i, u) => l.forEach(i, (c, d) => o(c, d, u));
422
- if (l.isPlainObject(t) || t instanceof this.constructor)
423
- s(t, a);
424
- else if (l.isString(t) && (t = t.trim()) && !On(t))
425
- s(kn(t), a);
426
- else if (l.isObject(t) && l.isSafeIterable(t)) {
427
- let i = /* @__PURE__ */ Object.create(null), u, c;
428
- for (const d of t) {
429
- if (!l.isArray(d))
430
- throw new TypeError("Object iterator must return a key-value pair");
431
- c = d[0], l.hasOwnProp(i, c) ? (u = i[c], i[c] = l.isArray(u) ? [...u, d[1]] : [u, d[1]]) : i[c] = d[1];
432
- }
433
- s(i, a);
434
- } else
435
- t != null && o(a, t, n);
436
- return this;
437
- }
438
- get(t, a) {
439
- if (t = De(t), t) {
440
- const n = l.findKey(this, t);
441
- if (n) {
442
- const r = this[n];
443
- if (!a)
444
- return r;
445
- if (a === !0)
446
- return Cn(r);
447
- if (l.isFunction(a))
448
- return a.call(this, r, n);
449
- if (l.isRegExp(a))
450
- return a.exec(r);
451
- throw new TypeError("parser must be boolean|regexp|function");
452
- }
453
- }
454
- }
455
- has(t, a) {
456
- if (t = De(t), t) {
457
- const n = l.findKey(this, t);
458
- return !!(n && this[n] !== void 0 && (!a || nt(this, this[n], n, a)));
459
- }
460
- return !1;
461
- }
462
- delete(t, a) {
463
- const n = this;
464
- let r = !1;
465
- function o(s) {
466
- if (s = De(s), s) {
467
- const i = l.findKey(n, s);
468
- i && (!a || nt(n, n[i], i, a)) && (delete n[i], r = !0);
469
- }
470
- }
471
- return l.isArray(t) ? t.forEach(o) : o(t), r;
472
- }
473
- clear(t) {
474
- const a = Object.keys(this);
475
- let n = a.length, r = !1;
476
- for (; n--; ) {
477
- const o = a[n];
478
- (!t || nt(this, this[o], o, t, !0)) && (delete this[o], r = !0);
479
- }
480
- return r;
481
- }
482
- normalize(t) {
483
- const a = this, n = {};
484
- return l.forEach(this, (r, o) => {
485
- const s = l.findKey(n, o);
486
- if (s) {
487
- a[s] = qe(r), delete a[o];
488
- return;
489
- }
490
- const i = t ? An(o) : String(o).trim();
491
- i !== o && delete a[o], a[i] = qe(r), n[i] = !0;
492
- }), this;
493
- }
494
- concat(...t) {
495
- return this.constructor.concat(this, ...t);
496
- }
497
- toJSON(t) {
498
- const a = /* @__PURE__ */ Object.create(null);
499
- return l.forEach(this, (n, r) => {
500
- n != null && n !== !1 && (a[r] = t && l.isArray(n) ? n.join(", ") : n);
501
- }), a;
502
- }
503
- [Symbol.iterator]() {
504
- return Object.entries(this.toJSON())[Symbol.iterator]();
505
- }
506
- toString() {
507
- return Object.entries(this.toJSON()).map(([t, a]) => t + ": " + a).join(`
508
- `);
509
- }
510
- getSetCookie() {
511
- return this.get("set-cookie") || [];
512
- }
513
- get [Symbol.toStringTag]() {
514
- return "AxiosHeaders";
515
- }
516
- static from(t) {
517
- return t instanceof this ? t : new this(t);
518
- }
519
- static concat(t, ...a) {
520
- const n = new this(t);
521
- return a.forEach((r) => n.set(r)), n;
522
- }
523
- static accessor(t) {
524
- const a = (this[_t] = this[_t] = {
525
- accessors: {}
526
- }).accessors, n = this.prototype;
527
- function r(o) {
528
- const s = De(o);
529
- a[s] || (Bn(n, o), a[s] = !0);
530
- }
531
- return l.isArray(t) ? t.forEach(r) : r(t), this;
532
- }
533
- }
534
- Qe.accessor([
535
- "Content-Type",
536
- "Content-Length",
537
- "Accept",
538
- "Accept-Encoding",
539
- "User-Agent",
540
- "Authorization"
541
- ]);
542
- l.reduceDescriptors(Qe.prototype, ({ value: e }, t) => {
543
- let a = t[0].toUpperCase() + t.slice(1);
544
- return {
545
- get: () => e,
546
- set(n) {
547
- this[a] = n;
548
- }
549
- };
550
- });
551
- l.freezeMethods(Qe);
552
- const ae = Qe, _n = "[REDACTED ****]";
553
- function Dn(e) {
554
- if (l.hasOwnProp(e, "toJSON"))
555
- return !0;
556
- let t = Object.getPrototypeOf(e);
557
- for (; t && t !== Object.prototype; ) {
558
- if (l.hasOwnProp(t, "toJSON"))
559
- return !0;
560
- t = Object.getPrototypeOf(t);
561
- }
562
- return !1;
563
- }
564
- function Fn(e, t) {
565
- const a = new Set(t.map((o) => String(o).toLowerCase())), n = [], r = (o) => {
566
- if (o === null || typeof o != "object" || l.isBuffer(o))
567
- return o;
568
- if (n.indexOf(o) !== -1)
569
- return;
570
- o instanceof ae && (o = o.toJSON()), n.push(o);
571
- let s;
572
- if (l.isArray(o))
573
- s = [], o.forEach((i, u) => {
574
- const c = r(i);
575
- l.isUndefined(c) || (s[u] = c);
576
- });
577
- else {
578
- if (!l.isPlainObject(o) && Dn(o))
579
- return n.pop(), o;
580
- s = /* @__PURE__ */ Object.create(null);
581
- for (const [i, u] of Object.entries(o)) {
582
- const c = a.has(i.toLowerCase()) ? _n : r(u);
583
- l.isUndefined(c) || (s[i] = c);
584
- }
585
- }
586
- return n.pop(), s;
587
- };
588
- return r(e);
589
- }
590
- class W extends Error {
591
- static from(t, a, n, r, o, s) {
592
- const i = new W(t.message, a || t.code, n, r, o);
593
- return Object.defineProperty(i, "cause", {
594
- __proto__: null,
595
- value: t,
596
- writable: !0,
597
- enumerable: !1,
598
- configurable: !0
599
- }), i.name = t.name, t.status != null && i.status == null && (i.status = t.status), s && Object.assign(i, s), i;
600
- }
601
- /**
602
- * Create an Error with the specified message, config, error code, request and response.
603
- *
604
- * @param {string} message The error message.
605
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
606
- * @param {Object} [config] The config.
607
- * @param {Object} [request] The request.
608
- * @param {Object} [response] The response.
609
- *
610
- * @returns {Error} The created error.
611
- */
612
- constructor(t, a, n, r, o) {
613
- super(t), Object.defineProperty(this, "message", {
614
- // Null-proto descriptor so a polluted Object.prototype.get cannot turn
615
- // this data descriptor into an accessor descriptor on the way in.
616
- __proto__: null,
617
- value: t,
618
- enumerable: !0,
619
- writable: !0,
620
- configurable: !0
621
- }), this.name = "AxiosError", this.isAxiosError = !0, a && (this.code = a), n && (this.config = n), r && (this.request = r), o && (this.response = o, this.status = o.status);
622
- }
623
- toJSON() {
624
- const t = this.config, a = t && l.hasOwnProp(t, "redact") ? t.redact : void 0, n = l.isArray(a) && a.length > 0 ? Fn(t, a) : l.toJSONObject(t);
625
- return {
626
- // Standard
627
- message: this.message,
628
- name: this.name,
629
- // Microsoft
630
- description: this.description,
631
- number: this.number,
632
- // Mozilla
633
- fileName: this.fileName,
634
- lineNumber: this.lineNumber,
635
- columnNumber: this.columnNumber,
636
- stack: this.stack,
637
- // Axios
638
- config: n,
639
- code: this.code,
640
- status: this.status
641
- };
642
- }
643
- }
644
- W.ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
645
- W.ERR_BAD_OPTION = "ERR_BAD_OPTION";
646
- W.ECONNABORTED = "ECONNABORTED";
647
- W.ETIMEDOUT = "ETIMEDOUT";
648
- W.ECONNREFUSED = "ECONNREFUSED";
649
- W.ERR_NETWORK = "ERR_NETWORK";
650
- W.ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";
651
- W.ERR_DEPRECATED = "ERR_DEPRECATED";
652
- W.ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";
653
- W.ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
654
- W.ERR_CANCELED = "ERR_CANCELED";
655
- W.ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
656
- W.ERR_INVALID_URL = "ERR_INVALID_URL";
657
- W.ERR_FORM_DATA_DEPTH_EXCEEDED = "ERR_FORM_DATA_DEPTH_EXCEEDED";
658
- const S = W, Nn = null, oa = 100;
659
- function ct(e) {
660
- return l.isPlainObject(e) || l.isArray(e);
661
- }
662
- function sa(e) {
663
- return l.endsWith(e, "[]") ? e.slice(0, -2) : e;
664
- }
665
- function rt(e, t, a) {
666
- return e ? e.concat(t).map(function(n, r) {
667
- return n = sa(n), !a && r ? "[" + n + "]" : n;
668
- }).join(a ? "." : "") : t;
669
- }
670
- function Un(e) {
671
- return l.isArray(e) && !e.some(ct);
672
- }
673
- const Ln = l.toFlatObject(l, {}, null, function(e) {
674
- return /^is[A-Z]/.test(e);
675
- });
676
- function Ye(e, t, a) {
677
- if (!l.isObject(e))
678
- throw new TypeError("target must be an object");
679
- t = t || new FormData(), a = l.toFlatObject(
680
- a,
681
- {
682
- metaTokens: !0,
683
- dots: !1,
684
- indexes: !1
685
- },
686
- !1,
687
- function(f, g) {
688
- return !l.isUndefined(g[f]);
689
- }
690
- );
691
- const n = a.metaTokens, r = a.visitor || h, o = a.dots, s = a.indexes, i = a.Blob || typeof Blob < "u" && Blob, u = a.maxDepth === void 0 ? oa : a.maxDepth, c = i && l.isSpecCompliantForm(t), d = [];
692
- if (!l.isFunction(r))
693
- throw new TypeError("visitor must be a function");
694
- function p(f) {
695
- if (f === null)
696
- return "";
697
- if (l.isDate(f))
698
- return f.toISOString();
699
- if (l.isBoolean(f))
700
- return f.toString();
701
- if (!c && l.isBlob(f))
702
- throw new S("Blob is not supported. Use a Buffer instead.");
703
- if (l.isArrayBuffer(f) || l.isTypedArray(f)) {
704
- if (c && typeof i == "function")
705
- return new i([f]);
706
- if (typeof Buffer < "u")
707
- return Buffer.from(f);
708
- throw new S("Blob is not supported. Use a Buffer instead.", S.ERR_NOT_SUPPORT);
709
- }
710
- return f;
711
- }
712
- function v(f) {
713
- if (f > u)
714
- throw new S(
715
- "Object is too deeply nested (" + f + " levels). Max depth: " + u,
716
- S.ERR_FORM_DATA_DEPTH_EXCEEDED
717
- );
718
- }
719
- function k(f, g) {
720
- if (u === 1 / 0)
721
- return JSON.stringify(f);
722
- const m = [];
723
- return JSON.stringify(f, function(C, B) {
724
- if (!l.isObject(B))
725
- return B;
726
- for (; m.length && m[m.length - 1] !== this; )
727
- m.pop();
728
- return m.push(B), v(g + m.length - 1), B;
729
- });
730
- }
731
- function h(f, g, m) {
732
- let C = f;
733
- if (l.isReactNative(t) && l.isReactNativeBlob(f))
734
- return t.append(rt(m, g, o), p(f)), !1;
735
- if (f && !m && typeof f == "object") {
736
- if (l.endsWith(g, "{}"))
737
- g = n ? g : g.slice(0, -2), f = k(f, 1);
738
- else if (l.isArray(f) && Un(f) || (l.isFileList(f) || l.endsWith(g, "[]")) && (C = l.toArray(f)))
739
- return g = sa(g), C.forEach(function(B, y) {
740
- !(l.isUndefined(B) || B === null) && t.append(
741
- // eslint-disable-next-line no-nested-ternary
742
- s === !0 ? rt([g], y, o) : s === null ? g : g + "[]",
743
- p(B)
744
- );
745
- }), !1;
746
- }
747
- return ct(f) ? !0 : (t.append(rt(m, g, o), p(f)), !1);
748
- }
749
- const w = Object.assign(Ln, {
750
- defaultVisitor: h,
751
- convertValue: p,
752
- isVisitable: ct
753
- });
754
- function D(f, g, m = 0) {
755
- if (!l.isUndefined(f)) {
756
- if (v(m), d.indexOf(f) !== -1)
757
- throw new Error("Circular reference detected in " + g.join("."));
758
- d.push(f), l.forEach(f, function(C, B) {
759
- (!(l.isUndefined(C) || C === null) && r.call(t, C, l.isString(B) ? B.trim() : B, g, w)) === !0 && D(C, g ? g.concat(B) : [B], m + 1);
760
- }), d.pop();
761
- }
762
- }
763
- if (!l.isObject(e))
764
- throw new TypeError("data must be an object");
765
- return D(e), t;
766
- }
767
- function Dt(e) {
768
- const t = {
769
- "!": "%21",
770
- "'": "%27",
771
- "(": "%28",
772
- ")": "%29",
773
- "~": "%7E",
774
- "%20": "+"
775
- };
776
- return encodeURIComponent(e).replace(/[!'()~]|%20/g, function(a) {
777
- return t[a];
778
- });
779
- }
780
- function ht(e, t) {
781
- this._pairs = [], e && Ye(e, this, t);
782
- }
783
- const ia = ht.prototype;
784
- ia.append = function(e, t) {
785
- this._pairs.push([e, t]);
786
- };
787
- ia.toString = function(e) {
788
- const t = e ? (a) => e.call(this, a, Dt) : Dt;
789
- return this._pairs.map(function(a) {
790
- return t(a[0]) + "=" + t(a[1]);
791
- }, "").join("&");
792
- };
793
- function In(e) {
794
- return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
795
- }
796
- function la(e, t, a) {
797
- if (!t)
798
- return e;
799
- e = e || "";
800
- const n = l.isFunction(a) ? {
801
- serialize: a
802
- } : a, r = l.getSafeProp(n, "encode") || In, o = l.getSafeProp(n, "serialize");
803
- let s;
804
- if (o ? s = o(t, n) : s = l.isURLSearchParams(t) ? t.toString() : new ht(t, n).toString(r), s) {
805
- const i = e.indexOf("#");
806
- i !== -1 && (e = e.slice(0, i)), e += (e.indexOf("?") === -1 ? "?" : "&") + s;
807
- }
808
- return e;
809
- }
810
- class jn {
811
- constructor() {
812
- this.handlers = [];
813
- }
814
- /**
815
- * Add a new interceptor to the stack
816
- *
817
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
818
- * @param {Function} rejected The function to handle `reject` for a `Promise`
819
- * @param {Object} options The options for the interceptor, synchronous and runWhen
820
- *
821
- * @return {Number} An ID used to remove interceptor later
822
- */
823
- use(t, a, n) {
824
- return this.handlers.push({
825
- fulfilled: t,
826
- rejected: a,
827
- synchronous: n ? n.synchronous : !1,
828
- runWhen: n ? n.runWhen : null
829
- }), this.handlers.length - 1;
830
- }
831
- /**
832
- * Remove an interceptor from the stack
833
- *
834
- * @param {Number} id The ID that was returned by `use`
835
- *
836
- * @returns {void}
837
- */
838
- eject(t) {
839
- this.handlers[t] && (this.handlers[t] = null);
840
- }
841
- /**
842
- * Clear all interceptors from the stack
843
- *
844
- * @returns {void}
845
- */
846
- clear() {
847
- this.handlers && (this.handlers = []);
848
- }
849
- /**
850
- * Iterate over all the registered interceptors
851
- *
852
- * This method is particularly useful for skipping over any
853
- * interceptors that may have become `null` calling `eject`.
854
- *
855
- * @param {Function} fn The function to call for each interceptor
856
- *
857
- * @returns {void}
858
- */
859
- forEach(t) {
860
- l.forEach(this.handlers, function(a) {
861
- a !== null && t(a);
862
- });
863
- }
864
- }
865
- const Ft = jn, bt = {
866
- silentJSONParsing: !0,
867
- forcedJSONParsing: !0,
868
- clarifyTimeoutError: !1,
869
- legacyInterceptorReqResOrdering: !0,
870
- advertiseZstdAcceptEncoding: !1,
871
- validateStatusUndefinedResolves: !0
872
- }, Mn = typeof URLSearchParams < "u" ? URLSearchParams : ht, zn = typeof FormData < "u" ? FormData : null, Vn = typeof Blob < "u" ? Blob : null, qn = {
873
- isBrowser: !0,
874
- classes: {
875
- URLSearchParams: Mn,
876
- FormData: zn,
877
- Blob: Vn
878
- },
879
- protocols: ["http", "https", "file", "blob", "url", "data"]
880
- }, yt = typeof window < "u" && typeof document < "u", dt = typeof navigator == "object" && navigator || void 0, $n = yt && (!dt || ["ReactNative", "NativeScript", "NS"].indexOf(dt.product) < 0), Gn = (() => typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
881
- self instanceof WorkerGlobalScope && typeof self.importScripts == "function")(), Hn = yt && window.location.href || "http://localhost", Jn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
882
- __proto__: null,
883
- hasBrowserEnv: yt,
884
- hasStandardBrowserEnv: $n,
885
- hasStandardBrowserWebWorkerEnv: Gn,
886
- navigator: dt,
887
- origin: Hn
888
- }, Symbol.toStringTag, { value: "Module" })), J = {
889
- ...Jn,
890
- ...qn
891
- };
892
- function Wn(e, t) {
893
- return Ye(e, new J.classes.URLSearchParams(), {
894
- visitor: function(a, n, r, o) {
895
- return J.isNode && l.isBuffer(a) ? (this.append(n, a.toString("base64")), !1) : o.defaultVisitor.apply(this, arguments);
896
- },
897
- ...t
898
- });
899
- }
900
- const Nt = oa;
901
- function ua(e) {
902
- if (e > Nt)
903
- throw new S(
904
- "FormData field is too deeply nested (" + e + " levels). Max depth: " + Nt,
905
- S.ERR_FORM_DATA_DEPTH_EXCEEDED
906
- );
907
- }
908
- function Kn(e) {
909
- const t = [], a = /\w+|\[(\w*)]/g;
910
- let n;
911
- for (; (n = a.exec(e)) !== null; )
912
- ua(t.length), t.push(n[0] === "[]" ? "" : n[1] || n[0]);
913
- return t;
914
- }
915
- function Xn(e) {
916
- const t = {}, a = Object.keys(e);
917
- let n;
918
- const r = a.length;
919
- let o;
920
- for (n = 0; n < r; n++)
921
- o = a[n], t[o] = e[o];
922
- return t;
923
- }
924
- function ca(e) {
925
- function t(a, n, r, o) {
926
- ua(o);
927
- let s = a[o++];
928
- if (s === "__proto__")
929
- return !0;
930
- const i = Number.isFinite(+s), u = o >= a.length;
931
- return s = !s && l.isArray(r) ? r.length : s, u ? (l.hasOwnProp(r, s) ? r[s] = l.isArray(r[s]) ? r[s].concat(n) : [r[s], n] : r[s] = n, !i) : ((!l.hasOwnProp(r, s) || !l.isObject(r[s])) && (r[s] = []), t(a, n, r[s], o) && l.isArray(r[s]) && (r[s] = Xn(r[s])), !i);
932
- }
933
- if (l.isFormData(e) && l.isFunction(e.entries)) {
934
- const a = {};
935
- return l.forEachEntry(e, (n, r) => {
936
- t(Kn(n), r, a, 0);
937
- }), a;
938
- }
939
- return null;
940
- }
941
- const Re = (e, t) => e != null && l.hasOwnProp(e, t) ? e[t] : void 0;
942
- function Qn(e, t, a) {
943
- if (l.isString(e))
944
- try {
945
- return (t || JSON.parse)(e), l.trim(e);
946
- } catch (n) {
947
- if (n.name !== "SyntaxError")
948
- throw n;
949
- }
950
- return (a || JSON.stringify)(e);
951
- }
952
- const vt = {
953
- transitional: bt,
954
- adapter: ["xhr", "http", "fetch"],
955
- transformRequest: [
956
- function(e, t) {
957
- const a = t.getContentType() || "", n = a.indexOf("application/json") > -1, r = l.isObject(e);
958
- if (r && l.isHTMLForm(e) && (e = new FormData(e)), l.isFormData(e))
959
- return n ? JSON.stringify(ca(e)) : e;
960
- if (l.isArrayBuffer(e) || l.isBuffer(e) || l.isStream(e) || l.isFile(e) || l.isBlob(e) || l.isReadableStream(e))
961
- return e;
962
- if (l.isArrayBufferView(e))
963
- return e.buffer;
964
- if (l.isURLSearchParams(e))
965
- return t.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), e.toString();
966
- let o;
967
- if (r) {
968
- const s = Re(this, "formSerializer");
969
- if (a.indexOf("application/x-www-form-urlencoded") > -1)
970
- return Wn(e, s).toString();
971
- if ((o = l.isFileList(e)) || a.indexOf("multipart/form-data") > -1) {
972
- const i = Re(this, "env"), u = i && i.FormData;
973
- return Ye(
974
- o ? { "files[]": e } : e,
975
- u && new u(),
976
- s
977
- );
978
- }
979
- }
980
- return r || n ? (t.setContentType("application/json", !1), Qn(e)) : e;
981
- }
982
- ],
983
- transformResponse: [
984
- function(e) {
985
- const t = Re(this, "transitional") || vt.transitional, a = t && t.forcedJSONParsing, n = Re(this, "responseType"), r = n === "json";
986
- if (l.isResponse(e) || l.isReadableStream(e))
987
- return e;
988
- if (e && l.isString(e) && (a && !n || r)) {
989
- const o = !(t && t.silentJSONParsing) && r;
990
- try {
991
- return JSON.parse(e, Re(this, "parseReviver"));
992
- } catch (s) {
993
- if (o)
994
- throw s.name === "SyntaxError" ? S.from(s, S.ERR_BAD_RESPONSE, this, null, Re(this, "response")) : s;
995
- }
996
- }
997
- return e;
998
- }
999
- ],
1000
- /**
1001
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
1002
- * timeout is not created.
1003
- */
1004
- timeout: 0,
1005
- xsrfCookieName: "XSRF-TOKEN",
1006
- xsrfHeaderName: "X-XSRF-TOKEN",
1007
- maxContentLength: -1,
1008
- maxBodyLength: -1,
1009
- env: {
1010
- FormData: J.classes.FormData,
1011
- Blob: J.classes.Blob
1012
- },
1013
- validateStatus: function(e) {
1014
- return e >= 200 && e < 300;
1015
- },
1016
- headers: {
1017
- common: {
1018
- Accept: "application/json, text/plain, */*",
1019
- "Content-Type": void 0
1020
- }
1021
- }
1022
- };
1023
- l.forEach(["delete", "get", "head", "post", "put", "patch", "query"], (e) => {
1024
- vt.headers[e] = {};
1025
- });
1026
- const wt = vt;
1027
- function ot(e, t) {
1028
- const a = this || wt, n = t || a, r = ae.from(n.headers);
1029
- let o = n.data;
1030
- return l.forEach(e, function(s) {
1031
- o = s.call(a, o, r.normalize(), t ? t.status : void 0);
1032
- }), r.normalize(), o;
1033
- }
1034
- function da(e) {
1035
- return !!(e && e.__CANCEL__);
1036
- }
1037
- class Yn extends S {
1038
- /**
1039
- * A `CanceledError` is an object that is thrown when an operation is canceled.
1040
- *
1041
- * @param {string=} message The message.
1042
- * @param {Object=} config The config.
1043
- * @param {Object=} request The request.
1044
- *
1045
- * @returns {CanceledError} The created error.
1046
- */
1047
- constructor(t, a, n) {
1048
- super(t ?? "canceled", S.ERR_CANCELED, a, n), this.name = "CanceledError", this.__CANCEL__ = !0;
1049
- }
1050
- }
1051
- const Le = Yn;
1052
- function pa(e, t, a) {
1053
- const n = a.config.validateStatus;
1054
- !a.status || !n || n(a.status) ? e(a) : t(new S(
1055
- "Request failed with status code " + a.status,
1056
- a.status >= 400 && a.status < 500 ? S.ERR_BAD_REQUEST : S.ERR_BAD_RESPONSE,
1057
- a.config,
1058
- a.request,
1059
- a
1060
- ));
1061
- }
1062
- function Zn(e) {
1063
- const t = /^([-+\w]{1,25}):(?:\/\/)?/.exec(e);
1064
- return t && t[1] || "";
1065
- }
1066
- function er(e, t) {
1067
- e = e || 10;
1068
- const a = new Array(e), n = new Array(e);
1069
- let r = 0, o = 0, s;
1070
- return t = t !== void 0 ? t : 1e3, function(i) {
1071
- const u = Date.now(), c = n[o];
1072
- s || (s = u), a[r] = i, n[r] = u;
1073
- let d = o, p = 0;
1074
- for (; d !== r; )
1075
- p += a[d++], d = d % e;
1076
- if (r = (r + 1) % e, r === o && (o = (o + 1) % e), u - s < t)
1077
- return;
1078
- const v = c && u - c;
1079
- return v ? Math.round(p * 1e3 / v) : void 0;
1080
- };
1081
- }
1082
- function tr(e, t) {
1083
- let a = 0, n = 1e3 / t, r, o;
1084
- const s = (i, u = Date.now()) => {
1085
- a = u, r = null, o && (clearTimeout(o), o = null), e(...i);
1086
- };
1087
- return [(...i) => {
1088
- const u = Date.now(), c = u - a;
1089
- c >= n ? s(i, u) : (r = i, o || (o = setTimeout(() => {
1090
- o = null, s(r);
1091
- }, n - c)));
1092
- }, () => r && s(r)];
1093
- }
1094
- const Je = (e, t, a = 3) => {
1095
- let n = 0;
1096
- const r = er(50, 250);
1097
- return tr((o) => {
1098
- if (!o || typeof o.loaded != "number")
1099
- return;
1100
- const s = o.loaded, i = o.lengthComputable ? o.total : void 0, u = i != null ? Math.min(s, i) : s, c = Math.max(0, u - n), d = r(c);
1101
- n = Math.max(n, u);
1102
- const p = {
1103
- loaded: u,
1104
- total: i,
1105
- progress: i ? u / i : void 0,
1106
- bytes: c,
1107
- rate: d || void 0,
1108
- estimated: d && i ? (i - u) / d : void 0,
1109
- event: o,
1110
- lengthComputable: i != null,
1111
- [t ? "download" : "upload"]: !0
1112
- };
1113
- e(p);
1114
- }, a);
1115
- }, Ut = (e, t) => {
1116
- const a = e != null;
1117
- return [
1118
- (n) => t[0]({
1119
- lengthComputable: a,
1120
- total: e,
1121
- loaded: n
1122
- }),
1123
- t[1]
1124
- ];
1125
- }, Lt = (e) => (...t) => l.asap(() => e(...t)), ar = J.hasStandardBrowserEnv ? ((e, t) => (a) => (a = new URL(a, J.origin), e.protocol === a.protocol && e.host === a.host && (t || e.port === a.port)))(
1126
- new URL(J.origin),
1127
- J.navigator && /(msie|trident)/i.test(J.navigator.userAgent)
1128
- ) : () => !0, nr = J.hasStandardBrowserEnv ? (
1129
- // Standard browser envs support document.cookie
1130
- {
1131
- write(e, t, a, n, r, o, s) {
1132
- if (typeof document > "u")
1133
- return;
1134
- const i = [`${e}=${encodeURIComponent(t)}`];
1135
- l.isNumber(a) && i.push(`expires=${new Date(a).toUTCString()}`), l.isString(n) && i.push(`path=${n}`), l.isString(r) && i.push(`domain=${r}`), o === !0 && i.push("secure"), l.isString(s) && i.push(`SameSite=${s}`), document.cookie = i.join("; ");
1136
- },
1137
- read(e) {
1138
- if (typeof document > "u")
1139
- return null;
1140
- const t = document.cookie.split(";");
1141
- for (let a = 0; a < t.length; a++) {
1142
- const n = t[a].replace(/^\s+/, ""), r = n.indexOf("=");
1143
- if (r !== -1 && n.slice(0, r) === e)
1144
- try {
1145
- return decodeURIComponent(n.slice(r + 1));
1146
- } catch {
1147
- return n.slice(r + 1);
1148
- }
1149
- }
1150
- return null;
1151
- },
1152
- remove(e) {
1153
- this.write(e, "", Date.now() - 864e5, "/");
1154
- }
1155
- }
1156
- ) : (
1157
- // Non-standard browser env (web workers, react-native) lack needed support.
1158
- {
1159
- write() {
1160
- },
1161
- read() {
1162
- return null;
1163
- },
1164
- remove() {
1165
- }
1166
- }
1167
- );
1168
- function rr(e) {
1169
- return typeof e != "string" ? !1 : /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
1170
- }
1171
- function or(e, t) {
1172
- return t ? e.replace(/\/?\/$/, "") + "/" + t.replace(/^\/+/, "") : e;
1173
- }
1174
- const sr = /^https?:(?!\/\/)/i, ir = /[\t\n\r]/g;
1175
- function lr(e) {
1176
- let t = 0;
1177
- for (; t < e.length && e.charCodeAt(t) <= 32; )
1178
- t++;
1179
- return e.slice(t);
1180
- }
1181
- function ur(e) {
1182
- return lr(e).replace(ir, "");
1183
- }
1184
- function It(e, t) {
1185
- if (typeof e == "string" && sr.test(ur(e)))
1186
- throw new S(
1187
- 'Invalid URL: missing "//" after protocol',
1188
- S.ERR_INVALID_URL,
1189
- t
1190
- );
1191
- }
1192
- function fa(e, t, a, n) {
1193
- It(t, n);
1194
- let r = !rr(t);
1195
- return e && (r || a === !1) ? (It(e, n), or(e, t)) : t;
1196
- }
1197
- const jt = (e) => e instanceof ae ? { ...e } : e;
1198
- function Ee(e, t) {
1199
- e = e || {}, t = t || {};
1200
- const a = /* @__PURE__ */ Object.create(null);
1201
- Object.defineProperty(a, "hasOwnProperty", {
1202
- // Null-proto descriptor so a polluted Object.prototype.get cannot turn
1203
- // this data descriptor into an accessor descriptor on the way in.
1204
- __proto__: null,
1205
- value: Object.prototype.hasOwnProperty,
1206
- enumerable: !1,
1207
- writable: !0,
1208
- configurable: !0
1209
- });
1210
- function n(d, p, v, k) {
1211
- return l.isPlainObject(d) && l.isPlainObject(p) ? l.merge.call({ caseless: k }, d, p) : l.isPlainObject(p) ? l.merge({}, p) : l.isArray(p) ? p.slice() : p;
1212
- }
1213
- function r(d, p, v, k) {
1214
- if (l.isUndefined(p)) {
1215
- if (!l.isUndefined(d))
1216
- return n(void 0, d, v, k);
1217
- } else
1218
- return n(d, p, v, k);
1219
- }
1220
- function o(d, p) {
1221
- if (!l.isUndefined(p))
1222
- return n(void 0, p);
1223
- }
1224
- function s(d, p) {
1225
- if (l.isUndefined(p)) {
1226
- if (!l.isUndefined(d))
1227
- return n(void 0, d);
1228
- } else
1229
- return n(void 0, p);
1230
- }
1231
- function i(d) {
1232
- const p = l.hasOwnProp(t, "transitional") ? t.transitional : void 0;
1233
- if (!l.isUndefined(p))
1234
- if (l.isPlainObject(p)) {
1235
- if (l.hasOwnProp(p, d))
1236
- return p[d];
1237
- } else
1238
- return;
1239
- const v = l.hasOwnProp(e, "transitional") ? e.transitional : void 0;
1240
- if (l.isPlainObject(v) && l.hasOwnProp(v, d))
1241
- return v[d];
1242
- }
1243
- function u(d, p, v) {
1244
- if (l.hasOwnProp(t, v))
1245
- return n(d, p);
1246
- if (l.hasOwnProp(e, v))
1247
- return n(void 0, d);
1248
- }
1249
- const c = {
1250
- url: o,
1251
- method: o,
1252
- data: o,
1253
- baseURL: s,
1254
- transformRequest: s,
1255
- transformResponse: s,
1256
- paramsSerializer: s,
1257
- timeout: s,
1258
- timeoutMessage: s,
1259
- withCredentials: s,
1260
- withXSRFToken: s,
1261
- adapter: s,
1262
- responseType: s,
1263
- xsrfCookieName: s,
1264
- xsrfHeaderName: s,
1265
- onUploadProgress: s,
1266
- onDownloadProgress: s,
1267
- decompress: s,
1268
- maxContentLength: s,
1269
- maxBodyLength: s,
1270
- beforeRedirect: s,
1271
- transport: s,
1272
- httpAgent: s,
1273
- httpsAgent: s,
1274
- cancelToken: s,
1275
- socketPath: s,
1276
- allowedSocketPaths: s,
1277
- responseEncoding: s,
1278
- validateStatus: u,
1279
- headers: (d, p, v) => r(jt(d), jt(p), v, !0)
1280
- };
1281
- return l.forEach(Object.keys({ ...e, ...t }), function(d) {
1282
- if (d === "__proto__" || d === "constructor" || d === "prototype")
1283
- return;
1284
- const p = l.hasOwnProp(c, d) ? c[d] : r, v = l.hasOwnProp(e, d) ? e[d] : void 0, k = l.hasOwnProp(t, d) ? t[d] : void 0, h = p(v, k, d);
1285
- l.isUndefined(h) && p !== u || (a[d] = h);
1286
- }), l.hasOwnProp(t, "validateStatus") && l.isUndefined(t.validateStatus) && i("validateStatusUndefinedResolves") === !1 && (l.hasOwnProp(e, "validateStatus") ? a.validateStatus = n(void 0, e.validateStatus) : delete a.validateStatus), a;
1287
- }
1288
- const cr = ["content-type", "content-length"];
1289
- function dr(e, t, a) {
1290
- if (a !== "content-only") {
1291
- e.set(t);
1292
- return;
1293
- }
1294
- Object.entries(t || {}).forEach(([n, r]) => {
1295
- cr.includes(n.toLowerCase()) && e.set(n, r);
1296
- });
1297
- }
1298
- const pr = (e) => encodeURIComponent(e).replace(
1299
- /%([0-9A-F]{2})/gi,
1300
- (t, a) => String.fromCharCode(parseInt(a, 16))
1301
- );
1302
- function ma(e) {
1303
- const t = Ee({}, e), a = (v) => l.hasOwnProp(t, v) ? t[v] : void 0, n = a("data");
1304
- let r = a("withXSRFToken");
1305
- const o = a("xsrfHeaderName"), s = a("xsrfCookieName");
1306
- let i = a("headers");
1307
- const u = a("auth"), c = a("baseURL"), d = a("allowAbsoluteUrls"), p = a("url");
1308
- if (t.headers = i = ae.from(i), t.url = la(
1309
- fa(c, p, d, t),
1310
- a("params"),
1311
- a("paramsSerializer")
1312
- ), u) {
1313
- const v = l.getSafeProp(u, "username") || "", k = l.getSafeProp(u, "password") || "";
1314
- try {
1315
- i.set(
1316
- "Authorization",
1317
- "Basic " + btoa(v + ":" + (k ? pr(k) : ""))
1318
- );
1319
- } catch (h) {
1320
- throw S.from(h, S.ERR_BAD_OPTION_VALUE, e);
1321
- }
1322
- }
1323
- if (l.isFormData(n) && (J.hasStandardBrowserEnv || J.hasStandardBrowserWebWorkerEnv || l.isReactNative(n) ? i.setContentType(void 0) : l.isFunction(n.getHeaders) && dr(i, n.getHeaders(), a("formDataHeaderPolicy"))), J.hasStandardBrowserEnv && (l.isFunction(r) && (r = r(t)), r === !0 || r == null && ar(t.url))) {
1324
- const v = o && s && nr.read(s);
1325
- v && i.set(o, v);
1326
- }
1327
- return t;
1328
- }
1329
- const fr = typeof XMLHttpRequest < "u", mr = fr && function(e) {
1330
- return new Promise(function(t, a) {
1331
- const n = ma(e);
1332
- let r = n.data;
1333
- const o = ae.from(n.headers).normalize();
1334
- let { responseType: s, onUploadProgress: i, onDownloadProgress: u } = n, c, d, p, v, k;
1335
- function h() {
1336
- v && v(), k && k(), n.cancelToken && n.cancelToken.unsubscribe(c), n.signal && n.signal.removeEventListener("abort", c);
1337
- }
1338
- let w = new XMLHttpRequest();
1339
- w.open(n.method.toUpperCase(), n.url, !0), w.timeout = n.timeout;
1340
- function D() {
1341
- if (!w)
1342
- return;
1343
- const g = ae.from(
1344
- "getAllResponseHeaders" in w && w.getAllResponseHeaders()
1345
- ), m = {
1346
- data: !s || s === "text" || s === "json" ? w.responseText : w.response,
1347
- status: w.status,
1348
- statusText: w.statusText,
1349
- headers: g,
1350
- config: e,
1351
- request: w
1352
- };
1353
- pa(
1354
- function(C) {
1355
- t(C), h();
1356
- },
1357
- function(C) {
1358
- a(C), h();
1359
- },
1360
- m
1361
- ), w = null;
1362
- }
1363
- "onloadend" in w ? w.onloadend = D : w.onreadystatechange = function() {
1364
- !w || w.readyState !== 4 || w.status === 0 && !(w.responseURL && w.responseURL.startsWith("file:")) || setTimeout(D);
1365
- }, w.onabort = function() {
1366
- w && (a(new S("Request aborted", S.ECONNABORTED, e, w)), h(), w = null);
1367
- }, w.onerror = function(g) {
1368
- const m = g && g.message ? g.message : "Network Error", C = new S(m, S.ERR_NETWORK, e, w);
1369
- C.event = g || null, a(C), h(), w = null;
1370
- }, w.ontimeout = function() {
1371
- let g = n.timeout ? "timeout of " + n.timeout + "ms exceeded" : "timeout exceeded";
1372
- const m = n.transitional || bt;
1373
- n.timeoutErrorMessage && (g = n.timeoutErrorMessage), a(
1374
- new S(
1375
- g,
1376
- m.clarifyTimeoutError ? S.ETIMEDOUT : S.ECONNABORTED,
1377
- e,
1378
- w
1379
- )
1380
- ), h(), w = null;
1381
- }, r === void 0 && o.setContentType(null), "setRequestHeader" in w && l.forEach(ra(o), function(g, m) {
1382
- w.setRequestHeader(m, g);
1383
- }), l.isUndefined(n.withCredentials) || (w.withCredentials = !!n.withCredentials), s && s !== "json" && (w.responseType = n.responseType), u && ([p, k] = Je(u, !0), w.addEventListener("progress", p)), i && w.upload && ([d, v] = Je(i), w.upload.addEventListener("progress", d), w.upload.addEventListener("loadend", v)), (n.cancelToken || n.signal) && (c = (g) => {
1384
- w && (a(!g || g.type ? new Le(null, e, w) : g), w.abort(), h(), w = null);
1385
- }, n.cancelToken && n.cancelToken.subscribe(c), n.signal && (n.signal.aborted ? c() : n.signal.addEventListener("abort", c)));
1386
- const f = Zn(n.url);
1387
- if (f && !J.protocols.includes(f)) {
1388
- a(
1389
- new S(
1390
- "Unsupported protocol " + f + ":",
1391
- S.ERR_BAD_REQUEST,
1392
- e
1393
- )
1394
- ), h();
1395
- return;
1396
- }
1397
- w.send(r || null);
1398
- });
1399
- }, gr = (e, t) => {
1400
- if (e = e ? e.filter(Boolean) : [], !t && !e.length)
1401
- return;
1402
- const a = new AbortController();
1403
- let n = !1;
1404
- const r = function(u) {
1405
- if (!n) {
1406
- n = !0, s();
1407
- const c = u instanceof Error ? u : this.reason;
1408
- a.abort(
1409
- c instanceof S ? c : new Le(c instanceof Error ? c.message : c)
1410
- );
1411
- }
1412
- };
1413
- let o = t && setTimeout(() => {
1414
- o = null, r(new S(`timeout of ${t}ms exceeded`, S.ETIMEDOUT));
1415
- }, t);
1416
- const s = () => {
1417
- e && (o && clearTimeout(o), o = null, e.forEach((u) => {
1418
- u.unsubscribe ? u.unsubscribe(r) : u.removeEventListener("abort", r);
1419
- }), e = null);
1420
- };
1421
- e.forEach((u) => u.addEventListener("abort", r, { once: !0 }));
1422
- const { signal: i } = a;
1423
- return i.unsubscribe = () => l.asap(s), i;
1424
- }, hr = gr, br = function* (e, t) {
1425
- let a = e.byteLength;
1426
- if (!t || a < t) {
1427
- yield e;
1428
- return;
1429
- }
1430
- let n = 0, r;
1431
- for (; n < a; )
1432
- r = n + t, yield e.slice(n, r), n = r;
1433
- }, yr = async function* (e, t) {
1434
- for await (const a of vr(e))
1435
- yield* br(a, t);
1436
- }, vr = async function* (e) {
1437
- if (e[Symbol.asyncIterator]) {
1438
- yield* e;
1439
- return;
1440
- }
1441
- const t = e.getReader();
1442
- try {
1443
- for (; ; ) {
1444
- const { done: a, value: n } = await t.read();
1445
- if (a)
1446
- break;
1447
- yield n;
1448
- }
1449
- } finally {
1450
- await t.cancel();
1451
- }
1452
- }, Mt = (e, t, a, n) => {
1453
- const r = yr(e, t);
1454
- let o = 0, s, i = (u) => {
1455
- s || (s = !0, n && n(u));
1456
- };
1457
- return new ReadableStream(
1458
- {
1459
- async pull(u) {
1460
- try {
1461
- const { done: c, value: d } = await r.next();
1462
- if (c) {
1463
- i(), u.close();
1464
- return;
1465
- }
1466
- let p = d.byteLength;
1467
- if (a) {
1468
- let v = o += p;
1469
- a(v);
1470
- }
1471
- u.enqueue(new Uint8Array(d));
1472
- } catch (c) {
1473
- throw i(c), c;
1474
- }
1475
- },
1476
- cancel(u) {
1477
- return i(u), r.return();
1478
- }
1479
- },
1480
- {
1481
- highWaterMark: 2
1482
- }
1483
- );
1484
- }, We = (e) => e >= 48 && e <= 57 || e >= 65 && e <= 70 || e >= 97 && e <= 102, wr = (e, t, a) => t + 2 < a && We(e.charCodeAt(t + 1)) && We(e.charCodeAt(t + 2));
1485
- function xr(e) {
1486
- if (!e || typeof e != "string" || !e.startsWith("data:"))
1487
- return 0;
1488
- const t = e.indexOf(",");
1489
- if (t < 0)
1490
- return 0;
1491
- const a = e.slice(5, t), n = e.slice(t + 1);
1492
- if (/;base64/i.test(a)) {
1493
- let o = n.length;
1494
- const s = n.length;
1495
- for (let p = 0; p < s; p++)
1496
- if (n.charCodeAt(p) === 37 && p + 2 < s) {
1497
- const v = n.charCodeAt(p + 1), k = n.charCodeAt(p + 2);
1498
- We(v) && We(k) && (o -= 2, p += 2);
1499
- }
1500
- let i = 0, u = s - 1;
1501
- const c = (p) => p >= 2 && n.charCodeAt(p - 2) === 37 && // '%'
1502
- n.charCodeAt(p - 1) === 51 && // '3'
1503
- (n.charCodeAt(p) === 68 || n.charCodeAt(p) === 100);
1504
- u >= 0 && (n.charCodeAt(u) === 61 ? (i++, u--) : c(u) && (i++, u -= 3)), i === 1 && u >= 0 && (n.charCodeAt(u) === 61 || c(u)) && i++;
1505
- const d = Math.floor(o / 4) * 3 - (i || 0);
1506
- return d > 0 ? d : 0;
1507
- }
1508
- let r = 0;
1509
- for (let o = 0, s = n.length; o < s; o++) {
1510
- const i = n.charCodeAt(o);
1511
- if (i === 37 && wr(n, o, s))
1512
- r += 1, o += 2;
1513
- else if (i < 128)
1514
- r += 1;
1515
- else if (i < 2048)
1516
- r += 2;
1517
- else if (i >= 55296 && i <= 56319 && o + 1 < s) {
1518
- const u = n.charCodeAt(o + 1);
1519
- u >= 56320 && u <= 57343 ? (r += 4, o++) : r += 3;
1520
- } else
1521
- r += 3;
1522
- }
1523
- return r;
1524
- }
1525
- const xt = "1.18.1", zt = 64 * 1024, { isFunction: ze } = l, kr = (e) => encodeURIComponent(e).replace(
1526
- /%([0-9A-F]{2})/gi,
1527
- (t, a) => String.fromCharCode(parseInt(a, 16))
1528
- ), Vt = (e) => {
1529
- if (!l.isString(e))
1530
- return e;
1531
- try {
1532
- return decodeURIComponent(e);
1533
- } catch {
1534
- return e;
1535
- }
1536
- }, qt = (e, ...t) => {
1537
- try {
1538
- return !!e(...t);
1539
- } catch {
1540
- return !1;
1541
- }
1542
- }, Pr = (e) => {
1543
- const t = e.indexOf("://");
1544
- let a = e;
1545
- return t !== -1 && (a = a.slice(t + 3)), a.includes("@") || a.includes(":");
1546
- }, Er = (e) => {
1547
- const t = l.global !== void 0 && l.global !== null ? l.global : globalThis, { ReadableStream: a, TextEncoder: n } = t;
1548
- e = l.merge.call(
1549
- {
1550
- skipUndefined: !0
1551
- },
1552
- {
1553
- Request: t.Request,
1554
- Response: t.Response
1555
- },
1556
- e
1557
- );
1558
- const { fetch: r, Request: o, Response: s } = e, i = r ? ze(r) : typeof fetch == "function", u = ze(o), c = ze(s);
1559
- if (!i)
1560
- return !1;
1561
- const d = i && ze(a), p = i && (typeof n == "function" ? ((f) => (g) => f.encode(g))(new n()) : async (f) => new Uint8Array(await new o(f).arrayBuffer())), v = u && d && qt(() => {
1562
- let f = !1;
1563
- const g = new o(J.origin, {
1564
- body: new a(),
1565
- method: "POST",
1566
- get duplex() {
1567
- return f = !0, "half";
1568
- }
1569
- }), m = g.headers.has("Content-Type");
1570
- return g.body != null && g.body.cancel(), f && !m;
1571
- }), k = c && d && qt(() => l.isReadableStream(new s("").body)), h = {
1572
- stream: k && ((f) => f.body)
1573
- };
1574
- i && ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((f) => {
1575
- !h[f] && (h[f] = (g, m) => {
1576
- let C = g && g[f];
1577
- if (C)
1578
- return C.call(g);
1579
- throw new S(
1580
- `Response type '${f}' is not supported`,
1581
- S.ERR_NOT_SUPPORT,
1582
- m
1583
- );
1584
- });
1585
- });
1586
- const w = async (f) => {
1587
- if (f == null)
1588
- return 0;
1589
- if (l.isBlob(f))
1590
- return f.size;
1591
- if (l.isSpecCompliantForm(f))
1592
- return (await new o(J.origin, {
1593
- method: "POST",
1594
- body: f
1595
- }).arrayBuffer()).byteLength;
1596
- if (l.isArrayBufferView(f) || l.isArrayBuffer(f))
1597
- return f.byteLength;
1598
- if (l.isURLSearchParams(f) && (f = f + ""), l.isString(f))
1599
- return (await p(f)).byteLength;
1600
- }, D = async (f, g) => l.toFiniteNumber(f.getContentLength()) ?? w(g);
1601
- return async (f) => {
1602
- let {
1603
- url: g,
1604
- method: m,
1605
- data: C,
1606
- signal: B,
1607
- cancelToken: y,
1608
- timeout: _,
1609
- onDownloadProgress: z,
1610
- onUploadProgress: ie,
1611
- responseType: q,
1612
- headers: Q,
1613
- withCredentials: V = "same-origin",
1614
- fetchOptions: ve,
1615
- maxContentLength: E,
1616
- maxBodyLength: R
1617
- } = ma(f);
1618
- const Z = l.isNumber(E) && E > -1, Y = l.isNumber(R) && R > -1, et = (F) => l.hasOwnProp(f, F) ? f[F] : void 0;
1619
- let ne = r || fetch;
1620
- q = q ? (q + "").toLowerCase() : "text";
1621
- let $ = hr(
1622
- [B, y && y.toAbortSignal()],
1623
- _
1624
- ), I = null;
1625
- const le = $ && $.unsubscribe && (() => {
1626
- $.unsubscribe();
1627
- });
1628
- let Ae, Be = null;
1629
- const Rt = () => new S(
1630
- "Request body larger than maxBodyLength limit",
1631
- S.ERR_BAD_REQUEST,
1632
- f,
1633
- I
1634
- );
1635
- try {
1636
- let F;
1637
- const re = et("auth");
1638
- if (re) {
1639
- const A = l.getSafeProp(re, "username") || "", te = l.getSafeProp(re, "password") || "";
1640
- F = {
1641
- username: A,
1642
- password: te
1643
- };
1644
- }
1645
- if (Pr(g)) {
1646
- const A = new URL(g, J.origin);
1647
- if (!F && (A.username || A.password)) {
1648
- const te = Vt(A.username), be = Vt(A.password);
1649
- F = {
1650
- username: te,
1651
- password: be
1652
- };
1653
- }
1654
- (A.username || A.password) && (A.username = "", A.password = "", g = A.href);
1655
- }
1656
- if (F && (Q.delete("authorization"), Q.set(
1657
- "Authorization",
1658
- "Basic " + btoa(kr((F.username || "") + ":" + (F.password || "")))
1659
- )), Z && typeof g == "string" && g.startsWith("data:") && xr(g) > E)
1660
- throw new S(
1661
- "maxContentLength size of " + E + " exceeded",
1662
- S.ERR_BAD_RESPONSE,
1663
- f,
1664
- I
1665
- );
1666
- if (Y && m !== "get" && m !== "head") {
1667
- const A = await w(C);
1668
- if (typeof A == "number" && isFinite(A) && (Ae = A, A > R))
1669
- throw Rt();
1670
- }
1671
- const Me = Y && (l.isReadableStream(C) || l.isStream(C)), St = (A, te, be) => Mt(
1672
- A,
1673
- zt,
1674
- (we) => {
1675
- if (Y && we > R)
1676
- throw Be = Rt();
1677
- te && te(we);
1678
- },
1679
- be
1680
- );
1681
- if (v && m !== "get" && m !== "head" && (ie || Me)) {
1682
- if (Ae = Ae ?? await D(Q, C), Ae !== 0 || Me) {
1683
- let A = new o(g, {
1684
- method: "POST",
1685
- body: C,
1686
- duplex: "half"
1687
- }), te;
1688
- if (l.isFormData(C) && (te = A.headers.get("content-type")) && Q.setContentType(te), A.body) {
1689
- const [be, we] = ie && Ut(
1690
- Ae,
1691
- Je(Lt(ie))
1692
- ) || [];
1693
- C = St(A.body, be, we);
1694
- }
1695
- }
1696
- } else if (Me && !u && d && m !== "get" && m !== "head")
1697
- C = St(C);
1698
- else if (Me && u && !v && m !== "get" && m !== "head")
1699
- throw new S(
1700
- "Stream request bodies are not supported by the current fetch implementation",
1701
- S.ERR_NOT_SUPPORT,
1702
- f,
1703
- I
1704
- );
1705
- l.isString(V) || (V = V ? "include" : "omit");
1706
- const ka = u && "credentials" in o.prototype;
1707
- if (l.isFormData(C)) {
1708
- const A = Q.getContentType();
1709
- A && /^multipart\/form-data/i.test(A) && !/boundary=/i.test(A) && Q.delete("content-type");
1710
- }
1711
- Q.set("User-Agent", "axios/" + xt, !1);
1712
- const Tt = {
1713
- ...ve,
1714
- signal: $,
1715
- method: m.toUpperCase(),
1716
- headers: ra(Q.normalize()),
1717
- body: C,
1718
- duplex: "half",
1719
- credentials: ka ? V : void 0
1720
- };
1721
- I = u && new o(g, Tt);
1722
- let me = await (u ? ne(I, ve) : ne(g, Tt));
1723
- const Ct = ae.from(me.headers);
1724
- if (Z) {
1725
- const A = l.toFiniteNumber(Ct.getContentLength());
1726
- if (A != null && A > E)
1727
- throw new S(
1728
- "maxContentLength size of " + E + " exceeded",
1729
- S.ERR_BAD_RESPONSE,
1730
- f,
1731
- I
1732
- );
1733
- }
1734
- const tt = k && (q === "stream" || q === "response");
1735
- if (k && me.body && (z || Z || tt && le)) {
1736
- const A = {};
1737
- ["status", "statusText", "headers"].forEach((_e) => {
1738
- A[_e] = me[_e];
1739
- });
1740
- const te = l.toFiniteNumber(Ct.getContentLength()), [be, we] = z && Ut(
1741
- te,
1742
- Je(Lt(z), !0)
1743
- ) || [];
1744
- let Ot = 0;
1745
- const Pa = (_e) => {
1746
- if (Z && (Ot = _e, Ot > E))
1747
- throw new S(
1748
- "maxContentLength size of " + E + " exceeded",
1749
- S.ERR_BAD_RESPONSE,
1750
- f,
1751
- I
1752
- );
1753
- be && be(_e);
1754
- };
1755
- me = new s(
1756
- Mt(me.body, zt, Pa, () => {
1757
- we && we(), le && le();
1758
- }),
1759
- A
1760
- );
1761
- }
1762
- q = q || "text";
1763
- let ge = await h[l.findKey(h, q) || "text"](
1764
- me,
1765
- f
1766
- );
1767
- if (Z && !k && !tt) {
1768
- let A;
1769
- if (ge != null && (typeof ge.byteLength == "number" ? A = ge.byteLength : typeof ge.size == "number" ? A = ge.size : typeof ge == "string" && (A = typeof n == "function" ? new n().encode(ge).byteLength : ge.length)), typeof A == "number" && A > E)
1770
- throw new S(
1771
- "maxContentLength size of " + E + " exceeded",
1772
- S.ERR_BAD_RESPONSE,
1773
- f,
1774
- I
1775
- );
1776
- }
1777
- return !tt && le && le(), await new Promise((A, te) => {
1778
- pa(A, te, {
1779
- data: ge,
1780
- headers: ae.from(me.headers),
1781
- status: me.status,
1782
- statusText: me.statusText,
1783
- config: f,
1784
- request: I
1785
- });
1786
- });
1787
- } catch (F) {
1788
- if (le && le(), $ && $.aborted && $.reason instanceof S) {
1789
- const re = $.reason;
1790
- throw re.config = f, I && (re.request = I), F !== re && Object.defineProperty(re, "cause", {
1791
- __proto__: null,
1792
- value: F,
1793
- writable: !0,
1794
- enumerable: !1,
1795
- configurable: !0
1796
- }), re;
1797
- }
1798
- if (Be)
1799
- throw I && !Be.request && (Be.request = I), Be;
1800
- if (F instanceof S)
1801
- throw I && !F.request && (F.request = I), F;
1802
- if (F && F.name === "TypeError" && /Load failed|fetch/i.test(F.message)) {
1803
- const re = new S(
1804
- "Network Error",
1805
- S.ERR_NETWORK,
1806
- f,
1807
- I,
1808
- F && F.response
1809
- );
1810
- throw Object.defineProperty(re, "cause", {
1811
- __proto__: null,
1812
- value: F.cause || F,
1813
- writable: !0,
1814
- enumerable: !1,
1815
- configurable: !0
1816
- }), re;
1817
- }
1818
- throw S.from(F, F && F.code, f, I, F && F.response);
1819
- }
1820
- };
1821
- }, Rr = /* @__PURE__ */ new Map(), ga = (e) => {
1822
- let t = e && e.env || {};
1823
- const { fetch: a, Request: n, Response: r } = t, o = [n, r, a];
1824
- let s = o.length, i = s, u, c, d = Rr;
1825
- for (; i--; )
1826
- u = o[i], c = d.get(u), c === void 0 && d.set(u, c = i ? /* @__PURE__ */ new Map() : Er(t)), d = c;
1827
- return c;
1828
- };
1829
- ga();
1830
- const kt = {
1831
- http: Nn,
1832
- xhr: mr,
1833
- fetch: {
1834
- get: ga
1835
- }
1836
- };
1837
- l.forEach(kt, (e, t) => {
1838
- if (e) {
1839
- try {
1840
- Object.defineProperty(e, "name", { __proto__: null, value: t });
1841
- } catch {
1842
- }
1843
- Object.defineProperty(e, "adapterName", { __proto__: null, value: t });
1844
- }
1845
- });
1846
- const $t = (e) => `- ${e}`, Sr = (e) => l.isFunction(e) || e === null || e === !1;
1847
- function Tr(e, t) {
1848
- e = l.isArray(e) ? e : [e];
1849
- const { length: a } = e;
1850
- let n, r;
1851
- const o = {};
1852
- for (let s = 0; s < a; s++) {
1853
- n = e[s];
1854
- let i;
1855
- if (r = n, !Sr(n) && (r = kt[(i = String(n)).toLowerCase()], r === void 0))
1856
- throw new S(`Unknown adapter '${i}'`);
1857
- if (r && (l.isFunction(r) || (r = r.get(t))))
1858
- break;
1859
- o[i || "#" + s] = r;
1860
- }
1861
- if (!r) {
1862
- const s = Object.entries(o).map(
1863
- ([u, c]) => `adapter ${u} ` + (c === !1 ? "is not supported by the environment" : "is not available in the build")
1864
- );
1865
- let i = a ? s.length > 1 ? `since :
1866
- ` + s.map($t).join(`
1867
- `) : " " + $t(s[0]) : "as no adapter specified";
1868
- throw new S(
1869
- "There is no suitable adapter to dispatch the request " + i,
1870
- S.ERR_NOT_SUPPORT
1871
- );
1872
- }
1873
- return r;
1874
- }
1875
- const ha = {
1876
- /**
1877
- * Resolve an adapter from a list of adapter names or functions.
1878
- * @type {Function}
1879
- */
1880
- getAdapter: Tr,
1881
- /**
1882
- * Exposes all known adapters
1883
- * @type {Object<string, Function|Object>}
1884
- */
1885
- adapters: kt
1886
- };
1887
- function st(e) {
1888
- if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
1889
- throw new Le(null, e);
1890
- }
1891
- function Gt(e) {
1892
- return st(e), e.headers = ae.from(e.headers), e.data = ot.call(e, e.transformRequest), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), ha.getAdapter(e.adapter || wt.adapter, e)(e).then(
1893
- function(t) {
1894
- st(e), e.response = t;
1895
- try {
1896
- t.data = ot.call(e, e.transformResponse, t);
1897
- } finally {
1898
- delete e.response;
1899
- }
1900
- return t.headers = ae.from(t.headers), t;
1901
- },
1902
- function(t) {
1903
- if (!da(t) && (st(e), t && t.response)) {
1904
- e.response = t.response;
1905
- try {
1906
- t.response.data = ot.call(
1907
- e,
1908
- e.transformResponse,
1909
- t.response
1910
- );
1911
- } finally {
1912
- delete e.response;
1913
- }
1914
- t.response.headers = ae.from(t.response.headers);
1915
- }
1916
- return Promise.reject(t);
1917
- }
1918
- );
1919
- }
1920
- const Ze = {};
1921
- ["object", "boolean", "number", "function", "string", "symbol"].forEach((e, t) => {
1922
- Ze[e] = function(a) {
1923
- return typeof a === e || "a" + (t < 1 ? "n " : " ") + e;
1924
- };
1925
- });
1926
- const Ht = {};
1927
- Ze.transitional = function(e, t, a) {
1928
- function n(r, o) {
1929
- return "[Axios v" + xt + "] Transitional option '" + r + "'" + o + (a ? ". " + a : "");
1930
- }
1931
- return (r, o, s) => {
1932
- if (e === !1)
1933
- throw new S(
1934
- n(o, " has been removed" + (t ? " in " + t : "")),
1935
- S.ERR_DEPRECATED
1936
- );
1937
- return t && !Ht[o] && (Ht[o] = !0, console.warn(
1938
- n(
1939
- o,
1940
- " has been deprecated since v" + t + " and will be removed in the near future"
1941
- )
1942
- )), e ? e(r, o, s) : !0;
1943
- };
1944
- };
1945
- Ze.spelling = function(e) {
1946
- return (t, a) => (console.warn(`${a} is likely a misspelling of ${e}`), !0);
1947
- };
1948
- function Cr(e, t, a) {
1949
- if (typeof e != "object" || e === null)
1950
- throw new S("options must be an object", S.ERR_BAD_OPTION_VALUE);
1951
- const n = Object.keys(e);
1952
- let r = n.length;
1953
- for (; r-- > 0; ) {
1954
- const o = n[r], s = Object.prototype.hasOwnProperty.call(t, o) ? t[o] : void 0;
1955
- if (s) {
1956
- const i = e[o], u = i === void 0 || s(i, o, e);
1957
- if (u !== !0)
1958
- throw new S(
1959
- "option " + o + " must be " + u,
1960
- S.ERR_BAD_OPTION_VALUE
1961
- );
1962
- continue;
1963
- }
1964
- if (a !== !0)
1965
- throw new S("Unknown option " + o, S.ERR_BAD_OPTION);
1966
- }
1967
- }
1968
- const $e = {
1969
- assertOptions: Cr,
1970
- validators: Ze
1971
- }, K = $e.validators;
1972
- class Ke {
1973
- constructor(t) {
1974
- this.defaults = t || {}, this.interceptors = {
1975
- request: new Ft(),
1976
- response: new Ft()
1977
- };
1978
- }
1979
- /**
1980
- * Dispatch a request
1981
- *
1982
- * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
1983
- * @param {?Object} config
1984
- *
1985
- * @returns {Promise} The Promise to be fulfilled
1986
- */
1987
- async request(t, a) {
1988
- try {
1989
- return await this._request(t, a);
1990
- } catch (n) {
1991
- if (n instanceof Error) {
1992
- let r = {};
1993
- Error.captureStackTrace ? Error.captureStackTrace(r) : r = new Error();
1994
- const o = (() => {
1995
- if (!r.stack)
1996
- return "";
1997
- const s = r.stack.indexOf(`
1998
- `);
1999
- return s === -1 ? "" : r.stack.slice(s + 1);
2000
- })();
2001
- try {
2002
- if (!n.stack)
2003
- n.stack = o;
2004
- else if (o) {
2005
- const s = o.indexOf(`
2006
- `), i = s === -1 ? -1 : o.indexOf(`
2007
- `, s + 1), u = i === -1 ? "" : o.slice(i + 1);
2008
- String(n.stack).endsWith(u) || (n.stack += `
2009
- ` + o);
2010
- }
2011
- } catch {
2012
- }
2013
- }
2014
- throw n;
2015
- }
2016
- }
2017
- _request(t, a) {
2018
- typeof t == "string" ? (a = a || {}, a.url = t) : a = t || {}, a = Ee(this.defaults, a);
2019
- const { transitional: n, paramsSerializer: r, headers: o } = a;
2020
- n !== void 0 && $e.assertOptions(
2021
- n,
2022
- {
2023
- silentJSONParsing: K.transitional(K.boolean),
2024
- forcedJSONParsing: K.transitional(K.boolean),
2025
- clarifyTimeoutError: K.transitional(K.boolean),
2026
- legacyInterceptorReqResOrdering: K.transitional(K.boolean),
2027
- advertiseZstdAcceptEncoding: K.transitional(K.boolean),
2028
- validateStatusUndefinedResolves: K.transitional(K.boolean)
2029
- },
2030
- !1
2031
- ), r != null && (l.isFunction(r) ? a.paramsSerializer = {
2032
- serialize: r
2033
- } : $e.assertOptions(
2034
- r,
2035
- {
2036
- encode: K.function,
2037
- serialize: K.function
2038
- },
2039
- !0
2040
- )), a.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? a.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : a.allowAbsoluteUrls = !0), $e.assertOptions(
2041
- a,
2042
- {
2043
- baseUrl: K.spelling("baseURL"),
2044
- withXsrfToken: K.spelling("withXSRFToken")
2045
- },
2046
- !0
2047
- ), a.method = (a.method || this.defaults.method || "get").toLowerCase();
2048
- let s = o && l.merge(o.common, o[a.method]);
2049
- o && l.forEach(["delete", "get", "head", "post", "put", "patch", "query", "common"], (h) => {
2050
- delete o[h];
2051
- }), a.headers = ae.concat(s, o);
2052
- const i = [];
2053
- let u = !0;
2054
- this.interceptors.request.forEach(function(h) {
2055
- if (typeof h.runWhen == "function" && h.runWhen(a) === !1)
2056
- return;
2057
- u = u && h.synchronous;
2058
- const w = a.transitional || bt;
2059
- w && w.legacyInterceptorReqResOrdering ? i.unshift(h.fulfilled, h.rejected) : i.push(h.fulfilled, h.rejected);
2060
- });
2061
- const c = [];
2062
- this.interceptors.response.forEach(function(h) {
2063
- c.push(h.fulfilled, h.rejected);
2064
- });
2065
- let d, p = 0, v;
2066
- if (!u) {
2067
- const h = [Gt.bind(this), void 0];
2068
- for (h.unshift(...i), h.push(...c), v = h.length, d = Promise.resolve(a); p < v; )
2069
- d = d.then(h[p++], h[p++]);
2070
- return d;
2071
- }
2072
- v = i.length;
2073
- let k = a;
2074
- for (; p < v; ) {
2075
- const h = i[p++], w = i[p++];
2076
- try {
2077
- k = h(k);
2078
- } catch (D) {
2079
- w.call(this, D);
2080
- break;
2081
- }
2082
- }
2083
- try {
2084
- d = Gt.call(this, k);
2085
- } catch (h) {
2086
- return Promise.reject(h);
2087
- }
2088
- for (p = 0, v = c.length; p < v; )
2089
- d = d.then(c[p++], c[p++]);
2090
- return d;
2091
- }
2092
- getUri(t) {
2093
- t = Ee(this.defaults, t);
2094
- const a = fa(t.baseURL, t.url, t.allowAbsoluteUrls, t);
2095
- return la(a, t.params, t.paramsSerializer);
2096
- }
2097
- }
2098
- l.forEach(["delete", "get", "head", "options"], function(e) {
2099
- Ke.prototype[e] = function(t, a) {
2100
- return this.request(
2101
- Ee(a || {}, {
2102
- method: e,
2103
- url: t,
2104
- data: a && l.hasOwnProp(a, "data") ? a.data : void 0
2105
- })
2106
- );
2107
- };
2108
- });
2109
- l.forEach(["post", "put", "patch", "query"], function(e) {
2110
- function t(a) {
2111
- return function(n, r, o) {
2112
- return this.request(
2113
- Ee(o || {}, {
2114
- method: e,
2115
- headers: a ? {
2116
- "Content-Type": "multipart/form-data"
2117
- } : {},
2118
- url: n,
2119
- data: r
2120
- })
2121
- );
2122
- };
2123
- }
2124
- Ke.prototype[e] = t(), e !== "query" && (Ke.prototype[e + "Form"] = t(!0));
2125
- });
2126
- const Ge = Ke;
2127
- class Pt {
2128
- constructor(t) {
2129
- if (typeof t != "function")
2130
- throw new TypeError("executor must be a function.");
2131
- let a;
2132
- this.promise = new Promise(function(r) {
2133
- a = r;
2134
- });
2135
- const n = this;
2136
- this.promise.then((r) => {
2137
- if (!n._listeners)
2138
- return;
2139
- let o = n._listeners.length;
2140
- for (; o-- > 0; )
2141
- n._listeners[o](r);
2142
- n._listeners = null;
2143
- }), this.promise.then = (r) => {
2144
- let o;
2145
- const s = new Promise((i) => {
2146
- n.subscribe(i), o = i;
2147
- }).then(r);
2148
- return s.cancel = function() {
2149
- n.unsubscribe(o);
2150
- }, s;
2151
- }, t(function(r, o, s) {
2152
- n.reason || (n.reason = new Le(r, o, s), a(n.reason));
2153
- });
2154
- }
2155
- /**
2156
- * Throws a `CanceledError` if cancellation has been requested.
2157
- */
2158
- throwIfRequested() {
2159
- if (this.reason)
2160
- throw this.reason;
2161
- }
2162
- /**
2163
- * Subscribe to the cancel signal
2164
- */
2165
- subscribe(t) {
2166
- if (this.reason) {
2167
- t(this.reason);
2168
- return;
2169
- }
2170
- this._listeners ? this._listeners.push(t) : this._listeners = [t];
2171
- }
2172
- /**
2173
- * Unsubscribe from the cancel signal
2174
- */
2175
- unsubscribe(t) {
2176
- if (!this._listeners)
2177
- return;
2178
- const a = this._listeners.indexOf(t);
2179
- a !== -1 && this._listeners.splice(a, 1);
2180
- }
2181
- toAbortSignal() {
2182
- const t = new AbortController(), a = (n) => {
2183
- t.abort(n);
2184
- };
2185
- return this.subscribe(a), t.signal.unsubscribe = () => this.unsubscribe(a), t.signal;
2186
- }
2187
- /**
2188
- * Returns an object that contains a new `CancelToken` and a function that, when called,
2189
- * cancels the `CancelToken`.
2190
- */
2191
- static source() {
2192
- let t;
2193
- return {
2194
- token: new Pt(function(a) {
2195
- t = a;
2196
- }),
2197
- cancel: t
2198
- };
2199
- }
2200
- }
2201
- const Or = Pt;
2202
- function Ar(e) {
2203
- return function(t) {
2204
- return e.apply(null, t);
2205
- };
2206
- }
2207
- function Br(e) {
2208
- return l.isObject(e) && e.isAxiosError === !0;
2209
- }
2210
- const pt = {
2211
- Continue: 100,
2212
- SwitchingProtocols: 101,
2213
- Processing: 102,
2214
- EarlyHints: 103,
2215
- Ok: 200,
2216
- Created: 201,
2217
- Accepted: 202,
2218
- NonAuthoritativeInformation: 203,
2219
- NoContent: 204,
2220
- ResetContent: 205,
2221
- PartialContent: 206,
2222
- MultiStatus: 207,
2223
- AlreadyReported: 208,
2224
- ImUsed: 226,
2225
- MultipleChoices: 300,
2226
- MovedPermanently: 301,
2227
- Found: 302,
2228
- SeeOther: 303,
2229
- NotModified: 304,
2230
- UseProxy: 305,
2231
- Unused: 306,
2232
- TemporaryRedirect: 307,
2233
- PermanentRedirect: 308,
2234
- BadRequest: 400,
2235
- Unauthorized: 401,
2236
- PaymentRequired: 402,
2237
- Forbidden: 403,
2238
- NotFound: 404,
2239
- MethodNotAllowed: 405,
2240
- NotAcceptable: 406,
2241
- ProxyAuthenticationRequired: 407,
2242
- RequestTimeout: 408,
2243
- Conflict: 409,
2244
- Gone: 410,
2245
- LengthRequired: 411,
2246
- PreconditionFailed: 412,
2247
- PayloadTooLarge: 413,
2248
- UriTooLong: 414,
2249
- UnsupportedMediaType: 415,
2250
- RangeNotSatisfiable: 416,
2251
- ExpectationFailed: 417,
2252
- ImATeapot: 418,
2253
- MisdirectedRequest: 421,
2254
- UnprocessableEntity: 422,
2255
- Locked: 423,
2256
- FailedDependency: 424,
2257
- TooEarly: 425,
2258
- UpgradeRequired: 426,
2259
- PreconditionRequired: 428,
2260
- TooManyRequests: 429,
2261
- RequestHeaderFieldsTooLarge: 431,
2262
- UnavailableForLegalReasons: 451,
2263
- InternalServerError: 500,
2264
- NotImplemented: 501,
2265
- BadGateway: 502,
2266
- ServiceUnavailable: 503,
2267
- GatewayTimeout: 504,
2268
- HttpVersionNotSupported: 505,
2269
- VariantAlsoNegotiates: 506,
2270
- InsufficientStorage: 507,
2271
- LoopDetected: 508,
2272
- NotExtended: 510,
2273
- NetworkAuthenticationRequired: 511,
2274
- WebServerIsDown: 521,
2275
- ConnectionTimedOut: 522,
2276
- OriginIsUnreachable: 523,
2277
- TimeoutOccurred: 524,
2278
- SslHandshakeFailed: 525,
2279
- InvalidSslCertificate: 526
2280
- };
2281
- Object.entries(pt).forEach(([e, t]) => {
2282
- pt[t] = e;
2283
- });
2284
- const _r = pt;
2285
- function ba(e) {
2286
- const t = new Ge(e), a = Kt(Ge.prototype.request, t);
2287
- return l.extend(a, Ge.prototype, t, { allOwnKeys: !0 }), l.extend(a, t, null, { allOwnKeys: !0 }), a.create = function(n) {
2288
- return ba(Ee(e, n));
2289
- }, a;
2290
- }
2291
- const M = ba(wt);
2292
- M.Axios = Ge;
2293
- M.CanceledError = Le;
2294
- M.CancelToken = Or;
2295
- M.isCancel = da;
2296
- M.VERSION = xt;
2297
- M.toFormData = Ye;
2298
- M.AxiosError = S;
2299
- M.Cancel = M.CanceledError;
2300
- M.all = function(e) {
2301
- return Promise.all(e);
2302
- };
2303
- M.spread = Ar;
2304
- M.isAxiosError = Br;
2305
- M.mergeConfig = Ee;
2306
- M.AxiosHeaders = ae;
2307
- M.formToJSON = (e) => ca(l.isHTMLForm(e) ? new FormData(e) : e);
2308
- M.getAdapter = ha.getAdapter;
2309
- M.HttpStatusCode = _r;
2310
- M.default = M;
2311
- const Dr = M;
2312
- function Fr(e, t) {
2313
- const a = t && t.toUpperCase() !== "MY" ? `.${t.toLowerCase()}` : "";
2314
- return `https://portal-v2${e === "dev" ? "-dev" : ""}${a}.feedmeapi.com`;
2315
- }
2316
- function Nr(e, t) {
2317
- return Fr(e, t);
2318
- }
2319
- const Et = ["1x1", "4x3", "16x9", "9x16"], ft = "asset";
2320
- function Ur(e) {
2321
- return e.some((t) => t.status === "pending");
2322
- }
2323
- function Lr(e) {
2324
- if (e.length === 0)
2325
- return null;
2326
- const t = e.filter((a) => a.status === "active").length;
2327
- return { tone: e.some((a) => a.status === "pending") ? "progress" : e.some((a) => a.status === "failed") ? "warning" : "done", active: t, total: e.length };
2328
- }
2329
- function ya(e, t) {
2330
- return [
2331
- { key: "original", kind: "original", ratio: null, url: e.url, status: null },
2332
- ...t.map((a) => ({
2333
- key: a.aspectRatio,
2334
- kind: "variant",
2335
- ratio: a.aspectRatio,
2336
- url: a.status === "failed" ? null : a.url,
2337
- status: a.status,
2338
- failureCode: a.failureCode
2339
- }))
2340
- ];
2341
- }
2342
- function Ir(e) {
2343
- return e.refType && e.refId ? {
2344
- kind: "image",
2345
- entry: {
2346
- refType: e.refType,
2347
- refId: e.refId,
2348
- imageId: e.imageId ?? "main",
2349
- // null, not []: null deletes the whole set including the original, which is what
2350
- // deleting an asset means. [] is rejected by the server.
2351
- aspectRatios: null
2352
- }
2353
- } : { kind: "asset", id: e.id };
2354
- }
2355
- function jr(e, t, a) {
2356
- if (e.kind === "original" || e.ratio === null)
2357
- return {
2358
- ratio: null,
2359
- dimensions: `${t.width}×${t.height}`,
2360
- sizeBytes: t.fileSizeBytes,
2361
- contentType: t.mimeType,
2362
- url: t.url
2363
- };
2364
- const n = a.find((r) => r.aspectRatio === e.ratio);
2365
- return {
2366
- ratio: e.ratio,
2367
- dimensions: n != null && n.width && n != null && n.height ? `${n.width}×${n.height}` : null,
2368
- sizeBytes: (n == null ? void 0 : n.fileSizeBytes) ?? null,
2369
- contentType: (n == null ? void 0 : n.contentType) ?? null,
2370
- // Falling back to the asset's url here would reintroduce the copy-link bug, so a
2371
- // missing variant keeps its derivable address rather than borrowing the original's.
2372
- url: (n == null ? void 0 : n.url) ?? `${t.url}?aspect_ratio=${e.ratio}`
2373
- };
2374
- }
2375
- function it(e, t, a) {
2376
- if (t === null)
2377
- return { asset: e, ratio: null, url: e.url };
2378
- const n = a.find((r) => r.aspectRatio === t);
2379
- return !n || n.status !== "active" ? null : { asset: e, ratio: t, url: n.url };
2380
- }
2381
- function Mr(e) {
2382
- return e >= 1024 * 1024 ? `${(e / 1024 / 1024).toFixed(1)} MB` : `${Math.round(e / 1024)} KB`;
2383
- }
2384
- const va = "ai-draft";
2385
- function zr() {
2386
- var e;
2387
- const { sessionUser: t, namespace: a, currentCountry: n } = Ca(), r = (e = t.value) == null ? void 0 : e.token;
2388
- return Dr.create({
2389
- baseURL: Nr(a.value, n.value),
2390
- headers: r ? { Authorization: `Bearer ${r}` } : {}
2391
- });
2392
- }
2393
- const pe = zr;
2394
- function Ie(e) {
2395
- return `/media-v1/businesses/${e}/assets`;
2396
- }
2397
- async function Vr(e) {
2398
- const { businessId: t, ...a } = e, { data: n } = await pe().get(Ie(t), { params: a });
2399
- return n;
2400
- }
2401
- async function wa(e) {
2402
- const { data: t } = await pe().get(`${Ie(e)}/tags`, {
2403
- params: { excludeTags: [va] }
2404
- });
2405
- return t;
2406
- }
2407
- async function qr(e) {
2408
- const { tags: t } = await wa(e);
2409
- return t.map((a) => a.tag);
2410
- }
2411
- async function $r(e, t, a) {
2412
- const { data: n } = await pe().patch(`${Ie(e)}/${t}`, { fileName: a });
2413
- return n;
2414
- }
2415
- async function Gr(e, t, a) {
2416
- const { data: n } = await pe().patch(`${Ie(e)}/${t}`, { tags: a });
2417
- return n;
2418
- }
2419
- async function Hr(e, t) {
2420
- await pe().delete(`${Ie(e)}/${t}`);
2421
- }
2422
- function je(e) {
2423
- return `/media-v1/businesses/${e}/images`;
2424
- }
2425
- async function Jr(e, t, a) {
2426
- const { data: n } = await pe().post(`${je(e)}/create`, t, {
2427
- headers: a ? { "Idempotency-Key": a } : {}
2428
- });
2429
- return n;
2430
- }
2431
- async function Wr(e, t) {
2432
- const { data: a } = await pe().post(`${je(e)}/delete`, {
2433
- entries: t
2434
- });
2435
- return a.results;
2436
- }
2437
- async function Kr(e) {
2438
- const { businessId: t, refIds: a, ...n } = e, { data: r } = await pe().get(je(t), {
2439
- params: { ...n, refIds: a.join(",") }
2440
- });
2441
- return r.images;
2442
- }
2443
- async function Xr(e, t) {
2444
- const { data: a } = await pe().post(`${je(e)}/upload-intent`, t);
2445
- return a;
2446
- }
2447
- async function Qr(e, t) {
2448
- const { data: a } = await pe().post(`${je(e)}/confirm`, t);
2449
- return a;
2450
- }
2451
- async function Yr(e, t) {
2452
- const a = Ir(t);
2453
- if (a.kind === "image") {
2454
- await Wr(e, [a.entry]);
2455
- return;
2456
- }
2457
- await Hr(e, a.id);
2458
- }
2459
- const Zr = {
2460
- assetGrid: {
2461
- loading: "Loading…",
2462
- empty: "No assets yet",
2463
- columns: {
2464
- name: "Name",
2465
- dimensions: "Dimensions",
2466
- fileSize: "Size",
2467
- uploader: "Uploaded By",
2468
- uploadedAt: "Uploaded At"
2469
- },
2470
- time: {
2471
- justNow: "Just now",
2472
- minutesAgo: "{n} minutes ago",
2473
- hoursAgo: "{n} hours ago",
2474
- daysAgo: "{n} days ago"
2475
- }
2476
- },
2477
- assetPagination: {
2478
- itemCount: "{start}–{end} of {total}",
2479
- pageCount: "{total} pages"
2480
- },
2481
- assetDetailDialog: {
2482
- previewTitle: "Preview",
2483
- saveButton: "Save",
2484
- dimensionsLabel: "Dimensions",
2485
- sizeLabel: "Size",
2486
- formatLabel: "Format",
2487
- copyLinkButton: "Copy Link",
2488
- deleteButton: "Delete",
2489
- deleteDisclaimer: "If any business module is still using this image, it will show as broken wherever it's referenced after deletion — make sure it's no longer needed.",
2490
- deleteDialogTitle: "Delete Asset",
2491
- deleteDialogMessage: 'Delete "{fileName}"? {disclaimer}',
2492
- deleteConfirmButton: "Delete",
2493
- cancelButton: "Cancel"
2494
- },
2495
- tagFilterBar: {
2496
- all: "All",
2497
- newTagPlaceholder: "New tag…"
2498
- },
2499
- tagFilterTabs: {
2500
- all: "All"
2501
- },
2502
- uploadPanel: {
2503
- dropLabel: "Drag images here, or click to choose",
2504
- helperText: "Supports JPG, PNG, WEBP, up to 10MB each",
2505
- stagedCount: "Pending · {count}",
2506
- tagsLabel: "Tags (optional)",
2507
- suggestedTagsLabel: "Common",
2508
- uploadFailedError: "Upload failed: {status}",
2509
- uploading: "Uploading…"
2510
- },
2511
- pickerModal: {
2512
- title: "Select Assets",
2513
- subtitleMultiple: "Select multiple or upload — click an image to toggle selection",
2514
- subtitleSingle: "Click an image to select it, or switch to Upload New",
2515
- searchPlaceholder: "Search…",
2516
- browseTab: "Browse",
2517
- uploadTab: "Upload New",
2518
- selectedCount: "{count} selected",
2519
- selectPrompt: "Select an image",
2520
- cancelButton: "Cancel",
2521
- uploadSubmitButton: "Upload {count}",
2522
- confirmButton: "Confirm"
2523
- },
2524
- ratios: {
2525
- title: "Ratios to generate",
2526
- hint: "AI expands the canvas — about 40s per ratio"
2527
- },
2528
- variants: {
2529
- badgeDone: "{count} ratios",
2530
- badgeProgress: "{active}/{total} ratios",
2531
- original: "Original",
2532
- generating: "Generating…",
2533
- failed: "Generation failed",
2534
- failedNoTokens: "Out of AI tokens. Top up, then generate this size again.",
2535
- failedTokenServiceDown: "Couldn't check your AI token balance. Try again shortly.",
2536
- regenerate: "Regenerate"
2537
- },
2538
- ratioBar: {
2539
- label: "Ratio"
2540
- }
2541
- }, eo = {
2542
- mediaPicker: Zr
2543
- }, to = {
2544
- assetGrid: {
2545
- loading: "Chargement…",
2546
- empty: "Aucun média",
2547
- columns: {
2548
- name: "Nom",
2549
- dimensions: "Dimensions",
2550
- fileSize: "Taille",
2551
- uploader: "Importé par",
2552
- uploadedAt: "Importé le"
2553
- },
2554
- time: {
2555
- justNow: "À l'instant",
2556
- minutesAgo: "il y a {n} min",
2557
- hoursAgo: "il y a {n} h",
2558
- daysAgo: "il y a {n} j"
2559
- }
2560
- },
2561
- assetPagination: {
2562
- itemCount: "{start}–{end} sur {total}",
2563
- pageCount: "{total} pages"
2564
- },
2565
- assetDetailDialog: {
2566
- previewTitle: "Aperçu",
2567
- saveButton: "Enregistrer",
2568
- dimensionsLabel: "Dimensions",
2569
- sizeLabel: "Taille",
2570
- formatLabel: "Format",
2571
- copyLinkButton: "Copier le lien",
2572
- deleteButton: "Supprimer",
2573
- deleteDisclaimer: "Après suppression, si un module métier utilise encore cette image, elle apparaîtra comme cassée à l'endroit où elle est référencée. Assurez-vous qu'elle n'est plus nécessaire.",
2574
- deleteDialogTitle: "Supprimer le média",
2575
- deleteDialogMessage: "Supprimer « {fileName} » ? {disclaimer}",
2576
- deleteConfirmButton: "Supprimer",
2577
- cancelButton: "Annuler"
2578
- },
2579
- tagFilterBar: {
2580
- all: "Tous",
2581
- newTagPlaceholder: "Nouveau tag…"
2582
- },
2583
- tagFilterTabs: {
2584
- all: "Tous"
2585
- },
2586
- uploadPanel: {
2587
- dropLabel: "Glissez des images ici, ou cliquez pour choisir",
2588
- helperText: "JPG, PNG, WEBP acceptés, 10 Mo maximum par image",
2589
- stagedCount: "En attente · {count}",
2590
- tagsLabel: "Tags (facultatif)",
2591
- suggestedTagsLabel: "Fréquents",
2592
- uploadFailedError: "Échec de l'import : {status}",
2593
- uploading: "Téléchargement…"
2594
- },
2595
- pickerModal: {
2596
- title: "Sélectionner des médias",
2597
- subtitleMultiple: "Sélection multiple ou import — cliquez sur une image pour la sélectionner",
2598
- subtitleSingle: "Cliquez sur une image pour la choisir, ou passez à l'onglet Importer",
2599
- searchPlaceholder: "Rechercher…",
2600
- browseTab: "Parcourir",
2601
- uploadTab: "Importer",
2602
- selectedCount: "{count} sélectionné(s)",
2603
- selectPrompt: "Sélectionnez une image",
2604
- cancelButton: "Annuler",
2605
- uploadSubmitButton: "Importer {count}",
2606
- confirmButton: "Confirmer"
2607
- },
2608
- ratios: {
2609
- title: "Ratios à générer",
2610
- hint: "L'IA étend le cadre — environ 40 s par ratio"
2611
- },
2612
- variants: {
2613
- badgeDone: "{count} ratios",
2614
- badgeProgress: "{active}/{total} ratios",
2615
- original: "Original",
2616
- generating: "Génération…",
2617
- failed: "Échec de la génération",
2618
- failedNoTokens: "Jetons IA épuisés. Rechargez, puis regénérez ce format.",
2619
- failedTokenServiceDown: "Impossible de vérifier votre solde de jetons IA. Réessayez sous peu.",
2620
- regenerate: "Régénérer"
2621
- },
2622
- ratioBar: {
2623
- label: "Ratio"
2624
- }
2625
- }, ao = {
2626
- mediaPicker: to
2627
- }, no = {
2628
- assetGrid: {
2629
- loading: "Memuat…",
2630
- empty: "Belum ada media",
2631
- columns: {
2632
- name: "Nama",
2633
- dimensions: "Dimensi",
2634
- fileSize: "Ukuran",
2635
- uploader: "Diunggah Oleh",
2636
- uploadedAt: "Waktu Unggah"
2637
- },
2638
- time: {
2639
- justNow: "Baru saja",
2640
- minutesAgo: "{n} menit lalu",
2641
- hoursAgo: "{n} jam lalu",
2642
- daysAgo: "{n} hari lalu"
2643
- }
2644
- },
2645
- assetPagination: {
2646
- itemCount: "{start}–{end} dari {total}",
2647
- pageCount: "{total} halaman"
2648
- },
2649
- assetDetailDialog: {
2650
- previewTitle: "Pratinjau",
2651
- saveButton: "Simpan",
2652
- dimensionsLabel: "Dimensi",
2653
- sizeLabel: "Ukuran",
2654
- formatLabel: "Format",
2655
- copyLinkButton: "Salin Tautan",
2656
- deleteButton: "Hapus",
2657
- deleteDisclaimer: "Setelah dihapus, jika ada modul bisnis yang masih menggunakan gambar ini, gambar akan tampil rusak di tempat penggunaannya. Pastikan gambar ini sudah tidak diperlukan lagi.",
2658
- deleteDialogTitle: "Hapus Media",
2659
- deleteDialogMessage: 'Hapus "{fileName}"? {disclaimer}',
2660
- deleteConfirmButton: "Hapus",
2661
- cancelButton: "Batal"
2662
- },
2663
- tagFilterBar: {
2664
- all: "Semua",
2665
- newTagPlaceholder: "Buat tag baru…"
2666
- },
2667
- tagFilterTabs: {
2668
- all: "Semua"
2669
- },
2670
- uploadPanel: {
2671
- dropLabel: "Seret gambar ke sini, atau klik untuk memilih",
2672
- helperText: "Mendukung JPG, PNG, WEBP, maksimal 10MB per file",
2673
- stagedCount: "Menunggu diunggah · {count}",
2674
- tagsLabel: "Tag (opsional)",
2675
- suggestedTagsLabel: "Sering digunakan",
2676
- uploadFailedError: "Unggah gagal: {status}",
2677
- uploading: "Mengunggah…"
2678
- },
2679
- pickerModal: {
2680
- title: "Pilih Media",
2681
- subtitleMultiple: "Pilih beberapa atau unggah — klik gambar untuk mengubah pilihan",
2682
- subtitleSingle: "Klik gambar untuk memilihnya, atau beralih ke Unggah Baru",
2683
- searchPlaceholder: "Cari…",
2684
- browseTab: "Jelajahi & Pilih",
2685
- uploadTab: "Unggah Baru",
2686
- selectedCount: "{count} dipilih",
2687
- selectPrompt: "Pilih gambar",
2688
- cancelButton: "Batal",
2689
- uploadSubmitButton: "Unggah {count}",
2690
- confirmButton: "Konfirmasi"
2691
- },
2692
- ratios: {
2693
- title: "Rasio yang akan dibuat",
2694
- hint: "AI memperluas kanvas — sekitar 40 detik per rasio"
2695
- },
2696
- variants: {
2697
- badgeDone: "{count} rasio",
2698
- badgeProgress: "{active}/{total} rasio",
2699
- original: "Asli",
2700
- generating: "Membuat…",
2701
- failed: "Gagal membuat",
2702
- failedNoTokens: "Token AI habis. Isi ulang, lalu buat ukuran ini lagi.",
2703
- failedTokenServiceDown: "Saldo token AI tidak dapat diperiksa. Coba lagi sebentar lagi.",
2704
- regenerate: "Buat ulang"
2705
- },
2706
- ratioBar: {
2707
- label: "Rasio"
2708
- }
2709
- }, ro = {
2710
- mediaPicker: no
2711
- }, oo = {
2712
- assetGrid: {
2713
- loading: "読み込み中…",
2714
- empty: "素材がありません",
2715
- columns: {
2716
- name: "名前",
2717
- dimensions: "サイズ",
2718
- fileSize: "容量",
2719
- uploader: "アップロード者",
2720
- uploadedAt: "アップロード日時"
2721
- },
2722
- time: {
2723
- justNow: "たった今",
2724
- minutesAgo: "{n} 分前",
2725
- hoursAgo: "{n} 時間前",
2726
- daysAgo: "{n} 日前"
2727
- }
2728
- },
2729
- assetPagination: {
2730
- itemCount: "{total} 件中 {start}–{end} 件",
2731
- pageCount: "全 {total} ページ"
2732
- },
2733
- assetDetailDialog: {
2734
- previewTitle: "プレビュー",
2735
- saveButton: "保存",
2736
- dimensionsLabel: "サイズ",
2737
- sizeLabel: "容量",
2738
- formatLabel: "形式",
2739
- copyLinkButton: "リンクをコピー",
2740
- deleteButton: "削除",
2741
- deleteDisclaimer: "削除後、この画像を使用している業務モジュールがある場合、参照元では画像が表示されなくなります。不要であることを確認してください。",
2742
- deleteDialogTitle: "素材を削除",
2743
- deleteDialogMessage: "「{fileName}」を削除しますか?{disclaimer}",
2744
- deleteConfirmButton: "削除",
2745
- cancelButton: "キャンセル"
2746
- },
2747
- tagFilterBar: {
2748
- all: "すべて",
2749
- newTagPlaceholder: "新しいタグを作成…"
2750
- },
2751
- tagFilterTabs: {
2752
- all: "すべて"
2753
- },
2754
- uploadPanel: {
2755
- dropLabel: "ここに画像をドラッグ、またはクリックして選択",
2756
- helperText: "JPG、PNG、WEBP に対応、1枚あたり10MBまで",
2757
- stagedCount: "アップロード待ち · {count}",
2758
- tagsLabel: "タグ(任意)",
2759
- suggestedTagsLabel: "よく使うタグ",
2760
- uploadFailedError: "アップロードに失敗しました:{status}",
2761
- uploading: "アップロード中…"
2762
- },
2763
- pickerModal: {
2764
- title: "素材を選択",
2765
- subtitleMultiple: "複数選択またはアップロードが可能です。画像をクリックして選択を切り替えます",
2766
- subtitleSingle: "画像をクリックして選択するか、「新規アップロード」に切り替えてください",
2767
- searchPlaceholder: "検索…",
2768
- browseTab: "選択して閲覧",
2769
- uploadTab: "新規アップロード",
2770
- selectedCount: "{count} 件選択中",
2771
- selectPrompt: "画像を選択してください",
2772
- cancelButton: "キャンセル",
2773
- uploadSubmitButton: "{count} 件をアップロード",
2774
- confirmButton: "確定"
2775
- },
2776
- ratios: {
2777
- title: "生成する比率",
2778
- hint: "AI がキャンバスを拡張します(1件あたり約40秒)"
2779
- },
2780
- variants: {
2781
- badgeDone: "{count} 比率",
2782
- badgeProgress: "{active}/{total} 比率",
2783
- original: "元画像",
2784
- generating: "生成中…",
2785
- failed: "生成に失敗しました",
2786
- failedNoTokens: "AIトークンが不足しています。チャージ後にこのサイズを再生成できます。",
2787
- failedTokenServiceDown: "AIトークンの残高を確認できませんでした。しばらくしてからお試しください。",
2788
- regenerate: "再生成"
2789
- },
2790
- ratioBar: {
2791
- label: "比率"
2792
- }
2793
- }, so = {
2794
- mediaPicker: oo
2795
- }, io = {
2796
- assetGrid: {
2797
- loading: "กำลังโหลด…",
2798
- empty: "ยังไม่มีสื่อ",
2799
- columns: {
2800
- name: "ชื่อ",
2801
- dimensions: "ขนาด (พิกเซล)",
2802
- fileSize: "ขนาดไฟล์",
2803
- uploader: "ผู้อัปโหลด",
2804
- uploadedAt: "เวลาอัปโหลด"
2805
- },
2806
- time: {
2807
- justNow: "เมื่อสักครู่",
2808
- minutesAgo: "{n} นาทีที่แล้ว",
2809
- hoursAgo: "{n} ชั่วโมงที่แล้ว",
2810
- daysAgo: "{n} วันที่แล้ว"
2811
- }
2812
- },
2813
- assetPagination: {
2814
- itemCount: "{start}–{end} จาก {total} รายการ",
2815
- pageCount: "{total} หน้า"
2816
- },
2817
- assetDetailDialog: {
2818
- previewTitle: "ตัวอย่าง",
2819
- saveButton: "บันทึก",
2820
- dimensionsLabel: "ขนาด (พิกเซล)",
2821
- sizeLabel: "ขนาดไฟล์",
2822
- formatLabel: "รูปแบบ",
2823
- copyLinkButton: "คัดลอกลิงก์",
2824
- deleteButton: "ลบ",
2825
- deleteDisclaimer: "หลังลบแล้ว หากมีโมดูลธุรกิจใดกำลังใช้รูปนี้อยู่ รูปจะแสดงเป็นลิงก์เสียในตำแหน่งที่ถูกใช้งาน กรุณายืนยันว่าไม่จำเป็นต้องใช้แล้ว",
2826
- deleteDialogTitle: "ลบสื่อ",
2827
- deleteDialogMessage: "ยืนยันลบ “{fileName}” ใช่หรือไม่? {disclaimer}",
2828
- deleteConfirmButton: "ลบ",
2829
- cancelButton: "ยกเลิก"
2830
- },
2831
- tagFilterBar: {
2832
- all: "ทั้งหมด",
2833
- newTagPlaceholder: "สร้างแท็กใหม่…"
2834
- },
2835
- tagFilterTabs: {
2836
- all: "ทั้งหมด"
2837
- },
2838
- uploadPanel: {
2839
- dropLabel: "ลากรูปภาพมาวางที่นี่ หรือคลิกเพื่อเลือก",
2840
- helperText: "รองรับ JPG, PNG, WEBP ไฟล์ละไม่เกิน 10MB",
2841
- stagedCount: "รอการอัปโหลด · {count}",
2842
- tagsLabel: "แท็ก (ไม่บังคับ)",
2843
- suggestedTagsLabel: "ที่ใช้บ่อย",
2844
- uploadFailedError: "อัปโหลดล้มเหลว: {status}",
2845
- uploading: "กำลังอัปโหลด…"
2846
- },
2847
- pickerModal: {
2848
- title: "เลือกสื่อ",
2849
- subtitleMultiple: "เลือกได้หลายรายการหรืออัปโหลด คลิกที่รูปเพื่อสลับการเลือก",
2850
- subtitleSingle: "คลิกที่รูปเพื่อเลือก หรือสลับไปที่แท็บอัปโหลดรูปใหม่",
2851
- searchPlaceholder: "ค้นหา…",
2852
- browseTab: "เรียกดูและเลือก",
2853
- uploadTab: "อัปโหลดรูปใหม่",
2854
- selectedCount: "เลือกแล้ว {count} รายการ",
2855
- selectPrompt: "กรุณาเลือกรูปภาพ",
2856
- cancelButton: "ยกเลิก",
2857
- uploadSubmitButton: "อัปโหลด {count} รายการ",
2858
- confirmButton: "ยืนยัน"
2859
- },
2860
- ratios: {
2861
- title: "อัตราส่วนที่ต้องการสร้าง",
2862
- hint: "AI จะขยายพื้นที่ภาพ ใช้เวลาประมาณ 40 วินาทีต่อรายการ"
2863
- },
2864
- variants: {
2865
- badgeDone: "{count} อัตราส่วน",
2866
- badgeProgress: "{active}/{total} อัตราส่วน",
2867
- original: "ภาพต้นฉบับ",
2868
- generating: "กำลังสร้าง…",
2869
- failed: "สร้างไม่สำเร็จ",
2870
- failedNoTokens: "โทเค็น AI หมดแล้ว เติมเงินแล้วสร้างขนาดนี้ใหม่ได้",
2871
- failedTokenServiceDown: "ตรวจสอบยอดโทเค็น AI ไม่ได้ กรุณาลองใหม่อีกครั้ง",
2872
- regenerate: "สร้างใหม่"
2873
- },
2874
- ratioBar: {
2875
- label: "อัตราส่วน"
2876
- }
2877
- }, lo = {
2878
- mediaPicker: io
2879
- }, uo = {
2880
- assetGrid: {
2881
- loading: "加载中…",
2882
- empty: "暂无素材",
2883
- columns: {
2884
- name: "名称",
2885
- dimensions: "尺寸",
2886
- fileSize: "大小",
2887
- uploader: "上传人",
2888
- uploadedAt: "上传时间"
2889
- },
2890
- time: {
2891
- justNow: "刚刚",
2892
- minutesAgo: "{n} 分钟前",
2893
- hoursAgo: "{n} 小时前",
2894
- daysAgo: "{n} 天前"
2895
- }
2896
- },
2897
- assetPagination: {
2898
- itemCount: "第 {start}–{end} 项,共 {total} 项",
2899
- pageCount: "共 {total} 页"
2900
- },
2901
- assetDetailDialog: {
2902
- previewTitle: "预览",
2903
- saveButton: "保存",
2904
- dimensionsLabel: "尺寸",
2905
- sizeLabel: "大小",
2906
- formatLabel: "格式",
2907
- copyLinkButton: "复制链接",
2908
- deleteButton: "删除",
2909
- deleteDisclaimer: "删除后如有业务模块正在使用这张图,图片会在原处显示失效,请确认已不再需要。",
2910
- deleteDialogTitle: "删除素材",
2911
- deleteDialogMessage: "确定删除「{fileName}」吗?{disclaimer}",
2912
- deleteConfirmButton: "删除",
2913
- cancelButton: "取消"
2914
- },
2915
- tagFilterBar: {
2916
- all: "全部",
2917
- newTagPlaceholder: "新建标签…"
2918
- },
2919
- tagFilterTabs: {
2920
- all: "全部"
2921
- },
2922
- uploadPanel: {
2923
- dropLabel: "拖拽图片到此处,或点击选择",
2924
- helperText: "支持 JPG、PNG、WEBP,单张不超过 10MB",
2925
- stagedCount: "待上传 · {count}",
2926
- tagsLabel: "标签(可选)",
2927
- suggestedTagsLabel: "常用",
2928
- uploadFailedError: "上传失败:{status}",
2929
- uploading: "上传中…"
2930
- },
2931
- pickerModal: {
2932
- title: "选择素材",
2933
- subtitleMultiple: "可多选或上传,点击图片切换选择",
2934
- subtitleSingle: "点击图片完成选择,或切换到上传新图",
2935
- searchPlaceholder: "搜索…",
2936
- browseTab: "浏览选择",
2937
- uploadTab: "上传新图",
2938
- selectedCount: "已选择 {count} 张",
2939
- selectPrompt: "请选择图片",
2940
- cancelButton: "取消",
2941
- uploadSubmitButton: "上传 {count} 张",
2942
- confirmButton: "确定"
2943
- },
2944
- ratios: {
2945
- title: "要生成的规格",
2946
- hint: "AI 扩展画布,每个规格约 40 秒"
2947
- },
2948
- variants: {
2949
- badgeDone: "{count} 规格",
2950
- badgeProgress: "{active}/{total} 规格",
2951
- original: "原图",
2952
- generating: "生成中…",
2953
- failed: "生成失败",
2954
- failedNoTokens: "AI 额度已用完。充值后可重新生成这个尺寸。",
2955
- failedTokenServiceDown: "暂时无法确认 AI 额度,请稍后重试。",
2956
- regenerate: "重新生成"
2957
- },
2958
- ratioBar: {
2959
- label: "规格"
2960
- }
2961
- }, co = {
2962
- mediaPicker: uo
2963
- }, po = {
2964
- assetGrid: {
2965
- loading: "載入中…",
2966
- empty: "暫無素材",
2967
- columns: {
2968
- name: "名稱",
2969
- dimensions: "尺寸",
2970
- fileSize: "大小",
2971
- uploader: "上傳人",
2972
- uploadedAt: "上傳時間"
2973
- },
2974
- time: {
2975
- justNow: "剛剛",
2976
- minutesAgo: "{n} 分鐘前",
2977
- hoursAgo: "{n} 小時前",
2978
- daysAgo: "{n} 天前"
2979
- }
2980
- },
2981
- assetPagination: {
2982
- itemCount: "第 {start}–{end} 項,共 {total} 項",
2983
- pageCount: "共 {total} 頁"
2984
- },
2985
- assetDetailDialog: {
2986
- previewTitle: "預覽",
2987
- saveButton: "儲存",
2988
- dimensionsLabel: "尺寸",
2989
- sizeLabel: "大小",
2990
- formatLabel: "格式",
2991
- copyLinkButton: "複製連結",
2992
- deleteButton: "刪除",
2993
- deleteDisclaimer: "刪除後如有業務模組正在使用這張圖,圖片會在原處顯示失效,請確認已不再需要。",
2994
- deleteDialogTitle: "刪除素材",
2995
- deleteDialogMessage: "確定刪除「{fileName}」嗎?{disclaimer}",
2996
- deleteConfirmButton: "刪除",
2997
- cancelButton: "取消"
2998
- },
2999
- tagFilterBar: {
3000
- all: "全部",
3001
- newTagPlaceholder: "新增標籤…"
3002
- },
3003
- tagFilterTabs: {
3004
- all: "全部"
3005
- },
3006
- uploadPanel: {
3007
- dropLabel: "拖曳圖片到此處,或點擊選擇",
3008
- helperText: "支援 JPG、PNG、WEBP,單張不超過 10MB",
3009
- stagedCount: "待上傳 · {count}",
3010
- tagsLabel: "標籤(可選)",
3011
- suggestedTagsLabel: "常用",
3012
- uploadFailedError: "上傳失敗:{status}",
3013
- uploading: "上傳中…"
3014
- },
3015
- pickerModal: {
3016
- title: "選擇素材",
3017
- subtitleMultiple: "可多選或上傳,點擊圖片切換選擇",
3018
- subtitleSingle: "點擊圖片完成選擇,或切換到上傳新圖",
3019
- searchPlaceholder: "搜尋…",
3020
- browseTab: "瀏覽選擇",
3021
- uploadTab: "上傳新圖",
3022
- selectedCount: "已選擇 {count} 張",
3023
- selectPrompt: "請選擇圖片",
3024
- cancelButton: "取消",
3025
- uploadSubmitButton: "上傳 {count} 張",
3026
- confirmButton: "確定"
3027
- },
3028
- ratios: {
3029
- title: "要產生的規格",
3030
- hint: "AI 擴展畫布,每個規格約 40 秒"
3031
- },
3032
- variants: {
3033
- badgeDone: "{count} 規格",
3034
- badgeProgress: "{active}/{total} 規格",
3035
- original: "原圖",
3036
- generating: "產生中…",
3037
- failed: "產生失敗",
3038
- failedNoTokens: "AI 額度已用完。儲值後可重新產生這個尺寸。",
3039
- failedTokenServiceDown: "暫時無法確認 AI 額度,請稍後重試。",
3040
- regenerate: "重新產生"
3041
- },
3042
- ratioBar: {
3043
- label: "規格"
3044
- }
3045
- }, fo = {
3046
- mediaPicker: po
3047
- }, fe = {
3048
- "en-US": eo,
3049
- "zh-CN": co,
3050
- "zh-Hant": fo,
3051
- "th-TH": lo,
3052
- "ja-JP": so,
3053
- "id-ID": ro,
3054
- "fr-MA": ao
3055
- }, mo = {
3056
- key: 0,
3057
- class: "py-64 text-center text-sm text-gray-400"
3058
- }, go = {
3059
- key: 1,
3060
- class: "py-64 text-center text-sm text-gray-400"
3061
- }, ho = {
3062
- key: 2,
3063
- class: "bg-white border border-fm-color-neutral-gray-200 rounded-lg overflow-hidden"
3064
- }, bo = { class: "grid grid-cols-[40px_56px_minmax(160px,2.2fr)_110px_90px_150px_120px_40px] items-center gap-8 px-16 h-40 bg-fm-color-neutral-gray-100 border-b border-fm-color-neutral-gray-200 text-xs font-semibold text-fm-color-typo-secondary" }, yo = ["onClick"], vo = ["onClick"], wo = { key: 1 }, xo = { class: "w-[44px] h-[36px] rounded overflow-hidden" }, ko = { class: "min-w-0 flex flex-col gap-4" }, Po = { class: "text-xs font-semibold truncate" }, Eo = { class: "flex items-center gap-8" }, Ro = { class: "text-[11px] text-fm-color-typo-tertiary" }, So = { class: "text-xs text-fm-color-typo-primary" }, To = { class: "text-xs text-fm-color-typo-primary" }, Co = { class: "flex items-center gap-8 min-w-0" }, Oo = { class: "text-xs text-fm-color-typo-primary truncate" }, Ao = { class: "text-xs text-fm-color-typo-secondary" }, Bo = {
3065
- key: 3,
3066
- class: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-16"
3067
- }, _o = ["onClick"], Do = { class: "relative aspect-[4/3]" }, Fo = ["onClick"], No = { class: "absolute bottom-8 left-8 bg-black/70 text-white text-[11px] font-semibold px-[6px] py-[2px] rounded" }, Uo = { class: "px-8 py-6 space-y-2" }, Lo = { class: "text-xs font-semibold truncate" }, Io = { class: "text-[11px] text-gray-500 truncate" }, jo = /* @__PURE__ */ ce({
3068
- __name: "AssetGrid",
3069
- props: {
3070
- assets: {},
3071
- loading: { type: Boolean, default: !1 },
3072
- selectable: { type: Boolean, default: !1 },
3073
- selectedIds: { default: () => /* @__PURE__ */ new Set() },
3074
- view: { default: "grid" },
3075
- variantsByRefId: {},
3076
- unavailableIds: {}
3077
- },
3078
- emits: ["open", "toggle", "delete"],
3079
- setup(e, { emit: t }) {
3080
- const { t: a } = de({ messages: fe }), n = e;
3081
- function r(k) {
3082
- var h;
3083
- if (!k.refId)
3084
- return null;
3085
- const w = (h = n.variantsByRefId) == null ? void 0 : h.get(k.refId);
3086
- return w ? Lr(w.variants) : null;
3087
- }
3088
- function o(k) {
3089
- var h;
3090
- return ((h = n.unavailableIds) == null ? void 0 : h.has(k.id)) ?? !1;
3091
- }
3092
- function s(k) {
3093
- o(k) || c("open", k);
3094
- }
3095
- function i(k) {
3096
- o(k) || c("toggle", k);
3097
- }
3098
- function u(k) {
3099
- return k.tone === "done" ? a("mediaPicker.variants.badgeDone", { count: k.total }) : a("mediaPicker.variants.badgeProgress", { active: k.active, total: k.total });
3100
- }
3101
- const c = t;
3102
- function d(k) {
3103
- var h;
3104
- return ((h = k.split("/")[1]) == null ? void 0 : h.toUpperCase()) ?? k;
3105
- }
3106
- function p(k) {
3107
- return k >= 1024 * 1024 ? `${(k / 1024 / 1024).toFixed(1)} MB` : `${Math.round(k / 1024)} KB`;
3108
- }
3109
- function v(k) {
3110
- const h = Date.now() - new Date(k).getTime(), w = 6e4, D = 36e5, f = 864e5;
3111
- if (h < w)
3112
- return a("mediaPicker.assetGrid.time.justNow");
3113
- if (h < D)
3114
- return a("mediaPicker.assetGrid.time.minutesAgo", { n: Math.floor(h / w) });
3115
- if (h < f)
3116
- return a("mediaPicker.assetGrid.time.hoursAgo", { n: Math.floor(h / D) });
3117
- if (h < f * 8)
3118
- return a("mediaPicker.assetGrid.time.daysAgo", { n: Math.floor(h / f) });
3119
- const g = new Date(k);
3120
- return `${g.getFullYear()}-${String(g.getMonth() + 1).padStart(2, "0")}-${String(g.getDate()).padStart(2, "0")}`;
3121
- }
3122
- return (k, h) => {
3123
- const w = j("FmIcon"), D = j("FmThumbnail"), f = j("FmAvatar"), g = j("FmButton");
3124
- return e.loading ? (x(), T("div", mo, P(O(a)("mediaPicker.assetGrid.loading")), 1)) : e.assets.length === 0 ? (x(), T("div", go, P(O(a)("mediaPicker.assetGrid.empty")), 1)) : e.view === "list" ? (x(), T("div", ho, [
3125
- b("div", bo, [
3126
- h[0] || (h[0] = b("span", null, null, -1)),
3127
- h[1] || (h[1] = b("span", null, null, -1)),
3128
- b("span", null, P(O(a)("mediaPicker.assetGrid.columns.name")), 1),
3129
- b("span", null, P(O(a)("mediaPicker.assetGrid.columns.dimensions")), 1),
3130
- b("span", null, P(O(a)("mediaPicker.assetGrid.columns.fileSize")), 1),
3131
- b("span", null, P(O(a)("mediaPicker.assetGrid.columns.uploader")), 1),
3132
- b("span", null, P(O(a)("mediaPicker.assetGrid.columns.uploadedAt")), 1),
3133
- h[2] || (h[2] = b("span", null, null, -1))
3134
- ]),
3135
- (x(!0), T(X, null, ue(e.assets, (m) => (x(), T("div", {
3136
- key: m.id,
3137
- class: G(["grid grid-cols-[40px_56px_minmax(160px,2.2fr)_110px_90px_150px_120px_40px] items-center gap-8 px-16 h-56 border-b border-fm-color-neutral-gray-200 last:border-b-0 cursor-pointer hover:bg-fm-color-neutral-gray-100", [
3138
- e.selectedIds.has(m.id) ? "bg-[#FFF7F0]" : "bg-white",
3139
- o(m) ? "opacity-40 pointer-events-none" : ""
3140
- ]]),
3141
- onClick: (C) => s(m)
3142
- }, [
3143
- e.selectable ? (x(), T("button", {
3144
- key: 0,
3145
- class: G(["w-[20px] h-[20px] rounded flex items-center justify-center", e.selectedIds.has(m.id) ? "bg-[--fm-color-brand-primary,#FF7823]" : "bg-white border border-fm-color-neutral-gray-200"]),
3146
- onClick: at((C) => i(m), ["stop"])
3147
- }, [
3148
- e.selectedIds.has(m.id) ? (x(), oe(w, {
3149
- key: 0,
3150
- name: "check",
3151
- size: "sm",
3152
- color: "white"
3153
- })) : U("", !0)
3154
- ], 10, vo)) : (x(), T("span", wo)),
3155
- b("div", xo, [
3156
- N(D, {
3157
- src: m.url,
3158
- size: "sm",
3159
- class: "!w-full !h-full"
3160
- }, null, 8, ["src"])
3161
- ]),
3162
- b("div", ko, [
3163
- b("span", Po, P(m.fileName), 1),
3164
- b("div", Eo, [
3165
- b("span", Ro, P(d(m.mimeType)), 1),
3166
- r(m) ? (x(), T("span", {
3167
- key: 0,
3168
- class: G(["text-[11px] font-semibold", {
3169
- "text-fm-color-typo-tertiary": r(m).tone === "done",
3170
- "text-blue-600": r(m).tone === "progress",
3171
- "text-amber-600": r(m).tone === "warning"
3172
- }])
3173
- }, P(u(r(m))), 3)) : U("", !0)
3174
- ])
3175
- ]),
3176
- b("span", So, P(m.width) + "×" + P(m.height), 1),
3177
- b("span", To, P(p(m.fileSizeBytes)), 1),
3178
- b("div", Co, [
3179
- N(f, {
3180
- name: m.uploadedBy,
3181
- size: "sm"
3182
- }, null, 8, ["name"]),
3183
- b("span", Oo, P(m.uploadedBy), 1)
3184
- ]),
3185
- b("span", Ao, P(v(m.createdAt)), 1),
3186
- N(g, {
3187
- variant: "tertiary",
3188
- size: "md",
3189
- "prepend-icon": "delete",
3190
- label: "",
3191
- onClick: at((C) => c("delete", m), ["stop"])
3192
- }, null, 8, ["onClick"])
3193
- ], 10, yo))), 128))
3194
- ])) : (x(), T("div", Bo, [
3195
- (x(!0), T(X, null, ue(e.assets, (m) => (x(), T("div", {
3196
- key: m.id,
3197
- class: G(["cursor-pointer rounded-lg border bg-white overflow-hidden transition-shadow hover:shadow-lg", [
3198
- e.selectedIds.has(m.id) ? "border-2 border-[--fm-color-brand-primary,#FF7823]" : "border-gray-200",
3199
- o(m) ? "opacity-40 pointer-events-none" : ""
3200
- ]]),
3201
- onClick: (C) => s(m)
3202
- }, [
3203
- b("div", Do, [
3204
- N(D, {
3205
- src: m.url,
3206
- size: "xl",
3207
- class: "w-full h-full"
3208
- }, null, 8, ["src"]),
3209
- e.selectable ? (x(), T("button", {
3210
- key: 0,
3211
- class: G(["absolute top-8 left-8 z-10 w-24 h-24 rounded-full flex items-center justify-center", e.selectedIds.has(m.id) ? "bg-[--fm-color-brand-primary,#FF7823]" : "bg-black/30 border border-white/80"]),
3212
- onClick: at((C) => i(m), ["stop"])
3213
- }, [
3214
- e.selectedIds.has(m.id) ? (x(), oe(w, {
3215
- key: 0,
3216
- name: "check",
3217
- size: "sm",
3218
- color: "white"
3219
- })) : U("", !0)
3220
- ], 10, Fo)) : U("", !0),
3221
- b("span", No, P(d(m.mimeType)), 1),
3222
- r(m) ? (x(), T("span", {
3223
- key: 1,
3224
- class: G(["absolute bottom-8 right-8 text-white text-[11px] font-semibold px-[6px] py-[2px] rounded", {
3225
- "bg-black/70": r(m).tone === "done",
3226
- "bg-blue-600/90": r(m).tone === "progress",
3227
- "bg-amber-600/90": r(m).tone === "warning"
3228
- }])
3229
- }, P(u(r(m))), 3)) : U("", !0)
3230
- ]),
3231
- b("div", Uo, [
3232
- b("div", Lo, P(m.fileName), 1),
3233
- b("span", Io, P(m.width) + "×" + P(m.height) + " · " + P(p(m.fileSizeBytes)), 1)
3234
- ])
3235
- ], 10, _o))), 128))
3236
- ]));
3237
- };
3238
- }
3239
- }), Mo = { class: "flex flex-wrap items-center gap-8" }, zo = /* @__PURE__ */ ce({
3240
- __name: "TagFilterTabs",
3241
- props: {
3242
- tags: {},
3243
- total: {},
3244
- modelValue: {}
3245
- },
3246
- emits: ["update:modelValue"],
3247
- setup(e, { emit: t }) {
3248
- const { t: a } = de({ messages: fe }), n = t;
3249
- return (r, o) => {
3250
- const s = j("FmChip");
3251
- return x(), T("div", Mo, [
3252
- N(s, {
3253
- selectable: "",
3254
- selected: e.modelValue === null,
3255
- onClick: o[0] || (o[0] = (i) => n("update:modelValue", null))
3256
- }, {
3257
- default: ke(() => [
3258
- b("span", {
3259
- class: G(["fm-typo-en-body-md-600 flex items-center gap-6", { "text-white": e.modelValue === null }])
3260
- }, [
3261
- he(P(O(a)("mediaPicker.tagFilterTabs.all")) + " ", 1),
3262
- b("span", {
3263
- class: G(["text-[11px] leading-none rounded-full px-6 py-2", e.modelValue === null ? "bg-white/25" : "bg-fm-color-neutral-gray-100"])
3264
- }, P(e.total), 3)
3265
- ], 2)
3266
- ]),
3267
- _: 1
3268
- }, 8, ["selected"]),
3269
- (x(!0), T(X, null, ue(e.tags, (i) => (x(), oe(s, {
3270
- key: i.tag,
3271
- selectable: "",
3272
- selected: e.modelValue === i.tag,
3273
- onClick: (u) => n("update:modelValue", e.modelValue === i.tag ? null : i.tag)
3274
- }, {
3275
- default: ke(() => [
3276
- b("span", {
3277
- class: G(["fm-typo-en-body-md-600 flex items-center gap-6", { "text-white": e.modelValue === i.tag }])
3278
- }, [
3279
- he(P(i.tag) + " ", 1),
3280
- b("span", {
3281
- class: G(["text-[11px] leading-none rounded-full px-6 py-2", e.modelValue === i.tag ? "bg-white/25" : "bg-fm-color-neutral-gray-100"])
3282
- }, P(i.count), 3)
3283
- ], 2)
3284
- ]),
3285
- _: 2
3286
- }, 1032, ["selected", "onClick"]))), 128))
3287
- ]);
3288
- };
3289
- }
3290
- }), Vo = { class: "flex items-center gap-12 py-4 px-2" }, qo = { class: "text-xs font-semibold text-fm-color-typo-secondary shrink-0" }, $o = { class: "flex flex-wrap items-center gap-6" }, Go = ["onClick"], Ho = {
3291
- key: 0,
3292
- class: "text-xs text-fm-color-typo-secondary shrink-0"
3293
- }, Jo = /* @__PURE__ */ ce({
3294
- __name: "RatioPickerBar",
3295
- props: /* @__PURE__ */ lt({
3296
- facts: {},
3297
- locked: { type: Boolean },
3298
- unavailableRatios: {}
3299
- }, {
3300
- modelValue: { default: null },
3301
- modelModifiers: {}
3302
- }),
3303
- emits: ["update:modelValue"],
3304
- setup(e) {
3305
- const { t } = de({ messages: fe }), a = e, n = Wt(e, "modelValue");
3306
- function r(i) {
3307
- var u;
3308
- a.locked || i !== null && (u = a.unavailableRatios) != null && u.has(i) || (n.value = i);
3309
- }
3310
- function o(i) {
3311
- return i.replace("x", ":");
3312
- }
3313
- function s(i, u) {
3314
- var c;
3315
- return u !== void 0 && ((c = a.unavailableRatios) != null && c.has(u)) ? "border-fm-color-neutral-gray-200 text-fm-color-neutral-gray-300 cursor-not-allowed opacity-40" : [
3316
- i ? "border-[--fm-color-brand-primary,#FF7823] text-[--fm-color-brand-primary,#FF7823] bg-[#FFF7F0]" : "border-fm-color-neutral-gray-300 text-gray-500",
3317
- a.locked ? "cursor-not-allowed opacity-60" : ""
3318
- ];
3319
- }
3320
- return (i, u) => (x(), T("div", Vo, [
3321
- b("span", qo, P(O(t)("mediaPicker.ratioBar.label")), 1),
3322
- b("div", $o, [
3323
- b("button", {
3324
- type: "button",
3325
- class: G(["h-[28px] px-12 rounded-full border text-[11px] font-semibold transition-colors", s(n.value === null)]),
3326
- onClick: u[0] || (u[0] = (c) => r(null))
3327
- }, P(O(t)("mediaPicker.variants.original")), 3),
3328
- (x(!0), T(X, null, ue(O(Et), (c) => (x(), T("button", {
3329
- key: c,
3330
- type: "button",
3331
- class: G(["h-[28px] px-12 rounded-full border text-[11px] font-semibold transition-colors", s(n.value === c, c)]),
3332
- onClick: (d) => r(c)
3333
- }, P(o(c)), 11, Go))), 128))
3334
- ]),
3335
- u[1] || (u[1] = b("div", { class: "flex-1" }, null, -1)),
3336
- e.facts ? (x(), T("span", Ho, P(e.facts.dimensions) + " · " + P(O(Mr)(e.facts.sizeBytes)), 1)) : U("", !0)
3337
- ]));
3338
- }
3339
- });
3340
- function xa(e) {
3341
- var t, a;
3342
- const n = (a = (t = e == null ? void 0 : e.response) == null ? void 0 : t.data) == null ? void 0 : a.message;
3343
- return n || (e instanceof Error ? e.message : (e == null ? void 0 : e.message) || String(e));
3344
- }
3345
- function Wo(e) {
3346
- switch (e) {
3347
- case "INSUFFICIENT_TOKENS":
3348
- return "mediaPicker.variants.failedNoTokens";
3349
- case "TOKEN_SERVICE_UNAVAILABLE":
3350
- return "mediaPicker.variants.failedTokenServiceDown";
3351
- default:
3352
- return "mediaPicker.variants.failed";
3353
- }
3354
- }
3355
- const Ko = { class: "space-y-8" }, Xo = { class: "text-xs font-semibold text-gray-500" }, Qo = { class: "flex flex-wrap gap-8" }, Yo = ["onClick"], Zo = { class: "text-[11px] text-gray-400" }, es = /* @__PURE__ */ ce({
3356
- __name: "RatioSelector",
3357
- props: {
3358
- modelValue: {},
3359
- disabled: { type: Boolean }
3360
- },
3361
- emits: ["update:modelValue"],
3362
- setup(e, { emit: t }) {
3363
- const { t: a } = de({ messages: fe }), n = e, r = t;
3364
- function o(i) {
3365
- n.disabled || r(
3366
- "update:modelValue",
3367
- n.modelValue.includes(i) ? n.modelValue.filter((u) => u !== i) : [...n.modelValue, i]
3368
- );
3369
- }
3370
- function s(i) {
3371
- return i.replace("x", ":");
3372
- }
3373
- return (i, u) => (x(), T("div", Ko, [
3374
- b("div", Xo, P(O(a)("mediaPicker.ratios.title")), 1),
3375
- b("div", Qo, [
3376
- (x(!0), T(X, null, ue(O(Et), (c) => (x(), T("button", {
3377
- key: c,
3378
- type: "button",
3379
- class: G(["h-[30px] px-12 rounded-full border text-[11px] font-semibold transition-colors", [
3380
- e.modelValue.includes(c) ? "border-[--fm-color-brand-primary,#FF7823] text-[--fm-color-brand-primary,#FF7823] bg-[#FFF7F0]" : "border-fm-color-neutral-gray-300 text-gray-500",
3381
- e.disabled ? "opacity-50 cursor-not-allowed" : ""
3382
- ]]),
3383
- onClick: (d) => o(c)
3384
- }, P(s(c)), 11, Yo))), 128))
3385
- ]),
3386
- b("div", Zo, P(O(a)("mediaPicker.ratios.hint")), 1)
3387
- ]));
3388
- }
3389
- });
3390
- function Jt(e) {
3391
- return new Promise((t) => {
3392
- const a = new Image();
3393
- a.onload = () => t({ width: a.naturalWidth || 480, height: a.naturalHeight || 360 }), a.onerror = () => t({ width: 480, height: 360 }), a.src = e;
3394
- });
3395
- }
3396
- const ts = { class: "flex flex-wrap items-center gap-8" }, as = {
3397
- key: 1,
3398
- class: "inline-flex items-center gap-4 border rounded-full border-gray-300 pl-8 pr-4 h-[28px]"
3399
- }, ns = ["placeholder"], rs = /* @__PURE__ */ ce({
3400
- __name: "TagFilterBar",
3401
- props: {
3402
- tags: {},
3403
- modelValue: {},
3404
- mode: { default: "filter" }
3405
- },
3406
- emits: ["update:modelValue", "tag-created"],
3407
- setup(e, { emit: t }) {
3408
- const { t: a } = de({ messages: fe }), n = e, r = t;
3409
- function o(u) {
3410
- r("update:modelValue", n.modelValue.includes(u) ? n.modelValue.filter((c) => c !== u) : [...n.modelValue, u]);
3411
- }
3412
- const s = L("");
3413
- function i() {
3414
- const u = s.value.trim();
3415
- s.value = "", u && (n.modelValue.includes(u) || r("update:modelValue", [...n.modelValue, u]), n.tags.includes(u) || r("tag-created", u));
3416
- }
3417
- return (u, c) => {
3418
- const d = j("FmChip"), p = j("FmIcon");
3419
- return x(), T("div", ts, [
3420
- e.mode === "filter" ? (x(), oe(d, {
3421
- key: 0,
3422
- label: O(a)("mediaPicker.tagFilterBar.all"),
3423
- selected: e.modelValue.length === 0,
3424
- selectable: "",
3425
- onClick: c[0] || (c[0] = (v) => r("update:modelValue", []))
3426
- }, null, 8, ["label", "selected"])) : U("", !0),
3427
- (x(!0), T(X, null, ue(e.tags, (v) => (x(), oe(d, {
3428
- key: v,
3429
- label: v,
3430
- selected: e.modelValue.includes(v),
3431
- selectable: "",
3432
- onClick: (k) => o(v)
3433
- }, null, 8, ["label", "selected", "onClick"]))), 128)),
3434
- e.mode === "assign" ? (x(), T("div", as, [
3435
- Ea(b("input", {
3436
- "onUpdate:modelValue": c[1] || (c[1] = (v) => s.value = v),
3437
- placeholder: O(a)("mediaPicker.tagFilterBar.newTagPlaceholder"),
3438
- class: "text-xs outline-none w-[88px]",
3439
- onKeyup: Ra(i, ["enter"])
3440
- }, null, 40, ns), [
3441
- [Sa, s.value]
3442
- ]),
3443
- b("button", {
3444
- class: "p-2",
3445
- onClick: i
3446
- }, [
3447
- N(p, {
3448
- name: "add",
3449
- size: "sm"
3450
- })
3451
- ])
3452
- ])) : U("", !0)
3453
- ]);
3454
- };
3455
- }
3456
- }), os = { class: "space-y-16" }, ss = {
3457
- key: 0,
3458
- class: "space-y-8"
3459
- }, is = { class: "text-xs font-semibold text-gray-500" }, ls = ["src"], us = { class: "flex-1 min-w-0 flex flex-col gap-2" }, cs = { class: "text-xs font-semibold truncate" }, ds = {
3460
- key: 0,
3461
- class: "text-[11px] text-red-600"
3462
- }, ps = {
3463
- key: 1,
3464
- class: "text-[11px] text-gray-500"
3465
- }, fs = ["onClick"], ms = { class: "space-y-8" }, gs = { class: "text-xs font-semibold text-gray-500" }, hs = {
3466
- key: 0,
3467
- class: "flex flex-wrap items-center gap-8"
3468
- }, bs = { class: "text-[11px] text-gray-400" }, ys = ["onClick"], vs = /* @__PURE__ */ ce({
3469
- __name: "UploadPanel",
3470
- props: {
3471
- businessId: {},
3472
- restaurantId: {},
3473
- availableTags: {}
3474
- },
3475
- emits: ["tag-created", "uploaded"],
3476
- setup(e, { expose: t, emit: a }) {
3477
- const { t: n } = de({ messages: fe }), r = e, o = a, s = L([]), i = L([]), u = L([]), c = L(!1), d = H(() => s.value.length), p = H(() => r.availableTags.filter((g) => !i.value.includes(g)).slice(0, 6));
3478
- function v() {
3479
- s.value.forEach((g) => URL.revokeObjectURL(g.previewUrl)), s.value = [], i.value = [], u.value = [];
3480
- }
3481
- async function k(g) {
3482
- const m = URL.createObjectURL(g), C = {
3483
- id: crypto.randomUUID(),
3484
- refId: crypto.randomUUID(),
3485
- file: g,
3486
- previewUrl: m,
3487
- dimensions: null,
3488
- error: null
3489
- };
3490
- s.value.push(C), C.dimensions = await Jt(m);
3491
- }
3492
- function h(g) {
3493
- const m = s.value.find((C) => C.id === g);
3494
- m && URL.revokeObjectURL(m.previewUrl), s.value = s.value.filter((C) => C.id !== g);
3495
- }
3496
- function w(g) {
3497
- return g >= 1024 * 1024 ? `${(g / 1024 / 1024).toFixed(1)} MB` : `${Math.round(g / 1024)} KB`;
3498
- }
3499
- async function D(g) {
3500
- const m = g.dimensions ?? await Jt(g.previewUrl), C = g.file.type || "image/jpeg", B = await Xr(r.businessId, {
3501
- refType: ft,
3502
- refId: g.refId,
3503
- imageId: "main",
3504
- contentType: C,
3505
- fileSize: g.file.size
3506
- }), y = await fetch(B.uploadUrl, { method: "PUT", headers: { "Content-Type": C }, body: g.file });
3507
- if (!y.ok)
3508
- throw new Error(n("mediaPicker.uploadPanel.uploadFailedError", { status: y.status }));
3509
- const _ = await Qr(r.businessId, {
3510
- refType: ft,
3511
- refId: g.refId,
3512
- imageId: "main",
3513
- restaurantId: r.restaurantId,
3514
- fileName: g.file.name,
3515
- width: m.width,
3516
- height: m.height,
3517
- aspectRatios: u.value
3518
- });
3519
- return i.value.length ? await Gr(r.businessId, _.asset.id, i.value) : _.asset;
3520
- }
3521
- async function f() {
3522
- if (!(!s.value.length || !r.businessId)) {
3523
- c.value = !0;
3524
- try {
3525
- const g = s.value, m = await Promise.allSettled(g.map(D)), C = /* @__PURE__ */ new Set(), B = [];
3526
- m.forEach((y, _) => {
3527
- y.status === "rejected" ? (C.add(g[_].id), g[_].error = xa(y.reason)) : B.push(y.value);
3528
- }), s.value = g.filter((y) => C.has(y.id)), B.length > 0 && o("uploaded", B);
3529
- } finally {
3530
- c.value = !1;
3531
- }
3532
- }
3533
- }
3534
- return t({ stagedCount: d, uploading: c, upload: f, reset: v }), (g, m) => {
3535
- const C = j("FmDropField"), B = j("FmIcon");
3536
- return x(), T("div", os, [
3537
- N(C, {
3538
- label: O(n)("mediaPicker.uploadPanel.dropLabel"),
3539
- accept: "image/jpeg,image/png,image/webp",
3540
- "max-file-size": 10 * 1024 * 1024,
3541
- onFileUpload: k
3542
- }, {
3543
- "helper-text": ke(() => [
3544
- he(P(O(n)("mediaPicker.uploadPanel.helperText")), 1)
3545
- ]),
3546
- _: 1
3547
- }, 8, ["label"]),
3548
- N(es, {
3549
- modelValue: u.value,
3550
- "onUpdate:modelValue": m[0] || (m[0] = (y) => u.value = y),
3551
- disabled: c.value
3552
- }, null, 8, ["modelValue", "disabled"]),
3553
- s.value.length ? (x(), T("div", ss, [
3554
- b("div", is, P(O(n)("mediaPicker.uploadPanel.stagedCount", { count: s.value.length })), 1),
3555
- (x(!0), T(X, null, ue(s.value, (y) => (x(), T("div", {
3556
- key: y.id,
3557
- class: G(["flex items-center gap-12 p-8 border rounded-lg", y.error ? "border-red-300 bg-red-50" : "border-fm-color-neutral-gray-200"])
3558
- }, [
3559
- b("img", {
3560
- src: y.previewUrl,
3561
- class: "w-[44px] h-[44px] rounded flex-shrink-0 object-cover"
3562
- }, null, 8, ls),
3563
- b("div", us, [
3564
- b("span", cs, P(y.file.name), 1),
3565
- y.error ? (x(), T("span", ds, P(y.error), 1)) : (x(), T("span", ps, [
3566
- y.dimensions ? (x(), T(X, { key: 0 }, [
3567
- he(P(y.dimensions.width) + "×" + P(y.dimensions.height) + " · ", 1)
3568
- ], 64)) : U("", !0),
3569
- he(P(w(y.file.size)), 1)
3570
- ]))
3571
- ]),
3572
- b("button", {
3573
- class: "w-[28px] h-[28px] rounded flex-shrink-0 flex items-center justify-center text-gray-500 hover:bg-red-50 hover:text-red-600",
3574
- onClick: (_) => h(y.id)
3575
- }, [
3576
- N(B, {
3577
- name: "close",
3578
- size: "sm"
3579
- })
3580
- ], 8, fs)
3581
- ], 2))), 128))
3582
- ])) : U("", !0),
3583
- b("div", ms, [
3584
- b("div", gs, P(O(n)("mediaPicker.uploadPanel.tagsLabel")), 1),
3585
- N(rs, {
3586
- modelValue: i.value,
3587
- "onUpdate:modelValue": m[1] || (m[1] = (y) => i.value = y),
3588
- tags: e.availableTags,
3589
- mode: "assign",
3590
- onTagCreated: m[2] || (m[2] = (y) => o("tag-created", y))
3591
- }, null, 8, ["modelValue", "tags"]),
3592
- p.value.length ? (x(), T("div", hs, [
3593
- b("span", bs, P(O(n)("mediaPicker.uploadPanel.suggestedTagsLabel")), 1),
3594
- (x(!0), T(X, null, ue(p.value, (y) => (x(), T("button", {
3595
- key: y,
3596
- class: "h-[26px] px-12 rounded-full border border-dashed border-fm-color-neutral-gray-300 text-[11px] font-semibold text-gray-500",
3597
- onClick: (_) => i.value.push(y)
3598
- }, " + " + P(y), 9, ys))), 128))
3599
- ])) : U("", !0)
3600
- ])
3601
- ]);
3602
- };
3603
- }
3604
- }), ws = 5e3, xs = 3;
3605
- function ks(e) {
3606
- const t = L(/* @__PURE__ */ new Map());
3607
- let a = [], n, r = 0;
3608
- function o() {
3609
- n !== void 0 && clearTimeout(n), n = void 0;
3610
- }
3611
- async function s() {
3612
- let u = !1;
3613
- try {
3614
- const c = await Kr({ businessId: e(), refType: ft, refIds: a });
3615
- t.value = new Map(c.map((d) => [d.refId, d])), r = 0;
3616
- } catch (c) {
3617
- if (u = !0, r += 1, r >= xs) {
3618
- console.warn("[media-picker] stopped polling image variants after repeated failures", c);
3619
- return;
3620
- }
3621
- }
3622
- ([...t.value.values()].some((c) => Ur(c.variants)) || u) && (n = setTimeout(s, ws));
3623
- }
3624
- async function i(u) {
3625
- if (o(), r = 0, a = u, u.length === 0 || !e()) {
3626
- t.value = /* @__PURE__ */ new Map();
3627
- return;
3628
- }
3629
- await s();
3630
- }
3631
- return Ta(o), { byRefId: t, load: i, stop: o };
3632
- }
3633
- const Ps = { class: "w-full flex items-center justify-between gap-16 pr-8" }, Es = { class: "text-xs font-normal text-fm-color-typo-secondary" }, Rs = { class: "relative" }, Ss = {
3634
- key: 0,
3635
- class: "absolute inset-0 z-10 flex flex-col items-center justify-center gap-12 bg-white/80 rounded"
3636
- }, Ts = { class: "text-sm font-semibold text-[--fm-color-brand-primary,#FF7823]" }, Cs = {
3637
- key: 1,
3638
- class: "flex gap-16 border-b border-fm-color-neutral-gray-200 mb-12"
3639
- }, Os = { class: "flex flex-col w-full" }, As = {
3640
- key: 0,
3641
- class: "border-b border-fm-color-neutral-gray-200 pb-12 mb-12"
3642
- }, Bs = { class: "flex items-center justify-between w-full" }, _s = {
3643
- key: 0,
3644
- class: "text-xs text-fm-color-typo-secondary"
3645
- }, Ds = { key: 1 }, Fs = { class: "flex gap-8" }, vi = /* @__PURE__ */ ce({
3646
- __name: "MediaPickerModal",
3647
- props: {
3648
- open: { type: Boolean },
3649
- businessId: {},
3650
- restaurantId: {},
3651
- selectionMode: { default: "single" },
3652
- ratio: {},
3653
- allowUpload: { type: Boolean, default: !0 }
3654
- },
3655
- emits: ["update:open", "select", "confirm"],
3656
- setup(e, { emit: t }) {
3657
- const { t: a } = de({ messages: fe }), n = e, r = t, o = L("browse");
3658
- ye(
3659
- () => n.allowUpload,
3660
- (E) => {
3661
- E || (o.value = "browse");
3662
- },
3663
- { immediate: !0 }
3664
- );
3665
- const s = L(""), i = L(null), u = L([]), c = ks(() => n.businessId), d = L([]), p = L(0), v = L([]), k = L(!1);
3666
- async function h() {
3667
- if (n.businessId) {
3668
- k.value = !0;
3669
- try {
3670
- const E = await Vr({
3671
- // Never offer an unconfirmed AI draft as a pickable image.
3672
- excludeTags: [va],
3673
- businessId: n.businessId,
3674
- restaurantId: n.restaurantId,
3675
- search: s.value || void 0,
3676
- tags: i.value ? [i.value] : void 0,
3677
- limit: 200,
3678
- sortBy: "createdAt",
3679
- descending: !0
3680
- });
3681
- u.value = E.resources, await c.load(E.resources.map((R) => R.refId).filter((R) => !!R));
3682
- } finally {
3683
- k.value = !1;
3684
- }
3685
- }
3686
- }
3687
- async function w() {
3688
- if (!n.businessId)
3689
- return;
3690
- const [E, R] = await Promise.all([wa(n.businessId), qr(n.businessId)]);
3691
- d.value = E.tags, p.value = E.total, v.value = R;
3692
- }
3693
- ye(
3694
- () => n.open,
3695
- (E) => {
3696
- var R;
3697
- E && (o.value = "browse", s.value = "", i.value = null, B.value = /* @__PURE__ */ new Set(), f.value = n.ratio ?? null, (R = V.value) == null || R.reset(), w(), h());
3698
- }
3699
- ), ye(i, h);
3700
- let D;
3701
- ye(s, () => {
3702
- clearTimeout(D), D = setTimeout(h, 250);
3703
- });
3704
- const f = L(n.ratio ?? null);
3705
- ye(
3706
- () => n.ratio,
3707
- (E) => f.value = E ?? null
3708
- );
3709
- const g = H(() => n.ratio !== void 0 && n.ratio !== null);
3710
- function m(E) {
3711
- var R;
3712
- return E.refId ? ((R = c.byRefId.value.get(E.refId)) == null ? void 0 : R.variants) ?? [] : [];
3713
- }
3714
- const C = H(() => {
3715
- const E = /* @__PURE__ */ new Set();
3716
- if (f.value === null)
3717
- return E;
3718
- for (const R of u.value)
3719
- it(R, f.value, m(R)) || E.add(R.id);
3720
- return E;
3721
- }), B = L(/* @__PURE__ */ new Set());
3722
- function y(E) {
3723
- const R = new Set(B.value);
3724
- R.has(E.id) ? R.delete(E.id) : (n.selectionMode === "single" && R.clear(), R.add(E.id)), B.value = R;
3725
- }
3726
- function _(E) {
3727
- y(E);
3728
- }
3729
- const z = H(
3730
- () => u.value.filter((E) => B.value.has(E.id)).map((E) => it(E, f.value, m(E))).filter((E) => E !== null)
3731
- ), ie = H(() => {
3732
- if (z.value.length !== 1)
3733
- return /* @__PURE__ */ new Set();
3734
- const E = z.value[0].asset, R = m(E);
3735
- return new Set(Et.filter((Z) => !it(E, Z, R)));
3736
- }), q = H(() => {
3737
- if (z.value.length !== 1)
3738
- return null;
3739
- const E = z.value[0];
3740
- if (E.ratio === null)
3741
- return { dimensions: `${E.asset.width}×${E.asset.height}`, sizeBytes: E.asset.fileSizeBytes };
3742
- const R = m(E.asset).find((Z) => Z.aspectRatio === E.ratio);
3743
- return !(R != null && R.width) || !(R != null && R.height) || !R.fileSizeBytes ? null : { dimensions: `${R.width}×${R.height}`, sizeBytes: R.fileSizeBytes };
3744
- });
3745
- function Q() {
3746
- if (n.selectionMode === "single") {
3747
- const E = z.value[0];
3748
- if (!E)
3749
- return;
3750
- r("select", E), r("update:open", !1);
3751
- return;
3752
- }
3753
- r("confirm", z.value), r("update:open", !1);
3754
- }
3755
- const V = L(null);
3756
- async function ve() {
3757
- var E;
3758
- (E = V.value) != null && E.stagedCount || (o.value = "browse"), await Promise.all([h(), w()]);
3759
- }
3760
- return (E, R) => {
3761
- const Z = j("FmSearch"), Y = j("FmButton"), et = j("FmDialog");
3762
- return x(), oe(et, {
3763
- "model-value": e.open,
3764
- "max-width": 900,
3765
- "onUpdate:modelValue": R[8] || (R[8] = (ne) => !ne && r("update:open", !1))
3766
- }, {
3767
- "dialog-header": ke(() => [
3768
- b("div", Ps, [
3769
- b("div", null, [
3770
- b("div", null, P(O(a)("mediaPicker.pickerModal.title")), 1),
3771
- b("div", Es, P(e.selectionMode === "multiple" ? O(a)("mediaPicker.pickerModal.subtitleMultiple") : O(a)("mediaPicker.pickerModal.subtitleSingle")), 1)
3772
- ]),
3773
- o.value === "browse" ? (x(), oe(Z, {
3774
- key: 0,
3775
- modelValue: s.value,
3776
- "onUpdate:modelValue": R[0] || (R[0] = (ne) => s.value = ne),
3777
- placeholder: O(a)("mediaPicker.pickerModal.searchPlaceholder"),
3778
- class: "w-[200px] shrink-0"
3779
- }, null, 8, ["modelValue", "placeholder"])) : U("", !0)
3780
- ])
3781
- ]),
3782
- "dialog-footer": ke(() => {
3783
- var ne, $;
3784
- return [
3785
- b("div", Os, [
3786
- o.value === "browse" && e.selectionMode === "single" ? (x(), T("div", As, [
3787
- N(Jo, {
3788
- modelValue: f.value,
3789
- "onUpdate:modelValue": R[5] || (R[5] = (I) => f.value = I),
3790
- facts: q.value,
3791
- locked: g.value,
3792
- "unavailable-ratios": ie.value
3793
- }, null, 8, ["modelValue", "facts", "locked", "unavailable-ratios"])
3794
- ])) : U("", !0),
3795
- b("div", Bs, [
3796
- o.value === "browse" ? (x(), T("span", _s, [
3797
- B.value.size ? (x(), T(X, { key: 0 }, [
3798
- he(P(O(a)("mediaPicker.pickerModal.selectedCount", { count: B.value.size })), 1)
3799
- ], 64)) : (x(), T(X, { key: 1 }, [
3800
- he(P(O(a)("mediaPicker.pickerModal.selectPrompt")), 1)
3801
- ], 64))
3802
- ])) : (x(), T("span", Ds)),
3803
- b("div", Fs, [
3804
- N(Y, {
3805
- label: O(a)("mediaPicker.pickerModal.cancelButton"),
3806
- variant: "tertiary",
3807
- onClick: R[6] || (R[6] = (I) => r("update:open", !1))
3808
- }, null, 8, ["label"]),
3809
- o.value === "upload" ? (x(), oe(Y, {
3810
- key: 0,
3811
- label: O(a)("mediaPicker.pickerModal.uploadSubmitButton", { count: ((ne = V.value) == null ? void 0 : ne.stagedCount) ?? 0 }),
3812
- variant: "primary",
3813
- disabled: !(($ = V.value) != null && $.stagedCount) || V.value.uploading,
3814
- onClick: R[7] || (R[7] = (I) => {
3815
- var le;
3816
- return (le = V.value) == null ? void 0 : le.upload();
3817
- })
3818
- }, null, 8, ["label", "disabled"])) : (x(), oe(Y, {
3819
- key: 1,
3820
- label: O(a)("mediaPicker.pickerModal.confirmButton"),
3821
- variant: "primary",
3822
- disabled: z.value.length === 0,
3823
- onClick: Q
3824
- }, null, 8, ["label", "disabled"]))
3825
- ])
3826
- ])
3827
- ])
3828
- ];
3829
- }),
3830
- default: ke(() => {
3831
- var ne;
3832
- return [
3833
- b("div", Rs, [
3834
- (ne = V.value) != null && ne.uploading ? (x(), T("div", Ss, [
3835
- R[9] || (R[9] = b("svg", {
3836
- class: "animate-spin w-[32px] h-[32px] text-[--fm-color-brand-primary,#FF7823]",
3837
- xmlns: "http://www.w3.org/2000/svg",
3838
- fill: "none",
3839
- viewBox: "0 0 24 24"
3840
- }, [
3841
- b("circle", {
3842
- class: "opacity-25",
3843
- cx: "12",
3844
- cy: "12",
3845
- r: "10",
3846
- stroke: "currentColor",
3847
- "stroke-width": "3"
3848
- }),
3849
- b("path", {
3850
- class: "opacity-75",
3851
- fill: "currentColor",
3852
- d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"
3853
- })
3854
- ], -1)),
3855
- b("span", Ts, P(O(a)("mediaPicker.uploadPanel.uploading")), 1)
3856
- ])) : U("", !0),
3857
- e.allowUpload ? (x(), T("div", Cs, [
3858
- b("button", {
3859
- class: G(["pb-8 px-4 text-sm", o.value === "browse" ? "font-semibold border-b-2 border-[--fm-color-brand-primary,#FF7823]" : "text-gray-500"]),
3860
- onClick: R[1] || (R[1] = ($) => o.value = "browse")
3861
- }, P(O(a)("mediaPicker.pickerModal.browseTab")), 3),
3862
- b("button", {
3863
- class: G(["pb-8 px-4 text-sm", o.value === "upload" ? "font-semibold border-b-2 border-[--fm-color-brand-primary,#FF7823]" : "text-gray-500"]),
3864
- onClick: R[2] || (R[2] = ($) => o.value = "upload")
3865
- }, P(O(a)("mediaPicker.pickerModal.uploadTab")), 3)
3866
- ])) : U("", !0),
3867
- o.value === "browse" ? (x(), T(X, { key: 2 }, [
3868
- d.value.length ? (x(), oe(zo, {
3869
- key: 0,
3870
- modelValue: i.value,
3871
- "onUpdate:modelValue": R[3] || (R[3] = ($) => i.value = $),
3872
- tags: d.value,
3873
- total: p.value,
3874
- class: "mb-12"
3875
- }, null, 8, ["modelValue", "tags", "total"])) : U("", !0),
3876
- N(jo, {
3877
- assets: u.value,
3878
- loading: k.value,
3879
- selectable: "",
3880
- "selected-ids": B.value,
3881
- "variants-by-ref-id": O(c).byRefId.value,
3882
- "unavailable-ids": C.value,
3883
- onOpen: _,
3884
- onToggle: y
3885
- }, null, 8, ["assets", "loading", "selected-ids", "variants-by-ref-id", "unavailable-ids"])
3886
- ], 64)) : e.allowUpload ? (x(), oe(vs, {
3887
- key: 3,
3888
- ref_key: "uploadPanelRef",
3889
- ref: V,
3890
- "business-id": e.businessId,
3891
- "restaurant-id": e.restaurantId,
3892
- "available-tags": v.value,
3893
- onTagCreated: R[4] || (R[4] = ($) => v.value.push($)),
3894
- onUploaded: ve
3895
- }, null, 8, ["business-id", "restaurant-id", "available-tags"])) : U("", !0)
3896
- ])
3897
- ];
3898
- }),
3899
- _: 1
3900
- }, 8, ["model-value"]);
3901
- };
3902
- }
3903
- }), wi = 60;
3904
- function Ns(e, t) {
3905
- return (e - 1) * t;
3906
- }
3907
- function Us(e, t, a) {
3908
- if (a === 0)
3909
- return { start: 0, end: 0 };
3910
- const n = Ns(e, t) + 1;
3911
- return { start: n, end: Math.min(n + t - 1, a) };
3912
- }
3913
- function xi(e, t) {
3914
- return Math.min(Math.max(e, 1), Math.max(t, 1));
3915
- }
3916
- function Ls(e) {
3917
- return Array.from({ length: Math.max(e, 0) }, (t, a) => ({
3918
- label: String(a + 1),
3919
- value: a + 1
3920
- }));
3921
- }
3922
- const Is = {
3923
- key: 0,
3924
- class: "flex items-center justify-between gap-24 mt-16 flex-wrap"
3925
- }, js = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Ms = { class: "flex gap-8 items-center" }, zs = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary" }, ki = /* @__PURE__ */ ce({
3926
- __name: "AssetPagination",
3927
- props: {
3928
- page: {},
3929
- pageSize: {},
3930
- totalResources: {},
3931
- totalPages: {},
3932
- disabled: { type: Boolean, default: !1 }
3933
- },
3934
- emits: ["update:page"],
3935
- setup(e, { emit: t }) {
3936
- const a = e, n = t, { t: r } = de({ messages: fe }), o = H(() => Us(a.page, a.pageSize, a.totalResources)), s = H(() => Ls(a.totalPages)), i = H(() => a.page <= 1), u = H(() => a.page >= a.totalPages);
3937
- function c(d) {
3938
- d === a.page || d < 1 || d > a.totalPages || n("update:page", d);
3939
- }
3940
- return (d, p) => {
3941
- const v = j("FmSelect"), k = j("FmButton");
3942
- return e.totalPages > 1 ? (x(), T("div", Is, [
3943
- b("span", js, P(O(r)("mediaPicker.assetPagination.itemCount", { start: o.value.start, end: o.value.end, total: e.totalResources })), 1),
3944
- b("div", Ms, [
3945
- N(v, {
3946
- items: s.value,
3947
- "model-value": e.page,
3948
- disabled: e.disabled,
3949
- "onUpdate:modelValue": p[0] || (p[0] = (h) => c(h))
3950
- }, null, 8, ["items", "model-value", "disabled"]),
3951
- b("span", zs, P(O(r)("mediaPicker.assetPagination.pageCount", { total: e.totalPages })), 1),
3952
- N(k, {
3953
- icon: "chevron_left",
3954
- "icon-color": "neutral-black",
3955
- variant: "tertiary",
3956
- disabled: e.disabled || i.value,
3957
- onClick: p[1] || (p[1] = (h) => c(e.page - 1))
3958
- }, null, 8, ["disabled"]),
3959
- N(k, {
3960
- icon: "chevron_right",
3961
- "icon-color": "neutral-black",
3962
- variant: "tertiary",
3963
- disabled: e.disabled || u.value,
3964
- onClick: p[2] || (p[2] = (h) => c(e.page + 1))
3965
- }, null, 8, ["disabled"])
3966
- ])
3967
- ])) : U("", !0);
3968
- };
3969
- }
3970
- }), Vs = { class: "relative flex-1 min-w-0 bg-gray-900 flex items-center justify-center overflow-hidden" }, qs = ["src", "alt"], $s = {
3971
- key: 1,
3972
- class: "flex flex-col items-center gap-12 text-center px-24"
3973
- }, Gs = { class: "text-sm text-white" }, Hs = { class: "absolute top-8 left-8 bg-black/70 text-white text-[11px] font-semibold px-8 py-[2px] rounded" }, Js = { class: "absolute bottom-12 left-1/2 -translate-x-1/2 flex items-center gap-8" }, Ws = ["onClick"], Ks = /* @__PURE__ */ ce({
3974
- __name: "VariantCarousel",
3975
- props: /* @__PURE__ */ lt({
3976
- original: {},
3977
- variants: {},
3978
- alt: {}
3979
- }, {
3980
- index: { default: 0 },
3981
- indexModifiers: {}
3982
- }),
3983
- emits: /* @__PURE__ */ lt(["regenerate"], ["update:index"]),
3984
- setup(e, { emit: t }) {
3985
- const { t: a } = de({ messages: fe }), n = e, r = t, o = Wt(e, "index"), s = H(() => ya(n.original, n.variants));
3986
- ye(s, (d) => {
3987
- o.value > d.length - 1 && (o.value = d.length - 1);
3988
- });
3989
- const i = H(() => s.value[o.value]);
3990
- function u(d) {
3991
- const p = s.value.length;
3992
- o.value = (o.value + d + p) % p;
3993
- }
3994
- function c(d) {
3995
- return d ? d.replace("x", ":") : "";
3996
- }
3997
- return (d, p) => {
3998
- var v, k, h, w;
3999
- const D = j("FmIcon"), f = j("FmButton");
4000
- return x(), T("div", Vs, [
4001
- (v = i.value) != null && v.url ? (x(), T("img", {
4002
- key: 0,
4003
- src: i.value.url,
4004
- alt: e.alt,
4005
- class: "max-w-full max-h-full object-contain"
4006
- }, null, 8, qs)) : i.value ? (x(), T("div", $s, [
4007
- N(D, {
4008
- name: "error",
4009
- size: "lg",
4010
- color: "white"
4011
- }),
4012
- b("span", Gs, P(O(a)(O(Wo)(i.value.failureCode))), 1),
4013
- N(f, {
4014
- label: O(a)("mediaPicker.variants.regenerate"),
4015
- variant: "secondary",
4016
- size: "md",
4017
- "prepend-icon": "refresh",
4018
- onClick: p[0] || (p[0] = (g) => i.value.ratio && r("regenerate", i.value.ratio))
4019
- }, null, 8, ["label"])
4020
- ])) : U("", !0),
4021
- b("span", Hs, [
4022
- he(P(((k = i.value) == null ? void 0 : k.kind) === "original" ? O(a)("mediaPicker.variants.original") : c(((h = i.value) == null ? void 0 : h.ratio) ?? null)) + " ", 1),
4023
- ((w = i.value) == null ? void 0 : w.status) === "pending" ? (x(), T(X, { key: 0 }, [
4024
- he(" · " + P(O(a)("mediaPicker.variants.generating")), 1)
4025
- ], 64)) : U("", !0)
4026
- ]),
4027
- s.value.length > 1 ? (x(), T(X, { key: 2 }, [
4028
- b("button", {
4029
- class: "absolute left-8 top-1/2 -translate-y-1/2 w-[32px] h-[32px] rounded-full bg-black/50 flex items-center justify-center",
4030
- onClick: p[1] || (p[1] = (g) => u(-1))
4031
- }, [
4032
- N(D, {
4033
- name: "chevron_left",
4034
- size: "sm",
4035
- color: "white"
4036
- })
4037
- ]),
4038
- b("button", {
4039
- class: "absolute right-8 top-1/2 -translate-y-1/2 w-[32px] h-[32px] rounded-full bg-black/50 flex items-center justify-center",
4040
- onClick: p[2] || (p[2] = (g) => u(1))
4041
- }, [
4042
- N(D, {
4043
- name: "chevron_right",
4044
- size: "sm",
4045
- color: "white"
4046
- })
4047
- ]),
4048
- b("div", Js, [
4049
- (x(!0), T(X, null, ue(s.value, (g, m) => (x(), T("button", {
4050
- key: g.key,
4051
- class: G(["w-[8px] h-[8px] rounded-full", m === o.value ? "bg-white" : "bg-white/40"]),
4052
- onClick: (C) => o.value = m
4053
- }, null, 10, Ws))), 128))
4054
- ])
4055
- ], 64)) : U("", !0)
4056
- ]);
4057
- };
4058
- }
4059
- }), Xs = {
4060
- key: 0,
4061
- class: "flex h-[620px]"
4062
- }, Qs = { class: "w-[320px] flex-shrink-0 flex flex-col gap-12 p-16 overflow-y-auto" }, Ys = {
4063
- key: 0,
4064
- class: "text-sm text-red-600 bg-red-50 rounded-lg px-12 py-8"
4065
- }, Zs = { class: "flex items-center justify-between" }, ei = { class: "fm-typo-en-title-sm-600" }, ti = {
4066
- key: 1,
4067
- class: "flex items-start gap-8"
4068
- }, ai = { class: "flex-1 text-sm font-semibold break-all" }, ni = {
4069
- key: 2,
4070
- class: "flex gap-8"
4071
- }, ri = { class: "text-xs space-y-8 border-t pt-8" }, oi = { class: "flex justify-between" }, si = { class: "text-gray-500" }, ii = { class: "font-semibold" }, li = { class: "flex justify-between" }, ui = { class: "text-gray-500" }, ci = { class: "flex justify-between" }, di = { class: "text-gray-500" }, pi = { class: "flex justify-between" }, fi = { class: "text-gray-500" }, mi = {
4072
- key: 3,
4073
- class: "flex flex-wrap gap-4"
4074
- }, gi = { class: "flex gap-8 border-t pt-12" }, Pi = /* @__PURE__ */ ce({
4075
- __name: "AssetDetailDialog",
4076
- props: {
4077
- asset: {},
4078
- businessId: {},
4079
- image: {}
4080
- },
4081
- emits: ["close", "renamed", "deleted", "changed"],
4082
- setup(e, { emit: t }) {
4083
- const a = Oa(), { t: n } = de({ messages: fe }), r = e, o = t, s = L(!1), i = L("");
4084
- ye(
4085
- () => r.asset,
4086
- (y) => {
4087
- s.value = !1, i.value = (y == null ? void 0 : y.fileName) ?? "";
4088
- }
4089
- );
4090
- function u() {
4091
- var y;
4092
- i.value = ((y = r.asset) == null ? void 0 : y.fileName) ?? "", s.value = !0;
4093
- }
4094
- async function c() {
4095
- r.asset && (await $r(r.businessId, r.asset.id, i.value), s.value = !1, o("renamed"));
4096
- }
4097
- function d() {
4098
- if (!r.asset)
4099
- return;
4100
- const y = r.asset;
4101
- a.open({
4102
- title: n("mediaPicker.assetDetailDialog.deleteDialogTitle"),
4103
- message: n("mediaPicker.assetDetailDialog.deleteDialogMessage", {
4104
- fileName: y.fileName,
4105
- disclaimer: n("mediaPicker.assetDetailDialog.deleteDisclaimer")
4106
- }),
4107
- primaryActions: { text: n("mediaPicker.assetDetailDialog.deleteConfirmButton"), close: !1, variant: "destructive" },
4108
- secondaryActions: { text: n("mediaPicker.assetDetailDialog.cancelButton"), close: !0 }
4109
- }).onPrimary(async () => {
4110
- await Yr(r.businessId, y), o("deleted", y.id), a.close();
4111
- });
4112
- }
4113
- const p = L(0), v = H(() => {
4114
- var y, _, z, ie, q, Q;
4115
- return {
4116
- url: ((y = r.image) == null ? void 0 : y.original.url) ?? ((_ = r.asset) == null ? void 0 : _.url) ?? "",
4117
- width: ((z = r.image) == null ? void 0 : z.original.width) ?? ((ie = r.asset) == null ? void 0 : ie.width),
4118
- height: ((q = r.image) == null ? void 0 : q.original.height) ?? ((Q = r.asset) == null ? void 0 : Q.height)
4119
- };
4120
- }), k = H(
4121
- () => {
4122
- var y;
4123
- return r.asset ? ya(v.value, ((y = r.image) == null ? void 0 : y.variants) ?? []) : [];
4124
- }
4125
- );
4126
- ye(() => {
4127
- var y;
4128
- return (y = r.asset) == null ? void 0 : y.id;
4129
- }, () => p.value = 0);
4130
- const h = H(() => {
4131
- var y;
4132
- const _ = k.value[p.value];
4133
- return !_ || !r.asset ? null : jr(_, r.asset, ((y = r.image) == null ? void 0 : y.variants) ?? []);
4134
- }), w = H(
4135
- () => {
4136
- var y;
4137
- return (y = h.value) != null && y.ratio ? h.value.ratio.replace("x", ":") : n("mediaPicker.variants.original");
4138
- }
4139
- ), D = L(!1), f = L(null);
4140
- async function g(y) {
4141
- var _;
4142
- if (!(!((_ = r.asset) != null && _.refType) || !r.asset.refId || D.value)) {
4143
- D.value = !0, f.value = null;
4144
- try {
4145
- await Jr(r.businessId, {
4146
- refType: r.asset.refType,
4147
- refId: r.asset.refId,
4148
- imageId: r.asset.imageId ?? "main",
4149
- aspectRatios: [y],
4150
- mode: "append"
4151
- }), o("changed");
4152
- } catch (z) {
4153
- f.value = xa(z);
4154
- } finally {
4155
- D.value = !1;
4156
- }
4157
- }
4158
- }
4159
- function m() {
4160
- var y;
4161
- h.value && ((y = navigator.clipboard) == null || y.writeText(h.value.url));
4162
- }
4163
- function C(y) {
4164
- var _;
4165
- return ((_ = y.split("/")[1]) == null ? void 0 : _.toUpperCase()) ?? y;
4166
- }
4167
- function B(y) {
4168
- return y >= 1024 * 1024 ? `${(y / 1024 / 1024).toFixed(1)} MB` : `${Math.round(y / 1024)} KB`;
4169
- }
4170
- return (y, _) => {
4171
- const z = j("FmIcon"), ie = j("FmTextField"), q = j("FmButton"), Q = j("FmDialog");
4172
- return x(), oe(Q, {
4173
- "model-value": !!e.asset,
4174
- "max-width": 920,
4175
- "max-height": "620px",
4176
- "content-class": "!p-0 asset-preview-dialog-content",
4177
- "close-button": !1,
4178
- "onUpdate:modelValue": _[3] || (_[3] = (V) => !V && o("close"))
4179
- }, {
4180
- default: ke(() => {
4181
- var V, ve, E, R, Z;
4182
- return [
4183
- e.asset ? (x(), T("div", Xs, [
4184
- N(Ks, {
4185
- index: p.value,
4186
- "onUpdate:index": _[0] || (_[0] = (Y) => p.value = Y),
4187
- original: v.value,
4188
- variants: ((V = e.image) == null ? void 0 : V.variants) ?? [],
4189
- alt: e.asset.fileName,
4190
- onRegenerate: g
4191
- }, null, 8, ["index", "original", "variants", "alt"]),
4192
- b("div", Qs, [
4193
- f.value ? (x(), T("p", Ys, P(f.value), 1)) : U("", !0),
4194
- b("div", Zs, [
4195
- b("span", ei, P(O(n)("mediaPicker.assetDetailDialog.previewTitle")), 1),
4196
- b("button", {
4197
- class: "w-[32px] h-[32px] rounded-lg bg-fm-color-neutral-gray-100 flex items-center justify-center flex-shrink-0",
4198
- onClick: _[1] || (_[1] = (Y) => o("close"))
4199
- }, [
4200
- N(z, {
4201
- name: "close",
4202
- size: "sm"
4203
- })
4204
- ])
4205
- ]),
4206
- s.value ? (x(), T("div", ni, [
4207
- N(ie, {
4208
- modelValue: i.value,
4209
- "onUpdate:modelValue": _[2] || (_[2] = (Y) => i.value = Y),
4210
- class: "flex-1 min-w-0"
4211
- }, null, 8, ["modelValue"]),
4212
- N(q, {
4213
- label: O(n)("mediaPicker.assetDetailDialog.saveButton"),
4214
- variant: "primary",
4215
- size: "md",
4216
- class: "flex-shrink-0",
4217
- onClick: c
4218
- }, null, 8, ["label"])
4219
- ])) : (x(), T("div", ti, [
4220
- b("span", ai, P(e.asset.fileName), 1),
4221
- b("button", { onClick: u }, [
4222
- N(z, {
4223
- name: "edit",
4224
- size: "sm"
4225
- })
4226
- ])
4227
- ])),
4228
- b("div", ri, [
4229
- b("div", oi, [
4230
- b("span", si, P(O(n)("mediaPicker.ratios.title")), 1),
4231
- b("span", ii, P(w.value), 1)
4232
- ]),
4233
- b("div", li, [
4234
- b("span", ui, P(O(n)("mediaPicker.assetDetailDialog.dimensionsLabel")), 1),
4235
- b("span", null, P(((ve = h.value) == null ? void 0 : ve.dimensions) ?? "—"), 1)
4236
- ]),
4237
- b("div", ci, [
4238
- b("span", di, P(O(n)("mediaPicker.assetDetailDialog.sizeLabel")), 1),
4239
- b("span", null, P((E = h.value) != null && E.sizeBytes ? B(h.value.sizeBytes) : "—"), 1)
4240
- ]),
4241
- b("div", pi, [
4242
- b("span", fi, P(O(n)("mediaPicker.assetDetailDialog.formatLabel")), 1),
4243
- b("span", null, P((R = h.value) != null && R.contentType ? C(h.value.contentType) : "—"), 1)
4244
- ])
4245
- ]),
4246
- (Z = e.asset.tags) != null && Z.length ? (x(), T("div", mi, [
4247
- (x(!0), T(X, null, ue(e.asset.tags, (Y) => (x(), T("span", {
4248
- key: Y,
4249
- class: "text-[11px] bg-gray-100 rounded-full px-8 py-[2px]"
4250
- }, " # " + P(Y), 1))), 128))
4251
- ])) : U("", !0),
4252
- _[4] || (_[4] = b("div", { class: "flex-1" }, null, -1)),
4253
- b("div", gi, [
4254
- N(q, {
4255
- label: O(n)("mediaPicker.assetDetailDialog.copyLinkButton"),
4256
- variant: "tertiary",
4257
- size: "md",
4258
- "prepend-icon": "link",
4259
- class: "flex-1",
4260
- onClick: m
4261
- }, null, 8, ["label"]),
4262
- N(q, {
4263
- label: O(n)("mediaPicker.assetDetailDialog.deleteButton"),
4264
- variant: "destructive",
4265
- size: "md",
4266
- "prepend-icon": "delete",
4267
- onClick: d
4268
- }, null, 8, ["label"])
4269
- ])
4270
- ])
4271
- ])) : U("", !0)
4272
- ];
4273
- }),
4274
- _: 1
4275
- }, 8, ["model-value"]);
4276
- };
4277
- }
4278
- });
4279
- export {
4280
- Pi as A,
4281
- ki as C,
4282
- xi as E,
4283
- qr as H,
4284
- Gr as J,
4285
- Ns as L,
4286
- jo as M,
4287
- vi as S,
4288
- wi as T,
4289
- zr as V,
4290
- Wr as X,
4291
- ks as _,
4292
- rs as a,
4293
- Yr as e,
4294
- Vr as q,
4295
- va as v,
4296
- vs as x
4297
- };