xstate 6.0.0-beta.2 → 6.0.0-beta.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.
Files changed (65) hide show
  1. package/README.md +4 -2
  2. package/dist/{createActor-20a97166.esm.js → createActor-49ea55ba.esm.js} +17 -8
  3. package/dist/{createActor-c91c9ffe.cjs.js → createActor-73aa92ba.cjs.js} +17 -7
  4. package/dist/{createActor-0250284a.development.esm.js → createActor-a085b20b.development.esm.js} +17 -8
  5. package/dist/{createActor-c029d29f.development.cjs.js → createActor-dfb6b790.development.cjs.js} +17 -7
  6. package/dist/declarations/src/fsm.d.ts +7 -7
  7. package/dist/{effectDescriptor-47f73e7e.cjs.js → effectDescriptor-3402f63e.cjs.js} +1 -1
  8. package/dist/{effectDescriptor-e93df910.esm.js → effectDescriptor-65821048.development.esm.js} +1 -1
  9. package/dist/{effectDescriptor-5ac7dccb.development.esm.js → effectDescriptor-72c62058.esm.js} +1 -1
  10. package/dist/{effectDescriptor-3fff5c51.development.cjs.js → effectDescriptor-d0ea44ad.development.cjs.js} +1 -1
  11. package/dist/{legacySnapshot-ae6594a7.development.esm.js → legacySnapshot-11aba2d2.development.esm.js} +1 -1
  12. package/dist/{legacySnapshot-ebf0b2b8.development.cjs.js → legacySnapshot-2e2c1d3b.development.cjs.js} +1 -1
  13. package/dist/{legacySnapshot-8d595687.cjs.js → legacySnapshot-a85dfbe2.cjs.js} +1 -1
  14. package/dist/{legacySnapshot-9e06feb4.esm.js → legacySnapshot-fffe81a0.esm.js} +1 -1
  15. package/dist/xstate-actors.cjs.js +30 -5
  16. package/dist/xstate-actors.development.cjs.js +30 -5
  17. package/dist/xstate-actors.development.esm.js +31 -6
  18. package/dist/xstate-actors.esm.js +31 -6
  19. package/dist/xstate-actors.umd.min.js +1 -1
  20. package/dist/xstate-actors.umd.min.js.map +1 -1
  21. package/dist/xstate-durable.cjs.js +3 -3
  22. package/dist/xstate-durable.development.cjs.js +3 -3
  23. package/dist/xstate-durable.development.esm.js +3 -3
  24. package/dist/xstate-durable.esm.js +3 -3
  25. package/dist/xstate-durable.umd.min.js +1 -1
  26. package/dist/xstate-durable.umd.min.js.map +1 -1
  27. package/dist/xstate-fsm.cjs.js +61 -31
  28. package/dist/xstate-fsm.development.cjs.js +61 -31
  29. package/dist/xstate-fsm.development.esm.js +61 -31
  30. package/dist/xstate-fsm.esm.js +61 -31
  31. package/dist/xstate-fsm.umd.min.js +1 -1
  32. package/dist/xstate-fsm.umd.min.js.map +1 -1
  33. package/dist/xstate-graph.cjs.js +1 -1
  34. package/dist/xstate-graph.development.cjs.js +1 -1
  35. package/dist/xstate-graph.development.esm.js +2 -2
  36. package/dist/xstate-graph.esm.js +2 -2
  37. package/dist/xstate-persist.cjs.js +2 -2
  38. package/dist/xstate-persist.development.cjs.js +2 -2
  39. package/dist/xstate-persist.development.esm.js +3 -3
  40. package/dist/xstate-persist.esm.js +3 -3
  41. package/dist/xstate-persist.umd.min.js +1 -1
  42. package/dist/xstate-persist.umd.min.js.map +1 -1
  43. package/dist/xstate-validation.cjs.js +1 -1
  44. package/dist/xstate-validation.development.cjs.js +1 -1
  45. package/dist/xstate-validation.development.esm.js +1 -1
  46. package/dist/xstate-validation.esm.js +1 -1
  47. package/dist/xstate.cjs.js +26 -8
  48. package/dist/xstate.development.cjs.js +26 -8
  49. package/dist/xstate.development.esm.js +28 -10
  50. package/dist/xstate.esm.js +28 -10
  51. package/dist/xstate.umd.min.js +1 -1
  52. package/dist/xstate.umd.min.js.map +1 -1
  53. package/docs/actor-logic.md +1 -1
  54. package/docs/api-stability.json +93 -81
  55. package/docs/faq.md +1 -1
  56. package/docs/fsm.md +53 -10
  57. package/docs/index.md +2 -1
  58. package/docs/inspect-actor-systems.md +20 -3
  59. package/docs/inspection.md +5 -1
  60. package/docs/invoke.md +2 -2
  61. package/docs/migrate-inspector.md +141 -0
  62. package/docs/system-transitions.md +2 -0
  63. package/docs/transitions.md +5 -1
  64. package/docs/xstate-v5-to-v6.md +6 -4
  65. package/package.json +1 -1
@@ -63,7 +63,63 @@ function createFSM(config) {
63
63
  output: undefined,
64
64
  error: undefined
65
65
  });
66
- const initialState = createSnapshot(config.initial, config.context ?? {});
66
+ const checkTransition = transition => {
67
+ if (typeof transition === 'string') {
68
+ throw new TypeError(`Use { target: ${JSON.stringify(transition)} } instead of a string transition. Run the @xstate/codemod string-targets transform.`);
69
+ }
70
+ };
71
+ let hasAlways = false;
72
+ for (const value of Object.getOwnPropertyNames(config.states)) {
73
+ const state = config.states[value];
74
+ checkTransition(state?.always);
75
+ hasAlways ||= state?.always !== undefined;
76
+ for (const type of Object.getOwnPropertyNames(state?.on ?? {})) {
77
+ checkTransition(state.on[type]);
78
+ }
79
+ }
80
+ const getState = value => Object.hasOwn(config.states, value) ? config.states[value] : undefined;
81
+ const step = (snapshot, selected, event) => {
82
+ const result = typeof selected === 'function' ? selected({
83
+ context: snapshot.context,
84
+ event
85
+ }) : selected;
86
+ checkTransition(result);
87
+ if (!result) {
88
+ return undefined;
89
+ }
90
+ let {
91
+ value,
92
+ context
93
+ } = snapshot;
94
+ const {
95
+ target = value,
96
+ context: patch
97
+ } = result;
98
+ for (const key of Reflect.ownKeys({
99
+ ...patch
100
+ })) {
101
+ if (!Object.hasOwn(context, key) || !Object.is(patch[key], context[key])) {
102
+ context = {
103
+ ...context,
104
+ ...patch
105
+ };
106
+ }
107
+ }
108
+ return target === value && context === snapshot.context ? snapshot : createSnapshot(target, context);
109
+ };
110
+ const settle = (snapshot, event) => {
111
+ for (;;) {
112
+ const next = step(snapshot, getState(snapshot.value)?.always, event);
113
+ if (!next) {
114
+ return snapshot;
115
+ }
116
+ snapshot = next;
117
+ }
118
+ };
119
+ const initialSnapshot = createSnapshot(config.initial, config.context ?? {});
120
+ const initialState = hasAlways ? settle(initialSnapshot, {
121
+ type: 'xstate.init'
122
+ }) : initialSnapshot;
67
123
  return {
68
124
  id: config.id,
69
125
  config,
@@ -72,36 +128,10 @@ function createFSM(config) {
72
128
  getInitialSnapshot: () => initialState,
73
129
  getPersistedSnapshot: snapshot => snapshot,
74
130
  transition(snapshot, event) {
75
- let {
76
- value,
77
- context
78
- } = snapshot;
79
- const transitions = (Object.hasOwn(config.states, value) ? config.states[value] : undefined)?.on;
80
- const transition = Object.hasOwn(transitions || {}, event.type) && transitions[event.type];
81
- const {
82
- target = value,
83
- context: patch
84
- } = (typeof transition === 'string' ? {
85
- target: transition
86
- } : typeof transition === 'function' ? transition({
87
- context,
88
- event
89
- }) : transition) || {};
90
- // Copy only when the patch changes a value, so a no-op patch keeps the
91
- // current snapshot. After the first copy every key matches. Iterate a
92
- // spread copy so inherited keys, which the spread below ignores, are
93
- // skipped.
94
- for (const key of Reflect.ownKeys({
95
- ...patch
96
- })) {
97
- if (!Object.hasOwn(context, key) || !Object.is(patch[key], context[key])) {
98
- context = {
99
- ...context,
100
- ...patch
101
- };
102
- }
103
- }
104
- return [target === value && context === snapshot.context ? snapshot : createSnapshot(target, context), []];
131
+ const transitions = (Object.hasOwn(config.states, snapshot.value) ? config.states[snapshot.value] : undefined)?.on;
132
+ const selected = Object.hasOwn(transitions || {}, event.type) ? transitions[event.type] : undefined;
133
+ const next = step(snapshot, selected, event);
134
+ return [next ? hasAlways ? settle(next, event) : next : snapshot, []];
105
135
  }
106
136
  };
107
137
  }
@@ -63,7 +63,63 @@ function createFSM(config) {
63
63
  output: undefined,
64
64
  error: undefined
65
65
  });
