Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@titaniumnetwork-dev/ultraviolet

Package Overview
Dependencies
Maintainers
4
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@titaniumnetwork-dev/ultraviolet - npm Package Compare versions

Comparing version 3.1.1 to 3.1.2

2

dist/sw.js

@@ -17,3 +17,3 @@ /*global UVServiceWorker,__uv$config*/

(async ()=>{
if(event.request.url.startsWith(location.origin + __uv$config.prefix)) {
if (uv.route(event)) {
return await uv.fetch(event);

@@ -20,0 +20,0 @@ }

@@ -1,2 +0,2 @@

(()=>{var f=self.Ultraviolet,R=self.UVClient,I=self.__uv$config,d=self.__uv$bareData,m=self.__uv$bareURL,v=self.__uv$cookies;if(typeof d!="object"||typeof m!="string"||typeof v!="string")throw new TypeError("Unable to load global UV data");self.__uv||p(self);self.__uvHook=p;function p(o){if("__uv"in o&&o.__uv instanceof f)return!1;o.document&&o.window&&o.document.querySelectorAll("script[__uv-script]").forEach(t=>t.remove());let b=!o.window,_="__uv",i="__uv$",e=new f(I),y=new f.BareClient,a=new R(o,y,b),{HTMLMediaElement:h,HTMLScriptElement:S,HTMLAudioElement:M,HTMLVideoElement:j,HTMLInputElement:H,HTMLEmbedElement:$,HTMLTrackElement:x,HTMLAnchorElement:L,HTMLIFrameElement:u,HTMLAreaElement:O,HTMLLinkElement:T,HTMLBaseElement:E,HTMLFormElement:C,HTMLImageElement:P,HTMLSourceElement:W}=o;a.nativeMethods.defineProperty(o,"__uv",{value:e,enumerable:!1}),e.meta.origin=location.origin,e.location=a.location.emulate(t=>t==="about:srcdoc"?new URL(t):(t.startsWith("blob:")&&(t=t.slice(5)),new URL(e.sourceUrl(t))),t=>e.rewriteUrl(t));let n=v;if(e.meta.url=e.location,e.domain=e.meta.url.host,e.blobUrls=new o.Map,e.referrer="",e.cookies=[],e.localStorageObj={},e.sessionStorageObj={},e.location.href==="about:srcdoc"&&(e.meta=o.parent.__uv.meta),o.EventTarget&&(e.addEventListener=o.EventTarget.prototype.addEventListener,e.removeListener=o.EventTarget.prototype.removeListener,e.dispatchEvent=o.EventTarget.prototype.dispatchEvent),a.nativeMethods.defineProperty(a.storage.storeProto,"__uv$storageObj",{get(){if(this===a.storage.sessionStorage)return e.sessionStorageObj;if(this===a.storage.localStorage)return e.localStorageObj},enumerable:!1}),o.localStorage){for(let t in o.localStorage)t.startsWith(i+e.location.origin+"@")&&(e.localStorageObj[t.slice((i+e.location.origin+"@").length)]=o.localStorage.getItem(t));e.lsWrap=a.storage.emulate(a.storage.localStorage,e.localStorageObj)}if(o.sessionStorage){for(let t in o.sessionStorage)t.startsWith(i+e.location.origin+"@")&&(e.sessionStorageObj[t.slice((i+e.location.origin+"@").length)]=o.sessionStorage.getItem(t));e.ssWrap=a.storage.emulate(a.storage.sessionStorage,e.sessionStorageObj)}let c=o.document?a.node.baseURI.get.call(o.document):o.location.href,k=e.sourceUrl(c);a.nativeMethods.defineProperty(e.meta,"base",{get(){return o.document?(a.node.baseURI.get.call(o.document)!==c&&(c=a.node.baseURI.get.call(o.document),k=e.sourceUrl(c)),k):e.meta.url.href}}),e.methods={setSource:i+"setSource",source:i+"source",location:i+"location",function:i+"function",string:i+"string",eval:i+"eval",parent:i+"parent",top:i+"top"},e.filterKeys=[_,e.methods.setSource,e.methods.source,e.methods.location,e.methods.function,e.methods.string,e.methods.eval,e.methods.parent,e.methods.top,i+"protocol",i+"storageObj",i+"url",i+"modifiedStyle",i+"config",i+"dispatched","Ultraviolet","__uvHook"],a.on("wrap",(t,r)=>{a.nativeMethods.defineProperty(r,"name",a.nativeMethods.getOwnPropertyDescriptor(t,"name")),a.nativeMethods.defineProperty(r,"length",a.nativeMethods.getOwnPropertyDescriptor(t,"length")),a.nativeMethods.defineProperty(r,e.methods.string,{enumerable:!1,value:a.nativeMethods.fnToString.call(t)}),a.nativeMethods.defineProperty(r,e.methods.function,{enumerable:!1,value:t})}),a.fetch.on("request",t=>{t.data.input=e.rewriteUrl(t.data.input)}),a.fetch.on("requestUrl",t=>{t.data.value=e.sourceUrl(t.data.value)}),a.fetch.on("responseUrl",t=>{t.data.value=e.sourceUrl(t.data.value)}),a.xhr.on("open",t=>{t.data.input=e.rewriteUrl(t.data.input)}),a.xhr.on("responseUrl",t=>{t.data.value=e.sourceUrl(t.data.value)}),a.workers.on("worker",t=>{t.data.url=e.rewriteUrl(t.data.url)}),a.workers.on("addModule",t=>{t.data.url=e.rewriteUrl(t.data.url)}),a.workers.on("importScripts",t=>{for(let r in t.data.scripts)t.data.scripts[r]=e.rewriteUrl(t.data.scripts[r])}),a.workers.on("postMessage",t=>{let r=t.data.origin;t.data.origin="*",t.data.message={__data:t.data.message,__origin:e.meta.url.origin,__to:r}}),a.navigator.on("sendBeacon",t=>{t.data.url=e.rewriteUrl(t.data.url)}),a.document.on("getCookie",t=>{t.data.value=n}),a.document.on("setCookie",t=>{e.cookie.db().then(l=>{e.cookie.setCookies(t.data.value,l,e.meta),e.cookie.getCookies(l).then(s=>{n=e.cookie.serialize(s,e.meta,!0)})});let r=e.cookie.setCookie(t.data.value)[0];r.path||(r.path="/"),r.domain||(r.domain=e.meta.url.hostname),e.cookie.validateCookie(r,e.meta,!0)&&(n.length&&(n+="; "),n+=`${r.name}=${r.value}`),t.respondWith(t.data.value)}),a.element.on("setInnerHTML",t=>{switch(t.that.tagName){case"SCRIPT":t.data.value=e.js.rewrite(t.data.value);break;case"STYLE":t.data.value=e.rewriteCSS(t.data.value);break;default:t.data.value=e.rewriteHtml(t.data.value)}}),a.element.on("getInnerHTML",t=>{switch(t.that.tagName){case"SCRIPT":t.data.value=e.js.source(t.data.value);break;default:t.data.value=e.sourceHtml(t.data.value)}}),a.element.on("setOuterHTML",t=>{t.data.value=e.rewriteHtml(t.data.value,{document:t.that.tagName==="HTML"})}),a.element.on("getOuterHTML",t=>{switch(t.that.tagName){case"HEAD":t.data.value=e.sourceHtml(t.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":t.data.value=e.sourceHtml(t.data.value.replace(/<body(.*)>(.*)<\/body>/s,"<op-body$1>$2</op-body>")).replace(/<op-body(.*)>(.*)<\/op-body>/s,"<body$1>$2</body>");break;default:t.data.value=e.sourceHtml(t.data.value,{document:t.that.tagName==="HTML"});break}}),a.document.on("write",t=>{if(!t.data.html.length)return!1;t.data.html=[e.rewriteHtml(t.data.html.join(""))]}),a.document.on("writeln",t=>{if(!t.data.html.length)return!1;t.data.html=[e.rewriteHtml(t.data.html.join(""))]}),a.element.on("insertAdjacentHTML",t=>{t.data.html=e.rewriteHtml(t.data.html)}),a.eventSource.on("construct",t=>{t.data.url=e.rewriteUrl(t.data.url)}),a.eventSource.on("url",t=>{t.data.url=e.rewriteUrl(t.data.url)}),a.idb.on("idbFactoryOpen",t=>{t.data.name!=="__op"&&(t.data.name=`${e.meta.url.origin}@${t.data.name}`)}),a.idb.on("idbFactoryName",t=>{t.data.value=t.data.value.slice(e.meta.url.origin.length+1)}),a.history.on("replaceState",t=>{t.data.url&&(t.data.url=e.rewriteUrl(t.data.url,"__uv"in t.that?t.that.__uv.meta:e.meta))}),a.history.on("pushState",t=>{t.data.url&&(t.data.url=e.rewriteUrl(t.data.url,"__uv"in t.that?t.that.__uv.meta:e.meta))}),a.element.on("getAttribute",t=>{a.element.hasAttribute.call(t.that,e.attributePrefix+"-attr-"+t.data.name)&&t.respondWith(t.target.call(t.that,e.attributePrefix+"-attr-"+t.data.name))}),a.message.on("postMessage",t=>{let r=t.data.origin,l=e.call;t.that&&(l=t.that.__uv$source.call),t.data.origin="*",t.data.message={__data:t.data.message,__origin:(t.that||t.target).__uv$source.location.origin,__to:r},t.respondWith(b?l(t.target,[t.data.message,t.data.transfer],t.that):l(t.target,[t.data.message,t.data.origin,t.data.transfer],t.that))}),a.message.on("data",t=>{let{value:r}=t.data;typeof r=="object"&&"__data"in r&&"__origin"in r&&t.respondWith(r.__data)}),a.message.on("origin",t=>{let r=a.message.messageData.get.call(t.that);typeof r=="object"&&r.__data&&r.__origin&&t.respondWith(r.__origin)}),a.overrideDescriptor(o,"origin",{get:()=>e.location.origin}),a.node.on("baseURI",t=>{t.data.value.startsWith(o.location.origin)&&(t.data.value=e.sourceUrl(t.data.value))}),a.element.on("setAttribute",t=>{if(t.that instanceof h&&t.data.name==="src"&&t.data.value.startsWith("blob:")){t.target.call(t.that,e.attributePrefix+"-attr-"+t.data.name,t.data.value),t.data.value=e.blobUrls.get(t.data.value);return}e.attrs.isUrl(t.data.name)&&(t.target.call(t.that,e.attributePrefix+"-attr-"+t.data.name,t.data.value),t.data.value=e.rewriteUrl(t.data.value)),e.attrs.isStyle(t.data.name)&&(t.target.call(t.that,e.attributePrefix+"-attr-"+t.data.name,t.data.value),t.data.value=e.rewriteCSS(t.data.value,{context:"declarationList"})),e.attrs.isHtml(t.data.name)&&(t.target.call(t.that,e.attributePrefix+"-attr-"+t.data.name,t.data.value),t.data.value=e.rewriteHtml(t.data.value,{...e.meta,document:!0,injectHead:e.createHtmlInject(e.handlerScript,e.bundleScript,e.clientScript,e.configScript,m,d,n,o.location.href)})),e.attrs.isSrcset(t.data.name)&&(t.target.call(t.that,e.attributePrefix+"-attr-"+t.data.name,t.data.value),t.data.value=e.html.wrapSrcset(t.data.value.toString())),e.attrs.isForbidden(t.data.name)&&(t.data.name=e.attributePrefix+"-attr-"+t.data.name)}),a.element.on("audio",t=>{t.data.url=e.rewriteUrl(t.data.url)}),a.element.hookProperty([L,O,T,E],"href",{get:(t,r)=>e.sourceUrl(t.call(r)),set:(t,r,[l])=>{a.element.setAttribute.call(r,e.attributePrefix+"-attr-href",l),t.call(r,e.rewriteUrl(l))}}),a.element.hookProperty([S,M,j,h,P,H,$,u,x,W],"src",{get:(t,r)=>e.sourceUrl(t.call(r)),set:(t,r,[l])=>{if(new String(l).toString().trim().startsWith("blob:")&&r instanceof h)return a.element.setAttribute.call(r,e.attributePrefix+"-attr-src",l),t.call(r,e.blobUrls.get(l)||l);a.element.setAttribute.call(r,e.attributePrefix+"-attr-src",l),t.call(r,e.rewriteUrl(l))}}),a.element.hookProperty([C],"action",{get:(t,r)=>e.sourceUrl(t.call(r)),set:(t,r,[l])=>{a.element.setAttribute.call(r,e.attributePrefix+"-attr-action",l),t.call(r,e.rewriteUrl(l))}}),a.element.hookProperty([P],"srcset",{get:(t,r)=>a.element.getAttribute.call(r,e.attributePrefix+"-attr-srcset")||t.call(r),set:(t,r,[l])=>{a.element.setAttribute.call(r,e.attributePrefix+"-attr-srcset",l),t.call(r,e.html.wrapSrcset(l.toString()))}}),a.element.hookProperty(S,"integrity",{get:(t,r)=>a.element.getAttribute.call(r,e.attributePrefix+"-attr-integrity"),set:(t,r,[l])=>{a.element.setAttribute.call(r,e.attributePrefix+"-attr-integrity",l)}}),a.element.hookProperty(u,"sandbox",{get:(t,r)=>a.element.getAttribute.call(r,e.attributePrefix+"-attr-sandbox")||t.call(r),set:(t,r,[l])=>{a.element.setAttribute.call(r,e.attributePrefix+"-attr-sandbox",l)}});let A=u&&Object.getOwnPropertyDescriptor(u.prototype,"contentWindow").get;function U(t){let r=A.call(t);if(!r.__uv)try{p(r)}catch(l){console.error("catastrophic failure"),console.error(l)}}if(a.element.hookProperty(u,"contentWindow",{get:(t,r)=>(U(r),t.call(r))}),a.element.hookProperty(u,"contentDocument",{get:(t,r)=>(U(r),t.call(r))}),a.element.hookProperty(u,"srcdoc",{get:(t,r)=>a.element.getAttribute.call(r,e.attributePrefix+"-attr-srcdoc")||t.call(r),set:(t,r,[l])=>{t.call(r,e.rewriteHtml(l,{document:!0,injectHead:e.createHtmlInject(e.handlerScript,e.bundleScript,e.clientScript,e.configScript,m,d,n,o.location.href)}))}}),a.node.on("getTextContent",t=>{t.that.tagName==="SCRIPT"&&(t.data.value=e.js.source(t.data.value))}),a.node.on("setTextContent",t=>{t.that.tagName==="SCRIPT"&&(t.data.value=e.js.rewrite(t.data.value))}),"serviceWorker"in o.navigator&&delete o.Navigator.prototype.serviceWorker,a.document.on("getDomain",t=>{t.data.value=e.domain}),a.document.on("setDomain",t=>{if(!t.data.value.toString().endsWith(e.meta.url.hostname.split(".").slice(-2).join(".")))return t.respondWith("");t.respondWith(e.domain=t.data.value)}),a.document.on("url",t=>{t.data.value=e.location.href}),a.document.on("documentURI",t=>{t.data.value=e.location.href}),a.document.on("referrer",t=>{t.data.value=e.referrer||e.sourceUrl(t.data.value)}),a.document.on("parseFromString",t=>{if(t.data.type!=="text/html")return!1;t.data.string=e.rewriteHtml(t.data.string,{...e.meta,document:!0})}),a.attribute.on("getValue",t=>{a.element.hasAttribute.call(t.that.ownerElement,e.attributePrefix+"-attr-"+t.data.name)&&(t.data.value=a.element.getAttribute.call(t.that.ownerElement,e.attributePrefix+"-attr-"+t.data.name))}),a.attribute.on("setValue",t=>{e.attrs.isUrl(t.data.name)&&(a.element.setAttribute.call(t.that.ownerElement,e.attributePrefix+"-attr-"+t.data.name,t.data.value),t.data.value=e.rewriteUrl(t.data.value)),e.attrs.isStyle(t.data.name)&&(a.element.setAttribute.call(t.that.ownerElement,e.attributePrefix+"-attr-"+t.data.name,t.data.value),t.data.value=e.rewriteCSS(t.data.value,{context:"declarationList"})),e.attrs.isHtml(t.data.name)&&(a.element.setAttribute.call(t.that.ownerElement,e.attributePrefix+"-attr-"+t.data.name,t.data.value),t.data.value=e.rewriteHtml(t.data.value,{...e.meta,document:!0,injectHead:e.createHtmlInject(e.handlerScript,e.bundleScript,e.clientScript,e.configScript,m,d,n,o.location.href)})),e.attrs.isSrcset(t.data.name)&&(a.element.setAttribute.call(t.that.ownerElement,e.attributePrefix+"-attr-"+t.data.name,t.data.value),t.data.value=e.html.wrapSrcset(t.data.value.toString()))}),a.url.on("createObjectURL",t=>{let r=t.target.call(t.that,t.data.object);if(r.startsWith("blob:"+location.origin)){let l="blob:"+(e.meta.url.href!=="about:blank"?e.meta.url.origin:o.parent.__uv.meta.url.origin)+r.slice(5+location.origin.length);e.blobUrls.set(l,r),t.respondWith(l)}else t.respondWith(r)}),a.url.on("revokeObjectURL",t=>{if(e.blobUrls.has(t.data.url)){let r=t.data.url;t.data.url=e.blobUrls.get(t.data.url),e.blobUrls.delete(r)}}),a.storage.on("get",t=>{t.data.name=i+e.meta.url.origin+"@"+t.data.name}),a.storage.on("set",t=>{t.that.__uv$storageObj&&(t.that.__uv$storageObj[t.data.name]=t.data.value),t.data.name=i+e.meta.url.origin+"@"+t.data.name}),a.storage.on("delete",t=>{t.that.__uv$storageObj&&delete t.that.__uv$storageObj[t.data.name],t.data.name=i+e.meta.url.origin+"@"+t.data.name}),a.storage.on("getItem",t=>{t.data.name=i+e.meta.url.origin+"@"+t.data.name}),a.storage.on("setItem",t=>{t.that.__uv$storageObj&&(t.that.__uv$storageObj[t.data.name]=t.data.value),t.data.name=i+e.meta.url.origin+"@"+t.data.name}),a.storage.on("removeItem",t=>{t.that.__uv$storageObj&&delete t.that.__uv$storageObj[t.data.name],t.data.name=i+e.meta.url.origin+"@"+t.data.name}),a.storage.on("clear",t=>{if(t.that.__uv$storageObj)for(let r of a.nativeMethods.keys.call(null,t.that.__uv$storageObj))delete t.that.__uv$storageObj[r],a.storage.removeItem.call(t.that,i+e.meta.url.origin+"@"+r),t.respondWith()}),a.storage.on("length",t=>{t.that.__uv$storageObj&&t.respondWith(a.nativeMethods.keys.call(null,t.that.__uv$storageObj).length)}),a.storage.on("key",t=>{t.that.__uv$storageObj&&t.respondWith(a.nativeMethods.keys.call(null,t.that.__uv$storageObj)[t.data.index]||null)}),a.websocket.on("websocket",async t=>{let r=Object.create(null);r.Origin=e.meta.url.origin,r["User-Agent"]=navigator.userAgent,n!==""&&(r.Cookie=n.toString()),t.respondWith(y.createWebSocket(t.data.args[0],t.data.args[1],t.target,r))}),a.websocket.on("readyState",t=>{"__uv$getReadyState"in t.that&&(t.data.value=t.that.__uv$getReadyState())}),a.websocket.on("send",t=>{if("__uv$getSendError"in t.that){let r=t.that.__uv$getSendError();if(r)throw r}}),a.websocket.on("url",t=>{"__uv$socketUrl"in t.that&&(t.data.value=t.that.__uv$socketUrl.toString())}),a.websocket.on("protocol",t=>{"__uv$getProtocol"in t.that&&(t.data.value=t.that.__uv$getProtocol())}),a.function.on("function",t=>{t.data.script=e.rewriteJS(t.data.script)}),a.function.on("toString",t=>{e.methods.string in t.that&&t.respondWith(t.that[e.methods.string])}),a.object.on("getOwnPropertyNames",t=>{t.data.names=t.data.names.filter(r=>!e.filterKeys.includes(r))}),a.object.on("getOwnPropertyDescriptors",t=>{for(let r of e.filterKeys)delete t.data.descriptors[r]}),a.style.on("setProperty",t=>{a.style.dashedUrlProps.includes(t.data.property)&&(t.data.value=e.rewriteCSS(t.data.value,{context:"value",...e.meta}))}),a.style.on("getPropertyValue",t=>{a.style.dashedUrlProps.includes(t.data.property)&&t.respondWith(e.sourceCSS(t.target.call(t.that,t.data.property),{context:"value",...e.meta}))}),"CSS2Properties"in o)for(let t of a.style.urlProps)a.overrideDescriptor(o.CSS2Properties.prototype,t,{get:(r,l)=>e.sourceCSS(r.call(l),{context:"value",...e.meta}),set:(r,l,s)=>{r.call(l,e.rewriteCSS(s,{context:"value",...e.meta}))}});else"HTMLElement"in o&&a.overrideDescriptor(o.HTMLElement.prototype,"style",{get:(t,r)=>{let l=t.call(r);if(!l[i+"modifiedStyle"])for(let s of a.style.urlProps)a.nativeMethods.defineProperty(l,s,{enumerable:!0,configurable:!0,get(){let g=a.style.getPropertyValue.call(this,s)||"";return e.sourceCSS(g,{context:"value",...e.meta})},set(g){a.style.setProperty.call(this,a.style.propToDashed[s]||s,e.rewriteCSS(g,{context:"value",...e.meta}))}}),a.nativeMethods.defineProperty(l,i+"modifiedStyle",{enumerable:!1,value:!0});return l}});a.style.on("setCssText",t=>{t.data.value=e.rewriteCSS(t.data.value,{context:"declarationList",...e.meta})}),a.style.on("getCssText",t=>{t.data.value=e.sourceCSS(t.data.value,{context:"declarationList",...e.meta})}),e.addEventListener.call(o,"hashchange",t=>{if(t.__uv$dispatched)return!1;t.stopImmediatePropagation();let r=o.location.hash;a.history.replaceState.call(o.history,"","",t.oldURL),e.location.hash=r}),a.location.on("hashchange",(t,r,l)=>{if(l.HashChangeEvent&&a.history.replaceState){a.history.replaceState.call(o.history,"","",e.rewriteUrl(r));let s=new l.HashChangeEvent("hashchange",{newURL:r,oldURL:t});a.nativeMethods.defineProperty(s,i+"dispatched",{value:!0,enumerable:!1}),e.dispatchEvent.call(o,s)}}),a.fetch.overrideRequest(),a.fetch.overrideUrl(),a.xhr.overrideOpen(),a.xhr.overrideResponseUrl(),a.element.overrideHtml(),a.element.overrideAttribute(),a.element.overrideInsertAdjacentHTML(),a.element.overrideAudio(),a.node.overrideBaseURI(),a.node.overrideTextContent(),a.attribute.overrideNameValue(),a.document.overrideDomain(),a.document.overrideURL(),a.document.overrideDocumentURI(),a.document.overrideWrite(),a.document.overrideReferrer(),a.document.overrideParseFromString(),a.storage.overrideMethods(),a.storage.overrideLength(),a.object.overrideGetPropertyNames(),a.object.overrideGetOwnPropertyDescriptors(),a.idb.overrideName(),a.idb.overrideOpen(),a.history.overridePushState(),a.history.overrideReplaceState(),a.eventSource.overrideConstruct(),a.eventSource.overrideUrl(),a.websocket.overrideWebSocket(),a.websocket.overrideProtocol(),a.websocket.overrideURL(),a.websocket.overrideReadyState(),a.websocket.overrideProtocol(),a.websocket.overrideSend(),a.url.overrideObjectURL(),a.document.overrideCookie(),a.message.overridePostMessage(),a.message.overrideMessageOrigin(),a.message.overrideMessageData(),a.workers.overrideWorker(),a.workers.overrideAddModule(),a.workers.overrideImportScripts(),a.workers.overridePostMessage(),a.style.overrideSetGetProperty(),a.style.overrideCssText(),a.navigator.overrideSendBeacon(),a.function.overrideFunction(),a.function.overrideToString(),a.location.overrideWorkerLocation(t=>new URL(e.sourceUrl(t))),a.overrideDescriptor(o,"localStorage",{get:(t,r)=>(r||o).__uv.lsWrap}),a.overrideDescriptor(o,"sessionStorage",{get:(t,r)=>(r||o).__uv.ssWrap}),a.override(o,"open",(t,r,l)=>{if(!l.length)return t.apply(r,l);let[s]=l;return s=e.rewriteUrl(s),t.call(r,s)}),e.$wrap=function(t){return t==="location"?e.methods.location:t==="eval"?e.methods.eval:t},e.$get=function(t){return t===o.location?e.location:t===o.eval?e.eval:t===o.parent?o.__uv$parent:t===o.top?o.__uv$top:t},e.eval=a.wrap(o,"eval",(t,r,l)=>{if(!l.length||typeof l[0]!="string")return t.apply(r,l);let[s]=l;return s=e.rewriteJS(s),t.call(r,s)}),e.call=function(t,r,l){return l?t.apply(l,r):t(...r)},e.call$=function(t,r,l=[]){return t[r].apply(t,l)},a.nativeMethods.defineProperty(o.Object.prototype,_,{get:()=>e,enumerable:!1}),a.nativeMethods.defineProperty(o.Object.prototype,e.methods.setSource,{value:function(t){return a.nativeMethods.isExtensible(this)?(a.nativeMethods.defineProperty(this,e.methods.source,{value:t,writable:!0,enumerable:!1}),this):this},enumerable:!1}),a.nativeMethods.defineProperty(o.Object.prototype,e.methods.source,{value:e,writable:!0,enumerable:!1}),a.nativeMethods.defineProperty(o.Object.prototype,e.methods.location,{configurable:!0,get(){return this===o.document||this===o?e.location:this.location},set(t){this===o.document||this===o?e.location.href=t:this.location=t}}),a.nativeMethods.defineProperty(o.Object.prototype,e.methods.parent,{configurable:!0,get(){let t=this.parent;if(this===o)try{return"__uv"in t?t:this}catch{return this}return t},set(t){this.parent=t}}),a.nativeMethods.defineProperty(o.Object.prototype,e.methods.top,{configurable:!0,get(){let t=this.top;if(this===o){if(t===this.parent)return this[e.methods.parent];try{if("__uv"in t)return t;{let r=this;for(;r.parent!==t;)r=r.parent;return"__uv"in r?r:this}}catch{return this}}return t},set(t){this.top=t}}),a.nativeMethods.defineProperty(o.Object.prototype,e.methods.eval,{configurable:!0,get(){return this===o?e.eval:this.eval},set(t){this.eval=t}})}})();
(()=>{var h=self.Ultraviolet,W=self.UVClient,A=self.__uv$config,k=self.__uv$cookies;if(typeof k!="string")throw new TypeError("Unable to load global UV data");self.__uv||g(self);self.__uvHook=g;function g(o){if("__uv"in o&&o.__uv instanceof h)return!1;o.document&&o.window&&o.document.querySelectorAll("script[__uv-script]").forEach(t=>t.remove());let f=!o.window,p="__uv",i="__uv$",e=new h(A),b=new h.BareClient,a=new W(o,b,f),{HTMLMediaElement:d,HTMLScriptElement:_,HTMLAudioElement:U,HTMLVideoElement:v,HTMLInputElement:M,HTMLEmbedElement:j,HTMLTrackElement:H,HTMLAnchorElement:x,HTMLIFrameElement:u,HTMLAreaElement:O,HTMLLinkElement:L,HTMLBaseElement:$,HTMLFormElement:T,HTMLImageElement:y,HTMLSourceElement:E}=o;a.nativeMethods.defineProperty(o,"__uv",{value:e,enumerable:!1}),e.meta.origin=location.origin,e.location=a.location.emulate(t=>t==="about:srcdoc"?new URL(t):(t.startsWith("blob:")&&(t=t.slice(5)),new URL(e.sourceUrl(t))),t=>e.rewriteUrl(t));let n=k;if(e.meta.url=e.location,e.domain=e.meta.url.host,e.blobUrls=new o.Map,e.referrer="",e.cookies=[],e.localStorageObj={},e.sessionStorageObj={},e.location.href==="about:srcdoc"&&(e.meta=o.parent.__uv.meta),o.EventTarget&&(e.addEventListener=o.EventTarget.prototype.addEventListener,e.removeListener=o.EventTarget.prototype.removeListener,e.dispatchEvent=o.EventTarget.prototype.dispatchEvent),a.nativeMethods.defineProperty(a.storage.storeProto,"__uv$storageObj",{get(){if(this===a.storage.sessionStorage)return e.sessionStorageObj;if(this===a.storage.localStorage)return e.localStorageObj},enumerable:!1}),o.localStorage){for(let t in o.localStorage)t.startsWith(i+e.location.origin+"@")&&(e.localStorageObj[t.slice((i+e.location.origin+"@").length)]=o.localStorage.getItem(t));e.lsWrap=a.storage.emulate(a.storage.localStorage,e.localStorageObj)}if(o.sessionStorage){for(let t in o.sessionStorage)t.startsWith(i+e.location.origin+"@")&&(e.sessionStorageObj[t.slice((i+e.location.origin+"@").length)]=o.sessionStorage.getItem(t));e.ssWrap=a.storage.emulate(a.storage.sessionStorage,e.sessionStorageObj)}let c=o.document?a.node.baseURI.get.call(o.document):o.location.href,S=e.sourceUrl(c);a.nativeMethods.defineProperty(e.meta,"base",{get(){return o.document?(a.node.baseURI.get.call(o.document)!==c&&(c=a.node.baseURI.get.call(o.document),S=e.sourceUrl(c)),S):e.meta.url.href}}),e.methods={setSource:i+"setSource",source:i+"source",location:i+"location",function:i+"function",string:i+"string",eval:i+"eval",parent:i+"parent",top:i+"top"},e.filterKeys=[p,e.methods.setSource,e.methods.source,e.methods.location,e.methods.function,e.methods.string,e.methods.eval,e.methods.parent,e.methods.top,i+"protocol",i+"storageObj",i+"url",i+"modifiedStyle",i+"config",i+"dispatched","Ultraviolet","__uvHook"],a.on("wrap",(t,r)=>{a.nativeMethods.defineProperty(r,"name",a.nativeMethods.getOwnPropertyDescriptor(t,"name")),a.nativeMethods.defineProperty(r,"length",a.nativeMethods.getOwnPropertyDescriptor(t,"length")),a.nativeMethods.defineProperty(r,e.methods.string,{enumerable:!1,value:a.nativeMethods.fnToString.call(t)}),a.nativeMethods.defineProperty(r,e.methods.function,{enumerable:!1,value:t})}),a.fetch.on("request",t=>{t.data.input=e.rewriteUrl(t.data.input)}),a.fetch.on("requestUrl",t=>{t.data.value=e.sourceUrl(t.data.value)}),a.fetch.on("responseUrl",t=>{t.data.value=e.sourceUrl(t.data.value)}),a.xhr.on("open",t=>{t.data.input=e.rewriteUrl(t.data.input)}),a.xhr.on("responseUrl",t=>{t.data.value=e.sourceUrl(t.data.value)}),a.workers.on("worker",t=>{t.data.url=e.rewriteUrl(t.data.url)}),a.workers.on("addModule",t=>{t.data.url=e.rewriteUrl(t.data.url)}),a.workers.on("importScripts",t=>{for(let r in t.data.scripts)t.data.scripts[r]=e.rewriteUrl(t.data.scripts[r])}),a.workers.on("postMessage",t=>{let r=t.data.origin;t.data.origin="*",t.data.message={__data:t.data.message,__origin:e.meta.url.origin,__to:r}}),a.navigator.on("sendBeacon",t=>{t.data.url=e.rewriteUrl(t.data.url)}),a.document.on("getCookie",t=>{t.data.value=n}),a.document.on("setCookie",t=>{e.cookie.db().then(l=>{e.cookie.setCookies(t.data.value,l,e.meta),e.cookie.getCookies(l).then(s=>{n=e.cookie.serialize(s,e.meta,!0)})});let r=e.cookie.setCookie(t.data.value)[0];r.path||(r.path="/"),r.domain||(r.domain=e.meta.url.hostname),e.cookie.validateCookie(r,e.meta,!0)&&(n.length&&(n+="; "),n+=`${r.name}=${r.value}`),t.respondWith(t.data.value)}),a.element.on("setInnerHTML",t=>{switch(t.that.tagName){case"SCRIPT":t.data.value=e.js.rewrite(t.data.value);break;case"STYLE":t.data.value=e.rewriteCSS(t.data.value);break;default:t.data.value=e.rewriteHtml(t.data.value)}}),a.element.on("getInnerHTML",t=>{switch(t.that.tagName){case"SCRIPT":t.data.value=e.js.source(t.data.value);break;default:t.data.value=e.sourceHtml(t.data.value)}}),a.element.on("setOuterHTML",t=>{t.data.value=e.rewriteHtml(t.data.value,{document:t.that.tagName==="HTML"})}),a.element.on("getOuterHTML",t=>{switch(t.that.tagName){case"HEAD":t.data.value=e.sourceHtml(t.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":t.data.value=e.sourceHtml(t.data.value.replace(/<body(.*)>(.*)<\/body>/s,"<op-body$1>$2</op-body>")).replace(/<op-body(.*)>(.*)<\/op-body>/s,"<body$1>$2</body>");break;default:t.data.value=e.sourceHtml(t.data.value,{document:t.that.tagName==="HTML"});break}}),a.document.on("write",t=>{if(!t.data.html.length)return!1;t.data.html=[e.rewriteHtml(t.data.html.join(""))]}),a.document.on("writeln",t=>{if(!t.data.html.length)return!1;t.data.html=[e.rewriteHtml(t.data.html.join(""))]}),a.element.on("insertAdjacentHTML",t=>{t.data.html=e.rewriteHtml(t.data.html)}),a.eventSource.on("construct",t=>{t.data.url=e.rewriteUrl(t.data.url)}),a.eventSource.on("url",t=>{t.data.url=e.rewriteUrl(t.data.url)}),a.idb.on("idbFactoryOpen",t=>{t.data.name!=="__op"&&(t.data.name=`${e.meta.url.origin}@${t.data.name}`)}),a.idb.on("idbFactoryName",t=>{t.data.value=t.data.value.slice(e.meta.url.origin.length+1)}),a.history.on("replaceState",t=>{t.data.url&&(t.data.url=e.rewriteUrl(t.data.url,"__uv"in t.that?t.that.__uv.meta:e.meta))}),a.history.on("pushState",t=>{t.data.url&&(t.data.url=e.rewriteUrl(t.data.url,"__uv"in t.that?t.that.__uv.meta:e.meta))}),a.element.on("getAttribute",t=>{a.element.hasAttribute.call(t.that,e.attributePrefix+"-attr-"+t.data.name)&&t.respondWith(t.target.call(t.that,e.attributePrefix+"-attr-"+t.data.name))}),a.message.on("postMessage",t=>{let r=t.data.origin,l=e.call;t.that&&(l=t.that.__uv$source.call),t.data.origin="*",t.data.message={__data:t.data.message,__origin:(t.that||t.target).__uv$source.location.origin,__to:r},t.respondWith(f?l(t.target,[t.data.message,t.data.transfer],t.that):l(t.target,[t.data.message,t.data.origin,t.data.transfer],t.that))}),a.message.on("data",t=>{let{value:r}=t.data;typeof r=="object"&&"__data"in r&&"__origin"in r&&t.respondWith(r.__data)}),a.message.on("origin",t=>{let r=a.message.messageData.get.call(t.that);typeof r=="object"&&r.__data&&r.__origin&&t.respondWith(r.__origin)}),a.overrideDescriptor(o,"origin",{get:()=>e.location.origin}),a.node.on("baseURI",t=>{t.data.value.startsWith(o.location.origin)&&(t.data.value=e.sourceUrl(t.data.value))}),a.element.on("setAttribute",t=>{if(t.that instanceof d&&t.data.name==="src"&&t.data.value.startsWith("blob:")){t.target.call(t.that,e.attributePrefix+"-attr-"+t.data.name,t.data.value),t.data.value=e.blobUrls.get(t.data.value);return}e.attrs.isUrl(t.data.name)&&(t.target.call(t.that,e.attributePrefix+"-attr-"+t.data.name,t.data.value),t.data.value=e.rewriteUrl(t.data.value)),e.attrs.isStyle(t.data.name)&&(t.target.call(t.that,e.attributePrefix+"-attr-"+t.data.name,t.data.value),t.data.value=e.rewriteCSS(t.data.value,{context:"declarationList"})),e.attrs.isHtml(t.data.name)&&(t.target.call(t.that,e.attributePrefix+"-attr-"+t.data.name,t.data.value),t.data.value=e.rewriteHtml(t.data.value,{...e.meta,document:!0,injectHead:e.createHtmlInject(e.handlerScript,e.bundleScript,e.clientScript,e.configScript,n,o.location.href)})),e.attrs.isSrcset(t.data.name)&&(t.target.call(t.that,e.attributePrefix+"-attr-"+t.data.name,t.data.value),t.data.value=e.html.wrapSrcset(t.data.value.toString())),e.attrs.isForbidden(t.data.name)&&(t.data.name=e.attributePrefix+"-attr-"+t.data.name)}),a.element.on("audio",t=>{t.data.url=e.rewriteUrl(t.data.url)}),a.element.hookProperty([x,O,L,$],"href",{get:(t,r)=>e.sourceUrl(t.call(r)),set:(t,r,[l])=>{a.element.setAttribute.call(r,e.attributePrefix+"-attr-href",l),t.call(r,e.rewriteUrl(l))}}),a.element.hookProperty([_,U,v,d,y,M,j,u,H,E],"src",{get:(t,r)=>e.sourceUrl(t.call(r)),set:(t,r,[l])=>{if(new String(l).toString().trim().startsWith("blob:")&&r instanceof d)return a.element.setAttribute.call(r,e.attributePrefix+"-attr-src",l),t.call(r,e.blobUrls.get(l)||l);a.element.setAttribute.call(r,e.attributePrefix+"-attr-src",l),t.call(r,e.rewriteUrl(l))}}),a.element.hookProperty([T],"action",{get:(t,r)=>e.sourceUrl(t.call(r)),set:(t,r,[l])=>{a.element.setAttribute.call(r,e.attributePrefix+"-attr-action",l),t.call(r,e.rewriteUrl(l))}}),a.element.hookProperty([y],"srcset",{get:(t,r)=>a.element.getAttribute.call(r,e.attributePrefix+"-attr-srcset")||t.call(r),set:(t,r,[l])=>{a.element.setAttribute.call(r,e.attributePrefix+"-attr-srcset",l),t.call(r,e.html.wrapSrcset(l.toString()))}}),a.element.hookProperty(_,"integrity",{get:(t,r)=>a.element.getAttribute.call(r,e.attributePrefix+"-attr-integrity"),set:(t,r,[l])=>{a.element.setAttribute.call(r,e.attributePrefix+"-attr-integrity",l)}}),a.element.hookProperty(u,"sandbox",{get:(t,r)=>a.element.getAttribute.call(r,e.attributePrefix+"-attr-sandbox")||t.call(r),set:(t,r,[l])=>{a.element.setAttribute.call(r,e.attributePrefix+"-attr-sandbox",l)}});let C=u&&Object.getOwnPropertyDescriptor(u.prototype,"contentWindow").get;function P(t){let r=C.call(t);if(!r.__uv)try{g(r)}catch(l){console.error("catastrophic failure"),console.error(l)}}if(a.element.hookProperty(u,"contentWindow",{get:(t,r)=>(P(r),t.call(r))}),a.element.hookProperty(u,"contentDocument",{get:(t,r)=>(P(r),t.call(r))}),a.element.hookProperty(u,"srcdoc",{get:(t,r)=>a.element.getAttribute.call(r,e.attributePrefix+"-attr-srcdoc")||t.call(r),set:(t,r,[l])=>{t.call(r,e.rewriteHtml(l,{document:!0,injectHead:e.createHtmlInject(e.handlerScript,e.bundleScript,e.clientScript,e.configScript,n,o.location.href)}))}}),a.node.on("getTextContent",t=>{t.that.tagName==="SCRIPT"&&(t.data.value=e.js.source(t.data.value))}),a.node.on("setTextContent",t=>{t.that.tagName==="SCRIPT"&&(t.data.value=e.js.rewrite(t.data.value))}),"serviceWorker"in o.navigator&&delete o.Navigator.prototype.serviceWorker,a.document.on("getDomain",t=>{t.data.value=e.domain}),a.document.on("setDomain",t=>{if(!t.data.value.toString().endsWith(e.meta.url.hostname.split(".").slice(-2).join(".")))return t.respondWith("");t.respondWith(e.domain=t.data.value)}),a.document.on("url",t=>{t.data.value=e.location.href}),a.document.on("documentURI",t=>{t.data.value=e.location.href}),a.document.on("referrer",t=>{t.data.value=e.referrer||e.sourceUrl(t.data.value)}),a.document.on("parseFromString",t=>{if(t.data.type!=="text/html")return!1;t.data.string=e.rewriteHtml(t.data.string,{...e.meta,document:!0})}),a.attribute.on("getValue",t=>{a.element.hasAttribute.call(t.that.ownerElement,e.attributePrefix+"-attr-"+t.data.name)&&(t.data.value=a.element.getAttribute.call(t.that.ownerElement,e.attributePrefix+"-attr-"+t.data.name))}),a.attribute.on("setValue",t=>{e.attrs.isUrl(t.data.name)&&(a.element.setAttribute.call(t.that.ownerElement,e.attributePrefix+"-attr-"+t.data.name,t.data.value),t.data.value=e.rewriteUrl(t.data.value)),e.attrs.isStyle(t.data.name)&&(a.element.setAttribute.call(t.that.ownerElement,e.attributePrefix+"-attr-"+t.data.name,t.data.value),t.data.value=e.rewriteCSS(t.data.value,{context:"declarationList"})),e.attrs.isHtml(t.data.name)&&(a.element.setAttribute.call(t.that.ownerElement,e.attributePrefix+"-attr-"+t.data.name,t.data.value),t.data.value=e.rewriteHtml(t.data.value,{...e.meta,document:!0,injectHead:e.createHtmlInject(e.handlerScript,e.bundleScript,e.clientScript,e.configScript,n,o.location.href)})),e.attrs.isSrcset(t.data.name)&&(a.element.setAttribute.call(t.that.ownerElement,e.attributePrefix+"-attr-"+t.data.name,t.data.value),t.data.value=e.html.wrapSrcset(t.data.value.toString()))}),a.url.on("createObjectURL",t=>{let r=t.target.call(t.that,t.data.object);if(r.startsWith("blob:"+location.origin)){let l="blob:"+(e.meta.url.href!=="about:blank"?e.meta.url.origin:o.parent.__uv.meta.url.origin)+r.slice(5+location.origin.length);e.blobUrls.set(l,r),t.respondWith(l)}else t.respondWith(r)}),a.url.on("revokeObjectURL",t=>{if(e.blobUrls.has(t.data.url)){let r=t.data.url;t.data.url=e.blobUrls.get(t.data.url),e.blobUrls.delete(r)}}),a.storage.on("get",t=>{t.data.name=i+e.meta.url.origin+"@"+t.data.name}),a.storage.on("set",t=>{t.that.__uv$storageObj&&(t.that.__uv$storageObj[t.data.name]=t.data.value),t.data.name=i+e.meta.url.origin+"@"+t.data.name}),a.storage.on("delete",t=>{t.that.__uv$storageObj&&delete t.that.__uv$storageObj[t.data.name],t.data.name=i+e.meta.url.origin+"@"+t.data.name}),a.storage.on("getItem",t=>{t.data.name=i+e.meta.url.origin+"@"+t.data.name}),a.storage.on("setItem",t=>{t.that.__uv$storageObj&&(t.that.__uv$storageObj[t.data.name]=t.data.value),t.data.name=i+e.meta.url.origin+"@"+t.data.name}),a.storage.on("removeItem",t=>{t.that.__uv$storageObj&&delete t.that.__uv$storageObj[t.data.name],t.data.name=i+e.meta.url.origin+"@"+t.data.name}),a.storage.on("clear",t=>{if(t.that.__uv$storageObj)for(let r of a.nativeMethods.keys.call(null,t.that.__uv$storageObj))delete t.that.__uv$storageObj[r],a.storage.removeItem.call(t.that,i+e.meta.url.origin+"@"+r),t.respondWith()}),a.storage.on("length",t=>{t.that.__uv$storageObj&&t.respondWith(a.nativeMethods.keys.call(null,t.that.__uv$storageObj).length)}),a.storage.on("key",t=>{t.that.__uv$storageObj&&t.respondWith(a.nativeMethods.keys.call(null,t.that.__uv$storageObj)[t.data.index]||null)}),a.websocket.on("websocket",async t=>{let r=Object.create(null);r.Origin=e.meta.url.origin,r["User-Agent"]=navigator.userAgent,n!==""&&(r.Cookie=n.toString()),t.respondWith(b.createWebSocket(t.data.args[0],t.data.args[1],t.target,r))}),a.websocket.on("readyState",t=>{"__uv$getReadyState"in t.that&&(t.data.value=t.that.__uv$getReadyState())}),a.websocket.on("send",t=>{if("__uv$getSendError"in t.that){let r=t.that.__uv$getSendError();if(r)throw r}}),a.websocket.on("url",t=>{"__uv$socketUrl"in t.that&&(t.data.value=t.that.__uv$socketUrl.toString())}),a.websocket.on("protocol",t=>{"__uv$getProtocol"in t.that&&(t.data.value=t.that.__uv$getProtocol())}),a.function.on("function",t=>{t.data.script=e.rewriteJS(t.data.script)}),a.function.on("toString",t=>{e.methods.string in t.that&&t.respondWith(t.that[e.methods.string])}),a.object.on("getOwnPropertyNames",t=>{t.data.names=t.data.names.filter(r=>!e.filterKeys.includes(r))}),a.object.on("getOwnPropertyDescriptors",t=>{for(let r of e.filterKeys)delete t.data.descriptors[r]}),a.style.on("setProperty",t=>{a.style.dashedUrlProps.includes(t.data.property)&&(t.data.value=e.rewriteCSS(t.data.value,{context:"value",...e.meta}))}),a.style.on("getPropertyValue",t=>{a.style.dashedUrlProps.includes(t.data.property)&&t.respondWith(e.sourceCSS(t.target.call(t.that,t.data.property),{context:"value",...e.meta}))}),"CSS2Properties"in o)for(let t of a.style.urlProps)a.overrideDescriptor(o.CSS2Properties.prototype,t,{get:(r,l)=>e.sourceCSS(r.call(l),{context:"value",...e.meta}),set:(r,l,s)=>{r.call(l,e.rewriteCSS(s,{context:"value",...e.meta}))}});else"HTMLElement"in o&&a.overrideDescriptor(o.HTMLElement.prototype,"style",{get:(t,r)=>{let l=t.call(r);if(!l[i+"modifiedStyle"])for(let s of a.style.urlProps)a.nativeMethods.defineProperty(l,s,{enumerable:!0,configurable:!0,get(){let m=a.style.getPropertyValue.call(this,s)||"";return e.sourceCSS(m,{context:"value",...e.meta})},set(m){a.style.setProperty.call(this,a.style.propToDashed[s]||s,e.rewriteCSS(m,{context:"value",...e.meta}))}}),a.nativeMethods.defineProperty(l,i+"modifiedStyle",{enumerable:!1,value:!0});return l}});a.style.on("setCssText",t=>{t.data.value=e.rewriteCSS(t.data.value,{context:"declarationList",...e.meta})}),a.style.on("getCssText",t=>{t.data.value=e.sourceCSS(t.data.value,{context:"declarationList",...e.meta})}),e.addEventListener.call(o,"hashchange",t=>{if(t.__uv$dispatched)return!1;t.stopImmediatePropagation();let r=o.location.hash;a.history.replaceState.call(o.history,"","",t.oldURL),e.location.hash=r}),a.location.on("hashchange",(t,r,l)=>{if(l.HashChangeEvent&&a.history.replaceState){a.history.replaceState.call(o.history,"","",e.rewriteUrl(r));let s=new l.HashChangeEvent("hashchange",{newURL:r,oldURL:t});a.nativeMethods.defineProperty(s,i+"dispatched",{value:!0,enumerable:!1}),e.dispatchEvent.call(o,s)}}),a.fetch.overrideRequest(),a.fetch.overrideUrl(),a.xhr.overrideOpen(),a.xhr.overrideResponseUrl(),a.element.overrideHtml(),a.element.overrideAttribute(),a.element.overrideInsertAdjacentHTML(),a.element.overrideAudio(),a.node.overrideBaseURI(),a.node.overrideTextContent(),a.attribute.overrideNameValue(),a.document.overrideDomain(),a.document.overrideURL(),a.document.overrideDocumentURI(),a.document.overrideWrite(),a.document.overrideReferrer(),a.document.overrideParseFromString(),a.storage.overrideMethods(),a.storage.overrideLength(),a.object.overrideGetPropertyNames(),a.object.overrideGetOwnPropertyDescriptors(),a.idb.overrideName(),a.idb.overrideOpen(),a.history.overridePushState(),a.history.overrideReplaceState(),a.eventSource.overrideConstruct(),a.eventSource.overrideUrl(),a.websocket.overrideWebSocket(),a.websocket.overrideProtocol(),a.websocket.overrideURL(),a.websocket.overrideReadyState(),a.websocket.overrideProtocol(),a.websocket.overrideSend(),a.url.overrideObjectURL(),a.document.overrideCookie(),a.message.overridePostMessage(),a.message.overrideMessageOrigin(),a.message.overrideMessageData(),a.workers.overrideWorker(),a.workers.overrideAddModule(),a.workers.overrideImportScripts(),a.workers.overridePostMessage(),a.style.overrideSetGetProperty(),a.style.overrideCssText(),a.navigator.overrideSendBeacon(),a.function.overrideFunction(),a.function.overrideToString(),a.location.overrideWorkerLocation(t=>new URL(e.sourceUrl(t))),a.overrideDescriptor(o,"localStorage",{get:(t,r)=>(r||o).__uv.lsWrap}),a.overrideDescriptor(o,"sessionStorage",{get:(t,r)=>(r||o).__uv.ssWrap}),a.override(o,"open",(t,r,l)=>{if(!l.length)return t.apply(r,l);let[s]=l;return s=e.rewriteUrl(s),t.call(r,s)}),e.$wrap=function(t){return t==="location"?e.methods.location:t==="eval"?e.methods.eval:t},e.$get=function(t){return t===o.location?e.location:t===o.eval?e.eval:t===o.parent?o.__uv$parent:t===o.top?o.__uv$top:t},e.eval=a.wrap(o,"eval",(t,r,l)=>{if(!l.length||typeof l[0]!="string")return t.apply(r,l);let[s]=l;return s=e.rewriteJS(s),t.call(r,s)}),e.call=function(t,r,l){return l?t.apply(l,r):t(...r)},e.call$=function(t,r,l=[]){return t[r].apply(t,l)},a.nativeMethods.defineProperty(o.Object.prototype,p,{get:()=>e,enumerable:!1}),a.nativeMethods.defineProperty(o.Object.prototype,e.methods.setSource,{value:function(t){return a.nativeMethods.isExtensible(this)?(a.nativeMethods.defineProperty(this,e.methods.source,{value:t,writable:!0,enumerable:!1}),this):this},enumerable:!1}),a.nativeMethods.defineProperty(o.Object.prototype,e.methods.source,{value:e,writable:!0,enumerable:!1}),a.nativeMethods.defineProperty(o.Object.prototype,e.methods.location,{configurable:!0,get(){return this===o.document||this===o?e.location:this.location},set(t){this===o.document||this===o?e.location.href=t:this.location=t}}),a.nativeMethods.defineProperty(o.Object.prototype,e.methods.parent,{configurable:!0,get(){let t=this.parent;if(this===o)try{return"__uv"in t?t:this}catch{return this}return t},set(t){this.parent=t}}),a.nativeMethods.defineProperty(o.Object.prototype,e.methods.top,{configurable:!0,get(){let t=this.top;if(this===o){if(t===this.parent)return this[e.methods.parent];try{if("__uv"in t)return t;{let r=this;for(;r.parent!==t;)r=r.parent;return"__uv"in r?r:this}}catch{return this}}return t},set(t){this.top=t}}),a.nativeMethods.defineProperty(o.Object.prototype,e.methods.eval,{configurable:!0,get(){return this===o?e.eval:this.eval},set(t){this.eval=t}})}})();
//# sourceMappingURL=uv.handler.js.map

@@ -1,3 +0,44 @@

(()=>{var m=self.Ultraviolet,w=["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"],S=["GET","HEAD"],b=class extends m.EventEmitter{constructor(t=__uv$config){super(),t.bare||(t.bare="/bare/"),t.prefix||(t.prefix="/service/"),this.config=t;let i=(Array.isArray(t.bare)?t.bare:[t.bare]).map(e=>new URL(e,location).toString());this.address=i[~~(Math.random()*i.length)],this.bareClient=new m.BareClient}async fetch({request:t}){let i;try{if(!t.url.startsWith(location.origin+this.config.prefix))return await fetch(t);let e=new m(this.config,this.address);typeof this.config.construct=="function"&&this.config.construct(e,"service");let a=await e.cookie.db();e.meta.origin=location.origin,e.meta.base=e.meta.url=new URL(e.sourceUrl(t.url));let r=new g(t,this,e,S.includes(t.method.toUpperCase())?null:await t.blob());if(e.meta.url.protocol==="blob:"&&(r.blob=!0,r.base=r.url=new URL(r.url.pathname)),t.referrer&&t.referrer.startsWith(location.origin)){let n=new URL(e.sourceUrl(t.referrer));(r.headers.origin||e.meta.url.origin!==n.origin&&t.mode==="cors")&&(r.headers.origin=n.origin),r.headers.referer=n.href}let l=await e.cookie.getCookies(a)||[],c=e.cookie.serialize(l,e.meta,!1);r.headers["user-agent"]=navigator.userAgent,c&&(r.headers.cookie=c);let d=new f(r,null,null);if(this.emit("request",d),d.intercepted)return d.returnValue;i=r.blob?"blob:"+location.origin+r.url.pathname:r.url;let u=await this.bareClient.fetch(i,{headers:r.headers,method:r.method,body:r.body,credentials:r.credentials,mode:location.origin!==r.address.origin?"cors":r.mode,cache:r.cache,redirect:r.redirect}),s=new y(r,u),h=new f(s,null,null);if(this.emit("beforemod",h),h.intercepted)return h.returnValue;for(let n of w)s.headers[n]&&delete s.headers[n];if(s.headers.location&&(s.headers.location=e.rewriteUrl(s.headers.location)),t.destination==="document"){let n=s.headers["content-disposition"];if(!/\s*?((inline|attachment);\s*?)filename=/i.test(n)){let p=/^\s*?attachment/i.test(n)?"attachment":"inline",[v]=new URL(u.finalURL).pathname.split("/").slice(-1);s.headers["content-disposition"]=`${p}; filename=${JSON.stringify(v)}`}}if(s.headers["set-cookie"]&&(Promise.resolve(e.cookie.setCookies(s.headers["set-cookie"],a,e.meta)).then(()=>{self.clients.matchAll().then(function(n){n.forEach(function(p){p.postMessage({msg:"updateCookies",url:e.meta.url.href})})})}),delete s.headers["set-cookie"]),s.body)switch(t.destination){case"script":case"worker":{let n=[e.bundleScript,e.clientScript,e.configScript,e.handlerScript].map(p=>JSON.stringify(p)).join(",");s.body=`if (!self.__uv && self.importScripts) { ${e.createJsInject(this.address,this.bareClient.manifest,e.cookie.serialize(l,e.meta,!0),t.referrer)} importScripts(${n}); }
`,s.body+=e.js.rewrite(await u.text())}break;case"style":s.body=e.rewriteCSS(await u.text());break;case"iframe":case"document":x(e.meta.url,s.headers["content-type"]||"")&&(s.body=e.rewriteHtml(await u.text(),{document:!0,injectHead:e.createHtmlInject(e.handlerScript,e.bundleScript,e.clientScript,e.configScript,this.address,this.bareClient.manifest,e.cookie.serialize(l,e.meta,!0),t.referrer)}))}return r.headers.accept==="text/event-stream"&&(s.headers["content-type"]="text/event-stream"),crossOriginIsolated&&(s.headers["Cross-Origin-Embedder-Policy"]="require-corp"),this.emit("response",h),h.intercepted?h.returnValue:new Response(s.body,{headers:s.headers,status:s.status,statusText:s.statusText})}catch(e){return["document","iframe"].includes(t.destination)?(console.error(e),U(e,i,this.address)):new Response(void 0,{status:500})}}static Ultraviolet=m};self.UVServiceWorker=b;var y=class{constructor(t,i){this.request=t,this.raw=i,this.ultraviolet=t.ultraviolet,this.headers={};for(let e in i.rawHeaders)this.headers[e.toLowerCase()]=i.rawHeaders[e];this.status=i.status,this.statusText=i.statusText,this.body=i.body}get url(){return this.request.url}get base(){return this.request.base}set base(t){this.request.base=t}},g=class{constructor(t,i,e,a=null){this.ultraviolet=e,this.request=t,this.headers=Object.fromEntries(t.headers.entries()),this.method=t.method,this.address=i.address,this.body=a||null,this.cache=t.cache,this.redirect=t.redirect,this.credentials="omit",this.mode=t.mode==="cors"?t.mode:"same-origin",this.blob=!1}get url(){return this.ultraviolet.meta.url}set url(t){this.ultraviolet.meta.url=t}get base(){return this.ultraviolet.meta.base}set base(t){this.ultraviolet.meta.base=t}};function x(o,t=""){return(m.mime.contentType(t||o.pathname)||"text/html").split(";")[0]==="text/html"}var f=class{#e;#t;constructor(t={},i=null,e=null){this.#e=!1,this.#t=null,this.data=t,this.target=i,this.that=e}get intercepted(){return this.#e}get returnValue(){return this.#t}respondWith(t){this.#t=t,this.#e=!0}};function C(o,t){let i=new URL(o),e=`remoteHostname.textContent = ${JSON.stringify(i.hostname)};bareServer.href = ${JSON.stringify(t)};uvHostname.textContent = ${JSON.stringify(location.hostname)};reload.addEventListener("click", () => location.reload());uvVersion.textContent = ${JSON.stringify("3.1.1")};`;return`<!DOCTYPE html><html><head><meta charset='utf-8' /><title>Error</title><style>* { background-color: white }</style></head><body><h1>This site can\u2019t be reached</h1><hr /><p><b id="remoteHostname"></b>\u2019s server IP address could not be found.</p><p>Try:</p><ul><li>Verifying you entered the correct address</li><li>Clearing the site data</li><li>Contacting <b id="uvHostname"></b>'s administrator</li><li>Verifying the <a id='bareServer' title='Bare server'>Bare server</a> isn't censored</li></ul><button id="reload">Reload</button><hr /><p><i>Ultraviolet v<span id="uvVersion"></span></i></p><script src="${"data:application/javascript,"+encodeURIComponent(e)}"><\/script></body></html>`}function E(o,t,i,e,a,r,l){if(e==="The specified host could not be resolved.")return C(r,l);let c=`errorTitle.textContent = ${JSON.stringify(o)};errorCode.textContent = ${JSON.stringify(t)};`+(i?`errorId.textContent = ${JSON.stringify(i)};`:"")+`errorMessage.textContent = ${JSON.stringify(e)};errorTrace.value = ${JSON.stringify(a)};fetchedURL.textContent = ${JSON.stringify(r)};bareServer.href = ${JSON.stringify(l)};for (const node of document.querySelectorAll("#uvHostname")) node.textContent = ${JSON.stringify(location.hostname)};reload.addEventListener("click", () => location.reload());uvVersion.textContent = ${JSON.stringify("3.1.1")};`;return`<!DOCTYPE html><html><head><meta charset='utf-8' /><title>Error</title><style>* { background-color: white }</style></head><body><h1 id='errorTitle'></h1><hr /><p>Failed to load <b id="fetchedURL"></b></p><p id="errorMessage"></p><table><tbody><tr><td>Code:</td><td id="errorCode"></td></tr>`+(i?'<tr><td>ID:</td><td id="errorId"></td></tr>':"")+`</tbody></table><textarea id="errorTrace" cols="40" rows="10" readonly></textarea><p>Try:</p><ul><li>Checking your internet connection</li><li>Verifying you entered the correct address</li><li>Clearing the site data</li><li>Contacting <b id="uvHostname"></b>'s administrator</li><li>Verify the <a id='bareServer' title='Bare server'>Bare server</a> isn't censored</li></ul><p>If you're the administrator of <b id="uvHostname"></b>, try:</p><ul><li>Restarting your Bare server</li><li>Updating Ultraviolet</li><li>Troubleshooting the error on the <a href="https://github.com/titaniumnetwork-dev/Ultraviolet" target="_blank">GitHub repository</a></li></ul><button id="reload">Reload</button><hr /><p><i>Ultraviolet v<span id="uvVersion"></span></i></p><script src="${"data:application/javascript,"+encodeURIComponent(c)}"><\/script></body></html>`}function O(o){return o instanceof Error&&typeof o.body=="object"}function U(o,t,i){let e,a,r,l="",c,d={"content-type":"text/html"};return crossOriginIsolated&&(d["Cross-Origin-Embedder-Policy"]="require-corp"),O(o)?(e=o.status,a="Error communicating with the Bare server",c=o.body.message,r=o.body.code,l=o.body.id):(e=500,a="Error processing your request",c="Internal Server Error",r=o instanceof Error?o.name:"UNKNOWN"),new Response(E(a,r,l,c,String(o),t,i),{status:e,headers:d})}})();
(()=>{var d=self.Ultraviolet,w=["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"],x=["GET","HEAD"],p=class extends d.EventEmitter{constructor(e=__uv$config){super(),e.prefix||(e.prefix="/service/"),this.config=e,this.bareClient=new d.BareClient}route({request:e}){return!!e.url.startsWith(location.origin+this.config.prefix)}async fetch({request:e}){let o;try{if(!e.url.startsWith(location.origin+this.config.prefix))return await fetch(e);let t=new d(this.config);typeof this.config.construct=="function"&&this.config.construct(t,"service");let g=await t.cookie.db();t.meta.origin=location.origin,t.meta.base=t.meta.url=new URL(t.sourceUrl(e.url));let i=new b(e,t,x.includes(e.method.toUpperCase())?null:await e.blob());if(t.meta.url.protocol==="blob:"&&(i.blob=!0,i.base=i.url=new URL(i.url.pathname)),e.referrer&&e.referrer.startsWith(location.origin)){let s=new URL(t.sourceUrl(e.referrer));(i.headers.origin||t.meta.url.origin!==s.origin&&e.mode==="cors")&&(i.headers.origin=s.origin),i.headers.referer=s.href}let u=await t.cookie.getCookies(g)||[],y=t.cookie.serialize(u,t.meta,!1);i.headers["user-agent"]=navigator.userAgent,y&&(i.headers.cookie=y);let f=new h(i,null,null);if(this.emit("request",f),f.intercepted)return f.returnValue;o=i.blob?"blob:"+location.origin+i.url.pathname:i.url;let c=await this.bareClient.fetch(o,{headers:i.headers,method:i.method,body:i.body,credentials:i.credentials,mode:i.mode,cache:i.cache,redirect:i.redirect}),r=new m(i,c),a=new h(r,null,null);if(this.emit("beforemod",a),a.intercepted)return a.returnValue;for(let s of w)r.headers[s]&&delete r.headers[s];if(r.headers.location&&(r.headers.location=t.rewriteUrl(r.headers.location)),e.destination==="document"){let s=r.headers["content-disposition"];if(!/\s*?((inline|attachment);\s*?)filename=/i.test(s)){let l=/^\s*?attachment/i.test(s)?"attachment":"inline",[v]=new URL(c.finalURL).pathname.split("/").slice(-1);r.headers["content-disposition"]=`${l}; filename=${JSON.stringify(v)}`}}if(r.headers["set-cookie"]&&(Promise.resolve(t.cookie.setCookies(r.headers["set-cookie"],g,t.meta)).then(()=>{self.clients.matchAll().then(function(s){s.forEach(function(l){l.postMessage({msg:"updateCookies",url:t.meta.url.href})})})}),delete r.headers["set-cookie"]),r.body)switch(e.destination){case"script":case"worker":{let s=[t.bundleScript,t.clientScript,t.configScript,t.handlerScript].map(l=>JSON.stringify(l)).join(",");r.body=`if (!self.__uv && self.importScripts) { ${t.createJsInject(t.cookie.serialize(u,t.meta,!0),e.referrer)} importScripts(${s}); }
`,r.body+=t.js.rewrite(await c.text())}break;case"style":r.body=t.rewriteCSS(await c.text());break;case"iframe":case"document":k(t.meta.url,r.headers["content-type"]||"")&&(r.body=t.rewriteHtml(await c.text(),{document:!0,injectHead:t.createHtmlInject(t.handlerScript,t.bundleScript,t.clientScript,t.configScript,t.cookie.serialize(u,t.meta,!0),e.referrer)}))}return i.headers.accept==="text/event-stream"&&(r.headers["content-type"]="text/event-stream"),crossOriginIsolated&&(r.headers["Cross-Origin-Embedder-Policy"]="require-corp"),this.emit("response",a),a.intercepted?a.returnValue:new Response(r.body,{headers:r.headers,status:r.status,statusText:r.statusText})}catch(t){return["document","iframe"].includes(e.destination)?(console.error(t),U(t,o)):new Response(void 0,{status:500})}}static Ultraviolet=d};self.UVServiceWorker=p;var m=class{constructor(e,o){this.request=e,this.raw=o,this.ultraviolet=e.ultraviolet,this.headers={};for(let t in o.rawHeaders)this.headers[t.toLowerCase()]=o.rawHeaders[t];this.status=o.status,this.statusText=o.statusText,this.body=o.body}get url(){return this.request.url}get base(){return this.request.base}set base(e){this.request.base=e}},b=class{constructor(e,o,t=null){this.ultraviolet=o,this.request=e,this.headers=Object.fromEntries(e.headers.entries()),this.method=e.method,this.body=t||null,this.cache=e.cache,this.redirect=e.redirect,this.credentials="omit",this.mode=e.mode==="cors"?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}};function k(n,e=""){return(d.mime.contentType(e||n.pathname)||"text/html").split(";")[0]==="text/html"}var h=class{#e;#t;constructor(e={},o=null,t=null){this.#e=!1,this.#t=null,this.data=e,this.target=o,this.that=t}get intercepted(){return this.#e}get returnValue(){return this.#t}respondWith(e){this.#t=e,this.#e=!0}};function S(n,e){let o=`
errorTrace.value = ${JSON.stringify(n)};
fetchedURL.textContent = ${JSON.stringify(e)};
for (const node of document.querySelectorAll("#uvHostname")) node.textContent = ${JSON.stringify(location.hostname)};
reload.addEventListener("click", () => location.reload());
uvVersion.textContent = ${JSON.stringify("3.1.2")};
`;return`<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>Error</title>
<style>
* { background-color: white }
</style>
</head>
<body>
<h1 id='errorTitle'>Error processing your request</h1>
<hr />
<p>Failed to load <b id="fetchedURL"></b></p>
<p id="errorMessage">Internal Server Error</p>
<textarea id="errorTrace" cols="40" rows="10" readonly></textarea>
<p>Try:</p>
<ul>
<li>Checking your internet connection</li>
<li>Verifying you entered the correct address</li>
<li>Clearing the site data</li>
<li>Contacting <b id="uvHostname"></b>'s administrator</li>
<li>Verify the server isn't censored</li>
</ul>
<p>If you're the administrator of <b id="uvHostname"></b>, try:</p>
<ul>
<li>Restarting your server</li>
<li>Updating Ultraviolet</li>
<li>Troubleshooting the error on the <a href="https://github.com/titaniumnetwork-dev/Ultraviolet" target="_blank">GitHub repository</a></li>
</ul>
<button id="reload">Reload</button>
<hr />
<p><i>Ultraviolet v<span id="uvVersion"></span></i></p>
<script src="${"data:application/javascript,"+encodeURIComponent(o)}"><\/script>
</body>
</html>
`}function U(n,e){let o={"content-type":"text/html"};return crossOriginIsolated&&(o["Cross-Origin-Embedder-Policy"]="require-corp"),new Response(S(String(n),e),{status:500,headers:o})}})();
//# sourceMappingURL=uv.sw.js.map
{
"name": "@titaniumnetwork-dev/ultraviolet",
"version": "3.1.1",
"version": "3.1.2",
"description": "Highly sophisticated proxy used for evading internet censorship or accessing websites in a controlled sandbox using the power of service-workers and more!",

@@ -9,3 +9,3 @@ "main": "lib/index.cjs",

"type": "git",
"url": "https://github.com/titaniumnetwork-dev/Ultraviolet.git"
"url": "git+https://github.com/titaniumnetwork-dev/Ultraviolet.git"
},

@@ -12,0 +12,0 @@ "files": [

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc