(()=>{"use strict";const e="https://group-speed-dial.fastaddons.com";browser.runtime.getManifest(),self.location.pathname;const t=e=>browser.runtime.sendMessage(e),s="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?Promise.resolve():new Promise((e=>"complete"===document.readyState||"interactive"===document.readyState?e():document.addEventListener("DOMContentLoaded",(()=>e())))),o=new Promise((e=>document&&"complete"===document.readyState?e():window.addEventListener("load",(()=>e()))));new Promise((e=>window.addEventListener("load",e))),(async()=>{if(!await t({type:"cs_is_default_container"}))return await o,void self.setTimeout((()=>window.postMessage({type:"gsd_ext_not_in_default_container"},e)),500);window.addEventListener("message",(async s=>{if(s.source===window&&s.origin===e&&s.data.type.startsWith("gsd_"))switch(s.data.type){case"gsd_return_home":t({type:"cs_return_home"});break;case"gsd_update_token":t({type:"cs_web_token_update",token:s.data.token});break;case"gsd_get_token":const o=await t({type:"cs_get_token"});o&&window.postMessage({type:"gsd_token",token:o},e);break;case"gsd_shared_groups":const a=s.data.groups;Array.isArray(a)&&a.length&&await t({type:"cs_shared_groups_import",groups:a}).catch(console.error)}}),!1);const a=()=>window.postMessage({type:"gsd_ext_ready"},e);await s,a(),await o,a(),self.setTimeout(a,1e3)})()})();