New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@cliqz/adblocker

Package Overview
Dependencies
Maintainers
2
Versions
181
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cliqz/adblocker - npm Package Compare versions

Comparing version 1.28.2 to 1.29.0

2

dist/commonjs/codebooks/cosmetic-selector.d.ts
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -12,85 +12,78 @@ * This Source Code Form is subject to the terms of the Mozilla Public

exports.default = [
"%3D%3D%2527%252Cnecessary%3Atrue%252Cpreferences%3Afalse%252Cstatistics%3Afalse%252Cmarketing%3Afalse%252Cmethod%3A%2527explicit%2527%252Cve",
", CookieConsent, {stamp:%27Uv9YOAVP5djCBw71lxhE4rNAfTObaGck2Sn3rKWf9dPCYpqcWvAlpA==%27%2Cnecessary:true%2Cpreferences:false%2Cstatistics:fal",
"div[style=\"position: absolute; inset: 0px; overflow: hidden; z-index: 160; background: transparent none repeat scroll 0% 0%; display: block;",
"IAEQJQIAJqJEgFERAkJQCBpZHwMACAIQgHRWATFIiB-HaBroyfhEMaC0AUBQ4AonhMTPAoSdwXCkg7uaHIgIImgFASBAIoYMEEEEBlTkFABAAAkAAABJSADAAEQUCUAGAAIgoDoAMAAR",
"div[style=\"position: fixed; display: block; width: 100%; height: 100%; inset: 0px; background-color: rgba(0, 0, 0, 0); z-index: 300000;\"]",
"\"]:not([style^=\"width: 1px; height: 1px; position: absolute; left: -10000px; top: -\"])",
"acs, document.createElement, %2Fl%5C.parentNode%5C.insertBefore%5C(s%2F",
"%2Fvisit%2F%22%5D%5Btitle%5E%3D%22https%3A%2F%2F%22%5D, %5Btitle%5D",
"rmnt, script, %2Fh%3DdecodeURIComponent%7CpopundersPerIP%2F",
":not([style^=\"position: absolute; left: -5000px\"])",
"href-sanitizer, a%5Bhref%5E%3D%22https%3A%2F%2F",
"ra, oncontextmenu%7Condragstart%7Conselectstart",
"acs, document.querySelectorAll, popMagic",
"acs, addEventListener, google_ad_client",
"acis, document.querySelectorAll, popMagic",
"nostif, f.parentNode.removeChild(f), 100",
"acis, Object.defineProperty, vocabulary",
"aost, String.prototype.charCodeAt, ai_",
"://paid.outbrain.com/network/redir?\"]",
"aopr, app_vars.force_disable_adblock",
"paid.outbrain.com/network/redir?\"]",
"acs, document.addEventListener, ",
"acs, document.getElementById, ",
"no-fetch-if, googlesyndication",
"aeld, /^(?:click|mousedown)$/, _0x",
"acis, document.getElementById, ",
"acis, JSON.parse, break;case $.",
"acis, document.createElement, ",
"aopr, document.dispatchEvent",
"no-xhr-if, googlesyndication",
", document.createElement, ",
"acs, String.fromCharCode, ",
"%2522%253Afalse%252C%2522",
", document.oncontextmenu",
"aeld, DOMContentLoaded, ",
"acis, String.fromCharCode, ",
"Date.prototype.toUTCString",
"acis, Math, break;case $.",
"nosiif, visibility, 1000",
"set-local-storage-item, ",
"trusted-click-element, ",
"document.onselectstart",
"acis, Math, zfgloaded",
"set, blurred, false",
"acs, eval, replace",
"decodeURIComponent",
"window.open-defuser",
"aopw, Fingerprint2",
"[target=\"_blank\"]",
"%22%3Afalse%2C%22",
"^script:has-text(",
"Object.prototype.",
"[href^=\"https://",
"[href^=\"http://",
"[href=\"https://",
"[src^=\"https://",
"modal-backdrop",
"rmnt, script, ",
"disableSelection",
":nth-of-type(",
"#custom_html-",
"advertisement",
"BlockDetected",
"console.clear",
"no-fetch-if, ",
":first-child",
"[href^=\"http",
"dEventListen",
"trusted-set-",
", document.",
".prototype.",
"[href=\"http",
"contextmenu",
"no-fetch-if",
"div[style=\"",
"leaderboard",
"otification",
":has-text(",
"px; height:",
", noopFunc",
"AaDetector",
"aopw, _pop",
"background",
"[class*=\"",
"s-dummy.js",
"[class^=\"",
"[href^=\"/",
"AAAAAAAAA",
"body,html",
"container",
"Container",
"affiliate",
"decodeURI",
"div[class",
"div[id^=\"",
"div[style",
"document.",
"no-xhr-if",
"ompliance",
"placehold",
"sbygoogle",
"rectangle",
"[href*=\"",
"#wpsafe-",
"Detector",
"[width=\"",
"disclaim",
"nano-sib",
"nextFunc",
"noopFunc",
"nostif, ",
"nowebrtc",
"ontainer",
"skyscrap",
"://www.",
".com/\"]",
"#ctl00_",
"300x250",
"article",
"consent",
"Consent",
"content",
"display",
"message",
"Message",
"overlay",
"privacy",

@@ -100,12 +93,19 @@ "sidebar",

"wrapper",
"[class",
"[data-",
"%7B%7D",
"[style",
"%2C%22",
"728x90",
"accept",
"Accept",
"acis, ",
"aeld, ",
"aopr, ",
"aopw, ",
"banner",
"bottom",
"Bottom",
"cookie",
"Cookie",
"google",
"nosiif",

@@ -117,49 +117,50 @@ "notice",

"script",
"Script",
"widget",
":has(",
"width:",
":not(",
".com/",
"block",
"Block",
"click",
"deskt",
"disab",
"fixed",
"etect",
"ExoLo",
"frame",
"modal",
"popup",
"video",
"0px;",
"2%3A",
"aeld",
"promo",
"sense",
"set, ",
"body",
"butt",
"dfp-",
"down",
"foot",
"gdpr",
"goog",
"html",
"icky",
"ight",
"Info",
"show",
"text",
"tion",
"true",
"view",
" > ",
"%3D",
"%7C",
"://",
"728",
"age",
"box",
"Box",
"div",
"ent",
"out",
"ide",
"img",
"lay",
"mod",
"px;",
"rap",
"set",
"__",
"sby",
"top",
", ",
".t",
".m",
"\"]",
"%2",
"%5",
"=\"",
"00",
"ab",
"ac",

@@ -169,2 +170,3 @@ "ad",

"al",
"am",
"an",

@@ -175,12 +177,12 @@ "ar",

"ed",
"el",
"en",
"er",
"he",
"ic",
"id",
"in",
"is",
"la",
"it",
"le",
"lo",
"od",
"ol",

@@ -192,10 +194,12 @@ "om",

"re",
"ro",
"s_",
"s-",
"se",
"sp",
"st",
"t-",
"te",
"ti",
"un",
"ut",
" ",

@@ -207,3 +211,2 @@ "_",

".",
"(",
")",

@@ -215,3 +218,3 @@ "[",

"#",
"^",
"%",
"0",

@@ -227,2 +230,3 @@ "1",

"9",
"a",
"b",

@@ -242,5 +246,5 @@ "B",

"H",
"i",
"I",
"j",
"J",
"k",

@@ -258,3 +262,2 @@ "l",

"q",
"Q",
"r",

@@ -269,3 +272,2 @@ "R",

"v",
"V",
"w",

@@ -275,6 +277,4 @@ "W",

"y",
"Y",
"z",
"Z"
"z"
];
//# sourceMappingURL=cosmetic-selector.js.map
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -12,66 +12,113 @@ * This Source Code Form is subject to the terms of the Mozilla Public

exports.default = [
"script-src 'self' *.leadpages.net *.gstatic.com *.google.com *.googleapis.com *.playwire.com *.facebook.com *.bootstrapcdn.com *.twitter.com *.spot.im",
"sandbox allow-forms allow-same-origin allow-scripts allow-modals allow-orientation-lock allow-pointer-lock allow-presentation allow-top-navigation",
"script-src 'self' *.leadpages.net *.gstatic.com *.google.com *.googleapis.com *.playwire.com *.facebook.com *.bootstrapcdn.com",
"script-src 'self' *.gstatic.com *.google.com *.googleapis.com *.facebook.com *.bootstrapcdn.com *.twitter.com *.spot.im",
"script-src 'self' 'unsafe-eval' http: https: data: blob: mediastream: filesystem:",
"script-src 'self' 'unsafe-inline' 'unsafe-eval' ",
" *.google.com *.gstatic.com *.googleapis.com",
".com *.google.com *.googletagmanager.com *.",
"script-src 'self' '*' 'unsafe-inline'",
" *.hcaptcha.com *.googleapis.com *.jquery.com *.googletagmanager.com *.c",
" *.gstatic.com *.google.com *.solvemedia.com *.recaptcha.net",
"script-src http: https: 'self' * 'unsafe-inline'",
"child-src 'none';frame-src *;worker-src 'none';",
" *.gstatic.com *.google.com *.googleapis.com",
" 'self' 'unsafe-eval' 'unsafe-inline' ",
"script-src 'self' * 'unsafe-inline'",
"default-src 'unsafe-inline' 'self'",
" *.google.com *.gstatic.com *.",
"t-src 'self' 'unsafe-inline' ",
" *.recaptcha.net *.solvemedia.com",
"script-src 'self' 'unsafe-inline'",
"script-src 'self' * blob: data:",
"script-src * 'unsafe-inline'",
".com *.googleapis.com *.",
" *.googletagmanager.com",
"default-src 'self' *.",
"frame-src 'self' *",
" *.google.com *.gstatic.com",
" *.gstatic.com *.google.com",
".com *.google-analytics.com",
".com *.googletagmanager.com",
"-src 'self' *.google.com",
" 'unsafe-eval' data: ",
".com *.cloudflare.com",
" *.googleapis.com *.",
" *.googletagservices",
" *.bootstrapcdn.com",
" *.google-analytics",
".com https://disqus",
"connect-src 'self'",
" *.cloudflare.com",
"child-src 'none';",
"scorecardresearch",
"worker-src 'none'",
" 'unsafe-inline'",
"google-analytics",
" *.recaptcha.net",
"frame-src 'self'",
"googletagmanager",
"'unsafe-inline'",
" 'unsafe-eval'",
"bootstrapcdn",
"connect-src ",
"child-src *",
" *.gstatic",
"googleapis",
"facebook.net",
"jsdelivr.net",
" *.facebook",
"connect-src",
"script-src ",
"script-src",
"style-src ",
" data: *.",
" https://",
"child-src",
"disquscdn",
"frame-src",
"loudflare",
" 'none';",
"*.google",
"facebook",
"https://",
" 'self'",
"hcaptcha",
" https:",
".com *.",
".net *.",
"addthis",
"captcha",
"cdn.net",
"gstatic",
"twitter",
"youtube",
"defaul",
" data:",
" http:",
"'self'",
"disqus",
"google",
"jquery",
"data:",
"scrip",
"-src",
"blob:",
"media",
"ytimg",
".com",
".net",
"n.cc",
".org",
"apis",
"cdn.",
" *.",
".tv",
"age",
"dia",
"img",
"vic",
"ant",
"def",
"jwp",
"ram",
"sta",
"tic",
" *",
"; ",
"*.",
"an",
"at",
"ch",
"el",
"co",
"ct",
"en",
"er",
"fo",
"im",
"in",
"ir",
"le",
"ly",
"ne",
"ol",
"oo",
"qu",
"ra",
"re",
"tt",
"wi",
"un",
"wp",
"yt",
"ww",
" ",

@@ -85,3 +132,4 @@ "-",

"/",
"3",
"2",
"5",
"a",

@@ -111,4 +159,5 @@ "b",

"x",
"y"
"y",
"z"
];
//# sourceMappingURL=network-csp.js.map
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -12,74 +12,52 @@ * This Source Code Form is subject to the terms of the Mozilla Public

