nmea-web-serial 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +19 -0
- package/README.md +0 -0
- package/dist/nmea-web-serial.cjs +4 -0
- package/dist/nmea-web-serial.d.ts +1421 -0
- package/dist/nmea-web-serial.iife.js +4 -0
- package/dist/nmea-web-serial.js +3858 -0
- package/dist/nmea-web-serial.umd.cjs +4 -0
- package/package.json +72 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
(function(y,ne){typeof exports=="object"&&typeof module<"u"?ne(exports):typeof define=="function"&&define.amd?define(["exports"],ne):(y=typeof globalThis<"u"?globalThis:y||self,ne(y.NmeaWebSerial={}))})(this,(function(y){"use strict";function ne(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global}function Cn(){const e=ne();if(e.__xstate__)return e.__xstate__}const Rn=e=>{if(typeof window>"u")return;const t=Cn();t&&t.register(e)};class mt{constructor(t){this._process=t,this._active=!1,this._current=null,this._last=null}start(){this._active=!0,this.flush()}clear(){this._current&&(this._current.next=null,this._last=this._current)}enqueue(t){const n={value:t,next:null};if(this._current){this._last.next=n,this._last=n;return}this._current=n,this._last=n,this._active&&this.flush()}flush(){for(;this._current;){const t=this._current;this._process(t.value),this._current=t.next}this._last=null}}const gt=".",jn="",vt="",Gn="#",Ln="*",yt="xstate.init",Un="xstate.error",re="xstate.stop";function qn(e,t){return{type:`xstate.after.${e}.${t}`}}function He(e,t){return{type:`xstate.done.state.${e}`,output:t}}function Hn(e,t){return{type:`xstate.done.actor.${e}`,output:t,actorId:e}}function St(e,t){return{type:`xstate.error.actor.${e}`,error:t,actorId:e}}function _t(e){return{type:yt,input:e}}function R(e){setTimeout(()=>{throw e})}const xn=typeof Symbol=="function"&&Symbol.observable||"@@observable";function bt(e,t){const n=Tt(e),r=Tt(t);return typeof r=="string"?typeof n=="string"?r===n:!1:typeof n=="string"?n in r:Object.keys(n).every(s=>s in r?bt(n[s],r[s]):!1)}function xe(e){if(kt(e))return e;const t=[];let n="";for(let r=0;r<e.length;r++){switch(e.charCodeAt(r)){case 92:n+=e[r+1],r++;continue;case 46:t.push(n),n="";continue}n+=e[r]}return t.push(n),t}function Tt(e){if(_r(e))return e.value;if(typeof e!="string")return e;const t=xe(e);return Wn(t)}function Wn(e){if(e.length===1)return e[0];const t={};let n=t;for(let r=0;r<e.length-1;r++)if(r===e.length-2)n[e[r]]=e[r+1];else{const s=n;n={},s[e[r]]=n}return t}function It(e,t){const n={},r=Object.keys(e);for(let s=0;s<r.length;s++){const o=r[s];n[o]=t(e[o],o,e,s)}return n}function wt(e){return kt(e)?e:[e]}function q(e){return e===void 0?[]:wt(e)}function We(e,t,n,r){return typeof e=="function"?e({context:t,event:n,self:r}):e}function kt(e){return Array.isArray(e)}function Vn(e){return e.type.startsWith("xstate.error.actor")}function z(e){return wt(e).map(t=>typeof t>"u"||typeof t=="string"?{target:t}:t)}function Dt(e){if(!(e===void 0||e===jn))return q(e)}function Ve(e,t,n){const r=typeof e=="object",s=r?e:void 0;return{next:(r?e.next:e)?.bind(s),error:(r?e.error:t)?.bind(s),complete:(r?e.complete:n)?.bind(s)}}function Pt(e,t){return`${t}.${e}`}function Be(e,t){const n=t.match(/^xstate\.invoke\.(\d+)\.(.*)/);if(!n)return e.implementations.actors[t];const[,r,s]=n,i=e.getStateNodeById(s).config.invoke;return(Array.isArray(i)?i[r]:i).src}function Mt(e,t){return`${e.sessionId}.${t}`}let Bn=0;function Kn(e,t){const n=new Map,r=new Map,s=new WeakMap,o=new Set,i={},{clock:a,logger:c}=t,u={schedule:(d,p,m,S,w=Math.random().toString(36).slice(2))=>{const G={source:d,target:p,event:m,delay:S,id:w,startedAt:Date.now()},L=Mt(d,w);l._snapshot._scheduledEvents[L]=G;const $=a.setTimeout(()=>{delete i[L],delete l._snapshot._scheduledEvents[L],l._relay(d,p,m)},S);i[L]=$},cancel:(d,p)=>{const m=Mt(d,p),S=i[m];delete i[m],delete l._snapshot._scheduledEvents[m],S!==void 0&&a.clearTimeout(S)},cancelAll:d=>{for(const p in l._snapshot._scheduledEvents){const m=l._snapshot._scheduledEvents[p];m.source===d&&u.cancel(d,m.id)}}},f=d=>{if(!o.size)return;const p={...d,rootId:e.sessionId};o.forEach(m=>m.next?.(p))},l={_snapshot:{_scheduledEvents:(t?.snapshot&&t.snapshot.scheduler)??{}},_bookId:()=>`x:${Bn++}`,_register:(d,p)=>(n.set(d,p),d),_unregister:d=>{n.delete(d.sessionId);const p=s.get(d);p!==void 0&&(r.delete(p),s.delete(d))},get:d=>r.get(d),getAll:()=>Object.fromEntries(r.entries()),_set:(d,p)=>{const m=r.get(d);if(m&&m!==p)throw new Error(`Actor with system ID '${d}' already exists.`);r.set(d,p),s.set(p,d)},inspect:d=>{const p=Ve(d);return o.add(p),{unsubscribe(){o.delete(p)}}},_sendInspectionEvent:f,_relay:(d,p,m)=>{l._sendInspectionEvent({type:"@xstate.event",sourceRef:d,actorRef:p,event:m}),p._send(m)},scheduler:u,getSnapshot:()=>({_scheduledEvents:{...l._snapshot._scheduledEvents}}),start:()=>{const d=l._snapshot._scheduledEvents;l._snapshot._scheduledEvents={};for(const p in d){const{source:m,target:S,event:w,delay:G,id:L}=d[p];u.schedule(m,S,w,G,L)}},_clock:a,_logger:c};return l}let Ke=!1;const ze=1;let A=(function(e){return e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped",e})({});const zn={clock:{setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)},logger:console.log.bind(console),devTools:!1};class Jn{constructor(t,n){this.logic=t,this._snapshot=void 0,this.clock=void 0,this.options=void 0,this.id=void 0,this.mailbox=new mt(this._process.bind(this)),this.observers=new Set,this.eventListeners=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=[];const r={...zn,...n},{clock:s,logger:o,parent:i,syncSnapshot:a,id:c,systemId:u,inspect:f}=r;this.system=i?i.system:Kn(this,{clock:s,logger:o}),f&&!i&&this.system.inspect(Ve(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=i,this._syncSnapshot=a,this.options=r,this.src=r.src??t,this.ref=this,this._actorScope={self:this,id:this.id,sessionId:this.sessionId,logger:this.logger,defer:l=>{this._deferred.push(l)},system:this.system,stopChild:l=>{if(l._parent!==this)throw new Error(`Cannot stop child actor ${l.id} of ${this.id} because it is not a child`);l._stop()},emit:l=>{const d=this.eventListeners.get(l.type),p=this.eventListeners.get("*");if(!d&&!p)return;const m=[...d?d.values():[],...p?p.values():[]];for(const S of m)try{S(l)}catch(w){R(w)}},actionExecutor:l=>{const d=()=>{if(this._actorScope.system._sendInspectionEvent({type:"@xstate.action",actorRef:this,action:{type:l.type,params:l.params}}),!l.exec)return;const p=Ke;try{Ke=!0,l.exec(l.info,l.params)}finally{Ke=p}};this._processingStatus===A.Running?d():this._deferred.push(d)}},this.send=this.send.bind(this),this.system._sendInspectionEvent({type:"@xstate.actor",actorRef:this}),u&&(this.systemId=u,this.system._set(u,this)),this._initState(n?.snapshot??n?.state),u&&this._snapshot.status!=="active"&&this.system._unregister(this)}_initState(t){try{this._snapshot=t?this.logic.restoreSnapshot?this.logic.restoreSnapshot(t,this._actorScope):t:this.logic.getInitialSnapshot(this._actorScope,this.options?.input)}catch(n){this._snapshot={status:"error",output:void 0,error:n}}}update(t,n){this._snapshot=t;let r;for(;r=this._deferred.shift();)try{r()}catch(s){this._deferred.length=0,this._snapshot={...t,status:"error",error:s}}switch(this._snapshot.status){case"active":for(const s of this.observers)try{s.next?.(t)}catch(o){R(o)}break;case"done":for(const s of this.observers)try{s.next?.(t)}catch(o){R(o)}this._stopProcedure(),this._complete(),this._doneEvent=Hn(this.id,this._snapshot.output),this._parent&&this.system._relay(this,this._parent,this._doneEvent);break;case"error":this._error(this._snapshot.error);break}this.system._sendInspectionEvent({type:"@xstate.snapshot",actorRef:this,event:n,snapshot:t})}subscribe(t,n,r){const s=Ve(t,n,r);if(this._processingStatus!==A.Stopped)this.observers.add(s);else switch(this._snapshot.status){case"done":try{s.complete?.()}catch(o){R(o)}break;case"error":{const o=this._snapshot.error;if(!s.error)R(o);else try{s.error(o)}catch(i){R(i)}break}}return{unsubscribe:()=>{this.observers.delete(s)}}}on(t,n){let r=this.eventListeners.get(t);r||(r=new Set,this.eventListeners.set(t,r));const s=n.bind(void 0);return r.add(s),{unsubscribe:()=>{r.delete(s)}}}start(){if(this._processingStatus===A.Running)return this;this._syncSnapshot&&this.subscribe({next:r=>{r.status==="active"&&this.system._relay(this,this._parent,{type:`xstate.snapshot.${this.id}`,snapshot:r})},error:()=>{}}),this.system._register(this.sessionId,this),this.systemId&&this.system._set(this.systemId,this),this._processingStatus=A.Running;const t=_t(this.options.input);switch(this.system._sendInspectionEvent({type:"@xstate.event",sourceRef:this._parent,actorRef:this,event:t}),this._snapshot.status){case"done":return this.update(this._snapshot,t),this;case"error":return this._error(this._snapshot.error),this}if(this._parent||this.system.start(),this.logic.start)try{this.logic.start(this._snapshot,this._actorScope)}catch(r){return this._snapshot={...this._snapshot,status:"error",error:r},this._error(r),this}return this.update(this._snapshot,t),this.options.devTools&&this.attachDevTools(),this.mailbox.start(),this}_process(t){let n,r;try{n=this.logic.transition(this._snapshot,t,this._actorScope)}catch(s){r={err:s}}if(r){const{err:s}=r;this._snapshot={...this._snapshot,status:"error",error:s},this._error(s);return}this.update(n,t),t.type===re&&(this._stopProcedure(),this._complete())}_stop(){return this._processingStatus===A.Stopped?this:(this.mailbox.clear(),this._processingStatus===A.NotStarted?(this._processingStatus=A.Stopped,this):(this.mailbox.enqueue({type:re}),this))}stop(){if(this._parent)throw new Error("A non-root actor cannot be stopped directly.");return this._stop()}_complete(){for(const t of this.observers)try{t.complete?.()}catch(n){R(n)}this.observers.clear()}_reportError(t){if(!this.observers.size){this._parent||R(t);return}let n=!1;for(const r of this.observers){const s=r.error;n||=!s;try{s?.(t)}catch(o){R(o)}}this.observers.clear(),n&&R(t)}_error(t){this._stopProcedure(),this._reportError(t),this._parent&&this.system._relay(this,this._parent,St(this.id,t))}_stopProcedure(){return this._processingStatus!==A.Running?this:(this.system.scheduler.cancelAll(this),this.mailbox.clear(),this.mailbox=new mt(this._process.bind(this)),this._processingStatus=A.Stopped,this.system._unregister(this),this)}_send(t){this._processingStatus!==A.Stopped&&this.mailbox.enqueue(t)}send(t){this.system._relay(void 0,this,t)}attachDevTools(){const{devTools:t}=this.options;t&&(typeof t=="function"?t:Rn)(this)}toJSON(){return{xstate$$type:ze,id:this.id}}getPersistedSnapshot(t){return this.logic.getPersistedSnapshot(this._snapshot,t)}[xn](){return this}getSnapshot(){return this._snapshot}}function Ae(e,...[t]){return new Jn(e,t)}function Yn(e,t,n,r,{sendId:s}){const o=typeof s=="function"?s(n,r):s;return[t,{sendId:o},void 0]}function Zn(e,t){e.defer(()=>{e.system.scheduler.cancel(e.self,t.sendId)})}function Je(e){function t(n,r){}return t.type="xstate.cancel",t.sendId=e,t.resolve=Yn,t.execute=Zn,t}function Xn(e,t,n,r,{id:s,systemId:o,src:i,input:a,syncSnapshot:c}){const u=typeof i=="string"?Be(t.machine,i):i,f=typeof s=="function"?s(n):s;let l,d;return u&&(d=typeof a=="function"?a({context:t.context,event:n.event,self:e.self}):a,l=Ae(u,{id:f,src:i,parent:e.self,syncSnapshot:c,systemId:o,input:d})),[B(t,{children:{...t.children,[f]:l}}),{id:s,systemId:o,actorRef:l,src:i,input:d},void 0]}function Qn(e,{actorRef:t}){t&&e.defer(()=>{t._processingStatus!==A.Stopped&&t.start()})}function Ye(...[e,{id:t,systemId:n,input:r,syncSnapshot:s=!1}={}]){function o(i,a){}return o.type="xstate.spawnChild",o.id=t,o.systemId=n,o.src=e,o.input=r,o.syncSnapshot=s,o.resolve=Xn,o.execute=Qn,o}function $n(e,t,n,r,{actorRef:s}){const o=typeof s=="function"?s(n,r):s,i=typeof o=="string"?t.children[o]:o;let a=t.children;return i&&(a={...a},delete a[i.id]),[B(t,{children:a}),i,void 0]}function er(e,t){if(t){if(e.system._unregister(t),t._processingStatus!==A.Running){e.stopChild(t);return}e.defer(()=>{e.stopChild(t)})}}function Ee(e){function t(n,r){}return t.type="xstate.stopChild",t.actorRef=e,t.resolve=$n,t.execute=er,t}function Fe(e,t,n,r){const{machine:s}=r,o=typeof e=="function",i=o?e:s.implementations.guards[typeof e=="string"?e:e.type];if(!o&&!i)throw new Error(`Guard '${typeof e=="string"?e:e.type}' is not implemented.'.`);if(typeof i!="function")return Fe(i,t,n,r);const a={context:t,event:n},c=o||typeof e=="string"?void 0:"params"in e?typeof e.params=="function"?e.params({context:t,event:n}):e.params:void 0;return"check"in i?i.check(r,a,i):i(a,c)}const Ze=e=>e.type==="atomic"||e.type==="final";function J(e){return Object.values(e.states).filter(t=>t.type!=="history")}function ie(e,t){const n=[];if(t===e)return n;let r=e.parent;for(;r&&r!==t;)n.push(r),r=r.parent;return n}function Ne(e){const t=new Set(e),n=Et(t);for(const r of t)if(r.type==="compound"&&(!n.get(r)||!n.get(r).length))Ot(r).forEach(s=>t.add(s));else if(r.type==="parallel"){for(const s of J(r))if(s.type!=="history"&&!t.has(s)){const o=Ot(s);for(const i of o)t.add(i)}}for(const r of t){let s=r.parent;for(;s;)t.add(s),s=s.parent}return t}function At(e,t){const n=t.get(e);if(!n)return{};if(e.type==="compound"){const s=n[0];if(s){if(Ze(s))return s.key}else return{}}const r={};for(const s of n)r[s.key]=At(s,t);return r}function Et(e){const t=new Map;for(const n of e)t.has(n)||t.set(n,[]),n.parent&&(t.has(n.parent)||t.set(n.parent,[]),t.get(n.parent).push(n));return t}function Ft(e,t){const n=Ne(t);return At(e,Et(n))}function Xe(e,t){return t.type==="compound"?J(t).some(n=>n.type==="final"&&e.has(n)):t.type==="parallel"?J(t).every(n=>Xe(e,n)):t.type==="final"}const Oe=e=>e[0]===Gn;function tr(e,t){return e.transitions.get(t)||[...e.transitions.keys()].filter(r=>{if(r===Ln)return!0;if(!r.endsWith(".*"))return!1;const s=r.split("."),o=t.split(".");for(let i=0;i<s.length;i++){const a=s[i],c=o[i];if(a==="*")return i===s.length-1;if(a!==c)return!1}return!0}).sort((r,s)=>s.length-r.length).flatMap(r=>e.transitions.get(r))}function nr(e){const t=e.config.after;if(!t)return[];const n=s=>{const o=qn(s,e.id),i=o.type;return e.entry.push(it(o,{id:i,delay:s})),e.exit.push(Je(i)),i};return Object.keys(t).flatMap(s=>{const o=t[s],i=typeof o=="string"?{target:o}:o,a=Number.isNaN(+s)?s:+s,c=n(a);return q(i).map(u=>({...u,event:c,delay:a}))}).map(s=>{const{delay:o}=s;return{...W(e,s.event,s),delay:o}})}function W(e,t,n){const r=Dt(n.target),s=n.reenter??!1,o=sr(e,r),i={...n,actions:q(n.actions),guard:n.guard,target:o,source:e,reenter:s,eventType:t,toJSON:()=>({...i,source:`#${e.id}`,target:o?o.map(a=>`#${a.id}`):void 0})};return i}function rr(e){const t=new Map;if(e.config.on)for(const n of Object.keys(e.config.on)){if(n===vt)throw new Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');const r=e.config.on[n];t.set(n,z(r).map(s=>W(e,n,s)))}if(e.config.onDone){const n=`xstate.done.state.${e.id}`;t.set(n,z(e.config.onDone).map(r=>W(e,n,r)))}for(const n of e.invoke){if(n.onDone){const r=`xstate.done.actor.${n.id}`;t.set(r,z(n.onDone).map(s=>W(e,r,s)))}if(n.onError){const r=`xstate.error.actor.${n.id}`;t.set(r,z(n.onError).map(s=>W(e,r,s)))}if(n.onSnapshot){const r=`xstate.snapshot.${n.id}`;t.set(r,z(n.onSnapshot).map(s=>W(e,r,s)))}}for(const n of e.after){let r=t.get(n.eventType);r||(r=[],t.set(n.eventType,r)),r.push(n)}return t}function ir(e,t){const n=typeof t=="string"?e.states[t]:t?e.states[t.target]:void 0;if(!n&&t)throw new Error(`Initial state node "${t}" not found on parent state node #${e.id}`);const r={source:e,actions:!t||typeof t=="string"?[]:q(t.actions),eventType:null,reenter:!1,target:n?[n]:[],toJSON:()=>({...r,source:`#${e.id}`,target:n?[`#${n.id}`]:[]})};return r}function sr(e,t){if(t!==void 0)return t.map(n=>{if(typeof n!="string")return n;if(Oe(n))return e.machine.getStateNodeById(n);const r=n[0]===gt;if(r&&!e.parent)return Ce(e,n.slice(1));const s=r?e.key+n:n;if(e.parent)try{return Ce(e.parent,s)}catch(o){throw new Error(`Invalid transition definition for state node '${e.id}':
|
|
2
|
+
${o.message}`)}else throw new Error(`Invalid target: "${n}" is not a valid target from the root node. Did you mean ".${n}"?`)})}function Nt(e){const t=Dt(e.config.target);return t?{target:t.map(n=>typeof n=="string"?Ce(e.parent,n):n)}:e.parent.initial}function V(e){return e.type==="history"}function Ot(e){const t=Ct(e);for(const n of t)for(const r of ie(n,e))t.add(r);return t}function Ct(e){const t=new Set;function n(r){if(!t.has(r)){if(t.add(r),r.type==="compound")n(r.initial.target[0]);else if(r.type==="parallel")for(const s of J(r))n(s)}}return n(e),t}function Y(e,t){if(Oe(t))return e.machine.getStateNodeById(t);if(!e.states)throw new Error(`Unable to retrieve child state '${t}' from '${e.id}'; no child states exist.`);const n=e.states[t];if(!n)throw new Error(`Child state '${t}' does not exist on '${e.id}'`);return n}function Ce(e,t){if(typeof t=="string"&&Oe(t))try{return e.machine.getStateNodeById(t)}catch{}const n=xe(t).slice();let r=e;for(;n.length;){const s=n.shift();if(!s.length)break;r=Y(r,s)}return r}function Re(e,t){if(typeof t=="string"){const s=e.states[t];if(!s)throw new Error(`State '${t}' does not exist on '${e.id}'`);return[e,s]}const n=Object.keys(t),r=n.map(s=>Y(e,s)).filter(Boolean);return[e.machine.root,e].concat(r,n.reduce((s,o)=>{const i=Y(e,o);if(!i)return s;const a=Re(i,t[o]);return s.concat(a)},[]))}function or(e,t,n,r){const o=Y(e,t).next(n,r);return!o||!o.length?e.next(n,r):o}function ar(e,t,n,r){const s=Object.keys(t),o=Y(e,s[0]),i=Qe(o,t[s[0]],n,r);return!i||!i.length?e.next(n,r):i}function cr(e,t,n,r){const s=[];for(const o of Object.keys(t)){const i=t[o];if(!i)continue;const a=Y(e,o),c=Qe(a,i,n,r);c&&s.push(...c)}return s.length?s:e.next(n,r)}function Qe(e,t,n,r){return typeof t=="string"?or(e,t,n,r):Object.keys(t).length===1?ar(e,t,n,r):cr(e,t,n,r)}function ur(e){return Object.keys(e.states).map(t=>e.states[t]).filter(t=>t.type==="history")}function H(e,t){let n=e;for(;n.parent&&n.parent!==t;)n=n.parent;return n.parent===t}function dr(e,t){const n=new Set(e),r=new Set(t);for(const s of n)if(r.has(s))return!0;for(const s of r)if(n.has(s))return!0;return!1}function Rt(e,t,n){const r=new Set;for(const s of e){let o=!1;const i=new Set;for(const a of r)if(dr(et([s],t,n),et([a],t,n)))if(H(s.source,a.source))i.add(a);else{o=!0;break}if(!o){for(const a of i)r.delete(a);r.add(s)}}return Array.from(r)}function fr(e){const[t,...n]=e;for(const r of ie(t,void 0))if(n.every(s=>H(s,r)))return r}function $e(e,t){if(!e.target)return[];const n=new Set;for(const r of e.target)if(V(r))if(t[r.id])for(const s of t[r.id])n.add(s);else for(const s of $e(Nt(r),t))n.add(s);else n.add(r);return[...n]}function jt(e,t){const n=$e(e,t);if(!n)return;if(!e.reenter&&n.every(s=>s===e.source||H(s,e.source)))return e.source;const r=fr(n.concat(e.source));if(r)return r;if(!e.reenter)return e.source.machine.root}function et(e,t,n){const r=new Set;for(const s of e)if(s.target?.length){const o=jt(s,n);s.reenter&&s.source===o&&r.add(o);for(const i of t)H(i,o)&&r.add(i)}return[...r]}function lr(e,t){if(e.length!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function tt(e,t,n,r,s,o){if(!e.length)return t;const i=new Set(t._nodes);let a=t.historyValue;const c=Rt(e,i,a);let u=t;s||([u,a]=gr(u,r,n,c,i,a,o,n.actionExecutor)),u=X(u,r,n,c.flatMap(l=>l.actions),o,void 0),u=pr(u,r,n,c,i,o,a,s);const f=[...i];u.status==="done"&&(u=X(u,r,n,f.sort((l,d)=>d.order-l.order).flatMap(l=>l.exit),o,void 0));try{return a===t.historyValue&&lr(t._nodes,i)?u:B(u,{_nodes:f,historyValue:a})}catch(l){throw l}}function hr(e,t,n,r,s){if(r.output===void 0)return;const o=He(s.id,s.output!==void 0&&s.parent?We(s.output,e.context,t,n.self):void 0);return We(r.output,e.context,o,n.self)}function pr(e,t,n,r,s,o,i,a){let c=e;const u=new Set,f=new Set;mr(r,i,f,u),a&&f.add(e.machine.root);const l=new Set;for(const d of[...u].sort((p,m)=>p.order-m.order)){s.add(d);const p=[];p.push(...d.entry);for(const m of d.invoke)p.push(Ye(m.src,{...m,syncSnapshot:!!m.onSnapshot}));if(f.has(d)){const m=d.initial.actions;p.push(...m)}if(c=X(c,t,n,p,o,d.invoke.map(m=>m.id)),d.type==="final"){const m=d.parent;let S=m?.type==="parallel"?m:m?.parent,w=S||d;for(m?.type==="compound"&&o.push(He(m.id,d.output!==void 0?We(d.output,c.context,t,n.self):void 0));S?.type==="parallel"&&!l.has(S)&&Xe(s,S);)l.add(S),o.push(He(S.id)),w=S,S=S.parent;if(S)continue;c=B(c,{status:"done",output:hr(c,t,n,c.machine.root,w)})}}return c}function mr(e,t,n,r){for(const s of e){const o=jt(s,t);for(const a of s.target||[])!V(a)&&(s.source!==a||s.source!==o||s.reenter)&&(r.add(a),n.add(a)),Z(a,t,n,r);const i=$e(s,t);for(const a of i){const c=ie(a,o);o?.type==="parallel"&&c.push(o),Gt(r,t,n,c,!s.source.parent&&s.reenter?void 0:o)}}}function Z(e,t,n,r){if(V(e))if(t[e.id]){const s=t[e.id];for(const o of s)r.add(o),Z(o,t,n,r);for(const o of s)nt(o,e.parent,r,t,n)}else{const s=Nt(e);for(const o of s.target)r.add(o),s===e.parent?.initial&&n.add(e.parent),Z(o,t,n,r);for(const o of s.target)nt(o,e.parent,r,t,n)}else if(e.type==="compound"){const[s]=e.initial.target;V(s)||(r.add(s),n.add(s)),Z(s,t,n,r),nt(s,e,r,t,n)}else if(e.type==="parallel")for(const s of J(e).filter(o=>!V(o)))[...r].some(o=>H(o,s))||(V(s)||(r.add(s),n.add(s)),Z(s,t,n,r))}function Gt(e,t,n,r,s){for(const o of r)if((!s||H(o,s))&&e.add(o),o.type==="parallel")for(const i of J(o).filter(a=>!V(a)))[...e].some(a=>H(a,i))||(e.add(i),Z(i,t,n,e))}function nt(e,t,n,r,s){Gt(n,r,s,ie(e,t))}function gr(e,t,n,r,s,o,i,a){let c=e;const u=et(r,s,o);u.sort((l,d)=>d.order-l.order);let f;for(const l of u)for(const d of ur(l)){let p;d.history==="deep"?p=m=>Ze(m)&&H(m,l):p=m=>m.parent===l,f??={...o},f[d.id]=Array.from(s).filter(p)}for(const l of u)c=X(c,t,n,[...l.exit,...l.invoke.map(d=>Ee(d.id))],i,void 0),s.delete(l);return[c,f||o]}function vr(e,t){return e.implementations.actions[t]}function Lt(e,t,n,r,s,o){const{machine:i}=e;let a=e;for(const c of r){const u=typeof c=="function",f=u?c:vr(i,typeof c=="string"?c:c.type),l={context:a.context,event:t,self:n.self,system:n.system},d=u||typeof c=="string"?void 0:"params"in c?typeof c.params=="function"?c.params({context:a.context,event:t}):c.params:void 0;if(!f||!("resolve"in f)){n.actionExecutor({type:typeof c=="string"?c:typeof c=="object"?c.type:c.name||"(anonymous)",info:l,params:d,exec:f});continue}const p=f,[m,S,w]=p.resolve(n,a,l,d,f,s);a=m,"retryResolve"in p&&o?.push([p,S]),"execute"in p&&n.actionExecutor({type:p.type,info:l,params:S,exec:p.execute.bind(null,n,S)}),w&&(a=Lt(a,t,n,w,s,o))}return a}function X(e,t,n,r,s,o){const i=o?[]:void 0,a=Lt(e,t,n,r,{internalQueue:s,deferredActorIds:o},i);return i?.forEach(([c,u])=>{c.retryResolve(n,a,u)}),a}function rt(e,t,n,r){let s=e;const o=[];function i(u,f,l){n.system._sendInspectionEvent({type:"@xstate.microstep",actorRef:n.self,event:f,snapshot:u,_transitions:l}),o.push(u)}if(t.type===re)return s=B(Ut(s,t,n),{status:"stopped"}),i(s,t,[]),{snapshot:s,microstates:o};let a=t;if(a.type!==yt){const u=a,f=Vn(u),l=qt(u,s);if(f&&!l.length)return s=B(e,{status:"error",error:u.error}),i(s,u,[]),{snapshot:s,microstates:o};s=tt(l,e,n,a,!1,r),i(s,u,l)}let c=!0;for(;s.status==="active";){let u=c?yr(s,a):[];const f=u.length?s:void 0;if(!u.length){if(!r.length)break;a=r.shift(),u=qt(a,s)}s=tt(u,s,n,a,!1,r),c=s!==f,i(s,a,u)}return s.status!=="active"&&Ut(s,a,n),{snapshot:s,microstates:o}}function Ut(e,t,n){return X(e,t,n,Object.values(e.children).map(r=>Ee(r)),[],void 0)}function qt(e,t){return t.machine.getTransitionData(t,e)}function yr(e,t){const n=new Set,r=e._nodes.filter(Ze);for(const s of r)e:for(const o of[s].concat(ie(s,void 0)))if(o.always){for(const i of o.always)if(i.guard===void 0||Fe(i.guard,e.context,t,e)){n.add(i);break e}}return Rt(Array.from(n),new Set(e._nodes),e.historyValue)}function Sr(e,t){const n=Ne(Re(e,t));return Ft(e,[...n])}function _r(e){return!!e&&typeof e=="object"&&"machine"in e&&"value"in e}const br=function(t){return bt(t,this.value)},Tr=function(t){return this.tags.has(t)},Ir=function(t){const n=this.machine.getTransitionData(this,t);return!!n?.length&&n.some(r=>r.target!==void 0||r.actions.length)},wr=function(){const{_nodes:t,tags:n,machine:r,getMeta:s,toJSON:o,can:i,hasTag:a,matches:c,...u}=this;return{...u,tags:Array.from(n)}},kr=function(){return this._nodes.reduce((t,n)=>(n.meta!==void 0&&(t[n.id]=n.meta),t),{})};function je(e,t){return{status:e.status,output:e.output,error:e.error,machine:t,context:e.context,_nodes:e._nodes,value:Ft(t.root,e._nodes),tags:new Set(e._nodes.flatMap(n=>n.tags)),children:e.children,historyValue:e.historyValue||{},matches:br,hasTag:Tr,can:Ir,getMeta:kr,toJSON:wr}}function B(e,t={}){return je({...e,...t},e.machine)}function Dr(e){if(typeof e!="object"||e===null)return{};const t={};for(const n in e){const r=e[n];Array.isArray(r)&&(t[n]=r.map(s=>({id:s.id})))}return t}function Pr(e,t){const{_nodes:n,tags:r,machine:s,children:o,context:i,can:a,hasTag:c,matches:u,getMeta:f,toJSON:l,...d}=e,p={};for(const S in o){const w=o[S];p[S]={snapshot:w.getPersistedSnapshot(t),src:w.src,systemId:w.systemId,syncSnapshot:w._syncSnapshot}}return{...d,context:Ht(i),children:p,historyValue:Dr(d.historyValue)}}function Ht(e){let t;for(const n in e){const r=e[n];if(r&&typeof r=="object")if("sessionId"in r&&"send"in r&&"ref"in r)t??=Array.isArray(e)?e.slice():{...e},t[n]={xstate$$type:ze,id:r.id};else{const s=Ht(r);s!==r&&(t??=Array.isArray(e)?e.slice():{...e},t[n]=s)}}return t??e}function Mr(e,t,n,r,{event:s,id:o,delay:i},{internalQueue:a}){const c=t.machine.implementations.delays;if(typeof s=="string")throw new Error(`Only event objects may be used with raise; use raise({ type: "${s}" }) instead`);const u=typeof s=="function"?s(n,r):s;let f;if(typeof i=="string"){const l=c&&c[i];f=typeof l=="function"?l(n,r):l}else f=typeof i=="function"?i(n,r):i;return typeof f!="number"&&a.push(u),[t,{event:u,id:o,delay:f},void 0]}function Ar(e,t){const{event:n,delay:r,id:s}=t;if(typeof r=="number"){e.defer(()=>{const o=e.self;e.system.scheduler.schedule(o,o,n,r,s)});return}}function it(e,t){function n(r,s){}return n.type="xstate.raise",n.event=e,n.id=t?.id,n.delay=t?.delay,n.resolve=Mr,n.execute=Ar,n}const xt=new WeakMap;function Er(e){return{config:e,start:(n,r)=>{const{self:s,system:o,emit:i}=r,a={receivers:void 0,dispose:void 0};xt.set(s,a),a.dispose=e({input:n.input,system:o,self:s,sendBack:c=>{s.getSnapshot().status!=="stopped"&&s._parent&&o._relay(s,s._parent,c)},receive:c=>{a.receivers??=new Set,a.receivers.add(c)},emit:i})},transition:(n,r,s)=>{const o=xt.get(s.self);return r.type===re?(n={...n,status:"stopped",error:void 0},o.dispose?.(),n):(o.receivers?.forEach(i=>i(r)),n)},getInitialSnapshot:(n,r)=>({status:"active",output:void 0,error:void 0,input:r}),getPersistedSnapshot:n=>n,restoreSnapshot:n=>n}}const Wt="xstate.promise.resolve",Vt="xstate.promise.reject",Ge=new WeakMap;function Bt(e){return{config:e,transition:(n,r,s)=>{if(n.status!=="active")return n;switch(r.type){case Wt:{const o=r.data;return{...n,status:"done",output:o,input:void 0}}case Vt:return{...n,status:"error",error:r.data,input:void 0};case re:return Ge.get(s.self)?.abort(),{...n,status:"stopped",input:void 0};default:return n}},start:(n,{self:r,system:s,emit:o})=>{if(n.status!=="active")return;const i=new AbortController;Ge.set(r,i),Promise.resolve(e({input:n.input,system:s,self:r,signal:i.signal,emit:o})).then(c=>{r.getSnapshot().status==="active"&&(Ge.delete(r),s._relay(r,r,{type:Wt,data:c}))},c=>{r.getSnapshot().status==="active"&&(Ge.delete(r),s._relay(r,r,{type:Vt,data:c}))})},getInitialSnapshot:(n,r)=>({status:"active",output:void 0,error:void 0,input:r}),getPersistedSnapshot:n=>n,restoreSnapshot:n=>n}}function Fr(e,{machine:t,context:n},r,s){const o=(i,a)=>{if(typeof i=="string"){const c=Be(t,i);if(!c)throw new Error(`Actor logic '${i}' not implemented in machine '${t.id}'`);const u=Ae(c,{id:a?.id,parent:e.self,syncSnapshot:a?.syncSnapshot,input:typeof a?.input=="function"?a.input({context:n,event:r,self:e.self}):a?.input,src:i,systemId:a?.systemId});return s[u.id]=u,u}else return Ae(i,{id:a?.id,parent:e.self,syncSnapshot:a?.syncSnapshot,input:a?.input,src:i,systemId:a?.systemId})};return(i,a)=>{const c=o(i,a);return s[c.id]=c,e.defer(()=>{c._processingStatus!==A.Stopped&&c.start()}),c}}function Nr(e,t,n,r,{assignment:s}){if(!t.context)throw new Error("Cannot assign to undefined `context`. Ensure that `context` is defined in the machine config.");const o={},i={context:t.context,event:n.event,spawn:Fr(e,t,n.event,o),self:e.self,system:e.system};let a={};if(typeof s=="function")a=s(i,r);else for(const u of Object.keys(s)){const f=s[u];a[u]=typeof f=="function"?f(i,r):f}const c=Object.assign({},t.context,a);return[B(t,{context:c,children:Object.keys(o).length?{...t.children,...o}:t.children}),void 0,void 0]}function O(e){function t(n,r){}return t.type="xstate.assign",t.assignment=e,t.resolve=Nr,t}const Kt=new WeakMap;function Q(e,t,n){let r=Kt.get(e);return r?t in r||(r[t]=n()):(r={[t]:n()},Kt.set(e,r)),r[t]}const Or={},se=e=>typeof e=="string"?{type:e}:typeof e=="function"?"resolve"in e?{type:e.type}:{type:e.name}:e;class Le{constructor(t,n){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(gt),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?It(this.config.states,(r,s)=>new Le(r,{_parent:this,_key:s,_machine:this.machine})):Or,this.type==="compound"&&!this.config.initial)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.`);this.history=this.config.history===!0?"shallow":this.config.history||!1,this.entry=q(this.config.entry).slice(),this.exit=q(this.config.exit).slice(),this.meta=this.config.meta,this.output=this.type==="final"||!this.parent?this.config.output:void 0,this.tags=q(t.tags).slice()}_initialize(){this.transitions=rr(this),this.config.always&&(this.always=z(this.config.always).map(t=>W(this,vt,t))),Object.keys(this.states).forEach(t=>{this.states[t]._initialize()})}get definition(){return{id:this.id,key:this.key,version:this.machine.version,type:this.type,initial:this.initial?{target:this.initial.target,source:this,actions:this.initial.actions.map(se),eventType:null,reenter:!1,toJSON:()=>({target:this.initial.target.map(t=>`#${t.id}`),source:`#${this.id}`,actions:this.initial.actions.map(se),eventType:null})}:void 0,history:this.history,states:It(this.states,t=>t.definition),on:this.on,transitions:[...this.transitions.values()].flat().map(t=>({...t,actions:t.actions.map(se)})),entry:this.entry.map(se),exit:this.exit.map(se),meta:this.meta,order:this.order||-1,output:this.output,invoke:this.invoke,description:this.description,tags:this.tags}}toJSON(){return this.definition}get invoke(){return Q(this,"invoke",()=>q(this.config.invoke).map((t,n)=>{const{src:r,systemId:s}=t,o=t.id??Pt(this.id,n),i=typeof r=="string"?r:`xstate.invoke.${Pt(this.id,n)}`;return{...t,src:i,id:o,systemId:s,toJSON(){const{onDone:a,onError:c,...u}=t;return{...u,type:"xstate.invoke",src:i,id:o}}}}))}get on(){return Q(this,"on",()=>[...this.transitions].flatMap(([n,r])=>r.map(s=>[n,s])).reduce((n,[r,s])=>(n[r]=n[r]||[],n[r].push(s),n),{}))}get after(){return Q(this,"delayedTransitions",()=>nr(this))}get initial(){return Q(this,"initial",()=>ir(this,this.config.initial))}next(t,n){const r=n.type,s=[];let o;const i=Q(this,`candidates-${r}`,()=>tr(this,r));for(const a of i){const{guard:c}=a,u=t.context;let f=!1;try{f=!c||Fe(c,u,n,t)}catch(l){const d=typeof c=="string"?c:typeof c=="object"?c.type:void 0;throw new Error(`Unable to evaluate guard ${d?`'${d}' `:""}in transition for event '${r}' in state node '${this.id}':
|
|
3
|
+
${l.message}`)}if(f){s.push(...a.actions),o=a;break}}return o?[o]:void 0}get events(){return Q(this,"events",()=>{const{states:t}=this,n=new Set(this.ownEvents);if(t)for(const r of Object.keys(t)){const s=t[r];if(s.states)for(const o of s.events)n.add(`${o}`)}return Array.from(n)})}get ownEvents(){const t=new Set([...this.transitions.keys()].filter(n=>this.transitions.get(n).some(r=>!(!r.target&&!r.actions.length&&!r.reenter))));return Array.from(t)}}const Cr="#";class st{constructor(t,n){this.config=t,this.version=void 0,this.schemas=void 0,this.implementations=void 0,this.__xstatenode=!0,this.idMap=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={actors:n?.actors??{},actions:n?.actions??{},delays:n?.delays??{},guards:n?.guards??{}},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 Le(t,{_key:this.id,_machine:this}),this.root._initialize(),this.states=this.root.states,this.events=this.root.events}provide(t){const{actions:n,guards:r,actors:s,delays:o}=this.implementations;return new st(this.config,{actions:{...n,...t.actions},guards:{...r,...t.guards},actors:{...s,...t.actors},delays:{...o,...t.delays}})}resolveState(t){const n=Sr(this.root,t.value),r=Ne(Re(this.root,n));return je({_nodes:[...r],context:t.context||{},children:{},status:Xe(r,this.root)?"done":t.status||"active",output:t.output,error:t.error,historyValue:t.historyValue},this)}transition(t,n,r){return rt(t,n,r,[]).snapshot}microstep(t,n,r){return rt(t,n,r,[]).microstates}getTransitionData(t,n){return Qe(this.root,t.value,t,n)||[]}getPreInitialState(t,n,r){const{context:s}=this.config,o=je({context:typeof s!="function"&&s?s:{},_nodes:[this.root],children:{},status:"active"},this);return typeof s=="function"?X(o,n,t,[O(({spawn:a,event:c,self:u})=>s({spawn:a,input:c.input,self:u}))],r,void 0):o}getInitialSnapshot(t,n){const r=_t(n),s=[],o=this.getPreInitialState(t,r,s),i=tt([{target:[...Ct(this.root)],source:this.root,reenter:!0,actions:[],eventType:null,toJSON:null}],o,t,r,!0,s),{snapshot:a}=rt(i,r,t,s);return a}start(t){Object.values(t.children).forEach(n=>{n.getSnapshot().status==="active"&&n.start()})}getStateNodeById(t){const n=xe(t),r=n.slice(1),s=Oe(n[0])?n[0].slice(Cr.length):n[0],o=this.idMap.get(s);if(!o)throw new Error(`Child state node '#${s}' does not exist on machine '${this.id}'`);return Ce(o,r)}get definition(){return this.root.definition}toJSON(){return this.definition}getPersistedSnapshot(t,n){return Pr(t,n)}restoreSnapshot(t,n){const r={},s=t.children;Object.keys(s).forEach(l=>{const d=s[l],p=d.snapshot,m=d.src,S=typeof m=="string"?Be(this,m):m;if(!S)return;const w=Ae(S,{id:l,parent:n.self,syncSnapshot:d.syncSnapshot,snapshot:p,src:m,systemId:d.systemId});r[l]=w});function o(l,d){if(d instanceof Le)return d;try{return l.machine.getStateNodeById(d.id)}catch{}}function i(l,d){if(!d||typeof d!="object")return{};const p={};for(const m in d){const S=d[m];for(const w of S){const G=o(l,w);G&&(p[m]??=[],p[m].push(G))}}return p}const a=i(this.root,t.historyValue),c=je({...t,children:r,_nodes:Array.from(Ne(Re(this.root,t.value))),historyValue:a},this),u=new Set;function f(l,d){if(!u.has(l)){u.add(l);for(const p in l){const m=l[p];if(m&&typeof m=="object"){if("xstate$$type"in m&&m.xstate$$type===ze){l[p]=d[m.id];continue}f(m,d)}}}}return f(c.context,r),c}}function Rr(e,t,n,r,{event:s}){const o=typeof s=="function"?s(n,r):s;return[t,{event:o},void 0]}function jr(e,{event:t}){e.defer(()=>e.emit(t))}function zt(e){function t(n,r){}return t.type="xstate.emit",t.event=e,t.resolve=Rr,t.execute=jr,t}let ot=(function(e){return e.Parent="#_parent",e.Internal="#_internal",e})({});function Gr(e,t,n,r,{to:s,event:o,id:i,delay:a},c){const u=t.machine.implementations.delays;if(typeof o=="string")throw new Error(`Only event objects may be used with sendTo; use sendTo({ type: "${o}" }) instead`);const f=typeof o=="function"?o(n,r):o;let l;if(typeof a=="string"){const m=u&&u[a];l=typeof m=="function"?m(n,r):m}else l=typeof a=="function"?a(n,r):a;const d=typeof s=="function"?s(n,r):s;let p;if(typeof d=="string"){if(d===ot.Parent?p=e.self._parent:d===ot.Internal?p=e.self:d.startsWith("#_")?p=t.children[d.slice(2)]:p=c.deferredActorIds?.includes(d)?d:t.children[d],!p)throw new Error(`Unable to send event to actor '${d}' from machine '${t.machine.id}'.`)}else p=d||e.self;return[t,{to:p,targetId:typeof d=="string"?d:void 0,event:f,id:i,delay:l},void 0]}function Lr(e,t,n){typeof n.to=="string"&&(n.to=t.children[n.to])}function Ur(e,t){e.defer(()=>{const{to:n,event:r,delay:s,id:o}=t;if(typeof s=="number"){e.system.scheduler.schedule(e.self,n,r,s,o);return}e.system._relay(e.self,n,r.type===Un?St(e.self.id,r.data):r)})}function Ue(e,t,n){function r(s,o){}return r.type="xstate.sendTo",r.to=e,r.event=t,r.id=n?.id,r.delay=n?.delay,r.resolve=Gr,r.retryResolve=Lr,r.execute=Ur,r}function qr(e,t){return Ue(ot.Parent,e,t)}function Hr(e,t,n,r,{collect:s}){const o=[],i=function(c){o.push(c)};return i.assign=(...a)=>{o.push(O(...a))},i.cancel=(...a)=>{o.push(Je(...a))},i.raise=(...a)=>{o.push(it(...a))},i.sendTo=(...a)=>{o.push(Ue(...a))},i.sendParent=(...a)=>{o.push(qr(...a))},i.spawnChild=(...a)=>{o.push(Ye(...a))},i.stopChild=(...a)=>{o.push(Ee(...a))},i.emit=(...a)=>{o.push(zt(...a))},s({context:n.context,event:n.event,enqueue:i,check:a=>Fe(a,t.context,n.event,t),self:e.self,system:e.system},r),[t,void 0,o]}function xr(e){function t(n,r){}return t.type="xstate.enqueueActions",t.collect=e,t.resolve=Hr,t}function Wr(e,t,n,r,{value:s,label:o}){return[t,{value:typeof s=="function"?s(n,r):s,label:o},void 0]}function Vr({logger:e},{value:t,label:n}){n?e(n,t):e(t)}function Br(e=({context:n,event:r})=>({context:n,event:r}),t){function n(r,s){}return n.type="xstate.log",n.value=e,n.label=t,n.resolve=Wr,n.execute=Vr,n}function Kr(e,t){return new st(e,t)}function Jt({schemas:e,actors:t,actions:n,guards:r,delays:s}){return{assign:O,sendTo:Ue,raise:it,log:Br,cancel:Je,stopChild:Ee,enqueueActions:xr,emit:zt,spawnChild:Ye,createStateConfig:o=>o,createAction:o=>o,createMachine:o=>Kr({...o,schemas:e},{actors:t,actions:n,guards:r,delays:s}),extend:o=>Jt({schemas:e,actors:t,actions:{...n,...o.actions},guards:{...r,...o.guards},delays:{...s,...o.delays}})}}var N={},oe={},T={},Yt;function D(){if(Yt)return T;Yt=1,Object.defineProperty(T,"__esModule",{value:!0});var e=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];function t(h){var g=h>>4&15,v=h>>0&15;return e[g]+e[v]}T.toHexString=t;function n(h,g,v){for(var _=typeof h=="string"?h:h.toFixed(0);_.length<g;)_=v+_;return _}T.padLeft=n;function r(h){var g=h.split("*"),v=g[0],_=g[1],M=s(v),F=parseInt(_,16);return M===F}T.validNmeaChecksum=r;function s(h){for(var g=h.charCodeAt(1),v=2;v<h.length;v+=1)g=g^h.charCodeAt(v);return g=g&255,g}T.computeNmeaChecksum=s;function o(h){return"*"+t(s(h))}T.createNmeaChecksumFooter=o;function i(h){return h+o(h)}T.appendChecksumFooter=i;function a(h,g){return h===void 0?"":h.toFixed(g)}T.encodeFixed=a;function c(h){if(h===void 0)return",";var g;h<0?(g="S",h=-h):g="N";var v=Math.floor(h),_=n(v,2,"0"),M=h-v,F=M*60,U=n(F.toFixed(6),9,"0");return _=_+U+","+g,_}T.encodeLatitude=c;function u(h){if(h===void 0)return",";var g;h<0?(g="W",h=-h):g="E";var v=Math.floor(h),_=n(v,3,"0"),M=h-v,F=M*60,U=n(F.toFixed(6),9,"0");return _=_+U+","+g,_}T.encodeLongitude=u;function f(h){return h===void 0?",":h.toFixed(1)+",M"}T.encodeAltitude=f;function l(h){return h===void 0?"":h.toFixed(1)}T.encodeAltitudeNoUnits=l;function d(h){return h===void 0?",":h.toFixed(1)+",M"}T.encodeGeoidalSeperation=d;function p(h){return h===void 0?"":h.toFixed(1)}T.encodeGeoidalSeperationNoUnits=p;function m(h){return h===void 0?"":n(h.toFixed(2),6,"0")}T.encodeDegrees=m;function S(h){if(h===void 0)return"";var g=h.getUTCFullYear(),v=h.getUTCMonth()+1,_=h.getUTCDate();return n(_,2,"0")+n(v,2,"0")+g.toFixed(0).substr(2)}T.encodeDate=S;function w(h){if(h===void 0)return"";var g=h.getUTCHours(),v=h.getUTCMinutes(),_=h.getUTCSeconds();return n(g,2,"0")+n(v,2,"0")+n(_,2,"0")}T.encodeTime=w;function G(h){return h===void 0?"":h.toString()}T.encodeValue=G;function L(h){return h===""?0:parseFloat(h)}T.parseFloatSafe=L;function $(h){return h===""?0:parseInt(h,10)}T.parseIntSafe=$;function dt(h){if(h===void 0)return"";var g=parseFloat(h);return g===NaN?h:g}T.parseNumberOrString=dt;function Me(h){var g=h.indexOf(".");if(g<0)return 0;var v,_;return g>=3?(v=h.substring(0,g-2),_=h.substring(g-2)):(v="0",_=h),parseFloat(v)+parseFloat(_)/60}T.parseDmCoordinate=Me;function ft(h,g){var v=g==="N"?1:-1;return Me(h)*v}T.parseLatitude=ft;function lt(h,g){var v=g==="E"?1:-1;return Me(h)*v}T.parseLongitude=lt;function ht(h,g){if(h==="")return new Date(0);var v=new Date;if(g){var _=g.slice(4),M=parseInt(g.slice(2,4),10)-1,F=g.slice(0,2);_.length===4?v.setUTCFullYear(Number(_),Number(M),Number(F)):v.setUTCFullYear(+("20"+_),Number(M),Number(F))}v.setUTCHours(Number(h.slice(0,2))),v.setUTCMinutes(Number(h.slice(2,4))),v.setUTCSeconds(Number(h.slice(4,6)));var U=h.slice(7),ee=U.length,K=0;return ee!==0&&(K=parseFloat(U)*Math.pow(10,3-ee)),v.setUTCMilliseconds(Number(K)),v}T.parseTime=ht;function pt(h,g){var v=parseInt(h.slice(0,2),10),_=parseInt(h.slice(2,4),10),M=parseInt(h.slice(4,6),10);M<73?M=M+2e3:M=M+1900;var F=parseInt(g.slice(0,2),10),U=parseInt(g.slice(2,4),10),ee=parseInt(g.slice(4,6),10),K=0;return g.length===9&&(K=parseInt(g.slice(7,9),10)*10),new Date(Date.UTC(M,_-1,v,F,U,ee,K))}return T.parseDatetime=pt,T}var ae={},Zt;function k(){if(Zt)return ae;Zt=1,Object.defineProperty(ae,"__esModule",{value:!0});function e(n,r,s){return{sentenceId:r,talkerId:n.talkerId,chxOk:n.chxOk,sentenceName:s}}ae.initStubFields=e;function t(n,r){var s,o;return n.charAt(1)==="P"?(s="P",o=n.substr(2)):(s=n.substr(1,2),o=n.substr(3)),{talkerId:s,sentenceId:o,chxOk:r||void 0}}return ae.parseStub=t,ae}var Xt;function zr(){return Xt||(Xt=1,(function(e){var t=oe&&oe.__assign||function(){return t=Object.assign||function(o){for(var i,a=1,c=arguments.length;a<c;a++){i=arguments[a];for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(o[u]=i[u])}return o},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var n=D(),r=k();e.sentenceId="APB",e.sentenceName='Autopilot sentence "B"';function s(o,i){return t(t({},r.initStubFields(o,e.sentenceId,e.sentenceName)),{status1:i[1],status2:i[2],xteMagn:n.parseFloatSafe(i[3]),steerDir:i[4],xteUnit:i[5],arrivalCircleStatus:i[6],arrivalPerpendicularStatus:i[7],bearingOrig2Dest:n.parseFloatSafe(i[8]),bearingOrig2DestType:i[9],waypoint:i[10],bearing2Dest:n.parseFloatSafe(i[11]),bearingDestType:i[12],heading2steer:n.parseFloatSafe(i[13]),headingDestType:i[14]})}e.decodeSentence=s})(oe)),oe}var ce={},Qt;function Jr(){return Qt||(Qt=1,(function(e){var t=ce&&ce.__assign||function(){return t=Object.assign||function(o){for(var i,a=1,c=arguments.length;a<c;a++){i=arguments[a];for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(o[u]=i[u])}return o},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var n=D(),r=k();e.sentenceId="BWC",e.sentenceName="Bearing and distance to waypoint - great circle";function s(o,i){return t(t({},r.initStubFields(o,e.sentenceId,e.sentenceName)),{time:n.parseTime(i[1]),bearingLatitude:n.parseLatitude(i[2],i[3]),bearingLongitude:n.parseLongitude(i[4],i[5]),bearingTrue:n.parseFloatSafe(i[6]),bearingMagnetic:n.parseFloatSafe(i[8]),distanceNm:n.parseFloatSafe(i[10]),waypointId:i[12],faaMode:i[13]})}e.decodeSentence=s})(ce)),ce}var ue={},$t;function Yr(){return $t||($t=1,(function(e){var t=ue&&ue.__assign||function(){return t=Object.assign||function(i){for(var a,c=1,u=arguments.length;c<u;c++){a=arguments[c];for(var f in a)Object.prototype.hasOwnProperty.call(a,f)&&(i[f]=a[f])}return i},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var n=D(),r=k();e.sentenceId="DBT",e.sentenceName="Depth below transducer";function s(i,a){return t(t({},r.initStubFields(i,e.sentenceId,e.sentenceName)),{depthFeet:n.parseFloatSafe(a[1]),depthMeters:n.parseFloatSafe(a[3]),depthFathoms:n.parseFloatSafe(a[5])})}e.decodeSentence=s;function o(i,a){var c=["$"+a+e.sentenceId];c.push(n.encodeFixed(i.depthFeet,2)),c.push("f"),c.push(n.encodeFixed(i.depthMeters,2)),c.push("M"),c.push(n.encodeFixed(i.depthFathoms,2)),c.push("F");var u=c.join(",");return u+n.createNmeaChecksumFooter(u)}e.encodePacket=o})(ue)),ue}var de={},en;function Zr(){return en||(en=1,(function(e){var t=de&&de.__assign||function(){return t=Object.assign||function(i){for(var a,c=1,u=arguments.length;c<u;c++){a=arguments[c];for(var f in a)Object.prototype.hasOwnProperty.call(a,f)&&(i[f]=a[f])}return i},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var n=D(),r=k();e.sentenceId="DTM",e.sentenceName="Datum reference";function s(i,a){return t(t({},r.initStubFields(i,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])})}e.decodeSentence=s;function o(i){return i==="W84"?"W84":i==="W72"?"W72":i==="S85"?"S85":i==="P90"?"P90":i==="999"?"999":""}})(de)),de}var fe={},tn;function Xr(){return tn||(tn=1,(function(e){var t=fe&&fe.__assign||function(){return t=Object.assign||function(a){for(var c,u=1,f=arguments.length;u<f;u++){c=arguments[u];for(var l in c)Object.prototype.hasOwnProperty.call(c,l)&&(a[l]=c[l])}return a},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var n=D(),r=k();e.sentenceId="GGA",e.sentenceName="Global positioning system fix data";var s=["none","fix","delta","pps","rtk","frtk","estimated","manual","simulation"];function o(a,c){return t(t({},r.initStubFields(a,e.sentenceId,e.sentenceName)),{time:n.parseTime(c[1]),latitude:n.parseLatitude(c[2],c[3]),longitude:n.parseLongitude(c[4],c[5]),fixType:s[n.parseIntSafe(c[6])],satellitesInView:n.parseIntSafe(c[7]),horizontalDilution:n.parseFloatSafe(c[8]),altitudeMeters:n.parseFloatSafe(c[9]),geoidalSeperation:n.parseFloatSafe(c[11]),differentialAge:n.parseFloatSafe(c[13]),differentialRefStn:c[14]})}e.decodeSentence=o;function i(a,c){var u=["$"+c+e.sentenceId];u.push(n.encodeTime(a.time)),u.push(n.encodeLatitude(a.latitude)),u.push(n.encodeLongitude(a.longitude)),u.push(n.encodeValue(s.indexOf(a.fixType))),u.push(n.encodeValue(a.satellitesInView)),u.push(n.encodeFixed(a.horizontalDilution,1)),u.push(n.encodeAltitude(a.altitudeMeters)),u.push(n.encodeGeoidalSeperation(a.geoidalSeperation)),u.push(n.encodeFixed(a.differentialAge,2)),u.push(n.encodeValue(a.differentialRefStn));var f=u.join(",");return f+n.createNmeaChecksumFooter(f)}e.encodePacket=i})(fe)),fe}var le={},nn;function Qr(){return nn||(nn=1,(function(e){var t=le&&le.__assign||function(){return t=Object.assign||function(i){for(var a,c=1,u=arguments.length;c<u;c++){a=arguments[c];for(var f in a)Object.prototype.hasOwnProperty.call(a,f)&&(i[f]=a[f])}return i},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var n=D(),r=k();e.sentenceId="GLL",e.sentenceName="Geographic position - latitude and longitude";function s(i,a){return t(t({},r.initStubFields(i,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]})}e.decodeSentence=s;function o(i,a){var c=["$"+a+e.sentenceId];c.push(n.encodeLatitude(i.latitude)),c.push(n.encodeLongitude(i.longitude)),c.push(n.encodeTime(i.time)),c.push(i.status==="valid"?"A":"V"),i.faaMode&&c.push(i.faaMode);var u=c.join(",");return u+n.createNmeaChecksumFooter(u)}e.encodePacket=o})(le)),le}var he={},rn;function $r(){return rn||(rn=1,(function(e){var t=he&&he.__assign||function(){return t=Object.assign||function(i){for(var a,c=1,u=arguments.length;c<u;c++){a=arguments[c];for(var f in a)Object.prototype.hasOwnProperty.call(a,f)&&(i[f]=a[f])}return i},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var n=D(),r=k();e.sentenceId="GNS",e.sentenceName="GNSS fix data";function s(i,a){return t(t({},r.initStubFields(i,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]})}e.decodeSentence=s;function o(i,a){var c=["$"+a+e.sentenceId];c.push(n.encodeTime(i.time)),c.push(n.encodeLatitude(i.latitude)),c.push(n.encodeLongitude(i.longitude)),c.push(i.modeIndicator),c.push(n.encodeValue(i.satellitesInView)),c.push(n.encodeFixed(i.horizontalDilution,1)),c.push(n.encodeAltitudeNoUnits(i.altitudeMeters)),c.push(n.encodeGeoidalSeperationNoUnits(i.geoidalSeperation)),c.push(n.encodeFixed(i.differentialAge,2)),c.push(n.encodeValue(i.differentialRefStn));var u=c.join(",");return u+n.createNmeaChecksumFooter(u)}e.encodePacket=o})(he)),he}var pe={},sn;function ei(){return sn||(sn=1,(function(e){var t=pe&&pe.__assign||function(){return t=Object.assign||function(i){for(var a,c=1,u=arguments.length;c<u;c++){a=arguments[c];for(var f in a)Object.prototype.hasOwnProperty.call(a,f)&&(i[f]=a[f])}return i},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var n=D(),r=k();e.sentenceId="GSA",e.sentenceName="Active satellites and dilution of precision";var s=["unknown","none","2D","3D"];function o(i,a){for(var c=[],u=3;u<15;u++)a[u]&&c.push(+a[u]);return t(t({},r.initStubFields(i,e.sentenceId,e.sentenceName)),{selectionMode:a[1]==="A"?"automatic":"manual",fixMode:s[n.parseIntSafe(a[2])],satellites:c,PDOP:n.parseFloatSafe(a[15]),HDOP:n.parseFloatSafe(a[16]),VDOP:n.parseFloatSafe(a[17])})}e.decodeSentence=o})(pe)),pe}var me={},on;function ti(){return on||(on=1,(function(e){var t=me&&me.__assign||function(){return t=Object.assign||function(o){for(var i,a=1,c=arguments.length;a<c;a++){i=arguments[a];for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(o[u]=i[u])}return o},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var n=D(),r=k();e.sentenceId="GST",e.sentenceName="GPS pseudorange noise statistics";function s(o,i){return t(t({},r.initStubFields(o,e.sentenceId,e.sentenceName)),{time:n.parseTime(i[1]),totalRms:n.parseFloatSafe(i[2]),semiMajorError:n.parseFloatSafe(i[3]),semiMinorError:n.parseFloatSafe(i[4]),orientationOfSemiMajorError:n.parseFloatSafe(i[5]),latitudeError:n.parseFloatSafe(i[6]),longitudeError:n.parseFloatSafe(i[7]),altitudeError:n.parseFloatSafe(i[8])})}e.decodeSentence=s})(me)),me}var ge={},an;function ni(){return an||(an=1,(function(e){var t=ge&&ge.__assign||function(){return t=Object.assign||function(o){for(var i,a=1,c=arguments.length;a<c;a++){i=arguments[a];for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(o[u]=i[u])}return o},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var n=D(),r=k();e.sentenceId="GSV",e.sentenceName="Satellites in view";function s(o,i){for(var a=(i.length-4)/4,c=[],u=0;u<a;u++){var f=u*4+4;c.push({prnNumber:n.parseIntSafe(i[f]),elevationDegrees:n.parseIntSafe(i[f+1]),azimuthTrue:n.parseIntSafe(i[f+2]),SNRdB:n.parseIntSafe(i[f+3])})}return t(t({},r.initStubFields(o,e.sentenceId,e.sentenceName)),{numberOfMessages:n.parseIntSafe(i[1]),messageNumber:n.parseIntSafe(i[2]),satellitesInView:n.parseIntSafe(i[3]),satellites:c})}e.decodeSentence=s})(ge)),ge}var ve={},cn;function ri(){return cn||(cn=1,(function(e){var t=ve&&ve.__assign||function(){return t=Object.assign||function(o){for(var i,a=1,c=arguments.length;a<c;a++){i=arguments[a];for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(o[u]=i[u])}return o},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var n=D(),r=k();e.sentenceId="HDG",e.sentenceName="Heading - deviation and variation";function s(o,i){return t(t({},r.initStubFields(o,e.sentenceId,e.sentenceName)),{heading:n.parseFloatSafe(i[1]),deviation:n.parseFloatSafe(i[2]),deviationDirection:i[3]==="E"?"E":i[3]==="W"?"W":"",variation:n.parseFloatSafe(i[4]),variationDirection:i[5]==="E"?"E":i[5]==="W"?"W":""})}e.decodeSentence=s})(ve)),ve}var ye={},un;function ii(){return un||(un=1,(function(e){var t=ye&&ye.__assign||function(){return t=Object.assign||function(i){for(var a,c=1,u=arguments.length;c<u;c++){a=arguments[c];for(var f in a)Object.prototype.hasOwnProperty.call(a,f)&&(i[f]=a[f])}return i},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var n=D(),r=k();e.sentenceId="HDM",e.sentenceName="Heading - magnetic";function s(i,a){return t(t({},r.initStubFields(i,e.sentenceId,e.sentenceName)),{heading:n.parseFloatSafe(a[1])})}e.decodeSentence=s;function o(i,a){var c=["$"+a+e.sentenceId];c.push(n.encodeFixed(i.heading,1)),c.push("M");var u=c.join(",");return u+n.createNmeaChecksumFooter(u)}e.encodePacket=o})(ye)),ye}var Se={},dn;function si(){return dn||(dn=1,(function(e){var t=Se&&Se.__assign||function(){return t=Object.assign||function(i){for(var a,c=1,u=arguments.length;c<u;c++){a=arguments[c];for(var f in a)Object.prototype.hasOwnProperty.call(a,f)&&(i[f]=a[f])}return i},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var n=D(),r=k();e.sentenceId="HDT",e.sentenceName="Heading - true";function s(i,a){return t(t({},r.initStubFields(i,e.sentenceId,e.sentenceName)),{heading:n.parseFloatSafe(a[1])})}e.decodeSentence=s;function o(i,a){var c=["$"+a+e.sentenceId];c.push(n.encodeFixed(i.heading,1)),c.push("T");var u=c.join(",");return u+n.createNmeaChecksumFooter(u)}e.encodePacket=o})(Se)),Se}var _e={},fn;function oi(){return fn||(fn=1,(function(e){var t=_e&&_e.__assign||function(){return t=Object.assign||function(i){for(var a,c=1,u=arguments.length;c<u;c++){a=arguments[c];for(var f in a)Object.prototype.hasOwnProperty.call(a,f)&&(i[f]=a[f])}return i},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var n=D(),r=k();e.sentenceId="MTK",e.sentenceName="Configuration packet";function s(i,a){return t(t({},r.initStubFields(i,e.sentenceId,e.sentenceName)),{packetType:n.parseIntSafe(i.sentenceId.substr(3)),data:a.slice(1).map(n.parseNumberOrString)})}e.decodeSentence=s;function o(i,a){var c=["$"+a+e.sentenceId+n.padLeft(i.packetType,3,"0")];c=c.concat(i.data.toString());var u=c.join(",");return u+n.createNmeaChecksumFooter(u)}e.encodePacket=o})(_e)),_e}var be={},ln;function ai(){return ln||(ln=1,(function(e){var t=be&&be.__assign||function(){return t=Object.assign||function(i){for(var a,c=1,u=arguments.length;c<u;c++){a=arguments[c];for(var f in a)Object.prototype.hasOwnProperty.call(a,f)&&(i[f]=a[f])}return i},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var n=D(),r=k();e.sentenceId="MWV",e.sentenceName="Wind speed and angle";function s(i,a){return t(t({},r.initStubFields(i,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"})}e.decodeSentence=s;function o(i,a){var c=["$"+a+e.sentenceId];c.push(n.encodeDegrees(i.windAngle)),c.push(i.reference==="relative"?"R":"T"),c.push(n.encodeFixed(i.speed,2)),c.push(i.units==="K"?"K":i.units==="M"?"M":"N"),c.push(i.status==="valid"?"A":"V");var u=c.join(",");return u+n.createNmeaChecksumFooter(u)}e.encodePacket=o})(be)),be}var Te={},hn;function ci(){return hn||(hn=1,(function(e){var t=Te&&Te.__assign||function(){return t=Object.assign||function(o){for(var i,a=1,c=arguments.length;a<c;a++){i=arguments[a];for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(o[u]=i[u])}return o},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var n=D(),r=k();e.sentenceId="RDID",e.sentenceName="RDI proprietary heading, pitch, and roll";function s(o,i){return t(t({},r.initStubFields(o,e.sentenceId,e.sentenceName)),{roll:n.parseFloatSafe(i[1]),pitch:n.parseFloatSafe(i[2]),heading:n.parseFloatSafe(i[3])})}e.decodeSentence=s})(Te)),Te}var Ie={},pn;function ui(){return pn||(pn=1,(function(e){var t=Ie&&Ie.__assign||function(){return t=Object.assign||function(o){for(var i,a=1,c=arguments.length;a<c;a++){i=arguments[a];for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(o[u]=i[u])}return o},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var n=D(),r=k();e.sentenceId="RMC",e.sentenceName="Recommended minimum navigation information";function s(o,i){return t(t({},r.initStubFields(o,e.sentenceId,e.sentenceName)),{datetime:n.parseDatetime(i[9],i[1]),status:i[2]==="A"?"valid":"warning",latitude:n.parseLatitude(i[3],i[4]),longitude:n.parseLongitude(i[5],i[6]),speedKnots:n.parseFloatSafe(i[7]),trackTrue:n.parseFloatSafe(i[8]),variation:n.parseFloatSafe(i[10]),variationPole:i[11]==="E"?"E":i[11]==="W"?"W":"",faaMode:i[12]})}e.decodeSentence=s})(Ie)),Ie}var we={},mn;function di(){return mn||(mn=1,(function(e){var t=we&&we.__assign||function(){return t=Object.assign||function(o){for(var i,a=1,c=arguments.length;a<c;a++){i=arguments[a];for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(o[u]=i[u])}return o},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var n=D(),r=k();e.sentenceId="VHW",e.sentenceName="Water speed and heading";function s(o,i){return t(t({},r.initStubFields(o,e.sentenceId,e.sentenceName)),{degreesTrue:n.parseFloatSafe(i[1]),degreesMagnetic:n.parseFloatSafe(i[3]),speedKnots:n.parseFloatSafe(i[5]),speedKmph:n.parseFloatSafe(i[7])})}e.decodeSentence=s})(we)),we}var ke={},gn;function fi(){return gn||(gn=1,(function(e){var t=ke&&ke.__assign||function(){return t=Object.assign||function(i){for(var a,c=1,u=arguments.length;c<u;c++){a=arguments[c];for(var f in a)Object.prototype.hasOwnProperty.call(a,f)&&(i[f]=a[f])}return i},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var n=D(),r=k();e.sentenceId="VTG",e.sentenceName="Track made good and ground speed";function s(i,a){return t(t({},r.initStubFields(i,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]})}e.decodeSentence=s;function o(i,a){var c=["$"+a+e.sentenceId];c.push(n.encodeDegrees(i.trackTrue)),c.push("T"),c.push(n.encodeDegrees(i.trackMagnetic)),c.push("M"),c.push(n.encodeFixed(i.speedKnots,2)),c.push("N"),i.speedKmph?(c.push(n.encodeFixed(i.speedKmph,2)),c.push("K")):(c.push(""),c.push("")),i.faaMode&&c.push(i.faaMode);var u=c.join(",");return u+n.createNmeaChecksumFooter(u)}e.encodePacket=o})(ke)),ke}var De={},vn;function li(){return vn||(vn=1,(function(e){var t=De&&De.__assign||function(){return t=Object.assign||function(o){for(var i,a=1,c=arguments.length;a<c;a++){i=arguments[a];for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(o[u]=i[u])}return o},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var n=D(),r=k();e.sentenceId="ZDA",e.sentenceName="UTC, day, month, year, and local time zone";function s(o,i){return t(t({},r.initStubFields(o,e.sentenceId,e.sentenceName)),{datetime:n.parseTime(i[1],i.slice(2,5).join("")),localZoneHours:n.parseIntSafe(i[5]),localZoneMinutes:n.parseIntSafe(i[6])})}e.decodeSentence=s})(De)),De}var Pe={},yn;function Sn(){return yn||(yn=1,(function(e){var t=Pe&&Pe.__assign||function(){return t=Object.assign||function(s){for(var o,i=1,a=arguments.length;i<a;i++){o=arguments[i];for(var c in o)Object.prototype.hasOwnProperty.call(o,c)&&(s[c]=o[c])}return s},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var n=k();e.sentenceId="?";function r(s,o){return t(t({},n.initStubFields(s,e.sentenceId)),{originalPacketId:s.sentenceId,dataFields:o.slice(1)})}e.decodeSentence=r})(Pe)),Pe}var _n;function hi(){if(_n)return N;_n=1;var e=N&&N.__extends||(function(){var b=function(I,P){return b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,x){E.__proto__=x}||function(E,x){for(var te in x)x.hasOwnProperty(te)&&(E[te]=x[te])},b(I,P)};return function(I,P){b(I,P);function E(){this.constructor=I}I.prototype=P===null?Object.create(P):(E.prototype=P.prototype,new E)}})();Object.defineProperty(N,"__esModule",{value:!0});var t=zr(),n=Jr(),r=Yr(),s=Zr(),o=Xr(),i=Qr(),a=$r(),c=ei(),u=ti(),f=ni(),l=ri(),d=ii(),p=si(),m=oi(),S=ai(),w=ci(),G=ui(),L=di(),$=fi(),dt=li(),Me=k(),ft=Sn(),lt=D(),ht={APB:t.decodeSentence,BWC:n.decodeSentence,DBT:r.decodeSentence,DTM:s.decodeSentence,GGA:o.decodeSentence,GLL:i.decodeSentence,GNS:a.decodeSentence,GSA:c.decodeSentence,GST:u.decodeSentence,GSV:f.decodeSentence,HDG:l.decodeSentence,HDM:d.decodeSentence,HDT:p.decodeSentence,MTK:m.decodeSentence,MWV:S.decodeSentence,RDID:w.decodeSentence,RMC:G.decodeSentence,VHW:L.decodeSentence,VTG:$.decodeSentence,ZDA:dt.decodeSentence},pt={DBT:r.encodePacket,GGA:o.encodePacket,GLL:i.encodePacket,GNS:a.encodePacket,HDM:d.encodePacket,HDT:p.encodePacket,MTK:m.encodePacket,MWV:S.encodePacket,VTG:$.encodePacket},h=(function(){function b(I){I===void 0&&(I=!1),this.ableToParseBadChecksum=I}return b.getParser=function(I){return I.sentenceId.substr(0,3)==="MTK"?m.decodeSentence:ht[I.sentenceId]},b.prototype.assemble=function(I,P){var E=b.getParser(I);return E?E(I,P):this.assembleCustomPacket(I,P)},b.prototype.assembleCustomPacket=function(I,P){return null},b})();N.DefaultPacketFactory=h;var g=new h;function v(b,I){var P=!0;if(!lt.validNmeaChecksum(b)){if(!I.ableToParseBadChecksum)throw Error('Invalid sentence: "'+b+'".');P=!1}var E=b.split("*")[0].split(","),x=Me.parseStub(E[0],P),te=I.assemble(x,E);if(!te)throw Error('No known parser for sentence ID "'+x.sentenceId+'".');return te}N.parseGenericPacket=v;function _(b){return v(b,g)}N.parseNmeaSentence=_;function M(b,I){if(I===void 0&&(I="P"),b===void 0)throw new Error("Packet must be given.");var P=pt[b.sentenceId];if(P)return P(b,I);throw Error('No known encoder for sentence ID "'+b.sentenceId+'"')}N.encodeNmeaPacket=M;var F=(function(b){e(I,b);function I(){return b.call(this,!0)||this}return I.prototype.assembleCustomPacket=function(P,E){return ft.decodeSentence(P,E)},I})(h);N.UnsafePacketFactory=F;var U=new F;function ee(b){return v(b,U)}N.parseUnsafeNmeaSentence=ee;function K(b){return b.sentenceId==="?"?b.originalPacketId:b.sentenceId}return N.getUnsafePacketId=K,N}var qe=hi(),pi=Sn(),at=k();const bn=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];function Tn(e){const t=e>>4&15,n=e>>0&15;return bn[t]+bn[n]}function C(e,t,n){let r=typeof e=="string"?e:e.toFixed(0);for(;r.length<t;)r=n+r;return r}function mi(e){const[t,n]=e.split("*"),r=ct(t),s=Number.parseInt(n,16);return r===s}function ct(e){let t=e.charCodeAt(1);for(let n=2;n<e.length;n+=1)t=t^e.charCodeAt(n);return t=t&255,t}function In(e){return`*${Tn(ct(e))}`}function gi(e){return e+In(e)}function vi(e,t){return e===void 0?"":e.toFixed(t)}function yi(e){if(e===void 0)return",";let t;e<0?(t="S",e=-e):t="N";const n=Math.floor(e);let r=C(n,2,"0");const o=(e-n)*60,i=C(o.toFixed(6),9,"0");return r=`${r+i},${t}`,r}function Si(e){if(e===void 0)return",";let t;e<0?(t="W",e=-e):t="E";const n=Math.floor(e);let r=C(n,3,"0");const o=(e-n)*60,i=C(o.toFixed(6),9,"0");return r=`${r+i},${t}`,r}function _i(e){return e===void 0?",":`${e.toFixed(1)},M`}function bi(e){return e===void 0?"":e.toFixed(1)}function Ti(e){return e===void 0?",":`${e.toFixed(1)},M`}function Ii(e){return e===void 0?"":e.toFixed(1)}function wi(e){return e===void 0?"":C(e.toFixed(2),6,"0")}function ki(e){if(e===void 0)return"";const t=e.getUTCFullYear(),n=e.getUTCMonth()+1,r=e.getUTCDate();return C(r,2,"0")+C(n,2,"0")+t.toFixed(0).substr(2)}function Di(e){if(e===void 0)return"";const t=e.getUTCHours(),n=e.getUTCMinutes(),r=e.getUTCSeconds();return C(t,2,"0")+C(n,2,"0")+C(r,2,"0")}function Pi(e){return e===void 0?"":String(e)}function j(e){return e===""?0:Number.parseFloat(e)}function Mi(e){return e===""?0:Number.parseInt(e,10)}function Ai(e){if(e===void 0)return"";const t=Number.parseFloat(e);return Number.isNaN(t)?e:t}function ut(e){const t=e.indexOf(".");if(t<0)return 0;let n,r;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}function Ei(e,t){const n=t==="N"?1:-1;return ut(e)*n}function Fi(e,t){const n=t==="E"?1:-1;return ut(e)*n}function Ni(e,t){if(e.length===4)return Number(e);if(e.length===2)if(t){let n=Number(e);return n<73?n=2e3+n:n=1900+n,n}else return+`20${e}`;else throw new Error(`Unexpected year string: ${e}`)}function Oi(e,t,n=!1){if(e==="")return new Date(0);const r=new Date;if(t){const a=t.slice(4),c=Number.parseInt(t.slice(2,4),10)-1,u=t.slice(0,2);r.setUTCFullYear(Ni(a,n),Number(c),Number(u))}r.setUTCHours(Number(e.slice(0,2))),r.setUTCMinutes(Number(e.slice(2,4))),r.setUTCSeconds(Number(e.slice(4,6)));const s=e.slice(7),o=s.length;let i=0;return o!==0&&(i=Number.parseFloat(s)*10**(3-o)),r.setUTCMilliseconds(Number(i)),r}const Ci="DBK",Ri="Depth Below Keel";function ji(e,t){return{...at.initStubFields(e,Ci,Ri),depthFeet:j(t[1]),depthMeters:j(t[3]),depthFathoms:j(t[5])}}const Gi="DBS",Li="Depth Below Surface";function Ui(e,t){return{...at.initStubFields(e,Gi,Li),depthFeet:j(t[1]),depthMeters:j(t[3]),depthFathoms:j(t[5])}}const qi="DPT",Hi="Depth of Water";function xi(e,t){return{...at.initStubFields(e,qi,Hi),depthMeters:j(t[1]),offsetMeters:j(t[2]),maximumRangeScale:j(t[3])}}function wn(e,t){switch(e.talkerId){case"DBS":return Ui(e,t);case"DBK":return ji(e,t);case"DPT":return xi(e,t);default:return null}}class Wi extends qe.DefaultPacketFactory{assembleCustomPacket(t,n){return wn(t,n)}}const Vi=new Wi;function Bi(e){return qe.parseGenericPacket(e,Vi)}class Ki extends qe.DefaultPacketFactory{constructor(){super(!0)}assembleCustomPacket(t,n){const r=wn(t,n);return r||pi.decodeSentence(t,n)}}const zi=new Ki;function kn(e){return qe.parseGenericPacket(e,zi)}function Dn(e,t){return!t||t.length===0?!0:e!==void 0&&t.includes(e)}class Ji{container;constructor(){this.container=""}transform(t,n){this.container+=t;const r=this.container.split(`\r
|
|
4
|
+
`),s=r.pop();this.container=s??"",r.forEach(o=>{o.length>0&&n.enqueue(o)})}flush(t){this.container=""}}const Yi=Bt(async({input:e})=>{if(!navigator.serial)throw new Error("Web Serial API is not supported in this browser.");console.log("Requesting serial port...");const t=await navigator.serial.requestPort();if(console.log(`Opening port at ${e.baudRate} baud...`),t.readable||t.writable){console.log("Port is already open, closing first...");try{await t.close()}catch(n){console.warn("Error closing already-open port:",n)}}return await t.open({baudRate:e.baudRate}),console.log("Port open."),t}),Zi=Bt(async({input:e})=>{if(e.port)try{(e.port.readable||e.port.writable)&&(await e.port.close(),console.log("Port closed successfully."))}catch(t){console.warn("Error closing port:",t)}}),Xi=Er(({input:e,sendBack:t,receive:n})=>{const{port:r}=e;if(!r||!r.readable){t({type:"SERIAL.ERROR",error:"Invalid port context."});return}const s=new Ji,i=r.readable.pipeThrough(new TextDecoderStream).pipeThrough(new TransformStream({transform:s.transform.bind(s),flush:s.flush.bind(s)})).getReader();let a=!0;async function c(){try{for(;a;){const{value:u,done:f}=await i.read();if(f)break;if(u&&u.length>0)try{const l=kn(u);if(l.sentenceId==="?")continue;t({type:"SERIAL.DATA",data:l})}catch(l){const d=l instanceof Error?l.message:String(l);console.warn("Failed to parse NMEA sentence:",u,d),t({type:"SERIAL.ERROR",error:`Parser Error: ${d}`})}}}catch(u){if(console.error("Read loop error:",u),a){const f=u instanceof Error?u.message:String(u);t({type:"FATAL_ERROR",error:f})}}finally{console.log("Read loop finished."),t({type:"SERIAL.DISCONNECTED"})}}return c(),n(u=>{u.type==="STOP"&&(console.log("Received STOP, cancelling reader..."),a=!1,i.cancel().catch(()=>{}))}),()=>{console.log("Cleaning up stream reader actor..."),a=!1,i&&i.cancel().catch(()=>{})}});function Pn(e){const{adapter:t,allowedSentenceIds:n,initialData:r,initialPackets:s}=e;return Jt({actors:{connectToSerial:Yi,readNmeaStream:Xi,closePort:Zi},actions:{setPort:O((o,i)=>({port:i.port,error:null})),setError:O((o,i)=>{const a=i.error;let c;return typeof a=="string"?c=a:a instanceof Error?c=a.message||"Failed to connect.":c=String(a)||"Failed to connect.",{error:c}}),logParsedData:({context:o},i)=>{if(!o.enableLogging)return;const c=i.packet.sentenceId;Dn(c,n)&&console.log(`${c} Packet:`,i.packet)},storePacket:O(({context:o},i)=>{const c=i.packet.sentenceId;if(c&&Dn(c,n)){const u={...o.packets,[c]:i.packet};return{packets:u,data:t(u),error:null}}return{packets:o.packets,data:t(o.packets),error:null}}),clearError:O((o,i)=>({error:i.error})),setFatalError:O((o,i)=>({error:i.error})),disconnect:O({port:null,error:null,packets:s,data:r}),setLogging:O((o,i)=>({enableLogging:i.enabled})),setBaudRate:O((o,i)=>({baudRate:i.baudRate}))}}).createMachine({id:"nmea",initial:"disconnected",context:{port:null,error:null,packets:s,data:r,enableLogging:!1,baudRate:4800},on:{SET_LOGGING:{actions:{type:"setLogging",params:({event:o})=>({enabled:o.enabled})}}},states:{disconnected:{on:{CONNECT:"connecting",SET_BAUD_RATE:{actions:{type:"setBaudRate",params:({event:o})=>({baudRate:o.baudRate})}}}},connecting:{invoke:{id:"connectToSerial",src:"connectToSerial",input:({context:o})=>({baudRate:o.baudRate}),onDone:{target:"connected",actions:{type:"setPort",params:({event:o})=>({port:o.output})}},onError:{target:"error",actions:{type:"setError",params:({event:o})=>({error:o.error})}}}},connected:{on:{"SERIAL.DATA":{actions:[{type:"logParsedData",params:({event:o})=>({packet:o.data})},{type:"storePacket",params:({event:o})=>({packet:o.data})}]},"SERIAL.ERROR":{actions:{type:"clearError",params:({event:o})=>({error:o.error})}},FATAL_ERROR:{target:"error",actions:{type:"setFatalError",params:({event:o})=>({error:o.error})}},"SERIAL.DISCONNECTED":{target:"disconnecting"},DISCONNECT:{actions:Ue("streamReader",{type:"STOP"})}},invoke:{id:"streamReader",src:"readNmeaStream",input:({context:o})=>({port:o.port})}},disconnecting:{invoke:{id:"closePort",src:"closePort",input:({context:o})=>({port:o.port}),onDone:{target:"disconnected",actions:"disconnect"},onError:{target:"disconnected",actions:"disconnect"}}},error:{on:{CONNECT:"connecting"}}}})}function Qi(e,t,n){return e&&e.fixType!=="none"?{latitude:e.latitude,longitude:e.longitude,source:"GGA",fixType:e.fixType,altitudeMeters:e.altitudeMeters,satellitesInView:e.satellitesInView,horizontalDilution:e.horizontalDilution}:t&&t.status==="valid"?{latitude:t.latitude,longitude:t.longitude,source:"RMC",status:t.status}:n&&n.status==="valid"?{latitude:n.latitude,longitude:n.longitude,source:"GLL",status:"valid"}:null}function $i(e,t,n,r){if(e){const s=new Date(e.datetime),o=e.localZoneHours*60+e.localZoneMinutes;return s.setMinutes(s.getMinutes()+o),{utc:e.datetime,local:s,source:"ZDA"}}return t&&t.fixType!=="none"?{utc:t.time,local:null,source:"GGA"}:n&&n.status==="valid"?{utc:n.datetime,local:null,source:"RMC"}:r&&r.status==="valid"?{utc:r.time,local:null,source:"GLL"}:null}function es(e,t){return e?{knots:e.speedKnots,source:"VTG"}:t&&t.status==="valid"?{knots:t.speedKnots,source:"RMC"}:null}function ts(e){return e.variationDirection==="W"?-e.variation:(e.variationDirection==="E",e.variation)}function ns(e,t,n,r,s,o){if(e&&e.heading!==void 0)return{degreesTrue:e.heading,source:"HDT",isDerived:!1};if(t&&t.heading!==void 0){const a=ts(t);return{degreesTrue:t.heading+a,source:"HDG",isDerived:!1}}if(n&&n.heading!==void 0&&o!==void 0)return{degreesTrue:n.heading+o,source:"HDM",isDerived:!1};const i=r?.trackTrue??s?.trackTrue;return i!==void 0?{degreesTrue:i,source:"COG",isDerived:!0}:null}function rs(e,t,n,r){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}function Mn(e,t){const n=$i(e.ZDA,e.GGA,e.RMC,e.GLL),r=Qi(e.GGA,e.RMC,e.GLL),s=es(e.VTG,e.RMC),o=ns(e.HDT,e.HDG,e.HDM,e.RMC,e.VTG,t),i=rs(e.DPT,e.DBT,e.DBS,e.DBK);return{time:n,position:r,speed:s,heading:o,depth:i}}const An=["GGA","RMC","GLL","VTG","HDT","HDG","HDM","DPT","DBT","DBS","DBK","ZDA"];function En(e){return t=>Mn(t,e)}const Fn={time:null,position:null,speed:null,heading:null,depth:null},Nn={};function On(e){return{adapter:En(e?.externalVariation),allowedSentenceIds:e?.allowedSentenceIds??An,initialData:Fn,initialPackets:Nn}}function is(e){return Pn(On(e))}y.NAVIGATION_SENTENCE_IDS=An,y.appendChecksumFooter=gi,y.computeNavigationData=Mn,y.computeNmeaChecksum=ct,y.createNavigationAdapter=En,y.createNavigationNmeaConfig=On,y.createNavigationNmeaMachine=is,y.createNmeaChecksumFooter=In,y.createNmeaMachine=Pn,y.encodeAltitude=_i,y.encodeAltitudeNoUnits=bi,y.encodeDate=ki,y.encodeDegrees=wi,y.encodeFixed=vi,y.encodeGeoidalSeperation=Ti,y.encodeGeoidalSeperationNoUnits=Ii,y.encodeLatitude=yi,y.encodeLongitude=Si,y.encodeTime=Di,y.encodeValue=Pi,y.initialNavigationData=Fn,y.initialNavigationPackets=Nn,y.padLeft=C,y.parseDmCoordinate=ut,y.parseFloatSafe=j,y.parseIntSafe=Mi,y.parseLatitude=Ei,y.parseLongitude=Fi,y.parseNmeaSentence=Bi,y.parseNumberOrString=Ai,y.parseTime=Oi,y.parseUnsafeNmeaSentence=kn,y.toHexString=Tn,y.validNmeaChecksum=mi,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nmea-web-serial",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"packageManager": "npm@10.8.2",
|
|
6
|
+
"description": "NMEA 0183 sentence parser for the Web Serial API",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Jonathan Dawe",
|
|
9
|
+
"email": "jonwe@bas.ac.uk"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/JonnyDawe/nmea-web-serial#readme",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/JonnyDawe/nmea-web-serial.git"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/JonnyDawe/nmea-web-serial/issues"
|
|
18
|
+
},
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"import": "./dist/nmea-web-serial.js",
|
|
22
|
+
"require": "./dist/nmea-web-serial.cjs"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"main": "./dist/nmea-web-serial.cjs",
|
|
26
|
+
"module": "./dist/nmea-web-serial.js",
|
|
27
|
+
"types": "./dist/nmea-web-serial.d.ts",
|
|
28
|
+
"files": [
|
|
29
|
+
"dist"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"dev": "vite",
|
|
33
|
+
"build": "tsc && vite build",
|
|
34
|
+
"build:all": "npm run build && turbo run build",
|
|
35
|
+
"lint": "eslint . --fix",
|
|
36
|
+
"lint:all": "turbo run lint",
|
|
37
|
+
"test": "vitest --run",
|
|
38
|
+
"test:watch": "vitest",
|
|
39
|
+
"test:coverage": "vitest --coverage",
|
|
40
|
+
"test:all": "turbo run test",
|
|
41
|
+
"release": "npm run build && changelogen --release --push && npm publish",
|
|
42
|
+
"prepare": "husky install"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"nmea-simple": "^3.3.0",
|
|
46
|
+
"xstate": "^5.24.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@antfu/eslint-config": "^4.19.0",
|
|
50
|
+
"@commitlint/cli": "^20.1.0",
|
|
51
|
+
"@commitlint/config-conventional": "^20.0.0",
|
|
52
|
+
"@types/node": "^22.19.0",
|
|
53
|
+
"@types/w3c-web-serial": "^1.0.8",
|
|
54
|
+
"@vitest/coverage-v8": "^4.0.7",
|
|
55
|
+
"camelcase": "^8.0.0",
|
|
56
|
+
"changelogen": "^0.6.2",
|
|
57
|
+
"eslint": "^9.39.1",
|
|
58
|
+
"husky": "^9.1.7",
|
|
59
|
+
"lint-staged": "^16.2.6",
|
|
60
|
+
"turbo": "^2.0.0",
|
|
61
|
+
"typescript": "^5.9.3",
|
|
62
|
+
"vite": "^7.2.1",
|
|
63
|
+
"vite-plugin-dts": "^4.5.4",
|
|
64
|
+
"vitest": "^4.0.7"
|
|
65
|
+
},
|
|
66
|
+
"lint-staged": {
|
|
67
|
+
"*.ts": "npm run lint"
|
|
68
|
+
},
|
|
69
|
+
"workspaces": [
|
|
70
|
+
"example"
|
|
71
|
+
]
|
|
72
|
+
}
|