import{d as b,r as u,aI as C,E as M,A as S,ai as f,aq as B,P as l,u as s,o as O,M as R,O as z,a as c,U as D,V as h}from"./vue.1RczIYhx.js";import{i as k}from"./echarts.DoXO02ct.js";import{j as F}from"./api.CeyMUdte.js";const N={class:"w-full",style:{"min-height":"400px"}},V={style:{"min-height":"400px"}},A=b({__name:"NegativeLabelChart",props:{asin:String},setup(p){const m=p,{asin:_}=m,a=u(!1);let o=null;const i=C("chartRef");let e=null,t=null;const r=u(!0);M(()=>{g()}),S(()=>{t&&t.disconnect(),e&&(e.dispose(),e=null)});async function g(){a.value=!0;const n={asin:_,agg_field:"raw_label"};try{if(o=await F(n),!o.data||o.data.length===0){r.value=!1,e&&e.clear();return}r.value=!0,v()}catch(d){console.error("==Error==",d)}finally{a.value=!1}}function v(){const n={title:{text:"负面标签"},tooltip:{show:!0},series:[{type:"wordCloud",width:"95%",height:"85%",shape:"star",sizeRange:[12,30],rotationRange:[0,0],rotationStep:45,gridSize:8,drawOutOfBound:!1,shrinkToFit:!1,layoutAnimation:!0,textStyle:{fontFamily:"PingFang",fontWeight:"bold",color:function(){return"rgb("+[Math.round(Math.random()*160),Math.round(Math.random()*160),Math.round(Math.random()*160)].join(",")+")"}},emphasis:{focus:"self",textStyle:{textShadowBlur:10,textShadowColor:"#333"}},data:o.data}],backgroundColor:"#fff"};e||(e=k(i.value)),e.setOption(n),t||(t=new ResizeObserver(()=>{e==null||e.resize()}),t.observe(i.value))}return(n,d)=>{const w=f("el-empty"),y=f("el-card"),x=B("loading");return l((O(),R(y,{class:"border-none",shadow:"hover"},{default:z(()=>[c("div",N,[l(c("div",V,[D(w,{"image-size":200})],512),[[h,!s(a)&&!s(r)]]),l(c("div",{ref_key:"chartRef",ref:i,style:{width:"100%",height:"400px"}},null,512),[[h,s(r)]])])]),_:1})),[[x,s(a)]])}}});export{A as _};
