import{i as e}from"./chunk-B3pr0VN8.js";import"./src-DeO5iVgv.js";import{n as t,t as n}from"./jsx-runtime-wTfS3W87.js";import{t as r}from"./client-DDZ1qWKB.js";import{t as i}from"./runtimeTheme-D84RXo8q.js";import{t as a}from"./ExtensionCrashBoundary-AOGiVqC0.js";import{t as o}from"./SideComparePanel-Tz6TArUz.js";var s=e(t(),1),c=e(r(),1),l=n();function u(){return s.useEffect(()=>{i(`light`);let e=globalThis?.chrome?.runtime,t=globalThis?.chrome?.tabs;if(!e?.connect)return;let n=()=>{try{return String(e?.lastError?.message||``).trim()}catch{return``}},r=!1,a=null;try{a=e.connect({name:`SIDE_PANEL_STATE`}),n()}catch{n();return}if(!a)return;let o=()=>{r=!0,n()};try{a.onDisconnect?.addListener?.(o)}catch{}let s=()=>{try{t?.query?.({active:!0,currentWindow:!0},e=>{if(n()||r)return;let t=Number(e?.[0]?.id||0);if(t>0)try{a.postMessage({type:`SIDE_PANEL_ACTIVE`,tabId:t}),n()}catch{n()}})}catch{n()}};s();let c=()=>s();try{t?.onActivated?.addListener?.(c)}catch{}try{t?.onUpdated?.addListener?.(c)}catch{}return()=>{r=!0;try{t?.onActivated?.removeListener?.(c)}catch{}try{t?.onUpdated?.removeListener?.(c)}catch{}try{a.onDisconnect?.removeListener?.(o)}catch{}try{a.disconnect()}catch{}n()}},[]),(0,l.jsx)(o,{})}c.createRoot(document.getElementById(`root`)).render((0,l.jsx)(s.StrictMode,{children:(0,l.jsx)(a,{surface:`sidepanel`,children:(0,l.jsx)(u,{})})}));