@eyeo/snippets
Version:
eye/o snippets for Ads blocker
30 lines (29 loc) • 389 kB
JavaScript
/*!
* 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 callback = (environment, ...filters) => {
const e=Proxy,{apply:t,bind:n,call:r}=Function,a=r.bind(t),o=r.bind(n),u=r.bind(r),i={get:(e,t)=>o(r,e[t])},c=t=>new e(t,i),l={get:(e,t)=>o(e[t],e)},s=t=>new e(t,l),{assign:p,defineProperties:f,freeze:h,getOwnPropertyDescriptor:d,getOwnPropertyDescriptors:m,getPrototypeOf:y}=s(Object),{hasOwnProperty:g}=c({}),{species:v}=Symbol,w={get(e,t){const n=e[t];class r extends n{}const a=m(n.prototype);delete a.constructor,h(f(r.prototype,a));const o=m(n);return delete o.length,delete o.prototype,o[v]={value:r},h(f(r,o))}},A=t=>new e(t,w),x="undefined"!=typeof environment?environment:{};"undefined"==typeof globalThis&&(window.globalThis=window);const{apply:b,ownKeys:B}=s(Reflect),E="world"in x,N=E&&"ISOLATED"===x.world,T=E&&"MAIN"===x.world,I="object"==typeof chrome&&!!chrome.runtime,C="object"==typeof browser&&!!browser.runtime,F=!T&&(N||I||C),O=e=>F?e:S(e,U(e)),{create:S,defineProperties:G,defineProperty:D,freeze:R,getOwnPropertyDescriptor:k,getOwnPropertyDescriptors:U}=s(Object),M=s(globalThis),H=F?globalThis:A(globalThis),{Map:P,RegExp:j,Set:X,WeakMap:L,WeakSet:Y}=H,Q=(e,t,n=null)=>{const r=B(t);for(const a of B(e)){if(r.includes(a))continue;const o=k(e,a);if(n&&"value"in o){const{value:e}=o;"function"==typeof e&&(o.value=n(e))}D(t,a,o)}},J=e=>{const t=H[e];class n extends t{}const{toString:r,valueOf:a}=t.prototype;G(n.prototype,{toString:{value:r},valueOf:{value:a}});const o=e.toLowerCase(),u=e=>function(){const t=b(e,this,arguments);return typeof t===o?new n(t):t};return Q(t,n,u),Q(t.prototype,n.prototype,u),n},K=R({frozen:new L,hidden:new Y,iframePropertiesToAbort:{read:new X,write:new X},abortedIframes:new L}),q=new j("^[A-Z]"),V=F&&(I&&chrome||C&&browser)||void 0;var _=new Proxy(new P([["chrome",V],["browser",V],["isExtensionContext",F],["variables",K],["console",O(console)],["document",globalThis.document],["JSON",O(JSON)],["Map",P],["Math",O(Math)],["Number",F?Number:J("Number")],["RegExp",j],["Set",X],["String",F?String:J("String")],["WeakMap",L],["WeakSet",Y],["MouseEvent",MouseEvent]]),{get(e,t){if(e.has(t))return e.get(t);let n=globalThis[t];return"function"==typeof n&&(n=(q.test(t)?H:M)[t]),e.set(t,n),n},has:(e,t)=>e.has(t)});const W={WeakSet:WeakSet,WeakMap:WeakMap,WeakValue:class{has(){return!1}set(){}}},{apply:Z}=Reflect;const{Map:$,WeakMap:z,WeakSet:ee,setTimeout:te}=_;let ne=!0,re=e=>{e.clear(),ne=!ne};var ae=function(e){const{WeakSet:t,WeakMap:n,WeakValue:r}=this||W,a=new t,o=new n,u=new r;return function(t){if(a.has(t))return t;if(o.has(t))return o.get(t);if(u.has(t))return u.get(t);const n=Z(e,this,arguments);return a.add(n),n!==t&&("object"==typeof t&&t?o:u).set(t,n),n}}.bind({WeakMap:z,WeakSet:ee,WeakValue:class extends ${set(e,t){return ne&&(ne=!ne,te(re,0,this)),super.set(e,t)}}});const{concat:oe,includes:ue,join:ie,reduce:ce,unshift:le}=c([]),se=A(globalThis),{Map:pe,WeakMap:fe}=se,he=new pe,de=t=>{const n=(e=>{const t=[];let n=e;for(;n;){if(he.has(n))le(t,he.get(n));else{const e=m(n);he.set(n,e),le(t,e)}n=y(n)}return le(t,{}),a(p,null,t)})("function"==typeof t?t.prototype:t),r={get(e,t){if(t in n){const{value:r,get:a}=n[t];if(a)return u(a,e);if("function"==typeof r)return o(r,e)}return e[t]},set(e,t,r){if(t in n){const{set:a}=n[t];if(a)return u(a,e,r),!0}return e[t]=r,!0}};return t=>new e(t,r)},{isExtensionContext:me,Array:ye,Number:ge,String:ve,Object:we}=_,{isArray:Ae}=ye,{getOwnPropertyDescriptor:xe,setPrototypeOf:be}=we,{toString:Be}=we.prototype,{slice:Ee}=ve.prototype,{get:Ne}=xe(Node.prototype,"nodeType"),Te=me?{}:{Attr:de(Attr),CanvasRenderingContext2D:de(CanvasRenderingContext2D),CSSStyleDeclaration:de(CSSStyleDeclaration),Document:de(Document),Element:de(Element),HTMLCanvasElement:de(HTMLCanvasElement),HTMLElement:de(HTMLElement),HTMLImageElement:de(HTMLImageElement),HTMLScriptElement:de(HTMLScriptElement),MutationRecord:de(MutationRecord),Node:de(Node),ShadowRoot:de(ShadowRoot),get CSS2Properties(){return Te.CSSStyleDeclaration}},Ie=(e,t)=>{if("Element"!==t&&t in Te)return Te[t](e);if(Ae(e))return be(e,ye.prototype);const n=(e=>u(Ee,u(Be,e),8,-1))(e);if(n in Te)return Te[n](e);if(n in _)return be(e,_[n].prototype);if("nodeType"in e)switch(u(Ne,e)){case 1:if(!(t in Te))throw new Error("unknown hint "+t);return Te[t](e);case 2:return Te.Attr(e);case 3:return Te.Node(e);case 9:return Te.Document(e)}throw new Error("unknown brand "+n)};var Ce=me?e=>e===window||e===globalThis?_:e:ae(((e,t="Element")=>{if(e===window||e===globalThis)return _;switch(typeof e){case"object":return e&&Ie(e,t);case"string":return new ve(e);case"number":return new ge(e);default:throw new Error("unsupported value")}}));let Fe=!1;function Oe(){return Fe}let{console:Se,document:Ge,getComputedStyle:De,isExtensionContext:Re,variables:ke,Array:Ue,MutationObserver:Me,Object:He,XPathEvaluator:Pe,XPathExpression:je,XPathResult:Xe}=Ce(window);const{querySelectorAll:Le}=Ge,Ye=Le&&o(Le,Ge);function Qe(e,t=!1){try{const n=navigator.userAgent.includes("Firefox")?e.openOrClosedShadowRoot:browser.dom.openOrClosedShadowRoot(e);return null===n&&Oe()&&!t&&Se.log("Shadow root not found or not added in element yet",e),n}catch(n){return Oe()&&!t&&Se.log("Error while accessing shadow root",e,n),null}}function Je(e,t=!1){return Ve(e,Ye.bind(Ge),Ge,t)}function Ke(e,t,n,r){const a=t.getAttribute("xlink:href")||t.getAttribute("href");if(a){const u=Ye(a)[0];if(!u&&Oe())return Se.log("No elements found matching",a),!1;if(!(o=e)||0===o.length||o.every((e=>""===e.trim()))){const e=r.length>0?r:[];return n.push({element:u,rootParents:[...e,t]}),!1}const i=u.querySelectorAll.bind(u);return{nextBoundElement:u,nestedSelectorsString:e.join("^^"),next$$:i}}var o}function qe(e,t){const n=Qe(t);if(n){const{querySelectorAll:r}=n,a=r&&o(r,n).bind(n);return{nextBoundElement:t,nestedSelectorsString:":host "+e.join("^^"),next$$:a}}return!1}function Ve(e,t,n,r,a=[]){if(e.includes("^^")){const[o,u,...i]=e.split("^^");let c,l;switch(u){case"svg":l=Ke;break;case"sh":l=qe;break;default:return Oe()&&Se.log(u," is not supported. Supported commands are: \n^^sh^^\n^^svg^^"),[]}c=""===o.trim()?[n]:t(o);const s=[];for(const e of c){const t=l(i,e,s,a);if(!t)continue;const{next$$:n,nestedSelectorsString:o,nextBoundElement:u}=t,c=Ve(o,n,u,r,[...a,e]);c&&s.push(...c)}return s}const o=t(e);return r?[...o].map((e=>({element:e,rootParents:a.length>0?a:[]}))):o}function _e(e,t,n=[]){if(t.includes("^^svg^^")&&(t=t.split("^^svg^^")[0]),t.includes("^^sh^^")){const r=t.split("^^sh^^"),a=r.length-1;if(t=`:host ${r[a]}`,a===n.length)return e.closest(t);return n[a].closest(t)}return n[0]?n[0].closest(t):e.closest(t)}const{assign:We,setPrototypeOf:Ze}=He;class $e extends je{evaluate(...e){return Ze(a(super.evaluate,this,e),Xe.prototype)}}class ze extends Pe{createExpression(...e){return Ze(a(super.createExpression,this,e),$e.prototype)}}function et(e){if(ke.hidden.has(e))return!1;!function(e){Re&&"function"==typeof checkElement&&checkElement(e)}(e),ke.hidden.add(e);let{style:t}=Ce(e),n=Ce(t,"CSSStyleDeclaration"),r=Ce([]),{debugCSSProperties:a}=x;for(let[e,t]of a||[["display","none"]])n.setProperty(e,t,"important"),r.push([e,n.getPropertyValue(e)]);return new Me((()=>{for(let[e,t]of r){let r=n.getPropertyValue(e),a=n.getPropertyPriority(e);r==t&&"important"==a||n.setProperty(e,t,"important")}})).observe(e,{attributes:!0,attributeFilter:["style"]}),!0}function tt(e){let t=e;if(t.startsWith("xpath(")&&t.endsWith(")")){let e=t.slice(6,-1),n=(new ze).createExpression(e,null),r=Xe.ORDERED_NODE_SNAPSHOT_TYPE;return e=>{if(!e)return;let t=n.evaluate(Ge,r,null),{snapshotLength:a}=t;for(let n=0;n<a;n++)e(t.snapshotItem(n))}}return t=>Je(e).forEach(t)}function nt(e,t,n,r){let a;null==n&&(n=t);const o=()=>{for(const{element:o,rootParents:u}of Je(n,!0)){const n=_e(Ce(o),t,u);n&&e(o,n,u)&&(a(),et(n)&&"function"==typeof r&&r(n))}};return We(new Me(o),{race(e){a=e,this.observe(Ge,{childList:!0,characterData:!0,subtree:!0}),o()}})}function rt(e,t,n,r){let a=Ce(t,"CSSStyleDeclaration");if("none"==a.getPropertyValue("display"))return!1;let o=a.getPropertyValue("visibility");if("hidden"==o||"collapse"==o)return!1;if(!n||e==n)return!0;let u=Ce(e).parentElement;if(!u){if(!r||!r.length)return!0;u=r[r.length-1],r=r.slice(0,-1)}return rt(u,De(u),n,r)}function at(e){let t=De(e),{cssText:n}=t;if(n)return n;for(let e of t)n+=`${e}: ${t[e]}; `;return Ce(n).trim()}let{Array:ot,Math:ut,RegExp:it}=Ce(window);function ct(e){let{length:t}=e;if(t>1&&"/"===e[0]){let n="/"===e[t-1];if(n||t>2&&Ce(e).endsWith("/i")){let t=[Ce(e).slice(1,n?-1:-2)];return n||t.push("i"),new it(...t)}}return new it(Ce(e).replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"))}function lt(e){return Ce(ot.from(e)).map((e=>`'${e}'`)).join(" ")}let{Math:st,setInterval:pt,performance:ft}=Ce(window);const ht={mark(){},end(){},toString:()=>"{mark(){},end(){}}"};let dt=!0;function mt(e,t=10){if(dt)return ht;function n(){let e=Ce([]);for(let{name:t,duration:n}of ft.getEntriesByType("measure"))e.push({name:t,duration:n});e.length&&ft.clearMeasures()}return mt[e]||(mt[e]=pt(n,st.round(6e4/st.min(60,t)))),{mark(){ft.mark(e)},end(t=!1){ft.measure(e,e);const r=ft.getEntriesByName(e,"measure"),a=r.length>0?r[r.length-1]:null;console.log("PROFILER:",a),ft.clearMarks(e),t&&(clearInterval(mt[e]),delete mt[e],n())}}}const{console:yt}=Ce(window),gt=()=>{};function vt(...e){let{mark:t,end:n}=mt("log");if(Oe()){const t=["%c DEBUG","font-weight: bold;"],n=e.indexOf("error"),r=e.indexOf("warn"),a=e.indexOf("success"),o=e.indexOf("info");-1!==n?(t[0]+=" - ERROR",t[1]+="color: red; border:2px solid red",Ce(e).splice(n,1)):-1!==r?(t[0]+=" - WARNING",t[1]+="color: orange; border:2px solid orange ",Ce(e).splice(r,1)):-1!==a?(t[0]+=" - SUCCESS",t[1]+="color: green; border:2px solid green",Ce(e).splice(a,1)):-1!==o&&(t[1]+="color: black;",Ce(e).splice(o,1)),Ce(e).unshift(...t)}t(),yt.log(...e),n()}function wt(e){return o(Oe()?vt:gt,null,e)}let{Array:At,Error:xt,Map:bt,parseInt:Bt}=Ce(window),Et=null,Nt=null;function Tt(e,t){if(null===Et)return gt;let n=Et,{participants:r}=n;return r.set(a,t),a;function a(){if(n.winners<1)return;if(wt("race")("success",`${e} won the race`),n===Et)Nt.push(a);else if(r.delete(a),--n.winners<1){for(let e of r.values())e();r.clear()}}}const It={get(e,t){const n=e;for(;!g(e,t);)e=y(e);const{get:r,set:o}=d(e,t);return function(){return arguments.length?a(o,n,arguments):u(r,n)}}};var Ct;function Ft(e,t,n){var r,a;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,a=n,new Promise((e=>{const t=()=>{r.removeEventListener(a,t),e()};r.addEventListener(a,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()}Ce(window),Ct=window,new e(Ct,It),Ce(/^\d+$/);let{MutationObserver:Ot,WeakSet:St,getComputedStyle:Gt}=Ce(window);let{clearTimeout:Dt,fetch:Rt,getComputedStyle:kt,setTimeout:Ut,Map:Mt,MutationObserver:Ht,Uint8Array:Pt}=Ce(window);let jt=new Mt;function Xt(e,{as:t="arrayBuffer",cleanup:n=6e4}={}){let r=t+":"+e,a=jt.get(r)||{remove:()=>jt.delete(r),result:null,timer:0};return Dt(a.timer),a.timer=Ut(a.remove,n),a.result||(a.result=Rt(e).then((e=>e[t]())).catch(a.remove),jt.set(r,a)),a.result}const{parseFloat:Lt,Math:Yt,MutationObserver:Qt,WeakSet:Jt}=Ce(window),{min:Kt}=Yt,qt=(e,t)=>{const n=e.length+1,r=t.length+1,a=[[0]];let o=0,u=0;for(;++o<r;)a[0][o]=o;for(o=0;++o<n;){const n=e[u];let i=0,c=0;for(a[o]=[o];++i<r;)a[o][i]=Kt(a[u][i]+1,a[o][c]+1,a[u][c]+(n!=t[c])),++c;++u}return a[n-1][r-1]};let{getComputedStyle:Vt,Map:_t,WeakSet:Wt,parseFloat:Zt,DOMMatrix:$t,Math:zt}=Ce(window);const{ELEMENT_NODE:en,TEXT_NODE:tn}=Node;let{MutationObserver:nn,WeakSet:rn,getComputedStyle:an}=Ce(window);let{getComputedStyle:on,MutationObserver:un,WeakSet:cn}=Ce(window);let{MutationObserver:ln,WeakSet:sn}=Ce(window);const{ELEMENT_NODE:pn}=Node;let{MutationObserver:fn,WeakSet:hn}=Ce(window);const{ELEMENT_NODE:dn}=Node;let{parseInt:mn,setTimeout:yn,Error:gn,MouseEvent:vn,MutationObserver:wn,WeakSet:An}=Ce(window);const xn=["auxclick","click","dblclick","gotpointercapture","lostpointercapture","mouseenter","mousedown","mouseleave","mousemove","mouseout","mouseover","mouseup","pointerdown","pointerenter","pointermove","pointerover","pointerout","pointerup","pointercancel","pointerleave"];let{isNaN:bn,MutationObserver:Bn,parseInt:En,parseFloat:Nn,setTimeout:Tn}=Ce(window);const In={log:vt,race:function(e,t="1"){switch(e){case"start":Et={winners:Bt(t,10)||1,participants:new bt},Nt=new At;break;case"end":case"finish":case"stop":Et=null;for(let e of Nt)e();Nt=null;break;default:throw new xt(`Invalid action: ${e}`)}},debug:function(){Fe=!0},profile:function(){dt=!1},"hide-if-matches-xpath":function(e,t,n){const{mark:r,end:a}=mt("hide-if-matches-xpath"),o=lt(arguments),u=wt("hide-if-matches-xpath");Ft(u,(()=>{const n=n=>{const i=tt(`xpath(${e})`),c=new sn,l=e=>{c.add(e),f(),Ce(e).nodeType===pn?et(e):Ce(e).textContent="",u("success","Matched: ",e,"\nFILTER: hide-if-matches-xpath",o)},s=()=>{r(),i((e=>{if(c.has(e))return!1;if(t){tt(`xpath(${t})`)((t=>{if(!t.contains(e))return!1;l(e)}))}else l(e)})),a()},p=new ln(s),f=Tt("hide-if-matches-xpath",(()=>p.disconnect()));p.observe(n,{characterData:!0,childList:!0,subtree:!0}),s()};if(t){let e,r=0;const a=tt(`xpath(${t})`),o=()=>{a((e=>{n(e),r++})),r>0&&e.disconnect()};e=new ln(o),e.observe(document,{characterData:!0,childList:!0,subtree:!0}),o()}else n(document)}),n)},"hide-if-matches-computed-xpath":function(e,t,n,r){const{mark:a,end:o}=mt("hide-if-matches-computed-xpath"),u=lt(arguments),i=wt("hide-if-matches-computed-xpath");if(!t||!e)return void i("error","No query or searchQuery provided.");const c=t=>{const n=(t=>e.replace("{{}}",t))(t);i("info","Starting hiding elements that match query: ",n);const r=tt(`xpath(${n})`),c=new hn,l=()=>{a(),r((e=>{if(c.has(e))return!1;c.add(e),p(),Ce(e).nodeType===dn?et(e):Ce(e).textContent="",i("success","Matched: ",e,"\nFILTER: hide-if-matches-computed-xpath",u)})),o()},s=new fn(l),p=Tt("hide-if-matches-computed-xpath",(()=>s.disconnect()));s.observe(document,{characterData:!0,childList:!0,subtree:!0}),l()},l=ct(n);Ft(i,(()=>{if(t){i("info","Started searching for: ",t);const e=new hn;let n;const r=tt(`xpath(${t})`),a=()=>{r((t=>{if(e.has(t))return!1;if(e.add(t),i("info","Found node: ",t),t.innerHTML){i("info","Searching in: ",t.innerHTML);const e=t.innerHTML.match(l);if(e&&e.length){let t="";t=e[1]?e[1]:e[0],i("info","Matched search query: ",t),c(t)}}}))};n=new fn(a),n.observe(document,{characterData:!0,childList:!0,subtree:!0}),a()}}),r)},"hide-if-contains":function(e,t="*",n=null){const r=lt(arguments),a=wt("hide-if-contains"),{mark:o,end:u}=mt("hide-if-contains");let i=ct(e);const c=nt((e=>i.test(Ce(e).textContent)),t,n,(e=>{o(),a("success","Matched: ",e,"\nFILTER: hide-if-contains",r),u()}));c.race(Tt("hide-if-contains",(()=>{c.disconnect()})))},"hide-if-contains-similar-text":function(e,t,n=null,r=0,a=0){const o=new Jt,u=lt(arguments),i=wt("hide-if-contains-similar-text"),{mark:c,end:l}=mt("hide-if-contains-similar-text"),s=Ce(e),{length:p}=s,f=p+Lt(r)||0,h=Ce([...s]).sort(),d=Lt(a)||1/0;null==n&&(n=t),i("info","Looking for similar text: "+s);const m=()=>{c();for(const{element:e,rootParents:a}of Je(n,!0)){if(o.has(e))continue;o.add(e);const{innerText:n}=Ce(e),c=Kt(d,n.length-f+1);for(let o=0;o<c;o++){const c=Ce(n).substr(o,f);if(qt(h,Ce([...c]).sort())-r<=0){const n=_e(Ce(e),t,a);if(i("success","Found similar text: "+s,n,"\nFILTER: hide-if-contains-similar-text",u),n){g(),et(n);break}}}}l()};let y=new Qt(m),g=Tt("hide-if-contains-similar-text",(()=>y.disconnect()));y.observe(document,{childList:!0,characterData:!0,subtree:!0}),m()},"hide-if-contains-visible-text":function(e,t,n=null,...r){const{mark:a,end:o}=mt("hide-if-contains-visible-text"),u=lt(arguments);let i=Ce([]);const c=new _t([["-snippet-box-margin","2"],["-disable-bg-color-check","false"],["-check-is-contained","false"],["-pseudo-box-margin","2"],["-ignore-padding","false"]]);for(let e of r){e=Ce(e);let t=e.indexOf(":");if(t<0)continue;let n=e.slice(0,t).trim().toString(),r=e.slice(t+1).trim().toString();n&&r&&(c.has(n)?c.set(n,r):i.push([n,r]))}let l=Ce([["opacity","0"],["font-size","0px"],["color","rgba(0, 0, 0, 0)"]]),s=new _t(l.concat(i));function p(e,t,{bgColorCheck:n=!0,pseudoElemCheck:r=!1}={}){t||(t=Vt(e)),t=Ce(t);for(const[e,n]of s){if(ct(n).test(t.getPropertyValue(e)))return!1}const a=t.getPropertyValue("color");if(n&&t.getPropertyValue("background-color")===a)return!1;if(!r){const t=Vt(e,"::first-line");if(t)return p(e,t,{bgColorCheck:n,pseudoElemCheck:!0})}const o=t.getPropertyValue("text-shadow");return!a.includes("rgba(0, 0, 0, 0)")||"none"!==o&&!o.includes("rgba(0, 0, 0, 0)")}function f(e,t=null){let n=Vt(e,t).transform;return"none"===n&&(n="matrix(1, 0, 0, 1, 0, 0)"),new $t(n)}function h(e,t,n,{bgColorCheck:r=!0,translateThresh:a=2}={}){let o=Vt(e,t);if(!rt(e,o)||!p(e,o,{bgColorCheck:r}))return"";let{content:u}=Ce(o);if(u&&"none"!==u){let r=Ce([]);const o=f(e,t),i=n.multiply(o),c=zt.atan2(i.b,i.a)*(180/zt.PI);if(zt.abs(c)>5)return"";return zt.abs(i.e)>a||zt.abs(i.f)>a?"":(u=Ce(u).trim().replace(/(["'])(?:(?=(\\?))\2.)*?\1/g,(e=>""+(r.push(Ce(e).slice(1,-1))-1))),u=u.replace(/\s*attr\(\s*([^\s,)]+)[^)]*?\)\s*/g,((t,n)=>Ce(e).getAttribute(n)||"")),u.replace(/\x01(\d+)/g,((e,t)=>r[t])))}return""}function d(e,t,{boxMargin:n=2,ignorePadding:r=!1}={}){let a=Ce(e).getBoundingClientRect();if(r){const t=Vt(e),n=Zt(t.paddingTop)||0,r=Zt(t.paddingRight)||0,o=Zt(t.paddingBottom)||0,u=Zt(t.paddingLeft)||0;a={left:a.left+u,right:a.right-r,top:a.top+n,bottom:a.bottom-o}}const o=Ce(t).getBoundingClientRect(),u=o.left-n,i=o.right+n,c=o.top-n,l=o.bottom+n;return u<=a.left&&a.left<=i&&c<=a.top&&a.top<=l&&c<=a.bottom&&a.bottom<=l&&u<=a.right&&a.right<=i}function m(e,t,n,r,a,o,u,{boxMargin:i=2,bgColorCheck:c,checkIsContained:l,translateThresh:s}={}){let y=!n;if(y&&(n=Vt(e)),!rt(e,n,y&&t,o))return"";r||"hidden"!==Ce(n).getPropertyValue("overflow-x")&&"hidden"!==Ce(n).getPropertyValue("overflow-y")||(r=e);let g=h(e,":before",u=u?u.multiply(f(e)):f(e),{bgColorCheck:c,translateThresh:s});for(let t of function(e,t=!0){const n=Qe(e,t);return n?n.childNodes:Ce(e).childNodes}(Ce(e)))switch(Ce(t).nodeType){case en:g+=m(t,e,Vt(t),r,a,o,u,{boxMargin:i,bgColorCheck:c,checkIsContained:l,translateThresh:s});break;case tn:if(r)d(e,r,{boxMargin:i,ignorePadding:A})&&p(e,n,{bgColorCheck:c})&&(g+=Ce(t).nodeValue);else if(p(e,n,{bgColorCheck:c})){if(l&&!d(e,a,{boxMargin:i,ignorePadding:A}))continue;g+=Ce(t).nodeValue}}return g+=h(e,":after",u,{bgColorCheck:c,translateThresh:s}),g}const y=c.get("-snippet-box-margin"),g=Zt(y)||0,v=!("true"===c.get("-disable-bg-color-check")),w="true"===c.get("-check-is-contained"),A="true"===c.get("-ignore-padding"),x=c.get("-pseudo-box-margin"),b=Zt(x)||0;let B=ct(e),E=new Wt;const N=nt(((e,t,n)=>{if(a(),E.has(e))return!1;E.add(e);let r=m(e,t,null,null,e,n,null,{boxMargin:g,bgColorCheck:v,checkIsContained:w,translateThresh:b}),i=B.test(r);return Oe()&&r.length&&(i?vt("success",i,B,r,"\nFILTER: hide-if-contains-visible-text",u):vt("info",i,B,r)),o(),i}),t,n);N.race(Tt("hide-if-contains-visible-text",(()=>{N.disconnect()})))},"hide-if-contains-and-matches-style":function(e,t="*",n=null,r=null,a=null,o,u=null,i=null){const c=lt(arguments),l=wt("hide-if-contains-and-matches-style"),{mark:s,end:p}=mt("hide-if-contains-and-matches-style"),f=new St,h=Oe()&&new St;null==n&&(n=t);const d=ct(e),m=r?ct(r):null,y=a?ct(a):null;Ft(l,(()=>{const e=()=>{if(s(),!(u&&window.innerWidth<u||i&&window.innerWidth>i)){for(const{element:e,rootParents:r}of Je(n,!0))if(!f.has(e)&&d.test(Ce(e).textContent))if(!y||y.test(at(e))){const n=_e(Ce(e),t,r);if(!n)continue;if(!m||m.test(at(n)))a(),et(n),f.add(e),l("success","Matched: ",n,"which contains: ",e,"\nFILTER: hide-if-contains-and-matches-style",c);else{if(!h||h.has(n))continue;l("info","In this element the searchStyle matched but style didn't:\n",n,Gt(n),c),h.add(n)}}else{if(!h||h.has(e))continue;l("info","In this element the searchStyle didn't match:\n",e,Gt(e),c),h.add(e)}p()}},r=new Ot(e),a=Tt("hide-if-contains-and-matches-style",(()=>r.disconnect()));r.observe(document,{childList:!0,characterData:!0,subtree:!0}),e()}),o)},"hide-if-has-and-matches-style":function(e,t="*",n=null,r=null,a=null,o=null,u=null,i=null){const c=lt(arguments),l=wt("hide-if-has-and-matches-style"),{mark:s,end:p}=mt("hide-if-has-and-matches-style"),f=new rn,h=Oe()&&new rn;null==n&&(n=t);const d=r?ct(r):null,m=a?ct(a):null;Ft(l,(()=>{const r=()=>{if(s(),!(u&&window.innerWidth<u||i&&window.innerWidth>i)){for(const{element:r,rootParents:a}of Je(n,!0))if(!f.has(r))if(!Ce(r).querySelector(e)||m&&!m.test(at(r))){if(!h||h.has(r))continue;l("info","In this element the searchStyle didn't match:\n",r,an(r),...arguments),h.add(r)}else{const e=_e(Ce(r),t,a);if(!e||d&&!d.test(at(e))){if(!h||h.has(e))continue;l("info","In this element the searchStyle matchedbut style didn't:\n",e,an(e),...arguments),h.add(e)}else o(),et(e),f.add(r),l("success","Matched: ",e,"which contains: ",r,"\nFILTER: hide-if-has-and-matches-style",c)}p()}},a=new nn(r),o=Tt("hide-if-has-and-matches-style",(()=>a.disconnect()));a.observe(document,{childList:!0,subtree:!0}),r()}),o)},"hide-if-labelled-by":function(e,t,n=null){const{mark:r,end:a}=mt("hide-if-labelled-by");let o=null==n,u=ct(e),i=new cn,c=()=>{r();for(const{element:e,rootParents:r}of Je(t,!0)){let t=o?e:_e(Ce(e),n,r);if(!t||!rt(e,on(e),t))continue;let a=Ce(e).getAttribute("aria-labelledby"),c=()=>{i.has(t)||u.test(Ce(e).getAttribute("aria-label")||"")&&(s(),i.add(t),et(t))};if(a)for(let e of Ce(a).split(/\s+/)){let n=Ce(document).getElementById(e);n?!i.has(n)&&u.test(n.innerText)&&(s(),i.add(n),et(t)):c()}else c()}a()},l=new un(c),s=Tt("hide-if-labelled-by",(()=>l.disconnect()));l.observe(document,{characterData:!0,childList:!0,subtree:!0}),c()},"hide-if-contains-image":function(e,t,n){null==n&&(n=t);let r=ct(e);const a=lt(arguments),o=wt("hide-if-contains-image"),{mark:u,end:i}=mt("hide-if-contains-image");let c=()=>{u();for(const{element:e,rootParents:u}of Je(n,!0)){let n=kt(e),i=Ce(n["background-image"]).match(/^url\("(.*)"\)$/);i&&Xt(i[1]).then((n=>{if(r.test(new Pt(n).reduce(((e,t)=>e+function(e,t=2){let n=Ce(e).toString(16);n.length<t&&(n=Ce("0").repeat(t-n.length)+n);return n}(t)),""))){let n=_e(Ce(e),t,u);n&&(s(),et(n),o("success","Matched: ",n,"\nFILTER: hide-if-contains-image",a))}}))}i()},l=new Ht(c),s=Tt("hide-if-contains-image",(()=>l.disconnect()));l.observe(document,{childList:!0,subtree:!0}),c()},"simulate-mouse-event":function(...e){const t=lt(arguments),n=wt("simulate-mouse-event"),{mark:r,end:a}=mt("simulate-mouse-event");if(e.length<1)throw new gn("[simulate-mouse-event snippet]: No selector provided.");e.length>7&&(e=e.slice(0,7));const o=Ce([]);function u(){return o.forEach((e=>{if(!e.found){(function(e){let t=e;if(t.startsWith("xpath(")&&t.endsWith(")")){let t=tt(e);return()=>{let e=Ce([]);return t((t=>e.push(t))),e}}return()=>Ue.from(Je(e))})(e.selector)().length>0&&(e.found=!0)}})),o.every((e=>e.found))}function i(e,r,a){e&&r&&("click"===r&&e.click?(e.click(),n("success","Clicked on this node:\n",e,"\nwith a delay of",a,"ms",`n\nFILTER: simulate-mouse-event ${t}`)):(e.dispatchEvent(new vn(r,{bubbles:!0,cancelable:!0})),n("success","A",r,"event was dispatched with a delay of",a,"ms on this node:\n",e,`n\nFILTER: simulate-mouse-event ${t}`)))}Ce(e).forEach((e=>{const t=function(e){if(!e)return null;const t={selector:"",continue:!1,trigger:!1,event:"click",delay:"500",clicked:!1,found:!1},r=e.split("$");let a=[];r.length>=2&&(a=r[1].toLowerCase().split(",")),[t.selector]=r;for(const e of a)if("trigger"===e)t.trigger=!0;else if("continue"===e)t.continue=!0;else if(e.startsWith("event")){const n=e.toLowerCase().split("=");n[1]?t.event=n[1]:t.event="click"}else if(e.startsWith("delay")){const n=e.toLowerCase().split("=");n[1]?t.delay=n[1]:t.delay="500"}return xn.includes(t.event)||n("warn",t.event," might be misspelled, check for typos.\n","These are the supported events:",xn),t}(e);o.push(t)}));let c=!1;const[l]=o.slice(-1);l.trigger=!0;let s=new An;function p(){if(r(),c||(c=u()),c)for(const e of o){const t=tt(e.selector),n=mn(e.delay,10);e.trigger&&t((t=>{s.has(t)||(s.add(t),e.continue?setInterval((()=>{o.forEach((e=>{e.found=!1,e.clicked=!1}));u()&&i(t,e.event,e.delay)}),n):yn((()=>{i(t,e.event,e.delay)}),n))}))}a()}new wn(p).observe(document,{childList:!0,subtree:!0}),p()},"skip-video":function(e,t,...n){const r=lt(arguments),a=new Map([["-max-attempts","10"],["-retry-ms","10"],["-run-once","false"],["-wait-until",""],["-skip-to","-0.1"],["-stop-on-video-end","false"],["-start-from","0"],["-mute-video-when-skipping","true"]]);for(let e of n){e=Ce(e);let t=e.indexOf(":");if(t<0)continue;let n=e.slice(0,t).trim().toString(),r=e.slice(t+1).trim().toString();n&&r&&a.has(n)&&a.set(n,r)}const o=a.get("-max-attempts"),u=En(o||10,10),i=a.get("-retry-ms"),c=En(i||10,10),l="true"===a.get("-run-once"),s=a.get("-skip-to"),p=Nn(s||-.1),f=a.get("-start-from"),h=En(f||0,10),d=a.get("-wait-until"),m="true"===a.get("-stop-on-video-end"),y=!("false"===a.get("-mute-video-when-skipping")),g=wt("skip-video"),{mark:v,end:w}=mt("skip-video"),A=tt(`xpath(${t})`);let x=!1;Ft(g,(()=>{v();const n=new WeakSet,a=(s=0)=>{x&&l?o&&o.disconnect():A((o=>{let l,f=n.has(o);f||(g("info","Matched:",o," for selector: ",t),g("info","Running video skipping logic."));const d=Je(e);let v=!1;for(const e of d){if(!e||bn(e.duration)||bn(e.currentTime))continue;v=!0;const t=e.duration-e.currentTime<.5;!(e.duration>0&&e.currentTime<e.duration)||m&&t||(y&&(e.muted=!0,f||g("success","Muted video...")),h<=1e3*e.currentTime&&(p<=0?e.currentTime=e.duration+p:e.currentTime+=p,l!==e.duration&&(g("success","Skipped video, currentTime: ",e.currentTime,"s.","\nFILTER: skip-video",r),n.add(o),l=e.duration),e.paused&&e.play(),x=!0,i()))}!v&&s<u&&Tn((()=>{const e=s+1;g("info","Running video skipping logic. Attempt: ",e),a(e)}),c)}))},o=new Bn(a),i=Tt("skip-video",(()=>o.disconnect()));o.observe(document,{characterData:!0,childList:!0,subtree:!0}),a(),w()}),d)}};let{MutationObserver:Cn}=Ce(window);const{ELEMENT_NODE:Fn}=Node;In["hide-if-matches-xpath3"]=function(e,t){let{mark:n,end:r}=mt("hide-if-matches-xpath3");const a=e=>""===e&&"http://www.w3.org/1999/xhtml";function o(e){return fontoxpath.evaluateXPathToNodes(e,document,null,null,{language:fontoxpath.evaluateXPath.XQUERY_3_1_LANGUAGE,namespaceResolver:a})}const u=lt(arguments);let i=wt("hide-if-matches-xpath3");const c=t=>{const a=new WeakSet,c=()=>{n();const t=o(e);for(const e of Ce(t)){if(a.has(e))return!1;a.add(e),s(),Ce(e).nodeType===Fn?et(e):Ce(e).textContent="",i("success","Matched: ",e,"\nFILTER: hide-if-matches-xpath3",u)}r()},l=new Cn(c),s=Tt("hide-if-matches-xpath3",(()=>l.disconnect()));l.observe(t,{characterData:!0,childList:!0,subtree:!0}),c()};if(t){let e,n=0;const r=o(t),a=()=>{for(const e of Ce(r))c(e),n++;n>0&&e.disconnect()};e=new Cn(a),e.observe(document,{characterData:!0,childList:!0,subtree:!0}),a()}else c(document)};
const snippets=In;
let context;
for (const [name, ...args] of filters) {
if (snippets.hasOwnProperty(name)) {
try { context = snippets[name].apply(context, args); }
catch (error) { console.error(error); }
}
}
context = void 0;
};
const graph = new Map([["log",null],["race",null],["debug",null],["profile",null],["hide-if-matches-xpath",null],["hide-if-matches-computed-xpath",null],["hide-if-contains",null],["hide-if-contains-similar-text",null],["hide-if-contains-visible-text",null],["hide-if-contains-and-matches-style",null],["hide-if-has-and-matches-style",null],["hide-if-labelled-by",null],["hide-if-contains-image",null],["simulate-mouse-event",null],["skip-video",null],["hide-if-matches-xpath3",function(){var e,t,n,r,a,o;e=this,function(e){function t(e,t,n,r){const a={op:t,func:n,data:r};return e.push(a),a}function n(e,t){return e}class r{constructor(){this.program=[]}test(e,n){return t(this.program,5,e,void 0===n?null:n)}jump(e){return t(this.program,3,null,e)}record(e,r){return t(this.program,4,void 0===r?n:r,e)}bad(e=1){return t(this.program,1,null,e)}accept(){return t(this.program,0,null,null)}fail(e){return t(this.program,2,e||null,null)}}class a{constructor(e,t,n){this.programLength=e,this.maxFromByPc=t,this.maxSurvivorFromByPc=n}static fromProgram(e){const t=e.length,n=[],r=[];return e.forEach((e=>{n.push(0),r.push(0)})),e.forEach(((e,a)=>{switch(e.op){case 2:if(null===e.func)return;if(a+1>=t)throw new Error("Invalid program: program could run past end");n[a+1]+=1;break;case 1:case 4:if(a+1>=t)throw new Error("Invalid program: program could run past end");n[a+1]+=1;break;case 3:e.data.forEach((e=>{if(e<0||e>=t)throw new Error("Invalid program: program could run past end");n[e]+=1}));break;case 5:if(a+1>=t)throw new Error("Invalid program: program could run past end");r[a+1]+=1;break;case 0:r[a]+=1}})),new a(t,n,r)}static createStub(e){const t=[],n=[];for(let r=0;r<e;++r)t.push(e),n.push(e);return new a(e,t,n)}}class o{constructor(e){this.acceptingTraces=e,this.success=e.length>0}}const u=255;class i{constructor(e){this.t=0,this.i=0,this.h=new Uint16Array(e),this.l=new Uint8Array(e)}getBadness(e){return this.l[e]}add(e,t){this.l[e]=t>u?u:t;const n=function(e,t,n,r,a){let o=r,u=a;for(;o<u;){const r=o+u>>>1;n<t[e[r]]?u=r:o=r+1}return o}(this.h,this.l,t,this.i,this.t);this.h.copyWithin(n+1,n,this.t),this.h[n]=e,this.t+=1}reschedule(e,t){const n=Math.max(this.l[e],t>u?u:t);if(this.l[e]!==n){const t=this.h.indexOf(e,this.i);if(t<0||t>=this.t)return void(this.l[e]=n);this.h.copyWithin(t,t+1,this.t),this.t-=1,this.add(e,n)}}getNextPc(){return this.i>=this.t?null:this.h[this.i++]}reset(){this.t=0,this.i=0,this.l.fill(0)}}class c{constructor(e){this.o=[];let t=e.length;e.forEach((e=>{this.o.push(e>0?t:-1),t+=e})),this.u=new Uint16Array(t)}clear(){this.u.fill(0,0,this.o.length)}add(e,t){const n=this.u[t],r=this.o[t];this.u[t]+=1,this.u[r+n]=e}has(e){return this.u[e]>0}forEach(e,t){const n=this.u[e],r=this.o[e];for(let e=r;e<r+n;++e)t(this.u[e])}}function l(e,t,n=!1){return null===e?t:Array.isArray(e)?(-1===e.indexOf(t)&&(n&&(e=e.slice()),e.push(t)),e):e===t?e:[e,t]}class s{constructor(e,t){this.prefixes=e,this.record=t}}function p(e,t){let n;if(null===t){if(!Array.isArray(e))return e;n=e}else n=e===s.EMPTY?[]:Array.isArray(e)?e:[e];return new s(n,t)}s.EMPTY=new s([],null);class f{constructor(e){this.p=[],this.v=[];for(let t=0;t<e;++t)this.p.push(0),this.v.push(null)}mergeTraces(e,t,n,r,a,o){let u=!1;return n.forEach(t,(t=>{const n=this.trace(t,r,a,o);var i,c,s;c=n,s=u,e=null===(i=e)?c:null===c?i:Array.isArray(c)?c.reduce(((e,t)=>l(e,t,e===c)),i):l(i,c,s),u=e===n})),e}trace(e,t,n,r){switch(this.p[e]){case 2:return this.v[e];case 1:return null}this.p[e]=1;let a=null;const o=t[e];if(null!==o)a=o;else if(!n.has(e))throw new Error(`Trace without source at pc ${e}`);if(a=this.mergeTraces(a,e,n,t,n,r),null!==a){const t=r[e];null!==t&&(a=p(a,t))}return this.v[e]=a,this.p[e]=2,a}buildSurvivorTraces(e,t,n,r,a){for(let o=0,u=e.length;o<u;++o){if(!n.has(o)){t[o]=null;continue}this.v.fill(null),this.p.fill(0);const u=this.mergeTraces(null,o,n,e,r,a);if(null===u)throw new Error(`No non-cyclic paths found to survivor ${o}`);t[o]=p(u,null)}this.v.fill(null)}}class h{constructor(e){this.g=[],this.k=[],this.m=[],this.A=new c(e.maxFromByPc),this.T=new c(e.maxSurvivorFromByPc),this.S=new f(e.programLength);for(let t=0;t<e.programLength;++t)this.g.push(null),this.k.push(null),this.m.push(null);this.k[0]=s.EMPTY}reset(e){this.A.clear(),this.T.clear(),this.g.fill(null),e&&(this.k.fill(null),this.m.fill(null),this.k[0]=s.EMPTY)}record(e,t){this.g[e]=t}has(e){return this.A.has(e)||null!==this.k[e]}add(e,t){this.A.add(e,t)}hasSurvivor(e){return this.T.has(e)}addSurvivor(e,t){this.T.add(e,t)}buildSurvivorTraces(){const e=this.k;this.S.buildSurvivorTraces(e,this.m,this.T,this.A,this.g),this.k=this.m,this.m=e}getTraces(e){const t=e.reduce(((e,t)=>l(e,this.k[t])),null);return null===t?[]:Array.isArray(t)?t:[t]}}class d{constructor(e){this.I=[],this.M=new i(e.programLength),this.N=new i(e.programLength),this.j=new h(e)}reset(){this.M.reset(),this.M.add(0,0),this.I.length=0,this.j.reset(!0)}getNextThreadPc(){return this.M.getNextPc()}step(e,t,n){const r=this.j.has(t);this.j.add(e,t);const a=this.M.getBadness(e)+n;r?this.M.reschedule(t,a):this.M.add(t,a)}stepToNextGeneration(e,t){const n=this.j.hasSurvivor(t);this.j.addSurvivor(e,t);const r=this.M.getBadness(e);n?this.N.reschedule(t,r):this.N.add(t,r)}accept(e){this.I.push(e),this.j.addSurvivor(e,e)}fail(e){}record(e,t){this.j.record(e,t)}nextGeneration(){this.j.buildSurvivorTraces(),this.j.reset(!1);const e=this.M;e.reset(),this.M=this.N,this.N=e}getAcceptingTraces(){return this.j.getTraces(this.I)}}class m{constructor(e){this.P=[],this.U=e,this.G=a.fromProgram(e),this.P.push(new d(this.G))}execute(e,t){const n=this.P.pop()||new d(this.G);n.reset();const r=e.length;let a,u=-1;do{let o=n.getNextThreadPc();if(null===o)break;for(++u,a=u>=r?null:e[u];null!==o;){const e=this.U[o];switch(e.op){case 0:null===a?n.accept(o):n.fail(o);break;case 2:{const r=e.func;if(null===r||r(t)){n.fail(o);break}n.step(o,o+1,0);break}case 1:n.step(o,o+1,e.data);break;case 5:if(null===a){n.fail(o);break}if(!(0,e.func)(a,e.data,t)){n.fail(o);break}n.stepToNextGeneration(o,o+1);break;case 3:{const t=e.data,r=t.length;if(0===r){n.fail(o);break}for(let e=0;e<r;++e)n.step(o,t[e],0);break}case 4:{const r=(0,e.func)(e.data,u,t);null!=r&&n.record(o,r),n.step(o,o+1,0);break}}o=n.getNextThreadPc()}n.nextGeneration()}while(null!==a);const i=new o(n.getAcceptingTraces());return n.reset(),this.P.push(n),i}}function y(e){const t=new r;return e(t),new m(t.program)}var g={Assembler:r,VM:m,compileVM:y};e.Assembler=r,e.VM=m,e.compileVM=y,e.default=g,Object.defineProperty(e,"V",{value:!0})}((e="undefined"!=typeof globalThis?globalThis:e||self).whynot={}),t=this,function(e){function t(e,t){return{success:!0,offset:e,value:t}}function n(e){return t(e,void 0)}function r(e,t,n=!1){return{success:!1,offset:e,expected:t,fatal:n}}function a(e){return e>65535?2:1}function o(e,t){return(o,u)=>{const i=o.codePointAt(u);return void 0!==i&&e(i)?n(u+a(i)):r(u,t)}}function u(e,n){return(r,a)=>{const o=e(r,a);return o.success?t(o.offset,n(o.value)):o}}function i(e){return(n,r)=>{let a=[],o=r;for(;;){const t=e(n,o);if(!t.success){if(t.fatal)return t;break}if(a.push(t.value),t.offset===o)break;o=t.offset}return t(o,a)}}function c(e){return(t,r)=>{let a=r;for(;;){const n=e(t,a);if(!n.success){if(n.fatal)return n;break}if(n.offset===a)break;a=n.offset}return n(a)}}function l(e,n,r){return(a,o)=>{const u=e(a,o);if(!u.success)return u;const i=n(a,u.offset);return i.success?t(i.offset,r(u.value,i.value)):i}}function s(e,t){return e}function p(e,t){return t}function f(e,t){return l(e,t,p)}function h(e,t){return l(e,t,s)}function d(e,t){return(a,o)=>e(a,o).success?r(o,t):n(o)}function m(e){return(t,n)=>{const a=e(t,n);return a.success?a:r(a.offset,a.expected,!0)}}const y=(e,t)=>e.length===t?n(t):r(t,["end of input"]);function g(e){const t=[];let n=e.next();for(;!n.done;)t.push(n.value),n=e.next();return[t,n.value]}e.codepoint=o,e.codepoints=function(e,t){return(a,o)=>{const u=o;for(;;){const t=a.codePointAt(o);if(void 0===t)break;if(!e(t))break;o+=t>65535?2:1}return void 0!==t&&o===u?r(o,t):n(o)}},e.collect=g,e.complete=function(e){return l(e,y,s)},e.consume=function(e){return u(e,(()=>{}))},e.cut=m,e.delimited=function(e,t,n,r=!1){return f(e,r?m(h(t,n)):h(t,n))},e.dispatch=function(e,t,n=0,a=[]){return(o,u)=>{const i=o.codePointAt(u+n);if(void 0===i)return r(u,a);const c=e[i];return void 0===c?void 0===t?r(u,a):t(o,u):c(o,u)}},e.end=y,e.error=r,e.except=function(e,t,n){return f(d(t,n),e)},e.filter=function(e,t,n,a){return(o,u)=>{const i=e(o,u);return i.success?t(i.value)?i:r(u,n,a):i}},e.filterUndefined=function(e){return u(e,(e=>e.filter((e=>void 0!==e))))},e.first=s,e.followed=h,e.map=u,e.not=d,e.ok=n,e.okWithValue=t,e.optional=function(e){return(n,r)=>{const a=e(n,r);return a.success||a.fatal?a:t(r,null)}},e.or=function(e,t){return(n,a)=>{let o=null;for(const r of e){const e=r(n,a);if(e.success)return e;if(null===o||e.offset>o.offset?o=e:e.offset===o.offset&&void 0===t&&(o.expected=o.expected.concat(e.expected)),e.fatal)return e}return t=t||(null==o?void 0:o.expected)||[],o&&(o.expected=t),o||r(a,t)}},e.peek=function(e){return(n,r)=>{const a=e(n,r);return a.success?t(r,a.value):a}},e.plus=function(e){return l(e,i(e),((e,t)=>[e].concat(t)))},e.plusConsumed=function(e){return l(e,c(e),p)},e.preceded=f,e.range=function(e,t,n){return o((n=>e<=n&&n<=t),n||[`${String.fromCodePoint(e)}-${String.fromCodePoint(t)}`])},e.recognize=function(e){return(n,r)=>{const a=e(n,r);return a.success?t(a.offset,n.slice(r,a.offset)):a}},e.second=p,e.sequence=function(...e){return(n,r)=>{const a=[];for(const t of e){const e=t(n,r);if(!e.success)return e;r=e.offset,a.push(e.value)}return t(r,a)}},e.sequenceConsumed=function(...e){return(t,r)=>{for(const n of e){const e=n(t,r);if(!e.success)return e;r=e.offset}return n(r)}},e.skipChars=function(e){return(t,o)=>{let u=e;for(;u>0;){const e=t.codePointAt(o);if(void 0===e)return r(o,["any character"]);o+=a(e),u-=1}return n(o)}},e.star=i,e.starConsumed=c,e.start=(e,t)=>0===t?n(t):r(t,["start of input"]),e.streaming=function(e){return function*(t,n){const r=e(t,n);return r.success&&(yield r.value),r}},e.streamingComplete=function(e){return function*(t,n){const r=yield*e(t,n);return r.success?y(t,r.offset):r}},e.streamingFilterUndefined=function(e){return function*(t,n){const r=e(t,n);let a=r.next();for(;!a.done;){const e=a.value;void 0!==e&&(yield e),a=r.next()}return a.value}},e.streamingOptional=function(e){return function*(t,r){const[a,o]=g(e(t,r));return o.success?(yield*a,o):o.fatal?o:n(r)}},e.streamingStar=function(e){return function*(t,r){for(;;){const[a,o]=g(e(t,r));if(!o.success)return o.fatal?o:n(r);if(yield*a,r===o.offset)return n(r);r=o.offset}}},e.streamingThen=function(e,t){return function*(n,r){const a=yield*e(n,r);return a.success?yield*t(n,a.offset):a}},e.then=l,e.token=function(e){return(n,a)=>{const o=a+e.length;return n.slice(a,o)===e?t(o,e):r(a,[e])}},Object.defineProperty(e,"__esModule",{value:!0})}((t="undefined"!=typeof globalThis?globalThis:t||self).prsc={}),n=this,function(e,t){function n(e){return t=>t===e}function r(e,t){if(null===e||null===t)throw new Error("unescaped hyphen may not be used as a range endpoint");if(t<e)throw new Error("character range is in the wrong order");return n=>e<=n&&n<=t}function a(e){return!0}function o(){return!1}function u(e,t){return n=>e(n)||t(n)}const i=-1,c=-2;function l(e,t){switch(t.kind){case"predicate":return void e.test(t.value);case"regexp":return void p(e,t.value,!1)}}function s(e,t){t.forEach((t=>{!function(e,t){const[n,{min:r,max:a}]=t;if(null!==a){for(let t=0;t<r;++t)l(e,n);for(let t=r;t<a;++t){const t=e.jump([]);t.data.push(e.program.length),l(e,n),t.data.push(e.program.length)}}else if(r>0){for(let t=0;t<r-1;++t)l(e,n);const t=e.program.length;l(e,n),e.jump([t]).data.push(e.program.length)}else{const t=e.program.length,r=e.jump([]);r.data.push(e.program.length),l(e,n),e.jump([t]),r.data.push(e.program.length)}}(e,t)}))}function p(e,t,n){const r=e.program.length,a=e.jump([]);n&&(a.data.push(e.program.length),e.test((()=>!0)),e.jump([r]));const o=[];if(t.forEach((t=>{a.data.push(e.program.length),s(e,t),o.push(e.jump([]))})),o.forEach((t=>{t.data.push(e.program.length)})),n){const t=e.program.length,n=e.jump([]);n.data.push(e.program.length),e.test((()=>!0)),e.jump([t]),n.data.push(e.program.length)}}function f(e,t){return{success:!0,offset:e,value:t}}function h(e){return f(e,void 0)}function d(e,t,n=!1){return{success:!1,offset:e,expected:t,fatal:n}}function m(e){return(t,n)=>{const r=n+e.length;return t.slice(n,r)===e?f(r,e):d(n,[e])}}function y(e,t){return(n,r)=>{const a=e(n,r);return a.success?f(a.offset,t(a.value)):a}}function g(e,t,n,r){return(a,o)=>{const u=e(a,o);return u.success?t(u.value)?u:d(o,n,r):u}}function v(e,t){return(n,r)=>{let a=null;for(const o of e){const e=o(n,r);if(e.success)return e;if(null===a||e.offset>a.offset?a=e:e.offset===a.offset&&void 0===t&&(a.expected=a.expected.concat(e.expected)),e.fatal)return e}return t=t||(null==a?void 0:a.expected)||[],a&&(a.expected=t),a||d(r,t)}}function w(e){return(t,n)=>{const r=e(t,n);return r.success||r.fatal?r:f(n,null)}}function A(e){return(t,n)=>{let r=[],a=n;for(;;){const n=e(t,a);if(!n.success){if(n.fatal)return n;break}if(r.push(n.value),n.offset===a)break;a=n.offset}return f(a,r)}}function x(e,t,n){return(r,a)=>{const o=e(r,a);if(!o.success)return o;const u=t(r,o.offset);return u.success?f(u.offset,n(o.value,u.value)):u}}function b(e){return x(e,A(e),((e,t)=>[e].concat(t)))}function B(e,t){return e}function E(e,t){return t}function N(e,t){return x(e,t,E)}function T(e,t){return x(e,t,B)}function I(e,t,n,r=!1){return N(e,r?F(T(t,n)):T(t,n))}function C(e,t){return(n,r)=>e(n,r).success?d(r,t):h(r)}function F(e){return(t,n)=>{const r=e(t,n);return r.success?r:d(r.offset,r.expected,!0)}}const O=(e,t)=>e.length===t?h(t):d(t,["end of input"]),S=["Lu","Ll","Lt","Lm","Lo","Mn","Mc","Me","Nd","Nl","No","Pc","Pd","Ps","Pe","Pi","Pf","Po","Zs","Zl","Zp","Sm","Sc","Sk","So","Cc","Cf","Co","Cn"],G={};function D(e){return e.codePointAt(0)}"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").forEach(((e,t)=>{G[e]=t}));const R=e=>e===i||e===c;function k(e){return t=>!R(t)&&!e(t)}function U(e,t){return null===t?e:n=>e(n)&&!t(n)}const M=function(e,t){const n=new Map;let a=0;return e.forEach(((e,o)=>{const i=t[o];null!==e&&e.split("|").forEach((e=>{const t=n.get(e),o=r(a,a+i-1);n.set(e,t?u(t,o):o)})),a+=i})),n}(["BasicLatin","Latin-1Supplement","LatinExtended-A","LatinExtended-B","IPAExtensions","SpacingModifierLetters","CombiningDiacriticalMarks","GreekandCoptic|Greek","Cyrillic","CyrillicSupplement","Armenian","Hebrew","Arabic","Syriac","ArabicSupplement","Thaana","NKo","Samaritan","Mandaic","SyriacSupplement","ArabicExtended-B","ArabicExtended-A","Devanagari","Bengali","Gurmukhi","Gujarati","Oriya","Tamil","Telugu","Kannada","Malayalam","Sinhala","Thai","Lao","Tibetan","Myanmar","Georgian","HangulJamo","Ethiopic","EthiopicSupplement","Cherokee","UnifiedCanadianAboriginalSyllabics","Ogham","Runic","Tagalog","Hanunoo","Buhid","Tagbanwa","Khmer","Mongolian","UnifiedCanadianAboriginalSyllabicsExtended","Limbu","TaiLe","NewTaiLue","KhmerSymbols","Buginese","TaiTham","CombiningDiacriticalMarksExtended","Balinese","Sundanese","Batak","Lepcha","OlChiki","CyrillicExtended-C","GeorgianExtended","SundaneseSupplement","VedicExtensions","PhoneticExtensions","PhoneticExtensionsSupplement","CombiningDiacriticalMarksSupplement","LatinExtendedAdditional","GreekExtended","GeneralPunctuation","SuperscriptsandSubscripts","CurrencySymbols","CombiningDiacriticalMarksforSymbols|CombiningMarksforSymbols","LetterlikeSymbols","NumberForms","Arrows","MathematicalOperators","MiscellaneousTechnical","ControlPictures","OpticalCharacterRecognition","EnclosedAlphanumerics","BoxDrawing","BlockElements","GeometricShapes","MiscellaneousSymbols","Dingbats","MiscellaneousMathematicalSymbols-A","SupplementalArrows-A","BraillePatterns","SupplementalArrows-B","MiscellaneousMathematicalSymbols-B","SupplementalMathematicalOperators","MiscellaneousSymbolsandArrows","Glagolitic","LatinExtended-C","Coptic","GeorgianSupplement","Tifinagh","EthiopicExtended","CyrillicExtended-A","SupplementalPunctuation","CJKRadicalsSupplement","KangxiRadicals",null,"IdeographicDescriptionCharacters","CJKSymbolsandPunctuation","Hiragana","Katakana","Bopomofo","HangulCompatibilityJamo","Kanbun","BopomofoExtended","CJKStrokes","KatakanaPhoneticExtensions","EnclosedCJKLettersandMonths","CJKCompatibility","CJKUnifiedIdeographsExtensionA","YijingHexagramSymbols","CJKUnifiedIdeographs","YiSyllables","YiRadicals","Lisu","Vai","CyrillicExtended-B","Bamum","ModifierToneLetters","LatinExtended-D","SylotiNagri","CommonIndicNumberForms","Phags-pa","Saurashtra","DevanagariExtended","KayahLi","Rejang","HangulJamoExtended-A","Javanese","MyanmarExtended-B","Cham","MyanmarExtended-A","TaiViet","MeeteiMayekExtensions","EthiopicExtended-A","LatinExtended-E","CherokeeSupplement","MeeteiMayek","HangulSyllables","HangulJamoExtended-B","HighSurrogates","HighPrivateUseSurrogates","LowSurrogates","PrivateUseArea|PrivateUse","CJKCompatibilityIdeographs","AlphabeticPresentationForms","ArabicPresentationForms-A","VariationSelectors","VerticalForms","CombiningHalfMarks","CJKCompatibilityForms","SmallFormVariants","ArabicPresentationForms-B","HalfwidthandFullwidthForms","Specials","LinearBSyllabary","LinearBIdeograms","AegeanNumbers","AncientGreekNumbers","AncientSymbols","PhaistosDisc",null,"Lycian","Carian","CopticEpactNumbers","OldItalic","Gothic","OldPermic","Ugaritic","OldPersian",null,"Deseret","Shavian","Osmanya","Osage","Elbasan","CaucasianAlbanian","Vithkuqi",null,"LinearA","LatinExtended-F",null,"CypriotSyllabary","ImperialAramaic","Palmyrene","Nabataean",null,"Hatran","Phoenician","Lydian",null,"MeroiticHieroglyphs","MeroiticCursive","Kharoshthi","OldSouthArabian","OldNorthArabian",null,"Manichaean","Avestan","InscriptionalParthian","InscriptionalPahlavi","PsalterPahlavi",null,"OldTurkic",null,"OldHungarian","HanifiRohingya",null,"RumiNumeralSymbols","Yezidi","ArabicExtended-C","OldSogdian","Sogdian","OldUyghur","Chorasmian","Elymaic","Brahmi","Kaithi","SoraSompeng","Chakma","Mahajani","Sharada","SinhalaArchaicNumbers","Khojki",null,"Multani","Khudawadi","Grantha",null,"Newa","Tirhuta",null,"Siddham","Modi","MongolianSupplement","Takri",null,"Ahom",null,"Dogra",null,"WarangCiti","DivesAkuru",null,"Nandinagari","ZanabazarSquare","Soyombo","UnifiedCanadianAboriginalSyllabicsExtended-A","PauCinHau","DevanagariExtended-A",null,"Bhaiksuki","Marchen",null,"MasaramGondi","GunjalaGondi",null,"Makasar","Kawi",null,"LisuSupplement","TamilSupplement","Cuneiform","CuneiformNumbersandPunctuation","EarlyDynasticCuneiform",null,"Cypro-Minoan","EgyptianHieroglyphs","EgyptianHieroglyphFormatControls",null,"AnatolianHieroglyphs",null,"BamumSupplement","Mro","Tangsa","BassaVah","PahawhHmong",null,"Medefaidrin",null,"Miao",null,"IdeographicSymbolsandPunctuation","Tangut","TangutComponents","KhitanSmallScript","TangutSupplement",null,"KanaExtended-B","KanaSupplement","KanaExtended-A","SmallKanaExtension","Nushu",null,"Duployan","ShorthandFormatControls",null,"ZnamennyMusicalNotation",null,"ByzantineMusicalSymbols","MusicalSymbols","AncientGreekMusicalNotation",null,"KaktovikNumerals","MayanNumerals","TaiXuanJingSymbols","CountingRodNumerals",null,"MathematicalAlphanumericSymbols","SuttonSignWriting",null,"LatinExtended-G","GlagoliticSupplement","CyrillicExtended-D",null,"NyiakengPuachueHmong",null,"Toto","Wancho",null,"NagMundari",null,"EthiopicExtended-B","MendeKikakui",null,"Adlam",null,"IndicSiyaqNumbers",null,"OttomanSiyaqNumbers",null,"ArabicMathematicalAlphabeticSymbols",null,"MahjongTiles","DominoTiles","PlayingCards","EnclosedAlphanumericSupplement","EnclosedIdeographicSupplement","MiscellaneousSymbolsandPictographs","Emoticons","OrnamentalDingbats","TransportandMapSymbols","AlchemicalSymbols","GeometricShapesExtended","SupplementalArrows-C","SupplementalSymbolsandPictographs","ChessSymbols","SymbolsandPictographsExtended-A","SymbolsforLegacyComputing",null,"CJKUnifiedIdeographsExtensionB",null,"CJKUnifiedIdeographsExtensionC","CJKUnifiedIdeographsExtensionD","CJKUnifiedIdeographsExtensionE","CJKUnifiedIdeographsExtensionF",null,"CJKCompatibilityIdeographsSupplement",null,"CJKUnifiedIdeographsExtensionG","CJKUnifiedIdeographsExtensionH",null,"Tags",null,"VariationSelectorsSupplement",null,"SupplementaryPrivateUseArea-A|PrivateUse","SupplementaryPrivateUseArea-B|PrivateUse"],[128,128,128,208,96,80,112,144,256,48,96,112,256,80,48,64,64,64,32,16,48,96,128,128,128,128,128,128,128,128,128,128,128,128,256,160,96,256,384,32,96,640,32,96,32,32,32,32,128,176,80,80,48,96,32,32,144,80,128,64,64,80,48,16,48,16,48,128,64,64,256,256,112,48,48,48,80,64,112,256,256,64,32,160,128,32,96,256,192,48,16,256,128,128,256,256,96,32,128,48,80,96,32,128,128,224,16,16,64,96,96,48,96,16,32,48,16,256,256,6592,64,20992,1168,64,48,320,96,96,32,224,48,16,64,96,32,48,48,32,96,32,96,32,96,32,48,64,80,64,11184,80,896,128,1024,6400,512,80,688,16,16,16,32,32,144,240,16,128,128,64,80,64,48,128,32,64,32,48,32,48,32,64,32,80,48,48,80,48,64,80,64,384,64,64,64,32,32,48,48,32,32,32,64,32,96,96,32,32,32,64,64,32,32,48,80,80,48,128,64,288,32,64,64,48,64,64,48,32,128,80,48,80,48,96,32,80,48,48,80,128,128,128,96,160,128,96,32,80,48,80,176,80,80,96,96,64,96,80,96,16,64,96,160,112,80,64,96,80,304,32,96,80,16,64,1024,128,208,2624,112,1072,48,4e3,640,85