!function(e){function t(n){if(r[n])return r[n].exports;var s=r[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,t),s.l=!0,s.exports}var r={};t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e
;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var s in e)t.d(n,s,function(t){return e[t]}.bind(null,s));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return{}.hasOwnProperty.call(e,t)},t.p="",t(t.s=71)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{
value:!0}),t.normalizeLocale=t.I18N=void 0;const n=r(3),s=r(14),o=r(2),a=window.rea,i="en";let A={},l={},c=null;const u=[],d=(e,...t)=>{const r=[],n=e=>{for(let t=0;t<e.length;t++)Array.isArray(e[t])?n(e[t]):r.push(String(e[t]))};return n(t),a.i18n.getMessage(e,r)},g=e=>new Promise((t,r)=>{const n=`_locales/${e}/messages.json`;s.getRaw(n,n=>{try{if(n)return t(JSON.parse(n))}catch(t){o.logger.log("i18n: parsing locale "+e+" failed!")}r()})}),p=async e=>{e=e.concat(i);let t=-1,r=null
;const n=async()=>{if(t++,t<e.length){const s=e[t];if(!s||!R.includes(s))return n();try{const e=await g(s);r=s,A=e}catch(e){return n()}if(!v&&s!=i)try{const e=await g(i);l=e||{}}catch(e){}}};return await n(),r},m=e=>e?e.replace(/-/g,"_").split("_").map((e,t)=>t?e.toUpperCase():e.toLowerCase()).join("_"):e;t.normalizeLocale=m;const f=(e,t)=>{let r,s;return t=t||(c?[c,c.split("_")[0]].concat(u).filter(e=>e):u),n.each(t,(t,o)=>{const a=Number(o);if(n.each(e,(e,n)=>{
const o=Number(n),i=m(e),A=i.split(/_/)[0];if(i==t)return s=o,!1;A==t&&(void 0===r||a<r)&&(s=o,r=a)}),void 0!==s)return!1}),void 0===s?s:e[s]},h=[{name:"Arabic - ‎‫العربية‬‎",value:"ar"},{name:"Chinese (Simplified) - 中文（简体中文）",value:"zh_CN"},{name:"Chinese (Traditional) - 中文（繁體）",value:"zh_TW"},{name:"Croatian - hrvatski",value:"hr"},{name:"Czech - čeština",value:"cs"},{name:"Danish - dansk",value:"da"},{name:"English",value:"en"},{name:"French - français",value:"fr"},{name:"German - Deutsch",
value:"de"},{name:"Hindi - हिन्दी",value:"hi"},{name:"Hungarian - magyar",value:"hu"},{name:"Indonesian - Indonesia",value:"id"},{name:"Italian - italiano",value:"it"},{name:"Japanese - 日本語",value:"ja"},{name:"Korean - 한국어",value:"ko"},{name:"Norwegian - norsk",value:"nb"},{name:"Polish - polski",value:"pl"},{name:"Portuguese (Brazil) - português (Brasil)",value:"pt_BR"},{name:"Portuguese (Portugal) - português (Portugal)",value:"pt_PT"},{name:"Russian - русский",value:"ru"},{
name:"Serbian - српски",value:"sr"},{name:"Slovak - slovenčina",value:"sk"},{name:"Spanish - español",value:"es"},{name:"Turkish - Türkçe",value:"tr"},{name:"Ukrainian - українська",value:"uk"},{name:"Vietnamese - Tiếng Việt",value:"vi"}],R=h.map(e=>e.value),v=!(void 0===a)&&a.i18n.native_support,b={init:async()=>{const e=async()=>{c||v||(c=await p(u))},t=m(v?a.i18n.getUILanguage():navigator.language);if(t){const e=[t],r=t.split(/_/);r[0]!==t&&e.push(r[0]),e.forEach(e=>{u.unshift(e)})}await e(),
v&&(await new Promise(e=>{a.i18n.getAcceptLanguages(t=>{t.forEach(e=>{u.push(m(e))}),e()})}),await e())},getMessage:(e,...t)=>{let r;return c&&(r=A[e]||l[e])?((e,t)=>{let r,n=e.message;return r=1==t.length&&Array.isArray(t[0])?t[0]:t,e.placeholders&&Object.entries(e.placeholders).forEach(([e,t])=>{try{const s=Number(t.content.replace(/^\$/,""))-1;let a;s<r.length?(a=r[s],n=n.replace("$"+e+"$",a)):o.logger.log('i18n: invalid argument count on processing "'+n+'" with args '+JSON.stringify(r))
}catch(e){o.logger.log('i18n: error processing "'+n+'" with args '+JSON.stringify(r))}}),n})(r,t):(v&&(r=d(e,...t))||(r=function(e,...t){let r=e;1==t.length&&Array.isArray(t[0])&&(t=t[0]);const n=new RegExp("(^|_)0[a-zA-Z]+0(_|$)");for(let e=0;e<t.length;e++){const s=r.match(n);if(!s){o.logger.log("i18n: getMessage(): wrong argument count!!!");break}r=r.replace(n,(s[1]?" ":"")+t[e]+(s[2]?" ":""))}return r.replace(/_/g," ")}(e,...t),o.logger.warn("i18n: missing translation"+r)),r)},
getOriginalMessage:d,normalizeLocale:m,getTranslation:(e,t)=>{let r,n;if(e&&(n=e[t+"_i18n"]||{})){e[t]&&(n={...n,en:e[t]});const s=f(Object.keys(n));void 0!==s&&(r=n[s])}return r||e[t]},setLocale:async e=>{let t=e;if("null"===e&&(t=null),t&&(t=m(t)),!t&&v)c=t;else if(t!==c)return p([t,...u,c].filter(e=>e)).then(t=>{c=t,c!=e&&o.logger.log("i18n: retrieving locale "+t+" failed!")})},getLocale:()=>c,getUiLocale:()=>m(c||v?a.i18n.getUILanguage():u[0]||navigator.language||i),getBestLocale:f,
supported:h};t.I18N=b},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Deferred=void 0;const r=e=>{const t=(()=>{let e,t;const n=[],s=[],o=e=>{s.push(e),a()},a=()=>{if(void 0!==e){let r;for(;s.length;)r=s.shift(),void 0!==r.state&&r.state!==e||(t=("function"==typeof r.f?r.f.call(i,t):r.f)||t)}},i={promise:()=>i,done:e=>(o({state:!0,f:e}),i),fail:e=>(o({state:!1,f:e}),i),always:e=>(o({f:e}),i),progress:e=>(e&&n.push(e),i),then:(e,n,s)=>r(r=>{[{fn:"done",
forward:"resolve",f:e},{fn:"fail",forward:"reject",f:n},{fn:"progress",forward:"notify",f:s}].forEach(e=>{i[e.fn]((...n)=>{const s=e.f?e.f(t):void 0,o=s&&"function"==typeof s.promise?s.promise():null,a=s&&"function"==typeof s.then?s:null;if(o)o.done(r.resolve).fail(r.reject).progress(r.notify);else if(a)a.then(r.resolve,r.reject);else{const t=e.f?[s]:n;r[e.forward](t[0])}})})}).promise(),each:e=>{const t=r();return i.then(n=>{const s=Array.isArray(n)?n:[n];r.when(s.map(t=>e(t))).then(t.resolve)
}),t.promise()},iterate:e=>{const t=r();return i.then(n=>{const s=(Array.isArray(n)?n:[n]).map(t=>()=>e(t));r.onebyone(s,!0).done(e=>{t.resolve(e)}).fail(t.reject)}),t.promise()}};return{get:()=>i,try_resolve:r=>(void 0===e&&(e=!0,t=r),a(),i),try_reject:function(r){return void 0===e&&(e=!1,t=r),a(),i},do_notify:function(e){(e=>{n.forEach(t=>t(e))})(e)}}})(),n={promise:function(){return t.get()},resolve:function(e){return t.try_resolve(e)},reject:function(e){return t.try_reject(e)},
notify:function(e){return t.do_notify(e)},consume:function(e){return e.promise().done(n.resolve).fail(n.reject).progress(n.notify),n.promise()}};return e&&e(n),n};t.Deferred=r,r.Pledge=e=>{const t=r();return t.resolve(e),t.promise()},r.Breach=e=>{const t=r();return t.reject(e),t.promise()},r.onebyone=(e,t=!0)=>{const n=[],s=r();let o=0;const a=()=>{if(o<e.length){const r=(0,e[o++])();r&&r.promise?r.promise().done(e=>{n.push(e),a()}).fail(()=>{if(n.push(null),t)return s.reject();a()}):(n.push(r),
a())}else s.resolve(n)};return a(),s.promise()},r.or=e=>{let t;const n=r(),s=()=>{e.length?(t=e.shift(),t&&r.Pledge().then(t).done(n.resolve).fail(s)):n.reject()};return s(),n.promise()},r.sidebyside=e=>{e=Array.isArray(e)?e:[e];const t=r();let n=e.length;return n?e.forEach(e=>{e&&e.promise&&e.promise().always(()=>{0==--n&&t.resolve()})}):t.resolve(),t.promise()},r.when=e=>{e=Array.isArray(e)?e:[e];const t=r();let n=e.length;const s=[];return n?e.forEach(e=>{let r
;if(e&&e.promise)r=e.promise();else{if(!e.then)return void console.warn("promise: incompatible object given to when()",e);r=e}r.fail(e=>{t.reject(e),n=-1}).done(e=>{s.push(e),0==--n&&t.resolve(s)})}):t.resolve(s),t.promise()},r.sleep=e=>{const t=r();return window.setTimeout(t.resolve,e),t.promise()}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VERBOSE=t.DEBUG=t.WARN=t.ERROR=t.logger=void 0,t.ERROR=0,t.WARN=30,t.DEBUG=60,t.VERBOSE=80;let r=0;const n=[],s=()=>{
const e=["debug"],t=["log"],n=["warn","info"],s=["error"],a=[...e,...t,...n,...s],i=s;r>=80&&i.push(...e),r>=60&&i.push(...t),r>=30&&i.push(...n),a.forEach(e=>o[e]=i.includes(e)?console[e].bind(console):()=>{})},o={set:e=>{r=e,n.forEach(e=>{e(o,r)}),s()},get:()=>r,verbose:(console.debug||(()=>{})).bind(console),debug:()=>{},log:()=>{},warn:()=>{},info:()=>{},error:()=>{},addChangeListener:e=>{n.push(e)}};t.logger=o,s()},function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){
return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.staticVars=t.safeFileName=t.encodeHtml=t.decodeHtml=t.createUUID=t.getDebouncer=t.adiff=t.copy=t.insert=t.each=t.splitSlice=t.toType=t.filterString=t.cPrompt=t.cConfirm=t.cAlert=t.getSource=t.getUrlArgs=t.isLocalImage=t.escapeForRegExp=t.escapeForRegExpURL=t.getStringBetweenTags=t.createUniqueId=void 0;const s=n(r(6)),o=window.rea
;t.createUniqueId=(e,t)=>s.default.Base64.encode(e+"_"+t).replace(/[^0-9a-zA-Z_\-]/g,""),t.getStringBetweenTags=(e,t,r)=>{const n=e.indexOf(t);if(-1==n)return"";if(!r)return e.substr(n+t.length);const s=e.substr(n+t.length).indexOf(r);return-1==s?"":e.substr(n+t.length,s)};const a=(e,t)=>{null==t&&(t=[]);const r=new RegExp("(\\"+["/",".","+","?","|","(",")","[","]","{","}","\\"].concat(t).join("|\\")+")","g");return e.replace(r,"\\$1")};t.escapeForRegExpURL=a,t.escapeForRegExp=e=>a(e,["*"]),
t.isLocalImage=e=>{const t="background.js";let r=o.extension.getURL(t);return r=r.replace(t,"")+"images/",e.length>=r.length&&r==e.substr(0,r.length)},t.getUrlArgs=e=>{const t={};let r=window.location.search.replace(/^\?/,"");const n=window.location.hash.replace(/^#/,"");r?e&&n&&(r=r+"&"+n):r=n;const s=r.split("&");let o;for(let e=0;e<s.length;e++){if(o=s[e].split("="),2!=o.length){const e=o[0],t=o.slice(1).join("=");o=[e,t]}t[o[0]]=decodeURIComponent(o[1])}return t},t.cAlert=e=>{
window.setTimeout(()=>{alert(e)},1)},t.cConfirm=(e,t)=>{window.setTimeout(()=>{const r=confirm(e);t&&t(r)},1)},t.cPrompt=(e,t,r)=>{window.setTimeout(()=>{const n=prompt(e,t);r&&r(n)},1)};const i=e=>(({}.toString.apply(e).match(/\s([a-z|A-Z]+)/)||[])[1]);t.toType=i;const A=(e,t)=>{const r=i(e);if("Array"===r||"NodeList"===r){for(let r=0;r<e.length;r++)if(!1===t(e[r],r))return}else if("XPathResult"===r){let r=e.iterateNext(),n=0;for(;r;){if(!1===t(r,n++))return;r=e.iterateNext()}
}else for(const r in e)if(e.hasOwnProperty(r)&&!1===t(e[r],r))return};t.each=A,t.insert=(e,t,r,n)=>e.slice(0,t)+n+e.slice(t+Math.abs(r));const l=(e,t,r,n)=>{let s;if(Array.isArray(r)){const e={};r.forEach(t=>{e[t]=!0}),s=e}else s=r;return A(s||e,(r,o)=>{if(!s||s.hasOwnProperty(o)){let r;const a=e[o],A=i(a);if("Undefined"==A)return;if(s&&n&&(r=i(s[o]))&&r!==A&&("Array"===r||"Object"===r))return;"Object"==A?(t[o]={},l(a,t[o],s?s[o]:null)):"Array"==A?(t[o]=[],l(a,t[o])):t[o]=a}}),t};t.copy=l,
t.decodeHtml=e=>e.replace(/(?:&#x([a-fA-F0-9]+);|&#([0-9]+);)/g,(e,t,r)=>t?String.fromCharCode(parseInt(t,16)):String.fromCharCode(parseInt(r,10))),t.encodeHtml=e=>e.replace(/[\u00A0-\u2666<>]/g,e=>"&#"+e.charCodeAt(0)+";");const c=e=>document.body?document.body.innerText:e.childNodes.length>0?c(e.childNodes[e.childNodes.length-1]):e.innerText;t.getSource=c,t.getDebouncer=e=>(()=>{let t={};const r=e||1e3,n={clear:()=>{A(t,e=>window.clearTimeout(e)),t={}},is:(e,r)=>{const s=void 0!==t[e]
;return r&&n.add(e),s},add:(e,s)=>{n.is(e)&&window.clearTimeout(t[e]),t[e]=window.setTimeout(()=>{delete t[e]},s||r)}};return n})(),t.filterString=(e,t)=>e&&t?(e.match(t)||[]).join(""):"",t.adiff=(e,t,r)=>{const n=[];return"both"==(r=r||"both")?e.concat(t).forEach(r=>{e.includes(r)&&t.includes(r)||n.push(r)}):"notinfirst"==r&&t.forEach(t=>{e.includes(t)||n.push(t)}),n},t.safeFileName=(e,t,r)=>{void 0===r&&(r="-")
;const n=t?/[:<>|~?*\x00-\x1F\uFDD0-\uFDEF"]/g:/[:<>|~?*\x00-\x1F\uFDD0-\uFDEF"\/\\]|^[.]|[.]$/g;return!t&&/^((CON|PRN|AUX|NUL|CLOCK\$|COM[1-9]|LPT[1-9])(\..*)?|device(\..*)?|desktop.ini|thumbs.db)$/i.test(e)?(r||"_")+e.replace(n,r):e.replace(n,r)},t.createUUID=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}),t.splitSlice=(e,t)=>{const r=[];for(let n=0,s=e.length;n<s;n+=t)r.push(e.slice(n,t+n));return r}
;t.staticVars={visible:void 0,invisible:"display: none;",visible_move:void 0,invisible_move:"position:absolute; left: -20000px; top: -200000px; width: 1px; height: 1px;"}},function(e,t,r){"use strict";r.r(t);var n=r(2),s=r(3),o=r(10)
;const a="de.net|gb.net|uk.net|dk.org|eu.org|asn.au|conf.au|csiro.au|edu.au|gov.au|id.au|info.au|net.au|org.au|otc.au|oz.au|telememo.au|ac.cn|ah.cn|bj.cn|cq.cn|edu.cn|gd.cn|gov.cn|gs.cn|gx.cn|gz.cn|hb.cn|he.cn|hi.cn|hk.cn|hl.cn|hn.cn|jl.cn|js.cn|ln.cn|mo.cn|net.cn|nm.cn|nx.cn|org.cn|qh.cn|sc.cn|sh.cn|sn.cn|sx.cn|tj.cn|tw.cn|xj.cn|xz.cn|yn.cn|zj.cn|ac.jp|ad.jp|aichi.jp|akita.jp|aomori.jp|chiba.jp|co.jp|ed.jp|ehime.jp|fukui.jp|fukuoka.jp|fukushima.jp|gifu.jp|go.jp|gov.jp|gr.jp|gunma.jp|hiroshima.jp|hokkaido.jp|hyogo.jp|ibaraki.jp|ishikawa.jp|iwate.jp|kagawa.jp|kagoshima.jp|kanagawa.jp|kanazawa.jp|kawasaki.jp|kitakyushu.jp|kobe.jp|kochi.jp|kumamoto.jp|kyoto.jp|lg.jp|matsuyama.jp|mie.jp|miyagi.jp|miyazaki.jp|nagano.jp|nagasaki.jp|nagoya.jp|nara.jp|ne.jp|net.jp|niigata.jp|oita.jp|okayama.jp|okinawa.jp|or.jp|org.jp|osaka.jp|saga.jp|saitama.jp|sapporo.jp|sendai.jp|shiga.jp|shimane.jp|shizuoka.jp|takamatsu.jp|tochigi.jp|tokushima.jp|tokyo.jp|tottori.jp|toyama.jp|utsunomiya.jp|wakayama.jp|yamagata.jp|yamaguchi.jp|yamanashi.jp|yokohama.jp|ac.uk|co.uk|edu.uk|gov.uk|ltd.uk|me.uk|mod.uk|net.uk|nhs.uk|nic.uk|org.uk|plc.uk|police.uk|sch.uk|co.tv|co.th|co.nz|co.za|com.ac|com.af|com.ag|com.ai|com.al|com.ar|com.au|com.aw|com.az|com.ba|com.bb|com.bh|com.bi|com.bm|com.bo|com.br|com.bs|com.bt|com.by|com.bz|com.ci|com.cm|com.cn|com.co|com.cu|com.cw|com.cy|com.dm|com.do|com.dz|com.ec|com.ee|com.eg|com.es|com.et|com.fr|com.ge|com.gh|com.gi|com.gl|com.gn|com.gp|com.gr|com.gt|com.gu|com.gy|com.hk|com.hn|com.hr|com.ht|com.im|com.io|com.iq|com.is|com.jo|com.kg|com.ki|com.km|com.kp|com.ky|com.kz|com.la|com.lb|com.lc|com.lk|com.lr|com.lv|com.ly|com.mg|com.mk|com.ml|com.mo|com.ms|com.mt|com.mu|com.mv|com.mw|com.mx|com.my|com.na|com.nf|com.ng|com.ni|com.nr|com.om|com.pa|com.pe|com.pf|com.ph|com.pk|com.pl|com.pr|com.ps|com.pt|com.py|com.qa|com.re|com.ro|com.rw|com.sa|com.sb|com.sc|com.sd|com.sg|com.sh|com.sl|com.sn|com.so|com.st|com.sv|com.sy|com.tj|com.tm|com.tn|com.to|com.tr|com.tt|com.tw|com.ua|com.ug|com.uy|com.uz|com.vc|com.ve|com.vi|com.vn|com.vu|com.ws|com.zm|com.de|com.se|com.ru",i=(".("+["aaa|aarp|abb|abbott|abogado|ac|academy|accenture|accountant|accountants|aco|active|actor|ad|adac|ads|adult|ae|aeg|aero|af|afl|ag|agency|ai|aig|airforce|airtel|al|alibaba|alipay|allfinanz|alsace|am|amica|amsterdam|an|analytics|android|ao|apartments|app|apple|aq|aquarelle|ar|aramco|archi|army|arpa|arte|as|asia|associates|at|attorney|au|auction|audi|audio|author|auto|autos|aw|ax|axa|az|azure|ba|baidu|band|bank|bar|barcelona|barclaycard|barclays|bargains|bauhaus|bayern|bb|bbc|bbva|bcn|bd|be|beats|beer|bentley|berlin|best|bet|bf|bg|bh|bharti|bi|bible|bid|bike|bing|bingo|bio|biz|bj|bl|black|blackfriday|bloomberg|blue|bm|bms|bmw|bn|bnl|bnpparibas|bo|boats|boehringer|bom|bond|boo|book|boots|bosch|bostik|bot|boutique|bq|br|bradesco|bridgestone|broadway|broker|brother|brussels|bs|bt|budapest|bugatti|build|builders|business|buy|buzz|bv|bw|by|bz|bzh|ca|cab|cafe|cal|call|camera|camp|cancerresearch|canon|capetown|capital|car|caravan|cards|care|career|careers|cars|cartier|casa|cash|casino|cat|catering|cba|cbn|cc|cd|ceb|center|ceo|cern|cf|cfa|cfd|cg|ch|chanel|channel|chat|cheap|chloe|christmas|chrome|church|ci|cipriani|circle|cisco|citic|city|cityeats|ck|cl|claims|cleaning|click|clinic|clinique|clothing|cloud|club|clubmed|cm|cn|co|coach|codes|coffee|college|cologne|com|commbank|community|company|compare|computer|comsec|condos|construction|consulting|contact|contractors|cooking|cool|coop|corsica|country|coupons|courses|cr|credit|creditcard|creditunion|cricket|crown|crs|cruises|csc|cu|cuisinella|cv|cw|cx|cy|cymru|cyou|cz|dabur|dad|dance|date|dating|datsun|day|dclk|de|dealer|deals|degree|delivery|dell|deloitte|delta|democrat|dental|dentist|desi|design|dev|diamonds|diet|digital|direct|directory|discount|dj|dk|dm|dnp|do|docs|dog|doha|domains|doosan|download|drive|dubai|durban|dvag|dz|earth|eat|ec|edeka|edu|education|ee|eg|eh|email|emerck|energy|engineer|engineering|enterprises|epson|equipment|er|erni|es|esq|estate|et|eu|eurovision|eus|events|everbank|exchange|expert|exposed|express|fage|fail|fairwinds|faith|family|fan|fans|farm|fashion|fast|feedback|ferrero|fi|film|final|finance|financial|firestone|firmdale|fish|fishing|fit|fitness|fj|fk|flickr|flights|florist|flowers|flsmidth|fly|fm|fo|foo|football|ford|forex|forsale|forum|foundation|fox|fr|fresenius|frl|frogans|frontier|fund|furniture|futbol|fyi|ga|gal|gallery|gallup|game|garden|gb|gbiz|gd|gdn|ge|gea|gent|genting|gf|gg|ggee|gh|gi|gift|gifts|gives|giving|gl|glass|gle|global|globo|gm|gmail|gmo|gmx|gn|gold|goldpoint|golf|goo|goog|google|gop|got|gov|gp|gq|gr|grainger|graphics|gratis|green|gripe|group|gs|gt|gu|gucci|guge|guide|guitars|guru|gw|gy|hamburg|hangout|haus|hdfcbank|health|healthcare|help|helsinki|here|hermes|hiphop|hitachi|hiv|hk|hm|hn|hockey|holdings|holiday|homedepot|homes|honda|horse|host|hosting|hoteles|hotmail|house|how|hr|hsbc|ht|hu|hyundai|ibm|icbc|ice|icu|id|ie|ifm|iinet|il|im|immo|immobilien|in|industries|infiniti|info|ing|ink|institute|insurance|insure|int|international|investments|io|ipiranga|iq|ir|irish|is|iselect|ist|istanbul|it|itau|iwc|jaguar|java|jcb|je|jetzt|jewelry|jlc|jll|jm|jmp|jo|jobs|joburg|jot|joy|jp|jprs|juegos|kaufen|kddi|ke|kfh|kg|kh|ki|kia|kim|kinder|kitchen|kiwi|km|kn|koeln|komatsu|kp|kpn|kr|krd|kred|kw|ky|kyoto|kz|la|lacaixa|lamborghini|lamer|lancaster|land|landrover|lanxess|lasalle|lat|latrobe|law|lawyer|lb|lc|lds|lease|leclerc|legal|lexus|lgbt|li|liaison|lidl|life|lifeinsurance|lifestyle|lighting|like|limited|limo|lincoln|linde|link|live|living|lixil|lk|loan|loans|lol|london|lotte|lotto|love|lr|ls|lt|ltd|ltda|lu|lupin|luxe|luxury|lv|ly|ma|madrid|maif|maison|makeup|man|management|mango|market|marketing|markets|marriott|mba|mc|md|me|med|media|meet|melbourne|meme|memorial|men|menu|meo|mf|mg|mh|miami|microsoft|mil|mini|mk|ml|mm|mma|mn|mo|mobi|mobily|moda|moe|moi|mom|monash|money|montblanc|mormon|mortgage|moscow|motorcycles|mov|movie|movistar|mp|mq|mr|ms|mt|mtn|mtpc|mtr|mu|museum|mutuelle|mv|mw|mx|my|mz|na|nadex|nagoya|name|natura|navy|nc|ne|nec|net|netbank|network|neustar|new|news|nexus|nf|ng|ngo|nhk|ni|nico|nikon|ninja|nissan|nl|no|nokia|norton|nowruz|np|nr|nra|nrw|ntt|nu|nyc|nz|obi|office|okinawa|om|omega|one|ong|onl|online|ooo|oracle|orange|org|organic|origins|osaka|otsuka|ovh|pa|page|pamperedchef|panerai|paris|pars|partners|parts|party|pe|pet|pf|pg|ph|pharmacy|philips|photo|photography|photos|physio|piaget|pics|pictet|pictures|pid|pin|ping|pink|pizza|pk|pl|place|play|playstation|plumbing|plus|pm|pn|pohl|poker|porn|post|pr|praxi|press|pro|prod|productions|prof|promo|properties|property|protection|ps|pt|pub|pw|pwc|py|qa|qpon|quebec|quest|racing|re|read|realtor|realty|recipes|red|redstone|redumbrella|rehab|reise|reisen|reit|ren|rent|rentals|repair|report|republican|rest|restaurant|review|reviews|rexroth|rich|ricoh|rio|rip|ro|rocher|rocks|rodeo|room|rs|rsvp|ru|ruhr|run|rw|rwe|ryukyu|sa|saarland|safe|safety|sakura|sale|salon|samsung|sandvik|sandvikcoromant|sanofi|sap|sapo|sarl|sas|saxo|sb|sbs|sc|sca|scb|schaeffler|schmidt|scholarships|school|schule|schwarz|science|scor|scot|sd|se|seat|security|seek|select|sener|services|seven|sew|sex|sexy|sfr|sg|sh|sharp|shell|shia|shiksha|shoes|show|shriram|si|singles|site|sj|sk|ski|skin|sky|skype|sl|sm|smile|sn|sncf|so|soccer|social|softbank|software|sohu|solar|solutions|sony|soy|space|spiegel|spreadbetting|sr|srl|ss|st|stada|star|starhub|statefarm|statoil|stc|stcgroup|stockholm|storage|studio|study|style|su|sucks|supplies|supply|support|surf|surgery|suzuki|sv|swatch|swiss|sx|sy|sydney|symantec|systems|sz|tab|taipei|taobao|tatamotors|tatar|tattoo|tax|taxi|tc|tci|td|team|tech|technology|tel|telefonica|temasek|tennis|tf|tg|th|thd|theater|theatre|tickets|tienda|tiffany|tips|tires|tirol|tj|tk|tl|tm|tmall|tn|to|today|tokyo|tools|top|toray|toshiba|tours|town|toyota|toys|tp|tr|trade|trading|training|travel|travelers|travelersinsurance|trust|trv|tt|tube|tui|tushu|tv|tvs|tw|tz|ua|ubs|ug|uk|um|unicom|university|uno|uol|us|uy|uz|va|vacations|vana|vc|ve|vegas|ventures|verisign|versicherung|vet|vg|vi|viajes|video|villas|vin|vip|virgin|vision|vista|vistaprint|viva|vlaanderen|vn|vodka|volkswagen|vote|voting|voto|voyage|vu|wales|walter|wang|wanggou|watch|watches|weather|weatherchannel|webcam|weber|website|wed|wedding|weir|wf|whoswho|wien|wiki|williamhill|win|windows|wine|wme|wolterskluwer|work|works|world|ws|wtc|wtf|xbox|xerox|xin|测试|कॉम|परीक्षा|佛山|慈善|集团|在线|한국|点看|คอม|ভারত|八卦|‏موقع‎|বাংলা|公益|公司|移动|我爱你|москва|испытание|қаз|онлайн|сайт|联通|срб|бел|‏קום‎|时尚|테스트|淡马锡|орг|नेट|삼성|சிங்கப்பூர்|商标|商店|商城|дети|мкд|‏טעסט‎|ею|ポイント|新闻|工行|‏كوم‎|中文网|中信|中国|中國|娱乐|谷歌|భారత్|ලංකා|购物|測試|ભારત|भारत|‏آزمایشی‎|பரிட்சை|网店|संगठन|餐厅|网络|ком|укр|香港|诺基亚|δοκιμή|飞利浦|‏إختبار‎|台湾|台灣|手表|手机|мон|‏الجزائر‎|‏عمان‎|‏ارامكو‎|‏ایران‎|‏امارات‎|‏بازار‎|‏پاکستان‎|‏الاردن‎|‏موبايلي‎|‏بھارت‎|‏المغرب‎|‏السعودية‎|‏سودان‎|‏همراه‎|‏عراق‎|‏مليسيا‎|澳門|닷컴|政府|‏شبكة‎|‏بيتك‎|გე|机构|组织机构|健康|ไทย|‏سورية‎|рус|рф|珠宝|‏تونس‎|大拿|みんな|グーグル|ελ|世界|ਭਾਰਤ|网址|닷넷|コム|游戏|vermögensberater|vermögensberatung|企业|信息|‏مصر‎|‏قطر‎|广东|இலங்கை|இந்தியா|հայ|新加坡|‏فلسطين‎|テスト|政务|xperia|xxx|xyz|yachts|yahoo|yamaxun|yandex|ye|yodobashi|yoga|yokohama|youtube|yt|za|zara|zero|zip|zm|zone|zuerich|zw",a].join("|")+")").replace(/\./gi,"\\."),A=Object(o.createCache)({
timeout:180,check_interval:120,retimeout_on_get:!0}).init(),l=(()=>{const e=e=>e.split("").map(e=>{const t=e.toLowerCase(),r=e.toUpperCase();return t!=r?"["+t+r+"]":e}).join(""),t=["protocol","hostname","port","origin"],r=["pathname"],o=["search","hash"],l=t.concat(r).concat(o);let c;const u=(e,n)=>{const s={};if(null==e)l.forEach(e=>{s[e]=""});else if(["data:","view-source:"].some(t=>e.startsWith(t))){s.origin="null";const t=e.indexOf(":");s.protocol=e.substr(0,t+1),s.pathname=e.substr(t+1)
}else{const a=document.createElement("a");a.href=e;const i=document.body||document.documentElement||document;if(i.appendChild(a),l.forEach(e=>{s[e]=a[e]}),i.removeChild(a),!n&&s.protocol){if(0!==e.toLowerCase().indexOf(s.protocol))if(e.startsWith("//"))s.origin="",s.protocol="";else{if(!["/","?","#"].includes(e[0]))return u("/"+e);c||(c=u("",!0)),o.concat(r).forEach(e=>{c[e]===s[e]&&(s[e]="")}),t.forEach(e=>{s[e]=""})}
["tampermonkey:"].includes(s.protocol)&&(s.pathname=((s.hostname?"/"+s.hostname:"")+(s.pathname||"")).replace(/^\/+/,"/"),s.hostname="")}}return"0"===s.port&&(s.port=""),Object.defineProperties(s,{domain:{get:function(){const e=s.hostname.split("."),t=e.pop();let r=`${e.pop()}.${t}`;return m.isSecondLevelDomain(r)&&(r=`${e.pop()}.${r}`),r}}}),s
},d=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,g=/((^\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\s*$)|(^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$))/
;let p;const m={isIp:function(e){return e.match(d)||e.match(g)},isIpOrHostname:function(e){return m.isIp(e)||!e.includes(".")},isSecondLevelDomain:function(e){return p=p||new RegExp("^("+a.replace(/\./g,"\\.")+")$"),e.match(p)},sanitize:function(e,t,r){let n=!1;const s=m.parse(e);if(s)return"tampermonkey:"==s.protocol?s.pathname.includes("..")?n=!0:e=rea.extension.getURL(e.replace(/^tampermonkey:\/\//,"")):s.protocol||t&&(e=m.rel2abs(e,t,r||["http:","https:"]))||(n=!0),n?null:e},
parse:function(e){if(null==e)return;let t=A.get(e);return t||(t=u(e),A.set(e,t),t)},rel2abs:function(e,t,r){let n,s,o;if(e&&t&&(n=m.parse(e))&&(s=m.parse(t))&&n&&s&&s.protocol&&(!r||r.includes(s.protocol)||!e.includes("..")))return e.startsWith("//")?s.protocol+"//"+n.hostname+(n.port?":"+n.port:"")+n.pathname+n.search:("/"===e[0]?o=n.pathname:(t=m.woParams(s),s=m.parse(t+("/"===t[t.length-1]?"":"/")+e),o=s.pathname),s.protocol+"//"+s.hostname+(s.port?":"+s.port:"")+o+n.search)},
toUrl:function(e,t){return t=t||{},(["about:"].includes(e.protocol)?e.protocol:e.protocol+"//")+e.hostname+(e.port&&e.port>0?":"+e.port:"")+(t.nopath?"":e.pathname+(t.nosearch?"":e.search))},woPath:function(e){const t="string"==typeof e?m.parse(e):e;return m.toUrl(t,{nopath:!0})},woParams:function(e){const t="string"==typeof e?m.parse(e):e;return m.toUrl(t,{nosearch:!0})},woHash:function(e){const t="string"==typeof e?m.parse(e):e;return m.toUrl(t)},hash2params:function(e){
return Object.keys(e).map(t=>void 0===e[t]?null:encodeURIComponent(t)+"="+encodeURIComponent(e[t])).filter(e=>e).join("&")},params2hash:function(e){return"string"!=typeof e&&(e=e.search?e.search.substring(1):e.hash?e.hash.substring(1):""),e.split("&").reduce((e,t)=>{const r=t.split("=");return e[decodeURIComponent(r[0])]=decodeURIComponent(r[1]),e},{})},getRegExpFromInclude:e=>{let t;return"*"==e?t="^(https?|file)://.*":(t=e.includes(".*/")?e.replace(".*/",".tld/"):e,
t="^"+Object(s.escapeForRegExpURL)(t),t=t.replace(/\*/gi,".*"),t=t.replace(Object(s.escapeForRegExpURL)(".tld/"),i+"/"),t=t.replace(/(\^|:\/\/)\.\*/,"$1([^\\?#])*"),t=t.replace(/<1>/g,"([^\\/#\\?]*\\.)?"),t=t.replace(/<2>/g,"[^#\\?]*"),t=t.replace(/<3>/g,"([^\\?#]*\\.)*")),"("+t+")"},getRegExpFromMatch:(t,r)=>{let o,a,A,l,c,u;const d="://",g="/";if(o=t.replace(/\$$/,"").split(d),o.length<2?(a="",A=t):(a=o[0].replace(/^\^/,""),A=o.slice(1).join(d)),l=A.split(g),
u=l.length<2?"/":g+l.slice(1).join(g),c=l[0],"http*"===a?a="https<1>":a.match(/\*|http|https|file|ftp/)||(n.logger.warn('uri: override scheme "'+a+'" with "*"'),a="*"),"file"===a)c="";else{const e=c,t=c.match(/\*$|(\*\.)?[^\/\*]+/);c=(t?t[0]:"").replace(/:[0-9]*$/,""),c!==e&&n.logger.warn('uri: override host "'+e+'" with "'+c+'"')}return u&&u.substr(0,1)===g||(n.logger.warn('uri: prefix path "'+u+'" with "/"'),u=g+u),a=Object(s.escapeForRegExpURL)(a).replace(/\*/gi,"[^:\\/#\\?]*"),
c=Object(s.escapeForRegExpURL)(c).replace(/\*\\\./gi,"(*\\.)?").replace(/\*/gi,"[^#\\?\\/]*"),u=Object(s.escapeForRegExpURL)(u).replace(/\*/gi,".*"),a=a.replace(/<1>/g,"?"),c=c.replace(new RegExp(Object(s.escapeForRegExpURL)(".tld")+"$"),i),r||(a=e(a),c=e(c)),c+="(:[0-9]{1,5})?","(^"+a+Object(s.escapeForRegExpURL)(d)+c+u+"$)"}};return m})();t.default=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0})
;const n=r(1),s=r(2),o=window.rea,a=o.FEATURES,i=a.HTML5.LOCALSTORAGE,A=[];let l=!0;const c=(()=>{const e=[a.CONSTANTS.STORAGE.VERSION,a.CONSTANTS.STORAGE.TYPE],t={};return e.forEach(e=>{t[e]=!0}),{keys:e,has:function(e){return!!t[e]}}})(),u=()=>o.other.openDatabase("tmStorage","1.0","TM Storage",31457280),d=(e,t)=>{if(!e)return t;const r=e[0];switch(e=e.substring(1),r){case"b":return"true"==e;case"n":return Number(e);case"o":try{return JSON.parse(e)}catch(e){
s.logger.error("Storage: getValue ERROR: "+e.message)}return t;default:return e}},g=e=>{const t=(typeof e)[0];switch(t){case"o":try{e=t+JSON.stringify(e)}catch(r){s.logger.error("Storage: setValue ERROR: "+r.message),e=t+JSON.stringify({})}break;default:e=t+e}return e},p=function(e,t){const r=n.Deferred();let o;return e==a.DB.USE&&"clean"==t?s.logger.warn("Storage: can't clean currently active storage"):o=v[e][t],o?o().then(()=>{r.resolve()},()=>{r.reject()}):r.resolve(),r.promise()},m=(e,t)=>{
const r=n.Deferred(),s=[];return Object.getOwnPropertyNames(t).forEach(r=>{void 0!==t[r]&&s.push(e.setValue(r,t[r]))}),n.Deferred.when(s).done(()=>{r.resolve()}),r.promise()},f=(e,t)=>{const r={};for(const n of t){const t=e.getValue(n);void 0!==t&&(r[n]=t)}return r},h=(()=>{const e="s_",t=t=>{document.cookie=e+t+"=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/"},r={setValue:(t,r)=>{const s=n.Deferred();return((t,r)=>{const n=new Date;n.setTime(n.getTime()+47304e7)
;const s="expires="+n.toUTCString();document.cookie=e+t+"="+r+";"+s+";path=/"})(t,g(r)),s.resolve(),s.promise()},setValues:e=>{const t=[];return Object.keys(e).forEach(n=>{t.push(r.setValue(n,e[n]))}),n.Deferred.sidebyside(t)},getValue:(t,r)=>d((t=>{const r=e+t+"=",n=document.cookie.split(";");for(let e=0;e<n.length;e++){let t=n[e];for(;" "==t.charAt(0);)t=t.substring(1);if(0==t.indexOf(r))return t.substring(r.length,t.length)}return null})(t),r),deleteAll:()=>{const e=n.Deferred()
;return r.listValues().forEach(e=>{t(e)}),e.resolve(),e.promise()},deleteValue:e=>{const r=n.Deferred();return t(e),r.resolve(),r.promise()},listValues:()=>(()=>{const t=document.cookie.split(";"),r=[];for(let n=0;n<t.length;n++){const s=t[n].trim(),o=s.indexOf("="),a=s.substr(0,o);a.substr(0,e.length)==e&&r.push(a.substr(e.length))}return r})().map(e=>e)};return r})();let R;const v={localStorage:(()=>{const e=a.HTML5.LOCALSTORAGE,t={setValue:(t,r)=>{const s=n.Deferred(),o=t,a=g(r)
;return l&&void 0!==a&&e.setItem(o,a),s.resolve(),s.promise()},setValues:e=>{const r=[];return Object.keys(e).forEach(n=>{r.push(t.setValue(n,e[n]))}),n.Deferred.sidebyside(r)},getValue:(t,r)=>{const n=t;return d(e.getItem(n),r)},deleteAll:()=>{const r=n.Deferred();return l&&t.listValues().forEach(t=>{c.has(t)||e.removeItem(t)}),r.resolve(),r.promise()},deleteValue:t=>{const r=n.Deferred(),s=t;return l&&e.removeItem(s),r.resolve(),r.promise()},listValues:()=>{const t=[]
;for(let r=0;r<e.length;r++){const n=e.key(r);null!==n&&t.push(n)}return t}};return{options:{},methods:t}})(),sql:(()=>{let e,t=!1,r={};const a=()=>{const t=n.Deferred();return null==e||e.db.transaction(r=>{r.executeSql("CREATE TABLE IF NOT EXISTS config(ID INTEGER PRIMARY KEY ASC, name TEXT, value TEXT)",[],()=>t.resolve(),null==e?void 0:e.onError)}),t.promise()},i={setValue:(t,a)=>{const i=n.Deferred(),A=t,c=g(a);return l&&(r[A]?null==e||e.db.transaction(t=>{
t.executeSql("UPDATE config SET value=? WHERE name=?",[c,A],()=>{o.runtime.lastError&&s.logger.warn(o.runtime.lastError),i.resolve()},null==e?void 0:e.onError)}):null==e||e.db.transaction(t=>{t.executeSql("INSERT INTO config(name, value) VALUES (?,?)",[A,c],()=>{o.runtime.lastError&&s.logger.warn(o.runtime.lastError),i.resolve()},null==e?void 0:e.onError)})),r[A]=c,l||i.resolve(),i.promise()},setValues:e=>{const t=[];return Object.keys(e).forEach(r=>{t.push(i.setValue(r,e[r]))}),
n.Deferred.sidebyside(t)},getValue:(e,t)=>d(r[e],t),deleteAll:()=>{const t=n.Deferred(),s=f(i,c.keys);r={};for(const e of Object.keys(s))r[e]=g(s[e]);return l?null==e||e.db.transaction(n=>{n.executeSql("DROP TABLE config",[],()=>{a().done(()=>{m(i,r).done(t.resolve)})},null==e?void 0:e.onError)}):t.resolve(),t.promise()},deleteValue:t=>{const s=n.Deferred(),o=t;return delete r[o],l?null==e||e.db.transaction(t=>{
t.executeSql("DELETE FROM config WHERE name=?",[o],()=>s.resolve(),null==e?void 0:e.onError)}):s.resolve(),s.promise()},listValues:()=>{const e=[];return Object.getOwnPropertyNames(r).forEach(t=>{e.push(t)}),e},isWorking:()=>n.Deferred.Pledge()};return{init:()=>{const o=n.Deferred(),i=(e,t)=>{if(r={},t)for(let e=0;e<t.rows.length;e++)r[t.rows.item(e).name]=t.rows.item(e).value;o.resolve()},A=()=>{t?o.resolve():(t=!0,null==e||e.db.transaction(t=>{
t.executeSql("SELECT * FROM config",[],i,null==e?void 0:e.onError)}))};return e?A():(()=>{const t=n.Deferred();return e={db:u(),onSuccess:()=>{},onError:(e,t)=>(s.logger.error("webSQL: localDB Error ",t),!1)},e.db?a().done(t.resolve):(e=null,t.reject()),t.promise()})().done(A).fail(o.reject),o.promise()},clean:()=>(t=!1,r={},n.Deferred.Pledge()),options:{},methods:i}})(),chromeStorage:(()=>{let e=!1,t={},r=!1,a=!1;const i=o.extension.inIncognitoContext?"incognito":"normal",A=(e,r)=>{
l&&a&&"local"==r&&e&&Object.keys(e).forEach(r=>{const n=e[r];n.newValue?n.newValue.origin!==i&&(n.newValue.value&&(t[r]=n.newValue.value),b.notifyDifferentOriginChangeListeners(r,n.newValue.value)):n.oldValue&&n.oldValue.origin!==i&&delete t[r]})},u={setValue:(e,r)=>{const s=n.Deferred(),a=e;if(t[a]=r,l){const e={};e[a]={origin:i,value:r},o.storage.local.set(e,s.resolve)}else s.resolve();return s.promise()},setValues:e=>{const r=n.Deferred(),s={};return Object.keys(e).forEach(r=>{
const n=r,o=e[r];t[n]=o,l&&(s[n]={origin:i,value:o})}),l?o.storage.local.set(s,r.resolve):r.resolve(),r.promise()},getValue:(e,r)=>{const n=e;return void 0===t[n]?r:t[n]},deleteAll:()=>{const e=n.Deferred(),r=f(u,c.keys);return t=r,l?o.storage.local.clear(()=>{m(u,r).done(e.resolve)}):e.resolve(),e.promise()},deleteValue:e=>{const r=n.Deferred(),s=e;return delete t[s],l?o.storage.local.remove(s,r.resolve):r.resolve(),r.promise()},listValues:()=>{const e=[]
;return Object.getOwnPropertyNames(t).forEach(t=>{e.push(t)}),e},setTemporary:e=>{l=!e,a=!0},isWorking:()=>{const e=n.Deferred();let t=0;const r=Date.now(),a="foo",i={};i[a]={origin:"normal",value:r};const A=()=>{u&&window.clearTimeout(u),u=null},l=e=>{++t<=5?(s.logger.warn("storage:",e||"storage set/get test failed!"),window.setTimeout(d,t*t*100)):(s.logger.warn("storage: storage set/get test finally failed!"),c())},c=()=>{u&&(A(),e.reject())};let u=window.setTimeout(()=>{u=null,c()},18e4)
;const d=()=>{s.logger.log("Storage: test -> start");const t=Date.now();o.storage.local.set(i,()=>{s.logger.log("Storage: test -> set after "+(Date.now()-t)+"ms"),o.storage.local.get(a,n=>(s.logger.log("Storage: test -> get after "+(Date.now()-t)+"ms"),n&&n[a]?n[a].value!==r?l("read value is different "+JSON.stringify(n[a])+" != "+JSON.stringify(r)):o.runtime.lastError?l(o.runtime.lastError&&o.runtime.lastError.message||"lastError is set"):void o.storage.local.remove(a,()=>{
s.logger.log("Storage: test -> remove after "+(Date.now()-t)+"ms"),u&&(A(),e.resolve())}):l("read value is"+JSON.stringify(n))))})};return d(),e.promise()}};return{init:()=>{const s=n.Deferred();if(e)s.resolve();else{e=!0;const n=e=>{t={},e&&Object.keys(e).forEach(r=>{const n=e[r];n&&n.hasOwnProperty("origin")&&n.hasOwnProperty("value")?t[r]=n.value:t[r]=n}),r||(o.storage.onChanged.addListener(A),r=!0),s.resolve()};o.storage.local.get(null,n)}return s.promise()},clean:()=>{const r=n.Deferred()
;return e=!1,t={},r.resolve(),r.promise()},options:{},methods:u}})()},b={secure:{cookie:h},setValue:(e,t)=>R.setValue(e,t),setValues:e=>R.setValues(e),getValue:(e,t)=>R.getValue(e,t),deleteAll:()=>R.deleteAll(),deleteValue:e=>R.deleteValue(e),listValues:()=>R.listValues(),isWorking:()=>(R.isWorking||n.Deferred.Pledge)(),migrate:(e,t,r)=>{const o=n.Deferred(),a=v[e],i=v[t];return r=r||{},a&&i?p(e,"init").then(()=>p(t,"init")).then(()=>{const e=n.Deferred(),t=[]
;return a.methods.listValues().forEach(e=>{const n=a.methods.getValue(e);r.drop&&t.push(a.methods.deleteValue(e)),void 0!==n&&t.push(i.methods.setValue(e,n))}),n.Deferred.when(t).done(()=>{e.resolve()}),e.promise()}).then(()=>p(t,"clean")).then(()=>p(e,"clean")).done(()=>{o.resolve()}).fail(()=>{o.reject()}):(s.logger.error("Migration: unknown storage implementation(s) ",e,t),o.reject()),o.promise()},setTemporary:e=>{l=!e},init:()=>{s.logger.debug("Storage: use "+a.DB.USE);const e=v[a.DB.USE]
;return R=e.methods,e.init?e.init():n.Deferred.Pledge()},factoryReset:()=>(i&&i.removeItem(a.CONSTANTS.STORAGE.LEGACY_VERSION),b.deleteAll()),isWiped:()=>{if("localStorage"===a.DB.USE||!i)return n.Deferred.Pledge(!1);const e=n.Deferred(),t=b.getValue(a.CONSTANTS.STORAGE.VERSION);let r=!1;return i.getItem(a.CONSTANTS.STORAGE.LEGACY_VERSION)&&!t&&(b.listValues().length?s.logger.warn("storage: unable to find version information"):r=!0),e.resolve(r),e.promise()},setVersion:(e,t)=>{
const r=n.Deferred();return l?(i&&i.setItem(a.CONSTANTS.STORAGE.LEGACY_VERSION,e),b.setValue(a.CONSTANTS.STORAGE.VERSION,e).then(()=>t?b.setValue(a.CONSTANTS.STORAGE.SCHEMA,t):n.Deferred.Pledge()).always(r.resolve)):r.resolve(),r.promise()},getVersion:e=>{const t=n.Deferred();let r=b.getValue(a.CONSTANTS.STORAGE.VERSION)||b.getValue(a.CONSTANTS.STORAGE.LEGACY_VERSION)||(i?i.getItem(a.CONSTANTS.STORAGE.LEGACY_VERSION):null);if(r)t.resolve(r);else{const n="sql"
;p(n,"init").then(()=>(r=v.sql.methods.getValue(a.CONSTANTS.STORAGE.LEGACY_VERSION)||e,p(n,"clean"))).always(()=>{t.resolve(r||e)})}return t.promise()},getSchemaVersion:()=>b.getValue(a.CONSTANTS.STORAGE.SCHEMA,"3.5"),addDifferentOriginChangeListener:(e,t)=>{A.push({search:e,cb:t})},notifyDifferentOriginChangeListeners:(e,t)=>{A.forEach(r=>{0==e.indexOf(r.search)&&r.cb(e,t)})},recover:e=>{const t=n.Deferred();"string"==typeof e&&(e={method:e,storages:["sql","chromeStorage"]});const r={}
;if(e.storages.forEach(e=>{r[e]=!0}),"log"==e.method){let e,n,a,i;const A=[{method:"sql",fn:t=>{s.logger.debug("check sql storage for data...");try{if(i=u(),o.runtime.lastError||!i)return e=o.runtime.lastError,t();i.transaction(r=>{r.executeSql("CREATE TABLE IF NOT EXISTS config(ID INTEGER PRIMARY KEY ASC, name TEXT, value TEXT)",[],()=>{s.logger.debug("sql table found/created"),t()},(r,n)=>(e=n,t(),!1))})}catch(r){e=r,window.setTimeout(t,1)}}},{method:"sql",fn:t=>{const r={};i.transaction(s=>{
s.executeSql("SELECT * FROM config",[],(e,s)=>{if(s)for(let e=0;e<s.rows.length;e++)r[s.rows.item(e).name]=s.rows.item(e).value;n=r,window.setTimeout(t,1)},(r,n)=>(e=n,t(),!1))})}},{method:"sql",fn:e=>{const t=n?Object.getOwnPropertyNames(n):[];n&&t.length?(s.logger.debug("found values:"),t.forEach(e=>{var t;const r=null===(t=n[e])||void 0===t?void 0:t.toString();s.logger.debug("    ",e,r&&r.length>30?r.substr(0,30):r)})):(s.logger.warn("no data found"),r.sql=!1),window.setTimeout(e,1)}},{
method:"chromeStorage",fn:e=>{s.logger.debug("check chromeStorage for data..."),o.storage.local.get(null,t=>{a=t,e()})}},{method:"chromeStorage",fn:e=>{const t=a?Object.getOwnPropertyNames(a):[];a&&t.length?(s.logger.debug("found values:"),t.forEach(e=>{var t;const r=null===(t=a[e])||void 0===t?void 0:t.toString();s.logger.debug("    ",e,r&&r.length>30?r.substr(0,30):r)})):(s.logger.warn("no data found"),r.chromeStorage=!1,window.setTimeout(e,1))}}],l=()=>{if(e)return s.logger.warn("error:",e),
void t.resolve();for(const e of A)if(r[e.method])return void e.fn(l);t.resolve()};l()}else t.resolve();return t.promise()}};t.default=b},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r={encode:e=>window.unescape(window.encodeURIComponent(e)),decode:e=>window.decodeURIComponent(window.escape(e))},n=(e,t)=>{try{let n;n="object"==typeof t?t.encoding:t,n&&"utf-8"==n.toLowerCase()&&(e=r.encode(e));const s=new window.Uint8Array(e.length)
;for(let t=0;t<e.length;t++)s[t]=255&e.charCodeAt(t);return s.buffer}catch(e){window.console.warn(e)}return new window.Uint8Array(0).buffer},s={UTF8:r,Base64:{encode:e=>{let t="";for(let r=0;r<e.length;r++)t+=window.String.fromCharCode(255&e.charCodeAt(r));return window.btoa(t)},decode:e=>window.atob(e)},encode:e=>window.escape(e),decode:e=>window.unescape(e),encodeR:e=>e,decodeR:e=>e,encodeS:e=>window.btoa(r.encode(e)),decodeS:e=>r.decode(window.atob(e)),MD5:(e,t)=>{
const n=(e,t)=>e<<t|e>>>32-t,s=(e,t)=>{const r=2147483648&e,n=2147483648&t,s=1073741824&e,o=1073741824&t,a=(1073741823&e)+(1073741823&t);return s&o?2147483648^a^r^n:s|o?1073741824&a?3221225472^a^r^n:1073741824^a^r^n:a^r^n},o=(e,t,r,o,a,i,A)=>(e=s(e,s(s(((e,t,r)=>e&t|~e&r)(t,r,o),a),A)),s(n(e,i),t)),a=(e,t,r,o,a,i,A)=>(e=s(e,s(s(((e,t,r)=>e&r|t&~r)(t,r,o),a),A)),s(n(e,i),t)),i=(e,t,r,o,a,i,A)=>(e=s(e,s(s(((e,t,r)=>e^t^r)(t,r,o),a),A)),
s(n(e,i),t)),A=(e,t,r,o,a,i,A)=>(e=s(e,s(s(((e,t,r)=>t^(e|~r))(t,r,o),a),A)),s(n(e,i),t)),l=e=>{let t,r,n="",s="";for(r=0;r<=3;r++)t=e>>>8*r&255,s="0"+t.toString(16),n+=s.substr(s.length-2,2);return n};let c,u,d,g,p,m,f,h,R,v=[];for(t&&"utf-8"==t.toLowerCase()&&(e=r.encode(e)),v=(e=>{let t;const r=e.length,n=r+8,s=16*((n-n%64)/64+1),o=Array(s-1);let a=0,i=0;for(;i<r;)t=(i-i%4)/4,a=i%4*8,o[t]=o[t]|e.charCodeAt(i)<<a,i++;return t=(i-i%4)/4,a=i%4*8,o[t]=o[t]|128<<a,o[s-2]=r<<3,o[s-1]=r>>>29,o})(e),
m=1732584193,f=4023233417,h=2562383102,R=271733878,c=0;c<v.length;c+=16)u=m,d=f,g=h,p=R,m=o(m,f,h,R,v[c+0],7,3614090360),R=o(R,m,f,h,v[c+1],12,3905402710),h=o(h,R,m,f,v[c+2],17,606105819),f=o(f,h,R,m,v[c+3],22,3250441966),m=o(m,f,h,R,v[c+4],7,4118548399),R=o(R,m,f,h,v[c+5],12,1200080426),h=o(h,R,m,f,v[c+6],17,2821735955),f=o(f,h,R,m,v[c+7],22,4249261313),m=o(m,f,h,R,v[c+8],7,1770035416),R=o(R,m,f,h,v[c+9],12,2336552879),h=o(h,R,m,f,v[c+10],17,4294925233),f=o(f,h,R,m,v[c+11],22,2304563134),
m=o(m,f,h,R,v[c+12],7,1804603682),R=o(R,m,f,h,v[c+13],12,4254626195),h=o(h,R,m,f,v[c+14],17,2792965006),f=o(f,h,R,m,v[c+15],22,1236535329),m=a(m,f,h,R,v[c+1],5,4129170786),R=a(R,m,f,h,v[c+6],9,3225465664),h=a(h,R,m,f,v[c+11],14,643717713),f=a(f,h,R,m,v[c+0],20,3921069994),m=a(m,f,h,R,v[c+5],5,3593408605),R=a(R,m,f,h,v[c+10],9,38016083),h=a(h,R,m,f,v[c+15],14,3634488961),f=a(f,h,R,m,v[c+4],20,3889429448),m=a(m,f,h,R,v[c+9],5,568446438),R=a(R,m,f,h,v[c+14],9,3275163606),
h=a(h,R,m,f,v[c+3],14,4107603335),f=a(f,h,R,m,v[c+8],20,1163531501),m=a(m,f,h,R,v[c+13],5,2850285829),R=a(R,m,f,h,v[c+2],9,4243563512),h=a(h,R,m,f,v[c+7],14,1735328473),f=a(f,h,R,m,v[c+12],20,2368359562),m=i(m,f,h,R,v[c+5],4,4294588738),R=i(R,m,f,h,v[c+8],11,2272392833),h=i(h,R,m,f,v[c+11],16,1839030562),f=i(f,h,R,m,v[c+14],23,4259657740),m=i(m,f,h,R,v[c+1],4,2763975236),R=i(R,m,f,h,v[c+4],11,1272893353),h=i(h,R,m,f,v[c+7],16,4139469664),f=i(f,h,R,m,v[c+10],23,3200236656),
m=i(m,f,h,R,v[c+13],4,681279174),R=i(R,m,f,h,v[c+0],11,3936430074),h=i(h,R,m,f,v[c+3],16,3572445317),f=i(f,h,R,m,v[c+6],23,76029189),m=i(m,f,h,R,v[c+9],4,3654602809),R=i(R,m,f,h,v[c+12],11,3873151461),h=i(h,R,m,f,v[c+15],16,530742520),f=i(f,h,R,m,v[c+2],23,3299628645),m=A(m,f,h,R,v[c+0],6,4096336452),R=A(R,m,f,h,v[c+7],10,1126891415),h=A(h,R,m,f,v[c+14],15,2878612391),f=A(f,h,R,m,v[c+5],21,4237533241),m=A(m,f,h,R,v[c+12],6,1700485571),R=A(R,m,f,h,v[c+3],10,2399980690),
h=A(h,R,m,f,v[c+10],15,4293915773),f=A(f,h,R,m,v[c+1],21,2240044497),m=A(m,f,h,R,v[c+8],6,1873313359),R=A(R,m,f,h,v[c+15],10,4264355552),h=A(h,R,m,f,v[c+6],15,2734768916),f=A(f,h,R,m,v[c+13],21,1309151649),m=A(m,f,h,R,v[c+4],6,4149444226),R=A(R,m,f,h,v[c+11],10,3174756917),h=A(h,R,m,f,v[c+2],15,718787259),f=A(f,h,R,m,v[c+9],21,3951481745),m=s(m,u),f=s(f,d),h=s(h,g),R=s(R,p);return(l(m)+l(f)+l(h)+l(R)).toLowerCase()},ab2strSync:(e,t)=>{try{let n,s;if("object"==typeof t?(n=t.encoding,
s=t.array):n=t,window.TextDecoder&&!s&&n)return new window.TextDecoder(n).decode(e);{let t=0;const s=[],o=e.byteLength;for(;t<o;t+=16384)s.push(window.String.fromCharCode.apply(null,new Uint8Array(e,t,Math.min(16384,o-t))));let a=s.join("");return n&&"utf-8"==n.toLowerCase()&&(a=r.decode(a)),a}}catch(e){window.console.warn(e)}return null},str2abSync:n,ab2str:(e,t)=>new Promise((r,n)=>{const s=t&&t.encoding?"text/plain":"binary/octet-stream",o=new Blob([e],{type:s}),a=new FileReader;a.onload=e=>{
e.target?r(e.target.result):n(new Error("Could not convert array to string!"))},t&&t.encoding?a.readAsText(o,t.encoding):a.readAsBinaryString(o)}),str2ab:(e,t)=>new Promise(r=>{r(n(e,t))}),dataUri2Blob:e=>{let t;t=e.split(",")[0].includes("base64")?window.atob(e.split(",")[1]):window.unescape(e.split(",")[1]);const r=e.split(",")[0].split(":")[1].split(";")[0],n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return new window.Blob([n],{type:r})},blob2dataUri:(e,t)=>{
const r=new window.FileReader;r.onload=e=>{var r;t((null===(r=e.target)||void 0===r?void 0:r.result)||null)},r.readAsDataURL(e)},blob2str:async(e,t)=>new Promise(r=>{const n=new FileReader;n.onload=()=>{r(n.result||"")},n.onerror=e=>{console.warn("unable to decode data "+e),r("")},t?n.readAsText(e,t):n.readAsBinaryString(e)})};t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),
t.determineOriginOfUrl=t.HEADER_STOP=t.HEADER_START=t.versionCmp=t.createScriptFromSrc=t.processHeader=t.processMetaHeader=t.createScript=t.init=void 0;const n=r(3),s=r(10),o=r(0),a=r(2);let i;const A={},l=e=>{const t=null==e?void 0:e.keys,r={keys:t,default:()=>[],set:(e,t)=>(e.push(t),e)};return(null==t?void 0:t.length)&&t.forEach(e=>A[e]=r),r},c=e=>{const t=null==e?void 0:e.keys,r={keys:t,default:()=>null,set:(t,r)=>{const n=(null==e?void 0:e.convert)?e.convert(r):r;return null===t?n:t}}
;return(null==t?void 0:t.length)&&t.forEach(e=>A[e]=r),r},u=e=>{const t=null==e?void 0:e.keys,r={keys:t,default:()=>({}),set:(t,r,n)=>{n=n?o.normalizeLocale(n):"default";const s=(null==e?void 0:e.convert)?e.convert(r):r;return t[n]=t[n]||s,t}};return(null==t?void 0:t.length)&&t.forEach(e=>A[e]=r),r},d={name:u({convert:e=>null==e?void 0:e.replace(/\s\s+/g," ")}),version:c({convert:e=>(null==e?void 0:e.replace(/\s/g,""))||e}),grants:l({keys:["grant"]}),icon:c({
keys:["icon","iconURL","iconUrl","defaulticon"]}),icon64:c({keys:["icon64","iconURL64"]}),supportURL:c({keys:["supportURL","supportUrl"]}),fileURL:c(),downloadURL:c({keys:["downloadURL","downloadUrl"]}),updateURL:c({keys:["updateURL","updateUrl"]}),namespace:c({convert:e=>""===e?null:e}),author:c(),copyright:c(),homepage:c({keys:["homepage","homepageURL","homepageUrl","website","source"]}),description:u(),includes:l({keys:["include"]}),excludes:l({keys:["exclude"]}),matches:l({keys:["match"]}),
requires:l({keys:["require"]}),resources:(e=>{const t=null==e?void 0:e.keys,r={keys:t,default:()=>({}),set:(t,r)=>{const n=r.match(/^(\S*)\s+(.*)/);if(n&&void 0===t[n[1]]){const r=(null==e?void 0:e.convert)?e.convert(n[2]):n[2];t[n[1]]=r}return t}};return(null==t?void 0:t.length)&&t.forEach(e=>A[e]=r),r})({keys:["resource"]}),noframes:(()=>{const e=void 0,t={default:()=>null,set:()=>!0};return(null==e?void 0:e.length)&&e.forEach(e=>A[e]=t),t})(),connects:l({
keys:["connect","connect-src","domain"]}),webRequest:l(),"run-at":c(),antifeatures:(e=>{const t=null==e?void 0:e.keys,r={keys:t,default:()=>({}),set:(t,r,n)=>{var s;n=n?o.normalizeLocale(n):"default";const a=r.match(/^(\S*)\s+(.*)/);if(a){const r=t[s=a[1]]||(t[s]={}),o=(null==e?void 0:e.convert)?e.convert(a[2]):a[2];r[n]=o}return t}};return(null==t?void 0:t.length)&&t.forEach(e=>A[e]=r),r})({keys:["antifeature"]})},g={};Object.entries(d).forEach(([e,t])=>{t.keys?t.keys.forEach(t=>{g[t]=e
}):g[e]=e});const p="==UserScript==";t.HEADER_START=p;const m="==/UserScript==";t.HEADER_STOP=m;const f=/(?:^|\n)\s*\/\/\x20*==UserScript==([\s\S]*?\n)\s*\/\/\x20*==\/UserScript==|$/,h=()=>({...{...Object.fromEntries(Object.keys(d).map(e=>[e,d[e].default()]))}}),R=e=>{const t=e.match(f),r=(t?t[1]:"")||"",n={};return r.replace(/(?:^|\n)\s*\/\/\s*(@\S+)(.*)/g,(e,t,r)=>{const[s,o]=t.slice(1).split(":"),a=g[s],i=A[a]||d[a]||void 0;if(i){const e=r.trim();let t=n[a];void 0===t&&(t=i.default()),
n[a]=i.set(t,e,o)}else(null==n?void 0:n.name)&&(null==n?void 0:n.name).default;return""}),{...h(),...n}},v=e=>{const{name:t,description:r,version:n,grants:s,fileURL:o,requires:a,resources:i,webRequest:A,namespace:l,noframes:c,author:u,copyright:d,antifeatures:g}=e;let{icon:p,icon64:m,updateURL:f,downloadURL:h,supportURL:R,homepage:v,includes:b,matches:w,excludes:k,connects:_}=e;const y=e["run-at"]||null,E=(e,{[e]:t,...r})=>r,I=s.filter(e=>e);p=p||null,m=m||null,f=f||null,h=h||null,R=R||null,
v=v||null;const x=t.default,T=r.default,M=E("default",t),S=E("default",r);b=b.filter(e=>e),w=w.filter(e=>e),k=k.filter(e=>e),_=_.filter(e=>e);const G=Object.entries(i).map(([e,t])=>({name:e,url:t,loaded:!1})).filter(e=>e.url);return{name:x,description:T,version:n||"0.0",grant:I,icon:p,icon64:m,supportURL:R,fileURL:o,downloadURL:h,updateURL:f,namespace:l,requires:a.filter(e=>e).map(e=>({url:e,loaded:!1,textContent:""})),includes:b,matches:w,excludes:k,homepage:v,resources:G,connects:_,
webRequest:A.map(e=>{const t=JSON.parse(e);return Array.isArray(t)?t:[t]}).reduce((e,t)=>e.concat(t),[]),author:u,copyright:d,antifeatures:g,name_i18n:M,description_i18n:S,uuid:null,system:!1,enabled:!0,position:0,blockers:[],lastModified:0,sync:{imported:!1},options:{check_for_updates:!0,comment:null,compatopts_for_requires:!0,compat_wrappedjsobject:!1,compat_metadata:!1,compat_foreach:!1,compat_prototypes:!1,noframes:c,run_at:y,override:{use_includes:[],orig_includes:[],merge_includes:!0,
use_matches:[],orig_matches:[],merge_matches:!0,use_excludes:[],orig_excludes:[],merge_excludes:!0,use_connects:[],merge_connects:!0,use_blockers:[],orig_run_at:null,orig_noframes:null}},textContent:null,header:null}},b=(()=>{const e=e=>{const t=e.split(".");return t.slice(0,3).concat([t.slice(3).join(".")]).concat([0,0,0,0]).slice(0,4).map(e=>{const t=e.toString().match(/((?:\-?[0-9]+)?)([^0-9\-]*)((?:\-?[0-9]+)?)(.*)/);return t?[Number(t[1]),t[2],Number(t[3]),t[4]]:[]
}).reduce((e,t)=>e.concat(t))},t=(r,n)=>{const s=Array.isArray(r)?r:e(r),o=Array.isArray(n)?n:e(n);for(let e=0;e<16;e++){const r=s[e],n=o[e];if(e%2==1){if(!r&&n)return t.eNEWER;if(r&&!n)return t.eOLDER;const e=r.match(/\w/g)||[],s=n.match(/\w/g)||[];for(let r=0;r<Math.min(e.length,s.length);r++){if(e[r].charCodeAt(0)>s[r].charCodeAt(0))return t.eNEWER;if(e[r].charCodeAt(0)<s[r].charCodeAt(0))return t.eOLDER}if(e.length>s.length)return t.eNEWER;if(e.length<s.length)return t.eOLDER}else{
if(Number(r)>Number(n))return t.eNEWER;if(Number(r)<Number(n))return t.eOLDER}}return t.eEQUAL};return t.eERROR=-2,t.eOLDER=-1,t.eEQUAL=0,t.eNEWER=1,t})();t.versionCmp=b,t.createScriptFromSrc=e=>{const t=(e=>{const t=n.getStringBetweenTags(e,p,m);if(!t)return null;const r=e.indexOf(p),s=e.indexOf("<html>"),o=e.indexOf("<body>");return s>0&&s<r||o>0&&o<r?null:["// ",p,t,m].join("")})(e);if(!t)return null;const r=w(t);return r?(r.textContent=e,r.header=t,
r.options.compat_wrappedjsobject=e!=i.unWrappedJsObjectify(e),r.options.compat_metadata=e!=i.unMetaDataify(e),r):null};const w=e=>{const t=(e=>R(e))(e=(e=(e=(e=(e||"").replace(/(\r\n|\n|\r)/gm,"\n")).replace(/\t/g,"    ")).replace(/\n\n+/g,"\n")).replace(/[^|\n][ \t]+\/\//g,"//"));if(t)return v(t)};t.processHeader=w,t.processMetaHeader=e=>R(e),t.createScript=()=>v(h())||{},t.init=e=>{i=e}
;const k="try to take over the world!",_="This script was deleted from Greasy Fork, and due to its negative effects, it has been automatically removed from your browser.",y=s.createCache({timeout:600,retimeout_on_get:!0});t.determineOriginOfUrl=e=>{if(e){let t;const r=e.match(new RegExp("https?://userscripts\\.org/scripts/(source|version)/([0-9]{1,9})\\.user\\.js"))||e.match(new RegExp("https?://userscripts-mirror\\.org/scripts/(source|version)/([0-9]{1,9})\\.user\\.js"))
;if(r&&3==r.length)return{id:r[2],token:"uso",updates:!1,meta_url:!0,url:"http://userscripts-mirror.org/scripts/show/"+r[2],code_url:"http://userscripts-mirror.org/scripts/review/"+r[2],issue_url:"http://contactbyweb.com/userscripts-mirror"};const n=e.match(new RegExp("https?://greasyfork\\.org/(?:[^/]+/)?scripts/([^/-]+).*/code.*\\.user\\.js"));if(n&&2==n.length)return t=n[1],{id:t,token:"gf",updates:!0,meta_url:!0,url:"https://greasyfork.org/scripts/"+t,
issue_url:"https://greasyfork.org/scripts/"+t+"/feedback",code_url:"https://greasyfork.org/scripts/"+t+"/code",updates_allowed:function(e){return!e.match(new RegExp("https?://greasyfork\\.org/scripts/([^/]+)/code/.*\\.user\\.js.*version=[0-9]+.*"))},convert:async e=>{var t;let r,n=e;if(n){const s=null===(t=e.description)||void 0===t?void 0:t.trim();s===k?n.description="":s===_&&(n=null,r="deleted by hoster")}return{script:n,warning:r}}}
;const s=e.match(new RegExp("https?://sleazyfork\\.org/(?:[^/]+/)?scripts/([^/-]+).*/code.*\\.user\\.js"));if(s&&2==s.length)return t=s[1],{id:t,token:"sf",updates:!0,meta_url:!0,url:"https://sleazyfork.org/scripts/"+t,issue_url:"https://sleazyfork.org/scripts/"+t+"/feedback",code_url:"https://sleazyfork.org/scripts/"+t+"/code",updates_allowed:function(e){return!e.match(new RegExp("https?://sleazyfork\\.org/scripts/([^/]+)/code/.*\\.user\\.js.*version=[0-9]+.*"))},convert:async e=>{var t
;let r,n=e;if(n){const s=null===(t=e.description)||void 0===t?void 0:t.trim();s===k?n.description="":s===_&&(n=null,r="deleted by hoster")}return{script:n,warning:r}}};const o=e.match(new RegExp("https?://openuserjs\\.org/install/([^/]+)+/(.+?)(?:\\.min)?\\.user\\.js"));if(o&&3==o.length)return o.shift(),{id:o.join("/"),token:"ouj",updates:!0,meta_header:!0,url:"https://openuserjs.org/scripts/"+o[0]+"/"+o[1],issue_url:"https://openuserjs.org/scripts/"+o[0]+"/"+o[1]+"/issues",
code_url:"https://openuserjs.org/scripts/"+o[0]+"/"+o[1]+"/source",convert:async e=>{var t;const r=e;return r&&(null===(t=e.description)||void 0===t?void 0:t.trim())===k&&(r.description=""),{script:r,warning:void 0}}}
;const i=e.match(new RegExp("https?://raw\\.githubusercontent\\.com/([^/]+)/([^/]+)/[^/]+/(.*)\\.user\\.js"))||e.match(new RegExp("https?://github\\.com/([^/]+)/([^/]+)/raw/[^/]+/(.*)\\.user\\.js"))||e.match(new RegExp("https?://raw.github\\.com/([^/]+)/([^/]+)/[^/]+/(.*)\\.user\\.js"))||e.match(new RegExp("https?://github\\.com/([^/]+)/([^/]+)/releases/download/[^/]+/(.*)\\.user\\.js")),A=e.match(new RegExp("https?://(([^\\.]+).github\\.io)/(.*)\\.user\\.js"))
;if(i&&4==i.length||A&&4==A.length){let e;if(i){i.shift();const[r,n,s]=i;e=[r,n].join("/"),t=[r,n].concat(n==s?[]:s).join("/")}else{if(!A)throw new Error("Should never happen!");{A.shift();const[r,n,s]=A;e=[n,r].join("/"),t=[n,r].concat(r==s?[]:s).join("/")}}return{id:t,token:"gh",updates:!0,url:"https://github.com/"+e,issue_url:"https://github.com/"+e+"/issues"}}
const l=e.match(new RegExp("https?://gist\\.github\\.com/([^/]+)/([^/]+)/raw/(.*/)?.*\\.user\\.js"))||e.match(new RegExp("https?://gist\\.githubusercontent\\.com/([^/]+)/([^/]+)/raw/(.*/)?.*\\.user\\.js"));if(l&&(3==l.length||4==l.length)){const e=l[1],r=l[2];return t=`${e}/${r}`,{id:t,token:"gst",updates:4==l.length,url:"https://gist.github.com/"+t,issue_url:`https://gist.github.com/${t}#new_comment_field`,code_url:"https://gist.github.com/"+t,precheck:async()=>{const t=y.get(e);let n;if(t){
if(n=t.json,!n)return"cache error"}else{const t=await fetch(`https://api.github.com/users/${e}/gists`,{method:"GET",mode:"cors",cache:"no-cache",credentials:"same-origin",headers:{Accept:"application/vnd.github.v3+json"},redirect:"follow",referrerPolicy:"no-referrer"});if(200!==t.status){a.logger.warn(`Unable to load gists of "${e}" -> SKIPPING`);const t="unable to load gists of user";return y.set(e,{error:t}),t}n=await t.json(),y.set(e,{error:null,json:n})}
return n?n.reduce((e,t)=>(e[t.id]=t.public,e),{})[r]?null:"secret gist":"unable to decode gists of user"}}}const c=e.match(new RegExp("https?://gitlab\\.com/([^/]+)/([^/]+)/(?:-/)?(?:raw|blob)/[^/]+/(.*)\\.user\\.js"));if(c&&4==c.length){c.shift();const[e,r,n]=c;t=[e,r].concat(r==n?[]:n).join("/");const s=[e,r].join("/");return{id:t,token:"gl",updates:!0,url:"https://gitlab.com/"+s,issue_url:"https://gitlab.com/"+s+"/issues"}}
const u=e.match(new RegExp("https?://bitbucket\\.org/([^/]+)/([^/]+)/raw/[^/]+/(.*)\\.user\\.js"))||e.match(new RegExp("https?://bitbucket\\.org/([^/]+)/([^/]+)/downloads/(.*)\\.user\\.js"));if(u&&4==u.length){u.shift();const[e,r,n]=u;t=[e,r].concat(r==n?[]:n).join("/");const s=[e,r].join("/");return{id:t,token:"bb",updates:!0,url:"https://bitbucket.org/"+s,issue_url:"https://bitbucket.org/"+s+"/issues"}}
const d=e.match(new RegExp("https?://userstyles\\.org/styles/userjs/([^/]+)/.*\\.user\\.js"));if(d&&2==d.length)return d.shift(),{id:d[0],token:"usty",updates:!0,url:"https://userstyles.org/styles/"+d[0],issue_url:"https://forum.userstyles.org/post/discussion?Discussion/StyleID="+d[0],convert:async e=>{let t,r,n,s;const o=[{tag:"includes",re:/(?: \|\| \(new RegExp\("\^)([^$]+)(?:\$"\)\)\.test\(document\.location\.href\))/g,idx:1,value:e=>"/^"+e.replace(/\\\\(.)/g,"\\$1")+"$/"},{tag:"includes",
re:/(?: \|\| \(document\.location\.href\.indexOf\(")([^\"]+)"(?:\) == 0\))/g,idx:1,value:e=>e+"*"},{tag:"matches",re:/(?: \|\| \(document\.domain == ")([^\"]+)"(?: \|\| document\.domain\.substring\(document\.domain\.indexOf\("[^\"]+"\) \+ 1\) == "[^\"]+"\))/g,idx:1,value:e=>"*."+e}],a=new RegExp("(?:if \\(false)("+o.map(e=>"(?:"+e.re.source+")").join("|")+")+","g")
;return e.textContent&&0===e.includes.length&&0===e.matches.length&&0===e.excludes.length&&e.options&&e.options.override&&e.options.override.orig_includes&&0===e.options.override.orig_includes.length&&e.options.override.orig_matches&&0===e.options.override.orig_matches.length&&(r=e.textContent.match(a))&&(r.forEach(t=>{o.forEach(r=>{for(;n=r.re.exec(t);)if(n.length>r.idx){const t=r.value(n[r.idx]);e.options.override["orig_"+r.tag].push(t),e[r.tag].push(t),s=!0}})}),s&&(t="includes added")),{
script:e,info:t}}};const g=e.match(new RegExp("https://static\\.iitc\\.me/build/release/(plugins/)?(.*)\\.user\\.js"));if(g&&3===g.length){g.shift();const[e,r]=g,n="iitc-project/ingress-intel-total-conversion";return t=[n].concat(e?[e,r]:[]).join("/").replace(/\/\//g,"/"),{id:t,token:"gh",updates:!0,url:"https://github.com/"+n,issue_url:"https://github.com/"+n+"/issues"}}const p=e.match(new RegExp("https://iitc\\.app/build/release/(plugins/)?(.*)\\.user\\.js"));if(p&&3===p.length){p.shift()
;const[e,r]=p,n="IITC-CE/ingress-intel-total-conversion";return t=[n].concat(e?[e,r]:[]).join("/").replace(/\/\//g,"/"),{id:t,token:"gh",updates:!0,url:"https://github.com/"+n,issue_url:"https://github.com/"+n+"/issues"}}if(e.match(new RegExp("https?://socialfixer\\.com/socialfixer\\.user\\.js")))return{id:"socialfixer",token:"web",updates:!0,url:"http://socialfixer.com",issue_url:"https://www.facebook.com/groups/SocialFixerUsersSupport/"}
;if(e.match(new RegExp("https?://www\\.fbpurity\\.com/.*\\.user\\.js")))return{id:"fbpurity",token:"web",updates:!0,url:"https://www.fbpurity.com/",issue_url:"https://www.facebook.com/fluffbustingpurity"}}}},,function(e,t,r){"use strict";const n=rea.FEATURES;let s=null,o=n.PINGPONG.RETRIES;const a=(e,t)=>{const r=()=>{null!=s&&window.clearTimeout(s),s=null},n=t=>{t?(r(),e&&(e(t),e=null)):console.log("pp: Warn: got pseudo response!")};s=window.setTimeout(()=>{if(r(),o-- >0)return a(e,t),
void(e=t=null);t&&t()},5e3);const i={method:"ping"};try{rea.extension.sendMessage(i,n)}catch(e){}};var i=a,A=r(0);const l=rea.FEATURES;var c=[];let u=null;const d=(()=>{const e=l.HTML5.LOCALSTORAGE;let t,r;return{cache:function(){const t=document.documentElement,r=location.pathname;if(e&&t&&r)try{const n=JSON.parse(e.getItem("background")||"{}");n[r]={class:t.getAttribute("class")},e.setItem("background",JSON.stringify(n))}catch(e){}},reset:function(){r=!0;const e=document.documentElement
;"string"==typeof t&&e&&e.setAttribute("class",t)},restore:function(){if(r)return;const n=location.pathname;if(e&&n)try{let r;const s=e.getItem("background");if(s&&(r=JSON.parse(s))&&(r=r[n])&&r.class){const e=document.documentElement;if(!e)return;t=e.getAttribute("class")||"",e.setAttribute("class",t+" "+r.class)}}catch(e){}}}})(),g=e=>{const t=()=>{e(),d.restore()};R?document.body?t():window.addEventListener("DOMContentLoaded",t):(h=h||[]).push(()=>{g(e)}),u&&(window.clearTimeout(u),u=null)}
;c=[{name:A.I18N.getMessage("Default"),layout:"default"},{name:A.I18N.getMessage("Default_Light"),layout:"default",theme:"light"},{name:A.I18N.getMessage("Default_Dark"),layout:"default",theme:"dark"},{name:A.I18N.getMessage("Default_Darker"),layout:"default",theme:"darker",footer:'Theme by <a href="https://github.com/narcolepticinsomniac" target="blank">narcolepticinsomniac</a> from the <a href="https://github.com/openstyles/stylus" target="blank">Stylus</a> project.'}];let p=!1;const m={
default:A.I18N.getMessage("Default"),monokai:"Monokai",solarized:"Solarized","mdn-like":"MDN-like",eclipse:"Eclipse",railscasts:"RailsCasts",zenburn:"ZenBurn"},f=()=>(p||(c=c.map(e=>(e.value=e.theme?[e.layout,e.theme].join("#"):e.layout,e)),p=!0),c);var h,R=!1;const v={init:e=>{R=!0,h&&(h.forEach(e=>{e()}),h=null),d.restore(),i(t=>{let r,n,s;var o;t&&(r=t.config)&&(n=r.layout)&&(r.dark&&!n.includes("#")&&(n+="#dark"),(o=(e=>{let t;return f().some(r=>{if(r.value===e)return t=r,!0}),t
})(n)).theme&&"light"!==o.theme?(o.footer&&$(".footer").html(o.footer),s=o.theme):s="default",d.reset(),$(document.documentElement).addClass([rea.FEATURES.RUNTIME.MOBILE?"mobile":"desktop",s].join(" ")),window.setTimeout(d.cache,500)),e.suc&&e.suc()},e.fail)},images:{origin:function(e){return"gst"==e&&(e="gh"),{
unknown:"data:image/png;base64, ",
uso:"data:image/png;base64, ",
gf:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3ggEBCQHM3fXsAAAAVdJREFUOMudkz2qwkAUhc/goBaGJBgUtBCZyj0ILkpwAW7Bws4yO3AHLiCtEFD8KVREkoiFxZzX5A2KGfN4F04zMN+ce+5c4LMUgDmANYBnrnV+plBSi+FwyHq9TgA2LQpvCiEiABwMBtzv95RSfoNEHy8DYBzHrNVqVEr9BWKcqNFoxF6vx3a7zc1mYyC73a4MogBg7vs+z+czO50OW60Wt9stK5UKp9Mpj8cjq9WqDTBHnjAdxzGQZrPJw+HA31oulzbAWgLoA0CWZVBKIY5jzGYzdLtdE9DlcrFNrY98zobqOA6TJKHW2jg4nU5sNBpFDp6mhVe5rsvVasUwDHm9Xqm15u12o+/7Hy0gD8KatOd5vN/v1FozTVN6nkchxFuI6hsAAIMg4OPxMJCXdtTbR7JJCMEgCJhlGUlyPB4XfumozInrupxMJpRSRtZlKoNYl+m/6/wDuWAjtPfsQuwAAAAASUVORK5CYII=",
gh:"data:image/png;base64, ",
gl:"data:image/png;base64, ",
bb:"data:image/png;base64, ",
ouj:"data:image/x-icon;base64, ",
usty:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PHRpdGxlPjlDMzAwNDI3LTg4Q0QtNDI2RC05QkZELUFEMUU2RUI2RjRDNjwvdGl0bGU+PGRlZnM+PHBhdGggZD0iTTAgNS42MjNBNS42MjMgNS42MjMgMCAwIDEgNS42MjMgMGgxMi43NTRBNS42MjMgNS42MjMgMCAwIDEgMjQgNS42MjN2MTIuNzU0QTUuNjIzIDUuNjIzIDAgMCAxIDE4LjM3NyAyNEg1LjYyM0E1LjYyMyA1LjYyMyAwIDAgMSAwIDE4LjM3N1Y1LjYyM3oiIGlkPSJhIi8+PC9kZWZzPjxnIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PG1hc2sgaWQ9ImIiIGZpbGw9IiNmZmYiPjx1c2UgeGxpbms6aHJlZj0iI2EiLz48L21hc2s+PHVzZSBmaWxsLW9wYWNpdHk9IjAiIGZpbGw9IiNGRkYiIHhsaW5rOmhyZWY9IiNhIi8+PHBhdGggZmlsbD0iIzJFQ0M3MSIgbWFzaz0idXJsKCNiKSIgZD0iTTExLjI1IDB2MTQuNjI1SDBWMHoiLz48cGF0aCBmaWxsPSIjRTc0QzNDIiBtYXNrPSJ1cmwoI2IpIiBkPSJNMjQgMHY3Ljg3NUgxMi43NVYweiIvPjxwYXRoIGZpbGw9IiNGMzlDMTIiIG1hc2s9InVybCgjYikiIGQ9Ik0xMS4yNSAxNi4xMjVWMjRIMHYtNy44NzV6Ii8+PHBhdGggZmlsbD0iIzM0OThEQiIgbWFzaz0idXJsKCNiKSIgZD0iTTI0IDkuNTYzdjE0LjYyNEgxMi43NVY5LjU2M3oiLz48L2c+PC9zdmc+"
}[e]},brand:function(e){return"data:image/svg+xml,"+encodeURI({
tampermonkey:"<?xml version='1.0' encoding='utf-8'?><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 400'><g id='XMLID_273_'><g id='XMLID_78_'><path id='XMLID_83_' class='st0' d='M304.8,0H95.2C42.6,0,0,42.6,0,95.2v209.6C0,357.4,42.6,400,95.2,400h209.6 c52.6,0,95.2-42.6,95.2-95.2V95.2C400,42.6,357.4,0,304.8,0z M106.3,375C61.4,375,25,338.6,25,293.8c0-44.9,36.4-81.3,81.3-81.3 c44.9,0,81.3,36.4,81.3,81.3C187.5,338.6,151.1,375,106.3,375z M293.8,375c-44.9,0-81.3-36.4-81.3-81.3 c0-44.9,36.4-81.3,81.3-81.3c44.9,0,81.3,36.4,81.3,81.3C375,338.6,338.6,375,293.8,375z'/></g><g id='XMLID_67_' class='st2'><path id='XMLID_74_' class='st3' d='M304.8,0H95.2C42.6,0,0,42.6,0,95.2v209.6C0,357.4,42.6,400,95.2,400h209.6 c52.6,0,95.2-42.6,95.2-95.2V95.2C400,42.6,357.4,0,304.8,0z M106.3,375C61.4,375,25,338.6,25,293.8c0-44.9,36.4-81.3,81.3-81.3 c44.9,0,81.3,36.4,81.3,81.3C187.5,338.6,151.1,375,106.3,375z M293.8,375c-44.9,0-81.3-36.4-81.3-81.3 c0-44.9,36.4-81.3,81.3-81.3c44.9,0,81.3,36.4,81.3,81.3C375,338.6,338.6,375,293.8,375z'/></g></g></svg>",
webdav:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 512'><path d='M537.585 226.56C541.725 215.836 544 204.184 544 192c0-53.019-42.981-96-96-96-19.729 0-38.065 5.954-53.316 16.159C367.042 64.248 315.288 32 256 32c-88.366 0-160 71.634-160 160 0 2.728.07 5.439.204 8.133C40.171 219.845 0 273.227 0 336c0 79.529 64.471 144 144 144h368c70.692 0 128-57.308 128-128 0-61.93-43.983-113.586-102.415-125.44z'/></svg>",
yandex:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 512'><path d='M153.1 315.8L65.7 512H2l96-209.8c-45.1-22.9-75.2-64.4-75.2-141.1C22.7 53.7 90.8 0 171.7 0H254v512h-55.1V315.8h-45.8zm45.8-269.3h-29.4c-44.4 0-87.4 29.4-87.4 114.6 0 82.3 39.4 108.8 87.4 108.8h29.4V46.5z'/></svg>",
firefox:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 496 512'><path d='M496 262.5C497.6 380.8 388.9 504 248 504c-106.7 0-190.9-62.5-229.8-151.7-43-97.7-5.7-251.6 70.3-320.3l-2.7 69.7c3.9-5 32.5-6.4 37.1 0C139 71 190.7 48 232.1 47.2c-15.8 13.3-52.2 61.6-49.2 86.2 20.2 6.4 51.1 6.6 67.4 7.7 5 2.8 4.1 19.6-5.8 33.4 0 0-13 18-48.1 24.3l2.7 41.1-37-7.4c-12.4 31.5 17.4 59.4 48.4 54.2 34.3-5.8 45.9-32 70-30.6 23.8 1.4 33.2 14.6 30.1 27.1 0 0-3.9 14.9-29.6 12.4-21.8 34.5-50.4 53.5-97.3 49.4 71.3 59.1 168.3 5.5 192.6-42.8 24.3-48.1 8-122.1-16.3-142.3 28.7 12.4 43.7 27.6 54.2 55.5 5.5-61.9-22.9-132.1-73.8-173.3C436 70.1 494.3 144.2 496 262.5z'/></svg>",
chrome:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 496 512'><path d='M131.5 217.5L55.1 100.1c47.6-59.2 119-91.8 192-92.1 42.3-.3 85.5 10.5 124.8 33.2 43.4 25.2 76.4 61.4 97.4 103L264 133.4c-58.1-3.4-113.4 29.3-132.5 84.1zm32.9 38.5c0 46.2 37.4 83.6 83.6 83.6s83.6-37.4 83.6-83.6-37.4-83.6-83.6-83.6-83.6 37.3-83.6 83.6zm314.9-89.2L339.6 174c37.9 44.3 38.5 108.2 6.6 157.2L234.1 503.6c46.5 2.5 94.4-7.7 137.8-32.9 107.4-62 150.9-192 107.4-303.9zM133.7 303.6L40.4 120.1C14.9 159.1 0 205.9 0 256c0 124 90.8 226.7 209.5 244.9l63.7-124.8c-57.6 10.8-113.2-20.8-139.5-72.5z'/></svg>",
onedrive:"<svg xmlns='http://www.w3.org/2000/svg' id='Layer_1' data-name='Layer 1' viewBox='0 0 24 24'><title>Artboard 1</title><g id='Templates'><path d='M17,10.57a3,3,0,0,1,1.18.23,3.11,3.11,0,0,1,1,.64,2.82,2.82,0,0,1,.65,1,3,3,0,0,1-1.6,3.95,3.08,3.08,0,0,1-1.16.23H8a4,4,0,0,1-1.56-.31,4,4,0,0,1,0-7.38A4,4,0,0,1,8,8.57a3.54,3.54,0,0,1,.73.07,4.63,4.63,0,0,1,.72-.87,4.72,4.72,0,0,1,.89-.65,4.58,4.58,0,0,1,1-.41,4.79,4.79,0,0,1,1.13-.14,4.37,4.37,0,0,1,1.64.3,4.55,4.55,0,0,1,1.36.84,4.39,4.39,0,0,1,1,1.27A4.66,4.66,0,0,1,17,10.57Z'/></g></svg>",
gdrive:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path d='M339 314.9L175.4 32h161.2l163.6 282.9H339zm-137.5 23.6L120.9 480h310.5L512 338.5H201.5zM154.1 67.4L0 338.5 80.6 480 237 208.8 154.1 67.4z'/></svg>",
dropbox:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path d='M256 87.2l-151.9 93.9L0 97.5 150.6 0 256 87.2zM0 265.3l150.6 98.3 105.4-88L104.1 181 0 265.3zm256 10.3l105.4 88L512 265.3l-104.1-84.2L256 275.6zM512 97.5L361.4 0 256 87.2l151.9 93.9L512 97.5zM256.3 294.6l-105.7 87.7-45.2-29.5V385l150.9 90.5L407.2 385v-32.2L362 382.3l-105.7-87.7z'/></svg>",
instagram:"<svg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='5 4 44 44' style='enable-background:new 5 4 44 44;' xml:space='preserve'><style type='text/css'>.st0{fill:none;}</style><g><rect x='-0.2' y='0.1' class='st0' width='53.8' height='53.4'/><path d='M48.1,26.3c0,4.3,0,7.2-0.1,8.8c-0.2,3.9-1.3,6.9-3.5,9s-5.1,3.3-9,3.5c-1.6,0.1-4.6,0.1-8.8,0.1c-4.3,0-7.2,0-8.8-0.1 c-3.9-0.2-6.9-1.3-9-3.5c-2.1-2.1-3.3-5.1-3.5-9c-0.1-1.6-0.1-4.6-0.1-8.8s0-7.2,0.1-8.8c0.2-3.9,1.3-6.9,3.5-9 c2.1-2.1,5.1-3.3,9-3.5c1.6-0.1,4.6-0.1,8.8-0.1c4.3,0,7.2,0,8.8,0.1c3.9,0.2,6.9,1.3,9,3.5s3.3,5.1,3.5,9 C48,19.1,48.1,22,48.1,26.3z M28.8,8.7c-1.3,0-2,0-2.1,0c-0.1,0-0.8,0-2.1,0c-1.3,0-2.3,0-2.9,0c-0.7,0-1.6,0-2.7,0.1 c-1.1,0-2.1,0.1-2.9,0.3c-0.8,0.1-1.5,0.3-2,0.5c-0.9,0.4-1.7,0.9-2.5,1.6c-0.7,0.7-1.2,1.5-1.6,2.5c-0.2,0.5-0.4,1.2-0.5,2 s-0.2,1.7-0.3,2.9c0,1.1-0.1,2-0.1,2.7c0,0.7,0,1.7,0,2.9c0,1.3,0,2,0,2.1s0,0.8,0,2.1c0,1.3,0,2.3,0,2.9c0,0.7,0,1.6,0.1,2.7 c0,1.1,0.1,2.1,0.3,2.9s0.3,1.5,0.5,2c0.4,0.9,0.9,1.7,1.6,2.5c0.7,0.7,1.5,1.2,2.5,1.6c0.5,0.2,1.2,0.4,2,0.5 c0.8,0.1,1.7,0.2,2.9,0.3s2,0.1,2.7,0.1c0.7,0,1.7,0,2.9,0c1.3,0,2,0,2.1,0c0.1,0,0.8,0,2.1,0c1.3,0,2.3,0,2.9,0 c0.7,0,1.6,0,2.7-0.1c1.1,0,2.1-0.1,2.9-0.3c0.8-0.1,1.5-0.3,2-0.5c0.9-0.4,1.7-0.9,2.5-1.6c0.7-0.7,1.2-1.5,1.6-2.5 c0.2-0.5,0.4-1.2,0.5-2c0.1-0.8,0.2-1.7,0.3-2.9c0-1.1,0.1-2,0.1-2.7c0-0.7,0-1.7,0-2.9c0-1.3,0-2,0-2.1s0-0.8,0-2.1 c0-1.3,0-2.3,0-2.9c0-0.7,0-1.6-0.1-2.7c0-1.1-0.1-2.1-0.3-2.9c-0.1-0.8-0.3-1.5-0.5-2c-0.4-0.9-0.9-1.7-1.6-2.5 c-0.7-0.7-1.5-1.2-2.5-1.6c-0.5-0.2-1.2-0.4-2-0.5c-0.8-0.1-1.7-0.2-2.9-0.3c-1.1,0-2-0.1-2.7-0.1C31.1,8.7,30.1,8.7,28.8,8.7z  M34.4,18.5c2.1,2.1,3.2,4.7,3.2,7.8s-1.1,5.6-3.2,7.8c-2.1,2.1-4.7,3.2-7.8,3.2c-3.1,0-5.6-1.1-7.8-3.2c-2.1-2.1-3.2-4.7-3.2-7.8 s1.1-5.6,3.2-7.8c2.1-2.1,4.7-3.2,7.8-3.2C29.7,15.3,32.3,16.3,34.4,18.5z M31.7,31.3c1.4-1.4,2.1-3.1,2.1-5s-0.7-3.7-2.1-5.1 c-1.4-1.4-3.1-2.1-5.1-2.1c-2,0-3.7,0.7-5.1,2.1s-2.1,3.1-2.1,5.1s0.7,3.7,2.1,5c1.4,1.4,3.1,2.1,5.1,2.1 C28.6,33.4,30.3,32.7,31.7,31.3z M39.9,13c0.5,0.5,0.8,1.1,0.8,1.8c0,0.7-0.3,1.3-0.8,1.8c-0.5,0.5-1.1,0.8-1.8,0.8 s-1.3-0.3-1.8-0.8c-0.5-0.5-0.8-1.1-0.8-1.8c0-0.7,0.3-1.3,0.8-1.8c0.5-0.5,1.1-0.8,1.8-0.8S39.4,12.5,39.9,13z'/></g></svg>",
facebook:"<svg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 30 30' style='enable-background:new 0 0 30 30;' xml:space='preserve'><style type='text/css'>.f{}.c{fill:none;}</style><g><circle class='c' cx='15' cy='15' r='13' stroke='black' stroke-width='3'/><path class='f' d='M16.4,23.9v-8.1h2.7l0.4-3.2h-3.1v-2c0-0.9,0.3-1.5,1.6-1.5l1.7,0V6.2c-0.3,0-1.3-0.1-2.4-0.1c-2.4,0-4.1,1.5-4.1,4.2v2.3h-2.7v3.2h2.7v8.1H16.4z'/></g></svg>"
}[e]).replace(/%20/g," ")},empty:"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="},render:g,getLayouts:f,getEditorThemes:()=>Object.keys(m).map(e=>({name:m[e]||e,value:e}))};t.a=v},function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.createQueue=t.createCache=t.sleepEvery=t.sleep=void 0;const s=r(1),o=n(r(18));t.sleep=e=>new o.default(t=>setTimeout(t,e))
;let a=0;t.sleepEvery=(e,t)=>{const r=Date.now();if(a+e<r)return new o.default(e=>window.setTimeout(()=>{a=Date.now(),e()},t||0))},t.createQueue=e=>{const t=[],r=[],n=()=>{let o;if(r.length<e.threads&&t.length&&(o=t.shift())){const e=o.fn();let t;if(void 0!==e.catch){const r=s.Deferred();e.then(r.resolve).catch(r.reject),t=r.promise()}else t=e;r.push(t),t.always(()=>{let e;(e=r.indexOf(t))>-1&&r.splice(e,1),n()}),o.p.consume(t)}};return{add:function(e){const r=s.Deferred();return t.push({fn:e,
p:r}),n(),r.promise()}}},t.createCache=e=>{let t={};const r=(null==e?void 0:e.retimeout_on_get)||!1,n=(null==e?void 0:e.timeout)||300,s=(null==e?void 0:e.check_interval)||120;let o;const a=()=>{o&&clearInterval(o),o=null},i=e=>{delete t[e]},A=()=>{const e=Date.now()-1e3*n;Object.entries(t).forEach(([t,r])=>{r.ts<e&&setTimeout(()=>i(t),1)})},l={init:()=>(o||(a(),o=setInterval(A,1e3*s)),l),set:(e,r)=>{t[e]={value:r,ts:Date.now()}},get:(e,n)=>{let s=n;return t[e]&&(r&&(t[e].ts=Date.now()),
s=t[e].value),s},remove:i,removeAll:()=>{t={}}};return l}},function(e,t,r){"use strict";r.r(t);var n=r(3),s=r(10),o=r(2),a=r(6),i=r.n(a);let A
;const l=e=>["https:","http:","data:","blob"].some(t=>e.startsWith(t)),c=["internal","user-agent","accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"],u={"cache-control":"no-cache",pragma:"no-cache"},d={"cache-control":"max-age=0, must-revalidate"},g=e=>{if(e){const t={}
;return Object.keys(e).forEach(r=>{let n=r,s=e[r];if(A.prefix)o=r.toLowerCase(),(c.includes(o)||0===o.indexOf("proxy-")||0===o.indexOf("sec-"))&&(n=A.prefix+r,s=null===s?"":i.a.encodeS(s));else if(null===s)return;var o;t[n]=s}),t}},p=e=>({responseXML:"",responseText:"",response:null,readyState:4,responseHeaders:"",status:0,statusText:"",error:e=e||"Forbidden"}),m=e=>{if("Blob"===e.type)return new Blob([i.a.str2abSync(e.value)])
;if("File"===e.type)return new File([i.a.str2abSync(e.value)],e.name,{type:e.meta,lastModified:e.lastModified||Date.now()});if("FormData"==e.type){const t=new FormData;return Object.keys(e.value).forEach(r=>{const n="Array"===e.value[r].type,s=m(e.value[r]),o=n?s:[s];o.forEach((e,n)=>{t.append(r,o[n])})}),t}if("Array"===e.type||"Object"===e.type){let t,r,n;"Object"===e?(n=Object.keys(e.value),r=e=>e<n.length?n[e]:null,t={}):(r=t=>t<e.value.length?t:null,t=[])
;for(let n,s=0;null!==(n=r(s));s++)t[n]=m(e.value[n]);return t}return e.value},f=e=>{const t={};return e&&e.split("\n").forEach(e=>{const r=e.match(/^([^:]+): ?(.*)/);if(r){const e=r[1].toLowerCase();t[e]=(void 0!==t[e]?", ":"")+(r[2]||"").replace(/,/g,"%2C")}}),t},h="tm-finalurl"+rea.runtime.short_id.toLowerCase(),R="tm-setcookie"+rea.runtime.short_id.toLowerCase();var v=(e,t,r,s,a)=>{const A=e.responseType?e.responseType.toLowerCase():"",l=e=>{const t=[];let r,n
;return e.headers&&(r=e.headers.get(h)||e.url,e.headers.forEach((e,r)=>{const n=r.toLowerCase();[h,R].includes(n)||t.push(n+":"+e)}),(n=e.headers.get(R))&&t.push("set-cookie:"+n)),{readyState:4,responseHeaders:t.join("\n"),finalUrl:r,status:e.status,statusText:e.statusText}};let c=!1;let u,b,w;const k=e=>{e&&(w=!0),y?y.abort():w?_():_({name:"AbortError",message:"Aborted by user"})},_=e=>{let t;b||(w?(t=l({status:408,statusText:"Request Timeout"}),
s("ontimeout")):"AbortError"==e.name?(t=p("aborted"),s("onabort")):(t=l({status:408,statusText:e.message||"Request Timeout"}),s("onerror",t)),b=!0,s("ondone",t))};try{const p={};let h;p.method=e.method||"GET",p.redirect="follow",e.headers&&(h=g(e.headers)),e.nocache?p.cache="reload":e.revalidate&&(p.cache="default",h=h||{},h={...h,...d}),e.anonymous?p.credentials="omit":p.credentials="include",e.user&&e.password&&(h=h||{},h.Authorization="Basic "+btoa(e.user+":"+e.password)),
h&&(p.headers=new window.Headers(h)),void 0!==e.data&&("typified"===e.data_type?p.body=m(e.data):"string"==typeof e.data?p.body=e.data:p.body=JSON.stringify(e.data));var y=window.AbortController?new window.AbortController:null;y&&(p.signal=y.signal),window.fetch(e.url,p).then(d=>{if(u&&(window.clearTimeout(u),u=null),b)return;let g=l(d);if((0!==g.status||g.status<200||g.status>=300)&&e.retries>0)return e.retries--,void v(e,t,r,s,a);(async()=>{if(d.ok)if(e.partialSize){let t
;["arraybuffer","blob"].includes(A)||void 0!==e.overrideMimeType?(g.response=await d.blob(),t=!1):(g.response=await d.text(),t=!0),g=await(async(t,s)=>{if(e.partialSize){const o=t.response;["response","responseText","responseXML"].forEach(e=>{delete t[e]}),!c&&o&&(c=!0,await(async(t,s)=>{if(!s){if(rea.FEATURES.RUNTIME.SHARED_OBJECT_URLS&&!r.foreign_context){const e={url:URL.createObjectURL(t),type:t.type};return a("onpartial",{objurl:e}),void window.setTimeout(()=>URL.revokeObjectURL(e.url),3e5)
}t=await i.a.blob2str(t)}const o=Object(n.splitSlice)(t,parseInt(e.partialSize));o.forEach((e,t)=>{a("onpartial",{partial:e,index:t,length:o.length})})})(o,s))}return t})(g,t)}else if(void 0!==e.responseType){let e;if("arraybuffer"==A)g.response=await d.arrayBuffer();else if("blob"==A)g.response=await d.blob();else if("document"==A){e=(f(g.responseHeaders)["content-type"]||"text/xml").split(";")[0];const t=new window.DOMParser;g.response=t.parseFromString(await d.text(),e)}else if("json"==A){
const e=await d.text();g.response=JSON.parse(e)}else o.logger.warn("xhr: responseType",A," is not implemented!"),g.response=await d.text()}else if(void 0!==e.overrideMimeType&&window.TextDecoder){const t=await d.arrayBuffer(),r=e.overrideMimeType.toLowerCase().match(/charset=([^;]+)/)[1];g.response=new window.TextDecoder(r).decode(t)}else{const e=await d.text();g.response=e}else g.responseXML=null,g.responseText="",g.response=null})().then(()=>{s("onload",g),s("ondone",g)})}).catch(_),
void 0!==e.timeout&&(u=setTimeout(()=>{u=null,k(!0)},e.timeout))}catch(e){o.logger.error(e.stack);const t=p(e.message);s("onerror",t),s("ondone",t)}return{abort:()=>k()}},b=(e,t,r,a,c)=>{const R=e.responseType?e.responseType.toLowerCase():"";let v,w,k;e.anonymous&&(v=A.mozAnon?{mozAnon:!0}:{anonymous:!0});const _=new XMLHttpRequest(v),y=t=>{let r="",n=e.url;if(_.readyState>=2){let e;r=_.getAllResponseHeaders(),r&&(r=r.replace(/tm-finalurl[0-9a-zA-Z]*\: .*[\r\n]{1,2}/i,""),
r=r.replace(/tm-setcookie[0-9a-zA-Z]*\:/i,"set-cookie:")),(e=_.getResponseHeader(h)||_.responseURL)&&(n=e)}const s={readyState:_.readyState,responseHeaders:r,finalUrl:n,status:_.readyState>=2?_.status:0,statusText:_.readyState>=2?_.statusText:""};return t&&4==_.readyState?_.responseType?(s.responseXML=null,s.responseText=null,s.responseType=_.responseType,s.response=_.response):(s.responseXML=_.responseXML,s.responseText=_.responseText,s.response=_.response):(s.responseXML=null,
s.responseText="",s.response=null),s};let E=!1;const I=async t=>{if(e.partialSize){const s=t.response,o=!["arraybuffer","blob"].includes(R);["response","responseText","responseXML"].forEach(e=>{delete t[e]}),!E&&s&&(E=!0,await(async(t,s)=>{if(!s){if(rea.FEATURES.RUNTIME.SHARED_OBJECT_URLS&&!r.foreign_context){const e={url:URL.createObjectURL(t),type:t.type};return c("onpartial",{objurl:e}),void window.setTimeout(()=>URL.revokeObjectURL(e.url),3e5)}t=await i.a.blob2str(t)}
const o=Object(n.splitSlice)(t,parseInt(e.partialSize));o.forEach((e,t)=>{c("onpartial",{partial:e,index:t,length:o.length})})})(s,o))}return t},x=Object(s.createQueue)({threads:1}),T=e=>(...t)=>x.add(async()=>e(...t)),M={onload:T(async()=>{let n=y(!0);if((0!==n.status||n.status<200||n.status>=300)&&e.retries>0)return e.retries--,void b(e,t,r,a,c);e.partialSize&&(n=await I(n)),await a("onload",n),4==n.readyState&&await a("ondone",n)}),onerror:T(async()=>{const n=y()
;if(4==n.readyState&&200!=n.status&&0!=n.status&&e.retries>0)return e.retries--,void b(e,t,r,a,c);await a("onerror",n),await a("ondone",n)}),onloadstart:T(async()=>{await c("onloadstart",()=>y())}),onreadystatechange:T(async()=>{await c("onreadystatechange",async()=>{let e=y();return e=await I(e),e})}),onprogress:T(async e=>{await c("onprogress",async()=>{let t=y();return t=await I(t),G(e,t,t)})}),ontimeout:T(async()=>{const e=y();await a("ontimeout"),await a("ondone",e)}),onabort:T(async()=>{
const e=p("aborted");await a("onabort"),await a("ondone",e)})},S=0==Object.keys(M).concat(["ondone"]).filter(e=>!!t[e]).length;if(S)throw new Error("Synchronous XHR is not supported anymore");var G=(e,t,r)=>{void 0===r&&(r={});try{let n=null,s=null;if(e.lengthComputable||e.total>0)n=e.loaded,s=e.total;else{const r=!_.responseType||["","text"].includes(_.responseType)?_.responseText:null;let o=Number(f(t.responseHeaders)["content-length"]||"");const a=t.readyState>2&&r?r.length:0;0==o&&(o=-1),
n=e.loaded||a,s=e.total||o}r.lengthComputable=e.lengthComputable,r.loaded=n,r.done=n,r.position=n,r.total=s,r.totalSize=s}catch(e){}return r};Object.keys(M).forEach(e=>{(t[e]||["ontimeout","onload","onerror","onabort"].includes(e))&&(_[e]=M[e])});try{if(!r.internal&&!l(e.url))throw new Error("Invalid scheme of url: "+e.url);_.open(e.method||"GET",e.url,!S,e.user,e.password);let n=g(e.headers);(e.nocache||e.revalidate)&&(n=n||{},e.nocache?n={...n,...u}:e.revalidate&&(n={...n,...d})),
n&&Object.keys(n).forEach(e=>{try{_.setRequestHeader(e,n[e])}catch(t){o.logger.warn("xhr: rejected header",e,n[e])}}),void 0!==e.overrideMimeType&&_.overrideMimeType(e.overrideMimeType),e.partialSize?["arraybuffer","blob"].includes(R)?_.responseType=e.responseType="blob":delete e.responseType:void 0!==e.responseType&&(w=e.responseType.toLowerCase(),["document","json"].includes(w)||(_.responseType=w)),void 0!==e.timeout&&(_.timeout=e.timeout),
void 0!==e.data?("typified"===e.data_type?_.send(m(e.data)):"string"==typeof e.data?_.send(e.data):_.send(JSON.stringify(e.data)),t.onprogress&&_.upload&&(_.upload.onprogress=M.onprogress)):_.send()}catch(e){o.logger.error(e.stack);const t=p(e.message);a("onerror",t),a("ondone",t)}return k=k||{},Object(n.copy)({abort:function(){_.abort()}},k)};const w={run:(e,t,r)=>{const n={...t||{}},s=async(e,t)=>{n[e]&&await n[e]("function"==typeof t?await t():t)},a=async(e,t)=>{n[e]&&(await s(e,t),n[e]=null)
};if(!(r=r||{}).internal&&!l(e.url)){o.logger.warn("xhr: invalid scheme of url:",e.url);const t=p("Invalid scheme");return a("onerror",t),void a("ondone",t)}const i=window.fetch&&e.url&&"http"==e.url.substr(0,4),c=!A.mozAnon&&e.anonymous,u=e.fetch;return i&&(c||u)?v(e,n,r,a,s):b(e,n,r,a,s)},setConfig:function(e){A=e},getConfig:function(){return A},makeErrorResponse:p,parseCookie:e=>{
const t=e.split(";").filter(e=>"string"==typeof e&&!!e.trim()),r=t.shift().split("="),n=r.shift(),s=r.join("="),o={name:n,value:decodeURIComponent(s)};return t.forEach((function(e){var t=e.split("="),r=t.shift().trimLeft().toLowerCase(),n=t.join("=");if("expires"===r){const e=new Date(decodeURIComponent(n));isNaN(e.getTime())||(o.expires=e)}else"max-age"===r?o.maxAge=parseInt(n,10):"secure"===r?o.secure=!0:"httponly"===r?o.httpOnly=!0:"samesite"===r?o.sameSite=n:o[r]=n})),o},parseHeaders:f}
;t.default=w},function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(r(4)),o=(r(2),"mtm_visitor"),a="default",i="pageview",A="script_update",l="script",c="cloud",u="event",d="pageview",g="ping",p="https://a.tampermonkey.net/matomo.php",m=window.rea,f=m.FEATURES.HTML5.LOCALSTORAGE;let h,R,v,b=!1,w=!1;const k=()=>({url:p,siteId:5,tracker:{[a]:{enabled:U(5,10)},[l]:{enabled:!0},[A]:{
enabled:U(5,10)},[c]:{enabled:U(5,.001)}}}),_=()=>({url:p,siteId:6,tracker:{[a]:{enabled:U(6,50)},[l]:{enabled:!0},[A]:{enabled:U(6,10)},[c]:{enabled:U(6,.01)}}}),y={default:k,gcal:k,iikm:()=>({url:p,siteId:4,tracker:{[a]:{enabled:U(4,1)},[l]:{enabled:!0},[A]:{enabled:U(4,10)},[c]:{enabled:U(4,5e-4)}}}),saap:()=>({url:p,siteId:7,tracker:{[a]:{enabled:!0},[l]:{enabled:!0},[A]:{enabled:U(7,10)},[c]:{enabled:U(7,.01)}}}),fire:_,firb:_,dhdg:()=>({url:p,siteId:3,tracker:{[a]:{enabled:U(3,1)},[l]:{
enabled:!0},[A]:{enabled:U(3,10)},[c]:{enabled:U(3,5e-4)}}}),mfdh:k,heif:()=>({url:"http://a.userscript.grobilan:8081/matomo.php",siteId:2,tracker:{[a]:{enabled:!0}}})};let E;const I=[{msg:"a disconnected port"},{msg:"Function.prototype.apply: Arguments list has wrong type",url:"event_bindings"},{msg:"Script error."}],x=e=>[...Array(e)].map(()=>Math.floor(16*Math.random()).toString(16)).join(""),T=e=>{if(!f)return;const t=[e.uuid,e.createTs,e.visitCount,e.currentVisitTs,e.lastVisitTs].join(".")
;f.setItem(o,t)},M=e=>{const t=e||a,r=E.tracker[t]||E.tracker.default;return r.enabled?{url:E.url,siteId:E.siteId,options:r}:null},S=x(6),G=async(e,t,r)=>{if(!e)return;const n=(()=>{if(!f)return;const e=f.getItem(o);if(!e)return;const t=e.split(".");if(t.length>=5){t.unshift("0");const[e,r,n,s,o,a]=t;return{createdNow:!1,newVisitor:e,uuid:r,createTs:n,visitCount:s,currentVisitTs:o,lastVisitTs:a}}})()||(()=>{const e=Math.floor(Date.now()/1e3).toString(),t={createdNow:!0,newVisitor:"1",uuid:x(16),
createTs:e,visitCount:"0",currentVisitTs:e,lastVisitTs:""};return T(t),t})();let a;const i=new Date,A={idsite:e.siteId,rec:1,action_name:document.title||m.runtime.short_id,url:location.href,_id:n.uuid,rand:x(4),apiv:1,h:i.getHours(),m:i.getMinutes(),s:i.getSeconds(),cookie:1,pv_id:S},l={...A,_idts:Number(n.createTs),_idvc:Number(n.visitCount),_viewts:Number(n.lastVisitTs),res:`${screen.width}x${screen.height}`};if(t==d){const e=R?{gt_ms:R}:{},t={...A,...l,...e,new_visit:1};T((e=>{
const t=Math.floor(Date.now()/1e3).toString();return e.newVisitor="0",e.visitCount=(Number(e.visitCount)+1).toString(),e.lastVisitTs=e.currentVisitTs,e.currentVisitTs=t,e})(n)),a=t}else if(t==u){if(!r)return;a={...A,ca:1,e_c:r.category,e_a:r.action,e_n:r.name,e_v:r.value}}else{if(t!=g)return;a={...A,...l,ping:1}}a=Object.assign(A,a);const c=`${e.url}?${s.default.hash2params(a)}`,p=document.createElement("img");p.src=c,p.onload=()=>{var e;null===(e=p.parentNode)||void 0===e||e.removeChild(p)},
p.onerror=()=>{var e;null===(e=p.parentNode)||void 0===e||e.removeChild(p)},(document.body||document.head||document.documentElement).appendChild(p)},U=(e,t)=>{let r=100*Math.random()<t;if(f)try{let n,s;const o=["wsr",e,t].join("_"),a=Date.now(),i=864e7;if(n=f.getItem(o)){try{s=JSON.parse(n)}catch(e){}(!s||s.ts+i<a)&&(s={ts:a,w:r})}else s={ts:a,w:r};r=s.w,f.setItem(o,JSON.stringify(s))}catch(e){}return r},N=e=>{b&&(w=e,w?h&&O&&(O(),O=void 0):v&&(clearInterval(v),v=void 0))};let O=()=>{G(M(i),d),
v=window.setInterval(()=>G(M(i),g),864e5)};const Z=(e,t,r)=>{if(!w||!e.search)return;void 0===t&&(t=""),void 0===r&&(t+=" "+window.location.href,r="");let n=!1;I.forEach(r=>{(r.msg||r.url)&&(r.msg&&-1==e.indexOf(r.msg)||r.url&&-1==t.indexOf(r.url)||(n=!0))}),n||G(M("error"),u,{category:"Error",action:e,name:t+":"+r})},C={init:(e,t,r)=>{const n=((null==r?void 0:r.version)||"")+" ",s=m.runtime.short_id;E=(y[s]||y.default)(),window.onerror=(t,r,s,o,a)=>{let i="";if(a)try{i=a.stack||""}catch(e){}
Z(t.toString(),n+e+"@"+m.extension.urls.prepareForReport(r||""),[s+":"+o,i].join(";"))},document.onsecuritypolicyviolation=t=>{let r="";if(t)try{r=t.stack}catch(e){}Z("CSP violation of "+t.effectiveDirective,n+e+"@"+m.extension.urls.prepareForReport(t.documentURI),[t.sourceFile," -> ",t.lineNumber+":"+t.columnNumber,r].join(";"))},(null==r?void 0:r.started)&&(R=Date.now()-r.started.getTime()),b=!0,h=!!(null==r?void 0:r.trackView),N(t)},setEnabled:N,isActive:function(e){return w&&!!M(e)},
tC:(e,t,r)=>{if(!w)return;let n="",s="";"init"===t?(s="Initialized",n=e):"error"===t&&(s="Error",n=e+" -> "+r),G(M(c),u,{category:"Cloud",action:s,name:n})},tS:(e,t,r)=>{if(!w)return;const n=`${e}${r?` <${r}> `:""}`;let s="",o=null;if("i"===t)s="Installed";else if("u"===t)s="Updated",o=M(A);else if("m"===t)s="Revealed";else{if("r"!==t)return;s="Removed"}G(o||M(l),u,{category:"Script",action:s,name:n})},tE:Z,tG:(e,t,r)=>{if(!w)return;let n="",s="";"clicked"===e?(s="Click",
n=t+":"+r):"button"===e?(s="Button",n=t):"dialog"===e&&(s="Dialog"),G(M("begging"),u,{category:"Begging",action:s,name:n})}};t.default=C},function(e,t,r){"use strict";r.d(t,"a",(function(){return m})),r.d(t,"b",(function(){return f}));var n=r(1),s=r(2),o=r(15),a=r.n(o);let i=0;const A={ePASTEBIN:1,eCHROMESYNC:2,eSYNCFS:3,eGDRIVE:4,eDROPBOX:5,eWEBDAV:6,eYANDEX:7,eONEDRIVE:8};let l=[],c=!1;const u=e=>{const t=Object(n.Deferred)(),r=new FileReader;return r.onloadend=function(){
t.resolve(this.result)},r.onerror=t.reject,r.onabort=t.reject,r.readAsText(e),t.promise()},d=(()=>{const e=e=>{const t=e.type,r=e.id,o=".meta.json",A=".user.js";let c,d=null;const g=e=>{let t;return n.Deferred.Pledge().then(()=>{if(!d)return t=!0,p()}).then(()=>{if(d&&void 0===d[e]&&!t)return p()}).then(()=>d?(d[e]=d[e]||null,d[e]):(s.logger.warn("si: unable to list remote list!"),n.Deferred.Breach()))},p=e=>c.list(e).then(e=>{d={};const t={},r={};let n,o;const a=Date.now();return e.forEach(e=>{
d[e.name]=e;const i=new RegExp(".meta.json$"),A=new RegExp(".user.js$");var l;e.modified>a?s.logger.log("si: ignore future list item",a,e):((n=e.name.match(i))||(o=e.name.match(A)))&&(n?(e.uuid=l=e.name.replace(i,""),e.lastModified=e.modified,t[l]=e):o&&(l=e.name.replace(A,""),r[l]=e))}),Object.keys(t).map(e=>{let n;if(n=t[e])return n.source=r[e],n.options=n.options||{},n}).filter(e=>e)});let m;return{init:function(e){return c=a.a[t]({...e,path:"sync"}),n.Deferred.Pledge().then(()=>{
if(!c.credentials&&!e.basic_auth)return c.list()}).then(()=>(m||(m=c.changes.listen(),m.progress(e=>{((e,t)=>{if(t!=i)return;const r=e.name,n=new RegExp(".meta.json$"),o=new RegExp(".user.js$");s.logger.log("si: cloud file changed",r,e),(r.match(n)||r.match(o))&&l.forEach(e=>{e(r)})})(e,r)})),!0))},list:p,setSource:(e,t)=>{const r=e+A;return g(r).then(e=>{let o;return n.Deferred.Pledge(!1).then(()=>{if(e&&c.compare)return c.compare(e,t)
}).then(a=>a?(s.logger.log("si: remote source data matches, skip upload of",r),n.Deferred.Pledge()):(o=new Blob([t],{type:"text/plain"}),delete d[r],c.put(e||r,o)))})},getSource:(e,t)=>{const r=e+A;return g(r).then(o=>o?n.Deferred.Pledge(!1).then(()=>{if(t&&c.compare)return c.compare(o,t)}).then(e=>e?(s.logger.log("si: remote source data matches, skip download of",r),n.Deferred.Pledge(t)):c.get(o).then(u)):(s.logger.warn("si: list cache does not contain this UUID",e),n.Deferred.Breach()))},
getMeta:e=>g(e+o).then(t=>t?c.get(t).then(u).then(r=>{let n;if((n=(e=>{let t=null;try{t=JSON.parse(e)}catch(e){}return t&&t.uuid?t:(s.logger.log("si: unable to parse extended info of "+void 0),null)})(r))&&(n.uuid=e))return n.lastModified=t.modified||n.lastModified,n.precision=t.precision,n.options=n.options||{},n}):n.Deferred.Breach()),setMeta:(e,t)=>{const r=new Blob([JSON.stringify(e)],{type:"text/plain"}),n=e.uuid+o;return g(n).then(e=>c.put(e||n,r,t))},remove:e=>{const t=e.uuid+o
;e.options.removed=!0;const r=new Blob([JSON.stringify(e)],{type:"text/plain"});return c.put(t,r).then(()=>{const t=e.uuid+A;return g(t).then(e=>{if(e)return delete d[t],c.delete(e)})})},reset:()=>c.list(!0).then(e=>e.filter(e=>{const t=new RegExp(".meta.json$"),r=new RegExp(".user.js$");return e.name.match(t)||e.name.match(r)})).then(e=>{const t=[];return e.forEach(e=>{t.push((()=>{const t=Object(n.Deferred)();return c.delete(e).always(()=>{t.resolve()}),t.promise()})())}),
n.Deferred.when(t).always(()=>{d=null})}),getRemoteUrl:function(e){if(c.getRemoteUrl)return c.getRemoteUrl(e.uuid+A)},getRemoteDomains:function(){if(c.getRemoteDomains)return c.getRemoteDomains()}}},t=e({type:"drive",id:A.eGDRIVE}),r=e({type:"dropbox",id:A.eDROPBOX}),o=e({type:"onedrive",id:A.eONEDRIVE}),c=e({type:"webdav",id:A.eWEBDAV}),d=e({type:"yandex",id:A.eYANDEX}),p=(()=>{let e,t=!1;const r=(t,r)=>{i==A.eCHROMESYNC&&"sync"==r&&n.Deferred.Pledge().then(()=>{const n=new RegExp(e+"$")
;t&&Object.keys(t).forEach(e=>{const o=t[e];if(s.logger.log('si: storage key "%s" in namespace "%s" changed. Old value was "%s", new value is "%s".',e,r,o.oldValue,o.newValue),-1!=e.search(n))for(let t=0;t<l.length;t++)if(p[e]);else{const r=c(o.newValue,e);r&&l[t](e,r)}})})},o=e=>{const t=Object(n.Deferred)();let r=[];return e?a().done(n=>{r=n.filter(t=>t.item&&t.item.uuis==e),t.resolve(r)}).fail(e=>{t.reject(e)}):t.resolve(r),t.promise()};var a=()=>g(()=>{
const t=Object(n.Deferred)(),r=new RegExp(e+"$");return rea.storage.sync.get(null,e=>{const n=[];e&&Object.keys(e).forEach(t=>{-1!=t.search(r)&&n.push({key:t,item:c(e[t],t)})}),t.resolve(n)}),t.promise()}),c=(e,t)=>{let r=null;try{r=JSON.parse(e)}catch(e){}return r&&(r.url||r.options)?r:(s.logger.log("si: unable to parse extended info of "+t),null)};const u=e=>e.then(e=>{const t={};if((e=e.filter(e=>{if(!t[e.key])return t[e.key]=!0,!0})).length>1){const t=Object(n.Deferred)(),r=[],s=e.pop()
;return e.forEach(e=>{r.push(m(e.key))}),n.Deferred.when(r).done(()=>{t.resolve(s)}),t.promise()}return n.Deferred.Pledge(e[0])});let d=null;var p={},m=e=>{const t=Object(n.Deferred)();return rea.storage.sync.remove(e,()=>{const e=rea.runtime.lastError;e?t.reject(e):t.resolve()}),t.promise()},f=()=>{const e=Object(n.Deferred)();return rea.storage.sync.set(p,()=>{const t=rea.runtime.lastError;t?e.reject(t):(p={},e.resolve())}),e.promise()};return{init:function(){let o=!0;if(!t)try{
rea.storage.onChanged.addListener(r),t=!0}catch(e){s.logger.warn("si: error registering sync callback: "+e.message),o=!1}return e="@v2",n.Deferred.Pledge(o)},list:()=>n.Deferred.Pledge().then(()=>a()).then(t=>{const r=new RegExp(e+"$"),s=[];return t.forEach(e=>{const t=e.key,n=e.item,o=t.replace(r,"");let a=null;if(a=p[t]?c(p[t],t):n,!a)return;const i=a.options||{},A=!!i.removed;s.push({id:o,uuid:A?o:a.uuid,lastModified:A?i.removed:a.lastModified,url:a.url,options:i})}),n.Deferred.Pledge(s)}),
setMeta:(t,r)=>{const s=Object(n.Deferred)();return u(o(t.uuid)).done(n=>{let o,a;n?(o=n.key,a=n.item):(o=t.uuid+e,a={}),a.url=t.url,a.options=t.options||{},a.uuid=t.uuid,r.lastModified&&(a.lastModified=r.lastModified),p[o]=JSON.stringify(a),d&&window.clearTimeout(d),d=window.setTimeout(f,3e3),s.resolve()}),s.promise()},remove:t=>{const r=Object(n.Deferred)();return u(o(t.uuid)).done(n=>{let s,o;n?(s=n.key,o=n.item):(s=t.uuid+e,o={}),o.options=o.options||{},o.options.removed=!0,
p[s]=JSON.stringify(o),d&&window.clearTimeout(d),d=window.setTimeout(f,3e3),r.resolve()}),r.promise()},reset:()=>g(()=>{const e=Object(n.Deferred)();return rea.storage.sync.clear(()=>{p={},e.resolve()}),e.promise()})}})(),m={};return rea.storage.sync.supported&&(m[A.eCHROMESYNC]=p),m[A.eGDRIVE]=t,m[A.eDROPBOX]=r,m[A.eONEDRIVE]=o,m[A.eWEBDAV]=c,m[A.eYANDEX]=d,m})();var g=(e,t)=>{const r=Object(n.Deferred)();void 0===t&&(t=3);const o=()=>{if(c)window.setTimeout(o,500);else{c=!0;try{
e().always(()=>{c=!1}).done((function(){r.resolve.apply(this,arguments)})).fail(()=>{--t>0?(s.logger.log("si: some retries left, wait for",6e4,"ms"),window.setTimeout(o,6e4)):(s.logger.warn("si: no retries left, skipping this sync request!"),r.reject("no retries left"))})}catch(e){s.logger.warn(e),c=!1,r.reject(e)}}};return o(),r.promise()};const p={init:(e,t)=>(l=[],i=e,d[i]?d[i].init(t):n.Deferred.Breach()),debug:function(){},addChangeListener:function(e){l.push(e)},getRemoteUrl:function(e){
if(d[i]&&d[i].getRemoteUrl)return d[i].getRemoteUrl(e)},getRemoteDomains:function(){if(d[i]&&d[i].getRemoteDomains)return d[i].getRemoteDomains()},caps:(()=>{const e={};return Object.defineProperties(e,{specialMeta:{get:function(){return d[i]&&!!d[i].getMeta},enumerable:!0},syncsSource:{get:function(){return d[i]&&!!d[i].getSource},enumerable:!0}}),e})(),types:A};["list","setMeta","getMeta","setSource","getSource","reset","remove"].forEach(e=>{p[e]=function(){
return d[i]&&d[i][e]?d[i][e].apply(this,arguments):n.Deferred.Pledge()}});const m=e=>(a.a.init(t=>{let r=Object(n.Deferred)();const s=e.openAndWatch({url:t.url},e=>{e?r&&r.notify(e):r&&(r.resolve("tab closed"),r=null)});return{promise:r.promise(),close:function(){s.cancel()}}}),p),f=A},function(e,t,r){"use strict";r.r(t),r.d(t,"vendor",(function(){return d})),r.d(t,"getRaw",(function(){return p})),r.d(t,"require",(function(){return g})),r.d(t,"get",(function(){return f}));let n=[]
;const s={},o={},a=(e,t,r)=>{var a=()=>{e.every(e=>!!i[e])?r():n.push(a)};(e="string"==typeof e?[e]:e).forEach(e=>{if(void 0===i[e]&&void 0===s[e]){const r=window.setTimeout(()=>{o[e]||(delete s[e],c(e),m(rea.extension.getURL(e+".js"),()=>{t?u(e,null,{}):console.log("registry: finished loading "+e+".js ")}))},0);s[e]=()=>{window.clearTimeout(r),delete s[e]}}}),a()};var i={};const A={},l={},c=e=>{o[e]=!0},u=(e,t,r,a)=>{if(!i[e]||a){let a;A[e]=t,i[e]=r,delete o[e],(a=s[e])&&a(),(()=>{const e=n
;for(n=[];e.length;)e.pop()()})()}},d=(e,t)=>a(e,!0,t),g=(e,t)=>a(e,!1,t),p=(e,t)=>{let r;if(void 0!==(r=l[e]))t&&t(r);else{const n=rea.extension.getURL(e);try{const s=new XMLHttpRequest;if(XMLHttpRequest.onlyasync){if(!t)return void console.warn("registry: async xhr without a callback!");s.open("GET",n),s.onload=()=>{t(s.responseText)},s.onerror=()=>{t()},s.send(null)}else s.open("GET",n,!1),s.send(null),r=s.responseText,r||console.warn("registry: content of "+e+" is null!"),t&&t(r)}catch(e){
console.log("getRawContent "+e)}}return r},m=(e,t)=>{let r=1;const n=()=>{0==--r&&t&&t()};(e="string"==typeof e?[e]:e).forEach(e=>{r++;try{rea.page.addScript(e,t=>{t||console.warn("registry: self.load "+e+" failed! "),n()})}catch(t){console.warn("registry: self.load "+e+" failed! ",t),n()}}),n()},f=(e,...t)=>{let r;const n=i[e];return"function"==typeof n?r=n.apply(void 0,t):n&&(r=n),r}},function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e
}};Object.defineProperty(t,"__esModule",{value:!0});const s=r(1),o=n(r(4)),a=r(3),i=r(2),A=n(r(6)),l=n(r(12)),c=n(r(11)),u=r(10),d=window.rea,g=window.forge_sha256,p=d.FEATURES,m=c.default;let f,h;const R=u.createQueue({threads:1}),v=(e,t)=>{const r=(e?e.split("/"):[]).concat(t?[t]:[]).join("/");return r?("/"==r.substr(0,1)?"":"/")+r:""},b=e=>{const t={type:e,request:e=>{const t=()=>{const t=s.Deferred(),r=e=>{i.logger.log("rest service: request failed",e),t.reject(e)
},n="xml"===e.responseType,o="headers"===e.responseType;return(n||o)&&delete e.responseType,f(e,{onload:s=>{if([200,201,204,207].includes(s.status)){let r;r=n?e.anonymous||e.fetch?(new window.DOMParser).parseFromString(s.responseText||"","text/xml"):s.responseXML:o?m.parseHeaders(s.responseHeaders):s.response,t.resolve({result:r})}else r(s)},onerror:r,ontimeout:r,onprogress:e=>t.notify(e)},{internal:!0}),t.promise()};return e.no_queue?t():R.add(t)},error:t=>{const r=t;let n
;if(void 0!==r.status){n=r.status.toString();try{n=n+" | "+r.responseText}catch(e){}}else n=t;l.default.tC(e,"error","request: "+n)},wait:e=>(...t)=>e(...t).then(e=>e,e=>(e=>s.Deferred.Breach(e?e.responseText||e.statusText:void 0))(e)),changes:(()=>{let e;return{listen:()=>(e||(e=s.Deferred(),t.watch&&t.watch.start()),e.promise()),notify:t=>{e.notify(t)}}})()};return t},w=e=>{const t=Object.assign({},e),r=t.type;if(void 0===r)throw new Error("Internal error");let n,i=[];const A=Object.assign(e,{
...t,config:{...t.config,auth_prefix:"Bearer",storage_key:""},credentials:{},request:e=>(e.no_auth||(e.headers=e.headers||{},e.headers.Authorization=A.config.auth_prefix+" "+A.credentials.access_token),t.request(e)),oauth:(()=>{let e;const t={run:()=>{if(n)return n;let o=s.Deferred();const i=n=o.promise();e="!!"+r+"-"+a.createUUID();let c=A.credentials?A.credentials.refresh_token:null;const u=(e,t)=>{A.credentials=t,null==o||o.resolve(),o=void 0,e&&e.close()};return(()=>{
if(!A.config.refresh_supported||!c)return s.Deferred.Pledge();const e=s.Deferred(),n=()=>{c=null,delete A.credentials.refresh_token};return f({url:t.getRefreshUrl(c),fetch:!p.RUNTIME.SAFARI},{onload:e=>{if(!e.finalUrl)return l.default.tC(r,"error","auth refresh token: !finalUrl"),void n();const s=t.onUrl(e.finalUrl);s&&(s.error||!s.access_token?(l.default.tC(r,"error","auth refresh token: "+(s.error||"!access_token")),n()):u(null,s))},onerror:n,ondone:()=>e.resolve()}),e.promise()})().then(()=>{
if(!o)return;if(!A.config.refresh_supported)return s.Deferred.Pledge();const e=s.Deferred(),n=h({url:t.getRefreshUrl()});return n.promise.progress(e=>{let s;o&&(s=t.onUrl(e.url))&&(s.error||!s.access_token?(l.default.tC(r,"error","auth refresh: "+(s.error||"!access_token")),A.config.refresh_supported=!1):u(n,s))}).always(e.resolve),e.promise()}).then(()=>{if(!o)return;const e=s.Deferred(),n=h({url:t.getAuthUrl()});return n.promise.progress(e=>{let s
;o&&(s=t.onUrl(e.url))&&(s.error||!s.access_token?l.default.tC(r,"error","auth: "+(s.error||"!access_token")):u(n,s))}).always(e.resolve),e.promise()}).done(()=>{n=void 0,o&&o.reject("auth_failed")}),i},getAuthUrl:()=>A.config.request_uri+"?"+o.default.hash2params({response_type:A.config.response_type,client_id:A.config.client_id,redirect_uri:A.config.redirect_uri,state:e,scope:A.config.scope}),getRefreshUrl:t=>{const r={client_id:A.config.client_id,redirect_uri:A.config.redirect_uri,state:e,
scope:A.config.scope,refresh_token:t};return A.config.redirect_uri+"?"+o.default.hash2params(r)},onUrl:t=>{let r,n;if(t&&0===t.indexOf(A.config.redirect_uri)&&(n=o.default.parse(t))&&(r=o.default.params2hash(n))&&(r.access_token||r.error)&&r.state===e)return{uid:r.uid,access_token:r.access_token,refresh_token:r.refresh_token,error:r.error}}};return t})(),wait:e=>t.wait((...t)=>{if(A.credentials.access_token)return e(...t);{const r=s.Deferred();return i.push(()=>r.consume(e(...t))),
A.oauth.run().done(()=>{i.forEach(e=>e()),i=[]}).fail(e=>{r.reject(e)}),r.promise()}})}),c=p.HTML5.LOCALSTORAGE;let u;return Object.defineProperty(A,"credentials",{get:()=>{if(void 0===u){if(l.default.tC(r,"init"),c)try{const e=JSON.parse(c.getItem(A.config.storage_key)||"");u={uid:e.uid,access_token:e.access_token,refresh_token:e.refresh_token}}catch(e){}u=u||{}}return u},set:e=>{if(c)try{c.setItem(A.config.storage_key,JSON.stringify({uid:e.uid,access_token:e.access_token,
refresh_token:e.refresh_token}))}catch(e){}u=e},enumerable:!1}),A},k=e=>{let t,r,n,A,l,c,d,g,p,m=null,f=null;const h=Object.assign({},e),R=e=>{var t;let r;return e&&(r=(null===(t=e.firstChild)||void 0===t?void 0:t.nextSibling)?e.firstChild.nextSibling:e.firstChild),r},b=e=>h.wait((...t)=>E.init().then(()=>e(...t))),w=(e,t)=>{let r,n;if((r=e.getElementsByTagNameNS("*",t)[0])&&(n=r.firstChild))return n.nodeValue||void 0},k=e=>{const s=[],o=e.getElementsByTagNameNS("*","response")
;for(let e=0;e<o.length;e++){const i=o[e];let A=w(i,"href");if(null==A)continue;A=A.replace(/\/$/,"");const l=i.getElementsByTagNameNS("*","propstat")[0].getElementsByTagNameNS("*","prop")[0],c=w(l,"getlastmodified"),u=w(l,"getetag"),d=parseInt(w(l,"getcontentlength")||""),g=l.getElementsByTagNameNS("*","resourcetype")[0].getElementsByTagNameNS("*","collection")[0],p=A.replace(new RegExp("^("+[a.escapeForRegExpURL(r+t)+"/?",a.escapeForRegExpURL(n+t)+"/?"].join("|")+")"),"");if(g);else{const e={
etag:u,name:p,modifiedTime:new Date(c||0).getTime(),size:d>=0?d:void 0,removed:-1==d};s.push(e)}}return s},_=e=>w(e,"td:cursor"),y=(e,t)=>{const r=t||{};return r.set_current_list&&(l={}),E.request({method:"PROPFIND",url:e,headers:{"Content-Type":"text/xml; charset=UTF-8",Depth:void 0!==r.depth?r.depth:1},responseType:"xml"}).then(e=>{const t=e.result;let n;if(null===t||!(n=R(t))||!n.childNodes)return s.Deferred.Breach();const o=k(n);if(r.set_current_list){const e=_(n);e&&(c=e),o.forEach(e=>{
l[e.name]=e})}return o})},E=Object.assign(e,{...e,config:{...e.config,watch_interval:36e5,root:void 0,path:void 0},request:e=>(e.headers=e.headers||{},e.headers["User-Agent"]="Tampermonkey",e.headers.Cookie="",h.request(e).then(e=>e,t=>{const r=t;return!r||[403,500].includes(r.status)?(e.backoff=2*(e.backoff||1e3),u.sleep(e.backoff).then(()=>E.request(e))):404==r.status?s.Deferred.Pledge(r):(E.error(r),s.Deferred.Breach(r))})),init:()=>{if(A)return A;t=v(E.config.root,E.config.path),
r=E.config.url||"","/"==r.slice(-1)&&(r=r.slice(0,-1)),n=o.default.parse(r).pathname,"/"==n.slice(-1)&&(n=n.slice(0,-1));const e=s.Deferred();A=e.promise();const a=r+t;return E.request({method:"OPTIONS",url:r,responseType:"headers"}).done(e=>{const t=e.result;let r;t&&(r=t["access-control-allow-methods"])&&r.includes("EDITOR")&&(p=!0)}).always(()=>{y(a,{depth:0}).done(()=>e.resolve()).fail(()=>{const n=[];s.Deferred.onebyone(t.split("/").filter(e=>e).map(e=>{n.push(e);const t=n.join("/")
;return()=>E.request({method:"MKCOL",url:r+"/"+t,headers:{"Content-Type":"text/xml; charset=UTF-8"},responseType:"xml"})})).done(()=>e.resolve()).fail(e.reject)})}),A},list:b(e=>y(r+t,{set_current_list:!0}).then(t=>{const r={};return t.map(t=>{if(!e){if(r[t.name])return;r[t.name]=!0}return{name:t.name,size:t.size||0,etag:t.etag,modified:t.modifiedTime,precision:1e3,removed:t.removed}}).filter(e=>e)})),get:b(e=>{const n=e.name||e;return E.request({method:"GET",url:r+v(t,n),headers:{
"Content-Type":"text/xml; charset=UTF-8"},responseType:"arraybuffer"}).then(e=>{const t=e.result;return new Blob([t])})}),put:b((e,n,s)=>{const o=e.name||e;let a,A,l;const c={"Content-Type":"application/octet-stream"},u=null===f;return s&&s.lastModified&&(a=s.lastModified,l=new Date(s.lastModified).toISOString(),A=s.lastModified/1e3,(f||u)&&(c["X-OC-Mtime"]=A)),E.request({method:"PUT",url:r+v(t,o),headers:c,data_type:"typified",data:{type:"raw",value:n},responseType:"headers"}).then(e=>{
const n=e.result;if(n&&u){let e;f=!("accepted"!=n["x-oc-mtime"]&&(!n.date||!(e=new Date(n.date).getTime())||e!=a&&e!=Math.floor(A)))}if(!f&&!m&&l)return E.request({method:"PROPPATCH",url:r+v(t,o),headers:{"Content-Type":"text/xml; charset=UTF-8"},responseType:"xml",
data:[`<?xml version="1.0"?>\n                            <d:propertyupdate xmlns:d="DAV:">\n                                <d:set>\n                                    <d:prop>\n                                        <d:getlastmodified>${l}</d:getlastmodified>\n                                    </d:prop>\n                                </d:set>\n                            </d:propertyupdate>`].join("")}).then(e=>{var t;const r=e.result;let n,s,o
;r&&(n=r.childNodes[0])&&(s=n.getElementsByTagNameNS("*","status")[0])&&(o=null===(t=s.firstChild)||void 0===t?void 0:t.nodeValue)&&-1!=o.search(/HTTP\/[0-9\.]+ 403/)&&(i.logger.warn("WebDAV: no way to set file modification date! This might cause redundant up and downloads."),m=!0)},()=>{i.logger.warn("WebDAV: no way to set file modification date! This might cause redundant up and downloads."),m=!0})})}),delete:b(e=>{const n=e.name||e;return E.request({method:"DELETE",url:r+v(t,n),headers:{
"Content-Type":"text/xml; charset=UTF-8"}})}),watch:{start:()=>{if(d)return;d=!0;let e=null;const n=()=>{if(g=void 0,d)if(!1===e){const e=l;y(r+t,{set_current_list:!0}).then(()=>{e&&(Object.keys(e).forEach(t=>{const r=l[t],n=e[t];r?n.modifiedTime!=r.modifiedTime&&h.changes.notify({time:r.modifiedTime,name:r.name}):h.changes.notify({time:Date.now(),name:n.name,removed:!0})}),Object.keys(l).forEach(t=>{if(!e[t]){const e=l[t];h.changes.notify({time:e.modifiedTime,name:e.name})}}))}).fail(e=>{
i.logger.warn("WebDAV: file changes check failed",e)}).always(()=>{g=window.setTimeout(n,E.config.watch_interval)})}else{let o=100;((e,t)=>{const r={"Content-Type":"text/xml; charset=UTF-8",Depth:1,Timeout:90};return t&&(r.Cursor=t),E.request({method:"SUBSCRIBE",url:e,headers:r,responseType:"xml",no_queue:!0}).then(e=>{const t=e.result;let r;return null===t?s.Deferred.Pledge({changes:[],cursor:c}):(r=R(t))&&r.childNodes?{changes:k(r),cursor:_(r)}:s.Deferred.Breach()})})(r+t,c).then(e=>{
const t=e.changes;c=e.cursor,o=1,t.forEach(e=>{h.changes.notify({time:e.modifiedTime,name:e.name,removed:e.removed})})},()=>{if(null!==e)return o*=2,u.sleep(o);e=!1}).always(n)}};b(()=>d?(n(),s.Deferred.Pledge()):s.Deferred.Breach())()},stop:()=>{d=!1,g&&(window.clearTimeout(g),g=void 0)}},getRemoteUrl:e=>{if(p)return r+v(t,e)+"?method=editor#bypass=true"},getRemoteDomains:()=>[o.default.parse(r).origin.replace(/^.*:\/\//,"")]});return E},_={init:e=>{h=e,f=m.run},drive:()=>{let e,t
;(e=p.HTML5.LOCALSTORAGE)&&(t=parseInt(e.getItem("dropbox_poll_interval")||""))||(t=18e5);const r=w(b("drive")),n=Object.assign({},r),l="appDataFolder";let c,d;const g=Object.assign(r,{...r,config:{...r.config,redirect_uri:"https://auth.tampermonkey.net/oauth.php",refresh_supported:!0,request_uri:"https://accounts.google.com/o/oauth2/v2/auth",client_id:"408438522028-3cgn3t3jas3fak7isbnfod1q4h15g2fv.apps.googleusercontent.com",storage_key:"gd_config",
scope:"https://www.googleapis.com/auth/drive.appdata",response_type:"token",watch_interval:t},request:e=>n.request(e).then(e=>e,t=>{if(!t||[403,500].includes(t.status))return e.backoff=2*(e.backoff||1e3),u.sleep(e.backoff).then(()=>g.request(e));if([400,401].includes(t.status)){if(i.logger.warn("Google Drive: authentication error",t),delete g.credentials.access_token,!e.retry_auth)return e.retry_auth=!0,g.oauth.run().then(()=>g.request(e))}else if(404==t.status)return s.Deferred.Pledge(t)
;return g.error(t),s.Deferred.Breach(t)}),list:n.wait(e=>{let t=[];const r=s.Deferred(),n=e=>"https://www.googleapis.com/drive/v3/files?"+o.default.hash2params({spaces:l,pageToken:e,orderBy:"modifiedTime desc",fields:"nextPageToken, files(id, size, name, modifiedTime, md5Checksum)",pageSize:500}),a=e=>{g.request({method:"GET",url:e,headers:{"Content-Type":"application/json"}}).then(e=>{const s=e.result,o=s?JSON.parse(s):{files:[]};if(t=t.concat(o.files),
o.nextPageToken)return a(n(o.nextPageToken));r.resolve(t)})};return a(n()),r.promise().then(t=>{const r={};return t.map(t=>{if(!e){if(r[t.name])return;r[t.name]=!0}return{name:t.name,size:t.size||0,id:t.id,md5:t.md5Checksum,modified:new Date(t.modifiedTime).getTime()}}).filter(e=>e)})}),get:n.wait(e=>{const t=e.id||e;return g.request({method:"GET",url:"https://www.googleapis.com/drive/v3/files/"+t+"?"+o.default.hash2params({spaces:l,alt:"media"}),responseType:"arraybuffer"}).then(e=>{
const t=e.result;return new Blob([t])})}),put:n.wait((e,t,r)=>{const n=e,i=n.name||e,c=n.id,u=a.createUUID();return s.Deferred.Pledge().then(()=>{if(t)return A.default.blob2str(t)}).then(e=>{const t=r&&r.lastModified?new Date(r.lastModified).toISOString():void 0,n=[];return n.push("--"+u),n.push("Content-Type: application/json"),n.push(""),n.push(JSON.stringify({name:i,parents:c?void 0:[l],modifiedTime:t})),n.push("--"+u),e&&(n.push("Content-Type: application/octet-stream"),
n.push("Content-Transfer-Encoding: base64"),n.push(""),n.push(A.default.Base64.encode(e)),n.push("--"+u+"--")),n.push(""),g.request({method:c||!e?"PATCH":"POST",url:"https://www.googleapis.com/"+(e?"upload/":"")+"drive/v3/files"+(c?"/"+c:"")+"?"+o.default.hash2params({uploadType:"multipart"}),headers:{"Content-Type":"multipart/related; boundary="+u},data:n.join("\r\n")})})}),delete:n.wait(e=>{const t=e.id||e;return g.request({method:"DELETE",
url:"https://www.googleapis.com/drive/v3/files/"+t+"?"+o.default.hash2params({spaces:l}),headers:{"Content-Type":" application/json"}})}),revoke:n.wait(()=>{const e=g.credentials.access_token;return e?n.request({method:"GET",url:"https://accounts.google.com/o/oauth2/revoke?"+o.default.hash2params({token:e})}):s.Deferred.Breach()}),compare:(e,t)=>{const r=s.Deferred();let n;return(n=e.md5)&&n==A.default.MD5(t,"utf-8")?r.resolve(!0):r.resolve(!1),r.promise()},watch:{start:()=>{if(c)return;let e
;c=!0;const t=()=>{d=null,c&&g.request({method:"GET",url:"https://www.googleapis.com/drive/v3/changes/?"+o.default.hash2params({pageToken:e,spaces:"appDataFolder",pageSize:1e3,includeRemoved:!0}),headers:{"Content-Type":" application/json"}}).then(t=>{const r=t.result;if(!c)return s.Deferred.Breach();const n=r?JSON.parse(r):{};if(!(e=n.newStartPageToken))return i.logger.warn("Google Drive: watch token error",r),g.watch.stop();n.nextPageToken&&i.logger.warn("Google Drive: too much changes",r),
(n.changes||[]).forEach(e=>{let t;const r=e.file;"file"===e.type&&r&&(t=Date.parse(e.time),isNaN(t)&&(t=Date.now()),g.changes.notify({id:r.id,time:t,name:r.name,removed:e.removed}))})}).fail(e=>{i.logger.warn("Google Drive: file changes check failed",e)}).always(()=>{d=window.setTimeout(t,g.config.watch_interval)})};n.wait(()=>c?g.request({method:"GET",url:"https://www.googleapis.com/drive/v3/changes/startPageToken",headers:{"Content-Type":" application/json"}}).then(r=>{
const n=r.result,s=n?JSON.parse(n):{};if(!(e=s.startPageToken))return i.logger.warn("Google Drive: watch token error",n),g.watch.stop();t()}):s.Deferred.Breach())()},stop:()=>{c=!1,d&&(window.clearTimeout(d),d=null)}}});return g},dropbox:e=>{const t=e.path||"",r=p.HTML5.LOCALSTORAGE;let n;r&&(n=parseInt(r.getItem("dropbox_poll_interval")||""))||(n=18e5);const o=w(b("dropbox")),a=Object.assign({},o);let l,c,g,m,f=!0;const h=e=>{let r=[];const n=s.Deferred(),o=e=>{R.request({method:"POST",
url:"https://api.dropboxapi.com/2/files/list_folder"+(e?"/continue":""),headers:{"Content-Type":" application/json"},data:{path:e?void 0:v(t),cursor:e}}).then(e=>{const t=e.result,s=t?JSON.parse(t):{entries:[]};if(r=r.concat(s.entries),s.has_more&&s.cursor)return o(s.cursor);n.resolve({list:r,cursor:s.cursor})}).fail(n.reject)};return f?(f=!1,R.put(".version",new Blob([d.extension.manifest.version])).then(()=>{o(e)}).fail(n.reject)):o(e),n.promise()},R=Object.assign(o,{...o,config:{...o.config,
redirect_uri:"https://auth.tampermonkey.net/oauth.php",request_uri:"https://www.dropbox.com/oauth2/authorize",client_id:"gq3auc9yym0e21y",storage_key:"db_config",response_type:"token",watch_interval:n?Number(n):0},request:e=>a.request(e).then(e=>e,t=>!t||[500,429].includes(t.status)?(e.backoff=2*(e.backoff||1e3),u.sleep(e.backoff).then(()=>R.request(e))):[401].includes(t.status)&&(i.logger.warn("Dropbox: authentication error",t),delete R.credentials.access_token,!e.retry_auth)?(e.retry_auth=!0,
R.oauth.run().then(()=>R.request(e))):(R.error(t),s.Deferred.Breach(t))),list:a.wait(e=>h().then(t=>{const r={};return c=t.cursor,t.list.map(t=>{if(!e){if(r[t.name])return;r[t.name]=!0}return{name:t.name,size:t.size,dropbox_hash:t.content_hash,modified:new Date(t.client_modified).getTime(),precision:1e3}}).filter(e=>e)}).always(()=>{l&&c&&(l(),l=null)})),get:a.wait(e=>{const r=e.name||e;return R.request({method:"POST",url:"https://content.dropboxapi.com/2/files/download",headers:{
"Dropbox-API-Arg":JSON.stringify({path:v(t,r)})},responseType:"arraybuffer"}).then(e=>{const t=e.result;return new Blob([t])})}),put:a.wait((e,r,n)=>{const s=e.name||e,o=n&&n.lastModified?(new Date(n.lastModified).toISOString().match(/[^:]*:[^:]*:[^:.a-zA_Z]*/)||"")[0]+"Z":void 0;return R.request({method:"POST",url:"https://content.dropboxapi.com/2/files/upload",headers:{"Dropbox-API-Arg":JSON.stringify({path:v(t,s),client_modified:o,mode:"overwrite"}),"Content-Type":"application/octet-stream"},
data_type:"typified",data:{type:"raw",value:r}})}),delete:a.wait(e=>{const r=e.name||e;return R.request({method:"POST",url:"https://api.dropboxapi.com/2/files/delete",headers:{"Content-Type":" application/json"},data:{path:v(t,r)}})}),compare:(e,t)=>{const r=s.Deferred();if(window.crypto&&window.ArrayBuffer){const n=4194304,s=A.default.str2abSync(t,{encoding:"utf-8"}),o=[],a=s.byteLength;let l=1;const c=(e,t)=>{const r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e),0),
r.set(new Uint8Array(t),e.byteLength),r.buffer},u=()=>{if(0==--l){let t=new window.ArrayBuffer(o.map(e=>(null==e?void 0:e.byteLength)||0).reduce((e,t)=>e+t,0));o.forEach(e=>{e&&(t=c(t,e))}),window.crypto.subtle.digest("SHA-256",t).then(t=>{const n=Array.from(new Uint8Array(t)).map(e=>("00"+e.toString(16)).slice(-2)).join("");r.resolve(n==e.dropbox_hash)})}};for(let e=0,t=0;t<a;t+=n,e++)(e=>{o.push(null),l++,window.crypto.subtle.digest("SHA-256",s.slice(t,t+Math.min(n,a-t))).then(t=>{o[e]=t,u()
},()=>{i.logger.warn("Dropbox: unable to calculate SHA-256 hashes"),r.reject()})})(e);u()}else i.logger.warn("Dropbox: unable to calculate SHA-256 hashes"),r.reject();return r.promise()},watch:{start:()=>{if(g)return;g=!0;let e=0;const t=()=>{if(m=null,e=0,g)return c?void R.request({method:"POST",url:"https://notify.dropboxapi.com/2/files/list_folder/longpoll",headers:{"Content-Type":" application/json"},no_auth:!0,no_queue:!0,data:{cursor:c,timeout:180}}).then(t=>{const r=t.result
;if(!g)return s.Deferred.Breach();const n=r?JSON.parse(r):{};return n.backoff&&(e=1e3*n.backoff),n.changes?u.sleep(6e4).then(()=>h(c)).then(e=>(c=e.cursor)?e.list:(i.logger.warn("Dropbox: watch token error",r),R.watch.stop())):null}).then(e=>{e&&e.forEach(e=>{let t;const r=e[".tag"];["file","deleted"].includes(r)&&(t=Date.parse(e.server_modified),R.changes.notify({id:e.id,time:t,name:e.name,removed:"deleted"==r}))})}).fail(e=>{i.logger.warn("Dropbox: file changes check failed",e)}).always(()=>{
m=window.setTimeout(t,e+R.config.watch_interval)}):(i.logger.warn("Dropbox: watch token error",c),R.watch.stop())};a.wait(()=>g?(c?t():l=t,s.Deferred.Pledge()):s.Deferred.Breach())()},stop:()=>{g=!1,m&&(window.clearTimeout(m),m=null)}},getRemoteDomains:()=>["dropbox.com","dropboxapi.com"]});return R},onedrive:e=>{const t=e.path||"";let r,n,o;(r=p.HTML5.LOCALSTORAGE)&&(n=parseInt(r.getItem("onedrive_poll_interval")||""))||(n=18e5);const a=w(b("onedrive")),A=Object.assign({},a);let l,c
;const d=e=>{const r=s.Deferred();let n=[];const a=s=>{g.request({method:"GET",url:s||"https://api.onedrive.com/v1.0/drive/special/approot:"+v(t)+":/children",headers:{"Content-Type":" application/json"}}).then(t=>{const s=t.result,i=s?JSON.parse(s):{value:[]};if(n=n.concat(i.value.map(e=>{var t,r,n
;const s=(null===(t=null==e?void 0:e.fileSystemInfo)||void 0===t?void 0:t.lastModifiedDateTime)||0,o=(null===(n=null===(r=null==e?void 0:e.file)||void 0===r?void 0:r.hashes)||void 0===n?void 0:n.sha1Hash)||void 0;return{id:e.id,name:e.name,size:e.size,sha1:o,modified:new Date(s).getTime()}})),i["@odata.nextLink"])return a(i["@odata.nextLink"]);e.set_current_list&&(o=n),r.resolve(n)})};return a(),r.promise()},g=Object.assign(a,{...a,config:{...a.config,
redirect_uri:"https://auth.tampermonkey.net/oauth.php",request_uri:"https://login.live.com/oauth20_authorize.srf",client_id:"000000004C1A3122",storage_key:"od_config",response_type:"token",scope:"onedrive.appfolder",watch_interval:n},getRemoteDomains:()=>["onedrive.live.com"],request:e=>A.request(e).then(e=>e,t=>{if(!t||[403,500].includes(t.status))return e.backoff=2*(e.backoff||1e3),u.sleep(e.backoff).then(()=>g.request(e));if([401].includes(t.status)){
if(i.logger.warn("OneDrive: authentication error",t),delete g.credentials.access_token,!e.retry_auth)return e.retry_auth=!0,g.oauth.run().then(()=>g.request(e))}else if(404==t.status)return s.Deferred.Pledge(t);return g.error(t),s.Deferred.Breach(t)}),list:A.wait(()=>d({set_current_list:!0})),get:A.wait(e=>{const r=e.name||e;return g.request({method:"GET",url:"https://api.onedrive.com/v1.0/drive/special/approot:"+v(t,encodeURIComponent(r))+":/content",responseType:"arraybuffer"}).then(e=>{
const t=e.result;return new Blob([t])})}),put:A.wait((e,r,n)=>{const s=e.name||e,o=encodeURIComponent(s.replace(/[#%<>:"|\?\*\/\\]/g,"-"));return g.request({method:"PUT",url:"https://api.onedrive.com/v1.0/drive/special/approot:"+v(t,o)+":/content",headers:{"Content-Type":"application/octet-stream"},data_type:"typified",data:{type:"raw",value:r}}).then(e=>{const t=n&&n.lastModified?new Date(n.lastModified).toISOString():void 0;if(!t)return e;const r=e.result,s=JSON.parse(r);return g.request({
method:"PATCH",url:"https://api.onedrive.com/v1.0/drive/items/"+s.id,headers:{"Content-Type":"application/json"},data:JSON.stringify({fileSystemInfo:{lastModifiedDateTime:t}})})})}),delete:A.wait(e=>{const r=e.name||e;return g.request({method:"DELETE",url:"https://api.onedrive.com/v1.0/drive/special/approot:"+v(t,encodeURIComponent(r))})}),watch:{start:()=>{if(l)return;l=!0;const e=()=>{if(c=null,!l)return;const t=o;d({set_current_list:!0}).then(()=>{if(!t)return;const e={},r={};o.forEach(t=>{
e[t.id]=t}),t.forEach(e=>{r[e.id]=e}),Object.keys(r).forEach(t=>{const n=e[t],s=r[t];n?s.modified!=n.modified&&g.changes.notify({time:n.modified,name:n.name}):g.changes.notify({time:Date.now(),name:s.name,removed:!0})}),Object.keys(e).forEach(t=>{if(!r[t]){const r=e[t];g.changes.notify({time:r.modified,name:r.name})}})}).fail(e=>{i.logger.warn("OneDrive: file changes check failed",e)}).always(()=>{c=window.setTimeout(e,g.config.watch_interval)})};A.wait(()=>l?(e(),
s.Deferred.Pledge()):s.Deferred.Breach())()},stop:()=>{l=!1,c&&(window.clearTimeout(c),c=null)}}});return g},yandex:()=>{let e,t;(e=p.HTML5.LOCALSTORAGE)&&(t=parseInt(e.getItem("yandex_poll_interval")||""))||(t=18e5);const r=w(b("yandex")),n=k(r),o=Object.assign({},n);let a;const l=Object.assign(n,{...r,...n,config:{...n.config,root:"/Programs/Tampermonkey",url:"https://webdav.yandex.ru",redirect_uri:"https://auth.tampermonkey.net/oauth.php",refresh_supported:!0,
request_uri:"https://oauth.yandex.com/authorize",client_id:"a591fcd2ccd248f0baa84222898065f4",storage_key:"ya_config",response_type:"token",auth_prefix:"OAuth",watch_interval:t},init:()=>{if(a)return a;const e=s.Deferred();return a=e.promise(),l.request({method:"GET",url:"https://cloud-api.yandex.net/v1/disk/"}).done(e=>{const t=e.result,r=t?JSON.parse(t):{}
;r.total_space&&r.used_space&&(r.used_space+5e7>r.total_space?i.logger.warn("Yandex: low disk space warning, only "+(r.total_space-r.used_space)+" bytes available"):i.logger.log("Yandex: "+(r.total_space-r.used_space)+" bytes on disk available!"))}).always(()=>{e.consume(o.init())}),a},getRemoteDomains:()=>["disk.yandex.com"],list:e=>o.list(e).then(e=>e.map(e=>(e.md5=e.etag,e))),request:e=>(()=>{const t=e.headers=e.headers||{};if(t["X-Requested-With"]="XMLHttpRequest",
g&&"PUT"==e.method&&e.data&&"raw"==e.data.type&&e.data.value){const r=s.Deferred();return A.default.blob2str(e.data.value).then(e=>{t.Etag=A.default.MD5(e),t.Sha256=g(e,"ASCII")}).always(r.resolve),r.promise()}return s.Deferred.Pledge()})().then(()=>o.request(e).then(e=>e,t=>t&&[401].includes(t.status)&&(i.logger.warn("Yandex: authentication error",t),delete l.credentials.access_token,!e.retry_auth)?(e.retry_auth=!0,l.oauth.run().then(()=>o.request(e))):t)),compare:(e,t)=>{const r=s.Deferred()
;let n;return(n=e.md5)&&n==A.default.MD5(t,"utf-8")?r.resolve(!0):r.resolve(!1),r.promise()}});return l},webdav:e=>{let t,r;(t=p.HTML5.LOCALSTORAGE)&&(r=parseInt(t.getItem("webdav_poll_interval")||""))||(r=18e5);const n=e.url;if(n){const t=n.toLowerCase();t.startsWith("webdav")?e.url=n.replace(/^webdav/i,"http"):t.startsWith("http")||(e.url="http://"+n)}const o=k((e=>{const t=Object.assign({},e),r=t.type;if(void 0===r)throw new Error("Internal error");const n=Object.assign(e,{...t,config:{
...t.config},credentials:{},request:e=>n.credentials.basic_auth?(e.no_auth||(e.headers=e.headers||{},e.headers.Authorization="Basic "+n.credentials.basic_auth),t.request(e)):s.Deferred.Breach("Authentication failed"),wait:e=>t.wait((...t)=>e(...t))});let o;return Object.defineProperty(n,"credentials",{get:()=>(void 0===o&&(l.default.tC(r,"init"),o={basic_auth:n.config.basic_auth}),o),set:e=>{o=e},enumerable:!1}),n})(b("webdav")));return Object.assign(o,{...o,config:{...o.config,
root:"Tampermonkey",watch_interval:r,...e}})}};t.default=_},function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Notify=void 0;const s=r(1),o=r(3),a=r(2),i=n(r(32)),A=window.rea,l=A.FEATURES,c=window.webkitNotifications,u=(()=>{const e={};let t,r=null;return{create:(n,i,c,u)=>{let d=0;return(()=>{if(t)return t;const n=s.Deferred(),o=e=>{r=e||"unknown",
a.logger.log("notify: chronos level",e),n.resolve()};return A.notifications.supported?(A.notifications.getPermissionLevel(o),A.notifications.onPermissionLevelChanged.addListener(o),A.notifications.onClicked.addListener(t=>{a.logger.log("notify: chronos click",t);const r=e[t];if(!r)return;const n=r.cb;n&&n.click&&n.click(),r.cancel(),delete e[t]}),A.notifications.onClosed.addListener(t=>{a.logger.log("notify: chronos close",t);const r=e[t];if(!r)return;const n=r.cb;n&&n.close&&n.close(),
delete e[t]})):o("unsupported"),t=n.promise()})().then(()=>{const t=s.Deferred();let g=10;const p=()=>{if(r)if("granted"==r){const r={},s={cb:r,on:(e,t)=>{r[e]=t},cancel:()=>{},show:()=>{const r={type:"basic",title:i||"",message:c||""};r.iconUrl=0==d?n:"data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",(l.RUNTIME.CHROME&&l.RUNTIME.BROWSER_VERSION>=70||l.RUNTIME.SAFARI)&&void 0!==u.silent&&(r.silent=u.silent),
l.RUNTIME.CHROME&&l.RUNTIME.BROWSER_VERSION>=50&&(r.requireInteraction=!0);const g=o.createUUID();A.notifications.create(g,r,()=>{if(A.runtime.lastError){if(d<1)return a.logger.log("notify: chronos creating failed, retry...",A.runtime.lastError),d++,void s.show();a.logger.log("notify: chronos creating finally failed",A.runtime.lastError),t.reject()}else a.logger.log("notify: chronos created",g),s.cancel=()=>{e[g]&&A.notifications.clear(g,()=>{})},e[g]=s})}};t.resolve(s)}else t.resolve();else{
const e=()=>{r?p():g--?window.setTimeout(e,200):t.resolve()};e()}};return p(),t.promise()})}}})(),d=(()=>{const e={};let t,r=null;return{create:(n,i,A,c)=>(()=>{if(t)return t;const e=e=>{r=e||"unknown",a.logger.log("notify: notification level",e)};return window.Notification?e(Notification.permission):e("unsupported"),t=s.Deferred.Pledge()})().then(()=>{const t=s.Deferred(),u=()=>{if("granted"==r||"default"==r){const r={cb:{},on:(e,t)=>{r.cb[e]=t},cancel:()=>{},show:()=>{const t={body:A||"",
icon:n};l.RUNTIME.CHROME&&(l.RUNTIME.BROWSER_VERSION>=43&&void 0!==c.silent&&(t.silent=c.silent),t.requireInteraction=!0);const s=o.createUUID(),u=new window.Notification(i||"",t);u.onclick=()=>{a.logger.log("notify: notification click",s);const t=e[s];t&&(t.cb&&t.cb.click&&t.cb.click(),t.cancel(),delete e[s])},u.onclose=u.onerror=t=>{a.logger.log("notify: notification close",s,t);const r=e[s];r&&r.cb&&r.cb.close&&r.cb.close(),delete e[s]},r.cancel=()=>{e[s]&&u.close()},e[s]=r}};t.resolve(r)
}else if("denied"==r)t.resolve();else if("unsupported"==r)t.resolve();else{const e=e=>{r="granted"==e?"granted":"denied",u()};l.RUNTIME.SAFARI?Notification.requestPermission(e):Notification.requestPermission().then(e)}};return u(),t.promise()})}})(),g=(e,t,r)=>{let n=void 0;if(c)try{const s=c.createNotification(e,t||"",r||"");n={on:(e,t)=>{s["on"+e]=t},cancel:()=>{closed||s.cancel()},show:()=>{s.show()}}}catch(e){a.logger.warn("notify: webkitNotifications creation failed with: "+e.message)}
return s.Deferred.Pledge(n)},p=(e,t,r,n)=>{const o={cb:{},on:(e,t)=>{o.cb&&(o.cb[e]=t)},cancel:()=>{},show:()=>{n.informational||window.setTimeout(()=>{const e=confirm((t?t+"\n\n":"")+r);o.cb&&(e?o.cb.click&&o.cb.click():o.cb.close&&o.cb.close())},1)}};return s.Deferred.Pledge(o)},m={notify:(e,t,r,n,o)=>{const l=(n=n||{}).timeout;let c,m=null,f=!1,h=null;const R=()=>{h&&window.clearTimeout(h),!f&&o&&o({})},v=()=>{f=!0,o&&o({clicked:f}),m&&m.cancel()}
;return r=r||A.extension.getURL("images/icon128.png"),i.default.getDataUriFromUrl(r).then(e=>(c=e||r,s.Deferred.Pledge())).then(()=>u.create(c,e,t,n)).then(r=>r||g(c,e,t,n)).then(r=>r||d.create(c,e,t,n)).then(r=>r||p(c,e,t,{informational:!o})).then(n=>{n&&(m=n,n.on("close",R),n.on("click",v),h=window.setTimeout(()=>{h=null,n.cancel()},l||6e5),a.logger.log("notify:",e,t,r,l),n.show&&n.show())}),{cancel:()=>{m&&m.cancel()}}},showUpdate:(e,t,r,n)=>m.notify(e,t,r,{timeout:3e5},n),
show:(e,t,r,n,s)=>m.notify(e,t,r,n,s),highlight:(e,t)=>{A.tabs.highlight({tabs:e},t)}};t.Notify=m},,function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperties(Promise.prototype,{done:{value:function(e){return this.then((...t)=>e.apply(this,t))}},fail:{value:function(e){return this.then(()=>{},(...t)=>e.apply(this,t))}},always:{value:function(e){return this.then((...t)=>e.apply(this,t),(...t)=>e.apply(this,t))}}}),t.default=Promise},function(e,t,r){
"use strict";var n=r(1),s=r(3),o=r(14);const a=rea.FEATURES;let i;const A=a.RUNTIME.BROWSER_VERSION;let l=!0;i=a.RUNTIME.CHROME?A>=83?2020:A>=64?2018:A>=59?2017:A>=47?2015:5:a.RUNTIME.SAFARI?A>=14?2020:A>=11?2018:A>=10?2017:A>=6?2015:3:a.RUNTIME.EDGE?A>=83?2020:A>=16?2017:2016:a.RUNTIME.FIREFOX?A>=77?2020:A>=58?2018:A>=52?2017:2016:5;const c={};a.RUNTIME.CHROME&&A<77?(l=!1,
console.warn("hint: disable inline ESLint config due to web worker CSP issues","https://bugs.chromium.org/p/chromium/issues/detail?id=777076","https://bugs.chromium.org/p/chromium/issues/detail?id=159303")):a.RUNTIME.EDGE?(l=!1,console.warn("hint: disable inline ESLint config due to web worker CSP issues")):window.Worker||(l=!1,
console.warn("hint: disable inline ESLint config because web workers are unavailable and this extension's CSP doesn't allow unsafe eval, which is required for ESLint's dynamic reconfigration"));const u={env:{es6:i>=2015,browser:!0},parserOptions:{ecmaVersion:i,sourceType:"script",ecmaFeatures:{globalReturn:!0}},rules:{curly:[1,"multi-line"],"dot-location":0,"dot-notation":[1,{allowKeywords:!0}],"no-caller":1,"no-case-declarations":2,"no-div-regex":0,"no-empty-pattern":2,"no-eq-null":0,
"no-eval":1,"no-extra-bind":1,"no-fallthrough":1,"no-implicit-globals":2,"no-implied-eval":1,"no-lone-blocks":1,"no-loop-func":1,"no-multi-spaces":1,"no-multi-str":1,"no-native-reassign":1,"no-octal-escape":2,"no-octal":2,"no-proto":1,"no-redeclare":2,"no-return-assign":1,"no-sequences":1,"no-undef":1,"no-useless-call":1,"no-useless-concat":1,"no-with":1}},d={};let g
;Object(s.each)(["uneval","unsafeWindow","TM_info","GM_info","GM","GM_addStyle","GM_deleteValue","GM_listValues","GM_getValue","GM_download","GM_log","GM_registerMenuCommand","GM_unregisterMenuCommand","GM_openInTab","GM_setValue","GM_addValueChangeListener","GM_removeValueChangeListener","GM_xmlhttpRequest","GM_getTab","GM_setTab","GM_saveTab","GM_getTabs","GM_setClipboard","GM_notification","GM_getResourceText","GM_getResourceURL"],e=>{d[e]="writeable"}),u.globals=d;const p={};let m;const f={
hint:function(e,t,r){const i=Object(n.Deferred)(),A=i.promise(),f=r||c;let h;if(t?(h=t,h.globals={...h.globals||{},...d}):h=u,window.Worker&&!a.RUNTIME.SAFARI){const t=()=>{g=new Worker("worker/lint.js"),g.onmessage=e=>{const t=e.data,r=t.id;let n,s,o;r&&(n=p[r])&&(s=n.d)&&(delete p[r],(o=t.results)?(l||(o=o.map(e=>{let t
;return e.message&&(t=e.message.match(/Configuration for rule "([^"]+)"[\s\S]*evaluate a string as JavaScript[\s\S]*/))&&(e.message='Rule "'+t[1]+'": ESLint inline configuration is not supported by this browser.',e.severity=1),e})),s.resolve(o)):s.reject(t.error||"Unknown error")),R(r)},g.postMessage({method:"base_uri",value:rea.extension.getURL("/")}),m=null};var R=e=>{if(g||t(),e)m=null;else if(m)return;let r,n=Date.now();Object.keys(p).forEach(e=>{p[e].ts<=n&&(r=p[e],n=r.ts)}),r&&(m=r.id,
g.postMessage({method:r.method,id:r.id,config:r.c,options:r.o,text:r.t}))};A.abort=()=>{g&&(g.terminate(),g=null,R())},g||t();const r=Object(s.createUUID)();p[r]={method:"lint",id:r,d:i,t:e,c:h,o:f,ts:Date.now()},R()}else Object(o.vendor)("vendor/eslint/eslint",()=>{try{const t={problem:"error",layout:1,suggestion:1},r=new window.eslint.Linter;h.extends&&h.extends.includes("eslint:recommended")&&(h.rules=h.rules||[],r.getRules().forEach((function(e,r){let n,s,o,a,i
;if(!(e&&(s=e.meta)&&void 0===h.rules[r]&&(n=s.docs)&&n.recommended))return;const A=[(s.type?t[s.type]:null)||1];(o=s.schema)&&(a={},o.forEach(e=>{"object"==e.type&&Object.keys(e.properties).forEach(t=>{const r=e.properties[t].default;void 0!==r&&!1!==r&&(a[t]=e.properties[t].default,i=!0)})}),i&&A.push(a)),h.rules[r]=A})));const n=r.verify(e,h,f);i.resolve(n||[])}catch(e){i.reject(e)}});return A},globals:d,config:u,options:c,autoHintMaxLength:5e4};t.a=f},,function(e,t,r){"use strict"
;var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SRI=void 0;const s=n(r(6)),o=n(r(4)),a=r(1),i=r(2),A=window.forge_sha256,l=["md5","sha256","sha1","sha384","sha512"],c=(()=>{const e=e=>{const t=[],r=new DataView(e);for(let e=0;e<r.byteLength;e+=4){const n="00000000",s=(n+r.getUint32(e).toString(16)).slice(-n.length);t.push(s)}return t.join("")},t=t=>{try{
return e(s.default.str2abSync(s.default.Base64.decode(t)))}catch(e){return null}},r={md5:(e,t)=>a.Deferred.Pledge(s.default.MD5(e,t)),sha256:(e,t)=>a.Deferred.Pledge(A(e,t))},n={};["SHA-1","SHA-384","SHA-512"].forEach(t=>{const r=t.toLowerCase().replace("-","");n[r]=()=>{const r=(r,n)=>{const o=a.Deferred();return window.crypto.subtle.digest(t,s.default.str2abSync(r,{encoding:n})).then(t=>{o.resolve(e(t))},()=>{o.reject()}),o.promise()};try{
return r("").then(e=>e&&e.substr(0,4).toLowerCase().match(/[0-9a-f]{4,4}/)?r:a.Deferred.Breach())}catch(e){return a.Deferred.Breach()}}});const c=e=>Object.keys(r).includes(e),u=e=>(...t)=>{if(!1!==d){const r=a.Deferred();return d.push(()=>r.consume(e(...t))),r.promise()}return e(...t)};let d=[];return{init:()=>(i.logger.get()>=i.DEBUG&&Object.keys(r).forEach(e=>i.logger.log("sri:",e,"is supported")),a.Deferred.sidebyside(Object.keys(n).map(e=>n[e]().done(t=>{
i.logger.log("sri:",e,"is supported"),r[e]=t}).fail(()=>{i.logger.log("sri:",e,"is unsupported")}))).always(()=>{if(!1===d)return;const e=d;d=!1,e.forEach(e=>e())})),isSupported:u(e=>a.Deferred.Pledge(c(e))),getHash:u((e,r)=>{const n=a.Deferred();if("string"==typeof e&&(e=o.default.parse(e)),e&&e.hash){let s;const o=e.hash.replace(/^#/,"").split(/,|;/g);for(let e=0;e<o.length;e++){const r=o[e].match(/([^=|:|-]+)[=|:|-](.+)/);if(!r||3!=r.length||!c(r[1]))continue;let n=r[2]
;/^[0-9a-fA-F]+$/.exec(n)||(n=t(decodeURIComponent(n))||n);const a=r[1];l.includes(a)&&(s={type:a,value:n})}n.resolve(s||(r?s:{type:"unsupported",value:""}))}else n.resolve();return n.promise()}),check:u((e,t,n)=>t&&e&&c(e.type)?r[e.type](t,n).then(t=>t===e.value?a.Deferred.Pledge(!0):a.Deferred.Breach({type:e.type,value:t})):a.Deferred.Breach())}})();t.SRI=c},function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}}
;Object.defineProperty(t,"__esModule",{value:!0}),t.Promise=t.fromEntries=void 0;const s=r(23);Object.defineProperty(t,"fromEntries",{enumerable:!0,get:function(){return s.fromEntries}});const o=n(r(18));t.Promise=o.default},function(e,t){"use strict";let r;Object.defineProperty(t,"__esModule",{value:!0}),t.fromEntries=void 0,t.fromEntries=r,Object.fromEntries?t.fromEntries=r=Object.fromEntries:(t.fromEntries=r=e=>[...e].reduce((e,[t,r])=>(e[t]=r,e),{}),Object.fromEntries=r)
},,,,,,,,,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(1),s=window.rea;let o,a;const i=(e,t,r,n)=>{const s="rgba("+n.join(",")+", 1)";o.fillStyle=s,o.beginPath(),o.arc(e,t,r,0,2*Math.PI,!0),o.fill()},A=(e,t,r,n,s,a)=>{null==s&&(s=!0),s?(o.fillStyle="rgba("+a.join(",")+", 0.99)",o.fillRect(e,t,r,n)):(o.fillStyle="rgb("+a.join(",")+", 1)",o.beginPath(),o.moveTo(e,t),o.lineTo(e+r,t),o.lineTo(e+r,t+n),o.lineTo(e,t+n),o.lineTo(e,t),o.stroke())
},l=(e,t,r,n,s,o)=>{const a=s;i(e+a,t+a,s,o),i(r-a,t+a,s,o),i(e+a,n-a,s,o),i(r-a,n-a,s,o),A(e+s,t,r-e-2*s,n-t,!0,o),A(e,t+s,r-e,n-t-2*s,!0,o)},c={toPNG:()=>a.toDataURL(),getDataUriFromUrl:e=>{const t=n.Deferred(),r=document.createElement("img");let s=!1,o=null;const a=document.body||document.documentElement||document;a.appendChild(r);const i=()=>{o&&window.clearTimeout(o),s||t.reject()};return o=window.setTimeout(()=>{o=null,i(),s=!0},5e3),r.onload=()=>{var e;let n,i;o&&window.clearTimeout(o)
;try{i=document.createElement("canvas"),i.width=r.width,i.height=r.height,null===(e=i.getContext("2d"))||void 0===e||e.drawImage(r,0,0),n=i.toDataURL(),a.removeChild(r)}catch(e){}s||t.resolve(n)},r.onerror=i,r.src=e,t.promise()},createIconEx:e=>{const t=n.Deferred();return((e,t,r,n,s,i,A)=>{const l=document.createElement("img");l.onload=()=>{((e,t)=>{let r=null;r=a||document.createElement("canvas"),r.height=t,r.width=e,(e=>{a=e;const t=a.getContext("2d");t&&(o=t)})(r)})(140,140),o.scale(1,1),
o.drawImage(l,6,6),l.parentNode&&l.parentNode.removeChild(l),A&&A()},l.src=e})(s.extension.getURL("images/icon128.png"),0,0,0,0,0,()=>{const r=116-(e>10?14:0)-(e>100?14:0)-(e>1e3?14:0)-(e>1e4?14:0);l(r,0,140,25,4,[200,0,0]),l(r+3,3,137,22,4,[190,0,0]),((e,t,r)=>{o.font="22pt Arial bold",o.fillStyle="rgba("+[240,250,240].join(",")+", 1)",o.fillText(r.toString(),e,22)})(r+4,0,e),t.resolve(a.toDataURL())}),t.promise()}};t.default=c},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,r){"use strict"
;r.r(t),r(22);var n=r(18),s=r.n(n),o=r(1),a=r(12),i=r.n(a),A=r(3),l=r(5),c=r.n(l),u=r(16);let d={},g=null;const p=()=>{const e=Date.now(),t=d;d={};const r=Object.keys(t);r.forEach(r=>{const n=t[r];n&&e-n.ts<m?d[r]=n:n.com.reject()}),g&&0===r.length&&(window.clearInterval(g),g=null)},m=15e3;let f=!1;const h=(e,t)=>{f||R.init(),null===g&&(g=window.setInterval(p,5e3));const r=Object(o.Deferred)();return((e,t)=>{const r=Object(o.Deferred)();return void 0===t&&(t=!0),rea.tabs.getSelected(null,n=>{
const s=n?n.index+1:void 0;rea.tabs.create({url:rea.extension.getURL("ask.html")+"?aid="+e,active:t,index:s,parent:n},e=>{if(!e){const e="rea.tabs.create failed -> giving up now!";console.error(e),r.reject({error:e})}r.resolve({id:e.id,close:function(){rea.tabs.remove(e.id)}})})}),r.promise()})((e=>{const t=Object(A.createUUID)();return d[t]=e,t})({ts:Date.now(),com:r,preparat:t,type:e}),t.active).then(e=>r.promise().done(t=>{(t.ok||t.aborted)&&e.close()}))},R={init:function(){f||(f=!0)},
onMessage:function(e){const t=Object(o.Deferred)(),r=e.aid,n=d[r];if(n)if(n.aborter&&(window.clearTimeout(n.aborter),delete n.aborter),"ping"==e.method)d[r].ts=Date.now(),t.resolve({pong:!0});else if("preparat"==e.method)t.resolve({preparat:n.preparat,type:n.type});else if("install"==e.method)n.com.resolve({ok:!0}),t.resolve({}),delete d[r];else if("import"==e.method)n.com.resolve({ok:!0,externals_ids:e.externals_ids,storage_ids:e.storage_ids,import_ids:e.import_ids,
global_settings:e.global_settings}),t.resolve({}),delete d[r];else if("permission"==e.method)n.com.resolve({ok:!0,granted:e.granted,permissions:e.permissions,origins:e.origins}),t.resolve({}),delete d[r];else if("unload"==e.method||"abort"==e.method){t.resolve({});const s=()=>{n.com.resolve({ok:!1,aborted:!0}),delete d[r]};"abort"==e.method?s():n.aborter=window.setTimeout(s,3e3)}else"connect"==e.method&&(n.com.resolve(e),t.resolve({}),delete d[r]);else t.reject({error:"unknown_id",
please_close:!0});return t.promise()},install:function(e){return h("install",e)},import:function(e){return h("import",e)},askForPermission:function(e,t,r){return h("permission",{permissions:e.permissions,origins:e.origins,title:t,message:r})},installError:function(e){return h("install_error",e)},askForConnect:function(e){return h("connect",e)}};var v=R;let b=!1,w=null,k=null;const _=()=>b||o.Deferred.Pledge(),y=e=>{rea.permissions.supported&&(rea.permissions.onAdded.addListener(t=>{e({added:t})
}),rea.permissions.onRemoved.addListener(t=>{e({removed:t})}))},E={permDownloads:"downloads",get:function(){const e=Object(o.Deferred)();return w={},k={},b=e.promise(),rea.permissions.supported?rea.permissions.getAll(t=>{t.permissions&&Object(A.each)(t.permissions,e=>{w[e]=!0}),t.origins&&Object(A.each)(t.origins,e=>{k[e]=!0}),b=null,e.resolve()}):e.resolve(),e.promise()},has:function(e){return _().then(()=>!rea.permissions.supported||(w?!!w[e]||!!k[e]:(y(()=>{_().then(E.get)}),
E.get().then(()=>E.has(e)))))},hasOrigin:function(e){return Array.isArray(e)||(e=[e]),_().then(()=>{const t=Object(o.Deferred)();return rea.permissions.supported?rea.permissions.contains({origins:e},e=>{t.resolve(e)}):t.resolve(!0),t.promise()})},ask:function(e,t,r){Array.isArray(e)||(e=[e]);const n=Object(o.Deferred)();return rea.permissions.supported?v.askForPermission({permissions:e},t,r).done(t=>{t.granted&&(w||(w={}),w[e]=!0),n.resolve(t.granted)}):n.resolve(!1),n.promise()},
askOrigin:function(e,t,r){Array.isArray(e)||(e=[e]);const n=Object(o.Deferred)();return rea.permissions.supported?v.askForPermission({origins:e},t,r).done(e=>{n.resolve(e.granted)}):n.resolve(!1),n.promise()},remove:function(e){return _().then(()=>{const t=Object(o.Deferred)();return rea.permissions.supported?(b=t.promise(),rea.permissions.remove({permissions:[e]},r=>{b=null,w&&(w[e]=!1),t.resolve(r)})):t.resolve(!0),t.promise()})},addListener:y}
;var I=E,x=r(9),T=r(4),M=r(0),S=r(21),G=r(2),U=r(10),N=r(11),O=r(6),Z=r.n(O),C=r(14);const D=rea.FEATURES,j={DEFAULT:"default",OFF:"off",NATIVE:"native",CHROME:"chrome",NOT_ENABLED:"not_enabled",NOT_WHITELISTED:"not_whitelisted",NOT_PERMITTED:"not_permitted",NOT_SUPPORTED:"not_supported",NOT_SUCCEEDED:"not_succeeded"},F=N.default.run;let B=j.OFF,L=[],P=null,V=!1;const Q={};let H,X=!1,q=Object(U.createQueue)({threads:6}),z=()=>{H=Object(U.createQueue)({threads:3});const e=Object(o.Deferred)()
;return Object(C.vendor)(["vendor/saveas/filesaver"],()=>{z=o.Deferred.Pledge,e.resolve()}),e.promise()};const Y=()=>null!==P?o.Deferred.Pledge(P):!rea.permissions.supported&&rea.downloads.supported?(P=!0,o.Deferred.Pledge(P)):I.has(I.permDownloads).then(e=>(P=e,G.logger.log("downs: permission to use rea.downloads ->",e),Y())),W=function(e,t){this[e]&&this[e]("function"==typeof t?t():t)},J=function(e){this[e]&&(W.apply(this,arguments),this[e]=null)};let K=0;var $=(e,t,r)=>{
var n=Object(o.Deferred)();te();const s={filename:e.name};let a;if(D.RUNTIME.FIREFOX&&D.RUNTIME.BROWSER_VERSION<52)a=["url"];else{a=["url","method","saveAs"],s.body=e.data;const t=e.headers;t&&(Array.isArray(t)?G.logger.warn("downs: invalid type of headers property",t):s.headers=Object.keys(t).map(e=>({name:e,value:t[e]})))}a.forEach(t=>{s[t]=e[t]});const i=Q[t.download_id]={callbacks:{onprogress:r.onprogress,onload:e=>{n.resolve(),A("onload",e)},onerror:e=>{n.reject(e),A("onerror",e)}},
url:e.url,name:e.name},A=(...e)=>J.apply(r,e);if(rea.downloads.download(s,(e,t)=>{if(void 0===e)return n.reject(t),void A("onerror",{error:t});i.id=e;const r=t=>{rea.downloads.cancel(e,()=>{s(),t&&t()})};var s=()=>{rea.downloads.search({id:e},t=>{let r;(r=t[0])?ee(r):G.logger.warn("downs: unable to query download ID",e)})};!0===i.cancel?r():(i.cancel=r,i.interval=window.setInterval(s,1e3))}),rea.runtime.lastError){const e=rea.runtime.lastError.message;n.reject(e),A("onerror",{error:e})}
return n.promise()},ee=e=>{const{item:t,key:r}=(e=>{let t,r;return Object.keys(Q).every(n=>{let s;return!(s=Q[n])||s.id!=e||(r=n,t=s,!1)}),{item:t,key:r}})(e.id);if(t){const n=t.callbacks,s=(...e)=>J.apply(n,e),o=()=>{t.interval&&(window.clearInterval(t.interval),t.interval=null),delete Q[r]};e.error||[e.state,e.state&&e.state.current].includes("interrupted")?(G.logger.warn("downs: download of",t.name,"("+t.url+")","failed",e.error),s("onerror",{error:j.NOT_SUCCEEDED,details:e.error}),
o()):e.endTime||[e.state,e.state&&e.state.current].includes("complete")?(G.logger.log("downs: download of",t.name,"("+t.url+")","finished"),s("onload",{}),o()):void 0===e.totalBytes&&void 0===e.bytesReceived||s("onprogress",{loaded:e.bytesReceived,total:e.totalBytes,estimatedEndTime:e.estimatedEndTime})}},te=()=>{P&&!X&&rea.downloads.supported&&(rea.downloads.onChanged.addListener(ee),X=!0)},re=e=>{let t=!1;return Object(A.each)(L,r=>{if(r&&r.length)try{let n
;if("/"===r[0])"$"!==(r=r.replace(/^\//g,"").replace(/\/$/g,""))[r.length-1]&&(G.logger.log("downs: patching $ into",r),r+="$"),n=new RegExp(r,"i");else if("."===r[0]){const e=[Object(A.escapeForRegExp)(r),"$"].join("");n=new RegExp(e,"i")}else G.logger.warn("downs: invalid file extension:",'"'+r+'"','starts neither with "." nor with "/"');if(n&&-1!==e.search(n))return G.logger.log("downs:",r,"matched @",e),t=!0,!0}catch(e){G.logger.warn("downs: can't process",r,e)}}),t},ne={
start:function(e,t,r){r=r||{};const n=++K,s=(...e)=>J.apply(t,e);if(Q[n]={},G.logger.log("downs: start",e),!r.internal){if(B==j.OFF)return G.logger.warn("downs: feature is not enabled"),void s("onerror",{error:j.NOT_ENABLED});if(!e.name||!re(e.name))return G.logger.warn("downs:",e.name,"is not whitelisted"),void s("onerror",{error:j.NOT_WHITELISTED});if(!rea.downloads.supported&&B==j.CHROME)return G.logger.warn("downs: this download mode is not supported"),void s("onerror",{error:j.NOT_SUPPORTED
})}const a=()=>{if(Q[n].cancel)return s("onerror",{error:"aborted"}),o.Deferred.Breach("aborted")},i=e.name;let l;return i&&(e.name=Object(A.safeFileName)(i,!0),i!=e.name&&G.logger.warn(`downs: changed file name from ${i} to ${e.name} for safety`)),o.Deferred.Pledge().then(()=>{if(rea.downloads.supported&&(r.internal||B==j.CHROME||B==j.DEFAULT))return Y().then(e=>l=e).then(a);l=!1
}).then(()=>"data:"==T.default.parse(e.url).protocol?Z.a.dataUri2Blob(e.url):!l||!r.internal&&(D.RUNTIME.FIREFOX||D.RUNTIME.SAFARI)&&B==j.DEFAULT?((e,t,r)=>q.add(()=>{var n=Object(o.Deferred)();void 0===r&&(r={});const s=(...e)=>J.apply(r,e);e.responseType="blob",e.method=e.method||"GET";const a=F(e,{onload:t=>{if(4!=t.readyState||200!=t.status&&0!=t.status||t.error){const e=t.error||t.statusText||"xhr_failed";n.reject(e),s("onerror",{error:e})}else{
const r=N.default.parseHeaders(t.responseHeaders)["content-type"],o=new Blob([t.response],{type:e.overrideMimeType||r||"binary/octet-stream"});n.resolve(o),s("onload",{})}},onerror:e=>{n.reject(),s("onerror",e)},onabort:()=>{n.reject(),s("onerror",{error:"aborted"})},ontimeout:e=>{n.reject(),s("ontimeout",e)},onprogress:r.onprogress},{internal:t.internal});return Q[t.download_id]={cancel:a?a.abort:()=>{}},n.promise()}))(e,{internal:r.internal,download_id:n},{onerror:t.onerror,
ontimeout:t.ontimeout,onprogress:t.onprogress}):void 0).then(a=>{if(a&&l){let r;return o.Deferred.Pledge().then(()=>{if(D.RUNTIME.SHARED_OBJECT_URLS)return r=URL.createObjectURL(a);var e=Object(o.Deferred)();return Z.a.blob2dataUri(a,e.resolve),e.promise()}).then(s=>$({url:s,name:e.name,saveAs:e.saveAs},{download_id:n},{onerror:t.onerror,onload:t.onload}).always(()=>{r&&URL.revokeObjectURL(r)}))}return a?(e.name=e.name||"File.download",z().then(async()=>H.add(async()=>{saveAs(a,e.name),
await Object(U.sleep)(500),s("onload",{})}))):l?$(e,{download_id:n},t):void(r.internal||B!=j.CHROME?(G.logger.warn("downs: download failed"),s("onerror",{error:"failed"})):(G.logger.warn("downs: download permission is missing"),s("onerror",{error:j.NOT_PERMITTED})))}).always(()=>{delete Q[n],window.setTimeout(()=>s("ondone",{}),1)}),n},cancel:e=>{let t;if(t=Q[e])return t.cancel?"function"==typeof t.cancel&&t.cancel():t.cancel=!0,!0},set_mode:e=>{B=e,B==j.CHROME&&Y().done(e=>{
e||I.has(I.permDownloads).then(e=>{const t=Object(o.Deferred)();return V||e?t.resolve({permission:e,asked:!1}):I.ask(I.permDownloads,M.I18N.getMessage("Browser_API_Downloads"),M.I18N.getMessage("Click_here_to_allow_TM_to_start_downloads")).done(e=>{t.resolve({permission:e,asked:!0})}),V=!0,t.promise()}).done(e=>{e.permission&&e.asked&&rea.page.reload()})})},set_whitelist:e=>{"Array"===Object(A.toType)(e)&&(L=e)},is_whitelisted:re,remove_permission:()=>I.remove(I.permDownloads),staticVars:j
},se=r(19);const oe={mkCompat:function(e,t,r,n){return t&&((t.options.compat_wrappedjsobject||n)&&(e=oe.unWrappedJsObjectify(e)),(t.options.compat_metadata||n)&&(e=oe.unMetaDataify(e)),(t.options.compat_foreach||n)&&(e=oe.unEachify(e))),r||(e=e.replace(/([\'\"]{1,1})use strict([\'\"]{1,1})/g,"$1use strict$2")),e},findPrototypes:function(e){if(e.includes(".toSource("))return!0;const t=["indexOf","lastIndexOf","filter","forEach","every","map","some","slice"]
;for(const r in t)if(e.includes("Array."+t[r]+"("))return!0;return!1},unEachify:function(e){const t=(e=e.replace(/for each[ \t]*\(/gi,"for each(")).split("for each");for(let e=1;e<t.length;e++){const r=t[e];if("("!=r.substr(0,1)){t[e]=" each"+t[e];continue}const n=Object(A.getStringBetweenTags)(r,"(",")"),s=n.split(" ");let o=null,a=null,i=null;for(const e in s)""!=s[e]&&"var"!=s[e]&&(o?a?i||(i=s[e]):a=s[e]:o=s[e]);if(!o||!i){t[e]=" each"+t[e];continue}const l="var __kk in "+i;let c=""
;c+="{\n    if (!"+i+".hasOwnProperty(__kk)) continue;",c+=" \n    var "+o+" = "+i+"[__kk];",t[e]=t[e].replace(n,l).replace("{",c)}return t.join("for")},unMetaDataify:function(e){let t=e,r=e;const n="<><![CDATA[",s="]]></>";let o=t.indexOf(n);for(;-1!=o;){const e=t.substr(0,o),a=e.lastIndexOf("\n");let i="";-1!=a&&(i=e.substr(a,e.length-a)),t=t.substr(o,t.length-o);const l=i.indexOf("/*"),c=i.indexOf("//");if(-1==l&&-1==c){const e=Object(A.getStringBetweenTags)(t,n,s);let o=e
;o=o.replace(/\\/g,"\\\\"),o=o.replace(/\"/g,'\\"').replace(/\n/g,'\\n" + \n"'),o=o.replace(/^\n/g,"").replace(/\n$/g,""),o=o.replace(/\r/g,"");const a=n+e+s;r=r.replace(a,'(new CDATA("'+o+'"))')}t=t.substr(1,t.length-1),o=t.indexOf(n)}return r},unWrappedJsObjectify:function(e){const t=e.split("\n");for(let e=0;e<t.length;e++){const r=t[e].indexOf(".wrappedJSObject");if(-1==r)continue;const n=t[e].indexOf("//");-1!=n&&n<r||(t[e]=t[e].replace(/\.wrappedJSObject/g,""))}return t.join("\n")}}
;var ae=oe,ie=r(7),Ae=r(13);const le="root",ce=["http://*/*","https://*/*","file://*/*"];let ue,de,ge,pe={},me={};const fe=(e,t)=>{const r=e.id;pe[r]?(delete e.id,rea.contextMenus.update(r,e)):rea.contextMenus.create(e),me[r]=!0,window.setTimeout(t,1)},he=()=>{const e=Object(o.Deferred)();return rea.contextMenus.removeAll(()=>{ue=null,pe={},e.resolve()}),e.promise()};var Re={init:({onclick:e})=>rea.contextMenus.supported?(rea.contextMenus.onClicked.addListener((t,r)=>{console.debug(t,r),
r&&t.menuItemId&&t.parentMenuItemId&&e&&e({id:t.menuItemId,tabId:r.id,frameId:t.frameId,url:t.frameUrl||t.pageUrl,isMenuCommand:t.parentMenuItemId!=le})}),he()):o.Deferred.Pledge(),clean:e=>{const t=Object(o.Deferred)();return e.forEach(e=>{rea.contextMenus.remove(e,()=>{const e=rea.runtime.lastError;e&&console.warn(e.message),t.resolve()})}),t.promise()},update:({contexters:e,commands:t})=>{if(de){ge&&ge.deferred.reject();const r=Object(o.Deferred)();return ge={contexters:e,commands:t,
deferred:r},r.promise()}if(!e.length&&!t.length)return he();const r=Object.keys(pe);return me={},de=o.Deferred.Pledge().then(()=>ue||(()=>{const e=Object(o.Deferred)();return he().then(()=>{ue=rea.contextMenus.create({id:le,contexts:["all"],title:"Tampermonkey",type:"normal",documentUrlPatterns:ce},()=>{e.resolve()})}),e.promise()})()).then(()=>{if(t.length)return o.Deferred.when(t.map(e=>{return t=e.uuid,r=e.scriptName,o.Deferred.Pledge().then(()=>{const e=Object(o.Deferred)();return fe({id:t,
parentId:le,contexts:["all"],title:"🛠 "+r,type:"normal",documentUrlPatterns:ce},()=>e.resolve()),e.promise()});var t,r}))}).then(()=>((e,t)=>{const r=[];return Object(A.each)(e,e=>{const t=Object(o.Deferred)();fe({id:e.uuid,contexts:["all"],parentId:le,title:"🖱 "+e.name,type:"normal",documentUrlPatterns:ce},()=>t.resolve()),r.push(t.promise())}),Object(A.each)(t,e=>{const t=Object(o.Deferred)();let n;try{const t=new RegExp("^"+Object(A.escapeForRegExp)(e.scriptName)+"[ -:+/]*")
;n=e.name.replace(t,"")}catch(e){console.warn(e)}fe({id:e.menuId,contexts:["all"],parentId:e.uuid,title:"🔧 "+(n||e.name),type:"normal",documentUrlPatterns:ce},()=>t.resolve()),r.push(t.promise())}),o.Deferred.when(r)})(e,t)).always(()=>{const e=Object(A.adiff)(Object.keys(me),r,"notinfirst");e.length&&Re.clean(e),pe=me;const t=ge;de=ge=null,t&&Re.update(t).then(t.deferred.resolve)}),de}},ve=Re;const be=Object(U.createCache)({timeout:600,check_interval:300,retimeout_on_get:!0}).init()
;let we,ke,_e,ye;const Ee=()=>({utm_source:"ext",utm_medium:_e.substr(0,3),utm_campaign:rea.runtime.short_id}),Ie=e=>we+"/api?"+T.default.hash2params(Object.assign({l:ke,q:e},Ee()));let xe;var Te=(e,{url:t,mode:r})=>{ye=e.internal,we=t,_e=r,ke=M.I18N.getLocale()||M.I18N.getUiLocale()},Me=e=>{const t=Ie(e),r=be.get(t);if(r)return r;const n=Object(o.Deferred)(),s=n.promise(),a=e=>{n.resolve({error:e})};if(xe&&xe>Date.now())return a("rate limit or backoff"),s
;if(!e.startsWith("http"))return a("unsupported url"),s;xe=void 0;let i=1;const A=ye({url:t,headers:{Accept:"application/json, */*"},fetch:!0,responseType:"json"},{onload:e=>{if(200==e.status){const{count:t,url:r}=e.response,s=`${we}${r}`;i=1,n.resolve({count:Number(t||0),url:s})}else if(429===e.status){const t=N.default.parseHeaders(e.responseHeaders),r=Number(t["retry-after"]||15);i=1,r&&(xe=Date.now()+1e3*r,a("rate limit"))}else i=Math.min(2*i,300),xe=Date.now()+1e3*i,
a(e.responseText||"unknown error")},onerror:e=>{a(e)},onabort:()=>{a("aborted")},ontimeout:e=>{a(e)}},{internal:!0});return s.abort=()=>A.abort(),be.set(t,s),s},Se=e=>(e=>{let t,r="",n="";return"click"==_e?(r="?"+T.default.hash2params(Object.assign({l:ke},Ee())),n="#"+T.default.hash2params(Object.assign({q:e})),t=we+"/"+r+n):(r="?"+T.default.hash2params(Object.assign({l:ke,q:e},Ee())),t=we+"/search?"+r+n),t})(e),Ge=()=>{const e="?"+T.default.hash2params(Object.assign({l:ke},Ee()))
;return we+"/privacy?"+e};const Ue=window.Tests;const Ne=rea.FEATURES,Oe="https://www.userscript.zone",Ze=new Date,Ce=(()=>{const e=[],t=(e,t,r)=>{const n={title:e.join("\n\n")},s=t.frag?"_"+t.frag:"";t.path=rea.extension.getURL("images/icon"+s+".png"),G.logger.warn(e.join("\n")),rea.browserAction.setIcon({path:t.path}),rea.browserAction.setTitle(n),r||rea.extension.onMessage.addListener((t,r,n)=>{const s={name:"1",id:"1",sub_menu_item:!0,pos:"left",items:[]};s.items.push({name:e[0],image:"info"
}),e.length>1&&s.items.push({name:e[1]}),n({items:[s],options:{enabled:!1}})})};return{run:()=>{if("chromeStorage"==Ne.DB.USE&&!Ne.DB.NO_WARNING){const e=()=>{if(!c.a)return window.setTimeout(e,2e3);c.a.isWorking().fail(()=>{if(confirm("Tampermonkey detected that the extension storage is unreliable!\n\nUnfortunately this means that all your settings and userscripts are inaccessible at the moment.\n\nDo you want to visit the FAQ entry that explains how to recover from that?")){const e={
url:"https://www.tampermonkey.net/faq#Q206"};rea.tabs.create(e,()=>{})}t(["Tampermonkey detected that the extension storage is unreliable!"],{frag:"paused"},!0)})};window.setTimeout(e,1e3)}return!0},pause:t,setWarning:function(t,r,n){e.push({text:t,description:r,url:n})},getWarnings:function(){return e}}})();if(!Ce.run())throw"Quitting now";window.uris=T.default,window.down=ne,window.perm=I,window.dast=c.a;const De=Object(A.createUUID)(),je={};G.logger.debug("Starting background fred @"+De)
;const Fe=Object(U.createCache)({timeout:5,check_interval:10,retimeout_on_get:!0}).init(),Be=Object(U.createCache)({timeout:300,check_interval:120,retimeout_on_get:!0}).init(),Le=()=>{const e=Object(o.Deferred)(),t="0.0.0.0";let r,n;const s=rea.extension.manifest.version,a=c.a.getSchemaVersion();let i=a;return c.a.getVersion(t).then(e=>(n=e,r=Object(ie.versionCmp)(s,n)==ie.versionCmp.eNEWER,c.a.isWiped())).then((function(e){if(!r&&e){
const e=["Tampermonkey detected inconsistencies that indicate that your browser wiped the extension database!","You can continue to use Tampermonkey normally, but your settings and scripts might be lost. Click here to get more information.","https://www.tampermonkey.net/faq.php#Q207"];G.logger.warn(e.join("\n")),Ce.setWarning.apply(this,e)}})).always(()=>{let l=[],u=0;const d=()=>{if(u<l.length){const t=()=>{u++,d()},r=l[u].schema;l[u].cond(r)?l[u].fn().done(()=>{
r&&(G.logger.info("Converted database from",i,"to",r),i=r),t()}).fail(()=>{e.reject()}):t()}},g=()=>{G.logger.warn("Incognito mode detected. Database conversion can only be done in non-incognito mode! Stopping now..."),Ce.pause(["Tampermonkey needs to convert its database but this can't be done in incogonito mode!","Please open a non-incognito mode window and/or restart your browser."],{frag:"paused"})};l=[{cond:function(){
return r&&!Ne.RUNTIME.FIREFOX&&!Ne.RUNTIME.EDGE&&"chromeStorage"==Ne.DB.USE&&!c.a.getValue(Ne.CONSTANTS.STORAGE.LEGACY_VERSION)&&Object(ie.versionCmp)("3.5.3603",n)==ie.versionCmp.eNEWER},fn:function(){const e=Object(o.Deferred)();return rea.extension.inIncognitoContext?(g(),e.reject()):(G.logger.info("Update database..."),i="3.5.3603",c.a.migrate("sql","chromeStorage").done(()=>{G.logger.info("Copied config for default usage of chrome storage"),e.resolve()}).fail(()=>{e.resolve()})),e.promise()
}},{cond:function(){return r&&Object(ie.versionCmp)("3.6.3650",i)==ie.versionCmp.eNEWER&&Object(ie.versionCmp)("3.5.3650",n)==ie.versionCmp.eNEWER},fn:function(){const e=Object(o.Deferred)();if(rea.extension.inIncognitoContext)g(),e.reject();else{i="3.6.3650";const t=[];[{o:"TM_config",n:Ne.CONSTANTS.STORAGE.CONFIG},{o:"TM_update_check",n:Ne.CONSTANTS.STORAGE.UPDATE},{o:"TM_version"},{o:"TM_unload_ts"}].forEach(e=>{if(e.n){const r=c.a.getValue(e.o);void 0!==r&&t.push(c.a.setValue(e.n,r))}
t.push(c.a.deleteValue(e.o))});let r=new RegExp("@re$");const s=[];c.a.listValues().forEach(e=>{if(-1==e.search(r))return;const t=e.replace(r,"");s.push(t)}),s.forEach(e=>{const r=c.a.getValue(e+"@st"),n=c.a.getValue(e),s=c.a.getValue(e+"@re"),o=c.a.getValue(e+"@source"),a=at.getUidByName(e)||Object(A.createUUID)();t.push(c.a.deleteValue(e+"@st")),t.push(c.a.deleteValue(e)),t.push(c.a.deleteValue(e+"@re")),t.push(c.a.deleteValue(e+"@source")),
n&&s&&o?(t.push(c.a.setValue(Ne.CONSTANTS.PREFIX.SCRIPT_UID+a,e)),t.push(c.a.setValue(Ne.CONSTANTS.PREFIX.COND+a,s)),t.push(c.a.setValue(Ne.CONSTANTS.PREFIX.STORE+a,r)),t.push(c.a.setValue(Ne.CONSTANTS.PREFIX.SCRIPT+a,o)),t.push(c.a.setValue(Ne.CONSTANTS.PREFIX.META+a,n))):G.logger.warn("invalid script entry",{source:o,meta:n,cond:s})}),r=new RegExp("@st$"),c.a.listValues().forEach(e=>{-1!=e.search(r)&&t.push(c.a.deleteValue(e))}),o.Deferred.when(t).done(()=>{
G.logger.info("Converted database from",n,"to",i),e.resolve()})}return e.promise()}},{schema:"3.7.0",cond:function(e){return Object(ie.versionCmp)(e,i)==ie.versionCmp.eNEWER},fn:function(){const e=Object(o.Deferred)();if(rea.extension.inIncognitoContext)g(),e.reject();else{const t=[],r=new RegExp("^"+Ne.CONSTANTS.PREFIX.META);c.a.listValues().forEach(e=>{if(-1==e.search(r))return;const n=c.a.getValue(e)
;n.options&&n.options.override&&!n.options.override.orig_run_at&&(n.options.override.orig_run_at=n.options.run_at||"document-idle",n.options.run_at=null,t.push(c.a.setValue(e,n)))}),o.Deferred.when(t).done(()=>{e.resolve()})}return e.promise()}},{schema:"4526",cond:function(e){return r&&Ne.RUNTIME.SAFARI&&"chromeStorage"==Ne.DB.USE&&Object(ie.versionCmp)(e,i)==ie.versionCmp.eNEWER},fn:function(){const e=Object(o.Deferred)();if(rea.extension.inIncognitoContext)g(),e.reject();else{
G.logger.info("Update database...");const t=c.a.migrate("localStorage","chromeStorage").done(()=>{G.logger.info("Copied config for default usage of setting storage")}).fail(()=>{e.resolve()});e.consume(t)}return e.promise()}},{schema:"4871",cond:function(e){return r&&Object(ie.versionCmp)(e,i)==ie.versionCmp.eNEWER},fn:function(){const e=Object(o.Deferred)();let t,r;const n=c.a.getValue(Ne.CONSTANTS.STORAGE.CONFIG)
;return n&&n.scriptTemplate&&(r=We.getDefaults())&&(t=r.script_templates)&&t[0]&&t[0].value&&(t[0].value=n.scriptTemplate,delete n.scriptTemplate,c.a.setValue(Ne.CONSTANTS.STORAGE.CONFIG,n)),e.resolve(),e.promise()}},{schema:"5465",cond:function(e){return Object(ie.versionCmp)(e,i)==ie.versionCmp.eNEWER},fn:function(){const e=Object(o.Deferred)();if(rea.extension.inIncognitoContext)g(),e.reject();else{const t=c.a.getValue(Ne.CONSTANTS.STORAGE.CONFIG);t&&1==t.sync_version&&(t.sync_enabled=!1,
c.a.setValue(Ne.CONSTANTS.STORAGE.CONFIG,t)),e.resolve()}return e.promise()}},{cond:function(){return r||Object(ie.versionCmp)(i,a)==ie.versionCmp.eNEWER},fn:function(){const e=Object(o.Deferred)();return c.a.setVersion(s,i).done(()=>{e.resolve()}),e.promise()}},{cond:function(){return r},fn:function(){return G.logger.info("First run of version "+s+"!"),yt.scheduleNotification(n,n==t),o.Deferred.Pledge()}},{cond:function(){return!0},fn:function(){const t=Object(o.Deferred)();return e.resolve(),
window.setTimeout(t.resolve,0),t.promise()}}],d()}),e.promise()},Pe=function(e,t,r){const n=(0==e)+"#"+(r?"a":"e")+"#"+t,s=Fe.get(n);let o=s?JSON.parse(s):s;if(o)o=o.oldret;else{const s=[],a=[],i=[],A=[],l={};if(t){const n=ot.determineScriptsToRun(t,!0,!r||void 0);for(let r=0;r<n.length;r++){const o=n[r]
;o.deleted||0!=e&&(!0===o.options.noframes||null===o.options.noframes&&!0===o.options.override.orig_noframes)||(o.evilness&&o.evilness>=Math.min(ze.SEVERITY_MAX,We.values.script_blacklist_severity)?i.push(o):o.enabled?(l[o.uuid]=t,ot.isContexter(o)?A.push(o):s.push(o)):a.push(o))}}o={contexters:A,runners:s,disabled:a,evilness:i,script_map:l},t&&Fe.set(n,JSON.stringify({frameId:e,oldret:o}))}return o},Ve=function(e,t){const{runners:r,contexters:n}=e,s=[{m:"native",
t:[ne.staticVars.DEFAULT,ne.staticVars.NATIVE]},{m:"disabled",t:[ne.staticVars.OFF]},{m:"browser",t:[ne.staticVars.CHROME]}].filter(e=>{if(e.t.includes(We.values.downloads_mode))return!0}).map(e=>e.m)[0]||"disabled",o=!rea.extension.inIncognitoContext&&"off"!=We.values.external_connect&&ot.validUrl(t,ut.externally_connectable_reg);return{scripts:r,contexters:n.length,raw:{},external_connect:o,isFirstPartyIsolation:dt.fpi,downloadMode:s,enforce_strict_mode:"on"==We.values.runtime_strict_mode,
top_level_await:["default","on"].includes(We.values.runtime_top_level_await),measure_scripts:We.values.debug,logLevel:We.values.logLevel,version:rea.extension.manifest.version}},Qe=(()=>{const e={};let t=1;const r=t++,n=t++,s=t++,a=t++,i=t++,l=t++,c=t++,u=()=>{const e={frames:{0:{state:r}},tabs:{reset_ts:Date.now()},scripts:{},urls:{},maps:{},contexts:{onUnload:{}},stats:{running:0,disabled:0,searched:-1},extra:{}};return Object.defineProperties(e.urls,{length:{value:0,enumerable:!1,writable:!0,
configurable:!0}}),e},d=function(t,r,n){let s;qe.isAllowed(n)?s=Pe(r,n):(G.logger.log("This URL is filtered by the security settings:",n,"-> Do nothing!"),Qe.set.forbidden(t,r),s={contexters:[],runners:[],disabled:[],evilness:[],script_map:{}}),e[t].scripts[n]=s,s.runners.forEach(e=>{e.webRequest&&e.webRequest.length&&wt.scripts.set(t,r,e.uuid,e.webRequest)})},g=(t,r)=>{We.values.userscript_search_url&&"badge"==We.values.userscript_search_mode&&Me(t).then(n=>{let s,o
;(s=e[r])&&(o=s.urls[t])&&0===o.frameId&&(s.stats.searched=n.count,vt.setBadge(r))})};const p={},m={},f={},h={};let R,v;const b={getActive:()=>({windowId:R,tabId:v}),listeners:{once:{whenReady:function(t,r){!e[t]||e[t].frames[0].state<s?b.listeners.once.onReady(t,r):r()},onReady:function(e,t){const r=e=>{b.listeners.remove.onCommited(n),b.listeners.remove.onCompleted(s),e&&t()};var n=b.listeners.add.onCommited(t=>{t===e&&r(!0)}),s=b.listeners.add.onCompleted(t=>{t===e&&r(!0)})}},add:{
onReset:function(e){const t=Object(A.createUUID)();return p[t]=e,t},onCommited:function(e){const t=Object(A.createUUID)();return m[t]=e,t},onCompleted:function(e){const t=Object(A.createUUID)();return f[t]=e,t},onRemoved:function(e){const t=Object(A.createUUID)();return h[t]=e,t}},remove:(()=>{const e=(e,t)=>{delete e[t]};return{onReset:function(t){e(p,t)},onCommited:function(t){e(m,t)},onCompleted:function(t){e(f,t)},onRemoved:function(t){e(h,t)}}})()},events:{active:(e,t)=>{R=t,v=e,
rea.tabs.getSelected(t,t=>{t.id==e&&g(t.url,e)})},reset:function(t,n){let s;Ne.RUNTIME.FAST_EXEC_SUPPORT&&(s=e[t])&&Object.keys(s.frames).forEach(e=>{b.events.clean(t,e)}),s=e[t]=u(),s.frames[0].state=r,Object(A.each)(p,e=>{e&&e(t,n)})},response:function(t,s,o){if(!We.values.enabled)return;const a=e[t]=e[t]||u(),i=a.frames[s]=a.frames[s]||{},A=i.state||r;0===s&&(a.tabs.response_ts=Date.now());const l=T.default.woHash(o);A<n&&(d(t,s,l),i.state=n);const c=a.scripts[l]
;return c?c.runners.length+c.contexters.length:0},commited:function(t,o,a){if(!We.values.enabled)return;const i=T.default.parse(a);if("http:"!==i.protocol&&"https:"!==i.protocol&&"file:"!==i.protocol)return;const l=e[t]=e[t]||u(),c=l.frames[o]=l.frames[o]||{},g=c.state||r;if(!(g>=s)){if(c.state=s,g<n){const e=T.default.woHash(a);d(t,o,e)}Object(A.each)(m,e=>{e&&e(t)})}},loading:function(t,s,o){if(!We.values.enabled)return;const i=T.default.parse(o)
;if(("http:"===i.protocol||"https:"===i.protocol||"file:"===i.protocol)&&0===s&&"file:"===i.protocol){const i=e[t]=e[t]||u();i.frames[s]=i.frames[s]||{};const A=i.frames[s].state||r;if(A>=a)return;if(i.frames[s].state=a,A<n){const e=T.default.woHash(o);d(t,s,e)}}},run:function(t,r,n,s,a){if(!We.values.enabled)return;const l=0===r||Ne.RUNTIME.FAST_EXEC_SUPPORT?r:n,c=e[t]=e[t]||u();c.frames[l]=c.frames[l]||{};const g=T.default.woHash(s);let p=c.scripts[g]
;if(!p&&(G.logger.log("tv: lazy init @ events.run("+t+", "+r+", "+n+", "+s+")"),d(t,r,g),p=c.scripts[g],!p))return void G.logger.warn("tv: no script run info for tab "+t+" @ "+g,G.logger.D?c.scripts:"");const m=c.frames[l].state;c.frames[l].state=i,m!=i&&(function(t,r,n){let s=1;const o=(r,n)=>{const o=1===s;void 0===e[t].maps[n]&&o&&(e[t].maps[n]={count:0,all_time:0,urls:[]}),o&&(e[t].maps[n].urls.push(r),e[t].maps[n].all_time++),e[t].maps[n].count+=s};Object(A.each)(n,o),
e[t].contexts.onUnload[r]=e[t].contexts.onUnload[r]||[],e[t].contexts.onUnload[r].push(()=>{e[t]&&(s=-1,Object(A.each)(n,o))})}(t,l,p.script_map),function(t,r,n){const s=s=>{1===s&&(void 0===e[t].urls[n]?e[t].urls[n]={frameId:r,count:0}:0===r&&(e[t].urls[n].frameId=r)),e[t].urls[n].count+=s,e[t].urls.length=-1};s(1),e[t].contexts.onUnload[r]=e[t].contexts.onUnload[r]||[],e[t].contexts.onUnload[r].push(()=>{e[t]&&s(-1)})}(t,l,g),function(t,r,n){e[t].stats.running+=n,
e[t].contexts.onUnload[r]=e[t].contexts.onUnload[r]||[],e[t].contexts.onUnload[r].push(()=>{e[t].stats.running-=n}),e[t].tabs.ts=Date.now()}(t,l,p.runners.length));const f=p.contexters,h=function(e,t,r,n,s){const a=[];for(let e=0;e<n.length;e++){const t=n[e];a.push(tt.bundle({url:r},t))}let i;return o.Deferred.when(a).always(e=>{s?s(e):i=e}),i}(0,0,g,p.runners,a?e=>{b.events.clean(t,l,s),a(e||f&&f.length?{runners:e,contexters:f}:null)}:null);return h||f&&f.length?{runners:h,contexters:f}:null},
clean:function(t,r,n){if(!We.values.enabled)return;let s,o,a;(o=e[t])&&(n&&(s=T.default.woHash(n),delete o.scripts[s]),(a=Qe.get.objurl(t,r))&&URL.revokeObjectURL(a))},complete:function(t,n,s){const o=T.default.parse(s);if(We.values.enabled&&("http:"===o.protocol||"https:"===o.protocol||"file:"===o.protocol)){if(0===n){const a=e[t]=e[t]||u();a.frames[n]=a.frames[n]||{};const A=a.frames[n].state||r;if(a.frames[n].state=l,!Qe.get.empty(t)&&Qe.get.stats(t).running){
if(A<i)return void G.logger.warn("tv: no script run info!");"file:"===o.protocol?window.setTimeout(()=>{rea.tabs.sendMessage(t,{method:"onLoad"},{frameId:n})},500):rea.tabs.sendMessage(t,{method:"onLoad"},{frameId:n})}v==t&&g(s,t)}Object(A.each)(f,e=>{e&&e(t)})}},unload:function(t,r,n){const s=0===r||Ne.RUNTIME.FAST_EXEC_SUPPORT?r:n;Ne.RUNTIME.FAST_EXEC_SUPPORT&&b.events.clean(t,r);const o=e[t]=e[t]||u();if(o.frames[s]=o.frames[s]||{},o.frames[s].state=c,o.contexts.onUnload[s]){
for(let e=0;e<o.contexts.onUnload[s].length;e++)o.contexts.onUnload[s][e]();o.contexts.onUnload[s]=[]}delete o.frames[s]},remove:function(t){let r;Ne.RUNTIME.FAST_EXEC_SUPPORT&&(r=e[t])&&Object.keys(r.frames).forEach(e=>{b.events.clean(t,e)}),delete e[t],Object(A.each)(h,e=>{e&&e(t)})}},set:{extra:function(t,r,n,s){const o=e[t]=e[t]||u();null===r?o.extra[n]=s:(o.extra[n]=o.extra[n]||{},o.extra[n][r]=s)},objurl:function(e,t,r){b.set.extra(e,t,"objurl",r)},blocker:function(e){
b.set.extra(e,null,"blocker",!0)},forbidden:function(e,t){0===t&&b.set.extra(e,null,"forbidden",!0)},requests:function(t,r,n,s){let o,a,i;o=e[t]=e[t]||u(),a=o.frames[r]=o.frames[r]||{},i=a.requests=a.requests||{},i[n]=s}},get:{extra:function(t,r,n,s,o){void 0===s&&(s=null);let a=null;const i=(e[t]?e[t].extra:{})[n];return null!==r?i&&(a=i[r],o&&delete i[r]):a=i,a||s},empty:function(t){let r=!0;if(e[t])if(0==e[t].urls.length);else{if(-1==e[t].urls.length)return e[t].urls.length=0,
Object(A.each)(e[t].urls,(r,n)=>{"length"!==n&&r.count>0&&e[t].urls.length++}),b.get.empty(t);r=!1}return r},urls:function(t,r){let n;return r?(n=e[t].maps[r])?n.urls:[]:(n=e[t])?n.urls:{}},history:function(t){return e[t].maps},stats:function(t,r){const n={};return e[t]&&(n.running=e[t].stats.running,n.searched=e[t].stats.searched,r&&(n.unique=0,Object.keys(e[t].maps).forEach(r=>{e[t].maps[r].count>0&&n.unique++}))),n},tabs:function(){const t={};return Object(A.each)(e,(e,r)=>{t[r]={
ts:e.response_ts}}),t},objurl:function(e,t){return b.get.extra(e,t,"objurl",null,!0)},blocker:function(e){return b.get.extra(e,null,"blocker")},forbidden:function(e){return b.get.extra(e,null,"forbidden")},requests:function(t,r){return e[t]&&e[t].frames[r]?e[t].frames[r].requests:null}}};return b})(),He=(()=>{const e={};return{get:function(t,r){return e[t]||(e[t]={}),e[t][r]||(e[t][r]={}),e[t][r]},getAll:function(t){const r={};return Object.keys(e).forEach(n=>{r[n]={},r[n]=e[n][t]}),r},
set:function(t,r,n){e[t]||(e[t]={});const s={};n&&Object.keys(n).forEach(e=>{s[e]=n[e]}),e[t][r]=s},cleanTab:function(t){delete e[t]}}})(),Xe=function(e,t){if(!e||-1!=e.search(/#bypass=true/)||-1!=e.search(Ne.REQUESTS.GET_INTERNAL_PAGE_REGEXP())||!["https:","http:","file:","ftp:"].some(t=>e.startsWith(t)))return!1;const r=t?e:e.split(/[?#$]/)[0],n=-1!=r.search(/[^/]{1}\.user\.(js#|js\?|js$)/)||-1!=r.search(/[^/]{1}\.tamper\.(js#|js\?|js$)/)
;return n?!(-1!=r.search(/^htt[ps]{1,2}:\/\/code\.google\.com/)||-1!=r.search(/^htt[ps]{1,2}:\/\/(github|gitlab)\.com/)&&!ot.determineOriginOfUrl(r)||-1!=r.search(/^htt[ps]{1,2}:\/\/bitbucket\.org/)&&!ot.determineOriginOfUrl(r)):n};var qe=(()=>{const e="PageFilter";return{init:function(){const t=()=>{Be.remove(e)};We.addChangeListener("forbiddenPages",t),We.addChangeListener("page_whitelist",t),We.addChangeListener("page_filter_mode",t)},isAllowed:function(t){let r=!1,n=!1
;const s=Ye.getSyncRemoteDomains().map(e=>"*://"+e+"/*"),o=We.values.forbiddenPages.concat(s),a=o.length>0,i=We.values.page_whitelist.length>0;switch(We.values.page_filter_mode){case"black":n=a;break;case"off":break;case"white":r=i;break;default:r=i,n=a}let A;return(A=Be.get(e))||(A=ot.regexify({inc:r?We.values.page_whitelist:void 0,exc:n?o:void 0}),Be.set(e,A)),!n&&!r||ot.validUrl(t,A)}}})(),ze=(()=>{const e="https://blacklist.tampermonkey.net/get.php",t=(e,t)=>{let r=!1
;if(t.length)return r="/"==t.substr(0,1)?ot.matchUrl(e,ot.convertToRegExp(t)):-1!=e.indexOf(t),r&&G.logger.log('black: entry "'+t+'" matched'),r},r={SEVERITY_MAX:10,SEVERITY_MANUALLY_DEFINED:11,SEVERITY_FOISTED_SCRIPT:12,init:function(){const e=Object(o.Deferred)(),t=()=>{"server"===We.values.script_blacklist_type&&window.setTimeout(r.checkUpdate,2e4)};return t(),We.addChangeListener("script_blacklist_type",t),e.resolve(),e.promise()},getWarningsFor:function(e){const r=[]
;return e&&Object(A.each)(We.values.script_blacklist_server,n=>{if(!n)return;let s;if(Object(A.each)(n.rules,r=>(s|=t(e,r),1!=s)),s)if(n.reasons){const e=M.I18N.getBestLocale(Object.keys(n.reasons));r.push(n.reasons[e||"en"])}else n.reason&&r.push(n.reason)}),r},getEvilnessOf:function(e){if("off"===We.values.script_blacklist_type)return!1;if(!e)return 0;let n=!1,s=0;return Object(A.each)(We.values.require_blacklist,r=>(n|=t(e,r),1!=n)),
n?s=r.SEVERITY_MANUALLY_DEFINED:"server"===We.values.script_blacklist_type&&Object(A.each)(We.values.script_blacklist_server,r=>{if(r)return Object(A.each)(r.rules,r=>(n|=t(e,r),1!=n)),n?(s=r.severity,!1):void 0}),Number(s)},checkUpdate:function(t){const r=Object(o.Deferred)();let n,s=nt.getConfig();if(t||Date.now()-s.black.last>6048e5){const a=(e,t)=>{const r=Object(o.Deferred)(),n={method:"GET",url:e,nocache:t,retries:Ne.XMLHTTPREQUEST.RETRIES,
overrideMimeType:"text/plain; charset=x-user-defined"};return Je.internal(n,{ondone:function(e){r.resolve(e)}}),r.promise()};a(e+"?version=get").then(r=>{if(4==r.readyState&&200==r.status){try{const e=JSON.parse(r.responseText);n=e.version}catch(e){G.logger.warn("black: unable to parse version response! "+r.responseText)}if(G.logger.info("black: local version: "+s.black.version+" remote: "+n),n>s.black.version||t)return a(e,!0)}}).then(e=>{if(e&&4==e.readyState&&200==e.status)try{
const t=JSON.parse(e.responseText);t&&t.blacklist&&1==t.version&&(We.values.script_blacklist_server=t.blacklist),G.logger.info("black: updated blacklist to ",t)}catch(t){G.logger.warn("black: blacklist update failed! ",e.responseText)}}).always(()=>{s=nt.getConfig(),s.black.last=Date.now(),s.black.version=n||s.black.version,nt.setConfig(s),r.resolve()})}else r.resolve();return r.promise()}};return r})();window.blak=ze;var Ye=(()=>{let e=0;const t=[],r={to:null,force:null,t:0
},n={},s=Object(U.createQueue)({threads:1}),a={},i=(e,t)=>s.add(()=>{if(!St.caps.syncsSource){let t;if(!e.url||!(t=T.default.parse(e.url))||!t.protocol.match(/https?:/))return G.logger.log("sync: skip export due to missing URL",e.name,e.url),o.Deferred.Pledge(!1)}return G.logger.log("sync: export",e.name,e.url),St.setMeta(e,{lastModified:e.lastModified}).then(()=>{if(St.setSource&&t)return St.setSource(e.uuid,t)}).then(()=>!0)}),A=e=>{
const t=e.downloadURL?e.downloadURL.split("#")[0]:null,r=e.fileURL?e.fileURL.split("#")[0]:null,n=[r,t].filter(e=>{if(!e||"file:"!==T.default.parse(e).protocol)return e})[0],s={uuid:e.uuid,name:e.name,options:{},durl:t,furl:r,url:n,lastModified:e.lastModified||e.lastUpdated};for(const t in d.SYNCED)!0===d.SYNCED[t]&&null!==e.options[t]&&(s.options[t]=e.options[t]);return s},l=()=>{const e=[];return at.getUidList().forEach(t=>{const r=at.getByUid(t);if(r.script&&r.cond&&!r.script.deleted){
const t=A(r.script);if(!t.lastModified&&!Ue)return void G.logger.warn("sync: script without updated/modified timestamps found",r.script);if(r.script.evilness&&r.script.evilness>=Math.min(ze.SEVERITY_MAX,We.values.script_blacklist_severity))return void G.logger.warn("sync: ignore evil script",r.script);e.push(t)}}),e},c=()=>{d.enabled&&d.sync(500,!0)};let u=null;var d={enabled:!1,SYNCED:{comment:!0},configChangeListener:function(){u||(u=window.setTimeout(()=>{u=null,d.init().done(()=>{
d.enabled&&d.sync(3e3)})},3e3))},init:function(){const e=Object(o.Deferred)();return d.enabled=!1,(()=>{if(We.values.sync_enabled&&We.values.sync_type){let e;return We.values.sync_type==Ae.b.eWEBDAV&&(e={url:We.values.cloud_url,basic_auth:Z.a.Base64.encode(We.values.cloud_user+":"+We.values.cloud_pass)}),St.init(We.values.sync_type,e).done(e=>{d.enabled=e,d.enabled?St.addChangeListener(c):G.logger.warn("sync: init failed!")}).fail(()=>{G.logger.warn("sync: init failed!")})}
return o.Deferred.Pledge()})().always(()=>{e.resolve(d.enabled)}),e.promise()},finalize:function(){},reset:function(){return d.enabled?St.reset():o.Deferred.Breach()},addSyncDoneCallback:function(e){t.push(e)},sync:function(A,c){const u=Date.now();A=A||500,c=r.force||c,r.to?(window.clearTimeout(r.to),r.ts<u+A&&(A=r.ts-u)<1&&(A=1)):G.logger.log("sync: schedule sync for run in "+A+" ms"),r.force=c,r.ts=u+A,r.to=window.setTimeout(()=>{(r=>{if(!d.enabled)return
;if(e>0)return void(r&&d.addSyncDoneCallback(e=>{e&&d.sync(50,r)}));e++;let A=null,c=null,u=0,g=0,p=!0;const m=e=>{if(e)for(let t=0;t<c.length;t++)if(c[t].uuid==e)return c[t];return null},f=(e,t,r)=>r?Math.floor(e/r)*r<Math.floor(t/r)*r:e<t;rt.all("status",{key:"sync_status",class:"information",title:M.I18N.getMessage("Script_Sync"),text:M.I18N.getMessage("Sync_is_running"),timeout:9e5}),o.Deferred.Pledge().then(()=>(A=l(),St.list().done(e=>{c=e}).fail(()=>{
G.logger.warn("sync: unable to get remotelist!")}))).then(()=>{const e=c.map(e=>{let t;const r=(e=>{if(!e)return null;for(let t=0;t<A.length;t++)if(A[t].uuid==e)return A[t]})(e.uuid);let i,l;if(r){if(!e.lastModified&&We.values.sync_type==Ae.b.eCHROMESYNC)for(const t in d.SYNCED)if(!0===d.SYNCED[t]&&r.options[t]!=e.options[t]){G.logger.log("sync: importable change detected!",e.name,"key:",t,e),i=!0;break}e.lastModified&&f(r.lastModified,e.lastModified,e.precision)&&(l=e.lastModified,i=!0,
G.logger.log("sync: importable change detected!",e.name,"local ts:",new Date(r.lastModified),"remote ts:",new Date(e.lastModified),e))}else(t=a[e.uuid])&&e.lastModified&&f(t.lastModified,e.lastModified,e.precision)&&(l=e.lastModified,i=!0,G.logger.log("sync: changed cache entry detected!",e.name,"local ts:",new Date(t.lastModified),"remote ts:",new Date(e.lastModified),e));if(!r&&!t||i)return()=>o.Deferred.Pledge().then(()=>St.caps.specialMeta?St.getMeta(e.uuid):o.Deferred.Pledge(e)).then(e=>{
if(!e)return;let A;if(r){if(e.options.removed)u++,G.logger.log("sync: remove local script",e.uuid,e.name,e.url),ot.doRemove(r.uuid,!1);else if(i)return c=l,g=e.lastModified,((p=e.precision)?Math.floor(c/p)*p!=Math.floor(g/p)*p:c!=g)&&(e.lastModified&&G.logger.warn("sync: list and meta data lastModified differ, this will cause extra traffic!","file ts:",new Date(l),"meta ts:",new Date(e.lastModified),e),e.lastModified=l),u++,G.logger.log("sync: update local script",e.uuid,e.name,e.url),
o.Deferred.Pledge().then(()=>{if(St.caps.syncsSource){const t=Object(o.Deferred)();return St.getSource(e.uuid,null).then(t=>t?ot.doSave({uuid:e.uuid,src:t,ask:!1,internal:!0,save:!0}):o.Deferred.Breach()).fail(()=>{G.logger.warn("sync: getting source of",e.uuid,"failed",e)}).always(t.resolve),t.promise()}}).then(()=>{const t=at.getByUid(r.uuid);for(A in d.SYNCED)!0===d.SYNCED[A]&&(t.script.options[A]=e.options[A]);return t.script.lastModified=e.lastModified,ot.doModify(t.script.uuid,t.script,!1)
})}else if(r||e.options.removed)!t&&e.options.removed&&(a[e.uuid]=e);else{const t=Object(o.Deferred)();if(!(e.url&&n[e.url]||e.uuid&&n[e.uuid]))return(e=>s.add(()=>{G.logger.log("sync: import",e.uuid,e.name,e.url);const t={imported:We.values.sync_type},r={};for(const t in d.SYNCED)!0===d.SYNCED[t]&&(r[t]=e.options[t]);const n={uuid:e.uuid,ask:!1,internal:!0,sync:t,force_meta:{lastModified:e.lastModified,fileURL:e.url},force_options:r},s={silent_fail:!0}
;return(St.caps.syncsSource?St.getSource(e.uuid).then(e=>ot.installFromSource(e,n,s)):ot.installFromUrl(e.url,n,s)).done(()=>{Fe.removeAll()})}))(e).done(t=>{t?u++:(G.logger.warn("sync: unable to import",e),n[e.url]=!0,n[e.uuid]=!0)}).fail(()=>{G.logger.warn("sync: unable to load",e),n[e.url]=!0,n[e.uuid]=!0}).always(t.resolve),t.promise();G.logger.warn("sync: skip previously failed import",e)}var c,g,p})}).filter(e=>e);return o.Deferred.onebyone(e)}).then(()=>(u&&(ot.reorderScripts(),
rt.all("status",{key:"sync",class:"information",title:M.I18N.getMessage("Script_Sync"),text:M.I18N.getMessage("0count0_changes_imported",u),timeout:1e4})),A=l(),o.Deferred.Pledge())).then(()=>{const e=[];for(let t=0;t<A.length;t++)e.push((()=>{const e=A[t];let r,n;if(!St.caps.syncsSource&&!e.url)return o.Deferred.Pledge();const s=m(e.uuid);var a,l,c;if(s?s.lastModified&&(a=e.lastModified,l=s.lastModified,!((c=s.precision)?Math.floor(a/c)*c>Math.floor(l/c)*c:a>l))||(r=!0,
G.logger.log("sync: exportable change detected!",e.name,"remote ts:",new Date(s.lastModified),"local ts:",new Date(e.lastModified),e)):G.logger.log("sync: export because remotely missing!",e.name,"local ts:",new Date(e.lastModified),e),!s||r||St.caps.syncsSource&&!s.source){if(St.caps.syncsSource){const t=at.getByUid(e.uuid);t.script&&t.cond&&(n=t.script.textContent)}return i(e,n).then(e=>{e&&g++})}return o.Deferred.Pledge()})());return o.Deferred.when(e)}).fail(()=>{p=!1}).done(()=>{p=!0
}).always(()=>{G.logger.log("sync: finished"),0==--e&&(rt.all("status",{key:"sync_status",class:"information",title:M.I18N.getMessage("Script_Sync"),text:M.I18N.getMessage("Sync_finished"),timeout:15e3}),g&&rt.all("status",{key:"sync",class:"information",title:M.I18N.getMessage("Script_Sync"),text:M.I18N.getMessage("0count0_changes_exported",g),timeout:5e3}),(e=>{for(;t.length;)t.shift()(e)})(p))})})(r.force),r.to=null,r.force=null},A)},scriptAddedCb:function(e,t){if(!d.enabled)return
;const r=A(t);i(r,t.textContent)},scriptChangedCb:function(){d.enabled&&d.sync(6e4)},scriptRemovedCb:function(e,t){var r;d.enabled&&(r=A(t),G.logger.log("sync: remove",r.name,r.url),St.remove(r))},getSyncRemoteUrl:function(e){if(d.enabled)return St.getRemoteUrl(e)},getSyncRemoteDomains:function(){return St.getRemoteDomains()||[]}};return d})();window.sycl=Ye;var We=(()=>{const e=[{name:"ECMAScript 5",
value:["// ==UserScript==","// @name         New Userscript","// @namespace    http://tampermonkey.net/","// @version      0.1","// @description  try to take over the world!","// @author       You","// @match        <$URL$>","// @icon         <$ICON$>","// @grant        none","// ==/UserScript==","","(function() {","    'use strict';","","    // Your code here...","})();"].join("\n")},{name:"ECMAScript 6",
value:["// ==UserScript==","// @name         New ES6-Userscript","// @namespace    http://tampermonkey.net/","// @version      0.1","// @description  shows how to use babel compiler","// @author       You","// @require      https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.18.2/babel.js","// @require      https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.16.0/polyfill.js","// @match        <$URL$>","// @icon         <$ICON$>","// ==/UserScript==","","var inline_src = (<><![CDATA[","","    // Your code here...","","]]></>).toString();",'var c = Babel.transform(inline_src, { presets: [ "es2015", "es2016" ] });',"eval(c.code);"].join("\n")
},{name:"CoffeeScript",
value:["// ==UserScript==","// @name         New Coffee-Userscript","// @namespace    http://tampermonkey.net/","// @version      0.1","// @description  shows how to use coffeescript compiler","// @author       You","// @require      http://coffeescript.org/browser-compiler/coffeescript.js","// @match        <$URL$>","// @icon         <$ICON$>","// ==/UserScript==","","var inline_src = (<><![CDATA[","","    // Your code here","","]]></>).toString();","var compiled = this.CoffeeScript.compile(inline_src);","eval(compiled);"].join("\n")
}],t={},r={enabled:!0,configMode:0,debug:!1,logLevel:0,showFixedSrc:!1,webrequest_modHeaders:"yes",webrequest_fixCSP:"yes",webrequest_fixContentCSP:"no",notification_showUpdate:"changelog",notification_silentScriptUpdate:!0,script_templates:e,scriptUpdateCheckPeriod:864e5,scriptUpdateHideNotificationAfter:15e3,scriptUpdateCheckDisabled:!1,scriptUrlDetection:"auto",script_file_access:Ne.RUNTIME.FIREFOX?"off":"externals",trash_cleanup_after:6048e5,runtime_strict_mode:"byscript",
runtime_top_level_await:"default",runtime_inject_mode:"default",autoReload:!1,appearance_badges:"running",appearance_badge_color:"gcal"===rea.runtime.short_id?"#444":"#ee3131",appearance_badge_text_color:"#ffffff",context_menu_enabled:!0,context_menu_scripts:!0,context_menu_commands:!0,editor_enabled:!0,editor_fontSize:100,editor_theme:"default",editor_keyMap:"windows",editor_indentUnit:4,editor_tabSize:4,editor_indentWithTabs:"spaces",editor_tabMode:"indent",editor_electricChars:!0,
editor_autoSave:!1,editor_easySave:!0,editor_autoLint:!0,editor_autoLintMaxLen:3e5,editor_lineWrapping:!1,userscript_search_url:Oe,userscript_search_mode:"disabled",editor_highlightTrailingWhitespace:!0,editor_trimTrailingSpacesFromModifiedLines:!0,editor_highlightSelectionMatches:"cursor",editor_linter_config:null,favicon_service:"google",i18n:null,action_menu_columns:1,action_menu_scripts_hide_disabled:!1,action_menu_scripts_sort:"auto",incognito_mode:"temporary",layout:"default",
layout_user_css:"",sync_enabled:!1,sync_type:2,statistics_enabled:!Ne.RUNTIME.FIREFOX&&!Ne.RUNTIME.SAFARI||"firb"==rea.runtime.short_id||null,downloads_mode:"default",downloads_extension_whitelist:["/^[^\\.]*$/","/\\.mp[34]$/",".wav","/\\.(avi|mkv|flv|divx|mpe?g|webm)$/","/\\.(ico|gif|png|jpe?g)/","/\\.(srt|sub|idx)$/",".txt",".iso",".zip","/\\.r(ar|[0-9]{2,2})$/"],external_update_interval:6048e5,external_connect:"all",require_timeout:2e4,
require_blacklist:["/^https?:\\/\\/example.com(:[0-9]{1,5})?\\/.*/"],require_sri_mode:"supported",script_blacklist_server:[],script_blacklist_type:"server",script_blacklist_severity:4,connect_mode:"ask",page_filter_mode:"black",page_whitelist:["/https?:\\/\\/greasyfork\\.org\\/.*/","http://xkcd.com/970/"],
forbiddenPages:["*example.org/*","*paypal.tld/*","*stripe.com/*","https://*deutsche-bank-24.tld/*","https://*bankofamerica.tld/*","/^.*:\\/\\/apis\\.google\\.com\\/((?!render)([^\\/]+)\\/)+([^\\/]+)?$/","*://www.facebook.com/plugins/*","*://platform.twitter.com/widgets/*"]},n={cloud_url:null,cloud_user:null,cloud_pass:null},s=e=>{let t;return void 0!==(t=c.a.getValue(Ne.CONSTANTS.STORAGE.CONFIG,{})[e])?t:"function"==typeof(t=r[e])?t():t},a=(e,r)=>{
const n=c.a.getValue(Ne.CONSTANTS.STORAGE.CONFIG,{}),o=s(e);n[e]=r;const a=c.a.setValue(Ne.CONSTANTS.STORAGE.CONFIG,n);return t[e]&&JSON.stringify(o)!=JSON.stringify(r)&&t[e].forEach(t=>{try{t(e,o,r,a)}catch(e){G.logger.warn("config: changeListener error",e)}}),a};let i,A;if(Ne.HTML5.LOCALSTORAGE&&(A=Ne.HTML5.LOCALSTORAGE.getItem(Ne.CONSTANTS.STORAGE.SESSION)))try{i=JSON.parse(Z.a.Base64.decode(A))}catch(e){}i=i||{};const l=e=>{let t;return void 0!==(t=i[e])?t:n[e]},u=(e,r)=>{const n=l(e)
;return void 0===r?delete i[e]:i[e]=r,Ne.HTML5.LOCALSTORAGE&&Ne.HTML5.LOCALSTORAGE.setItem(Ne.CONSTANTS.STORAGE.SESSION,Z.a.Base64.encode(JSON.stringify(i))),t[e]&&JSON.stringify(n)!=JSON.stringify(r)&&t[e].forEach(t=>{try{t(e,n,r)}catch(e){G.logger.warn("config: changeListener error",e)}}),o.Deferred.Pledge()},d={init:function(){const e=Object(o.Deferred)();return d.values={},Object.defineProperty(d,"snapshot",{get:function(){return{...d.values}},enumerable:!0}),Object.keys(r).forEach(e=>{
Object.defineProperty(d.values,e,{get:function(){return s(e)},set:function(t){a(e,t)},enumerable:!0})}),Object.keys(n).forEach(e=>{Object.defineProperty(d.values,e,{get:function(){return l(e)},set:function(t){u(e,t)},enumerable:!0})}),d.initialized=!0,(async t=>{const r=Object.keys(t).map(async e=>{const r=t[e];await Object(U.sleepEvery)(1e3),ot.doSave({url:null,src:r,ask:!1,replace:!0,internal:!0})});await o.Deferred.when(r),e.resolve()})([]),e.promise()},getValue:function(e){
return n.hasOwnProperty(e)?l(e):s(e)},setValue:function(e,t){return n.hasOwnProperty(e)?u(e,t):a(e,t)},getDefaults:function(){return r},addChangeListener:function(e,r){Array.isArray(e)||(e=[e]),e.forEach(e=>{t[e]||(t[e]=[]),t[e].push(r)})}};return d})(),Je=(()=>{let e,t,r,n,s,a={};const i="runtime_host_permissions",A=()=>o.Deferred.sleep(1).then(()=>!rea.permissions.supported||I.has(Ne.PERMISSIONS.ALL_URLS).then(e=>e,()=>!0)).always(e=>{t=e,t?rt.removeAll(i):(rt.all("status",{key:i,id:i,
class:"warning",text:M.I18N.getMessage("Limited_runtime_host_permissions_might_break_some_Tampermonkey_features_"),timeout:31536e6}),l&&(wt.addRedirectListener(l),l=null)),r=null});let l=e=>{u(e.url,1e3)};let c;const u=(e,i)=>{if(c||(c=window.setTimeout(()=>{c=null,o.Deferred.Pledge().then(()=>{if(void 0===t)return s||(I.addListener(e=>{G.logger.info("pcx: detected permission change",e),t=void 0,r=A()}),s=!0),r=r||A(),r}).then(()=>n).then(()=>{const e=Object.values(a);if(a={},t)return e;{let t
;const r={},s=e.map(e=>{const t=(n=e.url,T.default.woPath(n)+"/*");var n;return I.hasOrigin(t).then(e=>{e||(r[t]=!0)})});return t=n=o.Deferred.sidebyside(s).then(()=>{const t=Object.keys(r);return t.length?(G.logger.info("pcx: need to ask for some permissions",t),I.askOrigin(t,M.I18N.getMessage("Cross_Origin_Request_Permission"),M.I18N.getMessage("Click_here_to_allow_TM_to_access_the_following_hosts_0host_list0",t.join("\n"))).then(()=>(n=null,e))):e}).always(()=>{n=null}),t}}).always(e=>{
e.forEach(e=>e.deferred.resolve()),Object.keys(a).length&&u()})},i||100)),!e)return o.Deferred.Pledge();if(a[e])return a[e].deferred.promise();const l=Object(o.Deferred)();return a[e]={url:e,deferred:l},l.promise()},d=(t,r,n,s)=>{let o,a;return u(t.url).then(()=>{if(a)return r.onabort&&r.onabort(),void(r.ondone&&r.ondone({}));(n=n||{}).internal=s,o=e(t,r,n)}),{abort:function(){if(o)return o.abort();a=!0}}};return{init:function(){e=N.default.run},internal:(e,t,r)=>d(e,t,r,!0),
external:(e,t,r)=>d(e,t,r,!1)}})();const Ke=()=>{const e=Object(o.Deferred)();return rea.tabs.getSelected(null,t=>{e.resolve(t)}),e.promise()},$e=(()=>{const e={},t=e=>e&&e.includes("*"),r=()=>{const e=e=>{for(let t=0;t<s.length;t++)if(s[t].tabId===e)return s.splice(t,1)[0];return s.pop()};let t;Ke().then(r=>{for(;!n&&(t=e(r.id));)t.fn()})};var n,s=[];const a=(i,l,c,u)=>{const d=((e,t)=>{const r=e=>e?e.map(e=>{
if(e.match(/^'?self'?$/))e=T.default.parse(t.url).hostname||null;else if("'none'"==e)e="none";else{if(["none","localhost","*"].includes(e))return e;if(T.default.isIpOrHostname(e))return e;if(0===e.indexOf("."))return null;if(1===(e.match(/\./g)||[]).length&&T.default.isSecondLevelDomain(e))return null}return e}):[];return{connects:e.options.override.merge_connects&&"paranoid"!=We.values.connect_mode?r(e.connects):[],userconnects:r(e.options.override.use_connects),
blockers:r(e.options.override.use_blockers)}})(i,l);return(e=>{const t=Object(o.Deferred)();return qe.isAllowed(e)?t.resolve({allowed:!0}):t.resolve({allowed:!1}),t.promise()})(c).then(r=>{if(!0!==r.allowed)return o.Deferred.Breach("URL is blacklisted");let n,s;return(n=T.default.parse(c))&&n.origin&&(s=T.default.parse(l.url))&&s.origin&&n.origin===s.origin?o.Deferred.Pledge({permitted:!0}):((r,n,s)=>{const a=Object(o.Deferred)(),i=()=>{a.resolve({permitted:!0})},l=e=>{a.resolve({permitted:!1,
reason:e})},c=()=>{a.resolve({unknown:!0})};let u,d;const g=e=>t(e)?i:null,p=(e,t)=>{let r=null;const n=T.default.isIpOrHostname(e);return t.every(t=>{if(t.a)for(let s=0;s<t.a.length;s++)if(t.a[s]&&(n||T.default.isIpOrHostname(t.a[s])?t.a[s]===e:-1!=e.search(new RegExp("(^|.+\\.)"+Object(A.escapeForRegExp)(t.a[s])+"$"))))return r=t.blocker?l:i,!1;return!0}),r}
;return"off"==We.values.connect_mode||s.startsWith("data:")||s.startsWith("blob:")?i():(u=T.default.parse(s))&&u.hostname?(d=p(u.hostname,[{a:e[r.uuid]
}]))||(d=g(e[r.uuid]))?d():0===n.connects.length&&0===n.userconnects.length&&0===n.blockers.length?"casual"==We.values.connect_mode?i():"strict"==We.values.connect_mode?l("No @connects given, but strict mode enabled"):c():n.connects.includes("none")?l("None value found"):("casual"==We.values.connect_mode&&!t(n.blockers)&&(d=g(n.connects))||(d=g(n.userconnects))||(d=p(u.hostname,[{a:n.blockers,blocker:!0},{a:n.connects},{a:n.userconnects}])||c),d()):l("URL can not be parsed"),a.promise()})(i,d,c)
}).then(A=>{if(!1===A.permitted)return o.Deferred.Breach("URL is not permitted"+(A.reason?": "+A.reason:""));if(!0===A.permitted)return o.Deferred.Pledge();if(0===d.connects.length||t(d.connects)){if(["ask","paranoid"].includes(We.values.connect_mode)){if(t(d.blockers))return o.Deferred.Breach("URL was permanently blocked by the user");if(n){G.logger.log('cor: queuing access permission check from "'+i.name+'" to',c,l);const e=Object(o.Deferred)();return s.push({tabId:l.tab?l.tab.id:null,
fn:function(){e.consume(a.apply(this,[i,l,c,u]))}}),e.promise()}return((a,i,A,l,c)=>{let u;const d=Object(o.Deferred)(),g=()=>{d.resolve({approved:!0})},p=()=>{d.resolve({forbidden:!0})};if(G.logger.log('cor: "'+a.name+'" is asking for permission to access',l,i),(u=T.default.parse(l))&&u.hostname){const o=(e=>{if(T.default.isIpOrHostname(e))return null;const t=e.split(".");if(t.length<3)return e;const r=T.default.isSecondLevelDomain(t.slice(-2).join("."))?-3:-2;return t.slice(r).join(".")
})(u.hostname),d=i.tab?i.tab.id:null;n=!0,Ke().then(e=>v.askForConnect({src_url:i.url,hostname:u.hostname,domain:o,all_domains:t(A.connects),tabid:d,active:d===e.id,timeout:c,url:l,settings_url:rea.extension.getURL("options.html")+"#nav="+a.uuid+"+settings",connect_url:"https://www.tampermonkey.net/documentation.php#_connect",script:{name:a.name,uuid:a.uuid,icon:a.icon64||a.icon||x.a.images.origin("unknown")}})).done(t=>{let r;const n=t.whole_domain?o:u.hostname
;t.allow?t.once?(G.logger.log('cor: allowing "'+a.name+'" to access',n,"once"),g()):t.temporary?(G.logger.log('cor: allowing "'+a.name+'" to access',n,"temporarily"),void 0===e[a.uuid]&&(e[a.uuid]=[]),e[a.uuid].includes(n)||e[a.uuid].push(n),g()):(r=g,t.all_domains?(G.logger.log('cor: allowing "'+a.name+'" to access all domains always'),a.options.override.use_connects.push("*")):(G.logger.log('cor: allowing "'+a.name+'" to access',n,"always"),a.options.override.use_connects.push(n),
r=g)):t.once||t.aborted?(G.logger.log('cor: denying "'+a.name+'" to access',n,"once"),p()):(a.options.override.use_blockers||(a.options.override.use_blockers=[]),r=p,t.all_domains?(G.logger.log('cor: denying "'+a.name+'" to access any domains (additional) domain'),a.options.override.use_blockers.push("*")):(G.logger.log('cor: denying "'+a.name+'" to access',n,"always"),a.options.override.use_blockers.push(n))),r&&ot.doModify(a.uuid,a,!1).always(r)}).fail(p).always(()=>{n=!1,
s.length&&window.setTimeout(r,1)})}else p();return d.promise()})(i,l,d,c,u).then(e=>!0===e.approved?o.Deferred.Pledge():o.Deferred.Breach("Request was blocked by the user"))}return o.Deferred.Breach()}return o.Deferred.Breach("URL is not a part of the @connect list")})};return{getSessionConnects:function(t){return e[t]||[]},setSessionConnects:function(t,r){e[t]=r||[]},purgeAppeals:function(e){s=s.filter(t=>t.tabId!==e)},exec:function(e,t,r,n,s){let o,i,A,l,c,u=e.url
;const d=[],g=Math.max(Math.min(e.timeout||0,6e4),2e4),p=()=>{let e;for(;!c&&(e=d.shift());)e()},m=(t,r)=>{const n='Refused to connect to "'+(r||e.url)+'": '+(t||"Blocked by @connect CORS check"),o=N.default.makeErrorResponse(n);["onerror","ondone"].forEach(e=>{s[e]&&s[e]({response:o,exception:n})})};return r&&r.url&&r.tab&&e.url&&t&&(i=at.getByUid(t))&&i.script&&i.cond&&!i.script.deleted?(a(i.script,r,e.url,g).done(()=>{if(l)return;const t={};Object.keys(s).forEach(e=>{t[e]=(n,...f)=>{
A||(c?d.push((function(){t[e].apply(this,[n,...f])})):(n&&n.finalUrl&&u!==n.finalUrl?(c=!0,a(i.script,r,n.finalUrl,g).fail(()=>{l||A||(o&&o.abort(),A=!0,m("Request was redirected to a not whitelisted URL",n.finalUrl),G.logger.warn("cor: request to",u,"was redirect to a not whitelisted URL",n.finalUrl))}).always(()=>{u=n.finalUrl,c=!1,d.length&&window.setTimeout(p,1)})):{always:function(e){e()}}).always(()=>{A||s[e]({response:n})}))}}),o=Je.external(e,t,n)}).fail(e=>{l||(m(e),
G.logger.warn("cor: access to",u,"was denied"))}).always(()=>{l&&(s.onabort&&s.onabort(),s.ondone&&s.ondone({}))}),{abort:()=>{o?o.abort():l=!0}}):m()}}})(),et=(()=>{const e={key:function(e,t){return Ne.CONSTANTS.PREFIX.EXTERNAL+[e,t?Z.a.MD5(t):null].filter(e=>e).join(":")},list:function(e){const t=new RegExp("^"+e);return c.a.listValues().filter(e=>-1!=e.search(t))},set:function(t,r,n,s){const o=e.key(t,r),a={};Object(A.each)(n,(e,t)=>{"content"==t&&(t="base",e=Z.a.encodeS(e)),a[t]=e}),
c.a.setValue(o,{ts:Date.now(),url:r,resource:a,modified:s})},get:function(t,r){const n=e.key(t,r),s=c.a.getValue(n);let o;if(s&&s.resource){const e={};Object(A.each)(s.resource,(t,r)=>{"base"==r&&(r="content",t=Z.a.decodeS(t)),e[r]=t}),o={ts:s.ts,url:s.url,data:e,modified:s.modified}}return o},clean:function(t,r){const n=e.key(t,r);c.a.deleteValue(n)},cleanAll:function(t,r){let n;const s=e.list(e.key(t));if(r){const o={};Object(A.each)(r,r=>{const n=e.key(t,r);o[n]=!0}),n=[],
Object(A.each)(s,e=>{o[e]||n.push(e)})}else n=s;n.forEach(e=>{c.a.deleteValue(e)})}},t=Object(A.getDebouncer)(9e3),r=(t,r,n,s)=>{const a=Object(o.Deferred)(),i={sync:!1};return((e,t)=>{const r=Object(o.Deferred)(),n=n=>{const s={content:""};if(4!=n.readyState||200!=n.status&&0!=n.status||n.error)r.reject(s);else{let o,a;const i=N.default.parseHeaders(n.responseHeaders)["content-type"];i&&i.match("(image/|text/)([.-a-zA-Z0-9]+)")&&(o=i),
o||((a=e.match(".*.(ico|jpg|jpeg)+($|\\?|#).*"))?o="image/x-icon":(a=e.match(".*.(gif|png)+($|\\?|#).*"))?o="image/"+a[1]:-1!=e.search(".*.(js)+($|\\?|#).*")?o="text/javascript":(a=e.match(".*.(css|html|xml)+($|\\?|#).*"))?o="text/"+a[1]:Object(A.isLocalImage)(e)&&(o="image/x-icon")),s.meta=o,s.content=Z.a.ab2strSync(n.response,t.encoding)||"",r.resolve(s)}},s=()=>{r.reject({})},a=T.default.parse(e)
;if(["file:"].concat(Ne.REQUESTS.INTERNAL_PAGE_PROTOCOLS).includes(a.protocol))if("file:"!=a.protocol||Ne.RUNTIME.ALLOWS_FILE_SCHEME_ACCESS&&["externals","all"].includes(We.values.script_file_access))rea.file.get(e,e=>{n({readyState:4,status:0,response:e})},()=>{s()});else{const t="Access to this local file is forbidden!";G.logger.warn("externals:",t,"Loading the following @resource failed:",e,"-> more info:","https://www.tampermonkey.net/faq.php#Q204"),s()}else{const t={method:"GET",url:e,
retries:Ne.XMLHTTPREQUEST.RETRIES,nocache:!1,responseType:"arraybuffer"};t.timeout=We.values.require_timeout,Je.internal(t,{onload:n,onerror:s,ontimeout:s})}return r.promise()})(r,{encoding:s.encoding}).done(o=>{n&&(o.sri=n);const A=n=>{const s=T.default.parse(r);s.protocol&&!["file:"].concat(Ne.REQUESTS.INTERNAL_PAGE_PROTOCOLS).includes(s.protocol)&&e.set(t,r,n)};n&&["supported","given"].includes(We.values.require_sri_mode)?S.SRI.check(n,o.content,s.encoding).done(()=>{i.resource=o,
A(i.resource),a.resolve(i)}).fail(e=>{i.resource={forbidden:!0,sri:{mode:We.values.require_sri_mode,type:n.type,value:"invalid"},determined:e,content:""},A(i.resource),a.reject(i)}):(i.resource=o,A(i.resource),a.resolve(i))}).fail(e=>{G.logger.log("externals: get.failed",t,r,e),i.resource={failed:!0,content:""},a.reject(i)}),a.promise()},n=(n,s,a)=>{const i=Object(o.Deferred)(),A=T.default.parse(s),l={sync:a.sync};let c
;return s?ze.getEvilnessOf(s)>=We.values.script_blacklist_severity?(l.resource={blacklisted:!0,content:""},i.reject(l)):S.SRI.getHash(A,"supported"==We.values.require_sri_mode).done(o=>{if("enforce"!=We.values.require_sri_mode||o)if("file:"!==A.protocol&&(c=e.get(n,s))){const A=e.key(n,s),u=Date.now();We.values.external_update_interval>0&&u-c.ts>We.values.external_update_interval&&(t.is(A)||(We.values.external_update_interval>1&&t.add(A),
c.modified?G.logger.log("externals: resource is not updated due to user modifications",s,new Date(c.ts).toISOString(),new Date(u).toISOString()):(G.logger.log("externals: resource needs update",s,new Date(c.ts).toISOString(),new Date(u).toISOString()),window.setTimeout(()=>{r(n,s,o,a)},3e3)))),l.resource=c.data,l.resource.forbidden||l.resource.blacklisted?i.reject(l):i.resolve(l)}else i.consume(r(n,s,o,a));else l.resource={forbidden:!0,sri:{mode:We.values.require_sri_mode},content:""},
i.reject(l)}):(l.resource={forbidden:!0,content:""},i.reject(l)),i.promise()},s={setElement:function(t,r,n,s){return e.set(t,r,n,s)},getElement:function(t,r){return e.get(t,r)},cleanElement:function(t,r){return e.clean(t,r)},dropAll:function(t){return e.cleanAll(t),o.Deferred.Pledge()},dropAllBut:function(t,r){return e.cleanAll(t,r),o.Deferred.Pledge()},loadResources:function(e,t){const r=Object(o.Deferred)();return s.getResources(e,t).always(()=>{r.resolve()}),r.promise()},
loadRequires:function(e,t){const r=Object(o.Deferred)();return s.getRequires(e,t).always(()=>{r.resolve()}),r.promise()},getResources:function(e,t){const r={elements:[]},s=Object(o.Deferred)(),a=[],i={sync:!0};return t.forEach(t=>{const s=t.url||T.default.sanitize(t.unsafe_url,t.abs_url),A={name:t.name,url:s},l=n(e,s,i),c=Object(o.Deferred)();l.done(e=>{const t=e.resource;A.content=t.content,A.meta=t.meta||"application"}).fail(e=>{
e.resource&&e.resource.forbidden?e.resource.sri?G.logger.warn("externals: can't load @resource",t.name,"from URL",t.unsafe_url,"due to a SRI error"):G.logger.warn("externals: can't load @resource",t.name,"from forbidden URL",t.unsafe_url):e.resource&&e.resource.blacklisted?G.logger.warn("externals: can't load @resource",t.name,"from blacklisted URL",t.unsafe_url):(G.logger.warn("externals: can't load @resource",t.name,"from URL",t.unsafe_url),A.failed=!0),A.content=null}).always(e=>{
i.sync&=e.sync,r.elements.push(A),c.resolve()}),a.push(c)}),o.Deferred.when(a).always(()=>{r.sync=i.sync,s.resolve(r)}),s.promise()},getRequires:function(e,t){const r={elements:[]},s=Object(o.Deferred)(),a=[],i={encoding:"UTF-8",sync:!0};return Object(A.each)(t,(t,s)=>{const A=t.url||T.default.sanitize(t.unsafe_url,t.abs_url),l={},c=n(e,A,i),u=Object(o.Deferred)();c.done(e=>{l.textContent=e.resource.content||""}).fail(e=>{let r
;r=e.resource&&e.resource.forbidden?e.resource.sri?"couldn't load @require from URL "+t.unsafe_url+" due to a SRI error":"couldn't load @require from forbidden URL "+t.unsafe_url:e.resource&&e.resource.blacklisted?"couldn't load @require from blacklisted URL "+t.unsafe_url:"couldn't load @require from URL "+t.unsafe_url,l.textContent=(e=>'console.warn("Tampermonkey: " + decodeURIComponent("'+encodeURIComponent(e)+'"));')(r)+"\n",G.logger.warn("externals: "+r)}).always(e=>{i.sync&=e.sync,
r.elements[s]=l,u.resolve()}),a.push(u)}),o.Deferred.when(a).always(()=>{r.sync=i.sync,r.elements=r.elements.filter(e=>e),s.resolve(r)}),s.promise()}};return s})();window.exts=et;var tt=(()=>{const e={};return{bundle:function(t,r){let n,s,a=!0;if(n=e[r.uuid])return n;const i={},l=["includes","matches","requires","resources","excludes","connects","textContent"];return Object.keys(r).forEach(e=>{l.includes(e)||("options"==e?(i[e]=JSON.parse(JSON.stringify(r[e])),
i[e].run_at=i[e].run_at||r.options.override.orig_run_at||"document-idle"):i[e]=r[e])}),n=et.getResources(i.uuid,r.resources).then(e=>(a&&!e.sync&&(G.logger.log("ri: uncached @external detected -> fast script start disabled"),a=e.sync),i.resources=e.elements,et.getRequires(i.uuid,r.requires))).then(e=>{a&&!e.sync&&(G.logger.log("ri: uncached @external detected -> fast script start disabled"),a=e.sync);const n=e.elements;return G.logger.log("run script "+i.name+" @ "+t.url),((e,t,r)=>{
const n=Object(o.Deferred)(),s=[];r.forEach(t=>{let r=t.textContent||"";r=ae.mkCompat(r,e.options.compatopts_for_requires?e:null,"off"!=We.values.runtime_strict_mode),s.push(r)});const a="\n"+s.join("\n")+"\n",i=at.getStorageByUid(e.uuid);let l=ae.mkCompat(t,e,"off"!=We.values.runtime_strict_mode);if(We.values.debug){const e=l.split("\n");let t,r=!1;for(let n=0;n<e.length;n++){const s=e[n];if(!s.match(/^\s*$|^\s*\/\/\s*|^\s*\/\*.*\*\/\s*$|^\s*["']+use strict["']+;*\s*$/)){
if(s.match(/^\s*\/\*/)&&(r=!0),!r){e[n]="debugger;"+e[n];break}if(s.match(/\*\/\s*$/))r=!1;else if(-1!=(t=s.search(/\*\//))){e[n]=Object(A.insert)(e[n],t+2,0,"debugger;");break}}}l=e.join("\n")}const c=encodeURIComponent(e.name)+".user.js";let u;u=Ne.RUNTIME.FIREFOX?rea.extension.getURL("userscripts/")+c+"?"+T.default.hash2params({id:e.uuid}):rea.extension.getURL("userscript.html")+"?"+T.default.hash2params({name:c,id:e.uuid});const d={header:e.header,code:l,requires:a,storage:i,script:e,
source_url:u};return n.resolve(d),n.promise()})(i,r.textContent,n)}).always(()=>{s=!0,delete e[i.uuid]}),s||(e[i.uuid]=n),n}}})(),rt=(()=>{const e={},t={},r=(e,t)=>{let r;const n=t.key||"general",s=t.timeout||3e5,o=window.setTimeout(()=>{delete e[n]},s);(r=e[n])&&window.clearTimeout(r.to),e[n]={ts:Date.now()+s,options:t,to:o}},n=e=>{const t=Date.now();return Object.keys(e).map(r=>{const n=e[r],s=Object(A.copy)(n.options,{});let o;if(o=Math.max(0,n.ts-t))return s.timeout=o,s}).filter(e=>e)},s={
all:function(e,t){s.actionPage(e,t),s.optionsPage(e,t)},removeAll:function(r){delete e[r],delete t[r]},actionPage:function(t,n){const s=rea.extension.getViews({type:"popup"});s&&s.length&&rea.extension.sendMessage({method:t,options:n},()=>{}),n&&r(e,n)},optionsPage:function(e,n){const s=rea.extension.getViews({type:"tab"});s&&s.length&&rea.extension.sendMessage({method:e,options:n},()=>{}),n&&r(t,n)},actionStatus:function(){return n(t)},optionsStatus:function(){return n(e)}};return s})(),nt={
getConfig:function(){const e={scripts:0};let t=c.a.getValue(Ne.CONSTANTS.STORAGE.UPDATE,e);return"object"!=typeof t&&(t=e),t||(t=e),null==t.black&&(t.black={version:0,last:0}),null==t.scripts&&(t.scripts=0),t},setConfig:function(e){e&&c.a.setValue(Ne.CONSTANTS.STORAGE.UPDATE,e)}};const st=(()=>{let e=null;const t=36e5;var r={check:function(e,n,s){if(!e&&We.values.scriptUpdateCheckPeriod<=0)return o.Deferred.Breach();let a,i,A=nt.getConfig()
;return!e&&Date.now()-A.scripts<Math.max(We.values.scriptUpdateCheckPeriod,t)?o.Deferred.Breach():o.Deferred.Pledge().then(()=>{const e=()=>{i=null;const e=M.I18N.getMessage("Script_Update"),t=M.I18N.getMessage("Waiting_for_sync_to_finish")+"...";i=u.Notify.show(e,t,x.a.images.brand("tampermonkey"),{timeout:6e4})};if(Ye.enabled){const t=Object(o.Deferred)();return Ye.addSyncDoneCallback(t.resolve),Ye.sync(50,!1),n&&(a=window.setTimeout(e,500)),t.promise()}}).then(()=>{if(e)return
;const t=Object(o.Deferred)(),r=()=>{rea.idle.queryState(Ne.MISC.IDLE_TIMEOUT,e=>{"active"==e?window.setTimeout(r,1e3*Math.round(Ne.MISC.IDLE_TIMEOUT/2)):n()})};var n=()=>{let e;rea.windows.getAll({},n=>{n.forEach(t=>{"fullscreen"===t.state&&(e=!0)}),e?window.setTimeout(r,1e3*Ne.MISC.IDLE_TIMEOUT):t.resolve()})};return r(),t.promise()}).then(()=>{const e=Object(o.Deferred)();return a&&(window.clearTimeout(a),a=null),i&&i.cancel(),((e,t)=>{let n=0,s=0,a=0
;const i=M.I18N.getMessage("Script_Update"),A=M.I18N.getMessage("Check_for_userscripts_updates")+"...";e&&u.Notify.show(i,A,x.a.images.brand("tampermonkey"),{timeout:1e4});const l=at.getUidList().map(e=>{let i,A,l,c;return(()=>{if(i=at.getByUid(e),!i.script||!i.cond)return G.logger.warn("update: inconsistent script entry",e,i),o.Deferred.Breach();if(i.script.deleted)return o.Deferred.Breach()
;const r=t&&i.script.uuid!==t,s=!We.values.scriptUpdateCheckDisabled&&!i.script.enabled&&!t||!i.script.options.check_for_updates;if(r||s||!(c=ot.determineSourceURL(i.script)))return o.Deferred.Breach();if(i.script.evilness&&i.script.evilness>=Math.min(ze.SEVERITY_MAX,We.values.script_blacklist_severity))return o.Deferred.Breach();let a;return(a=ot.determineOrigin(i.script))&&a.updates_allowed&&!a.updates_allowed(c)?o.Deferred.Breach():(n++,G.logger.info("update: check for script updates @",e),
o.Deferred.Pledge())})().then(()=>{const e=ot.determineMetaURL(i.script);if(!e)return o.Deferred.Pledge();if("none"==e)return G.logger.debug("update: ignore non-updatable script",i.script.name),o.Deferred.Breach();const t=Object(o.Deferred)(),r={method:"GET",retries:Ne.XMLHTTPREQUEST.RETRIES,timeout:1e3*Ne.SCRIPT_DOWNLOAD.TIMEOUT,revalidate:!0,headers:{Accept:"text/x-userscript-meta, */*"},url:e};return Je.internal(r,{ondone:function(r){
4==r.readyState&&200==r.status?A=Object(ie.processMetaHeader)(r.responseText):G.logger.warn("update: unable to find meta data @ "+e+" req.status = "+r.status),t.resolve()}}),t.promise()}).then(()=>{const e=!!A,t=e&&!!A.version,r=t&&(!i.script.version||Object(ie.versionCmp)(A.version,i.script.version)==ie.versionCmp.eNEWER);return e&&t&&!r?o.Deferred.Breach():o.Deferred.Pledge()}).then(()=>{let e;if(e=T.default.parse(c)){
if(e.protocol.match(/(https?|file):/))return r.getScriptFromURL(c).fail(()=>{G.logger.warn("update: failed",i.script.name,c)});G.logger.warn("update: can't download URL",i.script.name,c)}else G.logger.warn("update: can't parse URL",i.script.name,c)}).then(e=>((e,t)=>{const r=Object(ie.createScriptFromSrc)(t);if(!r||!r.name||void 0===r.version)return ie.versionCmp.eERROR;let n
;return(n=at.getMetaByUid(e))?n.system?null:r.version==n.version?ie.versionCmp.eEQUAL:Object(ie.versionCmp)(r.version,n.version):ie.versionCmp.eNEWER})(i.script.uuid,e)==ie.versionCmp.eNEWER?(s++,l={name:i.script.name,url:c,code:e},o.Deferred.Pledge()):o.Deferred.Breach()).then(()=>{if(We.values.notification_silentScriptUpdate)return o.Deferred.Pledge();{
const e=M.I18N.getMessage("There_is_an_update_for_0name0_avaiable_",l.name)+"\n"+M.I18N.getMessage("Click_here_to_install_it_"),t=M.I18N.getMessage("Just_another_service_provided_by_your_friendly_script_updater_")+":",r=Object(o.Deferred)();return u.Notify.show(t,e,x.a.images.brand("tampermonkey"),{timeout:We.values.scriptUpdateHideNotificationAfter},r.resolve),r.promise()}}).then(t=>{const r=e||i.script.uuid;return void 0===t||t.clicked?ot.doSave({url:l.url,uuid:r,replace:!r,src:l.code,
ask:!We.values.notification_silentScriptUpdate}).done(e=>{e&&e.installed&&a++}):o.Deferred.Breach()})});return n&&rt.all("status",{key:"script_update",class:"information",title:i,text:A,timeout:1e4}),o.Deferred.sidebyside(l).then(()=>(l.length&&0==s&&(G.logger.debug("No update found"),e&&u.Notify.show("Narf!",M.I18N.getMessage("No_update_found__sry_"),x.a.images.brand("tampermonkey"),{timeout:1e4}),rt.all("status",{key:"script_update",class:"information",
text:M.I18N.getMessage("No_update_found__sry_"),timeout:1e4})),{found:s,installed:a}))})(n,s).done(t=>{e.resolve(t.installed)}).fail(()=>{e.resolve(null)}),A=nt.getConfig(),A.scripts=Date.now(),nt.setConfig(A),e.promise()})},getScriptFromURL:function(e){const t=Object(o.Deferred)();if(["file:"].concat(Ne.REQUESTS.INTERNAL_PAGE_PROTOCOLS).includes(T.default.parse(e).protocol))rea.file.get(e,e=>{t.resolve(Z.a.ab2strSync(e,"UTF-8"))},e=>{t.reject({error:!0,responseText:e})});else{const r={
method:"GET",retries:Ne.XMLHTTPREQUEST.RETRIES,timeout:1e3*Ne.SCRIPT_DOWNLOAD.TIMEOUT,revalidate:!0,headers:{Accept:"text/x-userscript, */*"},url:e};Je.internal(r,{onload:function(e){4!=e.readyState||200!=e.status&&0!=e.status||e.error?t.reject({error:!0,responseText:e.responseText}):t.resolve(e.responseText)},onerror:function(e){t.reject({error:!0,responseText:e.responseText})},ontimeout:function(){t.reject({timeout:!0,responseText:""})}})}return t.promise()},init:function(){const n=()=>{
e&&(window.clearTimeout(e),e=null),We.values.scriptUpdateCheckPeriod>0&&(e=window.setTimeout(()=>{e=null,r.check(),n()},t))};n(),We.addChangeListener("scriptUpdateCheckPeriod",n)}};return r})();window.trup=st;var ot=(()=>{const e=e=>(e.sort((e,t)=>e.position-t.position),e),t=e=>{void 0===e.ask&&(e.ask=!0),void 0!==e.url&&null!=e.url||(e.url=""),""===e.force_url&&(e.force_url=null);let t=Object(ie.createScriptFromSrc)(e.src),r=null;const n={heading:null,errors:[],info:[],warnings:[],flags:{}
},a=Object(o.Deferred)(),i=Date.now(),l=e.save&&!e.ask&&We.values.editor_easySave;let c,u=e.uuid;return(t&&t.name&&null!=t.version?o.Deferred.Pledge():(n.errors.push(M.I18N.getMessage("Invalid_UserScript__Sry_")+"\n\n"),e.name&&n.errors.push(M.I18N.getMessage("Script_name_0name0",e.name)+"\n\n"),e.url&&n.errors.push(M.I18N.getMessage("Downloaded_from_0url0",e.url)),G.logger.warn("scriptman: invalid userscript",n,t),o.Deferred.Breach())).then(()=>{
if(e.replace&&!u&&(u=at.getUidsByName(t.name,t.namespace)[0]),u)r=at.getMetaByUid(u);else if(t.uuid)u=t.uuid;else{if(!e.replace)return G.logger.warn("scriptman: neither UUID, @uuid nor replace option set"),o.Deferred.Breach();u=Object(A.createUUID)()}return""!==u.replace(/[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}/,"")?(G.logger.warn("scriptman: invalid UUID",u),o.Deferred.Breach()):!e.clean&&!e.defaultscript&&r&&r.system?o.Deferred.Breach():void 0}).then(()=>{
if(e.clean&&e.name&&e.name!=t.name||-1!=t.name.indexOf("\n"))return n.errors.push(M.I18N.getMessage("Invalid_UserScript_name__Sry_")),o.Deferred.Breach()}).then(()=>{if(r){if(r.name!=t.name&&(n.flags.renamed=!0),e.internal||r.evilness!=ze.SEVERITY_FOISTED_SCRIPT||(n.warnings.push(M.I18N.getMessage("This_is_a_possibly_foisted_script_and_a_modification_will_enable_it_")),n.flags.forceAsk=!0),r.lastModified&&void 0!==e.lastModTime&&r.lastModified!==e.lastModTime){
let e=M.I18N.getMessage("some_secs");try{const t=Math.max(1,Math.floor((i-r.lastModified)/1e3));isNaN(t)||(e=t)}catch(e){}n.warnings.push(M.I18N.getMessage("CONFLICT__This_script_was_modified_0t0_seconds_ago_",e)),n.flags.forceAsk=!0}t.version==r.version&&(e.save?n.flags.modification=!0:n.flags.reset=!0),e.clean&&(n.flags.factory=!0),c=!e.internal}else n.flags.first_install=!0,c=!e.internal||e.save
;t.includes.length||t.matches.length||l||e.internal||n.warnings.push(M.I18N.getMessage("This_script_does_not_provide_any__include_information_")),t.antifeatures&&!e.internal&&Object.keys(t.antifeatures).forEach(e=>{const s=t.antifeatures[e];let o;o="ads"==e?M.I18N.getMessage("Antifeature_ads"):"miner"==e?M.I18N.getMessage("Antifeature_miner"):"tracking"==e?M.I18N.getMessage("Antifeature_tracking"):M.I18N.getMessage("Antifeature_other")
;const a=s[M.I18N.getBestLocale(Object.keys(s))||"default"]||s.en||M.I18N.getMessage("Antifeature_no_details");let i,A;r&&r.antifeatures&&(A=r.antifeatures[e])&&(i=A[M.I18N.getBestLocale(Object.keys(A))||"default"]||A.en||M.I18N.getMessage("Antifeature_no_details")),l&&i&&a===i||n.warnings.push(M.I18N.getMessage("Antifeature__0name0__0description0",o,a))}),n.flags.sync=!!e.sync,n.flags.internal=e.internal,n.flags.ask=e.ask,n.flags.save=e.save,n.flags.whitewash=e.whitewash}).then(()=>{
if(t.uuid=u,t.system=e.defaultscript,t.evilness=ot.getEvilness(t),t.position=ot.determineLastPosition()+1,t.lastModified=i,e.force_meta){let r;(r=e.force_meta.fileURL)&&(t.fileURL=r),(r=e.force_meta.lastModified)&&(t.lastModified=r)}n.flags.factory||n.flags.reset?r&&(t.lastModified=r.lastModified):(e.force_url&&(t.updateURL=null,t.downloadURL=e.force_url),r&&(t.options.override=Object(A.copy)(r.options.override,{}),t.options.comment=r.options.comment,
e.save&&t.textContent!=r.textContent?t.options.check_for_updates=!1:t.options.check_for_updates=r.options.check_for_updates)),["includes","excludes","matches","connects"].forEach(e=>{t.options.override["orig_"+e]=t[e]}),t.options.override.orig_noframes=t.options.noframes,t.options.override.orig_run_at=t.options.run_at||"document-idle",t.options.noframes=null,t.options.run_at=null}).then(()=>{if(r&&(t.fileURL=r.fileURL,r.deleted||(t.position=r.position),r.sync&&(t.sync=r.sync),
!n.flags.factory&&!n.flags.reset)){t.enabled=r.enabled,t.options.noframes=r.options.noframes,t.options.run_at=r.options.run_at,e.save&&!e.force_url&&(t.downloadURL=r.downloadURL||t.downloadURL);const o=s.determineSourceURL(r),a=s.determineSourceURL(t),i=o?T.default.woHash(o):o||M.I18N.getMessage("_not_set_"),c=a?T.default.woHash(a):a||M.I18N.getMessage("_not_set_");if(i==c||l||e.internal||n.warnings.push(M.I18N.getMessage("The_update_url_has_changed_from_0oldurl0_to__0newurl0",[i,c])),!e.save){
const e=r.options.override.orig_includes||r.includes,s=r.options.override.orig_matches||r.matches,o=r.options.override.orig_excludes||r.excludes;Object(A.adiff)(e,t.includes,"notinfirst").length+Object(A.adiff)(s,t.matches,"notinfirst").length+Object(A.adiff)(t.excludes,o,"notinfirst").length&&n.warnings.push(M.I18N.getMessage("At_least_one_of_the_include_match_or_exclude_statements_was_changed_")),
Object(A.adiff)(r.connects||[],t.connects||[],"notinfirst").length&&n.warnings.push(M.I18N.getMessage("At_least_one_new_connect_statement_was_added_"))}}}).then(()=>{if(r&&!n.flags.factory&&t.version==r.version){if(e.defaultscript)return o.Deferred.Breach();if(e.noreinstall)return o.Deferred.Breach()}}).then(()=>{r?(n.flags.factory||n.flags.reset?(n.flags.reset?(n.heading=M.I18N.getMessage("You_are_about_to_reinstall_a_UserScript_"),
n.flags.reinstall=!0):(n.heading=M.I18N.getMessage("You_are_about_to_install_a_UserScript_"),n.flags.install=!0),e.internal||n.warnings.splice(0,0,M.I18N.getMessage("All_script_settings_will_be_reset_"))):n.flags.modification?n.heading=M.I18N.getMessage("You_are_about_to_modify_a_UserScript_"):Object(ie.versionCmp)(t.version,r.version)==ie.versionCmp.eOLDER?(n.heading=M.I18N.getMessage("You_are_about_to_downgrade_a_UserScript"),n.flags.downgrade=!0,
l||e.internal||n.warnings.splice(0,0,M.I18N.getMessage("The_downgraded_script_might_have_problems_to_read_its_stored_data_"))):(n.heading=M.I18N.getMessage("You_are_about_to_update_a_UserScript_"),n.flags.update=!0),n.info.push({label:M.I18N.getMessage("Installed_Version_"),value:"v"+r.version})):(n.heading=M.I18N.getMessage("You_are_about_to_install_a_UserScript_"),l||e.internal||(n.info.splice(0,0,M.I18N.getMessage("Malicious_scripts_can_violate_your_privacy_")),
ze.getWarningsFor(s.determineSourceURL(t)).forEach(e=>{n.warnings.splice(0,0,e)})),n.flags.install=!0),n.flags.whitewash?n.action=M.I18N.getMessage("Enable"):n.flags.install?n.action=M.I18N.getMessage("Install"):n.flags.reinstall?n.action=M.I18N.getMessage("Reinstall"):n.flags.modification?n.action=M.I18N.getMessage("Modify"):n.flags.downgrade?n.action=M.I18N.getMessage("Downgrade"):n.flags.update&&(n.action=M.I18N.getMessage("Update"))}).then(()=>{e.url&&(t.fileURL=e.url),
e.sync&&(t.sync=e.sync),e.force_options&&Object(A.copy)(e.force_options,t.options,Object(ie.createScript)().options,!0),e.force_settings&&Object(A.copy)(e.force_settings,t,["enabled","position"]),t=ot.mergeCludes(t)}).then(async()=>{let r,o,a=!1;for(const e in t.options)if(-1!=e.indexOf("compat_")&&!0===t.options[e]){a=!0;break}if(a&&n.info.push({label:M.I18N.getMessage("Note"),
value:M.I18N.getMessage("A_recheck_of_the_GreaseMonkey_FF_compatibility_options_may_be_required_in_order_to_run_this_script_")}),(r=s.determineOrigin(t))&&(o=r.convert)){const r=await o(t);if(r.info&&("includes added"===r.info?n.info.push(M.I18N.getMessage("Automatically_added_user_includes_for_compatibility_reasons_")):G.logger.warn("scriptman: unknown script convert info",r.info)),r.warning){let t;"deleted by hoster"===r.warning&&(t=M.I18N.getMessage("This_script_was_deleted_by_the_hoster_")),
t?e.internal?n.info.push(t):n.warnings.push(t):G.logger.warn("scriptman: unknown script convert warning",r.warning)}t=r.script||t}}).then(()=>{["requires","resources"].forEach(e=>{t[e]=t[e].map(e=>(e.unsafe_url=e.url,e.abs_url=t.fileURL?t.fileURL.split("/").slice(0,-1).join("/"):null,e.url=null,e))})}).done(()=>{a.resolve({script:t,oldscript:r,messages:n,trigger_sync:!!c,short_info:[{label:M.I18N.getMessage("Author"),prop:"author"},{label:M.I18N.getMessage("Description"),prop:"description"},{
label:M.I18N.getMessage("Source"),prop:"fileURL"}]})}).fail(()=>{a.reject({messages:n})}),a.promise()},r=e=>{const t=Object(o.Deferred)(),r=e.messages,n=e.script,a=r.warnings.length||r.flags.ask,A=e.trigger_sync,l=()=>{r.flags.modification||et.dropAll(n.uuid),t.notify();const e=s.doModify(n.uuid,n,A)||{};return r.flags.save||!r.flags.install&&!r.flags.update||r.flags.factory||r.flags.reset||i.a.tS(n.name,r.flags.install?"i":"u",n.fileURL),
(r.flags.first_install||r.flags.factory)&&at.setStorageByUid(n.uuid,{ts:Date.now()}),e},c={uuid:n.uuid,lastModified:void 0,installed:!0,renamed:r.flags.renamed};return a?(rea.extension.inIncognitoContext&&"temporary"==We.values.incognito_mode&&(e.hints=e.hints||[],e.hints.push({globalhint:!0,options:{id:"incognito",image:"critical",text:M.I18N.getMessage("All_modifications_are_only_kept_until_this_incognito_session_is_closed_")}})),v.install(e).done(e=>{e.ok&&l(),c.installed=e.ok,
c.aborted=e.aborted,t.resolve(c)}).fail(e=>{t.reject(e)})):window.setTimeout(()=>{l(),t.resolve(c)},1),t.promise()},n=Object(A.getDebouncer)(1e3);var s={determineSourceURL:function(e){return e?[e.downloadURL,e.fileURL].filter(e=>{if(!e||"file:"!==T.default.parse(e).protocol)return e})[0]:null},determineMetaURL:function(e){if(!e)return null;let t;const r=ot.determineOrigin(e);return r&&r.meta_header?t=e.fileURL:!e.fileURL||r&&!r.meta_url||(t=e.fileURL.replace(".user.js",".meta.js"),
e.fileURL==t&&(t=e.fileURL.replace(".tamper.js",".meta.js")),e.fileURL==t&&(t=null)),[e.updateURL,e.downloadURL,t].filter(e=>{if(!e||"file:"!==T.default.parse(e).protocol)return e})[0]},mergeCludes:function(e){let t,r;const n=e.options.override;if(["includes","excludes","matches"].forEach(t=>{e[t]=n["merge_"+t]&&n["orig_"+t]?n["orig_"+t].slice():[]}),n.use_includes)for(t=0;t<n.use_includes.length;t++)r=e.excludes.indexOf(n.use_includes[t]),r>=0&&e.excludes.splice(r,1),
e.includes.push(n.use_includes[t]);if(n.use_matches)for(t=0;t<n.use_matches.length;t++)r=e.excludes.indexOf(n.use_matches[t]),r>=0&&e.excludes.splice(r,1),e.matches.push(n.use_matches[t]);if(n.use_excludes)for(t=0;t<n.use_excludes.length;t++)e.excludes.push(n.use_excludes[t]);return e},doSave:function(e){return t(e).then(r)},doRemove:function(e,t,r){return r?(at.removeByUid(e,t),at.setStorageByUid(e,null),et.dropAll(e)):at.softRemoveByUid(e,t),o.Deferred.Pledge()},doModify:function(e,t,r){
return void 0===r&&(r=!0),at.setByUid(e,t,r),r?et.loadResources(e,t.resources).then(()=>et.loadRequires(e,t.requires)).then(()=>{const r=[].concat(t.resources).concat(t.requires).map(e=>T.default.sanitize(e.unsafe_url,e.abs_url));return et.dropAllBut(e,r)}):o.Deferred.Pledge()},exportToJson:function(e,t){const r=Object(o.Deferred)();let n=ot.determineScriptsToRun(null);n=n.filter(e=>!e.deleted),e&&(n=n.filter(t=>e[t.uuid])),n=ht(n,{options_page:!0,externals:t.externals}),
t&&!t.storage||n.forEach(e=>{e.storage=at.getStorageByUid(e.uuid)});const s={scripts:n};return t&&!t.global_settings||(s.global_settings=c.a.getValue(Ne.CONSTANTS.STORAGE.CONFIG,{})),r.resolve(s),r.promise()},importFromJson:function(e){if(!e||!e.scripts||!e.scripts.length)return o.Deferred.Breach();const n={},s=[],a=[],i=[],l={},u={};for(let r,c=0;r=e.scripts[c];c++)try{const e=Object(o.Deferred)();if("new-user-script"==r.uuid)continue;r.storage&&(l[r.uuid]=r.storage),
["resources","requires"].forEach(e=>{let t;(t=r[e])&&t.length&&(u[r.uuid]=u[r.uuid]||{requires:{},resources:{}},u[r.uuid][e]=t)});const c=r.file_url||r.update_url;t({uuid:r.uuid,name:r.name,src:r.source,force_settings:{enabled:r.enabled,position:r.position},force_options:r.options,force_meta:{lastModified:r.lastModified},replace:!0,url:c,ask:!1}).done(t=>{const s=Object(A.createUUID)();n[s]=t,r.storage&&r.storage.data&&Object.keys(r.storage.data).length&&a.push(s),u[r.uuid]&&i.push(s),
e.resolve()}).fail(t=>{G.logger.warn("import: Error @ script",r.name,t),e.resolve()}),s.push(e.promise())}catch(e){G.logger.warn("import: Error while importing script",r.name,e)}const d=(()=>{const e=Object(o.Deferred)();return o.Deferred.when(s).always(()=>{e.resolve()}),e.promise()})().then(()=>v.import({scripts:n,storage_ids:a,externals_ids:i,global_settings:e.global_settings,hints:rea.extension.inIncognitoContext&&"temporary"==We.values.incognito_mode?[{globalhint:!0,options:{id:"incognito",
image:"critical",text:M.I18N.getMessage("All_modifications_are_only_kept_until_this_incognito_session_is_closed_")}}]:[]})).then(e=>{const t=Object(o.Deferred)(),s=[],a=[];if(e.ok)for(let t,o=0;t=e.import_ids[o];o++)(()=>{const o=t;if(n[o]){n[o].messages.warnings=[];const t=n[o].script.uuid,i=r(n[o]).progress(()=>{if(!e.externals_ids.includes(o))return;let r=u[t];["resources","requires"].forEach(e=>{let n;r&&(n=r[e])&&n.length&&n.forEach(e=>{et.setElement(t,e.url,{content:e.content||"",
meta:e.mimetype||"text/javascript"},e.modified)})})}).done(()=>{let r;e.storage_ids.includes(o)&&l[t]&&(r=at.setStorageByUid(t,{data:l[t].data||{},ts:Date.now()}),a.push(r))});s.push(i)}})();return o.Deferred.when(s).always(()=>{ot.reorderScripts(),o.Deferred.when(a).always(()=>{t.resolve(e)})}),t.promise()}).then(t=>{if(e.global_settings&&t.global_settings){const t=c.a.setValue(Ne.CONSTANTS.STORAGE.CONFIG,e.global_settings).then(()=>(d.done(()=>{window.setTimeout(Rt.reset,1)}),
o.Deferred.Pledge({global_settings:!0})));return c.a.setTemporary(!0),t}return o.Deferred.Pledge({})});return d},installFromUrl:function(e,t,r){const a=Object(o.Deferred)();let i;const l={messages:{errors:[M.I18N.getMessage("Unable_to_load_script_from_url_0url0",e)],warnings:[]}};t=t||{},r=r||{};const c=["url",e,JSON.stringify(t)].join("_");return n.is(c)?(G.logger.debug("scriptman: de-bounced installFromUrl",e),o.Deferred.Breach()):(n.add(c),
(i=T.default.parse(e))&&i.protocol.match(/(https?|file):/)?("file:"!=i.protocol||Ne.RUNTIME.ALLOWS_FILE_SCHEME_ACCESS||G.logger.warn("scriptman: Access to local files is forbidden! Loading the following script for installation may fail:",e,"-> more info:","https://www.tampermonkey.net/faq.php#Q204"),st.getScriptFromURL(e).then(n=>{const o={url:e,src:n,ask:!0,replace:!0};t&&Object(A.each)(t,(e,r)=>{o[r]=t[r]}),a.consume(s.installFromSource(n,o,r))}).fail(e=>{let t;e?(t=l,
"file:"!=i.protocol||Ne.RUNTIME.ALLOWS_FILE_SCHEME_ACCESS||t.messages.warnings.unshift(M.I18N.getMessage("Tampermonkey_has_no_file_access_permission_")),t.heading=M.I18N.getMessage("You_are_about_to_install_a_UserScript_"),r.silent_fail?a.reject(t):v.installError(t).always(e=>{a.reject(e)})):a.reject()}),a.promise()):(G.logger.warn("scriptman: can't install from ",e),o.Deferred.Breach(l)))},installFromSource:function(e,t,r){const n=Object(o.Deferred)(),a={src:e,ask:!0,replace:!0}
;return t&&Object(A.each)(t,(e,r)=>{a[r]=t[r]}),s.doSave(a).done(e=>{n.resolve(e.installed)}).fail(e=>{e?(e.heading=M.I18N.getMessage("You_are_about_to_install_a_UserScript_"),r.silent_fail?n.reject(e):v.installError(e).always(e=>{n.reject(e)})):n.reject()}),n.promise()},determineLastPosition:function(){let e=0;return at.getUidList().forEach(t=>{const r=at.getByUid(t)
;r.script&&r.cond?r.script.position&&r.script.position!=Number.MAX_SAFE_INTEGER&&r.script.position>e&&(e=r.script.position):G.logger.warn("scriptman: inconsistent script entry",t)}),e},convertToRegExp:function(e,t){let r,n;try{t||"/"!=e.substr(0,1)?t?(n=T.default.getRegExpFromMatch(e),r=new RegExp(n)):(n=T.default.getRegExpFromInclude(e),r=new RegExp(n,"i")):(n=("^"==e.substr(1,1)?"":".*")+e.replace(/^\//g,"").replace(/\/$/g,"")+("$"==e.substr(-2,1)?"":".*"),n=n.replace(/(\.\*){1,}/g,".*"),
r=new RegExp(n,"i"))}catch(t){return G.logger.warn("scriptman: invalid regexp ",e),!1}return r},matchUrl:function(e,t){return""===e.replace(t,"")},regexify:function(e,t){const r={},n={inc:"rinc",match:"rinc",exc:"rexc"};return Object.keys(n).forEach(o=>{const a=e[o]&&e[o].length?e[o].map(e=>s.convertToRegExp(e,"match"===o)).filter(e=>!1!==e):null;(a||t)&&(r[n[o]]=(r[n[o]]||[]).concat(a||[]))}),r},validUrl:function(e,t,r){let n=!1;if(t.rinc){
if(t.rinc.every(t=>!s.matchUrl(e,t)||(G.logger.debug('scriptman: @include "'+t+'" matched'+(r?" ("+r+")":'"')),n=!0,!1)),!n)return n}else n=!0;return t.rexc&&t.rexc.every(t=>!s.matchUrl(e,t)||(G.logger.debug('scriptman: @exclude "'+t+'" matched'+(r?" ("+r+")":'"')),n=!1,!1)),n},getEvilness:function(e){let t=0
;return e.fileURL&&(t=ze.getEvilnessOf(e.fileURL))||e.downloadURL&&(t=ze.getEvilnessOf(e.downloadURL))||e.updateURL&&(t=ze.getEvilnessOf(e.updateURL))?(G.logger.debug("scriptman: found blacklisted script",e),t):0},blackCheckAll:function(){at.getUidList().forEach(e=>{const t=at.getByUid(e);if(!t.script||!t.cond)return;const r=ot.getEvilness(t.script);r!==t.script.evilness&&(t.script.evilness=r,s.doModify(e,t.script,!1))})},reorderScripts:function(t,r){let n=s.determineScriptsToRun()
;if(t)for(let e=0;e<n.length;e++){const s=n[e];if(s.uuid==t){const e=s.position<r?.5:-.5;s.position=Number(r)+e}}n=e(n);let o=1;for(let e=0;e<n.length;e++){const t=n[e];t.deleted?t.position=Number.MAX_SAFE_INTEGER:t.position=o++,s.doModify(t.uuid,t,!1)}},getScriptHistoryForTab:function(e){return Qe.get.empty(e.id)?(G.logger.debug("bg: WARN: Tabs.get.urls["+e.id+"] is empty!"),{}):Qe.get.history(e.id)},getUniqueScriptsForTab:function(e){const t={}
;if(Qe.get.empty(e.id))G.logger.debug("bg: WARN: Tabs.get.urls["+e.id+"] is empty!");else{const r=(e,r)=>{if(!qe.isAllowed(r))return;const{runners:n,contexters:s,disabled:o,evilness:a}=Pe(e.frameId,r,!0);[n,s,o,a].forEach(e=>{e.forEach(e=>{t[e.uuid]={script:e}})})};Object(A.each)(Qe.get.urls(e.id),r)}return t},scriptWillRun:function(e,t){if(!t||!e)return;let r=Be.get(e);if(!r){if(!(r=c.a.getValue(Ne.CONSTANTS.PREFIX.COND+e,null)))return;r=s.regexify(r,!0),Be.set(e,r)}return!!s.validUrl(t,r,e)},
determineScriptsToRun:function(t,r,n){const o=[];return G.logger.log("scriptman: determineScriptsToRun @"+t),at.getUidList().forEach(e=>{let a=!0,i=0;const A=at.getByUid(e);if(void 0===n||!A.script||A.script.enabled===n){if(t){const r=Date.now();a=s.scriptWillRun(e,t),i=Date.now()-r}if(A.script&&A.cond){if(r&&i>1e3&&(G.logger.warn("scriptman: checking "+A.script.name+"'s ("+e+") includes and excludes took "+i+"ms!"),rt.all("status",{key:"slowdown",class:"warning",
text:M.I18N.getMessage("Script_0name0_is_slowing_down_some_page_loads_",A.script.name),timeout:3e5})),!a)return;o.push(A.script)}else G.logger.warn("scriptman: inconsistent script entry",e,A)}}),e(o)},isContexter:function(e){return e.options&&("context-menu"===e.options.run_at||null===e.options.run_at&&"context-menu"===e.options.override.orig_run_at)},determineOrigin:function(e){const t=e.fileURL||e.downloadURL||e.updateURL;return s.determineOriginOfUrl(t)},determineOriginOfUrl:function(e){
return Object(ie.determineOriginOfUrl)(e)},clean:function(e){const t=Date.now();at.getUidList().forEach(r=>{const n=at.getByUid(r);if(n.script&&n.cond){if(!n.script.deleted)return;{const e=Math.floor((n.script.deleted+We.values.trash_cleanup_after-t)/1e3);if(e>=0)return void G.logger.log(`scriptman: script entry in trash ${r} will be cleaned in ${e}s`,n);G.logger.log(`scriptman: script entry in trash ${r} will be cleaned now`,n)}
}else G.logger.warn(`scriptman: inconsistent script entry ${r} will be cleaned now`,n);e||s.doRemove(r,!0,!0)})}};return s})();window.scma=ot;var at=(()=>{let e=[];const t={init:function(){c.a.addDifferentOriginChangeListener(Ne.CONSTANTS.PREFIX.STORE,(e,r)=>{const n=e.replace(Ne.CONSTANTS.PREFIX.STORE,"");for(const e in r.data)r.data.hasOwnProperty(e)&&(()=>{const s=e,o=r.data[e];t.notifyStorageListeners({uuid:n},null,e=>{const t={data:{},ts:0};t.data[s]=o,t.ts=r.data.ts;const n={storage:t}
;void 0===t.data[s]&&(n.removed=s),e(n)})})()})},getUidList:function(){const e=new RegExp("^"+Ne.CONSTANTS.PREFIX.SCRIPT_UID),t=[];return c.a.listValues().forEach(r=>{-1!=r.search(e)&&t.push(r.replace(e,""))}),t},getUidsByName:function(e,r){const n=[];return t.getUidList().forEach(s=>{const o=t.getMetaByUid(s);!o||o.name!=e||r&&r!=o.namespace||n.push(s)}),n},getUidByName:function(e){return t.getUidsByName(e)[0]},getStorageByUid:function(e){const t=c.a.getValue(Ne.CONSTANTS.PREFIX.STORE+e,{ts:0,
data:{}});return void 0===t.ts&&(t.ts=0),void 0===t.data&&(t.data={}),t},setStorageByUid:function(e,t){return t?c.a.setValue(Ne.CONSTANTS.PREFIX.STORE+e,t):c.a.deleteValue(Ne.CONSTANTS.PREFIX.STORE+e)},getMetaByUid:function(e){return c.a.getValue(Ne.CONSTANTS.PREFIX.META+e,null)},getByUid:function(e,t){if(!e)return G.logger.error("sb: no UUID set"),{};let r,n=c.a.getValue(Ne.CONSTANTS.PREFIX.META+e,null);if(n){const s=e=>{if(e)for(let t=0,r=null;r=e[t];t++)delete r.loaded,delete r.textContent,
delete r.resURL,delete r.resText};s(n.requires),s(n.resources),n.uuid=e,n.grant=n.grant||[],n.options.override.use_connects||(n.connects=n.connects||[],n.options.override.merge_connects=!0,n.options.override.use_connects=[]),void 0===n.options.check_for_updates&&(n.options.check_for_updates=!0),t&&(n=Object(A.copy)(n,{})),n.textContent=c.a.getValue(Ne.CONSTANTS.PREFIX.SCRIPT+e,n.textContent),n.textContent&&(r=n)}return{script:r,cond:c.a.getValue(Ne.CONSTANTS.PREFIX.COND+e,null)}},
setByUid:function(e,t,r){const n={};if(!e)return G.logger.error("sb: no UUID set",t),n;if(null===t.textContent||void 0===t.textContent)throw new Error("No script code set!");const s=c.a.getValue(Ne.CONSTANTS.PREFIX.META+e),o=!s,a={},i=Object(A.copy)(t,{});return i.textContent=null,a[Ne.CONSTANTS.PREFIX.META+e]=i,a[Ne.CONSTANTS.PREFIX.SCRIPT_UID+e]=t.name,a[Ne.CONSTANTS.PREFIX.COND+e]={inc:t.includes,match:t.matches,exc:t.excludes},a[Ne.CONSTANTS.PREFIX.SCRIPT+e]=t.textContent,c.a.setValues(a),
r&&(o?Ye.scriptAddedCb(t.name,t):Ye.scriptChangedCb(t.name,t,s)),Fe.removeAll(),Be.remove(e),n},restoreByUid:function(e,r){const n=t.getByUid(e);n.script&&n.cond&&(delete n.script.deleted,t.setByUid(e,n.script),void 0===r&&(r=!0),r&&n.script&&n.cond&&Ye.scriptAddedCb(n.script.name,n.script))},softRemoveByUid:function(e,r){const n=t.getByUid(e);n.script&&n.cond&&(n.script.deleted=Date.now(),t.setByUid(e,n.script),Fe.removeAll(),Be.remove(e),void 0===r&&(r=!0),
r&&n.script&&n.cond&&Ye.scriptRemovedCb(n.script.name,n.script))},removeByUid:function(e){const r=t.getByUid(e);r&&(c.a.deleteValue(Ne.CONSTANTS.PREFIX.SCRIPT_UID+e),c.a.deleteValue(Ne.CONSTANTS.PREFIX.COND+e),c.a.deleteValue(Ne.CONSTANTS.PREFIX.SCRIPT+e),c.a.deleteValue(Ne.CONSTANTS.PREFIX.META+e),c.a.deleteValue(Ne.CONSTANTS.PREFIX.STORE+e),We.values&&r.script&&i.a.tS(r.script.name,"r"))},addStorageListener:function(t,r,n,s,o){e.push({tabid:t,id:r,uuid:n,time:s,response:o})},
removeStorageListeners:function(t,r){void 0===r&&(r=!0);const n=e;e=[],n.forEach(n=>{try{void 0!==t.tabid&&t.tabid!==n.tabid||void 0!==t.uuid&&t.uuid!==n.uuid||void 0!==t.id&&t.id!==n.id?e.push(n):r&&n.response({})}catch(e){G.logger.debug("sb: listener clear for script",t,"failed! Page reload?!")}})},notifyStorageListeners:function(t,r,n){t=t||{},r=r||{},e.forEach(e=>{try{
void 0!==r.uuid&&e.uuid===r.uuid||void 0!==r.tabid&&e.tabid===r.tabid||void 0!==r.id&&e.id===r.id||void 0!==t.tabid&&t.tabid!==e.tabid||void 0!==t.uuid&&t.uuid!==e.uuid||void 0!==t.id&&t.id!==e.id||n&&n(e.response)}catch(e){G.logger.warn("sb: listener notification for script",t,"failed! Page reload?!")}})}};return t})();window.scbr=at;const it=function(){return o.Deferred.Pledge()},At=function(){return o.Deferred.Pledge()},lt=function(){Ne.DB.SECURE||at.getUidList().forEach(e=>{
const t=at.getByUid(e);t.script&&t.cond&&t.script.evilness!=ze.SEVERITY_FOISTED_SCRIPT&&(G.logger.warn("content security: found unfamiliar script",t.script.name),t.script.evilness=ze.SEVERITY_FOISTED_SCRIPT,ot.doModify(e,t.script,!1))})},ct=function(){};var ut=(()=>{const e={ping:{allow:{insecure:!0},exec:function(e,t,r){r({pong:!0,instanceID:De,config:{layout:We.values.layout,dark:rea.runtime.isDarkMode()}})}},newTab:{allow:{extpage:!0},exec:function(e,t,r){
("options"==t.extpage||"options"==e.origin?o.Deferred.Pledge(t.tab):Ke()).then(t=>{rea.tabs.create({url:e.url,parent:t},e=>{r({tabId:e.id})})})}},tabs:{allow:{script:!0},exec:function(e,t,r){"get"==e.action?t.tab&&e.uuid?r({data:He.get(t.tab.id,e.uuid)}):(G.logger.warn("bg: unable to process request",t,e),r({data:null})):"list"==e.action?e.uuid?r({data:He.getAll(e.uuid)}):(G.logger.warn("bg: unable to process request",t,e),r({data:null
})):"set"==e.action?(t.tab&&e.uuid?He.set(t.tab.id,e.uuid,e.tab):G.logger.warn("bg: unable to process request",t,e),r({})):r({error:"unknown action"})}},focusTab:{allow:{script:!0},exec:function(e,t,r){const n=t&&t.tab?t.tab.id:null;n?rea.tabs.update(n,{active:!0},()=>{const e=rea.runtime.lastError;r({error:e?e.message:void 0})}):r({error:"internal error"})}},closeTab:{allow:{script:!0},exec:function(e,t,r){const n=t&&t.tab?t.tab.id:null;n?rea.tabs.query({windowType:"normal"},e=>{
if(e.length<=1){const e="refused to close last tab!";G.logger.warn("bg:",e),r({error:e})}else rea.tabs.remove(n,()=>{const e=rea.runtime.lastError;r({error:e?e.message:void 0})})}):r({error:"internal error"})}},setOption:{allow:{extpage:!0},exec:function(e,t,r){const n="options"==t.extpage||"options"==e.origin;We.setValue(e.name,e.value).always(()=>{n?mt.create("options.settings").done(e=>{r({items:e,options:We.snapshot})}).fail(e=>{r({error:e,options:We.snapshot})}):r({})})}},reportAnIssue:{
allow:{extpage:!0},exec:function(e,t,r){("options"==t.extpage||"options"==e.origin?o.Deferred.Pledge(t.tab):Ke()).then(t=>{let n,s,o;if(e.uuid&&(n=at.getByUid(e.uuid))&&n.script&&n.cond){let r;s=ot.determineOrigin(n.script),"hoster"==e.to&&s?o=s:(r=n.script.supportURL||s.issue_url||s.url)&&(o={issue_url:r}),o&&(i.a.tS(n.script.name,"m"),rea.tabs.create({url:o.abuse_url||o.issue_url,active:!0,parent:t},()=>{}))}r({})})}},begEvent:{allow:{extpage:!0},exec:function(e,t,r){
if("dialog"==e.action)bt.dialog.shown(e.extra);else if("clicked"==e.action){let t,r;e.extra&&(t=e.extra.amount,r=e.extra.currency),bt.clicked(e.type,t,r)}else bt.button[e.action]?bt.button[e.action](e.type,e.extra):G.logger.warn("bg: Warning: unknown request ",e);r({})}},buttonPress:{allow:{extpage:!0},exec:function(t,r,n){const{name:s,data:o,scriptuid:a}=t,i=()=>{n({})}
;if("reset_simple"==s)Rt.reset(i);else if("reset_factory"==s)Rt.factoryReset(i);else if("reset_sync"==s)Ye.reset().always(i);else if("install_tests"==s){const e=Ue.framework.prepare(ot,at,Ne.RUNTIME.BROWSER,Ne.RUNTIME.BROWSER_VERSION,i);e&&G.logger.error(e)}else if("enabled"==s)We.setValue(s,!We.values[s]).always(()=>{n({})});else if("installFromUrl"==s)ot.installFromUrl(o).always(()=>{n({})});else if("externals_delete"==s)et.cleanElement(a,t.safe_url),mt.create("options.scripts").done(e=>{n({
items:e,options:We.snapshot})}).fail(e=>{n({error:e,options:We.snapshot})});else if("focus_tab"==s)e.focusTab.exec({},{tab:{id:t.tabid}},n);else if("run_script_updates"==s)if(a){let e;st.check(!0,!1,a).done(t=>{e=t}).always(()=>{n({scriptuid:a,updatable:e})})}else st.check(!0,!0),n({});else if("blacklist_page"==s){const e=o.domain;if(!e)throw new Error("Blacklisted domain is missing!");const t="/"+T.default.getRegExpFromMatch(`*://*.${e}/*`,!0)+"/"
;We.setValue("forbiddenPages",We.values.forbiddenPages.concat([t])).always(()=>{n({})})}else if("script_search"==s){const{url:e,result_url:t}=o;if(e){const t={url:Se(e),active:!0};rea.tabs.create(t,()=>{})}else{if(!t)throw new Error("Search URL is missing!");{const e={url:t,active:!0};rea.tabs.create(e,()=>{})}}}else G.logger.warn("bg: Warning: unknown button "+s),n({})}},loadTree:{allow:{extpage:!0},exec:function(e,t,r){mt.create(e.referrer,{complete:e.complete,url:e.url,uuid:e.uuid,
filter:e.filter,tabId:e.tabId}).done(t=>{const n={items:t},s=1==mt.level(e.referrer)?{i18n:We.values.i18n,options:We.snapshot,xhr:N.default.getConfig(),begging:bt.needed()}:{};r(Object.assign(n,s))}).fail(e=>{r({error:e,options:We.snapshot})})}},modifyScriptOptions:{allow:{extpage:!0},exec:function(t,r,n){if(!t.uuid)return void n({});const s="options"==r.extpage||"options"==t.origin;let o=null==t.reload||1==t.reload,a=!1;const i=at.getByUid(t.uuid,!0),A=()=>{
o?(void 0!==t.position&&ot.reorderScripts(t.uuid,t.position),s?e.loadTree.exec({referrer:"options.scripts"},r,n):rea.tabs.getSelected(null,e=>{mt.create("actions").done(e=>{n({items:e,i18n:We.values.i18n,options:{enabled:We.values.enabled}})}).fail(()=>{n({i18n:We.values.i18n,options:{enabled:We.values.enabled}})}),!e||e.id<0||t.uuid&&We.values.autoReload&&rea.tabs.sendMessage(e.id,{method:"reload"},{frameId:0})})):n({})}
;if(i.script&&i.cond)if(t.whitewash&&i.script.evilness==ze.SEVERITY_FOISTED_SCRIPT)o=!0,i.script&&i.cond?ot.doSave({uuid:t.uuid,src:i.script.textContent,force_settings:{enabled:!0},whitewash:!0,save:!0}).always(A):(G.logger.error(M.I18N.getMessage("fatal_error")+" ("+t.uuid+")!!!"),A());else{let e=!1;const r=Object(ie.createScript)();Object.keys(r.options).forEach(e=>{void 0!==t[e]&&(i.script.options[e]=t[e],a|=!0===Ye.SYNCED[e])}),Object.keys(r.options.override).forEach(r=>{
-1!=r.indexOf("merge_")&&void 0!==t[r]&&(i.script.options.override[r]=t[r],e=!0)}),["includes","excludes","matches"].forEach(r=>{void 0!==t[r]&&(e=!0,i.script.options.override["use_"+r]=t[r])}),["connects","blockers"].forEach(e=>{void 0!==t[e]&&(i.script.options.override["use_"+e]=t[e])}),t.add_excludes&&(i.script.options.override.use_excludes=i.script.options.override.use_excludes.concat(t.add_excludes),e=!0),e&&(i.script=ot.mergeCludes(i.script)),
t.temp_connects&&$e.setSessionConnects(i.script.uuid,t.temp_connects),void 0!==t.enabled&&(i.script.enabled=t.enabled),a&&(i.script.lastModified=Date.now()),void 0!==t.file_url&&(i.script.downloadURL=t.file_url),ot.doModify(i.script.uuid,i.script,a).done(A).fail(()=>{n({})})}else n({})}},purgeScript:{allow:{extpage:!0},exec:function(e,t,r){ot.doRemove(e.uuid,!1,!0),ot.reorderScripts(),
o.Deferred.onebyone([()=>mt.create("options.scripts"),()=>mt.create("options.trash")]).then(e=>e.reduce((e,t)=>e.concat(t),[]).filter(e=>e)).done(e=>{const t={};t.items=e,t.options=We.snapshot,r(t)}).fail(e=>{r({error:e,options:We.snapshot})})}},saveScript:{allow:{extpage:!0},exec:function(e,t,r){const n=void 0===e.reload||!!e.reload,s="options"==t.extpage||"options"==e.origin,a=t=>{
s?n?o.Deferred.onebyone([()=>mt.create("options.scripts"),()=>mt.create("options.trash")]).then(e=>e.reduce((e,t)=>e.concat(t),[]).filter(e=>e)).done(e=>{t.items=e,t.options=We.snapshot,r(t)}).fail(e=>{r({error:e,options:We.snapshot})}):r({}):rea.tabs.getSelected(null,t=>{mt.create("actions").done(e=>{r({items:e,i18n:We.values.i18n,options:{enabled:We.values.enabled}})}).fail(()=>{r({i18n:We.values.i18n,options:{enabled:We.values.enabled}})}),
!t||t.id<0||e.uuid&&We.values.autoReload&&rea.tabs.sendMessage(t.id,{method:"reload"},{frameId:0})})};if(e.clean){G.logger.debug("bg: clean userscript "+e.uuid);const t=at.getByUid(e.uuid),n=t=>{mt.create("options.scripts").done(n=>{r({cleaned:t.installed,items:n,options:We.snapshot}),t.installed&&at.notifyStorageListeners({uuid:e.uuid},null,t=>{t({storage:at.getStorageByUid(e.uuid)})})}).fail(e=>{r({error:e,options:We.snapshot})})};t.script&&t.cond?ot.doSave({name:e.name,uuid:e.uuid,
src:t.script.textContent,clean:!0,ask:!1,internal:!0,save:!0}).always(e=>{n(e||{installed:!1})}):(G.logger.error(M.I18N.getMessage("fatal_error")+" ("+e.uuid+")!!!"),n({installed:!1}))}else if(e.code){let t=r;n&&(t=e=>{ot.reorderScripts(),a(e)}),e.new_script&&(e.uuid=Object(A.createUUID)()),ot.doSave({name:e.name,uuid:e.uuid,force_url:e.force_url,src:e.code,ask:!We.values.editor_easySave,lastModTime:e.lastModTime,save:!0}).always(e=>{t(e||{installed:!1})})
}else e.auto_save?a({}):e.restore?(at.restoreByUid(e.uuid),ot.reorderScripts(),a({})):(ot.doRemove(e.uuid),ot.reorderScripts(),a({}))}},saveExternal:{allow:{extpage:!0},exec:function(e,t,r){et.setElement(e.uuid,e.url,{content:e.code||"",meta:e.mimetype||"text/javascript"},!0),mt.create("options.scripts").done(e=>{r({success:!0,items:e,options:We.snapshot})}).fail(e=>{r({error:e,options:We.snapshot})})}},saveStorageKey:{allow:{extpage:!0},exec:function(e,t,r){s.saveStorageKey.exec(null,e,t,r)}},
importFromJson:{allow:{extpage:!0},exec:function(e,t,r){const n=void 0===e.reload||!!e.reload;ot.importFromJson(e.json).fail(e=>{r({error:e||M.I18N.getMessage("An_error_occured_during_import_")})}).done(e=>{const t={reload:e.global_settings};n&&!t.reload?mt.create("options.scripts").done(e=>{t.items=e,t.options=We.snapshot,r(t)}).fail(e=>{r({error:e,options:We.snapshot})}):r(t)})}},download:{allow:{extpage:!0},exec:function(e,t,r){s.download.exec(null,e,t,e=>{(e.error||e.load)&&r(e)})}},askCom:{
allow:{extpage:!0},exec:function(e,t,r){v.onMessage(e.data).always(e=>{e.i18n=We.values.i18n,e.options=We.snapshot,r(e)})}},installScript:{allow:{extpage:!0},exec:function(e,t,r){if(t.tab){let t={};(e.code?ot.installFromSource(e.code,{},{silent_fail:!0}):ot.installFromUrl(e.url,{},{silent_fail:!0})).done(e=>{t={data:null,found:!0,installed:e}}).fail(e=>{e&&e.messages&&e.messages.errors?t.err=e.messages.errors[0]:t.err=M.I18N.getMessage("Unable_to_parse_this_")}).always(()=>{r(t)})
}else G.logger.warn("bg: Error: unable to install script due to empty tabID!")}},execMenuCmd:{allow:{extpage:!0},exec:function(e,t,r){const n=gt.getById(e.id);n?n.response({run:!0,menuId:n.menuId}):G.logger.warn("bg: Error: unable to find MC id "+n.menuId),r({})}},unLoad:{allow:{script:!0},exec:function(e,t){return e.topframe||e.id&&t.tab&&t.frameId&&Qe.events.unload(t.tab.id,t.frameId,e.id),!1}},prepare:{allow:{script:!0},exec:function(e,t,r){if(t.tab){
const n=void 0!==t.frameId?t.frameId:e.topframe?0:null,s=T.default.woHash(e.url);e.cleanup?(Qe.events.clean(t.tab.id,n,s),vt.setIcon(t.tab.id),vt.setBadge(t.tab.id),r({})):Qe.events.run(t.tab.id,n,e.id,s,n=>{const s=n?Ve(n,e.url):{fast:!0};r(s),vt.setIcon(t.tab.id),vt.setBadge(t.tab.id)})}else r({})}},contextmenu:{allow:{script:!0},exec:function(e,t,r){const{tab:n}=t;if(n&&We.values.context_menu_enabled){const r=void 0!==t.frameId?t.frameId:e.topframe?0:null,s=T.default.woHash(e.url)
;let o=[],a=[];We.values.context_menu_scripts&&(a=Pe(r,s).contexters),We.values.context_menu_commands&&(o=gt.listByTabId(n.id)),ve.update({contexters:a,commands:o})}else r({})}},notification:{allow:{script:!0,extpage:!0},exec:function(e,t,r){const n=e.image?e.image:x.a.images.brand("tampermonkey");(()=>{const r=Object(o.Deferred)();return e.highlight&&t.tab?u.Notify.highlight(t.tab.id,r.resolve):r.resolve(),r.promise()})().then(()=>{const t=Object(o.Deferred)()
;return e.text?u.Notify.show(e.title,e.text,n,{timeout:e.timeout,silent:e.silent},t.resolve):t.resolve(),t.promise()}).always(e=>{r({clicked:e&&e.clicked})})}},clipboard:{allow:{script:!0,extpage:!0},exec:function(e,t,r){rea.clipboard?rea.clipboard.set({mimetype:e.mimetype,content:e.content},()=>{r({success:!0})}):r({error:"unsupported"})}},determineScriptsToRun:{allow:{extpage:!0},exec:function(e,t,r){r({scripts:ot.determineScriptsToRun(e.url).filter(e=>!e.deleted).map(e=>e.uuid)})}},
syntaxCheck:{allow:{script:!0,extpage:!0},exec:function(e,t,r){se.a.hint(e.code,We.values.editor_linter_config||void 0).always(e=>{r({errors:e})})}},externalMessage:{allow:{insecure:!0},exec:function(e,t,r){return n(e.request,t,r)}},cookie:{allow:{script:!0},exec:function(e,t,r){
const n=["expirationDate","domain","httpOnly","secure","session","name","path","sameSite","value"].concat(["url"]),s=n.concat(["hostOnly"]),o=e.url||t.url||null,a=e.details.url?T.default.sanitize(e.details.url,o)||e.details.url:o,i=t.tab?t.tab.cookieStoreId:void 0;let A;if(dt.fpi&&(A=T.default.parse(o).domain),Ne.DB.SECURE||"dhdg"!=rea.runtime.short_id)if(a)if(qe.isAllowed(T.default.woHash(a)))if(ot.scriptWillRun(e.uuid,a))if("list"==e.action)dt.getAll({url:a,domain:e.details.domain,
name:e.details.name,path:e.details.path,firstPartyDomain:A?null:void 0,storeId:i}).done(e=>{const t=e.map(e=>{const t={};return s.forEach(r=>{t[r]=e[r]}),t});r({data:{cookies:t}})});else if("delete"==e.action)dt.remove({url:a,name:e.details.name,firstPartyDomain:A,storeId:i}).done(()=>{r({data:{success:!0}})}).fail(e=>{r({data:{error:e}})});else if("set"==e.action){const t={firstPartyDomain:A,storeId:i},s=e.details;n.forEach(e=>{
void 0!==s[e]&&(["value","name"].includes(e)?t[e]=String(s[e]):t[e]=s[e])}),t.url=t.url||a,dt.set(t).done(()=>r({data:{success:!0}})).fail(e=>r({data:{error:e}}))}else r({data:{error:"unknown action"}});else r({data:{error:"the URL needs to be included by the scripts @include or @match tag"}});else r({data:{error:"the URL is filtered by the security settings"}});else r({data:{error:"invalid URL"}});else r({data:{error:"not supported"}})}}},t=e=>{
const t=rea.runtime.id,r=!Ne.REQUESTS.HAS_SENDER_ID&&e.tab||e.id===t;let n=null;const s=Ne.REQUESTS.INTERNAL_PAGE_PROTOCOLS[0],o=s?s+"//":null,a=Ne.REQUESTS.GET_INTERNAL_PAGE_REGEXP(),i=e.url?e.url:e.tab?e.tab.url:null;let A=r&&(!i||!!o&&0==i.indexOf(o));if(A||!o){if(i){const e=i.match(a);e&&2==e.length&&(n=e[1])}else n="*";!o&&n&&(A=!0)}return{id_valid:r,url:i,page:n,extpage:A}},r=(n,s,o)=>{if(!kt.late)return kt.registerLateCallback(()=>{r(n,s,o)}),!0;const a=e[n.method]
;if(!a)return G.logger.warn("mh: unknown method "+n.method),!1;if(!a.allow||!a.exec)return G.logger.warn("mh: invalid implementation of "+n.method),!1;const i=t(s),A=i.extpage,l=i.page,c=i.id_valid;A?s.extpage=l:delete n.origin;const u="options"==l,d=c&&!A;let g=!0;if("background"==l||a.allow.insecure||a.allow.extpage&&A||a.allow.options&&u||a.allow.script&&d){const e=a.exec(n,s,e=>{g=!1,o(e)});return!1!==g&&!1!==e||void 0}
return!1===n.topframe&&(A||u)||G.logger.warn("mh: this context doesn't have the permission to call \""+n.method+'"'),!1};var n=(e,t,r)=>{let n,s,o,a,i;if("off"==We.values.external_connect||!(n=t.url)||!qe.isAllowed(n))return;const A=Object.keys(l.externally_connectable);for(let t=0;t<A.length;t++)if(o=A[t],s=l.externally_connectable[o],(a=ot.regexify({match:[o]}))&&ot.validUrl(n,a)&&(s.includes("*")||s.includes(e.method))){i=!0;break}if(i)if("getVersion"==e.method)r({
version:rea.extension.manifest.version,id:rea.runtime.short_id});else if("all"!=We.values.external_connect)G.logger.warn("mh: calling external method "+e.method+" is not permitted to "+n+" by the user");else if("isInstalled"==e.method){let t,n,s,o,a=!1;const i=e.script.name,A=e.script.namespace;(n=at.getUidsByName(i,A)[0])&&(t=at.getByUid(n))&&t.script&&(a=!0,o=t.script.enabled,s=t.script.version),r({name:i,installed:a,enabled:o,version:s})
}else G.logger.warn("mh: unknown external method "+e.method);else G.logger.warn("mh: calling external method "+e.method+" is not permitted to "+n)},s={xhr:{allow:{script:!0},exec:function(e,t,r,n){let s=!1;const a=Ne.RUNTIME.FIREFOX&&!t.details.anonymous&&(r.tab&&r.tab.incognito||dt.fpi);let i;const l=r.tab?r.tab.cookieStoreId:void 0;a&&(t.details.anonymous=!0,dt.fpi&&r.url&&(i=T.default.parse(r.url).domain||""));const c=r=>{e.disconnect();const n=r.response,s=n?n.responseHeaders:null;if(a&&s){
const e=N.default.parseHeaders(s)["set-cookie"];if(!e)return;e.split(",").forEach(e=>{const r=N.default.parseCookie(e);if(!r)return;const{expires:s,httpOnly:o,name:a,path:A,sameSite:c,secure:u,value:d}=r;dt.set({expirationDate:s?s.getTime():void 0,httpOnly:o,name:a,path:A,sameSite:c,secure:u,storeId:l,url:n.finalUrl||t.details.url,value:d,firstPartyDomain:i})})}};t.details.partialSize=t.details.partialSize||Ne.XMLHTTPREQUEST.PARTIAL_SIZE;const u={};let d;Object.keys(t.callbacks).forEach(e=>{
const r="ondone"===e;(t.callbacks[e]||r||"onload"===e)&&(u[e]=t=>{t=t||{},r&&t.response&&delete t.response.response_data;const s={data:t.response,exception:t.exception};s[e]=!0,n(s),r&&c(t)})}),u.ondone||(u.ondone=c);const g=t.url||r.url||null;t.details.url=T.default.sanitize(t.details.url,g)||t.details.url,Ne.RUNTIME.WEBREQUEST_XHR_SUPPORT&&"no"!=We.values.webrequest_modHeaders&&(t.details.headers=t.details.headers||{},t.details.headers.internal=t.uuid,
Ne.REQUESTS.SENDS_ORIGIN&&!Object.keys(t.details.headers).map(e=>e.toLowerCase()).includes("origin")&&(t.details.headers.origin=null)),((t.details.cookie||a)&&t.details.url?dt.getAll({url:t.details.url,storeId:l,firstPartyDomain:i?null:void 0}).then(e=>{const r=e.map(e=>e.name+"="+encodeURIComponent(e.value)).concat([t.details.cookie]).join(";");delete t.details.cookie,t.details.headers=t.details.headers||{},t.details.headers.cookie=r}):o.Deferred.Pledge()).then(()=>{
if(s)return u.onabort&&u.onabort(),void u.ondone({});let e;if(t.details.url&&(e=T.default.parse(t.details.url).protocol)&&["file:"].concat(Ne.REQUESTS.INTERNAL_PAGE_PROTOCOLS).includes(e)){const r=e=>{const r='Refused to connect to "'+t.details.url+'": '+e,n=N.default.makeErrorResponse(r);["onerror","ondone"].forEach(e=>{u[e]&&u[e]({response:n,exception:r})})};if("file:"==e){let e,n
;if(Ne.RUNTIME.ALLOWS_FILE_SCHEME_ACCESS&&("all"==We.values.script_file_access?e=!0:"externals"!=We.values.script_file_access||(n=at.getByUid(t.uuid))&&n.script&&n.cond&&[].concat(n.script.resources).concat(n.script.requires).map(e=>T.default.sanitize(e.unsafe_url,e.abs_url)).includes(t.details.url)&&(e=!0)),!e)return r("Access to this local file is forbidden!")}rea.file.get(t.details.url,e=>{const t=Z.a.ab2strSync(e);if(u.onpartial){const e=Object(A.splitSlice)(t,Ne.XMLHTTPREQUEST.PARTIAL_SIZE)
;e.forEach((t,r)=>{u.onpartial({response:{partial:t,index:r,length:e.length}})})}const r={readyState:4,responseHeaders:"",status:0,statusText:""};["onload","ondone"].forEach(e=>{u[e]&&u[e]({response:r})})},r)}else{const e={foreign_context:Ne.RUNTIME.FIREFOX&&r.tab&&(r.tab.incognito||r.tab.cookieStoreId!=rea.cookies.DEFAULT_STORE_ID)};d=$e.exec(t.details,t.uuid,r||{},e,u)}});const p=()=>{s||(d?d.abort():s=!0)};return e&&e.onMessage.addListener(e=>{e.cancel&&p()}),p}},download:{allow:{script:!0},
exec:function(e,t,r,n){const s=t.details;let o=ne.start(s,{onload:e=>{n&&n({load:!0,data:e})},onprogress:e=>{n&&n({progress:!0,data:e})},onerror:e=>{n&&n({error:!0,data:e})},ontimeout:e=>{n&&n({timeout:!0,data:e})},ondone:()=>{e&&e.disconnect(),e=null}},{internal:null===e});return e&&void 0!==o&&e.onMessage.addListener(e=>{e.cancel&&null!==o&&(ne.cancel(o),o=null)}),()=>{e=null,n=null}}},webRequest:{allow:{script:!0},exec:function(e,t,r,n){const s=r.tab.id,o=r.frameId
;(void 0!==s&&void 0!==o||!t.uuid)&&wt.scripts.set(s,o,t.uuid,t.rules,e=>{n(e)})}},addStorageListener:{allow:{script:!0},exec:function(e,t,r,n){if(r.tab)return at.addStorageListener(r.tab.id,t.id,t.uuid,Date.now(),n),()=>{at.removeStorageListeners({uuid:t.uuid,id:t.id},!1)};n({error:!0})}},saveStorageKey:{allow:{script:!0},exec:function(e,t,r,n){if(r.tab){if(t.uuid){const e=at.getStorageByUid(t.uuid),r=t.value,n=t.key;e.data[n]=r,e.ts=t.ts,at.setStorageByUid(t.uuid,e),at.notifyStorageListeners({
uuid:t.uuid},{id:t.id},e=>{const s={data:{},ts:t.ts},o={storage:s};void 0===r?o.removed=n:s.data[n]=r,e(o)})}}else G.logger.warn("storage: unable to save storage due to empty tabID!");n({})}},exportToJson:{allow:{extpage:!0},exec:function(e,t,r,n){ot.exportToJson(t.ids,t.options).done(e=>{const t=JSON.stringify(e);Object(A.splitSlice)(t,parseInt(Ne.XMLHTTPREQUEST.PARTIAL_SIZE)).forEach(e=>n({partial:e})),n({done:!0})}).fail(()=>{n({error:!0})})}},openInTab:{allow:{script:!0},
exec:function(e,t,r,n){let s;const o=["active"],a={url:t.details.url};let i=null;if(s=t.details.options){for(let e=0;e<o.length;e++)void 0!==s[o[e]]&&(a[o[e]]=s[o[e]]);s.incognito?a.incognito=!0:(s.insert&&(a.index=r.tab.index+1),s.setParent?a.parent=r.tab:a.parent={windowId:r.tab.windowId})}return rea.tabs.create(a,t=>{t&&(i=t.id,e&&(je[i]={onClose:function(){e&&n({closed:!0})}},n({success:!0,tabId:i})))}),e.onMessage.addListener(e=>{if(null!==i)if(e.close)rea.tabs.remove(i,()=>{
const e=rea.runtime.lastError;e?G.logger.warn("tab.close",e.message):i=null});else if(void 0!==e.name){const t=5;let r=0;const s=()=>{Qe.listeners.once.whenReady(i,()=>{rea.tabs.sendMessage(i,{method:"setForeignAttr",attr:"name",value:e.name},{frameId:0},o=>{o?n({name:e.name}):r++<t?window.setTimeout(s,100*r):G.logger.warn("foreignAttr: error setting attr")})})};s()}}),()=>{null!==i&&delete je[i],e=null}}},registerMenuCommand:{allow:{script:!0},exec:function(e,t,r,n){if(r.tab){
const{name:e,uuid:s,accessKey:o,menuId:a}=t,i=r.tab.id;let A;const l=at.getByUid(s);return A=l.script&&l.cond?M.I18N.getTranslation(l.script,"name"):M.I18N.getMessage("This_script_was_deleted"),gt.add({tabId:i,name:e,uuid:s,accessKey:o,menuId:a,scriptName:A},n),rt.actionPage("update"),()=>{gt.clearById(t.menuId),rt.actionPage("update")}}G.logger.warn("Unable to register menu cmd due to empty tabID!"),e.disconnect()}},observeUrlChanges:{allow:{script:!0},exec:function(e,t,r,n){
const s=r.frameId,o=r.tab.id,a=e=>{e.tabId==o&&e.frameId==s&&n({url:e.url})};return It.addListener(o,a),()=>{It.removeListener(o,a)}}},tabWatch:{allow:{extpage:!0},exec:function(e,t,r,n){let s;const o=xt.openAndWatch({url:t.url,index:(r.tab.index||0)+1,parent:r.tab},t=>{t?(s=s||t.id,n({tab:t})):(a(),e.disconnect())});var a=()=>{o.cancel()};return a}}};const a=e=>{kt.late?e.onMessage.addListener(r=>{void 0!==r.method&&((e,r)=>{const n=e.sender,o=s[r.method]
;if(!o)return G.logger.warn("mh: unknown method "+r.method),!1;if(!o.allow||!o.exec)return G.logger.warn("mh: invalid implementation of "+r.method),!1;const a=t(n),i=a.extpage,A=a.page,l="options"==A,c=a.id_valid&&!i;if(!("background"==A||o.allow.insecure||o.allow.extpage&&i||o.allow.options&&l||o.allow.script&&c))return!1===r.topframe&&(i||l)||G.logger.warn("mh: this context doesn't have the permission to call \""+r.method+'"'),!1;{const t=o.exec(e,r,n,t=>{try{e.postMessage(t)}catch(r){
G.logger.debug("bg: Error sending port ("+e.name+") message",t)}});t&&e.onDisconnect.addListener(t)}})(e,r)}):kt.registerLateCallback(()=>{a(e)})};var l={init:function(){l.externally_connectable_reg=ot.regexify({match:Object.keys(l.externally_connectable)}),rea.extension.onMessage.addListener(r),rea.extension.onConnect.addListener(a),rea.extension.onConnectExternal.addListener(e=>{e.disconnect()})},externally_connectable:{"*://www.tampermonkey.net/*":["getVersion"],
"https://greasyfork.org/*":["*"],"https://userstyles.org/*":["*"],"*://*.userscript.zone/*":["*"]}};return l})(),dt=(()=>{const e=(e,t)=>(Ne.RUNTIME.FPI?void 0!==t&&(e.firstPartyDomain=e.firstPartyDomain||t):delete e.firstPartyDomain,e);let t;const r={getAll:function(t){const r=Object(o.Deferred)();return rea.cookies.getAll(e(t,null),r.resolve),r.promise()},remove:function(t){const r=Object(o.Deferred)();return rea.cookies.remove(e(t),e=>{if(e)r.resolve();else{const e=rea.runtime.lastError
;r.reject(e?e.message:"unknown error")}}),r.promise()},set:function(t){const r=Object(o.Deferred)();return rea.cookies.set(e(t),e=>{if(e)r.resolve();else{const e=rea.runtime.lastError;r.reject(e?e.message:"unknown error")}}),r.promise()}};return Object.defineProperties(r,{fpi:{get:()=>t}}),Ne.RUNTIME.FPI&&rea.cookies.remove({url:"https://www.tampermonkey.net",name:"doesnotexist"},()=>{rea.runtime.lastError&&(t=!0)}),r})(),gt=(()=>{let e=[];return{
add:function({tabId:t,name:r,uuid:n,accessKey:s,menuId:o,scriptName:a},i){e.push({tabId:t,name:r,uuid:n,accessKey:s,menuId:o,scriptName:a,response:i})},list:function(){return e},listByTabId:function(t){const r={};return e.filter(e=>{const n=e.uuid+e.name;return e.tabId==t&&!r[n]&&(r[n]=!0)})},clearByTabId:function(t){e=e.filter(e=>e.tabId!=t)},getByTabId:function(t){return e.filter(e=>e.tabId==t)[0]},clearById:function(t){e=e.filter(e=>e.menuId!=t)},getById:function(t){
return e.filter(e=>e.menuId==t)[0]}}})();const pt=function(){let e,t,r,n,s,o,a,i,A,l,c,u,d,g,p,m,f,h,R=null;e={id:"general",name:M.I18N.getMessage("General"),sub_menu_item:!0,items:[]},e.items.push({name:M.I18N.getMessage("Config_Mode"),id:"configMode",level:0,option:!0,select:[{name:M.I18N.getMessage("Novice"),value:0},{name:M.I18N.getMessage("Beginner"),value:50},{name:M.I18N.getMessage("Advanced"),value:100}],value:We.values.configMode,
desc:M.I18N.getMessage("Changes_the_number_of_visible_config_options")}),e.items.push({name:M.I18N.getMessage("Language"),id:"i18n",level:0,option:!0,reload:!0,warning:M.I18N.getMessage("A_reload_is_required"),select:[{name:"Browser Default",value:null}].concat(M.I18N.supported),value:We.values.i18n,validation:{image:"info",opacity:.9,msg:M.I18N.getMessage("Your_language_is_not_supported__Click_here_to_get_intructions_how_to_translate_TM_"),url:"https://www.tampermonkey.net/faq.php#Q500"}}),
e.items.push({name:M.I18N.getMessage("Auto_reload_on_script_enabled"),level:20,id:"autoReload",option:!0,checkbox:!0,enabled:We.values.autoReload,desc:M.I18N.getMessage("Auto_reload_on_script_enabled_desc")}),e.items.push({name:M.I18N.getMessage("Anonymous_statistics"),level:0,id:"statistics_enabled",option:!0,checkbox:!0,enabled:!!We.values.statistics_enabled,validation:{image:"info",opacity:.9,msg:M.I18N.getMessage("Allow_Tampermonkey_to_collect_anonymous_statistics_via_Google_Analytics"),
url:"https://www.tampermonkey.net/privacy.php#extension"}}),e.items.push({name:M.I18N.getMessage("Debug_scripts"),level:100,id:"debug",option:!0,checkbox:!0,enabled:We.values.debug,desc:""}),e.items.push({name:M.I18N.getMessage("Show_fixed_source"),level:100,id:"showFixedSrc",option:!0,checkbox:!0,enabled:We.values.showFixedSrc,desc:""}),e.items.push({name:M.I18N.getMessage("LogLevel"),id:"logLevel",level:0,option:!0,select:[].concat(Ne.RUNTIME.SAFARI?[{name:M.I18N.getMessage("Verbose"),value:90
}]:[]).concat([{name:M.I18N.getMessage("Debug"),value:G.VERBOSE},{name:M.I18N.getMessage("Info"),value:G.DEBUG},{name:M.I18N.getMessage("Warning"),value:G.WARN},{name:M.I18N.getMessage("Error"),value:G.ERROR}]),value:We.values.logLevel,desc:""}),m={id:"script_sync",name:M.I18N.getMessage("Script_Sync"),sub_menu_item:!0,level:50,need_save:!0,items:[]},m.items.push({name:M.I18N.getMessage("Enable_Script_Sync"),id:"sync_enabled",level:50,option:!0,checkbox:!0,enabled:We.values.sync_enabled,
desc:M.I18N.getMessage("Synchronize_your_scripts_across_browsers_and_operation_systems")});const v=(()=>{const e=[],t={reset_sync:!0,cloud_url:!1,cloud_user:!1,cloud_pass:!1};return rea.storage.sync.supported&&e.push({name:M.I18N.getMessage("Browser_Sync"),value:Ae.b.eCHROMESYNC,enable:t}),e.push({name:M.I18N.getMessage("Google_Drive"),value:Ae.b.eGDRIVE,enable:t}),
Ne.RUNTIME.CHROME&&Ne.RUNTIME.BROWSER_VERSION<37||Ne.RUNTIME.SAFARI&&Ne.RUNTIME.BROWSER_VERSION<8||Ne.RUNTIME.DOLPHIN?G.logger.info("Script Sync: no Dropbox support due to missing SHA-256 capabilities"):e.push({name:M.I18N.getMessage("Dropbox"),value:Ae.b.eDROPBOX,enable:t}),e.push({name:M.I18N.getMessage("OneDrive"),value:Ae.b.eONEDRIVE,enable:t}),Ne.RUNTIME.SAFARI||(e.push({name:M.I18N.getMessage("Yandex_Disk"),value:Ae.b.eYANDEX,enable:t}),e.push({name:M.I18N.getMessage("WebDAV"),
value:Ae.b.eWEBDAV,enable:{reset_sync:!0,cloud_url:!0,cloud_user:!0,cloud_pass:!0}})),e})();if(m.items.push({name:M.I18N.getMessage("Sync_Type"),id:"sync_type",enabler:!0,level:50,option:!0,select:v,value:We.values.sync_type}),m.items.push({name:M.I18N.getMessage("URL"),id:"cloud_url",enabledBy:"sync_type",level:50,option:!0,text:!0,width:2,value:We.values.cloud_url}),m.items.push({name:M.I18N.getMessage("Login"),id:"cloud_user",enabledBy:"sync_type",level:50,option:!0,text:!0,width:2,
value:We.values.cloud_user}),m.items.push({name:M.I18N.getMessage("Password"),id:"cloud_pass",enabledBy:"sync_type",level:50,option:!0,text:!0,password:!0,width:2,value:We.values.cloud_pass}),m.items.push({name:M.I18N.getMessage("Sync_Reset"),id:"reset_sync",enabledBy:"sync_type",level:80,button:!0,reload:!0,value:0,warning:M.I18N.getMessage("This_will_remove_all_remote_data_from_sync_Ok_")}),a={id:"appearance",name:M.I18N.getMessage("Appearance"),sub_menu_item:!0,need_save:!0,items:[],
warning:M.I18N.getMessage("A_reload_is_required"),reload:!0},a.items.push({name:M.I18N.getMessage("Layout"),id:"layout",level:0,option:!0,select:x.a.getLayouts(),value:We.values.layout,desc:""}),a.items.push({name:M.I18N.getMessage("Custom_CSS"),id:"layout_user_css",level:100,option:!0,input:!0,value:We.values.layout_user_css,desc:M.I18N.getMessage("You_can_add_your_custom_CSS_rules_here_")}),R={},"off"==We.values.notification_showUpdate&&(R={image:"critical",
msg:M.I18N.getMessage("Are_you_sure_that_you_don_t_want_to_be_notified_of_updates_")}),a.items.push({name:M.I18N.getMessage("Update_Notification"),id:"notification_showUpdate",level:50,option:!0,select:[{name:M.I18N.getMessage("Disabled"),value:"off"},{name:M.I18N.getMessage("Show_notification"),value:"notification"},{name:M.I18N.getMessage("Open_changelog"),value:"changelog"}],value:We.values.notification_showUpdate,validation:R}),a.items.push({name:M.I18N.getMessage("Favicon_Service"),
id:"favicon_service",level:50,option:!0,select:[{name:M.I18N.getMessage("Google"),value:"google"},{name:M.I18N.getMessage("DuckDuckGo"),value:"duckduckgo"},{name:M.I18N.getMessage("Native"),value:"native",warning:M.I18N.getMessage("Warning_unsafe_site_warnings_might_appear_")}],value:We.values.favicon_service}),i={id:"action_menu",name:M.I18N.getMessage("Action_Menu"),sub_menu_item:!0,need_save:!0,items:[],level:50},i.items.push({name:M.I18N.getMessage("Hide_disabled_scripts"),
id:"action_menu_scripts_hide_disabled",level:100,option:!0,checkbox:!0,enabled:We.values.action_menu_scripts_hide_disabled,desc:""}),i.items.push({name:M.I18N.getMessage("Columns"),id:"action_menu_columns",level:50,option:!0,select:[{name:M.I18N.getMessage("1"),value:"1"},{name:M.I18N.getMessage("2"),value:"2"},{name:M.I18N.getMessage("3"),value:"3"}],value:We.values.action_menu_columns}),i.items.push({name:M.I18N.getMessage("Script_order"),id:"action_menu_scripts_sort",level:50,option:!0,
select:[{name:M.I18N.getMessage("Auto"),value:"auto"},{name:M.I18N.getMessage("Position_"),value:"position"},{name:M.I18N.getMessage("Name"),value:"name"},{name:M.I18N.getMessage("Enabled"),value:"enabled"}],value:We.values.action_menu_scripts_sort}),i.items.push({name:M.I18N.getMessage("Icon_badge_info"),id:"appearance_badges",level:50,option:!0,select:[{name:M.I18N.getMessage("Disabled"),value:"off"},{name:M.I18N.getMessage("Running_scripts"),value:"running"},{
name:M.I18N.getMessage("Unique_running_scripts"),value:"running_unique"}],value:We.values.appearance_badges}),(Ne.RUNTIME.CHROME||Ne.RUNTIME.FIREFOX)&&i.items.push({name:M.I18N.getMessage("Icon_badge_color"),id:"appearance_badge_color",level:100,color:!0,value:We.values.appearance_badge_color}),Ne.RUNTIME.FIREFOX&&i.items.push({name:M.I18N.getMessage("Icon_badge_text_color"),id:"appearance_badge_text_color",level:100,color:!0,value:We.values.appearance_badge_text_color}),A={id:"context_menu",
name:M.I18N.getMessage("Context_Menu"),sub_menu_item:!0,items:[],level:50},A.items.push({name:M.I18N.getMessage("Enable_context_menu"),id:"context_menu_enabled",level:50,option:!0,checkbox:!0,enabled:We.values.context_menu_enabled,desc:""}),A.items.push({name:M.I18N.getMessage("Scripts_activated_by_context_menu"),id:"context_menu_scripts",level:50,option:!0,checkbox:!0,enabled:We.values.context_menu_scripts,desc:""}),A.items.push({name:M.I18N.getMessage("Script_menu_commands"),
id:"context_menu_commands",level:50,option:!0,checkbox:!0,enabled:We.values.context_menu_commands,desc:""}),We.values.userscript_search_url&&(n={id:"userscript_search",name:M.I18N.getMessage("Userscript_Search"),sub_menu_item:!0,level:0,items:[],reload:!0},n.items.push({name:M.I18N.getMessage("Userscript_search_integration_mode"),id:"userscript_search_mode",level:0,option:!0,select:[{name:M.I18N.getMessage("Disabled"),value:"off"},{name:M.I18N.getMessage("On_Click"),value:"click"},{
name:M.I18N.getMessage("On_Action_Menu"),value:"action_menu"},{name:M.I18N.getMessage("Add_to_icon_badge_text"),value:"badge"}],value:We.values.userscript_search_mode,validation:{image:"info",opacity:.9,
msg:M.I18N.getMessage("In_order_to_search_for_userscripts__0on_action_menu0__and__0icon_badge_number0__automatically_transfer_the_tab_s_url_to_the_search_website__0on_click0_opens_the_search_page_on_click_Please_click_at_this_icon_to_open_the_privacy_policy_",M.I18N.getMessage("Add_to_icon_badge_text"),M.I18N.getMessage("On_Action_Menu"),M.I18N.getMessage("On_Click")),url:Ge()}})),r={id:"editor",name:M.I18N.getMessage("Editor"),sub_menu_item:!0,level:20,need_save:!0,items:[],
warning:M.I18N.getMessage("A_reload_is_required"),reload:!0},r.items.push({name:M.I18N.getMessage("Enable_Editor"),id:"editor_enabled",level:100,option:!0,checkbox:!0,enabled:We.values.editor_enabled,desc:""}),r.items.push({name:M.I18N.getMessage("Theme"),id:"editor_theme",level:50,option:!0,select:x.a.getEditorThemes(),value:We.values.editor_theme}),r.items.push({name:M.I18N.getMessage("Font_Size"),id:"editor_fontSize",level:50,option:!0,select:[{name:"50%",value:50},{name:"70%",value:70},{
name:"80%",value:80},{name:"90%",value:90},{name:"100%",value:100},{name:"110%",value:110},{name:"120%",value:120},{name:"150%",value:150}],value:We.values.editor_fontSize}),r.items.push({name:M.I18N.getMessage("Key_Mapping"),id:"editor_keyMap",level:50,option:!0,select:[{name:M.I18N.getMessage("Windows"),value:"windows"},{name:M.I18N.getMessage("Sublime"),value:"sublime"},{name:M.I18N.getMessage("Emacs"),value:"emacs"},{name:M.I18N.getMessage("Vim"),value:"vim"}],value:We.values.editor_keyMap
}),r.items.push({name:M.I18N.getMessage("Indentation_Width"),id:"editor_indentUnit",level:50,option:!0,select:[{name:M.I18N.getMessage("1"),value:1},{name:M.I18N.getMessage("2"),value:2},{name:M.I18N.getMessage("3"),value:3},{name:M.I18N.getMessage("4"),value:4},{name:M.I18N.getMessage("5"),value:5},{name:M.I18N.getMessage("6"),value:6},{name:M.I18N.getMessage("7"),value:7},{name:M.I18N.getMessage("8"),value:8},{name:M.I18N.getMessage("9"),value:9},{name:M.I18N.getMessage("10"),value:10},{
name:M.I18N.getMessage("11"),value:11}],value:We.values.editor_indentUnit,desc:""}),r.items.push({name:M.I18N.getMessage("Tab_Size"),id:"editor_tabSize",level:50,option:!0,select:[{name:M.I18N.getMessage("1"),value:1},{name:M.I18N.getMessage("2"),value:2},{name:M.I18N.getMessage("3"),value:3},{name:M.I18N.getMessage("4"),value:4},{name:M.I18N.getMessage("5"),value:5},{name:M.I18N.getMessage("6"),value:6},{name:M.I18N.getMessage("7"),value:7},{name:M.I18N.getMessage("8"),value:8},{
name:M.I18N.getMessage("9"),value:9},{name:M.I18N.getMessage("10"),value:10},{name:M.I18N.getMessage("11"),value:11}],value:We.values.editor_tabSize,desc:""}),r.items.push({name:M.I18N.getMessage("Indent_with"),id:"editor_indentWithTabs",level:50,option:!0,select:[{name:M.I18N.getMessage("Tabs"),value:"tabs"},{name:M.I18N.getMessage("Spaces"),value:"spaces"}],value:We.values.editor_indentWithTabs,desc:""}),r.items.push({name:M.I18N.getMessage("TabMode"),id:"editor_tabMode",level:50,option:!0,
select:[{name:M.I18N.getMessage("Classic"),value:"classic"},{name:M.I18N.getMessage("Smart"),value:"smart"},{name:M.I18N.getMessage("Indent"),value:"indent"}],value:We.values.editor_tabMode,desc:""}),r.items.push({name:M.I18N.getMessage("Highlight_selection_matches"),id:"editor_highlightSelectionMatches",level:50,option:!0,select:[{name:M.I18N.getMessage("Cursor"),value:"cursor"},{name:M.I18N.getMessage("On"),value:"on"},{name:M.I18N.getMessage("Off"),value:"off"}],
value:We.values.editor_highlightSelectionMatches,desc:""}),r.items.push({name:M.I18N.getMessage("Line_break"),id:"editor_lineWrapping",level:50,option:!0,checkbox:!0,enabled:We.values.editor_lineWrapping,desc:""}),r.items.push({name:M.I18N.getMessage("Reindent_on_typing"),id:"editor_electricChars",level:50,option:!0,checkbox:!0,enabled:We.values.editor_electricChars,desc:""}),r.items.push({name:M.I18N.getMessage("Enable_autoSave"),id:"editor_autoSave",level:20,option:!0,checkbox:!0,
enabled:We.values.editor_autoSave,desc:""}),r.items.push({name:M.I18N.getMessage("Enable_easySave"),id:"editor_easySave",level:20,option:!0,checkbox:!0,enabled:We.values.editor_easySave,desc:""}),r.items.push({name:M.I18N.getMessage("Highlight_trailing_whitespace"),id:"editor_highlightTrailingWhitespace",level:50,option:!0,checkbox:!0,enabled:We.values.editor_highlightTrailingWhitespace,desc:""}),r.items.push({name:M.I18N.getMessage("Trim_trailing_whitespace_from_modified_lines"),
id:"editor_trimTrailingSpacesFromModifiedLines",level:50,option:!0,checkbox:!0,enabled:We.values.editor_trimTrailingSpacesFromModifiedLines,desc:""}),r.items.push({name:M.I18N.getMessage("Auto_syntax_check_on_typing"),id:"editor_autoLint",level:50,option:!0,checkbox:!0,enabled:We.values.editor_autoLint,desc:M.I18N.getMessage("Enable_this_option_to_automatically_check_the_code_on_typing_")}),r.items.push({name:M.I18N.getMessage("Auto_syntax_check_max_length"),id:"editor_autoLintMaxLen",level:50,
option:!0,text:!0,value:We.values.editor_autoLintMaxLen,desc:M.I18N.getMessage("Check_only_scripts_up_to_this_size_automatically_")}),r.items.push({name:M.I18N.getMessage("Custom_Linter_Config"),id:"editor_linter_config",level:100,option:!0,input:!0,json:!0,value:We.values.editor_linter_config,validation:{image:"info",opacity:.9,msg:M.I18N.getMessage("You_can_add_your_custom_linter_config_here_"),url:"https://eslint.org/docs/user-guide/configuring"}}),o={id:"script_update",
name:M.I18N.getMessage("Script_Update"),sub_menu_item:!0,level:0,items:[]},o.items.push({name:M.I18N.getMessage("Check_disabled_scripts"),id:"scriptUpdateCheckDisabled",level:0,option:!0,checkbox:!0,enabled:We.values.scriptUpdateCheckDisabled,desc:""}),o.items.push({name:M.I18N.getMessage("Dont_ask_me_for_simple_script_updates"),id:"notification_silentScriptUpdate",level:80,option:!0,checkbox:!0,enabled:We.values.notification_silentScriptUpdate,desc:""}),o.items.push({
name:M.I18N.getMessage("Check_interval"),id:"scriptUpdateCheckPeriod",level:0,option:!0,select:[{name:M.I18N.getMessage("Never"),value:0},{name:M.I18N.getMessage("Every_6_Hours"),value:216e5},{name:M.I18N.getMessage("Every_12_Hour"),value:432e5},{name:M.I18N.getMessage("Every_Day"),value:864e5},{name:M.I18N.getMessage("Every_Week"),value:6048e5}],value:We.values.scriptUpdateCheckPeriod,desc:""}),o.items.push({name:M.I18N.getMessage("Hide_notification_after"),
id:"scriptUpdateHideNotificationAfter",level:50,option:!0,select:[{name:M.I18N.getMessage("Never"),value:0},{name:M.I18N.getMessage("15_Seconds"),value:15e3},{name:M.I18N.getMessage("30_Seconds"),value:3e4},{name:M.I18N.getMessage("1_Minute"),value:6e4},{name:M.I18N.getMessage("5_Minutes"),value:3e5},{name:M.I18N.getMessage("1_Hour"),value:36e5}],value:We.values.scriptUpdateHideNotificationAfter,desc:""}),s={id:"externals",name:M.I18N.getMessage("Externals"),sub_menu_item:!0,level:0,items:[]},
s.items.push({name:M.I18N.getMessage("Update_interval"),id:"external_update_interval",level:0,option:!0,select:[{name:M.I18N.getMessage("Always"),value:1},{name:M.I18N.getMessage("Every_Day"),value:864e5},{name:M.I18N.getMessage("Every_Week"),value:6048e5},{name:M.I18N.getMessage("Every_Month"),value:2592e6},{name:M.I18N.getMessage("Never"),value:0}],value:We.values.external_update_interval,desc:""}),l={id:"security",name:M.I18N.getMessage("Security"),sub_menu_item:!0,need_save:!0,level:50,
items:[]},Ne.OPTIONS.HAS_CSP&&(l.items.push({name:M.I18N.getMessage("Add_TM_to_CSP"),id:"webrequest_fixCSP",level:80,option:!0,select:[{name:M.I18N.getMessage("Remove__possibly_unsecure_"),value:"remove"},{name:M.I18N.getMessage("Yes"),value:"yes"},{name:M.I18N.getMessage("No"),value:"no"}],value:We.values.webrequest_fixCSP,desc:M.I18N.getMessage("Tampermonkey_might_not_be_able_to_provide_access_to_the_unsafe_context_when_this_is_disabled")}),l.items.push({
name:M.I18N.getMessage("Allow_headers_to_be_modified_by_scripts"),id:"webrequest_modHeaders",level:80,option:!0,reload:!0,select:[{name:M.I18N.getMessage("Yes"),value:"yes"},{name:M.I18N.getMessage("Auto"),value:"auto"},{name:M.I18N.getMessage("No"),value:"no"}],value:We.values.webrequest_modHeaders,warning:M.I18N.getMessage("Tampermonkey_needs_to_be_restarted_to_make_this_change_apply_Do_you_want_to_continue_"),desc:""})),Ne.RUNTIME.ALLOWS_FILE_SCHEME_ACCESS&&l.items.push({
name:M.I18N.getMessage("Script_local_files_access"),id:"script_file_access",level:80,option:!0,select:[{name:M.I18N.getMessage("All_local_files"),value:"all"},{name:M.I18N.getMessage("require_and_resource"),value:"externals"},{name:M.I18N.getMessage("Disabled"),value:"off"}],value:We.values.script_file_access}),l.items.push({name:M.I18N.getMessage("Allow_communication_with_cooperate_pages"),id:"external_connect",level:80,option:!0,reload:!0,select:[{
name:M.I18N.getMessage("Tampermonkey_and_script_version"),value:"all"},{name:M.I18N.getMessage("Tampermonkey_version"),value:"version"},{name:M.I18N.getMessage("Disabled"),value:"off"}],value:We.values.external_connect,desc:M.I18N.getMessage("This_option_allows_the_Tampermonkey_homepage_and_some_script_hosting_pages_to_determine_the_Tampermonkey_version_and_whether_a_script_is_installed_")}),l.items.push({name:M.I18N.getMessage("Subresource_Integrity"),id:"require_sri_mode",level:80,option:!0,
select:[{name:M.I18N.getMessage("Disabled"),value:"ignore"},{name:M.I18N.getMessage("Validate_if_supported"),value:"supported"},{name:M.I18N.getMessage("Validate_if_given"),value:"given"},{name:M.I18N.getMessage("Enforce"),value:"enforce"}],value:We.values.require_sri_mode,desc:M.I18N.getMessage("Script_authors_can_secure_external_resources_by_adding_a_SRI_hash_to_the_URL_")}),l.items.push({name:M.I18N.getMessage("connect_mode"),id:"connect_mode",level:50,option:!0,
select:(We.values.configMode>=80||["off","casual"].includes(We.values.connect_mode)?[{name:M.I18N.getMessage("Disabled"),value:"off"},{name:M.I18N.getMessage("Casual"),value:"casual"}]:[]).concat([{name:M.I18N.getMessage("Ask_if_unknown"),value:"ask"},{name:M.I18N.getMessage("Strict"),value:"strict"},{name:M.I18N.getMessage("Always_ask"),value:"paranoid"}]),value:We.values.connect_mode,desc:""}),
Ne.RUNTIME.INCOGNITO_MODE&&!rea.extension.inIncognitoContext&&(R="temporary"==We.values.incognito_mode?{}:{image:"critical",msg:"Permanent mode is still a BETA feature!"},l.items.push({name:M.I18N.getMessage("Store_data_in_incognito_mode"),id:"incognito_mode",level:50,option:!0,select:[{name:M.I18N.getMessage("Temporary"),value:"temporary"},{name:M.I18N.getMessage("Permanent"),value:"permanent"}],value:We.values.incognito_mode,validation:R})),l.items.push({
name:M.I18N.getMessage("Page_Filter_Mode"),id:"page_filter_mode",level:50,option:!0,select:[{name:M.I18N.getMessage("Disabled"),value:"off"},{name:M.I18N.getMessage("Blacklist"),value:"black"},{name:M.I18N.getMessage("Whitelist"),value:"white"},{name:M.I18N.getMessage("Both"),value:"black+white"}],value:We.values.page_filter_mode,desc:""}),l.items.push({name:M.I18N.getMessage("Whitelisted_Pages"),id:"page_whitelist",level:50,option:!0,input:!0,array:!0,value:We.values.page_whitelist,desc:""}),
l.items.push({name:M.I18N.getMessage("Blacklisted_Pages"),id:"forbiddenPages",level:50,option:!0,input:!0,array:!0,value:We.values.forbiddenPages,desc:""}),c={id:"blackcheck",name:M.I18N.getMessage("BlackCheck"),sub_menu_item:!0,need_save:!0,level:50,items:[]},c.items.push({name:M.I18N.getMessage("Script_Blacklist_Source"),id:"script_blacklist_type",level:50,option:!0,select:[{name:M.I18N.getMessage("Disabled"),value:"off"},{name:M.I18N.getMessage("Server_And_Manual"),value:"server"},{
name:M.I18N.getMessage("Only_Manual"),value:"only_manual"}],value:We.values.script_blacklist_type}),c.items.push({name:M.I18N.getMessage("Blacklist_Severity"),id:"script_blacklist_severity",level:50,option:!0,select:[{name:M.I18N.getMessage("severity_1"),value:1},{name:M.I18N.getMessage("severity_2"),value:2},{name:M.I18N.getMessage("severity_3"),value:3},{name:M.I18N.getMessage("severity_4"),value:4},{name:M.I18N.getMessage("severity_5"),value:5},{name:M.I18N.getMessage("severity_6"),value:6},{
name:M.I18N.getMessage("severity_7"),value:7},{name:M.I18N.getMessage("severity_8"),value:8},{name:M.I18N.getMessage("severity_9"),value:9},{name:M.I18N.getMessage("severity_10"),value:ze.SEVERITY_MAX}],value:We.values.script_blacklist_severity}),c.items.push({name:M.I18N.getMessage("Manual_Script_Blacklist"),id:"require_blacklist",level:50,option:!0,input:!0,array:!0,value:We.values.require_blacklist,desc:""}),Ne.OPTIONS.CAN_DOWNLOAD){let e=!1;R={},
["exe","sh","crx","com","bat","scr"].map(e=>"name."+e).forEach(t=>{e|=ne.is_whitelisted(t)}),e&&(R={image:"critical",msg:M.I18N.getMessage("Your_whitelist_seems_to_include_executable_files_This_means_your_userscripts_may_download_malware_or_spyware_to_your_harddisk_")}),h={id:"downloads",name:M.I18N.getMessage("Downloads")+" BETA",sub_menu_item:!0,need_save:!0,level:50,items:[]},h.items.push({name:M.I18N.getMessage("Download_Mode"),id:"downloads_mode",level:50,option:!0,select:[{
name:M.I18N.getMessage("Default"),value:ne.staticVars.DEFAULT},{name:M.I18N.getMessage("Disabled"),value:ne.staticVars.OFF},{name:M.I18N.getMessage("Native"),value:ne.staticVars.NATIVE},{name:M.I18N.getMessage("Browser_API"),value:rea.downloads.supported?ne.staticVars.CHROME:null}].filter(e=>e.value),value:We.values.downloads_mode,desc:M.I18N.getMessage("The_Browser_API_mode_requires_a_special_permission_")}),h.items.push({name:M.I18N.getMessage("Whitelisted_File_Extensions"),
id:"downloads_extension_whitelist",level:50,option:!0,input:!0,array:!0,value:We.values.downloads_extension_whitelist,desc:M.I18N.getMessage("Only_files_with_these_extensions_can_be_saved_to_the_harddisk_Be_careful_to_not_allow_file_extensions_that_represent_executables_at_your_operating_system_"),validation:R})}return p={id:"experimental",name:M.I18N.getMessage("Experimental"),sub_menu_item:!0,level:80,items:[]},Ne.RUNTIME.FAST_EXEC_SUPPORT&&p.items.push({name:M.I18N.getMessage("Inject_Mode"),
id:"runtime_inject_mode",level:80,option:!0,select:[{name:M.I18N.getMessage("Default"),value:"default"},{name:M.I18N.getMessage("Instant"),value:"instant"},{name:M.I18N.getMessage("Normal"),value:"normal"}],value:We.values.runtime_inject_mode}),p.items.push({name:M.I18N.getMessage("strict_mode"),id:"runtime_strict_mode",level:80,option:!0,select:[{name:M.I18N.getMessage("Default"),value:"byscript"},{name:M.I18N.getMessage("Always"),value:"on"},{name:M.I18N.getMessage("Disabled"),value:"off"}],
value:We.values.runtime_strict_mode}),p.items.push({name:M.I18N.getMessage("top_level_await"),id:"runtime_top_level_await",level:80,option:!0,select:[{name:M.I18N.getMessage("Default"),value:"default"},{name:M.I18N.getMessage("Enabled"),value:"on"},{name:M.I18N.getMessage("Disabled"),value:"off"}],value:We.values.runtime_top_level_await}),rea.webRequest.filterResponseData&&Ne.OPTIONS.HAS_CSP&&p.items.push({name:M.I18N.getMessage("Add_Tampermonkey_to_the_site_s_content_csp"),
id:"webrequest_fixContentCSP",level:80,option:!0,select:[{name:M.I18N.getMessage("Yes"),value:"yes"},{name:M.I18N.getMessage("No"),value:"no"}],value:We.values.webrequest_fixContentCSP,warning:"Warning: enabling this option is may break pages!"}),g={id:"userscripts",name:M.I18N.getMessage("Userscripts"),sub_menu_item:!0,need_save:!0,level:80,items:[]},g.items.push({name:M.I18N.getMessage("Script_URL_detection"),id:"scriptUrlDetection",level:80,option:!0,select:[{name:M.I18N.getMessage("Auto"),
value:"auto"},{name:M.I18N.getMessage("Disabled"),value:"manual"}],value:We.values.scriptUrlDetection}),g.items.push({name:M.I18N.getMessage("New_script_template_"),id:"script_templates",level:80,option:!0,input:!0,array:!0,named:!0,value:We.values.script_templates}),f={id:"reset",name:M.I18N.getMessage("Reset_Section"),sub_menu_item:!0,level:50,items:[]},f.items.push({name:M.I18N.getMessage("Restart_Tampermonkey"),id:"reset_simple",level:50,button:!0,reload:!0,value:0,
warning:M.I18N.getMessage("This_will_restart_Tampermonkey_Ok_")}),f.items.push({name:M.I18N.getMessage("Factory_Reset"),id:"reset_factory",level:80,button:!0,reload:!0,value:0,warning:M.I18N.getMessage("This_will_remove_all_scripts_and_reset_all_settings_Ok_")}),Ue&&f.items.push({name:"Install Tests",id:"install_tests",level:80,button:!0,reload:!1,ignore:!0,value:0,warning:"This will install a lot of test scripts!"}),[e,a,i,A,n,o,s,u,m,t,d,r,l,c,h,g,p,f].filter(e=>!!e)};var mt={create:(e,t)=>{
e=e||"",t=t||{};const r=e=>o.Deferred.onebyone(e).fail(()=>{G.logger.warn("tree: wait failed!")}).then(e=>e.reduce((e,t)=>e.concat(t),[]).filter(e=>e)),n=(e,r)=>{const n=e.replace(/\.$/,"").split(".");let a=s;for(;n.length;){const s=n.shift();if(!a[s])return G.logger.warn("tree: unable to find",e,t),()=>o.Deferred.Pledge([]);if("function"==typeof a[s])return()=>a[s](t,!r);a=a[s],n.length||n.unshift("root")}return G.logger.warn("tree: unable to find",e,t),()=>o.Deferred.Pledge([])};var s={
actions:{root:function(e){const s=Object(o.Deferred)();return rea.tabs.getSelected(null,o=>{o&&o.id>=0?t.tab=o:e.tabId&&(t.tab={id:e.tabId,url:null});const a=r([n("actions.general"),n("actions.scripts"),n("actions.commands")]);s.consume(a)}),s.promise()},general:function(){const e=t.tab,r=e?e.url:null,n=r&&r.length>4&&""==r.substr(0,4).replace(/file|http/,"")?r:"",s=[],a={name:"enabled",id:"enabled",sub_menu_item:!0,pos:"top",items:[],tabId:e?e.id:null};let i;a.items.push({
name:M.I18N.getMessage("Enabled"),display:We.values.enabled?null:"greyed",id:"enabled",button:!0,reload:!0,enabler:!0}),a.items=a.items.concat(rt.actionStatus().map(e=>({options:e,globalhint:!0}))),s.push(a),!Xe(r,!0)||(i=Xe(r))&&"manual"!=We.values.scriptUrlDetection||a.items.push({name:i?M.I18N.getMessage("Install_this_script"):M.I18N.getMessage("Try_to_install_as_script"),image:"script_download",id:"installFromUrl",data:r,button:!0,reload:!0});const A={name:"about",id:"about",
sub_menu_item:!0,pos:"bottom",items:[]};A.items.push({name:M.I18N.getMessage("Dashboard"),image:"utilities",url:rea.extension.getURL("options.html")+"#"+["url="+Z.a.Base64.encode(n),"nav=dashboard"].join("&"),url_alt:rea.extension.getURL("options.html")+"#"+["filter="+encodeURIComponent(e.url),"url="+Z.a.Base64.encode(n),"nav=dashboard"].join("&"),newtab:!0});const l="version="+rea.extension.manifest.version+"&ext="+rea.runtime.short_id;return A.items.push({image:"about",id:"about",urls:[{
name:" "+M.I18N.getMessage("Help"),url:"https://www.tampermonkey.net/faq.php?"+l,newtab:!0},{name:" "+M.I18N.getMessage("Changelog"),url:"https://www.tampermonkey.net/changelog.php?"+l,newtab:!0},{social:!0,newtab:!0}]}),s.push(A),o.Deferred.Pledge(s)},scripts:{root:function(e){const r=t.tab,n=r?r.url:null,s=[],a=n?T.default.parse(n):null,i=a&&["http:","https:","file:"].includes(a.protocol)?T.default.woHash(a):"";let A;const l={name:"scripts",id:"scripts",sub_menu_item:!0,pos:"center",items:[]
},c={},u={},d={};let g={};const p={},m=a?Ne.REQUESTS.INTERNAL_PAGE_PROTOCOLS.includes(a.protocol):null;let f;r&&[ot.getUniqueScriptsForTab(r),ot.getScriptHistoryForTab(r)].forEach((e,t)=>{let r;Object.keys(e).forEach(n=>{const s=e[n];if(t){if(c[n]=s.urls,u[n]=s.count,d[n]=s.all_time,!(r=g[n])){const e=at.getByUid(n);e.script&&e.cond&&!e.script.deleted?g[n]=r=e.script:g[n]=r={uuid:n,name:M.I18N.getMessage("This_script_was_deleted"),enabled:!0,deleted:!0}}p[n]="a"+r.name.toLowerCase()+r.position
}else g[n]=r=s.script,p[n]="z"+r.name.toLowerCase()+r.position})}),f="position"==We.values.action_menu_scripts_sort?(e,t)=>e.position-t.position:"name"==We.values.action_menu_scripts_sort?(e,t)=>e.name.toLowerCase()<t.name.toLowerCase()?-1:e.name.toLowerCase()>t.name.toLowerCase()?1:0:"enabled"==We.values.action_menu_scripts_sort?(e,t)=>1e4*(e.enabled?0:1)+e.position-(1e4*(t.enabled?0:1)+t.position):(e,t)=>p[e.uuid].localeCompare(p[t.uuid]),g=Object.values(g).sort(f);let h=ht([].concat(g),{
active_urls:c,active_counts:u,all_time_active_counts:d});const R=r?ft(r.id):{};We.values.action_menu_scripts_hide_disabled&&(h=h.filter(e=>e.enabled||u[e.uuid])),h.forEach(e=>{let t;(t=R[e.uuid])&&(e.menu_cmds=t)}),!We.values.action_menu_scripts_hide_disabled&&Math.min(We.values.action_menu_columns,(e?e.available_columns:null)||99)>2?(A={name:"scripts_right",id:"scripts_right",sub_menu_item:!0,pos:"right",items:[]},h.forEach(e=>{(e.enabled||u[e.uuid]?l:A).items.push(e)}),s.push(l),
A.items.length&&s.push(A)):(A=l,l.items=l.items.concat(h),s.push(l)),We.values.enabled&&!h.length&&n&&(m?l.items.push({name:M.I18N.getMessage("Tampermonkey_has_no_access_to_this_page"),image:"no_script",class:"disabled"}):qe.isAllowed(n)?l.items.push({name:M.I18N.getMessage("No_script_is_running"),image:"no_script",class:"disabled"}):l.items.push({name:M.I18N.getMessage("This_page_is_blacklisted_at_the_security_settings"),image:"critical",class:"disabled"}));const v=M.I18N.getLocale()
;if(We.values.enabled){let e;h.length?(e={name:"scripts_new",id:"scripts_new",sub_menu_item:!0,pos:"center",items:[]},s.push(e)):e=l;const t=!!We.values.userscript_search_url,r=We.values.userscript_search_mode;t&&i&&"click"==r?e.items.push({name:M.I18N.getMessage("Search_for_userscripts_for_this_tab"),image:"script_search",data:{url:i},id:"script_search",button:!0}):t&&i&&["action_menu","badge"].includes(r)?e.items.push({name:M.I18N.getMessage("Searching_for_userscripts_for_this_tab"),
image:"script_search",data:{url:i},id:"script_search",class:"disabled",partial:!0,referrer:"actions.script_search"}):e.items.push({name:M.I18N.getMessage("Get_new_scripts___"),image:"script_search",url:"https://www.tampermonkey.net/scripts.php"+(v?"?locale="+v:""),newtab:!0}),e.items.push({name:M.I18N.getMessage("Add_new_script___"),image:"script_add",url:rea.extension.getURL("options.html")+"#nav=new-user-script"+(m?"":"&url="+Z.a.Base64.encode(i)),newtab:!0})}return o.Deferred.Pledge(s)}},
script_search:{root:async e=>{let t,r,n;return t=e.url?await Me(e.url):{count:0},t.error||!t.url?(r=M.I18N.getMessage("Search_for_userscripts_for_this_tab"),n={url:e.url}):(r=t.count?M.I18N.getMessage("Found_0count0_available_scripts",t.count):M.I18N.getMessage("No_available_scripts"),n={result_url:t.url}),[{name:r,data:n,button:!0,image:"script_search",id:"script_search"}]}},commands:function(){const e=[],r=M.I18N.getLocale(),n={name:"commands",id:"commands",sub_menu_item:!0,pos:"left",items:[]
},s={name:M.I18N.getMessage("Utilities"),id:"commands",sub_menu_item:!0,more_menu:!0,pos:"left",items:[]};if(s.items.push({name:M.I18N.getMessage("Check_for_userscripts_updates"),id:"run_script_updates",button:!0,image:"update"}),We.values.configMode>=80&&s.items.push({name:M.I18N.getMessage("Report_a_bug"),image:"bug",url:"https://www.tampermonkey.net/bug",newtab:!0}),We.values.configMode>=50){let e,r,n,o
;["black","black+white"].includes(We.values.page_filter_mode)&&(e=t.tab)&&(r=e.url)&&(n=T.default.parse(r))&&!Ne.REQUESTS.INTERNAL_PAGE_PROTOCOLS.includes(n.protocol)&&(o=n.hostname)&&qe.isAllowed(r)&&s.items.push({name:M.I18N.getMessage("Blacklist_0domain0",o),image:"no",button:!0,id:"blacklist_page",data:{domain:o}})}return Ne.RUNTIME.SAFARI||n.items.push({name:M.I18N.getMessage("Please_consider_a_contribution"),image:"contrib",
url:"https://www.tampermonkey.net/contrib.php?src=a"+rea.runtime.short_id+(r?"&locale="+r:""),newtab:!0}),n.items.push(s),e.push(n),o.Deferred.Pledge(e)}},options:{root:function(){return r([n("options.general"),n("options.verification"),n("options.scripts"),n("options.settings"),n("options.trash")])},general:function(){let e,t=[];return rea.extension.inIncognitoContext&&"temporary"==We.values.incognito_mode?t.push({globalhint:!0,options:{id:"incognito",image:"critical",
text:M.I18N.getMessage("All_modifications_are_only_kept_until_this_incognito_session_is_closed_")}}):(e=rt.optionsStatus().map(e=>({options:e,globalhint:!0})))&&e.length?t=t.concat(e):(e=yt.updateAvailable())&&t.push({globalhint:!0,options:{id:"extensionupdate",image:"info",class:"information",text:M.I18N.getMessage("0name0_0version0_is_available__Please_re_start_your_browser_to_update_",rea.extension.manifest.name,e)}}),o.Deferred.Pledge(t)},verification:function(){const e=[]
;return Ce.getWarnings().forEach(t=>{e.push({globalhint:!0,options:{key:t.key,id:t.id,image:"critical",class:"warning",text:t.text,title:t.description,info_url:t.url}})}),o.Deferred.Pledge(e)},scripts:{root:function(e,t){const s=Object(o.Deferred)(),a={name:M.I18N.getMessage("Installed_userscripts"),main_menu_item:!0,id:"dashboard"};return(e.complete||!t?r(["options.scripts.userscripts","options.scripts.new"].map(e=>n(e))):(a.referrer="options.scripts",a.partial=!0,
r([n("options.scripts.new")]))).done(e=>{a.items=e,s.resolve([a])}).fail(s.reject),s.promise()},new:function(){const e=[];return e.push({name:M.I18N.getMessage("New_userscript"),id:null,image:"script_add",icon:x.a.images.origin("unknown"),nnew:!0,uuid:"new-user-script",position:-1,positionof:Ne.RUNTIME.MAX_SCRIPTS,enabled:!0,userscript:!0}),o.Deferred.Pledge(e)},userscripts:{root:function(e,t){
const r=e.complete||!t?null:"options.scripts.userscripts",n=ot.determineScriptsToRun(null).filter(e=>!e.deleted),s=ht(n,{options_page:!0,referrer:r}),a=s.length,i=M.I18N.getLocale();return s.push({name:M.I18N.getMessage("No_script_is_installed"),image:"info",class:"disabled",visible:!a}),s.push({name:M.I18N.getMessage("Get_some_scripts___"),image:"edit_add",url:"https://www.tampermonkey.net/scripts.php"+(i?"?locale="+i:""),newtab:!0,visible:!a}),o.Deferred.Pledge(s)},matches:function(e){
let t,r=e.filter;if(!r)return o.Deferred.Pledge([]);const n=/\/(.*)\/(.*)/.exec(r.code),s=new RegExp(n[1],n[2]);if(e.uuid){const r=at.getByUid(e.uuid);r.script&&r.cond&&(t=[r.script])}else t=ot.determineScriptsToRun(null).filter(e=>!e.deleted);if(t){const e=t.map(e=>-1!=e.textContent.search(s)?e.uuid:null).filter(e=>e);return o.Deferred.Pledge(e)}return o.Deferred.Pledge([])},source:function(e){if(!e.uuid)return o.Deferred.Pledge([]);const t=at.getByUid(e.uuid);if(t.script&&t.cond){let e
;return e=We.values.showFixedSrc?ae.mkCompat(t.script.textContent,t.script,"off"!=We.values.runtime_strict_mode):t.script.textContent,o.Deferred.Pledge([e])}return G.logger.warn("tree: unable to process ",t),o.Deferred.Breach()},storage:function(e){return e.uuid?o.Deferred.Pledge([at.getStorageByUid(e.uuid).data]):o.Deferred.Pledge([])},external:function(e){if(!e.uuid)return o.Deferred.Pledge([]);const t=at.getByUid(e.uuid);if(t.script&&t.cond){let r
;return[].concat(t.script.requires).concat(t.script.resources).some(t=>{const n=t.url||T.default.sanitize(t.unsafe_url,t.abs_url);if(n!=e.url)return;const s=et.getElement(e.uuid,n);return s&&s.data&&s.data.content?(r=s.data.content,!0):void 0}),o.Deferred.Pledge([r])}return G.logger.warn("tree: unable to process ",t),o.Deferred.Breach()}}},trash:(()=>{const e=ot.determineScriptsToRun(null).filter(e=>e.deleted);return{root:function(t,s){const a=Object(o.Deferred)(),i={
name:M.I18N.getMessage("Trash"),main_menu_item:!0,hidden:!e.length,id:"trash"};return(t.complete||!s?r(["options.trash.userscripts"].map(e=>n(e))):(i.referrer="options.trash",i.partial=!0,o.Deferred.Pledge([]))).done(e=>{i.items=e,a.resolve([i])}).fail(a.reject),a.promise()},userscripts:{root:function(t,r){const n=t.complete||!r?null:"options.trash.userscripts",s=ht(e,{options_page:!0,referrer:n});return o.Deferred.Pledge(s)}}}})(),settings:function(e,t){const r=Object(o.Deferred)(),n={
name:M.I18N.getMessage("Settings"),main_menu_item:!0,id:"settings",selected_default:!0};return(e.complete||!t?o.Deferred.Pledge(pt()):(n.referrer="options.settings",o.Deferred.Pledge())).done(e=>{n.items=e,r.resolve([n])}).fail(r.reject),r.promise()}}};return G.logger.debug("tree: loading",e,t),n(e,!0)()},level:e=>e.replace(/\.$/,"").split(".").length},ft=e=>{const t={},r=null==e||null==e?gt.list():gt.listByTabId(e);for(const e in r){if(!r.hasOwnProperty(e))continue;const n=r[e]
;(t[n.uuid]=t[n.uuid]||[]).push({name:n.name,uuid:n.uuid,id:n.menuId,accessKey:n.accessKey,image:"menu_cmd",menucmd:!0})}return t},ht=(e,t)=>{const r=[];t=t||{};const n=Object(ie.createScript)();return["author","copyright"].forEach(e=>{n[e]=!1}),Object.keys(e).forEach(s=>{const o=e[s];let a;if(t.options_page){a={};const e=["textContent","requires","resources"];Object.keys(n).forEach(t=>{e.includes(t)||(Object(A.toType)(n[t]),a[t]=o[t])}),t.referrer?(a.referrer=t.referrer,
a.length=o.textContent.length):a.code=o.textContent,["requires","resources"].forEach(e=>{a[e]=o[e].map(r=>{const n=r.url||T.default.sanitize(r.unsafe_url,r.abs_url),s=et.getElement(o.uuid,n);let a,i,A,l,c=0,u=null,d=null;return s&&s.data&&(s.data.content&&(l=s.data.content,c=l.length),d=s.data.sri,u=s.ts,a=s.modified,A=s.data.meta||"text/plain",i="requires"==e||/text\/.*|application\/(?:x-)?(?:java|ecma)script/.test(A)),{display_url:r.url||r.unsafe_url,abs_url:r.abs_url,unsafe_url:r.unsafe_url,
url:n,data:{length:c,content:t.externals?l:void 0},sri:d,ts:u,mimetype:A,editable:i,modified:a}})}),a.origin=ot.determineOrigin(o),a.contexter=ot.isContexter(o),a.temp_connects=$e.getSessionConnects(o.uuid);const r=at.getStorageByUid(o.uuid);a.storage_key_count=Object.keys(r.data).length,a.remote_url=Ye.getSyncRemoteUrl(o),a.deleted=o.deleted,a.lastUpdated=o.lastUpdated}else{const e=ot.determineOrigin(o),r=t.active_urls||{},n=t.active_counts||{},s=t.all_time_active_counts||{};a={name:o.name,
name_i18n:o.name_i18n,uuid:o.uuid,system:o.system,support:!!o.supportURL||e&&!!e.issue_url,abuse:e&&!!e.abuse_url,active_urls:r[o.uuid],active_count:n[o.uuid],all_time_active_count:s[o.uuid],referrer:t.referrer,contexter:ot.isContexter(o),enabled:o.enabled,position:o.position,deleted:o.deleted}}
o.evilness&&(o.evilness==ze.SEVERITY_FOISTED_SCRIPT?a.foisted=M.I18N.getMessage("The_origin_of_this_script_cant_be_determined_"):o.evilness>=Math.min(ze.SEVERITY_MAX,We.values.script_blacklist_severity)&&(a.blacklisted=M.I18N.getMessage("This_script_is_blacklisted_"))),o.evilness&&(a.warnings=ze.getWarningsFor(ot.determineSourceURL(o))),a.file_url=o.downloadURL||o.fileURL,a.positionof=e.length,a.userscript=!0,o.icon64||o.icon||(a.icon64=x.a.images.origin("unknown")),
o.options&&Object.keys(n.options).forEach(e=>{a[e]=o.options[e]}),r.push(a)}),r},Rt={run:function(e,t){let r=1;const n=()=>{0==--r&&(t&&t(),rea.page.reload())};if("config"==e){const e=c.a.listValues();Object.keys(e).forEach(t=>{const s=e[t];-1==s.indexOf(Ne.CONSTANTS.PREFIX.SCRIPT)&&-1==s.indexOf(Ne.CONSTANTS.PREFIX.COND)&&-1==s.indexOf(Ne.CONSTANTS.PREFIX.STORE)&&-1==s.indexOf(Ne.CONSTANTS.PREFIX.META)&&(r++,c.a.deleteValue(s).always(n))})}else"factory"==e&&(r++,ne.remove_permission().done(n),
r++,c.a.factoryReset().always(n));n()},reset:function(e){Rt.run(null,e)},factoryReset:function(e){Rt.run("factory",e)},configReset:function(e){Rt.run("config",e)}},vt=(()=>{const e=()=>{rea.runtime.lastError&&rea.runtime.lastError},t={init:function(){t.setIcon();let e=We.values.appearance_badge_color||"#ee3131";"#"!==e[0]&&(e="#"+e),rea.browserAction.setBadgeBackgroundColor({color:e}),e=We.values.appearance_badge_text_color||"#ffffff","#"!==e[0]&&(e="#"+e),rea.browserAction.setBadgeTextColor({
color:e})},setIcon:t=>{let r,n,s,o=null,a=!1,i=!1;void 0===t||Qe.get.empty(t)||(a=Qe.get.blocker(t),i=Qe.get.forbidden(t)),i?(s="_forbidden",o=M.I18N.getMessage("At_least_one_part_of_this_page_is_listed_at_the_forbidden_pages_setting_")):a?(s="_blocker",o=M.I18N.getMessage("Some_scripts_might_be_blocked_by_the_javascript_settings_for_this_page_or_a_script_blocker_")):s=We.values.enabled&&void 0!==t?"":"_grey",G.logger.debug("badge: set icon "+s),r={
path:rea.extension.getURL("images/icon"+s+".png")},n={title:o||rea.extension.manifest.name},null!=t&&(r.tabId=t,n.tabId=t);try{rea.browserAction.setIcon(r,e),rea.browserAction.setTitle(n)}catch(e){G.logger.warn("bg: ERROR while setIcon! "+e.message)}},setBadge:e=>{let t=""
;if("off"==We.values.appearance_badges?t="":"running"==We.values.appearance_badges?e&&!Qe.get.empty(e)&&(t=Qe.get.stats(e).running||""):"running_unique"==We.values.appearance_badges&&e&&!Qe.get.empty(e)&&(t=Qe.get.stats(e,!0).unique||""),We.values.userscript_search_url&&"badge"==We.values.userscript_search_mode){let r=Qe.get.stats(e).searched;r>0&&(t>999?r="":(t>99||`${t}+${r}`.length>4)&&(r="+"),t=`${t}+${r}`)}G.logger.debug("badge: set "+t),rea.browserAction.setBadgeText({text:t.toString(),
tabId:e})}};return t})(),bt=(()=>{const e=12096e5;let t=null;const r={init:function(){let n;t=c.a.getValue(Ne.CONSTANTS.STORAGE.BEGGING,null);const s=Date.now();t?(n=c.a.getValue(Ne.CONSTANTS.STORAGE.LAST_START,0))&&s-n>e&&(t.later={type:"after_pause",ts:s},r.save()):(t={first_run:{type:"from_init",ts:s}},r.save())},save:function(){c.a.setValue(Ne.CONSTANTS.STORAGE.BEGGING,t)},needed:function(){
const r=Date.now(),n=!t.first_run||t.first_run.ts+e<r,s=!t.hide,o=!t.contributed,a=!t.later||t.later.ts+e<r;if(!Ne.RUNTIME.SAFARI&&!Ne.RUNTIME.DOLPHIN&&n&&s&&o&&a)return t.later?"l":"i"},clicked:function(e,t,r){i.a.tG("clicked",e,t+r)},dialog:{shown:function(e){const n=Date.now();t.dialog={ts:n,extra:e},r.save(),i.a.tG("dialog")}},button:(()=>{const e={};return["contributed","later","hide"].forEach(n=>{e[n]=(e,s)=>{const o=Date.now();t[n]={ts:o,type:e,extra:s},r.save(),i.a.tG("button",n)}}),e
})()};return r})(),wt=(()=>{const e={},t={},r=("TM_"+Object(A.createUUID)().substr(0,5)).toLowerCase(),n=["content-security-policy","x-content-security-policy","x-webkit-csp"],s="feature-policy",o=rea.webRequest.extraHeaderNeeded,a=[],i=e=>{const t=e.split(",").map(e=>{let t,r,n,s,o;const a=e.split(";");let i,A;return a.forEach((e,t)=>{0===e.search(/^\s*script-src /)?r=t:0===e.search(/^\s*default-src /)?n=t:0===e.search(/^\s*img-src /)&&(s=t)}),void 0!==n&&void 0===r&&(t=!0,
a.push(a[n].replace(/default-src /,"script-src ")),r=a.length-1),void 0!==n&&void 0===s&&(t=!0,a.push(a[n].replace(/default-src /,"img-src ")),s=a.length-1),void 0!==s&&(A=!1,i=a[s],-1==i.search(/'data:'/)&&(A=!0,i=i.replace(/img-src /,"img-src data: ")),-1!=i.search(/'none'/)&&(A=!0,i=i.replace(/ 'none'/,"")),A&&(a[s]=i,t=!0)),void 0!==r&&(A=!1,i=a[r],-1==i.search(/'unsafe-eval'/)&&(A=!0,i=i.replace(/script-src /,"script-src 'unsafe-eval' ")),-1!=i.search(/'none'/)&&(A=!0,
i=i.replace(/ 'none'/,"")),Ne.RUNTIME.FIREFOX&&(-1==i.search(/'unsafe-inline'/)&&(A=o=!0,i=i.replace(/script-src /,"script-src 'unsafe-inline' ")),-1==i.search(/'strict-dynamic'/)&&-1!=i.search(/ '(nonce|sha[0-9]+)-[^\']+'/)&&(A=!0,i=i.replace(/ '(nonce|sha[0-9]+)-[^\']+'/g," *"))),A&&(a[r]=i,t=!0)),void 0!==n&&(A=!1,i=a[n],o&&-1!=i.search(/ 'self'/)&&(A=!0,a[n]=i.replace(/default-src /,"default-src blob: data: ")),A&&(t=!0)),t?a.filter(e=>e).join(";"):null}).filter(e=>e).join(",")
;return""===t?null:t},l=e=>{if((e=>{let t;return Ne.RUNTIME.CHROME&&Ne.RUNTIME.BROWSER_VERSION>=63?t=e.initiator:Ne.RUNTIME.FIREFOX&&(t=e.originUrl),t&&0!==(t+"/").indexOf(rea.extension.getURL("/"))?t:null})(e))return;const n=[];let s,o,a=e.requestHeaders||[];const i={},A=new RegExp("^"+r);return a=a.filter(r=>!r.name||0!=r.name.search(A)||(o=r.name.replace(A,""),i[o.toLowerCase()]=!0,"internal"==o?t[e.requestId]=r.value:r.value&&n.push({name:o,value:Z.a.decodeS(r.value)}),void(s=!0))),s?{
requestHeaders:a.filter(e=>!e.name||!i[e.name.toLowerCase()]).concat(n)}:void 0},c=e=>{if(kt.late)if("main_frame"==e.type){if(Qe.events.reset(e.tabId,!0),e.tabId>0&&"POST"!=e.method&&"auto"==We.values.scriptUrlDetection&&Xe(e.url))return ot.installFromUrl(e.url,{},{silent_fail:!0}).fail(t=>{G.logger.info("webRequest: user script detected @ "+e.url+" was invalid",t?t.messages:""),rea.tabs.update(e.tabId,{url:e.url+"#bypass=true"},()=>{})}).done(()=>{Ne.RUNTIME.EDGE&&rea.tabs.query({
windowType:"normal"},t=>{t.forEach(t=>{t.id===e.tabId&&rea.tabs.update(t.id,{url:t.url},()=>{})})})}),Ne.RUNTIME.EDGE?{cancel:!0}:{redirectUrl:"javascript:history.back()"}}else{let t,r;if((t=Qe.get.requests(e.tabId,e.frameId))&&(r=((e,t)=>{let r={};const n=e.url;return Object.keys(t).forEach(e=>{const s=t[e];Object(A.each)(s.rules,(e,t)=>{let o,a,i;if(!(o=e.selector)||!(a=e.action))return;const A=s.id+"/"+t;if((i=Be.get(A))||(i=ot.regexify({inc:o.include,match:o.match,exc:o.exclude}),
Be.set(A,i)),ot.validUrl(n,i)){if(a.cancel)return G.logger.log("webRequest: request was canceled by script "+s.uuid,n,e,s),s.callback&&s.callback({type:"cancel",details:{rule:e,url:n}}),r={cancel:!0},!1;if(a.redirect){let t,o,i,A;a.redirect.url?t=a.redirect.url:(o=a.redirect.from)&&(i=a.redirect.to)&&(A=n.match(o,i))&&(A.shift(),t=i,A.concat(["","",""]).forEach((e,r)=>{t=t.replace("$"+(r+1),e||"")}));const l=r=>{G.logger.warn("webRequest: error while request redirect by script "+s.uuid,n,e,s),
s.callback&&s.callback({type:"redirect",message:"error",details:{description:r,rule:e,url:n,redirect_url:t}})};if(!t)return void l("unable to determine the redirect URL");t=T.default.woHash(t),qe.isAllowed(t)?ot.scriptWillRun(s.uuid,t)?(G.logger.log("webRequest: request was redirected by script "+s.uuid,n,t,e,s),s.callback&&s.callback({type:"redirect",details:{rule:e,url:n,redirect_url:t}}),
r.redirectUrl=t):l("the redirect URL needs to be included by the scripts @include or @match tag"):l("the redirect URL is filtered by the security settings")}}})}),r})(e,t)))return r}else kt.registerLateCallback(()=>{c(e)})},u=(r,o)=>{if(!kt.late)return void kt.registerLateCallback(()=>{u(r,!0)});let a,A,l,c,d=r.responseHeaders||[];if("xmlhttprequest"==r.type){let n,s;if(t[r.requestId])return Ne.XMLHTTPREQUEST.COOKIE_PASSTHROUGH||d.forEach(e=>{
e.name&&e.value&&e.name.toLowerCase().includes("set-cookie")&&(d.push({name:"tm-setcookie"+rea.runtime.short_id.toLowerCase(),value:e.value}),s=!0)}),(n=e[r.requestId])&&(d.push({name:"tm-finalurl"+rea.runtime.short_id.toLowerCase(),value:n}),s=!0),s?{responseHeaders:d}:void 0;if(!Ne.RUNTIME.FIREFOX||-1!==r.parentFrameId||-1!==r.tabId||!d.some(e=>e.name&&e.value&&"content-type"===e.name.toLowerCase()&&-1!=e.value.toLowerCase().indexOf("text/html")))return
;G.logger.log("webRequest: service worker cache request detected",r)}const g=Ne.OPTIONS.HAS_CSP&&"remove"==We.values.webrequest_fixCSP,p=g||Ne.OPTIONS.HAS_CSP&&"yes"==We.values.webrequest_fixCSP,m=p&&Ne.RUNTIME.CHROME&&Ne.RUNTIME.BROWSER_VERSION>=60;if(d.some(e=>{if(!e.name)return;const t=e.name.toLowerCase();return A|="location"==t,p&&(l|=n.includes(t)),m&&(c|=t==s),A}),A)return;let f,h;if("xmlhttprequest"==r.type){const{runners:e,contexters:t}=Pe(r.frameId,r.url);f=e.length+t.length
}else f=Qe.events.response(r.tabId,r.frameId,r.url);if(f&&(l||c)&&d.forEach((e,t)=>{if(!e.name||!e.value)return;const r=e.name.toLowerCase();if(n.includes(r)){let r;g?(a=!0,d[t]={name:e.name,value:void 0}):(r=i(e.value))&&(a=!0,Ne.RUNTIME.FIREFOX?(d[t]={name:e.name,value:void 0},e.name!==n[1]&&d.push({name:n[1],value:r})):d[t]={name:e.name,value:r})}if(r==s){let r;(r=(e=>{let t,r;const n=e.split(";");let s,o;return n.forEach((e,t)=>{0===e.search(/^\s*sync-xhr /)&&(r=t)}),void 0!==r&&(o=!1,
s=n[r],-1!=s.search(/'none'/)&&(o=!0,s=s.replace(/ 'none'/," *")),o&&(n[r]=s,t=!0)),t?n.join(";"):null})(e.value))&&(a=!0,d[t]={name:e.name,value:r})}}),Ne.RUNTIME.FAST_EXEC_SUPPORT&&["instant"].includes(We.values.runtime_inject_mode)&&(!Ne.RUNTIME.FIREFOX||r.cookieStoreId===rea.cookies.DEFAULT_STORE_ID)&&(h=Qe.events.run(r.tabId,r.frameId,null,r.url))){
const e=T.default.parse(r.url),t=e.pathname+e.search,n="TM_"+rea.runtime.short_id+Z.a.Base64.encode(t.length+t).substr(0,255).replace(/[#=\/]/g,"_")+Date.now(),s=Ve(h,r.url),o=JSON.stringify(s),i=new Blob([o],{type:"binary/octet-stream"}),A=URL.createObjectURL(i);Qe.set.objurl(r.tabId,r.frameId,A),d.push({name:"set-cookie",value:n+"="+window.encodeURIComponent(A)+"; max-age=15;"}),a=!0}
if(f&&!o&&rea.webRequest.filterResponseData&&Ne.OPTIONS.HAS_CSP&&["yes","remove"].includes(We.values.webrequest_fixCSP)&&"yes"==We.values.webrequest_fixContentCSP&&["main_frame","sub_frame"].includes(r.type)){let e;if(d.some(t=>{if(t.name&&t.value)return"content-type"==t.name.toLowerCase()&&"text/html"==t.value.split(";")[0].toLowerCase().trim()?(e=!0,!0):void 0}),e){let e=rea.webRequest.filterResponseData(r.requestId);e.ondata=t=>{const r=new TextDecoder("x-user-defined").decode(t.data,{
stream:!0}),s=new RegExp('(<head>[\\s\\S]*)(<meta[^>]+http-equiv="(?:'+n.join("|")+')"[^>]*>)([\\s\\S]*?<\\/head>)',"i");let o;const a=r.replace(s,(e,t,r,n)=>{const s=new RegExp('(content=")([^">]+)(")');return t+r.replace(s,(e,t,r,n)=>{let s;return(s=i(r||""))&&(o=!0),t+(s||r)+n})+n});o?e.write(Z.a.str2abSync(a)):e.write(t.data),e.disconnect(),e=null},e.onstop=()=>{e&&e.disconnect()}}}return a?(Ne.RUNTIME.FIREFOX&&(d=d.filter(e=>"cache-control"!=e.name.toLowerCase()),d.push({
name:"cache-control",value:"no-cache, no-store, must-revalidate"})),d=d.filter(e=>void 0!==e.value),{responseHeaders:d}):void 0},d=r=>{e[r.requestId]=r.redirectUrl,t[r.requestId]&&a.forEach(e=>e({url:r.redirectUrl}))},g=r=>{kt.late?"xmlhttprequest"==r.type?(delete t[r.requestId],delete e[r.requestId]):r.fromCache&&Qe.events.response(r.tabId,r.frameId,r.url):kt.registerLateCallback(()=>{g(r)})},p=r=>{"xmlhttprequest"==r.type?(delete t[r.requestId],
delete e[r.requestId]):Qe.events.reset(r.tabId,!0)};return{getPrefix:function(){return r},init:function(e){try{let t;t=Ne.RUNTIME.EDGE?["http://*/*","https://*/*"]:["http://*/*","https://*/*","ftp://*/*","file:///*"].concat(Ne.RUNTIME.WEBREQUEST_WEBSOCKET?["ws://*/*","wss://*/*"]:[]),e?(rea.webRequest.onBeforeRequest.addListener(c,{urls:t,types:["main_frame","sub_frame","script","xmlhttprequest"].concat(Ne.RUNTIME.WEBREQUEST_WEBSOCKET?["websocket"]:[])},["blocking"]),
rea.webRequest.onHeadersReceived.addListener(u,{urls:t,types:["main_frame","sub_frame","xmlhttprequest"]},["blocking","responseHeaders"].concat(o?["extraHeaders"]:[])),Ne.RUNTIME.WEBREQUEST_XHR_SUPPORT&&rea.webRequest.onBeforeRedirect.addListener(d,{urls:t,types:["xmlhttprequest"]},[]),rea.webRequest.onResponseStarted.addListener(g,{urls:t,types:["main_frame","sub_frame","xmlhttprequest"]},[]),rea.webRequest.onErrorOccurred.addListener(p,{urls:t,types:["main_frame","xmlhttprequest"]
})):Ne.RUNTIME.WEBREQUEST_XHR_SUPPORT&&"no"!=We.values.webrequest_modHeaders&&rea.webRequest.onBeforeSendHeaders.addListener(l,{urls:t,types:["xmlhttprequest"]},["blocking","requestHeaders"].concat(o?["extraHeaders"]:[])),rea.webRequest.handlerBehaviorChanged()}catch(e){G.logger.warn("webRequest: error initializings",e.message)}},addRedirectListener:e=>a.push(e),scripts:{set:function(e,t,r,n,s){const o=[];n.forEach(e=>{const t="string"==typeof e.selector?{include:[e.selector]}:e.selector
;["include","match","exclude"].forEach(t=>{"string"==typeof e.selector[t]&&(e.selector[t]=[e.selector[t]])});let r=e.action;if("string"==typeof r){const e=r;r={},r[e]=!0}"string"==typeof e.action.redirect&&(e.action.redirect={url:e.action.redirect}),o.push({selector:t,action:r})}),Qe.set.requests(e,t,r,{id:r+"@"+e+":"+t+"#"+Date.now(),rules:o,uuid:r,callback:s})}}}})(),kt={late:!1,callbacks:[],init:function(){},registerLateCallback:function(e){G.logger.debug("toea: register callback"),
kt.callbacks.push(e)},ensureLate:function(e){kt.late?e():kt.registerLateCallback(e)},setReady:function(){G.logger.debug("toea: run "+kt.callbacks.length+" callbacks"),kt.late=!0;for(let e=0;e<kt.callbacks.length;e++)kt.callbacks[e]();kt.callbacks=[]}};const _t=(()=>{let e=!1,t=null;const r=()=>{e||(G.logger.debug("Unloader.onbeforeunload()"),t&&t(),e=!0)};return{init:function(e){t=e,window.addEventListener("beforeunload",r,!1)}}})();var yt=(()=>{let e=null;const t={
newV:rea.extension.manifest.version,oldV:null,first_run:!1,active:!1},r=()=>{if(!kt.late)return void kt.registerLateCallback(r);let e,n="version="+t.newV+"&ext="+rea.runtime.short_id+"&updated=true";if(t.first_run?(e="https://www.tampermonkey.net/installed.php?"+n,t.active=!0):(n+="&old="+t.oldV,e="https://www.tampermonkey.net/changelog.php?"+n),
"off"==We.values.notification_showUpdate);else if("notification"==We.values.notification_showUpdate)u.Notify.showUpdate(M.I18N.getMessage("Updated_to__0version0",t.newV),M.I18N.getMessage("Click_here_to_see_the_recent_changes"),x.a.images.brand("tampermonkey"),t=>{if(t.clicked){const t={url:e};rea.tabs.create(t,()=>{})}});else if("changelog"==We.values.notification_showUpdate){t.active||(e+="&intr=true"),t.active=!0;const r={url:e,active:t.active};rea.tabs.create(r,()=>{})}},n=(()=>{
const e=Object(o.Deferred)(),t=()=>{const t=Date.now(),r=c.a.getValue(Ne.CONSTANTS.STORAGE.LAST_START,0),n=Math.round((t-r)/1e3),s=n<=Ne.MISC.DISTURBANCE_ALLOWED;G.logger.log("upd: restart?",s,"(",n,"seconds ago)"),e.resolve(s)};return kt.late?t():kt.registerLateCallback(t),e.promise()})(),s=()=>{let e=!1,s=!1;(()=>{let e,t=null;const r=Object(o.Deferred)(),n=()=>{e&&(e=null,r.resolve(!!t))};return e=window.setTimeout(n,300),rea.idle.queryState(Ne.MISC.IDLE_TIMEOUT,e=>{t="active"==e,n()}),
r.promise()})().then(e=>(s=e,n)).then(t=>{e=t}).always(()=>{t.active=!s||e,r(),i=!0})};let a=null;var i=!1;const A={scheduleNotification:function(e,r){i||(t.oldV=e,t.first_run|=r,a&&window.clearTimeout(a),a=window.setTimeout(s,1e3))},updateAvailable:function(){return e},onInstalled:function(){A.scheduleNotification(null,!0)},onUpdated:function(e){A.scheduleNotification(e,!1)},onUpdateAvailable:t=>{G.logger.info("An update to version",t.version,"is available"),e=t.version,window.setTimeout(()=>{
u.Notify.show(M.I18N.getMessage("Update"),M.I18N.getMessage("0name0_0version0_is_available__Please_re_start_your_browser_to_update_",rea.extension.manifest.name,t.version),x.a.images.brand("tampermonkey"),{timeout:6e4})},864e5)}};return kt.registerLateCallback(()=>{c.a.setValue(Ne.CONSTANTS.STORAGE.LAST_START,Date.now())}),A})();const Et=e=>{(()=>{const t=Object(o.Deferred)();return"activate"==e?(rea.browserAction.openPopup(),t.resolve()):"toggle-enable"==e?(We.values.enabled=!We.values.enabled,
t.resolve()):rea.tabs.getSelected(null,r=>{let n;"open-dashboard"==e?n=rea.extension.getURL("options.html")+"#nav=dashboard":"open-dashboard-with-running-scripts"==e?n=rea.extension.getURL("options.html")+"#nav=dashboard&filter="+encodeURIComponent(r.url):"open-new-script"==e&&(n=rea.extension.getURL("options.html")+"#url="+Z.a.Base64.encode(r.url)+"&nav=new-user-script"),t.resolve(n?{url:n,active:!0,parent:r}:null)}),t.promise()})().then(e=>{e&&rea.tabs.create(e)})};var It=(()=>{const e={}
;let t;const r=({tabId:t,frameId:r,url:n})=>{const s=e[t];s&&s.forEach(e=>{e({tabId:t,frameId:r,url:n})})};return{addListener:(n,s)=>{e[n]=e[n]||[],e[n].push(s),!t&&Object.keys(e).length&&(rea.webNavigation.supported&&rea.webNavigation.onUrlUpdated&&rea.webNavigation.onUrlUpdated.addListener(r),t=!0)},removeListener:(t,r)=>{let n;const s=e[t];s&&(n=s.indexOf(r))>-1&&s.splice(n,1),0===s.length&&delete e[t]},removeListeners:t=>{delete e[t]}}})(),xt=(()=>{const e=[],t=e=>{
kt.late?Qe.events.active(e.tabId,e.windowId):window.setTimeout(()=>{t(e)},100)},r=(t,n,s)=>{if(!kt.late)return void window.setTimeout(()=>{r(t,n,s)},100);const o=s.pendingUrl||s.url;"auto"==We.values.scriptUrlDetection&&Xe(o)&&ot.installFromUrl(o,{},{silent_fail:!0}),o?"loading"==n.status?Qe.events.loading(s.id,0,o):"complete"==n.status&&Qe.events.complete(s.id,0,o):G.logger.warn("tabUpdates: no tab url set! ",s),e.forEach(e=>{e({reason:"updated",status:n.status},s)})},n=t=>{
je[t]&&(je[t].onClose(),delete je[t]),Qe.events.remove(t),e.forEach(e=>{e({reason:"removed"},{id:t})})},s=(t,r)=>{n(r),vt.setIcon(t),vt.setBadge(t),e.forEach(e=>{e({reason:"replaced"},t)})},o=t=>{kt.late?(Qe.events.commited(t.tabId,t.frameId,t.url),0===t.frameId&&e.forEach(e=>{e({reason:"commited"},{url:t.url,id:t.tabId})})):window.setTimeout(()=>{o(t)},100)},a={init:function(){rea.tabs.onUpdated.addListener(r),rea.tabs.onRemoved.addListener(n),rea.tabs.onReplaced.addListener(s),
rea.tabs.onActivated.addListener(t),rea.webNavigation.supported&&rea.webNavigation.onCommitted.addListener(o)},openAndWatch:function(e,t){let r=null;const n=(e,s)=>{null!==r&&s.id===r&&(["updated","commited"].includes(e.reason)?t(s):"removed"==e.reason&&(a.removeListener(n),t()))};return rea.tabs.create(e,e=>{r=e.id,t(e)}),a.addListener(n),{cancel:function(){a.removeListener(n),null!==r&&rea.tabs.remove(r,()=>{const e=rea.runtime.lastError;e?G.logger.warn("tab.close",e.message):r=null})}}},
addListener:function(t){e.push(t)},removeListener:function(t){let r;e&&(r=e.indexOf(t))>-1&&e.splice(r,1)}};return a})(),Tt=()=>{const e="temporary"==We.values.incognito_mode&&rea.extension.inIncognitoContext;c.a.setTemporary(e),e&&(We.values.sync_enabled=!1,We.values.scriptUpdateCheckPeriod=0,We.values.sync_type=0,We.values.statistics_enabled=!1)};const Mt=(()=>{const e="tm_content",t=async()=>{["instant"].includes(We.values.runtime_inject_mode)?await(async()=>{await new s.a(e=>{
rea.declarativeContent.onPageChanged.removeRules(void 0,e)})})():await(async()=>{await new s.a(t=>{rea.declarativeContent.onPageChanged.getRules([e],async r=>{if(r.length)return t();rea.declarativeContent.onPageChanged.addRules([{id:e,conditions:[new rea.declarativeContent.PageStateMatcher({pageUrl:{urlContains:"://"}})],actions:[new rea.declarativeContent.RequestContentScript({js:rea.extension.manifest.content_scripts[0].js})]}],t)})})})()};return{init:()=>{
rea.declarativeContent.supported&&(t(),We.addChangeListener("runtime_inject_mode",t))}}})();let St;(window.init=async()=>{M.I18N.init(),kt.init(),wt.init(!0),xt.init(),St=Object(Ae.a)(xt),ut.init(),rea.commands.supported&&rea.commands.onCommand.addListener(Et),rea.runtime.setUninstallURL("https://www.tampermonkey.net/uninstall.php?ext="+rea.runtime.short_id),_t.init(()=>{Ye.finalize()}),Object(ie.init)(ae),rea.browserAction.setIcon({path:rea.extension.getURL("images/icon_grey.png")}),
rea.browserAction.setPopup({popup:"action.html"}),rea.browserAction.setTitle({title:"Tampermonkey"}),rea.runtime.onUpdateAvailable.addListener(yt.onUpdateAvailable),rea.runtime.onInstalled.addListener(e=>{G.logger.log("bg: onInstalled",e),e||(e={reason:"mandatory_argument_is_not_set"}),"install"==e.reason?lt():"update"==e.reason&&ct(e.previousVersion),kt.ensureLate(()=>{"install"==e.reason?yt.onInstalled():"update"==e.reason&&yt.onUpdated(e.previousVersion)})}),await c.a.init(),await Le(),
await it(),await We.init(),window.cfgo=We,Tt(),(()=>{if(G.logger.set(We.values.logLevel),M.I18N.setLocale(We.values.i18n),We.values.userscript_search_url){const e=()=>{Te(Je,{url:["dhdg","gcal","fire","iikm","mfdh"].includes(rea.runtime.short_id)?Oe:We.values.userscript_search_url,mode:We.values.userscript_search_mode})};We.addChangeListener("userscript_search_mode",e),e()}const e=Ne.RUNTIME.WEBREQUEST_XHR_SUPPORT&&"no"!=We.values.webrequest_modHeaders;N.default.setConfig({
prefix:e?wt.getPrefix():null,mozAnon:Ne.RUNTIME.FIREFOX}),Je.init(),i.a.init("bg",We.values.statistics_enabled,{trackView:!0,version:rea.extension.manifest.version,started:Ze}),Qe.listeners.add.onReset((e,t)=>{gt.clearByTabId(e),at.removeStorageListeners({tabid:e},!1),t||vt.setIcon(e)});const t=e=>{e>=0&&rea.tabs.get(e,t=>{!rea.runtime.lastError&&t&&(vt.setIcon(e),vt.setBadge(e))})};Qe.listeners.add.onCommited(t),Qe.listeners.add.onCompleted(t),Qe.listeners.add.onReset($e.purgeAppeals),
Qe.listeners.add.onRemoved($e.purgeAppeals),Qe.listeners.add.onRemoved(He.cleanTab),Ye.init().done(e=>{e&&Ye.sync()}),qe.init(),ze.init(),at.init();const r=()=>{ne.set_mode(We.values.downloads_mode),ne.set_whitelist(We.values.downloads_extension_whitelist)};r(),ne.config_changed_listener=r,S.SRI.init(),wt.init(),ve.init({onclick:({id:e,frameId:t,tabId:r,url:n,isMenuCommand:s})=>{if(s){const t=gt.getById(e);t?t.response({run:!0,menuId:t.menuId
}):G.logger.warn("bg: Error: unable to find MC id "+t.menuId)}else{const s=at.getByUid(e);if(!s||!s.script)return void G.logger.log("ctxm: unable to find script "+e);const a=s.script;if(a.deleted)return;tt.bundle({url:n||"<unknown>"},a,!0).then(e=>{const s=Object(o.Deferred)(),a={};return e.method="executeScript",void 0!==t?e.frameId=a.frameId=t:n?e.url=T.default.woHash(n):e.topframe=!0,rea.tabs.sendMessage(r,e,a,s.resolve),s.promise()})}}}),bt.init(),st.init()})(),
We.addChangeListener(["sync_enabled","sync_type","cloud_url","cloud_user","cloud_pass"],Ye.configChangeListener),We.addChangeListener("logLevel",()=>{G.logger.set(We.values.logLevel)}),We.addChangeListener("i18n",()=>{M.I18N.setLocale(We.values.i18n)}),We.addChangeListener("incognito_mode",()=>{Tt()}),We.addChangeListener("statistics_enabled",()=>{i.a.setEnabled(We.values.statistics_enabled,!0)}),We.addChangeListener("context_menu_enabled",()=>{We.values.context_menu_enabled||ve.update({
contexters:[],commands:[]})}),We.addChangeListener(["require_blacklist","script_blacklist_server","script_blacklist_type"],ot.blackCheckAll),We.addChangeListener(["downloads_extension_whitelist","downloads_mode"],ne.config_changed_listener),We.addChangeListener("webrequest_modHeaders",(e,t,r,n)=>{n.done(window.setTimeout(Rt.reset,1))}),We.addChangeListener(["appearance_badge_color","appearance_badge_text_color"],vt.init),vt.init(),Mt.init(),window.setTimeout(()=>{st.check(),ot.clean()},1e4),
await At(),G.logger.log("bg: listeners registered!"),kt.setReady()})()}]);