"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
require("../../../../../node_modules/element-plus/es/index.js");
;/* empty css                                                             */
;/* empty css                                                                */
const Vue = require("vue");
const Node = require("./Node.vue2.js");
;/* empty css                   */
const _pluginVue_exportHelper = require("../../../../../_virtual/_plugin-vue_export-helper.js");
const index = require("../../../../../node_modules/element-plus/es/components/text/index.js");
const _hoisted_1 = { class: "branch-node" };
const _sfc_main = {
  __name: "ConditionNode",
  props: {
    node: Object
  },
  setup(__props) {
    const { nodesError } = Vue.inject("flowDesign", { nodesError: Vue.ref({}) });
    const props = __props;
    const content = Vue.ref("");
    Vue.watchEffect(() => {
      var _a, _b;
      const errors = [];
      const { id, name, def, conditions, next } = props.node;
      if (def) {
        content.value = "不满足其他条件时执行";
      } else if (conditions.conditions.length > 0 || (((_a = conditions.groups) == null ? void 0 : _a.length) || 0) > 0) {
        const count = conditions.conditions.length + (((_b = conditions.groups) == null ? void 0 : _b.length) || 0);
        content.value = `已设置（${count}）个条件`;
        if (!next) {
          errors.push({ id, name, message: "分支下没有下一步动作" });
        }
      } else {
        errors.push({ id, name, message: "未设置条件" });
        content.value = "点击配置条件";
      }
      if (errors.length > 0) {
        nodesError.value[id] = errors;
      } else {
        delete nodesError.value[id];
      }
    });
    return (_ctx, _cache) => {
      const _component_el_text = index.ElText;
      return Vue.openBlock(), Vue.createElementBlock("div", _hoisted_1, [
        Vue.createVNode(Node.default, Vue.mergeProps(_ctx.$attrs, {
          icon: "el:Share",
          node: __props.node,
          readOnly: __props.node.def,
          color: "linear-gradient(89.96deg, #79db88 .05%, #4bb44b 79.83%)"
        }), {
          default: Vue.withCtx(() => [
            Vue.createVNode(_component_el_text, null, {
              default: Vue.withCtx(() => [
                Vue.createTextVNode(Vue.toDisplayString(Vue.unref(content)), 1)
              ]),
              _: 1
            }),
            Vue.renderSlot(_ctx.$slots, "append", {}, void 0, true)
          ]),
          _: 3
        }, 16, ["node", "readOnly"])
      ]);
    };
  }
};
const Condition = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-6370e05c"]]);
exports.default = Condition;
