@nejs/basic-extensions 2.4.0 → 2.6.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 (37) hide show
  1. package/README.md +151 -118
  2. package/dist/@nejs/basic-extensions.bundle.2.5.0.js +8 -0
  3. package/dist/@nejs/basic-extensions.bundle.2.5.0.js.map +7 -0
  4. package/dist/cjs/arrayextensions.js +56 -54
  5. package/dist/cjs/arrayextensions.js.map +1 -1
  6. package/dist/cjs/functionextensions.js +81 -79
  7. package/dist/cjs/functionextensions.js.map +1 -1
  8. package/dist/cjs/mapextensions.js +23 -21
  9. package/dist/cjs/mapextensions.js.map +1 -1
  10. package/dist/cjs/objectextensions.js +49 -17
  11. package/dist/cjs/objectextensions.js.map +1 -1
  12. package/dist/cjs/setextensions.js +191 -189
  13. package/dist/cjs/setextensions.js.map +1 -1
  14. package/dist/cjs/stringextensions.js +69 -67
  15. package/dist/cjs/stringextensions.js.map +1 -1
  16. package/dist/mjs/arrayextensions.js +56 -54
  17. package/dist/mjs/arrayextensions.js.map +1 -1
  18. package/dist/mjs/functionextensions.js +81 -79
  19. package/dist/mjs/functionextensions.js.map +1 -1
  20. package/dist/mjs/mapextensions.js +23 -21
  21. package/dist/mjs/mapextensions.js.map +1 -1
  22. package/dist/mjs/objectextensions.js +49 -17
  23. package/dist/mjs/objectextensions.js.map +1 -1
  24. package/dist/mjs/setextensions.js +191 -189
  25. package/dist/mjs/setextensions.js.map +1 -1
  26. package/dist/mjs/stringextensions.js +69 -67
  27. package/dist/mjs/stringextensions.js.map +1 -1
  28. package/docs/index.html +636 -478
  29. package/package.json +5 -4
  30. package/src/arrayextensions.js +56 -55
  31. package/src/functionextensions.js +87 -85
  32. package/src/mapextensions.js +26 -24
  33. package/src/objectextensions.js +52 -17
  34. package/src/setextensions.js +216 -214
  35. package/src/stringextensions.js +69 -67
  36. package/dist/@nejs/basic-extensions.bundle.2.3.0.js +0 -8
  37. package/dist/@nejs/basic-extensions.bundle.2.3.0.js.map +0 -7
@@ -11,61 +11,63 @@ const extension_1 = require("@nejs/extension");
11
11
  * operations on arrays and makes code more expressive and concise.
12
12
  */
13
13
  exports.ArrayPrototypeExtensions = new extension_1.Patch(Array.prototype, {
14
- /**
15
- * Sometimes defining even a short function for the invocation of `find`
16
- * can be troublesome. This helper function performs that job for you. If
17
- * the specified element is in the array, `true` will be returned.
18
- *
19
- * @param {*} value the value to search for. This value must triple equals
20
- * the array element in order to return true.
21
- * @returns true if the exact element exists in the array, false otherwise
22
- */
23
- contains(value) {
24
- return !!this.find(entry => entry === value);
25
- },
26
- /**
27
- * The `findEntry` function searches the entries of the object and returns
28
- * the `[index, value]` entry array for the first matching value found.
29
- *
30
- * @param {function} findFn a function that takes the element to be checked
31
- * and returns a boolean value
32
- * @returns if `findFn` returns `true`, an array with two elements, the first
33
- * being the index, the second being the value, is returned.
34
- */
35
- findEntry(findFn) {
36
- const entries = this.entries();
37
- const VALUE = 1;
38
- for (let entry of entries) {
39
- if (findFn(entry[VALUE])) {
40
- return entry;
14
+ [extension_1.Patch.kMutablyHidden]: {
15
+ /**
16
+ * Sometimes defining even a short function for the invocation of `find`
17
+ * can be troublesome. This helper function performs that job for you. If
18
+ * the specified element is in the array, `true` will be returned.
19
+ *
20
+ * @param {*} value the value to search for. This value must triple equals
21
+ * the array element in order to return true.
22
+ * @returns true if the exact element exists in the array, false otherwise
23
+ */
24
+ contains(value) {
25
+ return !!this.find(entry => entry === value);
26
+ },
27
+ /**
28
+ * The `findEntry` function searches the entries of the object and returns
29
+ * the `[index, value]` entry array for the first matching value found.
30
+ *
31
+ * @param {function} findFn a function that takes the element to be checked
32
+ * and returns a boolean value
33
+ * @returns if `findFn` returns `true`, an array with two elements, the first
34
+ * being the index, the second being the value, is returned.
35
+ */
36
+ findEntry(findFn) {
37
+ const entries = this.entries();
38
+ const VALUE = 1;
39
+ for (let entry of entries) {
40
+ if (findFn(entry[VALUE])) {
41
+ return entry;
42
+ }
41
43
  }
42
- }
43
- return undefined;
44
- },
45
- /**
46
- * A getter property that returns the first element of the array. If the
47
- * array is empty, it returns `undefined`. This property is useful for
48
- * scenarios where you need to quickly access the first item of an array
49
- * without the need for additional checks or method calls.
50
- *
51
- * @returns {*} The first element of the array or `undefined` if the array
52
- * is empty.
53
- */
54
- get first() {
55
- return this[0];
56
- },
57
- /**
58
- * A getter property that returns the last element of the array. It
59
- * calculates the last index based on the array's length. If the array is
60
- * empty, it returns `undefined`. This property is beneficial when you need
61
- * to access the last item in an array, improving code readability and
62
- * avoiding manual index calculation.
63
- *
64
- * @returns {*} The last element of the array or `undefined` if the
65
- * array is empty.
66
- */
67
- get last() {
68
- return this[this.length - 1];
44
+ return undefined;
45
+ },
46
+ /**
47
+ * A getter property that returns the first element of the array. If the
48
+ * array is empty, it returns `undefined`. This property is useful for
49
+ * scenarios where you need to quickly access the first item of an array
50
+ * without the need for additional checks or method calls.
51
+ *
52
+ * @returns {*} The first element of the array or `undefined` if the array
53
+ * is empty.
54
+ */
55
+ get first() {
56
+ return this[0];
57
+ },
58
+ /**
59
+ * A getter property that returns the last element of the array. It
60
+ * calculates the last index based on the array's length. If the array is
61
+ * empty, it returns `undefined`. This property is beneficial when you need
62
+ * to access the last item in an array, improving code readability and
63
+ * avoiding manual index calculation.
64
+ *
65
+ * @returns {*} The last element of the array or `undefined` if the
66
+ * array is empty.
67
+ */
68
+ get last() {
69
+ return this[this.length - 1];
70
+ },
69
71
  },
70
72
  });
71
73
  //# sourceMappingURL=arrayextensions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"arrayextensions.js","sourceRoot":"","sources":["../../src/arrayextensions.js"],"names":[],"mappings":";;;AAAA,+CAAuC;AAEvC;;;;;;;GAOG;AACU,QAAA,wBAAwB,GAAG,IAAI,iBAAK,CAAC,KAAK,CAAC,SAAS,EAAE;IACjE;;;;;;;;OAQG;IACH,QAAQ,CAAC,KAAK;QACZ,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAA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AAC,EAAE,CAAC;oBACzB,OAAO,KAAK,CAAA;gBACd,CAAC;YACH,CAAC;YAED,OAAO,SAAS,CAAA;QAClB,CAAC;QAED;;;;;;;;WAQG;QACH,IAAI,KAAK;YACP,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;QAED;;;;;;;;;WASG;QACH,IAAI,IAAI;YACN,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC/B,CAAC;KACF;CACF,CAAC,CAAA"}
@@ -116,85 +116,87 @@ exports.FunctionExtensions = new extension_1.Patch(Function, {
116
116
  },
117
117
  });
118
118
  exports.FunctionPrototypeExtensions = new extension_1.Patch(Function.prototype, {
119
- /**
120
- * Determines if a given value is an asynchronous function. It checks if the
121
- * value is an instance of `Function` and if its string representation
122
- * includes the keyword 'Async'. This method is particularly useful for
123
- * identifying async functions.
124
- *
125
- * @returns {boolean} Returns `true` if the value is an async function,
126
- * otherwise `false`.
127
- */
128
- get isAsync() {
129
- return Function.isAsync(this);
130
- },
131
- /**
132
- * The function checks if a given value is an async generator function
133
- *
134
- * @returns {boolean} `true` if the value is an instance of a function and
135
- * its string tag is 'AsyncGeneratorFunction', otherwise it returns `false`.
136
- */
137
- get isAsyncGenerator() {
138
- return Function.isAsyncGenerator(this);
139
- },
140
- /**
141
- * Checks if a given value is an arrow function. It verifies if the value is
142
- * an instance of `Function`, if its string representation includes the '=>'
143
- * symbol, and if it lacks a prototype, which is a characteristic of arrow
144
- * functions in JavaScript.
145
- *
146
- * @returns {boolean} Returns `true` if the value is an arrow function,
147
- * otherwise `false`.
148
- */
149
- get isBigArrow() {
150
- return Function.isBigArrow(this);
151
- },
152
- /**
153
- * Determines if a given value is a bound function. Bound functions are
154
- * created using the `Function.prototype.bind` method, which allows setting
155
- * the `this` value at the time of binding. This method checks if the value
156
- * is an instance of `Function`, if its string representation starts with
157
- * 'bound', and if it lacks a `prototype` property. These characteristics
158
- * are indicative of bound functions in JavaScript.
159
- *
160
- * @returns {boolean} Returns `true` if the value is a bound function,
161
- * otherwise `false`. Bound functions have a specific format in their
162
- * string representation and do not have their own `prototype` property.
163
- */
164
- get isBound() {
165
- return Function.isBound(this);
166
- },
167
- /**
168
- * Determines if a given value is a class. It checks if the value is an
169
- * instance of `Function` and if its string representation includes the
170
- * keyword 'class'. This method is useful for distinguishing classes from
171
- * other function types in JavaScript.
172
- *
173
- * @returns {boolean} Returns `true` if the value is a class, otherwise
174
- * `false`.
175
- */
176
- get isClass() {
177
- return Function.isClass(this);
178
- },
179
- /**
180
- * Checks if a given value is a regular function. This method verifies if
181
- * the value is an instance of `Function`, which includes regular functions,
182
- * classes, and async functions but excludes arrow functions.
183
- *
184
- * @returns {boolean} Returns `true` if the value is a regular function,
185
- * otherwise `false`.
186
- */
187
- get isFunction() {
188
- return Function.isFunction(this);
189
- },
190
- /**
191
- * The function checks if a given value is a generator function
192
- *
193
- * @returns {boolean} `true` if the value is an instance of a function and
194
- * its string tag is 'GeneratorFunction', otherwise it returns `false`.
195
- */
196
- get isGenerator() {
197
- return Function.isGenerator(this);
119
+ [extension_1.Patch.kMutablyHidden]: {
120
+ /**
121
+ * Determines if a given value is an asynchronous function. It checks if the
122
+ * value is an instance of `Function` and if its string representation
123
+ * includes the keyword 'Async'. This method is particularly useful for
124
+ * identifying async functions.
125
+ *
126
+ * @returns {boolean} Returns `true` if the value is an async function,
127
+ * otherwise `false`.
128
+ */
129
+ get isAsync() {
130
+ return Function.isAsync(this);
131
+ },
132
+ /**
133
+ * The function checks if a given value is an async generator function
134
+ *
135
+ * @returns {boolean} `true` if the value is an instance of a function and
136
+ * its string tag is 'AsyncGeneratorFunction', otherwise it returns `false`.
137
+ */
138
+ get isAsyncGenerator() {
139
+ return Function.isAsyncGenerator(this);
140
+ },
141
+ /**
142
+ * Checks if a given value is an arrow function. It verifies if the value is
143
+ * an instance of `Function`, if its string representation includes the '=>'
144
+ * symbol, and if it lacks a prototype, which is a characteristic of arrow
145
+ * functions in JavaScript.
146
+ *
147
+ * @returns {boolean} Returns `true` if the value is an arrow function,
148
+ * otherwise `false`.
149
+ */
150
+ get isBigArrow() {
151
+ return Function.isBigArrow(this);
152
+ },
153
+ /**
154
+ * Determines if a given value is a bound function. Bound functions are
155
+ * created using the `Function.prototype.bind` method, which allows setting
156
+ * the `this` value at the time of binding. This method checks if the value
157
+ * is an instance of `Function`, if its string representation starts with
158
+ * 'bound', and if it lacks a `prototype` property. These characteristics
159
+ * are indicative of bound functions in JavaScript.
160
+ *
161
+ * @returns {boolean} Returns `true` if the value is a bound function,
162
+ * otherwise `false`. Bound functions have a specific format in their
163
+ * string representation and do not have their own `prototype` property.
164
+ */
165
+ get isBound() {
166
+ return Function.isBound(this);
167
+ },
168
+ /**
169
+ * Determines if a given value is a class. It checks if the value is an
170
+ * instance of `Function` and if its string representation includes the
171
+ * keyword 'class'. This method is useful for distinguishing classes from
172
+ * other function types in JavaScript.
173
+ *
174
+ * @returns {boolean} Returns `true` if the value is a class, otherwise
175
+ * `false`.
176
+ */
177
+ get isClass() {
178
+ return Function.isClass(this);
179
+ },
180
+ /**
181
+ * Checks if a given value is a regular function. This method verifies if
182
+ * the value is an instance of `Function`, which includes regular functions,
183
+ * classes, and async functions but excludes arrow functions.
184
+ *
185
+ * @returns {boolean} Returns `true` if the value is a regular function,
186
+ * otherwise `false`.
187
+ */
188
+ get isFunction() {
189
+ return Function.isFunction(this);
190
+ },
191
+ /**
192
+ * The function checks if a given value is a generator function
193
+ *
194
+ * @returns {boolean} `true` if the value is an instance of a function and
195
+ * its string tag is 'GeneratorFunction', otherwise it returns `false`.
196
+ */
197
+ get isGenerator() {
198
+ return Function.isGenerator(this);
199
+ },
198
200
  },
199
201
  });
200
202
  //# sourceMappingURL=functionextensions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"functionextensions.js","sourceRoot":"","sources":["../../src/functionextensions.js"],"names":[],"mappings":";;;AAAA,+CAAuC;AACvC,+DAAwD;AAExD,MAAM,EAAE,YA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O,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;QACnC,CAAC;KACF;CACF,CAAC,CAAA"}
@@ -3,28 +3,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MapPrototypeExtensions = void 0;
4
4
  const extension_1 = require("@nejs/extension");
5
5
  exports.MapPrototypeExtensions = new extension_1.Patch(Map.prototype, {
6
- /**
7
- * The function `getKey` returns the key associated with a given value
8
- * in a map.
9
- *
10
- * @param {any} value - The value parameter is the value that you want to
11
- * find the corresponding key for in the map.
12
- * @param [strict=true] - The "strict" parameter is a boolean value that
13
- * determines whether strict equality (===) or loose equality (==) should
14
- * be used when comparing the "value" parameter with the values in the
15
- * entries of the object. If "strict" is set to true, strict equality will
16
- * be used.
17
- * @returns the key associated with the given value. If a matching key is
18
- * found, it is returned. If no matching key is found, null is returned.
19
- */
20
- getKey(value, strict = true) {
21
- for (const [key, entryValue] of this) {
22
- if ((strict && value === entryValue) &&
23
- (!strict && value == entryValue)) {
24
- return key;
6
+ [extension_1.Patch.kMutablyHidden]: {
7
+ /**
8
+ * The function `getKey` returns the key associated with a given value
9
+ * in a map.
10
+ *
11
+ * @param {any} value - The value parameter is the value that you want to
12
+ * find the corresponding key for in the map.
13
+ * @param [strict=true] - The "strict" parameter is a boolean value that
14
+ * determines whether strict equality (===) or loose equality (==) should
15
+ * be used when comparing the "value" parameter with the values in the
16
+ * entries of the object. If "strict" is set to true, strict equality will
17
+ * be used.
18
+ * @returns the key associated with the given value. If a matching key is
19
+ * found, it is returned. If no matching key is found, null is returned.
20
+ */
21
+ getKey(value, strict = true) {
22
+ for (const [key, entryValue] of this) {
23
+ if ((strict && value === entryValue) &&
24
+ (!strict && value == entryValue)) {
25
+ return key;
26
+ }
27
+ return null;
25
28
  }
26
- return null;
27
- }
29
+ },
28
30
  },
29
31
  });
30
32
  //# sourceMappingURL=mapextensions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mapextensions.js","sourceRoot":"","sources":["../../src/mapextensions.js"],"names":[],"mappings":";;;AAAA,+CAAwC;AAE3B,QAAA,sBAAsB,GAAG,IAAI,iBAAK,CAAC,GAAG,CAAC,SAAS,EAAE;IAC7D;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;QACzB,KAAK,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC,IAAI,IAAI,EAAE,CAAC;YACrC,IACE,CAAC,MAAM,IAAI,KAAK,KAAK,UAAU,CAAC;gBAChC,CAAC,CAAC,MAAM,IAAI,KAAK,IAAI,UAAU,CAAC,EAChC,CAAC;gBACD,OAAO,GAAG,CAAA;YACZ,CAAC;YAED,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;CACF,CAAC,CAAA"}
1
+ {"version":3,"file":"mapextensions.js","sourceRoot":"","sources":["../../src/mapextensions.js"],"names":[],"mappings":";;;AAAA,+CAAwC;AAE3B,QAAA,sBAAsB,GAAG,IAAI,iBAAK,CAAC,GAAG,CAAC,SAAS,EAAE;IAC7D,CAAC,iBAAK,CAAC,cAAc,CAAC,EAAE;QACtB;;;;;;;;;;;;;WAaG;QACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;YACzB,KAAK,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC,IAAI,IAAI,EAAE,CAAC;gBACrC,IACE,CAAC,MAAM,IAAI,KAAK,KAAK,UAAU,CAAC;oBAChC,CAAC,CAAC,MAAM,IAAI,KAAK,IAAI,UAAU,CAAC,EAChC,CAAC;oBACD,OAAO,GAAG,CAAA;gBACZ,CAAC;gBAED,OAAO,IAAI,CAAA;YACb,CAAC;QACH,CAAC;KACF;CACF,CAAC,CAAA"}
@@ -178,23 +178,55 @@ exports.ObjectExtensions = new extension_1.Patch(Object, {
178
178
  return result;
179
179
  },
180
180
  });
181
+ const staticPatches = exports.ObjectExtensions.patches;
181
182
  exports.ObjectPrototypeExtensions = new extension_1.Patch(Object.prototype, {
182
- /**
183
- * Strips an object down to only the keys specified. Optionally, any
184
- * accessors can be made to retain their context on the source object.
185
- * This is a passthrough to the static {@link Object.stripTo} function
186
- *
187
- * @param {Array<string|symbol>} keys the keys that should appear in the
188
- * final reduced object
189
- * @param {boolean} [bindAccessors = true] if this value is true then any
190
- * accessors from the source object will continue to have their `this`
191
- * value bound to the source. If the getter or setter on that object is
192
- * defined using an arrow function, this will not work as intended.
193
- * @returns {object} an object containing only the keys and symbols
194
- * specified in the `keys` parameter.
195
- */
196
- stripTo(keys, bindAccessors = true) {
197
- return Object.stripTo(this, keys, bindAccessors);
198
- }
183
+ [extension_1.Patch.kMutablyHidden](store) {
184
+ return {
185
+ /**
186
+ * Checks to see if the supplied `value` is both an object, and has the
187
+ * appropriate symbol defined.
188
+ *
189
+ * @param {any} value the value to determine if it contains a defined
190
+ * `Symbol.toStringTag` defined.
191
+ * @returns true if the symbol is defined, false otherwise
192
+ */
193
+ get hasStringTag() {
194
+ return staticPatches.hasStringTag(this);
195
+ },
196
+ /**
197
+ * Retrieves the string tag of an object. The string tag is a representation
198
+ * of the object's type, as defined by its `Object.prototype.toString`
199
+ * method. This utility method is helpful for getting a more descriptive
200
+ * type of an object than what is returned by the `typeof` operator,
201
+ * especially for custom objects.
202
+ *
203
+ * @param {*} value - The object whose string tag is to be retrieved.
204
+ * @param {boolean} strict - if this is set to true, undefined will be
205
+ * returned whenever a supplied object does not have a
206
+ * `Symbol.toStringTag` defined, period. if false, the default,
207
+ * @returns {string} - The string tag of the object, indicating its type.
208
+ */
209
+ getStringTag(strict = false) {
210
+ return staticPatches.getStringTag(this, strict);
211
+ },
212
+ /**
213
+ * Strips an object down to only the keys specified. Optionally, any
214
+ * accessors can be made to retain their context on the source object.
215
+ * This is a passthrough to the static {@link Object.stripTo} function
216
+ *
217
+ * @param {Array<string|symbol>} keys the keys that should appear in the
218
+ * final reduced object
219
+ * @param {boolean} [bindAccessors = true] if this value is true then any
220
+ * accessors from the source object will continue to have their `this`
221
+ * value bound to the source. If the getter or setter on that object is
222
+ * defined using an arrow function, this will not work as intended.
223
+ * @returns {object} an object containing only the keys and symbols
224
+ * specified in the `keys` parameter.
225
+ */
226
+ stripTo(keys, bindAccessors = true) {
227
+ return Object.stripTo(this, keys, bindAccessors);
228
+ }
229
+ };
230
+ },
199
231
  });
200
232
  //# sourceMappingURL=objectextensions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"objectextensions.js","sourceRoot":"","sources":["../../src/objectextensions.js"],"names":[],"mappings":";;;AAAA,+CAAwC;AAExC;;;;;;;GAOG;AACU,QAAA,gBAAgB,GAAG,IAAI,iBAAK,CAAC,MAAM,EAAE;IAChD;;;;;;;OAOG;IACH,aAAa,CAAC,KAAK;QACjB,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAA;IAC9C,CAAC;IAED;;;;;;;OAOG;IACH,YAAY,CAAC,KAAK;QAChB,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,CAAA;IACzE,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK;QAChC,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/B,OAAO,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;QAClC,CAAC;QAED,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,SAAS,CAAA;QAClB,CAAC;QAED,IAAI,KAAK,IAAI,CAAC,OAAO,KAAK,KAAK,UAAU,CAAC,EAAE,CAAC;YAC3C,OAAO,KAAK,CAAC,IAAI,CAAA;QACnB,CAAC;QAED,OAAO,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;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