@feedmepos/mf-miniprogram-v2 0.2.12-dev.1 → 0.2.12-dev.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.
- package/dist/{App-B0BXsVum.js → App-DkOwAOxM.js} +1 -1
- package/dist/{BrandFontPicker-D_MntcD2.js → BrandFontPicker-BleP2-eo.js} +1 -1
- package/dist/{BrandKitView-DHV0PUus.js → BrandKitView-Dnqd31n0.js} +2 -2
- package/dist/{ControlPlaneView-Bl_2Mt4i.js → ControlPlaneView-D_kblZVM.js} +9009 -8920
- package/dist/{EcosystemView-Blo9u-dq.js → EcosystemView-Zu_OgDZV.js} +1 -1
- package/dist/app.js +4 -4
- package/dist/{localPreference-CaizsY6G.js → localPreference-BsnGsgbd.js} +178 -172
- package/dist/package.json +1 -1
- package/dist/style.css +1 -1
- package/dist/{useBrandKit-Dl8N-9UZ.js → useBrandKit-BZtIOj1S.js} +459 -444
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { f as
|
|
2
|
-
import { computed as B, reactive as
|
|
3
|
-
import { k as
|
|
4
|
-
import { useCoreStore as
|
|
5
|
-
import { g as
|
|
6
|
-
const
|
|
1
|
+
import { f as ke, e as Be } from "./index-DB33ug2V.js";
|
|
2
|
+
import { computed as B, reactive as Ue } from "vue";
|
|
3
|
+
import { k as R, e as le, h as Ke } from "./controlPlane-Bn-uDXG_.js";
|
|
4
|
+
import { useCoreStore as He } from "@feedmepos/mf-common";
|
|
5
|
+
import { g as Ge, c as Je } from "./_commonjsHelpers-DaMA6jEr.js";
|
|
6
|
+
const ce = [
|
|
7
7
|
"Inter",
|
|
8
8
|
"Roboto",
|
|
9
9
|
"Open Sans",
|
|
@@ -26,26 +26,26 @@ const le = [
|
|
|
26
26
|
"Noto Sans SC",
|
|
27
27
|
"Noto Sans TC"
|
|
28
28
|
];
|
|
29
|
-
function
|
|
29
|
+
function qe(e) {
|
|
30
30
|
var o;
|
|
31
31
|
return ((o = e.split(",")[0]) == null ? void 0 : o.trim().replace(/^(['"])(.*)\1$/, "$2")) || "App default";
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function Lt(e) {
|
|
34
34
|
const o = ["Playfair Display", "Merriweather", "Lora"].includes(e) ? "serif" : "sans-serif";
|
|
35
35
|
return `'${e}', ${o === "serif" ? "" : "system-ui, "}${o}`;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
return `https://fonts.googleapis.com/css2?${[...new Set(e)].sort().map((
|
|
37
|
+
function Fe(e) {
|
|
38
|
+
return `https://fonts.googleapis.com/css2?${[...new Set(e)].sort().map((i) => `family=${encodeURIComponent(i)}:wght@400;500;600;700`).join("&")}&display=swap`;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function We(e) {
|
|
41
41
|
if (!e || typeof e != "object" || !("stylesheet" in e) || typeof e.stylesheet != "string")
|
|
42
42
|
return !1;
|
|
43
43
|
try {
|
|
44
44
|
const o = new URL(e.stylesheet);
|
|
45
45
|
if (o.hostname !== "fonts.googleapis.com" || !["/css", "/css2"].includes(o.pathname)) return !1;
|
|
46
|
-
const
|
|
47
|
-
return
|
|
48
|
-
(t) =>
|
|
46
|
+
const i = o.searchParams.getAll("family").flatMap((t) => t.split("|"));
|
|
47
|
+
return i.length > 0 && i.every(
|
|
48
|
+
(t) => ce.some((n) => {
|
|
49
49
|
var a;
|
|
50
50
|
return n.toLowerCase() === ((a = t.split(":")[0]) == null ? void 0 : a.trim().toLowerCase());
|
|
51
51
|
})
|
|
@@ -54,23 +54,23 @@ function He(e) {
|
|
|
54
54
|
return !1;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
const
|
|
57
|
+
function Ye(e, o) {
|
|
58
|
+
const i = ["brand", "heading", "body"].flatMap(
|
|
59
59
|
(n) => (o[n] || "").split(",").flatMap((a) => {
|
|
60
|
-
const l =
|
|
60
|
+
const l = ce.find((f) => f.toLowerCase() === qe(a).toLowerCase());
|
|
61
61
|
return l ? [l] : [];
|
|
62
62
|
})
|
|
63
|
-
), t = Array.isArray(e) ? e.filter((n) => !
|
|
64
|
-
return
|
|
63
|
+
), t = Array.isArray(e) ? e.filter((n) => !We(n)) : [];
|
|
64
|
+
return i.length ? [...t, { stylesheet: Fe(i) }] : t;
|
|
65
65
|
}
|
|
66
66
|
const Z = /* @__PURE__ */ new Map();
|
|
67
|
-
function
|
|
68
|
-
if (!
|
|
67
|
+
function Nt(e) {
|
|
68
|
+
if (!ce.some((t) => t === e)) return Promise.resolve();
|
|
69
69
|
const o = Z.get(e);
|
|
70
70
|
if (o) return o;
|
|
71
|
-
const
|
|
71
|
+
const i = new Promise((t, n) => {
|
|
72
72
|
const a = document.createElement("link");
|
|
73
|
-
a.rel = "stylesheet", a.href =
|
|
73
|
+
a.rel = "stylesheet", a.href = Fe([e]);
|
|
74
74
|
let l = !1;
|
|
75
75
|
const f = window.setTimeout(() => y(), 15e3), y = () => {
|
|
76
76
|
l || (l = !0, window.clearTimeout(f), a.remove(), Z.delete(e), n(new Error(`Could not load ${e}`)));
|
|
@@ -84,21 +84,21 @@ function jt(e) {
|
|
|
84
84
|
}, y);
|
|
85
85
|
}, document.head.append(a);
|
|
86
86
|
});
|
|
87
|
-
return Z.set(e,
|
|
87
|
+
return Z.set(e, i), i;
|
|
88
88
|
}
|
|
89
89
|
var Oe = { exports: {} };
|
|
90
90
|
(function(e, o) {
|
|
91
|
-
(function(
|
|
91
|
+
(function(i, t) {
|
|
92
92
|
e.exports = t();
|
|
93
|
-
})(
|
|
94
|
-
return function(
|
|
93
|
+
})(Je, function() {
|
|
94
|
+
return function(i) {
|
|
95
95
|
var t = {};
|
|
96
96
|
function n(a) {
|
|
97
97
|
if (t[a]) return t[a].exports;
|
|
98
98
|
var l = t[a] = { i: a, l: !1, exports: {} };
|
|
99
|
-
return
|
|
99
|
+
return i[a].call(l.exports, l, l.exports, n), l.l = !0, l.exports;
|
|
100
100
|
}
|
|
101
|
-
return n.m =
|
|
101
|
+
return n.m = i, n.c = t, n.d = function(a, l, f) {
|
|
102
102
|
n.o(a, l) || Object.defineProperty(a, l, { enumerable: !0, get: f });
|
|
103
103
|
}, n.r = function(a) {
|
|
104
104
|
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(a, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(a, "__esModule", { value: !0 });
|
|
@@ -126,228 +126,228 @@ var Oe = { exports: {} };
|
|
|
126
126
|
return Object.prototype.hasOwnProperty.call(a, l);
|
|
127
127
|
}, n.p = "", n(n.s = 0);
|
|
128
128
|
}([
|
|
129
|
-
function(
|
|
130
|
-
|
|
129
|
+
function(i, t, n) {
|
|
130
|
+
i.exports = n(1);
|
|
131
131
|
},
|
|
132
|
-
function(
|
|
132
|
+
function(i, t, n) {
|
|
133
133
|
function a(r) {
|
|
134
|
-
return (a = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(
|
|
135
|
-
return typeof
|
|
136
|
-
} : function(
|
|
137
|
-
return
|
|
134
|
+
return (a = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(s) {
|
|
135
|
+
return typeof s;
|
|
136
|
+
} : function(s) {
|
|
137
|
+
return s && typeof Symbol == "function" && s.constructor === Symbol && s !== Symbol.prototype ? "symbol" : typeof s;
|
|
138
138
|
})(r);
|
|
139
139
|
}
|
|
140
140
|
function l(r) {
|
|
141
|
-
var
|
|
141
|
+
var s = "[object " + r + "]";
|
|
142
142
|
return function(c) {
|
|
143
|
-
return Object.prototype.toString.call(c) ===
|
|
143
|
+
return Object.prototype.toString.call(c) === s;
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
146
|
n.r(t), n.d(t, "default", function() {
|
|
147
|
-
return
|
|
147
|
+
return Ne;
|
|
148
148
|
}), n.d(t, "compare", function() {
|
|
149
149
|
return pe;
|
|
150
150
|
}), n.d(t, "comparable", function() {
|
|
151
|
-
return
|
|
151
|
+
return z;
|
|
152
152
|
});
|
|
153
153
|
var f = l("Array"), y = l("Object"), w = l("Function");
|
|
154
|
-
function
|
|
155
|
-
return w(r.get) ? r.get(
|
|
154
|
+
function b(r, s) {
|
|
155
|
+
return w(r.get) ? r.get(s) : r[s];
|
|
156
156
|
}
|
|
157
|
-
function
|
|
158
|
-
return function(
|
|
159
|
-
if (!f(c) || !c.length) return r(
|
|
160
|
-
for (var d = 0,
|
|
161
|
-
if (r(
|
|
157
|
+
function S(r) {
|
|
158
|
+
return function(s, c) {
|
|
159
|
+
if (!f(c) || !c.length) return r(s, c);
|
|
160
|
+
for (var d = 0, h = c.length; d < h; d++)
|
|
161
|
+
if (r(s, b(c, d))) return !0;
|
|
162
162
|
return !1;
|
|
163
163
|
};
|
|
164
164
|
}
|
|
165
165
|
function $(r) {
|
|
166
|
-
return function(
|
|
167
|
-
if (!f(c) || !c.length) return r(
|
|
168
|
-
for (var d = 0,
|
|
169
|
-
if (!r(
|
|
166
|
+
return function(s, c) {
|
|
167
|
+
if (!f(c) || !c.length) return r(s, c);
|
|
168
|
+
for (var d = 0, h = c.length; d < h; d++)
|
|
169
|
+
if (!r(s, b(c, d))) return !1;
|
|
170
170
|
return !0;
|
|
171
171
|
};
|
|
172
172
|
}
|
|
173
|
-
function
|
|
174
|
-
return r.validate(r.options,
|
|
173
|
+
function m(r, s, c, d) {
|
|
174
|
+
return r.validate(r.options, s, c, d);
|
|
175
175
|
}
|
|
176
|
-
var
|
|
177
|
-
$eq:
|
|
178
|
-
return r(
|
|
176
|
+
var P = {
|
|
177
|
+
$eq: S(function(r, s) {
|
|
178
|
+
return r(s);
|
|
179
179
|
}),
|
|
180
|
-
$ne: $(function(r,
|
|
181
|
-
return r(
|
|
180
|
+
$ne: $(function(r, s) {
|
|
181
|
+
return r(s);
|
|
182
182
|
}),
|
|
183
|
-
$gt:
|
|
184
|
-
return r(
|
|
183
|
+
$gt: S(function(r, s) {
|
|
184
|
+
return r(s);
|
|
185
185
|
}),
|
|
186
|
-
$gte:
|
|
187
|
-
return r(
|
|
186
|
+
$gte: S(function(r, s) {
|
|
187
|
+
return r(s);
|
|
188
188
|
}),
|
|
189
|
-
$lt:
|
|
190
|
-
return r(
|
|
189
|
+
$lt: S(function(r, s) {
|
|
190
|
+
return r(s);
|
|
191
191
|
}),
|
|
192
|
-
$lte:
|
|
193
|
-
return r(
|
|
192
|
+
$lte: S(function(r, s) {
|
|
193
|
+
return r(s);
|
|
194
194
|
}),
|
|
195
|
-
$mod:
|
|
196
|
-
return r(
|
|
195
|
+
$mod: S(function(r, s) {
|
|
196
|
+
return r(s);
|
|
197
197
|
}),
|
|
198
|
-
$in: function(r,
|
|
199
|
-
return r(
|
|
198
|
+
$in: function(r, s) {
|
|
199
|
+
return r(s);
|
|
200
200
|
},
|
|
201
|
-
$nin: function(r,
|
|
202
|
-
return r(
|
|
201
|
+
$nin: function(r, s) {
|
|
202
|
+
return r(s);
|
|
203
203
|
},
|
|
204
|
-
$not: function(r,
|
|
205
|
-
return r(
|
|
204
|
+
$not: function(r, s, c, d) {
|
|
205
|
+
return r(s, c, d);
|
|
206
206
|
},
|
|
207
|
-
$type: function(r,
|
|
208
|
-
return r(
|
|
207
|
+
$type: function(r, s) {
|
|
208
|
+
return r(s);
|
|
209
209
|
},
|
|
210
|
-
$all: function(r,
|
|
211
|
-
return
|
|
210
|
+
$all: function(r, s, c, d) {
|
|
211
|
+
return P.$and(r, s, c, d);
|
|
212
212
|
},
|
|
213
|
-
$size: function(r,
|
|
214
|
-
return !!
|
|
213
|
+
$size: function(r, s) {
|
|
214
|
+
return !!s && r === s.length;
|
|
215
215
|
},
|
|
216
|
-
$or: function(r,
|
|
217
|
-
for (var
|
|
218
|
-
if (b(
|
|
216
|
+
$or: function(r, s, c, d) {
|
|
217
|
+
for (var h = 0, p = r.length; h < p; h++)
|
|
218
|
+
if (m(b(r, h), s, c, d)) return !0;
|
|
219
219
|
return !1;
|
|
220
220
|
},
|
|
221
|
-
$nor: function(r,
|
|
222
|
-
return !
|
|
221
|
+
$nor: function(r, s, c, d) {
|
|
222
|
+
return !P.$or(r, s, c, d);
|
|
223
223
|
},
|
|
224
|
-
$and: function(r,
|
|
225
|
-
for (var
|
|
226
|
-
if (!b(
|
|
224
|
+
$and: function(r, s, c, d) {
|
|
225
|
+
for (var h = 0, p = r.length; h < p; h++)
|
|
226
|
+
if (!m(b(r, h), s, c, d)) return !1;
|
|
227
227
|
return !0;
|
|
228
228
|
},
|
|
229
|
-
$regex:
|
|
230
|
-
return typeof
|
|
229
|
+
$regex: S(function(r, s) {
|
|
230
|
+
return typeof s == "string" && r.test(s);
|
|
231
231
|
}),
|
|
232
|
-
$where: function(r,
|
|
233
|
-
return r.call(
|
|
232
|
+
$where: function(r, s, c, d) {
|
|
233
|
+
return r.call(s, s, c, d);
|
|
234
234
|
},
|
|
235
|
-
$elemMatch: function(r,
|
|
236
|
-
return f(
|
|
237
|
-
for (var g = 0; g <
|
|
238
|
-
if (
|
|
235
|
+
$elemMatch: function(r, s, c, d) {
|
|
236
|
+
return f(s) ? !!~function(h, p) {
|
|
237
|
+
for (var g = 0; g < h.length; g++)
|
|
238
|
+
if (b(h, g), m(p, b(h, g))) return g;
|
|
239
239
|
return -1;
|
|
240
|
-
}(
|
|
240
|
+
}(s, r) : m(r, s, c, d);
|
|
241
241
|
},
|
|
242
|
-
$exists: function(r,
|
|
242
|
+
$exists: function(r, s, c, d) {
|
|
243
243
|
return d.hasOwnProperty(c) === r;
|
|
244
244
|
}
|
|
245
|
-
},
|
|
246
|
-
$eq: function(r,
|
|
247
|
-
var d = c.comparable,
|
|
248
|
-
return r instanceof RegExp ?
|
|
249
|
-
return typeof
|
|
250
|
-
}) : r instanceof Function ?
|
|
251
|
-
return f(
|
|
252
|
-
}) :
|
|
253
|
-
r === null ? function(
|
|
254
|
-
return
|
|
255
|
-
} : function(
|
|
256
|
-
return
|
|
245
|
+
}, A = {
|
|
246
|
+
$eq: function(r, s, c) {
|
|
247
|
+
var d = c.comparable, h = c.compare;
|
|
248
|
+
return r instanceof RegExp ? S(function(p) {
|
|
249
|
+
return typeof p == "string" && r.test(p);
|
|
250
|
+
}) : r instanceof Function ? S(r) : f(r) && !r.length ? S(function(p) {
|
|
251
|
+
return f(p) && !p.length;
|
|
252
|
+
}) : S(
|
|
253
|
+
r === null ? function(p) {
|
|
254
|
+
return p == null;
|
|
255
|
+
} : function(p) {
|
|
256
|
+
return h(d(p), d(r)) === 0;
|
|
257
257
|
}
|
|
258
258
|
);
|
|
259
259
|
},
|
|
260
|
-
$gt: function(r,
|
|
261
|
-
var d = c.comparable,
|
|
262
|
-
return function(
|
|
263
|
-
return
|
|
260
|
+
$gt: function(r, s, c) {
|
|
261
|
+
var d = c.comparable, h = c.compare;
|
|
262
|
+
return function(p) {
|
|
263
|
+
return h(d(p), d(r)) > 0;
|
|
264
264
|
};
|
|
265
265
|
},
|
|
266
|
-
$gte: function(r,
|
|
267
|
-
var d = c.comparable,
|
|
268
|
-
return function(
|
|
269
|
-
return
|
|
266
|
+
$gte: function(r, s, c) {
|
|
267
|
+
var d = c.comparable, h = c.compare;
|
|
268
|
+
return function(p) {
|
|
269
|
+
return h(d(p), d(r)) >= 0;
|
|
270
270
|
};
|
|
271
271
|
},
|
|
272
|
-
$lt: function(r,
|
|
273
|
-
var d = c.comparable,
|
|
274
|
-
return function(
|
|
275
|
-
return
|
|
272
|
+
$lt: function(r, s, c) {
|
|
273
|
+
var d = c.comparable, h = c.compare;
|
|
274
|
+
return function(p) {
|
|
275
|
+
return h(d(p), d(r)) < 0;
|
|
276
276
|
};
|
|
277
277
|
},
|
|
278
|
-
$lte: function(r,
|
|
279
|
-
var d = c.comparable,
|
|
280
|
-
return function(
|
|
281
|
-
return
|
|
278
|
+
$lte: function(r, s, c) {
|
|
279
|
+
var d = c.comparable, h = c.compare;
|
|
280
|
+
return function(p) {
|
|
281
|
+
return h(d(p), d(r)) <= 0;
|
|
282
282
|
};
|
|
283
283
|
},
|
|
284
|
-
$in: function(r,
|
|
284
|
+
$in: function(r, s, c) {
|
|
285
285
|
var d = c.comparable;
|
|
286
|
-
return function(
|
|
287
|
-
if (!(
|
|
288
|
-
var
|
|
289
|
-
if (
|
|
286
|
+
return function(h) {
|
|
287
|
+
if (!(h instanceof Array)) {
|
|
288
|
+
var p = d(h);
|
|
289
|
+
if (p === h && a(h) === "object") {
|
|
290
290
|
for (v = r.length; v--; )
|
|
291
|
-
if (String(r[v]) === String(
|
|
291
|
+
if (String(r[v]) === String(h) && String(h) !== "[object Object]")
|
|
292
292
|
return !0;
|
|
293
293
|
}
|
|
294
|
-
if (
|
|
294
|
+
if (p === void 0) {
|
|
295
295
|
for (v = r.length; v--; ) if (r[v] == null) return !0;
|
|
296
296
|
}
|
|
297
297
|
for (v = r.length; v--; ) {
|
|
298
|
-
var g =
|
|
299
|
-
if (g && String(g) !== "[object Object]" && String(
|
|
298
|
+
var g = m(he(b(r, v), c), p, v, r);
|
|
299
|
+
if (g && String(g) !== "[object Object]" && String(p) !== "[object Object]")
|
|
300
300
|
return !0;
|
|
301
301
|
}
|
|
302
|
-
return !!~r.indexOf(
|
|
302
|
+
return !!~r.indexOf(p);
|
|
303
303
|
}
|
|
304
|
-
for (var v =
|
|
305
|
-
if (~r.indexOf(d(
|
|
304
|
+
for (var v = h.length; v--; )
|
|
305
|
+
if (~r.indexOf(d(b(h, v)))) return !0;
|
|
306
306
|
return !1;
|
|
307
307
|
};
|
|
308
308
|
},
|
|
309
|
-
$nin: function(r,
|
|
310
|
-
var d =
|
|
311
|
-
return function(
|
|
312
|
-
return !d(
|
|
309
|
+
$nin: function(r, s, c) {
|
|
310
|
+
var d = A.$in(r, s, c);
|
|
311
|
+
return function(h, p, g, v) {
|
|
312
|
+
return !d(h, p, g, v);
|
|
313
313
|
};
|
|
314
314
|
},
|
|
315
315
|
$mod: function(r) {
|
|
316
|
-
return function(
|
|
317
|
-
return
|
|
316
|
+
return function(s) {
|
|
317
|
+
return s % r[0] == r[1];
|
|
318
318
|
};
|
|
319
319
|
},
|
|
320
|
-
$ne: function(r,
|
|
321
|
-
var d =
|
|
322
|
-
return $(function(
|
|
323
|
-
return !d(
|
|
320
|
+
$ne: function(r, s, c) {
|
|
321
|
+
var d = A.$eq(r, s, c);
|
|
322
|
+
return $(function(h, p, g, v) {
|
|
323
|
+
return !d(h, p, g, v);
|
|
324
324
|
});
|
|
325
325
|
},
|
|
326
|
-
$and: function(r,
|
|
326
|
+
$and: function(r, s, c) {
|
|
327
327
|
return r.map(T(c));
|
|
328
328
|
},
|
|
329
|
-
$all: function(r,
|
|
330
|
-
return
|
|
329
|
+
$all: function(r, s, c) {
|
|
330
|
+
return A.$and(r, s, c);
|
|
331
331
|
},
|
|
332
|
-
$or: function(r,
|
|
332
|
+
$or: function(r, s, c) {
|
|
333
333
|
return r.map(T(c));
|
|
334
334
|
},
|
|
335
|
-
$nor: function(r,
|
|
335
|
+
$nor: function(r, s, c) {
|
|
336
336
|
return r.map(T(c));
|
|
337
337
|
},
|
|
338
|
-
$not: function(r,
|
|
338
|
+
$not: function(r, s, c) {
|
|
339
339
|
var d = T(c)(r);
|
|
340
|
-
return function(
|
|
341
|
-
return !
|
|
340
|
+
return function(h, p, g) {
|
|
341
|
+
return !m(d, h, p, g);
|
|
342
342
|
};
|
|
343
343
|
},
|
|
344
344
|
$type: function(r) {
|
|
345
|
-
return function(
|
|
346
|
-
return
|
|
345
|
+
return function(s, c, d) {
|
|
346
|
+
return s != null && (s instanceof r || s.constructor == r);
|
|
347
347
|
};
|
|
348
348
|
},
|
|
349
|
-
$regex: function(r,
|
|
350
|
-
return new RegExp(r,
|
|
349
|
+
$regex: function(r, s) {
|
|
350
|
+
return new RegExp(r, s.$options);
|
|
351
351
|
},
|
|
352
352
|
$where: function(r) {
|
|
353
353
|
if (typeof r == "function") return r;
|
|
@@ -355,132 +355,132 @@ var Oe = { exports: {} };
|
|
|
355
355
|
'In CSP mode, sift does not support strings in "$where" condition'
|
|
356
356
|
);
|
|
357
357
|
},
|
|
358
|
-
$elemMatch: function(r,
|
|
358
|
+
$elemMatch: function(r, s, c) {
|
|
359
359
|
return T(c)(r);
|
|
360
360
|
},
|
|
361
361
|
$exists: function(r) {
|
|
362
362
|
return !!r;
|
|
363
363
|
}
|
|
364
364
|
};
|
|
365
|
-
function x(r,
|
|
366
|
-
return { options: r, validate:
|
|
365
|
+
function x(r, s) {
|
|
366
|
+
return { options: r, validate: s };
|
|
367
367
|
}
|
|
368
|
-
function
|
|
369
|
-
var c = r.keyPath, d = r.child,
|
|
370
|
-
if (function
|
|
371
|
-
if (
|
|
372
|
-
return void
|
|
373
|
-
var
|
|
374
|
-
if (f(j) && isNaN(Number(
|
|
375
|
-
for (var X = 0,
|
|
376
|
-
else
|
|
377
|
-
}(
|
|
378
|
-
var g =
|
|
379
|
-
return
|
|
368
|
+
function Te(r, s) {
|
|
369
|
+
var c = r.keyPath, d = r.child, h = r.query, p = [];
|
|
370
|
+
if (function ge(j, M, D, Me, V) {
|
|
371
|
+
if (D === M.length || j == null)
|
|
372
|
+
return void V.push([j, M[D - 1], Me]);
|
|
373
|
+
var ye = b(M, D);
|
|
374
|
+
if (f(j) && isNaN(Number(ye)))
|
|
375
|
+
for (var X = 0, De = j.length; X < De; X++) ge(b(j, X), M, D, j, V);
|
|
376
|
+
else ge(b(j, ye), M, D + 1, j, V);
|
|
377
|
+
}(s, c, 0, s, p), p.length === 1) {
|
|
378
|
+
var g = p[0];
|
|
379
|
+
return m(d, g[0], g[1], g[2]);
|
|
380
380
|
}
|
|
381
|
-
for (var v =
|
|
382
|
-
var
|
|
383
|
-
v ? F &=
|
|
381
|
+
for (var v = h && h.$ne !== void 0, F = v, O = 0; O < p.length; O++) {
|
|
382
|
+
var C = p[O], H = m(d, C[0], C[1], C[2]);
|
|
383
|
+
v ? F &= H : F |= H;
|
|
384
384
|
}
|
|
385
385
|
return F;
|
|
386
386
|
}
|
|
387
|
-
function
|
|
388
|
-
return x({ keyPath: r, child:
|
|
387
|
+
function Le(r, s, c) {
|
|
388
|
+
return x({ keyPath: r, child: s, query: c }, Te);
|
|
389
389
|
}
|
|
390
390
|
function T(r) {
|
|
391
|
-
var
|
|
391
|
+
var s = r.comparable, c = r.expressions, d = function(g) {
|
|
392
392
|
var v;
|
|
393
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
|
-
},
|
|
395
|
-
g =
|
|
394
|
+
}, h = function(g) {
|
|
395
|
+
g = s(g);
|
|
396
396
|
var v = [];
|
|
397
397
|
for (var F in g) {
|
|
398
|
-
var
|
|
398
|
+
var O = g[F];
|
|
399
399
|
if (F !== "$options") {
|
|
400
|
-
var
|
|
401
|
-
if (
|
|
400
|
+
var C = P[F] || r && c && c[F];
|
|
401
|
+
if (C) A[F] && (O = A[F](O, g, r)), v.push(x(s(O), C));
|
|
402
402
|
else {
|
|
403
403
|
if (F.charCodeAt(0) === 36)
|
|
404
404
|
throw new Error("Unknown operation " + F);
|
|
405
|
-
var
|
|
406
|
-
v.push(
|
|
405
|
+
var H = F.split(".");
|
|
406
|
+
v.push(Le(H, p(O), O));
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
|
-
return v.length === 1 ? v[0] : x(v,
|
|
411
|
-
},
|
|
412
|
-
return g = d(g), function v(F,
|
|
413
|
-
if (!y(F)) return
|
|
414
|
-
for (var
|
|
415
|
-
return
|
|
416
|
-
}(g, []).join(",").search(/[$.]/) === -1 ? x(g, K) :
|
|
410
|
+
return v.length === 1 ? v[0] : x(v, P.$and);
|
|
411
|
+
}, p = function(g) {
|
|
412
|
+
return g = d(g), function v(F, O) {
|
|
413
|
+
if (!y(F)) return O;
|
|
414
|
+
for (var C in F) O.push(C), v(F[C], O);
|
|
415
|
+
return O;
|
|
416
|
+
}(g, []).join(",").search(/[$.]/) === -1 ? x(g, K) : h(g);
|
|
417
417
|
};
|
|
418
418
|
return function(g) {
|
|
419
|
-
return
|
|
419
|
+
return h(d(g));
|
|
420
420
|
};
|
|
421
421
|
}
|
|
422
|
-
function K(r,
|
|
423
|
-
if (Object.prototype.toString.call(r) !== Object.prototype.toString.call(
|
|
422
|
+
function K(r, s) {
|
|
423
|
+
if (Object.prototype.toString.call(r) !== Object.prototype.toString.call(s))
|
|
424
424
|
return !1;
|
|
425
425
|
if (y(r)) {
|
|
426
|
-
if (Object.keys(r).length !== Object.keys(
|
|
427
|
-
for (var c in r) if (!K(r[c],
|
|
426
|
+
if (Object.keys(r).length !== Object.keys(s).length) return !1;
|
|
427
|
+
for (var c in r) if (!K(r[c], s[c])) return !1;
|
|
428
428
|
return !0;
|
|
429
429
|
}
|
|
430
430
|
if (f(r)) {
|
|
431
|
-
if (r.length !==
|
|
432
|
-
for (var d = 0,
|
|
433
|
-
if (!K(r[d],
|
|
431
|
+
if (r.length !== s.length) return !1;
|
|
432
|
+
for (var d = 0, h = r.length; d < h; d++)
|
|
433
|
+
if (!K(r[d], s[d])) return !1;
|
|
434
434
|
return !0;
|
|
435
435
|
}
|
|
436
|
-
return r ===
|
|
436
|
+
return r === s;
|
|
437
437
|
}
|
|
438
|
-
function
|
|
439
|
-
var c = T(
|
|
440
|
-
return
|
|
438
|
+
function he(r, s) {
|
|
439
|
+
var c = T(s)(r);
|
|
440
|
+
return s && s.select && (c = {
|
|
441
441
|
options: c,
|
|
442
|
-
validate: function(d,
|
|
443
|
-
return
|
|
442
|
+
validate: function(d, h, p, g) {
|
|
443
|
+
return m(d, h && s.select(h), p, g);
|
|
444
444
|
}
|
|
445
445
|
}), c;
|
|
446
446
|
}
|
|
447
|
-
function
|
|
448
|
-
var c =
|
|
449
|
-
return function(d,
|
|
450
|
-
return
|
|
447
|
+
function Ne(r, s) {
|
|
448
|
+
var c = he(r, s = Object.assign({ compare: pe, comparable: z }, s));
|
|
449
|
+
return function(d, h, p) {
|
|
450
|
+
return m(c, d, h, p);
|
|
451
451
|
};
|
|
452
452
|
}
|
|
453
|
-
function pe(r,
|
|
454
|
-
if (K(r,
|
|
455
|
-
if (a(r) === a(
|
|
456
|
-
if (r >
|
|
457
|
-
if (r <
|
|
453
|
+
function pe(r, s) {
|
|
454
|
+
if (K(r, s)) return 0;
|
|
455
|
+
if (a(r) === a(s)) {
|
|
456
|
+
if (r > s) return 1;
|
|
457
|
+
if (r < s) return -1;
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
|
-
function
|
|
461
|
-
return r instanceof Date ? r.getTime() : f(r) ? r.map(
|
|
460
|
+
function z(r) {
|
|
461
|
+
return r instanceof Date ? r.getTime() : f(r) ? r.map(z) : r && typeof r.toJSON == "function" ? r.toJSON() : r;
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
464
|
]);
|
|
465
465
|
});
|
|
466
466
|
})(Oe);
|
|
467
|
-
var
|
|
468
|
-
const
|
|
469
|
-
function
|
|
470
|
-
for (var
|
|
471
|
-
var t = o[
|
|
467
|
+
var ze = Oe.exports;
|
|
468
|
+
const Ve = /* @__PURE__ */ Ge(ze);
|
|
469
|
+
function Xe(e, o) {
|
|
470
|
+
for (var i = 0; i < o.length; i++) {
|
|
471
|
+
var t = o[i];
|
|
472
472
|
t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(e, t.key, t);
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
|
-
function
|
|
476
|
-
return o &&
|
|
475
|
+
function Ze(e, o, i) {
|
|
476
|
+
return o && Xe(e.prototype, o), e;
|
|
477
477
|
}
|
|
478
|
-
function
|
|
478
|
+
function Qe(e, o) {
|
|
479
479
|
e.prototype = Object.create(o.prototype), e.prototype.constructor = e, e.__proto__ = o;
|
|
480
480
|
}
|
|
481
481
|
function Q(e) {
|
|
482
|
-
return Q = Object.setPrototypeOf ? Object.getPrototypeOf : function(
|
|
483
|
-
return
|
|
482
|
+
return Q = Object.setPrototypeOf ? Object.getPrototypeOf : function(i) {
|
|
483
|
+
return i.__proto__ || Object.getPrototypeOf(i);
|
|
484
484
|
}, Q(e);
|
|
485
485
|
}
|
|
486
486
|
function q(e, o) {
|
|
@@ -488,7 +488,7 @@ function q(e, o) {
|
|
|
488
488
|
return t.__proto__ = n, t;
|
|
489
489
|
}, q(e, o);
|
|
490
490
|
}
|
|
491
|
-
function
|
|
491
|
+
function et() {
|
|
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 Xe() {
|
|
|
498
498
|
return !1;
|
|
499
499
|
}
|
|
500
500
|
}
|
|
501
|
-
function J(e, o,
|
|
502
|
-
return
|
|
501
|
+
function J(e, o, i) {
|
|
502
|
+
return et() ? J = Reflect.construct : J = function(n, a, l) {
|
|
503
503
|
var f = [null];
|
|
504
504
|
f.push.apply(f, a);
|
|
505
505
|
var y = Function.bind.apply(n, f), w = new y();
|
|
506
506
|
return l && q(w, l.prototype), w;
|
|
507
507
|
}, J.apply(null, arguments);
|
|
508
508
|
}
|
|
509
|
-
function
|
|
509
|
+
function tt(e) {
|
|
510
510
|
return Function.toString.call(e).indexOf("[native code]") !== -1;
|
|
511
511
|
}
|
|
512
512
|
function ee(e) {
|
|
513
513
|
var o = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
514
514
|
return ee = function(t) {
|
|
515
|
-
if (t === null || !
|
|
515
|
+
if (t === null || !tt(t)) return t;
|
|
516
516
|
if (typeof t != "function")
|
|
517
517
|
throw new TypeError("Super expression must either be null or a function");
|
|
518
518
|
if (typeof o < "u") {
|
|
@@ -532,16 +532,16 @@ function ee(e) {
|
|
|
532
532
|
}), q(n, t);
|
|
533
533
|
}, ee(e);
|
|
534
534
|
}
|
|
535
|
-
function
|
|
535
|
+
function ve(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 Ie = function(o) {
|
|
541
541
|
return 'Cannot execute "' + o.action + '" on "' + o.subjectName + '"';
|
|
542
|
-
},
|
|
543
|
-
|
|
544
|
-
n === null ?
|
|
542
|
+
}, G = Ie, rt = /* @__PURE__ */ function(e) {
|
|
543
|
+
Qe(o, e), o.setDefaultMessage = function(n) {
|
|
544
|
+
n === null ? G = Ie : G = typeof n == "string" ? function() {
|
|
545
545
|
return n;
|
|
546
546
|
} : n;
|
|
547
547
|
}, o.from = function(n) {
|
|
@@ -552,12 +552,12 @@ var Fe = function(o) {
|
|
|
552
552
|
};
|
|
553
553
|
function o(t, n) {
|
|
554
554
|
var a;
|
|
555
|
-
return n === void 0 && (n = {}), a = e.call(this, t) || this, a._setMetadata(n), a.message = t ||
|
|
555
|
+
return n === void 0 && (n = {}), a = e.call(this, t) || this, a._setMetadata(n), a.message = t || G(ve(a)), a._customMessage = null, typeof Error.captureStackTrace == "function" && (a.name = a.constructor.name, Error.captureStackTrace(ve(a), a.constructor)), a;
|
|
556
556
|
}
|
|
557
|
-
var
|
|
558
|
-
return
|
|
557
|
+
var i = o.prototype;
|
|
558
|
+
return i.setMessage = function(n) {
|
|
559
559
|
return this._customMessage = n, this;
|
|
560
|
-
},
|
|
560
|
+
}, i.throwUnlessCan = function(n, a, l) {
|
|
561
561
|
if (!this.ability)
|
|
562
562
|
throw new ReferenceError("Cannot throw FordiddenError without respective ability instance");
|
|
563
563
|
var f = this.ability.relevantRuleFor(n, a, l);
|
|
@@ -569,46 +569,46 @@ var Fe = function(o) {
|
|
|
569
569
|
subjectName: this.ability.subjectName(a)
|
|
570
570
|
});
|
|
571
571
|
var y = f ? f.reason : "";
|
|
572
|
-
throw this.message = this._customMessage || y ||
|
|
572
|
+
throw this.message = this._customMessage || y || G(this), this;
|
|
573
573
|
}
|
|
574
|
-
},
|
|
574
|
+
}, i._setMetadata = function(n) {
|
|
575
575
|
this.subject = n.subject, this.subjectName = n.subjectName, this.action = n.action, this.field = n.field;
|
|
576
576
|
}, o;
|
|
577
577
|
}(ee(Error));
|
|
578
578
|
function te(e) {
|
|
579
579
|
return Array.isArray(e) ? e : [e];
|
|
580
580
|
}
|
|
581
|
-
function
|
|
581
|
+
function nt(e) {
|
|
582
582
|
if (!e || typeof e == "string")
|
|
583
583
|
return e;
|
|
584
584
|
var o = typeof e == "object" ? e.constructor : e;
|
|
585
585
|
return o.modelName || o.name;
|
|
586
586
|
}
|
|
587
|
-
function
|
|
587
|
+
function ot(e) {
|
|
588
588
|
return JSON.parse(JSON.stringify(e));
|
|
589
589
|
}
|
|
590
|
-
var
|
|
591
|
-
function
|
|
592
|
-
var t =
|
|
593
|
-
return o + e.length ===
|
|
590
|
+
var at = /[-/\\^$+?.()|[\]{}]/g, it = /\.?\*+\.?/g, st = /\*+/, ut = /\./g;
|
|
591
|
+
function lt(e, o, i) {
|
|
592
|
+
var t = i[0] === "*" || e[0] === "." && e[e.length - 1] === "." ? "+" : "*", n = e.indexOf("**") === -1 ? "[^.]" : ".", a = e.replace(ut, "\\$&").replace(st, n + t);
|
|
593
|
+
return o + e.length === i.length ? "(?:" + a + ")?" : a;
|
|
594
594
|
}
|
|
595
|
-
function
|
|
596
|
-
return e === "." && (
|
|
595
|
+
function ct(e, o, i) {
|
|
596
|
+
return e === "." && (i[o - 1] === "*" || i[o + 1] === "*") ? e : "\\" + e;
|
|
597
597
|
}
|
|
598
|
-
function
|
|
598
|
+
function ft(e) {
|
|
599
599
|
var o = e.map(function(t) {
|
|
600
|
-
return t.replace(
|
|
601
|
-
}),
|
|
602
|
-
return new RegExp("^" +
|
|
600
|
+
return t.replace(at, ct).replace(it, lt);
|
|
601
|
+
}), i = o.length > 1 ? "(?:" + o.join("|") + ")" : o[0];
|
|
602
|
+
return new RegExp("^" + i + "$");
|
|
603
603
|
}
|
|
604
|
-
var
|
|
605
|
-
function e(
|
|
606
|
-
this.actions =
|
|
604
|
+
var dt = /* @__PURE__ */ function() {
|
|
605
|
+
function e(i) {
|
|
606
|
+
this.actions = i.actions || i.action, this.subject = i.subject, this.fields = !i.fields || i.fields.length === 0 ? void 0 : te(i.fields), Object.defineProperty(this, "_fieldsPattern", {
|
|
607
607
|
writable: !0
|
|
608
|
-
}), this.inverted = !!
|
|
608
|
+
}), this.inverted = !!i.inverted, this.conditions = i.conditions, Object.defineProperty(this, "_matches", {
|
|
609
609
|
writable: !0,
|
|
610
|
-
value: this.conditions ?
|
|
611
|
-
}), this.reason =
|
|
610
|
+
value: this.conditions ? Ve(this.conditions) : void 0
|
|
611
|
+
}), this.reason = i.reason;
|
|
612
612
|
}
|
|
613
613
|
var o = e.prototype;
|
|
614
614
|
return o.matches = function(t) {
|
|
@@ -616,34 +616,34 @@ var lt = /* @__PURE__ */ function() {
|
|
|
616
616
|
}, o.isRelevantFor = function(t, n) {
|
|
617
617
|
return this.fields ? n ? this.matchesField(n) : !this.inverted : !0;
|
|
618
618
|
}, o.matchesField = function(t) {
|
|
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 : ft(this.fields)), this._fieldsPattern === null || t.indexOf("*") !== -1 ? this.fields.indexOf(t) !== -1 : this._fieldsPattern.test(t);
|
|
620
620
|
}, e;
|
|
621
|
-
}(),
|
|
621
|
+
}(), I = typeof Symbol < "u" ? Symbol("private") : "__" + Date.now(), me = {
|
|
622
622
|
crud: ["create", "read", "update", "delete"]
|
|
623
623
|
};
|
|
624
|
-
function
|
|
624
|
+
function be(e, o) {
|
|
625
625
|
return e === o || Array.isArray(o) && o.indexOf(e) !== -1;
|
|
626
626
|
}
|
|
627
|
-
var
|
|
627
|
+
var ht = /* @__PURE__ */ function() {
|
|
628
628
|
e.addAlias = function(t, n) {
|
|
629
|
-
if (t === "manage" ||
|
|
629
|
+
if (t === "manage" || be("manage", n))
|
|
630
630
|
throw new Error('Cannot add alias for "manage" action because it represents any action');
|
|
631
|
-
if (
|
|
631
|
+
if (be(t, n))
|
|
632
632
|
throw new Error("Attempt to alias action to itself: " + t + " -> " + n.toString());
|
|
633
|
-
return
|
|
633
|
+
return me[t] = n, this;
|
|
634
634
|
};
|
|
635
|
-
function e(
|
|
635
|
+
function e(i, t) {
|
|
636
636
|
t === void 0 && (t = {}), Object.defineProperty(this, "subjectName", {
|
|
637
|
-
value: t.subjectName ||
|
|
638
|
-
}), this[
|
|
639
|
-
RuleType: t.RuleType ||
|
|
640
|
-
originalRules:
|
|
637
|
+
value: t.subjectName || nt
|
|
638
|
+
}), this[I] = {
|
|
639
|
+
RuleType: t.RuleType || dt,
|
|
640
|
+
originalRules: i || [],
|
|
641
641
|
hasPerFieldRules: !1,
|
|
642
642
|
indexedRules: /* @__PURE__ */ Object.create(null),
|
|
643
643
|
mergedRules: /* @__PURE__ */ Object.create(null),
|
|
644
644
|
events: {},
|
|
645
|
-
aliases:
|
|
646
|
-
}, this.update(
|
|
645
|
+
aliases: ot(me)
|
|
646
|
+
}, this.update(i);
|
|
647
647
|
}
|
|
648
648
|
var o = e.prototype;
|
|
649
649
|
return o.update = function(t) {
|
|
@@ -653,19 +653,19 @@ var ct = /* @__PURE__ */ function() {
|
|
|
653
653
|
rules: t,
|
|
654
654
|
ability: this
|
|
655
655
|
};
|
|
656
|
-
this.emit("update", n), this[
|
|
656
|
+
this.emit("update", n), this[I].originalRules = t.slice(0), this[I].mergedRules = /* @__PURE__ */ Object.create(null);
|
|
657
657
|
var a = this.buildIndexFor(t);
|
|
658
|
-
return this[
|
|
658
|
+
return this[I].indexedRules = a.rules, this[I].hasPerFieldRules = a.hasPerFieldRules, this.emit("updated", n), this;
|
|
659
659
|
}, o.buildIndexFor = function(t) {
|
|
660
|
-
for (var n = /* @__PURE__ */ Object.create(null), a = this[
|
|
661
|
-
var w = new a(t[y]),
|
|
660
|
+
for (var n = /* @__PURE__ */ Object.create(null), a = this[I].RuleType, l = !0, f = !1, y = 0; y < t.length; y++) {
|
|
661
|
+
var w = new a(t[y]), b = this.expandActions(w.actions), S = te(w.subject), $ = t.length - y - 1;
|
|
662
662
|
l = !!(l && w.inverted), !f && w.fields && (f = !0);
|
|
663
|
-
for (var
|
|
664
|
-
var
|
|
665
|
-
n[
|
|
666
|
-
for (var
|
|
667
|
-
var x =
|
|
668
|
-
n[
|
|
663
|
+
for (var m = 0; m < S.length; m++) {
|
|
664
|
+
var P = S[m];
|
|
665
|
+
n[P] = n[P] || /* @__PURE__ */ Object.create(null);
|
|
666
|
+
for (var A = 0; A < b.length; A++) {
|
|
667
|
+
var x = b[A];
|
|
668
|
+
n[P][x] = n[P][x] || /* @__PURE__ */ Object.create(null), n[P][x][$] = w;
|
|
669
669
|
}
|
|
670
670
|
}
|
|
671
671
|
}
|
|
@@ -675,7 +675,7 @@ var ct = /* @__PURE__ */ function() {
|
|
|
675
675
|
rules: n
|
|
676
676
|
};
|
|
677
677
|
}, o.expandActions = function(t) {
|
|
678
|
-
for (var n = this[
|
|
678
|
+
for (var n = this[I].aliases, a = te(t), l = 0; l < a.length; ) {
|
|
679
679
|
var f = a[l++];
|
|
680
680
|
n.hasOwnProperty(f) && (a = a.concat(n[f]));
|
|
681
681
|
}
|
|
@@ -691,17 +691,17 @@ var ct = /* @__PURE__ */ function() {
|
|
|
691
691
|
return l[f];
|
|
692
692
|
return null;
|
|
693
693
|
}, o.possibleRulesFor = function(t, n) {
|
|
694
|
-
var a = this.subjectName(n), l = this[
|
|
694
|
+
var a = this.subjectName(n), l = this[I].mergedRules, f = a + "_" + t;
|
|
695
695
|
return l[f] || (l[f] = this.mergeRulesFor(t, a)), l[f];
|
|
696
696
|
}, o.mergeRulesFor = function(t, n) {
|
|
697
|
-
var a = this[
|
|
697
|
+
var a = this[I].indexedRules, l = [n, "all"].reduce(function(f, y) {
|
|
698
698
|
var w = a[y];
|
|
699
699
|
return w ? Object.assign(f, w[t], w.manage) : f;
|
|
700
700
|
}, []);
|
|
701
701
|
return l.filter(Boolean);
|
|
702
702
|
}, o.rulesFor = function(t, n, a) {
|
|
703
703
|
var l = this.possibleRulesFor(t, n);
|
|
704
|
-
return this[
|
|
704
|
+
return this[I].hasPerFieldRules ? l.filter(function(f) {
|
|
705
705
|
return f.isRelevantFor(n, a);
|
|
706
706
|
}) : l;
|
|
707
707
|
}, o.cannot = function() {
|
|
@@ -711,9 +711,9 @@ var ct = /* @__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()), (t =
|
|
714
|
+
`.trim()), (t = rt.from(this)).throwUnlessCan.apply(t, arguments);
|
|
715
715
|
}, o.on = function(t, n) {
|
|
716
|
-
var a = this[
|
|
716
|
+
var a = this[I].events, l = !0;
|
|
717
717
|
return a[t] || (a[t] = []), a[t].push(n), function() {
|
|
718
718
|
if (l) {
|
|
719
719
|
var f = a[t].indexOf(n);
|
|
@@ -721,34 +721,34 @@ var ct = /* @__PURE__ */ function() {
|
|
|
721
721
|
}
|
|
722
722
|
};
|
|
723
723
|
}, o.emit = function(t, n) {
|
|
724
|
-
var a = this[
|
|
724
|
+
var a = this[I].events[t];
|
|
725
725
|
a && a.slice(0).forEach(function(l) {
|
|
726
726
|
return l(n);
|
|
727
727
|
});
|
|
728
|
-
},
|
|
728
|
+
}, Ze(e, [{
|
|
729
729
|
key: "rules",
|
|
730
730
|
get: function() {
|
|
731
|
-
return this[
|
|
731
|
+
return this[I].originalRules;
|
|
732
732
|
}
|
|
733
733
|
}]), e;
|
|
734
734
|
}();
|
|
735
|
-
function
|
|
736
|
-
return new
|
|
735
|
+
function pt(e) {
|
|
736
|
+
return new ht(e).can("manage", "business::miniProgram::brandkit");
|
|
737
737
|
}
|
|
738
|
-
function
|
|
738
|
+
function Y() {
|
|
739
739
|
var o;
|
|
740
|
-
const e = ((o =
|
|
741
|
-
return
|
|
742
|
-
e.map(({ fields:
|
|
740
|
+
const e = ((o = He().sessionUser.value) == null ? void 0 : o.permissions) ?? [];
|
|
741
|
+
return pt(
|
|
742
|
+
e.map(({ fields: i, inverted: t, reason: n, ...a }) => ({
|
|
743
743
|
...a,
|
|
744
|
-
fields:
|
|
744
|
+
fields: i ?? void 0,
|
|
745
745
|
inverted: t ?? void 0,
|
|
746
746
|
reason: n ?? void 0
|
|
747
747
|
}))
|
|
748
748
|
);
|
|
749
749
|
}
|
|
750
|
-
function
|
|
751
|
-
return B(
|
|
750
|
+
function Mt() {
|
|
751
|
+
return B(Y);
|
|
752
752
|
}
|
|
753
753
|
const U = [
|
|
754
754
|
{ path: "primary", label: "Primary", group: "Brand", hint: "Dominant brand color" },
|
|
@@ -781,29 +781,34 @@ const U = [
|
|
|
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
|
-
], re = "HORIZONTAL", ne = "LIST", oe = !1,
|
|
784
|
+
], re = "HORIZONTAL", ne = "LIST", oe = !1, ae = !1, Ee = ["showCategoryImage", "showScheduledItems"], _e = {
|
|
785
785
|
category: ["HORIZONTAL", "VERTICAL"],
|
|
786
786
|
items: ["LIST", "GRID"]
|
|
787
|
-
},
|
|
788
|
-
function
|
|
789
|
-
const o =
|
|
787
|
+
}, gt = { category: "VERTICAL", singleCategory: !1 };
|
|
788
|
+
function yt(e) {
|
|
789
|
+
const o = E(e, "ordering.app.category");
|
|
790
790
|
return o === "VERTICAL" || o === "HORIZONTAL" ? o : re;
|
|
791
791
|
}
|
|
792
|
-
function
|
|
793
|
-
return
|
|
792
|
+
function vt(e) {
|
|
793
|
+
return E(e, "ordering.app.items") === "GRID" ? "GRID" : ne;
|
|
794
794
|
}
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
795
|
+
const mt = {
|
|
796
|
+
showCategoryImage: oe,
|
|
797
|
+
showScheduledItems: ae
|
|
798
|
+
};
|
|
799
|
+
function we(e, o) {
|
|
800
|
+
const i = E(e, `ordering.app.${o}`);
|
|
801
|
+
return typeof i == "boolean" ? i : mt[o];
|
|
798
802
|
}
|
|
799
|
-
function
|
|
800
|
-
(!e.ordering || typeof e.ordering != "object") && (e.ordering = { kiosk: { ...
|
|
803
|
+
function bt(e, o, i) {
|
|
804
|
+
(!e.ordering || typeof e.ordering != "object") && (e.ordering = { kiosk: { ...gt } });
|
|
801
805
|
const t = e.ordering;
|
|
802
806
|
(!t.app || typeof t.app != "object") && (t.app = { singleCategory: !1 });
|
|
803
807
|
const n = t.app;
|
|
804
808
|
for (const a of ["category", "items"])
|
|
805
|
-
(
|
|
806
|
-
|
|
809
|
+
(i.includes(a) || !_e[a].includes(n[a])) && (n[a] = o[a]);
|
|
810
|
+
for (const a of Ee)
|
|
811
|
+
i.includes(a) && (n[a] = o[a]);
|
|
807
812
|
}
|
|
808
813
|
const Pe = {
|
|
809
814
|
primary: "#ff7823",
|
|
@@ -826,36 +831,36 @@ const Pe = {
|
|
|
826
831
|
brand: "'Inter', sans-serif",
|
|
827
832
|
heading: "'Inter', sans-serif",
|
|
828
833
|
body: "'Roboto', sans-serif"
|
|
829
|
-
},
|
|
830
|
-
function
|
|
831
|
-
return
|
|
834
|
+
}, $e = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
835
|
+
function wt(e) {
|
|
836
|
+
return $e.test(e.trim());
|
|
832
837
|
}
|
|
833
|
-
function
|
|
838
|
+
function Se(e) {
|
|
834
839
|
const o = e.trim().toLowerCase();
|
|
835
|
-
if (
|
|
840
|
+
if (!$e.test(o)) return "#000000";
|
|
836
841
|
if (o.length === 7) return o;
|
|
837
|
-
const [
|
|
838
|
-
return `#${
|
|
842
|
+
const [i, t, n] = o.slice(1);
|
|
843
|
+
return `#${i}${i}${t}${t}${n}${n}`;
|
|
839
844
|
}
|
|
840
|
-
function
|
|
841
|
-
return
|
|
845
|
+
function St() {
|
|
846
|
+
return ke(Be("fmmf:dev")).apiOrigin;
|
|
842
847
|
}
|
|
843
|
-
function
|
|
844
|
-
return `${
|
|
848
|
+
function fe(e) {
|
|
849
|
+
return `${St()}/metadata/${e}/brandkit`;
|
|
845
850
|
}
|
|
846
|
-
async function
|
|
847
|
-
const e = await
|
|
851
|
+
async function Ae() {
|
|
852
|
+
const e = await Ke();
|
|
848
853
|
return e ? { "Content-Type": "application/json", Authorization: e } : { "Content-Type": "application/json" };
|
|
849
854
|
}
|
|
850
|
-
function
|
|
851
|
-
let
|
|
855
|
+
function E(e, o) {
|
|
856
|
+
let i = e;
|
|
852
857
|
for (const t of o.split(".")) {
|
|
853
|
-
if (!
|
|
854
|
-
|
|
858
|
+
if (!i || typeof i != "object") return;
|
|
859
|
+
i = i[t];
|
|
855
860
|
}
|
|
856
|
-
return
|
|
861
|
+
return i;
|
|
857
862
|
}
|
|
858
|
-
function
|
|
863
|
+
function ie(e, o, i) {
|
|
859
864
|
const t = o.split("."), n = t.pop();
|
|
860
865
|
if (!n) return;
|
|
861
866
|
let a = e;
|
|
@@ -863,20 +868,20 @@ function ae(e, o, s) {
|
|
|
863
868
|
const f = a[l];
|
|
864
869
|
(!f || typeof f != "object") && (a[l] = {}), a = a[l];
|
|
865
870
|
}
|
|
866
|
-
a[n] =
|
|
871
|
+
a[n] = i;
|
|
867
872
|
}
|
|
868
|
-
function
|
|
873
|
+
function se(e, o, i) {
|
|
869
874
|
const t = {};
|
|
870
|
-
for (const n of
|
|
871
|
-
const a =
|
|
875
|
+
for (const n of i) {
|
|
876
|
+
const a = E(e == null ? void 0 : e[o], n.path);
|
|
872
877
|
t[n.path] = typeof a == "string" ? a : "";
|
|
873
878
|
}
|
|
874
879
|
return t;
|
|
875
880
|
}
|
|
876
|
-
function
|
|
881
|
+
function ue(e) {
|
|
877
882
|
return JSON.parse(JSON.stringify(e));
|
|
878
883
|
}
|
|
879
|
-
const u =
|
|
884
|
+
const u = Ue({
|
|
880
885
|
panelOpen: !1,
|
|
881
886
|
loading: !1,
|
|
882
887
|
saving: !1,
|
|
@@ -893,119 +898,128 @@ const u = ke({
|
|
|
893
898
|
savedMenuItems: ne,
|
|
894
899
|
showCategoryImage: oe,
|
|
895
900
|
savedShowCategoryImage: oe,
|
|
901
|
+
showScheduledItems: ae,
|
|
902
|
+
savedShowScheduledItems: ae,
|
|
896
903
|
// Full kit as it was before our last save — the only undo colors get.
|
|
897
904
|
revertKit: null,
|
|
898
905
|
appliedProposal: null
|
|
899
906
|
});
|
|
900
|
-
async function
|
|
901
|
-
const o = await fetch(
|
|
907
|
+
async function de(e) {
|
|
908
|
+
const o = await fetch(fe(e), { signal: AbortSignal.timeout(15e3) });
|
|
902
909
|
if (o.status === 404) return null;
|
|
903
910
|
if (!o.ok) throw new Error(`GET brandkit failed: HTTP ${o.status}`);
|
|
904
911
|
return await o.json();
|
|
905
912
|
}
|
|
906
|
-
function
|
|
907
|
-
u.colors =
|
|
913
|
+
function W(e) {
|
|
914
|
+
u.colors = se(e, "colors", U), u.fonts = se(e, "fonts", N), u.savedColors = { ...u.colors }, u.savedFonts = { ...u.fonts }, u.categoryLayout = yt(e), u.savedCategoryLayout = u.categoryLayout, u.menuItems = vt(e), u.savedMenuItems = u.menuItems, u.showCategoryImage = we(e, "showCategoryImage"), u.savedShowCategoryImage = u.showCategoryImage, u.showScheduledItems = we(e, "showScheduledItems"), u.savedShowScheduledItems = u.showScheduledItems, u.loaded = !0;
|
|
908
915
|
}
|
|
909
|
-
let L = null,
|
|
910
|
-
function
|
|
911
|
-
const o =
|
|
916
|
+
let L = null, _ = 0, k = null;
|
|
917
|
+
function Ce(e = !1) {
|
|
918
|
+
const o = R();
|
|
912
919
|
if (u.loaded && !e && u.businessId === o) return Promise.resolve();
|
|
913
920
|
if ((L == null ? void 0 : L.businessId) === o) return L.promise;
|
|
914
|
-
const
|
|
915
|
-
u.businessId !== o && (u.businessId = o, u.loaded = !1, u.revertKit = null,
|
|
921
|
+
const i = ++_;
|
|
922
|
+
u.businessId !== o && (u.businessId = o, u.loaded = !1, u.revertKit = null, k = null, u.appliedProposal = null, W(null), u.loaded = !1);
|
|
916
923
|
const t = (async () => {
|
|
917
924
|
u.loading = !0, u.error = null;
|
|
918
925
|
try {
|
|
919
|
-
const n = await
|
|
920
|
-
|
|
926
|
+
const n = await de(o);
|
|
927
|
+
i === _ && W(n);
|
|
921
928
|
} catch (n) {
|
|
922
|
-
|
|
929
|
+
i === _ && (u.error = le(n));
|
|
923
930
|
} finally {
|
|
924
|
-
|
|
931
|
+
i === _ && (u.loading = !1, L = null);
|
|
925
932
|
}
|
|
926
933
|
})();
|
|
927
934
|
return L = { businessId: o, promise: t }, t;
|
|
928
935
|
}
|
|
929
|
-
function
|
|
936
|
+
function xe() {
|
|
930
937
|
const e = U.filter((t) => u.colors[t.path] !== u.savedColors[t.path]).map(
|
|
931
938
|
(t) => t.path
|
|
932
939
|
), o = N.filter((t) => u.fonts[t.path] !== u.savedFonts[t.path]).map(
|
|
933
940
|
(t) => t.path
|
|
934
|
-
),
|
|
935
|
-
return u.categoryLayout !== u.savedCategoryLayout &&
|
|
941
|
+
), i = [];
|
|
942
|
+
return u.categoryLayout !== u.savedCategoryLayout && i.push("category"), u.menuItems !== u.savedMenuItems && i.push("items"), u.showCategoryImage !== u.savedShowCategoryImage && i.push("showCategoryImage"), u.showScheduledItems !== u.savedShowScheduledItems && i.push("showScheduledItems"), { colorPaths: e, fontPaths: o, layoutFields: i };
|
|
936
943
|
}
|
|
937
|
-
const
|
|
938
|
-
const { colorPaths: e, fontPaths: o, layoutFields:
|
|
939
|
-
return e.length + o.length +
|
|
940
|
-
}),
|
|
944
|
+
const Ft = B(() => {
|
|
945
|
+
const { colorPaths: e, fontPaths: o, layoutFields: i } = xe();
|
|
946
|
+
return e.length + o.length + i.length;
|
|
947
|
+
}), je = B(
|
|
941
948
|
() => U.some((e) => {
|
|
942
949
|
const o = u.colors[e.path] ?? "";
|
|
943
|
-
return o !== "" && !
|
|
950
|
+
return o !== "" && !wt(o);
|
|
944
951
|
})
|
|
945
952
|
);
|
|
946
|
-
async function
|
|
947
|
-
const e =
|
|
948
|
-
if (!
|
|
953
|
+
async function Ot() {
|
|
954
|
+
const e = R();
|
|
955
|
+
if (!Y())
|
|
949
956
|
throw u.error = "You do not have permission to manage this Brand Kit. Contact an administrator.", new Error(u.error);
|
|
950
957
|
if (u.saving || u.loading || !u.loaded || u.businessId !== e)
|
|
951
958
|
throw new Error("Wait for the current Brand Kit to finish loading or saving.");
|
|
952
|
-
if (
|
|
953
|
-
const { colorPaths: o, fontPaths:
|
|
954
|
-
if (!o.length && !
|
|
955
|
-
const n = { ...u.colors }, a = { ...u.fonts }, l = {
|
|
959
|
+
if (je.value) throw new Error("Enter valid hex colors before saving.");
|
|
960
|
+
const { colorPaths: o, fontPaths: i, layoutFields: t } = xe();
|
|
961
|
+
if (!o.length && !i.length && !t.length) return;
|
|
962
|
+
const n = { ...u.colors }, a = { ...u.fonts }, l = {
|
|
963
|
+
category: u.categoryLayout,
|
|
964
|
+
items: u.menuItems,
|
|
965
|
+
showCategoryImage: u.showCategoryImage,
|
|
966
|
+
showScheduledItems: u.showScheduledItems
|
|
967
|
+
}, f = _;
|
|
956
968
|
u.saving = !0, u.error = null;
|
|
957
969
|
try {
|
|
958
|
-
const y = await
|
|
959
|
-
o.length && (!
|
|
960
|
-
for (const
|
|
961
|
-
for (const
|
|
962
|
-
|
|
963
|
-
const
|
|
970
|
+
const y = await de(e) ?? {}, w = ue(y), b = ue(y);
|
|
971
|
+
o.length && (!b.colors || typeof b.colors != "object") && (b.colors = {}), i.length && (!b.fonts || typeof b.fonts != "object") && (b.fonts = {});
|
|
972
|
+
for (const m of o) ie(b.colors, m, (n[m] ?? "").trim());
|
|
973
|
+
for (const m of i) ie(b.fonts, m, (a[m] ?? "").trim());
|
|
974
|
+
i.length && (b.fontFamilies = Ye(y.fontFamilies, se(b, "fonts", N)));
|
|
975
|
+
const S = t.length ? [
|
|
964
976
|
...["category", "items"].filter(
|
|
965
|
-
(
|
|
977
|
+
(m) => t.includes(m) || !_e[m].includes(E(y, `ordering.app.${m}`))
|
|
966
978
|
),
|
|
967
|
-
...t.includes(
|
|
979
|
+
...Ee.filter((m) => t.includes(m))
|
|
968
980
|
] : [];
|
|
969
|
-
if (t.length &&
|
|
981
|
+
if (t.length && bt(b, l, t), f !== _ || e !== R())
|
|
970
982
|
throw new Error("Business changed. No Brand Kit was saved.");
|
|
971
|
-
const $ = await fetch(
|
|
983
|
+
const $ = await fetch(fe(e), {
|
|
972
984
|
method: "POST",
|
|
973
|
-
headers: await
|
|
974
|
-
body: JSON.stringify(
|
|
985
|
+
headers: await Ae(),
|
|
986
|
+
body: JSON.stringify(b),
|
|
975
987
|
signal: AbortSignal.timeout(2e4)
|
|
976
988
|
});
|
|
977
989
|
if (!$.ok) throw new Error(`Save failed: HTTP ${$.status}`);
|
|
978
|
-
f ===
|
|
990
|
+
f === _ && e === R() && (u.revertKit = w, k = {
|
|
979
991
|
colorPaths: o,
|
|
980
|
-
fontPaths:
|
|
981
|
-
savedFontFamilies:
|
|
982
|
-
...
|
|
992
|
+
fontPaths: i,
|
|
993
|
+
savedFontFamilies: i.length ? JSON.stringify(b.fontFamilies) : void 0,
|
|
994
|
+
...S.length ? {
|
|
983
995
|
menuLayout: {
|
|
984
|
-
fields:
|
|
985
|
-
previous: Object.fromEntries(
|
|
996
|
+
fields: S,
|
|
997
|
+
previous: Object.fromEntries(
|
|
998
|
+
S.map((m) => [m, E(y, `ordering.app.${m}`)])
|
|
999
|
+
)
|
|
986
1000
|
}
|
|
987
1001
|
} : {}
|
|
988
|
-
}, u.appliedProposal = null,
|
|
1002
|
+
}, u.appliedProposal = null, W(b));
|
|
989
1003
|
} catch (y) {
|
|
990
|
-
throw f ===
|
|
1004
|
+
throw f === _ && (u.error = le(y)), y;
|
|
991
1005
|
} finally {
|
|
992
1006
|
u.saving = !1;
|
|
993
1007
|
}
|
|
994
1008
|
}
|
|
995
|
-
async function
|
|
996
|
-
if (!u.revertKit || !
|
|
997
|
-
const e =
|
|
998
|
-
if (!
|
|
1009
|
+
async function It() {
|
|
1010
|
+
if (!u.revertKit || !k || u.saving || u.loading) return;
|
|
1011
|
+
const e = R();
|
|
1012
|
+
if (!Y())
|
|
999
1013
|
throw u.error = "You do not have permission to manage this Brand Kit. Contact an administrator.", new Error(u.error);
|
|
1000
1014
|
if (u.businessId !== e) throw new Error("Load the current business before reverting.");
|
|
1001
|
-
const o =
|
|
1015
|
+
const o = _, i = ue(u.revertKit), t = k;
|
|
1002
1016
|
u.saving = !0, u.error = null;
|
|
1003
1017
|
try {
|
|
1004
|
-
const n = await
|
|
1018
|
+
const n = await de(e) ?? {};
|
|
1005
1019
|
if (t.fontPaths.length) {
|
|
1006
|
-
if (N.some((l) => (
|
|
1020
|
+
if (N.some((l) => (E(n.fonts, l.path) ?? "") !== u.savedFonts[l.path]) || JSON.stringify(n.fontFamilies) !== t.savedFontFamilies)
|
|
1007
1021
|
throw new Error("Brand Kit changed since your save. Reload it before editing again.");
|
|
1008
|
-
Object.hasOwn(
|
|
1022
|
+
Object.hasOwn(i, "fontFamilies") ? n.fontFamilies = i.fontFamilies : delete n.fontFamilies;
|
|
1009
1023
|
}
|
|
1010
1024
|
for (const [l, f] of [
|
|
1011
1025
|
["colors", t.colorPaths],
|
|
@@ -1013,14 +1027,14 @@ async function Ot() {
|
|
|
1013
1027
|
]) {
|
|
1014
1028
|
const y = l === "colors" ? u.savedColors : u.savedFonts;
|
|
1015
1029
|
for (const w of f) {
|
|
1016
|
-
if ((
|
|
1030
|
+
if ((E(n[l], w) ?? "") !== y[w])
|
|
1017
1031
|
throw new Error("Brand Kit changed since your save. Reload it before editing again.");
|
|
1018
1032
|
(!n[l] || typeof n[l] != "object") && (n[l] = {});
|
|
1019
|
-
const
|
|
1020
|
-
if (typeof
|
|
1033
|
+
const b = E(i[l], w);
|
|
1034
|
+
if (typeof b == "string") ie(n[l], w, b);
|
|
1021
1035
|
else {
|
|
1022
|
-
const
|
|
1023
|
-
|
|
1036
|
+
const S = w.split("."), $ = S.pop(), m = S.length ? E(n[l], S.join(".")) : n[l];
|
|
1037
|
+
m && typeof m == "object" && delete m[$];
|
|
1024
1038
|
}
|
|
1025
1039
|
}
|
|
1026
1040
|
}
|
|
@@ -1028,83 +1042,84 @@ async function Ot() {
|
|
|
1028
1042
|
const l = {
|
|
1029
1043
|
category: u.savedCategoryLayout,
|
|
1030
1044
|
items: u.savedMenuItems,
|
|
1031
|
-
showCategoryImage: u.savedShowCategoryImage
|
|
1045
|
+
showCategoryImage: u.savedShowCategoryImage,
|
|
1046
|
+
showScheduledItems: u.savedShowScheduledItems
|
|
1032
1047
|
};
|
|
1033
|
-
if (t.menuLayout.fields.some((y) =>
|
|
1048
|
+
if (t.menuLayout.fields.some((y) => E(n, `ordering.app.${y}`) !== l[y]))
|
|
1034
1049
|
throw new Error("Brand Kit changed since your save. Reload it before editing again.");
|
|
1035
|
-
const f =
|
|
1050
|
+
const f = E(n, "ordering.app");
|
|
1036
1051
|
for (const y of t.menuLayout.fields) {
|
|
1037
1052
|
if (!f || typeof f != "object") break;
|
|
1038
1053
|
const w = t.menuLayout.previous[y];
|
|
1039
1054
|
w === void 0 ? delete f[y] : f[y] = w;
|
|
1040
1055
|
}
|
|
1041
1056
|
}
|
|
1042
|
-
if (o !==
|
|
1057
|
+
if (o !== _ || e !== R())
|
|
1043
1058
|
throw new Error("Business changed. No Brand Kit was reverted.");
|
|
1044
|
-
const a = await fetch(
|
|
1059
|
+
const a = await fetch(fe(e), {
|
|
1045
1060
|
method: "POST",
|
|
1046
|
-
headers: await
|
|
1061
|
+
headers: await Ae(),
|
|
1047
1062
|
body: JSON.stringify(n),
|
|
1048
1063
|
signal: AbortSignal.timeout(2e4)
|
|
1049
1064
|
});
|
|
1050
1065
|
if (!a.ok) throw new Error(`Revert failed: HTTP ${a.status}`);
|
|
1051
|
-
o ===
|
|
1066
|
+
o === _ && e === R() && (u.revertKit = null, k = null, W(n));
|
|
1052
1067
|
} catch (n) {
|
|
1053
|
-
throw o ===
|
|
1068
|
+
throw o === _ && (u.error = le(n)), n;
|
|
1054
1069
|
} finally {
|
|
1055
1070
|
u.saving = !1;
|
|
1056
1071
|
}
|
|
1057
1072
|
}
|
|
1058
|
-
async function
|
|
1073
|
+
async function Et(e) {
|
|
1059
1074
|
u.panelOpen = !0;
|
|
1060
|
-
const o =
|
|
1061
|
-
if (await
|
|
1062
|
-
for (const
|
|
1063
|
-
const t = e.colors[
|
|
1064
|
-
t && (u.colors[
|
|
1075
|
+
const o = R();
|
|
1076
|
+
if (await Ce(), !(!u.loaded || u.loading || u.saving || u.businessId !== o || R() !== o)) {
|
|
1077
|
+
for (const i of U) {
|
|
1078
|
+
const t = e.colors[i.path];
|
|
1079
|
+
t && (u.colors[i.path] = t);
|
|
1065
1080
|
}
|
|
1066
|
-
for (const
|
|
1067
|
-
const t = e.fonts[
|
|
1068
|
-
t && (u.fonts[
|
|
1081
|
+
for (const i of N) {
|
|
1082
|
+
const t = e.fonts[i.path];
|
|
1083
|
+
t && (u.fonts[i.path] = t);
|
|
1069
1084
|
}
|
|
1070
1085
|
u.appliedProposal = e.name ?? "Untitled proposal";
|
|
1071
1086
|
}
|
|
1072
1087
|
}
|
|
1073
|
-
function
|
|
1074
|
-
u.colors = { ...u.savedColors }, u.fonts = { ...u.savedFonts }, u.categoryLayout = u.savedCategoryLayout, u.menuItems = u.savedMenuItems, u.showCategoryImage = u.savedShowCategoryImage, u.appliedProposal = null;
|
|
1088
|
+
function _t() {
|
|
1089
|
+
u.colors = { ...u.savedColors }, u.fonts = { ...u.savedFonts }, u.categoryLayout = u.savedCategoryLayout, u.menuItems = u.savedMenuItems, u.showCategoryImage = u.savedShowCategoryImage, u.showScheduledItems = u.savedShowScheduledItems, u.appliedProposal = null;
|
|
1075
1090
|
}
|
|
1076
1091
|
const Pt = B(
|
|
1077
|
-
() => U.every((e) =>
|
|
1092
|
+
() => U.every((e) => Se(u.colors[e.path] ?? "") === Se(Pe[e.path]))
|
|
1078
1093
|
), Rt = B(
|
|
1079
1094
|
() => N.every((e) => u.fonts[e.path] === Re[e.path])
|
|
1080
1095
|
);
|
|
1081
|
-
function
|
|
1082
|
-
!
|
|
1096
|
+
function $t(e) {
|
|
1097
|
+
!Y() || !u.loaded || u.loading || u.saving || u.businessId !== R() || (e === "colors" ? u.colors = { ...Pe } : u.fonts = { ...Re }, u.appliedProposal = null);
|
|
1083
1098
|
}
|
|
1084
|
-
function
|
|
1099
|
+
function Dt() {
|
|
1085
1100
|
return {
|
|
1086
1101
|
state: u,
|
|
1087
|
-
dirtyCount:
|
|
1088
|
-
hasInvalidColor:
|
|
1102
|
+
dirtyCount: Ft,
|
|
1103
|
+
hasInvalidColor: je,
|
|
1089
1104
|
colorsAreDefault: Pt,
|
|
1090
1105
|
fontsAreDefault: Rt,
|
|
1091
|
-
load:
|
|
1092
|
-
save:
|
|
1093
|
-
revertLastSave:
|
|
1094
|
-
applyProposal:
|
|
1095
|
-
resetToDefault:
|
|
1096
|
-
discardEdits:
|
|
1106
|
+
load: Ce,
|
|
1107
|
+
save: Ot,
|
|
1108
|
+
revertLastSave: It,
|
|
1109
|
+
applyProposal: Et,
|
|
1110
|
+
resetToDefault: $t,
|
|
1111
|
+
discardEdits: _t
|
|
1097
1112
|
};
|
|
1098
1113
|
}
|
|
1099
1114
|
export {
|
|
1100
1115
|
U as C,
|
|
1101
1116
|
N as F,
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1117
|
+
ce as G,
|
|
1118
|
+
Mt as a,
|
|
1119
|
+
qe as b,
|
|
1120
|
+
Lt as f,
|
|
1121
|
+
wt as i,
|
|
1122
|
+
Nt as l,
|
|
1123
|
+
Se as t,
|
|
1124
|
+
Dt as u
|
|
1110
1125
|
};
|