@one-payments/web-components 1.1.8 → 1.1.11
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.js +224 -178
- package/dist/one-payment.d.ts +3 -1
- package/dist/one-payment.d.ts.map +1 -1
- package/dist/one-payment.js +115 -23
- package/dist/one-payment.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -284,7 +284,7 @@ Q.elementStyles = [], Q.shadowRootOptions = { mode: "open" }, Q[ie("elementPrope
|
|
|
284
284
|
* Copyright 2017 Google LLC
|
|
285
285
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
286
286
|
*/
|
|
287
|
-
const oe = globalThis, we = oe.trustedTypes, tt = we ? we.createPolicy("lit-html", { createHTML: (t) => t }) : void 0,
|
|
287
|
+
const oe = globalThis, we = oe.trustedTypes, tt = we ? we.createPolicy("lit-html", { createHTML: (t) => t }) : void 0, ft = "$lit$", L = `lit$${Math.random().toFixed(9).slice(2)}$`, mt = "?" + L, Yt = `<${mt}>`, Y = document, le = () => Y.createComment(""), de = (t) => t === null || typeof t != "object" && typeof t != "function", je = Array.isArray, Kt = (t) => je(t) || typeof (t == null ? void 0 : t[Symbol.iterator]) == "function", _e = `[
|
|
288
288
|
\f\r]`, re = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, nt = /-->/g, rt = />/g, q = RegExp(`>|${_e}(?:([^\\s"'>=/]+)(${_e}*=${_e}*(?:[^
|
|
289
289
|
\f\r"'\`<>=]|("|')|))|$)`, "g"), it = /'/g, ot = /"/g, pt = /^(?:script|style|textarea|title)$/i, Qt = (t) => (e, ...n) => ({ _$litType$: t, strings: e, values: n }), A = Qt(1), G = Symbol.for("lit-noChange"), I = Symbol.for("lit-nothing"), st = /* @__PURE__ */ new WeakMap(), V = Y.createTreeWalker(Y, 129);
|
|
290
290
|
function gt(t, e) {
|
|
@@ -296,10 +296,10 @@ const Zt = (t, e) => {
|
|
|
296
296
|
let i, o = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", s = re;
|
|
297
297
|
for (let l = 0; l < n; l++) {
|
|
298
298
|
const a = t[l];
|
|
299
|
-
let d, c, h = -1,
|
|
300
|
-
for (;
|
|
299
|
+
let d, c, h = -1, f = 0;
|
|
300
|
+
for (; f < a.length && (s.lastIndex = f, c = s.exec(a), c !== null); ) f = s.lastIndex, s === re ? c[1] === "!--" ? s = nt : c[1] !== void 0 ? s = rt : c[2] !== void 0 ? (pt.test(c[2]) && (i = RegExp("</" + c[2], "g")), s = q) : c[3] !== void 0 && (s = q) : s === q ? c[0] === ">" ? (s = i ?? re, h = -1) : c[1] === void 0 ? h = -2 : (h = s.lastIndex - c[2].length, d = c[1], s = c[3] === void 0 ? q : c[3] === '"' ? ot : it) : s === ot || s === it ? s = q : s === nt || s === rt ? s = re : (s = q, i = void 0);
|
|
301
301
|
const u = s === q && t[l + 1].startsWith("/>") ? " " : "";
|
|
302
|
-
o += s === re ? a + Yt : h >= 0 ? (r.push(d), a.slice(0, h) +
|
|
302
|
+
o += s === re ? a + Yt : h >= 0 ? (r.push(d), a.slice(0, h) + ft + a.slice(h) + L + u) : a + L + (h === -2 ? l : u);
|
|
303
303
|
}
|
|
304
304
|
return [gt(t, o + (t[n] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), r];
|
|
305
305
|
};
|
|
@@ -315,19 +315,19 @@ class ce {
|
|
|
315
315
|
}
|
|
316
316
|
for (; (i = V.nextNode()) !== null && a.length < l; ) {
|
|
317
317
|
if (i.nodeType === 1) {
|
|
318
|
-
if (i.hasAttributes()) for (const h of i.getAttributeNames()) if (h.endsWith(
|
|
319
|
-
const
|
|
320
|
-
a.push({ type: 1, index: o, name:
|
|
318
|
+
if (i.hasAttributes()) for (const h of i.getAttributeNames()) if (h.endsWith(ft)) {
|
|
319
|
+
const f = c[s++], u = i.getAttribute(h).split(L), m = /([.?@])?(.*)/.exec(f);
|
|
320
|
+
a.push({ type: 1, index: o, name: m[2], strings: u, ctor: m[1] === "." ? Jt : m[1] === "?" ? Wt : m[1] === "@" ? Xt : Se }), i.removeAttribute(h);
|
|
321
321
|
} else h.startsWith(L) && (a.push({ type: 6, index: o }), i.removeAttribute(h));
|
|
322
322
|
if (pt.test(i.tagName)) {
|
|
323
|
-
const h = i.textContent.split(L),
|
|
324
|
-
if (
|
|
323
|
+
const h = i.textContent.split(L), f = h.length - 1;
|
|
324
|
+
if (f > 0) {
|
|
325
325
|
i.textContent = we ? we.emptyScript : "";
|
|
326
|
-
for (let u = 0; u <
|
|
327
|
-
i.append(h[
|
|
326
|
+
for (let u = 0; u < f; u++) i.append(h[u], le()), V.nextNode(), a.push({ type: 2, index: ++o });
|
|
327
|
+
i.append(h[f], le());
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
-
} else if (i.nodeType === 8) if (i.data ===
|
|
330
|
+
} else if (i.nodeType === 8) if (i.data === mt) a.push({ type: 2, index: o });
|
|
331
331
|
else {
|
|
332
332
|
let h = -1;
|
|
333
333
|
for (; (h = i.data.indexOf(L, h + 1)) !== -1; ) a.push({ type: 7, index: o }), h += L.length - 1;
|
|
@@ -548,8 +548,8 @@ class se extends Q {
|
|
|
548
548
|
}
|
|
549
549
|
var ut;
|
|
550
550
|
se._$litElement$ = !0, se.finalized = !0, (ut = j.litElementHydrateSupport) == null || ut.call(j, { LitElement: se });
|
|
551
|
-
const
|
|
552
|
-
|
|
551
|
+
const Me = j.litElementPolyfillSupport;
|
|
552
|
+
Me == null || Me({ LitElement: se });
|
|
553
553
|
(j.litElementVersions ?? (j.litElementVersions = [])).push("4.2.1");
|
|
554
554
|
/**
|
|
555
555
|
* @license
|
|
@@ -587,7 +587,7 @@ const rn = { attribute: !0, type: String, converter: be, reflect: !1, hasChanged
|
|
|
587
587
|
}
|
|
588
588
|
throw Error("Unsupported decorator location: " + r);
|
|
589
589
|
};
|
|
590
|
-
function
|
|
590
|
+
function $(t) {
|
|
591
591
|
return (e, n) => typeof n == "object" ? on(t, e, n) : ((r, i, o) => {
|
|
592
592
|
const s = i.hasOwnProperty(o);
|
|
593
593
|
return i.constructor.createProperty(o, r), s ? Object.getOwnPropertyDescriptor(i, o) : void 0;
|
|
@@ -599,7 +599,7 @@ function M(t) {
|
|
|
599
599
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
600
600
|
*/
|
|
601
601
|
function _(t) {
|
|
602
|
-
return
|
|
602
|
+
return $({ ...t, state: !0, attribute: !1 });
|
|
603
603
|
}
|
|
604
604
|
function sn(t) {
|
|
605
605
|
return t instanceof Error && ("response" in t && typeof t.response == "object" && t.response !== null || "data" in t && typeof t.data == "object" && t.data !== null);
|
|
@@ -607,7 +607,7 @@ function sn(t) {
|
|
|
607
607
|
var K = {
|
|
608
608
|
CARD: "card",
|
|
609
609
|
PAYNOW: "paynow"
|
|
610
|
-
},
|
|
610
|
+
}, M = {
|
|
611
611
|
IDLE: "idle",
|
|
612
612
|
INITIALIZING: "initializing",
|
|
613
613
|
READY: "ready",
|
|
@@ -620,8 +620,8 @@ function an(t) {
|
|
|
620
620
|
return t === "paid" ? "succeeded" : t;
|
|
621
621
|
}
|
|
622
622
|
var ln = class {
|
|
623
|
-
constructor(t, e, n, r, i = {}) {
|
|
624
|
-
this.isPolling = !1, this.attempts = 0, this.startTime = 0, this.pollTimeoutId = null, this.adapters = t, this.baseUrl = e, this.token = n, this.onStatusUpdate = r, this.config = {
|
|
623
|
+
constructor(t, e, n, r, i = {}, o) {
|
|
624
|
+
this.isPolling = !1, this.attempts = 0, this.startTime = 0, this.pollTimeoutId = null, this.adapters = t, this.baseUrl = e, this.token = n, this.onStatusUpdate = r, this.onPollStart = o, this.config = {
|
|
625
625
|
interval: i.interval ?? 3e3,
|
|
626
626
|
// 3 seconds default
|
|
627
627
|
maxAttempts: i.maxAttempts ?? 60,
|
|
@@ -699,7 +699,7 @@ var ln = class {
|
|
|
699
699
|
*/
|
|
700
700
|
async poll() {
|
|
701
701
|
if (this.isPolling) {
|
|
702
|
-
this.attempts
|
|
702
|
+
this.attempts++, this.onPollStart && this.onPollStart();
|
|
703
703
|
try {
|
|
704
704
|
const t = await this.adapters.http.get(
|
|
705
705
|
`${this.baseUrl}/payment-intent/get-payment-data`,
|
|
@@ -758,7 +758,7 @@ function dn(t) {
|
|
|
758
758
|
var cn = class {
|
|
759
759
|
// Flag to ignore qrCode after user scans it
|
|
760
760
|
constructor(t, e) {
|
|
761
|
-
this.state = { status:
|
|
761
|
+
this.state = { status: M.IDLE }, this.subscribers = /* @__PURE__ */ new Set(), this.eventListeners = {}, this.paymentToken = null, this.paymentIntentId = null, this.pollingService = null, this.ignore3DSInPolling = !1, this.ignoreQRInPolling = !1, this.config = t, this.adapters = e;
|
|
762
762
|
}
|
|
763
763
|
/**
|
|
764
764
|
* Get the API base URL - uses apiBaseUrl if provided, otherwise derives from environment
|
|
@@ -913,7 +913,7 @@ var cn = class {
|
|
|
913
913
|
* @public
|
|
914
914
|
*/
|
|
915
915
|
async initialize(t) {
|
|
916
|
-
this.setState({ status:
|
|
916
|
+
this.setState({ status: M.INITIALIZING }), this.emit({
|
|
917
917
|
type: "initialize",
|
|
918
918
|
payload: t
|
|
919
919
|
});
|
|
@@ -948,19 +948,19 @@ var cn = class {
|
|
|
948
948
|
id: this.paymentIntentId,
|
|
949
949
|
amount: l.result.customerAmount || t.amount,
|
|
950
950
|
currency: l.result.currency || t.currency,
|
|
951
|
-
status:
|
|
951
|
+
status: M.READY,
|
|
952
952
|
...t.metadata && { metadata: t.metadata }
|
|
953
|
-
}, c = a.result.paymentMethods.map((h,
|
|
953
|
+
}, c = a.result.paymentMethods.map((h, f) => {
|
|
954
954
|
let u = null;
|
|
955
|
-
const
|
|
956
|
-
return
|
|
955
|
+
const m = h.type.toLowerCase(), g = h.capabilities || [];
|
|
956
|
+
return m.includes("card") ? u = "card" : (m.includes("paynow") || m.includes("bank transfer") || g.includes("payments_pay_now")) && (u = "paynow"), u === null ? null : {
|
|
957
957
|
id: u,
|
|
958
958
|
enabled: !0,
|
|
959
|
-
priority:
|
|
959
|
+
priority: f
|
|
960
960
|
};
|
|
961
961
|
}).filter((h) => h !== null);
|
|
962
962
|
return this.setState({
|
|
963
|
-
status:
|
|
963
|
+
status: M.READY,
|
|
964
964
|
paymentIntent: d,
|
|
965
965
|
availableMethods: c
|
|
966
966
|
}), this.emit({
|
|
@@ -977,7 +977,7 @@ var cn = class {
|
|
|
977
977
|
timestamp: this.adapters.timer.now()
|
|
978
978
|
};
|
|
979
979
|
throw this.setState({
|
|
980
|
-
status:
|
|
980
|
+
status: M.FAILED,
|
|
981
981
|
error: n
|
|
982
982
|
}), this.emit({
|
|
983
983
|
type: "payment_failed",
|
|
@@ -1045,7 +1045,7 @@ var cn = class {
|
|
|
1045
1045
|
if (!this.paymentToken)
|
|
1046
1046
|
throw new Error("Cannot submit payment: No payment token available");
|
|
1047
1047
|
this.ignore3DSInPolling = !1, this.ignoreQRInPolling = !1, this.setState({
|
|
1048
|
-
status:
|
|
1048
|
+
status: M.PROCESSING,
|
|
1049
1049
|
paymentIntent: n.paymentIntent,
|
|
1050
1050
|
selectedMethod: t,
|
|
1051
1051
|
availableMethods: n.availableMethods
|
|
@@ -1081,15 +1081,15 @@ var cn = class {
|
|
|
1081
1081
|
id: this.paymentIntentId || "",
|
|
1082
1082
|
amount: n.paymentIntent.amount,
|
|
1083
1083
|
currency: n.paymentIntent.currency,
|
|
1084
|
-
status:
|
|
1084
|
+
status: M.PROCESSING
|
|
1085
1085
|
};
|
|
1086
1086
|
} catch (a) {
|
|
1087
1087
|
let d = "Unknown error", c = "PAYMENT_FAILED";
|
|
1088
1088
|
if (a instanceof Error)
|
|
1089
1089
|
try {
|
|
1090
1090
|
if (sn(a)) {
|
|
1091
|
-
const
|
|
1092
|
-
|
|
1091
|
+
const f = (r = a.response) == null ? void 0 : r.data, u = a.data;
|
|
1092
|
+
f ? (d = f.message || ((i = f.error) == null ? void 0 : i.message) || a.message, c = f.code || ((o = f.error) == null ? void 0 : o.code) || c) : u ? (d = u.message || ((s = u.error) == null ? void 0 : s.message) || a.message, c = u.code || ((l = u.error) == null ? void 0 : l.code) || c) : d = a.message;
|
|
1093
1093
|
} else
|
|
1094
1094
|
d = a.message;
|
|
1095
1095
|
} catch {
|
|
@@ -1101,7 +1101,7 @@ var cn = class {
|
|
|
1101
1101
|
timestamp: this.adapters.timer.now()
|
|
1102
1102
|
};
|
|
1103
1103
|
throw this.setState({
|
|
1104
|
-
status:
|
|
1104
|
+
status: M.FAILED,
|
|
1105
1105
|
error: h,
|
|
1106
1106
|
paymentIntent: n.paymentIntent
|
|
1107
1107
|
}), this.emit({
|
|
@@ -1209,7 +1209,9 @@ var cn = class {
|
|
|
1209
1209
|
// Pass flag to polling service
|
|
1210
1210
|
ignoreQR: this.ignoreQRInPolling
|
|
1211
1211
|
// Pass flag to polling service
|
|
1212
|
-
}
|
|
1212
|
+
},
|
|
1213
|
+
this.handlePollStart.bind(this)
|
|
1214
|
+
// Pass poll start callback
|
|
1213
1215
|
), this.pollingService.start();
|
|
1214
1216
|
}
|
|
1215
1217
|
/**
|
|
@@ -1218,6 +1220,15 @@ var cn = class {
|
|
|
1218
1220
|
stopPolling() {
|
|
1219
1221
|
this.pollingService && (this.pollingService.stop(), this.pollingService = null);
|
|
1220
1222
|
}
|
|
1223
|
+
/**
|
|
1224
|
+
* Handle poll start - called before each getPaymentData request
|
|
1225
|
+
*/
|
|
1226
|
+
handlePollStart() {
|
|
1227
|
+
this.emit({
|
|
1228
|
+
type: "poll_started",
|
|
1229
|
+
payload: {}
|
|
1230
|
+
});
|
|
1231
|
+
}
|
|
1221
1232
|
/**
|
|
1222
1233
|
* Handle polling status update
|
|
1223
1234
|
*/
|
|
@@ -1258,11 +1269,11 @@ var cn = class {
|
|
|
1258
1269
|
id: t.paymentIntentId,
|
|
1259
1270
|
amount: t.amount ?? e.paymentIntent.amount,
|
|
1260
1271
|
currency: t.currency ?? e.paymentIntent.currency,
|
|
1261
|
-
status:
|
|
1272
|
+
status: M.REQUIRES_ACTION,
|
|
1262
1273
|
...t.metadata && { metadata: t.metadata }
|
|
1263
1274
|
};
|
|
1264
1275
|
this.setState({
|
|
1265
|
-
status:
|
|
1276
|
+
status: M.REQUIRES_ACTION,
|
|
1266
1277
|
paymentIntent: r,
|
|
1267
1278
|
actionUrl: t.nextActionUrl,
|
|
1268
1279
|
selectedMethod: e.selectedMethod,
|
|
@@ -1286,7 +1297,7 @@ var cn = class {
|
|
|
1286
1297
|
};
|
|
1287
1298
|
if (t.status === "succeeded")
|
|
1288
1299
|
this.stopPolling(), this.setState({
|
|
1289
|
-
status:
|
|
1300
|
+
status: M.SUCCEEDED,
|
|
1290
1301
|
paymentIntent: n,
|
|
1291
1302
|
selectedMethod: e.selectedMethod
|
|
1292
1303
|
}), this.emit({
|
|
@@ -1304,7 +1315,7 @@ var cn = class {
|
|
|
1304
1315
|
timestamp: this.adapters.timer.now()
|
|
1305
1316
|
};
|
|
1306
1317
|
this.setState({
|
|
1307
|
-
status:
|
|
1318
|
+
status: M.FAILED,
|
|
1308
1319
|
error: i,
|
|
1309
1320
|
paymentIntent: n
|
|
1310
1321
|
}), this.emit({
|
|
@@ -1410,7 +1421,7 @@ yt.prototype = {
|
|
|
1410
1421
|
}), this.getFixedDateString(n);
|
|
1411
1422
|
},
|
|
1412
1423
|
getFixedDateString: function(t) {
|
|
1413
|
-
var e = this, n = e.datePattern, r = [], i = 0, o = 0, s = 0, l = 0, a = 0, d = 0, c, h,
|
|
1424
|
+
var e = this, n = e.datePattern, r = [], i = 0, o = 0, s = 0, l = 0, a = 0, d = 0, c, h, f, u = !1;
|
|
1414
1425
|
t.length === 4 && n[0].toLowerCase() !== "y" && n[1].toLowerCase() !== "y" && (l = n[0] === "d" ? 0 : 2, a = 2 - l, c = parseInt(t.slice(l, l + 2), 10), h = parseInt(t.slice(a, a + 2), 10), r = this.getFixedDate(c, h, 0)), t.length === 8 && (n.forEach(function(g, k) {
|
|
1415
1426
|
switch (g) {
|
|
1416
1427
|
case "d":
|
|
@@ -1423,8 +1434,8 @@ yt.prototype = {
|
|
|
1423
1434
|
s = k;
|
|
1424
1435
|
break;
|
|
1425
1436
|
}
|
|
1426
|
-
}), d = s * 2, l = i <= s ? i * 2 : i * 2 + 2, a = o <= s ? o * 2 : o * 2 + 2, c = parseInt(t.slice(l, l + 2), 10), h = parseInt(t.slice(a, a + 2), 10),
|
|
1427
|
-
var
|
|
1437
|
+
}), d = s * 2, l = i <= s ? i * 2 : i * 2 + 2, a = o <= s ? o * 2 : o * 2 + 2, c = parseInt(t.slice(l, l + 2), 10), h = parseInt(t.slice(a, a + 2), 10), f = parseInt(t.slice(d, d + 4), 10), u = t.slice(d, d + 4).length === 4, r = this.getFixedDate(c, h, f)), t.length === 4 && (n[0] === "y" || n[1] === "y") && (a = n[0] === "m" ? 0 : 2, d = 2 - a, h = parseInt(t.slice(a, a + 2), 10), f = parseInt(t.slice(d, d + 2), 10), u = t.slice(d, d + 2).length === 2, r = [0, h, f]), t.length === 6 && (n[0] === "Y" || n[1] === "Y") && (a = n[0] === "m" ? 0 : 4, d = 2 - 0.5 * a, h = parseInt(t.slice(a, a + 2), 10), f = parseInt(t.slice(d, d + 4), 10), u = t.slice(d, d + 4).length === 4, r = [0, h, f]), r = e.getRangeFixedDate(r), e.date = r;
|
|
1438
|
+
var m = r.length === 0 ? t : n.reduce(function(g, k) {
|
|
1428
1439
|
switch (k) {
|
|
1429
1440
|
case "d":
|
|
1430
1441
|
return g + (r[0] === 0 ? "" : e.addLeadingZero(r[0]));
|
|
@@ -1436,7 +1447,7 @@ yt.prototype = {
|
|
|
1436
1447
|
return g + (u ? e.addLeadingZeroForYear(r[2], !0) : "");
|
|
1437
1448
|
}
|
|
1438
1449
|
}, "");
|
|
1439
|
-
return
|
|
1450
|
+
return m;
|
|
1440
1451
|
},
|
|
1441
1452
|
getRangeFixedDate: function(t) {
|
|
1442
1453
|
var e = this, n = e.datePattern, r = e.dateMin || [], i = e.dateMax || [];
|
|
@@ -1510,30 +1521,30 @@ bt.prototype = {
|
|
|
1510
1521
|
}), this.getFixedTimeString(n);
|
|
1511
1522
|
},
|
|
1512
1523
|
getFixedTimeString: function(t) {
|
|
1513
|
-
var e = this, n = e.timePattern, r = [], i = 0, o = 0, s = 0, l = 0, a = 0, d = 0, c, h,
|
|
1514
|
-
return t.length === 6 && (n.forEach(function(u,
|
|
1524
|
+
var e = this, n = e.timePattern, r = [], i = 0, o = 0, s = 0, l = 0, a = 0, d = 0, c, h, f;
|
|
1525
|
+
return t.length === 6 && (n.forEach(function(u, m) {
|
|
1515
1526
|
switch (u) {
|
|
1516
1527
|
case "s":
|
|
1517
|
-
i =
|
|
1528
|
+
i = m * 2;
|
|
1518
1529
|
break;
|
|
1519
1530
|
case "m":
|
|
1520
|
-
o =
|
|
1531
|
+
o = m * 2;
|
|
1521
1532
|
break;
|
|
1522
1533
|
case "h":
|
|
1523
|
-
s =
|
|
1534
|
+
s = m * 2;
|
|
1524
1535
|
break;
|
|
1525
1536
|
}
|
|
1526
|
-
}), d = s, a = o, l = i, c = parseInt(t.slice(l, l + 2), 10), h = parseInt(t.slice(a, a + 2), 10),
|
|
1537
|
+
}), d = s, a = o, l = i, c = parseInt(t.slice(l, l + 2), 10), h = parseInt(t.slice(a, a + 2), 10), f = parseInt(t.slice(d, d + 2), 10), r = this.getFixedTime(f, h, c)), t.length === 4 && e.timePattern.indexOf("s") < 0 && (n.forEach(function(u, m) {
|
|
1527
1538
|
switch (u) {
|
|
1528
1539
|
case "m":
|
|
1529
|
-
o =
|
|
1540
|
+
o = m * 2;
|
|
1530
1541
|
break;
|
|
1531
1542
|
case "h":
|
|
1532
|
-
s =
|
|
1543
|
+
s = m * 2;
|
|
1533
1544
|
break;
|
|
1534
1545
|
}
|
|
1535
|
-
}), d = s, a = o, c = 0, h = parseInt(t.slice(a, a + 2), 10),
|
|
1536
|
-
switch (
|
|
1546
|
+
}), d = s, a = o, c = 0, h = parseInt(t.slice(a, a + 2), 10), f = parseInt(t.slice(d, d + 2), 10), r = this.getFixedTime(f, h, c)), e.time = r, r.length === 0 ? t : n.reduce(function(u, m) {
|
|
1547
|
+
switch (m) {
|
|
1537
1548
|
case "s":
|
|
1538
1549
|
return u + e.addLeadingZero(r[2]);
|
|
1539
1550
|
case "m":
|
|
@@ -1550,7 +1561,7 @@ bt.prototype = {
|
|
|
1550
1561
|
return (t < 10 ? "0" : "") + t;
|
|
1551
1562
|
}
|
|
1552
1563
|
};
|
|
1553
|
-
var
|
|
1564
|
+
var fn = bt, wt = function(t, e) {
|
|
1554
1565
|
var n = this;
|
|
1555
1566
|
n.delimiter = e || e === "" ? e : " ", n.delimiterRE = e ? new RegExp("\\" + e, "g") : "", n.formatter = t;
|
|
1556
1567
|
};
|
|
@@ -1566,7 +1577,7 @@ wt.prototype = {
|
|
|
1566
1577
|
return n = n.replace(/[()]/g, ""), n = n.replace(/[\s-]/g, e.delimiter), n;
|
|
1567
1578
|
}
|
|
1568
1579
|
};
|
|
1569
|
-
var
|
|
1580
|
+
var mn = wt, Be = {
|
|
1570
1581
|
blocks: {
|
|
1571
1582
|
uatp: [4, 5, 6],
|
|
1572
1583
|
amex: [4, 6, 5],
|
|
@@ -1709,8 +1720,8 @@ var fn = wt, Be = {
|
|
|
1709
1720
|
var s = "", l = i.length > 0, a = "";
|
|
1710
1721
|
return n === 0 ? t : (e.forEach(function(d, c) {
|
|
1711
1722
|
if (t.length > 0) {
|
|
1712
|
-
var h = t.slice(0, d),
|
|
1713
|
-
l ? a = i[o ? c - 1 : c] || a : a = r, o ? (c > 0 && (s += a), s += h) : (s += h, h.length === d && c < n - 1 && (s += a)), t =
|
|
1723
|
+
var h = t.slice(0, d), f = t.slice(d);
|
|
1724
|
+
l ? a = i[o ? c - 1 : c] || a : a = r, o ? (c > 0 && (s += a), s += h) : (s += h, h.length === d && c < n - 1 && (s += a)), t = f;
|
|
1714
1725
|
}
|
|
1715
1726
|
}), s);
|
|
1716
1727
|
},
|
|
@@ -1943,13 +1954,13 @@ x.prototype = {
|
|
|
1943
1954
|
};
|
|
1944
1955
|
x.NumeralFormatter = un;
|
|
1945
1956
|
x.DateFormatter = hn;
|
|
1946
|
-
x.TimeFormatter =
|
|
1947
|
-
x.PhoneFormatter =
|
|
1957
|
+
x.TimeFormatter = fn;
|
|
1958
|
+
x.PhoneFormatter = mn;
|
|
1948
1959
|
x.CreditCardDetector = pn;
|
|
1949
1960
|
x.Util = yn;
|
|
1950
1961
|
x.DefaultProperties = wn;
|
|
1951
1962
|
(typeof Z == "object" && Z ? Z : window).Cleave = x;
|
|
1952
|
-
var at = x,
|
|
1963
|
+
var at = x, fe = {}, vn = function() {
|
|
1953
1964
|
return typeof Promise == "function" && Promise.prototype && Promise.prototype.then;
|
|
1954
1965
|
}, vt = {}, D = {};
|
|
1955
1966
|
let Ye;
|
|
@@ -2078,25 +2089,25 @@ xt.prototype = {
|
|
|
2078
2089
|
}
|
|
2079
2090
|
};
|
|
2080
2091
|
var Sn = xt;
|
|
2081
|
-
function
|
|
2092
|
+
function me(t) {
|
|
2082
2093
|
if (!t || t < 1)
|
|
2083
2094
|
throw new Error("BitMatrix size must be defined and greater than 0");
|
|
2084
2095
|
this.size = t, this.data = new Uint8Array(t * t), this.reservedBit = new Uint8Array(t * t);
|
|
2085
2096
|
}
|
|
2086
|
-
|
|
2097
|
+
me.prototype.set = function(t, e, n, r) {
|
|
2087
2098
|
const i = t * this.size + e;
|
|
2088
2099
|
this.data[i] = n, r && (this.reservedBit[i] = !0);
|
|
2089
2100
|
};
|
|
2090
|
-
|
|
2101
|
+
me.prototype.get = function(t, e) {
|
|
2091
2102
|
return this.data[t * this.size + e];
|
|
2092
2103
|
};
|
|
2093
|
-
|
|
2104
|
+
me.prototype.xor = function(t, e, n) {
|
|
2094
2105
|
this.data[t * this.size + e] ^= n;
|
|
2095
2106
|
};
|
|
2096
|
-
|
|
2107
|
+
me.prototype.isReserved = function(t, e) {
|
|
2097
2108
|
return this.reservedBit[t * this.size + e];
|
|
2098
2109
|
};
|
|
2099
|
-
var Cn =
|
|
2110
|
+
var Cn = me, St = {};
|
|
2100
2111
|
(function(t) {
|
|
2101
2112
|
const e = D.getSymbolSize;
|
|
2102
2113
|
t.getRowColCoords = function(r) {
|
|
@@ -2155,9 +2166,9 @@ var kt = {};
|
|
|
2155
2166
|
let s = 0, l = 0, a = 0, d = null, c = null;
|
|
2156
2167
|
for (let h = 0; h < o; h++) {
|
|
2157
2168
|
l = a = 0, d = c = null;
|
|
2158
|
-
for (let
|
|
2159
|
-
let u = i.get(h,
|
|
2160
|
-
u === d ? l++ : (l >= 5 && (s += e.N1 + (l - 5)), d = u, l = 1), u = i.get(
|
|
2169
|
+
for (let f = 0; f < o; f++) {
|
|
2170
|
+
let u = i.get(h, f);
|
|
2171
|
+
u === d ? l++ : (l >= 5 && (s += e.N1 + (l - 5)), d = u, l = 1), u = i.get(f, h), u === c ? a++ : (a >= 5 && (s += e.N1 + (a - 5)), c = u, a = 1);
|
|
2161
2172
|
}
|
|
2162
2173
|
l >= 5 && (s += e.N1 + (l - 5)), a >= 5 && (s += e.N1 + (a - 5));
|
|
2163
2174
|
}
|
|
@@ -2728,33 +2739,33 @@ F.testAlphanumeric = function(e) {
|
|
|
2728
2739
|
})(z);
|
|
2729
2740
|
(function(t) {
|
|
2730
2741
|
const e = D, n = ke, r = Ce, i = z, o = Qe, s = 7973, l = e.getBCHDigit(s);
|
|
2731
|
-
function a(
|
|
2742
|
+
function a(f, u, m) {
|
|
2732
2743
|
for (let g = 1; g <= 40; g++)
|
|
2733
|
-
if (u <= t.getCapacity(g,
|
|
2744
|
+
if (u <= t.getCapacity(g, m, f))
|
|
2734
2745
|
return g;
|
|
2735
2746
|
}
|
|
2736
|
-
function d(
|
|
2737
|
-
return i.getCharCountIndicator(
|
|
2747
|
+
function d(f, u) {
|
|
2748
|
+
return i.getCharCountIndicator(f, u) + 4;
|
|
2738
2749
|
}
|
|
2739
|
-
function c(
|
|
2740
|
-
let
|
|
2741
|
-
return
|
|
2750
|
+
function c(f, u) {
|
|
2751
|
+
let m = 0;
|
|
2752
|
+
return f.forEach(function(g) {
|
|
2742
2753
|
const k = d(g.mode, u);
|
|
2743
|
-
|
|
2744
|
-
}),
|
|
2754
|
+
m += k + g.getBitsLength();
|
|
2755
|
+
}), m;
|
|
2745
2756
|
}
|
|
2746
|
-
function h(
|
|
2747
|
-
for (let
|
|
2748
|
-
if (c(
|
|
2749
|
-
return
|
|
2757
|
+
function h(f, u) {
|
|
2758
|
+
for (let m = 1; m <= 40; m++)
|
|
2759
|
+
if (c(f, m) <= t.getCapacity(m, u, i.MIXED))
|
|
2760
|
+
return m;
|
|
2750
2761
|
}
|
|
2751
|
-
t.from = function(u,
|
|
2752
|
-
return o.isValid(u) ? parseInt(u, 10) :
|
|
2753
|
-
}, t.getCapacity = function(u,
|
|
2762
|
+
t.from = function(u, m) {
|
|
2763
|
+
return o.isValid(u) ? parseInt(u, 10) : m;
|
|
2764
|
+
}, t.getCapacity = function(u, m, g) {
|
|
2754
2765
|
if (!o.isValid(u))
|
|
2755
2766
|
throw new Error("Invalid QR Code version");
|
|
2756
2767
|
typeof g > "u" && (g = i.BYTE);
|
|
2757
|
-
const k = e.getSymbolTotalCodewords(u), b = n.getTotalCodewordsCount(u,
|
|
2768
|
+
const k = e.getSymbolTotalCodewords(u), b = n.getTotalCodewordsCount(u, m), w = (k - b) * 8;
|
|
2758
2769
|
if (g === i.MIXED) return w;
|
|
2759
2770
|
const y = w - d(g, u);
|
|
2760
2771
|
switch (g) {
|
|
@@ -2768,9 +2779,9 @@ F.testAlphanumeric = function(e) {
|
|
|
2768
2779
|
default:
|
|
2769
2780
|
return Math.floor(y / 8);
|
|
2770
2781
|
}
|
|
2771
|
-
}, t.getBestVersionForData = function(u,
|
|
2782
|
+
}, t.getBestVersionForData = function(u, m) {
|
|
2772
2783
|
let g;
|
|
2773
|
-
const k = r.from(
|
|
2784
|
+
const k = r.from(m, r.M);
|
|
2774
2785
|
if (Array.isArray(u)) {
|
|
2775
2786
|
if (u.length > 1)
|
|
2776
2787
|
return h(u, k);
|
|
@@ -2783,25 +2794,25 @@ F.testAlphanumeric = function(e) {
|
|
|
2783
2794
|
}, t.getEncodedBits = function(u) {
|
|
2784
2795
|
if (!o.isValid(u) || u < 7)
|
|
2785
2796
|
throw new Error("Invalid QR Code version");
|
|
2786
|
-
let
|
|
2787
|
-
for (; e.getBCHDigit(
|
|
2788
|
-
|
|
2789
|
-
return u << 12 |
|
|
2797
|
+
let m = u << 12;
|
|
2798
|
+
for (; e.getBCHDigit(m) - l >= 0; )
|
|
2799
|
+
m ^= s << e.getBCHDigit(m) - l;
|
|
2800
|
+
return u << 12 | m;
|
|
2790
2801
|
};
|
|
2791
2802
|
})(Pt);
|
|
2792
2803
|
var _t = {};
|
|
2793
|
-
const Le = D, Dt = 1335,
|
|
2804
|
+
const Le = D, Dt = 1335, Mn = 21522, dt = Le.getBCHDigit(Dt);
|
|
2794
2805
|
_t.getEncodedBits = function(e, n) {
|
|
2795
2806
|
const r = e.bit << 3 | n;
|
|
2796
2807
|
let i = r << 10;
|
|
2797
2808
|
for (; Le.getBCHDigit(i) - dt >= 0; )
|
|
2798
2809
|
i ^= Dt << Le.getBCHDigit(i) - dt;
|
|
2799
|
-
return (r << 10 | i) ^
|
|
2810
|
+
return (r << 10 | i) ^ Mn;
|
|
2800
2811
|
};
|
|
2801
|
-
var
|
|
2802
|
-
const
|
|
2812
|
+
var Mt = {};
|
|
2813
|
+
const $n = z;
|
|
2803
2814
|
function W(t) {
|
|
2804
|
-
this.mode =
|
|
2815
|
+
this.mode = $n.NUMERIC, this.data = t.toString();
|
|
2805
2816
|
}
|
|
2806
2817
|
W.getBitsLength = function(e) {
|
|
2807
2818
|
return 10 * Math.floor(e / 3) + (e % 3 ? e % 3 * 3 + 1 : 0);
|
|
@@ -2819,8 +2830,8 @@ W.prototype.write = function(e) {
|
|
|
2819
2830
|
const o = this.data.length - n;
|
|
2820
2831
|
o > 0 && (r = this.data.substr(n), i = parseInt(r, 10), e.put(i, o * 3 + 1));
|
|
2821
2832
|
};
|
|
2822
|
-
var
|
|
2823
|
-
const
|
|
2833
|
+
var Nn = W;
|
|
2834
|
+
const Tn = z, $e = [
|
|
2824
2835
|
"0",
|
|
2825
2836
|
"1",
|
|
2826
2837
|
"2",
|
|
@@ -2868,7 +2879,7 @@ const Nn = z, Me = [
|
|
|
2868
2879
|
":"
|
|
2869
2880
|
];
|
|
2870
2881
|
function X(t) {
|
|
2871
|
-
this.mode =
|
|
2882
|
+
this.mode = Tn.ALPHANUMERIC, this.data = t;
|
|
2872
2883
|
}
|
|
2873
2884
|
X.getBitsLength = function(e) {
|
|
2874
2885
|
return 11 * Math.floor(e / 2) + 6 * (e % 2);
|
|
@@ -2882,10 +2893,10 @@ X.prototype.getBitsLength = function() {
|
|
|
2882
2893
|
X.prototype.write = function(e) {
|
|
2883
2894
|
let n;
|
|
2884
2895
|
for (n = 0; n + 2 <= this.data.length; n += 2) {
|
|
2885
|
-
let r =
|
|
2886
|
-
r +=
|
|
2896
|
+
let r = $e.indexOf(this.data[n]) * 45;
|
|
2897
|
+
r += $e.indexOf(this.data[n + 1]), e.put(r, 11);
|
|
2887
2898
|
}
|
|
2888
|
-
this.data.length % 2 && e.put(
|
|
2899
|
+
this.data.length % 2 && e.put($e.indexOf(this.data[n]), 6);
|
|
2889
2900
|
};
|
|
2890
2901
|
var Fn = X;
|
|
2891
2902
|
const Rn = z;
|
|
@@ -2935,7 +2946,7 @@ Make sure your charset is UTF-8`
|
|
|
2935
2946
|
n = (n >>> 8 & 255) * 192 + (n & 255), t.put(n, 13);
|
|
2936
2947
|
}
|
|
2937
2948
|
};
|
|
2938
|
-
var On = te,
|
|
2949
|
+
var On = te, $t = { exports: {} };
|
|
2939
2950
|
(function(t) {
|
|
2940
2951
|
var e = {
|
|
2941
2952
|
single_source_shortest_paths: function(n, r, i) {
|
|
@@ -2943,10 +2954,10 @@ var On = te, Mt = { exports: {} };
|
|
|
2943
2954
|
s[r] = 0;
|
|
2944
2955
|
var l = e.PriorityQueue.make();
|
|
2945
2956
|
l.push(r, 0);
|
|
2946
|
-
for (var a, d, c, h,
|
|
2947
|
-
a = l.pop(), d = a.value, h = a.cost,
|
|
2948
|
-
for (c in
|
|
2949
|
-
|
|
2957
|
+
for (var a, d, c, h, f, u, m, g, k; !l.empty(); ) {
|
|
2958
|
+
a = l.pop(), d = a.value, h = a.cost, f = n[d] || {};
|
|
2959
|
+
for (c in f)
|
|
2960
|
+
f.hasOwnProperty(c) && (u = f[c], m = h + u, g = s[c], k = typeof s[c] > "u", (k || g > m) && (s[c] = m, l.push(c, m), o[c] = d));
|
|
2950
2961
|
}
|
|
2951
2962
|
if (typeof i < "u" && typeof s[i] > "u") {
|
|
2952
2963
|
var b = ["Could not find a path from ", r, " to ", i, "."].join("");
|
|
@@ -3000,10 +3011,10 @@ var On = te, Mt = { exports: {} };
|
|
|
3000
3011
|
}
|
|
3001
3012
|
};
|
|
3002
3013
|
t.exports = e;
|
|
3003
|
-
})(
|
|
3004
|
-
var zn =
|
|
3014
|
+
})($t);
|
|
3015
|
+
var zn = $t.exports;
|
|
3005
3016
|
(function(t) {
|
|
3006
|
-
const e = z, n =
|
|
3017
|
+
const e = z, n = Nn, r = Fn, i = Bn, o = On, s = F, l = D, a = zn;
|
|
3007
3018
|
function d(b) {
|
|
3008
3019
|
return unescape(encodeURIComponent(b)).length;
|
|
3009
3020
|
}
|
|
@@ -3022,8 +3033,8 @@ var zn = Mt.exports;
|
|
|
3022
3033
|
function h(b) {
|
|
3023
3034
|
const w = c(s.NUMERIC, e.NUMERIC, b), y = c(s.ALPHANUMERIC, e.ALPHANUMERIC, b);
|
|
3024
3035
|
let p, C;
|
|
3025
|
-
return l.isKanjiModeEnabled() ? (p = c(s.BYTE, e.BYTE, b), C = c(s.KANJI, e.KANJI, b)) : (p = c(s.BYTE_KANJI, e.BYTE, b), C = []), w.concat(y, p, C).sort(function(P,
|
|
3026
|
-
return P.index -
|
|
3036
|
+
return l.isKanjiModeEnabled() ? (p = c(s.BYTE, e.BYTE, b), C = c(s.KANJI, e.KANJI, b)) : (p = c(s.BYTE_KANJI, e.BYTE, b), C = []), w.concat(y, p, C).sort(function(P, N) {
|
|
3037
|
+
return P.index - N.index;
|
|
3027
3038
|
}).map(function(P) {
|
|
3028
3039
|
return {
|
|
3029
3040
|
data: P.data,
|
|
@@ -3032,7 +3043,7 @@ var zn = Mt.exports;
|
|
|
3032
3043
|
};
|
|
3033
3044
|
});
|
|
3034
3045
|
}
|
|
3035
|
-
function
|
|
3046
|
+
function f(b, w) {
|
|
3036
3047
|
switch (w) {
|
|
3037
3048
|
case e.NUMERIC:
|
|
3038
3049
|
return n.getBitsLength(b);
|
|
@@ -3050,7 +3061,7 @@ var zn = Mt.exports;
|
|
|
3050
3061
|
return p && p.mode === y.mode ? (w[w.length - 1].data += y.data, w) : (w.push(y), w);
|
|
3051
3062
|
}, []);
|
|
3052
3063
|
}
|
|
3053
|
-
function
|
|
3064
|
+
function m(b) {
|
|
3054
3065
|
const w = [];
|
|
3055
3066
|
for (let y = 0; y < b.length; y++) {
|
|
3056
3067
|
const p = b[y];
|
|
@@ -3086,16 +3097,16 @@ var zn = Mt.exports;
|
|
|
3086
3097
|
const y = {}, p = { start: {} };
|
|
3087
3098
|
let C = ["start"];
|
|
3088
3099
|
for (let E = 0; E < b.length; E++) {
|
|
3089
|
-
const P = b[E],
|
|
3100
|
+
const P = b[E], N = [];
|
|
3090
3101
|
for (let B = 0; B < P.length; B++) {
|
|
3091
|
-
const
|
|
3092
|
-
|
|
3102
|
+
const T = P[B], ne = "" + E + B;
|
|
3103
|
+
N.push(ne), y[ne] = { node: T, lastCount: 0 }, p[ne] = {};
|
|
3093
3104
|
for (let Pe = 0; Pe < C.length; Pe++) {
|
|
3094
3105
|
const R = C[Pe];
|
|
3095
|
-
y[R] && y[R].node.mode ===
|
|
3106
|
+
y[R] && y[R].node.mode === T.mode ? (p[R][ne] = f(y[R].lastCount + T.length, T.mode) - f(y[R].lastCount, T.mode), y[R].lastCount += T.length) : (y[R] && (y[R].lastCount = T.length), p[R][ne] = f(T.length, T.mode) + 4 + e.getCharCountIndicator(T.mode, w));
|
|
3096
3107
|
}
|
|
3097
3108
|
}
|
|
3098
|
-
C =
|
|
3109
|
+
C = N;
|
|
3099
3110
|
}
|
|
3100
3111
|
for (let E = 0; E < C.length; E++)
|
|
3101
3112
|
p[C[E]].end = 0;
|
|
@@ -3123,17 +3134,17 @@ var zn = Mt.exports;
|
|
|
3123
3134
|
return typeof p == "string" ? y.push(k(p, null)) : p.data && y.push(k(p.data, p.mode)), y;
|
|
3124
3135
|
}, []);
|
|
3125
3136
|
}, t.fromString = function(w, y) {
|
|
3126
|
-
const p = h(w, l.isKanjiModeEnabled()), C =
|
|
3137
|
+
const p = h(w, l.isKanjiModeEnabled()), C = m(p), E = g(C, y), P = a.find_path(E.map, "start", "end"), N = [];
|
|
3127
3138
|
for (let B = 1; B < P.length - 1; B++)
|
|
3128
|
-
|
|
3129
|
-
return t.fromArray(u(
|
|
3139
|
+
N.push(E.table[P[B]].node);
|
|
3140
|
+
return t.fromArray(u(N));
|
|
3130
3141
|
}, t.rawSplit = function(w) {
|
|
3131
3142
|
return t.fromArray(
|
|
3132
3143
|
h(w, l.isKanjiModeEnabled())
|
|
3133
3144
|
);
|
|
3134
3145
|
};
|
|
3135
|
-
})(
|
|
3136
|
-
const Ae = D,
|
|
3146
|
+
})(Mt);
|
|
3147
|
+
const Ae = D, Ne = Ce, qn = Sn, Vn = Cn, Hn = St, jn = Ct, Ue = kt, Oe = ke, Yn = En, xe = Pt, Kn = _t, Qn = z, Te = Mt;
|
|
3137
3148
|
function Zn(t, e) {
|
|
3138
3149
|
const n = t.size, r = jn.getPositions(e);
|
|
3139
3150
|
for (let i = 0; i < r.length; i++) {
|
|
@@ -3203,21 +3214,21 @@ function er(t, e, n) {
|
|
|
3203
3214
|
return tr(r, t, e);
|
|
3204
3215
|
}
|
|
3205
3216
|
function tr(t, e, n) {
|
|
3206
|
-
const r = Ae.getSymbolTotalCodewords(e), i = Oe.getTotalCodewordsCount(e, n), o = r - i, s = Oe.getBlocksCount(e, n), l = r % s, a = s - l, d = Math.floor(r / s), c = Math.floor(o / s), h = c + 1,
|
|
3207
|
-
let
|
|
3217
|
+
const r = Ae.getSymbolTotalCodewords(e), i = Oe.getTotalCodewordsCount(e, n), o = r - i, s = Oe.getBlocksCount(e, n), l = r % s, a = s - l, d = Math.floor(r / s), c = Math.floor(o / s), h = c + 1, f = d - c, u = new Yn(f);
|
|
3218
|
+
let m = 0;
|
|
3208
3219
|
const g = new Array(s), k = new Array(s);
|
|
3209
3220
|
let b = 0;
|
|
3210
3221
|
const w = new Uint8Array(t.buffer);
|
|
3211
3222
|
for (let P = 0; P < s; P++) {
|
|
3212
|
-
const
|
|
3213
|
-
g[P] = w.slice(
|
|
3223
|
+
const N = P < a ? c : h;
|
|
3224
|
+
g[P] = w.slice(m, m + N), k[P] = u.encode(g[P]), m += N, b = Math.max(b, N);
|
|
3214
3225
|
}
|
|
3215
3226
|
const y = new Uint8Array(r);
|
|
3216
3227
|
let p = 0, C, E;
|
|
3217
3228
|
for (C = 0; C < b; C++)
|
|
3218
3229
|
for (E = 0; E < s; E++)
|
|
3219
3230
|
C < g[E].length && (y[p++] = g[E][C]);
|
|
3220
|
-
for (C = 0; C <
|
|
3231
|
+
for (C = 0; C < f; C++)
|
|
3221
3232
|
for (E = 0; E < s; E++)
|
|
3222
3233
|
y[p++] = k[E][C];
|
|
3223
3234
|
return y;
|
|
@@ -3225,14 +3236,14 @@ function tr(t, e, n) {
|
|
|
3225
3236
|
function nr(t, e, n, r) {
|
|
3226
3237
|
let i;
|
|
3227
3238
|
if (Array.isArray(t))
|
|
3228
|
-
i =
|
|
3239
|
+
i = Te.fromArray(t);
|
|
3229
3240
|
else if (typeof t == "string") {
|
|
3230
3241
|
let d = e;
|
|
3231
3242
|
if (!d) {
|
|
3232
|
-
const c =
|
|
3243
|
+
const c = Te.rawSplit(t);
|
|
3233
3244
|
d = xe.getBestVersionForData(c, n);
|
|
3234
3245
|
}
|
|
3235
|
-
i =
|
|
3246
|
+
i = Te.fromString(t, d || 40);
|
|
3236
3247
|
} else
|
|
3237
3248
|
throw new Error("Invalid data");
|
|
3238
3249
|
const o = xe.getBestVersionForData(i, n);
|
|
@@ -3262,10 +3273,10 @@ Minimum version required to store current data is: ` + o + `.
|
|
|
3262
3273
|
vt.create = function(e, n) {
|
|
3263
3274
|
if (typeof e > "u" || e === "")
|
|
3264
3275
|
throw new Error("No input text");
|
|
3265
|
-
let r =
|
|
3266
|
-
return typeof n < "u" && (r =
|
|
3276
|
+
let r = Ne.M, i, o;
|
|
3277
|
+
return typeof n < "u" && (r = Ne.from(n.errorCorrectionLevel, Ne.M), i = xe.from(n.version), o = Ue.from(n.maskPattern), n.toSJISFunc && Ae.setToSJISFunction(n.toSJISFunc)), nr(e, i, r, o);
|
|
3267
3278
|
};
|
|
3268
|
-
var
|
|
3279
|
+
var Nt = {}, Ze = {};
|
|
3269
3280
|
(function(t) {
|
|
3270
3281
|
function e(n) {
|
|
3271
3282
|
if (typeof n == "number" && (n = n.toString()), typeof n != "string")
|
|
@@ -3306,14 +3317,14 @@ var Tt = {}, Ze = {};
|
|
|
3306
3317
|
return Math.floor((r + i.margin * 2) * o);
|
|
3307
3318
|
}, t.qrToImageData = function(r, i, o) {
|
|
3308
3319
|
const s = i.modules.size, l = i.modules.data, a = t.getScale(s, o), d = Math.floor((s + o.margin * 2) * a), c = o.margin * a, h = [o.color.light, o.color.dark];
|
|
3309
|
-
for (let
|
|
3320
|
+
for (let f = 0; f < d; f++)
|
|
3310
3321
|
for (let u = 0; u < d; u++) {
|
|
3311
|
-
let
|
|
3312
|
-
if (
|
|
3313
|
-
const k = Math.floor((
|
|
3322
|
+
let m = (f * d + u) * 4, g = o.color.light;
|
|
3323
|
+
if (f >= c && u >= c && f < d - c && u < d - c) {
|
|
3324
|
+
const k = Math.floor((f - c) / a), b = Math.floor((u - c) / a);
|
|
3314
3325
|
g = h[l[k * s + b] ? 1 : 0];
|
|
3315
3326
|
}
|
|
3316
|
-
r[
|
|
3327
|
+
r[m++] = g.r, r[m++] = g.g, r[m++] = g.b, r[m] = g.a;
|
|
3317
3328
|
}
|
|
3318
3329
|
};
|
|
3319
3330
|
})(Ze);
|
|
@@ -3332,16 +3343,16 @@ var Tt = {}, Ze = {};
|
|
|
3332
3343
|
t.render = function(o, s, l) {
|
|
3333
3344
|
let a = l, d = s;
|
|
3334
3345
|
typeof a > "u" && (!s || !s.getContext) && (a = s, s = void 0), s || (d = r()), a = e.getOptions(a);
|
|
3335
|
-
const c = e.getImageWidth(o.modules.size, a), h = d.getContext("2d"),
|
|
3336
|
-
return e.qrToImageData(
|
|
3346
|
+
const c = e.getImageWidth(o.modules.size, a), h = d.getContext("2d"), f = h.createImageData(c, c);
|
|
3347
|
+
return e.qrToImageData(f.data, o, a), n(h, d, c), h.putImageData(f, 0, 0), d;
|
|
3337
3348
|
}, t.renderToDataURL = function(o, s, l) {
|
|
3338
3349
|
let a = l;
|
|
3339
3350
|
typeof a > "u" && (!s || !s.getContext) && (a = s, s = void 0), a || (a = {});
|
|
3340
3351
|
const d = t.render(o, s, a), c = a.type || "image/png", h = a.rendererOpts || {};
|
|
3341
3352
|
return d.toDataURL(c, h.quality);
|
|
3342
3353
|
};
|
|
3343
|
-
})(
|
|
3344
|
-
var
|
|
3354
|
+
})(Nt);
|
|
3355
|
+
var Tt = {};
|
|
3345
3356
|
const rr = Ze;
|
|
3346
3357
|
function ct(t, e) {
|
|
3347
3358
|
const n = t.a / 255, r = e + '="' + t.hex + '"';
|
|
@@ -3359,12 +3370,12 @@ function ir(t, e, n) {
|
|
|
3359
3370
|
}
|
|
3360
3371
|
return r;
|
|
3361
3372
|
}
|
|
3362
|
-
|
|
3363
|
-
const i = rr.getOptions(n), o = e.modules.size, s = e.modules.data, l = o + i.margin * 2, a = i.color.light.a ? "<path " + ct(i.color.light, "fill") + ' d="M0 0h' + l + "v" + l + 'H0z"/>' : "", d = "<path " + ct(i.color.dark, "stroke") + ' d="' + ir(s, o, i.margin) + '"/>', c = 'viewBox="0 0 ' + l + " " + l + '"',
|
|
3373
|
+
Tt.render = function(e, n, r) {
|
|
3374
|
+
const i = rr.getOptions(n), o = e.modules.size, s = e.modules.data, l = o + i.margin * 2, a = i.color.light.a ? "<path " + ct(i.color.light, "fill") + ' d="M0 0h' + l + "v" + l + 'H0z"/>' : "", d = "<path " + ct(i.color.dark, "stroke") + ' d="' + ir(s, o, i.margin) + '"/>', c = 'viewBox="0 0 ' + l + " " + l + '"', f = '<svg xmlns="http://www.w3.org/2000/svg" ' + (i.width ? 'width="' + i.width + '" height="' + i.width + '" ' : "") + c + ' shape-rendering="crispEdges">' + a + d + `</svg>
|
|
3364
3375
|
`;
|
|
3365
|
-
return typeof r == "function" && r(null,
|
|
3376
|
+
return typeof r == "function" && r(null, f), f;
|
|
3366
3377
|
};
|
|
3367
|
-
const or = vn, ze = vt, Ft =
|
|
3378
|
+
const or = vn, ze = vt, Ft = Nt, sr = Tt;
|
|
3368
3379
|
function Ge(t, e, n, r, i) {
|
|
3369
3380
|
const o = [].slice.call(arguments, 1), s = o.length, l = typeof o[s - 1] == "function";
|
|
3370
3381
|
if (!l && !or())
|
|
@@ -3392,10 +3403,10 @@ function Ge(t, e, n, r, i) {
|
|
|
3392
3403
|
i(a);
|
|
3393
3404
|
}
|
|
3394
3405
|
}
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3406
|
+
fe.create = ze.create;
|
|
3407
|
+
fe.toCanvas = Ge.bind(null, Ft.render);
|
|
3408
|
+
fe.toDataURL = Ge.bind(null, Ft.renderToDataURL);
|
|
3409
|
+
fe.toString = Ge.bind(null, function(t, e, n) {
|
|
3399
3410
|
return sr.render(t, n);
|
|
3400
3411
|
});
|
|
3401
3412
|
var ar = Object.defineProperty, lr = Object.getOwnPropertyDescriptor, S = (t, e, n, r) => {
|
|
@@ -3410,20 +3421,22 @@ let v = class extends se {
|
|
|
3410
3421
|
expiry: "",
|
|
3411
3422
|
cvv: "",
|
|
3412
3423
|
cardholderName: ""
|
|
3413
|
-
}, this.formErrors = {}, this.paymentData = null, this.feesExpanded = !1, this.isInitializing = !0, this.cardBrand = "unknown", this.paymentLocked = !1, this.show3DSModal = !1, this.showQRModal = !1, this.nextActionUrl = null, this.qrCode = null, this.qrCodeDataUrl = null, this.qrAutoResumeTimer = null, this.qrPollingInProgress = !1, this.sdk = null, this.isInitialized = !1, this.cardNumberCleave = null, this.expiryCleave = null, this.leaveEventsCounter = 0, this.
|
|
3424
|
+
}, this.formErrors = {}, this.paymentData = null, this.feesExpanded = !1, this.isInitializing = !0, this.cardBrand = "unknown", this.paymentLocked = !1, this.show3DSModal = !1, this.showQRModal = !1, this.nextActionUrl = null, this.qrCode = null, this.qrCodeDataUrl = null, this.qrAutoResumeTimer = null, this.qrPollingInProgress = !1, this.sdk = null, this.isInitialized = !1, this.cardNumberCleave = null, this.expiryCleave = null, this.leaveEventsCounter = 0, this.previousState = null, this.handle3DSPostMessage = (t) => {
|
|
3414
3425
|
t.data === "ON_AWX_3DS_START_PAGE_LEAVE" && (this.leaveEventsCounter++, this.leaveEventsCounter > 1 && this.handle3DSComplete());
|
|
3415
3426
|
};
|
|
3416
3427
|
}
|
|
3417
3428
|
// --- Lifecycle ---
|
|
3418
3429
|
connectedCallback() {
|
|
3419
|
-
super.connectedCallback(), window.addEventListener("message", this.handle3DSPostMessage)
|
|
3430
|
+
super.connectedCallback(), window.addEventListener("message", this.handle3DSPostMessage), this.addEventListener("force-close-3ds-modal", () => {
|
|
3431
|
+
console.log("[3DS] force-close-3ds-modal event received - closing modal immediately (React Native fix)"), this.show3DSModal && (this.show3DSModal = !1, this.nextActionUrl = null, this.leaveEventsCounter = 0);
|
|
3432
|
+
});
|
|
3420
3433
|
}
|
|
3421
3434
|
firstUpdated() {
|
|
3422
3435
|
this.initializeSDK();
|
|
3423
3436
|
}
|
|
3424
3437
|
disconnectedCallback() {
|
|
3425
3438
|
var t;
|
|
3426
|
-
super.disconnectedCallback(), (t = this.sdk) == null || t.destroy(), this.isInitialized = !1, this.destroyCleave(), window.removeEventListener("message", this.handle3DSPostMessage), this.qrAutoResumeTimer !== null && clearTimeout(this.qrAutoResumeTimer)
|
|
3439
|
+
super.disconnectedCallback(), (t = this.sdk) == null || t.destroy(), this.isInitialized = !1, this.destroyCleave(), window.removeEventListener("message", this.handle3DSPostMessage), this.qrAutoResumeTimer !== null && clearTimeout(this.qrAutoResumeTimer);
|
|
3427
3440
|
}
|
|
3428
3441
|
// --- Cleave.js Setup ---
|
|
3429
3442
|
setupCleave() {
|
|
@@ -3501,7 +3514,8 @@ let v = class extends se {
|
|
|
3501
3514
|
return;
|
|
3502
3515
|
}
|
|
3503
3516
|
this.isInitialized || (this.isInitialized = !0, (t = this.sdk) == null || t.destroy(), this.sdk = new cn(this.config, this.adapters), this.sdk.subscribe((e) => {
|
|
3504
|
-
|
|
3517
|
+
var n, r;
|
|
3518
|
+
console.log("[3DS] State changed:", (n = this.previousState) == null ? void 0 : n.status, "→", e.status), ((r = this.previousState) == null ? void 0 : r.status) === "requires_action" && e.status !== "requires_action" && this.show3DSModal && (console.log("[3DS] State changed from requires_action - closing modal immediately"), this.show3DSModal = !1, this.nextActionUrl = null, this.leaveEventsCounter = 0), this.previousState = e, this.currentState = e, this.dispatchEvent(
|
|
3505
3519
|
new CustomEvent("state-change", {
|
|
3506
3520
|
detail: { state: e },
|
|
3507
3521
|
bubbles: !0,
|
|
@@ -3527,9 +3541,9 @@ let v = class extends se {
|
|
|
3527
3541
|
}), this.sdk.on("initialized", (e) => {
|
|
3528
3542
|
this.paymentData = e.payload.paymentData, this.isInitializing = !1;
|
|
3529
3543
|
}), this.sdk.on("payment_requires_action", (e) => {
|
|
3530
|
-
this.nextActionUrl = e.payload.actionUrl, this.show3DSModal = !0, this.paymentLocked = !0, this.leaveEventsCounter = 0
|
|
3531
|
-
|
|
3532
|
-
|
|
3544
|
+
console.log("[3DS] payment_requires_action event - showing modal with nextActionUrl"), this.nextActionUrl = e.payload.actionUrl, this.show3DSModal = !0, this.paymentLocked = !0, this.leaveEventsCounter = 0;
|
|
3545
|
+
}), this.sdk.on("poll_started", () => {
|
|
3546
|
+
console.log("[3DS] poll_started event - getPaymentData is being invoked"), this.show3DSModal && (console.log("[3DS] Closing 3DS modal due to poll start (React Native fix)"), this.show3DSModal = !1, this.nextActionUrl = null, this.leaveEventsCounter = 0);
|
|
3533
3547
|
}), this.sdk.on(
|
|
3534
3548
|
"qr_code_received",
|
|
3535
3549
|
async (e) => {
|
|
@@ -3538,7 +3552,7 @@ let v = class extends se {
|
|
|
3538
3552
|
const n = this.qrCode.startsWith("http://") || this.qrCode.startsWith("https://"), r = this.qrCode.startsWith("data:image");
|
|
3539
3553
|
if (!n && !r)
|
|
3540
3554
|
try {
|
|
3541
|
-
const i = await
|
|
3555
|
+
const i = await fe.toDataURL(this.qrCode, {
|
|
3542
3556
|
width: 300,
|
|
3543
3557
|
margin: 2,
|
|
3544
3558
|
color: {
|
|
@@ -3569,17 +3583,49 @@ let v = class extends se {
|
|
|
3569
3583
|
this.qrAutoResumeTimer !== null && (clearTimeout(this.qrAutoResumeTimer), this.qrAutoResumeTimer = null), this.qrPollingInProgress = !0, this.sdk && this.sdk.resumePolling();
|
|
3570
3584
|
}
|
|
3571
3585
|
handle3DSComplete() {
|
|
3572
|
-
|
|
3586
|
+
console.log("[3DS] handle3DSComplete called - closing modal and resuming polling"), this.show3DSModal = !1, this.nextActionUrl = null, this.leaveEventsCounter = 0, this.sdk && this.sdk.resumePolling();
|
|
3573
3587
|
}
|
|
3574
3588
|
handleInputChange(t, e) {
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3589
|
+
this.cardFormData = { ...this.cardFormData, [t]: e };
|
|
3590
|
+
}
|
|
3591
|
+
// Luhn algorithm check for card number validation
|
|
3592
|
+
luhnCheck(t) {
|
|
3593
|
+
const e = t.replace(/\s/g, "");
|
|
3594
|
+
if (!/^\d+$/.test(e))
|
|
3595
|
+
return !1;
|
|
3596
|
+
let n = 0, r = !1;
|
|
3597
|
+
for (let i = e.length - 1; i >= 0; i--) {
|
|
3598
|
+
const o = e.charAt(i);
|
|
3599
|
+
if (!o) continue;
|
|
3600
|
+
let s = parseInt(o, 10);
|
|
3601
|
+
r && (s *= 2, s > 9 && (s -= 9)), n += s, r = !r;
|
|
3602
|
+
}
|
|
3603
|
+
return n % 10 === 0;
|
|
3604
|
+
}
|
|
3605
|
+
// Validate expiry date (MM/YY format)
|
|
3606
|
+
validateExpiry(t) {
|
|
3607
|
+
const e = t.trim();
|
|
3608
|
+
if (!/^\d{1,2}\/\d{2,4}$/.test(e))
|
|
3609
|
+
return { valid: !1, error: "Invalid format (MM/YY)" };
|
|
3610
|
+
const n = e.split("/"), r = n[0], i = n[1];
|
|
3611
|
+
if (!r || !i)
|
|
3612
|
+
return { valid: !1, error: "Invalid format (MM/YY)" };
|
|
3613
|
+
const o = parseInt(r, 10);
|
|
3614
|
+
let s;
|
|
3615
|
+
if (i.length === 2 ? s = parseInt("20" + i, 10) : s = parseInt(i, 10), o < 1 || o > 12)
|
|
3616
|
+
return { valid: !1, error: "Invalid month (01-12)" };
|
|
3617
|
+
const l = /* @__PURE__ */ new Date(), a = l.getFullYear(), d = l.getMonth() + 1;
|
|
3618
|
+
return s < a || s === a && o < d ? { valid: !1, error: "Card has expired" } : { valid: !0 };
|
|
3579
3619
|
}
|
|
3580
3620
|
validateCardForm() {
|
|
3581
3621
|
const t = {};
|
|
3582
|
-
|
|
3622
|
+
if (this.cardFormData.cardNumber.trim() ? this.luhnCheck(this.cardFormData.cardNumber) || (t.cardNumber = "Invalid card number") : t.cardNumber = "Please enter card number", !this.cardFormData.expiry.trim())
|
|
3623
|
+
t.expiry = "Please enter expiry date";
|
|
3624
|
+
else {
|
|
3625
|
+
const e = this.validateExpiry(this.cardFormData.expiry);
|
|
3626
|
+
e.valid || (t.expiry = e.error);
|
|
3627
|
+
}
|
|
3628
|
+
return this.cardFormData.cvv.trim() || (t.cvv = "Please enter CVV"), this.cardFormData.cardholderName.trim() || (t.cardholderName = "Please enter cardholder name"), this.formErrors = t, Object.keys(t).length === 0;
|
|
3583
3629
|
}
|
|
3584
3630
|
handleCardPayment() {
|
|
3585
3631
|
if (!this.sdk || this.currentState.status !== "ready" || !this.validateCardForm())
|
|
@@ -5251,37 +5297,37 @@ v.styles = Bt`
|
|
|
5251
5297
|
}
|
|
5252
5298
|
`;
|
|
5253
5299
|
S([
|
|
5254
|
-
|
|
5300
|
+
$({ type: Object })
|
|
5255
5301
|
], v.prototype, "config", 2);
|
|
5256
5302
|
S([
|
|
5257
|
-
|
|
5303
|
+
$({ type: Object })
|
|
5258
5304
|
], v.prototype, "adapters", 2);
|
|
5259
5305
|
S([
|
|
5260
|
-
|
|
5306
|
+
$({ type: Number })
|
|
5261
5307
|
], v.prototype, "amount", 2);
|
|
5262
5308
|
S([
|
|
5263
|
-
|
|
5309
|
+
$({ type: String })
|
|
5264
5310
|
], v.prototype, "currency", 2);
|
|
5265
5311
|
S([
|
|
5266
|
-
|
|
5312
|
+
$({ type: String })
|
|
5267
5313
|
], v.prototype, "orderId", 2);
|
|
5268
5314
|
S([
|
|
5269
|
-
|
|
5315
|
+
$({ type: String })
|
|
5270
5316
|
], v.prototype, "firstName", 2);
|
|
5271
5317
|
S([
|
|
5272
|
-
|
|
5318
|
+
$({ type: String })
|
|
5273
5319
|
], v.prototype, "lastName", 2);
|
|
5274
5320
|
S([
|
|
5275
|
-
|
|
5321
|
+
$({ type: String })
|
|
5276
5322
|
], v.prototype, "email", 2);
|
|
5277
5323
|
S([
|
|
5278
|
-
|
|
5324
|
+
$({ type: Array })
|
|
5279
5325
|
], v.prototype, "excludePaymentMethods", 2);
|
|
5280
5326
|
S([
|
|
5281
|
-
|
|
5327
|
+
$({ type: String })
|
|
5282
5328
|
], v.prototype, "width", 2);
|
|
5283
5329
|
S([
|
|
5284
|
-
|
|
5330
|
+
$({ type: String })
|
|
5285
5331
|
], v.prototype, "maxWidth", 2);
|
|
5286
5332
|
S([
|
|
5287
5333
|
_()
|