@tabl.io/auth 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +27 -0
- package/dist/index.js +707 -625
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { create as
|
|
1
|
+
import { create as R3 } from "zustand";
|
|
2
2
|
import { persist as V3 } from "zustand/middleware";
|
|
3
3
|
import { useEffect as Z, useRef as J, useState as e3 } from "react";
|
|
4
4
|
import { Loader2 as v3, QrCode as H3, WifiOff as $3 } from "lucide-react";
|
|
5
|
-
import { Fragment as u3, jsx as
|
|
5
|
+
import { Fragment as u3, jsx as T, jsxs as U } from "react/jsx-runtime";
|
|
6
6
|
import { createClient as W3 } from "@supabase/supabase-js";
|
|
7
|
-
var J3 = Object.create,
|
|
7
|
+
var J3 = Object.create, L3 = Object.defineProperty, Y3 = Object.getOwnPropertyDescriptor, Z3 = Object.getOwnPropertyNames, e2 = Object.getPrototypeOf, t2 = Object.prototype.hasOwnProperty, r2 = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), o2 = (e, t, r, o) => {
|
|
8
8
|
if (t && typeof t == "object" || typeof t == "function")
|
|
9
|
-
for (var
|
|
10
|
-
s =
|
|
9
|
+
for (var i = Z3(t), d = 0, a = i.length, s; d < a; d++)
|
|
10
|
+
s = i[d], !t2.call(e, s) && s !== r && L3(e, s, {
|
|
11
11
|
get: ((k) => t[k]).bind(null, s),
|
|
12
12
|
enumerable: !(o = Y3(t, s)) || o.enumerable
|
|
13
13
|
});
|
|
14
14
|
return e;
|
|
15
|
-
}, s2 = (e, t, r) => (r = e != null ? J3(e2(e)) : {}, o2(t || !e || !e.__esModule ?
|
|
15
|
+
}, s2 = (e, t, r) => (r = e != null ? J3(e2(e)) : {}, o2(t || !e || !e.__esModule ? L3(r, "default", {
|
|
16
16
|
value: e,
|
|
17
17
|
enumerable: !0
|
|
18
18
|
}) : r, e)), b3 = {
|
|
@@ -27,7 +27,7 @@ function m3(e) {
|
|
|
27
27
|
const t = e?.role;
|
|
28
28
|
return t === "manager" || t === "cashier" || t === "supervisor" ? t : null;
|
|
29
29
|
}
|
|
30
|
-
const D3 =
|
|
30
|
+
const D3 = R3()((e) => ({
|
|
31
31
|
user: null,
|
|
32
32
|
role: null,
|
|
33
33
|
isInitializing: !0,
|
|
@@ -42,10 +42,10 @@ const D3 = T3()((e) => ({
|
|
|
42
42
|
isInitializing: !1
|
|
43
43
|
}) : e({ isInitializing: !1 });
|
|
44
44
|
});
|
|
45
|
-
const { data: { subscription: r } } = t.auth.onAuthStateChange((o,
|
|
46
|
-
|
|
47
|
-
user:
|
|
48
|
-
role: m3(
|
|
45
|
+
const { data: { subscription: r } } = t.auth.onAuthStateChange((o, i) => {
|
|
46
|
+
i?.user ? e({
|
|
47
|
+
user: i.user,
|
|
48
|
+
role: m3(i.user.app_metadata),
|
|
49
49
|
isAuthenticated: !0,
|
|
50
50
|
isInitializing: !1,
|
|
51
51
|
error: null
|
|
@@ -60,13 +60,13 @@ const D3 = T3()((e) => ({
|
|
|
60
60
|
},
|
|
61
61
|
signIn: async (t, r, o) => {
|
|
62
62
|
e({ error: null });
|
|
63
|
-
const { data:
|
|
63
|
+
const { data: i, error: d } = await t.auth.signInWithPassword({
|
|
64
64
|
email: r,
|
|
65
65
|
password: o
|
|
66
66
|
});
|
|
67
67
|
if (d)
|
|
68
68
|
throw e({ error: d.message }), d;
|
|
69
|
-
if (!m3(
|
|
69
|
+
if (!m3(i.user?.app_metadata)) {
|
|
70
70
|
await t.auth.signOut();
|
|
71
71
|
const a = "Usuário sem permissão de acesso.";
|
|
72
72
|
throw e({ error: a }), new Error(a);
|
|
@@ -75,7 +75,7 @@ const D3 = T3()((e) => ({
|
|
|
75
75
|
signOut: async (t) => {
|
|
76
76
|
await t.auth.signOut();
|
|
77
77
|
}
|
|
78
|
-
})), a2 =
|
|
78
|
+
})), a2 = R3()(V3((e, t) => ({
|
|
79
79
|
deviceId: crypto.randomUUID(),
|
|
80
80
|
deviceSessionId: null,
|
|
81
81
|
session: null,
|
|
@@ -88,9 +88,9 @@ const D3 = T3()((e) => ({
|
|
|
88
88
|
error: null
|
|
89
89
|
});
|
|
90
90
|
try {
|
|
91
|
-
const { deviceId:
|
|
91
|
+
const { deviceId: i } = t(), { data: d, error: a } = await o.functions.invoke("session/connect", { body: {
|
|
92
92
|
otp: r.replace(/-/g, ""),
|
|
93
|
-
deviceId:
|
|
93
|
+
deviceId: i
|
|
94
94
|
} });
|
|
95
95
|
if (a) throw a;
|
|
96
96
|
const s = typeof d == "string" ? JSON.parse(d) : d, { error: k } = await o.auth.setSession({
|
|
@@ -105,10 +105,10 @@ const D3 = T3()((e) => ({
|
|
|
105
105
|
isConnecting: !1,
|
|
106
106
|
error: null
|
|
107
107
|
});
|
|
108
|
-
} catch (
|
|
109
|
-
let d =
|
|
108
|
+
} catch (i) {
|
|
109
|
+
let d = i.message ?? "Erro ao conectar";
|
|
110
110
|
try {
|
|
111
|
-
const a = await
|
|
111
|
+
const a = await i.context?.json?.();
|
|
112
112
|
a?.error && (d = a.error);
|
|
113
113
|
} catch {
|
|
114
114
|
}
|
|
@@ -137,7 +137,7 @@ const D3 = T3()((e) => ({
|
|
|
137
137
|
})
|
|
138
138
|
}));
|
|
139
139
|
function _3() {
|
|
140
|
-
const { user: e, role: t, isInitializing: r, isAuthenticated: o, error:
|
|
140
|
+
const { user: e, role: t, isInitializing: r, isAuthenticated: o, error: i } = D3();
|
|
141
141
|
function d(a) {
|
|
142
142
|
return t ? n2(t, a) : !1;
|
|
143
143
|
}
|
|
@@ -146,35 +146,35 @@ function _3() {
|
|
|
146
146
|
role: t,
|
|
147
147
|
isInitializing: r,
|
|
148
148
|
isAuthenticated: o,
|
|
149
|
-
error:
|
|
149
|
+
error: i,
|
|
150
150
|
can: d
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
|
-
function
|
|
154
|
-
const { isInitializing: r, isAuthenticated: o, can:
|
|
153
|
+
function H2(e, t) {
|
|
154
|
+
const { isInitializing: r, isAuthenticated: o, can: i } = _3();
|
|
155
155
|
Z(() => {
|
|
156
|
-
r || (!o || !
|
|
156
|
+
r || (!o || !i(e)) && t();
|
|
157
157
|
}, [
|
|
158
158
|
r,
|
|
159
159
|
o,
|
|
160
160
|
e
|
|
161
161
|
]);
|
|
162
162
|
}
|
|
163
|
-
function
|
|
164
|
-
const { signIn: o, error:
|
|
165
|
-
return /* @__PURE__ */
|
|
163
|
+
function $2({ supabase: e, moduleName: t, logo: r }) {
|
|
164
|
+
const { signIn: o, error: i } = D3(), [d, a] = e3(""), [s, k] = e3(""), [p, u] = e3(!1);
|
|
165
|
+
return /* @__PURE__ */ T("div", {
|
|
166
166
|
className: "flex min-h-screen flex-col items-center justify-center bg-background p-4",
|
|
167
167
|
children: /* @__PURE__ */ U("div", {
|
|
168
168
|
className: "w-full max-w-sm space-y-8",
|
|
169
169
|
children: [/* @__PURE__ */ U("div", {
|
|
170
170
|
className: "flex flex-col items-center gap-3 text-center",
|
|
171
|
-
children: [r && /* @__PURE__ */
|
|
171
|
+
children: [r && /* @__PURE__ */ T("div", {
|
|
172
172
|
className: "mb-2",
|
|
173
173
|
children: r
|
|
174
|
-
}), /* @__PURE__ */ U("div", { children: [/* @__PURE__ */
|
|
174
|
+
}), /* @__PURE__ */ U("div", { children: [/* @__PURE__ */ T("p", {
|
|
175
175
|
className: "text-xs font-bold uppercase tracking-widest text-muted-foreground",
|
|
176
176
|
children: "tabl.io"
|
|
177
|
-
}), /* @__PURE__ */
|
|
177
|
+
}), /* @__PURE__ */ T("h1", {
|
|
178
178
|
className: "text-2xl font-bold",
|
|
179
179
|
children: t
|
|
180
180
|
})] })]
|
|
@@ -182,21 +182,21 @@ function q2({ supabase: e, moduleName: t, logo: r }) {
|
|
|
182
182
|
className: "rounded-xl border bg-card p-6 shadow-sm space-y-4",
|
|
183
183
|
children: [/* @__PURE__ */ U("div", {
|
|
184
184
|
className: "space-y-1",
|
|
185
|
-
children: [/* @__PURE__ */
|
|
185
|
+
children: [/* @__PURE__ */ T("h2", {
|
|
186
186
|
className: "text-base font-semibold",
|
|
187
187
|
children: "Entrar"
|
|
188
|
-
}), /* @__PURE__ */
|
|
188
|
+
}), /* @__PURE__ */ T("p", {
|
|
189
189
|
className: "text-sm text-muted-foreground",
|
|
190
190
|
children: "Use suas credenciais de acesso"
|
|
191
191
|
})]
|
|
192
192
|
}), /* @__PURE__ */ U("form", {
|
|
193
193
|
onSubmit: async (m) => {
|
|
194
194
|
if (m.preventDefault(), !(!d || !s)) {
|
|
195
|
-
|
|
195
|
+
u(!0);
|
|
196
196
|
try {
|
|
197
197
|
await o(e, d, s);
|
|
198
198
|
} finally {
|
|
199
|
-
|
|
199
|
+
u(!1);
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
},
|
|
@@ -204,11 +204,11 @@ function q2({ supabase: e, moduleName: t, logo: r }) {
|
|
|
204
204
|
children: [
|
|
205
205
|
/* @__PURE__ */ U("div", {
|
|
206
206
|
className: "space-y-1.5",
|
|
207
|
-
children: [/* @__PURE__ */
|
|
207
|
+
children: [/* @__PURE__ */ T("label", {
|
|
208
208
|
htmlFor: "email",
|
|
209
209
|
className: "text-sm font-medium",
|
|
210
210
|
children: "E-mail"
|
|
211
|
-
}), /* @__PURE__ */
|
|
211
|
+
}), /* @__PURE__ */ T("input", {
|
|
212
212
|
id: "email",
|
|
213
213
|
type: "email",
|
|
214
214
|
autoComplete: "email",
|
|
@@ -223,11 +223,11 @@ function q2({ supabase: e, moduleName: t, logo: r }) {
|
|
|
223
223
|
}),
|
|
224
224
|
/* @__PURE__ */ U("div", {
|
|
225
225
|
className: "space-y-1.5",
|
|
226
|
-
children: [/* @__PURE__ */
|
|
226
|
+
children: [/* @__PURE__ */ T("label", {
|
|
227
227
|
htmlFor: "password",
|
|
228
228
|
className: "text-sm font-medium",
|
|
229
229
|
children: "Senha"
|
|
230
|
-
}), /* @__PURE__ */
|
|
230
|
+
}), /* @__PURE__ */ T("input", {
|
|
231
231
|
id: "password",
|
|
232
232
|
type: "password",
|
|
233
233
|
autoComplete: "current-password",
|
|
@@ -239,15 +239,15 @@ function q2({ supabase: e, moduleName: t, logo: r }) {
|
|
|
239
239
|
className: "w-full rounded-md border bg-background px-3 py-2 text-sm outline-none transition focus:ring-2 focus:ring-ring/50 disabled:opacity-50"
|
|
240
240
|
})]
|
|
241
241
|
}),
|
|
242
|
-
|
|
242
|
+
i && /* @__PURE__ */ T("p", {
|
|
243
243
|
className: "rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",
|
|
244
|
-
children:
|
|
244
|
+
children: i
|
|
245
245
|
}),
|
|
246
|
-
/* @__PURE__ */
|
|
246
|
+
/* @__PURE__ */ T("button", {
|
|
247
247
|
type: "submit",
|
|
248
248
|
disabled: p || !d || !s,
|
|
249
249
|
className: "inline-flex w-full items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-50",
|
|
250
|
-
children: p ? /* @__PURE__ */
|
|
250
|
+
children: p ? /* @__PURE__ */ T(v3, { className: "size-4 animate-spin" }) : "Entrar"
|
|
251
251
|
})
|
|
252
252
|
]
|
|
253
253
|
})]
|
|
@@ -255,43 +255,43 @@ function q2({ supabase: e, moduleName: t, logo: r }) {
|
|
|
255
255
|
})
|
|
256
256
|
});
|
|
257
257
|
}
|
|
258
|
-
function
|
|
259
|
-
const { isInitializing: o, can:
|
|
260
|
-
return o ? /* @__PURE__ */
|
|
258
|
+
function W2({ role: e, fallback: t = null, children: r }) {
|
|
259
|
+
const { isInitializing: o, can: i } = _3();
|
|
260
|
+
return o ? /* @__PURE__ */ T(u3, { children: t }) : i(e) ? /* @__PURE__ */ T(u3, { children: r }) : /* @__PURE__ */ T(u3, { children: t });
|
|
261
261
|
}
|
|
262
262
|
var i2 = /* @__PURE__ */ r2(((e, t) => {
|
|
263
|
-
(function(o,
|
|
264
|
-
typeof e == "object" && typeof t == "object" ? t.exports =
|
|
263
|
+
(function(o, i) {
|
|
264
|
+
typeof e == "object" && typeof t == "object" ? t.exports = i() : typeof define == "function" && define.amd ? define([], i) : typeof e == "object" ? e.jsQR = i() : o.jsQR = i();
|
|
265
265
|
})(typeof self < "u" ? self : e, function() {
|
|
266
266
|
return (function(r) {
|
|
267
267
|
var o = {};
|
|
268
|
-
function
|
|
268
|
+
function i(d) {
|
|
269
269
|
if (o[d]) return o[d].exports;
|
|
270
270
|
var a = o[d] = {
|
|
271
271
|
i: d,
|
|
272
272
|
l: !1,
|
|
273
273
|
exports: {}
|
|
274
274
|
};
|
|
275
|
-
return r[d].call(a.exports, a, a.exports,
|
|
275
|
+
return r[d].call(a.exports, a, a.exports, i), a.l = !0, a.exports;
|
|
276
276
|
}
|
|
277
|
-
return
|
|
278
|
-
|
|
277
|
+
return i.m = r, i.c = o, i.d = function(d, a, s) {
|
|
278
|
+
i.o(d, a) || Object.defineProperty(d, a, {
|
|
279
279
|
configurable: !1,
|
|
280
280
|
enumerable: !0,
|
|
281
281
|
get: s
|
|
282
282
|
});
|
|
283
|
-
},
|
|
283
|
+
}, i.n = function(d) {
|
|
284
284
|
var a = d && d.__esModule ? function() {
|
|
285
285
|
return d.default;
|
|
286
286
|
} : function() {
|
|
287
287
|
return d;
|
|
288
288
|
};
|
|
289
|
-
return
|
|
290
|
-
},
|
|
289
|
+
return i.d(a, "a", a), a;
|
|
290
|
+
}, i.o = function(d, a) {
|
|
291
291
|
return Object.prototype.hasOwnProperty.call(d, a);
|
|
292
|
-
},
|
|
292
|
+
}, i.p = "", i(i.s = 3);
|
|
293
293
|
})([
|
|
294
|
-
(function(r, o,
|
|
294
|
+
(function(r, o, i) {
|
|
295
295
|
"use strict";
|
|
296
296
|
Object.defineProperty(o, "__esModule", { value: !0 }), o.BitMatrix = (function() {
|
|
297
297
|
function d(a, s) {
|
|
@@ -303,23 +303,23 @@ var i2 = /* @__PURE__ */ r2(((e, t) => {
|
|
|
303
303
|
return a < 0 || a >= this.width || s < 0 || s >= this.height ? !1 : !!this.data[s * this.width + a];
|
|
304
304
|
}, d.prototype.set = function(a, s, k) {
|
|
305
305
|
this.data[s * this.width + a] = k ? 1 : 0;
|
|
306
|
-
}, d.prototype.setRegion = function(a, s, k, p,
|
|
307
|
-
for (var
|
|
306
|
+
}, d.prototype.setRegion = function(a, s, k, p, u) {
|
|
307
|
+
for (var c = s; c < s + p; c++) for (var m = a; m < a + k; m++) this.set(m, c, !!u);
|
|
308
308
|
}, d;
|
|
309
309
|
})();
|
|
310
310
|
}),
|
|
311
|
-
(function(r, o,
|
|
311
|
+
(function(r, o, i) {
|
|
312
312
|
"use strict";
|
|
313
313
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
314
|
-
var d =
|
|
314
|
+
var d = i(2);
|
|
315
315
|
function a(s, k) {
|
|
316
316
|
return s ^ k;
|
|
317
317
|
}
|
|
318
318
|
o.addOrSubtractGF = a, o.default = (function() {
|
|
319
|
-
function s(k, p,
|
|
320
|
-
this.primitive = k, this.size = p, this.generatorBase =
|
|
321
|
-
for (var
|
|
322
|
-
this.expTable[m] =
|
|
319
|
+
function s(k, p, u) {
|
|
320
|
+
this.primitive = k, this.size = p, this.generatorBase = u, this.expTable = new Array(this.size), this.logTable = new Array(this.size);
|
|
321
|
+
for (var c = 1, m = 0; m < this.size; m++)
|
|
322
|
+
this.expTable[m] = c, c = c * 2, c >= this.size && (c = (c ^ this.primitive) & this.size - 1);
|
|
323
323
|
for (var m = 0; m < this.size - 1; m++) this.logTable[this.expTable[m]] = m;
|
|
324
324
|
this.zero = new d.default(this, Uint8ClampedArray.from([0])), this.one = new d.default(this, Uint8ClampedArray.from([1]));
|
|
325
325
|
}
|
|
@@ -331,8 +331,8 @@ var i2 = /* @__PURE__ */ r2(((e, t) => {
|
|
|
331
331
|
}, s.prototype.buildMonomial = function(k, p) {
|
|
332
332
|
if (k < 0) throw new Error("Invalid monomial degree less than 0");
|
|
333
333
|
if (p === 0) return this.zero;
|
|
334
|
-
var
|
|
335
|
-
return
|
|
334
|
+
var u = new Uint8ClampedArray(k + 1);
|
|
335
|
+
return u[0] = p, new d.default(this, u);
|
|
336
336
|
}, s.prototype.log = function(k) {
|
|
337
337
|
if (k === 0) throw new Error("Can't take log(0)");
|
|
338
338
|
return this.logTable[k];
|
|
@@ -341,21 +341,21 @@ var i2 = /* @__PURE__ */ r2(((e, t) => {
|
|
|
341
341
|
}, s;
|
|
342
342
|
})();
|
|
343
343
|
}),
|
|
344
|
-
(function(r, o,
|
|
344
|
+
(function(r, o, i) {
|
|
345
345
|
"use strict";
|
|
346
346
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
347
|
-
var d =
|
|
347
|
+
var d = i(1);
|
|
348
348
|
o.default = (function() {
|
|
349
349
|
function a(s, k) {
|
|
350
350
|
if (k.length === 0) throw new Error("No coefficients.");
|
|
351
351
|
this.field = s;
|
|
352
352
|
var p = k.length;
|
|
353
353
|
if (p > 1 && k[0] === 0) {
|
|
354
|
-
for (var
|
|
355
|
-
if (
|
|
354
|
+
for (var u = 1; u < p && k[u] === 0; ) u++;
|
|
355
|
+
if (u === p) this.coefficients = s.zero.coefficients;
|
|
356
356
|
else {
|
|
357
|
-
this.coefficients = new Uint8ClampedArray(p -
|
|
358
|
-
for (var
|
|
357
|
+
this.coefficients = new Uint8ClampedArray(p - u);
|
|
358
|
+
for (var c = 0; c < this.coefficients.length; c++) this.coefficients[c] = k[u + c];
|
|
359
359
|
}
|
|
360
360
|
} else this.coefficients = k;
|
|
361
361
|
}
|
|
@@ -369,49 +369,49 @@ var i2 = /* @__PURE__ */ r2(((e, t) => {
|
|
|
369
369
|
var k;
|
|
370
370
|
if (this.isZero()) return s;
|
|
371
371
|
if (s.isZero()) return this;
|
|
372
|
-
var p = this.coefficients,
|
|
373
|
-
p.length >
|
|
374
|
-
for (var
|
|
375
|
-
for (var v = m; v <
|
|
376
|
-
return new a(this.field,
|
|
372
|
+
var p = this.coefficients, u = s.coefficients;
|
|
373
|
+
p.length > u.length && (k = [u, p], p = k[0], u = k[1]);
|
|
374
|
+
for (var c = new Uint8ClampedArray(u.length), m = u.length - p.length, v = 0; v < m; v++) c[v] = u[v];
|
|
375
|
+
for (var v = m; v < u.length; v++) c[v] = d.addOrSubtractGF(p[v - m], u[v]);
|
|
376
|
+
return new a(this.field, c);
|
|
377
377
|
}, a.prototype.multiply = function(s) {
|
|
378
378
|
if (s === 0) return this.field.zero;
|
|
379
379
|
if (s === 1) return this;
|
|
380
|
-
for (var k = this.coefficients.length, p = new Uint8ClampedArray(k),
|
|
380
|
+
for (var k = this.coefficients.length, p = new Uint8ClampedArray(k), u = 0; u < k; u++) p[u] = this.field.multiply(this.coefficients[u], s);
|
|
381
381
|
return new a(this.field, p);
|
|
382
382
|
}, a.prototype.multiplyPoly = function(s) {
|
|
383
383
|
if (this.isZero() || s.isZero()) return this.field.zero;
|
|
384
|
-
for (var k = this.coefficients, p = k.length,
|
|
385
|
-
for (var
|
|
384
|
+
for (var k = this.coefficients, p = k.length, u = s.coefficients, c = u.length, m = new Uint8ClampedArray(p + c - 1), v = 0; v < p; v++)
|
|
385
|
+
for (var y = k[v], C = 0; C < c; C++) m[v + C] = d.addOrSubtractGF(m[v + C], this.field.multiply(y, u[C]));
|
|
386
386
|
return new a(this.field, m);
|
|
387
387
|
}, a.prototype.multiplyByMonomial = function(s, k) {
|
|
388
388
|
if (s < 0) throw new Error("Invalid degree less than 0");
|
|
389
389
|
if (k === 0) return this.field.zero;
|
|
390
|
-
for (var p = this.coefficients.length,
|
|
391
|
-
return new a(this.field,
|
|
390
|
+
for (var p = this.coefficients.length, u = new Uint8ClampedArray(p + s), c = 0; c < p; c++) u[c] = this.field.multiply(this.coefficients[c], k);
|
|
391
|
+
return new a(this.field, u);
|
|
392
392
|
}, a.prototype.evaluateAt = function(s) {
|
|
393
393
|
var k = 0;
|
|
394
394
|
if (s === 0) return this.getCoefficient(0);
|
|
395
395
|
var p = this.coefficients.length;
|
|
396
396
|
if (s === 1)
|
|
397
|
-
return this.coefficients.forEach(function(
|
|
398
|
-
k = d.addOrSubtractGF(k,
|
|
397
|
+
return this.coefficients.forEach(function(c) {
|
|
398
|
+
k = d.addOrSubtractGF(k, c);
|
|
399
399
|
}), k;
|
|
400
400
|
k = this.coefficients[0];
|
|
401
|
-
for (var
|
|
401
|
+
for (var u = 1; u < p; u++) k = d.addOrSubtractGF(this.field.multiply(s, k), this.coefficients[u]);
|
|
402
402
|
return k;
|
|
403
403
|
}, a;
|
|
404
404
|
})();
|
|
405
405
|
}),
|
|
406
|
-
(function(r, o,
|
|
406
|
+
(function(r, o, i) {
|
|
407
407
|
"use strict";
|
|
408
408
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
409
|
-
var d =
|
|
409
|
+
var d = i(4), a = i(5), s = i(11), k = i(12);
|
|
410
410
|
function p(m) {
|
|
411
411
|
var v = k.locate(m);
|
|
412
412
|
if (!v) return null;
|
|
413
|
-
for (var
|
|
414
|
-
var w = C[
|
|
413
|
+
for (var y = 0, C = v; y < C.length; y++) {
|
|
414
|
+
var w = C[y], b = s.extract(m, w), x = a.decode(b.matrix);
|
|
415
415
|
if (x) return {
|
|
416
416
|
binaryData: x.bytes,
|
|
417
417
|
data: x.text,
|
|
@@ -431,82 +431,82 @@ var i2 = /* @__PURE__ */ r2(((e, t) => {
|
|
|
431
431
|
}
|
|
432
432
|
return null;
|
|
433
433
|
}
|
|
434
|
-
var
|
|
435
|
-
function
|
|
434
|
+
var u = { inversionAttempts: "attemptBoth" };
|
|
435
|
+
function c(m, v, y, C) {
|
|
436
436
|
C === void 0 && (C = {});
|
|
437
|
-
var w =
|
|
438
|
-
Object.keys(w || {}).forEach(function(
|
|
439
|
-
w[
|
|
437
|
+
var w = u;
|
|
438
|
+
Object.keys(w || {}).forEach(function(f) {
|
|
439
|
+
w[f] = C[f] || w[f];
|
|
440
440
|
});
|
|
441
|
-
var b = w.inversionAttempts === "attemptBoth" || w.inversionAttempts === "invertFirst", x = w.inversionAttempts === "onlyInvert" || w.inversionAttempts === "invertFirst", B = d.binarize(m, v,
|
|
442
|
-
return !h && (w.inversionAttempts === "attemptBoth" || w.inversionAttempts === "invertFirst") && (h = p(x ? n :
|
|
441
|
+
var b = w.inversionAttempts === "attemptBoth" || w.inversionAttempts === "invertFirst", x = w.inversionAttempts === "onlyInvert" || w.inversionAttempts === "invertFirst", B = d.binarize(m, v, y, b), n = B.binarized, l = B.inverted, h = p(x ? l : n);
|
|
442
|
+
return !h && (w.inversionAttempts === "attemptBoth" || w.inversionAttempts === "invertFirst") && (h = p(x ? n : l)), h;
|
|
443
443
|
}
|
|
444
|
-
|
|
444
|
+
c.default = c, o.default = c;
|
|
445
445
|
}),
|
|
446
|
-
(function(r, o,
|
|
446
|
+
(function(r, o, i) {
|
|
447
447
|
"use strict";
|
|
448
448
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
449
|
-
var d =
|
|
450
|
-
function k(
|
|
451
|
-
return
|
|
449
|
+
var d = i(0), a = 8, s = 24;
|
|
450
|
+
function k(c, m, v) {
|
|
451
|
+
return c < m ? m : c > v ? v : c;
|
|
452
452
|
}
|
|
453
453
|
var p = (function() {
|
|
454
|
-
function
|
|
454
|
+
function c(m, v) {
|
|
455
455
|
this.width = m, this.data = new Uint8ClampedArray(m * v);
|
|
456
456
|
}
|
|
457
|
-
return
|
|
457
|
+
return c.prototype.get = function(m, v) {
|
|
458
458
|
return this.data[v * this.width + m];
|
|
459
|
-
},
|
|
460
|
-
this.data[v * this.width + m] =
|
|
461
|
-
},
|
|
459
|
+
}, c.prototype.set = function(m, v, y) {
|
|
460
|
+
this.data[v * this.width + m] = y;
|
|
461
|
+
}, c;
|
|
462
462
|
})();
|
|
463
|
-
function
|
|
464
|
-
if (
|
|
463
|
+
function u(c, m, v, y) {
|
|
464
|
+
if (c.length !== m * v * 4) throw new Error("Malformed data passed to binarizer.");
|
|
465
465
|
for (var C = new p(m, v), w = 0; w < m; w++) for (var b = 0; b < v; b++) {
|
|
466
|
-
var x =
|
|
466
|
+
var x = c[(b * m + w) * 4 + 0], B = c[(b * m + w) * 4 + 1], n = c[(b * m + w) * 4 + 2];
|
|
467
467
|
C.set(w, b, 0.2126 * x + 0.7152 * B + 0.0722 * n);
|
|
468
468
|
}
|
|
469
|
-
for (var
|
|
469
|
+
for (var l = Math.ceil(m / a), h = Math.ceil(v / a), f = new p(l, h), g = 0; g < h; g++) for (var P = 0; P < l; P++) {
|
|
470
470
|
for (var S = 0, M = 1 / 0, O = 0, b = 0; b < a; b++) for (var w = 0; w < a; w++) {
|
|
471
|
-
var
|
|
472
|
-
S +=
|
|
471
|
+
var N = C.get(P * a + w, g * a + b);
|
|
472
|
+
S += N, M = Math.min(M, N), O = Math.max(O, N);
|
|
473
473
|
}
|
|
474
|
-
var
|
|
475
|
-
if (O - M <= s && (
|
|
476
|
-
var A = (
|
|
477
|
-
M < A && (
|
|
474
|
+
var F = S / Math.pow(a, 2);
|
|
475
|
+
if (O - M <= s && (F = M / 2, g > 0 && P > 0)) {
|
|
476
|
+
var A = (f.get(P, g - 1) + 2 * f.get(P - 1, g) + f.get(P - 1, g - 1)) / 4;
|
|
477
|
+
M < A && (F = A);
|
|
478
478
|
}
|
|
479
|
-
|
|
479
|
+
f.set(P, g, F);
|
|
480
480
|
}
|
|
481
|
-
var E = d.BitMatrix.createEmpty(m, v),
|
|
482
|
-
|
|
483
|
-
for (var g = 0; g < h; g++) for (var
|
|
484
|
-
for (var D = k(
|
|
481
|
+
var E = d.BitMatrix.createEmpty(m, v), L = null;
|
|
482
|
+
y && (L = d.BitMatrix.createEmpty(m, v));
|
|
483
|
+
for (var g = 0; g < h; g++) for (var P = 0; P < l; P++) {
|
|
484
|
+
for (var D = k(P, 2, l - 3), _ = k(g, 2, h - 3), S = 0, Q = -2; Q <= 2; Q++) for (var I = -2; I <= 2; I++) S += f.get(D + Q, _ + I);
|
|
485
485
|
for (var j = S / 25, Q = 0; Q < a; Q++) for (var I = 0; I < a; I++) {
|
|
486
|
-
var w =
|
|
487
|
-
E.set(w, b, z <= j),
|
|
486
|
+
var w = P * a + Q, b = g * a + I, z = C.get(w, b);
|
|
487
|
+
E.set(w, b, z <= j), y && L.set(w, b, !(z <= j));
|
|
488
488
|
}
|
|
489
489
|
}
|
|
490
|
-
return
|
|
490
|
+
return y ? {
|
|
491
491
|
binarized: E,
|
|
492
|
-
inverted:
|
|
492
|
+
inverted: L
|
|
493
493
|
} : { binarized: E };
|
|
494
494
|
}
|
|
495
|
-
o.binarize =
|
|
495
|
+
o.binarize = u;
|
|
496
496
|
}),
|
|
497
|
-
(function(r, o,
|
|
497
|
+
(function(r, o, i) {
|
|
498
498
|
"use strict";
|
|
499
499
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
500
|
-
var d =
|
|
501
|
-
function p(n,
|
|
502
|
-
for (var h = n ^
|
|
503
|
-
|
|
504
|
-
return
|
|
500
|
+
var d = i(0), a = i(6), s = i(9), k = i(10);
|
|
501
|
+
function p(n, l) {
|
|
502
|
+
for (var h = n ^ l, f = 0; h; )
|
|
503
|
+
f++, h &= h - 1;
|
|
504
|
+
return f;
|
|
505
505
|
}
|
|
506
|
-
function
|
|
507
|
-
return
|
|
506
|
+
function u(n, l) {
|
|
507
|
+
return l << 1 | n;
|
|
508
508
|
}
|
|
509
|
-
var
|
|
509
|
+
var c = [
|
|
510
510
|
{
|
|
511
511
|
bits: 21522,
|
|
512
512
|
formatInfo: {
|
|
@@ -758,115 +758,115 @@ var i2 = /* @__PURE__ */ r2(((e, t) => {
|
|
|
758
758
|
}
|
|
759
759
|
];
|
|
760
760
|
function v(n) {
|
|
761
|
-
var
|
|
762
|
-
h.setRegion(0, 0, 9, 9, !0), h.setRegion(
|
|
763
|
-
for (var
|
|
764
|
-
for (var
|
|
761
|
+
var l = 17 + 4 * n.versionNumber, h = d.BitMatrix.createEmpty(l, l);
|
|
762
|
+
h.setRegion(0, 0, 9, 9, !0), h.setRegion(l - 8, 0, 8, 9, !0), h.setRegion(0, l - 8, 9, 8, !0);
|
|
763
|
+
for (var f = 0, g = n.alignmentPatternCenters; f < g.length; f++)
|
|
764
|
+
for (var P = g[f], S = 0, M = n.alignmentPatternCenters; S < M.length; S++) {
|
|
765
765
|
var O = M[S];
|
|
766
|
-
|
|
766
|
+
P === 6 && O === 6 || P === 6 && O === l - 7 || P === l - 7 && O === 6 || h.setRegion(P - 2, O - 2, 5, 5, !0);
|
|
767
767
|
}
|
|
768
|
-
return h.setRegion(6, 9, 1,
|
|
768
|
+
return h.setRegion(6, 9, 1, l - 17, !0), h.setRegion(9, 6, l - 17, 1, !0), n.versionNumber > 6 && (h.setRegion(l - 11, 0, 3, 6, !0), h.setRegion(0, l - 11, 6, 3, !0)), h;
|
|
769
769
|
}
|
|
770
|
-
function
|
|
771
|
-
for (var
|
|
772
|
-
|
|
770
|
+
function y(n, l, h) {
|
|
771
|
+
for (var f = m[h.dataMask], g = n.height, P = v(l), S = [], M = 0, O = 0, N = !0, F = g - 1; F > 0; F -= 2) {
|
|
772
|
+
F === 6 && F--;
|
|
773
773
|
for (var A = 0; A < g; A++)
|
|
774
|
-
for (var E =
|
|
775
|
-
var D =
|
|
776
|
-
if (!
|
|
774
|
+
for (var E = N ? g - 1 - A : A, L = 0; L < 2; L++) {
|
|
775
|
+
var D = F - L;
|
|
776
|
+
if (!P.get(D, E)) {
|
|
777
777
|
O++;
|
|
778
778
|
var _ = n.get(D, E);
|
|
779
|
-
|
|
779
|
+
f({
|
|
780
780
|
y: E,
|
|
781
781
|
x: D
|
|
782
|
-
}) && (_ = !_), M =
|
|
782
|
+
}) && (_ = !_), M = u(_, M), O === 8 && (S.push(M), O = 0, M = 0);
|
|
783
783
|
}
|
|
784
784
|
}
|
|
785
|
-
|
|
785
|
+
N = !N;
|
|
786
786
|
}
|
|
787
787
|
return S;
|
|
788
788
|
}
|
|
789
789
|
function C(n) {
|
|
790
|
-
var
|
|
790
|
+
var l = n.height, h = Math.floor((l - 17) / 4);
|
|
791
791
|
if (h <= 6) return k.VERSIONS[h - 1];
|
|
792
|
-
for (var
|
|
793
|
-
for (var S = 0,
|
|
794
|
-
for (var M = 1 / 0, O,
|
|
795
|
-
var A = N
|
|
796
|
-
if (A.infoBits ===
|
|
797
|
-
var E = p(
|
|
792
|
+
for (var f = 0, g = 5; g >= 0; g--) for (var P = l - 9; P >= l - 11; P--) f = u(n.get(P, g), f);
|
|
793
|
+
for (var S = 0, P = 5; P >= 0; P--) for (var g = l - 9; g >= l - 11; g--) S = u(n.get(P, g), S);
|
|
794
|
+
for (var M = 1 / 0, O, N = 0, F = k.VERSIONS; N < F.length; N++) {
|
|
795
|
+
var A = F[N];
|
|
796
|
+
if (A.infoBits === f || A.infoBits === S) return A;
|
|
797
|
+
var E = p(f, A.infoBits);
|
|
798
798
|
E < M && (O = A, M = E), E = p(S, A.infoBits), E < M && (O = A, M = E);
|
|
799
799
|
}
|
|
800
800
|
if (M <= 3) return O;
|
|
801
801
|
}
|
|
802
802
|
function w(n) {
|
|
803
|
-
for (var
|
|
804
|
-
for (var
|
|
805
|
-
for (var g = n.height,
|
|
806
|
-
for (var h = g - 8; h < g; h++)
|
|
807
|
-
for (var S = 1 / 0, M = null, O = 0,
|
|
808
|
-
var
|
|
809
|
-
if (A ===
|
|
810
|
-
var
|
|
811
|
-
|
|
803
|
+
for (var l = 0, h = 0; h <= 8; h++) h !== 6 && (l = u(n.get(h, 8), l));
|
|
804
|
+
for (var f = 7; f >= 0; f--) f !== 6 && (l = u(n.get(8, f), l));
|
|
805
|
+
for (var g = n.height, P = 0, f = g - 1; f >= g - 7; f--) P = u(n.get(8, f), P);
|
|
806
|
+
for (var h = g - 8; h < g; h++) P = u(n.get(h, 8), P);
|
|
807
|
+
for (var S = 1 / 0, M = null, O = 0, N = c; O < N.length; O++) {
|
|
808
|
+
var F = N[O], A = F.bits, E = F.formatInfo;
|
|
809
|
+
if (A === l || A === P) return E;
|
|
810
|
+
var L = p(l, A);
|
|
811
|
+
L < S && (M = E, S = L), l !== P && (L = p(P, A), L < S && (M = E, S = L));
|
|
812
812
|
}
|
|
813
813
|
return S <= 3 ? M : null;
|
|
814
814
|
}
|
|
815
|
-
function b(n,
|
|
816
|
-
var
|
|
817
|
-
if (
|
|
815
|
+
function b(n, l, h) {
|
|
816
|
+
var f = l.errorCorrectionLevels[h], g = [], P = 0;
|
|
817
|
+
if (f.ecBlocks.forEach(function(_) {
|
|
818
818
|
for (var Q = 0; Q < _.numBlocks; Q++)
|
|
819
819
|
g.push({
|
|
820
820
|
numDataCodewords: _.dataCodewordsPerBlock,
|
|
821
821
|
codewords: []
|
|
822
|
-
}),
|
|
823
|
-
}), n.length <
|
|
824
|
-
n = n.slice(0,
|
|
825
|
-
for (var S =
|
|
826
|
-
var
|
|
827
|
-
|
|
822
|
+
}), P += _.dataCodewordsPerBlock + f.ecCodewordsPerBlock;
|
|
823
|
+
}), n.length < P) return null;
|
|
824
|
+
n = n.slice(0, P);
|
|
825
|
+
for (var S = f.ecBlocks[0].dataCodewordsPerBlock, M = 0; M < S; M++) for (var O = 0, N = g; O < N.length; O++) {
|
|
826
|
+
var F = N[O];
|
|
827
|
+
F.codewords.push(n.shift());
|
|
828
828
|
}
|
|
829
|
-
if (
|
|
830
|
-
for (var A =
|
|
831
|
-
for (; n.length > 0; ) for (var
|
|
832
|
-
var
|
|
833
|
-
|
|
829
|
+
if (f.ecBlocks.length > 1)
|
|
830
|
+
for (var A = f.ecBlocks[0].numBlocks, E = f.ecBlocks[1].numBlocks, M = 0; M < E; M++) g[A + M].codewords.push(n.shift());
|
|
831
|
+
for (; n.length > 0; ) for (var L = 0, D = g; L < D.length; L++) {
|
|
832
|
+
var F = D[L];
|
|
833
|
+
F.codewords.push(n.shift());
|
|
834
834
|
}
|
|
835
835
|
return g;
|
|
836
836
|
}
|
|
837
837
|
function x(n) {
|
|
838
|
-
var
|
|
839
|
-
if (!
|
|
838
|
+
var l = C(n);
|
|
839
|
+
if (!l) return null;
|
|
840
840
|
var h = w(n);
|
|
841
841
|
if (!h) return null;
|
|
842
|
-
var
|
|
843
|
-
if (!
|
|
844
|
-
for (var g =
|
|
845
|
-
return E +
|
|
846
|
-
}, 0),
|
|
847
|
-
var
|
|
848
|
-
if (!
|
|
849
|
-
for (var A = 0; A <
|
|
842
|
+
var f = b(y(n, l, h), l, h.errorCorrectionLevel);
|
|
843
|
+
if (!f) return null;
|
|
844
|
+
for (var g = f.reduce(function(E, L) {
|
|
845
|
+
return E + L.numDataCodewords;
|
|
846
|
+
}, 0), P = new Uint8ClampedArray(g), S = 0, M = 0, O = f; M < O.length; M++) {
|
|
847
|
+
var N = O[M], F = s.decode(N.codewords, N.codewords.length - N.numDataCodewords);
|
|
848
|
+
if (!F) return null;
|
|
849
|
+
for (var A = 0; A < N.numDataCodewords; A++) P[S++] = F[A];
|
|
850
850
|
}
|
|
851
851
|
try {
|
|
852
|
-
return a.decode(
|
|
852
|
+
return a.decode(P, l.versionNumber);
|
|
853
853
|
} catch {
|
|
854
854
|
return null;
|
|
855
855
|
}
|
|
856
856
|
}
|
|
857
857
|
function B(n) {
|
|
858
858
|
if (n == null) return null;
|
|
859
|
-
var
|
|
860
|
-
if (
|
|
861
|
-
for (var h = 0; h < n.width; h++) for (var
|
|
859
|
+
var l = x(n);
|
|
860
|
+
if (l) return l;
|
|
861
|
+
for (var h = 0; h < n.width; h++) for (var f = h + 1; f < n.height; f++) n.get(h, f) !== n.get(f, h) && (n.set(h, f, !n.get(h, f)), n.set(f, h, !n.get(f, h)));
|
|
862
862
|
return x(n);
|
|
863
863
|
}
|
|
864
864
|
o.decode = B;
|
|
865
865
|
}),
|
|
866
|
-
(function(r, o,
|
|
866
|
+
(function(r, o, i) {
|
|
867
867
|
"use strict";
|
|
868
868
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
869
|
-
var d =
|
|
869
|
+
var d = i(7), a = i(8), s;
|
|
870
870
|
(function(C) {
|
|
871
871
|
C.Numeric = "numeric", C.Alphanumeric = "alphanumeric", C.Byte = "byte", C.Kanji = "kanji", C.ECI = "eci";
|
|
872
872
|
})(s = o.Mode || (o.Mode = {}));
|
|
@@ -880,27 +880,27 @@ var i2 = /* @__PURE__ */ r2(((e, t) => {
|
|
|
880
880
|
12,
|
|
881
881
|
14
|
|
882
882
|
][w], n = C.readBits(B); n >= 3; ) {
|
|
883
|
-
var
|
|
884
|
-
if (
|
|
885
|
-
var h = Math.floor(
|
|
886
|
-
b.push(48 + h, 48 +
|
|
883
|
+
var l = C.readBits(10);
|
|
884
|
+
if (l >= 1e3) throw new Error("Invalid numeric value above 999");
|
|
885
|
+
var h = Math.floor(l / 100), f = Math.floor(l / 10) % 10, g = l % 10;
|
|
886
|
+
b.push(48 + h, 48 + f, 48 + g), x += h.toString() + f.toString() + g.toString(), n -= 3;
|
|
887
887
|
}
|
|
888
888
|
if (n === 2) {
|
|
889
|
-
var
|
|
890
|
-
if (
|
|
891
|
-
var h = Math.floor(
|
|
892
|
-
b.push(48 + h, 48 +
|
|
889
|
+
var l = C.readBits(7);
|
|
890
|
+
if (l >= 100) throw new Error("Invalid numeric value above 99");
|
|
891
|
+
var h = Math.floor(l / 10), f = l % 10;
|
|
892
|
+
b.push(48 + h, 48 + f), x += h.toString() + f.toString();
|
|
893
893
|
} else if (n === 1) {
|
|
894
|
-
var
|
|
895
|
-
if (
|
|
896
|
-
b.push(48 +
|
|
894
|
+
var l = C.readBits(4);
|
|
895
|
+
if (l >= 10) throw new Error("Invalid numeric value above 9");
|
|
896
|
+
b.push(48 + l), x += l.toString();
|
|
897
897
|
}
|
|
898
898
|
return {
|
|
899
899
|
bytes: b,
|
|
900
900
|
text: x
|
|
901
901
|
};
|
|
902
902
|
}
|
|
903
|
-
var
|
|
903
|
+
var u = [
|
|
904
904
|
"0",
|
|
905
905
|
"1",
|
|
906
906
|
"2",
|
|
@@ -947,18 +947,18 @@ var i2 = /* @__PURE__ */ r2(((e, t) => {
|
|
|
947
947
|
"/",
|
|
948
948
|
":"
|
|
949
949
|
];
|
|
950
|
-
function
|
|
950
|
+
function c(C, w) {
|
|
951
951
|
for (var b = [], x = "", B = [
|
|
952
952
|
9,
|
|
953
953
|
11,
|
|
954
954
|
13
|
|
955
955
|
][w], n = C.readBits(B); n >= 2; ) {
|
|
956
|
-
var
|
|
957
|
-
b.push(
|
|
956
|
+
var l = C.readBits(11), h = Math.floor(l / 45), f = l % 45;
|
|
957
|
+
b.push(u[h].charCodeAt(0), u[f].charCodeAt(0)), x += u[h] + u[f], n -= 2;
|
|
958
958
|
}
|
|
959
959
|
if (n === 1) {
|
|
960
960
|
var h = C.readBits(6);
|
|
961
|
-
b.push(
|
|
961
|
+
b.push(u[h].charCodeAt(0)), x += u[h];
|
|
962
962
|
}
|
|
963
963
|
return {
|
|
964
964
|
bytes: b,
|
|
@@ -970,13 +970,13 @@ var i2 = /* @__PURE__ */ r2(((e, t) => {
|
|
|
970
970
|
8,
|
|
971
971
|
16,
|
|
972
972
|
16
|
|
973
|
-
][w], n = C.readBits(B),
|
|
973
|
+
][w], n = C.readBits(B), l = 0; l < n; l++) {
|
|
974
974
|
var h = C.readBits(8);
|
|
975
975
|
b.push(h);
|
|
976
976
|
}
|
|
977
977
|
try {
|
|
978
|
-
x += decodeURIComponent(b.map(function(
|
|
979
|
-
return "%" + ("0" +
|
|
978
|
+
x += decodeURIComponent(b.map(function(f) {
|
|
979
|
+
return "%" + ("0" + f.toString(16)).substr(-2);
|
|
980
980
|
}).join(""));
|
|
981
981
|
} catch {
|
|
982
982
|
}
|
|
@@ -990,70 +990,70 @@ var i2 = /* @__PURE__ */ r2(((e, t) => {
|
|
|
990
990
|
8,
|
|
991
991
|
10,
|
|
992
992
|
12
|
|
993
|
-
][w], n = C.readBits(B),
|
|
994
|
-
var h = C.readBits(13),
|
|
995
|
-
|
|
993
|
+
][w], n = C.readBits(B), l = 0; l < n; l++) {
|
|
994
|
+
var h = C.readBits(13), f = Math.floor(h / 192) << 8 | h % 192;
|
|
995
|
+
f < 7936 ? f += 33088 : f += 49472, b.push(f >> 8, f & 255), x += String.fromCharCode(a.shiftJISTable[f]);
|
|
996
996
|
}
|
|
997
997
|
return {
|
|
998
998
|
bytes: b,
|
|
999
999
|
text: x
|
|
1000
1000
|
};
|
|
1001
1001
|
}
|
|
1002
|
-
function
|
|
1003
|
-
for (var b, x, B, n,
|
|
1002
|
+
function y(C, w) {
|
|
1003
|
+
for (var b, x, B, n, l = new d.BitStream(C), h = w <= 9 ? 0 : w <= 26 ? 1 : 2, f = {
|
|
1004
1004
|
text: "",
|
|
1005
1005
|
bytes: [],
|
|
1006
1006
|
chunks: [],
|
|
1007
1007
|
version: w
|
|
1008
|
-
};
|
|
1009
|
-
var g =
|
|
1010
|
-
if (g === k.Terminator) return
|
|
1011
|
-
if (g === k.ECI)
|
|
1008
|
+
}; l.available() >= 4; ) {
|
|
1009
|
+
var g = l.readBits(4);
|
|
1010
|
+
if (g === k.Terminator) return f;
|
|
1011
|
+
if (g === k.ECI) l.readBits(1) === 0 ? f.chunks.push({
|
|
1012
1012
|
type: s.ECI,
|
|
1013
|
-
assignmentNumber:
|
|
1014
|
-
}) :
|
|
1013
|
+
assignmentNumber: l.readBits(7)
|
|
1014
|
+
}) : l.readBits(1) === 0 ? f.chunks.push({
|
|
1015
1015
|
type: s.ECI,
|
|
1016
|
-
assignmentNumber:
|
|
1017
|
-
}) :
|
|
1016
|
+
assignmentNumber: l.readBits(14)
|
|
1017
|
+
}) : l.readBits(1) === 0 ? f.chunks.push({
|
|
1018
1018
|
type: s.ECI,
|
|
1019
|
-
assignmentNumber:
|
|
1020
|
-
}) :
|
|
1019
|
+
assignmentNumber: l.readBits(21)
|
|
1020
|
+
}) : f.chunks.push({
|
|
1021
1021
|
type: s.ECI,
|
|
1022
1022
|
assignmentNumber: -1
|
|
1023
1023
|
});
|
|
1024
1024
|
else if (g === k.Numeric) {
|
|
1025
|
-
var
|
|
1026
|
-
|
|
1025
|
+
var P = p(l, h);
|
|
1026
|
+
f.text += P.text, (b = f.bytes).push.apply(b, P.bytes), f.chunks.push({
|
|
1027
1027
|
type: s.Numeric,
|
|
1028
|
-
text:
|
|
1028
|
+
text: P.text
|
|
1029
1029
|
});
|
|
1030
1030
|
} else if (g === k.Alphanumeric) {
|
|
1031
|
-
var S =
|
|
1032
|
-
|
|
1031
|
+
var S = c(l, h);
|
|
1032
|
+
f.text += S.text, (x = f.bytes).push.apply(x, S.bytes), f.chunks.push({
|
|
1033
1033
|
type: s.Alphanumeric,
|
|
1034
1034
|
text: S.text
|
|
1035
1035
|
});
|
|
1036
1036
|
} else if (g === k.Byte) {
|
|
1037
|
-
var M = m(
|
|
1038
|
-
|
|
1037
|
+
var M = m(l, h);
|
|
1038
|
+
f.text += M.text, (B = f.bytes).push.apply(B, M.bytes), f.chunks.push({
|
|
1039
1039
|
type: s.Byte,
|
|
1040
1040
|
bytes: M.bytes,
|
|
1041
1041
|
text: M.text
|
|
1042
1042
|
});
|
|
1043
1043
|
} else if (g === k.Kanji) {
|
|
1044
|
-
var O = v(
|
|
1045
|
-
|
|
1044
|
+
var O = v(l, h);
|
|
1045
|
+
f.text += O.text, (n = f.bytes).push.apply(n, O.bytes), f.chunks.push({
|
|
1046
1046
|
type: s.Kanji,
|
|
1047
1047
|
bytes: O.bytes,
|
|
1048
1048
|
text: O.text
|
|
1049
1049
|
});
|
|
1050
1050
|
}
|
|
1051
1051
|
}
|
|
1052
|
-
if (
|
|
1052
|
+
if (l.available() === 0 || l.readBits(l.available()) === 0) return f;
|
|
1053
1053
|
}
|
|
1054
|
-
o.decode =
|
|
1054
|
+
o.decode = y;
|
|
1055
1055
|
}),
|
|
1056
|
-
(function(r, o,
|
|
1056
|
+
(function(r, o, i) {
|
|
1057
1057
|
"use strict";
|
|
1058
1058
|
Object.defineProperty(o, "__esModule", { value: !0 }), o.BitStream = (function() {
|
|
1059
1059
|
function d(a) {
|
|
@@ -1063,15 +1063,15 @@ var i2 = /* @__PURE__ */ r2(((e, t) => {
|
|
|
1063
1063
|
if (a < 1 || a > 32 || a > this.available()) throw new Error("Cannot read " + a.toString() + " bits");
|
|
1064
1064
|
var s = 0;
|
|
1065
1065
|
if (this.bitOffset > 0) {
|
|
1066
|
-
var k = 8 - this.bitOffset, p = a < k ? a : k,
|
|
1067
|
-
s = (this.bytes[this.byteOffset] &
|
|
1066
|
+
var k = 8 - this.bitOffset, p = a < k ? a : k, u = k - p, c = 255 >> 8 - p << u;
|
|
1067
|
+
s = (this.bytes[this.byteOffset] & c) >> u, a -= p, this.bitOffset += p, this.bitOffset === 8 && (this.bitOffset = 0, this.byteOffset++);
|
|
1068
1068
|
}
|
|
1069
1069
|
if (a > 0) {
|
|
1070
1070
|
for (; a >= 8; )
|
|
1071
1071
|
s = s << 8 | this.bytes[this.byteOffset] & 255, this.byteOffset++, a -= 8;
|
|
1072
1072
|
if (a > 0) {
|
|
1073
|
-
var
|
|
1074
|
-
s = s << a | (this.bytes[this.byteOffset] &
|
|
1073
|
+
var u = 8 - a, c = 255 >> u << u;
|
|
1074
|
+
s = s << a | (this.bytes[this.byteOffset] & c) >> u, this.bitOffset += a;
|
|
1075
1075
|
}
|
|
1076
1076
|
}
|
|
1077
1077
|
return s;
|
|
@@ -1080,7 +1080,7 @@ var i2 = /* @__PURE__ */ r2(((e, t) => {
|
|
|
1080
1080
|
}, d;
|
|
1081
1081
|
})();
|
|
1082
1082
|
}),
|
|
1083
|
-
(function(r, o,
|
|
1083
|
+
(function(r, o, i) {
|
|
1084
1084
|
"use strict";
|
|
1085
1085
|
Object.defineProperty(o, "__esModule", { value: !0 }), o.shiftJISTable = {
|
|
1086
1086
|
32: 32,
|
|
@@ -8122,63 +8122,63 @@ var i2 = /* @__PURE__ */ r2(((e, t) => {
|
|
|
8122
8122
|
60068: 29081
|
|
8123
8123
|
};
|
|
8124
8124
|
}),
|
|
8125
|
-
(function(r, o,
|
|
8125
|
+
(function(r, o, i) {
|
|
8126
8126
|
"use strict";
|
|
8127
8127
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
8128
|
-
var d =
|
|
8129
|
-
function s(
|
|
8128
|
+
var d = i(1), a = i(2);
|
|
8129
|
+
function s(c, m, v, y) {
|
|
8130
8130
|
var C;
|
|
8131
8131
|
m.degree() < v.degree() && (C = [v, m], m = C[0], v = C[1]);
|
|
8132
|
-
for (var w = m, b = v, x =
|
|
8133
|
-
var n = w,
|
|
8132
|
+
for (var w = m, b = v, x = c.zero, B = c.one; b.degree() >= y / 2; ) {
|
|
8133
|
+
var n = w, l = x;
|
|
8134
8134
|
if (w = b, x = B, w.isZero()) return null;
|
|
8135
8135
|
b = n;
|
|
8136
|
-
for (var h =
|
|
8137
|
-
var
|
|
8138
|
-
h = h.addOrSubtract(
|
|
8136
|
+
for (var h = c.zero, f = w.getCoefficient(w.degree()), g = c.inverse(f); b.degree() >= w.degree() && !b.isZero(); ) {
|
|
8137
|
+
var P = b.degree() - w.degree(), S = c.multiply(b.getCoefficient(b.degree()), g);
|
|
8138
|
+
h = h.addOrSubtract(c.buildMonomial(P, S)), b = b.addOrSubtract(w.multiplyByMonomial(P, S));
|
|
8139
8139
|
}
|
|
8140
|
-
if (B = h.multiplyPoly(x).addOrSubtract(
|
|
8140
|
+
if (B = h.multiplyPoly(x).addOrSubtract(l), b.degree() >= w.degree()) return null;
|
|
8141
8141
|
}
|
|
8142
8142
|
var M = B.getCoefficient(0);
|
|
8143
8143
|
if (M === 0) return null;
|
|
8144
|
-
var O =
|
|
8144
|
+
var O = c.inverse(M);
|
|
8145
8145
|
return [B.multiply(O), b.multiply(O)];
|
|
8146
8146
|
}
|
|
8147
|
-
function k(
|
|
8147
|
+
function k(c, m) {
|
|
8148
8148
|
var v = m.degree();
|
|
8149
8149
|
if (v === 1) return [m.getCoefficient(1)];
|
|
8150
|
-
for (var
|
|
8151
|
-
return C !== v ? null :
|
|
8150
|
+
for (var y = new Array(v), C = 0, w = 1; w < c.size && C < v; w++) m.evaluateAt(w) === 0 && (y[C] = c.inverse(w), C++);
|
|
8151
|
+
return C !== v ? null : y;
|
|
8152
8152
|
}
|
|
8153
|
-
function p(
|
|
8154
|
-
for (var
|
|
8155
|
-
for (var b =
|
|
8156
|
-
C[w] =
|
|
8153
|
+
function p(c, m, v) {
|
|
8154
|
+
for (var y = v.length, C = new Array(y), w = 0; w < y; w++) {
|
|
8155
|
+
for (var b = c.inverse(v[w]), x = 1, B = 0; B < y; B++) w !== B && (x = c.multiply(x, d.addOrSubtractGF(1, c.multiply(v[B], b))));
|
|
8156
|
+
C[w] = c.multiply(m.evaluateAt(b), c.inverse(x)), c.generatorBase !== 0 && (C[w] = c.multiply(C[w], b));
|
|
8157
8157
|
}
|
|
8158
8158
|
return C;
|
|
8159
8159
|
}
|
|
8160
|
-
function
|
|
8161
|
-
var v = new Uint8ClampedArray(
|
|
8162
|
-
v.set(
|
|
8163
|
-
for (var
|
|
8164
|
-
var B = C.evaluateAt(
|
|
8160
|
+
function u(c, m) {
|
|
8161
|
+
var v = new Uint8ClampedArray(c.length);
|
|
8162
|
+
v.set(c);
|
|
8163
|
+
for (var y = new d.default(285, 256, 0), C = new a.default(y, v), w = new Uint8ClampedArray(m), b = !1, x = 0; x < m; x++) {
|
|
8164
|
+
var B = C.evaluateAt(y.exp(x + y.generatorBase));
|
|
8165
8165
|
w[w.length - 1 - x] = B, B !== 0 && (b = !0);
|
|
8166
8166
|
}
|
|
8167
8167
|
if (!b) return v;
|
|
8168
|
-
var n = new a.default(
|
|
8169
|
-
if (
|
|
8170
|
-
var h = k(
|
|
8168
|
+
var n = new a.default(y, w), l = s(y, y.buildMonomial(m, 1), n, m);
|
|
8169
|
+
if (l === null) return null;
|
|
8170
|
+
var h = k(y, l[0]);
|
|
8171
8171
|
if (h == null) return null;
|
|
8172
|
-
for (var
|
|
8173
|
-
var
|
|
8174
|
-
if (
|
|
8175
|
-
v[
|
|
8172
|
+
for (var f = p(y, l[1], h), g = 0; g < h.length; g++) {
|
|
8173
|
+
var P = v.length - 1 - y.log(h[g]);
|
|
8174
|
+
if (P < 0) return null;
|
|
8175
|
+
v[P] = d.addOrSubtractGF(v[P], f[g]);
|
|
8176
8176
|
}
|
|
8177
8177
|
return v;
|
|
8178
8178
|
}
|
|
8179
|
-
o.decode =
|
|
8179
|
+
o.decode = u;
|
|
8180
8180
|
}),
|
|
8181
|
-
(function(r, o,
|
|
8181
|
+
(function(r, o, i) {
|
|
8182
8182
|
"use strict";
|
|
8183
8183
|
Object.defineProperty(o, "__esModule", { value: !0 }), o.VERSIONS = [
|
|
8184
8184
|
{
|
|
@@ -10169,128 +10169,128 @@ var i2 = /* @__PURE__ */ r2(((e, t) => {
|
|
|
10169
10169
|
}
|
|
10170
10170
|
];
|
|
10171
10171
|
}),
|
|
10172
|
-
(function(r, o,
|
|
10172
|
+
(function(r, o, i) {
|
|
10173
10173
|
"use strict";
|
|
10174
10174
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
10175
|
-
var d =
|
|
10176
|
-
function a(
|
|
10177
|
-
var
|
|
10178
|
-
if (
|
|
10179
|
-
a11:
|
|
10180
|
-
a12:
|
|
10175
|
+
var d = i(0);
|
|
10176
|
+
function a(u, c, m, v) {
|
|
10177
|
+
var y = u.x - c.x + m.x - v.x, C = u.y - c.y + m.y - v.y;
|
|
10178
|
+
if (y === 0 && C === 0) return {
|
|
10179
|
+
a11: c.x - u.x,
|
|
10180
|
+
a12: c.y - u.y,
|
|
10181
10181
|
a13: 0,
|
|
10182
|
-
a21: m.x -
|
|
10183
|
-
a22: m.y -
|
|
10182
|
+
a21: m.x - c.x,
|
|
10183
|
+
a22: m.y - c.y,
|
|
10184
10184
|
a23: 0,
|
|
10185
|
-
a31:
|
|
10186
|
-
a32:
|
|
10185
|
+
a31: u.x,
|
|
10186
|
+
a32: u.y,
|
|
10187
10187
|
a33: 1
|
|
10188
10188
|
};
|
|
10189
|
-
var w =
|
|
10189
|
+
var w = c.x - m.x, b = v.x - m.x, x = c.y - m.y, B = v.y - m.y, n = w * B - b * x, l = (y * B - b * C) / n, h = (w * C - y * x) / n;
|
|
10190
10190
|
return {
|
|
10191
|
-
a11:
|
|
10192
|
-
a12:
|
|
10193
|
-
a13:
|
|
10194
|
-
a21: v.x -
|
|
10195
|
-
a22: v.y -
|
|
10191
|
+
a11: c.x - u.x + l * c.x,
|
|
10192
|
+
a12: c.y - u.y + l * c.y,
|
|
10193
|
+
a13: l,
|
|
10194
|
+
a21: v.x - u.x + h * v.x,
|
|
10195
|
+
a22: v.y - u.y + h * v.y,
|
|
10196
10196
|
a23: h,
|
|
10197
|
-
a31:
|
|
10198
|
-
a32:
|
|
10197
|
+
a31: u.x,
|
|
10198
|
+
a32: u.y,
|
|
10199
10199
|
a33: 1
|
|
10200
10200
|
};
|
|
10201
10201
|
}
|
|
10202
|
-
function s(
|
|
10203
|
-
var
|
|
10202
|
+
function s(u, c, m, v) {
|
|
10203
|
+
var y = a(u, c, m, v);
|
|
10204
10204
|
return {
|
|
10205
|
-
a11:
|
|
10206
|
-
a12:
|
|
10207
|
-
a13:
|
|
10208
|
-
a21:
|
|
10209
|
-
a22:
|
|
10210
|
-
a23:
|
|
10211
|
-
a31:
|
|
10212
|
-
a32:
|
|
10213
|
-
a33:
|
|
10205
|
+
a11: y.a22 * y.a33 - y.a23 * y.a32,
|
|
10206
|
+
a12: y.a13 * y.a32 - y.a12 * y.a33,
|
|
10207
|
+
a13: y.a12 * y.a23 - y.a13 * y.a22,
|
|
10208
|
+
a21: y.a23 * y.a31 - y.a21 * y.a33,
|
|
10209
|
+
a22: y.a11 * y.a33 - y.a13 * y.a31,
|
|
10210
|
+
a23: y.a13 * y.a21 - y.a11 * y.a23,
|
|
10211
|
+
a31: y.a21 * y.a32 - y.a22 * y.a31,
|
|
10212
|
+
a32: y.a12 * y.a31 - y.a11 * y.a32,
|
|
10213
|
+
a33: y.a11 * y.a22 - y.a12 * y.a21
|
|
10214
10214
|
};
|
|
10215
10215
|
}
|
|
10216
|
-
function k(
|
|
10216
|
+
function k(u, c) {
|
|
10217
10217
|
return {
|
|
10218
|
-
a11:
|
|
10219
|
-
a12:
|
|
10220
|
-
a13:
|
|
10221
|
-
a21:
|
|
10222
|
-
a22:
|
|
10223
|
-
a23:
|
|
10224
|
-
a31:
|
|
10225
|
-
a32:
|
|
10226
|
-
a33:
|
|
10218
|
+
a11: u.a11 * c.a11 + u.a21 * c.a12 + u.a31 * c.a13,
|
|
10219
|
+
a12: u.a12 * c.a11 + u.a22 * c.a12 + u.a32 * c.a13,
|
|
10220
|
+
a13: u.a13 * c.a11 + u.a23 * c.a12 + u.a33 * c.a13,
|
|
10221
|
+
a21: u.a11 * c.a21 + u.a21 * c.a22 + u.a31 * c.a23,
|
|
10222
|
+
a22: u.a12 * c.a21 + u.a22 * c.a22 + u.a32 * c.a23,
|
|
10223
|
+
a23: u.a13 * c.a21 + u.a23 * c.a22 + u.a33 * c.a23,
|
|
10224
|
+
a31: u.a11 * c.a31 + u.a21 * c.a32 + u.a31 * c.a33,
|
|
10225
|
+
a32: u.a12 * c.a31 + u.a22 * c.a32 + u.a32 * c.a33,
|
|
10226
|
+
a33: u.a13 * c.a31 + u.a23 * c.a32 + u.a33 * c.a33
|
|
10227
10227
|
};
|
|
10228
10228
|
}
|
|
10229
|
-
function p(
|
|
10229
|
+
function p(u, c) {
|
|
10230
10230
|
for (var m = s({
|
|
10231
10231
|
x: 3.5,
|
|
10232
10232
|
y: 3.5
|
|
10233
10233
|
}, {
|
|
10234
|
-
x:
|
|
10234
|
+
x: c.dimension - 3.5,
|
|
10235
10235
|
y: 3.5
|
|
10236
10236
|
}, {
|
|
10237
|
-
x:
|
|
10238
|
-
y:
|
|
10237
|
+
x: c.dimension - 6.5,
|
|
10238
|
+
y: c.dimension - 6.5
|
|
10239
10239
|
}, {
|
|
10240
10240
|
x: 3.5,
|
|
10241
|
-
y:
|
|
10242
|
-
}), v = k(a(
|
|
10243
|
-
var
|
|
10241
|
+
y: c.dimension - 3.5
|
|
10242
|
+
}), v = k(a(c.topLeft, c.topRight, c.alignmentPattern, c.bottomLeft), m), y = d.BitMatrix.createEmpty(c.dimension, c.dimension), C = function(B, n) {
|
|
10243
|
+
var l = v.a13 * B + v.a23 * n + v.a33;
|
|
10244
10244
|
return {
|
|
10245
|
-
x: (v.a11 * B + v.a21 * n + v.a31) /
|
|
10246
|
-
y: (v.a12 * B + v.a22 * n + v.a32) /
|
|
10245
|
+
x: (v.a11 * B + v.a21 * n + v.a31) / l,
|
|
10246
|
+
y: (v.a12 * B + v.a22 * n + v.a32) / l
|
|
10247
10247
|
};
|
|
10248
|
-
}, w = 0; w <
|
|
10248
|
+
}, w = 0; w < c.dimension; w++) for (var b = 0; b < c.dimension; b++) {
|
|
10249
10249
|
var x = C(b + 0.5, w + 0.5);
|
|
10250
|
-
|
|
10250
|
+
y.set(b, w, u.get(Math.floor(x.x), Math.floor(x.y)));
|
|
10251
10251
|
}
|
|
10252
10252
|
return {
|
|
10253
|
-
matrix:
|
|
10253
|
+
matrix: y,
|
|
10254
10254
|
mappingFunction: C
|
|
10255
10255
|
};
|
|
10256
10256
|
}
|
|
10257
10257
|
o.extract = p;
|
|
10258
10258
|
}),
|
|
10259
|
-
(function(r, o,
|
|
10259
|
+
(function(r, o, i) {
|
|
10260
10260
|
"use strict";
|
|
10261
10261
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
10262
10262
|
var d = 4, a = 0.5, s = 1.5, k = function(B, n) {
|
|
10263
10263
|
return Math.sqrt(Math.pow(n.x - B.x, 2) + Math.pow(n.y - B.y, 2));
|
|
10264
10264
|
};
|
|
10265
10265
|
function p(B) {
|
|
10266
|
-
return B.reduce(function(n,
|
|
10267
|
-
return n +
|
|
10266
|
+
return B.reduce(function(n, l) {
|
|
10267
|
+
return n + l;
|
|
10268
10268
|
});
|
|
10269
10269
|
}
|
|
10270
|
-
function
|
|
10271
|
-
var h,
|
|
10270
|
+
function u(B, n, l) {
|
|
10271
|
+
var h, f, g, P, S = k(B, n), M = k(n, l), O = k(B, l), N, F, A;
|
|
10272
10272
|
return M >= S && M >= O ? (h = [
|
|
10273
10273
|
n,
|
|
10274
10274
|
B,
|
|
10275
|
-
|
|
10276
|
-
],
|
|
10275
|
+
l
|
|
10276
|
+
], N = h[0], F = h[1], A = h[2]) : O >= M && O >= S ? (f = [
|
|
10277
10277
|
B,
|
|
10278
10278
|
n,
|
|
10279
|
-
|
|
10280
|
-
],
|
|
10279
|
+
l
|
|
10280
|
+
], N = f[0], F = f[1], A = f[2]) : (g = [
|
|
10281
10281
|
B,
|
|
10282
|
-
|
|
10282
|
+
l,
|
|
10283
10283
|
n
|
|
10284
|
-
],
|
|
10285
|
-
bottomLeft:
|
|
10286
|
-
topLeft:
|
|
10284
|
+
], N = g[0], F = g[1], A = g[2]), (A.x - F.x) * (N.y - F.y) - (A.y - F.y) * (N.x - F.x) < 0 && (P = [A, N], N = P[0], A = P[1]), {
|
|
10285
|
+
bottomLeft: N,
|
|
10286
|
+
topLeft: F,
|
|
10287
10287
|
topRight: A
|
|
10288
10288
|
};
|
|
10289
10289
|
}
|
|
10290
|
-
function
|
|
10291
|
-
var
|
|
10292
|
-
if (
|
|
10293
|
-
var g = Math.round(k(B, n) /
|
|
10290
|
+
function c(B, n, l, h) {
|
|
10291
|
+
var f = (p(v(B, l, h, 5)) / 7 + p(v(B, n, h, 5)) / 7 + p(v(l, B, h, 5)) / 7 + p(v(n, B, h, 5)) / 7) / 4;
|
|
10292
|
+
if (f < 1) throw new Error("Invalid module size");
|
|
10293
|
+
var g = Math.round(k(B, n) / f), P = Math.round(k(B, l) / f), S = Math.floor((g + P) / 2) + 7;
|
|
10294
10294
|
switch (S % 4) {
|
|
10295
10295
|
case 0:
|
|
10296
10296
|
S++;
|
|
@@ -10301,79 +10301,79 @@ var i2 = /* @__PURE__ */ r2(((e, t) => {
|
|
|
10301
10301
|
}
|
|
10302
10302
|
return {
|
|
10303
10303
|
dimension: S,
|
|
10304
|
-
moduleSize:
|
|
10304
|
+
moduleSize: f
|
|
10305
10305
|
};
|
|
10306
10306
|
}
|
|
10307
|
-
function m(B, n,
|
|
10308
|
-
var
|
|
10307
|
+
function m(B, n, l, h) {
|
|
10308
|
+
var f = [{
|
|
10309
10309
|
x: Math.floor(B.x),
|
|
10310
10310
|
y: Math.floor(B.y)
|
|
10311
|
-
}], g = Math.abs(n.y - B.y) > Math.abs(n.x - B.x),
|
|
10312
|
-
g ? (
|
|
10313
|
-
for (var
|
|
10311
|
+
}], g = Math.abs(n.y - B.y) > Math.abs(n.x - B.x), P, S, M, O;
|
|
10312
|
+
g ? (P = Math.floor(B.y), S = Math.floor(B.x), M = Math.floor(n.y), O = Math.floor(n.x)) : (P = Math.floor(B.x), S = Math.floor(B.y), M = Math.floor(n.x), O = Math.floor(n.y));
|
|
10313
|
+
for (var N = Math.abs(M - P), F = Math.abs(O - S), A = Math.floor(-N / 2), E = P < M ? 1 : -1, L = S < O ? 1 : -1, D = !0, _ = P, Q = S; _ !== M + E; _ += E) {
|
|
10314
10314
|
var I = g ? Q : _, j = g ? _ : Q;
|
|
10315
|
-
if (
|
|
10315
|
+
if (l.get(I, j) !== D && (D = !D, f.push({
|
|
10316
10316
|
x: I,
|
|
10317
10317
|
y: j
|
|
10318
|
-
}),
|
|
10318
|
+
}), f.length === h + 1))
|
|
10319
10319
|
break;
|
|
10320
|
-
if (A +=
|
|
10320
|
+
if (A += F, A > 0) {
|
|
10321
10321
|
if (Q === O) break;
|
|
10322
|
-
Q +=
|
|
10322
|
+
Q += L, A -= N;
|
|
10323
10323
|
}
|
|
10324
10324
|
}
|
|
10325
|
-
for (var z = [],
|
|
10325
|
+
for (var z = [], R = 0; R < h; R++) f[R] && f[R + 1] ? z.push(k(f[R], f[R + 1])) : z.push(0);
|
|
10326
10326
|
return z;
|
|
10327
10327
|
}
|
|
10328
|
-
function v(B, n,
|
|
10329
|
-
var
|
|
10330
|
-
x: B.x -
|
|
10328
|
+
function v(B, n, l, h) {
|
|
10329
|
+
var f, g = n.y - B.y, P = n.x - B.x, S = m(B, n, l, Math.ceil(h / 2)), M = m(B, {
|
|
10330
|
+
x: B.x - P,
|
|
10331
10331
|
y: B.y - g
|
|
10332
|
-
},
|
|
10333
|
-
return (
|
|
10332
|
+
}, l, Math.ceil(h / 2)), O = S.shift() + M.shift() - 1;
|
|
10333
|
+
return (f = M.concat(O)).concat.apply(f, S);
|
|
10334
10334
|
}
|
|
10335
|
-
function
|
|
10336
|
-
var
|
|
10337
|
-
return n.forEach(function(
|
|
10338
|
-
h += Math.pow(B[g] -
|
|
10335
|
+
function y(B, n) {
|
|
10336
|
+
var l = p(B) / p(n), h = 0;
|
|
10337
|
+
return n.forEach(function(f, g) {
|
|
10338
|
+
h += Math.pow(B[g] - f * l, 2);
|
|
10339
10339
|
}), {
|
|
10340
|
-
averageSize:
|
|
10340
|
+
averageSize: l,
|
|
10341
10341
|
error: h
|
|
10342
10342
|
};
|
|
10343
10343
|
}
|
|
10344
|
-
function C(B, n,
|
|
10344
|
+
function C(B, n, l) {
|
|
10345
10345
|
try {
|
|
10346
10346
|
var h = v(B, {
|
|
10347
10347
|
x: -1,
|
|
10348
10348
|
y: B.y
|
|
10349
|
-
},
|
|
10349
|
+
}, l, n.length), f = v(B, {
|
|
10350
10350
|
x: B.x,
|
|
10351
10351
|
y: -1
|
|
10352
|
-
},
|
|
10352
|
+
}, l, n.length), g = v(B, {
|
|
10353
10353
|
x: Math.max(0, B.x - B.y) - 1,
|
|
10354
10354
|
y: Math.max(0, B.y - B.x) - 1
|
|
10355
|
-
},
|
|
10356
|
-
x: Math.min(
|
|
10357
|
-
y: Math.min(
|
|
10358
|
-
},
|
|
10359
|
-
return
|
|
10355
|
+
}, l, n.length), P = v(B, {
|
|
10356
|
+
x: Math.min(l.width, B.x + B.y) + 1,
|
|
10357
|
+
y: Math.min(l.height, B.y + B.x) + 1
|
|
10358
|
+
}, l, n.length), S = y(h, n), M = y(f, n), O = y(g, n), N = y(P, n), F = Math.sqrt(S.error * S.error + M.error * M.error + O.error * O.error + N.error * N.error), A = (S.averageSize + M.averageSize + O.averageSize + N.averageSize) / 4;
|
|
10359
|
+
return F + (Math.pow(S.averageSize - A, 2) + Math.pow(M.averageSize - A, 2) + Math.pow(O.averageSize - A, 2) + Math.pow(N.averageSize - A, 2)) / A;
|
|
10360
10360
|
} catch {
|
|
10361
10361
|
return 1 / 0;
|
|
10362
10362
|
}
|
|
10363
10363
|
}
|
|
10364
10364
|
function w(B, n) {
|
|
10365
|
-
for (var
|
|
10365
|
+
for (var l = Math.round(n.x); B.get(l, Math.round(n.y)); ) l--;
|
|
10366
10366
|
for (var h = Math.round(n.x); B.get(h, Math.round(n.y)); ) h++;
|
|
10367
|
-
for (var
|
|
10368
|
-
for (var
|
|
10367
|
+
for (var f = (l + h) / 2, g = Math.round(n.y); B.get(Math.round(f), g); ) g--;
|
|
10368
|
+
for (var P = Math.round(n.y); B.get(Math.round(f), P); ) P++;
|
|
10369
10369
|
return {
|
|
10370
|
-
x:
|
|
10371
|
-
y: (g +
|
|
10370
|
+
x: f,
|
|
10371
|
+
y: (g + P) / 2
|
|
10372
10372
|
};
|
|
10373
10373
|
}
|
|
10374
10374
|
function b(B) {
|
|
10375
|
-
for (var n = [],
|
|
10376
|
-
for (var j = 0, z = !1,
|
|
10375
|
+
for (var n = [], l = [], h = [], f = [], g = function(I) {
|
|
10376
|
+
for (var j = 0, z = !1, R = [
|
|
10377
10377
|
0,
|
|
10378
10378
|
0,
|
|
10379
10379
|
0,
|
|
@@ -10383,65 +10383,65 @@ var i2 = /* @__PURE__ */ r2(((e, t) => {
|
|
|
10383
10383
|
var i3 = B.get(G, I);
|
|
10384
10384
|
if (i3 === z) j++;
|
|
10385
10385
|
else {
|
|
10386
|
-
|
|
10387
|
-
|
|
10388
|
-
|
|
10389
|
-
|
|
10390
|
-
|
|
10386
|
+
R = [
|
|
10387
|
+
R[1],
|
|
10388
|
+
R[2],
|
|
10389
|
+
R[3],
|
|
10390
|
+
R[4],
|
|
10391
10391
|
j
|
|
10392
10392
|
], j = 1, z = i3;
|
|
10393
|
-
var V = p(
|
|
10393
|
+
var V = p(R) / 7, q3 = Math.abs(R[0] - V) < V && Math.abs(R[1] - V) < V && Math.abs(R[2] - 3 * V) < 3 * V && Math.abs(R[3] - V) < V && Math.abs(R[4] - V) < V && !i3, Y = p(R.slice(-3)) / 3, X3 = Math.abs(R[2] - Y) < Y && Math.abs(R[3] - Y) < Y && Math.abs(R[4] - Y) < Y && i3;
|
|
10394
10394
|
if (q3) {
|
|
10395
|
-
var c3 = G -
|
|
10395
|
+
var c3 = G - R[3] - R[4], r3 = c3 - R[2], W = {
|
|
10396
10396
|
startX: r3,
|
|
10397
10397
|
endX: c3,
|
|
10398
10398
|
y: I
|
|
10399
|
-
}, o3 =
|
|
10400
|
-
return r3 >= H.bottom.startX && r3 <= H.bottom.endX || c3 >= H.bottom.startX && r3 <= H.bottom.endX || r3 <= H.bottom.startX && c3 >= H.bottom.endX &&
|
|
10399
|
+
}, o3 = l.filter(function(H) {
|
|
10400
|
+
return r3 >= H.bottom.startX && r3 <= H.bottom.endX || c3 >= H.bottom.startX && r3 <= H.bottom.endX || r3 <= H.bottom.startX && c3 >= H.bottom.endX && R[2] / (H.bottom.endX - H.bottom.startX) < s && R[2] / (H.bottom.endX - H.bottom.startX) > a;
|
|
10401
10401
|
});
|
|
10402
|
-
o3.length > 0 ? o3[0].bottom = W :
|
|
10402
|
+
o3.length > 0 ? o3[0].bottom = W : l.push({
|
|
10403
10403
|
top: W,
|
|
10404
10404
|
bottom: W
|
|
10405
10405
|
});
|
|
10406
10406
|
}
|
|
10407
10407
|
if (X3) {
|
|
10408
|
-
var l3 = G -
|
|
10408
|
+
var l3 = G - R[4], s3 = l3 - R[3], W = {
|
|
10409
10409
|
startX: s3,
|
|
10410
10410
|
y: I,
|
|
10411
10411
|
endX: l3
|
|
10412
|
-
}, o3 =
|
|
10413
|
-
return s3 >= $.bottom.startX && s3 <= $.bottom.endX || l3 >= $.bottom.startX && s3 <= $.bottom.endX || s3 <= $.bottom.startX && l3 >= $.bottom.endX &&
|
|
10412
|
+
}, o3 = f.filter(function($) {
|
|
10413
|
+
return s3 >= $.bottom.startX && s3 <= $.bottom.endX || l3 >= $.bottom.startX && s3 <= $.bottom.endX || s3 <= $.bottom.startX && l3 >= $.bottom.endX && R[2] / ($.bottom.endX - $.bottom.startX) < s && R[2] / ($.bottom.endX - $.bottom.startX) > a;
|
|
10414
10414
|
});
|
|
10415
|
-
o3.length > 0 ? o3[0].bottom = W :
|
|
10415
|
+
o3.length > 0 ? o3[0].bottom = W : f.push({
|
|
10416
10416
|
top: W,
|
|
10417
10417
|
bottom: W
|
|
10418
10418
|
});
|
|
10419
10419
|
}
|
|
10420
10420
|
}
|
|
10421
10421
|
}, q = -1; q <= B.width; q++) t3(q);
|
|
10422
|
-
n.push.apply(n,
|
|
10422
|
+
n.push.apply(n, l.filter(function(G) {
|
|
10423
10423
|
return G.bottom.y !== I && G.bottom.y - G.top.y >= 2;
|
|
10424
|
-
})),
|
|
10424
|
+
})), l = l.filter(function(G) {
|
|
10425
10425
|
return G.bottom.y === I;
|
|
10426
|
-
}), h.push.apply(h,
|
|
10426
|
+
}), h.push.apply(h, f.filter(function(G) {
|
|
10427
10427
|
return G.bottom.y !== I;
|
|
10428
|
-
})),
|
|
10428
|
+
})), f = f.filter(function(G) {
|
|
10429
10429
|
return G.bottom.y === I;
|
|
10430
10430
|
});
|
|
10431
|
-
},
|
|
10432
|
-
n.push.apply(n,
|
|
10431
|
+
}, P = 0; P <= B.height; P++) g(P);
|
|
10432
|
+
n.push.apply(n, l.filter(function(I) {
|
|
10433
10433
|
return I.bottom.y - I.top.y >= 2;
|
|
10434
|
-
})), h.push.apply(h,
|
|
10434
|
+
})), h.push.apply(h, f);
|
|
10435
10435
|
var S = n.filter(function(I) {
|
|
10436
10436
|
return I.bottom.y - I.top.y >= 2;
|
|
10437
10437
|
}).map(function(I) {
|
|
10438
10438
|
var j = (I.top.startX + I.top.endX + I.bottom.startX + I.bottom.endX) / 4, z = (I.top.y + I.bottom.y + 1) / 2;
|
|
10439
10439
|
if (B.get(Math.round(j), Math.round(z))) {
|
|
10440
|
-
var
|
|
10440
|
+
var R = [
|
|
10441
10441
|
I.top.endX - I.top.startX,
|
|
10442
10442
|
I.bottom.endX - I.bottom.startX,
|
|
10443
10443
|
I.bottom.y - I.top.y + 1
|
|
10444
|
-
], t3 = p(
|
|
10444
|
+
], t3 = p(R) / R.length;
|
|
10445
10445
|
return {
|
|
10446
10446
|
score: C({
|
|
10447
10447
|
x: Math.round(j),
|
|
@@ -10464,7 +10464,7 @@ var i2 = /* @__PURE__ */ r2(((e, t) => {
|
|
|
10464
10464
|
return I.score - j.score;
|
|
10465
10465
|
}).map(function(I, j, z) {
|
|
10466
10466
|
if (j > d) return null;
|
|
10467
|
-
var
|
|
10467
|
+
var R = z.filter(function(q, G) {
|
|
10468
10468
|
return j !== G;
|
|
10469
10469
|
}).map(function(q) {
|
|
10470
10470
|
return {
|
|
@@ -10476,10 +10476,10 @@ var i2 = /* @__PURE__ */ r2(((e, t) => {
|
|
|
10476
10476
|
}).sort(function(q, G) {
|
|
10477
10477
|
return q.score - G.score;
|
|
10478
10478
|
});
|
|
10479
|
-
if (
|
|
10480
|
-
var t3 = I.score +
|
|
10479
|
+
if (R.length < 2) return null;
|
|
10480
|
+
var t3 = I.score + R[0].score + R[1].score;
|
|
10481
10481
|
return {
|
|
10482
|
-
points: [I].concat(
|
|
10482
|
+
points: [I].concat(R.slice(0, 2)),
|
|
10483
10483
|
score: t3
|
|
10484
10484
|
};
|
|
10485
10485
|
}).filter(function(I) {
|
|
@@ -10488,27 +10488,27 @@ var i2 = /* @__PURE__ */ r2(((e, t) => {
|
|
|
10488
10488
|
return I.score - j.score;
|
|
10489
10489
|
});
|
|
10490
10490
|
if (S.length === 0) return null;
|
|
10491
|
-
var M =
|
|
10491
|
+
var M = u(S[0].points[0], S[0].points[1], S[0].points[2]), O = M.topRight, N = M.topLeft, F = M.bottomLeft, A = x(B, h, O, N, F), E = [];
|
|
10492
10492
|
A && E.push({
|
|
10493
10493
|
alignmentPattern: {
|
|
10494
10494
|
x: A.alignmentPattern.x,
|
|
10495
10495
|
y: A.alignmentPattern.y
|
|
10496
10496
|
},
|
|
10497
10497
|
bottomLeft: {
|
|
10498
|
-
x:
|
|
10499
|
-
y:
|
|
10498
|
+
x: F.x,
|
|
10499
|
+
y: F.y
|
|
10500
10500
|
},
|
|
10501
10501
|
dimension: A.dimension,
|
|
10502
10502
|
topLeft: {
|
|
10503
|
-
x:
|
|
10504
|
-
y:
|
|
10503
|
+
x: N.x,
|
|
10504
|
+
y: N.y
|
|
10505
10505
|
},
|
|
10506
10506
|
topRight: {
|
|
10507
10507
|
x: O.x,
|
|
10508
10508
|
y: O.y
|
|
10509
10509
|
}
|
|
10510
10510
|
});
|
|
10511
|
-
var
|
|
10511
|
+
var L = w(B, O), D = w(B, N), _ = w(B, F), Q = x(B, h, L, D, _);
|
|
10512
10512
|
return Q && E.push({
|
|
10513
10513
|
alignmentPattern: {
|
|
10514
10514
|
x: Q.alignmentPattern.x,
|
|
@@ -10523,66 +10523,66 @@ var i2 = /* @__PURE__ */ r2(((e, t) => {
|
|
|
10523
10523
|
y: D.y
|
|
10524
10524
|
},
|
|
10525
10525
|
topRight: {
|
|
10526
|
-
x:
|
|
10527
|
-
y:
|
|
10526
|
+
x: L.x,
|
|
10527
|
+
y: L.y
|
|
10528
10528
|
},
|
|
10529
10529
|
dimension: Q.dimension
|
|
10530
10530
|
}), E.length === 0 ? null : E;
|
|
10531
10531
|
}
|
|
10532
10532
|
o.locate = b;
|
|
10533
|
-
function x(B, n,
|
|
10534
|
-
var g,
|
|
10533
|
+
function x(B, n, l, h, f) {
|
|
10534
|
+
var g, P, S;
|
|
10535
10535
|
try {
|
|
10536
|
-
g =
|
|
10536
|
+
g = c(h, l, f, B), P = g.dimension, S = g.moduleSize;
|
|
10537
10537
|
} catch {
|
|
10538
10538
|
return null;
|
|
10539
10539
|
}
|
|
10540
10540
|
var M = {
|
|
10541
|
-
x:
|
|
10542
|
-
y:
|
|
10543
|
-
}, O = (k(h,
|
|
10544
|
-
x: h.x +
|
|
10545
|
-
y: h.y +
|
|
10541
|
+
x: l.x - h.x + f.x,
|
|
10542
|
+
y: l.y - h.y + f.y
|
|
10543
|
+
}, O = (k(h, f) + k(h, l)) / 2 / S, N = 1 - 3 / O, F = {
|
|
10544
|
+
x: h.x + N * (M.x - h.x),
|
|
10545
|
+
y: h.y + N * (M.y - h.y)
|
|
10546
10546
|
}, A = n.map(function(E) {
|
|
10547
|
-
var
|
|
10548
|
-
if (B.get(Math.floor(
|
|
10547
|
+
var L = (E.top.startX + E.top.endX + E.bottom.startX + E.bottom.endX) / 4, D = (E.top.y + E.bottom.y + 1) / 2;
|
|
10548
|
+
if (B.get(Math.floor(L), Math.floor(D))) {
|
|
10549
10549
|
var _ = [
|
|
10550
10550
|
E.top.endX - E.top.startX,
|
|
10551
10551
|
E.bottom.endX - E.bottom.startX,
|
|
10552
10552
|
E.bottom.y - E.top.y + 1
|
|
10553
10553
|
];
|
|
10554
10554
|
return p(_) / _.length, {
|
|
10555
|
-
x:
|
|
10555
|
+
x: L,
|
|
10556
10556
|
y: D,
|
|
10557
10557
|
score: C({
|
|
10558
|
-
x: Math.floor(
|
|
10558
|
+
x: Math.floor(L),
|
|
10559
10559
|
y: Math.floor(D)
|
|
10560
10560
|
}, [
|
|
10561
10561
|
1,
|
|
10562
10562
|
1,
|
|
10563
10563
|
1
|
|
10564
10564
|
], B) + k({
|
|
10565
|
-
x:
|
|
10565
|
+
x: L,
|
|
10566
10566
|
y: D
|
|
10567
|
-
},
|
|
10567
|
+
}, F)
|
|
10568
10568
|
};
|
|
10569
10569
|
}
|
|
10570
10570
|
}).filter(function(E) {
|
|
10571
10571
|
return !!E;
|
|
10572
|
-
}).sort(function(E,
|
|
10573
|
-
return E.score -
|
|
10572
|
+
}).sort(function(E, L) {
|
|
10573
|
+
return E.score - L.score;
|
|
10574
10574
|
});
|
|
10575
10575
|
return {
|
|
10576
|
-
alignmentPattern: O >= 15 && A.length ? A[0] :
|
|
10577
|
-
dimension:
|
|
10576
|
+
alignmentPattern: O >= 15 && A.length ? A[0] : F,
|
|
10577
|
+
dimension: P
|
|
10578
10578
|
};
|
|
10579
10579
|
}
|
|
10580
10580
|
})
|
|
10581
10581
|
]).default;
|
|
10582
10582
|
});
|
|
10583
10583
|
})), c2 = /* @__PURE__ */ s2(i2(), 1), l2 = 3e4, d2 = 200;
|
|
10584
|
-
function
|
|
10585
|
-
const { isConnected: o, isConnecting:
|
|
10584
|
+
function J2({ supabase: e, app: t, children: r }) {
|
|
10585
|
+
const { isConnected: o, isConnecting: i, session: d, deviceSessionId: a, connect: s, disconnect: k, error: p, clearError: u } = a2(), [c, m] = e3(!1), v = o && d && d.app !== t, y = !o || !!v;
|
|
10586
10586
|
return Z(() => {
|
|
10587
10587
|
if (!o) return;
|
|
10588
10588
|
(async () => {
|
|
@@ -10591,7 +10591,7 @@ function V2({ supabase: e, app: t, children: r }) {
|
|
|
10591
10591
|
k(e);
|
|
10592
10592
|
return;
|
|
10593
10593
|
}
|
|
10594
|
-
if (a) {
|
|
10594
|
+
if (e.realtime.setAuth(w.access_token), a) {
|
|
10595
10595
|
const { data: b } = await e.from("device_sessions").select("status").eq("id", a).maybeSingle();
|
|
10596
10596
|
(!b || b.status !== "active") && (m(!0), k(e));
|
|
10597
10597
|
}
|
|
@@ -10615,31 +10615,31 @@ function V2({ supabase: e, app: t, children: r }) {
|
|
|
10615
10615
|
e.functions.invoke("session/keepalive", { body: { deviceSessionId: a } });
|
|
10616
10616
|
}, l2);
|
|
10617
10617
|
return () => clearInterval(C);
|
|
10618
|
-
}, [o, a]),
|
|
10618
|
+
}, [o, a]), y ? /* @__PURE__ */ T(u2, {
|
|
10619
10619
|
app: t,
|
|
10620
|
-
sessionEnded:
|
|
10621
|
-
isConnecting:
|
|
10620
|
+
sessionEnded: c,
|
|
10621
|
+
isConnecting: i,
|
|
10622
10622
|
error: p,
|
|
10623
10623
|
onConnect: (C) => s(C, e),
|
|
10624
|
-
onClearError:
|
|
10624
|
+
onClearError: u,
|
|
10625
10625
|
onDismissEnded: () => m(!1)
|
|
10626
|
-
}) : /* @__PURE__ */
|
|
10626
|
+
}) : /* @__PURE__ */ T(u3, { children: r });
|
|
10627
10627
|
}
|
|
10628
10628
|
var M3 = {
|
|
10629
10629
|
pdv: "PDV",
|
|
10630
10630
|
kds: "KDS"
|
|
10631
10631
|
};
|
|
10632
|
-
function u2({ app: e, sessionEnded: t, isConnecting: r, error: o, onConnect:
|
|
10633
|
-
const s = J(null), k = J(null), p = J(null),
|
|
10632
|
+
function u2({ app: e, sessionEnded: t, isConnecting: r, error: o, onConnect: i, onClearError: d, onDismissEnded: a }) {
|
|
10633
|
+
const s = J(null), k = J(null), p = J(null), u = J(0), c = J(0), m = J(!1), v = J(0), [y, C] = e3(!1), [w, b] = e3(null);
|
|
10634
10634
|
function x() {
|
|
10635
|
-
v.current += 1, cancelAnimationFrame(
|
|
10635
|
+
v.current += 1, cancelAnimationFrame(u.current), p.current?.getTracks().forEach((O) => O.stop()), p.current = null, C(!1);
|
|
10636
10636
|
}
|
|
10637
10637
|
async function B() {
|
|
10638
10638
|
const O = v.current;
|
|
10639
10639
|
b(null);
|
|
10640
|
-
let
|
|
10640
|
+
let N;
|
|
10641
10641
|
try {
|
|
10642
|
-
|
|
10642
|
+
N = await navigator.mediaDevices.getUserMedia({ video: {
|
|
10643
10643
|
facingMode: { ideal: "environment" },
|
|
10644
10644
|
width: { ideal: 1280 },
|
|
10645
10645
|
height: { ideal: 720 }
|
|
@@ -10650,11 +10650,11 @@ function u2({ app: e, sessionEnded: t, isConnecting: r, error: o, onConnect: f,
|
|
|
10650
10650
|
return;
|
|
10651
10651
|
}
|
|
10652
10652
|
if (O !== v.current) {
|
|
10653
|
-
|
|
10653
|
+
N.getTracks().forEach((A) => A.stop());
|
|
10654
10654
|
return;
|
|
10655
10655
|
}
|
|
10656
|
-
if (p.current =
|
|
10657
|
-
s.current.srcObject =
|
|
10656
|
+
if (p.current = N, s.current) {
|
|
10657
|
+
s.current.srcObject = N;
|
|
10658
10658
|
try {
|
|
10659
10659
|
await s.current.play();
|
|
10660
10660
|
} catch {
|
|
@@ -10662,22 +10662,22 @@ function u2({ app: e, sessionEnded: t, isConnecting: r, error: o, onConnect: f,
|
|
|
10662
10662
|
}
|
|
10663
10663
|
if (O !== v.current) return;
|
|
10664
10664
|
C(!0);
|
|
10665
|
-
const
|
|
10665
|
+
const F = () => {
|
|
10666
10666
|
if (O !== v.current) return;
|
|
10667
10667
|
const A = s.current, E = k.current;
|
|
10668
10668
|
if (!A || !E || A.readyState !== A.HAVE_ENOUGH_DATA) {
|
|
10669
|
-
|
|
10669
|
+
u.current = requestAnimationFrame(F);
|
|
10670
10670
|
return;
|
|
10671
10671
|
}
|
|
10672
|
-
const
|
|
10673
|
-
if (
|
|
10674
|
-
|
|
10672
|
+
const L = performance.now();
|
|
10673
|
+
if (L - c.current < d2) {
|
|
10674
|
+
u.current = requestAnimationFrame(F);
|
|
10675
10675
|
return;
|
|
10676
10676
|
}
|
|
10677
|
-
|
|
10677
|
+
c.current = L;
|
|
10678
10678
|
const D = E.getContext("2d", { willReadFrequently: !0 });
|
|
10679
10679
|
if (!D) {
|
|
10680
|
-
|
|
10680
|
+
u.current = requestAnimationFrame(F);
|
|
10681
10681
|
return;
|
|
10682
10682
|
}
|
|
10683
10683
|
E.width = A.videoWidth, E.height = A.videoHeight, D.drawImage(A, 0, 0, E.width, E.height);
|
|
@@ -10694,14 +10694,14 @@ function u2({ app: e, sessionEnded: t, isConnecting: r, error: o, onConnect: f,
|
|
|
10694
10694
|
m.current = !1, b(`Este QR code é para o app ${j.toUpperCase()}, mas este dispositivo é ${M3[e]}. Gere um novo código no Manager.`);
|
|
10695
10695
|
return;
|
|
10696
10696
|
}
|
|
10697
|
-
|
|
10697
|
+
i(I).catch(() => {
|
|
10698
10698
|
m.current = !1, B();
|
|
10699
10699
|
});
|
|
10700
10700
|
return;
|
|
10701
10701
|
}
|
|
10702
|
-
|
|
10702
|
+
u.current = requestAnimationFrame(F);
|
|
10703
10703
|
};
|
|
10704
|
-
|
|
10704
|
+
u.current = requestAnimationFrame(F);
|
|
10705
10705
|
}
|
|
10706
10706
|
Z(() => (m.current = !1, B(), x), []), Z(() => {
|
|
10707
10707
|
o && (m.current = !1, x(), B());
|
|
@@ -10709,7 +10709,7 @@ function u2({ app: e, sessionEnded: t, isConnecting: r, error: o, onConnect: f,
|
|
|
10709
10709
|
function n() {
|
|
10710
10710
|
d(), b(null), m.current = !1, x(), B();
|
|
10711
10711
|
}
|
|
10712
|
-
const
|
|
10712
|
+
const l = r || m.current, h = 288, f = Math.round(h * 0.65), g = Math.round((h - f) / 2), P = "var(--primary, #f97316)", S = "rgba(0,0,0,0.60)", M = 20;
|
|
10713
10713
|
return /* @__PURE__ */ U("div", {
|
|
10714
10714
|
style: {
|
|
10715
10715
|
display: "flex",
|
|
@@ -10732,16 +10732,16 @@ function u2({ app: e, sessionEnded: t, isConnecting: r, error: o, onConnect: f,
|
|
|
10732
10732
|
textAlign: "center"
|
|
10733
10733
|
},
|
|
10734
10734
|
children: [
|
|
10735
|
-
/* @__PURE__ */
|
|
10735
|
+
/* @__PURE__ */ T("div", {
|
|
10736
10736
|
style: {
|
|
10737
10737
|
borderRadius: "9999px",
|
|
10738
|
-
background: `color-mix(in oklch, ${
|
|
10738
|
+
background: `color-mix(in oklch, ${P} 15%, transparent)`,
|
|
10739
10739
|
padding: "1rem"
|
|
10740
10740
|
},
|
|
10741
|
-
children: /* @__PURE__ */
|
|
10741
|
+
children: /* @__PURE__ */ T(H3, { style: {
|
|
10742
10742
|
width: "2.5rem",
|
|
10743
10743
|
height: "2.5rem",
|
|
10744
|
-
color:
|
|
10744
|
+
color: P
|
|
10745
10745
|
} })
|
|
10746
10746
|
}),
|
|
10747
10747
|
/* @__PURE__ */ U("h1", {
|
|
@@ -10751,12 +10751,12 @@ function u2({ app: e, sessionEnded: t, isConnecting: r, error: o, onConnect: f,
|
|
|
10751
10751
|
margin: 0,
|
|
10752
10752
|
color: "var(--foreground, #f1f5f9)"
|
|
10753
10753
|
},
|
|
10754
|
-
children: ["tabl ", /* @__PURE__ */
|
|
10755
|
-
style: { color:
|
|
10754
|
+
children: ["tabl ", /* @__PURE__ */ T("span", {
|
|
10755
|
+
style: { color: P },
|
|
10756
10756
|
children: M3[e]
|
|
10757
10757
|
})]
|
|
10758
10758
|
}),
|
|
10759
|
-
/* @__PURE__ */
|
|
10759
|
+
/* @__PURE__ */ T("p", {
|
|
10760
10760
|
style: {
|
|
10761
10761
|
fontSize: "0.875rem",
|
|
10762
10762
|
color: "var(--muted-foreground, #94a3b8)",
|
|
@@ -10780,13 +10780,13 @@ function u2({ app: e, sessionEnded: t, isConnecting: r, error: o, onConnect: f,
|
|
|
10780
10780
|
color: "#d97706"
|
|
10781
10781
|
},
|
|
10782
10782
|
children: [
|
|
10783
|
-
/* @__PURE__ */
|
|
10783
|
+
/* @__PURE__ */ T($3, { style: {
|
|
10784
10784
|
width: "1rem",
|
|
10785
10785
|
height: "1rem",
|
|
10786
10786
|
flexShrink: 0
|
|
10787
10787
|
} }),
|
|
10788
10788
|
"Sessão encerrada",
|
|
10789
|
-
/* @__PURE__ */
|
|
10789
|
+
/* @__PURE__ */ T("button", {
|
|
10790
10790
|
onClick: a,
|
|
10791
10791
|
style: {
|
|
10792
10792
|
marginLeft: "0.5rem",
|
|
@@ -10814,7 +10814,7 @@ function u2({ app: e, sessionEnded: t, isConnecting: r, error: o, onConnect: f,
|
|
|
10814
10814
|
boxShadow: "0 20px 40px rgba(0,0,0,0.5)"
|
|
10815
10815
|
},
|
|
10816
10816
|
children: [
|
|
10817
|
-
/* @__PURE__ */
|
|
10817
|
+
/* @__PURE__ */ T("video", {
|
|
10818
10818
|
ref: s,
|
|
10819
10819
|
style: {
|
|
10820
10820
|
position: "absolute",
|
|
@@ -10826,18 +10826,18 @@ function u2({ app: e, sessionEnded: t, isConnecting: r, error: o, onConnect: f,
|
|
|
10826
10826
|
muted: !0,
|
|
10827
10827
|
playsInline: !0
|
|
10828
10828
|
}),
|
|
10829
|
-
/* @__PURE__ */
|
|
10829
|
+
/* @__PURE__ */ T("canvas", {
|
|
10830
10830
|
ref: k,
|
|
10831
10831
|
style: { display: "none" }
|
|
10832
10832
|
}),
|
|
10833
|
-
|
|
10833
|
+
y && !l && /* @__PURE__ */ U("div", {
|
|
10834
10834
|
style: {
|
|
10835
10835
|
position: "absolute",
|
|
10836
10836
|
inset: 0,
|
|
10837
10837
|
pointerEvents: "none"
|
|
10838
10838
|
},
|
|
10839
10839
|
children: [
|
|
10840
|
-
/* @__PURE__ */
|
|
10840
|
+
/* @__PURE__ */ T("div", { style: {
|
|
10841
10841
|
position: "absolute",
|
|
10842
10842
|
top: 0,
|
|
10843
10843
|
left: 0,
|
|
@@ -10845,7 +10845,7 @@ function u2({ app: e, sessionEnded: t, isConnecting: r, error: o, onConnect: f,
|
|
|
10845
10845
|
height: g,
|
|
10846
10846
|
background: S
|
|
10847
10847
|
} }),
|
|
10848
|
-
/* @__PURE__ */
|
|
10848
|
+
/* @__PURE__ */ T("div", { style: {
|
|
10849
10849
|
position: "absolute",
|
|
10850
10850
|
bottom: 0,
|
|
10851
10851
|
left: 0,
|
|
@@ -10853,20 +10853,20 @@ function u2({ app: e, sessionEnded: t, isConnecting: r, error: o, onConnect: f,
|
|
|
10853
10853
|
height: g,
|
|
10854
10854
|
background: S
|
|
10855
10855
|
} }),
|
|
10856
|
-
/* @__PURE__ */
|
|
10856
|
+
/* @__PURE__ */ T("div", { style: {
|
|
10857
10857
|
position: "absolute",
|
|
10858
10858
|
top: g,
|
|
10859
10859
|
left: 0,
|
|
10860
10860
|
width: g,
|
|
10861
|
-
height:
|
|
10861
|
+
height: f,
|
|
10862
10862
|
background: S
|
|
10863
10863
|
} }),
|
|
10864
|
-
/* @__PURE__ */
|
|
10864
|
+
/* @__PURE__ */ T("div", { style: {
|
|
10865
10865
|
position: "absolute",
|
|
10866
10866
|
top: g,
|
|
10867
10867
|
right: 0,
|
|
10868
10868
|
width: g,
|
|
10869
|
-
height:
|
|
10869
|
+
height: f,
|
|
10870
10870
|
background: S
|
|
10871
10871
|
} }),
|
|
10872
10872
|
/* @__PURE__ */ U("div", {
|
|
@@ -10874,65 +10874,65 @@ function u2({ app: e, sessionEnded: t, isConnecting: r, error: o, onConnect: f,
|
|
|
10874
10874
|
position: "absolute",
|
|
10875
10875
|
top: g,
|
|
10876
10876
|
left: g,
|
|
10877
|
-
width:
|
|
10878
|
-
height:
|
|
10877
|
+
width: f,
|
|
10878
|
+
height: f,
|
|
10879
10879
|
overflow: "hidden"
|
|
10880
10880
|
},
|
|
10881
10881
|
children: [
|
|
10882
|
-
/* @__PURE__ */
|
|
10882
|
+
/* @__PURE__ */ T("div", { style: {
|
|
10883
10883
|
position: "absolute",
|
|
10884
10884
|
top: 0,
|
|
10885
10885
|
left: 0,
|
|
10886
10886
|
width: M,
|
|
10887
10887
|
height: M,
|
|
10888
|
-
borderTop: `2px solid ${
|
|
10889
|
-
borderLeft: `2px solid ${
|
|
10888
|
+
borderTop: `2px solid ${P}`,
|
|
10889
|
+
borderLeft: `2px solid ${P}`,
|
|
10890
10890
|
borderRadius: "3px 0 0 0"
|
|
10891
10891
|
} }),
|
|
10892
|
-
/* @__PURE__ */
|
|
10892
|
+
/* @__PURE__ */ T("div", { style: {
|
|
10893
10893
|
position: "absolute",
|
|
10894
10894
|
top: 0,
|
|
10895
10895
|
right: 0,
|
|
10896
10896
|
width: M,
|
|
10897
10897
|
height: M,
|
|
10898
|
-
borderTop: `2px solid ${
|
|
10899
|
-
borderRight: `2px solid ${
|
|
10898
|
+
borderTop: `2px solid ${P}`,
|
|
10899
|
+
borderRight: `2px solid ${P}`,
|
|
10900
10900
|
borderRadius: "0 3px 0 0"
|
|
10901
10901
|
} }),
|
|
10902
|
-
/* @__PURE__ */
|
|
10902
|
+
/* @__PURE__ */ T("div", { style: {
|
|
10903
10903
|
position: "absolute",
|
|
10904
10904
|
bottom: 0,
|
|
10905
10905
|
left: 0,
|
|
10906
10906
|
width: M,
|
|
10907
10907
|
height: M,
|
|
10908
|
-
borderBottom: `2px solid ${
|
|
10909
|
-
borderLeft: `2px solid ${
|
|
10908
|
+
borderBottom: `2px solid ${P}`,
|
|
10909
|
+
borderLeft: `2px solid ${P}`,
|
|
10910
10910
|
borderRadius: "0 0 0 3px"
|
|
10911
10911
|
} }),
|
|
10912
|
-
/* @__PURE__ */
|
|
10912
|
+
/* @__PURE__ */ T("div", { style: {
|
|
10913
10913
|
position: "absolute",
|
|
10914
10914
|
bottom: 0,
|
|
10915
10915
|
right: 0,
|
|
10916
10916
|
width: M,
|
|
10917
10917
|
height: M,
|
|
10918
|
-
borderBottom: `2px solid ${
|
|
10919
|
-
borderRight: `2px solid ${
|
|
10918
|
+
borderBottom: `2px solid ${P}`,
|
|
10919
|
+
borderRight: `2px solid ${P}`,
|
|
10920
10920
|
borderRadius: "0 0 3px 0"
|
|
10921
10921
|
} }),
|
|
10922
|
-
/* @__PURE__ */
|
|
10922
|
+
/* @__PURE__ */ T("div", { style: {
|
|
10923
10923
|
position: "absolute",
|
|
10924
10924
|
left: 0,
|
|
10925
10925
|
right: 0,
|
|
10926
10926
|
height: 2,
|
|
10927
|
-
background: `linear-gradient(90deg, transparent, ${
|
|
10928
|
-
boxShadow: `0 0 6px ${
|
|
10927
|
+
background: `linear-gradient(90deg, transparent, ${P}, transparent)`,
|
|
10928
|
+
boxShadow: `0 0 6px ${P}`,
|
|
10929
10929
|
animation: "tabl-scan 2s ease-in-out infinite"
|
|
10930
10930
|
} })
|
|
10931
10931
|
]
|
|
10932
10932
|
})
|
|
10933
10933
|
]
|
|
10934
10934
|
}),
|
|
10935
|
-
!
|
|
10935
|
+
!y && !w && /* @__PURE__ */ U("div", {
|
|
10936
10936
|
style: {
|
|
10937
10937
|
position: "absolute",
|
|
10938
10938
|
inset: 0,
|
|
@@ -10943,12 +10943,12 @@ function u2({ app: e, sessionEnded: t, isConnecting: r, error: o, onConnect: f,
|
|
|
10943
10943
|
gap: "0.75rem",
|
|
10944
10944
|
background: "rgba(0,0,0,0.85)"
|
|
10945
10945
|
},
|
|
10946
|
-
children: [/* @__PURE__ */
|
|
10946
|
+
children: [/* @__PURE__ */ T(v3, { style: {
|
|
10947
10947
|
width: "2rem",
|
|
10948
10948
|
height: "2rem",
|
|
10949
|
-
color:
|
|
10949
|
+
color: P,
|
|
10950
10950
|
animation: "tabl-spin 1s linear infinite"
|
|
10951
|
-
} }), /* @__PURE__ */
|
|
10951
|
+
} }), /* @__PURE__ */ T("span", {
|
|
10952
10952
|
style: {
|
|
10953
10953
|
fontSize: "0.75rem",
|
|
10954
10954
|
color: "rgba(255,255,255,0.6)"
|
|
@@ -10956,7 +10956,7 @@ function u2({ app: e, sessionEnded: t, isConnecting: r, error: o, onConnect: f,
|
|
|
10956
10956
|
children: "Acessando câmera..."
|
|
10957
10957
|
})]
|
|
10958
10958
|
}),
|
|
10959
|
-
|
|
10959
|
+
l && /* @__PURE__ */ U("div", {
|
|
10960
10960
|
style: {
|
|
10961
10961
|
position: "absolute",
|
|
10962
10962
|
inset: 0,
|
|
@@ -10967,12 +10967,12 @@ function u2({ app: e, sessionEnded: t, isConnecting: r, error: o, onConnect: f,
|
|
|
10967
10967
|
gap: "0.75rem",
|
|
10968
10968
|
background: "rgba(0,0,0,0.75)"
|
|
10969
10969
|
},
|
|
10970
|
-
children: [/* @__PURE__ */
|
|
10970
|
+
children: [/* @__PURE__ */ T(v3, { style: {
|
|
10971
10971
|
width: "2.5rem",
|
|
10972
10972
|
height: "2.5rem",
|
|
10973
|
-
color:
|
|
10973
|
+
color: P,
|
|
10974
10974
|
animation: "tabl-spin 1s linear infinite"
|
|
10975
|
-
} }), /* @__PURE__ */
|
|
10975
|
+
} }), /* @__PURE__ */ T("span", {
|
|
10976
10976
|
style: {
|
|
10977
10977
|
fontSize: "0.875rem",
|
|
10978
10978
|
fontWeight: 500,
|
|
@@ -10996,14 +10996,14 @@ function u2({ app: e, sessionEnded: t, isConnecting: r, error: o, onConnect: f,
|
|
|
10996
10996
|
maxWidth: "20rem",
|
|
10997
10997
|
boxSizing: "border-box"
|
|
10998
10998
|
},
|
|
10999
|
-
children: [/* @__PURE__ */
|
|
10999
|
+
children: [/* @__PURE__ */ T("p", {
|
|
11000
11000
|
style: {
|
|
11001
11001
|
fontSize: "0.875rem",
|
|
11002
11002
|
color: "#ef4444",
|
|
11003
11003
|
margin: 0
|
|
11004
11004
|
},
|
|
11005
11005
|
children: w ?? o
|
|
11006
|
-
}), /* @__PURE__ */
|
|
11006
|
+
}), /* @__PURE__ */ T("button", {
|
|
11007
11007
|
onClick: n,
|
|
11008
11008
|
style: {
|
|
11009
11009
|
alignSelf: "flex-end",
|
|
@@ -11018,7 +11018,7 @@ function u2({ app: e, sessionEnded: t, isConnecting: r, error: o, onConnect: f,
|
|
|
11018
11018
|
children: "Tentar novamente"
|
|
11019
11019
|
})]
|
|
11020
11020
|
}),
|
|
11021
|
-
/* @__PURE__ */
|
|
11021
|
+
/* @__PURE__ */ T("style", { children: `
|
|
11022
11022
|
@keyframes tabl-scan {
|
|
11023
11023
|
0% { top: 0px; }
|
|
11024
11024
|
50% { top: calc(100% - 2px); }
|
|
@@ -11032,7 +11032,7 @@ function u2({ app: e, sessionEnded: t, isConnecting: r, error: o, onConnect: f,
|
|
|
11032
11032
|
]
|
|
11033
11033
|
});
|
|
11034
11034
|
}
|
|
11035
|
-
function
|
|
11035
|
+
function Y2(e) {
|
|
11036
11036
|
const { url: t, anonKey: r, realtimeEventsPerSecond: o = 10 } = e;
|
|
11037
11037
|
if (!t || !r) throw new Error("[tabl.io/auth] VITE_TABL_SERVER_URL e VITE_TABL_SERVER_ANON_KEY são obrigatórios.");
|
|
11038
11038
|
return W3(t, r, {
|
|
@@ -11108,7 +11108,7 @@ function C2(e, t) {
|
|
|
11108
11108
|
return typeof e == "function" ? e(t) : e;
|
|
11109
11109
|
}
|
|
11110
11110
|
function S3(e, t) {
|
|
11111
|
-
const { type: r = "all", exact: o, fetchStatus:
|
|
11111
|
+
const { type: r = "all", exact: o, fetchStatus: i, predicate: d, queryKey: a, stale: s } = e;
|
|
11112
11112
|
if (a) {
|
|
11113
11113
|
if (o) {
|
|
11114
11114
|
if (t.queryHash !== g3(a, t.options)) return !1;
|
|
@@ -11118,54 +11118,54 @@ function S3(e, t) {
|
|
|
11118
11118
|
const k = t.isActive();
|
|
11119
11119
|
if (r === "active" && !k || r === "inactive" && k) return !1;
|
|
11120
11120
|
}
|
|
11121
|
-
return !(typeof s == "boolean" && t.isStale() !== s ||
|
|
11121
|
+
return !(typeof s == "boolean" && t.isStale() !== s || i && i !== t.state.fetchStatus || d && !d(t));
|
|
11122
11122
|
}
|
|
11123
11123
|
function O3(e, t) {
|
|
11124
|
-
const { exact: r, status: o, predicate:
|
|
11124
|
+
const { exact: r, status: o, predicate: i, mutationKey: d } = e;
|
|
11125
11125
|
if (d) {
|
|
11126
11126
|
if (!t.options.mutationKey) return !1;
|
|
11127
11127
|
if (r) {
|
|
11128
11128
|
if (n3(t.options.mutationKey) !== n3(d)) return !1;
|
|
11129
11129
|
} else if (!a3(t.options.mutationKey, d)) return !1;
|
|
11130
11130
|
}
|
|
11131
|
-
return !(o && t.state.status !== o ||
|
|
11131
|
+
return !(o && t.state.status !== o || i && !i(t));
|
|
11132
11132
|
}
|
|
11133
11133
|
function g3(e, t) {
|
|
11134
11134
|
return (t?.queryKeyHashFn || n3)(e);
|
|
11135
11135
|
}
|
|
11136
11136
|
function n3(e) {
|
|
11137
|
-
return JSON.stringify(e, (t, r) =>
|
|
11137
|
+
return JSON.stringify(e, (t, r) => P3(r) ? Object.keys(r).sort().reduce((o, i) => (o[i] = r[i], o), {}) : r);
|
|
11138
11138
|
}
|
|
11139
11139
|
function a3(e, t) {
|
|
11140
11140
|
return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? Object.keys(t).every((r) => a3(e[r], t[r])) : !1;
|
|
11141
11141
|
}
|
|
11142
11142
|
var w2 = Object.prototype.hasOwnProperty;
|
|
11143
|
-
function
|
|
11143
|
+
function y3(e, t, r = 0) {
|
|
11144
11144
|
if (e === t) return e;
|
|
11145
11145
|
if (r > 500) return t;
|
|
11146
11146
|
const o = x3(e) && x3(t);
|
|
11147
|
-
if (!o && !(
|
|
11148
|
-
const
|
|
11147
|
+
if (!o && !(P3(e) && P3(t))) return t;
|
|
11148
|
+
const i = (o ? e : Object.keys(e)).length, d = o ? t : Object.keys(t), a = d.length, s = o ? new Array(a) : {};
|
|
11149
11149
|
let k = 0;
|
|
11150
11150
|
for (let p = 0; p < a; p++) {
|
|
11151
|
-
const
|
|
11152
|
-
if (
|
|
11153
|
-
s[
|
|
11151
|
+
const u = o ? p : d[p], c = e[u], m = t[u];
|
|
11152
|
+
if (c === m) {
|
|
11153
|
+
s[u] = c, (o ? p < i : w2.call(e, u)) && k++;
|
|
11154
11154
|
continue;
|
|
11155
11155
|
}
|
|
11156
|
-
if (
|
|
11157
|
-
s[
|
|
11156
|
+
if (c === null || m === null || typeof c != "object" || typeof m != "object") {
|
|
11157
|
+
s[u] = m;
|
|
11158
11158
|
continue;
|
|
11159
11159
|
}
|
|
11160
|
-
const v =
|
|
11161
|
-
s[
|
|
11160
|
+
const v = y3(c, m, r + 1);
|
|
11161
|
+
s[u] = v, v === c && k++;
|
|
11162
11162
|
}
|
|
11163
|
-
return
|
|
11163
|
+
return i === a && k === i ? e : s;
|
|
11164
11164
|
}
|
|
11165
11165
|
function x3(e) {
|
|
11166
11166
|
return Array.isArray(e) && e.length === Object.keys(e).length;
|
|
11167
11167
|
}
|
|
11168
|
-
function
|
|
11168
|
+
function P3(e) {
|
|
11169
11169
|
if (!A3(e)) return !1;
|
|
11170
11170
|
const t = e.constructor;
|
|
11171
11171
|
if (t === void 0) return !0;
|
|
@@ -11175,20 +11175,20 @@ function y3(e) {
|
|
|
11175
11175
|
function A3(e) {
|
|
11176
11176
|
return Object.prototype.toString.call(e) === "[object Object]";
|
|
11177
11177
|
}
|
|
11178
|
-
function
|
|
11178
|
+
function y2(e) {
|
|
11179
11179
|
return new Promise((t) => {
|
|
11180
11180
|
C3.setTimeout(t, e);
|
|
11181
11181
|
});
|
|
11182
11182
|
}
|
|
11183
|
-
function
|
|
11183
|
+
function P2(e, t, r) {
|
|
11184
11184
|
if (typeof r.structuralSharing == "function") return r.structuralSharing(e, t);
|
|
11185
11185
|
if (r.structuralSharing !== !1) {
|
|
11186
11186
|
if (process.env.NODE_ENV !== "production") try {
|
|
11187
|
-
return
|
|
11187
|
+
return y3(e, t);
|
|
11188
11188
|
} catch (o) {
|
|
11189
11189
|
throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${o}`), o;
|
|
11190
11190
|
}
|
|
11191
|
-
return
|
|
11191
|
+
return y3(e, t);
|
|
11192
11192
|
}
|
|
11193
11193
|
return t;
|
|
11194
11194
|
}
|
|
@@ -11205,10 +11205,10 @@ function j3(e, t) {
|
|
|
11205
11205
|
return process.env.NODE_ENV !== "production" && e.queryFn === f3 && console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`), !e.queryFn && t?.initialPromise ? () => t.initialPromise : !e.queryFn || e.queryFn === f3 ? () => Promise.reject(/* @__PURE__ */ new Error(`Missing queryFn: '${e.queryHash}'`)) : e.queryFn;
|
|
11206
11206
|
}
|
|
11207
11207
|
function b2(e, t, r) {
|
|
11208
|
-
let o = !1,
|
|
11208
|
+
let o = !1, i;
|
|
11209
11209
|
return Object.defineProperty(e, "signal", {
|
|
11210
11210
|
enumerable: !0,
|
|
11211
|
-
get: () => (
|
|
11211
|
+
get: () => (i ??= t(), o || (o = !0, i.aborted ? r() : i.addEventListener("abort", r, { once: !0 })), i)
|
|
11212
11212
|
}), e;
|
|
11213
11213
|
}
|
|
11214
11214
|
var M2 = class extends k3 {
|
|
@@ -11251,24 +11251,24 @@ var M2 = class extends k3 {
|
|
|
11251
11251
|
}, Q3 = new M2();
|
|
11252
11252
|
function S2() {
|
|
11253
11253
|
let e, t;
|
|
11254
|
-
const r = new Promise((
|
|
11255
|
-
e =
|
|
11254
|
+
const r = new Promise((i, d) => {
|
|
11255
|
+
e = i, t = d;
|
|
11256
11256
|
});
|
|
11257
11257
|
r.status = "pending", r.catch(() => {
|
|
11258
11258
|
});
|
|
11259
|
-
function o(
|
|
11260
|
-
Object.assign(r,
|
|
11259
|
+
function o(i) {
|
|
11260
|
+
Object.assign(r, i), delete r.resolve, delete r.reject;
|
|
11261
11261
|
}
|
|
11262
|
-
return r.resolve = (
|
|
11262
|
+
return r.resolve = (i) => {
|
|
11263
11263
|
o({
|
|
11264
11264
|
status: "fulfilled",
|
|
11265
|
-
value:
|
|
11266
|
-
}), e(
|
|
11267
|
-
}, r.reject = (
|
|
11265
|
+
value: i
|
|
11266
|
+
}), e(i);
|
|
11267
|
+
}, r.reject = (i) => {
|
|
11268
11268
|
o({
|
|
11269
11269
|
status: "rejected",
|
|
11270
|
-
reason:
|
|
11271
|
-
}), t(
|
|
11270
|
+
reason: i
|
|
11271
|
+
}), t(i);
|
|
11272
11272
|
}, r;
|
|
11273
11273
|
}
|
|
11274
11274
|
var O2 = k2;
|
|
@@ -11277,14 +11277,14 @@ function x2() {
|
|
|
11277
11277
|
s();
|
|
11278
11278
|
}, o = (s) => {
|
|
11279
11279
|
s();
|
|
11280
|
-
},
|
|
11280
|
+
}, i = O2;
|
|
11281
11281
|
const d = (s) => {
|
|
11282
|
-
t ? e.push(s) :
|
|
11282
|
+
t ? e.push(s) : i(() => {
|
|
11283
11283
|
r(s);
|
|
11284
11284
|
});
|
|
11285
11285
|
}, a = () => {
|
|
11286
11286
|
const s = e;
|
|
11287
|
-
e = [], s.length &&
|
|
11287
|
+
e = [], s.length && i(() => {
|
|
11288
11288
|
o(() => {
|
|
11289
11289
|
s.forEach((k) => {
|
|
11290
11290
|
r(k);
|
|
@@ -11316,7 +11316,7 @@ function x2() {
|
|
|
11316
11316
|
o = s;
|
|
11317
11317
|
},
|
|
11318
11318
|
setScheduler: (s) => {
|
|
11319
|
-
|
|
11319
|
+
i = s;
|
|
11320
11320
|
}
|
|
11321
11321
|
};
|
|
11322
11322
|
}
|
|
@@ -11365,7 +11365,7 @@ var p3 = class extends Error {
|
|
|
11365
11365
|
};
|
|
11366
11366
|
function U3(e) {
|
|
11367
11367
|
let t = !1, r = 0, o;
|
|
11368
|
-
const
|
|
11368
|
+
const i = S2(), d = () => i.status !== "pending", a = (C) => {
|
|
11369
11369
|
if (!d()) {
|
|
11370
11370
|
const w = new p3(C);
|
|
11371
11371
|
m(w), e.onCancel?.(w);
|
|
@@ -11374,17 +11374,17 @@ function U3(e) {
|
|
|
11374
11374
|
t = !0;
|
|
11375
11375
|
}, k = () => {
|
|
11376
11376
|
t = !1;
|
|
11377
|
-
}, p = () => Q3.isFocused() && (e.networkMode === "always" || h3.isOnline()) && e.canRun(),
|
|
11378
|
-
d() || (o?.(),
|
|
11377
|
+
}, p = () => Q3.isFocused() && (e.networkMode === "always" || h3.isOnline()) && e.canRun(), u = () => z3(e.networkMode) && e.canRun(), c = (C) => {
|
|
11378
|
+
d() || (o?.(), i.resolve(C));
|
|
11379
11379
|
}, m = (C) => {
|
|
11380
|
-
d() || (o?.(),
|
|
11380
|
+
d() || (o?.(), i.reject(C));
|
|
11381
11381
|
}, v = () => new Promise((C) => {
|
|
11382
11382
|
o = (w) => {
|
|
11383
11383
|
(d() || p()) && C(w);
|
|
11384
11384
|
}, e.onPause?.();
|
|
11385
11385
|
}).then(() => {
|
|
11386
11386
|
o = void 0, d() || e.onContinue?.();
|
|
11387
|
-
}),
|
|
11387
|
+
}), y = () => {
|
|
11388
11388
|
if (d()) return;
|
|
11389
11389
|
let C;
|
|
11390
11390
|
const w = r === 0 ? e.initialPromise : void 0;
|
|
@@ -11393,27 +11393,27 @@ function U3(e) {
|
|
|
11393
11393
|
} catch (b) {
|
|
11394
11394
|
C = Promise.reject(b);
|
|
11395
11395
|
}
|
|
11396
|
-
Promise.resolve(C).then(
|
|
11396
|
+
Promise.resolve(C).then(c).catch((b) => {
|
|
11397
11397
|
if (d()) return;
|
|
11398
|
-
const x = e.retry ?? (B3 ? 0 : 3), B = e.retryDelay ?? E2, n = typeof B == "function" ? B(r, b) : B,
|
|
11399
|
-
if (t || !
|
|
11398
|
+
const x = e.retry ?? (B3 ? 0 : 3), B = e.retryDelay ?? E2, n = typeof B == "function" ? B(r, b) : B, l = x === !0 || typeof x == "number" && r < x || typeof x == "function" && x(r, b);
|
|
11399
|
+
if (t || !l) {
|
|
11400
11400
|
m(b);
|
|
11401
11401
|
return;
|
|
11402
11402
|
}
|
|
11403
|
-
r++, e.onFail?.(r, b),
|
|
11404
|
-
t ? m(b) :
|
|
11403
|
+
r++, e.onFail?.(r, b), y2(n).then(() => p() ? void 0 : v()).then(() => {
|
|
11404
|
+
t ? m(b) : y();
|
|
11405
11405
|
});
|
|
11406
11406
|
});
|
|
11407
11407
|
};
|
|
11408
11408
|
return {
|
|
11409
|
-
promise:
|
|
11410
|
-
status: () =>
|
|
11409
|
+
promise: i,
|
|
11410
|
+
status: () => i.status,
|
|
11411
11411
|
cancel: a,
|
|
11412
|
-
continue: () => (o?.(),
|
|
11412
|
+
continue: () => (o?.(), i),
|
|
11413
11413
|
cancelRetry: s,
|
|
11414
11414
|
continueRetry: k,
|
|
11415
|
-
canStart:
|
|
11416
|
-
start: () => (
|
|
11415
|
+
canStart: u,
|
|
11416
|
+
start: () => (u() ? y() : v().then(y), i)
|
|
11417
11417
|
};
|
|
11418
11418
|
}
|
|
11419
11419
|
var G3 = class {
|
|
@@ -11462,7 +11462,7 @@ var G3 = class {
|
|
|
11462
11462
|
!this.observers.length && this.state.fetchStatus === "idle" && this.#r.remove(this);
|
|
11463
11463
|
}
|
|
11464
11464
|
setData(e, t) {
|
|
11465
|
-
const r =
|
|
11465
|
+
const r = P2(this.state.data, e, this.options);
|
|
11466
11466
|
return this.#n({
|
|
11467
11467
|
data: r,
|
|
11468
11468
|
type: "success",
|
|
@@ -11544,14 +11544,14 @@ var G3 = class {
|
|
|
11544
11544
|
enumerable: !0,
|
|
11545
11545
|
get: () => (this.#i = !0, r.signal)
|
|
11546
11546
|
});
|
|
11547
|
-
},
|
|
11547
|
+
}, i = () => {
|
|
11548
11548
|
const s = j3(this.options, t), p = (() => {
|
|
11549
|
-
const
|
|
11549
|
+
const u = {
|
|
11550
11550
|
client: this.#s,
|
|
11551
11551
|
queryKey: this.queryKey,
|
|
11552
11552
|
meta: this.meta
|
|
11553
11553
|
};
|
|
11554
|
-
return o(
|
|
11554
|
+
return o(u), u;
|
|
11555
11555
|
})();
|
|
11556
11556
|
return this.#i = !1, this.options.persister ? this.options.persister(s, p, this) : s(p);
|
|
11557
11557
|
}, a = (() => {
|
|
@@ -11561,7 +11561,7 @@ var G3 = class {
|
|
|
11561
11561
|
queryKey: this.queryKey,
|
|
11562
11562
|
client: this.#s,
|
|
11563
11563
|
state: this.state,
|
|
11564
|
-
fetchFn:
|
|
11564
|
+
fetchFn: i
|
|
11565
11565
|
};
|
|
11566
11566
|
return o(s), s;
|
|
11567
11567
|
})();
|
|
@@ -11638,7 +11638,7 @@ var G3 = class {
|
|
|
11638
11638
|
case "fetch":
|
|
11639
11639
|
return {
|
|
11640
11640
|
...r,
|
|
11641
|
-
...
|
|
11641
|
+
...N2(r.data, this.options),
|
|
11642
11642
|
fetchMeta: e.meta ?? null
|
|
11643
11643
|
};
|
|
11644
11644
|
case "success":
|
|
@@ -11654,14 +11654,14 @@ var G3 = class {
|
|
|
11654
11654
|
};
|
|
11655
11655
|
return this.#t = e.manual ? o : void 0, o;
|
|
11656
11656
|
case "error":
|
|
11657
|
-
const
|
|
11657
|
+
const i = e.error;
|
|
11658
11658
|
return {
|
|
11659
11659
|
...r,
|
|
11660
|
-
error:
|
|
11660
|
+
error: i,
|
|
11661
11661
|
errorUpdateCount: r.errorUpdateCount + 1,
|
|
11662
11662
|
errorUpdatedAt: Date.now(),
|
|
11663
11663
|
fetchFailureCount: r.fetchFailureCount + 1,
|
|
11664
|
-
fetchFailureReason:
|
|
11664
|
+
fetchFailureReason: i,
|
|
11665
11665
|
fetchStatus: "idle",
|
|
11666
11666
|
status: "error",
|
|
11667
11667
|
isInvalidated: !0
|
|
@@ -11689,7 +11689,7 @@ var G3 = class {
|
|
|
11689
11689
|
});
|
|
11690
11690
|
}
|
|
11691
11691
|
};
|
|
11692
|
-
function
|
|
11692
|
+
function N2(e, t) {
|
|
11693
11693
|
return {
|
|
11694
11694
|
fetchFailureCount: 0,
|
|
11695
11695
|
fetchFailureReason: null,
|
|
@@ -11726,48 +11726,48 @@ function I3(e) {
|
|
|
11726
11726
|
fetchStatus: "idle"
|
|
11727
11727
|
};
|
|
11728
11728
|
}
|
|
11729
|
-
function
|
|
11729
|
+
function N3(e) {
|
|
11730
11730
|
return { onFetch: (t, r) => {
|
|
11731
|
-
const o = t.options,
|
|
11731
|
+
const o = t.options, i = t.fetchOptions?.meta?.fetchMore?.direction, d = t.state.data?.pages || [], a = t.state.data?.pageParams || [];
|
|
11732
11732
|
let s = {
|
|
11733
11733
|
pages: [],
|
|
11734
11734
|
pageParams: []
|
|
11735
11735
|
}, k = 0;
|
|
11736
11736
|
const p = async () => {
|
|
11737
|
-
let
|
|
11738
|
-
const
|
|
11739
|
-
b2(
|
|
11740
|
-
}, m = j3(t.options, t.fetchOptions), v = async (
|
|
11741
|
-
if (
|
|
11742
|
-
if (C == null &&
|
|
11737
|
+
let u = !1;
|
|
11738
|
+
const c = (y) => {
|
|
11739
|
+
b2(y, () => t.signal, () => u = !0);
|
|
11740
|
+
}, m = j3(t.options, t.fetchOptions), v = async (y, C, w) => {
|
|
11741
|
+
if (u) return Promise.reject();
|
|
11742
|
+
if (C == null && y.pages.length) return Promise.resolve(y);
|
|
11743
11743
|
const x = await m((() => {
|
|
11744
|
-
const
|
|
11744
|
+
const l = {
|
|
11745
11745
|
client: t.client,
|
|
11746
11746
|
queryKey: t.queryKey,
|
|
11747
11747
|
pageParam: C,
|
|
11748
11748
|
direction: w ? "backward" : "forward",
|
|
11749
11749
|
meta: t.options.meta
|
|
11750
11750
|
};
|
|
11751
|
-
return
|
|
11751
|
+
return c(l), l;
|
|
11752
11752
|
})()), { maxPages: B } = t.options, n = w ? g2 : p2;
|
|
11753
11753
|
return {
|
|
11754
|
-
pages: n(
|
|
11755
|
-
pageParams: n(
|
|
11754
|
+
pages: n(y.pages, x, B),
|
|
11755
|
+
pageParams: n(y.pageParams, C, B)
|
|
11756
11756
|
};
|
|
11757
11757
|
};
|
|
11758
|
-
if (
|
|
11759
|
-
const
|
|
11758
|
+
if (i && d.length) {
|
|
11759
|
+
const y = i === "backward", C = y ? F2 : F3, w = {
|
|
11760
11760
|
pages: d,
|
|
11761
11761
|
pageParams: a
|
|
11762
11762
|
};
|
|
11763
|
-
s = await v(w, C(o, w),
|
|
11763
|
+
s = await v(w, C(o, w), y);
|
|
11764
11764
|
} else {
|
|
11765
|
-
const
|
|
11765
|
+
const y = e ?? d.length;
|
|
11766
11766
|
do {
|
|
11767
|
-
const C = k === 0 ? a[0] ?? o.initialPageParam :
|
|
11767
|
+
const C = k === 0 ? a[0] ?? o.initialPageParam : F3(o, s);
|
|
11768
11768
|
if (k > 0 && C == null) break;
|
|
11769
11769
|
s = await v(s, C), k++;
|
|
11770
|
-
} while (k <
|
|
11770
|
+
} while (k < y);
|
|
11771
11771
|
}
|
|
11772
11772
|
return s;
|
|
11773
11773
|
};
|
|
@@ -11779,20 +11779,20 @@ function F3(e) {
|
|
|
11779
11779
|
}, r) : t.fetchFn = p;
|
|
11780
11780
|
} };
|
|
11781
11781
|
}
|
|
11782
|
-
function
|
|
11782
|
+
function F3(e, { pages: t, pageParams: r }) {
|
|
11783
11783
|
const o = t.length - 1;
|
|
11784
11784
|
return t.length > 0 ? e.getNextPageParam(t[o], t, r[o], r) : void 0;
|
|
11785
11785
|
}
|
|
11786
|
-
function
|
|
11786
|
+
function F2(e, { pages: t, pageParams: r }) {
|
|
11787
11787
|
return t.length > 0 ? e.getPreviousPageParam?.(t[0], t, r[0], r) : void 0;
|
|
11788
11788
|
}
|
|
11789
|
-
var
|
|
11789
|
+
var T2 = class extends G3 {
|
|
11790
11790
|
#e;
|
|
11791
11791
|
#t;
|
|
11792
11792
|
#r;
|
|
11793
11793
|
#s;
|
|
11794
11794
|
constructor(e) {
|
|
11795
|
-
super(), this.#e = e.client, this.mutationId = e.mutationId, this.#r = e.mutationCache, this.#t = [], this.state = e.state ||
|
|
11795
|
+
super(), this.#e = e.client, this.mutationId = e.mutationId, this.#r = e.mutationCache, this.#t = [], this.state = e.state || R2(), this.setOptions(e.options), this.scheduleGc();
|
|
11796
11796
|
}
|
|
11797
11797
|
setOptions(e) {
|
|
11798
11798
|
this.options = e, this.updateGcTime(this.options.gcTime);
|
|
@@ -11846,21 +11846,21 @@ var L2 = class extends G3 {
|
|
|
11846
11846
|
networkMode: this.options.networkMode,
|
|
11847
11847
|
canRun: () => this.#r.canRun(this)
|
|
11848
11848
|
});
|
|
11849
|
-
const o = this.state.status === "pending",
|
|
11849
|
+
const o = this.state.status === "pending", i = !this.#s.canStart();
|
|
11850
11850
|
try {
|
|
11851
11851
|
if (o) t();
|
|
11852
11852
|
else {
|
|
11853
11853
|
this.#o({
|
|
11854
11854
|
type: "pending",
|
|
11855
11855
|
variables: e,
|
|
11856
|
-
isPaused:
|
|
11856
|
+
isPaused: i
|
|
11857
11857
|
}), this.#r.config.onMutate && await this.#r.config.onMutate(e, this, r);
|
|
11858
11858
|
const a = await this.options.onMutate?.(e, r);
|
|
11859
11859
|
a !== this.state.context && this.#o({
|
|
11860
11860
|
type: "pending",
|
|
11861
11861
|
context: a,
|
|
11862
11862
|
variables: e,
|
|
11863
|
-
isPaused:
|
|
11863
|
+
isPaused: i
|
|
11864
11864
|
});
|
|
11865
11865
|
}
|
|
11866
11866
|
const d = await this.#s.start();
|
|
@@ -11962,7 +11962,7 @@ var L2 = class extends G3 {
|
|
|
11962
11962
|
});
|
|
11963
11963
|
}
|
|
11964
11964
|
};
|
|
11965
|
-
function
|
|
11965
|
+
function R2() {
|
|
11966
11966
|
return {
|
|
11967
11967
|
context: void 0,
|
|
11968
11968
|
data: void 0,
|
|
@@ -11975,7 +11975,7 @@ function T2() {
|
|
|
11975
11975
|
submittedAt: 0
|
|
11976
11976
|
};
|
|
11977
11977
|
}
|
|
11978
|
-
var
|
|
11978
|
+
var L2 = class extends k3 {
|
|
11979
11979
|
constructor(e = {}) {
|
|
11980
11980
|
super(), this.config = e, this.#e = /* @__PURE__ */ new Set(), this.#t = /* @__PURE__ */ new Map(), this.#r = 0;
|
|
11981
11981
|
}
|
|
@@ -11983,7 +11983,7 @@ var R2 = class extends k3 {
|
|
|
11983
11983
|
#t;
|
|
11984
11984
|
#r;
|
|
11985
11985
|
build(e, t, r) {
|
|
11986
|
-
const o = new
|
|
11986
|
+
const o = new T2({
|
|
11987
11987
|
client: e,
|
|
11988
11988
|
mutationCache: this,
|
|
11989
11989
|
mutationId: ++this.#r,
|
|
@@ -12076,12 +12076,12 @@ var K3 = class extends k3 {
|
|
|
12076
12076
|
}
|
|
12077
12077
|
#e;
|
|
12078
12078
|
build(e, t, r) {
|
|
12079
|
-
const o = t.queryKey,
|
|
12080
|
-
let d = this.get(
|
|
12079
|
+
const o = t.queryKey, i = t.queryHash ?? g3(o, t);
|
|
12080
|
+
let d = this.get(i);
|
|
12081
12081
|
return d || (d = new I2({
|
|
12082
12082
|
client: e,
|
|
12083
12083
|
queryKey: o,
|
|
12084
|
-
queryHash:
|
|
12084
|
+
queryHash: i,
|
|
12085
12085
|
options: e.defaultQueryOptions(t),
|
|
12086
12086
|
state: r,
|
|
12087
12087
|
defaultOptions: e.getQueryDefaults(o)
|
|
@@ -12155,7 +12155,7 @@ var K3 = class extends k3 {
|
|
|
12155
12155
|
#i;
|
|
12156
12156
|
#n;
|
|
12157
12157
|
constructor(e = {}) {
|
|
12158
|
-
this.#e = e.queryCache || new K3(), this.#t = e.mutationCache || new
|
|
12158
|
+
this.#e = e.queryCache || new K3(), this.#t = e.mutationCache || new L2(), this.#r = e.defaultOptions || {}, this.#s = /* @__PURE__ */ new Map(), this.#o = /* @__PURE__ */ new Map(), this.#a = 0;
|
|
12159
12159
|
}
|
|
12160
12160
|
mount() {
|
|
12161
12161
|
this.#a++, this.#a === 1 && (this.#i = Q3.subscribe(async (e) => {
|
|
@@ -12198,7 +12198,7 @@ var K3 = class extends k3 {
|
|
|
12198
12198
|
return this.#e.findAll(e).map(({ queryKey: t, state: r }) => [t, r.data]);
|
|
12199
12199
|
}
|
|
12200
12200
|
setQueryData(e, t, r) {
|
|
12201
|
-
const o = this.defaultQueryOptions({ queryKey: e }),
|
|
12201
|
+
const o = this.defaultQueryOptions({ queryKey: e }), i = this.#e.get(o.queryHash)?.state.data, d = B2(t, i);
|
|
12202
12202
|
if (d !== void 0)
|
|
12203
12203
|
return this.#e.build(this, o).setData(d, {
|
|
12204
12204
|
...r,
|
|
@@ -12233,7 +12233,7 @@ var K3 = class extends k3 {
|
|
|
12233
12233
|
const r = {
|
|
12234
12234
|
revert: !0,
|
|
12235
12235
|
...t
|
|
12236
|
-
}, o = K.batch(() => this.#e.findAll(e).map((
|
|
12236
|
+
}, o = K.batch(() => this.#e.findAll(e).map((i) => i.cancel(r)));
|
|
12237
12237
|
return Promise.all(o).then(X).catch(X);
|
|
12238
12238
|
}
|
|
12239
12239
|
invalidateQueries(e, t = {}) {
|
|
@@ -12248,9 +12248,9 @@ var K3 = class extends k3 {
|
|
|
12248
12248
|
const r = {
|
|
12249
12249
|
...t,
|
|
12250
12250
|
cancelRefetch: t.cancelRefetch ?? !0
|
|
12251
|
-
}, o = K.batch(() => this.#e.findAll(e).filter((
|
|
12252
|
-
let d =
|
|
12253
|
-
return r.throwOnError || (d = d.catch(X)),
|
|
12251
|
+
}, o = K.batch(() => this.#e.findAll(e).filter((i) => !i.isDisabled() && !i.isStatic()).map((i) => {
|
|
12252
|
+
let d = i.fetch(void 0, r);
|
|
12253
|
+
return r.throwOnError || (d = d.catch(X)), i.state.fetchStatus === "paused" ? Promise.resolve() : d;
|
|
12254
12254
|
}));
|
|
12255
12255
|
return Promise.all(o).then(X);
|
|
12256
12256
|
}
|
|
@@ -12264,13 +12264,13 @@ var K3 = class extends k3 {
|
|
|
12264
12264
|
return this.fetchQuery(e).then(X).catch(X);
|
|
12265
12265
|
}
|
|
12266
12266
|
fetchInfiniteQuery(e) {
|
|
12267
|
-
return e.behavior =
|
|
12267
|
+
return e.behavior = N3(e.pages), this.fetchQuery(e);
|
|
12268
12268
|
}
|
|
12269
12269
|
prefetchInfiniteQuery(e) {
|
|
12270
12270
|
return this.fetchInfiniteQuery(e).then(X).catch(X);
|
|
12271
12271
|
}
|
|
12272
12272
|
ensureInfiniteQueryData(e) {
|
|
12273
|
-
return e.behavior =
|
|
12273
|
+
return e.behavior = N3(e.pages), this.ensureQueryData(e);
|
|
12274
12274
|
}
|
|
12275
12275
|
resumePausedMutations() {
|
|
12276
12276
|
return h3.isOnline() ? this.#t.resumePausedMutations() : Promise.resolve();
|
|
@@ -12333,26 +12333,26 @@ var K3 = class extends k3 {
|
|
|
12333
12333
|
this.#e.clear(), this.#t.clear();
|
|
12334
12334
|
}
|
|
12335
12335
|
};
|
|
12336
|
-
function
|
|
12336
|
+
function T3(e) {
|
|
12337
12337
|
if (!e || typeof e != "object") return !1;
|
|
12338
12338
|
const t = e;
|
|
12339
12339
|
return !!(t.code === "PGRST301" || typeof t.message == "string" && /jwt|token/i.test(t.message));
|
|
12340
12340
|
}
|
|
12341
|
-
function
|
|
12341
|
+
function Z2(e, t = {}) {
|
|
12342
12342
|
let r = null;
|
|
12343
12343
|
const o = () => r || (r = e.auth.refreshSession().then(({ error: k }) => !k).catch(() => !1).finally(() => {
|
|
12344
12344
|
r = null;
|
|
12345
|
-
}), r),
|
|
12346
|
-
|
|
12345
|
+
}), r), i = new K3({ onError: async (k, p) => {
|
|
12346
|
+
T3(k) && (await o() ? s.invalidateQueries({ queryKey: p.queryKey }) : await e.auth.signOut());
|
|
12347
12347
|
} }), { defaultOptions: d = {}, ...a } = t, s = new D2({
|
|
12348
|
-
queryCache:
|
|
12348
|
+
queryCache: i,
|
|
12349
12349
|
defaultOptions: {
|
|
12350
12350
|
...d,
|
|
12351
12351
|
queries: {
|
|
12352
12352
|
retry: (k, p) => {
|
|
12353
|
-
if (
|
|
12354
|
-
const
|
|
12355
|
-
return typeof
|
|
12353
|
+
if (T3(p)) return !1;
|
|
12354
|
+
const u = d.queries?.retry;
|
|
12355
|
+
return typeof u == "function" ? u(k, p) : k < (typeof u == "number" ? u : 1);
|
|
12356
12356
|
},
|
|
12357
12357
|
...d.queries
|
|
12358
12358
|
}
|
|
@@ -12361,16 +12361,98 @@ function $2(e, t = {}) {
|
|
|
12361
12361
|
});
|
|
12362
12362
|
return s;
|
|
12363
12363
|
}
|
|
12364
|
+
var _2 = 300, j2 = 1e3, Q2 = 3e4, z2 = class {
|
|
12365
|
+
tables = /* @__PURE__ */ new Map();
|
|
12366
|
+
supabase = null;
|
|
12367
|
+
authWatchActive = !1;
|
|
12368
|
+
/**
|
|
12369
|
+
* Registra um listener para eventos de uma tabela.
|
|
12370
|
+
* Canal criado no primeiro registro, destruído no último unsubscribe.
|
|
12371
|
+
*
|
|
12372
|
+
* IMPORTANTE: a tabela precisa estar na publication do Supabase Realtime
|
|
12373
|
+
* (`ALTER PUBLICATION supabase_realtime ADD TABLE <tabela>`).
|
|
12374
|
+
* Subscrever uma tabela fora da publication gera CHANNEL_ERROR em loop.
|
|
12375
|
+
*/
|
|
12376
|
+
subscribe(e, t, r, o) {
|
|
12377
|
+
this.supabase || (this.supabase = e, this.watchAuth(e));
|
|
12378
|
+
let i = this.tables.get(t);
|
|
12379
|
+
i ? i.closeTimer !== null && (clearTimeout(i.closeTimer), i.closeTimer = null) : (i = {
|
|
12380
|
+
channel: this.createChannel(t),
|
|
12381
|
+
listeners: /* @__PURE__ */ new Set(),
|
|
12382
|
+
refCount: 0,
|
|
12383
|
+
closeTimer: null
|
|
12384
|
+
}, this.tables.set(t, i));
|
|
12385
|
+
const d = {
|
|
12386
|
+
event: r,
|
|
12387
|
+
listener: o
|
|
12388
|
+
};
|
|
12389
|
+
return i.listeners.add(d), i.refCount++, () => {
|
|
12390
|
+
const a = this.tables.get(t);
|
|
12391
|
+
a && (a.listeners.delete(d), a.refCount = Math.max(0, a.refCount - 1), a.refCount === 0 && (a.closeTimer = setTimeout(() => {
|
|
12392
|
+
const s = this.tables.get(t);
|
|
12393
|
+
s && s.refCount === 0 && (this.supabase?.removeChannel(s.channel), this.tables.delete(t));
|
|
12394
|
+
}, _2)));
|
|
12395
|
+
};
|
|
12396
|
+
}
|
|
12397
|
+
watchAuth(e) {
|
|
12398
|
+
this.authWatchActive || (this.authWatchActive = !0, e.auth.onAuthStateChange((t, r) => {
|
|
12399
|
+
if (r) {
|
|
12400
|
+
if (t === "INITIAL_SESSION") {
|
|
12401
|
+
queueMicrotask(() => {
|
|
12402
|
+
this.tables.size > 0 && this.reconnectAll();
|
|
12403
|
+
});
|
|
12404
|
+
return;
|
|
12405
|
+
}
|
|
12406
|
+
(t === "SIGNED_IN" || t === "TOKEN_REFRESHED") && this.reconnectAll();
|
|
12407
|
+
}
|
|
12408
|
+
}));
|
|
12409
|
+
}
|
|
12410
|
+
reconnectAll() {
|
|
12411
|
+
for (const [e, t] of this.tables.entries())
|
|
12412
|
+
t.refCount !== 0 && (console.info(`[Realtime] 🔄 ${e}`), this.supabase?.removeChannel(t.channel), t.channel = this.createChannel(e));
|
|
12413
|
+
}
|
|
12414
|
+
createChannel(e, t = 0) {
|
|
12415
|
+
const r = `tabl:rt:${e}:${Date.now()}`;
|
|
12416
|
+
return this.supabase.channel(r).on("postgres_changes", {
|
|
12417
|
+
event: "*",
|
|
12418
|
+
schema: "public",
|
|
12419
|
+
table: e
|
|
12420
|
+
}, (o) => this.dispatch(e, o)).subscribe((o, i) => {
|
|
12421
|
+
o === "SUBSCRIBED" ? console.info(`[Realtime] ✅ ${e}`) : (o === "CHANNEL_ERROR" || o === "TIMED_OUT") && (console.error(`[Realtime] ❌ ${e} (${o})`, i ?? ""), this.scheduleReconnect(e, t));
|
|
12422
|
+
});
|
|
12423
|
+
}
|
|
12424
|
+
dispatch(e, t) {
|
|
12425
|
+
const r = this.tables.get(e);
|
|
12426
|
+
if (!r) return;
|
|
12427
|
+
const o = t.eventType;
|
|
12428
|
+
for (const { event: i, listener: d } of r.listeners) if (i === "*" || i === o) try {
|
|
12429
|
+
d(t);
|
|
12430
|
+
} catch (a) {
|
|
12431
|
+
console.error(`[Realtime] Erro em listener de ${e}:`, a);
|
|
12432
|
+
}
|
|
12433
|
+
}
|
|
12434
|
+
scheduleReconnect(e, t) {
|
|
12435
|
+
const r = this.tables.get(e);
|
|
12436
|
+
if (!r || r.refCount === 0) return;
|
|
12437
|
+
const o = Math.min(j2 * Math.pow(2, t), Q2);
|
|
12438
|
+
console.info(`[Realtime] Reconectando ${e} em ${o}ms (tentativa ${t + 1})`), setTimeout(() => {
|
|
12439
|
+
const i = this.tables.get(e);
|
|
12440
|
+
!i || i.refCount === 0 || (this.supabase?.removeChannel(i.channel), i.channel = this.createChannel(e, t + 1));
|
|
12441
|
+
}, o);
|
|
12442
|
+
}
|
|
12443
|
+
};
|
|
12444
|
+
const e5 = new z2();
|
|
12364
12445
|
export {
|
|
12365
|
-
|
|
12366
|
-
|
|
12367
|
-
|
|
12368
|
-
|
|
12369
|
-
|
|
12446
|
+
J2 as DeviceSessionGuard,
|
|
12447
|
+
$2 as LoginPage,
|
|
12448
|
+
W2 as RoleGuard,
|
|
12449
|
+
Z2 as createAuthAwareQueryClient,
|
|
12450
|
+
Y2 as createTablaClient,
|
|
12370
12451
|
m3 as getRoleFromMetadata,
|
|
12371
12452
|
n2 as hasRole,
|
|
12453
|
+
e5 as realtimeRegistry,
|
|
12372
12454
|
_3 as useAuth,
|
|
12373
12455
|
D3 as useAuthStore,
|
|
12374
12456
|
a2 as useDeviceSessionStore,
|
|
12375
|
-
|
|
12457
|
+
H2 as useRequireRole
|
|
12376
12458
|
};
|