"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e=(e=>(e.ONE_HOUR_AGO="oneHourAgo",e.ONE_DAY_AGO="oneDayAgo",e.ONE_WEEK_AGO="oneWeekAgo",e.ONE_MONTH_AGO="oneMonthAgo",e.TIME_UNLIMITED="TimeUnlimited",e))(e||{});const r="undefined"==typeof browser,t=r?chrome.runtime.getManifest():browser.runtime.getManifest(),o=r?chrome.runtime.id:browser.runtime.id;function n(e){return r?chrome.runtime.getURL(e):browser.runtime.getURL(e)}function s(e={}){return new Promise(((r,t)=>{chrome.tabs.query(e,(e=>{r(e)}))}))}function i(e){return new Promise(((r,t)=>{chrome.tabs.update(e,{active:!0},(()=>{r(!0)}))}))}function a(e){return new Promise(((r,t)=>{chrome.tabs.create(e,(e=>{r(e)}))}))}exports.clearAlarm=function(e){return new Promise(((r,t)=>{chrome.alarms.clear(e,(e=>{r(!!e)}))}))},exports.clearAllAlarm=function(){return new Promise(((e,r)=>{chrome.alarms.clearAll((r=>{e(!!r)}))}))},exports.createNewAlarm=function(e,r={delayInMinutes:.5,periodInMinutes:.5}){return new Promise(((t,o)=>{let n=!1;chrome.alarms.getAll((o=>{for(let r=0,t=o.length;r{t(!0)}))}))}))},exports.createNewTab=a,exports.download=function(e){return new Promise(((r,t)=>{chrome.downloads.download(e,(e=>{r(e)}))}))},exports.extensionId=o,exports.getBiosBrand=function(){},exports.getBiosSN=function(){},exports.getBiosVersion=function(){},exports.getComputerName=function(){},exports.getCpuID=function(){},exports.getCurrentActiveTabInfo=function(){return new Promise(((e,r)=>{chrome.tabs.query({active:!0},(r=>{const t=r.length>0?r[0]:{};e(t)}))}))},exports.getDeviceBrand=function(){},exports.getDeviceMac=function(){},exports.getDiskSN=function(){},exports.getExtensionFileUrl=n,exports.getI18nText=function(e){return""!==e?r?chrome.i18n.getMessage(e):browser.i18n.getMessage(e):""},exports.getLocalIP=function(){},exports.getMainboardModel=function(){},exports.getNetIP=function(){},exports.getOsDate=function(){},exports.getOsLanguage=function(){},exports.getOsName=function(){},exports.getOsVersion=function(){},exports.manifestInfo=t,exports.onAlarm=function(e=()=>{}){chrome.alarms.onAlarm.addListener((r=>{e(r)}))},exports.onBeforeRequest=function(e=()=>{}){r?chrome.webRequest.onBeforeRequest.addListener((r=>e(r)),{urls:[""]},["blocking"]):browser.webRequest.onBeforeRequest.addListener((r=>e(r)),{urls:[""]},["blocking"])},exports.onBrowserStartup=function(){return new Promise(((e,t)=>{r?chrome.runtime.onStartup.addListener((()=>{e(!0)})):browser.runtime.onStartup.addListener((()=>{e(!0)}))}))},exports.onChangeStorage=function(e=()=>{}){chrome.storage.onChanged.addListener(((r,t)=>{e(r,t)}))},exports.onMessage=function(e=()=>{}){r?chrome.runtime.onMessage.addListener(((r,t,o)=>(e(r,t,o),!0))):browser.runtime.onMessage.addListener(((r,t,o)=>(e(r,t,o),!0)))},exports.onSelfInstalled=function(){return new Promise(((e,t)=>{r?chrome.runtime.onInstalled.addListener((()=>{e(!0)})):browser.runtime.onInstalled.addListener((()=>{e(!0)}))}))},exports.onSelfUninstalledOpenUrl=function(e){return r?new Promise(((r,t)=>{chrome.runtime.setUninstallURL(e,(()=>{r(!0)}))})):browser.runtime.setUninstallURL(e)},exports.openSelfPage=function(e){return new Promise(((r,t)=>{let o=!1;const c=n(e);let u=-1;s().then((t=>{for(let e=0;e-1?i(u).then((()=>{r(!0)})):(a({active:!0,url:e}),r(!0))}))}))},exports.openSettingPage=function(){return new Promise(((e,t)=>{r?chrome.runtime.openOptionsPage((()=>{e(!0)})):(browser.runtime.openOptionsPage(),e(!0))}))},exports.queryAllTabs=s,exports.removeBrowserData=function(t,o={}){const n=Date.now(),s=JSON.parse(JSON.stringify(o));let i=0;switch(t){case e.ONE_HOUR_AGO:i=36e5;break;case e.ONE_DAY_AGO:i=864e5;break;case e.ONE_WEEK_AGO:i=6048e5;break;case e.ONE_MONTH_AGO:i=2592e6;break;case e.TIME_UNLIMITED:i=n;break;default:i=864e5}const a=n-i;return r?new Promise(((e,r)=>{chrome.browsingData.remove({since:a},s,(()=>{e(!0)}))})):(delete s.appcache,delete s.cacheStorage,delete s.fileSystems,delete s.webSQL,browser.browsingData.remove({since:a},s))},exports.sendMessageToBackgroundOrPopup=function(e={}){return new Promise(((t,o)=>{if(!r)return browser.runtime.sendMessage(e);chrome.runtime.sendMessage(e,(e=>{t(e)}))}))},exports.setIconBadgeBackgroundColor=function(e){return new Promise(((t,o)=>{r?chrome.action.setBadgeBackgroundColor({color:e},(()=>{t(!0)})):(browser.browserAction.setBadgeBackgroundColor({color:e}),t(!0))}))},exports.setIconBadgeText=function(e){return new Promise(((t,o)=>{r?chrome.action.setBadgeText({text:e},(()=>{t(!0)})):(browser.browserAction.setBadgeText({text:e}),t(!0))}))},exports.setIconBadgeTextColor=function(e){return new Promise(((t,o)=>{r?chrome.action.setBadgeTextColor({color:e},(()=>{t(!0)})):(browser.browserAction.setBadgeTextColor({color:e}),t(!0))}))},exports.setIconTitle=function(e){return new Promise(((t,o)=>{r?chrome.action.setTitle({title:e},(()=>{t(!0)})):(browser.browserAction.setTitle({title:e}),t(!0))}))},exports.setPageTitle=function(e){document.title=e},exports.setTabActiveById=i,exports.storageClearAllData=function(){return r?new Promise(((e,r)=>{chrome.storage.local.clear((()=>{e(!0)}))})):browser.storage.local.clear()},exports.storageGet=function(e){return r?new Promise(((r,t)=>{chrome.storage.local.get(e,(e=>{r(e)}))})):browser.storage.local.get(e)},exports.storageRemoveKey=function(e){return r?new Promise(((r,t)=>{chrome.storage.local.remove(e,(()=>{r(!0)}))})):browser.storage.local.remove(e)},exports.storageSet=function(e){return r?new Promise(((r,t)=>{chrome.storage.local.set(e,(()=>{r(!0)}))})):browser.storage.local.set(e)};