@adobe/helix-rum-enhancer 2.49.0 → 2.50.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/CHANGELOG.md +19 -0
- package/modules/fflags.js +1 -1
- package/package.json +21 -21
- package/plugins/martech.js +1 -0
- package/rollup.config.js +6 -1
- package/src/index.js +417 -430
- package/src/index.md5 +1 -1
- package/src/index.sri +1 -1
- package/src/plugins/a11y.map.js +1 -1
- package/src/plugins/a11y.md5 +1 -1
- package/src/plugins/cwv.js +313 -205
- package/src/plugins/cwv.map.js +314 -206
- package/src/plugins/cwv.md5 +1 -1
- package/src/plugins/form.map.js +1 -1
- package/src/plugins/martech.js +2 -1
- package/src/plugins/martech.map.js +3 -2
- package/src/plugins/martech.md5 +1 -1
- package/src/plugins/onetrust.map.js +1 -1
- package/src/plugins/onetrust.md5 +1 -1
- package/src/plugins/redirect.map.js +1 -1
- package/src/plugins/redirect.md5 +1 -1
- package/src/plugins/trustarc.map.js +1 -1
- package/src/plugins/trustarc.md5 +1 -1
- package/src/plugins/usercentrics.map.js +1 -1
- package/src/plugins/usercentrics.md5 +1 -1
- package/src/plugins/video.map.js +1 -1
- package/src/plugins/video.md5 +1 -1
- package/src/plugins/webcomponent.map.js +1 -1
- package/src/plugins/webcomponent.md5 +1 -1
package/src/plugins/cwv.js
CHANGED
|
@@ -9,287 +9,395 @@
|
|
|
9
9
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
(function (
|
|
12
|
+
(function (t) {
|
|
13
13
|
|
|
14
|
-
let
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
let n = -1;
|
|
15
|
+
const e = () => n,
|
|
16
|
+
i = t => {
|
|
17
|
+
addEventListener("pageshow", e => {
|
|
18
|
+
e.persisted && (n = e.timeStamp, t(e));
|
|
18
19
|
}, true);
|
|
19
20
|
},
|
|
20
|
-
|
|
21
|
-
let
|
|
22
|
-
return
|
|
23
|
-
|
|
21
|
+
o = (t, n, e, i) => {
|
|
22
|
+
let o, s;
|
|
23
|
+
return a => {
|
|
24
|
+
n.value >= 0 && (a || i) && (s = n.value - (o ?? 0), (s || void 0 === o) && (o = n.value, n.delta = s, n.rating = ((t, n) => t > n[1] ? "poor" : t > n[0] ? "needs-improvement" : "good")(n.value, e), t(n)));
|
|
24
25
|
};
|
|
25
26
|
},
|
|
26
|
-
s =
|
|
27
|
-
requestAnimationFrame(() => requestAnimationFrame(
|
|
27
|
+
s = t => {
|
|
28
|
+
requestAnimationFrame(() => requestAnimationFrame(() => t()));
|
|
28
29
|
},
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
if (
|
|
30
|
+
a = () => {
|
|
31
|
+
const t = performance.getEntriesByType("navigation")[0];
|
|
32
|
+
if (t && t.responseStart > 0 && t.responseStart < performance.now()) return t;
|
|
32
33
|
},
|
|
33
|
-
r = () =>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
r = () => a()?.activationStart ?? 0;
|
|
35
|
+
let c = -1;
|
|
36
|
+
const f = new Set(),
|
|
37
|
+
h = () => "hidden" !== document.visibilityState || document.prerendering ? 1 / 0 : 0,
|
|
38
|
+
d = t => {
|
|
39
|
+
if ("hidden" === document.visibilityState) {
|
|
40
|
+
if ("visibilitychange" === t.type) for (const t of f) t();
|
|
41
|
+
isFinite(c) || (c = "visibilitychange" === t.type ? t.timeStamp : 0, removeEventListener("prerenderingchange", d, true));
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
l = (t = false) => {
|
|
45
|
+
if (t && (c = 1 / 0), c < 0) {
|
|
46
|
+
const t = r(),
|
|
47
|
+
n = document.prerendering ? void 0 : globalThis.performance.getEntriesByType("visibility-state").find(n => "hidden" === n.name && n.startTime >= t)?.startTime;
|
|
48
|
+
c = n ?? h(), addEventListener("visibilitychange", d, true), addEventListener("prerenderingchange", d, true), i(() => {
|
|
49
|
+
setTimeout(() => {
|
|
50
|
+
c = h();
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
}
|
|
38
54
|
return {
|
|
39
|
-
|
|
55
|
+
get firstHiddenTime() {
|
|
56
|
+
return c;
|
|
57
|
+
},
|
|
58
|
+
onHidden(t) {
|
|
59
|
+
f.add(t);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
g = (t, n = -1, i, o = 0, s, c, f) => {
|
|
64
|
+
const h = a(),
|
|
65
|
+
d = h?.navigationId || 0;
|
|
66
|
+
let l = "navigate";
|
|
67
|
+
i ? l = i : e() >= 0 ? l = "back-forward-cache" : h && (document.prerendering || r() > 0 ? l = "prerender" : document.wasDiscarded ? l = "restore" : h.type && (l = h.type.replace(/_/g, "-")));
|
|
68
|
+
return {
|
|
69
|
+
name: t,
|
|
40
70
|
value: n,
|
|
41
71
|
rating: "good",
|
|
42
72
|
delta: 0,
|
|
43
73
|
entries: [],
|
|
44
|
-
id: `
|
|
45
|
-
navigationType:
|
|
74
|
+
id: `v6-${Date.now()}-${Math.floor(8999999999999 * Math.random()) + 1e12}`,
|
|
75
|
+
navigationType: l,
|
|
76
|
+
navigationId: o || d,
|
|
77
|
+
navigationInteractionId: s,
|
|
78
|
+
navigationURL: c || h?.name,
|
|
79
|
+
navigationStartTime: f || 0
|
|
46
80
|
};
|
|
47
81
|
},
|
|
48
|
-
|
|
49
|
-
function
|
|
50
|
-
let
|
|
51
|
-
return
|
|
82
|
+
u = new WeakMap();
|
|
83
|
+
function v(t, n) {
|
|
84
|
+
let e = u.get(n);
|
|
85
|
+
return e || (e = new WeakMap(), u.set(n, e)), e.get(t) || e.set(t, new n()), e.get(t);
|
|
52
86
|
}
|
|
53
|
-
class
|
|
87
|
+
class m {
|
|
54
88
|
t;
|
|
55
89
|
i = 0;
|
|
56
90
|
o = [];
|
|
57
|
-
h(
|
|
58
|
-
if (
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
this.i &&
|
|
91
|
+
h(t) {
|
|
92
|
+
if (t.hadRecentInput) return;
|
|
93
|
+
const n = this.o[0],
|
|
94
|
+
e = this.o.at(-1);
|
|
95
|
+
this.i && n && e && t.startTime - e.startTime < 1e3 && t.startTime - n.startTime < 5e3 ? (this.i += t.value, this.o.push(t)) : (this.i = t.value, this.o = [t]), this.t?.(t);
|
|
62
96
|
}
|
|
63
97
|
}
|
|
64
|
-
const
|
|
98
|
+
const p = (t, n, e = {}) => {
|
|
65
99
|
try {
|
|
66
|
-
|
|
67
|
-
|
|
100
|
+
const i = t.filter(t => PerformanceObserver.supportedEntryTypes.includes(t));
|
|
101
|
+
if (i.length > 0) {
|
|
102
|
+
const t = new PerformanceObserver(t => {
|
|
68
103
|
queueMicrotask(() => {
|
|
69
|
-
t
|
|
104
|
+
const e = t.getEntries();
|
|
105
|
+
i.length > 1 && e.sort((t, n) => t.startTime + t.duration - (n.startTime + n.duration)), n(e);
|
|
70
106
|
});
|
|
71
107
|
});
|
|
72
|
-
|
|
73
|
-
type:
|
|
108
|
+
for (const n of i) t.observe({
|
|
109
|
+
type: n,
|
|
74
110
|
buffered: !0,
|
|
75
|
-
...
|
|
76
|
-
})
|
|
111
|
+
...e
|
|
112
|
+
});
|
|
113
|
+
return t;
|
|
77
114
|
}
|
|
78
115
|
} catch {}
|
|
79
116
|
},
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
};
|
|
86
|
-
let u = -1;
|
|
87
|
-
const m = new Set(),
|
|
88
|
-
g = () => "hidden" !== document.visibilityState || document.prerendering ? 1 / 0 : 0,
|
|
89
|
-
p = e => {
|
|
90
|
-
if ("hidden" === document.visibilityState) {
|
|
91
|
-
if ("visibilitychange" === e.type) for (const e of m) e();
|
|
92
|
-
isFinite(u) || (u = "visibilitychange" === e.type ? e.timeStamp : 0, removeEventListener("prerenderingchange", p, true));
|
|
117
|
+
b = t => globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation") && "function" == typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint && t && t.reportSoftNavs,
|
|
118
|
+
T = (t, n) => {
|
|
119
|
+
if (t.set(n.navigationId, n), t.size > 2) {
|
|
120
|
+
const n = t.keys().next().value;
|
|
121
|
+
void 0 !== n && t.delete(n);
|
|
93
122
|
}
|
|
94
123
|
},
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
u = t ?? g(), addEventListener("visibilitychange", p, true), addEventListener("prerenderingchange", p, true), n(() => {
|
|
100
|
-
setTimeout(() => {
|
|
101
|
-
u = g();
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
return {
|
|
106
|
-
get firstHiddenTime() {
|
|
107
|
-
return u;
|
|
108
|
-
},
|
|
109
|
-
onHidden(e) {
|
|
110
|
-
m.add(e);
|
|
111
|
-
}
|
|
124
|
+
y = t => {
|
|
125
|
+
let n = false;
|
|
126
|
+
return () => {
|
|
127
|
+
n || (t(), n = true);
|
|
112
128
|
};
|
|
129
|
+
};
|
|
130
|
+
class _ {
|
|
131
|
+
l;
|
|
132
|
+
}
|
|
133
|
+
const E = t => {
|
|
134
|
+
document.prerendering ? addEventListener("prerenderingchange", t, true) : t();
|
|
113
135
|
},
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
for (const t of e) "first-contentful-paint" === t.name && (h.disconnect(), t.startTime < o.firstHiddenTime && (d.value = Math.max(t.startTime - r(), 0), d.entries.push(t), a(true)));
|
|
136
|
+
M = [1800, 3e3],
|
|
137
|
+
L = (t, n = {}) => {
|
|
138
|
+
const a = b(n);
|
|
139
|
+
E(() => {
|
|
140
|
+
const c = v(n, _),
|
|
141
|
+
f = l();
|
|
142
|
+
let h,
|
|
143
|
+
d = g("FCP");
|
|
144
|
+
const u = p(["paint"], t => {
|
|
145
|
+
for (const n of t) "first-contentful-paint" === n.name && (u.disconnect(), n.startTime < f.firstHiddenTime && (d.value = Math.max(n.startTime - r(), 0), d.entries.push(n), d.navigationId = n.navigationId || d.navigationId, h(true)));
|
|
125
146
|
});
|
|
126
|
-
|
|
127
|
-
d =
|
|
128
|
-
d.value = performance.now() -
|
|
147
|
+
if (u && (h = o(t, d, M, n.reportAllChanges), i(i => {
|
|
148
|
+
d = g("FCP", -1, "back-forward-cache", d.navigationId, d.navigationInteractionId, d.navigationURL, e()), h = o(t, d, M, n.reportAllChanges), s(() => {
|
|
149
|
+
d.value = performance.now() - i.timeStamp, h(true);
|
|
129
150
|
});
|
|
130
|
-
}))
|
|
151
|
+
})), a) {
|
|
152
|
+
p(["soft-navigation"], e => {
|
|
153
|
+
e.forEach(e => {
|
|
154
|
+
c.l && e.navigationId && T(c.l, e);
|
|
155
|
+
const i = Math.max((e.presentationTime || e.paintTime || 0) - e.startTime, 0);
|
|
156
|
+
d = g("FCP", i, "soft-navigation", e.navigationId, e.interactionId, e.name, e.startTime), h = o(t, d, M, n.reportAllChanges), h(true);
|
|
157
|
+
});
|
|
158
|
+
}, n);
|
|
159
|
+
}
|
|
131
160
|
});
|
|
132
161
|
},
|
|
133
|
-
|
|
134
|
-
let
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const
|
|
138
|
-
for (const
|
|
162
|
+
w = [.1, .25];
|
|
163
|
+
let P = 0,
|
|
164
|
+
I = 1 / 0,
|
|
165
|
+
k = 0;
|
|
166
|
+
const C = t => {
|
|
167
|
+
for (const n of t) n.interactionId && (I = Math.min(I, n.interactionId), k = Math.max(k, n.interactionId), P = k ? (k - I) / 7 + 1 : 0);
|
|
139
168
|
};
|
|
140
|
-
let
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
"interactionCount" in performance ||
|
|
169
|
+
let F;
|
|
170
|
+
const N = () => F ? P : performance.interactionCount ?? 0,
|
|
171
|
+
B = () => {
|
|
172
|
+
"interactionCount" in performance || F || (F = p(["event"], C, {
|
|
144
173
|
durationThreshold: 0
|
|
145
174
|
}));
|
|
146
175
|
};
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
m;
|
|
176
|
+
class S {
|
|
177
|
+
u = 0;
|
|
178
|
+
v = [];
|
|
179
|
+
m = new Map();
|
|
152
180
|
p;
|
|
153
|
-
|
|
154
|
-
|
|
181
|
+
T;
|
|
182
|
+
_() {
|
|
183
|
+
return N() - this.u;
|
|
155
184
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
return this.l[e];
|
|
185
|
+
M() {
|
|
186
|
+
this.u = N(), this.v.length = 0, this.m.clear();
|
|
159
187
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
188
|
+
L(t) {
|
|
189
|
+
const n = this._(),
|
|
190
|
+
e = Math.min(this.v.length - 1, Math.floor(n / 50));
|
|
191
|
+
return !n || -1 !== e || "soft-navigation" !== t && "back-forward-cache" !== t ? this.v[e] : {
|
|
192
|
+
P: 8,
|
|
193
|
+
id: -1,
|
|
194
|
+
entries: []
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
h(t) {
|
|
198
|
+
if (this.p?.(t), !t.interactionId) return;
|
|
199
|
+
const n = this.v.at(-1);
|
|
200
|
+
let e = this.m.get(t.interactionId);
|
|
201
|
+
if (e || this.v.length < 10 || t.duration > n.P) {
|
|
202
|
+
if (e ? t.duration > e.P ? (e.entries = [t], e.P = t.duration) : t.duration === e.P && t.startTime === e.entries[0].startTime && e.entries.push(t) : (e = {
|
|
203
|
+
id: t.interactionId,
|
|
204
|
+
entries: [t],
|
|
205
|
+
P: t.duration
|
|
206
|
+
}, this.m.set(e.id, e), this.v.push(e)), this.v.sort((t, n) => n.P - t.P), this.v.length > 10) {
|
|
207
|
+
const t = this.v.splice(10);
|
|
208
|
+
for (const n of t) this.m.delete(n.id);
|
|
172
209
|
}
|
|
173
|
-
this.
|
|
210
|
+
this.T?.(e);
|
|
174
211
|
}
|
|
175
212
|
}
|
|
176
213
|
}
|
|
177
|
-
const
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
214
|
+
const q = t => {
|
|
215
|
+
const n = "requestIdleCallback" in globalThis ? 1e3 : 0,
|
|
216
|
+
e = globalThis.requestIdleCallback || setTimeout,
|
|
217
|
+
i = globalThis.cancelIdleCallback || clearTimeout;
|
|
218
|
+
if ("hidden" === document.visibilityState) t();else {
|
|
219
|
+
const o = y(t);
|
|
182
220
|
let s = -1;
|
|
183
|
-
const
|
|
184
|
-
|
|
221
|
+
const a = () => {
|
|
222
|
+
i(s), o();
|
|
185
223
|
};
|
|
186
|
-
addEventListener("visibilitychange",
|
|
224
|
+
addEventListener("visibilitychange", a, {
|
|
187
225
|
once: true,
|
|
188
226
|
capture: true
|
|
189
|
-
}), s =
|
|
190
|
-
removeEventListener("visibilitychange",
|
|
227
|
+
}), s = e(() => {
|
|
228
|
+
removeEventListener("visibilitychange", a, {
|
|
191
229
|
capture: true
|
|
192
|
-
}),
|
|
230
|
+
}), o();
|
|
231
|
+
}, {
|
|
232
|
+
timeout: n
|
|
193
233
|
});
|
|
194
234
|
}
|
|
195
235
|
},
|
|
196
|
-
|
|
197
|
-
class
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
236
|
+
A = [200, 500];
|
|
237
|
+
class H {
|
|
238
|
+
p;
|
|
239
|
+
l;
|
|
240
|
+
h(t) {
|
|
241
|
+
this.p?.(t);
|
|
201
242
|
}
|
|
202
243
|
}
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
document.prerendering ?
|
|
244
|
+
const O = [2500, 4e3],
|
|
245
|
+
U = [800, 1800],
|
|
246
|
+
V = t => {
|
|
247
|
+
document.prerendering ? E(() => V(t)) : "complete" !== document.readyState ? addEventListener("load", () => V(t), true) : setTimeout(t);
|
|
207
248
|
};
|
|
208
|
-
return
|
|
209
|
-
const
|
|
210
|
-
|
|
249
|
+
return t.CLSThresholds = w, t.FCPThresholds = M, t.INPThresholds = A, t.LCPThresholds = O, t.TTFBThresholds = U, t.onCLS = (t, n = {}) => {
|
|
250
|
+
const a = l();
|
|
251
|
+
L(y(() => {
|
|
211
252
|
let r,
|
|
212
|
-
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
253
|
+
c = g("CLS", 0);
|
|
254
|
+
const f = v(n, m),
|
|
255
|
+
h = (e, i, s, a, h) => {
|
|
256
|
+
c = g("CLS", 0, e, i, s, a, h), f.i = 0, r = o(t, c, w, n.reportAllChanges);
|
|
257
|
+
},
|
|
258
|
+
d = (t = false) => {
|
|
259
|
+
f.i > c.value && (c.value = f.i, c.entries = f.o), r(t);
|
|
260
|
+
},
|
|
261
|
+
l = t => {
|
|
262
|
+
d(true), h("soft-navigation", t.navigationId, t.interactionId, t.name, t.startTime);
|
|
263
|
+
},
|
|
264
|
+
u = t => {
|
|
265
|
+
for (const n of t) "soft-navigation" !== n.entryType ? f.h(n) : l(n);
|
|
266
|
+
d();
|
|
217
267
|
},
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
268
|
+
T = ["layout-shift"];
|
|
269
|
+
b(n) && T.push("soft-navigation");
|
|
270
|
+
const y = p(T, u);
|
|
271
|
+
y && (r = o(t, c, w, n.reportAllChanges), a.onHidden(() => {
|
|
272
|
+
u(y.takeRecords()), r(true);
|
|
273
|
+
}), i(() => {
|
|
274
|
+
h("back-forward-cache", c.navigationId, c.navigationInteractionId, c.navigationURL, e()), s(r);
|
|
223
275
|
}), setTimeout(r));
|
|
224
276
|
}));
|
|
225
|
-
},
|
|
277
|
+
}, t.onFCP = L, t.onINP = (t, n = {}) => {
|
|
226
278
|
if (!globalThis.PerformanceEventTiming || !("interactionId" in PerformanceEventTiming.prototype)) return;
|
|
227
|
-
const s =
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
let
|
|
231
|
-
r =
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
279
|
+
const s = l();
|
|
280
|
+
E(() => {
|
|
281
|
+
B();
|
|
282
|
+
let a,
|
|
283
|
+
r = g("INP");
|
|
284
|
+
const c = v(n, S),
|
|
285
|
+
f = (e, i, s, f, h) => {
|
|
286
|
+
c.M(), r = g("INP", -1, e, i, s, f, h), a = o(t, r, A, n.reportAllChanges);
|
|
287
|
+
},
|
|
288
|
+
h = () => {
|
|
289
|
+
const t = c.L(r.navigationType);
|
|
290
|
+
t && t.P !== r.value && (r.value = t.P, r.entries = t.entries, a());
|
|
291
|
+
},
|
|
292
|
+
d = t => {
|
|
293
|
+
h(), a(true), f("soft-navigation", t.navigationId, t.interactionId, t.name, t.startTime);
|
|
294
|
+
},
|
|
295
|
+
l = (t, n = false) => {
|
|
296
|
+
q(() => {
|
|
297
|
+
for (const n of t) "soft-navigation" !== n.entryType ? c.h(n) : d(n);
|
|
298
|
+
h(), n && a(true);
|
|
238
299
|
});
|
|
239
300
|
},
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}),
|
|
249
|
-
|
|
301
|
+
u = ["event", "first-input"];
|
|
302
|
+
b(n) && u.push("soft-navigation");
|
|
303
|
+
const m = p(u, l, {
|
|
304
|
+
...n,
|
|
305
|
+
durationThreshold: n.durationThreshold ?? 40
|
|
306
|
+
});
|
|
307
|
+
a = o(t, r, A, n.reportAllChanges), m && (s.onHidden(() => {
|
|
308
|
+
l(m.takeRecords(), true);
|
|
309
|
+
}), i(() => {
|
|
310
|
+
f("back-forward-cache", r.navigationId, r.navigationInteractionId, r.navigationURL, e());
|
|
250
311
|
}));
|
|
251
312
|
});
|
|
252
|
-
},
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
313
|
+
}, t.onLCP = (t, n = {}) => {
|
|
314
|
+
let a = false;
|
|
315
|
+
const c = b(n);
|
|
316
|
+
E(() => {
|
|
317
|
+
let f,
|
|
318
|
+
h = l(),
|
|
319
|
+
d = g("LCP");
|
|
320
|
+
const u = v(n, H),
|
|
321
|
+
m = (e, i, s, r, c) => {
|
|
322
|
+
d = g("LCP", -1, e, i, s, r, c), f = o(t, d, O, n.reportAllChanges), a = false, "soft-navigation" === e && (h = l(true));
|
|
323
|
+
},
|
|
324
|
+
b = t => {
|
|
325
|
+
u.l && t.navigationId && T(u.l, t), a || f(true), m("soft-navigation", t.navigationId, t.interactionId, t.name, t.startTime);
|
|
326
|
+
const n = t.getLargestInteractionContentfulPaint?.();
|
|
327
|
+
n && y([n]);
|
|
328
|
+
},
|
|
329
|
+
y = t => {
|
|
330
|
+
n.reportAllChanges || c || (t = t.slice(-1));
|
|
331
|
+
for (const n of t) {
|
|
332
|
+
if (!n) continue;
|
|
333
|
+
if ("soft-navigation" === n.entryType) {
|
|
334
|
+
b(n);
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
337
|
+
let t = 0,
|
|
338
|
+
e = [],
|
|
339
|
+
i = n.startTime;
|
|
340
|
+
if ("largest-contentful-paint" === n.entryType) t = Math.max(n.startTime - r(), 0), u.h(n), e = [n];else if ("interaction-contentful-paint" === n.entryType) {
|
|
341
|
+
const o = n;
|
|
342
|
+
if (!d.navigationId) continue;
|
|
343
|
+
if ("interactionId" in o && o.interactionId != d.navigationInteractionId) continue;
|
|
344
|
+
i = o.largestContentfulPaint?.renderTime || 0, t = Math.max(i - n.startTime, 0), o.largestContentfulPaint && (u.h(o.largestContentfulPaint), e = [o.largestContentfulPaint]);
|
|
345
|
+
}
|
|
346
|
+
i < h.firstHiddenTime && (d.value = t, d.entries = e, f());
|
|
347
|
+
}
|
|
261
348
|
},
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
349
|
+
_ = ["largest-contentful-paint"];
|
|
350
|
+
c && _.push("interaction-contentful-paint", "soft-navigation");
|
|
351
|
+
const E = p(_, y);
|
|
352
|
+
if (E) {
|
|
353
|
+
f = o(t, d, O, n.reportAllChanges);
|
|
354
|
+
const r = ["keydown", "click", "visibilitychange"],
|
|
355
|
+
h = t => {
|
|
356
|
+
if (t.isTrusted && !a) {
|
|
357
|
+
const t = d.id;
|
|
358
|
+
q(() => {
|
|
359
|
+
if (!a) {
|
|
360
|
+
if (!c) {
|
|
361
|
+
E.disconnect();
|
|
362
|
+
for (const t of r) removeEventListener(t, h, {
|
|
363
|
+
capture: true
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
t === d.id && (a = true, f(true));
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
}
|
|
272
370
|
};
|
|
273
|
-
for (const
|
|
371
|
+
for (const t of r) addEventListener(t, h, {
|
|
274
372
|
capture: true
|
|
275
373
|
});
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
374
|
+
i(i => {
|
|
375
|
+
m("back-forward-cache", d.navigationId, d.navigationInteractionId, d.navigationURL, e()), f = o(t, d, O, n.reportAllChanges), s(() => {
|
|
376
|
+
d.value = performance.now() - i.timeStamp, a = true, f(true);
|
|
279
377
|
});
|
|
280
378
|
});
|
|
281
379
|
}
|
|
282
380
|
});
|
|
283
|
-
},
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
381
|
+
}, t.onTTFB = (t, n = {}) => {
|
|
382
|
+
const s = b(n);
|
|
383
|
+
let c = g("TTFB"),
|
|
384
|
+
f = o(t, c, U, n.reportAllChanges);
|
|
385
|
+
V(() => {
|
|
386
|
+
const h = a();
|
|
387
|
+
if (h) {
|
|
388
|
+
const a = h.responseStart;
|
|
389
|
+
if (c.value = Math.max(a - r(), 0), c.entries = [h], f(true), i(() => {
|
|
390
|
+
c = g("TTFB", 0, "back-forward-cache", c.navigationId, c.navigationInteractionId, c.navigationURL, e()), f = o(t, c, U, n.reportAllChanges), f(true);
|
|
391
|
+
}), s) {
|
|
392
|
+
p(["soft-navigation"], e => {
|
|
393
|
+
e.forEach(e => {
|
|
394
|
+
e.navigationId && (c = g("TTFB", 0, "soft-navigation", e.navigationId, e.interactionId, e.name, e.startTime), c.entries = [e], f = o(t, c, U, n.reportAllChanges), f(true));
|
|
395
|
+
});
|
|
396
|
+
}, n);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
291
399
|
});
|
|
292
|
-
},
|
|
400
|
+
}, t;
|
|
293
401
|
})({});
|
|
294
402
|
|
|
295
403
|
function addCWVTracking({
|