exports.default = [
"/homad-global-configs.schneevonmorgen.com/global_config",
"/videojs-vast-vpaid@2.0.2/bin/videojs_5.vast.vpaid.min",
"/etc.clientlibs/logitech-common/clientlibs/onetrust.",
"[\\/]{1,}.*[a-zA-Z0-9]{3,7}\\/[a-zA-Z0-9]{6,}\\/.*/",
"/pagead/managed/js/adsense/*/show_ads_impl",
"/pagead/managed/js/gpt/*/pubads_impl",
"/ajax/libs/fuckadblock/*/fuckadblock.min.js",
"/dist/assets/omniture/visitorapi.min",
"/dist/assets/comscore/streamsense",
"/^https?:\\/\\/[a-z]{8,15}\\.",
"/pagead/js/adsbygoogle.js",
"/vans-adapter-google-ima",
"/js/sdkloader/ima3_dai",
"\\/[%0-9a-zA-Z]{170,}$/",
"/js/sdkloader/ima3.js",
"/videojs-contrib-ads",
"/wp-content/plugins/",
"/wp-content/uploads/",
"/wp-content/themes/",
"/detroitchicago/",
"/cdn-cgi/pe/bag2?",
"\\/[0-9]{2,9}\\/$/",
"/appmeasurement",
"/413gkwmt/init",
"/cdn-cgi/trace",
"/style/03/img/",
"\\/[a-zA-Z0-9]{",
"/www-static/js/",
"/^https?:\\/\\/",
"/^https:\\/\\/",
"notification",
"fingerprint",
"/ljub4etb/",
"[a-zA-Z0-9]",
"background",
"impression",
"[a-z0-9]{",
"/plugins/",
"/ajax/lib",
"affiliate",
"analytics",
"(.+?\\.)?",
"[0-9a-z]",
"/assets/",
"/images/",
"/pagead/",
"pageview",
"campaign",
"template",
"tisement",
"tracking",
"/assets",
"160x600",
"300x250",
"collect",
"consent",
"content",
"counter",
"default",
"metrics",
"privacy",
"[a-z]{",
"sponsor",
"visitor",
".aspx?",
"/embed",
"/video",
"120x60",
"468x60",
"728x90",
"aptcha",
"banner",
"bundle",
"client",
"cookie",
"detect",
"dn-cgi",
"google",
"iframe",
"module",
"prebid",
"public",
"metric",
"rivacy",
"script",
"source",
"widget",
".aspx",
".cgi?",
".com/",
".html",
"/api/",
"/beac",
"/html",
"/java",

@@ -89,48 +67,55 @@ "/stat",

"click",
"count",
"clude",
"event",
"frame",
"image",
"manag",
"media",
"pixel",
"popup",
"right",
"track",
"type=",
".css",
"video",
".gif",
".htm",
".jpg",
".min",
".php",
".png",
".swf",
"/img",
"/jqu",
"/js/",
"/lib",
"/log",
"/web",
"/wp-",
"468x",
"data",
"gdpr",
"book",
"gi-b",
"ight",
"mail",
"plug",
"show",
"html",
"http",
"nfig",
"page",
"play",
"stat",
"uild",
"tion",
"view",
"?*&",
".js",
"/ad",
"/js",
"^*/",
"=*&",
"age",
"fig",
"468",
"728",
"aff",
"box",
"dpr",
"ext",
"how",
"jax",
"key",
"lay",
"log",
"sdk",
"lug",
"tag",
"und",
"unt",
"web",
"ync",
"*/",
"-p",
".*",
".m",
"*^",

@@ -140,16 +125,19 @@ "/_",

"/*",
"/1",
"/d",
"/e",
"/f",
"/g",
"/h",
"/l",
"/i",
"/j",
"/m",
"/n",
"/p",
"/r",
"/u",
"/v",
"/w",
"\\/",
"^*",
"0_",
"00",
"ab",
"ac",

@@ -164,20 +152,25 @@ "ad",

"at",
"bo",
"ce",
"ch",
"ck",
"co",
"ct",
"de",
"di",
"e_",
"e-",
"e/",
"ed",
"el",
"em",
"en",
"eo",
"er",
"es",
"et",
"ew",
"fo",
"g/",
"ga",
"he",
"ic",
"id",
"il",
"im",

@@ -187,3 +180,2 @@ "in",

"it",
"js",
"la",

@@ -193,4 +185,9 @@ "le",

"lo",
"m/",
"ma",
"mm",
"mo",
"mp",
"o/",
"ns",
"nt",
"ol",

@@ -202,2 +199,4 @@ "om",

"ot",
"p-",
"qu",
"re",

@@ -209,8 +208,8 @@ "ro",

"s/",
"se",
"si",
"sp",
"ss",
"st",
"t/",
"te",
"ti",
"tm",

@@ -221,2 +220,3 @@ "tr",

"un",
"up",
"ur",

@@ -226,9 +226,9 @@ "us",

"ve",
"y/",
"yn",
"_",
"-",
",",
":",
"?",
".",
"}",
"*",

@@ -235,0 +235,0 @@ "/",

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -12,48 +12,44 @@ * This Source Code Form is subject to the terms of the Mozilla Public

exports.default = [
"securepubads.g.doubleclick",
".xx.fbcdn.net.iberostar",
"googlesyndication",
"imasdk.googleapis",
".cloudfront.net",
".actonservice",
"analytics.",
"marketing.",
"tracking.",
"metrics.",
"images.",
"cdnjs.cloudflare",
"googletagmanager",
"ajax.googleapis",
"doubleclick.net",
"cloudfront.net",
"affiliate",
"amazonaws",
"analytics",
"facebook",
"traffic",
".co.uk",
"a8clk.",
"stats.",
"a8cv.",
".fwmrm",
"google",
"phncdn",
".club",
".info",
".site",
"click",
"count",
"media",
"track",
".bid",
".com",
".net",
".top",
".xyz",
"tion",
"www.",
"news",
"stat",
"tube",
".io",
".jp",
"app",
".ru",
"cdn",
"new",
"ght",
"pix",
"pro",
"web",
".b",
".c",
".d",
".f",
".g",
".h",
".k",
".m",
".1",
".n",
".p",
".s",
".t",
".v",
".w",
"a1",
"a4",
"a8",
"24",
"ab",

@@ -64,2 +60,3 @@ "ac",

"ag",
"ah",
"ai",

@@ -77,6 +74,6 @@ "ak",

"aw",
"ax",
"ay",
"az",
"be",
"bi",
"bl",

@@ -92,5 +89,9 @@ "bo",

"cl",
"cn",
"cr",
"ct",
"cu",
"da",
"db",
"dd",
"de",

@@ -102,3 +103,2 @@ "di",

"ds",
"du",
"dy",

@@ -110,3 +110,3 @@ "e-",

"ef",
"eg",
"ek",
"el",

@@ -130,17 +130,19 @@ "em",

"fr",
"fy",
"ge",
"gh",
"gg",
"gi",
"gl",
"gn",
"go",
"gr",
"gs",
"gu",
"gy",
"hd",
"he",
"ho",
"ia",
"ib",
"hu",
"ic",
"id",
"ie",
"if",
"ig",
"ik",
"il",

@@ -153,8 +155,5 @@ "im",

"it",
"iv",
"ix",
"iz",
"jo",
"ki",
"kr",
"ks",
"la",
"ld",

@@ -165,13 +164,12 @@ "le",

"lo",
"lu",
"ly",
"ma",
"me",
"mi",
"mo",
"mp",
"my",
"ne",
"nd",
"no",
"ob",
"ok",
"ol",

@@ -183,7 +181,6 @@ "om",

"or",
"os",
"ot",
"ou",
"ow",
"pa",
"pe",
"ph",

@@ -193,10 +190,8 @@ "pl",

"pr",
"ps",
"pu",
"qu",
"ra",
"re",
"ri",
"ro",
"ru",
"ry",
"s-",
"sc",

@@ -207,2 +202,3 @@ "se",

"sk",
"sm",
"sn",

@@ -216,3 +212,2 @@ "so",

"sy",
"t-",
"ta",

@@ -222,2 +217,3 @@ "te",

"ti",
"tm",
"tn",

@@ -228,2 +224,3 @@ "to",

"tu",
"tv",
"tw",

@@ -238,7 +235,10 @@ "ty",

"us",
"ut",
"ve",
"vi",
"vo",
"we",
"wi",
"xx",
"xy",
"yp",
"zz",
"-",

@@ -245,0 +245,0 @@ ".",

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -12,22 +12,16 @@ * This Source Code Form is subject to the terms of the Mozilla Public

exports.default = [
"googlesyndication.com/adsbygoogle.js",
"google-analytics.com/analytics.js",
"googlesyndication_adsbygoogle.js",
"googletagmanager.com/gtm.js",
"googletagservices_gpt.js",
"googletagmanager_gtm.js",
"fuckadblock.js-3.2.0",
"amazon_apstag.js",
"google-analytics",
"fingerprint2.js",
"noop-1s.mp4:10",
"-transparent.",
"google-ima.js",
"noop-0.1s.mp3",
"prebid-ads.js",
"nobab2.js:10",
"noopmp3-0.1s",
"noop-1s.mp4",
"hd-main.js",
"noopmp4-1s",
"32x32.png",
"noop.html",
"nobab2.js",
"noopframe",

@@ -38,20 +32,28 @@ "noop.txt",

"2x2.png",
"3x2.png",
"noop.js",
"noopjs",
".com/",
".js:5",
"noop",
":10",
"1s.mp",
"noop-",
"atus",
".js",
"ads",
"bea",
"tag",
"_a",
":5",
"/a",
"am",
"ar",
"ch",
"em",
"ge",
"ic",
"in",
"le",
"ng",
"on",
"op",
"ou",
"pt",
"re",

@@ -63,2 +65,3 @@ "st",

".",
"*",
"/",

@@ -65,0 +68,0 @@ "0",

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -13,48 +13,57 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"-webkit-touch-callou",
"app_vars.force_disab",
"nosiif, visibility, ",
"overflow: auto !impo",
"rtant; position: ini",
"set-local-storage-it",
"set, blurred, false)",
".force_disable_adblo",
"+js(acis, Math, zfgl",
"+js(nosiif, visibili",
"+js(window.open-defu",
"document.dispatchEve",
"pornhubthbh7ap3u.oni",
"querySelectorAll, po",
"user-select: text !i",
"##^script:has-text(",
"##body,html:style(",
"decodeURIComponent",
"[href^=\"https://",
"acs, document.",
"rmnt, script, ",
" !important;",
"trusted-set-",
"+js(acis, document.",
"decodeURIComponent)",
"+js(acs, document.",
"^script:has-text(",
", break;case $.)",
"+js(trusted-set-",
"getElementById, ",
"blurred, false)",
"BlockDetected)",
"+js(nowebrtc)",
"t: default !i",
",www.google.",
"[href^=\"http",
"+js(nano-sib",
"+js(nostif, ",
"div[class^=\"",
", noopFunc)",
",airfrance.",
"+js(nowoif)",
"contextmenu",
"no-fetch-if",
"div[style=\"",
"otification",
".com##+js(",
"%2522%253A",
"%252C%2522",
"=\"https://",
"+js(acis, ",
"+js(aeld, ",
"+js(aopr, ",
"+js(aopw, ",
"background",
"t: default",
" -webkit-",
".*,xhamst",
"container",
".blogspot",
"+js(set, ",
"div[id^=\"",
"mportant;",
"AAAAAAAA",
"disclaim",
"nostif, ",
",google",
"ty, 1000)",
"[width=\"",
"ontainer",
", true)",
"://www.",
":style(",
".co.uk,",
"consent",
"300x250",
"content",
"message",
"nowoif)",
"privacy",
"-wrapp",
",kayak",
"[class",
"##+js(",
"accept",
"aopr, ",
"sponsor",
" -moz-",
".co.uk",
".co.za",
".com##",
"banner",

@@ -64,61 +73,41 @@ "bottom",

"Cookie",
"notice",
"google",
"policy",
"widget",
":has(",
"##div",
"width:",
".com,",
"app_v",
"block",
"cript",
"true)",
".co.",
"daily",
"movie",
"wrapp",
".au,",
".com",
".de,",
".fr,",
".net",
".nl,",
".pl,",
".xyz",
"#@#.",
"2%3A",
"+js(",
"down",
"foot",
"gdpr",
"goog",
"html",
"ight",
"news",
"text",
"wrap",
"tube",
" > ",
".*,",
"##.",
"###",
"%3D",
"%7C",
"ent",
"lay",
"://",
"728",
"age",
"px;",
"web",
"__",
"-s",
"-t",
", ",
",b",
",c",
",f",
",g",
",m",
",p",
",s",
",t",
": ",
".*",
".b",
".c",
".m",
".n",
".p",
".s",
".t",
"\"]",
"##",
"%2",
"%5",
"=\"",
"00",
"a-",
"ab",

@@ -128,5 +117,2 @@ "ac",

"Ad",
"af",
"ag",
"ak",
"al",

@@ -137,20 +123,16 @@ "am",

"ar",
"as",
"at",
"au",
"av",
"ay",
"az",
"bo",
"ca",
"ce",
"ch",
"ck",
"co",
"ct",
"da",
"de",
"di",
"do",
"e-",
"ed",
"el",
"em",
"en",

@@ -160,28 +142,35 @@ "er",

"et",
"ex",
"ew",
"fi",
"fo",
"ft",
"ga",
"ge",
"go",
"he",
"ho",
"ic",
"id",
"if",
"ig",
"il",
"im",
"in",
"is",
"it",
"ke",
"la",
"ld",
"le",
"li",
"lo",
"ma",
"me",
"mo",
"mp",
"na",
"no",
"ol",
"om",
"on",
"op",
"or",
"ot",
"ov",
"ow",
"po",
"ra",
"re",

@@ -191,12 +180,17 @@ "ro",

"s-",
"sc",
"se",
"sh",
"si",
"sk",
"so",
"sp",
"ss",
"st",
"t-",
"te",
"th",
"ti",
"to",
"tr",
"tv",
"ub",

@@ -212,2 +206,3 @@ "ul",

"vi",
"xt",
" ",

@@ -220,7 +215,8 @@ "_",

".",
"(",
")",
"[",
"*",
"/",
"^",
"#",
"%",
"0",

@@ -258,3 +254,5 @@ "1",

"n",
"N",
"o",
"O",
"p",

@@ -270,4 +268,6 @@ "P",

"u",
"U",
"v",
"w",
"W",
"x",

@@ -274,0 +274,0 @@ "y",

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -12,71 +12,102 @@ * This Source Code Form is subject to the terms of the Mozilla Public

exports.default = [
",redirect-rule=1x1.g",
"/js/sdkloader/ima3.j",
"|realmomsrealreviews",
"pornhubthbh7ap3u.oni",
",redirect-rule=noop",
"|patriotoutdoornews",
".com^$third-party",
"googlesyndication",
"imasdk.googleapis",
".cloudfront.net^",
",redirect-rule=",
"/cdn-cgi/pe/bag2?",
"|themattwalshblog",
" 'unsafe-inline'",
"/pagead/js/adsby",
"\\/[0-9]{2,9}\\/$/",
"/www-static/js/",
"$script,domain=",
",redirect=noop",
"|downdetector.",
"cdnjs.cloudfla",
"cloudfront.net",
"xmlhttprequest",
".actonservice",
"^$third-party",
"||smetrics.",
"^$generichide",
"/wp-content/",
"doubleclick",
"subdocument",
"syndication",
"third-party",
"marketing.",
"^$document",
"stylesheet",
"|https://",
"affiliate",
"analytics",
",domain=",
"metrics.",
"|http://",
"facebook",
"spiegel.",
"tracking",
"^$ghide",
"$script",
"300x250",
"domain=",
".club^",
".co.uk",
"$ghide",
"a8clk.",
"/ajax/",
"banner",
"cookie",
"Cookie",
"google",
"movies",
"phncdn",
"script",
"stats.",
".com^",
".top^",
".xyz^",
"/wp-c",
"$doma",
"a8cv.",
"count",
"daily",
"frame",
"image",
"media",
"right",
"track",
".au^",
"video",
".com",
".fr^",
".gif",
".jp^",
".net",
"/js/",
"$doc",
".php",
".xyz",
"^$3p",
"$xhr",
"www.",
"down",
"html",
"news",
"play",
"stat",
"tube",
"view",
" *.",
",1p",
",3p",
".jp",
".js",
"app",
".ru",
".tv",
"^*/",
"cdn",
"ent",
"js,",
"new",
"pro",
"the",
"web",
".b",
".c",
".d",
".f",
".k",
".m",
".n",
".p",
".s",
".t",
"@@",
"/*",
"/$",
"/j",
"/p",
"^$",
"||",
"|h",
"|k",
"|m",
"|w",
"10",
"ab",

@@ -98,3 +129,2 @@ "ac",

"aw",
"ax",
"ay",

@@ -105,7 +135,5 @@ "az",

"br",
"ca",
"ce",
"ch",
"ck",
"cl",
"cr",

@@ -116,7 +144,2 @@ "ct",

"do",
"ds",
"e-",
"e^",
"eb",
"ec",
"ed",

@@ -126,3 +149,2 @@ "el",

"en",
"ep",
"er",

@@ -132,20 +154,12 @@ "es",

"ev",
"ew",
"ex",
"fe",
"ff",
"fi",
"fl",
"fo",
"fr",
"g^",
"ge",
"gi",
"go",
"gr",
"gu",
"he",
"hi",
"ho",
"hp",
"ht",
"ic",

@@ -157,3 +171,2 @@ "id",

"in",
"io",
"ip",

@@ -163,11 +176,8 @@ "ir",

"it",
"iv",
"ix",
"iz",
"jo",
"js",
"ke",
"le",
"li",
"lo",
"lu",
"ly",

@@ -177,7 +187,3 @@ "me",

"mp",
"my",
"ne",
"no",
"od",
"ok",
"ol",

@@ -188,3 +194,2 @@ "om",

"or",
"ot",
"pl",

@@ -195,8 +200,5 @@ "po",

"re",
"ri",
"ro",
"ru",
"s-",
"s/",
"sc",
"se",

@@ -207,14 +209,9 @@ "sh",

"sp",
"ss",
"st",
"su",
"sw",
"te",
"th",
"ti",
"to",
"tr",
"ts",
"tv",
"ub",
"ud",
"ul",

@@ -228,4 +225,4 @@ "um",

"ve",
"vi",
"yo",
" ",
"_",

@@ -236,4 +233,6 @@ "-",

".",
"'",
"*",
"/",
"&",
"^",

@@ -255,2 +254,3 @@ "=",

"a",
"A",
"b",

@@ -257,0 +257,0 @@ "c",

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -5,0 +5,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -5,0 +5,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -5,0 +5,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -5,0 +5,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -5,0 +5,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -44,11 +44,14 @@ * This Source Code Form is subject to the terms of the Mozilla Public

serialize(buffer: StaticDataView): void;
getHtmlRules({ domain, hostname, isFilterExcluded, }: {
getHtmlFilters({ domain, hostname, isFilterExcluded, }: {
domain: string;
hostname: string;
isFilterExcluded?: (filter: CosmeticFilter) => boolean;
}): CosmeticFilter[];
}): {
filters: CosmeticFilter[];
unhides: CosmeticFilter[];
};
/**
* Request cosmetics and scripts to inject in a page.
*/
getCosmeticsFilters({ domain, hostname, classes, hrefs, ids, allowGenericHides, allowSpecificHides, getBaseRules, getInjectionRules, getExtendedRules, getRulesFromDOM, getRulesFromHostname, isFilterExcluded, }: {
getCosmeticsFilters({ domain, hostname, classes, hrefs, ids, allowGenericHides, allowSpecificHides, getRulesFromDOM, getRulesFromHostname, isFilterExcluded, }: {
domain: string;

@@ -61,5 +64,2 @@ hostname: string;

allowSpecificHides: boolean;
getBaseRules?: boolean;
getInjectionRules?: boolean;
getExtendedRules?: boolean;
getRulesFromDOM?: boolean;

@@ -69,5 +69,14 @@ getRulesFromHostname?: boolean;

}): {
injections: CosmeticFilter[];
filters: CosmeticFilter[];
unhides: CosmeticFilter[];
};
getStylesheetsFromFilters({ filters, extendedFilters, }: {
filters: CosmeticFilter[];
extendedFilters: CosmeticFilter[];
}, { getBaseRules, allowGenericHides, }: {
getBaseRules: any;
allowGenericHides: any;
}): {
stylesheet: string;
extended: IMessageFromBackground['extended'];
stylesheet: string;
};

@@ -74,0 +83,0 @@ /**

"use strict";
/* eslint-disable @typescript-eslint/unbound-method */
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -259,19 +258,19 @@ * This Source Code Form is subject to the terms of the Mozilla Public

}
getHtmlRules({ domain, hostname, isFilterExcluded, }) {
getHtmlFilters({ domain, hostname, isFilterExcluded, }) {
const filters = [];
// Tokens from `hostname` and `domain` which will be used to lookup filters
// from the reverse index. The same tokens are re-used for multiple indices.
const hostnameTokens = createLookupTokens(hostname, domain);
const rules = [];
this.htmlIndex.iterMatchingFilters(hostnameTokens, (rule) => {
if (rule.match(hostname, domain) && !(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(rule))) {
rules.push(rule);
filters.push(rule);
}
return true;
});
const unhides = [];
// If we found at least one candidate, check if we have unhidden rules.
const disabledRules = new Set();
if (rules.length !== 0) {
if (filters.length !== 0) {
this.unhideIndex.iterMatchingFilters(hostnameTokens, (rule) => {
if (rule.match(hostname, domain) && !(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(rule))) {
disabledRules.add(rule.getSelector());
unhides.push(rule);
}

@@ -281,3 +280,3 @@ return true;

}
return rules.filter((rule) => disabledRules.size === 0 || disabledRules.has(rule.getSelector()) === false);
return { filters, unhides };
}

@@ -289,7 +288,7 @@ /**

// Allows to specify which rules to return
getBaseRules = true, getInjectionRules = true, getExtendedRules = true, getRulesFromDOM = true, getRulesFromHostname = true, isFilterExcluded, }) {
getRulesFromDOM = true, getRulesFromHostname = true, isFilterExcluded, }) {
// Tokens from `hostname` and `domain` which will be used to lookup filters
// from the reverse index. The same tokens are re-used for multiple indices.
const hostnameTokens = createLookupTokens(hostname, domain);
const rules = [];
const filters = [];
// =======================================================================

@@ -300,10 +299,10 @@ // Rules: hostname-specific

if (getRulesFromHostname === true) {
this.hostnameIndex.iterMatchingFilters(hostnameTokens, (rule) => {
this.hostnameIndex.iterMatchingFilters(hostnameTokens, (filter) => {
// A hostname-specific filter is considered if it's a scriptlet (not
// impacted by disabling of specific filters) or specific hides are
// allowed.
if ((allowSpecificHides === true || rule.isScriptInject() === true) &&
rule.match(hostname, domain) &&
!(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(rule))) {
rules.push(rule);
if ((allowSpecificHides === true || filter.isScriptInject() === true) &&
filter.match(hostname, domain) &&
!(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(filter))) {
filters.push(filter);
}

@@ -321,5 +320,5 @@ return true;

const genericRules = this.getGenericRules();
for (const rule of genericRules) {
if (rule.match(hostname, domain) === true && !(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(rule))) {
rules.push(rule);
for (const filter of genericRules) {
if (filter.match(hostname, domain) === true && !(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(filter))) {
filters.push(filter);
}

@@ -332,5 +331,5 @@ }

if (allowGenericHides === true && getRulesFromDOM === true && classes.length !== 0) {
this.classesIndex.iterMatchingFilters((0, utils_js_1.hashStrings)(classes), (rule) => {
if (rule.match(hostname, domain) && !(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(rule))) {
rules.push(rule);
this.classesIndex.iterMatchingFilters((0, utils_js_1.hashStrings)(classes), (filter) => {
if (filter.match(hostname, domain) && !(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(filter))) {
filters.push(filter);
}

@@ -344,5 +343,5 @@ return true;

if (allowGenericHides === true && getRulesFromDOM === true && ids.length !== 0) {
this.idsIndex.iterMatchingFilters((0, utils_js_1.hashStrings)(ids), (rule) => {
if (rule.match(hostname, domain) && !(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(rule))) {
rules.push(rule);
this.idsIndex.iterMatchingFilters((0, utils_js_1.hashStrings)(ids), (filter) => {
if (filter.match(hostname, domain) && !(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(filter))) {
filters.push(filter);
}

@@ -356,5 +355,5 @@ return true;

if (allowGenericHides === true && getRulesFromDOM === true && hrefs.length !== 0) {
this.hrefsIndex.iterMatchingFilters((0, compact_set_js_1.compactTokens)((0, compact_set_js_1.concatTypedArrays)(hrefs.map((href) => (0, utils_js_1.tokenizeNoSkip)(href)))), (rule) => {
if (rule.match(hostname, domain) && !(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(rule))) {
rules.push(rule);
this.hrefsIndex.iterMatchingFilters((0, compact_set_js_1.compactTokens)((0, compact_set_js_1.concatTypedArrays)(hrefs.map((href) => (0, utils_js_1.tokenizeNoSkip)(href)))), (filter) => {
if (filter.match(hostname, domain) && !(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(filter))) {
filters.push(filter);
}

@@ -364,9 +363,7 @@ return true;

}
const extended = [];
const injections = [];
const styles = [];
const unhides = [];
// If we found at least one candidate, check if we have unhidden rules,
// apply them and dispatch rules into `injections` (i.e.: '+js(...)'),
// `extended` (i.e. :not(...)), and `styles` (i.e.: '##rule').
if (rules.length !== 0) {
if (filters.length !== 0) {
// =======================================================================

@@ -377,59 +374,35 @@ // Rules: unhide

// rules from other indices.
let injectionsDisabled = false;
const disabledRules = new Set();
this.unhideIndex.iterMatchingFilters(hostnameTokens, (rule) => {
if (rule.match(hostname, domain) && !(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(rule))) {
disabledRules.add(rule.getSelector());
// Detect special +js() rules to disable scriptlet injections
if (rule.isScriptInject() === true &&
rule.isUnhide() === true &&
rule.getSelector().length === 0) {
injectionsDisabled = true;
}
this.unhideIndex.iterMatchingFilters(hostnameTokens, (filter) => {
if (filter.match(hostname, domain) && !(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(filter))) {
unhides.push(filter);
}
return true;
});
// Apply unhide rules + dispatch
for (const rule of rules) {
// Make sure `rule` is not un-hidden by a #@# filter
if (disabledRules.size !== 0 && disabledRules.has(rule.getSelector())) {
continue;
}
// Dispatch rules in `injections` or `styles` depending on type
if (rule.isScriptInject() === true) {
if (getInjectionRules === true && injectionsDisabled === false) {
injections.push(rule);
}
}
else if (rule.isExtended()) {
if (getExtendedRules === true) {
extended.push(rule);
}
}
else {
styles.push(rule);
}
}
}
// Create final stylesheet
return {
filters,
unhides,
};
}
getStylesheetsFromFilters({ filters, extendedFilters, }, { getBaseRules, allowGenericHides, }) {
let stylesheet = getBaseRules === false || allowGenericHides === false ? '' : this.getBaseStylesheet();
if (styles.length !== 0) {
if (filters.length !== 0) {
if (stylesheet.length !== 0) {
stylesheet += '\n\n';
}
stylesheet += createStylesheetFromRules(styles);
stylesheet += createStylesheetFromRules(filters);
}
const extendedProcessed = [];
if (extended.length !== 0) {
const extended = [];
if (extendedFilters.length !== 0) {
const extendedStyles = new Map();
for (const rule of extended) {
const ast = rule.getSelectorAST();
for (const filter of extendedFilters) {
const ast = filter.getSelectorAST();
if (ast !== undefined) {
const attribute = rule.isRemove() ? undefined : rule.getStyleAttributeHash();
const attribute = filter.isRemove() ? undefined : filter.getStyleAttributeHash();
if (attribute !== undefined) {
extendedStyles.set(rule.getStyle(), attribute);
extendedStyles.set(filter.getStyle(), attribute);
}
extendedProcessed.push({
extended.push({
ast,
remove: rule.isRemove(),
remove: filter.isRemove(),
attribute,

@@ -448,7 +421,3 @@ });

}
return {
extended: extendedProcessed,
injections,
stylesheet,
};
return { stylesheet, extended };
}

@@ -455,0 +424,0 @@ /**

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -5,0 +5,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -5,0 +5,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -5,0 +5,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -15,3 +15,3 @@ * This Source Code Form is subject to the terms of the Mozilla Public

import NetworkFilter from '../filters/network.js';
import { IListDiff, IPartialRawDiff } from '../lists.js';
import { FilterType, IListDiff, IPartialRawDiff } from '../lists.js';
import Request from '../request.js';

@@ -24,3 +24,3 @@ import Resources from '../resources.js';

import PreprocessorBucket from './bucket/preprocessor.js';
export declare const ENGINE_VERSION = 654;
export declare const ENGINE_VERSION = 657;
export interface BlockingResponse {

@@ -42,3 +42,27 @@ match: boolean;

}
export default class FilterEngine extends EventEmitter<'csp-injected' | 'html-filtered' | 'request-allowed' | 'request-blocked' | 'request-redirected' | 'request-whitelisted' | 'script-injected' | 'style-injected'> {
type NetworkFilterMatchingContext = {
request: Request;
filterType: FilterType.NETWORK;
};
type CosmeticFilterMatchingContext = {
url: string;
callerContext: any;
filterType: FilterType.COSMETIC;
};
type NetworkFilterMatchEvent = (request: Request, result: BlockingResponse) => void;
export type EngineEventHandlers = {
'request-allowed': NetworkFilterMatchEvent;
'request-blocked': NetworkFilterMatchEvent;
'request-redirected': NetworkFilterMatchEvent;
'request-whitelisted': NetworkFilterMatchEvent;
'csp-injected': (request: Request, csps: string) => void;
'html-filtered': (htmlSelectors: HTMLSelector[], url: string) => void;
'script-injected': (script: string, url: string) => void;
'style-injected': (style: string, url: string) => void;
'filter-matched': (match: {
filter?: CosmeticFilter | NetworkFilter | undefined;
exception?: CosmeticFilter | NetworkFilter | undefined;
}, context: CosmeticFilterMatchingContext | NetworkFilterMatchingContext) => any;
};
export default class FilterEngine extends EventEmitter<EngineEventHandlers> {
private static fromCached;

@@ -59,3 +83,3 @@ static empty<T extends FilterEngine>(this: new (...args: any[]) => T, config?: Partial<Config>): T;

* Attempt to initialize a blocking engine using a pre-built version served
* from Cliqz's CDN. If this fails (e.g.: if no pre-built engine is available
* from Ghostery's CDN. If this fails (e.g.: if no pre-built engine is available
* for this version of the library), then falls-back to using `fromLists(...)`

@@ -139,6 +163,7 @@ * method with the same subscriptions.

*/
getHtmlFilters({ url, hostname, domain, }: {
getHtmlFilters({ url, hostname, domain, callerContext, }: {
url: string;
hostname: string;
domain: string | null | undefined;
callerContext?: any | undefined;
}): HTMLSelector[];

@@ -149,3 +174,3 @@ /**

*/
getCosmeticsFilters({ url, hostname, domain, classes, hrefs, ids, getBaseRules, getInjectionRules, getExtendedRules, getRulesFromDOM, getRulesFromHostname, }: {
getCosmeticsFilters({ url, hostname, domain, classes, hrefs, ids, getBaseRules, getInjectionRules, getExtendedRules, getRulesFromDOM, getRulesFromHostname, callerContext, }: {
url: string;

@@ -162,2 +187,3 @@ hostname: string;

getRulesFromHostname?: boolean;
callerContext?: any | undefined;
}): IMessageFromBackground;

@@ -188,2 +214,3 @@ /**

}
export {};
//# sourceMappingURL=engine.d.ts.map
"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -50,3 +50,3 @@ * This Source Code Form is subject to the terms of the Mozilla Public

const preprocessor_js_2 = __importDefault(require("./bucket/preprocessor.js"));
exports.ENGINE_VERSION = 654;
exports.ENGINE_VERSION = 657;
function shouldApplyHideException(filters) {

@@ -116,3 +116,3 @@ if (filters.length === 0) {

* Attempt to initialize a blocking engine using a pre-built version served
* from Cliqz's CDN. If this fails (e.g.: if no pre-built engine is available
* from Ghostery's CDN. If this fails (e.g.: if no pre-built engine is available
* for this version of the library), then falls-back to using `fromLists(...)`

@@ -480,3 +480,3 @@ * method with the same subscriptions.

// Page information
url, hostname, domain, }) {
url, hostname, domain, callerContext, }) {
const htmlSelectors = [];

@@ -486,12 +486,23 @@ if (this.config.enableHtmlFiltering === false || this.config.loadCosmeticFilters === false) {

}
const rules = this.cosmetics.getHtmlRules({
domain: domain || '',
domain || (domain = '');
const { filters, unhides } = this.cosmetics.getHtmlFilters({
domain,
hostname,
isFilterExcluded: this.isFilterExcluded.bind(this),
});
for (const rule of rules) {
const extended = rule.getExtendedSelector();
if (extended !== undefined) {
const exceptions = new Map(unhides.map((unhide) => [unhide.getSelector(), unhide]));
for (const filter of filters) {
const extended = filter.getExtendedSelector();
if (extended === undefined) {
continue;
}
const exception = exceptions.get(filter.getSelector());
if (exception !== undefined) {
htmlSelectors.push(extended);
}
this.emit('filter-matched', { filter, exception }, {
url,
callerContext,
filterType: lists_js_1.FilterType.COSMETIC,
});
}

@@ -513,3 +524,3 @@ if (htmlSelectors.length !== 0) {

// Allows to specify which rules to return
getBaseRules = true, getInjectionRules = true, getExtendedRules = true, getRulesFromDOM = true, getRulesFromHostname = true, }) {
getBaseRules = true, getInjectionRules = true, getExtendedRules = true, getRulesFromDOM = true, getRulesFromHostname = true, callerContext, }) {
if (this.config.loadCosmeticFilters === false) {

@@ -523,6 +534,7 @@ return {

}
domain || (domain = '');
let allowGenericHides = true;
let allowSpecificHides = true;
const exceptions = this.hideExceptions.matchAll(request_js_1.default.fromRawDetails({
domain: domain || '',
domain,
hostname,

@@ -556,4 +568,4 @@ url,

// Lookup injections as well as stylesheets
const { injections, stylesheet, extended } = this.cosmetics.getCosmeticsFilters({
domain: domain || '',
const { filters, unhides } = this.cosmetics.getCosmeticsFilters({
domain,
hostname,

@@ -565,5 +577,2 @@ classes,

allowSpecificHides,
getBaseRules,
getInjectionRules,
getExtendedRules,
getRulesFromDOM,

@@ -573,2 +582,53 @@ getRulesFromHostname,

});
let injectionsDisabled = false;
const unhideExceptions = new Map();
for (const unhide of unhides) {
if (unhide.isScriptInject() === true &&
unhide.isUnhide() === true &&
unhide.getSelector().length === 0) {
injectionsDisabled = true;
}
unhideExceptions.set(unhide.getSelector(), unhide);
}
const injections = [];
const styleFilters = [];
const extendedFilters = [];
if (filters.length !== 0) {
// Apply unhide rules + dispatch
for (const filter of filters) {
// Make sure `rule` is not un-hidden by a #@# filter
const exception = unhideExceptions.get(filter.getSelector());
if (exception !== undefined) {
continue;
}
let applied = false;
// Dispatch filters in `injections` or `styles` depending on type
if (filter.isScriptInject() === true) {
if (getInjectionRules === true && injectionsDisabled === false) {
injections.push(filter);
applied = true;
}
}
else if (filter.isExtended()) {
if (getExtendedRules === true) {
extendedFilters.push(filter);
applied = true;
}
}
else {
styleFilters.push(filter);
applied = true;
}
if (applied) {
this.emit('filter-matched', {
filter,
exception,
}, {
url,
callerContext,
filterType: lists_js_1.FilterType.COSMETIC,
});
}
}
}
// Perform interpolation for injected scripts

@@ -583,2 +643,6 @@ const scripts = [];

}
const { stylesheet, extended } = this.cosmetics.getStylesheetsFromFilters({
filters: styleFilters,
extendedFilters,
}, { getBaseRules, allowGenericHides });
// Emit events

@@ -627,4 +691,4 @@ if (stylesheet.length !== 0) {

// Collect all CSP directives and keep track of exceptions
const disabledCsp = new Set();
const enabledCsp = new Set();
const cspExceptions = new Map();
const cspFilters = [];
for (const filter of matches) {

@@ -634,18 +698,27 @@ if (filter.isException()) {

// All CSP directives are disabled for this site
this.emit('filter-matched', { exception: filter }, { request, filterType: lists_js_1.FilterType.NETWORK });
return undefined;
}
disabledCsp.add(filter.csp);
cspExceptions.set(filter.csp, filter);
}
else {
enabledCsp.add(filter.csp);
cspFilters.push(filter);
}
}
if (cspFilters.length === 0) {
return undefined;
}
const enabledCsp = new Set();
// Combine all CSPs (except the black-listed ones)
const csps = Array.from(enabledCsp)
.filter((csp) => !disabledCsp.has(csp))
.join('; ') || undefined;
// Emit event
if (csps !== undefined) {
this.emit('csp-injected', csps, request);
for (const filter of cspFilters.values()) {
const exception = cspExceptions.get(filter.csp);
if (exception === undefined) {
enabledCsp.add(filter.csp);
}
this.emit('filter-matched', { filter, exception }, { request, filterType: lists_js_1.FilterType.NETWORK });
}
const csps = Array.from(enabledCsp).join('; ');
if (csps.length > 0) {
this.emit('csp-injected', request, csps);
}
return csps;

@@ -735,3 +808,5 @@ }

result.match = result.exception === undefined && result.filter !== undefined;
// Emit events if we found a match
if (result.filter) {
this.emit('filter-matched', { filter: result.filter, exception: result.exception }, { request, filterType: lists_js_1.FilterType.NETWORK });
}
if (result.exception !== undefined) {

@@ -738,0 +813,0 @@ this.emit('request-whitelisted', request, result);

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -5,0 +5,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -5,0 +5,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -5,0 +5,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -5,0 +5,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -5,0 +5,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -9,4 +9,24 @@ * This Source Code Form is subject to the terms of the Mozilla Public

*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};

@@ -17,3 +37,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

exports.optimizeNetwork = optimizeNetwork;
const network_js_1 = __importDefault(require("../filters/network.js"));
const network_js_1 = __importStar(require("../filters/network.js"));
const utils_js_1 = require("../utils.js");

@@ -135,3 +155,3 @@ const domains_js_1 = require("../engine/domains.js");

return new network_js_1.default(Object.assign({}, filters[0], {
mask: (0, utils_js_1.setBit)(filters[0].mask, 8388608 /* NETWORK_FILTER_MASK.isRegex */),
mask: (0, utils_js_1.setBit)(filters[0].mask, network_js_1.NETWORK_FILTER_MASK.isRegex),
rawLine: filters[0].rawLine !== undefined

@@ -143,3 +163,3 @@ ? filters.map(({ rawLine }) => rawLine).join(' <+> ')

},
groupByCriteria: (filter) => '' + (filter.getMask() & ~8388608 /* NETWORK_FILTER_MASK.isRegex */ & ~4194304 /* NETWORK_FILTER_MASK.isFullRegex */),
groupByCriteria: (filter) => '' + (filter.getMask() & ~network_js_1.NETWORK_FILTER_MASK.isRegex & ~network_js_1.NETWORK_FILTER_MASK.isFullRegex),
select: (filter) => filter.domains === undefined &&

@@ -146,0 +166,0 @@ filter.denyallow === undefined &&

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -5,0 +5,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -9,7 +9,2 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/**
* Type of an event listener (i.e.: callback). It accepts arbitrary arguments
* and is not expected to return any result.
*/
type EventListener = (...args: any[]) => void;
/**
* Simple and efficient `EventEmitter` abstraction (following conventions from

@@ -19,3 +14,3 @@ * Node.js) allowing partially typed event emitting. The set of event names is

*/
export declare class EventEmitter<EventNames> {
export declare class EventEmitter<EventHandlers extends Record<string, (...args: any[]) => any>, EventNames extends keyof EventHandlers = keyof EventHandlers> {
private onceListeners;

@@ -26,3 +21,3 @@ private onListeners;

*/
on(event: EventNames, callback: EventListener): void;
on<EventName extends EventNames>(event: EventName, callback: EventHandlers[EventName]): void;
/**

@@ -32,13 +27,12 @@ * Register an event listener for `event`; but only listen to first instance

*/
once(event: EventNames, callback: EventListener): void;
once<EventName extends EventNames>(event: EventName, callback: EventHandlers[EventName]): void;
/**
* Remove `callback` from list of listeners for `event`.
*/
unsubscribe(event: EventNames, callback: EventListener): void;
unsubscribe<EventName extends EventNames>(event: EventName, callback: EventHandlers[EventName]): void;
/**
* Emit an event. Call all registered listeners to this event.
*/
emit(event: EventNames, ...args: any[]): void;
emit<EventName extends EventNames>(event: EventName, ...args: Parameters<EventHandlers[EventName]>): void;
}
export {};
//# sourceMappingURL=events.d.ts.map
"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -5,0 +5,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -5,0 +5,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -93,2 +93,16 @@ * This Source Code Form is subject to the terms of the Mozilla Public

})();
/**
* Masks used to store options of cosmetic filters in a bitmask.
*/
var COSMETICS_MASK;
(function (COSMETICS_MASK) {
COSMETICS_MASK[COSMETICS_MASK["unhide"] = 1] = "unhide";
COSMETICS_MASK[COSMETICS_MASK["scriptInject"] = 2] = "scriptInject";
COSMETICS_MASK[COSMETICS_MASK["isUnicode"] = 4] = "isUnicode";
COSMETICS_MASK[COSMETICS_MASK["isClassSelector"] = 8] = "isClassSelector";
COSMETICS_MASK[COSMETICS_MASK["isIdSelector"] = 16] = "isIdSelector";
COSMETICS_MASK[COSMETICS_MASK["isHrefSelector"] = 32] = "isHrefSelector";
COSMETICS_MASK[COSMETICS_MASK["remove"] = 64] = "remove";
COSMETICS_MASK[COSMETICS_MASK["extended"] = 128] = "extended";
})(COSMETICS_MASK || (COSMETICS_MASK = {}));
function computeFilterId(mask, selector, domains, style) {

@@ -143,3 +157,3 @@ let hash = (utils_js_1.HASH_SEED * utils_js_1.HASH_INTERNAL_MULT) ^ mask;

if (line[afterSharpIndex] === '@') {
mask = (0, utils_js_1.setBit)(mask, 1 /* COSMETICS_MASK.unhide */);
mask = (0, utils_js_1.setBit)(mask, COSMETICS_MASK.unhide);
suffixStartIndex += 1;

@@ -169,4 +183,4 @@ }

// ##selector:remove()
mask = (0, utils_js_1.setBit)(mask, 64 /* COSMETICS_MASK.remove */);
mask = (0, utils_js_1.setBit)(mask, 128 /* COSMETICS_MASK.extended */);
mask = (0, utils_js_1.setBit)(mask, COSMETICS_MASK.remove);
mask = (0, utils_js_1.setBit)(mask, COSMETICS_MASK.extended);
line = line.slice(0, -9);

@@ -209,6 +223,6 @@ }

(domains.hostnames === undefined && domains.entities === undefined)) &&
(0, utils_js_1.getBit)(mask, 1 /* COSMETICS_MASK.unhide */) === false) {
(0, utils_js_1.getBit)(mask, COSMETICS_MASK.unhide) === false) {
return null;
}
mask = (0, utils_js_1.setBit)(mask, 2 /* COSMETICS_MASK.scriptInject */);
mask = (0, utils_js_1.setBit)(mask, COSMETICS_MASK.scriptInject);
selector = line.slice(suffixStartIndex + 4, line.length - 1);

@@ -218,3 +232,3 @@ // An empty scriptlet (i.e. '+js()') can be specified to cancel injections

// an empty scriptlet without an exception (i.e. '#@#' is mandatory).
if ((0, utils_js_1.getBit)(mask, 1 /* COSMETICS_MASK.unhide */) === false && selector.length === 0) {
if ((0, utils_js_1.getBit)(mask, COSMETICS_MASK.unhide) === false && selector.length === 0) {
return null;

@@ -227,3 +241,3 @@ }

if (selectorType === adblocker_extended_selectors_1.SelectorType.Extended) {
mask = (0, utils_js_1.setBit)(mask, 128 /* COSMETICS_MASK.extended */);
mask = (0, utils_js_1.setBit)(mask, COSMETICS_MASK.extended);
}

@@ -237,3 +251,3 @@ else if (selectorType === adblocker_extended_selectors_1.SelectorType.Invalid || !isValidCss(selector)) {

// Extended selectors should always be specific to some domain.
if (domains === undefined && (0, utils_js_1.getBit)(mask, 128 /* COSMETICS_MASK.extended */) === true) {
if (domains === undefined && (0, utils_js_1.getBit)(mask, COSMETICS_MASK.extended) === true) {
return null;

@@ -244,8 +258,8 @@ }

if ((0, utils_js_1.hasUnicode)(selector)) {
mask = (0, utils_js_1.setBit)(mask, 4 /* COSMETICS_MASK.isUnicode */);
mask = (0, utils_js_1.setBit)(mask, COSMETICS_MASK.isUnicode);
}
// Classify selector
if ((0, utils_js_1.getBit)(mask, 2 /* COSMETICS_MASK.scriptInject */) === false &&
(0, utils_js_1.getBit)(mask, 64 /* COSMETICS_MASK.remove */) === false &&
(0, utils_js_1.getBit)(mask, 128 /* COSMETICS_MASK.extended */) === false &&
if ((0, utils_js_1.getBit)(mask, COSMETICS_MASK.scriptInject) === false &&
(0, utils_js_1.getBit)(mask, COSMETICS_MASK.remove) === false &&
(0, utils_js_1.getBit)(mask, COSMETICS_MASK.extended) === false &&
selector.startsWith('^') === false) {

@@ -258,8 +272,8 @@ const c0 = selector.charCodeAt(0);

// a custom dispatch mechanism.
if ((0, utils_js_1.getBit)(mask, 2 /* COSMETICS_MASK.scriptInject */) === false) {
if ((0, utils_js_1.getBit)(mask, COSMETICS_MASK.scriptInject) === false) {
if (c0 === 46 /* '.' */ && isSimpleSelector(selector)) {
mask = (0, utils_js_1.setBit)(mask, 8 /* COSMETICS_MASK.isClassSelector */);
mask = (0, utils_js_1.setBit)(mask, COSMETICS_MASK.isClassSelector);
}
else if (c0 === 35 /* '#' */ && isSimpleSelector(selector)) {
mask = (0, utils_js_1.setBit)(mask, 16 /* COSMETICS_MASK.isIdSelector */);
mask = (0, utils_js_1.setBit)(mask, COSMETICS_MASK.isIdSelector);
}

@@ -270,3 +284,3 @@ else if (c0 === 97 /* a */ &&

isSimpleHrefSelector(selector, 2)) {
mask = (0, utils_js_1.setBit)(mask, 32 /* COSMETICS_MASK.isHrefSelector */);
mask = (0, utils_js_1.setBit)(mask, COSMETICS_MASK.isHrefSelector);
}

@@ -276,3 +290,3 @@ else if (c0 === 91 /* '[' */ &&

isSimpleHrefSelector(selector, 1)) {
mask = (0, utils_js_1.setBit)(mask, 32 /* COSMETICS_MASK.isHrefSelector */);
mask = (0, utils_js_1.setBit)(mask, COSMETICS_MASK.isHrefSelector);
}

@@ -296,3 +310,3 @@ }

const mask = buffer.getUint8();
const isUnicode = (0, utils_js_1.getBit)(mask, 4 /* COSMETICS_MASK.isUnicode */);
const isUnicode = (0, utils_js_1.getBit)(mask, COSMETICS_MASK.isUnicode);
const optionalParts = buffer.getUint8();

@@ -676,12 +690,12 @@ const selector = isUnicode ? buffer.getUTF8() : buffer.getCosmeticSelector();

isExtended() {
return (0, utils_js_1.getBit)(this.mask, 128 /* COSMETICS_MASK.extended */);
return (0, utils_js_1.getBit)(this.mask, COSMETICS_MASK.extended);
}
isRemove() {
return (0, utils_js_1.getBit)(this.mask, 64 /* COSMETICS_MASK.remove */);
return (0, utils_js_1.getBit)(this.mask, COSMETICS_MASK.remove);
}
isUnhide() {
return (0, utils_js_1.getBit)(this.mask, 1 /* COSMETICS_MASK.unhide */);
return (0, utils_js_1.getBit)(this.mask, COSMETICS_MASK.unhide);
}
isScriptInject() {
return (0, utils_js_1.getBit)(this.mask, 2 /* COSMETICS_MASK.scriptInject */);
return (0, utils_js_1.getBit)(this.mask, COSMETICS_MASK.scriptInject);
}

@@ -692,12 +706,12 @@ isCSS() {

isIdSelector() {
return (0, utils_js_1.getBit)(this.mask, 16 /* COSMETICS_MASK.isIdSelector */);
return (0, utils_js_1.getBit)(this.mask, COSMETICS_MASK.isIdSelector);
}
isClassSelector() {
return (0, utils_js_1.getBit)(this.mask, 8 /* COSMETICS_MASK.isClassSelector */);
return (0, utils_js_1.getBit)(this.mask, COSMETICS_MASK.isClassSelector);
}
isHrefSelector() {
return (0, utils_js_1.getBit)(this.mask, 32 /* COSMETICS_MASK.isHrefSelector */);
return (0, utils_js_1.getBit)(this.mask, COSMETICS_MASK.isHrefSelector);
}
isUnicode() {
return (0, utils_js_1.getBit)(this.mask, 4 /* COSMETICS_MASK.isUnicode */);
return (0, utils_js_1.getBit)(this.mask, COSMETICS_MASK.isUnicode);
}

@@ -704,0 +718,0 @@ isHtmlFiltering() {

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -5,0 +5,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -5,0 +5,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -10,2 +10,3 @@ * This Source Code Form is subject to the terms of the Mozilla Public

Object.defineProperty(exports, "__esModule", { value: true });
exports.NETWORK_FILTER_MASK = void 0;
exports.normalizeRawFilterOptions = normalizeRawFilterOptions;

@@ -77,16 +78,56 @@ exports.findLastIndexOfUnescapedCharacter = findLastIndexOfUnescapedCharacter;

/**
* Masks used to store options of network filters in a bitmask.
*/
var NETWORK_FILTER_MASK;
(function (NETWORK_FILTER_MASK) {
// Request Type
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromDocument"] = 1] = "fromDocument";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromFont"] = 2] = "fromFont";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromHttp"] = 4] = "fromHttp";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromHttps"] = 8] = "fromHttps";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromImage"] = 16] = "fromImage";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromMedia"] = 32] = "fromMedia";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromObject"] = 64] = "fromObject";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromOther"] = 128] = "fromOther";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromPing"] = 256] = "fromPing";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromScript"] = 512] = "fromScript";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromStylesheet"] = 1024] = "fromStylesheet";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromSubdocument"] = 2048] = "fromSubdocument";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromWebsocket"] = 4096] = "fromWebsocket";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromXmlHttpRequest"] = 8192] = "fromXmlHttpRequest";
// Partiness
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["firstParty"] = 16384] = "firstParty";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["thirdParty"] = 32768] = "thirdParty";
// Options
// FREE - 1 << 16
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isBadFilter"] = 131072] = "isBadFilter";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isCSP"] = 262144] = "isCSP";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isGenericHide"] = 524288] = "isGenericHide";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isImportant"] = 1048576] = "isImportant";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isSpecificHide"] = 2097152] = "isSpecificHide";
// Kind of patterns
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isFullRegex"] = 4194304] = "isFullRegex";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isRegex"] = 8388608] = "isRegex";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isUnicode"] = 16777216] = "isUnicode";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isLeftAnchor"] = 33554432] = "isLeftAnchor";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isRightAnchor"] = 67108864] = "isRightAnchor";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isException"] = 134217728] = "isException";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isHostnameAnchor"] = 268435456] = "isHostnameAnchor";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isRedirectRule"] = 536870912] = "isRedirectRule";
})(NETWORK_FILTER_MASK || (exports.NETWORK_FILTER_MASK = NETWORK_FILTER_MASK = {}));
/**
* Mask used when a network filter can be applied on any content type.
*/
const FROM_ANY = 1 /* NETWORK_FILTER_MASK.fromDocument */ |
2 /* NETWORK_FILTER_MASK.fromFont */ |
16 /* NETWORK_FILTER_MASK.fromImage */ |
32 /* NETWORK_FILTER_MASK.fromMedia */ |
64 /* NETWORK_FILTER_MASK.fromObject */ |
128 /* NETWORK_FILTER_MASK.fromOther */ |
256 /* NETWORK_FILTER_MASK.fromPing */ |
512 /* NETWORK_FILTER_MASK.fromScript */ |
1024 /* NETWORK_FILTER_MASK.fromStylesheet */ |
2048 /* NETWORK_FILTER_MASK.fromSubdocument */ |
4096 /* NETWORK_FILTER_MASK.fromWebsocket */ |
8192 /* NETWORK_FILTER_MASK.fromXmlHttpRequest */;
const FROM_ANY = NETWORK_FILTER_MASK.fromDocument |
NETWORK_FILTER_MASK.fromFont |
NETWORK_FILTER_MASK.fromImage |
NETWORK_FILTER_MASK.fromMedia |
NETWORK_FILTER_MASK.fromObject |
NETWORK_FILTER_MASK.fromOther |
NETWORK_FILTER_MASK.fromPing |
NETWORK_FILTER_MASK.fromScript |
NETWORK_FILTER_MASK.fromStylesheet |
NETWORK_FILTER_MASK.fromSubdocument |
NETWORK_FILTER_MASK.fromWebsocket |
NETWORK_FILTER_MASK.fromXmlHttpRequest;
/**

@@ -97,37 +138,37 @@ * Map content type value to mask the corresponding mask.

const REQUEST_TYPE_TO_MASK = {
beacon: 256 /* NETWORK_FILTER_MASK.fromPing */, // fromOther?
document: 1 /* NETWORK_FILTER_MASK.fromDocument */,
cspviolationreport: 128 /* NETWORK_FILTER_MASK.fromOther */,
fetch: 8192 /* NETWORK_FILTER_MASK.fromXmlHttpRequest */,
font: 2 /* NETWORK_FILTER_MASK.fromFont */,
image: 16 /* NETWORK_FILTER_MASK.fromImage */,
imageset: 16 /* NETWORK_FILTER_MASK.fromImage */,
mainFrame: 1 /* NETWORK_FILTER_MASK.fromDocument */,
main_frame: 1 /* NETWORK_FILTER_MASK.fromDocument */,
media: 32 /* NETWORK_FILTER_MASK.fromMedia */,
object: 64 /* NETWORK_FILTER_MASK.fromObject */,
object_subrequest: 64 /* NETWORK_FILTER_MASK.fromObject */,
ping: 256 /* NETWORK_FILTER_MASK.fromPing */, // fromOther?
script: 512 /* NETWORK_FILTER_MASK.fromScript */,
stylesheet: 1024 /* NETWORK_FILTER_MASK.fromStylesheet */,
subFrame: 2048 /* NETWORK_FILTER_MASK.fromSubdocument */,
sub_frame: 2048 /* NETWORK_FILTER_MASK.fromSubdocument */,
webSocket: 4096 /* NETWORK_FILTER_MASK.fromWebsocket */,
websocket: 4096 /* NETWORK_FILTER_MASK.fromWebsocket */,
xhr: 8192 /* NETWORK_FILTER_MASK.fromXmlHttpRequest */,
xmlhttprequest: 8192 /* NETWORK_FILTER_MASK.fromXmlHttpRequest */,
beacon: NETWORK_FILTER_MASK.fromPing, // fromOther?
document: NETWORK_FILTER_MASK.fromDocument,
cspviolationreport: NETWORK_FILTER_MASK.fromOther,
fetch: NETWORK_FILTER_MASK.fromXmlHttpRequest,
font: NETWORK_FILTER_MASK.fromFont,
image: NETWORK_FILTER_MASK.fromImage,
imageset: NETWORK_FILTER_MASK.fromImage,
mainFrame: NETWORK_FILTER_MASK.fromDocument,
main_frame: NETWORK_FILTER_MASK.fromDocument,
media: NETWORK_FILTER_MASK.fromMedia,
object: NETWORK_FILTER_MASK.fromObject,
object_subrequest: NETWORK_FILTER_MASK.fromObject,
ping: NETWORK_FILTER_MASK.fromPing, // fromOther?
script: NETWORK_FILTER_MASK.fromScript,
stylesheet: NETWORK_FILTER_MASK.fromStylesheet,
subFrame: NETWORK_FILTER_MASK.fromSubdocument,
sub_frame: NETWORK_FILTER_MASK.fromSubdocument,
webSocket: NETWORK_FILTER_MASK.fromWebsocket,
websocket: NETWORK_FILTER_MASK.fromWebsocket,
xhr: NETWORK_FILTER_MASK.fromXmlHttpRequest,
xmlhttprequest: NETWORK_FILTER_MASK.fromXmlHttpRequest,
// Other
cspReport: 128 /* NETWORK_FILTER_MASK.fromOther */,
csp_report: 128 /* NETWORK_FILTER_MASK.fromOther */,
eventsource: 128 /* NETWORK_FILTER_MASK.fromOther */,
manifest: 128 /* NETWORK_FILTER_MASK.fromOther */,
other: 128 /* NETWORK_FILTER_MASK.fromOther */,
prefetch: 128 /* NETWORK_FILTER_MASK.fromOther */,
preflight: 128 /* NETWORK_FILTER_MASK.fromOther */,
signedexchange: 128 /* NETWORK_FILTER_MASK.fromOther */,
speculative: 128 /* NETWORK_FILTER_MASK.fromOther */,
texttrack: 128 /* NETWORK_FILTER_MASK.fromOther */,
web_manifest: 128 /* NETWORK_FILTER_MASK.fromOther */,
xml_dtd: 128 /* NETWORK_FILTER_MASK.fromOther */,
xslt: 128 /* NETWORK_FILTER_MASK.fromOther */,
cspReport: NETWORK_FILTER_MASK.fromOther,
csp_report: NETWORK_FILTER_MASK.fromOther,
eventsource: NETWORK_FILTER_MASK.fromOther,
manifest: NETWORK_FILTER_MASK.fromOther,
other: NETWORK_FILTER_MASK.fromOther,
prefetch: NETWORK_FILTER_MASK.fromOther,
preflight: NETWORK_FILTER_MASK.fromOther,
signedexchange: NETWORK_FILTER_MASK.fromOther,
speculative: NETWORK_FILTER_MASK.fromOther,
texttrack: NETWORK_FILTER_MASK.fromOther,
web_manifest: NETWORK_FILTER_MASK.fromOther,
xml_dtd: NETWORK_FILTER_MASK.fromOther,
xslt: NETWORK_FILTER_MASK.fromOther,
};

