@danidoble/webserial 4.4.0 → 4.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pinpad.js CHANGED
@@ -1,4 +1,4 @@
1
- import { K as mi, a as yi, D as le, i as z, b as fe, w as pe } from "./kernel-BnWXOCde.js";
1
+ import { K as mi, a as yi, D as le, i as z, b as fe, w as pe } from "./kernel-BZzs36vi.js";
2
2
  var bi = "0123456789abcdefghijklmnopqrstuvwxyz";
3
3
  function G(n) {
4
4
  return bi.charAt(n);
@@ -119,7 +119,7 @@ var ct, wi = {
119
119
  }
120
120
  }, ut = 1e13, mt = (
121
121
  /** @class */
122
- function() {
122
+ (function() {
123
123
  function n(t) {
124
124
  this.buf = [+t || 0];
125
125
  }
@@ -148,14 +148,14 @@ var ct, wi = {
148
148
  var t = this.buf;
149
149
  return t.length == 1 ? t[0] : this;
150
150
  }, n;
151
- }()
151
+ })()
152
152
  ), Ke = "…", Si = /^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/, Ti = /^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;
153
153
  function lt(n, t) {
154
154
  return n.length > t && (n = n.substring(0, t) + Ke), n;
155
155
  }
156
156
  var Ht = (
157
157
  /** @class */
158
- function() {
158
+ (function() {
159
159
  function n(t, e) {
160
160
  this.hexDigits = "0123456789ABCDEF", t instanceof n ? (this.enc = t.enc, this.pos = t.pos) : (this.enc = t, this.pos = e);
161
161
  }
@@ -257,10 +257,10 @@ var Ht = (
257
257
  }
258
258
  return a > 0 && (r += ".incomplete"), r;
259
259
  }, n;
260
- }()
260
+ })()
261
261
  ), Ai = (
262
262
  /** @class */
263
- function() {
263
+ (function() {
264
264
  function n(t, e, i, r, s) {
265
265
  if (!(r instanceof me))
266
266
  throw new Error("Invalid tag value.");
@@ -468,10 +468,10 @@ var Ht = (
468
468
  }
469
469
  return new n(i, o, s, r, c);
470
470
  }, n;
471
- }()
471
+ })()
472
472
  ), me = (
473
473
  /** @class */
474
- function() {
474
+ (function() {
475
475
  function n(t) {
476
476
  var e = t.get();
477
477
  if (this.tagClass = e >> 6, this.tagConstructed = (e & 32) !== 0, this.tagNumber = e & 31, this.tagNumber == 31) {
@@ -487,10 +487,10 @@ var Ht = (
487
487
  }, n.prototype.isEOC = function() {
488
488
  return this.tagClass === 0 && this.tagNumber === 0;
489
489
  }, n;
490
- }()
490
+ })()
491
491
  ), Y, Ci = 244837814094590, ye = (Ci & 16777215) == 15715070, N = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997], Ri = (1 << 26) / N[N.length - 1], P = (
492
492
  /** @class */
493
- function() {
493
+ (function() {
494
494
  function n(t, e, i) {
495
495
  t != null && (typeof t == "number" ? this.fromNumber(t, e, i) : e == null && typeof t != "string" ? this.fromString(t, 256) : this.fromString(t, e));
496
496
  }
@@ -1007,10 +1007,10 @@ var Ht = (
1007
1007
  o.length = (t >> 3) + 1, e.nextBytes(o), c > 0 ? o[0] &= (1 << c) - 1 : o[0] = 0, this.fromString(o, 256);
1008
1008
  }
1009
1009
  }, n;
1010
- }()
1010
+ })()
1011
1011
  ), Oi = (
1012
1012
  /** @class */
1013
- function() {
1013
+ (function() {
1014
1014
  function n() {
1015
1015
  }
1016
1016
  return n.prototype.convert = function(t) {
@@ -1022,10 +1022,10 @@ var Ht = (
1022
1022
  }, n.prototype.sqrTo = function(t, e) {
1023
1023
  t.squareTo(e);
1024
1024
  }, n;
1025
- }()
1025
+ })()
1026
1026
  ), be = (
1027
1027
  /** @class */
1028
- function() {
1028
+ (function() {
1029
1029
  function n(t) {
1030
1030
  this.m = t;
1031
1031
  }
@@ -1040,10 +1040,10 @@ var Ht = (
1040
1040
  }, n.prototype.sqrTo = function(t, e) {
1041
1041
  t.squareTo(e), this.reduce(e);
1042
1042
  }, n;
1043
- }()
1043
+ })()
1044
1044
  ), Pe = (
1045
1045
  /** @class */
1046
- function() {
1046
+ (function() {
1047
1047
  function n(t) {
1048
1048
  this.m = t, this.mp = t.invDigit(), this.mpl = this.mp & 32767, this.mph = this.mp >> 15, this.um = (1 << t.DB - 15) - 1, this.mt2 = 2 * t.t;
1049
1049
  }
@@ -1067,10 +1067,10 @@ var Ht = (
1067
1067
  }, n.prototype.sqrTo = function(t, e) {
1068
1068
  t.squareTo(e), this.reduce(e);
1069
1069
  }, n;
1070
- }()
1070
+ })()
1071
1071
  ), Di = (
1072
1072
  /** @class */
1073
- function() {
1073
+ (function() {
1074
1074
  function n(t) {
1075
1075
  this.m = t, this.r2 = E(), this.q3 = E(), P.ONE.dlShiftTo(2 * t.t, this.r2), this.mu = this.r2.divide(t);
1076
1076
  }
@@ -1093,7 +1093,7 @@ var Ht = (
1093
1093
  }, n.prototype.sqrTo = function(t, e) {
1094
1094
  t.squareTo(e), this.reduce(e);
1095
1095
  }, n;
1096
- }()
1096
+ })()
1097
1097
  );
1098
1098
  function E() {
1099
1099
  return new P(null);
@@ -1124,10 +1124,10 @@ ve && ye && navigator.appName == "Microsoft Internet Explorer" ? (P.prototype.am
1124
1124
  P.prototype.DB = Y;
1125
1125
  P.prototype.DM = (1 << Y) - 1;
1126
1126
  P.prototype.DV = 1 << Y;
1127
- var ne = 52;
1128
- P.prototype.FV = Math.pow(2, ne);
1129
- P.prototype.F1 = ne - Y;
1130
- P.prototype.F2 = 2 * Y - ne;
1127
+ var ie = 52;
1128
+ P.prototype.FV = Math.pow(2, ie);
1129
+ P.prototype.F1 = ie - Y;
1130
+ P.prototype.F2 = 2 * Y - ie;
1131
1131
  var Lt = [], pt, k;
1132
1132
  pt = 48;
1133
1133
  for (k = 0; k <= 9; ++k)
@@ -1154,7 +1154,7 @@ P.ZERO = Q(0);
1154
1154
  P.ONE = Q(1);
1155
1155
  var Ii = (
1156
1156
  /** @class */
1157
- function() {
1157
+ (function() {
1158
1158
  function n() {
1159
1159
  this.i = 0, this.j = 0, this.S = [];
1160
1160
  }
@@ -1169,7 +1169,7 @@ var Ii = (
1169
1169
  var t;
1170
1170
  return this.i = this.i + 1 & 255, this.j = this.j + this.S[this.i] & 255, t = this.S[this.i], this.S[this.i] = this.S[this.j], this.S[this.j] = t, this.S[t + this.S[this.i] & 255];
1171
1171
  }, n;
1172
- }()
1172
+ })()
1173
1173
  );
1174
1174
  function Bi() {
1175
1175
  return new Ii();
@@ -1210,14 +1210,14 @@ function Ni() {
1210
1210
  }
1211
1211
  var Vt = (
1212
1212
  /** @class */
1213
- function() {
1213
+ (function() {
1214
1214
  function n() {
1215
1215
  }
1216
1216
  return n.prototype.nextBytes = function(t) {
1217
1217
  for (var e = 0; e < t.length; ++e)
1218
1218
  t[e] = Ni();
1219
1219
  }, n;
1220
- }()
1220
+ })()
1221
1221
  );
1222
1222
  function Qt(n) {
1223
1223
  return Vi(Ki(xi(n), n.length * 8));
@@ -1332,7 +1332,7 @@ function zi(n, t) {
1332
1332
  }
1333
1333
  var Gi = (
1334
1334
  /** @class */
1335
- function() {
1335
+ (function() {
1336
1336
  function n() {
1337
1337
  this.n = null, this.e = 0, this.d = null, this.p = null, this.q = null, this.dmp1 = null, this.dmq1 = null, this.coeff = null;
1338
1338
  }
@@ -1428,7 +1428,7 @@ var Gi = (
1428
1428
  var a = s.toString(16).replace(/^1f+00/, ""), o = Qi(a);
1429
1429
  return o == i(t).toString();
1430
1430
  }, n;
1431
- }()
1431
+ })()
1432
1432
  );
1433
1433
  function $i(n, t) {
1434
1434
  for (var e = n.toByteArray(), i = 0; i < e.length && e[i] == 0; )
@@ -1473,14 +1473,6 @@ function R(n, t, e) {
1473
1473
  };
1474
1474
  i.prototype = t.prototype, n.prototype = new i(), n.prototype.constructor = n, n.superclass = t.prototype, t.prototype.constructor == Object.prototype.constructor && (t.prototype.constructor = t);
1475
1475
  }
1476
- /**
1477
- * @fileOverview
1478
- * @name asn1-1.0.js
1479
- * @author Kenji Urushima kenji.urushima@gmail.com
1480
- * @version asn1 1.0.13 (2017-Jun-02)
1481
- * @since jsrsasign 2.1
1482
- * @license <a href="https://kjur.github.io/jsrsasign/license/">MIT License</a>
1483
- */
1484
1476
  var p = {};
1485
1477
  (typeof p.asn1 > "u" || !p.asn1) && (p.asn1 = {});
1486
1478
  p.asn1.ASN1Util = new function() {
@@ -1859,7 +1851,7 @@ p.asn1.DERTaggedObject = function(n) {
1859
1851
  }, typeof n < "u" && (typeof n.tag < "u" && (this.hT = n.tag), typeof n.explicit < "u" && (this.isExplicit = n.explicit), typeof n.obj < "u" && (this.asn1Object = n.obj, this.setASN1Object(this.isExplicit, this.hT, this.asn1Object)));
1860
1852
  };
1861
1853
  R(p.asn1.DERTaggedObject, p.asn1.ASN1Object);
1862
- var Zi = /* @__PURE__ */ function() {
1854
+ var Zi = /* @__PURE__ */ (function() {
1863
1855
  var n = function(t, e) {
1864
1856
  return n = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(i, r) {
1865
1857
  i.__proto__ = r;
@@ -1876,9 +1868,9 @@ var Zi = /* @__PURE__ */ function() {
1876
1868
  }
1877
1869
  t.prototype = e === null ? Object.create(e) : (i.prototype = e.prototype, new i());
1878
1870
  };
1879
- }(), Te = (
1871
+ })(), Te = (
1880
1872
  /** @class */
1881
- function(n) {
1873
+ (function(n) {
1882
1874
  Zi(t, n);
1883
1875
  function t(e) {
1884
1876
  var i = n.call(this) || this;
@@ -1974,10 +1966,10 @@ var Zi = /* @__PURE__ */ function() {
1974
1966
  }, t.prototype.parsePropertiesFrom = function(e) {
1975
1967
  this.n = e.n, this.e = e.e, e.hasOwnProperty("d") && (this.d = e.d, this.p = e.p, this.q = e.q, this.dmp1 = e.dmp1, this.dmq1 = e.dmq1, this.coeff = e.coeff);
1976
1968
  }, t;
1977
- }(Gi)
1969
+ })(Gi)
1978
1970
  ), Xt, Yi = typeof process < "u" ? (Xt = process.env) === null || Xt === void 0 ? void 0 : Xt.npm_package_version : void 0, tn = (
1979
1971
  /** @class */
1980
- function() {
1972
+ (function() {
1981
1973
  function n(t) {
1982
1974
  t === void 0 && (t = {}), this.default_key_size = t.default_key_size ? parseInt(t.default_key_size, 10) : 1024, this.default_public_exponent = t.default_public_exponent || "010001", this.log = t.log || !1, this.key = t.key || null;
1983
1975
  }
@@ -2049,14 +2041,14 @@ var Zi = /* @__PURE__ */ function() {
2049
2041
  }, n.prototype.getPublicKeyB64 = function() {
2050
2042
  return this.getKey().getPublicBaseKeyB64();
2051
2043
  }, n.version = Yi, n;
2052
- }()
2044
+ })()
2053
2045
  );
2054
2046
  function Xe(n, t) {
2055
2047
  return function() {
2056
2048
  return n.apply(t, arguments);
2057
2049
  };
2058
2050
  }
2059
- const { toString: en } = Object.prototype, { getPrototypeOf: re } = Object, { iterator: Mt, toStringTag: ze } = Symbol, kt = /* @__PURE__ */ ((n) => (t) => {
2051
+ const { toString: en } = Object.prototype, { getPrototypeOf: ne } = Object, { iterator: Mt, toStringTag: ze } = Symbol, kt = /* @__PURE__ */ ((n) => (t) => {
2060
2052
  const e = en.call(t);
2061
2053
  return n[e] || (n[e] = e.slice(8, -1).toLowerCase());
2062
2054
  })(/* @__PURE__ */ Object.create(null)), j = (n) => (n = n.toLowerCase(), (t) => kt(t) === n), Ft = (n) => (t) => typeof t === n, { isArray: dt } = Array, ft = Ft("undefined");
@@ -2071,7 +2063,7 @@ function nn(n) {
2071
2063
  const rn = Ft("string"), U = Ft("function"), $e = Ft("number"), Pt = (n) => n !== null && typeof n == "object", sn = (n) => n === !0 || n === !1, Bt = (n) => {
2072
2064
  if (kt(n) !== "object")
2073
2065
  return !1;
2074
- const t = re(n);
2066
+ const t = ne(n);
2075
2067
  return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(ze in n) && !(Mt in n);
2076
2068
  }, an = (n) => {
2077
2069
  if (!Pt(n) || bt(n))
@@ -2136,7 +2128,7 @@ const bn = (n, t, e, { allOwnKeys: i } = {}) => (vt(t, (r, s) => {
2136
2128
  do {
2137
2129
  for (r = Object.getOwnPropertyNames(n), s = r.length; s-- > 0; )
2138
2130
  a = r[s], (!i || i(a, n, t)) && !o[a] && (t[a] = n[a], o[a] = !0);
2139
- n = e !== !1 && re(n);
2131
+ n = e !== !1 && ne(n);
2140
2132
  } while (n && (!e || e(n, t)) && n !== Object.prototype);
2141
2133
  return t;
2142
2134
  }, wn = (n, t, e) => {
@@ -2152,7 +2144,7 @@ const bn = (n, t, e, { allOwnKeys: i } = {}) => (vt(t, (r, s) => {
2152
2144
  for (; t-- > 0; )
2153
2145
  e[t] = n[t];
2154
2146
  return e;
2155
- }, Tn = /* @__PURE__ */ ((n) => (t) => n && t instanceof n)(typeof Uint8Array < "u" && re(Uint8Array)), An = (n, t) => {
2147
+ }, Tn = /* @__PURE__ */ ((n) => (t) => n && t instanceof n)(typeof Uint8Array < "u" && ne(Uint8Array)), An = (n, t) => {
2156
2148
  const i = (n && n[Mt]).call(n);
2157
2149
  let r;
2158
2150
  for (; (r = i.next()) && !r.done; ) {
@@ -2436,10 +2428,10 @@ function Re(n) {
2436
2428
  return t[i];
2437
2429
  });
2438
2430
  }
2439
- function se(n, t) {
2431
+ function re(n, t) {
2440
2432
  this._pairs = [], n && jt(n, this, t);
2441
2433
  }
2442
- const ni = se.prototype;
2434
+ const ni = re.prototype;
2443
2435
  ni.append = function(t, e) {
2444
2436
  this._pairs.push([t, e]);
2445
2437
  };
@@ -2463,7 +2455,7 @@ function ri(n, t, e) {
2463
2455
  });
2464
2456
  const r = e && e.serialize;
2465
2457
  let s;
2466
- if (r ? s = r(t, e) : s = l.isURLSearchParams(t) ? t.toString() : new se(t, e).toString(i), s) {
2458
+ if (r ? s = r(t, e) : s = l.isURLSearchParams(t) ? t.toString() : new re(t, e).toString(i), s) {
2467
2459
  const a = n.indexOf("#");
2468
2460
  a !== -1 && (n = n.slice(0, a)), n += (n.indexOf("?") === -1 ? "?" : "&") + s;
2469
2461
  }
@@ -2494,7 +2486,7 @@ class Oe {
2494
2486
  *
2495
2487
  * @param {Number} id The ID that was returned by `use`
2496
2488
  *
2497
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
2489
+ * @returns {void}
2498
2490
  */
2499
2491
  eject(t) {
2500
2492
  this.handlers[t] && (this.handlers[t] = null);
@@ -2527,7 +2519,7 @@ const si = {
2527
2519
  silentJSONParsing: !0,
2528
2520
  forcedJSONParsing: !0,
2529
2521
  clarifyTimeoutError: !1
2530
- }, Wn = typeof URLSearchParams < "u" ? URLSearchParams : se, Xn = typeof FormData < "u" ? FormData : null, zn = typeof Blob < "u" ? Blob : null, Gn = {
2522
+ }, Wn = typeof URLSearchParams < "u" ? URLSearchParams : re, Xn = typeof FormData < "u" ? FormData : null, zn = typeof Blob < "u" ? Blob : null, Gn = {
2531
2523
  isBrowser: !0,
2532
2524
  classes: {
2533
2525
  URLSearchParams: Wn,
@@ -2535,10 +2527,10 @@ const si = {
2535
2527
  Blob: zn
2536
2528
  },
2537
2529
  protocols: ["http", "https", "file", "blob", "url", "data"]
2538
- }, ae = typeof window < "u" && typeof document < "u", te = typeof navigator == "object" && navigator || void 0, $n = ae && (!te || ["ReactNative", "NativeScript", "NS"].indexOf(te.product) < 0), Jn = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
2539
- self instanceof WorkerGlobalScope && typeof self.importScripts == "function", Qn = ae && window.location.href || "http://localhost", Zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2530
+ }, se = typeof window < "u" && typeof document < "u", te = typeof navigator == "object" && navigator || void 0, $n = se && (!te || ["ReactNative", "NativeScript", "NS"].indexOf(te.product) < 0), Jn = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
2531
+ self instanceof WorkerGlobalScope && typeof self.importScripts == "function", Qn = se && window.location.href || "http://localhost", Zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2540
2532
  __proto__: null,
2541
- hasBrowserEnv: ae,
2533
+ hasBrowserEnv: se,
2542
2534
  hasStandardBrowserEnv: $n,
2543
2535
  hasStandardBrowserWebWorkerEnv: Jn,
2544
2536
  navigator: te,
@@ -2952,16 +2944,18 @@ const Ut = (n, t, e = 3) => {
2952
2944
  ) : () => !0, pr = B.hasStandardBrowserEnv ? (
2953
2945
  // Standard browser envs support document.cookie
2954
2946
  {
2955
- write(n, t, e, i, r, s) {
2956
- const a = [n + "=" + encodeURIComponent(t)];
2957
- l.isNumber(e) && a.push("expires=" + new Date(e).toGMTString()), l.isString(i) && a.push("path=" + i), l.isString(r) && a.push("domain=" + r), s === !0 && a.push("secure"), document.cookie = a.join("; ");
2947
+ write(n, t, e, i, r, s, a) {
2948
+ if (typeof document > "u") return;
2949
+ const o = [`${n}=${encodeURIComponent(t)}`];
2950
+ l.isNumber(e) && o.push(`expires=${new Date(e).toUTCString()}`), l.isString(i) && o.push(`path=${i}`), l.isString(r) && o.push(`domain=${r}`), s === !0 && o.push("secure"), l.isString(a) && o.push(`SameSite=${a}`), document.cookie = o.join("; ");
2958
2951
  },
2959
2952
  read(n) {
2960
- const t = document.cookie.match(new RegExp("(^|;\\s*)(" + n + ")=([^;]*)"));
2961
- return t ? decodeURIComponent(t[3]) : null;
2953
+ if (typeof document > "u") return null;
2954
+ const t = document.cookie.match(new RegExp("(?:^|; )" + n + "=([^;]*)"));
2955
+ return t ? decodeURIComponent(t[1]) : null;
2962
2956
  },
2963
2957
  remove(n) {
2964
- this.write(n, "", Date.now() - 864e5);
2958
+ this.write(n, "", Date.now() - 864e5, "/");
2965
2959
  }
2966
2960
  }
2967
2961
  ) : (
@@ -3355,7 +3349,7 @@ const hi = (n) => {
3355
3349
  }
3356
3350
  };
3357
3351
  }, Sr = /* @__PURE__ */ new Map(), li = (n) => {
3358
- let t = n ? n.env : {};
3352
+ let t = n && n.env || {};
3359
3353
  const { fetch: e, Request: i, Response: r } = t, s = [
3360
3354
  i,
3361
3355
  r,
@@ -3367,14 +3361,14 @@ const hi = (n) => {
3367
3361
  return h;
3368
3362
  };
3369
3363
  li();
3370
- const ee = {
3364
+ const ae = {
3371
3365
  http: jn,
3372
3366
  xhr: mr,
3373
3367
  fetch: {
3374
3368
  get: li
3375
3369
  }
3376
3370
  };
3377
- l.forEach(ee, (n, t) => {
3371
+ l.forEach(ae, (n, t) => {
3378
3372
  if (n) {
3379
3373
  try {
3380
3374
  Object.defineProperty(n, "name", { value: t });
@@ -3383,36 +3377,46 @@ l.forEach(ee, (n, t) => {
3383
3377
  Object.defineProperty(n, "adapterName", { value: t });
3384
3378
  }
3385
3379
  });
3386
- const ke = (n) => `- ${n}`, Tr = (n) => l.isFunction(n) || n === null || n === !1, fi = {
3387
- getAdapter: (n, t) => {
3388
- n = l.isArray(n) ? n : [n];
3389
- const { length: e } = n;
3390
- let i, r;
3391
- const s = {};
3392
- for (let a = 0; a < e; a++) {
3393
- i = n[a];
3394
- let o;
3395
- if (r = i, !Tr(i) && (r = ee[(o = String(i)).toLowerCase()], r === void 0))
3396
- throw new v(`Unknown adapter '${o}'`);
3397
- if (r && (l.isFunction(r) || (r = r.get(t))))
3398
- break;
3399
- s[o || "#" + a] = r;
3400
- }
3401
- if (!r) {
3402
- const a = Object.entries(s).map(
3403
- ([c, h]) => `adapter ${c} ` + (h === !1 ? "is not supported by the environment" : "is not available in the build")
3404
- );
3405
- let o = e ? a.length > 1 ? `since :
3380
+ const ke = (n) => `- ${n}`, Tr = (n) => l.isFunction(n) || n === null || n === !1;
3381
+ function Ar(n, t) {
3382
+ n = l.isArray(n) ? n : [n];
3383
+ const { length: e } = n;
3384
+ let i, r;
3385
+ const s = {};
3386
+ for (let a = 0; a < e; a++) {
3387
+ i = n[a];
3388
+ let o;
3389
+ if (r = i, !Tr(i) && (r = ae[(o = String(i)).toLowerCase()], r === void 0))
3390
+ throw new v(`Unknown adapter '${o}'`);
3391
+ if (r && (l.isFunction(r) || (r = r.get(t))))
3392
+ break;
3393
+ s[o || "#" + a] = r;
3394
+ }
3395
+ if (!r) {
3396
+ const a = Object.entries(s).map(
3397
+ ([c, h]) => `adapter ${c} ` + (h === !1 ? "is not supported by the environment" : "is not available in the build")
3398
+ );
3399
+ let o = e ? a.length > 1 ? `since :
3406
3400
  ` + a.map(ke).join(`
3407
3401
  `) : " " + ke(a[0]) : "as no adapter specified";
3408
- throw new v(
3409
- "There is no suitable adapter to dispatch the request " + o,
3410
- "ERR_NOT_SUPPORT"
3411
- );
3412
- }
3413
- return r;
3414
- },
3415
- adapters: ee
3402
+ throw new v(
3403
+ "There is no suitable adapter to dispatch the request " + o,
3404
+ "ERR_NOT_SUPPORT"
3405
+ );
3406
+ }
3407
+ return r;
3408
+ }
3409
+ const fi = {
3410
+ /**
3411
+ * Resolve an adapter from a list of adapter names or functions.
3412
+ * @type {Function}
3413
+ */
3414
+ getAdapter: Ar,
3415
+ /**
3416
+ * Exposes all known adapters
3417
+ * @type {Object<string, Function|Object>}
3418
+ */
3419
+ adapters: ae
3416
3420
  };
3417
3421
  function $t(n) {
3418
3422
  if (n.cancelToken && n.cancelToken.throwIfRequested(), n.signal && n.signal.aborted)
@@ -3436,7 +3440,7 @@ function Fe(n) {
3436
3440
  ), i.response.headers = L.from(i.response.headers))), Promise.reject(i);
3437
3441
  });
3438
3442
  }
3439
- const pi = "1.12.2", qt = {};
3443
+ const pi = "1.13.2", qt = {};
3440
3444
  ["object", "boolean", "number", "function", "string", "symbol"].forEach((n, t) => {
3441
3445
  qt[n] = function(i) {
3442
3446
  return typeof i === n || "a" + (t < 1 ? "n " : " ") + n;
@@ -3464,7 +3468,7 @@ qt.transitional = function(t, e, i) {
3464
3468
  qt.spelling = function(t) {
3465
3469
  return (e, i) => (console.warn(`${i} is likely a misspelling of ${t}`), !0);
3466
3470
  };
3467
- function Ar(n, t, e) {
3471
+ function Cr(n, t, e) {
3468
3472
  if (typeof n != "object")
3469
3473
  throw new v("options must be an object", v.ERR_BAD_OPTION_VALUE);
3470
3474
  const i = Object.keys(n);
@@ -3482,7 +3486,7 @@ function Ar(n, t, e) {
3482
3486
  }
3483
3487
  }
3484
3488
  const xt = {
3485
- assertOptions: Ar,
3489
+ assertOptions: Cr,
3486
3490
  validators: qt
3487
3491
  }, H = xt.validators;
3488
3492
  let nt = class {
@@ -3609,7 +3613,7 @@ l.forEach(["post", "put", "patch"], function(t) {
3609
3613
  }
3610
3614
  nt.prototype[t] = e(), nt.prototype[t + "Form"] = e(!0);
3611
3615
  });
3612
- let Cr = class di {
3616
+ let Rr = class di {
3613
3617
  constructor(t) {
3614
3618
  if (typeof t != "function")
3615
3619
  throw new TypeError("executor must be a function.");
@@ -3682,15 +3686,15 @@ let Cr = class di {
3682
3686
  };
3683
3687
  }
3684
3688
  };
3685
- function Rr(n) {
3689
+ function Or(n) {
3686
3690
  return function(e) {
3687
3691
  return n.apply(null, e);
3688
3692
  };
3689
3693
  }
3690
- function Or(n) {
3694
+ function Dr(n) {
3691
3695
  return l.isObject(n) && n.isAxiosError === !0;
3692
3696
  }
3693
- const ie = {
3697
+ const ee = {
3694
3698
  Continue: 100,
3695
3699
  SwitchingProtocols: 101,
3696
3700
  Processing: 102,
@@ -3753,10 +3757,16 @@ const ie = {
3753
3757
  InsufficientStorage: 507,
3754
3758
  LoopDetected: 508,
3755
3759
  NotExtended: 510,
3756
- NetworkAuthenticationRequired: 511
3760
+ NetworkAuthenticationRequired: 511,
3761
+ WebServerIsDown: 521,
3762
+ ConnectionTimedOut: 522,
3763
+ OriginIsUnreachable: 523,
3764
+ TimeoutOccurred: 524,
3765
+ SslHandshakeFailed: 525,
3766
+ InvalidSslCertificate: 526
3757
3767
  };
3758
- Object.entries(ie).forEach(([n, t]) => {
3759
- ie[t] = n;
3768
+ Object.entries(ee).forEach(([n, t]) => {
3769
+ ee[t] = n;
3760
3770
  });
3761
3771
  function _i(n) {
3762
3772
  const t = new nt(n), e = Xe(nt.prototype.request, t);
@@ -3767,7 +3777,7 @@ function _i(n) {
3767
3777
  const S = _i(Et);
3768
3778
  S.Axios = nt;
3769
3779
  S.CanceledError = _t;
3770
- S.CancelToken = Cr;
3780
+ S.CancelToken = Rr;
3771
3781
  S.isCancel = oi;
3772
3782
  S.VERSION = pi;
3773
3783
  S.toFormData = jt;
@@ -3776,33 +3786,33 @@ S.Cancel = S.CanceledError;
3776
3786
  S.all = function(t) {
3777
3787
  return Promise.all(t);
3778
3788
  };
3779
- S.spread = Rr;
3780
- S.isAxiosError = Or;
3789
+ S.spread = Or;
3790
+ S.isAxiosError = Dr;
3781
3791
  S.mergeConfig = rt;
3782
3792
  S.AxiosHeaders = L;
3783
3793
  S.formToJSON = (n) => ai(l.isHTMLForm(n) ? new FormData(n) : n);
3784
3794
  S.getAdapter = fi.getAdapter;
3785
- S.HttpStatusCode = ie;
3795
+ S.HttpStatusCode = ee;
3786
3796
  S.default = S;
3787
3797
  const {
3788
- Axios: Nr,
3789
- AxiosError: xr,
3790
- CanceledError: Vr,
3791
- isCancel: Ur,
3792
- CancelToken: Lr,
3793
- VERSION: Mr,
3794
- all: kr,
3795
- Cancel: Fr,
3796
- isAxiosError: jr,
3797
- spread: qr,
3798
- toFormData: Kr,
3799
- AxiosHeaders: Hr,
3800
- HttpStatusCode: Wr,
3801
- formToJSON: Xr,
3802
- getAdapter: zr,
3803
- mergeConfig: Gr
3798
+ Axios: xr,
3799
+ AxiosError: Vr,
3800
+ CanceledError: Ur,
3801
+ isCancel: Lr,
3802
+ CancelToken: Mr,
3803
+ VERSION: kr,
3804
+ all: Fr,
3805
+ Cancel: jr,
3806
+ isAxiosError: qr,
3807
+ spread: Kr,
3808
+ toFormData: Hr,
3809
+ AxiosHeaders: Wr,
3810
+ HttpStatusCode: Xr,
3811
+ formToJSON: zr,
3812
+ getAdapter: Gr,
3813
+ mergeConfig: $r
3804
3814
  } = S;
3805
- class $r extends mi {
3815
+ class Jr extends mi {
3806
3816
  __pinPad__ = {
3807
3817
  buffer: null,
3808
3818
  about: {
@@ -4223,9 +4233,8 @@ class $r extends mi {
4223
4233
  this.dispatch("serial:message", e);
4224
4234
  }
4225
4235
  serialSetConnectionConstant() {
4226
- const t = "", e = "";
4227
4236
  let i = "C56AABOUT";
4228
- i = t + i.length.toString().padStart(3, "0") + i + e;
4237
+ i = "" + i.length.toString().padStart(3, "0") + i + "";
4229
4238
  let r = 0;
4230
4239
  for (let a = 0; a < i.length; a++)
4231
4240
  r ^= i.charCodeAt(a);
@@ -5331,5 +5340,5 @@ class $r extends mi {
5331
5340
  }
5332
5341
  }
5333
5342
  export {
5334
- $r as PinPad
5343
+ Jr as PinPad
5335
5344
  };
package/dist/pinpax.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./kernel-9JeWIxgz.cjs"),s=require("./relay-E3NCcSjS.cjs");class p extends c.Kernel{__pinpax__={server:"DEV",businessId:null,encryptionKey:null,apiKey:null,asyncResponses:{voucher:null,sale:null},waiting:{voucher:!1,sale:!1,sale_init:"idle",sale_login:"idle"}};constructor({filters:i=null,config_port:e={baudRate:115200,dataBits:8,stopBits:1,parity:"none",bufferSize:32768,flowControl:"none"},no_device:t=1,device_listen_on_channel:a=1,socket:n=!1}={filters:null,config_port:{baudRate:115200,dataBits:8,stopBits:1,parity:"none",bufferSize:32768,flowControl:"none"},no_device:1,device_listen_on_channel:1,socket:!1}){if(super({filters:i,config_port:e,no_device:t,device_listen_on_channel:a,socket:n}),this.__internal__.device.type="pinpax",c.Devices.getCustom(this.typeDevice,t))throw new Error(`Device ${this.typeDevice} ${t} already exists`);this.__internal__.time.response_connection=4e3,this.__internal__.time.response_general=3e3,this.__internal__.serial.delay_first_connection=1e3,this.__internal__.serial.response.replacer="",this.__internal__.serial.response.limiter=`\r
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./kernel-7ObJp74F.cjs"),s=require("./relay-E3NCcSjS.cjs");class p extends c.Kernel{__pinpax__={server:"DEV",businessId:null,encryptionKey:null,apiKey:null,asyncResponses:{voucher:null,sale:null},waiting:{voucher:!1,sale:!1,sale_init:"idle",sale_login:"idle"}};constructor({filters:i=null,config_port:e={baudRate:115200,dataBits:8,stopBits:1,parity:"none",bufferSize:32768,flowControl:"none"},no_device:t=1,device_listen_on_channel:a=1,socket:n=!1}={filters:null,config_port:{baudRate:115200,dataBits:8,stopBits:1,parity:"none",bufferSize:32768,flowControl:"none"},no_device:1,device_listen_on_channel:1,socket:!1}){if(super({filters:i,config_port:e,no_device:t,device_listen_on_channel:a,socket:n}),this.__internal__.device.type="pinpax",c.Devices.getCustom(this.typeDevice,t))throw new Error(`Device ${this.typeDevice} ${t} already exists`);this.__internal__.time.response_connection=4e3,this.__internal__.time.response_general=3e3,this.__internal__.serial.delay_first_connection=1e3,this.__internal__.serial.response.replacer="",this.__internal__.serial.response.limiter=`\r
2
2
  `,this.#t(),c.Devices.add(this),this.getResponseAsString()}#t(){const i=["buttons-status","init-app","connectMessage","voucher","info","keep-alive","reset-app","get-config","payment","error","refund","login"];for(const e of i)this.serialRegisterAvailableListener(e)}set businessId(i){this.__pinpax__.businessId=i}get businessId(){return this.__pinpax__.businessId}set encryptionKey(i){this.__pinpax__.encryptionKey=i}get encryptionKey(){return this.__pinpax__.encryptionKey}set apiKey(i){this.__pinpax__.apiKey=i}get apiKey(){return this.__pinpax__.apiKey}set server(i){this.__pinpax__.server=i}get server(){return this.__pinpax__.server}serialMessage(i){let e=null;try{e=JSON.parse(i),e.request||(e.request=this.lastAction),e.name||(e.name=this.lastAction)}catch(t){console.error("Error parsing response",t,i),this.dispatch("serial:message",i);return}switch(e.response){case"INIT":this.dispatch("init",{name:"INIT",request:this.lastAction,status:"ok"}),this.__pinpax__.waiting.sale_init==="waiting"&&(this.__pinpax__.waiting.sale_init="received");break;case"INITAPP":this.dispatch("init-app",{name:"INITAPP",request:this.lastAction,status:"started"}),this.__pinpax__.waiting.sale_init==="waiting"?this.__pinpax__.waiting.sale_init="received":this.#n().then(()=>{});break;case"CONNECT":this.dispatch("connectMessage",{name:"CONNECT",request:this.lastAction,status:"connected"}),this.#r().then(()=>{});break;case"LOGIN":e.name||(e.name="LOGIN"),this.__pinpax__.waiting.sale_login==="waiting"&&(this.__pinpax__.waiting.sale_login="received"),this.dispatch("login",e);break;case"LASTVOUCHER":e.name||(e.name="LASTVOUCHER"),this.dispatch("voucher",e),this.__pinpax__.waiting.voucher&&(this.__pinpax__.asyncResponses.voucher=e,this.__pinpax__.waiting.voucher=!1);break;case"DEVICEINFO":e.name||(e.name="DEVICEINFO"),this.dispatch("info",e);break;case"KEEPALIVE":this.dispatch("keep-alive",{name:"KEEPALIVE",request:this.lastAction,status:"alive"});break;case"RESETAPP":this.dispatch("reset-app",{name:"RESETAPP",request:this.lastAction,status:"accepted"});break;case"GETCONFIG":e.name||(e.name="GETCONFIG"),this.dispatch("get-config",e);break;case"HIDEBUTTONS":this.dispatch("buttons-status",{name:"HIDEBUTTONS",request:this.lastAction,hidden:!0});break;case"SHOWBUTTONS":this.dispatch("buttons-status",{name:"SHOWBUTTONS",request:this.lastAction,hidden:!1});break;case"PAYMENT_PROCESS":e.name||(e.name="PAYMENT_PROCESS"),this.dispatch("payment",{name:"PAYMENT_PROCESS",request:this.lastAction,status:"starting",amount:e.amount,reference:e.referecence});break;case"INSERT_CARD":this.dispatch("payment",{name:"INSERT_CARD",request:this.lastAction,status:"insert card"});break;case"CARD_DATA":e.name||(e.name="CARD_DATA"),this.dispatch("payment",{name:"CARD_DATA",request:this.lastAction,status:"card data",amount:e.amount,cardHolderName:e.cardHolderName,ccMark:e.ccMark,ccType:e.ccType,currency:e.currency,maskedPan:e.maskedPan,readingType:e.readingType});break;case"MERCHANT":e.name||(e.name="MERCHANT"),this.dispatch("payment",{request:this.lastAction,status:"merchant",afiliation:e.afiliation,alias:e.alias,amountCashBackCommission:e.amountCashBackCommission,currency:e.currency,description:e.description,hasCashBack:e.hasCashBack,limitCashBackAmount:e.limitCashBackAmount,merchant:e.merchant,months:e.months,name:e.name});break;case"TRANSACTION_RESULT":e.name||(e.name="TRANSACTION_RESULT"),this.#o({status:"result",approved:e.approved,acquirer:e.acquirer,address:e.address,amount:e.amount,amountCashback:e.amountCashback,appIDLabel:e.appIDLabel,appId:e.appId,arqc:e.arqc,auth:e.auth,ccBin:e.ccBin,ccExpirationDate:e.ccExpirationDate,ccName:e.ccName,ccNumber:e.ccNumber,ccType:e.ccType,comissionCashback:e.comissionCashback,currency:e.currency,date:e.date,errorCode:e.errorCode,errorDescription:e.errorDescription,folio:e.folio,id:e.id,merchantName:e.merchantName,msiLabel:e.msiLabel,operation:e.operation,pin:e.pin,qps:e.qps,reference:e.reference,response:e.response,source:e.source,sourceLabel:e.sourceLabel,time:e.time});break;case"ERROR":e.name||(e.name="ERROR"),this.__pinpax__.waiting.sale&&(this.__pinpax__.asyncResponses.sale={status:"error",approved:!1,response:e}),this.dispatch("error",{name:"ERROR",request:this.lastAction,status:"error",response:e}),this.dispatch("payment",{name:"ERROR",request:this.lastAction,status:"error",response:e});break;case"REFUND":this.dispatch("refund",{name:"ERROR",request:this.lastAction,status:"refund",response:e});break}this.dispatch("serial:message",e)}serialSetConnectionConstant(){return s.s.connection()}softReload(){super.softReload(),this.__pinpax__.waiting.sale=!1,this.__pinpax__.waiting.voucher=!1,this.__pinpax__.asyncResponses.sale=null,this.__pinpax__.asyncResponses.voucher=null}async sendCustomCode(i={}){if(typeof i!="object")throw new Error("Invalid object");if(i.constructor!==Object)throw new Error("Invalid object");if(Object.keys(i).length===0)throw new Error("Empty object");if(i.action===void 0||i.action===null)throw new Error("Invalid object add action");const e=JSON.stringify(i),t=this.parseStringToBytes(e,`\r
3
3
  `);await this.appendToQueue(this.stringArrayToUint8Array(t),"custom")}async connectMessage(){await this.appendToQueue(s.s.connect(),"connect:message")}async#e(){if(this.isDisconnected)throw new Error("Device is disconnected");return this.queue.length===0?!0:new Promise(i=>{const e=setInterval(()=>{this.queue.length===0&&(clearInterval(e),i(!0))},500)})}async#i({type:i="production"}={}){const e=s.s.readQR({type:i});return await this.appendToQueue(e,"read-qr")}async#s(){await this.appendToQueue(s.s.forceHide(),"force-hide")}async#a(){await this.appendToQueue(s.s.forceShow(),"force-show")}async#n(){await this.connectMessage()}async#r(){await this.hideButtons()}#o(i){this.dispatch("payment",i),this.__pinpax__.waiting.sale&&(this.__pinpax__.asyncResponses.sale=i)}cancelSaleRequestInProcess(){this.__pinpax__.waiting.sale&&(this.__pinpax__.asyncResponses.sale={status:"error",approved:!1,response:{}})}async#c(){return new Promise((i,e)=>{const t=setTimeout(()=>{this.__pinpax__.waiting.sale_login==="waiting"&&(this.__pinpax__.waiting.sale_login="timeout",e(new Error("Login timeout")))},1e4),a=setInterval(()=>{this.__pinpax__.waiting.sale_login==="received"&&(clearTimeout(t),clearInterval(a),i(!0))},100)})}async#p(){return new Promise((i,e)=>{const t=setTimeout(()=>{this.__pinpax__.waiting.sale_init==="waiting"&&(this.__pinpax__.waiting.sale_init="timeout",e(new Error("Init timeout")))},1e4),a=setInterval(()=>{this.__pinpax__.waiting.sale_init==="received"&&(clearTimeout(t),clearInterval(a),i(!0))},100)})}async makeSale({amount:i=0,reference:e=null}={amount:0,reference:null}){if(this.isDisconnected)throw new Error("Device is disconnected");if(this.__pinpax__.waiting.sale)throw new Error("Already waiting for sale response");const t=s.s.makeSale({amount:i,reference:e});this.__pinpax__.waiting.sale=!0,this.__pinpax__.asyncResponses.sale=null,this.queue.length>0&&await this.#e();let a=!1;try{this.__pinpax__.waiting.sale_login="waiting",await this.login(),await this.#c(),this.__pinpax__.waiting.sale_login="idle",this.__pinpax__.waiting.sale_init="waiting",await this.init(),await this.#p(),this.__pinpax__.waiting.sale_init="idle"}catch(n){a=!0,this.__pinpax__.waiting.sale_login="idle",this.__pinpax__.waiting.sale_init="idle",this.__pinpax__.waiting.sale=!1,this.dispatch("error",{name:"ERROR",request:this.lastAction,status:"error",response:"Error during login/init before sale",error:n})}return a?!1:(await this.appendToQueue(t,"make-sale"),new Promise(n=>{const r=setInterval(()=>{if(this.__pinpax__.asyncResponses.sale){const o=this.__pinpax__.asyncResponses.sale;this.__pinpax__.asyncResponses.sale=null,this.__pinpax__.waiting.sale=!1,clearInterval(r),n(o.approved)}},100)}))}async getVoucher({folio:i=null}={}){if(this.isDisconnected)throw new Error("Device is disconnected");if(this.__pinpax__.waiting.voucher)throw new Error("Already waiting for voucher");if(!i)throw new Error("Folio is required");this.__pinpax__.waiting.voucher=!0,this.__pinpax__.asyncResponses.voucher=null;const e=s.s.getVoucher({folio:i});return this.queue.length>0&&await this.#e(),await this.appendToQueue(e,"get-voucher"),new Promise((t,a)=>{const n=setTimeout(()=>{this.__pinpax__.waiting.voucher=!1,a("Timeout")},1e4),r=setInterval(()=>{if(this.__pinpax__.asyncResponses.voucher){const o=this.__pinpax__.asyncResponses.voucher;this.__pinpax__.asyncResponses.voucher=null,this.__pinpax__.waiting.voucher=!1,clearInterval(r),clearTimeout(n),t(o.voucher)}},100)})}async info(){await this.appendToQueue(s.s.info(),"info")}async keepAlive(){await this.appendToQueue(s.s.keepAlive(),"keep-alive")}async restartApp(){await this.appendToQueue(s.s.restartApp(),"reset-app")}async getConfig(){return await this.appendToQueue(s.s.getConfig(),"get-config")}async hideButtons(){return await this.appendToQueue(s.s.hideButtons(),"hide-buttons"),await this.#s()}async showButtons(){return await this.appendToQueue(s.s.showButtons(),"show-buttons"),await this.#a()}async demo(){return console.warn("RUNNING DEMO APP, BE CAREFUL"),await this.appendToQueue(s.s.demo(),"demo")}async refund({amount:i=0,folio:e=null,auth:t=null}={}){return await this.appendToQueue(s.s.refund({amount:i,folio:e,auth:t}),"refund")}async readProductionQR(){return await this.#i({type:"production"})}async readQualityAssuranceQR(){return this.#i({type:"QA"})}async exit(){return await this.appendToQueue(s.s.exit(),"exit-app")}async init(){await this.appendToQueue(s.s.init(),"init-app")}async login(){if(!this.apiKey||!this.businessId||!this.encryptionKey||!this.server)throw new Error("Invalid data to login check apiKey, businessId, encryptionKey, server");const i=JSON.stringify({action:"LOGIN_MIT",server:this.__pinpax__.server,business_id:this.__pinpax__.businessId,encryption_key:this.__pinpax__.encryptionKey,api_key:this.__pinpax__.apiKey}),e=this.parseStringToBytes(i,`\r
4
4
  `);await this.appendToQueue(e,"login")}}exports.PinPax=p;
package/dist/pinpax.js CHANGED
@@ -1,4 +1,4 @@
1
- import { K as p, D as c } from "./kernel-BnWXOCde.js";
1
+ import { K as p, D as c } from "./kernel-BZzs36vi.js";
2
2
  import { s } from "./relay-DP8PLsDP.js";
3
3
  class l extends p {
4
4
  __pinpax__ = {
package/dist/relay.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./kernel-9JeWIxgz.cjs"),a=require("./relay-E3NCcSjS.cjs");class r extends n.Kernel{constructor({filters:t=null,config_port:e,no_device:s=1,socket:i=!1}={}){if(super({filters:t,config_port:e,no_device:s,socket:i}),this.__internal__.device.type="relay",this.__internal__.auto_response=!1,this.__internal__.serial.auto_response=[2,6,221,221,240,207,3],n.Devices.getCustom(this.typeDevice,s))throw new Error(`Device ${this.typeDevice} ${s} already exists`);n.Devices.add(this)}serialMessage(t){t=this.fixHexArray(t);const e={code:t,name:null,description:null,request:null,no_code:0};t[0]==="a0"&&t[2]=="00"?(e.name="Relay turned off",e.description="The relay has been turned off successfully.",e.request=this.lastAction,e.no_code=101):t[0]==="a0"&&t[2]=="01"?(e.name="Relay turned on",e.description="The relay has been turned on successfully.",e.request=this.lastAction,e.no_code=102):(e.name="Unrecognized response",e.description="The response of application was received, but dont identify with any of current parameters",e.request="undefined",e.no_code=400),this.dispatch("serial:message",e)}serialSetConnectionConstant(t=1){return a.e.connection(t)}async turnOn(){const t=a.e.activate();await this.appendToQueue(t,"relay:turn-on")}async turnOff(){const t=a.e.deactivate();await this.appendToQueue(t,"relay:turn-off")}async toggle({inverse:t=!1,ms:e=300}={}){if(!t){await this.turnOn(),await n.wait(e),await this.turnOff();return}await this.turnOff(),await n.wait(e),await this.turnOn()}}exports.Relay=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./kernel-7ObJp74F.cjs"),a=require("./relay-E3NCcSjS.cjs");class r extends n.Kernel{constructor({filters:t=null,config_port:e,no_device:s=1,socket:i=!1}={}){if(super({filters:t,config_port:e,no_device:s,socket:i}),this.__internal__.device.type="relay",this.__internal__.auto_response=!1,this.__internal__.serial.auto_response=[2,6,221,221,240,207,3],n.Devices.getCustom(this.typeDevice,s))throw new Error(`Device ${this.typeDevice} ${s} already exists`);n.Devices.add(this)}serialMessage(t){t=this.fixHexArray(t);const e={code:t,name:null,description:null,request:null,no_code:0};t[0]==="a0"&&t[2]=="00"?(e.name="Relay turned off",e.description="The relay has been turned off successfully.",e.request=this.lastAction,e.no_code=101):t[0]==="a0"&&t[2]=="01"?(e.name="Relay turned on",e.description="The relay has been turned on successfully.",e.request=this.lastAction,e.no_code=102):(e.name="Unrecognized response",e.description="The response of application was received, but dont identify with any of current parameters",e.request="undefined",e.no_code=400),this.dispatch("serial:message",e)}serialSetConnectionConstant(t=1){return a.e.connection(t)}async turnOn(){const t=a.e.activate();await this.appendToQueue(t,"relay:turn-on")}async turnOff(){const t=a.e.deactivate();await this.appendToQueue(t,"relay:turn-off")}async toggle({inverse:t=!1,ms:e=300}={}){if(!t){await this.turnOn(),await n.wait(e),await this.turnOff();return}await this.turnOff(),await n.wait(e),await this.turnOn()}}exports.Relay=r;