@rimbu/deep 0.9.2 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +1 -1
  2. package/dist/main/index.js +12 -3
  3. package/dist/main/index.js.map +1 -1
  4. package/dist/main/internal.js +2 -4
  5. package/dist/main/internal.js.map +1 -1
  6. package/dist/main/match.js +197 -132
  7. package/dist/main/match.js.map +1 -1
  8. package/dist/main/patch.js +125 -106
  9. package/dist/main/patch.js.map +1 -1
  10. package/dist/main/path.js +14 -39
  11. package/dist/main/path.js.map +1 -1
  12. package/dist/main/protected.js +22 -0
  13. package/dist/main/protected.js.map +1 -0
  14. package/dist/module/index.js +3 -2
  15. package/dist/module/index.js.map +1 -1
  16. package/dist/module/internal.js +2 -4
  17. package/dist/module/internal.js.map +1 -1
  18. package/dist/module/match.js +180 -97
  19. package/dist/module/match.js.map +1 -1
  20. package/dist/module/patch.js +113 -87
  21. package/dist/module/patch.js.map +1 -1
  22. package/dist/module/path.js +15 -36
  23. package/dist/module/path.js.map +1 -1
  24. package/dist/module/protected.js +18 -0
  25. package/dist/module/protected.js.map +1 -0
  26. package/dist/types/index.d.ts +3 -2
  27. package/dist/types/internal.d.ts +2 -4
  28. package/dist/types/match.d.ts +93 -80
  29. package/dist/types/patch.d.ts +64 -61
  30. package/dist/types/path.d.ts +9 -20
  31. package/dist/types/protected.d.ts +32 -0
  32. package/package.json +4 -4
  33. package/src/index.ts +12 -2
  34. package/src/internal.ts +3 -4
  35. package/src/match.ts +254 -163
  36. package/src/patch.ts +204 -147
  37. package/src/path.ts +20 -44
  38. package/src/protected.ts +44 -0
  39. package/dist/main/immutable.js +0 -12
  40. package/dist/main/immutable.js.map +0 -1
  41. package/dist/main/literal.js +0 -41
  42. package/dist/main/literal.js.map +0 -1
  43. package/dist/module/immutable.js +0 -8
  44. package/dist/module/immutable.js.map +0 -1
  45. package/dist/module/literal.js +0 -37
  46. package/dist/module/literal.js.map +0 -1
  47. package/dist/types/immutable.d.ts +0 -13
  48. package/dist/types/literal.d.ts +0 -48
  49. package/src/immutable.ts +0 -21
  50. package/src/literal.ts +0 -70
