@feedmepos/mf-mdm 1.6.10-beta.261 → 1.6.10-beta.263

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