valtio-history 0.0.1 → 0.1.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/README.md CHANGED
@@ -12,7 +12,7 @@ https://valtio.pmnd.rs/docs/api/utils/proxyWithHistory
12
12
 
13
13
  ```tsx
14
14
  // replace the following line
15
- // import { proxyWithHistory } from '`valtio/utils';
15
+ // import { proxyWithHistory } from 'valtio/utils';
16
16
 
17
17
  import { proxyWithHistory } from 'valtio-history';
18
18
  import { useSnapshot } from 'valtio';
@@ -35,7 +35,10 @@ export default function App() {
35
35
  history,
36
36
  canUndo,
37
37
  canRedo,
38
- getCurrentChangeDate
38
+ getCurrentChangeDate,
39
+ getNode,
40
+ remove,
41
+ replace,
39
42
  } = useSnapshot(state);
40
43
 
41
44
  ...
@@ -46,4 +49,4 @@ export default function App() {
46
49
 
47
50
  - the `history` object has changes
48
51
  - `history.snapshots` is renamed to `history.nodes`
49
- - a `HistoryNode` has the structure `{ createdAt: Date; snapshot: Snapshot<T> }`
52
+ - a `HistoryNode` has the structure `{ snapshot: Snapshot<T>; createdAt: Date; updatedAt?: Date; }`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valtio-history",
3
- "version": "0.0.1",
3
+ "version": "0.1.0",
4
4
  "author": "Daishi Kato",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,50 +1,183 @@
1
1
  import type { INTERNAL_Snapshot as Snapshot } from 'valtio/vanilla';
2
2
  export type HistoryNode<T> = {
3
- createdAt: Date;
3
+ /**
4
+ * The snapshot being tracked
5
+ */
4
6
  snapshot: Snapshot<T>;
7
+ /**
8
+ * The date when the node was created
9
+ */
10
+ createdAt: Date;
11
+ /**
12
+ * The date when the node was updated. Will be undefined if
13
+ * the node was never updated.
14
+ */
15
+ updatedAt?: Date;
5
16
  };
6
17
  export type History<T> = {
18
+ /**
19
+ * field for holding sandbox changes; used to avoid infinite loops
20
+ */
7
21
  wip?: Snapshot<T>;
22
+ /**
23
+ * the nodes of the history for each change
24
+ */
8
25
  nodes: HistoryNode<T>[];
26
+ /**
27
+ * the history index of the current snapshot
28
+ */
9
29
  index: number;
10
30
  };
11
31
  /**
12
- * proxyWithHistory
32
+ * This creates a new proxy with history support (ProxyHistoryObject).
33
+ * It includes following main properties:<br>
34
+ * - value: any value (does not have to be an object)<br>
35
+ * - history: an object holding the history of snapshots and other metadata<br>
36
+ * - history.index: the history index of the current snapshot<br>
37
+ * - history.nodes: the nodes of the history for each change<br>
38
+ * - history.wip: field for holding sandbox changes; used to avoid infinite loops<br>
39
+ * - canUndo: a function to return true if undo is available <br>
40
+ * - undo: a function to go back history <br>
41
+ * - canRedo: a function to return true if redo is available <br>
42
+ * - redo: a function to go forward history <br>
43
+ * - saveHistory: a function to save history <br>
44
+ * - getCurrentChangeDate: gets the date of the current change <br>
45
+ * - remove: a function to remove a specified history index <br>
46
+ * - replace: a function to replace a snapshot at a specified history index <br>
47
+ * - getNode: a function to get the node at a specified history index <br>
13
48
  *
14
- * This creates a new proxy with history support.
15
- * It includes following properties:
16
- * - value: any value (does not have to be an object)
17
- * - history: an object holding the history of snapshots and other metadata
18
- * - history.index: the history index to the current snapshot
19
- * - history.nodes: the nodes of the history for each change
20
- * - history.wip: field for holding sandbox changes; used to avoid infinite loops
21
- * - canUndo: a function to return true if undo is available
22
- * - undo: a function to go back history
23
- * - canRedo: a function to return true if redo is available
24
- * - redo: a function to go forward history
25
- * - saveHistory: a function to save history
26
- * - getCurrentChangeDate: gets the date of the current change
49
+ * <br>
50
+ * Notes: <br>
51
+ * - Suspense/promise is not supported. <br>
27
52
  *
28
- * [Notes]
29
- * - Suspense/promise is not supported.
53
+ * @param initialValue - any object to track
54
+ * @param skipSubscribe - determines if the internal subscribe behaviour should be skipped.
55
+ * @returns proxyObject
30
56
  *
31
57
  * @example
32
- * import { proxyWithHistory } from 'valtio/utils'
58
+ * import { proxyWithHistory } from 'valtio-history'
33
59
  * const state = proxyWithHistory({
34
60
  * count: 1,
35
61
  * })
36
62
  */
37
63
  export declare function proxyWithHistory<V>(initialValue: V, skipSubscribe?: boolean): {
64
+ /**
65
+ * any value to be tracked (does not have to be an object)
66
+ */
38
67
  value: V;
68
+ /**
69
+ * an object holding the history of snapshots and other metadata <br>
70
+ * - history.index: the history index to the current snapshot <br>
71
+ * - history.nodes: the nodes of the history for each change <br>
72
+ * - history.wip: field for holding sandbox changes; used to avoid infinite loops<br>
73
+ */
39
74
  history: History<V> & {
40
75
  $$valtioRef: true;
41
76
  };
42
- getCurrentChangeDate: () => Date;
43
- clone: <T>(value: T) => T;
77
+ /**
78
+ * get the date when a node was entered into history.
79
+ *
80
+ * @returns date
81
+ */
82
+ getCurrentChangeDate: () => Date | undefined;
83
+ /**
84
+ * utility method to get a history node.
85
+ * The snapshot within this node is already cloned and
86
+ * will not affect the original value if updated.
87
+ *
88
+ * @param index
89
+ * @returns historyNode
90
+ */
91
+ getNode: (index: number) => {
92
+ snapshot: V extends RegExp | Date | Map<any, any> | Set<any> | WeakMap<any, any> | WeakSet<any> | {
93
+ $$valtioRef: true;
94
+ } | Error | ((...args: any[]) => any) | (string | number | bigint | boolean | symbol | null | undefined) ? V : V extends Promise<unknown> ? Awaited<V> : V extends object ? { readonly [K in keyof V]: V[K] extends infer T ? T extends V[K] ? T extends RegExp | Date | Map<any, any> | Set<any> | WeakMap<any, any> | WeakSet<any> | {
95
+ $$valtioRef: true;
96
+ } | Error | ((...args: any[]) => any) | (string | number | bigint | boolean | symbol | null | undefined) ? T : T extends Promise<unknown> ? Awaited<T> : T extends object ? { readonly [K_1 in keyof T]: T[K_1] extends infer T_1 ? T_1 extends T[K_1] ? T_1 extends RegExp | Date | Map<any, any> | Set<any> | WeakMap<any, any> | WeakSet<any> | {
97
+ $$valtioRef: true;
98
+ } | Error | ((...args: any[]) => any) | (string | number | bigint | boolean | symbol | null | undefined) ? T_1 : T_1 extends Promise<unknown> ? Awaited<T_1> : T_1 extends object ? { readonly [K_2 in keyof T_1]: T_1[K_2] extends infer T_2 ? T_2 extends T_1[K_2] ? T_2 extends RegExp | Date | Map<any, any> | Set<any> | WeakMap<any, any> | WeakSet<any> | {
99
+ $$valtioRef: true;
100
+ } | Error | ((...args: any[]) => any) | (string | number | bigint | boolean | symbol | null | undefined) ? T_2 : T_2 extends Promise<unknown> ? Awaited<T_2> : T_2 extends object ? { readonly [K_3 in keyof T_2]: T_2[K_3] extends infer T_3 ? T_3 extends T_2[K_3] ? T_3 extends RegExp | Date | Map<any, any> | Set<any> | WeakMap<any, any> | WeakSet<any> | {
101
+ $$valtioRef: true;
102
+ } | Error | ((...args: any[]) => any) | (string | number | bigint | boolean | symbol | null | undefined) ? T_3 : T_3 extends Promise<unknown> ? Awaited<T_3> : T_3 extends object ? { readonly [K_4 in keyof T_3]: T_3[K_4] extends infer T_4 ? T_4 extends T_3[K_4] ? T_4 extends RegExp | Date | Map<any, any> | Set<any> | WeakMap<any, any> | WeakSet<any> | {
103
+ $$valtioRef: true;
104
+ } | Error | ((...args: any[]) => any) | (string | number | bigint | boolean | symbol | null | undefined) ? T_4 : T_4 extends Promise<unknown> ? Awaited<T_4> : T_4 extends object ? { readonly [K_5 in keyof T_4]: T_4[K_5] extends infer T_5 ? T_5 extends T_4[K_5] ? T_5 extends RegExp | Date | Map<any, any> | Set<any> | WeakMap<any, any> | WeakSet<any> | {
105
+ $$valtioRef: true;
106
+ } | Error | ((...args: any[]) => any) | (string | number | bigint | boolean | symbol | null | undefined) ? T_5 : T_5 extends Promise<unknown> ? Awaited<T_5> : T_5 extends object ? { readonly [K_6 in keyof T_5]: T_5[K_6] extends infer T_6 ? T_6 extends T_5[K_6] ? T_6 extends RegExp | Date | Map<any, any> | Set<any> | WeakMap<any, any> | WeakSet<any> | {
107
+ $$valtioRef: true;
108
+ } | Error | ((...args: any[]) => any) | (string | number | bigint | boolean | symbol | null | undefined) ? T_6 : T_6 extends Promise<unknown> ? Awaited<T_6> : T_6 extends object ? { readonly [K_7 in keyof T_6]: T_6[K_7] extends infer T_7 ? T_7 extends T_6[K_7] ? T_7 extends RegExp | Date | Map<any, any> | Set<any> | WeakMap<any, any> | WeakSet<any> | {
109
+ $$valtioRef: true;
110
+ } | Error | ((...args: any[]) => any) | (string | number | bigint | boolean | symbol | null | undefined) ? T_7 : T_7 extends Promise<unknown> ? Awaited<T_7> : T_7 extends object ? { readonly [K_8 in keyof T_7]: T_7[K_8] extends infer T_8 ? T_8 extends T_7[K_8] ? T_8 extends RegExp | Date | Map<any, any> | Set<any> | WeakMap<any, any> | WeakSet<any> | {
111
+ $$valtioRef: true;
112
+ } | Error | ((...args: any[]) => any) | (string | number | bigint | boolean | symbol | null | undefined) ? T_8 : T_8 extends Promise<unknown> ? Awaited<T_8> : T_8 extends object ? { readonly [K_9 in keyof T_8]: T_8[K_9] extends infer T_9 ? T_9 extends T_8[K_9] ? T_9 extends RegExp | Date | Map<any, any> | Set<any> | WeakMap<any, any> | WeakSet<any> | {
113
+ $$valtioRef: true;
114
+ } | Error | ((...args: any[]) => any) | (string | number | bigint | boolean | symbol | null | undefined) ? T_9 : T_9 extends Promise<unknown> ? Awaited<T_9> : T_9 extends object ? { readonly [K_10 in keyof T_9]: any; } : T_9 : never : never; } : T_8 : never : never; } : T_7 : never : never; } : T_6 : never : never; } : T_5 : never : never; } : T_4 : never : never; } : T_3 : never : never; } : T_2 : never : never; } : T_1 : never : never; } : T : never : never; } : V;
115
+ /**
116
+ * The date when the node was created
117
+ */
118
+ createdAt: Date;
119
+ /**
120
+ * The date when the node was updated. Will be undefined if
121
+ * the node was never updated.
122
+ */
123
+ updatedAt?: Date | undefined;
124
+ } | undefined;
125
+ /**
126
+ * utility to clone a snapshot
127
+ */
128
+ clone: <T_10>(value: T_10) => T_10;
129
+ /**
130
+ * a function to return true if undo is available
131
+ * @returns boolean
132
+ */
44
133
  canUndo: () => boolean;
134
+ /**
135
+ * a function to go back in history
136
+ */
45
137
  undo: () => void;
138
+ /**
139
+ * a function to return true if redo is available
140
+ * @returns boolean
141
+ */
46
142
  canRedo: () => boolean;
143
+ /**
144
+ * a function to go forward in history
145
+ */
47
146
  redo: () => void;
147
+ /**
148
+ * a function to execute saving history when changes are made to `value`
149
+ */
48
150
  saveHistory: () => void;
151
+ /**
152
+ * a function to subscribe to changes made to `value`
153
+ */
49
154
  subscribe: () => () => void;
155
+ /**
156
+ * The remove method is only invoked when there are
157
+ * more than one nodes and when a valid index is provided.
158
+ * If the current index is removed,
159
+ * An index greater than the current index will be preferred as the next
160
+ * value.
161
+ *
162
+ * @param index - index of the node to remove
163
+ * @returns removedNode
164
+ */
165
+ remove: (index: number) => HistoryNode<V> | undefined;
166
+ /**
167
+ * utility to replace a value in history. The history
168
+ * changes will not be affected, only the value to be replaced.
169
+ * If a base value is needed to operate on,
170
+ * the `getNode` utility can be used to retrieve
171
+ * a cloned historyNode.
172
+ *
173
+ * <br> <br>
174
+ * Notes: <br>
175
+ * - No operations are done on the value provided to this utility. <br>
176
+ * - This is an advanced method, please ensure the value provided
177
+ * is a snapshot of the same type of the value being tracked. <br>
178
+ *
179
+ * @param index - index to replace value for
180
+ * @param value - the updated snapshot to be stored at the index
181
+ */
182
+ replace: (index: number, value: Snapshot<V>) => void;
50
183
  };
@@ -20,58 +20,113 @@ const deepClone = (value) => {
20
20
  return baseObject;
21
21
  };
22
22
  /**
23
- * proxyWithHistory
23
+ * This creates a new proxy with history support (ProxyHistoryObject).
24
+ * It includes following main properties:<br>
25
+ * - value: any value (does not have to be an object)<br>
26
+ * - history: an object holding the history of snapshots and other metadata<br>
27
+ * - history.index: the history index of the current snapshot<br>
28
+ * - history.nodes: the nodes of the history for each change<br>
29
+ * - history.wip: field for holding sandbox changes; used to avoid infinite loops<br>
30
+ * - canUndo: a function to return true if undo is available <br>
31
+ * - undo: a function to go back history <br>
32
+ * - canRedo: a function to return true if redo is available <br>
33
+ * - redo: a function to go forward history <br>
34
+ * - saveHistory: a function to save history <br>
35
+ * - getCurrentChangeDate: gets the date of the current change <br>
36
+ * - remove: a function to remove a specified history index <br>
37
+ * - replace: a function to replace a snapshot at a specified history index <br>
38
+ * - getNode: a function to get the node at a specified history index <br>
24
39
  *
25
- * This creates a new proxy with history support.
26
- * It includes following properties:
27
- * - value: any value (does not have to be an object)
28
- * - history: an object holding the history of snapshots and other metadata
29
- * - history.index: the history index to the current snapshot
30
- * - history.nodes: the nodes of the history for each change
31
- * - history.wip: field for holding sandbox changes; used to avoid infinite loops
32
- * - canUndo: a function to return true if undo is available
33
- * - undo: a function to go back history
34
- * - canRedo: a function to return true if redo is available
35
- * - redo: a function to go forward history
36
- * - saveHistory: a function to save history
37
- * - getCurrentChangeDate: gets the date of the current change
40
+ * <br>
41
+ * Notes: <br>
42
+ * - Suspense/promise is not supported. <br>
38
43
  *
39
- * [Notes]
40
- * - Suspense/promise is not supported.
44
+ * @param initialValue - any object to track
45
+ * @param skipSubscribe - determines if the internal subscribe behaviour should be skipped.
46
+ * @returns proxyObject
41
47
  *
42
48
  * @example
43
- * import { proxyWithHistory } from 'valtio/utils'
49
+ * import { proxyWithHistory } from 'valtio-history'
44
50
  * const state = proxyWithHistory({
45
51
  * count: 1,
46
52
  * })
47
53
  */
48
54
  function proxyWithHistory(initialValue, skipSubscribe = false) {
49
55
  const proxyObject = (0, vanilla_1.proxy)({
56
+ /**
57
+ * any value to be tracked (does not have to be an object)
58
+ */
50
59
  value: initialValue,
60
+ /**
61
+ * an object holding the history of snapshots and other metadata <br>
62
+ * - history.index: the history index to the current snapshot <br>
63
+ * - history.nodes: the nodes of the history for each change <br>
64
+ * - history.wip: field for holding sandbox changes; used to avoid infinite loops<br>
65
+ */
51
66
  history: (0, vanilla_1.ref)({
52
67
  wip: undefined,
53
68
  nodes: [],
54
69
  index: -1,
55
70
  }),
71
+ /**
72
+ * get the date when a node was entered into history.
73
+ *
74
+ * @returns date
75
+ */
56
76
  getCurrentChangeDate: () => {
57
77
  const node = proxyObject.history.nodes[proxyObject.history.index];
58
78
  return node === null || node === void 0 ? void 0 : node.createdAt;
59
79
  },
80
+ /**
81
+ * utility method to get a history node.
82
+ * The snapshot within this node is already cloned and
83
+ * will not affect the original value if updated.
84
+ *
85
+ * @param index
86
+ * @returns historyNode
87
+ */
88
+ getNode: (index) => {
89
+ const node = proxyObject.history.nodes[index];
90
+ return node
91
+ ? Object.assign(Object.assign({}, node), { snapshot: proxyObject.clone(node.snapshot) }) : undefined;
92
+ },
93
+ /**
94
+ * utility to clone a snapshot
95
+ */
60
96
  clone: deepClone,
97
+ /**
98
+ * a function to return true if undo is available
99
+ * @returns boolean
100
+ */
61
101
  canUndo: () => proxyObject.history.index > 0,
102
+ /**
103
+ * a function to go back in history
104
+ */
62
105
  undo: () => {
63
106
  var _a;
64
107
  if (proxyObject.canUndo()) {
65
- proxyObject.value = (proxyObject.history.wip = proxyObject.clone((_a = proxyObject.history.nodes[--proxyObject.history.index]) === null || _a === void 0 ? void 0 : _a.snapshot));
108
+ proxyObject.history.wip = proxyObject.clone((_a = proxyObject.history.nodes[--proxyObject.history.index]) === null || _a === void 0 ? void 0 : _a.snapshot);
109
+ proxyObject.value = proxyObject.history.wip;
66
110
  }
67
111
  },
112
+ /**
113
+ * a function to return true if redo is available
114
+ * @returns boolean
115
+ */
68
116
  canRedo: () => proxyObject.history.index < proxyObject.history.nodes.length - 1,
117
+ /**
118
+ * a function to go forward in history
119
+ */
69
120
  redo: () => {
70
121
  var _a;
71
122
  if (proxyObject.canRedo()) {
72
- proxyObject.value = (proxyObject.history.wip = proxyObject.clone((_a = proxyObject.history.nodes[++proxyObject.history.index]) === null || _a === void 0 ? void 0 : _a.snapshot));
123
+ proxyObject.history.wip = proxyObject.clone((_a = proxyObject.history.nodes[++proxyObject.history.index]) === null || _a === void 0 ? void 0 : _a.snapshot);
124
+ proxyObject.value = proxyObject.history.wip;
73
125
  }
74
126
  },
127
+ /**
128
+ * a function to execute saving history when changes are made to `value`
129
+ */
75
130
  saveHistory: () => {
76
131
  proxyObject.history.nodes.splice(proxyObject.history.index + 1);
77
132
  proxyObject.history.nodes.push({
@@ -80,12 +135,74 @@ function proxyWithHistory(initialValue, skipSubscribe = false) {
80
135
  });
81
136
  ++proxyObject.history.index;
82
137
  },
138
+ /**
139
+ * a function to subscribe to changes made to `value`
140
+ */
83
141
  subscribe: () => (0, vanilla_1.subscribe)(proxyObject, (ops) => {
84
142
  if (ops.every((op) => op[1][0] === 'value' &&
85
143
  (op[0] !== 'set' || op[2] !== proxyObject.history.wip))) {
86
144
  proxyObject.saveHistory();
87
145
  }
88
146
  }),
147
+ // history rewrite utilities
148
+ /**
149
+ * The remove method is only invoked when there are
150
+ * more than one nodes and when a valid index is provided.
151
+ * If the current index is removed,
152
+ * An index greater than the current index will be preferred as the next
153
+ * value.
154
+ *
155
+ * @param index - index of the node to remove
156
+ * @returns removedNode
157
+ */
158
+ remove: (index) => {
159
+ const node = proxyObject.history.nodes[index];
160
+ const isCurrentIndex = proxyObject.history.index === index;
161
+ const lastIndex = proxyObject.history.nodes.length - 1;
162
+ const isLastIndex = lastIndex === index;
163
+ if (!node || proxyObject.history.nodes.length < 2)
164
+ return;
165
+ if (isCurrentIndex) {
166
+ const resolvedIndex = isLastIndex ? index - 1 : index + 1;
167
+ const resolvedNode = proxyObject.history.nodes[resolvedIndex];
168
+ proxyObject.history.wip = proxyObject.clone(resolvedNode === null || resolvedNode === void 0 ? void 0 : resolvedNode.snapshot);
169
+ proxyObject.value = proxyObject.history.wip;
170
+ if (isLastIndex)
171
+ proxyObject.history.index--;
172
+ }
173
+ proxyObject.history.nodes.splice(index, 1);
174
+ if (!isCurrentIndex && proxyObject.history.index > index) {
175
+ proxyObject.history.index--;
176
+ }
177
+ return node;
178
+ },
179
+ /**
180
+ * utility to replace a value in history. The history
181
+ * changes will not be affected, only the value to be replaced.
182
+ * If a base value is needed to operate on,
183
+ * the `getNode` utility can be used to retrieve
184
+ * a cloned historyNode.
185
+ *
186
+ * <br> <br>
187
+ * Notes: <br>
188
+ * - No operations are done on the value provided to this utility. <br>
189
+ * - This is an advanced method, please ensure the value provided
190
+ * is a snapshot of the same type of the value being tracked. <br>
191
+ *
192
+ * @param index - index to replace value for
193
+ * @param value - the updated snapshot to be stored at the index
194
+ */
195
+ replace: (index, value) => {
196
+ const node = proxyObject.history.nodes[index];
197
+ const isCurrentIndex = proxyObject.history.index === index;
198
+ if (!node)
199
+ return;
200
+ proxyObject.history.nodes[index] = Object.assign(Object.assign({}, node), { snapshot: value, updatedAt: new Date() });
201
+ if (isCurrentIndex) {
202
+ proxyObject.history.wip = value;
203
+ proxyObject.value = proxyObject.history.wip;
204
+ }
205
+ },
89
206
  });
90
207
  proxyObject.saveHistory();
91
208
  if (!skipSubscribe) {
@@ -1 +1 @@
1
- {"version":3,"file":"history-utility.js","sourceRoot":"","sources":["../../../../packages/history-utility/src/history-utility.ts"],"names":[],"mappings":";;;AAAA,4CAMwB;AAcxB,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAmB,EAAE,CACnD,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC;AAEvC,IAAI,MAAmC,CAAC;AAExC,MAAM,SAAS,GAAG,CAAI,KAAQ,EAAK,EAAE;IACnC,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,GAAG,IAAA,qCAAkB,GAAE,CAAC,CAAC,CAAC,CAAC;KAClC;IACD,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QACzC,OAAO,KAAK,CAAC;KACd;IACD,MAAM,UAAU,GAAM,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACxC,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;IAChD,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACrC,UAAU,CAAC,GAAc,CAAC,GAAG,SAAS,CAA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G,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,GAAG,WAAW,CAAC,KAAK,CAC9D,MAAA,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,0CAAE,QAAQ,CACjE,CAAM,CAAC;aACT;QACH,CAAC;QACD,WAAW,EAAE,GAAG,EAAE;YAChB,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YAChE,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC;gBAC7B,SAAS,EAAE,IAAI,IAAI,EAAE;gBACrB,QAAQ,EAAE,IAAA,kBAAQ,EAAC,WAAW,CAAC,CAAC,KAAK;aACtC,CAAC,CAAC;YACH,EAAE,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC;QAC9B,CAAC;QACD,SAAS,EAAE,GAAG,EAAE,CACd,IAAA,mBAAS,EAAC,WAAW,EAAE,CAAC,GAAG,EAAE,EAAE;YAC7B,IACE,GAAG,CAAC,KAAK,CACP,CAAC,EAAE,EAAE,EAAE,CACL,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO;gBACpB,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CACzD,EACD;gBACA,WAAW,CAAC,WAAW,EAAE,CAAC;aAC3B;QACH,CAAC,CAAC;KACL,CAAC,CAAC;IAEH,WAAW,CAAC,WAAW,EAAE,CAAC;IAE1B,IAAI,CAAC,aAAa,EAAE;QAClB,WAAW,CAAC,SAAS,EAAE,CAAC;KACzB;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AA3DD,4CA2DC"}
1
+ {"version":3,"file":"history-utility.js","sourceRoot":"","sources":["../../../../packages/history-utility/src/history-utility.ts"],"names":[],"mapp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