@appsurify-testmap/rrweb-snapshot 3.6.0-alpha.1 → 3.11.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/rrweb-snapshot.cjs +291 -204
- package/dist/rrweb-snapshot.cjs.map +1 -1
- package/dist/rrweb-snapshot.js +291 -204
- package/dist/rrweb-snapshot.js.map +1 -1
- package/dist/rrweb-snapshot.umd.cjs +306 -204
- package/dist/rrweb-snapshot.umd.cjs.map +2 -2
- package/dist/rrweb-snapshot.umd.min.cjs +18 -18
- package/dist/rrweb-snapshot.umd.min.cjs.map +3 -3
- package/package.json +4 -4
package/dist/rrweb-snapshot.cjs
CHANGED
|
@@ -777,7 +777,7 @@ try {
|
|
|
777
777
|
}
|
|
778
778
|
} catch (error) {
|
|
779
779
|
}
|
|
780
|
-
const
|
|
780
|
+
const z = {
|
|
781
781
|
ANCHOR: 0.4,
|
|
782
782
|
PATH: 0.3,
|
|
783
783
|
TARGET: 0.2,
|
|
@@ -791,9 +791,9 @@ const U = {
|
|
|
791
791
|
DEPTH_PENALTY_THRESHOLD: 5,
|
|
792
792
|
DEPTH_PENALTY_FACTOR: 0.05,
|
|
793
793
|
DEGRADED_SCORE: 0.3
|
|
794
|
-
},
|
|
794
|
+
}, bt = {
|
|
795
795
|
MIN_CONFIDENCE_FOR_SKIP: 0.7
|
|
796
|
-
},
|
|
796
|
+
}, tt = [
|
|
797
797
|
"form",
|
|
798
798
|
"main",
|
|
799
799
|
"nav",
|
|
@@ -801,7 +801,7 @@ const U = {
|
|
|
801
801
|
"article",
|
|
802
802
|
"footer",
|
|
803
803
|
"header"
|
|
804
|
-
],
|
|
804
|
+
], et = [
|
|
805
805
|
"form",
|
|
806
806
|
"navigation",
|
|
807
807
|
"main",
|
|
@@ -810,7 +810,7 @@ const U = {
|
|
|
810
810
|
"complementary",
|
|
811
811
|
"banner",
|
|
812
812
|
"search"
|
|
813
|
-
],
|
|
813
|
+
], St = [
|
|
814
814
|
// HTML5 Semantic
|
|
815
815
|
"article",
|
|
816
816
|
"aside",
|
|
@@ -914,7 +914,7 @@ const U = {
|
|
|
914
914
|
"data-*": 30,
|
|
915
915
|
// Any aria-* attribute (if not above)
|
|
916
916
|
"aria-*": 25
|
|
917
|
-
},
|
|
917
|
+
}, Y = /* @__PURE__ */ new Set([
|
|
918
918
|
"id",
|
|
919
919
|
// handled separately
|
|
920
920
|
"class",
|
|
@@ -926,7 +926,7 @@ const U = {
|
|
|
926
926
|
"tabindex",
|
|
927
927
|
// can change
|
|
928
928
|
"contenteditable"
|
|
929
|
-
]),
|
|
929
|
+
]), At = {
|
|
930
930
|
maxPathDepth: 10,
|
|
931
931
|
enableSvgFingerprint: true,
|
|
932
932
|
confidenceThreshold: 0,
|
|
@@ -934,7 +934,7 @@ const U = {
|
|
|
934
934
|
includeUtilityClasses: false,
|
|
935
935
|
source: "dom-dsl"
|
|
936
936
|
};
|
|
937
|
-
function
|
|
937
|
+
function L(r) {
|
|
938
938
|
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))
|
|
939
939
|
return true;
|
|
940
940
|
if (/^[a-z]{1,3}[A-Za-z0-9]{8,}$/.test(r)) {
|
|
@@ -944,7 +944,7 @@ function P(r) {
|
|
|
944
944
|
}
|
|
945
945
|
return !!(/^radix-/.test(r) || /^mui-\d+$/.test(r));
|
|
946
946
|
}
|
|
947
|
-
const
|
|
947
|
+
const Z = /* @__PURE__ */ new Set([
|
|
948
948
|
"aria-labelledby",
|
|
949
949
|
"aria-describedby",
|
|
950
950
|
"aria-controls",
|
|
@@ -958,10 +958,10 @@ const Q = /* @__PURE__ */ new Set([
|
|
|
958
958
|
"aria-errormessage",
|
|
959
959
|
"aria-flowto"
|
|
960
960
|
]);
|
|
961
|
-
function
|
|
962
|
-
return r.trim().split(/\s+/).some((e) =>
|
|
961
|
+
function K(r) {
|
|
962
|
+
return r.trim().split(/\s+/).some((e) => L(e));
|
|
963
963
|
}
|
|
964
|
-
class
|
|
964
|
+
class Ct {
|
|
965
965
|
constructor(t, e) {
|
|
966
966
|
this.maxDepth = t.maxPathDepth ?? 10, this.cache = e;
|
|
967
967
|
}
|
|
@@ -994,25 +994,25 @@ class St {
|
|
|
994
994
|
if (e === "head" || this.isInsideHead(t)) {
|
|
995
995
|
const c = s == null ? void 0 : s.documentElement;
|
|
996
996
|
if (c) {
|
|
997
|
-
const
|
|
997
|
+
const l = {
|
|
998
998
|
element: c,
|
|
999
999
|
score: 1,
|
|
1000
1000
|
tier: "A",
|
|
1001
1001
|
depth: 0
|
|
1002
1002
|
};
|
|
1003
|
-
return this.cacheResult(t,
|
|
1003
|
+
return this.cacheResult(t, l), l;
|
|
1004
1004
|
}
|
|
1005
1005
|
}
|
|
1006
1006
|
if (e === "body") {
|
|
1007
1007
|
const c = s == null ? void 0 : s.documentElement;
|
|
1008
1008
|
if (c) {
|
|
1009
|
-
const
|
|
1009
|
+
const l = {
|
|
1010
1010
|
element: c,
|
|
1011
1011
|
score: 1,
|
|
1012
1012
|
tier: "A",
|
|
1013
1013
|
depth: 0
|
|
1014
1014
|
};
|
|
1015
|
-
return this.cacheResult(t,
|
|
1015
|
+
return this.cacheResult(t, l), l;
|
|
1016
1016
|
}
|
|
1017
1017
|
}
|
|
1018
1018
|
let n = t.parentElement, a = 0, i = null;
|
|
@@ -1026,10 +1026,10 @@ class St {
|
|
|
1026
1026
|
};
|
|
1027
1027
|
const c = this.scoreAnchor(n);
|
|
1028
1028
|
if (c > 0) {
|
|
1029
|
-
const
|
|
1030
|
-
if (
|
|
1031
|
-
return
|
|
1032
|
-
(!i ||
|
|
1029
|
+
const l = this.applyDepthPenalty(c, a), f = this.getTier(n), h = { element: n, score: l, tier: f, depth: a };
|
|
1030
|
+
if (f === "A")
|
|
1031
|
+
return h;
|
|
1032
|
+
(!i || l > i.score) && (i = h);
|
|
1033
1033
|
}
|
|
1034
1034
|
n = n.parentElement, a++;
|
|
1035
1035
|
}
|
|
@@ -1044,11 +1044,11 @@ class St {
|
|
|
1044
1044
|
scoreAnchor(t) {
|
|
1045
1045
|
let e = 0;
|
|
1046
1046
|
const s = t.tagName.toLowerCase();
|
|
1047
|
-
|
|
1047
|
+
tt.includes(s) && (e += I.SEMANTIC_TAG);
|
|
1048
1048
|
const n = t.getAttribute("role");
|
|
1049
|
-
n &&
|
|
1049
|
+
n && et.includes(n) && (e += I.ROLE), (t.hasAttribute("aria-label") || t.hasAttribute("aria-labelledby")) && (e += I.ARIA_LABEL);
|
|
1050
1050
|
const a = t.id;
|
|
1051
|
-
return a && !
|
|
1051
|
+
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);
|
|
1052
1052
|
}
|
|
1053
1053
|
/**
|
|
1054
1054
|
* Applies depth penalty to score
|
|
@@ -1065,10 +1065,10 @@ class St {
|
|
|
1065
1065
|
*/
|
|
1066
1066
|
getTier(t) {
|
|
1067
1067
|
const e = t.tagName.toLowerCase();
|
|
1068
|
-
if (
|
|
1068
|
+
if (tt.includes(e))
|
|
1069
1069
|
return "A";
|
|
1070
1070
|
const s = t.getAttribute("role");
|
|
1071
|
-
return s &&
|
|
1071
|
+
return s && et.includes(s) ? "B" : "C";
|
|
1072
1072
|
}
|
|
1073
1073
|
/**
|
|
1074
1074
|
* Checks if element is inside <head> section.
|
|
@@ -1101,7 +1101,7 @@ class St {
|
|
|
1101
1101
|
this.cache && this.cache.setAnchor(t, e);
|
|
1102
1102
|
}
|
|
1103
1103
|
}
|
|
1104
|
-
const
|
|
1104
|
+
const Tt = [
|
|
1105
1105
|
// CSS-in-JS
|
|
1106
1106
|
/^css-[a-z0-9]+$/i,
|
|
1107
1107
|
/^sc-[a-z0-9]+-\d+$/i,
|
|
@@ -1121,7 +1121,7 @@ const At = [
|
|
|
1121
1121
|
/^_[a-z0-9]{5,}$/i,
|
|
1122
1122
|
/\d{5,}/
|
|
1123
1123
|
// 5+ digits in a row
|
|
1124
|
-
],
|
|
1124
|
+
], Et = [
|
|
1125
1125
|
// === FIX 4: Tailwind arbitrary values and variants (highest priority) ===
|
|
1126
1126
|
/^\[/,
|
|
1127
1127
|
// Any arbitrary value or variant starting with [ (e.g., [&_svg]:..., [mask-type:luminance])
|
|
@@ -1233,29 +1233,81 @@ const At = [
|
|
|
1233
1233
|
/^pull-(left|right)$/,
|
|
1234
1234
|
/^float-(left|right|none)$/
|
|
1235
1235
|
];
|
|
1236
|
-
function
|
|
1237
|
-
return
|
|
1236
|
+
function q(r) {
|
|
1237
|
+
return Tt.some((t) => t.test(r));
|
|
1238
1238
|
}
|
|
1239
|
-
function
|
|
1240
|
-
return r.length <= 2 || /^\d/.test(r) ? true :
|
|
1239
|
+
function U(r) {
|
|
1240
|
+
return r.length <= 2 || /^\d/.test(r) ? true : Et.some((t) => t.test(r));
|
|
1241
1241
|
}
|
|
1242
|
-
function
|
|
1243
|
-
return !
|
|
1242
|
+
function $t(r) {
|
|
1243
|
+
return !q(r) && !U(r);
|
|
1244
1244
|
}
|
|
1245
1245
|
function M(r) {
|
|
1246
|
-
return r.filter((t) =>
|
|
1246
|
+
return r.filter((t) => $t(t));
|
|
1247
1247
|
}
|
|
1248
|
-
function
|
|
1248
|
+
function It(r) {
|
|
1249
1249
|
const t = [], e = [];
|
|
1250
1250
|
for (const s of r)
|
|
1251
|
-
|
|
1251
|
+
U(s) || q(s) ? e.push(s) : t.push(s);
|
|
1252
1252
|
return { semantic: t, utility: e };
|
|
1253
1253
|
}
|
|
1254
|
-
function
|
|
1255
|
-
return
|
|
1254
|
+
function st(r) {
|
|
1255
|
+
return U(r) || q(r);
|
|
1256
|
+
}
|
|
1257
|
+
const Rt = /* @__PURE__ */ new Set([
|
|
1258
|
+
"tr",
|
|
1259
|
+
"td",
|
|
1260
|
+
"th",
|
|
1261
|
+
"thead",
|
|
1262
|
+
"tbody",
|
|
1263
|
+
"tfoot"
|
|
1264
|
+
]), Dt = /* @__PURE__ */ new Set([
|
|
1265
|
+
"data-testid",
|
|
1266
|
+
"data-qa",
|
|
1267
|
+
"data-cy",
|
|
1268
|
+
"data-test",
|
|
1269
|
+
"aria-label",
|
|
1270
|
+
"name",
|
|
1271
|
+
"href"
|
|
1272
|
+
]);
|
|
1273
|
+
function Mt(r) {
|
|
1274
|
+
if (r.id) return true;
|
|
1275
|
+
if (r.attributes) {
|
|
1276
|
+
for (const t of Object.keys(r.attributes))
|
|
1277
|
+
if (Dt.has(t)) return true;
|
|
1278
|
+
}
|
|
1279
|
+
return false;
|
|
1280
|
+
}
|
|
1281
|
+
function Lt(r, t, e) {
|
|
1282
|
+
var _a;
|
|
1283
|
+
const s = r.parentElement;
|
|
1284
|
+
if (!s) return true;
|
|
1285
|
+
for (const n of Array.from(s.children)) {
|
|
1286
|
+
if (n === r || n.tagName.toLowerCase() !== t) continue;
|
|
1287
|
+
if ((((_a = n.textContent) == null ? void 0 : _a.trim()) ?? "") === e) return false;
|
|
1288
|
+
}
|
|
1289
|
+
return true;
|
|
1290
|
+
}
|
|
1291
|
+
function _(r, t, e) {
|
|
1292
|
+
var _a;
|
|
1293
|
+
if (Rt.has(r)) return true;
|
|
1294
|
+
if (Mt(t)) return false;
|
|
1295
|
+
if (e) {
|
|
1296
|
+
const s = e.parentElement;
|
|
1297
|
+
if (s) {
|
|
1298
|
+
const n = (_a = t.text) == null ? void 0 : _a.normalized;
|
|
1299
|
+
if (n && Lt(e, r, n))
|
|
1300
|
+
return false;
|
|
1301
|
+
if (Array.from(s.children).some(
|
|
1302
|
+
(i) => i !== e && i.tagName.toLowerCase() === r
|
|
1303
|
+
)) return true;
|
|
1304
|
+
}
|
|
1305
|
+
return false;
|
|
1306
|
+
}
|
|
1307
|
+
return true;
|
|
1256
1308
|
}
|
|
1257
|
-
const
|
|
1258
|
-
class
|
|
1309
|
+
const rt = (r) => r.replace(/([#:.[\]@])/g, "\\$1");
|
|
1310
|
+
class Pt {
|
|
1259
1311
|
constructor(t, e) {
|
|
1260
1312
|
this.maxDepth = t.maxPathDepth ?? 10, this.cache = e;
|
|
1261
1313
|
}
|
|
@@ -1290,19 +1342,22 @@ class $t {
|
|
|
1290
1342
|
degraded: true,
|
|
1291
1343
|
degradationReason: "target-not-descendant-of-anchor"
|
|
1292
1344
|
};
|
|
1293
|
-
let
|
|
1294
|
-
return
|
|
1295
|
-
path:
|
|
1296
|
-
const h =
|
|
1345
|
+
let l = this.filterNoise(i);
|
|
1346
|
+
return l = this.ensureUniqueness(i, l, t, e, s), {
|
|
1347
|
+
path: l.map((h) => {
|
|
1348
|
+
const d = h.tagName.toLowerCase(), u = s.extract(h);
|
|
1297
1349
|
let g;
|
|
1298
|
-
if (h) {
|
|
1299
|
-
const m =
|
|
1300
|
-
|
|
1350
|
+
if (_(d, u, h)) {
|
|
1351
|
+
const m = h.parentElement;
|
|
1352
|
+
if (m) {
|
|
1353
|
+
const b = Array.from(m.children).indexOf(h);
|
|
1354
|
+
b !== -1 && (g = b + 1);
|
|
1355
|
+
}
|
|
1301
1356
|
}
|
|
1302
1357
|
return {
|
|
1303
|
-
tag:
|
|
1304
|
-
semantics:
|
|
1305
|
-
score: s.scoreElement(
|
|
1358
|
+
tag: d,
|
|
1359
|
+
semantics: u,
|
|
1360
|
+
score: s.scoreElement(h),
|
|
1306
1361
|
nthChild: g
|
|
1307
1362
|
};
|
|
1308
1363
|
}),
|
|
@@ -1327,27 +1382,27 @@ class $t {
|
|
|
1327
1382
|
if (!o) return e;
|
|
1328
1383
|
let c;
|
|
1329
1384
|
if (this.cache) {
|
|
1330
|
-
const
|
|
1331
|
-
|
|
1385
|
+
const f = this.cache.getSelectorResults(i);
|
|
1386
|
+
f !== void 0 ? c = f : (c = Array.from(o.querySelectorAll(i)), this.cache.setSelectorResults(i, c));
|
|
1332
1387
|
} else
|
|
1333
1388
|
c = o.querySelectorAll(i);
|
|
1334
1389
|
if (c.length <= 1)
|
|
1335
1390
|
return e;
|
|
1336
|
-
const
|
|
1337
|
-
for (const
|
|
1338
|
-
if (a.scoreElement(
|
|
1391
|
+
const l = t.filter((f) => !e.includes(f));
|
|
1392
|
+
for (const f of l) {
|
|
1393
|
+
if (a.scoreElement(f) < bt.MIN_CONFIDENCE_FOR_SKIP)
|
|
1339
1394
|
continue;
|
|
1340
|
-
const
|
|
1395
|
+
const d = this.insertNodeInOrder(e, f, t), u = this.buildTestSelector(s, d, n);
|
|
1341
1396
|
try {
|
|
1342
|
-
let
|
|
1397
|
+
let g;
|
|
1343
1398
|
if (this.cache) {
|
|
1344
|
-
const m = this.cache.getSelectorResults(
|
|
1345
|
-
m !== void 0 ?
|
|
1399
|
+
const m = this.cache.getSelectorResults(u);
|
|
1400
|
+
m !== void 0 ? g = m : (g = Array.from(o.querySelectorAll(u)), this.cache.setSelectorResults(u, g));
|
|
1346
1401
|
} else
|
|
1347
|
-
|
|
1348
|
-
if (
|
|
1349
|
-
return
|
|
1350
|
-
|
|
1402
|
+
g = o.querySelectorAll(u);
|
|
1403
|
+
if (g.length === 1)
|
|
1404
|
+
return d;
|
|
1405
|
+
g.length < c.length && (e = d);
|
|
1351
1406
|
} catch {
|
|
1352
1407
|
}
|
|
1353
1408
|
}
|
|
@@ -1381,9 +1436,9 @@ class $t {
|
|
|
1381
1436
|
*/
|
|
1382
1437
|
elementToSelector(t) {
|
|
1383
1438
|
let e = t.tagName.toLowerCase();
|
|
1384
|
-
t.id && !
|
|
1439
|
+
t.id && !L(t.id) && (e += `#${rt(t.id)}`);
|
|
1385
1440
|
for (const s of Array.from(t.classList))
|
|
1386
|
-
|
|
1441
|
+
st(s) || (e += `.${rt(s)}`);
|
|
1387
1442
|
return e;
|
|
1388
1443
|
}
|
|
1389
1444
|
/**
|
|
@@ -1397,7 +1452,7 @@ class $t {
|
|
|
1397
1452
|
*/
|
|
1398
1453
|
shouldInclude(t) {
|
|
1399
1454
|
const e = t.tagName.toLowerCase();
|
|
1400
|
-
return
|
|
1455
|
+
return St.includes(e) ? true : e === "div" || e === "span" ? this.hasSemanticFeatures(t) : false;
|
|
1401
1456
|
}
|
|
1402
1457
|
/**
|
|
1403
1458
|
* Checks if element has meaningful semantic features
|
|
@@ -1408,12 +1463,12 @@ class $t {
|
|
|
1408
1463
|
if (s.name.startsWith("aria-")) return true;
|
|
1409
1464
|
if (t.classList.length > 0) {
|
|
1410
1465
|
for (const s of Array.from(t.classList))
|
|
1411
|
-
if (!
|
|
1466
|
+
if (!st(s)) return true;
|
|
1412
1467
|
}
|
|
1413
1468
|
if (t.hasAttribute("data-testid") || t.hasAttribute("data-qa") || t.hasAttribute("data-test"))
|
|
1414
1469
|
return true;
|
|
1415
1470
|
const e = t.id;
|
|
1416
|
-
return !!(e && !
|
|
1471
|
+
return !!(e && !L(e));
|
|
1417
1472
|
}
|
|
1418
1473
|
/**
|
|
1419
1474
|
* Checks if element is inside <head> section.
|
|
@@ -1460,31 +1515,34 @@ class $t {
|
|
|
1460
1515
|
degradationReason: "head-not-found-in-path"
|
|
1461
1516
|
} : {
|
|
1462
1517
|
path: n.map((c) => {
|
|
1463
|
-
const
|
|
1464
|
-
let
|
|
1465
|
-
if (
|
|
1466
|
-
const
|
|
1467
|
-
|
|
1518
|
+
const l = c.tagName.toLowerCase(), f = s.extract(c);
|
|
1519
|
+
let h;
|
|
1520
|
+
if (_(l, f, c)) {
|
|
1521
|
+
const d = c.parentElement;
|
|
1522
|
+
if (d) {
|
|
1523
|
+
const g = Array.from(d.children).indexOf(c);
|
|
1524
|
+
g !== -1 && (h = g + 1);
|
|
1525
|
+
}
|
|
1468
1526
|
}
|
|
1469
1527
|
return {
|
|
1470
|
-
tag:
|
|
1471
|
-
semantics:
|
|
1528
|
+
tag: l,
|
|
1529
|
+
semantics: f,
|
|
1472
1530
|
score: s.scoreElement(c),
|
|
1473
|
-
nthChild:
|
|
1531
|
+
nthChild: h
|
|
1474
1532
|
};
|
|
1475
1533
|
}),
|
|
1476
1534
|
degraded: false
|
|
1477
1535
|
};
|
|
1478
1536
|
}
|
|
1479
1537
|
}
|
|
1480
|
-
function
|
|
1538
|
+
function j(r) {
|
|
1481
1539
|
return r ? r.trim().replace(/[\n\t\r]/g, " ").replace(/\s+/g, " ") : "";
|
|
1482
1540
|
}
|
|
1483
|
-
const
|
|
1541
|
+
const Ht = {
|
|
1484
1542
|
preserveQueryForAbsolute: true,
|
|
1485
1543
|
removeDynamicHashes: true
|
|
1486
1544
|
};
|
|
1487
|
-
function
|
|
1545
|
+
function kt(r) {
|
|
1488
1546
|
return r ? [
|
|
1489
1547
|
/\d{5,}/,
|
|
1490
1548
|
// 5+ digits
|
|
@@ -1498,18 +1556,18 @@ function It(r) {
|
|
|
1498
1556
|
// UUID-like
|
|
1499
1557
|
].some((e) => e.test(r)) : false;
|
|
1500
1558
|
}
|
|
1501
|
-
function
|
|
1559
|
+
function _t(r, t) {
|
|
1502
1560
|
if (!r) return r;
|
|
1503
1561
|
const e = r.startsWith("http://") || r.startsWith("https://"), [s, n] = r.split("#"), [a, i] = s.split("?");
|
|
1504
1562
|
let o = a;
|
|
1505
|
-
return e && t.preserveQueryForAbsolute && i && (o += `?${i}`), n && (t.removeDynamicHashes &&
|
|
1563
|
+
return e && t.preserveQueryForAbsolute && i && (o += `?${i}`), n && (t.removeDynamicHashes && kt(n) || (o += `#${n}`)), o;
|
|
1506
1564
|
}
|
|
1507
1565
|
function D(r, t, e = {}) {
|
|
1508
1566
|
if (!t) return t;
|
|
1509
|
-
const s = { ...
|
|
1510
|
-
return r === "href" || r === "src" ?
|
|
1567
|
+
const s = { ...Ht, ...e };
|
|
1568
|
+
return r === "href" || r === "src" ? _t(t, s) : t;
|
|
1511
1569
|
}
|
|
1512
|
-
const
|
|
1570
|
+
const Ot = [
|
|
1513
1571
|
"role",
|
|
1514
1572
|
"aria-label",
|
|
1515
1573
|
"aria-labelledby",
|
|
@@ -1520,7 +1578,7 @@ const Dt = [
|
|
|
1520
1578
|
"aria-posinset",
|
|
1521
1579
|
"aria-setsize",
|
|
1522
1580
|
"aria-haspopup"
|
|
1523
|
-
],
|
|
1581
|
+
], qt = [
|
|
1524
1582
|
"aria-selected",
|
|
1525
1583
|
"aria-checked",
|
|
1526
1584
|
"aria-pressed",
|
|
@@ -1533,7 +1591,7 @@ const Dt = [
|
|
|
1533
1591
|
"aria-grabbed",
|
|
1534
1592
|
"aria-live",
|
|
1535
1593
|
"aria-atomic"
|
|
1536
|
-
],
|
|
1594
|
+
], Ut = [
|
|
1537
1595
|
"data-state",
|
|
1538
1596
|
"data-active",
|
|
1539
1597
|
"data-inactive",
|
|
@@ -1552,7 +1610,7 @@ const Dt = [
|
|
|
1552
1610
|
"data-hover",
|
|
1553
1611
|
"data-orientation",
|
|
1554
1612
|
"data-theme"
|
|
1555
|
-
],
|
|
1613
|
+
], zt = [
|
|
1556
1614
|
"data-radix-",
|
|
1557
1615
|
"data-headlessui-",
|
|
1558
1616
|
"data-reach-",
|
|
@@ -1560,7 +1618,7 @@ const Dt = [
|
|
|
1560
1618
|
"data-chakra-",
|
|
1561
1619
|
"data-mantine-",
|
|
1562
1620
|
"data-tw-"
|
|
1563
|
-
],
|
|
1621
|
+
], Ft = [
|
|
1564
1622
|
"data-testid",
|
|
1565
1623
|
"data-test-id",
|
|
1566
1624
|
"data-test",
|
|
@@ -1572,7 +1630,7 @@ const Dt = [
|
|
|
1572
1630
|
"data-entity-id",
|
|
1573
1631
|
"data-product-id",
|
|
1574
1632
|
"data-user-id"
|
|
1575
|
-
],
|
|
1633
|
+
], jt = [
|
|
1576
1634
|
// Google Analytics / GTM
|
|
1577
1635
|
"data-ga",
|
|
1578
1636
|
"data-gtm",
|
|
@@ -1608,7 +1666,7 @@ const Dt = [
|
|
|
1608
1666
|
"data-conversion",
|
|
1609
1667
|
"data-segment",
|
|
1610
1668
|
"data-analytics"
|
|
1611
|
-
],
|
|
1669
|
+
], Wt = [
|
|
1612
1670
|
"data-category",
|
|
1613
1671
|
// Google Analytics category
|
|
1614
1672
|
"data-action",
|
|
@@ -1617,7 +1675,7 @@ const Dt = [
|
|
|
1617
1675
|
// Google Analytics label
|
|
1618
1676
|
"data-value"
|
|
1619
1677
|
// Google Analytics value
|
|
1620
|
-
],
|
|
1678
|
+
], Bt = [
|
|
1621
1679
|
"id",
|
|
1622
1680
|
"name",
|
|
1623
1681
|
"type",
|
|
@@ -1626,7 +1684,7 @@ const Dt = [
|
|
|
1626
1684
|
"for",
|
|
1627
1685
|
"alt",
|
|
1628
1686
|
"href"
|
|
1629
|
-
],
|
|
1687
|
+
], Gt = [
|
|
1630
1688
|
"disabled",
|
|
1631
1689
|
"checked",
|
|
1632
1690
|
"selected",
|
|
@@ -1634,17 +1692,17 @@ const Dt = [
|
|
|
1634
1692
|
"readonly",
|
|
1635
1693
|
"required",
|
|
1636
1694
|
"value"
|
|
1637
|
-
],
|
|
1695
|
+
], Vt = [
|
|
1638
1696
|
/^radix-/,
|
|
1639
1697
|
/^headlessui-/,
|
|
1640
1698
|
/^mui-/,
|
|
1641
1699
|
/:\w+:/
|
|
1642
1700
|
// matches :ru:, :r1:, etc.
|
|
1643
1701
|
];
|
|
1644
|
-
function
|
|
1645
|
-
return
|
|
1702
|
+
function Qt(r, t) {
|
|
1703
|
+
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-");
|
|
1646
1704
|
}
|
|
1647
|
-
class
|
|
1705
|
+
class nt {
|
|
1648
1706
|
constructor(t, e) {
|
|
1649
1707
|
this.includeUtilityClasses = t.includeUtilityClasses ?? false, this.cache = e;
|
|
1650
1708
|
}
|
|
@@ -1660,12 +1718,12 @@ class st {
|
|
|
1660
1718
|
return i;
|
|
1661
1719
|
}
|
|
1662
1720
|
const e = {}, s = t.id;
|
|
1663
|
-
if (s && !
|
|
1721
|
+
if (s && !L(s) && (e.id = s), t.classList.length > 0) {
|
|
1664
1722
|
const i = Array.from(t.classList);
|
|
1665
1723
|
if (this.includeUtilityClasses)
|
|
1666
1724
|
e.classes = i;
|
|
1667
1725
|
else {
|
|
1668
|
-
const { semantic: o } =
|
|
1726
|
+
const { semantic: o } = It(i);
|
|
1669
1727
|
o.length > 0 && (e.classes = o);
|
|
1670
1728
|
}
|
|
1671
1729
|
}
|
|
@@ -1694,7 +1752,7 @@ class st {
|
|
|
1694
1752
|
* @returns True if should be ignored
|
|
1695
1753
|
*/
|
|
1696
1754
|
shouldIgnoreAttribute(t) {
|
|
1697
|
-
return !!(
|
|
1755
|
+
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-"));
|
|
1698
1756
|
}
|
|
1699
1757
|
/**
|
|
1700
1758
|
* Gets attribute priority
|
|
@@ -1729,7 +1787,7 @@ class st {
|
|
|
1729
1787
|
const e = {};
|
|
1730
1788
|
for (const s of Array.from(t.attributes)) {
|
|
1731
1789
|
const n = s.name;
|
|
1732
|
-
if (this.shouldIgnoreAttribute(n) || !
|
|
1790
|
+
if (this.shouldIgnoreAttribute(n) || !Qt(n, s.value) || Z.has(n) && K(s.value) || this.getAttributePriority(n) === 0) continue;
|
|
1733
1791
|
const i = n === "href" || n === "src" ? D(n, s.value) : s.value;
|
|
1734
1792
|
!i || i.trim() === "" || this.isDynamicValue(i) || (e[n] = i);
|
|
1735
1793
|
}
|
|
@@ -1741,7 +1799,7 @@ class st {
|
|
|
1741
1799
|
extractText(t) {
|
|
1742
1800
|
const e = this.getDirectTextContent(t);
|
|
1743
1801
|
if (!e) return null;
|
|
1744
|
-
const s =
|
|
1802
|
+
const s = j(e);
|
|
1745
1803
|
if (!s) return null;
|
|
1746
1804
|
const n = 100, a = e.length > n ? e.slice(0, n) + "..." : e, i = s.length > n ? s.slice(0, n) + "..." : s;
|
|
1747
1805
|
return {
|
|
@@ -1789,7 +1847,7 @@ class st {
|
|
|
1789
1847
|
].includes(e);
|
|
1790
1848
|
}
|
|
1791
1849
|
}
|
|
1792
|
-
class
|
|
1850
|
+
class Yt {
|
|
1793
1851
|
/**
|
|
1794
1852
|
* Generates fingerprint for SVG element
|
|
1795
1853
|
* @param element - SVG element to fingerprint
|
|
@@ -1900,11 +1958,11 @@ class Ft {
|
|
|
1900
1958
|
return Math.abs(e).toString(16).padStart(8, "0");
|
|
1901
1959
|
}
|
|
1902
1960
|
}
|
|
1903
|
-
function
|
|
1904
|
-
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 *
|
|
1961
|
+
function Zt(r, t = 0) {
|
|
1962
|
+
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;
|
|
1905
1963
|
return Math.max(0, Math.min(1, a - i));
|
|
1906
1964
|
}
|
|
1907
|
-
class
|
|
1965
|
+
class Kt {
|
|
1908
1966
|
constructor(t) {
|
|
1909
1967
|
this.cache = /* @__PURE__ */ new Map(), this.maxSize = t;
|
|
1910
1968
|
}
|
|
@@ -1935,9 +1993,9 @@ class Wt {
|
|
|
1935
1993
|
return this.cache.size;
|
|
1936
1994
|
}
|
|
1937
1995
|
}
|
|
1938
|
-
class
|
|
1996
|
+
class Xt {
|
|
1939
1997
|
constructor(t = {}) {
|
|
1940
|
-
this.eidCache = /* @__PURE__ */ new WeakMap(), this.selectorResultCache = new
|
|
1998
|
+
this.eidCache = /* @__PURE__ */ new WeakMap(), this.selectorResultCache = new Kt(
|
|
1941
1999
|
t.maxSelectorCacheSize ?? 1e3
|
|
1942
2000
|
), this.anchorCache = /* @__PURE__ */ new WeakMap(), this.semanticsCache = /* @__PURE__ */ new WeakMap(), this.stats = {
|
|
1943
2001
|
eidHits: 0,
|
|
@@ -2086,12 +2144,12 @@ class Bt {
|
|
|
2086
2144
|
return s > 0 ? t / s : 0;
|
|
2087
2145
|
}
|
|
2088
2146
|
}
|
|
2089
|
-
function
|
|
2090
|
-
return new
|
|
2147
|
+
function Jt(r) {
|
|
2148
|
+
return new Xt(r);
|
|
2091
2149
|
}
|
|
2092
|
-
let
|
|
2093
|
-
function
|
|
2094
|
-
return
|
|
2150
|
+
let F = null;
|
|
2151
|
+
function X() {
|
|
2152
|
+
return F || (F = Jt()), F;
|
|
2095
2153
|
}
|
|
2096
2154
|
function k(r) {
|
|
2097
2155
|
if (r.ownerDocument)
|
|
@@ -2109,7 +2167,7 @@ function k(r) {
|
|
|
2109
2167
|
3. You are working with a document node instead of an element`
|
|
2110
2168
|
);
|
|
2111
2169
|
}
|
|
2112
|
-
function
|
|
2170
|
+
function te(r, t) {
|
|
2113
2171
|
if (!t)
|
|
2114
2172
|
return;
|
|
2115
2173
|
const e = k(r), s = t instanceof Document ? t : k(t);
|
|
@@ -2124,64 +2182,65 @@ Common causes:
|
|
|
2124
2182
|
Solution: Ensure element and root parameter are from the same document context.`
|
|
2125
2183
|
);
|
|
2126
2184
|
}
|
|
2127
|
-
function
|
|
2185
|
+
function J(r, t = {}) {
|
|
2128
2186
|
var _a;
|
|
2129
2187
|
if (!r || !r.ownerDocument || !r.isConnected)
|
|
2130
2188
|
return null;
|
|
2131
|
-
const e = { ...
|
|
2189
|
+
const e = { ...At, ...t };
|
|
2132
2190
|
if (e.root)
|
|
2133
2191
|
try {
|
|
2134
|
-
|
|
2192
|
+
te(r, e.root);
|
|
2135
2193
|
} catch (x2) {
|
|
2136
2194
|
return console.error("Cross-document generation detected:", x2), null;
|
|
2137
2195
|
}
|
|
2138
|
-
const s = e.cache ??
|
|
2196
|
+
const s = e.cache ?? X(), n = s.getEID(r);
|
|
2139
2197
|
if (n !== void 0)
|
|
2140
2198
|
return n;
|
|
2141
|
-
|
|
2142
|
-
|
|
2199
|
+
const a = r.tagName.toLowerCase();
|
|
2200
|
+
if (a === "html") {
|
|
2201
|
+
const x2 = new nt(e, s), y = re(r, e, x2);
|
|
2143
2202
|
return s.setEID(r, y), y;
|
|
2144
2203
|
}
|
|
2145
|
-
const i = new
|
|
2146
|
-
if (!
|
|
2204
|
+
const i = new Ct(e, s), o = new Pt(e, s), c = new nt(e, s), l = new Yt(), f = i.findAnchor(r);
|
|
2205
|
+
if (!f && !e.fallbackToBody)
|
|
2147
2206
|
return null;
|
|
2148
|
-
const
|
|
2149
|
-
if (!
|
|
2150
|
-
const
|
|
2151
|
-
let
|
|
2152
|
-
if (
|
|
2153
|
-
const y = Array.from(
|
|
2154
|
-
y !== -1 && (
|
|
2155
|
-
}
|
|
2156
|
-
const
|
|
2157
|
-
tag:
|
|
2158
|
-
semantics:
|
|
2159
|
-
score: (
|
|
2160
|
-
degraded:
|
|
2161
|
-
nthChild:
|
|
2162
|
-
}, S = o.buildPath(
|
|
2163
|
-
e.enableSvgFingerprint &&
|
|
2207
|
+
const h = (f == null ? void 0 : f.element) ?? ((_a = r.ownerDocument) == null ? void 0 : _a.body) ?? null;
|
|
2208
|
+
if (!h) return null;
|
|
2209
|
+
const d = !f || f.tier === "C", u = h.tagName.toLowerCase(), g = c.extract(h), m = h.parentElement;
|
|
2210
|
+
let p;
|
|
2211
|
+
if (m && u !== "body" && u !== "html" && _(u, g, h)) {
|
|
2212
|
+
const y = Array.from(m.children).indexOf(h);
|
|
2213
|
+
y !== -1 && (p = y + 1);
|
|
2214
|
+
}
|
|
2215
|
+
const b = {
|
|
2216
|
+
tag: h.tagName.toLowerCase(),
|
|
2217
|
+
semantics: g,
|
|
2218
|
+
score: (f == null ? void 0 : f.score) ?? I.DEGRADED_SCORE,
|
|
2219
|
+
degraded: d,
|
|
2220
|
+
nthChild: p
|
|
2221
|
+
}, S = o.buildPath(h, r, c), T = c.extract(r);
|
|
2222
|
+
e.enableSvgFingerprint && ee(r) && (T.svg = l.fingerprint(r));
|
|
2164
2223
|
const C = r.parentElement;
|
|
2165
2224
|
let A;
|
|
2166
|
-
if (C) {
|
|
2225
|
+
if (C && _(a, T, r)) {
|
|
2167
2226
|
const y = Array.from(C.children).indexOf(r);
|
|
2168
2227
|
y !== -1 && (A = y + 1);
|
|
2169
2228
|
}
|
|
2170
2229
|
const v = {
|
|
2171
2230
|
tag: r.tagName.toLowerCase(),
|
|
2172
|
-
semantics:
|
|
2231
|
+
semantics: T,
|
|
2173
2232
|
score: c.scoreElement(r),
|
|
2174
2233
|
nthChild: A
|
|
2175
|
-
},
|
|
2234
|
+
}, P = [], $ = {
|
|
2176
2235
|
onMultiple: "best-score",
|
|
2177
2236
|
onMissing: "anchor-only",
|
|
2178
2237
|
maxDepth: 3
|
|
2179
|
-
},
|
|
2238
|
+
}, E = b.degraded || S.degraded, R = se(b.degraded, S), N = {
|
|
2180
2239
|
version: "1.0",
|
|
2181
2240
|
anchor: b,
|
|
2182
2241
|
path: S.path,
|
|
2183
2242
|
target: v,
|
|
2184
|
-
constraints:
|
|
2243
|
+
constraints: P,
|
|
2185
2244
|
fallback: $,
|
|
2186
2245
|
meta: {
|
|
2187
2246
|
confidence: 0,
|
|
@@ -2189,16 +2248,16 @@ function X(r, t = {}) {
|
|
|
2189
2248
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2190
2249
|
generator: "dom-eid@1.0",
|
|
2191
2250
|
source: e.source,
|
|
2192
|
-
degraded:
|
|
2251
|
+
degraded: E,
|
|
2193
2252
|
degradationReason: R
|
|
2194
2253
|
}
|
|
2195
2254
|
};
|
|
2196
|
-
return N.meta.confidence =
|
|
2255
|
+
return N.meta.confidence = Zt(N), N.meta.confidence < e.confidenceThreshold ? null : (s.setEID(r, N), N);
|
|
2197
2256
|
}
|
|
2198
|
-
function
|
|
2257
|
+
function ee(r) {
|
|
2199
2258
|
return r.namespaceURI === "http://www.w3.org/2000/svg" || r.tagName.toLowerCase() === "svg" || r instanceof SVGElement;
|
|
2200
2259
|
}
|
|
2201
|
-
function
|
|
2260
|
+
function se(r, t) {
|
|
2202
2261
|
if (r && t.degraded)
|
|
2203
2262
|
return "anchor-and-path-degraded";
|
|
2204
2263
|
if (r)
|
|
@@ -2206,7 +2265,7 @@ function Yt(r, t) {
|
|
|
2206
2265
|
if (t.degraded)
|
|
2207
2266
|
return t.degradationReason;
|
|
2208
2267
|
}
|
|
2209
|
-
function
|
|
2268
|
+
function re(r, t, e, s) {
|
|
2210
2269
|
const a = {
|
|
2211
2270
|
tag: "html",
|
|
2212
2271
|
semantics: e.extract(r),
|
|
@@ -2235,91 +2294,119 @@ function Zt(r, t, e, s) {
|
|
|
2235
2294
|
}
|
|
2236
2295
|
};
|
|
2237
2296
|
}
|
|
2238
|
-
const
|
|
2297
|
+
const ht = {
|
|
2298
|
+
id: "i",
|
|
2299
|
+
"data-testid": "tid",
|
|
2300
|
+
"data-qa": "qa",
|
|
2301
|
+
"data-cy": "cy",
|
|
2302
|
+
"data-test": "dt",
|
|
2303
|
+
"aria-label": "al",
|
|
2304
|
+
"aria-labelledby": "alb",
|
|
2305
|
+
"aria-describedby": "adb",
|
|
2306
|
+
name: "n",
|
|
2307
|
+
href: "h",
|
|
2308
|
+
src: "s",
|
|
2309
|
+
type: "t",
|
|
2310
|
+
role: "r",
|
|
2311
|
+
alt: "at",
|
|
2312
|
+
title: "tt",
|
|
2313
|
+
for: "f",
|
|
2314
|
+
placeholder: "ph",
|
|
2315
|
+
text: "x"
|
|
2316
|
+
}, G = Object.fromEntries(
|
|
2317
|
+
Object.entries(ht).map(([r, t]) => [t, r])
|
|
2318
|
+
), ut = {
|
|
2239
2319
|
maxClasses: 2,
|
|
2240
2320
|
maxAttributes: 5,
|
|
2241
2321
|
includeText: true,
|
|
2242
2322
|
maxTextLength: 50,
|
|
2243
2323
|
simplifyTarget: true,
|
|
2244
|
-
includeConstraints: true
|
|
2324
|
+
includeConstraints: true,
|
|
2325
|
+
format: "compact"
|
|
2245
2326
|
};
|
|
2246
|
-
function
|
|
2327
|
+
function ct(r) {
|
|
2247
2328
|
return r === "id" ? 101 : w[r] !== void 0 ? w[r] : r.startsWith("data-") ? w["data-*"] : r.startsWith("aria-") ? w["aria-*"] : 0;
|
|
2248
2329
|
}
|
|
2249
|
-
function
|
|
2330
|
+
function de(r) {
|
|
2250
2331
|
return ["id", "data-testid", "data-qa", "data-cy", "href", "text", "role"].includes(r);
|
|
2251
2332
|
}
|
|
2252
|
-
function
|
|
2333
|
+
function fe(r) {
|
|
2253
2334
|
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));
|
|
2254
2335
|
}
|
|
2255
|
-
function
|
|
2256
|
-
const e = { ...
|
|
2257
|
-
return `${
|
|
2258
|
-
}
|
|
2259
|
-
function
|
|
2260
|
-
const { tag:
|
|
2261
|
-
let
|
|
2262
|
-
const
|
|
2263
|
-
|
|
2264
|
-
const
|
|
2265
|
-
const
|
|
2266
|
-
return { name:
|
|
2267
|
-
}).filter((
|
|
2268
|
-
|
|
2269
|
-
const
|
|
2270
|
-
|
|
2271
|
-
for (const { name:
|
|
2272
|
-
i
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
}
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
);
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2336
|
+
function ge(r, t) {
|
|
2337
|
+
const e = { ...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) : "";
|
|
2338
|
+
return `${n}${a}${l}${i}${f}${h}${d}`;
|
|
2339
|
+
}
|
|
2340
|
+
function W(r, t = false, e = ut, s) {
|
|
2341
|
+
const { tag: n, semantics: a } = r, i = e.format === "compact";
|
|
2342
|
+
let o = n;
|
|
2343
|
+
const c = [], l = { ...a.attributes };
|
|
2344
|
+
a.id && (l.id = a.id), a.role && !l.role && (l.role = a.role);
|
|
2345
|
+
const f = Object.entries(l).map(([u, g]) => {
|
|
2346
|
+
const m = ct(u), p = u === "href" || u === "src" ? D(u, g) : g;
|
|
2347
|
+
return { name: u, value: p, priority: m };
|
|
2348
|
+
}).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");
|
|
2349
|
+
f.sort((u, g) => g.priority - u.priority);
|
|
2350
|
+
const h = f.slice(0, e.maxAttributes);
|
|
2351
|
+
h.sort((u, g) => u.name.localeCompare(g.name));
|
|
2352
|
+
for (const { name: u, value: g } of h) {
|
|
2353
|
+
const m = i ? ht[u] ?? u : u;
|
|
2354
|
+
c.push(`${m}="${V(g)}"`);
|
|
2355
|
+
}
|
|
2356
|
+
if (e.includeText && a.text && !fe(a.text.normalized)) {
|
|
2357
|
+
const u = a.text.normalized;
|
|
2358
|
+
if (u.length > 0 && u.length <= e.maxTextLength && !(!t && s !== void 0 && u === s)) {
|
|
2359
|
+
const m = i ? "x" : "text";
|
|
2360
|
+
c.push(`${m}="${V(u)}"`);
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
let d = c;
|
|
2364
|
+
if (c.length > 0 && t && e.simplifyTarget && a.id && (d = c.filter((u) => {
|
|
2365
|
+
const g = u.split("=")[0], m = G[g] ?? g;
|
|
2366
|
+
return ct(m) >= 60 || m === "text" || m === "id" || m === "role";
|
|
2367
|
+
})), a.classes && a.classes.length > 0) {
|
|
2368
|
+
const u = M(a.classes), g = !!a.id || c.some((p) => {
|
|
2369
|
+
const b = p.split("=")[0], S = G[b] ?? b;
|
|
2370
|
+
return S === "href" || S === "data-testid" || S === "text" || S === "role";
|
|
2371
|
+
});
|
|
2372
|
+
if (!(t && e.simplifyTarget && g) && u.length > 0) {
|
|
2373
|
+
const p = u.sort().slice(0, e.maxClasses);
|
|
2374
|
+
o += p.map((b) => `.${b}`).join("");
|
|
2288
2375
|
}
|
|
2289
2376
|
}
|
|
2290
|
-
if (d.length > 0 && (
|
|
2291
|
-
const
|
|
2292
|
-
t && e.simplifyTarget &&
|
|
2377
|
+
if (d.length > 0 && (o += `[${d.join(",")}]`), "nthChild" in r && r.nthChild) {
|
|
2378
|
+
const u = !!a.id || a.attributes && Object.keys(a.attributes).some(de);
|
|
2379
|
+
t && e.simplifyTarget && u || (o += `#${r.nthChild}`);
|
|
2293
2380
|
}
|
|
2294
|
-
return
|
|
2381
|
+
return o;
|
|
2295
2382
|
}
|
|
2296
|
-
function
|
|
2383
|
+
function pe(r, t) {
|
|
2297
2384
|
if (!r.constraints || r.constraints.length === 0)
|
|
2298
2385
|
return "";
|
|
2299
|
-
const
|
|
2300
|
-
for (const
|
|
2301
|
-
switch (
|
|
2386
|
+
const e = [];
|
|
2387
|
+
for (const n of r.constraints)
|
|
2388
|
+
switch (n.type) {
|
|
2302
2389
|
case "uniqueness":
|
|
2303
|
-
|
|
2390
|
+
e.push("unique=true");
|
|
2304
2391
|
break;
|
|
2305
2392
|
case "position":
|
|
2306
|
-
|
|
2393
|
+
n.params && n.params.strategy && e.push(`pos=${n.params.strategy}`);
|
|
2307
2394
|
break;
|
|
2308
2395
|
case "text-proximity":
|
|
2309
|
-
if (
|
|
2310
|
-
const
|
|
2311
|
-
|
|
2396
|
+
if (n.params && n.params.reference) {
|
|
2397
|
+
const a = V(String(n.params.reference));
|
|
2398
|
+
e.push(`text="${a}"`);
|
|
2312
2399
|
}
|
|
2313
2400
|
break;
|
|
2314
2401
|
}
|
|
2315
|
-
return
|
|
2402
|
+
return e.length === 0 ? "" : `${t.format === "verbose" ? " " : ""}{${e.join(",")}}`;
|
|
2316
2403
|
}
|
|
2317
|
-
function
|
|
2404
|
+
function V(r) {
|
|
2318
2405
|
return r.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/>/g, "\\>").replace(/:/g, "\\:");
|
|
2319
2406
|
}
|
|
2320
|
-
function
|
|
2321
|
-
const s =
|
|
2322
|
-
return s ?
|
|
2407
|
+
function Ne(r, t, e) {
|
|
2408
|
+
const s = J(r, t);
|
|
2409
|
+
return s ? ge(s, e) : null;
|
|
2323
2410
|
}
|
|
2324
2411
|
let _id = 1;
|
|
2325
2412
|
const tagNameRegex = new RegExp("[^a-z0-9-_:]");
|
|
@@ -2992,7 +3079,7 @@ function serializeNodeWithId(n, options) {
|
|
|
2992
3079
|
enableSvgFingerprint: selectorOptions.enableSvgFingerprint,
|
|
2993
3080
|
fallbackToBody: selectorOptions.fallbackToBody
|
|
2994
3081
|
};
|
|
2995
|
-
const selector =
|
|
3082
|
+
const selector = Ne(n, seqlGeneratorOptions);
|
|
2996
3083
|
if (selector) {
|
|
2997
3084
|
serializedNode.selector = selector;
|
|
2998
3085
|
}
|