(async function(){console.log("[HotTags] 模块脚本启动 (JS 重构版)...");const container=document.getElementById("hot_tags_container");if(!container){console.error("[HotTags] 找不到 ID 为 hot_tags_container 的容器");return}container.innerHTML='<div style="padding:20px; text-align:center; color:#ccc;">正在加载热门标签...</div>';try{if(!window.NetworkClient){throw new Error("NetworkClient 未加载，请检查 index.html 中的脚本引入顺序")}const config=window.pluginConfig||{};const endpoint=config.hot_tags_endpoint||"/client/v1/tags/hot";console.log(`[HotTags] 正在请求接口: ${endpoint}`);const responseData=await window.NetworkClient.getEndpoint(endpoint,{},{showProgress:false,ignoreErrors:false});let hotTags=[];if(responseData.hotTags&&Array.isArray(responseData.hotTags)){hotTags=responseData.hotTags}else if(responseData.data&&responseData.data.hotTags){hotTags=responseData.data.hotTags}else if(responseData.list&&Array.isArray(responseData.list)){hotTags=responseData.list}console.log(`[HotTags] 成功获取 ${hotTags.length} 个标签`);if(hotTags.length===0){container.innerHTML='<div style="padding:20px; text-align:center; color:#999;">暂无热门标签</div>';return}let tagsHtml=`<h2><i class="icon-tag"></i> 热门标签</h2>`;tagsHtml+='<div class="tags-container">';hotTags.forEach(tag=>{const safeTag=tag.replace(/'/g,"\\'");tagsHtml+=`<span class="tag-item" onclick="handleTagClick('${safeTag}')">${tag}</span>`});tagsHtml+="</div>";container.innerHTML=tagsHtml;container.style.display="block";if(container.parentElement){console.log(container.parentElement.id);container.parentElement.style.height="auto";container.parentElement.style.display="block"}console.log(`[HotTags] 渲染完成`)}catch(error){console.error("[HotTags] 加载失败:",error);const errorMsg=typeof decodeUnicodeString==="function"?decodeUnicodeString(error.message):error.message;showErrorInContent("加载热门标签失败："+errorMsg,[{text:"重试",callback:async()=>{container.innerHTML='<div style="padding:20px; text-align:center; color:#ccc;">重试中...</div>';if(typeof showContent==="function"){showContent("hot_tags_container")}else{location.reload()}}}])}finally{hideLoading()}})();