@danidoble/webserial 4.4.5 → 4.5.0-alpha.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.
Files changed (116) hide show
  1. package/dist/boardroid.cjs +1 -1
  2. package/dist/boardroid.js +4 -3
  3. package/dist/devices-BndwHuvP.cjs +1 -0
  4. package/dist/devices-CHc7K4eY.js +67 -0
  5. package/dist/hopper.cjs +1 -1
  6. package/dist/hopper.js +1 -1
  7. package/dist/jofemar.cjs +1 -1
  8. package/dist/jofemar.js +7 -6
  9. package/dist/jsd.cjs +1 -0
  10. package/dist/jsd.js +2443 -0
  11. package/dist/kernel-As0xv_MS.cjs +1 -0
  12. package/dist/{kernel-DAorOZat.js → kernel-CFxkp4Nz.js} +147 -204
  13. package/dist/kernel.cjs +1 -1
  14. package/dist/kernel.js +4 -3
  15. package/dist/locker.cjs +1 -1
  16. package/dist/locker.js +12 -11
  17. package/dist/pinpad.cjs +11 -11
  18. package/dist/pinpad.js +684 -639
  19. package/dist/pinpax.cjs +2 -2
  20. package/dist/pinpax.js +4 -3
  21. package/dist/relay.cjs +1 -1
  22. package/dist/relay.js +8 -7
  23. package/dist/types/lib/commands/jsd/applications/licensing.d.ts +51 -0
  24. package/dist/types/lib/commands/jsd/applications/licensing.d.ts.map +1 -0
  25. package/dist/types/lib/commands/jsd/applications/manifest.d.ts +73 -0
  26. package/dist/types/lib/commands/jsd/applications/manifest.d.ts.map +1 -0
  27. package/dist/types/lib/commands/jsd/applications/vision.d.ts +444 -0
  28. package/dist/types/lib/commands/jsd/applications/vision.d.ts.map +1 -0
  29. package/dist/types/lib/commands/jsd/frames/licensing/licensingClient.d.ts +34 -0
  30. package/dist/types/lib/commands/jsd/frames/licensing/licensingClient.d.ts.map +1 -0
  31. package/dist/types/lib/commands/jsd/frames/licensing/opCodes.d.ts +28 -0
  32. package/dist/types/lib/commands/jsd/frames/licensing/opCodes.d.ts.map +1 -0
  33. package/dist/types/lib/commands/jsd/frames/manifest/manifestClient.d.ts +40 -0
  34. package/dist/types/lib/commands/jsd/frames/manifest/manifestClient.d.ts.map +1 -0
  35. package/dist/types/lib/commands/jsd/frames/manifest/opCodes.d.ts +28 -0
  36. package/dist/types/lib/commands/jsd/frames/manifest/opCodes.d.ts.map +1 -0
  37. package/dist/types/lib/commands/jsd/frames/vision/opCodes.d.ts +72 -0
  38. package/dist/types/lib/commands/jsd/frames/vision/opCodes.d.ts.map +1 -0
  39. package/dist/types/lib/commands/jsd/frames/vision/visionClient.d.ts +336 -0
  40. package/dist/types/lib/commands/jsd/frames/vision/visionClient.d.ts.map +1 -0
  41. package/dist/types/lib/commands/jsd/protocol/crc16.d.ts +37 -0
  42. package/dist/types/lib/commands/jsd/protocol/crc16.d.ts.map +1 -0
  43. package/dist/types/lib/commands/jsd/protocol/responseHandler.d.ts +38 -0
  44. package/dist/types/lib/commands/jsd/protocol/responseHandler.d.ts.map +1 -0
  45. package/dist/types/lib/commands/jsd/protocol/rs232Strategy.d.ts +23 -0
  46. package/dist/types/lib/commands/jsd/protocol/rs232Strategy.d.ts.map +1 -0
  47. package/dist/types/lib/commands/jsd/protocol/tcpIpStrategy.d.ts +49 -0
  48. package/dist/types/lib/commands/jsd/protocol/tcpIpStrategy.d.ts.map +1 -0
  49. package/dist/types/lib/commands/jsd/types/LicensingClient.d.ts +32 -0
  50. package/dist/types/lib/commands/jsd/types/LicensingClient.d.ts.map +1 -0
  51. package/dist/types/lib/commands/jsd/types/jsd.types.d.ts +140 -0
  52. package/dist/types/lib/commands/jsd/types/jsd.types.d.ts.map +1 -0
  53. package/dist/types/lib/commands/jsd/types/manifestClient.d.ts +40 -0
  54. package/dist/types/lib/commands/jsd/types/manifestClient.d.ts.map +1 -0
  55. package/dist/types/lib/commands/jsd/types/transport.types.d.ts +29 -0
  56. package/dist/types/lib/commands/jsd/types/transport.types.d.ts.map +1 -0
  57. package/dist/types/lib/commands/jsd/types/visionClient.types.d.ts +356 -0
  58. package/dist/types/lib/commands/jsd/types/visionClient.types.d.ts.map +1 -0
  59. package/dist/types/lib/commands/jsd/utils/aplications.d.ts +48 -0
  60. package/dist/types/lib/commands/jsd/utils/aplications.d.ts.map +1 -0
  61. package/dist/types/lib/commands/jsd/utils/helpers.d.ts +15 -0
  62. package/dist/types/lib/commands/jsd/utils/helpers.d.ts.map +1 -0
  63. package/dist/types/lib/kernel.d.ts.map +1 -0
  64. package/dist/types/{main.d.ts → lib/main.d.ts} +6 -0
  65. package/dist/types/lib/main.d.ts.map +1 -0
  66. package/dist/types/lib/parsers/delimiterTransformer.d.ts +29 -0
  67. package/dist/types/lib/parsers/delimiterTransformer.d.ts.map +1 -0
  68. package/dist/types/lib/serial/boardroid.d.ts.map +1 -0
  69. package/dist/types/lib/serial/hopper.d.ts.map +1 -0
  70. package/dist/types/lib/serial/jofemar.d.ts.map +1 -0
  71. package/dist/types/lib/serial/jsd.d.ts +40 -0
  72. package/dist/types/lib/serial/jsd.d.ts.map +1 -0
  73. package/dist/types/{serial → lib/serial}/kernel.d.ts +1 -0
  74. package/dist/types/{serial → lib/serial}/kernel.d.ts.map +1 -1
  75. package/dist/types/lib/serial/locker.d.ts.map +1 -0
  76. package/dist/types/lib/serial/pinpad.d.ts.map +1 -0
  77. package/dist/types/lib/serial/pinpax.d.ts.map +1 -0
  78. package/dist/types/lib/serial/relay.d.ts.map +1 -0
  79. package/dist/types/{utils → lib/utils}/devices.d.ts +2 -0
  80. package/dist/types/lib/utils/devices.d.ts.map +1 -0
  81. package/dist/types/lib/utils/dispatcher.d.ts.map +1 -0
  82. package/dist/types/lib/utils/emulator.d.ts.map +1 -0
  83. package/dist/types/lib/utils/utils.d.ts.map +1 -0
  84. package/dist/types/test/t.d.ts +2 -0
  85. package/dist/types/test/t.d.ts.map +1 -0
  86. package/dist/webserial-core-3UL91lxi.cjs +4 -0
  87. package/dist/{webserial-core-CiU9IcKf.js → webserial-core-DSv1dX3s.js} +160 -140
  88. package/dist/webserial.cjs +1 -1
  89. package/dist/webserial.js +29 -23
  90. package/package.json +13 -8
  91. package/dist/kernel-g4zSg1Ll.cjs +0 -1
  92. package/dist/types/kernel.d.ts.map +0 -1
  93. package/dist/types/main.d.ts.map +0 -1
  94. package/dist/types/serial/boardroid.d.ts.map +0 -1
  95. package/dist/types/serial/hopper.d.ts.map +0 -1
  96. package/dist/types/serial/jofemar.d.ts.map +0 -1
  97. package/dist/types/serial/locker.d.ts.map +0 -1
  98. package/dist/types/serial/pinpad.d.ts.map +0 -1
  99. package/dist/types/serial/pinpax.d.ts.map +0 -1
  100. package/dist/types/serial/relay.d.ts.map +0 -1
  101. package/dist/types/utils/devices.d.ts.map +0 -1
  102. package/dist/types/utils/dispatcher.d.ts.map +0 -1
  103. package/dist/types/utils/emulator.d.ts.map +0 -1
  104. package/dist/types/utils/utils.d.ts.map +0 -1
  105. package/dist/webserial-core-D49c459A.cjs +0 -4
  106. /package/dist/types/{kernel.d.ts → lib/kernel.d.ts} +0 -0
  107. /package/dist/types/{serial → lib/serial}/boardroid.d.ts +0 -0
  108. /package/dist/types/{serial → lib/serial}/hopper.d.ts +0 -0
  109. /package/dist/types/{serial → lib/serial}/jofemar.d.ts +0 -0
  110. /package/dist/types/{serial → lib/serial}/locker.d.ts +0 -0
  111. /package/dist/types/{serial → lib/serial}/pinpad.d.ts +0 -0
  112. /package/dist/types/{serial → lib/serial}/pinpax.d.ts +0 -0
  113. /package/dist/types/{serial → lib/serial}/relay.d.ts +0 -0
  114. /package/dist/types/{utils → lib/utils}/dispatcher.d.ts +0 -0
  115. /package/dist/types/{utils → lib/utils}/emulator.d.ts +0 -0
  116. /package/dist/types/{utils → lib/utils}/utils.d.ts +0 -0