@@ -282,6 +323,6 @@ function getListOfRequestTypesNegated(filter) {

// Represent options as a bitmask
let mask = 32768 /* NETWORK_FILTER_MASK.thirdParty */ |
16384 /* NETWORK_FILTER_MASK.firstParty */ |
8 /* NETWORK_FILTER_MASK.fromHttps */ |
4 /* NETWORK_FILTER_MASK.fromHttp */;
let mask = NETWORK_FILTER_MASK.thirdParty |
NETWORK_FILTER_MASK.firstParty |
NETWORK_FILTER_MASK.fromHttps |
NETWORK_FILTER_MASK.fromHttp;
// Temporary masks for positive (e.g.: $script) and negative (e.g.: $~script)

@@ -302,3 +343,3 @@ // content type options.

filterIndexStart += 2;
mask = (0, utils_js_1.setBit)(mask, 134217728 /* NETWORK_FILTER_MASK.isException */);
mask = (0, utils_js_1.setBit)(mask, NETWORK_FILTER_MASK.isException);
}

@@ -343,3 +384,3 @@ // filter$options == Options

case 'badfilter':
mask = (0, utils_js_1.setBit)(mask, 131072 /* NETWORK_FILTER_MASK.isBadFilter */);
mask = (0, utils_js_1.setBit)(mask, NETWORK_FILTER_MASK.isBadFilter);
break;

@@ -351,3 +392,3 @@ case 'important':

}
mask = (0, utils_js_1.setBit)(mask, 1048576 /* NETWORK_FILTER_MASK.isImportant */);
mask = (0, utils_js_1.setBit)(mask, NETWORK_FILTER_MASK.isImportant);
break;

@@ -365,7 +406,7 @@ case 'match-case':

// ~third-party means we should clear the flag
mask = (0, utils_js_1.clearBit)(mask, 32768 /* NETWORK_FILTER_MASK.thirdParty */);
mask = (0, utils_js_1.clearBit)(mask, NETWORK_FILTER_MASK.thirdParty);
}
else {
// third-party means ~first-party
mask = (0, utils_js_1.clearBit)(mask, 16384 /* NETWORK_FILTER_MASK.firstParty */);
mask = (0, utils_js_1.clearBit)(mask, NETWORK_FILTER_MASK.firstParty);
}

@@ -377,7 +418,7 @@ break;

// ~first-party means we should clear the flag
mask = (0, utils_js_1.clearBit)(mask, 16384 /* NETWORK_FILTER_MASK.firstParty */);
mask = (0, utils_js_1.clearBit)(mask, NETWORK_FILTER_MASK.firstParty);
}
else {
// first-party means ~third-party
mask = (0, utils_js_1.clearBit)(mask, 32768 /* NETWORK_FILTER_MASK.thirdParty */);
mask = (0, utils_js_1.clearBit)(mask, NETWORK_FILTER_MASK.thirdParty);
}

@@ -396,3 +437,3 @@ break;

if (option === 'redirect-rule') {
mask = (0, utils_js_1.setBit)(mask, 536870912 /* NETWORK_FILTER_MASK.isRedirectRule */);
mask = (0, utils_js_1.setBit)(mask, NETWORK_FILTER_MASK.isRedirectRule);
}

@@ -405,3 +446,3 @@ redirect = optionValue;

}
mask = (0, utils_js_1.setBit)(mask, 262144 /* NETWORK_FILTER_MASK.isCSP */);
mask = (0, utils_js_1.setBit)(mask, NETWORK_FILTER_MASK.isCSP);
if (optionValue.length > 0) {

@@ -416,4 +457,4 @@ csp = optionValue;

}
mask = (0, utils_js_1.setBit)(mask, 524288 /* NETWORK_FILTER_MASK.isGenericHide */);
mask = (0, utils_js_1.setBit)(mask, 2097152 /* NETWORK_FILTER_MASK.isSpecificHide */);
mask = (0, utils_js_1.setBit)(mask, NETWORK_FILTER_MASK.isGenericHide);
mask = (0, utils_js_1.setBit)(mask, NETWORK_FILTER_MASK.isSpecificHide);
break;

@@ -425,3 +466,3 @@ case 'shide':

}
mask = (0, utils_js_1.setBit)(mask, 2097152 /* NETWORK_FILTER_MASK.isSpecificHide */);
mask = (0, utils_js_1.setBit)(mask, NETWORK_FILTER_MASK.isSpecificHide);
break;

@@ -433,3 +474,3 @@ case 'ghide':

}
mask = (0, utils_js_1.setBit)(mask, 524288 /* NETWORK_FILTER_MASK.isGenericHide */);
mask = (0, utils_js_1.setBit)(mask, NETWORK_FILTER_MASK.isGenericHide);
break;

@@ -440,3 +481,3 @@ case 'inline-script':

}
mask = (0, utils_js_1.setBit)(mask, 262144 /* NETWORK_FILTER_MASK.isCSP */);
mask = (0, utils_js_1.setBit)(mask, NETWORK_FILTER_MASK.isCSP);
csp =

@@ -449,3 +490,3 @@ "script-src 'self' 'unsafe-eval' http: https: data: blob: mediastream: filesystem:";

}
mask = (0, utils_js_1.setBit)(mask, 262144 /* NETWORK_FILTER_MASK.isCSP */);
mask = (0, utils_js_1.setBit)(mask, NETWORK_FILTER_MASK.isCSP);
csp =

@@ -472,42 +513,42 @@ "font-src 'self' 'unsafe-eval' http: https: data: blob: mediastream: filesystem:";

case 'image':
optionMask = 16 /* NETWORK_FILTER_MASK.fromImage */;
optionMask = NETWORK_FILTER_MASK.fromImage;
break;
case 'media':
optionMask = 32 /* NETWORK_FILTER_MASK.fromMedia */;
optionMask = NETWORK_FILTER_MASK.fromMedia;
break;
case 'object':
case 'object-subrequest':
optionMask = 64 /* NETWORK_FILTER_MASK.fromObject */;
optionMask = NETWORK_FILTER_MASK.fromObject;
break;
case 'other':
optionMask = 128 /* NETWORK_FILTER_MASK.fromOther */;
optionMask = NETWORK_FILTER_MASK.fromOther;
break;
case 'ping':
case 'beacon':
optionMask = 256 /* NETWORK_FILTER_MASK.fromPing */;
optionMask = NETWORK_FILTER_MASK.fromPing;
break;
case 'script':
optionMask = 512 /* NETWORK_FILTER_MASK.fromScript */;
optionMask = NETWORK_FILTER_MASK.fromScript;
break;
case 'css':
case 'stylesheet':
optionMask = 1024 /* NETWORK_FILTER_MASK.fromStylesheet */;
optionMask = NETWORK_FILTER_MASK.fromStylesheet;
break;
case 'frame':
case 'subdocument':
optionMask = 2048 /* NETWORK_FILTER_MASK.fromSubdocument */;
optionMask = NETWORK_FILTER_MASK.fromSubdocument;
break;
case 'xhr':
case 'xmlhttprequest':
optionMask = 8192 /* NETWORK_FILTER_MASK.fromXmlHttpRequest */;
optionMask = NETWORK_FILTER_MASK.fromXmlHttpRequest;
break;
case 'websocket':
optionMask = 4096 /* NETWORK_FILTER_MASK.fromWebsocket */;
optionMask = NETWORK_FILTER_MASK.fromWebsocket;
break;
case 'font':
optionMask = 2 /* NETWORK_FILTER_MASK.fromFont */;
optionMask = NETWORK_FILTER_MASK.fromFont;
break;
case 'doc':
case 'document':
optionMask = 1 /* NETWORK_FILTER_MASK.fromDocument */;
optionMask = NETWORK_FILTER_MASK.fromDocument;
break;

