Syntax_min

Library for simplifying code logic and syntax

Questo script non dovrebbe essere installato direttamente. È una libreria per altri script da includere con la chiave // @require https://update.greasyfork.org/scripts/495339/1711626/Syntax_min.js

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Syntax
// @version      2025.12.11
// @author       Canaan HS
// @description  Library for simplifying code logic and syntax
// @namespace    https://greasyfork.org/users/989635
// @match        *://*/*
// @license      MPL-2.0
// ==/UserScript==
const Lib=(()=>{function y(a=document,b,c){if(1!==a?.nodeType&&9!==a?.nodeType)return c?[]:void 0;const e=b[0],d=b.slice(1);if(/[ .#:[\]>+~*,()^$=]/.test(d))return c?a.querySelectorAll(b):a.querySelector(b);if(!c&&"#"===e)return 9===a.nodeType?a.getElementById(d):a.querySelector(b);if("."===b[0])return a=a.getElementsByClassName(d),c?[...a]:a[0];a=a.getElementsByTagName(b);return c?[...a]:a[0]}async function W(a,b,c=crypto.randomUUID(),e=!0){let d=E.get(c);if(e||!d)d||(d=document.createElement(a),
d.id=c,(a=I.head)?a.appendChild(d):X("head").then(g=>{g.appendChild(d)})),d.textContent+=b,E.set(c,d)}async function X(a,b,c={}){const e=Array.isArray(a)?Y.queryMap:Y.queryElement,{raf:d=!1,all:g=!1,timeout:l=8,throttle:h=0,debounce:n=50,visibility:f=!0,subtree:m=!0,childList:k=!0,attributes:r=!0,characterData:p=!1,timeoutResult:q=!1,root:w=document}=c||{};return new Promise((t,u)=>{const v=async function(){let z,x;if(d){let D;const J=()=>{(x=e(a,g))?(cancelAnimationFrame(D),clearTimeout(z),b?.(x),
t(x)):D=requestAnimationFrame(J)};D=requestAnimationFrame(J);z=setTimeout(()=>{cancelAnimationFrame(D);q&&(b?.(x),t(x))},1E3*l)}else{const [D,J]=0<h?[K,h]:[L,n],M=new MutationObserver(D(()=>{if(x=e(a,g))M.disconnect(),clearTimeout(z),b?.(x),t(x)},J));M.observe(w,{subtree:m,childList:k,attributes:r,characterData:p});z=setTimeout(()=>{M.disconnect();q&&(b?.(x),t(x))},1E3*l)}};f&&"hidden"===document.visibilityState?document.addEventListener("visibilitychange",()=>v(),{once:!0}):v()})}function Z(a){if(!a||
!a.trim())return 0;if(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(a)){var b=(new Date(a)).getTime();if(!isNaN(b))return Math.floor(b/1E3)}b=new Date;var c=[...a.matchAll(/(\d+)\s*([YyMDdhms])/g)];if(0===c.length)return 0;var e=a=0,d=0,g=0,l=0,h=0;for(const n of c){c=parseInt(n[1],10);const f=n[2];switch(f.toLowerCase()){case "y":a+=c;break;case "d":d+=c;break;case "h":g+=c;break;case "s":h+=c;break;default:"M"===f?e+=c:"m"===f&&(l+=c)}}b.setFullYear(b.getFullYear()+a);b.setMonth(b.getMonth()+e);
b.setDate(b.getDate()+d);b.setHours(b.getHours()+g);b.setMinutes(b.getMinutes()+l);b.setSeconds(b.getSeconds()+h);return Math.floor(b.getTime()/1E3)}function N(a,b,c,{space:e=0,expireStr:d}={}){const g=A(c);c={type:g,data:aa[g]?.(c)??c};(d=Z(d))&&(c.expire=d);a(b,JSON.stringify(c,null,e))}function O(a,b,c,{autoRemove:e=!1,removeer:d}={}){a=a(b);if(null==a)return c;try{a=JSON.parse(a);const g=a instanceof Object;if(g&&a.expire&&Date.now()>1E3*a.expire)return d(b),c;let l,h;g?(l=a.type??"Object",h=
a.data??a):(l=A(a),h=a);const n=ba[l]?.(h)??h;e&&d(b);return n}catch{return"object"===typeof a&&I.isEmpty(a)||"string"===typeof a&&a.startsWith("[object")?c:a}}function K(a,b){let c=0;return(...e)=>{const d=Date.now();d-c>=b&&(c=d,a(...e))}}function L(a,b){let c;return(...e)=>{clearTimeout(c);c=setTimeout(function(){a(...e)},b)}}function P(a){a=new Blob([a],{type:"application/javascript"});const b=URL.createObjectURL(a),c=new Worker(b),e=c.terminate;c.terminate=function(){e.call(c);URL.revokeObjectURL(b)};
return c}function Q(a,b="https://cdnjs.cloudflare.com/ajax/libs/pako/2.1.0/pako.min.js"){function c(f){return new Promise((m,k)=>{const r=new Blob([f],{type:"application/octet-stream"}),p=new FileReader;p.onload=function(q){q=q.target.result;q=q.substring(q.indexOf(",")+1);m(q)};p.onerror=function(q){k(q)};p.readAsDataURL(r)})}function e(f,m,k){return new Promise(r=>{const p=h++;n.set(p,r);d.postMessage({type:f,data:m,level:k,requestId:p},[m.buffer])})}let d=P(`${a||`importScripts('${b}')`}onmessage = function(e) {const { type, data, level, requestId } = e.data;const bytes = type === "compress" ? pako.deflate(data, { level }) : pako.inflate(data);postMessage({ data: bytes, requestId }, [bytes.buffer]);}`);
const g=new TextEncoder,l=new TextDecoder;let h=0;const n=new Map;d.onmessage=f=>{const {requestId:m,data:k}=f.data;n.has(m)&&(n.get(m)(k),n.delete(m))};return{async destroyWorker(){d&&(d.terminate(),d=null)},async compress(f,{level:m=5,base64:k=!0,stringify:r=!0}={}){if(null==f)return f;f=await e("compress",g.encode(r?JSON.stringify(f):f),m);return k?await c(f):f},async decompress(f,m=!0){if(null==f)return f;if(!(f instanceof Uint8Array)){f=atob(f);const k=f.length,r=new Uint8Array(k);
for(let p=0;p<k;p++)r[p]=f.charCodeAt(p);f=r}f=await e("decompress",f);f=l.decode(f);return m?JSON.parse(f):f}}}function ca(a){if(null==a){for(const b of H)GM_unregisterMenuCommand(b);H.clear()}else Array.isArray(a)?a.forEach(b=>{H.delete(b)&&GM_unregisterMenuCommand(b)}):H.delete(a)&&GM_unregisterMenuCommand(a)}const ia=new DOMParser,A=a=>Object.prototype.toString.call(a).slice(8,-1);[Document.prototype,Element.prototype].forEach(a=>{a.$q=function(b){return y(this,b,!1)};a.$qa=function(b){return y(this,
b,!0)}});let B=null;const R=()=>window.trustedTypes?.getPolicy?.("default")??window.trustedTypes?.createPolicy?.(Symbol("myPolicy").toString(),{createHTML:a=>a}),S={$text(a){return null==a?this?.textContent?.trim():this.textContent=a?.trim()??""},$copy(a=!0){return this.cloneNode(a)},$iHtml(a){return null==a?this.innerHTML:this.innerHTML=a},$safeiHtml(a){if(null==a)return this.innerHTML;try{B??=R(),B?this.appendChild(document.createRange().createContextualFragment(B.createHTML(a))):this.innerHTML=
a}catch(b){console.error(b)}},$oHtml(a){return null==a?this.outerHTML:this.outerHTML=a},$iAdjacent(a,b="beforeend"){null!=a&&(1===a.nodeType?this.insertAdjacentElement(b,a):this.insertAdjacentHTML(b,a))},$safeiAdjacent(a,b="beforeend"){if(null!=a){if(1===a.nodeType)return this.insertAdjacentElement(b,a);try{B??=R(),B?this.insertAdjacentHTML(b,B.createHTML(a)):this.insertAdjacentHTML(b,a)}catch(c){console.error(c)}}},$safeiBefore(a,b="beforeend"){if(null!=a)try{B??=R();if(!B)throw Error("Policy not found");
const c=document.createRange().createContextualFragment(B.createHTML(a));switch(b){case "beforebegin":this.parentNode?.insertBefore(c,this);break;case "afterbegin":this.insertBefore(c,this.firstChild);break;case "beforeend":this.appendChild(c);break;case "afterend":this.parentNode?.insertBefore(c,this.nextSibling)}}catch(c){console.error(c)}},$sAttr(a,b){this.setAttribute(a,b)},$dAttr(a){this.removeAttribute(a)},$gAttr(a){return this.getAttribute(a)},$hAttr(a){return this.hasAttribute(a)},$addClass(...a){this.classList.add(...a)},
$delClass(...a){this.classList.remove(...a)},$toggleClass(a,b){this.classList.toggle(a,b)},$replaceClass(a,b){this.classList.replace(a,b)},$hasClass(a){return this.classList.contains(a)}};Object.assign(Node.prototype,S);const da=Object.keys(S)[0];Object.defineProperty(Object.prototype,da,{value:function(a=null){return S[da].call(this,a)},writable:!0,configurable:!0});const I={$q:document.$q.bind(document),$Q:(a,b)=>y(a,b,!1),$qa:document.$qa.bind(document),$Qa:(a,b)=>y(a,b,!0),html:document.documentElement,
get head(){const a=document.head;a&&Object.defineProperty(this,"head",{value:a,writable:!1});return a},get body(){const a=document.body;a&&Object.defineProperty(this,"body",{value:a,writable:!1});return a},img:document.images,link:document.links,script:document.scripts,style:document.styleSheets,$url:location.href,get url(){return location.href},$origin:location.origin,get origin(){return location.origin},$domain:location.hostname,get domain(){return location.hostname},$lang:navigator.language,get lang(){return navigator.language},
$agen:navigator.userAgent,get agen(){return navigator.userAgent},isEmpty(a){for(const b in a)return!1;return!0},createDomFragment:a=>document.createRange().createContextualFragment(a),get createFragment(){return document.createDocumentFragment()},title:a=>null==a?document.title:document.title=a,cookie:a=>null==a?document.cookie:document.cookie=a,createUrl:a=>URL.createObjectURL(a),_on:(a,b)=>{const c={};for(const e of Object.keys(b)){let d=b[e];d&&("function"===typeof d&&(d={listen:d}),d.listen&&
(a.addEventListener(e,d.listen,d.add),c[e]=()=>a.removeEventListener(e,d.listen,d.add)))}return c},createElement(a,b,c,e){const [d,g,l={},h="beforeend"]="string"===typeof a?[void 0,a,b,c]:[a,b,c,e];if(g){var {class:n,text:f,html:m,rows:k,cols:r,on:p={},style:q={},attr:w={},...t}=l;a=document.createElement(g);n&&(a.className=n);f&&(a.textContent=f);m&&a.$safeiHtml(m);null!=k&&(a.rowSpan=k);null!=r&&(a.colSpan=r);Object.assign(a,t);"string"===typeof q?a.style.cssText=q:Object.assign(a.style,q);for(const v in w)a.setAttribute(v,
w[v]);var u="object"!==typeof p||this.isEmpty(p)?{}:this._on(a,p);Object.assign(a,{on(v,z,x){this.addEventListener(v,z,x);Object.assign(u,{[v]:()=>this.removeEventListener(v,z,x)})},off(v){u[v]?.();delete u[v]},offAll(){Object.keys(u).forEach(v=>{u[v]();delete u[v]})}});return 1===d?.nodeType?d.insertAdjacentElement(h,a):a}}},C=new Map,T={log:(...a)=>console.log(...a),warn:(...a)=>console.warn(...a),table:(...a)=>console.table(...a),trace:(...a)=>console.trace(...a),debug:(...a)=>console.debug(...a),
error:(...a)=>console.error(...a),count:a=>console.count(a)},E=new Map,U=new Map,Y={queryMap:(a,b)=>{a=a.map(c=>y(document,c,b));return b?a.every(c=>0<c.length)&&a:a.every(Boolean)&&a},queryElement:(a,b)=>{a=y(document,a,b);return(b?0<a.length:a)&&a}},ba={Set:a=>new Set(a),Map:a=>new Map(a),Date:a=>new Date(a)},aa={Set:a=>a instanceof Set?[...a]:a,Map:a=>a instanceof Map?[...a]:a,Date:a=>a instanceof Date?a.toISOString():a},ea=localStorage.removeItem.bind(localStorage),ja=localStorage.setItem.bind(localStorage),
ka=localStorage.getItem.bind(localStorage),fa=sessionStorage.removeItem.bind(sessionStorage),la=sessionStorage.setItem.bind(sessionStorage),ma=sessionStorage.getItem.bind(sessionStorage);let F;const ha={process:(a,b,c)=>{a=a[b.toLowerCase()];return"Function"===A(a)?a(c):a?a:"None"}},V={ko:"Korea","ko-KR":"Korea",ja:"Japan","ja-JP":"Japan",ru:"Russia","ru-RU":"Russia",en:"English","en-US":"English","en-GB":"English","en-AU":"English","en-CA":"English","en-NZ":"English","en-IE":"English","en-ZA":"English",
"en-IN":"English",zh:"Simplified","zh-CN":"Simplified","zh-SG":"Simplified","zh-MY":"Simplified","zh-TW":"Traditional","zh-HK":"Traditional","zh-MO":"Traditional"},H=new Set,G=new Map;return function(...a){const b={};for(const c of a)c&&Object.defineProperties(b,Object.getOwnPropertyDescriptors(c));return b}({get sX(){return window.scrollX},get sY(){return window.scrollY},get iW(){return window.innerWidth},get iH(){return window.innerHeight},get platform(){const a={desktop:!1,mobile:!1};window.matchMedia?.("(pointer: coarse)")?.matches||
window.matchMedia?.("(hover: none)")?.matches?a.mobile=!0:/Android|iPhone|iPad|iPod|webOS|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?a.mobile=!0:a.desktop=!0;Object.defineProperty(this,"platform",{value:a,writable:!1});return a}},I,{addStyle:(a,b,c)=>W("style",a,b,c),addScript:(a,b,c)=>W("script",a,b,c),delLocal:a=>ea(a),setLocal:(a,b,c)=>N(ja,a,b,{expireStr:c}),getLocal:(a,b,c)=>O(ka,a,b,{autoRemove:c,removeer:ea}),delSession:a=>fa(a),setSession:(a,b,c)=>N(la,a,b,{expireStr:c}),getSession:(a,
b,c)=>O(ma,a,b,{autoRemove:c,removeer:fa}),delV:a=>GM_deleteValue(a),allV:()=>GM_listValues()||void 0,setV:(a,b)=>GM_setValue(a,b),getV:(a,b)=>GM_getValue(a,b)||void 0,setJV:(a,b,{space:c,expireStr:e}={})=>N(GM_setValue,a,b,{space:c,expireStr:e}),getJV:(a,b,c)=>O(GM_getValue,a,b,{autoRemove:c,removeer:GM_deleteValue}),eventRecord:C,addRecord:E,observerRecord:U,type:A,onE:async function(a,b,c,e={},d){try{"string"===typeof a&&(a=y(document,a));let g=b.split(/\s*[,|/]\s*/).filter(Boolean);if(0===g.length)throw Error("No event types provided");
if(1===g.length)a.addEventListener(b,c,e);else{let l;const h=n=>{clearTimeout(l);l=setTimeout(()=>c(n),15)};g.forEach(n=>a.addEventListener(n,h,e))}d?.(!0)}catch{d?.(!1)}},onEvent:async function(a,b,c,e={}){const {mark:d,...g}=e;"string"===typeof a&&(a=y(document,a));e=d??a;const l=C.get(e);l?.has(b)||(a.addEventListener(b,c,g),l||C.set(e,new Map),C.get(e).set(b,{element:a,type:b,listener:c}))},offEvent:async function(a,b,c){if(null==a&&null==b&&null==c){for(const e of C.values())for(const {element:d,
type:g,listener:l}of e.values())d.removeEventListener(g,l);C.clear()}else if(a=c??"string"===typeof a?y(document,a):a,c=C.get(a))if(b=c.get(b)){const {element:e,type:d,listener:g}=b;e.removeEventListener(d,g);C.get(a).delete(d)}else{for(const {element:e,type:d,listener:g}of c.values())e.removeEventListener(d,g);C.delete(a)}},onUrlChange:function(a,b=15){function c(m){clearTimeout(d);l||"urlchange"!==m||(l=!0);d=setTimeout(()=>{l&&e(!1,!0);a({type:m,url:location.href,domain:location.hostname})},Math.max(15,
b))}function e(m=!0,k=!1){k&&g||(clearTimeout(d),history.pushState=h,history.replaceState=n,window.removeEventListener("popstate",f.popstate),window.removeEventListener("hashchange",f.hashchange),m&&window.removeEventListener("urlchange",f.urlchange),g=!0)}let d,g=!1,l=!1;const h=history.pushState,n=history.replaceState,f={urlchange:()=>c("urlchange"),popstate:()=>c("popstate"),hashchange:()=>c("hashchange")};window.addEventListener("urlchange",f.urlchange);window.addEventListener("popstate",f.popstate);
window.addEventListener("hashchange",f.hashchange);history.pushState=function(){h.apply(this,arguments);c("pushState")};history.replaceState=function(){n.apply(this,arguments);c("replacestate")};return{off:e}},log:function(...a){if(0!==a.length){var b={},c=a,e={dev:!0,group:null,collapsed:!0};if(1<a.length){const f=a[0],m=a.at(-1),k=f?.constructor===Object,r=m?.constructor===Object;if(r&&!k)b=m,c=a.slice(0,-1);else if(k&&!r)b=f,c=a.slice(1);else if(k&&r){const p=new Set(Object.keys(e));b=Object.keys(f).filter(q=>
p.has(q)).length;Object.keys(m).filter(q=>p.has(q)).length>b?(b=m,c=a.slice(0,-1)):(b=f,c=a.slice(1))}}var {dev:d,group:g,collapsed:l}={...e,...b};if(!d||0===c.length)return new Proxy({},{get(){}});var h=f=>{"count"===f?T.count(c[0]):(f=T[f]||T.log,g?(l?console.groupCollapsed(g):console.group(g),f(...c),console.groupEnd()):f(...c))},n=setTimeout(()=>h("log",c));return new Proxy({},{get(f,m){clearTimeout(n);h(m,c)}})}},delHead:async function(a){if(null==a){for(var b of E.values())b.remove();E.clear()}else if(b=
E.get(a))b.remove(),E.delete(a)},observer:async function(a,b,c={},e){const {mark:d="",debounce:g=0,throttle:l=100,subtree:h=!0,childList:n=!0,attributes:f=!0,characterData:m=!1}=c||{};if(d&&(c=U.get(d))){if(c.target===a)return;c.ob.disconnect()}const [k,r]=0<g?[L,g]:[K,l];c={subtree:h,childList:n,attributes:f,characterData:m};const p=new MutationObserver(k((q,w)=>{b(q,w)},r));p.observe(a,c);d&&U.set(d,{target:a,ob:p});e?.({ob:p,op:c})},waitEl:X,openDB:async function(a="StorageDB",b=1,c){return new Promise((e,
d)=>{const g=indexedDB.open(a,b),l=a.replace(/db$/i,"").toLowerCase();g.onupgradeneeded=h=>{h=h.target.result;h.objectStoreNames.contains(l)||h.createObjectStore(l)};g.onsuccess=h=>{async function n(m){return new Promise((k,r)=>{const p=f.transaction(l,"readwrite").objectStore(l).delete(m);p.onsuccess=()=>k(p.result);p.onerror=()=>r(p.error)})}const f=h.target.result;e({set:async function(m,k,{compress:r=!0,expireStr:p}={}){const q={};r?(F??=Q(c),r=A(k),q.type=r,q.data=await F.compress(aa[r]?.(k)??
k,{base64:!1}),q.compressed=!0):q.data=k;if(k=Z(p))q.expire=k;return new Promise((w,t)=>{const u=f.transaction(l,"readwrite").objectStore(l).put(q,m);u.onsuccess=()=>w(u.result);u.onerror=()=>t(u.error)})},get:async function(m,k,r=!1){const p=f.transaction(l,"readonly").objectStore(l),q=await new Promise((w,t)=>{const u=p.get(m);u.onsuccess=()=>w(u.result);u.onerror=()=>t(k)});if(null==q)return k;try{const w=q instanceof Object;if(w&&q.expire&&Date.now()>1E3*q.expire)return n(m),k;let t;if(w){if(t=
q.data??q,q.compressed){F??=Q(c);t=await F.decompress(t);const u=q.type||A(t);t=ba[u]?.(t)??t}}else t=q;r&&n(m);return t}catch{return q}},del:n,destroy:function(){f&&(f.close(),indexedDB.deleteDatabase(a),F.destroyWorker(),setTimeout(()=>F=null,100))}})};g.onerror=()=>d(g.error)})},throttle:K,debounce:L,scopeParse:function(a,b){if("string"!==typeof a||""===a.trim())return b;const c=b.length;let e=!1;const d=new Set,g=new Set,l=(h,n,f)=>{const m=h<=n;for(;m?h<=n:h>=n;m?h++:h--)f.add(h)};for(const h of a.split(/\s*[\.,|/]\s*/))if(/^(!|-)?\d+(~\d+|-\d+)?$/.test(h)){a=
h.slice(1);const n=/^[!-]/.test(h),f=/[~-]/.test(a),[m,k]=n?[g,a]:(e=!0,[d,h]),[r,p]=f?k.split(/-|~/):[k,k];r===p?m.add(+r-1):l(+r-1,+p-1,m)}return(e?[...d]:[...b.keys()]).filter(h=>!g.has(h)&&h<c&&0<=h).sort((h,n)=>h-n).map(h=>b[h])},createWorker:P,formatTemplate:function(a,b){if("Object"!==A(a))return"Template must be an object";a=Object.fromEntries(Object.entries(a).map(([c,e])=>[c.toLowerCase(),e]));return"String"===A(b)?b.replace(/\{\s*([^}\s]+)\s*\}/g,(c,e)=>ha.process(a,e)):"Object"===A(b)?
Object.entries(b).map(([c,e])=>ha.process(a,c,e)):{"Unsupported format":b}},createZip:function(a,b="https://cdn.jsdelivr.net/npm/[email protected]/umd/index.min.js"){let c=P(`${a||`importScripts('${b}')`}onmessage = function(e) {const { filesWithOptions } = e.data;const fileNames = Object.keys(filesWithOptions);let totalSize = 0;let processedSize = 0;fileNames.forEach(name => {totalSize += filesWithOptions[name].data.length;});const chunks = [];const zip = new fflate.Zip((err, data, final) => {if (err) {postMessage({ type: "error", error: err.message });return;}chunks.push(data);if (final) {let size = 0;let offset = 0;chunks.forEach(c => size += c.length);const zipped = new Uint8Array(size);chunks.forEach(c => {zipped.set(c, offset);offset += c.length;});postMessage({ type: "done", data: zipped }, [zipped.buffer]);}});(async () => {for (const name of fileNames) {const { data, level } = filesWithOptions[name];const fileStream = new fflate.ZipPassThrough(name, { level });zip.add(fileStream);fileStream.push(data, true);processedSize += data.length;postMessage({ type: "progress", loaded: processedSize, total: totalSize });}zip.end();})().catch(err => {postMessage({ type: "error", error: err.message });});}`);
const e=new Set("mp4 mov avi mkv flv wmv webm mpg mpeg m4v ogv 3gp asf ts vob rm rmvb m2ts f4v mts zip rar 7z gz bz2 jpeg png gif webp bmp tiff tif svg eic heif raw ico psd mp3 aac flac wav ogg pdf".split(" "));let d={},g=[];return{async destroyWorker(){c&&(c.terminate(),c=null)},async file(l,h){const n=new Promise(async f=>{const m=await h.arrayBuffer();d[l]=new Uint8Array(m);f()});g.push(n);return n},async generateZip(l={},h){await Promise.all(g);return new Promise((n,f)=>{if(I.isEmpty(d))return f("Empty Data Error");
const m={};Object.entries(d).forEach(([k,r])=>{var p=k.split(".").pop().toLowerCase();p=e.has(p)?0:l.level||5;m[k]={data:r,level:p}});c.postMessage({filesWithOptions:m},Object.values(m).map(k=>k.data.buffer));c.onmessage=k=>{k=k.data;"progress"===k.type?h?.(k.loaded/k.total*100):"done"===k.type?(h?.(100),d={},g=[],n(new Blob([k.data],{type:"application/zip"}))):"error"===k.type&&(d={},g=[],f(k.error))}})}}},createStrCompress:Q,createNetworkObserver:function(a={}){function b(){var t=Date.now();if(t-
q<f)return w;q=t;if(navigator.connection){const {effectiveType:u,saveData:v}=navigator.connection;w="4g"!==u||v?"3g"===u||"4g"===u&&v?"normal":"poor":"good"}else 5<=p.length&&(t=p.reduce((u,v)=>u+v,0)/p.length,w=t<g?"good":t>l?"poor":"normal");return w}let {MAX_Delay:c=2E3,MIN_CONCURRENCY:e=1,MAX_CONCURRENCY:d=16,Good_Network_THRESHOLD:g=500,Poor_Network_THRESHOLD:l=1500,adaptiveFactors:h={good:{delayFactor:.8,threadFactor:1.2},normal:{delayFactor:1,threadFactor:1},poor:{delayFactor:1.5,threadFactor:.7}},
TIME_THRESHOLD:n=1E3,Network_Check_Interval:f=1E4,EMA_ALPHA:m=.3,ADJUSTMENT_FACTOR:k=.25,History_Size:r=10}=a||{},{responseHistory:p=[],lastNetworkCheck:q=0,networkCondition:w="normal"}={};return function(t,u,v,z=0){t=Date.now()-t;p.push(t);p.length>r&&p.shift();n=!n||1>=p.length?t:m*t+(1-m)*n;n=Math.max(20,Math.min(2E3,n));const {delayFactor:x,threadFactor:D}=h[b()];t/=n;u=Math.max(z,Math.min(u*(1+(t-1)*k*x),c));return null!=v?[Math.round(u),Math.round(Math.max(e,Math.min(v*(1-(t-1)*k*D),d)))]:Math.round(u)}},
outputTXT:async function(a,b,c){try{b="string"===typeof b?b.endsWith(".txt")?b:`${b}.txt`:`Untitled-${crypto.randomUUID().slice(9,23)}.txt`;const e=new Blob([a],{type:"text/plain"}),d=document.createElement("a");d.href=URL.createObjectURL(e);d.download=b;d.click();URL.revokeObjectURL(d.href);d.remove();c?.({State:!0})}catch(e){c?.({State:!1,Info:e})}},outputJson:async function(a,b,c){try{a="string"===typeof a?a:JSON.stringify(a,null,4);b="string"===typeof b?b.endsWith(".json")?b:`${b}.json`:`Untitled-${crypto.randomUUID().slice(9,
23)}.json`;const e=new Blob([a],{type:"application/json"}),d=document.createElement("a");d.href=URL.createObjectURL(e);d.download=b;d.click();URL.revokeObjectURL(d.href);d.remove();c?.({State:!0})}catch(e){c?.({State:!1,Info:e})}},runTime:function(a,{lable:b="Elapsed Time:",log:c=!0,format:e=!0,style:d="\u001b[1m\u001b[36m%s\u001b[0m"}={}){if(!a)return performance.now();a=e?`${((performance.now()-a)/1E3).toPrecision(3)}s`:performance.now()-a;return c?console.log(d,`${b} ${a}`):a},getDate:function(a){const b=
new Date,c={year:b.getFullYear(),month:`${b.getMonth()+1}`.padStart(2,"0"),date:`${b.getDate()}`.padStart(2,"0"),hour:`${b.getHours()}`.padStart(2,"0"),minute:`${b.getMinutes()}`.padStart(2,"0"),second:`${b.getSeconds()}`.padStart(2,"0")};return(e=>e.replace(/{([^}]+)}/g,(d,g)=>c[g]??"Error"))("string"===typeof a?a:"{year}-{month}-{date} {hour}:{minute}:{second}")},translMatcher:function(a,b=navigator.language,c="en-US"){return a[V[b]]??a[V[c]]??a[V["en-US"]]},regMenu:function(a,b={}){let {name:c=
"regMenu",index:e=1,reset:d=!1}=b||{};d&&ca();for(let [g,l]of Object.entries(a))a=`${c}-${e++}`,"function"===typeof l&&(l={func:l}),GM_registerMenuCommand(g,()=>{l.func()},{id:a,title:l.desc,autoClose:l.close,accessKey:l.hotkey}),H.add(a)},unMenu:ca,storageListen:function(a,b){a.forEach(c=>{if(!G.has(c)){const e=GM_addValueChangeListener(c,function(d,g,l,h){b({key:d,ov:g,nv:l,far:h})});G.set(c,e)}});return{off(c){const e=G.get(c);e&&(GM_removeValueChangeListener(e),G.delete(c))},offAll(){for(const c of G.values())GM_removeValueChangeListener(c);
G.clear()}}},sleep:a=>new Promise(b=>setTimeout(b,a)),domParse:a=>ia.parseFromString(a,"text/html"),nameFilter:a=>a.replace(/[\/\?<>\\:\*\|":]/g,"").trim(),getFill:a=>Math.max(2,`${a}`.length),suffixName(a,b="webp"){try{if(!a)return b;const c=new URL(a,location.href);a=/\.([^.]+)$/;return(c.pathname.match(a)?.[1]||c.search.match(a)?.[1])?.toLowerCase().trim()||b}catch{return b}},mantissa(a,b,c="0",e){return e?`${++a}`.padStart(b,c)+`.${this.suffixName(e)}`:`${++a}`.padStart(b,c)}})})();