@idscan/idvc2 2.4.16 → 2.5.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 (56) hide show
  1. package/README.md +17 -0
  2. package/dist/css/idvc.css +1 -1
  3. package/dist/idvc.js +1684 -2
  4. package/dist/index.html +3 -5
  5. package/dist/js/defaultConfig.ts +0 -8
  6. package/dist/js/environment/langs.js +1 -1
  7. package/dist/js/environment/networkNames.json +5 -16
  8. package/dist/js/environment/realFaceModes.ts +9 -0
  9. package/dist/js/environment/stepsDescription.ts +2 -23
  10. package/dist/networks/156-9239-chunk.js +1 -0
  11. package/dist/networks/190-77ed-chunk.js +1 -0
  12. package/dist/networks/77-9e2f-chunk.js +1 -0
  13. package/dist/networks/Face-e375-chunk.js +1 -0
  14. package/dist/networks/MRZ-d498-chunk.js +1 -0
  15. package/dist/networks/PDF-78d2-chunk.js +1 -0
  16. package/dist/networks/ZXing-5410-chunk.js +1 -0
  17. package/dist/networks/angle03032023.onnx +0 -0
  18. package/dist/networks/classLocal03032023.onnx +0 -0
  19. package/dist/networks/faceDetection03032023.onnx +0 -0
  20. package/dist/networks/faceLandmark03032023.onnx +0 -0
  21. package/dist/networks/mrz03032023.onnx +0 -0
  22. package/dist/networks/ort-wasm-simd-threaded.wasm +0 -0
  23. package/dist/networks/ort-wasm-simd.wasm +0 -0
  24. package/dist/networks/ort-wasm-threaded.wasm +0 -0
  25. package/dist/networks/ort-wasm.wasm +0 -0
  26. package/package.json +25 -47
  27. package/dist/idvc.js.LICENSE.txt +0 -219
  28. package/dist/js/common.d.ts +0 -3
  29. package/dist/js/geometry.d.ts +0 -8
  30. package/dist/js/idvc.d.ts +0 -3
  31. package/dist/js/image.d.ts +0 -4
  32. package/dist/js/index.d.ts +0 -12
  33. package/dist/js/loop.d.ts +0 -21
  34. package/dist/js/mrz.d.ts +0 -105
  35. package/dist/networks/130-2dfe-chunk.js +0 -1
  36. package/dist/networks/215-a42b-chunk.js +0 -1
  37. package/dist/networks/400-2d7a-chunk.js +0 -1
  38. package/dist/networks/716-9029-chunk.js +0 -1
  39. package/dist/networks/Face-4ee6-chunk.js +0 -1
  40. package/dist/networks/MRZ-69fb-chunk.js +0 -1
  41. package/dist/networks/PDF-781c-chunk.js +0 -1
  42. package/dist/networks/ZXing-c882-chunk.js +0 -1
  43. package/dist/networks/angles20210831.bin +0 -0
  44. package/dist/networks/angles20210831.json +0 -1
  45. package/dist/networks/asyncLoader-35f7-chunk.js +0 -1
  46. package/dist/networks/cdnLoader-881d-chunk.js +0 -1
  47. package/dist/networks/classLocal20220112.bin +0 -0
  48. package/dist/networks/classLocal20220112.json +0 -1
  49. package/dist/networks/detectormodel20220817.bin +0 -0
  50. package/dist/networks/detectormodel20220817.json +0 -1
  51. package/dist/networks/facemesh20210831.bin +0 -0
  52. package/dist/networks/facemesh20210831.json +0 -1
  53. package/dist/networks/landmarkmodel20220817.bin +0 -0
  54. package/dist/networks/landmarkmodel20220817.json +0 -1
  55. package/dist/networks/mrz20220531.bin +0 -0
  56. package/dist/networks/mrz20220531.json +0 -1953
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@idscan/idvc2",
3
- "version": "2.4.16",
3
+ "version": "2.5.0",
4
4
  "description": "component for the capturing documents",
5
5
  "main": "dist/idvc.js",
6
+ "types": "dist/types/idvc.d.ts",
6
7
  "files": [
7
8
  "dist"
8
9
  ],
@@ -19,7 +20,6 @@
19
20
  "build:testing": "webpack --mode production --progress --color --env RUNTIME=webgl",
20
21
  "build:develop": "webpack --mode development --progress --color --env RUNTIME=webgl && npm run pack",
