@uziee/document-scanner 1.1.7 → 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
- import Ye, { useRef as Q, useState as ie, useEffect as ht } from "react";
2
- var ge = { exports: {} }, Z = {};
1
+ import Ye, { useRef as Q, useState as te, useEffect as gt } from "react";
2
+ var me = { exports: {} }, Z = {};
3
3
  /**
4
4
  * @license React
5
5
  * react-jsx-runtime.production.min.js
@@ -9,23 +9,23 @@ var ge = { exports: {} }, Z = {};
9
9
  * This source code is licensed under the MIT license found in the
10
10
  * LICENSE file in the root directory of this source tree.
11
11
  */
12
- var We;
13
- function vt() {
14
- if (We)
12
+ var Ae;
13
+ function mt() {
14
+ if (Ae)
15
15
  return Z;
16
- We = 1;
17
- var A = Ye, r = Symbol.for("react.element"), o = Symbol.for("react.fragment"), a = Object.prototype.hasOwnProperty, c = A.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, g = { key: !0, ref: !0, __self: !0, __source: !0 };
18
- function u(l, i, b) {
19
- var s, p = {}, m = null, d = null;
20
- b !== void 0 && (m = "" + b), i.key !== void 0 && (m = "" + i.key), i.ref !== void 0 && (d = i.ref);
21
- for (s in i)
22
- a.call(i, s) && !g.hasOwnProperty(s) && (p[s] = i[s]);
23
- if (l && l.defaultProps)
24
- for (s in i = l.defaultProps, i)
25
- p[s] === void 0 && (p[s] = i[s]);
26
- return { $$typeof: r, type: l, key: m, ref: d, props: p, _owner: c.current };
16
+ Ae = 1;
17
+ var D = Ye, i = Symbol.for("react.element"), n = Symbol.for("react.fragment"), l = Object.prototype.hasOwnProperty, c = D.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, x = { key: !0, ref: !0, __self: !0, __source: !0 };
18
+ function u(f, a, b) {
19
+ var s, h = {}, p = null, g = null;
20
+ b !== void 0 && (p = "" + b), a.key !== void 0 && (p = "" + a.key), a.ref !== void 0 && (g = a.ref);
21
+ for (s in a)
22
+ l.call(a, s) && !x.hasOwnProperty(s) && (h[s] = a[s]);
23
+ if (f && f.defaultProps)
24
+ for (s in a = f.defaultProps, a)
25
+ h[s] === void 0 && (h[s] = a[s]);
26
+ return { $$typeof: i, type: f, key: p, ref: g, props: h, _owner: c.current };
27
27
  }
28
- return Z.Fragment = o, Z.jsx = u, Z.jsxs = u, Z;
28
+ return Z.Fragment = n, Z.jsx = u, Z.jsxs = u, Z;
29
29
  }
30
30
  var ee = {};
31
31
  /**
@@ -37,66 +37,66 @@ var ee = {};
37
37
  * This source code is licensed under the MIT license found in the
38
38
  * LICENSE file in the root directory of this source tree.
39
39
  */
40
- var $e;
41
- function pt() {
42
- return $e || ($e = 1, {}.NODE_ENV !== "production" && function() {
43
- var A = Ye, r = Symbol.for("react.element"), o = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), c = Symbol.for("react.strict_mode"), g = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), l = Symbol.for("react.context"), i = Symbol.for("react.forward_ref"), b = Symbol.for("react.suspense"), s = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), m = Symbol.for("react.lazy"), d = Symbol.for("react.offscreen"), _ = Symbol.iterator, P = "@@iterator";
44
- function y(e) {
40
+ var We;
41
+ function xt() {
42
+ return We || (We = 1, {}.NODE_ENV !== "production" && function() {
43
+ var D = Ye, i = Symbol.for("react.element"), n = Symbol.for("react.portal"), l = Symbol.for("react.fragment"), c = Symbol.for("react.strict_mode"), x = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), f = Symbol.for("react.context"), a = Symbol.for("react.forward_ref"), b = Symbol.for("react.suspense"), s = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), g = Symbol.for("react.offscreen"), R = Symbol.iterator, O = "@@iterator";
44
+ function S(e) {
45
45
  if (e === null || typeof e != "object")
46
46
  return null;
47
- var t = _ && e[_] || e[P];
47
+ var t = R && e[R] || e[O];
48
48
  return typeof t == "function" ? t : null;
49
49
  }
50
- var v = A.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
51
- function f(e) {
50
+ var v = D.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
51
+ function d(e) {
52
52
  {
53
- for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), h = 1; h < t; h++)
54
- n[h - 1] = arguments[h];
55
- C("error", e, n);
53
+ for (var t = arguments.length, o = new Array(t > 1 ? t - 1 : 0), m = 1; m < t; m++)
54
+ o[m - 1] = arguments[m];
55
+ C("error", e, o);
56
56
  }
57
57
  }
58
- function C(e, t, n) {
58
+ function C(e, t, o) {
59
59
  {
60
- var h = v.ReactDebugCurrentFrame, E = h.getStackAddendum();
61
- E !== "" && (t += "%s", n = n.concat([E]));
62
- var S = n.map(function(R) {
63
- return String(R);
60
+ var m = v.ReactDebugCurrentFrame, w = m.getStackAddendum();
61
+ w !== "" && (t += "%s", o = o.concat([w]));
62
+ var E = o.map(function(j) {
63
+ return String(j);
64
64
  });
65
- S.unshift("Warning: " + t), Function.prototype.apply.call(console[e], console, S);
65
+ E.unshift("Warning: " + t), Function.prototype.apply.call(console[e], console, E);
66
66
  }
67
67
  }
68
- var F = !1, $ = !1, M = !1, Y = !1, z = !1, te;
69
- te = Symbol.for("react.module.reference");
70
- function L(e) {
71
- return !!(typeof e == "string" || typeof e == "function" || e === a || e === g || z || e === c || e === b || e === s || Y || e === d || F || $ || M || typeof e == "object" && e !== null && (e.$$typeof === m || e.$$typeof === p || e.$$typeof === u || e.$$typeof === l || e.$$typeof === i || // This needs to include all possible module reference object
68
+ var M = !1, N = !1, L = !1, W = !1, $ = !1, z;
69
+ z = Symbol.for("react.module.reference");
70
+ function ie(e) {
71
+ return !!(typeof e == "string" || typeof e == "function" || e === l || e === x || $ || e === c || e === b || e === s || W || e === g || M || N || L || typeof e == "object" && e !== null && (e.$$typeof === p || e.$$typeof === h || e.$$typeof === u || e.$$typeof === f || e.$$typeof === a || // This needs to include all possible module reference object
72
72
  // types supported by any Flight configuration anywhere since
73
73
  // we don't know which Flight build this will end up being used
74
74
  // with.
75
- e.$$typeof === te || e.getModuleId !== void 0));
75
+ e.$$typeof === z || e.getModuleId !== void 0));
76
76
  }
77
- function q(e, t, n) {
78
- var h = e.displayName;
79
- if (h)
80
- return h;
81
- var E = t.displayName || t.name || "";
82
- return E !== "" ? n + "(" + E + ")" : n;
77
+ function Y(e, t, o) {
78
+ var m = e.displayName;
79
+ if (m)
80
+ return m;
81
+ var w = t.displayName || t.name || "";
82
+ return w !== "" ? o + "(" + w + ")" : o;
83
83
  }
84
- function W(e) {
84
+ function B(e) {
85
85
  return e.displayName || "Context";
86
86
  }
87
- function O(e) {
87
+ function T(e) {
88
88
  if (e == null)
89
89
  return null;
90
- if (typeof e.tag == "number" && f("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
90
+ if (typeof e.tag == "number" && d("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
91
91
  return e.displayName || e.name || null;
92
92
  if (typeof e == "string")
93
93
  return e;
94
94
  switch (e) {
95
- case a:
95
+ case l:
96
96
  return "Fragment";
97
- case o:
97
+ case n:
98
98
  return "Portal";
99
- case g:
99
+ case x:
100
100
  return "Profiler";
101
101
  case c:
102
102
  return "StrictMode";
@@ -107,21 +107,21 @@ function pt() {
107
107
  }
108
108
  if (typeof e == "object")
109
109
  switch (e.$$typeof) {
110
- case l:
110
+ case f:
111
111
  var t = e;
112
- return W(t) + ".Consumer";
112
+ return B(t) + ".Consumer";
113
113
  case u:
114
- var n = e;
115
- return W(n._context) + ".Provider";
116
- case i:
117
- return q(e, e.render, "ForwardRef");
118
- case p:
119
- var h = e.displayName || null;
120
- return h !== null ? h : O(e.type) || "Memo";
121
- case m: {
122
- var E = e, S = E._payload, R = E._init;
114
+ var o = e;
115
+ return B(o._context) + ".Provider";
116
+ case a:
117
+ return Y(e, e.render, "ForwardRef");
118
+ case h:
119
+ var m = e.displayName || null;
120
+ return m !== null ? m : T(e.type) || "Memo";
121
+ case p: {
122
+ var w = e, E = w._payload, j = w._init;
123
123
  try {
124
- return O(R(S));
124
+ return T(j(E));
125
125
  } catch {
126
126
  return null;
127
127
  }
@@ -129,14 +129,14 @@ function pt() {
129
129
  }
130
130
  return null;
131
131
  }
132
- var U = Object.assign, V = 0, N, H, be, ye, me, xe, Re;
132
+ var P = Object.assign, V = 0, re, U, q, xe, be, ye, je;
133
133
  function Ce() {
134
134
  }
135
135
  Ce.__reactDisabledLog = !0;
136
- function Ue() {
136
+ function Be() {
137
137
  {
138
138
  if (V === 0) {
139
- N = console.log, H = console.info, be = console.warn, ye = console.error, me = console.group, xe = console.groupCollapsed, Re = console.groupEnd;
139
+ re = console.log, U = console.info, q = console.warn, xe = console.error, be = console.group, ye = console.groupCollapsed, je = console.groupEnd;
140
140
  var e = {
141
141
  configurable: !0,
142
142
  enumerable: !0,
@@ -156,7 +156,7 @@ function pt() {
156
156
  V++;
157
157
  }
158
158
  }
159
- function Le() {
159
+ function Ve() {
160
160
  {
161
161
  if (V--, V === 0) {
162
162
  var e = {
@@ -165,324 +165,324 @@ function pt() {
165
165
  writable: !0
166
166
  };
167
167
  Object.defineProperties(console, {
168
- log: U({}, e, {
169
- value: N
168
+ log: P({}, e, {
169
+ value: re
170
170
  }),
171
- info: U({}, e, {
172
- value: H
171
+ info: P({}, e, {
172
+ value: U
173
173
  }),
174
- warn: U({}, e, {
175
- value: be
174
+ warn: P({}, e, {
175
+ value: q
176
176
  }),
177
- error: U({}, e, {
178
- value: ye
177
+ error: P({}, e, {
178
+ value: xe
179
179
  }),
180
- group: U({}, e, {
181
- value: me
180
+ group: P({}, e, {
181
+ value: be
182
182
  }),
183
- groupCollapsed: U({}, e, {
184
- value: xe
183
+ groupCollapsed: P({}, e, {
184
+ value: ye
185
185
  }),
186
- groupEnd: U({}, e, {
187
- value: Re
186
+ groupEnd: P({}, e, {
187
+ value: je
188
188
  })
189
189
  });
190
190
  }
191
- V < 0 && f("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
191
+ V < 0 && d("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
192
192
  }
193
193
  }
194
- var se = v.ReactCurrentDispatcher, le;
195
- function re(e, t, n) {
194
+ var le = v.ReactCurrentDispatcher, ce;
195
+ function ne(e, t, o) {
196
196
  {
197
- if (le === void 0)
197
+ if (ce === void 0)
198
198
  try {
199
199
  throw Error();
200
- } catch (E) {
201
- var h = E.stack.trim().match(/\n( *(at )?)/);
202
- le = h && h[1] || "";
200
+ } catch (w) {
201
+ var m = w.stack.trim().match(/\n( *(at )?)/);
202
+ ce = m && m[1] || "";
203
203
  }
204
204
  return `
205
- ` + le + e;
205
+ ` + ce + e;
206
206
  }
207
207
  }
208
- var ce = !1, ne;
208
+ var ue = !1, oe;
209
209
  {
210
- var ze = typeof WeakMap == "function" ? WeakMap : Map;
211
- ne = new ze();
210
+ var Ue = typeof WeakMap == "function" ? WeakMap : Map;
211
+ oe = new Ue();
212
212
  }
213
- function Ee(e, t) {
214
- if (!e || ce)
213
+ function we(e, t) {
214
+ if (!e || ue)
215
215
  return "";
216
216
  {
217
- var n = ne.get(e);
218
- if (n !== void 0)
219
- return n;
217
+ var o = oe.get(e);
218
+ if (o !== void 0)
219
+ return o;
220
220
  }
221
- var h;
222
- ce = !0;
223
- var E = Error.prepareStackTrace;
221
+ var m;
222
+ ue = !0;
223
+ var w = Error.prepareStackTrace;
224
224
  Error.prepareStackTrace = void 0;
225
- var S;
226
- S = se.current, se.current = null, Ue();
225
+ var E;
226
+ E = le.current, le.current = null, Be();
227
227
  try {
228
228
  if (t) {
229
- var R = function() {
229
+ var j = function() {
230
230
  throw Error();
231
231
  };
232
- if (Object.defineProperty(R.prototype, "props", {
232
+ if (Object.defineProperty(j.prototype, "props", {
233
233
  set: function() {
234
234
  throw Error();
235
235
  }
236
236
  }), typeof Reflect == "object" && Reflect.construct) {
237
237
  try {
238
- Reflect.construct(R, []);
239
- } catch (k) {
240
- h = k;
238
+ Reflect.construct(j, []);
239
+ } catch (F) {
240
+ m = F;
241
241
  }
242
- Reflect.construct(e, [], R);
242
+ Reflect.construct(e, [], j);
243
243
  } else {
244
244
  try {
245
- R.call();
246
- } catch (k) {
247
- h = k;
245
+ j.call();
246
+ } catch (F) {
247
+ m = F;
248
248
  }
249
- e.call(R.prototype);
249
+ e.call(j.prototype);
250
250
  }
251
251
  } else {
252
252
  try {
253
253
  throw Error();
254
- } catch (k) {
255
- h = k;
254
+ } catch (F) {
255
+ m = F;
256
256
  }
257
257
  e();
258
258
  }
259
- } catch (k) {
260
- if (k && h && typeof k.stack == "string") {
261
- for (var x = k.stack.split(`
262
- `), D = h.stack.split(`
263
- `), T = x.length - 1, w = D.length - 1; T >= 1 && w >= 0 && x[T] !== D[w]; )
264
- w--;
265
- for (; T >= 1 && w >= 0; T--, w--)
266
- if (x[T] !== D[w]) {
267
- if (T !== 1 || w !== 1)
259
+ } catch (F) {
260
+ if (F && m && typeof F.stack == "string") {
261
+ for (var y = F.stack.split(`
262
+ `), I = m.stack.split(`
263
+ `), _ = y.length - 1, k = I.length - 1; _ >= 1 && k >= 0 && y[_] !== I[k]; )
264
+ k--;
265
+ for (; _ >= 1 && k >= 0; _--, k--)
266
+ if (y[_] !== I[k]) {
267
+ if (_ !== 1 || k !== 1)
268
268
  do
269
- if (T--, w--, w < 0 || x[T] !== D[w]) {
270
- var I = `
271
- ` + x[T].replace(" at new ", " at ");
272
- return e.displayName && I.includes("<anonymous>") && (I = I.replace("<anonymous>", e.displayName)), typeof e == "function" && ne.set(e, I), I;
269
+ if (_--, k--, k < 0 || y[_] !== I[k]) {
270
+ var A = `
271
+ ` + y[_].replace(" at new ", " at ");
272
+ return e.displayName && A.includes("<anonymous>") && (A = A.replace("<anonymous>", e.displayName)), typeof e == "function" && oe.set(e, A), A;
273
273
  }
274
- while (T >= 1 && w >= 0);
274
+ while (_ >= 1 && k >= 0);
275
275
  break;
276
276
  }
277
277
  }
278
278
  } finally {
279
- ce = !1, se.current = S, Le(), Error.prepareStackTrace = E;
279
+ ue = !1, le.current = E, Ve(), Error.prepareStackTrace = w;
280
280
  }
281
- var K = e ? e.displayName || e.name : "", B = K ? re(K) : "";
282
- return typeof e == "function" && ne.set(e, B), B;
281
+ var G = e ? e.displayName || e.name : "", H = G ? ne(G) : "";
282
+ return typeof e == "function" && oe.set(e, H), H;
283
283
  }
284
- function Ve(e, t, n) {
285
- return Ee(e, !1);
284
+ function He(e, t, o) {
285
+ return we(e, !1);
286
286
  }
287
- function Ne(e) {
287
+ function qe(e) {
288
288
  var t = e.prototype;
289
289
  return !!(t && t.isReactComponent);
290
290
  }
291
- function oe(e, t, n) {
291
+ function ae(e, t, o) {
292
292
  if (e == null)
293
293
  return "";
294
294
  if (typeof e == "function")
295
- return Ee(e, Ne(e));
295
+ return we(e, qe(e));
296
296
  if (typeof e == "string")
297
- return re(e);
297
+ return ne(e);
298
298
  switch (e) {
299
299
  case b:
300
- return re("Suspense");
300
+ return ne("Suspense");
301
301
  case s:
302
- return re("SuspenseList");
302
+ return ne("SuspenseList");
303
303
  }
304
304
  if (typeof e == "object")
305
305
  switch (e.$$typeof) {
306
- case i:
307
- return Ve(e.render);
308
- case p:
309
- return oe(e.type, t, n);
310
- case m: {
311
- var h = e, E = h._payload, S = h._init;
306
+ case a:
307
+ return He(e.render);
308
+ case h:
309
+ return ae(e.type, t, o);
310
+ case p: {
311
+ var m = e, w = m._payload, E = m._init;
312
312
  try {
313
- return oe(S(E), t, n);
313
+ return ae(E(w), t, o);
314
314
  } catch {
315
315
  }
316
316
  }
317
317
  }
318
318
  return "";
319
319
  }
320
- var X = Object.prototype.hasOwnProperty, _e = {}, Se = v.ReactDebugCurrentFrame;
321
- function ae(e) {
320
+ var K = Object.prototype.hasOwnProperty, Re = {}, Ee = v.ReactDebugCurrentFrame;
321
+ function se(e) {
322
322
  if (e) {
323
- var t = e._owner, n = oe(e.type, e._source, t ? t.type : null);
324
- Se.setExtraStackFrame(n);
323
+ var t = e._owner, o = ae(e.type, e._source, t ? t.type : null);
324
+ Ee.setExtraStackFrame(o);
325
325
  } else
326
- Se.setExtraStackFrame(null);
326
+ Ee.setExtraStackFrame(null);
327
327
  }
328
- function Be(e, t, n, h, E) {
328
+ function Je(e, t, o, m, w) {
329
329
  {
330
- var S = Function.call.bind(X);
331
- for (var R in e)
332
- if (S(e, R)) {
333
- var x = void 0;
330
+ var E = Function.call.bind(K);
331
+ for (var j in e)
332
+ if (E(e, j)) {
333
+ var y = void 0;
334
334
  try {
335
- if (typeof e[R] != "function") {
336
- var D = Error((h || "React class") + ": " + n + " type `" + R + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[R] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
337
- throw D.name = "Invariant Violation", D;
335
+ if (typeof e[j] != "function") {
336
+ var I = Error((m || "React class") + ": " + o + " type `" + j + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[j] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
337
+ throw I.name = "Invariant Violation", I;
338
338
  }
339
- x = e[R](t, R, h, n, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
340
- } catch (T) {
341
- x = T;
339
+ y = e[j](t, j, m, o, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
340
+ } catch (_) {
341
+ y = _;
342
342
  }
343
- x && !(x instanceof Error) && (ae(E), f("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", h || "React class", n, R, typeof x), ae(null)), x instanceof Error && !(x.message in _e) && (_e[x.message] = !0, ae(E), f("Failed %s type: %s", n, x.message), ae(null));
343
+ y && !(y instanceof Error) && (se(w), d("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", m || "React class", o, j, typeof y), se(null)), y instanceof Error && !(y.message in Re) && (Re[y.message] = !0, se(w), d("Failed %s type: %s", o, y.message), se(null));
344
344
  }
345
345
  }
346
346
  }
347
- var qe = Array.isArray;
348
- function ue(e) {
349
- return qe(e);
347
+ var Ge = Array.isArray;
348
+ function fe(e) {
349
+ return Ge(e);
350
350
  }
351
- function He(e) {
351
+ function Ke(e) {
352
352
  {
353
- var t = typeof Symbol == "function" && Symbol.toStringTag, n = t && e[Symbol.toStringTag] || e.constructor.name || "Object";
354
- return n;
353
+ var t = typeof Symbol == "function" && Symbol.toStringTag, o = t && e[Symbol.toStringTag] || e.constructor.name || "Object";
354
+ return o;
355
355
  }
356
356
  }
357
- function Je(e) {
357
+ function Xe(e) {
358
358
  try {
359
- return je(e), !1;
359
+ return Se(e), !1;
360
360
  } catch {
361
361
  return !0;
362
362
  }
363
363
  }
364
- function je(e) {
364
+ function Se(e) {
365
365
  return "" + e;
366
366
  }
367
- function Te(e) {
368
- if (Je(e))
369
- return f("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", He(e)), je(e);
367
+ function _e(e) {
368
+ if (Xe(e))
369
+ return d("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ke(e)), Se(e);
370
370
  }
371
- var G = v.ReactCurrentOwner, Ke = {
371
+ var X = v.ReactCurrentOwner, Qe = {
372
372
  key: !0,
373
373
  ref: !0,
374
374
  __self: !0,
375
375
  __source: !0
376
- }, we, Oe, fe;
377
- fe = {};
378
- function Xe(e) {
379
- if (X.call(e, "ref")) {
376
+ }, ke, Te, de;
377
+ de = {};
378
+ function Ze(e) {
379
+ if (K.call(e, "ref")) {
380
380
  var t = Object.getOwnPropertyDescriptor(e, "ref").get;
381
381
  if (t && t.isReactWarning)
382
382
  return !1;
383
383
  }
384
384
  return e.ref !== void 0;
385
385
  }
386
- function Ge(e) {
387
- if (X.call(e, "key")) {
386
+ function et(e) {
387
+ if (K.call(e, "key")) {
388
388
  var t = Object.getOwnPropertyDescriptor(e, "key").get;
389
389
  if (t && t.isReactWarning)
390
390
  return !1;
391
391
  }
392
392
  return e.key !== void 0;
393
393
  }
394
- function Qe(e, t) {
395
- if (typeof e.ref == "string" && G.current && t && G.current.stateNode !== t) {
396
- var n = O(G.current.type);
397
- fe[n] || (f('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', O(G.current.type), e.ref), fe[n] = !0);
394
+ function tt(e, t) {
395
+ if (typeof e.ref == "string" && X.current && t && X.current.stateNode !== t) {
396
+ var o = T(X.current.type);
397
+ de[o] || (d('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', T(X.current.type), e.ref), de[o] = !0);
398
398
  }
399
399
  }
400
- function Ze(e, t) {
400
+ function rt(e, t) {
401
401
  {
402
- var n = function() {
403
- we || (we = !0, f("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
402
+ var o = function() {
403
+ ke || (ke = !0, d("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
404
404
  };
405
- n.isReactWarning = !0, Object.defineProperty(e, "key", {
406
- get: n,
405
+ o.isReactWarning = !0, Object.defineProperty(e, "key", {
406
+ get: o,
407
407
  configurable: !0
408
408
  });
409
409
  }
410
410
  }
411
- function et(e, t) {
411
+ function nt(e, t) {
412
412
  {
413
- var n = function() {
414
- Oe || (Oe = !0, f("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
413
+ var o = function() {
414
+ Te || (Te = !0, d("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
415
415
  };
416
- n.isReactWarning = !0, Object.defineProperty(e, "ref", {
417
- get: n,
416
+ o.isReactWarning = !0, Object.defineProperty(e, "ref", {
417
+ get: o,
418
418
  configurable: !0
419
419
  });
420
420
  }
421
421
  }
422
- var tt = function(e, t, n, h, E, S, R) {
423
- var x = {
422
+ var ot = function(e, t, o, m, w, E, j) {
423
+ var y = {
424
424
  // This tag allows us to uniquely identify this as a React Element
425
- $$typeof: r,
425
+ $$typeof: i,
426
426
  // Built-in properties that belong on the element
427
427
  type: e,
428
428
  key: t,
429
- ref: n,
430
- props: R,
429
+ ref: o,
430
+ props: j,
431
431
  // Record the component responsible for creating this element.
432
- _owner: S
432
+ _owner: E
433
433
  };
434
- return x._store = {}, Object.defineProperty(x._store, "validated", {
434
+ return y._store = {}, Object.defineProperty(y._store, "validated", {
435
435
  configurable: !1,
436
436
  enumerable: !1,
437
437
  writable: !0,
438
438
  value: !1
439
- }), Object.defineProperty(x, "_self", {
439
+ }), Object.defineProperty(y, "_self", {
440
440
  configurable: !1,
441
441
  enumerable: !1,
442
442
  writable: !1,
443
- value: h
444
- }), Object.defineProperty(x, "_source", {
443
+ value: m
444
+ }), Object.defineProperty(y, "_source", {
445
445
  configurable: !1,
446
446
  enumerable: !1,
447
447
  writable: !1,
448
- value: E
449
- }), Object.freeze && (Object.freeze(x.props), Object.freeze(x)), x;
448
+ value: w
449
+ }), Object.freeze && (Object.freeze(y.props), Object.freeze(y)), y;
450
450
  };
451
- function rt(e, t, n, h, E) {
451
+ function at(e, t, o, m, w) {
452
452
  {
453
- var S, R = {}, x = null, D = null;
454
- n !== void 0 && (Te(n), x = "" + n), Ge(t) && (Te(t.key), x = "" + t.key), Xe(t) && (D = t.ref, Qe(t, E));
455
- for (S in t)
456
- X.call(t, S) && !Ke.hasOwnProperty(S) && (R[S] = t[S]);
453
+ var E, j = {}, y = null, I = null;
454
+ o !== void 0 && (_e(o), y = "" + o), et(t) && (_e(t.key), y = "" + t.key), Ze(t) && (I = t.ref, tt(t, w));
455
+ for (E in t)
456
+ K.call(t, E) && !Qe.hasOwnProperty(E) && (j[E] = t[E]);
457
457
  if (e && e.defaultProps) {
458
- var T = e.defaultProps;
459
- for (S in T)
460
- R[S] === void 0 && (R[S] = T[S]);
458
+ var _ = e.defaultProps;
459
+ for (E in _)
460
+ j[E] === void 0 && (j[E] = _[E]);
461
461
  }
462
- if (x || D) {
463
- var w = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
464
- x && Ze(R, w), D && et(R, w);
462
+ if (y || I) {
463
+ var k = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
464
+ y && rt(j, k), I && nt(j, k);
465
465
  }
466
- return tt(e, x, D, E, h, G.current, R);
466
+ return ot(e, y, I, w, m, X.current, j);
467
467
  }
468
468
  }
469
- var de = v.ReactCurrentOwner, Pe = v.ReactDebugCurrentFrame;
469
+ var he = v.ReactCurrentOwner, De = v.ReactDebugCurrentFrame;
470
470
  function J(e) {
471
471
  if (e) {
472
- var t = e._owner, n = oe(e.type, e._source, t ? t.type : null);
473
- Pe.setExtraStackFrame(n);
472
+ var t = e._owner, o = ae(e.type, e._source, t ? t.type : null);
473
+ De.setExtraStackFrame(o);
474
474
  } else
475
- Pe.setExtraStackFrame(null);
475
+ De.setExtraStackFrame(null);
476
476
  }
477
- var he;
478
- he = !1;
477
+ var pe;
478
+ pe = !1;
479
479
  function ve(e) {
480
- return typeof e == "object" && e !== null && e.$$typeof === r;
480
+ return typeof e == "object" && e !== null && e.$$typeof === i;
481
481
  }
482
- function De() {
482
+ function Oe() {
483
483
  {
484
- if (de.current) {
485
- var e = O(de.current.type);
484
+ if (he.current) {
485
+ var e = T(he.current.type);
486
486
  if (e)
487
487
  return `
488
488
 
@@ -491,336 +491,336 @@ Check the render method of \`` + e + "`.";
491
491
  return "";
492
492
  }
493
493
  }
494
- function nt(e) {
494
+ function st(e) {
495
495
  {
496
496
  if (e !== void 0) {
497
- var t = e.fileName.replace(/^.*[\\\/]/, ""), n = e.lineNumber;
497
+ var t = e.fileName.replace(/^.*[\\\/]/, ""), o = e.lineNumber;
498
498
  return `
499
499
 
500
- Check your code at ` + t + ":" + n + ".";
500
+ Check your code at ` + t + ":" + o + ".";
501
501
  }
502
502
  return "";
503
503
  }
504
504
  }
505
- var ke = {};
506
- function ot(e) {
505
+ var Me = {};
506
+ function it(e) {
507
507
  {
508
- var t = De();
508
+ var t = Oe();
509
509
  if (!t) {
510
- var n = typeof e == "string" ? e : e.displayName || e.name;
511
- n && (t = `
510
+ var o = typeof e == "string" ? e : e.displayName || e.name;
511
+ o && (t = `
512
512
 
513
- Check the top-level render call using <` + n + ">.");
513
+ Check the top-level render call using <` + o + ">.");
514
514
  }
515
515
  return t;
516
516
  }
517
517
  }
518
- function Fe(e, t) {
518
+ function Pe(e, t) {
519
519
  {
520
520
  if (!e._store || e._store.validated || e.key != null)
521
521
  return;
522
522
  e._store.validated = !0;
523
- var n = ot(t);
524
- if (ke[n])
523
+ var o = it(t);
524
+ if (Me[o])
525
525
  return;
526
- ke[n] = !0;
527
- var h = "";
528
- e && e._owner && e._owner !== de.current && (h = " It was passed a child from " + O(e._owner.type) + "."), J(e), f('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, h), J(null);
526
+ Me[o] = !0;
527
+ var m = "";
528
+ e && e._owner && e._owner !== he.current && (m = " It was passed a child from " + T(e._owner.type) + "."), J(e), d('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', o, m), J(null);
529
529
  }
530
530
  }
531
531
  function Ie(e, t) {
532
532
  {
533
533
  if (typeof e != "object")
534
534
  return;
535
- if (ue(e))
536
- for (var n = 0; n < e.length; n++) {
537
- var h = e[n];
538
- ve(h) && Fe(h, t);
535
+ if (fe(e))
536
+ for (var o = 0; o < e.length; o++) {
537
+ var m = e[o];
538
+ ve(m) && Pe(m, t);
539
539
  }
540
540
  else if (ve(e))
541
541
  e._store && (e._store.validated = !0);
542
542
  else if (e) {
543
- var E = y(e);
544
- if (typeof E == "function" && E !== e.entries)
545
- for (var S = E.call(e), R; !(R = S.next()).done; )
546
- ve(R.value) && Fe(R.value, t);
543
+ var w = S(e);
544
+ if (typeof w == "function" && w !== e.entries)
545
+ for (var E = w.call(e), j; !(j = E.next()).done; )
546
+ ve(j.value) && Pe(j.value, t);
547
547
  }
548
548
  }
549
549
  }
550
- function at(e) {
550
+ function lt(e) {
551
551
  {
552
552
  var t = e.type;
553
553
  if (t == null || typeof t == "string")
554
554
  return;
555
- var n;
555
+ var o;
556
556
  if (typeof t == "function")
557
- n = t.propTypes;
558
- else if (typeof t == "object" && (t.$$typeof === i || // Note: Memo only checks outer props here.
557
+ o = t.propTypes;
558
+ else if (typeof t == "object" && (t.$$typeof === a || // Note: Memo only checks outer props here.
559
559
  // Inner props are checked in the reconciler.
560
- t.$$typeof === p))
561
- n = t.propTypes;
560
+ t.$$typeof === h))
561
+ o = t.propTypes;
562
562
  else
563
563
  return;
564
- if (n) {
565
- var h = O(t);
566
- Be(n, e.props, "prop", h, e);
567
- } else if (t.PropTypes !== void 0 && !he) {
568
- he = !0;
569
- var E = O(t);
570
- f("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", E || "Unknown");
564
+ if (o) {
565
+ var m = T(t);
566
+ Je(o, e.props, "prop", m, e);
567
+ } else if (t.PropTypes !== void 0 && !pe) {
568
+ pe = !0;
569
+ var w = T(t);
570
+ d("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", w || "Unknown");
571
571
  }
572
- typeof t.getDefaultProps == "function" && !t.getDefaultProps.isReactClassApproved && f("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
572
+ typeof t.getDefaultProps == "function" && !t.getDefaultProps.isReactClassApproved && d("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
573
573
  }
574
574
  }
575
- function it(e) {
575
+ function ct(e) {
576
576
  {
577
- for (var t = Object.keys(e.props), n = 0; n < t.length; n++) {
578
- var h = t[n];
579
- if (h !== "children" && h !== "key") {
580
- J(e), f("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", h), J(null);
577
+ for (var t = Object.keys(e.props), o = 0; o < t.length; o++) {
578
+ var m = t[o];
579
+ if (m !== "children" && m !== "key") {
580
+ J(e), d("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", m), J(null);
581
581
  break;
582
582
  }
583
583
  }
584
- e.ref !== null && (J(e), f("Invalid attribute `ref` supplied to `React.Fragment`."), J(null));
584
+ e.ref !== null && (J(e), d("Invalid attribute `ref` supplied to `React.Fragment`."), J(null));
585
585
  }
586
586
  }
587
- var Ae = {};
588
- function Me(e, t, n, h, E, S) {
587
+ var Fe = {};
588
+ function Ne(e, t, o, m, w, E) {
589
589
  {
590
- var R = L(e);
591
- if (!R) {
592
- var x = "";
593
- (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (x += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
594
- var D = nt(E);
595
- D ? x += D : x += De();
596
- var T;
597
- e === null ? T = "null" : ue(e) ? T = "array" : e !== void 0 && e.$$typeof === r ? (T = "<" + (O(e.type) || "Unknown") + " />", x = " Did you accidentally export a JSX literal instead of a component?") : T = typeof e, f("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", T, x);
590
+ var j = ie(e);
591
+ if (!j) {
592
+ var y = "";
593
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (y += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
594
+ var I = st(w);
595
+ I ? y += I : y += Oe();
596
+ var _;
597
+ e === null ? _ = "null" : fe(e) ? _ = "array" : e !== void 0 && e.$$typeof === i ? (_ = "<" + (T(e.type) || "Unknown") + " />", y = " Did you accidentally export a JSX literal instead of a component?") : _ = typeof e, d("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", _, y);
598
598
  }
599
- var w = rt(e, t, n, E, S);
600
- if (w == null)
601
- return w;
602
- if (R) {
603
- var I = t.children;
604
- if (I !== void 0)
605
- if (h)
606
- if (ue(I)) {
607
- for (var K = 0; K < I.length; K++)
608
- Ie(I[K], e);
609
- Object.freeze && Object.freeze(I);
599
+ var k = at(e, t, o, w, E);
600
+ if (k == null)
601
+ return k;
602
+ if (j) {
603
+ var A = t.children;
604
+ if (A !== void 0)
605
+ if (m)
606
+ if (fe(A)) {
607
+ for (var G = 0; G < A.length; G++)
608
+ Ie(A[G], e);
609
+ Object.freeze && Object.freeze(A);
610
610
  } else
611
- f("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
611
+ d("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
612
612
  else
613
- Ie(I, e);
613
+ Ie(A, e);
614
614
  }
615
- if (X.call(t, "key")) {
616
- var B = O(e), k = Object.keys(t).filter(function(dt) {
617
- return dt !== "key";
618
- }), pe = k.length > 0 ? "{key: someKey, " + k.join(": ..., ") + ": ...}" : "{key: someKey}";
619
- if (!Ae[B + pe]) {
620
- var ft = k.length > 0 ? "{" + k.join(": ..., ") + ": ...}" : "{}";
621
- f(`A props object containing a "key" prop is being spread into JSX:
615
+ if (K.call(t, "key")) {
616
+ var H = T(e), F = Object.keys(t).filter(function(vt) {
617
+ return vt !== "key";
618
+ }), ge = F.length > 0 ? "{key: someKey, " + F.join(": ..., ") + ": ...}" : "{key: someKey}";
619
+ if (!Fe[H + ge]) {
620
+ var pt = F.length > 0 ? "{" + F.join(": ..., ") + ": ...}" : "{}";
621
+ d(`A props object containing a "key" prop is being spread into JSX:
622
622
  let props = %s;
623
623
  <%s {...props} />
624
624
  React keys must be passed directly to JSX without using spread:
625
625
  let props = %s;
626
- <%s key={someKey} {...props} />`, pe, B, ft, B), Ae[B + pe] = !0;
626
+ <%s key={someKey} {...props} />`, ge, H, pt, H), Fe[H + ge] = !0;
627
627
  }
628
628
  }
629
- return e === a ? it(w) : at(w), w;
629
+ return e === l ? ct(k) : lt(k), k;
630
630
  }
631
631
  }
632
- function st(e, t, n) {
633
- return Me(e, t, n, !0);
632
+ function ut(e, t, o) {
633
+ return Ne(e, t, o, !0);
634
634
  }
635
- function lt(e, t, n) {
636
- return Me(e, t, n, !1);
635
+ function ft(e, t, o) {
636
+ return Ne(e, t, o, !1);
637
637
  }
638
- var ct = lt, ut = st;
639
- ee.Fragment = a, ee.jsx = ct, ee.jsxs = ut;
638
+ var dt = ft, ht = ut;
639
+ ee.Fragment = l, ee.jsx = dt, ee.jsxs = ht;
640
640
  }()), ee;
641
641
  }
642
- ({}).NODE_ENV === "production" ? ge.exports = vt() : ge.exports = pt();
643
- var j = ge.exports;
644
- class gt {
642
+ ({}).NODE_ENV === "production" ? me.exports = mt() : me.exports = xt();
643
+ var r = me.exports;
644
+ class bt {
645
645
  constructor() {
646
646
  this.procCanvas = document.createElement("canvas"), this.procCtx = this.procCanvas.getContext("2d", { willReadFrequently: !0 }), this.smoothCorners = null, this.missCount = 0;
647
647
  }
648
- detect(r, o = 0.18) {
649
- const a = Math.floor(r.videoWidth * o), c = Math.floor(r.videoHeight * o);
650
- if (!a || !c)
648
+ detect(i, n = 0.18) {
649
+ const l = Math.floor(i.videoWidth * n), c = Math.floor(i.videoHeight * n);
650
+ if (!l || !c)
651
651
  return null;
652
- this.procCanvas.width = a, this.procCanvas.height = c, this.procCtx.drawImage(r, 0, 0, a, c);
653
- const u = this.procCtx.getImageData(0, 0, a, c).data, { brightness: l, saturation: i, avgBright: b, isTexturedBackground: s } = this.analyzeImage(u, a, c), p = this.createPaperMask(u, l, i, a, c, b, s);
654
- this.cleanMask(p, a, c, s);
655
- const m = this.findLargestBlob(p, a, c);
656
- if (!m || m.size < a * c * 0.06)
652
+ this.procCanvas.width = l, this.procCanvas.height = c, this.procCtx.drawImage(i, 0, 0, l, c);
653
+ const u = this.procCtx.getImageData(0, 0, l, c).data, { brightness: f, saturation: a, avgBright: b, isTexturedBackground: s } = this.analyzeImage(u, l, c), h = this.createPaperMask(u, f, a, l, c, b, s);
654
+ this.cleanMask(h, l, c, s);
655
+ const p = this.findLargestBlob(h, l, c);
656
+ if (!p || p.size < l * c * 0.06)
657
657
  return this.handleMiss();
658
- const d = this.findRegionCorners(m.pixels, a, c);
659
- if (!d)
658
+ const g = this.findRegionCorners(p.pixels, l, c);
659
+ if (!g)
660
660
  return this.handleMiss();
661
- if (!this.validateQuad(d, a, c))
661
+ if (!this.validateQuad(g, l, c))
662
662
  return this.handleMiss();
663
- const _ = {
664
- tl: [d.tl[0] / o, d.tl[1] / o],
665
- tr: [d.tr[0] / o, d.tr[1] / o],
666
- br: [d.br[0] / o, d.br[1] / o],
667
- bl: [d.bl[0] / o, d.bl[1] / o]
663
+ const R = {
664
+ tl: [g.tl[0] / n, g.tl[1] / n],
665
+ tr: [g.tr[0] / n, g.tr[1] / n],
666
+ br: [g.br[0] / n, g.br[1] / n],
667
+ bl: [g.bl[0] / n, g.bl[1] / n]
668
668
  };
669
- return this.missCount = 0, this.smooth(_);
669
+ return this.missCount = 0, this.smooth(R);
670
670
  }
671
- analyzeImage(r, o, a) {
672
- const c = new Float32Array(o * a), g = new Float32Array(o * a);
673
- let u = 0, l = 0;
674
- for (let p = 0, m = 0; p < r.length; p += 4, m++) {
675
- const d = r[p], _ = r[p + 1], P = r[p + 2], y = (d + _ + P) / 3;
676
- c[m] = y, u += y, y > 150 && l++;
677
- const v = Math.max(d, _, P), f = Math.min(d, _, P);
678
- g[m] = v > 0 ? (v - f) / v : 0;
679
- }
680
- const i = u / (o * a), s = l / (o * a) > 0.5 || i > 160;
681
- return { brightness: c, saturation: g, avgBright: i, isTexturedBackground: s };
671
+ analyzeImage(i, n, l) {
672
+ const c = new Float32Array(n * l), x = new Float32Array(n * l);
673
+ let u = 0, f = 0;
674
+ for (let h = 0, p = 0; h < i.length; h += 4, p++) {
675
+ const g = i[h], R = i[h + 1], O = i[h + 2], S = (g + R + O) / 3;
676
+ c[p] = S, u += S, S > 150 && f++;
677
+ const v = Math.max(g, R, O), d = Math.min(g, R, O);
678
+ x[p] = v > 0 ? (v - d) / v : 0;
679
+ }
680
+ const a = u / (n * l), s = f / (n * l) > 0.5 || a > 160;
681
+ return { brightness: c, saturation: x, avgBright: a, isTexturedBackground: s };
682
682
  }
683
- createPaperMask(r, o, a, c, g, u, l) {
684
- const i = new Uint8Array(c * g), b = l ? this.calcLocalVariance(o, c, g) : null;
683
+ createPaperMask(i, n, l, c, x, u, f) {
684
+ const a = new Uint8Array(c * x), b = f ? this.calcLocalVariance(n, c, x) : null;
685
685
  let s;
686
- l ? s = u + 15 : s = Math.max(120, u);
687
- const p = 0.3, m = l ? 400 : 9999;
688
- for (let d = 0; d < c * g; d++) {
689
- const _ = o[d], P = a[d];
690
- if (_ < s || P > p)
686
+ f ? s = u + 15 : s = Math.max(120, u);
687
+ const h = 0.3, p = f ? 400 : 9999;
688
+ for (let g = 0; g < c * x; g++) {
689
+ const R = n[g], O = l[g];
690
+ if (R < s || O > h)
691
691
  continue;
692
- const y = d * 4, v = r[y], f = r[y + 1], C = r[y + 2];
693
- Math.abs(v - f) + Math.abs(f - C) + Math.abs(v - C) > 80 || l && b && b[d] > m || (i[d] = 1);
692
+ const S = g * 4, v = i[S], d = i[S + 1], C = i[S + 2];
693
+ Math.abs(v - d) + Math.abs(d - C) + Math.abs(v - C) > 80 || f && b && b[g] > p || (a[g] = 1);
694
694
  }
695
- return i;
695
+ return a;
696
696
  }
697
- calcLocalVariance(r, o, a) {
698
- const c = new Float32Array(o * a), u = Math.floor(3 / 2);
699
- for (let l = u; l < a - u; l++)
700
- for (let i = u; i < o - u; i++) {
701
- let b = 0, s = 0, p = 0;
702
- for (let d = -u; d <= u; d++)
703
- for (let _ = -u; _ <= u; _++) {
704
- const P = r[(l + d) * o + (i + _)];
705
- b += P, s += P * P, p++;
697
+ calcLocalVariance(i, n, l) {
698
+ const c = new Float32Array(n * l), u = Math.floor(3 / 2);
699
+ for (let f = u; f < l - u; f++)
700
+ for (let a = u; a < n - u; a++) {
701
+ let b = 0, s = 0, h = 0;
702
+ for (let g = -u; g <= u; g++)
703
+ for (let R = -u; R <= u; R++) {
704
+ const O = i[(f + g) * n + (a + R)];
705
+ b += O, s += O * O, h++;
706
706
  }
707
- const m = b / p;
708
- c[l * o + i] = s / p - m * m;
707
+ const p = b / h;
708
+ c[f * n + a] = s / h - p * p;
709
709
  }
710
710
  return c;
711
711
  }
712
- cleanMask(r, o, a, c) {
713
- const g = c ? 2 : 1;
714
- for (let u = 0; u < g; u++) {
715
- const l = new Uint8Array(o * a);
716
- for (let i = 1; i < a - 1; i++)
717
- for (let b = 1; b < o - 1; b++) {
718
- const s = i * o + b;
719
- r[s] && r[s - 1] && r[s + 1] && r[s - o] && r[s + o] && (l[s] = 1);
712
+ cleanMask(i, n, l, c) {
713
+ const x = c ? 2 : 1;
714
+ for (let u = 0; u < x; u++) {
715
+ const f = new Uint8Array(n * l);
716
+ for (let a = 1; a < l - 1; a++)
717
+ for (let b = 1; b < n - 1; b++) {
718
+ const s = a * n + b;
719
+ i[s] && i[s - 1] && i[s + 1] && i[s - n] && i[s + n] && (f[s] = 1);
720
720
  }
721
- for (let i = 0; i < o * a; i++)
722
- r[i] = l[i];
723
- }
724
- for (let u = 0; u < g; u++) {
725
- const l = new Uint8Array(o * a);
726
- for (let i = 1; i < a - 1; i++)
727
- for (let b = 1; b < o - 1; b++) {
728
- const s = i * o + b;
729
- (r[s] || r[s - 1] || r[s + 1] || r[s - o] || r[s + o]) && (l[s] = 1);
721
+ for (let a = 0; a < n * l; a++)
722
+ i[a] = f[a];
723
+ }
724
+ for (let u = 0; u < x; u++) {
725
+ const f = new Uint8Array(n * l);
726
+ for (let a = 1; a < l - 1; a++)
727
+ for (let b = 1; b < n - 1; b++) {
728
+ const s = a * n + b;
729
+ (i[s] || i[s - 1] || i[s + 1] || i[s - n] || i[s + n]) && (f[s] = 1);
730
730
  }
731
- for (let i = 0; i < o * a; i++)
732
- r[i] = l[i];
731
+ for (let a = 0; a < n * l; a++)
732
+ i[a] = f[a];
733
733
  }
734
734
  }
735
- findLargestBlob(r, o, a) {
736
- const c = new Uint8Array(o * a);
737
- let g = null, u = 0;
738
- for (let l = 0; l < a; l++)
739
- for (let i = 0; i < o; i++) {
740
- const b = l * o + i;
741
- if (!r[b] || c[b])
735
+ findLargestBlob(i, n, l) {
736
+ const c = new Uint8Array(n * l);
737
+ let x = null, u = 0;
738
+ for (let f = 0; f < l; f++)
739
+ for (let a = 0; a < n; a++) {
740
+ const b = f * n + a;
741
+ if (!i[b] || c[b])
742
742
  continue;
743
- const s = /* @__PURE__ */ new Set(), p = [[i, l]];
744
- for (; p.length > 0; ) {
745
- const [m, d] = p.pop();
746
- if (m < 0 || m >= o || d < 0 || d >= a)
743
+ const s = /* @__PURE__ */ new Set(), h = [[a, f]];
744
+ for (; h.length > 0; ) {
745
+ const [p, g] = h.pop();
746
+ if (p < 0 || p >= n || g < 0 || g >= l)
747
747
  continue;
748
- const _ = d * o + m;
749
- c[_] || !r[_] || (c[_] = 1, s.add(_), p.push([m - 1, d], [m + 1, d], [m, d - 1], [m, d + 1]));
748
+ const R = g * n + p;
749
+ c[R] || !i[R] || (c[R] = 1, s.add(R), h.push([p - 1, g], [p + 1, g], [p, g - 1], [p, g + 1]));
750
750
  }
751
- s.size > u && (u = s.size, g = { pixels: s, size: s.size });
751
+ s.size > u && (u = s.size, x = { pixels: s, size: s.size });
752
752
  }
753
- return g;
753
+ return x;
754
754
  }
755
- findRegionCorners(r, o, a) {
756
- let c = 0, g = 0;
757
- for (const y of r) {
758
- const v = y % o, f = Math.floor(y / o);
759
- c += v, g += f;
760
- }
761
- const u = c / r.size, l = g / r.size;
762
- let i = null, b = 1 / 0, s = null, p = -1 / 0, m = null, d = -1 / 0, _ = null, P = -1 / 0;
763
- for (const y of r) {
764
- const v = y % o, f = Math.floor(y / o);
765
- if (v <= u && f <= l) {
766
- const C = v + f;
767
- C < b && (b = C, i = [v, f]);
768
- }
769
- if (v >= u && f <= l) {
770
- const C = v - f;
771
- C > p && (p = C, s = [v, f]);
772
- }
773
- if (v >= u && f >= l) {
774
- const C = v + f;
775
- C > d && (d = C, m = [v, f]);
776
- }
777
- if (v <= u && f >= l) {
778
- const C = f - v;
779
- C > P && (P = C, _ = [v, f]);
780
- }
781
- }
782
- return !i || !s || !m || !_ ? null : { tl: i, tr: s, br: m, bl: _ };
755
+ findRegionCorners(i, n, l) {
756
+ let c = 0, x = 0;
757
+ for (const S of i) {
758
+ const v = S % n, d = Math.floor(S / n);
759
+ c += v, x += d;
760
+ }
761
+ const u = c / i.size, f = x / i.size;
762
+ let a = null, b = 1 / 0, s = null, h = -1 / 0, p = null, g = -1 / 0, R = null, O = -1 / 0;
763
+ for (const S of i) {
764
+ const v = S % n, d = Math.floor(S / n);
765
+ if (v <= u && d <= f) {
766
+ const C = v + d;
767
+ C < b && (b = C, a = [v, d]);
768
+ }
769
+ if (v >= u && d <= f) {
770
+ const C = v - d;
771
+ C > h && (h = C, s = [v, d]);
772
+ }
773
+ if (v >= u && d >= f) {
774
+ const C = v + d;
775
+ C > g && (g = C, p = [v, d]);
776
+ }
777
+ if (v <= u && d >= f) {
778
+ const C = d - v;
779
+ C > O && (O = C, R = [v, d]);
780
+ }
781
+ }
782
+ return !a || !s || !p || !R ? null : { tl: a, tr: s, br: p, bl: R };
783
783
  }
784
- validateQuad(r, o, a) {
785
- const { tl: c, tr: g, br: u, bl: l } = r;
786
- for (const y of [c, g, u, l])
787
- if (!y || y[0] < 0 || y[0] >= o || y[1] < 0 || y[1] >= a)
784
+ validateQuad(i, n, l) {
785
+ const { tl: c, tr: x, br: u, bl: f } = i;
786
+ for (const S of [c, x, u, f])
787
+ if (!S || S[0] < 0 || S[0] >= n || S[1] < 0 || S[1] >= l)
788
788
  return !1;
789
- if (c[0] >= g[0] - 5 || l[0] >= u[0] - 5 || c[1] >= l[1] - 5 || g[1] >= u[1] - 5)
789
+ if (c[0] >= x[0] - 5 || f[0] >= u[0] - 5 || c[1] >= f[1] - 5 || x[1] >= u[1] - 5)
790
790
  return !1;
791
- const i = Math.hypot(g[0] - c[0], g[1] - c[1]), b = Math.hypot(u[0] - l[0], u[1] - l[1]), s = Math.hypot(l[0] - c[0], l[1] - c[1]), p = Math.hypot(u[0] - g[0], u[1] - g[1]), m = (i + b) / 2, d = (s + p) / 2;
792
- if (m < 10 || d < 10)
791
+ const a = Math.hypot(x[0] - c[0], x[1] - c[1]), b = Math.hypot(u[0] - f[0], u[1] - f[1]), s = Math.hypot(f[0] - c[0], f[1] - c[1]), h = Math.hypot(u[0] - x[0], u[1] - x[1]), p = (a + b) / 2, g = (s + h) / 2;
792
+ if (p < 10 || g < 10)
793
793
  return !1;
794
- const _ = m / d;
795
- return !(_ < 0.3 || _ > 3.5 || i / b > 2.5 || b / i > 2.5 || s / p > 2.5 || p / s > 2.5 || 0.5 * Math.abs(
796
- (g[0] - l[0]) * (c[1] - u[1]) - (c[0] - u[0]) * (g[1] - l[1])
797
- ) < o * a * 0.05);
794
+ const R = p / g;
795
+ return !(R < 0.3 || R > 3.5 || a / b > 2.5 || b / a > 2.5 || s / h > 2.5 || h / s > 2.5 || 0.5 * Math.abs(
796
+ (x[0] - f[0]) * (c[1] - u[1]) - (c[0] - u[0]) * (x[1] - f[1])
797
+ ) < n * l * 0.05);
798
798
  }
799
- smooth(r) {
799
+ smooth(i) {
800
800
  if (!this.smoothCorners)
801
- return this.smoothCorners = r, r;
802
- if (this.cornerDistance(this.smoothCorners, r) > 50)
803
- return this.smoothCorners = r, r;
804
- const a = 0.35;
801
+ return this.smoothCorners = i, i;
802
+ if (this.cornerDistance(this.smoothCorners, i) > 50)
803
+ return this.smoothCorners = i, i;
804
+ const l = 0.35;
805
805
  return this.smoothCorners = {
806
- tl: this.lerp(this.smoothCorners.tl, r.tl, a),
807
- tr: this.lerp(this.smoothCorners.tr, r.tr, a),
808
- br: this.lerp(this.smoothCorners.br, r.br, a),
809
- bl: this.lerp(this.smoothCorners.bl, r.bl, a)
806
+ tl: this.lerp(this.smoothCorners.tl, i.tl, l),
807
+ tr: this.lerp(this.smoothCorners.tr, i.tr, l),
808
+ br: this.lerp(this.smoothCorners.br, i.br, l),
809
+ bl: this.lerp(this.smoothCorners.bl, i.bl, l)
810
810
  }, this.smoothCorners;
811
811
  }
812
- cornerDistance(r, o) {
813
- let a = 0;
812
+ cornerDistance(i, n) {
813
+ let l = 0;
814
814
  for (const c of ["tl", "tr", "br", "bl"]) {
815
- const g = r[c][0] - o[c][0], u = r[c][1] - o[c][1];
816
- a += Math.sqrt(g * g + u * u);
815
+ const x = i[c][0] - n[c][0], u = i[c][1] - n[c][1];
816
+ l += Math.sqrt(x * x + u * u);
817
817
  }
818
- return a / 4;
818
+ return l / 4;
819
819
  }
820
- lerp(r, o, a) {
820
+ lerp(i, n, l) {
821
821
  return [
822
- r[0] + a * (o[0] - r[0]),
823
- r[1] + a * (o[1] - r[1])
822
+ i[0] + l * (n[0] - i[0]),
823
+ i[1] + l * (n[1] - i[1])
824
824
  ];
825
825
  }
826
826
  handleMiss() {
@@ -830,140 +830,315 @@ class gt {
830
830
  this.smoothCorners = null, this.missCount = 0;
831
831
  }
832
832
  }
833
- const bt = ({ onCapture: A }) => {
834
- const r = Q(null), o = Q(null), [a, c] = ie(!1), [g, u] = ie(null), [l, i] = ie([]), b = Q(null), s = Q(null), p = Q(0);
835
- ht(() => {
836
- b.current || (b.current = new gt());
837
- let y = null;
838
- async function v() {
833
+ const yt = ({ onCapture: D, onClose: i }) => {
834
+ const n = Q(null), l = Q(null), [c, x] = te(!1), [u, f] = te(null), [a, b] = te([]), s = Q(null), h = Q(null), p = Q(0);
835
+ gt(() => {
836
+ s.current || (s.current = new bt());
837
+ let v = null;
838
+ async function d() {
839
839
  try {
840
- const C = await navigator.mediaDevices.getUserMedia({
840
+ const M = await navigator.mediaDevices.getUserMedia({
841
841
  video: { facingMode: "environment", width: { ideal: 1920 } }
842
842
  });
843
- r.current && (r.current.srcObject = C, r.current.play(), y = requestAnimationFrame(f));
844
- } catch (C) {
845
- console.error("Camera access error:", C);
843
+ n.current && (n.current.srcObject = M, n.current.play(), v = requestAnimationFrame(C));
844
+ } catch (M) {
845
+ console.error("Camera access error:", M);
846
846
  }
847
847
  }
848
- function f() {
849
- var C;
850
- if (((C = r.current) == null ? void 0 : C.readyState) >= 2) {
851
- const F = r.current, $ = o.current;
852
- if (!$)
848
+ function C() {
849
+ var M;
850
+ if (((M = n.current) == null ? void 0 : M.readyState) >= 2) {
851
+ const N = n.current, L = l.current;
852
+ if (!L)
853
853
  return;
854
- const M = $.getContext("2d");
855
- $.width !== F.videoWidth && ($.width = F.videoWidth, $.height = F.videoHeight), M.drawImage(F, 0, 0);
856
- const Y = b.current.detect(F, 0.18);
857
- Y ? (s.current && m(Y, s.current) ? p.current = Math.min(15, p.current + 1) : p.current = 0, s.current = Y, p.current > 5 && (c(!0), u(Y))) : (p.current = Math.max(0, p.current - 2), p.current === 0 && (s.current = null, c(!1), u(null)));
854
+ const W = L.getContext("2d");
855
+ L.width !== N.videoWidth && (L.width = N.videoWidth, L.height = N.videoHeight), W.drawImage(N, 0, 0);
856
+ const $ = s.current.detect(N, 0.18);
857
+ $ ? (h.current && g($, h.current) ? p.current = Math.min(15, p.current + 1) : p.current = 0, h.current = $, p.current > 5 && (x(!0), f($))) : (p.current = Math.max(0, p.current - 2), p.current === 0 && (h.current = null, x(!1), f(null)));
858
858
  }
859
- y = requestAnimationFrame(f);
859
+ v = requestAnimationFrame(C);
860
860
  }
861
- return v(), () => {
862
- cancelAnimationFrame(y), b.current && b.current.reset();
861
+ return d(), () => {
862
+ cancelAnimationFrame(v), s.current && s.current.reset();
863
863
  };
864
864
  }, []);
865
- const m = (y, v) => Math.abs(y.tl[0] - v.tl[0]) + Math.abs(y.tl[1] - v.tl[1]) < 50, d = () => {
866
- const y = r.current, v = s.current;
867
- if (!y || !v)
865
+ const g = (v, d) => Math.abs(v.tl[0] - d.tl[0]) + Math.abs(v.tl[1] - d.tl[1]) < 50, R = () => {
866
+ const v = n.current, d = h.current;
867
+ if (!v || !d)
868
868
  return;
869
- const f = 1240, C = 1754, F = document.createElement("canvas");
870
- F.width = f, F.height = C;
871
- const $ = F.getContext("2d"), M = document.createElement("canvas");
872
- M.width = y.videoWidth, M.height = y.videoHeight, M.getContext("2d").drawImage(y, 0, 0);
873
- const Y = M.getContext("2d").getImageData(0, 0, M.width, M.height), z = $.createImageData(f, C);
874
- for (let L = 0; L < C; L++)
875
- for (let q = 0; q < f; q++) {
876
- const W = q / f, O = L / C, U = Math.floor((1 - W) * (1 - O) * v.tl[0] + W * (1 - O) * v.tr[0] + (1 - W) * O * v.bl[0] + W * O * v.br[0]), V = Math.floor((1 - W) * (1 - O) * v.tl[1] + W * (1 - O) * v.tr[1] + (1 - W) * O * v.bl[1] + W * O * v.br[1]), N = (L * f + q) * 4, H = (V * M.width + U) * 4;
877
- z.data[N] = Y.data[H], z.data[N + 1] = Y.data[H + 1], z.data[N + 2] = Y.data[H + 2], z.data[N + 3] = 255;
878
- }
879
- $.putImageData(z, 0, 0);
880
- const te = F.toDataURL("image/jpeg", 0.92);
881
- i((L) => [...L, te]);
882
- }, _ = () => {
883
- l.length > 0 && A(l);
884
- }, P = () => {
885
- if (!g || !r.current)
869
+ const C = 1240, M = 1754, N = document.createElement("canvas");
870
+ N.width = C, N.height = M;
871
+ const L = N.getContext("2d"), W = document.createElement("canvas");
872
+ W.width = v.videoWidth, W.height = v.videoHeight, W.getContext("2d").drawImage(v, 0, 0);
873
+ const $ = W.getContext("2d").getImageData(0, 0, W.width, W.height), z = L.createImageData(C, M);
874
+ for (let Y = 0; Y < M; Y++)
875
+ for (let B = 0; B < C; B++) {
876
+ const T = B / C, P = Y / M, V = Math.floor((1 - T) * (1 - P) * d.tl[0] + T * (1 - P) * d.tr[0] + (1 - T) * P * d.bl[0] + T * P * d.br[0]), re = Math.floor((1 - T) * (1 - P) * d.tl[1] + T * (1 - P) * d.tr[1] + (1 - T) * P * d.bl[1] + T * P * d.br[1]), U = (Y * C + B) * 4, q = (re * W.width + V) * 4;
877
+ z.data[U] = $.data[q], z.data[U + 1] = $.data[q + 1], z.data[U + 2] = $.data[q + 2], z.data[U + 3] = 255;
878
+ }
879
+ L.putImageData(z, 0, 0);
880
+ const ie = N.toDataURL("image/jpeg", 0.92);
881
+ b((Y) => [...Y, ie]);
882
+ }, O = () => {
883
+ a.length > 0 && D(a);
884
+ }, S = () => {
885
+ if (!u || !n.current)
886
886
  return "";
887
- const y = r.current.videoWidth, v = r.current.videoHeight, f = (C) => `${C[0] / y * 100},${C[1] / v * 100}`;
888
- return `${f(g.tl)} ${f(g.tr)} ${f(g.br)} ${f(g.bl)}`;
887
+ const v = n.current.videoWidth, d = n.current.videoHeight, C = (M) => `${M[0] / v * 100},${M[1] / d * 100}`;
888
+ return `${C(u.tl)} ${C(u.tr)} ${C(u.br)} ${C(u.bl)}`;
889
889
  };
890
- return /* @__PURE__ */ j.jsxs("div", { style: {
890
+ return /* @__PURE__ */ r.jsxs("div", { style: {
891
891
  position: "fixed",
892
892
  inset: 0,
893
893
  backgroundColor: "#000",
894
894
  fontFamily: "system-ui, -apple-system, sans-serif",
895
895
  overflow: "hidden"
896
896
  }, children: [
897
- /* @__PURE__ */ j.jsx("video", { ref: r, style: { display: "none" }, playsInline: !0, muted: !0 }),
898
- /* @__PURE__ */ j.jsx("canvas", { ref: o, style: { width: "100vw", height: "100vh", objectFit: "cover" } }),
899
- /* @__PURE__ */ j.jsx(
897
+ /* @__PURE__ */ r.jsx("video", { ref: n, style: { display: "none" }, playsInline: !0, muted: !0 }),
898
+ /* @__PURE__ */ r.jsx("canvas", { ref: l, style: { width: "100vw", height: "100vh", objectFit: "cover" } }),
899
+ /* @__PURE__ */ r.jsx(
900
900
  "svg",
901
901
  {
902
902
  viewBox: "0 0 100 100",
903
903
  preserveAspectRatio: "none",
904
904
  style: { position: "absolute", top: 0, left: 0, width: "100%", height: "100%", pointerEvents: "none", zIndex: 10 },
905
- children: g && /* @__PURE__ */ j.jsx(
905
+ children: u && /* @__PURE__ */ r.jsx(
906
906
  "polygon",
907
907
  {
908
- points: P(),
908
+ points: S(),
909
909
  fill: "rgba(0, 255, 70, 0.15)",
910
910
  stroke: "#00FF46",
911
- strokeWidth: "0.5",
911
+ strokeWidth: "0.2",
912
912
  style: { transition: "all 0.1s ease-out" }
913
913
  }
914
914
  )
915
915
  }
916
916
  ),
917
- /* @__PURE__ */ j.jsx("div", { style: { position: "absolute", top: 0, width: "100%", padding: "40px 0 20px", background: "linear-gradient(rgba(0,0,0,0.6), transparent)", textAlign: "center", zIndex: 20 }, children: /* @__PURE__ */ j.jsx("div", { style: { display: "inline-block", padding: "6px 16px", borderRadius: "20px", backgroundColor: a ? "#00FF46" : "rgba(255,255,255,0.2)", color: a ? "#000" : "#fff", fontSize: "12px", fontWeight: "bold" }, children: a ? "READY TO SCAN" : "POSITION DOCUMENT" }) }),
918
- /* @__PURE__ */ j.jsxs("div", { style: { position: "absolute", bottom: 0, width: "100%", height: "160px", background: "linear-gradient(transparent, rgba(0,0,0,0.8))", display: "flex", alignItems: "center", justifyContent: "space-around", zIndex: 20 }, children: [
919
- /* @__PURE__ */ j.jsxs(
917
+ /* @__PURE__ */ r.jsxs("div", { style: { position: "absolute", top: 0, width: "100%", padding: "40px 16px 20px", background: "linear-gradient(rgba(0,0,0,0.6), transparent)", display: "flex", alignItems: "center", justifyContent: "center", zIndex: 20 }, children: [
918
+ i && /* @__PURE__ */ r.jsx(
919
+ "button",
920
+ {
921
+ onClick: i,
922
+ style: {
923
+ position: "absolute",
924
+ right: "16px",
925
+ top: "40px",
926
+ width: "44px",
927
+ height: "44px",
928
+ borderRadius: "50%",
929
+ border: "none",
930
+ backgroundColor: "rgba(255,255,255,0.15)",
931
+ backdropFilter: "blur(8px)",
932
+ color: "#fff",
933
+ fontSize: "20px",
934
+ cursor: "pointer",
935
+ display: "flex",
936
+ alignItems: "center",
937
+ justifyContent: "center",
938
+ transition: "all 0.2s ease"
939
+ },
940
+ onMouseEnter: (v) => v.currentTarget.style.backgroundColor = "rgba(255,255,255,0.25)",
941
+ onMouseLeave: (v) => v.currentTarget.style.backgroundColor = "rgba(255,255,255,0.15)",
942
+ children: /* @__PURE__ */ r.jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
943
+ /* @__PURE__ */ r.jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
944
+ /* @__PURE__ */ r.jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
945
+ ] })
946
+ }
947
+ ),
948
+ /* @__PURE__ */ r.jsx("div", { style: { display: "inline-block", padding: "6px 16px", borderRadius: "20px", backgroundColor: c ? "#00FF46" : "rgba(255,255,255,0.2)", color: c ? "#000" : "#fff", fontSize: "12px", fontWeight: "bold" }, children: c ? "READY TO SCAN" : "POSITION DOCUMENT" })
949
+ ] }),
950
+ /* @__PURE__ */ r.jsxs("div", { style: { position: "absolute", bottom: 0, width: "100%", height: "160px", background: "linear-gradient(transparent, rgba(0,0,0,0.8))", display: "flex", alignItems: "center", justifyContent: "space-around", zIndex: 20 }, children: [
951
+ /* @__PURE__ */ r.jsxs(
920
952
  "div",
921
953
  {
922
- onClick: _,
954
+ onClick: O,
923
955
  style: {
924
956
  width: "64px",
925
957
  height: "64px",
926
958
  position: "relative",
927
- cursor: l.length > 0 ? "pointer" : "default",
928
- opacity: l.length > 0 ? 1 : 0.4,
959
+ cursor: a.length > 0 ? "pointer" : "default",
960
+ opacity: a.length > 0 ? 1 : 0.4,
929
961
  transition: "transform 0.2s"
930
962
  },
931
- onMouseDown: (y) => l.length > 0 && (y.currentTarget.style.transform = "scale(0.9)"),
932
- onMouseUp: (y) => y.currentTarget.style.transform = "scale(1)",
963
+ onMouseDown: (v) => a.length > 0 && (v.currentTarget.style.transform = "scale(0.9)"),
964
+ onMouseUp: (v) => v.currentTarget.style.transform = "scale(1)",
933
965
  children: [
934
- l.length > 0 ? /* @__PURE__ */ j.jsxs(j.Fragment, { children: [
935
- /* @__PURE__ */ j.jsx("img", { src: l[l.length - 1], style: { width: "100%", height: "100%", objectFit: "cover", border: "2px solid #fff", borderRadius: "4px" }, alt: "preview" }),
936
- /* @__PURE__ */ j.jsx("div", { style: { position: "absolute", top: "-8px", right: "-8px", background: "#00FF46", color: "#000", width: "22px", height: "22px", borderRadius: "50%", fontSize: "12px", fontWeight: "bold", display: "flex", alignItems: "center", justifyContent: "center", border: "2px solid #000" }, children: l.length })
937
- ] }) : /* @__PURE__ */ j.jsx("div", { style: { width: "100%", height: "100%", borderRadius: "4px", backgroundColor: "rgba(255,255,255,0.1)", border: "1px dashed #555" } }),
938
- /* @__PURE__ */ j.jsx("span", { style: { fontSize: "10px", display: "block", textAlign: "center", marginTop: "4px", color: "#fff" }, children: "DONE" })
966
+ a.length > 0 ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
967
+ /* @__PURE__ */ r.jsx("img", { src: a[a.length - 1], style: { width: "100%", height: "100%", objectFit: "cover", border: "2px solid #fff", borderRadius: "4px" }, alt: "preview" }),
968
+ /* @__PURE__ */ r.jsx("div", { style: { position: "absolute", top: "-8px", right: "-8px", background: "#00FF46", color: "#000", width: "22px", height: "22px", borderRadius: "50%", fontSize: "12px", fontWeight: "bold", display: "flex", alignItems: "center", justifyContent: "center", border: "2px solid #000" }, children: a.length })
969
+ ] }) : /* @__PURE__ */ r.jsx("div", { style: { width: "100%", height: "100%", borderRadius: "4px", backgroundColor: "rgba(255,255,255,0.1)", border: "1px dashed #555" } }),
970
+ /* @__PURE__ */ r.jsx("span", { style: { fontSize: "10px", display: "block", textAlign: "center", marginTop: "4px", color: "#fff" }, children: "DONE" })
939
971
  ]
940
972
  }
941
973
  ),
942
- /* @__PURE__ */ j.jsx("button", { onClick: d, disabled: !a, style: { width: "84px", height: "84px", borderRadius: "50%", border: `4px solid ${a ? "#00FF46" : "#555"}`, backgroundColor: "transparent", cursor: "pointer", display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ j.jsx("div", { style: { width: "68px", height: "68px", borderRadius: "50%", backgroundColor: a ? "#fff" : "#444" } }) }),
943
- /* @__PURE__ */ j.jsx("div", { style: { width: "64px" } })
974
+ /* @__PURE__ */ r.jsx("button", { onClick: R, disabled: !c, style: { width: "84px", height: "84px", borderRadius: "50%", border: `4px solid ${c ? "#00FF46" : "#555"}`, backgroundColor: "transparent", cursor: "pointer", display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ r.jsx("div", { style: { width: "68px", height: "68px", borderRadius: "50%", backgroundColor: c ? "#fff" : "#444" } }) }),
975
+ /* @__PURE__ */ r.jsx("div", { style: { width: "64px" } })
944
976
  ] })
945
977
  ] });
946
978
  };
947
- function mt() {
948
- const [A, r] = ie(null);
949
- return /* @__PURE__ */ j.jsxs("div", { style: { textAlign: "center", padding: "20px", fontFamily: "sans-serif" }, children: [
950
- /* @__PURE__ */ j.jsx("h1", { children: "JS Doc Scanner" }),
951
- A ? /* @__PURE__ */ j.jsxs("div", { children: [
952
- /* @__PURE__ */ j.jsx("h3", { children: "Scanned Result:" }),
953
- A == null ? void 0 : A.map((o, a) => /* @__PURE__ */ j.jsx(
954
- "img",
955
- {
956
- src: o,
957
- style: { width: "100%", maxWidth: "400px", border: "2px solid #ccc", margin: "10px" }
958
- },
959
- a
960
- )),
961
- /* @__PURE__ */ j.jsx("br", {}),
962
- /* @__PURE__ */ j.jsx("button", { onClick: () => r(null), children: "Scan Again" })
963
- ] }) : /* @__PURE__ */ j.jsx(bt, { onCapture: (o) => r(o) })
979
+ const Le = () => /* @__PURE__ */ r.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
980
+ /* @__PURE__ */ r.jsx("path", { d: "M3 7V5a2 2 0 0 1 2-2h2" }),
981
+ /* @__PURE__ */ r.jsx("path", { d: "M17 3h2a2 2 0 0 1 2 2v2" }),
982
+ /* @__PURE__ */ r.jsx("path", { d: "M21 17v2a2 2 0 0 1-2 2h-2" }),
983
+ /* @__PURE__ */ r.jsx("path", { d: "M7 21H5a2 2 0 0 1-2-2v-2" }),
984
+ /* @__PURE__ */ r.jsx("rect", { x: "7", y: "7", width: "10", height: "10", rx: "1" })
985
+ ] }), $e = () => /* @__PURE__ */ r.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
986
+ /* @__PURE__ */ r.jsx("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
987
+ /* @__PURE__ */ r.jsx("polyline", { points: "14,2 14,8 20,8" }),
988
+ /* @__PURE__ */ r.jsx("line", { x1: "16", y1: "13", x2: "8", y2: "13" }),
989
+ /* @__PURE__ */ r.jsx("line", { x1: "16", y1: "17", x2: "8", y2: "17" }),
990
+ /* @__PURE__ */ r.jsx("polyline", { points: "10,9 9,9 8,9" })
991
+ ] }), jt = () => /* @__PURE__ */ r.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ r.jsx("path", { d: "M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z" }) }), Ct = () => /* @__PURE__ */ r.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ r.jsx("path", { d: "M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z" }) }), ze = () => /* @__PURE__ */ r.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
992
+ /* @__PURE__ */ r.jsx("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
993
+ /* @__PURE__ */ r.jsx("polyline", { points: "7 10 12 15 17 10" }),
994
+ /* @__PURE__ */ r.jsx("line", { x1: "12", y1: "15", x2: "12", y2: "3" })
995
+ ] }), wt = () => /* @__PURE__ */ r.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
996
+ /* @__PURE__ */ r.jsx("polyline", { points: "23 4 23 10 17 10" }),
997
+ /* @__PURE__ */ r.jsx("polyline", { points: "1 20 1 14 7 14" }),
998
+ /* @__PURE__ */ r.jsx("path", { d: "M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15" })
999
+ ] });
1000
+ function Et() {
1001
+ const [D, i] = te(null), [n, l] = te(!1), c = (s) => {
1002
+ i(s), l(!1);
1003
+ }, x = () => {
1004
+ l(!0);
1005
+ }, u = () => {
1006
+ i(null), l(!0);
1007
+ }, f = (s, h) => {
1008
+ const p = document.createElement("a");
1009
+ p.href = s, p.download = `scanned-document-${h + 1}.jpg`, document.body.appendChild(p), p.click(), document.body.removeChild(p);
1010
+ }, a = () => {
1011
+ D == null || D.forEach((s, h) => {
1012
+ setTimeout(() => f(s, h), h * 200);
1013
+ });
1014
+ }, b = () => {
1015
+ l(!1);
1016
+ };
1017
+ return n ? /* @__PURE__ */ r.jsx(yt, { onCapture: c, onClose: b }) : /* @__PURE__ */ r.jsxs("div", { className: "app-container", children: [
1018
+ /* @__PURE__ */ r.jsx("header", { className: "header", children: /* @__PURE__ */ r.jsxs("div", { className: "header-content", children: [
1019
+ /* @__PURE__ */ r.jsxs("a", { href: "/", className: "logo", children: [
1020
+ /* @__PURE__ */ r.jsx("div", { className: "logo-icon", children: /* @__PURE__ */ r.jsx(Le, {}) }),
1021
+ /* @__PURE__ */ r.jsx("span", { className: "logo-text", children: "DocScanner" })
1022
+ ] }),
1023
+ /* @__PURE__ */ r.jsx("span", { className: "header-badge", children: "✨ 100% Browser-based" })
1024
+ ] }) }),
1025
+ /* @__PURE__ */ r.jsxs("main", { className: "main-content", children: [
1026
+ /* @__PURE__ */ r.jsxs("section", { className: "hero-section", children: [
1027
+ /* @__PURE__ */ r.jsx("h1", { className: "hero-title", children: D ? "Your Scanned Documents" : "Smart Document Scanner" }),
1028
+ /* @__PURE__ */ r.jsx("p", { className: "hero-subtitle", children: D ? `Successfully captured ${D.length} document${D.length > 1 ? "s" : ""}` : "Capture, enhance, and digitize your documents with precision edge detection — all in your browser" })
1029
+ ] }),
1030
+ D ? /* @__PURE__ */ r.jsxs("section", { className: "results-section", children: [
1031
+ /* @__PURE__ */ r.jsxs("div", { className: "results-header", children: [
1032
+ /* @__PURE__ */ r.jsxs("h2", { className: "results-title", children: [
1033
+ /* @__PURE__ */ r.jsx($e, {}),
1034
+ /* @__PURE__ */ r.jsx("span", { children: "Scanned Documents" }),
1035
+ /* @__PURE__ */ r.jsx("span", { className: "results-count", children: D.length })
1036
+ ] }),
1037
+ /* @__PURE__ */ r.jsxs("div", { className: "results-actions", children: [
1038
+ /* @__PURE__ */ r.jsxs("button", { className: "btn btn-secondary", onClick: a, children: [
1039
+ /* @__PURE__ */ r.jsx(ze, {}),
1040
+ /* @__PURE__ */ r.jsx("span", { children: "Download All" })
1041
+ ] }),
1042
+ /* @__PURE__ */ r.jsxs("button", { className: "btn btn-primary", onClick: u, children: [
1043
+ /* @__PURE__ */ r.jsx(wt, {}),
1044
+ /* @__PURE__ */ r.jsx("span", { children: "Scan More" })
1045
+ ] })
1046
+ ] })
1047
+ ] }),
1048
+ /* @__PURE__ */ r.jsx("div", { className: "results-grid", children: D.map((s, h) => /* @__PURE__ */ r.jsxs(
1049
+ "article",
1050
+ {
1051
+ className: "result-card animate-fade-in",
1052
+ style: { animationDelay: `${h * 0.1}s` },
1053
+ children: [
1054
+ /* @__PURE__ */ r.jsxs("span", { className: "result-card-number", children: [
1055
+ "#",
1056
+ h + 1
1057
+ ] }),
1058
+ /* @__PURE__ */ r.jsx(
1059
+ "img",
1060
+ {
1061
+ src: s,
1062
+ alt: `Scanned document ${h + 1}`,
1063
+ className: "result-card-image"
1064
+ }
1065
+ ),
1066
+ /* @__PURE__ */ r.jsx("div", { className: "result-card-overlay" }),
1067
+ /* @__PURE__ */ r.jsx("div", { className: "result-card-actions", children: /* @__PURE__ */ r.jsx(
1068
+ "button",
1069
+ {
1070
+ className: "btn btn-icon",
1071
+ onClick: (p) => {
1072
+ p.stopPropagation(), f(s, h);
1073
+ },
1074
+ title: "Download",
1075
+ children: /* @__PURE__ */ r.jsx(ze, {})
1076
+ }
1077
+ ) })
1078
+ ]
1079
+ },
1080
+ h
1081
+ )) })
1082
+ ] }) : /* @__PURE__ */ r.jsxs("section", { className: "empty-state animate-fade-in", children: [
1083
+ /* @__PURE__ */ r.jsx("div", { className: "empty-state-icon", children: /* @__PURE__ */ r.jsx($e, {}) }),
1084
+ /* @__PURE__ */ r.jsx("h3", { className: "empty-state-title", children: "No Documents Scanned Yet" }),
1085
+ /* @__PURE__ */ r.jsx("p", { className: "empty-state-text", children: "Start scanning to capture and enhance your documents instantly" }),
1086
+ /* @__PURE__ */ r.jsxs("button", { className: "btn btn-primary", onClick: x, children: [
1087
+ /* @__PURE__ */ r.jsx(Le, {}),
1088
+ " Start Scanning"
1089
+ ] })
1090
+ ] })
1091
+ ] }),
1092
+ /* @__PURE__ */ r.jsx("footer", { className: "footer", children: /* @__PURE__ */ r.jsxs("div", { className: "footer-content", children: [
1093
+ /* @__PURE__ */ r.jsxs("div", { className: "footer-links", children: [
1094
+ /* @__PURE__ */ r.jsxs(
1095
+ "a",
1096
+ {
1097
+ href: "https://github.com/uzair2244/document-scanner",
1098
+ target: "_blank",
1099
+ rel: "noopener noreferrer",
1100
+ className: "footer-link",
1101
+ children: [
1102
+ /* @__PURE__ */ r.jsx(jt, {}),
1103
+ /* @__PURE__ */ r.jsx("span", { children: "View on GitHub" })
1104
+ ]
1105
+ }
1106
+ ),
1107
+ /* @__PURE__ */ r.jsxs(
1108
+ "a",
1109
+ {
1110
+ href: "https://www.linkedin.com/in/muhammad-uzair-shahid-rao/",
1111
+ target: "_blank",
1112
+ rel: "noopener noreferrer",
1113
+ className: "footer-link",
1114
+ children: [
1115
+ /* @__PURE__ */ r.jsx(Ct, {}),
1116
+ /* @__PURE__ */ r.jsx("span", { children: "Connect on LinkedIn" })
1117
+ ]
1118
+ }
1119
+ )
1120
+ ] }),
1121
+ /* @__PURE__ */ r.jsxs("p", { className: "footer-text", children: [
1122
+ "Built with ❤️ by",
1123
+ " ",
1124
+ /* @__PURE__ */ r.jsx(
1125
+ "a",
1126
+ {
1127
+ href: "https://www.linkedin.com/in/muhammad-uzair-shahid-rao/",
1128
+ target: "_blank",
1129
+ rel: "noopener noreferrer",
1130
+ children: "Muhammad Uzair Shahid Rao"
1131
+ }
1132
+ ),
1133
+ " ",
1134
+ "• © ",
1135
+ (/* @__PURE__ */ new Date()).getFullYear(),
1136
+ " DocScanner"
1137
+ ] })
1138
+ ] }) })
964
1139
  ] });
965
1140
  }
966
1141
  export {
967
- mt as App,
968
- bt as DocumentScanner
1142
+ Et as App,
1143
+ yt as DocumentScanner
969
1144
  };