(function(u,h){typeof exports=="object"&&typeof module<"u"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(u=typeof globalThis<"u"?globalThis:u||self,h(u.VtjCharts={}))})(this,(function(u){"use strict";/**!
 * Copyright (c) 2026, VTJ.PRO All rights reserved.
 * @name @vtj/charts 
 * @author CHC chenhuachun1549@dingtalk.com 
 * @version 0.18.22
 * @license <a href="https://vtj.pro/license.html">MIT License</a>
 */const h="0.18.22";function v(t){const s=Vue.reactive({});for(const[l,e]of Object.entries(t)){const[r,...i]=VtjUtils.kebabCase(l).split("-");if(r==="on"&&typeof e=="function"){const n=VtjUtils.camelCase(i.join("-"));s[n]=e}}return s}function g(t,s,l){const e=Vue.ref(),r=v(l);return Vue.onMounted(()=>{const n=Vue.unref(t);if(n&&(e.value||(e.value=Vue.markRaw(echarts.init(n))),e.value)){for(const[c,a]of Object.entries(r))e.value.on(c,a);e.value.setOption(s.value||{})}}),Vue.onUnmounted(()=>{if(e.value){for(const n of Object.keys(r))e.value.off(n);e.value.dispose()}}),Vue.watch(s,async n=>{e.value&&e.value.setOption(n||{})},{deep:!0}),VueUse.useResizeObserver(t,VtjUtils.debounce(()=>{e.value&&e.value.resize()},150)),{instance:e,getEChart:()=>e.value}}function V(t,s,l){const e=Vue.ref(),r=Vue.shallowRef(null),i=Vue.ref({}),n=async(c,a)=>{var C;const o=(C=e.value)==null?void 0:C.instance;o&&o.showLoading();const f=typeof a=="string"?await fetch(a).then(j=>j.json()).catch(()=>null):a;return o&&o.hideLoading(),f&&echarts.registerMap(c,f),f};return Vue.watch([t,s],async()=>{r.value=await n(t.value,s.value)}),Vue.watch(r,c=>{if(c){const a=l.option||{};a.geo&&(a.geo.map=t.value),(a.series||[]).map(f=>{(f==null?void 0:f.type)==="map"&&(f.map=t.value)}),i.value=a}}),Vue.onMounted(async()=>{r.value=await n(t.value,s.value)}),Vue.onUnmounted(()=>{var a;const c=(a=e.value)==null?void 0:a.instance;c&&c.hideLoading()}),{chartRef:e,geoJSON:r,option:i}}const d=Vue.defineComponent({name:"XChart",props:{width:{type:String,default:"100%"},height:{type:String,default:"400px"},option:{type:Object}},setup(t,{expose:s,attrs:l}){const{width:e,height:r,option:i}=Vue.toRefs(t),n=Vue.ref(),c=Vue.computed(()=>({width:e.value,height:r.value})),{instance:a,getEChart:o}=g(n,i,l);return s({elRef:n,option:i,instance:a,getEChart:o}),{elRef:n,option:i,styles:c,instance:a,getEChart:o}},render(){return Vue.h("div",{class:"x-chart",ref:"elRef",style:this.styles})}}),m=Vue.defineComponent({name:"XMapChart",inheritAttrs:!1,props:{geoJson:{type:[String,Object],default:"https://unpkg.com/vtj-geojson@0.1.3/geo/100000/100000.geoJson"},name:{type:String,default:"china"}},emits:["ready"],async setup(t,{attrs:s,emit:l}){const{name:e,geoJson:r}=Vue.toRefs(t),{chartRef:i,geoJSON:n,option:c}=V(e,r,s),a=Vue.computed(()=>{var o;return(o=i.value)==null?void 0:o.instance});return Vue.watch(n,async o=>{o&&l("ready",o)}),{chartRef:i,option:c,instance:a,getChartRef:()=>i.value,getEChart:()=>{var o;return(o=i.value)==null?void 0:o.getEChart()},geoJSON:n}},render(){return Vue.h(d,{...this.$attrs,ref:"chartRef",class:"x-map-chart",option:this.option},this.$slots)},methods:{}}),y=[d,m];var b=echarts;const p=Symbol("INSTALLED_KEY");function S(t){t[p]||(t[p]=!0,y.forEach(s=>{s.name&&t.component(s.name,s)}))}u.INSTALLED_KEY=p,u.VTJ_CHARTS_VERSION=h,u.XChart=d,u.XMapChart=m,u.components=y,u.echarts=b,u.install=S,u.useChart=g,u.useListeners=v,u.useMapChart=V,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})}));
