import{i as W,t as F}from"./echarts.Bm4fHez2.js";import{a as G,ai as Z,s as y,i as T,ag as q,f as d,g as V,w as A,l as H,q as J,Z as Q,t as X,y as ee,u as te}from"./vue.D1BjjNmv.js";const ne=["getWidth","getHeight","getDom","getOption","resize","dispatchAction","convertToPixel","convertFromPixel","containPixel","getDataURL","getConnectedDataURL","appendData","clear","isDisposed","dispose"];function se(e){function o(t){return(...a)=>{if(!e.value)throw new Error("ECharts is not initialized yet.");return e.value[t].apply(e.value,a)}}function n(){const t=Object.create(null);return ne.forEach(a=>{t[a]=o(a)}),t}return n()}function ie(e,o,n){A([n,e,o],([t,a,l],D,C)=>{let c=null;if(t&&a&&l){const{offsetWidth:I,offsetHeight:P}=t,x=l===!0?{}:l,{throttle:m=100,onResize:f}=x;let p=!1;const h=()=>{a.resize(),f==null||f()},z=m?F(h,m):h;c=new ResizeObserver(()=>{!p&&(p=!0,t.offsetWidth===I&&t.offsetHeight===P)||z()}),c.observe(t)}C(()=>{c&&(c.disconnect(),c=null)})})}const oe={autoresize:[Boolean,Object]},ae=/^on[^a-z]/,S=e=>ae.test(e);function le(e){const o={};for(const n in e)S(n)||(o[n]=e[n]);return o}function L(e,o){const n=ee(e)?te(e):e;return n&&typeof n=="object"&&"value"in n?n.value||o:n||o}const ce="ecLoadingOptions";function re(e,o,n){const t=T(ce,{}),a=d(()=>({...L(t,{}),...n==null?void 0:n.value}));H(()=>{const l=e.value;l&&(o.value?l.showLoading(a.value):l.hideLoading())})}const ue={loading:Boolean,loadingOptions:Object};let O=null;const $="x-vue-echarts";function fe(){if(O!=null)return O;if(typeof HTMLElement>"u"||typeof customElements>"u")return O=!1;try{new Function("tag","class EChartsElement extends HTMLElement{__dispose=null;disconnectedCallback(){this.__dispose&&(this.__dispose(),this.__dispose=null)}}customElements.get(tag)==null&&customElements.define(tag,EChartsElement);")($)}catch{return O=!1}return O=!0}document.head.appendChild(document.createElement("style")).textContent=`x-vue-echarts{display:block;width:100%;height:100%;min-width:0}
`;const de=fe(),pe="ecTheme",he="ecInitOptions",ge="ecUpdateOptions",R=/(^&?~?!?)native:/;var me=G({name:"echarts",props:{option:Object,theme:{type:[Object,String]},initOptions:Object,updateOptions:Object,group:String,manualUpdate:Boolean,...oe,...ue},emits:{},inheritAttrs:!1,setup(e,{attrs:o}){const n=y(),t=y(),a=y(),l=T(pe,null),D=T(he,null),C=T(ge,null),{autoresize:c,manualUpdate:I,loading:P,loadingOptions:x}=q(e),m=d(()=>a.value||e.option||null),f=d(()=>e.theme||L(l,{})),p=d(()=>e.initOptions||L(D,{})),h=d(()=>e.updateOptions||L(C,{})),z=d(()=>le(o)),j={},E=V().proxy.$listeners,_={};E?Object.keys(E).forEach(i=>{R.test(i)?j[i.replace(R,"$1")]=E[i]:_[i]=E[i]}):Object.keys(o).filter(i=>S(i)).forEach(i=>{let s=i.charAt(2).toLowerCase()+i.slice(3);if(s.indexOf("native:")===0){const g=`on${s.charAt(7).toUpperCase()}${s.slice(8)}`;j[g]=o[i];return}s.substring(s.length-4)==="Once"&&(s=`~${s.substring(0,s.length-4)}`),_[s]=o[i]});function b(i){if(!n.value)return;const s=t.value=W(n.value,f.value,p.value);e.group&&(s.group=e.group),Object.keys(_).forEach(v=>{let r=_[v];if(!r)return;let u=v.toLowerCase();u.charAt(0)==="~"&&(u=u.substring(1),r.__once__=!0);let M=s;if(u.indexOf("zr:")===0&&(M=s.getZr(),u=u.substring(3)),r.__once__){delete r.__once__;const Y=r;r=(...k)=>{Y(...k),M.off(u,r)}}M.on(u,r)});function g(){s&&!s.isDisposed()&&s.resize()}function N(){const v=i||m.value;v&&s.setOption(v,h.value)}c.value?X(()=>{g(),N()}):N()}function K(i,s){e.manualUpdate&&(a.value=i),t.value?t.value.setOption(i,s||{}):b(i)}function U(){t.value&&(t.value.dispose(),t.value=void 0)}let w=null;A(I,i=>{typeof w=="function"&&(w(),w=null),i||(w=A(()=>e.option,(s,g)=>{s&&(t.value?t.value.setOption(s,{notMerge:s!==g,...h.value}):b())},{deep:!0}))},{immediate:!0}),A([f,p],()=>{U(),b()},{deep:!0}),H(()=>{e.group&&t.value&&(t.value.group=e.group)});const B=se(t);return re(t,P,x),ie(t,c,n),J(()=>{b()}),Q(()=>{de&&n.value?n.value.__dispose=U:U()}),{chart:t,root:n,setOption:K,nonEventAttrs:z,nativeListeners:j,...B}},render(){const e={...this.nonEventAttrs,...this.nativeListeners};return e.ref="root",e.class=e.class?["echarts"].concat(e.class):"echarts",Z($,e)}});export{me as E};