21
22
  "build:wasm": "webpack --mode production --progress --color --env RUNTIME=wasm",
22
- "build:cdn": "webpack --mode production --progress --color --config cdn.webpack.config.js",
23
23
  "rename": "node -e \"const fs=require('fs');fs.readdirSync('./').forEach(file=>{if(file.match(/^(idscan-idvc-).+(tgz)$/))fs.renameSync(file,'UITests/idscan-idvc.tgz')})\"",
24
24
  "build:wasm-rename": "webpack --mode production --progress --color --env RUNTIME=wasm && npm run pack && npm run rename",
25
25
  "pack": "npm pack",
@@ -30,74 +30,52 @@
30
30
  "readme": "node updateReadme.js"
31
31
  },
32
32
  "devDependencies": {
33
- "@babel/core": "^7.18.10",
34
- "@babel/eslint-parser": "^7.18.9",
35
- "@babel/plugin-proposal-class-properties": "^7.18.6",
36
- "@babel/plugin-proposal-export-default-from": "^7.18.10",
37
- "@babel/plugin-proposal-optional-chaining": "^7.18.9",
38
- "@babel/plugin-proposal-private-methods": "^7.18.6",
39
- "@babel/plugin-syntax-dynamic-import": "^7.8.3",
40
- "@babel/plugin-syntax-optional-chaining": "^7.8.3",
41
- "@babel/plugin-transform-runtime": "^7.18.10",
42
- "@babel/preset-env": "^7.18.10",
43
- "@babel/preset-typescript": "^7.18.6",
44
- "@typescript-eslint/eslint-plugin": "^5.33.0",
45
- "@typescript-eslint/parser": "^5.33.0",
46
- "acorn": "^8.8.0",
33
+ "@swc/core": "^1.3.49",
34
+ "@typescript-eslint/eslint-plugin": "^5.59.1",
35
+ "@typescript-eslint/parser": "^5.58.0",
36
+ "acorn": "^8.8.2",
47
37
  "args-parser": "^1.3.0",
48
- "babel-loader": "^8.2.5",
49
- "babel-plugin-transform-html-import-to-string": "^2.0.0",
50
38
  "circular-dependency-plugin": "^5.2.2",
51
39
  "copy-webpack-plugin": "^11.0.0",
52
40
  "css-loader": "^6.7.1",
53
- "eslint": "8.22.0",
41
+ "eslint": "8.39.0",
54
42
  "eslint-config-airbnb-base": "^15.0.0",
55
43
  "eslint-config-airbnb-typescript": "^17.0.0",
56
- "eslint-plugin-import": "^2.26.0",
57
- "eslint-plugin-jest": "^26.8.2",
44
+ "eslint-plugin-import": "^2.27.5",
45
+ "eslint-plugin-jest": "^27.2.1",
58
46
  "eslint-plugin-node": "^11.1.0",
59
- "eslint-webpack-plugin": "^3.2.0",
47
+ "eslint-webpack-plugin": "^4.0.0",
60
48
  "handlebars": "^4.7.7",
61
49
  "html-loader": "^4.1.0",
62
- "html-webpack-plugin": "^5.5.0",
63
- "jest": "^27.4.5",
64
- "jsdom": "^19.0.0",
65
- "mini-css-extract-plugin": "^2.6.1",
66
- "remove-files-webpack-plugin": "^1.5.0",
67
- "sass": "^1.54.4",
68
- "sass-loader": "^13.0.2",
50
+ "html-webpack-plugin": "^5.5.1",
51
+ "jest": "^29.5.0",
52
+ "jsdom": "^21.1.1",
53
+ "mini-css-extract-plugin": "^2.7.5",
54
+ "sass": "^1.62.0",
55
+ "sass-loader": "^13.2.1",
69
56
  "string-replace-loader": "^3.1.0",
70
- "terser-webpack-plugin": "^5.3.3",
71
- "ts-loader": "^9.3.1",
72
- "typescript": "^4.9.4",
73
- "webpack": "^5.74.0",
74
- "webpack-bundle-analyzer": "^4.5.0",
57
+ "swc-loader": "^0.2.3",
58
+ "swc-minify-webpack-plugin": "^2.0.0",
59
+ "webpack": "^5.80.0",
60
+ "webpack-bundle-analyzer": "^4.8.0",
75
61
  "webpack-cli": "^5.0.1",
76
- "webpack-dev-server": "^4.11.1",
62
+ "webpack-dev-server": "^4.13.3",
77
63
  "webpack-merge": "^5.8.0"
78
64
  },
