@feedmepos/mf-miniprogram-v2 0.2.2-dev.9 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/App-qAELeU_7.js +1120 -0
  2. package/dist/AppTemplatePicker.vue_vue_type_script_setup_true_lang-CDvGnq6F.js +184 -0
  3. package/dist/BrandFontPicker-BZyGrK3D.js +241 -0
  4. package/dist/BrandKitView-CzefaEEN.js +249 -0
  5. package/dist/{ControlPlaneView-DGDA8EFh.js → ControlPlaneView-CqUxRaS2.js} +7717 -7289
  6. package/dist/{EcosystemView-Cx-3k7lB.js → EcosystemView-C-y5cPOp.js} +7 -7
  7. package/dist/{LegacyWorkspaceEntry-opz_kWz9.js → LegacyWorkspaceEntry-CADRpDkg.js} +2 -2
  8. package/dist/MobileProjectsView-obtkXdEv.js +331 -0
  9. package/dist/{ModuleCenterView-DEShxy_e.js → ModuleCenterView-B08oZqQw.js} +34 -34
  10. package/dist/{ModuleDetailView-BSndm4ov.js → ModuleDetailView-lROTkaR7.js} +49 -49
  11. package/dist/{PagesView-CegMd6GC.js → PagesView-DOG8RSen.js} +2 -2
  12. package/dist/{PlatformUnavailableView-j0_2YBKm.js → PlatformUnavailableView-C1RltAIw.js} +1 -1
  13. package/dist/{PortalSettingsView-DFz6FUd9.js → PortalSettingsView-BK6kRgtf.js} +7 -7
  14. package/dist/StatusBadge.vue_vue_type_script_setup_true_lang-CMgQ0bd_.js +30 -0
  15. package/dist/TemplateCenterView-niXTXw9y.js +426 -0
  16. package/dist/WorkspaceEntryView-DzR8DQC5.js +21 -0
  17. package/dist/_commonjsHelpers-DaMA6jEr.js +8 -0
  18. package/dist/adminAccess-CDxAuQ-M.js +48 -0
  19. package/dist/app.js +22 -11
  20. package/dist/{controlPlane-CoEgf9BA.js → controlPlane-DT3t_ftg.js} +11 -11
  21. package/dist/{index-D5qXvcfE.js → index-CIJWcl_6.js} +10 -9
  22. package/dist/package.json +3 -1
  23. package/dist/{portalContext-C4HL_0kl.js → portalContext-B2pXdNtB.js} +2 -2
  24. package/dist/portalNavigation-DKCfwTH8.js +28 -0
  25. package/dist/routes-CeuodIgg.js +95 -0
  26. package/dist/style.css +1 -1
  27. package/dist/{useBrandKit-BlKlqpo2.js → useBrandKit-CQv08nyY.js} +166 -170
  28. package/dist/{useModuleCatalog-CkNuZzNM.js → useModuleCatalog-B9HXHA-e.js} +3 -3
  29. package/package.json +3 -1
  30. package/dist/App-BtDqnBq4.js +0 -193
  31. package/dist/AppTemplatePicker-eKlQ0c54.js +0 -184
  32. package/dist/BrandFontPicker-CyLbp5nr.js +0 -240
  33. package/dist/BrandKitView-CaxS1T-W.js +0 -217
  34. package/dist/MobileProjectsView-DEQ6q6Si.js +0 -279
  35. package/dist/StatusBadge.vue_vue_type_script_setup_true_lang-Bh9Eoe_H.js +0 -26
  36. package/dist/WorkspaceEntryView-e2EUnq9A.js +0 -21
  37. package/dist/localPreference-DneUpUrQ.js +0 -34
  38. package/dist/portalNavigation-DOF4Ah49.js +0 -28
  39. package/dist/routes-Boz_WlNM.js +0 -54
@@ -1,7 +1,8 @@
1
- import { a as jt, e as xt } from "./index-D5qXvcfE.js";
1
+ import { a as xt, e as jt } from "./index-CIJWcl_6.js";
2
2
  import { computed as nt, reactive as Et } from "vue";
3
- import { h as x, e as ot } from "./controlPlane-CoEgf9BA.js";
3
+ import { h as j, e as ot } from "./controlPlane-DT3t_ftg.js";
4
4
  import { useCoreStore as At } from "@feedmepos/mf-common";
