@feedmepos/mf-miniprogram-v2 0.2.8-dev.2 → 0.2.8-dev.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{App-C8Vn8LvE.js → App-dgkwfArX.js} +337 -338
- package/dist/{BrandFontPicker-JHyoGusq.js → BrandFontPicker-CF3O3meB.js} +1 -1
- package/dist/BrandKitView-CdLMBZKd.js +276 -0
- package/dist/ControlPlaneView-BDPzyv_Z.js +27172 -0
- package/dist/{EcosystemView-XP9IZ9wn.js → EcosystemView-DHtS5IDN.js} +115 -93
- package/dist/MobileProjectDialog-Bt6r-bHC.js +446 -0
- package/dist/MobileProjectsView-Dvj7YKlO.js +237 -0
- package/dist/ModuleCenterView-t8rhd419.js +283 -0
- package/dist/ModuleDetailView-CcqJ4Hfu.js +296 -0
- package/dist/{PagesView-DzDqCd8N.js → PagesView-D0RMTyqw.js} +2 -2
- package/dist/{PlatformUnavailableView-CdHjkolw.js → PlatformUnavailableView-OHEJAztd.js} +1 -1
- package/dist/{PortalSettingsView-Df5jChmi.js → PortalSettingsView-B68s6fiS.js} +3 -3
- package/dist/StatusBadge.vue_vue_type_script_setup_true_lang-DMm_s9ua.js +41 -0
- package/dist/TemplateCenterView-Cpr39Y5S.js +515 -0
- package/dist/{WorkspaceEntryView-DQkYJWdf.js → WorkspaceEntryView-gM7RX5BV.js} +2 -2
- package/dist/app.js +15 -15
- package/dist/{controlPlane-sXaC6pAh.js → controlPlane-DR5ykj4d.js} +8 -8
- package/dist/{adminAccess-D2K-L-Vt.js → localPreference-Do4VKtxT.js} +35 -35
- package/dist/package.json +1 -1
- package/dist/{portalContext-DV-6uUwp.js → portalContext-BeKN8Bcx.js} +2 -2
- package/dist/portalNavigation-DLcC7Koh.js +43 -0
- package/dist/{routes-CeuodIgg.js → routes-B9oMJsaM.js} +45 -27
- package/dist/style.css +1 -1
- package/dist/{useBrandKit-CXLIXo5j.js → useBrandKit-MkgkEuIX.js} +265 -233
- package/dist/useModuleCatalog-Daw8KA--.js +147 -0
- package/package.json +1 -1
- package/dist/AppTemplatePicker.vue_vue_type_script_setup_true_lang-LE_aKvfg.js +0 -198
- package/dist/BrandKitView-Dlt_ifI0.js +0 -249
- package/dist/ControlPlaneView-qDA8RgiR.js +0 -25317
- package/dist/MobileProjectsView-aAyHV5G-.js +0 -333
- package/dist/ModuleCenterView-C6mCPATr.js +0 -147
- package/dist/ModuleDetailView-CSfMF0Uo.js +0 -189
- package/dist/StatusBadge.vue_vue_type_script_setup_true_lang-CMgQ0bd_.js +0 -30
- package/dist/TemplateCenterView-DrWImUYO.js +0 -425
- package/dist/portalNavigation-C29ihtq_.js +0 -38
- package/dist/useModuleCatalog-Cep-pzWO.js +0 -124
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { computed as
|
|
3
|
-
import { h as
|
|
4
|
-
import { useCoreStore as
|
|
5
|
-
import { g as
|
|
6
|
-
const
|
|
1
|
+
import { a as At, e as Nt } from "./index-CIJWcl_6.js";
|
|
2
|
+
import { computed as L, reactive as Tt } from "vue";
|
|
3
|
+
import { h as R, e as it } from "./controlPlane-DR5ykj4d.js";
|
|
4
|
+
import { useCoreStore as kt } from "@feedmepos/mf-common";
|
|
5
|
+
import { g as Ct, c as Mt } from "./_commonjsHelpers-DaMA6jEr.js";
|
|
6
|
+
const at = [
|
|
7
7
|
"Inter",
|
|
8
8
|
"Roboto",
|
|
9
9
|
"Open Sans",
|
|
@@ -26,18 +26,18 @@ const it = [
|
|
|
26
26
|
"Noto Sans SC",
|
|
27
27
|
"Noto Sans TC"
|
|
28
28
|
];
|
|
29
|
-
function
|
|
29
|
+
function It(e) {
|
|
30
30
|
var i;
|
|
31
31
|
return ((i = e.split(",")[0]) == null ? void 0 : i.trim().replace(/^(['"])(.*)\1$/, "$2")) || "App default";
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function Fe(e) {
|
|
34
34
|
const i = ["Playfair Display", "Merriweather", "Lora"].includes(e) ? "serif" : "sans-serif";
|
|
35
35
|
return `'${e}', ${i === "serif" ? "" : "system-ui, "}${i}`;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function yt(e) {
|
|
38
38
|
return `https://fonts.googleapis.com/css2?${[...new Set(e)].sort().map((s) => `family=${encodeURIComponent(s)}:wght@400;500;600;700`).join("&")}&display=swap`;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function Bt(e) {
|
|
41
41
|
if (!e || typeof e != "object" || !("stylesheet" in e) || typeof e.stylesheet != "string")
|
|
42
42
|
return !1;
|
|
43
43
|
try {
|
|
@@ -45,7 +45,7 @@ function Mt(e) {
|
|
|
45
45
|
if (i.hostname !== "fonts.googleapis.com" || !["/css", "/css2"].includes(i.pathname)) return !1;
|
|
46
46
|
const s = i.searchParams.getAll("family").flatMap((r) => r.split("|"));
|
|
47
47
|
return s.length > 0 && s.every(
|
|
48
|
-
(r) =>
|
|
48
|
+
(r) => at.some((n) => {
|
|
49
49
|
var o;
|
|
50
50
|
return n.toLowerCase() === ((o = r.split(":")[0]) == null ? void 0 : o.trim().toLowerCase());
|
|
51
51
|
})
|
|
@@ -54,26 +54,26 @@ function Mt(e) {
|
|
|
54
54
|
return !1;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function Dt(e, i) {
|
|
58
58
|
const s = ["brand", "heading", "body"].flatMap(
|
|
59
59
|
(n) => (i[n] || "").split(",").flatMap((o) => {
|
|
60
|
-
const u =
|
|
60
|
+
const u = at.find((d) => d.toLowerCase() === It(o).toLowerCase());
|
|
61
61
|
return u ? [u] : [];
|
|
62
62
|
})
|
|
63
|
-
), r = Array.isArray(e) ? e.filter((n) => !
|
|
64
|
-
return s.length ? [...r, { stylesheet:
|
|
63
|
+
), r = Array.isArray(e) ? e.filter((n) => !Bt(n)) : [];
|
|
64
|
+
return s.length ? [...r, { stylesheet: yt(s) }] : r;
|
|
65
65
|
}
|
|
66
|
-
const
|
|
67
|
-
function
|
|
68
|
-
if (!
|
|
69
|
-
const i =
|
|
66
|
+
const Q = /* @__PURE__ */ new Map();
|
|
67
|
+
function Oe(e) {
|
|
68
|
+
if (!at.some((r) => r === e)) return Promise.resolve();
|
|
69
|
+
const i = Q.get(e);
|
|
70
70
|
if (i) return i;
|
|
71
71
|
const s = new Promise((r, n) => {
|
|
72
72
|
const o = document.createElement("link");
|
|
73
|
-
o.rel = "stylesheet", o.href =
|
|
73
|
+
o.rel = "stylesheet", o.href = yt([e]);
|
|
74
74
|
let u = !1;
|
|
75
75
|
const d = window.setTimeout(() => v(), 15e3), v = () => {
|
|
76
|
-
u || (u = !0, window.clearTimeout(d), o.remove(),
|
|
76
|
+
u || (u = !0, window.clearTimeout(d), o.remove(), Q.delete(e), n(new Error(`Could not load ${e}`)));
|
|
77
77
|
};
|
|
78
78
|
o.onerror = v, o.onload = () => {
|
|
79
79
|
document.fonts.load(`400 16px "${e}"`).then((m) => {
|
|
@@ -84,13 +84,13 @@ function ve(e) {
|
|
|
84
84
|
}, v);
|
|
85
85
|
}, document.head.append(o);
|
|
86
86
|
});
|
|
87
|
-
return
|
|
87
|
+
return Q.set(e, s), s;
|
|
88
88
|
}
|
|
89
|
-
var
|
|
89
|
+
var mt = { exports: {} };
|
|
90
90
|
(function(e, i) {
|
|
91
91
|
(function(s, r) {
|
|
92
92
|
e.exports = r();
|
|
93
|
-
})(
|
|
93
|
+
})(Mt, function() {
|
|
94
94
|
return function(s) {
|
|
95
95
|
var r = {};
|
|
96
96
|
function n(o) {
|
|
@@ -144,11 +144,11 @@ var yt = { exports: {} };
|
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
146
|
n.r(r), n.d(r, "default", function() {
|
|
147
|
-
return
|
|
147
|
+
return xt;
|
|
148
148
|
}), n.d(r, "compare", function() {
|
|
149
149
|
return ct;
|
|
150
150
|
}), n.d(r, "comparable", function() {
|
|
151
|
-
return
|
|
151
|
+
return Y;
|
|
152
152
|
});
|
|
153
153
|
var d = u("Array"), v = u("Object"), m = u("Function");
|
|
154
154
|
function b(t, a) {
|
|
@@ -170,7 +170,7 @@ var yt = { exports: {} };
|
|
|
170
170
|
return !0;
|
|
171
171
|
};
|
|
172
172
|
}
|
|
173
|
-
function
|
|
173
|
+
function F(t, a, l, f) {
|
|
174
174
|
return t.validate(t.options, a, l, f);
|
|
175
175
|
}
|
|
176
176
|
var _ = {
|
|
@@ -215,7 +215,7 @@ var yt = { exports: {} };
|
|
|
215
215
|
},
|
|
216
216
|
$or: function(t, a, l, f) {
|
|
217
217
|
for (var p = 0, h = t.length; p < h; p++)
|
|
218
|
-
if (
|
|
218
|
+
if (F(b(t, p), a, l, f)) return !0;
|
|
219
219
|
return !1;
|
|
220
220
|
},
|
|
221
221
|
$nor: function(t, a, l, f) {
|
|
@@ -223,7 +223,7 @@ var yt = { exports: {} };
|
|
|
223
223
|
},
|
|
224
224
|
$and: function(t, a, l, f) {
|
|
225
225
|
for (var p = 0, h = t.length; p < h; p++)
|
|
226
|
-
if (!
|
|
226
|
+
if (!F(b(t, p), a, l, f)) return !1;
|
|
227
227
|
return !0;
|
|
228
228
|
},
|
|
229
229
|
$regex: w(function(t, a) {
|
|
@@ -235,14 +235,14 @@ var yt = { exports: {} };
|
|
|
235
235
|
$elemMatch: function(t, a, l, f) {
|
|
236
236
|
return d(a) ? !!~function(p, h) {
|
|
237
237
|
for (var g = 0; g < p.length; g++)
|
|
238
|
-
if (b(p, g),
|
|
238
|
+
if (b(p, g), F(h, b(p, g))) return g;
|
|
239
239
|
return -1;
|
|
240
|
-
}(a, t) :
|
|
240
|
+
}(a, t) : F(t, a, l, f);
|
|
241
241
|
},
|
|
242
242
|
$exists: function(t, a, l, f) {
|
|
243
243
|
return f.hasOwnProperty(l) === t;
|
|
244
244
|
}
|
|
245
|
-
},
|
|
245
|
+
}, x = {
|
|
246
246
|
$eq: function(t, a, l) {
|
|
247
247
|
var f = l.comparable, p = l.compare;
|
|
248
248
|
return t instanceof RegExp ? w(function(h) {
|
|
@@ -295,7 +295,7 @@ var yt = { exports: {} };
|
|
|
295
295
|
for (y = t.length; y--; ) if (t[y] == null) return !0;
|
|
296
296
|
}
|
|
297
297
|
for (y = t.length; y--; ) {
|
|
298
|
-
var g =
|
|
298
|
+
var g = F(lt(b(t, y), l), h, y, t);
|
|
299
299
|
if (g && String(g) !== "[object Object]" && String(h) !== "[object Object]")
|
|
300
300
|
return !0;
|
|
301
301
|
}
|
|
@@ -307,7 +307,7 @@ var yt = { exports: {} };
|
|
|
307
307
|
};
|
|
308
308
|
},
|
|
309
309
|
$nin: function(t, a, l) {
|
|
310
|
-
var f =
|
|
310
|
+
var f = x.$in(t, a, l);
|
|
311
311
|
return function(p, h, g, y) {
|
|
312
312
|
return !f(p, h, g, y);
|
|
313
313
|
};
|
|
@@ -318,7 +318,7 @@ var yt = { exports: {} };
|
|
|
318
318
|
};
|
|
319
319
|
},
|
|
320
320
|
$ne: function(t, a, l) {
|
|
321
|
-
var f =
|
|
321
|
+
var f = x.$eq(t, a, l);
|
|
322
322
|
return N(function(p, h, g, y) {
|
|
323
323
|
return !f(p, h, g, y);
|
|
324
324
|
});
|
|
@@ -327,7 +327,7 @@ var yt = { exports: {} };
|
|
|
327
327
|
return t.map(T(l));
|
|
328
328
|
},
|
|
329
329
|
$all: function(t, a, l) {
|
|
330
|
-
return
|
|
330
|
+
return x.$and(t, a, l);
|
|
331
331
|
},
|
|
332
332
|
$or: function(t, a, l) {
|
|
333
333
|
return t.map(T(l));
|
|
@@ -338,7 +338,7 @@ var yt = { exports: {} };
|
|
|
338
338
|
$not: function(t, a, l) {
|
|
339
339
|
var f = T(l)(t);
|
|
340
340
|
return function(p, h, g) {
|
|
341
|
-
return !
|
|
341
|
+
return !F(f, p, h, g);
|
|
342
342
|
};
|
|
343
343
|
},
|
|
344
344
|
$type: function(t) {
|
|
@@ -362,30 +362,30 @@ var yt = { exports: {} };
|
|
|
362
362
|
return !!t;
|
|
363
363
|
}
|
|
364
364
|
};
|
|
365
|
-
function
|
|
365
|
+
function j(t, a) {
|
|
366
366
|
return { options: t, validate: a };
|
|
367
367
|
}
|
|
368
|
-
function
|
|
368
|
+
function _t(t, a) {
|
|
369
369
|
var l = t.keyPath, f = t.child, p = t.query, h = [];
|
|
370
|
-
if (function ft(A, M,
|
|
371
|
-
if (
|
|
372
|
-
return void
|
|
373
|
-
var dt = b(M,
|
|
370
|
+
if (function ft(A, M, I, Et, z) {
|
|
371
|
+
if (I === M.length || A == null)
|
|
372
|
+
return void z.push([A, M[I - 1], Et]);
|
|
373
|
+
var dt = b(M, I);
|
|
374
374
|
if (d(A) && isNaN(Number(dt)))
|
|
375
|
-
for (var
|
|
376
|
-
else ft(b(A, dt), M,
|
|
375
|
+
for (var V = 0, jt = A.length; V < jt; V++) ft(b(A, V), M, I, A, z);
|
|
376
|
+
else ft(b(A, dt), M, I + 1, A, z);
|
|
377
377
|
}(a, l, 0, a, h), h.length === 1) {
|
|
378
378
|
var g = h[0];
|
|
379
|
-
return
|
|
379
|
+
return F(f, g[0], g[1], g[2]);
|
|
380
380
|
}
|
|
381
|
-
for (var y = p && p.$ne !== void 0, O = y,
|
|
382
|
-
var
|
|
383
|
-
y ? O &=
|
|
381
|
+
for (var y = p && p.$ne !== void 0, O = y, S = 0; S < h.length; S++) {
|
|
382
|
+
var E = h[S], J = F(f, E[0], E[1], E[2]);
|
|
383
|
+
y ? O &= J : O |= J;
|
|
384
384
|
}
|
|
385
385
|
return O;
|
|
386
386
|
}
|
|
387
|
-
function
|
|
388
|
-
return
|
|
387
|
+
function Rt(t, a, l) {
|
|
388
|
+
return j({ keyPath: t, child: a, query: l }, _t);
|
|
389
389
|
}
|
|
390
390
|
function T(t) {
|
|
391
391
|
var a = t.comparable, l = t.expressions, f = function(g) {
|
|
@@ -395,42 +395,42 @@ var yt = { exports: {} };
|
|
|
395
395
|
g = a(g);
|
|
396
396
|
var y = [];
|
|
397
397
|
for (var O in g) {
|
|
398
|
-
var
|
|
398
|
+
var S = g[O];
|
|
399
399
|
if (O !== "$options") {
|
|
400
|
-
var
|
|
401
|
-
if (
|
|
400
|
+
var E = _[O] || t && l && l[O];
|
|
401
|
+
if (E) x[O] && (S = x[O](S, g, t)), y.push(j(a(S), E));
|
|
402
402
|
else {
|
|
403
403
|
if (O.charCodeAt(0) === 36)
|
|
404
404
|
throw new Error("Unknown operation " + O);
|
|
405
|
-
var
|
|
406
|
-
y.push(
|
|
405
|
+
var J = O.split(".");
|
|
406
|
+
y.push(Rt(J, h(S), S));
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
|
-
return y.length === 1 ? y[0] :
|
|
410
|
+
return y.length === 1 ? y[0] : j(y, _.$and);
|
|
411
411
|
}, h = function(g) {
|
|
412
|
-
return g = f(g), function y(O,
|
|
413
|
-
if (!v(O)) return
|
|
414
|
-
for (var
|
|
415
|
-
return
|
|
416
|
-
}(g, []).join(",").search(/[$.]/) === -1 ?
|
|
412
|
+
return g = f(g), function y(O, S) {
|
|
413
|
+
if (!v(O)) return S;
|
|
414
|
+
for (var E in O) S.push(E), y(O[E], S);
|
|
415
|
+
return S;
|
|
416
|
+
}(g, []).join(",").search(/[$.]/) === -1 ? j(g, U) : p(g);
|
|
417
417
|
};
|
|
418
418
|
return function(g) {
|
|
419
419
|
return p(f(g));
|
|
420
420
|
};
|
|
421
421
|
}
|
|
422
|
-
function
|
|
422
|
+
function U(t, a) {
|
|
423
423
|
if (Object.prototype.toString.call(t) !== Object.prototype.toString.call(a))
|
|
424
424
|
return !1;
|
|
425
425
|
if (v(t)) {
|
|
426
426
|
if (Object.keys(t).length !== Object.keys(a).length) return !1;
|
|
427
|
-
for (var l in t) if (!
|
|
427
|
+
for (var l in t) if (!U(t[l], a[l])) return !1;
|
|
428
428
|
return !0;
|
|
429
429
|
}
|
|
430
430
|
if (d(t)) {
|
|
431
431
|
if (t.length !== a.length) return !1;
|
|
432
432
|
for (var f = 0, p = t.length; f < p; f++)
|
|
433
|
-
if (!
|
|
433
|
+
if (!U(t[f], a[f])) return !1;
|
|
434
434
|
return !0;
|
|
435
435
|
}
|
|
436
436
|
return t === a;
|
|
@@ -440,55 +440,55 @@ var yt = { exports: {} };
|
|
|
440
440
|
return a && a.select && (l = {
|
|
441
441
|
options: l,
|
|
442
442
|
validate: function(f, p, h, g) {
|
|
443
|
-
return
|
|
443
|
+
return F(f, p && a.select(p), h, g);
|
|
444
444
|
}
|
|
445
445
|
}), l;
|
|
446
446
|
}
|
|
447
|
-
function
|
|
448
|
-
var l = lt(t, a = Object.assign({ compare: ct, comparable:
|
|
447
|
+
function xt(t, a) {
|
|
448
|
+
var l = lt(t, a = Object.assign({ compare: ct, comparable: Y }, a));
|
|
449
449
|
return function(f, p, h) {
|
|
450
|
-
return
|
|
450
|
+
return F(l, f, p, h);
|
|
451
451
|
};
|
|
452
452
|
}
|
|
453
453
|
function ct(t, a) {
|
|
454
|
-
if (
|
|
454
|
+
if (U(t, a)) return 0;
|
|
455
455
|
if (o(t) === o(a)) {
|
|
456
456
|
if (t > a) return 1;
|
|
457
457
|
if (t < a) return -1;
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
|
-
function
|
|
461
|
-
return t instanceof Date ? t.getTime() : d(t) ? t.map(
|
|
460
|
+
function Y(t) {
|
|
461
|
+
return t instanceof Date ? t.getTime() : d(t) ? t.map(Y) : t && typeof t.toJSON == "function" ? t.toJSON() : t;
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
464
|
]);
|
|
465
465
|
});
|
|
466
|
-
})(
|
|
467
|
-
var
|
|
468
|
-
const
|
|
469
|
-
function
|
|
466
|
+
})(mt);
|
|
467
|
+
var Lt = mt.exports;
|
|
468
|
+
const Kt = /* @__PURE__ */ Ct(Lt);
|
|
469
|
+
function Ut(e, i) {
|
|
470
470
|
for (var s = 0; s < i.length; s++) {
|
|
471
471
|
var r = i[s];
|
|
472
472
|
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
|
-
function
|
|
476
|
-
return i &&
|
|
475
|
+
function Jt(e, i, s) {
|
|
476
|
+
return i && Ut(e.prototype, i), e;
|
|
477
477
|
}
|
|
478
|
-
function
|
|
478
|
+
function Gt(e, i) {
|
|
479
479
|
e.prototype = Object.create(i.prototype), e.prototype.constructor = e, e.__proto__ = i;
|
|
480
480
|
}
|
|
481
|
-
function
|
|
482
|
-
return
|
|
481
|
+
function Z(e) {
|
|
482
|
+
return Z = Object.setPrototypeOf ? Object.getPrototypeOf : function(s) {
|
|
483
483
|
return s.__proto__ || Object.getPrototypeOf(s);
|
|
484
|
-
},
|
|
484
|
+
}, Z(e);
|
|
485
485
|
}
|
|
486
|
-
function
|
|
487
|
-
return
|
|
486
|
+
function H(e, i) {
|
|
487
|
+
return H = Object.setPrototypeOf || function(r, n) {
|
|
488
488
|
return r.__proto__ = n, r;
|
|
489
|
-
},
|
|
489
|
+
}, H(e, i);
|
|
490
490
|
}
|
|
491
|
-
function
|
|
491
|
+
function qt() {
|
|
492
492
|
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
|
|
493
493
|
if (typeof Proxy == "function") return !0;
|
|
494
494
|
try {
|
|
@@ -498,21 +498,21 @@ function Ut() {
|
|
|
498
498
|
return !1;
|
|
499
499
|
}
|
|
500
500
|
}
|
|
501
|
-
function
|
|
502
|
-
return
|
|
501
|
+
function q(e, i, s) {
|
|
502
|
+
return qt() ? q = Reflect.construct : q = function(n, o, u) {
|
|
503
503
|
var d = [null];
|
|
504
504
|
d.push.apply(d, o);
|
|
505
505
|
var v = Function.bind.apply(n, d), m = new v();
|
|
506
|
-
return u &&
|
|
507
|
-
},
|
|
506
|
+
return u && H(m, u.prototype), m;
|
|
507
|
+
}, q.apply(null, arguments);
|
|
508
508
|
}
|
|
509
|
-
function
|
|
509
|
+
function Ht(e) {
|
|
510
510
|
return Function.toString.call(e).indexOf("[native code]") !== -1;
|
|
511
511
|
}
|
|
512
|
-
function
|
|
512
|
+
function tt(e) {
|
|
513
513
|
var i = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
514
|
-
return
|
|
515
|
-
if (r === null || !
|
|
514
|
+
return tt = function(r) {
|
|
515
|
+
if (r === null || !Ht(r)) return r;
|
|
516
516
|
if (typeof r != "function")
|
|
517
517
|
throw new TypeError("Super expression must either be null or a function");
|
|
518
518
|
if (typeof i < "u") {
|
|
@@ -520,7 +520,7 @@ function Q(e) {
|
|
|
520
520
|
i.set(r, n);
|
|
521
521
|
}
|
|
522
522
|
function n() {
|
|
523
|
-
return
|
|
523
|
+
return q(r, arguments, Z(this).constructor);
|
|
524
524
|
}
|
|
525
525
|
return n.prototype = Object.create(r.prototype, {
|
|
526
526
|
constructor: {
|
|
@@ -529,19 +529,19 @@ function Q(e) {
|
|
|
529
529
|
writable: !0,
|
|
530
530
|
configurable: !0
|
|
531
531
|
}
|
|
532
|
-
}),
|
|
533
|
-
},
|
|
532
|
+
}), H(n, r);
|
|
533
|
+
}, tt(e);
|
|
534
534
|
}
|
|
535
535
|
function pt(e) {
|
|
536
536
|
if (e === void 0)
|
|
537
537
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
538
538
|
return e;
|
|
539
539
|
}
|
|
540
|
-
var
|
|
540
|
+
var bt = function(i) {
|
|
541
541
|
return 'Cannot execute "' + i.action + '" on "' + i.subjectName + '"';
|
|
542
|
-
},
|
|
543
|
-
|
|
544
|
-
n === null ?
|
|
542
|
+
}, G = bt, Xt = /* @__PURE__ */ function(e) {
|
|
543
|
+
Gt(i, e), i.setDefaultMessage = function(n) {
|
|
544
|
+
n === null ? G = bt : G = typeof n == "string" ? function() {
|
|
545
545
|
return n;
|
|
546
546
|
} : n;
|
|
547
547
|
}, i.from = function(n) {
|
|
@@ -552,7 +552,7 @@ var mt = function(i) {
|
|
|
552
552
|
};
|
|
553
553
|
function i(r, n) {
|
|
554
554
|
var o;
|
|
555
|
-
return n === void 0 && (n = {}), o = e.call(this, r) || this, o._setMetadata(n), o.message = r ||
|
|
555
|
+
return n === void 0 && (n = {}), o = e.call(this, r) || this, o._setMetadata(n), o.message = r || G(pt(o)), o._customMessage = null, typeof Error.captureStackTrace == "function" && (o.name = o.constructor.name, Error.captureStackTrace(pt(o), o.constructor)), o;
|
|
556
556
|
}
|
|
557
557
|
var s = i.prototype;
|
|
558
558
|
return s.setMessage = function(n) {
|
|
@@ -569,45 +569,45 @@ var mt = function(i) {
|
|
|
569
569
|
subjectName: this.ability.subjectName(o)
|
|
570
570
|
});
|
|
571
571
|
var v = d ? d.reason : "";
|
|
572
|
-
throw this.message = this._customMessage || v ||
|
|
572
|
+
throw this.message = this._customMessage || v || G(this), this;
|
|
573
573
|
}
|
|
574
574
|
}, s._setMetadata = function(n) {
|
|
575
575
|
this.subject = n.subject, this.subjectName = n.subjectName, this.action = n.action, this.field = n.field;
|
|
576
576
|
}, i;
|
|
577
|
-
}(
|
|
578
|
-
function
|
|
577
|
+
}(tt(Error));
|
|
578
|
+
function et(e) {
|
|
579
579
|
return Array.isArray(e) ? e : [e];
|
|
580
580
|
}
|
|
581
|
-
function
|
|
581
|
+
function Wt(e) {
|
|
582
582
|
if (!e || typeof e == "string")
|
|
583
583
|
return e;
|
|
584
584
|
var i = typeof e == "object" ? e.constructor : e;
|
|
585
585
|
return i.modelName || i.name;
|
|
586
586
|
}
|
|
587
|
-
function
|
|
587
|
+
function Yt(e) {
|
|
588
588
|
return JSON.parse(JSON.stringify(e));
|
|
589
589
|
}
|
|
590
|
-
var
|
|
591
|
-
function
|
|
592
|
-
var r = s[0] === "*" || e[0] === "." && e[e.length - 1] === "." ? "+" : "*", n = e.indexOf("**") === -1 ? "[^.]" : ".", o = e.replace(
|
|
590
|
+
var zt = /[-/\\^$+?.()|[\]{}]/g, Vt = /\.?\*+\.?/g, Qt = /\*+/, Zt = /\./g;
|
|
591
|
+
function te(e, i, s) {
|
|
592
|
+
var r = s[0] === "*" || e[0] === "." && e[e.length - 1] === "." ? "+" : "*", n = e.indexOf("**") === -1 ? "[^.]" : ".", o = e.replace(Zt, "\\$&").replace(Qt, n + r);
|
|
593
593
|
return i + e.length === s.length ? "(?:" + o + ")?" : o;
|
|
594
594
|
}
|
|
595
|
-
function
|
|
595
|
+
function ee(e, i, s) {
|
|
596
596
|
return e === "." && (s[i - 1] === "*" || s[i + 1] === "*") ? e : "\\" + e;
|
|
597
597
|
}
|
|
598
|
-
function
|
|
598
|
+
function re(e) {
|
|
599
599
|
var i = e.map(function(r) {
|
|
600
|
-
return r.replace(
|
|
600
|
+
return r.replace(zt, ee).replace(Vt, te);
|
|
601
601
|
}), s = i.length > 1 ? "(?:" + i.join("|") + ")" : i[0];
|
|
602
602
|
return new RegExp("^" + s + "$");
|
|
603
603
|
}
|
|
604
|
-
var
|
|
604
|
+
var ne = /* @__PURE__ */ function() {
|
|
605
605
|
function e(s) {
|
|
606
|
-
this.actions = s.actions || s.action, this.subject = s.subject, this.fields = !s.fields || s.fields.length === 0 ? void 0 :
|
|
606
|
+
this.actions = s.actions || s.action, this.subject = s.subject, this.fields = !s.fields || s.fields.length === 0 ? void 0 : et(s.fields), Object.defineProperty(this, "_fieldsPattern", {
|
|
607
607
|
writable: !0
|
|
608
608
|
}), this.inverted = !!s.inverted, this.conditions = s.conditions, Object.defineProperty(this, "_matches", {
|
|
609
609
|
writable: !0,
|
|
610
|
-
value: this.conditions ?
|
|
610
|
+
value: this.conditions ? Kt(this.conditions) : void 0
|
|
611
611
|
}), this.reason = s.reason;
|
|
612
612
|
}
|
|
613
613
|
var i = e.prototype;
|
|
@@ -616,15 +616,15 @@ var te = /* @__PURE__ */ function() {
|
|
|
616
616
|
}, i.isRelevantFor = function(r, n) {
|
|
617
617
|
return this.fields ? n ? this.matchesField(n) : !this.inverted : !0;
|
|
618
618
|
}, i.matchesField = function(r) {
|
|
619
|
-
return typeof this._fieldsPattern > "u" && (this._fieldsPattern = this.fields.join("").indexOf("*") === -1 ? null :
|
|
619
|
+
return typeof this._fieldsPattern > "u" && (this._fieldsPattern = this.fields.join("").indexOf("*") === -1 ? null : re(this.fields)), this._fieldsPattern === null || r.indexOf("*") !== -1 ? this.fields.indexOf(r) !== -1 : this._fieldsPattern.test(r);
|
|
620
620
|
}, e;
|
|
621
|
-
}(),
|
|
621
|
+
}(), P = typeof Symbol < "u" ? Symbol("private") : "__" + Date.now(), ht = {
|
|
622
622
|
crud: ["create", "read", "update", "delete"]
|
|
623
623
|
};
|
|
624
624
|
function gt(e, i) {
|
|
625
625
|
return e === i || Array.isArray(i) && i.indexOf(e) !== -1;
|
|
626
626
|
}
|
|
627
|
-
var
|
|
627
|
+
var oe = /* @__PURE__ */ function() {
|
|
628
628
|
e.addAlias = function(r, n) {
|
|
629
629
|
if (r === "manage" || gt("manage", n))
|
|
630
630
|
throw new Error('Cannot add alias for "manage" action because it represents any action');
|
|
@@ -634,15 +634,15 @@ var ee = /* @__PURE__ */ function() {
|
|
|
634
634
|
};
|
|
635
635
|
function e(s, r) {
|
|
636
636
|
r === void 0 && (r = {}), Object.defineProperty(this, "subjectName", {
|
|
637
|
-
value: r.subjectName ||
|
|
638
|
-
}), this[
|
|
639
|
-
RuleType: r.RuleType ||
|
|
637
|
+
value: r.subjectName || Wt
|
|
638
|
+
}), this[P] = {
|
|
639
|
+
RuleType: r.RuleType || ne,
|
|
640
640
|
originalRules: s || [],
|
|
641
641
|
hasPerFieldRules: !1,
|
|
642
642
|
indexedRules: /* @__PURE__ */ Object.create(null),
|
|
643
643
|
mergedRules: /* @__PURE__ */ Object.create(null),
|
|
644
644
|
events: {},
|
|
645
|
-
aliases:
|
|
645
|
+
aliases: Yt(ht)
|
|
646
646
|
}, this.update(s);
|
|
647
647
|
}
|
|
648
648
|
var i = e.prototype;
|
|
@@ -653,19 +653,19 @@ var ee = /* @__PURE__ */ function() {
|
|
|
653
653
|
rules: r,
|
|
654
654
|
ability: this
|
|
655
655
|
};
|
|
656
|
-
this.emit("update", n), this[
|
|
656
|
+
this.emit("update", n), this[P].originalRules = r.slice(0), this[P].mergedRules = /* @__PURE__ */ Object.create(null);
|
|
657
657
|
var o = this.buildIndexFor(r);
|
|
658
|
-
return this[
|
|
658
|
+
return this[P].indexedRules = o.rules, this[P].hasPerFieldRules = o.hasPerFieldRules, this.emit("updated", n), this;
|
|
659
659
|
}, i.buildIndexFor = function(r) {
|
|
660
|
-
for (var n = /* @__PURE__ */ Object.create(null), o = this[
|
|
661
|
-
var m = new o(r[v]), b = this.expandActions(m.actions), w =
|
|
660
|
+
for (var n = /* @__PURE__ */ Object.create(null), o = this[P].RuleType, u = !0, d = !1, v = 0; v < r.length; v++) {
|
|
661
|
+
var m = new o(r[v]), b = this.expandActions(m.actions), w = et(m.subject), N = r.length - v - 1;
|
|
662
662
|
u = !!(u && m.inverted), !d && m.fields && (d = !0);
|
|
663
|
-
for (var
|
|
664
|
-
var _ = w[
|
|
663
|
+
for (var F = 0; F < w.length; F++) {
|
|
664
|
+
var _ = w[F];
|
|
665
665
|
n[_] = n[_] || /* @__PURE__ */ Object.create(null);
|
|
666
|
-
for (var
|
|
667
|
-
var
|
|
668
|
-
n[_][
|
|
666
|
+
for (var x = 0; x < b.length; x++) {
|
|
667
|
+
var j = b[x];
|
|
668
|
+
n[_][j] = n[_][j] || /* @__PURE__ */ Object.create(null), n[_][j][N] = m;
|
|
669
669
|
}
|
|
670
670
|
}
|
|
671
671
|
}
|
|
@@ -675,7 +675,7 @@ var ee = /* @__PURE__ */ function() {
|
|
|
675
675
|
rules: n
|
|
676
676
|
};
|
|
677
677
|
}, i.expandActions = function(r) {
|
|
678
|
-
for (var n = this[
|
|
678
|
+
for (var n = this[P].aliases, o = et(r), u = 0; u < o.length; ) {
|
|
679
679
|
var d = o[u++];
|
|
680
680
|
n.hasOwnProperty(d) && (o = o.concat(n[d]));
|
|
681
681
|
}
|
|
@@ -691,17 +691,17 @@ var ee = /* @__PURE__ */ function() {
|
|
|
691
691
|
return u[d];
|
|
692
692
|
return null;
|
|
693
693
|
}, i.possibleRulesFor = function(r, n) {
|
|
694
|
-
var o = this.subjectName(n), u = this[
|
|
694
|
+
var o = this.subjectName(n), u = this[P].mergedRules, d = o + "_" + r;
|
|
695
695
|
return u[d] || (u[d] = this.mergeRulesFor(r, o)), u[d];
|
|
696
696
|
}, i.mergeRulesFor = function(r, n) {
|
|
697
|
-
var o = this[
|
|
697
|
+
var o = this[P].indexedRules, u = [n, "all"].reduce(function(d, v) {
|
|
698
698
|
var m = o[v];
|
|
699
699
|
return m ? Object.assign(d, m[r], m.manage) : d;
|
|
700
700
|
}, []);
|
|
701
701
|
return u.filter(Boolean);
|
|
702
702
|
}, i.rulesFor = function(r, n, o) {
|
|
703
703
|
var u = this.possibleRulesFor(r, n);
|
|
704
|
-
return this[
|
|
704
|
+
return this[P].hasPerFieldRules ? u.filter(function(d) {
|
|
705
705
|
return d.isRelevantFor(n, o);
|
|
706
706
|
}) : u;
|
|
707
707
|
}, i.cannot = function() {
|
|
@@ -711,9 +711,9 @@ var ee = /* @__PURE__ */ function() {
|
|
|
711
711
|
console.warn(`
|
|
712
712
|
Ability.throwUnlessCan is deprecated and will be removed in 4.x version.
|
|
713
713
|
Please use "ForbiddenError.from(ability).throwUnlessCan(...)" instead.
|
|
714
|
-
`.trim()), (r =
|
|
714
|
+
`.trim()), (r = Xt.from(this)).throwUnlessCan.apply(r, arguments);
|
|
715
715
|
}, i.on = function(r, n) {
|
|
716
|
-
var o = this[
|
|
716
|
+
var o = this[P].events, u = !0;
|
|
717
717
|
return o[r] || (o[r] = []), o[r].push(n), function() {
|
|
718
718
|
if (u) {
|
|
719
719
|
var d = o[r].indexOf(n);
|
|
@@ -721,24 +721,24 @@ var ee = /* @__PURE__ */ function() {
|
|
|
721
721
|
}
|
|
722
722
|
};
|
|
723
723
|
}, i.emit = function(r, n) {
|
|
724
|
-
var o = this[
|
|
724
|
+
var o = this[P].events[r];
|
|
725
725
|
o && o.slice(0).forEach(function(u) {
|
|
726
726
|
return u(n);
|
|
727
727
|
});
|
|
728
|
-
},
|
|
728
|
+
}, Jt(e, [{
|
|
729
729
|
key: "rules",
|
|
730
730
|
get: function() {
|
|
731
|
-
return this[
|
|
731
|
+
return this[P].originalRules;
|
|
732
732
|
}
|
|
733
733
|
}]), e;
|
|
734
734
|
}();
|
|
735
|
-
function
|
|
736
|
-
return new
|
|
735
|
+
function ie(e) {
|
|
736
|
+
return new oe(e).can("manage", "business::miniProgram::brandkit");
|
|
737
737
|
}
|
|
738
|
-
function
|
|
738
|
+
function W() {
|
|
739
739
|
var i;
|
|
740
|
-
const e = ((i =
|
|
741
|
-
return
|
|
740
|
+
const e = ((i = kt().sessionUser.value) == null ? void 0 : i.permissions) ?? [];
|
|
741
|
+
return ie(
|
|
742
742
|
e.map(({ fields: s, inverted: r, reason: n, ...o }) => ({
|
|
743
743
|
...o,
|
|
744
744
|
fields: s ?? void 0,
|
|
@@ -747,10 +747,10 @@ function at() {
|
|
|
747
747
|
}))
|
|
748
748
|
);
|
|
749
749
|
}
|
|
750
|
-
function
|
|
751
|
-
return
|
|
750
|
+
function Se() {
|
|
751
|
+
return L(W);
|
|
752
752
|
}
|
|
753
|
-
const
|
|
753
|
+
const K = [
|
|
754
754
|
{ path: "primary", label: "Primary", group: "Brand", hint: "Dominant brand color" },
|
|
755
755
|
{
|
|
756
756
|
path: "secondary",
|
|
@@ -777,28 +777,49 @@ const H = [
|
|
|
777
777
|
{ path: "status.warning", label: "Warning", group: "Status" },
|
|
778
778
|
{ path: "status.error", label: "Error", group: "Status" },
|
|
779
779
|
{ path: "status.info", label: "Info", group: "Status" }
|
|
780
|
-
],
|
|
780
|
+
], C = [
|
|
781
781
|
{ path: "brand", label: "Brand", group: "Fonts", hint: "Logo / wordmark contexts" },
|
|
782
782
|
{ path: "heading", label: "Heading", group: "Fonts" },
|
|
783
783
|
{ path: "body", label: "Body", group: "Fonts" }
|
|
784
|
-
],
|
|
785
|
-
|
|
786
|
-
|
|
784
|
+
], wt = {
|
|
785
|
+
primary: "#ff7823",
|
|
786
|
+
secondary: "#fff3e6",
|
|
787
|
+
accent: "#B25300",
|
|
788
|
+
"background.base": "#F8F8F8",
|
|
789
|
+
"background.elevated": "#FFFFFF",
|
|
790
|
+
"neutral.light": "#DADADA",
|
|
791
|
+
"neutral.mid": "#B2B3B6",
|
|
792
|
+
"neutral.dark": "#1C1C1E",
|
|
793
|
+
"text.onPrimary": "#FFFFFF",
|
|
794
|
+
"text.primary": "#1C1C1E",
|
|
795
|
+
"text.secondary": "#555555",
|
|
796
|
+
"text.tertiary": "#A2A09E",
|
|
797
|
+
"status.success": "#10B981",
|
|
798
|
+
"status.warning": "#F59E0B",
|
|
799
|
+
"status.error": "#EF4444",
|
|
800
|
+
"status.info": "#3B82F6"
|
|
801
|
+
}, Ft = {
|
|
802
|
+
brand: "'Inter', sans-serif",
|
|
803
|
+
heading: "'Inter', sans-serif",
|
|
804
|
+
body: "'Roboto', sans-serif"
|
|
805
|
+
}, Ot = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
806
|
+
function ae(e) {
|
|
807
|
+
return Ot.test(e.trim());
|
|
787
808
|
}
|
|
788
|
-
function
|
|
809
|
+
function vt(e) {
|
|
789
810
|
const i = e.trim().toLowerCase();
|
|
790
|
-
if (!
|
|
811
|
+
if (!Ot.test(i)) return "#000000";
|
|
791
812
|
if (i.length === 7) return i;
|
|
792
813
|
const [s, r, n] = i.slice(1);
|
|
793
814
|
return `#${s}${s}${r}${r}${n}${n}`;
|
|
794
815
|
}
|
|
795
|
-
function
|
|
796
|
-
return
|
|
816
|
+
function se() {
|
|
817
|
+
return At(Nt("fmmf:dev")).apiOrigin;
|
|
797
818
|
}
|
|
798
819
|
function st(e) {
|
|
799
|
-
return `${
|
|
820
|
+
return `${se()}/metadata/${e}/brandkit`;
|
|
800
821
|
}
|
|
801
|
-
function
|
|
822
|
+
function B(e, i) {
|
|
802
823
|
let s = e;
|
|
803
824
|
for (const r of i.split(".")) {
|
|
804
825
|
if (!s || typeof s != "object") return;
|
|
@@ -806,7 +827,7 @@ function I(e, i) {
|
|
|
806
827
|
}
|
|
807
828
|
return s;
|
|
808
829
|
}
|
|
809
|
-
function
|
|
830
|
+
function rt(e, i, s) {
|
|
810
831
|
const r = i.split("."), n = r.pop();
|
|
811
832
|
if (!n) return;
|
|
812
833
|
let o = e;
|
|
@@ -816,18 +837,18 @@ function tt(e, i, s) {
|
|
|
816
837
|
}
|
|
817
838
|
o[n] = s;
|
|
818
839
|
}
|
|
819
|
-
function
|
|
840
|
+
function nt(e, i, s) {
|
|
820
841
|
const r = {};
|
|
821
842
|
for (const n of s) {
|
|
822
|
-
const o =
|
|
843
|
+
const o = B(e == null ? void 0 : e[i], n.path);
|
|
823
844
|
r[n.path] = typeof o == "string" ? o : "";
|
|
824
845
|
}
|
|
825
846
|
return r;
|
|
826
847
|
}
|
|
827
|
-
function
|
|
848
|
+
function ot(e) {
|
|
828
849
|
return JSON.parse(JSON.stringify(e));
|
|
829
850
|
}
|
|
830
|
-
const c =
|
|
851
|
+
const c = Tt({
|
|
831
852
|
panelOpen: !1,
|
|
832
853
|
loading: !1,
|
|
833
854
|
saving: !1,
|
|
@@ -848,63 +869,63 @@ async function ut(e) {
|
|
|
848
869
|
if (!i.ok) throw new Error(`GET brandkit failed: HTTP ${i.status}`);
|
|
849
870
|
return await i.json();
|
|
850
871
|
}
|
|
851
|
-
function
|
|
852
|
-
c.colors =
|
|
872
|
+
function X(e) {
|
|
873
|
+
c.colors = nt(e, "colors", K), c.fonts = nt(e, "fonts", C), c.savedColors = { ...c.colors }, c.savedFonts = { ...c.fonts }, c.loaded = !0;
|
|
853
874
|
}
|
|
854
|
-
let k = null,
|
|
855
|
-
function
|
|
856
|
-
const i =
|
|
875
|
+
let k = null, $ = 0, D = null;
|
|
876
|
+
function St(e = !1) {
|
|
877
|
+
const i = R();
|
|
857
878
|
if (c.loaded && !e && c.businessId === i) return Promise.resolve();
|
|
858
879
|
if ((k == null ? void 0 : k.businessId) === i) return k.promise;
|
|
859
|
-
const s =
|
|
860
|
-
c.businessId !== i && (c.businessId = i, c.loaded = !1, c.revertKit = null,
|
|
880
|
+
const s = ++$;
|
|
881
|
+
c.businessId !== i && (c.businessId = i, c.loaded = !1, c.revertKit = null, D = null, c.appliedProposal = null, X(null), c.loaded = !1);
|
|
861
882
|
const r = (async () => {
|
|
862
883
|
c.loading = !0, c.error = null;
|
|
863
884
|
try {
|
|
864
885
|
const n = await ut(i);
|
|
865
|
-
s ===
|
|
886
|
+
s === $ && X(n);
|
|
866
887
|
} catch (n) {
|
|
867
|
-
s ===
|
|
888
|
+
s === $ && (c.error = it(n));
|
|
868
889
|
} finally {
|
|
869
|
-
s ===
|
|
890
|
+
s === $ && (c.loading = !1, k = null);
|
|
870
891
|
}
|
|
871
892
|
})();
|
|
872
893
|
return k = { businessId: i, promise: r }, r;
|
|
873
894
|
}
|
|
874
|
-
function
|
|
875
|
-
const e =
|
|
895
|
+
function Pt() {
|
|
896
|
+
const e = K.filter((s) => c.colors[s.path] !== c.savedColors[s.path]).map(
|
|
876
897
|
(s) => s.path
|
|
877
|
-
), i =
|
|
898
|
+
), i = C.filter((s) => c.fonts[s.path] !== c.savedFonts[s.path]).map(
|
|
878
899
|
(s) => s.path
|
|
879
900
|
);
|
|
880
901
|
return { colorPaths: e, fontPaths: i };
|
|
881
902
|
}
|
|
882
|
-
const
|
|
883
|
-
const { colorPaths: e, fontPaths: i } =
|
|
903
|
+
const ue = L(() => {
|
|
904
|
+
const { colorPaths: e, fontPaths: i } = Pt();
|
|
884
905
|
return e.length + i.length;
|
|
885
|
-
}),
|
|
886
|
-
() =>
|
|
906
|
+
}), $t = L(
|
|
907
|
+
() => K.some((e) => {
|
|
887
908
|
const i = c.colors[e.path] ?? "";
|
|
888
|
-
return i !== "" && !
|
|
909
|
+
return i !== "" && !ae(i);
|
|
889
910
|
})
|
|
890
911
|
);
|
|
891
|
-
async function
|
|
892
|
-
const e =
|
|
893
|
-
if (!
|
|
912
|
+
async function le() {
|
|
913
|
+
const e = R();
|
|
914
|
+
if (!W())
|
|
894
915
|
throw c.error = "You do not have permission to manage this Brand Kit. Contact an administrator.", new Error(c.error);
|
|
895
916
|
if (c.saving || c.loading || !c.loaded || c.businessId !== e)
|
|
896
917
|
throw new Error("Wait for the current Brand Kit to finish loading or saving.");
|
|
897
|
-
if (
|
|
898
|
-
const { colorPaths: i, fontPaths: s } =
|
|
918
|
+
if ($t.value) throw new Error("Enter valid hex colors before saving.");
|
|
919
|
+
const { colorPaths: i, fontPaths: s } = Pt();
|
|
899
920
|
if (!i.length && !s.length) return;
|
|
900
|
-
const r = { ...c.colors }, n = { ...c.fonts }, o =
|
|
921
|
+
const r = { ...c.colors }, n = { ...c.fonts }, o = $;
|
|
901
922
|
c.saving = !0, c.error = null;
|
|
902
923
|
try {
|
|
903
|
-
const u = await ut(e) ?? {}, d =
|
|
924
|
+
const u = await ut(e) ?? {}, d = ot(u), v = ot(u);
|
|
904
925
|
(!v.colors || typeof v.colors != "object") && (v.colors = {}), (!v.fonts || typeof v.fonts != "object") && (v.fonts = {});
|
|
905
|
-
for (const b of i)
|
|
906
|
-
for (const b of s)
|
|
907
|
-
if (s.length && (v.fontFamilies =
|
|
926
|
+
for (const b of i) rt(v.colors, b, (r[b] ?? "").trim());
|
|
927
|
+
for (const b of s) rt(v.fonts, b, (n[b] ?? "").trim());
|
|
928
|
+
if (s.length && (v.fontFamilies = Dt(u.fontFamilies, nt(v, "fonts", C))), o !== $ || e !== R())
|
|
908
929
|
throw new Error("Business changed. No Brand Kit was saved.");
|
|
909
930
|
const m = await fetch(st(e), {
|
|
910
931
|
method: "POST",
|
|
@@ -913,29 +934,29 @@ async function ae() {
|
|
|
913
934
|
signal: AbortSignal.timeout(2e4)
|
|
914
935
|
});
|
|
915
936
|
if (!m.ok) throw new Error(`Save failed: HTTP ${m.status}`);
|
|
916
|
-
o ===
|
|
937
|
+
o === $ && e === R() && (c.revertKit = d, D = {
|
|
917
938
|
colorPaths: i,
|
|
918
939
|
fontPaths: s,
|
|
919
940
|
savedFontFamilies: s.length ? JSON.stringify(v.fontFamilies) : void 0
|
|
920
|
-
}, c.appliedProposal = null,
|
|
941
|
+
}, c.appliedProposal = null, X(v));
|
|
921
942
|
} catch (u) {
|
|
922
|
-
throw o ===
|
|
943
|
+
throw o === $ && (c.error = it(u)), u;
|
|
923
944
|
} finally {
|
|
924
945
|
c.saving = !1;
|
|
925
946
|
}
|
|
926
947
|
}
|
|
927
|
-
async function
|
|
928
|
-
if (!c.revertKit || !
|
|
929
|
-
const e =
|
|
930
|
-
if (!
|
|
948
|
+
async function ce() {
|
|
949
|
+
if (!c.revertKit || !D || c.saving || c.loading) return;
|
|
950
|
+
const e = R();
|
|
951
|
+
if (!W())
|
|
931
952
|
throw c.error = "You do not have permission to manage this Brand Kit. Contact an administrator.", new Error(c.error);
|
|
932
953
|
if (c.businessId !== e) throw new Error("Load the current business before reverting.");
|
|
933
|
-
const i =
|
|
954
|
+
const i = $, s = ot(c.revertKit), r = D;
|
|
934
955
|
c.saving = !0, c.error = null;
|
|
935
956
|
try {
|
|
936
957
|
const n = await ut(e) ?? {};
|
|
937
958
|
if (r.fontPaths.length) {
|
|
938
|
-
if (
|
|
959
|
+
if (C.some((u) => (B(n.fonts, u.path) ?? "") !== c.savedFonts[u.path]) || JSON.stringify(n.fontFamilies) !== r.savedFontFamilies)
|
|
939
960
|
throw new Error("Brand Kit changed since your save. Reload it before editing again.");
|
|
940
961
|
Object.hasOwn(s, "fontFamilies") ? n.fontFamilies = s.fontFamilies : delete n.fontFamilies;
|
|
941
962
|
}
|
|
@@ -945,18 +966,18 @@ async function se() {
|
|
|
945
966
|
]) {
|
|
946
967
|
const v = u === "colors" ? c.savedColors : c.savedFonts;
|
|
947
968
|
for (const m of d) {
|
|
948
|
-
if ((
|
|
969
|
+
if ((B(n[u], m) ?? "") !== v[m])
|
|
949
970
|
throw new Error("Brand Kit changed since your save. Reload it before editing again.");
|
|
950
971
|
(!n[u] || typeof n[u] != "object") && (n[u] = {});
|
|
951
|
-
const b =
|
|
952
|
-
if (typeof b == "string")
|
|
972
|
+
const b = B(s[u], m);
|
|
973
|
+
if (typeof b == "string") rt(n[u], m, b);
|
|
953
974
|
else {
|
|
954
|
-
const w = m.split("."), N = w.pop(),
|
|
955
|
-
|
|
975
|
+
const w = m.split("."), N = w.pop(), F = w.length ? B(n[u], w.join(".")) : n[u];
|
|
976
|
+
F && typeof F == "object" && delete F[N];
|
|
956
977
|
}
|
|
957
978
|
}
|
|
958
979
|
}
|
|
959
|
-
if (i !==
|
|
980
|
+
if (i !== $ || e !== R())
|
|
960
981
|
throw new Error("Business changed. No Brand Kit was reverted.");
|
|
961
982
|
const o = await fetch(st(e), {
|
|
962
983
|
method: "POST",
|
|
@@ -965,52 +986,63 @@ async function se() {
|
|
|
965
986
|
signal: AbortSignal.timeout(2e4)
|
|
966
987
|
});
|
|
967
988
|
if (!o.ok) throw new Error(`Revert failed: HTTP ${o.status}`);
|
|
968
|
-
i ===
|
|
989
|
+
i === $ && e === R() && (c.revertKit = null, D = null, X(n));
|
|
969
990
|
} catch (n) {
|
|
970
|
-
throw i ===
|
|
991
|
+
throw i === $ && (c.error = it(n)), n;
|
|
971
992
|
} finally {
|
|
972
993
|
c.saving = !1;
|
|
973
994
|
}
|
|
974
995
|
}
|
|
975
|
-
async function
|
|
996
|
+
async function fe(e) {
|
|
976
997
|
c.panelOpen = !0;
|
|
977
|
-
const i =
|
|
978
|
-
if (await
|
|
979
|
-
for (const s of
|
|
998
|
+
const i = R();
|
|
999
|
+
if (await St(), !(!c.loaded || c.loading || c.saving || c.businessId !== i || R() !== i)) {
|
|
1000
|
+
for (const s of K) {
|
|
980
1001
|
const r = e.colors[s.path];
|
|
981
1002
|
r && (c.colors[s.path] = r);
|
|
982
1003
|
}
|
|
983
|
-
for (const s of
|
|
1004
|
+
for (const s of C) {
|
|
984
1005
|
const r = e.fonts[s.path];
|
|
985
1006
|
r && (c.fonts[s.path] = r);
|
|
986
1007
|
}
|
|
987
1008
|
c.appliedProposal = e.name ?? "Untitled proposal";
|
|
988
1009
|
}
|
|
989
1010
|
}
|
|
990
|
-
function
|
|
1011
|
+
function de() {
|
|
991
1012
|
c.colors = { ...c.savedColors }, c.fonts = { ...c.savedFonts }, c.appliedProposal = null;
|
|
992
1013
|
}
|
|
993
|
-
|
|
1014
|
+
const pe = L(
|
|
1015
|
+
() => K.every((e) => vt(c.colors[e.path] ?? "") === vt(wt[e.path]))
|
|
1016
|
+
), he = L(
|
|
1017
|
+
() => C.every((e) => c.fonts[e.path] === Ft[e.path])
|
|
1018
|
+
);
|
|
1019
|
+
function ge(e) {
|
|
1020
|
+
!W() || !c.loaded || c.loading || c.saving || c.businessId !== R() || (e === "colors" ? c.colors = { ...wt } : c.fonts = { ...Ft }, c.appliedProposal = null);
|
|
1021
|
+
}
|
|
1022
|
+
function Pe() {
|
|
994
1023
|
return {
|
|
995
1024
|
state: c,
|
|
996
|
-
dirtyCount:
|
|
997
|
-
hasInvalidColor:
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1025
|
+
dirtyCount: ue,
|
|
1026
|
+
hasInvalidColor: $t,
|
|
1027
|
+
colorsAreDefault: pe,
|
|
1028
|
+
fontsAreDefault: he,
|
|
1029
|
+
load: St,
|
|
1030
|
+
save: le,
|
|
1031
|
+
revertLastSave: ce,
|
|
1032
|
+
applyProposal: fe,
|
|
1033
|
+
resetToDefault: ge,
|
|
1034
|
+
discardEdits: de
|
|
1003
1035
|
};
|
|
1004
1036
|
}
|
|
1005
1037
|
export {
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1038
|
+
K as C,
|
|
1039
|
+
C as F,
|
|
1040
|
+
at as G,
|
|
1041
|
+
Se as a,
|
|
1042
|
+
It as b,
|
|
1043
|
+
Fe as f,
|
|
1044
|
+
ae as i,
|
|
1045
|
+
Oe as l,
|
|
1046
|
+
vt as t,
|
|
1047
|
+
Pe as u
|
|
1016
1048
|
};
|