var n = Object.defineProperty;
var s = (t, e, r) => e in t ? n(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
var o = (t, e, r) => (s(t, typeof e != "symbol" ? e + "" : e, r), r);
import { ControlType as c, ViewType as l } from "@ibiz-template/model";
import { PluginStaticResource as h } from "@ibiz-template/runtime";
import { PortletPartController as m } from "@ibiz-template/controller";
const C = new h(import.meta.url);
class p {
  constructor() {
    o(this, "component", "ChartControl");
  }
}
class d {
  constructor() {
    o(this, "component", "ChartView");
  }
}
class w extends m {
  constructor() {
    super(...arguments);
    /**
     * 图表神经元
     *
     * @author zhanghengfeng
     * @date 2023-10-30 19:10:58
     * @type {ChartNeuron}
     */
    o(this, "chart");
    /**
     * 图表适配器
     *
     * @author zhanghengfeng
     * @date 2023-10-30 19:10:22
     * @type {IControlProvider}
     */
    o(this, "chartProvider");
  }
  async onInit() {
    await super.onInit();
    const { chart: r } = this.model;
    r && (this.chartProvider = await ibiz.register.control.get(r));
  }
  /**
   * 设置图表神经元
   *
   * @author zhanghengfeng
   * @date 2023-10-30 19:10:45
   * @param {ChartNeuron} neuron
   */
  setChartNeuron(r) {
    this.chart = r, this.chart.evt.on("mounted", () => {
      var i;
      (i = this.chart) == null || i.call.load();
    }), this.chart.evt.on("destroyed", () => {
      this.chart = void 0;
    });
  }
}
class P {
  constructor() {
    o(this, "component", "ChartPortlet");
  }
  async createController(e, r, i) {
    const a = new w(
      e,
      r,
      i
    );
    return await a.init(), a;
  }
}
const T = {
  mateUrl: import.meta.url,
  install(t) {
    C.loadStyle(["/style.css"]), t.component(
      "ChartControl",
      () => import("./chart-control-82e4972f.js")
    ), ibiz.register.control.register(c.CHART, new p()), t.component(
      "ChartView",
      () => import("./chart-view-2e05f0a8.js")
    ), ibiz.register.view.register(
      l.DE_CHART_VIEW,
      new d()
    ), t.component(
      "ChartPortlet",
      () => import("./chart-portlet-54877294.js")
    ), ibiz.register.portletPart.register("CHART", new P());
  }
};
export {
  w as C,
  T as i
};