@@ -559,3 +600,3 @@ default:

}
mask = (0, utils_js_1.setBit)(mask, 4194304 /* NETWORK_FILTER_MASK.isFullRegex */);
mask = (0, utils_js_1.setBit)(mask, NETWORK_FILTER_MASK.isFullRegex);
}

@@ -565,3 +606,3 @@ else {

if (filterIndexEnd > 0 && line.charCodeAt(filterIndexEnd - 1) === 124 /* '|' */) {
mask = (0, utils_js_1.setBit)(mask, 67108864 /* NETWORK_FILTER_MASK.isRightAnchor */);
mask = (0, utils_js_1.setBit)(mask, NETWORK_FILTER_MASK.isRightAnchor);
filterIndexEnd -= 1;

@@ -573,7 +614,7 @@ }

line.charCodeAt(filterIndexStart + 1) === 124 /* '|' */) {
mask = (0, utils_js_1.setBit)(mask, 268435456 /* NETWORK_FILTER_MASK.isHostnameAnchor */);
mask = (0, utils_js_1.setBit)(mask, NETWORK_FILTER_MASK.isHostnameAnchor);
filterIndexStart += 2;
}
else {
mask = (0, utils_js_1.setBit)(mask, 33554432 /* NETWORK_FILTER_MASK.isLeftAnchor */);
mask = (0, utils_js_1.setBit)(mask, NETWORK_FILTER_MASK.isLeftAnchor);
filterIndexStart += 1;

@@ -584,3 +625,3 @@ }

// mask = setNetworkMask(mask, NETWORK_FILTER_MASK.isRegex, isRegex);
if ((0, utils_js_1.getBit)(mask, 268435456 /* NETWORK_FILTER_MASK.isHostnameAnchor */)) {
if ((0, utils_js_1.getBit)(mask, NETWORK_FILTER_MASK.isHostnameAnchor)) {
// Split at the first character which is not allowed in a hostname

@@ -609,15 +650,15 @@ let firstSeparator = filterIndexStart;

filterIndexStart = filterIndexEnd;
mask = (0, utils_js_1.setBit)(mask, 67108864 /* NETWORK_FILTER_MASK.isRightAnchor */);
mask = (0, utils_js_1.setBit)(mask, NETWORK_FILTER_MASK.isRightAnchor);
}
else {
mask = (0, utils_js_1.setBit)(mask, 8388608 /* NETWORK_FILTER_MASK.isRegex */);
mask = (0, utils_js_1.setBit)(mask, 33554432 /* NETWORK_FILTER_MASK.isLeftAnchor */);
mask = (0, utils_js_1.setBit)(mask, NETWORK_FILTER_MASK.isRegex);
mask = (0, utils_js_1.setBit)(mask, NETWORK_FILTER_MASK.isLeftAnchor);
}
}
else if (separatorCode === 42 /* '*' */) {
mask = (0, utils_js_1.setBit)(mask, 8388608 /* NETWORK_FILTER_MASK.isRegex */);
mask = (0, utils_js_1.setBit)(mask, NETWORK_FILTER_MASK.isRegex);
// mask = setBit(mask, NETWORK_FILTER_MASK.isLeftAnchor);
}
else {
mask = (0, utils_js_1.setBit)(mask, 33554432 /* NETWORK_FILTER_MASK.isLeftAnchor */);
mask = (0, utils_js_1.setBit)(mask, NETWORK_FILTER_MASK.isLeftAnchor);
}

@@ -632,16 +673,16 @@ }

// Remove leading '*' if the filter is not hostname anchored.
if ((0, utils_js_1.getBit)(mask, 268435456 /* NETWORK_FILTER_MASK.isHostnameAnchor */) === false &&
if ((0, utils_js_1.getBit)(mask, NETWORK_FILTER_MASK.isHostnameAnchor) === false &&
filterIndexEnd - filterIndexStart > 0 &&
line.charCodeAt(filterIndexStart) === 42 /* '*' */) {
mask = (0, utils_js_1.clearBit)(mask, 33554432 /* NETWORK_FILTER_MASK.isLeftAnchor */);
mask = (0, utils_js_1.clearBit)(mask, NETWORK_FILTER_MASK.isLeftAnchor);
filterIndexStart += 1;
}
// Transform filters on protocol (http, https, ws)
if ((0, utils_js_1.getBit)(mask, 33554432 /* NETWORK_FILTER_MASK.isLeftAnchor */)) {
if ((0, utils_js_1.getBit)(mask, NETWORK_FILTER_MASK.isLeftAnchor)) {
if (filterIndexEnd - filterIndexStart === 5 &&
(0, utils_js_1.fastStartsWithFrom)(line, 'ws://', filterIndexStart)) {
mask = (0, utils_js_1.setBit)(mask, 4096 /* NETWORK_FILTER_MASK.fromWebsocket */);
mask = (0, utils_js_1.clearBit)(mask, 33554432 /* NETWORK_FILTER_MASK.isLeftAnchor */);
mask = (0, utils_js_1.clearBit)(mask, 4 /* NETWORK_FILTER_MASK.fromHttp */);
mask = (0, utils_js_1.clearBit)(mask, 8 /* NETWORK_FILTER_MASK.fromHttps */);
mask = (0, utils_js_1.setBit)(mask, NETWORK_FILTER_MASK.fromWebsocket);
mask = (0, utils_js_1.clearBit)(mask, NETWORK_FILTER_MASK.isLeftAnchor);
mask = (0, utils_js_1.clearBit)(mask, NETWORK_FILTER_MASK.fromHttp);
mask = (0, utils_js_1.clearBit)(mask, NETWORK_FILTER_MASK.fromHttps);
filterIndexStart = filterIndexEnd;

@@ -651,5 +692,5 @@ }

(0, utils_js_1.fastStartsWithFrom)(line, 'http://', filterIndexStart)) {
mask = (0, utils_js_1.setBit)(mask, 4 /* NETWORK_FILTER_MASK.fromHttp */);
mask = (0, utils_js_1.clearBit)(mask, 8 /* NETWORK_FILTER_MASK.fromHttps */);
mask = (0, utils_js_1.clearBit)(mask, 33554432 /* NETWORK_FILTER_MASK.isLeftAnchor */);
mask = (0, utils_js_1.setBit)(mask, NETWORK_FILTER_MASK.fromHttp);
mask = (0, utils_js_1.clearBit)(mask, NETWORK_FILTER_MASK.fromHttps);
mask = (0, utils_js_1.clearBit)(mask, NETWORK_FILTER_MASK.isLeftAnchor);
filterIndexStart = filterIndexEnd;

@@ -659,5 +700,5 @@ }

(0, utils_js_1.fastStartsWithFrom)(line, 'https://', filterIndexStart)) {
mask = (0, utils_js_1.setBit)(mask, 8 /* NETWORK_FILTER_MASK.fromHttps */);
mask = (0, utils_js_1.clearBit)(mask, 4 /* NETWORK_FILTER_MASK.fromHttp */);
mask = (0, utils_js_1.clearBit)(mask, 33554432 /* NETWORK_FILTER_MASK.isLeftAnchor */);
mask = (0, utils_js_1.setBit)(mask, NETWORK_FILTER_MASK.fromHttps);
mask = (0, utils_js_1.clearBit)(mask, NETWORK_FILTER_MASK.fromHttp);
mask = (0, utils_js_1.clearBit)(mask, NETWORK_FILTER_MASK.isLeftAnchor);
filterIndexStart = filterIndexEnd;

@@ -667,5 +708,5 @@ }

(0, utils_js_1.fastStartsWithFrom)(line, 'http*://', filterIndexStart)) {
mask = (0, utils_js_1.setBit)(mask, 8 /* NETWORK_FILTER_MASK.fromHttps */);
mask = (0, utils_js_1.setBit)(mask, 4 /* NETWORK_FILTER_MASK.fromHttp */);
mask = (0, utils_js_1.clearBit)(mask, 33554432 /* NETWORK_FILTER_MASK.isLeftAnchor */);
mask = (0, utils_js_1.setBit)(mask, NETWORK_FILTER_MASK.fromHttps);
mask = (0, utils_js_1.setBit)(mask, NETWORK_FILTER_MASK.fromHttp);
mask = (0, utils_js_1.clearBit)(mask, NETWORK_FILTER_MASK.isLeftAnchor);
filterIndexStart = filterIndexEnd;

@@ -676,5 +717,5 @@ }

filter = line.slice(filterIndexStart, filterIndexEnd).toLowerCase();
mask = setNetworkMask(mask, 16777216 /* NETWORK_FILTER_MASK.isUnicode */, (0, utils_js_1.hasUnicode)(filter));
if ((0, utils_js_1.getBit)(mask, 8388608 /* NETWORK_FILTER_MASK.isRegex */) === false) {
mask = setNetworkMask(mask, 8388608 /* NETWORK_FILTER_MASK.isRegex */, checkIsRegex(filter, 0, filter.length));
mask = setNetworkMask(mask, NETWORK_FILTER_MASK.isUnicode, (0, utils_js_1.hasUnicode)(filter));
if ((0, utils_js_1.getBit)(mask, NETWORK_FILTER_MASK.isRegex) === false) {
mask = setNetworkMask(mask, NETWORK_FILTER_MASK.isRegex, checkIsRegex(filter, 0, filter.length));
}

@@ -687,3 +728,3 @@ }

if ((0, utils_js_1.hasUnicode)(hostname)) {
mask = setNetworkMask(mask, 16777216 /* NETWORK_FILTER_MASK.isUnicode */, true);
mask = setNetworkMask(mask, NETWORK_FILTER_MASK.isUnicode, true);
hostname = (0, punycode_js_1.toASCII)(hostname);

@@ -712,3 +753,3 @@ }

const optionalParts = buffer.getUint8();
const isUnicode = (0, utils_js_1.getBit)(mask, 16777216 /* NETWORK_FILTER_MASK.isUnicode */);
const isUnicode = (0, utils_js_1.getBit)(mask, NETWORK_FILTER_MASK.isUnicode);
// The order of these statements is important. Since `buffer.getX()` will

@@ -990,3 +1031,3 @@ // internally increment the position of next byte to read, they need to be

// than string comparison.
return computeFilterId(this.csp, this.mask & ~131072 /* NETWORK_FILTER_MASK.isBadFilter */, this.filter, this.hostname, this.domains, this.denyallow, this.redirect);
return computeFilterId(this.csp, this.mask & ~NETWORK_FILTER_MASK.isBadFilter, this.filter, this.hostname, this.domains, this.denyallow, this.redirect);
}

@@ -1015,3 +1056,3 @@ getId() {

isRedirectRule() {
return (0, utils_js_1.getBit)(this.mask, 536870912 /* NETWORK_FILTER_MASK.isRedirectRule */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.isRedirectRule);
}

@@ -1117,22 +1158,22 @@ getRedirect() {

isException() {
return (0, utils_js_1.getBit)(this.mask, 134217728 /* NETWORK_FILTER_MASK.isException */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.isException);
}
isHostnameAnchor() {
return (0, utils_js_1.getBit)(this.mask, 268435456 /* NETWORK_FILTER_MASK.isHostnameAnchor */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.isHostnameAnchor);
}
isRightAnchor() {
return (0, utils_js_1.getBit)(this.mask, 67108864 /* NETWORK_FILTER_MASK.isRightAnchor */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.isRightAnchor);
}
isLeftAnchor() {
return (0, utils_js_1.getBit)(this.mask, 33554432 /* NETWORK_FILTER_MASK.isLeftAnchor */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.isLeftAnchor);
}
isImportant() {
return (0, utils_js_1.getBit)(this.mask, 1048576 /* NETWORK_FILTER_MASK.isImportant */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.isImportant);
}
isFullRegex() {
return (0, utils_js_1.getBit)(this.mask, 4194304 /* NETWORK_FILTER_MASK.isFullRegex */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.isFullRegex);
}
isRegex() {
return ((0, utils_js_1.getBit)(this.mask, 8388608 /* NETWORK_FILTER_MASK.isRegex */) ||
(0, utils_js_1.getBit)(this.mask, 4194304 /* NETWORK_FILTER_MASK.isFullRegex */));
return ((0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.isRegex) ||
(0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.isFullRegex));
}

@@ -1143,3 +1184,3 @@ isPlain() {

isCSP() {
return (0, utils_js_1.getBit)(this.mask, 262144 /* NETWORK_FILTER_MASK.isCSP */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.isCSP);
}

@@ -1150,12 +1191,12 @@ isElemHide() {

isSpecificHide() {
return (0, utils_js_1.getBit)(this.mask, 2097152 /* NETWORK_FILTER_MASK.isSpecificHide */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.isSpecificHide);
}
isGenericHide() {
return (0, utils_js_1.getBit)(this.mask, 524288 /* NETWORK_FILTER_MASK.isGenericHide */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.isGenericHide);
}
isBadFilter() {
return (0, utils_js_1.getBit)(this.mask, 131072 /* NETWORK_FILTER_MASK.isBadFilter */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.isBadFilter);
}
isUnicode() {
return (0, utils_js_1.getBit)(this.mask, 16777216 /* NETWORK_FILTER_MASK.isUnicode */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.isUnicode);
}

@@ -1166,48 +1207,48 @@ fromAny() {

thirdParty() {
return (0, utils_js_1.getBit)(this.mask, 32768 /* NETWORK_FILTER_MASK.thirdParty */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.thirdParty);
}
firstParty() {
return (0, utils_js_1.getBit)(this.mask, 16384 /* NETWORK_FILTER_MASK.firstParty */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.firstParty);
}
fromImage() {
return (0, utils_js_1.getBit)(this.mask, 16 /* NETWORK_FILTER_MASK.fromImage */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.fromImage);
}
fromMedia() {
return (0, utils_js_1.getBit)(this.mask, 32 /* NETWORK_FILTER_MASK.fromMedia */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.fromMedia);
}
fromObject() {
return (0, utils_js_1.getBit)(this.mask, 64 /* NETWORK_FILTER_MASK.fromObject */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.fromObject);
}
fromOther() {
return (0, utils_js_1.getBit)(this.mask, 128 /* NETWORK_FILTER_MASK.fromOther */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.fromOther);
}
fromPing() {
return (0, utils_js_1.getBit)(this.mask, 256 /* NETWORK_FILTER_MASK.fromPing */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.fromPing);
}
fromScript() {
return (0, utils_js_1.getBit)(this.mask, 512 /* NETWORK_FILTER_MASK.fromScript */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.fromScript);
}
fromStylesheet() {
return (0, utils_js_1.getBit)(this.mask, 1024 /* NETWORK_FILTER_MASK.fromStylesheet */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.fromStylesheet);
}
fromDocument() {
return (0, utils_js_1.getBit)(this.mask, 1 /* NETWORK_FILTER_MASK.fromDocument */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.fromDocument);
}
fromSubdocument() {
return (0, utils_js_1.getBit)(this.mask, 2048 /* NETWORK_FILTER_MASK.fromSubdocument */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.fromSubdocument);
}
fromWebsocket() {
return (0, utils_js_1.getBit)(this.mask, 4096 /* NETWORK_FILTER_MASK.fromWebsocket */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.fromWebsocket);
}
fromHttp() {
return (0, utils_js_1.getBit)(this.mask, 4 /* NETWORK_FILTER_MASK.fromHttp */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.fromHttp);
}
fromHttps() {
return (0, utils_js_1.getBit)(this.mask, 8 /* NETWORK_FILTER_MASK.fromHttps */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.fromHttps);
}
fromXmlHttpRequest() {
return (0, utils_js_1.getBit)(this.mask, 8192 /* NETWORK_FILTER_MASK.fromXmlHttpRequest */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.fromXmlHttpRequest);
}
fromFont() {
return (0, utils_js_1.getBit)(this.mask, 2 /* NETWORK_FILTER_MASK.fromFont */);
return (0, utils_js_1.getBit)(this.mask, NETWORK_FILTER_MASK.fromFont);
}

@@ -1214,0 +1255,0 @@ }

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -5,0 +5,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -8,8 +8,11 @@ * This Source Code Form is subject to the terms of the Mozilla Public

*/
export { default as FiltersEngine, ENGINE_VERSION, BlockingResponse } from './engine/engine.js';
export { default as FiltersEngine, ENGINE_VERSION } from './engine/engine.js';
export type { BlockingResponse } from './engine/engine.js';
export { default as ReverseIndex } from './engine/reverse-index.js';
export { default as Request, makeRequest, RequestType, WebRequestType, ElectronRequestType, PuppeteerRequestType, getHostnameHashesFromLabelsBackward, PlaywrightRequestType, } from './request.js';
export { default as Request, makeRequest, getHostnameHashesFromLabelsBackward, } from './request.js';
export type { RequestType, WebRequestType, ElectronRequestType, PuppeteerRequestType, PlaywrightRequestType, } from './request.js';
export { default as CosmeticFilter } from './filters/cosmetic.js';
export { default as NetworkFilter } from './filters/network.js';
export { FilterType, IListDiff, IRawDiff, detectFilterType, f, generateDiff, getLinesWithFilters, mergeDiffs, parseFilter, parseFilters, } from './lists.js';
export { FilterType, detectFilterType, f, generateDiff, getLinesWithFilters, mergeDiffs, parseFilter, parseFilters, } from './lists.js';
export type { IListDiff, IRawDiff } from './lists.js';
export * from './fetch.js';

@@ -20,3 +23,4 @@ export { hasUnicode, tokenizeNoSkip as tokenize } from './utils.js';

export { default as Resources } from './resources.js';
export { HTMLSelector, default as StreamingHtmlFilter } from './html-filtering.js';
export { default as StreamingHtmlFilter } from './html-filtering.js';
export type { HTMLSelector } from './html-filtering.js';
//# sourceMappingURL=index.d.ts.map
"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -27,3 +27,3 @@ * This Source Code Form is subject to the terms of the Mozilla Public

Object.defineProperty(exports, "__esModule", { value: true });
exports.StreamingHtmlFilter = exports.Resources = exports.Config = exports.isUTF8 = exports.tokenize = exports.hasUnicode = exports.parseFilters = exports.parseFilter = exports.mergeDiffs = exports.getLinesWithFilters = exports.generateDiff = exports.f = exports.detectFilterType = exports.NetworkFilter = exports.CosmeticFilter = exports.getHostnameHashesFromLabelsBackward = exports.makeRequest = exports.Request = exports.ReverseIndex = exports.ENGINE_VERSION = exports.FiltersEngine = void 0;
exports.StreamingHtmlFilter = exports.Resources = exports.Config = exports.isUTF8 = exports.tokenize = exports.hasUnicode = exports.parseFilters = exports.parseFilter = exports.mergeDiffs = exports.getLinesWithFilters = exports.generateDiff = exports.f = exports.detectFilterType = exports.FilterType = exports.NetworkFilter = exports.CosmeticFilter = exports.getHostnameHashesFromLabelsBackward = exports.makeRequest = exports.Request = exports.ReverseIndex = exports.ENGINE_VERSION = exports.FiltersEngine = void 0;
var engine_js_1 = require("./engine/engine.js");

@@ -43,2 +43,3 @@ Object.defineProperty(exports, "FiltersEngine", { enumerable: true, get: function () { return __importDefault(engine_js_1).default; } });

var lists_js_1 = require("./lists.js");
Object.defineProperty(exports, "FilterType", { enumerable: true, get: function () { return lists_js_1.FilterType; } });
Object.defineProperty(exports, "detectFilterType", { enumerable: true, get: function () { return lists_js_1.detectFilterType; } });

@@ -45,0 +46,0 @@ Object.defineProperty(exports, "f", { enumerable: true, get: function () { return lists_js_1.f; } });

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -36,2 +36,3 @@ * This Source Code Form is subject to the terms of the Mozilla Public

Object.defineProperty(exports, "__esModule", { value: true });
exports.FilterType = void 0;
exports.detectFilterType = detectFilterType;

@@ -49,2 +50,8 @@ exports.parseFilter = parseFilter;

const utils_js_1 = require("./utils.js");
var FilterType;
(function (FilterType) {
FilterType[FilterType["NOT_SUPPORTED"] = 0] = "NOT_SUPPORTED";
FilterType[FilterType["NETWORK"] = 1] = "NETWORK";
FilterType[FilterType["COSMETIC"] = 2] = "COSMETIC";
})(FilterType || (exports.FilterType = FilterType = {}));
/**

@@ -59,3 +66,3 @@ * Given a single line (string), checks if this would likely be a cosmetic

if (line.length === 0 || line.length === 1) {
return 0 /* FilterType.NOT_SUPPORTED */;
return FilterType.NOT_SUPPORTED;
}

@@ -68,3 +75,3 @@ // Ignore comments

(firstCharCode === 91 /* '[' */ && (0, utils_js_1.fastStartsWith)(line, '[Adblock'))) {
return 0 /* FilterType.NOT_SUPPORTED */;
return FilterType.NOT_SUPPORTED;
}

@@ -86,3 +93,3 @@ // Fast heuristics to detect network filters

lastCharCode === 124 /* '|' */) {
return 1 /* FilterType.NETWORK */;
return FilterType.NETWORK;
}

@@ -99,3 +106,3 @@ // Ignore Adguard cosmetics

(0, utils_js_1.fastStartsWithFrom)(line, /* $@$ */ '@$', afterDollarIndex))) {
return 0 /* FilterType.NOT_SUPPORTED */;
return FilterType.NOT_SUPPORTED;
}

@@ -117,3 +124,3 @@ }

// `##` `#@#`
return 2 /* FilterType.COSMETIC */;
return FilterType.COSMETIC;
}

