const b = (f) => {
  let t = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
  if (!t)
    return;
  let i = 100 * (t / 1920);
  return f * i;
}, 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(f = 1, t = 100) {
  return Math.floor(Math.random() * (t - f + 1)) + f;
}
function L(f = 7) {
  let t = [];
  for (let i = 0; i < f; i++)
    t.push(v());
  return t;
}
function O(f) {
  let t = /* @__PURE__ */ new Map([
    ["0", ""],
    ["100", "line"],
    ["200", "bar"],
    ["201", "bar"],
    ["202", "bar"],
    ["203", "bar"],
    ["300", "pie"],
    ["301", "pie"],
    ["302", "pie"],
    ["400", "pie"],
    ["500", "map"],
    ["700", "radar"],
    ["2000", "pictorialBar"]
  ]);
  return t.get(f), console.log("777", t.get(f)), t.get(f);
}
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: L(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 r, m, y, S, _;
    const {
      color: i = [],
      xAxis: p = [],
      yAxis: l = [],
      series: h = [],
      directionFlag: c = !1,
      legendFlag: u = !0,
      tooltip: n = {},
      legend: a = {},
      grid: d = {},
      pieOptions: o = {},
      chartScroll: e = {},
      linerAareaColor: g
    } = t;
    this.formatColors(g), this.formatAxis(t), this.formatSeries(t);
    let s = {
      color: this.defaultColors,
      tooltip: {
        trigger: "item",
        show: !0,
        ...n
      },
      legend: {
        show: !!u,
        itemGap: 40,
        textStyle: {
          fontSize: b(0.18),
          color: "rgba(0,0,0,0.85)",
          fontFamily: "FZRuiZhengHeiS-R-GB",
          padding: [0, 0, 0, 8]
        },
        itemWidth: b(0.18),
        itemHeight: b(0.18),
        ...a
      },
      grid: { top: "15%", bottom: "15%", ...d },
      series: this.defaultseries
    };
    return ((r = h[0]) == null ? void 0 : r.type) == 201 ? s = {
      ...s,
      angleAxis: this.defaultYAxis[0],
      polar: this.polar,
      radiusAxis: this.radiusAxis
    } : ((m = h[0]) == null ? void 0 : m.type) == 200 || ((y = h[0]) == null ? void 0 : y.type) == 203 || ((S = h[0]) == null ? void 0 : S.type) == 100 ? s = {
      ...s,
      xAxis: this.defaultXAxis,
      yAxis: this.defaultYAxis
    } : ((_ = h[0]) == null ? void 0 : _.type) == 500 && (s = {
      tooltip: {
        trigger: "item",
        show: !0,
        ...n
      },
      visualMap: {
        min: 0,
        max: Math.max.apply(null, h[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
    }), e.dataZoom && (s = {
      ...s,
      dataZoom: e.dataZoom
    }), { ...s };
  }
  formatTitle({ title: t, titleText: i }) {
    return !t && i && (t = {
      text: i,
      top: "3%",
      left: "5%",
      textStyle: {
        color: "#ffffff",
        fontSize: 14,
        fontWeight: 500
      }
    }), t;
  }
  formatColors(t = []) {
    let i = t && t.length > 0 ? t.map(
      (p) => p.length == 1 ? p[0] : {
        type: "linear",
        x: 0,
        y: 0,
        x2: 1,
        y2: 0,
        colorStops: [
          {
            offset: 0,
            color: p[0]
          },
          {
            offset: 1,
            color: p[1]
          }
        ],
        opacity: 0.85,
        global: !1,
        globalCoord: !1
      }
    ) : w;
    Object.assign(this.defaultColors, i);
  }
  formatAxis({ xAxis: t = [], yAxis: i = [], series: p, directionFlag: l, barOptions: h = {}, categoryOptions: c = {}, yAxisOptions: u = {}, xAxisOptions: n = {} }) {
    let a = {
      axisLabelFormatter: "{value}",
      axisLabelXFormatter: "{value}",
      sortAndDirectionFlag: !1,
      nameTextStyle: {
        color: "#000",
        fontSize: 17,
        fontWeight: 400,
        padding: l ? [0, 8, 10, -20] : [0, 8, 0, 40]
      },
      ...h
    }, d = {
      axisLabel: {},
      ...c
    }, o = {
      showUnit: !0,
      ...u
    };
    ({
      ...n
    });
    let e = {
      type: "value",
      axisLine: {
        show: !1,
        color: "#9b9b9d"
      },
      axisLabel: {
        show: !a.sortAndDirectionFlag,
        fontSize: 16,
        color: "#000",
        interval: 0,
        formatter: a.axisLabelFormatter
      },
      axisTick: {
        show: !1
      },
      nameTextStyle: a.nameTextStyle,
      splitLine: {
        show: !a.sortAndDirectionFlag
      }
    };
    console.log("ajsvnjav", d);
    let g = {
      type: "category",
      axisTick: { show: !a.sortAndDirectionFlag },
      axisLabel: {
        interval: 0,
        fontSize: 16,
        color: "#000",
        formatter: a.axisLabelXFormatter,
        ...d.axisLabel
      },
      axisLine: {
        show: !a.sortAndDirectionFlag,
        style: {
          stroke: "#9b9b9d"
        }
      }
    };
    if (t.length > 0 && t[0].type == "category") {
      let s = l ? t.map((r) => ({ ...g, data: r.data || [] })) : i.map((r) => ({ ...e, name: o.showUnit ? r.unit : "" }));
      p[0].type == 201 ? s[0].axisLabel = {
        formatter: (r) => r < 0 ? -r : r
      } : p[0].type == 202 ? s[0].axisLabel = {
        formatter: (r) => r < 0 ? -r : r
      } : p[0].type == 100 && (s[0].boundaryGap = !0), Object.assign(this.defaultXAxis, s);
    }
    if (i.length > 0 && i[0].type == "value") {
      let s = l ? i.map((r) => ({ ...e, name: o.showUnit ? r.unit : "" })) : t.map((r) => ({ ...g, data: r.data || [] }));
      Object.assign(this.defaultYAxis, s);
    }
  }
  formatSeries({ series: t = [], xAxis: i = [], pieOptions: p = {}, linerAareaColor: l, barOptions: h = {} }) {
    console.log("10010", t);
    let c = {
      pieShowLabel: !1,
      labelFormatter: (a) => `${a.data.value}`,
      pieCenter: ["50%", "50%"],
      ...p
    }, u = {
      barBorderRadius: [0, 0, 0, 0],
      barWidth: "auto",
      barGap: "30%",
      ...h
    }, n = t.map((a, d) => {
      var g;
      const { type: o } = a;
      let e = { ...a, type: O(o) };
      if (o == 100 || o == 200 || o == 201 || o == 202 || o == 203)
        o == 100 ? (e = {
          ...e,
          smooth: !0,
          symbol: "none",
          lineStyle: {
            color: l ? l[d] && l[d][0] : x[d]
          },
          itemStyle: {
            color: l ? l[d] && l[d][0] : x[d]
          }
        }, l && ((g = l[d]) == null ? void 0 : g.length) && (e.areaStyle = {
          color: {
            type: "linear",
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [{
              offset: 0,
              color: l[d][0]
            }, {
              offset: 1,
              color: l[d][1]
            }],
            global: !1
          },
          opacity: 0.25
        })) : o == 200 || o == 202 || o == 203 ? (e.itemStyle = {
          normal: {
            barBorderRadius: u.barBorderRadius
          }
        }, e.barWidth = u.barWidth, e.barGap = u.barGap) : o == 201 && (e.coordinateSystem = "polar");
      else if (o == 300 || o == 301 || o == 302)
        e = {
          ...e,
          radius: o == 300 ? "50%" : o == 301 ? ["30%", "60%"] : [20, 80],
          center: c.pieCenter,
          data: a.data.map((s, r) => ({
            value: s,
            name: i[0].data[r],
            label: {
              show: c.pieShowLabel,
              fontSize: b(0.15),
              formatter: function(m) {
                return c.labelFormatter(m);
              }
            },
            labelLine: {
              show: c.pieShowLabel,
              length: 20,
              length2: 10,
              lineStyle: c.pieShowLabel ? {
                color: l ? l[r][0] : w[r][0],
                width: 1,
                type: "solid"
              } : {}
            }
          }))
        }, o == 302 && (e.center = ["50%", "50%"], e.roseType = "area", e.itemStyle = {
          borderRadius: 4
        });
      else if (o == 500) {
        let s = [];
        a.data.map((r, m) => {
          s.push({ value: r, name: i[0].data[m] });
        }), e = {
          name: "\u4FE1\u606F\u91CF",
          type: "map",
          geoIndex: 0,
          data: s
        };
      }
      return e;
    });
    console.log("anjsvknajksvna", n), Object.assign(this.defaultseries, n);
  }
  getPieChartsOption(t) {
    return t;
  }
}
function R(f, t, i, p, l, h, c, u) {
  var n = typeof f == "function" ? f.options : f;
  t && (n.render = t, n.staticRenderFns = i, n._compiled = !0), p && (n.functional = !0), h && (n._scopeId = "data-v-" + h);
  var a;
  if (c ? (a = function(e) {
    e = e || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !e && typeof __VUE_SSR_CONTEXT__ < "u" && (e = __VUE_SSR_CONTEXT__), l && l.call(this, e), e && e._registeredComponents && e._registeredComponents.add(c);
  }, n._ssrRegister = a) : l && (a = u ? function() {
    l.call(
      this,
      (n.functional ? this.parent : this).$root.$options.shadowRoot
    );
  } : l), a)
    if (n.functional) {
      n._injectStyles = a;
      var d = n.render;
      n.render = function(g, s) {
        return a.call(s), d(g, s);
      };
    } else {
      var o = n.beforeCreate;
      n.beforeCreate = o ? [].concat(o, a) : [a];
    }
  return {
    exports: f,
    options: n
  };
}
const D = {
  name: "yk-pie-chart",
  props: {
    chartOption: {
      type: Object,
      default: () => ({})
    },
    width: {
      type: String,
      default: "100%"
    },
    height: {
      type: String,
      default: "100%"
    }
  },
  data() {
    return {
      ChartData: {}
    };
  },
  mounted() {
    this.ChartData = new F().getChartsOption(this.chartOption);
  }
};
var T = function() {
  var t = this, i = t._self._c;
  return i("div", { staticClass: "pie-chart" }, [i("yk-base-chart", { style: { width: t.width, height: t.height }, attrs: { options: t.ChartData } })], 1);
}, A = [], W = /* @__PURE__ */ R(
  D,
  T,
  A,
  !1,
  null,
  "4bcac9dc",
  null,
  null
);
const C = W.exports, z = {
  install(f) {
    f.component(C.name, C);
  }
};
export {
  z as default
};
