import "./index-a857af7d.mjs";
import { b as d, a as b, d as c, p as l, c as h, B as m } from "./echartsUtil-c8c4d6d3.mjs";
import { unref as o, computed as u } from "vue";
function f(e, i) {
  const t = {}, s = x(i);
  return y(t, e, s), s && O(t), T(t), S(t, e), A(t, e), w(t, e), L(t, e, i), d(t, e), b(t, e, i), t;
}
function y(e, i, t) {
  if (!i["title-text"] && !i["title-subtext"])
    return !1;
  const s = { left: t ? "left" : "center" };
  return e.title = s, c(s, i, "title-text", "text"), c(s, i, "title-subtext", "subtext"), !0;
}
function x(e) {
  e = o(e);
  try {
    if (e[0].length <= 2)
      return !1;
  } catch {
    return !1;
  }
  return !0;
}
function O(e, i) {
  const t = { right: "10%" };
  e.legend = t;
}
function T(e, i, t, s) {
  const r = {};
  e.grid = r;
}
function S(e, i) {
  const t = {};
  e.tooltip = t, t.trigger = n(i) == "pie" ? "item" : "axis";
}
function A(e, i, t) {
  if (n(i) == "pie")
    return;
  const s = { type: "category" };
  e.xAxis = s;
}
function w(e, i) {
  if (n(i) == "pie")
    return;
  const t = { type: "value" };
  e.yAxis = t;
}
function L(e, i, t) {
  t = o(t);
  const s = [];
  e.series = s;
  try {
    const r = t[0];
    if (!t || !r || r.length <= 1) {
      s.push({ type: n(i) });
      return;
    }
    for (let p = 1; p < r.length; p++) {
      const a = v(i, r[p]);
      a && s.push(a);
    }
  } catch {
    s.push({ type: n(i) });
  }
}
function v(e, i) {
  const t = {}, s = n(e);
  return t.type = s, s == "line" ? l(t, e, "series", ["smooth"]) : s == "bar" ? l(t, e, "series", ["barWidth", "barGap"]) : s == "pie" && (l(t, e, "series", ["roseType"]), e["series-radius"] && (t.radius = h(e["series-radius"]))), t;
}
function n(e) {
  return e["series-type"] || "pie";
}
function C({ config: e, data: i, contextWrap: t }) {
  const s = f(e, i);
  return { "~": "div", "#": {
    "~component": m,
    option: s,
    autoresize: !0,
    theme: "default"
    // style: {
    //   height: config.height || '100%',
    //   width: config.width || '100%'
    // },
    // ...buildDefaultEvents(contextWrap)
  } };
}
const k = {
  key: "_echartsSimple",
  name: "Echarts simple",
  description: "",
  icon: "mdiChartBar",
  sequence: 2,
  transform: C,
  editor: {
    basic: {
      init: { "series-type": "bar" },
      ui: function({ config: e }) {
        return [
          // {
          //   '~component': 'el-input',
          //   '~label': 'Width',
          //   '~prop': 'wdith',
          //   '~default': '640px',
          //   clearable: true
          // },
          // {
          //   '~component': 'el-input',
          //   '~label': 'Height',
          //   '~prop': 'height',
          //   '~default': '480px',
          //   clearable: true
          // },
          {
            "~component": "el-select",
            "~label": "Series type",
            "~prop": "series-type",
            "~default": "pie",
            clearable: !0,
            "~options": ["line", "bar", "pie"]
          },
          {
            "~component": "el-input",
            "~label": "Title text",
            "~prop": "title-text"
          },
          {
            "~component": "el-input",
            "~label": "Title subtext",
            "~prop": "title-subtext"
          },
          //line
          {
            "~component": "el-switch",
            "~label": "Series smooth",
            "~prop": "series-smooth",
            "~show": u(() => o(e)["series-type"] == "line")
          },
          //pie
          {
            "~component": "el-select",
            "~label": "Pie rose type",
            "~prop": "series-roseType",
            clearable: !0,
            "~options": ["radius", "area"],
            "~show": u(() => o(e)["series-type"] == "pie")
          },
          {
            "~component": "el-input",
            "~label": "Pie radius",
            "~prop": "series-radius",
            clearable: !0,
            "~show": u(() => o(e)["series-type"] == "pie")
          },
          {
            "~component": "el-input",
            "~label": "Dimensions",
            "~prop": "dimensions"
          },
          {
            "~component": "el-input",
            "~label": "Other option",
            "~prop": "optionOther",
            type: "textarea",
            rows: 4
          }
        ];
      }
    },
    data: {
      //readonly:true,
      type: "Array",
      init: {
        mode: "fixed",
        dataContent: `[
        ["product", "2015", "2016", "2017"],
        ["Milk", 43.3, 85.8, 93.7],
        ["Computer", 83.1, 73.4, 55.1],
        ["TV", 86.4, 65.2, 82.5],
        ["Mobie", 72.4, 53.9, 39.1]
      ]`
      }
    },
    display: {
      init: { style: { width: "100%", height: "480px" } }
    }
  }
};
export {
  k as default
};
