@genai-fi/base 3.0.1 → 3.0.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.
@@ -8,6 +8,7 @@ import "./webrtcState-D0nJpE9Z.js";
8
8
  import { B as It } from "./Button-DQwRVw4a.js";
9
9
  import "./index-SOhdqzHq.js";
10
10
  import "./style/theme.js";
11
+ import "./util/canvas.js";
11
12
  import "./FileSaver.min-DhePf63e.js";
12
13
  import "./components/BusyButton/BusyButton.js";
13
14
  import './assets/DialogQR.css';var V = {}, $, Tt;
@@ -190,7 +191,7 @@ function Ee() {
190
191
  }(tt)), tt;
191
192
  }
192
193
  var et = {}, vt;
193
- function Be() {
194
+ function pe() {
194
195
  if (vt) return et;
195
196
  vt = 1;
196
197
  const r = F().getSymbolSize, o = 7;
@@ -207,7 +208,7 @@ function Be() {
207
208
  }, et;
208
209
  }
209
210
  var nt = {}, Dt;
210
- function pe() {
211
+ function Be() {
211
212
  return Dt || (Dt = 1, function(r) {
212
213
  r.Patterns = {
213
214
  PATTERN000: 0,
@@ -232,11 +233,11 @@ function pe() {
232
233
  }, r.getPenaltyN1 = function(t) {
233
234
  const e = t.size;
234
235
  let s = 0, a = 0, u = 0, c = null, d = null;
235
- for (let B = 0; B < e; B++) {
236
+ for (let p = 0; p < e; p++) {
236
237
  a = u = 0, c = d = null;
237
238
  for (let h = 0; h < e; h++) {
238
- let l = t.get(B, h);
239
- l === c ? a++ : (a >= 5 && (s += o.N1 + (a - 5)), c = l, a = 1), l = t.get(h, B), l === d ? u++ : (u >= 5 && (s += o.N1 + (u - 5)), d = l, u = 1);
239
+ let l = t.get(p, h);
240
+ l === c ? a++ : (a >= 5 && (s += o.N1 + (a - 5)), c = l, a = 1), l = t.get(h, p), l === d ? u++ : (u >= 5 && (s += o.N1 + (u - 5)), d = l, u = 1);
240
241
  }
241
242
  a >= 5 && (s += o.N1 + (a - 5)), u >= 5 && (s += o.N1 + (u - 5));
242
243
  }
@@ -839,7 +840,7 @@ function Te() {
839
840
  N += S + M.getBitsLength();
840
841
  }), N;
841
842
  }
842
- function B(h, l) {
843
+ function p(h, l) {
843
844
  for (let N = 1; N <= 40; N++)
844
845
  if (d(h, N) <= r.getCapacity(N, l, t.MIXED))
845
846
  return N;
@@ -869,7 +870,7 @@ function Te() {
869
870
  const S = n.from(N, n.M);
870
871
  if (Array.isArray(l)) {
871
872
  if (l.length > 1)
872
- return B(l, S);
873
+ return p(l, S);
873
874
  if (l.length === 0)
874
875
  return 1;
875
876
  M = l[0];
@@ -1079,10 +1080,10 @@ function De() {
1079
1080
  s[n] = 0;
1080
1081
  var a = o.PriorityQueue.make();
1081
1082
  a.push(n, 0);
1082
- for (var u, c, d, B, h, l, N, M, S; !a.empty(); ) {
1083
- u = a.pop(), c = u.value, B = u.cost, h = i[c] || {};
1083
+ for (var u, c, d, p, h, l, N, M, S; !a.empty(); ) {
1084
+ u = a.pop(), c = u.value, p = u.cost, h = i[c] || {};
1084
1085
  for (d in h)
1085
- h.hasOwnProperty(d) && (l = h[d], N = B + l, M = s[d], S = typeof s[d] > "u", (S || M > N) && (s[d] = N, a.push(d, N), e[d] = c));
1086
+ h.hasOwnProperty(d) && (l = h[d], N = p + l, M = s[d], S = typeof s[d] > "u", (S || M > N) && (s[d] = N, a.push(d, N), e[d] = c));
1086
1087
  }
1087
1088
  if (typeof t < "u" && typeof s[t] > "u") {
1088
1089
  var R = ["Could not find a path from ", n, " to ", t, "."].join("");
@@ -1146,21 +1147,21 @@ function Le() {
1146
1147
  return unescape(encodeURIComponent(R)).length;
1147
1148
  }
1148
1149
  function d(R, P, I) {
1149
- const p = [];
1150
+ const B = [];
1150
1151
  let b;
1151
1152
  for (; (b = R.exec(I)) !== null; )
1152
- p.push({
1153
+ B.push({
1153
1154
  data: b[0],
1154
1155
  index: b.index,
1155
1156
  mode: P,
1156
1157
  length: b[0].length
1157
1158
  });
1158
- return p;
1159
+ return B;
1159
1160
  }
1160
- function B(R) {
1161
+ function p(R) {
1161
1162
  const P = d(s.NUMERIC, o.NUMERIC, R), I = d(s.ALPHANUMERIC, o.ALPHANUMERIC, R);
1162
- let p, b;
1163
- return a.isKanjiModeEnabled() ? (p = d(s.BYTE, o.BYTE, R), b = d(s.KANJI, o.KANJI, R)) : (p = d(s.BYTE_KANJI, o.BYTE, R), b = []), P.concat(I, p, b).sort(function(y, C) {
1163
+ let B, b;
1164
+ return a.isKanjiModeEnabled() ? (B = d(s.BYTE, o.BYTE, R), b = d(s.KANJI, o.KANJI, R)) : (B = d(s.BYTE_KANJI, o.BYTE, R), b = []), P.concat(I, B, b).sort(function(y, C) {
1164
1165
  return y.index - C.index;
1165
1166
  }).map(function(y) {
1166
1167
  return {
@@ -1184,67 +1185,67 @@ function Le() {
1184
1185
  }
1185
1186
  function l(R) {
1186
1187
  return R.reduce(function(P, I) {
1187
- const p = P.length - 1 >= 0 ? P[P.length - 1] : null;
1188
- return p && p.mode === I.mode ? (P[P.length - 1].data += I.data, P) : (P.push(I), P);
1188
+ const B = P.length - 1 >= 0 ? P[P.length - 1] : null;
1189
+ return B && B.mode === I.mode ? (P[P.length - 1].data += I.data, P) : (P.push(I), P);
1189
1190
  }, []);
1190
1191
  }
1191
1192
  function N(R) {
1192
1193
  const P = [];
1193
1194
  for (let I = 0; I < R.length; I++) {
1194
- const p = R[I];
1195
- switch (p.mode) {
1195
+ const B = R[I];
1196
+ switch (B.mode) {
1196
1197
  case o.NUMERIC:
1197
1198
  P.push([
1198
- p,
1199
- { data: p.data, mode: o.ALPHANUMERIC, length: p.length },
1200
- { data: p.data, mode: o.BYTE, length: p.length }
1199
+ B,
1200
+ { data: B.data, mode: o.ALPHANUMERIC, length: B.length },
1201
+ { data: B.data, mode: o.BYTE, length: B.length }
1201
1202
  ]);
1202
1203
  break;
1203
1204
  case o.ALPHANUMERIC:
1204
1205
  P.push([
1205
- p,
1206
- { data: p.data, mode: o.BYTE, length: p.length }
1206
+ B,
1207
+ { data: B.data, mode: o.BYTE, length: B.length }
1207
1208
  ]);
1208
1209
  break;
1209
1210
  case o.KANJI:
1210
1211
  P.push([
1211
- p,
1212
- { data: p.data, mode: o.BYTE, length: c(p.data) }
1212
+ B,
1213
+ { data: B.data, mode: o.BYTE, length: c(B.data) }
1213
1214
  ]);
1214
1215
  break;
1215
1216
  case o.BYTE:
1216
1217
  P.push([
1217
- { data: p.data, mode: o.BYTE, length: c(p.data) }
1218
+ { data: B.data, mode: o.BYTE, length: c(B.data) }
1218
1219
  ]);
1219
1220
  }
1220
1221
  }
1221
1222
  return P;
1222
1223
  }
1223
1224
  function M(R, P) {
1224
- const I = {}, p = { start: {} };
1225
+ const I = {}, B = { start: {} };
1225
1226
  let b = ["start"];
1226
1227
  for (let g = 0; g < R.length; g++) {
1227
1228
  const y = R[g], C = [];
1228
1229
  for (let f = 0; f < y.length; f++) {
1229
1230
  const A = y[f], m = "" + g + f;
1230
- C.push(m), I[m] = { node: A, lastCount: 0 }, p[m] = {};
1231
+ C.push(m), I[m] = { node: A, lastCount: 0 }, B[m] = {};
1231
1232
  for (let E = 0; E < b.length; E++) {
1232
1233
  const w = b[E];
1233
- I[w] && I[w].node.mode === A.mode ? (p[w][m] = h(I[w].lastCount + A.length, A.mode) - h(I[w].lastCount, A.mode), I[w].lastCount += A.length) : (I[w] && (I[w].lastCount = A.length), p[w][m] = h(A.length, A.mode) + 4 + o.getCharCountIndicator(A.mode, P));
1234
+ I[w] && I[w].node.mode === A.mode ? (B[w][m] = h(I[w].lastCount + A.length, A.mode) - h(I[w].lastCount, A.mode), I[w].lastCount += A.length) : (I[w] && (I[w].lastCount = A.length), B[w][m] = h(A.length, A.mode) + 4 + o.getCharCountIndicator(A.mode, P));
1234
1235
  }
1235
1236
  }
1236
1237
  b = C;
1237
1238
  }
1238
1239
  for (let g = 0; g < b.length; g++)
1239
- p[b[g]].end = 0;
1240
- return { map: p, table: I };
1240
+ B[b[g]].end = 0;
1241
+ return { map: B, table: I };
1241
1242
  }
1242
1243
  function S(R, P) {
1243
1244
  let I;
1244
- const p = o.getBestModeForData(R);
1245
- if (I = o.from(P, p), I !== o.BYTE && I.bit < p.bit)
1245
+ const B = o.getBestModeForData(R);
1246
+ if (I = o.from(P, B), I !== o.BYTE && I.bit < B.bit)
1246
1247
  throw new Error('"' + R + '" cannot be encoded with mode ' + o.toString(I) + `.
1247
- Suggested mode is: ` + o.toString(p));
1248
+ Suggested mode is: ` + o.toString(B));
1248
1249
  switch (I === o.KANJI && !a.isKanjiModeEnabled() && (I = o.BYTE), I) {
1249
1250
  case o.NUMERIC:
1250
1251
  return new i(R);
@@ -1257,17 +1258,17 @@ function Le() {
1257
1258
  }
1258
1259
  }
1259
1260
  r.fromArray = function(P) {
1260
- return P.reduce(function(I, p) {
1261
- return typeof p == "string" ? I.push(S(p, null)) : p.data && I.push(S(p.data, p.mode)), I;
1261
+ return P.reduce(function(I, B) {
1262
+ return typeof B == "string" ? I.push(S(B, null)) : B.data && I.push(S(B.data, B.mode)), I;
1262
1263
  }, []);
1263
1264
  }, r.fromString = function(P, I) {
1264
- const p = B(P, a.isKanjiModeEnabled()), b = N(p), g = M(b, I), y = u.find_path(g.map, "start", "end"), C = [];
1265
+ const B = p(P, a.isKanjiModeEnabled()), b = N(B), g = M(b, I), y = u.find_path(g.map, "start", "end"), C = [];
1265
1266
  for (let f = 1; f < y.length - 1; f++)
1266
1267
  C.push(g.table[y[f]].node);
1267
1268
  return r.fromArray(l(C));
1268
1269
  }, r.rawSplit = function(P) {
1269
1270
  return r.fromArray(
1270
- B(P, a.isKanjiModeEnabled())
1271
+ p(P, a.isKanjiModeEnabled())
1271
1272
  );
1272
1273
  };
1273
1274
  }(ct)), ct;
@@ -1276,7 +1277,7 @@ var $t;
1276
1277
  function _e() {
1277
1278
  if ($t) return W;
1278
1279
  $t = 1;
1279
- const r = F(), o = Et(), i = Ce(), n = ye(), t = Ee(), e = Be(), s = pe(), a = te(), u = Ie(), c = Te(), d = Ne(), B = k(), h = Le();
1280
+ const r = F(), o = Et(), i = Ce(), n = ye(), t = Ee(), e = pe(), s = Be(), a = te(), u = Ie(), c = Te(), d = Ne(), p = k(), h = Le();
1280
1281
  function l(g, y) {
1281
1282
  const C = g.size, f = e.getPositions(y);
1282
1283
  for (let A = 0; A < f.length; A++) {
@@ -1335,7 +1336,7 @@ function _e() {
1335
1336
  function I(g, y, C) {
1336
1337
  const f = new i();
1337
1338
  C.forEach(function(T) {
1338
- f.put(T.mode.bit, 4), f.put(T.getLength(), B.getCharCountIndicator(T.mode, g)), T.write(f);
1339
+ f.put(T.mode.bit, 4), f.put(T.getLength(), p.getCharCountIndicator(T.mode, g)), T.write(f);
1339
1340
  });
1340
1341
  const A = r.getSymbolTotalCodewords(g), m = a.getTotalCodewordsCount(g, y), E = (A - m) * 8;
1341
1342
  for (f.getLengthInBits() + 4 <= E && f.put(0, 4); f.getLengthInBits() % 8 !== 0; )
@@ -1343,26 +1344,26 @@ function _e() {
1343
1344
  const w = (E - f.getLengthInBits()) / 8;
1344
1345
  for (let T = 0; T < w; T++)
1345
1346
  f.put(T % 2 ? 17 : 236, 8);
1346
- return p(f, g, y);
1347
+ return B(f, g, y);
1347
1348
  }
1348
- function p(g, y, C) {
1349
- const f = r.getSymbolTotalCodewords(y), A = a.getTotalCodewordsCount(y, C), m = f - A, E = a.getBlocksCount(y, C), w = f % E, T = E - w, _ = Math.floor(f / E), H = Math.floor(m / E), oe = H + 1, Bt = _ - H, ie = new u(Bt);
1349
+ function B(g, y, C) {
1350
+ const f = r.getSymbolTotalCodewords(y), A = a.getTotalCodewordsCount(y, C), m = f - A, E = a.getBlocksCount(y, C), w = f % E, T = E - w, _ = Math.floor(f / E), H = Math.floor(m / E), oe = H + 1, pt = _ - H, ie = new u(pt);
1350
1351
  let Y = 0;
1351
- const J = new Array(E), pt = new Array(E);
1352
+ const J = new Array(E), Bt = new Array(E);
1352
1353
  let O = 0;
1353
1354
  const se = new Uint8Array(g.buffer);
1354
1355
  for (let z = 0; z < E; z++) {
1355
1356
  const Q = z < T ? H : oe;
1356
- J[z] = se.slice(Y, Y + Q), pt[z] = ie.encode(J[z]), Y += Q, O = Math.max(O, Q);
1357
+ J[z] = se.slice(Y, Y + Q), Bt[z] = ie.encode(J[z]), Y += Q, O = Math.max(O, Q);
1357
1358
  }
1358
1359
  const G = new Uint8Array(f);
1359
1360
  let At = 0, D, L;
1360
1361
  for (D = 0; D < O; D++)
1361
1362
  for (L = 0; L < E; L++)
1362
1363
  D < J[L].length && (G[At++] = J[L][D]);
1363
- for (D = 0; D < Bt; D++)
1364
+ for (D = 0; D < pt; D++)
1364
1365
  for (L = 0; L < E; L++)
1365
- G[At++] = pt[L][D];
1366
+ G[At++] = Bt[L][D];
1366
1367
  return G;
1367
1368
  }
1368
1369
  function b(g, y, C, f) {
@@ -1450,13 +1451,13 @@ function re() {
1450
1451
  const e = r.getScale(n, t);
1451
1452
  return Math.floor((n + t.margin * 2) * e);
1452
1453
  }, r.qrToImageData = function(n, t, e) {
1453
- const s = t.modules.size, a = t.modules.data, u = r.getScale(s, e), c = Math.floor((s + e.margin * 2) * u), d = e.margin * u, B = [e.color.light, e.color.dark];
1454
+ const s = t.modules.size, a = t.modules.data, u = r.getScale(s, e), c = Math.floor((s + e.margin * 2) * u), d = e.margin * u, p = [e.color.light, e.color.dark];
1454
1455
  for (let h = 0; h < c; h++)
1455
1456
  for (let l = 0; l < c; l++) {
1456
1457
  let N = (h * c + l) * 4, M = e.color.light;
1457
1458
  if (h >= d && l >= d && h < c - d && l < c - d) {
1458
1459
  const S = Math.floor((h - d) / u), R = Math.floor((l - d) / u);
1459
- M = B[a[S * s + R] ? 1 : 0];
1460
+ M = p[a[S * s + R] ? 1 : 0];
1460
1461
  }
1461
1462
  n[N++] = M.r, n[N++] = M.g, n[N++] = M.b, n[N] = M.a;
1462
1463
  }
@@ -1480,13 +1481,13 @@ function qe() {
1480
1481
  r.render = function(e, s, a) {
1481
1482
  let u = a, c = s;
1482
1483
  typeof u > "u" && (!s || !s.getContext) && (u = s, s = void 0), s || (c = n()), u = o.getOptions(u);
1483
- const d = o.getImageWidth(e.modules.size, u), B = c.getContext("2d"), h = B.createImageData(d, d);
1484
- return o.qrToImageData(h.data, e, u), i(B, c, d), B.putImageData(h, 0, 0), c;
1484
+ const d = o.getImageWidth(e.modules.size, u), p = c.getContext("2d"), h = p.createImageData(d, d);
1485
+ return o.qrToImageData(h.data, e, u), i(p, c, d), p.putImageData(h, 0, 0), c;
1485
1486
  }, r.renderToDataURL = function(e, s, a) {
1486
1487
  let u = a;
1487
1488
  typeof u > "u" && (!s || !s.getContext) && (u = s, s = void 0), u || (u = {});
1488
- const c = r.render(e, s, u), d = u.type || "image/png", B = u.rendererOpts || {};
1489
- return c.toDataURL(d, B.quality);
1489
+ const c = r.render(e, s, u), d = u.type || "image/png", p = u.rendererOpts || {};
1490
+ return c.toDataURL(d, p.quality);
1490
1491
  };
1491
1492
  }(wt)), wt;
1492
1493
  }
@@ -1505,14 +1506,14 @@ function Ue() {
1505
1506
  }
1506
1507
  function n(t, e, s) {
1507
1508
  let a = "", u = 0, c = !1, d = 0;
1508
- for (let B = 0; B < t.length; B++) {
1509
- const h = Math.floor(B % e), l = Math.floor(B / e);
1510
- !h && !c && (c = !0), t[B] ? (d++, B > 0 && h > 0 && t[B - 1] || (a += c ? i("M", h + s, 0.5 + l + s) : i("m", u, 0), u = 0, c = !1), h + 1 < e && t[B + 1] || (a += i("h", d), d = 0)) : u++;
1509
+ for (let p = 0; p < t.length; p++) {
1510
+ const h = Math.floor(p % e), l = Math.floor(p / e);
1511
+ !h && !c && (c = !0), t[p] ? (d++, p > 0 && h > 0 && t[p - 1] || (a += c ? i("M", h + s, 0.5 + l + s) : i("m", u, 0), u = 0, c = !1), h + 1 < e && t[p + 1] || (a += i("h", d), d = 0)) : u++;
1511
1512
  }
1512
1513
  return a;
1513
1514
  }
1514
1515
  return yt.render = function(e, s, a) {
1515
- const u = r.getOptions(s), c = e.modules.size, d = e.modules.data, B = c + u.margin * 2, h = u.color.light.a ? "<path " + o(u.color.light, "fill") + ' d="M0 0h' + B + "v" + B + 'H0z"/>' : "", l = "<path " + o(u.color.dark, "stroke") + ' d="' + n(d, c, u.margin) + '"/>', N = 'viewBox="0 0 ' + B + " " + B + '"', S = '<svg xmlns="http://www.w3.org/2000/svg" ' + (u.width ? 'width="' + u.width + '" height="' + u.width + '" ' : "") + N + ' shape-rendering="crispEdges">' + h + l + `</svg>
1516
+ const u = r.getOptions(s), c = e.modules.size, d = e.modules.data, p = c + u.margin * 2, h = u.color.light.a ? "<path " + o(u.color.light, "fill") + ' d="M0 0h' + p + "v" + p + 'H0z"/>' : "", l = "<path " + o(u.color.dark, "stroke") + ' d="' + n(d, c, u.margin) + '"/>', N = 'viewBox="0 0 ' + p + " " + p + '"', S = '<svg xmlns="http://www.w3.org/2000/svg" ' + (u.width ? 'width="' + u.width + '" height="' + u.width + '" ' : "") + N + ' shape-rendering="crispEdges">' + h + l + `</svg>
1516
1517
  `;
1517
1518
  return typeof a == "function" && a(null, S), S;
1518
1519
  }, yt;
@@ -1523,17 +1524,17 @@ function Fe() {
1523
1524
  Xt = 1;
1524
1525
  const r = we(), o = _e(), i = qe(), n = Ue();
1525
1526
  function t(e, s, a, u, c) {
1526
- const d = [].slice.call(arguments, 1), B = d.length, h = typeof d[B - 1] == "function";
1527
+ const d = [].slice.call(arguments, 1), p = d.length, h = typeof d[p - 1] == "function";
1527
1528
  if (!h && !r())
1528
1529
  throw new Error("Callback required as last argument");
1529
1530
  if (h) {
1530
- if (B < 2)
1531
+ if (p < 2)
1531
1532
  throw new Error("Too few arguments provided");
1532
- B === 2 ? (c = a, a = s, s = u = void 0) : B === 3 && (s.getContext && typeof c > "u" ? (c = u, u = void 0) : (c = u, u = a, a = s, s = void 0));
1533
+ p === 2 ? (c = a, a = s, s = u = void 0) : p === 3 && (s.getContext && typeof c > "u" ? (c = u, u = void 0) : (c = u, u = a, a = s, s = void 0));
1533
1534
  } else {
1534
- if (B < 1)
1535
+ if (p < 1)
1535
1536
  throw new Error("Too few arguments provided");
1536
- return B === 1 ? (a = s, s = u = void 0) : B === 2 && !s.getContext && (u = a, a = s, s = void 0), new Promise(function(l, N) {
1537
+ return p === 1 ? (a = s, s = u = void 0) : p === 2 && !s.getContext && (u = a, a = s, s = void 0), new Promise(function(l, N) {
1537
1538
  try {
1538
1539
  const M = o.create(a, u);
1539
1540
  l(e(M, s, u));
@@ -1562,7 +1563,7 @@ const ze = /* @__PURE__ */ le(ke), Ve = "_link_1udre_3", He = "_container_1udre_
1562
1563
  }, Ye = me(/* @__PURE__ */ U("path", {
1563
1564
  d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"
1564
1565
  }), "ContentCopy");
1565
- function on({ url: r, open: o, onClose: i }) {
1566
+ function sn({ url: r, open: o, onClose: i }) {
1566
1567
  var s;
1567
1568
  const { t: n } = he("translation"), t = ue(null), e = ae(() => {
1568
1569
  navigator.clipboard.writeText(r);
@@ -1619,7 +1620,7 @@ function on({ url: r, open: o, onClose: i }) {
1619
1620
  );
1620
1621
  }
1621
1622
  export {
1622
- on as D,
1623
+ sn as D,
1623
1624
  ze as q,
1624
1625
  je as s
1625
1626
  };
@@ -1,14 +1,15 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
- import { D as u } from "../../DialogQR-BU45QB3i.js";
3
+ import { D as x } from "../../DialogQR-DVWhImXI.js";
4
4
  import "@mui/material";
5
5
  import "react-i18next";
6
6
  import "../../webrtcState-D0nJpE9Z.js";
7
7
  import "../../Button-DQwRVw4a.js";
8
8
  import "../../index-SOhdqzHq.js";
9
9
  import "../../style/theme.js";
10
+ import "../../util/canvas.js";
10
11
  import "../../FileSaver.min-DhePf63e.js";
11
12
  import "../BusyButton/BusyButton.js";
12
13
  export {
13
- u as default
14
+ x as default
14
15
  };
@@ -1,6 +1,6 @@
1
1
  import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
2
  import { useRef as h, useState as m, useEffect as u, Suspense as v } from "react";
3
- import { q as p, s as o, D as b } from "../../DialogQR-BU45QB3i.js";
3
+ import { q as p, s as o, D as b } from "../../DialogQR-DVWhImXI.js";
4
4
  function q({ url: a, size: r, code: c, label: l, dialog: d }) {
5
5
  const t = h(null), [f, n] = m(!1);
6
6
  return u(() => {
@@ -1,59 +1,60 @@
1
- function f(t, e, s, r) {
1
+ function i(t, e, s, r) {
2
2
  let n = t.width, o = t.height;
3
3
  t instanceof HTMLVideoElement && (n = t.videoWidth, o = t.videoHeight);
4
- const a = Math.min(n, o), c = e / a, l = Math.ceil(n * c), d = Math.ceil(o * c), h = l - e, u = d - e;
4
+ const a = Math.min(n, o), c = e / a, f = Math.ceil(n * c), d = Math.ceil(o * c), g = f - e, w = d - e;
5
5
  r.width = r.height = e;
6
- const i = r.getContext("2d");
7
- return i && (i.drawImage(t, ~~(h / 2) * -1, ~~(u / 2) * -1, l, d), s && (i.scale(-1, 1), i.drawImage(r, e * -1, 0))), r;
6
+ const l = r.getContext("2d");
7
+ return l && (l.drawImage(t, ~~(g / 2) * -1, ~~(w / 2) * -1, f, d), s && (l.scale(-1, 1), l.drawImage(r, e * -1, 0))), r;
8
8
  }
9
- function m(t, e = 224) {
9
+ var h, m;
10
+ const p = ((m = (h = globalThis == null ? void 0 : globalThis.process) == null ? void 0 : h.env) == null ? void 0 : m.NODE_ENV) === "test";
11
+ function u(t, e = 224) {
10
12
  return new Promise((s, r) => {
11
13
  const n = new FileReader();
12
14
  n.onabort = () => r(), n.onerror = () => r(), n.onload = () => {
13
- var c, l;
14
15
  const o = document.createElement("canvas");
15
16
  o.width = e, o.height = e;
16
17
  const a = new Image();
17
18
  a.onload = () => {
18
- f(a, e, !1, o), s(o);
19
+ i(a, e, !1, o), s(o);
19
20
  }, a.onerror = () => {
20
21
  s(o);
21
- }, a.src = n.result, ((l = (c = global == null ? void 0 : global.process) == null ? void 0 : c.env) == null ? void 0 : l.NODE_ENV) === "test" && a.onload(new Event("onload"));
22
+ }, a.src = n.result, p && a.onload(new Event("onload"));
22
23
  }, n.readAsDataURL(t);
23
24
  });
24
25
  }
25
- async function v(t, e = 224) {
26
+ async function E(t, e = 224) {
26
27
  const s = t.filter((n) => n.type.startsWith("image/"));
27
28
  if (s.length === 0)
28
29
  return [];
29
- const r = s.map((n) => m(n, e));
30
+ const r = s.map((n) => u(n, e));
30
31
  return Promise.all(r);
31
32
  }
32
- function g(t, e = 224) {
33
+ function v(t, e = 224) {
33
34
  return new Promise((s, r) => {
34
35
  const n = document.createElement("canvas");
35
36
  n.width = e, n.height = e, t.onload = () => {
36
- f(t, e, !1, n), s(n);
37
+ i(t, e, !1, n), s(n);
37
38
  }, t.onerror = r, t.onabort = r;
38
39
  });
39
40
  }
40
- function w(t, e = 224) {
41
+ function y(t, e = 224) {
41
42
  return new Promise((s, r) => {
42
43
  const n = document.createElement("canvas");
43
44
  n.width = e, n.height = e;
44
45
  const o = new Image();
45
46
  o.crossOrigin = "anonymous", o.onload = () => {
46
- f(o, e, !1, n), s(n);
47
+ i(o, e, !1, n), s(n);
47
48
  }, o.onerror = r, o.onabort = r, o.src = t;
48
49
  });
49
50
  }
50
- async function p(t, e = 224) {
51
+ async function T(t, e = 224) {
51
52
  var s;
52
53
  if ("files" in t && ((s = t.files) == null ? void 0 : s.length) > 0) {
53
54
  const n = Array.from(t.files).filter((a) => a.type.startsWith("image/"));
54
55
  if (n.length === 0)
55
56
  return [];
56
- const o = n.map((a) => m(a, e));
57
+ const o = n.map((a) => u(a, e));
57
58
  return Promise.all(o);
58
59
  }
59
60
  if ("html" in t && typeof t.html == "string") {
@@ -61,7 +62,7 @@ async function p(t, e = 224) {
61
62
  r.innerHTML = t.html;
62
63
  const n = r.getElementsByTagName("img");
63
64
  if (n.length > 0) {
64
- const o = Array.from(n).map((a) => (a.crossOrigin = "anonymous", g(a, e)));
65
+ const o = Array.from(n).map((a) => (a.crossOrigin = "anonymous", v(a, e)));
65
66
  return Promise.all(o);
66
67
  }
67
68
  }
@@ -71,22 +72,22 @@ async function p(t, e = 224) {
71
72
  const n = t.dataTransfer.getData("text/uri-list");
72
73
  if (n.length > 0) {
73
74
  const a = n.split(`
74
- `).map((c) => w(c), e);
75
+ `).map((c) => y(c), e);
75
76
  return Promise.all(a);
76
77
  }
77
78
  }
78
79
  }
79
80
  return [];
80
81
  }
81
- async function y(t, e = 224) {
82
- return (await p(t, e)).map((r) => r.toDataURL());
82
+ async function F(t, e = 224) {
83
+ return (await T(t, e)).map((r) => r.toDataURL());
83
84
  }
84
85
  export {
85
- p as canvasFromDataTransfer,
86
- m as canvasFromFile,
87
- g as canvasFromImage,
88
- w as canvasFromURL,
89
- v as canvasesFromFiles,
90
- f as cropTo,
91
- y as urlFromDataTransfer
86
+ T as canvasFromDataTransfer,
87
+ u as canvasFromFile,
88
+ v as canvasFromImage,
89
+ y as canvasFromURL,
90
+ E as canvasesFromFiles,
91
+ i as cropTo,
92
+ F as urlFromDataTransfer
92
93
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genai-fi/base",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",