@duckduckgo/autoconsent 4.1.1 → 4.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,43 @@
1
+ # v4.1.3 (Tue Feb 14 2023)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - Reduce triggering of coinbase and theverge rules [#101](https://github.com/duckduckgo/autoconsent/pull/101) ([@sammacbeth](https://github.com/sammacbeth))
6
+
7
+ #### 🔩 Dependency Updates
8
+
9
+ - Bump tslib from 2.4.1 to 2.5.0 [#97](https://github.com/duckduckgo/autoconsent/pull/97) ([@dependabot[bot]](https://github.com/dependabot[bot]))
10
+ - Bump auto from 10.37.6 to 10.42.0 [#98](https://github.com/duckduckgo/autoconsent/pull/98) ([@dependabot[bot]](https://github.com/dependabot[bot]))
11
+ - Bump eslint from 8.31.0 to 8.34.0 [#100](https://github.com/duckduckgo/autoconsent/pull/100) ([@dependabot[bot]](https://github.com/dependabot[bot]))
12
+
13
+ #### Authors: 2
14
+
15
+ - [@dependabot[bot]](https://github.com/dependabot[bot])
16
+ - Sam Macbeth ([@sammacbeth](https://github.com/sammacbeth))
17
+
18
+ ---
19
+
20
+ # v4.1.2 (Thu Feb 09 2023)
21
+
22
+ #### 🐛 Bug Fix
23
+
24
+ - New rules [#95](https://github.com/duckduckgo/autoconsent/pull/95) ([@sammacbeth](https://github.com/sammacbeth))
25
+
26
+ #### 🔩 Dependency Updates
27
+
28
+ - Bump mocha from 10.1.0 to 10.2.0 [#64](https://github.com/duckduckgo/autoconsent/pull/64) ([@dependabot[bot]](https://github.com/dependabot[bot]))
29
+ - Bump @playwright/test from 1.24.2 to 1.30.0 [#92](https://github.com/duckduckgo/autoconsent/pull/92) ([@dependabot[bot]](https://github.com/dependabot[bot]))
30
+ - Bump typescript from 4.8.4 to 4.9.5 [#93](https://github.com/duckduckgo/autoconsent/pull/93) ([@dependabot[bot]](https://github.com/dependabot[bot]))
31
+ - Bump @rollup/plugin-typescript from 10.0.1 to 11.0.0 [#89](https://github.com/duckduckgo/autoconsent/pull/89) ([@dependabot[bot]](https://github.com/dependabot[bot]))
32
+ - Bump @typescript-eslint/parser from 5.46.1 to 5.51.0 [#94](https://github.com/duckduckgo/autoconsent/pull/94) ([@dependabot[bot]](https://github.com/dependabot[bot]))
33
+
34
+ #### Authors: 2
35
+
36
+ - [@dependabot[bot]](https://github.com/dependabot[bot])
37
+ - Sam Macbeth ([@sammacbeth](https://github.com/sammacbeth))
38
+
39
+ ---
40
+
1
41
  # v4.1.1 (Tue Jan 24 2023)
2
42
 
3
43
  #### 🐛 Bug Fix
@@ -718,11 +718,6 @@
718
718
  // Note: JS API is also available:
719
719
  // https://help.consentmanager.net/books/cmp/page/javascript-api
720
720
  class ConsentManager extends AutoConsentCMPBase {
721
- constructor() {
722
- super("consentmanager.net");
723
- this.prehideSelectors = ["#cmpbox,#cmpbox2"];
724
- this.apiAvailable = false;
725
- }
726
721
  get hasSelfTest() {
727
722
  return this.apiAvailable;
728
723
  }
@@ -732,6 +727,11 @@
732
727
  get isCosmetic() {
733
728
  return false;
734
729
  }
730
+ constructor() {
731
+ super("consentmanager.net");
732
+ this.prehideSelectors = ["#cmpbox,#cmpbox2"];
733
+ this.apiAvailable = false;
734
+ }
735
735
  async detectCmp() {
736
736
  this.apiAvailable = await doEval('window.__cmp && typeof __cmp("getCMPData") === "object"');
737
737
  if (!this.apiAvailable) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 2,
3
3
  "name": "Autoconsent",
4
- "version": "2023.1.17",
4
+ "version": "2023.2.9",
5
5
  "background": {
6
6
  "scripts": [
7
7
  "background.bundle.js"
@@ -493,6 +493,93 @@
493
493
  }
494
494
  ]
495
495
  },
496
+ {
497
+ "name": "clinch",
498
+ "intermediate": false,
499
+ "runContext": {
500
+ "frame": false,
501
+ "main": true
502
+ },
503
+ "prehideSelectors": [
504
+ ".consent-modal[role=dialog]"
505
+ ],
506
+ "detectCmp": [
507
+ {
508
+ "exists": ".consent-modal[role=dialog]"
509
+ }
510
+ ],
511
+ "detectPopup": [
512
+ {
513
+ "visible": ".consent-modal[role=dialog]"
514
+ }
515
+ ],
516
+ "optIn": [
517
+ {
518
+ "click": "#consent_agree"
519
+ }
520
+ ],
521
+ "optOut": [
522
+ {
523
+ "click": "#manage_cookie_preferences"
524
+ },
525
+ {
526
+ "click": "#cookie_consent_preferences input:checked",
527
+ "all": true,
528
+ "optional": true
529
+ },
530
+ {
531
+ "click": "#consent_save"
532
+ }
533
+ ],
534
+ "test": [
535
+ {
536
+ "eval": "document.cookie.includes('ctc_rejected=1')"
537
+ }
538
+ ]
539
+ },
540
+ {
541
+ "name": "coinbase",
542
+ "intermediate": false,
543
+ "runContext": {
544
+ "frame": true,
545
+ "main": true,
546
+ "urlPattern": "^https://(www|help)\\.coinbase\\.com"
547
+ },
548
+ "prehideSelectors": [],
549
+ "detectCmp": [
550
+ {
551
+ "exists": "div[class^=CookieBannerContent__Container]"
552
+ }
553
+ ],
554
+ "detectPopup": [
555
+ {
556
+ "visible": "div[class^=CookieBannerContent__Container]"
557
+ }
558
+ ],
559
+ "optIn": [
560
+ {
561
+ "click": "div[class^=CookieBannerContent__CTA] :nth-last-child(1)"
562
+ }
563
+ ],
564
+ "optOut": [
565
+ {
566
+ "click": "button[class^=CookieBannerContent__Settings]"
567
+ },
568
+ {
569
+ "click": "div[class^=CookiePreferencesModal__CategoryContainer] input:checked",
570
+ "all": true,
571
+ "optional": true
572
+ },
573
+ {
574
+ "click": "div[class^=CookiePreferencesModal__ButtonContainer] > button"
575
+ }
576
+ ],
577
+ "test": [
578
+ {
579
+ "eval": "JSON.parse(decodeURIComponent(document.cookie.match(/cm_(eu|default)_preferences=([0-9a-zA-Z\\{\\}\\[\\]%:]*);?/)[2])).consent.length <= 1"
580
+ }
581
+ ]
582
+ },
496
583
  {
497
584
  "name": "Complianz banner",
498
585
  "prehideSelectors": [
@@ -1612,6 +1699,55 @@
1612
1699
  }
1613
1700
  ]
1614
1701
  },
1702
+ {
1703
+ "name": "ketch",
1704
+ "runContext": {
1705
+ "frame": false,
1706
+ "main": true
1707
+ },
1708
+ "intermediate": false,
1709
+ "prehideSelectors": [
1710
+ "#lanyard_root div[role='dialog']"
1711
+ ],
1712
+ "detectCmp": [
1713
+ {
1714
+ "exists": "#lanyard_root div[role='dialog']"
1715
+ }
1716
+ ],
1717
+ "detectPopup": [
1718
+ {
1719
+ "visible": "#lanyard_root div[role='dialog']"
1720
+ }
1721
+ ],
1722
+ "optIn": [
1723
+ {
1724
+ "click": "#lanyard_root button[class^='link']",
1725
+ "optional": true
1726
+ },
1727
+ {
1728
+ "wait": 500
1729
+ },
1730
+ {
1731
+ "waitForThenClick": "div[class^='buttons'] > :nth-child(2)"
1732
+ },
1733
+ {
1734
+ "click": "#lanyard_root button[class*='confirmButton']"
1735
+ }
1736
+ ],
1737
+ "optOut": [
1738
+ {
1739
+ "click": "#lanyard_root button[class^='link']",
1740
+ "optional": true
1741
+ },
1742
+ {
1743
+ "waitForThenClick": "#lanyard_root button[class*='rejectButton']"
1744
+ },
1745
+ {
1746
+ "click": "#lanyard_root button[class*='confirmButton']"
1747
+ }
1748
+ ],
1749
+ "test": []
1750
+ },
1615
1751
  {
1616
1752
  "name": "linkedin.com",
1617
1753
  "prehideSelectors": [
@@ -2816,6 +2952,44 @@
2816
2952
  }
2817
2953
  ]
2818
2954
  },
2955
+ {
2956
+ "name": "theverge",
2957
+ "runContext": {
2958
+ "frame": false,
2959
+ "main": true,
2960
+ "urlPattern": "^https://(www)?\\.theverge\\.com"
2961
+ },
2962
+ "intermediate": false,
2963
+ "prehideSelectors": [
2964
+ ".duet--cta--cookie-banner"
2965
+ ],
2966
+ "detectCmp": [
2967
+ {
2968
+ "exists": ".duet--cta--cookie-banner"
2969
+ }
2970
+ ],
2971
+ "detectPopup": [
2972
+ {
2973
+ "visible": ".duet--cta--cookie-banner"
2974
+ }
2975
+ ],
2976
+ "optIn": [
2977
+ {
2978
+ "click": ".duet--cta--cookie-banner button.tracking-12",
2979
+ "all": false
2980
+ }
2981
+ ],
2982
+ "optOut": [
2983
+ {
2984
+ "click": ".duet--cta--cookie-banner button.tracking-12 > span"
2985
+ }
2986
+ ],
2987
+ "test": [
2988
+ {
2989
+ "eval": "document.cookie.includes('_duet_gdpr_acknowledged=1')"
2990
+ }
2991
+ ]
2992
+ },
2819
2993
  {
2820
2994
  "name": "twitter",
2821
2995
  "runContext": {
@@ -718,11 +718,6 @@
718
718
  // Note: JS API is also available:
719
719
  // https://help.consentmanager.net/books/cmp/page/javascript-api
720
720
  class ConsentManager extends AutoConsentCMPBase {
721
- constructor() {
722
- super("consentmanager.net");
723
- this.prehideSelectors = ["#cmpbox,#cmpbox2"];
724
- this.apiAvailable = false;
725
- }
726
721
  get hasSelfTest() {
727
722
  return this.apiAvailable;
728
723
  }
@@ -732,6 +727,11 @@
732
727
  get isCosmetic() {
733
728
  return false;
734
729
  }
730
+ constructor() {
731
+ super("consentmanager.net");
732
+ this.prehideSelectors = ["#cmpbox,#cmpbox2"];
733
+ this.apiAvailable = false;
734
+ }
735
735
  async detectCmp() {
736
736
  this.apiAvailable = await doEval('window.__cmp && typeof __cmp("getCMPData") === "object"');
737
737
  if (!this.apiAvailable) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "Autoconsent",
4
- "version": "2023.1.17",
4
+ "version": "2023.2.9",
5
5
  "background": {
6
6
  "service_worker": "background.bundle.js"
7
7
  },
@@ -493,6 +493,93 @@
493
493
  }
494
494
  ]
495
495
  },
496
+ {
497
+ "name": "clinch",
498
+ "intermediate": false,
499
+ "runContext": {
500
+ "frame": false,
501
+ "main": true
502
+ },
503
+ "prehideSelectors": [
504
+ ".consent-modal[role=dialog]"
505
+ ],
506
+ "detectCmp": [
507
+ {
508
+ "exists": ".consent-modal[role=dialog]"
509
+ }
510
+ ],
511
+ "detectPopup": [
512
+ {
513
+ "visible": ".consent-modal[role=dialog]"
514
+ }
515
+ ],
516
+ "optIn": [
517
+ {
518
+ "click": "#consent_agree"
519
+ }
520
+ ],
521
+ "optOut": [
522
+ {
523
+ "click": "#manage_cookie_preferences"
524
+ },
525
+ {
526
+ "click": "#cookie_consent_preferences input:checked",
527
+ "all": true,
528
+ "optional": true
529
+ },
530
+ {
531
+ "click": "#consent_save"
532
+ }
533
+ ],
534
+ "test": [
535
+ {
536
+ "eval": "document.cookie.includes('ctc_rejected=1')"
537
+ }
538
+ ]
539
+ },
540
+ {
541
+ "name": "coinbase",
542
+ "intermediate": false,
543
+ "runContext": {
544
+ "frame": true,
545
+ "main": true,
546
+ "urlPattern": "^https://(www|help)\\.coinbase\\.com"
547
+ },
548
+ "prehideSelectors": [],
549
+ "detectCmp": [
550
+ {
551
+ "exists": "div[class^=CookieBannerContent__Container]"
552
+ }
553
+ ],
554
+ "detectPopup": [
555
+ {
556
+ "visible": "div[class^=CookieBannerContent__Container]"
557
+ }
558
+ ],
559
+ "optIn": [
560
+ {
561
+ "click": "div[class^=CookieBannerContent__CTA] :nth-last-child(1)"
562
+ }
563
+ ],
564
+ "optOut": [
565
+ {
566
+ "click": "button[class^=CookieBannerContent__Settings]"
567
+ },
568
+ {
569
+ "click": "div[class^=CookiePreferencesModal__CategoryContainer] input:checked",
570
+ "all": true,
571
+ "optional": true
572
+ },
573
+ {
574
+ "click": "div[class^=CookiePreferencesModal__ButtonContainer] > button"
575
+ }
576
+ ],
577
+ "test": [
578
+ {
579
+ "eval": "JSON.parse(decodeURIComponent(document.cookie.match(/cm_(eu|default)_preferences=([0-9a-zA-Z\\{\\}\\[\\]%:]*);?/)[2])).consent.length <= 1"
580
+ }
581
+ ]
582
+ },
496
583
  {
497
584
  "name": "Complianz banner",
498
585
  "prehideSelectors": [
@@ -1612,6 +1699,55 @@
1612
1699
  }
1613
1700
  ]
1614
1701
  },
1702
+ {
1703
+ "name": "ketch",
1704
+ "runContext": {
1705
+ "frame": false,
1706
+ "main": true
1707
+ },
1708
+ "intermediate": false,
1709
+ "prehideSelectors": [
1710
+ "#lanyard_root div[role='dialog']"
1711
+ ],
1712
+ "detectCmp": [
1713
+ {
1714
+ "exists": "#lanyard_root div[role='dialog']"
1715
+ }
1716
+ ],
1717
+ "detectPopup": [
1718
+ {
1719
+ "visible": "#lanyard_root div[role='dialog']"
1720
+ }
1721
+ ],
1722
+ "optIn": [
1723
+ {
1724
+ "click": "#lanyard_root button[class^='link']",
1725
+ "optional": true
1726
+ },
1727
+ {
1728
+ "wait": 500
1729
+ },
1730
+ {
1731
+ "waitForThenClick": "div[class^='buttons'] > :nth-child(2)"
1732
+ },
1733
+ {
1734
+ "click": "#lanyard_root button[class*='confirmButton']"
1735
+ }
1736
+ ],
1737
+ "optOut": [
1738
+ {
1739
+ "click": "#lanyard_root button[class^='link']",
1740
+ "optional": true
1741
+ },
1742
+ {
1743
+ "waitForThenClick": "#lanyard_root button[class*='rejectButton']"
1744
+ },
1745
+ {
1746
+ "click": "#lanyard_root button[class*='confirmButton']"
1747
+ }
1748
+ ],
1749
+ "test": []
1750
+ },
1615
1751
  {
1616
1752
  "name": "linkedin.com",
1617
1753
  "prehideSelectors": [
@@ -2816,6 +2952,44 @@
2816
2952
  }
2817
2953
  ]
2818
2954
  },
2955
+ {
2956
+ "name": "theverge",
2957
+ "runContext": {
2958
+ "frame": false,
2959
+ "main": true,
2960
+ "urlPattern": "^https://(www)?\\.theverge\\.com"
2961
+ },
2962
+ "intermediate": false,
2963
+ "prehideSelectors": [
2964
+ ".duet--cta--cookie-banner"
2965
+ ],
2966
+ "detectCmp": [
2967
+ {
2968
+ "exists": ".duet--cta--cookie-banner"
2969
+ }
2970
+ ],
2971
+ "detectPopup": [
2972
+ {
2973
+ "visible": ".duet--cta--cookie-banner"
2974
+ }
2975
+ ],
2976
+ "optIn": [
2977
+ {
2978
+ "click": ".duet--cta--cookie-banner button.tracking-12",
2979
+ "all": false
2980
+ }
2981
+ ],
2982
+ "optOut": [
2983
+ {
2984
+ "click": ".duet--cta--cookie-banner button.tracking-12 > span"
2985
+ }
2986
+ ],
2987
+ "test": [
2988
+ {
2989
+ "eval": "document.cookie.includes('_duet_gdpr_acknowledged=1')"
2990
+ }
2991
+ ]
2992
+ },
2819
2993
  {
2820
2994
  "name": "twitter",
2821
2995
  "runContext": {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});function t(){return crypto&&void 0!==crypto.randomUUID?crypto.randomUUID():Math.random().toString()}class e{constructor(t,e=1e3){this.id=t,this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),this.timer=window.setTimeout((()=>{this.reject(new Error("timeout"))}),e)}}const n={pending:new Map,sendContentMessage:null};function o(t="autoconsent-css-rules"){const e=`style#${t}`,n=document.querySelector(e);if(n&&n instanceof HTMLStyleElement)return n;{const e=document.head||document.getElementsByTagName("head")[0]||document.documentElement,n=document.createElement("style");return n.id=t,e.appendChild(n),n}}function i(t,e,n="display"){const o="opacity"===n?"opacity: 0":"display: none",i=`${e.join(",")} { ${o} !important; z-index: -1 !important; pointer-events: none !important; } `;return t instanceof HTMLStyleElement&&(t.innerText+=i,e.length>0)}async function s(t,e,n){const o=await t();return!o&&e>0?new Promise((o=>{setTimeout((async()=>{o(s(t,e-1,n))}),n)})):Promise.resolve(o)}function r(t){if(!t)return!1;if(null!==t.offsetParent)return!0;{const e=window.getComputedStyle(t);if("fixed"===e.position&&"none"!==e.display)return!0}return!1}function c(o){return function(o){const i=t();n.sendContentMessage({type:"eval",id:i,code:o});const s=new e(i);return n.pending.set(s.id,s),s.promise}(o).catch((t=>!1))}function a(t,e=!1){let n=[];return n="string"==typeof t?Array.from(document.querySelectorAll(t)):t,n.length>0&&(e?n.forEach((t=>t.click())):n[0].click()),n.length>0}function u(t){return null!==document.querySelector(t)}function l(t,e){const n=document.querySelectorAll(t),o=new Array(n.length);return n.forEach(((t,e)=>{o[e]=r(t)})),"none"===e?o.every((t=>!t)):0!==o.length&&("any"===e?o.some((t=>t)):o.every((t=>t)))}function p(t,e=1e4){return s((()=>null!==document.querySelector(t)),Math.ceil(e/200),200)}async function d(t,e=1e4,n=!1){return await p(t,e),a(t,n)}function h(t){return new Promise((e=>{setTimeout((()=>{e(!0)}),t)}))}const m={main:!0,frame:!1,urlPattern:""};class f{constructor(t){this.runContext=m,this.name=t}get hasSelfTest(){throw new Error("Not Implemented")}get isIntermediate(){throw new Error("Not Implemented")}get isCosmetic(){throw new Error("Not Implemented")}checkRunContext(){const t={...m,...this.runContext},e=window.top===window;return!(e&&!t.main)&&(!(!e&&!t.frame)&&!(t.urlPattern&&!window.location.href.match(t.urlPattern)))}detectCmp(){throw new Error("Not Implemented")}async detectPopup(){return!1}optOut(){throw new Error("Not Implemented")}optIn(){throw new Error("Not Implemented")}openCmp(){throw new Error("Not Implemented")}async test(){return Promise.resolve(!0)}}async function y(t){const e=[];if(t.exists&&e.push(u(t.exists)),t.visible&&e.push(l(t.visible,t.check)),t.eval){const n=c(t.eval);e.push(n)}var n,r;if(t.waitFor&&e.push(p(t.waitFor,t.timeout)),t.waitForVisible&&e.push(function(t,e=1e4,n="any"){return s((()=>l(t,n)),Math.ceil(e/200),200)}(t.waitForVisible,t.timeout,t.check)),t.click&&e.push(a(t.click,t.all)),t.waitForThenClick&&e.push(d(t.waitForThenClick,t.timeout,t.all)),t.wait&&e.push(h(t.wait)),t.hide&&e.push((n=t.hide,r=t.method,i(o(),n,r))),t.if){if(!t.if.exists&&!t.if.visible)return console.error("invalid conditional rule",t.if),!1;await y(t.if)?e.push(w(t.then)):t.else&&e.push(w(t.else))}if(0===e.length)return!1;return(await Promise.all(e)).reduce(((t,e)=>t&&e),!0)}async function w(t){for(const e of t){if(!await y(e)&&!e.optional)return!1}return!0}class g extends f{constructor(t){super(t.name),this.config=t,this.runContext=t.runContext||m}get hasSelfTest(){return!!this.config.test}get isIntermediate(){return!!this.config.intermediate}get isCosmetic(){return!!this.config.cosmetic}get prehideSelectors(){return this.config.prehideSelectors}async detectCmp(){return!!this.config.detectCmp&&async function(t){const e=t.map((t=>y(t)));return(await Promise.all(e)).every((t=>!!t))}(this.config.detectCmp)}async detectPopup(){return!!this.config.detectPopup&&w(this.config.detectPopup)}async optOut(){return!!this.config.optOut&&w(this.config.optOut)}async optIn(){return!!this.config.optIn&&w(this.config.optIn)}async openCmp(){return!!this.config.openCmp&&w(this.config.openCmp)}async test(){return this.hasSelfTest?w(this.config.test):super.test()}}function C(t){return new g(t)}const b=[new class extends f{constructor(){super("TrustArc-top"),this.prehideSelectors=[".trustarc-banner-container",".truste_popframe,.truste_overlay,.truste_box_overlay,#truste-consent-track"],this.runContext={main:!0,frame:!1},this._shortcutButton=null,this._optInDone=!1}get hasSelfTest(){return!1}get isIntermediate(){return!this._optInDone&&!this._shortcutButton}get isCosmetic(){return!1}async detectCmp(){const t=u("#truste-show-consent,#truste-consent-track");return t&&(this._shortcutButton=document.querySelector("#truste-consent-required")),t}async detectPopup(){return l("#truste-consent-content,#trustarc-banner-overlay,#truste-consent-track","all")}openFrame(){a("#truste-show-consent")}async optOut(){return this._shortcutButton?(this._shortcutButton.click(),!0):(i(o(),[".truste_popframe",".truste_overlay",".truste_box_overlay","#truste-consent-track"]),a("#truste-show-consent"),setTimeout((()=>{o().remove()}),1e4),!0)}async optIn(){return this._optInDone=!0,a("#truste-consent-button")}async openCmp(){return!0}async test(){return!0}},new class extends f{constructor(){super("TrustArc-frame"),this.runContext={main:!1,frame:!0,urlPattern:"^https://consent-pref\\.trustarc\\.com/\\?"}}get hasSelfTest(){return!1}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return!0}async detectPopup(){return l("#defaultpreferencemanager","any")&&l(".mainContent","any")}async navigateToSettings(){return await s((async()=>u(".shp")||l(".advance","any")||u(".switch span:first-child")),10,500),u(".shp")&&a(".shp"),await p(".prefPanel",5e3),l(".advance","any")&&a(".advance"),await s((()=>l(".switch span:first-child","any")),5,1e3)}async optOut(){return await s((()=>"complete"===document.readyState),20,100),await p(".mainContent[aria-hidden=false]",5e3),!!a(".rejectAll")||(u(".prefPanel")&&await p('.prefPanel[style="visibility: visible;"]',3e3),a("#catDetails0")?(a(".submit"),!0):(a(".required")||(await this.navigateToSettings(),a(".switch span:nth-child(1):not(.active)",!0),a(".submit"),p("#gwt-debug-close_id",3e5).then((()=>{a("#gwt-debug-close_id")}))),!0))}async optIn(){return a(".call")||(await this.navigateToSettings(),a(".switch span:nth-child(2)",!0),a(".submit"),p("#gwt-debug-close_id",3e5).then((()=>{a("#gwt-debug-close_id")}))),!0}},new class extends f{constructor(){super("Cybotcookiebot"),this.prehideSelectors=["#CybotCookiebotDialog,#dtcookie-container,#cookiebanner,#cb-cookieoverlay"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return u("#CybotCookiebotDialogBodyLevelButtonPreferences")}async detectPopup(){return u("#CybotCookiebotDialog,#dtcookie-container,#cookiebanner,#cb-cookiebanner")}async optOut(){return a(".cookie-alert-extended-detail-link")?(await p(".cookie-alert-configuration",2e3),a(".cookie-alert-configuration-input:checked",!0),a(".cookie-alert-extended-button-secondary"),!0):u("#dtcookie-container")?a(".h-dtcookie-decline"):(a(".cookiebot__button--settings")||a("#CybotCookiebotDialogBodyButtonDecline")||(a(".cookiebanner__link--details"),a('.CybotCookiebotDialogBodyLevelButton:checked:enabled,input[id*="CybotCookiebotDialogBodyLevelButton"]:checked:enabled',!0),a("#CybotCookiebotDialogBodyButtonDecline"),a("input[id^=CybotCookiebotDialogBodyLevelButton]:checked",!0),u("#CybotCookiebotDialogBodyButtonAcceptSelected")?a("#CybotCookiebotDialogBodyButtonAcceptSelected"):a("#CybotCookiebotDialogBodyLevelButtonAccept,#CybotCookiebotDialogBodyButtonAccept,#CybotCookiebotDialogBodyLevelButtonLevelOptinAllowallSelection",!0),await c("window.CookieConsent.hasResponse !== true")&&(await c("window.Cookiebot.dialog.submitConsent()"),await h(500)),u("#cb-confirmedSettings")&&await c("endCookieProcess()")),!0)}async optIn(){return u("#dtcookie-container")?a(".h-dtcookie-accept"):(a(".CybotCookiebotDialogBodyLevelButton:not(:checked):enabled",!0),a("#CybotCookiebotDialogBodyLevelButtonAccept"),a("#CybotCookiebotDialogBodyButtonAccept"),!0)}async test(){return c("window.CookieConsent.declined === true")}},new class extends f{constructor(){super("Sourcepoint-frame"),this.prehideSelectors=["div[id^='sp_message_container_'],.message-overlay","#sp_privacy_manager_container"],this.ccpaNotice=!1,this.ccpaPopup=!1,this.runContext={main:!1,frame:!0}}get hasSelfTest(){return!1}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){const t=new URL(location.href);return t.searchParams.has("message_id")&&"ccpa-notice.sp-prod.net"===t.hostname?(this.ccpaNotice=!0,!0):"ccpa-pm.sp-prod.net"===t.hostname?(this.ccpaPopup=!0,!0):("/index.html"===t.pathname||"/privacy-manager/index.html"===t.pathname)&&(t.searchParams.has("message_id")||t.searchParams.has("requestUUID")||t.searchParams.has("consentUUID"))}async detectPopup(){return!!this.ccpaNotice||(this.ccpaPopup?await p(".priv-save-btn",2e3):(await p(".sp_choice_type_11,.sp_choice_type_12,.sp_choice_type_13,.sp_choice_type_ACCEPT_ALL",2e3),!u(".sp_choice_type_9")))}async optIn(){return await p(".sp_choice_type_11,.sp_choice_type_ACCEPT_ALL",2e3),!!a(".sp_choice_type_11")||!!a(".sp_choice_type_ACCEPT_ALL")}isManagerOpen(){return"/privacy-manager/index.html"===location.pathname}async optOut(){if(this.ccpaPopup){const t=document.querySelectorAll(".priv-purpose-container .sp-switch-arrow-block a.neutral.on .right");for(const e of t)a([e]);const e=document.querySelectorAll(".priv-purpose-container .sp-switch-arrow-block a.switch-bg.on");for(const t of e)a([t]);return a(".priv-save-btn")}if(!this.isManagerOpen()){if(!await p(".sp_choice_type_12,.sp_choice_type_13"))return!1;if(!u(".sp_choice_type_12"))return a(".sp_choice_type_13");a(".sp_choice_type_12"),await s((()=>this.isManagerOpen()),200,100)}await p(".type-modal",2e4);try{const t=".sp_choice_type_REJECT_ALL",e=".reject-toggle",n=await Promise.race([p(t,2e3).then((t=>t?0:-1)),p(e,2e3).then((t=>t?1:-1)),p(".pm-features",2e3).then((t=>t?2:-1))]);if(0===n)return await h(1e3),a(t);1===n?a(e):2===n&&(await p(".pm-features",1e4),a(".checked > span",!0),a(".chevron"))}catch(t){}return a(".sp_choice_type_SAVE_AND_EXIT")}},new class extends f{constructor(){super("consentmanager.net"),this.prehideSelectors=["#cmpbox,#cmpbox2"],this.apiAvailable=!1}get hasSelfTest(){return this.apiAvailable}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return this.apiAvailable=await c('window.__cmp && typeof __cmp("getCMPData") === "object"'),!!this.apiAvailable||u("#cmpbox")}async detectPopup(){return this.apiAvailable?(await h(500),await c("!__cmp('consentStatus').userChoiceExists")):l("#cmpbox .cmpmore","any")}async optOut(){return await h(500),this.apiAvailable?await c("__cmp('setConsent', 0)"):!!a(".cmpboxbtnno")||(u(".cmpwelcomeprpsbtn")?(a(".cmpwelcomeprpsbtn > a[aria-checked=true]",!0),a(".cmpboxbtnsave"),!0):(a(".cmpboxbtncustom"),await p(".cmptblbox",2e3),a(".cmptdchoice > a[aria-checked=true]",!0),a(".cmpboxbtnyescustomchoices"),!0))}async optIn(){return this.apiAvailable?await c("__cmp('setConsent', 1)"):a(".cmpboxbtnyes")}async test(){if(this.apiAvailable)return await c("__cmp('consentStatus').userChoiceExists")}},new class extends f{constructor(){super("Evidon")}get hasSelfTest(){return!1}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return u("#_evidon_banner")}async detectPopup(){return l("#_evidon_banner","any")}async optOut(){return a("#_evidon-decline-button")||(i(o(),["#evidon-prefdiag-overlay","#evidon-prefdiag-background"]),a("#_evidon-option-button"),await p("#evidon-prefdiag-overlay",5e3),a("#evidon-prefdiag-decline")),!0}async optIn(){return a("#_evidon-accept-button")}},new class extends f{constructor(){super("Onetrust"),this.prehideSelectors=["#onetrust-banner-sdk,#onetrust-consent-sdk,.onetrust-pc-dark-filter,.js-consent-banner"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return u("#onetrust-banner-sdk")}async detectPopup(){return l("#onetrust-banner-sdk","all")}async optOut(){return u("#onetrust-pc-btn-handler")?a("#onetrust-pc-btn-handler"):a(".ot-sdk-show-settings,button.js-cookie-settings"),await p("#onetrust-consent-sdk",2e3),await h(1e3),a("#onetrust-consent-sdk input.category-switch-handler:checked,.js-editor-toggle-state:checked",!0),await h(1e3),await p(".save-preference-btn-handler,.js-consent-save",2e3),a(".save-preference-btn-handler,.js-consent-save"),await s((()=>l("#onetrust-banner-sdk","none")),10,500),!0}async optIn(){return a("#onetrust-accept-btn-handler,.js-accept-cookies")}async test(){return await c("window.OnetrustActiveGroups.split(',').filter(s => s.length > 0).length <= 1")}},new class extends f{constructor(){super("Klaro"),this.prehideSelectors=[".klaro"],this.settingsOpen=!1}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return u(".klaro > .cookie-modal")?(this.settingsOpen=!0,!0):u(".klaro > .cookie-notice")}async detectPopup(){return l(".klaro > .cookie-notice,.klaro > .cookie-modal","any")}async optOut(){return!!a(".klaro .cn-decline")||(this.settingsOpen||(a(".klaro .cn-learn-more"),await p(".klaro > .cookie-modal",2e3),this.settingsOpen=!0),!!a(".klaro .cn-decline")||(a(".cm-purpose:not(.cm-toggle-all) > input:not(.half-checked)",!0),a(".cm-btn-accept")))}async optIn(){return!!a(".klaro .cm-btn-accept-all")||(this.settingsOpen?(a(".cm-purpose:not(.cm-toggle-all) > input.half-checked",!0),a(".cm-btn-accept")):a(".klaro .cookie-notice .cm-btn-success"))}async test(){return await c("klaro.getManager().config.services.every(c => c.required || !klaro.getManager().consents[c.name])")}},new class extends f{constructor(){super("Uniconsent")}get prehideSelectors(){return[".unic",".modal:has(.unic)"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return u(".unic .unic-box,.unic .unic-bar")}async detectPopup(){return l(".unic .unic-box,.unic .unic-bar","any")}async optOut(){if(await p(".unic button",1e3),document.querySelectorAll(".unic button").forEach((t=>{const e=t.textContent;(e.includes("Manage Options")||e.includes("Optionen verwalten"))&&t.click()})),await p(".unic input[type=checkbox]",1e3)){await p(".unic button",1e3),document.querySelectorAll(".unic input[type=checkbox]").forEach((t=>{t.checked&&t.click()}));for(const t of document.querySelectorAll(".unic button")){const e=t.textContent;for(const n of["Confirm Choices","Save Choices","Auswahl speichern"])if(e.includes(n))return t.click(),await h(500),!0}}return!1}async optIn(){return d(".unic #unic-agree")}async test(){await h(1e3);return!u(".unic .unic-box,.unic .unic-bar")}},new class extends f{constructor(){super("Conversant"),this.prehideSelectors=[".cmp-root"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return u(".cmp-root .cmp-receptacle")}async detectPopup(){return l(".cmp-root .cmp-receptacle","any")}async optOut(){if(!await d(".cmp-main-button:not(.cmp-main-button--primary)"))return!1;if(!await p(".cmp-view-tab-tabs"))return!1;await d(".cmp-view-tab-tabs > :first-child"),await d(".cmp-view-tab-tabs > .cmp-view-tab--active:first-child");for(const t of Array.from(document.querySelectorAll(".cmp-accordion-item"))){t.querySelector(".cmp-accordion-item-title").click(),await s((()=>!!t.querySelector(".cmp-accordion-item-content.cmp-active")),10,50);const e=t.querySelector(".cmp-accordion-item-content.cmp-active");e.querySelectorAll(".cmp-toggle-actions .cmp-toggle-deny:not(.cmp-toggle-deny--active)").forEach((t=>t.click())),e.querySelectorAll(".cmp-toggle-actions .cmp-toggle-checkbox:not(.cmp-toggle-checkbox--active)").forEach((t=>t.click()))}return await a(".cmp-main-button:not(.cmp-main-button--primary)"),!0}async optIn(){return d(".cmp-main-button.cmp-main-button--primary")}async test(){return document.cookie.includes("cmp-data=0")}},new class extends f{constructor(){super("tiktok.com"),this.runContext={urlPattern:"tiktok"}}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}getShadowRoot(){const t=document.querySelector("tiktok-cookie-banner");return t?t.shadowRoot:null}async detectCmp(){return u("tiktok-cookie-banner")}async detectPopup(){return r(this.getShadowRoot().querySelector(".tiktok-cookie-banner"))}async optOut(){const t=this.getShadowRoot().querySelector(".button-wrapper button:first-child");return!!t&&(t.click(),!0)}async optIn(){const t=this.getShadowRoot().querySelector(".button-wrapper button:last-child");return!!t&&(t.click(),!0)}async test(){const t=document.cookie.match(/cookie-consent=([^;]+)/);if(!t)return!1;const e=JSON.parse(decodeURIComponent(t[1]));return Object.values(e).every((t=>"boolean"!=typeof t||!1===t))}},new class extends f{constructor(){super("airbnb"),this.runContext={urlPattern:"^https://(www\\.)?airbnb\\.[^/]+/"},this.prehideSelectors=["div[data-testid=main-cookies-banner-container]",'div:has(> div:first-child):has(> div:last-child):has(> section [data-testid="strictly-necessary-cookies"])']}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return u("div[data-testid=main-cookies-banner-container]")}async detectPopup(){return l("div[data-testid=main-cookies-banner-container","any")}async optOut(){let t;for(await d("div[data-testid=main-cookies-banner-container] button._snbhip0");t=document.querySelector("[data-testid=modal-container] button[aria-checked=true]:not([disabled])");)t.click();return d("button[data-testid=save-btn]")}async optIn(){return d("div[data-testid=main-cookies-banner-container] button._148dgdpk")}async test(){return await s((()=>!!document.cookie.match("OptanonAlertBoxClosed")),20,200)}}];class k{static setBase(t){k.base=t}static findElement(t,e=null,n=!1){let o=null;return o=null!=e?Array.from(e.querySelectorAll(t.selector)):null!=k.base?Array.from(k.base.querySelectorAll(t.selector)):Array.from(document.querySelectorAll(t.selector)),null!=t.textFilter&&(o=o.filter((e=>{const n=e.textContent.toLowerCase();if(Array.isArray(t.textFilter)){let e=!1;for(const o of t.textFilter)if(-1!==n.indexOf(o.toLowerCase())){e=!0;break}return e}if(null!=t.textFilter)return-1!==n.indexOf(t.textFilter.toLowerCase())}))),null!=t.styleFilters&&(o=o.filter((e=>{const n=window.getComputedStyle(e);let o=!0;for(const e of t.styleFilters){const t=n[e.option];o=e.negated?o&&t!==e.value:o&&t===e.value}return o}))),null!=t.displayFilter&&(o=o.filter((e=>t.displayFilter?0!==e.offsetHeight:0===e.offsetHeight))),null!=t.iframeFilter&&(o=o.filter((()=>t.iframeFilter?window.location!==window.parent.location:window.location===window.parent.location))),null!=t.childFilter&&(o=o.filter((e=>{const n=k.base;k.setBase(e);const o=k.find(t.childFilter);return k.setBase(n),null!=o.target}))),n?o:(o.length>1&&console.warn("Multiple possible targets: ",o,t,e),o[0])}static find(t,e=!1){const n=[];if(null!=t.parent){const o=k.findElement(t.parent,null,e);if(null!=o){if(o instanceof Array)return o.forEach((o=>{const i=k.findElement(t.target,o,e);i instanceof Array?i.forEach((t=>{n.push({parent:o,target:t})})):n.push({parent:o,target:i})})),n;{const i=k.findElement(t.target,o,e);i instanceof Array?i.forEach((t=>{n.push({parent:o,target:t})})):n.push({parent:o,target:i})}}}else{const o=k.findElement(t.target,null,e);o instanceof Array?o.forEach((t=>{n.push({parent:null,target:t})})):n.push({parent:null,target:o})}return 0===n.length&&n.push({parent:null,target:null}),e?n:(1!==n.length&&console.warn("Multiple results found, even though multiple false",n),n[0])}}function v(t){const e=k.find(t);return"css"===t.type?!!e.target:"checkbox"===t.type?!!e.target&&e.target.checked:void 0}async function _(t,e){switch(t.type){case"click":return async function(t){const e=k.find(t);null!=e.target&&e.target.click();return S(0)}(t);case"list":return async function(t,e){for(const n of t.actions)await _(n,e)}(t,e);case"consent":return async function(t,e){for(const n of t.consents){const t=-1!==e.indexOf(n.type);if(n.matcher&&n.toggleAction){v(n.matcher)!==t&&await _(n.toggleAction)}else t?await _(n.trueAction):await _(n.falseAction)}}(t,e);case"ifcss":return async function(t,e){k.find(t).target?t.falseAction&&await _(t.falseAction,e):t.trueAction&&await _(t.trueAction,e)}(t,e);case"waitcss":return async function(t){await new Promise((e=>{let n=t.retries||10;const o=t.waitTime||250,i=()=>{const s=k.find(t);(t.negated&&s.target||!t.negated&&!s.target)&&n>0?(n-=1,setTimeout(i,o)):e()};i()}))}(t);case"foreach":return async function(t,e){const n=k.find(t,!0),o=k.base;for(const o of n)o.target&&(k.setBase(o.target),await _(t.action,e));k.setBase(o)}(t,e);case"hide":return async function(t){const e=k.find(t);e.target&&e.target.classList.add("Autoconsent-Hidden")}(t);case"slide":return async function(t){const e=k.find(t),n=k.find(t.dragTarget);if(e.target){const t=e.target.getBoundingClientRect(),o=n.target.getBoundingClientRect();let i=o.top-t.top,s=o.left-t.left;"y"===this.config.axis.toLowerCase()&&(s=0),"x"===this.config.axis.toLowerCase()&&(i=0);const r=window.screenX+t.left+t.width/2,c=window.screenY+t.top+t.height/2,a=t.left+t.width/2,u=t.top+t.height/2,l=document.createEvent("MouseEvents");l.initMouseEvent("mousedown",!0,!0,window,0,r,c,a,u,!1,!1,!1,!1,0,e.target);const p=document.createEvent("MouseEvents");p.initMouseEvent("mousemove",!0,!0,window,0,r+s,c+i,a+s,u+i,!1,!1,!1,!1,0,e.target);const d=document.createEvent("MouseEvents");d.initMouseEvent("mouseup",!0,!0,window,0,r+s,c+i,a+s,u+i,!1,!1,!1,!1,0,e.target),e.target.dispatchEvent(l),await this.waitTimeout(10),e.target.dispatchEvent(p),await this.waitTimeout(10),e.target.dispatchEvent(d)}}(t);case"close":return async function(){window.close()}();case"wait":return async function(t){await S(t.waitTime)}(t);case"eval":return async function(t){return console.log("eval!",t.code),new Promise((e=>{try{t.async?(window.eval(t.code),setTimeout((()=>{e(window.eval("window.__consentCheckResult"))}),t.timeout||250)):e(window.eval(t.code))}catch(n){console.warn("eval error",n,t.code),e(!1)}}))}(t);default:throw"Unknown action type: "+t.type}}k.base=null;function S(t){return new Promise((e=>{setTimeout((()=>{e()}),t)}))}class P{constructor(t,e){this.name=t,this.config=e,this.methods=new Map,this.runContext=m,this.isCosmetic=!1,e.methods.forEach((t=>{t.action&&this.methods.set(t.name,t.action)})),this.hasSelfTest=!1}get isIntermediate(){return!1}checkRunContext(){return!0}async detectCmp(){return this.config.detectors.map((t=>v(t.presentMatcher))).some((t=>!!t))}async detectPopup(){return this.config.detectors.map((t=>v(t.showingMatcher))).some((t=>!!t))}async executeAction(t,e){return!this.methods.has(t)||_(this.methods.get(t),e)}async optOut(){return await this.executeAction("HIDE_CMP"),await this.executeAction("OPEN_OPTIONS"),await this.executeAction("HIDE_CMP"),await this.executeAction("DO_CONSENT",[]),await this.executeAction("SAVE_CONSENT"),!0}async optIn(){return await this.executeAction("HIDE_CMP"),await this.executeAction("OPEN_OPTIONS"),await this.executeAction("HIDE_CMP"),await this.executeAction("DO_CONSENT",["D","A","B","E","F","X"]),await this.executeAction("SAVE_CONSENT"),!0}async openCmp(){return await this.executeAction("HIDE_CMP"),await this.executeAction("OPEN_OPTIONS"),!0}async test(){return!0}}exports.createAutoCMP=C,exports.default=class{constructor(e,o=null,i=null){if(this.id=t(),this.rules=[],this.foundCmp=null,this.state={lifecycle:"loading",prehideOn:!1,findCmpAttempts:0,detectedCmps:[],detectedPopups:[],selfTest:null},n.sendContentMessage=e,this.sendContentMessage=e,this.rules=[...b],this.updateState({lifecycle:"loading"}),o)this.initialize(o,i);else{i&&this.parseRules(i);e({type:"init",url:window.location.href}),this.updateState({lifecycle:"waitingForInitResponse"})}}initialize(t,e){if(this.config=t,t.enabled){if(e&&this.parseRules(e),this.rules=function(t,e){return t.filter((t=>(!e.disabledCmps||!e.disabledCmps.includes(t.name))&&(e.enableCosmeticRules||!t.isCosmetic)))}(this.rules,t),t.enablePrehide)if(document.documentElement)this.prehideElements();else{const t=()=>{window.removeEventListener("DOMContentLoaded",t),this.prehideElements()};window.addEventListener("DOMContentLoaded",t)}if("loading"===document.readyState){const t=()=>{window.removeEventListener("DOMContentLoaded",t),this.start()};window.addEventListener("DOMContentLoaded",t)}else this.start();this.updateState({lifecycle:"initialized"})}}parseRules(t){Object.keys(t.consentomatic).forEach((e=>{this.addConsentomaticCMP(e,t.consentomatic[e])})),t.autoconsent.forEach((t=>{this.addCMP(t)}))}addCMP(t){this.rules.push(C(t))}addConsentomaticCMP(t,e){this.rules.push(new P(`com_${t}`,e))}start(){window.requestIdleCallback?window.requestIdleCallback((()=>this._start()),{timeout:500}):this._start()}async _start(){this.updateState({lifecycle:"started"});const t=await this.findCmp(this.config.detectRetries);if(this.updateState({detectedCmps:t.map((t=>t.name))}),0===t.length)return this.config.enablePrehide&&this.undoPrehide(),this.updateState({lifecycle:"nothingDetected"}),!1;this.updateState({lifecycle:"cmpDetected"});let e=await this.detectPopups(t.filter((t=>!t.isCosmetic)));if(0===e.length&&(e=await this.detectPopups(t.filter((t=>t.isCosmetic)))),0===e.length)return this.config.enablePrehide&&this.undoPrehide(),!1;if(this.updateState({lifecycle:"openPopupDetected"}),e.length>1){const t={msg:"Found multiple CMPs, check the detection rules.",cmps:e.map((t=>t.name))};this.sendContentMessage({type:"autoconsentError",details:t})}return this.foundCmp=e[0],"optOut"===this.config.autoAction?await this.doOptOut():"optIn"!==this.config.autoAction||await this.doOptIn()}async findCmp(t){this.updateState({findCmpAttempts:this.state.findCmpAttempts+1});const e=[];for(const t of this.rules)try{if(!t.checkRunContext())continue;await t.detectCmp()&&(this.sendContentMessage({type:"cmpDetected",url:location.href,cmp:t.name}),e.push(t))}catch(t){}return 0===e.length&&t>0?new Promise((e=>{setTimeout((async()=>{const n=this.findCmp(t-1);e(n)}),500)})):e}async detectPopups(t){const e=[],n=t.map((t=>this.waitForPopup(t).then((n=>{n&&(this.updateState({detectedPopups:this.state.detectedPopups.concat([t.name])}),this.sendContentMessage({type:"popupFound",cmp:t.name,url:location.href}),e.push(t))})).catch((()=>null))));return await Promise.all(n),e}async doOptOut(){let t;return this.updateState({lifecycle:"runningOptOut"}),t=!!this.foundCmp&&await this.foundCmp.optOut(),this.config.enablePrehide&&this.undoPrehide(),this.sendContentMessage({type:"optOutResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:t,scheduleSelfTest:this.foundCmp&&this.foundCmp.hasSelfTest,url:location.href}),t&&!this.foundCmp.isIntermediate?(this.sendContentMessage({type:"autoconsentDone",cmp:this.foundCmp.name,isCosmetic:this.foundCmp.isCosmetic,url:location.href}),this.updateState({lifecycle:"done"})):this.updateState({lifecycle:t?"optOutSucceeded":"optOutFailed"}),t}async doOptIn(){let t;return this.updateState({lifecycle:"runningOptIn"}),t=!!this.foundCmp&&await this.foundCmp.optIn(),this.config.enablePrehide&&this.undoPrehide(),this.sendContentMessage({type:"optInResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:t,scheduleSelfTest:!1,url:location.href}),t&&!this.foundCmp.isIntermediate?(this.sendContentMessage({type:"autoconsentDone",cmp:this.foundCmp.name,isCosmetic:this.foundCmp.isCosmetic,url:location.href}),this.updateState({lifecycle:"done"})):this.updateState({lifecycle:t?"optInSucceeded":"optInFailed"}),t}async doSelfTest(){let t;return t=!!this.foundCmp&&await this.foundCmp.test(),this.sendContentMessage({type:"selfTestResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:t,url:location.href}),this.updateState({selfTest:t}),t}async waitForPopup(t,e=5,n=500){const o=await t.detectPopup();return!o&&e>0?new Promise((o=>setTimeout((()=>o(this.waitForPopup(t,e-1,n))),n))):o}prehideElements(){const t=this.rules.reduce(((t,e)=>e.prehideSelectors?[...t,...e.prehideSelectors]:t),["#didomi-popup,.didomi-popup-container,.didomi-popup-notice,.didomi-consent-popup-preferences,#didomi-notice,.didomi-popup-backdrop,.didomi-screen-medium"]);return this.updateState({prehideOn:!0}),function(t){return i(o("autoconsent-prehide"),t,"opacity")}(t)}undoPrehide(){return this.updateState({prehideOn:!1}),function(){const t=o("autoconsent-prehide");return t&&t.remove(),!!t}()}updateState(t){Object.assign(this.state,t),this.sendContentMessage({type:"report",instanceId:this.id,url:window.location.href,mainFrame:window.top===window.self,state:this.state})}async receiveMessageCallback(t){switch(t.type){case"initResp":this.initialize(t.config,t.rules);break;case"optIn":await this.doOptIn();break;case"optOut":await this.doOptOut();break;case"selfTest":await this.doSelfTest();break;case"evalResp":!function(t,e){const o=n.pending.get(t);o?(n.pending.delete(t),o.timer&&window.clearTimeout(o.timer),o.resolve(e)):console.warn("no eval #",t)}(t.id,t.result)}}},exports.rules=b;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});function t(){return crypto&&void 0!==crypto.randomUUID?crypto.randomUUID():Math.random().toString()}class e{constructor(t,e=1e3){this.id=t,this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),this.timer=window.setTimeout((()=>{this.reject(new Error("timeout"))}),e)}}const n={pending:new Map,sendContentMessage:null};function o(t="autoconsent-css-rules"){const e=`style#${t}`,n=document.querySelector(e);if(n&&n instanceof HTMLStyleElement)return n;{const e=document.head||document.getElementsByTagName("head")[0]||document.documentElement,n=document.createElement("style");return n.id=t,e.appendChild(n),n}}function i(t,e,n="display"){const o="opacity"===n?"opacity: 0":"display: none",i=`${e.join(",")} { ${o} !important; z-index: -1 !important; pointer-events: none !important; } `;return t instanceof HTMLStyleElement&&(t.innerText+=i,e.length>0)}async function s(t,e,n){const o=await t();return!o&&e>0?new Promise((o=>{setTimeout((async()=>{o(s(t,e-1,n))}),n)})):Promise.resolve(o)}function r(t){if(!t)return!1;if(null!==t.offsetParent)return!0;{const e=window.getComputedStyle(t);if("fixed"===e.position&&"none"!==e.display)return!0}return!1}function c(o){return function(o){const i=t();n.sendContentMessage({type:"eval",id:i,code:o});const s=new e(i);return n.pending.set(s.id,s),s.promise}(o).catch((t=>!1))}function a(t,e=!1){let n=[];return n="string"==typeof t?Array.from(document.querySelectorAll(t)):t,n.length>0&&(e?n.forEach((t=>t.click())):n[0].click()),n.length>0}function u(t){return null!==document.querySelector(t)}function l(t,e){const n=document.querySelectorAll(t),o=new Array(n.length);return n.forEach(((t,e)=>{o[e]=r(t)})),"none"===e?o.every((t=>!t)):0!==o.length&&("any"===e?o.some((t=>t)):o.every((t=>t)))}function p(t,e=1e4){return s((()=>null!==document.querySelector(t)),Math.ceil(e/200),200)}async function d(t,e=1e4,n=!1){return await p(t,e),a(t,n)}function h(t){return new Promise((e=>{setTimeout((()=>{e(!0)}),t)}))}const m={main:!0,frame:!1,urlPattern:""};class f{constructor(t){this.runContext=m,this.name=t}get hasSelfTest(){throw new Error("Not Implemented")}get isIntermediate(){throw new Error("Not Implemented")}get isCosmetic(){throw new Error("Not Implemented")}checkRunContext(){const t={...m,...this.runContext},e=window.top===window;return!(e&&!t.main)&&(!(!e&&!t.frame)&&!(t.urlPattern&&!window.location.href.match(t.urlPattern)))}detectCmp(){throw new Error("Not Implemented")}async detectPopup(){return!1}optOut(){throw new Error("Not Implemented")}optIn(){throw new Error("Not Implemented")}openCmp(){throw new Error("Not Implemented")}async test(){return Promise.resolve(!0)}}async function y(t){const e=[];if(t.exists&&e.push(u(t.exists)),t.visible&&e.push(l(t.visible,t.check)),t.eval){const n=c(t.eval);e.push(n)}var n,r;if(t.waitFor&&e.push(p(t.waitFor,t.timeout)),t.waitForVisible&&e.push(function(t,e=1e4,n="any"){return s((()=>l(t,n)),Math.ceil(e/200),200)}(t.waitForVisible,t.timeout,t.check)),t.click&&e.push(a(t.click,t.all)),t.waitForThenClick&&e.push(d(t.waitForThenClick,t.timeout,t.all)),t.wait&&e.push(h(t.wait)),t.hide&&e.push((n=t.hide,r=t.method,i(o(),n,r))),t.if){if(!t.if.exists&&!t.if.visible)return console.error("invalid conditional rule",t.if),!1;await y(t.if)?e.push(w(t.then)):t.else&&e.push(w(t.else))}if(0===e.length)return!1;return(await Promise.all(e)).reduce(((t,e)=>t&&e),!0)}async function w(t){for(const e of t){if(!await y(e)&&!e.optional)return!1}return!0}class g extends f{constructor(t){super(t.name),this.config=t,this.runContext=t.runContext||m}get hasSelfTest(){return!!this.config.test}get isIntermediate(){return!!this.config.intermediate}get isCosmetic(){return!!this.config.cosmetic}get prehideSelectors(){return this.config.prehideSelectors}async detectCmp(){return!!this.config.detectCmp&&async function(t){const e=t.map((t=>y(t)));return(await Promise.all(e)).every((t=>!!t))}(this.config.detectCmp)}async detectPopup(){return!!this.config.detectPopup&&w(this.config.detectPopup)}async optOut(){return!!this.config.optOut&&w(this.config.optOut)}async optIn(){return!!this.config.optIn&&w(this.config.optIn)}async openCmp(){return!!this.config.openCmp&&w(this.config.openCmp)}async test(){return this.hasSelfTest?w(this.config.test):super.test()}}function C(t){return new g(t)}const b=[new class extends f{constructor(){super("TrustArc-top"),this.prehideSelectors=[".trustarc-banner-container",".truste_popframe,.truste_overlay,.truste_box_overlay,#truste-consent-track"],this.runContext={main:!0,frame:!1},this._shortcutButton=null,this._optInDone=!1}get hasSelfTest(){return!1}get isIntermediate(){return!this._optInDone&&!this._shortcutButton}get isCosmetic(){return!1}async detectCmp(){const t=u("#truste-show-consent,#truste-consent-track");return t&&(this._shortcutButton=document.querySelector("#truste-consent-required")),t}async detectPopup(){return l("#truste-consent-content,#trustarc-banner-overlay,#truste-consent-track","all")}openFrame(){a("#truste-show-consent")}async optOut(){return this._shortcutButton?(this._shortcutButton.click(),!0):(i(o(),[".truste_popframe",".truste_overlay",".truste_box_overlay","#truste-consent-track"]),a("#truste-show-consent"),setTimeout((()=>{o().remove()}),1e4),!0)}async optIn(){return this._optInDone=!0,a("#truste-consent-button")}async openCmp(){return!0}async test(){return!0}},new class extends f{constructor(){super("TrustArc-frame"),this.runContext={main:!1,frame:!0,urlPattern:"^https://consent-pref\\.trustarc\\.com/\\?"}}get hasSelfTest(){return!1}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return!0}async detectPopup(){return l("#defaultpreferencemanager","any")&&l(".mainContent","any")}async navigateToSettings(){return await s((async()=>u(".shp")||l(".advance","any")||u(".switch span:first-child")),10,500),u(".shp")&&a(".shp"),await p(".prefPanel",5e3),l(".advance","any")&&a(".advance"),await s((()=>l(".switch span:first-child","any")),5,1e3)}async optOut(){return await s((()=>"complete"===document.readyState),20,100),await p(".mainContent[aria-hidden=false]",5e3),!!a(".rejectAll")||(u(".prefPanel")&&await p('.prefPanel[style="visibility: visible;"]',3e3),a("#catDetails0")?(a(".submit"),!0):(a(".required")||(await this.navigateToSettings(),a(".switch span:nth-child(1):not(.active)",!0),a(".submit"),p("#gwt-debug-close_id",3e5).then((()=>{a("#gwt-debug-close_id")}))),!0))}async optIn(){return a(".call")||(await this.navigateToSettings(),a(".switch span:nth-child(2)",!0),a(".submit"),p("#gwt-debug-close_id",3e5).then((()=>{a("#gwt-debug-close_id")}))),!0}},new class extends f{constructor(){super("Cybotcookiebot"),this.prehideSelectors=["#CybotCookiebotDialog,#dtcookie-container,#cookiebanner,#cb-cookieoverlay"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return u("#CybotCookiebotDialogBodyLevelButtonPreferences")}async detectPopup(){return u("#CybotCookiebotDialog,#dtcookie-container,#cookiebanner,#cb-cookiebanner")}async optOut(){return a(".cookie-alert-extended-detail-link")?(await p(".cookie-alert-configuration",2e3),a(".cookie-alert-configuration-input:checked",!0),a(".cookie-alert-extended-button-secondary"),!0):u("#dtcookie-container")?a(".h-dtcookie-decline"):(a(".cookiebot__button--settings")||a("#CybotCookiebotDialogBodyButtonDecline")||(a(".cookiebanner__link--details"),a('.CybotCookiebotDialogBodyLevelButton:checked:enabled,input[id*="CybotCookiebotDialogBodyLevelButton"]:checked:enabled',!0),a("#CybotCookiebotDialogBodyButtonDecline"),a("input[id^=CybotCookiebotDialogBodyLevelButton]:checked",!0),u("#CybotCookiebotDialogBodyButtonAcceptSelected")?a("#CybotCookiebotDialogBodyButtonAcceptSelected"):a("#CybotCookiebotDialogBodyLevelButtonAccept,#CybotCookiebotDialogBodyButtonAccept,#CybotCookiebotDialogBodyLevelButtonLevelOptinAllowallSelection",!0),await c("window.CookieConsent.hasResponse !== true")&&(await c("window.Cookiebot.dialog.submitConsent()"),await h(500)),u("#cb-confirmedSettings")&&await c("endCookieProcess()")),!0)}async optIn(){return u("#dtcookie-container")?a(".h-dtcookie-accept"):(a(".CybotCookiebotDialogBodyLevelButton:not(:checked):enabled",!0),a("#CybotCookiebotDialogBodyLevelButtonAccept"),a("#CybotCookiebotDialogBodyButtonAccept"),!0)}async test(){return c("window.CookieConsent.declined === true")}},new class extends f{constructor(){super("Sourcepoint-frame"),this.prehideSelectors=["div[id^='sp_message_container_'],.message-overlay","#sp_privacy_manager_container"],this.ccpaNotice=!1,this.ccpaPopup=!1,this.runContext={main:!1,frame:!0}}get hasSelfTest(){return!1}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){const t=new URL(location.href);return t.searchParams.has("message_id")&&"ccpa-notice.sp-prod.net"===t.hostname?(this.ccpaNotice=!0,!0):"ccpa-pm.sp-prod.net"===t.hostname?(this.ccpaPopup=!0,!0):("/index.html"===t.pathname||"/privacy-manager/index.html"===t.pathname)&&(t.searchParams.has("message_id")||t.searchParams.has("requestUUID")||t.searchParams.has("consentUUID"))}async detectPopup(){return!!this.ccpaNotice||(this.ccpaPopup?await p(".priv-save-btn",2e3):(await p(".sp_choice_type_11,.sp_choice_type_12,.sp_choice_type_13,.sp_choice_type_ACCEPT_ALL",2e3),!u(".sp_choice_type_9")))}async optIn(){return await p(".sp_choice_type_11,.sp_choice_type_ACCEPT_ALL",2e3),!!a(".sp_choice_type_11")||!!a(".sp_choice_type_ACCEPT_ALL")}isManagerOpen(){return"/privacy-manager/index.html"===location.pathname}async optOut(){if(this.ccpaPopup){const t=document.querySelectorAll(".priv-purpose-container .sp-switch-arrow-block a.neutral.on .right");for(const e of t)a([e]);const e=document.querySelectorAll(".priv-purpose-container .sp-switch-arrow-block a.switch-bg.on");for(const t of e)a([t]);return a(".priv-save-btn")}if(!this.isManagerOpen()){if(!await p(".sp_choice_type_12,.sp_choice_type_13"))return!1;if(!u(".sp_choice_type_12"))return a(".sp_choice_type_13");a(".sp_choice_type_12"),await s((()=>this.isManagerOpen()),200,100)}await p(".type-modal",2e4);try{const t=".sp_choice_type_REJECT_ALL",e=".reject-toggle",n=await Promise.race([p(t,2e3).then((t=>t?0:-1)),p(e,2e3).then((t=>t?1:-1)),p(".pm-features",2e3).then((t=>t?2:-1))]);if(0===n)return await h(1e3),a(t);1===n?a(e):2===n&&(await p(".pm-features",1e4),a(".checked > span",!0),a(".chevron"))}catch(t){}return a(".sp_choice_type_SAVE_AND_EXIT")}},new class extends f{get hasSelfTest(){return this.apiAvailable}get isIntermediate(){return!1}get isCosmetic(){return!1}constructor(){super("consentmanager.net"),this.prehideSelectors=["#cmpbox,#cmpbox2"],this.apiAvailable=!1}async detectCmp(){return this.apiAvailable=await c('window.__cmp && typeof __cmp("getCMPData") === "object"'),!!this.apiAvailable||u("#cmpbox")}async detectPopup(){return this.apiAvailable?(await h(500),await c("!__cmp('consentStatus').userChoiceExists")):l("#cmpbox .cmpmore","any")}async optOut(){return await h(500),this.apiAvailable?await c("__cmp('setConsent', 0)"):!!a(".cmpboxbtnno")||(u(".cmpwelcomeprpsbtn")?(a(".cmpwelcomeprpsbtn > a[aria-checked=true]",!0),a(".cmpboxbtnsave"),!0):(a(".cmpboxbtncustom"),await p(".cmptblbox",2e3),a(".cmptdchoice > a[aria-checked=true]",!0),a(".cmpboxbtnyescustomchoices"),!0))}async optIn(){return this.apiAvailable?await c("__cmp('setConsent', 1)"):a(".cmpboxbtnyes")}async test(){if(this.apiAvailable)return await c("__cmp('consentStatus').userChoiceExists")}},new class extends f{constructor(){super("Evidon")}get hasSelfTest(){return!1}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return u("#_evidon_banner")}async detectPopup(){return l("#_evidon_banner","any")}async optOut(){return a("#_evidon-decline-button")||(i(o(),["#evidon-prefdiag-overlay","#evidon-prefdiag-background"]),a("#_evidon-option-button"),await p("#evidon-prefdiag-overlay",5e3),a("#evidon-prefdiag-decline")),!0}async optIn(){return a("#_evidon-accept-button")}},new class extends f{constructor(){super("Onetrust"),this.prehideSelectors=["#onetrust-banner-sdk,#onetrust-consent-sdk,.onetrust-pc-dark-filter,.js-consent-banner"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return u("#onetrust-banner-sdk")}async detectPopup(){return l("#onetrust-banner-sdk","all")}async optOut(){return u("#onetrust-pc-btn-handler")?a("#onetrust-pc-btn-handler"):a(".ot-sdk-show-settings,button.js-cookie-settings"),await p("#onetrust-consent-sdk",2e3),await h(1e3),a("#onetrust-consent-sdk input.category-switch-handler:checked,.js-editor-toggle-state:checked",!0),await h(1e3),await p(".save-preference-btn-handler,.js-consent-save",2e3),a(".save-preference-btn-handler,.js-consent-save"),await s((()=>l("#onetrust-banner-sdk","none")),10,500),!0}async optIn(){return a("#onetrust-accept-btn-handler,.js-accept-cookies")}async test(){return await c("window.OnetrustActiveGroups.split(',').filter(s => s.length > 0).length <= 1")}},new class extends f{constructor(){super("Klaro"),this.prehideSelectors=[".klaro"],this.settingsOpen=!1}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return u(".klaro > .cookie-modal")?(this.settingsOpen=!0,!0):u(".klaro > .cookie-notice")}async detectPopup(){return l(".klaro > .cookie-notice,.klaro > .cookie-modal","any")}async optOut(){return!!a(".klaro .cn-decline")||(this.settingsOpen||(a(".klaro .cn-learn-more"),await p(".klaro > .cookie-modal",2e3),this.settingsOpen=!0),!!a(".klaro .cn-decline")||(a(".cm-purpose:not(.cm-toggle-all) > input:not(.half-checked)",!0),a(".cm-btn-accept")))}async optIn(){return!!a(".klaro .cm-btn-accept-all")||(this.settingsOpen?(a(".cm-purpose:not(.cm-toggle-all) > input.half-checked",!0),a(".cm-btn-accept")):a(".klaro .cookie-notice .cm-btn-success"))}async test(){return await c("klaro.getManager().config.services.every(c => c.required || !klaro.getManager().consents[c.name])")}},new class extends f{constructor(){super("Uniconsent")}get prehideSelectors(){return[".unic",".modal:has(.unic)"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return u(".unic .unic-box,.unic .unic-bar")}async detectPopup(){return l(".unic .unic-box,.unic .unic-bar","any")}async optOut(){if(await p(".unic button",1e3),document.querySelectorAll(".unic button").forEach((t=>{const e=t.textContent;(e.includes("Manage Options")||e.includes("Optionen verwalten"))&&t.click()})),await p(".unic input[type=checkbox]",1e3)){await p(".unic button",1e3),document.querySelectorAll(".unic input[type=checkbox]").forEach((t=>{t.checked&&t.click()}));for(const t of document.querySelectorAll(".unic button")){const e=t.textContent;for(const n of["Confirm Choices","Save Choices","Auswahl speichern"])if(e.includes(n))return t.click(),await h(500),!0}}return!1}async optIn(){return d(".unic #unic-agree")}async test(){await h(1e3);return!u(".unic .unic-box,.unic .unic-bar")}},new class extends f{constructor(){super("Conversant"),this.prehideSelectors=[".cmp-root"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return u(".cmp-root .cmp-receptacle")}async detectPopup(){return l(".cmp-root .cmp-receptacle","any")}async optOut(){if(!await d(".cmp-main-button:not(.cmp-main-button--primary)"))return!1;if(!await p(".cmp-view-tab-tabs"))return!1;await d(".cmp-view-tab-tabs > :first-child"),await d(".cmp-view-tab-tabs > .cmp-view-tab--active:first-child");for(const t of Array.from(document.querySelectorAll(".cmp-accordion-item"))){t.querySelector(".cmp-accordion-item-title").click(),await s((()=>!!t.querySelector(".cmp-accordion-item-content.cmp-active")),10,50);const e=t.querySelector(".cmp-accordion-item-content.cmp-active");e.querySelectorAll(".cmp-toggle-actions .cmp-toggle-deny:not(.cmp-toggle-deny--active)").forEach((t=>t.click())),e.querySelectorAll(".cmp-toggle-actions .cmp-toggle-checkbox:not(.cmp-toggle-checkbox--active)").forEach((t=>t.click()))}return await a(".cmp-main-button:not(.cmp-main-button--primary)"),!0}async optIn(){return d(".cmp-main-button.cmp-main-button--primary")}async test(){return document.cookie.includes("cmp-data=0")}},new class extends f{constructor(){super("tiktok.com"),this.runContext={urlPattern:"tiktok"}}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}getShadowRoot(){const t=document.querySelector("tiktok-cookie-banner");return t?t.shadowRoot:null}async detectCmp(){return u("tiktok-cookie-banner")}async detectPopup(){return r(this.getShadowRoot().querySelector(".tiktok-cookie-banner"))}async optOut(){const t=this.getShadowRoot().querySelector(".button-wrapper button:first-child");return!!t&&(t.click(),!0)}async optIn(){const t=this.getShadowRoot().querySelector(".button-wrapper button:last-child");return!!t&&(t.click(),!0)}async test(){const t=document.cookie.match(/cookie-consent=([^;]+)/);if(!t)return!1;const e=JSON.parse(decodeURIComponent(t[1]));return Object.values(e).every((t=>"boolean"!=typeof t||!1===t))}},new class extends f{constructor(){super("airbnb"),this.runContext={urlPattern:"^https://(www\\.)?airbnb\\.[^/]+/"},this.prehideSelectors=["div[data-testid=main-cookies-banner-container]",'div:has(> div:first-child):has(> div:last-child):has(> section [data-testid="strictly-necessary-cookies"])']}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return u("div[data-testid=main-cookies-banner-container]")}async detectPopup(){return l("div[data-testid=main-cookies-banner-container","any")}async optOut(){let t;for(await d("div[data-testid=main-cookies-banner-container] button._snbhip0");t=document.querySelector("[data-testid=modal-container] button[aria-checked=true]:not([disabled])");)t.click();return d("button[data-testid=save-btn]")}async optIn(){return d("div[data-testid=main-cookies-banner-container] button._148dgdpk")}async test(){return await s((()=>!!document.cookie.match("OptanonAlertBoxClosed")),20,200)}}];class k{static setBase(t){k.base=t}static findElement(t,e=null,n=!1){let o=null;return o=null!=e?Array.from(e.querySelectorAll(t.selector)):null!=k.base?Array.from(k.base.querySelectorAll(t.selector)):Array.from(document.querySelectorAll(t.selector)),null!=t.textFilter&&(o=o.filter((e=>{const n=e.textContent.toLowerCase();if(Array.isArray(t.textFilter)){let e=!1;for(const o of t.textFilter)if(-1!==n.indexOf(o.toLowerCase())){e=!0;break}return e}if(null!=t.textFilter)return-1!==n.indexOf(t.textFilter.toLowerCase())}))),null!=t.styleFilters&&(o=o.filter((e=>{const n=window.getComputedStyle(e);let o=!0;for(const e of t.styleFilters){const t=n[e.option];o=e.negated?o&&t!==e.value:o&&t===e.value}return o}))),null!=t.displayFilter&&(o=o.filter((e=>t.displayFilter?0!==e.offsetHeight:0===e.offsetHeight))),null!=t.iframeFilter&&(o=o.filter((()=>t.iframeFilter?window.location!==window.parent.location:window.location===window.parent.location))),null!=t.childFilter&&(o=o.filter((e=>{const n=k.base;k.setBase(e);const o=k.find(t.childFilter);return k.setBase(n),null!=o.target}))),n?o:(o.length>1&&console.warn("Multiple possible targets: ",o,t,e),o[0])}static find(t,e=!1){const n=[];if(null!=t.parent){const o=k.findElement(t.parent,null,e);if(null!=o){if(o instanceof Array)return o.forEach((o=>{const i=k.findElement(t.target,o,e);i instanceof Array?i.forEach((t=>{n.push({parent:o,target:t})})):n.push({parent:o,target:i})})),n;{const i=k.findElement(t.target,o,e);i instanceof Array?i.forEach((t=>{n.push({parent:o,target:t})})):n.push({parent:o,target:i})}}}else{const o=k.findElement(t.target,null,e);o instanceof Array?o.forEach((t=>{n.push({parent:null,target:t})})):n.push({parent:null,target:o})}return 0===n.length&&n.push({parent:null,target:null}),e?n:(1!==n.length&&console.warn("Multiple results found, even though multiple false",n),n[0])}}function v(t){const e=k.find(t);return"css"===t.type?!!e.target:"checkbox"===t.type?!!e.target&&e.target.checked:void 0}async function _(t,e){switch(t.type){case"click":return async function(t){const e=k.find(t);null!=e.target&&e.target.click();return S(0)}(t);case"list":return async function(t,e){for(const n of t.actions)await _(n,e)}(t,e);case"consent":return async function(t,e){for(const n of t.consents){const t=-1!==e.indexOf(n.type);if(n.matcher&&n.toggleAction){v(n.matcher)!==t&&await _(n.toggleAction)}else t?await _(n.trueAction):await _(n.falseAction)}}(t,e);case"ifcss":return async function(t,e){k.find(t).target?t.falseAction&&await _(t.falseAction,e):t.trueAction&&await _(t.trueAction,e)}(t,e);case"waitcss":return async function(t){await new Promise((e=>{let n=t.retries||10;const o=t.waitTime||250,i=()=>{const s=k.find(t);(t.negated&&s.target||!t.negated&&!s.target)&&n>0?(n-=1,setTimeout(i,o)):e()};i()}))}(t);case"foreach":return async function(t,e){const n=k.find(t,!0),o=k.base;for(const o of n)o.target&&(k.setBase(o.target),await _(t.action,e));k.setBase(o)}(t,e);case"hide":return async function(t){const e=k.find(t);e.target&&e.target.classList.add("Autoconsent-Hidden")}(t);case"slide":return async function(t){const e=k.find(t),n=k.find(t.dragTarget);if(e.target){const t=e.target.getBoundingClientRect(),o=n.target.getBoundingClientRect();let i=o.top-t.top,s=o.left-t.left;"y"===this.config.axis.toLowerCase()&&(s=0),"x"===this.config.axis.toLowerCase()&&(i=0);const r=window.screenX+t.left+t.width/2,c=window.screenY+t.top+t.height/2,a=t.left+t.width/2,u=t.top+t.height/2,l=document.createEvent("MouseEvents");l.initMouseEvent("mousedown",!0,!0,window,0,r,c,a,u,!1,!1,!1,!1,0,e.target);const p=document.createEvent("MouseEvents");p.initMouseEvent("mousemove",!0,!0,window,0,r+s,c+i,a+s,u+i,!1,!1,!1,!1,0,e.target);const d=document.createEvent("MouseEvents");d.initMouseEvent("mouseup",!0,!0,window,0,r+s,c+i,a+s,u+i,!1,!1,!1,!1,0,e.target),e.target.dispatchEvent(l),await this.waitTimeout(10),e.target.dispatchEvent(p),await this.waitTimeout(10),e.target.dispatchEvent(d)}}(t);case"close":return async function(){window.close()}();case"wait":return async function(t){await S(t.waitTime)}(t);case"eval":return async function(t){return console.log("eval!",t.code),new Promise((e=>{try{t.async?(window.eval(t.code),setTimeout((()=>{e(window.eval("window.__consentCheckResult"))}),t.timeout||250)):e(window.eval(t.code))}catch(n){console.warn("eval error",n,t.code),e(!1)}}))}(t);default:throw"Unknown action type: "+t.type}}k.base=null;function S(t){return new Promise((e=>{setTimeout((()=>{e()}),t)}))}class P{constructor(t,e){this.name=t,this.config=e,this.methods=new Map,this.runContext=m,this.isCosmetic=!1,e.methods.forEach((t=>{t.action&&this.methods.set(t.name,t.action)})),this.hasSelfTest=!1}get isIntermediate(){return!1}checkRunContext(){return!0}async detectCmp(){return this.config.detectors.map((t=>v(t.presentMatcher))).some((t=>!!t))}async detectPopup(){return this.config.detectors.map((t=>v(t.showingMatcher))).some((t=>!!t))}async executeAction(t,e){return!this.methods.has(t)||_(this.methods.get(t),e)}async optOut(){return await this.executeAction("HIDE_CMP"),await this.executeAction("OPEN_OPTIONS"),await this.executeAction("HIDE_CMP"),await this.executeAction("DO_CONSENT",[]),await this.executeAction("SAVE_CONSENT"),!0}async optIn(){return await this.executeAction("HIDE_CMP"),await this.executeAction("OPEN_OPTIONS"),await this.executeAction("HIDE_CMP"),await this.executeAction("DO_CONSENT",["D","A","B","E","F","X"]),await this.executeAction("SAVE_CONSENT"),!0}async openCmp(){return await this.executeAction("HIDE_CMP"),await this.executeAction("OPEN_OPTIONS"),!0}async test(){return!0}}exports.createAutoCMP=C,exports.default=class{constructor(e,o=null,i=null){if(this.id=t(),this.rules=[],this.foundCmp=null,this.state={lifecycle:"loading",prehideOn:!1,findCmpAttempts:0,detectedCmps:[],detectedPopups:[],selfTest:null},n.sendContentMessage=e,this.sendContentMessage=e,this.rules=[...b],this.updateState({lifecycle:"loading"}),o)this.initialize(o,i);else{i&&this.parseRules(i);e({type:"init",url:window.location.href}),this.updateState({lifecycle:"waitingForInitResponse"})}}initialize(t,e){if(this.config=t,t.enabled){if(e&&this.parseRules(e),this.rules=function(t,e){return t.filter((t=>(!e.disabledCmps||!e.disabledCmps.includes(t.name))&&(e.enableCosmeticRules||!t.isCosmetic)))}(this.rules,t),t.enablePrehide)if(document.documentElement)this.prehideElements();else{const t=()=>{window.removeEventListener("DOMContentLoaded",t),this.prehideElements()};window.addEventListener("DOMContentLoaded",t)}if("loading"===document.readyState){const t=()=>{window.removeEventListener("DOMContentLoaded",t),this.start()};window.addEventListener("DOMContentLoaded",t)}else this.start();this.updateState({lifecycle:"initialized"})}}parseRules(t){Object.keys(t.consentomatic).forEach((e=>{this.addConsentomaticCMP(e,t.consentomatic[e])})),t.autoconsent.forEach((t=>{this.addCMP(t)}))}addCMP(t){this.rules.push(C(t))}addConsentomaticCMP(t,e){this.rules.push(new P(`com_${t}`,e))}start(){window.requestIdleCallback?window.requestIdleCallback((()=>this._start()),{timeout:500}):this._start()}async _start(){this.updateState({lifecycle:"started"});const t=await this.findCmp(this.config.detectRetries);if(this.updateState({detectedCmps:t.map((t=>t.name))}),0===t.length)return this.config.enablePrehide&&this.undoPrehide(),this.updateState({lifecycle:"nothingDetected"}),!1;this.updateState({lifecycle:"cmpDetected"});let e=await this.detectPopups(t.filter((t=>!t.isCosmetic)));if(0===e.length&&(e=await this.detectPopups(t.filter((t=>t.isCosmetic)))),0===e.length)return this.config.enablePrehide&&this.undoPrehide(),!1;if(this.updateState({lifecycle:"openPopupDetected"}),e.length>1){const t={msg:"Found multiple CMPs, check the detection rules.",cmps:e.map((t=>t.name))};this.sendContentMessage({type:"autoconsentError",details:t})}return this.foundCmp=e[0],"optOut"===this.config.autoAction?await this.doOptOut():"optIn"!==this.config.autoAction||await this.doOptIn()}async findCmp(t){this.updateState({findCmpAttempts:this.state.findCmpAttempts+1});const e=[];for(const t of this.rules)try{if(!t.checkRunContext())continue;await t.detectCmp()&&(this.sendContentMessage({type:"cmpDetected",url:location.href,cmp:t.name}),e.push(t))}catch(t){}return 0===e.length&&t>0?new Promise((e=>{setTimeout((async()=>{const n=this.findCmp(t-1);e(n)}),500)})):e}async detectPopups(t){const e=[],n=t.map((t=>this.waitForPopup(t).then((n=>{n&&(this.updateState({detectedPopups:this.state.detectedPopups.concat([t.name])}),this.sendContentMessage({type:"popupFound",cmp:t.name,url:location.href}),e.push(t))})).catch((()=>null))));return await Promise.all(n),e}async doOptOut(){let t;return this.updateState({lifecycle:"runningOptOut"}),t=!!this.foundCmp&&await this.foundCmp.optOut(),this.config.enablePrehide&&this.undoPrehide(),this.sendContentMessage({type:"optOutResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:t,scheduleSelfTest:this.foundCmp&&this.foundCmp.hasSelfTest,url:location.href}),t&&!this.foundCmp.isIntermediate?(this.sendContentMessage({type:"autoconsentDone",cmp:this.foundCmp.name,isCosmetic:this.foundCmp.isCosmetic,url:location.href}),this.updateState({lifecycle:"done"})):this.updateState({lifecycle:t?"optOutSucceeded":"optOutFailed"}),t}async doOptIn(){let t;return this.updateState({lifecycle:"runningOptIn"}),t=!!this.foundCmp&&await this.foundCmp.optIn(),this.config.enablePrehide&&this.undoPrehide(),this.sendContentMessage({type:"optInResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:t,scheduleSelfTest:!1,url:location.href}),t&&!this.foundCmp.isIntermediate?(this.sendContentMessage({type:"autoconsentDone",cmp:this.foundCmp.name,isCosmetic:this.foundCmp.isCosmetic,url:location.href}),this.updateState({lifecycle:"done"})):this.updateState({lifecycle:t?"optInSucceeded":"optInFailed"}),t}async doSelfTest(){let t;return t=!!this.foundCmp&&await this.foundCmp.test(),this.sendContentMessage({type:"selfTestResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:t,url:location.href}),this.updateState({selfTest:t}),t}async waitForPopup(t,e=5,n=500){const o=await t.detectPopup();return!o&&e>0?new Promise((o=>setTimeout((()=>o(this.waitForPopup(t,e-1,n))),n))):o}prehideElements(){const t=this.rules.reduce(((t,e)=>e.prehideSelectors?[...t,...e.prehideSelectors]:t),["#didomi-popup,.didomi-popup-container,.didomi-popup-notice,.didomi-consent-popup-preferences,#didomi-notice,.didomi-popup-backdrop,.didomi-screen-medium"]);return this.updateState({prehideOn:!0}),function(t){return i(o("autoconsent-prehide"),t,"opacity")}(t)}undoPrehide(){return this.updateState({prehideOn:!1}),function(){const t=o("autoconsent-prehide");return t&&t.remove(),!!t}()}updateState(t){Object.assign(this.state,t),this.sendContentMessage({type:"report",instanceId:this.id,url:window.location.href,mainFrame:window.top===window.self,state:this.state})}async receiveMessageCallback(t){switch(t.type){case"initResp":this.initialize(t.config,t.rules);break;case"optIn":await this.doOptIn();break;case"optOut":await this.doOptOut();break;case"selfTest":await this.doSelfTest();break;case"evalResp":!function(t,e){const o=n.pending.get(t);o?(n.pending.delete(t),o.timer&&window.clearTimeout(o.timer),o.resolve(e)):console.warn("no eval #",t)}(t.id,t.result)}}},exports.rules=b;