nmea-web-serial 1.1.1 → 1.1.3
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/README.md +170 -23
- package/dist/nmea-web-serial.cjs +4 -4
- package/dist/nmea-web-serial.d.ts +141 -172
- package/dist/nmea-web-serial.iife.js +4 -4
- package/dist/nmea-web-serial.js +862 -937
- package/dist/nmea-web-serial.umd.cjs +4 -4
- package/package.json +4 -2
package/dist/nmea-web-serial.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function yn() {
|
|
2
2
|
if (typeof globalThis < "u")
|
|
3
3
|
return globalThis;
|
|
4
4
|
if (typeof self < "u")
|
|
@@ -8,18 +8,18 @@ function Tn() {
|
|
|
8
8
|
if (typeof global < "u")
|
|
9
9
|
return global;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
const e =
|
|
11
|
+
function Sn() {
|
|
12
|
+
const e = yn();
|
|
13
13
|
if (e.__xstate__)
|
|
14
14
|
return e.__xstate__;
|
|
15
15
|
}
|
|
16
|
-
const
|
|
16
|
+
const _n = (e) => {
|
|
17
17
|
if (typeof window > "u")
|
|
18
18
|
return;
|
|
19
|
-
const t =
|
|
19
|
+
const t = Sn();
|
|
20
20
|
t && t.register(e);
|
|
21
21
|
};
|
|
22
|
-
class
|
|
22
|
+
class dt {
|
|
23
23
|
constructor(t) {
|
|
24
24
|
this._process = t, this._active = !1, this._current = null, this._last = null;
|
|
25
25
|
}
|
|
@@ -48,35 +48,35 @@ class ft {
|
|
|
48
48
|
this._last = null;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
const
|
|
52
|
-
function
|
|
51
|
+
const zt = ".", bn = "", Jt = "", Tn = "#", In = "*", Zt = "xstate.init", wn = "xstate.error", we = "xstate.stop";
|
|
52
|
+
function Pn(e, t) {
|
|
53
53
|
return {
|
|
54
54
|
type: `xstate.after.${e}.${t}`
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function Ke(e, t) {
|
|
58
58
|
return {
|
|
59
59
|
type: `xstate.done.state.${e}`,
|
|
60
60
|
output: t
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function kn(e, t) {
|
|
64
64
|
return {
|
|
65
65
|
type: `xstate.done.actor.${e}`,
|
|
66
66
|
output: t,
|
|
67
67
|
actorId: e
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function Yt(e, t) {
|
|
71
71
|
return {
|
|
72
72
|
type: `xstate.error.actor.${e}`,
|
|
73
73
|
error: t,
|
|
74
74
|
actorId: e
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function Xt(e) {
|
|
78
78
|
return {
|
|
79
|
-
type:
|
|
79
|
+
type: Zt,
|
|
80
80
|
input: e
|
|
81
81
|
};
|
|
82
82
|
}
|
|
@@ -85,13 +85,13 @@ function j(e) {
|
|
|
85
85
|
throw e;
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
-
const
|
|
89
|
-
function
|
|
90
|
-
const n =
|
|
91
|
-
return typeof r == "string" ? typeof n == "string" ? r === n : !1 : typeof n == "string" ? n in r : Object.keys(n).every((i) => i in r ?
|
|
88
|
+
const Dn = typeof Symbol == "function" && Symbol.observable || "@@observable";
|
|
89
|
+
function Qt(e, t) {
|
|
90
|
+
const n = ft(e), r = ft(t);
|
|
91
|
+
return typeof r == "string" ? typeof n == "string" ? r === n : !1 : typeof n == "string" ? n in r : Object.keys(n).every((i) => i in r ? Qt(n[i], r[i]) : !1);
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
if (
|
|
93
|
+
function Qe(e) {
|
|
94
|
+
if (en(e))
|
|
95
95
|
return e;
|
|
96
96
|
const t = [];
|
|
97
97
|
let n = "";
|
|
@@ -110,15 +110,15 @@ function $e(e) {
|
|
|
110
110
|
}
|
|
111
111
|
return t.push(n), t;
|
|
112
112
|
}
|
|
113
|
-
function
|
|
114
|
-
if (
|
|
113
|
+
function ft(e) {
|
|
114
|
+
if (ir(e))
|
|
115
115
|
return e.value;
|
|
116
116
|
if (typeof e != "string")
|
|
117
117
|
return e;
|
|
118
|
-
const t =
|
|
119
|
-
return
|
|
118
|
+
const t = Qe(e);
|
|
119
|
+
return En(t);
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function En(e) {
|
|
122
122
|
if (e.length === 1)
|
|
123
123
|
return e[0];
|
|
124
124
|
const t = {};
|
|
@@ -132,7 +132,7 @@ function On(e) {
|
|
|
132
132
|
}
|
|
133
133
|
return t;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function lt(e, t) {
|
|
136
136
|
const n = {}, r = Object.keys(e);
|
|
137
137
|
for (let i = 0; i < r.length; i++) {
|
|
138
138
|
const o = r[i];
|
|
@@ -140,35 +140,35 @@ function ht(e, t) {
|
|
|
140
140
|
}
|
|
141
141
|
return n;
|
|
142
142
|
}
|
|
143
|
-
function
|
|
144
|
-
return
|
|
143
|
+
function $t(e) {
|
|
144
|
+
return en(e) ? e : [e];
|
|
145
145
|
}
|
|
146
|
-
function
|
|
147
|
-
return e === void 0 ? [] :
|
|
146
|
+
function x(e) {
|
|
147
|
+
return e === void 0 ? [] : $t(e);
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function ze(e, t, n, r) {
|
|
150
150
|
return typeof e == "function" ? e({
|
|
151
151
|
context: t,
|
|
152
152
|
event: n,
|
|
153
153
|
self: r
|
|
154
154
|
}) : e;
|
|
155
155
|
}
|
|
156
|
-
function
|
|
156
|
+
function en(e) {
|
|
157
157
|
return Array.isArray(e);
|
|
158
158
|
}
|
|
159
|
-
function
|
|
159
|
+
function An(e) {
|
|
160
160
|
return e.type.startsWith("xstate.error.actor");
|
|
161
161
|
}
|
|
162
162
|
function Z(e) {
|
|
163
|
-
return
|
|
163
|
+
return $t(e).map((t) => typeof t > "u" || typeof t == "string" ? {
|
|
164
164
|
target: t
|
|
165
165
|
} : t);
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
if (!(e === void 0 || e ===
|
|
169
|
-
return
|
|
167
|
+
function tn(e) {
|
|
168
|
+
if (!(e === void 0 || e === bn))
|
|
169
|
+
return x(e);
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function Je(e, t, n) {
|
|
172
172
|
const r = typeof e == "object", i = r ? e : void 0;
|
|
173
173
|
return {
|
|
174
174
|
next: (r ? e.next : e)?.bind(i),
|
|
@@ -176,48 +176,48 @@ function Ye(e, t, n) {
|
|
|
176
176
|
complete: (r ? e.complete : n)?.bind(i)
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function ht(e, t) {
|
|
180
180
|
return `${t}.${e}`;
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function $e(e, t) {
|
|
183
183
|
const n = t.match(/^xstate\.invoke\.(\d+)\.(.*)/);
|
|
184
184
|
if (!n)
|
|
185
185
|
return e.implementations.actors[t];
|
|
186
186
|
const [, r, i] = n, s = e.getStateNodeById(i).config.invoke;
|
|
187
187
|
return (Array.isArray(s) ? s[r] : s).src;
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function pt(e, t) {
|
|
190
190
|
return `${e.sessionId}.${t}`;
|
|
191
191
|
}
|
|
192
|
-
let
|
|
193
|
-
function
|
|
192
|
+
let Mn = 0;
|
|
193
|
+
function On(e, t) {
|
|
194
194
|
const n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new Set(), s = {}, {
|
|
195
195
|
clock: a,
|
|
196
196
|
logger: c
|
|
197
197
|
} = t, u = {
|
|
198
|
-
schedule: (d, p,
|
|
199
|
-
const
|
|
198
|
+
schedule: (d, p, g, y, I = Math.random().toString(36).slice(2)) => {
|
|
199
|
+
const C = {
|
|
200
200
|
source: d,
|
|
201
201
|
target: p,
|
|
202
|
-
event:
|
|
202
|
+
event: g,
|
|
203
203
|
delay: y,
|
|
204
204
|
id: I,
|
|
205
205
|
startedAt: Date.now()
|
|
206
|
-
},
|
|
207
|
-
l._snapshot._scheduledEvents[
|
|
208
|
-
const
|
|
209
|
-
delete s[
|
|
206
|
+
}, R = pt(d, I);
|
|
207
|
+
l._snapshot._scheduledEvents[R] = C;
|
|
208
|
+
const V = a.setTimeout(() => {
|
|
209
|
+
delete s[R], delete l._snapshot._scheduledEvents[R], l._relay(d, p, g);
|
|
210
210
|
}, y);
|
|
211
|
-
s[
|
|
211
|
+
s[R] = V;
|
|
212
212
|
},
|
|
213
213
|
cancel: (d, p) => {
|
|
214
|
-
const
|
|
215
|
-
delete s[
|
|
214
|
+
const g = pt(d, p), y = s[g];
|
|
215
|
+
delete s[g], delete l._snapshot._scheduledEvents[g], y !== void 0 && a.clearTimeout(y);
|
|
216
216
|
},
|
|
217
217
|
cancelAll: (d) => {
|
|
218
218
|
for (const p in l._snapshot._scheduledEvents) {
|
|
219
|
-
const
|
|
220
|
-
|
|
219
|
+
const g = l._snapshot._scheduledEvents[p];
|
|
220
|
+
g.source === d && u.cancel(d, g.id);
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
}, f = (d) => {
|
|
@@ -227,12 +227,12 @@ function Rn(e, t) {
|
|
|
227
227
|
...d,
|
|
228
228
|
rootId: e.sessionId
|
|
229
229
|
};
|
|
230
|
-
o.forEach((
|
|
230
|
+
o.forEach((g) => g.next?.(p));
|
|
231
231
|
}, l = {
|
|
232
232
|
_snapshot: {
|
|
233
233
|
_scheduledEvents: (t?.snapshot && t.snapshot.scheduler) ?? {}
|
|
234
234
|
},
|
|
235
|
-
_bookId: () => `x:${
|
|
235
|
+
_bookId: () => `x:${Mn++}`,
|
|
236
236
|
_register: (d, p) => (n.set(d, p), d),
|
|
237
237
|
_unregister: (d) => {
|
|
238
238
|
n.delete(d.sessionId);
|
|
@@ -242,13 +242,13 @@ function Rn(e, t) {
|
|
|
242
242
|
get: (d) => r.get(d),
|
|
243
243
|
getAll: () => Object.fromEntries(r.entries()),
|
|
244
244
|
_set: (d, p) => {
|
|
245
|
-
const
|
|
246
|
-
if (
|
|
245
|
+
const g = r.get(d);
|
|
246
|
+
if (g && g !== p)
|
|
247
247
|
throw new Error(`Actor with system ID '${d}' already exists.`);
|
|
248
248
|
r.set(d, p), i.set(p, d);
|
|
249
249
|
},
|
|
250
250
|
inspect: (d) => {
|
|
251
|
-
const p =
|
|
251
|
+
const p = Je(d);
|
|
252
252
|
return o.add(p), {
|
|
253
253
|
unsubscribe() {
|
|
254
254
|
o.delete(p);
|
|
@@ -256,13 +256,13 @@ function Rn(e, t) {
|
|
|
256
256
|
};
|
|
257
257
|
},
|
|
258
258
|
_sendInspectionEvent: f,
|
|
259
|
-
_relay: (d, p,
|
|
259
|
+
_relay: (d, p, g) => {
|
|
260
260
|
l._sendInspectionEvent({
|
|
261
261
|
type: "@xstate.event",
|
|
262
262
|
sourceRef: d,
|
|
263
263
|
actorRef: p,
|
|
264
|
-
event:
|
|
265
|
-
}), p._send(
|
|
264
|
+
event: g
|
|
265
|
+
}), p._send(g);
|
|
266
266
|
},
|
|
267
267
|
scheduler: u,
|
|
268
268
|
getSnapshot: () => ({
|
|
@@ -275,13 +275,13 @@ function Rn(e, t) {
|
|
|
275
275
|
l._snapshot._scheduledEvents = {};
|
|
276
276
|
for (const p in d) {
|
|
277
277
|
const {
|
|
278
|
-
source:
|
|
278
|
+
source: g,
|
|
279
279
|
target: y,
|
|
280
280
|
event: I,
|
|
281
|
-
delay:
|
|
282
|
-
id:
|
|
281
|
+
delay: C,
|
|
282
|
+
id: R
|
|
283
283
|
} = d[p];
|
|
284
|
-
u.schedule(
|
|
284
|
+
u.schedule(g, y, I, C, R);
|
|
285
285
|
}
|
|
286
286
|
},
|
|
287
287
|
_clock: a,
|
|
@@ -289,12 +289,12 @@ function Rn(e, t) {
|
|
|
289
289
|
};
|
|
290
290
|
return l;
|
|
291
291
|
}
|
|
292
|
-
let
|
|
293
|
-
const
|
|
292
|
+
let He = !1;
|
|
293
|
+
const et = 1;
|
|
294
294
|
let A = /* @__PURE__ */ (function(e) {
|
|
295
295
|
return e[e.NotStarted = 0] = "NotStarted", e[e.Running = 1] = "Running", e[e.Stopped = 2] = "Stopped", e;
|
|
296
296
|
})({});
|
|
297
|
-
const
|
|
297
|
+
const Fn = {
|
|
298
298
|
clock: {
|
|
299
299
|
setTimeout: (e, t) => setTimeout(e, t),
|
|
300
300
|
clearTimeout: (e) => clearTimeout(e)
|
|
@@ -302,7 +302,7 @@ const jn = {
|
|
|
302
302
|
logger: console.log.bind(console),
|
|
303
303
|
devTools: !1
|
|
304
304
|
};
|
|
305
|
-
class
|
|
305
|
+
class Cn {
|
|
306
306
|
/**
|
|
307
307
|
* Creates a new actor instance for the given logic with the provided options,
|
|
308
308
|
* if any.
|
|
@@ -311,9 +311,9 @@ class Gn {
|
|
|
311
311
|
* @param options Actor options
|
|
312
312
|
*/
|
|
313
313
|
constructor(t, n) {
|
|
314
|
-
this.logic = t, this._snapshot = void 0, this.clock = void 0, this.options = void 0, this.id = void 0, this.mailbox = new
|
|
314
|
+
this.logic = t, this._snapshot = void 0, this.clock = void 0, this.options = void 0, this.id = void 0, this.mailbox = new dt(this._process.bind(this)), this.observers = /* @__PURE__ */ new Set(), this.eventListeners = /* @__PURE__ */ new Map(), this.logger = void 0, this._processingStatus = A.NotStarted, this._parent = void 0, this._syncSnapshot = void 0, this.ref = void 0, this._actorScope = void 0, this.systemId = void 0, this.sessionId = void 0, this.system = void 0, this._doneEvent = void 0, this.src = void 0, this._deferred = [];
|
|
315
315
|
const r = {
|
|
316
|
-
...
|
|
316
|
+
...Fn,
|
|
317
317
|
...n
|
|
318
318
|
}, {
|
|
319
319
|
clock: i,
|
|
@@ -324,10 +324,10 @@ class Gn {
|
|
|
324
324
|
systemId: u,
|
|
325
325
|
inspect: f
|
|
326
326
|
} = r;
|
|
327
|
-
this.system = s ? s.system :
|
|
327
|
+
this.system = s ? s.system : On(this, {
|
|
328
328
|
clock: i,
|
|
329
329
|
logger: o
|
|
330
|
-
}), f && !s && this.system.inspect(
|
|
330
|
+
}), f && !s && this.system.inspect(Je(f)), this.sessionId = this.system._bookId(), this.id = c ?? this.sessionId, this.logger = n?.logger ?? this.system._logger, this.clock = n?.clock ?? this.system._clock, this._parent = s, this._syncSnapshot = a, this.options = r, this.src = r.src ?? t, this.ref = this, this._actorScope = {
|
|
331
331
|
self: this,
|
|
332
332
|
id: this.id,
|
|
333
333
|
sessionId: this.sessionId,
|
|
@@ -345,8 +345,8 @@ class Gn {
|
|
|
345
345
|
const d = this.eventListeners.get(l.type), p = this.eventListeners.get("*");
|
|
346
346
|
if (!d && !p)
|
|
347
347
|
return;
|
|
348
|
-
const
|
|
349
|
-
for (const y of
|
|
348
|
+
const g = [...d ? d.values() : [], ...p ? p.values() : []];
|
|
349
|
+
for (const y of g)
|
|
350
350
|
try {
|
|
351
351
|
y(l);
|
|
352
352
|
} catch (I) {
|
|
@@ -364,11 +364,11 @@ class Gn {
|
|
|
364
364
|
}
|
|
365
365
|
}), !l.exec)
|
|
366
366
|
return;
|
|
367
|
-
const p =
|
|
367
|
+
const p = He;
|
|
368
368
|
try {
|
|
369
|
-
|
|
369
|
+
He = !0, l.exec(l.info, l.params);
|
|
370
370
|
} finally {
|
|
371
|
-
|
|
371
|
+
He = p;
|
|
372
372
|
}
|
|
373
373
|
};
|
|
374
374
|
this._processingStatus === A.Running ? d() : this._deferred.push(d);
|
|
@@ -418,7 +418,7 @@ class Gn {
|
|
|
418
418
|
} catch (o) {
|
|
419
419
|
j(o);
|
|
420
420
|
}
|
|
421
|
-
this._stopProcedure(), this._complete(), this._doneEvent =
|
|
421
|
+
this._stopProcedure(), this._complete(), this._doneEvent = kn(this.id, this._snapshot.output), this._parent && this.system._relay(this, this._parent, this._doneEvent);
|
|
422
422
|
break;
|
|
423
423
|
case "error":
|
|
424
424
|
this._error(this._snapshot.error);
|
|
@@ -491,7 +491,7 @@ class Gn {
|
|
|
491
491
|
* the latest snapshot
|
|
492
492
|
*/
|
|
493
493
|
subscribe(t, n, r) {
|
|
494
|
-
const i =
|
|
494
|
+
const i = Je(t, n, r);
|
|
495
495
|
if (this._processingStatus !== A.Stopped)
|
|
496
496
|
this.observers.add(i);
|
|
497
497
|
else
|
|
@@ -546,7 +546,7 @@ class Gn {
|
|
|
546
546
|
error: () => {
|
|
547
547
|
}
|
|
548
548
|
}), this.system._register(this.sessionId, this), this.systemId && this.system._set(this.systemId, this), this._processingStatus = A.Running;
|
|
549
|
-
const t =
|
|
549
|
+
const t = Xt(this.options.input);
|
|
550
550
|
switch (this.system._sendInspectionEvent({
|
|
551
551
|
type: "@xstate.event",
|
|
552
552
|
sourceRef: this._parent,
|
|
@@ -590,11 +590,11 @@ class Gn {
|
|
|
590
590
|
}, this._error(i);
|
|
591
591
|
return;
|
|
592
592
|
}
|
|
593
|
-
this.update(n, t), t.type ===
|
|
593
|
+
this.update(n, t), t.type === we && (this._stopProcedure(), this._complete());
|
|
594
594
|
}
|
|
595
595
|
_stop() {
|
|
596
596
|
return this._processingStatus === A.Stopped ? this : (this.mailbox.clear(), this._processingStatus === A.NotStarted ? (this._processingStatus = A.Stopped, this) : (this.mailbox.enqueue({
|
|
597
|
-
type:
|
|
597
|
+
type: we
|
|
598
598
|
}), this));
|
|
599
599
|
}
|
|
600
600
|
/** Stops the Actor and unsubscribe all listeners. */
|
|
@@ -630,7 +630,7 @@ class Gn {
|
|
|
630
630
|
this.observers.clear(), n && j(t);
|
|
631
631
|
}
|
|
632
632
|
_error(t) {
|
|
633
|
-
this._stopProcedure(), this._reportError(t), this._parent && this.system._relay(this, this._parent,
|
|
633
|
+
this._stopProcedure(), this._reportError(t), this._parent && this.system._relay(this, this._parent, Yt(this.id, t));
|
|
634
634
|
}
|
|
635
635
|
// TODO: atm children don't belong entirely to the actor so
|
|
636
636
|
// in a way - it's not even super aware of them
|
|
@@ -638,7 +638,7 @@ class Gn {
|
|
|
638
638
|
// right now, they are being stopped within the machine's transition
|
|
639
639
|
// but that could throw and leave us with "orphaned" active actors
|
|
640
640
|
_stopProcedure() {
|
|
641
|
-
return this._processingStatus !== A.Running ? this : (this.system.scheduler.cancelAll(this), this.mailbox.clear(), this.mailbox = new
|
|
641
|
+
return this._processingStatus !== A.Running ? this : (this.system.scheduler.cancelAll(this), this.mailbox.clear(), this.mailbox = new dt(this._process.bind(this)), this._processingStatus = A.Stopped, this.system._unregister(this), this);
|
|
642
642
|
}
|
|
643
643
|
/** @internal */
|
|
644
644
|
_send(t) {
|
|
@@ -656,11 +656,11 @@ class Gn {
|
|
|
656
656
|
const {
|
|
657
657
|
devTools: t
|
|
658
658
|
} = this.options;
|
|
659
|
-
t && (typeof t == "function" ? t :
|
|
659
|
+
t && (typeof t == "function" ? t : _n)(this);
|
|
660
660
|
}
|
|
661
661
|
toJSON() {
|
|
662
662
|
return {
|
|
663
|
-
xstate$$type:
|
|
663
|
+
xstate$$type: et,
|
|
664
664
|
id: this.id
|
|
665
665
|
};
|
|
666
666
|
}
|
|
@@ -680,7 +680,7 @@ class Gn {
|
|
|
680
680
|
getPersistedSnapshot(t) {
|
|
681
681
|
return this.logic.getPersistedSnapshot(this._snapshot, t);
|
|
682
682
|
}
|
|
683
|
-
[
|
|
683
|
+
[Dn]() {
|
|
684
684
|
return this;
|
|
685
685
|
}
|
|
686
686
|
/**
|
|
@@ -701,10 +701,10 @@ class Gn {
|
|
|
701
701
|
return this._snapshot;
|
|
702
702
|
}
|
|
703
703
|
}
|
|
704
|
-
function
|
|
705
|
-
return new
|
|
704
|
+
function Pe(e, ...[t]) {
|
|
705
|
+
return new Cn(e, t);
|
|
706
706
|
}
|
|
707
|
-
function
|
|
707
|
+
function Rn(e, t, n, r, {
|
|
708
708
|
sendId: i
|
|
709
709
|
}) {
|
|
710
710
|
const o = typeof i == "function" ? i(n, r) : i;
|
|
@@ -712,37 +712,37 @@ function Ln(e, t, n, r, {
|
|
|
712
712
|
sendId: o
|
|
713
713
|
}, void 0];
|
|
714
714
|
}
|
|
715
|
-
function
|
|
715
|
+
function Nn(e, t) {
|
|
716
716
|
e.defer(() => {
|
|
717
717
|
e.system.scheduler.cancel(e.self, t.sendId);
|
|
718
718
|
});
|
|
719
719
|
}
|
|
720
|
-
function
|
|
720
|
+
function tt(e) {
|
|
721
721
|
function t(n, r) {
|
|
722
722
|
}
|
|
723
|
-
return t.type = "xstate.cancel", t.sendId = e, t.resolve =
|
|
723
|
+
return t.type = "xstate.cancel", t.sendId = e, t.resolve = Rn, t.execute = Nn, t;
|
|
724
724
|
}
|
|
725
|
-
function
|
|
725
|
+
function jn(e, t, n, r, {
|
|
726
726
|
id: i,
|
|
727
727
|
systemId: o,
|
|
728
728
|
src: s,
|
|
729
729
|
input: a,
|
|
730
730
|
syncSnapshot: c
|
|
731
731
|
}) {
|
|
732
|
-
const u = typeof s == "string" ?
|
|
732
|
+
const u = typeof s == "string" ? $e(t.machine, s) : s, f = typeof i == "function" ? i(n) : i;
|
|
733
733
|
let l, d;
|
|
734
734
|
return u && (d = typeof a == "function" ? a({
|
|
735
735
|
context: t.context,
|
|
736
736
|
event: n.event,
|
|
737
737
|
self: e.self
|
|
738
|
-
}) : a, l =
|
|
738
|
+
}) : a, l = Pe(u, {
|
|
739
739
|
id: f,
|
|
740
740
|
src: s,
|
|
741
741
|
parent: e.self,
|
|
742
742
|
syncSnapshot: c,
|
|
743
743
|
systemId: o,
|
|
744
744
|
input: d
|
|
745
|
-
})), [
|
|
745
|
+
})), [U(t, {
|
|
746
746
|
children: {
|
|
747
747
|
...t.children,
|
|
748
748
|
[f]: l
|
|
@@ -755,14 +755,14 @@ function qn(e, t, n, r, {
|
|
|
755
755
|
input: d
|
|
756
756
|
}, void 0];
|
|
757
757
|
}
|
|
758
|
-
function
|
|
758
|
+
function Gn(e, {
|
|
759
759
|
actorRef: t
|
|
760
760
|
}) {
|
|
761
761
|
t && e.defer(() => {
|
|
762
762
|
t._processingStatus !== A.Stopped && t.start();
|
|
763
763
|
});
|
|
764
764
|
}
|
|
765
|
-
function
|
|
765
|
+
function nt(...[e, {
|
|
766
766
|
id: t,
|
|
767
767
|
systemId: n,
|
|
768
768
|
input: r,
|
|
@@ -770,20 +770,20 @@ function rt(...[e, {
|
|
|
770
770
|
} = {}]) {
|
|
771
771
|
function o(s, a) {
|
|
772
772
|
}
|
|
773
|
-
return o.type = "xstate.spawnChild", o.id = t, o.systemId = n, o.src = e, o.input = r, o.syncSnapshot = i, o.resolve =
|
|
773
|
+
return o.type = "xstate.spawnChild", o.id = t, o.systemId = n, o.src = e, o.input = r, o.syncSnapshot = i, o.resolve = jn, o.execute = Gn, o;
|
|
774
774
|
}
|
|
775
|
-
function
|
|
775
|
+
function Ln(e, t, n, r, {
|
|
776
776
|
actorRef: i
|
|
777
777
|
}) {
|
|
778
778
|
const o = typeof i == "function" ? i(n, r) : i, s = typeof o == "string" ? t.children[o] : o;
|
|
779
779
|
let a = t.children;
|
|
780
780
|
return s && (a = {
|
|
781
781
|
...a
|
|
782
|
-
}, delete a[s.id]), [
|
|
782
|
+
}, delete a[s.id]), [U(t, {
|
|
783
783
|
children: a
|
|
784
784
|
}), s, void 0];
|
|
785
785
|
}
|
|
786
|
-
function
|
|
786
|
+
function xn(e, t) {
|
|
787
787
|
if (t) {
|
|
788
788
|
if (e.system._unregister(t), t._processingStatus !== A.Running) {
|
|
789
789
|
e.stopChild(t);
|
|
@@ -797,7 +797,7 @@ function Wn(e, t) {
|
|
|
797
797
|
function Ce(e) {
|
|
798
798
|
function t(n, r) {
|
|
799
799
|
}
|
|
800
|
-
return t.type = "xstate.stopChild", t.actorRef = e, t.resolve =
|
|
800
|
+
return t.type = "xstate.stopChild", t.actorRef = e, t.resolve = Ln, t.execute = xn, t;
|
|
801
801
|
}
|
|
802
802
|
function Re(e, t, n, r) {
|
|
803
803
|
const {
|
|
@@ -821,11 +821,11 @@ function Re(e, t, n, r) {
|
|
|
821
821
|
// this holds all params
|
|
822
822
|
) : s(a, c);
|
|
823
823
|
}
|
|
824
|
-
const
|
|
825
|
-
function
|
|
824
|
+
const rt = (e) => e.type === "atomic" || e.type === "final";
|
|
825
|
+
function X(e) {
|
|
826
826
|
return Object.values(e.states).filter((t) => t.type !== "history");
|
|
827
827
|
}
|
|
828
|
-
function
|
|
828
|
+
function ke(e, t) {
|
|
829
829
|
const n = [];
|
|
830
830
|
if (t === e)
|
|
831
831
|
return n;
|
|
@@ -834,15 +834,15 @@ function Pe(e, t) {
|
|
|
834
834
|
n.push(r), r = r.parent;
|
|
835
835
|
return n;
|
|
836
836
|
}
|
|
837
|
-
function
|
|
838
|
-
const t = new Set(e), n =
|
|
837
|
+
function Ae(e) {
|
|
838
|
+
const t = new Set(e), n = rn(t);
|
|
839
839
|
for (const r of t)
|
|
840
840
|
if (r.type === "compound" && (!n.get(r) || !n.get(r).length))
|
|
841
|
-
|
|
841
|
+
gt(r).forEach((i) => t.add(i));
|
|
842
842
|
else if (r.type === "parallel") {
|
|
843
|
-
for (const i of
|
|
843
|
+
for (const i of X(r))
|
|
844
844
|
if (i.type !== "history" && !t.has(i)) {
|
|
845
|
-
const o =
|
|
845
|
+
const o = gt(i);
|
|
846
846
|
for (const s of o)
|
|
847
847
|
t.add(s);
|
|
848
848
|
}
|
|
@@ -854,40 +854,40 @@ function Ee(e) {
|
|
|
854
854
|
}
|
|
855
855
|
return t;
|
|
856
856
|
}
|
|
857
|
-
function
|
|
857
|
+
function nn(e, t) {
|
|
858
858
|
const n = t.get(e);
|
|
859
859
|
if (!n)
|
|
860
860
|
return {};
|
|
861
861
|
if (e.type === "compound") {
|
|
862
862
|
const i = n[0];
|
|
863
863
|
if (i) {
|
|
864
|
-
if (
|
|
864
|
+
if (rt(i))
|
|
865
865
|
return i.key;
|
|
866
866
|
} else
|
|
867
867
|
return {};
|
|
868
868
|
}
|
|
869
869
|
const r = {};
|
|
870
870
|
for (const i of n)
|
|
871
|
-
r[i.key] =
|
|
871
|
+
r[i.key] = nn(i, t);
|
|
872
872
|
return r;
|
|
873
873
|
}
|
|
874
|
-
function
|
|
874
|
+
function rn(e) {
|
|
875
875
|
const t = /* @__PURE__ */ new Map();
|
|
876
876
|
for (const n of e)
|
|
877
877
|
t.has(n) || t.set(n, []), n.parent && (t.has(n.parent) || t.set(n.parent, []), t.get(n.parent).push(n));
|
|
878
878
|
return t;
|
|
879
879
|
}
|
|
880
|
-
function
|
|
881
|
-
const n =
|
|
882
|
-
return
|
|
880
|
+
function sn(e, t) {
|
|
881
|
+
const n = Ae(t);
|
|
882
|
+
return nn(e, rn(n));
|
|
883
883
|
}
|
|
884
|
-
function
|
|
885
|
-
return t.type === "compound" ?
|
|
884
|
+
function st(e, t) {
|
|
885
|
+
return t.type === "compound" ? X(t).some((n) => n.type === "final" && e.has(n)) : t.type === "parallel" ? X(t).every((n) => st(e, n)) : t.type === "final";
|
|
886
886
|
}
|
|
887
|
-
const
|
|
888
|
-
function
|
|
887
|
+
const Ne = (e) => e[0] === Tn;
|
|
888
|
+
function qn(e, t) {
|
|
889
889
|
return e.transitions.get(t) || [...e.transitions.keys()].filter((r) => {
|
|
890
|
-
if (r ===
|
|
890
|
+
if (r === In)
|
|
891
891
|
return !0;
|
|
892
892
|
if (!r.endsWith(".*"))
|
|
893
893
|
return !1;
|
|
@@ -902,22 +902,22 @@ function Bn(e, t) {
|
|
|
902
902
|
return !0;
|
|
903
903
|
}).sort((r, i) => i.length - r.length).flatMap((r) => e.transitions.get(r));
|
|
904
904
|
}
|
|
905
|
-
function
|
|
905
|
+
function Wn(e) {
|
|
906
906
|
const t = e.config.after;
|
|
907
907
|
if (!t)
|
|
908
908
|
return [];
|
|
909
909
|
const n = (i) => {
|
|
910
|
-
const o =
|
|
911
|
-
return e.entry.push(
|
|
910
|
+
const o = Pn(i, e.id), s = o.type;
|
|
911
|
+
return e.entry.push(at(o, {
|
|
912
912
|
id: s,
|
|
913
913
|
delay: i
|
|
914
|
-
})), e.exit.push(
|
|
914
|
+
})), e.exit.push(tt(s)), s;
|
|
915
915
|
};
|
|
916
916
|
return Object.keys(t).flatMap((i) => {
|
|
917
917
|
const o = t[i], s = typeof o == "string" ? {
|
|
918
918
|
target: o
|
|
919
919
|
} : o, a = Number.isNaN(+i) ? i : +i, c = n(a);
|
|
920
|
-
return
|
|
920
|
+
return x(s).map((u) => ({
|
|
921
921
|
...u,
|
|
922
922
|
event: c,
|
|
923
923
|
delay: a
|
|
@@ -927,15 +927,15 @@ function Vn(e) {
|
|
|
927
927
|
delay: o
|
|
928
928
|
} = i;
|
|
929
929
|
return {
|
|
930
|
-
...
|
|
930
|
+
...B(e, i.event, i),
|
|
931
931
|
delay: o
|
|
932
932
|
};
|
|
933
933
|
});
|
|
934
934
|
}
|
|
935
|
-
function
|
|
936
|
-
const r =
|
|
935
|
+
function B(e, t, n) {
|
|
936
|
+
const r = tn(n.target), i = n.reenter ?? !1, o = Un(e, r), s = {
|
|
937
937
|
...n,
|
|
938
|
-
actions:
|
|
938
|
+
actions: x(n.actions),
|
|
939
939
|
guard: n.guard,
|
|
940
940
|
target: o,
|
|
941
941
|
source: e,
|
|
@@ -949,31 +949,31 @@ function W(e, t, n) {
|
|
|
949
949
|
};
|
|
950
950
|
return s;
|
|
951
951
|
}
|
|
952
|
-
function
|
|
952
|
+
function Bn(e) {
|
|
953
953
|
const t = /* @__PURE__ */ new Map();
|
|
954
954
|
if (e.config.on)
|
|
955
955
|
for (const n of Object.keys(e.config.on)) {
|
|
956
|
-
if (n ===
|
|
956
|
+
if (n === Jt)
|
|
957
957
|
throw new Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');
|
|
958
958
|
const r = e.config.on[n];
|
|
959
|
-
t.set(n, Z(r).map((i) =>
|
|
959
|
+
t.set(n, Z(r).map((i) => B(e, n, i)));
|
|
960
960
|
}
|
|
961
961
|
if (e.config.onDone) {
|
|
962
962
|
const n = `xstate.done.state.${e.id}`;
|
|
963
|
-
t.set(n, Z(e.config.onDone).map((r) =>
|
|
963
|
+
t.set(n, Z(e.config.onDone).map((r) => B(e, n, r)));
|
|
964
964
|
}
|
|
965
965
|
for (const n of e.invoke) {
|
|
966
966
|
if (n.onDone) {
|
|
967
967
|
const r = `xstate.done.actor.${n.id}`;
|
|
968
|
-
t.set(r, Z(n.onDone).map((i) =>
|
|
968
|
+
t.set(r, Z(n.onDone).map((i) => B(e, r, i)));
|
|
969
969
|
}
|
|
970
970
|
if (n.onError) {
|
|
971
971
|
const r = `xstate.error.actor.${n.id}`;
|
|
972
|
-
t.set(r, Z(n.onError).map((i) =>
|
|
972
|
+
t.set(r, Z(n.onError).map((i) => B(e, r, i)));
|
|
973
973
|
}
|
|
974
974
|
if (n.onSnapshot) {
|
|
975
975
|
const r = `xstate.snapshot.${n.id}`;
|
|
976
|
-
t.set(r, Z(n.onSnapshot).map((i) =>
|
|
976
|
+
t.set(r, Z(n.onSnapshot).map((i) => B(e, r, i)));
|
|
977
977
|
}
|
|
978
978
|
}
|
|
979
979
|
for (const n of e.after) {
|
|
@@ -982,7 +982,7 @@ function Kn(e) {
|
|
|
982
982
|
}
|
|
983
983
|
return t;
|
|
984
984
|
}
|
|
985
|
-
function
|
|
985
|
+
function Hn(e, t) {
|
|
986
986
|
const n = typeof t == "string" ? e.states[t] : t ? e.states[t.target] : void 0;
|
|
987
987
|
if (!n && t)
|
|
988
988
|
throw new Error(
|
|
@@ -991,7 +991,7 @@ function zn(e, t) {
|
|
|
991
991
|
);
|
|
992
992
|
const r = {
|
|
993
993
|
source: e,
|
|
994
|
-
actions: !t || typeof t == "string" ? [] :
|
|
994
|
+
actions: !t || typeof t == "string" ? [] : x(t.actions),
|
|
995
995
|
eventType: null,
|
|
996
996
|
reenter: !1,
|
|
997
997
|
target: n ? [n] : [],
|
|
@@ -1003,20 +1003,20 @@ function zn(e, t) {
|
|
|
1003
1003
|
};
|
|
1004
1004
|
return r;
|
|
1005
1005
|
}
|
|
1006
|
-
function
|
|
1006
|
+
function Un(e, t) {
|
|
1007
1007
|
if (t !== void 0)
|
|
1008
1008
|
return t.map((n) => {
|
|
1009
1009
|
if (typeof n != "string")
|
|
1010
1010
|
return n;
|
|
1011
|
-
if (
|
|
1011
|
+
if (Ne(n))
|
|
1012
1012
|
return e.machine.getStateNodeById(n);
|
|
1013
|
-
const r = n[0] ===
|
|
1013
|
+
const r = n[0] === zt;
|
|
1014
1014
|
if (r && !e.parent)
|
|
1015
|
-
return
|
|
1015
|
+
return Me(e, n.slice(1));
|
|
1016
1016
|
const i = r ? e.key + n : n;
|
|
1017
1017
|
if (e.parent)
|
|
1018
1018
|
try {
|
|
1019
|
-
return
|
|
1019
|
+
return Me(e.parent, i);
|
|
1020
1020
|
} catch (o) {
|
|
1021
1021
|
throw new Error(`Invalid transition definition for state node '${e.id}':
|
|
1022
1022
|
${o.message}`);
|
|
@@ -1025,37 +1025,37 @@ ${o.message}`);
|
|
|
1025
1025
|
throw new Error(`Invalid target: "${n}" is not a valid target from the root node. Did you mean ".${n}"?`);
|
|
1026
1026
|
});
|
|
1027
1027
|
}
|
|
1028
|
-
function
|
|
1029
|
-
const t =
|
|
1028
|
+
function on(e) {
|
|
1029
|
+
const t = tn(e.config.target);
|
|
1030
1030
|
return t ? {
|
|
1031
|
-
target: t.map((n) => typeof n == "string" ?
|
|
1031
|
+
target: t.map((n) => typeof n == "string" ? Me(e.parent, n) : n)
|
|
1032
1032
|
} : e.parent.initial;
|
|
1033
1033
|
}
|
|
1034
|
-
function
|
|
1034
|
+
function H(e) {
|
|
1035
1035
|
return e.type === "history";
|
|
1036
1036
|
}
|
|
1037
|
-
function
|
|
1038
|
-
const t =
|
|
1037
|
+
function gt(e) {
|
|
1038
|
+
const t = an(e);
|
|
1039
1039
|
for (const n of t)
|
|
1040
|
-
for (const r of
|
|
1040
|
+
for (const r of ke(n, e))
|
|
1041
1041
|
t.add(r);
|
|
1042
1042
|
return t;
|
|
1043
1043
|
}
|
|
1044
|
-
function
|
|
1044
|
+
function an(e) {
|
|
1045
1045
|
const t = /* @__PURE__ */ new Set();
|
|
1046
1046
|
function n(r) {
|
|
1047
1047
|
if (!t.has(r)) {
|
|
1048
1048
|
if (t.add(r), r.type === "compound")
|
|
1049
1049
|
n(r.initial.target[0]);
|
|
1050
1050
|
else if (r.type === "parallel")
|
|
1051
|
-
for (const i of
|
|
1051
|
+
for (const i of X(r))
|
|
1052
1052
|
n(i);
|
|
1053
1053
|
}
|
|
1054
1054
|
}
|
|
1055
1055
|
return n(e), t;
|
|
1056
1056
|
}
|
|
1057
|
-
function
|
|
1058
|
-
if (
|
|
1057
|
+
function Q(e, t) {
|
|
1058
|
+
if (Ne(t))
|
|
1059
1059
|
return e.machine.getStateNodeById(t);
|
|
1060
1060
|
if (!e.states)
|
|
1061
1061
|
throw new Error(`Unable to retrieve child state '${t}' from '${e.id}'; no child states exist.`);
|
|
@@ -1064,19 +1064,19 @@ function $(e, t) {
|
|
|
1064
1064
|
throw new Error(`Child state '${t}' does not exist on '${e.id}'`);
|
|
1065
1065
|
return n;
|
|
1066
1066
|
}
|
|
1067
|
-
function
|
|
1068
|
-
if (typeof t == "string" &&
|
|
1067
|
+
function Me(e, t) {
|
|
1068
|
+
if (typeof t == "string" && Ne(t))
|
|
1069
1069
|
try {
|
|
1070
1070
|
return e.machine.getStateNodeById(t);
|
|
1071
1071
|
} catch {
|
|
1072
1072
|
}
|
|
1073
|
-
const n =
|
|
1073
|
+
const n = Qe(t).slice();
|
|
1074
1074
|
let r = e;
|
|
1075
1075
|
for (; n.length; ) {
|
|
1076
1076
|
const i = n.shift();
|
|
1077
1077
|
if (!i.length)
|
|
1078
1078
|
break;
|
|
1079
|
-
r =
|
|
1079
|
+
r = Q(r, i);
|
|
1080
1080
|
}
|
|
1081
1081
|
return r;
|
|
1082
1082
|
}
|
|
@@ -1087,47 +1087,47 @@ function Oe(e, t) {
|
|
|
1087
1087
|
throw new Error(`State '${t}' does not exist on '${e.id}'`);
|
|
1088
1088
|
return [e, i];
|
|
1089
1089
|
}
|
|
1090
|
-
const n = Object.keys(t), r = n.map((i) =>
|
|
1090
|
+
const n = Object.keys(t), r = n.map((i) => Q(e, i)).filter(Boolean);
|
|
1091
1091
|
return [e.machine.root, e].concat(r, n.reduce((i, o) => {
|
|
1092
|
-
const s =
|
|
1092
|
+
const s = Q(e, o);
|
|
1093
1093
|
if (!s)
|
|
1094
1094
|
return i;
|
|
1095
1095
|
const a = Oe(s, t[o]);
|
|
1096
1096
|
return i.concat(a);
|
|
1097
1097
|
}, []));
|
|
1098
1098
|
}
|
|
1099
|
-
function
|
|
1100
|
-
const o =
|
|
1099
|
+
function Vn(e, t, n, r) {
|
|
1100
|
+
const o = Q(e, t).next(n, r);
|
|
1101
1101
|
return !o || !o.length ? e.next(n, r) : o;
|
|
1102
1102
|
}
|
|
1103
|
-
function
|
|
1104
|
-
const i = Object.keys(t), o =
|
|
1103
|
+
function Kn(e, t, n, r) {
|
|
1104
|
+
const i = Object.keys(t), o = Q(e, i[0]), s = it(o, t[i[0]], n, r);
|
|
1105
1105
|
return !s || !s.length ? e.next(n, r) : s;
|
|
1106
1106
|
}
|
|
1107
|
-
function
|
|
1107
|
+
function zn(e, t, n, r) {
|
|
1108
1108
|
const i = [];
|
|
1109
1109
|
for (const o of Object.keys(t)) {
|
|
1110
1110
|
const s = t[o];
|
|
1111
1111
|
if (!s)
|
|
1112
1112
|
continue;
|
|
1113
|
-
const a =
|
|
1113
|
+
const a = Q(e, o), c = it(a, s, n, r);
|
|
1114
1114
|
c && i.push(...c);
|
|
1115
1115
|
}
|
|
1116
1116
|
return i.length ? i : e.next(n, r);
|
|
1117
1117
|
}
|
|
1118
|
-
function
|
|
1119
|
-
return typeof t == "string" ?
|
|
1118
|
+
function it(e, t, n, r) {
|
|
1119
|
+
return typeof t == "string" ? Vn(e, t, n, r) : Object.keys(t).length === 1 ? Kn(e, t, n, r) : zn(e, t, n, r);
|
|
1120
1120
|
}
|
|
1121
|
-
function
|
|
1121
|
+
function Jn(e) {
|
|
1122
1122
|
return Object.keys(e.states).map((t) => e.states[t]).filter((t) => t.type === "history");
|
|
1123
1123
|
}
|
|
1124
|
-
function
|
|
1124
|
+
function q(e, t) {
|
|
1125
1125
|
let n = e;
|
|
1126
1126
|
for (; n.parent && n.parent !== t; )
|
|
1127
1127
|
n = n.parent;
|
|
1128
1128
|
return n.parent === t;
|
|
1129
1129
|
}
|
|
1130
|
-
function
|
|
1130
|
+
function Zn(e, t) {
|
|
1131
1131
|
const n = new Set(e), r = new Set(t);
|
|
1132
1132
|
for (const i of n)
|
|
1133
1133
|
if (r.has(i))
|
|
@@ -1137,14 +1137,14 @@ function $n(e, t) {
|
|
|
1137
1137
|
return !0;
|
|
1138
1138
|
return !1;
|
|
1139
1139
|
}
|
|
1140
|
-
function
|
|
1140
|
+
function cn(e, t, n) {
|
|
1141
1141
|
const r = /* @__PURE__ */ new Set();
|
|
1142
1142
|
for (const i of e) {
|
|
1143
1143
|
let o = !1;
|
|
1144
1144
|
const s = /* @__PURE__ */ new Set();
|
|
1145
1145
|
for (const a of r)
|
|
1146
|
-
if (
|
|
1147
|
-
if (
|
|
1146
|
+
if (Zn(Ze([i], t, n), Ze([a], t, n)))
|
|
1147
|
+
if (q(i.source, a.source))
|
|
1148
1148
|
s.add(a);
|
|
1149
1149
|
else {
|
|
1150
1150
|
o = !0;
|
|
@@ -1158,35 +1158,35 @@ function dn(e, t, n) {
|
|
|
1158
1158
|
}
|
|
1159
1159
|
return Array.from(r);
|
|
1160
1160
|
}
|
|
1161
|
-
function
|
|
1161
|
+
function Yn(e) {
|
|
1162
1162
|
const [t, ...n] = e;
|
|
1163
|
-
for (const r of
|
|
1164
|
-
if (n.every((i) =>
|
|
1163
|
+
for (const r of ke(t, void 0))
|
|
1164
|
+
if (n.every((i) => q(i, r)))
|
|
1165
1165
|
return r;
|
|
1166
1166
|
}
|
|
1167
|
-
function
|
|
1167
|
+
function ot(e, t) {
|
|
1168
1168
|
if (!e.target)
|
|
1169
1169
|
return [];
|
|
1170
1170
|
const n = /* @__PURE__ */ new Set();
|
|
1171
1171
|
for (const r of e.target)
|
|
1172
|
-
if (
|
|
1172
|
+
if (H(r))
|
|
1173
1173
|
if (t[r.id])
|
|
1174
1174
|
for (const i of t[r.id])
|
|
1175
1175
|
n.add(i);
|
|
1176
1176
|
else
|
|
1177
|
-
for (const i of
|
|
1177
|
+
for (const i of ot(on(r), t))
|
|
1178
1178
|
n.add(i);
|
|
1179
1179
|
else
|
|
1180
1180
|
n.add(r);
|
|
1181
1181
|
return [...n];
|
|
1182
1182
|
}
|
|
1183
|
-
function
|
|
1184
|
-
const n =
|
|
1183
|
+
function un(e, t) {
|
|
1184
|
+
const n = ot(e, t);
|
|
1185
1185
|
if (!n)
|
|
1186
1186
|
return;
|
|
1187
|
-
if (!e.reenter && n.every((i) => i === e.source ||
|
|
1187
|
+
if (!e.reenter && n.every((i) => i === e.source || q(i, e.source)))
|
|
1188
1188
|
return e.source;
|
|
1189
|
-
const r =
|
|
1189
|
+
const r = Yn(n.concat(e.source));
|
|
1190
1190
|
if (r)
|
|
1191
1191
|
return r;
|
|
1192
1192
|
if (!e.reenter)
|
|
@@ -1196,14 +1196,14 @@ function Ze(e, t, n) {
|
|
|
1196
1196
|
const r = /* @__PURE__ */ new Set();
|
|
1197
1197
|
for (const i of e)
|
|
1198
1198
|
if (i.target?.length) {
|
|
1199
|
-
const o =
|
|
1199
|
+
const o = un(i, n);
|
|
1200
1200
|
i.reenter && i.source === o && r.add(o);
|
|
1201
1201
|
for (const s of t)
|
|
1202
|
-
|
|
1202
|
+
q(s, o) && r.add(s);
|
|
1203
1203
|
}
|
|
1204
1204
|
return [...r];
|
|
1205
1205
|
}
|
|
1206
|
-
function
|
|
1206
|
+
function Xn(e, t) {
|
|
1207
1207
|
if (e.length !== t.size)
|
|
1208
1208
|
return !1;
|
|
1209
1209
|
for (const n of e)
|
|
@@ -1211,18 +1211,18 @@ function tr(e, t) {
|
|
|
1211
1211
|
return !1;
|
|
1212
1212
|
return !0;
|
|
1213
1213
|
}
|
|
1214
|
-
function
|
|
1214
|
+
function Ye(e, t, n, r, i, o) {
|
|
1215
1215
|
if (!e.length)
|
|
1216
1216
|
return t;
|
|
1217
1217
|
const s = new Set(t._nodes);
|
|
1218
1218
|
let a = t.historyValue;
|
|
1219
|
-
const c =
|
|
1219
|
+
const c = cn(e, s, a);
|
|
1220
1220
|
let u = t;
|
|
1221
|
-
i || ([u, a] =
|
|
1221
|
+
i || ([u, a] = tr(u, r, n, c, s, a, o, n.actionExecutor)), u = $(u, r, n, c.flatMap((l) => l.actions), o, void 0), u = $n(u, r, n, c, s, o, a, i);
|
|
1222
1222
|
const f = [...s];
|
|
1223
|
-
u.status === "done" && (u =
|
|
1223
|
+
u.status === "done" && (u = $(u, r, n, f.sort((l, d) => d.order - l.order).flatMap((l) => l.exit), o, void 0));
|
|
1224
1224
|
try {
|
|
1225
|
-
return a === t.historyValue &&
|
|
1225
|
+
return a === t.historyValue && Xn(t._nodes, s) ? u : U(u, {
|
|
1226
1226
|
_nodes: f,
|
|
1227
1227
|
historyValue: a
|
|
1228
1228
|
});
|
|
@@ -1230,112 +1230,112 @@ function Xe(e, t, n, r, i, o) {
|
|
|
1230
1230
|
throw l;
|
|
1231
1231
|
}
|
|
1232
1232
|
}
|
|
1233
|
-
function
|
|
1233
|
+
function Qn(e, t, n, r, i) {
|
|
1234
1234
|
if (r.output === void 0)
|
|
1235
1235
|
return;
|
|
1236
|
-
const o =
|
|
1237
|
-
return
|
|
1236
|
+
const o = Ke(i.id, i.output !== void 0 && i.parent ? ze(i.output, e.context, t, n.self) : void 0);
|
|
1237
|
+
return ze(r.output, e.context, o, n.self);
|
|
1238
1238
|
}
|
|
1239
|
-
function
|
|
1239
|
+
function $n(e, t, n, r, i, o, s, a) {
|
|
1240
1240
|
let c = e;
|
|
1241
1241
|
const u = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Set();
|
|
1242
|
-
|
|
1242
|
+
er(r, s, f, u), a && f.add(e.machine.root);
|
|
1243
1243
|
const l = /* @__PURE__ */ new Set();
|
|
1244
|
-
for (const d of [...u].sort((p,
|
|
1244
|
+
for (const d of [...u].sort((p, g) => p.order - g.order)) {
|
|
1245
1245
|
i.add(d);
|
|
1246
1246
|
const p = [];
|
|
1247
1247
|
p.push(...d.entry);
|
|
1248
|
-
for (const
|
|
1249
|
-
p.push(
|
|
1250
|
-
...
|
|
1251
|
-
syncSnapshot: !!
|
|
1248
|
+
for (const g of d.invoke)
|
|
1249
|
+
p.push(nt(g.src, {
|
|
1250
|
+
...g,
|
|
1251
|
+
syncSnapshot: !!g.onSnapshot
|
|
1252
1252
|
}));
|
|
1253
1253
|
if (f.has(d)) {
|
|
1254
|
-
const
|
|
1255
|
-
p.push(...
|
|
1256
|
-
}
|
|
1257
|
-
if (c =
|
|
1258
|
-
const
|
|
1259
|
-
let y =
|
|
1260
|
-
for (
|
|
1261
|
-
l.add(y), o.push(
|
|
1254
|
+
const g = d.initial.actions;
|
|
1255
|
+
p.push(...g);
|
|
1256
|
+
}
|
|
1257
|
+
if (c = $(c, t, n, p, o, d.invoke.map((g) => g.id)), d.type === "final") {
|
|
1258
|
+
const g = d.parent;
|
|
1259
|
+
let y = g?.type === "parallel" ? g : g?.parent, I = y || d;
|
|
1260
|
+
for (g?.type === "compound" && o.push(Ke(g.id, d.output !== void 0 ? ze(d.output, c.context, t, n.self) : void 0)); y?.type === "parallel" && !l.has(y) && st(i, y); )
|
|
1261
|
+
l.add(y), o.push(Ke(y.id)), I = y, y = y.parent;
|
|
1262
1262
|
if (y)
|
|
1263
1263
|
continue;
|
|
1264
|
-
c =
|
|
1264
|
+
c = U(c, {
|
|
1265
1265
|
status: "done",
|
|
1266
|
-
output:
|
|
1266
|
+
output: Qn(c, t, n, c.machine.root, I)
|
|
1267
1267
|
});
|
|
1268
1268
|
}
|
|
1269
1269
|
}
|
|
1270
1270
|
return c;
|
|
1271
1271
|
}
|
|
1272
|
-
function
|
|
1272
|
+
function er(e, t, n, r) {
|
|
1273
1273
|
for (const i of e) {
|
|
1274
|
-
const o =
|
|
1274
|
+
const o = un(i, t);
|
|
1275
1275
|
for (const a of i.target || [])
|
|
1276
|
-
!
|
|
1276
|
+
!H(a) && // if the target is different than the source then it will *definitely* be entered
|
|
1277
1277
|
(i.source !== a || // we know that the domain can't lie within the source
|
|
1278
1278
|
// if it's different than the source then it's outside of it and it means that the target has to be entered as well
|
|
1279
1279
|
i.source !== o || // reentering transitions always enter the target, even if it's the source itself
|
|
1280
|
-
i.reenter) && (r.add(a), n.add(a)),
|
|
1281
|
-
const s =
|
|
1280
|
+
i.reenter) && (r.add(a), n.add(a)), Y(a, t, n, r);
|
|
1281
|
+
const s = ot(i, t);
|
|
1282
1282
|
for (const a of s) {
|
|
1283
|
-
const c =
|
|
1284
|
-
o?.type === "parallel" && c.push(o),
|
|
1283
|
+
const c = ke(a, o);
|
|
1284
|
+
o?.type === "parallel" && c.push(o), dn(r, t, n, c, !i.source.parent && i.reenter ? void 0 : o);
|
|
1285
1285
|
}
|
|
1286
1286
|
}
|
|
1287
1287
|
}
|
|
1288
|
-
function
|
|
1289
|
-
if (
|
|
1288
|
+
function Y(e, t, n, r) {
|
|
1289
|
+
if (H(e))
|
|
1290
1290
|
if (t[e.id]) {
|
|
1291
1291
|
const i = t[e.id];
|
|
1292
1292
|
for (const o of i)
|
|
1293
|
-
r.add(o),
|
|
1293
|
+
r.add(o), Y(o, t, n, r);
|
|
1294
1294
|
for (const o of i)
|
|
1295
|
-
|
|
1295
|
+
Ue(o, e.parent, r, t, n);
|
|
1296
1296
|
} else {
|
|
1297
|
-
const i =
|
|
1297
|
+
const i = on(e);
|
|
1298
1298
|
for (const o of i.target)
|
|
1299
|
-
r.add(o), i === e.parent?.initial && n.add(e.parent),
|
|
1299
|
+
r.add(o), i === e.parent?.initial && n.add(e.parent), Y(o, t, n, r);
|
|
1300
1300
|
for (const o of i.target)
|
|
1301
|
-
|
|
1301
|
+
Ue(o, e.parent, r, t, n);
|
|
1302
1302
|
}
|
|
1303
1303
|
else if (e.type === "compound") {
|
|
1304
1304
|
const [i] = e.initial.target;
|
|
1305
|
-
|
|
1305
|
+
H(i) || (r.add(i), n.add(i)), Y(i, t, n, r), Ue(i, e, r, t, n);
|
|
1306
1306
|
} else if (e.type === "parallel")
|
|
1307
|
-
for (const i of
|
|
1308
|
-
[...r].some((o) =>
|
|
1307
|
+
for (const i of X(e).filter((o) => !H(o)))
|
|
1308
|
+
[...r].some((o) => q(o, i)) || (H(i) || (r.add(i), n.add(i)), Y(i, t, n, r));
|
|
1309
1309
|
}
|
|
1310
|
-
function
|
|
1310
|
+
function dn(e, t, n, r, i) {
|
|
1311
1311
|
for (const o of r)
|
|
1312
|
-
if ((!i ||
|
|
1313
|
-
for (const s of
|
|
1314
|
-
[...e].some((a) =>
|
|
1312
|
+
if ((!i || q(o, i)) && e.add(o), o.type === "parallel")
|
|
1313
|
+
for (const s of X(o).filter((a) => !H(a)))
|
|
1314
|
+
[...e].some((a) => q(a, s)) || (e.add(s), Y(s, t, n, e));
|
|
1315
1315
|
}
|
|
1316
|
-
function
|
|
1317
|
-
|
|
1316
|
+
function Ue(e, t, n, r, i) {
|
|
1317
|
+
dn(n, r, i, ke(e, t));
|
|
1318
1318
|
}
|
|
1319
|
-
function
|
|
1319
|
+
function tr(e, t, n, r, i, o, s, a) {
|
|
1320
1320
|
let c = e;
|
|
1321
1321
|
const u = Ze(r, i, o);
|
|
1322
1322
|
u.sort((l, d) => d.order - l.order);
|
|
1323
1323
|
let f;
|
|
1324
1324
|
for (const l of u)
|
|
1325
|
-
for (const d of
|
|
1325
|
+
for (const d of Jn(l)) {
|
|
1326
1326
|
let p;
|
|
1327
|
-
d.history === "deep" ? p = (
|
|
1327
|
+
d.history === "deep" ? p = (g) => rt(g) && q(g, l) : p = (g) => g.parent === l, f ??= {
|
|
1328
1328
|
...o
|
|
1329
1329
|
}, f[d.id] = Array.from(i).filter(p);
|
|
1330
1330
|
}
|
|
1331
1331
|
for (const l of u)
|
|
1332
|
-
c =
|
|
1332
|
+
c = $(c, t, n, [...l.exit, ...l.invoke.map((d) => Ce(d.id))], s, void 0), i.delete(l);
|
|
1333
1333
|
return [c, f || o];
|
|
1334
1334
|
}
|
|
1335
|
-
function
|
|
1335
|
+
function nr(e, t) {
|
|
1336
1336
|
return e.implementations.actions[t];
|
|
1337
1337
|
}
|
|
1338
|
-
function
|
|
1338
|
+
function fn(e, t, n, r, i, o) {
|
|
1339
1339
|
const {
|
|
1340
1340
|
machine: s
|
|
1341
1341
|
} = e;
|
|
@@ -1345,7 +1345,7 @@ function hn(e, t, n, r, i, o) {
|
|
|
1345
1345
|
// the existing type of `.actions` assumes non-nullable `TExpressionAction`
|
|
1346
1346
|
// it's fine to cast this here to get a common type and lack of errors in the rest of the code
|
|
1347
1347
|
// our logic below makes sure that we call those 2 "variants" correctly
|
|
1348
|
-
|
|
1348
|
+
nr(s, typeof c == "string" ? c : c.type)
|
|
1349
1349
|
), l = {
|
|
1350
1350
|
context: a.context,
|
|
1351
1351
|
event: t,
|
|
@@ -1364,7 +1364,7 @@ function hn(e, t, n, r, i, o) {
|
|
|
1364
1364
|
});
|
|
1365
1365
|
continue;
|
|
1366
1366
|
}
|
|
1367
|
-
const p = f, [
|
|
1367
|
+
const p = f, [g, y, I] = p.resolve(
|
|
1368
1368
|
n,
|
|
1369
1369
|
a,
|
|
1370
1370
|
l,
|
|
@@ -1373,17 +1373,17 @@ function hn(e, t, n, r, i, o) {
|
|
|
1373
1373
|
// this holds all params
|
|
1374
1374
|
i
|
|
1375
1375
|
);
|
|
1376
|
-
a =
|
|
1376
|
+
a = g, "retryResolve" in p && o?.push([p, y]), "execute" in p && n.actionExecutor({
|
|
1377
1377
|
type: p.type,
|
|
1378
1378
|
info: l,
|
|
1379
1379
|
params: y,
|
|
1380
1380
|
exec: p.execute.bind(null, n, y)
|
|
1381
|
-
}), I && (a =
|
|
1381
|
+
}), I && (a = fn(a, t, n, I, i, o));
|
|
1382
1382
|
}
|
|
1383
1383
|
return a;
|
|
1384
1384
|
}
|
|
1385
|
-
function
|
|
1386
|
-
const s = o ? [] : void 0, a =
|
|
1385
|
+
function $(e, t, n, r, i, o) {
|
|
1386
|
+
const s = o ? [] : void 0, a = fn(e, t, n, r, {
|
|
1387
1387
|
internalQueue: i,
|
|
1388
1388
|
deferredActorIds: o
|
|
1389
1389
|
}, s);
|
|
@@ -1391,7 +1391,7 @@ function ee(e, t, n, r, i, o) {
|
|
|
1391
1391
|
c.retryResolve(n, a, u);
|
|
1392
1392
|
}), a;
|
|
1393
1393
|
}
|
|
1394
|
-
function
|
|
1394
|
+
function Ve(e, t, n, r) {
|
|
1395
1395
|
let i = e;
|
|
1396
1396
|
const o = [];
|
|
1397
1397
|
function s(u, f, l) {
|
|
@@ -1403,25 +1403,25 @@ function Ke(e, t, n, r) {
|
|
|
1403
1403
|
_transitions: l
|
|
1404
1404
|
}), o.push(u);
|
|
1405
1405
|
}
|
|
1406
|
-
if (t.type ===
|
|
1407
|
-
return i =
|
|
1406
|
+
if (t.type === we)
|
|
1407
|
+
return i = U(vt(i, t, n), {
|
|
1408
1408
|
status: "stopped"
|
|
1409
1409
|
}), s(i, t, []), {
|
|
1410
1410
|
snapshot: i,
|
|
1411
1411
|
microstates: o
|
|
1412
1412
|
};
|
|
1413
1413
|
let a = t;
|
|
1414
|
-
if (a.type !==
|
|
1415
|
-
const u = a, f =
|
|
1414
|
+
if (a.type !== Zt) {
|
|
1415
|
+
const u = a, f = An(u), l = mt(u, i);
|
|
1416
1416
|
if (f && !l.length)
|
|
1417
|
-
return i =
|
|
1417
|
+
return i = U(e, {
|
|
1418
1418
|
status: "error",
|
|
1419
1419
|
error: u.error
|
|
1420
1420
|
}), s(i, u, []), {
|
|
1421
1421
|
snapshot: i,
|
|
1422
1422
|
microstates: o
|
|
1423
1423
|
};
|
|
1424
|
-
i =
|
|
1424
|
+
i = Ye(
|
|
1425
1425
|
l,
|
|
1426
1426
|
e,
|
|
1427
1427
|
n,
|
|
@@ -1433,30 +1433,30 @@ function Ke(e, t, n, r) {
|
|
|
1433
1433
|
}
|
|
1434
1434
|
let c = !0;
|
|
1435
1435
|
for (; i.status === "active"; ) {
|
|
1436
|
-
let u = c ?
|
|
1436
|
+
let u = c ? rr(i, a) : [];
|
|
1437
1437
|
const f = u.length ? i : void 0;
|
|
1438
1438
|
if (!u.length) {
|
|
1439
1439
|
if (!r.length)
|
|
1440
1440
|
break;
|
|
1441
|
-
a = r.shift(), u =
|
|
1441
|
+
a = r.shift(), u = mt(a, i);
|
|
1442
1442
|
}
|
|
1443
|
-
i =
|
|
1443
|
+
i = Ye(u, i, n, a, !1, r), c = i !== f, s(i, a, u);
|
|
1444
1444
|
}
|
|
1445
|
-
return i.status !== "active" &&
|
|
1445
|
+
return i.status !== "active" && vt(i, a, n), {
|
|
1446
1446
|
snapshot: i,
|
|
1447
1447
|
microstates: o
|
|
1448
1448
|
};
|
|
1449
1449
|
}
|
|
1450
|
-
function
|
|
1451
|
-
return
|
|
1450
|
+
function vt(e, t, n) {
|
|
1451
|
+
return $(e, t, n, Object.values(e.children).map((r) => Ce(r)), [], void 0);
|
|
1452
1452
|
}
|
|
1453
|
-
function
|
|
1453
|
+
function mt(e, t) {
|
|
1454
1454
|
return t.machine.getTransitionData(t, e);
|
|
1455
1455
|
}
|
|
1456
|
-
function
|
|
1457
|
-
const n = /* @__PURE__ */ new Set(), r = e._nodes.filter(
|
|
1456
|
+
function rr(e, t) {
|
|
1457
|
+
const n = /* @__PURE__ */ new Set(), r = e._nodes.filter(rt);
|
|
1458
1458
|
for (const i of r)
|
|
1459
|
-
e: for (const o of [i].concat(
|
|
1459
|
+
e: for (const o of [i].concat(ke(i, void 0)))
|
|
1460
1460
|
if (o.always) {
|
|
1461
1461
|
for (const s of o.always)
|
|
1462
1462
|
if (s.guard === void 0 || Re(s.guard, e.context, t, e)) {
|
|
@@ -1464,24 +1464,24 @@ function ar(e, t) {
|
|
|
1464
1464
|
break e;
|
|
1465
1465
|
}
|
|
1466
1466
|
}
|
|
1467
|
-
return
|
|
1467
|
+
return cn(Array.from(n), new Set(e._nodes), e.historyValue);
|
|
1468
1468
|
}
|
|
1469
|
-
function
|
|
1470
|
-
const n =
|
|
1471
|
-
return
|
|
1469
|
+
function sr(e, t) {
|
|
1470
|
+
const n = Ae(Oe(e, t));
|
|
1471
|
+
return sn(e, [...n]);
|
|
1472
1472
|
}
|
|
1473
|
-
function
|
|
1473
|
+
function ir(e) {
|
|
1474
1474
|
return !!e && typeof e == "object" && "machine" in e && "value" in e;
|
|
1475
1475
|
}
|
|
1476
|
-
const
|
|
1477
|
-
return
|
|
1478
|
-
},
|
|
1476
|
+
const or = function(t) {
|
|
1477
|
+
return Qt(t, this.value);
|
|
1478
|
+
}, ar = function(t) {
|
|
1479
1479
|
return this.tags.has(t);
|
|
1480
|
-
},
|
|
1480
|
+
}, cr = function(t) {
|
|
1481
1481
|
const n = this.machine.getTransitionData(this, t);
|
|
1482
1482
|
return !!n?.length && // Check that at least one transition is not forbidden
|
|
1483
1483
|
n.some((r) => r.target !== void 0 || r.actions.length);
|
|
1484
|
-
},
|
|
1484
|
+
}, ur = function() {
|
|
1485
1485
|
const {
|
|
1486
1486
|
_nodes: t,
|
|
1487
1487
|
tags: n,
|
|
@@ -1497,10 +1497,10 @@ const dr = function(t) {
|
|
|
1497
1497
|
...u,
|
|
1498
1498
|
tags: Array.from(n)
|
|
1499
1499
|
};
|
|
1500
|
-
},
|
|
1500
|
+
}, dr = function() {
|
|
1501
1501
|
return this._nodes.reduce((t, n) => (n.meta !== void 0 && (t[n.id] = n.meta), t), {});
|
|
1502
1502
|
};
|
|
1503
|
-
function
|
|
1503
|
+
function Ee(e, t) {
|
|
1504
1504
|
return {
|
|
1505
1505
|
status: e.status,
|
|
1506
1506
|
output: e.output,
|
|
@@ -1508,24 +1508,24 @@ function Me(e, t) {
|
|
|
1508
1508
|
machine: t,
|
|
1509
1509
|
context: e.context,
|
|
1510
1510
|
_nodes: e._nodes,
|
|
1511
|
-
value:
|
|
1511
|
+
value: sn(t.root, e._nodes),
|
|
1512
1512
|
tags: new Set(e._nodes.flatMap((n) => n.tags)),
|
|
1513
1513
|
children: e.children,
|
|
1514
1514
|
historyValue: e.historyValue || {},
|
|
1515
|
-
matches:
|
|
1516
|
-
hasTag:
|
|
1517
|
-
can:
|
|
1518
|
-
getMeta:
|
|
1519
|
-
toJSON:
|
|
1515
|
+
matches: or,
|
|
1516
|
+
hasTag: ar,
|
|
1517
|
+
can: cr,
|
|
1518
|
+
getMeta: dr,
|
|
1519
|
+
toJSON: ur
|
|
1520
1520
|
};
|
|
1521
1521
|
}
|
|
1522
|
-
function
|
|
1523
|
-
return
|
|
1522
|
+
function U(e, t = {}) {
|
|
1523
|
+
return Ee({
|
|
1524
1524
|
...e,
|
|
1525
1525
|
...t
|
|
1526
1526
|
}, e.machine);
|
|
1527
1527
|
}
|
|
1528
|
-
function
|
|
1528
|
+
function fr(e) {
|
|
1529
1529
|
if (typeof e != "object" || e === null)
|
|
1530
1530
|
return {};
|
|
1531
1531
|
const t = {};
|
|
@@ -1537,7 +1537,7 @@ function vr(e) {
|
|
|
1537
1537
|
}
|
|
1538
1538
|
return t;
|
|
1539
1539
|
}
|
|
1540
|
-
function
|
|
1540
|
+
function lr(e, t) {
|
|
1541
1541
|
const {
|
|
1542
1542
|
_nodes: n,
|
|
1543
1543
|
tags: r,
|
|
@@ -1562,12 +1562,12 @@ function mr(e, t) {
|
|
|
1562
1562
|
}
|
|
1563
1563
|
return {
|
|
1564
1564
|
...d,
|
|
1565
|
-
context:
|
|
1565
|
+
context: ln(s),
|
|
1566
1566
|
children: p,
|
|
1567
|
-
historyValue:
|
|
1567
|
+
historyValue: fr(d.historyValue)
|
|
1568
1568
|
};
|
|
1569
1569
|
}
|
|
1570
|
-
function
|
|
1570
|
+
function ln(e) {
|
|
1571
1571
|
let t;
|
|
1572
1572
|
for (const n in e) {
|
|
1573
1573
|
const r = e[n];
|
|
@@ -1576,11 +1576,11 @@ function pn(e) {
|
|
|
1576
1576
|
t ??= Array.isArray(e) ? e.slice() : {
|
|
1577
1577
|
...e
|
|
1578
1578
|
}, t[n] = {
|
|
1579
|
-
xstate$$type:
|
|
1579
|
+
xstate$$type: et,
|
|
1580
1580
|
id: r.id
|
|
1581
1581
|
};
|
|
1582
1582
|
else {
|
|
1583
|
-
const i =
|
|
1583
|
+
const i = ln(r);
|
|
1584
1584
|
i !== r && (t ??= Array.isArray(e) ? e.slice() : {
|
|
1585
1585
|
...e
|
|
1586
1586
|
}, t[n] = i);
|
|
@@ -1588,7 +1588,7 @@ function pn(e) {
|
|
|
1588
1588
|
}
|
|
1589
1589
|
return t ?? e;
|
|
1590
1590
|
}
|
|
1591
|
-
function
|
|
1591
|
+
function hr(e, t, n, r, {
|
|
1592
1592
|
event: i,
|
|
1593
1593
|
id: o,
|
|
1594
1594
|
delay: s
|
|
@@ -1614,7 +1614,7 @@ function gr(e, t, n, r, {
|
|
|
1614
1614
|
delay: f
|
|
1615
1615
|
}, void 0];
|
|
1616
1616
|
}
|
|
1617
|
-
function
|
|
1617
|
+
function pr(e, t) {
|
|
1618
1618
|
const {
|
|
1619
1619
|
event: n,
|
|
1620
1620
|
delay: r,
|
|
@@ -1628,13 +1628,13 @@ function yr(e, t) {
|
|
|
1628
1628
|
return;
|
|
1629
1629
|
}
|
|
1630
1630
|
}
|
|
1631
|
-
function
|
|
1631
|
+
function at(e, t) {
|
|
1632
1632
|
function n(r, i) {
|
|
1633
1633
|
}
|
|
1634
|
-
return n.type = "xstate.raise", n.event = e, n.id = t?.id, n.delay = t?.delay, n.resolve =
|
|
1634
|
+
return n.type = "xstate.raise", n.event = e, n.id = t?.id, n.delay = t?.delay, n.resolve = hr, n.execute = pr, n;
|
|
1635
1635
|
}
|
|
1636
|
-
const
|
|
1637
|
-
function
|
|
1636
|
+
const yt = /* @__PURE__ */ new WeakMap();
|
|
1637
|
+
function gr(e) {
|
|
1638
1638
|
return {
|
|
1639
1639
|
config: e,
|
|
1640
1640
|
start: (n, r) => {
|
|
@@ -1646,7 +1646,7 @@ function Sr(e) {
|
|
|
1646
1646
|
receivers: void 0,
|
|
1647
1647
|
dispose: void 0
|
|
1648
1648
|
};
|
|
1649
|
-
|
|
1649
|
+
yt.set(i, a), a.dispose = e({
|
|
1650
1650
|
input: n.input,
|
|
1651
1651
|
system: o,
|
|
1652
1652
|
self: i,
|
|
@@ -1660,8 +1660,8 @@ function Sr(e) {
|
|
|
1660
1660
|
});
|
|
1661
1661
|
},
|
|
1662
1662
|
transition: (n, r, i) => {
|
|
1663
|
-
const o =
|
|
1664
|
-
return r.type ===
|
|
1663
|
+
const o = yt.get(i.self);
|
|
1664
|
+
return r.type === we ? (n = {
|
|
1665
1665
|
...n,
|
|
1666
1666
|
status: "stopped",
|
|
1667
1667
|
error: void 0
|
|
@@ -1677,15 +1677,15 @@ function Sr(e) {
|
|
|
1677
1677
|
restoreSnapshot: (n) => n
|
|
1678
1678
|
};
|
|
1679
1679
|
}
|
|
1680
|
-
const
|
|
1681
|
-
function
|
|
1680
|
+
const St = "xstate.promise.resolve", _t = "xstate.promise.reject", De = /* @__PURE__ */ new WeakMap();
|
|
1681
|
+
function hn(e) {
|
|
1682
1682
|
return {
|
|
1683
1683
|
config: e,
|
|
1684
1684
|
transition: (n, r, i) => {
|
|
1685
1685
|
if (n.status !== "active")
|
|
1686
1686
|
return n;
|
|
1687
1687
|
switch (r.type) {
|
|
1688
|
-
case
|
|
1688
|
+
case St: {
|
|
1689
1689
|
const o = r.data;
|
|
1690
1690
|
return {
|
|
1691
1691
|
...n,
|
|
@@ -1694,14 +1694,14 @@ function vn(e) {
|
|
|
1694
1694
|
input: void 0
|
|
1695
1695
|
};
|
|
1696
1696
|
}
|
|
1697
|
-
case
|
|
1697
|
+
case _t:
|
|
1698
1698
|
return {
|
|
1699
1699
|
...n,
|
|
1700
1700
|
status: "error",
|
|
1701
1701
|
error: r.data,
|
|
1702
1702
|
input: void 0
|
|
1703
1703
|
};
|
|
1704
|
-
case
|
|
1704
|
+
case we:
|
|
1705
1705
|
return De.get(i.self)?.abort(), {
|
|
1706
1706
|
...n,
|
|
1707
1707
|
status: "stopped",
|
|
@@ -1727,12 +1727,12 @@ function vn(e) {
|
|
|
1727
1727
|
emit: o
|
|
1728
1728
|
})).then((c) => {
|
|
1729
1729
|
r.getSnapshot().status === "active" && (De.delete(r), i._relay(r, r, {
|
|
1730
|
-
type:
|
|
1730
|
+
type: St,
|
|
1731
1731
|
data: c
|
|
1732
1732
|
}));
|
|
1733
1733
|
}, (c) => {
|
|
1734
1734
|
r.getSnapshot().status === "active" && (De.delete(r), i._relay(r, r, {
|
|
1735
|
-
type:
|
|
1735
|
+
type: _t,
|
|
1736
1736
|
data: c
|
|
1737
1737
|
}));
|
|
1738
1738
|
});
|
|
@@ -1747,16 +1747,16 @@ function vn(e) {
|
|
|
1747
1747
|
restoreSnapshot: (n) => n
|
|
1748
1748
|
};
|
|
1749
1749
|
}
|
|
1750
|
-
function
|
|
1750
|
+
function vr(e, {
|
|
1751
1751
|
machine: t,
|
|
1752
1752
|
context: n
|
|
1753
1753
|
}, r, i) {
|
|
1754
1754
|
const o = (s, a) => {
|
|
1755
1755
|
if (typeof s == "string") {
|
|
1756
|
-
const c =
|
|
1756
|
+
const c = $e(t, s);
|
|
1757
1757
|
if (!c)
|
|
1758
1758
|
throw new Error(`Actor logic '${s}' not implemented in machine '${t.id}'`);
|
|
1759
|
-
const u =
|
|
1759
|
+
const u = Pe(c, {
|
|
1760
1760
|
id: a?.id,
|
|
1761
1761
|
parent: e.self,
|
|
1762
1762
|
syncSnapshot: a?.syncSnapshot,
|
|
@@ -1770,7 +1770,7 @@ function _r(e, {
|
|
|
1770
1770
|
});
|
|
1771
1771
|
return i[u.id] = u, u;
|
|
1772
1772
|
} else
|
|
1773
|
-
return
|
|
1773
|
+
return Pe(s, {
|
|
1774
1774
|
id: a?.id,
|
|
1775
1775
|
parent: e.self,
|
|
1776
1776
|
syncSnapshot: a?.syncSnapshot,
|
|
@@ -1786,7 +1786,7 @@ function _r(e, {
|
|
|
1786
1786
|
}), c;
|
|
1787
1787
|
};
|
|
1788
1788
|
}
|
|
1789
|
-
function
|
|
1789
|
+
function mr(e, t, n, r, {
|
|
1790
1790
|
assignment: i
|
|
1791
1791
|
}) {
|
|
1792
1792
|
if (!t.context)
|
|
@@ -1794,7 +1794,7 @@ function br(e, t, n, r, {
|
|
|
1794
1794
|
const o = {}, s = {
|
|
1795
1795
|
context: t.context,
|
|
1796
1796
|
event: n.event,
|
|
1797
|
-
spawn:
|
|
1797
|
+
spawn: vr(e, t, n.event, o),
|
|
1798
1798
|
self: e.self,
|
|
1799
1799
|
system: e.system
|
|
1800
1800
|
};
|
|
@@ -1807,7 +1807,7 @@ function br(e, t, n, r, {
|
|
|
1807
1807
|
a[u] = typeof f == "function" ? f(s, r) : f;
|
|
1808
1808
|
}
|
|
1809
1809
|
const c = Object.assign({}, t.context, a);
|
|
1810
|
-
return [
|
|
1810
|
+
return [U(t, {
|
|
1811
1811
|
context: c,
|
|
1812
1812
|
children: Object.keys(o).length ? {
|
|
1813
1813
|
...t.children,
|
|
@@ -1815,38 +1815,38 @@ function br(e, t, n, r, {
|
|
|
1815
1815
|
} : t.children
|
|
1816
1816
|
}), void 0, void 0];
|
|
1817
1817
|
}
|
|
1818
|
-
function
|
|
1818
|
+
function F(e) {
|
|
1819
1819
|
function t(n, r) {
|
|
1820
1820
|
}
|
|
1821
|
-
return t.type = "xstate.assign", t.assignment = e, t.resolve =
|
|
1821
|
+
return t.type = "xstate.assign", t.assignment = e, t.resolve = mr, t;
|
|
1822
1822
|
}
|
|
1823
|
-
const
|
|
1824
|
-
function
|
|
1825
|
-
let r =
|
|
1823
|
+
const bt = /* @__PURE__ */ new WeakMap();
|
|
1824
|
+
function J(e, t, n) {
|
|
1825
|
+
let r = bt.get(e);
|
|
1826
1826
|
return r ? t in r || (r[t] = n()) : (r = {
|
|
1827
1827
|
[t]: n()
|
|
1828
|
-
},
|
|
1828
|
+
}, bt.set(e, r)), r[t];
|
|
1829
1829
|
}
|
|
1830
|
-
const
|
|
1830
|
+
const yr = {}, te = (e) => typeof e == "string" ? {
|
|
1831
1831
|
type: e
|
|
1832
1832
|
} : typeof e == "function" ? "resolve" in e ? {
|
|
1833
1833
|
type: e.type
|
|
1834
1834
|
} : {
|
|
1835
1835
|
type: e.name
|
|
1836
1836
|
} : e;
|
|
1837
|
-
class
|
|
1837
|
+
class Fe {
|
|
1838
1838
|
constructor(t, n) {
|
|
1839
|
-
if (this.config = t, this.key = void 0, this.id = void 0, this.type = void 0, this.path = void 0, this.states = void 0, this.history = void 0, this.entry = void 0, this.exit = void 0, this.parent = void 0, this.machine = void 0, this.meta = void 0, this.output = void 0, this.order = -1, this.description = void 0, this.tags = [], this.transitions = void 0, this.always = void 0, this.parent = n._parent, this.key = n._key, this.machine = n._machine, this.path = this.parent ? this.parent.path.concat(this.key) : [], this.id = this.config.id || [this.machine.id, ...this.path].join(
|
|
1839
|
+
if (this.config = t, this.key = void 0, this.id = void 0, this.type = void 0, this.path = void 0, this.states = void 0, this.history = void 0, this.entry = void 0, this.exit = void 0, this.parent = void 0, this.machine = void 0, this.meta = void 0, this.output = void 0, this.order = -1, this.description = void 0, this.tags = [], this.transitions = void 0, this.always = void 0, this.parent = n._parent, this.key = n._key, this.machine = n._machine, this.path = this.parent ? this.parent.path.concat(this.key) : [], this.id = this.config.id || [this.machine.id, ...this.path].join(zt), this.type = this.config.type || (this.config.states && Object.keys(this.config.states).length ? "compound" : this.config.history ? "history" : "atomic"), this.description = this.config.description, this.order = this.machine.idMap.size, this.machine.idMap.set(this.id, this), this.states = this.config.states ? lt(this.config.states, (r, i) => new Fe(r, {
|
|
1840
1840
|
_parent: this,
|
|
1841
1841
|
_key: i,
|
|
1842
1842
|
_machine: this.machine
|
|
1843
|
-
})) :
|
|
1843
|
+
})) : yr, this.type === "compound" && !this.config.initial)
|
|
1844
1844
|
throw new Error(`No initial state specified for compound state node "#${this.id}". Try adding { initial: "${Object.keys(this.states)[0]}" } to the state config.`);
|
|
1845
|
-
this.history = this.config.history === !0 ? "shallow" : this.config.history || !1, this.entry =
|
|
1845
|
+
this.history = this.config.history === !0 ? "shallow" : this.config.history || !1, this.entry = x(this.config.entry).slice(), this.exit = x(this.config.exit).slice(), this.meta = this.config.meta, this.output = this.type === "final" || !this.parent ? this.config.output : void 0, this.tags = x(t.tags).slice();
|
|
1846
1846
|
}
|
|
1847
1847
|
/** @internal */
|
|
1848
1848
|
_initialize() {
|
|
1849
|
-
this.transitions =
|
|
1849
|
+
this.transitions = Bn(this), this.config.always && (this.always = Z(this.config.always).map((t) => B(this, Jt, t))), Object.keys(this.states).forEach((t) => {
|
|
1850
1850
|
this.states[t]._initialize();
|
|
1851
1851
|
});
|
|
1852
1852
|
}
|
|
@@ -1860,25 +1860,25 @@ class Ne {
|
|
|
1860
1860
|
initial: this.initial ? {
|
|
1861
1861
|
target: this.initial.target,
|
|
1862
1862
|
source: this,
|
|
1863
|
-
actions: this.initial.actions.map(
|
|
1863
|
+
actions: this.initial.actions.map(te),
|
|
1864
1864
|
eventType: null,
|
|
1865
1865
|
reenter: !1,
|
|
1866
1866
|
toJSON: () => ({
|
|
1867
1867
|
target: this.initial.target.map((t) => `#${t.id}`),
|
|
1868
1868
|
source: `#${this.id}`,
|
|
1869
|
-
actions: this.initial.actions.map(
|
|
1869
|
+
actions: this.initial.actions.map(te),
|
|
1870
1870
|
eventType: null
|
|
1871
1871
|
})
|
|
1872
1872
|
} : void 0,
|
|
1873
1873
|
history: this.history,
|
|
1874
|
-
states:
|
|
1874
|
+
states: lt(this.states, (t) => t.definition),
|
|
1875
1875
|
on: this.on,
|
|
1876
1876
|
transitions: [...this.transitions.values()].flat().map((t) => ({
|
|
1877
1877
|
...t,
|
|
1878
|
-
actions: t.actions.map(
|
|
1878
|
+
actions: t.actions.map(te)
|
|
1879
1879
|
})),
|
|
1880
|
-
entry: this.entry.map(
|
|
1881
|
-
exit: this.exit.map(
|
|
1880
|
+
entry: this.entry.map(te),
|
|
1881
|
+
exit: this.exit.map(te),
|
|
1882
1882
|
meta: this.meta,
|
|
1883
1883
|
order: this.order || -1,
|
|
1884
1884
|
output: this.output,
|
|
@@ -1893,11 +1893,11 @@ class Ne {
|
|
|
1893
1893
|
}
|
|
1894
1894
|
/** The logic invoked as actors by this state node. */
|
|
1895
1895
|
get invoke() {
|
|
1896
|
-
return
|
|
1896
|
+
return J(this, "invoke", () => x(this.config.invoke).map((t, n) => {
|
|
1897
1897
|
const {
|
|
1898
1898
|
src: r,
|
|
1899
1899
|
systemId: i
|
|
1900
|
-
} = t, o = t.id ??
|
|
1900
|
+
} = t, o = t.id ?? ht(this.id, n), s = typeof r == "string" ? r : `xstate.invoke.${ht(this.id, n)}`;
|
|
1901
1901
|
return {
|
|
1902
1902
|
...t,
|
|
1903
1903
|
src: s,
|
|
@@ -1921,19 +1921,19 @@ class Ne {
|
|
|
1921
1921
|
}
|
|
1922
1922
|
/** The mapping of events to transitions. */
|
|
1923
1923
|
get on() {
|
|
1924
|
-
return
|
|
1924
|
+
return J(this, "on", () => [...this.transitions].flatMap(([n, r]) => r.map((i) => [n, i])).reduce((n, [r, i]) => (n[r] = n[r] || [], n[r].push(i), n), {}));
|
|
1925
1925
|
}
|
|
1926
1926
|
get after() {
|
|
1927
|
-
return
|
|
1927
|
+
return J(this, "delayedTransitions", () => Wn(this));
|
|
1928
1928
|
}
|
|
1929
1929
|
get initial() {
|
|
1930
|
-
return
|
|
1930
|
+
return J(this, "initial", () => Hn(this, this.config.initial));
|
|
1931
1931
|
}
|
|
1932
1932
|
/** @internal */
|
|
1933
1933
|
next(t, n) {
|
|
1934
1934
|
const r = n.type, i = [];
|
|
1935
1935
|
let o;
|
|
1936
|
-
const s =
|
|
1936
|
+
const s = J(this, `candidates-${r}`, () => qn(this, r));
|
|
1937
1937
|
for (const a of s) {
|
|
1938
1938
|
const {
|
|
1939
1939
|
guard: c
|
|
@@ -1955,7 +1955,7 @@ ${l.message}`);
|
|
|
1955
1955
|
}
|
|
1956
1956
|
/** All the event types accepted by this state node and its descendants. */
|
|
1957
1957
|
get events() {
|
|
1958
|
-
return
|
|
1958
|
+
return J(this, "events", () => {
|
|
1959
1959
|
const {
|
|
1960
1960
|
states: t
|
|
1961
1961
|
} = this, n = new Set(this.ownEvents);
|
|
@@ -1979,15 +1979,15 @@ ${l.message}`);
|
|
|
1979
1979
|
return Array.from(t);
|
|
1980
1980
|
}
|
|
1981
1981
|
}
|
|
1982
|
-
const
|
|
1983
|
-
class
|
|
1982
|
+
const Sr = "#";
|
|
1983
|
+
class ct {
|
|
1984
1984
|
constructor(t, n) {
|
|
1985
1985
|
this.config = t, this.version = void 0, this.schemas = void 0, this.implementations = void 0, this.__xstatenode = !0, this.idMap = /* @__PURE__ */ new Map(), this.root = void 0, this.id = void 0, this.states = void 0, this.events = void 0, this.id = t.id || "(machine)", this.implementations = {
|
|
1986
1986
|
actors: n?.actors ?? {},
|
|
1987
1987
|
actions: n?.actions ?? {},
|
|
1988
1988
|
delays: n?.delays ?? {},
|
|
1989
1989
|
guards: n?.guards ?? {}
|
|
1990
|
-
}, this.version = this.config.version, this.schemas = this.config.schemas, this.transition = this.transition.bind(this), this.getInitialSnapshot = this.getInitialSnapshot.bind(this), this.getPersistedSnapshot = this.getPersistedSnapshot.bind(this), this.restoreSnapshot = this.restoreSnapshot.bind(this), this.start = this.start.bind(this), this.root = new
|
|
1990
|
+
}, this.version = this.config.version, this.schemas = this.config.schemas, this.transition = this.transition.bind(this), this.getInitialSnapshot = this.getInitialSnapshot.bind(this), this.getPersistedSnapshot = this.getPersistedSnapshot.bind(this), this.restoreSnapshot = this.restoreSnapshot.bind(this), this.start = this.start.bind(this), this.root = new Fe(t, {
|
|
1991
1991
|
_key: this.id,
|
|
1992
1992
|
_machine: this
|
|
1993
1993
|
}), this.root._initialize(), this.states = this.root.states, this.events = this.root.events;
|
|
@@ -2006,7 +2006,7 @@ class ut {
|
|
|
2006
2006
|
actors: i,
|
|
2007
2007
|
delays: o
|
|
2008
2008
|
} = this.implementations;
|
|
2009
|
-
return new
|
|
2009
|
+
return new ct(this.config, {
|
|
2010
2010
|
actions: {
|
|
2011
2011
|
...n,
|
|
2012
2012
|
...t.actions
|
|
@@ -2026,12 +2026,12 @@ class ut {
|
|
|
2026
2026
|
});
|
|
2027
2027
|
}
|
|
2028
2028
|
resolveState(t) {
|
|
2029
|
-
const n =
|
|
2030
|
-
return
|
|
2029
|
+
const n = sr(this.root, t.value), r = Ae(Oe(this.root, n));
|
|
2030
|
+
return Ee({
|
|
2031
2031
|
_nodes: [...r],
|
|
2032
2032
|
context: t.context || {},
|
|
2033
2033
|
children: {},
|
|
2034
|
-
status:
|
|
2034
|
+
status: st(r, this.root) ? "done" : t.status || "active",
|
|
2035
2035
|
output: t.output,
|
|
2036
2036
|
error: t.error,
|
|
2037
2037
|
historyValue: t.historyValue
|
|
@@ -2045,7 +2045,7 @@ class ut {
|
|
|
2045
2045
|
* @param event The received event
|
|
2046
2046
|
*/
|
|
2047
2047
|
transition(t, n, r) {
|
|
2048
|
-
return
|
|
2048
|
+
return Ve(t, n, r, []).snapshot;
|
|
2049
2049
|
}
|
|
2050
2050
|
/**
|
|
2051
2051
|
* Determines the next state given the current `state` and `event`. Calculates
|
|
@@ -2055,10 +2055,10 @@ class ut {
|
|
|
2055
2055
|
* @param event The received event
|
|
2056
2056
|
*/
|
|
2057
2057
|
microstep(t, n, r) {
|
|
2058
|
-
return
|
|
2058
|
+
return Ve(t, n, r, []).microstates;
|
|
2059
2059
|
}
|
|
2060
2060
|
getTransitionData(t, n) {
|
|
2061
|
-
return
|
|
2061
|
+
return it(this.root, t.value, t, n) || [];
|
|
2062
2062
|
}
|
|
2063
2063
|
/**
|
|
2064
2064
|
* The initial state _before_ evaluating any microsteps. This "pre-initial"
|
|
@@ -2067,13 +2067,13 @@ class ut {
|
|
|
2067
2067
|
getPreInitialState(t, n, r) {
|
|
2068
2068
|
const {
|
|
2069
2069
|
context: i
|
|
2070
|
-
} = this.config, o =
|
|
2070
|
+
} = this.config, o = Ee({
|
|
2071
2071
|
context: typeof i != "function" && i ? i : {},
|
|
2072
2072
|
_nodes: [this.root],
|
|
2073
2073
|
children: {},
|
|
2074
2074
|
status: "active"
|
|
2075
2075
|
}, this);
|
|
2076
|
-
return typeof i == "function" ?
|
|
2076
|
+
return typeof i == "function" ? $(o, n, t, [F(({
|
|
2077
2077
|
spawn: a,
|
|
2078
2078
|
event: c,
|
|
2079
2079
|
self: u
|
|
@@ -2088,8 +2088,8 @@ class ut {
|
|
|
2088
2088
|
* `ActorRef`.
|
|
2089
2089
|
*/
|
|
2090
2090
|
getInitialSnapshot(t, n) {
|
|
2091
|
-
const r =
|
|
2092
|
-
target: [...
|
|
2091
|
+
const r = Xt(n), i = [], o = this.getPreInitialState(t, r, i), s = Ye([{
|
|
2092
|
+
target: [...an(this.root)],
|
|
2093
2093
|
source: this.root,
|
|
2094
2094
|
reenter: !0,
|
|
2095
2095
|
actions: [],
|
|
@@ -2098,7 +2098,7 @@ class ut {
|
|
|
2098
2098
|
// TODO: fix
|
|
2099
2099
|
}], o, t, r, !0, i), {
|
|
2100
2100
|
snapshot: a
|
|
2101
|
-
} =
|
|
2101
|
+
} = Ve(s, r, t, i);
|
|
2102
2102
|
return a;
|
|
2103
2103
|
}
|
|
2104
2104
|
start(t) {
|
|
@@ -2107,10 +2107,10 @@ class ut {
|
|
|
2107
2107
|
});
|
|
2108
2108
|
}
|
|
2109
2109
|
getStateNodeById(t) {
|
|
2110
|
-
const n =
|
|
2110
|
+
const n = Qe(t), r = n.slice(1), i = Ne(n[0]) ? n[0].slice(Sr.length) : n[0], o = this.idMap.get(i);
|
|
2111
2111
|
if (!o)
|
|
2112
2112
|
throw new Error(`Child state node '#${i}' does not exist on machine '${this.id}'`);
|
|
2113
|
-
return
|
|
2113
|
+
return Me(o, r);
|
|
2114
2114
|
}
|
|
2115
2115
|
get definition() {
|
|
2116
2116
|
return this.root.definition;
|
|
@@ -2119,26 +2119,26 @@ class ut {
|
|
|
2119
2119
|
return this.definition;
|
|
2120
2120
|
}
|
|
2121
2121
|
getPersistedSnapshot(t, n) {
|
|
2122
|
-
return
|
|
2122
|
+
return lr(t, n);
|
|
2123
2123
|
}
|
|
2124
2124
|
restoreSnapshot(t, n) {
|
|
2125
2125
|
const r = {}, i = t.children;
|
|
2126
2126
|
Object.keys(i).forEach((l) => {
|
|
2127
|
-
const d = i[l], p = d.snapshot,
|
|
2127
|
+
const d = i[l], p = d.snapshot, g = d.src, y = typeof g == "string" ? $e(this, g) : g;
|
|
2128
2128
|
if (!y)
|
|
2129
2129
|
return;
|
|
2130
|
-
const I =
|
|
2130
|
+
const I = Pe(y, {
|
|
2131
2131
|
id: l,
|
|
2132
2132
|
parent: n.self,
|
|
2133
2133
|
syncSnapshot: d.syncSnapshot,
|
|
2134
2134
|
snapshot: p,
|
|
2135
|
-
src:
|
|
2135
|
+
src: g,
|
|
2136
2136
|
systemId: d.systemId
|
|
2137
2137
|
});
|
|
2138
2138
|
r[l] = I;
|
|
2139
2139
|
});
|
|
2140
2140
|
function o(l, d) {
|
|
2141
|
-
if (d instanceof
|
|
2141
|
+
if (d instanceof Fe)
|
|
2142
2142
|
return d;
|
|
2143
2143
|
try {
|
|
2144
2144
|
return l.machine.getStateNodeById(d.id);
|
|
@@ -2149,32 +2149,32 @@ class ut {
|
|
|
2149
2149
|
if (!d || typeof d != "object")
|
|
2150
2150
|
return {};
|
|
2151
2151
|
const p = {};
|
|
2152
|
-
for (const
|
|
2153
|
-
const y = d[
|
|
2152
|
+
for (const g in d) {
|
|
2153
|
+
const y = d[g];
|
|
2154
2154
|
for (const I of y) {
|
|
2155
|
-
const
|
|
2156
|
-
|
|
2155
|
+
const C = o(l, I);
|
|
2156
|
+
C && (p[g] ??= [], p[g].push(C));
|
|
2157
2157
|
}
|
|
2158
2158
|
}
|
|
2159
2159
|
return p;
|
|
2160
2160
|
}
|
|
2161
|
-
const a = s(this.root, t.historyValue), c =
|
|
2161
|
+
const a = s(this.root, t.historyValue), c = Ee({
|
|
2162
2162
|
...t,
|
|
2163
2163
|
children: r,
|
|
2164
|
-
_nodes: Array.from(
|
|
2164
|
+
_nodes: Array.from(Ae(Oe(this.root, t.value))),
|
|
2165
2165
|
historyValue: a
|
|
2166
2166
|
}, this), u = /* @__PURE__ */ new Set();
|
|
2167
2167
|
function f(l, d) {
|
|
2168
2168
|
if (!u.has(l)) {
|
|
2169
2169
|
u.add(l);
|
|
2170
2170
|
for (const p in l) {
|
|
2171
|
-
const
|
|
2172
|
-
if (
|
|
2173
|
-
if ("xstate$$type" in
|
|
2174
|
-
l[p] = d[
|
|
2171
|
+
const g = l[p];
|
|
2172
|
+
if (g && typeof g == "object") {
|
|
2173
|
+
if ("xstate$$type" in g && g.xstate$$type === et) {
|
|
2174
|
+
l[p] = d[g.id];
|
|
2175
2175
|
continue;
|
|
2176
2176
|
}
|
|
2177
|
-
f(
|
|
2177
|
+
f(g, d);
|
|
2178
2178
|
}
|
|
2179
2179
|
}
|
|
2180
2180
|
}
|
|
@@ -2182,7 +2182,7 @@ class ut {
|
|
|
2182
2182
|
return f(c.context, r), c;
|
|
2183
2183
|
}
|
|
2184
2184
|
}
|
|
2185
|
-
function
|
|
2185
|
+
function _r(e, t, n, r, {
|
|
2186
2186
|
event: i
|
|
2187
2187
|
}) {
|
|
2188
2188
|
const o = typeof i == "function" ? i(n, r) : i;
|
|
@@ -2190,20 +2190,20 @@ function wr(e, t, n, r, {
|
|
|
2190
2190
|
event: o
|
|
2191
2191
|
}, void 0];
|
|
2192
2192
|
}
|
|
2193
|
-
function
|
|
2193
|
+
function br(e, {
|
|
2194
2194
|
event: t
|
|
2195
2195
|
}) {
|
|
2196
2196
|
e.defer(() => e.emit(t));
|
|
2197
2197
|
}
|
|
2198
|
-
function
|
|
2198
|
+
function pn(e) {
|
|
2199
2199
|
function t(n, r) {
|
|
2200
2200
|
}
|
|
2201
|
-
return t.type = "xstate.emit", t.event = e, t.resolve =
|
|
2201
|
+
return t.type = "xstate.emit", t.event = e, t.resolve = _r, t.execute = br, t;
|
|
2202
2202
|
}
|
|
2203
|
-
let
|
|
2203
|
+
let Xe = /* @__PURE__ */ (function(e) {
|
|
2204
2204
|
return e.Parent = "#_parent", e.Internal = "#_internal", e;
|
|
2205
2205
|
})({});
|
|
2206
|
-
function
|
|
2206
|
+
function Tr(e, t, n, r, {
|
|
2207
2207
|
to: i,
|
|
2208
2208
|
event: o,
|
|
2209
2209
|
id: s,
|
|
@@ -2218,14 +2218,14 @@ function Pr(e, t, n, r, {
|
|
|
2218
2218
|
const f = typeof o == "function" ? o(n, r) : o;
|
|
2219
2219
|
let l;
|
|
2220
2220
|
if (typeof a == "string") {
|
|
2221
|
-
const
|
|
2222
|
-
l = typeof
|
|
2221
|
+
const g = u && u[a];
|
|
2222
|
+
l = typeof g == "function" ? g(n, r) : g;
|
|
2223
2223
|
} else
|
|
2224
2224
|
l = typeof a == "function" ? a(n, r) : a;
|
|
2225
2225
|
const d = typeof i == "function" ? i(n, r) : i;
|
|
2226
2226
|
let p;
|
|
2227
2227
|
if (typeof d == "string") {
|
|
2228
|
-
if (d ===
|
|
2228
|
+
if (d === Xe.Parent ? p = e.self._parent : d === Xe.Internal ? p = e.self : d.startsWith("#_") ? p = t.children[d.slice(2)] : p = c.deferredActorIds?.includes(d) ? d : t.children[d], !p)
|
|
2229
2229
|
throw new Error(`Unable to send event to actor '${d}' from machine '${t.machine.id}'.`);
|
|
2230
2230
|
} else
|
|
2231
2231
|
p = d || e.self;
|
|
@@ -2237,10 +2237,10 @@ function Pr(e, t, n, r, {
|
|
|
2237
2237
|
delay: l
|
|
2238
2238
|
}, void 0];
|
|
2239
2239
|
}
|
|
2240
|
-
function
|
|
2240
|
+
function Ir(e, t, n) {
|
|
2241
2241
|
typeof n.to == "string" && (n.to = t.children[n.to]);
|
|
2242
2242
|
}
|
|
2243
|
-
function
|
|
2243
|
+
function wr(e, t) {
|
|
2244
2244
|
e.defer(() => {
|
|
2245
2245
|
const {
|
|
2246
2246
|
to: n,
|
|
@@ -2257,40 +2257,40 @@ function Mr(e, t) {
|
|
|
2257
2257
|
// at this point, in a deferred task, it should already be mutated by retryResolveSendTo
|
|
2258
2258
|
// if it initially started as a string
|
|
2259
2259
|
n,
|
|
2260
|
-
r.type ===
|
|
2260
|
+
r.type === wn ? Yt(e.self.id, r.data) : r
|
|
2261
2261
|
);
|
|
2262
2262
|
});
|
|
2263
2263
|
}
|
|
2264
|
-
function
|
|
2264
|
+
function je(e, t, n) {
|
|
2265
2265
|
function r(i, o) {
|
|
2266
2266
|
}
|
|
2267
|
-
return r.type = "xstate.sendTo", r.to = e, r.event = t, r.id = n?.id, r.delay = n?.delay, r.resolve =
|
|
2267
|
+
return r.type = "xstate.sendTo", r.to = e, r.event = t, r.id = n?.id, r.delay = n?.delay, r.resolve = Tr, r.retryResolve = Ir, r.execute = wr, r;
|
|
2268
2268
|
}
|
|
2269
|
-
function
|
|
2270
|
-
return
|
|
2269
|
+
function Pr(e, t) {
|
|
2270
|
+
return je(Xe.Parent, e, t);
|
|
2271
2271
|
}
|
|
2272
|
-
function
|
|
2272
|
+
function kr(e, t, n, r, {
|
|
2273
2273
|
collect: i
|
|
2274
2274
|
}) {
|
|
2275
2275
|
const o = [], s = function(c) {
|
|
2276
2276
|
o.push(c);
|
|
2277
2277
|
};
|
|
2278
2278
|
return s.assign = (...a) => {
|
|
2279
|
-
o.push(
|
|
2279
|
+
o.push(F(...a));
|
|
2280
2280
|
}, s.cancel = (...a) => {
|
|
2281
|
-
o.push(
|
|
2281
|
+
o.push(tt(...a));
|
|
2282
2282
|
}, s.raise = (...a) => {
|
|
2283
|
-
o.push(
|
|
2283
|
+
o.push(at(...a));
|
|
2284
2284
|
}, s.sendTo = (...a) => {
|
|
2285
|
-
o.push(
|
|
2285
|
+
o.push(je(...a));
|
|
2286
2286
|
}, s.sendParent = (...a) => {
|
|
2287
|
-
o.push(
|
|
2287
|
+
o.push(Pr(...a));
|
|
2288
2288
|
}, s.spawnChild = (...a) => {
|
|
2289
|
-
o.push(
|
|
2289
|
+
o.push(nt(...a));
|
|
2290
2290
|
}, s.stopChild = (...a) => {
|
|
2291
2291
|
o.push(Ce(...a));
|
|
2292
2292
|
}, s.emit = (...a) => {
|
|
2293
|
-
o.push(
|
|
2293
|
+
o.push(pn(...a));
|
|
2294
2294
|
}, i({
|
|
2295
2295
|
context: n.context,
|
|
2296
2296
|
event: n.event,
|
|
@@ -2300,12 +2300,12 @@ function Er(e, t, n, r, {
|
|
|
2300
2300
|
system: e.system
|
|
2301
2301
|
}, r), [t, void 0, o];
|
|
2302
2302
|
}
|
|
2303
|
-
function
|
|
2303
|
+
function Dr(e) {
|
|
2304
2304
|
function t(n, r) {
|
|
2305
2305
|
}
|
|
2306
|
-
return t.type = "xstate.enqueueActions", t.collect = e, t.resolve =
|
|
2306
|
+
return t.type = "xstate.enqueueActions", t.collect = e, t.resolve = kr, t;
|
|
2307
2307
|
}
|
|
2308
|
-
function
|
|
2308
|
+
function Er(e, t, n, r, {
|
|
2309
2309
|
value: i,
|
|
2310
2310
|
label: o
|
|
2311
2311
|
}) {
|
|
@@ -2314,7 +2314,7 @@ function Or(e, t, n, r, {
|
|
|
2314
2314
|
label: o
|
|
2315
2315
|
}, void 0];
|
|
2316
2316
|
}
|
|
2317
|
-
function
|
|
2317
|
+
function Ar({
|
|
2318
2318
|
logger: e
|
|
2319
2319
|
}, {
|
|
2320
2320
|
value: t,
|
|
@@ -2322,7 +2322,7 @@ function Nr({
|
|
|
2322
2322
|
}) {
|
|
2323
2323
|
n ? e(n, t) : e(t);
|
|
2324
2324
|
}
|
|
2325
|
-
function
|
|
2325
|
+
function Mr(e = ({
|
|
2326
2326
|
context: n,
|
|
2327
2327
|
event: r
|
|
2328
2328
|
}) => ({
|
|
@@ -2331,10 +2331,10 @@ function Cr(e = ({
|
|
|
2331
2331
|
}), t) {
|
|
2332
2332
|
function n(r, i) {
|
|
2333
2333
|
}
|
|
2334
|
-
return n.type = "xstate.log", n.value = e, n.label = t, n.resolve =
|
|
2334
|
+
return n.type = "xstate.log", n.value = e, n.label = t, n.resolve = Er, n.execute = Ar, n;
|
|
2335
2335
|
}
|
|
2336
|
-
function
|
|
2337
|
-
return new
|
|
2336
|
+
function Or(e, t) {
|
|
2337
|
+
return new ct(e, t);
|
|
2338
2338
|
}
|
|
2339
2339
|
function gn({
|
|
2340
2340
|
schemas: e,
|
|
@@ -2344,18 +2344,18 @@ function gn({
|
|
|
2344
2344
|
delays: i
|
|
2345
2345
|
}) {
|
|
2346
2346
|
return {
|
|
2347
|
-
assign:
|
|
2348
|
-
sendTo:
|
|
2349
|
-
raise:
|
|
2350
|
-
log:
|
|
2351
|
-
cancel:
|
|
2347
|
+
assign: F,
|
|
2348
|
+
sendTo: je,
|
|
2349
|
+
raise: at,
|
|
2350
|
+
log: Mr,
|
|
2351
|
+
cancel: tt,
|
|
2352
2352
|
stopChild: Ce,
|
|
2353
|
-
enqueueActions:
|
|
2354
|
-
emit:
|
|
2355
|
-
spawnChild:
|
|
2353
|
+
enqueueActions: Dr,
|
|
2354
|
+
emit: pn,
|
|
2355
|
+
spawnChild: nt,
|
|
2356
2356
|
createStateConfig: (o) => o,
|
|
2357
2357
|
createAction: (o) => o,
|
|
2358
|
-
createMachine: (o) =>
|
|
2358
|
+
createMachine: (o) => Or({
|
|
2359
2359
|
...o,
|
|
2360
2360
|
schemas: e
|
|
2361
2361
|
}, {
|
|
@@ -2382,31 +2382,115 @@ function gn({
|
|
|
2382
2382
|
})
|
|
2383
2383
|
};
|
|
2384
2384
|
}
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2385
|
+
class Fr {
|
|
2386
|
+
actor;
|
|
2387
|
+
subscription = null;
|
|
2388
|
+
options;
|
|
2389
|
+
/**
|
|
2390
|
+
* Creates a new NMEA client.
|
|
2391
|
+
*
|
|
2392
|
+
* @param machine - The NMEA machine instance (created with createNmeaMachine).
|
|
2393
|
+
* @param options - Optional configuration and callbacks.
|
|
2394
|
+
*/
|
|
2395
|
+
constructor(t, n) {
|
|
2396
|
+
this.options = n, this.actor = Pe(t), this.setupSubscriptions(), n?.enableLogging !== void 0 && this.setLogging(n.enableLogging), n?.baudRate !== void 0 && this.setBaudRate(n.baudRate), this.actor.start();
|
|
2397
|
+
}
|
|
2398
|
+
setupSubscriptions() {
|
|
2399
|
+
this.subscription = this.actor.subscribe((t) => {
|
|
2400
|
+
if (this.options?.onData && t.context.data !== void 0 && this.options.onData(t.context.data), this.options?.onStateChange) {
|
|
2401
|
+
const n = t.value === "connected";
|
|
2402
|
+
this.options.onStateChange(n);
|
|
2403
|
+
}
|
|
2404
|
+
this.options?.onError && t.context.error && this.options.onError(t.context.error);
|
|
2405
|
+
});
|
|
2406
|
+
}
|
|
2407
|
+
/**
|
|
2408
|
+
* Gets the current data.
|
|
2409
|
+
*/
|
|
2410
|
+
get data() {
|
|
2411
|
+
return this.actor.getSnapshot().context.data;
|
|
2412
|
+
}
|
|
2413
|
+
/**
|
|
2414
|
+
* Gets whether the connection is currently active.
|
|
2415
|
+
*/
|
|
2416
|
+
get isConnected() {
|
|
2417
|
+
return this.actor.getSnapshot().value === "connected";
|
|
2418
|
+
}
|
|
2419
|
+
/**
|
|
2420
|
+
* Gets whether the connection is in progress.
|
|
2421
|
+
*/
|
|
2422
|
+
get isConnecting() {
|
|
2423
|
+
return this.actor.getSnapshot().value === "connecting";
|
|
2424
|
+
}
|
|
2425
|
+
/**
|
|
2426
|
+
* Gets the current error message, if any.
|
|
2427
|
+
*/
|
|
2428
|
+
get error() {
|
|
2429
|
+
return this.actor.getSnapshot().context.error;
|
|
2430
|
+
}
|
|
2431
|
+
/**
|
|
2432
|
+
* Connects to the serial port.
|
|
2433
|
+
*/
|
|
2434
|
+
connect() {
|
|
2435
|
+
this.actor.send({ type: "CONNECT" });
|
|
2436
|
+
}
|
|
2437
|
+
/**
|
|
2438
|
+
* Disconnects from the serial port.
|
|
2439
|
+
*/
|
|
2440
|
+
disconnect() {
|
|
2441
|
+
this.actor.send({ type: "DISCONNECT" });
|
|
2442
|
+
}
|
|
2443
|
+
/**
|
|
2444
|
+
* Sets logging enabled/disabled.
|
|
2445
|
+
*/
|
|
2446
|
+
setLogging(t) {
|
|
2447
|
+
this.actor.send({ type: "SET_LOGGING", enabled: t });
|
|
2448
|
+
}
|
|
2449
|
+
/**
|
|
2450
|
+
* Sets the baud rate (requires reconnection to take effect).
|
|
2451
|
+
*/
|
|
2452
|
+
setBaudRate(t) {
|
|
2453
|
+
this.actor.send({ type: "SET_BAUD_RATE", baudRate: t });
|
|
2454
|
+
}
|
|
2455
|
+
/**
|
|
2456
|
+
* Gets the underlying XState actor (for advanced users).
|
|
2457
|
+
* Allows access to full XState functionality.
|
|
2458
|
+
*/
|
|
2459
|
+
get machine() {
|
|
2460
|
+
return this.actor;
|
|
2461
|
+
}
|
|
2462
|
+
/**
|
|
2463
|
+
* Disposes of the client and cleans up resources.
|
|
2464
|
+
*/
|
|
2465
|
+
dispose() {
|
|
2466
|
+
this.subscription && (this.subscription.unsubscribe(), this.subscription = null), this.actor.stop();
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
var O = {}, ne = {}, T = {}, Tt;
|
|
2470
|
+
function P() {
|
|
2471
|
+
if (Tt) return T;
|
|
2472
|
+
Tt = 1, Object.defineProperty(T, "__esModule", { value: !0 });
|
|
2389
2473
|
var e = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"];
|
|
2390
2474
|
function t(h) {
|
|
2391
|
-
var
|
|
2392
|
-
return e[
|
|
2475
|
+
var v = h >> 4 & 15, m = h >> 0 & 15;
|
|
2476
|
+
return e[v] + e[m];
|
|
2393
2477
|
}
|
|
2394
2478
|
T.toHexString = t;
|
|
2395
|
-
function n(h,
|
|
2396
|
-
for (var S = typeof h == "string" ? h : h.toFixed(0); S.length <
|
|
2397
|
-
S =
|
|
2479
|
+
function n(h, v, m) {
|
|
2480
|
+
for (var S = typeof h == "string" ? h : h.toFixed(0); S.length < v; )
|
|
2481
|
+
S = m + S;
|
|
2398
2482
|
return S;
|
|
2399
2483
|
}
|
|
2400
2484
|
T.padLeft = n;
|
|
2401
2485
|
function r(h) {
|
|
2402
|
-
var
|
|
2403
|
-
return D ===
|
|
2486
|
+
var v = h.split("*"), m = v[0], S = v[1], D = i(m), M = parseInt(S, 16);
|
|
2487
|
+
return D === M;
|
|
2404
2488
|
}
|
|
2405
2489
|
T.validNmeaChecksum = r;
|
|
2406
2490
|
function i(h) {
|
|
2407
|
-
for (var
|
|
2408
|
-
|
|
2409
|
-
return
|
|
2491
|
+
for (var v = h.charCodeAt(1), m = 2; m < h.length; m += 1)
|
|
2492
|
+
v = v ^ h.charCodeAt(m);
|
|
2493
|
+
return v = v & 255, v;
|
|
2410
2494
|
}
|
|
2411
2495
|
T.computeNmeaChecksum = i;
|
|
2412
2496
|
function o(h) {
|
|
@@ -2417,26 +2501,26 @@ function k() {
|
|
|
2417
2501
|
return h + o(h);
|
|
2418
2502
|
}
|
|
2419
2503
|
T.appendChecksumFooter = s;
|
|
2420
|
-
function a(h,
|
|
2421
|
-
return h === void 0 ? "" : h.toFixed(
|
|
2504
|
+
function a(h, v) {
|
|
2505
|
+
return h === void 0 ? "" : h.toFixed(v);
|
|
2422
2506
|
}
|
|
2423
2507
|
T.encodeFixed = a;
|
|
2424
2508
|
function c(h) {
|
|
2425
2509
|
if (h === void 0)
|
|
2426
2510
|
return ",";
|
|
2427
|
-
var
|
|
2428
|
-
h < 0 ? (
|
|
2429
|
-
var
|
|
2430
|
-
return S = S +
|
|
2511
|
+
var v;
|
|
2512
|
+
h < 0 ? (v = "S", h = -h) : v = "N";
|
|
2513
|
+
var m = Math.floor(h), S = n(m, 2, "0"), D = h - m, M = D * 60, N = n(M.toFixed(6), 9, "0");
|
|
2514
|
+
return S = S + N + "," + v, S;
|
|
2431
2515
|
}
|
|
2432
2516
|
T.encodeLatitude = c;
|
|
2433
2517
|
function u(h) {
|
|
2434
2518
|
if (h === void 0)
|
|
2435
2519
|
return ",";
|
|
2436
|
-
var
|
|
2437
|
-
h < 0 ? (
|
|
2438
|
-
var
|
|
2439
|
-
return S = S +
|
|
2520
|
+
var v;
|
|
2521
|
+
h < 0 ? (v = "W", h = -h) : v = "E";
|
|
2522
|
+
var m = Math.floor(h), S = n(m, 3, "0"), D = h - m, M = D * 60, N = n(M.toFixed(6), 9, "0");
|
|
2523
|
+
return S = S + N + "," + v, S;
|
|
2440
2524
|
}
|
|
2441
2525
|
T.encodeLongitude = u;
|
|
2442
2526
|
function f(h) {
|
|
@@ -2455,86 +2539,86 @@ function k() {
|
|
|
2455
2539
|
return h === void 0 ? "" : h.toFixed(1);
|
|
2456
2540
|
}
|
|
2457
2541
|
T.encodeGeoidalSeperationNoUnits = p;
|
|
2458
|
-
function
|
|
2542
|
+
function g(h) {
|
|
2459
2543
|
return h === void 0 ? "" : n(h.toFixed(2), 6, "0");
|
|
2460
2544
|
}
|
|
2461
|
-
T.encodeDegrees =
|
|
2545
|
+
T.encodeDegrees = g;
|
|
2462
2546
|
function y(h) {
|
|
2463
2547
|
if (h === void 0)
|
|
2464
2548
|
return "";
|
|
2465
|
-
var
|
|
2466
|
-
return n(S, 2, "0") + n(
|
|
2549
|
+
var v = h.getUTCFullYear(), m = h.getUTCMonth() + 1, S = h.getUTCDate();
|
|
2550
|
+
return n(S, 2, "0") + n(m, 2, "0") + v.toFixed(0).substr(2);
|
|
2467
2551
|
}
|
|
2468
2552
|
T.encodeDate = y;
|
|
2469
2553
|
function I(h) {
|
|
2470
2554
|
if (h === void 0)
|
|
2471
2555
|
return "";
|
|
2472
|
-
var
|
|
2473
|
-
return n(
|
|
2556
|
+
var v = h.getUTCHours(), m = h.getUTCMinutes(), S = h.getUTCSeconds();
|
|
2557
|
+
return n(v, 2, "0") + n(m, 2, "0") + n(S, 2, "0");
|
|
2474
2558
|
}
|
|
2475
2559
|
T.encodeTime = I;
|
|
2476
|
-
function
|
|
2560
|
+
function C(h) {
|
|
2477
2561
|
return h === void 0 ? "" : h.toString();
|
|
2478
2562
|
}
|
|
2479
|
-
T.encodeValue =
|
|
2480
|
-
function
|
|
2563
|
+
T.encodeValue = C;
|
|
2564
|
+
function R(h) {
|
|
2481
2565
|
return h === "" ? 0 : parseFloat(h);
|
|
2482
2566
|
}
|
|
2483
|
-
T.parseFloatSafe =
|
|
2484
|
-
function
|
|
2567
|
+
T.parseFloatSafe = R;
|
|
2568
|
+
function V(h) {
|
|
2485
2569
|
return h === "" ? 0 : parseInt(h, 10);
|
|
2486
2570
|
}
|
|
2487
|
-
T.parseIntSafe =
|
|
2488
|
-
function
|
|
2571
|
+
T.parseIntSafe = V;
|
|
2572
|
+
function Le(h) {
|
|
2489
2573
|
if (h === void 0)
|
|
2490
2574
|
return "";
|
|
2491
|
-
var
|
|
2492
|
-
return
|
|
2575
|
+
var v = parseFloat(h);
|
|
2576
|
+
return v === NaN ? h : v;
|
|
2493
2577
|
}
|
|
2494
|
-
T.parseNumberOrString =
|
|
2495
|
-
function
|
|
2496
|
-
var
|
|
2497
|
-
if (
|
|
2578
|
+
T.parseNumberOrString = Le;
|
|
2579
|
+
function ee(h) {
|
|
2580
|
+
var v = h.indexOf(".");
|
|
2581
|
+
if (v < 0)
|
|
2498
2582
|
return 0;
|
|
2499
|
-
var
|
|
2500
|
-
return
|
|
2583
|
+
var m, S;
|
|
2584
|
+
return v >= 3 ? (m = h.substring(0, v - 2), S = h.substring(v - 2)) : (m = "0", S = h), parseFloat(m) + parseFloat(S) / 60;
|
|
2501
2585
|
}
|
|
2502
|
-
T.parseDmCoordinate =
|
|
2503
|
-
function
|
|
2504
|
-
var
|
|
2505
|
-
return
|
|
2586
|
+
T.parseDmCoordinate = ee;
|
|
2587
|
+
function xe(h, v) {
|
|
2588
|
+
var m = v === "N" ? 1 : -1;
|
|
2589
|
+
return ee(h) * m;
|
|
2506
2590
|
}
|
|
2507
|
-
T.parseLatitude =
|
|
2508
|
-
function
|
|
2509
|
-
var
|
|
2510
|
-
return
|
|
2591
|
+
T.parseLatitude = xe;
|
|
2592
|
+
function qe(h, v) {
|
|
2593
|
+
var m = v === "E" ? 1 : -1;
|
|
2594
|
+
return ee(h) * m;
|
|
2511
2595
|
}
|
|
2512
|
-
T.parseLongitude =
|
|
2513
|
-
function
|
|
2596
|
+
T.parseLongitude = qe;
|
|
2597
|
+
function We(h, v) {
|
|
2514
2598
|
if (h === "")
|
|
2515
2599
|
return /* @__PURE__ */ new Date(0);
|
|
2516
|
-
var
|
|
2517
|
-
if (
|
|
2518
|
-
var S =
|
|
2519
|
-
S.length === 4 ?
|
|
2520
|
-
}
|
|
2521
|
-
|
|
2522
|
-
var
|
|
2523
|
-
return
|
|
2524
|
-
}
|
|
2525
|
-
T.parseTime =
|
|
2526
|
-
function
|
|
2527
|
-
var
|
|
2600
|
+
var m = /* @__PURE__ */ new Date();
|
|
2601
|
+
if (v) {
|
|
2602
|
+
var S = v.slice(4), D = parseInt(v.slice(2, 4), 10) - 1, M = v.slice(0, 2);
|
|
2603
|
+
S.length === 4 ? m.setUTCFullYear(Number(S), Number(D), Number(M)) : m.setUTCFullYear(+("20" + S), Number(D), Number(M));
|
|
2604
|
+
}
|
|
2605
|
+
m.setUTCHours(Number(h.slice(0, 2))), m.setUTCMinutes(Number(h.slice(2, 4))), m.setUTCSeconds(Number(h.slice(4, 6)));
|
|
2606
|
+
var N = h.slice(7), K = N.length, W = 0;
|
|
2607
|
+
return K !== 0 && (W = parseFloat(N) * Math.pow(10, 3 - K)), m.setUTCMilliseconds(Number(W)), m;
|
|
2608
|
+
}
|
|
2609
|
+
T.parseTime = We;
|
|
2610
|
+
function Be(h, v) {
|
|
2611
|
+
var m = parseInt(h.slice(0, 2), 10), S = parseInt(h.slice(2, 4), 10), D = parseInt(h.slice(4, 6), 10);
|
|
2528
2612
|
D < 73 ? D = D + 2e3 : D = D + 1900;
|
|
2529
|
-
var
|
|
2530
|
-
return
|
|
2613
|
+
var M = parseInt(v.slice(0, 2), 10), N = parseInt(v.slice(2, 4), 10), K = parseInt(v.slice(4, 6), 10), W = 0;
|
|
2614
|
+
return v.length === 9 && (W = parseInt(v.slice(7, 9), 10) * 10), new Date(Date.UTC(D, S - 1, m, M, N, K, W));
|
|
2531
2615
|
}
|
|
2532
|
-
return T.parseDatetime =
|
|
2616
|
+
return T.parseDatetime = Be, T;
|
|
2533
2617
|
}
|
|
2534
|
-
var
|
|
2618
|
+
var re = {}, It;
|
|
2535
2619
|
function w() {
|
|
2536
|
-
if (
|
|
2537
|
-
|
|
2620
|
+
if (It) return re;
|
|
2621
|
+
It = 1, Object.defineProperty(re, "__esModule", { value: !0 });
|
|
2538
2622
|
function e(n, r, i) {
|
|
2539
2623
|
return {
|
|
2540
2624
|
sentenceId: r,
|
|
@@ -2543,17 +2627,17 @@ function w() {
|
|
|
2543
2627
|
sentenceName: i
|
|
2544
2628
|
};
|
|
2545
2629
|
}
|
|
2546
|
-
|
|
2630
|
+
re.initStubFields = e;
|
|
2547
2631
|
function t(n, r) {
|
|
2548
2632
|
var i, o;
|
|
2549
2633
|
return n.charAt(1) === "P" ? (i = "P", o = n.substr(2)) : (i = n.substr(1, 2), o = n.substr(3)), { talkerId: i, sentenceId: o, chxOk: r || void 0 };
|
|
2550
2634
|
}
|
|
2551
|
-
return
|
|
2635
|
+
return re.parseStub = t, re;
|
|
2552
2636
|
}
|
|
2553
|
-
var
|
|
2554
|
-
function
|
|
2555
|
-
return
|
|
2556
|
-
var t =
|
|
2637
|
+
var wt;
|
|
2638
|
+
function Cr() {
|
|
2639
|
+
return wt || (wt = 1, (function(e) {
|
|
2640
|
+
var t = ne && ne.__assign || function() {
|
|
2557
2641
|
return t = Object.assign || function(o) {
|
|
2558
2642
|
for (var s, a = 1, c = arguments.length; a < c; a++) {
|
|
2559
2643
|
s = arguments[a];
|
|
@@ -2563,18 +2647,18 @@ function jr() {
|
|
|
2563
2647
|
}, t.apply(this, arguments);
|
|
2564
2648
|
};
|
|
2565
2649
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
2566
|
-
var n =
|
|
2650
|
+
var n = P(), r = w();
|
|
2567
2651
|
e.sentenceId = "APB", e.sentenceName = 'Autopilot sentence "B"';
|
|
2568
2652
|
function i(o, s) {
|
|
2569
2653
|
return t(t({}, r.initStubFields(o, e.sentenceId, e.sentenceName)), { status1: s[1], status2: s[2], xteMagn: n.parseFloatSafe(s[3]), steerDir: s[4], xteUnit: s[5], arrivalCircleStatus: s[6], arrivalPerpendicularStatus: s[7], bearingOrig2Dest: n.parseFloatSafe(s[8]), bearingOrig2DestType: s[9], waypoint: s[10], bearing2Dest: n.parseFloatSafe(s[11]), bearingDestType: s[12], heading2steer: n.parseFloatSafe(s[13]), headingDestType: s[14] });
|
|
2570
2654
|
}
|
|
2571
2655
|
e.decodeSentence = i;
|
|
2572
|
-
})(
|
|
2656
|
+
})(ne)), ne;
|
|
2573
2657
|
}
|
|
2574
|
-
var
|
|
2575
|
-
function
|
|
2658
|
+
var se = {}, Pt;
|
|
2659
|
+
function Rr() {
|
|
2576
2660
|
return Pt || (Pt = 1, (function(e) {
|
|
2577
|
-
var t =
|
|
2661
|
+
var t = se && se.__assign || function() {
|
|
2578
2662
|
return t = Object.assign || function(o) {
|
|
2579
2663
|
for (var s, a = 1, c = arguments.length; a < c; a++) {
|
|
2580
2664
|
s = arguments[a];
|
|
@@ -2584,18 +2668,18 @@ function Gr() {
|
|
|
2584
2668
|
}, t.apply(this, arguments);
|
|
2585
2669
|
};
|
|
2586
2670
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
2587
|
-
var n =
|
|
2671
|
+
var n = P(), r = w();
|
|
2588
2672
|
e.sentenceId = "BWC", e.sentenceName = "Bearing and distance to waypoint - great circle";
|
|
2589
2673
|
function i(o, s) {
|
|
2590
2674
|
return t(t({}, r.initStubFields(o, e.sentenceId, e.sentenceName)), { time: n.parseTime(s[1]), bearingLatitude: n.parseLatitude(s[2], s[3]), bearingLongitude: n.parseLongitude(s[4], s[5]), bearingTrue: n.parseFloatSafe(s[6]), bearingMagnetic: n.parseFloatSafe(s[8]), distanceNm: n.parseFloatSafe(s[10]), waypointId: s[12], faaMode: s[13] });
|
|
2591
2675
|
}
|
|
2592
2676
|
e.decodeSentence = i;
|
|
2593
|
-
})(
|
|
2677
|
+
})(se)), se;
|
|
2594
2678
|
}
|
|
2595
|
-
var
|
|
2596
|
-
function
|
|
2597
|
-
return
|
|
2598
|
-
var t =
|
|
2679
|
+
var ie = {}, kt;
|
|
2680
|
+
function Nr() {
|
|
2681
|
+
return kt || (kt = 1, (function(e) {
|
|
2682
|
+
var t = ie && ie.__assign || function() {
|
|
2599
2683
|
return t = Object.assign || function(s) {
|
|
2600
2684
|
for (var a, c = 1, u = arguments.length; c < u; c++) {
|
|
2601
2685
|
a = arguments[c];
|
|
@@ -2605,7 +2689,7 @@ function Lr() {
|
|
|
2605
2689
|
}, t.apply(this, arguments);
|
|
2606
2690
|
};
|
|
2607
2691
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
2608
|
-
var n =
|
|
2692
|
+
var n = P(), r = w();
|
|
2609
2693
|
e.sentenceId = "DBT", e.sentenceName = "Depth below transducer";
|
|
2610
2694
|
function i(s, a) {
|
|
2611
2695
|
return t(t({}, r.initStubFields(s, e.sentenceId, e.sentenceName)), { depthFeet: n.parseFloatSafe(a[1]), depthMeters: n.parseFloatSafe(a[3]), depthFathoms: n.parseFloatSafe(a[5]) });
|
|
@@ -2618,12 +2702,12 @@ function Lr() {
|
|
|
2618
2702
|
return u + n.createNmeaChecksumFooter(u);
|
|
2619
2703
|
}
|
|
2620
2704
|
e.encodePacket = o;
|
|
2621
|
-
})(
|
|
2705
|
+
})(ie)), ie;
|
|
2622
2706
|
}
|
|
2623
|
-
var
|
|
2624
|
-
function
|
|
2625
|
-
return
|
|
2626
|
-
var t =
|
|
2707
|
+
var oe = {}, Dt;
|
|
2708
|
+
function jr() {
|
|
2709
|
+
return Dt || (Dt = 1, (function(e) {
|
|
2710
|
+
var t = oe && oe.__assign || function() {
|
|
2627
2711
|
return t = Object.assign || function(s) {
|
|
2628
2712
|
for (var a, c = 1, u = arguments.length; c < u; c++) {
|
|
2629
2713
|
a = arguments[c];
|
|
@@ -2633,7 +2717,7 @@ function xr() {
|
|
|
2633
2717
|
}, t.apply(this, arguments);
|
|
2634
2718
|
};
|
|
2635
2719
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
2636
|
-
var n =
|
|
2720
|
+
var n = P(), r = w();
|
|
2637
2721
|
e.sentenceId = "DTM", e.sentenceName = "Datum reference";
|
|
2638
2722
|
function i(s, a) {
|
|
2639
2723
|
return t(t({}, r.initStubFields(s, e.sentenceId, e.sentenceName)), { datumCode: o(a[1]), datumSubcode: a[2] || void 0, offsetLatitude: n.parseLatitude(a[3], a[4]), offsetLongitude: n.parseLongitude(a[5], a[6]), offsetAltitudeMeters: n.parseFloatSafe(a[7]), datumName: o(a[8]) });
|
|
@@ -2642,12 +2726,12 @@ function xr() {
|
|
|
2642
2726
|
function o(s) {
|
|
2643
2727
|
return s === "W84" ? "W84" : s === "W72" ? "W72" : s === "S85" ? "S85" : s === "P90" ? "P90" : s === "999" ? "999" : "";
|
|
2644
2728
|
}
|
|
2645
|
-
})(
|
|
2729
|
+
})(oe)), oe;
|
|
2646
2730
|
}
|
|
2647
|
-
var
|
|
2648
|
-
function
|
|
2649
|
-
return
|
|
2650
|
-
var t =
|
|
2731
|
+
var ae = {}, Et;
|
|
2732
|
+
function Gr() {
|
|
2733
|
+
return Et || (Et = 1, (function(e) {
|
|
2734
|
+
var t = ae && ae.__assign || function() {
|
|
2651
2735
|
return t = Object.assign || function(a) {
|
|
2652
2736
|
for (var c, u = 1, f = arguments.length; u < f; u++) {
|
|
2653
2737
|
c = arguments[u];
|
|
@@ -2657,7 +2741,7 @@ function qr() {
|
|
|
2657
2741
|
}, t.apply(this, arguments);
|
|
2658
2742
|
};
|
|
2659
2743
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
2660
|
-
var n =
|
|
2744
|
+
var n = P(), r = w();
|
|
2661
2745
|
e.sentenceId = "GGA", e.sentenceName = "Global positioning system fix data";
|
|
2662
2746
|
var i = ["none", "fix", "delta", "pps", "rtk", "frtk", "estimated", "manual", "simulation"];
|
|
2663
2747
|
function o(a, c) {
|
|
@@ -2671,12 +2755,12 @@ function qr() {
|
|
|
2671
2755
|
return f + n.createNmeaChecksumFooter(f);
|
|
2672
2756
|
}
|
|
2673
2757
|
e.encodePacket = s;
|
|
2674
|
-
})(
|
|
2758
|
+
})(ae)), ae;
|
|
2675
2759
|
}
|
|
2676
|
-
var
|
|
2677
|
-
function
|
|
2678
|
-
return
|
|
2679
|
-
var t =
|
|
2760
|
+
var ce = {}, At;
|
|
2761
|
+
function Lr() {
|
|
2762
|
+
return At || (At = 1, (function(e) {
|
|
2763
|
+
var t = ce && ce.__assign || function() {
|
|
2680
2764
|
return t = Object.assign || function(s) {
|
|
2681
2765
|
for (var a, c = 1, u = arguments.length; c < u; c++) {
|
|
2682
2766
|
a = arguments[c];
|
|
@@ -2686,7 +2770,7 @@ function Ur() {
|
|
|
2686
2770
|
}, t.apply(this, arguments);
|
|
2687
2771
|
};
|
|
2688
2772
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
2689
|
-
var n =
|
|
2773
|
+
var n = P(), r = w();
|
|
2690
2774
|
e.sentenceId = "GLL", e.sentenceName = "Geographic position - latitude and longitude";
|
|
2691
2775
|
function i(s, a) {
|
|
2692
2776
|
return t(t({}, r.initStubFields(s, e.sentenceId, e.sentenceName)), { latitude: n.parseLatitude(a[1], a[2]), longitude: n.parseLongitude(a[3], a[4]), time: n.parseTime(a[5]), status: a[6] === "A" ? "valid" : "invalid", faaMode: a[7] });
|
|
@@ -2699,12 +2783,12 @@ function Ur() {
|
|
|
2699
2783
|
return u + n.createNmeaChecksumFooter(u);
|
|
2700
2784
|
}
|
|
2701
2785
|
e.encodePacket = o;
|
|
2702
|
-
})(
|
|
2786
|
+
})(ce)), ce;
|
|
2703
2787
|
}
|
|
2704
|
-
var
|
|
2705
|
-
function
|
|
2706
|
-
return
|
|
2707
|
-
var t =
|
|
2788
|
+
var ue = {}, Mt;
|
|
2789
|
+
function xr() {
|
|
2790
|
+
return Mt || (Mt = 1, (function(e) {
|
|
2791
|
+
var t = ue && ue.__assign || function() {
|
|
2708
2792
|
return t = Object.assign || function(s) {
|
|
2709
2793
|
for (var a, c = 1, u = arguments.length; c < u; c++) {
|
|
2710
2794
|
a = arguments[c];
|
|
@@ -2714,7 +2798,7 @@ function Hr() {
|
|
|
2714
2798
|
}, t.apply(this, arguments);
|
|
2715
2799
|
};
|
|
2716
2800
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
2717
|
-
var n =
|
|
2801
|
+
var n = P(), r = w();
|
|
2718
2802
|
e.sentenceId = "GNS", e.sentenceName = "GNSS fix data";
|
|
2719
2803
|
function i(s, a) {
|
|
2720
2804
|
return t(t({}, r.initStubFields(s, e.sentenceId, e.sentenceName)), { time: n.parseTime(a[1]), latitude: n.parseLatitude(a[2], a[3]), longitude: n.parseLongitude(a[4], a[5]), modeIndicator: a[6], satellitesInView: n.parseIntSafe(a[7]), horizontalDilution: n.parseFloatSafe(a[8]), altitudeMeters: n.parseFloatSafe(a[9]), geoidalSeperation: n.parseFloatSafe(a[10]), differentialAge: n.parseFloatSafe(a[11]), differentialRefStn: a[12] });
|
|
@@ -2727,12 +2811,12 @@ function Hr() {
|
|
|
2727
2811
|
return u + n.createNmeaChecksumFooter(u);
|
|
2728
2812
|
}
|
|
2729
2813
|
e.encodePacket = o;
|
|
2730
|
-
})(
|
|
2814
|
+
})(ue)), ue;
|
|
2731
2815
|
}
|
|
2732
|
-
var
|
|
2733
|
-
function
|
|
2816
|
+
var de = {}, Ot;
|
|
2817
|
+
function qr() {
|
|
2734
2818
|
return Ot || (Ot = 1, (function(e) {
|
|
2735
|
-
var t =
|
|
2819
|
+
var t = de && de.__assign || function() {
|
|
2736
2820
|
return t = Object.assign || function(s) {
|
|
2737
2821
|
for (var a, c = 1, u = arguments.length; c < u; c++) {
|
|
2738
2822
|
a = arguments[c];
|
|
@@ -2742,7 +2826,7 @@ function Wr() {
|
|
|
2742
2826
|
}, t.apply(this, arguments);
|
|
2743
2827
|
};
|
|
2744
2828
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
2745
|
-
var n =
|
|
2829
|
+
var n = P(), r = w();
|
|
2746
2830
|
e.sentenceId = "GSA", e.sentenceName = "Active satellites and dilution of precision";
|
|
2747
2831
|
var i = ["unknown", "none", "2D", "3D"];
|
|
2748
2832
|
function o(s, a) {
|
|
@@ -2751,12 +2835,12 @@ function Wr() {
|
|
|
2751
2835
|
return t(t({}, r.initStubFields(s, e.sentenceId, e.sentenceName)), { selectionMode: a[1] === "A" ? "automatic" : "manual", fixMode: i[n.parseIntSafe(a[2])], satellites: c, PDOP: n.parseFloatSafe(a[15]), HDOP: n.parseFloatSafe(a[16]), VDOP: n.parseFloatSafe(a[17]) });
|
|
2752
2836
|
}
|
|
2753
2837
|
e.decodeSentence = o;
|
|
2754
|
-
})(
|
|
2838
|
+
})(de)), de;
|
|
2755
2839
|
}
|
|
2756
|
-
var
|
|
2757
|
-
function
|
|
2758
|
-
return
|
|
2759
|
-
var t =
|
|
2840
|
+
var fe = {}, Ft;
|
|
2841
|
+
function Wr() {
|
|
2842
|
+
return Ft || (Ft = 1, (function(e) {
|
|
2843
|
+
var t = fe && fe.__assign || function() {
|
|
2760
2844
|
return t = Object.assign || function(o) {
|
|
2761
2845
|
for (var s, a = 1, c = arguments.length; a < c; a++) {
|
|
2762
2846
|
s = arguments[a];
|
|
@@ -2766,18 +2850,18 @@ function Br() {
|
|
|
2766
2850
|
}, t.apply(this, arguments);
|
|
2767
2851
|
};
|
|
2768
2852
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
2769
|
-
var n =
|
|
2853
|
+
var n = P(), r = w();
|
|
2770
2854
|
e.sentenceId = "GST", e.sentenceName = "GPS pseudorange noise statistics";
|
|
2771
2855
|
function i(o, s) {
|
|
2772
2856
|
return t(t({}, r.initStubFields(o, e.sentenceId, e.sentenceName)), { time: n.parseTime(s[1]), totalRms: n.parseFloatSafe(s[2]), semiMajorError: n.parseFloatSafe(s[3]), semiMinorError: n.parseFloatSafe(s[4]), orientationOfSemiMajorError: n.parseFloatSafe(s[5]), latitudeError: n.parseFloatSafe(s[6]), longitudeError: n.parseFloatSafe(s[7]), altitudeError: n.parseFloatSafe(s[8]) });
|
|
2773
2857
|
}
|
|
2774
2858
|
e.decodeSentence = i;
|
|
2775
|
-
})(
|
|
2859
|
+
})(fe)), fe;
|
|
2776
2860
|
}
|
|
2777
|
-
var
|
|
2778
|
-
function
|
|
2861
|
+
var le = {}, Ct;
|
|
2862
|
+
function Br() {
|
|
2779
2863
|
return Ct || (Ct = 1, (function(e) {
|
|
2780
|
-
var t =
|
|
2864
|
+
var t = le && le.__assign || function() {
|
|
2781
2865
|
return t = Object.assign || function(o) {
|
|
2782
2866
|
for (var s, a = 1, c = arguments.length; a < c; a++) {
|
|
2783
2867
|
s = arguments[a];
|
|
@@ -2787,7 +2871,7 @@ function Vr() {
|
|
|
2787
2871
|
}, t.apply(this, arguments);
|
|
2788
2872
|
};
|
|
2789
2873
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
2790
|
-
var n =
|
|
2874
|
+
var n = P(), r = w();
|
|
2791
2875
|
e.sentenceId = "GSV", e.sentenceName = "Satellites in view";
|
|
2792
2876
|
function i(o, s) {
|
|
2793
2877
|
for (var a = (s.length - 4) / 4, c = [], u = 0; u < a; u++) {
|
|
@@ -2802,12 +2886,12 @@ function Vr() {
|
|
|
2802
2886
|
return t(t({}, r.initStubFields(o, e.sentenceId, e.sentenceName)), { numberOfMessages: n.parseIntSafe(s[1]), messageNumber: n.parseIntSafe(s[2]), satellitesInView: n.parseIntSafe(s[3]), satellites: c });
|
|
2803
2887
|
}
|
|
2804
2888
|
e.decodeSentence = i;
|
|
2805
|
-
})(
|
|
2889
|
+
})(le)), le;
|
|
2806
2890
|
}
|
|
2807
|
-
var
|
|
2808
|
-
function
|
|
2891
|
+
var he = {}, Rt;
|
|
2892
|
+
function Hr() {
|
|
2809
2893
|
return Rt || (Rt = 1, (function(e) {
|
|
2810
|
-
var t =
|
|
2894
|
+
var t = he && he.__assign || function() {
|
|
2811
2895
|
return t = Object.assign || function(o) {
|
|
2812
2896
|
for (var s, a = 1, c = arguments.length; a < c; a++) {
|
|
2813
2897
|
s = arguments[a];
|
|
@@ -2817,18 +2901,18 @@ function Kr() {
|
|
|
2817
2901
|
}, t.apply(this, arguments);
|
|
2818
2902
|
};
|
|
2819
2903
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
2820
|
-
var n =
|
|
2904
|
+
var n = P(), r = w();
|
|
2821
2905
|
e.sentenceId = "HDG", e.sentenceName = "Heading - deviation and variation";
|
|
2822
2906
|
function i(o, s) {
|
|
2823
2907
|
return t(t({}, r.initStubFields(o, e.sentenceId, e.sentenceName)), { heading: n.parseFloatSafe(s[1]), deviation: n.parseFloatSafe(s[2]), deviationDirection: s[3] === "E" ? "E" : s[3] === "W" ? "W" : "", variation: n.parseFloatSafe(s[4]), variationDirection: s[5] === "E" ? "E" : s[5] === "W" ? "W" : "" });
|
|
2824
2908
|
}
|
|
2825
2909
|
e.decodeSentence = i;
|
|
2826
|
-
})(
|
|
2910
|
+
})(he)), he;
|
|
2827
2911
|
}
|
|
2828
|
-
var
|
|
2829
|
-
function
|
|
2830
|
-
return
|
|
2831
|
-
var t =
|
|
2912
|
+
var pe = {}, Nt;
|
|
2913
|
+
function Ur() {
|
|
2914
|
+
return Nt || (Nt = 1, (function(e) {
|
|
2915
|
+
var t = pe && pe.__assign || function() {
|
|
2832
2916
|
return t = Object.assign || function(s) {
|
|
2833
2917
|
for (var a, c = 1, u = arguments.length; c < u; c++) {
|
|
2834
2918
|
a = arguments[c];
|
|
@@ -2838,7 +2922,7 @@ function zr() {
|
|
|
2838
2922
|
}, t.apply(this, arguments);
|
|
2839
2923
|
};
|
|
2840
2924
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
2841
|
-
var n =
|
|
2925
|
+
var n = P(), r = w();
|
|
2842
2926
|
e.sentenceId = "HDM", e.sentenceName = "Heading - magnetic";
|
|
2843
2927
|
function i(s, a) {
|
|
2844
2928
|
return t(t({}, r.initStubFields(s, e.sentenceId, e.sentenceName)), { heading: n.parseFloatSafe(a[1]) });
|
|
@@ -2851,12 +2935,12 @@ function zr() {
|
|
|
2851
2935
|
return u + n.createNmeaChecksumFooter(u);
|
|
2852
2936
|
}
|
|
2853
2937
|
e.encodePacket = o;
|
|
2854
|
-
})(
|
|
2938
|
+
})(pe)), pe;
|
|
2855
2939
|
}
|
|
2856
|
-
var
|
|
2857
|
-
function
|
|
2858
|
-
return
|
|
2859
|
-
var t =
|
|
2940
|
+
var ge = {}, jt;
|
|
2941
|
+
function Vr() {
|
|
2942
|
+
return jt || (jt = 1, (function(e) {
|
|
2943
|
+
var t = ge && ge.__assign || function() {
|
|
2860
2944
|
return t = Object.assign || function(s) {
|
|
2861
2945
|
for (var a, c = 1, u = arguments.length; c < u; c++) {
|
|
2862
2946
|
a = arguments[c];
|
|
@@ -2866,7 +2950,7 @@ function Jr() {
|
|
|
2866
2950
|
}, t.apply(this, arguments);
|
|
2867
2951
|
};
|
|
2868
2952
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
2869
|
-
var n =
|
|
2953
|
+
var n = P(), r = w();
|
|
2870
2954
|
e.sentenceId = "HDT", e.sentenceName = "Heading - true";
|
|
2871
2955
|
function i(s, a) {
|
|
2872
2956
|
return t(t({}, r.initStubFields(s, e.sentenceId, e.sentenceName)), { heading: n.parseFloatSafe(a[1]) });
|
|
@@ -2879,12 +2963,12 @@ function Jr() {
|
|
|
2879
2963
|
return u + n.createNmeaChecksumFooter(u);
|
|
2880
2964
|
}
|
|
2881
2965
|
e.encodePacket = o;
|
|
2882
|
-
})(
|
|
2966
|
+
})(ge)), ge;
|
|
2883
2967
|
}
|
|
2884
|
-
var
|
|
2885
|
-
function
|
|
2886
|
-
return
|
|
2887
|
-
var t =
|
|
2968
|
+
var ve = {}, Gt;
|
|
2969
|
+
function Kr() {
|
|
2970
|
+
return Gt || (Gt = 1, (function(e) {
|
|
2971
|
+
var t = ve && ve.__assign || function() {
|
|
2888
2972
|
return t = Object.assign || function(s) {
|
|
2889
2973
|
for (var a, c = 1, u = arguments.length; c < u; c++) {
|
|
2890
2974
|
a = arguments[c];
|
|
@@ -2894,7 +2978,7 @@ function Yr() {
|
|
|
2894
2978
|
}, t.apply(this, arguments);
|
|
2895
2979
|
};
|
|
2896
2980
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
2897
|
-
var n =
|
|
2981
|
+
var n = P(), r = w();
|
|
2898
2982
|
e.sentenceId = "MTK", e.sentenceName = "Configuration packet";
|
|
2899
2983
|
function i(s, a) {
|
|
2900
2984
|
return t(t({}, r.initStubFields(s, e.sentenceId, e.sentenceName)), { packetType: n.parseIntSafe(s.sentenceId.substr(3)), data: a.slice(1).map(n.parseNumberOrString) });
|
|
@@ -2907,12 +2991,12 @@ function Yr() {
|
|
|
2907
2991
|
return u + n.createNmeaChecksumFooter(u);
|
|
2908
2992
|
}
|
|
2909
2993
|
e.encodePacket = o;
|
|
2910
|
-
})(
|
|
2994
|
+
})(ve)), ve;
|
|
2911
2995
|
}
|
|
2912
|
-
var
|
|
2913
|
-
function
|
|
2914
|
-
return
|
|
2915
|
-
var t =
|
|
2996
|
+
var me = {}, Lt;
|
|
2997
|
+
function zr() {
|
|
2998
|
+
return Lt || (Lt = 1, (function(e) {
|
|
2999
|
+
var t = me && me.__assign || function() {
|
|
2916
3000
|
return t = Object.assign || function(s) {
|
|
2917
3001
|
for (var a, c = 1, u = arguments.length; c < u; c++) {
|
|
2918
3002
|
a = arguments[c];
|
|
@@ -2922,7 +3006,7 @@ function Zr() {
|
|
|
2922
3006
|
}, t.apply(this, arguments);
|
|
2923
3007
|
};
|
|
2924
3008
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
2925
|
-
var n =
|
|
3009
|
+
var n = P(), r = w();
|
|
2926
3010
|
e.sentenceId = "MWV", e.sentenceName = "Wind speed and angle";
|
|
2927
3011
|
function i(s, a) {
|
|
2928
3012
|
return t(t({}, r.initStubFields(s, e.sentenceId, e.sentenceName)), { windAngle: n.parseFloatSafe(a[1]), reference: a[2] === "R" ? "relative" : "true", speed: n.parseFloatSafe(a[3]), units: a[4] === "K" ? "K" : a[4] === "M" ? "M" : "N", status: a[5] === "A" ? "valid" : "invalid" });
|
|
@@ -2935,12 +3019,12 @@ function Zr() {
|
|
|
2935
3019
|
return u + n.createNmeaChecksumFooter(u);
|
|
2936
3020
|
}
|
|
2937
3021
|
e.encodePacket = o;
|
|
2938
|
-
})(
|
|
3022
|
+
})(me)), me;
|
|
2939
3023
|
}
|
|
2940
|
-
var
|
|
2941
|
-
function
|
|
2942
|
-
return
|
|
2943
|
-
var t =
|
|
3024
|
+
var ye = {}, xt;
|
|
3025
|
+
function Jr() {
|
|
3026
|
+
return xt || (xt = 1, (function(e) {
|
|
3027
|
+
var t = ye && ye.__assign || function() {
|
|
2944
3028
|
return t = Object.assign || function(o) {
|
|
2945
3029
|
for (var s, a = 1, c = arguments.length; a < c; a++) {
|
|
2946
3030
|
s = arguments[a];
|
|
@@ -2950,18 +3034,18 @@ function Xr() {
|
|
|
2950
3034
|
}, t.apply(this, arguments);
|
|
2951
3035
|
};
|
|
2952
3036
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
2953
|
-
var n =
|
|
3037
|
+
var n = P(), r = w();
|
|
2954
3038
|
e.sentenceId = "RDID", e.sentenceName = "RDI proprietary heading, pitch, and roll";
|
|
2955
3039
|
function i(o, s) {
|
|
2956
3040
|
return t(t({}, r.initStubFields(o, e.sentenceId, e.sentenceName)), { roll: n.parseFloatSafe(s[1]), pitch: n.parseFloatSafe(s[2]), heading: n.parseFloatSafe(s[3]) });
|
|
2957
3041
|
}
|
|
2958
3042
|
e.decodeSentence = i;
|
|
2959
|
-
})(
|
|
3043
|
+
})(ye)), ye;
|
|
2960
3044
|
}
|
|
2961
|
-
var
|
|
2962
|
-
function
|
|
2963
|
-
return
|
|
2964
|
-
var t =
|
|
3045
|
+
var Se = {}, qt;
|
|
3046
|
+
function Zr() {
|
|
3047
|
+
return qt || (qt = 1, (function(e) {
|
|
3048
|
+
var t = Se && Se.__assign || function() {
|
|
2965
3049
|
return t = Object.assign || function(o) {
|
|
2966
3050
|
for (var s, a = 1, c = arguments.length; a < c; a++) {
|
|
2967
3051
|
s = arguments[a];
|
|
@@ -2971,18 +3055,18 @@ function Qr() {
|
|
|
2971
3055
|
}, t.apply(this, arguments);
|
|
2972
3056
|
};
|
|
2973
3057
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
2974
|
-
var n =
|
|
3058
|
+
var n = P(), r = w();
|
|
2975
3059
|
e.sentenceId = "RMC", e.sentenceName = "Recommended minimum navigation information";
|
|
2976
3060
|
function i(o, s) {
|
|
2977
3061
|
return t(t({}, r.initStubFields(o, e.sentenceId, e.sentenceName)), { datetime: n.parseDatetime(s[9], s[1]), status: s[2] === "A" ? "valid" : "warning", latitude: n.parseLatitude(s[3], s[4]), longitude: n.parseLongitude(s[5], s[6]), speedKnots: n.parseFloatSafe(s[7]), trackTrue: n.parseFloatSafe(s[8]), variation: n.parseFloatSafe(s[10]), variationPole: s[11] === "E" ? "E" : s[11] === "W" ? "W" : "", faaMode: s[12] });
|
|
2978
3062
|
}
|
|
2979
3063
|
e.decodeSentence = i;
|
|
2980
|
-
})(
|
|
3064
|
+
})(Se)), Se;
|
|
2981
3065
|
}
|
|
2982
|
-
var
|
|
2983
|
-
function
|
|
2984
|
-
return
|
|
2985
|
-
var t =
|
|
3066
|
+
var _e = {}, Wt;
|
|
3067
|
+
function Yr() {
|
|
3068
|
+
return Wt || (Wt = 1, (function(e) {
|
|
3069
|
+
var t = _e && _e.__assign || function() {
|
|
2986
3070
|
return t = Object.assign || function(o) {
|
|
2987
3071
|
for (var s, a = 1, c = arguments.length; a < c; a++) {
|
|
2988
3072
|
s = arguments[a];
|
|
@@ -2992,18 +3076,18 @@ function $r() {
|
|
|
2992
3076
|
}, t.apply(this, arguments);
|
|
2993
3077
|
};
|
|
2994
3078
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
2995
|
-
var n =
|
|
3079
|
+
var n = P(), r = w();
|
|
2996
3080
|
e.sentenceId = "VHW", e.sentenceName = "Water speed and heading";
|
|
2997
3081
|
function i(o, s) {
|
|
2998
3082
|
return t(t({}, r.initStubFields(o, e.sentenceId, e.sentenceName)), { degreesTrue: n.parseFloatSafe(s[1]), degreesMagnetic: n.parseFloatSafe(s[3]), speedKnots: n.parseFloatSafe(s[5]), speedKmph: n.parseFloatSafe(s[7]) });
|
|
2999
3083
|
}
|
|
3000
3084
|
e.decodeSentence = i;
|
|
3001
|
-
})(
|
|
3085
|
+
})(_e)), _e;
|
|
3002
3086
|
}
|
|
3003
|
-
var
|
|
3004
|
-
function
|
|
3005
|
-
return
|
|
3006
|
-
var t =
|
|
3087
|
+
var be = {}, Bt;
|
|
3088
|
+
function Xr() {
|
|
3089
|
+
return Bt || (Bt = 1, (function(e) {
|
|
3090
|
+
var t = be && be.__assign || function() {
|
|
3007
3091
|
return t = Object.assign || function(s) {
|
|
3008
3092
|
for (var a, c = 1, u = arguments.length; c < u; c++) {
|
|
3009
3093
|
a = arguments[c];
|
|
@@ -3013,7 +3097,7 @@ function es() {
|
|
|
3013
3097
|
}, t.apply(this, arguments);
|
|
3014
3098
|
};
|
|
3015
3099
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
3016
|
-
var n =
|
|
3100
|
+
var n = P(), r = w();
|
|
3017
3101
|
e.sentenceId = "VTG", e.sentenceName = "Track made good and ground speed";
|
|
3018
3102
|
function i(s, a) {
|
|
3019
3103
|
return t(t({}, r.initStubFields(s, e.sentenceId, e.sentenceName)), { trackTrue: n.parseFloatSafe(a[1]), trackMagnetic: n.parseFloatSafe(a[3]), speedKnots: n.parseFloatSafe(a[5]), speedKmph: n.parseFloatSafe(a[7]), faaMode: a[9] });
|
|
@@ -3026,12 +3110,12 @@ function es() {
|
|
|
3026
3110
|
return u + n.createNmeaChecksumFooter(u);
|
|
3027
3111
|
}
|
|
3028
3112
|
e.encodePacket = o;
|
|
3029
|
-
})(
|
|
3113
|
+
})(be)), be;
|
|
3030
3114
|
}
|
|
3031
|
-
var
|
|
3032
|
-
function
|
|
3033
|
-
return
|
|
3034
|
-
var t =
|
|
3115
|
+
var Te = {}, Ht;
|
|
3116
|
+
function Qr() {
|
|
3117
|
+
return Ht || (Ht = 1, (function(e) {
|
|
3118
|
+
var t = Te && Te.__assign || function() {
|
|
3035
3119
|
return t = Object.assign || function(o) {
|
|
3036
3120
|
for (var s, a = 1, c = arguments.length; a < c; a++) {
|
|
3037
3121
|
s = arguments[a];
|
|
@@ -3041,18 +3125,18 @@ function ts() {
|
|
|
3041
3125
|
}, t.apply(this, arguments);
|
|
3042
3126
|
};
|
|
3043
3127
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
3044
|
-
var n =
|
|
3128
|
+
var n = P(), r = w();
|
|
3045
3129
|
e.sentenceId = "ZDA", e.sentenceName = "UTC, day, month, year, and local time zone";
|
|
3046
3130
|
function i(o, s) {
|
|
3047
3131
|
return t(t({}, r.initStubFields(o, e.sentenceId, e.sentenceName)), { datetime: n.parseTime(s[1], s.slice(2, 5).join("")), localZoneHours: n.parseIntSafe(s[5]), localZoneMinutes: n.parseIntSafe(s[6]) });
|
|
3048
3132
|
}
|
|
3049
3133
|
e.decodeSentence = i;
|
|
3050
|
-
})(
|
|
3134
|
+
})(Te)), Te;
|
|
3051
3135
|
}
|
|
3052
|
-
var
|
|
3053
|
-
function
|
|
3054
|
-
return
|
|
3055
|
-
var t =
|
|
3136
|
+
var Ie = {}, Ut;
|
|
3137
|
+
function vn() {
|
|
3138
|
+
return Ut || (Ut = 1, (function(e) {
|
|
3139
|
+
var t = Ie && Ie.__assign || function() {
|
|
3056
3140
|
return t = Object.assign || function(i) {
|
|
3057
3141
|
for (var o, s = 1, a = arguments.length; s < a; s++) {
|
|
3058
3142
|
o = arguments[s];
|
|
@@ -3068,30 +3152,30 @@ function yn() {
|
|
|
3068
3152
|
return t(t({}, n.initStubFields(i, e.sentenceId)), { originalPacketId: i.sentenceId, dataFields: o.slice(1) });
|
|
3069
3153
|
}
|
|
3070
3154
|
e.decodeSentence = r;
|
|
3071
|
-
})(
|
|
3072
|
-
}
|
|
3073
|
-
var
|
|
3074
|
-
function
|
|
3075
|
-
if (
|
|
3076
|
-
|
|
3077
|
-
var e =
|
|
3078
|
-
var _ = function(b,
|
|
3079
|
-
return _ = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(
|
|
3080
|
-
|
|
3081
|
-
} || function(
|
|
3082
|
-
for (var
|
|
3083
|
-
}, _(b,
|
|
3155
|
+
})(Ie)), Ie;
|
|
3156
|
+
}
|
|
3157
|
+
var Vt;
|
|
3158
|
+
function $r() {
|
|
3159
|
+
if (Vt) return O;
|
|
3160
|
+
Vt = 1;
|
|
3161
|
+
var e = O && O.__extends || /* @__PURE__ */ (function() {
|
|
3162
|
+
var _ = function(b, k) {
|
|
3163
|
+
return _ = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(E, L) {
|
|
3164
|
+
E.__proto__ = L;
|
|
3165
|
+
} || function(E, L) {
|
|
3166
|
+
for (var z in L) L.hasOwnProperty(z) && (E[z] = L[z]);
|
|
3167
|
+
}, _(b, k);
|
|
3084
3168
|
};
|
|
3085
|
-
return function(b,
|
|
3086
|
-
_(b,
|
|
3087
|
-
function
|
|
3169
|
+
return function(b, k) {
|
|
3170
|
+
_(b, k);
|
|
3171
|
+
function E() {
|
|
3088
3172
|
this.constructor = b;
|
|
3089
3173
|
}
|
|
3090
|
-
b.prototype =
|
|
3174
|
+
b.prototype = k === null ? Object.create(k) : (E.prototype = k.prototype, new E());
|
|
3091
3175
|
};
|
|
3092
3176
|
})();
|
|
3093
|
-
Object.defineProperty(
|
|
3094
|
-
var t =
|
|
3177
|
+
Object.defineProperty(O, "__esModule", { value: !0 });
|
|
3178
|
+
var t = Cr(), n = Rr(), r = Nr(), i = jr(), o = Gr(), s = Lr(), a = xr(), c = qr(), u = Wr(), f = Br(), l = Hr(), d = Ur(), p = Vr(), g = Kr(), y = zr(), I = Jr(), C = Zr(), R = Yr(), V = Xr(), Le = Qr(), ee = w(), xe = vn(), qe = P(), We = {
|
|
3095
3179
|
APB: t.decodeSentence,
|
|
3096
3180
|
BWC: n.decodeSentence,
|
|
3097
3181
|
DBT: r.decodeSentence,
|
|
@@ -3105,23 +3189,23 @@ function ns() {
|
|
|
3105
3189
|
HDG: l.decodeSentence,
|
|
3106
3190
|
HDM: d.decodeSentence,
|
|
3107
3191
|
HDT: p.decodeSentence,
|
|
3108
|
-
MTK:
|
|
3192
|
+
MTK: g.decodeSentence,
|
|
3109
3193
|
MWV: y.decodeSentence,
|
|
3110
3194
|
RDID: I.decodeSentence,
|
|
3111
|
-
RMC:
|
|
3112
|
-
VHW:
|
|
3113
|
-
VTG:
|
|
3114
|
-
ZDA:
|
|
3115
|
-
},
|
|
3195
|
+
RMC: C.decodeSentence,
|
|
3196
|
+
VHW: R.decodeSentence,
|
|
3197
|
+
VTG: V.decodeSentence,
|
|
3198
|
+
ZDA: Le.decodeSentence
|
|
3199
|
+
}, Be = {
|
|
3116
3200
|
DBT: r.encodePacket,
|
|
3117
3201
|
GGA: o.encodePacket,
|
|
3118
3202
|
GLL: s.encodePacket,
|
|
3119
3203
|
GNS: a.encodePacket,
|
|
3120
3204
|
HDM: d.encodePacket,
|
|
3121
3205
|
HDT: p.encodePacket,
|
|
3122
|
-
MTK:
|
|
3206
|
+
MTK: g.encodePacket,
|
|
3123
3207
|
MWV: y.encodePacket,
|
|
3124
|
-
VTG:
|
|
3208
|
+
VTG: V.encodePacket
|
|
3125
3209
|
}, h = (
|
|
3126
3210
|
/** @class */
|
|
3127
3211
|
(function() {
|
|
@@ -3129,264 +3213,135 @@ function ns() {
|
|
|
3129
3213
|
b === void 0 && (b = !1), this.ableToParseBadChecksum = b;
|
|
3130
3214
|
}
|
|
3131
3215
|
return _.getParser = function(b) {
|
|
3132
|
-
return b.sentenceId.substr(0, 3) === "MTK" ?
|
|
3133
|
-
}, _.prototype.assemble = function(b,
|
|
3134
|
-
var
|
|
3135
|
-
return
|
|
3136
|
-
}, _.prototype.assembleCustomPacket = function(b,
|
|
3216
|
+
return b.sentenceId.substr(0, 3) === "MTK" ? g.decodeSentence : We[b.sentenceId];
|
|
3217
|
+
}, _.prototype.assemble = function(b, k) {
|
|
3218
|
+
var E = _.getParser(b);
|
|
3219
|
+
return E ? E(b, k) : this.assembleCustomPacket(b, k);
|
|
3220
|
+
}, _.prototype.assembleCustomPacket = function(b, k) {
|
|
3137
3221
|
return null;
|
|
3138
3222
|
}, _;
|
|
3139
3223
|
})()
|
|
3140
3224
|
);
|
|
3141
|
-
|
|
3142
|
-
var
|
|
3143
|
-
function
|
|
3144
|
-
var
|
|
3145
|
-
if (!
|
|
3225
|
+
O.DefaultPacketFactory = h;
|
|
3226
|
+
var v = new h();
|
|
3227
|
+
function m(_, b) {
|
|
3228
|
+
var k = !0;
|
|
3229
|
+
if (!qe.validNmeaChecksum(_)) {
|
|
3146
3230
|
if (!b.ableToParseBadChecksum)
|
|
3147
3231
|
throw Error('Invalid sentence: "' + _ + '".');
|
|
3148
|
-
|
|
3232
|
+
k = !1;
|
|
3149
3233
|
}
|
|
3150
|
-
var
|
|
3151
|
-
if (!
|
|
3152
|
-
throw Error('No known parser for sentence ID "' +
|
|
3153
|
-
return
|
|
3234
|
+
var E = _.split("*")[0].split(","), L = ee.parseStub(E[0], k), z = b.assemble(L, E);
|
|
3235
|
+
if (!z)
|
|
3236
|
+
throw Error('No known parser for sentence ID "' + L.sentenceId + '".');
|
|
3237
|
+
return z;
|
|
3154
3238
|
}
|
|
3155
|
-
|
|
3239
|
+
O.parseGenericPacket = m;
|
|
3156
3240
|
function S(_) {
|
|
3157
|
-
return
|
|
3241
|
+
return m(_, v);
|
|
3158
3242
|
}
|
|
3159
|
-
|
|
3243
|
+
O.parseNmeaSentence = S;
|
|
3160
3244
|
function D(_, b) {
|
|
3161
3245
|
if (b === void 0 && (b = "P"), _ === void 0)
|
|
3162
3246
|
throw new Error("Packet must be given.");
|
|
3163
|
-
var
|
|
3164
|
-
if (
|
|
3165
|
-
return
|
|
3247
|
+
var k = Be[_.sentenceId];
|
|
3248
|
+
if (k)
|
|
3249
|
+
return k(_, b);
|
|
3166
3250
|
throw Error('No known encoder for sentence ID "' + _.sentenceId + '"');
|
|
3167
3251
|
}
|
|
3168
|
-
|
|
3169
|
-
var
|
|
3252
|
+
O.encodeNmeaPacket = D;
|
|
3253
|
+
var M = (
|
|
3170
3254
|
/** @class */
|
|
3171
3255
|
(function(_) {
|
|
3172
3256
|
e(b, _);
|
|
3173
3257
|
function b() {
|
|
3174
3258
|
return _.call(this, !0) || this;
|
|
3175
3259
|
}
|
|
3176
|
-
return b.prototype.assembleCustomPacket = function(
|
|
3177
|
-
return
|
|
3260
|
+
return b.prototype.assembleCustomPacket = function(k, E) {
|
|
3261
|
+
return xe.decodeSentence(k, E);
|
|
3178
3262
|
}, b;
|
|
3179
3263
|
})(h)
|
|
3180
3264
|
);
|
|
3181
|
-
|
|
3182
|
-
var
|
|
3183
|
-
function
|
|
3184
|
-
return
|
|
3265
|
+
O.UnsafePacketFactory = M;
|
|
3266
|
+
var N = new M();
|
|
3267
|
+
function K(_) {
|
|
3268
|
+
return m(_, N);
|
|
3185
3269
|
}
|
|
3186
|
-
|
|
3187
|
-
function
|
|
3270
|
+
O.parseUnsafeNmeaSentence = K;
|
|
3271
|
+
function W(_) {
|
|
3188
3272
|
return _.sentenceId === "?" ? _.originalPacketId : _.sentenceId;
|
|
3189
3273
|
}
|
|
3190
|
-
return
|
|
3191
|
-
}
|
|
3192
|
-
var Le = ns(), rs = yn(), dt = w();
|
|
3193
|
-
const zt = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"];
|
|
3194
|
-
function ss(e) {
|
|
3195
|
-
const t = e >> 4 & 15, n = e >> 0 & 15;
|
|
3196
|
-
return zt[t] + zt[n];
|
|
3197
|
-
}
|
|
3198
|
-
function G(e, t, n) {
|
|
3199
|
-
let r = typeof e == "string" ? e : e.toFixed(0);
|
|
3200
|
-
for (; r.length < t; )
|
|
3201
|
-
r = n + r;
|
|
3202
|
-
return r;
|
|
3203
|
-
}
|
|
3204
|
-
function Ls(e) {
|
|
3205
|
-
const [t, n] = e.split("*"), r = Sn(t), i = Number.parseInt(n, 16);
|
|
3206
|
-
return r === i;
|
|
3207
|
-
}
|
|
3208
|
-
function Sn(e) {
|
|
3209
|
-
let t = e.charCodeAt(1);
|
|
3210
|
-
for (let n = 2; n < e.length; n += 1)
|
|
3211
|
-
t = t ^ e.charCodeAt(n);
|
|
3212
|
-
return t = t & 255, t;
|
|
3213
|
-
}
|
|
3214
|
-
function is(e) {
|
|
3215
|
-
return `*${ss(Sn(e))}`;
|
|
3216
|
-
}
|
|
3217
|
-
function xs(e) {
|
|
3218
|
-
return e + is(e);
|
|
3219
|
-
}
|
|
3220
|
-
function qs(e, t) {
|
|
3221
|
-
return e === void 0 ? "" : e.toFixed(t);
|
|
3222
|
-
}
|
|
3223
|
-
function Us(e) {
|
|
3224
|
-
if (e === void 0)
|
|
3225
|
-
return ",";
|
|
3226
|
-
let t;
|
|
3227
|
-
e < 0 ? (t = "S", e = -e) : t = "N";
|
|
3228
|
-
const n = Math.floor(e);
|
|
3229
|
-
let r = G(n, 2, "0");
|
|
3230
|
-
const o = (e - n) * 60, s = G(o.toFixed(6), 9, "0");
|
|
3231
|
-
return r = `${r + s},${t}`, r;
|
|
3232
|
-
}
|
|
3233
|
-
function Hs(e) {
|
|
3234
|
-
if (e === void 0)
|
|
3235
|
-
return ",";
|
|
3236
|
-
let t;
|
|
3237
|
-
e < 0 ? (t = "W", e = -e) : t = "E";
|
|
3238
|
-
const n = Math.floor(e);
|
|
3239
|
-
let r = G(n, 3, "0");
|
|
3240
|
-
const o = (e - n) * 60, s = G(o.toFixed(6), 9, "0");
|
|
3241
|
-
return r = `${r + s},${t}`, r;
|
|
3242
|
-
}
|
|
3243
|
-
function Ws(e) {
|
|
3244
|
-
return e === void 0 ? "," : `${e.toFixed(1)},M`;
|
|
3245
|
-
}
|
|
3246
|
-
function Bs(e) {
|
|
3247
|
-
return e === void 0 ? "" : e.toFixed(1);
|
|
3248
|
-
}
|
|
3249
|
-
function Vs(e) {
|
|
3250
|
-
return e === void 0 ? "," : `${e.toFixed(1)},M`;
|
|
3251
|
-
}
|
|
3252
|
-
function Ks(e) {
|
|
3253
|
-
return e === void 0 ? "" : e.toFixed(1);
|
|
3254
|
-
}
|
|
3255
|
-
function zs(e) {
|
|
3256
|
-
return e === void 0 ? "" : G(e.toFixed(2), 6, "0");
|
|
3257
|
-
}
|
|
3258
|
-
function Js(e) {
|
|
3259
|
-
if (e === void 0)
|
|
3260
|
-
return "";
|
|
3261
|
-
const t = e.getUTCFullYear(), n = e.getUTCMonth() + 1, r = e.getUTCDate();
|
|
3262
|
-
return G(r, 2, "0") + G(n, 2, "0") + t.toFixed(0).substr(2);
|
|
3274
|
+
return O.getUnsafePacketId = W, O;
|
|
3263
3275
|
}
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
return "";
|
|
3267
|
-
const t = e.getUTCHours(), n = e.getUTCMinutes(), r = e.getUTCSeconds();
|
|
3268
|
-
return G(t, 2, "0") + G(n, 2, "0") + G(r, 2, "0");
|
|
3269
|
-
}
|
|
3270
|
-
function Zs(e) {
|
|
3271
|
-
return e === void 0 ? "" : String(e);
|
|
3272
|
-
}
|
|
3273
|
-
function L(e) {
|
|
3276
|
+
var Ge = $r(), es = vn(), ut = w();
|
|
3277
|
+
function G(e) {
|
|
3274
3278
|
return e === "" ? 0 : Number.parseFloat(e);
|
|
3275
3279
|
}
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
}
|
|
3279
|
-
function Qs(e) {
|
|
3280
|
-
if (e === void 0)
|
|
3281
|
-
return "";
|
|
3282
|
-
const t = Number.parseFloat(e);
|
|
3283
|
-
return Number.isNaN(t) ? e : t;
|
|
3284
|
-
}
|
|
3285
|
-
function _n(e) {
|
|
3286
|
-
const t = e.indexOf(".");
|
|
3287
|
-
if (t < 0)
|
|
3288
|
-
return 0;
|
|
3289
|
-
let n, r;
|
|
3290
|
-
return t >= 3 ? (n = e.substring(0, t - 2), r = e.substring(t - 2)) : (n = "0", r = e), Number.parseFloat(n) + Number.parseFloat(r) / 60;
|
|
3291
|
-
}
|
|
3292
|
-
function $s(e, t) {
|
|
3293
|
-
const n = t === "N" ? 1 : -1;
|
|
3294
|
-
return _n(e) * n;
|
|
3295
|
-
}
|
|
3296
|
-
function ei(e, t) {
|
|
3297
|
-
const n = t === "E" ? 1 : -1;
|
|
3298
|
-
return _n(e) * n;
|
|
3299
|
-
}
|
|
3300
|
-
function os(e, t) {
|
|
3301
|
-
if (e.length === 4)
|
|
3302
|
-
return Number(e);
|
|
3303
|
-
if (e.length === 2)
|
|
3304
|
-
if (t) {
|
|
3305
|
-
let n = Number(e);
|
|
3306
|
-
return n < 73 ? n = 2e3 + n : n = 1900 + n, n;
|
|
3307
|
-
} else
|
|
3308
|
-
return +`20${e}`;
|
|
3309
|
-
else
|
|
3310
|
-
throw new Error(`Unexpected year string: ${e}`);
|
|
3311
|
-
}
|
|
3312
|
-
function ti(e, t, n = !1) {
|
|
3313
|
-
if (e === "")
|
|
3314
|
-
return /* @__PURE__ */ new Date(0);
|
|
3315
|
-
const r = /* @__PURE__ */ new Date();
|
|
3316
|
-
if (t) {
|
|
3317
|
-
const a = t.slice(4), c = Number.parseInt(t.slice(2, 4), 10) - 1, u = t.slice(0, 2);
|
|
3318
|
-
r.setUTCFullYear(os(a, n), Number(c), Number(u));
|
|
3319
|
-
}
|
|
3320
|
-
r.setUTCHours(Number(e.slice(0, 2))), r.setUTCMinutes(Number(e.slice(2, 4))), r.setUTCSeconds(Number(e.slice(4, 6)));
|
|
3321
|
-
const i = e.slice(7), o = i.length;
|
|
3322
|
-
let s = 0;
|
|
3323
|
-
return o !== 0 && (s = Number.parseFloat(i) * 10 ** (3 - o)), r.setUTCMilliseconds(Number(s)), r;
|
|
3324
|
-
}
|
|
3325
|
-
const as = "DBK", cs = "Depth Below Keel";
|
|
3326
|
-
function us(e, t) {
|
|
3280
|
+
const ts = "DBK", ns = "Depth Below Keel";
|
|
3281
|
+
function rs(e, t) {
|
|
3327
3282
|
return {
|
|
3328
|
-
...
|
|
3329
|
-
depthFeet:
|
|
3330
|
-
depthMeters:
|
|
3331
|
-
depthFathoms:
|
|
3283
|
+
...ut.initStubFields(e, ts, ns),
|
|
3284
|
+
depthFeet: G(t[1]),
|
|
3285
|
+
depthMeters: G(t[3]),
|
|
3286
|
+
depthFathoms: G(t[5])
|
|
3332
3287
|
};
|
|
3333
3288
|
}
|
|
3334
|
-
const
|
|
3335
|
-
function
|
|
3289
|
+
const ss = "DBS", is = "Depth Below Surface";
|
|
3290
|
+
function os(e, t) {
|
|
3336
3291
|
return {
|
|
3337
|
-
...
|
|
3338
|
-
depthFeet:
|
|
3339
|
-
depthMeters:
|
|
3340
|
-
depthFathoms:
|
|
3292
|
+
...ut.initStubFields(e, ss, is),
|
|
3293
|
+
depthFeet: G(t[1]),
|
|
3294
|
+
depthMeters: G(t[3]),
|
|
3295
|
+
depthFathoms: G(t[5])
|
|
3341
3296
|
};
|
|
3342
3297
|
}
|
|
3343
|
-
const
|
|
3344
|
-
function
|
|
3298
|
+
const as = "DPT", cs = "Depth of Water";
|
|
3299
|
+
function us(e, t) {
|
|
3345
3300
|
return {
|
|
3346
|
-
...
|
|
3347
|
-
depthMeters:
|
|
3348
|
-
offsetMeters:
|
|
3349
|
-
maximumRangeScale:
|
|
3301
|
+
...ut.initStubFields(e, as, cs),
|
|
3302
|
+
depthMeters: G(t[1]),
|
|
3303
|
+
offsetMeters: G(t[2]),
|
|
3304
|
+
maximumRangeScale: G(t[3])
|
|
3350
3305
|
};
|
|
3351
3306
|
}
|
|
3352
|
-
function
|
|
3307
|
+
function mn(e, t) {
|
|
3353
3308
|
switch (e.talkerId) {
|
|
3354
3309
|
case "DBS":
|
|
3355
|
-
return
|
|
3310
|
+
return os(e, t);
|
|
3356
3311
|
case "DBK":
|
|
3357
|
-
return
|
|
3312
|
+
return rs(e, t);
|
|
3358
3313
|
case "DPT":
|
|
3359
|
-
return
|
|
3314
|
+
return us(e, t);
|
|
3360
3315
|
default:
|
|
3361
3316
|
return null;
|
|
3362
3317
|
}
|
|
3363
3318
|
}
|
|
3364
|
-
class
|
|
3319
|
+
class ds extends Ge.DefaultPacketFactory {
|
|
3365
3320
|
assembleCustomPacket(t, n) {
|
|
3366
|
-
return
|
|
3321
|
+
return mn(t, n);
|
|
3367
3322
|
}
|
|
3368
3323
|
}
|
|
3369
|
-
const
|
|
3370
|
-
function
|
|
3371
|
-
return
|
|
3324
|
+
const fs = new ds();
|
|
3325
|
+
function Cs(e) {
|
|
3326
|
+
return Ge.parseGenericPacket(e, fs);
|
|
3372
3327
|
}
|
|
3373
|
-
class
|
|
3328
|
+
class ls extends Ge.DefaultPacketFactory {
|
|
3374
3329
|
constructor() {
|
|
3375
3330
|
super(!0);
|
|
3376
3331
|
}
|
|
3377
3332
|
assembleCustomPacket(t, n) {
|
|
3378
|
-
const r =
|
|
3379
|
-
return r ||
|
|
3333
|
+
const r = mn(t, n);
|
|
3334
|
+
return r || es.decodeSentence(t, n);
|
|
3380
3335
|
}
|
|
3381
3336
|
}
|
|
3382
|
-
const
|
|
3383
|
-
function
|
|
3384
|
-
return
|
|
3337
|
+
const hs = new ls();
|
|
3338
|
+
function ps(e) {
|
|
3339
|
+
return Ge.parseGenericPacket(e, hs);
|
|
3385
3340
|
}
|
|
3386
|
-
function
|
|
3341
|
+
function Kt(e, t) {
|
|
3387
3342
|
return !t || t.length === 0 ? !0 : e !== void 0 && t.includes(e);
|
|
3388
3343
|
}
|
|
3389
|
-
class
|
|
3344
|
+
class gs {
|
|
3390
3345
|
/** Buffer for incomplete lines that span multiple chunks. */
|
|
3391
3346
|
container;
|
|
3392
3347
|
constructor() {
|
|
@@ -3417,7 +3372,7 @@ class bs {
|
|
|
3417
3372
|
this.container = "";
|
|
3418
3373
|
}
|
|
3419
3374
|
}
|
|
3420
|
-
const
|
|
3375
|
+
const vs = hn(async ({ input: e }) => {
|
|
3421
3376
|
if (!navigator.serial)
|
|
3422
3377
|
throw new Error("Web Serial API is not supported in this browser.");
|
|
3423
3378
|
console.log("Requesting serial port...");
|
|
@@ -3431,21 +3386,21 @@ const Ts = vn(async ({ input: e }) => {
|
|
|
3431
3386
|
}
|
|
3432
3387
|
}
|
|
3433
3388
|
return await t.open({ baudRate: e.baudRate }), console.log("Port open."), t;
|
|
3434
|
-
}),
|
|
3389
|
+
}), ms = hn(async ({ input: e }) => {
|
|
3435
3390
|
if (e.port)
|
|
3436
3391
|
try {
|
|
3437
3392
|
(e.port.readable || e.port.writable) && (await e.port.close(), console.log("Port closed successfully."));
|
|
3438
3393
|
} catch (t) {
|
|
3439
3394
|
console.warn("Error closing port:", t);
|
|
3440
3395
|
}
|
|
3441
|
-
}),
|
|
3396
|
+
}), ys = gr(
|
|
3442
3397
|
({ input: e, sendBack: t, receive: n }) => {
|
|
3443
3398
|
const { port: r } = e;
|
|
3444
3399
|
if (!r || !r.readable) {
|
|
3445
3400
|
t({ type: "SERIAL.ERROR", error: "Invalid port context." });
|
|
3446
3401
|
return;
|
|
3447
3402
|
}
|
|
3448
|
-
const i = new
|
|
3403
|
+
const i = new gs(), s = r.readable.pipeThrough(new TextDecoderStream()).pipeThrough(
|
|
3449
3404
|
new TransformStream({
|
|
3450
3405
|
transform: i.transform.bind(i),
|
|
3451
3406
|
flush: i.flush.bind(i)
|
|
@@ -3460,7 +3415,7 @@ const Ts = vn(async ({ input: e }) => {
|
|
|
3460
3415
|
break;
|
|
3461
3416
|
if (u && u.length > 0)
|
|
3462
3417
|
try {
|
|
3463
|
-
const l =
|
|
3418
|
+
const l = ps(u);
|
|
3464
3419
|
if (l.sentenceId === "?")
|
|
3465
3420
|
continue;
|
|
3466
3421
|
t({ type: "SERIAL.DATA", data: l });
|
|
@@ -3490,26 +3445,26 @@ const Ts = vn(async ({ input: e }) => {
|
|
|
3490
3445
|
};
|
|
3491
3446
|
}
|
|
3492
3447
|
);
|
|
3493
|
-
function
|
|
3448
|
+
function Ss(e) {
|
|
3494
3449
|
const { adapter: t, allowedSentenceIds: n, initialData: r, initialPackets: i } = e;
|
|
3495
3450
|
return gn({
|
|
3496
3451
|
actors: {
|
|
3497
|
-
connectToSerial:
|
|
3498
|
-
readNmeaStream:
|
|
3499
|
-
closePort:
|
|
3452
|
+
connectToSerial: vs,
|
|
3453
|
+
readNmeaStream: ys,
|
|
3454
|
+
closePort: ms
|
|
3500
3455
|
},
|
|
3501
3456
|
actions: {
|
|
3502
3457
|
/**
|
|
3503
3458
|
* Sets the serial port in context and clears any error.
|
|
3504
3459
|
*/
|
|
3505
|
-
setPort:
|
|
3460
|
+
setPort: F((o, s) => ({
|
|
3506
3461
|
port: s.port,
|
|
3507
3462
|
error: null
|
|
3508
3463
|
})),
|
|
3509
3464
|
/**
|
|
3510
3465
|
* Sets an error message in context from a connection error.
|
|
3511
3466
|
*/
|
|
3512
|
-
setError:
|
|
3467
|
+
setError: F((o, s) => {
|
|
3513
3468
|
const a = s.error;
|
|
3514
3469
|
let c;
|
|
3515
3470
|
return typeof a == "string" ? c = a : a instanceof Error ? c = a.message || "Failed to connect." : c = String(a) || "Failed to connect.", { error: c };
|
|
@@ -3522,15 +3477,15 @@ function ks(e) {
|
|
|
3522
3477
|
if (!o.enableLogging)
|
|
3523
3478
|
return;
|
|
3524
3479
|
const c = s.packet.sentenceId;
|
|
3525
|
-
|
|
3480
|
+
Kt(c, n) && console.log(`${c} Packet:`, s.packet);
|
|
3526
3481
|
},
|
|
3527
3482
|
/**
|
|
3528
3483
|
* Stores a parsed NMEA packet in context and recomputes data via the adapter.
|
|
3529
3484
|
* Only stores packets with allowed sentence IDs (if filtering is configured).
|
|
3530
3485
|
*/
|
|
3531
|
-
storePacket:
|
|
3486
|
+
storePacket: F(({ context: o }, s) => {
|
|
3532
3487
|
const c = s.packet.sentenceId;
|
|
3533
|
-
if (c &&
|
|
3488
|
+
if (c && Kt(c, n)) {
|
|
3534
3489
|
const u = {
|
|
3535
3490
|
...o.packets,
|
|
3536
3491
|
[c]: s.packet
|
|
@@ -3550,19 +3505,19 @@ function ks(e) {
|
|
|
3550
3505
|
/**
|
|
3551
3506
|
* Sets a serial error message in context.
|
|
3552
3507
|
*/
|
|
3553
|
-
clearError:
|
|
3508
|
+
clearError: F((o, s) => ({
|
|
3554
3509
|
error: s.error
|
|
3555
3510
|
})),
|
|
3556
3511
|
/**
|
|
3557
3512
|
* Sets a fatal error message in context.
|
|
3558
3513
|
*/
|
|
3559
|
-
setFatalError:
|
|
3514
|
+
setFatalError: F((o, s) => ({
|
|
3560
3515
|
error: s.error
|
|
3561
3516
|
})),
|
|
3562
3517
|
/**
|
|
3563
3518
|
* Resets the machine context to disconnected state.
|
|
3564
3519
|
*/
|
|
3565
|
-
disconnect:
|
|
3520
|
+
disconnect: F({
|
|
3566
3521
|
port: null,
|
|
3567
3522
|
error: null,
|
|
3568
3523
|
packets: i,
|
|
@@ -3571,13 +3526,13 @@ function ks(e) {
|
|
|
3571
3526
|
/**
|
|
3572
3527
|
* Sets the logging enabled state.
|
|
3573
3528
|
*/
|
|
3574
|
-
setLogging:
|
|
3529
|
+
setLogging: F((o, s) => ({
|
|
3575
3530
|
enableLogging: s.enabled
|
|
3576
3531
|
})),
|
|
3577
3532
|
/**
|
|
3578
3533
|
* Sets the baud rate for serial communication.
|
|
3579
3534
|
*/
|
|
3580
|
-
setBaudRate:
|
|
3535
|
+
setBaudRate: F((o, s) => ({
|
|
3581
3536
|
baudRate: s.baudRate
|
|
3582
3537
|
}))
|
|
3583
3538
|
}
|
|
@@ -3664,7 +3619,7 @@ function ks(e) {
|
|
|
3664
3619
|
target: "disconnecting"
|
|
3665
3620
|
},
|
|
3666
3621
|
DISCONNECT: {
|
|
3667
|
-
actions:
|
|
3622
|
+
actions: je("streamReader", { type: "STOP" })
|
|
3668
3623
|
}
|
|
3669
3624
|
},
|
|
3670
3625
|
invoke: {
|
|
@@ -3696,7 +3651,7 @@ function ks(e) {
|
|
|
3696
3651
|
}
|
|
3697
3652
|
});
|
|
3698
3653
|
}
|
|
3699
|
-
function
|
|
3654
|
+
function _s(e, t, n) {
|
|
3700
3655
|
return e && e.fixType !== "none" ? {
|
|
3701
3656
|
latitude: e.latitude,
|
|
3702
3657
|
longitude: e.longitude,
|
|
@@ -3717,7 +3672,7 @@ function Ps(e, t, n) {
|
|
|
3717
3672
|
status: "valid"
|
|
3718
3673
|
} : null;
|
|
3719
3674
|
}
|
|
3720
|
-
function
|
|
3675
|
+
function bs(e, t, n, r) {
|
|
3721
3676
|
if (e) {
|
|
3722
3677
|
const i = new Date(e.datetime), o = e.localZoneHours * 60 + e.localZoneMinutes;
|
|
3723
3678
|
return i.setMinutes(i.getMinutes() + o), {
|
|
@@ -3740,119 +3695,89 @@ function Ds(e, t, n, r) {
|
|
|
3740
3695
|
source: "GLL"
|
|
3741
3696
|
} : null;
|
|
3742
3697
|
}
|
|
3743
|
-
function
|
|
3698
|
+
function Ts(e, t) {
|
|
3744
3699
|
return e ? { knots: e.speedKnots, source: "VTG" } : t && t.status === "valid" ? { knots: t.speedKnots, source: "RMC" } : null;
|
|
3745
3700
|
}
|
|
3746
|
-
function
|
|
3701
|
+
function Is(e) {
|
|
3747
3702
|
return e.variationDirection === "W" ? -e.variation : (e.variationDirection === "E", e.variation);
|
|
3748
3703
|
}
|
|
3749
|
-
function
|
|
3704
|
+
function ws(e, t, n, r) {
|
|
3750
3705
|
if (e && e.heading !== void 0)
|
|
3751
3706
|
return { degreesTrue: e.heading, source: "HDT", isDerived: !1 };
|
|
3752
3707
|
if (t && t.heading !== void 0) {
|
|
3753
|
-
const
|
|
3708
|
+
const o = Is(t);
|
|
3754
3709
|
return {
|
|
3755
|
-
degreesTrue: t.heading +
|
|
3710
|
+
degreesTrue: t.heading + o,
|
|
3756
3711
|
source: "HDG",
|
|
3757
3712
|
isDerived: !1
|
|
3758
3713
|
};
|
|
3759
3714
|
}
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
degreesTrue: n.heading + o,
|
|
3763
|
-
source: "HDM",
|
|
3764
|
-
isDerived: !1
|
|
3765
|
-
};
|
|
3766
|
-
const s = r?.trackTrue ?? i?.trackTrue;
|
|
3767
|
-
return s !== void 0 ? { degreesTrue: s, source: "COG", isDerived: !0 } : null;
|
|
3715
|
+
const i = n?.trackTrue ?? r?.trackTrue;
|
|
3716
|
+
return i !== void 0 ? { degreesTrue: i, source: "COG", isDerived: !0 } : null;
|
|
3768
3717
|
}
|
|
3769
|
-
function
|
|
3718
|
+
function Ps(e, t, n, r) {
|
|
3770
3719
|
return e && e.depthMeters !== void 0 ? { meters: e.depthMeters, source: "DPT" } : t ? { meters: t.depthMeters, source: "DBT" } : n && n.depthMeters !== void 0 ? { meters: n.depthMeters, source: "DBS" } : r && r.depthMeters !== void 0 ? { meters: r.depthMeters, source: "DBK" } : null;
|
|
3771
3720
|
}
|
|
3772
|
-
function
|
|
3773
|
-
const
|
|
3774
|
-
|
|
3775
|
-
e.HDG,
|
|
3776
|
-
e.HDM,
|
|
3777
|
-
e.RMC,
|
|
3778
|
-
e.VTG,
|
|
3779
|
-
t
|
|
3780
|
-
), s = Fs(
|
|
3781
|
-
e.DPT,
|
|
3782
|
-
e.DBT,
|
|
3783
|
-
e.DBS,
|
|
3784
|
-
e.DBK
|
|
3785
|
-
);
|
|
3786
|
-
return { time: n, position: r, speed: i, heading: o, depth: s };
|
|
3721
|
+
function ks(e) {
|
|
3722
|
+
const t = bs(e.ZDA, e.GGA, e.RMC, e.GLL), n = _s(e.GGA, e.RMC, e.GLL), r = Ts(e.VTG, e.RMC), i = ws(e.HDT, e.HDG, e.RMC, e.VTG), o = Ps(e.DPT, e.DBT, e.DBS, e.DBK);
|
|
3723
|
+
return { time: t, position: n, speed: r, heading: i, depth: o };
|
|
3787
3724
|
}
|
|
3788
|
-
const
|
|
3725
|
+
const Ds = [
|
|
3789
3726
|
"GGA",
|
|
3790
3727
|
"RMC",
|
|
3791
3728
|
"GLL",
|
|
3792
3729
|
"VTG",
|
|
3793
3730
|
"HDT",
|
|
3794
3731
|
"HDG",
|
|
3795
|
-
"HDM",
|
|
3796
3732
|
"DPT",
|
|
3797
3733
|
"DBT",
|
|
3798
3734
|
"DBS",
|
|
3799
3735
|
"DBK",
|
|
3800
3736
|
"ZDA"
|
|
3801
3737
|
];
|
|
3802
|
-
function
|
|
3803
|
-
return (
|
|
3738
|
+
function Es() {
|
|
3739
|
+
return (e) => ks(e);
|
|
3804
3740
|
}
|
|
3805
|
-
const
|
|
3741
|
+
const As = {
|
|
3806
3742
|
time: null,
|
|
3807
3743
|
position: null,
|
|
3808
3744
|
speed: null,
|
|
3809
3745
|
heading: null,
|
|
3810
3746
|
depth: null
|
|
3811
|
-
},
|
|
3812
|
-
function
|
|
3747
|
+
}, Ms = {};
|
|
3748
|
+
function Os() {
|
|
3813
3749
|
return {
|
|
3814
|
-
adapter:
|
|
3815
|
-
allowedSentenceIds:
|
|
3816
|
-
initialData:
|
|
3817
|
-
initialPackets:
|
|
3750
|
+
adapter: Es(),
|
|
3751
|
+
allowedSentenceIds: Ds,
|
|
3752
|
+
initialData: As,
|
|
3753
|
+
initialPackets: Ms
|
|
3818
3754
|
};
|
|
3819
3755
|
}
|
|
3820
|
-
function
|
|
3821
|
-
return
|
|
3756
|
+
function Fs() {
|
|
3757
|
+
return Ss(Os());
|
|
3758
|
+
}
|
|
3759
|
+
class Rs extends Fr {
|
|
3760
|
+
/**
|
|
3761
|
+
* Creates a new navigation NMEA client.
|
|
3762
|
+
*
|
|
3763
|
+
* @param options - Optional configuration and callbacks.
|
|
3764
|
+
*/
|
|
3765
|
+
constructor(t) {
|
|
3766
|
+
const n = Fs();
|
|
3767
|
+
super(n, {
|
|
3768
|
+
enableLogging: t?.enableLogging,
|
|
3769
|
+
baudRate: t?.baudRate,
|
|
3770
|
+
onData: t?.onData,
|
|
3771
|
+
onStateChange: t?.onStateChange,
|
|
3772
|
+
onError: t?.onError
|
|
3773
|
+
});
|
|
3774
|
+
}
|
|
3822
3775
|
}
|
|
3823
3776
|
export {
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
Cs as
|
|
3829
|
-
|
|
3830
|
-
ri as createNavigationNmeaMachine,
|
|
3831
|
-
is as createNmeaChecksumFooter,
|
|
3832
|
-
ks as createNmeaMachine,
|
|
3833
|
-
Ws as encodeAltitude,
|
|
3834
|
-
Bs as encodeAltitudeNoUnits,
|
|
3835
|
-
Js as encodeDate,
|
|
3836
|
-
zs as encodeDegrees,
|
|
3837
|
-
qs as encodeFixed,
|
|
3838
|
-
Vs as encodeGeoidalSeperation,
|
|
3839
|
-
Ks as encodeGeoidalSeperationNoUnits,
|
|
3840
|
-
Us as encodeLatitude,
|
|
3841
|
-
Hs as encodeLongitude,
|
|
3842
|
-
Ys as encodeTime,
|
|
3843
|
-
Zs as encodeValue,
|
|
3844
|
-
Rs as initialNavigationData,
|
|
3845
|
-
js as initialNavigationPackets,
|
|
3846
|
-
G as padLeft,
|
|
3847
|
-
_n as parseDmCoordinate,
|
|
3848
|
-
L as parseFloatSafe,
|
|
3849
|
-
Xs as parseIntSafe,
|
|
3850
|
-
$s as parseLatitude,
|
|
3851
|
-
ei as parseLongitude,
|
|
3852
|
-
ni as parseNmeaSentence,
|
|
3853
|
-
Qs as parseNumberOrString,
|
|
3854
|
-
ti as parseTime,
|
|
3855
|
-
_s as parseUnsafeNmeaSentence,
|
|
3856
|
-
ss as toHexString,
|
|
3857
|
-
Ls as validNmeaChecksum
|
|
3777
|
+
Rs as NavigationNmeaClient,
|
|
3778
|
+
Fr as NmeaClient,
|
|
3779
|
+
Fs as createNavigationNmeaMachine,
|
|
3780
|
+
Ss as createNmeaMachine,
|
|
3781
|
+
Cs as parseNmeaSentence,
|
|
3782
|
+
ps as parseUnsafeNmeaSentence
|
|
3858
3783
|
};
|