@thi.ng/rle-pack 2.1.42 → 3.0.2

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/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [2.1.42](https://github.com/thi-ng/umbrella/compare/@thi.ng/rle-pack@2.1.41...@thi.ng/rle-pack@2.1.42) (2021-08-08)
6
+ ## [3.0.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/rle-pack@3.0.1...@thi.ng/rle-pack@3.0.2) (2021-10-15)
7
7
 
8
8
  **Note:** Version bump only for package @thi.ng/rle-pack
9
9
 
@@ -11,7 +11,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
11
11
 
12
12
 
13
13
 
14
- ## [2.1.41](https://github.com/thi-ng/umbrella/compare/@thi.ng/rle-pack@2.1.40...@thi.ng/rle-pack@2.1.41) (2021-08-08)
14
+ ## [3.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/rle-pack@3.0.0...@thi.ng/rle-pack@3.0.1) (2021-10-13)
15
15
 
16
16
  **Note:** Version bump only for package @thi.ng/rle-pack
17
17
 
@@ -19,58 +19,65 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
19
19
 
20
20
 
21
21
 
22
- ## [2.1.40](https://github.com/thi-ng/umbrella/compare/@thi.ng/rle-pack@2.1.39...@thi.ng/rle-pack@2.1.40) (2021-07-01)
22
+ # [3.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rle-pack@2.1.43...@thi.ng/rle-pack@3.0.0) (2021-10-12)
23
23
 
24
- **Note:** Version bump only for package @thi.ng/rle-pack
25
24
 
25
+ ### Build System
26
26
 
27
+ * major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea9fab2a645d6c5f2bf2591459b939c09b6))
27
28
 
28
29
 
30
+ ### BREAKING CHANGES
29
31
 
30
- ## [2.1.39](https://github.com/thi-ng/umbrella/compare/@thi.ng/rle-pack@2.1.38...@thi.ng/rle-pack@2.1.39) (2021-06-08)
32
+ * discontinue CommonJS & UMD versions
31
33
 
32
- **Note:** Version bump only for package @thi.ng/rle-pack
34
+ - only ESM modules will be published from now on
35
+ - CJS obsolete due to ESM support in recent versions of node:
36
+ - i.e. launch NodeJS via:
37
+ - `node --experimental-specifier-resolution=node --experimental-repl-await`
38
+ - in the node REPL use `await import(...)` instead of `require()`
39
+ - UMD obsolete due to widespread browser support for ESM
33
40
 
41
+ Also:
42
+ - normalize/restructure/reorg all package.json files
43
+ - cleanup all build scripts, remove obsolete
44
+ - switch from mocha to @thi.ng/testament for all tests
34
45
 
35
46
 
36
47
 
37
48
 
38
- # [2.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rle-pack@2.0.6...@thi.ng/rle-pack@2.1.0) (2019-07-07)
39
49
 
40
- ### Features
41
50
 