@@ -133,14 +140,14 @@ else if ((afterSharpCharCode === 64 /* '@'*/ &&

// `#?#`
return 0 /* FilterType.NOT_SUPPORTED */;
return FilterType.NOT_SUPPORTED;
}
}
// Everything else is a network filter
return 1 /* FilterType.NETWORK */;
return FilterType.NETWORK;
}
function parseFilter(filter) {
const filterType = detectFilterType(filter);
if (filterType === 1 /* FilterType.NETWORK */) {
if (filterType === FilterType.NETWORK) {
return network_js_1.default.parse(filter, true);
}
else if (filterType === 2 /* FilterType.COSMETIC */) {
else if (filterType === FilterType.COSMETIC) {
return cosmetic_js_1.default.parse(filter, true);

@@ -193,3 +200,3 @@ }

const filterType = detectFilterType(line);
if (filterType === 1 /* FilterType.NETWORK */ && config.loadNetworkFilters === true) {
if (filterType === FilterType.NETWORK && config.loadNetworkFilters === true) {
const filter = network_js_1.default.parse(line, config.debug);

@@ -203,3 +210,3 @@ if (filter !== null) {

}
else if (filterType === 2 /* FilterType.COSMETIC */ && config.loadCosmeticFilters === true) {
else if (filterType === FilterType.COSMETIC && config.loadCosmeticFilters === true) {
const filter = cosmetic_js_1.default.parse(line, config.debug);

@@ -217,3 +224,3 @@ if (filter !== null) {

const preprocessorToken = (0, preprocessor_js_1.detectPreprocessor)(line);
if (preprocessorToken === 1 /* PreprocessorTokens.BEGIF */) {
if (preprocessorToken === preprocessor_js_1.PreprocessorTokens.BEGIF) {
if (preprocessorStack.length > 0) {

@@ -228,8 +235,8 @@ preprocessorStack.push(new preprocessor_js_1.default({

}
else if ((preprocessorToken === 3 /* PreprocessorTokens.ENDIF */ ||
preprocessorToken === 2 /* PreprocessorTokens.ELSE */) &&
else if ((preprocessorToken === preprocessor_js_1.PreprocessorTokens.ENDIF ||
preprocessorToken === preprocessor_js_1.PreprocessorTokens.ELSE) &&
preprocessorStack.length > 0) {
const lastPreprocessor = preprocessorStack.pop();
preprocessors.push(lastPreprocessor);
if (preprocessorToken === 2 /* PreprocessorTokens.ELSE */) {
if (preprocessorToken === preprocessor_js_1.PreprocessorTokens.ELSE) {
preprocessorStack.push(new preprocessor_js_1.default({

@@ -236,0 +243,0 @@ condition: `!(${lastPreprocessor.condition})`,

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.evaluate = exports.Env = void 0;
exports.evaluate = exports.PreprocessorTokens = exports.Env = void 0;
exports.detectPreprocessor = detectPreprocessor;

@@ -9,2 +9,9 @@ const data_view_js_1 = require("./data-view.js");

exports.Env = Env;
var PreprocessorTokens;
(function (PreprocessorTokens) {
PreprocessorTokens[PreprocessorTokens["INVALID"] = 0] = "INVALID";
PreprocessorTokens[PreprocessorTokens["BEGIF"] = 1] = "BEGIF";
PreprocessorTokens[PreprocessorTokens["ELSE"] = 2] = "ELSE";
PreprocessorTokens[PreprocessorTokens["ENDIF"] = 3] = "ENDIF";
})(PreprocessorTokens || (exports.PreprocessorTokens = PreprocessorTokens = {}));
function detectPreprocessor(line) {

@@ -15,14 +22,14 @@ // Minimum size of a valid condition should be 6 for something like: "!#if x" or "!#else"

line.charCodeAt(1) !== 35 /* '#' */) {
return 0 /* PreprocessorTokens.INVALID */;
return PreprocessorTokens.INVALID;
}
if (line.startsWith('!#if ')) {
return 1 /* PreprocessorTokens.BEGIF */;
return PreprocessorTokens.BEGIF;
}
if (line.startsWith('!#else')) {
return 2 /* PreprocessorTokens.ELSE */;
return PreprocessorTokens.ELSE;
}
if (line.startsWith('!#endif')) {
return 3 /* PreprocessorTokens.ENDIF */;
return PreprocessorTokens.ENDIF;
}
return 0 /* PreprocessorTokens.INVALID */;
return PreprocessorTokens.INVALID;
}

@@ -29,0 +36,0 @@ const tokenizerPattern = /(!|&&|\|\||\(|\)|[a-zA-Z0-9_]+)/g;

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -5,0 +5,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -78,3 +78,2 @@ * This Source Code Form is subject to the terms of the Mozilla Public

// The resource containing javascirpts to be injected
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const js = typeToResource.get('application/javascript') || new Map();

@@ -81,0 +80,0 @@ for (const [key, value] of js.entries()) {

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -5,0 +5,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"use strict";
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -5,0 +5,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -10,85 +10,78 @@ * This Source Code Form is subject to the terms of the Mozilla Public

export default [
"%3D%3D%2527%252Cnecessary%3Atrue%252Cpreferences%3Afalse%252Cstatistics%3Afalse%252Cmarketing%3Afalse%252Cmethod%3A%2527explicit%2527%252Cve",
", CookieConsent, {stamp:%27Uv9YOAVP5djCBw71lxhE4rNAfTObaGck2Sn3rKWf9dPCYpqcWvAlpA==%27%2Cnecessary:true%2Cpreferences:false%2Cstatistics:fal",
"div[style=\"position: absolute; inset: 0px; overflow: hidden; z-index: 160; background: transparent none repeat scroll 0% 0%; display: block;",
"IAEQJQIAJqJEgFERAkJQCBpZHwMACAIQgHRWATFIiB-HaBroyfhEMaC0AUBQ4AonhMTPAoSdwXCkg7uaHIgIImgFASBAIoYMEEEEBlTkFABAAAkAAABJSADAAEQUCUAGAAIgoDoAMAAR",
"div[style=\"position: fixed; display: block; width: 100%; height: 100%; inset: 0px; background-color: rgba(0, 0, 0, 0); z-index: 300000;\"]",
"\"]:not([style^=\"width: 1px; height: 1px; position: absolute; left: -10000px; top: -\"])",
"acs, document.createElement, %2Fl%5C.parentNode%5C.insertBefore%5C(s%2F",
"%2Fvisit%2F%22%5D%5Btitle%5E%3D%22https%3A%2F%2F%22%5D, %5Btitle%5D",
"rmnt, script, %2Fh%3DdecodeURIComponent%7CpopundersPerIP%2F",
":not([style^=\"position: absolute; left: -5000px\"])",
"href-sanitizer, a%5Bhref%5E%3D%22https%3A%2F%2F",
"ra, oncontextmenu%7Condragstart%7Conselectstart",
"acs, document.querySelectorAll, popMagic",
"acs, addEventListener, google_ad_client",
"acis, document.querySelectorAll, popMagic",
"nostif, f.parentNode.removeChild(f), 100",
"acis, Object.defineProperty, vocabulary",
"aost, String.prototype.charCodeAt, ai_",
"://paid.outbrain.com/network/redir?\"]",
"aopr, app_vars.force_disable_adblock",
"paid.outbrain.com/network/redir?\"]",
"acs, document.addEventListener, ",
"acs, document.getElementById, ",
"no-fetch-if, googlesyndication",
"aeld, /^(?:click|mousedown)$/, _0x",
"acis, document.getElementById, ",
"acis, JSON.parse, break;case $.",
"acis, document.createElement, ",
"aopr, document.dispatchEvent",
"no-xhr-if, googlesyndication",
", document.createElement, ",
"acs, String.fromCharCode, ",
"%2522%253Afalse%252C%2522",
", document.oncontextmenu",
"aeld, DOMContentLoaded, ",
"acis, String.fromCharCode, ",
"Date.prototype.toUTCString",
"acis, Math, break;case $.",
"nosiif, visibility, 1000",
"set-local-storage-item, ",
"trusted-click-element, ",
"document.onselectstart",
"acis, Math, zfgloaded",
"set, blurred, false",
"acs, eval, replace",
"decodeURIComponent",
"window.open-defuser",
"aopw, Fingerprint2",
"[target=\"_blank\"]",
"%22%3Afalse%2C%22",
"^script:has-text(",
"Object.prototype.",
"[href^=\"https://",
"[href^=\"http://",
"[href=\"https://",
"[src^=\"https://",
"modal-backdrop",
"rmnt, script, ",
"disableSelection",
":nth-of-type(",
"#custom_html-",
"advertisement",
"BlockDetected",
"console.clear",
"no-fetch-if, ",
":first-child",
"[href^=\"http",
"dEventListen",
"trusted-set-",
", document.",
".prototype.",
"[href=\"http",
"contextmenu",
"no-fetch-if",
"div[style=\"",
"leaderboard",
"otification",
":has-text(",
"px; height:",
", noopFunc",
"AaDetector",
"aopw, _pop",
"background",
"[class*=\"",
"s-dummy.js",
"[class^=\"",
"[href^=\"/",
"AAAAAAAAA",
"body,html",
"container",
"Container",
"affiliate",
"decodeURI",
"div[class",
"div[id^=\"",
"div[style",
"document.",
"no-xhr-if",
"ompliance",
"placehold",
"sbygoogle",
"rectangle",
"[href*=\"",
"#wpsafe-",
"Detector",
"[width=\"",
"disclaim",
"nano-sib",
"nextFunc",
"noopFunc",
"nostif, ",
"nowebrtc",
"ontainer",
"skyscrap",
"://www.",
".com/\"]",
"#ctl00_",
"300x250",
"article",
"consent",
"Consent",
"content",
"display",
"message",
"Message",
"overlay",
"privacy",

@@ -98,12 +91,19 @@ "sidebar",

"wrapper",
"[class",
"[data-",
"%7B%7D",
"[style",
"%2C%22",
"728x90",
"accept",
"Accept",
"acis, ",
"aeld, ",
"aopr, ",
"aopw, ",
"banner",
"bottom",
"Bottom",
"cookie",
"Cookie",
"google",
"nosiif",

@@ -115,49 +115,50 @@ "notice",

"script",
"Script",
"widget",
":has(",
"width:",
":not(",
".com/",
"block",
"Block",
"click",
"deskt",
"disab",
"fixed",
"etect",
"ExoLo",
"frame",
"modal",
"popup",
"video",
"0px;",
"2%3A",
"aeld",
"promo",
"sense",
"set, ",
"body",
"butt",
"dfp-",
"down",
"foot",
"gdpr",
"goog",
"html",
"icky",
"ight",
"Info",
"show",
"text",
"tion",
"true",
"view",
" > ",
"%3D",
"%7C",
"://",
"728",
"age",
"box",
"Box",
"div",
"ent",
"out",
"ide",
"img",
"lay",
"mod",
"px;",
"rap",
"set",
"__",
"sby",
"top",
", ",
".t",
".m",
"\"]",
"%2",
"%5",
"=\"",
"00",
"ab",
"ac",

@@ -167,2 +168,3 @@ "ad",

"al",
"am",
"an",

@@ -173,12 +175,12 @@ "ar",

"ed",
"el",
"en",
"er",
"he",
"ic",
"id",
"in",
"is",
"la",
"it",
"le",
"lo",
"od",
"ol",

@@ -190,10 +192,12 @@ "om",

"re",
"ro",
"s_",
"s-",
"se",
"sp",
"st",
"t-",
"te",
"ti",
"un",
"ut",
" ",

@@ -205,3 +209,2 @@ "_",

".",
"(",
")",

@@ -213,3 +216,3 @@ "[",

"#",
"^",
"%",
"0",

@@ -225,2 +228,3 @@ "1",

"9",
"a",
"b",

@@ -240,5 +244,5 @@ "B",

"H",
"i",
"I",
"j",
"J",
"k",

@@ -256,3 +260,2 @@ "l",

"q",
"Q",
"r",

@@ -267,3 +270,2 @@ "R",

"v",
"V",
"w",

@@ -273,6 +275,4 @@ "W",

"y",
"Y",
"z",
"Z"
"z"
];
//# sourceMappingURL=cosmetic-selector.js.map
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -10,66 +10,113 @@ * This Source Code Form is subject to the terms of the Mozilla Public

export default [
"script-src 'self' *.leadpages.net *.gstatic.com *.google.com *.googleapis.com *.playwire.com *.facebook.com *.bootstrapcdn.com *.twitter.com *.spot.im",
"sandbox allow-forms allow-same-origin allow-scripts allow-modals allow-orientation-lock allow-pointer-lock allow-presentation allow-top-navigation",
"script-src 'self' *.leadpages.net *.gstatic.com *.google.com *.googleapis.com *.playwire.com *.facebook.com *.bootstrapcdn.com",
"script-src 'self' *.gstatic.com *.google.com *.googleapis.com *.facebook.com *.bootstrapcdn.com *.twitter.com *.spot.im",
"script-src 'self' 'unsafe-eval' http: https: data: blob: mediastream: filesystem:",
"script-src 'self' 'unsafe-inline' 'unsafe-eval' ",
" *.google.com *.gstatic.com *.googleapis.com",
".com *.google.com *.googletagmanager.com *.",
"script-src 'self' '*' 'unsafe-inline'",
" *.hcaptcha.com *.googleapis.com *.jquery.com *.googletagmanager.com *.c",
" *.gstatic.com *.google.com *.solvemedia.com *.recaptcha.net",
"script-src http: https: 'self' * 'unsafe-inline'",
"child-src 'none';frame-src *;worker-src 'none';",
" *.gstatic.com *.google.com *.googleapis.com",
" 'self' 'unsafe-eval' 'unsafe-inline' ",
"script-src 'self' * 'unsafe-inline'",
"default-src 'unsafe-inline' 'self'",
" *.google.com *.gstatic.com *.",
"t-src 'self' 'unsafe-inline' ",
" *.recaptcha.net *.solvemedia.com",
"script-src 'self' 'unsafe-inline'",
"script-src 'self' * blob: data:",
"script-src * 'unsafe-inline'",
".com *.googleapis.com *.",
" *.googletagmanager.com",
"default-src 'self' *.",
"frame-src 'self' *",
" *.google.com *.gstatic.com",
" *.gstatic.com *.google.com",
".com *.google-analytics.com",
".com *.googletagmanager.com",
"-src 'self' *.google.com",
" 'unsafe-eval' data: ",
".com *.cloudflare.com",
" *.googleapis.com *.",
" *.googletagservices",
" *.bootstrapcdn.com",
" *.google-analytics",
".com https://disqus",
"connect-src 'self'",
" *.cloudflare.com",
"child-src 'none';",
"scorecardresearch",
"worker-src 'none'",
" 'unsafe-inline'",
"google-analytics",
" *.recaptcha.net",
"frame-src 'self'",
"googletagmanager",
"'unsafe-inline'",
" 'unsafe-eval'",
"bootstrapcdn",
"connect-src ",
"child-src *",
" *.gstatic",
"googleapis",
"facebook.net",
"jsdelivr.net",
" *.facebook",
"connect-src",
"script-src ",
"script-src",
"style-src ",
" data: *.",
" https://",
"child-src",
"disquscdn",
"frame-src",
"loudflare",
" 'none';",
"*.google",
"facebook",
"https://",
" 'self'",
"hcaptcha",
" https:",
".com *.",
".net *.",
"addthis",
"captcha",
"cdn.net",
"gstatic",
"twitter",
"youtube",
"defaul",
" data:",
" http:",
"'self'",
"disqus",
"google",
"jquery",
"data:",
"scrip",
"-src",
"blob:",
"media",
"ytimg",
".com",
".net",
"n.cc",
".org",
"apis",
"cdn.",
" *.",
".tv",
"age",
"dia",
"img",
"vic",
"ant",
"def",
"jwp",
"ram",
"sta",
"tic",
" *",
"; ",
"*.",
"an",
"at",
"ch",
"el",
"co",
"ct",
"en",
"er",
"fo",
"im",
"in",
"ir",
"le",
"ly",
"ne",
"ol",
"oo",
"qu",
"ra",
"re",
"tt",
"wi",
"un",
"wp",
"yt",
"ww",
" ",

@@ -83,3 +130,4 @@ "-",

"/",
"3",
"2",
"5",
"a",

@@ -109,4 +157,5 @@ "b",

"x",
"y"
"y",
"z"
];
//# sourceMappingURL=network-csp.js.map
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -10,74 +10,52 @@ * This Source Code Form is subject to the terms of the Mozilla Public

export default [
"/homad-global-configs.schneevonmorgen.com/global_config",
"/videojs-vast-vpaid@2.0.2/bin/videojs_5.vast.vpaid.min",
"/etc.clientlibs/logitech-common/clientlibs/onetrust.",
"[\\/]{1,}.*[a-zA-Z0-9]{3,7}\\/[a-zA-Z0-9]{6,}\\/.*/",
"/pagead/managed/js/adsense/*/show_ads_impl",
"/pagead/managed/js/gpt/*/pubads_impl",
"/ajax/libs/fuckadblock/*/fuckadblock.min.js",
"/dist/assets/omniture/visitorapi.min",
"/dist/assets/comscore/streamsense",
"/^https?:\\/\\/[a-z]{8,15}\\.",
"/pagead/js/adsbygoogle.js",
"/vans-adapter-google-ima",
"/js/sdkloader/ima3_dai",
"\\/[%0-9a-zA-Z]{170,}$/",
"/js/sdkloader/ima3.js",
"/videojs-contrib-ads",
"/wp-content/plugins/",
"/wp-content/uploads/",
"/wp-content/themes/",
"/detroitchicago/",
"/cdn-cgi/pe/bag2?",
"\\/[0-9]{2,9}\\/$/",
"/appmeasurement",
"/413gkwmt/init",
"/cdn-cgi/trace",
"/style/03/img/",
"\\/[a-zA-Z0-9]{",
"/www-static/js/",
"/^https?:\\/\\/",
"/^https:\\/\\/",
"notification",
"fingerprint",
"/ljub4etb/",
"[a-zA-Z0-9]",
"background",
"impression",
"[a-z0-9]{",
"/plugins/",
"/ajax/lib",
"affiliate",
"analytics",
"(.+?\\.)?",
"[0-9a-z]",
"/assets/",
"/images/",
"/pagead/",
"pageview",
"campaign",
"template",
"tisement",
"tracking",
"/assets",
"160x600",
"300x250",
"collect",
"consent",
"content",
"counter",
"default",
"metrics",
"privacy",
"[a-z]{",
"sponsor",
"visitor",
".aspx?",
"/embed",
"/video",
"120x60",
"468x60",
"728x90",
"aptcha",
"banner",
"bundle",
"client",
"cookie",
"detect",
"dn-cgi",
"google",
"iframe",
"module",
"prebid",
"public",
"metric",
"rivacy",
"script",
"source",
"widget",
".aspx",
".cgi?",
".com/",
".html",
"/api/",
"/beac",
"/html",
"/java",

@@ -87,48 +65,55 @@ "/stat",

"click",
"count",
"clude",
"event",
"frame",
"image",
"manag",
"media",
"pixel",
"popup",
"right",
"track",
"type=",
".css",
"video",
".gif",
".htm",
".jpg",
".min",
".php",
".png",
".swf",
"/img",
"/jqu",
"/js/",
"/lib",
"/log",
"/web",
"/wp-",
"468x",
"data",
"gdpr",
"book",
"gi-b",
"ight",
"mail",
"plug",
"show",
"html",
"http",
"nfig",
"page",
"play",
"stat",
"uild",
"tion",
"view",
"?*&",
".js",
"/ad",
"/js",
"^*/",
"=*&",
"age",
"fig",
"468",
"728",
"aff",
"box",
"dpr",
"ext",
"how",
"jax",
"key",
"lay",
"log",
"sdk",
"lug",
"tag",
"und",
"unt",
"web",
"ync",
"*/",
"-p",
".*",
".m",
"*^",

@@ -138,16 +123,19 @@ "/_",

"/*",
"/1",
"/d",
"/e",
"/f",
"/g",
"/h",
"/l",
"/i",
"/j",
"/m",
"/n",
"/p",
"/r",
"/u",
"/v",
"/w",
"\\/",
"^*",
"0_",
"00",
"ab",
"ac",

@@ -162,20 +150,25 @@ "ad",

"at",
"bo",
"ce",
"ch",
"ck",
"co",
"ct",
"de",
"di",
"e_",
"e-",
"e/",
"ed",
"el",
"em",
"en",
"eo",
"er",
"es",
"et",
"ew",
"fo",
"g/",
"ga",
"he",
"ic",
"id",
"il",
"im",

@@ -185,3 +178,2 @@ "in",

"it",
"js",
"la",

@@ -191,4 +183,9 @@ "le",

"lo",
"m/",
"ma",
"mm",
"mo",
"mp",
"o/",
"ns",
"nt",
"ol",

@@ -200,2 +197,4 @@ "om",

"ot",
"p-",
"qu",
"re",

@@ -207,8 +206,8 @@ "ro",

"s/",
"se",
"si",
"sp",
"ss",
"st",
"t/",
"te",
"ti",
"tm",

@@ -219,2 +218,3 @@ "tr",

"un",
"up",
"ur",

@@ -224,9 +224,9 @@ "us",

"ve",
"y/",
"yn",
"_",
"-",
",",
":",
"?",
".",
"}",
"*",

@@ -233,0 +233,0 @@ "/",

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -10,48 +10,44 @@ * This Source Code Form is subject to the terms of the Mozilla Public

export default [
"securepubads.g.doubleclick",
".xx.fbcdn.net.iberostar",
"googlesyndication",
"imasdk.googleapis",
".cloudfront.net",
".actonservice",
"analytics.",
"marketing.",
"tracking.",
"metrics.",
"images.",
"cdnjs.cloudflare",
"googletagmanager",
"ajax.googleapis",
"doubleclick.net",
"cloudfront.net",
"affiliate",
"amazonaws",
"analytics",
"facebook",
"traffic",
".co.uk",
"a8clk.",
"stats.",
"a8cv.",
".fwmrm",
"google",
"phncdn",
".club",
".info",
".site",
"click",
"count",
"media",
"track",
".bid",
".com",
".net",
".top",
".xyz",
"tion",
"www.",
"news",
"stat",
"tube",
".io",
".jp",
"app",
".ru",
"cdn",
"new",
"ght",
"pix",
"pro",
"web",
".b",
".c",
".d",
".f",
".g",
".h",
".k",
".m",
".1",
".n",
".p",
".s",
".t",
".v",
".w",
"a1",
"a4",
"a8",
"24",
"ab",

@@ -62,2 +58,3 @@ "ac",

"ag",
"ah",
"ai",

@@ -75,6 +72,6 @@ "ak",

"aw",
"ax",
"ay",
"az",
"be",
"bi",
"bl",

@@ -90,5 +87,9 @@ "bo",

"cl",
"cn",
"cr",
"ct",
"cu",
"da",
"db",
"dd",
"de",

@@ -100,3 +101,2 @@ "di",

"ds",
"du",
"dy",

@@ -108,3 +108,3 @@ "e-",

"ef",
"eg",
"ek",
"el",

@@ -128,17 +128,19 @@ "em",

"fr",
"fy",
"ge",
"gh",
"gg",
"gi",
"gl",
"gn",
"go",
"gr",
"gs",
"gu",
"gy",
"hd",
"he",
"ho",
"ia",
"ib",
"hu",
"ic",
"id",
"ie",
"if",
"ig",
"ik",
"il",

@@ -151,8 +153,5 @@ "im",

"it",
"iv",
"ix",
"iz",
"jo",
"ki",
"kr",
"ks",
"la",
"ld",

@@ -163,13 +162,12 @@ "le",

"lo",
"lu",
"ly",
"ma",
"me",
"mi",
"mo",
"mp",
"my",
"ne",
"nd",
"no",
"ob",
"ok",
"ol",

@@ -181,7 +179,6 @@ "om",

"or",
"os",
"ot",
"ou",
"ow",
"pa",
"pe",
"ph",

@@ -191,10 +188,8 @@ "pl",

"pr",
"ps",
"pu",
"qu",
"ra",
"re",
"ri",
"ro",
"ru",
"ry",
"s-",
"sc",

@@ -205,2 +200,3 @@ "se",

"sk",
"sm",
"sn",

@@ -214,3 +210,2 @@ "so",

"sy",
"t-",
"ta",

@@ -220,2 +215,3 @@ "te",

"ti",
"tm",
"tn",

@@ -226,2 +222,3 @@ "to",

"tu",
"tv",
"tw",

@@ -236,7 +233,10 @@ "ty",

"us",
"ut",
"ve",
"vi",
"vo",
"we",
"wi",
"xx",
"xy",
"yp",
"zz",
"-",

@@ -243,0 +243,0 @@ ".",

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -10,22 +10,16 @@ * This Source Code Form is subject to the terms of the Mozilla Public

export default [
"googlesyndication.com/adsbygoogle.js",
"google-analytics.com/analytics.js",
"googlesyndication_adsbygoogle.js",
"googletagmanager.com/gtm.js",
"googletagservices_gpt.js",
"googletagmanager_gtm.js",
"fuckadblock.js-3.2.0",
"amazon_apstag.js",
"google-analytics",
"fingerprint2.js",
"noop-1s.mp4:10",
"-transparent.",
"google-ima.js",
"noop-0.1s.mp3",
"prebid-ads.js",
"nobab2.js:10",
"noopmp3-0.1s",
"noop-1s.mp4",
"hd-main.js",
"noopmp4-1s",
"32x32.png",
"noop.html",
"nobab2.js",
"noopframe",

@@ -36,20 +30,28 @@ "noop.txt",

"2x2.png",
"3x2.png",
"noop.js",
"noopjs",
".com/",
".js:5",
"noop",
":10",
"1s.mp",
"noop-",
"atus",
".js",
"ads",
"bea",
"tag",
"_a",
":5",
"/a",
"am",
"ar",
"ch",
"em",
"ge",
"ic",
"in",
"le",
"ng",
"on",
"op",
"ou",
"pt",
"re",

@@ -61,2 +63,3 @@ "st",

".",
"*",
"/",

@@ -63,0 +66,0 @@ "0",

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -11,48 +11,57 @@ * This Source Code Form is subject to the terms of the Mozilla Public

"-webkit-touch-callou",
"app_vars.force_disab",
"nosiif, visibility, ",
"overflow: auto !impo",
"rtant; position: ini",
"set-local-storage-it",
"set, blurred, false)",
".force_disable_adblo",
"+js(acis, Math, zfgl",
"+js(nosiif, visibili",
"+js(window.open-defu",
"document.dispatchEve",
"pornhubthbh7ap3u.oni",
"querySelectorAll, po",
"user-select: text !i",
"##^script:has-text(",
"##body,html:style(",
"decodeURIComponent",
"[href^=\"https://",
"acs, document.",
"rmnt, script, ",
" !important;",
"trusted-set-",
"+js(acis, document.",
"decodeURIComponent)",
"+js(acs, document.",
"^script:has-text(",
", break;case $.)",
"+js(trusted-set-",
"getElementById, ",
"blurred, false)",
"BlockDetected)",
"+js(nowebrtc)",
"t: default !i",
",www.google.",
"[href^=\"http",
"+js(nano-sib",
"+js(nostif, ",
"div[class^=\"",
", noopFunc)",
",airfrance.",
"+js(nowoif)",
"contextmenu",
"no-fetch-if",
"div[style=\"",
"otification",
".com##+js(",
"%2522%253A",
"%252C%2522",
"=\"https://",
"+js(acis, ",
"+js(aeld, ",
"+js(aopr, ",
"+js(aopw, ",
"background",
"t: default",
" -webkit-",
".*,xhamst",
"container",
".blogspot",
"+js(set, ",
"div[id^=\"",
"mportant;",
"AAAAAAAA",
"disclaim",
"nostif, ",
",google",
"ty, 1000)",
"[width=\"",
"ontainer",
", true)",
"://www.",
":style(",
".co.uk,",
"consent",
"300x250",
"content",
"message",
"nowoif)",
"privacy",
"-wrapp",
",kayak",
"[class",
"##+js(",
"accept",
"aopr, ",
"sponsor",
" -moz-",
".co.uk",
".co.za",
".com##",
"banner",

@@ -62,61 +71,41 @@ "bottom",

"Cookie",
"notice",
"google",
"policy",
"widget",
":has(",
"##div",
"width:",
".com,",
"app_v",
"block",
"cript",
"true)",
".co.",
"daily",
"movie",
"wrapp",
".au,",
".com",
".de,",
".fr,",
".net",
".nl,",
".pl,",
".xyz",
"#@#.",
"2%3A",
"+js(",
"down",
"foot",
"gdpr",
"goog",
"html",
"ight",
"news",
"text",
"wrap",
"tube",
" > ",
".*,",
"##.",
"###",
"%3D",
"%7C",
"ent",
"lay",
"://",
"728",
"age",
"px;",
"web",
"__",
"-s",
"-t",
", ",
",b",
",c",
",f",
",g",
",m",
",p",
",s",
",t",
": ",
".*",
".b",
".c",
".m",
".n",
".p",
".s",
".t",
"\"]",
"##",
"%2",
"%5",
"=\"",
"00",
"a-",
"ab",

@@ -126,5 +115,2 @@ "ac",

"Ad",
"af",
"ag",
"ak",
"al",

@@ -135,20 +121,16 @@ "am",

"ar",
"as",
"at",
"au",
"av",
"ay",
"az",
"bo",
"ca",
"ce",
"ch",
"ck",
"co",
"ct",
"da",
"de",
"di",
"do",
"e-",
"ed",
"el",
"em",
"en",

@@ -158,28 +140,35 @@ "er",

"et",
"ex",
"ew",
"fi",
"fo",
"ft",
"ga",
"ge",
"go",
"he",
"ho",
"ic",
"id",
"if",
"ig",
"il",
"im",
"in",
"is",
"it",
"ke",
"la",
"ld",
"le",
"li",
"lo",
"ma",
"me",
"mo",
"mp",
"na",
"no",
"ol",
"om",
"on",
"op",
"or",
"ot",
"ov",
"ow",
"po",
"ra",
"re",

@@ -189,12 +178,17 @@ "ro",

"s-",
"sc",
"se",
"sh",
"si",
"sk",
"so",
"sp",
"ss",
"st",
"t-",
"te",
"th",
"ti",
"to",
"tr",
"tv",
"ub",

@@ -210,2 +204,3 @@ "ul",

"vi",
"xt",
" ",

@@ -218,7 +213,8 @@ "_",

".",
"(",
")",
"[",
"*",
"/",
"^",
"#",
"%",
"0",

@@ -256,3 +252,5 @@ "1",

"n",
"N",
"o",
"O",
"p",

@@ -268,4 +266,6 @@ "P",

"u",
"U",
"v",
"w",
"W",
"x",

@@ -272,0 +272,0 @@ "y",

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -10,71 +10,102 @@ * This Source Code Form is subject to the terms of the Mozilla Public

export default [
",redirect-rule=1x1.g",
"/js/sdkloader/ima3.j",
"|realmomsrealreviews",
"pornhubthbh7ap3u.oni",
",redirect-rule=noop",
"|patriotoutdoornews",
".com^$third-party",
"googlesyndication",
"imasdk.googleapis",
".cloudfront.net^",
",redirect-rule=",
"/cdn-cgi/pe/bag2?",
"|themattwalshblog",
" 'unsafe-inline'",
"/pagead/js/adsby",
"\\/[0-9]{2,9}\\/$/",
"/www-static/js/",
"$script,domain=",
",redirect=noop",
"|downdetector.",
"cdnjs.cloudfla",
"cloudfront.net",
"xmlhttprequest",
".actonservice",
"^$third-party",
"||smetrics.",
"^$generichide",
"/wp-content/",
"doubleclick",
"subdocument",
"syndication",
"third-party",
"marketing.",
"^$document",
"stylesheet",
"|https://",
"affiliate",
"analytics",
",domain=",
"metrics.",
"|http://",
"facebook",
"spiegel.",
"tracking",
"^$ghide",
"$script",
"300x250",
"domain=",
".club^",
".co.uk",
"$ghide",
"a8clk.",
"/ajax/",
"banner",
"cookie",
"Cookie",
"google",
"movies",
"phncdn",
"script",
"stats.",
".com^",
".top^",
".xyz^",
"/wp-c",
"$doma",
"a8cv.",
"count",
"daily",
"frame",
"image",
"media",
"right",
"track",
".au^",
"video",
".com",
".fr^",
".gif",
".jp^",
".net",
"/js/",
"$doc",
".php",
".xyz",
"^$3p",
"$xhr",
"www.",
"down",
"html",
"news",
"play",
"stat",
"tube",
"view",
" *.",
",1p",
",3p",
".jp",
".js",
"app",
".ru",
".tv",
"^*/",
"cdn",
"ent",
"js,",
"new",
"pro",
"the",
"web",
".b",
".c",
".d",
".f",
".k",
".m",
".n",
".p",
".s",
".t",
"@@",
"/*",
"/$",
"/j",
"/p",
"^$",
"||",
"|h",
"|k",
"|m",
"|w",
"10",
"ab",

@@ -96,3 +127,2 @@ "ac",

"aw",
"ax",
"ay",

@@ -103,7 +133,5 @@ "az",

"br",
"ca",
"ce",
"ch",
"ck",
"cl",
"cr",

@@ -114,7 +142,2 @@ "ct",

"do",
"ds",
"e-",
"e^",
"eb",
"ec",
"ed",

@@ -124,3 +147,2 @@ "el",

"en",
"ep",
"er",

@@ -130,20 +152,12 @@ "es",

"ev",
"ew",
"ex",
"fe",
"ff",
"fi",
"fl",
"fo",
"fr",
"g^",
"ge",
"gi",
"go",
"gr",
"gu",
"he",
"hi",
"ho",
"hp",
"ht",
"ic",

@@ -155,3 +169,2 @@ "id",

"in",
"io",
"ip",

@@ -161,11 +174,8 @@ "ir",

"it",
"iv",
"ix",
"iz",
"jo",
"js",
"ke",
"le",
"li",
"lo",
"lu",
"ly",

@@ -175,7 +185,3 @@ "me",

"mp",
"my",
"ne",
"no",
"od",
"ok",
"ol",

@@ -186,3 +192,2 @@ "om",

"or",
"ot",
"pl",

@@ -193,8 +198,5 @@ "po",

"re",
"ri",
"ro",
"ru",
"s-",
"s/",
"sc",
"se",

@@ -205,14 +207,9 @@ "sh",

"sp",
"ss",
"st",
"su",
"sw",
"te",
"th",
"ti",
"to",
"tr",
"ts",
"tv",
"ub",
"ud",
"ul",

@@ -226,4 +223,4 @@ "um",

"ve",
"vi",
"yo",
" ",
"_",

@@ -234,4 +231,6 @@ "-",

".",
"'",
"*",
"/",
"&",
"^",

@@ -253,2 +252,3 @@ "=",

"a",
"A",
"b",

@@ -255,0 +255,0 @@ "c",

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -44,11 +44,14 @@ * This Source Code Form is subject to the terms of the Mozilla Public

serialize(buffer: StaticDataView): void;
getHtmlRules({ domain, hostname, isFilterExcluded, }: {
getHtmlFilters({ domain, hostname, isFilterExcluded, }: {
domain: string;
hostname: string;
isFilterExcluded?: (filter: CosmeticFilter) => boolean;
}): CosmeticFilter[];
}): {
filters: CosmeticFilter[];
unhides: CosmeticFilter[];
};
/**
* Request cosmetics and scripts to inject in a page.
*/
getCosmeticsFilters({ domain, hostname, classes, hrefs, ids, allowGenericHides, allowSpecificHides, getBaseRules, getInjectionRules, getExtendedRules, getRulesFromDOM, getRulesFromHostname, isFilterExcluded, }: {
getCosmeticsFilters({ domain, hostname, classes, hrefs, ids, allowGenericHides, allowSpecificHides, getRulesFromDOM, getRulesFromHostname, isFilterExcluded, }: {
domain: string;

@@ -61,5 +64,2 @@ hostname: string;

allowSpecificHides: boolean;
getBaseRules?: boolean;
getInjectionRules?: boolean;
getExtendedRules?: boolean;
getRulesFromDOM?: boolean;

@@ -69,5 +69,14 @@ getRulesFromHostname?: boolean;

}): {
injections: CosmeticFilter[];
filters: CosmeticFilter[];
unhides: CosmeticFilter[];
};
getStylesheetsFromFilters({ filters, extendedFilters, }: {
filters: CosmeticFilter[];
extendedFilters: CosmeticFilter[];
}, { getBaseRules, allowGenericHides, }: {
getBaseRules: any;
allowGenericHides: any;
}): {
stylesheet: string;
extended: IMessageFromBackground['extended'];
stylesheet: string;
};

@@ -74,0 +83,0 @@ /**

@@ -1,4 +0,3 @@

/* eslint-disable @typescript-eslint/unbound-method */
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -230,19 +229,19 @@ * This Source Code Form is subject to the terms of the Mozilla Public

}
getHtmlRules({ domain, hostname, isFilterExcluded, }) {
getHtmlFilters({ domain, hostname, isFilterExcluded, }) {
const filters = [];
// Tokens from `hostname` and `domain` which will be used to lookup filters
// from the reverse index. The same tokens are re-used for multiple indices.
const hostnameTokens = createLookupTokens(hostname, domain);
const rules = [];
this.htmlIndex.iterMatchingFilters(hostnameTokens, (rule) => {
if (rule.match(hostname, domain) && !(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(rule))) {
rules.push(rule);
filters.push(rule);
}
return true;
});
const unhides = [];
// If we found at least one candidate, check if we have unhidden rules.
const disabledRules = new Set();
if (rules.length !== 0) {
if (filters.length !== 0) {
this.unhideIndex.iterMatchingFilters(hostnameTokens, (rule) => {
if (rule.match(hostname, domain) && !(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(rule))) {
disabledRules.add(rule.getSelector());
unhides.push(rule);
}

@@ -252,3 +251,3 @@ return true;

}
return rules.filter((rule) => disabledRules.size === 0 || disabledRules.has(rule.getSelector()) === false);
return { filters, unhides };
}

@@ -260,7 +259,7 @@ /**

// Allows to specify which rules to return
getBaseRules = true, getInjectionRules = true, getExtendedRules = true, getRulesFromDOM = true, getRulesFromHostname = true, isFilterExcluded, }) {
getRulesFromDOM = true, getRulesFromHostname = true, isFilterExcluded, }) {
// Tokens from `hostname` and `domain` which will be used to lookup filters
// from the reverse index. The same tokens are re-used for multiple indices.
const hostnameTokens = createLookupTokens(hostname, domain);
const rules = [];
const filters = [];
// =======================================================================

@@ -271,10 +270,10 @@ // Rules: hostname-specific

if (getRulesFromHostname === true) {
this.hostnameIndex.iterMatchingFilters(hostnameTokens, (rule) => {
this.hostnameIndex.iterMatchingFilters(hostnameTokens, (filter) => {
// A hostname-specific filter is considered if it's a scriptlet (not
// impacted by disabling of specific filters) or specific hides are
// allowed.
if ((allowSpecificHides === true || rule.isScriptInject() === true) &&
rule.match(hostname, domain) &&
!(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(rule))) {
rules.push(rule);
if ((allowSpecificHides === true || filter.isScriptInject() === true) &&
filter.match(hostname, domain) &&
!(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(filter))) {
filters.push(filter);
}

@@ -292,5 +291,5 @@ return true;

const genericRules = this.getGenericRules();
for (const rule of genericRules) {
if (rule.match(hostname, domain) === true && !(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(rule))) {
rules.push(rule);
for (const filter of genericRules) {
if (filter.match(hostname, domain) === true && !(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(filter))) {
filters.push(filter);
}

@@ -303,5 +302,5 @@ }

if (allowGenericHides === true && getRulesFromDOM === true && classes.length !== 0) {
this.classesIndex.iterMatchingFilters(hashStrings(classes), (rule) => {
if (rule.match(hostname, domain) && !(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(rule))) {
rules.push(rule);
this.classesIndex.iterMatchingFilters(hashStrings(classes), (filter) => {
if (filter.match(hostname, domain) && !(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(filter))) {
filters.push(filter);
}

@@ -315,5 +314,5 @@ return true;

if (allowGenericHides === true && getRulesFromDOM === true && ids.length !== 0) {
this.idsIndex.iterMatchingFilters(hashStrings(ids), (rule) => {
if (rule.match(hostname, domain) && !(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(rule))) {
rules.push(rule);
this.idsIndex.iterMatchingFilters(hashStrings(ids), (filter) => {
if (filter.match(hostname, domain) && !(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(filter))) {
filters.push(filter);
}

@@ -327,5 +326,5 @@ return true;

if (allowGenericHides === true && getRulesFromDOM === true && hrefs.length !== 0) {
this.hrefsIndex.iterMatchingFilters(compactTokens(concatTypedArrays(hrefs.map((href) => tokenizeNoSkip(href)))), (rule) => {
if (rule.match(hostname, domain) && !(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(rule))) {
rules.push(rule);
this.hrefsIndex.iterMatchingFilters(compactTokens(concatTypedArrays(hrefs.map((href) => tokenizeNoSkip(href)))), (filter) => {
if (filter.match(hostname, domain) && !(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(filter))) {
filters.push(filter);
}

@@ -335,9 +334,7 @@ return true;

}
const extended = [];
const injections = [];
const styles = [];
const unhides = [];
// If we found at least one candidate, check if we have unhidden rules,
// apply them and dispatch rules into `injections` (i.e.: '+js(...)'),
// `extended` (i.e. :not(...)), and `styles` (i.e.: '##rule').
if (rules.length !== 0) {
if (filters.length !== 0) {
// =======================================================================

@@ -348,59 +345,35 @@ // Rules: unhide

// rules from other indices.
let injectionsDisabled = false;
const disabledRules = new Set();
this.unhideIndex.iterMatchingFilters(hostnameTokens, (rule) => {
if (rule.match(hostname, domain) && !(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(rule))) {
disabledRules.add(rule.getSelector());
// Detect special +js() rules to disable scriptlet injections
if (rule.isScriptInject() === true &&
rule.isUnhide() === true &&
rule.getSelector().length === 0) {
injectionsDisabled = true;
}
this.unhideIndex.iterMatchingFilters(hostnameTokens, (filter) => {
if (filter.match(hostname, domain) && !(isFilterExcluded === null || isFilterExcluded === void 0 ? void 0 : isFilterExcluded(filter))) {
unhides.push(filter);
}
return true;
});
// Apply unhide rules + dispatch
for (const rule of rules) {
// Make sure `rule` is not un-hidden by a #@# filter
if (disabledRules.size !== 0 && disabledRules.has(rule.getSelector())) {
continue;
}
// Dispatch rules in `injections` or `styles` depending on type
if (rule.isScriptInject() === true) {
if (getInjectionRules === true && injectionsDisabled === false) {
injections.push(rule);
}
}
else if (rule.isExtended()) {
if (getExtendedRules === true) {
extended.push(rule);
}
}
else {
styles.push(rule);
}
}
}
// Create final stylesheet
return {
filters,
unhides,
};
}
getStylesheetsFromFilters({ filters, extendedFilters, }, { getBaseRules, allowGenericHides, }) {
let stylesheet = getBaseRules === false || allowGenericHides === false ? '' : this.getBaseStylesheet();
if (styles.length !== 0) {
if (filters.length !== 0) {
if (stylesheet.length !== 0) {
stylesheet += '\n\n';
}
stylesheet += createStylesheetFromRules(styles);
stylesheet += createStylesheetFromRules(filters);
}
const extendedProcessed = [];
if (extended.length !== 0) {
const extended = [];
if (extendedFilters.length !== 0) {
const extendedStyles = new Map();
for (const rule of extended) {
const ast = rule.getSelectorAST();
for (const filter of extendedFilters) {
const ast = filter.getSelectorAST();
if (ast !== undefined) {
const attribute = rule.isRemove() ? undefined : rule.getStyleAttributeHash();
const attribute = filter.isRemove() ? undefined : filter.getStyleAttributeHash();
if (attribute !== undefined) {
extendedStyles.set(rule.getStyle(), attribute);
extendedStyles.set(filter.getStyle(), attribute);
}
extendedProcessed.push({
extended.push({
ast,
remove: rule.isRemove(),
remove: filter.isRemove(),
attribute,

@@ -419,7 +392,3 @@ });

}
return {
extended: extendedProcessed,
injections,
stylesheet,
};
return { stylesheet, extended };
}

@@ -426,0 +395,0 @@ /**

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -15,3 +15,3 @@ * This Source Code Form is subject to the terms of the Mozilla Public

import NetworkFilter from '../filters/network.js';
import { IListDiff, IPartialRawDiff } from '../lists.js';
import { FilterType, IListDiff, IPartialRawDiff } from '../lists.js';
import Request from '../request.js';

@@ -24,3 +24,3 @@ import Resources from '../resources.js';

import PreprocessorBucket from './bucket/preprocessor.js';
export declare const ENGINE_VERSION = 654;
export declare const ENGINE_VERSION = 657;
export interface BlockingResponse {

@@ -42,3 +42,27 @@ match: boolean;

}
export default class FilterEngine extends EventEmitter<'csp-injected' | 'html-filtered' | 'request-allowed' | 'request-blocked' | 'request-redirected' | 'request-whitelisted' | 'script-injected' | 'style-injected'> {
type NetworkFilterMatchingContext = {
request: Request;
filterType: FilterType.NETWORK;
};
type CosmeticFilterMatchingContext = {
url: string;
callerContext: any;
filterType: FilterType.COSMETIC;
};
type NetworkFilterMatchEvent = (request: Request, result: BlockingResponse) => void;
export type EngineEventHandlers = {
'request-allowed': NetworkFilterMatchEvent;
'request-blocked': NetworkFilterMatchEvent;
'request-redirected': NetworkFilterMatchEvent;
'request-whitelisted': NetworkFilterMatchEvent;
'csp-injected': (request: Request, csps: string) => void;
'html-filtered': (htmlSelectors: HTMLSelector[], url: string) => void;
'script-injected': (script: string, url: string) => void;
'style-injected': (style: string, url: string) => void;
'filter-matched': (match: {
filter?: CosmeticFilter | NetworkFilter | undefined;
exception?: CosmeticFilter | NetworkFilter | undefined;
}, context: CosmeticFilterMatchingContext | NetworkFilterMatchingContext) => any;
};
export default class FilterEngine extends EventEmitter<EngineEventHandlers> {
private static fromCached;

@@ -59,3 +83,3 @@ static empty<T extends FilterEngine>(this: new (...args: any[]) => T, config?: Partial<Config>): T;

* Attempt to initialize a blocking engine using a pre-built version served
* from Cliqz's CDN. If this fails (e.g.: if no pre-built engine is available
* from Ghostery's CDN. If this fails (e.g.: if no pre-built engine is available
* for this version of the library), then falls-back to using `fromLists(...)`

@@ -139,6 +163,7 @@ * method with the same subscriptions.

*/
getHtmlFilters({ url, hostname, domain, }: {
getHtmlFilters({ url, hostname, domain, callerContext, }: {
url: string;
hostname: string;
domain: string | null | undefined;
callerContext?: any | undefined;
}): HTMLSelector[];

@@ -149,3 +174,3 @@ /**

*/
getCosmeticsFilters({ url, hostname, domain, classes, hrefs, ids, getBaseRules, getInjectionRules, getExtendedRules, getRulesFromDOM, getRulesFromHostname, }: {
getCosmeticsFilters({ url, hostname, domain, classes, hrefs, ids, getBaseRules, getInjectionRules, getExtendedRules, getRulesFromDOM, getRulesFromHostname, callerContext, }: {
url: string;

@@ -162,2 +187,3 @@ hostname: string;

getRulesFromHostname?: boolean;
callerContext?: any | undefined;
}): IMessageFromBackground;

@@ -188,2 +214,3 @@ /**

}
export {};
//# sourceMappingURL=engine.d.ts.map
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -13,3 +13,3 @@ * This Source Code Form is subject to the terms of the Mozilla Public

import { block } from '../filters/dsl.js';
import { parseFilters } from '../lists.js';
import { FilterType, parseFilters } from '../lists.js';
import Request from '../request.js';

@@ -22,3 +22,3 @@ import Resources from '../resources.js';

import PreprocessorBucket from './bucket/preprocessor.js';
export const ENGINE_VERSION = 654;
export const ENGINE_VERSION = 657;
function shouldApplyHideException(filters) {

@@ -88,3 +88,3 @@ if (filters.length === 0) {

* Attempt to initialize a blocking engine using a pre-built version served
* from Cliqz's CDN. If this fails (e.g.: if no pre-built engine is available
* from Ghostery's CDN. If this fails (e.g.: if no pre-built engine is available
* for this version of the library), then falls-back to using `fromLists(...)`

@@ -452,3 +452,3 @@ * method with the same subscriptions.

// Page information
url, hostname, domain, }) {
url, hostname, domain, callerContext, }) {
const htmlSelectors = [];

@@ -458,12 +458,23 @@ if (this.config.enableHtmlFiltering === false || this.config.loadCosmeticFilters === false) {

}
const rules = this.cosmetics.getHtmlRules({
domain: domain || '',
domain || (domain = '');
const { filters, unhides } = this.cosmetics.getHtmlFilters({
domain,
hostname,
isFilterExcluded: this.isFilterExcluded.bind(this),
});
for (const rule of rules) {
const extended = rule.getExtendedSelector();
if (extended !== undefined) {
const exceptions = new Map(unhides.map((unhide) => [unhide.getSelector(), unhide]));
for (const filter of filters) {
const extended = filter.getExtendedSelector();
if (extended === undefined) {
continue;
}
const exception = exceptions.get(filter.getSelector());
if (exception !== undefined) {
htmlSelectors.push(extended);
}
this.emit('filter-matched', { filter, exception }, {
url,
callerContext,
filterType: FilterType.COSMETIC,
});
}

@@ -485,3 +496,3 @@ if (htmlSelectors.length !== 0) {

// Allows to specify which rules to return
getBaseRules = true, getInjectionRules = true, getExtendedRules = true, getRulesFromDOM = true, getRulesFromHostname = true, }) {
getBaseRules = true, getInjectionRules = true, getExtendedRules = true, getRulesFromDOM = true, getRulesFromHostname = true, callerContext, }) {
if (this.config.loadCosmeticFilters === false) {

@@ -495,6 +506,7 @@ return {

}
domain || (domain = '');
let allowGenericHides = true;
let allowSpecificHides = true;
const exceptions = this.hideExceptions.matchAll(Request.fromRawDetails({
domain: domain || '',
domain,
hostname,

@@ -528,4 +540,4 @@ url,

// Lookup injections as well as stylesheets
const { injections, stylesheet, extended } = this.cosmetics.getCosmeticsFilters({
domain: domain || '',
const { filters, unhides } = this.cosmetics.getCosmeticsFilters({
domain,
hostname,

@@ -537,5 +549,2 @@ classes,

allowSpecificHides,
getBaseRules,
getInjectionRules,
getExtendedRules,
getRulesFromDOM,

@@ -545,2 +554,53 @@ getRulesFromHostname,

});
let injectionsDisabled = false;
const unhideExceptions = new Map();
for (const unhide of unhides) {
if (unhide.isScriptInject() === true &&
unhide.isUnhide() === true &&
unhide.getSelector().length === 0) {
injectionsDisabled = true;
}
unhideExceptions.set(unhide.getSelector(), unhide);
}
const injections = [];
const styleFilters = [];
const extendedFilters = [];
if (filters.length !== 0) {
// Apply unhide rules + dispatch
for (const filter of filters) {
// Make sure `rule` is not un-hidden by a #@# filter
const exception = unhideExceptions.get(filter.getSelector());
if (exception !== undefined) {
continue;
}
let applied = false;
// Dispatch filters in `injections` or `styles` depending on type
if (filter.isScriptInject() === true) {
if (getInjectionRules === true && injectionsDisabled === false) {
injections.push(filter);
applied = true;
}
}
else if (filter.isExtended()) {
if (getExtendedRules === true) {
extendedFilters.push(filter);
applied = true;
}
}
else {
styleFilters.push(filter);
applied = true;
}
if (applied) {
this.emit('filter-matched', {
filter,
exception,
}, {
url,
callerContext,
filterType: FilterType.COSMETIC,
});
}
}
}
// Perform interpolation for injected scripts

@@ -555,2 +615,6 @@ const scripts = [];

}
const { stylesheet, extended } = this.cosmetics.getStylesheetsFromFilters({
filters: styleFilters,
extendedFilters,
}, { getBaseRules, allowGenericHides });
// Emit events

@@ -599,4 +663,4 @@ if (stylesheet.length !== 0) {

// Collect all CSP directives and keep track of exceptions
const disabledCsp = new Set();
const enabledCsp = new Set();
const cspExceptions = new Map();
const cspFilters = [];
for (const filter of matches) {

@@ -606,18 +670,27 @@ if (filter.isException()) {

// All CSP directives are disabled for this site
this.emit('filter-matched', { exception: filter }, { request, filterType: FilterType.NETWORK });
return undefined;
}
disabledCsp.add(filter.csp);
cspExceptions.set(filter.csp, filter);
}
else {
enabledCsp.add(filter.csp);
cspFilters.push(filter);
}
}
if (cspFilters.length === 0) {
return undefined;
}
const enabledCsp = new Set();
// Combine all CSPs (except the black-listed ones)
const csps = Array.from(enabledCsp)
.filter((csp) => !disabledCsp.has(csp))
.join('; ') || undefined;
// Emit event
if (csps !== undefined) {
this.emit('csp-injected', csps, request);
for (const filter of cspFilters.values()) {
const exception = cspExceptions.get(filter.csp);
if (exception === undefined) {
enabledCsp.add(filter.csp);
}
this.emit('filter-matched', { filter, exception }, { request, filterType: FilterType.NETWORK });
}
const csps = Array.from(enabledCsp).join('; ');
if (csps.length > 0) {
this.emit('csp-injected', request, csps);
}
return csps;

@@ -707,3 +780,5 @@ }

result.match = result.exception === undefined && result.filter !== undefined;
// Emit events if we found a match
if (result.filter) {
this.emit('filter-matched', { filter: result.filter, exception: result.exception }, { request, filterType: FilterType.NETWORK });
}
if (result.exception !== undefined) {

@@ -710,0 +785,0 @@ this.emit('request-whitelisted', request, result);

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -8,3 +8,3 @@ * This Source Code Form is subject to the terms of the Mozilla Public

*/
import NetworkFilter from '../filters/network.js';
import NetworkFilter, { NETWORK_FILTER_MASK } from '../filters/network.js';
import { setBit } from '../utils.js';

@@ -126,3 +126,3 @@ import { Domains } from '../engine/domains.js';

return new NetworkFilter(Object.assign({}, filters[0], {
mask: setBit(filters[0].mask, 8388608 /* NETWORK_FILTER_MASK.isRegex */),
mask: setBit(filters[0].mask, NETWORK_FILTER_MASK.isRegex),
rawLine: filters[0].rawLine !== undefined

@@ -134,3 +134,3 @@ ? filters.map(({ rawLine }) => rawLine).join(' <+> ')

},
groupByCriteria: (filter) => '' + (filter.getMask() & ~8388608 /* NETWORK_FILTER_MASK.isRegex */ & ~4194304 /* NETWORK_FILTER_MASK.isFullRegex */),
groupByCriteria: (filter) => '' + (filter.getMask() & ~NETWORK_FILTER_MASK.isRegex & ~NETWORK_FILTER_MASK.isFullRegex),
select: (filter) => filter.domains === undefined &&

@@ -137,0 +137,0 @@ filter.denyallow === undefined &&

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -9,7 +9,2 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/**
* Type of an event listener (i.e.: callback). It accepts arbitrary arguments
* and is not expected to return any result.
*/
type EventListener = (...args: any[]) => void;
/**
* Simple and efficient `EventEmitter` abstraction (following conventions from

@@ -19,3 +14,3 @@ * Node.js) allowing partially typed event emitting. The set of event names is

*/
export declare class EventEmitter<EventNames> {
export declare class EventEmitter<EventHandlers extends Record<string, (...args: any[]) => any>, EventNames extends keyof EventHandlers = keyof EventHandlers> {
private onceListeners;

@@ -26,3 +21,3 @@ private onListeners;

*/
on(event: EventNames, callback: EventListener): void;
on<EventName extends EventNames>(event: EventName, callback: EventHandlers[EventName]): void;
/**

@@ -32,13 +27,12 @@ * Register an event listener for `event`; but only listen to first instance

*/
once(event: EventNames, callback: EventListener): void;
once<EventName extends EventNames>(event: EventName, callback: EventHandlers[EventName]): void;
/**
* Remove `callback` from list of listeners for `event`.
*/
unsubscribe(event: EventNames, callback: EventListener): void;
unsubscribe<EventName extends EventNames>(event: EventName, callback: EventHandlers[EventName]): void;
/**
* Emit an event. Call all registered listeners to this event.
*/
emit(event: EventNames, ...args: any[]): void;
emit<EventName extends EventNames>(event: EventName, ...args: Parameters<EventHandlers[EventName]>): void;
}
export {};
//# sourceMappingURL=events.d.ts.map
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -90,2 +90,16 @@ * This Source Code Form is subject to the terms of the Mozilla Public

})();
/**
* Masks used to store options of cosmetic filters in a bitmask.
*/
var COSMETICS_MASK;
(function (COSMETICS_MASK) {
COSMETICS_MASK[COSMETICS_MASK["unhide"] = 1] = "unhide";
COSMETICS_MASK[COSMETICS_MASK["scriptInject"] = 2] = "scriptInject";
COSMETICS_MASK[COSMETICS_MASK["isUnicode"] = 4] = "isUnicode";
COSMETICS_MASK[COSMETICS_MASK["isClassSelector"] = 8] = "isClassSelector";
COSMETICS_MASK[COSMETICS_MASK["isIdSelector"] = 16] = "isIdSelector";
COSMETICS_MASK[COSMETICS_MASK["isHrefSelector"] = 32] = "isHrefSelector";
COSMETICS_MASK[COSMETICS_MASK["remove"] = 64] = "remove";
COSMETICS_MASK[COSMETICS_MASK["extended"] = 128] = "extended";
})(COSMETICS_MASK || (COSMETICS_MASK = {}));
function computeFilterId(mask, selector, domains, style) {

@@ -140,3 +154,3 @@ let hash = (HASH_SEED * HASH_INTERNAL_MULT) ^ mask;

if (line[afterSharpIndex] === '@') {
mask = setBit(mask, 1 /* COSMETICS_MASK.unhide */);
mask = setBit(mask, COSMETICS_MASK.unhide);
suffixStartIndex += 1;

@@ -166,4 +180,4 @@ }

// ##selector:remove()
mask = setBit(mask, 64 /* COSMETICS_MASK.remove */);
mask = setBit(mask, 128 /* COSMETICS_MASK.extended */);
mask = setBit(mask, COSMETICS_MASK.remove);
mask = setBit(mask, COSMETICS_MASK.extended);
line = line.slice(0, -9);

@@ -206,6 +220,6 @@ }

(domains.hostnames === undefined && domains.entities === undefined)) &&
getBit(mask, 1 /* COSMETICS_MASK.unhide */) === false) {
getBit(mask, COSMETICS_MASK.unhide) === false) {
return null;
}
mask = setBit(mask, 2 /* COSMETICS_MASK.scriptInject */);
mask = setBit(mask, COSMETICS_MASK.scriptInject);
selector = line.slice(suffixStartIndex + 4, line.length - 1);

@@ -215,3 +229,3 @@ // An empty scriptlet (i.e. '+js()') can be specified to cancel injections

// an empty scriptlet without an exception (i.e. '#@#' is mandatory).
if (getBit(mask, 1 /* COSMETICS_MASK.unhide */) === false && selector.length === 0) {
if (getBit(mask, COSMETICS_MASK.unhide) === false && selector.length === 0) {
return null;

@@ -224,3 +238,3 @@ }

if (selectorType === SelectorType.Extended) {
mask = setBit(mask, 128 /* COSMETICS_MASK.extended */);
mask = setBit(mask, COSMETICS_MASK.extended);
}

@@ -234,3 +248,3 @@ else if (selectorType === SelectorType.Invalid || !isValidCss(selector)) {

// Extended selectors should always be specific to some domain.
if (domains === undefined && getBit(mask, 128 /* COSMETICS_MASK.extended */) === true) {
if (domains === undefined && getBit(mask, COSMETICS_MASK.extended) === true) {
return null;

@@ -241,8 +255,8 @@ }

if (hasUnicode(selector)) {
mask = setBit(mask, 4 /* COSMETICS_MASK.isUnicode */);
mask = setBit(mask, COSMETICS_MASK.isUnicode);
}
// Classify selector
if (getBit(mask, 2 /* COSMETICS_MASK.scriptInject */) === false &&
getBit(mask, 64 /* COSMETICS_MASK.remove */) === false &&
getBit(mask, 128 /* COSMETICS_MASK.extended */) === false &&
if (getBit(mask, COSMETICS_MASK.scriptInject) === false &&
getBit(mask, COSMETICS_MASK.remove) === false &&
getBit(mask, COSMETICS_MASK.extended) === false &&
selector.startsWith('^') === false) {

@@ -255,8 +269,8 @@ const c0 = selector.charCodeAt(0);

// a custom dispatch mechanism.
if (getBit(mask, 2 /* COSMETICS_MASK.scriptInject */) === false) {
if (getBit(mask, COSMETICS_MASK.scriptInject) === false) {
if (c0 === 46 /* '.' */ && isSimpleSelector(selector)) {
mask = setBit(mask, 8 /* COSMETICS_MASK.isClassSelector */);
mask = setBit(mask, COSMETICS_MASK.isClassSelector);
}
else if (c0 === 35 /* '#' */ && isSimpleSelector(selector)) {
mask = setBit(mask, 16 /* COSMETICS_MASK.isIdSelector */);
mask = setBit(mask, COSMETICS_MASK.isIdSelector);
}

@@ -267,3 +281,3 @@ else if (c0 === 97 /* a */ &&

isSimpleHrefSelector(selector, 2)) {
mask = setBit(mask, 32 /* COSMETICS_MASK.isHrefSelector */);
mask = setBit(mask, COSMETICS_MASK.isHrefSelector);
}

@@ -273,3 +287,3 @@ else if (c0 === 91 /* '[' */ &&

isSimpleHrefSelector(selector, 1)) {
mask = setBit(mask, 32 /* COSMETICS_MASK.isHrefSelector */);
mask = setBit(mask, COSMETICS_MASK.isHrefSelector);
}

@@ -293,3 +307,3 @@ }

const mask = buffer.getUint8();
const isUnicode = getBit(mask, 4 /* COSMETICS_MASK.isUnicode */);
const isUnicode = getBit(mask, COSMETICS_MASK.isUnicode);
const optionalParts = buffer.getUint8();

@@ -673,12 +687,12 @@ const selector = isUnicode ? buffer.getUTF8() : buffer.getCosmeticSelector();

isExtended() {
return getBit(this.mask, 128 /* COSMETICS_MASK.extended */);
return getBit(this.mask, COSMETICS_MASK.extended);
}
isRemove() {
return getBit(this.mask, 64 /* COSMETICS_MASK.remove */);
return getBit(this.mask, COSMETICS_MASK.remove);
}
isUnhide() {
return getBit(this.mask, 1 /* COSMETICS_MASK.unhide */);
return getBit(this.mask, COSMETICS_MASK.unhide);
}
isScriptInject() {
return getBit(this.mask, 2 /* COSMETICS_MASK.scriptInject */);
return getBit(this.mask, COSMETICS_MASK.scriptInject);
}

@@ -689,12 +703,12 @@ isCSS() {

isIdSelector() {
return getBit(this.mask, 16 /* COSMETICS_MASK.isIdSelector */);
return getBit(this.mask, COSMETICS_MASK.isIdSelector);
}
isClassSelector() {
return getBit(this.mask, 8 /* COSMETICS_MASK.isClassSelector */);
return getBit(this.mask, COSMETICS_MASK.isClassSelector);
}
isHrefSelector() {
return getBit(this.mask, 32 /* COSMETICS_MASK.isHrefSelector */);
return getBit(this.mask, COSMETICS_MASK.isHrefSelector);
}
isUnicode() {
return getBit(this.mask, 4 /* COSMETICS_MASK.isUnicode */);
return getBit(this.mask, COSMETICS_MASK.isUnicode);
}

@@ -701,0 +715,0 @@ isHtmlFiltering() {

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -71,16 +71,56 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/**
* Masks used to store options of network filters in a bitmask.
*/
export var NETWORK_FILTER_MASK;
(function (NETWORK_FILTER_MASK) {
// Request Type
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromDocument"] = 1] = "fromDocument";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromFont"] = 2] = "fromFont";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromHttp"] = 4] = "fromHttp";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromHttps"] = 8] = "fromHttps";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromImage"] = 16] = "fromImage";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromMedia"] = 32] = "fromMedia";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromObject"] = 64] = "fromObject";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromOther"] = 128] = "fromOther";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromPing"] = 256] = "fromPing";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromScript"] = 512] = "fromScript";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromStylesheet"] = 1024] = "fromStylesheet";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromSubdocument"] = 2048] = "fromSubdocument";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromWebsocket"] = 4096] = "fromWebsocket";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["fromXmlHttpRequest"] = 8192] = "fromXmlHttpRequest";
// Partiness
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["firstParty"] = 16384] = "firstParty";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["thirdParty"] = 32768] = "thirdParty";
// Options
// FREE - 1 << 16
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isBadFilter"] = 131072] = "isBadFilter";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isCSP"] = 262144] = "isCSP";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isGenericHide"] = 524288] = "isGenericHide";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isImportant"] = 1048576] = "isImportant";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isSpecificHide"] = 2097152] = "isSpecificHide";
// Kind of patterns
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isFullRegex"] = 4194304] = "isFullRegex";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isRegex"] = 8388608] = "isRegex";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isUnicode"] = 16777216] = "isUnicode";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isLeftAnchor"] = 33554432] = "isLeftAnchor";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isRightAnchor"] = 67108864] = "isRightAnchor";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isException"] = 134217728] = "isException";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isHostnameAnchor"] = 268435456] = "isHostnameAnchor";
NETWORK_FILTER_MASK[NETWORK_FILTER_MASK["isRedirectRule"] = 536870912] = "isRedirectRule";
})(NETWORK_FILTER_MASK || (NETWORK_FILTER_MASK = {}));
/**
* Mask used when a network filter can be applied on any content type.
*/
const FROM_ANY = 1 /* NETWORK_FILTER_MASK.fromDocument */ |
2 /* NETWORK_FILTER_MASK.fromFont */ |
16 /* NETWORK_FILTER_MASK.fromImage */ |
32 /* NETWORK_FILTER_MASK.fromMedia */ |
64 /* NETWORK_FILTER_MASK.fromObject */ |
128 /* NETWORK_FILTER_MASK.fromOther */ |
256 /* NETWORK_FILTER_MASK.fromPing */ |
512 /* NETWORK_FILTER_MASK.fromScript */ |
1024 /* NETWORK_FILTER_MASK.fromStylesheet */ |
2048 /* NETWORK_FILTER_MASK.fromSubdocument */ |
4096 /* NETWORK_FILTER_MASK.fromWebsocket */ |
8192 /* NETWORK_FILTER_MASK.fromXmlHttpRequest */;
const FROM_ANY = NETWORK_FILTER_MASK.fromDocument |
NETWORK_FILTER_MASK.fromFont |
NETWORK_FILTER_MASK.fromImage |
NETWORK_FILTER_MASK.fromMedia |
NETWORK_FILTER_MASK.fromObject |
NETWORK_FILTER_MASK.fromOther |
NETWORK_FILTER_MASK.fromPing |
NETWORK_FILTER_MASK.fromScript |
NETWORK_FILTER_MASK.fromStylesheet |
NETWORK_FILTER_MASK.fromSubdocument |
NETWORK_FILTER_MASK.fromWebsocket |
NETWORK_FILTER_MASK.fromXmlHttpRequest;
/**

@@ -91,37 +131,37 @@ * Map content type value to mask the corresponding mask.

const REQUEST_TYPE_TO_MASK = {
beacon: 256 /* NETWORK_FILTER_MASK.fromPing */, // fromOther?
document: 1 /* NETWORK_FILTER_MASK.fromDocument */,
cspviolationreport: 128 /* NETWORK_FILTER_MASK.fromOther */,
fetch: 8192 /* NETWORK_FILTER_MASK.fromXmlHttpRequest */,
font: 2 /* NETWORK_FILTER_MASK.fromFont */,
image: 16 /* NETWORK_FILTER_MASK.fromImage */,
imageset: 16 /* NETWORK_FILTER_MASK.fromImage */,
mainFrame: 1 /* NETWORK_FILTER_MASK.fromDocument */,
main_frame: 1 /* NETWORK_FILTER_MASK.fromDocument */,
media: 32 /* NETWORK_FILTER_MASK.fromMedia */,
object: 64 /* NETWORK_FILTER_MASK.fromObject */,
object_subrequest: 64 /* NETWORK_FILTER_MASK.fromObject */,
ping: 256 /* NETWORK_FILTER_MASK.fromPing */, // fromOther?
script: 512 /* NETWORK_FILTER_MASK.fromScript */,
stylesheet: 1024 /* NETWORK_FILTER_MASK.fromStylesheet */,
subFrame: 2048 /* NETWORK_FILTER_MASK.fromSubdocument */,
sub_frame: 2048 /* NETWORK_FILTER_MASK.fromSubdocument */,
webSocket: 4096 /* NETWORK_FILTER_MASK.fromWebsocket */,
websocket: 4096 /* NETWORK_FILTER_MASK.fromWebsocket */,
xhr: 8192 /* NETWORK_FILTER_MASK.fromXmlHttpRequest */,
xmlhttprequest: 8192 /* NETWORK_FILTER_MASK.fromXmlHttpRequest */,
beacon: NETWORK_FILTER_MASK.fromPing, // fromOther?
document: NETWORK_FILTER_MASK.fromDocument,
cspviolationreport: NETWORK_FILTER_MASK.fromOther,
fetch: NETWORK_FILTER_MASK.fromXmlHttpRequest,
font: NETWORK_FILTER_MASK.fromFont,
image: NETWORK_FILTER_MASK.fromImage,
imageset: NETWORK_FILTER_MASK.fromImage,
mainFrame: NETWORK_FILTER_MASK.fromDocument,
main_frame: NETWORK_FILTER_MASK.fromDocument,
media: NETWORK_FILTER_MASK.fromMedia,
object: NETWORK_FILTER_MASK.fromObject,
object_subrequest: NETWORK_FILTER_MASK.fromObject,
ping: NETWORK_FILTER_MASK.fromPing, // fromOther?
script: NETWORK_FILTER_MASK.fromScript,
stylesheet: NETWORK_FILTER_MASK.fromStylesheet,
subFrame: NETWORK_FILTER_MASK.fromSubdocument,
sub_frame: NETWORK_FILTER_MASK.fromSubdocument,
webSocket: NETWORK_FILTER_MASK.fromWebsocket,
websocket: NETWORK_FILTER_MASK.fromWebsocket,
xhr: NETWORK_FILTER_MASK.fromXmlHttpRequest,
xmlhttprequest: NETWORK_FILTER_MASK.fromXmlHttpRequest,
// Other
cspReport: 128 /* NETWORK_FILTER_MASK.fromOther */,
csp_report: 128 /* NETWORK_FILTER_MASK.fromOther */,
eventsource: 128 /* NETWORK_FILTER_MASK.fromOther */,
manifest: 128 /* NETWORK_FILTER_MASK.fromOther */,
other: 128 /* NETWORK_FILTER_MASK.fromOther */,
prefetch: 128 /* NETWORK_FILTER_MASK.fromOther */,
preflight: 128 /* NETWORK_FILTER_MASK.fromOther */,
signedexchange: 128 /* NETWORK_FILTER_MASK.fromOther */,
speculative: 128 /* NETWORK_FILTER_MASK.fromOther */,
texttrack: 128 /* NETWORK_FILTER_MASK.fromOther */,
web_manifest: 128 /* NETWORK_FILTER_MASK.fromOther */,
xml_dtd: 128 /* NETWORK_FILTER_MASK.fromOther */,
xslt: 128 /* NETWORK_FILTER_MASK.fromOther */,
cspReport: NETWORK_FILTER_MASK.fromOther,
csp_report: NETWORK_FILTER_MASK.fromOther,
eventsource: NETWORK_FILTER_MASK.fromOther,
manifest: NETWORK_FILTER_MASK.fromOther,
other: NETWORK_FILTER_MASK.fromOther,
prefetch: NETWORK_FILTER_MASK.fromOther,
preflight: NETWORK_FILTER_MASK.fromOther,
signedexchange: NETWORK_FILTER_MASK.fromOther,
speculative: NETWORK_FILTER_MASK.fromOther,
texttrack: NETWORK_FILTER_MASK.fromOther,
web_manifest: NETWORK_FILTER_MASK.fromOther,
xml_dtd: NETWORK_FILTER_MASK.fromOther,
xslt: NETWORK_FILTER_MASK.fromOther,
};

@@ -276,6 +316,6 @@ function getListOfRequestTypesNegated(filter) {

// Represent options as a bitmask
let mask = 32768 /* NETWORK_FILTER_MASK.thirdParty */ |
16384 /* NETWORK_FILTER_MASK.firstParty */ |
8 /* NETWORK_FILTER_MASK.fromHttps */ |
4 /* NETWORK_FILTER_MASK.fromHttp */;
let mask = NETWORK_FILTER_MASK.thirdParty |
NETWORK_FILTER_MASK.firstParty |
NETWORK_FILTER_MASK.fromHttps |
NETWORK_FILTER_MASK.fromHttp;
// Temporary masks for positive (e.g.: $script) and negative (e.g.: $~script)

@@ -296,3 +336,3 @@ // content type options.

filterIndexStart += 2;
mask = setBit(mask, 134217728 /* NETWORK_FILTER_MASK.isException */);
mask = setBit(mask, NETWORK_FILTER_MASK.isException);
}

@@ -337,3 +377,3 @@ // filter$options == Options

case 'badfilter':
mask = setBit(mask, 131072 /* NETWORK_FILTER_MASK.isBadFilter */);
mask = setBit(mask, NETWORK_FILTER_MASK.isBadFilter);
break;

@@ -345,3 +385,3 @@ case 'important':

}
mask = setBit(mask, 1048576 /* NETWORK_FILTER_MASK.isImportant */);
mask = setBit(mask, NETWORK_FILTER_MASK.isImportant);
break;

@@ -359,7 +399,7 @@ case 'match-case':

// ~third-party means we should clear the flag
mask = clearBit(mask, 32768 /* NETWORK_FILTER_MASK.thirdParty */);
mask = clearBit(mask, NETWORK_FILTER_MASK.thirdParty);
}
else {
// third-party means ~first-party
mask = clearBit(mask, 16384 /* NETWORK_FILTER_MASK.firstParty */);
mask = clearBit(mask, NETWORK_FILTER_MASK.firstParty);
}

@@ -371,7 +411,7 @@ break;

// ~first-party means we should clear the flag
mask = clearBit(mask, 16384 /* NETWORK_FILTER_MASK.firstParty */);
mask = clearBit(mask, NETWORK_FILTER_MASK.firstParty);
}
else {
// first-party means ~third-party
mask = clearBit(mask, 32768 /* NETWORK_FILTER_MASK.thirdParty */);
mask = clearBit(mask, NETWORK_FILTER_MASK.thirdParty);
}

@@ -390,3 +430,3 @@ break;

if (option === 'redirect-rule') {
mask = setBit(mask, 536870912 /* NETWORK_FILTER_MASK.isRedirectRule */);
mask = setBit(mask, NETWORK_FILTER_MASK.isRedirectRule);
}

@@ -399,3 +439,3 @@ redirect = optionValue;

}
mask = setBit(mask, 262144 /* NETWORK_FILTER_MASK.isCSP */);
mask = setBit(mask, NETWORK_FILTER_MASK.isCSP);
if (optionValue.length > 0) {

@@ -410,4 +450,4 @@ csp = optionValue;

}
mask = setBit(mask, 524288 /* NETWORK_FILTER_MASK.isGenericHide */);
mask = setBit(mask, 2097152 /* NETWORK_FILTER_MASK.isSpecificHide */);
mask = setBit(mask, NETWORK_FILTER_MASK.isGenericHide);
mask = setBit(mask, NETWORK_FILTER_MASK.isSpecificHide);
break;

@@ -419,3 +459,3 @@ case 'shide':

}
mask = setBit(mask, 2097152 /* NETWORK_FILTER_MASK.isSpecificHide */);
mask = setBit(mask, NETWORK_FILTER_MASK.isSpecificHide);
break;

@@ -427,3 +467,3 @@ case 'ghide':

}
mask = setBit(mask, 524288 /* NETWORK_FILTER_MASK.isGenericHide */);
mask = setBit(mask, NETWORK_FILTER_MASK.isGenericHide);
break;

@@ -434,3 +474,3 @@ case 'inline-script':

}
mask = setBit(mask, 262144 /* NETWORK_FILTER_MASK.isCSP */);
mask = setBit(mask, NETWORK_FILTER_MASK.isCSP);
csp =

@@ -443,3 +483,3 @@ "script-src 'self' 'unsafe-eval' http: https: data: blob: mediastream: filesystem:";

}
mask = setBit(mask, 262144 /* NETWORK_FILTER_MASK.isCSP */);
mask = setBit(mask, NETWORK_FILTER_MASK.isCSP);
csp =

@@ -466,42 +506,42 @@ "font-src 'self' 'unsafe-eval' http: https: data: blob: mediastream: filesystem:";

case 'image':
optionMask = 16 /* NETWORK_FILTER_MASK.fromImage */;
optionMask = NETWORK_FILTER_MASK.fromImage;
break;
case 'media':
optionMask = 32 /* NETWORK_FILTER_MASK.fromMedia */;
optionMask = NETWORK_FILTER_MASK.fromMedia;
break;
case 'object':
case 'object-subrequest':
optionMask = 64 /* NETWORK_FILTER_MASK.fromObject */;
optionMask = NETWORK_FILTER_MASK.fromObject;
break;
case 'other':
optionMask = 128 /* NETWORK_FILTER_MASK.fromOther */;
optionMask = NETWORK_FILTER_MASK.fromOther;
break;
case 'ping':
case 'beacon':
optionMask = 256 /* NETWORK_FILTER_MASK.fromPing */;
optionMask = NETWORK_FILTER_MASK.fromPing;
break;
case 'script':
optionMask = 512 /* NETWORK_FILTER_MASK.fromScript */;
optionMask = NETWORK_FILTER_MASK.fromScript;
break;
case 'css':
case 'stylesheet':
optionMask = 1024 /* NETWORK_FILTER_MASK.fromStylesheet */;
optionMask = NETWORK_FILTER_MASK.fromStylesheet;
break;
case 'frame':
case 'subdocument':
optionMask = 2048 /* NETWORK_FILTER_MASK.fromSubdocument */;
optionMask = NETWORK_FILTER_MASK.fromSubdocument;
break;
case 'xhr':
case 'xmlhttprequest':
optionMask = 8192 /* NETWORK_FILTER_MASK.fromXmlHttpRequest */;
optionMask = NETWORK_FILTER_MASK.fromXmlHttpRequest;
break;
case 'websocket':
optionMask = 4096 /* NETWORK_FILTER_MASK.fromWebsocket */;
optionMask = NETWORK_FILTER_MASK.fromWebsocket;
break;
case 'font':
optionMask = 2 /* NETWORK_FILTER_MASK.fromFont */;
optionMask = NETWORK_FILTER_MASK.fromFont;
break;
case 'doc':
case 'document':
optionMask = 1 /* NETWORK_FILTER_MASK.fromDocument */;
optionMask = NETWORK_FILTER_MASK.fromDocument;
break;

@@ -553,3 +593,3 @@ default:

}
mask = setBit(mask, 4194304 /* NETWORK_FILTER_MASK.isFullRegex */);
mask = setBit(mask, NETWORK_FILTER_MASK.isFullRegex);
}

@@ -559,3 +599,3 @@ else {

if (filterIndexEnd > 0 && line.charCodeAt(filterIndexEnd - 1) === 124 /* '|' */) {
mask = setBit(mask, 67108864 /* NETWORK_FILTER_MASK.isRightAnchor */);
mask = setBit(mask, NETWORK_FILTER_MASK.isRightAnchor);
filterIndexEnd -= 1;

@@ -567,7 +607,7 @@ }

line.charCodeAt(filterIndexStart + 1) === 124 /* '|' */) {
mask = setBit(mask, 268435456 /* NETWORK_FILTER_MASK.isHostnameAnchor */);
mask = setBit(mask, NETWORK_FILTER_MASK.isHostnameAnchor);
filterIndexStart += 2;
}
else {
mask = setBit(mask, 33554432 /* NETWORK_FILTER_MASK.isLeftAnchor */);
mask = setBit(mask, NETWORK_FILTER_MASK.isLeftAnchor);
filterIndexStart += 1;

@@ -578,3 +618,3 @@ }

// mask = setNetworkMask(mask, NETWORK_FILTER_MASK.isRegex, isRegex);
if (getBit(mask, 268435456 /* NETWORK_FILTER_MASK.isHostnameAnchor */)) {
if (getBit(mask, NETWORK_FILTER_MASK.isHostnameAnchor)) {
// Split at the first character which is not allowed in a hostname

@@ -603,15 +643,15 @@ let firstSeparator = filterIndexStart;

filterIndexStart = filterIndexEnd;
mask = setBit(mask, 67108864 /* NETWORK_FILTER_MASK.isRightAnchor */);
mask = setBit(mask, NETWORK_FILTER_MASK.isRightAnchor);
}
else {
mask = setBit(mask, 8388608 /* NETWORK_FILTER_MASK.isRegex */);
mask = setBit(mask, 33554432 /* NETWORK_FILTER_MASK.isLeftAnchor */);
mask = setBit(mask, NETWORK_FILTER_MASK.isRegex);
mask = setBit(mask, NETWORK_FILTER_MASK.isLeftAnchor);
}
}
else if (separatorCode === 42 /* '*' */) {
mask = setBit(mask, 8388608 /* NETWORK_FILTER_MASK.isRegex */);
mask = setBit(mask, NETWORK_FILTER_MASK.isRegex);
// mask = setBit(mask, NETWORK_FILTER_MASK.isLeftAnchor);
}
else {
mask = setBit(mask, 33554432 /* NETWORK_FILTER_MASK.isLeftAnchor */);
mask = setBit(mask, NETWORK_FILTER_MASK.isLeftAnchor);
}

@@ -626,16 +666,16 @@ }

// Remove leading '*' if the filter is not hostname anchored.
if (getBit(mask, 268435456 /* NETWORK_FILTER_MASK.isHostnameAnchor */) === false &&
if (getBit(mask, NETWORK_FILTER_MASK.isHostnameAnchor) === false &&
filterIndexEnd - filterIndexStart > 0 &&
line.charCodeAt(filterIndexStart) === 42 /* '*' */) {
mask = clearBit(mask, 33554432 /* NETWORK_FILTER_MASK.isLeftAnchor */);
mask = clearBit(mask, NETWORK_FILTER_MASK.isLeftAnchor);
filterIndexStart += 1;
}
// Transform filters on protocol (http, https, ws)
if (getBit(mask, 33554432 /* NETWORK_FILTER_MASK.isLeftAnchor */)) {
if (getBit(mask, NETWORK_FILTER_MASK.isLeftAnchor)) {
if (filterIndexEnd - filterIndexStart === 5 &&
fastStartsWithFrom(line, 'ws://', filterIndexStart)) {
mask = setBit(mask, 4096 /* NETWORK_FILTER_MASK.fromWebsocket */);
mask = clearBit(mask, 33554432 /* NETWORK_FILTER_MASK.isLeftAnchor */);
mask = clearBit(mask, 4 /* NETWORK_FILTER_MASK.fromHttp */);
mask = clearBit(mask, 8 /* NETWORK_FILTER_MASK.fromHttps */);
mask = setBit(mask, NETWORK_FILTER_MASK.fromWebsocket);
mask = clearBit(mask, NETWORK_FILTER_MASK.isLeftAnchor);
mask = clearBit(mask, NETWORK_FILTER_MASK.fromHttp);
mask = clearBit(mask, NETWORK_FILTER_MASK.fromHttps);
filterIndexStart = filterIndexEnd;

@@ -645,5 +685,5 @@ }

fastStartsWithFrom(line, 'http://', filterIndexStart)) {
mask = setBit(mask, 4 /* NETWORK_FILTER_MASK.fromHttp */);
mask = clearBit(mask, 8 /* NETWORK_FILTER_MASK.fromHttps */);
mask = clearBit(mask, 33554432 /* NETWORK_FILTER_MASK.isLeftAnchor */);
mask = setBit(mask, NETWORK_FILTER_MASK.fromHttp);
mask = clearBit(mask, NETWORK_FILTER_MASK.fromHttps);
mask = clearBit(mask, NETWORK_FILTER_MASK.isLeftAnchor);
filterIndexStart = filterIndexEnd;

@@ -653,5 +693,5 @@ }

fastStartsWithFrom(line, 'https://', filterIndexStart)) {
mask = setBit(mask, 8 /* NETWORK_FILTER_MASK.fromHttps */);
mask = clearBit(mask, 4 /* NETWORK_FILTER_MASK.fromHttp */);
mask = clearBit(mask, 33554432 /* NETWORK_FILTER_MASK.isLeftAnchor */);
mask = setBit(mask, NETWORK_FILTER_MASK.fromHttps);
mask = clearBit(mask, NETWORK_FILTER_MASK.fromHttp);
mask = clearBit(mask, NETWORK_FILTER_MASK.isLeftAnchor);
filterIndexStart = filterIndexEnd;

@@ -661,5 +701,5 @@ }

fastStartsWithFrom(line, 'http*://', filterIndexStart)) {
mask = setBit(mask, 8 /* NETWORK_FILTER_MASK.fromHttps */);
mask = setBit(mask, 4 /* NETWORK_FILTER_MASK.fromHttp */);
mask = clearBit(mask, 33554432 /* NETWORK_FILTER_MASK.isLeftAnchor */);
mask = setBit(mask, NETWORK_FILTER_MASK.fromHttps);
mask = setBit(mask, NETWORK_FILTER_MASK.fromHttp);
mask = clearBit(mask, NETWORK_FILTER_MASK.isLeftAnchor);
filterIndexStart = filterIndexEnd;

@@ -670,5 +710,5 @@ }

filter = line.slice(filterIndexStart, filterIndexEnd).toLowerCase();
mask = setNetworkMask(mask, 16777216 /* NETWORK_FILTER_MASK.isUnicode */, hasUnicode(filter));
if (getBit(mask, 8388608 /* NETWORK_FILTER_MASK.isRegex */) === false) {
mask = setNetworkMask(mask, 8388608 /* NETWORK_FILTER_MASK.isRegex */, checkIsRegex(filter, 0, filter.length));
mask = setNetworkMask(mask, NETWORK_FILTER_MASK.isUnicode, hasUnicode(filter));
if (getBit(mask, NETWORK_FILTER_MASK.isRegex) === false) {
mask = setNetworkMask(mask, NETWORK_FILTER_MASK.isRegex, checkIsRegex(filter, 0, filter.length));
}

@@ -681,3 +721,3 @@ }

if (hasUnicode(hostname)) {
mask = setNetworkMask(mask, 16777216 /* NETWORK_FILTER_MASK.isUnicode */, true);
mask = setNetworkMask(mask, NETWORK_FILTER_MASK.isUnicode, true);
hostname = toASCII(hostname);

@@ -706,3 +746,3 @@ }

const optionalParts = buffer.getUint8();
const isUnicode = getBit(mask, 16777216 /* NETWORK_FILTER_MASK.isUnicode */);
const isUnicode = getBit(mask, NETWORK_FILTER_MASK.isUnicode);
// The order of these statements is important. Since `buffer.getX()` will

@@ -984,3 +1024,3 @@ // internally increment the position of next byte to read, they need to be

// than string comparison.
return computeFilterId(this.csp, this.mask & ~131072 /* NETWORK_FILTER_MASK.isBadFilter */, this.filter, this.hostname, this.domains, this.denyallow, this.redirect);
return computeFilterId(this.csp, this.mask & ~NETWORK_FILTER_MASK.isBadFilter, this.filter, this.hostname, this.domains, this.denyallow, this.redirect);
}

@@ -1009,3 +1049,3 @@ getId() {

isRedirectRule() {
return getBit(this.mask, 536870912 /* NETWORK_FILTER_MASK.isRedirectRule */);
return getBit(this.mask, NETWORK_FILTER_MASK.isRedirectRule);
}

@@ -1111,22 +1151,22 @@ getRedirect() {

isException() {
return getBit(this.mask, 134217728 /* NETWORK_FILTER_MASK.isException */);
return getBit(this.mask, NETWORK_FILTER_MASK.isException);
}
isHostnameAnchor() {
return getBit(this.mask, 268435456 /* NETWORK_FILTER_MASK.isHostnameAnchor */);
return getBit(this.mask, NETWORK_FILTER_MASK.isHostnameAnchor);
}
isRightAnchor() {
return getBit(this.mask, 67108864 /* NETWORK_FILTER_MASK.isRightAnchor */);
return getBit(this.mask, NETWORK_FILTER_MASK.isRightAnchor);
}
isLeftAnchor() {
return getBit(this.mask, 33554432 /* NETWORK_FILTER_MASK.isLeftAnchor */);
return getBit(this.mask, NETWORK_FILTER_MASK.isLeftAnchor);
}
isImportant() {
return getBit(this.mask, 1048576 /* NETWORK_FILTER_MASK.isImportant */);
return getBit(this.mask, NETWORK_FILTER_MASK.isImportant);
}
isFullRegex() {
return getBit(this.mask, 4194304 /* NETWORK_FILTER_MASK.isFullRegex */);
return getBit(this.mask, NETWORK_FILTER_MASK.isFullRegex);
}
isRegex() {
return (getBit(this.mask, 8388608 /* NETWORK_FILTER_MASK.isRegex */) ||
getBit(this.mask, 4194304 /* NETWORK_FILTER_MASK.isFullRegex */));
return (getBit(this.mask, NETWORK_FILTER_MASK.isRegex) ||
getBit(this.mask, NETWORK_FILTER_MASK.isFullRegex));
}

@@ -1137,3 +1177,3 @@ isPlain() {

isCSP() {
return getBit(this.mask, 262144 /* NETWORK_FILTER_MASK.isCSP */);
return getBit(this.mask, NETWORK_FILTER_MASK.isCSP);
}

@@ -1144,12 +1184,12 @@ isElemHide() {

isSpecificHide() {
return getBit(this.mask, 2097152 /* NETWORK_FILTER_MASK.isSpecificHide */);
return getBit(this.mask, NETWORK_FILTER_MASK.isSpecificHide);
}
isGenericHide() {
return getBit(this.mask, 524288 /* NETWORK_FILTER_MASK.isGenericHide */);
return getBit(this.mask, NETWORK_FILTER_MASK.isGenericHide);
}
isBadFilter() {
return getBit(this.mask, 131072 /* NETWORK_FILTER_MASK.isBadFilter */);
return getBit(this.mask, NETWORK_FILTER_MASK.isBadFilter);
}
isUnicode() {
return getBit(this.mask, 16777216 /* NETWORK_FILTER_MASK.isUnicode */);
return getBit(this.mask, NETWORK_FILTER_MASK.isUnicode);
}

@@ -1160,48 +1200,48 @@ fromAny() {

thirdParty() {
return getBit(this.mask, 32768 /* NETWORK_FILTER_MASK.thirdParty */);
return getBit(this.mask, NETWORK_FILTER_MASK.thirdParty);
}
firstParty() {
return getBit(this.mask, 16384 /* NETWORK_FILTER_MASK.firstParty */);
return getBit(this.mask, NETWORK_FILTER_MASK.firstParty);
}
fromImage() {
return getBit(this.mask, 16 /* NETWORK_FILTER_MASK.fromImage */);
return getBit(this.mask, NETWORK_FILTER_MASK.fromImage);
}
fromMedia() {
return getBit(this.mask, 32 /* NETWORK_FILTER_MASK.fromMedia */);
return getBit(this.mask, NETWORK_FILTER_MASK.fromMedia);
}
fromObject() {
return getBit(this.mask, 64 /* NETWORK_FILTER_MASK.fromObject */);
return getBit(this.mask, NETWORK_FILTER_MASK.fromObject);
}
fromOther() {
return getBit(this.mask, 128 /* NETWORK_FILTER_MASK.fromOther */);
return getBit(this.mask, NETWORK_FILTER_MASK.fromOther);
}
fromPing() {
return getBit(this.mask, 256 /* NETWORK_FILTER_MASK.fromPing */);
return getBit(this.mask, NETWORK_FILTER_MASK.fromPing);
}
fromScript() {
return getBit(this.mask, 512 /* NETWORK_FILTER_MASK.fromScript */);
return getBit(this.mask, NETWORK_FILTER_MASK.fromScript);
}
fromStylesheet() {
return getBit(this.mask, 1024 /* NETWORK_FILTER_MASK.fromStylesheet */);
return getBit(this.mask, NETWORK_FILTER_MASK.fromStylesheet);
}
fromDocument() {
return getBit(this.mask, 1 /* NETWORK_FILTER_MASK.fromDocument */);
return getBit(this.mask, NETWORK_FILTER_MASK.fromDocument);
}
fromSubdocument() {
return getBit(this.mask, 2048 /* NETWORK_FILTER_MASK.fromSubdocument */);
return getBit(this.mask, NETWORK_FILTER_MASK.fromSubdocument);
}
fromWebsocket() {
return getBit(this.mask, 4096 /* NETWORK_FILTER_MASK.fromWebsocket */);
return getBit(this.mask, NETWORK_FILTER_MASK.fromWebsocket);
}
fromHttp() {
return getBit(this.mask, 4 /* NETWORK_FILTER_MASK.fromHttp */);
return getBit(this.mask, NETWORK_FILTER_MASK.fromHttp);
}
fromHttps() {
return getBit(this.mask, 8 /* NETWORK_FILTER_MASK.fromHttps */);
return getBit(this.mask, NETWORK_FILTER_MASK.fromHttps);
}
fromXmlHttpRequest() {
return getBit(this.mask, 8192 /* NETWORK_FILTER_MASK.fromXmlHttpRequest */);
return getBit(this.mask, NETWORK_FILTER_MASK.fromXmlHttpRequest);
}
fromFont() {
return getBit(this.mask, 2 /* NETWORK_FILTER_MASK.fromFont */);
return getBit(this.mask, NETWORK_FILTER_MASK.fromFont);
}

@@ -1208,0 +1248,0 @@ }

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -8,8 +8,11 @@ * This Source Code Form is subject to the terms of the Mozilla Public

*/
export { default as FiltersEngine, ENGINE_VERSION, BlockingResponse } from './engine/engine.js';
export { default as FiltersEngine, ENGINE_VERSION } from './engine/engine.js';
export type { BlockingResponse } from './engine/engine.js';
export { default as ReverseIndex } from './engine/reverse-index.js';
export { default as Request, makeRequest, RequestType, WebRequestType, ElectronRequestType, PuppeteerRequestType, getHostnameHashesFromLabelsBackward, PlaywrightRequestType, } from './request.js';
export { default as Request, makeRequest, getHostnameHashesFromLabelsBackward, } from './request.js';
export type { RequestType, WebRequestType, ElectronRequestType, PuppeteerRequestType, PlaywrightRequestType, } from './request.js';
export { default as CosmeticFilter } from './filters/cosmetic.js';
export { default as NetworkFilter } from './filters/network.js';
export { FilterType, IListDiff, IRawDiff, detectFilterType, f, generateDiff, getLinesWithFilters, mergeDiffs, parseFilter, parseFilters, } from './lists.js';
export { FilterType, detectFilterType, f, generateDiff, getLinesWithFilters, mergeDiffs, parseFilter, parseFilters, } from './lists.js';
export type { IListDiff, IRawDiff } from './lists.js';
export * from './fetch.js';

@@ -20,3 +23,4 @@ export { hasUnicode, tokenizeNoSkip as tokenize } from './utils.js';

export { default as Resources } from './resources.js';
export { HTMLSelector, default as StreamingHtmlFilter } from './html-filtering.js';
export { default as StreamingHtmlFilter } from './html-filtering.js';
export type { HTMLSelector } from './html-filtering.js';
//# sourceMappingURL=index.d.ts.map
/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -13,3 +13,3 @@ * This Source Code Form is subject to the terms of the Mozilla Public

export { default as NetworkFilter } from './filters/network.js';
export { detectFilterType, f, generateDiff, getLinesWithFilters, mergeDiffs, parseFilter, parseFilters, } from './lists.js';
export { FilterType, detectFilterType, f, generateDiff, getLinesWithFilters, mergeDiffs, parseFilter, parseFilters, } from './lists.js';
export * from './fetch.js';

@@ -16,0 +16,0 @@ export { hasUnicode, tokenizeNoSkip as tokenize } from './utils.js';

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -11,4 +11,10 @@ * This Source Code Form is subject to the terms of the Mozilla Public

import NetworkFilter from './filters/network.js';
import Preprocessor, { detectPreprocessor } from './preprocessor.js';
import Preprocessor, { PreprocessorTokens, detectPreprocessor } from './preprocessor.js';
import { fastStartsWith, fastStartsWithFrom } from './utils.js';
export var FilterType;
(function (FilterType) {
FilterType[FilterType["NOT_SUPPORTED"] = 0] = "NOT_SUPPORTED";
FilterType[FilterType["NETWORK"] = 1] = "NETWORK";
FilterType[FilterType["COSMETIC"] = 2] = "COSMETIC";
})(FilterType || (FilterType = {}));
/**

@@ -23,3 +29,3 @@ * Given a single line (string), checks if this would likely be a cosmetic

if (line.length === 0 || line.length === 1) {
return 0 /* FilterType.NOT_SUPPORTED */;
return FilterType.NOT_SUPPORTED;
}

@@ -32,3 +38,3 @@ // Ignore comments

(firstCharCode === 91 /* '[' */ && fastStartsWith(line, '[Adblock'))) {
return 0 /* FilterType.NOT_SUPPORTED */;
return FilterType.NOT_SUPPORTED;
}

@@ -50,3 +56,3 @@ // Fast heuristics to detect network filters

lastCharCode === 124 /* '|' */) {
return 1 /* FilterType.NETWORK */;
return FilterType.NETWORK;
}

@@ -63,3 +69,3 @@ // Ignore Adguard cosmetics

fastStartsWithFrom(line, /* $@$ */ '@$', afterDollarIndex))) {
return 0 /* FilterType.NOT_SUPPORTED */;
return FilterType.NOT_SUPPORTED;
}

@@ -81,3 +87,3 @@ }

// `##` `#@#`
return 2 /* FilterType.COSMETIC */;
return FilterType.COSMETIC;
}