66
- const initialState = createSnapshot(config.initial, config.context ?? {});
66
+ const checkTransition = transition => {
67
+ if (typeof transition === 'string') {
68
+ throw new TypeError(`Use { target: ${JSON.stringify(transition)} } instead of a string transition. Run the @xstate/codemod string-targets transform.`);
69
+ }
70
+ };
71
+ let hasAlways = false;
72
+ for (const value of Object.getOwnPropertyNames(config.states)) {
73
+ const state = config.states[value];
74
+ checkTransition(state?.always);
75
+ hasAlways ||= state?.always !== undefined;
76
+ for (const type of Object.getOwnPropertyNames(state?.on ?? {})) {
77
+ checkTransition(state.on[type]);
78
+ }
79
+ }
80
+ const getState = value => Object.hasOwn(config.states, value) ? config.states[value] : undefined;
81
+ const step = (snapshot, selected, event) => {
82
+ const result = typeof selected === 'function' ? selected({
83
+ context: snapshot.context,
84
+ event
85
+ }) : selected;
86
+ checkTransition(result);
87
+ if (!result) {
88
+ return undefined;
89
+ }
90
+ let {
91
+ value,
92
+ context
93
+ } = snapshot;
94
+ const {
95
+ target = value,
96
+ context: patch
97
+ } = result;
98
+ for (const key of Reflect.ownKeys({
99
+ ...patch
100
+ })) {
101
+ if (!Object.hasOwn(context, key) || !Object.is(patch[key], context[key])) {
102
+ context = {
103
+ ...context,
104
+ ...patch
105
+ };
106
+ }
107
+ }
108
+ return target === value && context === snapshot.context ? snapshot : createSnapshot(target, context);
109
+ };
110
+ const settle = (snapshot, event) => {
111
+ for (;;) {
112
+ const next = step(snapshot, getState(snapshot.value)?.always, event);
113
+ if (!next) {
114
+ return snapshot;
115
+ }
116
+ snapshot = next;
117
+ }
118
+ };
119
+ const initialSnapshot = createSnapshot(config.initial, config.context ?? {});
120
+ const initialState = hasAlways ? settle(initialSnapshot, {
121
+ type: 'xstate.init'
122
+ }) : initialSnapshot;
67
123
  return {
68
124
  id: config.id,
69
125
  config,
@@ -72,36 +128,10 @@ function createFSM(config) {
72
128
  getInitialSnapshot: () => initialState,
73
129
  getPersistedSnapshot: snapshot => snapshot,
74
130
  transition(snapshot, event) {
75
- let {
76
- value,
77
- context
78
- } = snapshot;
79
- const transitions = (Object.hasOwn(config.states, value) ? config.states[value] : undefined)?.on;
80
- const transition = Object.hasOwn(transitions || {}, event.type) && transitions[event.type];
81
- const {
82
- target = value,
83
- context: patch
84
- } = (typeof transition === 'string' ? {
85
- target: transition
86
- } : typeof transition === 'function' ? transition({
87
- context,
88
- event
89
- }) : transition) || {};
90
- // Copy only when the patch changes a value, so a no-op patch keeps the
91
- // current snapshot. After the first copy every key matches. Iterate a
92
- // spread copy so inherited keys, which the spread below ignores, are
93
- // skipped.
94
- for (const key of Reflect.ownKeys({
95
- ...patch
96
- })) {
97
- if (!Object.hasOwn(context, key) || !Object.is(patch[key], context[key])) {
98
- context = {
99
- ...context,
100
- ...patch
101
- };
102
- }
103
- }
104
- return [target === value && context === snapshot.context ? snapshot : createSnapshot(target, context), []];
131
+ const transitions = (Object.hasOwn(config.states, snapshot.value) ? config.states[snapshot.value] : undefined)?.on;
132
+ const selected = Object.hasOwn(transitions || {}, event.type) ? transitions[event.type] : undefined;
133
+ const next = step(snapshot, selected, event);
134
+ return [next ? hasAlways ? settle(next, event) : next : snapshot, []];
105
135
  }
106
136
  };
107
137
  }
@@ -59,7 +59,63 @@ function createFSM(config) {
59
59
  output: undefined,
60
60
  error: undefined
61
61
  });
62
- const initialState = createSnapshot(config.initial, config.context ?? {});
62
+ const checkTransition = transition => {
63
+ if (typeof transition === 'string') {
64
+ throw new TypeError(`Use { target: ${JSON.stringify(transition)} } instead of a string transition. Run the @xstate/codemod string-targets transform.`);
65
+ }
66
+ };
67
+ let hasAlways = false;
68
+ for (const value of Object.getOwnPropertyNames(config.states)) {
69
+ const state = config.states[value];
70
+ checkTransition(state?.always);
71
+ hasAlways ||= state?.always !== undefined;
72
+ for (const type of Object.getOwnPropertyNames(state?.on ?? {})) {
73
+ checkTransition(state.on[type]);
74
+ }
75
+ }
76
+ const getState = value => Object.hasOwn(config.states, value) ? config.states[value] : undefined;
77
+ const step = (snapshot, selected, event) => {
78
+ const result = typeof selected === 'function' ? selected({
79
+ context: snapshot.context,
80
+ event
81
+ }) : selected;
82
+ checkTransition(result);
83
+ if (!result) {
84
+ return undefined;
85
+ }
86
+ let {
87
+ value,
88
+ context
89
+ } = snapshot;
90
+ const {
91
+ target = value,
92
+ context: patch
93
+ } = result;
94
+ for (const key of Reflect.ownKeys({
95
+ ...patch
96
+ })) {
97
+ if (!Object.hasOwn(context, key) || !Object.is(patch[key], context[key])) {
98
+ context = {
99
+ ...context,
100
+ ...patch
101
+ };
102
+ }
103
+ }
104
+ return target === value && context === snapshot.context ? snapshot : createSnapshot(target, context);
105
+ };
106
+ const settle = (snapshot, event) => {
107
+ for (;;) {
108
+ const next = step(snapshot, getState(snapshot.value)?.always, event);
109
+ if (!next) {
110
+ return snapshot;
111
+ }
112
+ snapshot = next;
113
+ }
114
+ };
115
+ const initialSnapshot = createSnapshot(config.initial, config.context ?? {});
116
+ const initialState = hasAlways ? settle(initialSnapshot, {
117
+ type: 'xstate.init'
118
+ }) : initialSnapshot;
63
119
  return {
64
120
  id: config.id,
65
121
  config,
@@ -68,36 +124,10 @@ function createFSM(config) {
68
124
  getInitialSnapshot: () => initialState,
69
125
  getPersistedSnapshot: snapshot => snapshot,
70
126
  transition(snapshot, event) {
71
- let {
72
- value,
73
- context
74
- } = snapshot;
75
- const transitions = (Object.hasOwn(config.states, value) ? config.states[value] : undefined)?.on;
76
- const transition = Object.hasOwn(transitions || {}, event.type) && transitions[event.type];
77
- const {
78
- target = value,
79
- context: patch
80
- } = (typeof transition === 'string' ? {
81
- target: transition
82
- } : typeof transition === 'function' ? transition({
83
- context,
84
- event
85
- }) : transition) || {};
86
- // Copy only when the patch changes a value, so a no-op patch keeps the
87
- // current snapshot. After the first copy every key matches. Iterate a
88
- // spread copy so inherited keys, which the spread below ignores, are
89
- // skipped.
90
- for (const key of Reflect.ownKeys({
91
- ...patch
92
- })) {
93
- if (!Object.hasOwn(context, key) || !Object.is(patch[key], context[key])) {
94
- context = {
95
- ...context,
96
- ...patch
97
- };
98
- }
99
- }
100
- return [target === value && context === snapshot.context ? snapshot : createSnapshot(target, context), []];
127
+ const transitions = (Object.hasOwn(config.states, snapshot.value) ? config.states[snapshot.value] : undefined)?.on;
128
+ const selected = Object.hasOwn(transitions || {}, event.type) ? transitions[event.type] : undefined;
129
+ const next = step(snapshot, selected, event);
130
+ return [next ? hasAlways ? settle(next, event) : next : snapshot, []];
101
131
  }
102
132
  };
103
133
  }
@@ -59,7 +59,63 @@ function createFSM(config) {
59
59
  output: undefined,
60
60
  error: undefined
61
61
  });
62
- const initialState = createSnapshot(config.initial, config.context ?? {});
62
+ const checkTransition = transition => {
63
+ if (typeof transition === 'string') {
64
+ throw new TypeError(`Use { target: ${JSON.stringify(transition)} } instead of a string transition. Run the @xstate/codemod string-targets transform.`);
65
+ }
66
+ };
67
+ let hasAlways = false;
68
+ for (const value of Object.getOwnPropertyNames(config.states)) {
69
+ const state = config.states[value];
70
+ checkTransition(state?.always);
71
+ hasAlways ||= state?.always !== undefined;
72
+ for (const type of Object.getOwnPropertyNames(state?.on ?? {})) {
73
+ checkTransition(state.on[type]);
74
+ }
75
+ }
76
+ const getState = value => Object.hasOwn(config.states, value) ? config.states[value] : undefined;
77
+ const step = (snapshot, selected, event) => {
78
+ const result = typeof selected === 'function' ? selected({
79
+ context: snapshot.context,
80
+ event
81
+ }) : selected;
82
+ checkTransition(result);
83
+ if (!result) {
84
+ return undefined;
85
+ }
86
+ let {
87
+ value,
88
+ context
89
+ } = snapshot;
90
+ const {
91
+ target = value,
92
+ context: patch
93
+ } = result;
94
+ for (const key of Reflect.ownKeys({
95
+ ...patch
96
+ })) {
97
+ if (!Object.hasOwn(context, key) || !Object.is(patch[key], context[key])) {
98
+ context = {
99
+ ...context,
100
+ ...patch
101
+ };
102
+ }
103
+ }
104
+ return target === value && context === snapshot.context ? snapshot : createSnapshot(target, context);
105
+ };
106
+ const settle = (snapshot, event) => {
107
+ for (;;) {
108
+ const next = step(snapshot, getState(snapshot.value)?.always, event);
109
+ if (!next) {
110
+ return snapshot;
111
+ }
112
+ snapshot = next;
113
+ }
114
+ };
115
+ const initialSnapshot = createSnapshot(config.initial, config.context ?? {});
116
+ const initialState = hasAlways ? settle(initialSnapshot, {
117
+ type: 'xstate.init'
118
+ }) : initialSnapshot;
63
119
  return {
64
120
  id: config.id,
65
121
  config,
@@ -68,36 +124,10 @@ function createFSM(config) {
68
124
  getInitialSnapshot: () => initialState,
69
125
  getPersistedSnapshot: snapshot => snapshot,
70
126
  transition(snapshot, event) {
71
- let {
72
- value,
73
- context
74
- } = snapshot;
75
- const transitions = (Object.hasOwn(config.states, value) ? config.states[value] : undefined)?.on;
76
- const transition = Object.hasOwn(transitions || {}, event.type) && transitions[event.type];
77
- const {
78
- target = value,
79
- context: patch
80
- } = (typeof transition === 'string' ? {
81
- target: transition
82
- } : typeof transition === 'function' ? transition({
83
- context,
84
- event
85
- }) : transition) || {};
86
- // Copy only when the patch changes a value, so a no-op patch keeps the
87
- // current snapshot. After the first copy every key matches. Iterate a
88
- // spread copy so inherited keys, which the spread below ignores, are
89
- // skipped.
90
- for (const key of Reflect.ownKeys({
91
- ...patch
92
- })) {
93
- if (!Object.hasOwn(context, key) || !Object.is(patch[key], context[key])) {
94
- context = {
95
- ...context,
96
- ...patch
97
- };
98
- }
99
- }
100
- return [target === value && context === snapshot.context ? snapshot : createSnapshot(target, context), []];
127
+ const transitions = (Object.hasOwn(config.states, snapshot.value) ? config.states[snapshot.value] : undefined)?.on;
128
+ const selected = Object.hasOwn(transitions || {}, event.type) ? transitions[event.type] : undefined;
129
+ const next = step(snapshot, selected, event);
130
+ return [next ? hasAlways ? settle(next, event) : next : snapshot, []];
101
131
  }
102
132
  };
103
133
  }