5
+ import { g as Nt, c as Tt } from "./_commonjsHelpers-DaMA6jEr.js";
5
6
  const it = [
6
7
  "Inter",
7
8
  "Roboto",
@@ -25,18 +26,18 @@ const it = [
25
26
  "Noto Sans SC",
26
27
  "Noto Sans TC"
27
28
  ];
28
- function Nt(e) {
29
+ function kt(e) {
29
30
  var i;
30
31
  return ((i = e.split(",")[0]) == null ? void 0 : i.trim().replace(/^(['"])(.*)\1$/, "$2")) || "App default";
31
32
  }
32
- function he(e) {
33
+ function ge(e) {
33
34
  const i = ["Playfair Display", "Merriweather", "Lora"].includes(e) ? "serif" : "sans-serif";
34
35
  return `'${e}', ${i === "serif" ? "" : "system-ui, "}${i}`;
35
36
  }
36
37
  function vt(e) {
37
38
  return `https://fonts.googleapis.com/css2?${[...new Set(e)].sort().map((s) => `family=${encodeURIComponent(s)}:wght@400;500;600;700`).join("&")}&display=swap`;
38
39
  }
39
- function Tt(e) {
40
+ function Mt(e) {
40
41
  if (!e || typeof e != "object" || !("stylesheet" in e) || typeof e.stylesheet != "string")
41
42
  return !1;
42
43
  try {
@@ -53,17 +54,17 @@ function Tt(e) {
53
54
  return !1;
54
55
  }
55
56
  }
56
- function Mt(e, i) {
57
+ function Ct(e, i) {
57
58
  const s = ["brand", "heading", "body"].flatMap(
58
59
  (n) => (i[n] || "").split(",").flatMap((o) => {
59
- const u = it.find((d) => d.toLowerCase() === Nt(o).toLowerCase());
60
+ const u = it.find((d) => d.toLowerCase() === kt(o).toLowerCase());
60
61
  return u ? [u] : [];
61
62
  })
62
- ), r = Array.isArray(e) ? e.filter((n) => !Tt(n)) : [];
63
+ ), r = Array.isArray(e) ? e.filter((n) => !Mt(n)) : [];
63
64
  return s.length ? [...r, { stylesheet: vt(s) }] : r;
64
65
  }
65
66
  const z = /* @__PURE__ */ new Map();
66
- function ge(e) {
67
+ function ve(e) {
67
68
  if (!it.some((r) => r === e)) return Promise.resolve();
68
69
  const i = z.get(e);
69
70
  if (i) return i;
@@ -85,15 +86,11 @@ function ge(e) {
85
86
  });
86
87
  return z.set(e, s), s;
87
88
  }
88
- var kt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
89
- function Ct(e) {
90
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
91
- }
92
89
  var yt = { exports: {} };
93
90
  (function(e, i) {
94
91
  (function(s, r) {
95
92
  e.exports = r();
96
- })(kt, function() {
93
+ })(Tt, function() {
97
94
  return function(s) {
98
95
  var r = {};
99
96
  function n(o) {
@@ -147,9 +144,9 @@ var yt = { exports: {} };
147
144
  };
148
145
  }
149
146
  n.r(r), n.d(r, "default", function() {
150
- return _t;
147
+ return Ft;
151
148
  }), n.d(r, "compare", function() {
152
- return ft;
149
+ return ct;
153
150
  }), n.d(r, "comparable", function() {
154
151
  return X;
155
152
  });
@@ -160,23 +157,23 @@ var yt = { exports: {} };
160
157
  function w(t) {
161
158
  return function(a, l) {
162
159
  if (!d(l) || !l.length) return t(a, l);
163
- for (var c = 0, p = l.length; c < p; c++)
164
- if (t(a, b(l, c))) return !0;
160
+ for (var f = 0, p = l.length; f < p; f++)
161
+ if (t(a, b(l, f))) return !0;
165
162
  return !1;
166
163
  };
167
164
  }
168
165
  function N(t) {
169
166
  return function(a, l) {
170
167
  if (!d(l) || !l.length) return t(a, l);
171
- for (var c = 0, p = l.length; c < p; c++)
172
- if (!t(a, b(l, c))) return !1;
168
+ for (var f = 0, p = l.length; f < p; f++)
169
+ if (!t(a, b(l, f))) return !1;
173
170
  return !0;
174
171
  };
175
172
  }
176
- function O(t, a, l, c) {
177
- return t.validate(t.options, a, l, c);
173
+ function S(t, a, l, f) {
174
+ return t.validate(t.options, a, l, f);
178
175
  }
179
- var F = {
176
+ var _ = {
180
177
  $eq: w(function(t, a) {
181
178
  return t(a);
182
179
  }),
@@ -204,50 +201,50 @@ var yt = { exports: {} };
204
201
  $nin: function(t, a) {
205
202
  return t(a);
206
203
  },
207
- $not: function(t, a, l, c) {
208
- return t(a, l, c);
204
+ $not: function(t, a, l, f) {
205
+ return t(a, l, f);
209
206
  },
210
207
  $type: function(t, a) {
211
208
  return t(a);
212
209
  },
213
- $all: function(t, a, l, c) {
214
- return F.$and(t, a, l, c);
210
+ $all: function(t, a, l, f) {
211
+ return _.$and(t, a, l, f);
215
212
  },
216
213
  $size: function(t, a) {
217
214
  return !!a && t === a.length;
218
215
  },
219
- $or: function(t, a, l, c) {
216
+ $or: function(t, a, l, f) {
220
217
  for (var p = 0, h = t.length; p < h; p++)
221
- if (O(b(t, p), a, l, c)) return !0;
218
+ if (S(b(t, p), a, l, f)) return !0;
222
219
  return !1;
223
220
  },
224
- $nor: function(t, a, l, c) {
225
- return !F.$or(t, a, l, c);
221
+ $nor: function(t, a, l, f) {
222
+ return !_.$or(t, a, l, f);
226
223
  },
227
- $and: function(t, a, l, c) {
224
+ $and: function(t, a, l, f) {
228
225
  for (var p = 0, h = t.length; p < h; p++)
229
- if (!O(b(t, p), a, l, c)) return !1;
226
+ if (!S(b(t, p), a, l, f)) return !1;
230
227
  return !0;
231
228
  },
232
229
  $regex: w(function(t, a) {
233
230
  return typeof a == "string" && t.test(a);
234
231
  }),
235
- $where: function(t, a, l, c) {
236
- return t.call(a, a, l, c);
232
+ $where: function(t, a, l, f) {
233
+ return t.call(a, a, l, f);
237
234
  },
238
- $elemMatch: function(t, a, l, c) {
235
+ $elemMatch: function(t, a, l, f) {
239
236
  return d(a) ? !!~function(p, h) {
240
237
  for (var g = 0; g < p.length; g++)
241
- if (b(p, g), O(h, b(p, g))) return g;
238
+ if (b(p, g), S(h, b(p, g))) return g;
242
239
  return -1;
243
- }(a, t) : O(t, a, l, c);
240
+ }(a, t) : S(t, a, l, f);
244
241
  },
245
- $exists: function(t, a, l, c) {
246
- return c.hasOwnProperty(l) === t;
242
+ $exists: function(t, a, l, f) {
243
+ return f.hasOwnProperty(l) === t;
247
244
  }
248
245
  }, R = {
249
246
  $eq: function(t, a, l) {
250
- var c = l.comparable, p = l.compare;
247
+ var f = l.comparable, p = l.compare;
251
248
  return t instanceof RegExp ? w(function(h) {
252
249
  return typeof h == "string" && t.test(h);
253
250
  }) : t instanceof Function ? w(t) : d(t) && !t.length ? w(function(h) {
@@ -256,39 +253,39 @@ var yt = { exports: {} };
256
253
  t === null ? function(h) {
257
254
  return h == null;
258
255
  } : function(h) {
259
- return p(c(h), c(t)) === 0;
256
+ return p(f(h), f(t)) === 0;
260
257
  }
261
258
  );
262
259
  },
263
260
  $gt: function(t, a, l) {
264
- var c = l.comparable, p = l.compare;
261
+ var f = l.comparable, p = l.compare;
265
262
  return function(h) {
266
- return p(c(h), c(t)) > 0;
263
+ return p(f(h), f(t)) > 0;
267
264
  };
268
265
  },
269
266
  $gte: function(t, a, l) {
270
- var c = l.comparable, p = l.compare;
267
+ var f = l.comparable, p = l.compare;
271
268
  return function(h) {
272
- return p(c(h), c(t)) >= 0;
269
+ return p(f(h), f(t)) >= 0;
273
270
  };
274
271
  },
275
272
  $lt: function(t, a, l) {
276
- var c = l.comparable, p = l.compare;
273
+ var f = l.comparable, p = l.compare;
277
274
  return function(h) {
278
- return p(c(h), c(t)) < 0;
275
+ return p(f(h), f(t)) < 0;
279
276
  };
280
277
  },
281
278
  $lte: function(t, a, l) {
282
- var c = l.comparable, p = l.compare;
279
+ var f = l.comparable, p = l.compare;
283
280
  return function(h) {
284
- return p(c(h), c(t)) <= 0;
281
+ return p(f(h), f(t)) <= 0;
285
282
  };
286
283
  },
287
284
  $in: function(t, a, l) {
288
- var c = l.comparable;
285
+ var f = l.comparable;
289
286
  return function(p) {
290
287
  if (!(p instanceof Array)) {
291
- var h = c(p);
288
+ var h = f(p);
292
289
  if (h === p && o(p) === "object") {
293
290
  for (y = t.length; y--; )
294
291
  if (String(t[y]) === String(p) && String(p) !== "[object Object]")
@@ -298,21 +295,21 @@ var yt = { exports: {} };
298
295
  for (y = t.length; y--; ) if (t[y] == null) return !0;
299
296
  }
300
297
  for (y = t.length; y--; ) {
301
- var g = O(lt(b(t, y), l), h, y, t);
298
+ var g = S(lt(b(t, y), l), h, y, t);
302
299
  if (g && String(g) !== "[object Object]" && String(h) !== "[object Object]")
303
300
  return !0;
304
301
  }
305
302
  return !!~t.indexOf(h);
306
303
  }
307
304
  for (var y = p.length; y--; )
308
- if (~t.indexOf(c(b(p, y)))) return !0;
305
+ if (~t.indexOf(f(b(p, y)))) return !0;
309
306
  return !1;
310
307
  };
311
308
  },
312
309
  $nin: function(t, a, l) {
313
- var c = R.$in(t, a, l);
310
+ var f = R.$in(t, a, l);
314
311
  return function(p, h, g, y) {
315
- return !c(p, h, g, y);
312
+ return !f(p, h, g, y);
316
313
  };
317
314
  },
318
315
  $mod: function(t) {
@@ -321,9 +318,9 @@ var yt = { exports: {} };
321
318
  };
322
319
  },
323
320
  $ne: function(t, a, l) {
324
- var c = R.$eq(t, a, l);
321
+ var f = R.$eq(t, a, l);
325
322
  return N(function(p, h, g, y) {
326
- return !c(p, h, g, y);
323
+ return !f(p, h, g, y);
327
324
  });
328
325
  },
329
326
  $and: function(t, a, l) {
@@ -339,13 +336,13 @@ var yt = { exports: {} };
339
336
  return t.map(T(l));
340
337
  },
341
338
  $not: function(t, a, l) {
342
- var c = T(l)(t);
339
+ var f = T(l)(t);
343
340
  return function(p, h, g) {
344
- return !O(c, p, h, g);
341
+ return !S(f, p, h, g);
345
342
  };
346
343
  },
347
344
  $type: function(t) {
348
- return function(a, l, c) {
345
+ return function(a, l, f) {
349
346
  return a != null && (a instanceof t || a.constructor == t);
350
347
  };
351
348
  },
@@ -368,58 +365,58 @@ var yt = { exports: {} };
368
365
  function E(t, a) {
369
366
  return { options: t, validate: a };
370
367
  }
371
- function St(t, a) {
372
- var l = t.keyPath, c = t.child, p = t.query, h = [];
373
- if (function ct(A, k, C, Ft, W) {
374
- if (C === k.length || A == null)
375
- return void W.push([A, k[C - 1], Ft]);
376
- var dt = b(k, C);
368
+ function Pt(t, a) {
369
+ var l = t.keyPath, f = t.child, p = t.query, h = [];
370
+ if (function ft(A, M, C, _t, W) {
371
+ if (C === M.length || A == null)
372
+ return void W.push([A, M[C - 1], _t]);
373
+ var dt = b(M, C);
377
374
  if (d(A) && isNaN(Number(dt)))
378
- for (var Y = 0, Rt = A.length; Y < Rt; Y++) ct(b(A, Y), k, C, A, W);
379
- else ct(b(A, dt), k, C + 1, A, W);
375
+ for (var Y = 0, Rt = A.length; Y < Rt; Y++) ft(b(A, Y), M, C, A, W);
376
+ else ft(b(A, dt), M, C + 1, A, W);
380
377
  }(a, l, 0, a, h), h.length === 1) {
381
378
  var g = h[0];
382
- return O(c, g[0], g[1], g[2]);
379
+ return S(f, g[0], g[1], g[2]);
383
380
  }
384
- for (var y = p && p.$ne !== void 0, P = y, S = 0; S < h.length; S++) {
385
- var j = h[S], K = O(c, j[0], j[1], j[2]);
386
- y ? P &= K : P |= K;
381
+ for (var y = p && p.$ne !== void 0, O = y, P = 0; P < h.length; P++) {
382
+ var x = h[P], K = S(f, x[0], x[1], x[2]);
383
+ y ? O &= K : O |= K;
387
384
  }
388
- return P;
385
+ return O;
389
386
  }
390
387
  function $t(t, a, l) {
391
- return E({ keyPath: t, child: a, query: l }, St);
388
+ return E({ keyPath: t, child: a, query: l }, Pt);
392
389
  }
393
390
  function T(t) {
394
- var a = t.comparable, l = t.expressions, c = function(g) {
391
+ var a = t.comparable, l = t.expressions, f = function(g) {
395
392
  var y;
396
393
  return (!g || !(y = g) || y.constructor !== Object && y.constructor !== Array && y.constructor.toString() !== "function Object() { [native code] }" && y.constructor.toString() !== "function Array() { [native code] }" || y.toJSON) && (g = { $eq: g }), g;
397
394
  }, p = function(g) {
398
395
  g = a(g);
399
396
  var y = [];
400
- for (var P in g) {
401
- var S = g[P];
402
- if (P !== "$options") {
403
- var j = F[P] || t && l && l[P];
404
- if (j) R[P] && (S = R[P](S, g, t)), y.push(E(a(S), j));
397
+ for (var O in g) {
398
+ var P = g[O];
399
+ if (O !== "$options") {
400
+ var x = _[O] || t && l && l[O];
401
+ if (x) R[O] && (P = R[O](P, g, t)), y.push(E(a(P), x));
405
402
  else {
406
- if (P.charCodeAt(0) === 36)
407
- throw new Error("Unknown operation " + P);
408
- var K = P.split(".");
409
- y.push($t(K, h(S), S));
403
+ if (O.charCodeAt(0) === 36)
404
+ throw new Error("Unknown operation " + O);
405
+ var K = O.split(".");
406
+ y.push($t(K, h(P), P));
410
407
  }
411
408
  }
412
409
  }
413
- return y.length === 1 ? y[0] : E(y, F.$and);
410
+ return y.length === 1 ? y[0] : E(y, _.$and);
414
411
  }, h = function(g) {
415
- return g = c(g), function y(P, S) {
416
- if (!v(P)) return S;
417
- for (var j in P) S.push(j), y(P[j], S);
418
- return S;
412
+ return g = f(g), function y(O, P) {
413
+ if (!v(O)) return P;
414
+ for (var x in O) P.push(x), y(O[x], P);
415
+ return P;
419
416
  }(g, []).join(",").search(/[$.]/) === -1 ? E(g, D) : p(g);
420
417
  };
421
418
  return function(g) {
422
- return p(c(g));
419
+ return p(f(g));
423
420
  };
424
421
  }
425
422
  function D(t, a) {
@@ -432,8 +429,8 @@ var yt = { exports: {} };
432
429
  }
433
430
  if (d(t)) {
434
431
  if (t.length !== a.length) return !1;
435
- for (var c = 0, p = t.length; c < p; c++)
436
- if (!D(t[c], a[c])) return !1;
432
+ for (var f = 0, p = t.length; f < p; f++)
433
+ if (!D(t[f], a[f])) return !1;
437
434
  return !0;
438
435
  }
439
436
  return t === a;
@@ -442,18 +439,18 @@ var yt = { exports: {} };
442
439
  var l = T(a)(t);
443
440
  return a && a.select && (l = {
444
441
  options: l,
445
- validate: function(c, p, h, g) {
446
- return O(c, p && a.select(p), h, g);
442
+ validate: function(f, p, h, g) {
443
+ return S(f, p && a.select(p), h, g);
447
444
  }
448
445
  }), l;
449
446
  }
450
- function _t(t, a) {
451
- var l = lt(t, a = Object.assign({ compare: ft, comparable: X }, a));
452
- return function(c, p, h) {
453
- return O(l, c, p, h);
447
+ function Ft(t, a) {
448
+ var l = lt(t, a = Object.assign({ compare: ct, comparable: X }, a));
449
+ return function(f, p, h) {
450
+ return S(l, f, p, h);
454
451
  };
455
452
  }
456
- function ft(t, a) {
453
+ function ct(t, a) {
457
454
  if (D(t, a)) return 0;
458
455
  if (o(t) === o(a)) {
459
456
  if (t > a) return 1;
@@ -468,7 +465,7 @@ var yt = { exports: {} };
468
465
  });
469
466
  })(yt);
470
467
  var It = yt.exports;
471
- const Bt = /* @__PURE__ */ Ct(It);
468
+ const Bt = /* @__PURE__ */ Nt(It);
472
469
  function Lt(e, i) {
473
470
  for (var s = 0; s < i.length; s++) {
474
471
  var r = i[s];
@@ -663,12 +660,12 @@ var ee = /* @__PURE__ */ function() {
663
660
  for (var n = /* @__PURE__ */ Object.create(null), o = this[$].RuleType, u = !0, d = !1, v = 0; v < r.length; v++) {
664
661
  var m = new o(r[v]), b = this.expandActions(m.actions), w = Z(m.subject), N = r.length - v - 1;
665
662
  u = !!(u && m.inverted), !d && m.fields && (d = !0);
666
- for (var O = 0; O < w.length; O++) {
667
- var F = w[O];
668
- n[F] = n[F] || /* @__PURE__ */ Object.create(null);
663
+ for (var S = 0; S < w.length; S++) {
664
+ var _ = w[S];
665
+ n[_] = n[_] || /* @__PURE__ */ Object.create(null);
669
666
  for (var R = 0; R < b.length; R++) {
670
667
  var E = b[R];
671
- n[F][E] = n[F][E] || /* @__PURE__ */ Object.create(null), n[F][E][N] = m;
668
+ n[_][E] = n[_][E] || /* @__PURE__ */ Object.create(null), n[_][E][N] = m;
672
669
  }
673
670
  }
674
671
  }
@@ -750,7 +747,7 @@ function at() {
750
747
  }))
751
748
  );
752
749
  }
753
- function ve() {
750
+ function ye() {
754
751
  return nt(at);
755
752
  }
756
753
  const H = [
@@ -788,7 +785,7 @@ const H = [
788
785
  function ne(e) {
789
786
  return bt.test(e.trim());
790
787
  }
791
- function ye(e) {
788
+ function me(e) {
792
789
  const i = e.trim().toLowerCase();
793
790
  if (!bt.test(i)) return "#000000";
794
791
  if (i.length === 7) return i;
@@ -796,7 +793,7 @@ function ye(e) {
796
793
  return `#${s}${s}${r}${r}${n}${n}`;
797
794
  }
798
795
  function oe() {
799
- return jt(xt("fmmf:dev")).apiOrigin;
796
+ return xt(jt("fmmf:prod")).apiOrigin;
800
797
  }
801
798
  function st(e) {
802
799
  return `${oe()}/metadata/${e}/brandkit`;
@@ -830,7 +827,7 @@ function et(e, i, s) {
830
827
  function rt(e) {
831
828
  return JSON.parse(JSON.stringify(e));
832
829
  }
833
- const f = Et({
830
+ const c = Et({
834
831
  panelOpen: !1,
835
832
  loading: !1,
836
833
  saving: !1,
@@ -852,62 +849,62 @@ async function ut(e) {
852
849
  return await i.json();
853
850
  }
854
851
  function q(e) {
855
- f.colors = et(e, "colors", H), f.fonts = et(e, "fonts", L), f.savedColors = { ...f.colors }, f.savedFonts = { ...f.fonts }, f.loaded = !0;
852
+ c.colors = et(e, "colors", H), c.fonts = et(e, "fonts", L), c.savedColors = { ...c.colors }, c.savedFonts = { ...c.fonts }, c.loaded = !0;
856
853
  }
857
- let M = null, _ = 0, B = null;
854
+ let k = null, F = 0, B = null;
858
855
  function wt(e = !1) {
859
- const i = x();
860
- if (f.loaded && !e && f.businessId === i) return Promise.resolve();
861
- if ((M == null ? void 0 : M.businessId) === i) return M.promise;
862
- const s = ++_;
863
- f.businessId !== i && (f.businessId = i, f.loaded = !1, f.revertKit = null, B = null, f.appliedProposal = null, q(null), f.loaded = !1);
856
+ const i = j();
857
+ if (c.loaded && !e && c.businessId === i) return Promise.resolve();
858
+ if ((k == null ? void 0 : k.businessId) === i) return k.promise;
859
+ const s = ++F;
860
+ c.businessId !== i && (c.businessId = i, c.loaded = !1, c.revertKit = null, B = null, c.appliedProposal = null, q(null), c.loaded = !1);
864
861
  const r = (async () => {
865
- f.loading = !0, f.error = null;
862
+ c.loading = !0, c.error = null;
866
863
  try {
867
864
  const n = await ut(i);
868
- s === _ && q(n);
865
+ s === F && q(n);
869
866
  } catch (n) {
870
- s === _ && (f.error = ot(n));
867
+ s === F && (c.error = ot(n));
871
868
  } finally {
872
- s === _ && (f.loading = !1, M = null);
869
+ s === F && (c.loading = !1, k = null);
873
870
  }
874
871
  })();
875
- return M = { businessId: i, promise: r }, r;
872
+ return k = { businessId: i, promise: r }, r;
876
873
  }
877
- function Ot() {
878
- const e = H.filter((s) => f.colors[s.path] !== f.savedColors[s.path]).map(
874
+ function St() {
875
+ const e = H.filter((s) => c.colors[s.path] !== c.savedColors[s.path]).map(
879
876
  (s) => s.path
880
- ), i = L.filter((s) => f.fonts[s.path] !== f.savedFonts[s.path]).map(
877
+ ), i = L.filter((s) => c.fonts[s.path] !== c.savedFonts[s.path]).map(
881
878
  (s) => s.path
882
879
  );
883
880
  return { colorPaths: e, fontPaths: i };
884
881
  }
885
882
  const ie = nt(() => {
886
- const { colorPaths: e, fontPaths: i } = Ot();
883
+ const { colorPaths: e, fontPaths: i } = St();
887
884
  return e.length + i.length;
888
- }), Pt = nt(
885
+ }), Ot = nt(
889
886
  () => H.some((e) => {
890
- const i = f.colors[e.path] ?? "";
887
+ const i = c.colors[e.path] ?? "";
891
888
  return i !== "" && !ne(i);
892
889
  })
893
890
  );
894
891
  async function ae() {
895
- const e = x();
892
+ const e = j();
896
893
  if (!at())
897
- throw f.error = "You do not have permission to manage this Brand Kit. Contact an administrator.", new Error(f.error);
898
- if (f.saving || f.loading || !f.loaded || f.businessId !== e)
894
+ throw c.error = "You do not have permission to manage this Brand Kit. Contact an administrator.", new Error(c.error);
895
+ if (c.saving || c.loading || !c.loaded || c.businessId !== e)
899
896
  throw new Error("Wait for the current Brand Kit to finish loading or saving.");
900
- if (Pt.value) throw new Error("Enter valid hex colors before saving.");
901
- const { colorPaths: i, fontPaths: s } = Ot();
897
+ if (Ot.value) throw new Error("Enter valid hex colors before saving.");
898
+ const { colorPaths: i, fontPaths: s } = St();
902
899
  if (!i.length && !s.length) return;
903
- const r = { ...f.colors }, n = { ...f.fonts }, o = _;
904
- f.saving = !0, f.error = null;
900
+ const r = { ...c.colors }, n = { ...c.fonts }, o = F;
901
+ c.saving = !0, c.error = null;
905
902
  try {
906
903
  const u = await ut(e) ?? {}, d = rt(u), v = rt(u);
907
904
  (!v.colors || typeof v.colors != "object") && (v.colors = {}), (!v.fonts || typeof v.fonts != "object") && (v.fonts = {});
908
905
  for (const b of i) tt(v.colors, b, (r[b] ?? "").trim());
909
906
  for (const b of s) tt(v.fonts, b, (n[b] ?? "").trim());
910
- if (s.length && (v.fontFamilies = Mt(u.fontFamilies, et(v, "fonts", L))), o !== _ || e !== x())
907
+ if (s.length && (v.fontFamilies = Ct(u.fontFamilies, et(v, "fonts", L))), o !== F || e !== j())
911
908
  throw new Error("Business changed. No Brand Kit was saved.");
912
909
  const m = await fetch(st(e), {
913
910
  method: "POST",
@@ -916,29 +913,29 @@ async function ae() {
916
913
  signal: AbortSignal.timeout(2e4)
917
914
  });
918
915
  if (!m.ok) throw new Error(`Save failed: HTTP ${m.status}`);
919
- o === _ && e === x() && (f.revertKit = d, B = {
916
+ o === F && e === j() && (c.revertKit = d, B = {
920
917
  colorPaths: i,
921
918
  fontPaths: s,
922
919
  savedFontFamilies: s.length ? JSON.stringify(v.fontFamilies) : void 0
923
- }, f.appliedProposal = null, q(v));
920
+ }, c.appliedProposal = null, q(v));
924
921
  } catch (u) {
925
- throw o === _ && (f.error = ot(u)), u;
922
+ throw o === F && (c.error = ot(u)), u;
926
923
  } finally {
927
- f.saving = !1;
924
+ c.saving = !1;
928
925
  }
929
926
  }
930
927
  async function se() {
931
- if (!f.revertKit || !B || f.saving || f.loading) return;
932
- const e = x();
928
+ if (!c.revertKit || !B || c.saving || c.loading) return;
929
+ const e = j();
933
930
  if (!at())
934
- throw f.error = "You do not have permission to manage this Brand Kit. Contact an administrator.", new Error(f.error);
935
- if (f.businessId !== e) throw new Error("Load the current business before reverting.");
936
- const i = _, s = rt(f.revertKit), r = B;
937
- f.saving = !0, f.error = null;
931
+ throw c.error = "You do not have permission to manage this Brand Kit. Contact an administrator.", new Error(c.error);
932
+ if (c.businessId !== e) throw new Error("Load the current business before reverting.");
933
+ const i = F, s = rt(c.revertKit), r = B;
934
+ c.saving = !0, c.error = null;
938
935
  try {
939
936
  const n = await ut(e) ?? {};
940
937
  if (r.fontPaths.length) {
941
- if (L.some((u) => (I(n.fonts, u.path) ?? "") !== f.savedFonts[u.path]) || JSON.stringify(n.fontFamilies) !== r.savedFontFamilies)
938
+ if (L.some((u) => (I(n.fonts, u.path) ?? "") !== c.savedFonts[u.path]) || JSON.stringify(n.fontFamilies) !== r.savedFontFamilies)
942
939
  throw new Error("Brand Kit changed since your save. Reload it before editing again.");
943
940
  Object.hasOwn(s, "fontFamilies") ? n.fontFamilies = s.fontFamilies : delete n.fontFamilies;
944
941
  }
@@ -946,7 +943,7 @@ async function se() {
946
943
  ["colors", r.colorPaths],
947
944
  ["fonts", r.fontPaths]
948
945
  ]) {
949
- const v = u === "colors" ? f.savedColors : f.savedFonts;
946
+ const v = u === "colors" ? c.savedColors : c.savedFonts;
950
947
  for (const m of d) {
951
948
  if ((I(n[u], m) ?? "") !== v[m])
952
949
  throw new Error("Brand Kit changed since your save. Reload it before editing again.");
@@ -954,12 +951,12 @@ async function se() {
954
951
  const b = I(s[u], m);
955
952
  if (typeof b == "string") tt(n[u], m, b);
956
953
  else {
957
- const w = m.split("."), N = w.pop(), O = w.length ? I(n[u], w.join(".")) : n[u];
958
- O && typeof O == "object" && delete O[N];
954
+ const w = m.split("."), N = w.pop(), S = w.length ? I(n[u], w.join(".")) : n[u];
955
+ S && typeof S == "object" && delete S[N];
959
956
  }
960
957
  }
961
958
  }
962
- if (i !== _ || e !== x())
959
+ if (i !== F || e !== j())
963
960
  throw new Error("Business changed. No Brand Kit was reverted.");
964
961
  const o = await fetch(st(e), {
965
962
  method: "POST",
@@ -968,36 +965,36 @@ async function se() {
968
965
  signal: AbortSignal.timeout(2e4)
969
966
  });
970
967
  if (!o.ok) throw new Error(`Revert failed: HTTP ${o.status}`);
971
- i === _ && e === x() && (f.revertKit = null, B = null, q(n));
968
+ i === F && e === j() && (c.revertKit = null, B = null, q(n));
972
969
  } catch (n) {
973
- throw i === _ && (f.error = ot(n)), n;
970
+ throw i === F && (c.error = ot(n)), n;
974
971
  } finally {
975
- f.saving = !1;
972
+ c.saving = !1;
976
973
  }
977
974
  }
978
975
  async function ue(e) {
979
- f.panelOpen = !0;
980
- const i = x();
981
- if (await wt(), !(!f.loaded || f.loading || f.saving || f.businessId !== i || x() !== i)) {
976
+ c.panelOpen = !0;
977
+ const i = j();
978
+ if (await wt(), !(!c.loaded || c.loading || c.saving || c.businessId !== i || j() !== i)) {
982
979
  for (const s of H) {
983
980
  const r = e.colors[s.path];
984
- r && (f.colors[s.path] = r);
981
+ r && (c.colors[s.path] = r);
985
982
  }
986
983
  for (const s of L) {
987
984
  const r = e.fonts[s.path];
988
- r && (f.fonts[s.path] = r);
985
+ r && (c.fonts[s.path] = r);
989
986
  }
990
- f.appliedProposal = e.name ?? "Untitled proposal";
987
+ c.appliedProposal = e.name ?? "Untitled proposal";
991
988
  }
992
989
  }
993
990
  function le() {
994
- f.colors = { ...f.savedColors }, f.fonts = { ...f.savedFonts }, f.appliedProposal = null;
991
+ c.colors = { ...c.savedColors }, c.fonts = { ...c.savedFonts }, c.appliedProposal = null;
995
992
  }
996
- function me() {
993
+ function be() {
997
994
  return {
998
- state: f,
995
+ state: c,
999
996
  dirtyCount: ie,
1000
- hasInvalidColor: Pt,
997
+ hasInvalidColor: Ot,
1001
998
  load: wt,
1002
999
  save: ae,
1003
1000
  revertLastSave: se,
@@ -1009,12 +1006,11 @@ export {
1009
1006
  H as C,
1010
1007
  L as F,
1011
1008
  it as G,
1012
- ve as a,
1013
- Nt as b,
1014
- he as f,
1015
- Ct as g,
1009
+ ye as a,
1010
+ kt as b,
1011
+ ge as f,
1016
1012
  ne as i,
1017
- ge as l,
1018
- ye as t,
1019
- me as u
1013
+ ve as l,
1014
+ me as t,
1015
+ be as u
1020
1016
  };