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

electron-extensions

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electron-extensions - npm Package Compare versions

Comparing version 5.0.2 to 5.1.0

popup-preload.js

4

api/index.d.ts

@@ -37,2 +37,5 @@ /// <reference types="chrome" />

};
onChanged: {
addListener: () => void;
};
};

@@ -113,3 +116,4 @@ tabs: {

isIncognitoContext: boolean;
getURL: (path: string) => string;
};
};

@@ -20,2 +20,5 @@ export declare const getStorage: (extensionId: string, sessionId: number) => {

};
onChanged: {
addListener: () => void;
};
};

2

background-preload.js

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

!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=20)}([function(e,t){e.exports=require("electron")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.makeId=(e,t="abcdefghijklmnopqrstuvwxyz")=>{let n="";for(let o=0;o<e;o++)n+=t.charAt(Math.floor(Math.random()*t.length));return n},t.replaceAll=(e,t,n,o="gi")=>(t=t.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),e.replace(new RegExp(t,o),n)),t.hashCode=e=>{let t=0;if(0===e.length)return t;for(let n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0);t.IpcEvent=class{constructor(e,t){this.callbacks=[],this.listener=!1,this.emit=(e,...t)=>{this.callbacks.forEach(e=>{e(...t)})},this.name=t,this.scope=e,this.emit=this.emit.bind(this)}addListener(e){this.callbacks.push(e),this.listener||(o.ipcRenderer.on(`api-emit-event-${this.scope}-${this.name}`,this.emit),this.listener=!0)}removeListener(e){this.callbacks=this.callbacks.filter(t=>t!==e),0===this.callbacks.length&&(o.ipcRenderer.removeListener(`api-emit-event-${this.scope}-${this.name}`,this.emit),this.listener=!1)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0);t.getSenderTab=()=>o.ipcRenderer.sendSync("current-webcontents-to-tab"),t.getSenderContent=e=>({id:e,url:window.location.href,frameId:0,tab:t.getSenderTab()}),t.getSender=e=>({id:e})},function(e,t){e.exports=require("url")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),r=n(6),s=n(3);t.Port=class{constructor(e,t,n=null,s=null){this.sessionId=e,this.onMessage=new r.LocalEvent,this.onDisconnect=new r.LocalEvent,s&&(this.sender=s),n&&(this.name=n),this.portId=t,o.ipcRenderer.on(`api-port-postMessage-${t}`,(e,t,n)=>{n&&this.sender&&(this.sender.tab=n),this.onMessage.emit(t,this)})}disconnect(){o.ipcRenderer.removeAllListeners(`api-port-postMessage-${this.portId}`)}postMessage(e){const{isBackground:t}=global;o.ipcRenderer.send(`api-port-postMessage-${this.sessionId}`,{portId:this.portId,msg:e,tab:t?null:s.getSenderTab()})}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.LocalEvent=class{constructor(){this.callbacks=[]}emit(...e){this.callbacks.forEach(t=>{t(...e)})}addListener(e){this.callbacks.push(e)}removeListener(e){this.callbacks=this.callbacks.filter(t=>t!==e)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),r=n(5),s=n(2),i=n(8),a=n(9),c=n(10),d=n(11),l=n(12),p=n(13),u=n(15),g=process.argv.find(e=>e.startsWith("--window-id="));let f=null;g&&(f=parseInt(g.split("--window-id=")[1],10)),t.getAPI=(e,t)=>{const n={runtime:c.getRuntime(e,t),storage:i.getStorage(e.id,t),tabs:a.getTabs(e,t,f),i18n:d.getI18n(e),browserAction:l.getBrowserAction(e,t),webRequest:p.getWebRequest(),webNavigation:u.getWebNavigation(),alarms:{onAlarm:new s.IpcEvent("alarms","onAlarm"),create:(e,t)=>{},get:(e,t)=>{},getAll:e=>{},clear:(e,t)=>{},clearAll:e=>{}},extension:{isIncognitoContext:!1}};return o.ipcRenderer.on("api-runtime-connect",(e,o)=>{const{portId:s,sender:i,name:a}=o,c=new r.Port(t,s,a,i);n.runtime.onConnect.emit(c)}),o.ipcRenderer.on("api-runtime-sendMessage",(e,t,r)=>{const{portId:s,sender:i,message:a}=t;n.runtime.onMessage.emit(a,i,e=>{o.ipcRenderer.send("send-msg-webcontents",r,`api-runtime-sendMessage-response-${s}`,e)})}),o.ipcRenderer.on("api-tabs-sendMessage",(e,t,r)=>{const{portId:s,sender:i,message:a}=t;n.runtime.onMessage.emit(a,i,e=>{o.ipcRenderer.send("send-msg-webcontents",r,`api-tabs-sendMessage-response-${s}`,e)})}),n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),r=n(1),s=(e,t,n,s,i,a)=>{const c=r.makeId(32);o.ipcRenderer.send(`api-storage-operation-${a}`,{extensionId:e,id:c,arg:t,type:s,area:n}),i&&o.ipcRenderer.once(`api-storage-operation-${c}`,(e,...t)=>{i(t[0])})},i=(e,t,n)=>({set:(o,r)=>s(e,o,t,"set",r,n),get:(o,r)=>s(e,o,t,"get",r,n),remove:(o,r)=>s(e,o,t,"remove",r,n),clear:(o,r)=>s(e,o,t,"clear",r,n)});t.getStorage=(e,t)=>({local:i(e,"local",t),managed:i(e,"managed",t),sync:i(e,"sync",t)})},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,s){function i(e){try{c(o.next(e))}catch(e){s(e)}}function a(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(0),s=n(2),i=n(1),a=n(3);t.getTabs=(e,t,n=null)=>{const c={onCreated:new s.IpcEvent("tabs","onCreated"),onUpdated:new s.IpcEvent("tabs","onUpdated"),onActivated:new s.IpcEvent("tabs","onActivated"),onRemoved:new s.IpcEvent("tabs","onRemoved"),get:(e,t)=>{c.query({},n=>{t(n.find(t=>t.id===e))})},getCurrent:e=>{c.get(r.ipcRenderer.sendSync("get-webcontents-id"),t=>{e(t)})},query:(e,n)=>{r.ipcRenderer.send(`api-tabs-query-${t}`),r.ipcRenderer.once("api-tabs-query",(t,o)=>{const r=(e,t)=>e[t];n(o.filter(t=>{for(const n in e){const o=r(t,n),s=r(e,n);if("url"===n&&"<all_urls>"===s)return!0;if(null==o||s!==o)return!1}return!0}))})},create:(e,o=null)=>{const s=i.makeId(32);r.ipcRenderer.send(`api-tabs-create-${t}`,s,e,n),o&&r.ipcRenderer.once(`api-tabs-create-${s}`,(e,t)=>{o(t)})},insertCSS:(...n)=>{const s=(n,s,i)=>o(void 0,void 0,void 0,(function*(){yield r.ipcRenderer.invoke(`api-tabs-insertCSS-${t}`,n,s,e.path),i&&i()}));"object"==typeof n[0]?c.getCurrent(e=>{s(e.id,n[0],n[1])}):"number"==typeof n[0]&&s(n[0],n[1],n[2])},executeScript:(...n)=>{const s=(n,s,i)=>o(void 0,void 0,void 0,(function*(){const o=yield r.ipcRenderer.invoke(`api-tabs-executeScript-${t}`,{tabId:n,details:s,basePath:e.path});i&&i(o)}));"object"==typeof n[0]?c.getCurrent(e=>{e&&s(e.id,n[0],n[1])}):"number"==typeof n[0]&&s(n[0],n[1],n[2])},setZoom:(e,n,o)=>{r.ipcRenderer.send(`api-tabs-setZoom-${t}`,e,n),r.ipcRenderer.once("api-tabs-setZoom",()=>{o&&o()})},getZoom:(e,n)=>{r.ipcRenderer.send(`api-tabs-getZoom-${t}`,e),r.ipcRenderer.once("api-tabs-getZoom",(e,t)=>{n&&n(t)})},detectLanguage:(e,n)=>{r.ipcRenderer.send(`api-tabs-detectLanguage-${t}`,e),r.ipcRenderer.once("api-tabs-detectLanguage",(e,t)=>{n&&n(t)})},sendMessage:(...n)=>{const o=a.getSender(e.id),s=i.makeId(32),c=n[0],d=n[1],l=n[2];let p=n[3];"function"==typeof n[2]&&(p=n[2]),"function"==typeof n[3]&&(p=n[3]),l&&l.includeTlsChannelId&&(o.tlsChannelId=s),"function"==typeof p&&r.ipcRenderer.on(`api-tabs-sendMessage-response-${s}`,(e,t)=>{p(t)}),r.ipcRenderer.send(`api-tabs-sendMessage-${t}`,{tabId:c,portId:s,sender:o,message:d})},update:()=>{}};return c}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),r=n(4),s=n(6),i=n(1),a=n(5),c=n(3);t.getRuntime=(e,t)=>({lastError:null,id:e.id,onConnect:new s.LocalEvent,onMessage:new s.LocalEvent,onInstalled:new s.LocalEvent,sendMessage:(...n)=>{const r=c.getSenderContent(e.id),s=i.makeId(32);let a=e.id,d=n[0],l=n[1],p=n[2];"string"==typeof n[0]&&"object"==typeof n[2]&&"function"==typeof n[3]?(a=n[0],d=n[1],l=n[2],p=n[3]):"string"==typeof n[0]&&"object"==typeof n[2]?(a=n[0],d=n[1],l=n[2],p=void 0):2===n.length&&"string"==typeof n[0]&&"function"!=typeof n[1]?(a=n[0],d=n[1],l=void 0,p=void 0):1===n.length?(l=void 0,p=void 0):2===n.length&&"function"==typeof n[1]&&(p=n[1],l=void 0),l&&l.includeTlsChannelId&&(r.tlsChannelId=s),"function"==typeof p&&o.ipcRenderer.on(`api-runtime-sendMessage-response-${s}`,(e,t)=>{p(t)}),o.ipcRenderer.send(`api-runtime-sendMessage-${t}`,{extensionId:a,portId:s,sender:r,message:d})},connect:(...n)=>{const r=c.getSenderContent(e.id),s=i.makeId(32);let d=null,l=e.id;return"string"==typeof n[0]?(l=n[0],n[1]&&"object"==typeof n[1]&&(n[1].includeTlsChannelId&&(r.tlsChannelId=s),d=n[1].name)):n[0]&&"object"==typeof n[0]&&(n[0].includeTlsChannelId&&(r.tlsChannelId=s),d=n[0].name),o.ipcRenderer.send(`api-runtime-connect-${t}`,{extensionId:l,portId:s,sender:r,name:d}),new a.Port(t,s,d)},reload:()=>{o.ipcRenderer.send(`api-runtime-reload-${t}`,e.id)},getURL:t=>r.format({protocol:"electron-extension",slashes:!0,hostname:e.id,pathname:t}),getManifest:()=>e.manifest})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(1);t.getI18n=e=>({getAcceptLanguages:e=>{e&&e(navigator.languages)},getMessage:(t,n)=>{if("@@ui_locale"===t)return"en_US";const{locale:r}=e,s=n instanceof Array,i=r[t];if(null==i)return"";if(s&&n.length>=9)return null;let a=i.message;if("object"==typeof i.placeholders)for(const e in i.placeholders)a=o.replaceAll(a,`$${e}$`,i.placeholders[e].content);if(s)for(let e=0;e<9;e++)a=o.replaceAll(a,`$${e+1}`,n[e]||" ");return a},getUILanguage:()=>navigator.language,detectLanguage:(e,t)=>{t&&t({isReliable:!1,languages:[]})}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),r=n(2),s=n(1);t.getBrowserAction=(e,t)=>({onClicked:new r.IpcEvent("browserAction","onClicked"),setIcon:(e,t)=>{t&&t()},setBadgeBackgroundColor:(e,t)=>{t&&t()},setBadgeText:(n,r)=>{const i=s.makeId(32);o.ipcRenderer.send(`api-browserAction-setBadgeText-${t}`,i,e.id,n),r&&o.ipcRenderer.once(`api-browserAction-setBadgeText-${i}`,()=>{r()})}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(14);t.getWebRequest=()=>({ResourceType:{CSP_REPORT:"csp_report",FONT:"font",IMAGE:"image",MAIN_FRAME:"main_frame",MEDIA:"media",OBJECT:"object",OTHER:"other",PING:"ping",SCRIPT:"script",STYLESHEET:"stylesheet",SUB_FRAME:"sub_frame",WEBSOCKET:"websocket",XMLHTTPREQUEST:"xmlhttprequest"},onBeforeRequest:new o.WebRequestEvent("onBeforeRequest"),onBeforeSendHeaders:new o.WebRequestEvent("onBeforeSendHeaders"),onHeadersReceived:new o.WebRequestEvent("onHeadersReceived"),onSendHeaders:new o.WebRequestEvent("onSendHeaders"),onResponseStarted:new o.WebRequestEvent("onResponseStarted"),onBeforeRedirect:new o.WebRequestEvent("onBeforeRedirect"),onCompleted:new o.WebRequestEvent("onCompleted"),onErrorOccurred:new o.WebRequestEvent("onErrorOccurred")})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),r=n(1);t.WebRequestEvent=class{constructor(e){this.listeners=[],this.name=e}addListener(e,t=null){const n=r.hashCode(e.toString());this.listeners.push(n),o.ipcRenderer.on(`api-webRequest-intercepted-${this.name}-${n}`,(t,r,s)=>{const i=e(r);o.ipcRenderer.send(`api-webRequest-response-${this.name}-${n}-${s}`,i)}),o.ipcRenderer.send("api-add-webRequest-listener",{id:n,name:this.name,filters:t})}removeListener(e){const t=r.hashCode(e.toString());this.listeners=this.listeners.filter(e=>e!==t),o.ipcRenderer.removeAllListeners(`api-webRequest-intercepted-${this.name}-${t}`),o.ipcRenderer.send("api-remove-webRequest-listener",{id:t,name:this.name})}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(2);t.getWebNavigation=()=>({onBeforeNavigate:new o.IpcEvent("webNavigation","onBeforeNavigate"),onCommitted:new o.IpcEvent("webNavigation","onCommitted"),onDOMContentLoaded:new o.IpcEvent("webNavigation","onDOMContentLoaded"),onCompleted:new o.IpcEvent("webNavigation","onCompleted"),onCreatedNavigationTarget:new o.IpcEvent("webNavigation","onCreatedNavigationTarget"),onReferenceFragmentUpdated:new o.IpcEvent("webNavigation","onReferenceFragmentUpdated"),onTabReplaced:new o.IpcEvent("webNavigation","onTabReplaced"),onHistoryStateUpdated:new o.IpcEvent("webNavigation","onHistoryStateUpdated")})},,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),r=n(4),s=n(7);global.isBackground=!0,Object.defineProperty(window.navigator,"userAgent",{value:window.navigator.userAgent.replace(/Electron\/\S*\s/,""),configurable:!1,writable:!1}),o.ipcRenderer.setMaxListeners(0);const i=r.parse(window.location.href).hostname,a=o.ipcRenderer.sendSync("get-session-id"),c=o.ipcRenderer.sendSync(`get-extension-${a}`,i);process.once("loaded",()=>{const e=s.getAPI(c,a);window.chrome=e,window.browser=e,process.once("loaded",()=>{delete global.require,delete global.module,delete global.Buffer,delete global.setImmediate,delete global.clearImmediate,delete global.global})})}]);
!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=20)}([function(e,t){e.exports=require("electron")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.makeId=(e,t="abcdefghijklmnopqrstuvwxyz")=>{let n="";for(let o=0;o<e;o++)n+=t.charAt(Math.floor(Math.random()*t.length));return n},t.replaceAll=(e,t,n,o="gi")=>(t=t.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),e.replace(new RegExp(t,o),n)),t.hashCode=e=>{let t=0;if(0===e.length)return t;for(let n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0);t.IpcEvent=class{constructor(e,t){this.callbacks=[],this.listener=!1,this.emit=(e,...t)=>{this.callbacks.forEach(e=>{e(...t)})},this.name=t,this.scope=e,this.emit=this.emit.bind(this)}addListener(e){this.callbacks.push(e),this.listener||(o.ipcRenderer.on(`api-emit-event-${this.scope}-${this.name}`,this.emit),this.listener=!0)}removeListener(e){this.callbacks=this.callbacks.filter(t=>t!==e),0===this.callbacks.length&&(o.ipcRenderer.removeListener(`api-emit-event-${this.scope}-${this.name}`,this.emit),this.listener=!1)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0);t.getSenderTab=()=>o.ipcRenderer.sendSync("current-webcontents-to-tab"),t.getSenderContent=e=>({id:e,url:window.location.href,frameId:0,tab:t.getSenderTab()}),t.getSender=e=>({id:e})},function(e,t){e.exports=require("url")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),r=n(6),s=n(3);t.Port=class{constructor(e,t,n=null,s=null){this.sessionId=e,this.onMessage=new r.LocalEvent,this.onDisconnect=new r.LocalEvent,s&&(this.sender=s),n&&(this.name=n),this.portId=t,o.ipcRenderer.on(`api-port-postMessage-${t}`,(e,t,n)=>{n&&this.sender&&(this.sender.tab=n),this.onMessage.emit(t,this)})}disconnect(){o.ipcRenderer.removeAllListeners(`api-port-postMessage-${this.portId}`)}postMessage(e){const{isTab:t}=global;o.ipcRenderer.send(`api-port-postMessage-${this.sessionId}`,{portId:this.portId,msg:e,tab:t?null:s.getSenderTab()})}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.LocalEvent=class{constructor(){this.callbacks=[]}emit(...e){this.callbacks.forEach(t=>{t(...e)})}addListener(e){this.callbacks.push(e)}removeListener(e){this.callbacks=this.callbacks.filter(t=>t!==e)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),r=n(5),s=n(2),i=n(8),a=n(9),c=n(10),d=n(11),l=n(12),p=n(13),u=n(15),g=process.argv.find(e=>e.startsWith("--window-id="));let b=null;g&&(b=parseInt(g.split("--window-id=")[1],10)),t.getAPI=(e,t)=>{const n={runtime:c.getRuntime(e,t),storage:i.getStorage(e.id,t),tabs:a.getTabs(e,t,b),i18n:d.getI18n(e),browserAction:l.getBrowserAction(e,t),webRequest:p.getWebRequest(),webNavigation:u.getWebNavigation(),alarms:{onAlarm:new s.IpcEvent("alarms","onAlarm"),create:(e,t)=>{},get:(e,t)=>{},getAll:e=>{},clear:(e,t)=>{},clearAll:e=>{}},extension:{isIncognitoContext:!1,getURL:c.getRuntime(e,t).getURL}};return o.ipcRenderer.on("api-runtime-connect",(e,o)=>{const{portId:s,sender:i,name:a}=o,c=new r.Port(t,s,a,i);n.runtime.onConnect.emit(c)}),o.ipcRenderer.on("api-runtime-sendMessage",(e,t,r)=>{const{portId:s,sender:i,message:a}=t;n.runtime.onMessage.emit(a,i,e=>{o.ipcRenderer.send("send-msg-webcontents",r,`api-runtime-sendMessage-response-${s}`,e)})}),o.ipcRenderer.on("api-tabs-sendMessage",(e,t,r)=>{const{portId:s,sender:i,message:a}=t;n.runtime.onMessage.emit(a,i,e=>{o.ipcRenderer.send("send-msg-webcontents",r,`api-tabs-sendMessage-response-${s}`,e)})}),n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),r=n(1),s=(e,t,n,s,i,a)=>{const c=r.makeId(32);o.ipcRenderer.send(`api-storage-operation-${a}`,{extensionId:e,id:c,arg:t,type:s,area:n}),i&&o.ipcRenderer.once(`api-storage-operation-${c}`,(e,...t)=>{i(t[0])})},i=(e,t,n)=>({set:(o,r)=>s(e,o,t,"set",r,n),get:(o,r)=>s(e,o,t,"get",r,n),remove:(o,r)=>s(e,o,t,"remove",r,n),clear:(o,r)=>s(e,o,t,"clear",r,n)});t.getStorage=(e,t)=>({local:i(e,"local",t),managed:i(e,"managed",t),sync:i(e,"sync",t),onChanged:{addListener:()=>{}}})},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,s){function i(e){try{c(o.next(e))}catch(e){s(e)}}function a(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(0),s=n(2),i=n(1),a=n(3);t.getTabs=(e,t,n=null)=>{const c={onCreated:new s.IpcEvent("tabs","onCreated"),onUpdated:new s.IpcEvent("tabs","onUpdated"),onActivated:new s.IpcEvent("tabs","onActivated"),onRemoved:new s.IpcEvent("tabs","onRemoved"),get:(e,t)=>{c.query({},n=>{t(n.find(t=>t.id===e))})},getCurrent:e=>{c.get(r.ipcRenderer.sendSync("get-webcontents-id"),t=>{e(t)})},query:(e,n)=>{r.ipcRenderer.send(`api-tabs-query-${t}`),r.ipcRenderer.once("api-tabs-query",(t,o)=>{const r=(e,t)=>e[t];n(o.filter(t=>{for(const n in e){const o=r(t,n),s=r(e,n);if("url"===n&&"<all_urls>"===s)return!0;if(null==o||s!==o)return!1}return!0}))})},create:(e,o=null)=>{const s=i.makeId(32);r.ipcRenderer.send(`api-tabs-create-${t}`,s,e,n),o&&r.ipcRenderer.once(`api-tabs-create-${s}`,(e,t)=>{o(t)})},insertCSS:(...n)=>{const s=(n,s,i)=>o(void 0,void 0,void 0,(function*(){yield r.ipcRenderer.invoke(`api-tabs-insertCSS-${t}`,n,s,e.path),i&&i()}));"object"==typeof n[0]?c.getCurrent(e=>{s(e.id,n[0],n[1])}):"number"==typeof n[0]&&s(n[0],n[1],n[2])},executeScript:(...n)=>{const s=(n,s,i)=>o(void 0,void 0,void 0,(function*(){const o=yield r.ipcRenderer.invoke(`api-tabs-executeScript-${t}`,{tabId:n,details:s,basePath:e.path});i&&i(o)}));"object"==typeof n[0]?c.getCurrent(e=>{e&&s(e.id,n[0],n[1])}):"number"==typeof n[0]&&s(n[0],n[1],n[2])},setZoom:(e,n,o)=>{r.ipcRenderer.send(`api-tabs-setZoom-${t}`,e,n),r.ipcRenderer.once("api-tabs-setZoom",()=>{o&&o()})},getZoom:(e,n)=>{r.ipcRenderer.send(`api-tabs-getZoom-${t}`,e),r.ipcRenderer.once("api-tabs-getZoom",(e,t)=>{n&&n(t)})},detectLanguage:(e,n)=>{r.ipcRenderer.send(`api-tabs-detectLanguage-${t}`,e),r.ipcRenderer.once("api-tabs-detectLanguage",(e,t)=>{n&&n(t)})},sendMessage:(...n)=>{const o=a.getSender(e.id),s=i.makeId(32),c=n[0],d=n[1],l=n[2];let p=n[3];"function"==typeof n[2]&&(p=n[2]),"function"==typeof n[3]&&(p=n[3]),l&&l.includeTlsChannelId&&(o.tlsChannelId=s),"function"==typeof p&&r.ipcRenderer.on(`api-tabs-sendMessage-response-${s}`,(e,t)=>{p(t)}),r.ipcRenderer.send(`api-tabs-sendMessage-${t}`,{tabId:c,portId:s,sender:o,message:d})},update:()=>{}};return c}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),r=n(4),s=n(6),i=n(1),a=n(5),c=n(3);t.getRuntime=(e,t)=>({lastError:null,id:e.id,onConnect:new s.LocalEvent,onMessage:new s.LocalEvent,onInstalled:new s.LocalEvent,sendMessage:(...n)=>{const r=c.getSenderContent(e.id),s=i.makeId(32);let a=e.id,d=n[0],l=n[1],p=n[2];"string"==typeof n[0]&&"object"==typeof n[2]&&"function"==typeof n[3]?(a=n[0],d=n[1],l=n[2],p=n[3]):"string"==typeof n[0]&&"object"==typeof n[2]?(a=n[0],d=n[1],l=n[2],p=void 0):2===n.length&&"string"==typeof n[0]&&"function"!=typeof n[1]?(a=n[0],d=n[1],l=void 0,p=void 0):1===n.length?(l=void 0,p=void 0):2===n.length&&"function"==typeof n[1]&&(p=n[1],l=void 0),l&&l.includeTlsChannelId&&(r.tlsChannelId=s),"function"==typeof p&&o.ipcRenderer.on(`api-runtime-sendMessage-response-${s}`,(e,t)=>{p(t)}),o.ipcRenderer.send(`api-runtime-sendMessage-${t}`,{extensionId:a,portId:s,sender:r,message:d})},connect:(...n)=>{const r=c.getSenderContent(e.id),s=i.makeId(32);let d=null,l=e.id;return"string"==typeof n[0]?(l=n[0],n[1]&&"object"==typeof n[1]&&(n[1].includeTlsChannelId&&(r.tlsChannelId=s),d=n[1].name)):n[0]&&"object"==typeof n[0]&&(n[0].includeTlsChannelId&&(r.tlsChannelId=s),d=n[0].name),o.ipcRenderer.send(`api-runtime-connect-${t}`,{extensionId:l,portId:s,sender:r,name:d}),new a.Port(t,s,d)},reload:()=>{o.ipcRenderer.send(`api-runtime-reload-${t}`,e.id)},getURL:t=>r.format({protocol:"electron-extension",slashes:!0,hostname:e.id,pathname:t}),getManifest:()=>e.manifest})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(1);t.getI18n=e=>({getAcceptLanguages:e=>{e&&e(navigator.languages)},getMessage:(t,n)=>{if("@@ui_locale"===t)return"en_US";const{locale:r}=e,s=n instanceof Array,i=r[t];if(null==i)return"";if(s&&n.length>=9)return null;let a=i.message;if("object"==typeof i.placeholders)for(const e in i.placeholders)a=o.replaceAll(a,`$${e}$`,i.placeholders[e].content);if(s)for(let e=0;e<9;e++)a=o.replaceAll(a,`$${e+1}`,n[e]||" ");return a},getUILanguage:()=>navigator.language,detectLanguage:(e,t)=>{t&&t({isReliable:!1,languages:[]})}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),r=n(2),s=n(1);t.getBrowserAction=(e,t)=>({onClicked:new r.IpcEvent("browserAction","onClicked"),setIcon:(e,t)=>{t&&t()},setBadgeBackgroundColor:(e,t)=>{t&&t()},setBadgeText:(n,r)=>{const i=s.makeId(32);o.ipcRenderer.send(`api-browserAction-setBadgeText-${t}`,i,e.id,n),r&&o.ipcRenderer.once(`api-browserAction-setBadgeText-${i}`,()=>{r()})}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(14);t.getWebRequest=()=>({ResourceType:{CSP_REPORT:"csp_report",FONT:"font",IMAGE:"image",MAIN_FRAME:"main_frame",MEDIA:"media",OBJECT:"object",OTHER:"other",PING:"ping",SCRIPT:"script",STYLESHEET:"stylesheet",SUB_FRAME:"sub_frame",WEBSOCKET:"websocket",XMLHTTPREQUEST:"xmlhttprequest"},onBeforeRequest:new o.WebRequestEvent("onBeforeRequest"),onBeforeSendHeaders:new o.WebRequestEvent("onBeforeSendHeaders"),onHeadersReceived:new o.WebRequestEvent("onHeadersReceived"),onSendHeaders:new o.WebRequestEvent("onSendHeaders"),onResponseStarted:new o.WebRequestEvent("onResponseStarted"),onBeforeRedirect:new o.WebRequestEvent("onBeforeRedirect"),onCompleted:new o.WebRequestEvent("onCompleted"),onErrorOccurred:new o.WebRequestEvent("onErrorOccurred")})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),r=n(1);t.WebRequestEvent=class{constructor(e){this.listeners=[],this.name=e}addListener(e,t=null){const n=r.hashCode(e.toString());this.listeners.push(n),o.ipcRenderer.on(`api-webRequest-intercepted-${this.name}-${n}`,(t,r,s)=>{const i=e(r);o.ipcRenderer.send(`api-webRequest-response-${this.name}-${n}-${s}`,i)}),o.ipcRenderer.send("api-add-webRequest-listener",{id:n,name:this.name,filters:t})}removeListener(e){const t=r.hashCode(e.toString());this.listeners=this.listeners.filter(e=>e!==t),o.ipcRenderer.removeAllListeners(`api-webRequest-intercepted-${this.name}-${t}`),o.ipcRenderer.send("api-remove-webRequest-listener",{id:t,name:this.name})}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(2);t.getWebNavigation=()=>({onBeforeNavigate:new o.IpcEvent("webNavigation","onBeforeNavigate"),onCommitted:new o.IpcEvent("webNavigation","onCommitted"),onDOMContentLoaded:new o.IpcEvent("webNavigation","onDOMContentLoaded"),onCompleted:new o.IpcEvent("webNavigation","onCompleted"),onCreatedNavigationTarget:new o.IpcEvent("webNavigation","onCreatedNavigationTarget"),onReferenceFragmentUpdated:new o.IpcEvent("webNavigation","onReferenceFragmentUpdated"),onTabReplaced:new o.IpcEvent("webNavigation","onTabReplaced"),onHistoryStateUpdated:new o.IpcEvent("webNavigation","onHistoryStateUpdated")})},,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),r=n(4),s=n(7);global.isTab=!1,Object.defineProperty(window.navigator,"userAgent",{value:window.navigator.userAgent.replace(/Electron\/\S*\s/,""),configurable:!1,writable:!1}),o.ipcRenderer.setMaxListeners(0);const i=r.parse(window.location.href).hostname,a=o.ipcRenderer.sendSync("get-session-id"),c=o.ipcRenderer.sendSync(`get-extension-${a}`,i);process.once("loaded",()=>{const e=s.getAPI(c,a);window.chrome=window.browser=e,window.webext=e,process.once("loaded",()=>{delete global.require,delete global.module,delete global.Buffer,delete global.setImmediate,delete global.clearImmediate,delete global.global})})}]);
//# sourceMappingURL=background-preload.js.map

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

!function(e){var t={};function n(o){if(t[o])return t[o].exports;var s=t[o]={i:o,l:!1,exports:{}};return e[o].call(s.exports,s,s.exports,n),s.l=!0,s.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)n.d(o,s,function(t){return e[t]}.bind(null,s));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=16)}([function(e,t){e.exports=require("electron")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.makeId=(e,t="abcdefghijklmnopqrstuvwxyz")=>{let n="";for(let o=0;o<e;o++)n+=t.charAt(Math.floor(Math.random()*t.length));return n},t.replaceAll=(e,t,n,o="gi")=>(t=t.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),e.replace(new RegExp(t,o),n)),t.hashCode=e=>{let t=0;if(0===e.length)return t;for(let n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0);t.IpcEvent=class{constructor(e,t){this.callbacks=[],this.listener=!1,this.emit=(e,...t)=>{this.callbacks.forEach(e=>{e(...t)})},this.name=t,this.scope=e,this.emit=this.emit.bind(this)}addListener(e){this.callbacks.push(e),this.listener||(o.ipcRenderer.on(`api-emit-event-${this.scope}-${this.name}`,this.emit),this.listener=!0)}removeListener(e){this.callbacks=this.callbacks.filter(t=>t!==e),0===this.callbacks.length&&(o.ipcRenderer.removeListener(`api-emit-event-${this.scope}-${this.name}`,this.emit),this.listener=!1)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0);t.getSenderTab=()=>o.ipcRenderer.sendSync("current-webcontents-to-tab"),t.getSenderContent=e=>({id:e,url:window.location.href,frameId:0,tab:t.getSenderTab()}),t.getSender=e=>({id:e})},function(e,t){e.exports=require("url")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),s=n(6),r=n(3);t.Port=class{constructor(e,t,n=null,r=null){this.sessionId=e,this.onMessage=new s.LocalEvent,this.onDisconnect=new s.LocalEvent,r&&(this.sender=r),n&&(this.name=n),this.portId=t,o.ipcRenderer.on(`api-port-postMessage-${t}`,(e,t,n)=>{n&&this.sender&&(this.sender.tab=n),this.onMessage.emit(t,this)})}disconnect(){o.ipcRenderer.removeAllListeners(`api-port-postMessage-${this.portId}`)}postMessage(e){const{isBackground:t}=global;o.ipcRenderer.send(`api-port-postMessage-${this.sessionId}`,{portId:this.portId,msg:e,tab:t?null:r.getSenderTab()})}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.LocalEvent=class{constructor(){this.callbacks=[]}emit(...e){this.callbacks.forEach(t=>{t(...e)})}addListener(e){this.callbacks.push(e)}removeListener(e){this.callbacks=this.callbacks.filter(t=>t!==e)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),s=n(5),r=n(2),i=n(8),a=n(9),c=n(10),d=n(11),l=n(12),u=n(13),p=n(15),f=process.argv.find(e=>e.startsWith("--window-id="));let g=null;f&&(g=parseInt(f.split("--window-id=")[1],10)),t.getAPI=(e,t)=>{const n={runtime:c.getRuntime(e,t),storage:i.getStorage(e.id,t),tabs:a.getTabs(e,t,g),i18n:d.getI18n(e),browserAction:l.getBrowserAction(e,t),webRequest:u.getWebRequest(),webNavigation:p.getWebNavigation(),alarms:{onAlarm:new r.IpcEvent("alarms","onAlarm"),create:(e,t)=>{},get:(e,t)=>{},getAll:e=>{},clear:(e,t)=>{},clearAll:e=>{}},extension:{isIncognitoContext:!1}};return o.ipcRenderer.on("api-runtime-connect",(e,o)=>{const{portId:r,sender:i,name:a}=o,c=new s.Port(t,r,a,i);n.runtime.onConnect.emit(c)}),o.ipcRenderer.on("api-runtime-sendMessage",(e,t,s)=>{const{portId:r,sender:i,message:a}=t;n.runtime.onMessage.emit(a,i,e=>{o.ipcRenderer.send("send-msg-webcontents",s,`api-runtime-sendMessage-response-${r}`,e)})}),o.ipcRenderer.on("api-tabs-sendMessage",(e,t,s)=>{const{portId:r,sender:i,message:a}=t;n.runtime.onMessage.emit(a,i,e=>{o.ipcRenderer.send("send-msg-webcontents",s,`api-tabs-sendMessage-response-${r}`,e)})}),n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),s=n(1),r=(e,t,n,r,i,a)=>{const c=s.makeId(32);o.ipcRenderer.send(`api-storage-operation-${a}`,{extensionId:e,id:c,arg:t,type:r,area:n}),i&&o.ipcRenderer.once(`api-storage-operation-${c}`,(e,...t)=>{i(t[0])})},i=(e,t,n)=>({set:(o,s)=>r(e,o,t,"set",s,n),get:(o,s)=>r(e,o,t,"get",s,n),remove:(o,s)=>r(e,o,t,"remove",s,n),clear:(o,s)=>r(e,o,t,"clear",s,n)});t.getStorage=(e,t)=>({local:i(e,"local",t),managed:i(e,"managed",t),sync:i(e,"sync",t)})},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(s,r){function i(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=n(0),r=n(2),i=n(1),a=n(3);t.getTabs=(e,t,n=null)=>{const c={onCreated:new r.IpcEvent("tabs","onCreated"),onUpdated:new r.IpcEvent("tabs","onUpdated"),onActivated:new r.IpcEvent("tabs","onActivated"),onRemoved:new r.IpcEvent("tabs","onRemoved"),get:(e,t)=>{c.query({},n=>{t(n.find(t=>t.id===e))})},getCurrent:e=>{c.get(s.ipcRenderer.sendSync("get-webcontents-id"),t=>{e(t)})},query:(e,n)=>{s.ipcRenderer.send(`api-tabs-query-${t}`),s.ipcRenderer.once("api-tabs-query",(t,o)=>{const s=(e,t)=>e[t];n(o.filter(t=>{for(const n in e){const o=s(t,n),r=s(e,n);if("url"===n&&"<all_urls>"===r)return!0;if(null==o||r!==o)return!1}return!0}))})},create:(e,o=null)=>{const r=i.makeId(32);s.ipcRenderer.send(`api-tabs-create-${t}`,r,e,n),o&&s.ipcRenderer.once(`api-tabs-create-${r}`,(e,t)=>{o(t)})},insertCSS:(...n)=>{const r=(n,r,i)=>o(void 0,void 0,void 0,(function*(){yield s.ipcRenderer.invoke(`api-tabs-insertCSS-${t}`,n,r,e.path),i&&i()}));"object"==typeof n[0]?c.getCurrent(e=>{r(e.id,n[0],n[1])}):"number"==typeof n[0]&&r(n[0],n[1],n[2])},executeScript:(...n)=>{const r=(n,r,i)=>o(void 0,void 0,void 0,(function*(){const o=yield s.ipcRenderer.invoke(`api-tabs-executeScript-${t}`,{tabId:n,details:r,basePath:e.path});i&&i(o)}));"object"==typeof n[0]?c.getCurrent(e=>{e&&r(e.id,n[0],n[1])}):"number"==typeof n[0]&&r(n[0],n[1],n[2])},setZoom:(e,n,o)=>{s.ipcRenderer.send(`api-tabs-setZoom-${t}`,e,n),s.ipcRenderer.once("api-tabs-setZoom",()=>{o&&o()})},getZoom:(e,n)=>{s.ipcRenderer.send(`api-tabs-getZoom-${t}`,e),s.ipcRenderer.once("api-tabs-getZoom",(e,t)=>{n&&n(t)})},detectLanguage:(e,n)=>{s.ipcRenderer.send(`api-tabs-detectLanguage-${t}`,e),s.ipcRenderer.once("api-tabs-detectLanguage",(e,t)=>{n&&n(t)})},sendMessage:(...n)=>{const o=a.getSender(e.id),r=i.makeId(32),c=n[0],d=n[1],l=n[2];let u=n[3];"function"==typeof n[2]&&(u=n[2]),"function"==typeof n[3]&&(u=n[3]),l&&l.includeTlsChannelId&&(o.tlsChannelId=r),"function"==typeof u&&s.ipcRenderer.on(`api-tabs-sendMessage-response-${r}`,(e,t)=>{u(t)}),s.ipcRenderer.send(`api-tabs-sendMessage-${t}`,{tabId:c,portId:r,sender:o,message:d})},update:()=>{}};return c}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),s=n(4),r=n(6),i=n(1),a=n(5),c=n(3);t.getRuntime=(e,t)=>({lastError:null,id:e.id,onConnect:new r.LocalEvent,onMessage:new r.LocalEvent,onInstalled:new r.LocalEvent,sendMessage:(...n)=>{const s=c.getSenderContent(e.id),r=i.makeId(32);let a=e.id,d=n[0],l=n[1],u=n[2];"string"==typeof n[0]&&"object"==typeof n[2]&&"function"==typeof n[3]?(a=n[0],d=n[1],l=n[2],u=n[3]):"string"==typeof n[0]&&"object"==typeof n[2]?(a=n[0],d=n[1],l=n[2],u=void 0):2===n.length&&"string"==typeof n[0]&&"function"!=typeof n[1]?(a=n[0],d=n[1],l=void 0,u=void 0):1===n.length?(l=void 0,u=void 0):2===n.length&&"function"==typeof n[1]&&(u=n[1],l=void 0),l&&l.includeTlsChannelId&&(s.tlsChannelId=r),"function"==typeof u&&o.ipcRenderer.on(`api-runtime-sendMessage-response-${r}`,(e,t)=>{u(t)}),o.ipcRenderer.send(`api-runtime-sendMessage-${t}`,{extensionId:a,portId:r,sender:s,message:d})},connect:(...n)=>{const s=c.getSenderContent(e.id),r=i.makeId(32);let d=null,l=e.id;return"string"==typeof n[0]?(l=n[0],n[1]&&"object"==typeof n[1]&&(n[1].includeTlsChannelId&&(s.tlsChannelId=r),d=n[1].name)):n[0]&&"object"==typeof n[0]&&(n[0].includeTlsChannelId&&(s.tlsChannelId=r),d=n[0].name),o.ipcRenderer.send(`api-runtime-connect-${t}`,{extensionId:l,portId:r,sender:s,name:d}),new a.Port(t,r,d)},reload:()=>{o.ipcRenderer.send(`api-runtime-reload-${t}`,e.id)},getURL:t=>s.format({protocol:"electron-extension",slashes:!0,hostname:e.id,pathname:t}),getManifest:()=>e.manifest})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(1);t.getI18n=e=>({getAcceptLanguages:e=>{e&&e(navigator.languages)},getMessage:(t,n)=>{if("@@ui_locale"===t)return"en_US";const{locale:s}=e,r=n instanceof Array,i=s[t];if(null==i)return"";if(r&&n.length>=9)return null;let a=i.message;if("object"==typeof i.placeholders)for(const e in i.placeholders)a=o.replaceAll(a,`$${e}$`,i.placeholders[e].content);if(r)for(let e=0;e<9;e++)a=o.replaceAll(a,`$${e+1}`,n[e]||" ");return a},getUILanguage:()=>navigator.language,detectLanguage:(e,t)=>{t&&t({isReliable:!1,languages:[]})}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),s=n(2),r=n(1);t.getBrowserAction=(e,t)=>({onClicked:new s.IpcEvent("browserAction","onClicked"),setIcon:(e,t)=>{t&&t()},setBadgeBackgroundColor:(e,t)=>{t&&t()},setBadgeText:(n,s)=>{const i=r.makeId(32);o.ipcRenderer.send(`api-browserAction-setBadgeText-${t}`,i,e.id,n),s&&o.ipcRenderer.once(`api-browserAction-setBadgeText-${i}`,()=>{s()})}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(14);t.getWebRequest=()=>({ResourceType:{CSP_REPORT:"csp_report",FONT:"font",IMAGE:"image",MAIN_FRAME:"main_frame",MEDIA:"media",OBJECT:"object",OTHER:"other",PING:"ping",SCRIPT:"script",STYLESHEET:"stylesheet",SUB_FRAME:"sub_frame",WEBSOCKET:"websocket",XMLHTTPREQUEST:"xmlhttprequest"},onBeforeRequest:new o.WebRequestEvent("onBeforeRequest"),onBeforeSendHeaders:new o.WebRequestEvent("onBeforeSendHeaders"),onHeadersReceived:new o.WebRequestEvent("onHeadersReceived"),onSendHeaders:new o.WebRequestEvent("onSendHeaders"),onResponseStarted:new o.WebRequestEvent("onResponseStarted"),onBeforeRedirect:new o.WebRequestEvent("onBeforeRedirect"),onCompleted:new o.WebRequestEvent("onCompleted"),onErrorOccurred:new o.WebRequestEvent("onErrorOccurred")})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),s=n(1);t.WebRequestEvent=class{constructor(e){this.listeners=[],this.name=e}addListener(e,t=null){const n=s.hashCode(e.toString());this.listeners.push(n),o.ipcRenderer.on(`api-webRequest-intercepted-${this.name}-${n}`,(t,s,r)=>{const i=e(s);o.ipcRenderer.send(`api-webRequest-response-${this.name}-${n}-${r}`,i)}),o.ipcRenderer.send("api-add-webRequest-listener",{id:n,name:this.name,filters:t})}removeListener(e){const t=s.hashCode(e.toString());this.listeners=this.listeners.filter(e=>e!==t),o.ipcRenderer.removeAllListeners(`api-webRequest-intercepted-${this.name}-${t}`),o.ipcRenderer.send("api-remove-webRequest-listener",{id:t,name:this.name})}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(2);t.getWebNavigation=()=>({onBeforeNavigate:new o.IpcEvent("webNavigation","onBeforeNavigate"),onCommitted:new o.IpcEvent("webNavigation","onCommitted"),onDOMContentLoaded:new o.IpcEvent("webNavigation","onDOMContentLoaded"),onCompleted:new o.IpcEvent("webNavigation","onCompleted"),onCreatedNavigationTarget:new o.IpcEvent("webNavigation","onCreatedNavigationTarget"),onReferenceFragmentUpdated:new o.IpcEvent("webNavigation","onReferenceFragmentUpdated"),onTabReplaced:new o.IpcEvent("webNavigation","onTabReplaced"),onHistoryStateUpdated:new o.IpcEvent("webNavigation","onHistoryStateUpdated")})},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(s,r){function i(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=n(0),r=n(17),i=s.ipcRenderer.sendSync("get-session-id"),a=process.argv.find(e=>e.startsWith("--blacklist="));let c=[];if(global.isBackground=!1,a)try{c=JSON.parse(a.split("--blacklist=")[1])}catch(e){console.log(e)}if(-1!==i){!function(){o(this,void 0,void 0,(function*(){(yield s.webFrame.executeJavaScript("window")).chrome={webstorePrivate:{install:()=>{}},app:{isInstalled:!1,getIsInstalled:()=>!1,getDetails:()=>{},installState:()=>{}}}}))}();const e=setImmediate,t=s.ipcRenderer.sendSync(`get-extensions-${i}`);process.once("loaded",()=>{global.setImmediate=e,c.find(e=>window.location.href.startsWith(e))||Object.keys(t).forEach(e=>{const n=t[e];n.contentScripts.forEach(e=>{r.injectContentScript(e,n,i)})})})}},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(s,r){function i(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=n(4),r=n(0),i=n(18),a=n(7),c=n(19);t.injectChromeApi=(e,t,n)=>o(void 0,void 0,void 0,(function*(){const o=a.getAPI(e,n);r.webFrame.setIsolatedWorldInfo(t,{name:name});const s=yield r.webFrame.executeJavaScriptInIsolatedWorld(t,[{code:"window"}]);s.chrome=s.browser=o}));const d=(e,n,i,a,c)=>o(void 0,void 0,void 0,(function*(){const o=s.parse(e);yield t.injectChromeApi(i,a,c),r.webFrame.executeJavaScriptInIsolatedWorld(a,[{code:n,url:s.format({protocol:o.protocol,slashes:!0,hostname:i.id,pathname:o.pathname})}])})),l=e=>{const t=document.createElement("style");t.textContent=e,document.body.appendChild(t)};t.injectContentScript=(e,t,n)=>{e.matches.some(e=>i.matchesPattern(e,`${location.protocol}//${location.host}${location.pathname}`))&&(process.setMaxListeners(0),e.js&&e.js.forEach(o=>{const s=d.bind(window,o.url,o.code,t,c.getIsolatedWorldId(t.id),n);"document_start"===e.runAt?process.once("document-start",s):"document_end"===e.runAt?process.once("document-end",s):document.addEventListener("DOMContentLoaded",s)}),e.css&&e.css.forEach(t=>{const n=l.bind(window,t.code);"document_start"===e.runAt?process.once("document-start",n):"document_end"===e.runAt?process.once("document-end",n):document.addEventListener("DOMContentLoaded",n)}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isURL=e=>{const t=/^(?:\w+:)?\/\/([^\s.]+\.\S{2}|localhost[:?\d]*)\S*$/;return!!t.test(e)||t.test(`http://${e}`)},t.matchesPattern=(e,t)=>{if("<all_urls>"===e)return!0;const n=new RegExp(`^${e.replace(/\*/g,".*").replace("/","\\/")}$`);return null!=t.match(n)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let o=1e3;const s={};t.getIsolatedWorldId=e=>s[e]?s[e]:(o++,s[e]=o)}]);
!function(e){var t={};function n(o){if(t[o])return t[o].exports;var s=t[o]={i:o,l:!1,exports:{}};return e[o].call(s.exports,s,s.exports,n),s.l=!0,s.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)n.d(o,s,function(t){return e[t]}.bind(null,s));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=16)}([function(e,t){e.exports=require("electron")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.makeId=(e,t="abcdefghijklmnopqrstuvwxyz")=>{let n="";for(let o=0;o<e;o++)n+=t.charAt(Math.floor(Math.random()*t.length));return n},t.replaceAll=(e,t,n,o="gi")=>(t=t.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),e.replace(new RegExp(t,o),n)),t.hashCode=e=>{let t=0;if(0===e.length)return t;for(let n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0);t.IpcEvent=class{constructor(e,t){this.callbacks=[],this.listener=!1,this.emit=(e,...t)=>{this.callbacks.forEach(e=>{e(...t)})},this.name=t,this.scope=e,this.emit=this.emit.bind(this)}addListener(e){this.callbacks.push(e),this.listener||(o.ipcRenderer.on(`api-emit-event-${this.scope}-${this.name}`,this.emit),this.listener=!0)}removeListener(e){this.callbacks=this.callbacks.filter(t=>t!==e),0===this.callbacks.length&&(o.ipcRenderer.removeListener(`api-emit-event-${this.scope}-${this.name}`,this.emit),this.listener=!1)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0);t.getSenderTab=()=>o.ipcRenderer.sendSync("current-webcontents-to-tab"),t.getSenderContent=e=>({id:e,url:window.location.href,frameId:0,tab:t.getSenderTab()}),t.getSender=e=>({id:e})},function(e,t){e.exports=require("url")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),s=n(6),r=n(3);t.Port=class{constructor(e,t,n=null,r=null){this.sessionId=e,this.onMessage=new s.LocalEvent,this.onDisconnect=new s.LocalEvent,r&&(this.sender=r),n&&(this.name=n),this.portId=t,o.ipcRenderer.on(`api-port-postMessage-${t}`,(e,t,n)=>{n&&this.sender&&(this.sender.tab=n),this.onMessage.emit(t,this)})}disconnect(){o.ipcRenderer.removeAllListeners(`api-port-postMessage-${this.portId}`)}postMessage(e){const{isTab:t}=global;o.ipcRenderer.send(`api-port-postMessage-${this.sessionId}`,{portId:this.portId,msg:e,tab:t?null:r.getSenderTab()})}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.LocalEvent=class{constructor(){this.callbacks=[]}emit(...e){this.callbacks.forEach(t=>{t(...e)})}addListener(e){this.callbacks.push(e)}removeListener(e){this.callbacks=this.callbacks.filter(t=>t!==e)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),s=n(5),r=n(2),i=n(8),a=n(9),c=n(10),d=n(11),l=n(12),u=n(13),p=n(15),f=process.argv.find(e=>e.startsWith("--window-id="));let g=null;f&&(g=parseInt(f.split("--window-id=")[1],10)),t.getAPI=(e,t)=>{const n={runtime:c.getRuntime(e,t),storage:i.getStorage(e.id,t),tabs:a.getTabs(e,t,g),i18n:d.getI18n(e),browserAction:l.getBrowserAction(e,t),webRequest:u.getWebRequest(),webNavigation:p.getWebNavigation(),alarms:{onAlarm:new r.IpcEvent("alarms","onAlarm"),create:(e,t)=>{},get:(e,t)=>{},getAll:e=>{},clear:(e,t)=>{},clearAll:e=>{}},extension:{isIncognitoContext:!1,getURL:c.getRuntime(e,t).getURL}};return o.ipcRenderer.on("api-runtime-connect",(e,o)=>{const{portId:r,sender:i,name:a}=o,c=new s.Port(t,r,a,i);n.runtime.onConnect.emit(c)}),o.ipcRenderer.on("api-runtime-sendMessage",(e,t,s)=>{const{portId:r,sender:i,message:a}=t;n.runtime.onMessage.emit(a,i,e=>{o.ipcRenderer.send("send-msg-webcontents",s,`api-runtime-sendMessage-response-${r}`,e)})}),o.ipcRenderer.on("api-tabs-sendMessage",(e,t,s)=>{const{portId:r,sender:i,message:a}=t;n.runtime.onMessage.emit(a,i,e=>{o.ipcRenderer.send("send-msg-webcontents",s,`api-tabs-sendMessage-response-${r}`,e)})}),n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),s=n(1),r=(e,t,n,r,i,a)=>{const c=s.makeId(32);o.ipcRenderer.send(`api-storage-operation-${a}`,{extensionId:e,id:c,arg:t,type:r,area:n}),i&&o.ipcRenderer.once(`api-storage-operation-${c}`,(e,...t)=>{i(t[0])})},i=(e,t,n)=>({set:(o,s)=>r(e,o,t,"set",s,n),get:(o,s)=>r(e,o,t,"get",s,n),remove:(o,s)=>r(e,o,t,"remove",s,n),clear:(o,s)=>r(e,o,t,"clear",s,n)});t.getStorage=(e,t)=>({local:i(e,"local",t),managed:i(e,"managed",t),sync:i(e,"sync",t),onChanged:{addListener:()=>{}}})},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(s,r){function i(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=n(0),r=n(2),i=n(1),a=n(3);t.getTabs=(e,t,n=null)=>{const c={onCreated:new r.IpcEvent("tabs","onCreated"),onUpdated:new r.IpcEvent("tabs","onUpdated"),onActivated:new r.IpcEvent("tabs","onActivated"),onRemoved:new r.IpcEvent("tabs","onRemoved"),get:(e,t)=>{c.query({},n=>{t(n.find(t=>t.id===e))})},getCurrent:e=>{c.get(s.ipcRenderer.sendSync("get-webcontents-id"),t=>{e(t)})},query:(e,n)=>{s.ipcRenderer.send(`api-tabs-query-${t}`),s.ipcRenderer.once("api-tabs-query",(t,o)=>{const s=(e,t)=>e[t];n(o.filter(t=>{for(const n in e){const o=s(t,n),r=s(e,n);if("url"===n&&"<all_urls>"===r)return!0;if(null==o||r!==o)return!1}return!0}))})},create:(e,o=null)=>{const r=i.makeId(32);s.ipcRenderer.send(`api-tabs-create-${t}`,r,e,n),o&&s.ipcRenderer.once(`api-tabs-create-${r}`,(e,t)=>{o(t)})},insertCSS:(...n)=>{const r=(n,r,i)=>o(void 0,void 0,void 0,(function*(){yield s.ipcRenderer.invoke(`api-tabs-insertCSS-${t}`,n,r,e.path),i&&i()}));"object"==typeof n[0]?c.getCurrent(e=>{r(e.id,n[0],n[1])}):"number"==typeof n[0]&&r(n[0],n[1],n[2])},executeScript:(...n)=>{const r=(n,r,i)=>o(void 0,void 0,void 0,(function*(){const o=yield s.ipcRenderer.invoke(`api-tabs-executeScript-${t}`,{tabId:n,details:r,basePath:e.path});i&&i(o)}));"object"==typeof n[0]?c.getCurrent(e=>{e&&r(e.id,n[0],n[1])}):"number"==typeof n[0]&&r(n[0],n[1],n[2])},setZoom:(e,n,o)=>{s.ipcRenderer.send(`api-tabs-setZoom-${t}`,e,n),s.ipcRenderer.once("api-tabs-setZoom",()=>{o&&o()})},getZoom:(e,n)=>{s.ipcRenderer.send(`api-tabs-getZoom-${t}`,e),s.ipcRenderer.once("api-tabs-getZoom",(e,t)=>{n&&n(t)})},detectLanguage:(e,n)=>{s.ipcRenderer.send(`api-tabs-detectLanguage-${t}`,e),s.ipcRenderer.once("api-tabs-detectLanguage",(e,t)=>{n&&n(t)})},sendMessage:(...n)=>{const o=a.getSender(e.id),r=i.makeId(32),c=n[0],d=n[1],l=n[2];let u=n[3];"function"==typeof n[2]&&(u=n[2]),"function"==typeof n[3]&&(u=n[3]),l&&l.includeTlsChannelId&&(o.tlsChannelId=r),"function"==typeof u&&s.ipcRenderer.on(`api-tabs-sendMessage-response-${r}`,(e,t)=>{u(t)}),s.ipcRenderer.send(`api-tabs-sendMessage-${t}`,{tabId:c,portId:r,sender:o,message:d})},update:()=>{}};return c}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),s=n(4),r=n(6),i=n(1),a=n(5),c=n(3);t.getRuntime=(e,t)=>({lastError:null,id:e.id,onConnect:new r.LocalEvent,onMessage:new r.LocalEvent,onInstalled:new r.LocalEvent,sendMessage:(...n)=>{const s=c.getSenderContent(e.id),r=i.makeId(32);let a=e.id,d=n[0],l=n[1],u=n[2];"string"==typeof n[0]&&"object"==typeof n[2]&&"function"==typeof n[3]?(a=n[0],d=n[1],l=n[2],u=n[3]):"string"==typeof n[0]&&"object"==typeof n[2]?(a=n[0],d=n[1],l=n[2],u=void 0):2===n.length&&"string"==typeof n[0]&&"function"!=typeof n[1]?(a=n[0],d=n[1],l=void 0,u=void 0):1===n.length?(l=void 0,u=void 0):2===n.length&&"function"==typeof n[1]&&(u=n[1],l=void 0),l&&l.includeTlsChannelId&&(s.tlsChannelId=r),"function"==typeof u&&o.ipcRenderer.on(`api-runtime-sendMessage-response-${r}`,(e,t)=>{u(t)}),o.ipcRenderer.send(`api-runtime-sendMessage-${t}`,{extensionId:a,portId:r,sender:s,message:d})},connect:(...n)=>{const s=c.getSenderContent(e.id),r=i.makeId(32);let d=null,l=e.id;return"string"==typeof n[0]?(l=n[0],n[1]&&"object"==typeof n[1]&&(n[1].includeTlsChannelId&&(s.tlsChannelId=r),d=n[1].name)):n[0]&&"object"==typeof n[0]&&(n[0].includeTlsChannelId&&(s.tlsChannelId=r),d=n[0].name),o.ipcRenderer.send(`api-runtime-connect-${t}`,{extensionId:l,portId:r,sender:s,name:d}),new a.Port(t,r,d)},reload:()=>{o.ipcRenderer.send(`api-runtime-reload-${t}`,e.id)},getURL:t=>s.format({protocol:"electron-extension",slashes:!0,hostname:e.id,pathname:t}),getManifest:()=>e.manifest})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(1);t.getI18n=e=>({getAcceptLanguages:e=>{e&&e(navigator.languages)},getMessage:(t,n)=>{if("@@ui_locale"===t)return"en_US";const{locale:s}=e,r=n instanceof Array,i=s[t];if(null==i)return"";if(r&&n.length>=9)return null;let a=i.message;if("object"==typeof i.placeholders)for(const e in i.placeholders)a=o.replaceAll(a,`$${e}$`,i.placeholders[e].content);if(r)for(let e=0;e<9;e++)a=o.replaceAll(a,`$${e+1}`,n[e]||" ");return a},getUILanguage:()=>navigator.language,detectLanguage:(e,t)=>{t&&t({isReliable:!1,languages:[]})}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),s=n(2),r=n(1);t.getBrowserAction=(e,t)=>({onClicked:new s.IpcEvent("browserAction","onClicked"),setIcon:(e,t)=>{t&&t()},setBadgeBackgroundColor:(e,t)=>{t&&t()},setBadgeText:(n,s)=>{const i=r.makeId(32);o.ipcRenderer.send(`api-browserAction-setBadgeText-${t}`,i,e.id,n),s&&o.ipcRenderer.once(`api-browserAction-setBadgeText-${i}`,()=>{s()})}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(14);t.getWebRequest=()=>({ResourceType:{CSP_REPORT:"csp_report",FONT:"font",IMAGE:"image",MAIN_FRAME:"main_frame",MEDIA:"media",OBJECT:"object",OTHER:"other",PING:"ping",SCRIPT:"script",STYLESHEET:"stylesheet",SUB_FRAME:"sub_frame",WEBSOCKET:"websocket",XMLHTTPREQUEST:"xmlhttprequest"},onBeforeRequest:new o.WebRequestEvent("onBeforeRequest"),onBeforeSendHeaders:new o.WebRequestEvent("onBeforeSendHeaders"),onHeadersReceived:new o.WebRequestEvent("onHeadersReceived"),onSendHeaders:new o.WebRequestEvent("onSendHeaders"),onResponseStarted:new o.WebRequestEvent("onResponseStarted"),onBeforeRedirect:new o.WebRequestEvent("onBeforeRedirect"),onCompleted:new o.WebRequestEvent("onCompleted"),onErrorOccurred:new o.WebRequestEvent("onErrorOccurred")})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),s=n(1);t.WebRequestEvent=class{constructor(e){this.listeners=[],this.name=e}addListener(e,t=null){const n=s.hashCode(e.toString());this.listeners.push(n),o.ipcRenderer.on(`api-webRequest-intercepted-${this.name}-${n}`,(t,s,r)=>{const i=e(s);o.ipcRenderer.send(`api-webRequest-response-${this.name}-${n}-${r}`,i)}),o.ipcRenderer.send("api-add-webRequest-listener",{id:n,name:this.name,filters:t})}removeListener(e){const t=s.hashCode(e.toString());this.listeners=this.listeners.filter(e=>e!==t),o.ipcRenderer.removeAllListeners(`api-webRequest-intercepted-${this.name}-${t}`),o.ipcRenderer.send("api-remove-webRequest-listener",{id:t,name:this.name})}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(2);t.getWebNavigation=()=>({onBeforeNavigate:new o.IpcEvent("webNavigation","onBeforeNavigate"),onCommitted:new o.IpcEvent("webNavigation","onCommitted"),onDOMContentLoaded:new o.IpcEvent("webNavigation","onDOMContentLoaded"),onCompleted:new o.IpcEvent("webNavigation","onCompleted"),onCreatedNavigationTarget:new o.IpcEvent("webNavigation","onCreatedNavigationTarget"),onReferenceFragmentUpdated:new o.IpcEvent("webNavigation","onReferenceFragmentUpdated"),onTabReplaced:new o.IpcEvent("webNavigation","onTabReplaced"),onHistoryStateUpdated:new o.IpcEvent("webNavigation","onHistoryStateUpdated")})},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(s,r){function i(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=n(0),r=n(17),i=s.ipcRenderer.sendSync("get-session-id"),a=process.argv.find(e=>e.startsWith("--blacklist="));let c=[];if(global.isTab=!0,a)try{c=JSON.parse(a.split("--blacklist=")[1])}catch(e){console.log(e)}if(-1!==i){!function(){o(this,void 0,void 0,(function*(){(yield s.webFrame.executeJavaScript("window")).chrome={webstorePrivate:{install:()=>{}},app:{isInstalled:!1,getIsInstalled:()=>!1,getDetails:()=>{},installState:()=>{}}}}))}();const e=setImmediate,t=s.ipcRenderer.sendSync(`get-extensions-${i}`);process.once("loaded",()=>{global.setImmediate=e,c.find(e=>window.location.href.startsWith(e))||Object.keys(t).forEach(e=>{const n=t[e];n.contentScripts.forEach(e=>{r.injectContentScript(e,n,i)})})})}},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(s,r){function i(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=n(4),r=n(0),i=n(18),a=n(7),c=n(19);t.injectChromeApi=(e,t,n)=>o(void 0,void 0,void 0,(function*(){const o=a.getAPI(e,n);r.webFrame.setIsolatedWorldInfo(t,{name:name});const s=yield r.webFrame.executeJavaScriptInIsolatedWorld(t,[{code:"window"}]);s.chrome=s.browser=s.webext=o}));const d=(e,n,i,a,c)=>o(void 0,void 0,void 0,(function*(){const o=s.parse(e);yield t.injectChromeApi(i,a,c),r.webFrame.executeJavaScriptInIsolatedWorld(a,[{code:n,url:s.format({protocol:o.protocol,slashes:!0,hostname:i.id,pathname:o.pathname})}])})),l=e=>{const t=document.createElement("style");t.textContent=e,document.body.appendChild(t)};t.injectContentScript=(e,t,n)=>{e.matches.some(e=>i.matchesPattern(e,`${location.protocol}//${location.host}${location.pathname}`))&&(process.setMaxListeners(0),e.js&&e.js.forEach(o=>{const s=d.bind(window,o.url,o.code,t,c.getIsolatedWorldId(t.id),n);"document_start"===e.runAt?process.once("document-start",s):"document_end"===e.runAt?process.once("document-end",s):document.addEventListener("DOMContentLoaded",s)}),e.css&&e.css.forEach(t=>{const n=l.bind(window,t.code);"document_start"===e.runAt?process.once("document-start",n):"document_end"===e.runAt?process.once("document-end",n):document.addEventListener("DOMContentLoaded",n)}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isURL=e=>{const t=/^(?:\w+:)?\/\/([^\s.]+\.\S{2}|localhost[:?\d]*)\S*$/;return!!t.test(e)||t.test(`http://${e}`)},t.matchesPattern=(e,t)=>{if("<all_urls>"===e)return!0;const n=new RegExp(`^${e.replace(/\*/g,".*").replace("/","\\/")}$`);return null!=t.match(n)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let o=1e3;const s={};t.getIsolatedWorldId=e=>s[e]?s[e]:(o++,s[e]=o)}]);
//# sourceMappingURL=content-preload.js.map

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

module.exports=function(e){var t={};function n(s){if(t[s])return t[s].exports;var o=t[s]={i:s,l:!1,exports:{}};return e[s].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,s){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(s,o,function(t){return e[t]}.bind(null,o));return s},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(e,t){e.exports=require("electron")},function(e,t){e.exports=require("path")},function(e,t){e.exports=require("fs")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.makeId=(e,t="abcdefghijklmnopqrstuvwxyz")=>{let n="";for(let s=0;s<e;s++)n+=t.charAt(Math.floor(Math.random()*t.length));return n},t.replaceAll=(e,t,n,s="gi")=>(t=t.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),e.replace(new RegExp(t,s),n)),t.hashCode=e=>{let t=0;if(0===e.length)return t;for(let n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return t}},function(e,t,n){"use strict";var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))((function(o,i){function r(e){try{c(s.next(e))}catch(e){i(e)}}function a(e){try{c(s.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),i=n(1),r=n(2),a=n(9),c=n(10),d=n(13),l=n(5),u=n(6),f=n(16);let p=1;const h=[];t.storages=new Map,o.ipcMain.on("get-session-id",e=>{let t=h.find(t=>t.session===e.sender.session);if(t)e.returnValue=t.id;else if(t=h.find(t=>{return!!Object.values(t.extensions).find(t=>t.backgroundPage.webContents.id===e.sender.id)}))return void(e.returnValue=t.id);e.returnValue=-1}),o.ipcMain.on("send-msg-webcontents",(e,t,n,...s)=>{o.webContents.fromId(t).send(n,...s)}),o.ipcMain.on("get-webcontents-id",e=>{e.returnValue=e.sender.id}),o.ipcMain.on("current-webcontents-to-tab",e=>{e.returnValue=u.webContentsToTab(e.sender)});t.ExtensibleSession=class{constructor(e,t={}){this.session=e,this.extensions={},this.id=p++,this.webContents=[],this._initialized=!1,this.options={contentPreloadPath:i.resolve(__dirname,"content-preload.js"),backgroundPreloadPath:i.resolve(__dirname,"background-preload.js")},a.registerProtocols(this),this.options=Object.assign(Object.assign({},this.options),t),h.push(this),o.app.on("web-contents-created",(e,t)=>{u.webContentsValid(t)&&f.hookWebContentsEvents(this,t)})}loadExtension(e){return s(this,void 0,void 0,(function*(){if(this._initialized||(this.session.setPreloads(this.session.getPreloads().concat([this.options.contentPreloadPath])),c.runWebRequestService(this),d.runMessagingService(this),this._initialized=!0),!(yield r.promises.stat(e)).isDirectory())throw new Error("Given path is not a directory");const t=i.resolve(e,"manifest.json");if(!r.existsSync(t))throw new Error("Given directory doesn't contain manifest.json file");const n=JSON.parse(yield r.promises.readFile(t,"utf8")),s=i.basename(e);if(this.extensions[s])return this.extensions[s];n.srcDirectory=e,n.extensionId=s;const o=yield l.loadExtension(n);return o.backgroundPage=yield l.startBackgroundPage(n,this.id,this.options.backgroundPreloadPath),this.extensions[s]=o,o}))}addWindow(e){this.webContents.push(e.webContents),e.isFocused()&&(this.lastActiveWebContents=e.webContents),e.on("focus",()=>{this.lastActiveWebContents=e.webContents}),o.ipcMain.on(`api-browserAction-onClicked-${e.webContents.id}`,(e,t,n)=>{const s=u.webContentsToTab(o.webContents.fromId(n));this.extensions[t].backgroundPage.webContents.send("api-emit-event-browserAction-onClicked",s)}),o.ipcMain.on(`get-extensions-${e.webContents.id}`,e=>{const t=Object.assign({},this.extensions);for(const e in t)t[e]=l.getIpcExtension(t[e]);e.returnValue=t})}}},function(e,t,n){"use strict";var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))((function(o,i){function r(e){try{c(s.next(e))}catch(e){i(e)}}function a(e){try{c(s.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),i=n(2),r=n(1),a=n(7),c=n(4),d=n(8),l=n(14);t.manifestToExtensionInfo=e=>({startPage:a.format({protocol:"electron-extension",slashes:!0,hostname:e.extensionId,pathname:e.devtools_page}),srcDirectory:e.srcDirectory,name:e.name,exposeExperimentalAPIs:!0}),t.getIpcExtension=e=>{const t=Object.assign({},e);return delete t.backgroundPage,t},t.startBackgroundPage=({background:e,srcDirectory:t,extensionId:n},c,d)=>s(void 0,void 0,void 0,(function*(){if(e){const{page:s,scripts:l}=e;let u,f=Buffer.from("");s?(u=s,f=yield i.promises.readFile(r.resolve(t,s))):l&&(u="generated.html",f=Buffer.from(`<html>\n <body>${l.map(e=>`<script src="${e}"><\/script>`).join("")}\n </body>\n </html>`,"utf8"));const p=o.webContents.create({partition:`persist:electron-extension-${c}`,preload:d,type:"backgroundPage",commandLineSwitches:["--background-page"],webPreferences:{nodeIntegration:!0,contextIsolation:!1,webSecurity:!1}});return p.loadURL(a.format({protocol:"electron-extension",slashes:!0,hostname:n,pathname:u})),{html:f,fileName:u,webContents:p}}return null})),t.sendToBackgroundPages=(e,t,...n)=>{for(const s in e.extensions){const{webContents:o}=e.extensions[s].backgroundPage;o.isDestroyed()||o.send(t,...n)}};const u=e=>s(void 0,void 0,void 0,(function*(){if("string"==typeof e.default_locale){const t=r.resolve(e.srcDirectory,"_locales",e.default_locale);if(!i.existsSync(t))return;const n=r.resolve(t,"messages.json"),s=yield i.promises.stat(n);if(!i.existsSync(n)||s.isDirectory())return;const o=yield i.promises.readFile(n,"utf8");return JSON.parse(o)}}));t.loadExtension=e=>s(void 0,void 0,void 0,(function*(){const t={manifest:e,alarms:[],locale:yield u(e),id:e.extensionId,path:e.srcDirectory};if(e.content_scripts){const n=t=>s(void 0,void 0,void 0,(function*(){return{url:`electron-extension://${e.extensionId}/${t}`,code:yield i.promises.readFile(r.join(e.srcDirectory,t),"utf8")}}));try{const o=yield Promise.all(e.content_scripts.map(e=>s(void 0,void 0,void 0,(function*(){return{matches:e.matches,js:e.js?yield Promise.all(e.js.map(n)):[],css:e.css?yield Promise.all(e.css.map(n)):[],runAt:e.run_at||"document_idle"}}))));t.contentScripts=o}catch(e){console.error("Failed to read content scripts",e)}}return c.storages.get(e.extensionId)||c.storages.set(e.extensionId,(e=>{const t=d.getPath("storage/extensions",e.extensionId);return{local:new l.StorageArea(r.resolve(t,"local")),sync:new l.StorageArea(r.resolve(t,"sync")),managed:new l.StorageArea(r.resolve(t,"managed"))}})(e)),t})),t.loadDevToolsExtensions=(e,n)=>{if(!e.devToolsWebContents)return;n.map(t.manifestToExtensionInfo).forEach(t=>{t.startPage&&e.devToolsWebContents._grantOriginAccess(t.startPage)})},t.extensionsToManifests=e=>Object.values(e).map(e=>e.manifest)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(0);t.webContentsToTab=e=>({id:e.id,index:e.id,windowId:e.hostWebContents?e.hostWebContents.id:e.id,highlighted:e.isFocused(),active:e.isFocused(),selected:e.isFocused(),pinned:!1,discarded:!1,autoDiscardable:!1,url:e.getURL(),title:e.getTitle(),incognito:!1,audible:e.isCurrentlyAudible()}),t.getAllWebContentsInSession=e=>s.webContents.getAllWebContents().filter(t=>t.session===e),t.webContentsValid=e=>{const t=e.getType();return"window"===t||"webview"===t||"browserView"===t}},function(e,t){e.exports=require("url")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(1),o=n(2),i=n(0);t.getPath=(...e)=>{let t;if(i.remote)t=i.remote.app.getPath("userData");else{if(!i.app)return null;t=i.app.getPath("userData")}return s.resolve(t,...e).replace(/\\/g,"/")},t.mkDirByPathSync=(e,{isRelativeToScript:t=!1}={})=>{const n=s.isAbsolute(e)?s.sep:"",i=t?__dirname:".";return e.split(s.sep).reduce((t,n)=>{const r=s.resolve(i,t,n);try{o.mkdirSync(r)}catch(n){if("EEXIST"===n.code)return r;if("ENOENT"===n.code)throw new Error(`EACCES: permission denied, mkdir '${t}'`);const s=["EACCES","EPERM","EISDIR"].indexOf(n.code)>-1;if(!s||s&&e===r)throw n}return r},n)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(0),o=n(2),i=n(1),r=n(7);s.protocol&&s.protocol.registerSchemesAsPrivileged([{scheme:"electron-extension",privileges:{bypassCSP:!0,secure:!0,standard:!0,supportFetchAPI:!0,allowServiceWorkers:!0,corsEnabled:!1}}]);const a=(e,t)=>{t.protocol.registerBufferProtocol("electron-extension",(t,n)=>{const s=r.parse(decodeURIComponent(t.url));if(!s.hostname||!s.pathname)return n();const a=e.extensions[s.hostname];if(!a)return n();const{backgroundPage:c,path:d}=a;return c&&s.pathname===`/${c.fileName}`?n({mimeType:"text/html",data:c.html}):(o.readFile(i.join(d,s.pathname),(e,t)=>n(e?-6:t)),null)},e=>{e&&console.error(`Failed to register extension protocol: ${e}`)})};t.registerProtocols=e=>{a(e,s.session.fromPartition(`persist:electron-extension-${e.id}`)),a(e,e.session)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(0),o=n(11),i=n(3),r={},a=e=>"mainFrame"===e?"main_frame":"subFrame"===e?"sub_frame":"cspReport"===e?"csp_report":e,c=e=>{const t=[];return Object.keys(e).forEach(n=>{e[n]&&t.push({name:n,value:e[n][0]})}),t},d=e=>{return e.forEach(t=>{e[t.name]=t.value}),{}};t.runWebRequestService=e=>{const{webRequest:t}=o.default(e.session);s.ipcMain.on("api-add-webRequest-listener",(e,n)=>{const{id:o,name:l,filters:u}=n;r[o]=(t,n)=>{let r=((e,t)=>{return Object.assign(Object.assign({},e),{requestId:e.id.toString(),frameId:0,parentFrameId:-1,type:a(e.resourceType),timeStamp:Date.now(),tabId:t?e.webContentsId:-1,error:""})})(t,!0);if("onBeforeSendHeaders"===l){const e=c(t.requestHeaders);r=Object.assign(Object.assign({},r),{requestHeaders:e})}else if("onHeadersReceived"===l){const e=c(t.responseHeaders);r=Object.assign(Object.assign({},r),{responseHeaders:e})}else if("onSendHeaders"===l){const e=c(t.requestHeaders);r=Object.assign(Object.assign({},r),{requestHeaders:e})}((e,t,n,o,r=null)=>{let a=!1;const c={cancel:!1,requestHeaders:t.requestHeaders,responseHeaders:t.responseHeaders},l=(e=>(function t(n){t.prototype.callbackCalled||(e(n),t.prototype.callbackCalled=!0)}))(r),u=i.makeId(32);s.ipcMain.once(`api-webRequest-response-${e}-${o}-${u}`,(n,s)=>{if(s){if(s.cancel)return l({cancel:!0});if(s.redirectURL)return l({cancel:!1,redirectURL:s.redirectUrl});if(s.requestHeaders&&("onBeforeSendHeaders"===e||"onSendHeaders"===e)){const e=d(s.requestHeaders);return l({cancel:!1,requestHeaders:e})}if(s.responseHeaders){const e=Object.assign(Object.assign({},t.responseHeaders),d(s.responseHeaders));return l({responseHeaders:e,cancel:!1})}}l(c)}),n.send(`api-webRequest-intercepted-${e}-${o}`,t,u),a=!0})(l,r,s.webContents.fromId(e.sender.id),o,n)},u?t[l](u,r[o]):t[l](r[o])}),s.ipcMain.on("api-remove-webRequest-listener",(e,t)=>{const{id:n}=t;r[n]&&delete r[n]})}},function(e,t,n){"use strict";var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))((function(o,i){function r(e){try{c(s.next(e))}catch(e){i(e)}}function a(e){try{c(s.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=n(3),i=n(12),r=e=>{return e.reverse().reduce((e,t)=>s(void 0,void 0,void 0,(function*(){if(e.cancel)return e;const n=yield t.apply();return Object.assign(Object.assign({},e),n)})),{cancel:!1})},a=["onBeforeRequest","onBeforeSendHeaders","onHeadersReceived"],c=["onBeforeRequest","onBeforeSendHeaders","onHeadersReceived","onSendHeaders","onResponseStarted","onBeforeRedirect","onCompleted","onErrorOccurred"];class d{constructor(e){this.orderIndex=0,this.webRequest=e,this.listeners=new Map,this.filters=new Map,this.resolvers=new Map}get nextIndex(){return this.orderIndex+=1}getListeners(){return this.listeners}getListenersFor(e){return this.listeners.get(e)}getFilters(){return this.filters}getFiltersFor(e){return this.filters.get(e)}hasCallback(e){return a.includes(e)}alias(e,t){const n=this.parseArguments(t);return this.identifyAction(e,n)}addListener(e,t,n,s={}){const{urls:i}=t,r=o.makeId(32),a={order:this.nextIndex},c={id:r,urls:i,action:n,context:Object.assign(Object.assign({},s),a)};this.listeners.has(e)||this.listeners.set(e,new Map),this.listeners.get(e).set(r,c),this.filters.has(e)||this.filters.set(e,new Set);const d=this.filters.get(e);for(const e of i)d.add(e);return this.webRequest[e]({urls:[...d]},this.listenerFactory(e)),c}removeListener(e,t){const n=this.listeners.get(e);if(n&&n.has(t))if(1===n.size)this.clearListeners(e);else{n.delete(t);const s=this.mergeFilters(n);this.filters.set(e,s),this.webRequest[e]([...s],this.listenerFactory(e))}}clearListeners(e){const t=this.listeners.get(e),n=this.filters.get(e);t&&t.clear(),n&&n.clear(),this.webRequest[e](null)}setResolver(e,t){this.hasCallback(e)?this.resolvers.set(e,t):console.warn(`Event method "${e}" has no callback and does not use a resolver`)}matchListeners(e,t){return Array.from(t.values()).filter(t=>t.urls.some(t=>i.matchesPattern(t,e)))}listenerFactory(e){return(t,n)=>s(this,void 0,void 0,(function*(){if(!this.listeners.has(e))return void this.webRequest[e](null);const s=this.listeners.get(e);if(!s)return void(n&&n({cancel:!1}));const o=this.matchListeners(t.url,s);if(0===o.length)return void(n&&n({cancel:!1}));let i=this.resolvers.get(e);i||(i=r);const a=this.processRequests(t,o);if(this.hasCallback(e)&&n){const e=yield i(a);n(e)}else a.map(e=>e.apply())}))}processRequests(e,t){const n=[];for(const s of t){const t=this.makeApplier(e,s.action);n.push({apply:t,context:s.context})}return n}makeApplier(e,t){return()=>new Promise((n,s)=>{try{t(e,n)}catch(e){s(e)}})}mergeFilters(e){return Array.from(e.values()).reduce((e,t)=>{for(const n of t.urls)e.add(n);return e},new Set)}parseArguments(e){const t={unbind:!1,filter:{urls:["<all_urls>"]},action:null,context:{}};switch(e.length){case 0:t.unbind=!0;break;case 1:if("function"==typeof e[0]){t.action=e[0];break}throw new Error("Wrong function signature : No function listener given");case 2:if("object"==typeof e[0]&&"function"==typeof e[1]){t.filter=e[0],t.action=e[1];break}if("function"==typeof e[0]){t.action=e[0],t.context=e[1];break}throw new Error("Wrong function signature : argument 1 should be an object filters or the function listener");case 3:if("object"==typeof e[0]&&"function"==typeof e[1]){t.filter=e[0],t.action=e[1],t.context=e[2];break}throw new Error("Wrong function signature : should be arg 1 -> filter object, arg 2 -> function listener, arg 3 -> context");default:throw new Error("Wrong function signature : Too many arguments")}return t}identifyAction(e,t){const{unbind:n,filter:s,action:o,context:i}=t;if(n)return this.clearListeners(e);if(!o)throw new Error(`Cannot bind with ${e} : a listener is missing.`);return this.addListener(e,s,o,i)}}t.BetterWebRequest=d;const l={get:(e,t)=>c.includes(t)?(...n)=>{e.alias(t,n)}:e[t]},u=e=>new Proxy(new d(e.webRequest),l),f=new Set;t.default=e=>f.has(e)?e:(Object.defineProperty(e,"webRequest",{value:u(e),writable:!1}),f.add(e),e)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isURL=e=>{const t=/^(?:\w+:)?\/\/([^\s.]+\.\S{2}|localhost[:?\d]*)\S*$/;return!!t.test(e)||t.test(`http://${e}`)},t.matchesPattern=(e,t)=>{if("<all_urls>"===e)return!0;const n=new RegExp(`^${e.replace(/\*/g,".*").replace("/","\\/")}$`);return null!=t.match(n)}},function(e,t,n){"use strict";var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))((function(o,i){function r(e){try{c(s.next(e))}catch(e){i(e)}}function a(e){try{c(s.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),i=n(5),r=n(4),a=n(6),c=n(3),d=n(2),l=n(1);t.runMessagingService=e=>{o.ipcMain.on(`get-extension-${e.id}`,(t,n)=>{t.returnValue=i.getIpcExtension(e.extensions[n])}),o.ipcMain.on(`get-extensions-${e.id}`,t=>{const n=Object.assign({},e.extensions);for(const e in n)n[e]=i.getIpcExtension(n[e]),delete n[e].manifest.contentScripts;t.returnValue=n}),o.ipcMain.on(`get-extensions-content-${e.id}`,t=>{const n=Object.assign({},e.extensions);for(const e in n)n[e]=i.getIpcExtension(n[e]);t.returnValue=n}),o.ipcMain.on(`api-tabs-query-${e.id}`,t=>{const n=a.getAllWebContentsInSession(e.session).map(e=>a.webContentsToTab(e));t.sender.send("api-tabs-query",n)}),o.ipcMain.on(`api-tabs-create-${e.id}`,(t,n,s,i)=>{const r=c.makeId(32),d=t.sender.getType();if(s.windowId){e.webContents.find(e=>e.id===s.windowId).send("api-tabs-create",r,s)}else if("backgroundPage"===d)e.lastActiveWebContents.send("api-tabs-create",r,s);else if("browserView"===d){const e=o.BrowserWindow.fromId(i);e&&e.webContents.send("api-tabs-create",r,s)}else"webview"===d&&t.sender.hostWebContents.send("api-tabs-create",r,s);o.ipcMain.once(`api-tabs-create-${r}`,(e,s)=>{t.sender.send(`api-tabs-create-${n}`,a.webContentsToTab(o.webContents.fromId(s)))})}),o.ipcMain.handle(`api-tabs-insertCSS-${e.id}`,(e,t,n,i)=>s(void 0,void 0,void 0,(function*(){const e=o.webContents.fromId(t);e&&(n.hasOwnProperty("file")&&(n.code=yield d.promises.readFile(l.join(i,n.file),"utf8")),e.insertCSS(n.code))}))),o.ipcMain.handle(`api-tabs-executeScript-${e.id}`,(e,t)=>s(void 0,void 0,void 0,(function*(){const{tabId:e,details:n,basePath:s}=t,i=o.webContents.fromId(e);if(i)return n.hasOwnProperty("file")&&(n.code=yield d.promises.readFile(l.join(s,n.file),"utf8")),yield i.executeJavaScript(n.code)}))),o.ipcMain.on(`api-runtime-reload-${e.id}`,(t,n)=>{const{backgroundPage:s}=e.extensions[n];if(s){o.webContents.fromId(t.sender.id).reload()}}),o.ipcMain.on(`api-runtime-connect-${e.id}`,(t,{extensionId:n,portId:o,sender:i,name:r})=>s(void 0,void 0,void 0,(function*(){const{backgroundPage:s}=e.extensions[n],{webContents:a}=s;t.sender.id!==a.id&&a.send("api-runtime-connect",{portId:o,sender:i,name:r})}))),o.ipcMain.on(`api-runtime-sendMessage-${e.id}`,(t,n)=>s(void 0,void 0,void 0,(function*(){const{extensionId:s}=n,{backgroundPage:o}=e.extensions[s],{webContents:i}=o;t.sender.id!==i.id&&i.send("api-runtime-sendMessage",n,t.sender.id)}))),o.ipcMain.on(`api-tabs-sendMessage-${e.id}`,(t,n)=>s(void 0,void 0,void 0,(function*(){const{tabId:s}=n,o=a.getAllWebContentsInSession(e.session);for(const e of o)e.id===s&&e.send("api-tabs-sendMessage",n,t.sender.id)}))),o.ipcMain.on(`api-port-postMessage-${e.id}`,(t,{portId:n,msg:s,tab:o})=>{if(a.webContentsValid(t.sender))Object.keys(e.extensions).forEach(i=>{const{backgroundPage:r}=e.extensions[i],a=r.webContents;t.sender.id!==a.id&&a.send(`api-port-postMessage-${n}`,s,o)});else{const i=a.getAllWebContentsInSession(e.session);for(const e of i)e.id!==t.sender.id&&e.send(`api-port-postMessage-${n}`,s,o)}}),o.ipcMain.on(`api-storage-operation-${e.id}`,(e,{extensionId:t,id:n,area:i,type:a,arg:c})=>s(void 0,void 0,void 0,(function*(){const s=r.storages.get(t),d=o.webContents.fromId(e.sender.id),l=`api-storage-operation-${n}`;if("get"===a){const e=yield s[i].get(c);for(const t in e)Buffer.isBuffer(e[t])&&(e[t]=JSON.parse(e[t].toString()));d.send(l,e)}else"set"===a?(yield s[i].set(c),d.send(l)):"clear"===a?(yield s[i].clear(),d.send(l)):"remove"===a&&(yield s[i].remove(c),d.send(l))}))),o.ipcMain.on(`api-alarms-operation-${e.id}`,(t,n)=>{const{extensionId:s,type:i}=n,r=o.webContents.fromId(t.sender.id);if("create"===i){const o=e.extensions[s],{alarms:i}=o,{name:a,alarmInfo:c}=n,d=-1!==i.findIndex(e=>e.name===a);if(t.returnValue=null,d)return;let l=0;if(null!=c.when&&(l=c.when),null!=c.delayInMinutes){if(c.delayInMinutes<1)return console.error(`Alarm delay is less than minimum of 1 minutes. In released .crx, alarm "${a}" will fire in approximately 1 minutes.`);l=Date.now()+6e4*c.delayInMinutes}const u={periodInMinutes:c.periodInMinutes,scheduledTime:l,name:a};i.push(u),u.periodInMinutes||setTimeout(()=>{r.send("api-emit-event-alarms-onAlarm",u)},u.scheduledTime-Date.now())}}),o.ipcMain.on(`api-browserAction-setBadgeText-${e.id}`,(t,n,s,i)=>{const r=c.makeId(32);for(const t of e.webContents)t.send("api-browserAction-setBadgeText",r,s,i);o.ipcMain.on(`api-browserAction-setBadgeText-${r}`,()=>{t.sender.send(`api-browserAction-setBadgeText-${n}`)})}),o.ipcMain.on(`send-to-all-extensions-${e.id}`,(t,n,...s)=>{i.sendToBackgroundPages(e,n,...s);const o=a.getAllWebContentsInSession(e.session);for(const e of o)e.send(n,...s)})}},function(e,t,n){"use strict";var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))((function(o,i){function r(e){try{c(s.next(e))}catch(e){i(e)}}function a(e){try{c(s.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=n(8),i=n(3),r=n(15),a=n(2),c=n(1);class d extends r.EventEmitter{constructor(e){super(),this.queue=[],this.path=c.resolve(e,"storage.db"),o.mkDirByPathSync(e),a.existsSync(e)||this.clear()}_save(e){return s(this,void 0,void 0,(function*(){try{if(yield a.promises.writeFile(this.path,e),this.queue.length>=3)for(let e=this.queue.length-1;e>0;e--)this.removeAllListeners(this.queue[e]),this.queue.splice(e,1);else this.queue.splice(0,1);this.queue[0]&&this.emit(this.queue[0])}catch(e){console.error(e)}}))}save(e){return s(this,void 0,void 0,(function*(){const t=i.makeId(32);this.queue.push(t),1===this.queue.length?this._save(e):this.once(t,()=>{this._save(e)})}))}get(e){return s(this,void 0,void 0,(function*(){try{if(null==e){const e={},t=JSON.parse(yield a.promises.readFile(this.path,"utf8"));for(const n in t)e[n]=t[n];return e}if(Array.isArray(e)){const t={},n=JSON.parse(yield a.promises.readFile(this.path,"utf8"));for(const s in n)for(const o of e)s===o&&(t[s]=n[s]);return t}if("object"==typeof e){const t=Object.assign({},e),n=JSON.parse(yield a.promises.readFile(this.path,"utf8"));for(const s in n)for(const o in e)o===s&&void 0!==n[s]&&(t[s]=n[s]);return t}if("string"==typeof e){const t=JSON.parse(yield a.promises.readFile(this.path,"utf8"));for(const n in t)if(n===e)return{[e]:t[n]};return{}}return{}}catch(e){return{}}}))}set(e){return s(this,void 0,void 0,(function*(){if(e===Object(e)){const t=this.get(null);for(const n in e)void 0===e[n]?delete t[n]:t[n]=e[n];yield this.save(JSON.stringify(t))}}))}remove(e){return s(this,void 0,void 0,(function*(){if("string"==typeof e)yield this.set({[e]:void 0});else if(Array.isArray(e))for(const t of e)yield this.set({[t]:void 0})}))}clear(){return s(this,void 0,void 0,(function*(){yield this.save("{}")}))}}t.StorageArea=d},function(e,t){e.exports=require("events")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(5),o=n(6);t.hookWebContentsEvents=(e,t)=>{const n=t.id;s.sendToBackgroundPages(e,"api-emit-event-tabs-onCreated"),t.on("will-navigate",(o,i)=>{s.sendToBackgroundPages(e,"api-emit-event-webNavigation-onBeforeNavigate",{frameId:0,parentFrameId:-1,processId:t.getProcessId(),tabId:n,timeStamp:Date.now(),url:i})}),t.on("did-start-loading",()=>{s.sendToBackgroundPages(e,"api-emit-event-tabs-onUpdated",n,{status:"loading"},o.webContentsToTab(t))}),t.on("did-stop-loading",()=>{s.sendToBackgroundPages(e,"api-emit-event-tabs-onUpdated",n,{status:"complete"},o.webContentsToTab(t))}),t.on("did-start-navigation",(o,i,r)=>{r&&s.sendToBackgroundPages(e,"api-emit-event-webNavigation-onCommitted",{frameId:0,parentFrameId:-1,processId:t.getProcessId(),tabId:n,timeStamp:Date.now(),url:i})}),t.on("did-navigate",(o,i)=>{s.sendToBackgroundPages(e,"api-emit-event-webNavigation-onCompleted",{frameId:0,parentFrameId:-1,processId:t.getProcessId(),tabId:n,timeStamp:Date.now(),url:i})}),t.once("destroyed",()=>{s.sendToBackgroundPages(e,"api-emit-event-tabs-onRemoved",n)})}}]);
module.exports=function(e){var t={};function n(s){if(t[s])return t[s].exports;var o=t[s]={i:s,l:!1,exports:{}};return e[s].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,s){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(s,o,function(t){return e[t]}.bind(null,o));return s},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(e,t){e.exports=require("electron")},function(e,t){e.exports=require("path")},function(e,t){e.exports=require("fs")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.makeId=(e,t="abcdefghijklmnopqrstuvwxyz")=>{let n="";for(let s=0;s<e;s++)n+=t.charAt(Math.floor(Math.random()*t.length));return n},t.replaceAll=(e,t,n,s="gi")=>(t=t.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),e.replace(new RegExp(t,s),n)),t.hashCode=e=>{let t=0;if(0===e.length)return t;for(let n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return t}},function(e,t,n){"use strict";var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))((function(o,i){function r(e){try{c(s.next(e))}catch(e){i(e)}}function a(e){try{c(s.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),i=n(1),r=n(2),a=n(9),c=n(10),d=n(13),l=n(5),u=n(6),f=n(16);let p=1;const h=[];t.storages=new Map,o.ipcMain.on("get-session-id",e=>{let t=h.find(t=>t.session===e.sender.session);if(t)e.returnValue=t.id;else if(t=h.find(t=>{return!!Object.values(t.extensions).find(t=>t.backgroundPage.webContents.id===e.sender.id)}),t)return void(e.returnValue=t.id);e.returnValue=-1}),o.ipcMain.on("send-msg-webcontents",(e,t,n,...s)=>{o.webContents.fromId(t).send(n,...s)}),o.ipcMain.on("get-webcontents-id",e=>{e.returnValue=e.sender.id}),o.ipcMain.on("current-webcontents-to-tab",e=>{e.returnValue=u.webContentsToTab(e.sender)});t.ExtensibleSession=class{constructor(e,t={}){this.session=e,this.extensions={},this.id=p++,this.webContents=[],this._initialized=!1,this.options={contentPreloadPath:i.resolve(__dirname,"content-preload.js"),backgroundPreloadPath:i.resolve(__dirname,"background-preload.js")},a.registerProtocols(this),this.options=Object.assign(Object.assign({},this.options),t),h.push(this),o.app.on("web-contents-created",(e,t)=>{u.webContentsValid(t)&&f.hookWebContentsEvents(this,t)})}loadExtension(e){return s(this,void 0,void 0,(function*(){if(this._initialized||(this.session.setPreloads(this.session.getPreloads().concat([this.options.contentPreloadPath])),c.runWebRequestService(this),d.runMessagingService(this),this._initialized=!0),!(yield r.promises.stat(e)).isDirectory())throw new Error("Given path is not a directory");const t=i.resolve(e,"manifest.json");if(!r.existsSync(t))throw new Error("Given directory doesn't contain manifest.json file");const n=JSON.parse(yield r.promises.readFile(t,"utf8")),s=i.basename(e);if(this.extensions[s])return this.extensions[s];n.srcDirectory=e,n.extensionId=s;const o=yield l.loadExtension(n);return o.backgroundPage=yield l.startBackgroundPage(n,this.id,this.options.backgroundPreloadPath),this.extensions[s]=o,o}))}addWindow(e){this.webContents.push(e.webContents),e.isFocused()&&(this.lastActiveWebContents=e.webContents),e.on("focus",()=>{this.lastActiveWebContents=e.webContents}),o.ipcMain.on(`api-browserAction-onClicked-${e.webContents.id}`,(e,t,n)=>{const s=u.webContentsToTab(o.webContents.fromId(n));this.extensions[t].backgroundPage.webContents.send("api-emit-event-browserAction-onClicked",s)}),o.ipcMain.on(`get-extensions-${e.webContents.id}`,e=>{const t=Object.assign({},this.extensions);for(const e in t)t[e]=l.getIpcExtension(t[e]);e.returnValue=t})}}},function(e,t,n){"use strict";var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))((function(o,i){function r(e){try{c(s.next(e))}catch(e){i(e)}}function a(e){try{c(s.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),i=n(2),r=n(1),a=n(7),c=n(4),d=n(8),l=n(14);t.manifestToExtensionInfo=e=>({startPage:a.format({protocol:"electron-extension",slashes:!0,hostname:e.extensionId,pathname:e.devtools_page}),srcDirectory:e.srcDirectory,name:e.name,exposeExperimentalAPIs:!0}),t.getIpcExtension=e=>{const t=Object.assign({},e);return delete t.backgroundPage,t},t.startBackgroundPage=({background:e,srcDirectory:t,extensionId:n},c,d)=>s(void 0,void 0,void 0,(function*(){if(e){const{page:s,scripts:l}=e;let u,f=Buffer.from("");s?(u=s,f=yield i.promises.readFile(r.resolve(t,s))):l&&(u="generated.html",f=Buffer.from(`<html>\n <body>${l.map(e=>`<script src="${e}"><\/script>`).join("")}\n </body>\n </html>`,"utf8"));const p=o.webContents.create({partition:`persist:electron-extension-${c}`,preload:d,type:"backgroundPage",commandLineSwitches:["--background-page"],webPreferences:{nodeIntegration:!0,contextIsolation:!1,webSecurity:!1}});return p.loadURL(a.format({protocol:"electron-extension",slashes:!0,hostname:n,pathname:u})),{html:f,fileName:u,webContents:p}}return null})),t.sendToBackgroundPages=(e,t,...n)=>{for(const s in e.extensions){const{webContents:o}=e.extensions[s].backgroundPage;o.isDestroyed()||o.send(t,...n)}};const u=e=>s(void 0,void 0,void 0,(function*(){if("string"==typeof e.default_locale){const t=r.resolve(e.srcDirectory,"_locales",e.default_locale);if(!i.existsSync(t))return;const n=r.resolve(t,"messages.json"),s=yield i.promises.stat(n);if(!i.existsSync(n)||s.isDirectory())return;const o=yield i.promises.readFile(n,"utf8");return JSON.parse(o)}}));t.loadExtension=e=>s(void 0,void 0,void 0,(function*(){const t={manifest:e,alarms:[],locale:yield u(e),id:e.extensionId,path:e.srcDirectory};if(e.content_scripts){const n=t=>s(void 0,void 0,void 0,(function*(){return{url:`electron-extension://${e.extensionId}/${t}`,code:yield i.promises.readFile(r.join(e.srcDirectory,t),"utf8")}}));try{const o=yield Promise.all(e.content_scripts.map(e=>s(void 0,void 0,void 0,(function*(){return{matches:e.matches,js:e.js?yield Promise.all(e.js.map(n)):[],css:e.css?yield Promise.all(e.css.map(n)):[],runAt:e.run_at||"document_idle"}}))));t.contentScripts=o}catch(e){console.error("Failed to read content scripts",e)}}return c.storages.get(e.extensionId)||c.storages.set(e.extensionId,(e=>{const t=d.getPath("storage/extensions",e.extensionId);return{local:new l.StorageArea(r.resolve(t,"local")),sync:new l.StorageArea(r.resolve(t,"sync")),managed:new l.StorageArea(r.resolve(t,"managed"))}})(e)),t})),t.loadDevToolsExtensions=(e,n)=>{if(!e.devToolsWebContents)return;n.map(t.manifestToExtensionInfo).forEach(t=>{t.startPage&&e.devToolsWebContents._grantOriginAccess(t.startPage)})},t.extensionsToManifests=e=>Object.values(e).map(e=>e.manifest)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(0);t.webContentsToTab=e=>({id:e.id,index:e.id,windowId:e.hostWebContents?e.hostWebContents.id:e.id,highlighted:e.isFocused(),active:e.isFocused(),selected:e.isFocused(),pinned:!1,discarded:!1,autoDiscardable:!1,url:e.getURL(),title:e.getTitle(),incognito:!1,audible:e.isCurrentlyAudible()}),t.getAllWebContentsInSession=e=>s.webContents.getAllWebContents().filter(t=>t.session===e),t.webContentsValid=e=>{const t=e.getType();return"window"===t||"webview"===t||"browserView"===t}},function(e,t){e.exports=require("url")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(1),o=n(2),i=n(0);t.getPath=(...e)=>{let t;if(i.remote)t=i.remote.app.getPath("userData");else{if(!i.app)return null;t=i.app.getPath("userData")}return s.resolve(t,...e).replace(/\\/g,"/")},t.mkDirByPathSync=(e,{isRelativeToScript:t=!1}={})=>{const n=s.isAbsolute(e)?s.sep:"",i=t?__dirname:".";return e.split(s.sep).reduce((t,n)=>{const r=s.resolve(i,t,n);try{o.mkdirSync(r)}catch(n){if("EEXIST"===n.code)return r;if("ENOENT"===n.code)throw new Error(`EACCES: permission denied, mkdir '${t}'`);const s=["EACCES","EPERM","EISDIR"].indexOf(n.code)>-1;if(!s||s&&e===r)throw n}return r},n)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(0),o=n(2),i=n(1),r=n(7);s.protocol&&s.protocol.registerSchemesAsPrivileged([{scheme:"electron-extension",privileges:{bypassCSP:!0,secure:!0,standard:!0,supportFetchAPI:!0,allowServiceWorkers:!0,corsEnabled:!1}}]);const a=(e,t)=>{t.protocol.registerBufferProtocol("electron-extension",(t,n)=>{const s=r.parse(decodeURIComponent(t.url));if(!s.hostname||!s.pathname)return n();const a=e.extensions[s.hostname];if(!a)return n();const{backgroundPage:c,path:d}=a;return c&&s.pathname===`/${c.fileName}`?n({mimeType:"text/html",data:c.html}):(o.readFile(i.join(d,s.pathname),(e,t)=>n(e?-6:t)),null)},e=>{e&&console.error(`Failed to register extension protocol: ${e}`)})};t.registerProtocols=e=>{a(e,s.session.fromPartition(`persist:electron-extension-${e.id}`)),a(e,e.session)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(0),o=n(11),i=n(3),r={},a=e=>"mainFrame"===e?"main_frame":"subFrame"===e?"sub_frame":"cspReport"===e?"csp_report":e,c=e=>{const t=[];return Object.keys(e).forEach(n=>{e[n]&&t.push({name:n,value:e[n][0]})}),t},d=e=>{return e.forEach(t=>{e[t.name]=t.value}),{}};t.runWebRequestService=e=>{const{webRequest:t}=o.default(e.session);s.ipcMain.on("api-add-webRequest-listener",(e,n)=>{const{id:o,name:l,filters:u}=n;r[o]=(t,n)=>{let r=((e,t)=>{return Object.assign(Object.assign({},e),{requestId:e.id.toString(),frameId:0,parentFrameId:-1,type:a(e.resourceType),timeStamp:Date.now(),tabId:t?e.webContentsId:-1,error:""})})(t,!0);if("onBeforeSendHeaders"===l){const e=c(t.requestHeaders);r=Object.assign(Object.assign({},r),{requestHeaders:e})}else if("onHeadersReceived"===l){const e=c(t.responseHeaders);r=Object.assign(Object.assign({},r),{responseHeaders:e})}else if("onSendHeaders"===l){const e=c(t.requestHeaders);r=Object.assign(Object.assign({},r),{requestHeaders:e})}((e,t,n,o,r=null)=>{let a=!1;const c={cancel:!1,requestHeaders:t.requestHeaders,responseHeaders:t.responseHeaders},l=(e=>(function t(n){t.prototype.callbackCalled||(e(n),t.prototype.callbackCalled=!0)}))(r),u=i.makeId(32);s.ipcMain.once(`api-webRequest-response-${e}-${o}-${u}`,(n,s)=>{if(s){if(s.cancel)return l({cancel:!0});if(s.redirectURL)return l({cancel:!1,redirectURL:s.redirectUrl});if(s.requestHeaders&&("onBeforeSendHeaders"===e||"onSendHeaders"===e)){const e=d(s.requestHeaders);return l({cancel:!1,requestHeaders:e})}if(s.responseHeaders){const e=Object.assign(Object.assign({},t.responseHeaders),d(s.responseHeaders));return l({responseHeaders:e,cancel:!1})}}l(c)}),n.send(`api-webRequest-intercepted-${e}-${o}`,t,u),a=!0})(l,r,s.webContents.fromId(e.sender.id),o,n)},u?t[l](u,r[o]):t[l](r[o])}),s.ipcMain.on("api-remove-webRequest-listener",(e,t)=>{const{id:n}=t;r[n]&&delete r[n]})}},function(e,t,n){"use strict";var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))((function(o,i){function r(e){try{c(s.next(e))}catch(e){i(e)}}function a(e){try{c(s.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=n(3),i=n(12),r=e=>{return e.reverse().reduce((e,t)=>s(void 0,void 0,void 0,(function*(){if(e.cancel)return e;const n=yield t.apply();return Object.assign(Object.assign({},e),n)})),{cancel:!1})},a=["onBeforeRequest","onBeforeSendHeaders","onHeadersReceived"],c=["onBeforeRequest","onBeforeSendHeaders","onHeadersReceived","onSendHeaders","onResponseStarted","onBeforeRedirect","onCompleted","onErrorOccurred"];class d{constructor(e){this.orderIndex=0,this.webRequest=e,this.listeners=new Map,this.filters=new Map,this.resolvers=new Map}get nextIndex(){return this.orderIndex+=1}getListeners(){return this.listeners}getListenersFor(e){return this.listeners.get(e)}getFilters(){return this.filters}getFiltersFor(e){return this.filters.get(e)}hasCallback(e){return a.includes(e)}alias(e,t){const n=this.parseArguments(t);return this.identifyAction(e,n)}addListener(e,t,n,s={}){const{urls:i}=t,r=o.makeId(32),a={order:this.nextIndex},c={id:r,urls:i,action:n,context:Object.assign(Object.assign({},s),a)};this.listeners.has(e)||this.listeners.set(e,new Map),this.listeners.get(e).set(r,c),this.filters.has(e)||this.filters.set(e,new Set);const d=this.filters.get(e);for(const e of i)d.add(e);return this.webRequest[e]({urls:[...d]},this.listenerFactory(e)),c}removeListener(e,t){const n=this.listeners.get(e);if(n&&n.has(t))if(1===n.size)this.clearListeners(e);else{n.delete(t);const s=this.mergeFilters(n);this.filters.set(e,s),this.webRequest[e]([...s],this.listenerFactory(e))}}clearListeners(e){const t=this.listeners.get(e),n=this.filters.get(e);t&&t.clear(),n&&n.clear(),this.webRequest[e](null)}setResolver(e,t){this.hasCallback(e)?this.resolvers.set(e,t):console.warn(`Event method "${e}" has no callback and does not use a resolver`)}matchListeners(e,t){return Array.from(t.values()).filter(t=>t.urls.some(t=>i.matchesPattern(t,e)))}listenerFactory(e){return(t,n)=>s(this,void 0,void 0,(function*(){if(!this.listeners.has(e))return void this.webRequest[e](null);const s=this.listeners.get(e);if(!s)return void(n&&n({cancel:!1}));const o=this.matchListeners(t.url,s);if(0===o.length)return void(n&&n({cancel:!1}));let i=this.resolvers.get(e);i||(i=r);const a=this.processRequests(t,o);if(this.hasCallback(e)&&n){const e=yield i(a);n(e)}else a.map(e=>e.apply())}))}processRequests(e,t){const n=[];for(const s of t){const t=this.makeApplier(e,s.action);n.push({apply:t,context:s.context})}return n}makeApplier(e,t){return()=>new Promise((n,s)=>{try{t(e,n)}catch(e){s(e)}})}mergeFilters(e){return Array.from(e.values()).reduce((e,t)=>{for(const n of t.urls)e.add(n);return e},new Set)}parseArguments(e){const t={unbind:!1,filter:{urls:["<all_urls>"]},action:null,context:{}};switch(e.length){case 0:t.unbind=!0;break;case 1:if("function"==typeof e[0]){t.action=e[0];break}throw new Error("Wrong function signature : No function listener given");case 2:if("object"==typeof e[0]&&"function"==typeof e[1]){t.filter=e[0],t.action=e[1];break}if("function"==typeof e[0]){t.action=e[0],t.context=e[1];break}throw new Error("Wrong function signature : argument 1 should be an object filters or the function listener");case 3:if("object"==typeof e[0]&&"function"==typeof e[1]){t.filter=e[0],t.action=e[1],t.context=e[2];break}throw new Error("Wrong function signature : should be arg 1 -> filter object, arg 2 -> function listener, arg 3 -> context");default:throw new Error("Wrong function signature : Too many arguments")}return t}identifyAction(e,t){const{unbind:n,filter:s,action:o,context:i}=t;if(n)return this.clearListeners(e);if(!o)throw new Error(`Cannot bind with ${e} : a listener is missing.`);return this.addListener(e,s,o,i)}}t.BetterWebRequest=d;const l={get:(e,t)=>c.includes(t)?(...n)=>{e.alias(t,n)}:e[t]},u=e=>new Proxy(new d(e.webRequest),l),f=new Set;t.default=e=>f.has(e)?e:(Object.defineProperty(e,"webRequest",{value:u(e),writable:!1}),f.add(e),e)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isURL=e=>{const t=/^(?:\w+:)?\/\/([^\s.]+\.\S{2}|localhost[:?\d]*)\S*$/;return!!t.test(e)||t.test(`http://${e}`)},t.matchesPattern=(e,t)=>{if("<all_urls>"===e)return!0;const n=new RegExp(`^${e.replace(/\*/g,".*").replace("/","\\/")}$`);return null!=t.match(n)}},function(e,t,n){"use strict";var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))((function(o,i){function r(e){try{c(s.next(e))}catch(e){i(e)}}function a(e){try{c(s.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),i=n(5),r=n(4),a=n(6),c=n(3),d=n(2),l=n(1);t.runMessagingService=e=>{o.ipcMain.on(`get-extension-${e.id}`,(t,n)=>{t.returnValue=i.getIpcExtension(e.extensions[n])}),o.ipcMain.on(`get-extensions-${e.id}`,t=>{const n=Object.assign({},e.extensions);for(const e in n)n[e]=i.getIpcExtension(n[e]),delete n[e].manifest.contentScripts;t.returnValue=n}),o.ipcMain.on(`get-extensions-content-${e.id}`,t=>{const n=Object.assign({},e.extensions);for(const e in n)n[e]=i.getIpcExtension(n[e]);t.returnValue=n}),o.ipcMain.on(`api-tabs-query-${e.id}`,t=>{const n=a.getAllWebContentsInSession(e.session).map(e=>a.webContentsToTab(e));t.sender.send("api-tabs-query",n)}),o.ipcMain.on(`api-tabs-create-${e.id}`,(t,n,s,i)=>{const r=c.makeId(32),d=t.sender.getType();if(s.windowId){e.webContents.find(e=>e.id===s.windowId).send("api-tabs-create",r,s)}else if("backgroundPage"===d)e.lastActiveWebContents.send("api-tabs-create",r,s);else if("browserView"===d){const e=o.BrowserWindow.fromId(i);e&&e.webContents.send("api-tabs-create",r,s)}else"webview"===d&&t.sender.hostWebContents.send("api-tabs-create",r,s);o.ipcMain.once(`api-tabs-create-${r}`,(e,s)=>{t.sender.send(`api-tabs-create-${n}`,a.webContentsToTab(o.webContents.fromId(s)))})}),o.ipcMain.handle(`api-tabs-insertCSS-${e.id}`,(e,t,n,i)=>s(void 0,void 0,void 0,(function*(){const e=o.webContents.fromId(t);e&&(n.hasOwnProperty("file")&&(n.code=yield d.promises.readFile(l.join(i,n.file),"utf8")),e.insertCSS(n.code))}))),o.ipcMain.handle(`api-tabs-executeScript-${e.id}`,(e,t)=>s(void 0,void 0,void 0,(function*(){const{tabId:e,details:n,basePath:s}=t,i=o.webContents.fromId(e);if(i)return n.hasOwnProperty("file")&&(n.code=yield d.promises.readFile(l.join(s,n.file),"utf8")),yield i.executeJavaScript(n.code)}))),o.ipcMain.on(`api-runtime-reload-${e.id}`,(t,n)=>{const{backgroundPage:s}=e.extensions[n];if(s){o.webContents.fromId(t.sender.id).reload()}}),o.ipcMain.on(`api-runtime-connect-${e.id}`,(t,{extensionId:n,portId:o,sender:i,name:r})=>s(void 0,void 0,void 0,(function*(){const{backgroundPage:s}=e.extensions[n],{webContents:a}=s;t.sender.id!==a.id&&a.send("api-runtime-connect",{portId:o,sender:i,name:r})}))),o.ipcMain.on(`api-runtime-sendMessage-${e.id}`,(t,n)=>s(void 0,void 0,void 0,(function*(){const{extensionId:s}=n,{backgroundPage:o}=e.extensions[s],{webContents:i}=o;t.sender.id!==i.id&&i.send("api-runtime-sendMessage",n,t.sender.id)}))),o.ipcMain.on(`api-tabs-sendMessage-${e.id}`,(t,n)=>s(void 0,void 0,void 0,(function*(){const{tabId:s}=n,o=a.getAllWebContentsInSession(e.session);for(const e of o)e.id===s&&e.send("api-tabs-sendMessage",n,t.sender.id)}))),o.ipcMain.on(`api-port-postMessage-${e.id}`,(t,{portId:n,msg:s,tab:i})=>{if(a.webContentsValid(t.sender))Object.keys(e.extensions).forEach(o=>{const{backgroundPage:r}=e.extensions[o],a=r.webContents;t.sender.id!==a.id&&a.send(`api-port-postMessage-${n}`,s,i)});else{let r=a.getAllWebContentsInSession(e.session);for(const e of r)e.id!==t.sender.id&&e.send(`api-port-postMessage-${n}`,s,i);r=a.getAllWebContentsInSession(o.session.fromPartition(`persist:electron-extension-${e.id}`));for(const e of r)e.id!==t.sender.id&&a.webContentsValid(e)&&e.send(`api-port-postMessage-${n}`,s,i)}}),o.ipcMain.on(`api-storage-operation-${e.id}`,(e,{extensionId:t,id:n,area:i,type:a,arg:c})=>s(void 0,void 0,void 0,(function*(){const s=r.storages.get(t),d=o.webContents.fromId(e.sender.id),l=`api-storage-operation-${n}`;if("get"===a){const e=yield s[i].get(c);for(const t in e)Buffer.isBuffer(e[t])&&(e[t]=JSON.parse(e[t].toString()));d.send(l,e)}else"set"===a?(yield s[i].set(c),d.send(l)):"clear"===a?(yield s[i].clear(),d.send(l)):"remove"===a&&(yield s[i].remove(c),d.send(l))}))),o.ipcMain.on(`api-alarms-operation-${e.id}`,(t,n)=>{const{extensionId:s,type:i}=n,r=o.webContents.fromId(t.sender.id);if("create"===i){const o=e.extensions[s],{alarms:i}=o,{name:a,alarmInfo:c}=n,d=-1!==i.findIndex(e=>e.name===a);if(t.returnValue=null,d)return;let l=0;if(null!=c.when&&(l=c.when),null!=c.delayInMinutes){if(c.delayInMinutes<1)return console.error(`Alarm delay is less than minimum of 1 minutes. In released .crx, alarm "${a}" will fire in approximately 1 minutes.`);l=Date.now()+6e4*c.delayInMinutes}const u={periodInMinutes:c.periodInMinutes,scheduledTime:l,name:a};i.push(u),u.periodInMinutes||setTimeout(()=>{r.send("api-emit-event-alarms-onAlarm",u)},u.scheduledTime-Date.now())}}),o.ipcMain.on(`api-browserAction-setBadgeText-${e.id}`,(t,n,s,i)=>{const r=c.makeId(32);for(const t of e.webContents)t.send("api-browserAction-setBadgeText",r,s,i);o.ipcMain.on(`api-browserAction-setBadgeText-${r}`,()=>{t.sender.send(`api-browserAction-setBadgeText-${n}`)})}),o.ipcMain.on(`send-to-all-extensions-${e.id}`,(t,n,...s)=>{i.sendToBackgroundPages(e,n,...s);const o=a.getAllWebContentsInSession(e.session);for(const e of o)e.send(n,...s)})}},function(e,t,n){"use strict";var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))((function(o,i){function r(e){try{c(s.next(e))}catch(e){i(e)}}function a(e){try{c(s.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=n(8),i=n(3),r=n(15),a=n(2),c=n(1);class d extends r.EventEmitter{constructor(e){super(),this.queue=[],this.path=c.resolve(e,"storage.db"),o.mkDirByPathSync(e),a.existsSync(e)||this.clear()}_save(e){return s(this,void 0,void 0,(function*(){try{if(yield a.promises.writeFile(this.path,e),this.queue.length>=3)for(let e=this.queue.length-1;e>0;e--)this.removeAllListeners(this.queue[e]),this.queue.splice(e,1);else this.queue.splice(0,1);this.queue[0]&&this.emit(this.queue[0])}catch(e){console.error(e)}}))}save(e){return s(this,void 0,void 0,(function*(){const t=i.makeId(32);this.queue.push(t),1===this.queue.length?this._save(e):this.once(t,()=>{this._save(e)})}))}get(e){return s(this,void 0,void 0,(function*(){try{if(null==e){const e={},t=JSON.parse(yield a.promises.readFile(this.path,"utf8"));for(const n in t)e[n]=t[n];return e}if(Array.isArray(e)){const t={},n=JSON.parse(yield a.promises.readFile(this.path,"utf8"));for(const s in n)for(const o of e)s===o&&(t[s]=n[s]);return t}if("object"==typeof e){const t=Object.assign({},e),n=JSON.parse(yield a.promises.readFile(this.path,"utf8"));for(const s in n)for(const o in e)o===s&&void 0!==n[s]&&(t[s]=n[s]);return t}if("string"==typeof e){const t=JSON.parse(yield a.promises.readFile(this.path,"utf8"));for(const n in t)if(n===e)return{[e]:t[n]};return{}}return{}}catch(e){return{}}}))}set(e){return s(this,void 0,void 0,(function*(){if(e===Object(e)){const t=this.get(null);for(const n in e)void 0===e[n]?delete t[n]:t[n]=e[n];yield this.save(JSON.stringify(t))}}))}remove(e){return s(this,void 0,void 0,(function*(){if("string"==typeof e)yield this.set({[e]:void 0});else if(Array.isArray(e))for(const t of e)yield this.set({[t]:void 0})}))}clear(){return s(this,void 0,void 0,(function*(){yield this.save("{}")}))}}t.StorageArea=d},function(e,t){e.exports=require("events")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(5),o=n(6);t.hookWebContentsEvents=(e,t)=>{const n=t.id;s.sendToBackgroundPages(e,"api-emit-event-tabs-onCreated"),t.on("will-navigate",(o,i)=>{s.sendToBackgroundPages(e,"api-emit-event-webNavigation-onBeforeNavigate",{frameId:0,parentFrameId:-1,processId:t.getProcessId(),tabId:n,timeStamp:Date.now(),url:i})}),t.on("did-start-loading",()=>{s.sendToBackgroundPages(e,"api-emit-event-tabs-onUpdated",n,{status:"loading"},o.webContentsToTab(t))}),t.on("did-stop-loading",()=>{s.sendToBackgroundPages(e,"api-emit-event-tabs-onUpdated",n,{status:"complete"},o.webContentsToTab(t))}),t.on("did-start-navigation",(o,i,r)=>{r&&s.sendToBackgroundPages(e,"api-emit-event-webNavigation-onCommitted",{frameId:0,parentFrameId:-1,processId:t.getProcessId(),tabId:n,timeStamp:Date.now(),url:i})}),t.on("did-navigate",(o,i)=>{s.sendToBackgroundPages(e,"api-emit-event-webNavigation-onCompleted",{frameId:0,parentFrameId:-1,processId:t.getProcessId(),tabId:n,timeStamp:Date.now(),url:i})}),t.once("destroyed",()=>{s.sendToBackgroundPages(e,"api-emit-event-tabs-onRemoved",n)})}}]);
//# sourceMappingURL=main.js.map
{
"name": "electron-extensions",
"version": "5.0.2",
"version": "5.1.0",
"description": "Implementation of Chrome extension APIs for Electron",

@@ -41,10 +41,10 @@ "keywords": [

"@types/chrome": "0.0.91",
"@types/node": "12.12.9",
"@typescript-eslint/eslint-plugin": "^2.8.0",
"@typescript-eslint/parser": "^2.8.0",
"@types/node": "13.1.1",
"@typescript-eslint/eslint-plugin": "^2.13.0",
"@typescript-eslint/parser": "^2.13.0",
"cross-env": "^6.0.3",
"electron": "^7.1.1",
"eslint": "^6.6.0",
"eslint-config-prettier": "^6.7.0",
"eslint-plugin-prettier": "^3.1.1",
"electron": "^7.1.7",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.9.0",
"eslint-plugin-prettier": "^3.1.2",
"ncp": "^2.0.0",

@@ -54,4 +54,4 @@ "prettier": "1.19.1",

"ts-loader": "^6.2.1",
"typescript": "3.7.2",
"webpack": "^4.41.2",
"typescript": "3.7.4",
"webpack": "^4.41.4",
"webpack-cli": "^3.3.10",

@@ -61,2 +61,2 @@ "webpack-merge": "^4.2.2"

"dependencies": {}
}
}

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