@appsurify-testmap/rrweb-snapshot 3.10.0-alpha.1 → 3.12.0-alpha.1
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/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/rrweb-snapshot.cjs +320 -213
- package/dist/rrweb-snapshot.cjs.map +1 -1
- package/dist/rrweb-snapshot.js +320 -213
- package/dist/rrweb-snapshot.js.map +1 -1
- package/dist/rrweb-snapshot.umd.cjs +335 -213
- package/dist/rrweb-snapshot.umd.cjs.map +3 -3
- package/dist/rrweb-snapshot.umd.min.cjs +18 -18
- package/dist/rrweb-snapshot.umd.min.cjs.map +3 -3
- package/package.json +4 -4
|
@@ -210,6 +210,18 @@ function describeNode(el) {
|
|
|
210
210
|
const classes = el.classList.length ? "." + Array.from(el.classList).join(".") : "";
|
|
211
211
|
return `${tag}${id}${classes}`;
|
|
212
212
|
}
|
|
213
|
+
function isAncestorOpacityVisible(el, win) {
|
|
214
|
+
var _a;
|
|
215
|
+
let node2 = el.parentElement;
|
|
216
|
+
while (node2) {
|
|
217
|
+
const s = (_a = win.getComputedStyle) == null ? void 0 : _a.call(win, node2);
|
|
218
|
+
if (s && (parseFloat(s.opacity) || 0) <= 0) {
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
node2 = node2.parentElement;
|
|
222
|
+
}
|
|
223
|
+
return true;
|
|
224
|
+
}
|
|
213
225
|
function getElementVisibility(el) {
|
|
214
226
|
var _a2;
|
|
215
227
|
var _a, _b;
|
|
@@ -217,10 +229,12 @@ function getElementVisibility(el) {
|
|
|
217
229
|
const rect = el.getBoundingClientRect();
|
|
218
230
|
const viewportWidth = win.innerWidth || win.document.documentElement.clientWidth || 0;
|
|
219
231
|
const viewportHeight = win.innerHeight || win.document.documentElement.clientHeight || 0;
|
|
220
|
-
const
|
|
232
|
+
const elHasSize = rect.width > 0 && rect.height > 0;
|
|
233
|
+
const isViewportVisible = elHasSize && rect.bottom > 0 && rect.right > 0 && rect.top < viewportHeight && rect.left < viewportWidth;
|
|
221
234
|
const style = (_b = win.getComputedStyle) == null ? void 0 : _b.call(win, el);
|
|
222
|
-
const
|
|
223
|
-
const
|
|
235
|
+
const isOwnStyleVisible = !!style && style.display !== "none" && style.visibility !== "hidden" && (parseFloat(style.opacity) || 0) > 0;
|
|
236
|
+
const isCSSVisible = isOwnStyleVisible && isAncestorOpacityVisible(el, win);
|
|
237
|
+
const isVisible = isCSSVisible && isViewportVisible;
|
|
224
238
|
let ratio = 0;
|
|
225
239
|
if (isVisible) {
|
|
226
240
|
const xOverlap = Math.max(
|
|
@@ -237,6 +251,9 @@ function getElementVisibility(el) {
|
|
|
237
251
|
}
|
|
238
252
|
return {
|
|
239
253
|
isVisible,
|
|
254
|
+
isCSSVisible,
|
|
255
|
+
isViewportVisible,
|
|
256
|
+
hasSize: elHasSize,
|
|
240
257
|
ratio
|
|
241
258
|
};
|
|
242
259
|
}
|
|
@@ -696,19 +713,18 @@ function isTextVisible(n) {
|
|
|
696
713
|
var _a;
|
|
697
714
|
const parent = index.parentNode(n);
|
|
698
715
|
const parentElement2 = parent && parent;
|
|
699
|
-
if (!parentElement2) {
|
|
716
|
+
if (!parentElement2 || parentElement2.nodeType !== Node.ELEMENT_NODE) {
|
|
700
717
|
return false;
|
|
701
718
|
}
|
|
702
|
-
const
|
|
703
|
-
if (!
|
|
719
|
+
const parentVis = isElementVisible(parentElement2);
|
|
720
|
+
if (!parentVis.isVisible) {
|
|
704
721
|
return false;
|
|
705
722
|
}
|
|
706
723
|
const textContent2 = (_a = n.textContent) == null ? void 0 : _a.trim();
|
|
707
724
|
return textContent2 !== "";
|
|
708
725
|
}
|
|
709
726
|
function isElementVisible(el) {
|
|
710
|
-
|
|
711
|
-
return visibility.isVisible;
|
|
727
|
+
return index.getElementVisibility(el);
|
|
712
728
|
}
|
|
713
729
|
const interactiveEvents = [
|
|
714
730
|
"change",
|
|
@@ -824,7 +840,7 @@ try {
|
|
|
824
840
|
}
|
|
825
841
|
} catch (error) {
|
|
826
842
|
}
|
|
827
|
-
const
|
|
843
|
+
const z = {
|
|
828
844
|
ANCHOR: 0.4,
|
|
829
845
|
PATH: 0.3,
|
|
830
846
|
TARGET: 0.2,
|
|
@@ -840,10 +856,10 @@ const I = {
|
|
|
840
856
|
DEPTH_PENALTY_FACTOR: 0.05,
|
|
841
857
|
DEGRADED_SCORE: 0.3
|
|
842
858
|
};
|
|
843
|
-
const
|
|
859
|
+
const bt = {
|
|
844
860
|
MIN_CONFIDENCE_FOR_SKIP: 0.7
|
|
845
861
|
};
|
|
846
|
-
const
|
|
862
|
+
const tt = [
|
|
847
863
|
"form",
|
|
848
864
|
"main",
|
|
849
865
|
"nav",
|
|
@@ -852,7 +868,7 @@ const K = [
|
|
|
852
868
|
"footer",
|
|
853
869
|
"header"
|
|
854
870
|
];
|
|
855
|
-
const
|
|
871
|
+
const et = [
|
|
856
872
|
"form",
|
|
857
873
|
"navigation",
|
|
858
874
|
"main",
|
|
@@ -862,7 +878,7 @@ const J = [
|
|
|
862
878
|
"banner",
|
|
863
879
|
"search"
|
|
864
880
|
];
|
|
865
|
-
const
|
|
881
|
+
const St = [
|
|
866
882
|
// HTML5 Semantic
|
|
867
883
|
"article",
|
|
868
884
|
"aside",
|
|
@@ -968,7 +984,7 @@ const w = {
|
|
|
968
984
|
// Any aria-* attribute (if not above)
|
|
969
985
|
"aria-*": 25
|
|
970
986
|
};
|
|
971
|
-
const
|
|
987
|
+
const Y = /* @__PURE__ */ new Set([
|
|
972
988
|
"id",
|
|
973
989
|
// handled separately
|
|
974
990
|
"class",
|
|
@@ -981,7 +997,7 @@ const V = /* @__PURE__ */ new Set([
|
|
|
981
997
|
// can change
|
|
982
998
|
"contenteditable"
|
|
983
999
|
]);
|
|
984
|
-
const
|
|
1000
|
+
const At = {
|
|
985
1001
|
maxPathDepth: 10,
|
|
986
1002
|
enableSvgFingerprint: true,
|
|
987
1003
|
confidenceThreshold: 0,
|
|
@@ -989,7 +1005,7 @@ const bt = {
|
|
|
989
1005
|
includeUtilityClasses: false,
|
|
990
1006
|
source: "dom-dsl"
|
|
991
1007
|
};
|
|
992
|
-
function
|
|
1008
|
+
function L(r) {
|
|
993
1009
|
if (/^[a-z]+-\d+$/i.test(r) || /^[a-z]+(-[a-z]+)+-\d+$/i.test(r) || /^[a-z]+(_[a-z]+)*_\d+$/i.test(r) || /^\d+$/.test(r) || /^:[a-z0-9]+:$/i.test(r) || /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(r))
|
|
994
1010
|
return true;
|
|
995
1011
|
if (/^[a-z]{1,3}[A-Za-z0-9]{8,}$/.test(r)) {
|
|
@@ -999,7 +1015,7 @@ function P(r) {
|
|
|
999
1015
|
}
|
|
1000
1016
|
return !!(/^radix-/.test(r) || /^mui-\d+$/.test(r));
|
|
1001
1017
|
}
|
|
1002
|
-
const
|
|
1018
|
+
const Z = /* @__PURE__ */ new Set([
|
|
1003
1019
|
"aria-labelledby",
|
|
1004
1020
|
"aria-describedby",
|
|
1005
1021
|
"aria-controls",
|
|
@@ -1013,10 +1029,10 @@ const Q = /* @__PURE__ */ new Set([
|
|
|
1013
1029
|
"aria-errormessage",
|
|
1014
1030
|
"aria-flowto"
|
|
1015
1031
|
]);
|
|
1016
|
-
function
|
|
1017
|
-
return r.trim().split(/\s+/).some((e) =>
|
|
1032
|
+
function K(r) {
|
|
1033
|
+
return r.trim().split(/\s+/).some((e) => L(e));
|
|
1018
1034
|
}
|
|
1019
|
-
class
|
|
1035
|
+
class Ct {
|
|
1020
1036
|
constructor(t, e) {
|
|
1021
1037
|
var _a;
|
|
1022
1038
|
this.maxDepth = (_a = t.maxPathDepth) != null ? _a : 10, this.cache = e;
|
|
@@ -1050,25 +1066,25 @@ class St {
|
|
|
1050
1066
|
if (e === "head" || this.isInsideHead(t)) {
|
|
1051
1067
|
const c = s == null ? void 0 : s.documentElement;
|
|
1052
1068
|
if (c) {
|
|
1053
|
-
const
|
|
1069
|
+
const l = {
|
|
1054
1070
|
element: c,
|
|
1055
1071
|
score: 1,
|
|
1056
1072
|
tier: "A",
|
|
1057
1073
|
depth: 0
|
|
1058
1074
|
};
|
|
1059
|
-
return this.cacheResult(t,
|
|
1075
|
+
return this.cacheResult(t, l), l;
|
|
1060
1076
|
}
|
|
1061
1077
|
}
|
|
1062
1078
|
if (e === "body") {
|
|
1063
1079
|
const c = s == null ? void 0 : s.documentElement;
|
|
1064
1080
|
if (c) {
|
|
1065
|
-
const
|
|
1081
|
+
const l = {
|
|
1066
1082
|
element: c,
|
|
1067
1083
|
score: 1,
|
|
1068
1084
|
tier: "A",
|
|
1069
1085
|
depth: 0
|
|
1070
1086
|
};
|
|
1071
|
-
return this.cacheResult(t,
|
|
1087
|
+
return this.cacheResult(t, l), l;
|
|
1072
1088
|
}
|
|
1073
1089
|
}
|
|
1074
1090
|
let n = t.parentElement, a = 0, i = null;
|
|
@@ -1082,10 +1098,10 @@ class St {
|
|
|
1082
1098
|
};
|
|
1083
1099
|
const c = this.scoreAnchor(n);
|
|
1084
1100
|
if (c > 0) {
|
|
1085
|
-
const
|
|
1086
|
-
if (
|
|
1087
|
-
return
|
|
1088
|
-
(!i ||
|
|
1101
|
+
const l = this.applyDepthPenalty(c, a), f = this.getTier(n), h = { element: n, score: l, tier: f, depth: a };
|
|
1102
|
+
if (f === "A")
|
|
1103
|
+
return h;
|
|
1104
|
+
(!i || l > i.score) && (i = h);
|
|
1089
1105
|
}
|
|
1090
1106
|
n = n.parentElement, a++;
|
|
1091
1107
|
}
|
|
@@ -1100,11 +1116,11 @@ class St {
|
|
|
1100
1116
|
scoreAnchor(t) {
|
|
1101
1117
|
let e = 0;
|
|
1102
1118
|
const s = t.tagName.toLowerCase();
|
|
1103
|
-
|
|
1119
|
+
tt.includes(s) && (e += I.SEMANTIC_TAG);
|
|
1104
1120
|
const n = t.getAttribute("role");
|
|
1105
|
-
n &&
|
|
1121
|
+
n && et.includes(n) && (e += I.ROLE), (t.hasAttribute("aria-label") || t.hasAttribute("aria-labelledby")) && (e += I.ARIA_LABEL);
|
|
1106
1122
|
const a = t.id;
|
|
1107
|
-
return a && !
|
|
1123
|
+
return a && !L(a) && (e += I.STABLE_ID), (t.hasAttribute("data-testid") || t.hasAttribute("data-qa") || t.hasAttribute("data-test")) && (e += I.TEST_MARKER), Math.min(e, 1);
|
|
1108
1124
|
}
|
|
1109
1125
|
/**
|
|
1110
1126
|
* Applies depth penalty to score
|
|
@@ -1121,10 +1137,10 @@ class St {
|
|
|
1121
1137
|
*/
|
|
1122
1138
|
getTier(t) {
|
|
1123
1139
|
const e = t.tagName.toLowerCase();
|
|
1124
|
-
if (
|
|
1140
|
+
if (tt.includes(e))
|
|
1125
1141
|
return "A";
|
|
1126
1142
|
const s = t.getAttribute("role");
|
|
1127
|
-
return s &&
|
|
1143
|
+
return s && et.includes(s) ? "B" : "C";
|
|
1128
1144
|
}
|
|
1129
1145
|
/**
|
|
1130
1146
|
* Checks if element is inside <head> section.
|
|
@@ -1159,7 +1175,7 @@ class St {
|
|
|
1159
1175
|
this.cache && this.cache.setAnchor(t, e);
|
|
1160
1176
|
}
|
|
1161
1177
|
}
|
|
1162
|
-
const
|
|
1178
|
+
const Tt = [
|
|
1163
1179
|
// CSS-in-JS
|
|
1164
1180
|
/^css-[a-z0-9]+$/i,
|
|
1165
1181
|
/^sc-[a-z0-9]+-\d+$/i,
|
|
@@ -1180,7 +1196,7 @@ const At = [
|
|
|
1180
1196
|
/\d{5,}/
|
|
1181
1197
|
// 5+ digits in a row
|
|
1182
1198
|
];
|
|
1183
|
-
const
|
|
1199
|
+
const Et = [
|
|
1184
1200
|
// === FIX 4: Tailwind arbitrary values and variants (highest priority) ===
|
|
1185
1201
|
/^\[/,
|
|
1186
1202
|
// Any arbitrary value or variant starting with [ (e.g., [&_svg]:..., [mask-type:luminance])
|
|
@@ -1292,29 +1308,91 @@ const xt = [
|
|
|
1292
1308
|
/^pull-(left|right)$/,
|
|
1293
1309
|
/^float-(left|right|none)$/
|
|
1294
1310
|
];
|
|
1295
|
-
function
|
|
1296
|
-
return
|
|
1311
|
+
function q(r) {
|
|
1312
|
+
return Tt.some((t) => t.test(r));
|
|
1297
1313
|
}
|
|
1298
|
-
function
|
|
1299
|
-
return r.length <= 2 || /^\d/.test(r) ? true :
|
|
1314
|
+
function U(r) {
|
|
1315
|
+
return r.length <= 2 || /^\d/.test(r) ? true : Et.some((t) => t.test(r));
|
|
1300
1316
|
}
|
|
1301
|
-
function
|
|
1302
|
-
return !
|
|
1317
|
+
function $t(r) {
|
|
1318
|
+
return !q(r) && !U(r);
|
|
1303
1319
|
}
|
|
1304
1320
|
function M(r) {
|
|
1305
|
-
return r.filter((t) =>
|
|
1321
|
+
return r.filter((t) => $t(t));
|
|
1306
1322
|
}
|
|
1307
|
-
function
|
|
1323
|
+
function It(r) {
|
|
1308
1324
|
const t = [], e = [];
|
|
1309
1325
|
for (const s of r)
|
|
1310
|
-
|
|
1326
|
+
U(s) || q(s) ? e.push(s) : t.push(s);
|
|
1311
1327
|
return { semantic: t, utility: e };
|
|
1312
1328
|
}
|
|
1313
|
-
function
|
|
1314
|
-
return
|
|
1329
|
+
function st(r) {
|
|
1330
|
+
return U(r) || q(r);
|
|
1315
1331
|
}
|
|
1316
|
-
const
|
|
1317
|
-
|
|
1332
|
+
const Rt = /* @__PURE__ */ new Set([
|
|
1333
|
+
"tr",
|
|
1334
|
+
"td",
|
|
1335
|
+
"th",
|
|
1336
|
+
"thead",
|
|
1337
|
+
"tbody",
|
|
1338
|
+
"tfoot"
|
|
1339
|
+
]);
|
|
1340
|
+
const Dt = /* @__PURE__ */ new Set([
|
|
1341
|
+
"data-testid",
|
|
1342
|
+
"data-qa",
|
|
1343
|
+
"data-cy",
|
|
1344
|
+
"data-test",
|
|
1345
|
+
"aria-label",
|
|
1346
|
+
"name",
|
|
1347
|
+
"href"
|
|
1348
|
+
]);
|
|
1349
|
+
function Mt(r) {
|
|
1350
|
+
if (r.id)
|
|
1351
|
+
return true;
|
|
1352
|
+
if (r.attributes) {
|
|
1353
|
+
for (const t of Object.keys(r.attributes))
|
|
1354
|
+
if (Dt.has(t))
|
|
1355
|
+
return true;
|
|
1356
|
+
}
|
|
1357
|
+
return false;
|
|
1358
|
+
}
|
|
1359
|
+
function Lt(r, t, e) {
|
|
1360
|
+
var _a2;
|
|
1361
|
+
var _a;
|
|
1362
|
+
const s = r.parentElement;
|
|
1363
|
+
if (!s)
|
|
1364
|
+
return true;
|
|
1365
|
+
for (const n of Array.from(s.children)) {
|
|
1366
|
+
if (n === r || n.tagName.toLowerCase() !== t)
|
|
1367
|
+
continue;
|
|
1368
|
+
if (((_a2 = (_a = n.textContent) == null ? void 0 : _a.trim()) != null ? _a2 : "") === e)
|
|
1369
|
+
return false;
|
|
1370
|
+
}
|
|
1371
|
+
return true;
|
|
1372
|
+
}
|
|
1373
|
+
function _(r, t, e) {
|
|
1374
|
+
var _a;
|
|
1375
|
+
if (Rt.has(r))
|
|
1376
|
+
return true;
|
|
1377
|
+
if (Mt(t))
|
|
1378
|
+
return false;
|
|
1379
|
+
if (e) {
|
|
1380
|
+
const s = e.parentElement;
|
|
1381
|
+
if (s) {
|
|
1382
|
+
const n = (_a = t.text) == null ? void 0 : _a.normalized;
|
|
1383
|
+
if (n && Lt(e, r, n))
|
|
1384
|
+
return false;
|
|
1385
|
+
if (Array.from(s.children).some(
|
|
1386
|
+
(i) => i !== e && i.tagName.toLowerCase() === r
|
|
1387
|
+
))
|
|
1388
|
+
return true;
|
|
1389
|
+
}
|
|
1390
|
+
return false;
|
|
1391
|
+
}
|
|
1392
|
+
return true;
|
|
1393
|
+
}
|
|
1394
|
+
const rt = (r) => r.replace(/([#:.[\]@])/g, "\\$1");
|
|
1395
|
+
class Pt {
|
|
1318
1396
|
constructor(t, e) {
|
|
1319
1397
|
var _a;
|
|
1320
1398
|
this.maxDepth = (_a = t.maxPathDepth) != null ? _a : 10, this.cache = e;
|
|
@@ -1350,19 +1428,22 @@ class $t {
|
|
|
1350
1428
|
degraded: true,
|
|
1351
1429
|
degradationReason: "target-not-descendant-of-anchor"
|
|
1352
1430
|
};
|
|
1353
|
-
let
|
|
1354
|
-
return
|
|
1355
|
-
path:
|
|
1356
|
-
const h =
|
|
1431
|
+
let l = this.filterNoise(i);
|
|
1432
|
+
return l = this.ensureUniqueness(i, l, t, e, s), {
|
|
1433
|
+
path: l.map((h) => {
|
|
1434
|
+
const d = h.tagName.toLowerCase(), u = s.extract(h);
|
|
1357
1435
|
let g;
|
|
1358
|
-
if (h) {
|
|
1359
|
-
const m =
|
|
1360
|
-
|
|
1436
|
+
if (_(d, u, h)) {
|
|
1437
|
+
const m = h.parentElement;
|
|
1438
|
+
if (m) {
|
|
1439
|
+
const b = Array.from(m.children).indexOf(h);
|
|
1440
|
+
b !== -1 && (g = b + 1);
|
|
1441
|
+
}
|
|
1361
1442
|
}
|
|
1362
1443
|
return {
|
|
1363
|
-
tag:
|
|
1364
|
-
semantics:
|
|
1365
|
-
score: s.scoreElement(
|
|
1444
|
+
tag: d,
|
|
1445
|
+
semantics: u,
|
|
1446
|
+
score: s.scoreElement(h),
|
|
1366
1447
|
nthChild: g
|
|
1367
1448
|
};
|
|
1368
1449
|
}),
|
|
@@ -1388,27 +1469,27 @@ class $t {
|
|
|
1388
1469
|
return e;
|
|
1389
1470
|
let c;
|
|
1390
1471
|
if (this.cache) {
|
|
1391
|
-
const
|
|
1392
|
-
|
|
1472
|
+
const f = this.cache.getSelectorResults(i);
|
|
1473
|
+
f !== void 0 ? c = f : (c = Array.from(o.querySelectorAll(i)), this.cache.setSelectorResults(i, c));
|
|
1393
1474
|
} else
|
|
1394
1475
|
c = o.querySelectorAll(i);
|
|
1395
1476
|
if (c.length <= 1)
|
|
1396
1477
|
return e;
|
|
1397
|
-
const
|
|
1398
|
-
for (const
|
|
1399
|
-
if (a.scoreElement(
|
|
1478
|
+
const l = t.filter((f) => !e.includes(f));
|
|
1479
|
+
for (const f of l) {
|
|
1480
|
+
if (a.scoreElement(f) < bt.MIN_CONFIDENCE_FOR_SKIP)
|
|
1400
1481
|
continue;
|
|
1401
|
-
const
|
|
1482
|
+
const d = this.insertNodeInOrder(e, f, t), u = this.buildTestSelector(s, d, n);
|
|
1402
1483
|
try {
|
|
1403
|
-
let
|
|
1484
|
+
let g;
|
|
1404
1485
|
if (this.cache) {
|
|
1405
|
-
const m = this.cache.getSelectorResults(
|
|
1406
|
-
m !== void 0 ?
|
|
1486
|
+
const m = this.cache.getSelectorResults(u);
|
|
1487
|
+
m !== void 0 ? g = m : (g = Array.from(o.querySelectorAll(u)), this.cache.setSelectorResults(u, g));
|
|
1407
1488
|
} else
|
|
1408
|
-
|
|
1409
|
-
if (
|
|
1410
|
-
return
|
|
1411
|
-
|
|
1489
|
+
g = o.querySelectorAll(u);
|
|
1490
|
+
if (g.length === 1)
|
|
1491
|
+
return d;
|
|
1492
|
+
g.length < c.length && (e = d);
|
|
1412
1493
|
} catch (e2) {
|
|
1413
1494
|
}
|
|
1414
1495
|
}
|
|
@@ -1442,9 +1523,9 @@ class $t {
|
|
|
1442
1523
|
*/
|
|
1443
1524
|
elementToSelector(t) {
|
|
1444
1525
|
let e = t.tagName.toLowerCase();
|
|
1445
|
-
t.id && !
|
|
1526
|
+
t.id && !L(t.id) && (e += `#${rt(t.id)}`);
|
|
1446
1527
|
for (const s of Array.from(t.classList))
|
|
1447
|
-
|
|
1528
|
+
st(s) || (e += `.${rt(s)}`);
|
|
1448
1529
|
return e;
|
|
1449
1530
|
}
|
|
1450
1531
|
/**
|
|
@@ -1458,7 +1539,7 @@ class $t {
|
|
|
1458
1539
|
*/
|
|
1459
1540
|
shouldInclude(t) {
|
|
1460
1541
|
const e = t.tagName.toLowerCase();
|
|
1461
|
-
return
|
|
1542
|
+
return St.includes(e) ? true : e === "div" || e === "span" ? this.hasSemanticFeatures(t) : false;
|
|
1462
1543
|
}
|
|
1463
1544
|
/**
|
|
1464
1545
|
* Checks if element has meaningful semantic features
|
|
@@ -1471,13 +1552,13 @@ class $t {
|
|
|
1471
1552
|
return true;
|
|
1472
1553
|
if (t.classList.length > 0) {
|
|
1473
1554
|
for (const s of Array.from(t.classList))
|
|
1474
|
-
if (!
|
|
1555
|
+
if (!st(s))
|
|
1475
1556
|
return true;
|
|
1476
1557
|
}
|
|
1477
1558
|
if (t.hasAttribute("data-testid") || t.hasAttribute("data-qa") || t.hasAttribute("data-test"))
|
|
1478
1559
|
return true;
|
|
1479
1560
|
const e = t.id;
|
|
1480
|
-
return !!(e && !
|
|
1561
|
+
return !!(e && !L(e));
|
|
1481
1562
|
}
|
|
1482
1563
|
/**
|
|
1483
1564
|
* Checks if element is inside <head> section.
|
|
@@ -1526,31 +1607,34 @@ class $t {
|
|
|
1526
1607
|
degradationReason: "head-not-found-in-path"
|
|
1527
1608
|
} : {
|
|
1528
1609
|
path: n.map((c) => {
|
|
1529
|
-
const
|
|
1530
|
-
let
|
|
1531
|
-
if (
|
|
1532
|
-
const
|
|
1533
|
-
|
|
1610
|
+
const l = c.tagName.toLowerCase(), f = s.extract(c);
|
|
1611
|
+
let h;
|
|
1612
|
+
if (_(l, f, c)) {
|
|
1613
|
+
const d = c.parentElement;
|
|
1614
|
+
if (d) {
|
|
1615
|
+
const g = Array.from(d.children).indexOf(c);
|
|
1616
|
+
g !== -1 && (h = g + 1);
|
|
1617
|
+
}
|
|
1534
1618
|
}
|
|
1535
1619
|
return {
|
|
1536
|
-
tag:
|
|
1537
|
-
semantics:
|
|
1620
|
+
tag: l,
|
|
1621
|
+
semantics: f,
|
|
1538
1622
|
score: s.scoreElement(c),
|
|
1539
|
-
nthChild:
|
|
1623
|
+
nthChild: h
|
|
1540
1624
|
};
|
|
1541
1625
|
}),
|
|
1542
1626
|
degraded: false
|
|
1543
1627
|
};
|
|
1544
1628
|
}
|
|
1545
1629
|
}
|
|
1546
|
-
function
|
|
1630
|
+
function j(r) {
|
|
1547
1631
|
return r ? r.trim().replace(/[\n\t\r]/g, " ").replace(/\s+/g, " ") : "";
|
|
1548
1632
|
}
|
|
1549
|
-
const
|
|
1633
|
+
const Ht = {
|
|
1550
1634
|
preserveQueryForAbsolute: true,
|
|
1551
1635
|
removeDynamicHashes: true
|
|
1552
1636
|
};
|
|
1553
|
-
function
|
|
1637
|
+
function kt(r) {
|
|
1554
1638
|
return r ? [
|
|
1555
1639
|
/\d{5,}/,
|
|
1556
1640
|
// 5+ digits
|
|
@@ -1564,20 +1648,20 @@ function It(r) {
|
|
|
1564
1648
|
// UUID-like
|
|
1565
1649
|
].some((e) => e.test(r)) : false;
|
|
1566
1650
|
}
|
|
1567
|
-
function
|
|
1651
|
+
function _t(r, t) {
|
|
1568
1652
|
if (!r)
|
|
1569
1653
|
return r;
|
|
1570
1654
|
const e = r.startsWith("http://") || r.startsWith("https://"), [s, n] = r.split("#"), [a, i] = s.split("?");
|
|
1571
1655
|
let o = a;
|
|
1572
|
-
return e && t.preserveQueryForAbsolute && i && (o += `?${i}`), n && (t.removeDynamicHashes &&
|
|
1656
|
+
return e && t.preserveQueryForAbsolute && i && (o += `?${i}`), n && (t.removeDynamicHashes && kt(n) || (o += `#${n}`)), o;
|
|
1573
1657
|
}
|
|
1574
1658
|
function D(r, t, e = {}) {
|
|
1575
1659
|
if (!t)
|
|
1576
1660
|
return t;
|
|
1577
|
-
const s = __spreadValues(__spreadValues({},
|
|
1578
|
-
return r === "href" || r === "src" ?
|
|
1661
|
+
const s = __spreadValues(__spreadValues({}, Ht), e);
|
|
1662
|
+
return r === "href" || r === "src" ? _t(t, s) : t;
|
|
1579
1663
|
}
|
|
1580
|
-
const
|
|
1664
|
+
const Ot = [
|
|
1581
1665
|
"role",
|
|
1582
1666
|
"aria-label",
|
|
1583
1667
|
"aria-labelledby",
|
|
@@ -1589,7 +1673,7 @@ const Dt = [
|
|
|
1589
1673
|
"aria-setsize",
|
|
1590
1674
|
"aria-haspopup"
|
|
1591
1675
|
];
|
|
1592
|
-
const
|
|
1676
|
+
const qt = [
|
|
1593
1677
|
"aria-selected",
|
|
1594
1678
|
"aria-checked",
|
|
1595
1679
|
"aria-pressed",
|
|
@@ -1603,7 +1687,7 @@ const Mt = [
|
|
|
1603
1687
|
"aria-live",
|
|
1604
1688
|
"aria-atomic"
|
|
1605
1689
|
];
|
|
1606
|
-
const
|
|
1690
|
+
const Ut = [
|
|
1607
1691
|
"data-state",
|
|
1608
1692
|
"data-active",
|
|
1609
1693
|
"data-inactive",
|
|
@@ -1623,7 +1707,7 @@ const Pt = [
|
|
|
1623
1707
|
"data-orientation",
|
|
1624
1708
|
"data-theme"
|
|
1625
1709
|
];
|
|
1626
|
-
const
|
|
1710
|
+
const zt = [
|
|
1627
1711
|
"data-radix-",
|
|
1628
1712
|
"data-headlessui-",
|
|
1629
1713
|
"data-reach-",
|
|
@@ -1632,7 +1716,7 @@ const Ht = [
|
|
|
1632
1716
|
"data-mantine-",
|
|
1633
1717
|
"data-tw-"
|
|
1634
1718
|
];
|
|
1635
|
-
const
|
|
1719
|
+
const Ft = [
|
|
1636
1720
|
"data-testid",
|
|
1637
1721
|
"data-test-id",
|
|
1638
1722
|
"data-test",
|
|
@@ -1645,7 +1729,7 @@ const Lt = [
|
|
|
1645
1729
|
"data-product-id",
|
|
1646
1730
|
"data-user-id"
|
|
1647
1731
|
];
|
|
1648
|
-
const
|
|
1732
|
+
const jt = [
|
|
1649
1733
|
// Google Analytics / GTM
|
|
1650
1734
|
"data-ga",
|
|
1651
1735
|
"data-gtm",
|
|
@@ -1682,7 +1766,7 @@ const kt = [
|
|
|
1682
1766
|
"data-segment",
|
|
1683
1767
|
"data-analytics"
|
|
1684
1768
|
];
|
|
1685
|
-
const
|
|
1769
|
+
const Wt = [
|
|
1686
1770
|
"data-category",
|
|
1687
1771
|
// Google Analytics category
|
|
1688
1772
|
"data-action",
|
|
@@ -1692,7 +1776,7 @@ const qt = [
|
|
|
1692
1776
|
"data-value"
|
|
1693
1777
|
// Google Analytics value
|
|
1694
1778
|
];
|
|
1695
|
-
const
|
|
1779
|
+
const Bt = [
|
|
1696
1780
|
"id",
|
|
1697
1781
|
"name",
|
|
1698
1782
|
"type",
|
|
@@ -1702,7 +1786,7 @@ const Ot = [
|
|
|
1702
1786
|
"alt",
|
|
1703
1787
|
"href"
|
|
1704
1788
|
];
|
|
1705
|
-
const
|
|
1789
|
+
const Gt = [
|
|
1706
1790
|
"disabled",
|
|
1707
1791
|
"checked",
|
|
1708
1792
|
"selected",
|
|
@@ -1711,17 +1795,17 @@ const _t = [
|
|
|
1711
1795
|
"required",
|
|
1712
1796
|
"value"
|
|
1713
1797
|
];
|
|
1714
|
-
const
|
|
1798
|
+
const Vt = [
|
|
1715
1799
|
/^radix-/,
|
|
1716
1800
|
/^headlessui-/,
|
|
1717
1801
|
/^mui-/,
|
|
1718
1802
|
/:\w+:/
|
|
1719
1803
|
// matches :ru:, :r1:, etc.
|
|
1720
1804
|
];
|
|
1721
|
-
function
|
|
1722
|
-
return
|
|
1805
|
+
function Qt(r, t) {
|
|
1806
|
+
return Ot.includes(r) ? true : qt.includes(r) || Ut.includes(r) || zt.some((e) => r.startsWith(e)) ? false : Ft.includes(r) ? true : jt.some((e) => r.startsWith(e)) || Wt.includes(r) ? false : r.startsWith("data-") && r.endsWith("-id") ? true : r === "id" ? !Vt.some((e) => e.test(t)) : Bt.includes(r) ? true : Gt.includes(r) ? false : !!r.startsWith("data-");
|
|
1723
1807
|
}
|
|
1724
|
-
class
|
|
1808
|
+
class nt {
|
|
1725
1809
|
constructor(t, e) {
|
|
1726
1810
|
var _a;
|
|
1727
1811
|
this.includeUtilityClasses = (_a = t.includeUtilityClasses) != null ? _a : false, this.cache = e;
|
|
@@ -1738,12 +1822,12 @@ class st {
|
|
|
1738
1822
|
return i;
|
|
1739
1823
|
}
|
|
1740
1824
|
const e = {}, s = t.id;
|
|
1741
|
-
if (s && !
|
|
1825
|
+
if (s && !L(s) && (e.id = s), t.classList.length > 0) {
|
|
1742
1826
|
const i = Array.from(t.classList);
|
|
1743
1827
|
if (this.includeUtilityClasses)
|
|
1744
1828
|
e.classes = i;
|
|
1745
1829
|
else {
|
|
1746
|
-
const { semantic: o } =
|
|
1830
|
+
const { semantic: o } = It(i);
|
|
1747
1831
|
o.length > 0 && (e.classes = o);
|
|
1748
1832
|
}
|
|
1749
1833
|
}
|
|
@@ -1772,7 +1856,7 @@ class st {
|
|
|
1772
1856
|
* @returns True if should be ignored
|
|
1773
1857
|
*/
|
|
1774
1858
|
shouldIgnoreAttribute(t) {
|
|
1775
|
-
return !!(
|
|
1859
|
+
return !!(Y.has(t) || t.startsWith("on") || t.startsWith("ng-") || t.startsWith("_ng") || t.startsWith("data-reactid") || t.startsWith("data-react") || t.startsWith("data-v-"));
|
|
1776
1860
|
}
|
|
1777
1861
|
/**
|
|
1778
1862
|
* Gets attribute priority
|
|
@@ -1807,7 +1891,7 @@ class st {
|
|
|
1807
1891
|
const e = {};
|
|
1808
1892
|
for (const s of Array.from(t.attributes)) {
|
|
1809
1893
|
const n = s.name;
|
|
1810
|
-
if (this.shouldIgnoreAttribute(n) || !
|
|
1894
|
+
if (this.shouldIgnoreAttribute(n) || !Qt(n, s.value) || Z.has(n) && K(s.value) || this.getAttributePriority(n) === 0)
|
|
1811
1895
|
continue;
|
|
1812
1896
|
const i = n === "href" || n === "src" ? D(n, s.value) : s.value;
|
|
1813
1897
|
!i || i.trim() === "" || this.isDynamicValue(i) || (e[n] = i);
|
|
@@ -1821,7 +1905,7 @@ class st {
|
|
|
1821
1905
|
const e = this.getDirectTextContent(t);
|
|
1822
1906
|
if (!e)
|
|
1823
1907
|
return null;
|
|
1824
|
-
const s =
|
|
1908
|
+
const s = j(e);
|
|
1825
1909
|
if (!s)
|
|
1826
1910
|
return null;
|
|
1827
1911
|
const n = 100, a = e.length > n ? e.slice(0, n) + "..." : e, i = s.length > n ? s.slice(0, n) + "..." : s;
|
|
@@ -1871,7 +1955,7 @@ class st {
|
|
|
1871
1955
|
].includes(e);
|
|
1872
1956
|
}
|
|
1873
1957
|
}
|
|
1874
|
-
class
|
|
1958
|
+
class Yt {
|
|
1875
1959
|
/**
|
|
1876
1960
|
* Generates fingerprint for SVG element
|
|
1877
1961
|
* @param element - SVG element to fingerprint
|
|
@@ -1986,11 +2070,11 @@ class Ft {
|
|
|
1986
2070
|
return Math.abs(e).toString(16).padStart(8, "0");
|
|
1987
2071
|
}
|
|
1988
2072
|
}
|
|
1989
|
-
function
|
|
1990
|
-
const e = r.anchor.score, s = r.path.length > 0 ? r.path.reduce((o, c) => o + c.score, 0) / r.path.length : 0.5, n = r.target.score, a = e *
|
|
2073
|
+
function Zt(r, t = 0) {
|
|
2074
|
+
const e = r.anchor.score, s = r.path.length > 0 ? r.path.reduce((o, c) => o + c.score, 0) / r.path.length : 0.5, n = r.target.score, a = e * z.ANCHOR + s * z.PATH + n * z.TARGET + t * z.UNIQUENESS, i = r.anchor.degraded ? 0.2 : 0;
|
|
1991
2075
|
return Math.max(0, Math.min(1, a - i));
|
|
1992
2076
|
}
|
|
1993
|
-
class
|
|
2077
|
+
class Kt {
|
|
1994
2078
|
constructor(t) {
|
|
1995
2079
|
this.cache = /* @__PURE__ */ new Map(), this.maxSize = t;
|
|
1996
2080
|
}
|
|
@@ -2021,10 +2105,10 @@ class Wt {
|
|
|
2021
2105
|
return this.cache.size;
|
|
2022
2106
|
}
|
|
2023
2107
|
}
|
|
2024
|
-
class
|
|
2108
|
+
class Xt {
|
|
2025
2109
|
constructor(t = {}) {
|
|
2026
2110
|
var _a, _b;
|
|
2027
|
-
this.eidCache = /* @__PURE__ */ new WeakMap(), this.selectorResultCache = new
|
|
2111
|
+
this.eidCache = /* @__PURE__ */ new WeakMap(), this.selectorResultCache = new Kt(
|
|
2028
2112
|
(_a = t.maxSelectorCacheSize) != null ? _a : 1e3
|
|
2029
2113
|
), this.anchorCache = /* @__PURE__ */ new WeakMap(), this.semanticsCache = /* @__PURE__ */ new WeakMap(), this.stats = {
|
|
2030
2114
|
eidHits: 0,
|
|
@@ -2172,12 +2256,12 @@ class Bt {
|
|
|
2172
2256
|
return s > 0 ? t / s : 0;
|
|
2173
2257
|
}
|
|
2174
2258
|
}
|
|
2175
|
-
function
|
|
2176
|
-
return new
|
|
2259
|
+
function Jt(r) {
|
|
2260
|
+
return new Xt(r);
|
|
2177
2261
|
}
|
|
2178
|
-
let
|
|
2179
|
-
function
|
|
2180
|
-
return
|
|
2262
|
+
let F = null;
|
|
2263
|
+
function X() {
|
|
2264
|
+
return F || (F = Jt()), F;
|
|
2181
2265
|
}
|
|
2182
2266
|
function k(r) {
|
|
2183
2267
|
if (r.ownerDocument)
|
|
@@ -2195,7 +2279,7 @@ function k(r) {
|
|
|
2195
2279
|
3. You are working with a document node instead of an element`
|
|
2196
2280
|
);
|
|
2197
2281
|
}
|
|
2198
|
-
function
|
|
2282
|
+
function te(r, t) {
|
|
2199
2283
|
if (!t)
|
|
2200
2284
|
return;
|
|
2201
2285
|
const e = k(r), s = t instanceof Document ? t : k(t);
|
|
@@ -2210,66 +2294,67 @@ Common causes:
|
|
|
2210
2294
|
Solution: Ensure element and root parameter are from the same document context.`
|
|
2211
2295
|
);
|
|
2212
2296
|
}
|
|
2213
|
-
function
|
|
2297
|
+
function J(r, t = {}) {
|
|
2214
2298
|
var _a2, _b, _c, _d;
|
|
2215
2299
|
var _a;
|
|
2216
2300
|
if (!r || !r.ownerDocument || !r.isConnected)
|
|
2217
2301
|
return null;
|
|
2218
|
-
const e = __spreadValues(__spreadValues({},
|
|
2302
|
+
const e = __spreadValues(__spreadValues({}, At), t);
|
|
2219
2303
|
if (e.root)
|
|
2220
2304
|
try {
|
|
2221
|
-
|
|
2305
|
+
te(r, e.root);
|
|
2222
2306
|
} catch (x2) {
|
|
2223
2307
|
return console.error("Cross-document generation detected:", x2), null;
|
|
2224
2308
|
}
|
|
2225
|
-
const s = (_a2 = e.cache) != null ? _a2 :
|
|
2309
|
+
const s = (_a2 = e.cache) != null ? _a2 : X(), n = s.getEID(r);
|
|
2226
2310
|
if (n !== void 0)
|
|
2227
2311
|
return n;
|
|
2228
|
-
|
|
2229
|
-
|
|
2312
|
+
const a = r.tagName.toLowerCase();
|
|
2313
|
+
if (a === "html") {
|
|
2314
|
+
const x2 = new nt(e, s), y = re(r, e, x2);
|
|
2230
2315
|
return s.setEID(r, y), y;
|
|
2231
2316
|
}
|
|
2232
|
-
const i = new
|
|
2233
|
-
if (!
|
|
2317
|
+
const i = new Ct(e, s), o = new Pt(e, s), c = new nt(e, s), l = new Yt(), f = i.findAnchor(r);
|
|
2318
|
+
if (!f && !e.fallbackToBody)
|
|
2234
2319
|
return null;
|
|
2235
|
-
const
|
|
2236
|
-
if (!
|
|
2320
|
+
const h = (_c = (_b = f == null ? void 0 : f.element) != null ? _b : (_a = r.ownerDocument) == null ? void 0 : _a.body) != null ? _c : null;
|
|
2321
|
+
if (!h)
|
|
2237
2322
|
return null;
|
|
2238
|
-
const
|
|
2239
|
-
let
|
|
2240
|
-
if (
|
|
2241
|
-
const y = Array.from(
|
|
2242
|
-
y !== -1 && (
|
|
2243
|
-
}
|
|
2244
|
-
const
|
|
2245
|
-
tag:
|
|
2246
|
-
semantics:
|
|
2247
|
-
score: (_d =
|
|
2248
|
-
degraded:
|
|
2249
|
-
nthChild:
|
|
2250
|
-
}, S = o.buildPath(
|
|
2251
|
-
e.enableSvgFingerprint &&
|
|
2323
|
+
const d = !f || f.tier === "C", u = h.tagName.toLowerCase(), g = c.extract(h), m = h.parentElement;
|
|
2324
|
+
let p;
|
|
2325
|
+
if (m && u !== "body" && u !== "html" && _(u, g, h)) {
|
|
2326
|
+
const y = Array.from(m.children).indexOf(h);
|
|
2327
|
+
y !== -1 && (p = y + 1);
|
|
2328
|
+
}
|
|
2329
|
+
const b = {
|
|
2330
|
+
tag: h.tagName.toLowerCase(),
|
|
2331
|
+
semantics: g,
|
|
2332
|
+
score: (_d = f == null ? void 0 : f.score) != null ? _d : I.DEGRADED_SCORE,
|
|
2333
|
+
degraded: d,
|
|
2334
|
+
nthChild: p
|
|
2335
|
+
}, S = o.buildPath(h, r, c), T = c.extract(r);
|
|
2336
|
+
e.enableSvgFingerprint && ee(r) && (T.svg = l.fingerprint(r));
|
|
2252
2337
|
const C = r.parentElement;
|
|
2253
2338
|
let A;
|
|
2254
|
-
if (C) {
|
|
2339
|
+
if (C && _(a, T, r)) {
|
|
2255
2340
|
const y = Array.from(C.children).indexOf(r);
|
|
2256
2341
|
y !== -1 && (A = y + 1);
|
|
2257
2342
|
}
|
|
2258
2343
|
const v = {
|
|
2259
2344
|
tag: r.tagName.toLowerCase(),
|
|
2260
|
-
semantics:
|
|
2345
|
+
semantics: T,
|
|
2261
2346
|
score: c.scoreElement(r),
|
|
2262
2347
|
nthChild: A
|
|
2263
|
-
},
|
|
2348
|
+
}, P = [], $ = {
|
|
2264
2349
|
onMultiple: "best-score",
|
|
2265
2350
|
onMissing: "anchor-only",
|
|
2266
2351
|
maxDepth: 3
|
|
2267
|
-
},
|
|
2352
|
+
}, E = b.degraded || S.degraded, R = se(b.degraded, S), N = {
|
|
2268
2353
|
version: "1.0",
|
|
2269
2354
|
anchor: b,
|
|
2270
2355
|
path: S.path,
|
|
2271
2356
|
target: v,
|
|
2272
|
-
constraints:
|
|
2357
|
+
constraints: P,
|
|
2273
2358
|
fallback: $,
|
|
2274
2359
|
meta: {
|
|
2275
2360
|
confidence: 0,
|
|
@@ -2277,16 +2362,16 @@ function X(r, t = {}) {
|
|
|
2277
2362
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2278
2363
|
generator: "dom-eid@1.0",
|
|
2279
2364
|
source: e.source,
|
|
2280
|
-
degraded:
|
|
2365
|
+
degraded: E,
|
|
2281
2366
|
degradationReason: R
|
|
2282
2367
|
}
|
|
2283
2368
|
};
|
|
2284
|
-
return N.meta.confidence =
|
|
2369
|
+
return N.meta.confidence = Zt(N), N.meta.confidence < e.confidenceThreshold ? null : (s.setEID(r, N), N);
|
|
2285
2370
|
}
|
|
2286
|
-
function
|
|
2371
|
+
function ee(r) {
|
|
2287
2372
|
return r.namespaceURI === "http://www.w3.org/2000/svg" || r.tagName.toLowerCase() === "svg" || r instanceof SVGElement;
|
|
2288
2373
|
}
|
|
2289
|
-
function
|
|
2374
|
+
function se(r, t) {
|
|
2290
2375
|
if (r && t.degraded)
|
|
2291
2376
|
return "anchor-and-path-degraded";
|
|
2292
2377
|
if (r)
|
|
@@ -2294,7 +2379,7 @@ function Yt(r, t) {
|
|
|
2294
2379
|
if (t.degraded)
|
|
2295
2380
|
return t.degradationReason;
|
|
2296
2381
|
}
|
|
2297
|
-
function
|
|
2382
|
+
function re(r, t, e, s) {
|
|
2298
2383
|
const a = {
|
|
2299
2384
|
tag: "html",
|
|
2300
2385
|
semantics: e.extract(r),
|
|
@@ -2323,91 +2408,124 @@ function Zt(r, t, e, s) {
|
|
|
2323
2408
|
}
|
|
2324
2409
|
};
|
|
2325
2410
|
}
|
|
2326
|
-
const
|
|
2411
|
+
const ht = {
|
|
2412
|
+
id: "i",
|
|
2413
|
+
"data-testid": "tid",
|
|
2414
|
+
"data-qa": "qa",
|
|
2415
|
+
"data-cy": "cy",
|
|
2416
|
+
"data-test": "dt",
|
|
2417
|
+
"aria-label": "al",
|
|
2418
|
+
"aria-labelledby": "alb",
|
|
2419
|
+
"aria-describedby": "adb",
|
|
2420
|
+
name: "n",
|
|
2421
|
+
href: "h",
|
|
2422
|
+
src: "s",
|
|
2423
|
+
type: "t",
|
|
2424
|
+
role: "r",
|
|
2425
|
+
alt: "at",
|
|
2426
|
+
title: "tt",
|
|
2427
|
+
for: "f",
|
|
2428
|
+
placeholder: "ph",
|
|
2429
|
+
text: "x"
|
|
2430
|
+
};
|
|
2431
|
+
const G = Object.fromEntries(
|
|
2432
|
+
Object.entries(ht).map(([r, t]) => [t, r])
|
|
2433
|
+
);
|
|
2434
|
+
const ut = {
|
|
2327
2435
|
maxClasses: 2,
|
|
2328
2436
|
maxAttributes: 5,
|
|
2329
2437
|
includeText: true,
|
|
2330
2438
|
maxTextLength: 50,
|
|
2331
2439
|
simplifyTarget: true,
|
|
2332
|
-
includeConstraints: true
|
|
2440
|
+
includeConstraints: true,
|
|
2441
|
+
format: "compact"
|
|
2333
2442
|
};
|
|
2334
|
-
function
|
|
2443
|
+
function ct(r) {
|
|
2335
2444
|
return r === "id" ? 101 : w[r] !== void 0 ? w[r] : r.startsWith("data-") ? w["data-*"] : r.startsWith("aria-") ? w["aria-*"] : 0;
|
|
2336
2445
|
}
|
|
2337
|
-
function
|
|
2446
|
+
function de(r) {
|
|
2338
2447
|
return ["id", "data-testid", "data-qa", "data-cy", "href", "text", "role"].includes(r);
|
|
2339
2448
|
}
|
|
2340
|
-
function
|
|
2449
|
+
function fe(r) {
|
|
2341
2450
|
return !!(/@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/.test(r) || /(\+?\d{1,3}[-.\s]?)?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}/.test(r) || /\d{4}[-\s]?\d{4}[-\s]?\d{4}[-\s]?\d{4}/.test(r));
|
|
2342
2451
|
}
|
|
2343
|
-
function
|
|
2344
|
-
const e = __spreadValues(__spreadValues({},
|
|
2345
|
-
return `${
|
|
2346
|
-
}
|
|
2347
|
-
function
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2452
|
+
function ge(r, t) {
|
|
2453
|
+
const e = __spreadValues(__spreadValues({}, ut), t), s = e.format === "compact", n = s ? "v1" : `v${r.version}`, a = s ? ":" : ": ", i = s ? "::" : " :: ", o = s ? ">" : " > ", c = e.includeText && r.target.semantics.text ? r.target.semantics.text.normalized : void 0, l = W(r.anchor, false, e), f = r.path.length > 0 ? r.path.map((u) => W(u, false, e, c)).join(o) + o : "", h = W(r.target, true, e), d = e.includeConstraints ? pe(r, e) : "";
|
|
2454
|
+
return `${n}${a}${l}${i}${f}${h}${d}`;
|
|
2455
|
+
}
|
|
2456
|
+
function W(r, t = false, e = ut, s) {
|
|
2457
|
+
var _a;
|
|
2458
|
+
const { tag: n, semantics: a } = r, i = e.format === "compact";
|
|
2459
|
+
let o = n;
|
|
2460
|
+
const c = [], l = __spreadValues({}, a.attributes);
|
|
2461
|
+
a.id && (l.id = a.id), a.role && !l.role && (l.role = a.role);
|
|
2462
|
+
const f = Object.entries(l).map(([u, g]) => {
|
|
2463
|
+
const m = ct(u), p = u === "href" || u === "src" ? D(u, g) : g;
|
|
2464
|
+
return { name: u, value: p, priority: m };
|
|
2465
|
+
}).filter((u) => u.name !== "id" && u.name !== "class" && Y.has(u.name) || Z.has(u.name) && K(u.value) ? false : u.priority > 0 || u.name === "role" || u.name === "id");
|
|
2466
|
+
f.sort((u, g) => g.priority - u.priority);
|
|
2467
|
+
const h = f.slice(0, e.maxAttributes);
|
|
2468
|
+
h.sort((u, g) => u.name.localeCompare(g.name));
|
|
2469
|
+
for (const { name: u, value: g } of h) {
|
|
2470
|
+
const m = i ? (_a = ht[u]) != null ? _a : u : u;
|
|
2471
|
+
c.push(`${m}="${V(g)}"`);
|
|
2472
|
+
}
|
|
2473
|
+
if (e.includeText && a.text && !fe(a.text.normalized)) {
|
|
2474
|
+
const u = a.text.normalized;
|
|
2475
|
+
if (u.length > 0 && u.length <= e.maxTextLength && !(!t && s !== void 0 && u === s)) {
|
|
2476
|
+
const m = i ? "x" : "text";
|
|
2477
|
+
c.push(`${m}="${V(u)}"`);
|
|
2478
|
+
}
|
|
2479
|
+
}
|
|
2480
|
+
let d = c;
|
|
2481
|
+
if (c.length > 0 && t && e.simplifyTarget && a.id && (d = c.filter((u) => {
|
|
2482
|
+
var _a2;
|
|
2483
|
+
const g = u.split("=")[0], m = (_a2 = G[g]) != null ? _a2 : g;
|
|
2484
|
+
return ct(m) >= 60 || m === "text" || m === "id" || m === "role";
|
|
2485
|
+
})), a.classes && a.classes.length > 0) {
|
|
2486
|
+
const u = M(a.classes), g = !!a.id || c.some((p) => {
|
|
2487
|
+
var _a2;
|
|
2488
|
+
const b = p.split("=")[0], S = (_a2 = G[b]) != null ? _a2 : b;
|
|
2489
|
+
return S === "href" || S === "data-testid" || S === "text" || S === "role";
|
|
2490
|
+
});
|
|
2491
|
+
if (!(t && e.simplifyTarget && g) && u.length > 0) {
|
|
2492
|
+
const p = u.sort().slice(0, e.maxClasses);
|
|
2493
|
+
o += p.map((b) => `.${b}`).join("");
|
|
2376
2494
|
}
|
|
2377
2495
|
}
|
|
2378
|
-
if (d.length > 0 && (
|
|
2379
|
-
const
|
|
2380
|
-
t && e.simplifyTarget &&
|
|
2496
|
+
if (d.length > 0 && (o += `[${d.join(",")}]`), "nthChild" in r && r.nthChild) {
|
|
2497
|
+
const u = !!a.id || a.attributes && Object.keys(a.attributes).some(de);
|
|
2498
|
+
t && e.simplifyTarget && u || (o += `#${r.nthChild}`);
|
|
2381
2499
|
}
|
|
2382
|
-
return
|
|
2500
|
+
return o;
|
|
2383
2501
|
}
|
|
2384
|
-
function
|
|
2502
|
+
function pe(r, t) {
|
|
2385
2503
|
if (!r.constraints || r.constraints.length === 0)
|
|
2386
2504
|
return "";
|
|
2387
|
-
const
|
|
2388
|
-
for (const
|
|
2389
|
-
switch (
|
|
2505
|
+
const e = [];
|
|
2506
|
+
for (const n of r.constraints)
|
|
2507
|
+
switch (n.type) {
|
|
2390
2508
|
case "uniqueness":
|
|
2391
|
-
|
|
2509
|
+
e.push("unique=true");
|
|
2392
2510
|
break;
|
|
2393
2511
|
case "position":
|
|
2394
|
-
|
|
2512
|
+
n.params && n.params.strategy && e.push(`pos=${n.params.strategy}`);
|
|
2395
2513
|
break;
|
|
2396
2514
|
case "text-proximity":
|
|
2397
|
-
if (
|
|
2398
|
-
const
|
|
2399
|
-
|
|
2515
|
+
if (n.params && n.params.reference) {
|
|
2516
|
+
const a = V(String(n.params.reference));
|
|
2517
|
+
e.push(`text="${a}"`);
|
|
2400
2518
|
}
|
|
2401
2519
|
break;
|
|
2402
2520
|
}
|
|
2403
|
-
return
|
|
2521
|
+
return e.length === 0 ? "" : `${t.format === "verbose" ? " " : ""}{${e.join(",")}}`;
|
|
2404
2522
|
}
|
|
2405
|
-
function
|
|
2523
|
+
function V(r) {
|
|
2406
2524
|
return r.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/>/g, "\\>").replace(/:/g, "\\:");
|
|
2407
2525
|
}
|
|
2408
|
-
function
|
|
2409
|
-
const s =
|
|
2410
|
-
return s ?
|
|
2526
|
+
function Ne(r, t, e) {
|
|
2527
|
+
const s = J(r, t);
|
|
2528
|
+
return s ? ge(s, e) : null;
|
|
2411
2529
|
}
|
|
2412
2530
|
let _id = 1;
|
|
2413
2531
|
const tagNameRegex = new RegExp("[^a-z0-9-_:]");
|
|
@@ -3095,7 +3213,7 @@ function serializeNodeWithId(n, options) {
|
|
|
3095
3213
|
enableSvgFingerprint: selectorOptions.enableSvgFingerprint,
|
|
3096
3214
|
fallbackToBody: selectorOptions.fallbackToBody
|
|
3097
3215
|
};
|
|
3098
|
-
const selector =
|
|
3216
|
+
const selector = Ne(n, seqlGeneratorOptions);
|
|
3099
3217
|
if (selector) {
|
|
3100
3218
|
serializedNode.selector = selector;
|
|
3101
3219
|
}
|
|
@@ -3107,7 +3225,11 @@ function serializeNodeWithId(n, options) {
|
|
|
3107
3225
|
serializedNode.isVisible = isTextVisible(n);
|
|
3108
3226
|
}
|
|
3109
3227
|
if (n.nodeType === Node.ELEMENT_NODE) {
|
|
3110
|
-
|
|
3228
|
+
const vis = isElementVisible(n);
|
|
3229
|
+
serializedNode.isVisible = vis.isVisible;
|
|
3230
|
+
serializedNode.isCSSVisible = vis.isCSSVisible;
|
|
3231
|
+
serializedNode.isViewportVisible = vis.isViewportVisible;
|
|
3232
|
+
serializedNode.hasSize = vis.hasSize;
|
|
3111
3233
|
serializedNode.isInteractive = isElementInteractive(n);
|
|
3112
3234
|
}
|
|
3113
3235
|
}
|