79
65
  "dependencies": {
80
- "@babel/runtime": "^7.20.7",
81
- "@tensorflow-models/face-detection": "^1.0.1",
82
- "@tensorflow-models/face-landmarks-detection": "1.0.2",
83
- "@tensorflow/tfjs": "^3.19.0",
84
- "@tensorflow/tfjs-backend-wasm": "^3.19.0",
85
- "@tensorflow/tfjs-backend-webgl": "^3.19.0",
86
- "@tensorflow/tfjs-converter": "^3.19.0",
87
- "@tensorflow/tfjs-core": "^3.19.0",
88
- "@tensorflow/tfjs-layers": "^3.19.0",
89
66
  "assert": "^2.0.0",
90
67
  "buffer": "^6.0.3",
91
- "core-js": "^3.24.1",
68
+ "core-js": "^3.30.1",
92
69
  "crypto-browserify": "^3.12.0",
93
70
  "detect-browser": "^5.3.0",
94
71
  "mobile-detect": "^1.4.5",
72
+ "onnxruntime-web": "^1.14.0",
95
73
  "process": "^0.11.10",
96
- "regenerator-runtime": "^0.13.9",
74
+ "regenerator-runtime": "^0.13.11",
97
75
  "stream-browserify": "^3.0.0",
98
76
  "strtok3": "^6.2.4",
99
77
  "token-types": "^4.1.1",
100
- "util": "^0.12.4"
78
+ "util": "^0.12.5"
101
79
  },
102
80
  "author": "IDScan.net",
103
81
  "license": "Apache-2.0"