@@ -1,52 +1,53 @@
1
- import { s as p, S as u } from "./webserial-core-CiU9IcKf.js";
2
- function b(o = 100) {
3
- return new Promise((n) => setTimeout(() => n(), o));
1
+ import { D as o } from "./devices-CHc7K4eY.js";
2
+ import { T as p } from "./webserial-core-DSv1dX3s.js";
3
+ function u(d = 100) {
4
+ return new Promise((n) => setTimeout(() => n(), d));
4
5
  }
5
- function k() {
6
+ function D() {
6
7
  return "serial" in navigator;
7
8
  }
8
- function y() {
9
+ function g() {
9
10
  return "geolocation" in navigator;
10
11
  }
11
12
  function w() {
12
13
  return "crypto" in window;
13
14
  }
14
- function M(o = 1) {
15
- return o * 1e3;
15
+ function M(d = 1) {
16
+ return d * 1e3;
16
17
  }
17
- function D(o) {
18
- return o == null || o === "";
18
+ function y(d) {
19
+ return d == null || d === "";
19
20
  }
20
21
  class e {
21
22
  static enable = !1;
22
23
  static instance = null;
23
- static #i = null;
24
+ static #t = null;
24
25
  static #r = 1;
25
26
  static #d() {
26
27
  if (e.enable === !1) throw new Error("Emulator is disabled");
27
28
  return e.enable;
28
29
  }
29
- static #o(n) {
30
- return e.instance = n, e.#i = n.typeDevice, e.#r = n.deviceNumber, !0;
30
+ static #h(n) {
31
+ return e.instance = n, e.#t = n.typeDevice, e.#r = n.deviceNumber, !0;
31
32
  }
32
33
  static #n(n = null) {
33
- return !e.#d() || n === null && e.instance === null ? !1 : (e.instance === null && n !== null && e.#o(n), !0);
34
+ return !e.#d() || n === null && e.instance === null ? !1 : (e.instance === null && n !== null && e.#h(n), !0);
34
35
  }
35
36
  static #l() {
36
- if (e.#i !== "locker") throw new Error("This function is only available for Locker devices");
37
+ if (e.#t !== "locker") throw new Error("This function is only available for Locker devices");
37
38
  return !0;
38
39
  }
39
- static #t() {
40
- if (e.#i !== "boardroid")
40
+ static #i() {
41
+ if (e.#t !== "boardroid")
41
42
  throw new Error("This function is only available for Boardroid devices");
42
43
  return !0;
43
44
  }
44
45
  static #s() {
45
- if (e.#i !== "jofemar") throw new Error("This function is only available for Jofemar devices");
46
+ if (e.#t !== "jofemar") throw new Error("This function is only available for Jofemar devices");
46
47
  return !0;
47
48
  }
48
49
  static #c() {
49
- if (e.#i === "locker") throw new Error("This function is not available for Locker devices");
50
+ if (e.#t === "locker") throw new Error("This function is not available for Locker devices");
50
51
  return !0;
51
52
  }
52
53
  // static #withoutBoardroid() {
@@ -65,7 +66,7 @@ class e {
65
66
  static status(n = null) {
66
67
  if (!e.#n(n)) return !1;
67
68
  let s = [];
68
- switch (e.#i) {
69
+ switch (e.#t) {
69
70
  case "locker":
70
71
  s = ["0", "8"];
71
72
  break;
@@ -83,7 +84,7 @@ class e {
83
84
  static dispensed(n = null) {
84
85
  if (!e.#n(n)) return !1;
85
86
  let s = [];
86
- switch (e.#i) {
87
+ switch (e.#t) {
87
88
  case "locker":
88
89
  s = ["0", "7", "4", "4", "4"];
89
90
  break;
@@ -101,7 +102,7 @@ class e {
101
102
  static notDispensed(n = null) {
102
103
  if (!e.#n(n)) return !1;
103
104
  let s = [];
104
- switch (e.#i) {
105
+ switch (e.#t) {
105
106
  case "locker":
106
107
  s = ["0", "7", "5", "5", "5"];
107
108
  break;
@@ -126,19 +127,19 @@ class e {
126
127
  }
127
128
  static keyPressed(n = null) {
128
129
  if (!e.#n(n) || !e.#s()) return !1;
129
- const s = ["30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "2A", "23", "41", "42", "43", "44"], t = (128 + e.#r).toString(16), i = Math.floor(Math.random() * 15);
130
- e.#e(["2", t, "54", s[i]]);
130
+ const s = ["30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "2A", "23", "41", "42", "43", "44"], i = (128 + e.#r).toString(16), t = Math.floor(Math.random() * 15);
131
+ e.#e(["2", i, "54", s[t]]);
131
132
  }
132
133
  static doorOpened(n = null) {
133
134
  if (!e.#n(n) || !this.#c()) return !1;
134
135
  let s = [];
135
- const t = (128 + e.#r).toString(16);
136
- switch (e.#i) {
136
+ const i = (128 + e.#r).toString(16);
137
+ switch (e.#t) {
137
138
  case "boardroid":
138
139
  s = ["2", "D8", "dc"];
139
140
  break;
140
141
  case "jofemar":
141
- s = ["2", t, "50", "4F"];
142
+ s = ["2", i, "50", "4F"];
142
143
  break;
143
144
  }
144
145
  e.#e(s);
@@ -146,13 +147,13 @@ class e {
146
147
  static doorClosed(n = null) {
147
148
  if (!e.#n(n) || !this.#c()) return !1;
148
149
  let s = [];
149
- const t = (128 + e.#r).toString(16);
150
- switch (e.#i) {
150
+ const i = (128 + e.#r).toString(16);
151
+ switch (e.#t) {
151
152
  case "boardroid":
152
153
  s = ["2", "D8", "db"];
153
154
  break;
154
155
  case "jofemar":
155
- s = ["2", t, "50", "43"];
156
+ s = ["2", i, "50", "43"];
156
157
  break;
157
158
  }
158
159
  e.#e(s);
@@ -180,13 +181,13 @@ class e {
180
181
  static currentTemperature(n = null) {
181
182
  if (!e.#n(n) || !e.#c()) return !1;
182
183
  let s = [];
183
- const t = (128 + e.#r).toString(16);
184
- switch (e.#i) {
184
+ const i = (128 + e.#r).toString(16);
185
+ switch (e.#t) {
185
186
  case "boardroid":
186
187
  s = ["2", "D9", "44", "30"];
187
188
  break;
188
189
  case "jofemar":
189
- s = ["2", t, "43", "74", "2B", "30", "39", "2E", "31", "7F", "43"];
190
+ s = ["2", i, "43", "74", "2B", "30", "39", "2E", "31", "7F", "43"];
190
191
  break;
191
192
  }
192
193
  e.#e(s);
@@ -300,109 +301,109 @@ class e {
300
301
  e.#e(["6", "51"]);
301
302
  }
302
303
  static rejectLever(n = null) {
303
- if (!e.#n(n) || !e.#t()) return !1;
304
+ if (!e.#n(n) || !e.#i()) return !1;
304
305
  e.#e(["2", "A0", "1"]);
305
306
  }
306
307
  static resetCoinPurse(n = null) {
307
- if (!e.#n(n) || !e.#t()) return !1;
308
+ if (!e.#n(n) || !e.#i()) return !1;
308
309
  e.#e(["2", "A0", "2"]);
309
310
  }
310
311
  static #f(n, s = null) {
311
- let t = n[Math.floor(Math.random() * 5)];
312
+ let i = n[Math.floor(Math.random() * 5)];
312
313
  if (s !== null && !isNaN(parseFloat(s)))
313
314
  switch (s.toString()) {
314
315
  case "0.5":
315
- t = n[1];
316
+ i = n[1];
316
317
  break;
317
318
  case "1":
318
- t = n[2];
319
+ i = n[2];
319
320
  break;
320
321
  case "2":
321
- t = n[3];
322
+ i = n[3];
322
323
  break;
323
324
  case "5":
324
- t = n[4];
325
+ i = n[4];
325
326
  break;
326
327
  case "10":
327
- t = n[5];
328
+ i = n[5];
328
329
  break;
329
330
  }
330
- return t;
331
+ return i;
331
332
  }
332
333
  static coinInsertedBox(n = null, s = null) {
333
- if (!e.#n(n) || !e.#t()) return !1;
334
- const t = ["40", "41", "42", "43", "44", "45"], i = e.#f(t, s);
335
- e.#e(["2", "A0", i]);
334
+ if (!e.#n(n) || !e.#i()) return !1;
335
+ const i = ["40", "41", "42", "43", "44", "45"], t = e.#f(i, s);
336
+ e.#e(["2", "A0", t]);
336
337
  }
337
338
  static coinInsertedTube(n = null, s = null) {
338
- if (!e.#n(n) || !e.#t()) return !1;
339
- const t = ["50", "51", "52", "53", "54", "55"], i = e.#f(t, s);
340
- e.#e(["2", "A0", i]);
339
+ if (!e.#n(n) || !e.#i()) return !1;
340
+ const i = ["50", "51", "52", "53", "54", "55"], t = e.#f(i, s);
341
+ e.#e(["2", "A0", t]);
341
342
  }
342
343
  static #a(n, s = null) {
343
- let t = n[Math.floor(Math.random() * 4)];
344
+ let i = n[Math.floor(Math.random() * 4)];
344
345
  if (s !== null && !isNaN(parseFloat(s)))
345
346
  switch (s.toString()) {
346
347
  case "20":
347
- t = n[0];
348
+ i = n[0];
348
349
  break;
349
350
  case "50":
350
- t = n[1];
351
+ i = n[1];
351
352
  break;
352
353
  case "100":
353
- t = n[2];
354
+ i = n[2];
354
355
  break;
355
356
  case "200":
356
- t = n[3];
357
+ i = n[3];
357
358
  break;
358
359
  case "500":
359
- t = n[4];
360
+ i = n[4];
360
361
  break;
361
362
  }
362
- return t;
363
+ return i;
363
364
  }
364
365
  static banknoteInsertedStacker(n = null, s = null) {
365
- if (!e.#n(n) || !e.#t()) return !1;
366
- const t = ["80", "81", "82", "83", "84"], i = e.#a(t, s);
367
- e.#e(["2", "B0", i]);
366
+ if (!e.#n(n) || !e.#i()) return !1;
367
+ const i = ["80", "81", "82", "83", "84"], t = e.#a(i, s);
368
+ e.#e(["2", "B0", t]);
368
369
  }
369
370
  static banknoteInsertedEscrow(n = null, s = null) {
370
- if (!e.#n(n) || !e.#t()) return !1;
371
- const t = ["90", "91", "92", "93", "94"], i = e.#a(t, s);
372
- e.#e(["2", "B0", i]);
371
+ if (!e.#n(n) || !e.#i()) return !1;
372
+ const i = ["90", "91", "92", "93", "94"], t = e.#a(i, s);
373
+ e.#e(["2", "B0", t]);
373
374
  }
374
375
  static banknoteEjected(n = null, s = null) {
375
- if (!e.#n(n) || !e.#t()) return !1;
376
- const t = ["A0", "A1", "A2", "A3", "A4"], i = e.#a(t, s);
377
- e.#e(["2", "B0", i]);
376
+ if (!e.#n(n) || !e.#i()) return !1;
377
+ const i = ["A0", "A1", "A2", "A3", "A4"], t = e.#a(i, s);
378
+ e.#e(["2", "B0", t]);
378
379
  }
379
380
  static banknoteInsertedRecycler(n = null, s = null) {
380
- if (!e.#n(n) || !e.#t()) return !1;
381
- const t = ["B0", "B1", "B2", "B3", "B4"], i = e.#a(t, s);
382
- e.#e(["2", "B0", i]);
381
+ if (!e.#n(n) || !e.#i()) return !1;
382
+ const i = ["B0", "B1", "B2", "B3", "B4"], t = e.#a(i, s);
383
+ e.#e(["2", "B0", t]);
383
384
  }
384
385
  static banknoteTaken(n = null) {
385
- if (!e.#n(n) || !e.#t()) return !1;
386
+ if (!e.#n(n) || !e.#i()) return !1;
386
387
  e.#e(["2", "B0", "2a"]);
387
388
  }
388
389
  static coinPurseEnabled(n = null) {
389
- if (!e.#n(n) || !e.#t()) return !1;
390
+ if (!e.#n(n) || !e.#i()) return !1;
390
391
  e.#e(["2", "D0", "1"]);
391
392
  }
392
393
  static coinPurseDisabled(n = null) {
393
- if (!e.#n(n) || !e.#t()) return !1;
394
+ if (!e.#n(n) || !e.#i()) return !1;
394
395
  e.#e(["2", "D0", "0"]);
395
396
  }
396
397
  static billPurseDisabled(n = null) {
397
- if (!e.#n(n) || !e.#t()) return !1;
398
+ if (!e.#n(n) || !e.#i()) return !1;
398
399
  e.#e(["2", "D1", "0", "0"]);
399
400
  }
400
401
  static billPurseEnabled(n = null) {
401
- if (!e.#n(n) || !e.#t()) return !1;
402
+ if (!e.#n(n) || !e.#i()) return !1;
402
403
  e.#e(["2", "D1", "1", "1"]);
403
404
  }
404
405
  static readTubes(n = null) {
405
- if (!e.#n(n) || !e.#t()) return !1;
406
+ if (!e.#n(n) || !e.#i()) return !1;
406
407
  const s = [
407
408
  "0",
408
409
  "1",
@@ -436,7 +437,7 @@ class e {
436
437
  "1d",
437
438
  "1e",
438
439
  "1f"
439
- ], [t, i, a, c, l, f] = [
440
+ ], [i, t, r, a, c, l] = [
440
441
  s[Math.floor(Math.random() * 30)],
441
442
  s[Math.floor(Math.random() * 30)],
442
443
  s[Math.floor(Math.random() * 30)],
@@ -444,11 +445,11 @@ class e {
444
445
  s[Math.floor(Math.random() * 30)],
445
446
  s[Math.floor(Math.random() * 30)]
446
447
  ];
447
- e.#e(["2", "D2", t, i, a, c, l, f]);
448
+ e.#e(["2", "D2", i, t, r, a, c, l]);
448
449
  }
449
450
  static readBillPurse(n = null, s = null) {
450
- if (!e.#n(n) || !e.#t() || e.instance === null) return !1;
451
- const t = e.instance, i = [
451
+ if (!e.#n(n) || !e.#i() || e.instance === null) return !1;
452
+ const i = e.instance, t = [
452
453
  "0",
453
454
  "1",
454
455
  "2",
@@ -479,69 +480,69 @@ class e {
479
480
  "1b",
480
481
  "1c"
481
482
  ];
482
- if (t.__banknote_purse.recycler.ict) {
483
- const a = i[Math.floor(Math.random() * 31)];
484
- let c = "0", l = "0", f = "0", d = "0", h = "0";
483
+ if (i.__banknote_purse.recycler.ict) {
484
+ const r = t[Math.floor(Math.random() * 31)];
485
+ let a = "0", c = "0", l = "0", f = "0", h = "0";
485
486
  if (s !== null && !isNaN(parseInt(s)))
486
487
  switch (s.toString()) {
487
488
  case "20":
488
- c = a;
489
+ a = r;
489
490
  break;
490
491
  case "50":
491
- l = a;
492
+ c = r;
492
493
  break;
493
494
  case "100":
494
- f = a;
495
+ l = r;
495
496
  break;
496
497
  case "200":
497
- d = a;
498
+ f = r;
498
499
  break;
499
500
  case "500":
500
- h = a;
501
+ h = r;
501
502
  break;
502
503
  }
503
504
  else
504
- switch (t.__banknote_purse.recycler.banknote) {
505
+ switch (i.__banknote_purse.recycler.banknote) {
505
506
  case 0:
506
- c = a;
507
+ a = r;
507
508
  break;
508
509
  case 1:
509
- l = a;
510
+ c = r;
510
511
  break;
511
512
  case 2:
512
- f = a;
513
+ l = r;
513
514
  break;
514
515
  case 3:
515
- d = a;
516
+ f = r;
516
517
  break;
517
518
  case 4:
518
- h = a;
519
+ h = r;
519
520
  break;
520
521
  }
521
- e.#e(["2", "D3", c, l, f, d, h, "0"]);
522
+ e.#e(["2", "D3", a, c, l, f, h, "0"]);
522
523
  } else {
523
- const [a, c, l, f, d, h] = [
524
- i[Math.floor(Math.random() * 30)],
525
- i[Math.floor(Math.random() * 30)],
526
- i[Math.floor(Math.random() * 30)],
527
- i[Math.floor(Math.random() * 2)],
528
- i[Math.floor(Math.random())],
529
- i[Math.floor(Math.random())]
524
+ const [r, a, c, l, f, h] = [
525
+ t[Math.floor(Math.random() * 30)],
526
+ t[Math.floor(Math.random() * 30)],
527
+ t[Math.floor(Math.random() * 30)],
528
+ t[Math.floor(Math.random() * 2)],
529
+ t[Math.floor(Math.random())],
530
+ t[Math.floor(Math.random())]
530
531
  ];
531
- e.#e(["2", "D3", a, c, l, f, d, h]);
532
+ e.#e(["2", "D3", r, a, c, l, f, h]);
532
533
  }
533
534
  }
534
535
  static banknoteAccepted(n = null) {
535
- if (!e.#n(n) || !e.#t()) return !1;
536
+ if (!e.#n(n) || !e.#i()) return !1;
536
537
  e.#e(["2", "D4", "1"]);
537
538
  }
538
539
  static banknoteRejected(n = null) {
539
- if (!e.#n(n) || !e.#t()) return !1;
540
+ if (!e.#n(n) || !e.#i()) return !1;
540
541
  e.#e(["2", "D4", "0"]);
541
542
  }
542
543
  static banknotesDispensed(n = null) {
543
- if (!e.#n(n) || !e.#t() || e.instance === null) return !1;
544
- const s = e.instance, t = [
544
+ if (!e.#n(n) || !e.#i() || e.instance === null) return !1;
545
+ const s = e.instance, i = [
545
546
  "1",
546
547
  "2",
547
548
  "3",
@@ -572,88 +573,88 @@ class e {
572
573
  "1c"
573
574
  ];
574
575
  if (s.__banknote_purse.recycler.ict) {
575
- const i = t[Math.floor(Math.random() * 30)];
576
- let a = "0", c = "0", l = "0", f = "0", d = "0";
576
+ const t = i[Math.floor(Math.random() * 30)];
577
+ let r = "0", a = "0", c = "0", l = "0", f = "0";
577
578
  switch (s.__banknote_purse.recycler.banknote) {
578
579
  case 0:
579
- a = i;
580
+ r = t;
580
581
  break;
581
582
  case 1:
582
- c = i;
583
+ a = t;
583
584
  break;
584
585
  case 2:
585
- l = i;
586
+ c = t;
586
587
  break;
587
588
  case 3:
588
- f = i;
589
+ l = t;
589
590
  break;
590
591
  case 4:
591
- d = i;
592
+ f = t;
592
593
  break;
593
594
  }
594
- e.#e(["2", "D5", a, c, l, f, d, "0"]);
595
+ e.#e(["2", "D5", r, a, c, l, f, "0"]);
595
596
  } else {
596
- const [i, a, c, l, f, d] = [
597
- t[Math.floor(Math.random() * 30)],
598
- t[Math.floor(Math.random() * 30)],
599
- t[Math.floor(Math.random() * 30)],
600
- t[Math.floor(Math.random() * 2)],
601
- t[Math.floor(Math.random())],
602
- t[Math.floor(Math.random())]
597
+ const [t, r, a, c, l, f] = [
598
+ i[Math.floor(Math.random() * 30)],
599
+ i[Math.floor(Math.random() * 30)],
600
+ i[Math.floor(Math.random() * 30)],
601
+ i[Math.floor(Math.random() * 2)],
602
+ i[Math.floor(Math.random())],
603
+ i[Math.floor(Math.random())]
603
604
  ];
604
- e.#e(["2", "D5", i, a, c, l, f, d]);
605
+ e.#e(["2", "D5", t, r, a, c, l, f]);
605
606
  }
606
607
  }
607
608
  static coinsDispensed(n = null) {
608
- if (!e.#n(n) || !e.#t()) return !1;
609
+ if (!e.#n(n) || !e.#i()) return !1;
609
610
  e.#e(["2", "D6"]);
610
611
  }
611
612
  static relayOn(n = null) {
612
- if (!e.#n(n) || !e.#t()) return !1;
613
+ if (!e.#n(n) || !e.#i()) return !1;
613
614
  e.#e(["2", "DA", "1"]);
614
615
  }
615
616
  static relayOff(n = null) {
616
- if (!e.#n(n) || !e.#t()) return !1;
617
+ if (!e.#n(n) || !e.#i()) return !1;
617
618
  e.#e(["2", "DA", "0"]);
618
619
  }
619
620
  static nayaxEnabled(n = null) {
620
- if (!e.#n(n) || !e.#t()) return !1;
621
+ if (!e.#n(n) || !e.#i()) return !1;
621
622
  e.#e(["2", "DD", "1"]);
622
623
  }
623
624
  static nayaxDisabled(n = null) {
624
- if (!e.#n(n) || !e.#t()) return !1;
625
+ if (!e.#n(n) || !e.#i()) return !1;
625
626
  e.#e(["2", "DD", "0"]);
626
627
  }
627
628
  static nayaxPreCreditAuthorized(n = null) {
628
- if (!e.#n(n) || !e.#t()) return !1;
629
+ if (!e.#n(n) || !e.#i()) return !1;
629
630
  e.#e(["2", "DD", "3"]);
630
631
  }
631
632
  static nayaxCancelRequest(n = null) {
632
- if (!e.#n(n) || !e.#t()) return !1;
633
+ if (!e.#n(n) || !e.#i()) return !1;
633
634
  e.#e(["2", "DD", "4"]);
634
635
  }
635
636
  static nayaxSellApproved(n = null) {
636
- if (!e.#n(n) || !e.#t()) return !1;
637
+ if (!e.#n(n) || !e.#i()) return !1;
637
638
  e.#e(["2", "DD", "5"]);
638
639
  }
639
640
  static nayaxSellDenied(n = null) {
640
- if (!e.#n(n) || !e.#t()) return !1;
641
+ if (!e.#n(n) || !e.#i()) return !1;
641
642
  e.#e(["2", "DD", "6"]);
642
643
  }
643
644
  static nayaxEndSession(n = null) {
644
- if (!e.#n(n) || !e.#t()) return !1;
645
+ if (!e.#n(n) || !e.#i()) return !1;
645
646
  e.#e(["2", "DD", "7"]);
646
647
  }
647
648
  static nayaxCancelled(n = null) {
648
- if (!e.#n(n) || !e.#t()) return !1;
649
+ if (!e.#n(n) || !e.#i()) return !1;
649
650
  e.#e(["2", "DD", "8"]);
650
651
  }
651
652
  static nayaxDispensed(n = null) {
652
- if (!e.#n(n) || !e.#t()) return !1;
653
+ if (!e.#n(n) || !e.#i()) return !1;
653
654
  e.#e(["2", "DD", "A", "0"]);
654
655
  }
655
656
  static nayaxNotDispensed(n = null) {
656
- if (!e.#n(n) || !e.#t()) return !1;
657
+ if (!e.#n(n) || !e.#i()) return !1;
657
658
  e.#e(["2", "DD", "A", "1"]);
658
659
  }
659
660
  static fullTray(n = null) {
@@ -665,64 +666,7 @@ class e {
665
666
  e.instance.__internal__.serial.connected = !0;
666
667
  }
667
668
  }
668
- class r extends p {
669
- constructor() {
670
- super(), r.registerType("boardroid"), r.registerType("hopper"), r.registerType("jofemar"), r.registerType("locker"), r.registerType("pinpad"), r.registerType("pinpax"), r.registerType("relay");
671
- }
672
- static addCustom(n, s) {
673
- r.registerType(n), r.add(s);
674
- }
675
- /**
676
- * @deprecated use get instead
677
- * */
678
- static getCustomByUuid(n, s) {
679
- return r.get(n, s);
680
- }
681
- static getJofemarByUuid(n) {
682
- return r.get("jofemar", n);
683
- }
684
- static getLockerByUuid(n) {
685
- return r.get("locker", n);
686
- }
687
- static getRelayByUuid(n) {
688
- return r.get("relay", n);
689
- }
690
- static getBoardroidByUuid(n) {
691
- return r.get("boardroid", n);
692
- }
693
- static getPinPadByUuid(n) {
694
- return r.get("pinpad", n);
695
- }
696
- static getPinPaxByUuid(n) {
697
- return r.get("pinpax", n);
698
- }
699
- static getHopperByUuid(n) {
700
- return r.get("hopper", n);
701
- }
702
- static getJofemar(n = 1) {
703
- return r.getByNumber("jofemar", n);
704
- }
705
- static getBoardroid(n = 1) {
706
- return r.getByNumber("boardroid", n);
707
- }
708
- static getLocker(n = 1) {
709
- return r.getByNumber("locker", n);
710
- }
711
- static getRelay(n = 1) {
712
- return r.getByNumber("relay", n);
713
- }
714
- static getPinPad(n = 1) {
715
- return r.getByNumber("pinpad", n);
716
- }
717
- static getPinPax(n = 1) {
718
- return r.getByNumber("pinpax", n);
719
- }
720
- static getHopper(n = 1) {
721
- return r.getByNumber("hopper", n);
722
- }
723
- }
724
- r.instance = new r();
725
- class S extends u {
669
+ class v extends p {
726
670
  constructor(n = {}) {
727
671
  super(n), this.__internal__ = structuredClone(this.__internal__), this.getResponseAsArrayHex(), this.__internal__.device.door_open = !1, this.__internal__.time.response_engines = 2e3, this.__internal__.time.sense = 100, this.__internal__.interval.waiting_sense = 0, this.__internal__.dispense = {
728
672
  must_response: !1,
@@ -755,7 +699,7 @@ class S extends u {
755
699
  }), null);
756
700
  }
757
701
  async internalDispenseStatus() {
758
- return this.__internal__.dispense.must_response && (await b(this.__internal__.time.response_engines + 10), this.__internal__.dispense.status === "no-response") ? (this.internalClearSensing(), this.__internal__.dispense.status = !1, this.dispatch("not-dispensed", { reason: "no-response" }), { status: !1, error: "no-response" }) : (this.__internal__.dispense.status = null, this.__internal__.dispense.dispensing = !0, this.dispatch("internal:dispense:running", {}), new Promise((n) => {
702
+ return this.__internal__.dispense.must_response && (await u(this.__internal__.time.response_engines + 10), this.__internal__.dispense.status === "no-response") ? (this.internalClearSensing(), this.__internal__.dispense.status = !1, this.dispatch("not-dispensed", { reason: "no-response" }), { status: !1, error: "no-response" }) : (this.__internal__.dispense.status = null, this.__internal__.dispense.dispensing = !0, this.dispatch("internal:dispense:running", {}), new Promise((n) => {
759
703
  this.__internal__.interval.waiting_sense = setInterval(() => {
760
704
  switch (this.__internal__.dispense.status) {
761
705
  case null:
@@ -782,11 +726,11 @@ class S extends u {
782
726
  if (this.__internal__.dispense.dispensing = !0, !e.enable && !this.__internal__.serial.connected && (await this.serialConnect(), !this.__internal__.serial.connected))
783
727
  throw this.__internal__.dispense.dispensing = !1, new Error("Serial device not connected");
784
728
  return this.__internal__.serial.queue.length === 0 ? (await this.appendToQueue(n, "dispense"), await this.internalDispenseStatus()) : new Promise((s) => {
785
- const t = setInterval(async () => {
729
+ const i = setInterval(async () => {
786
730
  if (this.__internal__.serial.queue.length > 0) return;
787
- clearInterval(t), await this.appendToQueue(n, "dispense");
788
- const i = await this.internalDispenseStatus();
789
- s(i);
731
+ clearInterval(i), await this.appendToQueue(n, "dispense");
732
+ const t = await this.internalDispenseStatus();
733
+ s(t);
790
734
  }, 100);
791
735
  });
792
736
  }
@@ -795,10 +739,10 @@ class S extends u {
795
739
  console.error("Invalid data to make an emulation");
796
740
  return;
797
741
  }
798
- this.__internal__.serial.connected || (this.__internal__.serial.connected = !0, this.dispatch("serial:connected"), r.instance.dispatch("change"), this.__internal__.interval.reconnection && (clearInterval(this.__internal__.interval.reconnection), this.__internal__.interval.reconnection = 0)), this.__internal__.timeout.until_response && (clearTimeout(this.__internal__.timeout.until_response), this.__internal__.timeout.until_response = 0);
742
+ this.__internal__.serial.connected || (this.__internal__.serial.connected = !0, this.dispatch("serial:connected"), o.instance.dispatch("change"), this.__internal__.interval.reconnection && (clearInterval(this.__internal__.interval.reconnection), this.__internal__.interval.reconnection = 0)), this.__internal__.timeout.until_response && (clearTimeout(this.__internal__.timeout.until_response), this.__internal__.timeout.until_response = 0);
799
743
  const s = [];
800
- for (const t in n.code)
801
- s.push(n.code[t].toString().padStart(2, "0").toLowerCase());
744
+ for (const i in n.code)
745
+ s.push(n.code[i].toString().padStart(2, "0").toLowerCase());
802
746
  this.serialMessage(s);
803
747
  }
804
748
  /**
@@ -819,13 +763,12 @@ class S extends u {
819
763
  }
820
764
  }
821
765
  export {
822
- r as D,
823
766
  e as E,
824
- S as K,
767
+ v as K,
825
768
  w as a,
826
- y as b,
769
+ g as b,
827
770
  M as g,
828
- D as i,
829
- k as s,
830
- b as w
771
+ y as i,
772
+ D as s,
773
+ u as w
831
774
  };
package/dist/kernel.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./kernel-g4zSg1Ll.cjs"),r="4.1.9";exports.Devices=e.Devices;exports.Kernel=e.Kernel;exports.version=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./kernel-As0xv_MS.cjs"),r=require("./devices-BndwHuvP.cjs"),i="4.1.9";exports.Kernel=e.Kernel;exports.Devices=r.Devices;exports.version=i;