var Q = Object.defineProperty;
var X = (e, t, s) => t in e ? Q(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
var k = (e, t, s) => (X(e, typeof t != "symbol" ? t + "" : t, s), s);
import { GridFieldColumnController as O, GridRowController as Z, WFStepTraceViewController as ee, UploadEditorController as V } from "@ibiz-template/controller";
import { defineComponent as U, computed as G, h as c, getCurrentInstance as N, ref as m, watch as T, toRefs as _ } from "vue";
import { useNamespace as S, useViewController as te, usePropsWatch as z, getUploadProps as se, getEditorEmits as oe, getGridUploadProps as A, useClickOutside as ie, getGridEditorEmits as re, useEventListener as ne, useWFStepTraceViewController as ae, useWFDynaEditView3Controller as le, useEditView3Controller as ce } from "@ibiz-template/vue-util";
import { colorBlend as de, IBizContext as ue, HttpError as j, isImage as me, uploadFile as pe, RuntimeError as he } from "@ibiz-template/core";
import { getCookie as fe } from "qx-util";
import { ViewMode as R } from "@ibiz-template/runtime";
import { ViewType as be } from "@ibiz-template/model";
const ve = U({
  name: "CodeListGridColumn",
  props: {
    controller: {
      type: O,
      required: !0
    },
    row: {
      type: Z,
      required: !0
    }
  },
  setup(e) {
    const t = S("grid-field-column"), s = G(() => {
      var l;
      if (e.controller.model.source.cLConvertMode !== "FRONT")
        return [];
      const n = e.row.data[e.controller.model.codeName];
      return ((l = e.controller.codeListItems) == null ? void 0 : l.length) && n ? n.split(",").map((v) => {
        const y = e.controller.codeListItems.find((h) => h.value === v);
        if (y) {
          const h = y.color || "#515a6e";
          return {
            text: y.text,
            colorStyle: t.cssVarBlock({
              color: h,
              "border-color": h,
              "bg-color": de(h, "#fff")
            })
          };
        }
      }).filter(Boolean) : [];
    }), o = (n) => {
      e.controller.isLinkColumn && e.controller.openLinkView(e.row, n);
    }, r = G(() => {
      let n = "";
      switch (e.controller.model.align) {
        case "LEFT":
          n = "flex-start";
          break;
        case "RIGHT":
          n = "flex-end";
          break;
        default:
          n = "center";
          break;
      }
      return t.cssVarBlock({
        "justify-content": n
      });
    });
    return {
      ns: t,
      alignStyle: r,
      selectedItems: s,
      onCellClick: o
    };
  },
  render() {
    const e = this.controller, t = this.row.data[e.model.codeName];
    return c("div", {
      class: [this.ns.b(), e.isLinkColumn && this.ns.m("link-column")],
      style: this.alignStyle,
      on: {
        click: this.onCellClick
      }
    }, [this.selectedItems.length > 0 ? this.selectedItems.map((s) => c("span", {
      class: this.ns.e("code-list-item"),
      style: s.colorStyle
    }, [s.text])) : c("span", {
      class: this.ns.e("text")
    }, [t])]);
  }
});
class we extends ee {
  constructor() {
    super(...arguments);
    k(this, "imgSrc");
  }
  async getUIData() {
    const s = new ue(this.params, this.context), o = await this.entityService.wf.getWFProcessDiagram(s), r = new Blob([o.data]);
    this.imgSrc = URL.createObjectURL(r);
  }
}
const ye = U({
  name: "PresetWFChartView",
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    },
    deName: {
      type: String,
      required: !0
    }
  },
  setup(e) {
    const t = S("preset-wf-chart-view"), {
      proxy: s
    } = N(), o = te(s, (r, n) => new we(e.modelPath, r, n));
    return z(s, "deName", o.setDeName.bind(o)), {
      c: o,
      ns: t
    };
  },
  render() {
    return c("div", {
      class: this.ns.b()
    }, [c("img", {
      attrs: {
        src: this.c.imgSrc
      }
    })]);
  }
});
const ge = U({
  name: "WFToolbar",
  props: {
    wfLinks: {
      type: Array,
      required: !0
    }
  },
  setup(e, {
    emit: t
  }) {
    return {
      ns: S("wf-toolbar"),
      handleClick: async (r, n) => {
        t("wf-link-click", r, n);
      }
    };
  },
  render() {
    const e = this.wfLinks || [];
    return c("div", {
      class: `${this.ns.b()}`
    }, [e.length > 0 && e.map((t) => {
      const s = t.sequenceFlowName == "\u9A73\u56DE" || t.sequenceFlowName == "\u53D6\u6D88";
      return c("div", {
        key: t.sequenceFlowId,
        class: [this.ns.e("item"), s ? this.ns.em("item", "reject") : ""]
      }, [c("i-button", {
        attrs: {
          title: t.sequenceFlowName
        },
        on: {
          click: (o) => this.handleClick(t, o)
        }
      }, [t.sequenceFlowName || ""])]);
    })]);
  }
}), Fe = typeof btoa == "function", B = typeof Buffer == "function";
typeof TextDecoder == "function" && new TextDecoder();
const W = typeof TextEncoder == "function" ? new TextEncoder() : void 0, Ce = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", D = Array.prototype.slice.call(Ce);
((e) => {
  let t = {};
  return e.forEach((s, o) => t[s] = o), t;
})(D);
const x = String.fromCharCode.bind(String);
typeof Uint8Array.from == "function" && Uint8Array.from.bind(Uint8Array);
const Ee = (e) => e.replace(/=/g, "").replace(/[+\/]/g, (t) => t == "+" ? "-" : "_"), Ue = (e) => {
  let t, s, o, r, n = "";
  const l = e.length % 3;
  for (let d = 0; d < e.length; ) {
    if ((s = e.charCodeAt(d++)) > 255 || (o = e.charCodeAt(d++)) > 255 || (r = e.charCodeAt(d++)) > 255)
      throw new TypeError("invalid character found");
    t = s << 16 | o << 8 | r, n += D[t >> 18 & 63] + D[t >> 12 & 63] + D[t >> 6 & 63] + D[t & 63];
  }
  return l ? n.slice(0, l - 3) + "===".substring(l) : n;
}, q = Fe ? (e) => btoa(e) : B ? (e) => Buffer.from(e, "binary").toString("base64") : Ue, xe = B ? (e) => Buffer.from(e).toString("base64") : (e) => {
  let s = [];
  for (let o = 0, r = e.length; o < r; o += 4096)
    s.push(x.apply(null, e.subarray(o, o + 4096)));
  return q(s.join(""));
}, Se = (e) => {
  if (e.length < 2) {
    var t = e.charCodeAt(0);
    return t < 128 ? e : t < 2048 ? x(192 | t >>> 6) + x(128 | t & 63) : x(224 | t >>> 12 & 15) + x(128 | t >>> 6 & 63) + x(128 | t & 63);
  } else {
    var t = 65536 + (e.charCodeAt(0) - 55296) * 1024 + (e.charCodeAt(1) - 56320);
    return x(240 | t >>> 18 & 7) + x(128 | t >>> 12 & 63) + x(128 | t >>> 6 & 63) + x(128 | t & 63);
  }
}, ke = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g, Te = (e) => e.replace(ke, Se), M = B ? (e) => Buffer.from(e, "utf8").toString("base64") : W ? (e) => xe(W.encode(e)) : (e) => q(Te(e)), $ = (e, t = !1) => t ? Ee(M(e)) : M(e);
function Ie(e, t, s) {
  const o = m([]), r = m({
    Authorization: `Bearer ${fe("access_token")}`
  }), n = m(""), l = m(""), d = {
    count: 0,
    cacheFiles: []
  };
  T(
    () => e.value,
    (i) => {
      o.value = i ? JSON.parse(i) : [];
    },
    { immediate: !0 }
  ), T(
    () => e.data,
    (i) => {
      if (i) {
        const a = s.calcBaseUrl(i);
        n.value = a.uploadUrl, l.value = a.downloadUrl;
      }
    },
    { immediate: !0, deep: !0 }
  ), T(
    o,
    (i) => {
      (i == null ? void 0 : i.length) && l.value && i.forEach((a) => {
        a.url = a.url || l.value.replace("%fileId%", a.id);
      });
    },
    { immediate: !0 }
  ), T(
    l,
    (i) => {
      i && o.value.length && o.value.forEach((a) => {
        a.url = l.value.replace("%fileId%", a.id);
      });
    },
    { immediate: !0 }
  );
  const p = () => {
    const i = [...o.value, ...d.cacheFiles], a = i.length > 0 ? JSON.stringify(i.map((b) => ({ name: b.name, id: b.id }))) : null;
    d.cacheFiles = [], t(a);
  }, v = (i) => {
    const a = ["html", "js", "exe", "sh"], b = i.name.trim().toLowerCase();
    if (a.some((L) => b.endsWith(`.${L}`)))
      return ibiz.message.error("\u4E0D\u53EF\u4E0A\u4F20 html\u3001js\u3001 exe\u3001sh\u7C7B\u578B\u7684\u6587\u4EF6\uFF01"), !1;
    d.count += 1;
  }, y = (i) => {
    !i || (d.cacheFiles.push({
      name: i.filename,
      id: i.fileid
    }), d.count -= 1, d.count === 0 && p());
  }, h = (i, a) => {
    throw d.count -= 1, new j({
      response: { data: a, status: i.status }
    });
  }, C = (i) => {
    if (e.disabled)
      return;
    const a = o.value.findIndex((b) => b.id === i.id);
    a !== -1 && o.value.splice(a, 1), p();
  }, g = (i) => {
    const a = i.url || l.value.replace("%fileId%", i.id);
    s.fileDownload({ url: a, name: i.name });
  }, f = m(!1), F = m(""), E = m("");
  return {
    uploadUrl: n,
    downloadUrl: l,
    headers: r,
    files: o,
    onDownload: g,
    onError: h,
    onRemove: C,
    onSuccess: y,
    beforeUpload: v,
    showModal: f,
    modalTitle: F,
    iframeUrl: E,
    onModalCancel: () => {
      f.value = !1, F.value = "", E.value = "";
    },
    previewFile: (i) => {
      f.value = !0, F.value = i.name;
      const a = window.Environment.previewFileUrl;
      if (a) {
        const b = encodeURIComponent(
          $(
            `${window.location.origin}${i.url}?fullfilename=${i.name}`
          )
        );
        E.value = `${a}/onlinePreview?url=${b}`;
      }
    }
  };
}
const De = U({
  name: "SyFileUpload",
  props: se(),
  emits: oe(),
  setup(e, {
    emit: t
  }) {
    const s = S("sy-file-upload"), o = e.controller, {
      uploadUrl: r,
      headers: n,
      files: l,
      onDownload: d,
      onError: p,
      onRemove: v,
      onSuccess: y,
      beforeUpload: h,
      showModal: C,
      modalTitle: g,
      iframeUrl: f,
      onModalCancel: F,
      previewFile: E
    } = Ie(e, (u) => {
      t("change", u);
    }, o);
    return {
      ns: s,
      c: o,
      uploadUrl: r,
      headers: n,
      files: l,
      onDownload: d,
      onError: p,
      onRemove: v,
      onSuccess: y,
      beforeUpload: h,
      showModal: C,
      modalTitle: g,
      iframeUrl: f,
      onModalCancel: F,
      previewFile: E
    };
  },
  render(e) {
    return e("div", {
      class: [this.ns.b(), this.disabled ? this.ns.m("disabled") : "", this.readonly ? this.ns.m("readonly") : ""]
    }, [e("IUpload", {
      ref: "fileUpload",
      props: {
        action: this.uploadUrl,
        headers: this.headers,
        disabled: this.disabled,
        "default-file-list": this.files,
        multiple: this.c.model.multiple,
        type: this.c.model.isDrag ? "drag" : "select",
        accept: this.c.model.accept,
        "before-upload": this.beforeUpload,
        "on-success": this.onSuccess,
        "on-error": this.onError,
        "on-remove": this.onRemove,
        "on-preview": this.onDownload,
        "show-upload-list": !1
      }
    }, [this.c.model.isDrag ? e("div", {
      class: this.ns.bm("box", "drag")
    }, [e("i-icon", {
      attrs: {
        type: "md-cloud-upload"
      }
    }), e("div", {
      class: this.ns.be("box", "title")
    }, [e("span", ["\u5C06\u6587\u4EF6\u62D6\u5230\u6B64\u5904\uFF0C\u6216"]), e("span", ["\u70B9\u51FB\u4E0A\u4F20"])])]) : e("i-button", {
      attrs: {
        icon: "ios-cloud-upload-outline"
      },
      class: this.ns.bm("box", "select")
    }, ["\u4E0A\u4F20\u6587\u4EF6"])]), e("div", {
      class: this.ns.b("file-list")
    }, [this.files.map((t) => e("div", {
      class: this.ns.b("file-item"),
      key: t.id
    }, [e("div", {
      class: this.ns.b("file-item-left")
    }, [e("i-icon", {
      attrs: {
        type: "md-document"
      }
    })]), e("div", {
      class: this.ns.b("file-item-right")
    }, [e("div", {
      class: this.ns.b("file-item-right-title"),
      on: {
        click: () => this.previewFile(t)
      }
    }, [t.name]), e("div", {
      class: this.ns.b("file-item-right-action")
    }, [e("i-icon", {
      attrs: {
        type: "md-download"
      },
      on: {
        click: () => this.onDownload(t)
      }
    }), e("i-icon", {
      attrs: {
        type: "md-eye"
      },
      on: {
        click: () => this.previewFile(t)
      }
    }), this.disabled || this.readonly ? null : e("i-icon", {
      attrs: {
        type: "md-close"
      },
      on: {
        click: () => this.onRemove(t)
      }
    })])])]))]), e("i-modal", {
      attrs: {
        value: this.showModal,
        title: this.modalTitle,
        "class-name": this.ns.b("modal"),
        width: "70%",
        transfer: !1,
        "footer-hide": !0
      },
      on: {
        "on-cancel": this.onModalCancel
      }
    }, [e("iframe", {
      class: this.ns.b("iframe"),
      attrs: {
        src: this.iframeUrl
      }
    })])]);
  }
});
function P(e, t) {
  if (e.url = t.replace("%fileId%", e.id), e.status || (e.status = "finished"), !e.fileName) {
    const s = e.name.lastIndexOf(".");
    e.fileName = e.name.substring(0, s), e.fileExt = e.name.substring(s), e.isImage = me(e.name);
  }
  return e;
}
function H(e) {
  const t = m(""), s = m(""), o = m([]);
  return T(
    e.data,
    (r) => {
      if (r) {
        const n = e.controller.value.calcBaseUrl(r);
        t.value = n.uploadUrl, s.value = n.downloadUrl;
      }
    },
    { immediate: !0, deep: !0 }
  ), T(
    e.value,
    (r) => {
      o.value = r ? JSON.parse(r) : [], o.value.length && s.value && o.value.forEach((n) => {
        P(n, s.value);
      });
    },
    { immediate: !0 }
  ), T(
    s,
    (r) => {
      r && o.value.length && o.value.forEach((n) => {
        P(n, r);
      });
    },
    { immediate: !0 }
  ), {
    downloadUrl: s,
    uploadUrl: t,
    valueList: o
  };
}
function J(e) {
  const t = m("undo"), s = m([]), { downloadUrl: o, value: r, uploadUrl: n } = e;
  T(
    r,
    (u) => {
      u.length > 0 && (s.value = [], u.forEach((w) => {
        s.value.push(P(w, o.value));
      }));
    },
    {
      immediate: !0,
      deep: !0
    }
  );
  const l = (u, w) => {
    const i = ["html", "js", "exe", "sh"], a = [];
    return w.forEach((b, I) => {
      const L = b.name.trim().toLowerCase();
      if (i.some((K) => L.endsWith(`.${K}`))) {
        a.push(I);
        return;
      }
      s.value.push({
        name: b.name,
        status: b.status,
        percentage: b.percentage,
        id: b.uid,
        url: ""
      });
    }), a.length === w.length ? (ibiz.message.error("\u4E0D\u53EF\u4E0A\u4F20 html\u3001js\u3001 exe\u3001sh\u7C7B\u578B\u7684\u6587\u4EF6\uFF01"), !1) : (a.length && (a.forEach((b) => {
      u.splice(b, 1), w.splice(b, 1);
    }), ibiz.message.error("\u4E0D\u53EF\u4E0A\u4F20 html\u3001js\u3001 exe\u3001sh\u7C7B\u578B\u7684\u6587\u4EF6\uFF01")), !0);
  }, d = (u) => {
    u.forEach((w) => {
      s.value.find((i) => i.id === w.uid ? (i.percentage = w.percentage, !0) : !1);
    });
  }, p = (u, w) => {
    u.forEach((i) => {
      s.value.find((a) => a.id === i.uid ? (a.status = i.status, a.id = w.data.fileid, a.name = w.data.filename, P(a, o.value), !0) : !1);
    });
  }, v = (u, w) => {
    var a;
    u.forEach((b) => {
      s.value.find((I) => I.id === b.uid ? (I.status = b.status, !0) : !1);
    });
    const i = new j(w);
    ibiz.notification.error({
      title: (a = i.status) == null ? void 0 : a.toString(),
      desc: i.message,
      duration: 10
    });
  }, y = (u) => {
    s.value = s.value.filter((w) => w.status === "finished"), t.value = "done";
  }, h = () => {
    pe({
      multiple: e.multiple,
      accept: e.accept,
      uploadUrl: n.value,
      beforeUpload: l,
      progress: d,
      success: p,
      error: v,
      finish: y
    });
  }, C = m(!1), g = m(""), f = m("");
  return {
    selectFile: h,
    fileList: s,
    uploadState: t,
    showModal: C,
    modalTitle: g,
    iframeUrl: f,
    onModalCancel: () => {
      C.value = !1, g.value = "", f.value = "";
    },
    previewFile: (u) => {
      C.value = !0, g.value = u.name;
      const w = window.Environment.previewFileUrl;
      if (w) {
        const i = encodeURIComponent(
          $(
            `${window.location.origin}${u.url}?fullfilename=${u.name}`
          )
        );
        f.value = `${w}/onlinePreview?url=${i}`;
      }
    }
  };
}
const Pe = U({
  name: "SyGridFileUpload",
  props: A(),
  setup(e) {
    const t = S("sy-grid-file-upload"), {
      value: s,
      data: o,
      controller: r
    } = _(e), {
      downloadUrl: n,
      uploadUrl: l,
      valueList: d
    } = H({
      value: s,
      data: o,
      controller: r
    }), {
      fileList: p,
      showModal: v,
      modalTitle: y,
      iframeUrl: h,
      previewFile: C,
      onModalCancel: g
    } = J({
      downloadUrl: n,
      uploadUrl: l,
      value: d
    });
    return {
      ns: t,
      fileList: p,
      showModal: v,
      modalTitle: y,
      iframeUrl: h,
      downloadFile: (F) => {
        e.controller.fileDownload(F);
      },
      previewFile: C,
      onModalCancel: g
    };
  },
  render() {
    return c("grid-editor", {
      attrs: {
        disabled: this.disabled,
        readonly: this.readonly
      },
      class: [this.ns.b(), this.disabled ? this.ns.m("disabled") : "", this.readonly ? this.ns.m("readonly") : ""]
    }, [c("div", {
      class: this.ns.b("file-list")
    }, [this.fileList.map((e) => c("div", {
      class: this.ns.b("file-item"),
      key: e.id
    }, [c("div", {
      class: this.ns.b("file-item-title"),
      on: {
        click: () => this.previewFile(e)
      }
    }, [e.name]), c("div", {
      class: this.ns.b("file-item-action")
    }, [c("i-icon", {
      attrs: {
        type: "md-download"
      },
      on: {
        click: () => this.downloadFile(e)
      }
    }), c("i-icon", {
      attrs: {
        type: "md-eye"
      },
      on: {
        click: () => this.previewFile(e)
      }
    })])]))]), c("i-modal", {
      attrs: {
        value: this.showModal,
        title: this.modalTitle,
        "class-name": this.ns.b("modal"),
        width: "70%",
        transfer: !1,
        "footer-hide": !0
      },
      on: {
        "on-cancel": this.onModalCancel
      }
    }, [c("iframe", {
      class: this.ns.b("iframe"),
      attrs: {
        src: this.iframeUrl
      }
    })])]);
  }
}), Ne = U({
  name: "SyGridFileUploadContainer",
  props: A(),
  render(e) {
    return this.disabled || this.readonly ? e("SyGridFileUpload", {
      props: {
        ...this.$props
      }
    }) : e("SyEditGridFileUpload", {
      props: {
        ...this.$props
      }
    });
  }
});
const Le = U({
  name: "SyEditGridFileUploadPopover",
  props: {
    uploadUrl: {
      type: String,
      required: !0
    },
    downloadUrl: {
      type: String,
      required: !0
    },
    value: {
      type: Array,
      required: !0
    },
    controller: {
      type: V,
      required: !0
    }
  },
  emits: {
    close: (e) => !0
  },
  setup(e, {
    emit: t
  }) {
    const s = S("sy-edit-grid-file-upload-popover"), {
      downloadUrl: o,
      value: r,
      uploadUrl: n
    } = _(e), {
      fileList: l,
      uploadState: d,
      selectFile: p
    } = J({
      downloadUrl: o,
      value: r,
      uploadUrl: n
    }), v = m(), y = m(!1), h = ie(v, async (f) => {
      t("close", {
        isModified: y.value,
        resultFiles: l.value
      });
    });
    return T(d, (f) => {
      f === "done" ? (y.value = !0, h.proceed()) : f === "loading" && h.pause();
    }), {
      ns: s,
      componentRef: v,
      fileList: l,
      deleteFile: (f) => {
        const F = l.value.findIndex((E) => E.id === f.id);
        l.value.splice(F, 1), y.value = !0;
      },
      selectFile: p,
      downloadFile: (f) => {
        e.controller.fileDownload(f);
      }
    };
  },
  render() {
    return c("div", {
      ref: "componentRef",
      style: "width:300px",
      class: this.ns.b()
    }, [c("div", {
      class: this.ns.b("file-list")
    }, [this.fileList.map((e) => c("div", {
      class: this.ns.b("file-item"),
      key: e.id
    }, [c("div", {
      class: this.ns.b("file-item-title"),
      on: {
        click: () => this.downloadFile(e)
      }
    }, [e.name]), c("div", {
      class: this.ns.b("file-item-action")
    }, [c("i-icon", {
      attrs: {
        type: "md-close"
      },
      on: {
        click: () => this.deleteFile(e)
      }
    })])]))]), c("div", {
      on: {
        click: () => this.selectFile()
      },
      class: this.ns.e("button")
    }, [c("i-icon", {
      attrs: {
        type: "md-add"
      }
    }), "\u6DFB\u52A0\u6587\u4EF6"])]);
  }
});
const _e = U({
  name: "SyEditGridFileUpload",
  props: A(),
  emits: re(),
  setup(e, {
    emit: t
  }) {
    const s = S("sy-edit-grid-file-upload"), {
      value: o,
      data: r,
      controller: n
    } = _(e), {
      downloadUrl: l,
      uploadUrl: d,
      valueList: p
    } = H({
      value: o,
      data: r,
      controller: n
    }), v = m(), y = async () => {
      if (!v.value)
        throw new he("\u5BB9\u5668\u5143\u7D20\u4E0D\u5B58\u5728");
      const h = v.value.$el, C = h.offsetHeight, g = ibiz.overlay.createPopover((E) => E(Le, {
        props: {
          value: p.value,
          uploadUrl: d.value,
          downloadUrl: l.value,
          controller: n.value
        },
        on: {
          close: (u) => {
            g.dismiss(u);
          }
        }
      }), void 0, {
        noArrow: !0,
        placement: "bottom-start",
        offsetOpts: {
          mainAxis: -C,
          crossAxis: 0
        }
      });
      await g.present(h);
      const {
        isModified: f,
        resultFiles: F
      } = await g.onWillDismiss();
      if (f) {
        const E = F.length > 0 ? JSON.stringify(F.map((u) => ({
          name: u.name,
          id: u.id
        }))) : null;
        t("change", E), t("rowSave");
      }
    };
    return ne(v, "click", (h) => {
      e.disabled || y();
    }), {
      ns: s,
      valueList: p,
      componentRef: v
    };
  },
  render() {
    return c("grid-editor", {
      attrs: {
        disabled: this.disabled,
        readonly: this.readonly
      },
      ref: "componentRef",
      class: this.ns.b()
    }, [c("div", {
      class: this.ns.b("file-list")
    }, [this.valueList.map((e) => c("div", {
      class: this.ns.b("file-item"),
      key: e.id
    }, [c("div", {
      class: this.ns.b("file-item-title")
    }, [e.name])]))])]);
  }
});
class Ae {
  constructor() {
    k(this, "component", ye);
  }
}
class Be {
  constructor() {
    k(this, "component", ve);
  }
  async createController(t, s) {
    const o = new O(t, s);
    return await o.init(), o;
  }
}
class Ge {
  constructor() {
    k(this, "component", "IndexView");
  }
}
const Y = U({
  name: "WFStepTraceGrid",
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    },
    deName: {
      type: String,
      required: !0
    }
  },
  setup(e) {
    const {
      proxy: t
    } = N(), s = ae(t, e.modelPath);
    z(t, "deName", s.setDeName.bind(s));
    const o = S("wf-step-trace-grid"), r = m([]);
    s.nerve.self.evt.on("mounted", () => {
      var l;
      !s.data || (l = s.data.usertasks) == null || l.forEach((d) => {
        d.identitylinks.length > 0 || (d.comments.length > 0 && d.comments.forEach((p) => {
          r.value.push({
            nodeName: d.userTaskName,
            personName: p.authorName,
            time: p.time,
            content: p.type,
            comment: p.fullMessage
          });
        }), r.value.sort((p, v) => Date.parse(v.time) - Date.parse(p.time)));
      });
    });
    const n = m([{
      title: "\u5904\u7406\u73AF\u8282",
      key: "nodeName",
      width: 180,
      resizable: !0
    }, {
      title: "\u5904\u7406\u4EBA",
      key: "personName",
      width: 180,
      resizable: !0
    }, {
      title: "\u5904\u7406\u65F6\u95F4",
      key: "time",
      width: 180,
      resizable: !0
    }, {
      title: "\u5904\u7406\u5185\u5BB9",
      key: "content",
      width: 180,
      resizable: !0
    }, {
      title: "\u5904\u7406\u610F\u89C1",
      key: "comment"
    }]);
    return {
      c: s,
      ns: o,
      gridData: r,
      columns: n
    };
  },
  render() {
    return c("div", {
      class: this.ns.b()
    }, [c("div", {
      class: this.ns.e("title")
    }, ["\u5BA1\u6279\u4FE1\u606F"]), c("i-table", {
      attrs: {
        "disabled-hover": !0,
        columns: this.columns,
        data: this.gridData
      },
      class: this.ns.e("grid")
    })]);
  }
}), We = U({
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    }
  },
  setup(e) {
    const {
      proxy: t
    } = N(), s = le(t, e.modelPath), o = S(`view-${be.DE_WF_DYNA_EDIT_VIEW3}`.toLowerCase()), r = m(["mainForm"]);
    return {
      c: s,
      ns: o,
      onTabClick: (l) => {
        r.value.includes(l) || r.value.push(l);
      },
      lazyList: r
    };
  },
  render(e) {
    const t = [];
    if (this.c.complete) {
      const {
        activeForm: s
      } = this.c;
      s && this.c.providers[s.name] && t.push(e(this.c.providers[s.name].component, {
        props: {
          modelData: s,
          context: this.c.context,
          params: this.c.params
        },
        style: {
          height: "auto"
        },
        on: {
          neuronInit: this.c.nerve.onNeuronInit("form")
        }
      }));
    }
    if (this.c.complete && this.c.model.drTab.pages[0]) {
      const s = this.c.model.drTab.pages[0], o = this.c.drPages[s.source.name];
      t.push(e(Y, {
        attrs: {
          context: o.context,
          params: o.params,
          deName: this.c.model.appEntity.source.codeName,
          modal: this.modal,
          modelPath: s.embedView.source.modelPath
        }
      }));
    }
    return e("view-base", {
      attrs: {
        controller: this.c
      },
      scopedSlots: {
        toolbar: () => this.c.complete ? [this.c.wfLinks.length > 0 && e("wf-toolbar", {
          attrs: {
            wfLinks: this.c.wfLinks
          },
          on: {
            "wf-link-click": (s) => {
              this.c.onLinkClick(s);
            }
          }
        })] : null
      }
    }, [this.c.complete && e("i-tabs", {
      class: [this.ns.be("", "tab")],
      attrs: {
        name: this.c.model.drTab.source.name
      },
      on: {
        "on-click": this.onTabClick
      }
    }, [e("i-tab-pane", {
      class: this.ns.be("", "tab-item"),
      attrs: {
        tab: this.c.model.drTab.source.name,
        label: this.c.model.drTab.source.editItemCaption,
        name: "mainForm"
      }
    }, [t]), this.c.model.drTab.pages.map((s) => {
      const o = this.c.drPages[s.source.name];
      return e("i-tab-pane", {
        class: this.ns.be("", "tab-item"),
        attrs: {
          tab: this.c.model.drTab.source.name,
          disabled: this.c.isNewData,
          label: s.source.caption,
          name: s.source.name
        }
      }, [!this.c.isNewData && this.lazyList.includes(s.source.name) && e("ViewShell", {
        props: {
          context: o.context,
          params: o.params,
          modal: {
            mode: R.EMBED
          },
          modelPath: s.embedView.source.modelPath,
          deName: this.c.model.appEntity.source.codeName
        },
        on: {
          neuronInit: this.c.nerve.onNeuronInit(s.source.name)
        },
        key: o.key
      })]);
    })])]);
  }
});
class Me {
  constructor() {
    k(this, "component", We);
  }
}
const Oe = U({
  name: "SyEditView3",
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    }
  },
  setup(e) {
    const {
      proxy: t
    } = N(), s = ce(t, e.modelPath), o = S("view-deeditview3"), r = m(["mainForm"]);
    return {
      c: s,
      ns: o,
      onTabClick: (l) => {
        r.value.includes(l) || r.value.push(l);
      },
      lazyList: r
    };
  },
  render(e) {
    return e("view-base", {
      attrs: {
        controller: this.c
      }
    }, [this.c.complete && e("i-tabs", {
      class: [this.ns.be("", "tab")],
      attrs: {
        name: this.c.model.drTab.source.name
      },
      on: {
        "on-click": this.onTabClick
      }
    }, [e("i-tab-pane", {
      class: this.ns.be("", "tab-item"),
      attrs: {
        tab: this.c.model.drTab.source.name,
        label: this.c.model.drTab.source.editItemCaption,
        name: "mainForm"
      }
    }, [e("edit-form-control", {
      attrs: {
        modelData: this.c.model.form,
        context: this.c.context,
        params: this.c.params
      },
      style: {
        height: "auto"
      },
      on: {
        neuronInit: this.c.nerve.onNeuronInit(this.c.model.form.source.name)
      }
    }), e(Y, {
      attrs: {
        context: this.c.drPages[this.c.model.drTab.pages[0].source.name].context,
        params: this.c.drPages[this.c.model.drTab.pages[0].source.name].params,
        deName: this.c.model.appEntity.source.codeName,
        modal: this.modal,
        modelPath: this.c.model.drTab.pages[0].embedView.source.modelPath
      }
    })]), this.c.model.drTab.pages.map((t) => {
      const s = this.c.drPages[t.source.name];
      if (!!s)
        return e("i-tab-pane", {
          class: this.ns.be("", "tab-item"),
          attrs: {
            tab: this.c.model.drTab.source.name,
            disabled: this.c.isNewData,
            label: t.source.caption,
            name: t.source.name
          }
        }, [!this.c.isNewData && this.lazyList.includes(t.source.name) && e("ViewShell", {
          props: {
            context: s.context,
            params: s.params,
            modal: {
              mode: R.EMBED
            },
            modelPath: t.embedView.source.modelPath,
            deName: this.c.model.appEntity.source.codeName
          },
          on: {
            neuronInit: this.c.nerve.onNeuronInit(t.source.name)
          },
          key: s.key
        })]);
    })])]);
  }
});
class Ve {
  constructor() {
    k(this, "component", Oe);
  }
}
class ze {
  constructor() {
    k(this, "formEditor", "SyFileUpload");
    k(this, "gridEditor", "SyGridFileUploadContainer");
  }
  async createController(t, s) {
    const o = new V(t, s);
    return await o.init(), o;
  }
}
const Xe = {
  mateUrl: import.meta.url,
  install(e) {
    ibiz.config.enableDataInfoBar = !1, ibiz.config.gridEditShowMode = "all", e.component("WfToolbar", ge), ibiz.register.view.register(
      "VIEW_CUSTOM_SyWebIndexView",
      new Ge()
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_PresetWFChartView",
      new Ae()
    ), ibiz.register.gridColumn.register(
      "GRID_COLRENDER_CodeListGridColumn",
      new Be()
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_SyWfDynaEditView3",
      new Me()
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_SyEditView3",
      new Ve()
    ), e.component("SyFileUpload", De), e.component("SyGridFileUpload", Pe), e.component("SyEditGridFileUpload", _e), e.component("SyGridFileUploadContainer", Ne), ibiz.register.editor.register(
      "EDITOR_CUSTOMSTYLE_SyFileUpload",
      new ze()
    );
  }
};
export {
  Xe as default
};