package/README.md CHANGED
@@ -84,7 +84,7 @@ console.log(
84
84
 
85
85
  ## Contributing
86
86
 
87
- Feel very welcome to contribute to further improve Rimbu. Please read our [Contributing guide](../../CONTRIBUTING.md).
87
+ Feel very welcome to contribute to further improve Rimbu. Please read our [Contributing guide](https://github.com/rimbu-org/rimbu/blob/main/CONTRIBUTING.md).
88
88
 
89
89
  ## Contributors
90
90
 
@@ -2,11 +2,20 @@
2
2
  /**
3
3
  * @packageDocumentation
4
4
  *
5
- * The `@rimbu/deep` package provides utilities to patch and match plain JavaScript objects..<br/>
5
+ * The `@rimbu/deep` package provides utilities to patch and match plain JavaScript objects.<br/>
6
6
  * <br/>
7
7
  * See the [Rimbu docs Deep overview page](/docs/deep/overview) for more information.
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- var tslib_1 = require("tslib");
11
- tslib_1.__exportStar(require("./internal"), exports);
10
+ exports.Tuple = exports.Protected = exports.Path = exports.Match = exports.match = exports.Patch = exports.patchNested = exports.patch = void 0;
11
+ var internal_1 = require("./internal");
12
+ Object.defineProperty(exports, "patch", { enumerable: true, get: function () { return internal_1.patch; } });
13
+ Object.defineProperty(exports, "patchNested", { enumerable: true, get: function () { return internal_1.patchNested; } });
14
+ Object.defineProperty(exports, "Patch", { enumerable: true, get: function () { return internal_1.Patch; } });
15
+ Object.defineProperty(exports, "match", { enumerable: true, get: function () { return internal_1.match; } });
16
+ Object.defineProperty(exports, "Match", { enumerable: true, get: function () { return internal_1.Match; } });
17
+ Object.defineProperty(exports, "Path", { enumerable: true, get: function () { return internal_1.Path; } });
18
+ Object.defineProperty(exports, "Protected", { enumerable: true, get: function () { return internal_1.Protected; } });
19
+ var tuple_1 = require("./tuple");
20
+ Object.defineProperty(exports, "Tuple", { enumerable: true, get: function () { return tuple_1.Tuple; } });
12
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,qDAA2B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,uCAQoB;AAPlB,iGAAA,KAAK,OAAA;AACL,uGAAA,WAAW,OAAA;AACX,iGAAA,KAAK,OAAA;AACL,iGAAA,KAAK,OAAA;AACL,iGAAA,KAAK,OAAA;AACL,gGAAA,IAAI,OAAA;AACJ,qGAAA,SAAS,OAAA;AAGX,iCAAgC;AAAvB,8FAAA,KAAK,OAAA"}
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./tuple"), exports);
5
- tslib_1.__exportStar(require("./literal"), exports);
6
- tslib_1.__exportStar(require("./immutable"), exports);
4
+ tslib_1.__exportStar(require("./protected"), exports);
7
5
  tslib_1.__exportStar(require("./match"), exports);
8
- tslib_1.__exportStar(require("./path"), exports);
9
6
  tslib_1.__exportStar(require("./patch"), exports);
7
+ tslib_1.__exportStar(require("./path"), exports);
10
8
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,oDAA0B;AAC1B,sDAA4B;AAC5B,kDAAwB;AACxB,iDAAuB;AACvB,kDAAwB"}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAE5B,kDAAwB;AACxB,kDAAwB;AACxB,iDAAuB"}
@@ -1,181 +1,246 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Match = void 0;
4
- var tslib_1 = require("tslib");
3
+ exports.match = exports.Match = void 0;
5
4
  var base_1 = require("@rimbu/base");
6
- var internal_1 = require("./internal");
7
5
  var Match;
8
6
  (function (Match) {
9
7
  /**
10
- * Returns true if the given `value` matches all of the given objects in the `matchers` array.
11
- * @typeparam T - the type of the object to match
12
- * @param value - the value to match
13
- * @param matchers - one or more `Match` objects
8
+ * Returns a matcher that returns true if every given `matchItem` matches the given value.
9
+ * @typeparam T - the type of value to match
10
+ * @typeparam R - the root object type
11
+ * @typeparam Q - a utility type for the matcher
12
+ * @param matchItems - the match specifications to test
14
13
  * @example
15
14
  * ```ts
16
- * matchAll({ g: { h: 'abc' }})({ g: { h: 'a' }}) => false
17
- * matchAll({ g: { h: 'abc' }})({ g: { h: v => v.length > 1 }}) => true
15
+ * const input = { a: 1, b: { c: true, d: 'a' } }
16
+ * match(input, Match.every({ a: 1, { c: true } } )) // => true
17
+ * match(input, Match.every({ a: 1, { c: false } } )) // => false
18
18
  * ```
19
19
  */
20
- function all(value) {
21
- return function () {
22
- var e_1, _a;
23
- var matchers = [];
24
- for (var _i = 0; _i < arguments.length; _i++) {
25
- matchers[_i] = arguments[_i];
26
- }
27
- try {
28
- for (var matchers_1 = tslib_1.__values(matchers), matchers_1_1 = matchers_1.next(); !matchers_1_1.done; matchers_1_1 = matchers_1.next()) {
29
- var matcher = matchers_1_1.value;
30
- if (!matchSingle(value, matcher, value, value)) {
31
- return false;
32
- }
33
- }
34
- }
35
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
36
- finally {
37
- try {
38
- if (matchers_1_1 && !matchers_1_1.done && (_a = matchers_1.return)) _a.call(matchers_1);
39
- }
40
- finally { if (e_1) throw e_1.error; }
41
- }
42
- return true;
43
- };
20
+ function every() {
21
+ var matchItems = [];
22
+ for (var _i = 0; _i < arguments.length; _i++) {
23
+ matchItems[_i] = arguments[_i];
24
+ }
25
+ return new Every(matchItems);
44
26
  }
45
- Match.all = all;
27
+ Match.every = every;
46
28
  /**
47
- * Returns true if the given `value` matches any of the given objects in the `matchers` array.
48
- * @typeparam T - the type of the object to match
49
- * @param value - the value to match
50
- * @param matchers - one or more `Match` objects
29
+ * Returns a matcher that returns true if at least one of given `matchItem` matches the given value.
30
+ * @typeparam T - the type of value to match
31
+ * @typeparam R - the root object type
32
+ * @typeparam Q - a utility type for the matcher
33
+ * @param matchItems - the match specifications to test
51
34
  * @example
52
35
  * ```ts
53
- * matchAny({ g: { h: 'abc' }})({ g: { h: 'a' }}, { g: { h: v => v.length < 2 }}) => false
54
- * matchAny({ g: { h: 'abc' }})({ g: { h: 'a' }}, { g: { h: v => v.length > 1 }}) => true
36
+ * const input = { a: 1, b: { c: true, d: 'a' } }
37
+ * match(input, Match.some({ a: 5, { c: true } } )) // => true
38
+ * match(input, Match.some({ a: 5, { c: false } } )) // => false
55
39
  * ```
56
40
  */
57
- function any(value) {
58
- return function () {
59
- var e_2, _a;
60
- var matchers = [];
61
- for (var _i = 0; _i < arguments.length; _i++) {
62
- matchers[_i] = arguments[_i];
63
- }
64
- try {
65
- for (var matchers_2 = tslib_1.__values(matchers), matchers_2_1 = matchers_2.next(); !matchers_2_1.done; matchers_2_1 = matchers_2.next()) {
66
- var matcher = matchers_2_1.value;
67
- if (matchSingle(value, matcher, value, value)) {
68
- return true;
69
- }
70
- }
71
- }
72
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
73
- finally {
74
- try {
75
- if (matchers_2_1 && !matchers_2_1.done && (_a = matchers_2.return)) _a.call(matchers_2);
76
- }
77
- finally { if (e_2) throw e_2.error; }
78
- }
79
- return false;
80
- };
41
+ function some() {
42
+ var matchItems = [];
43
+ for (var _i = 0; _i < arguments.length; _i++) {
44
+ matchItems[_i] = arguments[_i];
45
+ }
46
+ return new Some(matchItems);
81
47
  }
82
- Match.any = any;
48
+ Match.some = some;
83
49
  /**
84
- * Returns a function that takes a value of type T, and returns true if the value matches all the
85
- * given `matches` array of Match instances.
86
- * @typeparam T - the type of the object to match
87
- * @typeparam T2 - the type to use for the Match, should be equal to T
88
- * @param matches - at least one Match instance to perform on a given `value`
50
+ * Returns a matcher that returns true if none of given `matchItem` matches the given value.
51
+ * @typeparam T - the type of value to match
52
+ * @typeparam R - the root object type
53
+ * @typeparam Q - a utility type for the matcher
54
+ * @param matchItems - the match specifications to test
89
55
  * @example
90
56
  * ```ts
91
- * type Person = { name: string, age: number }
92
- * const m = Match.createAll<Person>({ age: v => v > 20 }, { name: v => v.length > 2 })
93
- *
94
- * console.log(m({ name: 'abc', age: 10 }))
95
- * // => false
96
- * console.log(m({ name: 'abc', age: 20 }))
97
- * // => true
98
- * console.log(m({ name: 'a', age: 20 }))
99
- * // => false
57
+ * const input = { a: 1, b: { c: true, d: 'a' } }
58
+ * match(input, Match.none({ a: 5, { c: true } } )) // => false
59
+ * match(input, Match.none({ a: 5, { c: false } } )) // => true
100
60
  * ```
101
61
  */
102
- function createAll() {
103
- var matches = [];
62
+ function none() {
63
+ var matchItems = [];
104
64
  for (var _i = 0; _i < arguments.length; _i++) {
105
- matches[_i] = arguments[_i];
65
+ matchItems[_i] = arguments[_i];
106
66
  }
107
- return function (value) { return Match.all(value).apply(void 0, tslib_1.__spreadArray([], tslib_1.__read(matches), false)); };
67
+ return new None(matchItems);
108
68
  }
109
- Match.createAll = createAll;
69
+ Match.none = none;
110
70
  /**
111
- * Returns a function that takes a value of type T, and returns true if the value matches any of the
112
- * given `matches` array of Match instances.
113
- * @typeparam T - the type of the object to match
114
- * @typeparam T2 - the type to use for the Match, should be equal to T
115
- * @param matches - at least one Match instance to perform on a given `value`
71
+ * Returns a matcher that returns true if exactly one of given `matchItem` matches the given value.
72
+ * @typeparam T - the type of value to match
73
+ * @typeparam R - the root object type
74
+ * @typeparam Q - a utility type for the matcher
75
+ * @param matchItems - the match specifications to test
116
76
  * @example
117
77
  * ```ts
118
- * type Person = { name: string, age: number }
119
- * const m = Match.createAny<Person>({ age: v => v > 20 }, { name: v => v.length > 2 })
120
- *
121
- * console.log(m({ name: 'abc', age: 10 }))
122
- * // => true
123
- * console.log(m({ name: 'abc', age: 20 }))
124
- * // => true
125
- * console.log(m({ name: 'a', age: 20 }))
126
- * // => true
127
- * console.log(m({ name: 'a', age: 10 }))
128
- * // => false
78
+ * const input = { a: 1, b: { c: true, d: 'a' } }
79
+ * match(input, Match.single({ a: 1, { c: true } } )) // => false
80
+ * match(input, Match.single({ a: 1, { c: false } } )) // => true
129
81
  * ```
130
82
  */
131
- function createAny() {
132
- var matches = [];
83
+ function single() {
84
+ var matchItems = [];
133
85
  for (var _i = 0; _i < arguments.length; _i++) {
134
- matches[_i] = arguments[_i];
86
+ matchItems[_i] = arguments[_i];
135
87
  }
136
- return function (value) { return Match.any(value).apply(void 0, tslib_1.__spreadArray([], tslib_1.__read(matches), false)); };
88
+ return new Single(matchItems);
137
89
  }
138
- Match.createAny = createAny;
90
+ Match.single = single;
139
91
  })(Match = exports.Match || (exports.Match = {}));
140
- function matchSingle(value, matcher, parent, root) {
141
- if (typeof matcher === 'function') {
142
- return matcher(value, parent, root);
92
+ var Every = /** @class */ (function () {
93
+ function Every(matchItems) {
94
+ this.matchItems = matchItems;
95
+ }
96
+ return Every;
97
+ }());
98
+ var Some = /** @class */ (function () {
99
+ function Some(matchItems) {
100
+ this.matchItems = matchItems;
101
+ }
102
+ return Some;
103
+ }());
104
+ var None = /** @class */ (function () {
105
+ function None(matchItems) {
106
+ this.matchItems = matchItems;
107
+ }
108
+ return None;
109
+ }());
110
+ var Single = /** @class */ (function () {
111
+ function Single(matchItems) {
112
+ this.matchItems = matchItems;
143
113
  }
144
- if (null === value || undefined === value || typeof value !== 'object') {
145
- if (typeof matcher !== 'object' || null === matcher) {
146
- return matcher === value;
114
+ return Single;
115
+ }());
116
+ /**
117
+ * Returns true if the given `value` object matches the given `matcher`, false otherwise.
118
+ * @typeparam T - the input value type
119
+ * @param value - the value to match (should be a plain object)
120
+ * @param matcher - a matcher object or a function taking the matcher API and returning a match object
121
+ * @example
122
+ * ```ts
123
+ * const input = { a: 1, b: { c: true, d: 'a' } }
124
+ * match(input, { a: 1 }) // => true
125
+ * match(input, { a: 2 }) // => false
126
+ * match(input, { a: v => v > 10 }) // => false
127
+ * match(input, { b: { c: true }}) // => true
128
+ * match(input, ({ every }) => every({ a: v => v > 0 }, { b: { c: true } } )) // => true
129
+ * match(input, { b: { c: (v, parent, root) => v && parent.d.length > 0 && root.a > 0 } })
130
+ * // => true
131
+ * ```
132
+ */
133
+ function match(value, matcher) {
134
+ if (matcher instanceof Function) {
135
+ return matchOptions(value, value, matcher(Match));
136
+ }
137
+ return matchOptions(value, value, matcher);
138
+ }
139
+ exports.match = match;
140
+ function matchOptions(value, root, matcher) {
141
+ if (matcher instanceof Every) {
142
+ var i = -1;
143
+ var matchItems = matcher.matchItems;
144
+ var len = matchItems.length;
145
+ while (++i < len) {
146
+ if (!matchOptions(value, root, matchItems[i])) {
147
+ return false;
148
+ }
147
149
  }
148
- if (internal_1.Literal.isLiteral(matcher)) {
149
- return internal_1.Literal.getValue(matcher) === value;
150
+ return true;
151
+ }
152
+ if (matcher instanceof Some) {
153
+ var i = -1;
154
+ var matchItems = matcher.matchItems;
155
+ var len = matchItems.length;
156
+ while (++i < len) {
157
+ if (matchOptions(value, root, matchItems[i])) {
158
+ return true;
159
+ }
150
160
  }
151
- return matcher === value;
161
+ return false;
152
162
  }
153
- if (Array.isArray(matcher)) {
154
- base_1.RimbuError.throwInvalidUsageError('Do not use arrays directly in match object, but use Literal.of(array) instead due to type limittions.');
163
+ if (matcher instanceof None) {
164
+ var i = -1;
165
+ var matchItems = matcher.matchItems;
166
+ var len = matchItems.length;
167
+ while (++i < len) {
168
+ if (matchOptions(value, root, matchItems[i])) {
169
+ return false;
170
+ }
171
+ }
172
+ return true;
155
173
  }
156
- if (typeof matcher !== 'object')
157
- base_1.RimbuError.throwInvalidStateError();
158
- if (null === matcher)
159
- return false;
160
- if (internal_1.Literal.isLiteral(matcher)) {
161
- return internal_1.Literal.getValue(matcher) === value;
174
+ if (matcher instanceof Single) {
175
+ var i = -1;
176
+ var matchItems = matcher.matchItems;
177
+ var len = matchItems.length;
178
+ var matched = false;
179
+ while (++i < len) {
180
+ if (matchOptions(value, root, matchItems[i])) {
181
+ if (matched) {
182
+ return false;
183
+ }
184
+ matched = true;
185
+ }
186
+ }
187
+ return matched;
188
+ }
189
+ if ((0, base_1.isPlainObj)(matcher)) {
190
+ return matchRecord(value, root, matcher);
162
191
  }
163
- var valueIsArray = Array.isArray(value);
164
- // check if plain object
165
- if (!valueIsArray && !internal_1.Literal.isPlainObject(value)) {
166
- return matcher === value;
192
+ return Object.is(value, matcher);
193
+ }
194
+ function matchRecord(value, root, matcher) {
195
+ if (!(0, base_1.isPlainObj)(matcher)) {
196
+ base_1.RimbuError.throwInvalidUsageError('match: to prevent accidental errors, match only supports plain objects as input.');
167
197
  }
168
198
  for (var key in matcher) {
169
199
  if (!(key in value))
170
200
  return false;
171
- var matchKey = matcher[key];
172
- if (undefined === matchKey) {
173
- base_1.RimbuError.throwInvalidUsageError('Do not use undefined directly in match objects, but use Literal.of(undefined) instead due to type limitations.');
201
+ var matchValue = matcher[key];
202
+ var target = value[key];
203
+ if (matchValue instanceof Function) {
204
+ if (target instanceof Function && Object.is(target, matchValue)) {
205
+ return true;
206
+ }
207
+ var result = matchValue(target, value, root);
208
+ if (typeof result === 'boolean') {
209
+ if (result) {
210
+ continue;
211
+ }
212
+ return false;
213
+ }
214
+ if (!matchRecordItem(target, root, result)) {
215
+ return false;
216
+ }
217
+ }
218
+ else {
219
+ if (!matchRecordItem(target, root, matchValue)) {
220
+ return false;
221
+ }
174
222
  }
175
- var result = matchSingle(value[key], matchKey, value, root);
176
- if (!result)
177
- return false;
178
223
  }
179
224
  return true;
180
225
  }
226
+ function matchRecordItem(value, root, matcher) {
227
+ if ((0, base_1.isIterable)(matcher) && (0, base_1.isIterable)(value)) {
228
+ var it1 = value[Symbol.iterator]();
229
+ var it2 = matcher[Symbol.iterator]();
230
+ while (true) {
231
+ var v1 = it1.next();
232
+ var v2 = it2.next();
233
+ if (v1.done !== v2.done || v1.value !== v2.value) {
234
+ return false;
235
+ }
236
+ if (v1.done) {
237
+ return true;
238
+ }
239
+ }
240
+ }
241
+ if ((0, base_1.isPlainObj)(value)) {
242
+ return matchOptions(value, root, matcher);
243
+ }
244
+ return Object.is(value, matcher);
245
+ }
181
246
  //# sourceMappingURL=match.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"match.js","sourceRoot":"","sources":["../../src/match.ts"],"names":[],"mappings":";;;;AAAA,oCAAyC;AAEzC,uCAAgD;AAgBhD,IAAiB,KAAK,CAgJrB;AAhJD,WAAiB,KAAK;IA+CpB;;;;;;;;;;OAUG;IACH,SAAgB,GAAG,CAAI,KAAQ;QAC7B,OAAO;;YAAC,kBAAW;iBAAX,UAAW,EAAX,qBAAW,EAAX,IAAW;gBAAX,6BAAW;;;gBACjB,KAAsB,IAAA,aAAA,iBAAA,QAAQ,CAAA,kCAAA,wDAAE;oBAA3B,IAAM,OAAO,qBAAA;oBAChB,IAAI,CAAC,WAAW,CAAgB,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE;wBAC7D,OAAO,KAAK,CAAC;qBACd;iBACF;;;;;;;;;YAED,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;IACJ,CAAC;IAVe,SAAG,MAUlB,CAAA;IAED;;;;;;;;;;OAUG;IACH,SAAgB,GAAG,CAAI,KAAQ;QAC7B,OAAO;;YAAC,kBAAW;iBAAX,UAAW,EAAX,qBAAW,EAAX,IAAW;gBAAX,6BAAW;;;gBACjB,KAAsB,IAAA,aAAA,iBAAA,QAAQ,CAAA,kCAAA,wDAAE;oBAA3B,IAAM,OAAO,qBAAA;oBAChB,IAAI,WAAW,CAAgB,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE;wBAC5D,OAAO,IAAI,CAAC;qBACb;iBACF;;;;;;;;;YAED,OAAO,KAAK,CAAC;QACf,CAAC,CAAC;IACJ,CAAC;I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