@titaniumnetwork-dev/ultraviolet
Advanced tools
Comparing version 1.0.4-beta.5 to 1.0.4-beta.6
@@ -1,2 +0,2 @@ | ||
(()=>{"use strict";var t={939:t=>{var e,r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};e=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}t.exports=s,t.exports.once=function(t,e){return new Promise((function(r,i){function o(r){t.removeListener(e,s),i(r)}function s(){"function"==typeof t.removeListener&&t.removeListener("error",o),r([].slice.call(arguments))}v(t,e,s,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&v(t,"error",e,r)}(t,o,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var n=10;function a(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function h(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function l(t,e,r,i){var o,s,n,l;if(a(r),void 0===(s=t._events)?(s=t._events=Object.create(null),t._eventsCount=0):(void 0!==s.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),n=s[e]),void 0===n)n=s[e]=r,++t._eventsCount;else if("function"==typeof n?n=s[e]=i?[r,n]:[n,r]:i?n.unshift(r):n.push(r),(o=h(t))>0&&n.length>o&&!n.warned){n.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+n.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=n.length,l=c,console&&console.warn&&console.warn(l)}return t}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=c.bind(i);return o.listener=r,i.wrapFn=o,o}function u(t,e,r){var i=t._events;if(void 0===i)return[];var o=i[e];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(o):w(o,o.length)}function p(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function w(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}function v(t,e,r,i){if("function"==typeof t.on)i.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function o(s){i.once&&t.removeEventListener(e,o),r(s)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return n},set:function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");n=t}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},s.prototype.getMaxListeners=function(){return h(this)},s.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var o="error"===t,s=this._events;if(void 0!==s)o=o&&void 0===s.error;else if(!o)return!1;if(o){var n;if(e.length>0&&(n=e[0]),n instanceof Error)throw n;var a=new Error("Unhandled error."+(n?" ("+n.message+")":""));throw a.context=n,a}var h=s[t];if(void 0===h)return!1;if("function"==typeof h)i(h,this,e);else{var l=h.length,c=w(h,l);for(r=0;r<l;++r)i(c[r],this,e)}return!0},s.prototype.addListener=function(t,e){return l(this,t,e,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(t,e){return l(this,t,e,!0)},s.prototype.once=function(t,e){return a(e),this.on(t,d(this,t,e)),this},s.prototype.prependOnceListener=function(t,e){return a(e),this.prependListener(t,d(this,t,e)),this},s.prototype.removeListener=function(t,e){var r,i,o,s,n;if(a(e),void 0===(i=this._events))return this;if(void 0===(r=i[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(o=-1,s=r.length-1;s>=0;s--)if(r[s]===e||r[s].listener===e){n=r[s].listener,o=s;break}if(o<0)return this;0===o?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,o),1===r.length&&(i[t]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",t,n||e)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(t){var e,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var o,s=Object.keys(r);for(i=0;i<s.length;++i)"removeListener"!==(o=s[i])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(i=e.length-1;i>=0;i--)this.removeListener(t,e[i]);return this},s.prototype.listeners=function(t){return u(this,t,!0)},s.prototype.rawListeners=function(t){return u(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):p.call(t,e)},s.prototype.listenerCount=p,s.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}}},e={};function r(i){var o=e[i];if(void 0!==o)return o.exports;var s=e[i]={exports:{}};return t[i](s,s.exports,r),s.exports}(()=>{var t=r(939);const e=class{#t;#e;constructor(t={},e=null,r=null){this.#t=!1,this.#e=null,this.data=t,this.target=e,this.that=r}get intercepted(){return this.#t}get returnValue(){return this.#e}respondWith(t){this.#e=t,this.#t=!0}};const i=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.document=this.window.document,this.Document=this.window.Document||{},this.DOMParser=this.window.DOMParser||{},this.docProto=this.Document.prototype||{},this.domProto=this.DOMParser.prototype||{},this.title=t.nativeMethods.getOwnPropertyDescriptor(this.docProto,"title"),this.cookie=t.nativeMethods.getOwnPropertyDescriptor(this.docProto,"cookie"),this.referrer=t.nativeMethods.getOwnPropertyDescriptor(this.docProto,"referrer"),this.domain=t.nativeMethods.getOwnPropertyDescriptor(this.docProto,"domain"),this.documentURI=t.nativeMethods.getOwnPropertyDescriptor(this.docProto,"documentURI"),this.write=this.docProto.write,this.writeln=this.docProto.writeln,this.querySelector=this.docProto.querySelector,this.querySelectorAll=this.docProto.querySelectorAll,this.parseFromString=this.domProto.parseFromString,this.URL=t.nativeMethods.getOwnPropertyDescriptor(this.docProto,"URL")}overrideParseFromString(){this.ctx.override(this.domProto,"parseFromString",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s]=i;const n=new e({string:o,type:s},t,r);return this.emit("parseFromString",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.string,n.data.type)}))}overrideQuerySelector(){this.ctx.override(this.docProto,"querySelector",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({selectors:o},t,r);return this.emit("querySelector",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.selectors)}))}overrideDomain(){this.ctx.overrideDescriptor(this.docProto,"domain",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("getDomain",i),i.intercepted?i.returnValue:i.data.value},set:(t,r,[i])=>{const o=new e({value:i},t,r);return this.emit("setDomain",o),o.intercepted?o.returnValue:o.target.call(o.that,o.data.value)}})}overrideReferrer(){this.ctx.overrideDescriptor(this.docProto,"referrer",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("referrer",i),i.intercepted?i.returnValue:i.data.value}})}overrideCreateTreeWalker(){this.ctx.override(this.docProto,"createTreeWalker",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o,s=4294967295,n,a]=i;const h=new e({root:o,show:s,filter:n,expandEntityReferences:a},t,r);return this.emit("createTreeWalker",h),h.intercepted?h.returnValue:h.target.call(h.that,h.data.root,h.data.show,h.data.filter,h.data.expandEntityReferences)}))}overrideWrite(){this.ctx.override(this.docProto,"write",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[...o]=i;const s=new e({html:o},t,r);return this.emit("write",s),s.intercepted?s.returnValue:s.target.apply(s.that,s.data.html)})),this.ctx.override(this.docProto,"writeln",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[...o]=i;const s=new e({html:o},t,r);return this.emit("writeln",s),s.intercepted?s.returnValue:s.target.apply(s.that,s.data.html)}))}overrideDocumentURI(){this.ctx.overrideDescriptor(this.docProto,"documentURI",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("documentURI",i),i.intercepted?i.returnValue:i.data.value}})}overrideURL(){this.ctx.overrideDescriptor(this.docProto,"URL",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("url",i),i.intercepted?i.returnValue:i.data.value}})}overrideCookie(){this.ctx.overrideDescriptor(this.docProto,"cookie",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("getCookie",i),i.intercepted?i.returnValue:i.data.value},set:(t,r,[i])=>{const o=new e({value:i},t,r);return this.emit("setCookie",o),o.intercepted?o.returnValue:o.target.call(o.that,o.data.value)}})}overrideTitle(){this.ctx.overrideDescriptor(this.docProto,"title",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("getTitle",i),i.intercepted?i.returnValue:i.data.value},set:(t,r,[i])=>{const o=new e({value:i},t,r);return this.emit("setTitle",o),o.intercepted?o.returnValue:o.target.call(o.that,o.data.value)}})}};const o=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.Audio=this.window.Audio,this.Element=this.window.Element,this.elemProto=this.Element?this.Element.prototype:{},this.innerHTML=t.nativeMethods.getOwnPropertyDescriptor(this.elemProto,"innerHTML"),this.outerHTML=t.nativeMethods.getOwnPropertyDescriptor(this.elemProto,"outerHTML"),this.setAttribute=this.elemProto.setAttribute,this.getAttribute=this.elemProto.getAttribute,this.removeAttribute=this.elemProto.removeAttribute,this.hasAttribute=this.elemProto.hasAttribute,this.querySelector=this.elemProto.querySelector,this.querySelectorAll=this.elemProto.querySelectorAll,this.insertAdjacentHTML=this.elemProto.insertAdjacentHTML,this.insertAdjacentText=this.elemProto.insertAdjacentText}overrideQuerySelector(){this.ctx.override(this.elemProto,"querySelector",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({selectors:o},t,r);return this.emit("querySelector",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.selectors)}))}overrideAttribute(){this.ctx.override(this.elemProto,"getAttribute",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({name:o},t,r);return this.emit("getAttribute",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.name)})),this.ctx.override(this.elemProto,"setAttribute",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s]=i;const n=new e({name:o,value:s},t,r);return this.emit("setAttribute",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.name,n.data.value)})),this.ctx.override(this.elemProto,"hasAttribute",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({name:o},t,r);return this.emit("hasAttribute",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.name)})),this.ctx.override(this.elemProto,"removeAttribute",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({name:o},t,r);return this.emit("removeAttribute",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.name)}))}overrideAudio(){this.ctx.override(this.window,"Audio",((t,r,i)=>{if(!i.length)return new t(...i);let[o]=i;const s=new e({url:o},t,r);return this.emit("audio",s),s.intercepted?s.returnValue:new s.target(s.data.url)}),!0)}overrideHtml(){this.hookProperty(this.Element,"innerHTML",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("getInnerHTML",i),i.intercepted?i.returnValue:i.data.value},set:(t,r,[i])=>{const o=new e({value:i},t,r);if(this.emit("setInnerHTML",o),o.intercepted)return o.returnValue;t.call(r,o.data.value)}}),this.hookProperty(this.Element,"outerHTML",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("getOuterHTML",i),i.intercepted?i.returnValue:i.data.value},set:(t,r,[i])=>{const o=new e({value:i},t,r);if(this.emit("setOuterHTML",o),o.intercepted)return o.returnValue;t.call(r,o.data.value)}})}overrideInsertAdjacentHTML(){this.ctx.override(this.elemProto,"insertAdjacentHTML",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s]=i;const n=new e({position:o,html:s},t,r);return this.emit("insertAdjacentHTML",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.position,n.data.html)}))}overrideInsertAdjacentText(){this.ctx.override(this.elemProto,"insertAdjacentText",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s]=i;const n=new e({position:o,text:s},t,r);return this.emit("insertAdjacentText",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.position,n.data.text)}))}hookProperty(t,e,r){if(!t)return!1;if(this.ctx.nativeMethods.isArray(t)){for(const i of t)this.hookProperty(i,e,r);return!0}const i=t.prototype;return this.ctx.overrideDescriptor(i,e,r),!0}};const s=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.Node=t.window.Node||{},this.nodeProto=this.Node.prototype||{},this.compareDocumentPosition=this.nodeProto.compareDocumentPosition,this.contains=this.nodeProto.contains,this.insertBefore=this.nodeProto.insertBefore,this.replaceChild=this.nodeProto.replaceChild,this.append=this.nodeProto.append,this.appendChild=this.nodeProto.appendChild,this.removeChild=this.nodeProto.removeChild,this.textContent=t.nativeMethods.getOwnPropertyDescriptor(this.nodeProto,"textContent"),this.parentNode=t.nativeMethods.getOwnPropertyDescriptor(this.nodeProto,"parentNode"),this.parentElement=t.nativeMethods.getOwnPropertyDescriptor(this.nodeProto,"parentElement"),this.childNodes=t.nativeMethods.getOwnPropertyDescriptor(this.nodeProto,"childNodes"),this.baseURI=t.nativeMethods.getOwnPropertyDescriptor(this.nodeProto,"baseURI"),this.previousSibling=t.nativeMethods.getOwnPropertyDescriptor(this.nodeProto,"previousSibling"),this.ownerDocument=t.nativeMethods.getOwnPropertyDescriptor(this.nodeProto,"ownerDocument")}overrideTextContent(){this.ctx.overrideDescriptor(this.nodeProto,"textContent",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("getTextContent",i),i.intercepted?i.returnValue:i.data.value},set:(t,r,[i])=>{const o=new e({value:i},t,r);if(this.emit("setTextContent",o),o.intercepted)return o.returnValue;t.call(r,o.data.value)}})}overrideAppend(){this.ctx.override(this.nodeProto,"append",((t,r,[...i])=>{const o=new e({nodes:i},t,r);return this.emit("append",o),o.intercepted?o.returnValue:o.target.call(o.that,o.data.nodes)})),this.ctx.override(this.nodeProto,"appendChild",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({node:o},t,r);return this.emit("appendChild",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.node)}))}overrideBaseURI(){this.ctx.overrideDescriptor(this.nodeProto,"baseURI",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("baseURI",i),i.intercepted?i.returnValue:i.data.value}})}overrideParent(){this.ctx.overrideDescriptor(this.nodeProto,"parentNode",{get:(t,r)=>{const i=new e({node:t.call(r)},t,r);return this.emit("parentNode",i),i.intercepted?i.returnValue:i.data.node}}),this.ctx.overrideDescriptor(this.nodeProto,"parentElement",{get:(t,r)=>{const i=new e({element:t.call(r)},t,r);return this.emit("parentElement",i),i.intercepted?i.returnValue:i.data.node}})}overrideOwnerDocument(){this.ctx.overrideDescriptor(this.nodeProto,"ownerDocument",{get:(t,r)=>{const i=new e({document:t.call(r)},t,r);return this.emit("ownerDocument",i),i.intercepted?i.returnValue:i.data.document}})}overrideCompareDocumentPosit1ion(){this.ctx.override(this.nodeProto,"compareDocumentPosition",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({node:o},t,r);return s.intercepted?s.returnValue:s.target.call(s.that,s.data.node)}))}overrideChildMethods(){this.ctx.override(this.nodeProto,"removeChild")}};const n=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.Attr=this.window.Attr||{},this.attrProto=this.Attr.prototype||{},this.value=t.nativeMethods.getOwnPropertyDescriptor(this.attrProto,"value"),this.name=t.nativeMethods.getOwnPropertyDescriptor(this.attrProto,"name"),this.getNamedItem=this.attrProto.getNamedItem||null,this.setNamedItem=this.attrProto.setNamedItem||null,this.removeNamedItem=this.attrProto.removeNamedItem||null,this.getNamedItemNS=this.attrProto.getNamedItemNS||null,this.setNamedItemNS=this.attrProto.setNamedItemNS||null,this.removeNamedItemNS=this.attrProto.removeNamedItemNS||null,this.item=this.attrProto.item||null}overrideNameValue(){this.ctx.overrideDescriptor(this.attrProto,"name",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("name",i),i.intercepted?i.returnValue:i.data.value}}),this.ctx.overrideDescriptor(this.attrProto,"value",{get:(t,r)=>{const i=new e({name:this.name.get.call(r),value:t.call(r)},t,r);return this.emit("getValue",i),i.intercepted?i.returnValue:i.data.value},set:(t,r,[i])=>{const o=new e({name:this.name.get.call(r),value:i},t,r);if(this.emit("setValue",o),o.intercepted)return o.returnValue;o.target.call(o.that,o.data.value)}})}overrideItemMethods(){this.ctx.override(this.attrProto,"getNamedItem",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({name:o},t,r);return this.emit("getNamedItem",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.name)})),this.ctx.override(this.attrProto,"setNamedItem",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s]=i;const n=new e({name:o,value:s},t,r);return this.emit("setNamedItem",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.name,n.data.value)})),this.ctx.override(this.attrProto,"removeNamedItem",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({name:o},t,r);return this.emit("removeNamedItem",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.name)})),this.ctx.override(this.attrProto,"item",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({index:o},t,r);return this.emit("item",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.name)})),this.ctx.override(this.attrProto,"getNamedItemNS",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s]=i;const n=new e({namespace:o,localName:s},t,r);return this.emit("getNamedItemNS",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.namespace,n.data.localName)})),this.ctx.override(this.attrProto,"setNamedItemNS",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({attr:o},t,r);return this.emit("setNamedItemNS",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.name)})),this.ctx.override(this.attrProto,"removeNamedItemNS",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s]=i;const n=new e({namespace:o,localName:s},t,r);return this.emit("removeNamedItemNS",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.namespace,n.data.localName)}))}};const a=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.Function=this.window.Function,this.fnProto=this.Function.prototype,this.toString=this.fnProto.toString,this.fnStrings=t.fnStrings,this.call=this.fnProto.call,this.apply=this.fnProto.apply,this.bind=this.fnProto.bind}overrideFunction(){this.ctx.override(this.window,"Function",((t,r,i)=>{if(!i.length)return t.apply(r,i);let o=i[i.length-1],s=[];for(let t=0;t<i.length-1;t++)s.push(i[t]);const n=new e({script:o,args:s},t,r);return this.emit("function",n),n.intercepted?n.returnValue:n.target.call(n.that,...n.data.args,n.data.script)}),!0)}overrideToString(){this.ctx.override(this.fnProto,"toString",((t,r)=>{const i=new e({fn:r},t,r);return this.emit("toString",i),i.intercepted?i.returnValue:i.target.call(i.data.fn)}))}};const h=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.Object=this.window.Object,this.getOwnPropertyDescriptors=this.Object.getOwnPropertyDescriptors,this.getOwnPropertyDescriptor=this.Object.getOwnPropertyDescriptor,this.getOwnPropertyNames=this.Object.getOwnPropertyNames}overrideGetPropertyNames(){this.ctx.override(this.Object,"getOwnPropertyNames",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({names:t.call(r,o)},t,r);return this.emit("getOwnPropertyNames",s),s.intercepted?s.returnValue:s.data.names}))}overrideGetOwnPropertyDescriptors(){this.ctx.override(this.Object,"getOwnPropertyDescriptors",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({descriptors:t.call(r,o)},t,r);return this.emit("getOwnPropertyDescriptors",s),s.intercepted?s.returnValue:s.data.descriptors}))}};const l=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.fetch=this.window.fetch,this.Request=this.window.Request,this.Response=this.window.Response,this.Headers=this.window.Headers,this.reqProto=this.Request?this.Request.prototype:{},this.resProto=this.Response?this.Response.prototype:{},this.headersProto=this.Headers?this.Headers.prototype:{},this.reqUrl=t.nativeMethods.getOwnPropertyDescriptor(this.reqProto,"url"),this.resUrl=t.nativeMethods.getOwnPropertyDescriptor(this.resProto,"url"),this.reqHeaders=t.nativeMethods.getOwnPropertyDescriptor(this.reqProto,"headers"),this.resHeaders=t.nativeMethods.getOwnPropertyDescriptor(this.resProto,"headers")}override(){return this.overrideRequest(),this.overrideUrl(),this.overrideHeaders(),!0}overrideRequest(){return!!this.fetch&&(this.ctx.override(this.window,"fetch",((t,r,i)=>{if(!i.length||i[0]instanceof this.Request)return t.apply(r,i);let[o,s={}]=i;const n=new e({input:o,options:s},t,r);return this.emit("request",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.input,n.data.options)})),this.ctx.override(this.window,"Request",((t,r,i)=>{if(!i.length)return new t(...i);let[o,s={}]=i;const n=new e({input:o,options:s},t);return this.emit("request",n),n.intercepted?n.returnValue:new n.target(n.data.input,n.data.options)}),!0),!0)}overrideUrl(){return this.ctx.overrideDescriptor(this.reqProto,"url",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("requestUrl",i),i.intercepted?i.returnValue:i.data.value}}),this.ctx.overrideDescriptor(this.resProto,"url",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("responseUrl",i),i.intercepted?i.returnValue:i.data.value}}),!0}overrideHeaders(){return!!this.Headers&&(this.ctx.overrideDescriptor(this.reqProto,"headers",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("requestHeaders",i),i.intercepted?i.returnValue:i.data.value}}),this.ctx.overrideDescriptor(this.resProto,"headers",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("responseHeaders",i),i.intercepted?i.returnValue:i.data.value}}),this.ctx.override(this.headersProto,"get",((t,r,[i])=>{if(!i)return t.call(r);const o=new e({name:i,value:t.call(r,i)},t,r);return this.emit("getHeader",o),o.intercepted?o.returnValue:o.data.value})),this.ctx.override(this.headersProto,"set",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s]=i;const n=new e({name:o,value:s},t,r);return this.emit("setHeader",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.name,n.data.value)})),this.ctx.override(this.headersProto,"has",((t,r,i)=>{if(!i.length)return t.call(r);let[o]=i;const s=new e({name:o,value:t.call(r,o)},t,r);return this.emit("hasHeader",s),s.intercepted?s.returnValue:s.data})),this.ctx.override(this.headersProto,"append",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s]=i;const n=new e({name:o,value:s},t,r);return this.emit("appendHeader",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.name,n.data.value)})),this.ctx.override(this.headersProto,"delete",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({name:o},t,r);return this.emit("deleteHeader",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.name)})),!0)}};const c=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.XMLHttpRequest=this.window.XMLHttpRequest,this.xhrProto=this.window.XMLHttpRequest?this.window.XMLHttpRequest.prototype:{},this.open=this.xhrProto.open,this.abort=this.xhrProto.abort,this.send=this.xhrProto.send,this.overrideMimeType=this.xhrProto.overrideMimeType,this.getAllResponseHeaders=this.xhrProto.getAllResponseHeaders,this.getResponseHeader=this.xhrProto.getResponseHeader,this.setRequestHeader=this.xhrProto.setRequestHeader,this.responseURL=t.nativeMethods.getOwnPropertyDescriptor(this.xhrProto,"responseURL"),this.responseText=t.nativeMethods.getOwnPropertyDescriptor(this.xhrProto,"responseText")}override(){this.overrideOpen(),this.overrideSend(),this.overrideMimeType(),this.overrideGetResHeader(),this.overrideGetResHeaders(),this.overrideSetReqHeader()}overrideOpen(){this.ctx.override(this.xhrProto,"open",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s,n=!0,a=null,h=null]=i;const l=new e({method:o,input:s,async:n,user:a,password:h},t,r);return this.emit("open",l),l.intercepted?l.returnValue:l.target.call(l.that,l.data.method,l.data.input,l.data.async,l.data.user,l.data.password)}))}overrideResponseUrl(){this.ctx.overrideDescriptor(this.xhrProto,"responseURL",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("responseUrl",i),i.intercepted?i.returnValue:i.data.value}})}overrideSend(){this.ctx.override(this.xhrProto,"send",((t,r,[i=null])=>{const o=new e({body:i},t,r);return this.emit("send",o),o.intercepted?o.returnValue:o.target.call(o.that,o.data.body)}))}overrideSetReqHeader(){this.ctx.override(this.xhrProto,"setRequestHeader",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s]=i;const n=new e({name:o,value:s},t,r);return this.emit("setReqHeader",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.name,n.data.value)}))}overrideGetResHeaders(){this.ctx.override(this.xhrProto,"getAllResponseHeaders",((t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("getAllResponseHeaders",i),i.intercepted?i.returnValue:i.data.value}))}overrideGetResHeader(){this.ctx.override(this.xhrProto,"getResponseHeader",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({name:o,value:t.call(r,o)},t,r);return s.intercepted?s.returnValue:s.data.value}))}};const d=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.EventSource=this.window.EventSource||{},this.esProto=this.EventSource.prototype||{},this.url=t.nativeMethods.getOwnPropertyDescriptor(this.esProto,"url"),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2}overrideConstruct(){this.ctx.override(this.window,"EventSource",((t,r,i)=>{if(!i.length)return new t(...i);let[o,s={}]=i;const n=new e({url:o,config:s},t,r);return this.emit("construct",n),n.intercepted?n.returnValue:new n.target(n.data.url,n.data.config)}),!0),"EventSource"in this.window&&(this.window.EventSource.CONNECTING=this.CONNECTING,this.window.EventSource.OPEN=this.OPEN,this.window.EventSource.CLOSED=this.CLOSED)}overrideUrl(){this.ctx.overrideDescriptor(this.esProto,"url",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("url",i),i.data.value}})}};const u=class extends t{constructor(t){super(),this.ctx=t,this.window=this.ctx.window,this.History=this.window.History,this.history=this.window.history,this.historyProto=this.History?this.History.prototype:{},this.pushState=this.historyProto.pushState,this.replaceState=this.historyProto.replaceState,this.go=this.historyProto.go,this.back=this.historyProto.back,this.forward=this.historyProto.forward}override(){this.overridePushState(),this.overrideReplaceState(),this.overrideGo(),this.overrideForward(),this.overrideBack()}overridePushState(){this.ctx.override(this.historyProto,"pushState",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s,n=""]=i;const a=new e({state:o,title:s,url:n},t,r);return this.emit("pushState",a),a.intercepted?a.returnValue:a.target.call(a.that,a.data.state,a.data.title,a.data.url)}))}overrideReplaceState(){this.ctx.override(this.historyProto,"replaceState",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s,n=""]=i;const a=new e({state:o,title:s,url:n},t,r);return this.emit("replaceState",a),a.intercepted?a.returnValue:a.target.call(a.that,a.data.state,a.data.title,a.data.url)}))}overrideGo(){this.ctx.override(this.historyProto,"go",((t,r,[i])=>{const o=new e({delta:i},t,r);return this.emit("go",o),o.intercepted?o.returnValue:o.target.call(o.that,o.data.delta)}))}overrideForward(){this.ctx.override(this.historyProto,"forward",((t,r)=>{const i=new e(null,t,r);return this.emit("forward",i),i.intercepted?i.returnValue:i.target.call(i.that)}))}overrideBack(){this.ctx.override(this.historyProto,"back",((t,r)=>{const i=new e(null,t,r);return this.emit("back",i),i.intercepted?i.returnValue:i.target.call(i.that)}))}};const p=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.location=this.window.location,this.WorkerLocation=this.ctx.worker?this.window.WorkerLocation:null,this.workerLocProto=this.WorkerLocation?this.WorkerLocation.prototype:{},this.keys=["href","protocol","host","hostname","port","pathname","search","hash","origin"],this.HashChangeEvent=this.window.HashChangeEvent||null,this.href=this.WorkerLocation?t.nativeMethods.getOwnPropertyDescriptor(this.workerLocProto,"href"):t.nativeMethods.getOwnPropertyDescriptor(this.location,"href")}overrideWorkerLocation(t){if(!this.WorkerLocation)return!1;const e=this;for(const r of this.keys)this.ctx.overrideDescriptor(this.workerLocProto,r,{get:()=>t(e.href.get.call(this.location))[r]});return!0}emulate(t,e){const r={},i=this;for(const o of i.keys)this.ctx.nativeMethods.defineProperty(r,o,{get:()=>t(i.href.get.call(i.location))[o],set:"origin"!==o?function(t){switch(o){case"href":i.location.href=e(t);break;case"hash":i.emit("hashchange",r.href,t.trim().startsWith("#")?new URL(t.trim(),r.href).href:new URL("#"+t.trim(),r.href).href,i);break;default:{const s=new URL(r.href);s[o]=t,i.location.href=e(s.href)}}}:void 0,configurable:!1,enumerable:!0});return"reload"in this.location&&this.ctx.nativeMethods.defineProperty(r,"reload",{value:this.ctx.wrap(this.location,"reload",((t,e)=>t.call(e===r?this.location:e))),writable:!1,enumerable:!0}),"replace"in this.location&&this.ctx.nativeMethods.defineProperty(r,"replace",{value:this.ctx.wrap(this.location,"assign",((t,i,o)=>{o.length&&i===r||t.call(i),i=this.location;let[s]=o;const n=new URL(s,r.href);return t.call(i===r?this.location:i,e(n.href))})),writable:!1,enumerable:!0}),"assign"in this.location&&this.ctx.nativeMethods.defineProperty(r,"assign",{value:this.ctx.wrap(this.location,"assign",((t,i,o)=>{o.length&&i===r||t.call(i),i=this.location;let[s]=o;const n=new URL(s,r.href);return t.call(i===r?this.location:i,e(n.href))})),writable:!1,enumerable:!0}),"ancestorOrigins"in this.location&&this.ctx.nativeMethods.defineProperty(r,"ancestorOrigins",{get(){const t=[];return i.window.DOMStringList&&i.ctx.nativeMethods.setPrototypeOf(t,i.window.DOMStringList.prototype),t},set:void 0,enumerable:!0}),this.ctx.nativeMethods.defineProperty(r,"toString",{value:this.ctx.wrap(this.location,"toString",(()=>r.href)),enumerable:!0,writable:!1}),this.ctx.nativeMethods.defineProperty(r,Symbol.toPrimitive,{value:()=>r.href,writable:!1,enumerable:!1}),this.ctx.window.Location&&this.ctx.nativeMethods.setPrototypeOf(r,this.ctx.window.Location.prototype),r}};const w=class extends t{constructor(t){super(),this.ctx=t,this.window=this.ctx.window,this.postMessage=this.window.postMessage,this.MessageEvent=this.window.MessageEvent||{},this.MessagePort=this.window.MessagePort||{},this.mpProto=this.MessagePort.prototype||{},this.mpPostMessage=this.mpProto.postMessage,this.messageProto=this.MessageEvent.prototype||{},this.messageData=t.nativeMethods.getOwnPropertyDescriptor(this.messageProto,"data"),this.messageOrigin=t.nativeMethods.getOwnPropertyDescriptor(this.messageProto,"origin")}overridePostMessage(){this.ctx.override(this.window,"postMessage",((t,r,i)=>{if(!i.length)return t.apply(r,i);let o,s,n;this.ctx.worker?[o,n=[]]=i:[o,s,n=[]]=i;const a=new e({message:o,origin:s,transfer:n,worker:this.ctx.worker},t,r);return this.emit("postMessage",a),a.intercepted?a.returnValue:this.ctx.worker?a.target.call(a.that,a.data.message,a.data.transfer):a.target.call(a.that,a.data.message,a.data.origin,a.data.transfer)}))}wrapPostMessage(t,r,i=!1){return this.ctx.wrap(t,r,((r,o,s)=>{if(this.ctx.worker?!s.length:2>s)return r.apply(o,s);let n,a,h;i?([n,h=[]]=s,a=null):[n,a,h=[]]=s;const l=new e({message:n,origin:a,transfer:h,worker:this.ctx.worker},r,t);return this.emit("postMessage",l),l.intercepted?l.returnValue:i?l.target.call(l.that,l.data.message,l.data.transfer):l.target.call(l.that,l.data.message,l.data.origin,l.data.transfer)}))}overrideMessageOrigin(){this.ctx.overrideDescriptor(this.messageProto,"origin",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("origin",i),i.intercepted?i.returnValue:i.data.value}})}overrideMessageData(){this.ctx.overrideDescriptor(this.messageProto,"data",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("data",i),i.intercepted?i.returnValue:i.data.value}})}};const v=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.navigator=this.window.navigator,this.Navigator=this.window.Navigator||{},this.navProto=this.Navigator.prototype||{},this.sendBeacon=this.navProto.sendBeacon}overrideSendBeacon(){this.ctx.override(this.navProto,"sendBeacon",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o,s=""]=i;const n=new e({url:o,data:s},t,r);return this.emit("sendBeacon",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.url,n.data.data)}))}};const m=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.Worker=this.window.Worker||{},this.Worklet=this.window.Worklet||{},this.workletProto=this.Worklet.prototype||{},this.workerProto=this.Worker.prototype||{},this.postMessage=this.workerProto.postMessage,this.terminate=this.workerProto.terminate,this.addModule=this.workletProto.addModule}overrideWorker(){this.ctx.override(this.window,"Worker",((t,r,i)=>{if(!i.length)return new t(...i);let[o,s={}]=i;const n=new e({url:o,options:s},t,r);return this.emit("worker",n),n.intercepted?n.returnValue:new n.target(...[n.data.url,n.data.options])}),!0)}overrideAddModule(){this.ctx.override(this.workletProto,"addModule",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o,s={}]=i;const n=new e({url:o,options:s},t,r);return this.emit("addModule",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.url,n.data.options)}))}overridePostMessage(){this.ctx.override(this.workerProto,"postMessage",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o,s=[]]=i;const n=new e({message:o,transfer:s},t,r);return this.emit("postMessage",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.message,n.data.transfer)}))}overrideImportScripts(){this.ctx.override(this.window,"importScripts",((t,r,i)=>{if(!i.length)return t.apply(r,i);const o=new e({scripts:i},t,r);return this.emit("importScripts",o),o.intercepted?o.returnValue:o.target.apply(o.that,o.data.scripts)}))}};const g=class extends t{constructor(t){super(),this.ctx=t,this.window=this.ctx.window,this.URL=this.window.URL||{},this.createObjectURL=this.URL.createObjectURL,this.revokeObjectURL=this.URL.revokeObjectURL}overrideObjectURL(){this.ctx.override(this.URL,"createObjectURL",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({object:o},t,r);return this.emit("createObjectURL",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.object)})),this.ctx.override(this.URL,"revokeObjectURL",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({url:o},t,r);return this.emit("revokeObjectURL",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.url)}))}};const y=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.localStorage=this.window.localStorage||null,this.sessionStorage=this.window.sessionStorage||null,this.Storage=this.window.Storage||{},this.storeProto=this.Storage.prototype||{},this.getItem=this.storeProto.getItem||null,this.setItem=this.storeProto.setItem||null,this.removeItem=this.storeProto.removeItem||null,this.clear=this.storeProto.clear||null,this.key=this.storeProto.key||null,this.methods=["key","getItem","setItem","removeItem","clear"],this.wrappers=new t.nativeMethods.Map}overrideMethods(){this.ctx.override(this.storeProto,"getItem",((t,r,i)=>{if(!i.length)return t.apply(this.wrappers.get(r)||r,i);let[o]=i;const s=new e({name:o},t,this.wrappers.get(r)||r);return this.emit("getItem",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.name)})),this.ctx.override(this.storeProto,"setItem",((t,r,i)=>{if(2>i.length)return t.apply(this.wrappers.get(r)||r,i);let[o,s]=i;const n=new e({name:o,value:s},t,this.wrappers.get(r)||r);return this.emit("setItem",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.name,n.data.value)})),this.ctx.override(this.storeProto,"removeItem",((t,r,i)=>{if(!i.length)return t.apply(this.wrappers.get(r)||r,i);let[o]=i;const s=new e({name:o},t,this.wrappers.get(r)||r);return this.emit("removeItem",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.name)})),this.ctx.override(this.storeProto,"clear",((t,r)=>{const i=new e(null,t,this.wrappers.get(r)||r);return this.emit("clear",i),i.intercepted?i.returnValue:i.target.call(i.that)})),this.ctx.override(this.storeProto,"key",((t,r,i)=>{if(!i.length)return t.apply(this.wrappers.get(r)||r,i);let[o]=i;const s=new e({index:o},t,this.wrappers.get(r)||r);return this.emit("key",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.index)}))}overrideLength(){this.ctx.overrideDescriptor(this.storeProto,"length",{get:(t,r)=>{const i=new e({length:t.call(this.wrappers.get(r)||r)},t,this.wrappers.get(r)||r);return this.emit("length",i),i.intercepted?i.returnValue:i.data.length}})}emulate(t,r={}){this.ctx.nativeMethods.setPrototypeOf(r,this.storeProto);const i=new this.ctx.window.Proxy(r,{get:(r,i)=>{if(i in this.storeProto||"symbol"==typeof i)return t[i];const o=new e({name:i},null,t);return this.emit("get",o),o.intercepted?o.returnValue:t[o.data.name]},set:(r,i,o)=>{if(i in this.storeProto||"symbol"==typeof i)return t[i]=o;const s=new e({name:i,value:o},null,t);return this.emit("set",s),s.intercepted?s.returnValue:t[s.data.name]=s.data.value},deleteProperty:(r,i)=>{if("symbol"==typeof i)return delete t[i];const o=new e({name:i},null,t);return this.emit("delete",o),o.intercepted?o.returnValue:delete t[o.data.name]}});return this.wrappers.set(i,t),this.ctx.nativeMethods.setPrototypeOf(i,this.storeProto),i}};const f=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.CSSStyleDeclaration=this.window.CSSStyleDeclaration||{},this.cssStyleProto=this.CSSStyleDeclaration.prototype||{},this.getPropertyValue=this.cssStyleProto.getPropertyValue||null,this.setProperty=this.cssStyleProto.setProperty||null,this.cssText,t.nativeMethods.getOwnPropertyDescriptors(this.cssStyleProto,"cssText"),this.urlProps=["background","backgroundImage","borderImage","borderImageSource","listStyle","listStyleImage","cursor"],this.dashedUrlProps=["background","background-image","border-image","border-image-source","list-style","list-style-image","cursor"],this.propToDashed={background:"background",backgroundImage:"background-image",borderImage:"border-image",borderImageSource:"border-image-source",listStyle:"list-style",listStyleImage:"list-style-image",cursor:"cursor"}}overrideSetGetProperty(){this.ctx.override(this.cssStyleProto,"getPropertyValue",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({property:o},t,r);return this.emit("getPropertyValue",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.property)})),this.ctx.override(this.cssStyleProto,"setProperty",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s]=i;const n=new e({property:o,value:s},t,r);return this.emit("setProperty",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.property,n.data.value)}))}overrideCssText(){this.ctx.overrideDescriptor(this.cssStyleProto,"cssText",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("getCssText",i),i.intercepted?i.returnValue:i.data.value},set:(t,r,[i])=>{const o=new e({value:i},t,r);return this.emit("setCssText",o),o.intercepted?o.returnValue:o.target.call(o.that,o.data.value)}})}};class P extends t{constructor(t=self,e=!t.window){super(),this.window=t,this.nativeMethods={fnToString:this.window.Function.prototype.toString,defineProperty:this.window.Object.defineProperty,getOwnPropertyDescriptor:this.window.Object.getOwnPropertyDescriptor,getOwnPropertyDescriptors:this.window.Object.getOwnPropertyDescriptors,getOwnPropertyNames:this.window.Object.getOwnPropertyNames,keys:this.window.Object.keys,getOwnPropertySymbols:this.window.Object.getOwnPropertySymbols,isArray:this.window.Array.isArray,setPrototypeOf:this.window.Object.setPrototypeOf,isExtensible:this.window.Object.isExtensible,Map:this.window.Map,Proxy:this.window.Proxy},this.worker=e,this.fetch=new l(this),this.xhr=new c(this),this.history=new u(this),this.element=new o(this),this.node=new s(this),this.document=new i(this),this.function=new a(this),this.object=new h(this),this.message=new w(this),this.navigator=new v(this),this.eventSource=new d(this),this.attribute=new n(this),this.url=new g(this),this.workers=new m(this),this.location=new p(this),this.storage=new y(this),this.style=new f(this)}initLocation(t,e){this.location=new p(this,e,t,this.worker)}override(t,e,r,i){const o=this.wrap(t,e,r,i);return t[e]=o}overrideDescriptor(t,e,r={}){const i=this.wrapDescriptor(t,e,r);return i?(this.nativeMethods.defineProperty(t,e,i),i):{}}wrap(t,e,r,i){const o=t[e];if(!o)return o;const s="prototype"in o?function(){return r(o,this,[...arguments])}:{attach(){return r(o,this,[...arguments])}}.attach;return i&&(s.prototype=o.prototype,s.prototype.constructor=s),this.emit("wrap",o,s,!!i),s}wrapDescriptor(t,e,r={}){const i=this.nativeMethods.getOwnPropertyDescriptor(t,e);if(!i)return!1;for(let t in r)t in i&&(i[t]="get"===t||"set"===t?this.wrap(i,t,r[t]):"function"==typeof r[t]?r[t](i[t]):r[t]);return i}}"object"==typeof self&&(self.UVClient=P)})()})(); | ||
(()=>{"use strict";var t={666:t=>{var e,r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};e=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}t.exports=s,t.exports.once=function(t,e){return new Promise((function(r,i){function o(r){t.removeListener(e,s),i(r)}function s(){"function"==typeof t.removeListener&&t.removeListener("error",o),r([].slice.call(arguments))}v(t,e,s,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&v(t,"error",e,r)}(t,o,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var n=10;function a(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function h(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function l(t,e,r,i){var o,s,n,l;if(a(r),void 0===(s=t._events)?(s=t._events=Object.create(null),t._eventsCount=0):(void 0!==s.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),n=s[e]),void 0===n)n=s[e]=r,++t._eventsCount;else if("function"==typeof n?n=s[e]=i?[r,n]:[n,r]:i?n.unshift(r):n.push(r),(o=h(t))>0&&n.length>o&&!n.warned){n.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+n.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=n.length,l=c,console&&console.warn&&console.warn(l)}return t}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=c.bind(i);return o.listener=r,i.wrapFn=o,o}function u(t,e,r){var i=t._events;if(void 0===i)return[];var o=i[e];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(o):w(o,o.length)}function p(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function w(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}function v(t,e,r,i){if("function"==typeof t.on)i.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function o(s){i.once&&t.removeEventListener(e,o),r(s)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return n},set:function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");n=t}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},s.prototype.getMaxListeners=function(){return h(this)},s.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var o="error"===t,s=this._events;if(void 0!==s)o=o&&void 0===s.error;else if(!o)return!1;if(o){var n;if(e.length>0&&(n=e[0]),n instanceof Error)throw n;var a=new Error("Unhandled error."+(n?" ("+n.message+")":""));throw a.context=n,a}var h=s[t];if(void 0===h)return!1;if("function"==typeof h)i(h,this,e);else{var l=h.length,c=w(h,l);for(r=0;r<l;++r)i(c[r],this,e)}return!0},s.prototype.addListener=function(t,e){return l(this,t,e,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(t,e){return l(this,t,e,!0)},s.prototype.once=function(t,e){return a(e),this.on(t,d(this,t,e)),this},s.prototype.prependOnceListener=function(t,e){return a(e),this.prependListener(t,d(this,t,e)),this},s.prototype.removeListener=function(t,e){var r,i,o,s,n;if(a(e),void 0===(i=this._events))return this;if(void 0===(r=i[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(o=-1,s=r.length-1;s>=0;s--)if(r[s]===e||r[s].listener===e){n=r[s].listener,o=s;break}if(o<0)return this;0===o?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,o),1===r.length&&(i[t]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",t,n||e)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(t){var e,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var o,s=Object.keys(r);for(i=0;i<s.length;++i)"removeListener"!==(o=s[i])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(i=e.length-1;i>=0;i--)this.removeListener(t,e[i]);return this},s.prototype.listeners=function(t){return u(this,t,!0)},s.prototype.rawListeners=function(t){return u(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):p.call(t,e)},s.prototype.listenerCount=p,s.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}}},e={};function r(i){var o=e[i];if(void 0!==o)return o.exports;var s=e[i]={exports:{}};return t[i](s,s.exports,r),s.exports}(()=>{var t=r(666);const e=class{#t;#e;constructor(t={},e=null,r=null){this.#t=!1,this.#e=null,this.data=t,this.target=e,this.that=r}get intercepted(){return this.#t}get returnValue(){return this.#e}respondWith(t){this.#e=t,this.#t=!0}};const i=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.document=this.window.document,this.Document=this.window.Document||{},this.DOMParser=this.window.DOMParser||{},this.docProto=this.Document.prototype||{},this.domProto=this.DOMParser.prototype||{},this.title=t.nativeMethods.getOwnPropertyDescriptor(this.docProto,"title"),this.cookie=t.nativeMethods.getOwnPropertyDescriptor(this.docProto,"cookie"),this.referrer=t.nativeMethods.getOwnPropertyDescriptor(this.docProto,"referrer"),this.domain=t.nativeMethods.getOwnPropertyDescriptor(this.docProto,"domain"),this.documentURI=t.nativeMethods.getOwnPropertyDescriptor(this.docProto,"documentURI"),this.write=this.docProto.write,this.writeln=this.docProto.writeln,this.querySelector=this.docProto.querySelector,this.querySelectorAll=this.docProto.querySelectorAll,this.parseFromString=this.domProto.parseFromString,this.URL=t.nativeMethods.getOwnPropertyDescriptor(this.docProto,"URL")}overrideParseFromString(){this.ctx.override(this.domProto,"parseFromString",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s]=i;const n=new e({string:o,type:s},t,r);return this.emit("parseFromString",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.string,n.data.type)}))}overrideQuerySelector(){this.ctx.override(this.docProto,"querySelector",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({selectors:o},t,r);return this.emit("querySelector",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.selectors)}))}overrideDomain(){this.ctx.overrideDescriptor(this.docProto,"domain",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("getDomain",i),i.intercepted?i.returnValue:i.data.value},set:(t,r,[i])=>{const o=new e({value:i},t,r);return this.emit("setDomain",o),o.intercepted?o.returnValue:o.target.call(o.that,o.data.value)}})}overrideReferrer(){this.ctx.overrideDescriptor(this.docProto,"referrer",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("referrer",i),i.intercepted?i.returnValue:i.data.value}})}overrideCreateTreeWalker(){this.ctx.override(this.docProto,"createTreeWalker",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o,s=4294967295,n,a]=i;const h=new e({root:o,show:s,filter:n,expandEntityReferences:a},t,r);return this.emit("createTreeWalker",h),h.intercepted?h.returnValue:h.target.call(h.that,h.data.root,h.data.show,h.data.filter,h.data.expandEntityReferences)}))}overrideWrite(){this.ctx.override(this.docProto,"write",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[...o]=i;const s=new e({html:o},t,r);return this.emit("write",s),s.intercepted?s.returnValue:s.target.apply(s.that,s.data.html)})),this.ctx.override(this.docProto,"writeln",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[...o]=i;const s=new e({html:o},t,r);return this.emit("writeln",s),s.intercepted?s.returnValue:s.target.apply(s.that,s.data.html)}))}overrideDocumentURI(){this.ctx.overrideDescriptor(this.docProto,"documentURI",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("documentURI",i),i.intercepted?i.returnValue:i.data.value}})}overrideURL(){this.ctx.overrideDescriptor(this.docProto,"URL",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("url",i),i.intercepted?i.returnValue:i.data.value}})}overrideCookie(){this.ctx.overrideDescriptor(this.docProto,"cookie",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("getCookie",i),i.intercepted?i.returnValue:i.data.value},set:(t,r,[i])=>{const o=new e({value:i},t,r);return this.emit("setCookie",o),o.intercepted?o.returnValue:o.target.call(o.that,o.data.value)}})}overrideTitle(){this.ctx.overrideDescriptor(this.docProto,"title",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("getTitle",i),i.intercepted?i.returnValue:i.data.value},set:(t,r,[i])=>{const o=new e({value:i},t,r);return this.emit("setTitle",o),o.intercepted?o.returnValue:o.target.call(o.that,o.data.value)}})}};const o=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.Audio=this.window.Audio,this.Element=this.window.Element,this.elemProto=this.Element?this.Element.prototype:{},this.innerHTML=t.nativeMethods.getOwnPropertyDescriptor(this.elemProto,"innerHTML"),this.outerHTML=t.nativeMethods.getOwnPropertyDescriptor(this.elemProto,"outerHTML"),this.setAttribute=this.elemProto.setAttribute,this.getAttribute=this.elemProto.getAttribute,this.removeAttribute=this.elemProto.removeAttribute,this.hasAttribute=this.elemProto.hasAttribute,this.querySelector=this.elemProto.querySelector,this.querySelectorAll=this.elemProto.querySelectorAll,this.insertAdjacentHTML=this.elemProto.insertAdjacentHTML,this.insertAdjacentText=this.elemProto.insertAdjacentText}overrideQuerySelector(){this.ctx.override(this.elemProto,"querySelector",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({selectors:o},t,r);return this.emit("querySelector",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.selectors)}))}overrideAttribute(){this.ctx.override(this.elemProto,"getAttribute",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({name:o},t,r);return this.emit("getAttribute",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.name)})),this.ctx.override(this.elemProto,"setAttribute",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s]=i;const n=new e({name:o,value:s},t,r);return this.emit("setAttribute",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.name,n.data.value)})),this.ctx.override(this.elemProto,"hasAttribute",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({name:o},t,r);return this.emit("hasAttribute",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.name)})),this.ctx.override(this.elemProto,"removeAttribute",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({name:o},t,r);return this.emit("removeAttribute",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.name)}))}overrideAudio(){this.ctx.override(this.window,"Audio",((t,r,i)=>{if(!i.length)return new t(...i);let[o]=i;const s=new e({url:o},t,r);return this.emit("audio",s),s.intercepted?s.returnValue:new s.target(s.data.url)}),!0)}overrideHtml(){this.hookProperty(this.Element,"innerHTML",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("getInnerHTML",i),i.intercepted?i.returnValue:i.data.value},set:(t,r,[i])=>{const o=new e({value:i},t,r);if(this.emit("setInnerHTML",o),o.intercepted)return o.returnValue;t.call(r,o.data.value)}}),this.hookProperty(this.Element,"outerHTML",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("getOuterHTML",i),i.intercepted?i.returnValue:i.data.value},set:(t,r,[i])=>{const o=new e({value:i},t,r);if(this.emit("setOuterHTML",o),o.intercepted)return o.returnValue;t.call(r,o.data.value)}})}overrideInsertAdjacentHTML(){this.ctx.override(this.elemProto,"insertAdjacentHTML",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s]=i;const n=new e({position:o,html:s},t,r);return this.emit("insertAdjacentHTML",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.position,n.data.html)}))}overrideInsertAdjacentText(){this.ctx.override(this.elemProto,"insertAdjacentText",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s]=i;const n=new e({position:o,text:s},t,r);return this.emit("insertAdjacentText",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.position,n.data.text)}))}hookProperty(t,e,r){if(!t)return!1;if(this.ctx.nativeMethods.isArray(t)){for(const i of t)this.hookProperty(i,e,r);return!0}const i=t.prototype;return this.ctx.overrideDescriptor(i,e,r),!0}};const s=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.Node=t.window.Node||{},this.nodeProto=this.Node.prototype||{},this.compareDocumentPosition=this.nodeProto.compareDocumentPosition,this.contains=this.nodeProto.contains,this.insertBefore=this.nodeProto.insertBefore,this.replaceChild=this.nodeProto.replaceChild,this.append=this.nodeProto.append,this.appendChild=this.nodeProto.appendChild,this.removeChild=this.nodeProto.removeChild,this.textContent=t.nativeMethods.getOwnPropertyDescriptor(this.nodeProto,"textContent"),this.parentNode=t.nativeMethods.getOwnPropertyDescriptor(this.nodeProto,"parentNode"),this.parentElement=t.nativeMethods.getOwnPropertyDescriptor(this.nodeProto,"parentElement"),this.childNodes=t.nativeMethods.getOwnPropertyDescriptor(this.nodeProto,"childNodes"),this.baseURI=t.nativeMethods.getOwnPropertyDescriptor(this.nodeProto,"baseURI"),this.previousSibling=t.nativeMethods.getOwnPropertyDescriptor(this.nodeProto,"previousSibling"),this.ownerDocument=t.nativeMethods.getOwnPropertyDescriptor(this.nodeProto,"ownerDocument")}overrideTextContent(){this.ctx.overrideDescriptor(this.nodeProto,"textContent",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("getTextContent",i),i.intercepted?i.returnValue:i.data.value},set:(t,r,[i])=>{const o=new e({value:i},t,r);if(this.emit("setTextContent",o),o.intercepted)return o.returnValue;t.call(r,o.data.value)}})}overrideAppend(){this.ctx.override(this.nodeProto,"append",((t,r,[...i])=>{const o=new e({nodes:i},t,r);return this.emit("append",o),o.intercepted?o.returnValue:o.target.call(o.that,o.data.nodes)})),this.ctx.override(this.nodeProto,"appendChild",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({node:o},t,r);return this.emit("appendChild",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.node)}))}overrideBaseURI(){this.ctx.overrideDescriptor(this.nodeProto,"baseURI",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("baseURI",i),i.intercepted?i.returnValue:i.data.value}})}overrideParent(){this.ctx.overrideDescriptor(this.nodeProto,"parentNode",{get:(t,r)=>{const i=new e({node:t.call(r)},t,r);return this.emit("parentNode",i),i.intercepted?i.returnValue:i.data.node}}),this.ctx.overrideDescriptor(this.nodeProto,"parentElement",{get:(t,r)=>{const i=new e({element:t.call(r)},t,r);return this.emit("parentElement",i),i.intercepted?i.returnValue:i.data.node}})}overrideOwnerDocument(){this.ctx.overrideDescriptor(this.nodeProto,"ownerDocument",{get:(t,r)=>{const i=new e({document:t.call(r)},t,r);return this.emit("ownerDocument",i),i.intercepted?i.returnValue:i.data.document}})}overrideCompareDocumentPosit1ion(){this.ctx.override(this.nodeProto,"compareDocumentPosition",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({node:o},t,r);return s.intercepted?s.returnValue:s.target.call(s.that,s.data.node)}))}overrideChildMethods(){this.ctx.override(this.nodeProto,"removeChild")}};const n=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.Attr=this.window.Attr||{},this.attrProto=this.Attr.prototype||{},this.value=t.nativeMethods.getOwnPropertyDescriptor(this.attrProto,"value"),this.name=t.nativeMethods.getOwnPropertyDescriptor(this.attrProto,"name"),this.getNamedItem=this.attrProto.getNamedItem||null,this.setNamedItem=this.attrProto.setNamedItem||null,this.removeNamedItem=this.attrProto.removeNamedItem||null,this.getNamedItemNS=this.attrProto.getNamedItemNS||null,this.setNamedItemNS=this.attrProto.setNamedItemNS||null,this.removeNamedItemNS=this.attrProto.removeNamedItemNS||null,this.item=this.attrProto.item||null}overrideNameValue(){this.ctx.overrideDescriptor(this.attrProto,"name",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("name",i),i.intercepted?i.returnValue:i.data.value}}),this.ctx.overrideDescriptor(this.attrProto,"value",{get:(t,r)=>{const i=new e({name:this.name.get.call(r),value:t.call(r)},t,r);return this.emit("getValue",i),i.intercepted?i.returnValue:i.data.value},set:(t,r,[i])=>{const o=new e({name:this.name.get.call(r),value:i},t,r);if(this.emit("setValue",o),o.intercepted)return o.returnValue;o.target.call(o.that,o.data.value)}})}overrideItemMethods(){this.ctx.override(this.attrProto,"getNamedItem",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({name:o},t,r);return this.emit("getNamedItem",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.name)})),this.ctx.override(this.attrProto,"setNamedItem",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s]=i;const n=new e({name:o,value:s},t,r);return this.emit("setNamedItem",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.name,n.data.value)})),this.ctx.override(this.attrProto,"removeNamedItem",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({name:o},t,r);return this.emit("removeNamedItem",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.name)})),this.ctx.override(this.attrProto,"item",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({index:o},t,r);return this.emit("item",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.name)})),this.ctx.override(this.attrProto,"getNamedItemNS",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s]=i;const n=new e({namespace:o,localName:s},t,r);return this.emit("getNamedItemNS",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.namespace,n.data.localName)})),this.ctx.override(this.attrProto,"setNamedItemNS",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({attr:o},t,r);return this.emit("setNamedItemNS",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.name)})),this.ctx.override(this.attrProto,"removeNamedItemNS",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s]=i;const n=new e({namespace:o,localName:s},t,r);return this.emit("removeNamedItemNS",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.namespace,n.data.localName)}))}};const a=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.Function=this.window.Function,this.fnProto=this.Function.prototype,this.toString=this.fnProto.toString,this.fnStrings=t.fnStrings,this.call=this.fnProto.call,this.apply=this.fnProto.apply,this.bind=this.fnProto.bind}overrideFunction(){this.ctx.override(this.window,"Function",((t,r,i)=>{if(!i.length)return t.apply(r,i);let o=i[i.length-1],s=[];for(let t=0;t<i.length-1;t++)s.push(i[t]);const n=new e({script:o,args:s},t,r);return this.emit("function",n),n.intercepted?n.returnValue:n.target.call(n.that,...n.data.args,n.data.script)}),!0)}overrideToString(){this.ctx.override(this.fnProto,"toString",((t,r)=>{const i=new e({fn:r},t,r);return this.emit("toString",i),i.intercepted?i.returnValue:i.target.call(i.data.fn)}))}};const h=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.Object=this.window.Object,this.getOwnPropertyDescriptors=this.Object.getOwnPropertyDescriptors,this.getOwnPropertyDescriptor=this.Object.getOwnPropertyDescriptor,this.getOwnPropertyNames=this.Object.getOwnPropertyNames}overrideGetPropertyNames(){this.ctx.override(this.Object,"getOwnPropertyNames",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({names:t.call(r,o)},t,r);return this.emit("getOwnPropertyNames",s),s.intercepted?s.returnValue:s.data.names}))}overrideGetOwnPropertyDescriptors(){this.ctx.override(this.Object,"getOwnPropertyDescriptors",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({descriptors:t.call(r,o)},t,r);return this.emit("getOwnPropertyDescriptors",s),s.intercepted?s.returnValue:s.data.descriptors}))}};const l=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.fetch=this.window.fetch,this.Request=this.window.Request,this.Response=this.window.Response,this.Headers=this.window.Headers,this.reqProto=this.Request?this.Request.prototype:{},this.resProto=this.Response?this.Response.prototype:{},this.headersProto=this.Headers?this.Headers.prototype:{},this.reqUrl=t.nativeMethods.getOwnPropertyDescriptor(this.reqProto,"url"),this.resUrl=t.nativeMethods.getOwnPropertyDescriptor(this.resProto,"url"),this.reqHeaders=t.nativeMethods.getOwnPropertyDescriptor(this.reqProto,"headers"),this.resHeaders=t.nativeMethods.getOwnPropertyDescriptor(this.resProto,"headers")}override(){return this.overrideRequest(),this.overrideUrl(),this.overrideHeaders(),!0}overrideRequest(){return!!this.fetch&&(this.ctx.override(this.window,"fetch",((t,r,i)=>{if(!i.length||i[0]instanceof this.Request)return t.apply(r,i);let[o,s={}]=i;const n=new e({input:o,options:s},t,r);return this.emit("request",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.input,n.data.options)})),this.ctx.override(this.window,"Request",((t,r,i)=>{if(!i.length)return new t(...i);let[o,s={}]=i;const n=new e({input:o,options:s},t);return this.emit("request",n),n.intercepted?n.returnValue:new n.target(n.data.input,n.data.options)}),!0),!0)}overrideUrl(){return this.ctx.overrideDescriptor(this.reqProto,"url",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("requestUrl",i),i.intercepted?i.returnValue:i.data.value}}),this.ctx.overrideDescriptor(this.resProto,"url",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("responseUrl",i),i.intercepted?i.returnValue:i.data.value}}),!0}overrideHeaders(){return!!this.Headers&&(this.ctx.overrideDescriptor(this.reqProto,"headers",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("requestHeaders",i),i.intercepted?i.returnValue:i.data.value}}),this.ctx.overrideDescriptor(this.resProto,"headers",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("responseHeaders",i),i.intercepted?i.returnValue:i.data.value}}),this.ctx.override(this.headersProto,"get",((t,r,[i])=>{if(!i)return t.call(r);const o=new e({name:i,value:t.call(r,i)},t,r);return this.emit("getHeader",o),o.intercepted?o.returnValue:o.data.value})),this.ctx.override(this.headersProto,"set",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s]=i;const n=new e({name:o,value:s},t,r);return this.emit("setHeader",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.name,n.data.value)})),this.ctx.override(this.headersProto,"has",((t,r,i)=>{if(!i.length)return t.call(r);let[o]=i;const s=new e({name:o,value:t.call(r,o)},t,r);return this.emit("hasHeader",s),s.intercepted?s.returnValue:s.data})),this.ctx.override(this.headersProto,"append",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s]=i;const n=new e({name:o,value:s},t,r);return this.emit("appendHeader",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.name,n.data.value)})),this.ctx.override(this.headersProto,"delete",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({name:o},t,r);return this.emit("deleteHeader",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.name)})),!0)}};const c=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.XMLHttpRequest=this.window.XMLHttpRequest,this.xhrProto=this.window.XMLHttpRequest?this.window.XMLHttpRequest.prototype:{},this.open=this.xhrProto.open,this.abort=this.xhrProto.abort,this.send=this.xhrProto.send,this.overrideMimeType=this.xhrProto.overrideMimeType,this.getAllResponseHeaders=this.xhrProto.getAllResponseHeaders,this.getResponseHeader=this.xhrProto.getResponseHeader,this.setRequestHeader=this.xhrProto.setRequestHeader,this.responseURL=t.nativeMethods.getOwnPropertyDescriptor(this.xhrProto,"responseURL"),this.responseText=t.nativeMethods.getOwnPropertyDescriptor(this.xhrProto,"responseText")}override(){this.overrideOpen(),this.overrideSend(),this.overrideMimeType(),this.overrideGetResHeader(),this.overrideGetResHeaders(),this.overrideSetReqHeader()}overrideOpen(){this.ctx.override(this.xhrProto,"open",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s,n=!0,a=null,h=null]=i;const l=new e({method:o,input:s,async:n,user:a,password:h},t,r);return this.emit("open",l),l.intercepted?l.returnValue:l.target.call(l.that,l.data.method,l.data.input,l.data.async,l.data.user,l.data.password)}))}overrideResponseUrl(){this.ctx.overrideDescriptor(this.xhrProto,"responseURL",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("responseUrl",i),i.intercepted?i.returnValue:i.data.value}})}overrideSend(){this.ctx.override(this.xhrProto,"send",((t,r,[i=null])=>{const o=new e({body:i},t,r);return this.emit("send",o),o.intercepted?o.returnValue:o.target.call(o.that,o.data.body)}))}overrideSetReqHeader(){this.ctx.override(this.xhrProto,"setRequestHeader",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s]=i;const n=new e({name:o,value:s},t,r);return this.emit("setReqHeader",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.name,n.data.value)}))}overrideGetResHeaders(){this.ctx.override(this.xhrProto,"getAllResponseHeaders",((t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("getAllResponseHeaders",i),i.intercepted?i.returnValue:i.data.value}))}overrideGetResHeader(){this.ctx.override(this.xhrProto,"getResponseHeader",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({name:o,value:t.call(r,o)},t,r);return s.intercepted?s.returnValue:s.data.value}))}};const d=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.EventSource=this.window.EventSource||{},this.esProto=this.EventSource.prototype||{},this.url=t.nativeMethods.getOwnPropertyDescriptor(this.esProto,"url"),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2}overrideConstruct(){this.ctx.override(this.window,"EventSource",((t,r,i)=>{if(!i.length)return new t(...i);let[o,s={}]=i;const n=new e({url:o,config:s},t,r);return this.emit("construct",n),n.intercepted?n.returnValue:new n.target(n.data.url,n.data.config)}),!0),"EventSource"in this.window&&(this.window.EventSource.CONNECTING=this.CONNECTING,this.window.EventSource.OPEN=this.OPEN,this.window.EventSource.CLOSED=this.CLOSED)}overrideUrl(){this.ctx.overrideDescriptor(this.esProto,"url",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("url",i),i.data.value}})}};const u=class extends t{constructor(t){super(),this.ctx=t,this.window=this.ctx.window,this.History=this.window.History,this.history=this.window.history,this.historyProto=this.History?this.History.prototype:{},this.pushState=this.historyProto.pushState,this.replaceState=this.historyProto.replaceState,this.go=this.historyProto.go,this.back=this.historyProto.back,this.forward=this.historyProto.forward}override(){this.overridePushState(),this.overrideReplaceState(),this.overrideGo(),this.overrideForward(),this.overrideBack()}overridePushState(){this.ctx.override(this.historyProto,"pushState",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s,n=""]=i;const a=new e({state:o,title:s,url:n},t,r);return this.emit("pushState",a),a.intercepted?a.returnValue:a.target.call(a.that,a.data.state,a.data.title,a.data.url)}))}overrideReplaceState(){this.ctx.override(this.historyProto,"replaceState",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s,n=""]=i;const a=new e({state:o,title:s,url:n},t,r);return this.emit("replaceState",a),a.intercepted?a.returnValue:a.target.call(a.that,a.data.state,a.data.title,a.data.url)}))}overrideGo(){this.ctx.override(this.historyProto,"go",((t,r,[i])=>{const o=new e({delta:i},t,r);return this.emit("go",o),o.intercepted?o.returnValue:o.target.call(o.that,o.data.delta)}))}overrideForward(){this.ctx.override(this.historyProto,"forward",((t,r)=>{const i=new e(null,t,r);return this.emit("forward",i),i.intercepted?i.returnValue:i.target.call(i.that)}))}overrideBack(){this.ctx.override(this.historyProto,"back",((t,r)=>{const i=new e(null,t,r);return this.emit("back",i),i.intercepted?i.returnValue:i.target.call(i.that)}))}};const p=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.location=this.window.location,this.WorkerLocation=this.ctx.worker?this.window.WorkerLocation:null,this.workerLocProto=this.WorkerLocation?this.WorkerLocation.prototype:{},this.keys=["href","protocol","host","hostname","port","pathname","search","hash","origin"],this.HashChangeEvent=this.window.HashChangeEvent||null,this.href=this.WorkerLocation?t.nativeMethods.getOwnPropertyDescriptor(this.workerLocProto,"href"):t.nativeMethods.getOwnPropertyDescriptor(this.location,"href")}overrideWorkerLocation(t){if(!this.WorkerLocation)return!1;const e=this;for(const r of this.keys)this.ctx.overrideDescriptor(this.workerLocProto,r,{get:()=>t(e.href.get.call(this.location))[r]});return!0}emulate(t,e){const r={},i=this;for(const o of i.keys)this.ctx.nativeMethods.defineProperty(r,o,{get:()=>t(i.href.get.call(i.location))[o],set:"origin"!==o?function(t){switch(o){case"href":i.location.href=e(t);break;case"hash":i.emit("hashchange",r.href,t.trim().startsWith("#")?new URL(t.trim(),r.href).href:new URL("#"+t.trim(),r.href).href,i);break;default:{const s=new URL(r.href);s[o]=t,i.location.href=e(s.href)}}}:void 0,configurable:!1,enumerable:!0});return"reload"in this.location&&this.ctx.nativeMethods.defineProperty(r,"reload",{value:this.ctx.wrap(this.location,"reload",((t,e)=>t.call(e===r?this.location:e))),writable:!1,enumerable:!0}),"replace"in this.location&&this.ctx.nativeMethods.defineProperty(r,"replace",{value:this.ctx.wrap(this.location,"assign",((t,i,o)=>{o.length&&i===r||t.call(i),i=this.location;let[s]=o;const n=new URL(s,r.href);return t.call(i===r?this.location:i,e(n.href))})),writable:!1,enumerable:!0}),"assign"in this.location&&this.ctx.nativeMethods.defineProperty(r,"assign",{value:this.ctx.wrap(this.location,"assign",((t,i,o)=>{o.length&&i===r||t.call(i),i=this.location;let[s]=o;const n=new URL(s,r.href);return t.call(i===r?this.location:i,e(n.href))})),writable:!1,enumerable:!0}),"ancestorOrigins"in this.location&&this.ctx.nativeMethods.defineProperty(r,"ancestorOrigins",{get(){const t=[];return i.window.DOMStringList&&i.ctx.nativeMethods.setPrototypeOf(t,i.window.DOMStringList.prototype),t},set:void 0,enumerable:!0}),this.ctx.nativeMethods.defineProperty(r,"toString",{value:this.ctx.wrap(this.location,"toString",(()=>r.href)),enumerable:!0,writable:!1}),this.ctx.nativeMethods.defineProperty(r,Symbol.toPrimitive,{value:()=>r.href,writable:!1,enumerable:!1}),this.ctx.window.Location&&this.ctx.nativeMethods.setPrototypeOf(r,this.ctx.window.Location.prototype),r}};const w=class extends t{constructor(t){super(),this.ctx=t,this.window=this.ctx.window,this.postMessage=this.window.postMessage,this.MessageEvent=this.window.MessageEvent||{},this.MessagePort=this.window.MessagePort||{},this.mpProto=this.MessagePort.prototype||{},this.mpPostMessage=this.mpProto.postMessage,this.messageProto=this.MessageEvent.prototype||{},this.messageData=t.nativeMethods.getOwnPropertyDescriptor(this.messageProto,"data"),this.messageOrigin=t.nativeMethods.getOwnPropertyDescriptor(this.messageProto,"origin")}overridePostMessage(){this.ctx.override(this.window,"postMessage",((t,r,i)=>{if(!i.length)return t.apply(r,i);let o,s,n;this.ctx.worker?[o,n=[]]=i:[o,s,n=[]]=i;const a=new e({message:o,origin:s,transfer:n,worker:this.ctx.worker},t,r);return this.emit("postMessage",a),a.intercepted?a.returnValue:this.ctx.worker?a.target.call(a.that,a.data.message,a.data.transfer):a.target.call(a.that,a.data.message,a.data.origin,a.data.transfer)}))}wrapPostMessage(t,r,i=!1){return this.ctx.wrap(t,r,((r,o,s)=>{if(this.ctx.worker?!s.length:2>s)return r.apply(o,s);let n,a,h;i?([n,h=[]]=s,a=null):[n,a,h=[]]=s;const l=new e({message:n,origin:a,transfer:h,worker:this.ctx.worker},r,t);return this.emit("postMessage",l),l.intercepted?l.returnValue:i?l.target.call(l.that,l.data.message,l.data.transfer):l.target.call(l.that,l.data.message,l.data.origin,l.data.transfer)}))}overrideMessageOrigin(){this.ctx.overrideDescriptor(this.messageProto,"origin",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("origin",i),i.intercepted?i.returnValue:i.data.value}})}overrideMessageData(){this.ctx.overrideDescriptor(this.messageProto,"data",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("data",i),i.intercepted?i.returnValue:i.data.value}})}};const v=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.navigator=this.window.navigator,this.Navigator=this.window.Navigator||{},this.navProto=this.Navigator.prototype||{},this.sendBeacon=this.navProto.sendBeacon}overrideSendBeacon(){this.ctx.override(this.navProto,"sendBeacon",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o,s=""]=i;const n=new e({url:o,data:s},t,r);return this.emit("sendBeacon",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.url,n.data.data)}))}};const m=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.Worker=this.window.Worker||{},this.Worklet=this.window.Worklet||{},this.workletProto=this.Worklet.prototype||{},this.workerProto=this.Worker.prototype||{},this.postMessage=this.workerProto.postMessage,this.terminate=this.workerProto.terminate,this.addModule=this.workletProto.addModule}overrideWorker(){this.ctx.override(this.window,"Worker",((t,r,i)=>{if(!i.length)return new t(...i);let[o,s={}]=i;const n=new e({url:o,options:s},t,r);return this.emit("worker",n),n.intercepted?n.returnValue:new n.target(...[n.data.url,n.data.options])}),!0)}overrideAddModule(){this.ctx.override(this.workletProto,"addModule",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o,s={}]=i;const n=new e({url:o,options:s},t,r);return this.emit("addModule",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.url,n.data.options)}))}overridePostMessage(){this.ctx.override(this.workerProto,"postMessage",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o,s=[]]=i;const n=new e({message:o,transfer:s},t,r);return this.emit("postMessage",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.message,n.data.transfer)}))}overrideImportScripts(){this.ctx.override(this.window,"importScripts",((t,r,i)=>{if(!i.length)return t.apply(r,i);const o=new e({scripts:i},t,r);return this.emit("importScripts",o),o.intercepted?o.returnValue:o.target.apply(o.that,o.data.scripts)}))}};const g=class extends t{constructor(t){super(),this.ctx=t,this.window=this.ctx.window,this.URL=this.window.URL||{},this.createObjectURL=this.URL.createObjectURL,this.revokeObjectURL=this.URL.revokeObjectURL}overrideObjectURL(){this.ctx.override(this.URL,"createObjectURL",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({object:o},t,r);return this.emit("createObjectURL",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.object)})),this.ctx.override(this.URL,"revokeObjectURL",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({url:o},t,r);return this.emit("revokeObjectURL",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.url)}))}};const y=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.localStorage=this.window.localStorage||null,this.sessionStorage=this.window.sessionStorage||null,this.Storage=this.window.Storage||{},this.storeProto=this.Storage.prototype||{},this.getItem=this.storeProto.getItem||null,this.setItem=this.storeProto.setItem||null,this.removeItem=this.storeProto.removeItem||null,this.clear=this.storeProto.clear||null,this.key=this.storeProto.key||null,this.methods=["key","getItem","setItem","removeItem","clear"],this.wrappers=new t.nativeMethods.Map}overrideMethods(){this.ctx.override(this.storeProto,"getItem",((t,r,i)=>{if(!i.length)return t.apply(this.wrappers.get(r)||r,i);let[o]=i;const s=new e({name:o},t,this.wrappers.get(r)||r);return this.emit("getItem",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.name)})),this.ctx.override(this.storeProto,"setItem",((t,r,i)=>{if(2>i.length)return t.apply(this.wrappers.get(r)||r,i);let[o,s]=i;const n=new e({name:o,value:s},t,this.wrappers.get(r)||r);return this.emit("setItem",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.name,n.data.value)})),this.ctx.override(this.storeProto,"removeItem",((t,r,i)=>{if(!i.length)return t.apply(this.wrappers.get(r)||r,i);let[o]=i;const s=new e({name:o},t,this.wrappers.get(r)||r);return this.emit("removeItem",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.name)})),this.ctx.override(this.storeProto,"clear",((t,r)=>{const i=new e(null,t,this.wrappers.get(r)||r);return this.emit("clear",i),i.intercepted?i.returnValue:i.target.call(i.that)})),this.ctx.override(this.storeProto,"key",((t,r,i)=>{if(!i.length)return t.apply(this.wrappers.get(r)||r,i);let[o]=i;const s=new e({index:o},t,this.wrappers.get(r)||r);return this.emit("key",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.index)}))}overrideLength(){this.ctx.overrideDescriptor(this.storeProto,"length",{get:(t,r)=>{const i=new e({length:t.call(this.wrappers.get(r)||r)},t,this.wrappers.get(r)||r);return this.emit("length",i),i.intercepted?i.returnValue:i.data.length}})}emulate(t,r={}){this.ctx.nativeMethods.setPrototypeOf(r,this.storeProto);const i=new this.ctx.window.Proxy(r,{get:(r,i)=>{if(i in this.storeProto||"symbol"==typeof i)return t[i];const o=new e({name:i},null,t);return this.emit("get",o),o.intercepted?o.returnValue:t[o.data.name]},set:(r,i,o)=>{if(i in this.storeProto||"symbol"==typeof i)return t[i]=o;const s=new e({name:i,value:o},null,t);return this.emit("set",s),s.intercepted?s.returnValue:t[s.data.name]=s.data.value},deleteProperty:(r,i)=>{if("symbol"==typeof i)return delete t[i];const o=new e({name:i},null,t);return this.emit("delete",o),o.intercepted?o.returnValue:delete t[o.data.name]}});return this.wrappers.set(i,t),this.ctx.nativeMethods.setPrototypeOf(i,this.storeProto),i}};const f=class extends t{constructor(t){super(),this.ctx=t,this.window=t.window,this.CSSStyleDeclaration=this.window.CSSStyleDeclaration||{},this.cssStyleProto=this.CSSStyleDeclaration.prototype||{},this.getPropertyValue=this.cssStyleProto.getPropertyValue||null,this.setProperty=this.cssStyleProto.setProperty||null,this.cssText,t.nativeMethods.getOwnPropertyDescriptors(this.cssStyleProto,"cssText"),this.urlProps=["background","backgroundImage","borderImage","borderImageSource","listStyle","listStyleImage","cursor"],this.dashedUrlProps=["background","background-image","border-image","border-image-source","list-style","list-style-image","cursor"],this.propToDashed={background:"background",backgroundImage:"background-image",borderImage:"border-image",borderImageSource:"border-image-source",listStyle:"list-style",listStyleImage:"list-style-image",cursor:"cursor"}}overrideSetGetProperty(){this.ctx.override(this.cssStyleProto,"getPropertyValue",((t,r,i)=>{if(!i.length)return t.apply(r,i);let[o]=i;const s=new e({property:o},t,r);return this.emit("getPropertyValue",s),s.intercepted?s.returnValue:s.target.call(s.that,s.data.property)})),this.ctx.override(this.cssStyleProto,"setProperty",((t,r,i)=>{if(2>i.length)return t.apply(r,i);let[o,s]=i;const n=new e({property:o,value:s},t,r);return this.emit("setProperty",n),n.intercepted?n.returnValue:n.target.call(n.that,n.data.property,n.data.value)}))}overrideCssText(){this.ctx.overrideDescriptor(this.cssStyleProto,"cssText",{get:(t,r)=>{const i=new e({value:t.call(r)},t,r);return this.emit("getCssText",i),i.intercepted?i.returnValue:i.data.value},set:(t,r,[i])=>{const o=new e({value:i},t,r);return this.emit("setCssText",o),o.intercepted?o.returnValue:o.target.call(o.that,o.data.value)}})}};class P extends t{constructor(t=self,e=!t.window){super(),this.window=t,this.nativeMethods={fnToString:this.window.Function.prototype.toString,defineProperty:this.window.Object.defineProperty,getOwnPropertyDescriptor:this.window.Object.getOwnPropertyDescriptor,getOwnPropertyDescriptors:this.window.Object.getOwnPropertyDescriptors,getOwnPropertyNames:this.window.Object.getOwnPropertyNames,keys:this.window.Object.keys,getOwnPropertySymbols:this.window.Object.getOwnPropertySymbols,isArray:this.window.Array.isArray,setPrototypeOf:this.window.Object.setPrototypeOf,isExtensible:this.window.Object.isExtensible,Map:this.window.Map,Proxy:this.window.Proxy},this.worker=e,this.fetch=new l(this),this.xhr=new c(this),this.history=new u(this),this.element=new o(this),this.node=new s(this),this.document=new i(this),this.function=new a(this),this.object=new h(this),this.message=new w(this),this.navigator=new v(this),this.eventSource=new d(this),this.attribute=new n(this),this.url=new g(this),this.workers=new m(this),this.location=new p(this),this.storage=new y(this),this.style=new f(this)}initLocation(t,e){this.location=new p(this,e,t,this.worker)}override(t,e,r,i){const o=this.wrap(t,e,r,i);return t[e]=o}overrideDescriptor(t,e,r={}){const i=this.wrapDescriptor(t,e,r);return i?(this.nativeMethods.defineProperty(t,e,i),i):{}}wrap(t,e,r,i){const o=t[e];if(!o)return o;const s="prototype"in o?function(){return r(o,this,[...arguments])}:{attach(){return r(o,this,[...arguments])}}.attach;return i&&(s.prototype=o.prototype,s.prototype.constructor=s),this.emit("wrap",o,s,!!i),s}wrapDescriptor(t,e,r={}){const i=this.nativeMethods.getOwnPropertyDescriptor(t,e);if(!i)return!1;for(let t in r)t in i&&(i[t]="get"===t||"set"===t?this.wrap(i,t,r[t]):"function"==typeof r[t]?r[t](i[t]):r[t]);return i}}"object"==typeof self&&(self.UVClient=P)})()})(); | ||
//# sourceMappingURL=uv.client.js.map |
@@ -1,2 +0,2 @@ | ||
(()=>{"use strict";const e=globalThis.Ultraviolet,t=globalThis.UVClient;function a(r,o={},n="/bare/"){if("__uv"in r&&r.__uv instanceof e)return!1;r.document&&r.window&&r.document.querySelectorAll("script[__uv-script]").forEach((e=>e.remove()));const i=!r.window,s="__uv",l="__uv$",c=new e(o);"function"==typeof o.construct&&o.construct(c,i?"worker":"window");const d=new t(r),{HTMLMediaElement:u,HTMLScriptElement:h,HTMLAudioElement:m,HTMLVideoElement:v,HTMLInputElement:p,HTMLEmbedElement:g,HTMLTrackElement:b,HTMLAnchorElement:f,HTMLIFrameElement:y,HTMLAreaElement:_,HTMLLinkElement:S,HTMLBaseElement:w,HTMLFormElement:k,HTMLImageElement:P,HTMLSourceElement:U}=r;d.nativeMethods.defineProperty(r,"__uv",{value:c,enumerable:!1}),c.meta.origin=location.origin,c.location=d.location.emulate((e=>"about:srcdoc"===e?new URL(e):(e.startsWith("blob:")&&(e=e.slice("blob:".length)),new URL(c.sourceUrl(e)))),(e=>c.rewriteUrl(e))),c.bareData=r.__uv$bareData,c.cookieStr=r.__uv$cookies||"",c.meta.url=c.location,c.domain=c.meta.url.host,c.blobUrls=new r.Map,c.referrer="",c.cookies=[],c.localStorageObj={},c.sessionStorageObj={};try{c.bare=new URL(n,r.location.href)}catch(e){c.bare=r.parent.__uv.bare}const M=new e.BareClient(c.bare,c.bareData);if("about:srcdoc"===c.location.href&&(c.meta=r.parent.__uv.meta),r.EventTarget&&(c.addEventListener=r.EventTarget.prototype.addEventListener,c.removeListener=r.EventTarget.prototype.removeListener,c.dispatchEvent=r.EventTarget.prototype.dispatchEvent),d.nativeMethods.defineProperty(d.storage.storeProto,"__uv$storageObj",{get(){return this===d.storage.sessionStorage?c.sessionStorageObj:this===d.storage.localStorage?c.localStorageObj:void 0},enumerable:!1}),r.localStorage){for(const e in r.localStorage)e.startsWith(l+c.location.origin+"@")&&(c.localStorageObj[e.slice((l+c.location.origin+"@").length)]=r.localStorage.getItem(e));c.lsWrap=d.storage.emulate(d.storage.localStorage,c.localStorageObj)}if(r.sessionStorage){for(const e in r.sessionStorage)e.startsWith(l+c.location.origin+"@")&&(c.sessionStorageObj[e.slice((l+c.location.origin+"@").length)]=r.sessionStorage.getItem(e));c.ssWrap=d.storage.emulate(d.storage.sessionStorage,c.sessionStorageObj)}let x=r.document?d.node.baseURI.get.call(r.document):r.location.href,E=c.sourceUrl(x);d.nativeMethods.defineProperty(c.meta,"base",{get:()=>r.document?(d.node.baseURI.get.call(r.document)!==x&&(x=d.node.baseURI.get.call(r.document),E=c.sourceUrl(x)),E):c.meta.url.href}),c.methods={setSource:"__uv$setSource",source:"__uv$source",location:"__uv$location",function:"__uv$function",string:"__uv$string",eval:"__uv$eval",parent:"__uv$parent",top:"__uv$top"},c.filterKeys=[s,c.methods.setSource,c.methods.source,c.methods.location,c.methods.function,c.methods.string,c.methods.eval,c.methods.parent,c.methods.top,"__uv$protocol","__uv$storageObj","__uv$url","__uv$modifiedStyle","__uv$config","__uv$dispatched","Ultraviolet","__uvHook"],d.on("wrap",((e,t)=>{d.nativeMethods.defineProperty(t,"name",d.nativeMethods.getOwnPropertyDescriptor(e,"name")),d.nativeMethods.defineProperty(t,"length",d.nativeMethods.getOwnPropertyDescriptor(e,"length")),d.nativeMethods.defineProperty(t,c.methods.string,{enumerable:!1,value:d.nativeMethods.fnToString.call(e)}),d.nativeMethods.defineProperty(t,c.methods.function,{enumerable:!1,value:e})})),d.fetch.on("request",(e=>{e.data.input=c.rewriteUrl(e.data.input)})),d.fetch.on("requestUrl",(e=>{e.data.value=c.sourceUrl(e.data.value)})),d.fetch.on("responseUrl",(e=>{e.data.value=c.sourceUrl(e.data.value)})),d.xhr.on("open",(e=>{e.data.input=c.rewriteUrl(e.data.input)})),d.xhr.on("responseUrl",(e=>{e.data.value=c.sourceUrl(e.data.value)})),d.workers.on("worker",(e=>{e.data.url=c.rewriteUrl(e.data.url)})),d.workers.on("addModule",(e=>{e.data.url=c.rewriteUrl(e.data.url)})),d.workers.on("importScripts",(e=>{for(const t in e.data.scripts)e.data.scripts[t]=c.rewriteUrl(e.data.scripts[t])})),d.workers.on("postMessage",(e=>{let t=e.data.origin;e.data.origin="*",e.data.message={__data:e.data.message,__origin:c.meta.url.origin,__to:t}})),d.navigator.on("sendBeacon",(e=>{e.data.url=c.rewriteUrl(e.data.url)})),d.document.on("getCookie",(e=>{e.data.value=c.cookieStr})),d.document.on("setCookie",(e=>{Promise.resolve(c.cookie.setCookies(e.data.value,c.db,c.meta)).then((()=>{c.cookie.db().then((e=>{c.cookie.getCookies(e).then((e=>{c.cookieStr=c.cookie.serialize(e,c.meta,!0)}))}))}));const t=c.cookie.setCookie(e.data.value)[0];t.path||(t.path="/"),t.domain||(t.domain=c.meta.url.hostname),c.cookie.validateCookie(t,c.meta,!0)&&(c.cookieStr.length&&(c.cookieStr+="; "),c.cookieStr+=`${t.name}=${t.value}`),e.respondWith(e.data.value)})),d.element.on("setInnerHTML",(e=>{switch(e.that.tagName){case"SCRIPT":e.data.value=c.js.rewrite(e.data.value);break;case"STYLE":e.data.value=c.rewriteCSS(e.data.value);break;default:e.data.value=c.rewriteHtml(e.data.value)}})),d.element.on("getInnerHTML",(e=>{if("SCRIPT"===e.that.tagName)e.data.value=c.js.source(e.data.value);else e.data.value=c.sourceHtml(e.data.value)})),d.element.on("setOuterHTML",(e=>{e.data.value=c.rewriteHtml(e.data.value,{document:"HTML"===e.that.tagName})})),d.element.on("getOuterHTML",(e=>{switch(e.that.tagName){case"HEAD":e.data.value=c.sourceHtml(e.data.value.replace(/<head(.*)>(.*)<\/head>/s,"<op-head$1>$2</op-head>")).replace(/<op-head(.*)>(.*)<\/op-head>/s,"<head$1>$2</head>");break;case"BODY":e.data.value=c.sourceHtml(e.data.value.replace(/<body(.*)>(.*)<\/body>/s,"<op-body$1>$2</op-body>")).replace(/<op-body(.*)>(.*)<\/op-body>/s,"<body$1>$2</body>");break;default:e.data.value=c.sourceHtml(e.data.value,{document:"HTML"===e.that.tagName})}})),d.document.on("write",(e=>{if(!e.data.html.length)return!1;e.data.html=[c.rewriteHtml(e.data.html.join(""))]})),d.document.on("writeln",(e=>{if(!e.data.html.length)return!1;e.data.html=[c.rewriteHtml(e.data.html.join(""))]})),d.element.on("insertAdjacentHTML",(e=>{e.data.html=c.rewriteHtml(e.data.html)})),d.eventSource.on("construct",(e=>{e.data.url=c.rewriteUrl(e.data.url)})),d.eventSource.on("url",(e=>{e.data.url=c.rewriteUrl(e.data.url)})),d.history.on("replaceState",(e=>{e.data.url&&(e.data.url=c.rewriteUrl(e.data.url,"__uv"in e.that?e.that.__uv.meta:c.meta))})),d.history.on("pushState",(e=>{e.data.url&&(e.data.url=c.rewriteUrl(e.data.url,"__uv"in e.that?e.that.__uv.meta:c.meta))})),d.element.on("getAttribute",(e=>{d.element.hasAttribute.call(e.that,c.attributePrefix+"-attr-"+e.data.name)&&e.respondWith(e.target.call(e.that,c.attributePrefix+"-attr-"+e.data.name))})),d.message.on("postMessage",(e=>{let t=e.data.origin,a=c.call;e.that&&(a=e.that.__uv$source.call),e.data.origin="*",e.data.message={__data:e.data.message,__origin:(e.that||e.target).__uv$source.location.origin,__to:t},e.respondWith(a(e.target,i?[e.data.message,e.data.transfer]:[e.data.message,e.data.origin,e.data.transfer],e.that))})),d.message.on("data",(e=>{const{value:t}=e.data;"object"==typeof t&&"__data"in t&&"__origin"in t&&e.respondWith(t.__data)})),d.message.on("origin",(e=>{const t=d.message.messageData.get.call(e.that);"object"==typeof t&&t.__data&&t.__origin&&e.respondWith(t.__origin)})),d.overrideDescriptor(r,"origin",{get:()=>c.location.origin}),d.node.on("baseURI",(e=>{e.data.value.startsWith(r.location.origin)&&(e.data.value=c.sourceUrl(e.data.value))})),d.element.on("setAttribute",(e=>{if(e.that instanceof u&&"src"===e.data.name&&e.data.value.startsWith("blob:"))return e.target.call(e.that,c.attributePrefix+"-attr-"+e.data.name,e.data.value),void(e.data.value=c.blobUrls.get(e.data.value));c.attrs.isUrl(e.data.name)&&(e.target.call(e.that,c.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=c.rewriteUrl(e.data.value)),c.attrs.isStyle(e.data.name)&&(e.target.call(e.that,c.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=c.rewriteCSS(e.data.value,{context:"declarationList"})),c.attrs.isHtml(e.data.name)&&(e.target.call(e.that,c.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=c.rewriteHtml(e.data.value,{...c.meta,document:!0,injectHead:c.createHtmlInject(c.handlerScript,c.bundleScript,c.clientScript,c.configScript,c.bareData,c.cookieStr,r.location.href)})),c.attrs.isSrcset(e.data.name)&&(e.target.call(e.that,c.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=c.html.wrapSrcset(e.data.value.toString())),c.attrs.isForbidden(e.data.name)&&(e.data.name=c.attributePrefix+"-attr-"+e.data.name)})),d.element.on("audio",(e=>{e.data.url=c.rewriteUrl(e.data.url)})),d.element.hookProperty([f,_,S,w],"href",{get:(e,t)=>c.sourceUrl(e.call(t)),set:(e,t,[a])=>{d.element.setAttribute.call(t,c.attributePrefix+"-attr-href",a),e.call(t,c.rewriteUrl(a))}}),d.element.hookProperty([h,m,v,u,P,p,g,y,b,U],"src",{get:(e,t)=>c.sourceUrl(e.call(t)),set:(e,t,[a])=>{if(new String(a).toString().trim().startsWith("blob:")&&t instanceof u)return d.element.setAttribute.call(t,c.attributePrefix+"-attr-src",a),e.call(t,c.blobUrls.get(a)||a);d.element.setAttribute.call(t,c.attributePrefix+"-attr-src",a),e.call(t,c.rewriteUrl(a))}}),d.element.hookProperty([k],"action",{get:(e,t)=>c.sourceUrl(e.call(t)),set:(e,t,[a])=>{d.element.setAttribute.call(t,c.attributePrefix+"-attr-action",a),e.call(t,c.rewriteUrl(a))}}),d.element.hookProperty([P],"srcset",{get:(e,t)=>d.element.getAttribute.call(t,c.attributePrefix+"-attr-srcset")||e.call(t),set:(e,t,[a])=>{d.element.setAttribute.call(t,c.attributePrefix+"-attr-srcset",a),e.call(t,c.html.wrapSrcset(a.toString()))}}),d.element.hookProperty(h,"integrity",{get:(e,t)=>d.element.getAttribute.call(t,c.attributePrefix+"-attr-integrity"),set:(e,t,[a])=>{d.element.setAttribute.call(t,c.attributePrefix+"-attr-integrity",a)}}),d.element.hookProperty(y,"sandbox",{get:(e,t)=>d.element.getAttribute.call(t,c.attributePrefix+"-attr-sandbox")||e.call(t),set:(e,t,[a])=>{d.element.setAttribute.call(t,c.attributePrefix+"-attr-sandbox",a)}});const $=y&&Object.getOwnPropertyDescriptor(y.prototype,"contentWindow").get;function T(e){const t=$.call(e);try{t.__uv$bareData=c.bareData,t.__uv$cookies=c.cookieStr,t.__uv||a(t,o,n)}catch(e){console.error("catastrophic failure"),console.error(e)}}function j(e,t){const a=`on${t}`,r=new WeakMap;Reflect.defineProperty(e,a,{enumerable:!0,configurable:!0,get(){return r.has(this)?r.get(this):null},set(e){"function"==typeof e&&(r.has(this)&&this.removeEventListener(t,r.get(this)),r.set(this,e),this.addEventListener(t,e))}})}d.element.hookProperty(y,"contentWindow",{get:(e,t)=>(T(t),e.call(t))}),d.element.hookProperty(y,"contentDocument",{get:(e,t)=>(T(t),e.call(t))}),d.element.hookProperty(y,"srcdoc",{get:(e,t)=>d.element.getAttribute.call(t,c.attributePrefix+"-attr-srcdoc")||e.call(t),set:(e,t,[a])=>{e.call(t,c.rewriteHtml(a,{document:!0,injectHead:c.createHtmlInject(c.handlerScript,c.bundleScript,c.clientScript,c.configScript,c.bareData,c.cookieStr,r.location.href)}))}}),d.node.on("getTextContent",(e=>{"SCRIPT"===e.that.tagName&&(e.data.value=c.js.source(e.data.value))})),d.node.on("setTextContent",(e=>{"SCRIPT"===e.that.tagName&&(e.data.value=c.js.rewrite(e.data.value))})),"serviceWorker"in r.navigator&&delete r.Navigator.prototype.serviceWorker,d.document.on("getDomain",(e=>{e.data.value=c.domain})),d.document.on("setDomain",(e=>{if(!e.data.value.toString().endsWith(c.meta.url.hostname.split(".").slice(-2).join(".")))return e.respondWith("");e.respondWith(c.domain=e.data.value)})),d.document.on("url",(e=>{e.data.value=c.location.href})),d.document.on("documentURI",(e=>{e.data.value=c.location.href})),d.document.on("referrer",(e=>{e.data.value=c.referrer||c.sourceUrl(e.data.value)})),d.document.on("parseFromString",(e=>{if("text/html"!==e.data.type)return!1;e.data.string=c.rewriteHtml(e.data.string,{...c.meta,document:!0})})),d.attribute.on("getValue",(e=>{d.element.hasAttribute.call(e.that.ownerElement,c.attributePrefix+"-attr-"+e.data.name)&&(e.data.value=d.element.getAttribute.call(e.that.ownerElement,c.attributePrefix+"-attr-"+e.data.name))})),d.attribute.on("setValue",(e=>{c.attrs.isUrl(e.data.name)&&(d.element.setAttribute.call(e.that.ownerElement,c.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=c.rewriteUrl(e.data.value)),c.attrs.isStyle(e.data.name)&&(d.element.setAttribute.call(e.that.ownerElement,c.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=c.rewriteCSS(e.data.value,{context:"declarationList"})),c.attrs.isHtml(e.data.name)&&(d.element.setAttribute.call(e.that.ownerElement,c.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=c.rewriteHtml(e.data.value,{...c.meta,document:!0,injectHead:c.createHtmlInject(c.handlerScript,c.bundleScript,c.clientScript,c.configScript,c.bareData,c.cookieStr,r.location.href)})),c.attrs.isSrcset(e.data.name)&&(d.element.setAttribute.call(e.that.ownerElement,c.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=c.html.wrapSrcset(e.data.value.toString()))})),d.url.on("createObjectURL",(e=>{let t=e.target.call(e.that,e.data.object);if(t.startsWith("blob:"+location.origin)){let a="blob:"+("about:blank"!==c.meta.url.href?c.meta.url.origin:r.parent.__uv.meta.url.origin)+t.slice("blob:".length+location.origin.length);c.blobUrls.set(a,t),e.respondWith(a)}else e.respondWith(t)})),d.url.on("revokeObjectURL",(e=>{if(c.blobUrls.has(e.data.url)){const t=e.data.url;e.data.url=c.blobUrls.get(e.data.url),c.blobUrls.delete(t)}})),d.storage.on("get",(e=>{e.data.name=l+c.meta.url.origin+"@"+e.data.name})),d.storage.on("set",(e=>{e.that.__uv$storageObj&&(e.that.__uv$storageObj[e.data.name]=e.data.value),e.data.name=l+c.meta.url.origin+"@"+e.data.name})),d.storage.on("delete",(e=>{e.that.__uv$storageObj&&delete e.that.__uv$storageObj[e.data.name],e.data.name=l+c.meta.url.origin+"@"+e.data.name})),d.storage.on("getItem",(e=>{e.data.name=l+c.meta.url.origin+"@"+e.data.name})),d.storage.on("setItem",(e=>{e.that.__uv$storageObj&&(e.that.__uv$storageObj[e.data.name]=e.data.value),e.data.name=l+c.meta.url.origin+"@"+e.data.name})),d.storage.on("removeItem",(e=>{e.that.__uv$storageObj&&delete e.that.__uv$storageObj[e.data.name],e.data.name=l+c.meta.url.origin+"@"+e.data.name})),d.storage.on("clear",(e=>{if(e.that.__uv$storageObj)for(const t of d.nativeMethods.keys.call(null,e.that.__uv$storageObj))delete e.that.__uv$storageObj[t],d.storage.removeItem.call(e.that,l+c.meta.url.origin+"@"+t),e.respondWith()})),d.storage.on("length",(e=>{e.that.__uv$storageObj&&e.respondWith(d.nativeMethods.keys.call(null,e.that.__uv$storageObj).length)})),d.storage.on("key",(e=>{e.that.__uv$storageObj&&e.respondWith(d.nativeMethods.keys.call(null,e.that.__uv$storageObj)[e.data.index]||null)}));const O=["ws:","wss:"];class L extends EventTarget{#e;#t;#a="blob";#r="";#o="";#n="";async#i(e,t){const a={};Reflect.setPrototypeOf(a,null),a.Origin=c.meta.url.origin,a["User-Agent"]=navigator.userAgent,""!==c.cookieStr&&(a.Cookie=c.cookieStr.toString()),this.#e=await M.createWebSocket(e,a,t),this.#e.binaryType=this.#a,this.#e.addEventListener("message",(e=>{this.dispatchEvent(new MessageEvent("message",e))})),this.#e.addEventListener("open",(async e=>{this.dispatchEvent(new Event("open",e))})),this.#e.addEventListener("error",(e=>{this.dispatchEvent(new ErrorEvent("error",e))})),this.#e.addEventListener("close",(e=>{this.dispatchEvent(new Event("close",e))}));const r=await this.#e.meta;r.headers.has("sec-websocket-protocol")&&(this.#r=r.headers.get("sec-websocket-protocol")),r.headers.has("sec-websocket-extensions")&&(this.#o=r.headers.get("sec-websocket-extensions"));let o=r.rawHeaders["set-cookie"]||[];Array.isArray(o)||(o=[]);for(const e of o)document.cookie=e}get url(){return this.#n}constructor(...e){if(super(),!e.length)throw new DOMException("Failed to construct 'WebSocket': 1 argument required, but only 0 present.");const[t,a]=e;let r;try{r=new URL(t)}catch(e){throw new DOMException(`Faiiled to construct 'WebSocket': The URL '${t}' is invalid.`)}if(!O.includes(r.protocol))throw new DOMException(`Failed to construct 'WebSocket': The URL's scheme must be either 'ws' or 'wss'. '${r.protocol}' is not allowed.`);this.#t=this.#i(r,a)}get protocol(){return this.#r}get extensions(){return this.#o}get readyState(){return this.#e?this.#e.readyState:L.CONNECTING}get binaryType(){return this.#a}set binaryType(e){this.#a=e,this.#e&&(this.#e.binaryType=e)}send(e){if(!this.#e)throw new DOMException("Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.");this.#e.send(e)}close(e,t){if(void 0!==e&&("number"!=typeof e&&(e=0),1e3!==e&&(e<3e3||e>4999)))throw new DOMException(`Failed to execute 'close' on 'WebSocket': The code must be either 1000, or between 3000 and 4999. ${e} is neither.`);this.#t.then((()=>this.#e.close(e,t)))}}j(L.prototype,"close"),j(L.prototype,"open"),j(L.prototype,"message"),j(L.prototype,"error");for(const e of["url","protocol","extensions","readyState","binaryType"]){const t=Object.getOwnPropertyDescriptor(r.WebSocket.prototype,e),a=Object.getOwnPropertyDescriptor(L.prototype,e);a?.get&&t?.get&&d.emit("wrap",a.get,t.get),a?.set&&t?.set&&d.emit("wrap",a.get,t.get)}if(d.emit("wrap",r.WebSocket.prototype.send,L.prototype.send),d.emit("wrap",r.WebSocket.prototype.close,L.prototype.close),d.override(r,"WebSocket",((e,t,a)=>new L(...a)),!0),L.prototype.constructor=r.WebSocket,d.function.on("function",(e=>{e.data.script=c.rewriteJS(e.data.script)})),d.function.on("toString",(e=>{c.methods.string in e.that&&e.respondWith(e.that[c.methods.string])})),d.object.on("getOwnPropertyNames",(e=>{e.data.names=e.data.names.filter((e=>!c.filterKeys.includes(e)))})),d.object.on("getOwnPropertyDescriptors",(e=>{for(const t of c.filterKeys)delete e.data.descriptors[t]})),d.style.on("setProperty",(e=>{d.style.dashedUrlProps.includes(e.data.property)&&(e.data.value=c.rewriteCSS(e.data.value,{context:"value",...c.meta}))})),d.style.on("getPropertyValue",(e=>{d.style.dashedUrlProps.includes(e.data.property)&&e.respondWith(c.sourceCSS(e.target.call(e.that,e.data.property),{context:"value",...c.meta}))})),"CSS2Properties"in r)for(const e of d.style.urlProps)d.overrideDescriptor(r.CSS2Properties.prototype,e,{get:(e,t)=>c.sourceCSS(e.call(t),{context:"value",...c.meta}),set:(e,t,a)=>{e.call(t,c.rewriteCSS(a,{context:"value",...c.meta}))}});else"HTMLElement"in r&&d.overrideDescriptor(r.HTMLElement.prototype,"style",{get:(e,t)=>{const a=e.call(t);if(!a.__uv$modifiedStyle)for(const e of d.style.urlProps)d.nativeMethods.defineProperty(a,e,{enumerable:!0,configurable:!0,get(){const t=d.style.getPropertyValue.call(this,e)||"";return c.sourceCSS(t,{context:"value",...c.meta})},set(t){d.style.setProperty.call(this,d.style.propToDashed[e]||e,c.rewriteCSS(t,{context:"value",...c.meta}))}}),d.nativeMethods.defineProperty(a,"__uv$modifiedStyle",{enumerable:!1,value:!0});return a}});d.style.on("setCssText",(e=>{e.data.value=c.rewriteCSS(e.data.value,{context:"declarationList",...c.meta})})),d.style.on("getCssText",(e=>{e.data.value=c.sourceCSS(e.data.value,{context:"declarationList",...c.meta})})),c.addEventListener.call(r,"hashchange",(e=>{if(e.__uv$dispatched)return!1;e.stopImmediatePropagation();const t=r.location.hash;d.history.replaceState.call(r.history,"","",e.oldURL),c.location.hash=t})),d.location.on("hashchange",((e,t,a)=>{if(a.HashChangeEvent&&d.history.replaceState){d.history.replaceState.call(r.history,"","",c.rewriteUrl(t));const o=new a.HashChangeEvent("hashchange",{newURL:t,oldURL:e});d.nativeMethods.defineProperty(o,"__uv$dispatched",{value:!0,enumerable:!1}),c.dispatchEvent.call(r,o)}})),d.fetch.overrideRequest(),d.fetch.overrideUrl(),d.xhr.overrideOpen(),d.xhr.overrideResponseUrl(),d.element.overrideHtml(),d.element.overrideAttribute(),d.element.overrideInsertAdjacentHTML(),d.element.overrideAudio(),d.node.overrideBaseURI(),d.node.overrideTextContent(),d.attribute.overrideNameValue(),d.document.overrideDomain(),d.document.overrideURL(),d.document.overrideDocumentURI(),d.document.overrideWrite(),d.document.overrideReferrer(),d.document.overrideParseFromString(),d.storage.overrideMethods(),d.storage.overrideLength(),d.object.overrideGetPropertyNames(),d.object.overrideGetOwnPropertyDescriptors(),d.history.overridePushState(),d.history.overrideReplaceState(),d.eventSource.overrideConstruct(),d.eventSource.overrideUrl(),d.url.overrideObjectURL(),d.document.overrideCookie(),d.message.overridePostMessage(),d.message.overrideMessageOrigin(),d.message.overrideMessageData(),d.workers.overrideWorker(),d.workers.overrideAddModule(),d.workers.overrideImportScripts(),d.workers.overridePostMessage(),d.style.overrideSetGetProperty(),d.style.overrideCssText(),d.navigator.overrideSendBeacon(),d.function.overrideFunction(),d.function.overrideToString(),d.location.overrideWorkerLocation((e=>new URL(c.sourceUrl(e)))),d.overrideDescriptor(r,"localStorage",{get:(e,t)=>(t||r).__uv.lsWrap}),d.overrideDescriptor(r,"sessionStorage",{get:(e,t)=>(t||r).__uv.ssWrap}),d.override(r,"open",((e,t,a)=>{if(!a.length)return e.apply(t,a);let[r]=a;return r=c.rewriteUrl(r),e.call(t,r)})),c.$wrap=function(e){return"location"===e?c.methods.location:"eval"===e?c.methods.eval:e},c.$get=function(e){return e===r.location?c.location:e===r.eval?c.eval:e===r.parent?r.__uv$parent:e===r.top?r.__uv$top:e},c.eval=d.wrap(r,"eval",((e,t,a)=>{if(!a.length||"string"!=typeof a[0])return e.apply(t,a);let[r]=a;return r=c.rewriteJS(r),e.call(t,r)})),c.call=function(e,t,a){return a?e.apply(a,t):e(...t)},c.call$=function(e,t,a=[]){return e[t].apply(e,a)},d.nativeMethods.defineProperty(r.Object.prototype,s,{get:()=>c,enumerable:!1}),d.nativeMethods.defineProperty(r.Object.prototype,c.methods.setSource,{value:function(e){return d.nativeMethods.isExtensible(this)?(d.nativeMethods.defineProperty(this,c.methods.source,{value:e,writable:!0,enumerable:!1}),this):this},enumerable:!1}),d.nativeMethods.defineProperty(r.Object.prototype,c.methods.source,{value:c,writable:!0,enumerable:!1}),d.nativeMethods.defineProperty(r.Object.prototype,c.methods.location,{configurable:!0,get(){return this===r.document||this===r?c.location:this.location},set(e){this===r.document||this===r?c.location.href=e:this.location=e}}),d.nativeMethods.defineProperty(r.Object.prototype,c.methods.parent,{configurable:!0,get(){const e=this.parent;if(this===r)try{return"__uv"in e?e:this}catch(e){return this}return e},set(e){this.parent=e}}),d.nativeMethods.defineProperty(r.Object.prototype,c.methods.top,{configurable:!0,get(){const e=this.top;if(this===r){if(e===this.parent)return this[c.methods.parent];try{if("__uv"in e)return e;{let t=this;for(;t.parent!==e;)t=t.parent;return"__uv"in t?t:this}}catch(e){return this}}return e},set(e){this.top=e}}),d.nativeMethods.defineProperty(r.Object.prototype,c.methods.eval,{configurable:!0,get(){return this===r?c.eval:this.eval},set(e){this.eval=e}})}self.__uv||a(self,self.__uv$config,self.__uv$config.bare),self.__uvHook=a})(); | ||
(()=>{"use strict";const e=globalThis.Ultraviolet,t=globalThis.UVClient;function a(r,o={},n="/bare/"){if("__uv"in r&&r.__uv instanceof e)return!1;r.document&&r.window&&r.document.querySelectorAll("script[__uv-script]").forEach((e=>e.remove()));const i=!r.window,s="__uv",l="__uv$",c=new e(o);"function"==typeof o.construct&&o.construct(c,i?"worker":"window");const d=new t(r),{HTMLMediaElement:u,HTMLScriptElement:h,HTMLAudioElement:m,HTMLVideoElement:v,HTMLInputElement:p,HTMLEmbedElement:g,HTMLTrackElement:b,HTMLAnchorElement:f,HTMLIFrameElement:y,HTMLAreaElement:_,HTMLLinkElement:S,HTMLBaseElement:w,HTMLFormElement:k,HTMLImageElement:P,HTMLSourceElement:U}=r;d.nativeMethods.defineProperty(r,"__uv",{value:c,enumerable:!1}),c.meta.origin=location.origin,c.location=d.location.emulate((e=>"about:srcdoc"===e?new URL(e):(e.startsWith("blob:")&&(e=e.slice("blob:".length)),new URL(c.sourceUrl(e)))),(e=>c.rewriteUrl(e))),c.bareData=r.__uv$bareData,c.cookieStr=r.__uv$cookies||"",c.meta.url=c.location,c.domain=c.meta.url.host,c.blobUrls=new r.Map,c.referrer="",c.cookies=[],c.localStorageObj={},c.sessionStorageObj={};try{c.bare=new URL(n,r.location.href)}catch(e){c.bare=r.parent.__uv.bare}const M=new e.BareClient(c.bare,c.bareData);if("about:srcdoc"===c.location.href&&(c.meta=r.parent.__uv.meta),r.EventTarget&&(c.addEventListener=r.EventTarget.prototype.addEventListener,c.removeListener=r.EventTarget.prototype.removeListener,c.dispatchEvent=r.EventTarget.prototype.dispatchEvent),d.nativeMethods.defineProperty(d.storage.storeProto,"__uv$storageObj",{get(){return this===d.storage.sessionStorage?c.sessionStorageObj:this===d.storage.localStorage?c.localStorageObj:void 0},enumerable:!1}),r.localStorage){for(const e in r.localStorage)e.startsWith(l+c.location.origin+"@")&&(c.localStorageObj[e.slice((l+c.location.origin+"@").length)]=r.localStorage.getItem(e));c.lsWrap=d.storage.emulate(d.storage.localStorage,c.localStorageObj)}if(r.sessionStorage){for(const e in r.sessionStorage)e.startsWith(l+c.location.origin+"@")&&(c.sessionStorageObj[e.slice((l+c.location.origin+"@").length)]=r.sessionStorage.getItem(e));c.ssWrap=d.storage.emulate(d.storage.sessionStorage,c.sessionStorageObj)}let x=r.document?d.node.baseURI.get.call(r.document):r.location.href,E=c.sourceUrl(x);d.nativeMethods.defineProperty(c.meta,"base",{get:()=>r.document?(d.node.baseURI.get.call(r.document)!==x&&(x=d.node.baseURI.get.call(r.document),E=c.sourceUrl(x)),E):c.meta.url.href}),c.methods={setSource:"__uv$setSource",source:"__uv$source",location:"__uv$location",function:"__uv$function",string:"__uv$string",eval:"__uv$eval",parent:"__uv$parent",top:"__uv$top"},c.filterKeys=[s,c.methods.setSource,c.methods.source,c.methods.location,c.methods.function,c.methods.string,c.methods.eval,c.methods.parent,c.methods.top,"__uv$protocol","__uv$storageObj","__uv$url","__uv$modifiedStyle","__uv$config","__uv$dispatched","Ultraviolet","__uvHook"],d.on("wrap",((e,t)=>{d.nativeMethods.defineProperty(t,"name",d.nativeMethods.getOwnPropertyDescriptor(e,"name")),d.nativeMethods.defineProperty(t,"length",d.nativeMethods.getOwnPropertyDescriptor(e,"length")),d.nativeMethods.defineProperty(t,c.methods.string,{enumerable:!1,value:d.nativeMethods.fnToString.call(e)}),d.nativeMethods.defineProperty(t,c.methods.function,{enumerable:!1,value:e})})),d.fetch.on("request",(e=>{e.data.input=c.rewriteUrl(e.data.input)})),d.fetch.on("requestUrl",(e=>{e.data.value=c.sourceUrl(e.data.value)})),d.fetch.on("responseUrl",(e=>{e.data.value=c.sourceUrl(e.data.value)})),d.xhr.on("open",(e=>{e.data.input=c.rewriteUrl(e.data.input)})),d.xhr.on("responseUrl",(e=>{e.data.value=c.sourceUrl(e.data.value)})),d.workers.on("worker",(e=>{e.data.url=c.rewriteUrl(e.data.url)})),d.workers.on("addModule",(e=>{e.data.url=c.rewriteUrl(e.data.url)})),d.workers.on("importScripts",(e=>{for(const t in e.data.scripts)e.data.scripts[t]=c.rewriteUrl(e.data.scripts[t])})),d.workers.on("postMessage",(e=>{let t=e.data.origin;e.data.origin="*",e.data.message={__data:e.data.message,__origin:c.meta.url.origin,__to:t}})),d.navigator.on("sendBeacon",(e=>{e.data.url=c.rewriteUrl(e.data.url)})),d.document.on("getCookie",(e=>{e.data.value=c.cookieStr})),d.document.on("setCookie",(e=>{Promise.resolve(c.cookie.setCookies(e.data.value,c.db,c.meta)).then((()=>{c.cookie.db().then((e=>{c.cookie.getCookies(e).then((e=>{c.cookieStr=c.cookie.serialize(e,c.meta,!0)}))}))}));const t=c.cookie.setCookie(e.data.value)[0];t.path||(t.path="/"),t.domain||(t.domain=c.meta.url.hostname),c.cookie.validateCookie(t,c.meta,!0)&&(c.cookieStr.length&&(c.cookieStr+="; "),c.cookieStr+=`${t.name}=${t.value}`),e.respondWith(e.data.value)})),d.element.on("setInnerHTML",(e=>{switch(e.that.tagName){case"SCRIPT":e.data.value=c.js.rewrite(e.data.value);break;case"STYLE":e.data.value=c.rewriteCSS(e.data.value);break;default:e.data.value=c.rewriteHtml(e.data.value)}})),d.element.on("getInnerHTML",(e=>{if("SCRIPT"===e.that.tagName)e.data.value=c.js.source(e.data.value);else e.data.value=c.sourceHtml(e.data.value)})),d.element.on("setOuterHTML",(e=>{e.data.value=c.rewriteHtml(e.data.value,{document:"HTML"===e.that.tagName})})),d.element.on("getOuterHTML",(e=>{switch(e.that.tagName){case"HEAD":e.data.value=c.sourceHtml(e.data.value.replace(/<head(.*)>(.*)<\/head>/s,"<op-head$1>$2</op-head>")).replace(/<op-head(.*)>(.*)<\/op-head>/s,"<head$1>$2</head>");break;case"BODY":e.data.value=c.sourceHtml(e.data.value.replace(/<body(.*)>(.*)<\/body>/s,"<op-body$1>$2</op-body>")).replace(/<op-body(.*)>(.*)<\/op-body>/s,"<body$1>$2</body>");break;default:e.data.value=c.sourceHtml(e.data.value,{document:"HTML"===e.that.tagName})}})),d.document.on("write",(e=>{if(!e.data.html.length)return!1;e.data.html=[c.rewriteHtml(e.data.html.join(""))]})),d.document.on("writeln",(e=>{if(!e.data.html.length)return!1;e.data.html=[c.rewriteHtml(e.data.html.join(""))]})),d.element.on("insertAdjacentHTML",(e=>{e.data.html=c.rewriteHtml(e.data.html)})),d.eventSource.on("construct",(e=>{e.data.url=c.rewriteUrl(e.data.url)})),d.eventSource.on("url",(e=>{e.data.url=c.rewriteUrl(e.data.url)})),d.history.on("replaceState",(e=>{e.data.url&&(e.data.url=c.rewriteUrl(e.data.url,"__uv"in e.that?e.that.__uv.meta:c.meta))})),d.history.on("pushState",(e=>{e.data.url&&(e.data.url=c.rewriteUrl(e.data.url,"__uv"in e.that?e.that.__uv.meta:c.meta))})),d.element.on("getAttribute",(e=>{d.element.hasAttribute.call(e.that,c.attributePrefix+"-attr-"+e.data.name)&&e.respondWith(e.target.call(e.that,c.attributePrefix+"-attr-"+e.data.name))})),d.message.on("postMessage",(e=>{let t=e.data.origin,a=c.call;e.that&&(a=e.that.__uv$source.call),e.data.origin="*",e.data.message={__data:e.data.message,__origin:(e.that||e.target).__uv$source.location.origin,__to:t},e.respondWith(a(e.target,i?[e.data.message,e.data.transfer]:[e.data.message,e.data.origin,e.data.transfer],e.that))})),d.message.on("data",(e=>{const{value:t}=e.data;"object"==typeof t&&"__data"in t&&"__origin"in t&&e.respondWith(t.__data)})),d.message.on("origin",(e=>{const t=d.message.messageData.get.call(e.that);"object"==typeof t&&t.__data&&t.__origin&&e.respondWith(t.__origin)})),d.overrideDescriptor(r,"origin",{get:()=>c.location.origin}),d.node.on("baseURI",(e=>{e.data.value.startsWith(r.location.origin)&&(e.data.value=c.sourceUrl(e.data.value))})),d.element.on("setAttribute",(e=>{if(e.that instanceof u&&"src"===e.data.name&&e.data.value.startsWith("blob:"))return e.target.call(e.that,c.attributePrefix+"-attr-"+e.data.name,e.data.value),void(e.data.value=c.blobUrls.get(e.data.value));c.attrs.isUrl(e.data.name)&&(e.target.call(e.that,c.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=c.rewriteUrl(e.data.value)),c.attrs.isStyle(e.data.name)&&(e.target.call(e.that,c.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=c.rewriteCSS(e.data.value,{context:"declarationList"})),c.attrs.isHtml(e.data.name)&&(e.target.call(e.that,c.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=c.rewriteHtml(e.data.value,{...c.meta,document:!0,injectHead:c.createHtmlInject(c.handlerScript,c.bundleScript,c.clientScript,c.configScript,c.bareData,c.cookieStr,r.location.href)})),c.attrs.isSrcset(e.data.name)&&(e.target.call(e.that,c.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=c.html.wrapSrcset(e.data.value.toString())),c.attrs.isForbidden(e.data.name)&&(e.data.name=c.attributePrefix+"-attr-"+e.data.name)})),d.element.on("audio",(e=>{e.data.url=c.rewriteUrl(e.data.url)})),d.element.hookProperty([f,_,S,w],"href",{get:(e,t)=>c.sourceUrl(e.call(t)),set:(e,t,[a])=>{d.element.setAttribute.call(t,c.attributePrefix+"-attr-href",a),e.call(t,c.rewriteUrl(a))}}),d.element.hookProperty([h,m,v,u,P,p,g,y,b,U],"src",{get:(e,t)=>c.sourceUrl(e.call(t)),set:(e,t,[a])=>{if(new String(a).toString().trim().startsWith("blob:")&&t instanceof u)return d.element.setAttribute.call(t,c.attributePrefix+"-attr-src",a),e.call(t,c.blobUrls.get(a)||a);d.element.setAttribute.call(t,c.attributePrefix+"-attr-src",a),e.call(t,c.rewriteUrl(a))}}),d.element.hookProperty([k],"action",{get:(e,t)=>c.sourceUrl(e.call(t)),set:(e,t,[a])=>{d.element.setAttribute.call(t,c.attributePrefix+"-attr-action",a),e.call(t,c.rewriteUrl(a))}}),d.element.hookProperty([P],"srcset",{get:(e,t)=>d.element.getAttribute.call(t,c.attributePrefix+"-attr-srcset")||e.call(t),set:(e,t,[a])=>{d.element.setAttribute.call(t,c.attributePrefix+"-attr-srcset",a),e.call(t,c.html.wrapSrcset(a.toString()))}}),d.element.hookProperty(h,"integrity",{get:(e,t)=>d.element.getAttribute.call(t,c.attributePrefix+"-attr-integrity"),set:(e,t,[a])=>{d.element.setAttribute.call(t,c.attributePrefix+"-attr-integrity",a)}}),d.element.hookProperty(y,"sandbox",{get:(e,t)=>d.element.getAttribute.call(t,c.attributePrefix+"-attr-sandbox")||e.call(t),set:(e,t,[a])=>{d.element.setAttribute.call(t,c.attributePrefix+"-attr-sandbox",a)}});const $=y&&Object.getOwnPropertyDescriptor(y.prototype,"contentWindow").get;function T(e){const t=$.call(e);if(!t.__uv)try{t.__uv$bareData=c.bareData,t.__uv$cookies=c.cookieStr,a(t,o,n)}catch(e){console.error("catastrophic failure"),console.error(e)}}function j(e,t){const a=`on${t}`,r=new WeakMap;Reflect.defineProperty(e,a,{enumerable:!0,configurable:!0,get(){return r.has(this)?r.get(this):null},set(e){"function"==typeof e&&(r.has(this)&&this.removeEventListener(t,r.get(this)),r.set(this,e),this.addEventListener(t,e))}})}d.element.hookProperty(y,"contentWindow",{get:(e,t)=>(T(t),e.call(t))}),d.element.hookProperty(y,"contentDocument",{get:(e,t)=>(T(t),e.call(t))}),d.element.hookProperty(y,"srcdoc",{get:(e,t)=>d.element.getAttribute.call(t,c.attributePrefix+"-attr-srcdoc")||e.call(t),set:(e,t,[a])=>{e.call(t,c.rewriteHtml(a,{document:!0,injectHead:c.createHtmlInject(c.handlerScript,c.bundleScript,c.clientScript,c.configScript,c.bareData,c.cookieStr,r.location.href)}))}}),d.node.on("getTextContent",(e=>{"SCRIPT"===e.that.tagName&&(e.data.value=c.js.source(e.data.value))})),d.node.on("setTextContent",(e=>{"SCRIPT"===e.that.tagName&&(e.data.value=c.js.rewrite(e.data.value))})),"serviceWorker"in r.navigator&&delete r.Navigator.prototype.serviceWorker,d.document.on("getDomain",(e=>{e.data.value=c.domain})),d.document.on("setDomain",(e=>{if(!e.data.value.toString().endsWith(c.meta.url.hostname.split(".").slice(-2).join(".")))return e.respondWith("");e.respondWith(c.domain=e.data.value)})),d.document.on("url",(e=>{e.data.value=c.location.href})),d.document.on("documentURI",(e=>{e.data.value=c.location.href})),d.document.on("referrer",(e=>{e.data.value=c.referrer||c.sourceUrl(e.data.value)})),d.document.on("parseFromString",(e=>{if("text/html"!==e.data.type)return!1;e.data.string=c.rewriteHtml(e.data.string,{...c.meta,document:!0})})),d.attribute.on("getValue",(e=>{d.element.hasAttribute.call(e.that.ownerElement,c.attributePrefix+"-attr-"+e.data.name)&&(e.data.value=d.element.getAttribute.call(e.that.ownerElement,c.attributePrefix+"-attr-"+e.data.name))})),d.attribute.on("setValue",(e=>{c.attrs.isUrl(e.data.name)&&(d.element.setAttribute.call(e.that.ownerElement,c.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=c.rewriteUrl(e.data.value)),c.attrs.isStyle(e.data.name)&&(d.element.setAttribute.call(e.that.ownerElement,c.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=c.rewriteCSS(e.data.value,{context:"declarationList"})),c.attrs.isHtml(e.data.name)&&(d.element.setAttribute.call(e.that.ownerElement,c.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=c.rewriteHtml(e.data.value,{...c.meta,document:!0,injectHead:c.createHtmlInject(c.handlerScript,c.bundleScript,c.clientScript,c.configScript,c.bareData,c.cookieStr,r.location.href)})),c.attrs.isSrcset(e.data.name)&&(d.element.setAttribute.call(e.that.ownerElement,c.attributePrefix+"-attr-"+e.data.name,e.data.value),e.data.value=c.html.wrapSrcset(e.data.value.toString()))})),d.url.on("createObjectURL",(e=>{let t=e.target.call(e.that,e.data.object);if(t.startsWith("blob:"+location.origin)){let a="blob:"+("about:blank"!==c.meta.url.href?c.meta.url.origin:r.parent.__uv.meta.url.origin)+t.slice("blob:".length+location.origin.length);c.blobUrls.set(a,t),e.respondWith(a)}else e.respondWith(t)})),d.url.on("revokeObjectURL",(e=>{if(c.blobUrls.has(e.data.url)){const t=e.data.url;e.data.url=c.blobUrls.get(e.data.url),c.blobUrls.delete(t)}})),d.storage.on("get",(e=>{e.data.name=l+c.meta.url.origin+"@"+e.data.name})),d.storage.on("set",(e=>{e.that.__uv$storageObj&&(e.that.__uv$storageObj[e.data.name]=e.data.value),e.data.name=l+c.meta.url.origin+"@"+e.data.name})),d.storage.on("delete",(e=>{e.that.__uv$storageObj&&delete e.that.__uv$storageObj[e.data.name],e.data.name=l+c.meta.url.origin+"@"+e.data.name})),d.storage.on("getItem",(e=>{e.data.name=l+c.meta.url.origin+"@"+e.data.name})),d.storage.on("setItem",(e=>{e.that.__uv$storageObj&&(e.that.__uv$storageObj[e.data.name]=e.data.value),e.data.name=l+c.meta.url.origin+"@"+e.data.name})),d.storage.on("removeItem",(e=>{e.that.__uv$storageObj&&delete e.that.__uv$storageObj[e.data.name],e.data.name=l+c.meta.url.origin+"@"+e.data.name})),d.storage.on("clear",(e=>{if(e.that.__uv$storageObj)for(const t of d.nativeMethods.keys.call(null,e.that.__uv$storageObj))delete e.that.__uv$storageObj[t],d.storage.removeItem.call(e.that,l+c.meta.url.origin+"@"+t),e.respondWith()})),d.storage.on("length",(e=>{e.that.__uv$storageObj&&e.respondWith(d.nativeMethods.keys.call(null,e.that.__uv$storageObj).length)})),d.storage.on("key",(e=>{e.that.__uv$storageObj&&e.respondWith(d.nativeMethods.keys.call(null,e.that.__uv$storageObj)[e.data.index]||null)}));const O=["ws:","wss:"];class L extends EventTarget{#e;#t;#a="blob";#r="";#o="";#n="";async#i(e,t){const a={};Reflect.setPrototypeOf(a,null),a.Origin=c.meta.url.origin,a["User-Agent"]=navigator.userAgent,""!==c.cookieStr&&(a.Cookie=c.cookieStr.toString()),this.#e=await M.createWebSocket(e,a,t),this.#e.binaryType=this.#a,this.#e.addEventListener("message",(e=>{this.dispatchEvent(new MessageEvent("message",e))})),this.#e.addEventListener("open",(async e=>{this.dispatchEvent(new Event("open",e))})),this.#e.addEventListener("error",(e=>{this.dispatchEvent(new ErrorEvent("error",e))})),this.#e.addEventListener("close",(e=>{this.dispatchEvent(new Event("close",e))}));const r=await this.#e.meta;r.headers.has("sec-websocket-protocol")&&(this.#r=r.headers.get("sec-websocket-protocol")),r.headers.has("sec-websocket-extensions")&&(this.#o=r.headers.get("sec-websocket-extensions"));let o=r.rawHeaders["set-cookie"]||[];Array.isArray(o)||(o=[]);for(const e of o)document.cookie=e}get url(){return this.#n}constructor(...e){if(super(),!e.length)throw new DOMException("Failed to construct 'WebSocket': 1 argument required, but only 0 present.");const[t,a]=e;let r;try{r=new URL(t)}catch(e){throw new DOMException(`Faiiled to construct 'WebSocket': The URL '${t}' is invalid.`)}if(!O.includes(r.protocol))throw new DOMException(`Failed to construct 'WebSocket': The URL's scheme must be either 'ws' or 'wss'. '${r.protocol}' is not allowed.`);this.#t=this.#i(r,a)}get protocol(){return this.#r}get extensions(){return this.#o}get readyState(){return this.#e?this.#e.readyState:L.CONNECTING}get binaryType(){return this.#a}set binaryType(e){this.#a=e,this.#e&&(this.#e.binaryType=e)}send(e){if(!this.#e)throw new DOMException("Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.");this.#e.send(e)}close(e,t){if(void 0!==e&&("number"!=typeof e&&(e=0),1e3!==e&&(e<3e3||e>4999)))throw new DOMException(`Failed to execute 'close' on 'WebSocket': The code must be either 1000, or between 3000 and 4999. ${e} is neither.`);this.#t.then((()=>this.#e.close(e,t)))}}j(L.prototype,"close"),j(L.prototype,"open"),j(L.prototype,"message"),j(L.prototype,"error");for(const e of["url","protocol","extensions","readyState","binaryType"]){const t=Object.getOwnPropertyDescriptor(r.WebSocket.prototype,e),a=Object.getOwnPropertyDescriptor(L.prototype,e);a?.get&&t?.get&&d.emit("wrap",a.get,t.get),a?.set&&t?.set&&d.emit("wrap",a.get,t.get)}if(d.emit("wrap",r.WebSocket.prototype.send,L.prototype.send),d.emit("wrap",r.WebSocket.prototype.close,L.prototype.close),d.override(r,"WebSocket",((e,t,a)=>new L(...a)),!0),L.prototype.constructor=r.WebSocket,d.function.on("function",(e=>{e.data.script=c.rewriteJS(e.data.script)})),d.function.on("toString",(e=>{c.methods.string in e.that&&e.respondWith(e.that[c.methods.string])})),d.object.on("getOwnPropertyNames",(e=>{e.data.names=e.data.names.filter((e=>!c.filterKeys.includes(e)))})),d.object.on("getOwnPropertyDescriptors",(e=>{for(const t of c.filterKeys)delete e.data.descriptors[t]})),d.style.on("setProperty",(e=>{d.style.dashedUrlProps.includes(e.data.property)&&(e.data.value=c.rewriteCSS(e.data.value,{context:"value",...c.meta}))})),d.style.on("getPropertyValue",(e=>{d.style.dashedUrlProps.includes(e.data.property)&&e.respondWith(c.sourceCSS(e.target.call(e.that,e.data.property),{context:"value",...c.meta}))})),"CSS2Properties"in r)for(const e of d.style.urlProps)d.overrideDescriptor(r.CSS2Properties.prototype,e,{get:(e,t)=>c.sourceCSS(e.call(t),{context:"value",...c.meta}),set:(e,t,a)=>{e.call(t,c.rewriteCSS(a,{context:"value",...c.meta}))}});else"HTMLElement"in r&&d.overrideDescriptor(r.HTMLElement.prototype,"style",{get:(e,t)=>{const a=e.call(t);if(!a.__uv$modifiedStyle)for(const e of d.style.urlProps)d.nativeMethods.defineProperty(a,e,{enumerable:!0,configurable:!0,get(){const t=d.style.getPropertyValue.call(this,e)||"";return c.sourceCSS(t,{context:"value",...c.meta})},set(t){d.style.setProperty.call(this,d.style.propToDashed[e]||e,c.rewriteCSS(t,{context:"value",...c.meta}))}}),d.nativeMethods.defineProperty(a,"__uv$modifiedStyle",{enumerable:!1,value:!0});return a}});d.style.on("setCssText",(e=>{e.data.value=c.rewriteCSS(e.data.value,{context:"declarationList",...c.meta})})),d.style.on("getCssText",(e=>{e.data.value=c.sourceCSS(e.data.value,{context:"declarationList",...c.meta})})),c.addEventListener.call(r,"hashchange",(e=>{if(e.__uv$dispatched)return!1;e.stopImmediatePropagation();const t=r.location.hash;d.history.replaceState.call(r.history,"","",e.oldURL),c.location.hash=t})),d.location.on("hashchange",((e,t,a)=>{if(a.HashChangeEvent&&d.history.replaceState){d.history.replaceState.call(r.history,"","",c.rewriteUrl(t));const o=new a.HashChangeEvent("hashchange",{newURL:t,oldURL:e});d.nativeMethods.defineProperty(o,"__uv$dispatched",{value:!0,enumerable:!1}),c.dispatchEvent.call(r,o)}})),d.fetch.overrideRequest(),d.fetch.overrideUrl(),d.xhr.overrideOpen(),d.xhr.overrideResponseUrl(),d.element.overrideHtml(),d.element.overrideAttribute(),d.element.overrideInsertAdjacentHTML(),d.element.overrideAudio(),d.node.overrideBaseURI(),d.node.overrideTextContent(),d.attribute.overrideNameValue(),d.document.overrideDomain(),d.document.overrideURL(),d.document.overrideDocumentURI(),d.document.overrideWrite(),d.document.overrideReferrer(),d.document.overrideParseFromString(),d.storage.overrideMethods(),d.storage.overrideLength(),d.object.overrideGetPropertyNames(),d.object.overrideGetOwnPropertyDescriptors(),d.history.overridePushState(),d.history.overrideReplaceState(),d.eventSource.overrideConstruct(),d.eventSource.overrideUrl(),d.url.overrideObjectURL(),d.document.overrideCookie(),d.message.overridePostMessage(),d.message.overrideMessageOrigin(),d.message.overrideMessageData(),d.workers.overrideWorker(),d.workers.overrideAddModule(),d.workers.overrideImportScripts(),d.workers.overridePostMessage(),d.style.overrideSetGetProperty(),d.style.overrideCssText(),d.navigator.overrideSendBeacon(),d.function.overrideFunction(),d.function.overrideToString(),d.location.overrideWorkerLocation((e=>new URL(c.sourceUrl(e)))),d.overrideDescriptor(r,"localStorage",{get:(e,t)=>(t||r).__uv.lsWrap}),d.overrideDescriptor(r,"sessionStorage",{get:(e,t)=>(t||r).__uv.ssWrap}),d.override(r,"open",((e,t,a)=>{if(!a.length)return e.apply(t,a);let[r]=a;return r=c.rewriteUrl(r),e.call(t,r)})),c.$wrap=function(e){return"location"===e?c.methods.location:"eval"===e?c.methods.eval:e},c.$get=function(e){return e===r.location?c.location:e===r.eval?c.eval:e===r.parent?r.__uv$parent:e===r.top?r.__uv$top:e},c.eval=d.wrap(r,"eval",((e,t,a)=>{if(!a.length||"string"!=typeof a[0])return e.apply(t,a);let[r]=a;return r=c.rewriteJS(r),e.call(t,r)})),c.call=function(e,t,a){return a?e.apply(a,t):e(...t)},c.call$=function(e,t,a=[]){return e[t].apply(e,a)},d.nativeMethods.defineProperty(r.Object.prototype,s,{get:()=>c,enumerable:!1}),d.nativeMethods.defineProperty(r.Object.prototype,c.methods.setSource,{value:function(e){return d.nativeMethods.isExtensible(this)?(d.nativeMethods.defineProperty(this,c.methods.source,{value:e,writable:!0,enumerable:!1}),this):this},enumerable:!1}),d.nativeMethods.defineProperty(r.Object.prototype,c.methods.source,{value:c,writable:!0,enumerable:!1}),d.nativeMethods.defineProperty(r.Object.prototype,c.methods.location,{configurable:!0,get(){return this===r.document||this===r?c.location:this.location},set(e){this===r.document||this===r?c.location.href=e:this.location=e}}),d.nativeMethods.defineProperty(r.Object.prototype,c.methods.parent,{configurable:!0,get(){const e=this.parent;if(this===r)try{return"__uv"in e?e:this}catch(e){return this}return e},set(e){this.parent=e}}),d.nativeMethods.defineProperty(r.Object.prototype,c.methods.top,{configurable:!0,get(){const e=this.top;if(this===r){if(e===this.parent)return this[c.methods.parent];try{if("__uv"in e)return e;{let t=this;for(;t.parent!==e;)t=t.parent;return"__uv"in t?t:this}}catch(e){return this}}return e},set(e){this.top=e}}),d.nativeMethods.defineProperty(r.Object.prototype,c.methods.eval,{configurable:!0,get(){return this===r?c.eval:this.eval},set(e){this.eval=e}})}self.__uv||a(self,self.__uv$config,self.__uv$config.bare),self.__uvHook=a})(); | ||
//# sourceMappingURL=uv.handler.js.map |
@@ -1,2 +0,2 @@ | ||
(()=>{"use strict";const e=globalThis.Ultraviolet,t=["cross-origin-embedder-policy","cross-origin-opener-policy","cross-origin-resource-policy","content-security-policy","content-security-policy-report-only","expect-ct","feature-policy","origin-isolation","strict-transport-security","upgrade-insecure-requests","x-content-type-options","x-download-options","x-frame-options","x-permitted-cross-domain-policies","x-powered-by","x-xss-protection"],r=["GET","HEAD"];class s extends e.EventEmitter{constructor(t=__uv$config){super(),t.bare||(t.bare="/bare/"),t.prefix||(t.prefix="/service/"),this.addresses="string"==typeof t.bare?[new URL(t.bare,location)]:t.bare.map((e=>new URL(e,location))),this.config=t,this.bareClient=new e.BareClient(this.address)}async fetch({request:s}){try{if(!s.url.startsWith(location.origin+this.config.prefix))return await fetch(s);const n=new e(this.config);"function"==typeof this.config.construct&&this.config.construct(n,"service");const c=await n.cookie.db();n.meta.origin=location.origin,n.meta.base=n.meta.url=new URL(n.sourceUrl(s.url));const l=new o(s,this,n,r.includes(s.method.toUpperCase())?null:await s.blob());if("blob:"===n.meta.url.protocol&&(l.blob=!0,l.base=l.url=new URL(l.url.pathname)),s.referrer&&s.referrer.startsWith(location.origin)){const e=new URL(n.sourceUrl(s.referrer));(l.headers.origin||n.meta.url.origin!==e.origin&&"cors"===s.mode)&&(l.headers.origin=e.origin),l.headers.referer=e.href}const u=await n.cookie.getCookies(c)||[],h=n.cookie.serialize(u,n.meta,!1);l.headers["user-agent"]=navigator.userAgent,h&&(l.headers.cookie=h),l.headers.Host=l.url.host;const d=new a(l,null,null);if(this.emit("request",d),d.intercepted)return d.returnValue;const p=await this.bareClient.fetch(l.blob?"blob:"+location.origin+l.url.pathname:l.url,{headers:l.headers,method:l.method,body:l.body,credentials:l.credentials,mode:location.origin!==l.address.origin?"cors":l.mode,redirect:l.redirect}),m=new i(l,p),b=new a(m,null,null);if(this.emit("beforemod",b),b.intercepted)return b.returnValue;for(const e of t)m.headers[e]&&delete m.headers[e];if(m.headers.location&&(m.headers.location=n.rewriteUrl(m.headers.location)),m.headers["set-cookie"]&&(Promise.resolve(n.cookie.setCookies(m.headers["set-cookie"],c,n.meta)).then((()=>{self.clients.matchAll().then((function(e){e.forEach((function(e){e.postMessage({msg:"updateCookies",url:n.meta.url.href})}))}))})),delete m.headers["set-cookie"]),m.body)switch(s.destination){case"script":case"worker":{const e=[n.bundleScript,n.clientScript,n.configScript,n.handlerScript].map((e=>JSON.stringify(e))).join(",");m.body=`if (!self.__uv && self.importScripts) importScripts(${e});\n`,m.body+=n.js.rewrite(await p.text())}break;case"style":m.body=n.rewriteCSS(await p.text());break;case"iframe":case"document":(function(t,r=""){return"text/html"===(e.mime.contentType(r||t.pathname)||"text/html").split(";")[0]})(n.meta.url,m.headers["content-type"]||"")&&(m.body=n.rewriteHtml(await p.text(),{document:!0,injectHead:n.createHtmlInject(n.handlerScript,n.bundleScript,n.clientScript,n.configScript,this.bareClient.data,n.cookie.serialize(u,n.meta,!0),s.referrer)}))}return"text/event-stream"===l.headers.accept&&(m.headers["content-type"]="text/event-stream"),this.emit("response",b),b.intercepted?b.returnValue:new Response(m.body,{headers:m.headers,status:m.status,statusText:m.statusText})}catch(e){return console.error(e),new Response(e.toString(),{status:500})}}get address(){return this.addresses[Math.floor(Math.random()*this.addresses.length)]}static Ultraviolet=e}self.UVServiceWorker=s;class i{constructor(e,t){this.request=e,this.raw=t,this.ultraviolet=e.ultraviolet,this.headers=Object.fromEntries(t.headers.entries()),this.status=t.status,this.statusText=t.statusText,this.body=t.body}get url(){return this.request.url}get base(){return this.request.base}set base(e){this.request.base=e}}class o{constructor(e,t,r,s=null){this.ultraviolet=r,this.request=e,this.headers=Object.fromEntries(e.headers.entries()),this.method=e.method,this.address=t.address,this.body=s||null,this.redirect=e.redirect,this.credentials="omit",this.mode="cors"===e.mode?e.mode:"same-origin",this.blob=!1}get url(){return this.ultraviolet.meta.url}set url(e){this.ultraviolet.meta.url=e}get base(){return this.ultraviolet.meta.base}set base(e){this.ultraviolet.meta.base=e}}class a{#e;#t;constructor(e={},t=null,r=null){this.#e=!1,this.#t=null,this.data=e,this.target=t,this.that=r}get intercepted(){return this.#e}get returnValue(){return this.#t}respondWith(e){this.#t=e,this.#e=!0}}})(); | ||
(()=>{"use strict";const e=globalThis.Ultraviolet,t=["cross-origin-embedder-policy","cross-origin-opener-policy","cross-origin-resource-policy","content-security-policy","content-security-policy-report-only","expect-ct","feature-policy","origin-isolation","strict-transport-security","upgrade-insecure-requests","x-content-type-options","x-download-options","x-frame-options","x-permitted-cross-domain-policies","x-powered-by","x-xss-protection"],r=["GET","HEAD"];class s extends e.EventEmitter{constructor(t=__uv$config){super(),t.bare||(t.bare="/bare/"),t.prefix||(t.prefix="/service/"),this.addresses="string"==typeof t.bare?[new URL(t.bare,location)]:t.bare.map((e=>new URL(e,location))),this.config=t,this.bareClient=new e.BareClient(this.address)}async fetch({request:s}){try{if(!s.url.startsWith(location.origin+this.config.prefix))return await fetch(s);const n=new e(this.config);"function"==typeof this.config.construct&&this.config.construct(n,"service");const c=await n.cookie.db();n.meta.origin=location.origin,n.meta.base=n.meta.url=new URL(n.sourceUrl(s.url));const l=new o(s,this,n,r.includes(s.method.toUpperCase())?null:await s.blob());if("blob:"===n.meta.url.protocol&&(l.blob=!0,l.base=l.url=new URL(l.url.pathname)),s.referrer&&s.referrer.startsWith(location.origin)){const e=new URL(n.sourceUrl(s.referrer));(l.headers.origin||n.meta.url.origin!==e.origin&&"cors"===s.mode)&&(l.headers.origin=e.origin),l.headers.referer=e.href}const u=await n.cookie.getCookies(c)||[],d=n.cookie.serialize(u,n.meta,!1);l.headers["user-agent"]=navigator.userAgent,d&&(l.headers.cookie=d);const h=new a(l,null,null);if(this.emit("request",h),h.intercepted)return h.returnValue;const p=await this.bareClient.fetch(l.blob?"blob:"+location.origin+l.url.pathname:l.url,{headers:l.headers,method:l.method,body:l.body,credentials:l.credentials,mode:location.origin!==l.address.origin?"cors":l.mode,redirect:l.redirect}),m=new i(l,p),b=new a(m,null,null);if(this.emit("beforemod",b),b.intercepted)return b.returnValue;for(const e of t)m.headers[e]&&delete m.headers[e];if(m.headers.location&&(m.headers.location=n.rewriteUrl(m.headers.location)),m.headers["set-cookie"]&&(Promise.resolve(n.cookie.setCookies(m.headers["set-cookie"],c,n.meta)).then((()=>{self.clients.matchAll().then((function(e){e.forEach((function(e){e.postMessage({msg:"updateCookies",url:n.meta.url.href})}))}))})),delete m.headers["set-cookie"]),m.body)switch(s.destination){case"script":case"worker":{const e=[n.bundleScript,n.clientScript,n.configScript,n.handlerScript].map((e=>JSON.stringify(e))).join(",");m.body=`if (!self.__uv && self.importScripts) importScripts(${e});\n`,m.body+=n.js.rewrite(await p.text())}break;case"style":m.body=n.rewriteCSS(await p.text());break;case"iframe":case"document":(function(t,r=""){return"text/html"===(e.mime.contentType(r||t.pathname)||"text/html").split(";")[0]})(n.meta.url,m.headers["content-type"]||"")&&(m.body=n.rewriteHtml(await p.text(),{document:!0,injectHead:n.createHtmlInject(n.handlerScript,n.bundleScript,n.clientScript,n.configScript,this.bareClient.data,n.cookie.serialize(u,n.meta,!0),s.referrer)}))}return"text/event-stream"===l.headers.accept&&(m.headers["content-type"]="text/event-stream"),this.emit("response",b),b.intercepted?b.returnValue:new Response(m.body,{headers:m.headers,status:m.status,statusText:m.statusText})}catch(e){return console.error(e),new Response(e.toString(),{status:500})}}get address(){return this.addresses[Math.floor(Math.random()*this.addresses.length)]}static Ultraviolet=e}self.UVServiceWorker=s;class i{constructor(e,t){this.request=e,this.raw=t,this.ultraviolet=e.ultraviolet,this.headers={};for(const e in t.rawHeaders)this.headers[e.toLowerCase()]=t.rawHeaders[e];this.status=t.status,this.statusText=t.statusText,this.body=t.body}get url(){return this.request.url}get base(){return this.request.base}set base(e){this.request.base=e}}class o{constructor(e,t,r,s=null){this.ultraviolet=r,this.request=e,this.headers=Object.fromEntries(e.headers.entries()),this.method=e.method,this.address=t.address,this.body=s||null,this.redirect=e.redirect,this.credentials="omit",this.mode="cors"===e.mode?e.mode:"same-origin",this.blob=!1}get url(){return this.ultraviolet.meta.url}set url(e){this.ultraviolet.meta.url=e}get base(){return this.ultraviolet.meta.base}set base(e){this.ultraviolet.meta.base=e}}class a{#e;#t;constructor(e={},t=null,r=null){this.#e=!1,this.#t=null,this.data=e,this.target=t,this.that=r}get intercepted(){return this.#e}get returnValue(){return this.#t}respondWith(e){this.#t=e,this.#e=!0}}})(); | ||
//# sourceMappingURL=uv.sw.js.map |
{ | ||
"name": "@titaniumnetwork-dev/ultraviolet", | ||
"version": "1.0.4-beta.5", | ||
"version": "1.0.4-beta.6", | ||
"description": "Highly sophisticated proxy used for evading internet censorship or accessing websites in a controlled sandbox using the power of service-workers and more!", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.cjs", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2911439