42
- * **rle-pack:** enable TS strict compiler flags (refactor) ([17c426b](https://github.com/thi-ng/umbrella/commit/17c426b))
51
+ # [2.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rle-pack@2.0.6...@thi.ng/rle-pack@2.1.0) (2019-07-07)
43
52
 
44
- # [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rle-pack@1.0.8...@thi.ng/rle-pack@2.0.0) (2019-01-21)
53
+ ### Features
45
54
 
46
- ### Build System
55
+ - **rle-pack:** enable TS strict compiler flags (refactor) ([17c426b](https://github.com/thi-ng/umbrella/commit/17c426b))
47
56
 
48
- * update package build scripts & outputs, imports in ~50 packages ([b54b703](https://github.com/thi-ng/umbrella/commit/b54b703))
57
+ # [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rle-pack@1.0.8...@thi.ng/rle-pack@2.0.0) (2019-01-21)
49
58
 
50
- ### BREAKING CHANGES
59
+ ### Build System
51
60
 
52
- * enabled multi-outputs (ES6 modules, CJS, UMD)
61
+ - update package build scripts & outputs, imports in ~50 packages ([b54b703](https://github.com/thi-ng/umbrella/commit/b54b703))
53
62
 
54
- - build scripts now first build ES6 modules in package root, then call
55
- `scripts/bundle-module` to build minified CJS & UMD bundles in `/lib`
56
- - all imports MUST be updated to only refer to package level
57
- (not individual files anymore). tree shaking in user land will get rid of
58
- all unused imported symbols.
63
+ ### BREAKING CHANGES
59
64
 
60
- <a name="1.0.0"></a>
61
- # [1.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rle-pack@0.2.24...@thi.ng/rle-pack@1.0.0) (2018-08-24)
65
+ - enabled multi-outputs (ES6 modules, CJS, UMD)
66
+ - build scripts now first build ES6 modules in package root, then call `scripts/bundle-module` to build minified CJS & UMD bundles in `/lib`
67
+ - all imports MUST be updated to only refer to package level (not individual files anymore). tree shaking in user land will get rid of all unused imported symbols.
62
68
 
63
- ### Bug Fixes
69
+ # [1.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rle-pack@0.2.24...@thi.ng/rle-pack@1.0.0) (2018-08-24)
64
70
 
65
- * **rle-pack:** fix initial repeat counts in encodeBytes(), update readme ([8565edb](https://github.com/thi-ng/umbrella/commit/8565edb))
71
+ ### Bug Fixes
66
72
 
67
- ### Features
73
+ - **rle-pack:** fix initial repeat counts in encodeBytes(), update readme ([8565edb](https://github.com/thi-ng/umbrella/commit/8565edb))
68
74
 
69
- * **rle-pack:** add support for custom input word sizes ([fd8e761](https://github.com/thi-ng/umbrella/commit/fd8e761))
70
- * **rle-pack:** further update data format (non-repeats) ([4041521](https://github.com/thi-ng/umbrella/commit/4041521))
71
- * **rle-pack:** update data format, custom repeat sizes, rename fns ([694a253](https://github.com/thi-ng/umbrella/commit/694a253))
75
+ ### Features
72
76
 
73
- ### BREAKING CHANGES
77
+ - **rle-pack:** add support for custom input word sizes ([fd8e761](https://github.com/thi-ng/umbrella/commit/fd8e761))
78
+ - **rle-pack:** further update data format (non-repeats) ([4041521](https://github.com/thi-ng/umbrella/commit/4041521))
79
+ - **rle-pack:** update data format, custom repeat sizes, rename fns ([694a253](https://github.com/thi-ng/umbrella/commit/694a253))
80
+
81
+ ### BREAKING CHANGES
74
82
 
75
- * **rle-pack:** new API and encoding format, see readme
76
- for details
83
+ - **rle-pack:** new API and encoding format, see readme for details
package/README.md CHANGED
@@ -57,6 +57,7 @@ Then per value:
57
57
 
58
58
  ### Related packages
59
59
 
60
+ - [@thi.ng/binary](https://github.com/thi-ng/umbrella/tree/develop/packages/binary) - 100+ assorted binary / bitwise operations, conversions, utilities, lookup tables
60
61
  - [@thi.ng/bitstream](https://github.com/thi-ng/umbrella/tree/develop/packages/bitstream) - ES6 iterator based read/write bit streams with support for variable word widths
61
62
  - [@thi.ng/range-coder](https://github.com/thi-ng/umbrella/tree/develop/packages/range-coder) - Binary data range encoder / decoder
62
63
 
@@ -66,15 +67,24 @@ Then per value:
66
67
  yarn add @thi.ng/rle-pack
67
68
  ```
68
69
 
70
+ ES module import:
71
+
69
72
  ```html
70
- // ES module
71
- <script type="module" src="https://unpkg.com/@thi.ng/rle-pack?module" crossorigin></script>
73
+ <script type="module" src="https://cdn.skypack.dev/@thi.ng/rle-pack"></script>
74
+ ```
75
+
76
+ [Skypack documentation](https://docs.skypack.dev/)
77
+
78
+ For Node.js REPL:
79
+
80
+ ```text
81
+ # with flag only for < v16
82
+ node --experimental-repl-await
72
83
 
73
- // UMD
74
- <script src="https://unpkg.com/@thi.ng/rle-pack/lib/index.umd.js" crossorigin></script>
84
+ > const rlePack = await import("@thi.ng/rle-pack");
75
85
  ```
76
86
 
77
- Package sizes (gzipped, pre-treeshake): ESM: 676 bytes / CJS: 730 bytes / UMD: 839 bytes
87
+ Package sizes (gzipped, pre-treeshake): ESM: 696 bytes
78
88
 
79
89
  ## Dependencies
80
90
 
package/index.js CHANGED
@@ -1,5 +1,6 @@
1
- import { BitInputStream, BitOutputStream } from "@thi.ng/bitstream";
2
- import { illegalArgs } from "@thi.ng/errors";
1
+ import { BitInputStream } from "@thi.ng/bitstream/input";
2
+ import { BitOutputStream } from "@thi.ng/bitstream/output";
3
+ import { illegalArgs } from "@thi.ng/errors/illegal-arguments";
3
4
  /**
4
5
  * Compresses input using dynamically sized RLE compression and returns
5
6
  * result as `Uint8Array`.
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@thi.ng/rle-pack",
3
- "version": "2.1.42",
3
+ "version": "3.0.2",
4
4
  "description": "Binary run-length encoding packer w/ flexible repeat bit widths",
5
+ "type": "module",
5
6
  "module": "./index.js",
6
- "main": "./lib/index.js",
7
- "umd:main": "./lib/index.umd.js",
8
7
  "typings": "./index.d.ts",
8
+ "sideEffects": false,
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "https://github.com/thi-ng/umbrella.git"
@@ -24,28 +24,22 @@
24
24
  "author": "Karsten Schmidt <k+npm@thi.ng>",
25
25
  "license": "Apache-2.0",
26
26
  "scripts": {
27
- "build": "yarn clean && yarn build:es6 && node ../../scripts/bundle-module",
28
- "build:release": "yarn clean && yarn build:es6 && node ../../scripts/bundle-module all",
29
- "build:es6": "tsc --declaration",
30
- "build:test": "rimraf build && tsc -p test/tsconfig.json",
31
- "build:check": "tsc --isolatedModules --noEmit",
32
- "test": "mocha test",
33
- "cover": "nyc mocha test && nyc report --reporter=lcov",
34
- "clean": "rimraf *.js *.d.ts *.map .nyc_output build coverage doc lib",
35
- "doc:readme": "ts-node -P ../../tools/tsconfig.json ../../tools/src/readme.ts",
36
- "doc": "typedoc --excludePrivate --out doc --theme ../../tools/doc/typedoc-theme src/index.ts",
27
+ "build": "yarn clean && tsc --declaration",
28
+ "clean": "rimraf *.js *.d.ts *.map doc",
29
+ "doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
37
30
  "doc:ae": "mkdir -p .ae/doc .ae/temp && node_modules/.bin/api-extractor run --local --verbose",
38
- "pub": "yarn build:release && yarn publish --access public"
31
+ "doc:readme": "yarn doc:stats && ../../scripts/node-esm ../../tools/src/readme.ts",
32
+ "doc:stats": "../../scripts/node-esm ../../tools/src/module-stats.ts",
33
+ "pub": "yarn build && yarn publish --access public",
34
+ "test": "testament test"
39
35
  },
40
36
  "dependencies": {
41
- "@thi.ng/bitstream": "^1.1.42",
42
- "@thi.ng/errors": "^1.3.4"
37
+ "@thi.ng/bitstream": "^2.0.2",
38
+ "@thi.ng/errors": "^2.0.2"
39
+ },
40
+ "devDependencies": {
41
+ "@thi.ng/testament": "^0.1.2"
43
42
  },
44
- "files": [
45
- "*.js",
46
- "*.d.ts",
47
- "lib"
48
- ],
49
43
  "keywords": [
50
44
  "array",
51
45
  "binary",
@@ -59,13 +53,25 @@
59
53
  "publishConfig": {
60
54
  "access": "public"
61
55
  },
62
- "sideEffects": false,
56
+ "engines": {
57
+ "node": ">=12.7"
58
+ },
59
+ "files": [
60
+ "*.js",
61
+ "*.d.ts"
62
+ ],
63
+ "exports": {
64
+ ".": {
65
+ "import": "./index.js"
66
+ }
67
+ },
63
68
  "thi.ng": {
64
69
  "related": [
70
+ "binary",
65
71
  "bitstream",
66
72
  "range-coder"
67
73
  ],
68
74
  "year": 2017
69
75
  },
70
- "gitHead": "538019e9d8ca6c5fee4754af93ad454c0674dc72"
76
+ "gitHead": "3c5f903104da150588946a94bb118ad559ad395d"
71
77
  }
package/lib/index.js DELETED
@@ -1,109 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var bitstream = require('@thi.ng/bitstream');
6
- var errors = require('@thi.ng/errors');
7
-
8
- const encode = (src, num, wordSize = 8, rleSizes = [3, 4, 8, 16]) => {
9
- (wordSize < 1 || wordSize > 32) &&
10
- errors.illegalArgs("word size (1-32 bits only)");
11
- const out = new bitstream.BitOutputStream(Math.ceil((num * wordSize) / 8) + 4 + 2 + 1)
12
- .write(num, 32)
13
- .write(wordSize - 1, 5);
14
- rleSizes.forEach((x) => {
15
- (x < 1 || x > 16) && errors.illegalArgs("RLE repeat size (1-16 bits only)");
16
- out.write(x - 1, 4);
17
- });
18
- const [rle0, rle1, rle2, rle3] = rleSizes.map((x) => 1 << x);
19
- const chunk = [];
20
- const n1 = num - 1;
21
- let val;
22
- let tail = true;
23
- let n = 0;
24
- let i = 0;
25
- const writeRLE = () => {
26
- const t = n < rle0 ? 0 : n < rle1 ? 1 : n < rle2 ? 2 : 3;
27
- out.writeBit(1);
28
- out.write(t, 2);
29
- out.write(n, rleSizes[t]);
30
- out.write(val, wordSize);
31
- n = 0;
32
- };
33
- const writeChunk = () => {
34
- const m = chunk.length - 1;
35
- const t = m < rle0 ? 0 : m < rle1 ? 1 : m < rle2 ? 2 : 3;
36
- out.writeBit(0);
37
- out.write(t, 2);
38
- out.write(m, rleSizes[t]);
39
- out.writeWords(chunk, wordSize);
40
- chunk.length = 0;
41
- };
42
- for (let x of src) {
43
- if (val === undefined) {
44
- val = x;
45
- }
46
- else if (x !== val) {
47
- if (n > 0) {
48
- writeRLE();
49
- }
50
- else {
51
- chunk.push(val);
52
- if (chunk.length === rle3) {
53
- writeChunk();
54
- }
55
- }
56
- val = x;
57
- }
58
- else {
59
- if (chunk.length) {
60
- writeChunk();
61
- }
62
- if (++n === rle3) {
63
- n--;
64
- writeRLE();
65
- tail = i < n1;
66
- }
67
- }
68
- if (i === n1) {
69
- break;
70
- }
71
- i++;
72
- }
73
- if (chunk.length) {
74
- chunk.push(val);
75
- writeChunk();
76
- }
77
- else if (tail) {
78
- writeRLE();
79
- }
80
- return out.bytes();
81
- };
82
- const decode = (src) => {
83
- const input = new bitstream.BitInputStream(src);
84
- const num = input.read(32);
85
- const wordSize = input.read(5) + 1;
86
- const rleSizes = [0, 0, 0, 0].map(() => input.read(4) + 1);
87
- const out = arrayForWordSize(wordSize, num);
88
- let x, j;
89
- for (let i = 0; i < num;) {
90
- x = input.readBit();
91
- j = i + 1 + input.read(rleSizes[input.read(2)]);
92
- if (x) {
93
- out.fill(input.read(wordSize), i, j);
94
- i = j;
95
- }
96
- else {
97
- for (; i < j; i++) {
98
- out[i] = input.read(wordSize);
99
- }
100
- }
101
- }
102
- return out;
103
- };
104
- const arrayForWordSize = (ws, n) => {
105
- return new (ws < 9 ? Uint8Array : ws < 17 ? Uint16Array : Uint32Array)(n);
106
- };
107
-
108
- exports.decode = decode;
109
- exports.encode = encode;
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../index.js"],"sourcesContent":null,"names":["illegalArgs","BitOutputStream","BitInputStream"],"mappings":";;;;;;;AAWY,MAAC,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK;AAC5E,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,QAAQ,GAAG,EAAE;AAClC,QAAQA,kBAAW,CAAC,4BAA4B,CAAC,CAAC;AAClD,IAAI,MAAM,GAAG,GAAG,IAAIC,yBAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,QAAQ,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAChF,SAAS,KAAK,CAAC,GAAG,EAAE,EAAE,CAAC;AACvB,SAAS,KAAK,CAAC,QAAQ,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;AAChC,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK;AAC5B,QAAQ,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,KAAKD,kBAAW,CAAC,kCAAkC,CAAC,CAAC;AAC7E,QAAQ,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5B,KAAK,CAAC,CAAC;AACP,IAAI,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,CAA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AgB,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC9C,aAAa;AACb,SAAS;AACT,KAAK;AACL,IAAI,OAAO,GAAG,CAAC;AACf,EAAE;AACF,MAAM,gBAAgB,GAAG,CAAC,EAAE,EAAE,CAAC,KAAK;AACpC,IAAI,OAAO,KAAK,EAAE,GAAG,CAAC,GAAG,UAAU,GAAG,EAAE,GAAG,EAAE,GAAG,WAAW,GAAG,WAAW,EAAE,CAAC,CAAC,CAAC;AAC9E,CAAC;;;;;"}
package/lib/index.umd.js DELETED
@@ -1 +0,0 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@thi.ng/bitstream"),require("@thi.ng/errors")):"function"==typeof define&&define.amd?define(["exports","@thi.ng/bitstream","@thi.ng/errors"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).thi=e.thi||{},e.thi.ng=e.thi.ng||{},e.thi.ng.rlePack={}),e.thi.ng.bitstream,e.thi.ng.errors)}(this,(function(e,t,r){"use strict";const i=(e,t)=>new(e<9?Uint8Array:e<17?Uint16Array:Uint32Array)(t);e.decode=e=>{const r=new t.BitInputStream(e),n=r.read(32),o=r.read(5)+1,s=[0,0,0,0].map((()=>r.read(4)+1)),l=i(o,n);let a,d;for(let e=0;e<n;)if(a=r.readBit(),d=e+1+r.read(s[r.read(2)]),a)l.fill(r.read(o),e,d),e=d;else for(;e<d;e++)l[e]=r.read(o);return l},e.encode=(e,i,n=8,o=[3,4,8,16])=>{(n<1||n>32)&&r.illegalArgs("word size (1-32 bits only)");const s=new t.BitOutputStream(Math.ceil(i*n/8)+4+2+1).write(i,32).write(n-1,5);o.forEach((e=>{(e<1||e>16)&&r.illegalArgs("RLE repeat size (1-16 bits only)"),s.write(e-1,4)}));const[l,a,d,h]=o.map((e=>1<<e)),f=[],g=i-1;let c,u=!0,p=0,w=0;const b=()=>{const e=p<l?0:p<a?1:p<d?2:3;s.writeBit(1),s.write(e,2),s.write(p,o[e]),s.write(c,n),p=0},y=()=>{const e=f.length-1,t=e<l?0:e<a?1:e<d?2:3;s.writeBit(0),s.write(t,2),s.write(e,o[t]),s.writeWords(f,n),f.length=0};for(let t of e){if(void 0===c?c=t:t!==c?(p>0?b():(f.push(c),f.length===h&&y()),c=t):(f.length&&y(),++p===h&&(p--,b(),u=w<g)),w===g)break;w++}return f.length?(f.push(c),y()):u&&b(),s.bytes()},Object.defineProperty(e,"__esModule",{value:!0})}));
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.umd.js","sources":["../index.js"],"sourcesContent":null,"names":["illegalArgs","BitOutputStream","BitInputStream"],"mappings":";;;;;;AAWY,UAAC,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK;IAC5E,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,QAAQ,GAAG,EAAE;IAClC,QAAQA,kBAAW,CAAC,4BAA4B,CAAC,CAAC;IAClD,IAAI,MAAM,GAAG,GAAG,IAAIC,yBAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,QAAQ,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChF,SAAS,KAAK,CAAC,GAAG,EAAE,EAAE,CAAC;IACvB,SAAS,KAAK,CAAC,QAAQ,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IAChC,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK;IAC5B,QAAQ,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,KAAKD,kBAAW,CAAC,kCAAkC,CAAC,CAAC;IAC7E,QAAQ,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5B,KAAK,CAAC,CAAC;IACP,IAAI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