@@ -1,2 +1,2 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).XStateFSM={})}(this,function(t){"use strict";function e(t){const e=(t,e)=>({status:"active",value:t,context:e,output:void 0,error:void 0}),n=e(t.initial,t.context??{});return{id:t.id,config:t,initialState:n,initialTransition:()=>[n,[]],getInitialSnapshot:()=>n,getPersistedSnapshot:t=>t,transition(n,o){let{value:i,context:s}=n;const a=(Object.hasOwn(t.states,i)?t.states[i]:void 0)?.on,r=Object.hasOwn(a||{},o.type)&&a[o.type],{target:c=i,context:f}=("string"==typeof r?{target:r}:"function"==typeof r?r({context:s,event:o}):r)||{};for(const t of Reflect.ownKeys({...f}))Object.hasOwn(s,t)&&Object.is(f[t],s[t])||(s={...s,...f});return[c===i&&s===n.context?n:e(c,s),[]]}}}t.createFSM=e,t.setup=function(t={}){return{createFSM:t=>e(t)}},t.types=function(){return{"~standard":{version:1,vendor:"xstate.types",validate:t=>({value:t})}}},Object.defineProperty(t,"__esModule",{value:!0})});
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).XStateFSM={})}(this,function(t){"use strict";function e(t){const e=(t,e)=>({status:"active",value:t,context:e,output:void 0,error:void 0}),n=t=>{if("string"==typeof t)throw new TypeError(`Use { target: ${JSON.stringify(t)} } instead of a string transition. Run the @xstate/codemod string-targets transform.`)};let o=!1;for(const e of Object.getOwnPropertyNames(t.states)){const s=t.states[e];n(s?.always),o||=void 0!==s?.always;for(const t of Object.getOwnPropertyNames(s?.on??{}))n(s.on[t])}const s=e=>Object.hasOwn(t.states,e)?t.states[e]:void 0,i=(t,o,s)=>{const i="function"==typeof o?o({context:t.context,event:s}):o;if(n(i),!i)return;let{value:a,context:r}=t;const{target:c=a,context:f}=i;for(const t of Reflect.ownKeys({...f}))Object.hasOwn(r,t)&&Object.is(f[t],r[t])||(r={...r,...f});return c===a&&r===t.context?t:e(c,r)},a=(t,e)=>{for(;;){const n=i(t,s(t.value)?.always,e);if(!n)return t;t=n}},r=e(t.initial,t.context??{}),c=o?a(r,{type:"xstate.init"}):r;return{id:t.id,config:t,initialState:c,initialTransition:()=>[c,[]],getInitialSnapshot:()=>c,getPersistedSnapshot:t=>t,transition(e,n){const s=(Object.hasOwn(t.states,e.value)?t.states[e.value]:void 0)?.on,r=Object.hasOwn(s||{},n.type)?s[n.type]:void 0,c=i(e,r,n);return[c?o?a(c,n):c:e,[]]}}}t.createFSM=e,t.setup=function(t={}){return{createFSM:t=>e(t)}},t.types=function(){return{"~standard":{version:1,vendor:"xstate.types",validate:t=>({value:t})}}},Object.defineProperty(t,"__esModule",{value:!0})});
2
2
  //# sourceMappingURL=xstate-fsm.umd.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"xstate-fsm.umd.min.js","sources":["../src/fsm.ts","../src/schema.types.ts"],"sourcesContent":["import type {\n EventObject,\n InferEvents,\n MachineContext,\n SetupSchemas,\n SetupStateSchema\n} from './base.types.ts';\nimport type { StandardSchemaV1 } from './schema.types.ts';\n\n/** @public */\nexport type FSMArgs<\n TContext extends MachineContext,\n TEvent extends EventObject\n> = {\n context: TContext;\n event: TEvent;\n};\n\n/** @public */\nexport type FSMContextPatch<TContext extends MachineContext> =\n Partial<TContext>;\n\n/** @public */\nexport type FSMTransitionConfig<\n TContext extends MachineContext,\n TState extends string\n> = {\n target?: TState;\n context?: FSMContextPatch<TContext>;\n};\n\n/** @public */\nexport type FSMTransitionFunction<\n TContext extends MachineContext,\n TEvent extends EventObject,\n TState extends string,\n TTransitionContext extends MachineContext = TContext\n> = (\n args: FSMArgs<TContext, TEvent>\n) => FSMTransitionConfig<TTransitionContext, TState> | undefined;\n\ntype EventForType<TEvent extends EventObject, TType extends string> = [\n Extract<TEvent, { type: TType }>\n] extends [never]\n ? TEvent\n : Extract<TEvent, { type: TType }>;\n\n/** @public */\nexport type FSMTransition<\n TContext extends MachineContext,\n TEvent extends EventObject,\n TState extends string,\n TTransitionContext extends MachineContext = TContext\n> =\n | TState\n | FSMTransitionConfig<TTransitionContext, TState>\n | FSMTransitionFunction<TContext, TEvent, TState, TTransitionContext>;\n\ntype FSMOn<\n TContext extends MachineContext,\n TEvent extends EventObject,\n TState extends string,\n TTransitionContext extends MachineContext = TContext\n> = {\n [TType in TEvent['type'] & string]?: FSMTransition<\n TContext,\n EventForType<TEvent, TType>,\n TState,\n TTransitionContext\n >;\n};\n\n/** @public */\nexport type FSMStateConfig<\n TContext extends MachineContext,\n TEvent extends EventObject,\n TState extends string,\n TTransitionContext extends MachineContext = TContext\n> = {\n on?: FSMOn<TContext, TEvent, TState, TTransitionContext>;\n};\n\ntype FSMContextConfig<TContext extends MachineContext> =\n string extends keyof TContext\n ? { context?: TContext }\n : keyof TContext extends never\n ? { context?: TContext }\n : { context: TContext };\n\n/** @public */\nexport type FSMConfig<\n TContext extends MachineContext = {},\n TEvent extends EventObject = EventObject,\n TState extends string = string\n> = {\n id?: string;\n initial: TState;\n states: { [K in TState]: FSMStateConfig<TContext, TEvent, TState> };\n} & FSMContextConfig<TContext>;\n\ntype FSMConfigForStates<\n TContext extends MachineContext,\n TEvent extends EventObject,\n TStates extends Record<string, unknown>\n> = Omit<\n FSMConfig<TContext, TEvent, keyof TStates & string>,\n 'initial' | 'states'\n> & {\n initial: keyof TStates & string;\n states: {\n [K in keyof TStates]: FSMStateConfig<\n TContext,\n TEvent,\n keyof TStates & string\n >;\n };\n};\n\n/**\n * A snapshot of a compact FSM. `status`, `output`, and `error` match the\n * snapshot shape shared by all actor logic, so an FSM can run in\n * `createActor`. An FSM snapshot is always `'active'`.\n *\n * @public\n */\nexport type FSMSnapshot<\n TContext extends MachineContext,\n TState extends string\n> = {\n status: 'active';\n value: TState;\n context: TContext;\n output: undefined;\n error: undefined;\n};\n\n/**\n * The result of an FSM transition: `[nextSnapshot, effects]`. FSMs have no\n * effects, so `effects` is always empty. The tuple matches the\n * `(snapshot, event) => [snapshot, effects]` protocol shared with full XState\n * actor logic.\n *\n * @public\n */\nexport type FSMTransitionResult<TSnapshot> = [\n nextSnapshot: TSnapshot,\n effects: never[]\n];\n\n/**\n * Pure logic returned by `createFSM`. It structurally satisfies `ActorLogic`,\n * so it works with `createActor`, `transition`, and `initialTransition` from\n * `xstate`.\n *\n * @public\n */\nexport type FSM<\n TContext extends MachineContext,\n TEvent extends EventObject,\n TState extends string,\n TSnapshot extends FSMSnapshot<MachineContext, TState> = FSMSnapshot<\n TContext,\n TState\n >,\n TConfig = FSMConfig<TContext, TEvent, TState>\n> = {\n readonly id: string | undefined;\n readonly config: TConfig;\n readonly initialState: TSnapshot;\n transition(\n snapshot: TSnapshot,\n event: TEvent\n ): FSMTransitionResult<TSnapshot>;\n initialTransition(input?: unknown): FSMTransitionResult<TSnapshot>;\n getInitialSnapshot(actorScope?: unknown, input?: unknown): TSnapshot;\n getPersistedSnapshot(snapshot: TSnapshot): TSnapshot;\n};\n\ntype FSMSetupSchemas = Pick<SetupSchemas, 'context' | 'events'>;\ntype FSMSetupStates = Record<string, SetupStateSchema>;\n\ntype FSMSchemaContext<TSchema extends StandardSchemaV1> =\n StandardSchemaV1.InferOutput<TSchema> extends MachineContext\n ? StandardSchemaV1.InferOutput<TSchema>\n : MachineContext;\n\ntype FSMSetupContext<TSchemas extends FSMSetupSchemas> = TSchemas extends {\n context: infer TSchema extends StandardSchemaV1;\n}\n ? FSMSchemaContext<TSchema>\n : MachineContext;\n\ntype FSMSetupEvents<TSchemas extends FSMSetupSchemas> = TSchemas extends {\n events: infer TEventSchemas extends Record<string, StandardSchemaV1>;\n}\n ? InferEvents<TEventSchemas>\n : EventObject;\n\ntype FSMStateContext<\n TStateSchema,\n TGlobalContext extends MachineContext\n> = TStateSchema extends { schemas?: infer TSchemas }\n ? TSchemas extends {\n context?: infer TSchema extends StandardSchemaV1;\n }\n ? FSMSchemaContext<TSchema> &\n ([MachineContext] extends [TGlobalContext] ? unknown : TGlobalContext)\n : TGlobalContext\n : TGlobalContext;\n\ntype FSMContextFromDeclaredStates<\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext\n> = {\n [K in keyof TStates & string]: FSMStateContext<TStates[K], TGlobalContext>;\n}[keyof TStates & string];\n\ntype FSMContextFromStates<\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext\n> = [keyof TStates] extends [never]\n ? TGlobalContext\n : [MachineContext] extends [TGlobalContext]\n ? FSMContextFromDeclaredStates<TStates, TGlobalContext>\n : TGlobalContext | FSMContextFromDeclaredStates<TStates, TGlobalContext>;\n\ntype FSMSetupStateContext<\n TState extends string,\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext\n> = TState extends keyof TStates\n ? FSMStateContext<TStates[TState], TGlobalContext>\n : TGlobalContext;\n\ntype FSMSetupSnapshot<\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext,\n TMachineStates extends Record<string, unknown>\n> = [keyof TStates] extends [never]\n ? FSMSnapshot<TGlobalContext, keyof TMachineStates & string>\n : {\n [K in keyof TMachineStates & string]: FSMSnapshot<\n FSMSetupStateContext<K, TStates, TGlobalContext>,\n K\n >;\n }[keyof TMachineStates & string];\n\ntype FSMSetupTargetTransitionConfig<\n TSourceContext extends MachineContext,\n TTarget extends string,\n TTargetContext extends MachineContext\n> = [FSMRequiredTargetContextKeys<TSourceContext, TTargetContext>] extends [\n never\n]\n ? {\n target: TTarget;\n context?: FSMTargetContextPatch<TSourceContext, TTargetContext>;\n }\n : {\n target: TTarget;\n context: FSMTargetContextPatch<TSourceContext, TTargetContext>;\n };\n\ntype FSMRequiredTargetContextKeys<TSourceContext, TTargetContext> = {\n [K in keyof TTargetContext]-?: K extends keyof TSourceContext\n ? [TSourceContext[K]] extends [TTargetContext[K]]\n ? never\n : K\n : K;\n}[keyof TTargetContext];\n\ntype FSMTargetContextPatch<TSourceContext, TTargetContext> =\n Partial<TTargetContext> &\n Pick<\n TTargetContext,\n Extract<\n FSMRequiredTargetContextKeys<TSourceContext, TTargetContext>,\n string\n >\n >;\n\ntype FSMSetupTransitionConfig<\n TSourceContext extends MachineContext,\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext\n> =\n | { target?: undefined; context?: FSMContextPatch<TSourceContext> }\n | {\n [TTarget in keyof TStates & string]: FSMSetupTargetTransitionConfig<\n TSourceContext,\n TTarget,\n FSMSetupStateContext<TTarget, TStates, TGlobalContext>\n >;\n }[keyof TStates & string];\n\ntype FSMSetupStringTransition<\n TSourceContext extends MachineContext,\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext\n> = {\n [TTarget in keyof TStates & string]: [TSourceContext] extends [\n FSMSetupStateContext<TTarget, TStates, TGlobalContext>\n ]\n ? TTarget\n : never;\n}[keyof TStates & string];\n\ntype FSMSetupTransitionFunction<\n TSourceContext extends MachineContext,\n TEvent extends EventObject,\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext\n> = (\n args: FSMArgs<TSourceContext, TEvent>\n) =>\n | FSMSetupTransitionConfig<TSourceContext, TStates, TGlobalContext>\n | undefined;\n\ntype FSMSetupTransition<\n TSourceContext extends MachineContext,\n TEvent extends EventObject,\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext,\n TMachineStates extends Record<string, unknown>\n> = [keyof TStates] extends [never]\n ? FSMTransition<TSourceContext, TEvent, keyof TMachineStates & string>\n :\n | FSMSetupStringTransition<TSourceContext, TStates, TGlobalContext>\n | FSMSetupTransitionConfig<TSourceContext, TStates, TGlobalContext>\n | FSMSetupTransitionFunction<\n TSourceContext,\n TEvent,\n TStates,\n TGlobalContext\n >;\n\ntype FSMSetupStateConfig<\n TSourceContext extends MachineContext,\n TEvent extends EventObject,\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext,\n TMachineStates extends Record<string, unknown>\n> = {\n on?: {\n [TType in TEvent['type'] & string]?: FSMSetupTransition<\n TSourceContext,\n EventForType<TEvent, TType>,\n TStates,\n TGlobalContext,\n TMachineStates\n >;\n };\n};\n\ntype FSMSetupMachineConfig<\n TSchemas extends FSMSetupSchemas,\n TStates extends FSMSetupStates,\n TMachineStates extends Record<string, unknown>\n> = {\n id?: string;\n initial: keyof TMachineStates & string;\n states: {\n [K in keyof TMachineStates]: FSMSetupStateConfig<\n FSMStateContext<\n K extends keyof TStates ? TStates[K] : {},\n FSMSetupContext<TSchemas>\n >,\n FSMSetupEvents<TSchemas>,\n TStates,\n FSMSetupContext<TSchemas>,\n TMachineStates\n >;\n };\n} & FSMContextConfig<FSMContextFromStates<TStates, FSMSetupContext<TSchemas>>>;\n\n/** @public */\nexport type FSMSetupConfig<\n TSchemas extends FSMSetupSchemas = {},\n TStates extends FSMSetupStates = {}\n> = {\n schemas?: TSchemas;\n states?: TStates;\n};\n\n/** @public */\nexport type FSMSetupReturn<\n TSchemas extends FSMSetupSchemas,\n TStates extends FSMSetupStates\n> = {\n createFSM<const TMachineStates extends Record<string, unknown>>(\n config: FSMSetupMachineConfig<TSchemas, TStates, TMachineStates>\n ): FSM<\n FSMContextFromStates<TStates, FSMSetupContext<TSchemas>>,\n FSMSetupEvents<TSchemas>,\n keyof TMachineStates & string,\n FSMSetupSnapshot<TStates, FSMSetupContext<TSchemas>, TMachineStates>,\n FSMSetupMachineConfig<TSchemas, TStates, TMachineStates>\n >;\n};\n\n/** @public */\nexport function setup<\n const TSchemas extends FSMSetupSchemas = {},\n const TStates extends FSMSetupStates = {}\n>(\n _config: FSMSetupConfig<TSchemas, TStates> = {}\n): FSMSetupReturn<TSchemas, TStates> {\n return {\n createFSM: (config: FSMConfig) => createFSM(config)\n } as unknown as FSMSetupReturn<TSchemas, TStates>;\n}\n\n/** @public */\nexport function createFSM<\n TContext extends MachineContext = {},\n TEvent extends EventObject = EventObject,\n const TStates extends Record<string, unknown> = Record<string, unknown>\n>(\n config: FSMConfigForStates<TContext, TEvent, TStates>\n): FSM<\n TContext,\n TEvent,\n keyof TStates & string,\n FSMSnapshot<TContext, keyof TStates & string>,\n FSMConfigForStates<TContext, TEvent, TStates>\n> {\n type TState = keyof TStates & string;\n type TSnapshot = FSMSnapshot<TContext, TState>;\n const createSnapshot = (value: TState, context: TContext) =>\n ({\n status: 'active',\n value,\n context,\n output: undefined,\n error: undefined\n }) as TSnapshot;\n const initialState = createSnapshot(\n config.initial,\n config.context ?? ({} as TContext)\n );\n\n return {\n id: config.id,\n config,\n initialState,\n initialTransition: () => [initialState, []],\n getInitialSnapshot: () => initialState,\n getPersistedSnapshot: (snapshot) => snapshot,\n transition(snapshot, event) {\n let { value, context } = snapshot;\n const transitions = (\n Object.hasOwn(config.states, value) ? config.states[value] : undefined\n )?.on as\n | Record<string, FSMTransition<TContext, TEvent, TState> | undefined>\n | undefined;\n const transition =\n Object.hasOwn(transitions || {}, event.type) &&\n transitions![event.type];\n const { target = value, context: patch } =\n (typeof transition === 'string'\n ? { target: transition }\n : typeof transition === 'function'\n ? transition({ context, event })\n : transition) || {};\n // Copy only when the patch changes a value, so a no-op patch keeps the\n // current snapshot. After the first copy every key matches. Iterate a\n // spread copy so inherited keys, which the spread below ignores, are\n // skipped.\n for (const key of Reflect.ownKeys({ ...patch }) as (keyof TContext)[]) {\n if (\n !Object.hasOwn(context, key) ||\n !Object.is(patch![key], context[key])\n ) {\n context = { ...context, ...patch };\n }\n }\n\n return [\n target === value && context === snapshot.context\n ? snapshot\n : createSnapshot(target, context),\n []\n ];\n }\n };\n}\n","/**\n * The Standard Schema interface.\n *\n * @public\n */\nexport interface StandardSchemaV1<Input = unknown, Output = Input> {\n /** The Standard Schema properties. */\n readonly '~standard': StandardSchemaV1.Props<Input, Output>;\n}\n\n/**\n * Schemas that can be declared for an individual state node.\n *\n * @public\n */\nexport type SetupStateSchemas = {\n /** Refines the machine's root context schema while this state is active. */\n context?: StandardSchemaV1;\n input?: StandardSchemaV1;\n /** The output emitted when this state node completes. */\n output?: StandardSchemaV1;\n};\n\n/**\n * A type-only Standard Schema produced by {@link types}.\n *\n * @public\n */\nexport interface TypeSchema<T> extends StandardSchemaV1<T, T> {\n readonly '~standard': StandardSchemaV1.Props<T, T> & {\n readonly vendor: 'xstate.types';\n };\n}\n\n/**\n * Declares schema types for inference only — no runtime validation.\n *\n * Use in a machine's `schemas` when you want TypeScript types without pulling\n * in a schema library like Zod. The returned value is a valid Standard Schema\n * whose validation is the identity function, so it carries types but never\n * rejects input.\n *\n * @example\n *\n * ```ts\n * import { createMachine, types } from 'xstate';\n *\n * const machine = createMachine({\n * schemas: {\n * context: types<{ count: number }>(),\n * events: {\n * inc: types<{ by: number }>(),\n * reset: types<void>()\n * }\n * },\n * context: { count: 0 }\n * // ...\n * });\n * ```\n *\n * Use `types<void>()` for events without a payload.\n * @public\n */\nexport function types<T>(): TypeSchema<T> {\n return {\n '~standard': {\n version: 1,\n vendor: 'xstate.types',\n validate: (value) => ({ value: value as T })\n }\n };\n}\n\n/**\n * Returns true if the value is a type-only schema created by {@link types}.\n *\n * @public\n */\nexport function isTypeSchema(value: unknown): value is TypeSchema<unknown> {\n return (\n !!value &&\n typeof value === 'object' &&\n '~standard' in value &&\n (value as StandardSchemaV1)['~standard'].vendor === 'xstate.types'\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace StandardSchemaV1 {\n /** The Standard Schema properties interface. */\n export interface Props<Input = unknown, Output = Input> {\n /** The version number of the standard. */\n readonly version: 1;\n /** The vendor name of the schema library. */\n readonly vendor: string;\n /** Validates unknown input values. */\n readonly validate: (\n value: unknown\n ) => Result<Output> | Promise<Result<Output>>;\n /** Inferred types associated with the schema. */\n readonly types?: Types<Input, Output> | undefined;\n }\n\n /** The result interface of the validate function. */\n export type Result<Output> = SuccessResult<Output> | FailureResult;\n\n /** The result interface if validation succeeds. */\n export interface SuccessResult<Output> {\n /** The typed output value. */\n readonly value: Output;\n /** The non-existent issues. */\n readonly issues?: undefined;\n }\n\n /** The result interface if validation fails. */\n export interface FailureResult {\n /** The issues of failed validation. */\n readonly issues: ReadonlyArray<Issue>;\n }\n\n /** The issue interface of the failure output. */\n export interface Issue {\n /** The error message of the issue. */\n readonly message: string;\n /** The path of the issue, if any. */\n readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;\n }\n\n /** The path segment interface of the issue. */\n export interface PathSegment {\n /** The key representing a path segment. */\n readonly key: PropertyKey;\n }\n\n /** The Standard Schema types interface. */\n export interface Types<Input = unknown, Output = Input> {\n /** The input type of the schema. */\n readonly input: Input;\n /** The output type of the schema. */\n readonly output: Output;\n }\n\n /** Infers the input type of a Standard Schema. */\n export type InferInput<Schema extends StandardSchemaV1> = NonNullable<\n Schema['~standard']['types']\n >['input'];\n\n /** Infers the output type of a Standard Schema. */\n export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<\n Schema['~standard']['types']\n >['output'];\n}\n"],"names":["createFSM","config","createSnapshot","value","context","status","output","undefined","error","initialState","initial","id","initialTransition","getInitialSnapshot","getPersistedSnapshot","snapshot","transition","event","transitions","Object","hasOwn","states","on","type","target","patch","key","Reflect","ownKeys","is","_config","version","vendor","validate"],"mappings":"gPA6ZO,SAASA,EAKdC,GAUA,MAAMC,EAAiBA,CAACC,EAAeC,KACpC,CACCC,OAAQ,SACRF,QACAC,UACAE,YAAQC,EACRC,WAAOD,IAELE,EAAeP,EACnBD,EAAOS,QACPT,EAAOG,SAAY,CAAA,GAGrB,MAAO,CACLO,GAAIV,EAAOU,GACXV,SACAQ,eACAG,kBAAmBA,IAAM,CAACH,EAAc,IACxCI,mBAAoBA,IAAMJ,EAC1BK,qBAAuBC,GAAaA,EACpCC,UAAAA,CAAWD,EAAUE,GACnB,IAAId,MAAEA,EAAKC,QAAEA,GAAYW,EACzB,MAAMG,GACJC,OAAOC,OAAOnB,EAAOoB,OAAQlB,GAASF,EAAOoB,OAAOlB,QAASI,IAC5De,GAGGN,EACJG,OAAOC,OAAOF,GAAe,CAAE,EAAED,EAAMM,OACvCL,EAAaD,EAAMM,OACfC,OAAEA,EAASrB,EAAOC,QAASqB,IACR,iBAAfT,EACJ,CAAEQ,OAAQR,GACY,mBAAfA,EACLA,EAAW,CAAEZ,UAASa,UACtBD,IAAe,GAKvB,IAAK,MAAMU,KAAOC,QAAQC,QAAQ,IAAKH,IAElCN,OAAOC,OAAOhB,EAASsB,IACvBP,OAAOU,GAAGJ,EAAOC,GAAMtB,EAAQsB,MAEhCtB,EAAU,IAAKA,KAAYqB,IAI/B,MAAO,CACLD,IAAWrB,GAASC,IAAYW,EAASX,QACrCW,EACAb,EAAesB,EAAQpB,GAC3B,GAEJ,EAEJ,uBApFO,SAIL0B,EAA6C,IAE7C,MAAO,CACL9B,UAAYC,GAAsBD,EAAUC,GAEhD,UC3VO,WACL,MAAO,CACL,YAAa,CACX8B,QAAS,EACTC,OAAQ,eACRC,SAAW9B,IAAW,CAAEA,MAAOA,KAGrC"}
