@duckduckgo/autoconsent 5.3.0 → 6.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.
Files changed (97) hide show
  1. package/.eslintrc +1 -1
  2. package/CHANGELOG.md +47 -0
  3. package/data/coverage.json +958 -1010
  4. package/dist/addon-firefox/background.bundle.js +13 -12
  5. package/dist/addon-firefox/content.bundle.js +1086 -942
  6. package/dist/addon-firefox/manifest.json +1 -1
  7. package/dist/addon-firefox/rules.json +112 -83
  8. package/dist/addon-mv3/background.bundle.js +13 -12
  9. package/dist/addon-mv3/content.bundle.js +1086 -942
  10. package/dist/addon-mv3/manifest.json +1 -1
  11. package/dist/addon-mv3/popup.bundle.js +38 -0
  12. package/dist/addon-mv3/popup.html +2 -1
  13. package/dist/addon-mv3/rules.json +112 -83
  14. package/dist/autoconsent.cjs.js +1579 -1442
  15. package/dist/autoconsent.esm.js +1566 -1424
  16. package/dist/autoconsent.playwright.js +1 -1
  17. package/lib/cmps/airbnb.ts +1 -3
  18. package/lib/cmps/all.ts +13 -22
  19. package/lib/cmps/base.ts +123 -92
  20. package/lib/cmps/consentmanager.ts +7 -10
  21. package/lib/cmps/conversant.ts +1 -4
  22. package/lib/cmps/cookiebot.ts +6 -10
  23. package/lib/cmps/evidon.ts +1 -3
  24. package/lib/cmps/klaro.ts +3 -7
  25. package/lib/cmps/onetrust.ts +3 -7
  26. package/lib/cmps/sourcepoint-frame.ts +1 -4
  27. package/lib/cmps/tiktok.ts +1 -3
  28. package/lib/cmps/trustarc-frame.ts +4 -6
  29. package/lib/cmps/trustarc-top.ts +6 -5
  30. package/lib/cmps/uniconsent.ts +1 -3
  31. package/lib/eval-snippets.ts +105 -0
  32. package/lib/rule-executors.ts +0 -8
  33. package/lib/rules.ts +3 -1
  34. package/lib/types.ts +1 -1
  35. package/lib/web.ts +26 -13
  36. package/package.json +4 -4
  37. package/readme.md +3 -3
  38. package/rules/autoconsent/192.json +1 -1
  39. package/rules/autoconsent/activobank-pt.json +19 -0
  40. package/rules/autoconsent/adroll.json +1 -1
  41. package/rules/autoconsent/affinity-serif-com.json +1 -1
  42. package/rules/autoconsent/axeptio.json +1 -1
  43. package/rules/autoconsent/bing.json +1 -1
  44. package/rules/autoconsent/borlabs.json +1 -1
  45. package/rules/autoconsent/bundesregierung-de.json +1 -1
  46. package/rules/autoconsent/canva.json +1 -1
  47. package/rules/autoconsent/clickio.json +1 -1
  48. package/rules/autoconsent/clinch.json +1 -1
  49. package/rules/autoconsent/coinbase.json +1 -1
  50. package/rules/autoconsent/complianz-banner.json +1 -1
  51. package/rules/autoconsent/complianz-categories.json +1 -1
  52. package/rules/autoconsent/complianz-optin.json +1 -1
  53. package/rules/autoconsent/cookie-law-info.json +2 -2
  54. package/rules/autoconsent/cookie-manager-popup.json +1 -1
  55. package/rules/autoconsent/cookiealert.json +3 -3
  56. package/rules/autoconsent/cookiefirst.json +7 -8
  57. package/rules/autoconsent/cookieinformation.json +3 -3
  58. package/rules/autoconsent/dailymotion.json +1 -1
  59. package/rules/autoconsent/dsgvo.json +1 -1
  60. package/rules/autoconsent/dunelm.json +1 -1
  61. package/rules/autoconsent/etsy.json +2 -2
  62. package/rules/autoconsent/eu-cookie-compliance.json +1 -1
  63. package/rules/autoconsent/eu-cookie-law.json +1 -1
  64. package/rules/autoconsent/ezoic.json +2 -2
  65. package/rules/autoconsent/google.json +1 -1
  66. package/rules/autoconsent/iubenda.json +2 -2
  67. package/rules/autoconsent/jquery-cookiebar.json +1 -1
  68. package/rules/autoconsent/mediavine.json +1 -1
  69. package/rules/autoconsent/microsoft.json +3 -3
  70. package/rules/autoconsent/moove.json +1 -1
  71. package/rules/autoconsent/paypal.json +1 -1
  72. package/rules/autoconsent/primebox.json +1 -1
  73. package/rules/autoconsent/pubtech.json +1 -1
  74. package/rules/autoconsent/reddit.json +1 -1
  75. package/rules/autoconsent/sibbo.json +1 -1
  76. package/rules/autoconsent/sirdata.json +1 -1
  77. package/rules/autoconsent/snigel.json +1 -1
  78. package/rules/autoconsent/steampowered.json +1 -1
  79. package/rules/autoconsent/tarteaucitron.json +3 -3
  80. package/rules/autoconsent/tealium.json +4 -4
  81. package/rules/autoconsent/testcmp-cosmetic.json +1 -1
  82. package/rules/autoconsent/testcmp.json +1 -1
  83. package/rules/autoconsent/thefreedictionary.json +2 -2
  84. package/rules/autoconsent/theverge.json +1 -1
  85. package/rules/autoconsent/twitter.json +1 -1
  86. package/rules/autoconsent/ubuntu.com.json +1 -1
  87. package/rules/autoconsent/uk-cookie-consent.json +1 -1
  88. package/rules/autoconsent/usercentrics-api.json +7 -7
  89. package/rules/autoconsent/usercentrics-button.json +1 -1
  90. package/rules/autoconsent/waitrose.json +2 -2
  91. package/rules/autoconsent/wp-cookie-notice.json +1 -1
  92. package/rules/autoconsent/xing.json +1 -1
  93. package/rules/autoconsent/youtube-desktop.json +1 -1
  94. package/rules/autoconsent/youtube-mobile.json +1 -1
  95. package/rules/rules.json +112 -83
  96. package/tests/activobank-pt.spec.ts +6 -0
  97. package/lib/index.ts +0 -4
@@ -1,54 +1,406 @@
1
1
  (() => {
2
- // lib/config.ts
3
- var enableLogs = false;
2
+ // lib/consentomatic/tools.ts
3
+ var Tools = class _Tools {
4
+ static {
5
+ this.base = null;
6
+ }
7
+ static setBase(base) {
8
+ _Tools.base = base;
9
+ }
10
+ static findElement(options, parent = null, multiple = false) {
11
+ let possibleTargets = null;
12
+ if (parent != null) {
13
+ possibleTargets = Array.from(parent.querySelectorAll(options.selector));
14
+ } else {
15
+ if (_Tools.base != null) {
16
+ possibleTargets = Array.from(
17
+ _Tools.base.querySelectorAll(options.selector)
18
+ );
19
+ } else {
20
+ possibleTargets = Array.from(
21
+ document.querySelectorAll(options.selector)
22
+ );
23
+ }
24
+ }
25
+ if (options.textFilter != null) {
26
+ possibleTargets = possibleTargets.filter((possibleTarget) => {
27
+ const textContent = possibleTarget.textContent.toLowerCase();
28
+ if (Array.isArray(options.textFilter)) {
29
+ let foundText = false;
30
+ for (const text of options.textFilter) {
31
+ if (textContent.indexOf(text.toLowerCase()) !== -1) {
32
+ foundText = true;
33
+ break;
34
+ }
35
+ }
36
+ return foundText;
37
+ } else if (options.textFilter != null) {
38
+ return textContent.indexOf(options.textFilter.toLowerCase()) !== -1;
39
+ }
40
+ });
41
+ }
42
+ if (options.styleFilters != null) {
43
+ possibleTargets = possibleTargets.filter((possibleTarget) => {
44
+ const styles = window.getComputedStyle(possibleTarget);
45
+ let keep = true;
46
+ for (const styleFilter of options.styleFilters) {
47
+ const option = styles[styleFilter.option];
48
+ if (styleFilter.negated) {
49
+ keep = keep && option !== styleFilter.value;
50
+ } else {
51
+ keep = keep && option === styleFilter.value;
52
+ }
53
+ }
54
+ return keep;
55
+ });
56
+ }
57
+ if (options.displayFilter != null) {
58
+ possibleTargets = possibleTargets.filter((possibleTarget) => {
59
+ if (options.displayFilter) {
60
+ return possibleTarget.offsetHeight !== 0;
61
+ } else {
62
+ return possibleTarget.offsetHeight === 0;
63
+ }
64
+ });
65
+ }
66
+ if (options.iframeFilter != null) {
67
+ possibleTargets = possibleTargets.filter(() => {
68
+ if (options.iframeFilter) {
69
+ return window.location !== window.parent.location;
70
+ } else {
71
+ return window.location === window.parent.location;
72
+ }
73
+ });
74
+ }
75
+ if (options.childFilter != null) {
76
+ possibleTargets = possibleTargets.filter((possibleTarget) => {
77
+ const oldBase = _Tools.base;
78
+ _Tools.setBase(possibleTarget);
79
+ const childResults = _Tools.find(options.childFilter);
80
+ _Tools.setBase(oldBase);
81
+ return childResults.target != null;
82
+ });
83
+ }
84
+ if (multiple) {
85
+ return possibleTargets;
86
+ } else {
87
+ if (possibleTargets.length > 1) {
88
+ console.warn(
89
+ "Multiple possible targets: ",
90
+ possibleTargets,
91
+ options,
92
+ parent
93
+ );
94
+ }
95
+ return possibleTargets[0];
96
+ }
97
+ }
98
+ static find(options, multiple = false) {
99
+ const results = [];
100
+ if (options.parent != null) {
101
+ const parent = _Tools.findElement(options.parent, null, multiple);
102
+ if (parent != null) {
103
+ if (parent instanceof Array) {
104
+ parent.forEach((p) => {
105
+ const targets = _Tools.findElement(options.target, p, multiple);
106
+ if (targets instanceof Array) {
107
+ targets.forEach((target) => {
108
+ results.push({
109
+ parent: p,
110
+ target
111
+ });
112
+ });
113
+ } else {
114
+ results.push({
115
+ parent: p,
116
+ target: targets
117
+ });
118
+ }
119
+ });
120
+ return results;
121
+ } else {
122
+ const targets = _Tools.findElement(options.target, parent, multiple);
123
+ if (targets instanceof Array) {
124
+ targets.forEach((target) => {
125
+ results.push({
126
+ parent,
127
+ target
128
+ });
129
+ });
130
+ } else {
131
+ results.push({
132
+ parent,
133
+ target: targets
134
+ });
135
+ }
136
+ }
137
+ }
138
+ } else {
139
+ const targets = _Tools.findElement(options.target, null, multiple);
140
+ if (targets instanceof Array) {
141
+ targets.forEach((target) => {
142
+ results.push({
143
+ parent: null,
144
+ target
145
+ });
146
+ });
147
+ } else {
148
+ results.push({
149
+ parent: null,
150
+ target: targets
151
+ });
152
+ }
153
+ }
154
+ if (results.length === 0) {
155
+ results.push({
156
+ parent: null,
157
+ target: null
158
+ });
159
+ }
160
+ if (multiple) {
161
+ return results;
162
+ } else {
163
+ if (results.length !== 1) {
164
+ console.warn(
165
+ "Multiple results found, even though multiple false",
166
+ results
167
+ );
168
+ }
169
+ return results[0];
170
+ }
171
+ }
172
+ };
4
173
 
5
- // lib/random.ts
6
- function getRandomID() {
7
- if (crypto && typeof crypto.randomUUID !== "undefined") {
8
- return crypto.randomUUID();
174
+ // lib/consentomatic/index.ts
175
+ function matches(config) {
176
+ const result = Tools.find(config);
177
+ if (config.type === "css") {
178
+ return !!result.target;
179
+ } else if (config.type === "checkbox") {
180
+ return !!result.target && result.target.checked;
181
+ }
182
+ }
183
+ async function executeAction(config, param) {
184
+ switch (config.type) {
185
+ case "click":
186
+ return clickAction(config);
187
+ case "list":
188
+ return listAction(config, param);
189
+ case "consent":
190
+ return consentAction(config, param);
191
+ case "ifcss":
192
+ return ifCssAction(config, param);
193
+ case "waitcss":
194
+ return waitCssAction(config);
195
+ case "foreach":
196
+ return forEachAction(config, param);
197
+ case "hide":
198
+ return hideAction(config);
199
+ case "slide":
200
+ return slideAction(config);
201
+ case "close":
202
+ return closeAction();
203
+ case "wait":
204
+ return waitAction(config);
205
+ case "eval":
206
+ return evalAction(config);
207
+ default:
208
+ throw "Unknown action type: " + config.type;
209
+ }
210
+ }
211
+ var STEP_TIMEOUT = 0;
212
+ function waitTimeout(timeout) {
213
+ return new Promise((resolve) => {
214
+ setTimeout(() => {
215
+ resolve();
216
+ }, timeout);
217
+ });
218
+ }
219
+ async function clickAction(config) {
220
+ const result = Tools.find(config);
221
+ if (result.target != null) {
222
+ result.target.click();
223
+ }
224
+ return waitTimeout(STEP_TIMEOUT);
225
+ }
226
+ async function listAction(config, param) {
227
+ for (const action of config.actions) {
228
+ await executeAction(action, param);
229
+ }
230
+ }
231
+ async function consentAction(config, consentTypes) {
232
+ for (const consentConfig of config.consents) {
233
+ const shouldEnable = consentTypes.indexOf(consentConfig.type) !== -1;
234
+ if (consentConfig.matcher && consentConfig.toggleAction) {
235
+ const isEnabled = matches(consentConfig.matcher);
236
+ if (isEnabled !== shouldEnable) {
237
+ await executeAction(consentConfig.toggleAction);
238
+ }
239
+ } else {
240
+ if (shouldEnable) {
241
+ await executeAction(consentConfig.trueAction);
242
+ } else {
243
+ await executeAction(consentConfig.falseAction);
244
+ }
245
+ }
246
+ }
247
+ }
248
+ async function ifCssAction(config, param) {
249
+ const result = Tools.find(config);
250
+ if (!result.target) {
251
+ if (config.trueAction) {
252
+ await executeAction(config.trueAction, param);
253
+ }
254
+ } else {
255
+ if (config.falseAction) {
256
+ await executeAction(config.falseAction, param);
257
+ }
258
+ }
259
+ }
260
+ async function waitCssAction(config) {
261
+ await new Promise((resolve) => {
262
+ let numRetries = config.retries || 10;
263
+ const waitTime = config.waitTime || 250;
264
+ const checkCss = () => {
265
+ const result = Tools.find(config);
266
+ if (config.negated && result.target || !config.negated && !result.target) {
267
+ if (numRetries > 0) {
268
+ numRetries -= 1;
269
+ setTimeout(checkCss, waitTime);
270
+ } else {
271
+ resolve();
272
+ }
273
+ } else {
274
+ resolve();
275
+ }
276
+ };
277
+ checkCss();
278
+ });
279
+ }
280
+ async function forEachAction(config, param) {
281
+ const results = Tools.find(config, true);
282
+ const oldBase = Tools.base;
283
+ for (const result of results) {
284
+ if (result.target) {
285
+ Tools.setBase(result.target);
286
+ await executeAction(config.action, param);
287
+ }
288
+ }
289
+ Tools.setBase(oldBase);
290
+ }
291
+ async function hideAction(config) {
292
+ const result = Tools.find(config);
293
+ if (result.target) {
294
+ result.target.classList.add("Autoconsent-Hidden");
295
+ }
296
+ }
297
+ async function slideAction(config) {
298
+ const result = Tools.find(config);
299
+ const dragResult = Tools.find(config.dragTarget);
300
+ if (result.target) {
301
+ const targetBounds = result.target.getBoundingClientRect();
302
+ const dragTargetBounds = dragResult.target.getBoundingClientRect();
303
+ let yDiff = dragTargetBounds.top - targetBounds.top;
304
+ let xDiff = dragTargetBounds.left - targetBounds.left;
305
+ if (this.config.axis.toLowerCase() === "y") {
306
+ xDiff = 0;
307
+ }
308
+ if (this.config.axis.toLowerCase() === "x") {
309
+ yDiff = 0;
310
+ }
311
+ const screenX = window.screenX + targetBounds.left + targetBounds.width / 2;
312
+ const screenY = window.screenY + targetBounds.top + targetBounds.height / 2;
313
+ const clientX = targetBounds.left + targetBounds.width / 2;
314
+ const clientY = targetBounds.top + targetBounds.height / 2;
315
+ const mouseDown = document.createEvent("MouseEvents");
316
+ mouseDown.initMouseEvent(
317
+ "mousedown",
318
+ true,
319
+ true,
320
+ window,
321
+ 0,
322
+ screenX,
323
+ screenY,
324
+ clientX,
325
+ clientY,
326
+ false,
327
+ false,
328
+ false,
329
+ false,
330
+ 0,
331
+ result.target
332
+ );
333
+ const mouseMove = document.createEvent("MouseEvents");
334
+ mouseMove.initMouseEvent(
335
+ "mousemove",
336
+ true,
337
+ true,
338
+ window,
339
+ 0,
340
+ screenX + xDiff,
341
+ screenY + yDiff,
342
+ clientX + xDiff,
343
+ clientY + yDiff,
344
+ false,
345
+ false,
346
+ false,
347
+ false,
348
+ 0,
349
+ result.target
350
+ );
351
+ const mouseUp = document.createEvent("MouseEvents");
352
+ mouseUp.initMouseEvent(
353
+ "mouseup",
354
+ true,
355
+ true,
356
+ window,
357
+ 0,
358
+ screenX + xDiff,
359
+ screenY + yDiff,
360
+ clientX + xDiff,
361
+ clientY + yDiff,
362
+ false,
363
+ false,
364
+ false,
365
+ false,
366
+ 0,
367
+ result.target
368
+ );
369
+ result.target.dispatchEvent(mouseDown);
370
+ await this.waitTimeout(10);
371
+ result.target.dispatchEvent(mouseMove);
372
+ await this.waitTimeout(10);
373
+ result.target.dispatchEvent(mouseUp);
9
374
  }
10
- return Math.random().toString();
11
375
  }
12
-
13
- // lib/eval-handler.ts
14
- var Deferred = class {
15
- constructor(id, timeout = 1e3) {
16
- this.id = id;
17
- this.promise = new Promise((resolve, reject) => {
18
- this.resolve = resolve;
19
- this.reject = reject;
20
- });
21
- this.timer = window.setTimeout(() => {
22
- this.reject(new Error("timeout"));
23
- }, timeout);
24
- }
25
- };
26
- var evalState = {
27
- pending: /* @__PURE__ */ new Map(),
28
- sendContentMessage: null
29
- };
30
- function requestEval(code) {
31
- const id = getRandomID();
32
- evalState.sendContentMessage({
33
- type: "eval",
34
- id,
35
- code
36
- });
37
- const deferred = new Deferred(id);
38
- evalState.pending.set(deferred.id, deferred);
39
- return deferred.promise;
376
+ async function waitAction(config) {
377
+ await waitTimeout(config.waitTime);
40
378
  }
41
- function resolveEval(id, value) {
42
- const deferred = evalState.pending.get(id);
43
- if (deferred) {
44
- evalState.pending.delete(id);
45
- deferred.timer && window.clearTimeout(deferred.timer);
46
- deferred.resolve(value);
47
- } else {
48
- console.warn("no eval #", id);
49
- }
379
+ async function closeAction() {
380
+ window.close();
381
+ }
382
+ async function evalAction(config) {
383
+ console.log("eval!", config.code);
384
+ return new Promise((resolve) => {
385
+ try {
386
+ if (config.async) {
387
+ window.eval(config.code);
388
+ setTimeout(() => {
389
+ resolve(window.eval("window.__consentCheckResult"));
390
+ }, config.timeout || 250);
391
+ } else {
392
+ resolve(window.eval(config.code));
393
+ }
394
+ } catch (e) {
395
+ console.warn("eval error", e, config.code);
396
+ resolve(false);
397
+ }
398
+ });
50
399
  }
51
400
 
401
+ // lib/config.ts
402
+ var enableLogs = false;
403
+
52
404
  // lib/utils.ts
53
405
  function getStyleElement(styleOverrideElementId = "autoconsent-css-rules") {
54
406
  const styleSelector = `style#${styleOverrideElementId}`;
@@ -101,12 +453,6 @@
101
453
  }
102
454
 
103
455
  // lib/rule-executors.ts
104
- function doEval(expr) {
105
- return requestEval(expr).catch((e) => {
106
- enableLogs && console.error("error evaluating rule", expr, e);
107
- return false;
108
- });
109
- }
110
456
  function click(selector, all = false) {
111
457
  const elem = elementSelector(selector);
112
458
  enableLogs && console.log("[click]", selector, all, elem);
@@ -156,7 +502,7 @@
156
502
  interval
157
503
  );
158
504
  }
159
- async function waitForThenClick(selector, timeout = 1e4, all = false) {
505
+ async function waitForThenClick2(selector, timeout = 1e4, all = false) {
160
506
  await waitForElement(selector, timeout);
161
507
  return click(selector, all);
162
508
  }
@@ -228,6 +574,163 @@
228
574
  return querySelectorChain(selector);
229
575
  }
230
576
 
577
+ // lib/random.ts
578
+ function getRandomID() {
579
+ if (crypto && typeof crypto.randomUUID !== "undefined") {
580
+ return crypto.randomUUID();
581
+ }
582
+ return Math.random().toString();
583
+ }
584
+
585
+ // lib/eval-handler.ts
586
+ var Deferred = class {
587
+ constructor(id, timeout = 1e3) {
588
+ this.id = id;
589
+ this.promise = new Promise((resolve, reject) => {
590
+ this.resolve = resolve;
591
+ this.reject = reject;
592
+ });
593
+ this.timer = window.setTimeout(() => {
594
+ this.reject(new Error("timeout"));
595
+ }, timeout);
596
+ }
597
+ };
598
+ var evalState = {
599
+ pending: /* @__PURE__ */ new Map(),
600
+ sendContentMessage: null
601
+ };
602
+ function requestEval(code) {
603
+ const id = getRandomID();
604
+ evalState.sendContentMessage({
605
+ type: "eval",
606
+ id,
607
+ code
608
+ });
609
+ const deferred = new Deferred(id);
610
+ evalState.pending.set(deferred.id, deferred);
611
+ return deferred.promise;
612
+ }
613
+ function resolveEval(id, value) {
614
+ const deferred = evalState.pending.get(id);
615
+ if (deferred) {
616
+ evalState.pending.delete(id);
617
+ deferred.timer && window.clearTimeout(deferred.timer);
618
+ deferred.resolve(value);
619
+ } else {
620
+ console.warn("no eval #", id);
621
+ }
622
+ }
623
+
624
+ // lib/eval-snippets.ts
625
+ var snippets = {
626
+ // code-based rules
627
+ EVAL_0: () => console.log(1),
628
+ EVAL_CONSENTMANAGER_1: () => window.__cmp && typeof __cmp("getCMPData") === "object",
629
+ EVAL_CONSENTMANAGER_2: () => !__cmp("consentStatus").userChoiceExists,
630
+ EVAL_CONSENTMANAGER_3: () => __cmp("setConsent", 0),
631
+ EVAL_CONSENTMANAGER_4: () => __cmp("setConsent", 1),
632
+ EVAL_CONSENTMANAGER_5: () => __cmp("consentStatus").userChoiceExists,
633
+ EVAL_COOKIEBOT_1: () => window.CookieConsent.hasResponse !== true,
634
+ EVAL_COOKIEBOT_2: () => window.Cookiebot.dialog.submitConsent(),
635
+ EVAL_COOKIEBOT_3: () => endCookieProcess(),
636
+ EVAL_COOKIEBOT_4: () => window.CookieConsent.declined === true,
637
+ EVAL_KLARO_1: () => klaro.getManager().config.services.every((c) => c.required || !klaro.getManager().consents[c.name]),
638
+ EVAL_ONETRUST_1: () => window.OnetrustActiveGroups.split(",").filter((s) => s.length > 0).length <= 1,
639
+ EVAL_TRUSTARC_TOP: () => window && window.truste && window.truste.eu.bindMap.prefCookie === "0",
640
+ // declarative rules
641
+ EVAL_ADROLL_0: () => !document.cookie.includes("__adroll_fpc"),
642
+ EVAL_AFFINITY_SERIF_COM_0: () => document.cookie.includes("serif_manage_cookies_viewed") && !document.cookie.includes("serif_allow_analytics"),
643
+ EVAL_AXEPTIO_0: () => document.cookie.includes("axeptio_authorized_vendors=%2C%2C"),
644
+ EVAL_BING_0: () => document.cookie.includes("AL=0") && document.cookie.includes("AD=0") && document.cookie.includes("SM=0"),
645
+ EVAL_BORLABS_0: () => !JSON.parse(decodeURIComponent(document.cookie.split(";").find((c) => c.indexOf("borlabs-cookie") !== -1).split("=", 2)[1])).consents.statistics,
646
+ EVAL_BUNDESREGIERUNG_DE_0: () => document.cookie.match("cookie-allow-tracking=0"),
647
+ EVAL_CANVA_0: () => !document.cookie.includes("gtm_fpc_engagement_event"),
648
+ EVAL_CLICKIO_0: () => document.cookie.includes("__lxG__consent__v2_daisybit="),
649
+ EVAL_CLINCH_0: () => document.cookie.includes("ctc_rejected=1"),
650
+ EVAL_COINBASE_0: () => JSON.parse(decodeURIComponent(document.cookie.match(/cm_(eu|default)_preferences=([0-9a-zA-Z\\{\\}\\[\\]%:]*);?/)[2])).consent.length <= 1,
651
+ EVAL_COMPLIANZ_BANNER_0: () => document.cookie.includes("cmplz_banner-status=dismissed"),
652
+ EVAL_COMPLIANZ_CATEGORIES_0: () => !!document.cookie.match(/cmplz_[^=]+=deny/),
653
+ EVAL_COMPLIANZ_OPTIN_0: () => !!document.cookie.match(/cookieconsent_preferences_disabled=[^;]+/),
654
+ EVAL_COOKIE_LAW_INFO_0: () => CLI.disableAllCookies() || CLI.reject_close() || true,
655
+ EVAL_COOKIE_LAW_INFO_1: () => document.cookie.indexOf("cookielawinfo-checkbox-non-necessary=yes") === -1,
656
+ EVAL_COOKIE_MANAGER_POPUP_0: () => JSON.parse(document.cookie.split(";").find((c) => c.trim().startsWith("CookieLevel")).split("=")[1]).social === false,
657
+ EVAL_COOKIEALERT_0: () => document.querySelector("body").removeAttribute("style") || true,
658
+ EVAL_COOKIEALERT_1: () => document.querySelector("body").removeAttribute("style") || true,
659
+ EVAL_COOKIEALERT_2: () => window.CookieConsent.declined === true,
660
+ EVAL_COOKIEFIRST_0: () => ((o) => o.performance === false && o.functional === false && o.advertising === false)(JSON.parse(decodeURIComponent(document.cookie.split(";").find((c) => c.indexOf("cookiefirst") !== -1).trim()).split("=")[1])),
661
+ EVAL_COOKIEFIRST_1: () => document.querySelectorAll("button[data-cookiefirst-accent-color=true][role=checkbox]:not([disabled])").forEach((i) => i.getAttribute("aria-checked") == "true" && i.click()) || true,
662
+ EVAL_COOKIEINFORMATION_0: () => CookieInformation.declineAllCategories() || true,
663
+ EVAL_COOKIEINFORMATION_1: () => CookieInformation.submitAllCategories() || true,
664
+ EVAL_COOKIEINFORMATION_2: () => document.cookie.includes("CookieInformationConsent="),
665
+ EVAL_DAILYMOTION_0: () => !!document.cookie.match("dm-euconsent-v2"),
666
+ EVAL_DSGVO_0: () => !document.cookie.includes("sp_dsgvo_cookie_settings"),
667
+ EVAL_DUNELM_0: () => document.cookie.includes("cc_functional=0") && document.cookie.includes("cc_targeting=0"),
668
+ EVAL_ETSY_0: () => document.querySelectorAll(".gdpr-overlay-body input").forEach((toggle) => {
669
+ toggle.checked = false;
670
+ }) || true,
671
+ EVAL_ETSY_1: () => document.querySelector(".gdpr-overlay-view button[data-wt-overlay-close]").click() || true,
672
+ EVAL_EU_COOKIE_COMPLIANCE_0: () => document.cookie.indexOf("cookie-agreed=2") === -1,
673
+ EVAL_EU_COOKIE_LAW_0: () => !document.cookie.includes("euCookie"),
674
+ EVAL_EZOIC_0: () => ezCMP.handleAcceptAllClick(),
675
+ EVAL_EZOIC_1: () => !!document.cookie.match(/ezCMPCookieConsent=[^;]+\|2=0\|3=0\|4=0/),
676
+ EVAL_GOOGLE_0: () => !!document.cookie.match(/SOCS=CAE/),
677
+ EVAL_IUBENDA_0: () => document.querySelectorAll(".purposes-item input[type=checkbox]:not([disabled])").forEach((x) => {
678
+ if (x.checked)
679
+ x.click();
680
+ }) || true,
681
+ EVAL_IUBENDA_1: () => !!document.cookie.match(/_iub_cs-\d+=/),
682
+ EVAL_JQUERY_COOKIEBAR_0: () => !document.cookie.includes("cookies-state=accepted"),
683
+ EVAL_MEDIAVINE_0: () => document.querySelectorAll('[data-name="mediavine-gdpr-cmp"] input[type=checkbox]').forEach((x) => x.checked && x.click()) || true,
684
+ EVAL_MICROSOFT_0: () => Array.from(document.querySelectorAll("div > button")).filter((el) => el.innerText.match("Reject|Ablehnen"))[0].click() || true,
685
+ EVAL_MICROSOFT_1: () => Array.from(document.querySelectorAll("div > button")).filter((el) => el.innerText.match("Accept|Annehmen"))[0].click() || true,
686
+ EVAL_MICROSOFT_2: () => !!document.cookie.match("MSCC"),
687
+ EVAL_MOOVE_0: () => document.querySelectorAll("#moove_gdpr_cookie_modal input").forEach((i) => {
688
+ if (!i.disabled && i.name !== "moove_gdpr_strict_cookies")
689
+ i.checked = false;
690
+ }) || true,
691
+ EVAL_ONENINETWO_0: () => document.cookie.includes("CC_ADVERTISING=NO") && document.cookie.includes("CC_ANALYTICS=NO"),
692
+ EVAL_PAYPAL_0: () => document.cookie.includes("cookie_prefs") === true,
693
+ EVAL_PRIMEBOX_0: () => !document.cookie.includes("cb-enabled=accepted"),
694
+ EVAL_PUBTECH_0: () => document.cookie.includes("euconsent-v2") && (document.cookie.match(/.YAAAAAAAAAAA/) || document.cookie.match(/.aAAAAAAAAAAA/) || document.cookie.match(/.YAAACFgAAAAA/)),
695
+ EVAL_REDDIT_0: () => document.cookie.includes("eu_cookie={%22opted%22:true%2C%22nonessential%22:false}"),
696
+ EVAL_SIBBO_0: () => !!window.localStorage.getItem("euconsent-v2"),
697
+ EVAL_SIRDATA_0: () => document.cookie.includes("euconsent-v2"),
698
+ EVAL_SNIGEL_0: () => !!document.cookie.match("snconsent"),
699
+ EVAL_STEAMPOWERED_0: () => JSON.parse(decodeURIComponent(document.cookie.split(";").find((s) => s.trim().startsWith("cookieSettings")).split("=")[1])).preference_state === 2,
700
+ EVAL_TARTEAUCITRON_0: () => tarteaucitron.userInterface.respondAll(false) || true,
701
+ EVAL_TARTEAUCITRON_1: () => tarteaucitron.userInterface.respondAll(true) || true,
702
+ EVAL_TARTEAUCITRON_2: () => document.cookie.match(/tarteaucitron=[^;]*/)[0].includes("false"),
703
+ EVAL_TEALIUM_0: () => typeof window.utag !== "undefined" && typeof utag.gdpr === "object",
704
+ EVAL_TEALIUM_1: () => utag.gdpr.setConsentValue(false) || true,
705
+ EVAL_TEALIUM_2: () => utag.gdpr.setConsentValue(true) || true,
706
+ EVAL_TEALIUM_3: () => utag.gdpr.getConsentState() !== 1,
707
+ EVAL_TESTCMP_0: () => window.results.results[0] === "button_clicked",
708
+ EVAL_TESTCMP_COSMETIC_0: () => window.results.results[0] === "banner_hidden",
709
+ EVAL_THEFREEDICTIONARY_0: () => cmpUi.showPurposes() || cmpUi.rejectAll() || true,
710
+ EVAL_THEFREEDICTIONARY_1: () => cmpUi.allowAll() || true,
711
+ EVAL_THEVERGE_0: () => document.cookie.includes("_duet_gdpr_acknowledged=1"),
712
+ EVAL_UBUNTU_COM_0: () => document.cookie === "_cookies_accepted=essential",
713
+ EVAL_UK_COOKIE_CONSENT_0: () => !document.cookie.includes("catAccCookies"),
714
+ EVAL_USERCENTRICS_API_0: () => typeof UC_UI === "object",
715
+ EVAL_USERCENTRICS_API_1: () => !!UC_UI.closeCMP(),
716
+ EVAL_USERCENTRICS_API_2: () => !!UC_UI.denyAllConsents(),
717
+ EVAL_USERCENTRICS_API_3: () => !!UC_UI.acceptAllConsents(),
718
+ EVAL_USERCENTRICS_API_4: () => !!UC_UI.closeCMP(),
719
+ EVAL_USERCENTRICS_API_5: () => UC_UI.areAllConsentsAccepted() === true,
720
+ EVAL_USERCENTRICS_API_6: () => UC_UI.areAllConsentsAccepted() === false,
721
+ EVAL_USERCENTRICS_BUTTON_0: () => JSON.parse(localStorage.getItem("usercentrics")).consents.every((c) => c.isEssential || !c.consentStatus),
722
+ EVAL_WAITROSE_0: () => Array.from(document.querySelectorAll("label[id$=cookies-deny-label]")).forEach((e) => e.click()) || true,
723
+ EVAL_WAITROSE_1: () => document.cookie.includes("wtr_cookies_advertising=0") && document.cookie.includes("wtr_cookies_analytics=0"),
724
+ EVAL_WP_COOKIE_NOTICE_0: () => document.cookie.includes("wpl_viewed_cookie=no"),
725
+ EVAL_XING_0: () => document.cookie.includes("userConsent=%7B%22marketing%22%3Afalse"),
726
+ EVAL_YOUTUBE_DESKTOP_0: () => !!document.cookie.match(/SOCS=CAE/),
727
+ EVAL_YOUTUBE_MOBILE_0: () => !!document.cookie.match(/SOCS=CAE/)
728
+ };
729
+ function getFunctionBody(snippetFunc) {
730
+ const snippetStr = snippetFunc.toString();
731
+ return snippetStr.substring(snippetStr.indexOf("=>") + 2);
732
+ }
733
+
231
734
  // lib/cmps/base.ts
232
735
  var defaultRunContext = {
233
736
  main: true,
@@ -235,9 +738,9 @@
235
738
  urlPattern: ""
236
739
  };
237
740
  var AutoConsentCMPBase = class {
238
- constructor(name) {
741
+ constructor(autoconsentInstance) {
239
742
  this.runContext = defaultRunContext;
240
- this.name = name;
743
+ this.autoconsent = autoconsentInstance;
241
744
  }
242
745
  get hasSelfTest() {
243
746
  throw new Error("Not Implemented");
@@ -248,6 +751,29 @@
248
751
  get isCosmetic() {
249
752
  throw new Error("Not Implemented");
250
753
  }
754
+ mainWorldEval(snippetId) {
755
+ const snippet = snippets[snippetId];
756
+ if (!snippet) {
757
+ console.warn("Snippet not found", snippetId);
758
+ return Promise.resolve(false);
759
+ }
760
+ if (this.autoconsent.config.isMainWorld) {
761
+ enableLogs && console.log("inline eval:", snippetId, snippet);
762
+ let result = false;
763
+ try {
764
+ result = !!snippet.call(globalThis);
765
+ } catch (e) {
766
+ enableLogs && console.error("error evaluating rule", snippetId, e);
767
+ }
768
+ return Promise.resolve(result);
769
+ }
770
+ const snippetSrc = getFunctionBody(snippet);
771
+ enableLogs && console.log("async eval:", snippetId, snippetSrc);
772
+ return requestEval(snippetSrc).catch((e) => {
773
+ enableLogs && console.error("error evaluating rule", snippetId, e);
774
+ return false;
775
+ });
776
+ }
251
777
  checkRunContext() {
252
778
  const runCtx = {
253
779
  ...defaultRunContext,
@@ -284,84 +810,11 @@
284
810
  return Promise.resolve(true);
285
811
  }
286
812
  };
287
- async function evaluateRuleStep(rule) {
288
- const results = [];
289
- if (rule.exists) {
290
- results.push(elementExists(rule.exists));
291
- }
292
- if (rule.visible) {
293
- results.push(elementVisible(rule.visible, rule.check));
294
- }
295
- if (rule.eval) {
296
- const res = doEval(rule.eval);
297
- results.push(res);
298
- }
299
- if (rule.waitFor) {
300
- results.push(waitForElement(rule.waitFor, rule.timeout));
301
- }
302
- if (rule.waitForVisible) {
303
- results.push(waitForVisible(rule.waitForVisible, rule.timeout, rule.check));
304
- }
305
- if (rule.click) {
306
- results.push(click(rule.click, rule.all));
307
- }
308
- if (rule.waitForThenClick) {
309
- results.push(waitForThenClick(rule.waitForThenClick, rule.timeout, rule.all));
310
- }
311
- if (rule.wait) {
312
- results.push(wait(rule.wait));
313
- }
314
- if (rule.hide) {
315
- results.push(hide(rule.hide, rule.method));
316
- }
317
- if (rule.if) {
318
- if (!rule.if.exists && !rule.if.visible) {
319
- console.error("invalid conditional rule", rule.if);
320
- return false;
321
- }
322
- const condition = await evaluateRuleStep(rule.if);
323
- enableLogs && console.log("Condition is", condition);
324
- if (condition) {
325
- results.push(_runRulesSequentially(rule.then));
326
- } else if (rule.else) {
327
- results.push(_runRulesSequentially(rule.else));
328
- }
329
- }
330
- if (rule.any) {
331
- for (const step of rule.any) {
332
- if (await evaluateRuleStep(step)) {
333
- return true;
334
- }
335
- }
336
- return false;
337
- }
338
- if (results.length === 0) {
339
- enableLogs && console.warn("Unrecognized rule", rule);
340
- return false;
341
- }
342
- const all = await Promise.all(results);
343
- return all.reduce((a, b) => a && b, true);
344
- }
345
- async function _runRulesParallel(rules3) {
346
- const results = rules3.map((rule) => evaluateRuleStep(rule));
347
- const detections = await Promise.all(results);
348
- return detections.every((r) => !!r);
349
- }
350
- async function _runRulesSequentially(rules3) {
351
- for (const rule of rules3) {
352
- enableLogs && console.log("Running rule...", rule);
353
- const result = await evaluateRuleStep(rule);
354
- enableLogs && console.log("...rule result", result);
355
- if (!result && !rule.optional) {
356
- return false;
357
- }
358
- }
359
- return true;
360
- }
361
813
  var AutoConsentCMP = class extends AutoConsentCMPBase {
362
- constructor(config) {
363
- super(config.name);
814
+ constructor(config, autoconsentInstance) {
815
+ super(autoconsentInstance);
364
816
  this.config = config;
817
+ this.name = config.name;
365
818
  this.runContext = config.runContext || defaultRunContext;
366
819
  }
367
820
  get hasSelfTest() {
@@ -378,41 +831,180 @@
378
831
  }
379
832
  async detectCmp() {
380
833
  if (this.config.detectCmp) {
381
- return _runRulesParallel(this.config.detectCmp);
834
+ return this._runRulesParallel(this.config.detectCmp);
382
835
  }
383
836
  return false;
384
837
  }
385
838
  async detectPopup() {
386
839
  if (this.config.detectPopup) {
387
- return _runRulesSequentially(this.config.detectPopup);
840
+ return this._runRulesSequentially(this.config.detectPopup);
388
841
  }
389
842
  return false;
390
843
  }
391
844
  async optOut() {
392
845
  if (this.config.optOut) {
393
846
  enableLogs && console.log("Initiated optOut()", this.config.optOut);
394
- return _runRulesSequentially(this.config.optOut);
847
+ return this._runRulesSequentially(this.config.optOut);
395
848
  }
396
849
  return false;
397
850
  }
398
851
  async optIn() {
399
852
  if (this.config.optIn) {
400
853
  enableLogs && console.log("Initiated optIn()", this.config.optIn);
401
- return _runRulesSequentially(this.config.optIn);
854
+ return this._runRulesSequentially(this.config.optIn);
855
+ }
856
+ return false;
857
+ }
858
+ async openCmp() {
859
+ if (this.config.openCmp) {
860
+ return this._runRulesSequentially(this.config.openCmp);
861
+ }
862
+ return false;
863
+ }
864
+ async test() {
865
+ if (this.hasSelfTest) {
866
+ return this._runRulesSequentially(this.config.test);
867
+ }
868
+ return super.test();
869
+ }
870
+ async evaluateRuleStep(rule) {
871
+ const results = [];
872
+ if (rule.exists) {
873
+ results.push(elementExists(rule.exists));
874
+ }
875
+ if (rule.visible) {
876
+ results.push(elementVisible(rule.visible, rule.check));
877
+ }
878
+ if (rule.eval) {
879
+ const res = this.mainWorldEval(rule.eval);
880
+ results.push(res);
881
+ }
882
+ if (rule.waitFor) {
883
+ results.push(waitForElement(rule.waitFor, rule.timeout));
884
+ }
885
+ if (rule.waitForVisible) {
886
+ results.push(waitForVisible(rule.waitForVisible, rule.timeout, rule.check));
887
+ }
888
+ if (rule.click) {
889
+ results.push(click(rule.click, rule.all));
890
+ }
891
+ if (rule.waitForThenClick) {
892
+ results.push(waitForThenClick2(rule.waitForThenClick, rule.timeout, rule.all));
893
+ }
894
+ if (rule.wait) {
895
+ results.push(wait(rule.wait));
896
+ }
897
+ if (rule.hide) {
898
+ results.push(hide(rule.hide, rule.method));
899
+ }
900
+ if (rule.if) {
901
+ if (!rule.if.exists && !rule.if.visible) {
902
+ console.error("invalid conditional rule", rule.if);
903
+ return false;
904
+ }
905
+ const condition = await this.evaluateRuleStep(rule.if);
906
+ enableLogs && console.log("Condition is", condition);
907
+ if (condition) {
908
+ results.push(this._runRulesSequentially(rule.then));
909
+ } else if (rule.else) {
910
+ results.push(this._runRulesSequentially(rule.else));
911
+ }
912
+ }
913
+ if (rule.any) {
914
+ for (const step of rule.any) {
915
+ if (await this.evaluateRuleStep(step)) {
916
+ return true;
917
+ }
918
+ }
919
+ return false;
920
+ }
921
+ if (results.length === 0) {
922
+ enableLogs && console.warn("Unrecognized rule", rule);
923
+ return false;
924
+ }
925
+ const all = await Promise.all(results);
926
+ return all.reduce((a, b) => a && b, true);
927
+ }
928
+ async _runRulesParallel(rules) {
929
+ const results = rules.map((rule) => this.evaluateRuleStep(rule));
930
+ const detections = await Promise.all(results);
931
+ return detections.every((r) => !!r);
932
+ }
933
+ async _runRulesSequentially(rules) {
934
+ for (const rule of rules) {
935
+ enableLogs && console.log("Running rule...", rule);
936
+ const result = await this.evaluateRuleStep(rule);
937
+ enableLogs && console.log("...rule result", result);
938
+ if (!result && !rule.optional) {
939
+ return false;
940
+ }
402
941
  }
942
+ return true;
943
+ }
944
+ };
945
+
946
+ // lib/cmps/consentomatic.ts
947
+ var ConsentOMaticCMP = class {
948
+ constructor(name, config) {
949
+ this.name = name;
950
+ this.config = config;
951
+ this.methods = /* @__PURE__ */ new Map();
952
+ this.runContext = defaultRunContext;
953
+ this.isCosmetic = false;
954
+ config.methods.forEach((methodConfig) => {
955
+ if (methodConfig.action) {
956
+ this.methods.set(methodConfig.name, methodConfig.action);
957
+ }
958
+ });
959
+ this.hasSelfTest = false;
960
+ }
961
+ get isIntermediate() {
403
962
  return false;
404
963
  }
964
+ checkRunContext() {
965
+ return true;
966
+ }
967
+ async detectCmp() {
968
+ const matchResults = this.config.detectors.map(
969
+ (detectorConfig) => matches(detectorConfig.presentMatcher)
970
+ );
971
+ return matchResults.some((r) => !!r);
972
+ }
973
+ async detectPopup() {
974
+ const matchResults = this.config.detectors.map(
975
+ (detectorConfig) => matches(detectorConfig.showingMatcher)
976
+ );
977
+ return matchResults.some((r) => !!r);
978
+ }
979
+ async executeAction(method, param) {
980
+ if (this.methods.has(method)) {
981
+ return executeAction(this.methods.get(method), param);
982
+ }
983
+ return true;
984
+ }
985
+ async optOut() {
986
+ await this.executeAction("HIDE_CMP");
987
+ await this.executeAction("OPEN_OPTIONS");
988
+ await this.executeAction("HIDE_CMP");
989
+ await this.executeAction("DO_CONSENT", []);
990
+ await this.executeAction("SAVE_CONSENT");
991
+ return true;
992
+ }
993
+ async optIn() {
994
+ await this.executeAction("HIDE_CMP");
995
+ await this.executeAction("OPEN_OPTIONS");
996
+ await this.executeAction("HIDE_CMP");
997
+ await this.executeAction("DO_CONSENT", ["D", "A", "B", "E", "F", "X"]);
998
+ await this.executeAction("SAVE_CONSENT");
999
+ return true;
1000
+ }
405
1001
  async openCmp() {
406
- if (this.config.openCmp) {
407
- return _runRulesSequentially(this.config.openCmp);
408
- }
409
- return false;
1002
+ await this.executeAction("HIDE_CMP");
1003
+ await this.executeAction("OPEN_OPTIONS");
1004
+ return true;
410
1005
  }
411
1006
  async test() {
412
- if (this.hasSelfTest) {
413
- return _runRulesSequentially(this.config.test);
414
- }
415
- return super.test();
1007
+ return true;
416
1008
  }
417
1009
  };
418
1010
 
@@ -424,8 +1016,9 @@
424
1016
  var bannerOverlay = "#trustarc-banner-overlay";
425
1017
  var bannerContainer = "#truste-consent-track";
426
1018
  var TrustArcTop = class extends AutoConsentCMPBase {
427
- constructor() {
428
- super("TrustArc-top");
1019
+ constructor(autoconsentInstance) {
1020
+ super(autoconsentInstance);
1021
+ this.name = "TrustArc-top";
429
1022
  this.prehideSelectors = [
430
1023
  ".trustarc-banner-container",
431
1024
  `.truste_popframe,.truste_overlay,.truste_box_overlay,${bannerContainer}`
@@ -485,14 +1078,15 @@
485
1078
  return true;
486
1079
  }
487
1080
  async test() {
488
- return await doEval("window && window.truste && window.truste.eu.bindMap.prefCookie === '0'");
1081
+ return await this.mainWorldEval("EVAL_TRUSTARC_TOP");
489
1082
  }
490
1083
  };
491
1084
 
492
1085
  // lib/cmps/trustarc-frame.ts
493
1086
  var TrustArcFrame = class extends AutoConsentCMPBase {
494
1087
  constructor() {
495
- super("TrustArc-frame");
1088
+ super(...arguments);
1089
+ this.name = "TrustArc-frame";
496
1090
  this.runContext = {
497
1091
  main: false,
498
1092
  frame: true,
@@ -546,17 +1140,17 @@
546
1140
  }
547
1141
  if (click("#catDetails0")) {
548
1142
  click(".submit");
1143
+ waitForThenClick("#gwt-debug-close_id", 5e3);
549
1144
  return true;
550
1145
  }
551
1146
  if (click(".required")) {
1147
+ waitForThenClick("#gwt-debug-close_id", 5e3);
552
1148
  return true;
553
1149
  }
554
1150
  await this.navigateToSettings();
555
1151
  click(".switch span:nth-child(1):not(.active)", true);
556
1152
  click(".submit");
557
- waitForElement("#gwt-debug-close_id", 3e5).then(() => {
558
- click("#gwt-debug-close_id");
559
- });
1153
+ waitForThenClick("#gwt-debug-close_id", 3e5);
560
1154
  return true;
561
1155
  }
562
1156
  async optIn() {
@@ -576,7 +1170,8 @@
576
1170
  // lib/cmps/cookiebot.ts
577
1171
  var Cookiebot = class extends AutoConsentCMPBase {
578
1172
  constructor() {
579
- super("Cybotcookiebot");
1173
+ super(...arguments);
1174
+ this.name = "Cybotcookiebot";
580
1175
  this.prehideSelectors = ["#CybotCookiebotDialog,#dtcookie-container,#cookiebanner,#cb-cookieoverlay"];
581
1176
  }
582
1177
  get hasSelfTest() {
@@ -619,12 +1214,12 @@
619
1214
  } else {
620
1215
  click("#CybotCookiebotDialogBodyLevelButtonAccept,#CybotCookiebotDialogBodyButtonAccept,#CybotCookiebotDialogBodyLevelButtonLevelOptinAllowallSelection", true);
621
1216
  }
622
- if (await doEval("window.CookieConsent.hasResponse !== true")) {
623
- await doEval("window.Cookiebot.dialog.submitConsent()");
1217
+ if (await this.mainWorldEval("EVAL_COOKIEBOT_1")) {
1218
+ await this.mainWorldEval("EVAL_COOKIEBOT_2");
624
1219
  await wait(500);
625
1220
  }
626
1221
  if (elementExists("#cb-confirmedSettings")) {
627
- await doEval("endCookieProcess()");
1222
+ await this.mainWorldEval("EVAL_COOKIEBOT_3");
628
1223
  }
629
1224
  return true;
630
1225
  }
@@ -638,14 +1233,15 @@
638
1233
  return true;
639
1234
  }
640
1235
  async test() {
641
- return doEval("window.CookieConsent.declined === true");
1236
+ return this.mainWorldEval("EVAL_COOKIEBOT_4");
642
1237
  }
643
1238
  };
644
1239
 
645
1240
  // lib/cmps/sourcepoint-frame.ts
646
1241
  var SourcePoint = class extends AutoConsentCMPBase {
647
1242
  constructor() {
648
- super("Sourcepoint-frame");
1243
+ super(...arguments);
1244
+ this.name = "Sourcepoint-frame";
649
1245
  this.prehideSelectors = ["div[id^='sp_message_container_'],.message-overlay", "#sp_privacy_manager_container"];
650
1246
  this.ccpaNotice = false;
651
1247
  this.ccpaPopup = false;
@@ -754,7 +1350,8 @@
754
1350
  // lib/cmps/consentmanager.ts
755
1351
  var ConsentManager = class extends AutoConsentCMPBase {
756
1352
  constructor() {
757
- super("consentmanager.net");
1353
+ super(...arguments);
1354
+ this.name = "consentmanager.net";
758
1355
  this.prehideSelectors = ["#cmpbox,#cmpbox2"];
759
1356
  this.apiAvailable = false;
760
1357
  }
@@ -768,7 +1365,7 @@
768
1365
  return false;
769
1366
  }
770
1367
  async detectCmp() {
771
- this.apiAvailable = await doEval('window.__cmp && typeof __cmp("getCMPData") === "object"');
1368
+ this.apiAvailable = await this.mainWorldEval("EVAL_CONSENTMANAGER_1");
772
1369
  if (!this.apiAvailable) {
773
1370
  return elementExists("#cmpbox");
774
1371
  } else {
@@ -778,14 +1375,14 @@
778
1375
  async detectPopup() {
779
1376
  if (this.apiAvailable) {
780
1377
  await wait(500);
781
- return await doEval("!__cmp('consentStatus').userChoiceExists");
1378
+ return await this.mainWorldEval("EVAL_CONSENTMANAGER_2");
782
1379
  }
783
1380
  return elementVisible("#cmpbox .cmpmore", "any");
784
1381
  }
785
1382
  async optOut() {
786
1383
  await wait(500);
787
1384
  if (this.apiAvailable) {
788
- return await doEval("__cmp('setConsent', 0)");
1385
+ return await this.mainWorldEval("EVAL_CONSENTMANAGER_3");
789
1386
  }
790
1387
  if (click(".cmpboxbtnno")) {
791
1388
  return true;
@@ -803,278 +1400,25 @@
803
1400
  }
804
1401
  async optIn() {
805
1402
  if (this.apiAvailable) {
806
- return await doEval("__cmp('setConsent', 1)");
1403
+ return await this.mainWorldEval("EVAL_CONSENTMANAGER_4");
807
1404
  }
808
1405
  return click(".cmpboxbtnyes");
809
1406
  }
810
1407
  async test() {
811
1408
  if (this.apiAvailable) {
812
- return await doEval("__cmp('consentStatus').userChoiceExists");
813
- }
814
- }
815
- };
816
-
817
- // lib/cmps/evidon.ts
818
- var Evidon = class extends AutoConsentCMPBase {
819
- constructor() {
820
- super("Evidon");
821
- }
822
- get hasSelfTest() {
823
- return false;
824
- }
825
- get isIntermediate() {
826
- return false;
827
- }
828
- get isCosmetic() {
829
- return false;
830
- }
831
- async detectCmp() {
832
- return elementExists("#_evidon_banner");
833
- }
834
- async detectPopup() {
835
- return elementVisible("#_evidon_banner", "any");
836
- }
837
- async optOut() {
838
- if (click("#_evidon-decline-button")) {
839
- return true;
840
- }
841
- hideElements(getStyleElement(), ["#evidon-prefdiag-overlay", "#evidon-prefdiag-background"]);
842
- click("#_evidon-option-button");
843
- await waitForElement("#evidon-prefdiag-overlay", 5e3);
844
- click("#evidon-prefdiag-decline");
845
- return true;
846
- }
847
- async optIn() {
848
- return click("#_evidon-accept-button");
849
- }
850
- };
851
-
852
- // lib/cmps/onetrust.ts
853
- var Onetrust = class extends AutoConsentCMPBase {
854
- constructor() {
855
- super("Onetrust");
856
- this.prehideSelectors = ["#onetrust-banner-sdk,#onetrust-consent-sdk,.onetrust-pc-dark-filter,.js-consent-banner"];
857
- this.runContext = {
858
- urlPattern: "^(?!.*https://www\\.nba\\.com/)"
859
- };
860
- }
861
- get hasSelfTest() {
862
- return true;
863
- }
864
- get isIntermediate() {
865
- return false;
866
- }
867
- get isCosmetic() {
868
- return false;
869
- }
870
- async detectCmp() {
871
- return elementExists("#onetrust-banner-sdk");
872
- }
873
- async detectPopup() {
874
- return elementVisible("#onetrust-banner-sdk", "all");
875
- }
876
- async optOut() {
877
- if (elementExists("#onetrust-pc-btn-handler")) {
878
- click("#onetrust-pc-btn-handler");
879
- } else {
880
- click(".ot-sdk-show-settings,button.js-cookie-settings");
881
- }
882
- await waitForElement("#onetrust-consent-sdk", 2e3);
883
- await wait(1e3);
884
- click("#onetrust-consent-sdk input.category-switch-handler:checked,.js-editor-toggle-state:checked", true);
885
- await wait(1e3);
886
- await waitForElement(".save-preference-btn-handler,.js-consent-save", 2e3);
887
- click(".save-preference-btn-handler,.js-consent-save");
888
- await waitFor(
889
- () => elementVisible("#onetrust-banner-sdk", "none"),
890
- 10,
891
- 500
892
- );
893
- return true;
894
- }
895
- async optIn() {
896
- return click("#onetrust-accept-btn-handler,.js-accept-cookies");
897
- }
898
- async test() {
899
- return await doEval("window.OnetrustActiveGroups.split(',').filter(s => s.length > 0).length <= 1");
900
- }
901
- };
902
-
903
- // lib/cmps/klaro.ts
904
- var Klaro = class extends AutoConsentCMPBase {
905
- constructor() {
906
- super("Klaro");
907
- this.prehideSelectors = [".klaro"];
908
- this.settingsOpen = false;
909
- }
910
- get hasSelfTest() {
911
- return true;
912
- }
913
- get isIntermediate() {
914
- return false;
915
- }
916
- get isCosmetic() {
917
- return false;
918
- }
919
- async detectCmp() {
920
- if (elementExists(".klaro > .cookie-modal")) {
921
- this.settingsOpen = true;
922
- return true;
923
- }
924
- return elementExists(".klaro > .cookie-notice");
925
- }
926
- async detectPopup() {
927
- return elementVisible(".klaro > .cookie-notice,.klaro > .cookie-modal", "any");
928
- }
929
- async optOut() {
930
- if (click(".klaro .cn-decline")) {
931
- return true;
932
- }
933
- if (!this.settingsOpen) {
934
- click(".klaro .cn-learn-more");
935
- await waitForElement(".klaro > .cookie-modal", 2e3);
936
- this.settingsOpen = true;
937
- }
938
- if (click(".klaro .cn-decline")) {
939
- return true;
940
- }
941
- click(".cm-purpose:not(.cm-toggle-all) > input:not(.half-checked)", true);
942
- return click(".cm-btn-accept");
943
- }
944
- async optIn() {
945
- if (click(".klaro .cm-btn-accept-all")) {
946
- return true;
947
- }
948
- if (this.settingsOpen) {
949
- click(".cm-purpose:not(.cm-toggle-all) > input.half-checked", true);
950
- return click(".cm-btn-accept");
951
- }
952
- return click(".klaro .cookie-notice .cm-btn-success");
953
- }
954
- async test() {
955
- return await doEval("klaro.getManager().config.services.every(c => c.required || !klaro.getManager().consents[c.name])");
956
- }
957
- };
958
-
959
- // lib/cmps/uniconsent.ts
960
- var Uniconsent = class extends AutoConsentCMPBase {
961
- constructor() {
962
- super("Uniconsent");
963
- }
964
- get prehideSelectors() {
965
- return [".unic", ".modal:has(.unic)"];
966
- }
967
- get hasSelfTest() {
968
- return true;
969
- }
970
- get isIntermediate() {
971
- return false;
972
- }
973
- get isCosmetic() {
974
- return false;
975
- }
976
- async detectCmp() {
977
- return elementExists(".unic .unic-box,.unic .unic-bar");
978
- }
979
- async detectPopup() {
980
- return elementVisible(".unic .unic-box,.unic .unic-bar", "any");
981
- }
982
- async optOut() {
983
- await waitForElement(".unic button", 1e3);
984
- document.querySelectorAll(".unic button").forEach((button) => {
985
- const text = button.textContent;
986
- if (text.includes("Manage Options") || text.includes("Optionen verwalten")) {
987
- button.click();
988
- }
989
- });
990
- if (await waitForElement(".unic input[type=checkbox]", 1e3)) {
991
- await waitForElement(".unic button", 1e3);
992
- document.querySelectorAll(".unic input[type=checkbox]").forEach((c) => {
993
- if (c.checked) {
994
- c.click();
995
- }
996
- });
997
- for (const b of document.querySelectorAll(".unic button")) {
998
- const text = b.textContent;
999
- for (const pattern of ["Confirm Choices", "Save Choices", "Auswahl speichern"]) {
1000
- if (text.includes(pattern)) {
1001
- b.click();
1002
- await wait(500);
1003
- return true;
1004
- }
1005
- }
1006
- }
1007
- }
1008
- return false;
1009
- }
1010
- async optIn() {
1011
- return waitForThenClick(".unic #unic-agree");
1012
- }
1013
- async test() {
1014
- await wait(1e3);
1015
- const res = elementExists(".unic .unic-box,.unic .unic-bar");
1016
- return !res;
1017
- }
1018
- };
1019
-
1020
- // lib/cmps/conversant.ts
1021
- var Conversant = class extends AutoConsentCMPBase {
1022
- constructor() {
1023
- super("Conversant");
1024
- this.prehideSelectors = [".cmp-root"];
1025
- }
1026
- get hasSelfTest() {
1027
- return true;
1028
- }
1029
- get isIntermediate() {
1030
- return false;
1031
- }
1032
- get isCosmetic() {
1033
- return false;
1034
- }
1035
- async detectCmp() {
1036
- return elementExists(".cmp-root .cmp-receptacle");
1037
- }
1038
- async detectPopup() {
1039
- return elementVisible(".cmp-root .cmp-receptacle", "any");
1040
- }
1041
- async optOut() {
1042
- if (!await waitForThenClick(".cmp-main-button:not(.cmp-main-button--primary)")) {
1043
- return false;
1044
- }
1045
- if (!await waitForElement(".cmp-view-tab-tabs")) {
1046
- return false;
1047
- }
1048
- await waitForThenClick(".cmp-view-tab-tabs > :first-child");
1049
- await waitForThenClick(".cmp-view-tab-tabs > .cmp-view-tab--active:first-child");
1050
- for (const item of Array.from(document.querySelectorAll(".cmp-accordion-item"))) {
1051
- item.querySelector(".cmp-accordion-item-title").click();
1052
- await waitFor(() => !!item.querySelector(".cmp-accordion-item-content.cmp-active"), 10, 50);
1053
- const content = item.querySelector(".cmp-accordion-item-content.cmp-active");
1054
- content.querySelectorAll(".cmp-toggle-actions .cmp-toggle-deny:not(.cmp-toggle-deny--active)").forEach((e) => e.click());
1055
- content.querySelectorAll(".cmp-toggle-actions .cmp-toggle-checkbox:not(.cmp-toggle-checkbox--active)").forEach((e) => e.click());
1409
+ return await this.mainWorldEval("EVAL_CONSENTMANAGER_5");
1056
1410
  }
1057
- await click(".cmp-main-button:not(.cmp-main-button--primary)");
1058
- return true;
1059
- }
1060
- async optIn() {
1061
- return waitForThenClick(".cmp-main-button.cmp-main-button--primary");
1062
- }
1063
- async test() {
1064
- return document.cookie.includes("cmp-data=0");
1065
1411
  }
1066
1412
  };
1067
-
1068
- // lib/cmps/tiktok.ts
1069
- var Tiktok = class extends AutoConsentCMPBase {
1413
+
1414
+ // lib/cmps/evidon.ts
1415
+ var Evidon = class extends AutoConsentCMPBase {
1070
1416
  constructor() {
1071
- super("tiktok.com");
1072
- this.runContext = {
1073
- urlPattern: "tiktok"
1074
- };
1417
+ super(...arguments);
1418
+ this.name = "Evidon";
1075
1419
  }
1076
1420
  get hasSelfTest() {
1077
- return true;
1421
+ return false;
1078
1422
  }
1079
1423
  get isIntermediate() {
1080
1424
  return false;
@@ -1082,63 +1426,36 @@
1082
1426
  get isCosmetic() {
1083
1427
  return false;
1084
1428
  }
1085
- getShadowRoot() {
1086
- const container = document.querySelector("tiktok-cookie-banner");
1087
- if (!container) {
1088
- return null;
1089
- }
1090
- return container.shadowRoot;
1091
- }
1092
1429
  async detectCmp() {
1093
- return elementExists("tiktok-cookie-banner");
1430
+ return elementExists("#_evidon_banner");
1094
1431
  }
1095
1432
  async detectPopup() {
1096
- const banner = this.getShadowRoot().querySelector(".tiktok-cookie-banner");
1097
- return isElementVisible(banner);
1433
+ return elementVisible("#_evidon_banner", "any");
1098
1434
  }
1099
1435
  async optOut() {
1100
- const declineButton = this.getShadowRoot().querySelector(".button-wrapper button:first-child");
1101
- if (declineButton) {
1102
- enableLogs && console.log("[clicking]", declineButton);
1103
- declineButton.click();
1436
+ if (click("#_evidon-decline-button")) {
1104
1437
  return true;
1105
- } else {
1106
- enableLogs && console.log("no decline button found");
1107
- return false;
1108
1438
  }
1439
+ hideElements(getStyleElement(), ["#evidon-prefdiag-overlay", "#evidon-prefdiag-background"]);
1440
+ click("#_evidon-option-button");
1441
+ await waitForElement("#evidon-prefdiag-overlay", 5e3);
1442
+ click("#evidon-prefdiag-decline");
1443
+ return true;
1109
1444
  }
1110
1445
  async optIn() {
1111
- const acceptButton = this.getShadowRoot().querySelector(".button-wrapper button:last-child");
1112
- if (acceptButton) {
1113
- enableLogs && console.log("[clicking]", acceptButton);
1114
- acceptButton.click();
1115
- return true;
1116
- } else {
1117
- enableLogs && console.log("no accept button found");
1118
- return false;
1119
- }
1120
- }
1121
- async test() {
1122
- const match = document.cookie.match(/cookie-consent=([^;]+)/);
1123
- if (!match) {
1124
- return false;
1125
- }
1126
- const value = JSON.parse(decodeURIComponent(match[1]));
1127
- return Object.values(value).every((x) => typeof x !== "boolean" || x === false);
1446
+ return click("#_evidon-accept-button");
1128
1447
  }
1129
1448
  };
1130
1449
 
1131
- // lib/cmps/airbnb.ts
1132
- var Airbnb = class extends AutoConsentCMPBase {
1450
+ // lib/cmps/onetrust.ts
1451
+ var Onetrust = class extends AutoConsentCMPBase {
1133
1452
  constructor() {
1134
- super("airbnb");
1453
+ super(...arguments);
1454
+ this.name = "Onetrust";
1455
+ this.prehideSelectors = ["#onetrust-banner-sdk,#onetrust-consent-sdk,.onetrust-pc-dark-filter,.js-consent-banner"];
1135
1456
  this.runContext = {
1136
- urlPattern: "^https://(www\\.)?airbnb\\.[^/]+/"
1457
+ urlPattern: "^(?!.*https://www\\.nba\\.com/)"
1137
1458
  };
1138
- this.prehideSelectors = [
1139
- "div[data-testid=main-cookies-banner-container]",
1140
- 'div:has(> div:first-child):has(> div:last-child):has(> section [data-testid="strictly-necessary-cookies"])'
1141
- ];
1142
1459
  }
1143
1460
  get hasSelfTest() {
1144
1461
  return true;
@@ -1150,521 +1467,336 @@
1150
1467
  return false;
1151
1468
  }
1152
1469
  async detectCmp() {
1153
- return elementExists("div[data-testid=main-cookies-banner-container]");
1470
+ return elementExists("#onetrust-banner-sdk");
1154
1471
  }
1155
1472
  async detectPopup() {
1156
- return elementVisible("div[data-testid=main-cookies-banner-container", "any");
1473
+ return elementVisible("#onetrust-banner-sdk", "all");
1157
1474
  }
1158
1475
  async optOut() {
1159
- await waitForThenClick("div[data-testid=main-cookies-banner-container] button._snbhip0");
1160
- let check;
1161
- while (check = document.querySelector("[data-testid=modal-container] button[aria-checked=true]:not([disabled])")) {
1162
- check.click();
1163
- }
1164
- return waitForThenClick("button[data-testid=save-btn]");
1165
- }
1166
- async optIn() {
1167
- return waitForThenClick("div[data-testid=main-cookies-banner-container] button._148dgdpk");
1168
- }
1169
- async test() {
1170
- return await waitFor(
1171
- () => !!document.cookie.match("OptanonAlertBoxClosed"),
1172
- 20,
1173
- 200
1174
- );
1175
- }
1176
- };
1177
-
1178
- // lib/cmps/all.ts
1179
- var rules = [
1180
- new TrustArcTop(),
1181
- new TrustArcFrame(),
1182
- new Cookiebot(),
1183
- new SourcePoint(),
1184
- new ConsentManager(),
1185
- new Evidon(),
1186
- new Onetrust(),
1187
- new Klaro(),
1188
- new Uniconsent(),
1189
- new Conversant(),
1190
- new Tiktok(),
1191
- new Airbnb()
1192
- ];
1193
- function createAutoCMP(config) {
1194
- return new AutoConsentCMP(config);
1195
- }
1196
- var all_default = rules;
1197
-
1198
- // lib/index.ts
1199
- var rules2 = all_default;
1200
-
1201
- // lib/consentomatic/tools.ts
1202
- var Tools = class _Tools {
1203
- static {
1204
- this.base = null;
1205
- }
1206
- static setBase(base) {
1207
- _Tools.base = base;
1208
- }
1209
- static findElement(options, parent = null, multiple = false) {
1210
- let possibleTargets = null;
1211
- if (parent != null) {
1212
- possibleTargets = Array.from(parent.querySelectorAll(options.selector));
1213
- } else {
1214
- if (_Tools.base != null) {
1215
- possibleTargets = Array.from(
1216
- _Tools.base.querySelectorAll(options.selector)
1217
- );
1218
- } else {
1219
- possibleTargets = Array.from(
1220
- document.querySelectorAll(options.selector)
1221
- );
1222
- }
1223
- }
1224
- if (options.textFilter != null) {
1225
- possibleTargets = possibleTargets.filter((possibleTarget) => {
1226
- const textContent = possibleTarget.textContent.toLowerCase();
1227
- if (Array.isArray(options.textFilter)) {
1228
- let foundText = false;
1229
- for (const text of options.textFilter) {
1230
- if (textContent.indexOf(text.toLowerCase()) !== -1) {
1231
- foundText = true;
1232
- break;
1233
- }
1234
- }
1235
- return foundText;
1236
- } else if (options.textFilter != null) {
1237
- return textContent.indexOf(options.textFilter.toLowerCase()) !== -1;
1238
- }
1239
- });
1240
- }
1241
- if (options.styleFilters != null) {
1242
- possibleTargets = possibleTargets.filter((possibleTarget) => {
1243
- const styles = window.getComputedStyle(possibleTarget);
1244
- let keep = true;
1245
- for (const styleFilter of options.styleFilters) {
1246
- const option = styles[styleFilter.option];
1247
- if (styleFilter.negated) {
1248
- keep = keep && option !== styleFilter.value;
1249
- } else {
1250
- keep = keep && option === styleFilter.value;
1251
- }
1252
- }
1253
- return keep;
1254
- });
1255
- }
1256
- if (options.displayFilter != null) {
1257
- possibleTargets = possibleTargets.filter((possibleTarget) => {
1258
- if (options.displayFilter) {
1259
- return possibleTarget.offsetHeight !== 0;
1260
- } else {
1261
- return possibleTarget.offsetHeight === 0;
1262
- }
1263
- });
1264
- }
1265
- if (options.iframeFilter != null) {
1266
- possibleTargets = possibleTargets.filter(() => {
1267
- if (options.iframeFilter) {
1268
- return window.location !== window.parent.location;
1269
- } else {
1270
- return window.location === window.parent.location;
1271
- }
1272
- });
1273
- }
1274
- if (options.childFilter != null) {
1275
- possibleTargets = possibleTargets.filter((possibleTarget) => {
1276
- const oldBase = _Tools.base;
1277
- _Tools.setBase(possibleTarget);
1278
- const childResults = _Tools.find(options.childFilter);
1279
- _Tools.setBase(oldBase);
1280
- return childResults.target != null;
1281
- });
1282
- }
1283
- if (multiple) {
1284
- return possibleTargets;
1285
- } else {
1286
- if (possibleTargets.length > 1) {
1287
- console.warn(
1288
- "Multiple possible targets: ",
1289
- possibleTargets,
1290
- options,
1291
- parent
1292
- );
1293
- }
1294
- return possibleTargets[0];
1295
- }
1296
- }
1297
- static find(options, multiple = false) {
1298
- const results = [];
1299
- if (options.parent != null) {
1300
- const parent = _Tools.findElement(options.parent, null, multiple);
1301
- if (parent != null) {
1302
- if (parent instanceof Array) {
1303
- parent.forEach((p) => {
1304
- const targets = _Tools.findElement(options.target, p, multiple);
1305
- if (targets instanceof Array) {
1306
- targets.forEach((target) => {
1307
- results.push({
1308
- parent: p,
1309
- target
1310
- });
1311
- });
1312
- } else {
1313
- results.push({
1314
- parent: p,
1315
- target: targets
1316
- });
1317
- }
1318
- });
1319
- return results;
1320
- } else {
1321
- const targets = _Tools.findElement(options.target, parent, multiple);
1322
- if (targets instanceof Array) {
1323
- targets.forEach((target) => {
1324
- results.push({
1325
- parent,
1326
- target
1327
- });
1328
- });
1329
- } else {
1330
- results.push({
1331
- parent,
1332
- target: targets
1333
- });
1334
- }
1335
- }
1336
- }
1337
- } else {
1338
- const targets = _Tools.findElement(options.target, null, multiple);
1339
- if (targets instanceof Array) {
1340
- targets.forEach((target) => {
1341
- results.push({
1342
- parent: null,
1343
- target
1344
- });
1345
- });
1346
- } else {
1347
- results.push({
1348
- parent: null,
1349
- target: targets
1350
- });
1351
- }
1352
- }
1353
- if (results.length === 0) {
1354
- results.push({
1355
- parent: null,
1356
- target: null
1357
- });
1358
- }
1359
- if (multiple) {
1360
- return results;
1476
+ if (elementExists("#onetrust-pc-btn-handler")) {
1477
+ click("#onetrust-pc-btn-handler");
1361
1478
  } else {
1362
- if (results.length !== 1) {
1363
- console.warn(
1364
- "Multiple results found, even though multiple false",
1365
- results
1366
- );
1367
- }
1368
- return results[0];
1479
+ click(".ot-sdk-show-settings,button.js-cookie-settings");
1369
1480
  }
1481
+ await waitForElement("#onetrust-consent-sdk", 2e3);
1482
+ await wait(1e3);
1483
+ click("#onetrust-consent-sdk input.category-switch-handler:checked,.js-editor-toggle-state:checked", true);
1484
+ await wait(1e3);
1485
+ await waitForElement(".save-preference-btn-handler,.js-consent-save", 2e3);
1486
+ click(".save-preference-btn-handler,.js-consent-save");
1487
+ await waitFor(
1488
+ () => elementVisible("#onetrust-banner-sdk", "none"),
1489
+ 10,
1490
+ 500
1491
+ );
1492
+ return true;
1370
1493
  }
1371
- };
1372
-
1373
- // lib/consentomatic/index.ts
1374
- function matches(config) {
1375
- const result = Tools.find(config);
1376
- if (config.type === "css") {
1377
- return !!result.target;
1378
- } else if (config.type === "checkbox") {
1379
- return !!result.target && result.target.checked;
1494
+ async optIn() {
1495
+ return click("#onetrust-accept-btn-handler,.js-accept-cookies");
1380
1496
  }
1381
- }
1382
- async function executeAction(config, param) {
1383
- switch (config.type) {
1384
- case "click":
1385
- return clickAction(config);
1386
- case "list":
1387
- return listAction(config, param);
1388
- case "consent":
1389
- return consentAction(config, param);
1390
- case "ifcss":
1391
- return ifCssAction(config, param);
1392
- case "waitcss":
1393
- return waitCssAction(config);
1394
- case "foreach":
1395
- return forEachAction(config, param);
1396
- case "hide":
1397
- return hideAction(config);
1398
- case "slide":
1399
- return slideAction(config);
1400
- case "close":
1401
- return closeAction();
1402
- case "wait":
1403
- return waitAction(config);
1404
- case "eval":
1405
- return evalAction(config);
1406
- default:
1407
- throw "Unknown action type: " + config.type;
1497
+ async test() {
1498
+ return await this.mainWorldEval("EVAL_ONETRUST_1");
1408
1499
  }
1409
- }
1410
- var STEP_TIMEOUT = 0;
1411
- function waitTimeout(timeout) {
1412
- return new Promise((resolve) => {
1413
- setTimeout(() => {
1414
- resolve();
1415
- }, timeout);
1416
- });
1417
- }
1418
- async function clickAction(config) {
1419
- const result = Tools.find(config);
1420
- if (result.target != null) {
1421
- result.target.click();
1500
+ };
1501
+
1502
+ // lib/cmps/klaro.ts
1503
+ var Klaro = class extends AutoConsentCMPBase {
1504
+ constructor() {
1505
+ super(...arguments);
1506
+ this.name = "Klaro";
1507
+ this.prehideSelectors = [".klaro"];
1508
+ this.settingsOpen = false;
1422
1509
  }
1423
- return waitTimeout(STEP_TIMEOUT);
1424
- }
1425
- async function listAction(config, param) {
1426
- for (const action of config.actions) {
1427
- await executeAction(action, param);
1510
+ get hasSelfTest() {
1511
+ return true;
1428
1512
  }
1429
- }
1430
- async function consentAction(config, consentTypes) {
1431
- for (const consentConfig of config.consents) {
1432
- const shouldEnable = consentTypes.indexOf(consentConfig.type) !== -1;
1433
- if (consentConfig.matcher && consentConfig.toggleAction) {
1434
- const isEnabled = matches(consentConfig.matcher);
1435
- if (isEnabled !== shouldEnable) {
1436
- await executeAction(consentConfig.toggleAction);
1437
- }
1438
- } else {
1439
- if (shouldEnable) {
1440
- await executeAction(consentConfig.trueAction);
1441
- } else {
1442
- await executeAction(consentConfig.falseAction);
1443
- }
1444
- }
1513
+ get isIntermediate() {
1514
+ return false;
1445
1515
  }
1446
- }
1447
- async function ifCssAction(config, param) {
1448
- const result = Tools.find(config);
1449
- if (!result.target) {
1450
- if (config.trueAction) {
1451
- await executeAction(config.trueAction, param);
1452
- }
1453
- } else {
1454
- if (config.falseAction) {
1455
- await executeAction(config.falseAction, param);
1456
- }
1516
+ get isCosmetic() {
1517
+ return false;
1457
1518
  }
1458
- }
1459
- async function waitCssAction(config) {
1460
- await new Promise((resolve) => {
1461
- let numRetries = config.retries || 10;
1462
- const waitTime = config.waitTime || 250;
1463
- const checkCss = () => {
1464
- const result = Tools.find(config);
1465
- if (config.negated && result.target || !config.negated && !result.target) {
1466
- if (numRetries > 0) {
1467
- numRetries -= 1;
1468
- setTimeout(checkCss, waitTime);
1469
- } else {
1470
- resolve();
1471
- }
1472
- } else {
1473
- resolve();
1474
- }
1475
- };
1476
- checkCss();
1477
- });
1478
- }
1479
- async function forEachAction(config, param) {
1480
- const results = Tools.find(config, true);
1481
- const oldBase = Tools.base;
1482
- for (const result of results) {
1483
- if (result.target) {
1484
- Tools.setBase(result.target);
1485
- await executeAction(config.action, param);
1519
+ async detectCmp() {
1520
+ if (elementExists(".klaro > .cookie-modal")) {
1521
+ this.settingsOpen = true;
1522
+ return true;
1486
1523
  }
1524
+ return elementExists(".klaro > .cookie-notice");
1487
1525
  }
1488
- Tools.setBase(oldBase);
1489
- }
1490
- async function hideAction(config) {
1491
- const result = Tools.find(config);
1492
- if (result.target) {
1493
- result.target.classList.add("Autoconsent-Hidden");
1526
+ async detectPopup() {
1527
+ return elementVisible(".klaro > .cookie-notice,.klaro > .cookie-modal", "any");
1494
1528
  }
1495
- }
1496
- async function slideAction(config) {
1497
- const result = Tools.find(config);
1498
- const dragResult = Tools.find(config.dragTarget);
1499
- if (result.target) {
1500
- const targetBounds = result.target.getBoundingClientRect();
1501
- const dragTargetBounds = dragResult.target.getBoundingClientRect();
1502
- let yDiff = dragTargetBounds.top - targetBounds.top;
1503
- let xDiff = dragTargetBounds.left - targetBounds.left;
1504
- if (this.config.axis.toLowerCase() === "y") {
1505
- xDiff = 0;
1506
- }
1507
- if (this.config.axis.toLowerCase() === "x") {
1508
- yDiff = 0;
1529
+ async optOut() {
1530
+ if (click(".klaro .cn-decline")) {
1531
+ return true;
1509
1532
  }
1510
- const screenX = window.screenX + targetBounds.left + targetBounds.width / 2;
1511
- const screenY = window.screenY + targetBounds.top + targetBounds.height / 2;
1512
- const clientX = targetBounds.left + targetBounds.width / 2;
1513
- const clientY = targetBounds.top + targetBounds.height / 2;
1514
- const mouseDown = document.createEvent("MouseEvents");
1515
- mouseDown.initMouseEvent(
1516
- "mousedown",
1517
- true,
1518
- true,
1519
- window,
1520
- 0,
1521
- screenX,
1522
- screenY,
1523
- clientX,
1524
- clientY,
1525
- false,
1526
- false,
1527
- false,
1528
- false,
1529
- 0,
1530
- result.target
1531
- );
1532
- const mouseMove = document.createEvent("MouseEvents");
1533
- mouseMove.initMouseEvent(
1534
- "mousemove",
1535
- true,
1536
- true,
1537
- window,
1538
- 0,
1539
- screenX + xDiff,
1540
- screenY + yDiff,
1541
- clientX + xDiff,
1542
- clientY + yDiff,
1543
- false,
1544
- false,
1545
- false,
1546
- false,
1547
- 0,
1548
- result.target
1549
- );
1550
- const mouseUp = document.createEvent("MouseEvents");
1551
- mouseUp.initMouseEvent(
1552
- "mouseup",
1553
- true,
1554
- true,
1555
- window,
1556
- 0,
1557
- screenX + xDiff,
1558
- screenY + yDiff,
1559
- clientX + xDiff,
1560
- clientY + yDiff,
1561
- false,
1562
- false,
1563
- false,
1564
- false,
1565
- 0,
1566
- result.target
1567
- );
1568
- result.target.dispatchEvent(mouseDown);
1569
- await this.waitTimeout(10);
1570
- result.target.dispatchEvent(mouseMove);
1571
- await this.waitTimeout(10);
1572
- result.target.dispatchEvent(mouseUp);
1573
- }
1574
- }
1575
- async function waitAction(config) {
1576
- await waitTimeout(config.waitTime);
1577
- }
1578
- async function closeAction() {
1579
- window.close();
1580
- }
1581
- async function evalAction(config) {
1582
- console.log("eval!", config.code);
1583
- return new Promise((resolve) => {
1584
- try {
1585
- if (config.async) {
1586
- window.eval(config.code);
1587
- setTimeout(() => {
1588
- resolve(window.eval("window.__consentCheckResult"));
1589
- }, config.timeout || 250);
1590
- } else {
1591
- resolve(window.eval(config.code));
1592
- }
1593
- } catch (e) {
1594
- console.warn("eval error", e, config.code);
1595
- resolve(false);
1533
+ if (!this.settingsOpen) {
1534
+ click(".klaro .cn-learn-more");
1535
+ await waitForElement(".klaro > .cookie-modal", 2e3);
1536
+ this.settingsOpen = true;
1596
1537
  }
1597
- });
1598
- }
1538
+ if (click(".klaro .cn-decline")) {
1539
+ return true;
1540
+ }
1541
+ click(".cm-purpose:not(.cm-toggle-all) > input:not(.half-checked)", true);
1542
+ return click(".cm-btn-accept");
1543
+ }
1544
+ async optIn() {
1545
+ if (click(".klaro .cm-btn-accept-all")) {
1546
+ return true;
1547
+ }
1548
+ if (this.settingsOpen) {
1549
+ click(".cm-purpose:not(.cm-toggle-all) > input.half-checked", true);
1550
+ return click(".cm-btn-accept");
1551
+ }
1552
+ return click(".klaro .cookie-notice .cm-btn-success");
1553
+ }
1554
+ async test() {
1555
+ return await this.mainWorldEval("EVAL_KLARO_1");
1556
+ }
1557
+ };
1599
1558
 
1600
- // lib/cmps/consentomatic.ts
1601
- var ConsentOMaticCMP = class {
1602
- constructor(name, config) {
1603
- this.name = name;
1604
- this.config = config;
1605
- this.methods = /* @__PURE__ */ new Map();
1606
- this.runContext = defaultRunContext;
1607
- this.isCosmetic = false;
1608
- config.methods.forEach((methodConfig) => {
1609
- if (methodConfig.action) {
1610
- this.methods.set(methodConfig.name, methodConfig.action);
1611
- }
1612
- });
1613
- this.hasSelfTest = false;
1559
+ // lib/cmps/uniconsent.ts
1560
+ var Uniconsent = class extends AutoConsentCMPBase {
1561
+ constructor() {
1562
+ super(...arguments);
1563
+ this.name = "Uniconsent";
1564
+ }
1565
+ get prehideSelectors() {
1566
+ return [".unic", ".modal:has(.unic)"];
1567
+ }
1568
+ get hasSelfTest() {
1569
+ return true;
1614
1570
  }
1615
1571
  get isIntermediate() {
1616
1572
  return false;
1617
1573
  }
1618
- checkRunContext() {
1619
- return true;
1574
+ get isCosmetic() {
1575
+ return false;
1620
1576
  }
1621
1577
  async detectCmp() {
1622
- const matchResults = this.config.detectors.map(
1623
- (detectorConfig) => matches(detectorConfig.presentMatcher)
1624
- );
1625
- return matchResults.some((r) => !!r);
1578
+ return elementExists(".unic .unic-box,.unic .unic-bar");
1626
1579
  }
1627
1580
  async detectPopup() {
1628
- const matchResults = this.config.detectors.map(
1629
- (detectorConfig) => matches(detectorConfig.showingMatcher)
1630
- );
1631
- return matchResults.some((r) => !!r);
1581
+ return elementVisible(".unic .unic-box,.unic .unic-bar", "any");
1632
1582
  }
1633
- async executeAction(method, param) {
1634
- if (this.methods.has(method)) {
1635
- return executeAction(this.methods.get(method), param);
1583
+ async optOut() {
1584
+ await waitForElement(".unic button", 1e3);
1585
+ document.querySelectorAll(".unic button").forEach((button) => {
1586
+ const text = button.textContent;
1587
+ if (text.includes("Manage Options") || text.includes("Optionen verwalten")) {
1588
+ button.click();
1589
+ }
1590
+ });
1591
+ if (await waitForElement(".unic input[type=checkbox]", 1e3)) {
1592
+ await waitForElement(".unic button", 1e3);
1593
+ document.querySelectorAll(".unic input[type=checkbox]").forEach((c) => {
1594
+ if (c.checked) {
1595
+ c.click();
1596
+ }
1597
+ });
1598
+ for (const b of document.querySelectorAll(".unic button")) {
1599
+ const text = b.textContent;
1600
+ for (const pattern of ["Confirm Choices", "Save Choices", "Auswahl speichern"]) {
1601
+ if (text.includes(pattern)) {
1602
+ b.click();
1603
+ await wait(500);
1604
+ return true;
1605
+ }
1606
+ }
1607
+ }
1636
1608
  }
1609
+ return false;
1610
+ }
1611
+ async optIn() {
1612
+ return waitForThenClick2(".unic #unic-agree");
1613
+ }
1614
+ async test() {
1615
+ await wait(1e3);
1616
+ const res = elementExists(".unic .unic-box,.unic .unic-bar");
1617
+ return !res;
1618
+ }
1619
+ };
1620
+
1621
+ // lib/cmps/conversant.ts
1622
+ var Conversant = class extends AutoConsentCMPBase {
1623
+ constructor() {
1624
+ super(...arguments);
1625
+ this.prehideSelectors = [".cmp-root"];
1626
+ this.name = "Conversant";
1627
+ }
1628
+ get hasSelfTest() {
1637
1629
  return true;
1638
1630
  }
1631
+ get isIntermediate() {
1632
+ return false;
1633
+ }
1634
+ get isCosmetic() {
1635
+ return false;
1636
+ }
1637
+ async detectCmp() {
1638
+ return elementExists(".cmp-root .cmp-receptacle");
1639
+ }
1640
+ async detectPopup() {
1641
+ return elementVisible(".cmp-root .cmp-receptacle", "any");
1642
+ }
1639
1643
  async optOut() {
1640
- await this.executeAction("HIDE_CMP");
1641
- await this.executeAction("OPEN_OPTIONS");
1642
- await this.executeAction("HIDE_CMP");
1643
- await this.executeAction("DO_CONSENT", []);
1644
- await this.executeAction("SAVE_CONSENT");
1644
+ if (!await waitForThenClick2(".cmp-main-button:not(.cmp-main-button--primary)")) {
1645
+ return false;
1646
+ }
1647
+ if (!await waitForElement(".cmp-view-tab-tabs")) {
1648
+ return false;
1649
+ }
1650
+ await waitForThenClick2(".cmp-view-tab-tabs > :first-child");
1651
+ await waitForThenClick2(".cmp-view-tab-tabs > .cmp-view-tab--active:first-child");
1652
+ for (const item of Array.from(document.querySelectorAll(".cmp-accordion-item"))) {
1653
+ item.querySelector(".cmp-accordion-item-title").click();
1654
+ await waitFor(() => !!item.querySelector(".cmp-accordion-item-content.cmp-active"), 10, 50);
1655
+ const content = item.querySelector(".cmp-accordion-item-content.cmp-active");
1656
+ content.querySelectorAll(".cmp-toggle-actions .cmp-toggle-deny:not(.cmp-toggle-deny--active)").forEach((e) => e.click());
1657
+ content.querySelectorAll(".cmp-toggle-actions .cmp-toggle-checkbox:not(.cmp-toggle-checkbox--active)").forEach((e) => e.click());
1658
+ }
1659
+ await click(".cmp-main-button:not(.cmp-main-button--primary)");
1645
1660
  return true;
1646
1661
  }
1647
1662
  async optIn() {
1648
- await this.executeAction("HIDE_CMP");
1649
- await this.executeAction("OPEN_OPTIONS");
1650
- await this.executeAction("HIDE_CMP");
1651
- await this.executeAction("DO_CONSENT", ["D", "A", "B", "E", "F", "X"]);
1652
- await this.executeAction("SAVE_CONSENT");
1653
- return true;
1663
+ return waitForThenClick2(".cmp-main-button.cmp-main-button--primary");
1654
1664
  }
1655
- async openCmp() {
1656
- await this.executeAction("HIDE_CMP");
1657
- await this.executeAction("OPEN_OPTIONS");
1665
+ async test() {
1666
+ return document.cookie.includes("cmp-data=0");
1667
+ }
1668
+ };
1669
+
1670
+ // lib/cmps/tiktok.ts
1671
+ var Tiktok = class extends AutoConsentCMPBase {
1672
+ constructor() {
1673
+ super(...arguments);
1674
+ this.name = "tiktok.com";
1675
+ this.runContext = {
1676
+ urlPattern: "tiktok"
1677
+ };
1678
+ }
1679
+ get hasSelfTest() {
1658
1680
  return true;
1659
1681
  }
1682
+ get isIntermediate() {
1683
+ return false;
1684
+ }
1685
+ get isCosmetic() {
1686
+ return false;
1687
+ }
1688
+ getShadowRoot() {
1689
+ const container = document.querySelector("tiktok-cookie-banner");
1690
+ if (!container) {
1691
+ return null;
1692
+ }
1693
+ return container.shadowRoot;
1694
+ }
1695
+ async detectCmp() {
1696
+ return elementExists("tiktok-cookie-banner");
1697
+ }
1698
+ async detectPopup() {
1699
+ const banner = this.getShadowRoot().querySelector(".tiktok-cookie-banner");
1700
+ return isElementVisible(banner);
1701
+ }
1702
+ async optOut() {
1703
+ const declineButton = this.getShadowRoot().querySelector(".button-wrapper button:first-child");
1704
+ if (declineButton) {
1705
+ enableLogs && console.log("[clicking]", declineButton);
1706
+ declineButton.click();
1707
+ return true;
1708
+ } else {
1709
+ enableLogs && console.log("no decline button found");
1710
+ return false;
1711
+ }
1712
+ }
1713
+ async optIn() {
1714
+ const acceptButton = this.getShadowRoot().querySelector(".button-wrapper button:last-child");
1715
+ if (acceptButton) {
1716
+ enableLogs && console.log("[clicking]", acceptButton);
1717
+ acceptButton.click();
1718
+ return true;
1719
+ } else {
1720
+ enableLogs && console.log("no accept button found");
1721
+ return false;
1722
+ }
1723
+ }
1660
1724
  async test() {
1725
+ const match = document.cookie.match(/cookie-consent=([^;]+)/);
1726
+ if (!match) {
1727
+ return false;
1728
+ }
1729
+ const value = JSON.parse(decodeURIComponent(match[1]));
1730
+ return Object.values(value).every((x) => typeof x !== "boolean" || x === false);
1731
+ }
1732
+ };
1733
+
1734
+ // lib/cmps/airbnb.ts
1735
+ var Airbnb = class extends AutoConsentCMPBase {
1736
+ constructor() {
1737
+ super(...arguments);
1738
+ this.runContext = {
1739
+ urlPattern: "^https://(www\\.)?airbnb\\.[^/]+/"
1740
+ };
1741
+ this.prehideSelectors = [
1742
+ "div[data-testid=main-cookies-banner-container]",
1743
+ 'div:has(> div:first-child):has(> div:last-child):has(> section [data-testid="strictly-necessary-cookies"])'
1744
+ ];
1745
+ }
1746
+ get hasSelfTest() {
1661
1747
  return true;
1662
1748
  }
1749
+ get isIntermediate() {
1750
+ return false;
1751
+ }
1752
+ get isCosmetic() {
1753
+ return false;
1754
+ }
1755
+ async detectCmp() {
1756
+ return elementExists("div[data-testid=main-cookies-banner-container]");
1757
+ }
1758
+ async detectPopup() {
1759
+ return elementVisible("div[data-testid=main-cookies-banner-container", "any");
1760
+ }
1761
+ async optOut() {
1762
+ await waitForThenClick2("div[data-testid=main-cookies-banner-container] button._snbhip0");
1763
+ let check;
1764
+ while (check = document.querySelector("[data-testid=modal-container] button[aria-checked=true]:not([disabled])")) {
1765
+ check.click();
1766
+ }
1767
+ return waitForThenClick2("button[data-testid=save-btn]");
1768
+ }
1769
+ async optIn() {
1770
+ return waitForThenClick2("div[data-testid=main-cookies-banner-container] button._148dgdpk");
1771
+ }
1772
+ async test() {
1773
+ return await waitFor(
1774
+ () => !!document.cookie.match("OptanonAlertBoxClosed"),
1775
+ 20,
1776
+ 200
1777
+ );
1778
+ }
1663
1779
  };
1664
1780
 
1781
+ // lib/cmps/all.ts
1782
+ var dynamicCMPs = [
1783
+ TrustArcTop,
1784
+ TrustArcFrame,
1785
+ Cookiebot,
1786
+ SourcePoint,
1787
+ ConsentManager,
1788
+ Evidon,
1789
+ Onetrust,
1790
+ Klaro,
1791
+ Uniconsent,
1792
+ Conversant,
1793
+ Tiktok,
1794
+ Airbnb
1795
+ ];
1796
+
1665
1797
  // lib/web.ts
1666
- function filterCMPs(rules3, config) {
1667
- return rules3.filter((cmp) => {
1798
+ function filterCMPs(rules, config) {
1799
+ return rules.filter((cmp) => {
1668
1800
  return (!config.disabledCmps || !config.disabledCmps.includes(cmp.name)) && (config.enableCosmeticRules || !cmp.isCosmetic);
1669
1801
  });
1670
1802
  }
@@ -1683,14 +1815,15 @@
1683
1815
  };
1684
1816
  evalState.sendContentMessage = sendContentMessage;
1685
1817
  this.sendContentMessage = sendContentMessage;
1686
- this.rules = [...rules2];
1818
+ this.rules = [];
1687
1819
  enableLogs && console.log("autoconsent init", window.location.href);
1688
1820
  this.updateState({ lifecycle: "loading" });
1821
+ this.addDynamicRules();
1689
1822
  if (config) {
1690
1823
  this.initialize(config, declarativeRules);
1691
1824
  } else {
1692
1825
  if (declarativeRules) {
1693
- this.parseRules(declarativeRules);
1826
+ this.parseDeclarativeRules(declarativeRules);
1694
1827
  }
1695
1828
  const initMsg = {
1696
1829
  type: "init",
@@ -1707,7 +1840,7 @@
1707
1840
  return;
1708
1841
  }
1709
1842
  if (declarativeRules) {
1710
- this.parseRules(declarativeRules);
1843
+ this.parseDeclarativeRules(declarativeRules);
1711
1844
  }
1712
1845
  this.rules = filterCMPs(this.rules, config);
1713
1846
  if (config.enablePrehide) {
@@ -1732,17 +1865,22 @@
1732
1865
  }
1733
1866
  this.updateState({ lifecycle: "initialized" });
1734
1867
  }
1735
- parseRules(declarativeRules) {
1868
+ addDynamicRules() {
1869
+ dynamicCMPs.forEach((cmp) => {
1870
+ this.rules.push(new cmp(this));
1871
+ });
1872
+ }
1873
+ parseDeclarativeRules(declarativeRules) {
1736
1874
  Object.keys(declarativeRules.consentomatic).forEach((name) => {
1737
1875
  this.addConsentomaticCMP(name, declarativeRules.consentomatic[name]);
1738
1876
  });
1739
- declarativeRules.autoconsent.forEach((rule) => {
1740
- this.addCMP(rule);
1877
+ declarativeRules.autoconsent.forEach((ruleset) => {
1878
+ this.addDeclarativeCMP(ruleset);
1741
1879
  });
1742
1880
  enableLogs && console.log("added rules", this.rules);
1743
1881
  }
1744
- addCMP(config) {
1745
- this.rules.push(createAutoCMP(config));
1882
+ addDeclarativeCMP(ruleset) {
1883
+ this.rules.push(new AutoConsentCMP(ruleset, this));
1746
1884
  }
1747
1885
  addConsentomaticCMP(name, config) {
1748
1886
  this.rules.push(new ConsentOMaticCMP(`com_${name}`, config));
@@ -1842,7 +1980,10 @@
1842
1980
  });
1843
1981
  result.push(cmp);
1844
1982
  }
1845
- }).catch(() => null));
1983
+ }).catch((e) => {
1984
+ enableLogs && console.warn(`error waiting for a popup for ${cmp.name}`, e);
1985
+ return null;
1986
+ }));
1846
1987
  await Promise.all(popupLookups);
1847
1988
  return result;
1848
1989
  }
@@ -1935,7 +2076,10 @@
1935
2076
  }
1936
2077
  async waitForPopup(cmp, retries = 5, interval = 500) {
1937
2078
  enableLogs && console.log("checking if popup is open...", cmp.name);
1938
- const isOpen = await cmp.detectPopup();
2079
+ const isOpen = await cmp.detectPopup().catch((e) => {
2080
+ enableLogs && console.warn(`error detecting popup for ${cmp.name}`, e);
2081
+ return false;
2082
+ });
1939
2083
  if (!isOpen && retries > 0) {
1940
2084
  await wait(interval);
1941
2085
  return this.waitForPopup(cmp, retries - 1, interval);