@amplitude/element-selector 0.0.1 → 0.1.1-featelement-selector-v1.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/LICENSE +21 -0
- package/README.md +162 -0
- package/lib/cjs/config/resolve-config.d.ts +56 -0
- package/lib/cjs/config/resolve-config.d.ts.map +1 -0
- package/lib/cjs/config/resolve-config.js +114 -0
- package/lib/cjs/config/resolve-config.js.map +1 -0
- package/lib/cjs/engine.d.ts +54 -0
- package/lib/cjs/engine.d.ts.map +1 -0
- package/lib/cjs/engine.js +139 -0
- package/lib/cjs/engine.js.map +1 -0
- package/lib/cjs/fallback-css-path.d.ts +53 -0
- package/lib/cjs/fallback-css-path.d.ts.map +1 -0
- package/lib/cjs/fallback-css-path.js +124 -0
- package/lib/cjs/fallback-css-path.js.map +1 -0
- package/lib/cjs/generate-selector.d.ts +54 -0
- package/lib/cjs/generate-selector.d.ts.map +1 -0
- package/lib/cjs/generate-selector.js +76 -0
- package/lib/cjs/generate-selector.js.map +1 -0
- package/lib/cjs/helpers/describe-relative.d.ts +28 -0
- package/lib/cjs/helpers/describe-relative.d.ts.map +1 -0
- package/lib/cjs/helpers/describe-relative.js +60 -0
- package/lib/cjs/helpers/describe-relative.js.map +1 -0
- package/lib/cjs/helpers/escape-css-identifier.d.ts +8 -0
- package/lib/cjs/helpers/escape-css-identifier.d.ts.map +1 -0
- package/lib/cjs/helpers/escape-css-identifier.js +50 -0
- package/lib/cjs/helpers/escape-css-identifier.js.map +1 -0
- package/lib/cjs/helpers/escape-id.d.ts +3 -0
- package/lib/cjs/helpers/escape-id.d.ts.map +1 -0
- package/lib/cjs/helpers/escape-id.js +10 -0
- package/lib/cjs/helpers/escape-id.js.map +1 -0
- package/lib/cjs/helpers/get-stable-id.d.ts +23 -0
- package/lib/cjs/helpers/get-stable-id.d.ts.map +1 -0
- package/lib/cjs/helpers/get-stable-id.js +44 -0
- package/lib/cjs/helpers/get-stable-id.js.map +1 -0
- package/lib/cjs/index.d.ts +31 -0
- package/lib/cjs/index.d.ts.map +1 -0
- package/lib/cjs/index.js +71 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/legacy-css-path.d.ts +84 -0
- package/lib/cjs/legacy-css-path.d.ts.map +1 -0
- package/lib/cjs/legacy-css-path.js +230 -0
- package/lib/cjs/legacy-css-path.js.map +1 -0
- package/lib/cjs/orchestrator.d.ts +61 -0
- package/lib/cjs/orchestrator.d.ts.map +1 -0
- package/lib/cjs/orchestrator.js +140 -0
- package/lib/cjs/orchestrator.js.map +1 -0
- package/lib/cjs/patterns/autogenerated-ids.d.ts +37 -0
- package/lib/cjs/patterns/autogenerated-ids.d.ts.map +1 -0
- package/lib/cjs/patterns/autogenerated-ids.js +102 -0
- package/lib/cjs/patterns/autogenerated-ids.js.map +1 -0
- package/lib/cjs/patterns/unstable-classes.d.ts +48 -0
- package/lib/cjs/patterns/unstable-classes.d.ts.map +1 -0
- package/lib/cjs/patterns/unstable-classes.js +155 -0
- package/lib/cjs/patterns/unstable-classes.js.map +1 -0
- package/lib/cjs/strategies/explicit-tracking-attribute.d.ts +22 -0
- package/lib/cjs/strategies/explicit-tracking-attribute.d.ts.map +1 -0
- package/lib/cjs/strategies/explicit-tracking-attribute.js +36 -0
- package/lib/cjs/strategies/explicit-tracking-attribute.js.map +1 -0
- package/lib/cjs/strategies/stable-id.d.ts +14 -0
- package/lib/cjs/strategies/stable-id.d.ts.map +1 -0
- package/lib/cjs/strategies/stable-id.js +27 -0
- package/lib/cjs/strategies/stable-id.js.map +1 -0
- package/lib/cjs/types.d.ts +100 -0
- package/lib/cjs/types.d.ts.map +1 -0
- package/lib/cjs/types.js +13 -0
- package/lib/cjs/types.js.map +1 -0
- package/lib/esm/config/resolve-config.d.ts +56 -0
- package/lib/esm/config/resolve-config.d.ts.map +1 -0
- package/lib/esm/config/resolve-config.js +110 -0
- package/lib/esm/config/resolve-config.js.map +1 -0
- package/lib/esm/engine.d.ts +54 -0
- package/lib/esm/engine.d.ts.map +1 -0
- package/lib/esm/engine.js +135 -0
- package/lib/esm/engine.js.map +1 -0
- package/lib/esm/fallback-css-path.d.ts +53 -0
- package/lib/esm/fallback-css-path.d.ts.map +1 -0
- package/lib/esm/fallback-css-path.js +120 -0
- package/lib/esm/fallback-css-path.js.map +1 -0
- package/lib/esm/generate-selector.d.ts +54 -0
- package/lib/esm/generate-selector.d.ts.map +1 -0
- package/lib/esm/generate-selector.js +72 -0
- package/lib/esm/generate-selector.js.map +1 -0
- package/lib/esm/helpers/describe-relative.d.ts +28 -0
- package/lib/esm/helpers/describe-relative.d.ts.map +1 -0
- package/lib/esm/helpers/describe-relative.js +56 -0
- package/lib/esm/helpers/describe-relative.js.map +1 -0
- package/lib/esm/helpers/escape-css-identifier.d.ts +8 -0
- package/lib/esm/helpers/escape-css-identifier.d.ts.map +1 -0
- package/lib/esm/helpers/escape-css-identifier.js +46 -0
- package/lib/esm/helpers/escape-css-identifier.js.map +1 -0
- package/lib/esm/helpers/escape-id.d.ts +3 -0
- package/lib/esm/helpers/escape-id.d.ts.map +1 -0
- package/lib/esm/helpers/escape-id.js +6 -0
- package/lib/esm/helpers/escape-id.js.map +1 -0
- package/lib/esm/helpers/get-stable-id.d.ts +23 -0
- package/lib/esm/helpers/get-stable-id.d.ts.map +1 -0
- package/lib/esm/helpers/get-stable-id.js +40 -0
- package/lib/esm/helpers/get-stable-id.js.map +1 -0
- package/lib/esm/index.d.ts +31 -0
- package/lib/esm/index.d.ts.map +1 -0
- package/lib/esm/index.js +50 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/legacy-css-path.d.ts +84 -0
- package/lib/esm/legacy-css-path.d.ts.map +1 -0
- package/lib/esm/legacy-css-path.js +226 -0
- package/lib/esm/legacy-css-path.js.map +1 -0
- package/lib/esm/orchestrator.d.ts +61 -0
- package/lib/esm/orchestrator.d.ts.map +1 -0
- package/lib/esm/orchestrator.js +136 -0
- package/lib/esm/orchestrator.js.map +1 -0
- package/lib/esm/patterns/autogenerated-ids.d.ts +37 -0
- package/lib/esm/patterns/autogenerated-ids.d.ts.map +1 -0
- package/lib/esm/patterns/autogenerated-ids.js +97 -0
- package/lib/esm/patterns/autogenerated-ids.js.map +1 -0
- package/lib/esm/patterns/unstable-classes.d.ts +48 -0
- package/lib/esm/patterns/unstable-classes.d.ts.map +1 -0
- package/lib/esm/patterns/unstable-classes.js +150 -0
- package/lib/esm/patterns/unstable-classes.js.map +1 -0
- package/lib/esm/strategies/explicit-tracking-attribute.d.ts +22 -0
- package/lib/esm/strategies/explicit-tracking-attribute.d.ts.map +1 -0
- package/lib/esm/strategies/explicit-tracking-attribute.js +33 -0
- package/lib/esm/strategies/explicit-tracking-attribute.js.map +1 -0
- package/lib/esm/strategies/stable-id.d.ts +14 -0
- package/lib/esm/strategies/stable-id.d.ts.map +1 -0
- package/lib/esm/strategies/stable-id.js +24 -0
- package/lib/esm/strategies/stable-id.js.map +1 -0
- package/lib/esm/types.d.ts +100 -0
- package/lib/esm/types.d.ts.map +1 -0
- package/lib/esm/types.js +12 -0
- package/lib/esm/types.js.map +1 -0
- package/package.json +40 -5
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Fallback CSS-path walker — the safety net for the v1 element-selector
|
|
4
|
+
* algorithm.
|
|
5
|
+
*
|
|
6
|
+
* When the orchestrator's strategy chain finds nothing usable across the full
|
|
7
|
+
* ancestor walk, the engine invokes this fallback. It produces a positional
|
|
8
|
+
* selector by walking up from the target to <html>, expressing each step as
|
|
9
|
+
* either an id anchor (when one survives the autogen filter) or a
|
|
10
|
+
* `tag:nth-of-type(n)` step.
|
|
11
|
+
*
|
|
12
|
+
* Key differences from the legacy autocapture `cssPath`:
|
|
13
|
+
*
|
|
14
|
+
* 1. Ids are filtered through `getStableId`, which honors the
|
|
15
|
+
* explicit-tracking-attribute suppression signal AND the autogenerated-id
|
|
16
|
+
* pattern pack. The legacy `cssPath` would happily anchor on `id=":r5:"`
|
|
17
|
+
* and produce selectors that never match across page loads.
|
|
18
|
+
*
|
|
19
|
+
* 2. Classes — when they're used at all for sibling disambiguation — are
|
|
20
|
+
* filtered through `filterClasses` against the unstable-class pattern
|
|
21
|
+
* pack. The current v1 implementation here doesn't emit classes (we lean
|
|
22
|
+
* entirely on `:nth-of-type` for sibling disambiguation), but the
|
|
23
|
+
* filtering helper is wired through so future iterations can opt back in
|
|
24
|
+
* surgically without re-deriving the policy.
|
|
25
|
+
*
|
|
26
|
+
* 3. A unique anchor id terminates the walk early — once we hit `body#main`,
|
|
27
|
+
* we don't need to keep walking up to `<html>`.
|
|
28
|
+
*
|
|
29
|
+
* 4. Ambiguous id anchors are skipped. Duplicate ids are invalid HTML but
|
|
30
|
+
* common enough in the wild that fallback must not emit selectors that
|
|
31
|
+
* resolve to the wrong target.
|
|
32
|
+
*
|
|
33
|
+
* Output format mirrors the orchestrator's output: `<anchor> > <descent>`.
|
|
34
|
+
* When no usable id is found anywhere on the walk, the fallback emits a
|
|
35
|
+
* pure-positional selector rooted at `html`.
|
|
36
|
+
*
|
|
37
|
+
* See the design doc:
|
|
38
|
+
* packages/plugin-autocapture-browser/element-selector-strategy-v1-no-classes.md
|
|
39
|
+
*/
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.fallbackCssPath = void 0;
|
|
42
|
+
var tslib_1 = require("tslib");
|
|
43
|
+
var get_stable_id_1 = require("./helpers/get-stable-id");
|
|
44
|
+
var escape_id_1 = require("./helpers/escape-id");
|
|
45
|
+
/**
|
|
46
|
+
* Build a positional CSS selector for `el`, using stable ids as anchors when
|
|
47
|
+
* available and falling back to `tag:nth-of-type(n)` for disambiguation.
|
|
48
|
+
*
|
|
49
|
+
* Honors `config.maxAncestorWalkDepth` defensively — once the depth limit is
|
|
50
|
+
* reached, the walker stops and returns whatever it has built so far rooted at
|
|
51
|
+
* the deepest reached ancestor.
|
|
52
|
+
*/
|
|
53
|
+
function fallbackCssPath(el, config, options) {
|
|
54
|
+
var _a, _b;
|
|
55
|
+
if (options === void 0) { options = {}; }
|
|
56
|
+
var scope = (_b = (_a = options.scope) !== null && _a !== void 0 ? _a : el.ownerDocument) !== null && _b !== void 0 ? _b : document;
|
|
57
|
+
var segments = [];
|
|
58
|
+
var cursor = el;
|
|
59
|
+
var depth = 0;
|
|
60
|
+
while (cursor !== null) {
|
|
61
|
+
if (config.maxAncestorWalkDepth !== undefined && depth > config.maxAncestorWalkDepth) {
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
var id = (0, get_stable_id_1.getStableId)(cursor, config);
|
|
65
|
+
if (id !== null) {
|
|
66
|
+
// Anchor format mirrors the stableId strategy: `tag#id` with the id
|
|
67
|
+
// CSS-escaped. Only terminate if the composed selector uniquely resolves
|
|
68
|
+
// to the target; duplicate ids should fall through to positional steps.
|
|
69
|
+
var anchorSegment = "".concat(cursor.tagName.toLowerCase(), "#").concat((0, escape_id_1.escapeIdForCss)(id));
|
|
70
|
+
var candidate = tslib_1.__spreadArray([anchorSegment], tslib_1.__read(segments), false).join(' > ');
|
|
71
|
+
if (isUniqueMatch(scope, candidate, el)) {
|
|
72
|
+
return candidate;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
segments.unshift(stepFor(cursor));
|
|
76
|
+
cursor = cursor.parentElement;
|
|
77
|
+
depth += 1;
|
|
78
|
+
}
|
|
79
|
+
// Walked all the way to the document root without finding an id. The first
|
|
80
|
+
// segment is whatever `<html>` produced (which is just `html` since it has
|
|
81
|
+
// no parent and no same-tag siblings).
|
|
82
|
+
return segments.join(' > ');
|
|
83
|
+
}
|
|
84
|
+
exports.fallbackCssPath = fallbackCssPath;
|
|
85
|
+
/**
|
|
86
|
+
* Build a single step. For an element with a parent: `tag:nth-of-type(n)`.
|
|
87
|
+
* For a root element (no parent — i.e. <html>): just `tag`.
|
|
88
|
+
*
|
|
89
|
+
* Class-based disambiguation is intentionally not emitted in v1 — see the
|
|
90
|
+
* design doc, "Why we don't use classes for sibling disambiguation". The
|
|
91
|
+
* `filterClasses` helper is imported in the package for future iterations.
|
|
92
|
+
*/
|
|
93
|
+
function stepFor(el) {
|
|
94
|
+
var tag = el.tagName.toLowerCase();
|
|
95
|
+
var parent = el.parentElement;
|
|
96
|
+
if (parent === null) {
|
|
97
|
+
return tag;
|
|
98
|
+
}
|
|
99
|
+
var index = sameTypeIndex(el, parent);
|
|
100
|
+
return "".concat(tag, ":nth-of-type(").concat(index, ")");
|
|
101
|
+
}
|
|
102
|
+
function sameTypeIndex(el, parent) {
|
|
103
|
+
var count = 0;
|
|
104
|
+
for (var i = 0; i < parent.children.length; i++) {
|
|
105
|
+
var sibling = parent.children[i];
|
|
106
|
+
if (sibling.tagName === el.tagName) {
|
|
107
|
+
count += 1;
|
|
108
|
+
if (sibling === el)
|
|
109
|
+
return count;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return 1;
|
|
113
|
+
}
|
|
114
|
+
function isUniqueMatch(scope, selector, el) {
|
|
115
|
+
var matches;
|
|
116
|
+
try {
|
|
117
|
+
matches = scope.querySelectorAll(selector);
|
|
118
|
+
}
|
|
119
|
+
catch (_e) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
return matches.length === 1 && matches[0] === el;
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=fallback-css-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fallback-css-path.js","sourceRoot":"","sources":["../../src/fallback-css-path.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;;;;AAGH,yDAAsD;AACtD,iDAAqD;AAOrD;;;;;;;GAOG;AACH,SAAgB,eAAe,CAC7B,EAAW,EACX,MAA8B,EAC9B,OAAoC;;IAApC,wBAAA,EAAA,YAAoC;IAEpC,IAAM,KAAK,GAAe,MAAA,MAAA,OAAO,CAAC,KAAK,mCAAI,EAAE,CAAC,aAAa,mCAAI,QAAQ,CAAC;IACxE,IAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI,MAAM,GAAmB,EAAE,CAAC;IAChC,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,OAAO,MAAM,KAAK,IAAI,EAAE;QACtB,IAAI,MAAM,CAAC,oBAAoB,KAAK,SAAS,IAAI,KAAK,GAAG,MAAM,CAAC,oBAAoB,EAAE;YACpF,MAAM;SACP;QAED,IAAM,EAAE,GAAG,IAAA,2BAAW,EAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACvC,IAAI,EAAE,KAAK,IAAI,EAAE;YACf,oEAAoE;YACpE,yEAAyE;YACzE,wEAAwE;YACxE,IAAM,aAAa,GAAG,UAAG,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,cAAI,IAAA,0BAAc,EAAC,EAAE,CAAC,CAAE,CAAC;YAC9E,IAAM,SAAS,GAAG,uBAAC,aAAa,kBAAK,QAAQ,UAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YAC3D,IAAI,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC,EAAE;gBACvC,OAAO,SAAS,CAAC;aAClB;SACF;QAED,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;QAClC,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC;QAC9B,KAAK,IAAI,CAAC,CAAC;KACZ;IAED,2EAA2E;IAC3E,2EAA2E;IAC3E,uCAAuC;IACvC,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AApCD,0CAoCC;AAED;;;;;;;GAOG;AACH,SAAS,OAAO,CAAC,EAAW;IAC1B,IAAM,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IACrC,IAAM,MAAM,GAAG,EAAE,CAAC,aAAa,CAAC;IAChC,IAAI,MAAM,KAAK,IAAI,EAAE;QACnB,OAAO,GAAG,CAAC;KACZ;IACD,IAAM,KAAK,GAAG,aAAa,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IACxC,OAAO,UAAG,GAAG,0BAAgB,KAAK,MAAG,CAAC;AACxC,CAAC;AAED,SAAS,aAAa,CAAC,EAAW,EAAE,MAAe;IACjD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC/C,IAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACnC,IAAI,OAAO,CAAC,OAAO,KAAK,EAAE,CAAC,OAAO,EAAE;YAClC,KAAK,IAAI,CAAC,CAAC;YACX,IAAI,OAAO,KAAK,EAAE;gBAAE,OAAO,KAAK,CAAC;SAClC;KACF;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,aAAa,CAAC,KAAiB,EAAE,QAAgB,EAAE,EAAW;IACrE,IAAI,OAA4B,CAAC;IACjC,IAAI;QACF,OAAO,GAAG,KAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;KAC5C;IAAC,OAAO,EAAE,EAAE;QACX,OAAO,KAAK,CAAC;KACd;IACD,OAAO,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;AACnD,CAAC","sourcesContent":["/**\n * Fallback CSS-path walker — the safety net for the v1 element-selector\n * algorithm.\n *\n * When the orchestrator's strategy chain finds nothing usable across the full\n * ancestor walk, the engine invokes this fallback. It produces a positional\n * selector by walking up from the target to <html>, expressing each step as\n * either an id anchor (when one survives the autogen filter) or a\n * `tag:nth-of-type(n)` step.\n *\n * Key differences from the legacy autocapture `cssPath`:\n *\n * 1. Ids are filtered through `getStableId`, which honors the\n * explicit-tracking-attribute suppression signal AND the autogenerated-id\n * pattern pack. The legacy `cssPath` would happily anchor on `id=\":r5:\"`\n * and produce selectors that never match across page loads.\n *\n * 2. Classes — when they're used at all for sibling disambiguation — are\n * filtered through `filterClasses` against the unstable-class pattern\n * pack. The current v1 implementation here doesn't emit classes (we lean\n * entirely on `:nth-of-type` for sibling disambiguation), but the\n * filtering helper is wired through so future iterations can opt back in\n * surgically without re-deriving the policy.\n *\n * 3. A unique anchor id terminates the walk early — once we hit `body#main`,\n * we don't need to keep walking up to `<html>`.\n *\n * 4. Ambiguous id anchors are skipped. Duplicate ids are invalid HTML but\n * common enough in the wild that fallback must not emit selectors that\n * resolve to the wrong target.\n *\n * Output format mirrors the orchestrator's output: `<anchor> > <descent>`.\n * When no usable id is found anywhere on the walk, the fallback emits a\n * pure-positional selector rooted at `html`.\n *\n * See the design doc:\n * packages/plugin-autocapture-browser/element-selector-strategy-v1-no-classes.md\n */\n\nimport { ResolvedSelectorConfig } from './types';\nimport { getStableId } from './helpers/get-stable-id';\nimport { escapeIdForCss } from './helpers/escape-id';\n\nexport interface FallbackCssPathOptions {\n /** Document or shadow root used for uniqueness checks. Defaults to the target's owner document. */\n scope?: ParentNode;\n}\n\n/**\n * Build a positional CSS selector for `el`, using stable ids as anchors when\n * available and falling back to `tag:nth-of-type(n)` for disambiguation.\n *\n * Honors `config.maxAncestorWalkDepth` defensively — once the depth limit is\n * reached, the walker stops and returns whatever it has built so far rooted at\n * the deepest reached ancestor.\n */\nexport function fallbackCssPath(\n el: Element,\n config: ResolvedSelectorConfig,\n options: FallbackCssPathOptions = {},\n): string {\n const scope: ParentNode = options.scope ?? el.ownerDocument ?? document;\n const segments: string[] = [];\n let cursor: Element | null = el;\n let depth = 0;\n\n while (cursor !== null) {\n if (config.maxAncestorWalkDepth !== undefined && depth > config.maxAncestorWalkDepth) {\n break;\n }\n\n const id = getStableId(cursor, config);\n if (id !== null) {\n // Anchor format mirrors the stableId strategy: `tag#id` with the id\n // CSS-escaped. Only terminate if the composed selector uniquely resolves\n // to the target; duplicate ids should fall through to positional steps.\n const anchorSegment = `${cursor.tagName.toLowerCase()}#${escapeIdForCss(id)}`;\n const candidate = [anchorSegment, ...segments].join(' > ');\n if (isUniqueMatch(scope, candidate, el)) {\n return candidate;\n }\n }\n\n segments.unshift(stepFor(cursor));\n cursor = cursor.parentElement;\n depth += 1;\n }\n\n // Walked all the way to the document root without finding an id. The first\n // segment is whatever `<html>` produced (which is just `html` since it has\n // no parent and no same-tag siblings).\n return segments.join(' > ');\n}\n\n/**\n * Build a single step. For an element with a parent: `tag:nth-of-type(n)`.\n * For a root element (no parent — i.e. <html>): just `tag`.\n *\n * Class-based disambiguation is intentionally not emitted in v1 — see the\n * design doc, \"Why we don't use classes for sibling disambiguation\". The\n * `filterClasses` helper is imported in the package for future iterations.\n */\nfunction stepFor(el: Element): string {\n const tag = el.tagName.toLowerCase();\n const parent = el.parentElement;\n if (parent === null) {\n return tag;\n }\n const index = sameTypeIndex(el, parent);\n return `${tag}:nth-of-type(${index})`;\n}\n\nfunction sameTypeIndex(el: Element, parent: Element): number {\n let count = 0;\n for (let i = 0; i < parent.children.length; i++) {\n const sibling = parent.children[i];\n if (sibling.tagName === el.tagName) {\n count += 1;\n if (sibling === el) return count;\n }\n }\n return 1;\n}\n\nfunction isUniqueMatch(scope: ParentNode, selector: string, el: Element): boolean {\n let matches: NodeListOf<Element>;\n try {\n matches = scope.querySelectorAll(selector);\n } catch (_e) {\n return false;\n }\n return matches.length === 1 && matches[0] === el;\n}\n"]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Top-level chokepoint for "generate a selector for this element."
|
|
3
|
+
*
|
|
4
|
+
* Both the SDK plugin (`plugin-autocapture-browser`) and the dashboard
|
|
5
|
+
* (`session-replay-ui`) used to maintain their own copy of this routing logic:
|
|
6
|
+
*
|
|
7
|
+
* if (config.enabled && engine) return engine.generate(el);
|
|
8
|
+
* else return cssPath(el, false);
|
|
9
|
+
*
|
|
10
|
+
* Two consumers, two routers, two locally-bundled copies of `cssPath`. As soon
|
|
11
|
+
* as we considered a third consumer (Chrome extension visual tagger, future
|
|
12
|
+
* tagging surfaces) the duplication became untenable — bug fixes had to land
|
|
13
|
+
* three places and the kill-switch semantics could drift between them.
|
|
14
|
+
*
|
|
15
|
+
* Moving the kill switch inside `engine.generate` covered the "engine present"
|
|
16
|
+
* case. This helper covers the remaining "engine is null" case that some
|
|
17
|
+
* consumers genuinely have:
|
|
18
|
+
*
|
|
19
|
+
* - dashboard's `useElementSelectorEngineContext()` returns
|
|
20
|
+
* `{ engine: null }` when no provider is mounted (tests, content-renderer
|
|
21
|
+
* paths, future call sites outside the canonical mount tree).
|
|
22
|
+
* - Chrome extension boots before the customer's SDK has stood up an engine
|
|
23
|
+
* on the page; reads `null` from `window.amplitude.elementSelector` until
|
|
24
|
+
* the SDK init finishes.
|
|
25
|
+
*
|
|
26
|
+
* In those cases, callers want the legacy `cssPath` selector — same shape the
|
|
27
|
+
* SDK is emitting in production for orgs without the engine. This helper makes
|
|
28
|
+
* that explicit and centralizes the rule so future consumers don't reinvent
|
|
29
|
+
* it.
|
|
30
|
+
*/
|
|
31
|
+
import { ResolvedSelectorConfig, SelectorEngine } from './types';
|
|
32
|
+
/**
|
|
33
|
+
* Generate a selector for `el`, transparently routing to the legacy
|
|
34
|
+
* `cssPath` walker when no engine is available.
|
|
35
|
+
*
|
|
36
|
+
* Why this signature (engine + config separately, rather than just engine):
|
|
37
|
+
* the dashboard's inert context has `engine: null` but still carries a
|
|
38
|
+
* resolved config. Both `null`-engine and engine-with-`enabled: false`
|
|
39
|
+
* collapse to "legacy `cssPath`", and we want the same one-line call site
|
|
40
|
+
* to handle both. When the engine *is* present, this just delegates — the
|
|
41
|
+
* engine's own kill switch handles `enabled === false`.
|
|
42
|
+
*
|
|
43
|
+
* Never throws. Returns the empty string in the pathological case where the
|
|
44
|
+
* legacy walker itself can't produce one (non-element nodes; environments
|
|
45
|
+
* missing `CSS.escape`).
|
|
46
|
+
*
|
|
47
|
+
* @param el DOM element to identify.
|
|
48
|
+
* @param engine Live `SelectorEngine`, or `null` when no engine is mounted.
|
|
49
|
+
* @param config Resolved selector config. Only consulted in the null-engine
|
|
50
|
+
* branch; when `engine` is present, the engine consults its
|
|
51
|
+
* own internal config.
|
|
52
|
+
*/
|
|
53
|
+
export declare const generateSelector: (el: Element, engine: SelectorEngine | null, config: ResolvedSelectorConfig) => string;
|
|
54
|
+
//# sourceMappingURL=generate-selector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-selector.d.ts","sourceRoot":"","sources":["../../src/generate-selector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGjE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,gBAAgB,OACvB,OAAO,UACH,cAAc,GAAG,IAAI,UACrB,sBAAsB,KAC7B,MAiBF,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Top-level chokepoint for "generate a selector for this element."
|
|
4
|
+
*
|
|
5
|
+
* Both the SDK plugin (`plugin-autocapture-browser`) and the dashboard
|
|
6
|
+
* (`session-replay-ui`) used to maintain their own copy of this routing logic:
|
|
7
|
+
*
|
|
8
|
+
* if (config.enabled && engine) return engine.generate(el);
|
|
9
|
+
* else return cssPath(el, false);
|
|
10
|
+
*
|
|
11
|
+
* Two consumers, two routers, two locally-bundled copies of `cssPath`. As soon
|
|
12
|
+
* as we considered a third consumer (Chrome extension visual tagger, future
|
|
13
|
+
* tagging surfaces) the duplication became untenable — bug fixes had to land
|
|
14
|
+
* three places and the kill-switch semantics could drift between them.
|
|
15
|
+
*
|
|
16
|
+
* Moving the kill switch inside `engine.generate` covered the "engine present"
|
|
17
|
+
* case. This helper covers the remaining "engine is null" case that some
|
|
18
|
+
* consumers genuinely have:
|
|
19
|
+
*
|
|
20
|
+
* - dashboard's `useElementSelectorEngineContext()` returns
|
|
21
|
+
* `{ engine: null }` when no provider is mounted (tests, content-renderer
|
|
22
|
+
* paths, future call sites outside the canonical mount tree).
|
|
23
|
+
* - Chrome extension boots before the customer's SDK has stood up an engine
|
|
24
|
+
* on the page; reads `null` from `window.amplitude.elementSelector` until
|
|
25
|
+
* the SDK init finishes.
|
|
26
|
+
*
|
|
27
|
+
* In those cases, callers want the legacy `cssPath` selector — same shape the
|
|
28
|
+
* SDK is emitting in production for orgs without the engine. This helper makes
|
|
29
|
+
* that explicit and centralizes the rule so future consumers don't reinvent
|
|
30
|
+
* it.
|
|
31
|
+
*/
|
|
32
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
exports.generateSelector = void 0;
|
|
34
|
+
var legacy_css_path_1 = require("./legacy-css-path");
|
|
35
|
+
/**
|
|
36
|
+
* Generate a selector for `el`, transparently routing to the legacy
|
|
37
|
+
* `cssPath` walker when no engine is available.
|
|
38
|
+
*
|
|
39
|
+
* Why this signature (engine + config separately, rather than just engine):
|
|
40
|
+
* the dashboard's inert context has `engine: null` but still carries a
|
|
41
|
+
* resolved config. Both `null`-engine and engine-with-`enabled: false`
|
|
42
|
+
* collapse to "legacy `cssPath`", and we want the same one-line call site
|
|
43
|
+
* to handle both. When the engine *is* present, this just delegates — the
|
|
44
|
+
* engine's own kill switch handles `enabled === false`.
|
|
45
|
+
*
|
|
46
|
+
* Never throws. Returns the empty string in the pathological case where the
|
|
47
|
+
* legacy walker itself can't produce one (non-element nodes; environments
|
|
48
|
+
* missing `CSS.escape`).
|
|
49
|
+
*
|
|
50
|
+
* @param el DOM element to identify.
|
|
51
|
+
* @param engine Live `SelectorEngine`, or `null` when no engine is mounted.
|
|
52
|
+
* @param config Resolved selector config. Only consulted in the null-engine
|
|
53
|
+
* branch; when `engine` is present, the engine consults its
|
|
54
|
+
* own internal config.
|
|
55
|
+
*/
|
|
56
|
+
var generateSelector = function (el, engine, config) {
|
|
57
|
+
if (engine) {
|
|
58
|
+
// The engine has its own kill switch (`config.enabled === false` →
|
|
59
|
+
// legacy cssPath) and its own try/catch safety net. Trust it.
|
|
60
|
+
return engine.generate(el);
|
|
61
|
+
}
|
|
62
|
+
// Engine-null branch. We don't have a live engine to consult, so we route
|
|
63
|
+
// straight to the legacy walker — the same selector the SDK would be
|
|
64
|
+
// emitting if `config.enabled === false`. `config` is accepted for symmetry
|
|
65
|
+
// with the engine signature and so future versions can extend behavior
|
|
66
|
+
// without a breaking change.
|
|
67
|
+
void config;
|
|
68
|
+
try {
|
|
69
|
+
return (0, legacy_css_path_1.legacyCssPath)(el);
|
|
70
|
+
}
|
|
71
|
+
catch (_a) {
|
|
72
|
+
return '';
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
exports.generateSelector = generateSelector;
|
|
76
|
+
//# sourceMappingURL=generate-selector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-selector.js","sourceRoot":"","sources":["../../src/generate-selector.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;;;AAGH,qDAAkD;AAElD;;;;;;;;;;;;;;;;;;;;GAoBG;AACI,IAAM,gBAAgB,GAAG,UAC9B,EAAW,EACX,MAA6B,EAC7B,MAA8B;IAE9B,IAAI,MAAM,EAAE;QACV,mEAAmE;QACnE,8DAA8D;QAC9D,OAAO,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;KAC5B;IACD,0EAA0E;IAC1E,qEAAqE;IACrE,4EAA4E;IAC5E,uEAAuE;IACvE,6BAA6B;IAC7B,KAAK,MAAM,CAAC;IACZ,IAAI;QACF,OAAO,IAAA,+BAAa,EAAC,EAAE,CAAC,CAAC;KAC1B;IAAC,WAAM;QACN,OAAO,EAAE,CAAC;KACX;AACH,CAAC,CAAC;AArBW,QAAA,gBAAgB,oBAqB3B","sourcesContent":["/**\n * Top-level chokepoint for \"generate a selector for this element.\"\n *\n * Both the SDK plugin (`plugin-autocapture-browser`) and the dashboard\n * (`session-replay-ui`) used to maintain their own copy of this routing logic:\n *\n * if (config.enabled && engine) return engine.generate(el);\n * else return cssPath(el, false);\n *\n * Two consumers, two routers, two locally-bundled copies of `cssPath`. As soon\n * as we considered a third consumer (Chrome extension visual tagger, future\n * tagging surfaces) the duplication became untenable — bug fixes had to land\n * three places and the kill-switch semantics could drift between them.\n *\n * Moving the kill switch inside `engine.generate` covered the \"engine present\"\n * case. This helper covers the remaining \"engine is null\" case that some\n * consumers genuinely have:\n *\n * - dashboard's `useElementSelectorEngineContext()` returns\n * `{ engine: null }` when no provider is mounted (tests, content-renderer\n * paths, future call sites outside the canonical mount tree).\n * - Chrome extension boots before the customer's SDK has stood up an engine\n * on the page; reads `null` from `window.amplitude.elementSelector` until\n * the SDK init finishes.\n *\n * In those cases, callers want the legacy `cssPath` selector — same shape the\n * SDK is emitting in production for orgs without the engine. This helper makes\n * that explicit and centralizes the rule so future consumers don't reinvent\n * it.\n */\n\nimport { ResolvedSelectorConfig, SelectorEngine } from './types';\nimport { legacyCssPath } from './legacy-css-path';\n\n/**\n * Generate a selector for `el`, transparently routing to the legacy\n * `cssPath` walker when no engine is available.\n *\n * Why this signature (engine + config separately, rather than just engine):\n * the dashboard's inert context has `engine: null` but still carries a\n * resolved config. Both `null`-engine and engine-with-`enabled: false`\n * collapse to \"legacy `cssPath`\", and we want the same one-line call site\n * to handle both. When the engine *is* present, this just delegates — the\n * engine's own kill switch handles `enabled === false`.\n *\n * Never throws. Returns the empty string in the pathological case where the\n * legacy walker itself can't produce one (non-element nodes; environments\n * missing `CSS.escape`).\n *\n * @param el DOM element to identify.\n * @param engine Live `SelectorEngine`, or `null` when no engine is mounted.\n * @param config Resolved selector config. Only consulted in the null-engine\n * branch; when `engine` is present, the engine consults its\n * own internal config.\n */\nexport const generateSelector = (\n el: Element,\n engine: SelectorEngine | null,\n config: ResolvedSelectorConfig,\n): string => {\n if (engine) {\n // The engine has its own kill switch (`config.enabled === false` →\n // legacy cssPath) and its own try/catch safety net. Trust it.\n return engine.generate(el);\n }\n // Engine-null branch. We don't have a live engine to consult, so we route\n // straight to the legacy walker — the same selector the SDK would be\n // emitting if `config.enabled === false`. `config` is accepted for symmetry\n // with the engine signature and so future versions can extend behavior\n // without a breaking change.\n void config;\n try {\n return legacyCssPath(el);\n } catch {\n return '';\n }\n};\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Positional descent builder.
|
|
3
|
+
*
|
|
4
|
+
* Given an anchor element (the result of pass 2's walk in the orchestration PR)
|
|
5
|
+
* and the trail of intermediate elements between the anchor and the original
|
|
6
|
+
* click target, produce the CSS-selector descent string. Each step in the
|
|
7
|
+
* descent uses `tag:nth-of-type(n)` so the resulting selector resolves
|
|
8
|
+
* unambiguously to the original target regardless of class-state churn.
|
|
9
|
+
*
|
|
10
|
+
* Matches ContentSquare's "position within identical markers" convention.
|
|
11
|
+
*
|
|
12
|
+
* Example:
|
|
13
|
+
*
|
|
14
|
+
* describeRelative(anchor, [<section>, <ul>, <li>])
|
|
15
|
+
* → "section:nth-of-type(1) > ul:nth-of-type(1) > li:nth-of-type(3)"
|
|
16
|
+
*
|
|
17
|
+
* Combined with the anchor selector (`anchor#some-id`) by the orchestrator:
|
|
18
|
+
*
|
|
19
|
+
* "anchor#some-id > section:nth-of-type(1) > ul:nth-of-type(1) > li:nth-of-type(3)"
|
|
20
|
+
*
|
|
21
|
+
* The `anchor` parameter is accepted for symmetry with the orchestrator's call
|
|
22
|
+
* site but isn't currently used — the function only needs each trail element's
|
|
23
|
+
* own parent context. We keep the signature so subsequent work can reference
|
|
24
|
+
* the anchor when extending the descent format (e.g., to optimize bare
|
|
25
|
+
* `:nth-of-type(1)` away when there's only one of that type).
|
|
26
|
+
*/
|
|
27
|
+
export declare function describeRelative(_anchor: Element, trail: Element[]): string;
|
|
28
|
+
//# sourceMappingURL=describe-relative.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe-relative.d.ts","sourceRoot":"","sources":["../../../src/helpers/describe-relative.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,CAE3E"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.describeRelative = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Positional descent builder.
|
|
6
|
+
*
|
|
7
|
+
* Given an anchor element (the result of pass 2's walk in the orchestration PR)
|
|
8
|
+
* and the trail of intermediate elements between the anchor and the original
|
|
9
|
+
* click target, produce the CSS-selector descent string. Each step in the
|
|
10
|
+
* descent uses `tag:nth-of-type(n)` so the resulting selector resolves
|
|
11
|
+
* unambiguously to the original target regardless of class-state churn.
|
|
12
|
+
*
|
|
13
|
+
* Matches ContentSquare's "position within identical markers" convention.
|
|
14
|
+
*
|
|
15
|
+
* Example:
|
|
16
|
+
*
|
|
17
|
+
* describeRelative(anchor, [<section>, <ul>, <li>])
|
|
18
|
+
* → "section:nth-of-type(1) > ul:nth-of-type(1) > li:nth-of-type(3)"
|
|
19
|
+
*
|
|
20
|
+
* Combined with the anchor selector (`anchor#some-id`) by the orchestrator:
|
|
21
|
+
*
|
|
22
|
+
* "anchor#some-id > section:nth-of-type(1) > ul:nth-of-type(1) > li:nth-of-type(3)"
|
|
23
|
+
*
|
|
24
|
+
* The `anchor` parameter is accepted for symmetry with the orchestrator's call
|
|
25
|
+
* site but isn't currently used — the function only needs each trail element's
|
|
26
|
+
* own parent context. We keep the signature so subsequent work can reference
|
|
27
|
+
* the anchor when extending the descent format (e.g., to optimize bare
|
|
28
|
+
* `:nth-of-type(1)` away when there's only one of that type).
|
|
29
|
+
*/
|
|
30
|
+
function describeRelative(_anchor, trail) {
|
|
31
|
+
return trail.map(stepFor).join(' > ');
|
|
32
|
+
}
|
|
33
|
+
exports.describeRelative = describeRelative;
|
|
34
|
+
function stepFor(el) {
|
|
35
|
+
var tag = el.tagName.toLowerCase();
|
|
36
|
+
var parent = el.parentElement;
|
|
37
|
+
if (parent === null) {
|
|
38
|
+
// Detached element or root — emit just the tag. The orchestrator shouldn't
|
|
39
|
+
// call us with a detached trail, but we don't want to crash if it does.
|
|
40
|
+
return tag;
|
|
41
|
+
}
|
|
42
|
+
var index = sameTypeIndex(el, parent);
|
|
43
|
+
return "".concat(tag, ":nth-of-type(").concat(index, ")");
|
|
44
|
+
}
|
|
45
|
+
function sameTypeIndex(el, parent) {
|
|
46
|
+
// 1-based index among same-tag element siblings, mirroring :nth-of-type semantics.
|
|
47
|
+
var count = 0;
|
|
48
|
+
for (var i = 0; i < parent.children.length; i++) {
|
|
49
|
+
var sibling = parent.children[i];
|
|
50
|
+
if (sibling.tagName === el.tagName) {
|
|
51
|
+
count += 1;
|
|
52
|
+
if (sibling === el)
|
|
53
|
+
return count;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// Element wasn't found among its parent's children — shouldn't happen for a
|
|
57
|
+
// live element. Return 1 as a defensive fallback rather than throwing.
|
|
58
|
+
return 1;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=describe-relative.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe-relative.js","sourceRoot":"","sources":["../../../src/helpers/describe-relative.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAgB,gBAAgB,CAAC,OAAgB,EAAE,KAAgB;IACjE,OAAO,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACxC,CAAC;AAFD,4CAEC;AAED,SAAS,OAAO,CAAC,EAAW;IAC1B,IAAM,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IACrC,IAAM,MAAM,GAAG,EAAE,CAAC,aAAa,CAAC;IAChC,IAAI,MAAM,KAAK,IAAI,EAAE;QACnB,2EAA2E;QAC3E,wEAAwE;QACxE,OAAO,GAAG,CAAC;KACZ;IACD,IAAM,KAAK,GAAG,aAAa,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IACxC,OAAO,UAAG,GAAG,0BAAgB,KAAK,MAAG,CAAC;AACxC,CAAC;AAED,SAAS,aAAa,CAAC,EAAW,EAAE,MAAe;IACjD,mFAAmF;IACnF,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC/C,IAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACnC,IAAI,OAAO,CAAC,OAAO,KAAK,EAAE,CAAC,OAAO,EAAE;YAClC,KAAK,IAAI,CAAC,CAAC;YACX,IAAI,OAAO,KAAK,EAAE;gBAAE,OAAO,KAAK,CAAC;SAClC;KACF;IACD,4EAA4E;IAC5E,uEAAuE;IACvE,OAAO,CAAC,CAAC;AACX,CAAC","sourcesContent":["/**\n * Positional descent builder.\n *\n * Given an anchor element (the result of pass 2's walk in the orchestration PR)\n * and the trail of intermediate elements between the anchor and the original\n * click target, produce the CSS-selector descent string. Each step in the\n * descent uses `tag:nth-of-type(n)` so the resulting selector resolves\n * unambiguously to the original target regardless of class-state churn.\n *\n * Matches ContentSquare's \"position within identical markers\" convention.\n *\n * Example:\n *\n * describeRelative(anchor, [<section>, <ul>, <li>])\n * → \"section:nth-of-type(1) > ul:nth-of-type(1) > li:nth-of-type(3)\"\n *\n * Combined with the anchor selector (`anchor#some-id`) by the orchestrator:\n *\n * \"anchor#some-id > section:nth-of-type(1) > ul:nth-of-type(1) > li:nth-of-type(3)\"\n *\n * The `anchor` parameter is accepted for symmetry with the orchestrator's call\n * site but isn't currently used — the function only needs each trail element's\n * own parent context. We keep the signature so subsequent work can reference\n * the anchor when extending the descent format (e.g., to optimize bare\n * `:nth-of-type(1)` away when there's only one of that type).\n */\nexport function describeRelative(_anchor: Element, trail: Element[]): string {\n return trail.map(stepFor).join(' > ');\n}\n\nfunction stepFor(el: Element): string {\n const tag = el.tagName.toLowerCase();\n const parent = el.parentElement;\n if (parent === null) {\n // Detached element or root — emit just the tag. The orchestrator shouldn't\n // call us with a detached trail, but we don't want to crash if it does.\n return tag;\n }\n const index = sameTypeIndex(el, parent);\n return `${tag}:nth-of-type(${index})`;\n}\n\nfunction sameTypeIndex(el: Element, parent: Element): number {\n // 1-based index among same-tag element siblings, mirroring :nth-of-type semantics.\n let count = 0;\n for (let i = 0; i < parent.children.length; i++) {\n const sibling = parent.children[i];\n if (sibling.tagName === el.tagName) {\n count += 1;\n if (sibling === el) return count;\n }\n }\n // Element wasn't found among its parent's children — shouldn't happen for a\n // live element. Return 1 as a defensive fallback rather than throwing.\n return 1;\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Escape a string for use as a CSS identifier.
|
|
3
|
+
*
|
|
4
|
+
* Uses the native CSS.escape implementation when available, with the CSSOM
|
|
5
|
+
* algorithm inlined for runtimes that do not expose it (notably jsdom).
|
|
6
|
+
*/
|
|
7
|
+
export declare function escapeCssIdentifier(value: string): string;
|
|
8
|
+
//# sourceMappingURL=escape-css-identifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escape-css-identifier.d.ts","sourceRoot":"","sources":["../../../src/helpers/escape-css-identifier.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAiDzD"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable no-restricted-globals */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.escapeCssIdentifier = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Escape a string for use as a CSS identifier.
|
|
7
|
+
*
|
|
8
|
+
* Uses the native CSS.escape implementation when available, with the CSSOM
|
|
9
|
+
* algorithm inlined for runtimes that do not expose it (notably jsdom).
|
|
10
|
+
*/
|
|
11
|
+
function escapeCssIdentifier(value) {
|
|
12
|
+
var css = globalThis.CSS;
|
|
13
|
+
if (css && typeof css.escape === 'function') {
|
|
14
|
+
return css.escape(value);
|
|
15
|
+
}
|
|
16
|
+
var string = String(value);
|
|
17
|
+
var length = string.length;
|
|
18
|
+
var result = '';
|
|
19
|
+
for (var index = 0; index < length; index++) {
|
|
20
|
+
var codeUnit = string.charCodeAt(index);
|
|
21
|
+
if (codeUnit === 0x0000) {
|
|
22
|
+
result += '\uFFFD';
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if ((codeUnit >= 0x0001 && codeUnit <= 0x001f) ||
|
|
26
|
+
codeUnit === 0x007f ||
|
|
27
|
+
(index === 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) ||
|
|
28
|
+
(index === 1 && codeUnit >= 0x0030 && codeUnit <= 0x0039 && string.charCodeAt(0) === 0x002d)) {
|
|
29
|
+
result += "\\".concat(codeUnit.toString(16), " ");
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
if (index === 0 && length === 1 && codeUnit === 0x002d) {
|
|
33
|
+
result += '\\-';
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if (codeUnit >= 0x0080 ||
|
|
37
|
+
codeUnit === 0x002d ||
|
|
38
|
+
codeUnit === 0x005f ||
|
|
39
|
+
(codeUnit >= 0x0030 && codeUnit <= 0x0039) ||
|
|
40
|
+
(codeUnit >= 0x0041 && codeUnit <= 0x005a) ||
|
|
41
|
+
(codeUnit >= 0x0061 && codeUnit <= 0x007a)) {
|
|
42
|
+
result += string.charAt(index);
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
result += "\\".concat(string.charAt(index));
|
|
46
|
+
}
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
exports.escapeCssIdentifier = escapeCssIdentifier;
|
|
50
|
+
//# sourceMappingURL=escape-css-identifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escape-css-identifier.js","sourceRoot":"","sources":["../../../src/helpers/escape-css-identifier.ts"],"names":[],"mappings":";AAAA,0CAA0C;;;AAQ1C;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,KAAa;IAC/C,IAAM,GAAG,GAAI,UAA8B,CAAC,GAAG,CAAC;IAChD,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,MAAM,KAAK,UAAU,EAAE;QAC3C,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;KAC1B;IAED,IAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAC7B,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,EAAE,KAAK,EAAE,EAAE;QAC3C,IAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAE1C,IAAI,QAAQ,KAAK,MAAM,EAAE;YACvB,MAAM,IAAI,QAAQ,CAAC;YACnB,SAAS;SACV;QAED,IACE,CAAC,QAAQ,IAAI,MAAM,IAAI,QAAQ,IAAI,MAAM,CAAC;YAC1C,QAAQ,KAAK,MAAM;YACnB,CAAC,KAAK,KAAK,CAAC,IAAI,QAAQ,IAAI,MAAM,IAAI,QAAQ,IAAI,MAAM,CAAC;YACzD,CAAC,KAAK,KAAK,CAAC,IAAI,QAAQ,IAAI,MAAM,IAAI,QAAQ,IAAI,MAAM,IAAI,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,EAC5F;YACA,MAAM,IAAI,YAAK,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAG,CAAC;YACxC,SAAS;SACV;QAED,IAAI,KAAK,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC,IAAI,QAAQ,KAAK,MAAM,EAAE;YACtD,MAAM,IAAI,KAAK,CAAC;YAChB,SAAS;SACV;QAED,IACE,QAAQ,IAAI,MAAM;YAClB,QAAQ,KAAK,MAAM;YACnB,QAAQ,KAAK,MAAM;YACnB,CAAC,QAAQ,IAAI,MAAM,IAAI,QAAQ,IAAI,MAAM,CAAC;YAC1C,CAAC,QAAQ,IAAI,MAAM,IAAI,QAAQ,IAAI,MAAM,CAAC;YAC1C,CAAC,QAAQ,IAAI,MAAM,IAAI,QAAQ,IAAI,MAAM,CAAC,EAC1C;YACA,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC/B,SAAS;SACV;QAED,MAAM,IAAI,YAAK,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAE,CAAC;KACvC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAjDD,kDAiDC","sourcesContent":["/* eslint-disable no-restricted-globals */\n\ntype CssEscapeGlobal = {\n CSS?: {\n escape?: (value: string) => string;\n };\n};\n\n/**\n * Escape a string for use as a CSS identifier.\n *\n * Uses the native CSS.escape implementation when available, with the CSSOM\n * algorithm inlined for runtimes that do not expose it (notably jsdom).\n */\nexport function escapeCssIdentifier(value: string): string {\n const css = (globalThis as CssEscapeGlobal).CSS;\n if (css && typeof css.escape === 'function') {\n return css.escape(value);\n }\n\n const string = String(value);\n const length = string.length;\n let result = '';\n\n for (let index = 0; index < length; index++) {\n const codeUnit = string.charCodeAt(index);\n\n if (codeUnit === 0x0000) {\n result += '\\uFFFD';\n continue;\n }\n\n if (\n (codeUnit >= 0x0001 && codeUnit <= 0x001f) ||\n codeUnit === 0x007f ||\n (index === 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) ||\n (index === 1 && codeUnit >= 0x0030 && codeUnit <= 0x0039 && string.charCodeAt(0) === 0x002d)\n ) {\n result += `\\\\${codeUnit.toString(16)} `;\n continue;\n }\n\n if (index === 0 && length === 1 && codeUnit === 0x002d) {\n result += '\\\\-';\n continue;\n }\n\n if (\n codeUnit >= 0x0080 ||\n codeUnit === 0x002d ||\n codeUnit === 0x005f ||\n (codeUnit >= 0x0030 && codeUnit <= 0x0039) ||\n (codeUnit >= 0x0041 && codeUnit <= 0x005a) ||\n (codeUnit >= 0x0061 && codeUnit <= 0x007a)\n ) {\n result += string.charAt(index);\n continue;\n }\n\n result += `\\\\${string.charAt(index)}`;\n }\n\n return result;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escape-id.d.ts","sourceRoot":"","sources":["../../../src/helpers/escape-id.ts"],"names":[],"mappings":"AAEA,+FAA+F;AAC/F,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAEjD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.escapeIdForCss = void 0;
|
|
4
|
+
var escape_css_identifier_1 = require("./escape-css-identifier");
|
|
5
|
+
/** Escape an element id for the `tag#<id>` selector form shared by strategies and fallback. */
|
|
6
|
+
function escapeIdForCss(id) {
|
|
7
|
+
return (0, escape_css_identifier_1.escapeCssIdentifier)(id);
|
|
8
|
+
}
|
|
9
|
+
exports.escapeIdForCss = escapeIdForCss;
|
|
10
|
+
//# sourceMappingURL=escape-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escape-id.js","sourceRoot":"","sources":["../../../src/helpers/escape-id.ts"],"names":[],"mappings":";;;AAAA,iEAA8D;AAE9D,+FAA+F;AAC/F,SAAgB,cAAc,CAAC,EAAU;IACvC,OAAO,IAAA,2CAAmB,EAAC,EAAE,CAAC,CAAC;AACjC,CAAC;AAFD,wCAEC","sourcesContent":["import { escapeCssIdentifier } from './escape-css-identifier';\n\n/** Escape an element id for the `tag#<id>` selector form shared by strategies and fallback. */\nexport function escapeIdForCss(id: string): string {\n return escapeCssIdentifier(id);\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ResolvedSelectorConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Shared helper that the `stableId` strategy (in this PR) and the
|
|
4
|
+
* `fallback-css-path` walker (in the orchestration PR) both consult to decide
|
|
5
|
+
* whether an element's id is usable as a selector anchor.
|
|
6
|
+
*
|
|
7
|
+
* Resolution order:
|
|
8
|
+
*
|
|
9
|
+
* 1. Check the customer's explicit-tracking attribute. If set with an empty
|
|
10
|
+
* value (e.g. `data-amp-track-id=""`), that's an explicit suppression
|
|
11
|
+
* signal — the customer is telling us to ignore this element's id even
|
|
12
|
+
* if it would otherwise look stable. Return null.
|
|
13
|
+
* 2. Read the element's id. If absent or empty, return null.
|
|
14
|
+
* 3. Check the id against the autogenerated-id pattern pack. If matched,
|
|
15
|
+
* return null (the algorithm should walk past this element).
|
|
16
|
+
* 4. Otherwise return the id.
|
|
17
|
+
*
|
|
18
|
+
* The single point of consultation means the strategy and the fallback always
|
|
19
|
+
* agree on what's a usable id — no chance of one component filtering an id
|
|
20
|
+
* while another uses it anyway.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getStableId(el: Element, cfg: ResolvedSelectorConfig): string | null;
|
|
23
|
+
//# sourceMappingURL=get-stable-id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-stable-id.d.ts","sourceRoot":"","sources":["../../../src/helpers/get-stable-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAGlD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,sBAAsB,GAAG,MAAM,GAAG,IAAI,CAoBnF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getStableId = void 0;
|
|
4
|
+
var autogenerated_ids_1 = require("../patterns/autogenerated-ids");
|
|
5
|
+
/**
|
|
6
|
+
* Shared helper that the `stableId` strategy (in this PR) and the
|
|
7
|
+
* `fallback-css-path` walker (in the orchestration PR) both consult to decide
|
|
8
|
+
* whether an element's id is usable as a selector anchor.
|
|
9
|
+
*
|
|
10
|
+
* Resolution order:
|
|
11
|
+
*
|
|
12
|
+
* 1. Check the customer's explicit-tracking attribute. If set with an empty
|
|
13
|
+
* value (e.g. `data-amp-track-id=""`), that's an explicit suppression
|
|
14
|
+
* signal — the customer is telling us to ignore this element's id even
|
|
15
|
+
* if it would otherwise look stable. Return null.
|
|
16
|
+
* 2. Read the element's id. If absent or empty, return null.
|
|
17
|
+
* 3. Check the id against the autogenerated-id pattern pack. If matched,
|
|
18
|
+
* return null (the algorithm should walk past this element).
|
|
19
|
+
* 4. Otherwise return the id.
|
|
20
|
+
*
|
|
21
|
+
* The single point of consultation means the strategy and the fallback always
|
|
22
|
+
* agree on what's a usable id — no chance of one component filtering an id
|
|
23
|
+
* while another uses it anyway.
|
|
24
|
+
*/
|
|
25
|
+
function getStableId(el, cfg) {
|
|
26
|
+
// 1. Suppression signal: empty explicit-tracking attribute on this element.
|
|
27
|
+
var trackAttr = el.getAttribute(cfg.explicitTrackingAttribute);
|
|
28
|
+
if (trackAttr !== null && trackAttr === '') {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
// 2. Id presence.
|
|
32
|
+
var id = el.getAttribute('id');
|
|
33
|
+
if (id === null || id === '') {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
// 3. Autogenerated-pattern filter.
|
|
37
|
+
if (!(0, autogenerated_ids_1.isStableId)(id, cfg.autogeneratedIdPatterns)) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
// 4. Stable.
|
|
41
|
+
return id;
|
|
42
|
+
}
|
|
43
|
+
exports.getStableId = getStableId;
|
|
44
|
+
//# sourceMappingURL=get-stable-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-stable-id.js","sourceRoot":"","sources":["../../../src/helpers/get-stable-id.ts"],"names":[],"mappings":";;;AACA,mEAA2D;AAE3D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,WAAW,CAAC,EAAW,EAAE,GAA2B;IAClE,4EAA4E;IAC5E,IAAM,SAAS,GAAG,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;IACjE,IAAI,SAAS,KAAK,IAAI,IAAI,SAAS,KAAK,EAAE,EAAE;QAC1C,OAAO,IAAI,CAAC;KACb;IAED,kBAAkB;IAClB,IAAM,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,EAAE,EAAE;QAC5B,OAAO,IAAI,CAAC;KACb;IAED,mCAAmC;IACnC,IAAI,CAAC,IAAA,8BAAU,EAAC,EAAE,EAAE,GAAG,CAAC,uBAAuB,CAAC,EAAE;QAChD,OAAO,IAAI,CAAC;KACb;IAED,aAAa;IACb,OAAO,EAAE,CAAC;AACZ,CAAC;AApBD,kCAoBC","sourcesContent":["import { ResolvedSelectorConfig } from '../types';\nimport { isStableId } from '../patterns/autogenerated-ids';\n\n/**\n * Shared helper that the `stableId` strategy (in this PR) and the\n * `fallback-css-path` walker (in the orchestration PR) both consult to decide\n * whether an element's id is usable as a selector anchor.\n *\n * Resolution order:\n *\n * 1. Check the customer's explicit-tracking attribute. If set with an empty\n * value (e.g. `data-amp-track-id=\"\"`), that's an explicit suppression\n * signal — the customer is telling us to ignore this element's id even\n * if it would otherwise look stable. Return null.\n * 2. Read the element's id. If absent or empty, return null.\n * 3. Check the id against the autogenerated-id pattern pack. If matched,\n * return null (the algorithm should walk past this element).\n * 4. Otherwise return the id.\n *\n * The single point of consultation means the strategy and the fallback always\n * agree on what's a usable id — no chance of one component filtering an id\n * while another uses it anyway.\n */\nexport function getStableId(el: Element, cfg: ResolvedSelectorConfig): string | null {\n // 1. Suppression signal: empty explicit-tracking attribute on this element.\n const trackAttr = el.getAttribute(cfg.explicitTrackingAttribute);\n if (trackAttr !== null && trackAttr === '') {\n return null;\n }\n\n // 2. Id presence.\n const id = el.getAttribute('id');\n if (id === null || id === '') {\n return null;\n }\n\n // 3. Autogenerated-pattern filter.\n if (!isStableId(id, cfg.autogeneratedIdPatterns)) {\n return null;\n }\n\n // 4. Stable.\n return id;\n}\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @amplitude/element-selector
|
|
3
|
+
*
|
|
4
|
+
* Shared element-selector algorithm consumed by autocapture, the
|
|
5
|
+
* app.amplitude.com tagging UI, and the Chrome extension visual tagger.
|
|
6
|
+
*
|
|
7
|
+
* This file is the package's public API surface. The orchestrator, fallback,
|
|
8
|
+
* config resolver, and engine factory compose on top of the primitives
|
|
9
|
+
* (types, pattern packs, helpers, strategies) to produce the runtime engine
|
|
10
|
+
* consumers actually call.
|
|
11
|
+
*
|
|
12
|
+
* See the design doc:
|
|
13
|
+
* packages/plugin-autocapture-browser/element-selector-strategy-v1-no-classes.md
|
|
14
|
+
*/
|
|
15
|
+
export declare const PACKAGE_NAME = "@amplitude/element-selector";
|
|
16
|
+
export type { Strategy, StrategyContext, ResolvedSelectorConfig, ElementSelectorRemoteConfig, ElementSelectorLogger, SelectorEngine, } from './types';
|
|
17
|
+
export { DEFAULT_AUTOGENERATED_ID_PATTERNS, compile as compileAutogeneratedIdPatterns, isStableId, } from './patterns/autogenerated-ids';
|
|
18
|
+
export { DEFAULT_UNSTABLE_CLASS_PATTERNS, compile as compileUnstableClassPatterns, filterClasses, } from './patterns/unstable-classes';
|
|
19
|
+
export { getStableId } from './helpers/get-stable-id';
|
|
20
|
+
export { describeRelative } from './helpers/describe-relative';
|
|
21
|
+
export { explicitTrackingAttribute } from './strategies/explicit-tracking-attribute';
|
|
22
|
+
export { stableId as stableIdStrategy } from './strategies/stable-id';
|
|
23
|
+
export { runOrchestrator, DEFAULT_STRATEGIES } from './orchestrator';
|
|
24
|
+
export type { OrchestratorOptions } from './orchestrator';
|
|
25
|
+
export { fallbackCssPath } from './fallback-css-path';
|
|
26
|
+
export { legacyCssPath } from './legacy-css-path';
|
|
27
|
+
export { resolveSelectorConfig, DEFAULT_RESOLVED_CONFIG } from './config/resolve-config';
|
|
28
|
+
export { createSelectorEngine } from './engine';
|
|
29
|
+
export type { CreateSelectorEngineOptions } from './engine';
|
|
30
|
+
export { generateSelector } from './generate-selector';
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,YAAY,gCAAgC,CAAC;AAG1D,YAAY,EACV,QAAQ,EACR,eAAe,EACf,sBAAsB,EACtB,2BAA2B,EAC3B,qBAAqB,EACrB,cAAc,GACf,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,iCAAiC,EACjC,OAAO,IAAI,8BAA8B,EACzC,UAAU,GACX,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,+BAA+B,EAC/B,OAAO,IAAI,4BAA4B,EACvC,aAAa,GACd,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAG/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AACrF,OAAO,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAKtE,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACrE,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAWtD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAGzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAChD,YAAY,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAO5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
|