@fingerly/web-js 0.0.0-stage → 0.1.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 +202 -0
- package/README.md +71 -2
- package/dist/browser.global.js +1 -0
- package/dist/index.cjs +1919 -0
- package/dist/index.d.cts +78 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.js +1900 -0
- package/package.json +42 -3
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,1919 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@fingerly/core');
|
|
4
|
+
|
|
5
|
+
// src/index.ts
|
|
6
|
+
function compact(value) {
|
|
7
|
+
const out = {};
|
|
8
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
9
|
+
if (entry !== void 0) out[key] = entry;
|
|
10
|
+
}
|
|
11
|
+
return out;
|
|
12
|
+
}
|
|
13
|
+
function attempt(read) {
|
|
14
|
+
try {
|
|
15
|
+
return read();
|
|
16
|
+
} catch {
|
|
17
|
+
return void 0;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function windowOrNull() {
|
|
21
|
+
return typeof window === "undefined" ? void 0 : window;
|
|
22
|
+
}
|
|
23
|
+
function requireWindow() {
|
|
24
|
+
const w = windowOrNull();
|
|
25
|
+
if (!w) throw new core.UnsupportedSignal("no-window");
|
|
26
|
+
return w;
|
|
27
|
+
}
|
|
28
|
+
function asBlockedIfRefused(error) {
|
|
29
|
+
if (error instanceof Error) {
|
|
30
|
+
if (error.name === "SecurityError" || error.name === "NotAllowedError" || error.name === "NotSupportedError") {
|
|
31
|
+
throw new core.BlockedSignal(error.name);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
function asReport(sources) {
|
|
37
|
+
return {
|
|
38
|
+
schema: 1,
|
|
39
|
+
budget_ms: 0,
|
|
40
|
+
elapsed_ms: 0,
|
|
41
|
+
tiers: [],
|
|
42
|
+
sources,
|
|
43
|
+
integrity: { patched_natives: [], lies: [], engine: {} }
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function claimedOs(userAgent) {
|
|
47
|
+
if (!userAgent) return void 0;
|
|
48
|
+
if (/Windows NT/i.test(userAgent)) return "windows";
|
|
49
|
+
if (/Android/i.test(userAgent)) return "android";
|
|
50
|
+
if (/iPhone|iPad|iPod/i.test(userAgent)) return "ios";
|
|
51
|
+
if (/Mac OS X/i.test(userAgent)) return "macos";
|
|
52
|
+
if (/Linux/i.test(userAgent)) return "linux";
|
|
53
|
+
return void 0;
|
|
54
|
+
}
|
|
55
|
+
function impliedOs(renderer) {
|
|
56
|
+
if (!renderer) return void 0;
|
|
57
|
+
const r = renderer.toLowerCase();
|
|
58
|
+
if (r.includes("direct3d") || r.includes("d3d11") || r.includes("d3d9")) return "windows";
|
|
59
|
+
if (r.includes("metal") || r.includes("apple")) return "apple";
|
|
60
|
+
if (r.includes("adreno") || r.includes("mali") || r.includes("powervr")) return "mobile";
|
|
61
|
+
return void 0;
|
|
62
|
+
}
|
|
63
|
+
function findContradictions(sources) {
|
|
64
|
+
const report = asReport(sources);
|
|
65
|
+
const lies = [];
|
|
66
|
+
const nav = core.valueOf(report, core.SOURCE.navigator);
|
|
67
|
+
const engine = core.valueOf(report, core.SOURCE.engine);
|
|
68
|
+
const errors = core.valueOf(report, core.SOURCE.errors);
|
|
69
|
+
const maths = core.valueOf(report, core.SOURCE.math);
|
|
70
|
+
const webgl = core.valueOf(report, core.SOURCE.webgl);
|
|
71
|
+
const touch = core.valueOf(report, core.SOURCE.touch);
|
|
72
|
+
const screen = core.valueOf(report, core.SOURCE.screen);
|
|
73
|
+
if (engine?.agrees === false) {
|
|
74
|
+
lies.push({
|
|
75
|
+
id: "user-agent-vs-engine",
|
|
76
|
+
kind: "contradiction",
|
|
77
|
+
detail: `claimed-${engine.claimed}-observed-${engine.observed}`
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (errors?.observed && engine?.observed && errors.observed !== engine.observed) {
|
|
81
|
+
lies.push({
|
|
82
|
+
id: "engine-vs-error-shapes",
|
|
83
|
+
kind: "contradiction",
|
|
84
|
+
detail: `engine-${engine.observed}-errors-${errors.observed}`
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
const claimed = engine?.claimed;
|
|
88
|
+
if (errors?.observed && claimed && errors.observed !== claimed) {
|
|
89
|
+
lies.push({
|
|
90
|
+
id: "user-agent-vs-error-shapes",
|
|
91
|
+
kind: "contradiction",
|
|
92
|
+
detail: `claimed-${claimed}-errors-${errors.observed}`
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
if (maths?.identities_hold === false) {
|
|
96
|
+
lies.push({
|
|
97
|
+
id: "math-identities",
|
|
98
|
+
kind: "contradiction",
|
|
99
|
+
detail: "math-builtins-do-not-hold-exact-identities"
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
const os = claimedOs(nav?.user_agent);
|
|
103
|
+
const gpu = impliedOs(webgl?.unmasked_renderer ?? webgl?.renderer);
|
|
104
|
+
if (os && gpu) {
|
|
105
|
+
const consistent = gpu === "windows" && os === "windows" || gpu === "apple" && (os === "macos" || os === "ios") || gpu === "mobile" && (os === "android" || os === "ios");
|
|
106
|
+
if (!consistent) {
|
|
107
|
+
lies.push({
|
|
108
|
+
id: "user-agent-vs-gpu",
|
|
109
|
+
kind: "contradiction",
|
|
110
|
+
detail: `os-${os}-gpu-${gpu}`
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (nav?.platform && os) {
|
|
115
|
+
const platform = nav.platform.toLowerCase();
|
|
116
|
+
const consistent = os === "windows" && platform.startsWith("win") || os === "macos" && platform.startsWith("mac") || os === "ios" && (platform.startsWith("iphone") || platform.startsWith("ipad") || platform.startsWith("mac")) || os === "android" && (platform.startsWith("linux") || platform.startsWith("android")) || os === "linux" && platform.startsWith("linux");
|
|
117
|
+
if (!consistent) {
|
|
118
|
+
lies.push({
|
|
119
|
+
id: "user-agent-vs-platform",
|
|
120
|
+
kind: "contradiction",
|
|
121
|
+
detail: `os-${os}-platform-${nav.platform}`
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (touch) {
|
|
126
|
+
const points = touch.max_touch_points;
|
|
127
|
+
if (typeof points === "number" && points > 0 && touch.pointer_coarse === false && touch.any_hover === true) {
|
|
128
|
+
lies.push({
|
|
129
|
+
id: "touch-points-vs-pointer-media",
|
|
130
|
+
kind: "contradiction",
|
|
131
|
+
detail: "touch-claimed-with-fine-pointer-and-hover"
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
if (touch.touch_event === true && typeof points === "number" && points === 0) {
|
|
135
|
+
lies.push({
|
|
136
|
+
id: "touch-event-vs-touch-points",
|
|
137
|
+
kind: "contradiction",
|
|
138
|
+
detail: "ontouchstart-present-with-zero-points"
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (typeof screen?.inner_width === "number" && typeof screen.width === "number" && screen.width > 0 && screen.inner_width > screen.width) {
|
|
143
|
+
lies.push({
|
|
144
|
+
id: "viewport-larger-than-screen",
|
|
145
|
+
kind: "contradiction",
|
|
146
|
+
detail: `inner-${screen.inner_width}-screen-${screen.width}`
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
if (nav?.product_sub !== void 0 && (engine?.observed === "chromium" || engine?.observed === "webkit") && nav.product_sub !== "20030107") {
|
|
150
|
+
lies.push({
|
|
151
|
+
id: "product-sub",
|
|
152
|
+
kind: "contradiction",
|
|
153
|
+
detail: `expected-20030107-got-${nav.product_sub}`
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
if (nav?.language && nav.languages && nav.languages.length > 0 && nav.languages[0] !== nav.language) {
|
|
157
|
+
lies.push({
|
|
158
|
+
id: "language-vs-languages",
|
|
159
|
+
kind: "contradiction",
|
|
160
|
+
detail: `language-${nav.language}-languages-${nav.languages[0]}`
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
return lies;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// src/lies/descriptors.ts
|
|
167
|
+
var NATIVE_PATTERN = /\{\s*\[native code\]\s*\}\s*$/;
|
|
168
|
+
var INSTANCE_SHOULD_NOT_OWN = [
|
|
169
|
+
["navigator", "webdriver"],
|
|
170
|
+
["navigator", "userAgent"],
|
|
171
|
+
["navigator", "platform"],
|
|
172
|
+
["navigator", "plugins"],
|
|
173
|
+
["navigator", "mimeTypes"],
|
|
174
|
+
["navigator", "languages"],
|
|
175
|
+
["navigator", "language"],
|
|
176
|
+
["navigator", "hardwareConcurrency"],
|
|
177
|
+
["navigator", "deviceMemory"],
|
|
178
|
+
["navigator", "maxTouchPoints"],
|
|
179
|
+
["navigator", "vendor"],
|
|
180
|
+
["navigator", "appVersion"],
|
|
181
|
+
["navigator", "productSub"],
|
|
182
|
+
["screen", "width"],
|
|
183
|
+
["screen", "height"],
|
|
184
|
+
["screen", "availWidth"],
|
|
185
|
+
["screen", "availHeight"],
|
|
186
|
+
["screen", "colorDepth"]
|
|
187
|
+
];
|
|
188
|
+
function findRedefinedProperties(w) {
|
|
189
|
+
const lies = [];
|
|
190
|
+
for (const [holderName, property] of INSTANCE_SHOULD_NOT_OWN) {
|
|
191
|
+
const holder = holderName === "navigator" ? w.navigator : w.screen;
|
|
192
|
+
if (!holder) continue;
|
|
193
|
+
const own = attempt(() => Object.getOwnPropertyDescriptor(holder, property));
|
|
194
|
+
if (own) {
|
|
195
|
+
lies.push({
|
|
196
|
+
id: `${holderName}.${property}`,
|
|
197
|
+
kind: "descriptor",
|
|
198
|
+
detail: "own-property-shadows-prototype"
|
|
199
|
+
});
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
const proto = attempt(() => Object.getPrototypeOf(holder));
|
|
203
|
+
if (!proto) continue;
|
|
204
|
+
const inherited = attempt(() => Object.getOwnPropertyDescriptor(proto, property));
|
|
205
|
+
if (!inherited?.get) continue;
|
|
206
|
+
const source = attempt(() => Function.prototype.toString.call(inherited.get));
|
|
207
|
+
if (source !== void 0 && !NATIVE_PATTERN.test(source)) {
|
|
208
|
+
lies.push({
|
|
209
|
+
id: `${holderName}.${property}.getter`,
|
|
210
|
+
kind: "descriptor",
|
|
211
|
+
detail: "getter-is-not-native"
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
const navigatorProto = attempt(() => Object.getPrototypeOf(w.navigator));
|
|
216
|
+
if (w.Navigator && navigatorProto !== void 0 && navigatorProto !== w.Navigator.prototype) {
|
|
217
|
+
lies.push({ id: "navigator", kind: "prototype", detail: "not-Navigator.prototype" });
|
|
218
|
+
}
|
|
219
|
+
const screenProto = attempt(() => Object.getPrototypeOf(w.screen));
|
|
220
|
+
if (w.Screen && screenProto !== void 0 && screenProto !== w.Screen.prototype) {
|
|
221
|
+
lies.push({ id: "screen", kind: "prototype", detail: "not-Screen.prototype" });
|
|
222
|
+
}
|
|
223
|
+
return lies;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// src/lies/natives.ts
|
|
227
|
+
var NATIVE_PATTERN2 = /\{\s*\[native code\]\s*\}\s*$/;
|
|
228
|
+
var TARGETS = [
|
|
229
|
+
["Function.prototype.toString", () => Function.prototype.toString],
|
|
230
|
+
["Function.prototype.bind", () => Function.prototype.bind],
|
|
231
|
+
["Object.getOwnPropertyDescriptor", () => Object.getOwnPropertyDescriptor],
|
|
232
|
+
["Object.defineProperty", () => Object.defineProperty],
|
|
233
|
+
["Date.prototype.getTimezoneOffset", () => Date.prototype.getTimezoneOffset],
|
|
234
|
+
["Number.prototype.toFixed", () => Number.prototype.toFixed],
|
|
235
|
+
["Error.prototype.toString", () => Error.prototype.toString],
|
|
236
|
+
["Intl.DateTimeFormat", () => Intl?.DateTimeFormat],
|
|
237
|
+
["Navigator.prototype.javaEnabled", (w) => w.Navigator?.prototype?.javaEnabled],
|
|
238
|
+
["Permissions.prototype.query", (w) => w.Permissions?.prototype?.query],
|
|
239
|
+
["MediaDevices.prototype.enumerateDevices", (w) => w.MediaDevices?.prototype?.enumerateDevices],
|
|
240
|
+
["HTMLCanvasElement.prototype.toDataURL", (w) => w.HTMLCanvasElement?.prototype?.toDataURL],
|
|
241
|
+
[
|
|
242
|
+
"CanvasRenderingContext2D.prototype.getImageData",
|
|
243
|
+
(w) => w.CanvasRenderingContext2D?.prototype?.getImageData
|
|
244
|
+
],
|
|
245
|
+
[
|
|
246
|
+
"WebGLRenderingContext.prototype.getParameter",
|
|
247
|
+
(w) => w.WebGLRenderingContext?.prototype?.getParameter
|
|
248
|
+
],
|
|
249
|
+
[
|
|
250
|
+
"WebGLRenderingContext.prototype.getExtension",
|
|
251
|
+
(w) => w.WebGLRenderingContext?.prototype?.getExtension
|
|
252
|
+
],
|
|
253
|
+
["AudioBuffer.prototype.getChannelData", (w) => w.AudioBuffer?.prototype?.getChannelData],
|
|
254
|
+
["Element.prototype.getBoundingClientRect", (w) => w.Element?.prototype?.getBoundingClientRect],
|
|
255
|
+
["Performance.prototype.now", (w) => w.Performance?.prototype?.now],
|
|
256
|
+
["Screen.prototype.constructor", (w) => w.Screen]
|
|
257
|
+
];
|
|
258
|
+
function borrowToString() {
|
|
259
|
+
const own = Function.prototype.toString;
|
|
260
|
+
if (typeof document === "undefined" || !document.body) return { fn: own, clean: false };
|
|
261
|
+
const frame = attempt(() => {
|
|
262
|
+
const element = document.createElement("iframe");
|
|
263
|
+
element.setAttribute("sandbox", "allow-same-origin");
|
|
264
|
+
element.style.display = "none";
|
|
265
|
+
document.body.appendChild(element);
|
|
266
|
+
return element;
|
|
267
|
+
});
|
|
268
|
+
if (!frame) return { fn: own, clean: false };
|
|
269
|
+
try {
|
|
270
|
+
const borrowed = attempt(
|
|
271
|
+
() => frame.contentWindow?.Function?.prototype?.toString
|
|
272
|
+
);
|
|
273
|
+
return borrowed ? { fn: borrowed, clean: true } : { fn: own, clean: false };
|
|
274
|
+
} finally {
|
|
275
|
+
frame.remove();
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
function findPatchedNatives(w) {
|
|
279
|
+
const patched = [];
|
|
280
|
+
const lies = [];
|
|
281
|
+
const { fn: toString, clean } = borrowToString();
|
|
282
|
+
const stringify = (value) => attempt(() => toString.call(value));
|
|
283
|
+
for (const [path, resolve] of TARGETS) {
|
|
284
|
+
const target = attempt(() => resolve(w));
|
|
285
|
+
if (target === void 0 || target === null) {
|
|
286
|
+
lies.push({ id: path, kind: "missing" });
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
if (typeof target !== "function") continue;
|
|
290
|
+
const source = stringify(target);
|
|
291
|
+
if (source === void 0) continue;
|
|
292
|
+
if (!NATIVE_PATTERN2.test(source)) {
|
|
293
|
+
patched.push(path);
|
|
294
|
+
lies.push({ id: path, kind: "not-native" });
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
if (clean) {
|
|
298
|
+
const own = Function.prototype.toString;
|
|
299
|
+
const viaBorrowed = stringify(own);
|
|
300
|
+
if (viaBorrowed !== void 0 && !NATIVE_PATTERN2.test(viaBorrowed)) {
|
|
301
|
+
if (!patched.includes("Function.prototype.toString")) {
|
|
302
|
+
patched.push("Function.prototype.toString");
|
|
303
|
+
}
|
|
304
|
+
lies.push({
|
|
305
|
+
id: "Function.prototype.toString",
|
|
306
|
+
kind: "not-native",
|
|
307
|
+
detail: "caught-via-fresh-realm"
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return { patched, lies };
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// src/lies/index.ts
|
|
315
|
+
function inspectIntegrity(sources) {
|
|
316
|
+
const w = windowOrNull();
|
|
317
|
+
const contradictions = findContradictions(sources);
|
|
318
|
+
const engine = core.valueOf(
|
|
319
|
+
{
|
|
320
|
+
schema: 1,
|
|
321
|
+
budget_ms: 0,
|
|
322
|
+
elapsed_ms: 0,
|
|
323
|
+
tiers: [],
|
|
324
|
+
sources,
|
|
325
|
+
integrity: { patched_natives: [], lies: [], engine: {} }
|
|
326
|
+
},
|
|
327
|
+
core.SOURCE.engine
|
|
328
|
+
);
|
|
329
|
+
const identity = {
|
|
330
|
+
...engine?.claimed === void 0 ? {} : { claimed: engine.claimed },
|
|
331
|
+
...engine?.observed === void 0 ? {} : { observed: engine.observed },
|
|
332
|
+
...engine?.agrees === void 0 ? {} : { agrees: engine.agrees }
|
|
333
|
+
};
|
|
334
|
+
if (!w) {
|
|
335
|
+
return { patched_natives: [], lies: contradictions, engine: identity };
|
|
336
|
+
}
|
|
337
|
+
const natives = findPatchedNatives(w);
|
|
338
|
+
const descriptors = findRedefinedProperties(w);
|
|
339
|
+
return {
|
|
340
|
+
patched_natives: natives.patched,
|
|
341
|
+
lies: [...natives.lies, ...descriptors, ...contradictions],
|
|
342
|
+
engine: identity
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
function offlineConstructor() {
|
|
346
|
+
const w = globalThis;
|
|
347
|
+
const ctor = w.OfflineAudioContext ?? w.webkitOfflineAudioContext;
|
|
348
|
+
if (!ctor) throw new core.UnsupportedSignal("no-offline-audio-context");
|
|
349
|
+
return ctor;
|
|
350
|
+
}
|
|
351
|
+
async function render(ctx) {
|
|
352
|
+
const OfflineContext = offlineConstructor();
|
|
353
|
+
const context = new OfflineContext(1, 5e3, 44100);
|
|
354
|
+
const oscillator = context.createOscillator();
|
|
355
|
+
oscillator.type = "triangle";
|
|
356
|
+
oscillator.frequency.value = 1e4;
|
|
357
|
+
const compressor = context.createDynamicsCompressor();
|
|
358
|
+
compressor.threshold.value = -50;
|
|
359
|
+
compressor.knee.value = 40;
|
|
360
|
+
compressor.ratio.value = 12;
|
|
361
|
+
compressor.attack.value = 0;
|
|
362
|
+
compressor.release.value = 0.25;
|
|
363
|
+
oscillator.connect(compressor);
|
|
364
|
+
compressor.connect(context.destination);
|
|
365
|
+
oscillator.start(0);
|
|
366
|
+
const buffer = await new Promise((resolve, reject) => {
|
|
367
|
+
ctx.signal.addEventListener("abort", () => reject(ctx.signal.reason), { once: true });
|
|
368
|
+
context.oncomplete = (event) => resolve(event.renderedBuffer);
|
|
369
|
+
try {
|
|
370
|
+
const started = context.startRendering();
|
|
371
|
+
if (started && typeof started.then === "function") started.then(resolve, reject);
|
|
372
|
+
} catch (error) {
|
|
373
|
+
reject(error);
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
const samples = buffer.getChannelData(0);
|
|
377
|
+
let sum = 0;
|
|
378
|
+
for (let i = 4500; i < samples.length; i++) sum += Math.abs(samples[i] ?? 0);
|
|
379
|
+
return sum;
|
|
380
|
+
}
|
|
381
|
+
var audioSource = {
|
|
382
|
+
id: core.SOURCE.audio,
|
|
383
|
+
tier: "deferred",
|
|
384
|
+
timeoutMs: 500,
|
|
385
|
+
async run(ctx) {
|
|
386
|
+
const first = await render(ctx);
|
|
387
|
+
if (first === 0) throw new core.BlockedSignal("audio-silent");
|
|
388
|
+
const second = await render(ctx);
|
|
389
|
+
return compact({
|
|
390
|
+
value: first,
|
|
391
|
+
unstable: first !== second,
|
|
392
|
+
sample_rate: 44100
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
var audioLatencySource = {
|
|
397
|
+
id: core.SOURCE.audioLatency,
|
|
398
|
+
tier: "deferred",
|
|
399
|
+
timeoutMs: 200,
|
|
400
|
+
run() {
|
|
401
|
+
const w = globalThis;
|
|
402
|
+
const Ctor = w.AudioContext ?? w.webkitAudioContext;
|
|
403
|
+
if (!Ctor) throw new core.UnsupportedSignal("no-audio-context");
|
|
404
|
+
const context = new Ctor();
|
|
405
|
+
try {
|
|
406
|
+
return compact({
|
|
407
|
+
base_latency: attempt(() => context.baseLatency),
|
|
408
|
+
sample_rate: attempt(() => context.sampleRate),
|
|
409
|
+
state: attempt(() => context.state)
|
|
410
|
+
});
|
|
411
|
+
} finally {
|
|
412
|
+
attempt(() => void context.close());
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
var hardwareSource = {
|
|
417
|
+
id: core.SOURCE.hardware,
|
|
418
|
+
tier: "fast",
|
|
419
|
+
run() {
|
|
420
|
+
if (typeof navigator === "undefined") throw new core.UnsupportedSignal("no-navigator");
|
|
421
|
+
const nav = navigator;
|
|
422
|
+
return compact({
|
|
423
|
+
hardware_concurrency: attempt(() => nav.hardwareConcurrency),
|
|
424
|
+
device_memory: attempt(() => nav.deviceMemory)
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
var touchSource = {
|
|
429
|
+
id: core.SOURCE.touch,
|
|
430
|
+
tier: "fast",
|
|
431
|
+
run() {
|
|
432
|
+
const w = requireWindow();
|
|
433
|
+
return compact({
|
|
434
|
+
max_touch_points: attempt(() => navigator.maxTouchPoints),
|
|
435
|
+
touch_event: attempt(() => "ontouchstart" in w),
|
|
436
|
+
touch_start: attempt(() => {
|
|
437
|
+
document.createEvent("TouchEvent");
|
|
438
|
+
return true;
|
|
439
|
+
}),
|
|
440
|
+
pointer_coarse: attempt(() => w.matchMedia?.("(pointer: coarse)").matches),
|
|
441
|
+
any_hover: attempt(() => w.matchMedia?.("(any-hover: hover)").matches)
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
var sensorsSource = {
|
|
446
|
+
id: core.SOURCE.sensors,
|
|
447
|
+
tier: "deferred",
|
|
448
|
+
// 150ms, not the 250 this started at. A real accelerometer delivers
|
|
449
|
+
// `devicemotion` at 60Hz, so anything past the first few frames is waiting
|
|
450
|
+
// for an event that is not coming.
|
|
451
|
+
timeoutMs: 150,
|
|
452
|
+
async run(ctx) {
|
|
453
|
+
const w = requireWindow();
|
|
454
|
+
const hasMotion = "DeviceMotionEvent" in w;
|
|
455
|
+
const hasOrientation = "DeviceOrientationEvent" in w;
|
|
456
|
+
if (!hasMotion && !hasOrientation) {
|
|
457
|
+
return compact({ device_motion: false, device_orientation: false });
|
|
458
|
+
}
|
|
459
|
+
if (typeof document !== "undefined" && document.visibilityState === "hidden") {
|
|
460
|
+
return compact({
|
|
461
|
+
device_motion: hasMotion,
|
|
462
|
+
device_orientation: hasOrientation
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
const observed = await new Promise((resolve) => {
|
|
466
|
+
let settled = false;
|
|
467
|
+
const finish = (value) => {
|
|
468
|
+
if (settled) return;
|
|
469
|
+
settled = true;
|
|
470
|
+
w.removeEventListener("devicemotion", onMotion);
|
|
471
|
+
clearTimeout(timer);
|
|
472
|
+
resolve(value);
|
|
473
|
+
};
|
|
474
|
+
const onMotion = () => finish(true);
|
|
475
|
+
const timer = setTimeout(() => finish(false), 100);
|
|
476
|
+
ctx.signal.addEventListener("abort", () => finish(false), { once: true });
|
|
477
|
+
w.addEventListener("devicemotion", onMotion, { once: true });
|
|
478
|
+
});
|
|
479
|
+
return compact({
|
|
480
|
+
device_motion: hasMotion,
|
|
481
|
+
device_orientation: hasOrientation,
|
|
482
|
+
motion_observed: observed
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
var mediaDevicesSource = {
|
|
487
|
+
id: core.SOURCE.mediaDevices,
|
|
488
|
+
tier: "deferred",
|
|
489
|
+
timeoutMs: 300,
|
|
490
|
+
async run() {
|
|
491
|
+
if (typeof navigator === "undefined") throw new core.UnsupportedSignal("no-navigator");
|
|
492
|
+
if (typeof navigator.mediaDevices?.enumerateDevices !== "function") {
|
|
493
|
+
throw new core.UnsupportedSignal("no-media-devices");
|
|
494
|
+
}
|
|
495
|
+
const devices = await navigator.mediaDevices.enumerateDevices();
|
|
496
|
+
return compact({
|
|
497
|
+
audio_input: devices.filter((d) => d.kind === "audioinput").length,
|
|
498
|
+
audio_output: devices.filter((d) => d.kind === "audiooutput").length,
|
|
499
|
+
video_input: devices.filter((d) => d.kind === "videoinput").length,
|
|
500
|
+
labels_hidden: devices.length > 0 && devices.every((d) => d.label === "")
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
var networkSource = {
|
|
505
|
+
id: core.SOURCE.network,
|
|
506
|
+
tier: "fast",
|
|
507
|
+
run() {
|
|
508
|
+
const connection = navigator.connection;
|
|
509
|
+
if (!connection) throw new core.UnsupportedSignal("no-network-information");
|
|
510
|
+
return compact({
|
|
511
|
+
effective_type: attempt(() => connection.effectiveType),
|
|
512
|
+
downlink: attempt(() => connection.downlink),
|
|
513
|
+
rtt: attempt(() => connection.rtt),
|
|
514
|
+
save_data: attempt(() => connection.saveData)
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
var intlSource = {
|
|
519
|
+
id: core.SOURCE.intl,
|
|
520
|
+
tier: "fast",
|
|
521
|
+
run() {
|
|
522
|
+
if (typeof Intl === "undefined") throw new core.UnsupportedSignal("no-intl");
|
|
523
|
+
const resolved = attempt(() => new Intl.DateTimeFormat().resolvedOptions());
|
|
524
|
+
return compact({
|
|
525
|
+
timezone: resolved?.timeZone,
|
|
526
|
+
// Kept alongside the zone name because resistFingerprinting reports UTC
|
|
527
|
+
// for both, while an ordinary browser in London reports Europe/London
|
|
528
|
+
// with the same zero offset in winter. The pair separates them.
|
|
529
|
+
timezone_offset: attempt(() => (/* @__PURE__ */ new Date()).getTimezoneOffset()),
|
|
530
|
+
locale: resolved?.locale,
|
|
531
|
+
calendar: resolved?.calendar,
|
|
532
|
+
numbering_system: resolved?.numberingSystem,
|
|
533
|
+
// A fixed instant formatted in the visitor's locale. Catches differences
|
|
534
|
+
// in the ICU data the browser was built with, which the locale name alone
|
|
535
|
+
// does not.
|
|
536
|
+
formatted: attempt(
|
|
537
|
+
() => new Intl.DateTimeFormat(void 0, {
|
|
538
|
+
dateStyle: "full",
|
|
539
|
+
timeStyle: "full"
|
|
540
|
+
}).format(/* @__PURE__ */ new Date(0))
|
|
541
|
+
)
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
var timezoneSource = {
|
|
546
|
+
id: core.SOURCE.timezone,
|
|
547
|
+
tier: "fast",
|
|
548
|
+
run() {
|
|
549
|
+
if (typeof Intl === "undefined") throw new core.UnsupportedSignal("no-intl");
|
|
550
|
+
return compact({
|
|
551
|
+
name: attempt(() => new Intl.DateTimeFormat().resolvedOptions().timeZone),
|
|
552
|
+
offset: attempt(() => (/* @__PURE__ */ new Date()).getTimezoneOffset())
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
var batterySource = {
|
|
557
|
+
id: core.SOURCE.battery,
|
|
558
|
+
tier: "deferred",
|
|
559
|
+
timeoutMs: 250,
|
|
560
|
+
async run() {
|
|
561
|
+
if (typeof navigator === "undefined") throw new core.UnsupportedSignal("no-navigator");
|
|
562
|
+
const getBattery = navigator.getBattery;
|
|
563
|
+
if (typeof getBattery !== "function") throw new core.UnsupportedSignal("no-battery-api");
|
|
564
|
+
const battery = await getBattery.call(navigator);
|
|
565
|
+
const finiteOrNull = (value) => value === void 0 ? void 0 : Number.isFinite(value) ? value : null;
|
|
566
|
+
return compact({
|
|
567
|
+
charging: battery.charging,
|
|
568
|
+
charging_time: finiteOrNull(battery.chargingTime),
|
|
569
|
+
discharging_time: finiteOrNull(battery.dischargingTime),
|
|
570
|
+
level: battery.level
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
};
|
|
574
|
+
var speechSource = {
|
|
575
|
+
id: core.SOURCE.speech,
|
|
576
|
+
tier: "deferred",
|
|
577
|
+
timeoutMs: 250,
|
|
578
|
+
async run(ctx) {
|
|
579
|
+
if (typeof speechSynthesis === "undefined") throw new core.UnsupportedSignal("no-speech-synthesis");
|
|
580
|
+
let voices = speechSynthesis.getVoices();
|
|
581
|
+
if (voices.length === 0) {
|
|
582
|
+
voices = await new Promise((resolve) => {
|
|
583
|
+
const finish = () => {
|
|
584
|
+
speechSynthesis.removeEventListener("voiceschanged", changed);
|
|
585
|
+
ctx.signal.removeEventListener("abort", aborted);
|
|
586
|
+
resolve(speechSynthesis.getVoices());
|
|
587
|
+
};
|
|
588
|
+
const changed = () => finish();
|
|
589
|
+
const aborted = () => finish();
|
|
590
|
+
speechSynthesis.addEventListener("voiceschanged", changed, { once: true });
|
|
591
|
+
ctx.signal.addEventListener("abort", aborted, { once: true });
|
|
592
|
+
setTimeout(finish, Math.min(100, ctx.budgetRemainingMs()));
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
return {
|
|
596
|
+
voices: voices.map((voice) => ({
|
|
597
|
+
name: voice.name,
|
|
598
|
+
language: voice.lang,
|
|
599
|
+
local_service: voice.localService,
|
|
600
|
+
default: voice.default,
|
|
601
|
+
uri: voice.voiceURI
|
|
602
|
+
}))
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
};
|
|
606
|
+
var screenSource = {
|
|
607
|
+
id: core.SOURCE.screen,
|
|
608
|
+
tier: "fast",
|
|
609
|
+
run() {
|
|
610
|
+
const w = requireWindow();
|
|
611
|
+
const s = w.screen;
|
|
612
|
+
return compact({
|
|
613
|
+
width: attempt(() => s.width),
|
|
614
|
+
height: attempt(() => s.height),
|
|
615
|
+
avail_width: attempt(() => s.availWidth),
|
|
616
|
+
avail_height: attempt(() => s.availHeight),
|
|
617
|
+
color_depth: attempt(() => s.colorDepth),
|
|
618
|
+
pixel_depth: attempt(() => s.pixelDepth),
|
|
619
|
+
device_pixel_ratio: attempt(() => w.devicePixelRatio),
|
|
620
|
+
orientation: attempt(() => s.orientation?.type),
|
|
621
|
+
inner_width: attempt(() => w.innerWidth),
|
|
622
|
+
inner_height: attempt(() => w.innerHeight),
|
|
623
|
+
// Window chrome insets. Zero on every side while fullscreen, which is
|
|
624
|
+
// why the tuple is kept rather than reduced to a boolean - a fullscreen
|
|
625
|
+
// window and a chromeless one are different, and the zeroes say which.
|
|
626
|
+
frame: attempt(() => [
|
|
627
|
+
s.availTop ?? null,
|
|
628
|
+
(s.width ?? 0) - (s.availWidth ?? 0) - (s.availLeft ?? 0),
|
|
629
|
+
(s.height ?? 0) - (s.availHeight ?? 0) - (s.availTop ?? 0),
|
|
630
|
+
s.availLeft ?? null
|
|
631
|
+
])
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
var lastUsableFrame;
|
|
636
|
+
function readFrame(w) {
|
|
637
|
+
const s = w.screen;
|
|
638
|
+
return [
|
|
639
|
+
s.availTop ?? null,
|
|
640
|
+
(s.width ?? 0) - (s.availWidth ?? 0) - (s.availLeft ?? 0),
|
|
641
|
+
(s.height ?? 0) - (s.availHeight ?? 0) - (s.availTop ?? 0),
|
|
642
|
+
s.availLeft ?? null
|
|
643
|
+
];
|
|
644
|
+
}
|
|
645
|
+
var screenFrameSource = {
|
|
646
|
+
id: core.SOURCE.screenFrame,
|
|
647
|
+
tier: "fast",
|
|
648
|
+
run() {
|
|
649
|
+
const w = requireWindow();
|
|
650
|
+
const frame = readFrame(w);
|
|
651
|
+
const fullscreen = w.document?.fullscreenElement != null;
|
|
652
|
+
const allZero = frame.every((value) => value === 0 || value === null);
|
|
653
|
+
if (!fullscreen && !allZero) lastUsableFrame = frame;
|
|
654
|
+
return { frame: fullscreen && lastUsableFrame ? [...lastUsableFrame] : frame };
|
|
655
|
+
}
|
|
656
|
+
};
|
|
657
|
+
function matchRange(w, feature, max) {
|
|
658
|
+
if (typeof w.matchMedia !== "function") return void 0;
|
|
659
|
+
for (let value = 0; value <= max; value++) {
|
|
660
|
+
if (w.matchMedia(`(${feature}: ${value})`).matches) return value;
|
|
661
|
+
}
|
|
662
|
+
return void 0;
|
|
663
|
+
}
|
|
664
|
+
function matchFirst(w, queries) {
|
|
665
|
+
if (typeof w.matchMedia !== "function") return void 0;
|
|
666
|
+
return queries.find((query) => w.matchMedia(query).matches);
|
|
667
|
+
}
|
|
668
|
+
var mediaQueriesSource = {
|
|
669
|
+
id: core.SOURCE.mediaQueries,
|
|
670
|
+
tier: "fast",
|
|
671
|
+
run() {
|
|
672
|
+
const w = requireWindow();
|
|
673
|
+
if (typeof w.matchMedia !== "function") throw new core.UnsupportedSignal("no-match-media");
|
|
674
|
+
const gamut = matchFirst(w, [
|
|
675
|
+
"(color-gamut: rec2020)",
|
|
676
|
+
"(color-gamut: p3)",
|
|
677
|
+
"(color-gamut: srgb)"
|
|
678
|
+
]);
|
|
679
|
+
const contrast = matchFirst(w, [
|
|
680
|
+
"(prefers-contrast: more)",
|
|
681
|
+
"(prefers-contrast: less)",
|
|
682
|
+
"(prefers-contrast: custom)",
|
|
683
|
+
"(prefers-contrast: no-preference)"
|
|
684
|
+
]);
|
|
685
|
+
return compact({
|
|
686
|
+
color_gamut: gamut?.match(/color-gamut:\s*(\w+)/)?.[1],
|
|
687
|
+
inverted_colors: attempt(() => w.matchMedia("(inverted-colors: inverted)").matches),
|
|
688
|
+
forced_colors: attempt(() => w.matchMedia("(forced-colors: active)").matches),
|
|
689
|
+
monochrome: matchRange(w, "monochrome", 10),
|
|
690
|
+
contrast: contrast?.match(/prefers-contrast:\s*([\w-]+)/)?.[1],
|
|
691
|
+
reduced_motion: attempt(() => w.matchMedia("(prefers-reduced-motion: reduce)").matches),
|
|
692
|
+
reduced_transparency: attempt(
|
|
693
|
+
() => w.matchMedia("(prefers-reduced-transparency: reduce)").matches
|
|
694
|
+
),
|
|
695
|
+
hdr: attempt(() => w.matchMedia("(dynamic-range: high)").matches)
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
};
|
|
699
|
+
var colorGamutSource = {
|
|
700
|
+
id: core.SOURCE.colorGamut,
|
|
701
|
+
tier: "fast",
|
|
702
|
+
run() {
|
|
703
|
+
const w = requireWindow();
|
|
704
|
+
if (typeof w.matchMedia !== "function") throw new core.UnsupportedSignal("no-match-media");
|
|
705
|
+
const query = matchFirst(w, [
|
|
706
|
+
"(color-gamut: rec2020)",
|
|
707
|
+
"(color-gamut: p3)",
|
|
708
|
+
"(color-gamut: srgb)"
|
|
709
|
+
]);
|
|
710
|
+
const gamut = query?.match(/color-gamut:\s*(\w+)/)?.[1];
|
|
711
|
+
return gamut === "srgb" || gamut === "p3" || gamut === "rec2020" ? { gamut } : {};
|
|
712
|
+
}
|
|
713
|
+
};
|
|
714
|
+
var PAYLOAD_BYTES = 16384;
|
|
715
|
+
var WRITES_PER_BLOCK = 15;
|
|
716
|
+
var MAX_ROUNDS = 9;
|
|
717
|
+
var BUDGET_RESERVE_MS = 250;
|
|
718
|
+
var CAP_MS = 600;
|
|
719
|
+
function openDatabase(name) {
|
|
720
|
+
return new Promise((resolve, reject) => {
|
|
721
|
+
const request = indexedDB.open(name, 1);
|
|
722
|
+
request.onupgradeneeded = () => request.result.createObjectStore("s");
|
|
723
|
+
request.onsuccess = () => resolve(request.result);
|
|
724
|
+
request.onerror = () => reject(request.error ?? new Error("indexeddb-open-failed"));
|
|
725
|
+
request.onblocked = () => reject(new Error("indexeddb-open-blocked"));
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
function durabilityHonored(db) {
|
|
729
|
+
try {
|
|
730
|
+
const transaction = db.transaction("s", "readwrite", {
|
|
731
|
+
durability: "strict"
|
|
732
|
+
});
|
|
733
|
+
const honored = transaction.durability === "strict";
|
|
734
|
+
transaction.abort();
|
|
735
|
+
return honored;
|
|
736
|
+
} catch {
|
|
737
|
+
return false;
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
function timeBlock(db, durability, payload) {
|
|
741
|
+
return new Promise((resolve, reject) => {
|
|
742
|
+
const started = performance.now();
|
|
743
|
+
let written = 0;
|
|
744
|
+
const step = () => {
|
|
745
|
+
if (written === WRITES_PER_BLOCK) {
|
|
746
|
+
resolve(performance.now() - started);
|
|
747
|
+
return;
|
|
748
|
+
}
|
|
749
|
+
const transaction = db.transaction("s", "readwrite", {
|
|
750
|
+
durability
|
|
751
|
+
});
|
|
752
|
+
transaction.objectStore("s").put(payload, written);
|
|
753
|
+
written += 1;
|
|
754
|
+
transaction.oncomplete = step;
|
|
755
|
+
transaction.onerror = transaction.onabort = () => reject(transaction.error ?? new Error("indexeddb-write-failed"));
|
|
756
|
+
};
|
|
757
|
+
step();
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
var storageDurabilitySource = {
|
|
761
|
+
id: core.SOURCE.storageDurability,
|
|
762
|
+
tier: "deferred",
|
|
763
|
+
// One round may overshoot the soft deadline; the slice has to cover that.
|
|
764
|
+
timeoutMs: CAP_MS + 400,
|
|
765
|
+
async run(ctx) {
|
|
766
|
+
requireWindow();
|
|
767
|
+
if (typeof indexedDB !== "object" || indexedDB === null) {
|
|
768
|
+
throw new core.UnsupportedSignal("no-indexeddb");
|
|
769
|
+
}
|
|
770
|
+
const engine = ctx.completed(core.SOURCE.engine);
|
|
771
|
+
const observed = engine?.status === "ok" ? engine.value.observed : void 0;
|
|
772
|
+
if (observed !== "chromium") throw new core.UnsupportedSignal("not-chromium");
|
|
773
|
+
const name = `__fingerly_durability_${Math.random().toString(36).slice(2)}`;
|
|
774
|
+
const payload = new Uint8Array(PAYLOAD_BYTES);
|
|
775
|
+
let db;
|
|
776
|
+
try {
|
|
777
|
+
db = await openDatabase(name);
|
|
778
|
+
if (!durabilityHonored(db)) return { honored: false };
|
|
779
|
+
await timeBlock(db, "relaxed", payload);
|
|
780
|
+
await timeBlock(db, "strict", payload);
|
|
781
|
+
const started = performance.now();
|
|
782
|
+
const deadline = started + Math.min(CAP_MS, Math.max(0, ctx.budgetRemainingMs() - BUDGET_RESERVE_MS));
|
|
783
|
+
const ratios = [];
|
|
784
|
+
while (ratios.length < MAX_ROUNDS) {
|
|
785
|
+
if (ctx.signal.aborted) break;
|
|
786
|
+
if (ratios.length > 0) {
|
|
787
|
+
const perRound = (performance.now() - started) / ratios.length;
|
|
788
|
+
if (performance.now() + perRound > deadline) break;
|
|
789
|
+
}
|
|
790
|
+
const relaxed = await timeBlock(db, "relaxed", payload);
|
|
791
|
+
const strict = await timeBlock(db, "strict", payload);
|
|
792
|
+
if (relaxed > 0) ratios.push(strict / relaxed);
|
|
793
|
+
else break;
|
|
794
|
+
}
|
|
795
|
+
if (ratios.length === 0) return { honored: true, rounds: 0 };
|
|
796
|
+
ratios.sort((a, b) => a - b);
|
|
797
|
+
return compact({
|
|
798
|
+
ratio: ratios[ratios.length >> 1],
|
|
799
|
+
rounds: ratios.length,
|
|
800
|
+
honored: true
|
|
801
|
+
});
|
|
802
|
+
} finally {
|
|
803
|
+
try {
|
|
804
|
+
db?.close();
|
|
805
|
+
indexedDB.deleteDatabase(name);
|
|
806
|
+
} catch {
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
};
|
|
811
|
+
var FILTER_LISTS = [
|
|
812
|
+
["easylist", ".ad_300x250", ".textads"],
|
|
813
|
+
["easylist_germany", ".werbung1", ".werbeblock"],
|
|
814
|
+
["easylist_italy", ".pubbl", ".banner_pubblicita"],
|
|
815
|
+
["easylist_dutch", ".advertentie-container", ".reclame"],
|
|
816
|
+
["easyprivacy", ".trackingpixel", "#tracking-pixel"],
|
|
817
|
+
["fanboy_annoyances", "#newsletter-signup-modal", ".cookie-consent-banner"],
|
|
818
|
+
["fanboy_social", ".social-share-buttons", ".facebook-like-box"],
|
|
819
|
+
["adguard_base", "#adsense_widget", ".adsbygoogle-container"],
|
|
820
|
+
["adguard_annoyances", ".push-notification-prompt", "#app-install-banner"],
|
|
821
|
+
["listekr", "#ad_wrapper_top", ".ad_zone"],
|
|
822
|
+
["liste_fr", ".pub_300x250", "#pubfooter"],
|
|
823
|
+
["ro_list", ".reclama-mare", "#reclama"]
|
|
824
|
+
];
|
|
825
|
+
var SETTLE_MS = 60;
|
|
826
|
+
function nextPaint() {
|
|
827
|
+
return new Promise((resolve) => {
|
|
828
|
+
let settled = false;
|
|
829
|
+
const done = () => {
|
|
830
|
+
if (!settled) {
|
|
831
|
+
settled = true;
|
|
832
|
+
resolve();
|
|
833
|
+
}
|
|
834
|
+
};
|
|
835
|
+
setTimeout(done, SETTLE_MS);
|
|
836
|
+
if (typeof requestAnimationFrame === "function") requestAnimationFrame(() => setTimeout(done, 0));
|
|
837
|
+
});
|
|
838
|
+
}
|
|
839
|
+
function hidden(element) {
|
|
840
|
+
if (element.offsetParent === null) return true;
|
|
841
|
+
if (element.offsetHeight === 0 || element.offsetWidth === 0) return true;
|
|
842
|
+
const style = getComputedStyle(element);
|
|
843
|
+
return style.display === "none" || style.visibility === "hidden";
|
|
844
|
+
}
|
|
845
|
+
function probe(document2, selector) {
|
|
846
|
+
const element = document2.createElement("div");
|
|
847
|
+
if (selector.startsWith("#")) element.id = selector.slice(1);
|
|
848
|
+
else element.className = selector.slice(1);
|
|
849
|
+
element.style.position = "absolute";
|
|
850
|
+
element.style.top = "-9999px";
|
|
851
|
+
element.style.left = "-9999px";
|
|
852
|
+
element.style.width = "1px";
|
|
853
|
+
element.style.height = "1px";
|
|
854
|
+
return element;
|
|
855
|
+
}
|
|
856
|
+
var domBlockersSource = {
|
|
857
|
+
id: core.SOURCE.domBlockers,
|
|
858
|
+
// Deferred: it inserts elements, waits for a paint and reads back layout,
|
|
859
|
+
// which is the most intrusive thing any source here does and has no business
|
|
860
|
+
// competing with the fast tier for the budget.
|
|
861
|
+
tier: "deferred",
|
|
862
|
+
timeoutMs: 300,
|
|
863
|
+
async run() {
|
|
864
|
+
requireWindow();
|
|
865
|
+
if (typeof document === "undefined" || !document.body) {
|
|
866
|
+
throw new core.UnsupportedSignal("no-document-body");
|
|
867
|
+
}
|
|
868
|
+
const container = document.createElement("div");
|
|
869
|
+
container.style.position = "absolute";
|
|
870
|
+
container.style.top = "-9999px";
|
|
871
|
+
container.style.left = "-9999px";
|
|
872
|
+
container.style.width = "1px";
|
|
873
|
+
container.style.height = "1px";
|
|
874
|
+
const control = probe(document, ".fingerly-control-element");
|
|
875
|
+
container.appendChild(control);
|
|
876
|
+
const elements = FILTER_LISTS.map(([name, ...selectors]) => ({
|
|
877
|
+
name,
|
|
878
|
+
nodes: selectors.map((selector) => {
|
|
879
|
+
const element = probe(document, selector);
|
|
880
|
+
container.appendChild(element);
|
|
881
|
+
return element;
|
|
882
|
+
})
|
|
883
|
+
}));
|
|
884
|
+
document.body.appendChild(container);
|
|
885
|
+
try {
|
|
886
|
+
await nextPaint();
|
|
887
|
+
if (hidden(control)) return {};
|
|
888
|
+
const blocked = elements.filter(({ nodes }) => nodes.some(hidden)).map(({ name }) => name);
|
|
889
|
+
return compact({ blocked, probed: FILTER_LISTS.length });
|
|
890
|
+
} finally {
|
|
891
|
+
container.remove();
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
};
|
|
895
|
+
function toFixedErrorLength() {
|
|
896
|
+
return attempt(() => {
|
|
897
|
+
try {
|
|
898
|
+
;
|
|
899
|
+
(-1).toFixed(-1);
|
|
900
|
+
} catch (error) {
|
|
901
|
+
return error instanceof Error ? error.message.length : void 0;
|
|
902
|
+
}
|
|
903
|
+
return void 0;
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
function evalLength() {
|
|
907
|
+
return attempt(() => eval.toString().length);
|
|
908
|
+
}
|
|
909
|
+
function stackStyle() {
|
|
910
|
+
return attempt(() => {
|
|
911
|
+
const stack = new Error("probe").stack;
|
|
912
|
+
if (typeof stack !== "string" || stack === "") return void 0;
|
|
913
|
+
if (stack.includes(" at ")) return "v8";
|
|
914
|
+
if (/^@|\n@|^\w*@/m.test(stack)) {
|
|
915
|
+
return stack.includes("global code") ? "javascriptcore" : "spidermonkey";
|
|
916
|
+
}
|
|
917
|
+
return "unknown";
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
function observedEngine(toFixed, evalLen, stack) {
|
|
921
|
+
const votes = [];
|
|
922
|
+
if (toFixed === 51) votes.push("chromium");
|
|
923
|
+
else if (toFixed === 43 || toFixed === 44) votes.push("webkit");
|
|
924
|
+
else if (toFixed === 25) votes.push("gecko");
|
|
925
|
+
if (evalLen === 33) votes.push("chromium");
|
|
926
|
+
if (stack === "v8") votes.push("chromium");
|
|
927
|
+
else if (stack === "javascriptcore") votes.push("webkit");
|
|
928
|
+
else if (stack === "spidermonkey") votes.push("gecko");
|
|
929
|
+
if (votes.length === 0) return void 0;
|
|
930
|
+
const tally = /* @__PURE__ */ new Map();
|
|
931
|
+
for (const vote of votes) tally.set(vote, (tally.get(vote) ?? 0) + 1);
|
|
932
|
+
let winner;
|
|
933
|
+
let best = 0;
|
|
934
|
+
for (const [engine, count] of tally) {
|
|
935
|
+
if (count > best) {
|
|
936
|
+
best = count;
|
|
937
|
+
winner = engine;
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
return winner;
|
|
941
|
+
}
|
|
942
|
+
function claimedEngine(userAgent) {
|
|
943
|
+
if (!userAgent) return void 0;
|
|
944
|
+
if (/Firefox\/|FxiOS/.test(userAgent)) return "gecko";
|
|
945
|
+
if (/Edg\/|OPR\/|Chrome\/|Chromium\//.test(userAgent)) return "chromium";
|
|
946
|
+
if (/Safari\//.test(userAgent)) return "webkit";
|
|
947
|
+
return void 0;
|
|
948
|
+
}
|
|
949
|
+
var engineSource = {
|
|
950
|
+
id: core.SOURCE.engine,
|
|
951
|
+
tier: "fast",
|
|
952
|
+
run() {
|
|
953
|
+
const toFixed = toFixedErrorLength();
|
|
954
|
+
const evalLen = evalLength();
|
|
955
|
+
const stack = stackStyle();
|
|
956
|
+
const observed = observedEngine(toFixed, evalLen, stack);
|
|
957
|
+
const claimed = claimedEngine(
|
|
958
|
+
typeof navigator === "undefined" ? void 0 : navigator.userAgent
|
|
959
|
+
);
|
|
960
|
+
return compact({
|
|
961
|
+
to_fixed_error_length: toFixed,
|
|
962
|
+
eval_length: evalLen,
|
|
963
|
+
stack_style: stack,
|
|
964
|
+
observed,
|
|
965
|
+
claimed,
|
|
966
|
+
// Undefined rather than false when either side is unknown. "We could not
|
|
967
|
+
// tell" and "they disagree" are different findings, and the automation
|
|
968
|
+
// detector weighs the second one heavily.
|
|
969
|
+
agrees: observed === void 0 || claimed === void 0 ? void 0 : observed === claimed
|
|
970
|
+
});
|
|
971
|
+
}
|
|
972
|
+
};
|
|
973
|
+
var MATH_PROBES = [
|
|
974
|
+
["acos", () => Math.acos(0.12312423423423424)],
|
|
975
|
+
["acosh", () => Math.acosh(1e308)],
|
|
976
|
+
["asin", () => Math.asin(0.12312423423423424)],
|
|
977
|
+
["asinh", () => Math.asinh(1)],
|
|
978
|
+
["atan", () => Math.atan(0.5)],
|
|
979
|
+
["atanh", () => Math.atanh(0.5)],
|
|
980
|
+
["cbrt", () => Math.cbrt(100)],
|
|
981
|
+
["cos", () => Math.cos(10.000000000123)],
|
|
982
|
+
["cosh", () => Math.cosh(1)],
|
|
983
|
+
["exp", () => Math.exp(1)],
|
|
984
|
+
["expm1", () => Math.expm1(1)],
|
|
985
|
+
["log", () => Math.log(10)],
|
|
986
|
+
["log1p", () => Math.log1p(10)],
|
|
987
|
+
["pow", () => Math.pow(Math.PI, -100)],
|
|
988
|
+
["sin", () => Math.sin(1e300)],
|
|
989
|
+
["sinh", () => Math.sinh(1)],
|
|
990
|
+
["sqrt", () => Math.sqrt(2)],
|
|
991
|
+
["tan", () => Math.tan(-1e300)],
|
|
992
|
+
["tanh", () => Math.tanh(1)]
|
|
993
|
+
];
|
|
994
|
+
function identitiesHold() {
|
|
995
|
+
return Object.is(Math.sin(0), 0) && Math.cos(0) === 1 && Math.sqrt(4) === 2 && Math.log(1) === 0 && Math.pow(2, 10) === 1024;
|
|
996
|
+
}
|
|
997
|
+
var mathSource = {
|
|
998
|
+
id: core.SOURCE.math,
|
|
999
|
+
tier: "fast",
|
|
1000
|
+
timeoutMs: 50,
|
|
1001
|
+
run() {
|
|
1002
|
+
const results = [];
|
|
1003
|
+
let probed = 0;
|
|
1004
|
+
const values = /* @__PURE__ */ new Map();
|
|
1005
|
+
for (const [name, probe2] of MATH_PROBES) {
|
|
1006
|
+
const value = attempt(probe2);
|
|
1007
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
1008
|
+
probed += 1;
|
|
1009
|
+
values.set(name, value);
|
|
1010
|
+
results.push(`${name}:${value}`);
|
|
1011
|
+
} else {
|
|
1012
|
+
results.push(`${name}:`);
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
return compact({
|
|
1016
|
+
hash: core.hash64(results.join("|")),
|
|
1017
|
+
probed,
|
|
1018
|
+
// The two the engines were measured to disagree about. See MathSignal
|
|
1019
|
+
// for the numbers; the other seventeen agreed to the last bit on the
|
|
1020
|
+
// machine they were measured on, which is why they are only in the hash.
|
|
1021
|
+
atanh_half: values.get("atanh"),
|
|
1022
|
+
expm1_1: values.get("expm1"),
|
|
1023
|
+
identities_hold: attempt(identitiesHold)
|
|
1024
|
+
});
|
|
1025
|
+
}
|
|
1026
|
+
};
|
|
1027
|
+
function thrownMessageLength(throwing) {
|
|
1028
|
+
return attempt(() => {
|
|
1029
|
+
try {
|
|
1030
|
+
throwing();
|
|
1031
|
+
} catch (error) {
|
|
1032
|
+
if (error instanceof EvalError) return void 0;
|
|
1033
|
+
return error instanceof Error ? error.message.length : void 0;
|
|
1034
|
+
}
|
|
1035
|
+
return void 0;
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
function evalAllowed() {
|
|
1039
|
+
try {
|
|
1040
|
+
new Function("");
|
|
1041
|
+
return true;
|
|
1042
|
+
} catch {
|
|
1043
|
+
return false;
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
function observedFromErrors(errors) {
|
|
1047
|
+
const votes = [];
|
|
1048
|
+
const own = errors.own_properties;
|
|
1049
|
+
if (own !== void 0) {
|
|
1050
|
+
if (own.includes("sourceURL")) votes.push("webkit", "webkit");
|
|
1051
|
+
else if (own.includes("lineNumber")) votes.push("gecko", "gecko");
|
|
1052
|
+
else if (own === "message,stack") votes.push("chromium", "chromium");
|
|
1053
|
+
}
|
|
1054
|
+
if (errors.null_property_length === 44) votes.push("chromium");
|
|
1055
|
+
else if (errors.null_property_length === 33) votes.push("gecko");
|
|
1056
|
+
if (errors.syntax_length === 20) votes.push("chromium");
|
|
1057
|
+
else if (errors.syntax_length === 28) votes.push("gecko");
|
|
1058
|
+
if (votes.length === 0) return void 0;
|
|
1059
|
+
const tally = /* @__PURE__ */ new Map();
|
|
1060
|
+
for (const vote of votes) tally.set(vote, (tally.get(vote) ?? 0) + 1);
|
|
1061
|
+
let winner;
|
|
1062
|
+
let best = 0;
|
|
1063
|
+
let tied = false;
|
|
1064
|
+
for (const [engine, count] of tally) {
|
|
1065
|
+
if (count > best) {
|
|
1066
|
+
best = count;
|
|
1067
|
+
winner = engine;
|
|
1068
|
+
tied = false;
|
|
1069
|
+
} else if (count === best) {
|
|
1070
|
+
tied = true;
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
return tied ? void 0 : winner;
|
|
1074
|
+
}
|
|
1075
|
+
function errorOwnProperties() {
|
|
1076
|
+
return attempt(() => {
|
|
1077
|
+
try {
|
|
1078
|
+
throw new Error("probe");
|
|
1079
|
+
} catch (error) {
|
|
1080
|
+
return Object.getOwnPropertyNames(error).sort().join(",");
|
|
1081
|
+
}
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
var errorsSource = {
|
|
1085
|
+
id: core.SOURCE.errors,
|
|
1086
|
+
tier: "fast",
|
|
1087
|
+
timeoutMs: 50,
|
|
1088
|
+
run() {
|
|
1089
|
+
const compiles = evalAllowed();
|
|
1090
|
+
const shapes = compact({
|
|
1091
|
+
null_property_length: thrownMessageLength(() => null.x),
|
|
1092
|
+
// `new Function` rather than `eval`, because a page with a strict
|
|
1093
|
+
// Content-Security-Policy blocks both and this way the failure is one
|
|
1094
|
+
// probe reporting nothing rather than the source throwing.
|
|
1095
|
+
syntax_length: compiles ? thrownMessageLength(() => new Function("!")) : void 0,
|
|
1096
|
+
json_parse_length: thrownMessageLength(() => JSON.parse("{")),
|
|
1097
|
+
invalid_array_length: thrownMessageLength(() => {
|
|
1098
|
+
const array = [];
|
|
1099
|
+
array.length = -1;
|
|
1100
|
+
}),
|
|
1101
|
+
const_assign_length: compiles ? thrownMessageLength(() => {
|
|
1102
|
+
new Function("const c = 1; c = 2")();
|
|
1103
|
+
}) : void 0,
|
|
1104
|
+
own_properties: errorOwnProperties(),
|
|
1105
|
+
capture_stack_trace: attempt(
|
|
1106
|
+
() => typeof Error.captureStackTrace === "function"
|
|
1107
|
+
),
|
|
1108
|
+
stack_trace_limit: attempt(() => "stackTraceLimit" in Error)
|
|
1109
|
+
});
|
|
1110
|
+
return compact({ ...shapes, observed: observedFromErrors(shapes) });
|
|
1111
|
+
}
|
|
1112
|
+
};
|
|
1113
|
+
var navigatorSource = {
|
|
1114
|
+
id: core.SOURCE.navigator,
|
|
1115
|
+
tier: "fast",
|
|
1116
|
+
run() {
|
|
1117
|
+
if (typeof navigator === "undefined") throw new core.UnsupportedSignal("no-navigator");
|
|
1118
|
+
const nav = navigator;
|
|
1119
|
+
return compact({
|
|
1120
|
+
user_agent: attempt(() => nav.userAgent),
|
|
1121
|
+
platform: attempt(() => nav.platform),
|
|
1122
|
+
vendor: attempt(() => nav.vendor),
|
|
1123
|
+
product_sub: attempt(() => nav.productSub),
|
|
1124
|
+
app_version: attempt(() => nav.appVersion),
|
|
1125
|
+
hardware_concurrency: attempt(() => nav.hardwareConcurrency),
|
|
1126
|
+
device_memory: attempt(() => nav.deviceMemory),
|
|
1127
|
+
max_touch_points: attempt(() => nav.maxTouchPoints),
|
|
1128
|
+
webdriver: attempt(() => nav.webdriver),
|
|
1129
|
+
cookie_enabled: attempt(() => nav.cookieEnabled),
|
|
1130
|
+
pdf_viewer_enabled: attempt(() => nav.pdfViewerEnabled),
|
|
1131
|
+
do_not_track: attempt(() => nav.doNotTrack),
|
|
1132
|
+
// The count rather than the list. The names are long, largely constant,
|
|
1133
|
+
// and the only thing any detector reads is whether there are none - a
|
|
1134
|
+
// desktop Chromium with zero plugins has no built-in PDF viewer, which
|
|
1135
|
+
// means it was built headless.
|
|
1136
|
+
plugin_count: attempt(() => nav.plugins?.length),
|
|
1137
|
+
mime_type_count: attempt(() => nav.mimeTypes?.length),
|
|
1138
|
+
language: attempt(() => nav.language),
|
|
1139
|
+
languages: attempt(() => nav.languages ? [...nav.languages] : void 0)
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1142
|
+
};
|
|
1143
|
+
var languagesSource = {
|
|
1144
|
+
id: core.SOURCE.languages,
|
|
1145
|
+
tier: "fast",
|
|
1146
|
+
run() {
|
|
1147
|
+
if (typeof navigator === "undefined") throw new core.UnsupportedSignal("no-navigator");
|
|
1148
|
+
return compact({
|
|
1149
|
+
primary: attempt(() => navigator.language),
|
|
1150
|
+
accepted: attempt(() => navigator.languages ? [...navigator.languages] : void 0)
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
};
|
|
1154
|
+
var vendorSource = {
|
|
1155
|
+
id: core.SOURCE.vendor,
|
|
1156
|
+
tier: "fast",
|
|
1157
|
+
run() {
|
|
1158
|
+
if (typeof navigator === "undefined") throw new core.UnsupportedSignal("no-navigator");
|
|
1159
|
+
return compact({ vendor: attempt(() => navigator.vendor) });
|
|
1160
|
+
}
|
|
1161
|
+
};
|
|
1162
|
+
var pluginsSource = {
|
|
1163
|
+
id: core.SOURCE.plugins,
|
|
1164
|
+
tier: "fast",
|
|
1165
|
+
run() {
|
|
1166
|
+
if (typeof navigator === "undefined") throw new core.UnsupportedSignal("no-navigator");
|
|
1167
|
+
const plugins = navigator.plugins;
|
|
1168
|
+
if (!plugins) throw new core.UnsupportedSignal("no-plugins");
|
|
1169
|
+
return {
|
|
1170
|
+
plugins: Array.from(plugins, (plugin) => ({
|
|
1171
|
+
name: plugin.name,
|
|
1172
|
+
filename: plugin.filename,
|
|
1173
|
+
description: plugin.description,
|
|
1174
|
+
mime_types: Array.from(plugin, (mime) => ({
|
|
1175
|
+
type: mime.type,
|
|
1176
|
+
suffixes: mime.suffixes,
|
|
1177
|
+
description: mime.description
|
|
1178
|
+
}))
|
|
1179
|
+
}))
|
|
1180
|
+
};
|
|
1181
|
+
}
|
|
1182
|
+
};
|
|
1183
|
+
var userAgentDataSource = {
|
|
1184
|
+
id: core.SOURCE.userAgentData,
|
|
1185
|
+
tier: "deferred",
|
|
1186
|
+
timeoutMs: 200,
|
|
1187
|
+
async run() {
|
|
1188
|
+
if (typeof navigator === "undefined") throw new core.UnsupportedSignal("no-navigator");
|
|
1189
|
+
const data = navigator.userAgentData;
|
|
1190
|
+
if (!data) throw new core.UnsupportedSignal("no-user-agent-data");
|
|
1191
|
+
const low = compact({
|
|
1192
|
+
brands: data.brands,
|
|
1193
|
+
mobile: data.mobile,
|
|
1194
|
+
platform: data.platform
|
|
1195
|
+
});
|
|
1196
|
+
if (typeof data.getHighEntropyValues !== "function") return low;
|
|
1197
|
+
const high = await data.getHighEntropyValues([
|
|
1198
|
+
"architecture",
|
|
1199
|
+
"bitness",
|
|
1200
|
+
"model",
|
|
1201
|
+
"platformVersion",
|
|
1202
|
+
// Not uaFullVersion: deprecated in the client hints spec, and
|
|
1203
|
+
// fullVersionList already carries the same version per brand.
|
|
1204
|
+
"fullVersionList",
|
|
1205
|
+
"wow64"
|
|
1206
|
+
]);
|
|
1207
|
+
return { ...low, ...high };
|
|
1208
|
+
}
|
|
1209
|
+
};
|
|
1210
|
+
function makeCanvas(width, height) {
|
|
1211
|
+
const canvas = document.createElement("canvas");
|
|
1212
|
+
canvas.width = width;
|
|
1213
|
+
canvas.height = height;
|
|
1214
|
+
const context = canvas.getContext("2d");
|
|
1215
|
+
if (!context) throw new core.UnsupportedSignal("no-2d-context");
|
|
1216
|
+
return [canvas, context];
|
|
1217
|
+
}
|
|
1218
|
+
function renderGeometry() {
|
|
1219
|
+
const [canvas, ctx] = makeCanvas(240, 60);
|
|
1220
|
+
ctx.globalCompositeOperation = "multiply";
|
|
1221
|
+
for (const [colour, x, y] of [
|
|
1222
|
+
["#f2f", 40, 40],
|
|
1223
|
+
["#2ff", 80, 40],
|
|
1224
|
+
["#ff2", 60, 80]
|
|
1225
|
+
]) {
|
|
1226
|
+
ctx.fillStyle = colour;
|
|
1227
|
+
ctx.beginPath();
|
|
1228
|
+
ctx.arc(x, y, 40, 0, Math.PI * 2, true);
|
|
1229
|
+
ctx.closePath();
|
|
1230
|
+
ctx.fill();
|
|
1231
|
+
}
|
|
1232
|
+
ctx.fillStyle = "#f9c";
|
|
1233
|
+
ctx.arc(100, 50, 50, 0, Math.PI * 2, true);
|
|
1234
|
+
ctx.arc(100, 50, 20, 0, Math.PI * 2, true);
|
|
1235
|
+
ctx.fill("evenodd");
|
|
1236
|
+
return canvas.toDataURL();
|
|
1237
|
+
}
|
|
1238
|
+
function renderText() {
|
|
1239
|
+
const [canvas, ctx] = makeCanvas(300, 60);
|
|
1240
|
+
ctx.textBaseline = "alphabetic";
|
|
1241
|
+
ctx.fillStyle = "#f60";
|
|
1242
|
+
ctx.fillRect(100, 1, 62, 20);
|
|
1243
|
+
ctx.fillStyle = "#069";
|
|
1244
|
+
ctx.font = '11pt "Times New Roman"';
|
|
1245
|
+
ctx.fillText("Fingerly <canvas> 1.0 \u{1F512}\u0416\u4E2D", 2, 15);
|
|
1246
|
+
ctx.font = "18pt Arial";
|
|
1247
|
+
ctx.fillStyle = "rgba(102, 204, 0, 0.7)";
|
|
1248
|
+
ctx.fillText("Fingerly <canvas> 1.0", 4, 45);
|
|
1249
|
+
return canvas.toDataURL();
|
|
1250
|
+
}
|
|
1251
|
+
function supportsWinding() {
|
|
1252
|
+
const [, ctx] = makeCanvas(1, 1);
|
|
1253
|
+
ctx.rect(0, 0, 10, 10);
|
|
1254
|
+
ctx.rect(2, 2, 6, 6);
|
|
1255
|
+
return ctx.isPointInPath(5, 5, "evenodd") === false;
|
|
1256
|
+
}
|
|
1257
|
+
function resistFingerprintingActive(ctx) {
|
|
1258
|
+
const timing = ctx.completed(core.SOURCE.timing);
|
|
1259
|
+
if (timing?.status !== "ok") return false;
|
|
1260
|
+
const resolution = timing.value?.now_resolution;
|
|
1261
|
+
return typeof resolution === "number" && resolution >= 16;
|
|
1262
|
+
}
|
|
1263
|
+
var canvasSource = {
|
|
1264
|
+
id: core.SOURCE.canvas,
|
|
1265
|
+
tier: "deferred",
|
|
1266
|
+
timeoutMs: 400,
|
|
1267
|
+
run(ctx) {
|
|
1268
|
+
requireWindow();
|
|
1269
|
+
if (typeof document === "undefined") throw new core.UnsupportedSignal("no-document");
|
|
1270
|
+
if (resistFingerprintingActive(ctx)) {
|
|
1271
|
+
throw new core.BlockedSignal("rfp-canvas-prompt-avoided");
|
|
1272
|
+
}
|
|
1273
|
+
try {
|
|
1274
|
+
const geometryFirst = renderGeometry();
|
|
1275
|
+
const geometrySecond = renderGeometry();
|
|
1276
|
+
const textFirst = renderText();
|
|
1277
|
+
const textSecond = renderText();
|
|
1278
|
+
const unstable = geometryFirst !== geometrySecond || textFirst !== textSecond;
|
|
1279
|
+
return compact({
|
|
1280
|
+
geometry: core.hash64(geometryFirst),
|
|
1281
|
+
text: core.hash64(textFirst),
|
|
1282
|
+
winding: attempt(supportsWinding),
|
|
1283
|
+
unstable
|
|
1284
|
+
});
|
|
1285
|
+
} catch (error) {
|
|
1286
|
+
asBlockedIfRefused(error);
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
};
|
|
1290
|
+
function webglContext() {
|
|
1291
|
+
if (typeof document === "undefined") throw new core.UnsupportedSignal("no-document");
|
|
1292
|
+
const canvas = document.createElement("canvas");
|
|
1293
|
+
const gl = canvas.getContext("webgl") ?? canvas.getContext("experimental-webgl");
|
|
1294
|
+
if (!gl) throw new core.UnsupportedSignal("no-webgl-context");
|
|
1295
|
+
return gl;
|
|
1296
|
+
}
|
|
1297
|
+
var webglSource = {
|
|
1298
|
+
id: core.SOURCE.webgl,
|
|
1299
|
+
// Renderer and GPU strings are hard identity components, and context setup
|
|
1300
|
+
// is synchronous; keep them in the authoritative initial report.
|
|
1301
|
+
tier: "fast",
|
|
1302
|
+
timeoutMs: 400,
|
|
1303
|
+
run() {
|
|
1304
|
+
const gl = webglContext();
|
|
1305
|
+
const debug = attempt(() => gl.getExtension("WEBGL_debug_renderer_info"));
|
|
1306
|
+
const parameters = {};
|
|
1307
|
+
for (const name of [
|
|
1308
|
+
"MAX_TEXTURE_SIZE",
|
|
1309
|
+
"MAX_VIEWPORT_DIMS",
|
|
1310
|
+
"MAX_VERTEX_ATTRIBS",
|
|
1311
|
+
"MAX_VARYING_VECTORS",
|
|
1312
|
+
"MAX_COMBINED_TEXTURE_IMAGE_UNITS",
|
|
1313
|
+
"MAX_CUBE_MAP_TEXTURE_SIZE",
|
|
1314
|
+
"MAX_FRAGMENT_UNIFORM_VECTORS",
|
|
1315
|
+
"MAX_RENDERBUFFER_SIZE",
|
|
1316
|
+
"MAX_TEXTURE_IMAGE_UNITS",
|
|
1317
|
+
"MAX_VERTEX_TEXTURE_IMAGE_UNITS",
|
|
1318
|
+
"MAX_VERTEX_UNIFORM_VECTORS",
|
|
1319
|
+
"ALIASED_LINE_WIDTH_RANGE",
|
|
1320
|
+
"ALIASED_POINT_SIZE_RANGE",
|
|
1321
|
+
"RED_BITS",
|
|
1322
|
+
"GREEN_BITS",
|
|
1323
|
+
"BLUE_BITS",
|
|
1324
|
+
"ALPHA_BITS",
|
|
1325
|
+
"DEPTH_BITS",
|
|
1326
|
+
"STENCIL_BITS"
|
|
1327
|
+
]) {
|
|
1328
|
+
const constant = gl[name];
|
|
1329
|
+
if (typeof constant !== "number") continue;
|
|
1330
|
+
const value = attempt(() => gl.getParameter(constant));
|
|
1331
|
+
if (value !== void 0 && value !== null) {
|
|
1332
|
+
parameters[name] = ArrayBuffer.isView(value) ? Array.from(value) : value;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
const precisions = [];
|
|
1336
|
+
for (const shader of [gl.VERTEX_SHADER, gl.FRAGMENT_SHADER]) {
|
|
1337
|
+
for (const precision of [gl.LOW_FLOAT, gl.MEDIUM_FLOAT, gl.HIGH_FLOAT]) {
|
|
1338
|
+
const format = attempt(() => gl.getShaderPrecisionFormat(shader, precision));
|
|
1339
|
+
if (format) precisions.push(format.rangeMin, format.rangeMax, format.precision);
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
return compact({
|
|
1343
|
+
vendor: attempt(() => gl.getParameter(gl.VENDOR)),
|
|
1344
|
+
renderer: attempt(() => gl.getParameter(gl.RENDERER)),
|
|
1345
|
+
unmasked_vendor: debug ? attempt(() => gl.getParameter(debug.UNMASKED_VENDOR_WEBGL)) : void 0,
|
|
1346
|
+
unmasked_renderer: debug ? attempt(() => gl.getParameter(debug.UNMASKED_RENDERER_WEBGL)) : void 0,
|
|
1347
|
+
version: attempt(() => gl.getParameter(gl.VERSION)),
|
|
1348
|
+
shading_language_version: attempt(
|
|
1349
|
+
() => gl.getParameter(gl.SHADING_LANGUAGE_VERSION)
|
|
1350
|
+
),
|
|
1351
|
+
max_texture_size: attempt(() => gl.getParameter(gl.MAX_TEXTURE_SIZE)),
|
|
1352
|
+
max_render_buffer_size: attempt(() => gl.getParameter(gl.MAX_RENDERBUFFER_SIZE)),
|
|
1353
|
+
// Hashed rather than sent whole: twenty parameters is a kilobyte of JSON
|
|
1354
|
+
// that no detector reads field by field, and the report has a budget.
|
|
1355
|
+
parameters_hash: Object.keys(parameters).length > 0 ? core.hash64(JSON.stringify(parameters)) : void 0,
|
|
1356
|
+
shader_precision_hash: precisions.length > 0 ? core.hash64(precisions.join(",")) : void 0
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
};
|
|
1360
|
+
var webglExtensionsSource = {
|
|
1361
|
+
id: core.SOURCE.webglExtensions,
|
|
1362
|
+
tier: "deferred",
|
|
1363
|
+
timeoutMs: 200,
|
|
1364
|
+
run() {
|
|
1365
|
+
const gl = webglContext();
|
|
1366
|
+
const extensions = gl.getSupportedExtensions();
|
|
1367
|
+
if (!extensions) throw new core.BlockedSignal("extensions-withheld");
|
|
1368
|
+
return [...extensions].sort();
|
|
1369
|
+
}
|
|
1370
|
+
};
|
|
1371
|
+
function clockResolution(now) {
|
|
1372
|
+
const deltas = [];
|
|
1373
|
+
const deadline = Date.now() + 12;
|
|
1374
|
+
while (deltas.length < 25 && Date.now() < deadline) {
|
|
1375
|
+
const start = now();
|
|
1376
|
+
let end = now();
|
|
1377
|
+
let guard = 0;
|
|
1378
|
+
while (end === start && guard++ < 1e5 && Date.now() < deadline) end = now();
|
|
1379
|
+
if (end !== start) deltas.push(end - start);
|
|
1380
|
+
}
|
|
1381
|
+
if (deltas.length === 0) {
|
|
1382
|
+
return 100;
|
|
1383
|
+
}
|
|
1384
|
+
return Math.round(Math.min(...deltas) * 1e6) / 1e6;
|
|
1385
|
+
}
|
|
1386
|
+
var timingSource = {
|
|
1387
|
+
id: core.SOURCE.timing,
|
|
1388
|
+
tier: "fast",
|
|
1389
|
+
timeoutMs: 150,
|
|
1390
|
+
run() {
|
|
1391
|
+
const w = requireWindow();
|
|
1392
|
+
const perf = w.performance;
|
|
1393
|
+
if (typeof perf?.now !== "function") {
|
|
1394
|
+
return compact({ has_performance: false });
|
|
1395
|
+
}
|
|
1396
|
+
return compact({
|
|
1397
|
+
has_performance: true,
|
|
1398
|
+
now_resolution: clockResolution(() => perf.now())
|
|
1399
|
+
});
|
|
1400
|
+
}
|
|
1401
|
+
};
|
|
1402
|
+
var permissionsSource = {
|
|
1403
|
+
id: core.SOURCE.permissions,
|
|
1404
|
+
tier: "fast",
|
|
1405
|
+
timeoutMs: 200,
|
|
1406
|
+
async run() {
|
|
1407
|
+
const w = requireWindow();
|
|
1408
|
+
if (!w.navigator.permissions?.query) throw new core.UnsupportedSignal("no-permissions-api");
|
|
1409
|
+
const query = async (name) => {
|
|
1410
|
+
try {
|
|
1411
|
+
return (await w.navigator.permissions.query({ name })).state;
|
|
1412
|
+
} catch {
|
|
1413
|
+
return void 0;
|
|
1414
|
+
}
|
|
1415
|
+
};
|
|
1416
|
+
const notification = await query("notifications");
|
|
1417
|
+
const legacy = attempt(() => w.Notification?.permission);
|
|
1418
|
+
return compact({
|
|
1419
|
+
notification,
|
|
1420
|
+
notification_legacy: legacy,
|
|
1421
|
+
geolocation: await query("geolocation"),
|
|
1422
|
+
inconsistent: notification !== void 0 && legacy !== void 0 ? (
|
|
1423
|
+
// `default` and `prompt` are the same state under two names, which
|
|
1424
|
+
// is why this is not a plain string comparison.
|
|
1425
|
+
(legacy === "default" ? "prompt" : legacy) !== notification
|
|
1426
|
+
) : void 0
|
|
1427
|
+
});
|
|
1428
|
+
}
|
|
1429
|
+
};
|
|
1430
|
+
var AUTOMATION_GLOBALS = [
|
|
1431
|
+
"__nightmare",
|
|
1432
|
+
"_phantom",
|
|
1433
|
+
"callPhantom",
|
|
1434
|
+
"__phantomas",
|
|
1435
|
+
"Buffer",
|
|
1436
|
+
"emit",
|
|
1437
|
+
"spawn",
|
|
1438
|
+
"__selenium_evaluate",
|
|
1439
|
+
"__selenium_unwrapped",
|
|
1440
|
+
"__webdriver_evaluate",
|
|
1441
|
+
"__webdriver_script_fn",
|
|
1442
|
+
"__webdriver_script_func",
|
|
1443
|
+
"__webdriver_unwrapped",
|
|
1444
|
+
"__fxdriver_evaluate",
|
|
1445
|
+
"__fxdriver_unwrapped",
|
|
1446
|
+
"__driver_evaluate",
|
|
1447
|
+
"__driver_unwrapped",
|
|
1448
|
+
"_Selenium_IDE_Recorder",
|
|
1449
|
+
"domAutomation",
|
|
1450
|
+
"domAutomationController",
|
|
1451
|
+
"__lastWatirAlert",
|
|
1452
|
+
"__playwright",
|
|
1453
|
+
"__puppeteer",
|
|
1454
|
+
"__pw_manual"
|
|
1455
|
+
];
|
|
1456
|
+
var automationSource = {
|
|
1457
|
+
id: core.SOURCE.automation,
|
|
1458
|
+
tier: "fast",
|
|
1459
|
+
run() {
|
|
1460
|
+
const w = requireWindow();
|
|
1461
|
+
const present = AUTOMATION_GLOBALS.filter((name) => attempt(() => name in w) === true);
|
|
1462
|
+
const cdp = attempt(
|
|
1463
|
+
() => Object.getOwnPropertyNames(w).filter((name) => /^cdc_|^\$cdc_/.test(name))
|
|
1464
|
+
);
|
|
1465
|
+
return compact({
|
|
1466
|
+
webdriver: attempt(() => navigator.webdriver),
|
|
1467
|
+
cdp_artifacts: cdp && cdp.length > 0 ? cdp : void 0,
|
|
1468
|
+
distinctive_properties: present.length > 0 ? [...present] : void 0,
|
|
1469
|
+
chrome_object: attempt(() => "chrome" in w),
|
|
1470
|
+
window_external: attempt(() => {
|
|
1471
|
+
const external = w.external;
|
|
1472
|
+
return external ? String(external) : void 0;
|
|
1473
|
+
})
|
|
1474
|
+
});
|
|
1475
|
+
}
|
|
1476
|
+
};
|
|
1477
|
+
var VENDOR_API_MS = 50;
|
|
1478
|
+
var TIMED_OUT = /* @__PURE__ */ Symbol("timed-out");
|
|
1479
|
+
async function askBrave(nav) {
|
|
1480
|
+
if (typeof nav.brave?.isBrave !== "function") return void 0;
|
|
1481
|
+
try {
|
|
1482
|
+
const answer = await Promise.race([
|
|
1483
|
+
nav.brave.isBrave(),
|
|
1484
|
+
new Promise((resolve) => setTimeout(() => resolve(TIMED_OUT), VENDOR_API_MS))
|
|
1485
|
+
]);
|
|
1486
|
+
return answer === TIMED_OUT ? void 0 : answer === true;
|
|
1487
|
+
} catch {
|
|
1488
|
+
return void 0;
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
function claimsBrave(nav) {
|
|
1492
|
+
const brands = nav.userAgentData?.brands;
|
|
1493
|
+
if (!Array.isArray(brands)) return void 0;
|
|
1494
|
+
return brands.some((entry) => entry?.brand === "Brave");
|
|
1495
|
+
}
|
|
1496
|
+
var CANARY_COLOURS = [
|
|
1497
|
+
[30, 60, 90],
|
|
1498
|
+
[210, 180, 140]
|
|
1499
|
+
];
|
|
1500
|
+
var CANARY_SIZE = 8;
|
|
1501
|
+
function canvasNoise() {
|
|
1502
|
+
if (typeof document === "undefined") return void 0;
|
|
1503
|
+
try {
|
|
1504
|
+
const canvas = document.createElement("canvas");
|
|
1505
|
+
canvas.width = CANARY_SIZE;
|
|
1506
|
+
canvas.height = CANARY_SIZE;
|
|
1507
|
+
const context = canvas.getContext("2d", { willReadFrequently: true });
|
|
1508
|
+
if (!context) return void 0;
|
|
1509
|
+
for (let y = 0; y < CANARY_SIZE; y++) {
|
|
1510
|
+
for (let x = 0; x < CANARY_SIZE; x++) {
|
|
1511
|
+
const [r, g, b] = CANARY_COLOURS[(x + y) % 2];
|
|
1512
|
+
context.fillStyle = `rgb(${r}, ${g}, ${b})`;
|
|
1513
|
+
context.fillRect(x, y, 1, 1);
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
const pixels = context.getImageData(0, 0, CANARY_SIZE, CANARY_SIZE).data;
|
|
1517
|
+
for (let index = 0; index < CANARY_SIZE * CANARY_SIZE; index++) {
|
|
1518
|
+
const x = index % CANARY_SIZE;
|
|
1519
|
+
const y = Math.floor(index / CANARY_SIZE);
|
|
1520
|
+
const [r, g, b] = CANARY_COLOURS[(x + y) % 2];
|
|
1521
|
+
const at = index * 4;
|
|
1522
|
+
if (pixels[at] !== r || pixels[at + 1] !== g || pixels[at + 2] !== b || pixels[at + 3] !== 255) {
|
|
1523
|
+
return true;
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
return false;
|
|
1527
|
+
} catch {
|
|
1528
|
+
return void 0;
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
var shieldsSource = {
|
|
1532
|
+
id: core.SOURCE.shields,
|
|
1533
|
+
tier: "fast",
|
|
1534
|
+
timeoutMs: 100,
|
|
1535
|
+
async run() {
|
|
1536
|
+
if (typeof navigator === "undefined") throw new core.UnsupportedSignal("no-navigator");
|
|
1537
|
+
const nav = navigator;
|
|
1538
|
+
return compact({
|
|
1539
|
+
brave: await askBrave(nav),
|
|
1540
|
+
brave_claimed: claimsBrave(nav),
|
|
1541
|
+
canvas_noise: canvasNoise()
|
|
1542
|
+
});
|
|
1543
|
+
}
|
|
1544
|
+
};
|
|
1545
|
+
function storageWorks(area) {
|
|
1546
|
+
try {
|
|
1547
|
+
const store = window[area];
|
|
1548
|
+
if (!store) return false;
|
|
1549
|
+
const key = "__fingerly_probe__";
|
|
1550
|
+
store.setItem(key, "1");
|
|
1551
|
+
store.removeItem(key);
|
|
1552
|
+
return true;
|
|
1553
|
+
} catch {
|
|
1554
|
+
return false;
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
function indexedDbWorks() {
|
|
1558
|
+
try {
|
|
1559
|
+
return typeof window.indexedDB === "object" && window.indexedDB !== null;
|
|
1560
|
+
} catch {
|
|
1561
|
+
return false;
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
function classifyFilesystemRefusal(error) {
|
|
1565
|
+
const name = error instanceof Error ? error.name : "";
|
|
1566
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1567
|
+
if (message.includes("unknown transient reason")) return "transient";
|
|
1568
|
+
if (name === "SecurityError" || message.includes("Security error")) return "refused";
|
|
1569
|
+
return "failed";
|
|
1570
|
+
}
|
|
1571
|
+
var FILESYSTEM_PROBE_MS = 200;
|
|
1572
|
+
async function originFilesystem() {
|
|
1573
|
+
const storage = navigator.storage;
|
|
1574
|
+
if (typeof storage?.getDirectory !== "function") return void 0;
|
|
1575
|
+
return Promise.race([
|
|
1576
|
+
storage.getDirectory().then(
|
|
1577
|
+
() => "ok",
|
|
1578
|
+
(error) => classifyFilesystemRefusal(error)
|
|
1579
|
+
),
|
|
1580
|
+
new Promise((resolve) => setTimeout(resolve, FILESYSTEM_PROBE_MS))
|
|
1581
|
+
]);
|
|
1582
|
+
}
|
|
1583
|
+
var LEGACY_QUOTA_PROBE_MS = 150;
|
|
1584
|
+
function legacyQuota() {
|
|
1585
|
+
const storage = navigator.webkitTemporaryStorage;
|
|
1586
|
+
if (typeof storage?.queryUsageAndQuota !== "function") return Promise.resolve(void 0);
|
|
1587
|
+
return new Promise((resolve) => {
|
|
1588
|
+
let settled = false;
|
|
1589
|
+
const settle = (value) => {
|
|
1590
|
+
if (settled) return;
|
|
1591
|
+
settled = true;
|
|
1592
|
+
resolve(value);
|
|
1593
|
+
};
|
|
1594
|
+
setTimeout(() => settle(void 0), LEGACY_QUOTA_PROBE_MS);
|
|
1595
|
+
try {
|
|
1596
|
+
storage.queryUsageAndQuota(
|
|
1597
|
+
(_usage, quota) => settle(typeof quota === "number" ? quota : void 0),
|
|
1598
|
+
() => settle(void 0)
|
|
1599
|
+
);
|
|
1600
|
+
} catch {
|
|
1601
|
+
settle(void 0);
|
|
1602
|
+
}
|
|
1603
|
+
});
|
|
1604
|
+
}
|
|
1605
|
+
function serviceWorkerAvailable() {
|
|
1606
|
+
if (!window.isSecureContext) return void 0;
|
|
1607
|
+
return "serviceWorker" in navigator;
|
|
1608
|
+
}
|
|
1609
|
+
var storageSource = {
|
|
1610
|
+
id: core.SOURCE.storage,
|
|
1611
|
+
tier: "fast",
|
|
1612
|
+
timeoutMs: 250,
|
|
1613
|
+
async run() {
|
|
1614
|
+
requireWindow();
|
|
1615
|
+
const estimated = attempt(async () => {
|
|
1616
|
+
if (typeof navigator.storage?.estimate !== "function") return void 0;
|
|
1617
|
+
const estimate2 = await navigator.storage.estimate();
|
|
1618
|
+
return { quota: estimate2.quota, usage: estimate2.usage };
|
|
1619
|
+
});
|
|
1620
|
+
const legacy = legacyQuota();
|
|
1621
|
+
const filesystem = originFilesystem();
|
|
1622
|
+
const [estimate, legacyValue, originFilesystemValue] = await Promise.all([
|
|
1623
|
+
estimated,
|
|
1624
|
+
legacy,
|
|
1625
|
+
filesystem
|
|
1626
|
+
]);
|
|
1627
|
+
const quota = estimate?.quota;
|
|
1628
|
+
const deviceMemory = navigator.deviceMemory;
|
|
1629
|
+
return compact({
|
|
1630
|
+
local_storage: storageWorks("localStorage"),
|
|
1631
|
+
session_storage: storageWorks("sessionStorage"),
|
|
1632
|
+
indexed_db: indexedDbWorks(),
|
|
1633
|
+
quota,
|
|
1634
|
+
usage: estimate?.usage,
|
|
1635
|
+
legacy_quota: legacyValue,
|
|
1636
|
+
// Chromium's incognito quota is derived from device memory on recent
|
|
1637
|
+
// builds rather than being a fixed number, so the ratio is the form of
|
|
1638
|
+
// the test that survives the next change to it. Reported alongside the
|
|
1639
|
+
// absolute value rather than instead, because older builds need the
|
|
1640
|
+
// absolute one.
|
|
1641
|
+
//
|
|
1642
|
+
// Both inputs are farbled on Brave, which is why the detector recomputes
|
|
1643
|
+
// this from the quota and the memory reading it decided to trust rather
|
|
1644
|
+
// than taking it. Kept because reports stored by shipped SDKs carry it
|
|
1645
|
+
// and the server's copy of the rules still has to read them.
|
|
1646
|
+
quota_ratio: typeof quota === "number" && typeof deviceMemory === "number" && deviceMemory > 0 ? quota / (deviceMemory * 1024 * 1024 * 1024) : void 0,
|
|
1647
|
+
origin_filesystem: originFilesystemValue,
|
|
1648
|
+
service_worker: serviceWorkerAvailable()
|
|
1649
|
+
});
|
|
1650
|
+
}
|
|
1651
|
+
};
|
|
1652
|
+
var storageQuotaSource = {
|
|
1653
|
+
id: core.SOURCE.storageQuota,
|
|
1654
|
+
tier: "fast",
|
|
1655
|
+
run() {
|
|
1656
|
+
requireWindow();
|
|
1657
|
+
if (typeof document === "undefined") throw new core.UnsupportedSignal("no-document");
|
|
1658
|
+
return { partitioned: typeof document.hasStorageAccess === "function" };
|
|
1659
|
+
}
|
|
1660
|
+
};
|
|
1661
|
+
var BASE_FONTS = ["monospace", "sans-serif", "serif"];
|
|
1662
|
+
var TEST_SIZE = "72px";
|
|
1663
|
+
var TEST_STRING = "mmmmmmmmmmlli WwMmIi 0123";
|
|
1664
|
+
var CANDIDATES = [
|
|
1665
|
+
// Windows
|
|
1666
|
+
"Arial",
|
|
1667
|
+
"Arial Black",
|
|
1668
|
+
"Calibri",
|
|
1669
|
+
"Cambria",
|
|
1670
|
+
"Candara",
|
|
1671
|
+
"Comic Sans MS",
|
|
1672
|
+
"Consolas",
|
|
1673
|
+
"Constantia",
|
|
1674
|
+
"Corbel",
|
|
1675
|
+
"Courier New",
|
|
1676
|
+
"Ebrima",
|
|
1677
|
+
"Franklin Gothic",
|
|
1678
|
+
"Gabriola",
|
|
1679
|
+
"Georgia",
|
|
1680
|
+
"Impact",
|
|
1681
|
+
"Lucida Console",
|
|
1682
|
+
"Lucida Sans Unicode",
|
|
1683
|
+
"Malgun Gothic",
|
|
1684
|
+
"Marlett",
|
|
1685
|
+
"Microsoft Himalaya",
|
|
1686
|
+
"MS Gothic",
|
|
1687
|
+
"MV Boli",
|
|
1688
|
+
"Nirmala UI",
|
|
1689
|
+
"Palatino Linotype",
|
|
1690
|
+
"Segoe UI",
|
|
1691
|
+
"Segoe UI Emoji",
|
|
1692
|
+
"Sylfaen",
|
|
1693
|
+
"Tahoma",
|
|
1694
|
+
"Times New Roman",
|
|
1695
|
+
"Trebuchet MS",
|
|
1696
|
+
"Verdana",
|
|
1697
|
+
"Webdings",
|
|
1698
|
+
"Wingdings",
|
|
1699
|
+
// macOS / iOS
|
|
1700
|
+
"American Typewriter",
|
|
1701
|
+
"Andale Mono",
|
|
1702
|
+
"Apple Chancery",
|
|
1703
|
+
"Arial Hebrew",
|
|
1704
|
+
"Avenir",
|
|
1705
|
+
"Avenir Next",
|
|
1706
|
+
"Baskerville",
|
|
1707
|
+
"Big Caslon",
|
|
1708
|
+
"Bodoni 72",
|
|
1709
|
+
"Chalkboard",
|
|
1710
|
+
"Cochin",
|
|
1711
|
+
"Copperplate",
|
|
1712
|
+
"Didot",
|
|
1713
|
+
"Futura",
|
|
1714
|
+
"Geneva",
|
|
1715
|
+
"Gill Sans",
|
|
1716
|
+
"Helvetica",
|
|
1717
|
+
"Helvetica Neue",
|
|
1718
|
+
"Herculanum",
|
|
1719
|
+
"Hoefler Text",
|
|
1720
|
+
"Lucida Grande",
|
|
1721
|
+
"Luminari",
|
|
1722
|
+
"Menlo",
|
|
1723
|
+
"Monaco",
|
|
1724
|
+
"Optima",
|
|
1725
|
+
"Papyrus",
|
|
1726
|
+
"Phosphate",
|
|
1727
|
+
"Rockwell",
|
|
1728
|
+
"SF Pro",
|
|
1729
|
+
"Skia",
|
|
1730
|
+
"Snell Roundhand",
|
|
1731
|
+
"Trattatello",
|
|
1732
|
+
"Zapfino",
|
|
1733
|
+
// Linux
|
|
1734
|
+
"Cantarell",
|
|
1735
|
+
"DejaVu Sans",
|
|
1736
|
+
"DejaVu Serif",
|
|
1737
|
+
"FreeSans",
|
|
1738
|
+
"Liberation Sans",
|
|
1739
|
+
"Liberation Serif",
|
|
1740
|
+
"Nimbus Sans",
|
|
1741
|
+
"Noto Sans",
|
|
1742
|
+
"Ubuntu",
|
|
1743
|
+
"Ubuntu Mono",
|
|
1744
|
+
// Android
|
|
1745
|
+
"Droid Sans",
|
|
1746
|
+
"Roboto",
|
|
1747
|
+
"Roboto Condensed",
|
|
1748
|
+
// Bundled with common applications - each one names an installed product
|
|
1749
|
+
"Bahnschrift",
|
|
1750
|
+
"Bookshelf Symbol 7",
|
|
1751
|
+
"Cascadia Code",
|
|
1752
|
+
"Fira Code",
|
|
1753
|
+
"HoloLens MDL2 Assets",
|
|
1754
|
+
"Inter",
|
|
1755
|
+
"JetBrains Mono",
|
|
1756
|
+
"MT Extra",
|
|
1757
|
+
"Source Code Pro",
|
|
1758
|
+
"Wingdings 2",
|
|
1759
|
+
"Wingdings 3"
|
|
1760
|
+
];
|
|
1761
|
+
var fontsSource = {
|
|
1762
|
+
id: core.SOURCE.fonts,
|
|
1763
|
+
tier: "deferred",
|
|
1764
|
+
// Generous: this measures ~300 spans, and forcing layout on a busy page is
|
|
1765
|
+
// genuinely slow. Still bounded, which is the part that matters.
|
|
1766
|
+
timeoutMs: 700,
|
|
1767
|
+
run() {
|
|
1768
|
+
if (typeof document === "undefined") throw new core.UnsupportedSignal("no-document");
|
|
1769
|
+
const holder = document.createElement("div");
|
|
1770
|
+
holder.style.cssText = "position:absolute;left:-9999px;top:-9999px;visibility:hidden;width:auto;height:auto;margin:0;padding:0;white-space:nowrap;";
|
|
1771
|
+
const span = (fontFamily) => {
|
|
1772
|
+
const element = document.createElement("span");
|
|
1773
|
+
element.style.cssText = `position:absolute;font-size:${TEST_SIZE};margin:0;padding:0;font-family:${fontFamily};`;
|
|
1774
|
+
element.textContent = TEST_STRING;
|
|
1775
|
+
holder.appendChild(element);
|
|
1776
|
+
return element;
|
|
1777
|
+
};
|
|
1778
|
+
const baseSpans = BASE_FONTS.map((base) => span(base));
|
|
1779
|
+
const candidateSpans = CANDIDATES.map(
|
|
1780
|
+
(candidate) => BASE_FONTS.map((base) => span(`'${candidate}',${base}`))
|
|
1781
|
+
);
|
|
1782
|
+
document.body.appendChild(holder);
|
|
1783
|
+
try {
|
|
1784
|
+
const baseWidths = baseSpans.map((element) => element.offsetWidth);
|
|
1785
|
+
const baseHeights = baseSpans.map((element) => element.offsetHeight);
|
|
1786
|
+
const available = [];
|
|
1787
|
+
CANDIDATES.forEach((candidate, index) => {
|
|
1788
|
+
const spans = candidateSpans[index];
|
|
1789
|
+
if (!spans) return;
|
|
1790
|
+
const differs = spans.every((element, baseIndex) => {
|
|
1791
|
+
const width = baseWidths[baseIndex];
|
|
1792
|
+
const height = baseHeights[baseIndex];
|
|
1793
|
+
return element.offsetWidth !== width || element.offsetHeight !== height;
|
|
1794
|
+
});
|
|
1795
|
+
if (differs) available.push(candidate);
|
|
1796
|
+
});
|
|
1797
|
+
return compact({
|
|
1798
|
+
available,
|
|
1799
|
+
// The denominator, so a consumer reads a ratio rather than a count -
|
|
1800
|
+
// and so that adding a candidate later does not silently change what
|
|
1801
|
+
// "12 fonts" meant in a stored report.
|
|
1802
|
+
probed: CANDIDATES.length
|
|
1803
|
+
});
|
|
1804
|
+
} finally {
|
|
1805
|
+
holder.remove();
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
};
|
|
1809
|
+
var fontPreferencesSource = {
|
|
1810
|
+
id: core.SOURCE.fontPreferences,
|
|
1811
|
+
tier: "deferred",
|
|
1812
|
+
timeoutMs: 250,
|
|
1813
|
+
run() {
|
|
1814
|
+
if (typeof document === "undefined" || !document.body) {
|
|
1815
|
+
throw new core.UnsupportedSignal("no-document-body");
|
|
1816
|
+
}
|
|
1817
|
+
const frame = document.createElement("iframe");
|
|
1818
|
+
frame.setAttribute("aria-hidden", "true");
|
|
1819
|
+
frame.style.cssText = "position:absolute;left:-9999px;width:1px;height:1px;border:0";
|
|
1820
|
+
document.body.appendChild(frame);
|
|
1821
|
+
try {
|
|
1822
|
+
const doc = frame.contentDocument;
|
|
1823
|
+
if (!doc?.body) throw new core.UnsupportedSignal("no-frame-document");
|
|
1824
|
+
const text = "mmMwWLliI0O&1";
|
|
1825
|
+
const families = {
|
|
1826
|
+
default: "",
|
|
1827
|
+
serif: "serif",
|
|
1828
|
+
sans: "sans-serif",
|
|
1829
|
+
mono: "monospace",
|
|
1830
|
+
system: "system-ui",
|
|
1831
|
+
apple: "-apple-system",
|
|
1832
|
+
min: "Arial, sans-serif"
|
|
1833
|
+
};
|
|
1834
|
+
const widths = {};
|
|
1835
|
+
for (const [name, family] of Object.entries(families)) {
|
|
1836
|
+
const span = doc.createElement("span");
|
|
1837
|
+
span.textContent = text;
|
|
1838
|
+
span.style.cssText = `font:72px ${family || "initial"};white-space:nowrap;position:absolute`;
|
|
1839
|
+
doc.body.appendChild(span);
|
|
1840
|
+
widths[name] = Math.round(span.getBoundingClientRect().width * 1e3) / 1e3;
|
|
1841
|
+
}
|
|
1842
|
+
return { widths };
|
|
1843
|
+
} finally {
|
|
1844
|
+
frame.remove();
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
};
|
|
1848
|
+
|
|
1849
|
+
// src/sources/index.ts
|
|
1850
|
+
var browserSources = [
|
|
1851
|
+
// fast
|
|
1852
|
+
engineSource,
|
|
1853
|
+
errorsSource,
|
|
1854
|
+
mathSource,
|
|
1855
|
+
navigatorSource,
|
|
1856
|
+
languagesSource,
|
|
1857
|
+
pluginsSource,
|
|
1858
|
+
vendorSource,
|
|
1859
|
+
screenSource,
|
|
1860
|
+
screenFrameSource,
|
|
1861
|
+
mediaQueriesSource,
|
|
1862
|
+
colorGamutSource,
|
|
1863
|
+
hardwareSource,
|
|
1864
|
+
touchSource,
|
|
1865
|
+
networkSource,
|
|
1866
|
+
intlSource,
|
|
1867
|
+
timezoneSource,
|
|
1868
|
+
storageSource,
|
|
1869
|
+
storageQuotaSource,
|
|
1870
|
+
shieldsSource,
|
|
1871
|
+
timingSource,
|
|
1872
|
+
permissionsSource,
|
|
1873
|
+
automationSource,
|
|
1874
|
+
webglSource,
|
|
1875
|
+
// deferred
|
|
1876
|
+
canvasSource,
|
|
1877
|
+
webglExtensionsSource,
|
|
1878
|
+
audioSource,
|
|
1879
|
+
audioLatencySource,
|
|
1880
|
+
fontsSource,
|
|
1881
|
+
fontPreferencesSource,
|
|
1882
|
+
batterySource,
|
|
1883
|
+
speechSource,
|
|
1884
|
+
sensorsSource,
|
|
1885
|
+
mediaDevicesSource,
|
|
1886
|
+
userAgentDataSource,
|
|
1887
|
+
domBlockersSource,
|
|
1888
|
+
storageDurabilitySource
|
|
1889
|
+
];
|
|
1890
|
+
function load(options) {
|
|
1891
|
+
return Promise.resolve(
|
|
1892
|
+
new core.FingerlyClient({
|
|
1893
|
+
...options,
|
|
1894
|
+
platform: "web",
|
|
1895
|
+
sources: options.sources ?? browserSources,
|
|
1896
|
+
integrity: (report) => inspectIntegrity(report.sources)
|
|
1897
|
+
})
|
|
1898
|
+
);
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
Object.defineProperty(exports, "ConsentError", {
|
|
1902
|
+
enumerable: true,
|
|
1903
|
+
get: function () { return core.ConsentError; }
|
|
1904
|
+
});
|
|
1905
|
+
Object.defineProperty(exports, "FingerlyClient", {
|
|
1906
|
+
enumerable: true,
|
|
1907
|
+
get: function () { return core.FingerlyClient; }
|
|
1908
|
+
});
|
|
1909
|
+
Object.defineProperty(exports, "SOURCE", {
|
|
1910
|
+
enumerable: true,
|
|
1911
|
+
get: function () { return core.SOURCE; }
|
|
1912
|
+
});
|
|
1913
|
+
Object.defineProperty(exports, "TransportError", {
|
|
1914
|
+
enumerable: true,
|
|
1915
|
+
get: function () { return core.TransportError; }
|
|
1916
|
+
});
|
|
1917
|
+
exports.browserSources = browserSources;
|
|
1918
|
+
exports.inspectIntegrity = inspectIntegrity;
|
|
1919
|
+
exports.load = load;
|