const _ = (s) => {
  let t = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
  if (!t)
    return;
  let r = 100 * (t / 1920);
  return s * r;
}, x = ["#DDB868", "#CF9747", "#D3702C", "#546E98", "#769CC9", "#8EC2CC"], w = [
  {
    type: "linear",
    x: 0,
    y: 0,
    x2: 1,
    y2: 0,
    colorStops: [
      {
        offset: 0,
        color: "rgba(224,104,15,0.8)"
      },
      {
        offset: 1,
        color: "rgba(242,161,34,0.8)"
      }
    ],
    globalCoord: !1
  },
  {
    type: "linear",
    x: 0,
    y: 0,
    x2: 1,
    y2: 0,
    colorStops: [
      {
        offset: 0,
        color: "rgba(248,231,28,0.9)"
      },
      {
        offset: 1,
        color: "rgba(255,190,0,0.9)"
      }
    ],
    globalCoord: !1
  },
  {
    type: "linear",
    x: 0,
    y: 0,
    x2: 1,
    y2: 0,
    colorStops: [
      {
        offset: 0,
        color: "rgba(28,189,180,0.9)"
      },
      {
        offset: 1,
        color: "rgba(143,243,121,0.9)"
      }
    ],
    globalCoord: !1
  },
  {
    type: "linear",
    x: 0,
    y: 0,
    x2: 1,
    y2: 0,
    colorStops: [
      {
        offset: 0,
        color: "rgba(7,185,249,0.9)"
      },
      {
        offset: 1,
        color: "rgba(104,243,202,0.9)"
      }
    ],
    globalCoord: !1
  },
  {
    type: "linear",
    x: 0,
    y: 0,
    x2: 1,
    y2: 0,
    colorStops: [
      {
        offset: 0,
        color: "rgba(187,155,241,0.9)"
      },
      {
        offset: 1,
        color: "rgba(136,123,242,0.9)"
      }
    ],
    globalCoord: !1
  }
];
function v(s = 1, t = 100) {
  return Math.floor(Math.random() * (t - s + 1)) + s;
}
function C(s = 7) {
  let t = [];
  for (let r = 0; r < s; r++)
    t.push(v());
  return t;
}
function O(s) {
  let t = /* @__PURE__ */ new Map([
    ["0", ""],
    [0, ""],
    ["100", "line"],
    [100, "line"],
    ["200", "bar"],
    [200, "bar"],
    ["201", "bar"],
    [201, "bar"],
    ["202", "bar"],
    [202, "bar"],
    ["203", "bar"],
    [203, "bar"],
    ["300", "pie"],
    [300, "pie"],
    [301, "pie"],
    ["301", "pie"],
    [302, "pie"],
    ["400", "pie"],
    [400, "pie"],
    ["500", "map"],
    [500, "map"],
    ["700", "radar"],
    [700, "radar"],
    ["1601", "sankey"],
    [1601, "sankey"],
    ["2000", "pictorialBar"],
    [2e3, "pictorialBar"]
  ]);
  return t.get(s), console.log("777", t.get(s)), t.get(s);
}
class F {
  constructor() {
    this.resetDefault();
  }
  getEchartOption() {
    return {
      grid: {},
      title: {},
      color: [],
      legend: {
        data: []
      },
      toolTip: {},
      xAxis: {},
      yAxis: {},
      series: {
        name: "",
        type: "line",
        symbol: "emptyCircle",
        showSymbol: !0,
        smooth: !1,
        areaStyle: !1,
        stack: !1,
        emphasis: {
          focus: "series"
        },
        data: C(8)
      }
    };
  }
  resetDefault() {
    this.defaultTitle = {}, this.defaultColors = [], this.defaultLegends = {
      data: []
    }, this.defaultGrid = {}, this.defaultXAxis = [], this.defaultYAxis = [], this.defaultseries = [], this.angleAxis = [], this.radiusAxis = {}, this.polar = {
      center: ["50%", "53%"],
      radius: "60%"
    };
  }
  getChartsOption(t = {}) {
    var f, S, b, g, y;
    const {
      color: r = [],
      xAxis: d = [],
      yAxis: a = [],
      series: p = [],
      directionFlag: m = !1,
      legendFlag: h = !0,
      tooltip: l = {},
      legend: n = {},
      grid: u = {},
      pieOptions: c = {},
      chartScroll: o = {},
      linerAareaColor: i
    } = t;
    this.formatColors(i), this.formatAxis(t), this.formatSeries(t);
    let e = {
      color: this.defaultColors,
      tooltip: {
        trigger: "item",
        show: !0,
        ...l
      },
      legend: {
        show: !!h,
        itemGap: 40,
        textStyle: {
          fontSize: _(0.18),
          color: "rgba(0,0,0,0.85)",
          fontFamily: "FZRuiZhengHeiS-R-GB",
          padding: [0, 0, 0, 8]
        },
        itemWidth: _(0.18),
        itemHeight: _(0.18),
        ...n
      },
      grid: {
        top: "15%",
        bottom: "15%",
        ...u
      },
      series: this.defaultseries
    };
    return ((f = p[0]) == null ? void 0 : f.type) == 201 ? e = {
      ...e,
      angleAxis: this.defaultYAxis[0],
      polar: this.polar,
      radiusAxis: this.radiusAxis
    } : ((S = p[0]) == null ? void 0 : S.type) == 200 || ((b = p[0]) == null ? void 0 : b.type) == 203 || ((g = p[0]) == null ? void 0 : g.type) == 100 ? e = {
      ...e,
      xAxis: this.defaultXAxis,
      yAxis: this.defaultYAxis
    } : ((y = p[0]) == null ? void 0 : y.type) == 500 && (e = {
      tooltip: {
        trigger: "item",
        show: !0,
        ...l
      },
      visualMap: {
        min: 0,
        max: Math.max.apply(null, p[0].data),
        left: "left",
        top: "bottom",
        text: ["\u9AD8", "\u4F4E"],
        inRange: {
          color: ["#FFE1CC", "#FF6A00"]
        },
        show: !0
      },
      geo: {
        map: "china",
        roam: !1,
        zoom: 1.23,
        label: {
          normal: {
            show: !1,
            fontSize: "10",
            color: "rgba(0,0,0,0.7)"
          },
          emphasis: {
            show: !1,
            textStyle: {
              color: "#fff"
            }
          }
        },
        itemStyle: {
          normal: {
            borderColor: "rgba(0, 0, 0, 0.2)"
          },
          emphasis: {
            areaColor: "#F3B329",
            shadowOffsetX: 0,
            shadowOffsetY: 0,
            shadowBlur: 20,
            borderWidth: 0,
            shadowColor: "rgba(0, 0, 0, 0.5)"
          }
        }
      },
      series: this.defaultseries
    }), o.dataZoom && (e = {
      ...e,
      dataZoom: o.dataZoom
    }), {
      ...e
    };
  }
  formatTitle({
    title: t,
    titleText: r
  }) {
    return !t && r && (t = {
      text: r,
      top: "3%",
      left: "5%",
      textStyle: {
        color: "#ffffff",
        fontSize: 14,
        fontWeight: 500
      }
    }), t;
  }
  formatColors(t = []) {
    let r = t && t.length > 0 ? t.map(
      (d) => d.length == 1 ? d[0] : {
        type: "linear",
        x: 0,
        y: 0,
        x2: 1,
        y2: 0,
        colorStops: [
          {
            offset: 0,
            color: d[0]
          },
          {
            offset: 1,
            color: d[1]
          }
        ],
        opacity: 0.85,
        global: !1,
        globalCoord: !1
      }
    ) : w;
    Object.assign(this.defaultColors, r);
  }
  formatAxis({
    xAxis: t = [],
    yAxis: r = [],
    series: d,
    directionFlag: a,
    barOptions: p = {},
    categoryOptions: m = {},
    yAxisOptions: h = {},
    xAxisOptions: l = {}
  }) {
    let n = {
      axisLabelFormatter: "{value}",
      axisLabelXFormatter: "{value}",
      sortAndDirectionFlag: !1,
      nameTextStyle: {
        color: "#000",
        fontSize: 17,
        fontWeight: 400,
        padding: a ? [0, 8, 10, -20] : [0, 8, 0, 40]
      },
      ...p
    }, u = {
      axisLabel: {},
      ...m
    }, c = {
      showUnit: !0,
      ...h
    };
    ({
      ...l
    });
    let o = {
      type: "value",
      axisLine: {
        show: !1,
        color: "#9b9b9d"
      },
      axisLabel: {
        show: !n.sortAndDirectionFlag,
        fontSize: 16,
        color: "#000",
        interval: 0,
        formatter: n.axisLabelFormatter
      },
      axisTick: {
        show: !1
      },
      nameTextStyle: n.nameTextStyle,
      splitLine: {
        show: !n.sortAndDirectionFlag
      }
    };
    console.log("ajsvnjav", u);
    let i = {
      type: "category",
      axisTick: {
        show: !n.sortAndDirectionFlag
      },
      axisLabel: {
        interval: 0,
        fontSize: 16,
        color: "#000",
        formatter: n.axisLabelXFormatter,
        ...u.axisLabel
      },
      axisLine: {
        show: !n.sortAndDirectionFlag,
        style: {
          stroke: "#9b9b9d"
        }
      }
    };
    if (t.length > 0 && t[0].type == "category") {
      let e = a ? t.map((f) => ({
        ...i,
        data: f.data || []
      })) : r.map((f) => ({
        ...o,
        name: c.showUnit ? f.unit : ""
      }));
      d[0].type == 201 ? e[0].axisLabel = {
        formatter: (f) => f < 0 ? -f : f
      } : d[0].type == 202 ? e[0].axisLabel = {
        formatter: (f) => f < 0 ? -f : f
      } : d[0].type == 100 && (e[0].boundaryGap = !0), Object.assign(this.defaultXAxis, e);
    }
    if (r.length > 0 && r[0].type == "value") {
      let e = a ? r.map((f) => ({
        ...o,
        name: c.showUnit ? f.unit : ""
      })) : t.map((f) => ({
        ...i,
        data: f.data || []
      }));
      Object.assign(this.defaultYAxis, e);
    }
  }
  formatSeries({
    series: t = [],
    xAxis: r = [],
    pieOptions: d = {},
    linerAareaColor: a,
    barOptions: p = {},
    linerOptions: m = {}
  }) {
    console.log("10010", t);
    let h = {
      pieShowLabel: !1,
      labelFormatter: (c) => `${c.data.value}`,
      pieCenter: ["50%", "50%"],
      label: null,
      pieRadius: [20, 80],
      itemStyle: {
        borderRadius: 4
      },
      ...d
    }, l = {
      barBorderRadius: [0, 0, 0, 0],
      barWidth: "auto",
      barGap: "30%",
      ...p
    }, n = {
      smooth: !0,
      showLinerAarea: !0,
      ...m
    }, u = t.map((c, o) => {
      var f, S;
      const {
        type: i
      } = c;
      let e = {
        ...c,
        type: O(i)
      };
      if (i == 100 || i == 200 || i == 201 || i == 202 || i == 203)
        i == 100 ? (e = {
          ...e,
          smooth: n.smooth,
          symbol: "none",
          lineStyle: {
            color: a ? a[o % a.length] && a[o % a.length][0] : x[o % x.length]
          },
          itemStyle: {
            color: a ? a[o % a.length] && a[o % a.length][0] : x[o % x.length]
          }
        }, a && ((f = a[o]) == null ? void 0 : f.length) && n.showLinerAarea && (e.areaStyle = {
          color: {
            type: "linear",
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [{
              offset: 0,
              color: a[o % a.length][0]
            }, {
              offset: 1,
              color: a[o % a.length][1]
            }],
            global: !1
          },
          opacity: 0.25
        })) : i == 200 || i == 202 || i == 203 ? (e.itemStyle = {
          normal: {
            barBorderRadius: l.barBorderRadius
          }
        }, e.barWidth = l.barWidth, e.barGap = l.barGap) : i == 201 && (e.coordinateSystem = "polar");
      else if (i == 300 || i == 301 || i == 302)
        e = {
          ...e,
          radius: d.pieRadius ? d.pieRadius : i == 300 ? "50%" : i == 301 ? ["30%", "60%"] : [20, 80],
          center: h.pieCenter,
          data: c.data.map((b, g) => ({
            value: b,
            name: r[0].data[g],
            label: h.label ? h.label : {
              show: h.pieShowLabel,
              fontSize: _(0.15),
              formatter: function(y) {
                return h.labelFormatter(y);
              }
            },
            labelLine: {
              show: h.pieShowLabel,
              length: 20,
              length2: 10,
              lineStyle: h.pieShowLabel ? {
                color: a ? a[g % a.length][0] : w[g][0],
                width: 1,
                type: "solid"
              } : {}
            }
          }))
        }, i == 302 && (e.roseType = "area", e.itemStyle = {
          ...h.itemStyle
        });
      else if (i == 500) {
        let b = [];
        c.data.map((g, y) => {
          b.push({
            value: g,
            name: r[0].data[y]
          });
        }), e = {
          name: "\u4FE1\u606F\u91CF",
          type: "map",
          geoIndex: 0,
          data: b
        };
      } else
        ((S = t[0]) == null ? void 0 : S.type) == 1601 && (delete initOption.color, delete initOption.legend);
      return e;
    });
    console.log("anjsvknajksvna", u), Object.assign(this.defaultseries, u);
  }
  getPieChartsOption(t) {
    return t;
  }
}
function R(s, t, r, d, a, p, m, h) {
  var l = typeof s == "function" ? s.options : s;
  t && (l.render = t, l.staticRenderFns = r, l._compiled = !0), d && (l.functional = !0), p && (l._scopeId = "data-v-" + p);
  var n;
  if (m ? (n = function(o) {
    o = o || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !o && typeof __VUE_SSR_CONTEXT__ < "u" && (o = __VUE_SSR_CONTEXT__), a && a.call(this, o), o && o._registeredComponents && o._registeredComponents.add(m);
  }, l._ssrRegister = n) : a && (n = h ? function() {
    a.call(
      this,
      (l.functional ? this.parent : this).$root.$options.shadowRoot
    );
  } : a), n)
    if (l.functional) {
      l._injectStyles = n;
      var u = l.render;
      l.render = function(i, e) {
        return n.call(e), u(i, e);
      };
    } else {
      var c = l.beforeCreate;
      l.beforeCreate = c ? [].concat(c, n) : [n];
    }
  return {
    exports: s,
    options: l
  };
}
const D = {
  name: "yk-map-chart",
  props: {
    chartOption: {
      type: Object,
      default: () => ({})
    },
    width: {
      type: String,
      default: "100%"
    },
    height: {
      type: String,
      default: "100%"
    }
  },
  data() {
    return {
      ChartData: {}
    };
  },
  mounted() {
  },
  watch: {
    chartOption: {
      deep: !0,
      immediate: !0,
      handler(s) {
        this.ChartData = new F().getChartsOption(s);
      }
    }
  }
};
var T = function() {
  var t = this, r = t._self._c;
  return r("div", { staticClass: "map-chart" }, [r("yk-base-chart", { style: { width: t.width, height: t.height }, attrs: { options: t.ChartData } })], 1);
}, W = [], k = /* @__PURE__ */ R(
  D,
  T,
  W,
  !1,
  null,
  "f1696375",
  null,
  null
);
const L = k.exports, z = {
  install(s) {
    s.component(L.name, L);
  }
};
export {
  z as default
};