@@ -1,219 +0,0 @@
1
- /*!
2
- * The buffer module from node.js, for the browser.
3
- *
4
- * @author Feross Aboukhadijeh <https://feross.org>
5
- * @license MIT
6
- */
7
-
8
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
9
-
10
- /*!@license Copyright 2013, Heinrich Goebl, License: MIT, see https://github.com/hgoebl/mobile-detect.js*/
11
-
12
- /*!mobile-detect v1.4.5 2021-03-13*/
13
-
14
- /**
15
- * @license
16
- * Copyright 2017 Google LLC. All Rights Reserved.
17
- * Licensed under the Apache License, Version 2.0 (the "License");
18
- * you may not use this file except in compliance with the License.
19
- * You may obtain a copy of the License at
20
- *
21
- * http://www.apache.org/licenses/LICENSE-2.0
22
- *
23
- * Unless required by applicable law or agreed to in writing, software
24
- * distributed under the License is distributed on an "AS IS" BASIS,
25
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
- * See the License for the specific language governing permissions and
27
- * limitations under the License.
28
- * =============================================================================
29
- */
30
-
31
- /**
32
- * @license
33
- * Copyright 2018 Google LLC. All Rights Reserved.
34
- * Licensed under the Apache License, Version 2.0 (the "License");
35
- * you may not use this file except in compliance with the License.
36
- * You may obtain a copy of the License at
37
- *
38
- * http://www.apache.org/licenses/LICENSE-2.0
39
- *
40
- * Unless required by applicable law or agreed to in writing, software
41
- * distributed under the License is distributed on an "AS IS" BASIS,
42
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
43
- * See the License for the specific language governing permissions and
44
- * limitations under the License.
45
- * =============================================================================
46
- */
47
-
48
- /**
49
- * @license
50
- * Copyright 2019 Google LLC. All Rights Reserved.
51
- * Licensed under the Apache License, Version 2.0 (the "License");
52
- * you may not use this file except in compliance with the License.
53
- * You may obtain a copy of the License at
54
- *
55
- * http://www.apache.org/licenses/LICENSE-2.0
56
- *
57
- * Unless required by applicable law or agreed to in writing, software
58
- * distributed under the License is distributed on an "AS IS" BASIS,
59
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
60
- * See the License for the specific language governing permissions and
61
- * limitations under the License.
62
- *
63
- * =============================================================================
64
- */
65
-
66
- /**
67
- * @license
68
- * Copyright 2019 Google LLC. All Rights Reserved.
69
- * Licensed under the Apache License, Version 2.0 (the "License");
70
- * you may not use this file except in compliance with the License.
71
- * You may obtain a copy of the License at
72
- *
73
- * http://www.apache.org/licenses/LICENSE-2.0
74
- *
75
- * Unless required by applicable law or agreed to in writing, software
76
- * distributed under the License is distributed on an "AS IS" BASIS,
77
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
78
- * See the License for the specific language governing permissions and
79
- * limitations under the License.
80
- * =============================================================================
81
- */
82
-
83
- /**
84
- * @license
85
- * Copyright 2020 Google Inc. All Rights Reserved.
86
- * Licensed under the Apache License, Version 2.0 (the "License");
87
- * you may not use this file except in compliance with the License.
88
- * You may obtain a copy of the License at
89
- *
90
- * http://www.apache.org/licenses/LICENSE-2.0
91
- *
92
- * Unless required by applicable law or agreed to in writing, software
93
- * distributed under the License is distributed on an "AS IS" BASIS,
94
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
95
- * See the License for the specific language governing permissions and
96
- * limitations under the License.
97
- * =============================================================================
98
- */
99
-
100
- /**
101
- * @license
102
- * Copyright 2020 Google LLC. All Rights Reserved.
103
- * Licensed under the Apache License, Version 2.0 (the "License");
104
- * you may not use this file except in compliance with the License.
105
- * You may obtain a copy of the License at
106
- *
107
- * http://www.apache.org/licenses/LICENSE-2.0
108
- *
109
- * Unless required by applicable law or agreed to in writing, software
110
- * distributed under the License is distributed on an "AS IS" BASIS,
111
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
112
- * See the License for the specific language governing permissions and
113
- * limitations under the License.
114
- * =============================================================================
115
- */
116
-
117
- /**
118
- * @license
119
- * Copyright 2020 Google LLC. All Rights Reserved.
120
- * Licensed under the Apache License, Version 2.0 (the "License");
121
- * you may not use this file except in compliance with the License.
122
- * You may obtain a copy of the License at
123
- *
124
- * https://www.apache.org/licenses/LICENSE-2.0
125
- *
126
- * Unless required by applicable law or agreed to in writing, software
127
- * distributed under the License is distributed on an "AS IS" BASIS,
128
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
129
- * See the License for the specific language governing permissions and
130
- * limitations under the License.
131
- * =============================================================================
132
- */
133
-
134
- /**
135
- * @license
136
- * Copyright 2020 Google LLC. All Rights Reserved.
137
- * Licensed under the Apache License, Version 2.0 (the License);
138
- * you may not use this file except in compliance with the License.
139
- * You may obtain a copy of the License at
140
- *
141
- * http://www.apache.org/licenses/LICENSE-2.0
142
- *
143
- * Unless required by applicable law or agreed to in writing, software
144
- * distributed under the License is distributed on an AS IS BASIS,
145
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
146
- * See the License for the specific language governing permissions and
147
- * limitations under the License.
148
- * =============================================================================
149
- */
150
-
151
- /**
152
- * @license
153
- * Copyright 2021 Google LLC. All Rights Reserved.
154
- * Licensed under the Apache License, Version 2.0 (the "License");
155
- * you may not use this file except in compliance with the License.
156
- * You may obtain a copy of the License at
157
- *
158
- * http://www.apache.org/licenses/LICENSE-2.0
159
- *
160
- * Unless required by applicable law or agreed to in writing, software
161
- * distributed under the License is distributed on an "AS IS" BASIS,
162
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
163
- * See the License for the specific language governing permissions and
164
- * limitations under the License.
165
- * =============================================================================
166
- */
167
-
168
- /**
169
- * @license
170
- * Copyright 2021 Google LLC. All Rights Reserved.
171
- * Licensed under the Apache License, Version 2.0 (the "License");
172
- * you may not use this file except in compliance with the License.
173
- * You may obtain a copy of the License at
174
- *
175
- * https://www.apache.org/licenses/LICENSE-2.0
176
- *
177
- * Unless required by applicable law or agreed to in writing, software
178
- * distributed under the License is distributed on an "AS IS" BASIS,
179
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
180
- * See the License for the specific language governing permissions and
181
- * limitations under the License.
182
- * =============================================================================
183
- */
184
-
185
- /**
186
- * @license
187
- * Copyright 2022 Google LLC. All Rights Reserved.
188
- * Licensed under the Apache License, Version 2.0 (the "License");
189
- * you may not use this file except in compliance with the License.
190
- * You may obtain a copy of the License at
191
- *
192
- * http://www.apache.org/licenses/LICENSE-2.0
193
- *
194
- * Unless required by applicable law or agreed to in writing, software
195
- * distributed under the License is distributed on an "AS IS" BASIS,
196
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
197
- * See the License for the specific language governing permissions and
198
- * limitations under the License.
199
- * =============================================================================
200
- */
201
-
202
- /**
203
- * @license
204
- * Copyright 2022 Google LLC. All Rights Reserved.
205
- * Licensed under the Apache License, Version 2.0 (the 'License');
206
- * you may not use this file except in compliance with the License.
207
- * You may obtain a copy of the License at
208
- *
209
- * http://www.apache.org/licenses/LICENSE-2.0
210
- *
211
- * Unless required by applicable law or agreed to in writing, software
212
- * distributed under the License is distributed on an 'AS IS' BASIS,
213
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
214
- * See the License for the specific language governing permissions and
215
- * limitations under the License.
216
- * =============================================================================
217
- */
218
-
219
- /** @license See the LICENSE file. */
@@ -1,3 +0,0 @@
1
- export type PartialRecord <T extends string, U> = {
2
- [V in T]?: U
3
- };
@@ -1,8 +0,0 @@
1
- /**
2
- * x: number,
3
- * y: number,
4
- */
5
- export interface ICoord {
6
- x: number,
7
- y: number,
8
- }
package/dist/js/idvc.d.ts DELETED
@@ -1,3 +0,0 @@
1
- declare const IDVC: any;
2
-
3
- export default IDVC;
@@ -1,4 +0,0 @@
1
- export interface IPredictLabelData {
2
- img: ImageData,
3
- blurConfidence: number,
4
- }
@@ -1,12 +0,0 @@
1
- import IDVC from './idvc';
2
-
3
- export {};
4
-
5
- declare global {
6
- interface Window {
7
- BlurDetector: any;
8
- PDF417: any;
9
- IDVC: typeof IDVC,
10
- faceLandmarksDetection: any,
11
- }
12
- }
package/dist/js/loop.d.ts DELETED
@@ -1,21 +0,0 @@
1
- import { StepType } from '../environment/stepsDescription';
2
-
3
- export interface StepResultError {
4
- errorType: string,
5
- errorVal: 0 | 1,
6
- }
7
-
8
- export interface StepFunctionResult {
9
- type: StepType | 'VolumeFace',
10
- cancel: boolean;
11
- image: null | ImageData;
12
- touch: boolean;
13
- status: boolean
14
- error?: StepResultError,
15
- }
16
-
17
- export type Cancel = (
18
- topImage: ImageData,
19
- cancelPredict?: boolean,
20
- byTouch?: boolean,
21
- ) => Promise<void>;
package/dist/js/mrz.d.ts DELETED
@@ -1,105 +0,0 @@
1
- import { Tensor } from '@tensorflow/tfjs-core';
2
- import { ICoord } from '../helpers/geometry';
3
- import { StepType } from '../environment/stepsDescription';
4
-
5
- interface StepResultError {
6
- errorType: string,
7
- errorVal: 0 | 1,
8
- }
9
-
10
- export interface IMRZResults {
11
- mrzText: string
12
- }
13
-
14
- type MRZCore = any;
15
-
16
- interface IDocumentData {
17
- fields: any,
18
- location: IMRZLocation,
19
- mrzType: { value: number },
20
- }
21
-
22
- interface IMrzPredict {
23
- confidence: number,
24
- value: string,
25
- }
26
-
27
- interface IDecodeResult {
28
- data: IDocumentData,
29
- errorDesc: string,
30
- status: { value: number },
31
- }
32
-
33
- interface IMrzTFModel {
34
- normalize: (input, batchSize) => Tensor,
35
- predictFromImageSync: (
36
- img: HTMLCanvasElement,
37
- countOfExits: number,
38
- channels: number,
39
- batchSize: number,
40
- ) => IMrzPredict[],
41
- }
42
-
43
- interface IDecodedField{
44
- name: string,
45
- value: string,
46
- status: 'valid' | 'invalidCS',
47
- }
48
-
49
- interface IMrzScanRes {
50
- status: {
51
- value: number,
52
- },
53
- fields: IDecodedField[],
54
- count: number,
55
- location: IMRZLocation,
56
- errorStatus?: string,
57
- }
58
-
59
- interface IMrzStepResult {
60
- type: StepType,
61
- status: boolean,
62
- cancel: boolean,
63
- touch: boolean,
64
- image: ImageData,
65
- error?: StepResultError,
66
- coords?: IMrzCoords,
67
- needToCut?: boolean,
68
- results?: {
69
- mrzText: string,
70
- },
71
- }
72
-
73
- interface IDetectRes {
74
- status: boolean,
75
- results?: { mrzText: string; } | null,
76
- locations?: IMRZLocation,
77
- error?: any, // ILicenceError
78
- }
79
-
80
- interface ICheckResult extends IDetectRes {
81
- mrzData: null,
82
- }
83
-
84
- export interface IMRZLocation{
85
- leftTop: ICoord,
86
- rightTop: ICoord,
87
- rightBottom: ICoord,
88
- leftBottom: ICoord,
89
- }
90
-
91
- interface IMrzDetected{
92
- status: boolean,
93
- location: IMRZLocation,
94
- results: { mrzText: string; } | null,
95
- error: {
96
- error: boolean,
97
- errorType: string,
98
- errorVal: number,
99
- }
100
- }
101
-
102
- export interface IMrzCoords{
103
- locations: IMRZLocation,
104
- color: 'green' | 'yellow',
105
- }
@@ -1 +0,0 @@
1
- onmessage=({data:e})=>{Object.keys(e).forEach(((t,n)=>{fetch(e[t]).then((e=>e.body)).then((e=>{const t=e.getReader();return new ReadableStream({start(e){!function n(){t.read().then((({done:t,value:s})=>{t?e.close():(e.enqueue(s),n())}))}()}})})).then((e=>new Response(e,{headers:{"Content-Type":"text/javascript"}}).text())).then((t=>{const s=`executedScript${n}`,a="scriptExecuted";let c=t;c+=`\n const event = new Event('${a}');\n document.getElementById('${s}').dispatchEvent(event);\n `,Object.keys(e).length,postMessage({value:c,id:s,event:a})}))}))};
@@ -1 +0,0 @@
1
- const t=(t,e)=>t-e,e=(t,e)=>t+e,r=(t,e)=>t%e>1?t-1:-1,n=(t,e)=>(t+1)%e>=0?t+1:-1,a=(e,n)=>r(t(e,n),n),s=(e,r)=>n(t(e,r),r),o=(t,n)=>r(e(t,n),n),c=(t,r)=>n(e(t,r),r),h=(h,d)=>[a,t,s,n,c,e,o,r].map((t=>t(h,d))),d=(t,e)=>{const r=[],n=[],a=t.length;let s,o=0;const c=()=>{const s=e=>e>0&&0!==t[e]&&e<a;for(;r.length;){const a=r.pop();if(!a)break;t[a]=0,n[o].add(a),h(a,e).forEach((t=>{s(t)&&r.push(t)}))}};for(s=0;s<a;s+=1)0!==t[s]&&(n[o]=new Set,r.push(s),c(),o+=1);return n},i=.3,l=(t,e)=>Math.floor(t/e),u=(t,e)=>{return[(r=t,n=e,r%n),l(t,e)];var r,n},m=t=>null!=t,g=(t,e,r)=>{const n=((t,e=120)=>{const r=t.width*t.height,n=new Uint8ClampedArray(r);let a,s=0,o=0,c=0,h=0;for(a=0;a<r;a+=1){const r=a<<2;s=t.data[r+0],o=t.data[r+1],c=t.data[r+2],h=77*s+151*o+28*c>>8,h<e&&(n[a]=1)}return n})(t);return(({segments:t,width:e,scaleWidth:r,scaleHeight:n})=>t.map((t=>{let a=Number.MAX_VALUE,s=Number.MAX_VALUE,o=Number.MIN_VALUE,c=Number.MIN_VALUE;for(const r of t){const t=u(r,e);t[0]<a&&(a=t[0]),t[1]<s&&(s=t[1]),t[0]>o&&(o=t[0]),t[1]>c&&(c=t[1])}const h=(o-a)*(c-s);return h>5&&h<500?{perimeter:h,x1:Math.trunc(a/i/r),y1:Math.trunc(s/i/n),x2:Math.trunc(o/i/r),y2:Math.trunc(c/i/n)}:null})).filter(m))({segments:d(n,t.width),width:t.width,scaleWidth:e,scaleHeight:r})};onmessage=({data:t})=>{const e=g(t.iData,t.resizedToBorderScaleWidth,t.resizedToBorderScaleHeight);postMessage({segments:e})};