const u={error:console.error,info:()=>{},table:()=>{}},c=u,a={createNewTab(e="index.html"){return new Promise(t=>{chrome.tabs.create({active:!0,url:e},r=>{const s=(o,i,n)=>{r.id&&o===r.id&&i.status==="complete"&&n.status==="complete"&&(chrome.tabs.onUpdated.removeListener(s),t(n))};chrome.tabs.onUpdated.addListener(s)})})},async executeScript(e,t){const r=await chrome.scripting.executeScript({func:t,target:{tabId:e}});if(chrome.runtime.lastError)throw new Error(chrome.runtime.lastError.message);if(!r||r.length===0)throw new Error("Script execution returned no result.");return r[0].result},async getActiveTab(){return(await chrome.tabs.query({active:!0,currentWindow:!0}))[0]},isExtensionTab(e){return e&&e.url&&(e.url.startsWith("chrome-extension://")||e.url.startsWith("moz-extension://"))},get isFirefox(){return navigator.userAgent.includes("Firefox")},isNewTabPage(e){return e&&e.url&&(e.url.startsWith("chrome://newtab")||e.url.startsWith("about:newtab"))}};export{a as e,c as l};
