@feedmepos/mf-miniprogram-v2 0.2.11-dev.1 → 0.2.11-dev.2
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-B0BXsVum.js +235 -0
- package/dist/{BrandFontPicker-CixDQhv-.js → BrandFontPicker-D_MntcD2.js} +1 -1
- package/dist/{BrandKitView-C0s8XmOA.js → BrandKitView-DHV0PUus.js} +2 -2
- package/dist/{ControlPlaneView-BUzkjvFu.js → ControlPlaneView-CPGMj9dc.js} +8269 -8167
- package/dist/{EcosystemView-Bp52MYSA.js → EcosystemView-Blo9u-dq.js} +3 -3
- package/dist/{MobileProjectDialog-CsezBOzx.js → MobileProjectDialog-QfVNJfyE.js} +1 -1
- package/dist/{MobileProjectsView-BX7HZv_b.js → MobileProjectsView-DVjw5R18.js} +3 -3
- package/dist/{ModuleCenterView-Bus9dN9-.js → ModuleCenterView-D_5TWuln.js} +1 -1
- package/dist/{ModuleDetailView-C0IVjslg.js → ModuleDetailView-U8M_-5qs.js} +1 -1
- package/dist/{PagesView-BYyOLtCz.js → PagesView-Bz5aN_A-.js} +1 -1
- package/dist/{PortalSettingsView-fR4yOFsv.js → PortalSettingsView-C-5ahh8D.js} +2 -2
- package/dist/{TemplateCenterView-BYb1WIgm.js → TemplateCenterView-Bd5haOtu.js} +1 -1
- package/dist/{WorkspaceEntryView-CcohqnAX.js → WorkspaceEntryView-V-Tu9Iiy.js} +1 -1
- package/dist/app.js +11 -11
- package/dist/{controlPlane-DffMY39e.js → controlPlane-Bn-uDXG_.js} +34 -33
- package/dist/localPreference-CaizsY6G.js +972 -0
- package/dist/package.json +1 -1
- package/dist/{portalContext-MKst4jC0.js → portalContext-FZ8_SePb.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/useBrandKit-Dl8N-9UZ.js +1110 -0
- package/dist/{useModuleCatalog-CS56tCMs.js → useModuleCatalog-CNvI4aSK.js} +1 -1
- package/package.json +1 -1
- package/dist/App-C0WpITly.js +0 -1129
- package/dist/localPreference-DJ1WUOiz.js +0 -62
- package/dist/useBrandKit-ChIpWVpr.js +0 -1096
|
@@ -1,1096 +0,0 @@
|
|
|
1
|
-
import { f as Ct, e as Nt } from "./index-DB33ug2V.js";
|
|
2
|
-
import { computed as B, reactive as Mt } from "vue";
|
|
3
|
-
import { k as _, e as st, h as kt } from "./controlPlane-DffMY39e.js";
|
|
4
|
-
import { useCoreStore as Dt } from "@feedmepos/mf-common";
|
|
5
|
-
import { g as Bt, c as Ut } from "./_commonjsHelpers-DaMA6jEr.js";
|
|
6
|
-
const ut = [
|
|
7
|
-
"Inter",
|
|
8
|
-
"Roboto",
|
|
9
|
-
"Open Sans",
|
|
10
|
-
"Lato",
|
|
11
|
-
"Montserrat",
|
|
12
|
-
"Noto Sans",
|
|
13
|
-
"Nunito",
|
|
14
|
-
"Nunito Sans",
|
|
15
|
-
"Poppins",
|
|
16
|
-
"Raleway",
|
|
17
|
-
"Source Sans 3",
|
|
18
|
-
"Ubuntu",
|
|
19
|
-
"DM Sans",
|
|
20
|
-
"Manrope",
|
|
21
|
-
"Work Sans",
|
|
22
|
-
"Oswald",
|
|
23
|
-
"Playfair Display",
|
|
24
|
-
"Merriweather",
|
|
25
|
-
"Lora",
|
|
26
|
-
"Noto Sans SC",
|
|
27
|
-
"Noto Sans TC"
|
|
28
|
-
];
|
|
29
|
-
function Kt(t) {
|
|
30
|
-
var o;
|
|
31
|
-
return ((o = t.split(",")[0]) == null ? void 0 : o.trim().replace(/^(['"])(.*)\1$/, "$2")) || "App default";
|
|
32
|
-
}
|
|
33
|
-
function Ae(t) {
|
|
34
|
-
const o = ["Playfair Display", "Merriweather", "Lora"].includes(t) ? "serif" : "sans-serif";
|
|
35
|
-
return `'${t}', ${o === "serif" ? "" : "system-ui, "}${o}`;
|
|
36
|
-
}
|
|
37
|
-
function bt(t) {
|
|
38
|
-
return `https://fonts.googleapis.com/css2?${[...new Set(t)].sort().map((s) => `family=${encodeURIComponent(s)}:wght@400;500;600;700`).join("&")}&display=swap`;
|
|
39
|
-
}
|
|
40
|
-
function Gt(t) {
|
|
41
|
-
if (!t || typeof t != "object" || !("stylesheet" in t) || typeof t.stylesheet != "string")
|
|
42
|
-
return !1;
|
|
43
|
-
try {
|
|
44
|
-
const o = new URL(t.stylesheet);
|
|
45
|
-
if (o.hostname !== "fonts.googleapis.com" || !["/css", "/css2"].includes(o.pathname)) return !1;
|
|
46
|
-
const s = o.searchParams.getAll("family").flatMap((e) => e.split("|"));
|
|
47
|
-
return s.length > 0 && s.every(
|
|
48
|
-
(e) => ut.some((n) => {
|
|
49
|
-
var i;
|
|
50
|
-
return n.toLowerCase() === ((i = e.split(":")[0]) == null ? void 0 : i.trim().toLowerCase());
|
|
51
|
-
})
|
|
52
|
-
);
|
|
53
|
-
} catch {
|
|
54
|
-
return !1;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function Ht(t, o) {
|
|
58
|
-
const s = ["brand", "heading", "body"].flatMap(
|
|
59
|
-
(n) => (o[n] || "").split(",").flatMap((i) => {
|
|
60
|
-
const l = ut.find((f) => f.toLowerCase() === Kt(i).toLowerCase());
|
|
61
|
-
return l ? [l] : [];
|
|
62
|
-
})
|
|
63
|
-
), e = Array.isArray(t) ? t.filter((n) => !Gt(n)) : [];
|
|
64
|
-
return s.length ? [...e, { stylesheet: bt(s) }] : e;
|
|
65
|
-
}
|
|
66
|
-
const Z = /* @__PURE__ */ new Map();
|
|
67
|
-
function je(t) {
|
|
68
|
-
if (!ut.some((e) => e === t)) return Promise.resolve();
|
|
69
|
-
const o = Z.get(t);
|
|
70
|
-
if (o) return o;
|
|
71
|
-
const s = new Promise((e, n) => {
|
|
72
|
-
const i = document.createElement("link");
|
|
73
|
-
i.rel = "stylesheet", i.href = bt([t]);
|
|
74
|
-
let l = !1;
|
|
75
|
-
const f = window.setTimeout(() => y(), 15e3), y = () => {
|
|
76
|
-
l || (l = !0, window.clearTimeout(f), i.remove(), Z.delete(t), n(new Error(`Could not load ${t}`)));
|
|
77
|
-
};
|
|
78
|
-
i.onerror = y, i.onload = () => {
|
|
79
|
-
document.fonts.load(`400 16px "${t}"`).then((w) => {
|
|
80
|
-
if (!l) {
|
|
81
|
-
if (!w.length) return y();
|
|
82
|
-
l = !0, window.clearTimeout(f), e();
|
|
83
|
-
}
|
|
84
|
-
}, y);
|
|
85
|
-
}, document.head.append(i);
|
|
86
|
-
});
|
|
87
|
-
return Z.set(t, s), s;
|
|
88
|
-
}
|
|
89
|
-
var wt = { exports: {} };
|
|
90
|
-
(function(t, o) {
|
|
91
|
-
(function(s, e) {
|
|
92
|
-
t.exports = e();
|
|
93
|
-
})(Ut, function() {
|
|
94
|
-
return function(s) {
|
|
95
|
-
var e = {};
|
|
96
|
-
function n(i) {
|
|
97
|
-
if (e[i]) return e[i].exports;
|
|
98
|
-
var l = e[i] = { i, l: !1, exports: {} };
|
|
99
|
-
return s[i].call(l.exports, l, l.exports, n), l.l = !0, l.exports;
|
|
100
|
-
}
|
|
101
|
-
return n.m = s, n.c = e, n.d = function(i, l, f) {
|
|
102
|
-
n.o(i, l) || Object.defineProperty(i, l, { enumerable: !0, get: f });
|
|
103
|
-
}, n.r = function(i) {
|
|
104
|
-
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(i, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(i, "__esModule", { value: !0 });
|
|
105
|
-
}, n.t = function(i, l) {
|
|
106
|
-
if (1 & l && (i = n(i)), 8 & l || 4 & l && typeof i == "object" && i && i.__esModule) return i;
|
|
107
|
-
var f = /* @__PURE__ */ Object.create(null);
|
|
108
|
-
if (n.r(f), Object.defineProperty(f, "default", { enumerable: !0, value: i }), 2 & l && typeof i != "string")
|
|
109
|
-
for (var y in i)
|
|
110
|
-
n.d(
|
|
111
|
-
f,
|
|
112
|
-
y,
|
|
113
|
-
(function(w) {
|
|
114
|
-
return i[w];
|
|
115
|
-
}).bind(null, y)
|
|
116
|
-
);
|
|
117
|
-
return f;
|
|
118
|
-
}, n.n = function(i) {
|
|
119
|
-
var l = i && i.__esModule ? function() {
|
|
120
|
-
return i.default;
|
|
121
|
-
} : function() {
|
|
122
|
-
return i;
|
|
123
|
-
};
|
|
124
|
-
return n.d(l, "a", l), l;
|
|
125
|
-
}, n.o = function(i, l) {
|
|
126
|
-
return Object.prototype.hasOwnProperty.call(i, l);
|
|
127
|
-
}, n.p = "", n(n.s = 0);
|
|
128
|
-
}([
|
|
129
|
-
function(s, e, n) {
|
|
130
|
-
s.exports = n(1);
|
|
131
|
-
},
|
|
132
|
-
function(s, e, n) {
|
|
133
|
-
function i(r) {
|
|
134
|
-
return (i = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(a) {
|
|
135
|
-
return typeof a;
|
|
136
|
-
} : function(a) {
|
|
137
|
-
return a && typeof Symbol == "function" && a.constructor === Symbol && a !== Symbol.prototype ? "symbol" : typeof a;
|
|
138
|
-
})(r);
|
|
139
|
-
}
|
|
140
|
-
function l(r) {
|
|
141
|
-
var a = "[object " + r + "]";
|
|
142
|
-
return function(c) {
|
|
143
|
-
return Object.prototype.toString.call(c) === a;
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
n.r(e), n.d(e, "default", function() {
|
|
147
|
-
return It;
|
|
148
|
-
}), n.d(e, "compare", function() {
|
|
149
|
-
return dt;
|
|
150
|
-
}), n.d(e, "comparable", function() {
|
|
151
|
-
return V;
|
|
152
|
-
});
|
|
153
|
-
var f = l("Array"), y = l("Object"), w = l("Function");
|
|
154
|
-
function m(r, a) {
|
|
155
|
-
return w(r.get) ? r.get(a) : r[a];
|
|
156
|
-
}
|
|
157
|
-
function F(r) {
|
|
158
|
-
return function(a, c) {
|
|
159
|
-
if (!f(c) || !c.length) return r(a, c);
|
|
160
|
-
for (var d = 0, p = c.length; d < p; d++)
|
|
161
|
-
if (r(a, m(c, d))) return !0;
|
|
162
|
-
return !1;
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
function x(r) {
|
|
166
|
-
return function(a, c) {
|
|
167
|
-
if (!f(c) || !c.length) return r(a, c);
|
|
168
|
-
for (var d = 0, p = c.length; d < p; d++)
|
|
169
|
-
if (!r(a, m(c, d))) return !1;
|
|
170
|
-
return !0;
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
function b(r, a, c, d) {
|
|
174
|
-
return r.validate(r.options, a, c, d);
|
|
175
|
-
}
|
|
176
|
-
var E = {
|
|
177
|
-
$eq: F(function(r, a) {
|
|
178
|
-
return r(a);
|
|
179
|
-
}),
|
|
180
|
-
$ne: x(function(r, a) {
|
|
181
|
-
return r(a);
|
|
182
|
-
}),
|
|
183
|
-
$gt: F(function(r, a) {
|
|
184
|
-
return r(a);
|
|
185
|
-
}),
|
|
186
|
-
$gte: F(function(r, a) {
|
|
187
|
-
return r(a);
|
|
188
|
-
}),
|
|
189
|
-
$lt: F(function(r, a) {
|
|
190
|
-
return r(a);
|
|
191
|
-
}),
|
|
192
|
-
$lte: F(function(r, a) {
|
|
193
|
-
return r(a);
|
|
194
|
-
}),
|
|
195
|
-
$mod: F(function(r, a) {
|
|
196
|
-
return r(a);
|
|
197
|
-
}),
|
|
198
|
-
$in: function(r, a) {
|
|
199
|
-
return r(a);
|
|
200
|
-
},
|
|
201
|
-
$nin: function(r, a) {
|
|
202
|
-
return r(a);
|
|
203
|
-
},
|
|
204
|
-
$not: function(r, a, c, d) {
|
|
205
|
-
return r(a, c, d);
|
|
206
|
-
},
|
|
207
|
-
$type: function(r, a) {
|
|
208
|
-
return r(a);
|
|
209
|
-
},
|
|
210
|
-
$all: function(r, a, c, d) {
|
|
211
|
-
return E.$and(r, a, c, d);
|
|
212
|
-
},
|
|
213
|
-
$size: function(r, a) {
|
|
214
|
-
return !!a && r === a.length;
|
|
215
|
-
},
|
|
216
|
-
$or: function(r, a, c, d) {
|
|
217
|
-
for (var p = 0, h = r.length; p < h; p++)
|
|
218
|
-
if (b(m(r, p), a, c, d)) return !0;
|
|
219
|
-
return !1;
|
|
220
|
-
},
|
|
221
|
-
$nor: function(r, a, c, d) {
|
|
222
|
-
return !E.$or(r, a, c, d);
|
|
223
|
-
},
|
|
224
|
-
$and: function(r, a, c, d) {
|
|
225
|
-
for (var p = 0, h = r.length; p < h; p++)
|
|
226
|
-
if (!b(m(r, p), a, c, d)) return !1;
|
|
227
|
-
return !0;
|
|
228
|
-
},
|
|
229
|
-
$regex: F(function(r, a) {
|
|
230
|
-
return typeof a == "string" && r.test(a);
|
|
231
|
-
}),
|
|
232
|
-
$where: function(r, a, c, d) {
|
|
233
|
-
return r.call(a, a, c, d);
|
|
234
|
-
},
|
|
235
|
-
$elemMatch: function(r, a, c, d) {
|
|
236
|
-
return f(a) ? !!~function(p, h) {
|
|
237
|
-
for (var g = 0; g < p.length; g++)
|
|
238
|
-
if (m(p, g), b(h, m(p, g))) return g;
|
|
239
|
-
return -1;
|
|
240
|
-
}(a, r) : b(r, a, c, d);
|
|
241
|
-
},
|
|
242
|
-
$exists: function(r, a, c, d) {
|
|
243
|
-
return d.hasOwnProperty(c) === r;
|
|
244
|
-
}
|
|
245
|
-
}, A = {
|
|
246
|
-
$eq: function(r, a, c) {
|
|
247
|
-
var d = c.comparable, p = c.compare;
|
|
248
|
-
return r instanceof RegExp ? F(function(h) {
|
|
249
|
-
return typeof h == "string" && r.test(h);
|
|
250
|
-
}) : r instanceof Function ? F(r) : f(r) && !r.length ? F(function(h) {
|
|
251
|
-
return f(h) && !h.length;
|
|
252
|
-
}) : F(
|
|
253
|
-
r === null ? function(h) {
|
|
254
|
-
return h == null;
|
|
255
|
-
} : function(h) {
|
|
256
|
-
return p(d(h), d(r)) === 0;
|
|
257
|
-
}
|
|
258
|
-
);
|
|
259
|
-
},
|
|
260
|
-
$gt: function(r, a, c) {
|
|
261
|
-
var d = c.comparable, p = c.compare;
|
|
262
|
-
return function(h) {
|
|
263
|
-
return p(d(h), d(r)) > 0;
|
|
264
|
-
};
|
|
265
|
-
},
|
|
266
|
-
$gte: function(r, a, c) {
|
|
267
|
-
var d = c.comparable, p = c.compare;
|
|
268
|
-
return function(h) {
|
|
269
|
-
return p(d(h), d(r)) >= 0;
|
|
270
|
-
};
|
|
271
|
-
},
|
|
272
|
-
$lt: function(r, a, c) {
|
|
273
|
-
var d = c.comparable, p = c.compare;
|
|
274
|
-
return function(h) {
|
|
275
|
-
return p(d(h), d(r)) < 0;
|
|
276
|
-
};
|
|
277
|
-
},
|
|
278
|
-
$lte: function(r, a, c) {
|
|
279
|
-
var d = c.comparable, p = c.compare;
|
|
280
|
-
return function(h) {
|
|
281
|
-
return p(d(h), d(r)) <= 0;
|
|
282
|
-
};
|
|
283
|
-
},
|
|
284
|
-
$in: function(r, a, c) {
|
|
285
|
-
var d = c.comparable;
|
|
286
|
-
return function(p) {
|
|
287
|
-
if (!(p instanceof Array)) {
|
|
288
|
-
var h = d(p);
|
|
289
|
-
if (h === p && i(p) === "object") {
|
|
290
|
-
for (v = r.length; v--; )
|
|
291
|
-
if (String(r[v]) === String(p) && String(p) !== "[object Object]")
|
|
292
|
-
return !0;
|
|
293
|
-
}
|
|
294
|
-
if (h === void 0) {
|
|
295
|
-
for (v = r.length; v--; ) if (r[v] == null) return !0;
|
|
296
|
-
}
|
|
297
|
-
for (v = r.length; v--; ) {
|
|
298
|
-
var g = b(ft(m(r, v), c), h, v, r);
|
|
299
|
-
if (g && String(g) !== "[object Object]" && String(h) !== "[object Object]")
|
|
300
|
-
return !0;
|
|
301
|
-
}
|
|
302
|
-
return !!~r.indexOf(h);
|
|
303
|
-
}
|
|
304
|
-
for (var v = p.length; v--; )
|
|
305
|
-
if (~r.indexOf(d(m(p, v)))) return !0;
|
|
306
|
-
return !1;
|
|
307
|
-
};
|
|
308
|
-
},
|
|
309
|
-
$nin: function(r, a, c) {
|
|
310
|
-
var d = A.$in(r, a, c);
|
|
311
|
-
return function(p, h, g, v) {
|
|
312
|
-
return !d(p, h, g, v);
|
|
313
|
-
};
|
|
314
|
-
},
|
|
315
|
-
$mod: function(r) {
|
|
316
|
-
return function(a) {
|
|
317
|
-
return a % r[0] == r[1];
|
|
318
|
-
};
|
|
319
|
-
},
|
|
320
|
-
$ne: function(r, a, c) {
|
|
321
|
-
var d = A.$eq(r, a, c);
|
|
322
|
-
return x(function(p, h, g, v) {
|
|
323
|
-
return !d(p, h, g, v);
|
|
324
|
-
});
|
|
325
|
-
},
|
|
326
|
-
$and: function(r, a, c) {
|
|
327
|
-
return r.map(L(c));
|
|
328
|
-
},
|
|
329
|
-
$all: function(r, a, c) {
|
|
330
|
-
return A.$and(r, a, c);
|
|
331
|
-
},
|
|
332
|
-
$or: function(r, a, c) {
|
|
333
|
-
return r.map(L(c));
|
|
334
|
-
},
|
|
335
|
-
$nor: function(r, a, c) {
|
|
336
|
-
return r.map(L(c));
|
|
337
|
-
},
|
|
338
|
-
$not: function(r, a, c) {
|
|
339
|
-
var d = L(c)(r);
|
|
340
|
-
return function(p, h, g) {
|
|
341
|
-
return !b(d, p, h, g);
|
|
342
|
-
};
|
|
343
|
-
},
|
|
344
|
-
$type: function(r) {
|
|
345
|
-
return function(a, c, d) {
|
|
346
|
-
return a != null && (a instanceof r || a.constructor == r);
|
|
347
|
-
};
|
|
348
|
-
},
|
|
349
|
-
$regex: function(r, a) {
|
|
350
|
-
return new RegExp(r, a.$options);
|
|
351
|
-
},
|
|
352
|
-
$where: function(r) {
|
|
353
|
-
if (typeof r == "function") return r;
|
|
354
|
-
throw new Error(
|
|
355
|
-
'In CSP mode, sift does not support strings in "$where" condition'
|
|
356
|
-
);
|
|
357
|
-
},
|
|
358
|
-
$elemMatch: function(r, a, c) {
|
|
359
|
-
return L(c)(r);
|
|
360
|
-
},
|
|
361
|
-
$exists: function(r) {
|
|
362
|
-
return !!r;
|
|
363
|
-
}
|
|
364
|
-
};
|
|
365
|
-
function I(r, a) {
|
|
366
|
-
return { options: r, validate: a };
|
|
367
|
-
}
|
|
368
|
-
function At(r, a) {
|
|
369
|
-
var c = r.keyPath, d = r.child, p = r.query, h = [];
|
|
370
|
-
if (function pt(T, M, k, Tt, X) {
|
|
371
|
-
if (k === M.length || T == null)
|
|
372
|
-
return void X.push([T, M[k - 1], Tt]);
|
|
373
|
-
var ht = m(M, k);
|
|
374
|
-
if (f(T) && isNaN(Number(ht)))
|
|
375
|
-
for (var W = 0, Lt = T.length; W < Lt; W++) pt(m(T, W), M, k, T, X);
|
|
376
|
-
else pt(m(T, ht), M, k + 1, T, X);
|
|
377
|
-
}(a, c, 0, a, h), h.length === 1) {
|
|
378
|
-
var g = h[0];
|
|
379
|
-
return b(d, g[0], g[1], g[2]);
|
|
380
|
-
}
|
|
381
|
-
for (var v = p && p.$ne !== void 0, O = v, S = 0; S < h.length; S++) {
|
|
382
|
-
var j = h[S], G = b(d, j[0], j[1], j[2]);
|
|
383
|
-
v ? O &= G : O |= G;
|
|
384
|
-
}
|
|
385
|
-
return O;
|
|
386
|
-
}
|
|
387
|
-
function jt(r, a, c) {
|
|
388
|
-
return I({ keyPath: r, child: a, query: c }, At);
|
|
389
|
-
}
|
|
390
|
-
function L(r) {
|
|
391
|
-
var a = r.comparable, c = r.expressions, d = function(g) {
|
|
392
|
-
var v;
|
|
393
|
-
return (!g || !(v = g) || v.constructor !== Object && v.constructor !== Array && v.constructor.toString() !== "function Object() { [native code] }" && v.constructor.toString() !== "function Array() { [native code] }" || v.toJSON) && (g = { $eq: g }), g;
|
|
394
|
-
}, p = function(g) {
|
|
395
|
-
g = a(g);
|
|
396
|
-
var v = [];
|
|
397
|
-
for (var O in g) {
|
|
398
|
-
var S = g[O];
|
|
399
|
-
if (O !== "$options") {
|
|
400
|
-
var j = E[O] || r && c && c[O];
|
|
401
|
-
if (j) A[O] && (S = A[O](S, g, r)), v.push(I(a(S), j));
|
|
402
|
-
else {
|
|
403
|
-
if (O.charCodeAt(0) === 36)
|
|
404
|
-
throw new Error("Unknown operation " + O);
|
|
405
|
-
var G = O.split(".");
|
|
406
|
-
v.push(jt(G, h(S), S));
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
return v.length === 1 ? v[0] : I(v, E.$and);
|
|
411
|
-
}, h = function(g) {
|
|
412
|
-
return g = d(g), function v(O, S) {
|
|
413
|
-
if (!y(O)) return S;
|
|
414
|
-
for (var j in O) S.push(j), v(O[j], S);
|
|
415
|
-
return S;
|
|
416
|
-
}(g, []).join(",").search(/[$.]/) === -1 ? I(g, K) : p(g);
|
|
417
|
-
};
|
|
418
|
-
return function(g) {
|
|
419
|
-
return p(d(g));
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
function K(r, a) {
|
|
423
|
-
if (Object.prototype.toString.call(r) !== Object.prototype.toString.call(a))
|
|
424
|
-
return !1;
|
|
425
|
-
if (y(r)) {
|
|
426
|
-
if (Object.keys(r).length !== Object.keys(a).length) return !1;
|
|
427
|
-
for (var c in r) if (!K(r[c], a[c])) return !1;
|
|
428
|
-
return !0;
|
|
429
|
-
}
|
|
430
|
-
if (f(r)) {
|
|
431
|
-
if (r.length !== a.length) return !1;
|
|
432
|
-
for (var d = 0, p = r.length; d < p; d++)
|
|
433
|
-
if (!K(r[d], a[d])) return !1;
|
|
434
|
-
return !0;
|
|
435
|
-
}
|
|
436
|
-
return r === a;
|
|
437
|
-
}
|
|
438
|
-
function ft(r, a) {
|
|
439
|
-
var c = L(a)(r);
|
|
440
|
-
return a && a.select && (c = {
|
|
441
|
-
options: c,
|
|
442
|
-
validate: function(d, p, h, g) {
|
|
443
|
-
return b(d, p && a.select(p), h, g);
|
|
444
|
-
}
|
|
445
|
-
}), c;
|
|
446
|
-
}
|
|
447
|
-
function It(r, a) {
|
|
448
|
-
var c = ft(r, a = Object.assign({ compare: dt, comparable: V }, a));
|
|
449
|
-
return function(d, p, h) {
|
|
450
|
-
return b(c, d, p, h);
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
|
-
function dt(r, a) {
|
|
454
|
-
if (K(r, a)) return 0;
|
|
455
|
-
if (i(r) === i(a)) {
|
|
456
|
-
if (r > a) return 1;
|
|
457
|
-
if (r < a) return -1;
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
function V(r) {
|
|
461
|
-
return r instanceof Date ? r.getTime() : f(r) ? r.map(V) : r && typeof r.toJSON == "function" ? r.toJSON() : r;
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
]);
|
|
465
|
-
});
|
|
466
|
-
})(wt);
|
|
467
|
-
var Jt = wt.exports;
|
|
468
|
-
const qt = /* @__PURE__ */ Bt(Jt);
|
|
469
|
-
function Yt(t, o) {
|
|
470
|
-
for (var s = 0; s < o.length; s++) {
|
|
471
|
-
var e = o[s];
|
|
472
|
-
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(t, e.key, e);
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
function zt(t, o, s) {
|
|
476
|
-
return o && Yt(t.prototype, o), t;
|
|
477
|
-
}
|
|
478
|
-
function Vt(t, o) {
|
|
479
|
-
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, t.__proto__ = o;
|
|
480
|
-
}
|
|
481
|
-
function Q(t) {
|
|
482
|
-
return Q = Object.setPrototypeOf ? Object.getPrototypeOf : function(s) {
|
|
483
|
-
return s.__proto__ || Object.getPrototypeOf(s);
|
|
484
|
-
}, Q(t);
|
|
485
|
-
}
|
|
486
|
-
function q(t, o) {
|
|
487
|
-
return q = Object.setPrototypeOf || function(e, n) {
|
|
488
|
-
return e.__proto__ = n, e;
|
|
489
|
-
}, q(t, o);
|
|
490
|
-
}
|
|
491
|
-
function Xt() {
|
|
492
|
-
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
|
|
493
|
-
if (typeof Proxy == "function") return !0;
|
|
494
|
-
try {
|
|
495
|
-
return Date.prototype.toString.call(Reflect.construct(Date, [], function() {
|
|
496
|
-
})), !0;
|
|
497
|
-
} catch {
|
|
498
|
-
return !1;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
function J(t, o, s) {
|
|
502
|
-
return Xt() ? J = Reflect.construct : J = function(n, i, l) {
|
|
503
|
-
var f = [null];
|
|
504
|
-
f.push.apply(f, i);
|
|
505
|
-
var y = Function.bind.apply(n, f), w = new y();
|
|
506
|
-
return l && q(w, l.prototype), w;
|
|
507
|
-
}, J.apply(null, arguments);
|
|
508
|
-
}
|
|
509
|
-
function Wt(t) {
|
|
510
|
-
return Function.toString.call(t).indexOf("[native code]") !== -1;
|
|
511
|
-
}
|
|
512
|
-
function tt(t) {
|
|
513
|
-
var o = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
514
|
-
return tt = function(e) {
|
|
515
|
-
if (e === null || !Wt(e)) return e;
|
|
516
|
-
if (typeof e != "function")
|
|
517
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
518
|
-
if (typeof o < "u") {
|
|
519
|
-
if (o.has(e)) return o.get(e);
|
|
520
|
-
o.set(e, n);
|
|
521
|
-
}
|
|
522
|
-
function n() {
|
|
523
|
-
return J(e, arguments, Q(this).constructor);
|
|
524
|
-
}
|
|
525
|
-
return n.prototype = Object.create(e.prototype, {
|
|
526
|
-
constructor: {
|
|
527
|
-
value: n,
|
|
528
|
-
enumerable: !1,
|
|
529
|
-
writable: !0,
|
|
530
|
-
configurable: !0
|
|
531
|
-
}
|
|
532
|
-
}), q(n, e);
|
|
533
|
-
}, tt(t);
|
|
534
|
-
}
|
|
535
|
-
function gt(t) {
|
|
536
|
-
if (t === void 0)
|
|
537
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
538
|
-
return t;
|
|
539
|
-
}
|
|
540
|
-
var Ft = function(o) {
|
|
541
|
-
return 'Cannot execute "' + o.action + '" on "' + o.subjectName + '"';
|
|
542
|
-
}, H = Ft, Zt = /* @__PURE__ */ function(t) {
|
|
543
|
-
Vt(o, t), o.setDefaultMessage = function(n) {
|
|
544
|
-
n === null ? H = Ft : H = typeof n == "string" ? function() {
|
|
545
|
-
return n;
|
|
546
|
-
} : n;
|
|
547
|
-
}, o.from = function(n) {
|
|
548
|
-
var i = new this("");
|
|
549
|
-
return Object.defineProperty(i, "ability", {
|
|
550
|
-
value: n
|
|
551
|
-
}), i;
|
|
552
|
-
};
|
|
553
|
-
function o(e, n) {
|
|
554
|
-
var i;
|
|
555
|
-
return n === void 0 && (n = {}), i = t.call(this, e) || this, i._setMetadata(n), i.message = e || H(gt(i)), i._customMessage = null, typeof Error.captureStackTrace == "function" && (i.name = i.constructor.name, Error.captureStackTrace(gt(i), i.constructor)), i;
|
|
556
|
-
}
|
|
557
|
-
var s = o.prototype;
|
|
558
|
-
return s.setMessage = function(n) {
|
|
559
|
-
return this._customMessage = n, this;
|
|
560
|
-
}, s.throwUnlessCan = function(n, i, l) {
|
|
561
|
-
if (!this.ability)
|
|
562
|
-
throw new ReferenceError("Cannot throw FordiddenError without respective ability instance");
|
|
563
|
-
var f = this.ability.relevantRuleFor(n, i, l);
|
|
564
|
-
if (!(f && !f.inverted)) {
|
|
565
|
-
this._setMetadata({
|
|
566
|
-
action: n,
|
|
567
|
-
subject: i,
|
|
568
|
-
field: l,
|
|
569
|
-
subjectName: this.ability.subjectName(i)
|
|
570
|
-
});
|
|
571
|
-
var y = f ? f.reason : "";
|
|
572
|
-
throw this.message = this._customMessage || y || H(this), this;
|
|
573
|
-
}
|
|
574
|
-
}, s._setMetadata = function(n) {
|
|
575
|
-
this.subject = n.subject, this.subjectName = n.subjectName, this.action = n.action, this.field = n.field;
|
|
576
|
-
}, o;
|
|
577
|
-
}(tt(Error));
|
|
578
|
-
function et(t) {
|
|
579
|
-
return Array.isArray(t) ? t : [t];
|
|
580
|
-
}
|
|
581
|
-
function Qt(t) {
|
|
582
|
-
if (!t || typeof t == "string")
|
|
583
|
-
return t;
|
|
584
|
-
var o = typeof t == "object" ? t.constructor : t;
|
|
585
|
-
return o.modelName || o.name;
|
|
586
|
-
}
|
|
587
|
-
function te(t) {
|
|
588
|
-
return JSON.parse(JSON.stringify(t));
|
|
589
|
-
}
|
|
590
|
-
var ee = /[-/\\^$+?.()|[\]{}]/g, re = /\.?\*+\.?/g, ne = /\*+/, oe = /\./g;
|
|
591
|
-
function ie(t, o, s) {
|
|
592
|
-
var e = s[0] === "*" || t[0] === "." && t[t.length - 1] === "." ? "+" : "*", n = t.indexOf("**") === -1 ? "[^.]" : ".", i = t.replace(oe, "\\$&").replace(ne, n + e);
|
|
593
|
-
return o + t.length === s.length ? "(?:" + i + ")?" : i;
|
|
594
|
-
}
|
|
595
|
-
function ae(t, o, s) {
|
|
596
|
-
return t === "." && (s[o - 1] === "*" || s[o + 1] === "*") ? t : "\\" + t;
|
|
597
|
-
}
|
|
598
|
-
function se(t) {
|
|
599
|
-
var o = t.map(function(e) {
|
|
600
|
-
return e.replace(ee, ae).replace(re, ie);
|
|
601
|
-
}), s = o.length > 1 ? "(?:" + o.join("|") + ")" : o[0];
|
|
602
|
-
return new RegExp("^" + s + "$");
|
|
603
|
-
}
|
|
604
|
-
var ue = /* @__PURE__ */ function() {
|
|
605
|
-
function t(s) {
|
|
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
|
-
writable: !0
|
|
608
|
-
}), this.inverted = !!s.inverted, this.conditions = s.conditions, Object.defineProperty(this, "_matches", {
|
|
609
|
-
writable: !0,
|
|
610
|
-
value: this.conditions ? qt(this.conditions) : void 0
|
|
611
|
-
}), this.reason = s.reason;
|
|
612
|
-
}
|
|
613
|
-
var o = t.prototype;
|
|
614
|
-
return o.matches = function(e) {
|
|
615
|
-
return this._matches ? typeof e == "string" ? !this.inverted : this._matches(e) : !0;
|
|
616
|
-
}, o.isRelevantFor = function(e, n) {
|
|
617
|
-
return this.fields ? n ? this.matchesField(n) : !this.inverted : !0;
|
|
618
|
-
}, o.matchesField = function(e) {
|
|
619
|
-
return typeof this._fieldsPattern > "u" && (this._fieldsPattern = this.fields.join("").indexOf("*") === -1 ? null : se(this.fields)), this._fieldsPattern === null || e.indexOf("*") !== -1 ? this.fields.indexOf(e) !== -1 : this._fieldsPattern.test(e);
|
|
620
|
-
}, t;
|
|
621
|
-
}(), P = typeof Symbol < "u" ? Symbol("private") : "__" + Date.now(), yt = {
|
|
622
|
-
crud: ["create", "read", "update", "delete"]
|
|
623
|
-
};
|
|
624
|
-
function vt(t, o) {
|
|
625
|
-
return t === o || Array.isArray(o) && o.indexOf(t) !== -1;
|
|
626
|
-
}
|
|
627
|
-
var le = /* @__PURE__ */ function() {
|
|
628
|
-
t.addAlias = function(e, n) {
|
|
629
|
-
if (e === "manage" || vt("manage", n))
|
|
630
|
-
throw new Error('Cannot add alias for "manage" action because it represents any action');
|
|
631
|
-
if (vt(e, n))
|
|
632
|
-
throw new Error("Attempt to alias action to itself: " + e + " -> " + n.toString());
|
|
633
|
-
return yt[e] = n, this;
|
|
634
|
-
};
|
|
635
|
-
function t(s, e) {
|
|
636
|
-
e === void 0 && (e = {}), Object.defineProperty(this, "subjectName", {
|
|
637
|
-
value: e.subjectName || Qt
|
|
638
|
-
}), this[P] = {
|
|
639
|
-
RuleType: e.RuleType || ue,
|
|
640
|
-
originalRules: s || [],
|
|
641
|
-
hasPerFieldRules: !1,
|
|
642
|
-
indexedRules: /* @__PURE__ */ Object.create(null),
|
|
643
|
-
mergedRules: /* @__PURE__ */ Object.create(null),
|
|
644
|
-
events: {},
|
|
645
|
-
aliases: te(yt)
|
|
646
|
-
}, this.update(s);
|
|
647
|
-
}
|
|
648
|
-
var o = t.prototype;
|
|
649
|
-
return o.update = function(e) {
|
|
650
|
-
if (!Array.isArray(e))
|
|
651
|
-
return this;
|
|
652
|
-
var n = {
|
|
653
|
-
rules: e,
|
|
654
|
-
ability: this
|
|
655
|
-
};
|
|
656
|
-
this.emit("update", n), this[P].originalRules = e.slice(0), this[P].mergedRules = /* @__PURE__ */ Object.create(null);
|
|
657
|
-
var i = this.buildIndexFor(e);
|
|
658
|
-
return this[P].indexedRules = i.rules, this[P].hasPerFieldRules = i.hasPerFieldRules, this.emit("updated", n), this;
|
|
659
|
-
}, o.buildIndexFor = function(e) {
|
|
660
|
-
for (var n = /* @__PURE__ */ Object.create(null), i = this[P].RuleType, l = !0, f = !1, y = 0; y < e.length; y++) {
|
|
661
|
-
var w = new i(e[y]), m = this.expandActions(w.actions), F = et(w.subject), x = e.length - y - 1;
|
|
662
|
-
l = !!(l && w.inverted), !f && w.fields && (f = !0);
|
|
663
|
-
for (var b = 0; b < F.length; b++) {
|
|
664
|
-
var E = F[b];
|
|
665
|
-
n[E] = n[E] || /* @__PURE__ */ Object.create(null);
|
|
666
|
-
for (var A = 0; A < m.length; A++) {
|
|
667
|
-
var I = m[A];
|
|
668
|
-
n[E][I] = n[E][I] || /* @__PURE__ */ Object.create(null), n[E][I][x] = w;
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
return {
|
|
673
|
-
isAllInverted: l,
|
|
674
|
-
hasPerFieldRules: f,
|
|
675
|
-
rules: n
|
|
676
|
-
};
|
|
677
|
-
}, o.expandActions = function(e) {
|
|
678
|
-
for (var n = this[P].aliases, i = et(e), l = 0; l < i.length; ) {
|
|
679
|
-
var f = i[l++];
|
|
680
|
-
n.hasOwnProperty(f) && (i = i.concat(n[f]));
|
|
681
|
-
}
|
|
682
|
-
return i;
|
|
683
|
-
}, o.can = function(e, n, i) {
|
|
684
|
-
if (i && typeof i != "string")
|
|
685
|
-
throw new Error("Ability.can expects 3rd parameter to be a string. See https://stalniy.github.io/casl/abilities/2017/07/21/check-abilities.html#checking-fields for details");
|
|
686
|
-
var l = this.relevantRuleFor(e, n, i);
|
|
687
|
-
return !!l && !l.inverted;
|
|
688
|
-
}, o.relevantRuleFor = function(e, n, i) {
|
|
689
|
-
for (var l = this.rulesFor(e, n, i), f = 0; f < l.length; f++)
|
|
690
|
-
if (l[f].matches(n))
|
|
691
|
-
return l[f];
|
|
692
|
-
return null;
|
|
693
|
-
}, o.possibleRulesFor = function(e, n) {
|
|
694
|
-
var i = this.subjectName(n), l = this[P].mergedRules, f = i + "_" + e;
|
|
695
|
-
return l[f] || (l[f] = this.mergeRulesFor(e, i)), l[f];
|
|
696
|
-
}, o.mergeRulesFor = function(e, n) {
|
|
697
|
-
var i = this[P].indexedRules, l = [n, "all"].reduce(function(f, y) {
|
|
698
|
-
var w = i[y];
|
|
699
|
-
return w ? Object.assign(f, w[e], w.manage) : f;
|
|
700
|
-
}, []);
|
|
701
|
-
return l.filter(Boolean);
|
|
702
|
-
}, o.rulesFor = function(e, n, i) {
|
|
703
|
-
var l = this.possibleRulesFor(e, n);
|
|
704
|
-
return this[P].hasPerFieldRules ? l.filter(function(f) {
|
|
705
|
-
return f.isRelevantFor(n, i);
|
|
706
|
-
}) : l;
|
|
707
|
-
}, o.cannot = function() {
|
|
708
|
-
return !this.can.apply(this, arguments);
|
|
709
|
-
}, o.throwUnlessCan = function() {
|
|
710
|
-
var e;
|
|
711
|
-
console.warn(`
|
|
712
|
-
Ability.throwUnlessCan is deprecated and will be removed in 4.x version.
|
|
713
|
-
Please use "ForbiddenError.from(ability).throwUnlessCan(...)" instead.
|
|
714
|
-
`.trim()), (e = Zt.from(this)).throwUnlessCan.apply(e, arguments);
|
|
715
|
-
}, o.on = function(e, n) {
|
|
716
|
-
var i = this[P].events, l = !0;
|
|
717
|
-
return i[e] || (i[e] = []), i[e].push(n), function() {
|
|
718
|
-
if (l) {
|
|
719
|
-
var f = i[e].indexOf(n);
|
|
720
|
-
i[e].splice(f, 1), l = !1;
|
|
721
|
-
}
|
|
722
|
-
};
|
|
723
|
-
}, o.emit = function(e, n) {
|
|
724
|
-
var i = this[P].events[e];
|
|
725
|
-
i && i.slice(0).forEach(function(l) {
|
|
726
|
-
return l(n);
|
|
727
|
-
});
|
|
728
|
-
}, zt(t, [{
|
|
729
|
-
key: "rules",
|
|
730
|
-
get: function() {
|
|
731
|
-
return this[P].originalRules;
|
|
732
|
-
}
|
|
733
|
-
}]), t;
|
|
734
|
-
}();
|
|
735
|
-
function ce(t) {
|
|
736
|
-
return new le(t).can("manage", "business::miniProgram::brandkit");
|
|
737
|
-
}
|
|
738
|
-
function z() {
|
|
739
|
-
var o;
|
|
740
|
-
const t = ((o = Dt().sessionUser.value) == null ? void 0 : o.permissions) ?? [];
|
|
741
|
-
return ce(
|
|
742
|
-
t.map(({ fields: s, inverted: e, reason: n, ...i }) => ({
|
|
743
|
-
...i,
|
|
744
|
-
fields: s ?? void 0,
|
|
745
|
-
inverted: e ?? void 0,
|
|
746
|
-
reason: n ?? void 0
|
|
747
|
-
}))
|
|
748
|
-
);
|
|
749
|
-
}
|
|
750
|
-
function Ie() {
|
|
751
|
-
return B(z);
|
|
752
|
-
}
|
|
753
|
-
const U = [
|
|
754
|
-
{ path: "primary", label: "Primary", group: "Brand", hint: "Dominant brand color" },
|
|
755
|
-
{
|
|
756
|
-
path: "secondary",
|
|
757
|
-
label: "Secondary",
|
|
758
|
-
group: "Brand",
|
|
759
|
-
hint: "Light supporting fill — primary-colored text renders on top, keep it a light tint"
|
|
760
|
-
},
|
|
761
|
-
{ path: "accent", label: "Accent", group: "Brand", hint: "Highlight / CTA pop" },
|
|
762
|
-
{ path: "background.base", label: "Base", group: "Background", hint: "Page background" },
|
|
763
|
-
{ path: "background.elevated", label: "Elevated", group: "Background", hint: "Cards / sheets" },
|
|
764
|
-
{ path: "neutral.light", label: "Light", group: "Neutral", hint: "Borders / dividers" },
|
|
765
|
-
{ path: "neutral.mid", label: "Mid", group: "Neutral" },
|
|
766
|
-
{
|
|
767
|
-
path: "neutral.dark",
|
|
768
|
-
label: "Dark",
|
|
769
|
-
group: "Neutral",
|
|
770
|
-
hint: "Doubles as the modal scrim — keep near-black"
|
|
771
|
-
},
|
|
772
|
-
{ path: "text.onPrimary", label: "On primary", group: "Text", hint: "Text on a brand fill" },
|
|
773
|
-
{ path: "text.primary", label: "Primary", group: "Text" },
|
|
774
|
-
{ path: "text.secondary", label: "Secondary", group: "Text" },
|
|
775
|
-
{ path: "text.tertiary", label: "Tertiary", group: "Text" },
|
|
776
|
-
{ path: "status.success", label: "Success", group: "Status" },
|
|
777
|
-
{ path: "status.warning", label: "Warning", group: "Status" },
|
|
778
|
-
{ path: "status.error", label: "Error", group: "Status" },
|
|
779
|
-
{ path: "status.info", label: "Info", group: "Status" }
|
|
780
|
-
], N = [
|
|
781
|
-
{ path: "brand", label: "Brand", group: "Fonts", hint: "Logo / wordmark contexts" },
|
|
782
|
-
{ path: "heading", label: "Heading", group: "Fonts" },
|
|
783
|
-
{ path: "body", label: "Body", group: "Fonts" }
|
|
784
|
-
], rt = "HORIZONTAL", nt = "LIST", Ot = {
|
|
785
|
-
category: ["HORIZONTAL", "VERTICAL"],
|
|
786
|
-
items: ["LIST", "GRID"]
|
|
787
|
-
}, fe = { category: "VERTICAL", singleCategory: !1 };
|
|
788
|
-
function de(t) {
|
|
789
|
-
const o = $(t, "ordering.app.category");
|
|
790
|
-
return o === "VERTICAL" || o === "HORIZONTAL" ? o : rt;
|
|
791
|
-
}
|
|
792
|
-
function pe(t) {
|
|
793
|
-
return $(t, "ordering.app.items") === "GRID" ? "GRID" : nt;
|
|
794
|
-
}
|
|
795
|
-
function he(t, o, s) {
|
|
796
|
-
(!t.ordering || typeof t.ordering != "object") && (t.ordering = { kiosk: { ...fe } });
|
|
797
|
-
const e = t.ordering;
|
|
798
|
-
(!e.app || typeof e.app != "object") && (e.app = { singleCategory: !1 });
|
|
799
|
-
const n = e.app;
|
|
800
|
-
for (const i of ["category", "items"])
|
|
801
|
-
(s.includes(i) || !Ot[i].includes(n[i])) && (n[i] = o[i]);
|
|
802
|
-
}
|
|
803
|
-
const St = {
|
|
804
|
-
primary: "#ff7823",
|
|
805
|
-
secondary: "#fff3e6",
|
|
806
|
-
accent: "#B25300",
|
|
807
|
-
"background.base": "#F8F8F8",
|
|
808
|
-
"background.elevated": "#FFFFFF",
|
|
809
|
-
"neutral.light": "#DADADA",
|
|
810
|
-
"neutral.mid": "#B2B3B6",
|
|
811
|
-
"neutral.dark": "#1C1C1E",
|
|
812
|
-
"text.onPrimary": "#FFFFFF",
|
|
813
|
-
"text.primary": "#1C1C1E",
|
|
814
|
-
"text.secondary": "#555555",
|
|
815
|
-
"text.tertiary": "#A2A09E",
|
|
816
|
-
"status.success": "#10B981",
|
|
817
|
-
"status.warning": "#F59E0B",
|
|
818
|
-
"status.error": "#EF4444",
|
|
819
|
-
"status.info": "#3B82F6"
|
|
820
|
-
}, Pt = {
|
|
821
|
-
brand: "'Inter', sans-serif",
|
|
822
|
-
heading: "'Inter', sans-serif",
|
|
823
|
-
body: "'Roboto', sans-serif"
|
|
824
|
-
}, Rt = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
825
|
-
function ge(t) {
|
|
826
|
-
return Rt.test(t.trim());
|
|
827
|
-
}
|
|
828
|
-
function mt(t) {
|
|
829
|
-
const o = t.trim().toLowerCase();
|
|
830
|
-
if (!Rt.test(o)) return "#000000";
|
|
831
|
-
if (o.length === 7) return o;
|
|
832
|
-
const [s, e, n] = o.slice(1);
|
|
833
|
-
return `#${s}${s}${e}${e}${n}${n}`;
|
|
834
|
-
}
|
|
835
|
-
function ye() {
|
|
836
|
-
return Ct(Nt("fmmf:dev")).apiOrigin;
|
|
837
|
-
}
|
|
838
|
-
function lt(t) {
|
|
839
|
-
return `${ye()}/metadata/${t}/brandkit`;
|
|
840
|
-
}
|
|
841
|
-
async function $t() {
|
|
842
|
-
const t = await kt();
|
|
843
|
-
return t ? { "Content-Type": "application/json", Authorization: t } : { "Content-Type": "application/json" };
|
|
844
|
-
}
|
|
845
|
-
function $(t, o) {
|
|
846
|
-
let s = t;
|
|
847
|
-
for (const e of o.split(".")) {
|
|
848
|
-
if (!s || typeof s != "object") return;
|
|
849
|
-
s = s[e];
|
|
850
|
-
}
|
|
851
|
-
return s;
|
|
852
|
-
}
|
|
853
|
-
function ot(t, o, s) {
|
|
854
|
-
const e = o.split("."), n = e.pop();
|
|
855
|
-
if (!n) return;
|
|
856
|
-
let i = t;
|
|
857
|
-
for (const l of e) {
|
|
858
|
-
const f = i[l];
|
|
859
|
-
(!f || typeof f != "object") && (i[l] = {}), i = i[l];
|
|
860
|
-
}
|
|
861
|
-
i[n] = s;
|
|
862
|
-
}
|
|
863
|
-
function it(t, o, s) {
|
|
864
|
-
const e = {};
|
|
865
|
-
for (const n of s) {
|
|
866
|
-
const i = $(t == null ? void 0 : t[o], n.path);
|
|
867
|
-
e[n.path] = typeof i == "string" ? i : "";
|
|
868
|
-
}
|
|
869
|
-
return e;
|
|
870
|
-
}
|
|
871
|
-
function at(t) {
|
|
872
|
-
return JSON.parse(JSON.stringify(t));
|
|
873
|
-
}
|
|
874
|
-
const u = Mt({
|
|
875
|
-
panelOpen: !1,
|
|
876
|
-
loading: !1,
|
|
877
|
-
saving: !1,
|
|
878
|
-
loaded: !1,
|
|
879
|
-
error: null,
|
|
880
|
-
businessId: null,
|
|
881
|
-
colors: {},
|
|
882
|
-
fonts: {},
|
|
883
|
-
savedColors: {},
|
|
884
|
-
savedFonts: {},
|
|
885
|
-
categoryLayout: rt,
|
|
886
|
-
savedCategoryLayout: rt,
|
|
887
|
-
menuItems: nt,
|
|
888
|
-
savedMenuItems: nt,
|
|
889
|
-
// Full kit as it was before our last save — the only undo colors get.
|
|
890
|
-
revertKit: null,
|
|
891
|
-
appliedProposal: null
|
|
892
|
-
});
|
|
893
|
-
async function ct(t) {
|
|
894
|
-
const o = await fetch(lt(t), { signal: AbortSignal.timeout(15e3) });
|
|
895
|
-
if (o.status === 404) return null;
|
|
896
|
-
if (!o.ok) throw new Error(`GET brandkit failed: HTTP ${o.status}`);
|
|
897
|
-
return await o.json();
|
|
898
|
-
}
|
|
899
|
-
function Y(t) {
|
|
900
|
-
u.colors = it(t, "colors", U), u.fonts = it(t, "fonts", N), u.savedColors = { ...u.colors }, u.savedFonts = { ...u.fonts }, u.categoryLayout = de(t), u.savedCategoryLayout = u.categoryLayout, u.menuItems = pe(t), u.savedMenuItems = u.menuItems, u.loaded = !0;
|
|
901
|
-
}
|
|
902
|
-
let C = null, R = 0, D = null;
|
|
903
|
-
function Et(t = !1) {
|
|
904
|
-
const o = _();
|
|
905
|
-
if (u.loaded && !t && u.businessId === o) return Promise.resolve();
|
|
906
|
-
if ((C == null ? void 0 : C.businessId) === o) return C.promise;
|
|
907
|
-
const s = ++R;
|
|
908
|
-
u.businessId !== o && (u.businessId = o, u.loaded = !1, u.revertKit = null, D = null, u.appliedProposal = null, Y(null), u.loaded = !1);
|
|
909
|
-
const e = (async () => {
|
|
910
|
-
u.loading = !0, u.error = null;
|
|
911
|
-
try {
|
|
912
|
-
const n = await ct(o);
|
|
913
|
-
s === R && Y(n);
|
|
914
|
-
} catch (n) {
|
|
915
|
-
s === R && (u.error = st(n));
|
|
916
|
-
} finally {
|
|
917
|
-
s === R && (u.loading = !1, C = null);
|
|
918
|
-
}
|
|
919
|
-
})();
|
|
920
|
-
return C = { businessId: o, promise: e }, e;
|
|
921
|
-
}
|
|
922
|
-
function _t() {
|
|
923
|
-
const t = U.filter((e) => u.colors[e.path] !== u.savedColors[e.path]).map(
|
|
924
|
-
(e) => e.path
|
|
925
|
-
), o = N.filter((e) => u.fonts[e.path] !== u.savedFonts[e.path]).map(
|
|
926
|
-
(e) => e.path
|
|
927
|
-
), s = [];
|
|
928
|
-
return u.categoryLayout !== u.savedCategoryLayout && s.push("category"), u.menuItems !== u.savedMenuItems && s.push("items"), { colorPaths: t, fontPaths: o, layoutFields: s };
|
|
929
|
-
}
|
|
930
|
-
const ve = B(() => {
|
|
931
|
-
const { colorPaths: t, fontPaths: o, layoutFields: s } = _t();
|
|
932
|
-
return t.length + o.length + s.length;
|
|
933
|
-
}), xt = B(
|
|
934
|
-
() => U.some((t) => {
|
|
935
|
-
const o = u.colors[t.path] ?? "";
|
|
936
|
-
return o !== "" && !ge(o);
|
|
937
|
-
})
|
|
938
|
-
);
|
|
939
|
-
async function me() {
|
|
940
|
-
const t = _();
|
|
941
|
-
if (!z())
|
|
942
|
-
throw u.error = "You do not have permission to manage this Brand Kit. Contact an administrator.", new Error(u.error);
|
|
943
|
-
if (u.saving || u.loading || !u.loaded || u.businessId !== t)
|
|
944
|
-
throw new Error("Wait for the current Brand Kit to finish loading or saving.");
|
|
945
|
-
if (xt.value) throw new Error("Enter valid hex colors before saving.");
|
|
946
|
-
const { colorPaths: o, fontPaths: s, layoutFields: e } = _t();
|
|
947
|
-
if (!o.length && !s.length && !e.length) return;
|
|
948
|
-
const n = { ...u.colors }, i = { ...u.fonts }, l = { category: u.categoryLayout, items: u.menuItems }, f = R;
|
|
949
|
-
u.saving = !0, u.error = null;
|
|
950
|
-
try {
|
|
951
|
-
const y = await ct(t) ?? {}, w = at(y), m = at(y);
|
|
952
|
-
o.length && (!m.colors || typeof m.colors != "object") && (m.colors = {}), s.length && (!m.fonts || typeof m.fonts != "object") && (m.fonts = {});
|
|
953
|
-
for (const b of o) ot(m.colors, b, (n[b] ?? "").trim());
|
|
954
|
-
for (const b of s) ot(m.fonts, b, (i[b] ?? "").trim());
|
|
955
|
-
s.length && (m.fontFamilies = Ht(y.fontFamilies, it(m, "fonts", N)));
|
|
956
|
-
const F = e.length ? ["category", "items"].filter(
|
|
957
|
-
(b) => e.includes(b) || !Ot[b].includes($(y, `ordering.app.${b}`))
|
|
958
|
-
) : [];
|
|
959
|
-
if (e.length && he(m, l, e), f !== R || t !== _())
|
|
960
|
-
throw new Error("Business changed. No Brand Kit was saved.");
|
|
961
|
-
const x = await fetch(lt(t), {
|
|
962
|
-
method: "POST",
|
|
963
|
-
headers: await $t(),
|
|
964
|
-
body: JSON.stringify(m),
|
|
965
|
-
signal: AbortSignal.timeout(2e4)
|
|
966
|
-
});
|
|
967
|
-
if (!x.ok) throw new Error(`Save failed: HTTP ${x.status}`);
|
|
968
|
-
f === R && t === _() && (u.revertKit = w, D = {
|
|
969
|
-
colorPaths: o,
|
|
970
|
-
fontPaths: s,
|
|
971
|
-
savedFontFamilies: s.length ? JSON.stringify(m.fontFamilies) : void 0,
|
|
972
|
-
...F.length ? {
|
|
973
|
-
menuLayout: {
|
|
974
|
-
fields: F,
|
|
975
|
-
previous: Object.fromEntries(F.map((b) => [b, $(y, `ordering.app.${b}`)]))
|
|
976
|
-
}
|
|
977
|
-
} : {}
|
|
978
|
-
}, u.appliedProposal = null, Y(m));
|
|
979
|
-
} catch (y) {
|
|
980
|
-
throw f === R && (u.error = st(y)), y;
|
|
981
|
-
} finally {
|
|
982
|
-
u.saving = !1;
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
async function be() {
|
|
986
|
-
if (!u.revertKit || !D || u.saving || u.loading) return;
|
|
987
|
-
const t = _();
|
|
988
|
-
if (!z())
|
|
989
|
-
throw u.error = "You do not have permission to manage this Brand Kit. Contact an administrator.", new Error(u.error);
|
|
990
|
-
if (u.businessId !== t) throw new Error("Load the current business before reverting.");
|
|
991
|
-
const o = R, s = at(u.revertKit), e = D;
|
|
992
|
-
u.saving = !0, u.error = null;
|
|
993
|
-
try {
|
|
994
|
-
const n = await ct(t) ?? {};
|
|
995
|
-
if (e.fontPaths.length) {
|
|
996
|
-
if (N.some((l) => ($(n.fonts, l.path) ?? "") !== u.savedFonts[l.path]) || JSON.stringify(n.fontFamilies) !== e.savedFontFamilies)
|
|
997
|
-
throw new Error("Brand Kit changed since your save. Reload it before editing again.");
|
|
998
|
-
Object.hasOwn(s, "fontFamilies") ? n.fontFamilies = s.fontFamilies : delete n.fontFamilies;
|
|
999
|
-
}
|
|
1000
|
-
for (const [l, f] of [
|
|
1001
|
-
["colors", e.colorPaths],
|
|
1002
|
-
["fonts", e.fontPaths]
|
|
1003
|
-
]) {
|
|
1004
|
-
const y = l === "colors" ? u.savedColors : u.savedFonts;
|
|
1005
|
-
for (const w of f) {
|
|
1006
|
-
if (($(n[l], w) ?? "") !== y[w])
|
|
1007
|
-
throw new Error("Brand Kit changed since your save. Reload it before editing again.");
|
|
1008
|
-
(!n[l] || typeof n[l] != "object") && (n[l] = {});
|
|
1009
|
-
const m = $(s[l], w);
|
|
1010
|
-
if (typeof m == "string") ot(n[l], w, m);
|
|
1011
|
-
else {
|
|
1012
|
-
const F = w.split("."), x = F.pop(), b = F.length ? $(n[l], F.join(".")) : n[l];
|
|
1013
|
-
b && typeof b == "object" && delete b[x];
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
if (e.menuLayout) {
|
|
1018
|
-
const l = { category: u.savedCategoryLayout, items: u.savedMenuItems };
|
|
1019
|
-
if (e.menuLayout.fields.some((y) => $(n, `ordering.app.${y}`) !== l[y]))
|
|
1020
|
-
throw new Error("Brand Kit changed since your save. Reload it before editing again.");
|
|
1021
|
-
const f = $(n, "ordering.app");
|
|
1022
|
-
for (const y of e.menuLayout.fields) {
|
|
1023
|
-
if (!f || typeof f != "object") break;
|
|
1024
|
-
const w = e.menuLayout.previous[y];
|
|
1025
|
-
w === void 0 ? delete f[y] : f[y] = w;
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
if (o !== R || t !== _())
|
|
1029
|
-
throw new Error("Business changed. No Brand Kit was reverted.");
|
|
1030
|
-
const i = await fetch(lt(t), {
|
|
1031
|
-
method: "POST",
|
|
1032
|
-
headers: await $t(),
|
|
1033
|
-
body: JSON.stringify(n),
|
|
1034
|
-
signal: AbortSignal.timeout(2e4)
|
|
1035
|
-
});
|
|
1036
|
-
if (!i.ok) throw new Error(`Revert failed: HTTP ${i.status}`);
|
|
1037
|
-
o === R && t === _() && (u.revertKit = null, D = null, Y(n));
|
|
1038
|
-
} catch (n) {
|
|
1039
|
-
throw o === R && (u.error = st(n)), n;
|
|
1040
|
-
} finally {
|
|
1041
|
-
u.saving = !1;
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
|
-
async function we(t) {
|
|
1045
|
-
u.panelOpen = !0;
|
|
1046
|
-
const o = _();
|
|
1047
|
-
if (await Et(), !(!u.loaded || u.loading || u.saving || u.businessId !== o || _() !== o)) {
|
|
1048
|
-
for (const s of U) {
|
|
1049
|
-
const e = t.colors[s.path];
|
|
1050
|
-
e && (u.colors[s.path] = e);
|
|
1051
|
-
}
|
|
1052
|
-
for (const s of N) {
|
|
1053
|
-
const e = t.fonts[s.path];
|
|
1054
|
-
e && (u.fonts[s.path] = e);
|
|
1055
|
-
}
|
|
1056
|
-
u.appliedProposal = t.name ?? "Untitled proposal";
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
function Fe() {
|
|
1060
|
-
u.colors = { ...u.savedColors }, u.fonts = { ...u.savedFonts }, u.categoryLayout = u.savedCategoryLayout, u.menuItems = u.savedMenuItems, u.appliedProposal = null;
|
|
1061
|
-
}
|
|
1062
|
-
const Oe = B(
|
|
1063
|
-
() => U.every((t) => mt(u.colors[t.path] ?? "") === mt(St[t.path]))
|
|
1064
|
-
), Se = B(
|
|
1065
|
-
() => N.every((t) => u.fonts[t.path] === Pt[t.path])
|
|
1066
|
-
);
|
|
1067
|
-
function Pe(t) {
|
|
1068
|
-
!z() || !u.loaded || u.loading || u.saving || u.businessId !== _() || (t === "colors" ? u.colors = { ...St } : u.fonts = { ...Pt }, u.appliedProposal = null);
|
|
1069
|
-
}
|
|
1070
|
-
function Te() {
|
|
1071
|
-
return {
|
|
1072
|
-
state: u,
|
|
1073
|
-
dirtyCount: ve,
|
|
1074
|
-
hasInvalidColor: xt,
|
|
1075
|
-
colorsAreDefault: Oe,
|
|
1076
|
-
fontsAreDefault: Se,
|
|
1077
|
-
load: Et,
|
|
1078
|
-
save: me,
|
|
1079
|
-
revertLastSave: be,
|
|
1080
|
-
applyProposal: we,
|
|
1081
|
-
resetToDefault: Pe,
|
|
1082
|
-
discardEdits: Fe
|
|
1083
|
-
};
|
|
1084
|
-
}
|
|
1085
|
-
export {
|
|
1086
|
-
U as C,
|
|
1087
|
-
N as F,
|
|
1088
|
-
ut as G,
|
|
1089
|
-
Ie as a,
|
|
1090
|
-
Kt as b,
|
|
1091
|
-
Ae as f,
|
|
1092
|
-
ge as i,
|
|
1093
|
-
je as l,
|
|
1094
|
-
mt as t,
|
|
1095
|
-
Te as u
|
|
1096
|
-
};
|