@tabl.io/auth 0.3.0 → 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.
Files changed (3) hide show
  1. package/dist/index.d.ts +51 -0
  2. package/dist/index.js +2434 -1033
  3. package/package.json +4 -2
package/dist/index.js CHANGED
@@ -1,253 +1,253 @@
1
- import { create as u3 } from "zustand";
2
- import { persist as v3 } from "zustand/middleware";
3
- import { useEffect as J, useRef as Y, useState as Z } from "react";
4
- import { Loader2 as d3, QrCode as w3, WifiOff as h3 } from "lucide-react";
5
- import { Fragment as n3, jsx as _, jsxs as G } from "react/jsx-runtime";
6
- import { createClient as P3 } from "@supabase/supabase-js";
7
- var g3 = Object.create, B3 = Object.defineProperty, b3 = Object.getOwnPropertyDescriptor, p3 = Object.getOwnPropertyNames, y3 = Object.getPrototypeOf, M3 = Object.prototype.hasOwnProperty, x3 = (M, L) => () => (L || M((L = { exports: {} }).exports, L), L.exports), S3 = (M, L, O, v) => {
8
- if (L && typeof L == "object" || typeof L == "function")
9
- for (var b = p3(L), h = 0, n = b.length, d; h < n; h++)
10
- d = b[h], !M3.call(M, d) && d !== O && B3(M, d, {
11
- get: ((u) => L[u]).bind(null, d),
12
- enumerable: !(v = b3(L, d)) || v.enumerable
1
+ import { create as R3 } from "zustand";
2
+ import { persist as V3 } from "zustand/middleware";
3
+ import { useEffect as Z, useRef as J, useState as e3 } from "react";
4
+ import { Loader2 as v3, QrCode as H3, WifiOff as $3 } from "lucide-react";
5
+ import { Fragment as u3, jsx as T, jsxs as U } from "react/jsx-runtime";
6
+ import { createClient as W3 } from "@supabase/supabase-js";
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
+ if (t && typeof t == "object" || typeof t == "function")
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
+ get: ((k) => t[k]).bind(null, s),
12
+ enumerable: !(o = Y3(t, s)) || o.enumerable
13
13
  });
14
- return M;
15
- }, I3 = (M, L, O) => (O = M != null ? g3(y3(M)) : {}, S3(L || !M || !M.__esModule ? B3(O, "default", {
16
- value: M,
14
+ return e;
15
+ }, s2 = (e, t, r) => (r = e != null ? J3(e2(e)) : {}, o2(t || !e || !e.__esModule ? L3(r, "default", {
16
+ value: e,
17
17
  enumerable: !0
18
- }) : O, M)), l3 = {
18
+ }) : r, e)), b3 = {
19
19
  supervisor: 1,
20
20
  cashier: 2,
21
21
  manager: 3
22
22
  };
