UNPKG

@eyeo/snippets

Version:

eye/o snippets for Ads blocker

18 lines 65.3 kB
(environment, ...filters) => { /*! * This file is part of eyeo's Anti-Circumvention Snippets module (@eyeo/snippets), * Copyright (C) 2006-present eyeo GmbH * * @eyeo/snippets is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * @eyeo/snippets is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with @eyeo/snippets. If not, see <http://www.gnu.org/licenses/>. */ const e=Proxy,{apply:t,bind:n,call:r}=Function,o=r.bind(t),i=r.bind(n),s=r.bind(r),a={get:(e,t)=>i(r,e[t])},c=t=>new e(t,a),l=(t,n)=>new e(t,{apply:(e,t,r)=>o(n,t,r)}),u={get:(e,t)=>i(e[t],e)},d=t=>new e(t,u),{assign:f,defineProperties:p,freeze:h,getOwnPropertyDescriptor:g,getOwnPropertyDescriptors:m,getPrototypeOf:w}=d(Object),{hasOwnProperty:y}=c({}),{species:v}=Symbol,b={get(e,t){const n=e[t];class r extends n{}const o=m(n.prototype);delete o.constructor,h(p(r.prototype,o));const i=m(n);return delete i.length,delete i.prototype,i[v]={value:r},h(p(r,i))}},E=t=>new e(t,b),k="undefined"!=typeof environment?environment:{};"undefined"==typeof globalThis&&(window.globalThis=window);const{apply:x,ownKeys:S}=d(Reflect),T="world"in k,$=T&&"ISOLATED"===k.world,M=T&&"MAIN"===k.world,L="object"==typeof chrome&&!!chrome.runtime,R="object"==typeof browser&&!!browser.runtime,C=!M&&($||L||R),P=e=>C?e:O(e,W(e)),{create:O,defineProperties:j,defineProperty:A,freeze:N,getOwnPropertyDescriptor:I,getOwnPropertyDescriptors:W}=d(Object),F=d(globalThis),D=C?globalThis:E(globalThis),{Map:H,RegExp:z,Set:V,WeakMap:B,WeakSet:q}=D,U=(e,t,n=null)=>{const r=S(t);for(const o of S(e)){if(r.includes(o))continue;const i=I(e,o);if(n&&"value"in i){const{value:e}=i;"function"==typeof e&&(i.value=n(e))}A(t,o,i)}},G=e=>{const t=D[e];class n extends t{}const{toString:r,valueOf:o}=t.prototype;j(n.prototype,{toString:{value:r},valueOf:{value:o}});const i=e.toLowerCase(),s=e=>function(){const t=x(e,this,arguments);return typeof t===i?new n(t):t};return U(t,n,s),U(t.prototype,n.prototype,s),n},J=N({frozen:new B,hidden:new q,iframePropertiesToAbort:{read:new V,write:new V},abortedIframes:new B}),X=new z("^[A-Z]"),_=C&&(L&&chrome||R&&browser)||void 0;var K=new Proxy(new H([["chrome",_],["browser",_],["isExtensionContext",C],["variables",J],["console",P(console)],["document",globalThis.document],["JSON",P(JSON)],["Map",H],["Math",P(Math)],["Number",C?Number:G("Number")],["RegExp",z],["Set",V],["String",C?String:G("String")],["WeakMap",B],["WeakSet",q],["MouseEvent",MouseEvent]]),{get(e,t){if(e.has(t))return e.get(t);let n=globalThis[t];return"function"==typeof n&&(n=(X.test(t)?D:F)[t]),e.set(t,n),n},has:(e,t)=>e.has(t)});const Q={WeakSet:WeakSet,WeakMap:WeakMap,WeakValue:class{has(){return!1}set(){}}},{apply:Y}=Reflect;const{Map:Z,WeakMap:ee,WeakSet:te,setTimeout:ne}=K;let re=!0,oe=e=>{e.clear(),re=!re};var ie=function(e){const{WeakSet:t,WeakMap:n,WeakValue:r}=this||Q,o=new t,i=new n,s=new r;return function(t){if(o.has(t))return t;if(i.has(t))return i.get(t);if(s.has(t))return s.get(t);const n=Y(e,this,arguments);return o.add(n),n!==t&&("object"==typeof t&&t?i:s).set(t,n),n}}.bind({WeakMap:ee,WeakSet:te,WeakValue:class extends Z{set(e,t){return re&&(re=!re,ne(oe,0,this)),super.set(e,t)}}});const{concat:se,includes:ae,join:ce,reduce:le,unshift:ue}=c([]),de=E(globalThis),{Map:fe,WeakMap:pe}=de,he=new fe,ge=t=>{const n=(e=>{const t=[];let n=e;for(;n;){if(he.has(n))ue(t,he.get(n));else{const e=m(n);he.set(n,e),ue(t,e)}n=w(n)}return ue(t,{}),o(f,null,t)})("function"==typeof t?t.prototype:t),r={get(e,t){if(t in n){const{value:r,get:o}=n[t];if(o)return s(o,e);if("function"==typeof r)return i(r,e)}return e[t]},set(e,t,r){if(t in n){const{set:o}=n[t];if(o)return s(o,e,r),!0}return e[t]=r,!0}};return t=>new e(t,r)},{isExtensionContext:me,Array:we,Number:ye,String:ve,Object:be}=K,{isArray:Ee}=we,{getOwnPropertyDescriptor:ke,setPrototypeOf:xe}=be,{toString:Se}=be.prototype,{slice:Te}=ve.prototype,{get:$e}=ke(Node.prototype,"nodeType"),Me=me?{}:{Attr:ge(Attr),CanvasRenderingContext2D:ge(CanvasRenderingContext2D),CSSStyleDeclaration:ge(CSSStyleDeclaration),Document:ge(Document),Element:ge(Element),HTMLCanvasElement:ge(HTMLCanvasElement),HTMLElement:ge(HTMLElement),HTMLImageElement:ge(HTMLImageElement),HTMLScriptElement:ge(HTMLScriptElement),MutationRecord:ge(MutationRecord),Node:ge(Node),ShadowRoot:ge(ShadowRoot),get CSS2Properties(){return Me.CSSStyleDeclaration}},Le=(e,t)=>{if("Element"!==t&&t in Me)return Me[t](e);if(Ee(e))return xe(e,we.prototype);const n=(e=>s(Te,s(Se,e),8,-1))(e);if(n in Me)return Me[n](e);if(n in K)return xe(e,K[n].prototype);if("nodeType"in e)switch(s($e,e)){case 1:if(!(t in Me))throw new Error("unknown hint "+t);return Me[t](e);case 2:return Me.Attr(e);case 3:return Me.Node(e);case 9:return Me.Document(e)}throw new Error("unknown brand "+n)};var Re=me?e=>e===window||e===globalThis?K:e:ie(((e,t="Element")=>{if(e===window||e===globalThis)return K;switch(typeof e){case"object":return e&&Le(e,t);case"string":return new ve(e);case"number":return new ye(e);default:throw new Error("unsupported value")}}));const Ce={get(e,t){const n=e;for(;!y(e,t);)e=w(e);const{get:r,set:i}=g(e,t);return function(){return arguments.length?o(i,n,arguments):s(r,n)}}},Pe=t=>new e(t,Ce);let{Math:Oe,setInterval:je,performance:Ae}=Re(window);const Ne={mark(){},end(){},toString:()=>"{mark(){},end(){}}"};let Ie=!0;function We(){Ie=!1}function Fe(e,t=10){if(Ie)return Ne;function n(){let e=Re([]);for(let{name:t,duration:n}of Ae.getEntriesByType("measure"))e.push({name:t,duration:n});e.length&&Ae.clearMeasures()}return Fe[e]||(Fe[e]=je(n,Oe.round(6e4/Oe.min(60,t)))),{mark(){Ae.mark(e)},end(t=!1){Ae.measure(e,e);const r=Ae.getEntriesByName(e,"measure"),o=r.length>0?r[r.length-1]:null;console.log("PROFILER:",o),Ae.clearMarks(e),t&&(clearInterval(Fe[e]),delete Fe[e],n())}}}let De=!1;function He(){return De}function ze(){De=!0}const{console:Ve}=Re(window),Be=()=>{};function qe(...e){let{mark:t,end:n}=Fe("log");if(He()){const t=["%c DEBUG","font-weight: bold;"],n=e.indexOf("error"),r=e.indexOf("warn"),o=e.indexOf("success"),i=e.indexOf("info");-1!==n?(t[0]+=" - ERROR",t[1]+="color: red; border:2px solid red",Re(e).splice(n,1)):-1!==r?(t[0]+=" - WARNING",t[1]+="color: orange; border:2px solid orange ",Re(e).splice(r,1)):-1!==o?(t[0]+=" - SUCCESS",t[1]+="color: green; border:2px solid green",Re(e).splice(o,1)):-1!==i&&(t[1]+="color: black;",Re(e).splice(i,1)),Re(e).unshift(...t)}t(),Ve.log(...e),n()}function Ue(e){return i(He()?qe:Be,null,e)}let{Array:Ge,Math:Je,RegExp:Xe}=Re(window);function _e(e){let{length:t}=e;if(t>1&&"/"===e[0]){let n="/"===e[t-1];if(n||t>2&&Re(e).endsWith("/i")){let t=[Re(e).slice(1,n?-1:-2)];return n||t.push("i"),new Xe(...t)}}return new Xe(Re(e).replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"))}function Ke(){return Re(Je.floor(2116316160*Je.random()+60466176)).toString(36)}function Qe(e){return Re(Ge.from(e)).map((e=>`'${e}'`)).join(" ")}function Ye(e){return e.reduce(((e,t)=>e+function(e,t=2){let n=Re(e).toString(16);return n.length<t&&(n=Re("0").repeat(t-n.length)+n),n}(t)),"")}let{parseFloat:Ze,variables:et,clearTimeout:tt,fetch:nt,setTimeout:rt,Array:ot,Error:it,Map:st,Object:at,ReferenceError:ct,Set:lt,WeakMap:ut}=Re(window),{onerror:dt}=Pe(window),ft=Node.prototype,pt=Element.prototype,ht=null;function gt(e,t,n,r=!0){let o=Re(t),i=o.indexOf(".");if(-1==i){let o=at.getOwnPropertyDescriptor(e,t);if(o&&!o.configurable)return;let i=at.assign({},n,{configurable:r});if(!o&&!i.get&&i.set){let n=e[t];i.get=()=>n}return void at.defineProperty(e,t,i)}let s=o.slice(0,i).toString();t=o.slice(i+1).toString();let a=e[s];!a||"object"!=typeof a&&"function"!=typeof a||gt(a,t,n);let c=at.getOwnPropertyDescriptor(e,s);if(c&&!c.configurable)return;ht||(ht=new ut),ht.has(e)||ht.set(e,new st);let l=ht.get(e);if(l.has(s))return void l.get(s).set(t,n);let u=new st([[t,n]]);l.set(s,u),at.defineProperty(e,s,{get:()=>a,set(e){if(a=e,a&&("object"==typeof a||"function"==typeof a))for(let[e,t]of u)gt(a,e,t)},configurable:r})}function mt(e){let t=dt();dt(((...n)=>{let r=n.length&&n[0];return!("string"!=typeof r||!Re(r).includes(e))||("function"==typeof t?o(t,this,n):void 0)}))}function wt(e,t,n,r="",o=!0){let i=Ue(e);if(!n)return void i("error","no property to abort on read");let s=Ke();i("info",`aborting on ${n} access`),gt(t,n,{get:function(){throw i("success",`${n} access aborted`,`\nFILTER: ${e} ${r}`),new ct(s)},set(){}},o),mt(s)}function yt(e,t,n,r="",o=!0){let i=Ue(e);if(!n)return void i("error","no property to abort on write");let s=Ke();i("info",`aborting when setting ${n}`),gt(t,n,{set:function(){throw i("success",`setting ${n} aborted`,`\nFILTER: ${e} ${r}`),new ct(s)}},o),mt(s)}function vt(e,t=!1,n=!1){let r=et.abortedIframes,i=et.iframePropertiesToAbort;const a=Qe(e);for(let o of ot.from(window.frames))if(r.has(o))for(let i of e)t&&r.get(o).read.add({property:i,formattedProperties:a}),n&&r.get(o).write.add({property:i,formattedProperties:a});for(let r of e)t&&i.read.add({property:r,formattedProperties:a}),n&&i.write.add({property:r,formattedProperties:a});function c(){for(let e of ot.from(window.frames)){r.has(e)||r.set(e,{read:new lt(i.read),write:new lt(i.write)});let t=r.get(e).read;if(t.size>0){let n=ot.from(t);t.clear();for(let{property:t,formattedProperties:r}of n)wt("abort-on-iframe-property-read",e,t,r)}let n=r.get(e).write;if(n.size>0){let t=ot.from(n);n.clear();for(let{property:n,formattedProperties:r}of t)yt("abort-on-iframe-property-write",e,n,r)}}}c(),r.has(document)||(r.set(document,!0),function(e){let t;function n(e,t){for(let n of t){gt(e,n,r(e,n))}}function r(t,n){let r=t[n];return{get:()=>function(...t){let n;return n=o(r,this,t),e&&e(),n}}}function i(t,n){let r=at.getOwnPropertyDescriptor(t,n),{set:o}=r||{};return{set(t){let n;return n=s(o,this,t),e&&e(),n}}}n(ft,["appendChild","insertBefore","replaceChild"]),n(pt,["append","prepend","replaceWith","after","before","insertAdjacentElement","insertAdjacentHTML"]),t=i(pt,"innerHTML"),gt(pt,"innerHTML",t),t=i(pt,"outerHTML"),gt(pt,"outerHTML",t)}(c))}let{Object:bt}=window;function Et(e,t){if(!(e instanceof bt))return;let n=e,r=Re(t).split(".");if(0===r.length)return;for(let e=0;e<r.length-1;e++){let t=r[e];if(!y(n,t))return;if(n=n[t],!(n instanceof bt))return}let o=r[r.length-1];return y(n,o)?[n,o]:void 0}const kt=Re(/^\d+$/);function xt(e){switch(e){case"false":return!1;case"true":return!0;case"null":return null;case"noopFunc":return()=>{};case"trueFunc":return()=>!0;case"falseFunc":return()=>!1;case"emptyArray":return[];case"emptyObj":return{};case"undefined":return;case"":return e;default:if(kt.test(e))return Ze(e);throw new it(`[override-property-read snippet]: Value "${e}" is not valid.`)}}function St(e,t,n){var r,o;n?"load"===n?(e("info","Waiting until window.load"),window.addEventListener("load",(()=>{e("info","Window.load fired."),t()}))):"loading"===n||"interactive"===n||"complete"===n?(e("info","Waiting document state until :",n),document.addEventListener("readystatechange",(()=>{e("info","Document state changed:",document.readyState),document.readyState===n&&t()}))):(e("info","Waiting until ",n," event is triggered on document"),(r=document,o=n,new Promise((e=>{const t=()=>{r.removeEventListener(o,t),e()};r.addEventListener(o,t)}))).then((()=>{e("info",n," is triggered on document, starting the snippet"),t()})).catch((t=>{e("error","There was an error while waiting for the event.",t)}))):t()}function Tt(e,t){if(!e||!e.length)return!0;const n=Ke(),r=new it(n),o=new URL(self.location.href);o.hash="";const i=/(.*?@)?(\S+)(:\d+):\d+\)?$/,s=[];for(let e of r.stack.split(/[\n\r]+/)){if(Re(e).includes(n))continue;e=Re(e).trim();const t=Re(i).exec(e);if(null===t)continue;let r=t[2];Re(r).startsWith("(")&&(r=Re(r).slice(1)),r===o.href?r="inlineScript":Re(r).startsWith("<anonymous>")&&(r="injectedScript");let a=t[1]?Re(t[1]).slice(0,-1):Re(e).slice(0,Re(t).index).trim();Re(a).startsWith("at")&&(a=Re(a).slice(2).trim());let c=t[3];Re(s).push(" "+`${a} ${r}${c}:1`.trim())}s[0]="stackDepth:"+(s.length-1);const a=Re(s).join("\n");for(let n of e){if(_e(n).test(a))return t("info",`Found needle in stack trace: ${n}`),!0}return t("info",`Stack trace does not match any needle. Stack trace: ${a}`),!1}let $t=new st;function Mt(e,{as:t="arrayBuffer",cleanup:n=6e4}={}){let r=t+":"+e,o=$t.get(r)||{remove:()=>$t.delete(r),result:null,timer:0};return tt(o.timer),o.timer=rt(o.remove,n),o.result||(o.result=nt(e).then((e=>e[t]())).catch(o.remove),$t.set(r,o)),o.result}let{HTMLScriptElement:Lt,Object:Rt,ReferenceError:Ct}=Re(window),Pt=Rt.getPrototypeOf(Lt);const{Error:Ot,Object:jt,Array:At,Map:Nt}=Re(window);let It=null;function Wt(e,t,n){let r=e;for(const e of n){if(!r||!y(r,e))return!1;r=r[e]}if("string"==typeof r||"number"==typeof r){const e=r.toString();return t.test(e)}return!1}const{Array:Ft,Blob:Dt,Error:Ht,Object:zt,Reflect:Vt}=Re(window),Bt=[];let{Error:qt,URL:Ut}=Re(window),{cookie:Gt}=Pe(document);const{Map:Jt,Object:Xt,Reflect:_t,WeakMap:Kt}=Re(window),Qt=window.EventTarget.prototype.addEventListener,Yt=window.EventTarget.prototype.removeEventListener,Zt=new Kt;let en=[];let{console:tn,document:nn,getComputedStyle:rn,isExtensionContext:on,variables:sn,Array:an,MutationObserver:cn,Object:ln,XPathEvaluator:un,XPathExpression:dn,XPathResult:fn}=Re(window);const{querySelectorAll:pn}=nn,hn=pn&&i(pn,nn);function gn(e,t=!1){try{const n=navigator.userAgent.includes("Firefox")?e.openOrClosedShadowRoot:browser.dom.openOrClosedShadowRoot(e);return null===n&&He()&&!t&&tn.log("Shadow root not found or not added in element yet",e),n}catch(n){return He()&&!t&&tn.log("Error while accessing shadow root",e,n),null}}function mn(e,t=!1){return vn(e,hn.bind(nn),nn,t)}function wn(e,t,n,r){const o=t.getAttribute("xlink:href")||t.getAttribute("href");if(o){const s=hn(o)[0];if(!s&&He())return tn.log("No elements found matching",o),!1;if(!(i=e)||0===i.length||i.every((e=>""===e.trim()))){const e=r.length>0?r:[];return n.push({element:s,rootParents:[...e,t]}),!1}const a=s.querySelectorAll.bind(s);return{nextBoundElement:s,nestedSelectorsString:e.join("^^"),next$$:a}}var i}function yn(e,t){const n=gn(t);if(n){const{querySelectorAll:r}=n,o=r&&i(r,n).bind(n);return{nextBoundElement:t,nestedSelectorsString:":host "+e.join("^^"),next$$:o}}return!1}function vn(e,t,n,r,o=[]){if(e.includes("^^")){const[i,s,...a]=e.split("^^");let c,l;switch(s){case"svg":l=wn;break;case"sh":l=yn;break;default:return He()&&tn.log(s," is not supported. Supported commands are: \n^^sh^^\n^^svg^^"),[]}c=""===i.trim()?[n]:t(i);const u=[];for(const e of c){const t=l(a,e,u,o);if(!t)continue;const{next$$:n,nestedSelectorsString:i,nextBoundElement:s}=t,c=vn(i,n,s,r,[...o,e]);c&&u.push(...c)}return u}const i=t(e);return r?[...i].map((e=>({element:e,rootParents:o.length>0?o:[]}))):i}function bn(e,t,n=[]){if(t.includes("^^svg^^")&&(t=t.split("^^svg^^")[0]),t.includes("^^sh^^")){const r=t.split("^^sh^^"),o=r.length-1;if(t=`:host ${r[o]}`,o===n.length)return e.closest(t);return n[o].closest(t)}return n[0]?n[0].closest(t):e.closest(t)}const{assign:En,setPrototypeOf:kn}=ln;class xn extends dn{evaluate(...e){return kn(o(super.evaluate,this,e),fn.prototype)}}class Sn extends un{createExpression(...e){return kn(o(super.createExpression,this,e),xn.prototype)}}function Tn(e){if(sn.hidden.has(e))return!1;!function(e){on&&"function"==typeof checkElement&&checkElement(e)}(e),sn.hidden.add(e);let{style:t}=Re(e),n=Re(t,"CSSStyleDeclaration"),r=Re([]),{debugCSSProperties:o}=k;for(let[e,t]of o||[["display","none"]])n.setProperty(e,t,"important"),r.push([e,n.getPropertyValue(e)]);return new cn((()=>{for(let[e,t]of r){let r=n.getPropertyValue(e),o=n.getPropertyPriority(e);r==t&&"important"==o||n.setProperty(e,t,"important")}})).observe(e,{attributes:!0,attributeFilter:["style"]}),!0}function $n(e){let t=e;if(t.startsWith("xpath(")&&t.endsWith(")")){let e=t.slice(6,-1),n=(new Sn).createExpression(e,null),r=fn.ORDERED_NODE_SNAPSHOT_TYPE;return e=>{if(!e)return;let t=n.evaluate(nn,r,null),{snapshotLength:o}=t;for(let n=0;n<o;n++)e(t.snapshotItem(n))}}return t=>mn(e).forEach(t)}function Mn(e){let t=e;if(t.startsWith("xpath(")&&t.endsWith(")")){let t=$n(e);return()=>{let e=Re([]);return t((t=>e.push(t))),e}}return()=>an.from(mn(e))}function Ln(e,t,n,r){let o;null==n&&(n=t);const i=()=>{for(const{element:i,rootParents:s}of mn(n,!0)){const n=bn(Re(i),t,s);n&&e(i,n,s)&&(o(),Tn(n)&&"function"==typeof r&&r(n))}};return En(new cn(i),{race(e){o=e,this.observe(nn,{childList:!0,characterData:!0,subtree:!0}),i()}})}function Rn(e,t,n,r){let o=Re(t,"CSSStyleDeclaration");if("none"==o.getPropertyValue("display"))return!1;let i=o.getPropertyValue("visibility");if("hidden"==i||"collapse"==i)return!1;if(!n||e==n)return!0;let s=Re(e).parentElement;if(!s){if(!r||!r.length)return!0;s=r[r.length-1],r=r.slice(0,-1)}return Rn(s,rn(s),n,r)}function Cn(e){let t=rn(e),{cssText:n}=t;if(n)return n;for(let e of t)n+=`${e}: ${t[e]}; `;return Re(n).trim()}let{ELEMENT_NODE:Pn,TEXT_NODE:On,prototype:jn}=Node,{prototype:An}=Element,{prototype:Nn}=HTMLElement,{console:In,variables:Wn,DOMParser:Fn,Error:Dn,MutationObserver:Hn,Object:zn,ReferenceError:Vn}=Re(window),{getOwnPropertyDescriptor:Bn}=zn;const{CanvasRenderingContext2D:qn,document:Un,Map:Gn,MutationObserver:Jn,Object:Xn,Set:_n,WeakSet:Kn}=Re(window);let Qn,Yn=new _n,Zn=new Kn;function er(e,t,n,r){Yn.add({canvasElement:e,rule:t,functionName:n,text:r})}let{Array:tr,Error:nr,Map:rr,parseInt:or}=Re(window),ir=null,sr=null;function ar(e,t){if(null===ir)return Be;let n=ir,{participants:r}=n;return r.set(o,t),o;function o(){if(n.winners<1)return;if(Ue("race")("success",`${e} won the race`),n===ir)sr.push(o);else if(r.delete(o),--n.winners<1){for(let e of r.values())e();r.clear()}}}const{Map:cr,MutationObserver:lr,Object:ur,Set:dr,WeakSet:fr}=Re(window);let pr=Element.prototype,{attachShadow:hr}=pr,gr=new fr,mr=new cr,wr=null;const{Array:yr,Error:vr,JSON:br,Map:Er,Object:kr,Response:xr}=Re(window);let Sr=null;let{Array:Tr,Error:$r,JSON:Mr,Map:Lr,Object:Rr,Response:Cr}=Re(window),Pr=null;const{Error:Or,Object:jr,Map:Ar}=Re(window);let Nr=null;function Ir(e,t,n){if(!n.length){if("string"==typeof e||"number"==typeof e){const n=e.toString();return t.test(n)}return!1}let r=e;for(const e of n){if(!r||!y(r,e))return!1;r=r[e]}if("string"==typeof r||"number"==typeof r){const e=r.toString();return t.test(e)}return!1}let{Error:Wr}=Re(window);let{Error:Fr,Map:Dr,Object:Hr,console:zr}=Re(window),{toString:Vr}=Function.prototype,Br=EventTarget.prototype,{addEventListener:qr}=Br,Ur=null;let{fetch:Gr}=Re(window),Jr=!1;const Xr=[],_r=[],Kr=()=>{Jr||(window.fetch=l(Gr,((...e)=>{let[t]=e;if(Xr.length>0&&"string"==typeof t){let n;try{n=new URL(t)}catch(e){if(!(e instanceof TypeError))throw e;n=new URL(t,Re(document).location)}Xr.forEach((e=>e(n))),e[0]=n.href}return o(Gr,self,e).then((e=>{let t=e;return _r.forEach((e=>{t=e(t)})),t}))})),Jr=!0)};let Qr,{Map:Yr,Object:Zr,RegExp:eo,Response:to}=Re(window);const{Error:no,Object:ro,atob:oo,btoa:io,RegExp:so}=Re(window);let ao,co,{RegExp:lo,XMLHttpRequest:uo,WeakMap:fo}=Re(window);let po,{delete:ho,has:go}=c(URLSearchParams.prototype);const mo={"abort-current-inline-script":function(e,t=null){const n=Qe(arguments),r=Ue("abort-current-inline-script"),{mark:o,end:i}=Fe("abort-current-inline-script"),a=t?_e(t):null,c=Ke(),l=Re(document).currentScript;let u=window;const d=Re(e).split("."),f=Re(d).pop();for(let e of Re(d))if(u=u[e],!u||"object"!=typeof u&&"function"!=typeof u)return void r("warn",d," is not found");const{get:p,set:h}=Rt.getOwnPropertyDescriptor(u,f)||{};let g=u[f];void 0===g&&r("warn","The property",f,"doesn't exist yet. Check typos.");const m=()=>{const e=Re(document).currentScript;if(e instanceof Pt&&""==Re(e,"HTMLScriptElement").src&&e!=l&&(!a||a.test(Re(e).textContent)))throw r("success",d," is aborted \n",e,"\nFILTER: abort-current-inline-script",n),new Ct(c)},w={get(){return m(),p?s(p,this):g},set(e){m(),h?s(h,this,e):g=e}};o(),gt(u,f,w),i(),mt(c)},"abort-on-iframe-property-read":function(...e){const{mark:t,end:n}=Fe("abort-on-iframe-property-read");t(),vt(e,!0,!1),n()},"abort-on-iframe-property-write":function(...e){const{mark:t,end:n}=Fe("abort-on-iframe-property-write");t(),vt(e,!1,!0),n()},"abort-on-property-read":function(e,t){const n=!("false"===t),r=Qe(arguments),{mark:o,end:i}=Fe("abort-on-property-read");o(),wt("abort-on-property-read",window,e,r,n),i()},"abort-on-property-write":function(e,t){const n=Qe(arguments),{mark:r,end:o}=Fe("abort-on-property-write"),i=!("false"===t);r(),yt("abort-on-property-write",window,e,n,i),o()},"array-override":function(e,t,n="false",r,i){if(!e)throw new Ot("[array-override snippet]: Missing method to override.");if(!t)throw new Ot("[array-override snippet]: Missing needle.");It||(It=new Nt);let s=Ue("array-override");const{mark:a,end:c}=Fe("array-override"),u=Qe(arguments);if("push"!==e||It.has("push"))if("includes"!==e||It.has("includes")){if("forEach"===e&&!It.has("forEach")){a();const{forEach:e}=At.prototype;It.set("forEach",Re([])),jt.defineProperty(window.Array.prototype,"forEach",{value:l(e,(function(t,n){const r=It.get("forEach");return o(e,this,[function(e,i,a){for(const{needleRegex:t,pathSegments:n,stackNeedles:o}of r)if(n.length||"string"!=typeof e&&"number"!=typeof e){if(n.length&&"object"==typeof e&&null!==e&&Wt(e,t,n)&&Tt(o,s))return void s("success",`Array.forEach skipped callback for object containing needle: ${t}\nFILTER: array-override ${u}`)}else{const n=e.toString();if(n.match&&n.match(t)&&Tt(o,s))return void s("success",`Array.forEach skipped callback for item matching needle: ${t}\nFILTER: array-override ${u}`)}return o(t,n||this,[e,i,a])},n])}))}),s("info","Wrapped Array.prototype.forEach"),c()}}else{a();const{includes:e}=At.prototype;It.set("includes",Re([])),jt.defineProperty(window.Array.prototype,"includes",{value:l(e,(function(t){const n=It.get("includes");for(const{needleRegex:e,retVal:r,pathSegments:o,stackNeedles:i}of n)if(o.length||"string"!=typeof t&&"number"!=typeof t){if(o.length&&"object"==typeof t&&null!==t&&Wt(t,e,o)&&Tt(i,s))return s("success",`Array.includes returned ${r} for object containing ${e}\nFILTER: array-override ${u}`),r}else if(t.toString().match&&t.toString().match(e)&&Tt(i,s))return s("success",`Array.includes returned ${r} for ${e}\nFILTER: array-override ${u}`),r;return o(e,this,arguments)}))}),s("info","Wrapped Array.prototype.includes"),c()}else{a();const{push:e}=At.prototype;It.set("push",Re([])),jt.defineProperty(window.Array.prototype,"push",{value:l(e,(function(t){const n=It.get("push");for(const{needleRegex:e,pathSegments:r,stackNeedles:o}of n)if(r.length||"string"!=typeof t&&"number"!=typeof t){if(r.length&&"object"==typeof t&&null!==t&&Wt(t,e,r)&&Tt(o,s))return void s("success",`Array.push is ignored for object containing needle: ${e}\nFILTER: array-override ${u}`)}else{const n=t.toString();if(n.match&&n.match(e)&&Tt(o,s))return void s("success",`Array.push is ignored for needle: ${e}\nFILTER: array-override ${u}`)}return o(e,this,arguments)}))}),s("info","Wrapped Array.prototype.push"),c()}const d=_e(t);let f=[];r&&(f=r.split("."));let p=[];i&&(p=i.split(",").map((e=>e.trim())));const h=It.get(e),g="true"===n;h.push({needleRegex:d,retVal:g,pathSegments:f,stackNeedles:p}),It.set(e,h)},"blob-override":function(e,t="",n=null){if(!e)throw new Ht("[blob-override snippet]: Missing parameter search.");const r=Ue("blob-override"),o=Qe(arguments),{mark:i,end:s}=Fe("blob-override");if(i(),Bt.push({match:_e(e),replaceWith:t,needle:n?_e(n):null,formattedArgs:o}),Bt.length>1)return;const a=Dt;function c(e,t={}){if(Ft.isArray(e)){let t=Re(e).join("");for(const e of Re(Bt))e.needle&&!e.needle.test(t)||!e.match.test(t)||(t=t.replace(e.match,e.replaceWith),r("success",`Replaced: ${e.match} → ${e.replaceWith},\nFILTER: blob-override ${e.formattedArgs}`));e=[t]}const n=Vt.construct(a,[e,t]);return zt.setPrototypeOf(n,c.prototype),n}c.prototype=a.prototype,zt.setPrototypeOf(c,a),window.Blob=c,r("info","Wrapped Blob constructor in context "),s()},"cookie-remover":function(e,t=!1){if(!e)throw new qt("[cookie-remover snippet]: No cookie to remove.");const n=Qe(arguments);let r=Ue("cookie-remover");const{mark:o,end:i}=Fe("cookie-remover");let s=_e(e);if(!Re(/^http|^about/).test(location.protocol))return void r("warn","Snippet only works for http or https and about.");function a(){return Re(Gt()).split(";").filter((e=>s.test(Re(e).split("=")[0])))}const c=()=>{r("info","Parsing cookies for matches"),o();for(const e of Re(a())){let t=Re(location.hostname);!t&&Re(location.ancestorOrigins)&&Re(location.ancestorOrigins[0])&&(t=new Ut(Re(location.ancestorOrigins[0])).hostname);const o=Re(e).split("=")[0],i="expires=Thu, 01 Jan 1970 00:00:00 GMT",s="path=/",a=t.split(".");for(let e=a.length;e>0;e--){const t=a.slice(a.length-e).join(".");Gt(`${Re(o).trim()}=;${i};${s};domain=${t}`),Gt(`${Re(o).trim()}=;${i};${s};domain=.${t}`),r("success",`Set expiration date on ${o}`,"\nFILTER: cookie-remover",n)}}i()};if(c(),t){let e=a();setInterval((()=>{let t=a();if(t!==e)try{c()}finally{e=t}}),1e3)}},profile:We,debug:ze,"event-override":function(e,t,n=null){const r=Qe(arguments),i={eventType:e,mode:t,needle:n?_e(n):null,formattedArgs:r};if(en.includes(i)||en.push(i),en.length>1)return;let a=Ue("[event-override]");const{mark:c,end:u}=Fe("event-override"),d=Xt.getOwnPropertyDescriptor(window.EventTarget.prototype,"addEventListener");d.configurable&&Xt.defineProperty(window.EventTarget.prototype,"addEventListener",{...d,value:l(Qt,(function(e,t,n){c();const r=en.filter((t=>t.eventType===e));if(!r.length||e!==r[0].eventType)return u(),o(Qt,this,arguments);const i=r.find((e=>"disable"===e.mode&&(!e.needle||e.needle.test(t.toString()))));if(i)return a("success",`Disabling ${i.eventType} event, \nFILTER: event-override ${i.formattedArgs}`),void u();const l=r.filter((e=>"trusted"===e.mode&&(!e.needle||e.needle.test(t.toString()))));if("function"!=typeof t&&(!t||"function"!=typeof t.handleEvent)||!l.length||e!==l[0].eventType)return u(),o(Qt,this,arguments);const d=function(e){const n=new Proxy(e,{get(t,n){if("isTrusted"===n)return a("success",`Providing trusted value for ${e.type} event`),!0;const r=_t.get(t,n);return"function"==typeof r?function(...e){return o(r,t,e)}:r}});return"function"==typeof t?s(t,this,n):s(t.handleEvent,t,n)};return d.originalListener=t,Zt.has(t)||Zt.set(t,new Jt),Zt.get(t).set(e,d),a("info",`\nWrapping event listener for ${e}`),u(),o(Qt,this,[e,d,n])}))});const f=Xt.getOwnPropertyDescriptor(window.EventTarget.prototype,"removeEventListener");f.configurable&&Xt.defineProperty(window.EventTarget.prototype,"removeEventListener",{...f,value:l(Yt,(function(e,t,n){if(t&&Zt.has(t)&&Zt.get(t).has(e)){const r=Zt.get(t).get(e);return Zt.get(t).delete(e),o(Yt,this,[e,r,n])}return o(Yt,this,arguments)}))}),a("info","Initialized event-override snippet")},"freeze-element":function(e,t="",...n){let r,i,a=!1,c=!1,l=Re(n).filter((e=>!h(e))),u=Re(n).filter((e=>h(e))).map(_e),d=Ke(),f=Mn(e);!function(){let n=Re(t).split("+");1===n.length&&""===n[0]&&(n=[]);for(let t of n)switch(t){case"subtree":a=!0;break;case"abort":c=!0;break;default:throw new Dn("[freeze] Unknown option passed to the snippet. [selector]: "+e+" [option]: "+t)}}();let p={selector:e,shouldAbort:c,rid:d,exceptionSelectors:l,regexExceptions:u,changeId:0};function h(e){return e.length>=2&&"/"==e[0]&&"/"==e[e.length-1]}function g(){i=f(),m(i,!1)}function m(e,t=!0){for(let n of e)Wn.frozen.has(n)||(Wn.frozen.set(n,p),!t&&a&&new Hn((e=>{for(let t of Re(e))m(Re(t,"MutationRecord").addedNodes)})).observe(n,{childList:!0,subtree:!0}),a&&Re(n).nodeType===Pn&&m(Re(n).childNodes))}function w(e,...t){qe(`[freeze][${e}] `,...t)}function y(e,t,n,r){let o=r.selector,i=r.changeId,s="string"==typeof e,a=r.shouldAbort?"aborting":"watching";switch(In.groupCollapsed(`[freeze][${i}] ${a}: ${o}`),n){case"appendChild":case"append":case"prepend":case"insertBefore":case"replaceChild":case"insertAdjacentElement":case"insertAdjacentHTML":case"insertAdjacentText":case"innerHTML":case"outerHTML":w(i,s?"text: ":"node: ",e),w(i,"added to node: ",t);break;case"replaceWith":case"after":case"before":w(i,s?"text: ":"node: ",e),w(i,"added to node: ",Re(t).parentNode);break;case"textContent":case"innerText":case"nodeValue":w(i,"content of node: ",t),w(i,"changed to: ",e)}w(i,`using the function "${n}"`),In.groupEnd(),r.changeId++}function v(e,t){if(t)for(let n of t)if(n.test(e))return!0;return!1}function b(e){throw new Vn(e)}function E(e,t,n,r){let o=new Fn,{body:i}=Re(o.parseFromString(e,"text/html")),s=k(Re(i).childNodes,t,n,r);return Re(s).map((e=>{switch(Re(e).nodeType){case Pn:return Re(e).outerHTML;case On:return Re(e).textContent;default:return""}})).join("")}function k(e,t,n,r){let o=Re([]);for(let i of e)x(i,t,n,r)&&o.push(i);return o}function x(e,t,n,r){let o=r.shouldAbort,i=r.regexExceptions,s=r.exceptionSelectors,a=r.rid;if("string"==typeof e){let s=e;return!!v(s,i)||(He()&&y(s,t,n,r),o&&b(a),He())}let c=e;switch(Re(c).nodeType){case Pn:return!!function(e,t){if(t){let n=Re(e);for(let e of t)if(n.matches(e))return!0}return!1}(c,s)||(o&&(He()&&y(c,t,n,r),b(a)),!!He()&&(Tn(c),y(c,t,n,r),!0));case On:return!!v(Re(c).textContent,i)||(He()&&y(c,t,n,r),o&&b(a),!1);default:return!0}}function S(e,t,n,r){let i=Bn(e,t)||{},a=i.get&&s(i.get,e)||i.value;if(a)return{get:()=>function(...e){if(n(this)){let n=r(this);if(n){let r=e[0];if(!x(r,this,t,n))return r}}return o(a,this,e)}}}function T(e,t,n,r){let i=Bn(e,t)||{},a=i.get&&s(i.get,e)||i.value;if(a)return{get:()=>function(...e){if(!n(this))return o(a,this,e);let i=r(this);if(!i)return o(a,this,e);let s=k(e,this,t,i);return s.length>0?o(a,this,s):void 0}}}function $(e,t,n,r){let i=Bn(e,t)||{},a=i.get&&s(i.get,e)||i.value;if(a)return{get:()=>function(...e){let[i,c]=e,l="afterbegin"===i||"beforeend"===i;if(n(this,l)){let e=r(this,l);if(e){let n,r=l?this:Re(this).parentNode;switch(t){case"insertAdjacentElement":if(!x(c,r,t,e))return c;break;case"insertAdjacentHTML":return n=E(c,r,t,e),n?s(a,this,i,n):void 0;case"insertAdjacentText":if(!x(c,r,t,e))return}}}return o(a,this,e)}}}function M(e,t,n,r){let o=Bn(e,t)||{},{set:i}=o;if(i)return{set(e){if(!n(this))return s(i,this,e);let o=r(this);if(!o)return s(i,this,e);let a=E(e,this,t,o);return a?s(i,this,a):void 0}}}function L(e,t,n,r){let o=Bn(e,t)||{},{set:i}=o;if(i)return{set(e){if(!n(this))return s(i,this,e);let o=r(this);return o?x(e,this,t,o)?s(i,this,e):void 0:s(i,this,e)}}}Wn.frozen.has(document)||(Wn.frozen.set(document,!0),function(){let e;function t(e){return e&&Wn.frozen.has(e)}function n(e){try{return e&&(Wn.frozen.has(e)||Wn.frozen.has(Re(e).parentNode))}catch(e){return!1}}function r(e,t){try{return e&&(Wn.frozen.has(e)&&t||Wn.frozen.has(Re(e).parentNode)&&!t)}catch(e){return!1}}function o(e){return Wn.frozen.get(e)}function i(e){try{if(Wn.frozen.has(e))return Wn.frozen.get(e);let t=Re(e).parentNode;return Wn.frozen.get(t)}catch(e){}}function s(e,t){try{if(Wn.frozen.has(e)&&t)return Wn.frozen.get(e);let n=Re(e).parentNode;return Wn.frozen.get(n)}catch(e){}}e=S(jn,"appendChild",t,o),gt(jn,"appendChild",e),e=S(jn,"insertBefore",t,o),gt(jn,"insertBefore",e),e=S(jn,"replaceChild",t,o),gt(jn,"replaceChild",e),e=T(An,"append",t,o),gt(An,"append",e),e=T(An,"prepend",t,o),gt(An,"prepend",e),e=T(An,"replaceWith",n,i),gt(An,"replaceWith",e),e=T(An,"after",n,i),gt(An,"after",e),e=T(An,"before",n,i),gt(An,"before",e),e=$(An,"insertAdjacentElement",r,s),gt(An,"insertAdjacentElement",e),e=$(An,"insertAdjacentHTML",r,s),gt(An,"insertAdjacentHTML",e),e=$(An,"insertAdjacentText",r,s),gt(An,"insertAdjacentText",e),e=M(An,"innerHTML",t,o),gt(An,"innerHTML",e),e=M(An,"outerHTML",n,i),gt(An,"outerHTML",e),e=L(jn,"textContent",t,o),gt(jn,"textContent",e),e=L(Nn,"innerText",t,o),gt(Nn,"innerText",e),e=L(jn,"nodeValue",t,o),gt(jn,"nodeValue",e)}()),r=new Hn(g),r.observe(document,{childList:!0,subtree:!0}),g()},"hide-if-canvas-contains":function(e,t="canvas"){const n=Ue("hide-if-canvas-contains"),r=Qe(arguments),{mark:i,end:s}=Fe("hide-if-canvas-contains");if(!e)return void n("error","The parameter 'search' is required");if(!Qn){i();const c=qn.prototype;function u(e){const t=c[e];Xn.defineProperty(window.CanvasRenderingContext2D.prototype,e,{value:l(t,(function(r,...i){for(const[t,o]of Qn)if(t.test(r)){const t=this.canvas;let i=Re(t).closest(o.selector);i&&!Zn.has(i)?(Tn(i),Zn.add(i),n("success","Matched: ",i,`\nFILTER: hide-if-canvas-contains ${o.formattedArguments}`)):er(t,o,e,r)}return o(t,this,[r,...i])}))})}n("info","CanvasRenderingContext2D proxied"),u("fillText"),u("strokeText"),Qn=new Gn;new Jn((e=>{for(let t of Re(e))"childList"===t.type&&Yn.forEach((({canvasElement:e,rule:t,functionName:n,text:r})=>{let o=Re(e).closest(t.selector);o&&!Zn.has(o)&&(Tn(o),Zn.add(o),Yn.delete({canvasElement:e,rule:t,functionName:n,text:r}),Ue("hide-if-canvas-contains")("success","Matched: ",o,`\nFILTER: hide-if-canvas-contains ${t.formattedArguments}`))}))})).observe(Un,{childList:!0,subtree:!0}),s()}const a=_e(e);Qn.set(a,{selector:t,formattedArguments:r})},"hide-if-shadow-contains":function(e,t="*"){const n=Qe(arguments);let r=`${e}\\${t}`;mr.has(r)||mr.set(r,[_e(e),t,ar("hide-if-shadow-contains",(()=>{mr.delete(r)}))],n);const i=Ue("hide-if-shadow-contains"),{mark:s,end:a}=Fe("hide-if-shadow-contains");wr||(wr=new lr((e=>{s();let t=new dr;for(let{target:r}of Re(e)){let e=Re(r).parentNode;for(;e;)[r,e]=[e,Re(r).parentNode];if(!gr.has(r)&&!t.has(r)){t.add(r);for(let[e,t,o]of mr.values())if(e.test(Re(r).textContent)){let e=Re(r.host).closest(t);e&&(o(),Re(r).appendChild(document.createElement("style")).textContent=":host {display: none !important}",Tn(e),gr.add(r),i("success","Hiding: ",e,`\nFILTER: hide-if-shadow-contains ${n}`)),a()}}}})),ur.defineProperty(pr,"attachShadow",{value:l(hr,(function(){let e=o(hr,this,arguments);return i("info","attachShadow is called for: ",e),wr.observe(e,{childList:!0,characterData:!0,subtree:!0}),e}))}))},"json-override":function(e,t,n="",r=""){if(!e)throw new vr("[json-override snippet]: Missing paths to override.");if(void 0===t)throw new vr("[json-override snippet]: No value to override with.");if(!Sr){let s=Ue("json-override");const{mark:a,end:c}=Fe("json-override");function u(e,t){for(let{formattedArgs:n,prune:r,needle:o,filter:i,value:s}of Sr.values())if(!i||i.test(t)){if(Re(o).some((t=>!Et(e,t))))return e;for(let t of r)t.includes("{}")||t.includes("[]")?d(e,t,s,n):f(e,t,s,n)}return e}function d(e,t,n,r){let o=Re(t).split("."),i=e;for(let e=0;e<o.length;e++){let a=o[e];if("[]"===a)return void(yr.isArray(i)&&(s("info",`Iterating over array at: ${a}`),Re(i).forEach((t=>{null!=t&&d(t,o.slice(e+1).join("."),n,r)}))));if("{}"===a)return void(i&&"object"==typeof i&&(s("info",`Iterating over object at: ${a}`),kr.keys(i).forEach((t=>{let s=i[t];null!=s&&d(s,o.slice(e+1).join("."),n,r)}))));if(!i||"object"!=typeof i||!y(i,a))return;e===o.length-1?(s("success",`Found ${t}, replaced it with ${n}`,`\nFILTER: json-override ${r}`),i[a]=xt(n)):i=i[a]}}function f(e,t,n,r){let o=Et(e,t);void 0!==o&&(s("success",`Found ${t}, replaced it with ${n}`,`\nFILTER: json-override ${r}`),o[0][o[1]]=xt(n))}a();let{parse:p}=br;Sr=new Er,kr.defineProperty(window.JSON,"parse",{value:l(p,(function(e){return u(o(p,this,arguments),e)}))}),s("info","Wrapped JSON.parse for override");let{json:h}=xr.prototype;kr.defineProperty(window.Response.prototype,"json",{value:l(h,(function(e){return o(h,this,arguments).then((t=>u(t,e)))}))}),s("info","Wrapped Response.json for override"),c()}const i=Qe(arguments);Sr.set(e,{formattedArgs:i,prune:Re(e).split(/ +/),needle:n.length?Re(n).split(/ +/):[],filter:r?_e(r):null,value:t})},"json-prune":function(e,t="",n=""){if(!e)throw new $r("Missing paths to prune");if(!Pr){let i=Ue("json-prune");const{mark:s,end:a}=Fe("json-prune");function c(e){for(let{prune:t,needle:n,stackNeedle:r,formattedArgs:o}of Pr.values()){if(Re(n).length>0&&Re(n).some((t=>!Et(e,t))))return e;if(Re(r)&&Re(r).length>0&&!Tt(r,i))return e;for(let n of t)n.includes("{}")||n.includes("[]")?u(e,n,o):d(e,n,o)}return e}function u(e,t,n){let r=Re(t).split("."),o=e;for(let e=0;e<r.length;e++){let s=r[e];if("[]"===s)return void(Tr.isArray(o)&&(i("info",`Iterating over array at: ${s}`),Re(o).forEach((t=>u(t,r.slice(e+1).join("."),n)))));if("{}"===s)return void("object"==typeof o&&null!==o&&(i("info",`Iterating over object at: ${s}`),Rr.keys(o).forEach((t=>u(o[t],r.slice(e+1).join("."),n)))));if(!o||"object"!=typeof o||!y(o,s))return;e===r.length-1?(i("success",`Found ${t} and deleted, \nFILTER: json-prune ${n}`),delete o[s]):o=o[s]}}function d(e,t,n){let r=Et(e,t);void 0!==r&&(i("success",`Found ${t} and deleted`,`\nFILTER: json-prune ${n}`),delete r[0][r[1]])}s();let{parse:f}=Mr;Pr=new Lr,Rr.defineProperty(window.JSON,"parse",{value:l(f,(function(){return c(o(f,this,arguments))}))}),i("info","Wrapped JSON.parse for prune");let{json:p}=Cr.prototype;Rr.defineProperty(window.Response.prototype,"json",{value:l(p,(function(){return o(p,this,arguments).then((e=>c(e)))}))}),i("info","Wrapped Response.json for prune"),a()}const r=Qe(arguments);Pr.set(e,{formattedArgs:r,prune:Re(e).split(/ +/),needle:t.length?Re(t).split(/ +/):[],stackNeedle:n.length?Re(n).split(/ +/):[]})},"map-override":function(e,t,n="",r,i){if(!e)throw new Or("[map-override snippet]: Missing method to override.");if(!t)throw new Or("[map-override snippet]: Missing needle.");Nr||(Nr=new Ar);let s=Ue("map-override");const{mark:a,end:c}=Fe("map-override"),u=Qe(arguments);if("set"!==e||Nr.has("set"))if("get"!==e||Nr.has("get")){if("has"===e&&!Nr.has("has")){a();const{has:e}=Ar.prototype;Nr.set("has",Re([])),jr.defineProperty(window.Map.prototype,"has",{value:l(e,(function(t){const n=Nr.get("has");for(const{needleRegex:e,retVal:r,stackNeedles:o}of n)if("string"==typeof t||"number"==typeof t){const n=t.toString();if(e.test(n)&&Tt(o,s))return s("success",`Map.has returned ${r} for key: ${n}\nFILTER: map-override ${u}`),r}return o(e,this,arguments)}))}),s("info","Wrapped Map.prototype.has"),c()}}else{a();const{get:e}=Ar.prototype;Nr.set("get",Re([])),jr.defineProperty(window.Map.prototype,"get",{value:l(e,(function(t){const n=Nr.get("get");for(const{needleRegex:e,retVal:r,stackNeedles:o}of n)if("string"==typeof t||"number"==typeof t){const n=t.toString();if(e.test(n)&&Tt(o,s))return s("success",`Map.get returned ${r} for key: ${n}\nFILTER: map-override ${u}`),r}return o(e,this,arguments)}))}),s("info","Wrapped Map.prototype.get"),c()}else{a();const{set:e}=Ar.prototype;Nr.set("set",Re([])),jr.defineProperty(window.Map.prototype,"set",{value:l(e,(function(t,n){const r=Nr.get("set");for(const{needleRegex:e,pathSegments:t,stackNeedles:o}of r)if(Ir(n,e,t)&&Tt(o,s))return s("success",`Map.set is ignored for value matching needle: ${e}\nFILTER: map-override ${u}`),this;return o(e,this,arguments)}))}),s("info","Wrapped Map.prototype.set"),c()}const d=_e(t);let f=[];r&&(f=r.split("."));let p=[];i&&(p=i.split(",").map((e=>e.trim())));const h=Nr.get(e);let g;"get"===e?g=""===n?void 0:n:"has"===e&&(g="true"===n),h.push({needleRegex:d,retVal:g,pathSegments:f,stackNeedles:p}),Nr.set(e,h)},"override-property-read":function(e,t,n){if(!e)throw new Wr("[override-property-read snippet]: No property to override.");if(void 0===t)throw new Wr("[override-property-read snippet]: No value to override with.");const r=Qe(arguments);let o=Ue("override-property-read");const{mark:i,end:s}=Fe("override-property-read");let a=xt(t);o("info",`Overriding ${e}.`);const c=!("false"===n);i(),gt(window,e,{get:()=>(o("success",`${e} override done.`,"\nFILTER: override-property-read",r),a),set(){}},c),s()},"prevent-listener":function(e,t,n){if(!e)throw new Fr("[prevent-listener snippet]: No event type.");if(!Ur){Ur=new Dr;let e=Ue("[prevent]");const{mark:t,end:n}=Fe("prevent-listener");Hr.defineProperty(Br,"addEventListener",{value:l(qr,(function(r,i){t();for(let{evt:t,handlers:n,selectors:o}of Ur.values()){if(!t.test(r))continue;let a=this instanceof Element;for(let l=0;l<n.length;l++){const u=n[l],d=o[l];if(!d||a&&Re(this).matches(d)){if(u){const t=function(){try{const e=String("function"==typeof i?i:i.handleEvent);return u.test(e)}catch(t){return e("error","Error while trying to stringify listener: ",t),!1}};if(!function(){try{const e=s(Vr,"function"==typeof i?i:i.handleEvent);return u.test(e)}catch(t){return e("error","Error while trying to stringify listener: ",t),!1}}()&&!t())continue}return void(He()&&(zr.groupCollapsed("DEBUG [prevent] was successful",`\nFILTER: prevent-listener ${c}`),e("success",`type: ${r} matching ${t}`),e("success","handler:",i),u&&e("success",`matching ${u}`),d&&e("success","on element: ",this,` matching ${d}`),e("success","was prevented from being added"),zr.groupEnd()))}}}return n(),o(qr,this,arguments)}))}),e("info","Wrapped addEventListener")}const r=Qe(arguments);Ur.has(e)||Ur.set(e,{evt:_e(e),handlers:[],selectors:[],formattedArgs:r});let{handlers:i,selectors:a,formattedArgs:c}=Ur.get(e);i.push(t?_e(t):null),a.push(n)},"replace-fetch-response":function(e,t="",n=null){const r=Qe(arguments),o=Ue("replace-fetch-response"),{mark:i,end:s}=Fe("replace-fetch-response");if(!e)return void o("error","The parameter 'search' is required");if(!Qr){const e=e=>{i();return Re(e).clone().text().then((t=>{let n=Re(t);for(const[e,{replacement:r,needle:i,formattedArgs:s}]of Qr){if(i){if(!_e(i).test(n)){He()&&(console.groupCollapsed(`DEBUG [replace-fetch-response] warn: '${i}' not found in fetch response`),o("warn",`${n}`),console.groupEnd());continue}He()&&(console.groupCollapsed(`DEBUG [replace-fetch-response] success: '${i}' found in fetch response`),o("info",`${n}`),console.groupEnd())}n=n.replace(e,r),He()&&n.toString()!==t.toString()&&(console.groupCollapsed(`DEBUG [replace-fetch-response] success: '${e}' replaced with '${r}' in fetch response`,`\nFILTER: replace-fetch-response ${s}`),o("success",`${n}`),console.groupEnd())}if(n.toString()===t.toString())return e;const r=new to(n.toString(),{status:e.status,statusText:e.statusText,headers:e.headers});return Zr.defineProperties(r,{ok:{value:e.ok},redirected:{value:e.redirected},type:{value:e.type},url:{value:e.url}}),s(),r}))};Qr=new Yr,o("info","Network API proxied"),a=e,_r.push(a),Kr()}var a;const c=_e(e),l=new eo(c,"g");Qr.set(l,{replacement:t,needle:n,formattedArgs:r})},"replace-outbound-value":function(e,t="",n="",r="",i="",s=""){if(!e)throw new no("[replace-outbound-value snippet]: Missing method path.");let a=Ue("replace-outbound-value");const{mark:c,end:u}=Fe("replace-outbound-value");function d(e,t,n,r){if("base64"===r)try{if(function(e){try{if(""===e)return!1;const t=oo(e),n=io(t),r=Re(e).replace(/=+$/,"").toString();return Re(n).replace(/=+$/,"").toString()===r}catch(e){return!1}}(e)){const r=oo(e);a("info",`Decoded base64 content: ${r}`);const o=t?Re(r).replace(t,n).toString():r;a("info",o!==r?`Modified decoded content: ${o}`:"Decoded content was not modified");const i=io(o);return a("info",`Re-encoded to base64: ${i}`),i}a("info",`Content is plain text: ${e}`);const r=t?Re(e).replace(t,n).toString():e;a("info",r!==e?`Modified plain text content: ${r}`:"Plain text content was not modified");const o=io(r);return a("info",`Encoded to base64: ${o}`),o}catch(t){return a("info",`Error processing base64 content: ${t.message}`),e}return t?Re(e).replace(t,n).toString():e}function f(e,t,n,r,o,i){const s=n?new so(_e(n),"g"):null;if(t.length&&"object"==typeof e&&null!==e){const c=n?function(e,t,n,r,o){if(!t.length)return e;let i=e;for(let n=0;n<t.length-1;n++){if(!i||"object"!=typeof i)return a("info",`Cannot navigate to path: property '${t[n]}' not found`),e;i=i[t[n]]}const s=t[t.length-1];if(!i||"object"!=typeof i||!(s in i))return a("info",`Target property '${s}' not found at path`),e;const c=i[s];if("string"!=typeof c)return a("info","Property at path is not a string: "+typeof c),e;const l=d(c,n,r,o);if(l!==c){const n=JSON.parse(JSON.stringify(e));let r=n;for(let e=0;e<t.length-1;e++)r=r[t[e]];return r[s]=l,a("info",`Replaced value at path '${t.join(".")}': '${c}' -> '${l}'`),n}return e}(e,t,s,r,o):e;return c!==e&&a("success",`Replaced outbound value\nFILTER: replace-outbound-value ${i}`),c}if("string"==typeof e){n||a("info",`Original text content: ${e}`);const t=n?d(e,s,r,o):e;return t!==e&&a("success",`Replaced outbound value: ${t} \nFILTER: replace-outbound-value ${i}`),t}return a("info",t.length?"Content is not an object or path not specified":"Content is not a string"),e}Qe(arguments),c();const p=function(e,t){let n=e,r=Re(t).split(".");for(let e=0;e<r.length-1;e++){let t=r[e];if(!n||"object"!=typeof n)return{base:n,prop:t,remainingPath:r.slice(e).join("."),success:!1};n=n[t]}return{base:n,prop:r[r.length-1],success:!0}}(window,e);if(!p.success)return a("error",`Could not reach the end of the prop chain: ${e}. Remaining path: ${p.remainingPath}`),void u();const{base:h,prop:g}=p,m=h[g];if(!m||"function"!=typeof m)return a("error",`Could not retrieve the method: ${e}`),void u();let w=[];i&&(w=Re(i).split("."));let y=[];s&&(y=Re(s).split(",").map((e=>e.trim())));let v=!1;ro.defineProperty(h,g,{value:l(m,(function(){if(v)return o(m,this,arguments);v=!0;const e=o(m,this,arguments);if(y.length&&!Tt(y,a))return v=!1,e;if(e&&"function"==typeof e.then)return a("info","Method returned a Promise, modifying resolved value"),v=!1,e.then((e=>{const o="object"==typeof e?JSON.stringify(e):e;return a("info",`Promise resolved with value: ${o}`),f(e,w,t,n,r,i)})).catch((e=>{throw a("info",`Promise rejected: ${e.message}`),e}));const s=f(e,w,t,n,r,i);return v=!1,s}))}),a("info",`Wrapped ${e}`),u()},"replace-xhr-response":function(e,t="",n=null){const r=Qe(arguments),o=Ue("replace-xhr-response"),{mark:i,end:s}=Fe("replace-xhr-response");if(!e)return void o("error","The parameter 'pattern' is required");ao||(ao=new fo,co=new Map,o("info","XMLHttpRequest proxied"),window.XMLHttpRequest=class extends uo{open(e,t,...n){const r={method:e,url:t};return ao.set(this,r),super.open(e,t,...n)}send(...e){return super.send(...e)}get response(){const e=super.response,t=ao.get(this);if(void 0===t)return e;i();const n="string"==typeof e?e.length:void 0;if(t.lastResponseLength!==n&&(t.response=void 0,t.lastResponseLength=n),void 0!==t.response)return t.response;if("string"!=typeof e)return t.response=e;let r=e;for(const[t,{replacement:n,needle:i,formattedArgs:s}]of co){if(i){if(!_e(i).test(r)){He()&&(console.groupCollapsed(`DEBUG [replace-xhr-response] warn: '${i}' not found in XHR response`),o("warn",r),console.groupEnd());continue}He()&&(console.groupCollapsed(`DEBUG [replace-xhr-response] success: '${i}' found in XHR response`),o("info",r),console.groupEnd())}r=Re(r).replace(t,n).toString(),He()&&e.toString()!==r.toString()&&(console.groupCollapsed(`DEBUG [replace-xhr-response] success: '${t}' replaced with '${n}' in XHR response`,`\nFILTER: replace-xhr-response ${s}`),o("success",r),console.groupEnd())}return s(),t.response=r.toString()}get responseText(){const e=this.response;return"string"!=typeof e?super.responseText:e}});const a=_e(e),c=new lo(a,"g");co.set(c,{replacement:t,needle:n,formattedArgs:r})},"strip-fetch-query-parameter":function(e,t=null){const n=Qe(arguments),r=Ue("strip-fetch-query-parameter"),{mark:o,end:i}=Fe("strip-fetch-query-parameter"),s=e=>{o();for(let[t,n]of po.entries()){const{reg:o,args:i}=n;o&&!o.test(e)||go(e.searchParams,t)&&(r("success",`${t} has been stripped from url ${e}`,`\nFILTER: strip-fetch-query-parameter ${i}`),ho(e.searchParams,t))}i()};var a;po||(po=new Map,a=s,Xr.push(a),Kr()),po.set(e,{reg:t&&_e(t),args:n})},trace:function(...e){o(qe,null,e)}};let{MutationObserver:wo,WeakSet:yo,getComputedStyle:vo}=Re(window);let{getComputedStyle:bo,MutationObserver:Eo,Uint8Array:ko}=Re(window);const{parseFloat:xo,Math:So,MutationObserver:To,WeakSet:$o}=Re(window),{min:Mo}=So,Lo=(e,t)=>{const n=e.length+1,r=t.length+1,o=[[0]];let i=0,s=0;for(;++i<r;)o[0][i]=i;for(i=0;++i<n;){const n=e[s];let a=0,c=0;for(o[i]=[i];++a<r;)o[i][a]=Mo(o[s][a]+1,o[i][c]+1,o[s][c]+(n!=t[c])),++c;++s}return o[n-1][r-1]};let{getComputedStyle:Ro,Map:Co,WeakSet:Po,parseFloat:Oo,DOMMatrix:jo,Math:Ao}=Re(window);const{ELEMENT_NODE:No,TEXT_NODE:Io}=Node;let{MutationObserver:Wo,WeakSet:Fo,getComputedStyle:Do}=Re(window);let{getComputedStyle:Ho,MutationObserver:zo,WeakSet:Vo}=Re(window);let{MutationObserver:Bo,WeakSet:qo}=Re(window);const{ELEMENT_NODE:Uo}=Node;let{MutationObserver:Go,WeakSet:Jo}=Re(window);const{ELEMENT_NODE:Xo}=Node;let{getComputedStyle:_o,MutationObserver:Ko,DOMParser:Qo,Math:Yo,Node:Zo,Map:ei}=Re(window);let{parseInt:ti,setTimeout:ni,Error:ri,MouseEvent:oi,MutationObserver:ii,WeakSet:si}=Re(window);const ai=["auxclick","click","dblclick","gotpointercapture","lostpointercapture","mouseenter","mousedown","mouseleave","mousemove","mouseout","mouseover","mouseup","pointerdown","pointerenter","pointermove","pointerover","pointerout","pointerup","pointercancel","pointerleave"];let{isNaN:ci,MutationObserver:li,parseInt:ui,parseFloat:di,setTimeout:fi}=Re(window);const pi={log:qe,race:function(e,t="1"){switch(e){case"start":ir={winners:or(t,10)||1,participants:new rr},sr=new tr;break;case"end":case"finish":case"stop":ir=null;for(let e of sr)e();sr=null;break;default:throw new nr(`Invalid action: ${e}`)}},debug:ze,profile:We,"hide-if-matches-xpath":function(e,t,n){const{mark:r,end:o}=Fe("hide-if-matches-xpath"),i=Qe(arguments),s=Ue("hide-if-matches-xpath");St(s,(()=>{const n=n=>{const a=$n(`xpath(${e})`),c=new qo,l=e=>{c.add(e),f(),Re(e).nodeType===Uo?Tn(e):Re(e).textContent="",s("success","Matched: ",