@one-payments/web-components 1.0.7 → 1.1.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 CHANGED
@@ -45,7 +45,7 @@ const Bt = (t) => new ht(typeof t == "string" ? t : t + "", void 0, Ve), Ft = (t
45
45
  * Copyright 2017 Google LLC
46
46
  * SPDX-License-Identifier: BSD-3-Clause
47
47
  */
48
- const { is: Ut, defineProperty: zt, getOwnPropertyDescriptor: Ot, getOwnPropertyNames: qt, getOwnPropertySymbols: Vt, getPrototypeOf: Ht } = Object, z = globalThis, Xe = z.trustedTypes, jt = Xe ? Xe.emptyScript : "", Pe = z.reactiveElementPolyfillSupport, ie = (t, e) => t, be = { toAttribute(t, e) {
48
+ const { is: Ut, defineProperty: Ot, getOwnPropertyDescriptor: zt, getOwnPropertyNames: qt, getOwnPropertySymbols: Vt, getPrototypeOf: Ht } = Object, O = globalThis, Xe = O.trustedTypes, jt = Xe ? Xe.emptyScript : "", Ie = O.reactiveElementPolyfillSupport, ie = (t, e) => t, be = { toAttribute(t, e) {
49
49
  switch (e) {
50
50
  case Boolean:
51
51
  t = t ? jt : null;
@@ -74,7 +74,7 @@ const { is: Ut, defineProperty: zt, getOwnPropertyDescriptor: Ot, getOwnProperty
74
74
  }
75
75
  return n;
76
76
  } }, He = (t, e) => !Ut(t, e), et = { attribute: !0, type: String, converter: be, reflect: !1, useDefault: !1, hasChanged: He };
77
- Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), z.litPropertyMetadata ?? (z.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
77
+ Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), O.litPropertyMetadata ?? (O.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
78
78
  let Q = class extends HTMLElement {
79
79
  static addInitializer(e) {
80
80
  this._$Ei(), (this.l ?? (this.l = [])).push(e);
@@ -85,11 +85,11 @@ let Q = class extends HTMLElement {
85
85
  static createProperty(e, n = et) {
86
86
  if (n.state && (n.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((n = Object.create(n)).wrapped = !0), this.elementProperties.set(e, n), !n.noAccessor) {
87
87
  const r = Symbol(), i = this.getPropertyDescriptor(e, r, n);
88
- i !== void 0 && zt(this.prototype, e, i);
88
+ i !== void 0 && Ot(this.prototype, e, i);
89
89
  }
90
90
  }
91
91
  static getPropertyDescriptor(e, n, r) {
92
- const { get: i, set: o } = Ot(this.prototype, e) ?? { get() {
92
+ const { get: i, set: o } = zt(this.prototype, e) ?? { get() {
93
93
  return this[n];
94
94
  }, set(s) {
95
95
  this[n] = s;
@@ -278,7 +278,7 @@ let Q = class extends HTMLElement {
278
278
  firstUpdated(e) {
279
279
  }
280
280
  };
281
- Q.elementStyles = [], Q.shadowRootOptions = { mode: "open" }, Q[ie("elementProperties")] = /* @__PURE__ */ new Map(), Q[ie("finalized")] = /* @__PURE__ */ new Map(), Pe == null || Pe({ ReactiveElement: Q }), (z.reactiveElementVersions ?? (z.reactiveElementVersions = [])).push("2.1.1");
281
+ Q.elementStyles = [], Q.shadowRootOptions = { mode: "open" }, Q[ie("elementProperties")] = /* @__PURE__ */ new Map(), Q[ie("finalized")] = /* @__PURE__ */ new Map(), Ie == null || Ie({ ReactiveElement: Q }), (O.reactiveElementVersions ?? (O.reactiveElementVersions = [])).push("2.1.1");
282
282
  /**
283
283
  * @license
284
284
  * Copyright 2017 Google LLC
@@ -286,7 +286,7 @@ Q.elementStyles = [], Q.shadowRootOptions = { mode: "open" }, Q[ie("elementPrope
286
286
  */
287
287
  const oe = globalThis, we = oe.trustedTypes, tt = we ? we.createPolicy("lit-html", { createHTML: (t) => t }) : void 0, ft = "$lit$", L = `lit$${Math.random().toFixed(9).slice(2)}$`, mt = "?" + L, Yt = `<${mt}>`, Y = document, le = () => Y.createComment(""), de = (t) => t === null || typeof t != "object" && typeof t != "function", je = Array.isArray, Kt = (t) => je(t) || typeof (t == null ? void 0 : t[Symbol.iterator]) == "function", _e = `[
288
288
  \f\r]`, re = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, nt = /-->/g, rt = />/g, q = RegExp(`>|${_e}(?:([^\\s"'>=/]+)(${_e}*=${_e}*(?:[^
289
- \f\r"'\`<>=]|("|')|))|$)`, "g"), it = /'/g, ot = /"/g, pt = /^(?:script|style|textarea|title)$/i, Qt = (t) => (e, ...n) => ({ _$litType$: t, strings: e, values: n }), A = Qt(1), G = Symbol.for("lit-noChange"), P = Symbol.for("lit-nothing"), st = /* @__PURE__ */ new WeakMap(), V = Y.createTreeWalker(Y, 129);
289
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), it = /'/g, ot = /"/g, pt = /^(?:script|style|textarea|title)$/i, Qt = (t) => (e, ...n) => ({ _$litType$: t, strings: e, values: n }), A = Qt(1), G = Symbol.for("lit-noChange"), I = Symbol.for("lit-nothing"), st = /* @__PURE__ */ new WeakMap(), V = Y.createTreeWalker(Y, 129);
290
290
  function gt(t, e) {
291
291
  if (!je(t) || !t.hasOwnProperty("raw")) throw Error("invalid template strings array");
292
292
  return tt !== void 0 ? tt.createHTML(e) : e;
@@ -381,7 +381,7 @@ class he {
381
381
  return ((e = this._$AM) == null ? void 0 : e._$AU) ?? this._$Cv;
382
382
  }
383
383
  constructor(e, n, r, i) {
384
- this.type = 2, this._$AH = P, this._$AN = void 0, this._$AA = e, this._$AB = n, this._$AM = r, this.options = i, this._$Cv = (i == null ? void 0 : i.isConnected) ?? !0;
384
+ this.type = 2, this._$AH = I, this._$AN = void 0, this._$AA = e, this._$AB = n, this._$AM = r, this.options = i, this._$Cv = (i == null ? void 0 : i.isConnected) ?? !0;
385
385
  }
386
386
  get parentNode() {
387
387
  let e = this._$AA.parentNode;
@@ -395,7 +395,7 @@ class he {
395
395
  return this._$AB;
396
396
  }
397
397
  _$AI(e, n = this) {
398
- e = J(this, e, n), de(e) ? e === P || e == null || e === "" ? (this._$AH !== P && this._$AR(), this._$AH = P) : e !== this._$AH && e !== G && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Kt(e) ? this.k(e) : this._(e);
398
+ e = J(this, e, n), de(e) ? e === I || e == null || e === "" ? (this._$AH !== I && this._$AR(), this._$AH = I) : e !== this._$AH && e !== G && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Kt(e) ? this.k(e) : this._(e);
399
399
  }
400
400
  O(e) {
401
401
  return this._$AA.parentNode.insertBefore(e, this._$AB);
@@ -404,7 +404,7 @@ class he {
404
404
  this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
405
405
  }
406
406
  _(e) {
407
- this._$AH !== P && de(this._$AH) ? this._$AA.nextSibling.data = e : this.T(Y.createTextNode(e)), this._$AH = e;
407
+ this._$AH !== I && de(this._$AH) ? this._$AA.nextSibling.data = e : this.T(Y.createTextNode(e)), this._$AH = e;
408
408
  }
409
409
  $(e) {
410
410
  var o;
@@ -446,7 +446,7 @@ class Se {
446
446
  return this._$AM._$AU;
447
447
  }
448
448
  constructor(e, n, r, i, o) {
449
- this.type = 1, this._$AH = P, this._$AN = void 0, this.element = e, this.name = n, this._$AM = i, this.options = o, r.length > 2 || r[0] !== "" || r[1] !== "" ? (this._$AH = Array(r.length - 1).fill(new String()), this.strings = r) : this._$AH = P;
449
+ this.type = 1, this._$AH = I, this._$AN = void 0, this.element = e, this.name = n, this._$AM = i, this.options = o, r.length > 2 || r[0] !== "" || r[1] !== "" ? (this._$AH = Array(r.length - 1).fill(new String()), this.strings = r) : this._$AH = I;
450
450
  }
451
451
  _$AI(e, n = this, r, i) {
452
452
  const o = this.strings;
@@ -455,12 +455,12 @@ class Se {
455
455
  else {
456
456
  const l = e;
457
457
  let a, d;
458
- for (e = o[0], a = 0; a < o.length - 1; a++) d = J(this, l[r + a], n, a), d === G && (d = this._$AH[a]), s || (s = !de(d) || d !== this._$AH[a]), d === P ? e = P : e !== P && (e += (d ?? "") + o[a + 1]), this._$AH[a] = d;
458
+ for (e = o[0], a = 0; a < o.length - 1; a++) d = J(this, l[r + a], n, a), d === G && (d = this._$AH[a]), s || (s = !de(d) || d !== this._$AH[a]), d === I ? e = I : e !== I && (e += (d ?? "") + o[a + 1]), this._$AH[a] = d;
459
459
  }
460
460
  s && !i && this.j(e);
461
461
  }
462
462
  j(e) {
463
- e === P ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
463
+ e === I ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
464
464
  }
465
465
  }
466
466
  class Jt extends Se {
@@ -468,7 +468,7 @@ class Jt extends Se {
468
468
  super(...arguments), this.type = 3;
469
469
  }
470
470
  j(e) {
471
- this.element[this.name] = e === P ? void 0 : e;
471
+ this.element[this.name] = e === I ? void 0 : e;
472
472
  }
473
473
  }
474
474
  class Wt extends Se {
@@ -476,7 +476,7 @@ class Wt extends Se {
476
476
  super(...arguments), this.type = 4;
477
477
  }
478
478
  j(e) {
479
- this.element.toggleAttribute(this.name, !!e && e !== P);
479
+ this.element.toggleAttribute(this.name, !!e && e !== I);
480
480
  }
481
481
  }
482
482
  class Xt extends Se {
@@ -484,8 +484,8 @@ class Xt extends Se {
484
484
  super(e, n, r, i, o), this.type = 5;
485
485
  }
486
486
  _$AI(e, n = this) {
487
- if ((e = J(this, e, n, 0) ?? P) === G) return;
488
- const r = this._$AH, i = e === P && r !== P || e.capture !== r.capture || e.once !== r.once || e.passive !== r.passive, o = e !== P && (r === P || i);
487
+ if ((e = J(this, e, n, 0) ?? I) === G) return;
488
+ const r = this._$AH, i = e === I && r !== I || e.capture !== r.capture || e.once !== r.once || e.passive !== r.passive, o = e !== I && (r === I || i);
489
489
  i && this.element.removeEventListener(this.name, this, r), o && this.element.addEventListener(this.name, this, e), this._$AH = e;
490
490
  }
491
491
  handleEvent(e) {
@@ -548,8 +548,8 @@ class se extends Q {
548
548
  }
549
549
  var ut;
550
550
  se._$litElement$ = !0, se.finalized = !0, (ut = j.litElementHydrateSupport) == null || ut.call(j, { LitElement: se });
551
- const Me = j.litElementPolyfillSupport;
552
- Me == null || Me({ LitElement: se });
551
+ const $e = j.litElementPolyfillSupport;
552
+ $e == null || $e({ LitElement: se });
553
553
  (j.litElementVersions ?? (j.litElementVersions = [])).push("4.2.1");
554
554
  /**
555
555
  * @license
@@ -587,7 +587,7 @@ const rn = { attribute: !0, type: String, converter: be, reflect: !1, hasChanged
587
587
  }
588
588
  throw Error("Unsupported decorator location: " + r);
589
589
  };
590
- function $(t) {
590
+ function M(t) {
591
591
  return (e, n) => typeof n == "object" ? on(t, e, n) : ((r, i, o) => {
592
592
  const s = i.hasOwnProperty(o);
593
593
  return i.constructor.createProperty(o, r), s ? Object.getOwnPropertyDescriptor(i, o) : void 0;
@@ -599,12 +599,15 @@ function $(t) {
599
599
  * SPDX-License-Identifier: BSD-3-Clause
600
600
  */
601
601
  function _(t) {
602
- return $({ ...t, state: !0, attribute: !1 });
602
+ return M({ ...t, state: !0, attribute: !1 });
603
+ }
604
+ function sn(t) {
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);
603
606
  }
604
607
  var K = {
605
608
  CARD: "card",
606
609
  PAYNOW: "paynow"
607
- }, M = {
610
+ }, $ = {
608
611
  IDLE: "idle",
609
612
  INITIALIZING: "initializing",
610
613
  READY: "ready",
@@ -613,10 +616,10 @@ var K = {
613
616
  SUCCEEDED: "succeeded",
614
617
  FAILED: "failed"
615
618
  };
616
- function sn(t) {
619
+ function an(t) {
617
620
  return t === "paid" ? "succeeded" : t;
618
621
  }
619
- var an = class {
622
+ var ln = class {
620
623
  constructor(t, e, n, r, i = {}) {
621
624
  this.isPolling = !1, this.attempts = 0, this.startTime = 0, this.pollTimeoutId = null, this.adapters = t, this.baseUrl = e, this.token = n, this.onStatusUpdate = r, this.config = {
622
625
  interval: i.interval ?? 3e3,
@@ -698,10 +701,13 @@ var an = class {
698
701
  if (this.isPolling) {
699
702
  this.attempts++;
700
703
  try {
701
- const t = await this.adapters.http.get(`${this.baseUrl}/payment-intent/get-payment-data`, {
702
- "x-token": this.token
703
- }), e = {
704
- status: sn(t.result.status),
704
+ const t = await this.adapters.http.get(
705
+ `${this.baseUrl}/payment-intent/get-payment-data`,
706
+ {
707
+ "x-token": this.token
708
+ }
709
+ ), e = {
710
+ status: an(t.result.status),
705
711
  // Map "paid" to "succeeded"
706
712
  paymentIntentId: t.result.paymentIntentId || "",
707
713
  ...t.result.amount !== void 0 && { amount: t.result.amount },
@@ -737,7 +743,7 @@ var an = class {
737
743
  }
738
744
  }
739
745
  };
740
- function ln(t) {
746
+ function dn(t) {
741
747
  switch (t) {
742
748
  case "prod":
743
749
  return "https://public.one.ooo";
@@ -749,26 +755,75 @@ function ln(t) {
749
755
  return "https://public.dev.one.ooo";
750
756
  }
751
757
  }
752
- var dn = class {
758
+ var cn = class {
753
759
  // Flag to ignore qrCode after user scans it
754
760
  constructor(t, e) {
755
- this.state = { status: M.IDLE }, this.subscribers = /* @__PURE__ */ new Set(), this.eventListeners = {}, this.paymentToken = null, this.paymentIntentId = null, this.pollingService = null, this.ignore3DSInPolling = !1, this.ignoreQRInPolling = !1, this.config = t, this.adapters = e;
761
+ this.state = { status: $.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;
756
762
  }
757
763
  /**
758
764
  * Get the API base URL - uses apiBaseUrl if provided, otherwise derives from environment
759
765
  */
760
766
  getApiBaseUrl() {
761
- return this.config.apiBaseUrl ?? ln(this.config.environment);
767
+ return this.config.apiBaseUrl ?? dn(this.config.environment);
762
768
  }
763
769
  /**
764
- * Get current state (immutable)
770
+ * Get the current payment state
771
+ *
772
+ * Returns an immutable snapshot of the current SDK state. The state follows a discriminated
773
+ * union pattern, where the `status` field determines which additional fields are available.
774
+ *
775
+ * @returns The current state object (readonly)
776
+ *
777
+ * @example
778
+ * ```typescript
779
+ * const state = sdk.getState();
780
+ *
781
+ * if (state.status === 'ready') {
782
+ * console.log('Available methods:', state.availableMethods);
783
+ * console.log('Payment intent:', state.paymentIntent);
784
+ * } else if (state.status === 'failed') {
785
+ * console.error('Error:', state.error);
786
+ * }
787
+ * ```
788
+ *
789
+ * @public
765
790
  */
766
791
  getState() {
767
792
  return this.state;
768
793
  }
769
794
  /**
770
795
  * Subscribe to state changes
771
- * @returns Unsubscribe function
796
+ *
797
+ * Registers a callback function that will be called immediately with the current state,
798
+ * and then again whenever the state changes. This is useful for reactive UI updates.
799
+ *
800
+ * @param subscriber - Callback function to be called with state updates
801
+ * @returns Unsubscribe function - call this to stop receiving updates
802
+ *
803
+ * @example
804
+ * ```typescript
805
+ * const unsubscribe = sdk.subscribe((state) => {
806
+ * switch (state.status) {
807
+ * case 'ready':
808
+ * console.log('Ready to accept payment');
809
+ * break;
810
+ * case 'processing':
811
+ * console.log('Processing payment...');
812
+ * break;
813
+ * case 'succeeded':
814
+ * console.log('Payment succeeded!');
815
+ * break;
816
+ * case 'failed':
817
+ * console.error('Payment failed:', state.error.message);
818
+ * break;
819
+ * }
820
+ * });
821
+ *
822
+ * // Later, when you want to stop listening:
823
+ * unsubscribe();
824
+ * ```
825
+ *
826
+ * @public
772
827
  */
773
828
  subscribe(t) {
774
829
  return this.subscribers.add(t), t(this.state), () => {
@@ -776,7 +831,39 @@ var dn = class {
776
831
  };
777
832
  }
778
833
  /**
779
- * Add event listener with type safety
834
+ * Add an event listener for specific payment events
835
+ *
836
+ * Allows you to listen to specific payment lifecycle events with full type safety.
837
+ * Unlike `subscribe`, which receives all state changes, this method lets you listen
838
+ * to specific events like payment initialization, success, failure, etc.
839
+ *
840
+ * @param eventType - The type of event to listen for
841
+ * @param listener - Callback function to be called when the event occurs
842
+ * @returns Unsubscribe function - call this to remove the listener
843
+ *
844
+ * @example
845
+ * ```typescript
846
+ * // Listen for successful payments
847
+ * const removeListener = sdk.on('payment_succeeded', (event) => {
848
+ * console.log('Payment succeeded!', event.payload.paymentIntent);
849
+ * console.log('Method used:', event.payload.methodId);
850
+ * });
851
+ *
852
+ * // Listen for QR codes
853
+ * sdk.on('qr_code_received', (event) => {
854
+ * displayQRCode(event.payload.qrCode);
855
+ * });
856
+ *
857
+ * // Listen for required actions (3DS)
858
+ * sdk.on('payment_requires_action', (event) => {
859
+ * openAuthenticationWindow(event.payload.actionUrl);
860
+ * });
861
+ *
862
+ * // Later, remove the listener:
863
+ * removeListener();
864
+ * ```
865
+ *
866
+ * @public
780
867
  */
781
868
  on(t, e) {
782
869
  this.eventListeners[t] || (this.eventListeners[t] = []);
@@ -787,10 +874,46 @@ var dn = class {
787
874
  };
788
875
  }
789
876
  /**
790
- * Initialize payment intent
877
+ * Initialize a new payment intent
878
+ *
879
+ * Creates a payment intent on the server and fetches available payment methods.
880
+ * This must be called before attempting to submit a payment. The SDK state will
881
+ * transition from 'idle' → 'initializing' → 'ready' (or 'failed' on error).
882
+ *
883
+ * @param params - Payment initialization parameters
884
+ * @param params.amount - Payment amount in smallest currency unit (e.g., cents for USD)
885
+ * @param params.currency - ISO 4217 currency code (e.g., 'USD', 'SGD', 'EUR')
886
+ * @param params.orderId - Your unique order/transaction identifier
887
+ * @param params.notes - Optional notes or description for the payment
888
+ * @param params.metadata - Optional metadata object with custom key-value pairs
889
+ * @returns Promise that resolves with the created payment intent
890
+ * @throws {Error} If initialization fails (network error, invalid credentials, etc.)
891
+ *
892
+ * @example
893
+ * ```typescript
894
+ * try {
895
+ * const paymentIntent = await sdk.initialize({
896
+ * amount: 5000, // $50.00
897
+ * currency: 'USD',
898
+ * orderId: 'ORDER-123',
899
+ * notes: 'Premium subscription',
900
+ * metadata: {
901
+ * userId: '12345',
902
+ * subscriptionId: 'sub_abc',
903
+ * },
904
+ * });
905
+ *
906
+ * console.log('Payment intent created:', paymentIntent.id);
907
+ * console.log('Amount with fees:', paymentIntent.amount);
908
+ * } catch (error) {
909
+ * console.error('Failed to initialize:', error);
910
+ * }
911
+ * ```
912
+ *
913
+ * @public
791
914
  */
792
915
  async initialize(t) {
793
- this.setState({ status: M.INITIALIZING }), this.emit({
916
+ this.setState({ status: $.INITIALIZING }), this.emit({
794
917
  type: "initialize",
795
918
  payload: t
796
919
  });
@@ -811,15 +934,21 @@ var dn = class {
811
934
  if (!s)
812
935
  throw new Error("No token found in redirectUrl");
813
936
  this.paymentToken = s, this.paymentIntentId = i.result.paymentIntentId;
814
- const l = await this.adapters.http.get(`${this.getApiBaseUrl()}/payment-intent/get-payment-data`, {
815
- "x-token": this.paymentToken
816
- }), a = await this.adapters.http.get(`${this.getApiBaseUrl()}/payment-intent/available-methods`, {
817
- "x-token": this.paymentToken
818
- }), d = {
937
+ const l = await this.adapters.http.get(
938
+ `${this.getApiBaseUrl()}/payment-intent/get-payment-data`,
939
+ {
940
+ "x-token": this.paymentToken
941
+ }
942
+ ), a = await this.adapters.http.get(
943
+ `${this.getApiBaseUrl()}/payment-intent/available-methods`,
944
+ {
945
+ "x-token": this.paymentToken
946
+ }
947
+ ), d = {
819
948
  id: this.paymentIntentId,
820
949
  amount: l.result.customerAmount || t.amount,
821
950
  currency: l.result.currency || t.currency,
822
- status: M.READY,
951
+ status: $.READY,
823
952
  ...t.metadata && { metadata: t.metadata }
824
953
  }, c = a.result.paymentMethods.map((h, f) => {
825
954
  let u = null;
@@ -831,7 +960,7 @@ var dn = class {
831
960
  };
832
961
  }).filter((h) => h !== null);
833
962
  return this.setState({
834
- status: M.READY,
963
+ status: $.READY,
835
964
  paymentIntent: d,
836
965
  availableMethods: c
837
966
  }), this.emit({
@@ -848,7 +977,7 @@ var dn = class {
848
977
  timestamp: this.adapters.timer.now()
849
978
  };
850
979
  throw this.setState({
851
- status: M.FAILED,
980
+ status: $.FAILED,
852
981
  error: n
853
982
  }), this.emit({
854
983
  type: "payment_failed",
@@ -857,7 +986,56 @@ var dn = class {
857
986
  }
858
987
  }
859
988
  /**
860
- * Submit payment with selected method
989
+ * Submit a payment with the selected payment method
990
+ *
991
+ * Processes a payment using the specified payment method and customer details.
992
+ * The SDK must be in 'ready' state before calling this method. After submission,
993
+ * the SDK automatically polls for payment status updates.
994
+ *
995
+ * For card payments, the payment may require 3D Secure authentication, which will
996
+ * trigger a 'payment_requires_action' event with an authentication URL.
997
+ *
998
+ * For PayNow/QR payments, a QR code will be provided via 'qr_code_received' event
999
+ * that the customer needs to scan with their mobile banking app.
1000
+ *
1001
+ * @param methodId - The payment method to use ('card' or 'paynow')
1002
+ * @param paymentData - Payment details object containing customer and payment information
1003
+ * @param paymentData.firstName - Customer's first name
1004
+ * @param paymentData.lastName - Customer's last name
1005
+ * @param paymentData.email - Customer's email address
1006
+ * @param paymentData.cardNumber - Card number (for card payments)
1007
+ * @param paymentData.expiryMonth - Card expiry month (for card payments)
1008
+ * @param paymentData.expiryYear - Card expiry year (for card payments)
1009
+ * @param paymentData.cvv - Card CVV code (for card payments)
1010
+ * @returns Promise that resolves with the payment intent
1011
+ * @throws {Error} If SDK is not in ready state, no payment token available, or submission fails
1012
+ *
1013
+ * @example
1014
+ * ```typescript
1015
+ * // Card payment
1016
+ * try {
1017
+ * await sdk.submitPayment('card', {
1018
+ * firstName: 'John',
1019
+ * lastName: 'Doe',
1020
+ * email: 'john@example.com',
1021
+ * cardNumber: '4242424242424242',
1022
+ * expiryMonth: '12',
1023
+ * expiryYear: '2025',
1024
+ * cvv: '123',
1025
+ * });
1026
+ * } catch (error) {
1027
+ * console.error('Payment failed:', error);
1028
+ * }
1029
+ *
1030
+ * // PayNow payment
1031
+ * await sdk.submitPayment('paynow', {
1032
+ * firstName: 'John',
1033
+ * lastName: 'Doe',
1034
+ * email: 'john@example.com',
1035
+ * });
1036
+ * ```
1037
+ *
1038
+ * @public
861
1039
  */
862
1040
  async submitPayment(t, e) {
863
1041
  var r, i, o, s, l;
@@ -867,7 +1045,7 @@ var dn = class {
867
1045
  if (!this.paymentToken)
868
1046
  throw new Error("Cannot submit payment: No payment token available");
869
1047
  this.ignore3DSInPolling = !1, this.ignoreQRInPolling = !1, this.setState({
870
- status: M.PROCESSING,
1048
+ status: $.PROCESSING,
871
1049
  paymentIntent: n.paymentIntent,
872
1050
  selectedMethod: t,
873
1051
  availableMethods: n.availableMethods
@@ -880,16 +1058,16 @@ var dn = class {
880
1058
  });
881
1059
  try {
882
1060
  const a = {
883
- firstName: e.firstName,
884
- lastName: e.lastName,
885
- email: e.email,
1061
+ firstName: String(e.firstName),
1062
+ lastName: String(e.lastName),
1063
+ email: String(e.email),
886
1064
  paymentMethod: t === "card" ? {
887
1065
  type: "card",
888
1066
  card: {
889
- number: e.cardNumber,
890
- expiryMonth: e.expiryMonth,
891
- expiryYear: e.expiryYear,
892
- cvc: e.cvv
1067
+ number: String(e.cardNumber),
1068
+ expiryMonth: String(e.expiryMonth),
1069
+ expiryYear: String(e.expiryYear),
1070
+ cvc: String(e.cvv)
893
1071
  }
894
1072
  } : { type: "qr" }
895
1073
  };
@@ -903,19 +1081,15 @@ var dn = class {
903
1081
  id: this.paymentIntentId || "",
904
1082
  amount: n.paymentIntent.amount,
905
1083
  currency: n.paymentIntent.currency,
906
- status: M.PROCESSING
1084
+ status: $.PROCESSING
907
1085
  };
908
1086
  } catch (a) {
909
1087
  let d = "Unknown error", c = "PAYMENT_FAILED";
910
1088
  if (a instanceof Error)
911
1089
  try {
912
- const f = a;
913
- if ((r = f.response) != null && r.data) {
914
- const u = f.response.data;
915
- d = u.message || ((i = u.error) == null ? void 0 : i.message) || a.message, c = u.code || ((o = u.error) == null ? void 0 : o.code) || c;
916
- } else if (f.data) {
917
- const u = f.data;
918
- d = u.message || ((s = u.error) == null ? void 0 : s.message) || a.message, c = u.code || ((l = u.error) == null ? void 0 : l.code) || c;
1090
+ if (sn(a)) {
1091
+ const f = (r = a.response) == null ? void 0 : r.data, u = a.data;
1092
+ f ? (d = f.message || ((i = f.error) == null ? void 0 : i.message) || a.message, c = f.code || ((o = f.error) == null ? void 0 : o.code) || c) : u ? (d = u.message || ((s = u.error) == null ? void 0 : s.message) || a.message, c = u.code || ((l = u.error) == null ? void 0 : l.code) || c) : d = a.message;
919
1093
  } else
920
1094
  d = a.message;
921
1095
  } catch {
@@ -927,7 +1101,7 @@ var dn = class {
927
1101
  timestamp: this.adapters.timer.now()
928
1102
  };
929
1103
  throw this.setState({
930
- status: M.FAILED,
1104
+ status: $.FAILED,
931
1105
  error: h,
932
1106
  paymentIntent: n.paymentIntent
933
1107
  }), this.emit({
@@ -940,8 +1114,39 @@ var dn = class {
940
1114
  }
941
1115
  }
942
1116
  /**
943
- * Resume polling after 3DS or QR flow completes
944
- * This is called by the UI layer after user completes 3DS authentication or scans QR code
1117
+ * Resume polling after 3D Secure or QR code flow completes
1118
+ *
1119
+ * This method should be called after the user completes 3D Secure authentication
1120
+ * or scans a QR code. It resumes payment status polling while ignoring subsequent
1121
+ * action URLs or QR codes to prevent showing the same modal/action multiple times.
1122
+ *
1123
+ * The SDK will continue polling until it receives a terminal status (succeeded or failed).
1124
+ *
1125
+ * @example
1126
+ * ```typescript
1127
+ * // After 3DS authentication completes
1128
+ * sdk.on('payment_requires_action', (event) => {
1129
+ * const authWindow = window.open(event.payload.actionUrl);
1130
+ *
1131
+ * // Monitor when auth window closes
1132
+ * const checkClosed = setInterval(() => {
1133
+ * if (authWindow?.closed) {
1134
+ * clearInterval(checkClosed);
1135
+ * sdk.resumePolling(); // Resume polling for final status
1136
+ * }
1137
+ * }, 500);
1138
+ * });
1139
+ *
1140
+ * // After QR code is scanned
1141
+ * sdk.on('qr_code_received', (event) => {
1142
+ * displayQRCode(event.payload.qrCode);
1143
+ * // User scans QR code with their banking app
1144
+ * // Once they confirm payment in their app:
1145
+ * sdk.resumePolling(); // Resume polling for final status
1146
+ * });
1147
+ * ```
1148
+ *
1149
+ * @public
945
1150
  */
946
1151
  resumePolling() {
947
1152
  if (!this.paymentToken) {
@@ -951,7 +1156,29 @@ var dn = class {
951
1156
  this.ignore3DSInPolling = !0, this.ignoreQRInPolling = !0, this.startPolling();
952
1157
  }
953
1158
  /**
954
- * Destroy SDK instance and cleanup
1159
+ * Destroy the SDK instance and clean up all resources
1160
+ *
1161
+ * This method should be called when you're done with the SDK instance to:
1162
+ * - Stop all polling operations
1163
+ * - Remove all event listeners
1164
+ * - Clear all state subscribers
1165
+ * - Free up memory
1166
+ *
1167
+ * After calling destroy(), the SDK instance should not be used again.
1168
+ *
1169
+ * @example
1170
+ * ```typescript
1171
+ * // When component unmounts or page unloads
1172
+ * useEffect(() => {
1173
+ * const sdk = new PaymentSDK(config, adapters);
1174
+ *
1175
+ * return () => {
1176
+ * sdk.destroy(); // Cleanup on unmount
1177
+ * };
1178
+ * }, []);
1179
+ * ```
1180
+ *
1181
+ * @public
955
1182
  */
956
1183
  destroy() {
957
1184
  this.stopPolling(), this.subscribers.clear(), Object.keys(this.eventListeners).forEach((t) => {
@@ -966,7 +1193,7 @@ var dn = class {
966
1193
  console.warn("Cannot start polling: no payment token available");
967
1194
  return;
968
1195
  }
969
- this.stopPolling(), this.pollingService = new an(
1196
+ this.stopPolling(), this.pollingService = new ln(
970
1197
  this.adapters,
971
1198
  this.getApiBaseUrl(),
972
1199
  this.paymentToken,
@@ -1031,11 +1258,11 @@ var dn = class {
1031
1258
  id: t.paymentIntentId,
1032
1259
  amount: t.amount ?? e.paymentIntent.amount,
1033
1260
  currency: t.currency ?? e.paymentIntent.currency,
1034
- status: M.REQUIRES_ACTION,
1261
+ status: $.REQUIRES_ACTION,
1035
1262
  ...t.metadata && { metadata: t.metadata }
1036
1263
  };
1037
1264
  this.setState({
1038
- status: M.REQUIRES_ACTION,
1265
+ status: $.REQUIRES_ACTION,
1039
1266
  paymentIntent: r,
1040
1267
  actionUrl: t.nextActionUrl,
1041
1268
  selectedMethod: e.selectedMethod,
@@ -1059,7 +1286,7 @@ var dn = class {
1059
1286
  };
1060
1287
  if (t.status === "succeeded")
1061
1288
  this.stopPolling(), this.setState({
1062
- status: M.SUCCEEDED,
1289
+ status: $.SUCCEEDED,
1063
1290
  paymentIntent: n,
1064
1291
  selectedMethod: e.selectedMethod
1065
1292
  }), this.emit({
@@ -1077,7 +1304,7 @@ var dn = class {
1077
1304
  timestamp: this.adapters.timer.now()
1078
1305
  };
1079
1306
  this.setState({
1080
- status: M.FAILED,
1307
+ status: $.FAILED,
1081
1308
  error: i,
1082
1309
  paymentIntent: n
1083
1310
  }), this.emit({
@@ -1143,7 +1370,7 @@ H.prototype = {
1143
1370
  return e.tailPrefix ? r + o.toString() + (e.numeralDecimalScale > 0 ? s.toString() : "") + e.prefix : i + o.toString() + (e.numeralDecimalScale > 0 ? s.toString() : "");
1144
1371
  }
1145
1372
  };
1146
- var cn = H, yt = function(t, e, n) {
1373
+ var un = H, yt = function(t, e, n) {
1147
1374
  var r = this;
1148
1375
  r.date = [], r.blocks = [], r.datePattern = t, r.dateMin = e.split("-").reverse().map(function(i) {
1149
1376
  return parseInt(i, 10);
@@ -1230,7 +1457,7 @@ yt.prototype = {
1230
1457
  return e ? (t < 10 ? "000" : t < 100 ? "00" : t < 1e3 ? "0" : "") + t : (t < 10 ? "0" : "") + t;
1231
1458
  }
1232
1459
  };
1233
- var un = yt, bt = function(t, e) {
1460
+ var hn = yt, bt = function(t, e) {
1234
1461
  var n = this;
1235
1462
  n.time = [], n.blocks = [], n.timePattern = t, n.timeFormat = e, n.initBlocks();
1236
1463
  };
@@ -1323,7 +1550,7 @@ bt.prototype = {
1323
1550
  return (t < 10 ? "0" : "") + t;
1324
1551
  }
1325
1552
  };
1326
- var hn = bt, wt = function(t, e) {
1553
+ var fn = bt, wt = function(t, e) {
1327
1554
  var n = this;
1328
1555
  n.delimiter = e || e === "" ? e : " ", n.delimiterRE = e ? new RegExp("\\" + e, "g") : "", n.formatter = t;
1329
1556
  };
@@ -1339,7 +1566,7 @@ wt.prototype = {
1339
1566
  return n = n.replace(/[()]/g, ""), n = n.replace(/[\s-]/g, e.delimiter), n;
1340
1567
  }
1341
1568
  };
1342
- var fn = wt, Fe = {
1569
+ var mn = wt, Fe = {
1343
1570
  blocks: {
1344
1571
  uatp: [4, 5, 6],
1345
1572
  amex: [4, 6, 5],
@@ -1406,7 +1633,7 @@ var fn = wt, Fe = {
1406
1633
  blocks: e ? this.getStrictBlocks(n.general) : n.general
1407
1634
  };
1408
1635
  }
1409
- }, mn = Fe, pn = {
1636
+ }, pn = Fe, gn = {
1410
1637
  noop: function() {
1411
1638
  },
1412
1639
  strip: function(t, e) {
@@ -1535,7 +1762,7 @@ var fn = wt, Fe = {
1535
1762
  isAndroidBackspaceKeydown: function(t, e) {
1536
1763
  return !this.isAndroid() || !t || !e ? !1 : e === t.slice(0, -1);
1537
1764
  }
1538
- }, gn = pn, yn = {
1765
+ }, yn = gn, bn = {
1539
1766
  // Maybe change to object-assign
1540
1767
  // for now just keep it as simple
1541
1768
  assign: function(t, e) {
@@ -1543,7 +1770,7 @@ var fn = wt, Fe = {
1543
1770
  }, 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 Z == "object" && Z ? Z : window, t.document = e.document || t.root.document, t.maxLength = 0, t.backspace = !1, t.result = "", t.onValueChanged = e.onValueChanged || function() {
1544
1771
  }, t;
1545
1772
  }
1546
- }, bn = yn, v = function(t, e) {
1773
+ }, wn = bn, x = function(t, e) {
1547
1774
  var n = this, r = !1;
1548
1775
  if (typeof t == "string" ? (n.element = document.querySelector(t), r = document.querySelectorAll(t).length > 1) : typeof t.length < "u" && t.length > 0 ? (n.element = t[0], r = t.length > 1) : n.element = t, !n.element)
1549
1776
  throw new Error("[cleave.js] Please check the element");
@@ -1552,16 +1779,16 @@ var fn = wt, Fe = {
1552
1779
  console.warn("[cleave.js] Multiple input fields matched, cleave.js will only take the first one.");
1553
1780
  } catch {
1554
1781
  }
1555
- e.initValue = n.element.value, n.properties = v.DefaultProperties.assign({}, e), n.init();
1782
+ e.initValue = n.element.value, n.properties = x.DefaultProperties.assign({}, e), n.init();
1556
1783
  };
1557
- v.prototype = {
1784
+ x.prototype = {
1558
1785
  init: function() {
1559
1786
  var t = this, e = t.properties;
1560
1787
  if (!e.numeral && !e.phone && !e.creditCard && !e.time && !e.date && e.blocksLength === 0 && !e.prefix) {
1561
1788
  t.onInput(e.initValue);
1562
1789
  return;
1563
1790
  }
1564
- e.maxLength = v.Util.getMaxLength(e.blocks), t.isAndroid = v.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);
1791
+ e.maxLength = x.Util.getMaxLength(e.blocks), t.isAndroid = x.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);
1565
1792
  },
1566
1793
  initSwapHiddenInput: function() {
1567
1794
  var t = this, e = t.properties;
@@ -1572,7 +1799,7 @@ v.prototype = {
1572
1799
  },
1573
1800
  initNumeralFormatter: function() {
1574
1801
  var t = this, e = t.properties;
1575
- e.numeral && (e.numeralFormatter = new v.NumeralFormatter(
1802
+ e.numeral && (e.numeralFormatter = new x.NumeralFormatter(
1576
1803
  e.numeralDecimalMark,
1577
1804
  e.numeralIntegerScale,
1578
1805
  e.numeralDecimalScale,
@@ -1587,17 +1814,17 @@ v.prototype = {
1587
1814
  },
1588
1815
  initTimeFormatter: function() {
1589
1816
  var t = this, e = t.properties;
1590
- e.time && (e.timeFormatter = new v.TimeFormatter(e.timePattern, e.timeFormat), e.blocks = e.timeFormatter.getBlocks(), e.blocksLength = e.blocks.length, e.maxLength = v.Util.getMaxLength(e.blocks));
1817
+ e.time && (e.timeFormatter = new x.TimeFormatter(e.timePattern, e.timeFormat), e.blocks = e.timeFormatter.getBlocks(), e.blocksLength = e.blocks.length, e.maxLength = x.Util.getMaxLength(e.blocks));
1591
1818
  },
1592
1819
  initDateFormatter: function() {
1593
1820
  var t = this, e = t.properties;
1594
- e.date && (e.dateFormatter = new v.DateFormatter(e.datePattern, e.dateMin, e.dateMax), e.blocks = e.dateFormatter.getBlocks(), e.blocksLength = e.blocks.length, e.maxLength = v.Util.getMaxLength(e.blocks));
1821
+ e.date && (e.dateFormatter = new x.DateFormatter(e.datePattern, e.dateMin, e.dateMax), e.blocks = e.dateFormatter.getBlocks(), e.blocksLength = e.blocks.length, e.maxLength = x.Util.getMaxLength(e.blocks));
1595
1822
  },
1596
1823
  initPhoneFormatter: function() {
1597
1824
  var t = this, e = t.properties;
1598
1825
  if (e.phone)
1599
1826
  try {
1600
- e.phoneFormatter = new v.PhoneFormatter(
1827
+ e.phoneFormatter = new x.PhoneFormatter(
1601
1828
  new e.root.Cleave.AsYouTypeFormatter(e.phoneRegionCode),
1602
1829
  e.delimiter
1603
1830
  );
@@ -1610,23 +1837,23 @@ v.prototype = {
1610
1837
  e.lastInputValue = e.element.value, e.isBackward = n === 8;
1611
1838
  },
1612
1839
  onChange: function(t) {
1613
- var e = this, n = e.properties, r = v.Util;
1840
+ var e = this, n = e.properties, r = x.Util;
1614
1841
  e.isBackward = e.isBackward || t.inputType === "deleteContentBackward";
1615
1842
  var i = r.getPostDelimiter(e.lastInputValue, n.delimiter, n.delimiters);
1616
1843
  e.isBackward && i ? n.postDelimiterBackspace = i : n.postDelimiterBackspace = !1, this.onInput(this.element.value);
1617
1844
  },
1618
1845
  onFocus: function() {
1619
1846
  var t = this, e = t.properties;
1620
- t.lastInputValue = t.element.value, e.prefix && e.noImmediatePrefix && !t.element.value && this.onInput(e.prefix), v.Util.fixPrefixCursor(t.element, e.prefix, e.delimiter, e.delimiters);
1847
+ t.lastInputValue = t.element.value, e.prefix && e.noImmediatePrefix && !t.element.value && this.onInput(e.prefix), x.Util.fixPrefixCursor(t.element, e.prefix, e.delimiter, e.delimiters);
1621
1848
  },
1622
1849
  onCut: function(t) {
1623
- v.Util.checkFullSelection(this.element.value) && (this.copyClipboardData(t), this.onInput(""));
1850
+ x.Util.checkFullSelection(this.element.value) && (this.copyClipboardData(t), this.onInput(""));
1624
1851
  },
1625
1852
  onCopy: function(t) {
1626
- v.Util.checkFullSelection(this.element.value) && this.copyClipboardData(t);
1853
+ x.Util.checkFullSelection(this.element.value) && this.copyClipboardData(t);
1627
1854
  },
1628
1855
  copyClipboardData: function(t) {
1629
- var e = this, n = e.properties, r = v.Util, i = e.element.value, o = "";
1856
+ var e = this, n = e.properties, r = x.Util, i = e.element.value, o = "";
1630
1857
  n.copyDelimiter ? o = i : o = r.stripDelimiters(i, n.delimiter, n.delimiters);
1631
1858
  try {
1632
1859
  t.clipboardData ? t.clipboardData.setData("Text", o) : window.clipboardData.setData("Text", o), t.preventDefault();
@@ -1634,7 +1861,7 @@ v.prototype = {
1634
1861
  }
1635
1862
  },
1636
1863
  onInput: function(t) {
1637
- var e = this, n = e.properties, r = v.Util, i = r.getPostDelimiter(t, n.delimiter, n.delimiters);
1864
+ var e = this, n = e.properties, r = x.Util, i = r.getPostDelimiter(t, n.delimiter, n.delimiters);
1638
1865
  if (!n.numeral && n.postDelimiterBackspace && !i && (t = r.headStr(t, t.length - n.postDelimiterBackspace.length)), n.phone) {
1639
1866
  n.prefix && (!n.noImmediatePrefix || t.length) ? n.result = n.prefix + n.phoneFormatter.format(t).slice(n.prefix.length) : n.result = n.phoneFormatter.format(t), e.updateValueState();
1640
1867
  return;
@@ -1657,11 +1884,11 @@ v.prototype = {
1657
1884
  ), e.updateValueState();
1658
1885
  },
1659
1886
  updateCreditCardPropsByValue: function(t) {
1660
- var e = this, n = e.properties, r = v.Util, i;
1661
- r.headStr(n.result, 4) !== r.headStr(t, 4) && (i = v.CreditCardDetector.getInfo(t, n.creditCardStrictMode), n.blocks = i.blocks, n.blocksLength = n.blocks.length, n.maxLength = r.getMaxLength(n.blocks), n.creditCardType !== i.type && (n.creditCardType = i.type, n.onCreditCardTypeChanged.call(e, n.creditCardType)));
1887
+ var e = this, n = e.properties, r = x.Util, i;
1888
+ r.headStr(n.result, 4) !== r.headStr(t, 4) && (i = x.CreditCardDetector.getInfo(t, n.creditCardStrictMode), n.blocks = i.blocks, n.blocksLength = n.blocks.length, n.maxLength = r.getMaxLength(n.blocks), n.creditCardType !== i.type && (n.creditCardType = i.type, n.onCreditCardTypeChanged.call(e, n.creditCardType)));
1662
1889
  },
1663
1890
  updateValueState: function() {
1664
- var t = this, e = v.Util, n = t.properties;
1891
+ var t = this, e = x.Util, n = t.properties;
1665
1892
  if (t.element) {
1666
1893
  var r = t.element.selectionEnd, i = t.element.value, o = n.result;
1667
1894
  if (r = e.getNextCursorPosition(r, i, o, n.delimiter, n.delimiters), t.isAndroid) {
@@ -1692,7 +1919,7 @@ v.prototype = {
1692
1919
  t = t != null ? t.toString() : "", n.numeral && (t = t.replace(".", n.numeralDecimalMark)), n.postDelimiterBackspace = !1, e.element.value = t, e.onInput(t);
1693
1920
  },
1694
1921
  getRawValue: function() {
1695
- var t = this, e = t.properties, n = v.Util, r = t.element.value;
1922
+ var t = this, e = t.properties, n = x.Util, r = t.element.value;
1696
1923
  return e.rawValueTrimPrefix && (r = n.getPrefixStrippedValue(r, e.prefix, e.prefixLength, e.result, e.delimiter, e.delimiters, e.noImmediatePrefix, e.tailPrefix, e.signBeforePrefix)), e.numeral ? r = e.numeralFormatter.getRawValue(r) : r = n.stripDelimiters(r, e.delimiter, e.delimiters), r;
1697
1924
  },
1698
1925
  getISOFormatDate: function() {
@@ -1714,19 +1941,19 @@ v.prototype = {
1714
1941
  return "[Cleave Object]";
1715
1942
  }
1716
1943
  };
1717
- v.NumeralFormatter = cn;
1718
- v.DateFormatter = un;
1719
- v.TimeFormatter = hn;
1720
- v.PhoneFormatter = fn;
1721
- v.CreditCardDetector = mn;
1722
- v.Util = gn;
1723
- v.DefaultProperties = bn;
1724
- (typeof Z == "object" && Z ? Z : window).Cleave = v;
1725
- var at = v, fe = {}, wn = function() {
1944
+ x.NumeralFormatter = un;
1945
+ x.DateFormatter = hn;
1946
+ x.TimeFormatter = fn;
1947
+ x.PhoneFormatter = mn;
1948
+ x.CreditCardDetector = pn;
1949
+ x.Util = yn;
1950
+ x.DefaultProperties = wn;
1951
+ (typeof Z == "object" && Z ? Z : window).Cleave = x;
1952
+ var at = x, fe = {}, vn = function() {
1726
1953
  return typeof Promise == "function" && Promise.prototype && Promise.prototype.then;
1727
1954
  }, vt = {}, D = {};
1728
1955
  let Ye;
1729
- const vn = [
1956
+ const xn = [
1730
1957
  0,
1731
1958
  // Not used
1732
1959
  26,
@@ -1776,7 +2003,7 @@ D.getSymbolSize = function(e) {
1776
2003
  return e * 4 + 17;
1777
2004
  };
1778
2005
  D.getSymbolTotalCodewords = function(e) {
1779
- return vn[e];
2006
+ return xn[e];
1780
2007
  };
1781
2008
  D.getBCHDigit = function(t) {
1782
2009
  let e = 0;
@@ -1850,7 +2077,7 @@ xt.prototype = {
1850
2077
  this.buffer.length <= e && this.buffer.push(0), t && (this.buffer[e] |= 128 >>> this.length % 8), this.length++;
1851
2078
  }
1852
2079
  };
1853
- var xn = xt;
2080
+ var Sn = xt;
1854
2081
  function me(t) {
1855
2082
  if (!t || t < 1)
1856
2083
  throw new Error("BitMatrix size must be defined and greater than 0");
@@ -1869,7 +2096,7 @@ me.prototype.xor = function(t, e, n) {
1869
2096
  me.prototype.isReserved = function(t, e) {
1870
2097
  return this.reservedBit[t * this.size + e];
1871
2098
  };
1872
- var Sn = me, St = {};
2099
+ var Cn = me, St = {};
1873
2100
  (function(t) {
1874
2101
  const e = D.getSymbolSize;
1875
2102
  t.getRowColCoords = function(r) {
@@ -1889,9 +2116,9 @@ var Sn = me, St = {};
1889
2116
  };
1890
2117
  })(St);
1891
2118
  var Ct = {};
1892
- const Cn = D.getSymbolSize, lt = 7;
2119
+ const kn = D.getSymbolSize, lt = 7;
1893
2120
  Ct.getPositions = function(e) {
1894
- const n = Cn(e);
2121
+ const n = kn(e);
1895
2122
  return [
1896
2123
  // top-left
1897
2124
  [0, 0],
@@ -2415,30 +2642,30 @@ Ke.prototype.encode = function(e) {
2415
2642
  }
2416
2643
  return r;
2417
2644
  };
2418
- var kn = Ke, It = {}, O = {}, Qe = {};
2645
+ var En = Ke, Pt = {}, z = {}, Qe = {};
2419
2646
  Qe.isValid = function(e) {
2420
2647
  return !isNaN(e) && e >= 1 && e <= 40;
2421
2648
  };
2422
2649
  var R = {};
2423
- const Pt = "[0-9]+", En = "[A-Z $%*+\\-./:]+";
2650
+ const It = "[0-9]+", An = "[A-Z $%*+\\-./:]+";
2424
2651
  let ue = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";
2425
2652
  ue = ue.replace(/u/g, "\\u");
2426
- const An = "(?:(?![A-Z0-9 $%*+\\-./:]|" + ue + `)(?:.|[\r
2653
+ const Pn = "(?:(?![A-Z0-9 $%*+\\-./:]|" + ue + `)(?:.|[\r
2427
2654
  ]))+`;
2428
2655
  R.KANJI = new RegExp(ue, "g");
2429
2656
  R.BYTE_KANJI = new RegExp("[^A-Z0-9 $%*+\\-./:]+", "g");
2430
- R.BYTE = new RegExp(An, "g");
2431
- R.NUMERIC = new RegExp(Pt, "g");
2432
- R.ALPHANUMERIC = new RegExp(En, "g");
2433
- const In = new RegExp("^" + ue + "$"), Pn = new RegExp("^" + Pt + "$"), _n = new RegExp("^[A-Z0-9 $%*+\\-./:]+$");
2657
+ R.BYTE = new RegExp(Pn, "g");
2658
+ R.NUMERIC = new RegExp(It, "g");
2659
+ R.ALPHANUMERIC = new RegExp(An, "g");
2660
+ const In = new RegExp("^" + ue + "$"), _n = new RegExp("^" + It + "$"), Dn = new RegExp("^[A-Z0-9 $%*+\\-./:]+$");
2434
2661
  R.testKanji = function(e) {
2435
2662
  return In.test(e);
2436
2663
  };
2437
2664
  R.testNumeric = function(e) {
2438
- return Pn.test(e);
2665
+ return _n.test(e);
2439
2666
  };
2440
2667
  R.testAlphanumeric = function(e) {
2441
- return _n.test(e);
2668
+ return Dn.test(e);
2442
2669
  };
2443
2670
  (function(t) {
2444
2671
  const e = Qe, n = R;
@@ -2498,9 +2725,9 @@ R.testAlphanumeric = function(e) {
2498
2725
  return s;
2499
2726
  }
2500
2727
  };
2501
- })(O);
2728
+ })(z);
2502
2729
  (function(t) {
2503
- const e = D, n = ke, r = Ce, i = O, o = Qe, s = 7973, l = e.getBCHDigit(s);
2730
+ const e = D, n = ke, r = Ce, i = z, o = Qe, s = 7973, l = e.getBCHDigit(s);
2504
2731
  function a(f, u, m) {
2505
2732
  for (let g = 1; g <= 40; g++)
2506
2733
  if (u <= t.getCapacity(g, m, f))
@@ -2561,18 +2788,18 @@ R.testAlphanumeric = function(e) {
2561
2788
  m ^= s << e.getBCHDigit(m) - l;
2562
2789
  return u << 12 | m;
2563
2790
  };
2564
- })(It);
2791
+ })(Pt);
2565
2792
  var _t = {};
2566
- const Le = D, Dt = 1335, Dn = 21522, dt = Le.getBCHDigit(Dt);
2793
+ const Le = D, Dt = 1335, $n = 21522, dt = Le.getBCHDigit(Dt);
2567
2794
  _t.getEncodedBits = function(e, n) {
2568
2795
  const r = e.bit << 3 | n;
2569
2796
  let i = r << 10;
2570
2797
  for (; Le.getBCHDigit(i) - dt >= 0; )
2571
2798
  i ^= Dt << Le.getBCHDigit(i) - dt;
2572
- return (r << 10 | i) ^ Dn;
2799
+ return (r << 10 | i) ^ $n;
2573
2800
  };
2574
- var Mt = {};
2575
- const Mn = O;
2801
+ var $t = {};
2802
+ const Mn = z;
2576
2803
  function W(t) {
2577
2804
  this.mode = Mn.NUMERIC, this.data = t.toString();
2578
2805
  }
@@ -2592,8 +2819,8 @@ W.prototype.write = function(e) {
2592
2819
  const o = this.data.length - n;
2593
2820
  o > 0 && (r = this.data.substr(n), i = parseInt(r, 10), e.put(i, o * 3 + 1));
2594
2821
  };
2595
- var $n = W;
2596
- const Tn = O, $e = [
2822
+ var Tn = W;
2823
+ const Nn = z, Me = [
2597
2824
  "0",
2598
2825
  "1",
2599
2826
  "2",
@@ -2641,7 +2868,7 @@ const Tn = O, $e = [
2641
2868
  ":"
2642
2869
  ];
2643
2870
  function X(t) {
2644
- this.mode = Tn.ALPHANUMERIC, this.data = t;
2871
+ this.mode = Nn.ALPHANUMERIC, this.data = t;
2645
2872
  }
2646
2873
  X.getBitsLength = function(e) {
2647
2874
  return 11 * Math.floor(e / 2) + 6 * (e % 2);
@@ -2655,15 +2882,15 @@ X.prototype.getBitsLength = function() {
2655
2882
  X.prototype.write = function(e) {
2656
2883
  let n;
2657
2884
  for (n = 0; n + 2 <= this.data.length; n += 2) {
2658
- let r = $e.indexOf(this.data[n]) * 45;
2659
- r += $e.indexOf(this.data[n + 1]), e.put(r, 11);
2885
+ let r = Me.indexOf(this.data[n]) * 45;
2886
+ r += Me.indexOf(this.data[n + 1]), e.put(r, 11);
2660
2887
  }
2661
- this.data.length % 2 && e.put($e.indexOf(this.data[n]), 6);
2888
+ this.data.length % 2 && e.put(Me.indexOf(this.data[n]), 6);
2662
2889
  };
2663
- var Nn = X;
2664
- const Rn = O;
2890
+ var Rn = X;
2891
+ const Bn = z;
2665
2892
  function ee(t) {
2666
- this.mode = Rn.BYTE, typeof t == "string" ? this.data = new TextEncoder().encode(t) : this.data = new Uint8Array(t);
2893
+ this.mode = Bn.BYTE, typeof t == "string" ? this.data = new TextEncoder().encode(t) : this.data = new Uint8Array(t);
2667
2894
  }
2668
2895
  ee.getBitsLength = function(e) {
2669
2896
  return e * 8;
@@ -2678,10 +2905,10 @@ ee.prototype.write = function(t) {
2678
2905
  for (let e = 0, n = this.data.length; e < n; e++)
2679
2906
  t.put(this.data[e], 8);
2680
2907
  };
2681
- var Bn = ee;
2682
- const Fn = O, Ln = D;
2908
+ var Fn = ee;
2909
+ const Ln = z, Un = D;
2683
2910
  function te(t) {
2684
- this.mode = Fn.KANJI, this.data = t;
2911
+ this.mode = Ln.KANJI, this.data = t;
2685
2912
  }
2686
2913
  te.getBitsLength = function(e) {
2687
2914
  return e * 13;
@@ -2695,7 +2922,7 @@ te.prototype.getBitsLength = function() {
2695
2922
  te.prototype.write = function(t) {
2696
2923
  let e;
2697
2924
  for (e = 0; e < this.data.length; e++) {
2698
- let n = Ln.toSJIS(this.data[e]);
2925
+ let n = Un.toSJIS(this.data[e]);
2699
2926
  if (n >= 33088 && n <= 40956)
2700
2927
  n -= 33088;
2701
2928
  else if (n >= 57408 && n <= 60351)
@@ -2708,7 +2935,7 @@ Make sure your charset is UTF-8`
2708
2935
  n = (n >>> 8 & 255) * 192 + (n & 255), t.put(n, 13);
2709
2936
  }
2710
2937
  };
2711
- var Un = te, $t = { exports: {} };
2938
+ var On = te, Mt = { exports: {} };
2712
2939
  (function(t) {
2713
2940
  var e = {
2714
2941
  single_source_shortest_paths: function(n, r, i) {
@@ -2773,10 +3000,10 @@ var Un = te, $t = { exports: {} };
2773
3000
  }
2774
3001
  };
2775
3002
  t.exports = e;
2776
- })($t);
2777
- var zn = $t.exports;
3003
+ })(Mt);
3004
+ var zn = Mt.exports;
2778
3005
  (function(t) {
2779
- const e = O, n = $n, r = Nn, i = Bn, o = Un, s = R, l = D, a = zn;
3006
+ const e = z, n = Tn, r = Rn, i = Fn, o = On, s = R, l = D, a = zn;
2780
3007
  function d(b) {
2781
3008
  return unescape(encodeURIComponent(b)).length;
2782
3009
  }
@@ -2795,13 +3022,13 @@ var zn = $t.exports;
2795
3022
  function h(b) {
2796
3023
  const w = c(s.NUMERIC, e.NUMERIC, b), y = c(s.ALPHANUMERIC, e.ALPHANUMERIC, b);
2797
3024
  let p, C;
2798
- return l.isKanjiModeEnabled() ? (p = c(s.BYTE, e.BYTE, b), C = c(s.KANJI, e.KANJI, b)) : (p = c(s.BYTE_KANJI, e.BYTE, b), C = []), w.concat(y, p, C).sort(function(I, T) {
2799
- return I.index - T.index;
2800
- }).map(function(I) {
3025
+ return l.isKanjiModeEnabled() ? (p = c(s.BYTE, e.BYTE, b), C = c(s.KANJI, e.KANJI, b)) : (p = c(s.BYTE_KANJI, e.BYTE, b), C = []), w.concat(y, p, C).sort(function(P, T) {
3026
+ return P.index - T.index;
3027
+ }).map(function(P) {
2801
3028
  return {
2802
- data: I.data,
2803
- mode: I.mode,
2804
- length: I.length
3029
+ data: P.data,
3030
+ mode: P.mode,
3031
+ length: P.length
2805
3032
  };
2806
3033
  });
2807
3034
  }
@@ -2859,12 +3086,12 @@ var zn = $t.exports;
2859
3086
  const y = {}, p = { start: {} };
2860
3087
  let C = ["start"];
2861
3088
  for (let E = 0; E < b.length; E++) {
2862
- const I = b[E], T = [];
2863
- for (let F = 0; F < I.length; F++) {
2864
- const N = I[F], ne = "" + E + F;
3089
+ const P = b[E], T = [];
3090
+ for (let F = 0; F < P.length; F++) {
3091
+ const N = P[F], ne = "" + E + F;
2865
3092
  T.push(ne), y[ne] = { node: N, lastCount: 0 }, p[ne] = {};
2866
- for (let Ie = 0; Ie < C.length; Ie++) {
2867
- const B = C[Ie];
3093
+ for (let Pe = 0; Pe < C.length; Pe++) {
3094
+ const B = C[Pe];
2868
3095
  y[B] && y[B].node.mode === N.mode ? (p[B][ne] = f(y[B].lastCount + N.length, N.mode) - f(y[B].lastCount, N.mode), y[B].lastCount += N.length) : (y[B] && (y[B].lastCount = N.length), p[B][ne] = f(N.length, N.mode) + 4 + e.getCharCountIndicator(N.mode, w));
2869
3096
  }
2870
3097
  }
@@ -2896,19 +3123,19 @@ var zn = $t.exports;
2896
3123
  return typeof p == "string" ? y.push(k(p, null)) : p.data && y.push(k(p.data, p.mode)), y;
2897
3124
  }, []);
2898
3125
  }, t.fromString = function(w, y) {
2899
- const p = h(w, l.isKanjiModeEnabled()), C = m(p), E = g(C, y), I = a.find_path(E.map, "start", "end"), T = [];
2900
- for (let F = 1; F < I.length - 1; F++)
2901
- T.push(E.table[I[F]].node);
3126
+ const p = h(w, l.isKanjiModeEnabled()), C = m(p), E = g(C, y), P = a.find_path(E.map, "start", "end"), T = [];
3127
+ for (let F = 1; F < P.length - 1; F++)
3128
+ T.push(E.table[P[F]].node);
2902
3129
  return t.fromArray(u(T));
2903
3130
  }, t.rawSplit = function(w) {
2904
3131
  return t.fromArray(
2905
3132
  h(w, l.isKanjiModeEnabled())
2906
3133
  );
2907
3134
  };
2908
- })(Mt);
2909
- const Ae = D, Te = Ce, On = xn, qn = Sn, Vn = St, Hn = Ct, Ue = kt, ze = ke, jn = kn, xe = It, Yn = _t, Kn = O, Ne = Mt;
2910
- function Qn(t, e) {
2911
- const n = t.size, r = Hn.getPositions(e);
3135
+ })($t);
3136
+ const Ae = D, Te = Ce, qn = Sn, Vn = Cn, Hn = St, jn = Ct, Ue = kt, Oe = ke, Yn = En, xe = Pt, Kn = _t, Qn = z, Ne = $t;
3137
+ function Zn(t, e) {
3138
+ const n = t.size, r = jn.getPositions(e);
2912
3139
  for (let i = 0; i < r.length; i++) {
2913
3140
  const o = r[i][0], s = r[i][1];
2914
3141
  for (let l = -1; l <= 7; l++)
@@ -2917,15 +3144,15 @@ function Qn(t, e) {
2917
3144
  s + a <= -1 || n <= 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));
2918
3145
  }
2919
3146
  }
2920
- function Zn(t) {
3147
+ function Gn(t) {
2921
3148
  const e = t.size;
2922
3149
  for (let n = 8; n < e - 8; n++) {
2923
3150
  const r = n % 2 === 0;
2924
3151
  t.set(n, 6, r, !0), t.set(6, n, r, !0);
2925
3152
  }
2926
3153
  }
2927
- function Gn(t, e) {
2928
- const n = Vn.getPositions(e);
3154
+ function Jn(t, e) {
3155
+ const n = Hn.getPositions(e);
2929
3156
  for (let r = 0; r < n.length; r++) {
2930
3157
  const i = n[r][0], o = n[r][1];
2931
3158
  for (let s = -2; s <= 2; s++)
@@ -2933,20 +3160,20 @@ function Gn(t, e) {
2933
3160
  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);
2934
3161
  }
2935
3162
  }
2936
- function Jn(t, e) {
3163
+ function Wn(t, e) {
2937
3164
  const n = t.size, r = xe.getEncodedBits(e);
2938
3165
  let i, o, s;
2939
3166
  for (let l = 0; l < 18; l++)
2940
3167
  i = Math.floor(l / 3), o = l % 3 + n - 8 - 3, s = (r >> l & 1) === 1, t.set(i, o, s, !0), t.set(o, i, s, !0);
2941
3168
  }
2942
3169
  function Re(t, e, n) {
2943
- const r = t.size, i = Yn.getEncodedBits(e, n);
3170
+ const r = t.size, i = Kn.getEncodedBits(e, n);
2944
3171
  let o, s;
2945
3172
  for (o = 0; o < 15; o++)
2946
3173
  s = (i >> o & 1) === 1, o < 6 ? t.set(o, 8, s, !0) : o < 8 ? t.set(o + 1, 8, s, !0) : t.set(r - 15 + o, 8, s, !0), o < 8 ? t.set(8, r - o - 1, s, !0) : o < 9 ? t.set(8, 15 - o - 1 + 1, s, !0) : t.set(8, 15 - o - 1, s, !0);
2947
3174
  t.set(r - 8, 8, 1, !0);
2948
3175
  }
2949
- function Wn(t, e) {
3176
+ function Xn(t, e) {
2950
3177
  const n = t.size;
2951
3178
  let r = -1, i = n - 1, o = 7, s = 0;
2952
3179
  for (let l = n - 1; l > 0; l -= 2)
@@ -2962,28 +3189,28 @@ function Wn(t, e) {
2962
3189
  }
2963
3190
  }
2964
3191
  }
2965
- function Xn(t, e, n) {
2966
- const r = new On();
3192
+ function er(t, e, n) {
3193
+ const r = new qn();
2967
3194
  n.forEach(function(a) {
2968
- r.put(a.mode.bit, 4), r.put(a.getLength(), Kn.getCharCountIndicator(a.mode, t)), a.write(r);
3195
+ r.put(a.mode.bit, 4), r.put(a.getLength(), Qn.getCharCountIndicator(a.mode, t)), a.write(r);
2969
3196
  });
2970
- const i = Ae.getSymbolTotalCodewords(t), o = ze.getTotalCodewordsCount(t, e), s = (i - o) * 8;
3197
+ const i = Ae.getSymbolTotalCodewords(t), o = Oe.getTotalCodewordsCount(t, e), s = (i - o) * 8;
2971
3198
  for (r.getLengthInBits() + 4 <= s && r.put(0, 4); r.getLengthInBits() % 8 !== 0; )
2972
3199
  r.putBit(0);
2973
3200
  const l = (s - r.getLengthInBits()) / 8;
2974
3201
  for (let a = 0; a < l; a++)
2975
3202
  r.put(a % 2 ? 17 : 236, 8);
2976
- return er(r, t, e);
3203
+ return tr(r, t, e);
2977
3204
  }
2978
- function er(t, e, n) {
2979
- const r = Ae.getSymbolTotalCodewords(e), i = ze.getTotalCodewordsCount(e, n), o = r - i, s = ze.getBlocksCount(e, n), l = r % s, a = s - l, d = Math.floor(r / s), c = Math.floor(o / s), h = c + 1, f = d - c, u = new jn(f);
3205
+ function tr(t, e, n) {
3206
+ const r = Ae.getSymbolTotalCodewords(e), i = Oe.getTotalCodewordsCount(e, n), o = r - i, s = Oe.getBlocksCount(e, n), l = r % s, a = s - l, d = Math.floor(r / s), c = Math.floor(o / s), h = c + 1, f = d - c, u = new Yn(f);
2980
3207
  let m = 0;
2981
3208
  const g = new Array(s), k = new Array(s);
2982
3209
  let b = 0;
2983
3210
  const w = new Uint8Array(t.buffer);
2984
- for (let I = 0; I < s; I++) {
2985
- const T = I < a ? c : h;
2986
- g[I] = w.slice(m, m + T), k[I] = u.encode(g[I]), m += T, b = Math.max(b, T);
3211
+ for (let P = 0; P < s; P++) {
3212
+ const T = P < a ? c : h;
3213
+ g[P] = w.slice(m, m + T), k[P] = u.encode(g[P]), m += T, b = Math.max(b, T);
2987
3214
  }
2988
3215
  const y = new Uint8Array(r);
2989
3216
  let p = 0, C, E;
@@ -2995,7 +3222,7 @@ function er(t, e, n) {
2995
3222
  y[p++] = k[E][C];
2996
3223
  return y;
2997
3224
  }
2998
- function tr(t, e, n, r) {
3225
+ function nr(t, e, n, r) {
2999
3226
  let i;
3000
3227
  if (Array.isArray(t))
3001
3228
  i = Ne.fromArray(t);
@@ -3020,8 +3247,8 @@ The chosen QR Code version cannot contain this amount of data.
3020
3247
  Minimum version required to store current data is: ` + o + `.
3021
3248
  `
3022
3249
  );
3023
- const s = Xn(e, n, i), l = Ae.getSymbolSize(e), a = new qn(l);
3024
- return Qn(a, e), Zn(a), Gn(a, e), Re(a, n, 0), e >= 7 && Jn(a, e), Wn(a, s), isNaN(r) && (r = Ue.getBestMask(
3250
+ const s = er(e, n, i), l = Ae.getSymbolSize(e), a = new Vn(l);
3251
+ return Zn(a, e), Gn(a), Jn(a, e), Re(a, n, 0), e >= 7 && Wn(a, e), Xn(a, s), isNaN(r) && (r = Ue.getBestMask(
3025
3252
  a,
3026
3253
  Re.bind(null, a, n)
3027
3254
  )), Ue.applyMask(r, a), Re(a, n, r), {
@@ -3036,7 +3263,7 @@ vt.create = function(e, n) {
3036
3263
  if (typeof e > "u" || e === "")
3037
3264
  throw new Error("No input text");
3038
3265
  let r = Te.M, i, o;
3039
- return typeof n < "u" && (r = Te.from(n.errorCorrectionLevel, Te.M), i = xe.from(n.version), o = Ue.from(n.maskPattern), n.toSJISFunc && Ae.setToSJISFunction(n.toSJISFunc)), tr(e, i, r, o);
3266
+ return typeof n < "u" && (r = Te.from(n.errorCorrectionLevel, Te.M), i = xe.from(n.version), o = Ue.from(n.maskPattern), n.toSJISFunc && Ae.setToSJISFunction(n.toSJISFunc)), nr(e, i, r, o);
3040
3267
  };
3041
3268
  var Tt = {}, Ze = {};
3042
3269
  (function(t) {
@@ -3115,7 +3342,7 @@ var Tt = {}, Ze = {};
3115
3342
  };
3116
3343
  })(Tt);
3117
3344
  var Nt = {};
3118
- const nr = Ze;
3345
+ const rr = Ze;
3119
3346
  function ct(t, e) {
3120
3347
  const n = t.a / 255, r = e + '="' + t.hex + '"';
3121
3348
  return n < 1 ? r + " " + e + '-opacity="' + n.toFixed(2).slice(1) + '"' : r;
@@ -3124,7 +3351,7 @@ function Be(t, e, n) {
3124
3351
  let r = t + e;
3125
3352
  return typeof n < "u" && (r += " " + n), r;
3126
3353
  }
3127
- function rr(t, e, n) {
3354
+ function ir(t, e, n) {
3128
3355
  let r = "", i = 0, o = !1, s = 0;
3129
3356
  for (let l = 0; l < t.length; l++) {
3130
3357
  const a = Math.floor(l % e), d = Math.floor(l / e);
@@ -3133,14 +3360,14 @@ function rr(t, e, n) {
3133
3360
  return r;
3134
3361
  }
3135
3362
  Nt.render = function(e, n, r) {
3136
- const i = nr.getOptions(n), o = e.modules.size, s = e.modules.data, l = o + i.margin * 2, a = i.color.light.a ? "<path " + ct(i.color.light, "fill") + ' d="M0 0h' + l + "v" + l + 'H0z"/>' : "", d = "<path " + ct(i.color.dark, "stroke") + ' d="' + rr(s, o, i.margin) + '"/>', c = 'viewBox="0 0 ' + l + " " + l + '"', f = '<svg xmlns="http://www.w3.org/2000/svg" ' + (i.width ? 'width="' + i.width + '" height="' + i.width + '" ' : "") + c + ' shape-rendering="crispEdges">' + a + d + `</svg>
3363
+ const i = rr.getOptions(n), o = e.modules.size, s = e.modules.data, l = o + i.margin * 2, a = i.color.light.a ? "<path " + ct(i.color.light, "fill") + ' d="M0 0h' + l + "v" + l + 'H0z"/>' : "", d = "<path " + ct(i.color.dark, "stroke") + ' d="' + ir(s, o, i.margin) + '"/>', c = 'viewBox="0 0 ' + l + " " + l + '"', f = '<svg xmlns="http://www.w3.org/2000/svg" ' + (i.width ? 'width="' + i.width + '" height="' + i.width + '" ' : "") + c + ' shape-rendering="crispEdges">' + a + d + `</svg>
3137
3364
  `;
3138
3365
  return typeof r == "function" && r(null, f), f;
3139
3366
  };
3140
- const ir = wn, Oe = vt, Rt = Tt, or = Nt;
3367
+ const or = vn, ze = vt, Rt = Tt, sr = Nt;
3141
3368
  function Ge(t, e, n, r, i) {
3142
3369
  const o = [].slice.call(arguments, 1), s = o.length, l = typeof o[s - 1] == "function";
3143
- if (!l && !ir())
3370
+ if (!l && !or())
3144
3371
  throw new Error("Callback required as last argument");
3145
3372
  if (l) {
3146
3373
  if (s < 2)
@@ -3151,7 +3378,7 @@ function Ge(t, e, n, r, i) {
3151
3378
  throw new Error("Too few arguments provided");
3152
3379
  return s === 1 ? (n = e, e = r = void 0) : s === 2 && !e.getContext && (r = n, n = e, e = void 0), new Promise(function(a, d) {
3153
3380
  try {
3154
- const c = Oe.create(n, r);
3381
+ const c = ze.create(n, r);
3155
3382
  a(t(c, e, r));
3156
3383
  } catch (c) {
3157
3384
  d(c);
@@ -3159,31 +3386,31 @@ function Ge(t, e, n, r, i) {
3159
3386
  });
3160
3387
  }
3161
3388
  try {
3162
- const a = Oe.create(n, r);
3389
+ const a = ze.create(n, r);
3163
3390
  i(null, t(a, e, r));
3164
3391
  } catch (a) {
3165
3392
  i(a);
3166
3393
  }
3167
3394
  }
3168
- fe.create = Oe.create;
3395
+ fe.create = ze.create;
3169
3396
  fe.toCanvas = Ge.bind(null, Rt.render);
3170
3397
  fe.toDataURL = Ge.bind(null, Rt.renderToDataURL);
3171
3398
  fe.toString = Ge.bind(null, function(t, e, n) {
3172
- return or.render(t, n);
3399
+ return sr.render(t, n);
3173
3400
  });
3174
- var sr = Object.defineProperty, ar = Object.getOwnPropertyDescriptor, S = (t, e, n, r) => {
3175
- for (var i = r > 1 ? void 0 : r ? ar(e, n) : e, o = t.length - 1, s; o >= 0; o--)
3401
+ var ar = Object.defineProperty, lr = Object.getOwnPropertyDescriptor, S = (t, e, n, r) => {
3402
+ for (var i = r > 1 ? void 0 : r ? lr(e, n) : e, o = t.length - 1, s; o >= 0; o--)
3176
3403
  (s = t[o]) && (i = (r ? s(e, n, i) : s(i)) || i);
3177
- return r && i && sr(e, n, i), i;
3404
+ return r && i && ar(e, n, i), i;
3178
3405
  };
3179
- let x = class extends se {
3406
+ let v = class extends se {
3180
3407
  constructor() {
3181
3408
  super(...arguments), this.currentState = { status: "idle" }, this.selectedMethod = null, this.cardFormData = {
3182
3409
  cardNumber: "",
3183
3410
  expiry: "",
3184
3411
  cvv: "",
3185
3412
  cardholderName: ""
3186
- }, this.formErrors = {}, this.paymentData = null, this.feesExpanded = !1, this.isInitializing = !0, this.cardBrand = "unknown", this.paymentLocked = !1, this.show3DSModal = !1, this.showQRModal = !1, this.nextActionUrl = null, this.qrCode = null, this.qrCodeDataUrl = null, this.qrAutoResumeTimer = null, this.sdk = null, this.isInitialized = !1, this.cardNumberCleave = null, this.expiryCleave = null, this.leaveEventsCounter = 0, this.handle3DSPostMessage = (t) => {
3413
+ }, this.formErrors = {}, this.paymentData = null, this.feesExpanded = !1, this.isInitializing = !0, this.cardBrand = "unknown", this.paymentLocked = !1, this.show3DSModal = !1, this.showQRModal = !1, this.nextActionUrl = null, this.qrCode = null, this.qrCodeDataUrl = null, this.qrAutoResumeTimer = null, this.qrPollingInProgress = !1, this.sdk = null, this.isInitialized = !1, this.cardNumberCleave = null, this.expiryCleave = null, this.leaveEventsCounter = 0, this.handle3DSPostMessage = (t) => {
3187
3414
  t.data === "ON_AWX_3DS_START_PAGE_LEAVE" && (this.leaveEventsCounter++, this.leaveEventsCounter > 1 && this.handle3DSComplete());
3188
3415
  };
3189
3416
  }
@@ -3249,7 +3476,31 @@ let x = class extends se {
3249
3476
  }
3250
3477
  initializeSDK() {
3251
3478
  var t;
3252
- !this.config || !this.adapters || !this.amount || !this.currency || !this.orderId || this.isInitialized || (this.isInitialized = !0, (t = this.sdk) == null || t.destroy(), this.sdk = new dn(this.config, this.adapters), this.sdk.subscribe((e) => {
3479
+ if (!this.config || !this.adapters || !this.amount || !this.currency || !this.orderId) {
3480
+ console.error(
3481
+ "OnePayment: Missing required props. Ensure config, adapters, amount, currency, and orderId are provided."
3482
+ );
3483
+ return;
3484
+ }
3485
+ if (!this.firstName || typeof this.firstName != "string" || this.firstName.trim() === "") {
3486
+ console.error(
3487
+ "OnePayment: firstName is required and must be a non-empty string. Customer information is required for all payment methods."
3488
+ );
3489
+ return;
3490
+ }
3491
+ if (!this.lastName || typeof this.lastName != "string" || this.lastName.trim() === "") {
3492
+ console.error(
3493
+ "OnePayment: lastName is required and must be a non-empty string. Customer information is required for all payment methods."
3494
+ );
3495
+ return;
3496
+ }
3497
+ if (!this.email || typeof this.email != "string" || this.email.trim() === "") {
3498
+ console.error(
3499
+ "OnePayment: email is required and must be a non-empty string. Customer information is required for all payment methods."
3500
+ );
3501
+ return;
3502
+ }
3503
+ this.isInitialized || (this.isInitialized = !0, (t = this.sdk) == null || t.destroy(), this.sdk = new cn(this.config, this.adapters), this.sdk.subscribe((e) => {
3253
3504
  this.currentState = e, this.dispatchEvent(
3254
3505
  new CustomEvent("state-change", {
3255
3506
  detail: { state: e },
@@ -3313,7 +3564,7 @@ let x = class extends se {
3313
3564
  this.paymentLocked || (this.selectedMethod = t);
3314
3565
  }
3315
3566
  handleQRScanned() {
3316
- this.qrAutoResumeTimer !== null && (clearTimeout(this.qrAutoResumeTimer), this.qrAutoResumeTimer = null), this.sdk && this.sdk.resumePolling();
3567
+ this.qrAutoResumeTimer !== null && (clearTimeout(this.qrAutoResumeTimer), this.qrAutoResumeTimer = null), this.qrPollingInProgress = !0, this.sdk && this.sdk.resumePolling();
3317
3568
  }
3318
3569
  handle3DSComplete() {
3319
3570
  this.show3DSModal = !1, this.nextActionUrl = null, this.leaveEventsCounter = 0, this.sdk && this.sdk.resumePolling();
@@ -3590,12 +3841,13 @@ let x = class extends se {
3590
3841
  </div>
3591
3842
 
3592
3843
  <button
3593
- class="scanned-button"
3844
+ class="scanned-button ${this.qrPollingInProgress ? "loading" : ""}"
3594
3845
  @click=${() => {
3595
3846
  this.handleQRScanned();
3596
3847
  }}
3848
+ ?disabled=${this.qrPollingInProgress}
3597
3849
  >
3598
- I Have Scanned the QR Code
3850
+ ${this.qrPollingInProgress ? "Verifying..." : "I Have Scanned the QR Code"}
3599
3851
  </button>
3600
3852
  </div>
3601
3853
  ` : A`
@@ -3732,7 +3984,7 @@ let x = class extends se {
3732
3984
  `;
3733
3985
  }
3734
3986
  };
3735
- x.styles = Ft`
3987
+ v.styles = Ft`
3736
3988
  :host {
3737
3989
  display: block;
3738
3990
  font-family:
@@ -4997,87 +5249,90 @@ x.styles = Ft`
4997
5249
  }
4998
5250
  `;
4999
5251
  S([
5000
- $({ type: Object })
5001
- ], x.prototype, "config", 2);
5252
+ M({ type: Object })
5253
+ ], v.prototype, "config", 2);
5002
5254
  S([
5003
- $({ type: Object })
5004
- ], x.prototype, "adapters", 2);
5255
+ M({ type: Object })
5256
+ ], v.prototype, "adapters", 2);
5005
5257
  S([
5006
- $({ type: Number })
5007
- ], x.prototype, "amount", 2);
5258
+ M({ type: Number })
5259
+ ], v.prototype, "amount", 2);
5008
5260
  S([
5009
- $({ type: String })
5010
- ], x.prototype, "currency", 2);
5261
+ M({ type: String })
5262
+ ], v.prototype, "currency", 2);
5011
5263
  S([
5012
- $({ type: String })
5013
- ], x.prototype, "orderId", 2);
5264
+ M({ type: String })
5265
+ ], v.prototype, "orderId", 2);
5014
5266
  S([
5015
- $({ type: String })
5016
- ], x.prototype, "firstName", 2);
5267
+ M({ type: String })
5268
+ ], v.prototype, "firstName", 2);
5017
5269
  S([
5018
- $({ type: String })
5019
- ], x.prototype, "lastName", 2);
5270
+ M({ type: String })
5271
+ ], v.prototype, "lastName", 2);
5020
5272
  S([
5021
- $({ type: String })
5022
- ], x.prototype, "email", 2);
5273
+ M({ type: String })
5274
+ ], v.prototype, "email", 2);
5023
5275
  S([
5024
- $({ type: Array })
5025
- ], x.prototype, "excludePaymentMethods", 2);
5276
+ M({ type: Array })
5277
+ ], v.prototype, "excludePaymentMethods", 2);
5026
5278
  S([
5027
- $({ type: String })
5028
- ], x.prototype, "width", 2);
5279
+ M({ type: String })
5280
+ ], v.prototype, "width", 2);
5029
5281
  S([
5030
- $({ type: String })
5031
- ], x.prototype, "maxWidth", 2);
5282
+ M({ type: String })
5283
+ ], v.prototype, "maxWidth", 2);
5284
+ S([
5285
+ _()
5286
+ ], v.prototype, "currentState", 2);
5032
5287
  S([
5033
5288
  _()
5034
- ], x.prototype, "currentState", 2);
5289
+ ], v.prototype, "selectedMethod", 2);
5035
5290
  S([
5036
5291
  _()
5037
- ], x.prototype, "selectedMethod", 2);
5292
+ ], v.prototype, "cardFormData", 2);
5038
5293
  S([
5039
5294
  _()
5040
- ], x.prototype, "cardFormData", 2);
5295
+ ], v.prototype, "formErrors", 2);
5041
5296
  S([
5042
5297
  _()
5043
- ], x.prototype, "formErrors", 2);
5298
+ ], v.prototype, "paymentData", 2);
5044
5299
  S([
5045
5300
  _()
5046
- ], x.prototype, "paymentData", 2);
5301
+ ], v.prototype, "feesExpanded", 2);
5047
5302
  S([
5048
5303
  _()
5049
- ], x.prototype, "feesExpanded", 2);
5304
+ ], v.prototype, "isInitializing", 2);
5050
5305
  S([
5051
5306
  _()
5052
- ], x.prototype, "isInitializing", 2);
5307
+ ], v.prototype, "cardBrand", 2);
5053
5308
  S([
5054
5309
  _()
5055
- ], x.prototype, "cardBrand", 2);
5310
+ ], v.prototype, "paymentLocked", 2);
5056
5311
  S([
5057
5312
  _()
5058
- ], x.prototype, "paymentLocked", 2);
5313
+ ], v.prototype, "show3DSModal", 2);
5059
5314
  S([
5060
5315
  _()
5061
- ], x.prototype, "show3DSModal", 2);
5316
+ ], v.prototype, "showQRModal", 2);
5062
5317
  S([
5063
5318
  _()
5064
- ], x.prototype, "showQRModal", 2);
5319
+ ], v.prototype, "nextActionUrl", 2);
5065
5320
  S([
5066
5321
  _()
5067
- ], x.prototype, "nextActionUrl", 2);
5322
+ ], v.prototype, "qrCode", 2);
5068
5323
  S([
5069
5324
  _()
5070
- ], x.prototype, "qrCode", 2);
5325
+ ], v.prototype, "qrCodeDataUrl", 2);
5071
5326
  S([
5072
5327
  _()
5073
- ], x.prototype, "qrCodeDataUrl", 2);
5328
+ ], v.prototype, "qrAutoResumeTimer", 2);
5074
5329
  S([
5075
5330
  _()
5076
- ], x.prototype, "qrAutoResumeTimer", 2);
5077
- x = S([
5331
+ ], v.prototype, "qrPollingInProgress", 2);
5332
+ v = S([
5078
5333
  nn("one-payment")
5079
- ], x);
5334
+ ], v);
5080
5335
  export {
5081
- x as OnePayment,
5082
- x as OnePaymentElement
5336
+ v as OnePayment,
5337
+ v as OnePaymentElement
5083
5338
  };