@feedmepos/mf-mdm 1.5.4-beta.178 → 1.5.4-beta.180

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.
@@ -0,0 +1,3525 @@
1
+ import { defineComponent as Se, resolveComponent as I, openBlock as f, createElementBlock as b, createElementVNode as r, toDisplayString as h, unref as i, createVNode as m, computed as Q, ref as P, watch as $e, onMounted as pt, createBlock as M, isRef as nn, createSlots as On, withCtx as F, createCommentVNode as k, Fragment as ie, renderList as ue, normalizeClass as on, withModifiers as Rt, nextTick as sn, createTextVNode as Ct, Teleport as An, h as X } from "vue";
2
+ import { b as zn, C as Sn, r as Gt, h as tt, c as Nn, w as Pn, e as xn, S as Ln, x as Un, F as Mn, u as an, y as Z, z as ne, A as Bn, B as Tt, D as Te, G as ft, H as ln, I as rt, v as Vn } from "./index-1fcfcd9b.js";
3
+ import { useI18n as Ne, useCoreStore as Dt } from "@feedmepos/mf-common";
4
+ import { useProxiedModel as mt, useSnackbar as nt, SnackbarPosition as ee, useBreakpoints as Ot, useDialogChild as rn, useDialog as cn, components as Me } from "@feedmepos/ui-library";
5
+ import { storeToRefs as $n } from "pinia";
6
+ const jn = { class: "flex flex-col gap-16" }, qn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Hn = {
7
+ key: 0,
8
+ class: "flex gap-5 flex-col"
9
+ }, Gn = {
10
+ key: 1,
11
+ class: "flex justify-start"
12
+ }, Wn = /* @__PURE__ */ Se({
13
+ __name: "BindOtpDialog",
14
+ props: {
15
+ restaurantId: {
16
+ type: String,
17
+ required: !0
18
+ },
19
+ otp: {
20
+ type: String,
21
+ required: !0
22
+ }
23
+ },
24
+ setup(e) {
25
+ const { t } = Ne(), o = mt(e, "otp"), s = nt(), l = async (c) => {
26
+ const p = "text/plain", _ = new Blob([c], { type: p }), y = [new ClipboardItem({ [p]: _ })];
27
+ await navigator.clipboard.write(y).then(() => {
28
+ s.open({
29
+ message: t("device.otp.otpCopiedMessage"),
30
+ type: "success",
31
+ position: ee.BOTTOM
32
+ });
33
+ });
34
+ };
35
+ return (c, p) => {
36
+ const _ = I("FmCircularProgress");
37
+ return f(), b("div", jn, [
38
+ r("div", qn, h(i(t)("device.otp.otpExpiryMessage")), 1),
39
+ i(o) ? (f(), b("div", Hn, [
40
+ r("div", {
41
+ class: "fm-typo-en-title-md-800 tracking-[0.3rem] cursor-pointer hover:text-fm-color-neutral-gray-300",
42
+ onClick: p[0] || (p[0] = (y) => l(i(o)))
43
+ }, h(i(o)), 1)
44
+ ])) : (f(), b("div", Gn, [
45
+ m(_, { size: "lg" })
46
+ ]))
47
+ ]);
48
+ };
49
+ }
50
+ });
51
+ /**
52
+ * @license
53
+ * Copyright 2017 Google LLC
54
+ *
55
+ * Licensed under the Apache License, Version 2.0 (the "License");
56
+ * you may not use this file except in compliance with the License.
57
+ * You may obtain a copy of the License at
58
+ *
59
+ * http://www.apache.org/licenses/LICENSE-2.0
60
+ *
61
+ * Unless required by applicable law or agreed to in writing, software
62
+ * distributed under the License is distributed on an "AS IS" BASIS,
63
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
64
+ * See the License for the specific language governing permissions and
65
+ * limitations under the License.
66
+ */
67
+ const un = "firebasestorage.googleapis.com", dn = "storageBucket", Yn = 2 * 60 * 1e3, Kn = 10 * 60 * 1e3;
68
+ /**
69
+ * @license
70
+ * Copyright 2017 Google LLC
71
+ *
72
+ * Licensed under the Apache License, Version 2.0 (the "License");
73
+ * you may not use this file except in compliance with the License.
74
+ * You may obtain a copy of the License at
75
+ *
76
+ * http://www.apache.org/licenses/LICENSE-2.0
77
+ *
78
+ * Unless required by applicable law or agreed to in writing, software
79
+ * distributed under the License is distributed on an "AS IS" BASIS,
80
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
81
+ * See the License for the specific language governing permissions and
82
+ * limitations under the License.
83
+ */
84
+ class H extends Mn {
85
+ /**
86
+ * @param code - A `StorageErrorCode` string to be prefixed with 'storage/' and
87
+ * added to the end of the message.
88
+ * @param message - Error message.
89
+ * @param status_ - Corresponding HTTP Status Code
90
+ */
91
+ constructor(t, n, o = 0) {
92
+ super(It(t), `Firebase Storage: ${n} (${It(t)})`), this.status_ = o, this.customData = { serverResponse: null }, this._baseMessage = this.message, Object.setPrototypeOf(this, H.prototype);
93
+ }
94
+ get status() {
95
+ return this.status_;
96
+ }
97
+ set status(t) {
98
+ this.status_ = t;
99
+ }
100
+ /**
101
+ * Compares a `StorageErrorCode` against this error's code, filtering out the prefix.
102
+ */
103
+ _codeEquals(t) {
104
+ return It(t) === this.code;
105
+ }
106
+ /**
107
+ * Optional response message that was added by the server.
108
+ */
109
+ get serverResponse() {
110
+ return this.customData.serverResponse;
111
+ }
112
+ set serverResponse(t) {
113
+ this.customData.serverResponse = t, this.customData.serverResponse ? this.message = `${this._baseMessage}
114
+ ${this.customData.serverResponse}` : this.message = this._baseMessage;
115
+ }
116
+ }
117
+ var q;
118
+ (function(e) {
119
+ e.UNKNOWN = "unknown", e.OBJECT_NOT_FOUND = "object-not-found", e.BUCKET_NOT_FOUND = "bucket-not-found", e.PROJECT_NOT_FOUND = "project-not-found", e.QUOTA_EXCEEDED = "quota-exceeded", e.UNAUTHENTICATED = "unauthenticated", e.UNAUTHORIZED = "unauthorized", e.UNAUTHORIZED_APP = "unauthorized-app", e.RETRY_LIMIT_EXCEEDED = "retry-limit-exceeded", e.INVALID_CHECKSUM = "invalid-checksum", e.CANCELED = "canceled", e.INVALID_EVENT_NAME = "invalid-event-name", e.INVALID_URL = "invalid-url", e.INVALID_DEFAULT_BUCKET = "invalid-default-bucket", e.NO_DEFAULT_BUCKET = "no-default-bucket", e.CANNOT_SLICE_BLOB = "cannot-slice-blob", e.SERVER_FILE_WRONG_SIZE = "server-file-wrong-size", e.NO_DOWNLOAD_URL = "no-download-url", e.INVALID_ARGUMENT = "invalid-argument", e.INVALID_ARGUMENT_COUNT = "invalid-argument-count", e.APP_DELETED = "app-deleted", e.INVALID_ROOT_OPERATION = "invalid-root-operation", e.INVALID_FORMAT = "invalid-format", e.INTERNAL_ERROR = "internal-error", e.UNSUPPORTED_ENVIRONMENT = "unsupported-environment";
120
+ })(q || (q = {}));
121
+ function It(e) {
122
+ return "storage/" + e;
123
+ }
124
+ function At() {
125
+ const e = "An unknown error occurred, please check the error payload for server response.";
126
+ return new H(q.UNKNOWN, e);
127
+ }
128
+ function Xn(e) {
129
+ return new H(q.OBJECT_NOT_FOUND, "Object '" + e + "' does not exist.");
130
+ }
131
+ function Zn(e) {
132
+ return new H(q.QUOTA_EXCEEDED, "Quota for bucket '" + e + "' exceeded, please view quota on https://firebase.google.com/pricing/.");
133
+ }
134
+ function Qn() {
135
+ const e = "User is not authenticated, please authenticate using Firebase Authentication and try again.";
136
+ return new H(q.UNAUTHENTICATED, e);
137
+ }
138
+ function Jn() {
139
+ return new H(q.UNAUTHORIZED_APP, "This app does not have permission to access Firebase Storage on this project.");
140
+ }
141
+ function eo(e) {
142
+ return new H(q.UNAUTHORIZED, "User does not have permission to access '" + e + "'.");
143
+ }
144
+ function to() {
145
+ return new H(q.RETRY_LIMIT_EXCEEDED, "Max retry time for operation exceeded, please try again.");
146
+ }
147
+ function no() {
148
+ return new H(q.CANCELED, "User canceled the upload/download.");
149
+ }
150
+ function oo(e) {
151
+ return new H(q.INVALID_URL, "Invalid URL '" + e + "'.");
152
+ }
153
+ function so(e) {
154
+ return new H(q.INVALID_DEFAULT_BUCKET, "Invalid default bucket '" + e + "'.");
155
+ }
156
+ function io() {
157
+ return new H(q.NO_DEFAULT_BUCKET, "No default bucket found. Did you set the '" + dn + "' property when initializing the app?");
158
+ }
159
+ function ao() {
160
+ return new H(q.CANNOT_SLICE_BLOB, "Cannot slice blob for upload. Please retry the upload.");
161
+ }
162
+ function lo() {
163
+ return new H(q.NO_DOWNLOAD_URL, "The given file does not have any download URLs.");
164
+ }
165
+ function ro(e) {
166
+ return new H(q.UNSUPPORTED_ENVIRONMENT, `${e} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`);
167
+ }
168
+ function kt(e) {
169
+ return new H(q.INVALID_ARGUMENT, e);
170
+ }
171
+ function mn() {
172
+ return new H(q.APP_DELETED, "The Firebase app was deleted.");
173
+ }
174
+ function co(e) {
175
+ return new H(q.INVALID_ROOT_OPERATION, "The operation '" + e + "' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').");
176
+ }
177
+ function et(e, t) {
178
+ return new H(q.INVALID_FORMAT, "String does not match format '" + e + "': " + t);
179
+ }
180
+ function Je(e) {
181
+ throw new H(q.INTERNAL_ERROR, "Internal error: " + e);
182
+ }
183
+ /**
184
+ * @license
185
+ * Copyright 2017 Google LLC
186
+ *
187
+ * Licensed under the Apache License, Version 2.0 (the "License");
188
+ * you may not use this file except in compliance with the License.
189
+ * You may obtain a copy of the License at
190
+ *
191
+ * http://www.apache.org/licenses/LICENSE-2.0
192
+ *
193
+ * Unless required by applicable law or agreed to in writing, software
194
+ * distributed under the License is distributed on an "AS IS" BASIS,
195
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
196
+ * See the License for the specific language governing permissions and
197
+ * limitations under the License.
198
+ */
199
+ class re {
200
+ constructor(t, n) {
201
+ this.bucket = t, this.path_ = n;
202
+ }
203
+ get path() {
204
+ return this.path_;
205
+ }
206
+ get isRoot() {
207
+ return this.path.length === 0;
208
+ }
209
+ fullServerUrl() {
210
+ const t = encodeURIComponent;
211
+ return "/b/" + t(this.bucket) + "/o/" + t(this.path);
212
+ }
213
+ bucketOnlyServerUrl() {
214
+ return "/b/" + encodeURIComponent(this.bucket) + "/o";
215
+ }
216
+ static makeFromBucketSpec(t, n) {
217
+ let o;
218
+ try {
219
+ o = re.makeFromUrl(t, n);
220
+ } catch {
221
+ return new re(t, "");
222
+ }
223
+ if (o.path === "")
224
+ return o;
225
+ throw so(t);
226
+ }
227
+ static makeFromUrl(t, n) {
228
+ let o = null;
229
+ const s = "([A-Za-z0-9.\\-_]+)";
230
+ function l(w) {
231
+ w.path.charAt(w.path.length - 1) === "/" && (w.path_ = w.path_.slice(0, -1));
232
+ }
233
+ const c = "(/(.*))?$", p = new RegExp("^gs://" + s + c, "i"), _ = { bucket: 1, path: 3 };
234
+ function y(w) {
235
+ w.path_ = decodeURIComponent(w.path);
236
+ }
237
+ const R = "v[A-Za-z0-9_]+", A = n.replace(/[.]/g, "\\."), N = "(/([^?#]*).*)?$", v = new RegExp(`^https?://${A}/${R}/b/${s}/o${N}`, "i"), E = { bucket: 1, path: 3 }, z = n === un ? "(?:storage.googleapis.com|storage.cloud.google.com)" : n, x = "([^?#]*)", V = new RegExp(`^https?://${z}/${s}/${x}`, "i"), O = [
238
+ { regex: p, indices: _, postModify: l },
239
+ {
240
+ regex: v,
241
+ indices: E,
242
+ postModify: y
243
+ },
244
+ {
245
+ regex: V,
246
+ indices: { bucket: 1, path: 2 },
247
+ postModify: y
248
+ }
249
+ ];
250
+ for (let w = 0; w < O.length; w++) {
251
+ const G = O[w], J = G.regex.exec(t);
252
+ if (J) {
253
+ const ae = J[G.indices.bucket];
254
+ let j = J[G.indices.path];
255
+ j || (j = ""), o = new re(ae, j), G.postModify(o);
256
+ break;
257
+ }
258
+ }
259
+ if (o == null)
260
+ throw oo(t);
261
+ return o;
262
+ }
263
+ }
264
+ class uo {
265
+ constructor(t) {
266
+ this.promise_ = Promise.reject(t);
267
+ }
268
+ /** @inheritDoc */
269
+ getPromise() {
270
+ return this.promise_;
271
+ }
272
+ /** @inheritDoc */
273
+ cancel(t = !1) {
274
+ }
275
+ }
276
+ /**
277
+ * @license
278
+ * Copyright 2017 Google LLC
279
+ *
280
+ * Licensed under the Apache License, Version 2.0 (the "License");
281
+ * you may not use this file except in compliance with the License.
282
+ * You may obtain a copy of the License at
283
+ *
284
+ * http://www.apache.org/licenses/LICENSE-2.0
285
+ *
286
+ * Unless required by applicable law or agreed to in writing, software
287
+ * distributed under the License is distributed on an "AS IS" BASIS,
288
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
289
+ * See the License for the specific language governing permissions and
290
+ * limitations under the License.
291
+ */
292
+ function mo(e, t, n) {
293
+ let o = 1, s = null, l = null, c = !1, p = 0;
294
+ function _() {
295
+ return p === 2;
296
+ }
297
+ let y = !1;
298
+ function R(...x) {
299
+ y || (y = !0, t.apply(null, x));
300
+ }
301
+ function A(x) {
302
+ s = setTimeout(() => {
303
+ s = null, e(v, _());
304
+ }, x);
305
+ }
306
+ function N() {
307
+ l && clearTimeout(l);
308
+ }
309
+ function v(x, ...V) {
310
+ if (y) {
311
+ N();
312
+ return;
313
+ }
314
+ if (x) {
315
+ N(), R.call(null, x, ...V);
316
+ return;
317
+ }
318
+ if (_() || c) {
319
+ N(), R.call(null, x, ...V);
320
+ return;
321
+ }
322
+ o < 64 && (o *= 2);
323
+ let O;
324
+ p === 1 ? (p = 2, O = 0) : O = (o + Math.random()) * 1e3, A(O);
325
+ }
326
+ let E = !1;
327
+ function z(x) {
328
+ E || (E = !0, N(), !y && (s !== null ? (x || (p = 2), clearTimeout(s), A(0)) : x || (p = 1)));
329
+ }
330
+ return A(0), l = setTimeout(() => {
331
+ c = !0, z(!0);
332
+ }, n), z;
333
+ }
334
+ function po(e) {
335
+ e(!1);
336
+ }
337
+ /**
338
+ * @license
339
+ * Copyright 2017 Google LLC
340
+ *
341
+ * Licensed under the Apache License, Version 2.0 (the "License");
342
+ * you may not use this file except in compliance with the License.
343
+ * You may obtain a copy of the License at
344
+ *
345
+ * http://www.apache.org/licenses/LICENSE-2.0
346
+ *
347
+ * Unless required by applicable law or agreed to in writing, software
348
+ * distributed under the License is distributed on an "AS IS" BASIS,
349
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
350
+ * See the License for the specific language governing permissions and
351
+ * limitations under the License.
352
+ */
353
+ function fo(e) {
354
+ return e !== void 0;
355
+ }
356
+ function ho(e) {
357
+ return typeof e == "object" && !Array.isArray(e);
358
+ }
359
+ function zt(e) {
360
+ return typeof e == "string" || e instanceof String;
361
+ }
362
+ function Wt(e) {
363
+ return St() && e instanceof Blob;
364
+ }
365
+ function St() {
366
+ return typeof Blob < "u";
367
+ }
368
+ function Yt(e, t, n, o) {
369
+ if (o < t)
370
+ throw kt(`Invalid value for '${e}'. Expected ${t} or greater.`);
371
+ if (o > n)
372
+ throw kt(`Invalid value for '${e}'. Expected ${n} or less.`);
373
+ }
374
+ /**
375
+ * @license
376
+ * Copyright 2017 Google LLC
377
+ *
378
+ * Licensed under the Apache License, Version 2.0 (the "License");
379
+ * you may not use this file except in compliance with the License.
380
+ * You may obtain a copy of the License at
381
+ *
382
+ * http://www.apache.org/licenses/LICENSE-2.0
383
+ *
384
+ * Unless required by applicable law or agreed to in writing, software
385
+ * distributed under the License is distributed on an "AS IS" BASIS,
386
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
387
+ * See the License for the specific language governing permissions and
388
+ * limitations under the License.
389
+ */
390
+ function ht(e, t, n) {
391
+ let o = t;
392
+ return n == null && (o = `https://${t}`), `${n}://${o}/v0${e}`;
393
+ }
394
+ function pn(e) {
395
+ const t = encodeURIComponent;
396
+ let n = "?";
397
+ for (const o in e)
398
+ if (e.hasOwnProperty(o)) {
399
+ const s = t(o) + "=" + t(e[o]);
400
+ n = n + s + "&";
401
+ }
402
+ return n = n.slice(0, -1), n;
403
+ }
404
+ /**
405
+ * @license
406
+ * Copyright 2017 Google LLC
407
+ *
408
+ * Licensed under the Apache License, Version 2.0 (the "License");
409
+ * you may not use this file except in compliance with the License.
410
+ * You may obtain a copy of the License at
411
+ *
412
+ * http://www.apache.org/licenses/LICENSE-2.0
413
+ *
414
+ * Unless required by applicable law or agreed to in writing, software
415
+ * distributed under the License is distributed on an "AS IS" BASIS,
416
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
417
+ * See the License for the specific language governing permissions and
418
+ * limitations under the License.
419
+ */
420
+ var Ae;
421
+ (function(e) {
422
+ e[e.NO_ERROR = 0] = "NO_ERROR", e[e.NETWORK_ERROR = 1] = "NETWORK_ERROR", e[e.ABORT = 2] = "ABORT";
423
+ })(Ae || (Ae = {}));
424
+ /**
425
+ * @license
426
+ * Copyright 2022 Google LLC
427
+ *
428
+ * Licensed under the Apache License, Version 2.0 (the "License");
429
+ * you may not use this file except in compliance with the License.
430
+ * You may obtain a copy of the License at
431
+ *
432
+ * http://www.apache.org/licenses/LICENSE-2.0
433
+ *
434
+ * Unless required by applicable law or agreed to in writing, software
435
+ * distributed under the License is distributed on an "AS IS" BASIS,
436
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
437
+ * See the License for the specific language governing permissions and
438
+ * limitations under the License.
439
+ */
440
+ function vo(e, t) {
441
+ const n = e >= 500 && e < 600, s = [
442
+ // Request Timeout: web server didn't receive full request in time.
443
+ 408,
444
+ // Too Many Requests: you're getting rate-limited, basically.
445
+ 429
446
+ ].indexOf(e) !== -1, l = t.indexOf(e) !== -1;
447
+ return n || s || l;
448
+ }
449
+ /**
450
+ * @license
451
+ * Copyright 2017 Google LLC
452
+ *
453
+ * Licensed under the Apache License, Version 2.0 (the "License");
454
+ * you may not use this file except in compliance with the License.
455
+ * You may obtain a copy of the License at
456
+ *
457
+ * http://www.apache.org/licenses/LICENSE-2.0
458
+ *
459
+ * Unless required by applicable law or agreed to in writing, software
460
+ * distributed under the License is distributed on an "AS IS" BASIS,
461
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
462
+ * See the License for the specific language governing permissions and
463
+ * limitations under the License.
464
+ */
465
+ class _o {
466
+ constructor(t, n, o, s, l, c, p, _, y, R, A, N = !0) {
467
+ this.url_ = t, this.method_ = n, this.headers_ = o, this.body_ = s, this.successCodes_ = l, this.additionalRetryCodes_ = c, this.callback_ = p, this.errorCallback_ = _, this.timeout_ = y, this.progressCallback_ = R, this.connectionFactory_ = A, this.retry = N, this.pendingConnection_ = null, this.backoffId_ = null, this.canceled_ = !1, this.appDelete_ = !1, this.promise_ = new Promise((v, E) => {
468
+ this.resolve_ = v, this.reject_ = E, this.start_();
469
+ });
470
+ }
471
+ /**
472
+ * Actually starts the retry loop.
473
+ */
474
+ start_() {
475
+ const t = (o, s) => {
476
+ if (s) {
477
+ o(!1, new ct(!1, null, !0));
478
+ return;
479
+ }
480
+ const l = this.connectionFactory_();
481
+ this.pendingConnection_ = l;
482
+ const c = (p) => {
483
+ const _ = p.loaded, y = p.lengthComputable ? p.total : -1;
484
+ this.progressCallback_ !== null && this.progressCallback_(_, y);
485
+ };
486
+ this.progressCallback_ !== null && l.addUploadProgressListener(c), l.send(this.url_, this.method_, this.body_, this.headers_).then(() => {
487
+ this.progressCallback_ !== null && l.removeUploadProgressListener(c), this.pendingConnection_ = null;
488
+ const p = l.getErrorCode() === Ae.NO_ERROR, _ = l.getStatus();
489
+ if (!p || vo(_, this.additionalRetryCodes_) && this.retry) {
490
+ const R = l.getErrorCode() === Ae.ABORT;
491
+ o(!1, new ct(!1, null, R));
492
+ return;
493
+ }
494
+ const y = this.successCodes_.indexOf(_) !== -1;
495
+ o(!0, new ct(y, l));
496
+ });
497
+ }, n = (o, s) => {
498
+ const l = this.resolve_, c = this.reject_, p = s.connection;
499
+ if (s.wasSuccessCode)
500
+ try {
501
+ const _ = this.callback_(p, p.getResponse());
502
+ fo(_) ? l(_) : l();
503
+ } catch (_) {
504
+ c(_);
505
+ }
506
+ else if (p !== null) {
507
+ const _ = At();
508
+ _.serverResponse = p.getErrorText(), this.errorCallback_ ? c(this.errorCallback_(p, _)) : c(_);
509
+ } else if (s.canceled) {
510
+ const _ = this.appDelete_ ? mn() : no();
511
+ c(_);
512
+ } else {
513
+ const _ = to();
514
+ c(_);
515
+ }
516
+ };
517
+ this.canceled_ ? n(!1, new ct(!1, null, !0)) : this.backoffId_ = mo(t, n, this.timeout_);
518
+ }
519
+ /** @inheritDoc */
520
+ getPromise() {
521
+ return this.promise_;
522
+ }
523
+ /** @inheritDoc */
524
+ cancel(t) {
525
+ this.canceled_ = !0, this.appDelete_ = t || !1, this.backoffId_ !== null && po(this.backoffId_), this.pendingConnection_ !== null && this.pendingConnection_.abort();
526
+ }
527
+ }
528
+ class ct {
529
+ constructor(t, n, o) {
530
+ this.wasSuccessCode = t, this.connection = n, this.canceled = !!o;
531
+ }
532
+ }
533
+ function go(e, t) {
534
+ t !== null && t.length > 0 && (e.Authorization = "Firebase " + t);
535
+ }
536
+ function bo(e, t) {
537
+ e["X-Firebase-Storage-Version"] = "webjs/" + (t ?? "AppManager");
538
+ }
539
+ function yo(e, t) {
540
+ t && (e["X-Firebase-GMPID"] = t);
541
+ }
542
+ function To(e, t) {
543
+ t !== null && (e["X-Firebase-AppCheck"] = t);
544
+ }
545
+ function Io(e, t, n, o, s, l, c = !0) {
546
+ const p = pn(e.urlParams), _ = e.url + p, y = Object.assign({}, e.headers);
547
+ return yo(y, t), go(y, n), bo(y, l), To(y, o), new _o(_, e.method, y, e.body, e.successCodes, e.additionalRetryCodes, e.handler, e.errorHandler, e.timeout, e.progressCallback, s, c);
548
+ }
549
+ /**
550
+ * @license
551
+ * Copyright 2017 Google LLC
552
+ *
553
+ * Licensed under the Apache License, Version 2.0 (the "License");
554
+ * you may not use this file except in compliance with the License.
555
+ * You may obtain a copy of the License at
556
+ *
557
+ * http://www.apache.org/licenses/LICENSE-2.0
558
+ *
559
+ * Unless required by applicable law or agreed to in writing, software
560
+ * distributed under the License is distributed on an "AS IS" BASIS,
561
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
562
+ * See the License for the specific language governing permissions and
563
+ * limitations under the License.
564
+ */
565
+ function Eo() {
566
+ return typeof BlobBuilder < "u" ? BlobBuilder : typeof WebKitBlobBuilder < "u" ? WebKitBlobBuilder : void 0;
567
+ }
568
+ function wo(...e) {
569
+ const t = Eo();
570
+ if (t !== void 0) {
571
+ const n = new t();
572
+ for (let o = 0; o < e.length; o++)
573
+ n.append(e[o]);
574
+ return n.getBlob();
575
+ } else {
576
+ if (St())
577
+ return new Blob(e);
578
+ throw new H(q.UNSUPPORTED_ENVIRONMENT, "This browser doesn't seem to support creating Blobs");
579
+ }
580
+ }
581
+ function Fo(e, t, n) {
582
+ return e.webkitSlice ? e.webkitSlice(t, n) : e.mozSlice ? e.mozSlice(t, n) : e.slice ? e.slice(t, n) : null;
583
+ }
584
+ /**
585
+ * @license
586
+ * Copyright 2021 Google LLC
587
+ *
588
+ * Licensed under the Apache License, Version 2.0 (the "License");
589
+ * you may not use this file except in compliance with the License.
590
+ * You may obtain a copy of the License at
591
+ *
592
+ * http://www.apache.org/licenses/LICENSE-2.0
593
+ *
594
+ * Unless required by applicable law or agreed to in writing, software
595
+ * distributed under the License is distributed on an "AS IS" BASIS,
596
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
597
+ * See the License for the specific language governing permissions and
598
+ * limitations under the License.
599
+ */
600
+ function Co(e) {
601
+ if (typeof atob > "u")
602
+ throw ro("base-64");
603
+ return atob(e);
604
+ }
605
+ /**
606
+ * @license
607
+ * Copyright 2017 Google LLC
608
+ *
609
+ * Licensed under the Apache License, Version 2.0 (the "License");
610
+ * you may not use this file except in compliance with the License.
611
+ * You may obtain a copy of the License at
612
+ *
613
+ * http://www.apache.org/licenses/LICENSE-2.0
614
+ *
615
+ * Unless required by applicable law or agreed to in writing, software
616
+ * distributed under the License is distributed on an "AS IS" BASIS,
617
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
618
+ * See the License for the specific language governing permissions and
619
+ * limitations under the License.
620
+ */
621
+ const _e = {
622
+ /**
623
+ * Indicates the string should be interpreted "raw", that is, as normal text.
624
+ * The string will be interpreted as UTF-16, then uploaded as a UTF-8 byte
625
+ * sequence.
626
+ * Example: The string 'Hello! \\ud83d\\ude0a' becomes the byte sequence
627
+ * 48 65 6c 6c 6f 21 20 f0 9f 98 8a
628
+ */
629
+ RAW: "raw",
630
+ /**
631
+ * Indicates the string should be interpreted as base64-encoded data.
632
+ * Padding characters (trailing '='s) are optional.
633
+ * Example: The string 'rWmO++E6t7/rlw==' becomes the byte sequence
634
+ * ad 69 8e fb e1 3a b7 bf eb 97
635
+ */
636
+ BASE64: "base64",
637
+ /**
638
+ * Indicates the string should be interpreted as base64url-encoded data.
639
+ * Padding characters (trailing '='s) are optional.
640
+ * Example: The string 'rWmO--E6t7_rlw==' becomes the byte sequence
641
+ * ad 69 8e fb e1 3a b7 bf eb 97
642
+ */
643
+ BASE64URL: "base64url",
644
+ /**
645
+ * Indicates the string is a data URL, such as one obtained from
646
+ * canvas.toDataURL().
647
+ * Example: the string 'data:application/octet-stream;base64,aaaa'
648
+ * becomes the byte sequence
649
+ * 69 a6 9a
650
+ * (the content-type "application/octet-stream" is also applied, but can
651
+ * be overridden in the metadata object).
652
+ */
653
+ DATA_URL: "data_url"
654
+ };
655
+ class Et {
656
+ constructor(t, n) {
657
+ this.data = t, this.contentType = n || null;
658
+ }
659
+ }
660
+ function ko(e, t) {
661
+ switch (e) {
662
+ case _e.RAW:
663
+ return new Et(fn(t));
664
+ case _e.BASE64:
665
+ case _e.BASE64URL:
666
+ return new Et(hn(e, t));
667
+ case _e.DATA_URL:
668
+ return new Et(Do(t), Oo(t));
669
+ }
670
+ throw At();
671
+ }
672
+ function fn(e) {
673
+ const t = [];
674
+ for (let n = 0; n < e.length; n++) {
675
+ let o = e.charCodeAt(n);
676
+ if (o <= 127)
677
+ t.push(o);
678
+ else if (o <= 2047)
679
+ t.push(192 | o >> 6, 128 | o & 63);
680
+ else if ((o & 64512) === 55296)
681
+ if (!(n < e.length - 1 && (e.charCodeAt(n + 1) & 64512) === 56320))
682
+ t.push(239, 191, 189);
683
+ else {
684
+ const l = o, c = e.charCodeAt(++n);
685
+ o = 65536 | (l & 1023) << 10 | c & 1023, t.push(240 | o >> 18, 128 | o >> 12 & 63, 128 | o >> 6 & 63, 128 | o & 63);
686
+ }
687
+ else
688
+ (o & 64512) === 56320 ? t.push(239, 191, 189) : t.push(224 | o >> 12, 128 | o >> 6 & 63, 128 | o & 63);
689
+ }
690
+ return new Uint8Array(t);
691
+ }
692
+ function Ro(e) {
693
+ let t;
694
+ try {
695
+ t = decodeURIComponent(e);
696
+ } catch {
697
+ throw et(_e.DATA_URL, "Malformed data URL.");
698
+ }
699
+ return fn(t);
700
+ }
701
+ function hn(e, t) {
702
+ switch (e) {
703
+ case _e.BASE64: {
704
+ const s = t.indexOf("-") !== -1, l = t.indexOf("_") !== -1;
705
+ if (s || l)
706
+ throw et(e, "Invalid character '" + (s ? "-" : "_") + "' found: is it base64url encoded?");
707
+ break;
708
+ }
709
+ case _e.BASE64URL: {
710
+ const s = t.indexOf("+") !== -1, l = t.indexOf("/") !== -1;
711
+ if (s || l)
712
+ throw et(e, "Invalid character '" + (s ? "+" : "/") + "' found: is it base64 encoded?");
713
+ t = t.replace(/-/g, "+").replace(/_/g, "/");
714
+ break;
715
+ }
716
+ }
717
+ let n;
718
+ try {
719
+ n = Co(t);
720
+ } catch (s) {
721
+ throw s.message.includes("polyfill") ? s : et(e, "Invalid character found");
722
+ }
723
+ const o = new Uint8Array(n.length);
724
+ for (let s = 0; s < n.length; s++)
725
+ o[s] = n.charCodeAt(s);
726
+ return o;
727
+ }
728
+ class vn {
729
+ constructor(t) {
730
+ this.base64 = !1, this.contentType = null;
731
+ const n = t.match(/^data:([^,]+)?,/);
732
+ if (n === null)
733
+ throw et(_e.DATA_URL, "Must be formatted 'data:[<mediatype>][;base64],<data>");
734
+ const o = n[1] || null;
735
+ o != null && (this.base64 = Ao(o, ";base64"), this.contentType = this.base64 ? o.substring(0, o.length - 7) : o), this.rest = t.substring(t.indexOf(",") + 1);
736
+ }
737
+ }
738
+ function Do(e) {
739
+ const t = new vn(e);
740
+ return t.base64 ? hn(_e.BASE64, t.rest) : Ro(t.rest);
741
+ }
742
+ function Oo(e) {
743
+ return new vn(e).contentType;
744
+ }
745
+ function Ao(e, t) {
746
+ return e.length >= t.length ? e.substring(e.length - t.length) === t : !1;
747
+ }
748
+ /**
749
+ * @license
750
+ * Copyright 2017 Google LLC
751
+ *
752
+ * Licensed under the Apache License, Version 2.0 (the "License");
753
+ * you may not use this file except in compliance with the License.
754
+ * You may obtain a copy of the License at
755
+ *
756
+ * http://www.apache.org/licenses/LICENSE-2.0
757
+ *
758
+ * Unless required by applicable law or agreed to in writing, software
759
+ * distributed under the License is distributed on an "AS IS" BASIS,
760
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
761
+ * See the License for the specific language governing permissions and
762
+ * limitations under the License.
763
+ */
764
+ class ke {
765
+ constructor(t, n) {
766
+ let o = 0, s = "";
767
+ Wt(t) ? (this.data_ = t, o = t.size, s = t.type) : t instanceof ArrayBuffer ? (n ? this.data_ = new Uint8Array(t) : (this.data_ = new Uint8Array(t.byteLength), this.data_.set(new Uint8Array(t))), o = this.data_.length) : t instanceof Uint8Array && (n ? this.data_ = t : (this.data_ = new Uint8Array(t.length), this.data_.set(t)), o = t.length), this.size_ = o, this.type_ = s;
768
+ }
769
+ size() {
770
+ return this.size_;
771
+ }
772
+ type() {
773
+ return this.type_;
774
+ }
775
+ slice(t, n) {
776
+ if (Wt(this.data_)) {
777
+ const o = this.data_, s = Fo(o, t, n);
778
+ return s === null ? null : new ke(s);
779
+ } else {
780
+ const o = new Uint8Array(this.data_.buffer, t, n - t);
781
+ return new ke(o, !0);
782
+ }
783
+ }
784
+ static getBlob(...t) {
785
+ if (St()) {
786
+ const n = t.map((o) => o instanceof ke ? o.data_ : o);
787
+ return new ke(wo.apply(null, n));
788
+ } else {
789
+ const n = t.map((c) => zt(c) ? ko(_e.RAW, c).data : c.data_);
790
+ let o = 0;
791
+ n.forEach((c) => {
792
+ o += c.byteLength;
793
+ });
794
+ const s = new Uint8Array(o);
795
+ let l = 0;
796
+ return n.forEach((c) => {
797
+ for (let p = 0; p < c.length; p++)
798
+ s[l++] = c[p];
799
+ }), new ke(s, !0);
800
+ }
801
+ }
802
+ uploadData() {
803
+ return this.data_;
804
+ }
805
+ }
806
+ /**
807
+ * @license
808
+ * Copyright 2017 Google LLC
809
+ *
810
+ * Licensed under the Apache License, Version 2.0 (the "License");
811
+ * you may not use this file except in compliance with the License.
812
+ * You may obtain a copy of the License at
813
+ *
814
+ * http://www.apache.org/licenses/LICENSE-2.0
815
+ *
816
+ * Unless required by applicable law or agreed to in writing, software
817
+ * distributed under the License is distributed on an "AS IS" BASIS,
818
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
819
+ * See the License for the specific language governing permissions and
820
+ * limitations under the License.
821
+ */
822
+ function _n(e) {
823
+ let t;
824
+ try {
825
+ t = JSON.parse(e);
826
+ } catch {
827
+ return null;
828
+ }
829
+ return ho(t) ? t : null;
830
+ }
831
+ /**
832
+ * @license
833
+ * Copyright 2017 Google LLC
834
+ *
835
+ * Licensed under the Apache License, Version 2.0 (the "License");
836
+ * you may not use this file except in compliance with the License.
837
+ * You may obtain a copy of the License at
838
+ *
839
+ * http://www.apache.org/licenses/LICENSE-2.0
840
+ *
841
+ * Unless required by applicable law or agreed to in writing, software
842
+ * distributed under the License is distributed on an "AS IS" BASIS,
843
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
844
+ * See the License for the specific language governing permissions and
845
+ * limitations under the License.
846
+ */
847
+ function zo(e) {
848
+ if (e.length === 0)
849
+ return null;
850
+ const t = e.lastIndexOf("/");
851
+ return t === -1 ? "" : e.slice(0, t);
852
+ }
853
+ function So(e, t) {
854
+ const n = t.split("/").filter((o) => o.length > 0).join("/");
855
+ return e.length === 0 ? n : e + "/" + n;
856
+ }
857
+ function gn(e) {
858
+ const t = e.lastIndexOf("/", e.length - 2);
859
+ return t === -1 ? e : e.slice(t + 1);
860
+ }
861
+ /**
862
+ * @license
863
+ * Copyright 2017 Google LLC
864
+ *
865
+ * Licensed under the Apache License, Version 2.0 (the "License");
866
+ * you may not use this file except in compliance with the License.
867
+ * You may obtain a copy of the License at
868
+ *
869
+ * http://www.apache.org/licenses/LICENSE-2.0
870
+ *
871
+ * Unless required by applicable law or agreed to in writing, software
872
+ * distributed under the License is distributed on an "AS IS" BASIS,
873
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
874
+ * See the License for the specific language governing permissions and
875
+ * limitations under the License.
876
+ */
877
+ function No(e, t) {
878
+ return t;
879
+ }
880
+ class se {
881
+ constructor(t, n, o, s) {
882
+ this.server = t, this.local = n || t, this.writable = !!o, this.xform = s || No;
883
+ }
884
+ }
885
+ let ut = null;
886
+ function Po(e) {
887
+ return !zt(e) || e.length < 2 ? e : gn(e);
888
+ }
889
+ function bn() {
890
+ if (ut)
891
+ return ut;
892
+ const e = [];
893
+ e.push(new se("bucket")), e.push(new se("generation")), e.push(new se("metageneration")), e.push(new se("name", "fullPath", !0));
894
+ function t(l, c) {
895
+ return Po(c);
896
+ }
897
+ const n = new se("name");
898
+ n.xform = t, e.push(n);
899
+ function o(l, c) {
900
+ return c !== void 0 ? Number(c) : c;
901
+ }
902
+ const s = new se("size");
903
+ return s.xform = o, e.push(s), e.push(new se("timeCreated")), e.push(new se("updated")), e.push(new se("md5Hash", null, !0)), e.push(new se("cacheControl", null, !0)), e.push(new se("contentDisposition", null, !0)), e.push(new se("contentEncoding", null, !0)), e.push(new se("contentLanguage", null, !0)), e.push(new se("contentType", null, !0)), e.push(new se("metadata", "customMetadata", !0)), ut = e, ut;
904
+ }
905
+ function xo(e, t) {
906
+ function n() {
907
+ const o = e.bucket, s = e.fullPath, l = new re(o, s);
908
+ return t._makeStorageReference(l);
909
+ }
910
+ Object.defineProperty(e, "ref", { get: n });
911
+ }
912
+ function Lo(e, t, n) {
913
+ const o = {};
914
+ o.type = "file";
915
+ const s = n.length;
916
+ for (let l = 0; l < s; l++) {
917
+ const c = n[l];
918
+ o[c.local] = c.xform(o, t[c.server]);
919
+ }
920
+ return xo(o, e), o;
921
+ }
922
+ function yn(e, t, n) {
923
+ const o = _n(t);
924
+ return o === null ? null : Lo(e, o, n);
925
+ }
926
+ function Uo(e, t, n, o) {
927
+ const s = _n(t);
928
+ if (s === null || !zt(s.downloadTokens))
929
+ return null;
930
+ const l = s.downloadTokens;
931
+ if (l.length === 0)
932
+ return null;
933
+ const c = encodeURIComponent;
934
+ return l.split(",").map((y) => {
935
+ const R = e.bucket, A = e.fullPath, N = "/b/" + c(R) + "/o/" + c(A), v = ht(N, n, o), E = pn({
936
+ alt: "media",
937
+ token: y
938
+ });
939
+ return v + E;
940
+ })[0];
941
+ }
942
+ function Mo(e, t) {
943
+ const n = {}, o = t.length;
944
+ for (let s = 0; s < o; s++) {
945
+ const l = t[s];
946
+ l.writable && (n[l.server] = e[l.local]);
947
+ }
948
+ return JSON.stringify(n);
949
+ }
950
+ class Nt {
951
+ constructor(t, n, o, s) {
952
+ this.url = t, this.method = n, this.handler = o, this.timeout = s, this.urlParams = {}, this.headers = {}, this.body = null, this.errorHandler = null, this.progressCallback = null, this.successCodes = [200], this.additionalRetryCodes = [];
953
+ }
954
+ }
955
+ /**
956
+ * @license
957
+ * Copyright 2017 Google LLC
958
+ *
959
+ * Licensed under the Apache License, Version 2.0 (the "License");
960
+ * you may not use this file except in compliance with the License.
961
+ * You may obtain a copy of the License at
962
+ *
963
+ * http://www.apache.org/licenses/LICENSE-2.0
964
+ *
965
+ * Unless required by applicable law or agreed to in writing, software
966
+ * distributed under the License is distributed on an "AS IS" BASIS,
967
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
968
+ * See the License for the specific language governing permissions and
969
+ * limitations under the License.
970
+ */
971
+ function Tn(e) {
972
+ if (!e)
973
+ throw At();
974
+ }
975
+ function Bo(e, t) {
976
+ function n(o, s) {
977
+ const l = yn(e, s, t);
978
+ return Tn(l !== null), l;
979
+ }
980
+ return n;
981
+ }
982
+ function Vo(e, t) {
983
+ function n(o, s) {
984
+ const l = yn(e, s, t);
985
+ return Tn(l !== null), Uo(l, s, e.host, e._protocol);
986
+ }
987
+ return n;
988
+ }
989
+ function In(e) {
990
+ function t(n, o) {
991
+ let s;
992
+ return n.getStatus() === 401 ? /* This exact message string is the only consistent part of the */ /* server's error response that identifies it as an App Check error. */ n.getErrorText().includes("Firebase App Check token is invalid") ? s = Jn() : s = Qn() : n.getStatus() === 402 ? s = Zn(e.bucket) : n.getStatus() === 403 ? s = eo(e.path) : s = o, s.status = n.getStatus(), s.serverResponse = o.serverResponse, s;
993
+ }
994
+ return t;
995
+ }
996
+ function En(e) {
997
+ const t = In(e);
998
+ function n(o, s) {
999
+ let l = t(o, s);
1000
+ return o.getStatus() === 404 && (l = Xn(e.path)), l.serverResponse = s.serverResponse, l;
1001
+ }
1002
+ return n;
1003
+ }
1004
+ function $o(e, t, n) {
1005
+ const o = t.fullServerUrl(), s = ht(o, e.host, e._protocol), l = "GET", c = e.maxOperationRetryTime, p = new Nt(s, l, Vo(e, n), c);
1006
+ return p.errorHandler = En(t), p;
1007
+ }
1008
+ function jo(e, t) {
1009
+ const n = t.fullServerUrl(), o = ht(n, e.host, e._protocol), s = "DELETE", l = e.maxOperationRetryTime;
1010
+ function c(_, y) {
1011
+ }
1012
+ const p = new Nt(o, s, c, l);
1013
+ return p.successCodes = [200, 204], p.errorHandler = En(t), p;
1014
+ }
1015
+ function qo(e, t) {
1016
+ return e && e.contentType || t && t.type() || "application/octet-stream";
1017
+ }
1018
+ function Ho(e, t, n) {
1019
+ const o = Object.assign({}, n);
1020
+ return o.fullPath = e.path, o.size = t.size(), o.contentType || (o.contentType = qo(null, t)), o;
1021
+ }
1022
+ function Go(e, t, n, o, s) {
1023
+ const l = t.bucketOnlyServerUrl(), c = {
1024
+ "X-Goog-Upload-Protocol": "multipart"
1025
+ };
1026
+ function p() {
1027
+ let O = "";
1028
+ for (let w = 0; w < 2; w++)
1029
+ O = O + Math.random().toString().slice(2);
1030
+ return O;
1031
+ }
1032
+ const _ = p();
1033
+ c["Content-Type"] = "multipart/related; boundary=" + _;
1034
+ const y = Ho(t, o, s), R = Mo(y, n), A = "--" + _ + `\r
1035
+ Content-Type: application/json; charset=utf-8\r
1036
+ \r
1037
+ ` + R + `\r
1038
+ --` + _ + `\r
1039
+ Content-Type: ` + y.contentType + `\r
1040
+ \r
1041
+ `, N = `\r
1042
+ --` + _ + "--", v = ke.getBlob(A, o, N);
1043
+ if (v === null)
1044
+ throw ao();
1045
+ const E = { name: y.fullPath }, z = ht(l, e.host, e._protocol), x = "POST", V = e.maxUploadRetryTime, $ = new Nt(z, x, Bo(e, n), V);
1046
+ return $.urlParams = E, $.headers = c, $.body = v.uploadData(), $.errorHandler = In(t), $;
1047
+ }
1048
+ class Wo {
1049
+ constructor() {
1050
+ this.sent_ = !1, this.xhr_ = new XMLHttpRequest(), this.initXhr(), this.errorCode_ = Ae.NO_ERROR, this.sendPromise_ = new Promise((t) => {
1051
+ this.xhr_.addEventListener("abort", () => {
1052
+ this.errorCode_ = Ae.ABORT, t();
1053
+ }), this.xhr_.addEventListener("error", () => {
1054
+ this.errorCode_ = Ae.NETWORK_ERROR, t();
1055
+ }), this.xhr_.addEventListener("load", () => {
1056
+ t();
1057
+ });
1058
+ });
1059
+ }
1060
+ send(t, n, o, s) {
1061
+ if (this.sent_)
1062
+ throw Je("cannot .send() more than once");
1063
+ if (this.sent_ = !0, this.xhr_.open(n, t, !0), s !== void 0)
1064
+ for (const l in s)
1065
+ s.hasOwnProperty(l) && this.xhr_.setRequestHeader(l, s[l].toString());
1066
+ return o !== void 0 ? this.xhr_.send(o) : this.xhr_.send(), this.sendPromise_;
1067
+ }
1068
+ getErrorCode() {
1069
+ if (!this.sent_)
1070
+ throw Je("cannot .getErrorCode() before sending");
1071
+ return this.errorCode_;
1072
+ }
1073
+ getStatus() {
1074
+ if (!this.sent_)
1075
+ throw Je("cannot .getStatus() before sending");
1076
+ try {
1077
+ return this.xhr_.status;
1078
+ } catch {
1079
+ return -1;
1080
+ }
1081
+ }
1082
+ getResponse() {
1083
+ if (!this.sent_)
1084
+ throw Je("cannot .getResponse() before sending");
1085
+ return this.xhr_.response;
1086
+ }
1087
+ getErrorText() {
1088
+ if (!this.sent_)
1089
+ throw Je("cannot .getErrorText() before sending");
1090
+ return this.xhr_.statusText;
1091
+ }
1092
+ /** Aborts the request. */
1093
+ abort() {
1094
+ this.xhr_.abort();
1095
+ }
1096
+ getResponseHeader(t) {
1097
+ return this.xhr_.getResponseHeader(t);
1098
+ }
1099
+ addUploadProgressListener(t) {
1100
+ this.xhr_.upload != null && this.xhr_.upload.addEventListener("progress", t);
1101
+ }
1102
+ removeUploadProgressListener(t) {
1103
+ this.xhr_.upload != null && this.xhr_.upload.removeEventListener("progress", t);
1104
+ }
1105
+ }
1106
+ class Yo extends Wo {
1107
+ initXhr() {
1108
+ this.xhr_.responseType = "text";
1109
+ }
1110
+ }
1111
+ function Pt() {
1112
+ return new Yo();
1113
+ }
1114
+ /**
1115
+ * @license
1116
+ * Copyright 2019 Google LLC
1117
+ *
1118
+ * Licensed under the Apache License, Version 2.0 (the "License");
1119
+ * you may not use this file except in compliance with the License.
1120
+ * You may obtain a copy of the License at
1121
+ *
1122
+ * http://www.apache.org/licenses/LICENSE-2.0
1123
+ *
1124
+ * Unless required by applicable law or agreed to in writing, software
1125
+ * distributed under the License is distributed on an "AS IS" BASIS,
1126
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1127
+ * See the License for the specific language governing permissions and
1128
+ * limitations under the License.
1129
+ */
1130
+ class ze {
1131
+ constructor(t, n) {
1132
+ this._service = t, n instanceof re ? this._location = n : this._location = re.makeFromUrl(n, t.host);
1133
+ }
1134
+ /**
1135
+ * Returns the URL for the bucket and path this object references,
1136
+ * in the form gs://<bucket>/<object-path>
1137
+ * @override
1138
+ */
1139
+ toString() {
1140
+ return "gs://" + this._location.bucket + "/" + this._location.path;
1141
+ }
1142
+ _newRef(t, n) {
1143
+ return new ze(t, n);
1144
+ }
1145
+ /**
1146
+ * A reference to the root of this object's bucket.
1147
+ */
1148
+ get root() {
1149
+ const t = new re(this._location.bucket, "");
1150
+ return this._newRef(this._service, t);
1151
+ }
1152
+ /**
1153
+ * The name of the bucket containing this reference's object.
1154
+ */
1155
+ get bucket() {
1156
+ return this._location.bucket;
1157
+ }
1158
+ /**
1159
+ * The full path of this object.
1160
+ */
1161
+ get fullPath() {
1162
+ return this._location.path;
1163
+ }
1164
+ /**
1165
+ * The short name of this object, which is the last component of the full path.
1166
+ * For example, if fullPath is 'full/path/image.png', name is 'image.png'.
1167
+ */
1168
+ get name() {
1169
+ return gn(this._location.path);
1170
+ }
1171
+ /**
1172
+ * The `StorageService` instance this `StorageReference` is associated with.
1173
+ */
1174
+ get storage() {
1175
+ return this._service;
1176
+ }
1177
+ /**
1178
+ * A `StorageReference` pointing to the parent location of this `StorageReference`, or null if
1179
+ * this reference is the root.
1180
+ */
1181
+ get parent() {
1182
+ const t = zo(this._location.path);
1183
+ if (t === null)
1184
+ return null;
1185
+ const n = new re(this._location.bucket, t);
1186
+ return new ze(this._service, n);
1187
+ }
1188
+ /**
1189
+ * Utility function to throw an error in methods that do not accept a root reference.
1190
+ */
1191
+ _throwIfRoot(t) {
1192
+ if (this._location.path === "")
1193
+ throw co(t);
1194
+ }
1195
+ }
1196
+ function Ko(e, t, n) {
1197
+ e._throwIfRoot("uploadBytes");
1198
+ const o = Go(e.storage, e._location, bn(), new ke(t, !0), n);
1199
+ return e.storage.makeRequestWithTokens(o, Pt).then((s) => ({
1200
+ metadata: s,
1201
+ ref: e
1202
+ }));
1203
+ }
1204
+ function Xo(e) {
1205
+ e._throwIfRoot("getDownloadURL");
1206
+ const t = $o(e.storage, e._location, bn());
1207
+ return e.storage.makeRequestWithTokens(t, Pt).then((n) => {
1208
+ if (n === null)
1209
+ throw lo();
1210
+ return n;
1211
+ });
1212
+ }
1213
+ function Zo(e) {
1214
+ e._throwIfRoot("deleteObject");
1215
+ const t = jo(e.storage, e._location);
1216
+ return e.storage.makeRequestWithTokens(t, Pt);
1217
+ }
1218
+ function Qo(e, t) {
1219
+ const n = So(e._location.path, t), o = new re(e._location.bucket, n);
1220
+ return new ze(e.storage, o);
1221
+ }
1222
+ /**
1223
+ * @license
1224
+ * Copyright 2017 Google LLC
1225
+ *
1226
+ * Licensed under the Apache License, Version 2.0 (the "License");
1227
+ * you may not use this file except in compliance with the License.
1228
+ * You may obtain a copy of the License at
1229
+ *
1230
+ * http://www.apache.org/licenses/LICENSE-2.0
1231
+ *
1232
+ * Unless required by applicable law or agreed to in writing, software
1233
+ * distributed under the License is distributed on an "AS IS" BASIS,
1234
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1235
+ * See the License for the specific language governing permissions and
1236
+ * limitations under the License.
1237
+ */
1238
+ function Jo(e) {
1239
+ return /^[A-Za-z]+:\/\//.test(e);
1240
+ }
1241
+ function es(e, t) {
1242
+ return new ze(e, t);
1243
+ }
1244
+ function wn(e, t) {
1245
+ if (e instanceof xt) {
1246
+ const n = e;
1247
+ if (n._bucket == null)
1248
+ throw io();
1249
+ const o = new ze(n, n._bucket);
1250
+ return t != null ? wn(o, t) : o;
1251
+ } else
1252
+ return t !== void 0 ? Qo(e, t) : e;
1253
+ }
1254
+ function ts(e, t) {
1255
+ if (t && Jo(t)) {
1256
+ if (e instanceof xt)
1257
+ return es(e, t);
1258
+ throw kt("To use ref(service, url), the first argument must be a Storage instance.");
1259
+ } else
1260
+ return wn(e, t);
1261
+ }
1262
+ function Kt(e, t) {
1263
+ const n = t == null ? void 0 : t[dn];
1264
+ return n == null ? null : re.makeFromBucketSpec(n, e);
1265
+ }
1266
+ function ns(e, t, n, o = {}) {
1267
+ e.host = `${t}:${n}`, e._protocol = "http";
1268
+ const { mockUserToken: s } = o;
1269
+ s && (e._overrideAuthToken = typeof s == "string" ? s : Un(s, e.app.options.projectId));
1270
+ }
1271
+ class xt {
1272
+ constructor(t, n, o, s, l) {
1273
+ this.app = t, this._authProvider = n, this._appCheckProvider = o, this._url = s, this._firebaseVersion = l, this._bucket = null, this._host = un, this._protocol = "https", this._appId = null, this._deleted = !1, this._maxOperationRetryTime = Yn, this._maxUploadRetryTime = Kn, this._requests = /* @__PURE__ */ new Set(), s != null ? this._bucket = re.makeFromBucketSpec(s, this._host) : this._bucket = Kt(this._host, this.app.options);
1274
+ }
1275
+ /**
1276
+ * The host string for this service, in the form of `host` or
1277
+ * `host:port`.
1278
+ */
1279
+ get host() {
1280
+ return this._host;
1281
+ }
1282
+ set host(t) {
1283
+ this._host = t, this._url != null ? this._bucket = re.makeFromBucketSpec(this._url, t) : this._bucket = Kt(t, this.app.options);
1284
+ }
1285
+ /**
1286
+ * The maximum time to retry uploads in milliseconds.
1287
+ */
1288
+ get maxUploadRetryTime() {
1289
+ return this._maxUploadRetryTime;
1290
+ }
1291
+ set maxUploadRetryTime(t) {
1292
+ Yt(
1293
+ "time",
1294
+ /* minValue=*/
1295
+ 0,
1296
+ /* maxValue= */
1297
+ Number.POSITIVE_INFINITY,
1298
+ t
1299
+ ), this._maxUploadRetryTime = t;
1300
+ }
1301
+ /**
1302
+ * The maximum time to retry operations other than uploads or downloads in
1303
+ * milliseconds.
1304
+ */
1305
+ get maxOperationRetryTime() {
1306
+ return this._maxOperationRetryTime;
1307
+ }
1308
+ set maxOperationRetryTime(t) {
1309
+ Yt(
1310
+ "time",
1311
+ /* minValue=*/
1312
+ 0,
1313
+ /* maxValue= */
1314
+ Number.POSITIVE_INFINITY,
1315
+ t
1316
+ ), this._maxOperationRetryTime = t;
1317
+ }
1318
+ async _getAuthToken() {
1319
+ if (this._overrideAuthToken)
1320
+ return this._overrideAuthToken;
1321
+ const t = this._authProvider.getImmediate({ optional: !0 });
1322
+ if (t) {
1323
+ const n = await t.getToken();
1324
+ if (n !== null)
1325
+ return n.accessToken;
1326
+ }
1327
+ return null;
1328
+ }
1329
+ async _getAppCheckToken() {
1330
+ const t = this._appCheckProvider.getImmediate({ optional: !0 });
1331
+ return t ? (await t.getToken()).token : null;
1332
+ }
1333
+ /**
1334
+ * Stop running requests and prevent more from being created.
1335
+ */
1336
+ _delete() {
1337
+ return this._deleted || (this._deleted = !0, this._requests.forEach((t) => t.cancel()), this._requests.clear()), Promise.resolve();
1338
+ }
1339
+ /**
1340
+ * Returns a new firebaseStorage.Reference object referencing this StorageService
1341
+ * at the given Location.
1342
+ */
1343
+ _makeStorageReference(t) {
1344
+ return new ze(this, t);
1345
+ }
1346
+ /**
1347
+ * @param requestInfo - HTTP RequestInfo object
1348
+ * @param authToken - Firebase auth token
1349
+ */
1350
+ _makeRequest(t, n, o, s, l = !0) {
1351
+ if (this._deleted)
1352
+ return new uo(mn());
1353
+ {
1354
+ const c = Io(t, this._appId, o, s, n, this._firebaseVersion, l);
1355
+ return this._requests.add(c), c.getPromise().then(() => this._requests.delete(c), () => this._requests.delete(c)), c;
1356
+ }
1357
+ }
1358
+ async makeRequestWithTokens(t, n) {
1359
+ const [o, s] = await Promise.all([
1360
+ this._getAuthToken(),
1361
+ this._getAppCheckToken()
1362
+ ]);
1363
+ return this._makeRequest(t, n, o, s).getPromise();
1364
+ }
1365
+ }
1366
+ const Xt = "@firebase/storage", Zt = "0.12.5";
1367
+ /**
1368
+ * @license
1369
+ * Copyright 2020 Google LLC
1370
+ *
1371
+ * Licensed under the Apache License, Version 2.0 (the "License");
1372
+ * you may not use this file except in compliance with the License.
1373
+ * You may obtain a copy of the License at
1374
+ *
1375
+ * http://www.apache.org/licenses/LICENSE-2.0
1376
+ *
1377
+ * Unless required by applicable law or agreed to in writing, software
1378
+ * distributed under the License is distributed on an "AS IS" BASIS,
1379
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1380
+ * See the License for the specific language governing permissions and
1381
+ * limitations under the License.
1382
+ */
1383
+ const Fn = "storage";
1384
+ function os(e, t, n) {
1385
+ return e = tt(e), Ko(e, t, n);
1386
+ }
1387
+ function ss(e) {
1388
+ return e = tt(e), Xo(e);
1389
+ }
1390
+ function is(e) {
1391
+ return e = tt(e), Zo(e);
1392
+ }
1393
+ function Qt(e, t) {
1394
+ return e = tt(e), ts(e, t);
1395
+ }
1396
+ function Jt(e = xn(), t) {
1397
+ e = tt(e);
1398
+ const o = Nn(e, Fn).getImmediate({
1399
+ identifier: t
1400
+ }), s = Pn("storage");
1401
+ return s && as(o, ...s), o;
1402
+ }
1403
+ function as(e, t, n, o = {}) {
1404
+ ns(e, t, n, o);
1405
+ }
1406
+ function ls(e, { instanceIdentifier: t }) {
1407
+ const n = e.getProvider("app").getImmediate(), o = e.getProvider("auth-internal"), s = e.getProvider("app-check-internal");
1408
+ return new xt(n, o, s, t, Ln);
1409
+ }
1410
+ function rs() {
1411
+ zn(new Sn(
1412
+ Fn,
1413
+ ls,
1414
+ "PUBLIC"
1415
+ /* ComponentType.PUBLIC */
1416
+ ).setMultipleInstances(!0)), Gt(Xt, Zt, ""), Gt(Xt, Zt, "esm2017");
1417
+ }
1418
+ rs();
1419
+ const en = {
1420
+ async update(e, t) {
1421
+ const n = Jt(), o = Qt(n, e);
1422
+ return await os(o, t), await ss(o);
1423
+ },
1424
+ async delete(e) {
1425
+ const t = Jt(), n = Qt(t, e);
1426
+ await is(n);
1427
+ }
1428
+ }, cs = { class: "w-full flex flex-col gap-5" }, us = { class: "flex flex-col gap-4" }, ds = { class: "fm-typo-en-body-lg-400" }, ms = { class: "fm-typo-en-body-lg-600" }, ps = { class: "flex flex-col gap-4" }, fs = { class: "fm-typo-en-body-lg-400" }, hs = { class: "fm-typo-en-body-lg-600" }, vs = { class: "flex flex-col gap-4" }, _s = { class: "fm-typo-en-body-lg-400" }, gs = { class: "fm-typo-en-body-lg-600" }, bs = { class: "flex flex-col gap-4" }, ys = { class: "fm-typo-en-body-lg-400" }, Ts = { class: "fm-typo-en-body-lg-600" }, Is = { class: "flex flex-col gap-4" }, Es = { class: "fm-typo-en-body-lg-400" }, ws = { class: "flex flex-row items-center gap-1" }, Fs = { class: "fm-typo-en-body-lg-600" }, Cs = {
1429
+ key: 0,
1430
+ class: "flex flex-col gap-4"
1431
+ }, ks = { class: "fm-typo-en-body-lg-400" }, Rs = { class: "fm-typo-en-body-lg-600" }, Ds = {
1432
+ key: 1,
1433
+ class: "flex flex-col gap-4"
1434
+ }, Os = { class: "fm-typo-en-body-lg-400" }, As = { class: "fm-typo-en-body-lg-600" }, zs = {
1435
+ key: 2,
1436
+ class: "flex flex-col gap-4"
1437
+ }, Ss = { class: "fm-typo-en-body-lg-400" }, Ns = { class: "fm-typo-en-body-lg-600" }, Ps = {
1438
+ key: 3,
1439
+ class: "flex flex-col gap-4"
1440
+ }, xs = { class: "fm-typo-en-body-lg-400" }, Ls = { class: "fm-typo-en-body-lg-600" }, Us = {
1441
+ key: 4,
1442
+ class: "flex flex-col gap-4"
1443
+ }, Ms = { class: "fm-typo-en-body-lg-400" }, Bs = { class: "fm-typo-en-body-lg-600" }, Vs = { class: "flex flex-col gap-4" }, $s = {
1444
+ key: 0,
1445
+ class: "fm-typo-en-body-lg-400"
1446
+ }, js = { class: "fm-typo-en-body-lg-600" }, qs = {
1447
+ key: 0,
1448
+ class: "flex flex-col gap-4"
1449
+ }, Hs = { class: "fm-typo-en-body-lg-400" }, Gs = { class: "fm-typo-en-body-lg-600" }, Ws = {
1450
+ key: 1,
1451
+ class: "flex flex-col gap-4"
1452
+ }, Ys = { class: "fm-typo-en-body-lg-400" }, Ks = { class: "fm-typo-en-body-lg-600 break-words" }, Xs = {
1453
+ key: 2,
1454
+ class: "flex flex-col gap-4"
1455
+ }, Zs = { class: "fm-typo-en-body-lg-400" }, Qs = { class: "fm-typo-en-body-lg-600" }, Js = {
1456
+ key: 3,
1457
+ class: "flex flex-col gap-4"
1458
+ }, ei = { class: "fm-typo-en-body-lg-400" }, ti = { class: "fm-typo-en-body-lg-600" }, ni = {
1459
+ key: 4,
1460
+ class: "flex flex-col gap-4"
1461
+ }, oi = { class: "fm-typo-en-body-lg-400" }, si = { class: "fm-typo-en-body-lg-600" }, ii = {
1462
+ key: 0,
1463
+ class: "flex flex-col gap-4"
1464
+ }, ai = { class: "fm-typo-en-body-lg-400" }, li = { class: "fm-typo-en-body-lg-600 break-words" }, ri = {
1465
+ key: 0,
1466
+ class: "flex flex-col gap-4"
1467
+ }, ci = { class: "fm-typo-en-body-lg-400" }, ui = { class: "fm-typo-en-body-lg-600 break-words" }, di = {
1468
+ key: 0,
1469
+ class: "flex flex-col gap-4"
1470
+ }, mi = { class: "fm-typo-en-body-lg-400" }, pi = { class: "fm-typo-en-body-lg-600 break-words" }, fi = {
1471
+ key: 0,
1472
+ class: "flex flex-col gap-4"
1473
+ }, hi = { class: "fm-typo-en-body-lg-400" }, vi = { class: "fm-typo-en-body-lg-600" }, _i = {
1474
+ key: 6,
1475
+ class: "flex flex-col gap-8"
1476
+ }, gi = { class: "fm-typo-en-title-sm-800" }, bi = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, yi = {
1477
+ key: 0,
1478
+ class: "flex h-full justify-center items-center"
1479
+ }, Ti = {
1480
+ key: 1,
1481
+ class: "flex flex-col gap-3 flex-wrap"
1482
+ }, Ii = {
1483
+ key: 0,
1484
+ class: "relative"
1485
+ }, Ei = ["src"], wi = { class: "absolute top-0 right-0 cursor-pointer mt-1 mr-1" }, Fi = { class: "flex w-full overflow-x-hidden flex-col gap-24" }, Ci = {
1486
+ key: 0,
1487
+ class: "flex flex-wrap grow-0 w-auto gap-24"
1488
+ }, ki = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ri = {
1489
+ key: 7,
1490
+ class: "flex flex-col gap-8"
1491
+ }, Di = { class: "fm-typo-en-title-sm-600" }, Oi = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ai = { class: "flex flex-col gap-3" }, zi = { class: "flex gap-8 items-center justify-start" }, Si = /* @__PURE__ */ Se({
1492
+ __name: "DeviceInformationSideSheet",
1493
+ props: {
1494
+ visible: { type: Boolean },
1495
+ device: {},
1496
+ devices: {},
1497
+ formUpdated: { type: Boolean }
1498
+ },
1499
+ setup(e) {
1500
+ const { t } = Ne(), { isAtMost: n } = Ot(), o = e, s = mt(o, "visible"), l = mt(o, "formUpdated"), c = Dt(), p = Q(() => c.restaurants.value), _ = Q(() => c.currentBusiness.value), y = (d) => {
1501
+ var S, Y;
1502
+ return d ? d.name ?? ((S = p.value.find((K) => K._id === d.restaurantId)) == null ? void 0 : S.profile.name) : o.device.name ?? ((Y = p.value.find((K) => K._id === o.device.restaurantId)) == null ? void 0 : Y.profile.name);
1503
+ }, R = P({}), A = Q(() => Object.entries(R.value).filter(([, { deleted: d }]) => !d).map(([d]) => d)), N = an(), v = Q(() => N.getCustomerDisplayImages()), E = () => {
1504
+ var d;
1505
+ R.value = v.value.reduce((S, Y) => (S[Y.url] = {
1506
+ restaurantIds: Y.restaurantIds,
1507
+ deleted: !1
1508
+ }, S), {}), z.value = (d = v.value) != null && d.length ? v.value[0].url : "";
1509
+ }, z = P(A.value.length > 0 ? A.value[0] : "");
1510
+ function x(d) {
1511
+ z.value = d;
1512
+ }
1513
+ function V() {
1514
+ const d = A.value;
1515
+ R.value[z.value].deleted = !0;
1516
+ const S = d.findIndex((Y) => Y === z.value);
1517
+ S >= 0 && (z.value = d[S - 1] || d[S + 1] || "");
1518
+ }
1519
+ const $ = Q(
1520
+ () => p.value.map((d) => d._id).every((d) => w.value.includes(d))
1521
+ ), O = (d) => {
1522
+ d ? R.value[z.value].restaurantIds = p.value.map((S) => S._id) : R.value[z.value].restaurantIds = [];
1523
+ }, w = Q(() => R.value[z.value].restaurantIds), G = (d) => {
1524
+ R.value[z.value].restaurantIds = d;
1525
+ }, J = P(null), ae = P(!1);
1526
+ async function j(d) {
1527
+ var K;
1528
+ const S = `business/${(K = _.value) == null ? void 0 : K._id}/customer-display/${(/* @__PURE__ */ new Date()).toISOString()}`;
1529
+ ae.value = !0, await en.update(S, d).then((ce) => {
1530
+ R.value[ce] = {
1531
+ restaurantIds: [],
1532
+ deleted: !1
1533
+ }, z.value = ce;
1534
+ }), ae.value = !1, await sn(), J.value.scrollIntoView(!1);
1535
+ }
1536
+ const oe = P(!1), W = nt();
1537
+ async function B() {
1538
+ oe.value = !0;
1539
+ const d = Re();
1540
+ await N.updateCustomerDisplay(d).then(async () => {
1541
+ W.open({
1542
+ message: t("device.customerDisplay.update.success", { name: y() }),
1543
+ type: "success",
1544
+ position: ee.BOTTOM
1545
+ });
1546
+ }).catch((S) => {
1547
+ W.open({
1548
+ message: t("device.error.general"),
1549
+ type: "error",
1550
+ position: ee.BOTTOM
1551
+ });
1552
+ }), l.value = !0, s.value = !1, await st(), oe.value = !1;
1553
+ }
1554
+ function Re() {
1555
+ return {
1556
+ images: A.value.map((d) => ({
1557
+ url: d,
1558
+ restaurantIds: R.value[d].restaurantIds
1559
+ })),
1560
+ publishRestaurants: p.value.map((d) => d._id)
1561
+ };
1562
+ }
1563
+ async function st() {
1564
+ const d = Object.entries(R.value).filter(([, { deleted: S }]) => S).map(([S]) => S);
1565
+ await Promise.all(
1566
+ d.map(async (S) => {
1567
+ await en.delete(S);
1568
+ })
1569
+ );
1570
+ }
1571
+ const je = (d) => new Date(d).toLocaleDateString("en-GB", {
1572
+ day: "2-digit",
1573
+ month: "short",
1574
+ year: "numeric",
1575
+ hour: "2-digit",
1576
+ minute: "2-digit",
1577
+ hour12: !0
1578
+ }).replace(",", "").toUpperCase(), Ie = (d) => {
1579
+ const S = d.replace(/([A-Z])/g, " $1").toLowerCase();
1580
+ return S.charAt(0).toUpperCase() + S.slice(1);
1581
+ }, Ee = (d) => Date.now() - new Date(d).getTime() < 6e5;
1582
+ return $e(s, (d) => {
1583
+ d && E();
1584
+ }), pt(() => {
1585
+ E();
1586
+ }), (d, S) => {
1587
+ const Y = I("FmCardHeader"), K = I("FmCardSection"), ce = I("FmCard"), it = I("FmIcon"), Pe = I("FmCircularProgress"), we = I("FmButton"), Fe = I("FmThumbnail"), me = I("FmDropField"), at = I("FmCheckbox"), yt = I("FmForm"), De = I("FmSideSheet");
1588
+ return f(), M(De, {
1589
+ header: i(t)("device.information.title"),
1590
+ "max-width": 560,
1591
+ modelValue: i(s),
1592
+ "onUpdate:modelValue": S[2] || (S[2] = (pe) => nn(s) ? s.value = pe : null),
1593
+ "close-button": !oe.value,
1594
+ "dismiss-away": !0
1595
+ }, On({
1596
+ default: F(() => [
1597
+ m(yt, null, {
1598
+ default: F(() => {
1599
+ var pe, a, u, g, U, fe, qe, lt, xe, Le, Ue, Ce;
1600
+ return [
1601
+ r("div", cs, [
1602
+ m(ce, { variant: "outlined" }, {
1603
+ default: F(() => [
1604
+ m(Y, {
1605
+ title: i(t)("device.information.sections.deviceInfo"),
1606
+ class: "pb-8 px-16"
1607
+ }, null, 8, ["title"]),
1608
+ m(K, { class: "pt-0 flex flex-col gap-8" }, {
1609
+ default: F(() => {
1610
+ var D, L, he, ve;
1611
+ return [
1612
+ r("div", us, [
1613
+ r("div", ds, h(i(t)("device.information.main.id")), 1),
1614
+ r("div", ms, h(((D = d.device) == null ? void 0 : D.machineId) ?? "-"), 1)
1615
+ ]),
1616
+ r("div", ps, [
1617
+ r("div", fs, h(i(t)("device.information.main.name")), 1),
1618
+ r("div", hs, h(y()), 1)
1619
+ ]),
1620
+ r("div", vs, [
1621
+ r("div", _s, h(i(t)("device.information.main.type")), 1),
1622
+ r("div", gs, h((L = d.device) == null ? void 0 : L.type), 1)
1623
+ ]),
1624
+ r("div", bs, [
1625
+ r("div", ys, h(i(t)("device.information.main.bindingAt")), 1),
1626
+ r("div", Ts, h((he = d.device) != null && he.bindAt ? je((ve = d.device) == null ? void 0 : ve.bindAt) : "-"), 1)
1627
+ ])
1628
+ ];
1629
+ }),
1630
+ _: 1
1631
+ })
1632
+ ]),
1633
+ _: 1
1634
+ }),
1635
+ (pe = d.device.heartbeatInfo) != null && pe.updatedAt ? (f(), M(ce, {
1636
+ key: 0,
1637
+ variant: "outlined"
1638
+ }, {
1639
+ default: F(() => [
1640
+ m(Y, {
1641
+ title: i(t)("device.information.sections.heartbeatStatus"),
1642
+ class: "pb-8 px-16"
1643
+ }, null, 8, ["title"]),
1644
+ m(K, { class: "pt-0 flex flex-col gap-8" }, {
1645
+ default: F(() => {
1646
+ var D, L, he, ve, Oe, T, te, ge, He, Ge, We, Ye, Ke, Xe, Ze, Qe;
1647
+ return [
1648
+ r("div", Is, [
1649
+ r("div", Es, h(i(t)("device.information.heartbeat.lastSyncAt")), 1),
1650
+ r("div", ws, [
1651
+ m(it, {
1652
+ class: "motion-safe:animate-pulse",
1653
+ name: "radio_button_unchecked",
1654
+ size: "sm",
1655
+ color: Ee((L = (D = d.device) == null ? void 0 : D.heartbeatInfo) == null ? void 0 : L.updatedAt) ? "system-success-300" : "system-error-300"
1656
+ }, null, 8, ["color"]),
1657
+ r("div", Fs, h(je((ve = (he = d.device) == null ? void 0 : he.heartbeatInfo) == null ? void 0 : ve.updatedAt)), 1)
1658
+ ])
1659
+ ]),
1660
+ (T = (Oe = d.device) == null ? void 0 : Oe.heartbeatInfo) != null && T.freeMemory ? (f(), b("div", Cs, [
1661
+ r("div", ks, h(i(t)("device.information.heartbeat.freeMemory")), 1),
1662
+ r("div", Rs, h((ge = (te = d.device) == null ? void 0 : te.heartbeatInfo) == null ? void 0 : ge.freeMemory.toFixed(2)) + " MB", 1)
1663
+ ])) : k("", !0),
1664
+ (He = d.device.heartbeatInfo) != null && He.appMemory ? (f(), b("div", Ds, [
1665
+ r("div", Os, h(i(t)("device.information.heartbeat.appMemory")), 1),
1666
+ r("div", As, h((Ge = d.device.heartbeatInfo) == null ? void 0 : Ge.appMemory.toFixed(2)) + " MB", 1)
1667
+ ])) : k("", !0),
1668
+ (We = d.device.heartbeatInfo) != null && We.totalMemory ? (f(), b("div", zs, [
1669
+ r("div", Ss, h(i(t)("device.information.heartbeat.totalMemory")), 1),
1670
+ r("div", Ns, h((Ye = d.device.heartbeatInfo) == null ? void 0 : Ye.totalMemory.toFixed(2)) + " MB", 1)
1671
+ ])) : k("", !0),
1672
+ (Ke = d.device.heartbeatInfo) != null && Ke.freeSpace ? (f(), b("div", Ps, [
1673
+ r("div", xs, h(i(t)("device.information.heartbeat.freeSpace")), 1),
1674
+ r("div", Ls, h((Xe = d.device.heartbeatInfo) == null ? void 0 : Xe.freeSpace.toFixed(2)) + " MB", 1)
1675
+ ])) : k("", !0),
1676
+ (Ze = d.device.heartbeatInfo) != null && Ze.totalSpace ? (f(), b("div", Us, [
1677
+ r("div", Ms, h(i(t)("device.information.heartbeat.totalSpace")), 1),
1678
+ r("div", Bs, h((Qe = d.device.heartbeatInfo) == null ? void 0 : Qe.totalSpace.toFixed(2)) + " MB", 1)
1679
+ ])) : k("", !0)
1680
+ ];
1681
+ }),
1682
+ _: 1
1683
+ })
1684
+ ]),
1685
+ _: 1
1686
+ })) : k("", !0),
1687
+ (a = d.device) != null && a.appVersion && Object.values((u = d.device) == null ? void 0 : u.appVersion).some((D) => D) ? (f(), M(ce, {
1688
+ key: 1,
1689
+ variant: "outlined"
1690
+ }, {
1691
+ default: F(() => [
1692
+ m(Y, {
1693
+ title: i(t)("device.information.sections.applicationInfo"),
1694
+ class: "pb-8 px-16"
1695
+ }, null, 8, ["title"]),
1696
+ m(K, { class: "pt-0 flex flex-col gap-8" }, {
1697
+ default: F(() => {
1698
+ var D, L, he, ve, Oe, T, te, ge, He, Ge, We, Ye, Ke, Xe, Ze, Qe, Ut, Mt, Bt, Vt, $t, jt, qt, Ht;
1699
+ return [
1700
+ r("div", Vs, [
1701
+ (L = (D = d.device) == null ? void 0 : D.appVersion) != null && L.appName ? (f(), b("div", $s, h(i(t)("device.information.app.name")), 1)) : k("", !0),
1702
+ r("div", js, h((ve = (he = d.device) == null ? void 0 : he.appVersion) == null ? void 0 : ve.appName), 1)
1703
+ ]),
1704
+ (T = (Oe = d.device) == null ? void 0 : Oe.appVersion) != null && T.buildNumber ? (f(), b("div", qs, [
1705
+ r("div", Hs, h(i(t)("device.information.app.buildNumber")), 1),
1706
+ r("div", Gs, h((ge = (te = d.device) == null ? void 0 : te.appVersion) == null ? void 0 : ge.buildNumber), 1)
1707
+ ])) : k("", !0),
1708
+ (Ge = (He = d.device) == null ? void 0 : He.appVersion) != null && Ge.buildSignature ? (f(), b("div", Ws, [
1709
+ r("div", Ys, h(i(t)("device.information.app.buildSignature")), 1),
1710
+ r("div", Ks, h((Ye = (We = d.device) == null ? void 0 : We.appVersion) == null ? void 0 : Ye.buildSignature), 1)
1711
+ ])) : k("", !0),
1712
+ (Xe = (Ke = d.device) == null ? void 0 : Ke.appVersion) != null && Xe.installerStore ? (f(), b("div", Xs, [
1713
+ r("div", Zs, h(i(t)("device.information.app.installerStore")), 1),
1714
+ r("div", Qs, h((Qe = (Ze = d.device) == null ? void 0 : Ze.appVersion) == null ? void 0 : Qe.installerStore), 1)
1715
+ ])) : k("", !0),
1716
+ (Mt = (Ut = d.device) == null ? void 0 : Ut.appVersion) != null && Mt.packageName ? (f(), b("div", Js, [
1717
+ r("div", ei, h(i(t)("device.information.app.packageName")), 1),
1718
+ r("div", ti, h((Vt = (Bt = d.device) == null ? void 0 : Bt.appVersion) == null ? void 0 : Vt.packageName), 1)
1719
+ ])) : k("", !0),
1720
+ (jt = ($t = d.device) == null ? void 0 : $t.appVersion) != null && jt.version ? (f(), b("div", ni, [
1721
+ r("div", oi, h(i(t)("device.information.app.version")), 1),
1722
+ r("div", si, h((Ht = (qt = d.device) == null ? void 0 : qt.appVersion) == null ? void 0 : Ht.version), 1)
1723
+ ])) : k("", !0)
1724
+ ];
1725
+ }),
1726
+ _: 1
1727
+ })
1728
+ ]),
1729
+ _: 1
1730
+ })) : k("", !0),
1731
+ (g = d.device.os) != null && g.system ? (f(), M(ce, {
1732
+ key: 2,
1733
+ variant: "outlined"
1734
+ }, {
1735
+ default: F(() => [
1736
+ m(Y, {
1737
+ title: i(t)("device.information.sections.systemInfo"),
1738
+ class: "pb-8 px-16"
1739
+ }, null, 8, ["title"]),
1740
+ m(K, { class: "pt-0 flex flex-col gap-8" }, {
1741
+ default: F(() => [
1742
+ (f(!0), b(ie, null, ue(d.device.os.system, (D, L) => (f(), b(ie, { key: L }, [
1743
+ D && !(D instanceof Object) ? (f(), b("div", ii, [
1744
+ r("div", ai, h(i(t)(`device.information.system.${L}`) || Ie(L)), 1),
1745
+ r("div", null, [
1746
+ r("div", li, h(D), 1)
1747
+ ])
1748
+ ])) : k("", !0)
1749
+ ], 64))), 128))
1750
+ ]),
1751
+ _: 1
1752
+ })
1753
+ ]),
1754
+ _: 1
1755
+ })) : k("", !0),
1756
+ (fe = (U = d.device) == null ? void 0 : U.os) != null && fe.android ? (f(), M(ce, {
1757
+ key: 3,
1758
+ variant: "outlined"
1759
+ }, {
1760
+ default: F(() => [
1761
+ m(Y, {
1762
+ title: i(t)("device.information.sections.androidOS"),
1763
+ class: "pb-8 px-16"
1764
+ }, null, 8, ["title"]),
1765
+ m(K, { class: "pt-0 flex flex-col gap-8" }, {
1766
+ default: F(() => [
1767
+ (f(!0), b(ie, null, ue(d.device.os.android, (D, L) => (f(), b(ie, { key: L }, [
1768
+ D && !(D instanceof Object) ? (f(), b("div", ri, [
1769
+ r("div", ci, h(i(t)(`device.information.android.${L}`) || Ie(L)), 1),
1770
+ r("div", null, [
1771
+ r("div", ui, h(D), 1)
1772
+ ])
1773
+ ])) : k("", !0)
1774
+ ], 64))), 128))
1775
+ ]),
1776
+ _: 1
1777
+ })
1778
+ ]),
1779
+ _: 1
1780
+ })) : k("", !0),
1781
+ (qe = d.device.os) != null && qe.iOS ? (f(), M(ce, {
1782
+ key: 4,
1783
+ variant: "outlined"
1784
+ }, {
1785
+ default: F(() => [
1786
+ m(Y, {
1787
+ title: i(t)("device.information.sections.iOSOS"),
1788
+ class: "pb-8 px-16"
1789
+ }, null, 8, ["title"]),
1790
+ m(K, { class: "pt-0 flex flex-col gap-8" }, {
1791
+ default: F(() => [
1792
+ (f(!0), b(ie, null, ue(d.device.os.iOS, (D, L) => (f(), b(ie, { key: L }, [
1793
+ D && !(D instanceof Object) ? (f(), b("div", di, [
1794
+ r("div", mi, h(i(t)(`device.information.ios.${L}`) || Ie(L)), 1),
1795
+ r("div", null, [
1796
+ r("div", pi, h(D), 1)
1797
+ ])
1798
+ ])) : k("", !0)
1799
+ ], 64))), 128))
1800
+ ]),
1801
+ _: 1
1802
+ })
1803
+ ]),
1804
+ _: 1
1805
+ })) : k("", !0),
1806
+ (lt = d.device.os) != null && lt.windows ? (f(), M(ce, {
1807
+ key: 5,
1808
+ variant: "outlined"
1809
+ }, {
1810
+ default: F(() => [
1811
+ m(Y, {
1812
+ title: i(t)("device.information.sections.windowsOS"),
1813
+ class: "pb-8 px-16"
1814
+ }, null, 8, ["title"]),
1815
+ m(K, { class: "pt-0 flex flex-col gap-8" }, {
1816
+ default: F(() => [
1817
+ (f(!0), b(ie, null, ue(d.device.os.windows, (D, L) => (f(), b(ie, { key: L }, [
1818
+ D && !(D instanceof Object) ? (f(), b("div", fi, [
1819
+ r("div", hi, h(i(t)(`device.information.windows.${L}`) || Ie(L)), 1),
1820
+ r("div", null, [
1821
+ r("div", vi, h(D), 1)
1822
+ ])
1823
+ ])) : k("", !0)
1824
+ ], 64))), 128))
1825
+ ]),
1826
+ _: 1
1827
+ })
1828
+ ]),
1829
+ _: 1
1830
+ })) : k("", !0),
1831
+ d.device.type === i(Z).Enum.MAIN ? (f(), b("div", _i, [
1832
+ r("div", gi, h(i(t)("device.customerDisplay.title")), 1),
1833
+ r("div", bi, h(i(t)("device.customerDisplay.description")), 1),
1834
+ ae.value ? (f(), b("div", yi, [
1835
+ m(Pe, { size: "lg" })
1836
+ ])) : (f(), b("div", Ti, [
1837
+ (xe = A.value) != null && xe.length ? (f(), b("div", Ii, [
1838
+ r("img", {
1839
+ class: "object-cover w-full h-[264px] xs:h-[175px]",
1840
+ src: z.value
1841
+ }, null, 8, Ei),
1842
+ r("div", wi, [
1843
+ m(we, {
1844
+ class: "h-[36px] w-[36px]",
1845
+ icon: "close",
1846
+ onClick: V,
1847
+ variant: "secondary",
1848
+ "bg-color": "neutral-white"
1849
+ })
1850
+ ])
1851
+ ])) : k("", !0),
1852
+ r("div", Fi, [
1853
+ (Le = A.value) != null && Le.length ? (f(), b("div", Ci, [
1854
+ (f(!0), b(ie, null, ue(A.value, (D) => (f(), M(Fe, {
1855
+ key: D,
1856
+ src: D,
1857
+ size: i(n)("xs") ? "lg" : "xl",
1858
+ class: on(["cursor-pointer mr-1", z.value == D ? "border-fm-color-primary border-[2px]" : ""]),
1859
+ onClick: (L) => x(D)
1860
+ }, null, 8, ["src", "size", "class", "onClick"]))), 128))
1861
+ ])) : k("", !0),
1862
+ m(me, {
1863
+ class: "w-[200px] h-[170px]",
1864
+ onFileUpload: S[0] || (S[0] = (D) => j(D)),
1865
+ accept: "image/*"
1866
+ }, {
1867
+ "accept-text": F(() => S[3] || (S[3] = [
1868
+ r("div", null, null, -1)
1869
+ ])),
1870
+ "helper-text": F(() => [
1871
+ r("div", ki, [
1872
+ r("div", null, h(i(t)("device.customerDisplay.imageSize.recommendation")), 1),
1873
+ r("div", null, h(i(t)("device.customerDisplay.imageSize.dimensions")), 1)
1874
+ ])
1875
+ ]),
1876
+ _: 1
1877
+ })
1878
+ ])
1879
+ ]))
1880
+ ])) : k("", !0),
1881
+ r("div", {
1882
+ ref_key: "bottomDiv",
1883
+ ref: J
1884
+ }, null, 512),
1885
+ (Ue = A.value) != null && Ue.length && d.device.type === i(Z).Enum.MAIN ? (f(), b("div", Ri, [
1886
+ r("div", Di, h(i(t)("device.customerDisplay.selection.title")), 1),
1887
+ r("div", Oi, h(i(t)("device.customerDisplay.selection.description")), 1),
1888
+ r("div", Ai, [
1889
+ m(at, {
1890
+ "model-value": $.value,
1891
+ label: i(t)("device.filters.all"),
1892
+ value: "1",
1893
+ indeterminate: ((Ce = w.value) == null ? void 0 : Ce.length) > 0,
1894
+ "onUpdate:modelValue": O
1895
+ }, null, 8, ["model-value", "label", "indeterminate"]),
1896
+ (f(!0), b(ie, null, ue(d.devices.filter((D) => D.restaurantId && D.type === i(Z).Enum.MAIN), (D, L) => (f(), M(at, {
1897
+ key: L,
1898
+ "model-value": w.value,
1899
+ label: y(D),
1900
+ value: D.restaurantId,
1901
+ "onUpdate:modelValue": G
1902
+ }, null, 8, ["model-value", "label", "value"]))), 128))
1903
+ ])
1904
+ ])) : k("", !0)
1905
+ ])
1906
+ ];
1907
+ }),
1908
+ _: 1
1909
+ })
1910
+ ]),
1911
+ _: 2
1912
+ }, [
1913
+ d.device.type === i(Z).Enum.MAIN ? {
1914
+ name: "side-sheet-footer",
1915
+ fn: F(() => [
1916
+ r("div", zi, [
1917
+ m(we, {
1918
+ loading: oe.value,
1919
+ disabled: oe.value,
1920
+ variant: "primary",
1921
+ label: i(t)("device.actions.update"),
1922
+ onClick: Rt(B, ["prevent"])
1923
+ }, null, 8, ["loading", "disabled", "label"]),
1924
+ m(we, {
1925
+ disabled: oe.value,
1926
+ variant: "secondary",
1927
+ label: i(t)("device.actions.cancel"),
1928
+ onClick: S[1] || (S[1] = (pe) => s.value = !1)
1929
+ }, null, 8, ["disabled", "label"])
1930
+ ])
1931
+ ]),
1932
+ key: "0"
1933
+ } : void 0
1934
+ ]), 1032, ["header", "modelValue", "close-button"]);
1935
+ };
1936
+ }
1937
+ });
1938
+ var Cn = /* @__PURE__ */ ((e) => (e.licensePosCreateSubPos = "license_pos_create_subpos", e))(Cn || {}), Ve = /* @__PURE__ */ ((e) => (e.PENDING = "pending", e.PROCESSING = "processing", e.COMPLETED = "completed", e.FAILED = "failed", e))(Ve || {});
1939
+ const Ni = { class: "flex flex-col gap-8" }, Pi = { class: "flex justify-end items-center" }, xi = {
1940
+ key: 0,
1941
+ class: "flex justify-center"
1942
+ }, Li = {
1943
+ key: 1,
1944
+ class: "flex flex-col gap-5"
1945
+ }, Ui = {
1946
+ key: 2,
1947
+ class: "flex flex-col gap-8"
1948
+ }, Mi = { key: 0 }, Bi = {
1949
+ key: 3,
1950
+ class: "flex flex-col gap-8"
1951
+ }, Vi = { key: 0 }, $i = { key: 4 }, ji = /* @__PURE__ */ Se({
1952
+ __name: "DownloadLogDialog",
1953
+ props: {
1954
+ machineId: {
1955
+ type: String,
1956
+ required: !0
1957
+ }
1958
+ },
1959
+ setup(e) {
1960
+ const t = e, n = P(), o = P(!1), s = P(!1), l = P(!1), c = async () => {
1961
+ const v = await Bn.currentUser();
1962
+ return {
1963
+ machineId: t.machineId,
1964
+ userId: v == null ? void 0 : v.id
1965
+ };
1966
+ }, p = async () => {
1967
+ o.value = !0, n.value = void 0;
1968
+ try {
1969
+ const v = await c(), E = await ne.getLogRequest(v);
1970
+ n.value = E, console.log(n.value);
1971
+ } catch (v) {
1972
+ console.error("Failed to fetch log request:", v);
1973
+ } finally {
1974
+ o.value = !1;
1975
+ }
1976
+ }, _ = async () => {
1977
+ l.value = !0;
1978
+ try {
1979
+ const v = await c(), E = await ne.getLogRequest(v);
1980
+ n.value = E;
1981
+ } catch (v) {
1982
+ console.error("Failed to refresh log request:", v);
1983
+ } finally {
1984
+ l.value = !1;
1985
+ }
1986
+ }, y = async () => {
1987
+ o.value = !0, n.value = void 0;
1988
+ try {
1989
+ const v = await c(), E = await ne.createLogRequest(v);
1990
+ n.value = E;
1991
+ } catch (v) {
1992
+ console.error("Failed to create log request:", v);
1993
+ } finally {
1994
+ o.value = !1;
1995
+ }
1996
+ }, R = async () => {
1997
+ var v;
1998
+ if ((v = n.value) != null && v.requestId) {
1999
+ s.value = !0;
2000
+ try {
2001
+ await ne.deleteLogRequest(n.value.requestId), await p();
2002
+ } catch (E) {
2003
+ console.error("Failed to delete log request:", E);
2004
+ } finally {
2005
+ s.value = !1;
2006
+ }
2007
+ }
2008
+ }, A = (v) => new Date(v).toLocaleDateString("en-GB", {
2009
+ day: "2-digit",
2010
+ month: "short",
2011
+ year: "numeric",
2012
+ hour: "2-digit",
2013
+ minute: "2-digit",
2014
+ hour12: !0
2015
+ }).toUpperCase(), N = (v) => {
2016
+ window.open(v, "_blank"), setTimeout(() => R(), 500);
2017
+ };
2018
+ return pt(async () => {
2019
+ await p();
2020
+ }), (v, E) => {
2021
+ var J, ae, j, oe;
2022
+ const z = I("FmButton"), x = I("FmProgress"), V = I("FmSnackbar"), $ = I("FmCardHeader"), O = I("FmCardSection"), w = I("FmCard"), G = I("FmCardActions");
2023
+ return f(), b("div", Ni, [
2024
+ r("div", Pi, [
2025
+ o.value ? k("", !0) : (f(), M(z, {
2026
+ key: 0,
2027
+ variant: "secondary",
2028
+ size: "md",
2029
+ "prepend-icon": "refresh",
2030
+ onClick: _
2031
+ }))
2032
+ ]),
2033
+ o.value ? (f(), b("div", xi, [
2034
+ m(x, {
2035
+ variant: "circular",
2036
+ size: "lg"
2037
+ })
2038
+ ])) : k("", !0),
2039
+ !o.value && !n.value ? (f(), b("div", Li, [
2040
+ m(V, {
2041
+ description: "Device is online",
2042
+ variant: "info"
2043
+ }),
2044
+ m(z, {
2045
+ label: "Create download log request",
2046
+ onClick: y,
2047
+ loading: o.value
2048
+ }, null, 8, ["loading"])
2049
+ ])) : k("", !0),
2050
+ !o.value && (((J = n.value) == null ? void 0 : J.status) === i(Ve).PENDING || ((ae = n.value) == null ? void 0 : ae.status) === i(Ve).PROCESSING) ? (f(), b("div", Ui, [
2051
+ m(V, {
2052
+ description: "Your in progress downloads need to finish before you can request a new download.",
2053
+ variant: "info"
2054
+ }),
2055
+ m(z, {
2056
+ label: "Create download log request",
2057
+ onClick: y,
2058
+ disabled: ""
2059
+ }),
2060
+ m(w, { variant: "outlined" }, {
2061
+ default: F(() => [
2062
+ m($, {
2063
+ title: n.value.status === i(Ve).PENDING ? "Pending" : "Processing"
2064
+ }, null, 8, ["title"]),
2065
+ m(O, { class: "pt-0" }, {
2066
+ default: F(() => {
2067
+ var W, B;
2068
+ return [
2069
+ r("div", null, "Request ID: " + h(n.value.requestId), 1),
2070
+ r("div", null, "Requested at: " + h(A((W = n.value) == null ? void 0 : W.createdAt)), 1),
2071
+ n.value.expiresAt ? (f(), b("div", Mi, "Expires at: " + h(A((B = n.value) == null ? void 0 : B.expiresAt)), 1)) : k("", !0)
2072
+ ];
2073
+ }),
2074
+ _: 1
2075
+ })
2076
+ ]),
2077
+ _: 1
2078
+ })
2079
+ ])) : k("", !0),
2080
+ !o.value && ((j = n.value) == null ? void 0 : j.status) === i(Ve).COMPLETED ? (f(), b("div", Bi, [
2081
+ m(z, {
2082
+ label: "Create new log request",
2083
+ onClick: y
2084
+ }),
2085
+ m(V, {
2086
+ description: `Please download this file before it expires. Once expired, the file will no longer be available for
2087
+ download.`,
2088
+ variant: "info"
2089
+ }),
2090
+ m(w, { variant: "outlined" }, {
2091
+ default: F(() => [
2092
+ m($, { title: "Completed" }),
2093
+ m(O, { class: "pt-0" }, {
2094
+ default: F(() => {
2095
+ var W, B, Re;
2096
+ return [
2097
+ r("div", null, "Request ID: " + h(n.value.requestId), 1),
2098
+ r("div", null, "Requested at: " + h(A((W = n.value) == null ? void 0 : W.createdAt)), 1),
2099
+ r("div", null, "File name: " + h(n.value.fileName || "logs.zip"), 1),
2100
+ r("div", null, " File size: " + h(n.value.fileSize ? Math.round(n.value.fileSize / 1024 / 1024 * 100) / 100 + " MB" : "Unknown"), 1),
2101
+ r("div", null, "Completed at: " + h(A((B = n.value) == null ? void 0 : B.completedAt)), 1),
2102
+ n.value.expiresAt ? (f(), b("div", Vi, "Expires at: " + h(A((Re = n.value) == null ? void 0 : Re.expiresAt)), 1)) : k("", !0)
2103
+ ];
2104
+ }),
2105
+ _: 1
2106
+ }),
2107
+ m(G, { class: "flex justify-center w-full pt-0" }, {
2108
+ default: F(() => [
2109
+ m(z, {
2110
+ class: "w-60",
2111
+ label: "Download",
2112
+ size: "md",
2113
+ variant: "primary",
2114
+ onClick: E[0] || (E[0] = (W) => N(n.value.downloadUrl)),
2115
+ loading: s.value
2116
+ }, null, 8, ["loading"]),
2117
+ m(z, {
2118
+ class: "w-60",
2119
+ label: "Delete",
2120
+ size: "md",
2121
+ variant: "destructive",
2122
+ onClick: R,
2123
+ loading: s.value
2124
+ }, null, 8, ["loading"])
2125
+ ]),
2126
+ _: 1
2127
+ })
2128
+ ]),
2129
+ _: 1
2130
+ })
2131
+ ])) : k("", !0),
2132
+ !o.value && ((oe = n.value) == null ? void 0 : oe.status) === i(Ve).FAILED ? (f(), b("div", $i, [
2133
+ m(z, {
2134
+ label: "Create download log request",
2135
+ onClick: y
2136
+ }),
2137
+ m(w, { variant: "outlined" }, {
2138
+ default: F(() => [
2139
+ m($, { title: "Error" }),
2140
+ m(O, { class: "pt-0" }, {
2141
+ default: F(() => {
2142
+ var W, B;
2143
+ return [
2144
+ r("div", null, "Request ID: " + h(n.value.requestId), 1),
2145
+ r("div", null, "Requested at: " + h(A((W = n.value) == null ? void 0 : W.createdAt)), 1),
2146
+ r("div", null, "Error: " + h(((B = n.value) == null ? void 0 : B.error) || "Unknown error"), 1)
2147
+ ];
2148
+ }),
2149
+ _: 1
2150
+ })
2151
+ ]),
2152
+ _: 1
2153
+ })
2154
+ ])) : k("", !0)
2155
+ ]);
2156
+ };
2157
+ }
2158
+ });
2159
+ function qi(e) {
2160
+ return e || {};
2161
+ }
2162
+ function Hi(e) {
2163
+ if (e == null || e === "" || typeof e == "boolean" || Array.isArray(e) || typeof e == "object")
2164
+ return !1;
2165
+ const t = Number(e);
2166
+ return !isNaN(t) && isFinite(t);
2167
+ }
2168
+ function Be(e, t, n) {
2169
+ const { t: o } = Ne();
2170
+ return (s) => e(s) || o(t, qi(n));
2171
+ }
2172
+ const be = {
2173
+ required() {
2174
+ return Be((e) => {
2175
+ var t;
2176
+ return !!((t = e == null ? void 0 : e.toString()) != null && t.length);
2177
+ }, "device.validation.required", {});
2178
+ },
2179
+ nonEmpty() {
2180
+ return Be((e) => {
2181
+ var t;
2182
+ return !!((t = e == null ? void 0 : e.trim()) != null && t.length);
2183
+ }, "device.validation.required", {});
2184
+ },
2185
+ matches(e) {
2186
+ return Be((t) => t === e, "device.validation.invalid", {});
2187
+ },
2188
+ min(e) {
2189
+ return Be((t) => t >= e, "device.validation.min", { min: e });
2190
+ },
2191
+ max(e) {
2192
+ return Be((t) => t <= e, "device.validation.max", { max: e });
2193
+ },
2194
+ number() {
2195
+ return Be(Hi, "device.validation.number", {});
2196
+ }
2197
+ }, Gi = { class: "flex gap-8 items-center justify-start" }, Wi = /* @__PURE__ */ Se({
2198
+ __name: "ManageConfigurationSideSheet",
2199
+ props: {
2200
+ device: {},
2201
+ visible: { type: Boolean }
2202
+ },
2203
+ setup(e) {
2204
+ const { t } = Ne(), { isAtMost: n } = Ot(), o = e, s = mt(o, "visible"), l = P(), c = P(), p = P(), _ = P(), y = Q(
2205
+ () => Object.values(Tt.enum).map((v) => ({
2206
+ label: v,
2207
+ value: v
2208
+ }))
2209
+ ), R = nt(), A = async () => {
2210
+ if (!p.value || p.value > 30 || p.value < 5)
2211
+ return;
2212
+ const v = {
2213
+ logging: {
2214
+ enable: l.value,
2215
+ level: c.value,
2216
+ ttl: p.value
2217
+ },
2218
+ telemetry: {
2219
+ enable: _.value
2220
+ }
2221
+ };
2222
+ await ne.updateDeviceConfig(o.device.deviceId, v).then(async () => {
2223
+ N(), setTimeout(() => {
2224
+ R.open({
2225
+ message: t("device.status.config.success", { deviceName: o.device.name ?? o.device.restaurantName }),
2226
+ type: "success",
2227
+ position: ee.BOTTOM
2228
+ });
2229
+ }, 100);
2230
+ }).catch((E) => {
2231
+ R.open({
2232
+ message: t("device.status.config.error", { error: E }),
2233
+ type: "error",
2234
+ position: ee.BOTTOM
2235
+ });
2236
+ });
2237
+ }, N = () => {
2238
+ s.value = !1;
2239
+ };
2240
+ return pt(async () => {
2241
+ await ne.getDeviceConfig(o.device.deviceId).then((v) => {
2242
+ var E, z, x, V;
2243
+ l.value = ((E = v.logging) == null ? void 0 : E.enable) ?? !0, c.value = ((z = v.logging) == null ? void 0 : z.level) ?? Tt.Enum.ALL, p.value = ((x = v.logging) == null ? void 0 : x.ttl) ?? 30, _.value = ((V = v.telemetry) == null ? void 0 : V.enable) ?? !1;
2244
+ }).catch(() => {
2245
+ l.value = !0, c.value = Tt.Enum.ALL, p.value = 30, _.value = !1;
2246
+ });
2247
+ }), (v, E) => {
2248
+ const z = I("FmCardHeader"), x = I("FmSwitch"), V = I("FmSelect"), $ = I("FmStepperField"), O = I("FmCardSection"), w = I("FmCard"), G = I("FmForm"), J = I("FmButton"), ae = I("FmSideSheet");
2249
+ return f(), M(ae, {
2250
+ header: i(t)("device.config.title"),
2251
+ modelValue: i(s),
2252
+ "onUpdate:modelValue": E[4] || (E[4] = (j) => nn(s) ? s.value = j : null),
2253
+ "max-width": i(n)("xs") ? 560 : 470
2254
+ }, {
2255
+ "side-sheet-footer": F(() => [
2256
+ r("div", Gi, [
2257
+ m(J, {
2258
+ variant: "primary",
2259
+ label: i(t)("device.actions.update"),
2260
+ onClick: Rt(A, ["prevent"])
2261
+ }, null, 8, ["label"]),
2262
+ m(J, {
2263
+ variant: "secondary",
2264
+ label: i(t)("device.actions.cancel"),
2265
+ onClick: N
2266
+ }, null, 8, ["label"])
2267
+ ])
2268
+ ]),
2269
+ default: F(() => [
2270
+ m(G, null, {
2271
+ default: F(() => [
2272
+ m(w, { variant: "flat" }, {
2273
+ default: F(() => [
2274
+ m(z, {
2275
+ title: i(t)("device.config.logging.title"),
2276
+ class: "p-1"
2277
+ }, null, 8, ["title"]),
2278
+ m(O, { class: "p-1 flex gap-6 flex-col" }, {
2279
+ default: F(() => [
2280
+ m(x, {
2281
+ modelValue: l.value,
2282
+ "onUpdate:modelValue": E[0] || (E[0] = (j) => l.value = j),
2283
+ value: "first",
2284
+ label: i(t)("device.config.logging.enable.label"),
2285
+ sublabel: i(t)("device.config.logging.enable.sublabel"),
2286
+ "label-placement": "right"
2287
+ }, null, 8, ["modelValue", "label", "sublabel"]),
2288
+ m(V, {
2289
+ width: 150,
2290
+ modelValue: c.value,
2291
+ "onUpdate:modelValue": E[1] || (E[1] = (j) => c.value = j),
2292
+ label: i(t)("device.config.logging.logLevel"),
2293
+ items: y.value
2294
+ }, null, 8, ["modelValue", "label", "items"]),
2295
+ m($, {
2296
+ modelValue: p.value,
2297
+ "onUpdate:modelValue": E[2] || (E[2] = (j) => p.value = j),
2298
+ label: i(t)("device.config.logging.ttl.label"),
2299
+ placeholder: "5",
2300
+ step: 1,
2301
+ min: 5,
2302
+ max: 30,
2303
+ rules: [i(be).required(), i(be).number(), i(be).min(5), i(be).max(30)],
2304
+ "append-text": i(t)("device.config.logging.ttl.unit")
2305
+ }, null, 8, ["modelValue", "label", "rules", "append-text"])
2306
+ ]),
2307
+ _: 1
2308
+ })
2309
+ ]),
2310
+ _: 1
2311
+ }),
2312
+ m(w, { variant: "flat" }, {
2313
+ default: F(() => [
2314
+ m(z, {
2315
+ title: i(t)("device.config.telemetry.title"),
2316
+ class: "p-1"
2317
+ }, null, 8, ["title"]),
2318
+ m(O, { class: "p-1 flex gap-6 flex-col" }, {
2319
+ default: F(() => [
2320
+ m(x, {
2321
+ modelValue: _.value,
2322
+ "onUpdate:modelValue": E[3] || (E[3] = (j) => _.value = j),
2323
+ value: "first",
2324
+ label: i(t)("device.config.telemetry.enable.label"),
2325
+ sublabel: i(t)("device.config.telemetry.enable.sublabel"),
2326
+ "label-placement": "right"
2327
+ }, null, 8, ["modelValue", "label", "sublabel"])
2328
+ ]),
2329
+ _: 1
2330
+ })
2331
+ ]),
2332
+ _: 1
2333
+ })
2334
+ ]),
2335
+ _: 1
2336
+ })
2337
+ ]),
2338
+ _: 1
2339
+ }, 8, ["header", "modelValue", "max-width"]);
2340
+ };
2341
+ }
2342
+ }), Yi = { class: "flex flex-col gap-24 fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ki = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary" }, Xi = /* @__PURE__ */ Se({
2343
+ __name: "UnbindDeviceDialog",
2344
+ props: {
2345
+ restaurantName: {
2346
+ type: String,
2347
+ required: !0
2348
+ }
2349
+ },
2350
+ setup(e) {
2351
+ const { t } = Ne(), { emitData: n } = rn(), o = P(), s = Q({
2352
+ get() {
2353
+ return o.value;
2354
+ },
2355
+ set(l) {
2356
+ o.value = l, n(o.value);
2357
+ }
2358
+ });
2359
+ return (l, c) => {
2360
+ const p = I("FmTextField"), _ = I("FmForm");
2361
+ return f(), b("div", Yi, [
2362
+ r("div", null, h(i(t)("device.unbindDevice.unbindConfirmationMessage")), 1),
2363
+ r("div", null, [
2364
+ Ct(h(i(t)("device.unbindDevice.confirmationInstructionPart1")) + " ", 1),
2365
+ r("span", Ki, h(e.restaurantName), 1),
2366
+ Ct(" " + h(i(t)("device.unbindDevice.confirmationInstructionPart2")), 1)
2367
+ ]),
2368
+ m(_, null, {
2369
+ default: F(() => [
2370
+ m(p, {
2371
+ modelValue: s.value,
2372
+ "onUpdate:modelValue": c[0] || (c[0] = (y) => s.value = y),
2373
+ rules: [i(be).required(), i(be).matches(e.restaurantName)],
2374
+ required: ""
2375
+ }, null, 8, ["modelValue", "rules"])
2376
+ ]),
2377
+ _: 1
2378
+ })
2379
+ ]);
2380
+ };
2381
+ }
2382
+ });
2383
+ function wt(e) {
2384
+ return e && (e = e.replace(/_/g, " ").toLowerCase(), e.split(" ").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" "));
2385
+ }
2386
+ var Zi = {}, ye = {};
2387
+ Object.defineProperty(ye, "__esModule", { value: !0 });
2388
+ ye.F_DISPLAY_NOTIFICATION_TYPE = ye.F_DISPLAY_ACTION_EVENT = ye.F_DISPLAY_SYSTEM_EVENT = void 0;
2389
+ const Lt = Te;
2390
+ ye.F_DISPLAY_SYSTEM_EVENT = Lt.z.enum([
2391
+ "restaurantInfo",
2392
+ "order",
2393
+ "orders",
2394
+ "action",
2395
+ "notification"
2396
+ ]);
2397
+ ye.F_DISPLAY_ACTION_EVENT = Lt.z.enum([
2398
+ "Serve",
2399
+ "StartCook",
2400
+ "FinishCook",
2401
+ "Close",
2402
+ "bind",
2403
+ "unbind"
2404
+ ]);
2405
+ ye.F_DISPLAY_NOTIFICATION_TYPE = Lt.z.enum([
2406
+ "Information",
2407
+ "Warning",
2408
+ "Error"
2409
+ ]);
2410
+ var vt = {}, le = {};
2411
+ Object.defineProperty(le, "__esModule", { value: !0 });
2412
+ le.F_PRINTER_PRINT_CUSTOMIZE = le.F_PAPER_DIRECTION = le.F_PRINTER_TYPE = le.F_PRINTER_CONNECTOR = le.F_STAR_EMULATION_MODE = void 0;
2413
+ const ot = Te;
2414
+ le.F_STAR_EMULATION_MODE = ot.z.enum([
2415
+ "StarPRNT",
2416
+ "StarLine",
2417
+ "StarGraphic"
2418
+ ]);
2419
+ le.F_PRINTER_CONNECTOR = ot.z.enum([
2420
+ "IP",
2421
+ "USB",
2422
+ "BLUETOOTH",
2423
+ "STAR"
2424
+ ]);
2425
+ le.F_PRINTER_TYPE = ot.z.enum([
2426
+ "ESCPOS",
2427
+ "TSPL",
2428
+ "STAR",
2429
+ "KITCHEN_KDS",
2430
+ "WINDOW_KDS"
2431
+ ]);
2432
+ le.F_PAPER_DIRECTION = ot.z.nativeEnum({
2433
+ NORMAL: "0",
2434
+ REVERSE: "1"
2435
+ });
2436
+ le.F_PRINTER_PRINT_CUSTOMIZE = ot.z.enum([
2437
+ "ALL",
2438
+ "ITEMS",
2439
+ "DEPARTMENTS"
2440
+ ]);
2441
+ Object.defineProperty(vt, "__esModule", { value: !0 });
2442
+ vt.FdoPrinterInfo = void 0;
2443
+ const C = Te, Qi = ft, dt = le;
2444
+ vt.FdoPrinterInfo = C.z.object({
2445
+ _id: C.z.string(),
2446
+ connector: dt.F_PRINTER_CONNECTOR,
2447
+ type: dt.F_PRINTER_TYPE,
2448
+ emulationMode: dt.F_STAR_EMULATION_MODE.nullish(),
2449
+ machineId: C.z.string().nullish(),
2450
+ billPrintTemplateId: C.z.string(),
2451
+ orderPrintTemplateId: C.z.string(),
2452
+ voidPrintTemplateId: C.z.string(),
2453
+ name: C.z.string(),
2454
+ path: C.z.string(),
2455
+ paperWidth: C.z.number(),
2456
+ paperHeight: C.z.number(),
2457
+ paperGapDistance: C.z.number(),
2458
+ paperGapOffset: C.z.number(),
2459
+ paperXReference: C.z.number(),
2460
+ paperYReference: C.z.number(),
2461
+ paperDirection: C.z.string(),
2462
+ dpi: C.z.number(),
2463
+ splitProduct: C.z.number().nullish(),
2464
+ splitQuantity: C.z.number().nullish(),
2465
+ printBill: C.z.boolean(),
2466
+ printCustomItem: C.z.boolean().nullish(),
2467
+ printDineInItem: C.z.boolean().nullish(),
2468
+ printTakeawayItem: C.z.boolean().nullish(),
2469
+ printChangeTable: C.z.boolean().nullish(),
2470
+ printReport: C.z.boolean(),
2471
+ printOrder: C.z.boolean(),
2472
+ printOrderCombine: C.z.boolean().nullish(),
2473
+ printVoid: C.z.boolean(),
2474
+ strikeThroughItem: C.z.boolean().nullish(),
2475
+ printAllProduct: C.z.boolean(),
2476
+ binded: C.z.boolean().nullish(),
2477
+ backupToUsb: C.z.boolean().nullish(),
2478
+ backupPrinterId: C.z.string(),
2479
+ printCustomize: dt.F_PRINTER_PRINT_CUSTOMIZE.nullish(),
2480
+ printingDepartments: C.z.array(C.z.string()).nullish(),
2481
+ printingProducts: C.z.array(C.z.string()),
2482
+ filterSlot: C.z.array(C.z.string()).nullish(),
2483
+ useInternalName: C.z.boolean().nullish(),
2484
+ beepAfterPrint: C.z.boolean().nullish(),
2485
+ chunkSize: C.z.number().nullish(),
2486
+ chunkDelay: C.z.number().nullish(),
2487
+ maxRetry: C.z.number().nullish(),
2488
+ sleepDelay: C.z.number().nullish(),
2489
+ waitForStatus: C.z.boolean().nullish(),
2490
+ printFinishCook: C.z.boolean().nullish(),
2491
+ isTextEncoding: C.z.boolean().nullish()
2492
+ }).describe(Qi.ZodMeta.couch().repo("printerInfo").build());
2493
+ var _t = {};
2494
+ Object.defineProperty(_t, "__esModule", { value: !0 });
2495
+ _t.FdtoFlatItem = void 0;
2496
+ const tn = ln, Ft = Te;
2497
+ _t.FdtoFlatItem = Ft.z.object({
2498
+ itemKey: Ft.z.string(),
2499
+ item: tn.FdoBillItem,
2500
+ parentKey: Ft.z.string().nullish(),
2501
+ parent: tn.FdoBillItem.nullish()
2502
+ });
2503
+ var de = {};
2504
+ Object.defineProperty(de, "__esModule", { value: !0 });
2505
+ de.F_CELL_WIDTH_TYPE = de.F_TEXT_ALIGN = de.F_WIDGET_ALIGNMENT = de.F_WIDGET_TEMPLATE_TYPE = void 0;
2506
+ const gt = Te;
2507
+ de.F_WIDGET_TEMPLATE_TYPE = gt.z.enum([
2508
+ "TEXT",
2509
+ "CHECKBOX",
2510
+ "DIVIDER",
2511
+ "EMPTY",
2512
+ "IMAGE",
2513
+ "QR"
2514
+ ]);
2515
+ de.F_WIDGET_ALIGNMENT = gt.z.enum([
2516
+ "TOP_LEFT",
2517
+ "TOP_CENTER",
2518
+ "TOP_RIGHT",
2519
+ "CENTER_LEFT",
2520
+ "CENTER",
2521
+ "CENTER_RIGHT",
2522
+ "BOTTOM_LEFT",
2523
+ "BOTTOM_CENTER",
2524
+ "BOTTOM_RIGHT"
2525
+ ]);
2526
+ de.F_TEXT_ALIGN = gt.z.enum([
2527
+ "LEFT",
2528
+ "CENTER",
2529
+ "RIGHT"
2530
+ ]);
2531
+ de.F_CELL_WIDTH_TYPE = gt.z.enum([
2532
+ "FLEX",
2533
+ "FIXED"
2534
+ ]);
2535
+ var kn = {};
2536
+ (function(e) {
2537
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.FdtoTicketItem = e.FdtoTicketSubItem = e.FdtoDisplayOrder = e.FdtoDisplayOrderConfig = e.FdtoDisplayNotification = e.FdtoDisplayAction = void 0;
2538
+ const t = ln, n = Te, o = ye;
2539
+ e.FdtoDisplayAction = n.z.object({
2540
+ type: o.F_DISPLAY_ACTION_EVENT,
2541
+ id: n.z.string(),
2542
+ stationName: n.z.string().nullish(),
2543
+ targetIds: n.z.array(n.z.string()).nullish(),
2544
+ undo: n.z.boolean().nullish(),
2545
+ isoDate: n.z.string().nullish()
2546
+ }), e.FdtoDisplayNotification = n.z.object({
2547
+ type: o.F_DISPLAY_NOTIFICATION_TYPE,
2548
+ id: n.z.string(),
2549
+ title: n.z.string().nullish(),
2550
+ header: n.z.string().nullish(),
2551
+ message: n.z.string().nullish(),
2552
+ billId: n.z.string().nullish(),
2553
+ requireAcknowledge: n.z.boolean().nullish()
2554
+ }), e.FdtoDisplayOrderConfig = n.z.object({
2555
+ removeIfExist: n.z.boolean()
2556
+ }), e.FdtoDisplayOrder = n.z.object({
2557
+ config: e.FdtoDisplayOrderConfig,
2558
+ bill: t.FdoBill
2559
+ });
2560
+ const s = n.z.object({
2561
+ id: n.z.string(),
2562
+ label: n.z.string()
2563
+ });
2564
+ e.FdtoTicketSubItem = s.extend({
2565
+ subItems: n.z.array(n.z.lazy(() => e.FdtoTicketSubItem)).optional()
2566
+ }), e.FdtoTicketItem = n.z.object({
2567
+ productId: n.z.string(),
2568
+ itemKey: n.z.string(),
2569
+ subItemKeys: n.z.array(n.z.string()),
2570
+ status: n.z.string(),
2571
+ label: n.z.string(),
2572
+ code: n.z.string(),
2573
+ quantity: n.z.number(),
2574
+ remark: n.z.string(),
2575
+ currency: n.z.string().nullish(),
2576
+ sentAt: n.z.string().nullish(),
2577
+ sentBy: n.z.string().nullish(),
2578
+ startAt: n.z.string().nullish(),
2579
+ finishAt: n.z.string().nullish(),
2580
+ stationFinishAt: n.z.string().nullish(),
2581
+ completedAt: n.z.string().nullish(),
2582
+ servedAt: n.z.string().nullish(),
2583
+ voidReason: n.z.string().nullish(),
2584
+ subItems: n.z.array(e.FdtoTicketSubItem).nullish()
2585
+ });
2586
+ })(kn);
2587
+ var bt = {};
2588
+ (function(e) {
2589
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.FdoEditorGroup = e.FdoAdvanceEditorRow = e.FdoAdvanceEditorColumn = e.FdoFixedCellWidth = e.FdoFlexCellWidth = e.FdoBaseCellWidth = e.FdoEditorConfig = e.FdoQrEditorConfig = e.FdoImageEditorConfig = e.FdoCheckboxEditorConfig = e.FdoDividerEditorConfig = e.FdoTextEditorConfig = e.FdoEmptyEditorConfig = e.FdoBaseEditorConfig = e.FdoCellEdgeInset = void 0;
2590
+ const t = ft, n = Te, o = de;
2591
+ e.FdoCellEdgeInset = n.z.object({
2592
+ top: n.z.number(),
2593
+ right: n.z.number(),
2594
+ bottom: n.z.number(),
2595
+ left: n.z.number()
2596
+ }), e.FdoBaseEditorConfig = n.z.object({
2597
+ type: o.F_WIDGET_TEMPLATE_TYPE,
2598
+ alignment: o.F_WIDGET_ALIGNMENT,
2599
+ padding: e.FdoCellEdgeInset,
2600
+ height: n.z.number().nullish()
2601
+ }).describe(t.ZodMeta.dart().baseUnion({
2602
+ isBaseUnion: !0,
2603
+ unionKey: "type",
2604
+ baseType: "FdoBaseEditorConfig"
2605
+ }).build()), e.FdoEmptyEditorConfig = e.FdoBaseEditorConfig.extend({
2606
+ type: n.z.literal(o.F_WIDGET_TEMPLATE_TYPE.enum.EMPTY)
2607
+ }), e.FdoTextEditorConfig = e.FdoBaseEditorConfig.extend({
2608
+ type: n.z.literal(o.F_WIDGET_TEMPLATE_TYPE.enum.TEXT),
2609
+ textAlign: o.F_TEXT_ALIGN,
2610
+ value: n.z.string(),
2611
+ factor: n.z.number(),
2612
+ isBold: n.z.boolean(),
2613
+ isItalic: n.z.boolean(),
2614
+ isUnderline: n.z.boolean(),
2615
+ isStrikeThrough: n.z.boolean().nullish()
2616
+ }), e.FdoDividerEditorConfig = e.FdoBaseEditorConfig.extend({
2617
+ type: n.z.literal(o.F_WIDGET_TEMPLATE_TYPE.enum.DIVIDER),
2618
+ spacing: n.z.number(),
2619
+ thickness: n.z.number()
2620
+ }), e.FdoCheckboxEditorConfig = e.FdoBaseEditorConfig.extend({
2621
+ type: n.z.literal(o.F_WIDGET_TEMPLATE_TYPE.enum.CHECKBOX),
2622
+ size: n.z.number(),
2623
+ height: n.z.number().nullish()
2624
+ }), e.FdoImageEditorConfig = e.FdoBaseEditorConfig.extend({
2625
+ type: n.z.literal(o.F_WIDGET_TEMPLATE_TYPE.enum.IMAGE),
2626
+ width: n.z.number().nullish(),
2627
+ height: n.z.number().nullish(),
2628
+ imgData: n.z.string()
2629
+ }), e.FdoQrEditorConfig = e.FdoBaseEditorConfig.extend({
2630
+ type: n.z.literal(o.F_WIDGET_TEMPLATE_TYPE.enum.QR),
2631
+ size: n.z.number(),
2632
+ link: n.z.string()
2633
+ }), e.FdoEditorConfig = n.z.object({
2634
+ data: n.z.discriminatedUnion("type", [
2635
+ e.FdoEmptyEditorConfig,
2636
+ e.FdoTextEditorConfig,
2637
+ e.FdoDividerEditorConfig,
2638
+ e.FdoCheckboxEditorConfig,
2639
+ e.FdoImageEditorConfig,
2640
+ e.FdoQrEditorConfig
2641
+ ]).describe(t.ZodMeta.dart().discriminatedUnion({ baseType: "FdoBaseEditorConfig" }).build())
2642
+ }), e.FdoBaseCellWidth = n.z.object({
2643
+ type: o.F_CELL_WIDTH_TYPE
2644
+ }).describe(t.ZodMeta.dart().baseUnion({
2645
+ isBaseUnion: !0,
2646
+ unionKey: "type",
2647
+ baseType: "FdoBaseCellWidth"
2648
+ }).build()), e.FdoFlexCellWidth = e.FdoBaseCellWidth.extend({
2649
+ type: n.z.literal(o.F_CELL_WIDTH_TYPE.enum.FLEX),
2650
+ value: n.z.number()
2651
+ }), e.FdoFixedCellWidth = e.FdoBaseCellWidth.extend({
2652
+ type: n.z.literal(o.F_CELL_WIDTH_TYPE.enum.FIXED),
2653
+ value: n.z.number()
2654
+ }), e.FdoAdvanceEditorColumn = n.z.object({
2655
+ cells: n.z.array(e.FdoEditorConfig),
2656
+ width: n.z.discriminatedUnion("type", [e.FdoFixedCellWidth, e.FdoFlexCellWidth]).describe(t.ZodMeta.dart().discriminatedUnion({ baseType: "FdoBaseCellWidth" }).build()).nullish()
2657
+ }), e.FdoAdvanceEditorRow = n.z.object({
2658
+ columns: n.z.array(e.FdoAdvanceEditorColumn)
2659
+ }), e.FdoEditorGroup = n.z.object({
2660
+ rows: n.z.array(e.FdoAdvanceEditorRow)
2661
+ });
2662
+ })(bt);
2663
+ var Rn = {};
2664
+ (function(e) {
2665
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.FdoOrderTemplateV4 = e.FdoOrderTemplateData = void 0;
2666
+ const t = ft, n = Te, o = bt;
2667
+ e.FdoOrderTemplateData = n.z.object({
2668
+ header: o.FdoEditorGroup,
2669
+ body: o.FdoEditorGroup,
2670
+ footer: o.FdoEditorGroup
2671
+ }), e.FdoOrderTemplateV4 = n.z.object({
2672
+ template: e.FdoOrderTemplateData,
2673
+ fmDefaultVersion: n.z.number().nullish(),
2674
+ _id: n.z.string(),
2675
+ name: n.z.string(),
2676
+ fontSize: n.z.number(),
2677
+ stickerMode: n.z.boolean().nullish()
2678
+ }).describe(t.ZodMeta.couch().repo("printTemplateV4").build());
2679
+ })(Rn);
2680
+ var Dn = {};
2681
+ (function(e) {
2682
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.FdoReceiptTemplate = e.FdoTemplateSection = e.F_RECEIPT_SECTION = e.FdoReceiptInfo = void 0;
2683
+ const t = ft, n = Te, o = bt;
2684
+ e.FdoReceiptInfo = n.z.object({
2685
+ _id: n.z.string(),
2686
+ imgData: n.z.string(),
2687
+ headerText: n.z.string(),
2688
+ needAddress: n.z.boolean(),
2689
+ needPhoneNo: n.z.boolean(),
2690
+ needEmail: n.z.boolean(),
2691
+ invoicePrefix: n.z.string().nullish(),
2692
+ footerText: n.z.string(),
2693
+ footerQr: n.z.string().nullish(),
2694
+ fontSize: n.z.number().nullish(),
2695
+ hideZeroPriceAddon: n.z.boolean().nullish(),
2696
+ hideZeroPriceItem: n.z.boolean().nullish(),
2697
+ hideProductCode: n.z.boolean().nullish(),
2698
+ imgHeight: n.z.number().nullish(),
2699
+ imgWidth: n.z.number().nullish()
2700
+ }).describe(t.ZodMeta.couch().repo("receiptInfo").isSingleDoc().build()), e.F_RECEIPT_SECTION = n.z.enum([
2701
+ "GENERAL",
2702
+ "ITEM",
2703
+ "CALCULATION",
2704
+ "PAYMENT"
2705
+ ]), e.FdoTemplateSection = n.z.object({
2706
+ name: n.z.string(),
2707
+ type: e.F_RECEIPT_SECTION,
2708
+ group: o.FdoEditorGroup
2709
+ }), e.FdoReceiptTemplate = n.z.object({
2710
+ _id: n.z.string(),
2711
+ name: n.z.string(),
2712
+ fontSize: n.z.number(),
2713
+ template: n.z.array(e.FdoTemplateSection)
2714
+ }).describe(t.ZodMeta.couch().repo("receiptTemplate").build());
2715
+ })(Dn);
2716
+ (function(e) {
2717
+ var t = rt && rt.__createBinding || (Object.create ? function(o, s, l, c) {
2718
+ c === void 0 && (c = l);
2719
+ var p = Object.getOwnPropertyDescriptor(s, l);
2720
+ (!p || ("get" in p ? !s.__esModule : p.writable || p.configurable)) && (p = { enumerable: !0, get: function() {
2721
+ return s[l];
2722
+ } }), Object.defineProperty(o, c, p);
2723
+ } : function(o, s, l, c) {
2724
+ c === void 0 && (c = l), o[c] = s[l];
2725
+ }), n = rt && rt.__exportStar || function(o, s) {
2726
+ for (var l in o)
2727
+ l !== "default" && !Object.prototype.hasOwnProperty.call(s, l) && t(s, o, l);
2728
+ };
2729
+ Object.defineProperty(e, "__esModule", { value: !0 }), n(ye, e), n(vt, e), n(_t, e), n(le, e), n(de, e), n(kn, e), n(bt, e), n(Rn, e), n(Dn, e);
2730
+ })(Zi);
2731
+ const Ji = { class: "fm-typo-en-body-md-400" }, ea = { class: "xs:flex-col-reverse flex items-center justify-end gap-8 sm:flex-col-reverse" }, ta = /* @__PURE__ */ Se({
2732
+ __name: "CreateDeviceDialog",
2733
+ setup(e) {
2734
+ const { t } = Ne(), n = Dt(), o = Q(
2735
+ () => n.restaurants.value.map((O) => ({
2736
+ label: O.profile.name,
2737
+ value: O._id
2738
+ })).sort((O, w) => O.label.toLowerCase().localeCompare(w.label.toLowerCase()))
2739
+ ), s = P([]), l = async () => {
2740
+ p.value && (s.value = await ne.getPrinters(p.value), R.value = []);
2741
+ }, c = Q(
2742
+ () => s.value.map((O) => ({
2743
+ label: O.name,
2744
+ value: O._id
2745
+ }))
2746
+ ), p = P(o.value.length === 1 ? o.value[0].value : ""), _ = P(""), y = P(Z.Enum.COUNTER), R = P([]), { emitData: A } = rn(), N = Q(() => ({
2747
+ restaurantId: p.value,
2748
+ name: _.value,
2749
+ type: y.value,
2750
+ printers: R.value
2751
+ }));
2752
+ $e(
2753
+ [p, _, y, R],
2754
+ () => {
2755
+ A(N.value);
2756
+ },
2757
+ { deep: !0 }
2758
+ );
2759
+ const v = P();
2760
+ function E(O) {
2761
+ R.value = O ? c.value.map((w) => w.value) : [];
2762
+ }
2763
+ const z = nt(), x = cn(), { getUserFlagValue: V } = Vn(), $ = async () => {
2764
+ try {
2765
+ const O = (await ne.getDevices(p.value)).filter((G) => G.type != Z.Enum.MAIN), w = await V(p.value, Cn.licensePosCreateSubPos, 3);
2766
+ if (w && O.length >= w) {
2767
+ z.open({
2768
+ message: t("device.status.creation.limitError", { limit: w }),
2769
+ type: "error",
2770
+ position: ee.BOTTOM
2771
+ });
2772
+ return;
2773
+ }
2774
+ await ne.createSubDevice(N.value).then(() => {
2775
+ z.open({
2776
+ message: t("device.status.creation.success", { name: N.value.name }),
2777
+ type: "success",
2778
+ position: ee.BOTTOM
2779
+ });
2780
+ });
2781
+ } catch (O) {
2782
+ z.open({
2783
+ message: t("device.status.creation.error", { error: O }),
2784
+ type: "error",
2785
+ position: ee.BOTTOM
2786
+ });
2787
+ } finally {
2788
+ x.close();
2789
+ }
2790
+ };
2791
+ return $e(R, (O) => {
2792
+ v.value = O.length === c.value.length;
2793
+ }), $e(p, l), (O, w) => {
2794
+ const G = I("FmSelect"), J = I("FmTextField"), ae = I("FmCheckbox"), j = I("FmSpacer"), oe = I("FmButton"), W = I("FmForm");
2795
+ return f(), M(W, {
2796
+ onValidationSuccess: $,
2797
+ class: "flex flex-col gap-5 py-2"
2798
+ }, {
2799
+ default: F(() => [
2800
+ m(G, {
2801
+ modelValue: p.value,
2802
+ "onUpdate:modelValue": w[0] || (w[0] = (B) => p.value = B),
2803
+ label: i(t)("device.creation.fields.restaurant.label"),
2804
+ items: o.value,
2805
+ placeholder: i(t)("device.creation.fields.restaurant.label"),
2806
+ rules: [i(be).required()]
2807
+ }, null, 8, ["modelValue", "label", "items", "placeholder", "rules"]),
2808
+ m(J, {
2809
+ modelValue: _.value,
2810
+ "onUpdate:modelValue": w[1] || (w[1] = (B) => _.value = B),
2811
+ label: i(t)("device.creation.fields.name.label"),
2812
+ placeholder: i(t)("device.creation.fields.name.placeholder"),
2813
+ rules: [i(be).nonEmpty()]
2814
+ }, null, 8, ["modelValue", "label", "placeholder", "rules"]),
2815
+ m(G, {
2816
+ modelValue: y.value,
2817
+ "onUpdate:modelValue": w[2] || (w[2] = (B) => y.value = B),
2818
+ items: [
2819
+ {
2820
+ label: i(t)("device.creation.fields.type.options.counter"),
2821
+ value: i(Z).Enum.COUNTER
2822
+ },
2823
+ {
2824
+ label: i(t)("device.creation.fields.type.options.orderStation"),
2825
+ value: i(Z).Enum.ORDER_STATION
2826
+ }
2827
+ ],
2828
+ label: i(t)("device.creation.fields.type.label"),
2829
+ placeholder: i(t)("device.creation.fields.type.placeholder"),
2830
+ rules: [i(be).required()]
2831
+ }, null, 8, ["modelValue", "items", "label", "placeholder", "rules"]),
2832
+ p.value && c.value.length ? (f(), M(G, {
2833
+ key: 0,
2834
+ multiselect: "",
2835
+ modelValue: R.value,
2836
+ "onUpdate:modelValue": w[4] || (w[4] = (B) => R.value = B),
2837
+ items: c.value,
2838
+ label: i(t)("device.creation.fields.printer.label"),
2839
+ placeholder: i(t)("device.creation.fields.printer.placeholder")
2840
+ }, {
2841
+ "prepend-menu": F(() => [
2842
+ m(ae, {
2843
+ class: "ml-1",
2844
+ indeterminate: R.value.length > 0,
2845
+ "model-value": v.value,
2846
+ "onUpdate:modelValue": w[3] || (w[3] = (B) => E(B)),
2847
+ label: " ",
2848
+ value: !0
2849
+ }, {
2850
+ label: F(() => [
2851
+ r("div", Ji, h(i(t)("device.filters.all")), 1)
2852
+ ]),
2853
+ _: 1
2854
+ }, 8, ["indeterminate", "model-value"])
2855
+ ]),
2856
+ _: 1
2857
+ }, 8, ["modelValue", "items", "label", "placeholder"])) : k("", !0),
2858
+ r("div", ea, [
2859
+ m(j, { class: "xs:hidden sm:hidden" }),
2860
+ m(oe, {
2861
+ class: "xs:w-full sm:w-full",
2862
+ variant: "secondary",
2863
+ label: i(t)("device.actions.cancel"),
2864
+ size: "md",
2865
+ onClick: w[5] || (w[5] = (B) => i(x).close())
2866
+ }, null, 8, ["label"]),
2867
+ m(oe, {
2868
+ class: "xs:w-full sm:w-full",
2869
+ variant: "primary",
2870
+ label: i(t)("device.actions.create"),
2871
+ size: "md",
2872
+ type: "submit"
2873
+ }, null, 8, ["label"])
2874
+ ])
2875
+ ]),
2876
+ _: 1
2877
+ });
2878
+ };
2879
+ }
2880
+ }), na = { class: "flex flex-col p-5 bg-white gap-5" }, oa = { class: "flex items-center" }, sa = { class: "fm-typo-en-title-md-600" }, ia = {
2881
+ key: 0,
2882
+ class: "flex gap-8"
2883
+ }, aa = { class: "flex gap-4 pb-5" }, la = { key: 0 }, ra = { class: "flex flex-col gap-1 overflow-y-auto h-full" }, ca = { class: "flex w-full justify-between" }, ua = { class: "w-full" }, da = { class: "max-w-[250px]" }, ma = { class: "max-h-[310px] overflow-y-auto" }, pa = { class: "w-full" }, fa = { class: "w-[200px]" }, ha = { class: "grow flex flex-col gap-8" }, va = { class: "flex flex-row gap-4 flex-wrap items-center" }, _a = { class: "fm-typo-en-body-lg-600" }, ga = { key: 0 }, ba = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ya = {
2884
+ key: 0,
2885
+ class: "flex gap-8"
2886
+ }, Ta = {
2887
+ key: 0,
2888
+ class: "flex items-center"
2889
+ }, Ia = { class: "flex flex-row gap-4" }, Ea = {
2890
+ key: 3,
2891
+ class: "fixed bottom-72 right-16"
2892
+ }, Da = /* @__PURE__ */ Se({
2893
+ __name: "DeviceList",
2894
+ setup(e) {
2895
+ const { t } = Ne(), { isAtMost: n } = Ot(), o = Dt(), s = an(), l = cn(), c = nt(), p = Q(() => {
2896
+ var a;
2897
+ return (a = o.restaurants.value) == null ? void 0 : a.filter((u) => u.managable);
2898
+ }), _ = Q(() => s.getCustomerDisplayImages()), y = P(!1), R = P([]), A = P([]), N = P([]), v = P(""), E = P(!0), z = async () => {
2899
+ var a;
2900
+ try {
2901
+ const u = await ne.getDevicesFromRestaurants();
2902
+ R.value = u.map((g) => ({
2903
+ ...g,
2904
+ type: g.type ?? "UNASSIGNED",
2905
+ restaurantName: je(g.restaurantId),
2906
+ images: g.type === Z.Enum.MAIN ? Ee(g.restaurantId) : []
2907
+ })), A.value = (a = p.value) == null ? void 0 : a.map((g) => g._id), N.value = O.value.map((g) => g.value);
2908
+ } catch (u) {
2909
+ console.error("Failed to get restaurants devices:", u);
2910
+ }
2911
+ }, x = (a, u) => a.type === Z.Enum.MAIN ? -1 : u.type === Z.Enum.MAIN ? 1 : a.type.toLowerCase() !== u.type.toLowerCase() ? a.type.toLowerCase() > u.type.toLowerCase() ? 1 : -1 : a.createdAt && u.createdAt ? a.createdAt < u.createdAt ? 1 : -1 : 0, V = Q(() => {
2912
+ if (E.value)
2913
+ return [];
2914
+ const a = v.value.toLowerCase(), u = R.value.filter((g) => {
2915
+ const U = A.value.includes(g.restaurantId), fe = N.value.includes(g.type);
2916
+ return U && fe;
2917
+ });
2918
+ return a ? u.filter(
2919
+ (g) => JSON.stringify({ ...g }).toLowerCase().includes(a)
2920
+ ).sort(x) : u.sort(x);
2921
+ }), $ = Q(
2922
+ () => p.value.map((a) => ({
2923
+ label: a.profile.name,
2924
+ value: a._id
2925
+ }))
2926
+ ), O = Q(
2927
+ () => R.value.map((a) => ({
2928
+ label: a.type ? wt(a.type) : a.type,
2929
+ value: a.type
2930
+ })).filter((a, u) => u === R.value.findIndex((g) => a.value === g.type))
2931
+ ), w = (a, u) => {
2932
+ const g = a.indexOf(u.value);
2933
+ g === -1 ? a.push(u.value) : a.splice(g, 1);
2934
+ }, G = (a, u) => {
2935
+ a.splice(0, a.length, ...a.length ? [] : u.map((g) => g.value));
2936
+ }, J = (a, u, g) => {
2937
+ var U;
2938
+ return a.length === 0 ? "" : a.length === u.length ? `${g}: ${t("device.filters.all")}` : a.length === 1 && !n("sm") ? (U = u.find((fe) => fe.value === a[0])) == null ? void 0 : U.label : t("device.filters.selected", { count: a.length });
2939
+ }, ae = (a) => {
2940
+ if (!a.restaurantId)
2941
+ return;
2942
+ const g = `https://grafana.feedme.farm/d/ee5tjb68adwjkb/pos-dashboard-quickwit?orgId=1&var-maxRows=1000&var-severity=All&var-env=dev&var-country=All&var-restaurantId=${a.restaurantId}`;
2943
+ c.open({
2944
+ message: t("device.logs.redirect", { name: a.name ?? je(a.restaurantId) }),
2945
+ type: "success",
2946
+ position: ee.BOTTOM
2947
+ }), setTimeout(() => window.open(g, "_blank"), 500);
2948
+ }, j = async (a) => {
2949
+ a.machineId && await ne.checkDeviceStatus(a.machineId).then(() => {
2950
+ l.open({
2951
+ title: "Download Logs",
2952
+ contentComponent: ji,
2953
+ contentComponentProps: {
2954
+ machineId: a.machineId
2955
+ }
2956
+ });
2957
+ }).catch((u) => {
2958
+ c.open({
2959
+ message: `${u}`,
2960
+ type: "error",
2961
+ position: ee.BOTTOM
2962
+ });
2963
+ });
2964
+ }, oe = (a) => {
2965
+ a.restaurantId && l.open({
2966
+ title: t("device.actions.unbindDevice"),
2967
+ contentComponent: Xi,
2968
+ contentComponentProps: {
2969
+ restaurantName: a.restaurantName
2970
+ },
2971
+ primaryActions: { text: t("device.actions.unbind"), close: !1, variant: "destructive" },
2972
+ secondaryActions: { text: t("device.actions.cancel"), close: !0 }
2973
+ }).onPrimary(async (u) => {
2974
+ u != a.restaurantName || !a.restaurantId || (await ne.unbindDevice(a.restaurantId).catch(async (g) => {
2975
+ if (g === "Restaurant has no machine" && a.machineId)
2976
+ await ne.mdmUnbindDevice(a.machineId);
2977
+ else
2978
+ throw g;
2979
+ }).then(async () => {
2980
+ await me(), c.open({
2981
+ message: t("device.status.unbind.success", { name: u }),
2982
+ type: "success",
2983
+ position: ee.BOTTOM
2984
+ });
2985
+ }).catch((g) => {
2986
+ c.open({
2987
+ message: t("device.error.general", { error: g }),
2988
+ type: "error",
2989
+ position: ee.BOTTOM
2990
+ });
2991
+ }), l.close());
2992
+ });
2993
+ }, W = P(""), B = async (a) => {
2994
+ W.value = "";
2995
+ const u = await ne.generateDeviceOtp(a);
2996
+ W.value = u.machineOtp ?? "";
2997
+ }, Re = async (a) => {
2998
+ a.restaurantId && await B(a.restaurantId).then(() => {
2999
+ l.open({
3000
+ title: t("device.actions.bindDevice"),
3001
+ contentComponent: Wn,
3002
+ contentComponentProps: {
3003
+ restaurantId: a.restaurantId,
3004
+ get otp() {
3005
+ return W.value;
3006
+ },
3007
+ "onUpdate:otp"(u) {
3008
+ W.value = u;
3009
+ }
3010
+ },
3011
+ primaryActions: { text: t("device.actions.regenerate"), close: !1 },
3012
+ secondaryActions: { text: t("device.actions.cancel"), close: !0 }
3013
+ }).onPrimary(async () => {
3014
+ a.restaurantId && await B(a.restaurantId);
3015
+ }).onClose(async () => {
3016
+ await me();
3017
+ let u = R.value.find(
3018
+ (g) => g.restaurantId === a.restaurantId && g.type === Z.Enum.MAIN && g.machineId
3019
+ );
3020
+ u && u.restaurantId && c.open({
3021
+ message: t("device.status.bind.success", { name: a.restaurantName }),
3022
+ type: "success",
3023
+ position: ee.BOTTOM
3024
+ });
3025
+ });
3026
+ }).catch((u) => {
3027
+ c.open({
3028
+ message: t("device.error.general", { error: u }),
3029
+ type: "error",
3030
+ position: ee.BOTTOM
3031
+ });
3032
+ });
3033
+ }, st = () => {
3034
+ l.open({
3035
+ title: t("device.actions.forceSync"),
3036
+ message: t("device.status.sync.confirmation"),
3037
+ primaryActions: { text: t("device.actions.confirm"), close: !0, variant: "destructive" },
3038
+ secondaryActions: { text: t("device.actions.cancel"), close: !0 }
3039
+ }).onPrimary(async () => {
3040
+ l.close();
3041
+ const a = c.open({
3042
+ message: t("device.status.sync.inProgress"),
3043
+ spinner: !0,
3044
+ type: "info",
3045
+ position: ee.BOTTOM
3046
+ });
3047
+ await ne.forceSync().then(async () => {
3048
+ await me(), setTimeout(() => {
3049
+ c.updateSnackbar(a, {
3050
+ message: t("device.status.sync.success"),
3051
+ spinner: !1,
3052
+ type: "success",
3053
+ position: ee.BOTTOM
3054
+ });
3055
+ }, 500);
3056
+ }).catch((u) => {
3057
+ c.updateSnackbar(a, {
3058
+ message: t("device.status.sync.error", { error: u }),
3059
+ spinner: !1,
3060
+ type: "error",
3061
+ position: ee.BOTTOM
3062
+ });
3063
+ });
3064
+ });
3065
+ }, je = (a) => {
3066
+ var u, g;
3067
+ return (g = (u = p.value) == null ? void 0 : u.find((U) => U._id === a)) == null ? void 0 : g.profile.name;
3068
+ }, Ie = (a) => new Date(a).toLocaleDateString("en-GB", {
3069
+ day: "2-digit",
3070
+ month: "short",
3071
+ year: "numeric",
3072
+ hour: "2-digit",
3073
+ minute: "2-digit",
3074
+ hour12: !0
3075
+ }).toUpperCase().split(","), Ee = (a) => _.value.filter((u) => u.restaurantIds.includes(a)).map((u) => u.url), d = (a) => a.slice(0, 3), S = (a) => {
3076
+ const u = [
3077
+ { label: t("device.menu.logs"), value: "logs", onClick: () => ae(a) },
3078
+ { label: "Download logs", value: "download_logs", onClick: () => j(a) }
3079
+ ];
3080
+ return a.deviceId && u.push({
3081
+ label: t("device.menu.configurations"),
3082
+ value: "configurations",
3083
+ onClick: () => {
3084
+ De.value = a, pe.value = !0;
3085
+ }
3086
+ }), u;
3087
+ }, Y = [
3088
+ {
3089
+ id: "deviceName",
3090
+ accessorKey: "name",
3091
+ header: () => t("device.table.columns.deviceName"),
3092
+ cell: (a) => {
3093
+ let u = a.row.original, g = u.name;
3094
+ return a.row.original.type === Z.Enum.MAIN && (g = u.restaurantName), X("div", { class: "text-ellipsis overflow-hidden text-balance" }, g ?? "-");
3095
+ },
3096
+ meta: {
3097
+ width: "220px"
3098
+ }
3099
+ },
3100
+ {
3101
+ id: "displayImage",
3102
+ accessorKey: "images",
3103
+ header: () => t("device.table.columns.displayImage"),
3104
+ cell(a) {
3105
+ const u = d(a.getValue()), g = a.getValue().length - u.length;
3106
+ return u.length > 0 ? X("div", { class: "flex gap-8" }, [
3107
+ ...u.map(
3108
+ (U) => X(Me.FmThumbnail, {
3109
+ src: U,
3110
+ size: n("sm") ? "sm" : "md",
3111
+ key: U
3112
+ })
3113
+ ),
3114
+ g > 0 && X("span", { class: "flex items-center" }, `+${g}`)
3115
+ ]) : X("div", "-");
3116
+ },
3117
+ meta: {
3118
+ width: "220px"
3119
+ }
3120
+ },
3121
+ {
3122
+ id: "restaurantName",
3123
+ accessorKey: "restaurantName",
3124
+ header: () => t("device.table.columns.restaurantName"),
3125
+ cell: (a) => X("div", { class: "text-ellipsis overflow-hidden text-balance" }, a.getValue()),
3126
+ meta: {
3127
+ width: "220px"
3128
+ }
3129
+ },
3130
+ {
3131
+ accessorKey: "type",
3132
+ header: () => t("device.table.columns.deviceType"),
3133
+ cell(a) {
3134
+ return X(
3135
+ "div",
3136
+ X(Me.FmChip, {
3137
+ variant: "plain",
3138
+ label: wt(a.getValue()),
3139
+ compact: !0
3140
+ })
3141
+ );
3142
+ },
3143
+ meta: {
3144
+ width: "160px"
3145
+ }
3146
+ },
3147
+ {
3148
+ accessorKey: "bindAt",
3149
+ header: () => t("device.table.columns.bindingAt"),
3150
+ cell: (a) => {
3151
+ if (a.getValue()) {
3152
+ const [u, g] = Ie(a.getValue());
3153
+ return X("div", [X("div", u), X("div", g)]);
3154
+ }
3155
+ return X("div", "-");
3156
+ },
3157
+ meta: {
3158
+ width: "140px"
3159
+ }
3160
+ },
3161
+ {
3162
+ id: "bind-device",
3163
+ cell(a) {
3164
+ let u = a.row.original;
3165
+ const g = !!u.machineId;
3166
+ if (u.type === Z.Enum.MAIN)
3167
+ return X(
3168
+ "div",
3169
+ { class: "flex items-center justify-center" },
3170
+ X(Me.FmButton, {
3171
+ prependIcon: g ? "link_off" : "link",
3172
+ variant: "secondary",
3173
+ label: n("sm") ? void 0 : t(g ? "device.actions.unbindDevice" : "device.actions.bindDevice"),
3174
+ onClick(U) {
3175
+ U.stopPropagation(), g ? oe(u) : Re(u);
3176
+ }
3177
+ })
3178
+ );
3179
+ },
3180
+ meta: {
3181
+ width: "235px"
3182
+ }
3183
+ },
3184
+ {
3185
+ id: "logs",
3186
+ cell(a) {
3187
+ var g;
3188
+ let u = a.row.original;
3189
+ return (g = o.sessionUser.value) != null && g.role.isAdmin ? X(
3190
+ "div",
3191
+ X(
3192
+ Me.FmMenu,
3193
+ {
3194
+ stopClickPropagation: !0,
3195
+ shift: !0,
3196
+ placement: "bottom-end",
3197
+ width: 180,
3198
+ minHeight: 3e3
3199
+ },
3200
+ {
3201
+ default: () => S(u).map(
3202
+ (U) => X(Me.FmMenuItem, {
3203
+ key: U.value,
3204
+ label: U.label,
3205
+ onClick: U.onClick
3206
+ })
3207
+ ),
3208
+ "menu-button": () => X(Me.FmButton, {
3209
+ variant: "tertiary",
3210
+ prependIcon: "more_vert"
3211
+ })
3212
+ }
3213
+ )
3214
+ ) : null;
3215
+ },
3216
+ meta: {
3217
+ width: "1px"
3218
+ }
3219
+ }
3220
+ ], K = P(""), ce = Q(
3221
+ () => $.value.filter(
3222
+ (a) => K.value ? a.label.toLowerCase().includes(K.value.toLowerCase()) : !0
3223
+ )
3224
+ ), it = () => {
3225
+ l.open({
3226
+ title: t("device.creation.title"),
3227
+ contentComponent: ta
3228
+ }).onClose(async () => {
3229
+ await me();
3230
+ });
3231
+ }, Pe = P(!1), we = P(!1), Fe = P(), me = async () => {
3232
+ E.value = !0, await o.readRestaurants(), await z(), await sn(), E.value = !1;
3233
+ }, { currentBusinessWithDisplayImages: at } = $n(s), yt = Q(() => o.currentBusiness.value);
3234
+ $e(we, async (a) => {
3235
+ var u;
3236
+ a && ((u = Fe.value) == null ? void 0 : u.type) === Z.Enum.MAIN && (Fe.value = void 0, await me()), we.value = !1;
3237
+ });
3238
+ const De = P(), pe = P(!1);
3239
+ return $e(pe, (a) => {
3240
+ a || (De.value = void 0);
3241
+ }), pt(async () => {
3242
+ at.value = yt.value, await me(), await ne.forceSync();
3243
+ }), (a, u) => {
3244
+ const g = I("FmSpacer"), U = I("FmButton"), fe = I("FmListItem"), qe = I("FmList"), lt = I("FmBottomSheet"), xe = I("FmMenuDivider"), Le = I("FmSearch"), Ue = I("FmChip"), Ce = I("FmMenuItem"), D = I("FmMenu"), L = I("FmTableToolbar"), he = I("FmTable"), ve = I("FmThumbnail"), Oe = I("FmCircularProgress");
3245
+ return f(), b("div", na, [
3246
+ r("div", oa, [
3247
+ r("div", sa, h(i(t)("device.title")), 1),
3248
+ m(g),
3249
+ i(n)("sm") ? k("", !0) : (f(), b("div", ia, [
3250
+ m(U, {
3251
+ bgColor: "neutral-gray-100",
3252
+ textColor: "typo-secondary",
3253
+ label: i(t)("device.actions.refresh"),
3254
+ variant: "tertiary",
3255
+ onClick: me
3256
+ }, null, 8, ["label"]),
3257
+ m(U, {
3258
+ bgColor: "neutral-gray-100",
3259
+ textColor: "typo-secondary",
3260
+ label: i(t)("device.actions.forceSync"),
3261
+ variant: "tertiary",
3262
+ onClick: st
3263
+ }, null, 8, ["label"]),
3264
+ m(U, {
3265
+ icon: "add",
3266
+ label: i(t)("device.actions.addDevice"),
3267
+ variant: "primary",
3268
+ onClick: it
3269
+ }, null, 8, ["label"])
3270
+ ])),
3271
+ i(n)("sm") ? (f(), M(U, {
3272
+ key: 1,
3273
+ "prepend-icon": "more_vert",
3274
+ variant: "tertiary",
3275
+ onClick: u[0] || (u[0] = (T) => y.value = !0)
3276
+ })) : k("", !0),
3277
+ m(lt, {
3278
+ zIndex: 100,
3279
+ modelValue: y.value,
3280
+ "onUpdate:modelValue": u[1] || (u[1] = (T) => y.value = T),
3281
+ "dismiss-away": "",
3282
+ "no-header": ""
3283
+ }, {
3284
+ default: F(() => [
3285
+ r("div", aa, [
3286
+ m(qe, { class: "w-full" }, {
3287
+ default: F(() => [
3288
+ m(fe, {
3289
+ label: i(t)("device.actions.refresh"),
3290
+ onClick: me
3291
+ }, null, 8, ["label"]),
3292
+ m(fe, {
3293
+ label: i(t)("device.actions.forceSync"),
3294
+ onClick: st
3295
+ }, null, 8, ["label"])
3296
+ ]),
3297
+ _: 1
3298
+ })
3299
+ ])
3300
+ ]),
3301
+ _: 1
3302
+ }, 8, ["modelValue"])
3303
+ ]),
3304
+ i(n)("sm") ? (f(), b("div", la, [
3305
+ m(xe),
3306
+ m(Le, {
3307
+ modelValue: v.value,
3308
+ "onUpdate:modelValue": u[2] || (u[2] = (T) => v.value = T),
3309
+ placeholder: i(t)("device.actions.search")
3310
+ }, null, 8, ["modelValue", "placeholder"]),
3311
+ m(xe)
3312
+ ])) : k("", !0),
3313
+ r("div", ra, [
3314
+ m(L, { class: "gap-x-0" }, {
3315
+ chips: F(() => [
3316
+ r("div", ca, [
3317
+ r("div", {
3318
+ class: on(["flex flex-row gap-2 mb-4 items-end", i(n)("sm") ? "w-full justify-between" : ""])
3319
+ }, [
3320
+ r("div", ua, [
3321
+ m(D, { "close-on-click": !1 }, {
3322
+ "menu-button": F(() => [
3323
+ m(Ue, {
3324
+ label: J(A.value, $.value, i(t)("device.filters.restaurant.label")),
3325
+ icon: "storefront",
3326
+ "right-icon": "keyboard_arrow_down",
3327
+ class: "fm-typo-en-body-md-600 text-fm-color-neutral-gray-400 w-full"
3328
+ }, null, 8, ["label"])
3329
+ ]),
3330
+ default: F(() => [
3331
+ r("div", da, [
3332
+ m(Le, {
3333
+ "model-value": K.value,
3334
+ "onUpdate:modelValue": u[3] || (u[3] = (T) => K.value = T),
3335
+ placeholder: i(t)("device.filters.restaurant.search"),
3336
+ collapsible: !1
3337
+ }, null, 8, ["model-value", "placeholder"]),
3338
+ m(xe),
3339
+ r("div", ma, [
3340
+ m(Ce, {
3341
+ "model-value": A.value.length === $.value.length,
3342
+ label: i(t)("device.filters.all"),
3343
+ "has-checkbox": !0,
3344
+ indeterminate: A.value.length > 0,
3345
+ onClick: u[4] || (u[4] = () => G(A.value, $.value))
3346
+ }, null, 8, ["model-value", "label", "indeterminate"]),
3347
+ (f(!0), b(ie, null, ue(ce.value, (T, te) => (f(), M(Ce, {
3348
+ key: te,
3349
+ "model-value": !!A.value.find((ge) => ge === T.value),
3350
+ label: T.label,
3351
+ "has-checkbox": !0,
3352
+ onClick: () => w(A.value, T)
3353
+ }, null, 8, ["model-value", "label", "onClick"]))), 128))
3354
+ ])
3355
+ ])
3356
+ ]),
3357
+ _: 1
3358
+ })
3359
+ ]),
3360
+ r("div", pa, [
3361
+ m(D, { "close-on-click": !1 }, {
3362
+ "menu-button": F(() => [
3363
+ m(Ue, {
3364
+ label: J(N.value, O.value, i(t)("device.filters.deviceType")),
3365
+ icon: "monitor",
3366
+ "right-icon": "keyboard_arrow_down",
3367
+ class: "fm-typo-en-body-md-600 text-fm-color-neutral-gray-400 w-full"
3368
+ }, null, 8, ["label"])
3369
+ ]),
3370
+ default: F(() => [
3371
+ r("div", fa, [
3372
+ m(Ce, {
3373
+ "model-value": N.value.length === O.value.length,
3374
+ label: i(t)("device.filters.all"),
3375
+ "has-checkbox": !0,
3376
+ indeterminate: N.value.length > 0,
3377
+ onClick: u[5] || (u[5] = () => G(N.value, O.value))
3378
+ }, null, 8, ["model-value", "label", "indeterminate"]),
3379
+ (f(!0), b(ie, null, ue(O.value, (T, te) => (f(), M(Ce, {
3380
+ key: te,
3381
+ "model-value": !!N.value.find((ge) => ge === T.value),
3382
+ label: T.label ?? "",
3383
+ "has-checkbox": !0,
3384
+ onClick: () => w(N.value, T)
3385
+ }, null, 8, ["model-value", "label", "onClick"]))), 128))
3386
+ ])
3387
+ ]),
3388
+ _: 1
3389
+ })
3390
+ ])
3391
+ ], 2),
3392
+ i(n)("sm") ? k("", !0) : (f(), M(Le, {
3393
+ key: 0,
3394
+ "model-value": v.value,
3395
+ "onUpdate:modelValue": u[6] || (u[6] = (T) => v.value = T),
3396
+ placeholder: i(t)("device.actions.search"),
3397
+ collapsible: !1,
3398
+ class: "w-[343px]"
3399
+ }, null, 8, ["model-value", "placeholder"]))
3400
+ ])
3401
+ ]),
3402
+ _: 1
3403
+ }),
3404
+ i(n)("sm") ? k("", !0) : (f(), M(he, {
3405
+ key: 0,
3406
+ "shrink-at": !1,
3407
+ "auto-reset-page-index": !0,
3408
+ class: "flex-1 overflow-y-auto",
3409
+ "column-defs": Y,
3410
+ "row-data": V.value,
3411
+ loading: E.value,
3412
+ "hide-footer": V.value.length < 11,
3413
+ "on-row-click": (T) => {
3414
+ Fe.value = T.original, Pe.value = !0;
3415
+ }
3416
+ }, null, 8, ["row-data", "loading", "hide-footer", "on-row-click"])),
3417
+ i(n)("sm") && !E.value ? (f(), M(qe, {
3418
+ key: 1,
3419
+ class: "w-full",
3420
+ separator: ""
3421
+ }, {
3422
+ default: F(() => [
3423
+ (f(!0), b(ie, null, ue(V.value, (T) => (f(), M(fe, {
3424
+ key: T._id,
3425
+ style: { padding: "12px 0 !important" },
3426
+ onClick: () => {
3427
+ Fe.value = T, Pe.value = !0;
3428
+ }
3429
+ }, {
3430
+ default: F(() => [
3431
+ r("div", ha, [
3432
+ r("div", va, [
3433
+ m(Ue, {
3434
+ label: i(wt)(T.type),
3435
+ variant: "plain",
3436
+ compact: ""
3437
+ }, null, 8, ["label"])
3438
+ ]),
3439
+ r("div", _a, [
3440
+ Ct(h(T.restaurantName) + " ", 1),
3441
+ T.type != i(Z).Enum.MAIN ? (f(), b("span", ga, " - " + h(T.name), 1)) : k("", !0)
3442
+ ]),
3443
+ r("div", ba, h(Ie(T.createdAt)[0]) + " " + h(Ie(T.createdAt)[1]), 1),
3444
+ _.value.length && T.type === i(Z).Enum.MAIN ? (f(), b("div", ya, [
3445
+ (f(!0), b(ie, null, ue(d(Ee(T.restaurantId)), (te) => (f(), b("div", { key: te }, [
3446
+ m(ve, {
3447
+ src: te,
3448
+ size: "md"
3449
+ }, null, 8, ["src"])
3450
+ ]))), 128)),
3451
+ Ee(T.restaurantId).length - d(Ee(T.restaurantId)).length > 0 ? (f(), b("span", Ta, "+" + h(Ee(T.restaurantId).length - d(Ee(T.restaurantId)).length), 1)) : k("", !0)
3452
+ ])) : k("", !0)
3453
+ ]),
3454
+ r("div", Ia, [
3455
+ T.type === i(Z).Enum.MAIN ? (f(), M(U, {
3456
+ key: 0,
3457
+ "prepend-icon": T.machineId ? "link_off" : "link",
3458
+ variant: "tertiary",
3459
+ onClick: Rt(() => T.machineId ? oe(T) : Re(T), ["stop"])
3460
+ }, null, 8, ["prepend-icon", "onClick"])) : k("", !0),
3461
+ m(D, {
3462
+ stopClickPropagation: !0,
3463
+ shift: "",
3464
+ placement: "bottom-end",
3465
+ width: 180,
3466
+ minHeight: 3e3
3467
+ }, {
3468
+ "menu-button": F(() => [
3469
+ m(U, {
3470
+ variant: "tertiary",
3471
+ prependIcon: "more_vert"
3472
+ })
3473
+ ]),
3474
+ default: F(() => [
3475
+ (f(!0), b(ie, null, ue(S(T), (te) => (f(), M(Ce, {
3476
+ key: te.value,
3477
+ label: te.label,
3478
+ onClick: te.onClick
3479
+ }, null, 8, ["label", "onClick"]))), 128))
3480
+ ]),
3481
+ _: 2
3482
+ }, 1024)
3483
+ ])
3484
+ ]),
3485
+ _: 2
3486
+ }, 1032, ["onClick"]))), 128))
3487
+ ]),
3488
+ _: 1
3489
+ })) : (f(), M(Oe, {
3490
+ key: 2,
3491
+ class: "hidden sm:block xs:block"
3492
+ })),
3493
+ i(n)("sm") ? (f(), b("div", Ea, [
3494
+ m(U, {
3495
+ icon: "add",
3496
+ label: i(t)("device.actions.addDevice"),
3497
+ onClick: it,
3498
+ size: "lg"
3499
+ }, null, 8, ["label"])
3500
+ ])) : k("", !0)
3501
+ ]),
3502
+ (f(), M(An, { to: "body" }, [
3503
+ Fe.value ? (f(), M(Si, {
3504
+ key: 0,
3505
+ visible: Pe.value,
3506
+ "onUpdate:visible": u[7] || (u[7] = (T) => Pe.value = T),
3507
+ device: Fe.value,
3508
+ devices: R.value,
3509
+ "form-updated": we.value,
3510
+ "onUpdate:formUpdated": u[8] || (u[8] = (T) => we.value = T)
3511
+ }, null, 8, ["visible", "device", "devices", "form-updated"])) : k("", !0),
3512
+ De.value && De.value.deviceId ? (f(), M(Wi, {
3513
+ key: 1,
3514
+ visible: pe.value,
3515
+ "onUpdate:visible": u[9] || (u[9] = (T) => pe.value = T),
3516
+ device: De.value
3517
+ }, null, 8, ["visible", "device"])) : k("", !0)
3518
+ ]))
3519
+ ]);
3520
+ };
3521
+ }
3522
+ });
3523
+ export {
3524
+ Da as default
3525
+ };