@midscene/shared 0.12.4 → 0.12.5-beta-20250306111616.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/dist/es/{constants.js → constants/index.js} +4 -5
- package/dist/es/extractor/client-extractor.js +161 -0
- package/dist/es/extractor/constants.js +10 -0
- package/dist/es/extractor/debug.js +9 -0
- package/dist/es/extractor/dom-util.js +73 -0
- package/dist/es/extractor/index.js +14 -0
- package/dist/es/extractor/tree.js +126 -0
- package/dist/es/extractor/util.js +344 -0
- package/dist/es/extractor/web-extractor.js +317 -0
- package/dist/es/img/box-select.js +187 -0
- package/dist/es/img/draw-box.js +43 -0
- package/dist/es/img/get-jimp.js +11 -0
- package/dist/es/img/index.js +34 -0
- package/dist/es/img/info.js +50 -0
- package/dist/es/img/transform.js +128 -0
- package/dist/es/index.js +0 -1
- package/dist/es/{fs.js → node/fs.js} +22 -5
- package/dist/es/types/index.js +5 -0
- package/dist/es/us-keyboard-layout.js +10 -11
- package/dist/es/utils.js +10 -569
- package/dist/lib/constants/index.js +20 -0
- package/dist/lib/extractor/client-extractor.js +161 -0
- package/dist/lib/extractor/constants.js +10 -0
- package/dist/lib/extractor/debug.js +9 -0
- package/dist/lib/extractor/dom-util.js +73 -0
- package/dist/lib/extractor/index.js +14 -0
- package/dist/lib/extractor/tree.js +126 -0
- package/dist/lib/extractor/util.js +344 -0
- package/dist/lib/extractor/web-extractor.js +317 -0
- package/dist/lib/img/box-select.js +187 -0
- package/dist/lib/img/draw-box.js +43 -0
- package/dist/lib/img/get-jimp.js +11 -0
- package/dist/lib/img/index.js +34 -0
- package/dist/lib/img/info.js +50 -0
- package/dist/lib/img/transform.js +128 -0
- package/dist/lib/index.js +3 -25
- package/dist/lib/node/fs.js +62 -0
- package/dist/lib/types/index.js +5 -0
- package/dist/lib/us-keyboard-layout.js +12 -41
- package/dist/lib/utils.js +12 -578
- package/dist/types/constants/index.d.ts +12 -0
- package/dist/types/extractor/client-extractor.d.ts +2 -0
- package/dist/types/extractor/constants.d.ts +1 -0
- package/dist/types/extractor/debug.d.ts +1 -0
- package/dist/types/extractor/dom-util.d.ts +5 -0
- package/dist/types/extractor/index.d.ts +29 -0
- package/dist/types/extractor/tree.d.ts +9 -0
- package/dist/types/extractor/util.d.ts +40 -0
- package/dist/types/extractor/web-extractor.d.ts +14 -0
- package/dist/types/img/box-select.d.ts +31 -0
- package/dist/types/img/draw-box.d.ts +15 -0
- package/dist/types/img/get-jimp.d.ts +2 -0
- package/dist/types/img/index.d.ts +4 -0
- package/dist/types/img/info.d.ts +40 -0
- package/dist/types/img/transform.d.ts +68 -0
- package/dist/types/index.d.ts +1 -2
- package/dist/{lib → types/node}/fs.d.ts +4 -4
- package/dist/{lib/index-305e7a7e.d.ts → types/types/index.d.ts} +6 -9
- package/dist/types/us-keyboard-layout.d.ts +32 -0
- package/dist/types/utils.d.ts +11 -0
- package/package.json +39 -39
- package/src/img/box-select.ts +17 -11
- package/src/img/draw-box.ts +5 -5
- package/src/img/get-jimp.ts +3 -0
- package/src/{fs/index.ts → node/fs.ts} +20 -0
- package/src/utils.ts +13 -0
- package/dist/browser/constants.d.ts +0 -14
- package/dist/browser/constants.js +0 -42
- package/dist/browser/extractor-debug.d.ts +0 -2
- package/dist/browser/extractor-debug.js +0 -1269
- package/dist/browser/extractor.d.ts +0 -47
- package/dist/browser/extractor.js +0 -1557
- package/dist/browser/fs.d.ts +0 -14
- package/dist/browser/fs.js +0 -66
- package/dist/browser/img.d.ts +0 -152
- package/dist/browser/img.js +0 -483
- package/dist/browser/index-305e7a7e.d.ts +0 -32
- package/dist/browser/index.d.ts +0 -3
- package/dist/browser/index.js +0 -26
- package/dist/browser/us-keyboard-layout.d.ts +0 -34
- package/dist/browser/us-keyboard-layout.js +0 -456
- package/dist/browser/utils.d.ts +0 -5
- package/dist/browser/utils.js +0 -611
- package/dist/es/constants.d.ts +0 -14
- package/dist/es/extractor-debug.d.ts +0 -2
- package/dist/es/extractor-debug.js +0 -1267
- package/dist/es/extractor.d.ts +0 -47
- package/dist/es/extractor.js +0 -1546
- package/dist/es/fs.d.ts +0 -14
- package/dist/es/img.d.ts +0 -152
- package/dist/es/img.js +0 -451
- package/dist/es/index-305e7a7e.d.ts +0 -32
- package/dist/es/index.d.ts +0 -3
- package/dist/es/us-keyboard-layout.d.ts +0 -34
- package/dist/es/utils.d.ts +0 -5
- package/dist/lib/constants.d.ts +0 -14
- package/dist/lib/constants.js +0 -50
- package/dist/lib/extractor-debug.d.ts +0 -2
- package/dist/lib/extractor-debug.js +0 -1261
- package/dist/lib/extractor.d.ts +0 -47
- package/dist/lib/extractor.js +0 -1559
- package/dist/lib/fs.js +0 -71
- package/dist/lib/img.d.ts +0 -152
- package/dist/lib/img.js +0 -501
- package/dist/lib/index.d.ts +0 -3
- package/dist/lib/us-keyboard-layout.d.ts +0 -34
- package/dist/lib/utils.d.ts +0 -5
package/dist/lib/utils.js
CHANGED
|
@@ -1,568 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
-
};
|
|
11
|
-
var __export = (target, all) => {
|
|
12
|
-
for (var name in all)
|
|
13
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
-
};
|
|
15
|
-
var __copyProps = (to, from, except, desc) => {
|
|
16
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
-
for (let key of __getOwnPropNames(from))
|
|
18
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
-
}
|
|
21
|
-
return to;
|
|
22
|
-
};
|
|
23
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
-
mod
|
|
30
|
-
));
|
|
31
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
-
|
|
33
|
-
// ../../node_modules/.pnpm/js-sha256@0.11.0/node_modules/js-sha256/src/sha256.js
|
|
34
|
-
var require_sha256 = __commonJS({
|
|
35
|
-
"../../node_modules/.pnpm/js-sha256@0.11.0/node_modules/js-sha256/src/sha256.js"(exports, module2) {
|
|
36
|
-
"use strict";
|
|
37
|
-
(function() {
|
|
38
|
-
"use strict";
|
|
39
|
-
var ERROR = "input is invalid type";
|
|
40
|
-
var WINDOW = typeof window === "object";
|
|
41
|
-
var root = WINDOW ? window : {};
|
|
42
|
-
if (root.JS_SHA256_NO_WINDOW) {
|
|
43
|
-
WINDOW = false;
|
|
44
|
-
}
|
|
45
|
-
var WEB_WORKER = !WINDOW && typeof self === "object";
|
|
46
|
-
var NODE_JS = !root.JS_SHA256_NO_NODE_JS && typeof process === "object" && process.versions && process.versions.node;
|
|
47
|
-
if (NODE_JS) {
|
|
48
|
-
root = global;
|
|
49
|
-
} else if (WEB_WORKER) {
|
|
50
|
-
root = self;
|
|
51
|
-
}
|
|
52
|
-
var COMMON_JS = !root.JS_SHA256_NO_COMMON_JS && typeof module2 === "object" && module2.exports;
|
|
53
|
-
var AMD = typeof define === "function" && define.amd;
|
|
54
|
-
var ARRAY_BUFFER = !root.JS_SHA256_NO_ARRAY_BUFFER && typeof ArrayBuffer !== "undefined";
|
|
55
|
-
var HEX_CHARS = "0123456789abcdef".split("");
|
|
56
|
-
var EXTRA = [-2147483648, 8388608, 32768, 128];
|
|
57
|
-
var SHIFT = [24, 16, 8, 0];
|
|
58
|
-
var K = [
|
|
59
|
-
1116352408,
|
|
60
|
-
1899447441,
|
|
61
|
-
3049323471,
|
|
62
|
-
3921009573,
|
|
63
|
-
961987163,
|
|
64
|
-
1508970993,
|
|
65
|
-
2453635748,
|
|
66
|
-
2870763221,
|
|
67
|
-
3624381080,
|
|
68
|
-
310598401,
|
|
69
|
-
607225278,
|
|
70
|
-
1426881987,
|
|
71
|
-
1925078388,
|
|
72
|
-
2162078206,
|
|
73
|
-
2614888103,
|
|
74
|
-
3248222580,
|
|
75
|
-
3835390401,
|
|
76
|
-
4022224774,
|
|
77
|
-
264347078,
|
|
78
|
-
604807628,
|
|
79
|
-
770255983,
|
|
80
|
-
1249150122,
|
|
81
|
-
1555081692,
|
|
82
|
-
1996064986,
|
|
83
|
-
2554220882,
|
|
84
|
-
2821834349,
|
|
85
|
-
2952996808,
|
|
86
|
-
3210313671,
|
|
87
|
-
3336571891,
|
|
88
|
-
3584528711,
|
|
89
|
-
113926993,
|
|
90
|
-
338241895,
|
|
91
|
-
666307205,
|
|
92
|
-
773529912,
|
|
93
|
-
1294757372,
|
|
94
|
-
1396182291,
|
|
95
|
-
1695183700,
|
|
96
|
-
1986661051,
|
|
97
|
-
2177026350,
|
|
98
|
-
2456956037,
|
|
99
|
-
2730485921,
|
|
100
|
-
2820302411,
|
|
101
|
-
3259730800,
|
|
102
|
-
3345764771,
|
|
103
|
-
3516065817,
|
|
104
|
-
3600352804,
|
|
105
|
-
4094571909,
|
|
106
|
-
275423344,
|
|
107
|
-
430227734,
|
|
108
|
-
506948616,
|
|
109
|
-
659060556,
|
|
110
|
-
883997877,
|
|
111
|
-
958139571,
|
|
112
|
-
1322822218,
|
|
113
|
-
1537002063,
|
|
114
|
-
1747873779,
|
|
115
|
-
1955562222,
|
|
116
|
-
2024104815,
|
|
117
|
-
2227730452,
|
|
118
|
-
2361852424,
|
|
119
|
-
2428436474,
|
|
120
|
-
2756734187,
|
|
121
|
-
3204031479,
|
|
122
|
-
3329325298
|
|
123
|
-
];
|
|
124
|
-
var OUTPUT_TYPES = ["hex", "array", "digest", "arrayBuffer"];
|
|
125
|
-
var blocks = [];
|
|
126
|
-
if (root.JS_SHA256_NO_NODE_JS || !Array.isArray) {
|
|
127
|
-
Array.isArray = function(obj) {
|
|
128
|
-
return Object.prototype.toString.call(obj) === "[object Array]";
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
if (ARRAY_BUFFER && (root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) {
|
|
132
|
-
ArrayBuffer.isView = function(obj) {
|
|
133
|
-
return typeof obj === "object" && obj.buffer && obj.buffer.constructor === ArrayBuffer;
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
var createOutputMethod = function(outputType, is224) {
|
|
137
|
-
return function(message) {
|
|
138
|
-
return new Sha256(is224, true).update(message)[outputType]();
|
|
139
|
-
};
|
|
140
|
-
};
|
|
141
|
-
var createMethod = function(is224) {
|
|
142
|
-
var method = createOutputMethod("hex", is224);
|
|
143
|
-
if (NODE_JS) {
|
|
144
|
-
method = nodeWrap(method, is224);
|
|
145
|
-
}
|
|
146
|
-
method.create = function() {
|
|
147
|
-
return new Sha256(is224);
|
|
148
|
-
};
|
|
149
|
-
method.update = function(message) {
|
|
150
|
-
return method.create().update(message);
|
|
151
|
-
};
|
|
152
|
-
for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
|
|
153
|
-
var type = OUTPUT_TYPES[i];
|
|
154
|
-
method[type] = createOutputMethod(type, is224);
|
|
155
|
-
}
|
|
156
|
-
return method;
|
|
157
|
-
};
|
|
158
|
-
var nodeWrap = function(method, is224) {
|
|
159
|
-
var crypto = require("crypto");
|
|
160
|
-
var Buffer2 = require("buffer").Buffer;
|
|
161
|
-
var algorithm = is224 ? "sha224" : "sha256";
|
|
162
|
-
var bufferFrom;
|
|
163
|
-
if (Buffer2.from && !root.JS_SHA256_NO_BUFFER_FROM) {
|
|
164
|
-
bufferFrom = Buffer2.from;
|
|
165
|
-
} else {
|
|
166
|
-
bufferFrom = function(message) {
|
|
167
|
-
return new Buffer2(message);
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
var nodeMethod = function(message) {
|
|
171
|
-
if (typeof message === "string") {
|
|
172
|
-
return crypto.createHash(algorithm).update(message, "utf8").digest("hex");
|
|
173
|
-
} else {
|
|
174
|
-
if (message === null || message === void 0) {
|
|
175
|
-
throw new Error(ERROR);
|
|
176
|
-
} else if (message.constructor === ArrayBuffer) {
|
|
177
|
-
message = new Uint8Array(message);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
if (Array.isArray(message) || ArrayBuffer.isView(message) || message.constructor === Buffer2) {
|
|
181
|
-
return crypto.createHash(algorithm).update(bufferFrom(message)).digest("hex");
|
|
182
|
-
} else {
|
|
183
|
-
return method(message);
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
return nodeMethod;
|
|
187
|
-
};
|
|
188
|
-
var createHmacOutputMethod = function(outputType, is224) {
|
|
189
|
-
return function(key, message) {
|
|
190
|
-
return new HmacSha256(key, is224, true).update(message)[outputType]();
|
|
191
|
-
};
|
|
192
|
-
};
|
|
193
|
-
var createHmacMethod = function(is224) {
|
|
194
|
-
var method = createHmacOutputMethod("hex", is224);
|
|
195
|
-
method.create = function(key) {
|
|
196
|
-
return new HmacSha256(key, is224);
|
|
197
|
-
};
|
|
198
|
-
method.update = function(key, message) {
|
|
199
|
-
return method.create(key).update(message);
|
|
200
|
-
};
|
|
201
|
-
for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
|
|
202
|
-
var type = OUTPUT_TYPES[i];
|
|
203
|
-
method[type] = createHmacOutputMethod(type, is224);
|
|
204
|
-
}
|
|
205
|
-
return method;
|
|
206
|
-
};
|
|
207
|
-
function Sha256(is224, sharedMemory) {
|
|
208
|
-
if (sharedMemory) {
|
|
209
|
-
blocks[0] = blocks[16] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = blocks[5] = blocks[6] = blocks[7] = blocks[8] = blocks[9] = blocks[10] = blocks[11] = blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
|
|
210
|
-
this.blocks = blocks;
|
|
211
|
-
} else {
|
|
212
|
-
this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
213
|
-
}
|
|
214
|
-
if (is224) {
|
|
215
|
-
this.h0 = 3238371032;
|
|
216
|
-
this.h1 = 914150663;
|
|
217
|
-
this.h2 = 812702999;
|
|
218
|
-
this.h3 = 4144912697;
|
|
219
|
-
this.h4 = 4290775857;
|
|
220
|
-
this.h5 = 1750603025;
|
|
221
|
-
this.h6 = 1694076839;
|
|
222
|
-
this.h7 = 3204075428;
|
|
223
|
-
} else {
|
|
224
|
-
this.h0 = 1779033703;
|
|
225
|
-
this.h1 = 3144134277;
|
|
226
|
-
this.h2 = 1013904242;
|
|
227
|
-
this.h3 = 2773480762;
|
|
228
|
-
this.h4 = 1359893119;
|
|
229
|
-
this.h5 = 2600822924;
|
|
230
|
-
this.h6 = 528734635;
|
|
231
|
-
this.h7 = 1541459225;
|
|
232
|
-
}
|
|
233
|
-
this.block = this.start = this.bytes = this.hBytes = 0;
|
|
234
|
-
this.finalized = this.hashed = false;
|
|
235
|
-
this.first = true;
|
|
236
|
-
this.is224 = is224;
|
|
237
|
-
}
|
|
238
|
-
Sha256.prototype.update = function(message) {
|
|
239
|
-
if (this.finalized) {
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
var notString, type = typeof message;
|
|
243
|
-
if (type !== "string") {
|
|
244
|
-
if (type === "object") {
|
|
245
|
-
if (message === null) {
|
|
246
|
-
throw new Error(ERROR);
|
|
247
|
-
} else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
|
|
248
|
-
message = new Uint8Array(message);
|
|
249
|
-
} else if (!Array.isArray(message)) {
|
|
250
|
-
if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) {
|
|
251
|
-
throw new Error(ERROR);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
} else {
|
|
255
|
-
throw new Error(ERROR);
|
|
256
|
-
}
|
|
257
|
-
notString = true;
|
|
258
|
-
}
|
|
259
|
-
var code, index = 0, i, length = message.length, blocks2 = this.blocks;
|
|
260
|
-
while (index < length) {
|
|
261
|
-
if (this.hashed) {
|
|
262
|
-
this.hashed = false;
|
|
263
|
-
blocks2[0] = this.block;
|
|
264
|
-
this.block = blocks2[16] = blocks2[1] = blocks2[2] = blocks2[3] = blocks2[4] = blocks2[5] = blocks2[6] = blocks2[7] = blocks2[8] = blocks2[9] = blocks2[10] = blocks2[11] = blocks2[12] = blocks2[13] = blocks2[14] = blocks2[15] = 0;
|
|
265
|
-
}
|
|
266
|
-
if (notString) {
|
|
267
|
-
for (i = this.start; index < length && i < 64; ++index) {
|
|
268
|
-
blocks2[i >>> 2] |= message[index] << SHIFT[i++ & 3];
|
|
269
|
-
}
|
|
270
|
-
} else {
|
|
271
|
-
for (i = this.start; index < length && i < 64; ++index) {
|
|
272
|
-
code = message.charCodeAt(index);
|
|
273
|
-
if (code < 128) {
|
|
274
|
-
blocks2[i >>> 2] |= code << SHIFT[i++ & 3];
|
|
275
|
-
} else if (code < 2048) {
|
|
276
|
-
blocks2[i >>> 2] |= (192 | code >>> 6) << SHIFT[i++ & 3];
|
|
277
|
-
blocks2[i >>> 2] |= (128 | code & 63) << SHIFT[i++ & 3];
|
|
278
|
-
} else if (code < 55296 || code >= 57344) {
|
|
279
|
-
blocks2[i >>> 2] |= (224 | code >>> 12) << SHIFT[i++ & 3];
|
|
280
|
-
blocks2[i >>> 2] |= (128 | code >>> 6 & 63) << SHIFT[i++ & 3];
|
|
281
|
-
blocks2[i >>> 2] |= (128 | code & 63) << SHIFT[i++ & 3];
|
|
282
|
-
} else {
|
|
283
|
-
code = 65536 + ((code & 1023) << 10 | message.charCodeAt(++index) & 1023);
|
|
284
|
-
blocks2[i >>> 2] |= (240 | code >>> 18) << SHIFT[i++ & 3];
|
|
285
|
-
blocks2[i >>> 2] |= (128 | code >>> 12 & 63) << SHIFT[i++ & 3];
|
|
286
|
-
blocks2[i >>> 2] |= (128 | code >>> 6 & 63) << SHIFT[i++ & 3];
|
|
287
|
-
blocks2[i >>> 2] |= (128 | code & 63) << SHIFT[i++ & 3];
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
this.lastByteIndex = i;
|
|
292
|
-
this.bytes += i - this.start;
|
|
293
|
-
if (i >= 64) {
|
|
294
|
-
this.block = blocks2[16];
|
|
295
|
-
this.start = i - 64;
|
|
296
|
-
this.hash();
|
|
297
|
-
this.hashed = true;
|
|
298
|
-
} else {
|
|
299
|
-
this.start = i;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
if (this.bytes > 4294967295) {
|
|
303
|
-
this.hBytes += this.bytes / 4294967296 << 0;
|
|
304
|
-
this.bytes = this.bytes % 4294967296;
|
|
305
|
-
}
|
|
306
|
-
return this;
|
|
307
|
-
};
|
|
308
|
-
Sha256.prototype.finalize = function() {
|
|
309
|
-
if (this.finalized) {
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
this.finalized = true;
|
|
313
|
-
var blocks2 = this.blocks, i = this.lastByteIndex;
|
|
314
|
-
blocks2[16] = this.block;
|
|
315
|
-
blocks2[i >>> 2] |= EXTRA[i & 3];
|
|
316
|
-
this.block = blocks2[16];
|
|
317
|
-
if (i >= 56) {
|
|
318
|
-
if (!this.hashed) {
|
|
319
|
-
this.hash();
|
|
320
|
-
}
|
|
321
|
-
blocks2[0] = this.block;
|
|
322
|
-
blocks2[16] = blocks2[1] = blocks2[2] = blocks2[3] = blocks2[4] = blocks2[5] = blocks2[6] = blocks2[7] = blocks2[8] = blocks2[9] = blocks2[10] = blocks2[11] = blocks2[12] = blocks2[13] = blocks2[14] = blocks2[15] = 0;
|
|
323
|
-
}
|
|
324
|
-
blocks2[14] = this.hBytes << 3 | this.bytes >>> 29;
|
|
325
|
-
blocks2[15] = this.bytes << 3;
|
|
326
|
-
this.hash();
|
|
327
|
-
};
|
|
328
|
-
Sha256.prototype.hash = function() {
|
|
329
|
-
var a = this.h0, b = this.h1, c = this.h2, d = this.h3, e = this.h4, f = this.h5, g = this.h6, h = this.h7, blocks2 = this.blocks, j, s0, s1, maj, t1, t2, ch, ab, da, cd, bc;
|
|
330
|
-
for (j = 16; j < 64; ++j) {
|
|
331
|
-
t1 = blocks2[j - 15];
|
|
332
|
-
s0 = (t1 >>> 7 | t1 << 25) ^ (t1 >>> 18 | t1 << 14) ^ t1 >>> 3;
|
|
333
|
-
t1 = blocks2[j - 2];
|
|
334
|
-
s1 = (t1 >>> 17 | t1 << 15) ^ (t1 >>> 19 | t1 << 13) ^ t1 >>> 10;
|
|
335
|
-
blocks2[j] = blocks2[j - 16] + s0 + blocks2[j - 7] + s1 << 0;
|
|
336
|
-
}
|
|
337
|
-
bc = b & c;
|
|
338
|
-
for (j = 0; j < 64; j += 4) {
|
|
339
|
-
if (this.first) {
|
|
340
|
-
if (this.is224) {
|
|
341
|
-
ab = 300032;
|
|
342
|
-
t1 = blocks2[0] - 1413257819;
|
|
343
|
-
h = t1 - 150054599 << 0;
|
|
344
|
-
d = t1 + 24177077 << 0;
|
|
345
|
-
} else {
|
|
346
|
-
ab = 704751109;
|
|
347
|
-
t1 = blocks2[0] - 210244248;
|
|
348
|
-
h = t1 - 1521486534 << 0;
|
|
349
|
-
d = t1 + 143694565 << 0;
|
|
350
|
-
}
|
|
351
|
-
this.first = false;
|
|
352
|
-
} else {
|
|
353
|
-
s0 = (a >>> 2 | a << 30) ^ (a >>> 13 | a << 19) ^ (a >>> 22 | a << 10);
|
|
354
|
-
s1 = (e >>> 6 | e << 26) ^ (e >>> 11 | e << 21) ^ (e >>> 25 | e << 7);
|
|
355
|
-
ab = a & b;
|
|
356
|
-
maj = ab ^ a & c ^ bc;
|
|
357
|
-
ch = e & f ^ ~e & g;
|
|
358
|
-
t1 = h + s1 + ch + K[j] + blocks2[j];
|
|
359
|
-
t2 = s0 + maj;
|
|
360
|
-
h = d + t1 << 0;
|
|
361
|
-
d = t1 + t2 << 0;
|
|
362
|
-
}
|
|
363
|
-
s0 = (d >>> 2 | d << 30) ^ (d >>> 13 | d << 19) ^ (d >>> 22 | d << 10);
|
|
364
|
-
s1 = (h >>> 6 | h << 26) ^ (h >>> 11 | h << 21) ^ (h >>> 25 | h << 7);
|
|
365
|
-
da = d & a;
|
|
366
|
-
maj = da ^ d & b ^ ab;
|
|
367
|
-
ch = h & e ^ ~h & f;
|
|
368
|
-
t1 = g + s1 + ch + K[j + 1] + blocks2[j + 1];
|
|
369
|
-
t2 = s0 + maj;
|
|
370
|
-
g = c + t1 << 0;
|
|
371
|
-
c = t1 + t2 << 0;
|
|
372
|
-
s0 = (c >>> 2 | c << 30) ^ (c >>> 13 | c << 19) ^ (c >>> 22 | c << 10);
|
|
373
|
-
s1 = (g >>> 6 | g << 26) ^ (g >>> 11 | g << 21) ^ (g >>> 25 | g << 7);
|
|
374
|
-
cd = c & d;
|
|
375
|
-
maj = cd ^ c & a ^ da;
|
|
376
|
-
ch = g & h ^ ~g & e;
|
|
377
|
-
t1 = f + s1 + ch + K[j + 2] + blocks2[j + 2];
|
|
378
|
-
t2 = s0 + maj;
|
|
379
|
-
f = b + t1 << 0;
|
|
380
|
-
b = t1 + t2 << 0;
|
|
381
|
-
s0 = (b >>> 2 | b << 30) ^ (b >>> 13 | b << 19) ^ (b >>> 22 | b << 10);
|
|
382
|
-
s1 = (f >>> 6 | f << 26) ^ (f >>> 11 | f << 21) ^ (f >>> 25 | f << 7);
|
|
383
|
-
bc = b & c;
|
|
384
|
-
maj = bc ^ b & d ^ cd;
|
|
385
|
-
ch = f & g ^ ~f & h;
|
|
386
|
-
t1 = e + s1 + ch + K[j + 3] + blocks2[j + 3];
|
|
387
|
-
t2 = s0 + maj;
|
|
388
|
-
e = a + t1 << 0;
|
|
389
|
-
a = t1 + t2 << 0;
|
|
390
|
-
this.chromeBugWorkAround = true;
|
|
391
|
-
}
|
|
392
|
-
this.h0 = this.h0 + a << 0;
|
|
393
|
-
this.h1 = this.h1 + b << 0;
|
|
394
|
-
this.h2 = this.h2 + c << 0;
|
|
395
|
-
this.h3 = this.h3 + d << 0;
|
|
396
|
-
this.h4 = this.h4 + e << 0;
|
|
397
|
-
this.h5 = this.h5 + f << 0;
|
|
398
|
-
this.h6 = this.h6 + g << 0;
|
|
399
|
-
this.h7 = this.h7 + h << 0;
|
|
400
|
-
};
|
|
401
|
-
Sha256.prototype.hex = function() {
|
|
402
|
-
this.finalize();
|
|
403
|
-
var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3, h4 = this.h4, h5 = this.h5, h6 = this.h6, h7 = this.h7;
|
|
404
|
-
var hex = HEX_CHARS[h0 >>> 28 & 15] + HEX_CHARS[h0 >>> 24 & 15] + HEX_CHARS[h0 >>> 20 & 15] + HEX_CHARS[h0 >>> 16 & 15] + HEX_CHARS[h0 >>> 12 & 15] + HEX_CHARS[h0 >>> 8 & 15] + HEX_CHARS[h0 >>> 4 & 15] + HEX_CHARS[h0 & 15] + HEX_CHARS[h1 >>> 28 & 15] + HEX_CHARS[h1 >>> 24 & 15] + HEX_CHARS[h1 >>> 20 & 15] + HEX_CHARS[h1 >>> 16 & 15] + HEX_CHARS[h1 >>> 12 & 15] + HEX_CHARS[h1 >>> 8 & 15] + HEX_CHARS[h1 >>> 4 & 15] + HEX_CHARS[h1 & 15] + HEX_CHARS[h2 >>> 28 & 15] + HEX_CHARS[h2 >>> 24 & 15] + HEX_CHARS[h2 >>> 20 & 15] + HEX_CHARS[h2 >>> 16 & 15] + HEX_CHARS[h2 >>> 12 & 15] + HEX_CHARS[h2 >>> 8 & 15] + HEX_CHARS[h2 >>> 4 & 15] + HEX_CHARS[h2 & 15] + HEX_CHARS[h3 >>> 28 & 15] + HEX_CHARS[h3 >>> 24 & 15] + HEX_CHARS[h3 >>> 20 & 15] + HEX_CHARS[h3 >>> 16 & 15] + HEX_CHARS[h3 >>> 12 & 15] + HEX_CHARS[h3 >>> 8 & 15] + HEX_CHARS[h3 >>> 4 & 15] + HEX_CHARS[h3 & 15] + HEX_CHARS[h4 >>> 28 & 15] + HEX_CHARS[h4 >>> 24 & 15] + HEX_CHARS[h4 >>> 20 & 15] + HEX_CHARS[h4 >>> 16 & 15] + HEX_CHARS[h4 >>> 12 & 15] + HEX_CHARS[h4 >>> 8 & 15] + HEX_CHARS[h4 >>> 4 & 15] + HEX_CHARS[h4 & 15] + HEX_CHARS[h5 >>> 28 & 15] + HEX_CHARS[h5 >>> 24 & 15] + HEX_CHARS[h5 >>> 20 & 15] + HEX_CHARS[h5 >>> 16 & 15] + HEX_CHARS[h5 >>> 12 & 15] + HEX_CHARS[h5 >>> 8 & 15] + HEX_CHARS[h5 >>> 4 & 15] + HEX_CHARS[h5 & 15] + HEX_CHARS[h6 >>> 28 & 15] + HEX_CHARS[h6 >>> 24 & 15] + HEX_CHARS[h6 >>> 20 & 15] + HEX_CHARS[h6 >>> 16 & 15] + HEX_CHARS[h6 >>> 12 & 15] + HEX_CHARS[h6 >>> 8 & 15] + HEX_CHARS[h6 >>> 4 & 15] + HEX_CHARS[h6 & 15];
|
|
405
|
-
if (!this.is224) {
|
|
406
|
-
hex += HEX_CHARS[h7 >>> 28 & 15] + HEX_CHARS[h7 >>> 24 & 15] + HEX_CHARS[h7 >>> 20 & 15] + HEX_CHARS[h7 >>> 16 & 15] + HEX_CHARS[h7 >>> 12 & 15] + HEX_CHARS[h7 >>> 8 & 15] + HEX_CHARS[h7 >>> 4 & 15] + HEX_CHARS[h7 & 15];
|
|
407
|
-
}
|
|
408
|
-
return hex;
|
|
409
|
-
};
|
|
410
|
-
Sha256.prototype.toString = Sha256.prototype.hex;
|
|
411
|
-
Sha256.prototype.digest = function() {
|
|
412
|
-
this.finalize();
|
|
413
|
-
var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3, h4 = this.h4, h5 = this.h5, h6 = this.h6, h7 = this.h7;
|
|
414
|
-
var arr = [
|
|
415
|
-
h0 >>> 24 & 255,
|
|
416
|
-
h0 >>> 16 & 255,
|
|
417
|
-
h0 >>> 8 & 255,
|
|
418
|
-
h0 & 255,
|
|
419
|
-
h1 >>> 24 & 255,
|
|
420
|
-
h1 >>> 16 & 255,
|
|
421
|
-
h1 >>> 8 & 255,
|
|
422
|
-
h1 & 255,
|
|
423
|
-
h2 >>> 24 & 255,
|
|
424
|
-
h2 >>> 16 & 255,
|
|
425
|
-
h2 >>> 8 & 255,
|
|
426
|
-
h2 & 255,
|
|
427
|
-
h3 >>> 24 & 255,
|
|
428
|
-
h3 >>> 16 & 255,
|
|
429
|
-
h3 >>> 8 & 255,
|
|
430
|
-
h3 & 255,
|
|
431
|
-
h4 >>> 24 & 255,
|
|
432
|
-
h4 >>> 16 & 255,
|
|
433
|
-
h4 >>> 8 & 255,
|
|
434
|
-
h4 & 255,
|
|
435
|
-
h5 >>> 24 & 255,
|
|
436
|
-
h5 >>> 16 & 255,
|
|
437
|
-
h5 >>> 8 & 255,
|
|
438
|
-
h5 & 255,
|
|
439
|
-
h6 >>> 24 & 255,
|
|
440
|
-
h6 >>> 16 & 255,
|
|
441
|
-
h6 >>> 8 & 255,
|
|
442
|
-
h6 & 255
|
|
443
|
-
];
|
|
444
|
-
if (!this.is224) {
|
|
445
|
-
arr.push(h7 >>> 24 & 255, h7 >>> 16 & 255, h7 >>> 8 & 255, h7 & 255);
|
|
446
|
-
}
|
|
447
|
-
return arr;
|
|
448
|
-
};
|
|
449
|
-
Sha256.prototype.array = Sha256.prototype.digest;
|
|
450
|
-
Sha256.prototype.arrayBuffer = function() {
|
|
451
|
-
this.finalize();
|
|
452
|
-
var buffer = new ArrayBuffer(this.is224 ? 28 : 32);
|
|
453
|
-
var dataView = new DataView(buffer);
|
|
454
|
-
dataView.setUint32(0, this.h0);
|
|
455
|
-
dataView.setUint32(4, this.h1);
|
|
456
|
-
dataView.setUint32(8, this.h2);
|
|
457
|
-
dataView.setUint32(12, this.h3);
|
|
458
|
-
dataView.setUint32(16, this.h4);
|
|
459
|
-
dataView.setUint32(20, this.h5);
|
|
460
|
-
dataView.setUint32(24, this.h6);
|
|
461
|
-
if (!this.is224) {
|
|
462
|
-
dataView.setUint32(28, this.h7);
|
|
463
|
-
}
|
|
464
|
-
return buffer;
|
|
465
|
-
};
|
|
466
|
-
function HmacSha256(key, is224, sharedMemory) {
|
|
467
|
-
var i, type = typeof key;
|
|
468
|
-
if (type === "string") {
|
|
469
|
-
var bytes = [], length = key.length, index = 0, code;
|
|
470
|
-
for (i = 0; i < length; ++i) {
|
|
471
|
-
code = key.charCodeAt(i);
|
|
472
|
-
if (code < 128) {
|
|
473
|
-
bytes[index++] = code;
|
|
474
|
-
} else if (code < 2048) {
|
|
475
|
-
bytes[index++] = 192 | code >>> 6;
|
|
476
|
-
bytes[index++] = 128 | code & 63;
|
|
477
|
-
} else if (code < 55296 || code >= 57344) {
|
|
478
|
-
bytes[index++] = 224 | code >>> 12;
|
|
479
|
-
bytes[index++] = 128 | code >>> 6 & 63;
|
|
480
|
-
bytes[index++] = 128 | code & 63;
|
|
481
|
-
} else {
|
|
482
|
-
code = 65536 + ((code & 1023) << 10 | key.charCodeAt(++i) & 1023);
|
|
483
|
-
bytes[index++] = 240 | code >>> 18;
|
|
484
|
-
bytes[index++] = 128 | code >>> 12 & 63;
|
|
485
|
-
bytes[index++] = 128 | code >>> 6 & 63;
|
|
486
|
-
bytes[index++] = 128 | code & 63;
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
key = bytes;
|
|
490
|
-
} else {
|
|
491
|
-
if (type === "object") {
|
|
492
|
-
if (key === null) {
|
|
493
|
-
throw new Error(ERROR);
|
|
494
|
-
} else if (ARRAY_BUFFER && key.constructor === ArrayBuffer) {
|
|
495
|
-
key = new Uint8Array(key);
|
|
496
|
-
} else if (!Array.isArray(key)) {
|
|
497
|
-
if (!ARRAY_BUFFER || !ArrayBuffer.isView(key)) {
|
|
498
|
-
throw new Error(ERROR);
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
} else {
|
|
502
|
-
throw new Error(ERROR);
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
if (key.length > 64) {
|
|
506
|
-
key = new Sha256(is224, true).update(key).array();
|
|
507
|
-
}
|
|
508
|
-
var oKeyPad = [], iKeyPad = [];
|
|
509
|
-
for (i = 0; i < 64; ++i) {
|
|
510
|
-
var b = key[i] || 0;
|
|
511
|
-
oKeyPad[i] = 92 ^ b;
|
|
512
|
-
iKeyPad[i] = 54 ^ b;
|
|
513
|
-
}
|
|
514
|
-
Sha256.call(this, is224, sharedMemory);
|
|
515
|
-
this.update(iKeyPad);
|
|
516
|
-
this.oKeyPad = oKeyPad;
|
|
517
|
-
this.inner = true;
|
|
518
|
-
this.sharedMemory = sharedMemory;
|
|
519
|
-
}
|
|
520
|
-
HmacSha256.prototype = new Sha256();
|
|
521
|
-
HmacSha256.prototype.finalize = function() {
|
|
522
|
-
Sha256.prototype.finalize.call(this);
|
|
523
|
-
if (this.inner) {
|
|
524
|
-
this.inner = false;
|
|
525
|
-
var innerHash = this.array();
|
|
526
|
-
Sha256.call(this, this.is224, this.sharedMemory);
|
|
527
|
-
this.update(this.oKeyPad);
|
|
528
|
-
this.update(innerHash);
|
|
529
|
-
Sha256.prototype.finalize.call(this);
|
|
530
|
-
}
|
|
531
|
-
};
|
|
532
|
-
var exports2 = createMethod();
|
|
533
|
-
exports2.sha256 = exports2;
|
|
534
|
-
exports2.sha224 = createMethod(true);
|
|
535
|
-
exports2.sha256.hmac = createHmacMethod();
|
|
536
|
-
exports2.sha224.hmac = createHmacMethod(true);
|
|
537
|
-
if (COMMON_JS) {
|
|
538
|
-
module2.exports = exports2;
|
|
539
|
-
} else {
|
|
540
|
-
root.sha256 = exports2.sha256;
|
|
541
|
-
root.sha224 = exports2.sha224;
|
|
542
|
-
if (AMD) {
|
|
543
|
-
define(function() {
|
|
544
|
-
return exports2;
|
|
545
|
-
});
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
})();
|
|
549
|
-
}
|
|
550
|
-
});
|
|
551
|
-
|
|
552
|
-
// src/utils.ts
|
|
553
|
-
var utils_exports = {};
|
|
554
|
-
__export(utils_exports, {
|
|
555
|
-
generateHashId: () => generateHashId,
|
|
556
|
-
ifInBrowser: () => ifInBrowser,
|
|
557
|
-
uuid: () => uuid
|
|
558
|
-
});
|
|
559
|
-
module.exports = __toCommonJS(utils_exports);
|
|
560
|
-
var import_js_sha256 = __toESM(require_sha256());
|
|
561
|
-
var ifInBrowser = typeof window !== "undefined";
|
|
1
|
+
import { sha256 } from "js-sha256";
|
|
2
|
+
const ifInBrowser = typeof window !== "undefined";
|
|
562
3
|
function uuid() {
|
|
563
4
|
return Math.random().toString(36).substring(2, 15);
|
|
564
5
|
}
|
|
565
|
-
|
|
6
|
+
const hashMap = {};
|
|
566
7
|
function generateHashId(rect, content = "") {
|
|
567
8
|
const combined = JSON.stringify({
|
|
568
9
|
content,
|
|
@@ -570,7 +11,7 @@ function generateHashId(rect, content = "") {
|
|
|
570
11
|
});
|
|
571
12
|
let sliceLength = 5;
|
|
572
13
|
let slicedHash = "";
|
|
573
|
-
const hashHex =
|
|
14
|
+
const hashHex = sha256.create().update(combined).hex();
|
|
574
15
|
const toLetters = (hex) => {
|
|
575
16
|
return hex.split("").map((char) => {
|
|
576
17
|
const code = Number.parseInt(char, 16);
|
|
@@ -589,21 +30,14 @@ function generateHashId(rect, content = "") {
|
|
|
589
30
|
}
|
|
590
31
|
return slicedHash;
|
|
591
32
|
}
|
|
592
|
-
|
|
593
|
-
|
|
33
|
+
function assert(condition, message) {
|
|
34
|
+
if (!condition) {
|
|
35
|
+
throw new Error(message || "Assertion failed");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
assert,
|
|
594
40
|
generateHashId,
|
|
595
41
|
ifInBrowser,
|
|
596
42
|
uuid
|
|
597
|
-
}
|
|
598
|
-
/*! Bundled license information:
|
|
599
|
-
|
|
600
|
-
js-sha256/src/sha256.js:
|
|
601
|
-
(**
|
|
602
|
-
* [js-sha256]{@link https://github.com/emn178/js-sha256}
|
|
603
|
-
*
|
|
604
|
-
* @version 0.11.0
|
|
605
|
-
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
606
|
-
* @copyright Chen, Yi-Cyuan 2014-2024
|
|
607
|
-
* @license MIT
|
|
608
|
-
*)
|
|
609
|
-
*/
|
|
43
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const TEXT_SIZE_THRESHOLD = 9;
|
|
2
|
+
export declare const TEXT_MAX_SIZE = 40;
|
|
3
|
+
export declare const CONTAINER_MINI_HEIGHT = 3;
|
|
4
|
+
export declare const CONTAINER_MINI_WIDTH = 3;
|
|
5
|
+
export declare enum NodeType {
|
|
6
|
+
CONTAINER = "CONTAINER Node",
|
|
7
|
+
FORM_ITEM = "FORM_ITEM Node",
|
|
8
|
+
BUTTON = "BUTTON Node",
|
|
9
|
+
IMG = "IMG Node",
|
|
10
|
+
TEXT = "TEXT Node",
|
|
11
|
+
POSITION = "POSITION Node"
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NodeType, TEXT_MAX_SIZE, TEXT_SIZE_THRESHOLD, } from '../constants';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function isFormElement(node: globalThis.Node): boolean;
|
|
2
|
+
export declare function isButtonElement(node: globalThis.Node): node is globalThis.HTMLButtonElement;
|
|
3
|
+
export declare function isImgElement(node: globalThis.Node): node is globalThis.HTMLImageElement;
|
|
4
|
+
export declare function isTextElement(node: globalThis.Node): node is globalThis.HTMLTextAreaElement;
|
|
5
|
+
export declare function isContainerElement(node: globalThis.Node): node is globalThis.HTMLElement;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { NodeType } from '../constants';
|
|
2
|
+
export interface ElementInfo {
|
|
3
|
+
id: string;
|
|
4
|
+
indexId: number;
|
|
5
|
+
nodeHashId: string;
|
|
6
|
+
locator: string;
|
|
7
|
+
attributes: {
|
|
8
|
+
nodeType: NodeType;
|
|
9
|
+
[key: string]: string;
|
|
10
|
+
};
|
|
11
|
+
nodeType: NodeType;
|
|
12
|
+
content: string;
|
|
13
|
+
rect: {
|
|
14
|
+
left: number;
|
|
15
|
+
top: number;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
};
|
|
19
|
+
center: [number, number];
|
|
20
|
+
}
|
|
21
|
+
export interface ElementNode {
|
|
22
|
+
node: ElementInfo | null;
|
|
23
|
+
children: ElementNode[];
|
|
24
|
+
}
|
|
25
|
+
export { descriptionOfTree, traverseTree, treeToList } from './tree';
|
|
26
|
+
export { extractTextWithPosition as webExtractTextWithPosition } from './web-extractor';
|
|
27
|
+
export { extractTextWithPosition as clientExtractTextWithPosition } from './client-extractor';
|
|
28
|
+
export { extractTreeNode as webExtractNodeTree } from './web-extractor';
|
|
29
|
+
export { extractTreeNodeAsString as webExtractNodeTreeAsString } from './web-extractor';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BaseElement, ElementTreeNode } from '../types';
|
|
2
|
+
export declare function truncateText(text: string | number | object | undefined, maxLength?: number): string;
|
|
3
|
+
export declare function trimAttributes(attributes: Record<string, any>, truncateTextLength?: number): {
|
|
4
|
+
[key: string]: string;
|
|
5
|
+
nodeType: import("./constants").NodeType;
|
|
6
|
+
};
|
|
7
|
+
export declare function descriptionOfTree<ElementType extends BaseElement = BaseElement>(tree: ElementTreeNode<ElementType>, truncateTextLength?: number, filterNonTextContent?: boolean): string;
|
|
8
|
+
export declare function treeToList<T extends BaseElement>(tree: ElementTreeNode<T>): T[];
|
|
9
|
+
export declare function traverseTree<T extends BaseElement, ReturnNodeType extends BaseElement>(tree: ElementTreeNode<T>, onNode: (node: T) => ReturnNodeType): ElementTreeNode<ReturnNodeType>;
|