1
+ {"version":3,"file":"xstate-fsm.umd.min.js","sources":["../src/fsm.ts","../src/schema.types.ts"],"sourcesContent":["import type {\n EventObject,\n InferEvents,\n MachineContext,\n SetupSchemas,\n SetupStateSchema\n} from './base.types.ts';\nimport type { StandardSchemaV1 } from './schema.types.ts';\n\ntype FSMInitEvent = { type: 'xstate.init' };\n\n/** @public */\nexport type FSMArgs<\n TContext extends MachineContext,\n TEvent extends EventObject\n> = {\n context: TContext;\n event: TEvent;\n};\n\n/** @public */\nexport type FSMContextPatch<TContext extends MachineContext> =\n Partial<TContext>;\n\n/** @public */\nexport type FSMTransitionConfig<\n TContext extends MachineContext,\n TState extends string\n> = {\n target?: TState;\n context?: FSMContextPatch<TContext>;\n};\n\n/** @public */\nexport type FSMTransitionFunction<\n TContext extends MachineContext,\n TEvent extends EventObject,\n TState extends string,\n TTransitionContext extends MachineContext = TContext\n> = (\n args: FSMArgs<TContext, TEvent>\n) => FSMTransitionConfig<TTransitionContext, TState> | undefined;\n\ntype EventForType<TEvent extends EventObject, TType extends string> = [\n Extract<TEvent, { type: TType }>\n] extends [never]\n ? TEvent\n : Extract<TEvent, { type: TType }>;\n\n/** @public */\nexport type FSMTransition<\n TContext extends MachineContext,\n TEvent extends EventObject,\n TState extends string,\n TTransitionContext extends MachineContext = TContext\n> =\n | FSMTransitionConfig<TTransitionContext, TState>\n | FSMTransitionFunction<TContext, TEvent, TState, TTransitionContext>;\n\ntype FSMOn<\n TContext extends MachineContext,\n TEvent extends EventObject,\n TState extends string,\n TTransitionContext extends MachineContext = TContext\n> = {\n [TType in TEvent['type'] & string]?: FSMTransition<\n TContext,\n EventForType<TEvent, TType>,\n TState,\n TTransitionContext\n >;\n};\n\n/** @public */\nexport type FSMStateConfig<\n TContext extends MachineContext,\n TEvent extends EventObject,\n TState extends string,\n TTransitionContext extends MachineContext = TContext\n> = {\n on?: FSMOn<TContext, TEvent, TState, TTransitionContext>;\n always?: FSMTransition<\n TContext,\n TEvent | FSMInitEvent,\n TState,\n TTransitionContext\n >;\n};\n\ntype FSMContextConfig<TContext extends MachineContext> =\n string extends keyof TContext\n ? { context?: TContext }\n : keyof TContext extends never\n ? { context?: TContext }\n : { context: TContext };\n\n/** @public */\nexport type FSMConfig<\n TContext extends MachineContext = {},\n TEvent extends EventObject = EventObject,\n TState extends string = string\n> = {\n id?: string;\n initial: TState;\n states: { [K in TState]: FSMStateConfig<TContext, TEvent, TState> };\n} & FSMContextConfig<TContext>;\n\ntype FSMConfigForStates<\n TContext extends MachineContext,\n TEvent extends EventObject,\n TStates extends Record<string, unknown>\n> = Omit<\n FSMConfig<TContext, TEvent, keyof TStates & string>,\n 'initial' | 'states'\n> & {\n initial: keyof TStates & string;\n states: {\n [K in keyof TStates]: FSMStateConfig<\n TContext,\n TEvent,\n keyof TStates & string\n >;\n };\n};\n\n/**\n * A snapshot of a compact FSM. `status`, `output`, and `error` match the\n * snapshot shape shared by all actor logic, so an FSM can run in\n * `createActor`. An FSM snapshot is always `'active'`.\n *\n * @public\n */\nexport type FSMSnapshot<\n TContext extends MachineContext,\n TState extends string\n> = {\n status: 'active';\n value: TState;\n context: TContext;\n output: undefined;\n error: undefined;\n};\n\n/**\n * The result of an FSM transition: `[nextSnapshot, effects]`. FSMs have no\n * effects, so `effects` is always empty. The tuple matches the\n * `(snapshot, event) => [snapshot, effects]` protocol shared with full XState\n * actor logic.\n *\n * @public\n */\nexport type FSMTransitionResult<TSnapshot> = [\n nextSnapshot: TSnapshot,\n effects: never[]\n];\n\n/**\n * Pure logic returned by `createFSM`. It structurally satisfies `ActorLogic`,\n * so it works with `createActor`, `transition`, and `initialTransition` from\n * `xstate`.\n *\n * @public\n */\nexport type FSM<\n TContext extends MachineContext,\n TEvent extends EventObject,\n TState extends string,\n TSnapshot extends FSMSnapshot<MachineContext, TState> = FSMSnapshot<\n TContext,\n TState\n >,\n TConfig = FSMConfig<TContext, TEvent, TState>\n> = {\n readonly id: string | undefined;\n readonly config: TConfig;\n readonly initialState: TSnapshot;\n transition(\n snapshot: TSnapshot,\n event: TEvent\n ): FSMTransitionResult<TSnapshot>;\n initialTransition(input?: unknown): FSMTransitionResult<TSnapshot>;\n getInitialSnapshot(actorScope?: unknown, input?: unknown): TSnapshot;\n getPersistedSnapshot(snapshot: TSnapshot): TSnapshot;\n};\n\ntype FSMSetupSchemas = Pick<SetupSchemas, 'context' | 'events'>;\ntype FSMSetupStates = Record<string, SetupStateSchema>;\n\ntype FSMSchemaContext<TSchema extends StandardSchemaV1> =\n StandardSchemaV1.InferOutput<TSchema> extends MachineContext\n ? StandardSchemaV1.InferOutput<TSchema>\n : MachineContext;\n\ntype FSMSetupContext<TSchemas extends FSMSetupSchemas> = TSchemas extends {\n context: infer TSchema extends StandardSchemaV1;\n}\n ? FSMSchemaContext<TSchema>\n : MachineContext;\n\ntype FSMSetupEvents<TSchemas extends FSMSetupSchemas> = TSchemas extends {\n events: infer TEventSchemas extends Record<string, StandardSchemaV1>;\n}\n ? InferEvents<TEventSchemas>\n : EventObject;\n\ntype FSMStateContext<\n TStateSchema,\n TGlobalContext extends MachineContext\n> = TStateSchema extends { schemas?: infer TSchemas }\n ? TSchemas extends {\n context?: infer TSchema extends StandardSchemaV1;\n }\n ? FSMSchemaContext<TSchema> &\n ([MachineContext] extends [TGlobalContext] ? unknown : TGlobalContext)\n : TGlobalContext\n : TGlobalContext;\n\ntype FSMContextFromDeclaredStates<\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext\n> = {\n [K in keyof TStates & string]: FSMStateContext<TStates[K], TGlobalContext>;\n}[keyof TStates & string];\n\ntype FSMContextFromStates<\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext\n> = [keyof TStates] extends [never]\n ? TGlobalContext\n : [MachineContext] extends [TGlobalContext]\n ? FSMContextFromDeclaredStates<TStates, TGlobalContext>\n : TGlobalContext | FSMContextFromDeclaredStates<TStates, TGlobalContext>;\n\ntype FSMSetupStateContext<\n TState extends string,\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext\n> = TState extends keyof TStates\n ? FSMStateContext<TStates[TState], TGlobalContext>\n : TGlobalContext;\n\ntype FSMSetupSnapshot<\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext,\n TMachineStates extends Record<string, unknown>\n> = [keyof TStates] extends [never]\n ? FSMSnapshot<TGlobalContext, keyof TMachineStates & string>\n : {\n [K in keyof TMachineStates & string]: FSMSnapshot<\n FSMSetupStateContext<K, TStates, TGlobalContext>,\n K\n >;\n }[keyof TMachineStates & string];\n\ntype FSMSetupTargetTransitionConfig<\n TSourceContext extends MachineContext,\n TTarget extends string,\n TTargetContext extends MachineContext\n> = [FSMRequiredTargetContextKeys<TSourceContext, TTargetContext>] extends [\n never\n]\n ? {\n target: TTarget;\n context?: FSMTargetContextPatch<TSourceContext, TTargetContext>;\n }\n : {\n target: TTarget;\n context: FSMTargetContextPatch<TSourceContext, TTargetContext>;\n };\n\ntype FSMRequiredTargetContextKeys<TSourceContext, TTargetContext> = {\n [K in keyof TTargetContext]-?: K extends keyof TSourceContext\n ? [TSourceContext[K]] extends [TTargetContext[K]]\n ? never\n : K\n : K;\n}[keyof TTargetContext];\n\ntype FSMTargetContextPatch<TSourceContext, TTargetContext> =\n Partial<TTargetContext> &\n Pick<\n TTargetContext,\n Extract<\n FSMRequiredTargetContextKeys<TSourceContext, TTargetContext>,\n string\n >\n >;\n\ntype FSMSetupTransitionConfig<\n TSourceContext extends MachineContext,\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext\n> =\n | { target?: undefined; context?: FSMContextPatch<TSourceContext> }\n | {\n [TTarget in keyof TStates & string]: FSMSetupTargetTransitionConfig<\n TSourceContext,\n TTarget,\n FSMSetupStateContext<TTarget, TStates, TGlobalContext>\n >;\n }[keyof TStates & string];\n\ntype FSMSetupTransitionFunction<\n TSourceContext extends MachineContext,\n TEvent extends EventObject,\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext\n> = (\n args: FSMArgs<TSourceContext, TEvent>\n) =>\n | FSMSetupTransitionConfig<TSourceContext, TStates, TGlobalContext>\n | undefined;\n\ntype FSMSetupTransition<\n TSourceContext extends MachineContext,\n TEvent extends EventObject,\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext,\n TMachineStates extends Record<string, unknown>\n> = [keyof TStates] extends [never]\n ? FSMTransition<TSourceContext, TEvent, keyof TMachineStates & string>\n :\n | FSMSetupTransitionConfig<TSourceContext, TStates, TGlobalContext>\n | FSMSetupTransitionFunction<\n TSourceContext,\n TEvent,\n TStates,\n TGlobalContext\n >;\n\ntype FSMSetupStateConfig<\n TSourceContext extends MachineContext,\n TEvent extends EventObject,\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext,\n TMachineStates extends Record<string, unknown>\n> = {\n always?: FSMSetupTransition<\n TSourceContext,\n TEvent | FSMInitEvent,\n TStates,\n TGlobalContext,\n TMachineStates\n >;\n on?: {\n [TType in TEvent['type'] & string]?: FSMSetupTransition<\n TSourceContext,\n EventForType<TEvent, TType>,\n TStates,\n TGlobalContext,\n TMachineStates\n >;\n };\n};\n\ntype FSMSetupMachineConfig<\n TSchemas extends FSMSetupSchemas,\n TStates extends FSMSetupStates,\n TMachineStates extends Record<string, unknown>\n> = {\n id?: string;\n initial: keyof TMachineStates & string;\n states: {\n [K in keyof TMachineStates]: FSMSetupStateConfig<\n FSMStateContext<\n K extends keyof TStates ? TStates[K] : {},\n FSMSetupContext<TSchemas>\n >,\n FSMSetupEvents<TSchemas>,\n TStates,\n FSMSetupContext<TSchemas>,\n TMachineStates\n >;\n };\n} & FSMContextConfig<FSMContextFromStates<TStates, FSMSetupContext<TSchemas>>>;\n\n/** @public */\nexport type FSMSetupConfig<\n TSchemas extends FSMSetupSchemas = {},\n TStates extends FSMSetupStates = {}\n> = {\n schemas?: TSchemas;\n states?: TStates;\n};\n\n/** @public */\nexport type FSMSetupReturn<\n TSchemas extends FSMSetupSchemas,\n TStates extends FSMSetupStates\n> = {\n createFSM<const TMachineStates extends Record<string, unknown>>(\n config: FSMSetupMachineConfig<TSchemas, TStates, TMachineStates>\n ): FSM<\n FSMContextFromStates<TStates, FSMSetupContext<TSchemas>>,\n FSMSetupEvents<TSchemas>,\n keyof TMachineStates & string,\n FSMSetupSnapshot<TStates, FSMSetupContext<TSchemas>, TMachineStates>,\n FSMSetupMachineConfig<TSchemas, TStates, TMachineStates>\n >;\n};\n\n/** @public */\nexport function setup<\n const TSchemas extends FSMSetupSchemas = {},\n const TStates extends FSMSetupStates = {}\n>(\n _config: FSMSetupConfig<TSchemas, TStates> = {}\n): FSMSetupReturn<TSchemas, TStates> {\n return {\n createFSM: (config: FSMConfig) => createFSM(config)\n } as unknown as FSMSetupReturn<TSchemas, TStates>;\n}\n\n/** @public */\nexport function createFSM<\n TContext extends MachineContext = {},\n TEvent extends EventObject = EventObject,\n const TStates extends Record<string, unknown> = Record<string, unknown>\n>(\n config: FSMConfigForStates<TContext, TEvent, TStates>\n): FSM<\n TContext,\n TEvent,\n keyof TStates & string,\n FSMSnapshot<TContext, keyof TStates & string>,\n FSMConfigForStates<TContext, TEvent, TStates>\n> {\n type TState = keyof TStates & string;\n type TSnapshot = FSMSnapshot<TContext, TState>;\n const createSnapshot = (value: TState, context: TContext) =>\n ({\n status: 'active',\n value,\n context,\n output: undefined,\n error: undefined\n }) as TSnapshot;\n const checkTransition = (transition: unknown) => {\n if (typeof transition === 'string') {\n throw new TypeError(\n `Use { target: ${JSON.stringify(transition)} } instead of a string transition. Run the @xstate/codemod string-targets transform.`\n );\n }\n };\n let hasAlways = false;\n for (const value of Object.getOwnPropertyNames(config.states)) {\n const state = config.states[value as TState];\n checkTransition(state?.always);\n hasAlways ||= state?.always !== undefined;\n for (const type of Object.getOwnPropertyNames(state?.on ?? {})) {\n checkTransition((state!.on as Record<string, unknown>)[type]);\n }\n }\n const getState = (value: TState) =>\n Object.hasOwn(config.states, value) ? config.states[value] : undefined;\n const step = <TStepEvent extends EventObject>(\n snapshot: TSnapshot,\n selected: FSMTransition<TContext, TStepEvent, TState> | undefined,\n event: TStepEvent\n ): TSnapshot | undefined => {\n const result =\n typeof selected === 'function'\n ? selected({ context: snapshot.context, event })\n : selected;\n checkTransition(result);\n if (!result) {\n return undefined;\n }\n let { value, context } = snapshot;\n const { target = value, context: patch } = result;\n for (const key of Reflect.ownKeys({ ...patch }) as (keyof TContext)[]) {\n if (\n !Object.hasOwn(context, key) ||\n !Object.is(patch![key], context[key])\n ) {\n context = { ...context, ...patch };\n }\n }\n return target === value && context === snapshot.context\n ? snapshot\n : createSnapshot(target, context);\n };\n const settle = (\n snapshot: TSnapshot,\n event: TEvent | FSMInitEvent\n ): TSnapshot => {\n for (;;) {\n const next = step(snapshot, getState(snapshot.value)?.always, event);\n if (!next) {\n return snapshot;\n }\n snapshot = next;\n }\n };\n const initialSnapshot = createSnapshot(\n config.initial,\n config.context ?? ({} as TContext)\n );\n const initialState = hasAlways\n ? settle(initialSnapshot, { type: 'xstate.init' })\n : initialSnapshot;\n\n return {\n id: config.id,\n config,\n initialState,\n initialTransition: () => [initialState, []],\n getInitialSnapshot: () => initialState,\n getPersistedSnapshot: (snapshot) => snapshot,\n transition(snapshot, event) {\n const transitions = (\n Object.hasOwn(config.states, snapshot.value)\n ? config.states[snapshot.value]\n : undefined\n )?.on as\n | Record<string, FSMTransition<TContext, TEvent, TState> | undefined>\n | undefined;\n const selected = Object.hasOwn(transitions || {}, event.type)\n ? transitions![event.type]\n : undefined;\n const next = step(snapshot, selected, event);\n return [next ? (hasAlways ? settle(next, event) : next) : snapshot, []];\n }\n };\n}\n","/**\n * The Standard Schema interface.\n *\n * @public\n */\nexport interface StandardSchemaV1<Input = unknown, Output = Input> {\n /** The Standard Schema properties. */\n readonly '~standard': StandardSchemaV1.Props<Input, Output>;\n}\n\n/**\n * Schemas that can be declared for an individual state node.\n *\n * @public\n */\nexport type SetupStateSchemas = {\n /** Refines the machine's root context schema while this state is active. */\n context?: StandardSchemaV1;\n input?: StandardSchemaV1;\n /** The output emitted when this state node completes. */\n output?: StandardSchemaV1;\n};\n\n/**\n * A type-only Standard Schema produced by {@link types}.\n *\n * @public\n */\nexport interface TypeSchema<T> extends StandardSchemaV1<T, T> {\n readonly '~standard': StandardSchemaV1.Props<T, T> & {\n readonly vendor: 'xstate.types';\n };\n}\n\n/**\n * Declares schema types for inference only — no runtime validation.\n *\n * Use in a machine's `schemas` when you want TypeScript types without pulling\n * in a schema library like Zod. The returned value is a valid Standard Schema\n * whose validation is the identity function, so it carries types but never\n * rejects input.\n *\n * @example\n *\n * ```ts\n * import { createMachine, types } from 'xstate';\n *\n * const machine = createMachine({\n * schemas: {\n * context: types<{ count: number }>(),\n * events: {\n * inc: types<{ by: number }>(),\n * reset: types<void>()\n * }\n * },\n * context: { count: 0 }\n * // ...\n * });\n * ```\n *\n * Use `types<void>()` for events without a payload.\n * @public\n */\nexport function types<T>(): TypeSchema<T> {\n return {\n '~standard': {\n version: 1,\n vendor: 'xstate.types',\n validate: (value) => ({ value: value as T })\n }\n };\n}\n\n/**\n * Returns true if the value is a type-only schema created by {@link types}.\n *\n * @public\n */\nexport function isTypeSchema(value: unknown): value is TypeSchema<unknown> {\n return (\n !!value &&\n typeof value === 'object' &&\n '~standard' in value &&\n (value as StandardSchemaV1)['~standard'].vendor === 'xstate.types'\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace StandardSchemaV1 {\n /** The Standard Schema properties interface. */\n export interface Props<Input = unknown, Output = Input> {\n /** The version number of the standard. */\n readonly version: 1;\n /** The vendor name of the schema library. */\n readonly vendor: string;\n /** Validates unknown input values. */\n readonly validate: (\n value: unknown\n ) => Result<Output> | Promise<Result<Output>>;\n /** Inferred types associated with the schema. */\n readonly types?: Types<Input, Output> | undefined;\n }\n\n /** The result interface of the validate function. */\n export type Result<Output> = SuccessResult<Output> | FailureResult;\n\n /** The result interface if validation succeeds. */\n export interface SuccessResult<Output> {\n /** The typed output value. */\n readonly value: Output;\n /** The non-existent issues. */\n readonly issues?: undefined;\n }\n\n /** The result interface if validation fails. */\n export interface FailureResult {\n /** The issues of failed validation. */\n readonly issues: ReadonlyArray<Issue>;\n }\n\n /** The issue interface of the failure output. */\n export interface Issue {\n /** The error message of the issue. */\n readonly message: string;\n /** The path of the issue, if any. */\n readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;\n }\n\n /** The path segment interface of the issue. */\n export interface PathSegment {\n /** The key representing a path segment. */\n readonly key: PropertyKey;\n }\n\n /** The Standard Schema types interface. */\n export interface Types<Input = unknown, Output = Input> {\n /** The input type of the schema. */\n readonly input: Input;\n /** The output type of the schema. */\n readonly output: Output;\n }\n\n /** Infers the input type of a Standard Schema. */\n export type InferInput<Schema extends StandardSchemaV1> = NonNullable<\n Schema['~standard']['types']\n >['input'];\n\n /** Infers the output type of a Standard Schema. */\n export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<\n Schema['~standard']['types']\n >['output'];\n}\n"],"names":["createFSM","config","createSnapshot","value","context","status","output","undefined","error","checkTransition","transition","TypeError","JSON","stringify","hasAlways","Object","getOwnPropertyNames","states","state","always","type","on","getState","hasOwn","step","snapshot","selected","event","result","target","patch","key","Reflect","ownKeys","is","settle","next","initialSnapshot","initial","initialState","id","initialTransition","getInitialSnapshot","getPersistedSnapshot","transitions","_config","version","vendor","validate"],"mappings":"gPA8ZO,SAASA,EAKdC,GAUA,MAAMC,EAAiBA,CAACC,EAAeC,KACpC,CACCC,OAAQ,SACRF,QACAC,UACAE,YAAQC,EACRC,WAAOD,IAELE,EAAmBC,IACvB,GAA0B,iBAAfA,EACT,MAAM,IAAIC,UACR,iBAAiBC,KAAKC,UAAUH,2FAItC,IAAII,GAAY,EAChB,IAAK,MAAMX,KAASY,OAAOC,oBAAoBf,EAAOgB,QAAS,CAC7D,MAAMC,EAAQjB,EAAOgB,OAAOd,GAC5BM,EAAgBS,GAAOC,QACvBL,SAAgCP,IAAlBW,GAAOC,OACrB,IAAK,MAAMC,KAAQL,OAAOC,oBAAoBE,GAAOG,IAAM,CAAA,GACzDZ,EAAiBS,EAAOG,GAA+BD,GAE3D,CACA,MAAME,EAAYnB,GAChBY,OAAOQ,OAAOtB,EAAOgB,OAAQd,GAASF,EAAOgB,OAAOd,QAASI,EACzDiB,EAAOA,CACXC,EACAC,EACAC,KAEA,MAAMC,EACgB,mBAAbF,EACHA,EAAS,CAAEtB,QAASqB,EAASrB,QAASuB,UACtCD,EAEN,GADAjB,EAAgBmB,IACXA,EACH,OAEF,IAAIzB,MAAEA,EAAKC,QAAEA,GAAYqB,EACzB,MAAMI,OAAEA,EAAS1B,EAAOC,QAAS0B,GAAUF,EAC3C,IAAK,MAAMG,KAAOC,QAAQC,QAAQ,IAAKH,IAElCf,OAAOQ,OAAOnB,EAAS2B,IACvBhB,OAAOmB,GAAGJ,EAAOC,GAAM3B,EAAQ2B,MAEhC3B,EAAU,IAAKA,KAAY0B,IAG/B,OAAOD,IAAW1B,GAASC,IAAYqB,EAASrB,QAC5CqB,EACAvB,EAAe2B,EAAQzB,IAEvB+B,EAASA,CACbV,EACAE,KAEA,OAAS,CACP,MAAMS,EAAOZ,EAAKC,EAAUH,EAASG,EAAStB,QAAQgB,OAAQQ,GAC9D,IAAKS,EACH,OAAOX,EAETA,EAAWW,CACb,GAEIC,EAAkBnC,EACtBD,EAAOqC,QACPrC,EAAOG,SAAY,CAAA,GAEfmC,EAAezB,EACjBqB,EAAOE,EAAiB,CAAEjB,KAAM,gBAChCiB,EAEJ,MAAO,CACLG,GAAIvC,EAAOuC,GACXvC,SACAsC,eACAE,kBAAmBA,IAAM,CAACF,EAAc,IACxCG,mBAAoBA,IAAMH,EAC1BI,qBAAuBlB,GAAaA,EACpCf,UAAAA,CAAWe,EAAUE,GACnB,MAAMiB,GACJ7B,OAAOQ,OAAOtB,EAAOgB,OAAQQ,EAAStB,OAClCF,EAAOgB,OAAOQ,EAAStB,YACvBI,IACHc,GAGGK,EAAWX,OAAOQ,OAAOqB,GAAe,CAAA,EAAIjB,EAAMP,MACpDwB,EAAajB,EAAMP,WACnBb,EACE6B,EAAOZ,EAAKC,EAAUC,EAAUC,GACtC,MAAO,CAACS,EAAQtB,EAAYqB,EAAOC,EAAMT,GAASS,EAAQX,EAAU,GACtE,EAEJ,uBA1HO,SAILoB,EAA6C,IAE7C,MAAO,CACL7C,UAAYC,GAAsBD,EAAUC,GAEhD,UC5VO,WACL,MAAO,CACL,YAAa,CACX6C,QAAS,EACTC,OAAQ,eACRC,SAAW7C,IAAW,CAAEA,MAAOA,KAGrC"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var dist_xstateActors = require('./xstate-actors.cjs.js');
6
- var createActor = require('./createActor-c91c9ffe.cjs.js');
6
+ var createActor = require('./createActor-73aa92ba.cjs.js');
7
7
  require('./validation-4561b43c.cjs.js');
8
8
 
9
9
  function createMockActorScope() {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var dist_xstateActors = require('./xstate-actors.development.cjs.js');
6
- var createActor = require('./createActor-c029d29f.development.cjs.js');
6
+ var createActor = require('./createActor-dfb6b790.development.cjs.js');
7
7
  require('./validation-f2714a35.development.cjs.js');
8
8
 
9
9
  function createMockActorScope() {
@@ -1,6 +1,6 @@
1
1
  import { createEmptyActor } from './xstate-actors.development.esm.js';
2
- import { z as isMachineSnapshot, aJ as getAllOwnEvents, m as matchesEventDescriptor, aK as matchesEvent, Y as XSTATE_INIT } from './createActor-0250284a.development.esm.js';
3
- export { aJ as getAllOwnEvents } from './createActor-0250284a.development.esm.js';
2
+ import { A as isMachineSnapshot, aK as getAllOwnEvents, m as matchesEventDescriptor, aL as matchesEvent, Z as XSTATE_INIT } from './createActor-a085b20b.development.esm.js';
3
+ export { aK as getAllOwnEvents } from './createActor-a085b20b.development.esm.js';
4
4
  import './validation-e69470ad.development.esm.js';
5
5
 
6
6
  function createMockActorScope() {
@@ -1,6 +1,6 @@
1
1
  import { createEmptyActor } from './xstate-actors.esm.js';
2
- import { A as isMachineSnapshot, aI as getAllOwnEvents, m as matchesEventDescriptor, aJ as matchesEvent, Z as XSTATE_INIT } from './createActor-20a97166.esm.js';
3
- export { aI as getAllOwnEvents } from './createActor-20a97166.esm.js';
2
+ import { B as isMachineSnapshot, aJ as getAllOwnEvents, m as matchesEventDescriptor, aK as matchesEvent, _ as XSTATE_INIT } from './createActor-49ea55ba.esm.js';
3
+ export { aJ as getAllOwnEvents } from './createActor-49ea55ba.esm.js';
4
4
  import './validation-05f1d517.esm.js';
5
5
 
6
6
  function createMockActorScope() {
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var legacySnapshot = require('./legacySnapshot-8d595687.cjs.js');
6
- var createActor = require('./createActor-c91c9ffe.cjs.js');
5
+ var legacySnapshot = require('./legacySnapshot-a85dfbe2.cjs.js');
6
+ var createActor = require('./createActor-73aa92ba.cjs.js');
7
7
  require('./validation-4561b43c.cjs.js');
8
8
 
9
9
  /**
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var legacySnapshot = require('./legacySnapshot-ebf0b2b8.development.cjs.js');
6
- var createActor = require('./createActor-c029d29f.development.cjs.js');
5
+ var legacySnapshot = require('./legacySnapshot-2e2c1d3b.development.cjs.js');
6
+ var createActor = require('./createActor-dfb6b790.development.cjs.js');
7
7
  require('./validation-f2714a35.development.cjs.js');
8
8
 
9
9
  /**
@@ -1,6 +1,6 @@
1
- import { S as StateMachine, b as upgradeLegacyPersistedSnapshot, I as InvalidSnapshotError, v as validatePersistedSnapshot, a as StateNode } from './legacySnapshot-ae6594a7.development.esm.js';
2
- export { s as snapshotSchema } from './legacySnapshot-ae6594a7.development.esm.js';
3
- import { aV as diagnoseActorOptions, E as Actor, ao as cloneMachineSnapshot, e as createMachineSnapshot, ah as createInertActorScope, ad as describeMachine, aW as createRemoteActorRef, aX as createInvokeTimeoutEvent, o as isSerializedActorRef, aY as parseGeneratedActorId, ai as setInertActorScopeSnapshot, ak as attachSnapshotActorRef, am as isInertActorScope, an as setSnapshotActorRef } from './createActor-0250284a.development.esm.js';
1
+ import { S as StateMachine, b as upgradeLegacyPersistedSnapshot, I as InvalidSnapshotError, v as validatePersistedSnapshot, a as StateNode } from './legacySnapshot-11aba2d2.development.esm.js';
2
+ export { s as snapshotSchema } from './legacySnapshot-11aba2d2.development.esm.js';
3
+ import { aW as diagnoseActorOptions, F as Actor, ap as cloneMachineSnapshot, e as createMachineSnapshot, ai as createInertActorScope, ae as describeMachine, aX as createRemoteActorRef, aY as createInvokeTimeoutEvent, o as isSerializedActorRef, aZ as parseGeneratedActorId, aj as setInertActorScopeSnapshot, al as attachSnapshotActorRef, an as isInertActorScope, ao as setSnapshotActorRef } from './createActor-a085b20b.development.esm.js';
4
4
  import './validation-e69470ad.development.esm.js';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { S as StateMachine, b as upgradeLegacyPersistedSnapshot, I as InvalidSnapshotError, v as validatePersistedSnapshot, a as StateNode } from './legacySnapshot-9e06feb4.esm.js';
2
- export { s as snapshotSchema } from './legacySnapshot-9e06feb4.esm.js';
3
- import { aU as diagnoseActorOptions, F as Actor, x as xstateError, ap as cloneMachineSnapshot, e as createMachineSnapshot, ai as createInertActorScope, aV as createRemoteActorRef, aW as createInvokeTimeoutEvent, o as isSerializedActorRef, aX as parseGeneratedActorId, aj as setInertActorScopeSnapshot, al as attachSnapshotActorRef, an as isInertActorScope, ao as setSnapshotActorRef } from './createActor-20a97166.esm.js';
1
+ import { S as StateMachine, b as upgradeLegacyPersistedSnapshot, I as InvalidSnapshotError, v as validatePersistedSnapshot, a as StateNode } from './legacySnapshot-fffe81a0.esm.js';
2
+ export { s as snapshotSchema } from './legacySnapshot-fffe81a0.esm.js';
3
+ import { aV as diagnoseActorOptions, G as Actor, x as xstateError, aq as cloneMachineSnapshot, e as createMachineSnapshot, aj as createInertActorScope, aW as createRemoteActorRef, aX as createInvokeTimeoutEvent, o as isSerializedActorRef, aY as parseGeneratedActorId, ak as setInertActorScopeSnapshot, am as attachSnapshotActorRef, ao as isInertActorScope, ap as setSnapshotActorRef } from './createActor-49ea55ba.esm.js';
4
4
  import './validation-05f1d517.esm.js';
5
5
 
6
6
  /**