@@ -97,14 +103,14 @@ else if ((afterSharpCharCode === 64 /* '@'*/ &&

// `#?#`
return 0 /* FilterType.NOT_SUPPORTED */;
return FilterType.NOT_SUPPORTED;
}
}
// Everything else is a network filter
return 1 /* FilterType.NETWORK */;
return FilterType.NETWORK;
}
export function parseFilter(filter) {
const filterType = detectFilterType(filter);
if (filterType === 1 /* FilterType.NETWORK */) {
if (filterType === FilterType.NETWORK) {
return NetworkFilter.parse(filter, true);
}
else if (filterType === 2 /* FilterType.COSMETIC */) {
else if (filterType === FilterType.COSMETIC) {
return CosmeticFilter.parse(filter, true);

@@ -157,3 +163,3 @@ }

const filterType = detectFilterType(line);
if (filterType === 1 /* FilterType.NETWORK */ && config.loadNetworkFilters === true) {
if (filterType === FilterType.NETWORK && config.loadNetworkFilters === true) {
const filter = NetworkFilter.parse(line, config.debug);

@@ -167,3 +173,3 @@ if (filter !== null) {

}
else if (filterType === 2 /* FilterType.COSMETIC */ && config.loadCosmeticFilters === true) {
else if (filterType === FilterType.COSMETIC && config.loadCosmeticFilters === true) {
const filter = CosmeticFilter.parse(line, config.debug);

@@ -181,3 +187,3 @@ if (filter !== null) {

const preprocessorToken = detectPreprocessor(line);
if (preprocessorToken === 1 /* PreprocessorTokens.BEGIF */) {
if (preprocessorToken === PreprocessorTokens.BEGIF) {
if (preprocessorStack.length > 0) {

@@ -192,8 +198,8 @@ preprocessorStack.push(new Preprocessor({

}
else if ((preprocessorToken === 3 /* PreprocessorTokens.ENDIF */ ||
preprocessorToken === 2 /* PreprocessorTokens.ELSE */) &&
else if ((preprocessorToken === PreprocessorTokens.ENDIF ||
preprocessorToken === PreprocessorTokens.ELSE) &&
preprocessorStack.length > 0) {
const lastPreprocessor = preprocessorStack.pop();
preprocessors.push(lastPreprocessor);
if (preprocessorToken === 2 /* PreprocessorTokens.ELSE */) {
if (preprocessorToken === PreprocessorTokens.ELSE) {
preprocessorStack.push(new Preprocessor({

@@ -200,0 +206,0 @@ condition: `!(${lastPreprocessor.condition})`,

import { sizeOfUTF8 } from './data-view.js';
export class Env extends Map {
}
export var PreprocessorTokens;
(function (PreprocessorTokens) {
PreprocessorTokens[PreprocessorTokens["INVALID"] = 0] = "INVALID";
PreprocessorTokens[PreprocessorTokens["BEGIF"] = 1] = "BEGIF";
PreprocessorTokens[PreprocessorTokens["ELSE"] = 2] = "ELSE";
PreprocessorTokens[PreprocessorTokens["ENDIF"] = 3] = "ENDIF";
})(PreprocessorTokens || (PreprocessorTokens = {}));
export function detectPreprocessor(line) {

@@ -9,14 +16,14 @@ // Minimum size of a valid condition should be 6 for something like: "!#if x" or "!#else"

line.charCodeAt(1) !== 35 /* '#' */) {
return 0 /* PreprocessorTokens.INVALID */;
return PreprocessorTokens.INVALID;
}
if (line.startsWith('!#if ')) {
return 1 /* PreprocessorTokens.BEGIF */;
return PreprocessorTokens.BEGIF;
}
if (line.startsWith('!#else')) {
return 2 /* PreprocessorTokens.ELSE */;
return PreprocessorTokens.ELSE;
}
if (line.startsWith('!#endif')) {
return 3 /* PreprocessorTokens.ENDIF */;
return PreprocessorTokens.ENDIF;
}
return 0 /* PreprocessorTokens.INVALID */;
return PreprocessorTokens.INVALID;
}

@@ -23,0 +30,0 @@ const tokenizerPattern = /(!|&&|\|\||\(|\)|[a-zA-Z0-9_]+)/g;

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -76,3 +76,2 @@ * This Source Code Form is subject to the terms of the Mozilla Public

// The resource containing javascirpts to be injected
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const js = typeToResource.get('application/javascript') || new Map();

@@ -79,0 +78,0 @@ for (const [key, value] of js.entries()) {

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

/*!
* Copyright (c) 2017-present Cliqz GmbH. All rights reserved.
* Copyright (c) 2017-present Ghostery GmbH. All rights reserved.
*

@@ -4,0 +4,0 @@ * This Source Code Form is subject to the terms of the Mozilla Public

{
"name": "@cliqz/adblocker",
"version": "1.28.2",
"description": "Cliqz adblocker library",
"version": "1.29.0",
"description": "Ghostery adblocker library",
"author": {
"name": "Cliqz"
"name": "Ghostery"
},

@@ -48,16 +48,16 @@ "homepage": "https://github.com/ghostery/adblocker#readme",

"clean": "rimraf dist coverage .tshy .tshy-build .nyc_output .rollup.cache",
"lint": "eslint src tools",
"lint": "eslint src test tools",
"build": "tshy && rollup --config ./rollup.config.js",
"test": "nyc mocha",
"dev": "mocha --watch",
"bench-metadata": "ts-node --project ./tools/tsconfig.json ./tools/bench-metadata.ts",
"bump-internal-engine-version": "ts-node --project ./tools/tsconfig.json ./tools/auto-bump-engine-version.ts",
"generate-codebooks": "concurrently -n build: \"yarn:codebook-*\" && yarn bump-internal-engine-version",
"codebook-network-csp": "ts-node --project ./tools/tsconfig.json ./tools/generate_compression_codebooks.ts -- network-csp",
"codebook-network-redirect": "ts-node --project ./tools/tsconfig.json ./tools/generate_compression_codebooks.ts -- network-redirect",
"codebook-network-filter": "ts-node --project ./tools/tsconfig.json ./tools/generate_compression_codebooks.ts -- network-filter",
"codebook-network-hostname": "ts-node --project ./tools/tsconfig.json ./tools/generate_compression_codebooks.ts -- network-hostname",
"codebook-cosmetic-selector": "ts-node --project ./tools/tsconfig.json ./tools/generate_compression_codebooks.ts -- cosmetic-selector",
"codebook-raw-network": "ts-node --project ./tools/tsconfig.json ./tools/generate_compression_codebooks.ts -- raw-network",
"codebook-raw-cosmetic": "ts-node --project ./tools/tsconfig.json ./tools/generate_compression_codebooks.ts -- raw-cosmetic"
"bench-metadata": "tsx ./tools/bench-metadata.ts",
"bump-internal-engine-version": "tsx ./tools/auto-bump-engine-version.ts",
"codebook-network-csp": "tsx ./tools/generate_compression_codebooks.ts -- network-csp",
"codebook-network-redirect": "tsx ./tools/generate_compression_codebooks.ts -- network-redirect",
"codebook-network-filter": "tsx ./tools/generate_compression_codebooks.ts -- network-filter",
"codebook-network-hostname": "tsx ./tools/generate_compression_codebooks.ts -- network-hostname",
"codebook-cosmetic-selector": "tsx ./tools/generate_compression_codebooks.ts -- cosmetic-selector",
"codebook-raw-network": "tsx ./tools/generate_compression_codebooks.ts -- raw-network",
"codebook-raw-cosmetic": "tsx ./tools/generate_compression_codebooks.ts -- raw-cosmetic",
"generate-codebooks": "concurrently -n build: \"yarn:codebook-*\" && yarn bump-internal-engine-version"
},

@@ -113,11 +113,11 @@ "bugs": {

"nyc": "^17.0.0",
"rimraf": "^5.0.1",
"rimraf": "^6.0.1",
"rollup": "^4.0.2",
"ts-node": "^10.9.1",
"tshy": "^3.0.2",
"tsx": "^4.16.2",
"typescript": "^5.5.2"
},
"dependencies": {
"@cliqz/adblocker-content": "^1.28.2",
"@cliqz/adblocker-extended-selectors": "^1.28.2",
"@cliqz/adblocker-content": "^1.29.0",
"@cliqz/adblocker-extended-selectors": "^1.29.0",
"@remusao/guess-url-type": "^1.3.0",

@@ -130,3 +130,3 @@ "@remusao/small": "^1.2.1",

},
"gitHead": "250b146a1c2fc06ea86ee9590df5864d6bcf023e"
"gitHead": "a4b7c5f456a826db4526bf8632bae8ea12b9bb38"
}

@@ -34,4 +34,4 @@ <h1 align="center">Adblocker</h2>

<img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square"></a>
<a href="https://twitter.com/cliqz">
<img alt="Follow Cliqz on Twitter" src="https://img.shields.io/twitter/follow/cliqz.svg?label=follow+cliqz&style=flat-square"></a>
<a href="https://twitter.com/ghostery">
<img alt="Follow Ghostery on Twitter" src="https://img.shields.io/twitter/follow/ghostery.svg?label=follow+ghostery&style=flat-square"></a>
<a href="https://github.com/ghostery/adblocker">

@@ -38,0 +38,0 @@ <img alt="Dependabot" src="https://img.shields.io/badge/dependabot-enabled-brightgreen?logo=dependabot&style=flat-square"></a>

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc