const o=document.getElementById("license-gate"),i=document.getElementById("newtab-content"),n=document.getElementById("license-gate-title"),s=document.getElementById("license-gate-message"),t=document.getElementById("license-retry"),d=document.getElementById("license-upgrade");async function c(a=!1){t.hidden=!0,d.hidden=!0,n.textContent="正在验证使用授权",s.textContent="正在连接理悟万池服务…";try{const e=await chrome.runtime.sendMessage({type:"extension-license-status",force:a});if(e?.status==="active"){o.hidden=!0,i.hidden=!1;return}n.textContent=e?.status==="payment_required"?"需要续费后继续使用":"暂时无法验证授权",s.textContent=e?.message||"请检查网络连接后重试。",t.hidden=!1,d.hidden=e?.status!=="payment_required"}catch(e){n.textContent="暂时无法验证授权",s.textContent=e instanceof Error?e.message:"请检查网络连接后重试。",t.hidden=!1}}t.addEventListener("click",()=>void c(!0));c();
