@one-payments/web-components 1.3.0 → 1.5.0
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 +796 -482
- package/dist/one-payment.d.ts +8 -0
- package/dist/one-payment.d.ts.map +1 -1
- package/dist/one-payment.js +365 -7
- package/dist/one-payment.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
const ye = globalThis, qe = ye.ShadowRoot && (ye.ShadyCSS === void 0 || ye.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype,
|
|
6
|
+
const ye = globalThis, qe = ye.ShadowRoot && (ye.ShadyCSS === void 0 || ye.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, He = Symbol(), Ze = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
let ht = class {
|
|
8
8
|
constructor(e, r, n) {
|
|
9
|
-
if (this._$cssResult$ = !0, n !==
|
|
9
|
+
if (this._$cssResult$ = !0, n !== He) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
10
10
|
this.cssText = e, this.t = r;
|
|
11
11
|
}
|
|
12
12
|
get styleSheet() {
|
|
@@ -14,7 +14,7 @@ let ht = class {
|
|
|
14
14
|
const r = this.t;
|
|
15
15
|
if (qe && e === void 0) {
|
|
16
16
|
const n = r !== void 0 && r.length === 1;
|
|
17
|
-
n && (e =
|
|
17
|
+
n && (e = Ze.get(r)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), n && Ze.set(r, e));
|
|
18
18
|
}
|
|
19
19
|
return e;
|
|
20
20
|
}
|
|
@@ -22,33 +22,33 @@ let ht = class {
|
|
|
22
22
|
return this.cssText;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
const
|
|
25
|
+
const Bt = (t) => new ht(typeof t == "string" ? t : t + "", void 0, He), Lt = (t, ...e) => {
|
|
26
26
|
const r = t.length === 1 ? t[0] : e.reduce((n, i, o) => n + ((s) => {
|
|
27
27
|
if (s._$cssResult$ === !0) return s.cssText;
|
|
28
28
|
if (typeof s == "number") return s;
|
|
29
29
|
throw Error("Value passed to 'css' function must be a 'css' function result: " + s + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
30
30
|
})(i) + t[o + 1], t[0]);
|
|
31
|
-
return new ht(r, t,
|
|
32
|
-
},
|
|
31
|
+
return new ht(r, t, He);
|
|
32
|
+
}, Ut = (t, e) => {
|
|
33
33
|
if (qe) t.adoptedStyleSheets = e.map((r) => r instanceof CSSStyleSheet ? r : r.styleSheet);
|
|
34
34
|
else for (const r of e) {
|
|
35
35
|
const n = document.createElement("style"), i = ye.litNonce;
|
|
36
36
|
i !== void 0 && n.setAttribute("nonce", i), n.textContent = r.cssText, t.appendChild(n);
|
|
37
37
|
}
|
|
38
|
-
},
|
|
38
|
+
}, Je = qe ? (t) => t : (t) => t instanceof CSSStyleSheet ? ((e) => {
|
|
39
39
|
let r = "";
|
|
40
40
|
for (const n of e.cssRules) r += n.cssText;
|
|
41
|
-
return
|
|
41
|
+
return Bt(r);
|
|
42
42
|
})(t) : t;
|
|
43
43
|
/**
|
|
44
44
|
* @license
|
|
45
45
|
* Copyright 2017 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
47
|
*/
|
|
48
|
-
const { is:
|
|
48
|
+
const { is: Ft, defineProperty: Ot, getOwnPropertyDescriptor: zt, getOwnPropertyNames: qt, getOwnPropertySymbols: Ht, getPrototypeOf: Yt } = Object, z = globalThis, Xe = z.trustedTypes, Vt = Xe ? Xe.emptyScript : "", _e = z.reactiveElementPolyfillSupport, ie = (t, e) => t, be = { toAttribute(t, e) {
|
|
49
49
|
switch (e) {
|
|
50
50
|
case Boolean:
|
|
51
|
-
t = t ?
|
|
51
|
+
t = t ? Vt : null;
|
|
52
52
|
break;
|
|
53
53
|
case Object:
|
|
54
54
|
case Array:
|
|
@@ -73,8 +73,8 @@ const { is: Ut, defineProperty: zt, getOwnPropertyDescriptor: Ot, getOwnProperty
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
return r;
|
|
76
|
-
} },
|
|
77
|
-
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")),
|
|
76
|
+
} }, Ye = (t, e) => !Ft(t, e), et = { attribute: !0, type: String, converter: be, reflect: !1, useDefault: !1, hasChanged: Ye };
|
|
77
|
+
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), z.litPropertyMetadata ?? (z.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
78
78
|
let K = class extends HTMLElement {
|
|
79
79
|
static addInitializer(e) {
|
|
80
80
|
this._$Ei(), (this.l ?? (this.l = [])).push(e);
|
|
@@ -85,11 +85,11 @@ let K = class extends HTMLElement {
|
|
|
85
85
|
static createProperty(e, r = et) {
|
|
86
86
|
if (r.state && (r.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((r = Object.create(r)).wrapped = !0), this.elementProperties.set(e, r), !r.noAccessor) {
|
|
87
87
|
const n = Symbol(), i = this.getPropertyDescriptor(e, n, r);
|
|
88
|
-
i !== void 0 &&
|
|
88
|
+
i !== void 0 && Ot(this.prototype, e, i);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
static getPropertyDescriptor(e, r, n) {
|
|
92
|
-
const { get: i, set: o } =
|
|
92
|
+
const { get: i, set: o } = zt(this.prototype, e) ?? { get() {
|
|
93
93
|
return this[r];
|
|
94
94
|
}, set(s) {
|
|
95
95
|
this[r] = s;
|
|
@@ -104,13 +104,13 @@ let K = class extends HTMLElement {
|
|
|
104
104
|
}
|
|
105
105
|
static _$Ei() {
|
|
106
106
|
if (this.hasOwnProperty(ie("elementProperties"))) return;
|
|
107
|
-
const e =
|
|
107
|
+
const e = Yt(this);
|
|
108
108
|
e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
|
|
109
109
|
}
|
|
110
110
|
static finalize() {
|
|
111
111
|
if (this.hasOwnProperty(ie("finalized"))) return;
|
|
112
112
|
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(ie("properties"))) {
|
|
113
|
-
const r = this.properties, n = [...qt(r), ...
|
|
113
|
+
const r = this.properties, n = [...qt(r), ...Ht(r)];
|
|
114
114
|
for (const i of n) this.createProperty(i, r[i]);
|
|
115
115
|
}
|
|
116
116
|
const e = this[Symbol.metadata];
|
|
@@ -129,8 +129,8 @@ let K = class extends HTMLElement {
|
|
|
129
129
|
const r = [];
|
|
130
130
|
if (Array.isArray(e)) {
|
|
131
131
|
const n = new Set(e.flat(1 / 0).reverse());
|
|
132
|
-
for (const i of n) r.unshift(
|
|
133
|
-
} else e !== void 0 && r.push(
|
|
132
|
+
for (const i of n) r.unshift(Je(i));
|
|
133
|
+
} else e !== void 0 && r.push(Je(e));
|
|
134
134
|
return r;
|
|
135
135
|
}
|
|
136
136
|
static _$Eu(e, r) {
|
|
@@ -159,7 +159,7 @@ let K = class extends HTMLElement {
|
|
|
159
159
|
}
|
|
160
160
|
createRenderRoot() {
|
|
161
161
|
const e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
162
|
-
return
|
|
162
|
+
return Ut(e, this.constructor.elementStyles), e;
|
|
163
163
|
}
|
|
164
164
|
connectedCallback() {
|
|
165
165
|
var e;
|
|
@@ -202,7 +202,7 @@ let K = class extends HTMLElement {
|
|
|
202
202
|
var i;
|
|
203
203
|
if (e !== void 0) {
|
|
204
204
|
const o = this.constructor, s = this[e];
|
|
205
|
-
if (n ?? (n = o.getPropertyOptions(e)), !((n.hasChanged ??
|
|
205
|
+
if (n ?? (n = o.getPropertyOptions(e)), !((n.hasChanged ?? Ye)(s, r) || n.useDefault && n.reflect && s === ((i = this._$Ej) == null ? void 0 : i.get(e)) && !this.hasAttribute(o._$Eu(e, n)))) return;
|
|
206
206
|
this.C(e, r, n);
|
|
207
207
|
}
|
|
208
208
|
this.isUpdatePending === !1 && (this._$ES = this._$EP());
|
|
@@ -278,28 +278,28 @@ let K = class extends HTMLElement {
|
|
|
278
278
|
firstUpdated(e) {
|
|
279
279
|
}
|
|
280
280
|
};
|
|
281
|
-
K.elementStyles = [], K.shadowRootOptions = { mode: "open" }, K[ie("elementProperties")] = /* @__PURE__ */ new Map(), K[ie("finalized")] = /* @__PURE__ */ new Map(),
|
|
281
|
+
K.elementStyles = [], K.shadowRootOptions = { mode: "open" }, K[ie("elementProperties")] = /* @__PURE__ */ new Map(), K[ie("finalized")] = /* @__PURE__ */ new Map(), _e == null || _e({ ReactiveElement: K }), (z.reactiveElementVersions ?? (z.reactiveElementVersions = [])).push("2.1.1");
|
|
282
282
|
/**
|
|
283
283
|
* @license
|
|
284
284
|
* Copyright 2017 Google LLC
|
|
285
285
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
286
286
|
*/
|
|
287
|
-
const oe = globalThis, ve = oe.trustedTypes, tt = ve ? ve.createPolicy("lit-html", { createHTML: (t) => t }) : void 0, pt = "$lit$",
|
|
288
|
-
\f\r]`, ne = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, rt = /-->/g, nt = />/g,
|
|
289
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), it = /'/g, ot = /"/g, ft = /^(?:script|style|textarea|title)$/i, Kt = (t) => (e, ...r) => ({ _$litType$: t, strings: e, values: r }),
|
|
287
|
+
const oe = globalThis, ve = oe.trustedTypes, tt = ve ? ve.createPolicy("lit-html", { createHTML: (t) => t }) : void 0, pt = "$lit$", F = `lit$${Math.random().toFixed(9).slice(2)}$`, mt = "?" + F, jt = `<${mt}>`, Q = document, le = () => Q.createComment(""), ce = (t) => t === null || typeof t != "object" && typeof t != "function", Ve = Array.isArray, Qt = (t) => Ve(t) || typeof (t == null ? void 0 : t[Symbol.iterator]) == "function", Ie = `[
|
|
288
|
+
\f\r]`, ne = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, rt = /-->/g, nt = />/g, H = RegExp(`>|${Ie}(?:([^\\s"'>=/]+)(${Ie}*=${Ie}*(?:[^
|
|
289
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), it = /'/g, ot = /"/g, ft = /^(?:script|style|textarea|title)$/i, Kt = (t) => (e, ...r) => ({ _$litType$: t, strings: e, values: r }), x = Kt(1), W = Symbol.for("lit-noChange"), I = Symbol.for("lit-nothing"), st = /* @__PURE__ */ new WeakMap(), Y = Q.createTreeWalker(Q, 129);
|
|
290
290
|
function gt(t, e) {
|
|
291
|
-
if (!
|
|
291
|
+
if (!Ve(t) || !t.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
292
292
|
return tt !== void 0 ? tt.createHTML(e) : e;
|
|
293
293
|
}
|
|
294
|
-
const
|
|
294
|
+
const Gt = (t, e) => {
|
|
295
295
|
const r = t.length - 1, n = [];
|
|
296
296
|
let i, o = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", s = ne;
|
|
297
297
|
for (let l = 0; l < r; l++) {
|
|
298
298
|
const a = t[l];
|
|
299
|
-
let c, d,
|
|
300
|
-
for (;
|
|
301
|
-
const u = s ===
|
|
302
|
-
o += s === ne ? a + jt :
|
|
299
|
+
let c, d, h = -1, p = 0;
|
|
300
|
+
for (; p < a.length && (s.lastIndex = p, d = s.exec(a), d !== null); ) p = s.lastIndex, s === ne ? d[1] === "!--" ? s = rt : d[1] !== void 0 ? s = nt : d[2] !== void 0 ? (ft.test(d[2]) && (i = RegExp("</" + d[2], "g")), s = H) : d[3] !== void 0 && (s = H) : s === H ? d[0] === ">" ? (s = i ?? ne, h = -1) : d[1] === void 0 ? h = -2 : (h = s.lastIndex - d[2].length, c = d[1], s = d[3] === void 0 ? H : d[3] === '"' ? ot : it) : s === ot || s === it ? s = H : s === rt || s === nt ? s = ne : (s = H, i = void 0);
|
|
301
|
+
const u = s === H && t[l + 1].startsWith("/>") ? " " : "";
|
|
302
|
+
o += s === ne ? a + jt : h >= 0 ? (n.push(c), a.slice(0, h) + pt + a.slice(h) + F + u) : a + F + (h === -2 ? l : u);
|
|
303
303
|
}
|
|
304
304
|
return [gt(t, o + (t[r] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), n];
|
|
305
305
|
};
|
|
@@ -308,29 +308,29 @@ class de {
|
|
|
308
308
|
let i;
|
|
309
309
|
this.parts = [];
|
|
310
310
|
let o = 0, s = 0;
|
|
311
|
-
const l = e.length - 1, a = this.parts, [c, d] =
|
|
312
|
-
if (this.el = de.createElement(c, n),
|
|
313
|
-
const
|
|
314
|
-
|
|
311
|
+
const l = e.length - 1, a = this.parts, [c, d] = Gt(e, r);
|
|
312
|
+
if (this.el = de.createElement(c, n), Y.currentNode = this.el.content, r === 2 || r === 3) {
|
|
313
|
+
const h = this.el.content.firstChild;
|
|
314
|
+
h.replaceWith(...h.childNodes);
|
|
315
315
|
}
|
|
316
|
-
for (; (i =
|
|
316
|
+
for (; (i = Y.nextNode()) !== null && a.length < l; ) {
|
|
317
317
|
if (i.nodeType === 1) {
|
|
318
|
-
if (i.hasAttributes()) for (const
|
|
319
|
-
const
|
|
320
|
-
a.push({ type: 1, index: o, name: m[2], strings: u, ctor: m[1] === "." ?
|
|
321
|
-
} else
|
|
318
|
+
if (i.hasAttributes()) for (const h of i.getAttributeNames()) if (h.endsWith(pt)) {
|
|
319
|
+
const p = d[s++], u = i.getAttribute(h).split(F), m = /([.?@])?(.*)/.exec(p);
|
|
320
|
+
a.push({ type: 1, index: o, name: m[2], strings: u, ctor: m[1] === "." ? Zt : m[1] === "?" ? Jt : m[1] === "@" ? Xt : Se }), i.removeAttribute(h);
|
|
321
|
+
} else h.startsWith(F) && (a.push({ type: 6, index: o }), i.removeAttribute(h));
|
|
322
322
|
if (ft.test(i.tagName)) {
|
|
323
|
-
const
|
|
324
|
-
if (
|
|
323
|
+
const h = i.textContent.split(F), p = h.length - 1;
|
|
324
|
+
if (p > 0) {
|
|
325
325
|
i.textContent = ve ? ve.emptyScript : "";
|
|
326
|
-
for (let u = 0; u <
|
|
327
|
-
i.append(p
|
|
326
|
+
for (let u = 0; u < p; u++) i.append(h[u], le()), Y.nextNode(), a.push({ type: 2, index: ++o });
|
|
327
|
+
i.append(h[p], le());
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
330
|
} else if (i.nodeType === 8) if (i.data === mt) a.push({ type: 2, index: o });
|
|
331
331
|
else {
|
|
332
|
-
let
|
|
333
|
-
for (; (
|
|
332
|
+
let h = -1;
|
|
333
|
+
for (; (h = i.data.indexOf(F, h + 1)) !== -1; ) a.push({ type: 7, index: o }), h += F.length - 1;
|
|
334
334
|
}
|
|
335
335
|
o++;
|
|
336
336
|
}
|
|
@@ -340,14 +340,14 @@ class de {
|
|
|
340
340
|
return n.innerHTML = e, n;
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
|
-
function
|
|
343
|
+
function Z(t, e, r = t, n) {
|
|
344
344
|
var s, l;
|
|
345
|
-
if (e ===
|
|
345
|
+
if (e === W) return e;
|
|
346
346
|
let i = n !== void 0 ? (s = r._$Co) == null ? void 0 : s[n] : r._$Cl;
|
|
347
347
|
const o = ce(e) ? void 0 : e._$litDirective$;
|
|
348
|
-
return (i == null ? void 0 : i.constructor) !== o && ((l = i == null ? void 0 : i._$AO) == null || l.call(i, !1), o === void 0 ? i = void 0 : (i = new o(t), i._$AT(t, r, n)), n !== void 0 ? (r._$Co ?? (r._$Co = []))[n] = i : r._$Cl = i), i !== void 0 && (e =
|
|
348
|
+
return (i == null ? void 0 : i.constructor) !== o && ((l = i == null ? void 0 : i._$AO) == null || l.call(i, !1), o === void 0 ? i = void 0 : (i = new o(t), i._$AT(t, r, n)), n !== void 0 ? (r._$Co ?? (r._$Co = []))[n] = i : r._$Cl = i), i !== void 0 && (e = Z(t, i._$AS(t, e.values), i, n)), e;
|
|
349
349
|
}
|
|
350
|
-
class
|
|
350
|
+
class Wt {
|
|
351
351
|
constructor(e, r) {
|
|
352
352
|
this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = r;
|
|
353
353
|
}
|
|
@@ -359,16 +359,16 @@ class Jt {
|
|
|
359
359
|
}
|
|
360
360
|
u(e) {
|
|
361
361
|
const { el: { content: r }, parts: n } = this._$AD, i = ((e == null ? void 0 : e.creationScope) ?? Q).importNode(r, !0);
|
|
362
|
-
|
|
363
|
-
let o =
|
|
362
|
+
Y.currentNode = i;
|
|
363
|
+
let o = Y.nextNode(), s = 0, l = 0, a = n[0];
|
|
364
364
|
for (; a !== void 0; ) {
|
|
365
365
|
if (s === a.index) {
|
|
366
366
|
let c;
|
|
367
367
|
a.type === 2 ? c = new he(o, o.nextSibling, this, e) : a.type === 1 ? c = new a.ctor(o, a.name, a.strings, this, e) : a.type === 6 && (c = new er(o, this, e)), this._$AV.push(c), a = n[++l];
|
|
368
368
|
}
|
|
369
|
-
s !== (a == null ? void 0 : a.index) && (o =
|
|
369
|
+
s !== (a == null ? void 0 : a.index) && (o = Y.nextNode(), s++);
|
|
370
370
|
}
|
|
371
|
-
return
|
|
371
|
+
return Y.currentNode = Q, i;
|
|
372
372
|
}
|
|
373
373
|
p(e) {
|
|
374
374
|
let r = 0;
|
|
@@ -395,7 +395,7 @@ class he {
|
|
|
395
395
|
return this._$AB;
|
|
396
396
|
}
|
|
397
397
|
_$AI(e, r = this) {
|
|
398
|
-
e =
|
|
398
|
+
e = Z(this, e, r), ce(e) ? e === I || e == null || e === "" ? (this._$AH !== I && this._$AR(), this._$AH = I) : e !== this._$AH && e !== W && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Qt(e) ? this.k(e) : this._(e);
|
|
399
399
|
}
|
|
400
400
|
O(e) {
|
|
401
401
|
return this._$AA.parentNode.insertBefore(e, this._$AB);
|
|
@@ -411,7 +411,7 @@ class he {
|
|
|
411
411
|
const { values: r, _$litType$: n } = e, i = typeof n == "number" ? this._$AC(e) : (n.el === void 0 && (n.el = de.createElement(gt(n.h, n.h[0]), this.options)), n);
|
|
412
412
|
if (((o = this._$AH) == null ? void 0 : o._$AD) === i) this._$AH.p(r);
|
|
413
413
|
else {
|
|
414
|
-
const s = new
|
|
414
|
+
const s = new Wt(i, this), l = s.u(this.options);
|
|
415
415
|
s.p(r), this.T(l), this._$AH = s;
|
|
416
416
|
}
|
|
417
417
|
}
|
|
@@ -420,7 +420,7 @@ class he {
|
|
|
420
420
|
return r === void 0 && st.set(e.strings, r = new de(e)), r;
|
|
421
421
|
}
|
|
422
422
|
k(e) {
|
|
423
|
-
|
|
423
|
+
Ve(this._$AH) || (this._$AH = [], this._$AR());
|
|
424
424
|
const r = this._$AH;
|
|
425
425
|
let n, i = 0;
|
|
426
426
|
for (const o of e) i === r.length ? r.push(n = new he(this.O(le()), this.O(le()), this, this.options)) : n = r[i], n._$AI(o), i++;
|
|
@@ -451,11 +451,11 @@ class Se {
|
|
|
451
451
|
_$AI(e, r = this, n, i) {
|
|
452
452
|
const o = this.strings;
|
|
453
453
|
let s = !1;
|
|
454
|
-
if (o === void 0) e =
|
|
454
|
+
if (o === void 0) e = Z(this, e, r, 0), s = !ce(e) || e !== this._$AH && e !== W, s && (this._$AH = e);
|
|
455
455
|
else {
|
|
456
456
|
const l = e;
|
|
457
457
|
let a, c;
|
|
458
|
-
for (e = o[0], a = 0; a < o.length - 1; a++) c =
|
|
458
|
+
for (e = o[0], a = 0; a < o.length - 1; a++) c = Z(this, l[n + a], r, a), c === W && (c = this._$AH[a]), s || (s = !ce(c) || c !== this._$AH[a]), c === I ? e = I : e !== I && (e += (c ?? "") + o[a + 1]), this._$AH[a] = c;
|
|
459
459
|
}
|
|
460
460
|
s && !i && this.j(e);
|
|
461
461
|
}
|
|
@@ -463,7 +463,7 @@ class Se {
|
|
|
463
463
|
e === I ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
|
-
class
|
|
466
|
+
class Zt extends Se {
|
|
467
467
|
constructor() {
|
|
468
468
|
super(...arguments), this.type = 3;
|
|
469
469
|
}
|
|
@@ -471,7 +471,7 @@ class Gt extends Se {
|
|
|
471
471
|
this.element[this.name] = e === I ? void 0 : e;
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
|
-
class
|
|
474
|
+
class Jt extends Se {
|
|
475
475
|
constructor() {
|
|
476
476
|
super(...arguments), this.type = 4;
|
|
477
477
|
}
|
|
@@ -484,7 +484,7 @@ class Xt extends Se {
|
|
|
484
484
|
super(e, r, n, i, o), this.type = 5;
|
|
485
485
|
}
|
|
486
486
|
_$AI(e, r = this) {
|
|
487
|
-
if ((e =
|
|
487
|
+
if ((e = Z(this, e, r, 0) ?? I) === W) return;
|
|
488
488
|
const n = this._$AH, i = e === I && n !== I || e.capture !== n.capture || e.once !== n.once || e.passive !== n.passive, o = e !== I && (n === I || i);
|
|
489
489
|
i && this.element.removeEventListener(this.name, this, n), o && this.element.addEventListener(this.name, this, e), this._$AH = e;
|
|
490
490
|
}
|
|
@@ -501,7 +501,7 @@ class er {
|
|
|
501
501
|
return this._$AM._$AU;
|
|
502
502
|
}
|
|
503
503
|
_$AI(e) {
|
|
504
|
-
|
|
504
|
+
Z(this, e);
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
507
|
const Me = oe.litHtmlPolyfillSupport;
|
|
@@ -543,7 +543,7 @@ class se extends K {
|
|
|
543
543
|
super.disconnectedCallback(), (e = this._$Do) == null || e.setConnected(!1);
|
|
544
544
|
}
|
|
545
545
|
render() {
|
|
546
|
-
return
|
|
546
|
+
return W;
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
549
|
var ut;
|
|
@@ -566,7 +566,7 @@ const rr = (t) => (e, r) => {
|
|
|
566
566
|
* Copyright 2017 Google LLC
|
|
567
567
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
568
568
|
*/
|
|
569
|
-
const nr = { attribute: !0, type: String, converter: be, reflect: !1, hasChanged:
|
|
569
|
+
const nr = { attribute: !0, type: String, converter: be, reflect: !1, hasChanged: Ye }, ir = (t = nr, e, r) => {
|
|
570
570
|
const { kind: n, metadata: i } = r;
|
|
571
571
|
let o = globalThis.litPropertyMetadata.get(i);
|
|
572
572
|
if (o === void 0 && globalThis.litPropertyMetadata.set(i, o = /* @__PURE__ */ new Map()), n === "setter" && ((t = Object.create(t)).wrapped = !0), o.set(r.name, t), n === "accessor") {
|
|
@@ -598,17 +598,21 @@ function D(t) {
|
|
|
598
598
|
* Copyright 2017 Google LLC
|
|
599
599
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
600
600
|
*/
|
|
601
|
-
function
|
|
601
|
+
function M(t) {
|
|
602
602
|
return D({ ...t, state: !0, attribute: !1 });
|
|
603
603
|
}
|
|
604
604
|
function or(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);
|
|
606
606
|
}
|
|
607
|
-
var
|
|
607
|
+
var w = {
|
|
608
608
|
CARD: "card",
|
|
609
609
|
PAYNOW: "paynow",
|
|
610
|
-
PROMPTPAY: "promptpay"
|
|
611
|
-
|
|
610
|
+
PROMPTPAY: "promptpay",
|
|
611
|
+
DUITNOW: "duitnow",
|
|
612
|
+
GOPAY: "gopay",
|
|
613
|
+
BOOST: "boost",
|
|
614
|
+
SHOPEEPAY: "shopeepay"
|
|
615
|
+
}, T = {
|
|
612
616
|
IDLE: "idle",
|
|
613
617
|
INITIALIZING: "initializing",
|
|
614
618
|
READY: "ready",
|
|
@@ -755,7 +759,7 @@ function lr(t) {
|
|
|
755
759
|
var cr = class {
|
|
756
760
|
// Flag to ignore qrCode after user scans it
|
|
757
761
|
constructor(t, e) {
|
|
758
|
-
this.state = { status:
|
|
762
|
+
this.state = { status: T.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;
|
|
759
763
|
}
|
|
760
764
|
/**
|
|
761
765
|
* Get the API base URL - uses apiBaseUrl if provided, otherwise derives from environment
|
|
@@ -910,7 +914,7 @@ var cr = class {
|
|
|
910
914
|
* @public
|
|
911
915
|
*/
|
|
912
916
|
async initialize(t) {
|
|
913
|
-
this.setState({ status:
|
|
917
|
+
this.setState({ status: T.INITIALIZING }), this.emit({
|
|
914
918
|
type: "initialize",
|
|
915
919
|
payload: t
|
|
916
920
|
});
|
|
@@ -945,27 +949,43 @@ var cr = class {
|
|
|
945
949
|
id: this.paymentIntentId,
|
|
946
950
|
amount: l.result.customerAmount || t.amount,
|
|
947
951
|
currency: l.result.currency || t.currency,
|
|
948
|
-
status:
|
|
952
|
+
status: T.READY,
|
|
949
953
|
...t.metadata && { metadata: t.metadata }
|
|
950
954
|
}, d = [];
|
|
951
|
-
let
|
|
952
|
-
return a.result.paymentMethods.forEach((
|
|
953
|
-
const u =
|
|
955
|
+
let h = 0;
|
|
956
|
+
return a.result.paymentMethods.forEach((p) => {
|
|
957
|
+
const u = p.type.toLowerCase(), m = p.capabilities || [];
|
|
954
958
|
u.includes("card") && d.push({
|
|
955
959
|
id: "card",
|
|
956
960
|
enabled: !0,
|
|
957
|
-
priority:
|
|
961
|
+
priority: h++
|
|
958
962
|
}), (u.includes("paynow") || m.includes("payments_pay_now")) && d.push({
|
|
959
963
|
id: "paynow",
|
|
960
964
|
enabled: !0,
|
|
961
|
-
priority:
|
|
965
|
+
priority: h++
|
|
962
966
|
}), (u.includes("promptpay") || u.includes("prompt pay") || m.includes("payments_prompt_pay")) && d.push({
|
|
963
967
|
id: "promptpay",
|
|
964
968
|
enabled: !0,
|
|
965
|
-
priority:
|
|
969
|
+
priority: h++
|
|
970
|
+
}), (u.includes("duitnow") || u.includes("duit now") || m.includes("payments_duit_now")) && d.push({
|
|
971
|
+
id: "duitnow",
|
|
972
|
+
enabled: !0,
|
|
973
|
+
priority: h++
|
|
974
|
+
}), (u.includes("gopay") || u.includes("go pay") || m.includes("payments_go_pay")) && d.push({
|
|
975
|
+
id: "gopay",
|
|
976
|
+
enabled: !0,
|
|
977
|
+
priority: h++
|
|
978
|
+
}), (u.includes("boost") || m.includes("payments_boost")) && d.push({
|
|
979
|
+
id: "boost",
|
|
980
|
+
enabled: !0,
|
|
981
|
+
priority: h++
|
|
982
|
+
}), (u.includes("shopeepay") || u.includes("shopee pay") || u.includes("shopee_pay") || m.includes("payments_shopee_pay")) && d.push({
|
|
983
|
+
id: "shopeepay",
|
|
984
|
+
enabled: !0,
|
|
985
|
+
priority: h++
|
|
966
986
|
});
|
|
967
987
|
}), this.setState({
|
|
968
|
-
status:
|
|
988
|
+
status: T.READY,
|
|
969
989
|
paymentIntent: c,
|
|
970
990
|
availableMethods: d
|
|
971
991
|
}), this.emit({
|
|
@@ -982,7 +1002,7 @@ var cr = class {
|
|
|
982
1002
|
timestamp: this.adapters.timer.now()
|
|
983
1003
|
};
|
|
984
1004
|
throw this.setState({
|
|
985
|
-
status:
|
|
1005
|
+
status: T.FAILED,
|
|
986
1006
|
error: r
|
|
987
1007
|
}), this.emit({
|
|
988
1008
|
type: "payment_failed",
|
|
@@ -1050,7 +1070,7 @@ var cr = class {
|
|
|
1050
1070
|
if (!this.paymentToken)
|
|
1051
1071
|
throw new Error("Cannot submit payment: No payment token available");
|
|
1052
1072
|
this.ignore3DSInPolling = !1, this.ignoreQRInPolling = !1, this.setState({
|
|
1053
|
-
status:
|
|
1073
|
+
status: T.PROCESSING,
|
|
1054
1074
|
paymentIntent: r.paymentIntent,
|
|
1055
1075
|
selectedMethod: t,
|
|
1056
1076
|
availableMethods: r.availableMethods
|
|
@@ -1062,7 +1082,24 @@ var cr = class {
|
|
|
1062
1082
|
}
|
|
1063
1083
|
});
|
|
1064
1084
|
try {
|
|
1065
|
-
const a = {
|
|
1085
|
+
const a = (d) => {
|
|
1086
|
+
switch (d) {
|
|
1087
|
+
case "paynow":
|
|
1088
|
+
return "qr";
|
|
1089
|
+
case "promptpay":
|
|
1090
|
+
return "prompt_pay";
|
|
1091
|
+
case "duitnow":
|
|
1092
|
+
return "duit_now";
|
|
1093
|
+
case "gopay":
|
|
1094
|
+
return "go_pay";
|
|
1095
|
+
case "boost":
|
|
1096
|
+
return "boost";
|
|
1097
|
+
case "shopeepay":
|
|
1098
|
+
return "shopee_pay";
|
|
1099
|
+
default:
|
|
1100
|
+
return "qr";
|
|
1101
|
+
}
|
|
1102
|
+
}, c = {
|
|
1066
1103
|
firstName: String(e.firstName),
|
|
1067
1104
|
lastName: String(e.lastName),
|
|
1068
1105
|
email: String(e.email),
|
|
@@ -1074,12 +1111,11 @@ var cr = class {
|
|
|
1074
1111
|
expiryYear: String(e.expiryYear),
|
|
1075
1112
|
cvc: String(e.cvv)
|
|
1076
1113
|
}
|
|
1077
|
-
} :
|
|
1078
|
-
// PayNow
|
|
1114
|
+
} : { type: a(t) }
|
|
1079
1115
|
};
|
|
1080
1116
|
return await this.adapters.http.patch(
|
|
1081
1117
|
`${this.getApiBaseUrl()}/payment-intent/confirm`,
|
|
1082
|
-
|
|
1118
|
+
c,
|
|
1083
1119
|
{
|
|
1084
1120
|
"x-token": this.paymentToken
|
|
1085
1121
|
}
|
|
@@ -1087,33 +1123,33 @@ var cr = class {
|
|
|
1087
1123
|
id: this.paymentIntentId || "",
|
|
1088
1124
|
amount: r.paymentIntent.amount,
|
|
1089
1125
|
currency: r.paymentIntent.currency,
|
|
1090
|
-
status:
|
|
1126
|
+
status: T.PROCESSING
|
|
1091
1127
|
};
|
|
1092
1128
|
} catch (a) {
|
|
1093
1129
|
let c = "Unknown error", d = "PAYMENT_FAILED";
|
|
1094
1130
|
if (a instanceof Error)
|
|
1095
1131
|
try {
|
|
1096
1132
|
if (or(a)) {
|
|
1097
|
-
const
|
|
1098
|
-
|
|
1133
|
+
const p = (n = a.response) == null ? void 0 : n.data, u = a.data;
|
|
1134
|
+
p ? (c = p.message || ((i = p.error) == null ? void 0 : i.message) || a.message, d = p.code || ((o = p.error) == null ? void 0 : o.code) || d) : u ? (c = u.message || ((s = u.error) == null ? void 0 : s.message) || a.message, d = u.code || ((l = u.error) == null ? void 0 : l.code) || d) : c = a.message;
|
|
1099
1135
|
} else
|
|
1100
1136
|
c = a.message;
|
|
1101
1137
|
} catch {
|
|
1102
1138
|
c = a.message;
|
|
1103
1139
|
}
|
|
1104
|
-
const
|
|
1140
|
+
const h = {
|
|
1105
1141
|
code: d,
|
|
1106
1142
|
message: c,
|
|
1107
1143
|
timestamp: this.adapters.timer.now()
|
|
1108
1144
|
};
|
|
1109
1145
|
throw this.setState({
|
|
1110
|
-
status:
|
|
1111
|
-
error:
|
|
1146
|
+
status: T.FAILED,
|
|
1147
|
+
error: h,
|
|
1112
1148
|
paymentIntent: r.paymentIntent
|
|
1113
1149
|
}), this.emit({
|
|
1114
1150
|
type: "payment_failed",
|
|
1115
1151
|
payload: {
|
|
1116
|
-
error:
|
|
1152
|
+
error: h,
|
|
1117
1153
|
paymentIntent: r.paymentIntent
|
|
1118
1154
|
}
|
|
1119
1155
|
}), a;
|
|
@@ -1261,6 +1297,46 @@ var cr = class {
|
|
|
1261
1297
|
});
|
|
1262
1298
|
return;
|
|
1263
1299
|
}
|
|
1300
|
+
if (e.selectedMethod === "duitnow") {
|
|
1301
|
+
this.stopPolling(), this.emit({
|
|
1302
|
+
type: "duitnow_redirect",
|
|
1303
|
+
payload: {
|
|
1304
|
+
redirectUrl: t.nextActionUrl,
|
|
1305
|
+
methodId: e.selectedMethod
|
|
1306
|
+
}
|
|
1307
|
+
});
|
|
1308
|
+
return;
|
|
1309
|
+
}
|
|
1310
|
+
if (e.selectedMethod === "gopay") {
|
|
1311
|
+
this.stopPolling(), this.emit({
|
|
1312
|
+
type: "gopay_redirect",
|
|
1313
|
+
payload: {
|
|
1314
|
+
redirectUrl: t.nextActionUrl,
|
|
1315
|
+
methodId: e.selectedMethod
|
|
1316
|
+
}
|
|
1317
|
+
});
|
|
1318
|
+
return;
|
|
1319
|
+
}
|
|
1320
|
+
if (e.selectedMethod === "boost") {
|
|
1321
|
+
this.stopPolling(), this.emit({
|
|
1322
|
+
type: "boost_redirect",
|
|
1323
|
+
payload: {
|
|
1324
|
+
redirectUrl: t.nextActionUrl,
|
|
1325
|
+
methodId: e.selectedMethod
|
|
1326
|
+
}
|
|
1327
|
+
});
|
|
1328
|
+
return;
|
|
1329
|
+
}
|
|
1330
|
+
if (e.selectedMethod === "shopeepay") {
|
|
1331
|
+
this.stopPolling(), this.emit({
|
|
1332
|
+
type: "shopeepay_redirect",
|
|
1333
|
+
payload: {
|
|
1334
|
+
redirectUrl: t.nextActionUrl,
|
|
1335
|
+
methodId: e.selectedMethod
|
|
1336
|
+
}
|
|
1337
|
+
});
|
|
1338
|
+
return;
|
|
1339
|
+
}
|
|
1264
1340
|
if (e.selectedMethod === "paynow" && !this.ignoreQRInPolling) {
|
|
1265
1341
|
this.emit({
|
|
1266
1342
|
type: "qr_code_received",
|
|
@@ -1276,11 +1352,11 @@ var cr = class {
|
|
|
1276
1352
|
id: t.paymentIntentId,
|
|
1277
1353
|
amount: t.amount ?? e.paymentIntent.amount,
|
|
1278
1354
|
currency: t.currency ?? e.paymentIntent.currency,
|
|
1279
|
-
status:
|
|
1355
|
+
status: T.REQUIRES_ACTION,
|
|
1280
1356
|
...t.metadata && { metadata: t.metadata }
|
|
1281
1357
|
};
|
|
1282
1358
|
this.setState({
|
|
1283
|
-
status:
|
|
1359
|
+
status: T.REQUIRES_ACTION,
|
|
1284
1360
|
paymentIntent: n,
|
|
1285
1361
|
actionUrl: t.nextActionUrl,
|
|
1286
1362
|
selectedMethod: e.selectedMethod,
|
|
@@ -1304,7 +1380,7 @@ var cr = class {
|
|
|
1304
1380
|
};
|
|
1305
1381
|
if (t.status === "succeeded")
|
|
1306
1382
|
this.stopPolling(), this.setState({
|
|
1307
|
-
status:
|
|
1383
|
+
status: T.SUCCEEDED,
|
|
1308
1384
|
paymentIntent: r,
|
|
1309
1385
|
selectedMethod: e.selectedMethod
|
|
1310
1386
|
}), this.emit({
|
|
@@ -1322,7 +1398,7 @@ var cr = class {
|
|
|
1322
1398
|
timestamp: this.adapters.timer.now()
|
|
1323
1399
|
};
|
|
1324
1400
|
this.setState({
|
|
1325
|
-
status:
|
|
1401
|
+
status: T.FAILED,
|
|
1326
1402
|
error: i,
|
|
1327
1403
|
paymentIntent: r
|
|
1328
1404
|
}), this.emit({
|
|
@@ -1358,37 +1434,37 @@ var cr = class {
|
|
|
1358
1434
|
r(t);
|
|
1359
1435
|
});
|
|
1360
1436
|
}
|
|
1361
|
-
}, dr = "https://images.ctfassets.net/c3n7jozh84hr/2A5qlS6JkUsOyFVPzQ0KlK/22b497afd71030ef1a44a52394b15027/______2022-06-30_11.03.43.png", ur = "https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/xLSOJpNvMp7cBKdvDln0B/eb2f53a0a3f2317750739dceff9df413/______2022-06-30_10.59.00.png",
|
|
1437
|
+
}, dr = "https://images.ctfassets.net/c3n7jozh84hr/2A5qlS6JkUsOyFVPzQ0KlK/22b497afd71030ef1a44a52394b15027/______2022-06-30_11.03.43.png", ur = "https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/xLSOJpNvMp7cBKdvDln0B/eb2f53a0a3f2317750739dceff9df413/______2022-06-30_10.59.00.png", hr = "https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/4Iq13VoxktB3amHFbQK1yb/f2fe12add0dac233d56c22cf5651c65c/image-20220630-030728.png", pr = "https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/mjau5Tqscwu9tbhRLFbmJ/a66cd2894060b2d3a94b75d7f4e65355/______2022-07-04_17.05.18.png", mr = "https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/1M4DBVFhOrkprPmjxZwS7M/c4a90840d3846b926d3a5524392435fe/Boost.svg", fr = "https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/1BYCLeHNQEyPXBjlIdu09h/71d67c5be3975f77091bf45c7ab58f65/ShopeePay.svg", G = typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, V = function(t, e, r, n, i, o, s, l, a, c) {
|
|
1362
1438
|
var d = this;
|
|
1363
|
-
d.numeralDecimalMark = t || ".", d.numeralIntegerScale = e > 0 ? e : 0, d.numeralDecimalScale = r >= 0 ? r : 2, d.numeralThousandsGroupStyle = n ||
|
|
1439
|
+
d.numeralDecimalMark = t || ".", d.numeralIntegerScale = e > 0 ? e : 0, d.numeralDecimalScale = r >= 0 ? r : 2, d.numeralThousandsGroupStyle = n || V.groupStyle.thousand, d.numeralPositiveOnly = !!i, d.stripLeadingZeroes = o !== !1, d.prefix = s || s === "" ? s : "", d.signBeforePrefix = !!l, d.tailPrefix = !!a, d.delimiter = c || c === "" ? c : ",", d.delimiterRE = c ? new RegExp("\\" + c, "g") : "";
|
|
1364
1440
|
};
|
|
1365
|
-
|
|
1441
|
+
V.groupStyle = {
|
|
1366
1442
|
thousand: "thousand",
|
|
1367
1443
|
lakh: "lakh",
|
|
1368
1444
|
wan: "wan",
|
|
1369
1445
|
none: "none"
|
|
1370
1446
|
};
|
|
1371
|
-
|
|
1447
|
+
V.prototype = {
|
|
1372
1448
|
getRawValue: function(t) {
|
|
1373
1449
|
return t.replace(this.delimiterRE, "").replace(this.numeralDecimalMark, ".");
|
|
1374
1450
|
},
|
|
1375
1451
|
format: function(t) {
|
|
1376
1452
|
var e = this, r, n, i, o, s = "";
|
|
1377
1453
|
switch (t = t.replace(/[A-Za-z]/g, "").replace(e.numeralDecimalMark, "M").replace(/[^\dM-]/g, "").replace(/^\-/, "N").replace(/\-/g, "").replace("N", e.numeralPositiveOnly ? "" : "-").replace("M", e.numeralDecimalMark), e.stripLeadingZeroes && (t = t.replace(/^(-)?0+(?=\d)/, "$1")), n = t.slice(0, 1) === "-" ? "-" : "", typeof e.prefix < "u" ? e.signBeforePrefix ? i = n + e.prefix : i = e.prefix + n : i = n, o = t, t.indexOf(e.numeralDecimalMark) >= 0 && (r = t.split(e.numeralDecimalMark), o = r[0], s = e.numeralDecimalMark + r[1].slice(0, e.numeralDecimalScale)), n === "-" && (o = o.slice(1)), e.numeralIntegerScale > 0 && (o = o.slice(0, e.numeralIntegerScale)), e.numeralThousandsGroupStyle) {
|
|
1378
|
-
case
|
|
1454
|
+
case V.groupStyle.lakh:
|
|
1379
1455
|
o = o.replace(/(\d)(?=(\d\d)+\d$)/g, "$1" + e.delimiter);
|
|
1380
1456
|
break;
|
|
1381
|
-
case
|
|
1457
|
+
case V.groupStyle.wan:
|
|
1382
1458
|
o = o.replace(/(\d)(?=(\d{4})+$)/g, "$1" + e.delimiter);
|
|
1383
1459
|
break;
|
|
1384
|
-
case
|
|
1460
|
+
case V.groupStyle.thousand:
|
|
1385
1461
|
o = o.replace(/(\d)(?=(\d{3})+$)/g, "$1" + e.delimiter);
|
|
1386
1462
|
break;
|
|
1387
1463
|
}
|
|
1388
1464
|
return e.tailPrefix ? n + o.toString() + (e.numeralDecimalScale > 0 ? s.toString() : "") + e.prefix : i + o.toString() + (e.numeralDecimalScale > 0 ? s.toString() : "");
|
|
1389
1465
|
}
|
|
1390
1466
|
};
|
|
1391
|
-
var
|
|
1467
|
+
var gr = V, yt = function(t, e, r) {
|
|
1392
1468
|
var n = this;
|
|
1393
1469
|
n.date = [], n.blocks = [], n.datePattern = t, n.dateMin = e.split("-").reverse().map(function(i) {
|
|
1394
1470
|
return parseInt(i, 10);
|
|
@@ -1428,22 +1504,22 @@ yt.prototype = {
|
|
|
1428
1504
|
}), this.getFixedDateString(r);
|
|
1429
1505
|
},
|
|
1430
1506
|
getFixedDateString: function(t) {
|
|
1431
|
-
var e = this, r = e.datePattern, n = [], i = 0, o = 0, s = 0, l = 0, a = 0, c = 0, d,
|
|
1432
|
-
t.length === 4 && r[0].toLowerCase() !== "y" && r[1].toLowerCase() !== "y" && (l = r[0] === "d" ? 0 : 2, a = 2 - l, d = parseInt(t.slice(l, l + 2), 10),
|
|
1507
|
+
var e = this, r = e.datePattern, n = [], i = 0, o = 0, s = 0, l = 0, a = 0, c = 0, d, h, p, u = !1;
|
|
1508
|
+
t.length === 4 && r[0].toLowerCase() !== "y" && r[1].toLowerCase() !== "y" && (l = r[0] === "d" ? 0 : 2, a = 2 - l, d = parseInt(t.slice(l, l + 2), 10), h = parseInt(t.slice(a, a + 2), 10), n = this.getFixedDate(d, h, 0)), t.length === 8 && (r.forEach(function(y, E) {
|
|
1433
1509
|
switch (y) {
|
|
1434
1510
|
case "d":
|
|
1435
|
-
i =
|
|
1511
|
+
i = E;
|
|
1436
1512
|
break;
|
|
1437
1513
|
case "m":
|
|
1438
|
-
o =
|
|
1514
|
+
o = E;
|
|
1439
1515
|
break;
|
|
1440
1516
|
default:
|
|
1441
|
-
s =
|
|
1517
|
+
s = E;
|
|
1442
1518
|
break;
|
|
1443
1519
|
}
|
|
1444
|
-
}), c = s * 2, l = i <= s ? i * 2 : i * 2 + 2, a = o <= s ? o * 2 : o * 2 + 2, d = parseInt(t.slice(l, l + 2), 10),
|
|
1445
|
-
var m = n.length === 0 ? t : r.reduce(function(y,
|
|
1446
|
-
switch (
|
|
1520
|
+
}), c = s * 2, l = i <= s ? i * 2 : i * 2 + 2, a = o <= s ? o * 2 : o * 2 + 2, d = parseInt(t.slice(l, l + 2), 10), h = parseInt(t.slice(a, a + 2), 10), p = parseInt(t.slice(c, c + 4), 10), u = t.slice(c, c + 4).length === 4, n = this.getFixedDate(d, h, p)), t.length === 4 && (r[0] === "y" || r[1] === "y") && (a = r[0] === "m" ? 0 : 2, c = 2 - a, h = parseInt(t.slice(a, a + 2), 10), p = parseInt(t.slice(c, c + 2), 10), u = t.slice(c, c + 2).length === 2, n = [0, h, p]), t.length === 6 && (r[0] === "Y" || r[1] === "Y") && (a = r[0] === "m" ? 0 : 4, c = 2 - 0.5 * a, h = parseInt(t.slice(a, a + 2), 10), p = parseInt(t.slice(c, c + 4), 10), u = t.slice(c, c + 4).length === 4, n = [0, h, p]), n = e.getRangeFixedDate(n), e.date = n;
|
|
1521
|
+
var m = n.length === 0 ? t : r.reduce(function(y, E) {
|
|
1522
|
+
switch (E) {
|
|
1447
1523
|
case "d":
|
|
1448
1524
|
return y + (n[0] === 0 ? "" : e.addLeadingZero(n[0]));
|
|
1449
1525
|
case "m":
|
|
@@ -1475,7 +1551,7 @@ yt.prototype = {
|
|
|
1475
1551
|
return e ? (t < 10 ? "000" : t < 100 ? "00" : t < 1e3 ? "0" : "") + t : (t < 10 ? "0" : "") + t;
|
|
1476
1552
|
}
|
|
1477
1553
|
};
|
|
1478
|
-
var
|
|
1554
|
+
var yr = yt, bt = function(t, e) {
|
|
1479
1555
|
var r = this;
|
|
1480
1556
|
r.time = [], r.blocks = [], r.timePattern = t, r.timeFormat = e, r.initBlocks();
|
|
1481
1557
|
};
|
|
@@ -1528,7 +1604,7 @@ bt.prototype = {
|
|
|
1528
1604
|
}), this.getFixedTimeString(r);
|
|
1529
1605
|
},
|
|
1530
1606
|
getFixedTimeString: function(t) {
|
|
1531
|
-
var e = this, r = e.timePattern, n = [], i = 0, o = 0, s = 0, l = 0, a = 0, c = 0, d,
|
|
1607
|
+
var e = this, r = e.timePattern, n = [], i = 0, o = 0, s = 0, l = 0, a = 0, c = 0, d, h, p;
|
|
1532
1608
|
return t.length === 6 && (r.forEach(function(u, m) {
|
|
1533
1609
|
switch (u) {
|
|
1534
1610
|
case "s":
|
|
@@ -1541,7 +1617,7 @@ bt.prototype = {
|
|
|
1541
1617
|
s = m * 2;
|
|
1542
1618
|
break;
|
|
1543
1619
|
}
|
|
1544
|
-
}), c = s, a = o, l = i, d = parseInt(t.slice(l, l + 2), 10),
|
|
1620
|
+
}), c = s, a = o, l = i, d = parseInt(t.slice(l, l + 2), 10), h = parseInt(t.slice(a, a + 2), 10), p = parseInt(t.slice(c, c + 2), 10), n = this.getFixedTime(p, h, d)), t.length === 4 && e.timePattern.indexOf("s") < 0 && (r.forEach(function(u, m) {
|
|
1545
1621
|
switch (u) {
|
|
1546
1622
|
case "m":
|
|
1547
1623
|
o = m * 2;
|
|
@@ -1550,7 +1626,7 @@ bt.prototype = {
|
|
|
1550
1626
|
s = m * 2;
|
|
1551
1627
|
break;
|
|
1552
1628
|
}
|
|
1553
|
-
}), c = s, a = o, d = 0,
|
|
1629
|
+
}), c = s, a = o, d = 0, h = parseInt(t.slice(a, a + 2), 10), p = parseInt(t.slice(c, c + 2), 10), n = this.getFixedTime(p, h, d)), e.time = n, n.length === 0 ? t : r.reduce(function(u, m) {
|
|
1554
1630
|
switch (m) {
|
|
1555
1631
|
case "s":
|
|
1556
1632
|
return u + e.addLeadingZero(n[2]);
|
|
@@ -1568,7 +1644,7 @@ bt.prototype = {
|
|
|
1568
1644
|
return (t < 10 ? "0" : "") + t;
|
|
1569
1645
|
}
|
|
1570
1646
|
};
|
|
1571
|
-
var
|
|
1647
|
+
var br = bt, vt = function(t, e) {
|
|
1572
1648
|
var r = this;
|
|
1573
1649
|
r.delimiter = e || e === "" ? e : " ", r.delimiterRE = e ? new RegExp("\\" + e, "g") : "", r.formatter = t;
|
|
1574
1650
|
};
|
|
@@ -1584,7 +1660,7 @@ vt.prototype = {
|
|
|
1584
1660
|
return r = r.replace(/[()]/g, ""), r = r.replace(/[\s-]/g, e.delimiter), r;
|
|
1585
1661
|
}
|
|
1586
1662
|
};
|
|
1587
|
-
var
|
|
1663
|
+
var vr = vt, Le = {
|
|
1588
1664
|
blocks: {
|
|
1589
1665
|
uatp: [4, 5, 6],
|
|
1590
1666
|
amex: [4, 6, 5],
|
|
@@ -1636,7 +1712,7 @@ var fr = vt, Be = {
|
|
|
1636
1712
|
return t.concat(19 - e);
|
|
1637
1713
|
},
|
|
1638
1714
|
getInfo: function(t, e) {
|
|
1639
|
-
var r =
|
|
1715
|
+
var r = Le.blocks, n = Le.re;
|
|
1640
1716
|
e = !!e;
|
|
1641
1717
|
for (var i in n)
|
|
1642
1718
|
if (n[i].test(t)) {
|
|
@@ -1651,7 +1727,7 @@ var fr = vt, Be = {
|
|
|
1651
1727
|
blocks: e ? this.getStrictBlocks(r.general) : r.general
|
|
1652
1728
|
};
|
|
1653
1729
|
}
|
|
1654
|
-
},
|
|
1730
|
+
}, wr = Le, xr = {
|
|
1655
1731
|
noop: function() {
|
|
1656
1732
|
},
|
|
1657
1733
|
strip: function(t, e) {
|
|
@@ -1727,8 +1803,8 @@ var fr = vt, Be = {
|
|
|
1727
1803
|
var s = "", l = i.length > 0, a = "";
|
|
1728
1804
|
return r === 0 ? t : (e.forEach(function(c, d) {
|
|
1729
1805
|
if (t.length > 0) {
|
|
1730
|
-
var
|
|
1731
|
-
l ? a = i[o ? d - 1 : d] || a : a = n, o ? (d > 0 && (s += a), s +=
|
|
1806
|
+
var h = t.slice(0, c), p = t.slice(c);
|
|
1807
|
+
l ? a = i[o ? d - 1 : d] || a : a = n, o ? (d > 0 && (s += a), s += h) : (s += h, h.length === c && d < r - 1 && (s += a)), t = p;
|
|
1732
1808
|
}
|
|
1733
1809
|
}), s);
|
|
1734
1810
|
},
|
|
@@ -1780,15 +1856,15 @@ var fr = vt, Be = {
|
|
|
1780
1856
|
isAndroidBackspaceKeydown: function(t, e) {
|
|
1781
1857
|
return !this.isAndroid() || !t || !e ? !1 : e === t.slice(0, -1);
|
|
1782
1858
|
}
|
|
1783
|
-
},
|
|
1859
|
+
}, Sr = xr, Pr = {
|
|
1784
1860
|
// Maybe change to object-assign
|
|
1785
1861
|
// for now just keep it as simple
|
|
1786
1862
|
assign: function(t, e) {
|
|
1787
1863
|
return t = t || {}, e = e || {}, t.creditCard = !!e.creditCard, t.creditCardStrictMode = !!e.creditCardStrictMode, t.creditCardType = "", t.onCreditCardTypeChanged = e.onCreditCardTypeChanged || function() {
|
|
1788
|
-
}, t.phone = !!e.phone, t.phoneRegionCode = e.phoneRegionCode || "AU", t.phoneFormatter = {}, t.time = !!e.time, t.timePattern = e.timePattern || ["h", "m", "s"], t.timeFormat = e.timeFormat || "24", t.timeFormatter = {}, t.date = !!e.date, t.datePattern = e.datePattern || ["d", "m", "Y"], t.dateMin = e.dateMin || "", t.dateMax = e.dateMax || "", t.dateFormatter = {}, t.numeral = !!e.numeral, t.numeralIntegerScale = e.numeralIntegerScale > 0 ? e.numeralIntegerScale : 0, t.numeralDecimalScale = e.numeralDecimalScale >= 0 ? e.numeralDecimalScale : 2, t.numeralDecimalMark = e.numeralDecimalMark || ".", t.numeralThousandsGroupStyle = e.numeralThousandsGroupStyle || "thousand", t.numeralPositiveOnly = !!e.numeralPositiveOnly, t.stripLeadingZeroes = e.stripLeadingZeroes !== !1, t.signBeforePrefix = !!e.signBeforePrefix, t.tailPrefix = !!e.tailPrefix, t.swapHiddenInput = !!e.swapHiddenInput, t.numericOnly = t.creditCard || t.date || !!e.numericOnly, t.uppercase = !!e.uppercase, t.lowercase = !!e.lowercase, t.prefix = t.creditCard || t.date ? "" : e.prefix || "", t.noImmediatePrefix = !!e.noImmediatePrefix, t.prefixLength = t.prefix.length, t.rawValueTrimPrefix = !!e.rawValueTrimPrefix, t.copyDelimiter = !!e.copyDelimiter, t.initValue = e.initValue !== void 0 && e.initValue !== null ? e.initValue.toString() : "", t.delimiter = e.delimiter || e.delimiter === "" ? e.delimiter : e.date ? "/" : e.time ? ":" : e.numeral ? "," : (e.phone, " "), t.delimiterLength = t.delimiter.length, t.delimiterLazyShow = !!e.delimiterLazyShow, t.delimiters = e.delimiters || [], t.blocks = e.blocks || [], t.blocksLength = t.blocks.length, t.root = typeof
|
|
1864
|
+
}, t.phone = !!e.phone, t.phoneRegionCode = e.phoneRegionCode || "AU", t.phoneFormatter = {}, t.time = !!e.time, t.timePattern = e.timePattern || ["h", "m", "s"], t.timeFormat = e.timeFormat || "24", t.timeFormatter = {}, t.date = !!e.date, t.datePattern = e.datePattern || ["d", "m", "Y"], t.dateMin = e.dateMin || "", t.dateMax = e.dateMax || "", t.dateFormatter = {}, t.numeral = !!e.numeral, t.numeralIntegerScale = e.numeralIntegerScale > 0 ? e.numeralIntegerScale : 0, t.numeralDecimalScale = e.numeralDecimalScale >= 0 ? e.numeralDecimalScale : 2, t.numeralDecimalMark = e.numeralDecimalMark || ".", t.numeralThousandsGroupStyle = e.numeralThousandsGroupStyle || "thousand", t.numeralPositiveOnly = !!e.numeralPositiveOnly, t.stripLeadingZeroes = e.stripLeadingZeroes !== !1, t.signBeforePrefix = !!e.signBeforePrefix, t.tailPrefix = !!e.tailPrefix, t.swapHiddenInput = !!e.swapHiddenInput, t.numericOnly = t.creditCard || t.date || !!e.numericOnly, t.uppercase = !!e.uppercase, t.lowercase = !!e.lowercase, t.prefix = t.creditCard || t.date ? "" : e.prefix || "", t.noImmediatePrefix = !!e.noImmediatePrefix, t.prefixLength = t.prefix.length, t.rawValueTrimPrefix = !!e.rawValueTrimPrefix, t.copyDelimiter = !!e.copyDelimiter, t.initValue = e.initValue !== void 0 && e.initValue !== null ? e.initValue.toString() : "", t.delimiter = e.delimiter || e.delimiter === "" ? e.delimiter : e.date ? "/" : e.time ? ":" : e.numeral ? "," : (e.phone, " "), t.delimiterLength = t.delimiter.length, t.delimiterLazyShow = !!e.delimiterLazyShow, t.delimiters = e.delimiters || [], t.blocks = e.blocks || [], t.blocksLength = t.blocks.length, t.root = typeof G == "object" && G ? G : window, t.document = e.document || t.root.document, t.maxLength = 0, t.backspace = !1, t.result = "", t.onValueChanged = e.onValueChanged || function() {
|
|
1789
1865
|
}, t;
|
|
1790
1866
|
}
|
|
1791
|
-
},
|
|
1867
|
+
}, kr = Pr, P = function(t, e) {
|
|
1792
1868
|
var r = this, n = !1;
|
|
1793
1869
|
if (typeof t == "string" ? (r.element = document.querySelector(t), n = document.querySelectorAll(t).length > 1) : typeof t.length < "u" && t.length > 0 ? (r.element = t[0], n = t.length > 1) : r.element = t, !r.element)
|
|
1794
1870
|
throw new Error("[cleave.js] Please check the element");
|
|
@@ -1797,16 +1873,16 @@ var fr = vt, Be = {
|
|
|
1797
1873
|
console.warn("[cleave.js] Multiple input fields matched, cleave.js will only take the first one.");
|
|
1798
1874
|
} catch {
|
|
1799
1875
|
}
|
|
1800
|
-
e.initValue = r.element.value, r.properties =
|
|
1876
|
+
e.initValue = r.element.value, r.properties = P.DefaultProperties.assign({}, e), r.init();
|
|
1801
1877
|
};
|
|
1802
|
-
|
|
1878
|
+
P.prototype = {
|
|
1803
1879
|
init: function() {
|
|
1804
1880
|
var t = this, e = t.properties;
|
|
1805
1881
|
if (!e.numeral && !e.phone && !e.creditCard && !e.time && !e.date && e.blocksLength === 0 && !e.prefix) {
|
|
1806
1882
|
t.onInput(e.initValue);
|
|
1807
1883
|
return;
|
|
1808
1884
|
}
|
|
1809
|
-
e.maxLength =
|
|
1885
|
+
e.maxLength = P.Util.getMaxLength(e.blocks), t.isAndroid = P.Util.isAndroid(), t.lastInputValue = "", t.isBackward = "", t.onChangeListener = t.onChange.bind(t), t.onKeyDownListener = t.onKeyDown.bind(t), t.onFocusListener = t.onFocus.bind(t), t.onCutListener = t.onCut.bind(t), t.onCopyListener = t.onCopy.bind(t), t.initSwapHiddenInput(), t.element.addEventListener("input", t.onChangeListener), t.element.addEventListener("keydown", t.onKeyDownListener), t.element.addEventListener("focus", t.onFocusListener), t.element.addEventListener("cut", t.onCutListener), t.element.addEventListener("copy", t.onCopyListener), t.initPhoneFormatter(), t.initDateFormatter(), t.initTimeFormatter(), t.initNumeralFormatter(), (e.initValue || e.prefix && !e.noImmediatePrefix) && t.onInput(e.initValue);
|
|
1810
1886
|
},
|
|
1811
1887
|
initSwapHiddenInput: function() {
|
|
1812
1888
|
var t = this, e = t.properties;
|
|
@@ -1817,7 +1893,7 @@ x.prototype = {
|
|
|
1817
1893
|
},
|
|
1818
1894
|
initNumeralFormatter: function() {
|
|
1819
1895
|
var t = this, e = t.properties;
|
|
1820
|
-
e.numeral && (e.numeralFormatter = new
|
|
1896
|
+
e.numeral && (e.numeralFormatter = new P.NumeralFormatter(
|
|
1821
1897
|
e.numeralDecimalMark,
|
|
1822
1898
|
e.numeralIntegerScale,
|
|
1823
1899
|
e.numeralDecimalScale,
|
|
@@ -1832,17 +1908,17 @@ x.prototype = {
|
|
|
1832
1908
|
},
|
|
1833
1909
|
initTimeFormatter: function() {
|
|
1834
1910
|
var t = this, e = t.properties;
|
|
1835
|
-
e.time && (e.timeFormatter = new
|
|
1911
|
+
e.time && (e.timeFormatter = new P.TimeFormatter(e.timePattern, e.timeFormat), e.blocks = e.timeFormatter.getBlocks(), e.blocksLength = e.blocks.length, e.maxLength = P.Util.getMaxLength(e.blocks));
|
|
1836
1912
|
},
|
|
1837
1913
|
initDateFormatter: function() {
|
|
1838
1914
|
var t = this, e = t.properties;
|
|
1839
|
-
e.date && (e.dateFormatter = new
|
|
1915
|
+
e.date && (e.dateFormatter = new P.DateFormatter(e.datePattern, e.dateMin, e.dateMax), e.blocks = e.dateFormatter.getBlocks(), e.blocksLength = e.blocks.length, e.maxLength = P.Util.getMaxLength(e.blocks));
|
|
1840
1916
|
},
|
|
1841
1917
|
initPhoneFormatter: function() {
|
|
1842
1918
|
var t = this, e = t.properties;
|
|
1843
1919
|
if (e.phone)
|
|
1844
1920
|
try {
|
|
1845
|
-
e.phoneFormatter = new
|
|
1921
|
+
e.phoneFormatter = new P.PhoneFormatter(
|
|
1846
1922
|
new e.root.Cleave.AsYouTypeFormatter(e.phoneRegionCode),
|
|
1847
1923
|
e.delimiter
|
|
1848
1924
|
);
|
|
@@ -1855,23 +1931,23 @@ x.prototype = {
|
|
|
1855
1931
|
e.lastInputValue = e.element.value, e.isBackward = r === 8;
|
|
1856
1932
|
},
|
|
1857
1933
|
onChange: function(t) {
|
|
1858
|
-
var e = this, r = e.properties, n =
|
|
1934
|
+
var e = this, r = e.properties, n = P.Util;
|
|
1859
1935
|
e.isBackward = e.isBackward || t.inputType === "deleteContentBackward";
|
|
1860
1936
|
var i = n.getPostDelimiter(e.lastInputValue, r.delimiter, r.delimiters);
|
|
1861
1937
|
e.isBackward && i ? r.postDelimiterBackspace = i : r.postDelimiterBackspace = !1, this.onInput(this.element.value);
|
|
1862
1938
|
},
|
|
1863
1939
|
onFocus: function() {
|
|
1864
1940
|
var t = this, e = t.properties;
|
|
1865
|
-
t.lastInputValue = t.element.value, e.prefix && e.noImmediatePrefix && !t.element.value && this.onInput(e.prefix),
|
|
1941
|
+
t.lastInputValue = t.element.value, e.prefix && e.noImmediatePrefix && !t.element.value && this.onInput(e.prefix), P.Util.fixPrefixCursor(t.element, e.prefix, e.delimiter, e.delimiters);
|
|
1866
1942
|
},
|
|
1867
1943
|
onCut: function(t) {
|
|
1868
|
-
|
|
1944
|
+
P.Util.checkFullSelection(this.element.value) && (this.copyClipboardData(t), this.onInput(""));
|
|
1869
1945
|
},
|
|
1870
1946
|
onCopy: function(t) {
|
|
1871
|
-
|
|
1947
|
+
P.Util.checkFullSelection(this.element.value) && this.copyClipboardData(t);
|
|
1872
1948
|
},
|
|
1873
1949
|
copyClipboardData: function(t) {
|
|
1874
|
-
var e = this, r = e.properties, n =
|
|
1950
|
+
var e = this, r = e.properties, n = P.Util, i = e.element.value, o = "";
|
|
1875
1951
|
r.copyDelimiter ? o = i : o = n.stripDelimiters(i, r.delimiter, r.delimiters);
|
|
1876
1952
|
try {
|
|
1877
1953
|
t.clipboardData ? t.clipboardData.setData("Text", o) : window.clipboardData.setData("Text", o), t.preventDefault();
|
|
@@ -1879,7 +1955,7 @@ x.prototype = {
|
|
|
1879
1955
|
}
|
|
1880
1956
|
},
|
|
1881
1957
|
onInput: function(t) {
|
|
1882
|
-
var e = this, r = e.properties, n =
|
|
1958
|
+
var e = this, r = e.properties, n = P.Util, i = n.getPostDelimiter(t, r.delimiter, r.delimiters);
|
|
1883
1959
|
if (!r.numeral && r.postDelimiterBackspace && !i && (t = n.headStr(t, t.length - r.postDelimiterBackspace.length)), r.phone) {
|
|
1884
1960
|
r.prefix && (!r.noImmediatePrefix || t.length) ? r.result = r.prefix + r.phoneFormatter.format(t).slice(r.prefix.length) : r.result = r.phoneFormatter.format(t), e.updateValueState();
|
|
1885
1961
|
return;
|
|
@@ -1902,11 +1978,11 @@ x.prototype = {
|
|
|
1902
1978
|
), e.updateValueState();
|
|
1903
1979
|
},
|
|
1904
1980
|
updateCreditCardPropsByValue: function(t) {
|
|
1905
|
-
var e = this, r = e.properties, n =
|
|
1906
|
-
n.headStr(r.result, 4) !== n.headStr(t, 4) && (i =
|
|
1981
|
+
var e = this, r = e.properties, n = P.Util, i;
|
|
1982
|
+
n.headStr(r.result, 4) !== n.headStr(t, 4) && (i = P.CreditCardDetector.getInfo(t, r.creditCardStrictMode), r.blocks = i.blocks, r.blocksLength = r.blocks.length, r.maxLength = n.getMaxLength(r.blocks), r.creditCardType !== i.type && (r.creditCardType = i.type, r.onCreditCardTypeChanged.call(e, r.creditCardType)));
|
|
1907
1983
|
},
|
|
1908
1984
|
updateValueState: function() {
|
|
1909
|
-
var t = this, e =
|
|
1985
|
+
var t = this, e = P.Util, r = t.properties;
|
|
1910
1986
|
if (t.element) {
|
|
1911
1987
|
var n = t.element.selectionEnd, i = t.element.value, o = r.result;
|
|
1912
1988
|
if (n = e.getNextCursorPosition(n, i, o, r.delimiter, r.delimiters), t.isAndroid) {
|
|
@@ -1937,7 +2013,7 @@ x.prototype = {
|
|
|
1937
2013
|
t = t != null ? t.toString() : "", r.numeral && (t = t.replace(".", r.numeralDecimalMark)), r.postDelimiterBackspace = !1, e.element.value = t, e.onInput(t);
|
|
1938
2014
|
},
|
|
1939
2015
|
getRawValue: function() {
|
|
1940
|
-
var t = this, e = t.properties, r =
|
|
2016
|
+
var t = this, e = t.properties, r = P.Util, n = t.element.value;
|
|
1941
2017
|
return e.rawValueTrimPrefix && (n = r.getPrefixStrippedValue(n, e.prefix, e.prefixLength, e.result, e.delimiter, e.delimiters, e.noImmediatePrefix, e.tailPrefix, e.signBeforePrefix)), e.numeral ? n = e.numeralFormatter.getRawValue(n) : n = r.stripDelimiters(n, e.delimiter, e.delimiters), n;
|
|
1942
2018
|
},
|
|
1943
2019
|
getISOFormatDate: function() {
|
|
@@ -1959,19 +2035,19 @@ x.prototype = {
|
|
|
1959
2035
|
return "[Cleave Object]";
|
|
1960
2036
|
}
|
|
1961
2037
|
};
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
(typeof
|
|
1970
|
-
var at =
|
|
2038
|
+
P.NumeralFormatter = gr;
|
|
2039
|
+
P.DateFormatter = yr;
|
|
2040
|
+
P.TimeFormatter = br;
|
|
2041
|
+
P.PhoneFormatter = vr;
|
|
2042
|
+
P.CreditCardDetector = wr;
|
|
2043
|
+
P.Util = Sr;
|
|
2044
|
+
P.DefaultProperties = kr;
|
|
2045
|
+
(typeof G == "object" && G ? G : window).Cleave = P;
|
|
2046
|
+
var at = P, pe = {}, Cr = function() {
|
|
1971
2047
|
return typeof Promise == "function" && Promise.prototype && Promise.prototype.then;
|
|
1972
|
-
}, wt = {},
|
|
2048
|
+
}, wt = {}, $ = {};
|
|
1973
2049
|
let je;
|
|
1974
|
-
const
|
|
2050
|
+
const Er = [
|
|
1975
2051
|
0,
|
|
1976
2052
|
// Not used
|
|
1977
2053
|
26,
|
|
@@ -2015,32 +2091,32 @@ const Sr = [
|
|
|
2015
2091
|
3532,
|
|
2016
2092
|
3706
|
|
2017
2093
|
];
|
|
2018
|
-
|
|
2094
|
+
$.getSymbolSize = function(e) {
|
|
2019
2095
|
if (!e) throw new Error('"version" cannot be null or undefined');
|
|
2020
2096
|
if (e < 1 || e > 40) throw new Error('"version" should be in range from 1 to 40');
|
|
2021
2097
|
return e * 4 + 17;
|
|
2022
2098
|
};
|
|
2023
|
-
|
|
2024
|
-
return
|
|
2099
|
+
$.getSymbolTotalCodewords = function(e) {
|
|
2100
|
+
return Er[e];
|
|
2025
2101
|
};
|
|
2026
|
-
|
|
2102
|
+
$.getBCHDigit = function(t) {
|
|
2027
2103
|
let e = 0;
|
|
2028
2104
|
for (; t !== 0; )
|
|
2029
2105
|
e++, t >>>= 1;
|
|
2030
2106
|
return e;
|
|
2031
2107
|
};
|
|
2032
|
-
|
|
2108
|
+
$.setToSJISFunction = function(e) {
|
|
2033
2109
|
if (typeof e != "function")
|
|
2034
2110
|
throw new Error('"toSJISFunc" is not a valid function.');
|
|
2035
2111
|
je = e;
|
|
2036
2112
|
};
|
|
2037
|
-
|
|
2113
|
+
$.isKanjiModeEnabled = function() {
|
|
2038
2114
|
return typeof je < "u";
|
|
2039
2115
|
};
|
|
2040
|
-
|
|
2116
|
+
$.toSJIS = function(e) {
|
|
2041
2117
|
return je(e);
|
|
2042
2118
|
};
|
|
2043
|
-
var
|
|
2119
|
+
var Pe = {};
|
|
2044
2120
|
(function(t) {
|
|
2045
2121
|
t.L = { bit: 1 }, t.M = { bit: 0 }, t.Q = { bit: 3 }, t.H = { bit: 2 };
|
|
2046
2122
|
function e(r) {
|
|
@@ -2074,7 +2150,7 @@ var ke = {};
|
|
|
2074
2150
|
return i;
|
|
2075
2151
|
}
|
|
2076
2152
|
};
|
|
2077
|
-
})(
|
|
2153
|
+
})(Pe);
|
|
2078
2154
|
function xt() {
|
|
2079
2155
|
this.buffer = [], this.length = 0;
|
|
2080
2156
|
}
|
|
@@ -2095,7 +2171,7 @@ xt.prototype = {
|
|
|
2095
2171
|
this.buffer.length <= e && this.buffer.push(0), t && (this.buffer[e] |= 128 >>> this.length % 8), this.length++;
|
|
2096
2172
|
}
|
|
2097
2173
|
};
|
|
2098
|
-
var
|
|
2174
|
+
var Ar = xt;
|
|
2099
2175
|
function me(t) {
|
|
2100
2176
|
if (!t || t < 1)
|
|
2101
2177
|
throw new Error("BitMatrix size must be defined and greater than 0");
|
|
@@ -2114,9 +2190,9 @@ me.prototype.xor = function(t, e, r) {
|
|
|
2114
2190
|
me.prototype.isReserved = function(t, e) {
|
|
2115
2191
|
return this.reservedBit[t * this.size + e];
|
|
2116
2192
|
};
|
|
2117
|
-
var
|
|
2193
|
+
var _r = me, St = {};
|
|
2118
2194
|
(function(t) {
|
|
2119
|
-
const e =
|
|
2195
|
+
const e = $.getSymbolSize;
|
|
2120
2196
|
t.getRowColCoords = function(n) {
|
|
2121
2197
|
if (n === 1) return [];
|
|
2122
2198
|
const i = Math.floor(n / 7) + 2, o = e(n), s = o === 145 ? 26 : Math.ceil((o - 13) / (2 * i - 2)) * 2, l = [o - 7];
|
|
@@ -2133,10 +2209,10 @@ var Cr = me, St = {};
|
|
|
2133
2209
|
return i;
|
|
2134
2210
|
};
|
|
2135
2211
|
})(St);
|
|
2136
|
-
var
|
|
2137
|
-
const
|
|
2138
|
-
|
|
2139
|
-
const r =
|
|
2212
|
+
var Pt = {};
|
|
2213
|
+
const Ir = $.getSymbolSize, lt = 7;
|
|
2214
|
+
Pt.getPositions = function(e) {
|
|
2215
|
+
const r = Ir(e);
|
|
2140
2216
|
return [
|
|
2141
2217
|
// top-left
|
|
2142
2218
|
[0, 0],
|
|
@@ -2146,7 +2222,7 @@ kt.getPositions = function(e) {
|
|
|
2146
2222
|
[0, r - lt]
|
|
2147
2223
|
];
|
|
2148
2224
|
};
|
|
2149
|
-
var
|
|
2225
|
+
var kt = {};
|
|
2150
2226
|
(function(t) {
|
|
2151
2227
|
t.Patterns = {
|
|
2152
2228
|
PATTERN000: 0,
|
|
@@ -2171,11 +2247,11 @@ var Ct = {};
|
|
|
2171
2247
|
}, t.getPenaltyN1 = function(i) {
|
|
2172
2248
|
const o = i.size;
|
|
2173
2249
|
let s = 0, l = 0, a = 0, c = null, d = null;
|
|
2174
|
-
for (let
|
|
2250
|
+
for (let h = 0; h < o; h++) {
|
|
2175
2251
|
l = a = 0, c = d = null;
|
|
2176
|
-
for (let
|
|
2177
|
-
let u = i.get(
|
|
2178
|
-
u === c ? l++ : (l >= 5 && (s += e.N1 + (l - 5)), c = u, l = 1), u = i.get(
|
|
2252
|
+
for (let p = 0; p < o; p++) {
|
|
2253
|
+
let u = i.get(h, p);
|
|
2254
|
+
u === c ? l++ : (l >= 5 && (s += e.N1 + (l - 5)), c = u, l = 1), u = i.get(p, h), u === d ? a++ : (a >= 5 && (s += e.N1 + (a - 5)), d = u, a = 1);
|
|
2179
2255
|
}
|
|
2180
2256
|
l >= 5 && (s += e.N1 + (l - 5)), a >= 5 && (s += e.N1 + (a - 5));
|
|
2181
2257
|
}
|
|
@@ -2241,9 +2317,9 @@ var Ct = {};
|
|
|
2241
2317
|
}
|
|
2242
2318
|
return l;
|
|
2243
2319
|
};
|
|
2244
|
-
})(
|
|
2245
|
-
var
|
|
2246
|
-
const
|
|
2320
|
+
})(kt);
|
|
2321
|
+
var ke = {};
|
|
2322
|
+
const O = Pe, fe = [
|
|
2247
2323
|
// L M Q H
|
|
2248
2324
|
1,
|
|
2249
2325
|
1,
|
|
@@ -2568,35 +2644,35 @@ const z = ke, fe = [
|
|
|
2568
2644
|
2040,
|
|
2569
2645
|
2430
|
|
2570
2646
|
];
|
|
2571
|
-
|
|
2647
|
+
ke.getBlocksCount = function(e, r) {
|
|
2572
2648
|
switch (r) {
|
|
2573
|
-
case
|
|
2649
|
+
case O.L:
|
|
2574
2650
|
return fe[(e - 1) * 4 + 0];
|
|
2575
|
-
case
|
|
2651
|
+
case O.M:
|
|
2576
2652
|
return fe[(e - 1) * 4 + 1];
|
|
2577
|
-
case
|
|
2653
|
+
case O.Q:
|
|
2578
2654
|
return fe[(e - 1) * 4 + 2];
|
|
2579
|
-
case
|
|
2655
|
+
case O.H:
|
|
2580
2656
|
return fe[(e - 1) * 4 + 3];
|
|
2581
2657
|
default:
|
|
2582
2658
|
return;
|
|
2583
2659
|
}
|
|
2584
2660
|
};
|
|
2585
|
-
|
|
2661
|
+
ke.getTotalCodewordsCount = function(e, r) {
|
|
2586
2662
|
switch (r) {
|
|
2587
|
-
case
|
|
2663
|
+
case O.L:
|
|
2588
2664
|
return ge[(e - 1) * 4 + 0];
|
|
2589
|
-
case
|
|
2665
|
+
case O.M:
|
|
2590
2666
|
return ge[(e - 1) * 4 + 1];
|
|
2591
|
-
case
|
|
2667
|
+
case O.Q:
|
|
2592
2668
|
return ge[(e - 1) * 4 + 2];
|
|
2593
|
-
case
|
|
2669
|
+
case O.H:
|
|
2594
2670
|
return ge[(e - 1) * 4 + 3];
|
|
2595
2671
|
default:
|
|
2596
2672
|
return;
|
|
2597
2673
|
}
|
|
2598
2674
|
};
|
|
2599
|
-
var
|
|
2675
|
+
var Ct = {}, Ce = {};
|
|
2600
2676
|
const ae = new Uint8Array(512), we = new Uint8Array(256);
|
|
2601
2677
|
(function() {
|
|
2602
2678
|
let e = 1;
|
|
@@ -2605,18 +2681,18 @@ const ae = new Uint8Array(512), we = new Uint8Array(256);
|
|
|
2605
2681
|
for (let r = 255; r < 512; r++)
|
|
2606
2682
|
ae[r] = ae[r - 255];
|
|
2607
2683
|
})();
|
|
2608
|
-
|
|
2684
|
+
Ce.log = function(e) {
|
|
2609
2685
|
if (e < 1) throw new Error("log(" + e + ")");
|
|
2610
2686
|
return we[e];
|
|
2611
2687
|
};
|
|
2612
|
-
|
|
2688
|
+
Ce.exp = function(e) {
|
|
2613
2689
|
return ae[e];
|
|
2614
2690
|
};
|
|
2615
|
-
|
|
2691
|
+
Ce.mul = function(e, r) {
|
|
2616
2692
|
return e === 0 || r === 0 ? 0 : ae[we[e] + we[r]];
|
|
2617
2693
|
};
|
|
2618
2694
|
(function(t) {
|
|
2619
|
-
const e =
|
|
2695
|
+
const e = Ce;
|
|
2620
2696
|
t.mul = function(n, i) {
|
|
2621
2697
|
const o = new Uint8Array(n.length + i.length - 1);
|
|
2622
2698
|
for (let s = 0; s < n.length; s++)
|
|
@@ -2640,8 +2716,8 @@ Pe.mul = function(e, r) {
|
|
|
2640
2716
|
i = t.mul(i, new Uint8Array([1, e.exp(o)]));
|
|
2641
2717
|
return i;
|
|
2642
2718
|
};
|
|
2643
|
-
})(
|
|
2644
|
-
const Et =
|
|
2719
|
+
})(Ct);
|
|
2720
|
+
const Et = Ct;
|
|
2645
2721
|
function Qe(t) {
|
|
2646
2722
|
this.genPoly = void 0, this.degree = t, this.degree && this.initialize(this.degree);
|
|
2647
2723
|
}
|
|
@@ -2660,33 +2736,33 @@ Qe.prototype.encode = function(e) {
|
|
|
2660
2736
|
}
|
|
2661
2737
|
return n;
|
|
2662
2738
|
};
|
|
2663
|
-
var
|
|
2739
|
+
var Mr = Qe, At = {}, q = {}, Ke = {};
|
|
2664
2740
|
Ke.isValid = function(e) {
|
|
2665
2741
|
return !isNaN(e) && e >= 1 && e <= 40;
|
|
2666
2742
|
};
|
|
2667
|
-
var
|
|
2668
|
-
const
|
|
2743
|
+
var B = {};
|
|
2744
|
+
const _t = "[0-9]+", Dr = "[A-Z $%*+\\-./:]+";
|
|
2669
2745
|
let ue = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";
|
|
2670
2746
|
ue = ue.replace(/u/g, "\\u");
|
|
2671
|
-
const
|
|
2747
|
+
const $r = "(?:(?![A-Z0-9 $%*+\\-./:]|" + ue + `)(?:.|[\r
|
|
2672
2748
|
]))+`;
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
const
|
|
2679
|
-
|
|
2680
|
-
return
|
|
2749
|
+
B.KANJI = new RegExp(ue, "g");
|
|
2750
|
+
B.BYTE_KANJI = new RegExp("[^A-Z0-9 $%*+\\-./:]+", "g");
|
|
2751
|
+
B.BYTE = new RegExp($r, "g");
|
|
2752
|
+
B.NUMERIC = new RegExp(_t, "g");
|
|
2753
|
+
B.ALPHANUMERIC = new RegExp(Dr, "g");
|
|
2754
|
+
const Tr = new RegExp("^" + ue + "$"), Nr = new RegExp("^" + _t + "$"), Rr = new RegExp("^[A-Z0-9 $%*+\\-./:]+$");
|
|
2755
|
+
B.testKanji = function(e) {
|
|
2756
|
+
return Tr.test(e);
|
|
2681
2757
|
};
|
|
2682
|
-
|
|
2683
|
-
return
|
|
2758
|
+
B.testNumeric = function(e) {
|
|
2759
|
+
return Nr.test(e);
|
|
2684
2760
|
};
|
|
2685
|
-
|
|
2686
|
-
return
|
|
2761
|
+
B.testAlphanumeric = function(e) {
|
|
2762
|
+
return Rr.test(e);
|
|
2687
2763
|
};
|
|
2688
2764
|
(function(t) {
|
|
2689
|
-
const e = Ke, r =
|
|
2765
|
+
const e = Ke, r = B;
|
|
2690
2766
|
t.NUMERIC = {
|
|
2691
2767
|
id: "Numeric",
|
|
2692
2768
|
bit: 1,
|
|
@@ -2745,25 +2821,25 @@ L.testAlphanumeric = function(e) {
|
|
|
2745
2821
|
};
|
|
2746
2822
|
})(q);
|
|
2747
2823
|
(function(t) {
|
|
2748
|
-
const e =
|
|
2749
|
-
function a(
|
|
2824
|
+
const e = $, r = ke, n = Pe, i = q, o = Ke, s = 7973, l = e.getBCHDigit(s);
|
|
2825
|
+
function a(p, u, m) {
|
|
2750
2826
|
for (let y = 1; y <= 40; y++)
|
|
2751
|
-
if (u <= t.getCapacity(y, m,
|
|
2827
|
+
if (u <= t.getCapacity(y, m, p))
|
|
2752
2828
|
return y;
|
|
2753
2829
|
}
|
|
2754
|
-
function c(
|
|
2755
|
-
return i.getCharCountIndicator(
|
|
2830
|
+
function c(p, u) {
|
|
2831
|
+
return i.getCharCountIndicator(p, u) + 4;
|
|
2756
2832
|
}
|
|
2757
|
-
function d(
|
|
2833
|
+
function d(p, u) {
|
|
2758
2834
|
let m = 0;
|
|
2759
|
-
return
|
|
2760
|
-
const
|
|
2761
|
-
m +=
|
|
2835
|
+
return p.forEach(function(y) {
|
|
2836
|
+
const E = c(y.mode, u);
|
|
2837
|
+
m += E + y.getBitsLength();
|
|
2762
2838
|
}), m;
|
|
2763
2839
|
}
|
|
2764
|
-
function p
|
|
2840
|
+
function h(p, u) {
|
|
2765
2841
|
for (let m = 1; m <= 40; m++)
|
|
2766
|
-
if (d(
|
|
2842
|
+
if (d(p, m) <= t.getCapacity(m, u, i.MIXED))
|
|
2767
2843
|
return m;
|
|
2768
2844
|
}
|
|
2769
2845
|
t.from = function(u, m) {
|
|
@@ -2772,7 +2848,7 @@ L.testAlphanumeric = function(e) {
|
|
|
2772
2848
|
if (!o.isValid(u))
|
|
2773
2849
|
throw new Error("Invalid QR Code version");
|
|
2774
2850
|
typeof y > "u" && (y = i.BYTE);
|
|
2775
|
-
const
|
|
2851
|
+
const E = e.getSymbolTotalCodewords(u), b = r.getTotalCodewordsCount(u, m), v = (E - b) * 8;
|
|
2776
2852
|
if (y === i.MIXED) return v;
|
|
2777
2853
|
const g = v - c(y, u);
|
|
2778
2854
|
switch (y) {
|
|
@@ -2788,16 +2864,16 @@ L.testAlphanumeric = function(e) {
|
|
|
2788
2864
|
}
|
|
2789
2865
|
}, t.getBestVersionForData = function(u, m) {
|
|
2790
2866
|
let y;
|
|
2791
|
-
const
|
|
2867
|
+
const E = n.from(m, n.M);
|
|
2792
2868
|
if (Array.isArray(u)) {
|
|
2793
2869
|
if (u.length > 1)
|
|
2794
|
-
return
|
|
2870
|
+
return h(u, E);
|
|
2795
2871
|
if (u.length === 0)
|
|
2796
2872
|
return 1;
|
|
2797
2873
|
y = u[0];
|
|
2798
2874
|
} else
|
|
2799
2875
|
y = u;
|
|
2800
|
-
return a(y.mode, y.getLength(),
|
|
2876
|
+
return a(y.mode, y.getLength(), E);
|
|
2801
2877
|
}, t.getEncodedBits = function(u) {
|
|
2802
2878
|
if (!o.isValid(u) || u < 7)
|
|
2803
2879
|
throw new Error("Invalid QR Code version");
|
|
@@ -2807,38 +2883,38 @@ L.testAlphanumeric = function(e) {
|
|
|
2807
2883
|
return u << 12 | m;
|
|
2808
2884
|
};
|
|
2809
2885
|
})(At);
|
|
2810
|
-
var
|
|
2811
|
-
const
|
|
2812
|
-
|
|
2886
|
+
var It = {};
|
|
2887
|
+
const Ue = $, Mt = 1335, Br = 21522, ct = Ue.getBCHDigit(Mt);
|
|
2888
|
+
It.getEncodedBits = function(e, r) {
|
|
2813
2889
|
const n = e.bit << 3 | r;
|
|
2814
2890
|
let i = n << 10;
|
|
2815
|
-
for (;
|
|
2816
|
-
i ^= Mt <<
|
|
2817
|
-
return (n << 10 | i) ^
|
|
2891
|
+
for (; Ue.getBCHDigit(i) - ct >= 0; )
|
|
2892
|
+
i ^= Mt << Ue.getBCHDigit(i) - ct;
|
|
2893
|
+
return (n << 10 | i) ^ Br;
|
|
2818
2894
|
};
|
|
2819
2895
|
var Dt = {};
|
|
2820
|
-
const
|
|
2821
|
-
function
|
|
2822
|
-
this.mode =
|
|
2896
|
+
const Lr = q;
|
|
2897
|
+
function J(t) {
|
|
2898
|
+
this.mode = Lr.NUMERIC, this.data = t.toString();
|
|
2823
2899
|
}
|
|
2824
|
-
|
|
2900
|
+
J.getBitsLength = function(e) {
|
|
2825
2901
|
return 10 * Math.floor(e / 3) + (e % 3 ? e % 3 * 3 + 1 : 0);
|
|
2826
2902
|
};
|
|
2827
|
-
|
|
2903
|
+
J.prototype.getLength = function() {
|
|
2828
2904
|
return this.data.length;
|
|
2829
2905
|
};
|
|
2830
|
-
|
|
2831
|
-
return
|
|
2906
|
+
J.prototype.getBitsLength = function() {
|
|
2907
|
+
return J.getBitsLength(this.data.length);
|
|
2832
2908
|
};
|
|
2833
|
-
|
|
2909
|
+
J.prototype.write = function(e) {
|
|
2834
2910
|
let r, n, i;
|
|
2835
2911
|
for (r = 0; r + 3 <= this.data.length; r += 3)
|
|
2836
2912
|
n = this.data.substr(r, 3), i = parseInt(n, 10), e.put(i, 10);
|
|
2837
2913
|
const o = this.data.length - r;
|
|
2838
2914
|
o > 0 && (n = this.data.substr(r), i = parseInt(n, 10), e.put(i, o * 3 + 1));
|
|
2839
2915
|
};
|
|
2840
|
-
var
|
|
2841
|
-
const
|
|
2916
|
+
var Ur = J;
|
|
2917
|
+
const Fr = q, $e = [
|
|
2842
2918
|
"0",
|
|
2843
2919
|
"1",
|
|
2844
2920
|
"2",
|
|
@@ -2886,7 +2962,7 @@ const Rr = q, Te = [
|
|
|
2886
2962
|
":"
|
|
2887
2963
|
];
|
|
2888
2964
|
function X(t) {
|
|
2889
|
-
this.mode =
|
|
2965
|
+
this.mode = Fr.ALPHANUMERIC, this.data = t;
|
|
2890
2966
|
}
|
|
2891
2967
|
X.getBitsLength = function(e) {
|
|
2892
2968
|
return 11 * Math.floor(e / 2) + 6 * (e % 2);
|
|
@@ -2900,15 +2976,15 @@ X.prototype.getBitsLength = function() {
|
|
|
2900
2976
|
X.prototype.write = function(e) {
|
|
2901
2977
|
let r;
|
|
2902
2978
|
for (r = 0; r + 2 <= this.data.length; r += 2) {
|
|
2903
|
-
let n =
|
|
2904
|
-
n +=
|
|
2979
|
+
let n = $e.indexOf(this.data[r]) * 45;
|
|
2980
|
+
n += $e.indexOf(this.data[r + 1]), e.put(n, 11);
|
|
2905
2981
|
}
|
|
2906
|
-
this.data.length % 2 && e.put(
|
|
2982
|
+
this.data.length % 2 && e.put($e.indexOf(this.data[r]), 6);
|
|
2907
2983
|
};
|
|
2908
|
-
var
|
|
2909
|
-
const
|
|
2984
|
+
var Or = X;
|
|
2985
|
+
const zr = q;
|
|
2910
2986
|
function ee(t) {
|
|
2911
|
-
this.mode =
|
|
2987
|
+
this.mode = zr.BYTE, typeof t == "string" ? this.data = new TextEncoder().encode(t) : this.data = new Uint8Array(t);
|
|
2912
2988
|
}
|
|
2913
2989
|
ee.getBitsLength = function(e) {
|
|
2914
2990
|
return e * 8;
|
|
@@ -2923,10 +2999,10 @@ ee.prototype.write = function(t) {
|
|
|
2923
2999
|
for (let e = 0, r = this.data.length; e < r; e++)
|
|
2924
3000
|
t.put(this.data[e], 8);
|
|
2925
3001
|
};
|
|
2926
|
-
var
|
|
2927
|
-
const
|
|
3002
|
+
var qr = ee;
|
|
3003
|
+
const Hr = q, Yr = $;
|
|
2928
3004
|
function te(t) {
|
|
2929
|
-
this.mode =
|
|
3005
|
+
this.mode = Hr.KANJI, this.data = t;
|
|
2930
3006
|
}
|
|
2931
3007
|
te.getBitsLength = function(e) {
|
|
2932
3008
|
return e * 13;
|
|
@@ -2940,7 +3016,7 @@ te.prototype.getBitsLength = function() {
|
|
|
2940
3016
|
te.prototype.write = function(t) {
|
|
2941
3017
|
let e;
|
|
2942
3018
|
for (e = 0; e < this.data.length; e++) {
|
|
2943
|
-
let r =
|
|
3019
|
+
let r = Yr.toSJIS(this.data[e]);
|
|
2944
3020
|
if (r >= 33088 && r <= 40956)
|
|
2945
3021
|
r -= 33088;
|
|
2946
3022
|
else if (r >= 57408 && r <= 60351)
|
|
@@ -2953,7 +3029,7 @@ Make sure your charset is UTF-8`
|
|
|
2953
3029
|
r = (r >>> 8 & 255) * 192 + (r & 255), t.put(r, 13);
|
|
2954
3030
|
}
|
|
2955
3031
|
};
|
|
2956
|
-
var
|
|
3032
|
+
var Vr = te, $t = { exports: {} };
|
|
2957
3033
|
(function(t) {
|
|
2958
3034
|
var e = {
|
|
2959
3035
|
single_source_shortest_paths: function(r, n, i) {
|
|
@@ -2961,10 +3037,10 @@ var Or = te, Tt = { exports: {} };
|
|
|
2961
3037
|
s[n] = 0;
|
|
2962
3038
|
var l = e.PriorityQueue.make();
|
|
2963
3039
|
l.push(n, 0);
|
|
2964
|
-
for (var a, c, d,
|
|
2965
|
-
a = l.pop(), c = a.value,
|
|
2966
|
-
for (d in
|
|
2967
|
-
|
|
3040
|
+
for (var a, c, d, h, p, u, m, y, E; !l.empty(); ) {
|
|
3041
|
+
a = l.pop(), c = a.value, h = a.cost, p = r[c] || {};
|
|
3042
|
+
for (d in p)
|
|
3043
|
+
p.hasOwnProperty(d) && (u = p[d], m = h + u, y = s[d], E = typeof s[d] > "u", (E || y > m) && (s[d] = m, l.push(d, m), o[d] = c));
|
|
2968
3044
|
}
|
|
2969
3045
|
if (typeof i < "u" && typeof s[i] > "u") {
|
|
2970
3046
|
var b = ["Could not find a path from ", n, " to ", i, "."].join("");
|
|
@@ -3018,39 +3094,39 @@ var Or = te, Tt = { exports: {} };
|
|
|
3018
3094
|
}
|
|
3019
3095
|
};
|
|
3020
3096
|
t.exports = e;
|
|
3021
|
-
})(
|
|
3022
|
-
var
|
|
3097
|
+
})($t);
|
|
3098
|
+
var jr = $t.exports;
|
|
3023
3099
|
(function(t) {
|
|
3024
|
-
const e = q, r =
|
|
3100
|
+
const e = q, r = Ur, n = Or, i = qr, o = Vr, s = B, l = $, a = jr;
|
|
3025
3101
|
function c(b) {
|
|
3026
3102
|
return unescape(encodeURIComponent(b)).length;
|
|
3027
3103
|
}
|
|
3028
3104
|
function d(b, v, g) {
|
|
3029
3105
|
const f = [];
|
|
3030
|
-
let
|
|
3031
|
-
for (; (
|
|
3106
|
+
let C;
|
|
3107
|
+
for (; (C = b.exec(g)) !== null; )
|
|
3032
3108
|
f.push({
|
|
3033
|
-
data:
|
|
3034
|
-
index:
|
|
3109
|
+
data: C[0],
|
|
3110
|
+
index: C.index,
|
|
3035
3111
|
mode: v,
|
|
3036
|
-
length:
|
|
3112
|
+
length: C[0].length
|
|
3037
3113
|
});
|
|
3038
3114
|
return f;
|
|
3039
3115
|
}
|
|
3040
|
-
function
|
|
3116
|
+
function h(b) {
|
|
3041
3117
|
const v = d(s.NUMERIC, e.NUMERIC, b), g = d(s.ALPHANUMERIC, e.ALPHANUMERIC, b);
|
|
3042
|
-
let f,
|
|
3043
|
-
return l.isKanjiModeEnabled() ? (f = d(s.BYTE, e.BYTE, b),
|
|
3044
|
-
return
|
|
3045
|
-
}).map(function(
|
|
3118
|
+
let f, C;
|
|
3119
|
+
return l.isKanjiModeEnabled() ? (f = d(s.BYTE, e.BYTE, b), C = d(s.KANJI, e.KANJI, b)) : (f = d(s.BYTE_KANJI, e.BYTE, b), C = []), v.concat(g, f, C).sort(function(_, N) {
|
|
3120
|
+
return _.index - N.index;
|
|
3121
|
+
}).map(function(_) {
|
|
3046
3122
|
return {
|
|
3047
|
-
data:
|
|
3048
|
-
mode:
|
|
3049
|
-
length:
|
|
3123
|
+
data: _.data,
|
|
3124
|
+
mode: _.mode,
|
|
3125
|
+
length: _.length
|
|
3050
3126
|
};
|
|
3051
3127
|
});
|
|
3052
3128
|
}
|
|
3053
|
-
function
|
|
3129
|
+
function p(b, v) {
|
|
3054
3130
|
switch (v) {
|
|
3055
3131
|
case e.NUMERIC:
|
|
3056
3132
|
return r.getBitsLength(b);
|
|
@@ -3102,24 +3178,24 @@ var qr = Tt.exports;
|
|
|
3102
3178
|
}
|
|
3103
3179
|
function y(b, v) {
|
|
3104
3180
|
const g = {}, f = { start: {} };
|
|
3105
|
-
let
|
|
3106
|
-
for (let
|
|
3107
|
-
const
|
|
3108
|
-
for (let
|
|
3109
|
-
const R =
|
|
3181
|
+
let C = ["start"];
|
|
3182
|
+
for (let A = 0; A < b.length; A++) {
|
|
3183
|
+
const _ = b[A], N = [];
|
|
3184
|
+
for (let U = 0; U < _.length; U++) {
|
|
3185
|
+
const R = _[U], re = "" + A + U;
|
|
3110
3186
|
N.push(re), g[re] = { node: R, lastCount: 0 }, f[re] = {};
|
|
3111
|
-
for (let Ae = 0; Ae <
|
|
3112
|
-
const
|
|
3113
|
-
g[
|
|
3187
|
+
for (let Ae = 0; Ae < C.length; Ae++) {
|
|
3188
|
+
const L = C[Ae];
|
|
3189
|
+
g[L] && g[L].node.mode === R.mode ? (f[L][re] = p(g[L].lastCount + R.length, R.mode) - p(g[L].lastCount, R.mode), g[L].lastCount += R.length) : (g[L] && (g[L].lastCount = R.length), f[L][re] = p(R.length, R.mode) + 4 + e.getCharCountIndicator(R.mode, v));
|
|
3114
3190
|
}
|
|
3115
3191
|
}
|
|
3116
|
-
|
|
3192
|
+
C = N;
|
|
3117
3193
|
}
|
|
3118
|
-
for (let
|
|
3119
|
-
f[
|
|
3194
|
+
for (let A = 0; A < C.length; A++)
|
|
3195
|
+
f[C[A]].end = 0;
|
|
3120
3196
|
return { map: f, table: g };
|
|
3121
3197
|
}
|
|
3122
|
-
function
|
|
3198
|
+
function E(b, v) {
|
|
3123
3199
|
let g;
|
|
3124
3200
|
const f = e.getBestModeForData(b);
|
|
3125
3201
|
if (g = e.from(v, f), g !== e.BYTE && g.bit < f.bit)
|
|
@@ -3138,22 +3214,22 @@ var qr = Tt.exports;
|
|
|
3138
3214
|
}
|
|
3139
3215
|
t.fromArray = function(v) {
|
|
3140
3216
|
return v.reduce(function(g, f) {
|
|
3141
|
-
return typeof f == "string" ? g.push(
|
|
3217
|
+
return typeof f == "string" ? g.push(E(f, null)) : f.data && g.push(E(f.data, f.mode)), g;
|
|
3142
3218
|
}, []);
|
|
3143
3219
|
}, t.fromString = function(v, g) {
|
|
3144
|
-
const f =
|
|
3145
|
-
for (let
|
|
3146
|
-
N.push(
|
|
3220
|
+
const f = h(v, l.isKanjiModeEnabled()), C = m(f), A = y(C, g), _ = a.find_path(A.map, "start", "end"), N = [];
|
|
3221
|
+
for (let U = 1; U < _.length - 1; U++)
|
|
3222
|
+
N.push(A.table[_[U]].node);
|
|
3147
3223
|
return t.fromArray(u(N));
|
|
3148
3224
|
}, t.rawSplit = function(v) {
|
|
3149
3225
|
return t.fromArray(
|
|
3150
|
-
|
|
3226
|
+
h(v, l.isKanjiModeEnabled())
|
|
3151
3227
|
);
|
|
3152
3228
|
};
|
|
3153
3229
|
})(Dt);
|
|
3154
|
-
const Ee =
|
|
3155
|
-
function
|
|
3156
|
-
const r = t.size, n =
|
|
3230
|
+
const Ee = $, Te = Pe, Qr = Ar, Kr = _r, Gr = St, Wr = Pt, Fe = kt, Oe = ke, Zr = Mr, xe = At, Jr = It, Xr = q, Ne = Dt;
|
|
3231
|
+
function en(t, e) {
|
|
3232
|
+
const r = t.size, n = Wr.getPositions(e);
|
|
3157
3233
|
for (let i = 0; i < n.length; i++) {
|
|
3158
3234
|
const o = n[i][0], s = n[i][1];
|
|
3159
3235
|
for (let l = -1; l <= 7; l++)
|
|
@@ -3162,15 +3238,15 @@ function Jr(t, e) {
|
|
|
3162
3238
|
s + a <= -1 || r <= s + a || (l >= 0 && l <= 6 && (a === 0 || a === 6) || a >= 0 && a <= 6 && (l === 0 || l === 6) || l >= 2 && l <= 4 && a >= 2 && a <= 4 ? t.set(o + l, s + a, !0, !0) : t.set(o + l, s + a, !1, !0));
|
|
3163
3239
|
}
|
|
3164
3240
|
}
|
|
3165
|
-
function
|
|
3241
|
+
function tn(t) {
|
|
3166
3242
|
const e = t.size;
|
|
3167
3243
|
for (let r = 8; r < e - 8; r++) {
|
|
3168
3244
|
const n = r % 2 === 0;
|
|
3169
3245
|
t.set(r, 6, n, !0), t.set(6, r, n, !0);
|
|
3170
3246
|
}
|
|
3171
3247
|
}
|
|
3172
|
-
function
|
|
3173
|
-
const r =
|
|
3248
|
+
function rn(t, e) {
|
|
3249
|
+
const r = Gr.getPositions(e);
|
|
3174
3250
|
for (let n = 0; n < r.length; n++) {
|
|
3175
3251
|
const i = r[n][0], o = r[n][1];
|
|
3176
3252
|
for (let s = -2; s <= 2; s++)
|
|
@@ -3178,20 +3254,20 @@ function Wr(t, e) {
|
|
|
3178
3254
|
s === -2 || s === 2 || l === -2 || l === 2 || s === 0 && l === 0 ? t.set(i + s, o + l, !0, !0) : t.set(i + s, o + l, !1, !0);
|
|
3179
3255
|
}
|
|
3180
3256
|
}
|
|
3181
|
-
function
|
|
3257
|
+
function nn(t, e) {
|
|
3182
3258
|
const r = t.size, n = xe.getEncodedBits(e);
|
|
3183
3259
|
let i, o, s;
|
|
3184
3260
|
for (let l = 0; l < 18; l++)
|
|
3185
3261
|
i = Math.floor(l / 3), o = l % 3 + r - 8 - 3, s = (n >> l & 1) === 1, t.set(i, o, s, !0), t.set(o, i, s, !0);
|
|
3186
3262
|
}
|
|
3187
3263
|
function Re(t, e, r) {
|
|
3188
|
-
const n = t.size, i =
|
|
3264
|
+
const n = t.size, i = Jr.getEncodedBits(e, r);
|
|
3189
3265
|
let o, s;
|
|
3190
3266
|
for (o = 0; o < 15; o++)
|
|
3191
3267
|
s = (i >> o & 1) === 1, o < 6 ? t.set(o, 8, s, !0) : o < 8 ? t.set(o + 1, 8, s, !0) : t.set(n - 15 + o, 8, s, !0), o < 8 ? t.set(8, n - o - 1, s, !0) : o < 9 ? t.set(8, 15 - o - 1 + 1, s, !0) : t.set(8, 15 - o - 1, s, !0);
|
|
3192
3268
|
t.set(n - 8, 8, 1, !0);
|
|
3193
3269
|
}
|
|
3194
|
-
function
|
|
3270
|
+
function on(t, e) {
|
|
3195
3271
|
const r = t.size;
|
|
3196
3272
|
let n = -1, i = r - 1, o = 7, s = 0;
|
|
3197
3273
|
for (let l = r - 1; l > 0; l -= 2)
|
|
@@ -3207,40 +3283,40 @@ function en(t, e) {
|
|
|
3207
3283
|
}
|
|
3208
3284
|
}
|
|
3209
3285
|
}
|
|
3210
|
-
function
|
|
3211
|
-
const n = new
|
|
3286
|
+
function sn(t, e, r) {
|
|
3287
|
+
const n = new Qr();
|
|
3212
3288
|
r.forEach(function(a) {
|
|
3213
|
-
n.put(a.mode.bit, 4), n.put(a.getLength(),
|
|
3289
|
+
n.put(a.mode.bit, 4), n.put(a.getLength(), Xr.getCharCountIndicator(a.mode, t)), a.write(n);
|
|
3214
3290
|
});
|
|
3215
|
-
const i = Ee.getSymbolTotalCodewords(t), o =
|
|
3291
|
+
const i = Ee.getSymbolTotalCodewords(t), o = Oe.getTotalCodewordsCount(t, e), s = (i - o) * 8;
|
|
3216
3292
|
for (n.getLengthInBits() + 4 <= s && n.put(0, 4); n.getLengthInBits() % 8 !== 0; )
|
|
3217
3293
|
n.putBit(0);
|
|
3218
3294
|
const l = (s - n.getLengthInBits()) / 8;
|
|
3219
3295
|
for (let a = 0; a < l; a++)
|
|
3220
3296
|
n.put(a % 2 ? 17 : 236, 8);
|
|
3221
|
-
return
|
|
3297
|
+
return an(n, t, e);
|
|
3222
3298
|
}
|
|
3223
|
-
function
|
|
3224
|
-
const n = Ee.getSymbolTotalCodewords(e), i =
|
|
3299
|
+
function an(t, e, r) {
|
|
3300
|
+
const n = Ee.getSymbolTotalCodewords(e), i = Oe.getTotalCodewordsCount(e, r), o = n - i, s = Oe.getBlocksCount(e, r), l = n % s, a = s - l, c = Math.floor(n / s), d = Math.floor(o / s), h = d + 1, p = c - d, u = new Zr(p);
|
|
3225
3301
|
let m = 0;
|
|
3226
|
-
const y = new Array(s),
|
|
3302
|
+
const y = new Array(s), E = new Array(s);
|
|
3227
3303
|
let b = 0;
|
|
3228
3304
|
const v = new Uint8Array(t.buffer);
|
|
3229
|
-
for (let
|
|
3230
|
-
const N =
|
|
3231
|
-
y[
|
|
3305
|
+
for (let _ = 0; _ < s; _++) {
|
|
3306
|
+
const N = _ < a ? d : h;
|
|
3307
|
+
y[_] = v.slice(m, m + N), E[_] = u.encode(y[_]), m += N, b = Math.max(b, N);
|
|
3232
3308
|
}
|
|
3233
3309
|
const g = new Uint8Array(n);
|
|
3234
|
-
let f = 0,
|
|
3235
|
-
for (
|
|
3236
|
-
for (
|
|
3237
|
-
|
|
3238
|
-
for (
|
|
3239
|
-
for (
|
|
3240
|
-
g[f++] =
|
|
3310
|
+
let f = 0, C, A;
|
|
3311
|
+
for (C = 0; C < b; C++)
|
|
3312
|
+
for (A = 0; A < s; A++)
|
|
3313
|
+
C < y[A].length && (g[f++] = y[A][C]);
|
|
3314
|
+
for (C = 0; C < p; C++)
|
|
3315
|
+
for (A = 0; A < s; A++)
|
|
3316
|
+
g[f++] = E[A][C];
|
|
3241
3317
|
return g;
|
|
3242
3318
|
}
|
|
3243
|
-
function
|
|
3319
|
+
function ln(t, e, r, n) {
|
|
3244
3320
|
let i;
|
|
3245
3321
|
if (Array.isArray(t))
|
|
3246
3322
|
i = Ne.fromArray(t);
|
|
@@ -3265,11 +3341,11 @@ The chosen QR Code version cannot contain this amount of data.
|
|
|
3265
3341
|
Minimum version required to store current data is: ` + o + `.
|
|
3266
3342
|
`
|
|
3267
3343
|
);
|
|
3268
|
-
const s =
|
|
3269
|
-
return
|
|
3344
|
+
const s = sn(e, r, i), l = Ee.getSymbolSize(e), a = new Kr(l);
|
|
3345
|
+
return en(a, e), tn(a), rn(a, e), Re(a, r, 0), e >= 7 && nn(a, e), on(a, s), isNaN(n) && (n = Fe.getBestMask(
|
|
3270
3346
|
a,
|
|
3271
3347
|
Re.bind(null, a, r)
|
|
3272
|
-
)),
|
|
3348
|
+
)), Fe.applyMask(n, a), Re(a, r, n), {
|
|
3273
3349
|
modules: a,
|
|
3274
3350
|
version: e,
|
|
3275
3351
|
errorCorrectionLevel: r,
|
|
@@ -3280,10 +3356,10 @@ Minimum version required to store current data is: ` + o + `.
|
|
|
3280
3356
|
wt.create = function(e, r) {
|
|
3281
3357
|
if (typeof e > "u" || e === "")
|
|
3282
3358
|
throw new Error("No input text");
|
|
3283
|
-
let n =
|
|
3284
|
-
return typeof r < "u" && (n =
|
|
3359
|
+
let n = Te.M, i, o;
|
|
3360
|
+
return typeof r < "u" && (n = Te.from(r.errorCorrectionLevel, Te.M), i = xe.from(r.version), o = Fe.from(r.maskPattern), r.toSJISFunc && Ee.setToSJISFunction(r.toSJISFunc)), ln(e, i, n, o);
|
|
3285
3361
|
};
|
|
3286
|
-
var
|
|
3362
|
+
var Tt = {}, Ge = {};
|
|
3287
3363
|
(function(t) {
|
|
3288
3364
|
function e(r) {
|
|
3289
3365
|
if (typeof r == "number" && (r = r.toString()), typeof r != "string")
|
|
@@ -3323,20 +3399,20 @@ var $t = {}, Ze = {};
|
|
|
3323
3399
|
const o = t.getScale(n, i);
|
|
3324
3400
|
return Math.floor((n + i.margin * 2) * o);
|
|
3325
3401
|
}, t.qrToImageData = function(n, i, o) {
|
|
3326
|
-
const s = i.modules.size, l = i.modules.data, a = t.getScale(s, o), c = Math.floor((s + o.margin * 2) * a), d = o.margin * a,
|
|
3327
|
-
for (let
|
|
3402
|
+
const s = i.modules.size, l = i.modules.data, a = t.getScale(s, o), c = Math.floor((s + o.margin * 2) * a), d = o.margin * a, h = [o.color.light, o.color.dark];
|
|
3403
|
+
for (let p = 0; p < c; p++)
|
|
3328
3404
|
for (let u = 0; u < c; u++) {
|
|
3329
|
-
let m = (
|
|
3330
|
-
if (
|
|
3331
|
-
const
|
|
3332
|
-
y =
|
|
3405
|
+
let m = (p * c + u) * 4, y = o.color.light;
|
|
3406
|
+
if (p >= d && u >= d && p < c - d && u < c - d) {
|
|
3407
|
+
const E = Math.floor((p - d) / a), b = Math.floor((u - d) / a);
|
|
3408
|
+
y = h[l[E * s + b] ? 1 : 0];
|
|
3333
3409
|
}
|
|
3334
3410
|
n[m++] = y.r, n[m++] = y.g, n[m++] = y.b, n[m] = y.a;
|
|
3335
3411
|
}
|
|
3336
3412
|
};
|
|
3337
|
-
})(
|
|
3413
|
+
})(Ge);
|
|
3338
3414
|
(function(t) {
|
|
3339
|
-
const e =
|
|
3415
|
+
const e = Ge;
|
|
3340
3416
|
function r(i, o, s) {
|
|
3341
3417
|
i.clearRect(0, 0, o.width, o.height), o.style || (o.style = {}), o.height = s, o.width = s, o.style.height = s + "px", o.style.width = s + "px";
|
|
3342
3418
|
}
|
|
@@ -3350,42 +3426,42 @@ var $t = {}, Ze = {};
|
|
|
3350
3426
|
t.render = function(o, s, l) {
|
|
3351
3427
|
let a = l, c = s;
|
|
3352
3428
|
typeof a > "u" && (!s || !s.getContext) && (a = s, s = void 0), s || (c = n()), a = e.getOptions(a);
|
|
3353
|
-
const d = e.getImageWidth(o.modules.size, a),
|
|
3354
|
-
return e.qrToImageData(
|
|
3429
|
+
const d = e.getImageWidth(o.modules.size, a), h = c.getContext("2d"), p = h.createImageData(d, d);
|
|
3430
|
+
return e.qrToImageData(p.data, o, a), r(h, c, d), h.putImageData(p, 0, 0), c;
|
|
3355
3431
|
}, t.renderToDataURL = function(o, s, l) {
|
|
3356
3432
|
let a = l;
|
|
3357
3433
|
typeof a > "u" && (!s || !s.getContext) && (a = s, s = void 0), a || (a = {});
|
|
3358
|
-
const c = t.render(o, s, a), d = a.type || "image/png",
|
|
3359
|
-
return c.toDataURL(d,
|
|
3434
|
+
const c = t.render(o, s, a), d = a.type || "image/png", h = a.rendererOpts || {};
|
|
3435
|
+
return c.toDataURL(d, h.quality);
|
|
3360
3436
|
};
|
|
3361
|
-
})(
|
|
3437
|
+
})(Tt);
|
|
3362
3438
|
var Nt = {};
|
|
3363
|
-
const
|
|
3439
|
+
const cn = Ge;
|
|
3364
3440
|
function dt(t, e) {
|
|
3365
3441
|
const r = t.a / 255, n = e + '="' + t.hex + '"';
|
|
3366
3442
|
return r < 1 ? n + " " + e + '-opacity="' + r.toFixed(2).slice(1) + '"' : n;
|
|
3367
3443
|
}
|
|
3368
|
-
function
|
|
3444
|
+
function Be(t, e, r) {
|
|
3369
3445
|
let n = t + e;
|
|
3370
3446
|
return typeof r < "u" && (n += " " + r), n;
|
|
3371
3447
|
}
|
|
3372
|
-
function
|
|
3448
|
+
function dn(t, e, r) {
|
|
3373
3449
|
let n = "", i = 0, o = !1, s = 0;
|
|
3374
3450
|
for (let l = 0; l < t.length; l++) {
|
|
3375
3451
|
const a = Math.floor(l % e), c = Math.floor(l / e);
|
|
3376
|
-
!a && !o && (o = !0), t[l] ? (s++, l > 0 && a > 0 && t[l - 1] || (n += o ?
|
|
3452
|
+
!a && !o && (o = !0), t[l] ? (s++, l > 0 && a > 0 && t[l - 1] || (n += o ? Be("M", a + r, 0.5 + c + r) : Be("m", i, 0), i = 0, o = !1), a + 1 < e && t[l + 1] || (n += Be("h", s), s = 0)) : i++;
|
|
3377
3453
|
}
|
|
3378
3454
|
return n;
|
|
3379
3455
|
}
|
|
3380
3456
|
Nt.render = function(e, r, n) {
|
|
3381
|
-
const i =
|
|
3457
|
+
const i = cn.getOptions(r), o = e.modules.size, s = e.modules.data, l = o + i.margin * 2, a = i.color.light.a ? "<path " + dt(i.color.light, "fill") + ' d="M0 0h' + l + "v" + l + 'H0z"/>' : "", c = "<path " + dt(i.color.dark, "stroke") + ' d="' + dn(s, o, i.margin) + '"/>', d = 'viewBox="0 0 ' + l + " " + l + '"', p = '<svg xmlns="http://www.w3.org/2000/svg" ' + (i.width ? 'width="' + i.width + '" height="' + i.width + '" ' : "") + d + ' shape-rendering="crispEdges">' + a + c + `</svg>
|
|
3382
3458
|
`;
|
|
3383
|
-
return typeof n == "function" && n(null,
|
|
3459
|
+
return typeof n == "function" && n(null, p), p;
|
|
3384
3460
|
};
|
|
3385
|
-
const
|
|
3386
|
-
function
|
|
3461
|
+
const un = Cr, ze = wt, Rt = Tt, hn = Nt;
|
|
3462
|
+
function We(t, e, r, n, i) {
|
|
3387
3463
|
const o = [].slice.call(arguments, 1), s = o.length, l = typeof o[s - 1] == "function";
|
|
3388
|
-
if (!l && !
|
|
3464
|
+
if (!l && !un())
|
|
3389
3465
|
throw new Error("Callback required as last argument");
|
|
3390
3466
|
if (l) {
|
|
3391
3467
|
if (s < 2)
|
|
@@ -3396,7 +3472,7 @@ function Je(t, e, r, n, i) {
|
|
|
3396
3472
|
throw new Error("Too few arguments provided");
|
|
3397
3473
|
return s === 1 ? (r = e, e = n = void 0) : s === 2 && !e.getContext && (n = r, r = e, e = void 0), new Promise(function(a, c) {
|
|
3398
3474
|
try {
|
|
3399
|
-
const d =
|
|
3475
|
+
const d = ze.create(r, n);
|
|
3400
3476
|
a(t(d, e, n));
|
|
3401
3477
|
} catch (d) {
|
|
3402
3478
|
c(d);
|
|
@@ -3404,24 +3480,24 @@ function Je(t, e, r, n, i) {
|
|
|
3404
3480
|
});
|
|
3405
3481
|
}
|
|
3406
3482
|
try {
|
|
3407
|
-
const a =
|
|
3483
|
+
const a = ze.create(r, n);
|
|
3408
3484
|
i(null, t(a, e, n));
|
|
3409
3485
|
} catch (a) {
|
|
3410
3486
|
i(a);
|
|
3411
3487
|
}
|
|
3412
3488
|
}
|
|
3413
|
-
pe.create =
|
|
3414
|
-
pe.toCanvas =
|
|
3415
|
-
pe.toDataURL =
|
|
3416
|
-
pe.toString =
|
|
3417
|
-
return
|
|
3489
|
+
pe.create = ze.create;
|
|
3490
|
+
pe.toCanvas = We.bind(null, Rt.render);
|
|
3491
|
+
pe.toDataURL = We.bind(null, Rt.renderToDataURL);
|
|
3492
|
+
pe.toString = We.bind(null, function(t, e, r) {
|
|
3493
|
+
return hn.render(t, r);
|
|
3418
3494
|
});
|
|
3419
|
-
var
|
|
3420
|
-
for (var i = n > 1 ? void 0 : n ?
|
|
3495
|
+
var pn = Object.defineProperty, mn = Object.getOwnPropertyDescriptor, k = (t, e, r, n) => {
|
|
3496
|
+
for (var i = n > 1 ? void 0 : n ? mn(e, r) : e, o = t.length - 1, s; o >= 0; o--)
|
|
3421
3497
|
(s = t[o]) && (i = (n ? s(e, r, i) : s(i)) || i);
|
|
3422
|
-
return n && i &&
|
|
3498
|
+
return n && i && pn(e, r, i), i;
|
|
3423
3499
|
};
|
|
3424
|
-
let
|
|
3500
|
+
let S = class extends se {
|
|
3425
3501
|
constructor() {
|
|
3426
3502
|
super(...arguments), this.currentState = { status: "idle" }, this.selectedMethod = null, this.cardFormData = {
|
|
3427
3503
|
cardNumber: "",
|
|
@@ -3576,14 +3652,30 @@ let w = class extends se {
|
|
|
3576
3652
|
return t.length === 0 ? [] : t.filter((e) => {
|
|
3577
3653
|
var r;
|
|
3578
3654
|
return !((r = this.excludePaymentMethods) != null && r.includes(e.id));
|
|
3579
|
-
}).map((e) => e.id ===
|
|
3655
|
+
}).map((e) => e.id === w.PAYNOW && this.getTransactionData().currency !== "SGD" ? {
|
|
3580
3656
|
id: e.id,
|
|
3581
3657
|
enabled: !1,
|
|
3582
3658
|
disabledReason: "PayNow is only available for SGD currency"
|
|
3583
|
-
} : e.id ===
|
|
3659
|
+
} : e.id === w.PROMPTPAY && this.getTransactionData().currency !== "THB" ? {
|
|
3660
|
+
id: e.id,
|
|
3661
|
+
enabled: !1,
|
|
3662
|
+
disabledReason: "PromptPay is only available for THB currency"
|
|
3663
|
+
} : e.id === w.DUITNOW && this.getTransactionData().currency !== "MYR" ? {
|
|
3664
|
+
id: e.id,
|
|
3665
|
+
enabled: !1,
|
|
3666
|
+
disabledReason: "DuitNow is only available for MYR currency"
|
|
3667
|
+
} : e.id === w.GOPAY && this.getTransactionData().currency !== "IDR" ? {
|
|
3668
|
+
id: e.id,
|
|
3669
|
+
enabled: !1,
|
|
3670
|
+
disabledReason: "GoPay is only available for IDR currency"
|
|
3671
|
+
} : e.id === w.BOOST && this.getTransactionData().currency !== "MYR" ? {
|
|
3672
|
+
id: e.id,
|
|
3673
|
+
enabled: !1,
|
|
3674
|
+
disabledReason: "Boost is only available for MYR currency"
|
|
3675
|
+
} : e.id === w.SHOPEEPAY && this.getTransactionData().currency !== "MYR" ? {
|
|
3584
3676
|
id: e.id,
|
|
3585
3677
|
enabled: !1,
|
|
3586
|
-
disabledReason: "
|
|
3678
|
+
disabledReason: "ShopeePay is only available for MYR currency"
|
|
3587
3679
|
} : {
|
|
3588
3680
|
id: e.id,
|
|
3589
3681
|
enabled: !0
|
|
@@ -3679,6 +3771,30 @@ let w = class extends se {
|
|
|
3679
3771
|
const { redirectUrl: r } = e.payload;
|
|
3680
3772
|
r && (window.location.href = r);
|
|
3681
3773
|
}
|
|
3774
|
+
), this.sdk.on(
|
|
3775
|
+
"duitnow_redirect",
|
|
3776
|
+
(e) => {
|
|
3777
|
+
const { redirectUrl: r } = e.payload;
|
|
3778
|
+
r && (window.location.href = r);
|
|
3779
|
+
}
|
|
3780
|
+
), this.sdk.on(
|
|
3781
|
+
"gopay_redirect",
|
|
3782
|
+
(e) => {
|
|
3783
|
+
const { redirectUrl: r } = e.payload;
|
|
3784
|
+
r && (window.location.href = r);
|
|
3785
|
+
}
|
|
3786
|
+
), this.sdk.on(
|
|
3787
|
+
"boost_redirect",
|
|
3788
|
+
(e) => {
|
|
3789
|
+
const { redirectUrl: r } = e.payload;
|
|
3790
|
+
r && (window.location.href = r);
|
|
3791
|
+
}
|
|
3792
|
+
), this.sdk.on(
|
|
3793
|
+
"shopeepay_redirect",
|
|
3794
|
+
(e) => {
|
|
3795
|
+
const { redirectUrl: r } = e.payload;
|
|
3796
|
+
r && (window.location.href = r);
|
|
3797
|
+
}
|
|
3682
3798
|
), this.sdk.initialize({
|
|
3683
3799
|
amount: this.amount,
|
|
3684
3800
|
currency: this.currency,
|
|
@@ -3726,13 +3842,13 @@ let w = class extends se {
|
|
|
3726
3842
|
if (l < 1 || l > 12)
|
|
3727
3843
|
return { valid: !1, error: "Invalid month (01-12)" };
|
|
3728
3844
|
const a = /* @__PURE__ */ new Date(), c = a.getFullYear(), d = a.getMonth() + 1;
|
|
3729
|
-
let
|
|
3845
|
+
let h;
|
|
3730
3846
|
if (s.length === 2) {
|
|
3731
|
-
const
|
|
3732
|
-
|
|
3847
|
+
const p = parseInt(s, 10), u = c % 100, m = Math.floor(c / 100) * 100;
|
|
3848
|
+
p < u && u - p > 80 ? h = m + 100 + p : h = m + p;
|
|
3733
3849
|
} else
|
|
3734
3850
|
return { valid: !1, error: "Invalid year format" };
|
|
3735
|
-
return
|
|
3851
|
+
return h < c ? { valid: !1, error: "Card has expired" } : h === c && l < d ? { valid: !1, error: "Card has expired" } : { valid: !0 };
|
|
3736
3852
|
}
|
|
3737
3853
|
validateCardForm() {
|
|
3738
3854
|
const t = {};
|
|
@@ -3749,7 +3865,7 @@ let w = class extends se {
|
|
|
3749
3865
|
return;
|
|
3750
3866
|
this.paymentLocked = !0;
|
|
3751
3867
|
const t = this.cardFormData.expiry.split("/"), e = (t[0] || "").trim(), n = `20${(t[1] || "").trim().substring(0, 2)}`;
|
|
3752
|
-
this.sdk.submitPayment(
|
|
3868
|
+
this.sdk.submitPayment(w.CARD, {
|
|
3753
3869
|
cardNumber: this.cardFormData.cardNumber.replace(/\s/g, ""),
|
|
3754
3870
|
expiryMonth: e,
|
|
3755
3871
|
expiryYear: n,
|
|
@@ -3760,14 +3876,42 @@ let w = class extends se {
|
|
|
3760
3876
|
});
|
|
3761
3877
|
}
|
|
3762
3878
|
handlePayNowPayment() {
|
|
3763
|
-
!this.sdk || this.currentState.status !== "ready" || (this.paymentLocked = !0, this.sdk.submitPayment(
|
|
3879
|
+
!this.sdk || this.currentState.status !== "ready" || (this.paymentLocked = !0, this.sdk.submitPayment(w.PAYNOW, {
|
|
3764
3880
|
firstName: this.firstName,
|
|
3765
3881
|
lastName: this.lastName,
|
|
3766
3882
|
email: this.email
|
|
3767
3883
|
}));
|
|
3768
3884
|
}
|
|
3769
3885
|
handlePromptPayPayment() {
|
|
3770
|
-
!this.sdk || this.currentState.status !== "ready" || (this.paymentLocked = !0, this.sdk.submitPayment(
|
|
3886
|
+
!this.sdk || this.currentState.status !== "ready" || (this.paymentLocked = !0, this.sdk.submitPayment(w.PROMPTPAY, {
|
|
3887
|
+
firstName: this.firstName,
|
|
3888
|
+
lastName: this.lastName,
|
|
3889
|
+
email: this.email
|
|
3890
|
+
}));
|
|
3891
|
+
}
|
|
3892
|
+
handleDuitNowPayment() {
|
|
3893
|
+
!this.sdk || this.currentState.status !== "ready" || (this.paymentLocked = !0, this.sdk.submitPayment(w.DUITNOW, {
|
|
3894
|
+
firstName: this.firstName,
|
|
3895
|
+
lastName: this.lastName,
|
|
3896
|
+
email: this.email
|
|
3897
|
+
}));
|
|
3898
|
+
}
|
|
3899
|
+
handleGoPayPayment() {
|
|
3900
|
+
!this.sdk || this.currentState.status !== "ready" || (this.paymentLocked = !0, this.sdk.submitPayment(w.GOPAY, {
|
|
3901
|
+
firstName: this.firstName,
|
|
3902
|
+
lastName: this.lastName,
|
|
3903
|
+
email: this.email
|
|
3904
|
+
}));
|
|
3905
|
+
}
|
|
3906
|
+
handleBoostPayment() {
|
|
3907
|
+
!this.sdk || this.currentState.status !== "ready" || (this.paymentLocked = !0, this.sdk.submitPayment(w.BOOST, {
|
|
3908
|
+
firstName: this.firstName,
|
|
3909
|
+
lastName: this.lastName,
|
|
3910
|
+
email: this.email
|
|
3911
|
+
}));
|
|
3912
|
+
}
|
|
3913
|
+
handleShopeePayPayment() {
|
|
3914
|
+
!this.sdk || this.currentState.status !== "ready" || (this.paymentLocked = !0, this.sdk.submitPayment(w.SHOPEEPAY, {
|
|
3771
3915
|
firstName: this.firstName,
|
|
3772
3916
|
lastName: this.lastName,
|
|
3773
3917
|
email: this.email
|
|
@@ -3803,7 +3947,7 @@ let w = class extends se {
|
|
|
3803
3947
|
};
|
|
3804
3948
|
}
|
|
3805
3949
|
renderTransactionDetailsSkeleton() {
|
|
3806
|
-
return
|
|
3950
|
+
return x`
|
|
3807
3951
|
<div class="skeleton-transaction">
|
|
3808
3952
|
<div class="skeleton skeleton-title"></div>
|
|
3809
3953
|
<div class="skeleton-row">
|
|
@@ -3827,7 +3971,7 @@ let w = class extends se {
|
|
|
3827
3971
|
`;
|
|
3828
3972
|
}
|
|
3829
3973
|
renderPaymentMethodsSkeleton() {
|
|
3830
|
-
return
|
|
3974
|
+
return x`
|
|
3831
3975
|
<div>
|
|
3832
3976
|
<div class="skeleton-method">
|
|
3833
3977
|
<div class="skeleton skeleton-radio"></div>
|
|
@@ -3847,7 +3991,7 @@ let w = class extends se {
|
|
|
3847
3991
|
this.width ? `--one-payment-width: ${this.width}` : "",
|
|
3848
3992
|
this.maxWidth ? `--one-payment-max-width: ${this.maxWidth}` : ""
|
|
3849
3993
|
].filter(Boolean).join("; ");
|
|
3850
|
-
return
|
|
3994
|
+
return x`
|
|
3851
3995
|
<div class="payment-element" style="${t}">
|
|
3852
3996
|
${this.renderTransactionDetailsSkeleton()}
|
|
3853
3997
|
<div class="header">Select a payment method</div>
|
|
@@ -3857,7 +4001,7 @@ let w = class extends se {
|
|
|
3857
4001
|
}
|
|
3858
4002
|
renderTransactionDetails() {
|
|
3859
4003
|
const t = this.getTransactionData(), e = (r) => r.toFixed(2);
|
|
3860
|
-
return
|
|
4004
|
+
return x`
|
|
3861
4005
|
<div class="transaction-details">
|
|
3862
4006
|
<h2 class="transaction-title">Transaction details</h2>
|
|
3863
4007
|
|
|
@@ -3892,7 +4036,7 @@ let w = class extends se {
|
|
|
3892
4036
|
margin-top: ${this.feesExpanded ? "0.625rem" : "0"};
|
|
3893
4037
|
`}
|
|
3894
4038
|
>
|
|
3895
|
-
${t.feeBreakdown ?
|
|
4039
|
+
${t.feeBreakdown ? x`
|
|
3896
4040
|
<div class="fee-breakdown-inner">
|
|
3897
4041
|
<div class="breakdown-row">
|
|
3898
4042
|
<span class="breakdown-label">Transaction fee:</span>
|
|
@@ -3926,7 +4070,7 @@ let w = class extends se {
|
|
|
3926
4070
|
renderCardForm() {
|
|
3927
4071
|
setTimeout(() => this.setupCleave(), 0);
|
|
3928
4072
|
const t = this.cardBrand === "amex" ? 4 : 3, e = this.cardBrand === "amex" ? "1234" : "123";
|
|
3929
|
-
return
|
|
4073
|
+
return x`
|
|
3930
4074
|
<div class="card-form">
|
|
3931
4075
|
<h4 class="form-title">Card Information</h4>
|
|
3932
4076
|
<div class="form-fields">
|
|
@@ -3941,7 +4085,7 @@ let w = class extends se {
|
|
|
3941
4085
|
.value=${this.cardFormData.cardNumber}
|
|
3942
4086
|
@input=${(r) => this.handleInputChange("cardNumber", r.target.value)}
|
|
3943
4087
|
/>
|
|
3944
|
-
${this.formErrors.cardNumber ?
|
|
4088
|
+
${this.formErrors.cardNumber ? x`<div class="error-message">${this.formErrors.cardNumber}</div>` : ""}
|
|
3945
4089
|
</div>
|
|
3946
4090
|
|
|
3947
4091
|
<!-- Single Expiry Field -->
|
|
@@ -3960,7 +4104,7 @@ let w = class extends se {
|
|
|
3960
4104
|
}, 0);
|
|
3961
4105
|
}}
|
|
3962
4106
|
/>
|
|
3963
|
-
${this.formErrors.expiry ?
|
|
4107
|
+
${this.formErrors.expiry ? x`<div class="error-message">${this.formErrors.expiry}</div>` : ""}
|
|
3964
4108
|
</div>
|
|
3965
4109
|
|
|
3966
4110
|
<!-- CVV -->
|
|
@@ -3977,7 +4121,7 @@ let w = class extends se {
|
|
|
3977
4121
|
r.target.value = n, this.handleInputChange("cvv", n);
|
|
3978
4122
|
}}
|
|
3979
4123
|
/>
|
|
3980
|
-
${this.formErrors.cvv ?
|
|
4124
|
+
${this.formErrors.cvv ? x`<div class="error-message">${this.formErrors.cvv}</div>` : ""}
|
|
3981
4125
|
</div>
|
|
3982
4126
|
|
|
3983
4127
|
<!-- Cardholder Name -->
|
|
@@ -3993,7 +4137,7 @@ let w = class extends se {
|
|
|
3993
4137
|
r.target.value = n, this.handleInputChange("cardholderName", n);
|
|
3994
4138
|
}}
|
|
3995
4139
|
/>
|
|
3996
|
-
${this.formErrors.cardholderName ?
|
|
4140
|
+
${this.formErrors.cardholderName ? x`<div class="error-message">${this.formErrors.cardholderName}</div>` : ""}
|
|
3997
4141
|
</div>
|
|
3998
4142
|
</div>
|
|
3999
4143
|
|
|
@@ -4010,7 +4154,7 @@ let w = class extends se {
|
|
|
4010
4154
|
`;
|
|
4011
4155
|
}
|
|
4012
4156
|
renderPayNowContent() {
|
|
4013
|
-
return this.showQRModal && this.qrCodeDataUrl ?
|
|
4157
|
+
return this.showQRModal && this.qrCodeDataUrl ? x`
|
|
4014
4158
|
<div class="paynow-container">
|
|
4015
4159
|
<!-- Render generated QR code image -->
|
|
4016
4160
|
<div class="qr-code-wrapper">
|
|
@@ -4027,7 +4171,7 @@ let w = class extends se {
|
|
|
4027
4171
|
${this.qrPollingInProgress ? "Verifying..." : "I Have Scanned the QR Code"}
|
|
4028
4172
|
</button>
|
|
4029
4173
|
</div>
|
|
4030
|
-
` :
|
|
4174
|
+
` : x`
|
|
4031
4175
|
<div class="paynow-container">
|
|
4032
4176
|
<div class="paynow-instructions">
|
|
4033
4177
|
<h3 class="instructions-title">How to Pay by QR:</h3>
|
|
@@ -4058,10 +4202,10 @@ let w = class extends se {
|
|
|
4058
4202
|
`;
|
|
4059
4203
|
}
|
|
4060
4204
|
renderPromptPayContent() {
|
|
4061
|
-
return
|
|
4205
|
+
return x`
|
|
4062
4206
|
<div class="paynow-container">
|
|
4063
4207
|
<div class="paynow-instructions">
|
|
4064
|
-
<h3 class="instructions-title">How to Pay with
|
|
4208
|
+
<h3 class="instructions-title">How to Pay with PromptPay:</h3>
|
|
4065
4209
|
|
|
4066
4210
|
<div class="instruction-steps">
|
|
4067
4211
|
<div class="instruction-step">
|
|
@@ -4093,8 +4237,152 @@ let w = class extends se {
|
|
|
4093
4237
|
</div>
|
|
4094
4238
|
`;
|
|
4095
4239
|
}
|
|
4240
|
+
renderDuitNowContent() {
|
|
4241
|
+
return x`
|
|
4242
|
+
<div class="paynow-container">
|
|
4243
|
+
<div class="paynow-instructions">
|
|
4244
|
+
<h3 class="instructions-title">How to Pay with DuitNow:</h3>
|
|
4245
|
+
|
|
4246
|
+
<div class="instruction-steps">
|
|
4247
|
+
<div class="instruction-step">
|
|
4248
|
+
<div class="step-number">1</div>
|
|
4249
|
+
<p class="step-text">Click <strong>"Pay"</strong> to go to the payment page.</p>
|
|
4250
|
+
</div>
|
|
4251
|
+
|
|
4252
|
+
<div class="instruction-step">
|
|
4253
|
+
<div class="step-number">2</div>
|
|
4254
|
+
<p class="step-text">Scan the QR code with your banking app.</p>
|
|
4255
|
+
</div>
|
|
4256
|
+
|
|
4257
|
+
<div class="instruction-step">
|
|
4258
|
+
<div class="step-number">3</div>
|
|
4259
|
+
<p class="step-text">You'll be redirected back automatically.</p>
|
|
4260
|
+
</div>
|
|
4261
|
+
</div>
|
|
4262
|
+
|
|
4263
|
+
<div class="submit-section">
|
|
4264
|
+
<button
|
|
4265
|
+
class="pay-button ${this.currentState.status === "processing" || this.currentState.status === "requires_action" ? "loading" : ""}"
|
|
4266
|
+
@click=${this.handleDuitNowPayment}
|
|
4267
|
+
?disabled=${this.currentState.status === "processing" || this.currentState.status === "requires_action"}
|
|
4268
|
+
>
|
|
4269
|
+
${this.currentState.status === "processing" || this.currentState.status === "requires_action" ? "Redirecting..." : `Pay ${this.currency} ${this.amount.toFixed(2)}`}
|
|
4270
|
+
</button>
|
|
4271
|
+
</div>
|
|
4272
|
+
</div>
|
|
4273
|
+
</div>
|
|
4274
|
+
`;
|
|
4275
|
+
}
|
|
4276
|
+
renderGoPayContent() {
|
|
4277
|
+
return x`
|
|
4278
|
+
<div class="paynow-container">
|
|
4279
|
+
<div class="paynow-instructions">
|
|
4280
|
+
<h3 class="instructions-title">How to Pay with GoPay:</h3>
|
|
4281
|
+
|
|
4282
|
+
<div class="instruction-steps">
|
|
4283
|
+
<div class="instruction-step">
|
|
4284
|
+
<div class="step-number">1</div>
|
|
4285
|
+
<p class="step-text">Click <strong>"Pay"</strong> to go to the payment page.</p>
|
|
4286
|
+
</div>
|
|
4287
|
+
|
|
4288
|
+
<div class="instruction-step">
|
|
4289
|
+
<div class="step-number">2</div>
|
|
4290
|
+
<p class="step-text">Complete payment in your Gojek app.</p>
|
|
4291
|
+
</div>
|
|
4292
|
+
|
|
4293
|
+
<div class="instruction-step">
|
|
4294
|
+
<div class="step-number">3</div>
|
|
4295
|
+
<p class="step-text">You'll be redirected back automatically.</p>
|
|
4296
|
+
</div>
|
|
4297
|
+
</div>
|
|
4298
|
+
|
|
4299
|
+
<div class="submit-section">
|
|
4300
|
+
<button
|
|
4301
|
+
class="pay-button ${this.currentState.status === "processing" || this.currentState.status === "requires_action" ? "loading" : ""}"
|
|
4302
|
+
@click=${this.handleGoPayPayment}
|
|
4303
|
+
?disabled=${this.currentState.status === "processing" || this.currentState.status === "requires_action"}
|
|
4304
|
+
>
|
|
4305
|
+
${this.currentState.status === "processing" || this.currentState.status === "requires_action" ? "Redirecting..." : `Pay ${this.currency} ${this.amount.toFixed(2)}`}
|
|
4306
|
+
</button>
|
|
4307
|
+
</div>
|
|
4308
|
+
</div>
|
|
4309
|
+
</div>
|
|
4310
|
+
`;
|
|
4311
|
+
}
|
|
4312
|
+
renderBoostContent() {
|
|
4313
|
+
return x`
|
|
4314
|
+
<div class="paynow-container">
|
|
4315
|
+
<div class="paynow-instructions">
|
|
4316
|
+
<h3 class="instructions-title">How to Pay with Boost:</h3>
|
|
4317
|
+
|
|
4318
|
+
<div class="instruction-steps">
|
|
4319
|
+
<div class="instruction-step">
|
|
4320
|
+
<div class="step-number">1</div>
|
|
4321
|
+
<p class="step-text">Click <strong>"Pay"</strong> to go to the payment page.</p>
|
|
4322
|
+
</div>
|
|
4323
|
+
|
|
4324
|
+
<div class="instruction-step">
|
|
4325
|
+
<div class="step-number">2</div>
|
|
4326
|
+
<p class="step-text">Complete payment in your Boost app.</p>
|
|
4327
|
+
</div>
|
|
4328
|
+
|
|
4329
|
+
<div class="instruction-step">
|
|
4330
|
+
<div class="step-number">3</div>
|
|
4331
|
+
<p class="step-text">You'll be redirected back automatically.</p>
|
|
4332
|
+
</div>
|
|
4333
|
+
</div>
|
|
4334
|
+
|
|
4335
|
+
<div class="submit-section">
|
|
4336
|
+
<button
|
|
4337
|
+
class="pay-button ${this.currentState.status === "processing" || this.currentState.status === "requires_action" ? "loading" : ""}"
|
|
4338
|
+
@click=${this.handleBoostPayment}
|
|
4339
|
+
?disabled=${this.currentState.status === "processing" || this.currentState.status === "requires_action"}
|
|
4340
|
+
>
|
|
4341
|
+
${this.currentState.status === "processing" || this.currentState.status === "requires_action" ? "Redirecting..." : `Pay ${this.currency} ${this.amount.toFixed(2)}`}
|
|
4342
|
+
</button>
|
|
4343
|
+
</div>
|
|
4344
|
+
</div>
|
|
4345
|
+
</div>
|
|
4346
|
+
`;
|
|
4347
|
+
}
|
|
4348
|
+
renderShopeePayContent() {
|
|
4349
|
+
return x`
|
|
4350
|
+
<div class="paynow-container">
|
|
4351
|
+
<div class="paynow-instructions">
|
|
4352
|
+
<h3 class="instructions-title">How to Pay with ShopeePay:</h3>
|
|
4353
|
+
|
|
4354
|
+
<div class="instruction-steps">
|
|
4355
|
+
<div class="instruction-step">
|
|
4356
|
+
<div class="step-number">1</div>
|
|
4357
|
+
<p class="step-text">Click <strong>"Pay"</strong> to go to the payment page.</p>
|
|
4358
|
+
</div>
|
|
4359
|
+
|
|
4360
|
+
<div class="instruction-step">
|
|
4361
|
+
<div class="step-number">2</div>
|
|
4362
|
+
<p class="step-text">Complete payment in your Shopee app.</p>
|
|
4363
|
+
</div>
|
|
4364
|
+
|
|
4365
|
+
<div class="instruction-step">
|
|
4366
|
+
<div class="step-number">3</div>
|
|
4367
|
+
<p class="step-text">You'll be redirected back automatically.</p>
|
|
4368
|
+
</div>
|
|
4369
|
+
</div>
|
|
4370
|
+
|
|
4371
|
+
<div class="submit-section">
|
|
4372
|
+
<button
|
|
4373
|
+
class="pay-button ${this.currentState.status === "processing" || this.currentState.status === "requires_action" ? "loading" : ""}"
|
|
4374
|
+
@click=${this.handleShopeePayPayment}
|
|
4375
|
+
?disabled=${this.currentState.status === "processing" || this.currentState.status === "requires_action"}
|
|
4376
|
+
>
|
|
4377
|
+
${this.currentState.status === "processing" || this.currentState.status === "requires_action" ? "Redirecting..." : `Pay ${this.currency} ${this.amount.toFixed(2)}`}
|
|
4378
|
+
</button>
|
|
4379
|
+
</div>
|
|
4380
|
+
</div>
|
|
4381
|
+
</div>
|
|
4382
|
+
`;
|
|
4383
|
+
}
|
|
4096
4384
|
render3DSModal() {
|
|
4097
|
-
return !this.show3DSModal || !this.nextActionUrl ? null :
|
|
4385
|
+
return !this.show3DSModal || !this.nextActionUrl ? null : x`
|
|
4098
4386
|
<div class="modal-overlay">
|
|
4099
4387
|
<div class="modal-content iframe-modal">
|
|
4100
4388
|
<iframe
|
|
@@ -4109,7 +4397,7 @@ let w = class extends se {
|
|
|
4109
4397
|
}
|
|
4110
4398
|
renderStatusBlock() {
|
|
4111
4399
|
if (this.currentState.status === "succeeded")
|
|
4112
|
-
return
|
|
4400
|
+
return x`
|
|
4113
4401
|
<div class="result-card success">
|
|
4114
4402
|
<div class="result-icon-wrapper">
|
|
4115
4403
|
<div class="result-icon">✓</div>
|
|
@@ -4123,7 +4411,7 @@ let w = class extends se {
|
|
|
4123
4411
|
`;
|
|
4124
4412
|
if (this.currentState.status === "failed") {
|
|
4125
4413
|
const t = this.currentState.error ? this.currentState.error.message : "An error occurred while processing your payment";
|
|
4126
|
-
return
|
|
4414
|
+
return x`
|
|
4127
4415
|
<div class="result-card error">
|
|
4128
4416
|
<div class="result-icon-wrapper">
|
|
4129
4417
|
<div class="result-icon">✕</div>
|
|
@@ -4151,16 +4439,24 @@ let w = class extends se {
|
|
|
4151
4439
|
}
|
|
4152
4440
|
const n = (s) => {
|
|
4153
4441
|
switch (s) {
|
|
4154
|
-
case
|
|
4442
|
+
case w.CARD:
|
|
4155
4443
|
return "Card";
|
|
4156
|
-
case
|
|
4444
|
+
case w.PAYNOW:
|
|
4157
4445
|
return "PayNow";
|
|
4158
|
-
case
|
|
4159
|
-
return "
|
|
4446
|
+
case w.PROMPTPAY:
|
|
4447
|
+
return "PromptPay";
|
|
4448
|
+
case w.DUITNOW:
|
|
4449
|
+
return "DuitNow";
|
|
4450
|
+
case w.GOPAY:
|
|
4451
|
+
return "GoPay";
|
|
4452
|
+
case w.BOOST:
|
|
4453
|
+
return "Boost";
|
|
4454
|
+
case w.SHOPEEPAY:
|
|
4455
|
+
return "ShopeePay";
|
|
4160
4456
|
default:
|
|
4161
4457
|
return s;
|
|
4162
4458
|
}
|
|
4163
|
-
}, i = (s) => s ===
|
|
4459
|
+
}, i = (s) => s === w.CARD ? x`
|
|
4164
4460
|
<div class="method-icon-right">
|
|
4165
4461
|
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
4166
4462
|
<path
|
|
@@ -4173,30 +4469,46 @@ let w = class extends se {
|
|
|
4173
4469
|
/>
|
|
4174
4470
|
</svg>
|
|
4175
4471
|
</div>
|
|
4176
|
-
` : s ===
|
|
4472
|
+
` : s === w.PAYNOW ? x`
|
|
4177
4473
|
<div class="method-icon-right">
|
|
4178
4474
|
<img src="${dr}" alt="PayNow" style="width: 45px; height: auto;" />
|
|
4179
4475
|
</div>
|
|
4180
|
-
` : s ===
|
|
4476
|
+
` : s === w.PROMPTPAY ? x`
|
|
4477
|
+
<div class="method-icon-right">
|
|
4478
|
+
<img src="${ur}" alt="PromptPay" style="width: 45px; height: auto;" />
|
|
4479
|
+
</div>
|
|
4480
|
+
` : s === w.DUITNOW ? x`
|
|
4481
|
+
<div class="method-icon-right">
|
|
4482
|
+
<img src="${hr}" alt="DuitNow" style="width: 45px; height: auto;" />
|
|
4483
|
+
</div>
|
|
4484
|
+
` : s === w.GOPAY ? x`
|
|
4485
|
+
<div class="method-icon-right">
|
|
4486
|
+
<img src="${pr}" alt="GoPay" style="width: 45px; height: auto;" />
|
|
4487
|
+
</div>
|
|
4488
|
+
` : s === w.BOOST ? x`
|
|
4489
|
+
<div class="method-icon-right">
|
|
4490
|
+
<img src="${mr}" alt="Boost" style="width: 45px; height: auto;" />
|
|
4491
|
+
</div>
|
|
4492
|
+
` : s === w.SHOPEEPAY ? x`
|
|
4181
4493
|
<div class="method-icon-right">
|
|
4182
|
-
<img src="${
|
|
4494
|
+
<img src="${fr}" alt="ShopeePay" style="width: 45px; height: auto;" />
|
|
4183
4495
|
</div>
|
|
4184
4496
|
` : null, o = [
|
|
4185
4497
|
this.width ? `--one-payment-width: ${this.width}` : "",
|
|
4186
4498
|
this.maxWidth ? `--one-payment-max-width: ${this.maxWidth}` : ""
|
|
4187
4499
|
].filter(Boolean).join("; ");
|
|
4188
|
-
return
|
|
4500
|
+
return x`
|
|
4189
4501
|
<div class="payment-element" style="${o}">
|
|
4190
4502
|
${this.renderTransactionDetails()}
|
|
4191
|
-
${e ?
|
|
4503
|
+
${e ? x`
|
|
4192
4504
|
<div class="header">Select a payment method</div>
|
|
4193
4505
|
<div class="payment-methods-list">
|
|
4194
4506
|
${r.map((s) => {
|
|
4195
4507
|
const l = this.selectedMethod === s.id, a = !s.enabled || this.paymentLocked && !l;
|
|
4196
|
-
return
|
|
4508
|
+
return x`
|
|
4197
4509
|
<div
|
|
4198
4510
|
class="payment-method-item"
|
|
4199
|
-
${s.disabledReason ?
|
|
4511
|
+
${s.disabledReason ? x`data-tooltip="${s.disabledReason}"` : ""}
|
|
4200
4512
|
>
|
|
4201
4513
|
<div
|
|
4202
4514
|
class="method-header ${l ? "selected" : ""} ${a ? "disabled" : ""}"
|
|
@@ -4208,13 +4520,15 @@ let w = class extends se {
|
|
|
4208
4520
|
name="payment-method"
|
|
4209
4521
|
.checked=${l}
|
|
4210
4522
|
?disabled=${a}
|
|
4211
|
-
@click=${(c) =>
|
|
4523
|
+
@click=${(c) => {
|
|
4524
|
+
c.stopPropagation(), s.enabled && this.handleMethodSelect(s.id);
|
|
4525
|
+
}}
|
|
4212
4526
|
/>
|
|
4213
4527
|
<span class="method-name">${n(s.id)}</span>
|
|
4214
4528
|
${i(s.id)}
|
|
4215
4529
|
</div>
|
|
4216
|
-
${l ?
|
|
4217
|
-
${s.id ===
|
|
4530
|
+
${l ? x`<div class="method-content">
|
|
4531
|
+
${s.id === w.CARD ? this.renderCardForm() : s.id === w.PAYNOW ? this.renderPayNowContent() : s.id === w.PROMPTPAY ? this.renderPromptPayContent() : s.id === w.DUITNOW ? this.renderDuitNowContent() : s.id === w.GOPAY ? this.renderGoPayContent() : s.id === w.BOOST ? this.renderBoostContent() : s.id === w.SHOPEEPAY ? this.renderShopeePayContent() : null}
|
|
4218
4532
|
</div>` : ""}
|
|
4219
4533
|
</div>
|
|
4220
4534
|
`;
|
|
@@ -4228,7 +4542,7 @@ let w = class extends se {
|
|
|
4228
4542
|
`;
|
|
4229
4543
|
}
|
|
4230
4544
|
};
|
|
4231
|
-
|
|
4545
|
+
S.styles = Lt`
|
|
4232
4546
|
/* ═══════════════════════════════════════════════════════════════
|
|
4233
4547
|
CSS CUSTOM PROPERTIES (Theming)
|
|
4234
4548
|
═══════════════════════════════════════════════════════════════ */
|
|
@@ -5550,106 +5864,106 @@ w.styles = Bt`
|
|
|
5550
5864
|
}
|
|
5551
5865
|
}
|
|
5552
5866
|
`;
|
|
5553
|
-
|
|
5867
|
+
k([
|
|
5554
5868
|
D({ type: Object })
|
|
5555
|
-
],
|
|
5556
|
-
|
|
5869
|
+
], S.prototype, "config", 2);
|
|
5870
|
+
k([
|
|
5557
5871
|
D({ type: Object })
|
|
5558
|
-
],
|
|
5559
|
-
|
|
5872
|
+
], S.prototype, "adapters", 2);
|
|
5873
|
+
k([
|
|
5560
5874
|
D({ type: Number })
|
|
5561
|
-
],
|
|
5562
|
-
|
|
5875
|
+
], S.prototype, "amount", 2);
|
|
5876
|
+
k([
|
|
5563
5877
|
D({ type: String })
|
|
5564
|
-
],
|
|
5565
|
-
|
|
5878
|
+
], S.prototype, "currency", 2);
|
|
5879
|
+
k([
|
|
5566
5880
|
D({ type: String })
|
|
5567
|
-
],
|
|
5568
|
-
|
|
5881
|
+
], S.prototype, "orderId", 2);
|
|
5882
|
+
k([
|
|
5569
5883
|
D({ type: String })
|
|
5570
|
-
],
|
|
5571
|
-
|
|
5884
|
+
], S.prototype, "firstName", 2);
|
|
5885
|
+
k([
|
|
5572
5886
|
D({ type: String })
|
|
5573
|
-
],
|
|
5574
|
-
|
|
5887
|
+
], S.prototype, "lastName", 2);
|
|
5888
|
+
k([
|
|
5575
5889
|
D({ type: String })
|
|
5576
|
-
],
|
|
5577
|
-
|
|
5890
|
+
], S.prototype, "email", 2);
|
|
5891
|
+
k([
|
|
5578
5892
|
D({ type: Array })
|
|
5579
|
-
],
|
|
5580
|
-
|
|
5893
|
+
], S.prototype, "excludePaymentMethods", 2);
|
|
5894
|
+
k([
|
|
5581
5895
|
D({ type: String })
|
|
5582
|
-
],
|
|
5583
|
-
|
|
5896
|
+
], S.prototype, "width", 2);
|
|
5897
|
+
k([
|
|
5584
5898
|
D({ type: String })
|
|
5585
|
-
],
|
|
5586
|
-
|
|
5899
|
+
], S.prototype, "maxWidth", 2);
|
|
5900
|
+
k([
|
|
5587
5901
|
D({ type: Object })
|
|
5588
|
-
],
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
],
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
],
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
],
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
],
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
],
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
],
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
],
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
],
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
],
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
],
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
],
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
],
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
],
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
],
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
],
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
],
|
|
5637
|
-
|
|
5902
|
+
], S.prototype, "appearance", 2);
|
|
5903
|
+
k([
|
|
5904
|
+
M()
|
|
5905
|
+
], S.prototype, "currentState", 2);
|
|
5906
|
+
k([
|
|
5907
|
+
M()
|
|
5908
|
+
], S.prototype, "selectedMethod", 2);
|
|
5909
|
+
k([
|
|
5910
|
+
M()
|
|
5911
|
+
], S.prototype, "cardFormData", 2);
|
|
5912
|
+
k([
|
|
5913
|
+
M()
|
|
5914
|
+
], S.prototype, "formErrors", 2);
|
|
5915
|
+
k([
|
|
5916
|
+
M()
|
|
5917
|
+
], S.prototype, "paymentData", 2);
|
|
5918
|
+
k([
|
|
5919
|
+
M()
|
|
5920
|
+
], S.prototype, "feesExpanded", 2);
|
|
5921
|
+
k([
|
|
5922
|
+
M()
|
|
5923
|
+
], S.prototype, "isInitializing", 2);
|
|
5924
|
+
k([
|
|
5925
|
+
M()
|
|
5926
|
+
], S.prototype, "cardBrand", 2);
|
|
5927
|
+
k([
|
|
5928
|
+
M()
|
|
5929
|
+
], S.prototype, "paymentLocked", 2);
|
|
5930
|
+
k([
|
|
5931
|
+
M()
|
|
5932
|
+
], S.prototype, "show3DSModal", 2);
|
|
5933
|
+
k([
|
|
5934
|
+
M()
|
|
5935
|
+
], S.prototype, "showQRModal", 2);
|
|
5936
|
+
k([
|
|
5937
|
+
M()
|
|
5938
|
+
], S.prototype, "nextActionUrl", 2);
|
|
5939
|
+
k([
|
|
5940
|
+
M()
|
|
5941
|
+
], S.prototype, "qrCode", 2);
|
|
5942
|
+
k([
|
|
5943
|
+
M()
|
|
5944
|
+
], S.prototype, "qrCodeDataUrl", 2);
|
|
5945
|
+
k([
|
|
5946
|
+
M()
|
|
5947
|
+
], S.prototype, "qrAutoResumeTimer", 2);
|
|
5948
|
+
k([
|
|
5949
|
+
M()
|
|
5950
|
+
], S.prototype, "qrPollingInProgress", 2);
|
|
5951
|
+
S = k([
|
|
5638
5952
|
rr("one-payment")
|
|
5639
|
-
],
|
|
5640
|
-
const
|
|
5953
|
+
], S);
|
|
5954
|
+
const fn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5641
5955
|
__proto__: null,
|
|
5642
5956
|
get OnePayment() {
|
|
5643
|
-
return
|
|
5957
|
+
return S;
|
|
5644
5958
|
}
|
|
5645
5959
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
5646
|
-
function
|
|
5647
|
-
customElements.get("one-payment") || Promise.resolve().then(() =>
|
|
5960
|
+
function bn() {
|
|
5961
|
+
customElements.get("one-payment") || Promise.resolve().then(() => fn).then(({ OnePayment: t }) => {
|
|
5648
5962
|
customElements.define("one-payment", t);
|
|
5649
5963
|
});
|
|
5650
5964
|
}
|
|
5651
5965
|
export {
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5966
|
+
S as OnePayment,
|
|
5967
|
+
S as OnePaymentElement,
|
|
5968
|
+
bn as defineCustomElements
|
|
5655
5969
|
};
|