23
- function L3(M, L) {
24
- return l3[M] >= l3[L];
23
+ function n2(e, t) {
24
+ return b3[e] >= b3[t];
25
25
  }
26
- function c3(M) {
27
- const L = M?.role;
28
- return L === "manager" || L === "cashier" || L === "supervisor" ? L : null;
26
+ function m3(e) {
27
+ const t = e?.role;
28
+ return t === "manager" || t === "cashier" || t === "supervisor" ? t : null;
29
29
  }
30
- const k3 = u3()((M) => ({
30
+ const D3 = R3()((e) => ({
31
31
  user: null,
32
32
  role: null,
33
33
  isInitializing: !0,
34
34
  isAuthenticated: !1,
35
35
  error: null,
36
- init: (L) => {
37
- L.auth.getSession().then(({ data: { session: v } }) => {
38
- v?.user ? M({
39
- user: v.user,
40
- role: c3(v.user.app_metadata),
36
+ init: (t) => {
37
+ t.auth.getSession().then(({ data: { session: o } }) => {
38
+ o?.user ? e({
39
+ user: o.user,
40
+ role: m3(o.user.app_metadata),
41
41
  isAuthenticated: !0,
42
42
  isInitializing: !1
43
- }) : M({ isInitializing: !1 });
43
+ }) : e({ isInitializing: !1 });
44
44
  });
45
- const { data: { subscription: O } } = L.auth.onAuthStateChange((v, b) => {
46
- b?.user ? M({
47
- user: b.user,
48
- role: c3(b.user.app_metadata),
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
52
- }) : M({
52
+ }) : e({
53
53
  user: null,
54
54
  role: null,
55
55
  isAuthenticated: !1,
56
56
  isInitializing: !1
57
57
  });
58
58
  });
59
- return () => O.unsubscribe();
59
+ return () => r.unsubscribe();
60
60
  },
61
- signIn: async (L, O, v) => {
62
- M({ error: null });
63
- const { data: b, error: h } = await L.auth.signInWithPassword({
64
- email: O,
65
- password: v
61
+ signIn: async (t, r, o) => {
62
+ e({ error: null });
63
+ const { data: i, error: d } = await t.auth.signInWithPassword({
64
+ email: r,
65
+ password: o
66
66
  });
67
- if (h)
68
- throw M({ error: h.message }), h;
69
- if (!c3(b.user?.app_metadata)) {
70
- await L.auth.signOut();
71
- const n = "Usuário sem permissão de acesso.";
72
- throw M({ error: n }), new Error(n);
67
+ if (d)
68
+ throw e({ error: d.message }), d;
69
+ if (!m3(i.user?.app_metadata)) {
70
+ await t.auth.signOut();
71
+ const a = "Usuário sem permissão de acesso.";
72
+ throw e({ error: a }), new Error(a);
73
73
  }
74
74
  },
75
- signOut: async (L) => {
76
- await L.auth.signOut();
75
+ signOut: async (t) => {
76
+ await t.auth.signOut();
77
77
  }
78
- })), A3 = u3()(v3((M, L) => ({
78
+ })), a2 = R3()(V3((e, t) => ({
79
79
  deviceId: crypto.randomUUID(),
80
80
  deviceSessionId: null,
81
81
  session: null,
82
82
  isConnected: !1,
83
83
  isConnecting: !1,
84
84
  error: null,
85
- connect: async (O, v) => {
86
- M({
85
+ connect: async (r, o) => {
86
+ e({
87
87
  isConnecting: !0,
88
88
  error: null
89
89
  });
90
90
  try {
91
- const { deviceId: b } = L(), { data: h, error: n } = await v.functions.invoke("session/connect", { body: {
92
- otp: O.replace(/-/g, ""),
93
- deviceId: b
91
+ const { deviceId: i } = t(), { data: d, error: a } = await o.functions.invoke("session/connect", { body: {
92
+ otp: r.replace(/-/g, ""),
93
+ deviceId: i
94
94
  } });
95
- if (n) throw n;
96
- const d = typeof h == "string" ? JSON.parse(h) : h, { error: u } = await v.auth.setSession({
97
- access_token: d.accessToken,
98
- refresh_token: d.refreshToken
95
+ if (a) throw a;
96
+ const s = typeof d == "string" ? JSON.parse(d) : d, { error: k } = await o.auth.setSession({
97
+ access_token: s.accessToken,
98
+ refresh_token: s.refreshToken
99
99
  });
100
- if (u) throw u;
101
- v.realtime.setAuth(d.accessToken), M({
102
- deviceSessionId: d.deviceSessionId,
103
- session: d.session,
100
+ if (k) throw k;
101
+ o.realtime.setAuth(s.accessToken), e({
102
+ deviceSessionId: s.deviceSessionId,
103
+ session: s.session,
104
104
  isConnected: !0,
105
105
  isConnecting: !1,
106
106
  error: null
107
107
  });
108
- } catch (b) {
109
- let h = b.message ?? "Erro ao conectar";
108
+ } catch (i) {
109
+ let d = i.message ?? "Erro ao conectar";
110
110
  try {
111
- const n = await b.context?.json?.();
112
- n?.error && (h = n.error);
111
+ const a = await i.context?.json?.();
112
+ a?.error && (d = a.error);
113
113
  } catch {
114
114
  }
115
- throw M({
115
+ throw e({
116
116
  isConnecting: !1,
117
- error: h
118
- }), new Error(h);
117
+ error: d
118
+ }), new Error(d);
119
119
  }
120
120
  },
121
- disconnect: (O) => {
122
- O.auth.signOut(), M({
121
+ disconnect: (r) => {
122
+ r.auth.signOut(), e({
123
123
  deviceSessionId: null,
124
124
  session: null,
125
125
  isConnected: !1,
126
126
  error: null
127
127
  });
128
128
  },
129
- clearError: () => M({ error: null })
129
+ clearError: () => e({ error: null })
130
130
  }), {
131
131
  name: "tabl::device",
132
- partialize: (M) => ({
133
- deviceId: M.deviceId,
134
- deviceSessionId: M.deviceSessionId,
135
- session: M.session,
136
- isConnected: M.isConnected
132
+ partialize: (e) => ({
133
+ deviceId: e.deviceId,
134
+ deviceSessionId: e.deviceSessionId,
135
+ session: e.session,
136
+ isConnected: e.isConnected
137
137
  })
138
138
  }));
139
- function f3() {
140
- const { user: M, role: L, isInitializing: O, isAuthenticated: v, error: b } = k3();
141
- function h(n) {
142
- return L ? L3(L, n) : !1;
139
+ function _3() {
140
+ const { user: e, role: t, isInitializing: r, isAuthenticated: o, error: i } = D3();
141
+ function d(a) {
142
+ return t ? n2(t, a) : !1;
143
143
  }
144
144
  return {
145
- user: M,
146
- role: L,
147
- isInitializing: O,
148
- isAuthenticated: v,
149
- error: b,
150
- can: h
145
+ user: e,
146
+ role: t,
147
+ isInitializing: r,
148
+ isAuthenticated: o,
149
+ error: i,
150
+ can: d
151
151
  };
152
152
  }
153
- function G3(M, L) {
154
- const { isInitializing: O, isAuthenticated: v, can: b } = f3();
155
- J(() => {
156
- O || (!v || !b(M)) && L();
153
+ function H2(e, t) {
154
+ const { isInitializing: r, isAuthenticated: o, can: i } = _3();
155
+ Z(() => {
156
+ r || (!o || !i(e)) && t();
157
157
  }, [
158
- O,
159
- v,
160
- M
158
+ r,
159
+ o,
160
+ e
161
161
  ]);
162
162
  }
163
- function U3({ supabase: M, moduleName: L, logo: O }) {
164
- const { signIn: v, error: b } = k3(), [h, n] = Z(""), [d, u] = Z(""), [g, a] = Z(!1);
165
- return /* @__PURE__ */ _("div", {
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
- children: /* @__PURE__ */ G("div", {
167
+ children: /* @__PURE__ */ U("div", {
168
168
  className: "w-full max-w-sm space-y-8",
169
- children: [/* @__PURE__ */ G("div", {
169
+ children: [/* @__PURE__ */ U("div", {
170
170
  className: "flex flex-col items-center gap-3 text-center",
171
- children: [O && /* @__PURE__ */ _("div", {
171
+ children: [r && /* @__PURE__ */ T("div", {
172
172
  className: "mb-2",
173
- children: O
174
- }), /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ _("p", {
173
+ children: r
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__ */ _("h1", {
177
+ }), /* @__PURE__ */ T("h1", {
178
178
  className: "text-2xl font-bold",
179
- children: L
179
+ children: t
180
180
  })] })]
181
- }), /* @__PURE__ */ G("div", {
181
+ }), /* @__PURE__ */ U("div", {
182
182
  className: "rounded-xl border bg-card p-6 shadow-sm space-y-4",
183
- children: [/* @__PURE__ */ G("div", {
183
+ children: [/* @__PURE__ */ U("div", {
184
184
  className: "space-y-1",
185
- children: [/* @__PURE__ */ _("h2", {
185
+ children: [/* @__PURE__ */ T("h2", {
186
186
  className: "text-base font-semibold",
187
187
  children: "Entrar"
188
- }), /* @__PURE__ */ _("p", {
188
+ }), /* @__PURE__ */ T("p", {
189
189
  className: "text-sm text-muted-foreground",
190
190
  children: "Use suas credenciais de acesso"
191
191
  })]
192
- }), /* @__PURE__ */ G("form", {
193
- onSubmit: async (i) => {
194
- if (i.preventDefault(), !(!h || !d)) {
195
- a(!0);
192
+ }), /* @__PURE__ */ U("form", {
193
+ onSubmit: async (m) => {
194
+ if (m.preventDefault(), !(!d || !s)) {
195
+ u(!0);
196
196
  try {
197
- await v(M, h, d);
197
+ await o(e, d, s);
198
198
  } finally {
199
- a(!1);
199
+ u(!1);
200
200
  }
201
201
  }
202
202
  },
203
203
  className: "space-y-3",
204
204
  children: [
205
- /* @__PURE__ */ G("div", {
205
+ /* @__PURE__ */ U("div", {
206
206
  className: "space-y-1.5",
207
- children: [/* @__PURE__ */ _("label", {
207
+ children: [/* @__PURE__ */ T("label", {
208
208
  htmlFor: "email",
209
209
  className: "text-sm font-medium",
210
210
  children: "E-mail"
211
- }), /* @__PURE__ */ _("input", {
211
+ }), /* @__PURE__ */ T("input", {
212
212
  id: "email",
213
213
  type: "email",
214
214
  autoComplete: "email",
215
215
  autoFocus: !0,
216
216
  required: !0,
217
- value: h,
218
- onChange: (i) => n(i.target.value),
219
- disabled: g,
217
+ value: d,
218
+ onChange: (m) => a(m.target.value),
219
+ disabled: p,
220
220
  placeholder: "voce@restaurante.com",
221
221
  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"
222
222
  })]
223
223
  }),
224
- /* @__PURE__ */ G("div", {
224
+ /* @__PURE__ */ U("div", {
225
225
  className: "space-y-1.5",
226
- children: [/* @__PURE__ */ _("label", {
226
+ children: [/* @__PURE__ */ T("label", {
227
227
  htmlFor: "password",
228
228
  className: "text-sm font-medium",
229
229
  children: "Senha"
230
- }), /* @__PURE__ */ _("input", {
230
+ }), /* @__PURE__ */ T("input", {
231
231
  id: "password",
232
232
  type: "password",
233
233
  autoComplete: "current-password",
234
234
  required: !0,
235
- value: d,
236
- onChange: (i) => u(i.target.value),
237
- disabled: g,
235
+ value: s,
236
+ onChange: (m) => k(m.target.value),
237
+ disabled: p,
238
238
  placeholder: "••••••••",
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
- b && /* @__PURE__ */ _("p", {
242
+ i && /* @__PURE__ */ T("p", {
243
243
  className: "rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",
244
- children: b
244
+ children: i
245
245
  }),
246
- /* @__PURE__ */ _("button", {
246
+ /* @__PURE__ */ T("button", {
247
247
  type: "submit",
248
- disabled: g || !h || !d,
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: g ? /* @__PURE__ */ _(d3, { className: "size-4 animate-spin" }) : "Entrar"
250
+ children: p ? /* @__PURE__ */ T(v3, { className: "size-4 animate-spin" }) : "Entrar"
251
251
  })
252
252
  ]
253
253
  })]
@@ -255,258 +255,258 @@ function U3({ supabase: M, moduleName: L, logo: O }) {
255
255
  })
256
256
  });
257
257
  }
258
- function V3({ role: M, fallback: L = null, children: O }) {
259
- const { isInitializing: v, can: b } = f3();
260
- return v ? /* @__PURE__ */ _(n3, { children: L }) : b(M) ? /* @__PURE__ */ _(n3, { children: O }) : /* @__PURE__ */ _(n3, { children: L });
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
- var N3 = /* @__PURE__ */ x3(((M, L) => {
263
- (function(v, b) {
264
- typeof M == "object" && typeof L == "object" ? L.exports = b() : typeof define == "function" && define.amd ? define([], b) : typeof M == "object" ? M.jsQR = b() : v.jsQR = b();
265
- })(typeof self < "u" ? self : M, function() {
266
- return (function(O) {
267
- var v = {};
268
- function b(h) {
269
- if (v[h]) return v[h].exports;
270
- var n = v[h] = {
271
- i: h,
262
+ var i2 = /* @__PURE__ */ r2(((e, t) => {
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
+ })(typeof self < "u" ? self : e, function() {
266
+ return (function(r) {
267
+ var o = {};
268
+ function i(d) {
269
+ if (o[d]) return o[d].exports;
270
+ var a = o[d] = {
271
+ i: d,
272
272
  l: !1,
273
273
  exports: {}
274
274
  };
275
- return O[h].call(n.exports, n, n.exports, b), n.l = !0, n.exports;
275
+ return r[d].call(a.exports, a, a.exports, i), a.l = !0, a.exports;
276
276
  }
277
- return b.m = O, b.c = v, b.d = function(h, n, d) {
278
- b.o(h, n) || Object.defineProperty(h, n, {
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
- get: d
281
+ get: s
282
282
  });
283
- }, b.n = function(h) {
284
- var n = h && h.__esModule ? function() {
285
- return h.default;
283
+ }, i.n = function(d) {
284
+ var a = d && d.__esModule ? function() {
285
+ return d.default;
286
286
  } : function() {
287
- return h;
287
+ return d;
288
288
  };
289
- return b.d(n, "a", n), n;
290
- }, b.o = function(h, n) {
291
- return Object.prototype.hasOwnProperty.call(h, n);
292
- }, b.p = "", b(b.s = 3);
289
+ return i.d(a, "a", a), a;
290
+ }, i.o = function(d, a) {
291
+ return Object.prototype.hasOwnProperty.call(d, a);
292
+ }, i.p = "", i(i.s = 3);
293
293
  })([
294
- (function(O, v, b) {
294
+ (function(r, o, i) {
295
295
  "use strict";
296
- Object.defineProperty(v, "__esModule", { value: !0 }), v.BitMatrix = (function() {
297
- function h(n, d) {
298
- this.width = d, this.height = n.length / d, this.data = n;
296
+ Object.defineProperty(o, "__esModule", { value: !0 }), o.BitMatrix = (function() {
297
+ function d(a, s) {
298
+ this.width = s, this.height = a.length / s, this.data = a;
299
299
  }
300
- return h.createEmpty = function(n, d) {
301
- return new h(new Uint8ClampedArray(n * d), n);
302
- }, h.prototype.get = function(n, d) {
303
- return n < 0 || n >= this.width || d < 0 || d >= this.height ? !1 : !!this.data[d * this.width + n];
304
- }, h.prototype.set = function(n, d, u) {
305
- this.data[d * this.width + n] = u ? 1 : 0;
306
- }, h.prototype.setRegion = function(n, d, u, g, a) {
307
- for (var r = d; r < d + g; r++) for (var i = n; i < n + u; i++) this.set(i, r, !!a);
308
- }, h;
300
+ return d.createEmpty = function(a, s) {
301
+ return new d(new Uint8ClampedArray(a * s), a);
302
+ }, d.prototype.get = function(a, s) {
303
+ return a < 0 || a >= this.width || s < 0 || s >= this.height ? !1 : !!this.data[s * this.width + a];
304
+ }, d.prototype.set = function(a, s, k) {
305
+ this.data[s * this.width + a] = k ? 1 : 0;
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
+ }, d;
309
309
  })();
310
310
  }),
311
- (function(O, v, b) {
311
+ (function(r, o, i) {
312
312
  "use strict";
313
- Object.defineProperty(v, "__esModule", { value: !0 });
314
- var h = b(2);
315
- function n(d, u) {
316
- return d ^ u;
313
+ Object.defineProperty(o, "__esModule", { value: !0 });
314
+ var d = i(2);
315
+ function a(s, k) {
316
+ return s ^ k;
317
317
  }
318
- v.addOrSubtractGF = n, v.default = (function() {
319
- function d(u, g, a) {
320
- this.primitive = u, this.size = g, this.generatorBase = a, this.expTable = new Array(this.size), this.logTable = new Array(this.size);
321
- for (var r = 1, i = 0; i < this.size; i++)
322
- this.expTable[i] = r, r = r * 2, r >= this.size && (r = (r ^ this.primitive) & this.size - 1);
323
- for (var i = 0; i < this.size - 1; i++) this.logTable[this.expTable[i]] = i;
324
- this.zero = new h.default(this, Uint8ClampedArray.from([0])), this.one = new h.default(this, Uint8ClampedArray.from([1]));
318
+ o.addOrSubtractGF = a, o.default = (function() {
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
+ for (var m = 0; m < this.size - 1; m++) this.logTable[this.expTable[m]] = m;
324
+ this.zero = new d.default(this, Uint8ClampedArray.from([0])), this.one = new d.default(this, Uint8ClampedArray.from([1]));
325
325
  }
326
- return d.prototype.multiply = function(u, g) {
327
- return u === 0 || g === 0 ? 0 : this.expTable[(this.logTable[u] + this.logTable[g]) % (this.size - 1)];
328
- }, d.prototype.inverse = function(u) {
329
- if (u === 0) throw new Error("Can't invert 0");
330
- return this.expTable[this.size - this.logTable[u] - 1];
331
- }, d.prototype.buildMonomial = function(u, g) {
332
- if (u < 0) throw new Error("Invalid monomial degree less than 0");
333
- if (g === 0) return this.zero;
334
- var a = new Uint8ClampedArray(u + 1);
335
- return a[0] = g, new h.default(this, a);
336
- }, d.prototype.log = function(u) {
337
- if (u === 0) throw new Error("Can't take log(0)");
338
- return this.logTable[u];
339
- }, d.prototype.exp = function(u) {
340
- return this.expTable[u];
341
- }, d;
326
+ return s.prototype.multiply = function(k, p) {
327
+ return k === 0 || p === 0 ? 0 : this.expTable[(this.logTable[k] + this.logTable[p]) % (this.size - 1)];
328
+ }, s.prototype.inverse = function(k) {
329
+ if (k === 0) throw new Error("Can't invert 0");
330
+ return this.expTable[this.size - this.logTable[k] - 1];
331
+ }, s.prototype.buildMonomial = function(k, p) {
332
+ if (k < 0) throw new Error("Invalid monomial degree less than 0");
333
+ if (p === 0) return this.zero;
334
+ var u = new Uint8ClampedArray(k + 1);
335
+ return u[0] = p, new d.default(this, u);
336
+ }, s.prototype.log = function(k) {
337
+ if (k === 0) throw new Error("Can't take log(0)");
338
+ return this.logTable[k];
339
+ }, s.prototype.exp = function(k) {
340
+ return this.expTable[k];
341
+ }, s;
342
342
  })();
343
343
  }),
344
- (function(O, v, b) {
344
+ (function(r, o, i) {
345
345
  "use strict";
346
- Object.defineProperty(v, "__esModule", { value: !0 });
347
- var h = b(1);
348
- v.default = (function() {
349
- function n(d, u) {
350
- if (u.length === 0) throw new Error("No coefficients.");
351
- this.field = d;
352
- var g = u.length;
353
- if (g > 1 && u[0] === 0) {
354
- for (var a = 1; a < g && u[a] === 0; ) a++;
355
- if (a === g) this.coefficients = d.zero.coefficients;
346
+ Object.defineProperty(o, "__esModule", { value: !0 });
347
+ var d = i(1);
348
+ o.default = (function() {
349
+ function a(s, k) {
350
+ if (k.length === 0) throw new Error("No coefficients.");
351
+ this.field = s;
352
+ var p = k.length;
353
+ if (p > 1 && k[0] === 0) {
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(g - a);
358
- for (var r = 0; r < this.coefficients.length; r++) this.coefficients[r] = u[a + r];
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
- } else this.coefficients = u;
360
+ } else this.coefficients = k;
361
361
  }
362
- return n.prototype.degree = function() {
362
+ return a.prototype.degree = function() {
363
363
  return this.coefficients.length - 1;
364
- }, n.prototype.isZero = function() {
364
+ }, a.prototype.isZero = function() {
365
365
  return this.coefficients[0] === 0;
366
- }, n.prototype.getCoefficient = function(d) {
367
- return this.coefficients[this.coefficients.length - 1 - d];
368
- }, n.prototype.addOrSubtract = function(d) {
369
- var u;
370
- if (this.isZero()) return d;
371
- if (d.isZero()) return this;
372
- var g = this.coefficients, a = d.coefficients;
373
- g.length > a.length && (u = [a, g], g = u[0], a = u[1]);
374
- for (var r = new Uint8ClampedArray(a.length), i = a.length - g.length, l = 0; l < i; l++) r[l] = a[l];
375
- for (var l = i; l < a.length; l++) r[l] = h.addOrSubtractGF(g[l - i], a[l]);
376
- return new n(this.field, r);
377
- }, n.prototype.multiply = function(d) {
378
- if (d === 0) return this.field.zero;
379
- if (d === 1) return this;
380
- for (var u = this.coefficients.length, g = new Uint8ClampedArray(u), a = 0; a < u; a++) g[a] = this.field.multiply(this.coefficients[a], d);
381
- return new n(this.field, g);
382
- }, n.prototype.multiplyPoly = function(d) {
383
- if (this.isZero() || d.isZero()) return this.field.zero;
384
- for (var u = this.coefficients, g = u.length, a = d.coefficients, r = a.length, i = new Uint8ClampedArray(g + r - 1), l = 0; l < g; l++)
385
- for (var m = u[l], C = 0; C < r; C++) i[l + C] = h.addOrSubtractGF(i[l + C], this.field.multiply(m, a[C]));
386
- return new n(this.field, i);
387
- }, n.prototype.multiplyByMonomial = function(d, u) {
388
- if (d < 0) throw new Error("Invalid degree less than 0");
389
- if (u === 0) return this.field.zero;
390
- for (var g = this.coefficients.length, a = new Uint8ClampedArray(g + d), r = 0; r < g; r++) a[r] = this.field.multiply(this.coefficients[r], u);
391
- return new n(this.field, a);
392
- }, n.prototype.evaluateAt = function(d) {
393
- var u = 0;
394
- if (d === 0) return this.getCoefficient(0);
395
- var g = this.coefficients.length;
396
- if (d === 1)
397
- return this.coefficients.forEach(function(r) {
398
- u = h.addOrSubtractGF(u, r);
399
- }), u;
400
- u = this.coefficients[0];
401
- for (var a = 1; a < g; a++) u = h.addOrSubtractGF(this.field.multiply(d, u), this.coefficients[a]);
402
- return u;
403
- }, n;
366
+ }, a.prototype.getCoefficient = function(s) {
367
+ return this.coefficients[this.coefficients.length - 1 - s];
368
+ }, a.prototype.addOrSubtract = function(s) {
369
+ var k;
370
+ if (this.isZero()) return s;
371
+ if (s.isZero()) return this;
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
+ }, a.prototype.multiply = function(s) {
378
+ if (s === 0) return this.field.zero;
379
+ if (s === 1) return this;
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
+ return new a(this.field, p);
382
+ }, a.prototype.multiplyPoly = function(s) {
383
+ if (this.isZero() || s.isZero()) return this.field.zero;
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
+ return new a(this.field, m);
387
+ }, a.prototype.multiplyByMonomial = function(s, k) {
388
+ if (s < 0) throw new Error("Invalid degree less than 0");
389
+ if (k === 0) return this.field.zero;
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
+ }, a.prototype.evaluateAt = function(s) {
393
+ var k = 0;
394
+ if (s === 0) return this.getCoefficient(0);
395
+ var p = this.coefficients.length;
396
+ if (s === 1)
397
+ return this.coefficients.forEach(function(c) {
398
+ k = d.addOrSubtractGF(k, c);
399
+ }), k;
400
+ k = this.coefficients[0];
401
+ for (var u = 1; u < p; u++) k = d.addOrSubtractGF(this.field.multiply(s, k), this.coefficients[u]);
402
+ return k;
403
+ }, a;
404
404
  })();
405
405
  }),
406
- (function(O, v, b) {
406
+ (function(r, o, i) {
407
407
  "use strict";
408
- Object.defineProperty(v, "__esModule", { value: !0 });
409
- var h = b(4), n = b(5), d = b(11), u = b(12);
410
- function g(i) {
411
- var l = u.locate(i);
412
- if (!l) return null;
413
- for (var m = 0, C = l; m < C.length; m++) {
414
- var k = C[m], w = d.extract(i, k), S = n.decode(w.matrix);
415
- if (S) return {
416
- binaryData: S.bytes,
417
- data: S.text,
418
- chunks: S.chunks,
419
- version: S.version,
408
+ Object.defineProperty(o, "__esModule", { value: !0 });
409
+ var d = i(4), a = i(5), s = i(11), k = i(12);
410
+ function p(m) {
411
+ var v = k.locate(m);
412
+ if (!v) return null;
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
+ if (x) return {
416
+ binaryData: x.bytes,
417
+ data: x.text,
418
+ chunks: x.chunks,
419
+ version: x.version,
420
420
  location: {
421
- topRightCorner: w.mappingFunction(k.dimension, 0),
422
- topLeftCorner: w.mappingFunction(0, 0),
423
- bottomRightCorner: w.mappingFunction(k.dimension, k.dimension),
424
- bottomLeftCorner: w.mappingFunction(0, k.dimension),
425
- topRightFinderPattern: k.topRight,
426
- topLeftFinderPattern: k.topLeft,
427
- bottomLeftFinderPattern: k.bottomLeft,
428
- bottomRightAlignmentPattern: k.alignmentPattern
421
+ topRightCorner: b.mappingFunction(w.dimension, 0),
422
+ topLeftCorner: b.mappingFunction(0, 0),
423
+ bottomRightCorner: b.mappingFunction(w.dimension, w.dimension),
424
+ bottomLeftCorner: b.mappingFunction(0, w.dimension),
425
+ topRightFinderPattern: w.topRight,
426
+ topLeftFinderPattern: w.topLeft,
427
+ bottomLeftFinderPattern: w.bottomLeft,
428
+ bottomRightAlignmentPattern: w.alignmentPattern
429
429
  }
430
430
  };
431
431
  }
432
432
  return null;
433
433
  }
434
- var a = { inversionAttempts: "attemptBoth" };
435
- function r(i, l, m, C) {
434
+ var u = { inversionAttempts: "attemptBoth" };
435
+ function c(m, v, y, C) {
436
436
  C === void 0 && (C = {});
437
- var k = a;
438
- Object.keys(k || {}).forEach(function(t) {
439
- k[t] = C[t] || k[t];
437
+ var w = u;
438
+ Object.keys(w || {}).forEach(function(f) {
439
+ w[f] = C[f] || w[f];
440
440
  });
441
- var w = k.inversionAttempts === "attemptBoth" || k.inversionAttempts === "invertFirst", S = k.inversionAttempts === "onlyInvert" || k.inversionAttempts === "invertFirst", c = h.binarize(i, l, m, w), e = c.binarized, o = c.inverted, s = g(S ? o : e);
442
- return !s && (k.inversionAttempts === "attemptBoth" || k.inversionAttempts === "invertFirst") && (s = g(S ? e : o)), s;
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
- r.default = r, v.default = r;
444
+ c.default = c, o.default = c;
445
445
  }),
446
- (function(O, v, b) {
446
+ (function(r, o, i) {
447
447
  "use strict";
448
- Object.defineProperty(v, "__esModule", { value: !0 });
449
- var h = b(0), n = 8, d = 24;
450
- function u(r, i, l) {
451
- return r < i ? i : r > l ? l : r;
448
+ Object.defineProperty(o, "__esModule", { value: !0 });
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
- var g = (function() {
454
- function r(i, l) {
455
- this.width = i, this.data = new Uint8ClampedArray(i * l);
453
+ var p = (function() {
454
+ function c(m, v) {
455
+ this.width = m, this.data = new Uint8ClampedArray(m * v);
456
456
  }
457
- return r.prototype.get = function(i, l) {
458
- return this.data[l * this.width + i];
459
- }, r.prototype.set = function(i, l, m) {
460
- this.data[l * this.width + i] = m;
461
- }, r;
457
+ return c.prototype.get = function(m, v) {
458
+ return this.data[v * this.width + m];
459
+ }, c.prototype.set = function(m, v, y) {
460
+ this.data[v * this.width + m] = y;
461
+ }, c;
462
462
  })();
463
- function a(r, i, l, m) {
464
- if (r.length !== i * l * 4) throw new Error("Malformed data passed to binarizer.");
465
- for (var C = new g(i, l), k = 0; k < i; k++) for (var w = 0; w < l; w++) {
466
- var S = r[(w * i + k) * 4 + 0], c = r[(w * i + k) * 4 + 1], e = r[(w * i + k) * 4 + 2];
467
- C.set(k, w, 0.2126 * S + 0.7152 * c + 0.0722 * e);
463
+ function u(c, m, v, y) {
464
+ if (c.length !== m * v * 4) throw new Error("Malformed data passed to binarizer.");
465
+ for (var C = new p(m, v), w = 0; w < m; w++) for (var b = 0; b < v; b++) {
466
+ var x = c[(b * m + w) * 4 + 0], B = c[(b * m + w) * 4 + 1], n = c[(b * m + w) * 4 + 2];
467
+ C.set(w, b, 0.2126 * x + 0.7152 * B + 0.0722 * n);
468
468
  }
469
- for (var o = Math.ceil(i / n), s = Math.ceil(l / n), t = new g(o, s), f = 0; f < s; f++) for (var B = 0; B < o; B++) {
470
- for (var p = 0, P = 1 / 0, y = 0, w = 0; w < n; w++) for (var k = 0; k < n; k++) {
471
- var N = C.get(B * n + k, f * n + w);
472
- p += N, P = Math.min(P, N), y = Math.max(y, N);
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
+ for (var S = 0, M = 1 / 0, O = 0, b = 0; b < a; b++) for (var w = 0; w < a; w++) {
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 E = p / Math.pow(n, 2);
475
- if (y - P <= d && (E = P / 2, f > 0 && B > 0)) {
476
- var x = (t.get(B, f - 1) + 2 * t.get(B - 1, f) + t.get(B - 1, f - 1)) / 4;
477
- P < x && (E = x);
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
- t.set(B, f, E);
479
+ f.set(P, g, F);
480
480
  }
481
- var I = h.BitMatrix.createEmpty(i, l), T = null;
482
- m && (T = h.BitMatrix.createEmpty(i, l));
483
- for (var f = 0; f < s; f++) for (var B = 0; B < o; B++) {
484
- for (var z = u(B, 2, o - 3), D = u(f, 2, s - 3), p = 0, j = -2; j <= 2; j++) for (var A = -2; A <= 2; A++) p += t.get(z + j, D + A);
485
- for (var F = p / 25, j = 0; j < n; j++) for (var A = 0; A < n; A++) {
486
- var k = B * n + j, w = f * n + A, X = C.get(k, w);
487
- I.set(k, w, X <= F), m && T.set(k, w, !(X <= F));
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
+ for (var j = S / 25, Q = 0; Q < a; Q++) for (var I = 0; I < a; I++) {
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 m ? {
491
- binarized: I,
492
- inverted: T
493
- } : { binarized: I };
490
+ return y ? {
491
+ binarized: E,
492
+ inverted: L
493
+ } : { binarized: E };
494
494
  }
495
- v.binarize = a;
495
+ o.binarize = u;
496
496
  }),
497
- (function(O, v, b) {
497
+ (function(r, o, i) {
498
498
  "use strict";
499
- Object.defineProperty(v, "__esModule", { value: !0 });
500
- var h = b(0), n = b(6), d = b(9), u = b(10);
501
- function g(e, o) {
502
- for (var s = e ^ o, t = 0; s; )
503
- t++, s &= s - 1;
504
- return t;
499
+ Object.defineProperty(o, "__esModule", { value: !0 });
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 a(e, o) {
507
- return o << 1 | e;
506
+ function u(n, l) {
507
+ return l << 1 | n;
508
508
  }
509
- var r = [
509
+ var c = [
510
510
  {
511
511
  bits: 21522,
512
512
  formatInfo: {
@@ -731,176 +731,176 @@ var N3 = /* @__PURE__ */ x3(((M, L) => {
731
731
  dataMask: 7
732
732
  }
733
733
  }
734
- ], i = [
735
- function(e) {
736
- return (e.y + e.x) % 2 === 0;
734
+ ], m = [
735
+ function(n) {
736
+ return (n.y + n.x) % 2 === 0;
737
737
  },
738
- function(e) {
739
- return e.y % 2 === 0;
738
+ function(n) {
739
+ return n.y % 2 === 0;
740
740
  },
741
- function(e) {
742
- return e.x % 3 === 0;
741
+ function(n) {
742
+ return n.x % 3 === 0;
743
743
  },
744
- function(e) {
745
- return (e.y + e.x) % 3 === 0;
744
+ function(n) {
745
+ return (n.y + n.x) % 3 === 0;
746
746
  },
747
- function(e) {
748
- return (Math.floor(e.y / 2) + Math.floor(e.x / 3)) % 2 === 0;
747
+ function(n) {
748
+ return (Math.floor(n.y / 2) + Math.floor(n.x / 3)) % 2 === 0;
749
749
  },
750
- function(e) {
751
- return e.x * e.y % 2 + e.x * e.y % 3 === 0;
750
+ function(n) {
751
+ return n.x * n.y % 2 + n.x * n.y % 3 === 0;
752
752
  },
753
- function(e) {
754
- return (e.y * e.x % 2 + e.y * e.x % 3) % 2 === 0;
753
+ function(n) {
754
+ return (n.y * n.x % 2 + n.y * n.x % 3) % 2 === 0;
755
755
  },
756
- function(e) {
757
- return ((e.y + e.x) % 2 + e.y * e.x % 3) % 2 === 0;
756
+ function(n) {
757
+ return ((n.y + n.x) % 2 + n.y * n.x % 3) % 2 === 0;
758
758
  }
759
759
  ];
760
- function l(e) {
761
- var o = 17 + 4 * e.versionNumber, s = h.BitMatrix.createEmpty(o, o);
762
- s.setRegion(0, 0, 9, 9, !0), s.setRegion(o - 8, 0, 8, 9, !0), s.setRegion(0, o - 8, 9, 8, !0);
763
- for (var t = 0, f = e.alignmentPatternCenters; t < f.length; t++)
764
- for (var B = f[t], p = 0, P = e.alignmentPatternCenters; p < P.length; p++) {
765
- var y = P[p];
766
- B === 6 && y === 6 || B === 6 && y === o - 7 || B === o - 7 && y === 6 || s.setRegion(B - 2, y - 2, 5, 5, !0);
760
+ function v(n) {
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
+ var O = M[S];
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 s.setRegion(6, 9, 1, o - 17, !0), s.setRegion(9, 6, o - 17, 1, !0), e.versionNumber > 6 && (s.setRegion(o - 11, 0, 3, 6, !0), s.setRegion(0, o - 11, 6, 3, !0)), s;
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 m(e, o, s) {
771
- for (var t = i[s.dataMask], f = e.height, B = l(o), p = [], P = 0, y = 0, N = !0, E = f - 1; E > 0; E -= 2) {
772
- E === 6 && E--;
773
- for (var x = 0; x < f; x++)
774
- for (var I = N ? f - 1 - x : x, T = 0; T < 2; T++) {
775
- var z = E - T;
776
- if (!B.get(z, I)) {
777
- y++;
778
- var D = e.get(z, I);
779
- t({
780
- y: I,
781
- x: z
782
- }) && (D = !D), P = a(D, P), y === 8 && (p.push(P), y = 0, P = 0);
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
+ for (var A = 0; A < g; A++)
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
+ O++;
778
+ var _ = n.get(D, E);
779
+ f({
780
+ y: E,
781
+ x: D
782
+ }) && (_ = !_), M = u(_, M), O === 8 && (S.push(M), O = 0, M = 0);
783
783
  }
784
784
  }
785
785
  N = !N;
786
786
  }
787
- return p;
787
+ return S;
788
788
  }
789
- function C(e) {
790
- var o = e.height, s = Math.floor((o - 17) / 4);
791
- if (s <= 6) return u.VERSIONS[s - 1];
792
- for (var t = 0, f = 5; f >= 0; f--) for (var B = o - 9; B >= o - 11; B--) t = a(e.get(B, f), t);
793
- for (var p = 0, B = 5; B >= 0; B--) for (var f = o - 9; f >= o - 11; f--) p = a(e.get(B, f), p);
794
- for (var P = 1 / 0, y, N = 0, E = u.VERSIONS; N < E.length; N++) {
795
- var x = E[N];
796
- if (x.infoBits === t || x.infoBits === p) return x;
797
- var I = g(t, x.infoBits);
798
- I < P && (y = x, P = I), I = g(p, x.infoBits), I < P && (y = x, P = I);
789
+ function C(n) {
790
+ var l = n.height, h = Math.floor((l - 17) / 4);
791
+ if (h <= 6) return k.VERSIONS[h - 1];
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
+ E < M && (O = A, M = E), E = p(S, A.infoBits), E < M && (O = A, M = E);
799
799
  }
800
- if (P <= 3) return y;
800
+ if (M <= 3) return O;
801
801
  }
802
- function k(e) {
803
- for (var o = 0, s = 0; s <= 8; s++) s !== 6 && (o = a(e.get(s, 8), o));
804
- for (var t = 7; t >= 0; t--) t !== 6 && (o = a(e.get(8, t), o));
805
- for (var f = e.height, B = 0, t = f - 1; t >= f - 7; t--) B = a(e.get(8, t), B);
806
- for (var s = f - 8; s < f; s++) B = a(e.get(s, 8), B);
807
- for (var p = 1 / 0, P = null, y = 0, N = r; y < N.length; y++) {
808
- var E = N[y], x = E.bits, I = E.formatInfo;
809
- if (x === o || x === B) return I;
810
- var T = g(o, x);
811
- T < p && (P = I, p = T), o !== B && (T = g(B, x), T < p && (P = I, p = T));
802
+ function w(n) {
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
- return p <= 3 ? P : null;
813
+ return S <= 3 ? M : null;
814
814
  }
815
- function w(e, o, s) {
816
- var t = o.errorCorrectionLevels[s], f = [], B = 0;
817
- if (t.ecBlocks.forEach(function(D) {
818
- for (var j = 0; j < D.numBlocks; j++)
819
- f.push({
820
- numDataCodewords: D.dataCodewordsPerBlock,
815
+ function b(n, l, h) {
816
+ var f = l.errorCorrectionLevels[h], g = [], P = 0;
817
+ if (f.ecBlocks.forEach(function(_) {
818
+ for (var Q = 0; Q < _.numBlocks; Q++)
819
+ g.push({
820
+ numDataCodewords: _.dataCodewordsPerBlock,
821
821
  codewords: []
822
- }), B += D.dataCodewordsPerBlock + t.ecCodewordsPerBlock;
823
- }), e.length < B) return null;
824
- e = e.slice(0, B);
825
- for (var p = t.ecBlocks[0].dataCodewordsPerBlock, P = 0; P < p; P++) for (var y = 0, N = f; y < N.length; y++) {
826
- var E = N[y];
827
- E.codewords.push(e.shift());
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 (t.ecBlocks.length > 1)
830
- for (var x = t.ecBlocks[0].numBlocks, I = t.ecBlocks[1].numBlocks, P = 0; P < I; P++) f[x + P].codewords.push(e.shift());
831
- for (; e.length > 0; ) for (var T = 0, z = f; T < z.length; T++) {
832
- var E = z[T];
833
- E.codewords.push(e.shift());
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
- return f;
835
+ return g;
836
836
  }
837
- function S(e) {
838
- var o = C(e);
839
- if (!o) return null;
840
- var s = k(e);
841
- if (!s) return null;
842
- var t = w(m(e, o, s), o, s.errorCorrectionLevel);
843
- if (!t) return null;
844
- for (var f = t.reduce(function(I, T) {
845
- return I + T.numDataCodewords;
846
- }, 0), B = new Uint8ClampedArray(f), p = 0, P = 0, y = t; P < y.length; P++) {
847
- var N = y[P], E = d.decode(N.codewords, N.codewords.length - N.numDataCodewords);
848
- if (!E) return null;
849
- for (var x = 0; x < N.numDataCodewords; x++) B[p++] = E[x];
837
+ function x(n) {
838
+ var l = C(n);
839
+ if (!l) return null;
840
+ var h = w(n);
841
+ if (!h) return null;
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 n.decode(B, o.versionNumber);
852
+ return a.decode(P, l.versionNumber);
853
853
  } catch {
854
854
  return null;
855
855
  }
856
856
  }
857
- function c(e) {
858
- if (e == null) return null;
859
- var o = S(e);
860
- if (o) return o;
861
- for (var s = 0; s < e.width; s++) for (var t = s + 1; t < e.height; t++) e.get(s, t) !== e.get(t, s) && (e.set(s, t, !e.get(s, t)), e.set(t, s, !e.get(t, s)));
862
- return S(e);
857
+ function B(n) {
858
+ if (n == null) return null;
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
+ return x(n);
863
863
  }
864
- v.decode = c;
864
+ o.decode = B;
865
865
  }),
866
- (function(O, v, b) {
866
+ (function(r, o, i) {
867
867
  "use strict";
868
- Object.defineProperty(v, "__esModule", { value: !0 });
869
- var h = b(7), n = b(8), d;
868
+ Object.defineProperty(o, "__esModule", { value: !0 });
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
- })(d = v.Mode || (v.Mode = {}));
873
- var u;
872
+ })(s = o.Mode || (o.Mode = {}));
873
+ var k;
874
874
  (function(C) {
875
875
  C[C.Terminator = 0] = "Terminator", C[C.Numeric = 1] = "Numeric", C[C.Alphanumeric = 2] = "Alphanumeric", C[C.Byte = 4] = "Byte", C[C.Kanji = 8] = "Kanji", C[C.ECI = 7] = "ECI";
876
- })(u || (u = {}));
877
- function g(C, k) {
878
- for (var w = [], S = "", c = [
876
+ })(k || (k = {}));
877
+ function p(C, w) {
878
+ for (var b = [], x = "", B = [
879
879
  10,
880
880
  12,
881
881
  14
882
- ][k], e = C.readBits(c); e >= 3; ) {
883
- var o = C.readBits(10);
884
- if (o >= 1e3) throw new Error("Invalid numeric value above 999");
885
- var s = Math.floor(o / 100), t = Math.floor(o / 10) % 10, f = o % 10;
886
- w.push(48 + s, 48 + t, 48 + f), S += s.toString() + t.toString() + f.toString(), e -= 3;
882
+ ][w], n = C.readBits(B); n >= 3; ) {
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
- if (e === 2) {
889
- var o = C.readBits(7);
890
- if (o >= 100) throw new Error("Invalid numeric value above 99");
891
- var s = Math.floor(o / 10), t = o % 10;
892
- w.push(48 + s, 48 + t), S += s.toString() + t.toString();
893
- } else if (e === 1) {
894
- var o = C.readBits(4);
895
- if (o >= 10) throw new Error("Invalid numeric value above 9");
896
- w.push(48 + o), S += o.toString();
888
+ if (n === 2) {
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
+ } else if (n === 1) {
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
- bytes: w,
900
- text: S
899
+ bytes: b,
900
+ text: x
901
901
  };
902
902
  }
903
- var a = [
903
+ var u = [
904
904
  "0",
905
905
  "1",
906
906
  "2",
@@ -947,142 +947,142 @@ var N3 = /* @__PURE__ */ x3(((M, L) => {
947
947
  "/",
948
948
  ":"
949
949
  ];
950
- function r(C, k) {
951
- for (var w = [], S = "", c = [
950
+ function c(C, w) {
951
+ for (var b = [], x = "", B = [
952
952
  9,
953
953
  11,
954
954
  13
955
- ][k], e = C.readBits(c); e >= 2; ) {
956
- var o = C.readBits(11), s = Math.floor(o / 45), t = o % 45;
957
- w.push(a[s].charCodeAt(0), a[t].charCodeAt(0)), S += a[s] + a[t], e -= 2;
955
+ ][w], n = C.readBits(B); n >= 2; ) {
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
- if (e === 1) {
960
- var s = C.readBits(6);
961
- w.push(a[s].charCodeAt(0)), S += a[s];
959
+ if (n === 1) {
960
+ var h = C.readBits(6);
961
+ b.push(u[h].charCodeAt(0)), x += u[h];
962
962
  }
963
963
  return {
964
- bytes: w,
965
- text: S
964
+ bytes: b,
965
+ text: x
966
966
  };
967
967
  }
968
- function i(C, k) {
969
- for (var w = [], S = "", c = [
968
+ function m(C, w) {
969
+ for (var b = [], x = "", B = [
970
970
  8,
971
971
  16,
972
972
  16
973
- ][k], e = C.readBits(c), o = 0; o < e; o++) {
974
- var s = C.readBits(8);
975
- w.push(s);
973
+ ][w], n = C.readBits(B), l = 0; l < n; l++) {
974
+ var h = C.readBits(8);
975
+ b.push(h);
976
976
  }
977
977
  try {
978
- S += decodeURIComponent(w.map(function(t) {
979
- return "%" + ("0" + t.toString(16)).substr(-2);
978
+ x += decodeURIComponent(b.map(function(f) {
979
+ return "%" + ("0" + f.toString(16)).substr(-2);
980
980
  }).join(""));
981
981
  } catch {
982
982
  }
983
983
  return {
984
- bytes: w,
985
- text: S
984
+ bytes: b,
985
+ text: x
986
986
  };
987
987
  }
988
- function l(C, k) {
989
- for (var w = [], S = "", c = [
988
+ function v(C, w) {
989
+ for (var b = [], x = "", B = [
990
990
  8,
991
991
  10,
992
992
  12
993
- ][k], e = C.readBits(c), o = 0; o < e; o++) {
994
- var s = C.readBits(13), t = Math.floor(s / 192) << 8 | s % 192;
995
- t < 7936 ? t += 33088 : t += 49472, w.push(t >> 8, t & 255), S += String.fromCharCode(n.shiftJISTable[t]);
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
- bytes: w,
999
- text: S
998
+ bytes: b,
999
+ text: x
1000
1000
  };
1001
1001
  }
1002
- function m(C, k) {
1003
- for (var w, S, c, e, o = new h.BitStream(C), s = k <= 9 ? 0 : k <= 26 ? 1 : 2, t = {
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
- version: k
1008
- }; o.available() >= 4; ) {
1009
- var f = o.readBits(4);
1010
- if (f === u.Terminator) return t;
1011
- if (f === u.ECI) o.readBits(1) === 0 ? t.chunks.push({
1012
- type: d.ECI,
1013
- assignmentNumber: o.readBits(7)
1014
- }) : o.readBits(1) === 0 ? t.chunks.push({
1015
- type: d.ECI,
1016
- assignmentNumber: o.readBits(14)
1017
- }) : o.readBits(1) === 0 ? t.chunks.push({
1018
- type: d.ECI,
1019
- assignmentNumber: o.readBits(21)
1020
- }) : t.chunks.push({
1021
- type: d.ECI,
1007
+ version: w
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
+ type: s.ECI,
1013
+ assignmentNumber: l.readBits(7)
1014
+ }) : l.readBits(1) === 0 ? f.chunks.push({
1015
+ type: s.ECI,
1016
+ assignmentNumber: l.readBits(14)
1017
+ }) : l.readBits(1) === 0 ? f.chunks.push({
1018
+ type: s.ECI,
1019
+ assignmentNumber: l.readBits(21)
1020
+ }) : f.chunks.push({
1021
+ type: s.ECI,
1022
1022
  assignmentNumber: -1
1023
1023
  });
1024
- else if (f === u.Numeric) {
1025
- var B = g(o, s);
1026
- t.text += B.text, (w = t.bytes).push.apply(w, B.bytes), t.chunks.push({
1027
- type: d.Numeric,
1028
- text: B.text
1024
+ else if (g === k.Numeric) {
1025
+ var P = p(l, h);
1026
+ f.text += P.text, (b = f.bytes).push.apply(b, P.bytes), f.chunks.push({
1027
+ type: s.Numeric,
1028
+ text: P.text
1029
1029
  });
1030
- } else if (f === u.Alphanumeric) {
1031
- var p = r(o, s);
1032
- t.text += p.text, (S = t.bytes).push.apply(S, p.bytes), t.chunks.push({
1033
- type: d.Alphanumeric,
1034
- text: p.text
1030
+ } else if (g === k.Alphanumeric) {
1031
+ var S = c(l, h);
1032
+ f.text += S.text, (x = f.bytes).push.apply(x, S.bytes), f.chunks.push({
1033
+ type: s.Alphanumeric,
1034
+ text: S.text
1035
1035
  });
1036
- } else if (f === u.Byte) {
1037
- var P = i(o, s);
1038
- t.text += P.text, (c = t.bytes).push.apply(c, P.bytes), t.chunks.push({
1039
- type: d.Byte,
1040
- bytes: P.bytes,
1041
- text: P.text
1036
+ } else if (g === k.Byte) {
1037
+ var M = m(l, h);
1038
+ f.text += M.text, (B = f.bytes).push.apply(B, M.bytes), f.chunks.push({
1039
+ type: s.Byte,
1040
+ bytes: M.bytes,
1041
+ text: M.text
1042
1042
  });
1043
- } else if (f === u.Kanji) {
1044
- var y = l(o, s);
1045
- t.text += y.text, (e = t.bytes).push.apply(e, y.bytes), t.chunks.push({
1046
- type: d.Kanji,
1047
- bytes: y.bytes,
1048
- text: y.text
1043
+ } else if (g === k.Kanji) {
1044
+ var O = v(l, h);
1045
+ f.text += O.text, (n = f.bytes).push.apply(n, O.bytes), f.chunks.push({
1046
+ type: s.Kanji,
1047
+ bytes: O.bytes,
1048
+ text: O.text
1049
1049
  });
1050
1050
  }
1051
1051
  }
1052
- if (o.available() === 0 || o.readBits(o.available()) === 0) return t;
1052
+ if (l.available() === 0 || l.readBits(l.available()) === 0) return f;
1053
1053
  }
1054
- v.decode = m;
1054
+ o.decode = y;
1055
1055
  }),
1056
- (function(O, v, b) {
1056
+ (function(r, o, i) {
1057
1057
  "use strict";
1058
- Object.defineProperty(v, "__esModule", { value: !0 }), v.BitStream = (function() {
1059
- function h(n) {
1060
- this.byteOffset = 0, this.bitOffset = 0, this.bytes = n;
1058
+ Object.defineProperty(o, "__esModule", { value: !0 }), o.BitStream = (function() {
1059
+ function d(a) {
1060
+ this.byteOffset = 0, this.bitOffset = 0, this.bytes = a;
1061
1061
  }
1062
- return h.prototype.readBits = function(n) {
1063
- if (n < 1 || n > 32 || n > this.available()) throw new Error("Cannot read " + n.toString() + " bits");
1064
- var d = 0;
1062
+ return d.prototype.readBits = function(a) {
1063
+ if (a < 1 || a > 32 || a > this.available()) throw new Error("Cannot read " + a.toString() + " bits");
1064
+ var s = 0;
1065
1065
  if (this.bitOffset > 0) {
1066
- var u = 8 - this.bitOffset, g = n < u ? n : u, a = u - g, r = 255 >> 8 - g << a;
1067
- d = (this.bytes[this.byteOffset] & r) >> a, n -= g, this.bitOffset += g, this.bitOffset === 8 && (this.bitOffset = 0, 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
- if (n > 0) {
1070
- for (; n >= 8; )
1071
- d = d << 8 | this.bytes[this.byteOffset] & 255, this.byteOffset++, n -= 8;
1072
- if (n > 0) {
1073
- var a = 8 - n, r = 255 >> a << a;
1074
- d = d << n | (this.bytes[this.byteOffset] & r) >> a, this.bitOffset += n;
1069
+ if (a > 0) {
1070
+ for (; a >= 8; )
1071
+ s = s << 8 | this.bytes[this.byteOffset] & 255, this.byteOffset++, a -= 8;
1072
+ if (a > 0) {
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
- return d;
1078
- }, h.prototype.available = function() {
1077
+ return s;
1078
+ }, d.prototype.available = function() {
1079
1079
  return 8 * (this.bytes.length - this.byteOffset) - this.bitOffset;
1080
- }, h;
1080
+ }, d;
1081
1081
  })();
1082
1082
  }),
1083
- (function(O, v, b) {
1083
+ (function(r, o, i) {
1084
1084
  "use strict";
1085
- Object.defineProperty(v, "__esModule", { value: !0 }), v.shiftJISTable = {
1085
+ Object.defineProperty(o, "__esModule", { value: !0 }), o.shiftJISTable = {
1086
1086
  32: 32,
1087
1087
  33: 33,
1088
1088
  34: 34,
@@ -8122,65 +8122,65 @@ var N3 = /* @__PURE__ */ x3(((M, L) => {
8122
8122
  60068: 29081
8123
8123
  };
8124
8124
  }),
8125
- (function(O, v, b) {
8125
+ (function(r, o, i) {
8126
8126
  "use strict";
8127
- Object.defineProperty(v, "__esModule", { value: !0 });
8128
- var h = b(1), n = b(2);
8129
- function d(r, i, l, m) {
8127
+ Object.defineProperty(o, "__esModule", { value: !0 });
8128
+ var d = i(1), a = i(2);
8129
+ function s(c, m, v, y) {
8130
8130
  var C;
8131
- i.degree() < l.degree() && (C = [l, i], i = C[0], l = C[1]);
8132
- for (var k = i, w = l, S = r.zero, c = r.one; w.degree() >= m / 2; ) {
8133
- var e = k, o = S;
8134
- if (k = w, S = c, k.isZero()) return null;
8135
- w = e;
8136
- for (var s = r.zero, t = k.getCoefficient(k.degree()), f = r.inverse(t); w.degree() >= k.degree() && !w.isZero(); ) {
8137
- var B = w.degree() - k.degree(), p = r.multiply(w.getCoefficient(w.degree()), f);
8138
- s = s.addOrSubtract(r.buildMonomial(B, p)), w = w.addOrSubtract(k.multiplyByMonomial(B, p));
8131
+ m.degree() < v.degree() && (C = [v, m], m = C[0], v = C[1]);
8132
+ for (var w = m, b = v, x = c.zero, B = c.one; b.degree() >= y / 2; ) {
8133
+ var n = w, l = x;
8134
+ if (w = b, x = B, w.isZero()) return null;
8135
+ b = n;
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 (c = s.multiplyPoly(S).addOrSubtract(o), w.degree() >= k.degree()) return null;
8140
+ if (B = h.multiplyPoly(x).addOrSubtract(l), b.degree() >= w.degree()) return null;
8141
8141
  }
8142
- var P = c.getCoefficient(0);
8143
- if (P === 0) return null;
8144
- var y = r.inverse(P);
8145
- return [c.multiply(y), w.multiply(y)];
8142
+ var M = B.getCoefficient(0);
8143
+ if (M === 0) return null;
8144
+ var O = c.inverse(M);
8145
+ return [B.multiply(O), b.multiply(O)];
8146
8146
  }
8147
- function u(r, i) {
8148
- var l = i.degree();
8149
- if (l === 1) return [i.getCoefficient(1)];
8150
- for (var m = new Array(l), C = 0, k = 1; k < r.size && C < l; k++) i.evaluateAt(k) === 0 && (m[C] = r.inverse(k), C++);
8151
- return C !== l ? null : m;
8147
+ function k(c, m) {
8148
+ var v = m.degree();
8149
+ if (v === 1) return [m.getCoefficient(1)];
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 g(r, i, l) {
8154
- for (var m = l.length, C = new Array(m), k = 0; k < m; k++) {
8155
- for (var w = r.inverse(l[k]), S = 1, c = 0; c < m; c++) k !== c && (S = r.multiply(S, h.addOrSubtractGF(1, r.multiply(l[c], w))));
8156
- C[k] = r.multiply(i.evaluateAt(w), r.inverse(S)), r.generatorBase !== 0 && (C[k] = r.multiply(C[k], 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 a(r, i) {
8161
- var l = new Uint8ClampedArray(r.length);
8162
- l.set(r);
8163
- for (var m = new h.default(285, 256, 0), C = new n.default(m, l), k = new Uint8ClampedArray(i), w = !1, S = 0; S < i; S++) {
8164
- var c = C.evaluateAt(m.exp(S + m.generatorBase));
8165
- k[k.length - 1 - S] = c, c !== 0 && (w = !0);
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
+ w[w.length - 1 - x] = B, B !== 0 && (b = !0);
8166
8166
  }
8167
- if (!w) return l;
8168
- var e = new n.default(m, k), o = d(m, m.buildMonomial(i, 1), e, i);
8169
- if (o === null) return null;
8170
- var s = u(m, o[0]);
8171
- if (s == null) return null;
8172
- for (var t = g(m, o[1], s), f = 0; f < s.length; f++) {
8173
- var B = l.length - 1 - m.log(s[f]);
8174
- if (B < 0) return null;
8175
- l[B] = h.addOrSubtractGF(l[B], t[f]);
8167
+ if (!b) return v;
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
+ if (h == null) return null;
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
- return l;
8177
+ return v;
8178
8178
  }
8179
- v.decode = a;
8179
+ o.decode = u;
8180
8180
  }),
8181
- (function(O, v, b) {
8181
+ (function(r, o, i) {
8182
8182
  "use strict";
8183
- Object.defineProperty(v, "__esModule", { value: !0 }), v.VERSIONS = [
8183
+ Object.defineProperty(o, "__esModule", { value: !0 }), o.VERSIONS = [
8184
8184
  {
8185
8185
  infoBits: null,
8186
8186
  versionNumber: 1,
@@ -10169,474 +10169,474 @@ var N3 = /* @__PURE__ */ x3(((M, L) => {
10169
10169
  }
10170
10170
  ];
10171
10171
  }),
10172
- (function(O, v, b) {
10172
+ (function(r, o, i) {
10173
10173
  "use strict";
10174
- Object.defineProperty(v, "__esModule", { value: !0 });
10175
- var h = b(0);
10176
- function n(a, r, i, l) {
10177
- var m = a.x - r.x + i.x - l.x, C = a.y - r.y + i.y - l.y;
10178
- if (m === 0 && C === 0) return {
10179
- a11: r.x - a.x,
10180
- a12: r.y - a.y,
10174
+ Object.defineProperty(o, "__esModule", { value: !0 });
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: i.x - r.x,
10183
- a22: i.y - r.y,
10182
+ a21: m.x - c.x,
10183
+ a22: m.y - c.y,
10184
10184
  a23: 0,
10185
- a31: a.x,
10186
- a32: a.y,
10185
+ a31: u.x,
10186
+ a32: u.y,
10187
10187
  a33: 1
10188
10188
  };
10189
- var k = r.x - i.x, w = l.x - i.x, S = r.y - i.y, c = l.y - i.y, e = k * c - w * S, o = (m * c - w * C) / e, s = (k * C - m * S) / e;
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: r.x - a.x + o * r.x,
10192
- a12: r.y - a.y + o * r.y,
10193
- a13: o,
10194
- a21: l.x - a.x + s * l.x,
10195
- a22: l.y - a.y + s * l.y,
10196
- a23: s,
10197
- a31: a.x,
10198
- a32: a.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
+ a23: h,
10197
+ a31: u.x,
10198
+ a32: u.y,
10199
10199
  a33: 1
10200
10200
  };
10201
10201
  }
10202
- function d(a, r, i, l) {
10203
- var m = n(a, r, i, l);
10202
+ function s(u, c, m, v) {
10203
+ var y = a(u, c, m, v);
10204
10204
  return {
10205
- a11: m.a22 * m.a33 - m.a23 * m.a32,
10206
- a12: m.a13 * m.a32 - m.a12 * m.a33,
10207
- a13: m.a12 * m.a23 - m.a13 * m.a22,
10208
- a21: m.a23 * m.a31 - m.a21 * m.a33,
10209
- a22: m.a11 * m.a33 - m.a13 * m.a31,
10210
- a23: m.a13 * m.a21 - m.a11 * m.a23,
10211
- a31: m.a21 * m.a32 - m.a22 * m.a31,
10212
- a32: m.a12 * m.a31 - m.a11 * m.a32,
10213
- a33: m.a11 * m.a22 - m.a12 * m.a21
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 u(a, r) {
10216
+ function k(u, c) {
10217
10217
  return {
10218
- a11: a.a11 * r.a11 + a.a21 * r.a12 + a.a31 * r.a13,
10219
- a12: a.a12 * r.a11 + a.a22 * r.a12 + a.a32 * r.a13,
10220
- a13: a.a13 * r.a11 + a.a23 * r.a12 + a.a33 * r.a13,
10221
- a21: a.a11 * r.a21 + a.a21 * r.a22 + a.a31 * r.a23,
10222
- a22: a.a12 * r.a21 + a.a22 * r.a22 + a.a32 * r.a23,
10223
- a23: a.a13 * r.a21 + a.a23 * r.a22 + a.a33 * r.a23,
10224
- a31: a.a11 * r.a31 + a.a21 * r.a32 + a.a31 * r.a33,
10225
- a32: a.a12 * r.a31 + a.a22 * r.a32 + a.a32 * r.a33,
10226
- a33: a.a13 * r.a31 + a.a23 * r.a32 + a.a33 * r.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 g(a, r) {
10230
- for (var i = d({
10229
+ function p(u, c) {
10230
+ for (var m = s({
10231
10231
  x: 3.5,
10232
10232
  y: 3.5
10233
10233
  }, {
10234
- x: r.dimension - 3.5,
10234
+ x: c.dimension - 3.5,
10235
10235
  y: 3.5
10236
10236
  }, {
10237
- x: r.dimension - 6.5,
10238
- y: r.dimension - 6.5
10237
+ x: c.dimension - 6.5,
10238
+ y: c.dimension - 6.5
10239
10239
  }, {
10240
10240
  x: 3.5,
10241
- y: r.dimension - 3.5
10242
- }), l = u(n(r.topLeft, r.topRight, r.alignmentPattern, r.bottomLeft), i), m = h.BitMatrix.createEmpty(r.dimension, r.dimension), C = function(c, e) {
10243
- var o = l.a13 * c + l.a23 * e + l.a33;
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: (l.a11 * c + l.a21 * e + l.a31) / o,
10246
- y: (l.a12 * c + l.a22 * e + l.a32) / o
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
- }, k = 0; k < r.dimension; k++) for (var w = 0; w < r.dimension; w++) {
10249
- var S = C(w + 0.5, k + 0.5);
10250
- m.set(w, k, a.get(Math.floor(S.x), Math.floor(S.y)));
10248
+ }, w = 0; w < c.dimension; w++) for (var b = 0; b < c.dimension; b++) {
10249
+ var x = C(b + 0.5, w + 0.5);
10250
+ y.set(b, w, u.get(Math.floor(x.x), Math.floor(x.y)));
10251
10251
  }
10252
10252
  return {
10253
- matrix: m,
10253
+ matrix: y,
10254
10254
  mappingFunction: C
10255
10255
  };
10256
10256
  }
10257
- v.extract = g;
10257
+ o.extract = p;
10258
10258
  }),
10259
- (function(O, v, b) {
10259
+ (function(r, o, i) {
10260
10260
  "use strict";
10261
- Object.defineProperty(v, "__esModule", { value: !0 });
10262
- var h = 4, n = 0.5, d = 1.5, u = function(c, e) {
10263
- return Math.sqrt(Math.pow(e.x - c.x, 2) + Math.pow(e.y - c.y, 2));
10261
+ Object.defineProperty(o, "__esModule", { value: !0 });
10262
+ var d = 4, a = 0.5, s = 1.5, k = function(B, n) {
10263
+ return Math.sqrt(Math.pow(n.x - B.x, 2) + Math.pow(n.y - B.y, 2));
10264
10264
  };
10265
- function g(c) {
10266
- return c.reduce(function(e, o) {
10267
- return e + o;
10265
+ function p(B) {
10266
+ return B.reduce(function(n, l) {
10267
+ return n + l;
10268
10268
  });
10269
10269
  }
10270
- function a(c, e, o) {
10271
- var s, t, f, B, p = u(c, e), P = u(e, o), y = u(c, o), N, E, x;
10272
- return P >= p && P >= y ? (s = [
10273
- e,
10274
- c,
10275
- o
10276
- ], N = s[0], E = s[1], x = s[2]) : y >= P && y >= p ? (t = [
10277
- c,
10278
- e,
10279
- o
10280
- ], N = t[0], E = t[1], x = t[2]) : (f = [
10281
- c,
10282
- o,
10283
- e
10284
- ], N = f[0], E = f[1], x = f[2]), (x.x - E.x) * (N.y - E.y) - (x.y - E.y) * (N.x - E.x) < 0 && (B = [x, N], N = B[0], x = B[1]), {
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
+ return M >= S && M >= O ? (h = [
10273
+ n,
10274
+ B,
10275
+ l
10276
+ ], N = h[0], F = h[1], A = h[2]) : O >= M && O >= S ? (f = [
10277
+ B,
10278
+ n,
10279
+ l
10280
+ ], N = f[0], F = f[1], A = f[2]) : (g = [
10281
+ B,
10282
+ l,
10283
+ n
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
10285
  bottomLeft: N,
10286
- topLeft: E,
10287
- topRight: x
10286
+ topLeft: F,
10287
+ topRight: A
10288
10288
  };
10289
10289
  }
10290
- function r(c, e, o, s) {
10291
- var t = (g(l(c, o, s, 5)) / 7 + g(l(c, e, s, 5)) / 7 + g(l(o, c, s, 5)) / 7 + g(l(e, c, s, 5)) / 7) / 4;
10292
- if (t < 1) throw new Error("Invalid module size");
10293
- var f = Math.round(u(c, e) / t), B = Math.round(u(c, o) / t), p = Math.floor((f + B) / 2) + 7;
10294
- switch (p % 4) {
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
+ switch (S % 4) {
10295
10295
  case 0:
10296
- p++;
10296
+ S++;
10297
10297
  break;
10298
10298
  case 2:
10299
- p--;
10299
+ S--;
10300
10300
  break;
10301
10301
  }
10302
10302
  return {
10303
- dimension: p,
10304
- moduleSize: t
10303
+ dimension: S,
10304
+ moduleSize: f
10305
10305
  };
10306
10306
  }
10307
- function i(c, e, o, s) {
10308
- var t = [{
10309
- x: Math.floor(c.x),
10310
- y: Math.floor(c.y)
10311
- }], f = Math.abs(e.y - c.y) > Math.abs(e.x - c.x), B, p, P, y;
10312
- f ? (B = Math.floor(c.y), p = Math.floor(c.x), P = Math.floor(e.y), y = Math.floor(e.x)) : (B = Math.floor(c.x), p = Math.floor(c.y), P = Math.floor(e.x), y = Math.floor(e.y));
10313
- for (var N = Math.abs(P - B), E = Math.abs(y - p), x = Math.floor(-N / 2), I = B < P ? 1 : -1, T = p < y ? 1 : -1, z = !0, D = B, j = p; D !== P + I; D += I) {
10314
- var A = f ? j : D, F = f ? D : j;
10315
- if (o.get(A, F) !== z && (z = !z, t.push({
10316
- x: A,
10317
- y: F
10318
- }), t.length === s + 1))
10307
+ function m(B, n, l, h) {
10308
+ var f = [{
10309
+ x: Math.floor(B.x),
10310
+ y: Math.floor(B.y)
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
+ var I = g ? Q : _, j = g ? _ : Q;
10315
+ if (l.get(I, j) !== D && (D = !D, f.push({
10316
+ x: I,
10317
+ y: j
10318
+ }), f.length === h + 1))
10319
10319
  break;
10320
- if (x += E, x > 0) {
10321
- if (j === y) break;
10322
- j += T, x -= N;
10320
+ if (A += F, A > 0) {
10321
+ if (Q === O) break;
10322
+ Q += L, A -= N;
10323
10323
  }
10324
10324
  }
10325
- for (var X = [], R = 0; R < s; R++) t[R] && t[R + 1] ? X.push(u(t[R], t[R + 1])) : X.push(0);
10326
- return X;
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
+ return z;
10327
10327
  }
10328
- function l(c, e, o, s) {
10329
- var t, f = e.y - c.y, B = e.x - c.x, p = i(c, e, o, Math.ceil(s / 2)), P = i(c, {
10330
- x: c.x - B,
10331
- y: c.y - f
10332
- }, o, Math.ceil(s / 2)), y = p.shift() + P.shift() - 1;
10333
- return (t = P.concat(y)).concat.apply(t, p);
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
+ y: B.y - g
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 m(c, e) {
10336
- var o = g(c) / g(e), s = 0;
10337
- return e.forEach(function(t, f) {
10338
- s += Math.pow(c[f] - t * o, 2);
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: o,
10341
- error: s
10340
+ averageSize: l,
10341
+ error: h
10342
10342
  };
10343
10343
  }
10344
- function C(c, e, o) {
10344
+ function C(B, n, l) {
10345
10345
  try {
10346
- var s = l(c, {
10346
+ var h = v(B, {
10347
10347
  x: -1,
10348
- y: c.y
10349
- }, o, e.length), t = l(c, {
10350
- x: c.x,
10348
+ y: B.y
10349
+ }, l, n.length), f = v(B, {
10350
+ x: B.x,
10351
10351
  y: -1
10352
- }, o, e.length), f = l(c, {
10353
- x: Math.max(0, c.x - c.y) - 1,
10354
- y: Math.max(0, c.y - c.x) - 1
10355
- }, o, e.length), B = l(c, {
10356
- x: Math.min(o.width, c.x + c.y) + 1,
10357
- y: Math.min(o.height, c.y + c.x) + 1
10358
- }, o, e.length), p = m(s, e), P = m(t, e), y = m(f, e), N = m(B, e), E = Math.sqrt(p.error * p.error + P.error * P.error + y.error * y.error + N.error * N.error), x = (p.averageSize + P.averageSize + y.averageSize + N.averageSize) / 4;
10359
- return E + (Math.pow(p.averageSize - x, 2) + Math.pow(P.averageSize - x, 2) + Math.pow(y.averageSize - x, 2) + Math.pow(N.averageSize - x, 2)) / x;
10352
+ }, l, n.length), g = v(B, {
10353
+ x: Math.max(0, B.x - B.y) - 1,
10354
+ y: Math.max(0, B.y - B.x) - 1
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
- function k(c, e) {
10365
- for (var o = Math.round(e.x); c.get(o, Math.round(e.y)); ) o--;
10366
- for (var s = Math.round(e.x); c.get(s, Math.round(e.y)); ) s++;
10367
- for (var t = (o + s) / 2, f = Math.round(e.y); c.get(Math.round(t), f); ) f--;
10368
- for (var B = Math.round(e.y); c.get(Math.round(t), B); ) B++;
10364
+ function w(B, n) {
10365
+ for (var l = Math.round(n.x); B.get(l, Math.round(n.y)); ) l--;
10366
+ for (var h = Math.round(n.x); B.get(h, Math.round(n.y)); ) h++;
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: t,
10371
- y: (f + B) / 2
10370
+ x: f,
10371
+ y: (g + P) / 2
10372
10372
  };
10373
10373
  }
10374
- function w(c) {
10375
- for (var e = [], o = [], s = [], t = [], f = function(A) {
10376
- for (var F = 0, X = !1, R = [
10374
+ function b(B) {
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,
10380
10380
  0,
10381
10381
  0
10382
- ], q = function(U) {
10383
- var t3 = c.get(U, A);
10384
- if (t3 === X) F++;
10382
+ ], t3 = function(G) {
10383
+ var i3 = B.get(G, I);
10384
+ if (i3 === z) j++;
10385
10385
  else {
10386
10386
  R = [
10387
10387
  R[1],
10388
10388
  R[2],
10389
10389
  R[3],
10390
10390
  R[4],
10391
- F
10392
- ], F = 1, X = t3;
10393
- var Q = g(R) / 7, m3 = Math.abs(R[0] - Q) < Q && Math.abs(R[1] - Q) < Q && Math.abs(R[2] - 3 * Q) < 3 * Q && Math.abs(R[3] - Q) < Q && Math.abs(R[4] - Q) < Q && !t3, H = g(R.slice(-3)) / 3, C3 = Math.abs(R[2] - H) < H && Math.abs(R[3] - H) < H && Math.abs(R[4] - H) < H && t3;
10394
- if (m3) {
10395
- var s3 = U - R[3] - R[4], e3 = s3 - R[2], $ = {
10396
- startX: e3,
10397
- endX: s3,
10398
- y: A
10399
- }, o3 = o.filter(function(K) {
10400
- return e3 >= K.bottom.startX && e3 <= K.bottom.endX || s3 >= K.bottom.startX && e3 <= K.bottom.endX || e3 <= K.bottom.startX && s3 >= K.bottom.endX && R[2] / (K.bottom.endX - K.bottom.startX) < d && R[2] / (K.bottom.endX - K.bottom.startX) > n;
10391
+ j
10392
+ ], j = 1, z = i3;
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
+ if (q3) {
10395
+ var c3 = G - R[3] - R[4], r3 = c3 - R[2], W = {
10396
+ startX: r3,
10397
+ endX: c3,
10398
+ y: I
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 = $ : o.push({
10403
- top: $,
10404
- bottom: $
10402
+ o3.length > 0 ? o3[0].bottom = W : l.push({
10403
+ top: W,
10404
+ bottom: W
10405
10405
  });
10406
10406
  }
10407
- if (C3) {
10408
- var a3 = U - R[4], r3 = a3 - R[3], $ = {
10409
- startX: r3,
10410
- y: A,
10411
- endX: a3
10412
- }, o3 = t.filter(function(W) {
10413
- return r3 >= W.bottom.startX && r3 <= W.bottom.endX || a3 >= W.bottom.startX && r3 <= W.bottom.endX || r3 <= W.bottom.startX && a3 >= W.bottom.endX && R[2] / (W.bottom.endX - W.bottom.startX) < d && R[2] / (W.bottom.endX - W.bottom.startX) > n;
10407
+ if (X3) {
10408
+ var l3 = G - R[4], s3 = l3 - R[3], W = {
10409
+ startX: s3,
10410
+ y: I,
10411
+ endX: l3
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 = $ : t.push({
10416
- top: $,
10417
- bottom: $
10415
+ o3.length > 0 ? o3[0].bottom = W : f.push({
10416
+ top: W,
10417
+ bottom: W
10418
10418
  });
10419
10419
  }
10420
10420
  }
10421
- }, V = -1; V <= c.width; V++) q(V);
10422
- e.push.apply(e, o.filter(function(U) {
10423
- return U.bottom.y !== A && U.bottom.y - U.top.y >= 2;
10424
- })), o = o.filter(function(U) {
10425
- return U.bottom.y === A;
10426
- }), s.push.apply(s, t.filter(function(U) {
10427
- return U.bottom.y !== A;
10428
- })), t = t.filter(function(U) {
10429
- return U.bottom.y === A;
10421
+ }, q = -1; q <= B.width; q++) t3(q);
10422
+ n.push.apply(n, l.filter(function(G) {
10423
+ return G.bottom.y !== I && G.bottom.y - G.top.y >= 2;
10424
+ })), l = l.filter(function(G) {
10425
+ return G.bottom.y === I;
10426
+ }), h.push.apply(h, f.filter(function(G) {
10427
+ return G.bottom.y !== I;
10428
+ })), f = f.filter(function(G) {
10429
+ return G.bottom.y === I;
10430
10430
  });
10431
- }, B = 0; B <= c.height; B++) f(B);
10432
- e.push.apply(e, o.filter(function(A) {
10433
- return A.bottom.y - A.top.y >= 2;
10434
- })), s.push.apply(s, t);
10435
- var p = e.filter(function(A) {
10436
- return A.bottom.y - A.top.y >= 2;
10437
- }).map(function(A) {
10438
- var F = (A.top.startX + A.top.endX + A.bottom.startX + A.bottom.endX) / 4, X = (A.top.y + A.bottom.y + 1) / 2;
10439
- if (c.get(Math.round(F), Math.round(X))) {
10431
+ }, P = 0; P <= B.height; P++) g(P);
10432
+ n.push.apply(n, l.filter(function(I) {
10433
+ return I.bottom.y - I.top.y >= 2;
10434
+ })), h.push.apply(h, f);
10435
+ var S = n.filter(function(I) {
10436
+ return I.bottom.y - I.top.y >= 2;
10437
+ }).map(function(I) {
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
+ if (B.get(Math.round(j), Math.round(z))) {
10440
10440
  var R = [
10441
- A.top.endX - A.top.startX,
10442
- A.bottom.endX - A.bottom.startX,
10443
- A.bottom.y - A.top.y + 1
10444
- ], q = g(R) / R.length;
10441
+ I.top.endX - I.top.startX,
10442
+ I.bottom.endX - I.bottom.startX,
10443
+ I.bottom.y - I.top.y + 1
10444
+ ], t3 = p(R) / R.length;
10445
10445
  return {
10446
10446
  score: C({
10447
- x: Math.round(F),
10448
- y: Math.round(X)
10447
+ x: Math.round(j),
10448
+ y: Math.round(z)
10449
10449
  }, [
10450
10450
  1,
10451
10451
  1,
10452
10452
  3,
10453
10453
  1,
10454
10454
  1
10455
- ], c),
10456
- x: F,
10457
- y: X,
10458
- size: q
10455
+ ], B),
10456
+ x: j,
10457
+ y: z,
10458
+ size: t3
10459
10459
  };
10460
10460
  }
10461
- }).filter(function(A) {
10462
- return !!A;
10463
- }).sort(function(A, F) {
10464
- return A.score - F.score;
10465
- }).map(function(A, F, X) {
10466
- if (F > h) return null;
10467
- var R = X.filter(function(V, U) {
10468
- return F !== U;
10469
- }).map(function(V) {
10461
+ }).filter(function(I) {
10462
+ return !!I;
10463
+ }).sort(function(I, j) {
10464
+ return I.score - j.score;
10465
+ }).map(function(I, j, z) {
10466
+ if (j > d) return null;
10467
+ var R = z.filter(function(q, G) {
10468
+ return j !== G;
10469
+ }).map(function(q) {
10470
10470
  return {
10471
- x: V.x,
10472
- y: V.y,
10473
- score: V.score + Math.pow(V.size - A.size, 2) / A.size,
10474
- size: V.size
10471
+ x: q.x,
10472
+ y: q.y,
10473
+ score: q.score + Math.pow(q.size - I.size, 2) / I.size,
10474
+ size: q.size
10475
10475
  };
10476
- }).sort(function(V, U) {
10477
- return V.score - U.score;
10476
+ }).sort(function(q, G) {
10477
+ return q.score - G.score;
10478
10478
  });
10479
10479
  if (R.length < 2) return null;
10480
- var q = A.score + R[0].score + R[1].score;
10480
+ var t3 = I.score + R[0].score + R[1].score;
10481
10481
  return {
10482
- points: [A].concat(R.slice(0, 2)),
10483
- score: q
10482
+ points: [I].concat(R.slice(0, 2)),
10483
+ score: t3
10484
10484
  };
10485
- }).filter(function(A) {
10486
- return !!A;
10487
- }).sort(function(A, F) {
10488
- return A.score - F.score;
10485
+ }).filter(function(I) {
10486
+ return !!I;
10487
+ }).sort(function(I, j) {
10488
+ return I.score - j.score;
10489
10489
  });
10490
- if (p.length === 0) return null;
10491
- var P = a(p[0].points[0], p[0].points[1], p[0].points[2]), y = P.topRight, N = P.topLeft, E = P.bottomLeft, x = S(c, s, y, N, E), I = [];
10492
- x && I.push({
10490
+ if (S.length === 0) return null;
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
+ A && E.push({
10493
10493
  alignmentPattern: {
10494
- x: x.alignmentPattern.x,
10495
- y: x.alignmentPattern.y
10494
+ x: A.alignmentPattern.x,
10495
+ y: A.alignmentPattern.y
10496
10496
  },
10497
10497
  bottomLeft: {
10498
- x: E.x,
10499
- y: E.y
10498
+ x: F.x,
10499
+ y: F.y
10500
10500
  },
10501
- dimension: x.dimension,
10501
+ dimension: A.dimension,
10502
10502
  topLeft: {
10503
10503
  x: N.x,
10504
10504
  y: N.y
10505
10505
  },
10506
10506
  topRight: {
10507
- x: y.x,
10508
- y: y.y
10507
+ x: O.x,
10508
+ y: O.y
10509
10509
  }
10510
10510
  });
10511
- var T = k(c, y), z = k(c, N), D = k(c, E), j = S(c, s, T, z, D);
10512
- return j && I.push({
10511
+ var L = w(B, O), D = w(B, N), _ = w(B, F), Q = x(B, h, L, D, _);
10512
+ return Q && E.push({
10513
10513
  alignmentPattern: {
10514
- x: j.alignmentPattern.x,
10515
- y: j.alignmentPattern.y
10514
+ x: Q.alignmentPattern.x,
10515
+ y: Q.alignmentPattern.y
10516
10516
  },
10517
10517
  bottomLeft: {
10518
- x: D.x,
10519
- y: D.y
10518
+ x: _.x,
10519
+ y: _.y
10520
10520
  },
10521
10521
  topLeft: {
10522
- x: z.x,
10523
- y: z.y
10522
+ x: D.x,
10523
+ y: D.y
10524
10524
  },
10525
10525
  topRight: {
10526
- x: T.x,
10527
- y: T.y
10526
+ x: L.x,
10527
+ y: L.y
10528
10528
  },
10529
- dimension: j.dimension
10530
- }), I.length === 0 ? null : I;
10529
+ dimension: Q.dimension
10530
+ }), E.length === 0 ? null : E;
10531
10531
  }
10532
- v.locate = w;
10533
- function S(c, e, o, s, t) {
10534
- var f, B, p;
10532
+ o.locate = b;
10533
+ function x(B, n, l, h, f) {
10534
+ var g, P, S;
10535
10535
  try {
10536
- f = r(s, o, t, c), B = f.dimension, p = f.moduleSize;
10536
+ g = c(h, l, f, B), P = g.dimension, S = g.moduleSize;
10537
10537
  } catch {
10538
10538
  return null;
10539
10539
  }
10540
- var P = {
10541
- x: o.x - s.x + t.x,
10542
- y: o.y - s.y + t.y
10543
- }, y = (u(s, t) + u(s, o)) / 2 / p, N = 1 - 3 / y, E = {
10544
- x: s.x + N * (P.x - s.x),
10545
- y: s.y + N * (P.y - s.y)
10546
- }, x = e.map(function(I) {
10547
- var T = (I.top.startX + I.top.endX + I.bottom.startX + I.bottom.endX) / 4, z = (I.top.y + I.bottom.y + 1) / 2;
10548
- if (c.get(Math.floor(T), Math.floor(z))) {
10549
- var D = [
10550
- I.top.endX - I.top.startX,
10551
- I.bottom.endX - I.bottom.startX,
10552
- I.bottom.y - I.top.y + 1
10540
+ var M = {
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
+ }, A = n.map(function(E) {
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
+ var _ = [
10550
+ E.top.endX - E.top.startX,
10551
+ E.bottom.endX - E.bottom.startX,
10552
+ E.bottom.y - E.top.y + 1
10553
10553
  ];
10554
- return g(D) / D.length, {
10555
- x: T,
10556
- y: z,
10554
+ return p(_) / _.length, {
10555
+ x: L,
10556
+ y: D,
10557
10557
  score: C({
10558
- x: Math.floor(T),
10559
- y: Math.floor(z)
10558
+ x: Math.floor(L),
10559
+ y: Math.floor(D)
10560
10560
  }, [
10561
10561
  1,
10562
10562
  1,
10563
10563
  1
10564
- ], c) + u({
10565
- x: T,
10566
- y: z
10567
- }, E)
10564
+ ], B) + k({
10565
+ x: L,
10566
+ y: D
10567
+ }, F)
10568
10568
  };
10569
10569
  }
10570
- }).filter(function(I) {
10571
- return !!I;
10572
- }).sort(function(I, T) {
10573
- return I.score - T.score;
10570
+ }).filter(function(E) {
10571
+ return !!E;
10572
+ }).sort(function(E, L) {
10573
+ return E.score - L.score;
10574
10574
  });
10575
10575
  return {
10576
- alignmentPattern: y >= 15 && x.length ? x[0] : E,
10577
- dimension: B
10576
+ alignmentPattern: O >= 15 && A.length ? A[0] : F,
10577
+ dimension: P
10578
10578
  };
10579
10579
  }
10580
10580
  })
10581
10581
  ]).default;
10582
10582
  });
10583
- })), E3 = /* @__PURE__ */ I3(N3(), 1), O3 = 3e4, _3 = 200;
10584
- function Q3({ supabase: M, app: L, children: O }) {
10585
- const { isConnected: v, isConnecting: b, session: h, deviceSessionId: n, connect: d, disconnect: u, error: g, clearError: a } = A3(), [r, i] = Z(!1), l = v && h && h.app !== L, m = !v || !!l;
10586
- return J(() => {
10587
- if (!v) return;
10583
+ })), c2 = /* @__PURE__ */ s2(i2(), 1), l2 = 3e4, d2 = 200;
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
+ return Z(() => {
10587
+ if (!o) return;
10588
10588
  (async () => {
10589
- const { data: { session: k } } = await M.auth.getSession();
10590
- if (!k) {
10591
- u(M);
10589
+ const { data: { session: w } } = await e.auth.getSession();
10590
+ if (!w) {
10591
+ k(e);
10592
10592
  return;
10593
10593
  }
10594
- if (n) {
10595
- const { data: w } = await M.from("device_sessions").select("status").eq("id", n).maybeSingle();
10596
- (!w || w.status !== "active") && (i(!0), u(M));
10594
+ if (e.realtime.setAuth(w.access_token), a) {
10595
+ const { data: b } = await e.from("device_sessions").select("status").eq("id", a).maybeSingle();
10596
+ (!b || b.status !== "active") && (m(!0), k(e));
10597
10597
  }
10598
10598
  })();
10599
- }, []), J(() => {
10600
- if (!v || !n) return;
10601
- const C = M.channel(`ds-watch-${n}-${Math.random()}`).on("postgres_changes", {
10599
+ }, []), Z(() => {
10600
+ if (!o || !a) return;
10601
+ const C = e.channel(`ds-watch-${a}-${Math.random()}`).on("postgres_changes", {
10602
10602
  event: "UPDATE",
10603
10603
  schema: "public",
10604
10604
  table: "device_sessions",
10605
- filter: `id=eq.${n}`
10606
- }, (k) => {
10607
- k.new?.status === "ended" && (i(!0), u(M));
10605
+ filter: `id=eq.${a}`
10606
+ }, (w) => {
10607
+ w.new?.status === "ended" && (m(!0), k(e));
10608
10608
  }).subscribe();
10609
10609
  return () => {
10610
- M.removeChannel(C);
10610
+ e.removeChannel(C);
10611
10611
  };
10612
- }, [v, n]), J(() => {
10613
- if (!v || !n) return;
10612
+ }, [o, a]), Z(() => {
10613
+ if (!o || !a) return;
10614
10614
  const C = setInterval(() => {
10615
- M.functions.invoke("session/keepalive", { body: { deviceSessionId: n } });
10616
- }, O3);
10615
+ e.functions.invoke("session/keepalive", { body: { deviceSessionId: a } });
10616
+ }, l2);
10617
10617
  return () => clearInterval(C);
10618
- }, [v, n]), m ? /* @__PURE__ */ _(R3, {
10619
- app: L,
10620
- sessionEnded: r,
10621
- isConnecting: b,
10622
- error: g,
10623
- onConnect: (C) => d(C, M),
10624
- onClearError: a,
10625
- onDismissEnded: () => i(!1)
10626
- }) : /* @__PURE__ */ _(n3, { children: O });
10618
+ }, [o, a]), y ? /* @__PURE__ */ T(u2, {
10619
+ app: t,
10620
+ sessionEnded: c,
10621
+ isConnecting: i,
10622
+ error: p,
10623
+ onConnect: (C) => s(C, e),
10624
+ onClearError: u,
10625
+ onDismissEnded: () => m(!1)
10626
+ }) : /* @__PURE__ */ T(u3, { children: r });
10627
10627
  }
10628
- var i3 = {
10628
+ var M3 = {
10629
10629
  pdv: "PDV",
10630
10630
  kds: "KDS"
10631
10631
  };
10632
- function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b, onClearError: h, onDismissEnded: n }) {
10633
- const d = Y(null), u = Y(null), g = Y(null), a = Y(0), r = Y(0), i = Y(!1), l = Y(0), [m, C] = Z(!1), [k, w] = Z(null);
10634
- function S() {
10635
- l.current += 1, cancelAnimationFrame(a.current), g.current?.getTracks().forEach((y) => y.stop()), g.current = null, C(!1);
10636
- }
10637
- async function c() {
10638
- const y = l.current;
10639
- w(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
+ function x() {
10635
+ v.current += 1, cancelAnimationFrame(u.current), p.current?.getTracks().forEach((O) => O.stop()), p.current = null, C(!1);
10636
+ }
10637
+ async function B() {
10638
+ const O = v.current;
10639
+ b(null);
10640
10640
  let N;
10641
10641
  try {
10642
10642
  N = await navigator.mediaDevices.getUserMedia({ video: {
@@ -10645,72 +10645,72 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
10645
10645
  height: { ideal: 720 }
10646
10646
  } });
10647
10647
  } catch {
10648
- if (y !== l.current) return;
10649
- w("Não foi possível acessar a câmera. Verifique as permissões.");
10648
+ if (O !== v.current) return;
10649
+ b("Não foi possível acessar a câmera. Verifique as permissões.");
10650
10650
  return;
10651
10651
  }
10652
- if (y !== l.current) {
10653
- N.getTracks().forEach((x) => x.stop());
10652
+ if (O !== v.current) {
10653
+ N.getTracks().forEach((A) => A.stop());
10654
10654
  return;
10655
10655
  }
10656
- if (g.current = N, d.current) {
10657
- d.current.srcObject = N;
10656
+ if (p.current = N, s.current) {
10657
+ s.current.srcObject = N;
10658
10658
  try {
10659
- await d.current.play();
10659
+ await s.current.play();
10660
10660
  } catch {
10661
10661
  }
10662
10662
  }
10663
- if (y !== l.current) return;
10663
+ if (O !== v.current) return;
10664
10664
  C(!0);
10665
- const E = () => {
10666
- if (y !== l.current) return;
10667
- const x = d.current, I = u.current;
10668
- if (!x || !I || x.readyState !== x.HAVE_ENOUGH_DATA) {
10669
- a.current = requestAnimationFrame(E);
10665
+ const F = () => {
10666
+ if (O !== v.current) return;
10667
+ const A = s.current, E = k.current;
10668
+ if (!A || !E || A.readyState !== A.HAVE_ENOUGH_DATA) {
10669
+ u.current = requestAnimationFrame(F);
10670
10670
  return;
10671
10671
  }
10672
- const T = performance.now();
10673
- if (T - r.current < _3) {
10674
- a.current = requestAnimationFrame(E);
10672
+ const L = performance.now();
10673
+ if (L - c.current < d2) {
10674
+ u.current = requestAnimationFrame(F);
10675
10675
  return;
10676
10676
  }
10677
- r.current = T;
10678
- const z = I.getContext("2d", { willReadFrequently: !0 });
10679
- if (!z) {
10680
- a.current = requestAnimationFrame(E);
10677
+ c.current = L;
10678
+ const D = E.getContext("2d", { willReadFrequently: !0 });
10679
+ if (!D) {
10680
+ u.current = requestAnimationFrame(F);
10681
10681
  return;
10682
10682
  }
10683
- I.width = x.videoWidth, I.height = x.videoHeight, z.drawImage(x, 0, 0, I.width, I.height);
10684
- const D = z.getImageData(0, 0, I.width, I.height), j = (0, E3.default)(D.data, D.width, D.height, { inversionAttempts: "dontInvert" });
10685
- if (j?.data && !i.current) {
10686
- i.current = !0, S();
10687
- let A = j.data.trim(), F = null;
10683
+ E.width = A.videoWidth, E.height = A.videoHeight, D.drawImage(A, 0, 0, E.width, E.height);
10684
+ const _ = D.getImageData(0, 0, E.width, E.height), Q = (0, c2.default)(_.data, _.width, _.height, { inversionAttempts: "dontInvert" });
10685
+ if (Q?.data && !m.current) {
10686
+ m.current = !0, x();
10687
+ let I = Q.data.trim(), j = null;
10688
10688
  try {
10689
- const X = JSON.parse(j.data);
10690
- X?.otp && (A = X.otp, F = X.app ?? null);
10689
+ const z = JSON.parse(Q.data);
10690
+ z?.otp && (I = z.otp, j = z.app ?? null);
10691
10691
  } catch {
10692
10692
  }
10693
- if (F !== null && F !== M) {
10694
- i.current = !1, w(`Este QR code é para o app ${F.toUpperCase()}, mas este dispositivo é ${i3[M]}. Gere um novo código no Manager.`);
10693
+ if (j !== null && j !== e) {
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
- b(A).catch(() => {
10698
- i.current = !1, c();
10697
+ i(I).catch(() => {
10698
+ m.current = !1, B();
10699
10699
  });
10700
10700
  return;
10701
10701
  }
10702
- a.current = requestAnimationFrame(E);
10702
+ u.current = requestAnimationFrame(F);
10703
10703
  };
10704
- a.current = requestAnimationFrame(E);
10704
+ u.current = requestAnimationFrame(F);
10705
10705
  }
10706
- J(() => (i.current = !1, c(), S), []), J(() => {
10707
- v && (i.current = !1, S(), c());
10708
- }, [v]);
10709
- function e() {
10710
- h(), w(null), i.current = !1, S(), c();
10706
+ Z(() => (m.current = !1, B(), x), []), Z(() => {
10707
+ o && (m.current = !1, x(), B());
10708
+ }, [o]);
10709
+ function n() {
10710
+ d(), b(null), m.current = !1, x(), B();
10711
10711
  }
10712
- const o = O || i.current, s = 288, t = Math.round(s * 0.65), f = Math.round((s - t) / 2), B = "var(--primary, #f97316)", p = "rgba(0,0,0,0.60)", P = 20;
10713
- return /* @__PURE__ */ G("div", {
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
+ return /* @__PURE__ */ U("div", {
10714
10714
  style: {
10715
10715
  display: "flex",
10716
10716
  minHeight: "100vh",
@@ -10723,7 +10723,7 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
10723
10723
  boxSizing: "border-box"
10724
10724
  },
10725
10725
  children: [
10726
- /* @__PURE__ */ G("div", {
10726
+ /* @__PURE__ */ U("div", {
10727
10727
  style: {
10728
10728
  display: "flex",
10729
10729
  flexDirection: "column",
@@ -10732,42 +10732,42 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
10732
10732
  textAlign: "center"
10733
10733
  },
10734
10734
  children: [
10735
- /* @__PURE__ */ _("div", {
10735
+ /* @__PURE__ */ T("div", {
10736
10736
  style: {
10737
10737
  borderRadius: "9999px",
10738
- background: `color-mix(in oklch, ${B} 15%, transparent)`,
10738
+ background: `color-mix(in oklch, ${P} 15%, transparent)`,
10739
10739
  padding: "1rem"
10740
10740
  },
10741
- children: /* @__PURE__ */ _(w3, { style: {
10741
+ children: /* @__PURE__ */ T(H3, { style: {
10742
10742
  width: "2.5rem",
10743
10743
  height: "2.5rem",
10744
- color: B
10744
+ color: P
10745
10745
  } })
10746
10746
  }),
10747
- /* @__PURE__ */ G("h1", {
10747
+ /* @__PURE__ */ U("h1", {
10748
10748
  style: {
10749
10749
  fontSize: "1.25rem",
10750
10750
  fontWeight: 700,
10751
10751
  margin: 0,
10752
10752
  color: "var(--foreground, #f1f5f9)"
10753
10753
  },
10754
- children: ["tabl ", /* @__PURE__ */ _("span", {
10755
- style: { color: B },
10756
- children: i3[M]
10754
+ children: ["tabl ", /* @__PURE__ */ T("span", {
10755
+ style: { color: P },
10756
+ children: M3[e]
10757
10757
  })]
10758
10758
  }),
10759
- /* @__PURE__ */ _("p", {
10759
+ /* @__PURE__ */ T("p", {
10760
10760
  style: {
10761
10761
  fontSize: "0.875rem",
10762
10762
  color: "var(--muted-foreground, #94a3b8)",
10763
10763
  maxWidth: "20rem",
10764
10764
  margin: 0
10765
10765
  },
10766
- children: L ? "Sessão encerrada pelo gerente. Escaneie um novo QR code para continuar." : "Escaneie o QR code gerado pelo Manager para autorizar este dispositivo."
10766
+ children: t ? "Sessão encerrada pelo gerente. Escaneie um novo QR code para continuar." : "Escaneie o QR code gerado pelo Manager para autorizar este dispositivo."
10767
10767
  })
10768
10768
  ]
10769
10769
  }),
10770
- L && /* @__PURE__ */ G("div", {
10770
+ t && /* @__PURE__ */ U("div", {
10771
10771
  style: {
10772
10772
  display: "flex",
10773
10773
  alignItems: "center",
@@ -10780,14 +10780,14 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
10780
10780
  color: "#d97706"
10781
10781
  },
10782
10782
  children: [
10783
- /* @__PURE__ */ _(h3, { style: {
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__ */ _("button", {
10790
- onClick: n,
10789
+ /* @__PURE__ */ T("button", {
10790
+ onClick: a,
10791
10791
  style: {
10792
10792
  marginLeft: "0.5rem",
10793
10793
  fontSize: "0.75rem",
@@ -10802,11 +10802,11 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
10802
10802
  })
10803
10803
  ]
10804
10804
  }),
10805
- /* @__PURE__ */ G("div", {
10805
+ /* @__PURE__ */ U("div", {
10806
10806
  style: {
10807
10807
  position: "relative",
10808
- width: s,
10809
- height: s,
10808
+ width: h,
10809
+ height: h,
10810
10810
  flexShrink: 0,
10811
10811
  overflow: "hidden",
10812
10812
  borderRadius: "1rem",
@@ -10814,8 +10814,8 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
10814
10814
  boxShadow: "0 20px 40px rgba(0,0,0,0.5)"
10815
10815
  },
10816
10816
  children: [
10817
- /* @__PURE__ */ _("video", {
10818
- ref: d,
10817
+ /* @__PURE__ */ T("video", {
10818
+ ref: s,
10819
10819
  style: {
10820
10820
  position: "absolute",
10821
10821
  inset: 0,
@@ -10826,113 +10826,113 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
10826
10826
  muted: !0,
10827
10827
  playsInline: !0
10828
10828
  }),
10829
- /* @__PURE__ */ _("canvas", {
10830
- ref: u,
10829
+ /* @__PURE__ */ T("canvas", {
10830
+ ref: k,
10831
10831
  style: { display: "none" }
10832
10832
  }),
10833
- m && !o && /* @__PURE__ */ G("div", {
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__ */ _("div", { style: {
10840
+ /* @__PURE__ */ T("div", { style: {
10841
10841
  position: "absolute",
10842
10842
  top: 0,
10843
10843
  left: 0,
10844
10844
  right: 0,
10845
- height: f,
10846
- background: p
10845
+ height: g,
10846
+ background: S
10847
10847
  } }),
10848
- /* @__PURE__ */ _("div", { style: {
10848
+ /* @__PURE__ */ T("div", { style: {
10849
10849
  position: "absolute",
10850
10850
  bottom: 0,
10851
10851
  left: 0,
10852
10852
  right: 0,
10853
- height: f,
10854
- background: p
10853
+ height: g,
10854
+ background: S
10855
10855
  } }),
10856
- /* @__PURE__ */ _("div", { style: {
10856
+ /* @__PURE__ */ T("div", { style: {
10857
10857
  position: "absolute",
10858
- top: f,
10858
+ top: g,
10859
10859
  left: 0,
10860
- width: f,
10861
- height: t,
10862
- background: p
10860
+ width: g,
10861
+ height: f,
10862
+ background: S
10863
10863
  } }),
10864
- /* @__PURE__ */ _("div", { style: {
10864
+ /* @__PURE__ */ T("div", { style: {
10865
10865
  position: "absolute",
10866
- top: f,
10866
+ top: g,
10867
10867
  right: 0,
10868
- width: f,
10869
- height: t,
10870
- background: p
10868
+ width: g,
10869
+ height: f,
10870
+ background: S
10871
10871
  } }),
10872
- /* @__PURE__ */ G("div", {
10872
+ /* @__PURE__ */ U("div", {
10873
10873
  style: {
10874
10874
  position: "absolute",
10875
- top: f,
10876
- left: f,
10877
- width: t,
10878
- height: t,
10875
+ top: g,
10876
+ left: g,
10877
+ width: f,
10878
+ height: f,
10879
10879
  overflow: "hidden"
10880
10880
  },
10881
10881
  children: [
10882
- /* @__PURE__ */ _("div", { style: {
10882
+ /* @__PURE__ */ T("div", { style: {
10883
10883
  position: "absolute",
10884
10884
  top: 0,
10885
10885
  left: 0,
10886
- width: P,
10887
- height: P,
10888
- borderTop: `2px solid ${B}`,
10889
- borderLeft: `2px solid ${B}`,
10886
+ width: M,
10887
+ height: M,
10888
+ borderTop: `2px solid ${P}`,
10889
+ borderLeft: `2px solid ${P}`,
10890
10890
  borderRadius: "3px 0 0 0"
10891
10891
  } }),
10892
- /* @__PURE__ */ _("div", { style: {
10892
+ /* @__PURE__ */ T("div", { style: {
10893
10893
  position: "absolute",
10894
10894
  top: 0,
10895
10895
  right: 0,
10896
- width: P,
10897
- height: P,
10898
- borderTop: `2px solid ${B}`,
10899
- borderRight: `2px solid ${B}`,
10896
+ width: M,
10897
+ height: M,
10898
+ borderTop: `2px solid ${P}`,
10899
+ borderRight: `2px solid ${P}`,
10900
10900
  borderRadius: "0 3px 0 0"
10901
10901
  } }),
10902
- /* @__PURE__ */ _("div", { style: {
10902
+ /* @__PURE__ */ T("div", { style: {
10903
10903
  position: "absolute",
10904
10904
  bottom: 0,
10905
10905
  left: 0,
10906
- width: P,
10907
- height: P,
10908
- borderBottom: `2px solid ${B}`,
10909
- borderLeft: `2px solid ${B}`,
10906
+ width: M,
10907
+ height: M,
10908
+ borderBottom: `2px solid ${P}`,
10909
+ borderLeft: `2px solid ${P}`,
10910
10910
  borderRadius: "0 0 0 3px"
10911
10911
  } }),
10912
- /* @__PURE__ */ _("div", { style: {
10912
+ /* @__PURE__ */ T("div", { style: {
10913
10913
  position: "absolute",
10914
10914
  bottom: 0,
10915
10915
  right: 0,
10916
- width: P,
10917
- height: P,
10918
- borderBottom: `2px solid ${B}`,
10919
- borderRight: `2px solid ${B}`,
10916
+ width: M,
10917
+ height: M,
10918
+ borderBottom: `2px solid ${P}`,
10919
+ borderRight: `2px solid ${P}`,
10920
10920
  borderRadius: "0 0 3px 0"
10921
10921
  } }),
10922
- /* @__PURE__ */ _("div", { style: {
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, ${B}, transparent)`,
10928
- boxShadow: `0 0 6px ${B}`,
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
- !m && !k && /* @__PURE__ */ G("div", {
10935
+ !y && !w && /* @__PURE__ */ U("div", {
10936
10936
  style: {
10937
10937
  position: "absolute",
10938
10938
  inset: 0,
@@ -10943,12 +10943,12 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
10943
10943
  gap: "0.75rem",
10944
10944
  background: "rgba(0,0,0,0.85)"
10945
10945
  },
10946
- children: [/* @__PURE__ */ _(d3, { style: {
10946
+ children: [/* @__PURE__ */ T(v3, { style: {
10947
10947
  width: "2rem",
10948
10948
  height: "2rem",
10949
- color: B,
10949
+ color: P,
10950
10950
  animation: "tabl-spin 1s linear infinite"
10951
- } }), /* @__PURE__ */ _("span", {
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 R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
10956
10956
  children: "Acessando câmera..."
10957
10957
  })]
10958
10958
  }),
10959
- o && /* @__PURE__ */ G("div", {
10959
+ l && /* @__PURE__ */ U("div", {
10960
10960
  style: {
10961
10961
  position: "absolute",
10962
10962
  inset: 0,
@@ -10967,12 +10967,12 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
10967
10967
  gap: "0.75rem",
10968
10968
  background: "rgba(0,0,0,0.75)"
10969
10969
  },
10970
- children: [/* @__PURE__ */ _(d3, { style: {
10970
+ children: [/* @__PURE__ */ T(v3, { style: {
10971
10971
  width: "2.5rem",
10972
10972
  height: "2.5rem",
10973
- color: B,
10973
+ color: P,
10974
10974
  animation: "tabl-spin 1s linear infinite"
10975
- } }), /* @__PURE__ */ _("span", {
10975
+ } }), /* @__PURE__ */ T("span", {
10976
10976
  style: {
10977
10977
  fontSize: "0.875rem",
10978
10978
  fontWeight: 500,
@@ -10983,7 +10983,7 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
10983
10983
  })
10984
10984
  ]
10985
10985
  }),
10986
- (k || v) && /* @__PURE__ */ G("div", {
10986
+ (w || o) && /* @__PURE__ */ U("div", {
10987
10987
  style: {
10988
10988
  display: "flex",
10989
10989
  flexDirection: "column",
@@ -10996,15 +10996,15 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
10996
10996
  maxWidth: "20rem",
10997
10997
  boxSizing: "border-box"
10998
10998
  },
10999
- children: [/* @__PURE__ */ _("p", {
10999
+ children: [/* @__PURE__ */ T("p", {
11000
11000
  style: {
11001
11001
  fontSize: "0.875rem",
11002
11002
  color: "#ef4444",
11003
11003
  margin: 0
11004
11004
  },
11005
- children: k ?? v
11006
- }), /* @__PURE__ */ _("button", {
11007
- onClick: e,
11005
+ children: w ?? o
11006
+ }), /* @__PURE__ */ T("button", {
11007
+ onClick: n,
11008
11008
  style: {
11009
11009
  alignSelf: "flex-end",
11010
11010
  fontSize: "0.75rem",
@@ -11018,7 +11018,7 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
11018
11018
  children: "Tentar novamente"
11019
11019
  })]
11020
11020
  }),
11021
- /* @__PURE__ */ _("style", { children: `
11021
+ /* @__PURE__ */ T("style", { children: `
11022
11022
  @keyframes tabl-scan {
11023
11023
  0% { top: 0px; }
11024
11024
  50% { top: calc(100% - 2px); }
@@ -11032,26 +11032,1427 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
11032
11032
  ]
11033
11033
  });
11034
11034
  }
11035
- function K3(M) {
11036
- const { url: L, anonKey: O, realtimeEventsPerSecond: v = 10 } = M;
11037
- if (!L || !O) throw new Error("[tabl.io/auth] VITE_TABL_SERVER_URL e VITE_TABL_SERVER_ANON_KEY são obrigatórios.");
11038
- return P3(L, O, {
11035
+ function Y2(e) {
11036
+ const { url: t, anonKey: r, realtimeEventsPerSecond: o = 10 } = e;
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
+ return W3(t, r, {
11039
11039
  auth: {
11040
11040
  persistSession: !0,
11041
11041
  autoRefreshToken: !0
11042
11042
  },
11043
- realtime: { params: { eventsPerSecond: v } }
11043
+ realtime: { params: { eventsPerSecond: o } }
11044
+ });
11045
+ }
11046
+ var k3 = class {
11047
+ constructor() {
11048
+ this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
11049
+ }
11050
+ subscribe(e) {
11051
+ return this.listeners.add(e), this.onSubscribe(), () => {
11052
+ this.listeners.delete(e), this.onUnsubscribe();
11053
+ };
11054
+ }
11055
+ hasListeners() {
11056
+ return this.listeners.size > 0;
11057
+ }
11058
+ onSubscribe() {
11059
+ }
11060
+ onUnsubscribe() {
11061
+ }
11062
+ }, f2 = {
11063
+ setTimeout: (e, t) => setTimeout(e, t),
11064
+ clearTimeout: (e) => clearTimeout(e),
11065
+ setInterval: (e, t) => setInterval(e, t),
11066
+ clearInterval: (e) => clearInterval(e)
11067
+ }, h2 = class {
11068
+ #e = f2;
11069
+ #t = !1;
11070
+ setTimeoutProvider(e) {
11071
+ process.env.NODE_ENV !== "production" && this.#t && e !== this.#e && console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.", {
11072
+ previous: this.#e,
11073
+ provider: e
11074
+ }), this.#e = e, process.env.NODE_ENV !== "production" && (this.#t = !1);
11075
+ }
11076
+ setTimeout(e, t) {
11077
+ return process.env.NODE_ENV !== "production" && (this.#t = !0), this.#e.setTimeout(e, t);
11078
+ }
11079
+ clearTimeout(e) {
11080
+ this.#e.clearTimeout(e);
11081
+ }
11082
+ setInterval(e, t) {
11083
+ return process.env.NODE_ENV !== "production" && (this.#t = !0), this.#e.setInterval(e, t);
11084
+ }
11085
+ clearInterval(e) {
11086
+ this.#e.clearInterval(e);
11087
+ }
11088
+ }, C3 = new h2();
11089
+ function k2(e) {
11090
+ setTimeout(e, 0);
11091
+ }
11092
+ var B3 = typeof window > "u" || "Deno" in globalThis;
11093
+ function X() {
11094
+ }
11095
+ function B2(e, t) {
11096
+ return typeof e == "function" ? e(t) : e;
11097
+ }
11098
+ function m2(e) {
11099
+ return typeof e == "number" && e >= 0 && e !== 1 / 0;
11100
+ }
11101
+ function v2(e, t) {
11102
+ return Math.max(e + (t || 0) - Date.now(), 0);
11103
+ }
11104
+ function w3(e, t) {
11105
+ return typeof e == "function" ? e(t) : e;
11106
+ }
11107
+ function C2(e, t) {
11108
+ return typeof e == "function" ? e(t) : e;
11109
+ }
11110
+ function S3(e, t) {
11111
+ const { type: r = "all", exact: o, fetchStatus: i, predicate: d, queryKey: a, stale: s } = e;
11112
+ if (a) {
11113
+ if (o) {
11114
+ if (t.queryHash !== g3(a, t.options)) return !1;
11115
+ } else if (!a3(t.queryKey, a)) return !1;
11116
+ }
11117
+ if (r !== "all") {
11118
+ const k = t.isActive();
11119
+ if (r === "active" && !k || r === "inactive" && k) return !1;
11120
+ }
11121
+ return !(typeof s == "boolean" && t.isStale() !== s || i && i !== t.state.fetchStatus || d && !d(t));
11122
+ }
11123
+ function O3(e, t) {
11124
+ const { exact: r, status: o, predicate: i, mutationKey: d } = e;
11125
+ if (d) {
11126
+ if (!t.options.mutationKey) return !1;
11127
+ if (r) {
11128
+ if (n3(t.options.mutationKey) !== n3(d)) return !1;
11129
+ } else if (!a3(t.options.mutationKey, d)) return !1;
11130
+ }
11131
+ return !(o && t.state.status !== o || i && !i(t));
11132
+ }
11133
+ function g3(e, t) {
11134
+ return (t?.queryKeyHashFn || n3)(e);
11135
+ }
11136
+ function n3(e) {
11137
+ return JSON.stringify(e, (t, r) => P3(r) ? Object.keys(r).sort().reduce((o, i) => (o[i] = r[i], o), {}) : r);
11138
+ }
11139
+ function a3(e, t) {
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
+ }
11142
+ var w2 = Object.prototype.hasOwnProperty;
11143
+ function y3(e, t, r = 0) {
11144
+ if (e === t) return e;
11145
+ if (r > 500) return t;
11146
+ const o = x3(e) && x3(t);
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
+ let k = 0;
11150
+ for (let p = 0; p < a; p++) {
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
+ continue;
11155
+ }
11156
+ if (c === null || m === null || typeof c != "object" || typeof m != "object") {
11157
+ s[u] = m;
11158
+ continue;
11159
+ }
11160
+ const v = y3(c, m, r + 1);
11161
+ s[u] = v, v === c && k++;
11162
+ }
11163
+ return i === a && k === i ? e : s;
11164
+ }
11165
+ function x3(e) {
11166
+ return Array.isArray(e) && e.length === Object.keys(e).length;
11167
+ }
11168
+ function P3(e) {
11169
+ if (!A3(e)) return !1;
11170
+ const t = e.constructor;
11171
+ if (t === void 0) return !0;
11172
+ const r = t.prototype;
11173
+ return !(!A3(r) || !r.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
11174
+ }
11175
+ function A3(e) {
11176
+ return Object.prototype.toString.call(e) === "[object Object]";
11177
+ }
11178
+ function y2(e) {
11179
+ return new Promise((t) => {
11180
+ C3.setTimeout(t, e);
11181
+ });
11182
+ }
11183
+ function P2(e, t, r) {
11184
+ if (typeof r.structuralSharing == "function") return r.structuralSharing(e, t);
11185
+ if (r.structuralSharing !== !1) {
11186
+ if (process.env.NODE_ENV !== "production") try {
11187
+ return y3(e, t);
11188
+ } catch (o) {
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
+ }
11191
+ return y3(e, t);
11192
+ }
11193
+ return t;
11194
+ }
11195
+ function p2(e, t, r = 0) {
11196
+ const o = [...e, t];
11197
+ return r && o.length > r ? o.slice(1) : o;
11198
+ }
11199
+ function g2(e, t, r = 0) {
11200
+ const o = [t, ...e];
11201
+ return r && o.length > r ? o.slice(0, -1) : o;
11202
+ }
11203
+ var f3 = /* @__PURE__ */ Symbol();
11204
+ function j3(e, t) {
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
+ }
11207
+ function b2(e, t, r) {
11208
+ let o = !1, i;
11209
+ return Object.defineProperty(e, "signal", {
11210
+ enumerable: !0,
11211
+ get: () => (i ??= t(), o || (o = !0, i.aborted ? r() : i.addEventListener("abort", r, { once: !0 })), i)
11212
+ }), e;
11213
+ }
11214
+ var M2 = class extends k3 {
11215
+ #e;
11216
+ #t;
11217
+ #r;
11218
+ constructor() {
11219
+ super(), this.#r = (e) => {
11220
+ if (!B3 && window.addEventListener) {
11221
+ const t = () => e();
11222
+ return window.addEventListener("visibilitychange", t, !1), () => {
11223
+ window.removeEventListener("visibilitychange", t);
11224
+ };
11225
+ }
11226
+ };
11227
+ }
11228
+ onSubscribe() {
11229
+ this.#t || this.setEventListener(this.#r);
11230
+ }
11231
+ onUnsubscribe() {
11232
+ this.hasListeners() || (this.#t?.(), this.#t = void 0);
11233
+ }
11234
+ setEventListener(e) {
11235
+ this.#r = e, this.#t?.(), this.#t = e((t) => {
11236
+ typeof t == "boolean" ? this.setFocused(t) : this.onFocus();
11237
+ });
11238
+ }
11239
+ setFocused(e) {
11240
+ this.#e !== e && (this.#e = e, this.onFocus());
11241
+ }
11242
+ onFocus() {
11243
+ const e = this.isFocused();
11244
+ this.listeners.forEach((t) => {
11245
+ t(e);
11246
+ });
11247
+ }
11248
+ isFocused() {
11249
+ return typeof this.#e == "boolean" ? this.#e : globalThis.document?.visibilityState !== "hidden";
11250
+ }
11251
+ }, Q3 = new M2();
11252
+ function S2() {
11253
+ let e, t;
11254
+ const r = new Promise((i, d) => {
11255
+ e = i, t = d;
11256
+ });
11257
+ r.status = "pending", r.catch(() => {
11044
11258
  });
11259
+ function o(i) {
11260
+ Object.assign(r, i), delete r.resolve, delete r.reject;
11261
+ }
11262
+ return r.resolve = (i) => {
11263
+ o({
11264
+ status: "fulfilled",
11265
+ value: i
11266
+ }), e(i);
11267
+ }, r.reject = (i) => {
11268
+ o({
11269
+ status: "rejected",
11270
+ reason: i
11271
+ }), t(i);
11272
+ }, r;
11273
+ }
11274
+ var O2 = k2;
11275
+ function x2() {
11276
+ let e = [], t = 0, r = (s) => {
11277
+ s();
11278
+ }, o = (s) => {
11279
+ s();
11280
+ }, i = O2;
11281
+ const d = (s) => {
11282
+ t ? e.push(s) : i(() => {
11283
+ r(s);
11284
+ });
11285
+ }, a = () => {
11286
+ const s = e;
11287
+ e = [], s.length && i(() => {
11288
+ o(() => {
11289
+ s.forEach((k) => {
11290
+ r(k);
11291
+ });
11292
+ });
11293
+ });
11294
+ };
11295
+ return {
11296
+ batch: (s) => {
11297
+ let k;
11298
+ t++;
11299
+ try {
11300
+ k = s();
11301
+ } finally {
11302
+ t--, t || a();
11303
+ }
11304
+ return k;
11305
+ },
11306
+ batchCalls: (s) => (...k) => {
11307
+ d(() => {
11308
+ s(...k);
11309
+ });
11310
+ },
11311
+ schedule: d,
11312
+ setNotifyFunction: (s) => {
11313
+ r = s;
11314
+ },
11315
+ setBatchNotifyFunction: (s) => {
11316
+ o = s;
11317
+ },
11318
+ setScheduler: (s) => {
11319
+ i = s;
11320
+ }
11321
+ };
11045
11322
  }
11323
+ var K = x2(), A2 = class extends k3 {
11324
+ #e = !0;
11325
+ #t;
11326
+ #r;
11327
+ constructor() {
11328
+ super(), this.#r = (e) => {
11329
+ if (!B3 && window.addEventListener) {
11330
+ const t = () => e(!0), r = () => e(!1);
11331
+ return window.addEventListener("online", t, !1), window.addEventListener("offline", r, !1), () => {
11332
+ window.removeEventListener("online", t), window.removeEventListener("offline", r);
11333
+ };
11334
+ }
11335
+ };
11336
+ }
11337
+ onSubscribe() {
11338
+ this.#t || this.setEventListener(this.#r);
11339
+ }
11340
+ onUnsubscribe() {
11341
+ this.hasListeners() || (this.#t?.(), this.#t = void 0);
11342
+ }
11343
+ setEventListener(e) {
11344
+ this.#r = e, this.#t?.(), this.#t = e(this.setOnline.bind(this));
11345
+ }
11346
+ setOnline(e) {
11347
+ this.#e !== e && (this.#e = e, this.listeners.forEach((t) => {
11348
+ t(e);
11349
+ }));
11350
+ }
11351
+ isOnline() {
11352
+ return this.#e;
11353
+ }
11354
+ }, h3 = new A2();
11355
+ function E2(e) {
11356
+ return Math.min(1e3 * 2 ** e, 3e4);
11357
+ }
11358
+ function z3(e) {
11359
+ return (e ?? "online") === "online" ? h3.isOnline() : !0;
11360
+ }
11361
+ var p3 = class extends Error {
11362
+ constructor(e) {
11363
+ super("CancelledError"), this.revert = e?.revert, this.silent = e?.silent;
11364
+ }
11365
+ };
11366
+ function U3(e) {
11367
+ let t = !1, r = 0, o;
11368
+ const i = S2(), d = () => i.status !== "pending", a = (C) => {
11369
+ if (!d()) {
11370
+ const w = new p3(C);
11371
+ m(w), e.onCancel?.(w);
11372
+ }
11373
+ }, s = () => {
11374
+ t = !0;
11375
+ }, k = () => {
11376
+ t = !1;
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
+ }, m = (C) => {
11380
+ d() || (o?.(), i.reject(C));
11381
+ }, v = () => new Promise((C) => {
11382
+ o = (w) => {
11383
+ (d() || p()) && C(w);
11384
+ }, e.onPause?.();
11385
+ }).then(() => {
11386
+ o = void 0, d() || e.onContinue?.();
11387
+ }), y = () => {
11388
+ if (d()) return;
11389
+ let C;
11390
+ const w = r === 0 ? e.initialPromise : void 0;
11391
+ try {
11392
+ C = w ?? e.fn();
11393
+ } catch (b) {
11394
+ C = Promise.reject(b);
11395
+ }
11396
+ Promise.resolve(C).then(c).catch((b) => {
11397
+ if (d()) return;
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
+ m(b);
11401
+ return;
11402
+ }
11403
+ r++, e.onFail?.(r, b), y2(n).then(() => p() ? void 0 : v()).then(() => {
11404
+ t ? m(b) : y();
11405
+ });
11406
+ });
11407
+ };
11408
+ return {
11409
+ promise: i,
11410
+ status: () => i.status,
11411
+ cancel: a,
11412
+ continue: () => (o?.(), i),
11413
+ cancelRetry: s,
11414
+ continueRetry: k,
11415
+ canStart: u,
11416
+ start: () => (u() ? y() : v().then(y), i)
11417
+ };
11418
+ }
11419
+ var G3 = class {
11420
+ #e;
11421
+ destroy() {
11422
+ this.clearGcTimeout();
11423
+ }
11424
+ scheduleGc() {
11425
+ this.clearGcTimeout(), m2(this.gcTime) && (this.#e = C3.setTimeout(() => {
11426
+ this.optionalRemove();
11427
+ }, this.gcTime));
11428
+ }
11429
+ updateGcTime(e) {
11430
+ this.gcTime = Math.max(this.gcTime || 0, e ?? (B3 ? 1 / 0 : 300 * 1e3));
11431
+ }
11432
+ clearGcTimeout() {
11433
+ this.#e && (C3.clearTimeout(this.#e), this.#e = void 0);
11434
+ }
11435
+ }, I2 = class extends G3 {
11436
+ #e;
11437
+ #t;
11438
+ #r;
11439
+ #s;
11440
+ #o;
11441
+ #a;
11442
+ #i;
11443
+ constructor(e) {
11444
+ super(), this.#i = !1, this.#a = e.defaultOptions, this.setOptions(e.options), this.observers = [], this.#s = e.client, this.#r = this.#s.getQueryCache(), this.queryKey = e.queryKey, this.queryHash = e.queryHash, this.#e = I3(this.options), this.state = e.state ?? this.#e, this.scheduleGc();
11445
+ }
11446
+ get meta() {
11447
+ return this.options.meta;
11448
+ }
11449
+ get promise() {
11450
+ return this.#o?.promise;
11451
+ }
11452
+ setOptions(e) {
11453
+ if (this.options = {
11454
+ ...this.#a,
11455
+ ...e
11456
+ }, this.updateGcTime(this.options.gcTime), this.state && this.state.data === void 0) {
11457
+ const t = I3(this.options);
11458
+ t.data !== void 0 && (this.setState(E3(t.data, t.dataUpdatedAt)), this.#e = t);
11459
+ }
11460
+ }
11461
+ optionalRemove() {
11462
+ !this.observers.length && this.state.fetchStatus === "idle" && this.#r.remove(this);
11463
+ }
11464
+ setData(e, t) {
11465
+ const r = P2(this.state.data, e, this.options);
11466
+ return this.#n({
11467
+ data: r,
11468
+ type: "success",
11469
+ dataUpdatedAt: t?.updatedAt,
11470
+ manual: t?.manual
11471
+ }), r;
11472
+ }
11473
+ setState(e, t) {
11474
+ this.#n({
11475
+ type: "setState",
11476
+ state: e,
11477
+ setStateOptions: t
11478
+ });
11479
+ }
11480
+ cancel(e) {
11481
+ const t = this.#o?.promise;
11482
+ return this.#o?.cancel(e), t ? t.then(X).catch(X) : Promise.resolve();
11483
+ }
11484
+ destroy() {
11485
+ super.destroy(), this.cancel({ silent: !0 });
11486
+ }
11487
+ reset() {
11488
+ this.destroy(), this.setState(this.#e);
11489
+ }
11490
+ isActive() {
11491
+ return this.observers.some((e) => C2(e.options.enabled, this) !== !1);
11492
+ }
11493
+ isDisabled() {
11494
+ return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn === f3 || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
11495
+ }
11496
+ isStatic() {
11497
+ return this.getObserversCount() > 0 ? this.observers.some((e) => w3(e.options.staleTime, this) === "static") : !1;
11498
+ }
11499
+ isStale() {
11500
+ return this.getObserversCount() > 0 ? this.observers.some((e) => e.getCurrentResult().isStale) : this.state.data === void 0 || this.state.isInvalidated;
11501
+ }
11502
+ isStaleByTime(e = 0) {
11503
+ return this.state.data === void 0 ? !0 : e === "static" ? !1 : this.state.isInvalidated ? !0 : !v2(this.state.dataUpdatedAt, e);
11504
+ }
11505
+ onFocus() {
11506
+ this.observers.find((e) => e.shouldFetchOnWindowFocus())?.refetch({ cancelRefetch: !1 }), this.#o?.continue();
11507
+ }
11508
+ onOnline() {
11509
+ this.observers.find((e) => e.shouldFetchOnReconnect())?.refetch({ cancelRefetch: !1 }), this.#o?.continue();
11510
+ }
11511
+ addObserver(e) {
11512
+ this.observers.includes(e) || (this.observers.push(e), this.clearGcTimeout(), this.#r.notify({
11513
+ type: "observerAdded",
11514
+ query: this,
11515
+ observer: e
11516
+ }));
11517
+ }
11518
+ removeObserver(e) {
11519
+ this.observers.includes(e) && (this.observers = this.observers.filter((t) => t !== e), this.observers.length || (this.#o && (this.#i ? this.#o.cancel({ revert: !0 }) : this.#o.cancelRetry()), this.scheduleGc()), this.#r.notify({
11520
+ type: "observerRemoved",
11521
+ query: this,
11522
+ observer: e
11523
+ }));
11524
+ }
11525
+ getObserversCount() {
11526
+ return this.observers.length;
11527
+ }
11528
+ invalidate() {
11529
+ this.state.isInvalidated || this.#n({ type: "invalidate" });
11530
+ }
11531
+ async fetch(e, t) {
11532
+ if (this.state.fetchStatus !== "idle" && this.#o?.status() !== "rejected") {
11533
+ if (this.state.data !== void 0 && t?.cancelRefetch) this.cancel({ silent: !0 });
11534
+ else if (this.#o)
11535
+ return this.#o.continueRetry(), this.#o.promise;
11536
+ }
11537
+ if (e && this.setOptions(e), !this.options.queryFn) {
11538
+ const s = this.observers.find((k) => k.options.queryFn);
11539
+ s && this.setOptions(s.options);
11540
+ }
11541
+ process.env.NODE_ENV !== "production" && (Array.isArray(this.options.queryKey) || console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));
11542
+ const r = new AbortController(), o = (s) => {
11543
+ Object.defineProperty(s, "signal", {
11544
+ enumerable: !0,
11545
+ get: () => (this.#i = !0, r.signal)
11546
+ });
11547
+ }, i = () => {
11548
+ const s = j3(this.options, t), p = (() => {
11549
+ const u = {
11550
+ client: this.#s,
11551
+ queryKey: this.queryKey,
11552
+ meta: this.meta
11553
+ };
11554
+ return o(u), u;
11555
+ })();
11556
+ return this.#i = !1, this.options.persister ? this.options.persister(s, p, this) : s(p);
11557
+ }, a = (() => {
11558
+ const s = {
11559
+ fetchOptions: t,
11560
+ options: this.options,
11561
+ queryKey: this.queryKey,
11562
+ client: this.#s,
11563
+ state: this.state,
11564
+ fetchFn: i
11565
+ };
11566
+ return o(s), s;
11567
+ })();
11568
+ this.options.behavior?.onFetch(a, this), this.#t = this.state, (this.state.fetchStatus === "idle" || this.state.fetchMeta !== a.fetchOptions?.meta) && this.#n({
11569
+ type: "fetch",
11570
+ meta: a.fetchOptions?.meta
11571
+ }), this.#o = U3({
11572
+ initialPromise: t?.initialPromise,
11573
+ fn: a.fetchFn,
11574
+ onCancel: (s) => {
11575
+ s instanceof p3 && s.revert && this.setState({
11576
+ ...this.#t,
11577
+ fetchStatus: "idle"
11578
+ }), r.abort();
11579
+ },
11580
+ onFail: (s, k) => {
11581
+ this.#n({
11582
+ type: "failed",
11583
+ failureCount: s,
11584
+ error: k
11585
+ });
11586
+ },
11587
+ onPause: () => {
11588
+ this.#n({ type: "pause" });
11589
+ },
11590
+ onContinue: () => {
11591
+ this.#n({ type: "continue" });
11592
+ },
11593
+ retry: a.options.retry,
11594
+ retryDelay: a.options.retryDelay,
11595
+ networkMode: a.options.networkMode,
11596
+ canRun: () => !0
11597
+ });
11598
+ try {
11599
+ const s = await this.#o.start();
11600
+ if (s === void 0)
11601
+ throw process.env.NODE_ENV !== "production" && console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`), new Error(`${this.queryHash} data is undefined`);
11602
+ return this.setData(s), this.#r.config.onSuccess?.(s, this), this.#r.config.onSettled?.(s, this.state.error, this), s;
11603
+ } catch (s) {
11604
+ if (s instanceof p3) {
11605
+ if (s.silent) return this.#o.promise;
11606
+ if (s.revert) {
11607
+ if (this.state.data === void 0) throw s;
11608
+ return this.state.data;
11609
+ }
11610
+ }
11611
+ throw this.#n({
11612
+ type: "error",
11613
+ error: s
11614
+ }), this.#r.config.onError?.(s, this), this.#r.config.onSettled?.(this.state.data, s, this), s;
11615
+ } finally {
11616
+ this.scheduleGc();
11617
+ }
11618
+ }
11619
+ #n(e) {
11620
+ const t = (r) => {
11621
+ switch (e.type) {
11622
+ case "failed":
11623
+ return {
11624
+ ...r,
11625
+ fetchFailureCount: e.failureCount,
11626
+ fetchFailureReason: e.error
11627
+ };
11628
+ case "pause":
11629
+ return {
11630
+ ...r,
11631
+ fetchStatus: "paused"
11632
+ };
11633
+ case "continue":
11634
+ return {
11635
+ ...r,
11636
+ fetchStatus: "fetching"
11637
+ };
11638
+ case "fetch":
11639
+ return {
11640
+ ...r,
11641
+ ...N2(r.data, this.options),
11642
+ fetchMeta: e.meta ?? null
11643
+ };
11644
+ case "success":
11645
+ const o = {
11646
+ ...r,
11647
+ ...E3(e.data, e.dataUpdatedAt),
11648
+ dataUpdateCount: r.dataUpdateCount + 1,
11649
+ ...!e.manual && {
11650
+ fetchStatus: "idle",
11651
+ fetchFailureCount: 0,
11652
+ fetchFailureReason: null
11653
+ }
11654
+ };
11655
+ return this.#t = e.manual ? o : void 0, o;
11656
+ case "error":
11657
+ const i = e.error;
11658
+ return {
11659
+ ...r,
11660
+ error: i,
11661
+ errorUpdateCount: r.errorUpdateCount + 1,
11662
+ errorUpdatedAt: Date.now(),
11663
+ fetchFailureCount: r.fetchFailureCount + 1,
11664
+ fetchFailureReason: i,
11665
+ fetchStatus: "idle",
11666
+ status: "error",
11667
+ isInvalidated: !0
11668
+ };
11669
+ case "invalidate":
11670
+ return {
11671
+ ...r,
11672
+ isInvalidated: !0
11673
+ };
11674
+ case "setState":
11675
+ return {
11676
+ ...r,
11677
+ ...e.state
11678
+ };
11679
+ }
11680
+ };
11681
+ this.state = t(this.state), K.batch(() => {
11682
+ this.observers.forEach((r) => {
11683
+ r.onQueryUpdate();
11684
+ }), this.#r.notify({
11685
+ query: this,
11686
+ type: "updated",
11687
+ action: e
11688
+ });
11689
+ });
11690
+ }
11691
+ };
11692
+ function N2(e, t) {
11693
+ return {
11694
+ fetchFailureCount: 0,
11695
+ fetchFailureReason: null,
11696
+ fetchStatus: z3(t.networkMode) ? "fetching" : "paused",
11697
+ ...e === void 0 && {
11698
+ error: null,
11699
+ status: "pending"
11700
+ }
11701
+ };
11702
+ }
11703
+ function E3(e, t) {
11704
+ return {
11705
+ data: e,
11706
+ dataUpdatedAt: t ?? Date.now(),
11707
+ error: null,
11708
+ isInvalidated: !1,
11709
+ status: "success"
11710
+ };
11711
+ }
11712
+ function I3(e) {
11713
+ const t = typeof e.initialData == "function" ? e.initialData() : e.initialData, r = t !== void 0, o = r ? typeof e.initialDataUpdatedAt == "function" ? e.initialDataUpdatedAt() : e.initialDataUpdatedAt : 0;
11714
+ return {
11715
+ data: t,
11716
+ dataUpdateCount: 0,
11717
+ dataUpdatedAt: r ? o ?? Date.now() : 0,
11718
+ error: null,
11719
+ errorUpdateCount: 0,
11720
+ errorUpdatedAt: 0,
11721
+ fetchFailureCount: 0,
11722
+ fetchFailureReason: null,
11723
+ fetchMeta: null,
11724
+ isInvalidated: !1,
11725
+ status: r ? "success" : "pending",
11726
+ fetchStatus: "idle"
11727
+ };
11728
+ }
11729
+ function N3(e) {
11730
+ return { onFetch: (t, r) => {
11731
+ const o = t.options, i = t.fetchOptions?.meta?.fetchMore?.direction, d = t.state.data?.pages || [], a = t.state.data?.pageParams || [];
11732
+ let s = {
11733
+ pages: [],
11734
+ pageParams: []
11735
+ }, k = 0;
11736
+ const p = async () => {
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
+ const x = await m((() => {
11744
+ const l = {
11745
+ client: t.client,
11746
+ queryKey: t.queryKey,
11747
+ pageParam: C,
11748
+ direction: w ? "backward" : "forward",
11749
+ meta: t.options.meta
11750
+ };
11751
+ return c(l), l;
11752
+ })()), { maxPages: B } = t.options, n = w ? g2 : p2;
11753
+ return {
11754
+ pages: n(y.pages, x, B),
11755
+ pageParams: n(y.pageParams, C, B)
11756
+ };
11757
+ };
11758
+ if (i && d.length) {
11759
+ const y = i === "backward", C = y ? F2 : F3, w = {
11760
+ pages: d,
11761
+ pageParams: a
11762
+ };
11763
+ s = await v(w, C(o, w), y);
11764
+ } else {
11765
+ const y = e ?? d.length;
11766
+ do {
11767
+ const C = k === 0 ? a[0] ?? o.initialPageParam : F3(o, s);
11768
+ if (k > 0 && C == null) break;
11769
+ s = await v(s, C), k++;
11770
+ } while (k < y);
11771
+ }
11772
+ return s;
11773
+ };
11774
+ t.options.persister ? t.fetchFn = () => t.options.persister?.(p, {
11775
+ client: t.client,
11776
+ queryKey: t.queryKey,
11777
+ meta: t.options.meta,
11778
+ signal: t.signal
11779
+ }, r) : t.fetchFn = p;
11780
+ } };
11781
+ }
11782
+ function F3(e, { pages: t, pageParams: r }) {
11783
+ const o = t.length - 1;
11784
+ return t.length > 0 ? e.getNextPageParam(t[o], t, r[o], r) : void 0;
11785
+ }
11786
+ function F2(e, { pages: t, pageParams: r }) {
11787
+ return t.length > 0 ? e.getPreviousPageParam?.(t[0], t, r[0], r) : void 0;
11788
+ }
11789
+ var T2 = class extends G3 {
11790
+ #e;
11791
+ #t;
11792
+ #r;
11793
+ #s;
11794
+ constructor(e) {
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
+ }
11797
+ setOptions(e) {
11798
+ this.options = e, this.updateGcTime(this.options.gcTime);
11799
+ }
11800
+ get meta() {
11801
+ return this.options.meta;
11802
+ }
11803
+ addObserver(e) {
11804
+ this.#t.includes(e) || (this.#t.push(e), this.clearGcTimeout(), this.#r.notify({
11805
+ type: "observerAdded",
11806
+ mutation: this,
11807
+ observer: e
11808
+ }));
11809
+ }
11810
+ removeObserver(e) {
11811
+ this.#t = this.#t.filter((t) => t !== e), this.scheduleGc(), this.#r.notify({
11812
+ type: "observerRemoved",
11813
+ mutation: this,
11814
+ observer: e
11815
+ });
11816
+ }
11817
+ optionalRemove() {
11818
+ this.#t.length || (this.state.status === "pending" ? this.scheduleGc() : this.#r.remove(this));
11819
+ }
11820
+ continue() {
11821
+ return this.#s?.continue() ?? this.execute(this.state.variables);
11822
+ }
11823
+ async execute(e) {
11824
+ const t = () => {
11825
+ this.#o({ type: "continue" });
11826
+ }, r = {
11827
+ client: this.#e,
11828
+ meta: this.options.meta,
11829
+ mutationKey: this.options.mutationKey
11830
+ };
11831
+ this.#s = U3({
11832
+ fn: () => this.options.mutationFn ? this.options.mutationFn(e, r) : Promise.reject(/* @__PURE__ */ new Error("No mutationFn found")),
11833
+ onFail: (d, a) => {
11834
+ this.#o({
11835
+ type: "failed",
11836
+ failureCount: d,
11837
+ error: a
11838
+ });
11839
+ },
11840
+ onPause: () => {
11841
+ this.#o({ type: "pause" });
11842
+ },
11843
+ onContinue: t,
11844
+ retry: this.options.retry ?? 0,
11845
+ retryDelay: this.options.retryDelay,
11846
+ networkMode: this.options.networkMode,
11847
+ canRun: () => this.#r.canRun(this)
11848
+ });
11849
+ const o = this.state.status === "pending", i = !this.#s.canStart();
11850
+ try {
11851
+ if (o) t();
11852
+ else {
11853
+ this.#o({
11854
+ type: "pending",
11855
+ variables: e,
11856
+ isPaused: i
11857
+ }), this.#r.config.onMutate && await this.#r.config.onMutate(e, this, r);
11858
+ const a = await this.options.onMutate?.(e, r);
11859
+ a !== this.state.context && this.#o({
11860
+ type: "pending",
11861
+ context: a,
11862
+ variables: e,
11863
+ isPaused: i
11864
+ });
11865
+ }
11866
+ const d = await this.#s.start();
11867
+ return await this.#r.config.onSuccess?.(d, e, this.state.context, this, r), await this.options.onSuccess?.(d, e, this.state.context, r), await this.#r.config.onSettled?.(d, null, this.state.variables, this.state.context, this, r), await this.options.onSettled?.(d, null, e, this.state.context, r), this.#o({
11868
+ type: "success",
11869
+ data: d
11870
+ }), d;
11871
+ } catch (d) {
11872
+ try {
11873
+ await this.#r.config.onError?.(d, e, this.state.context, this, r);
11874
+ } catch (a) {
11875
+ Promise.reject(a);
11876
+ }
11877
+ try {
11878
+ await this.options.onError?.(d, e, this.state.context, r);
11879
+ } catch (a) {
11880
+ Promise.reject(a);
11881
+ }
11882
+ try {
11883
+ await this.#r.config.onSettled?.(void 0, d, this.state.variables, this.state.context, this, r);
11884
+ } catch (a) {
11885
+ Promise.reject(a);
11886
+ }
11887
+ try {
11888
+ await this.options.onSettled?.(void 0, d, e, this.state.context, r);
11889
+ } catch (a) {
11890
+ Promise.reject(a);
11891
+ }
11892
+ throw this.#o({
11893
+ type: "error",
11894
+ error: d
11895
+ }), d;
11896
+ } finally {
11897
+ this.#r.runNext(this);
11898
+ }
11899
+ }
11900
+ #o(e) {
11901
+ const t = (r) => {
11902
+ switch (e.type) {
11903
+ case "failed":
11904
+ return {
11905
+ ...r,
11906
+ failureCount: e.failureCount,
11907
+ failureReason: e.error
11908
+ };
11909
+ case "pause":
11910
+ return {
11911
+ ...r,
11912
+ isPaused: !0
11913
+ };
11914
+ case "continue":
11915
+ return {
11916
+ ...r,
11917
+ isPaused: !1
11918
+ };
11919
+ case "pending":
11920
+ return {
11921
+ ...r,
11922
+ context: e.context,
11923
+ data: void 0,
11924
+ failureCount: 0,
11925
+ failureReason: null,
11926
+ error: null,
11927
+ isPaused: e.isPaused,
11928
+ status: "pending",
11929
+ variables: e.variables,
11930
+ submittedAt: Date.now()
11931
+ };
11932
+ case "success":
11933
+ return {
11934
+ ...r,
11935
+ data: e.data,
11936
+ failureCount: 0,
11937
+ failureReason: null,
11938
+ error: null,
11939
+ status: "success",
11940
+ isPaused: !1
11941
+ };
11942
+ case "error":
11943
+ return {
11944
+ ...r,
11945
+ data: void 0,
11946
+ error: e.error,
11947
+ failureCount: r.failureCount + 1,
11948
+ failureReason: e.error,
11949
+ isPaused: !1,
11950
+ status: "error"
11951
+ };
11952
+ }
11953
+ };
11954
+ this.state = t(this.state), K.batch(() => {
11955
+ this.#t.forEach((r) => {
11956
+ r.onMutationUpdate(e);
11957
+ }), this.#r.notify({
11958
+ mutation: this,
11959
+ type: "updated",
11960
+ action: e
11961
+ });
11962
+ });
11963
+ }
11964
+ };
11965
+ function R2() {
11966
+ return {
11967
+ context: void 0,
11968
+ data: void 0,
11969
+ error: null,
11970
+ failureCount: 0,
11971
+ failureReason: null,
11972
+ isPaused: !1,
11973
+ status: "idle",
11974
+ variables: void 0,
11975
+ submittedAt: 0
11976
+ };
11977
+ }
11978
+ var L2 = class extends k3 {
11979
+ constructor(e = {}) {
11980
+ super(), this.config = e, this.#e = /* @__PURE__ */ new Set(), this.#t = /* @__PURE__ */ new Map(), this.#r = 0;
11981
+ }
11982
+ #e;
11983
+ #t;
11984
+ #r;
11985
+ build(e, t, r) {
11986
+ const o = new T2({
11987
+ client: e,
11988
+ mutationCache: this,
11989
+ mutationId: ++this.#r,
11990
+ options: e.defaultMutationOptions(t),
11991
+ state: r
11992
+ });
11993
+ return this.add(o), o;
11994
+ }
11995
+ add(e) {
11996
+ this.#e.add(e);
11997
+ const t = d3(e);
11998
+ if (typeof t == "string") {
11999
+ const r = this.#t.get(t);
12000
+ r ? r.push(e) : this.#t.set(t, [e]);
12001
+ }
12002
+ this.notify({
12003
+ type: "added",
12004
+ mutation: e
12005
+ });
12006
+ }
12007
+ remove(e) {
12008
+ if (this.#e.delete(e)) {
12009
+ const t = d3(e);
12010
+ if (typeof t == "string") {
12011
+ const r = this.#t.get(t);
12012
+ if (r)
12013
+ if (r.length > 1) {
12014
+ const o = r.indexOf(e);
12015
+ o !== -1 && r.splice(o, 1);
12016
+ } else r[0] === e && this.#t.delete(t);
12017
+ }
12018
+ }
12019
+ this.notify({
12020
+ type: "removed",
12021
+ mutation: e
12022
+ });
12023
+ }
12024
+ canRun(e) {
12025
+ const t = d3(e);
12026
+ if (typeof t == "string") {
12027
+ const r = this.#t.get(t)?.find((o) => o.state.status === "pending");
12028
+ return !r || r === e;
12029
+ } else return !0;
12030
+ }
12031
+ runNext(e) {
12032
+ const t = d3(e);
12033
+ return typeof t == "string" ? this.#t.get(t)?.find((r) => r !== e && r.state.isPaused)?.continue() ?? Promise.resolve() : Promise.resolve();
12034
+ }
12035
+ clear() {
12036
+ K.batch(() => {
12037
+ this.#e.forEach((e) => {
12038
+ this.notify({
12039
+ type: "removed",
12040
+ mutation: e
12041
+ });
12042
+ }), this.#e.clear(), this.#t.clear();
12043
+ });
12044
+ }
12045
+ getAll() {
12046
+ return Array.from(this.#e);
12047
+ }
12048
+ find(e) {
12049
+ const t = {
12050
+ exact: !0,
12051
+ ...e
12052
+ };
12053
+ return this.getAll().find((r) => O3(t, r));
12054
+ }
12055
+ findAll(e = {}) {
12056
+ return this.getAll().filter((t) => O3(e, t));
12057
+ }
12058
+ notify(e) {
12059
+ K.batch(() => {
12060
+ this.listeners.forEach((t) => {
12061
+ t(e);
12062
+ });
12063
+ });
12064
+ }
12065
+ resumePausedMutations() {
12066
+ const e = this.getAll().filter((t) => t.state.isPaused);
12067
+ return K.batch(() => Promise.all(e.map((t) => t.continue().catch(X))));
12068
+ }
12069
+ };
12070
+ function d3(e) {
12071
+ return e.options.scope?.id;
12072
+ }
12073
+ var K3 = class extends k3 {
12074
+ constructor(e = {}) {
12075
+ super(), this.config = e, this.#e = /* @__PURE__ */ new Map();
12076
+ }
12077
+ #e;
12078
+ build(e, t, r) {
12079
+ const o = t.queryKey, i = t.queryHash ?? g3(o, t);
12080
+ let d = this.get(i);
12081
+ return d || (d = new I2({
12082
+ client: e,
12083
+ queryKey: o,
12084
+ queryHash: i,
12085
+ options: e.defaultQueryOptions(t),
12086
+ state: r,
12087
+ defaultOptions: e.getQueryDefaults(o)
12088
+ }), this.add(d)), d;
12089
+ }
12090
+ add(e) {
12091
+ this.#e.has(e.queryHash) || (this.#e.set(e.queryHash, e), this.notify({
12092
+ type: "added",
12093
+ query: e
12094
+ }));
12095
+ }
12096
+ remove(e) {
12097
+ const t = this.#e.get(e.queryHash);
12098
+ t && (e.destroy(), t === e && this.#e.delete(e.queryHash), this.notify({
12099
+ type: "removed",
12100
+ query: e
12101
+ }));
12102
+ }
12103
+ clear() {
12104
+ K.batch(() => {
12105
+ this.getAll().forEach((e) => {
12106
+ this.remove(e);
12107
+ });
12108
+ });
12109
+ }
12110
+ get(e) {
12111
+ return this.#e.get(e);
12112
+ }
12113
+ getAll() {
12114
+ return [...this.#e.values()];
12115
+ }
12116
+ find(e) {
12117
+ const t = {
12118
+ exact: !0,
12119
+ ...e
12120
+ };
12121
+ return this.getAll().find((r) => S3(t, r));
12122
+ }
12123
+ findAll(e = {}) {
12124
+ const t = this.getAll();
12125
+ return Object.keys(e).length > 0 ? t.filter((r) => S3(e, r)) : t;
12126
+ }
12127
+ notify(e) {
12128
+ K.batch(() => {
12129
+ this.listeners.forEach((t) => {
12130
+ t(e);
12131
+ });
12132
+ });
12133
+ }
12134
+ onFocus() {
12135
+ K.batch(() => {
12136
+ this.getAll().forEach((e) => {
12137
+ e.onFocus();
12138
+ });
12139
+ });
12140
+ }
12141
+ onOnline() {
12142
+ K.batch(() => {
12143
+ this.getAll().forEach((e) => {
12144
+ e.onOnline();
12145
+ });
12146
+ });
12147
+ }
12148
+ }, D2 = class {
12149
+ #e;
12150
+ #t;
12151
+ #r;
12152
+ #s;
12153
+ #o;
12154
+ #a;
12155
+ #i;
12156
+ #n;
12157
+ constructor(e = {}) {
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
+ }
12160
+ mount() {
12161
+ this.#a++, this.#a === 1 && (this.#i = Q3.subscribe(async (e) => {
12162
+ e && (await this.resumePausedMutations(), this.#e.onFocus());
12163
+ }), this.#n = h3.subscribe(async (e) => {
12164
+ e && (await this.resumePausedMutations(), this.#e.onOnline());
12165
+ }));
12166
+ }
12167
+ unmount() {
12168
+ this.#a--, this.#a === 0 && (this.#i?.(), this.#i = void 0, this.#n?.(), this.#n = void 0);
12169
+ }
12170
+ isFetching(e) {
12171
+ return this.#e.findAll({
12172
+ ...e,
12173
+ fetchStatus: "fetching"
12174
+ }).length;
12175
+ }
12176
+ isMutating(e) {
12177
+ return this.#t.findAll({
12178
+ ...e,
12179
+ status: "pending"
12180
+ }).length;
12181
+ }
12182
+ /**
12183
+ * Imperative (non-reactive) way to retrieve data for a QueryKey.
12184
+ * Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.
12185
+ *
12186
+ * Hint: Do not use this function inside a component, because it won't receive updates.
12187
+ * Use `useQuery` to create a `QueryObserver` that subscribes to changes.
12188
+ */
12189
+ getQueryData(e) {
12190
+ const t = this.defaultQueryOptions({ queryKey: e });
12191
+ return this.#e.get(t.queryHash)?.state.data;
12192
+ }
12193
+ ensureQueryData(e) {
12194
+ const t = this.defaultQueryOptions(e), r = this.#e.build(this, t), o = r.state.data;
12195
+ return o === void 0 ? this.fetchQuery(e) : (e.revalidateIfStale && r.isStaleByTime(w3(t.staleTime, r)) && this.prefetchQuery(t), Promise.resolve(o));
12196
+ }
12197
+ getQueriesData(e) {
12198
+ return this.#e.findAll(e).map(({ queryKey: t, state: r }) => [t, r.data]);
12199
+ }
12200
+ setQueryData(e, t, r) {
12201
+ const o = this.defaultQueryOptions({ queryKey: e }), i = this.#e.get(o.queryHash)?.state.data, d = B2(t, i);
12202
+ if (d !== void 0)
12203
+ return this.#e.build(this, o).setData(d, {
12204
+ ...r,
12205
+ manual: !0
12206
+ });
12207
+ }
12208
+ setQueriesData(e, t, r) {
12209
+ return K.batch(() => this.#e.findAll(e).map(({ queryKey: o }) => [o, this.setQueryData(o, t, r)]));
12210
+ }
12211
+ getQueryState(e) {
12212
+ const t = this.defaultQueryOptions({ queryKey: e });
12213
+ return this.#e.get(t.queryHash)?.state;
12214
+ }
12215
+ removeQueries(e) {
12216
+ const t = this.#e;
12217
+ K.batch(() => {
12218
+ t.findAll(e).forEach((r) => {
12219
+ t.remove(r);
12220
+ });
12221
+ });
12222
+ }
12223
+ resetQueries(e, t) {
12224
+ const r = this.#e;
12225
+ return K.batch(() => (r.findAll(e).forEach((o) => {
12226
+ o.reset();
12227
+ }), this.refetchQueries({
12228
+ type: "active",
12229
+ ...e
12230
+ }, t)));
12231
+ }
12232
+ cancelQueries(e, t = {}) {
12233
+ const r = {
12234
+ revert: !0,
12235
+ ...t
12236
+ }, o = K.batch(() => this.#e.findAll(e).map((i) => i.cancel(r)));
12237
+ return Promise.all(o).then(X).catch(X);
12238
+ }
12239
+ invalidateQueries(e, t = {}) {
12240
+ return K.batch(() => (this.#e.findAll(e).forEach((r) => {
12241
+ r.invalidate();
12242
+ }), e?.refetchType === "none" ? Promise.resolve() : this.refetchQueries({
12243
+ ...e,
12244
+ type: e?.refetchType ?? e?.type ?? "active"
12245
+ }, t)));
12246
+ }
12247
+ refetchQueries(e, t = {}) {
12248
+ const r = {
12249
+ ...t,
12250
+ cancelRefetch: t.cancelRefetch ?? !0
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
+ }));
12255
+ return Promise.all(o).then(X);
12256
+ }
12257
+ fetchQuery(e) {
12258
+ const t = this.defaultQueryOptions(e);
12259
+ t.retry === void 0 && (t.retry = !1);
12260
+ const r = this.#e.build(this, t);
12261
+ return r.isStaleByTime(w3(t.staleTime, r)) ? r.fetch(t) : Promise.resolve(r.state.data);
12262
+ }
12263
+ prefetchQuery(e) {
12264
+ return this.fetchQuery(e).then(X).catch(X);
12265
+ }
12266
+ fetchInfiniteQuery(e) {
12267
+ return e.behavior = N3(e.pages), this.fetchQuery(e);
12268
+ }
12269
+ prefetchInfiniteQuery(e) {
12270
+ return this.fetchInfiniteQuery(e).then(X).catch(X);
12271
+ }
12272
+ ensureInfiniteQueryData(e) {
12273
+ return e.behavior = N3(e.pages), this.ensureQueryData(e);
12274
+ }
12275
+ resumePausedMutations() {
12276
+ return h3.isOnline() ? this.#t.resumePausedMutations() : Promise.resolve();
12277
+ }
12278
+ getQueryCache() {
12279
+ return this.#e;
12280
+ }
12281
+ getMutationCache() {
12282
+ return this.#t;
12283
+ }
12284
+ getDefaultOptions() {
12285
+ return this.#r;
12286
+ }
12287
+ setDefaultOptions(e) {
12288
+ this.#r = e;
12289
+ }
12290
+ setQueryDefaults(e, t) {
12291
+ this.#s.set(n3(e), {
12292
+ queryKey: e,
12293
+ defaultOptions: t
12294
+ });
12295
+ }
12296
+ getQueryDefaults(e) {
12297
+ const t = [...this.#s.values()], r = {};
12298
+ return t.forEach((o) => {
12299
+ a3(e, o.queryKey) && Object.assign(r, o.defaultOptions);
12300
+ }), r;
12301
+ }
12302
+ setMutationDefaults(e, t) {
12303
+ this.#o.set(n3(e), {
12304
+ mutationKey: e,
12305
+ defaultOptions: t
12306
+ });
12307
+ }
12308
+ getMutationDefaults(e) {
12309
+ const t = [...this.#o.values()], r = {};
12310
+ return t.forEach((o) => {
12311
+ a3(e, o.mutationKey) && Object.assign(r, o.defaultOptions);
12312
+ }), r;
12313
+ }
12314
+ defaultQueryOptions(e) {
12315
+ if (e._defaulted) return e;
12316
+ const t = {
12317
+ ...this.#r.queries,
12318
+ ...this.getQueryDefaults(e.queryKey),
12319
+ ...e,
12320
+ _defaulted: !0
12321
+ };
12322
+ return t.queryHash || (t.queryHash = g3(t.queryKey, t)), t.refetchOnReconnect === void 0 && (t.refetchOnReconnect = t.networkMode !== "always"), t.throwOnError === void 0 && (t.throwOnError = !!t.suspense), !t.networkMode && t.persister && (t.networkMode = "offlineFirst"), t.queryFn === f3 && (t.enabled = !1), t;
12323
+ }
12324
+ defaultMutationOptions(e) {
12325
+ return e?._defaulted ? e : {
12326
+ ...this.#r.mutations,
12327
+ ...e?.mutationKey && this.getMutationDefaults(e.mutationKey),
12328
+ ...e,
12329
+ _defaulted: !0
12330
+ };
12331
+ }
12332
+ clear() {
12333
+ this.#e.clear(), this.#t.clear();
12334
+ }
12335
+ };
12336
+ function T3(e) {
12337
+ if (!e || typeof e != "object") return !1;
12338
+ const t = e;
12339
+ return !!(t.code === "PGRST301" || typeof t.message == "string" && /jwt|token/i.test(t.message));
12340
+ }
12341
+ function Z2(e, t = {}) {
12342
+ let r = null;
12343
+ const o = () => r || (r = e.auth.refreshSession().then(({ error: k }) => !k).catch(() => !1).finally(() => {
12344
+ r = null;
12345
+ }), r), i = new K3({ onError: async (k, p) => {
12346
+ T3(k) && (await o() ? s.invalidateQueries({ queryKey: p.queryKey }) : await e.auth.signOut());
12347
+ } }), { defaultOptions: d = {}, ...a } = t, s = new D2({
12348
+ queryCache: i,
12349
+ defaultOptions: {
12350
+ ...d,
12351
+ queries: {
12352
+ retry: (k, p) => {
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
+ },
12357
+ ...d.queries
12358
+ }
12359
+ },
12360
+ ...a
12361
+ });
12362
+ return s;
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();
11046
12445
  export {
11047
- Q3 as DeviceSessionGuard,
11048
- U3 as LoginPage,
11049
- V3 as RoleGuard,
11050
- K3 as createTablaClient,
11051
- c3 as getRoleFromMetadata,
11052
- L3 as hasRole,
11053
- f3 as useAuth,
11054
- k3 as useAuthStore,
11055
- A3 as useDeviceSessionStore,
11056
- G3 as useRequireRole
12446
+ J2 as DeviceSessionGuard,
12447
+ $2 as LoginPage,
12448
+ W2 as RoleGuard,
12449
+ Z2 as createAuthAwareQueryClient,
12450
+ Y2 as createTablaClient,
12451
+ m3 as getRoleFromMetadata,
12452
+ n2 as hasRole,
12453
+ e5 as realtimeRegistry,
12454
+ _3 as useAuth,
12455
+ D3 as useAuthStore,
12456
+ a2 as useDeviceSessionStore,
12457
+ H2 as useRequireRole
11057
12458
  };