var se = Object.defineProperty;
var oe = (e, t, s) => t in e ? se(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
var k = (e, t, s) => (oe(e, typeof t != "symbol" ? t + "" : t, s), s);
import { GridFieldColumnController as R, GridRowController as ie, WFStepTraceViewController as re, UploadEditorController as $ } from "@ibiz-template/controller";
import { defineComponent as U, computed as V, h as d, getCurrentInstance as G, ref as p, watch as T, toRefs as W } from "vue";
import { useNamespace as x, useViewController as ne, usePropsWatch as j, getUploadProps as ae, getEditorEmits as le, getGridUploadProps as A, getGridEditorEmits as q, useClickOutside as ce, useEventListener as de, useWFStepTraceViewController as ue, useWFDynaEditView3Controller as me, useEditView3Controller as pe } from "@ibiz-template/vue-util";
import { colorBlend as he, HttpError as H, isImage as fe, uploadFile as be, RuntimeError as ve } from "@ibiz-template/core";
import { getCookie as we } from "qx-util";
import { ViewMode as J, PluginStaticResource as ye } from "@ibiz-template/runtime";
import { ViewType as ge } from "@ibiz-template/model";
const Fe = U({
  name: "CodeListGridColumn",
  props: {
    controller: {
      type: R,
      required: !0
    },
    row: {
      type: ie,
      required: !0
    }
  },
  setup(e) {
    const t = x("grid-field-column"), s = V(() => {
      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 && l.length && n ? n.split(",").map((f) => {
        const w = e.controller.codeListItems.find((h) => h.value === f);
        if (w) {
          const h = w.color || "#515a6e";
          return {
            text: w.text,
            colorStyle: t.cssVarBlock({
              color: h,
              "border-color": h,
              "bg-color": he(h, "#fff")
            })
          };
        }
      }).filter(Boolean) : [];
    }), o = (n) => {
      e.controller.isLinkColumn && e.controller.openLinkView(e.row, n);
    }, r = V(() => {
      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 d("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) => d("span", {
      class: this.ns.e("code-list-item"),
      style: s.colorStyle
    }, [s.text])) : d("span", {
      class: this.ns.e("text")
    }, [t])]);
  }
});
class Ce extends re {
  constructor() {
    super(...arguments);
    /**
     * 流程图url
     *
     * @type {string}
     * @memberof PresetWFChartViewController
     */
    k(this, "imgSrc");
  }
  async getUIData() {
    const s = Object.assign(this.context.clone(), this.params), o = await this.entityService.wf.getWFProcessDiagram(s), r = new Blob([o.data]);
    this.imgSrc = URL.createObjectURL(r);
  }
}
const Ue = 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 = x("preset-wf-chart-view"), {
      proxy: s
    } = G(), o = ne(s, (r, n) => new Ce(e.modelPath, r, n));
    return j(s, "deName", o.setDeName.bind(o)), {
      c: o,
      ns: t
    };
  },
  render() {
    return d("div", {
      class: this.ns.b()
    }, [d("img", {
      attrs: {
        src: this.c.imgSrc
      }
    })]);
  }
});
const Se = U({
  name: "WFToolbar",
  props: {
    wfLinks: {
      type: Array,
      required: !0
    }
  },
  setup(e, {
    emit: t
  }) {
    return {
      ns: x("wf-toolbar"),
      handleClick: async (r, n) => {
        t("wf-link-click", r, n);
      }
    };
  },
  render() {
    const e = this.wfLinks || [];
    return d("div", {
      class: `${this.ns.b()}`
    }, [e.length > 0 && e.map((t) => {
      const s = t.sequenceFlowName == "驳回" || t.sequenceFlowName == "取消";
      return d("div", {
        key: t.sequenceFlowId,
        class: [this.ns.e("item"), s ? this.ns.em("item", "reject") : ""]
      }, [d("i-button", {
        attrs: {
          title: t.sequenceFlowName
        },
        on: {
          click: (o) => this.handleClick(t, o)
        }
      }, [t.sequenceFlowName || ""])]);
    })]);
  }
}), xe = typeof btoa == "function", M = typeof Buffer == "function";
typeof TextDecoder == "function" && new TextDecoder();
const z = typeof TextEncoder == "function" ? new TextEncoder() : void 0, Ee = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", I = Array.prototype.slice.call(Ee);
((e) => {
  let t = {};
  return e.forEach((s, o) => t[s] = o), t;
})(I);
const S = String.fromCharCode.bind(String);
typeof Uint8Array.from == "function" && Uint8Array.from.bind(Uint8Array);
const ke = (e) => e.replace(/=/g, "").replace(/[+\/]/g, (t) => t == "+" ? "-" : "_"), Te = (e) => {
  let t, s, o, r, n = "";
  const l = e.length % 3;
  for (let c = 0; c < e.length; ) {
    if ((s = e.charCodeAt(c++)) > 255 || (o = e.charCodeAt(c++)) > 255 || (r = e.charCodeAt(c++)) > 255)
      throw new TypeError("invalid character found");
    t = s << 16 | o << 8 | r, n += I[t >> 18 & 63] + I[t >> 12 & 63] + I[t >> 6 & 63] + I[t & 63];
  }
  return l ? n.slice(0, l - 3) + "===".substring(l) : n;
}, Y = xe ? (e) => btoa(e) : M ? (e) => Buffer.from(e, "binary").toString("base64") : Te, Pe = M ? (e) => Buffer.from(e).toString("base64") : (e) => {
  let s = [];
  for (let o = 0, r = e.length; o < r; o += 4096)
    s.push(S.apply(null, e.subarray(o, o + 4096)));
  return Y(s.join(""));
}, Ie = (e) => {
  if (e.length < 2) {
    var t = e.charCodeAt(0);
    return t < 128 ? e : t < 2048 ? S(192 | t >>> 6) + S(128 | t & 63) : S(224 | t >>> 12 & 15) + S(128 | t >>> 6 & 63) + S(128 | t & 63);
  } else {
    var t = 65536 + (e.charCodeAt(0) - 55296) * 1024 + (e.charCodeAt(1) - 56320);
    return S(240 | t >>> 18 & 7) + S(128 | t >>> 12 & 63) + S(128 | t >>> 6 & 63) + S(128 | t & 63);
  }
}, De = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g, Le = (e) => e.replace(De, Ie), B = M ? (e) => Buffer.from(e, "utf8").toString("base64") : z ? (e) => Pe(z.encode(e)) : (e) => Y(Le(e)), K = (e, t = !1) => t ? ke(B(e)) : B(e);
function Ne(e, t, s) {
  var P;
  const o = p([]), r = p({
    Authorization: `Bearer ${we("access_token")}`
  }), n = p(""), l = p(""), c = {
    count: 0,
    cacheFiles: []
    // iview上传过程中不能改default-file-list,所以需要缓存
  }, u = (P = s.editorParams) == null ? void 0 : P.blackList;
  let f = [];
  u && typeof u == "string" && (f = u.split(",")), 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 && 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 w = () => {
    const i = [...o.value, ...c.cacheFiles], a = i.length > 0 ? JSON.stringify(i.map((m) => ({ name: m.name, id: m.id }))) : null;
    c.cacheFiles = [], t(a);
  }, h = (i) => {
    const a = i.name.trim().toLowerCase();
    if (f.some((v) => a.endsWith(`.${v}`)))
      return ibiz.message.error(`不可上传 ${f.join("、")}类型的文件！`), !1;
    c.count += 1;
  }, F = (i) => {
    i && (c.cacheFiles.push({
      name: i.filename,
      id: i.fileid
    }), c.count -= 1, c.count === 0 && w());
  }, C = (i, a) => {
    throw c.count -= 1, new H({
      response: { data: a, status: i.status }
      // eslint-disable-next-line @typescript-eslint/no-explicit-any
    });
  }, E = (i) => {
    if (e.disabled)
      return;
    const a = o.value.findIndex((m) => m.id === i.id);
    a !== -1 && o.value.splice(a, 1), w();
  }, b = (i) => {
    const a = i.url || l.value.replace("%fileId%", i.id);
    s.fileDownload({ url: a, name: i.name });
  }, g = p(!1), y = p(""), D = p("");
  return {
    uploadUrl: n,
    downloadUrl: l,
    headers: r,
    files: o,
    onDownload: b,
    onError: C,
    onRemove: E,
    onSuccess: F,
    beforeUpload: h,
    showModal: g,
    modalTitle: y,
    iframeUrl: D,
    onModalCancel: () => {
      g.value = !1, y.value = "", D.value = "";
    },
    previewFile: (i) => {
      g.value = !0, y.value = i.name;
      const a = window.Environment.previewFileUrl;
      if (a) {
        const m = encodeURIComponent(
          K(
            `${window.location.origin}${i.url}?fullfilename=${i.name}`
          )
        );
        D.value = `${a}/onlinePreview?url=${m}`;
      }
    }
  };
}
const _e = U({
  name: "SyFileUpload",
  props: ae(),
  emits: le(),
  setup(e, {
    emit: t
  }) {
    const s = x("sy-file-upload"), o = e.controller, {
      uploadUrl: r,
      headers: n,
      files: l,
      onDownload: c,
      onError: u,
      onRemove: f,
      onSuccess: w,
      beforeUpload: h,
      showModal: F,
      modalTitle: C,
      iframeUrl: E,
      onModalCancel: b,
      previewFile: g
    } = Ne(e, (y) => {
      t("change", y);
    }, o);
    return {
      ns: s,
      c: o,
      uploadUrl: r,
      headers: n,
      files: l,
      onDownload: c,
      onError: u,
      onRemove: f,
      onSuccess: w,
      beforeUpload: h,
      showModal: F,
      modalTitle: C,
      iframeUrl: E,
      onModalCancel: b,
      previewFile: g
    };
  },
  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", ["将文件拖到此处，或"]), e("span", ["点击上传"])])]) : e("i-button", {
      attrs: {
        icon: "ios-cloud-upload-outline"
      },
      class: this.ns.bm("box", "select")
    }, ["上传文件"])]), 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-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 _(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 = fe(e.name);
  }
  return e;
}
function Q(e) {
  const t = p(""), s = p(""), o = p([]);
  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) => {
        _(n, s.value);
      });
    },
    { immediate: !0 }
  ), T(
    s,
    (r) => {
      r && o.value.length && o.value.forEach((n) => {
        _(n, r);
      });
    },
    { immediate: !0 }
  ), {
    downloadUrl: s,
    uploadUrl: t,
    valueList: o
  };
}
function X(e) {
  var O, P;
  const t = p("undo"), s = p([]), { downloadUrl: o, value: r, uploadUrl: n, controller: l } = e, c = (P = (O = l == null ? void 0 : l.value) == null ? void 0 : O.editorParams) == null ? void 0 : P.blackList;
  let u = [];
  c && typeof c == "string" && (u = c.split(",")), T(
    r,
    (i) => {
      i.length > 0 && (s.value = [], i.forEach((a) => {
        s.value.push(_(a, o.value));
      }));
    },
    {
      immediate: !0,
      deep: !0
    }
  );
  const f = (i, a) => {
    const m = [];
    return a.forEach((v, L) => {
      const N = v.name.trim().toLowerCase();
      if (u.some((te) => N.endsWith(`.${te}`))) {
        m.push(L);
        return;
      }
      s.value.push({
        name: v.name,
        status: v.status,
        percentage: v.percentage,
        id: v.uid,
        url: ""
      });
    }), m.length === a.length ? (ibiz.message.error(`不可上传 ${u.join("、")}类型的文件！`), !1) : (m.length && (m.forEach((v) => {
      i.splice(v, 1), a.splice(v, 1);
    }), ibiz.message.error(`不可上传 ${u.join("、")}类型的文件！`)), !0);
  }, w = (i) => {
    i.forEach((a) => {
      s.value.find((m) => m.id === a.uid ? (m.percentage = a.percentage, !0) : !1);
    });
  }, h = (i, a) => {
    i.forEach((m) => {
      s.value.find((v) => v.id === m.uid ? (v.status = m.status, v.id = a.data.fileid, v.name = a.data.filename, _(v, o.value), !0) : !1);
    });
  }, F = (i, a) => {
    var v;
    i.forEach((L) => {
      s.value.find((N) => N.id === L.uid ? (N.status = L.status, !0) : !1);
    });
    const m = new H(a);
    ibiz.notification.error({
      title: (v = m.status) == null ? void 0 : v.toString(),
      desc: m.message,
      duration: 10
    });
  }, C = (i) => {
    s.value = s.value.filter((a) => a.status === "finished"), t.value = "done";
  }, E = () => {
    be({
      multiple: e.multiple,
      accept: e.accept,
      uploadUrl: n.value,
      beforeUpload: f,
      progress: w,
      success: h,
      error: F,
      finish: C
    });
  }, b = p(!1), g = p(""), y = p("");
  return {
    selectFile: E,
    fileList: s,
    uploadState: t,
    showModal: b,
    modalTitle: g,
    iframeUrl: y,
    onModalCancel: () => {
      b.value = !1, g.value = "", y.value = "";
    },
    previewFile: (i) => {
      b.value = !0, g.value = i.name;
      const a = window.Environment.previewFileUrl;
      if (a) {
        const m = encodeURIComponent(
          K(
            `${window.location.origin}${i.url}?fullfilename=${i.name}`
          )
        );
        y.value = `${a}/onlinePreview?url=${m}`;
      }
    }
  };
}
const Ge = U({
  name: "SyGridFileUpload",
  props: A(),
  setup(e) {
    const t = x("sy-grid-file-upload"), {
      value: s,
      data: o,
      controller: r
    } = W(e), {
      downloadUrl: n,
      uploadUrl: l,
      valueList: c
    } = Q({
      value: s,
      data: o,
      controller: r
    }), {
      fileList: u,
      showModal: f,
      modalTitle: w,
      iframeUrl: h,
      previewFile: F,
      onModalCancel: C
    } = X({
      downloadUrl: n,
      uploadUrl: l,
      value: c
    });
    return {
      ns: t,
      fileList: u,
      showModal: f,
      modalTitle: w,
      iframeUrl: h,
      downloadFile: (b) => {
        e.controller.fileDownload(b);
      },
      previewFile: F,
      onModalCancel: C
    };
  },
  render() {
    return d("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") : ""]
    }, [d("div", {
      class: this.ns.b("file-list")
    }, [this.fileList.map((e) => d("div", {
      class: this.ns.b("file-item"),
      key: e.id
    }, [d("div", {
      class: this.ns.b("file-item-title"),
      on: {
        click: () => this.previewFile(e)
      }
    }, [e.name]), d("div", {
      class: this.ns.b("file-item-action")
    }, [d("i-icon", {
      attrs: {
        type: "md-download"
      },
      on: {
        click: () => this.downloadFile(e)
      }
    }), d("i-icon", {
      attrs: {
        type: "md-eye"
      },
      on: {
        click: () => this.previewFile(e)
      }
    })])]))]), d("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
      }
    }, [d("iframe", {
      class: this.ns.b("iframe"),
      attrs: {
        src: this.iframeUrl
      }
    })])]);
  }
}), Oe = U({
  name: "SyGridFileUploadContainer",
  props: A(),
  emits: q(),
  render(e) {
    return this.disabled || this.readonly ? e("SyGridFileUpload", {
      props: {
        ...this.$props
      }
    }) : e("SyEditGridFileUpload", {
      props: {
        ...this.$props
      },
      on: {
        change: (t, s) => {
          this.$emit("change", t, s);
        },
        rowSave: () => {
          this.$emit("rowSave");
        }
      }
    });
  }
});
const We = U({
  name: "SyEditGridFileUploadPopover",
  props: {
    uploadUrl: {
      type: String,
      required: !0
    },
    downloadUrl: {
      type: String,
      required: !0
    },
    value: {
      type: Array,
      required: !0
    },
    controller: {
      type: $,
      required: !0
    }
  },
  emits: {
    close: (e) => !0
  },
  setup(e, {
    emit: t
  }) {
    const s = x("sy-edit-grid-file-upload-popover"), {
      downloadUrl: o,
      value: r,
      uploadUrl: n,
      controller: l
    } = W(e), {
      fileList: c,
      uploadState: u,
      selectFile: f
    } = X({
      downloadUrl: o,
      value: r,
      uploadUrl: n,
      controller: l
    }), w = p(), h = p(!1), F = ce(w, async (b) => {
      t("close", {
        isModified: h.value,
        resultFiles: c.value
      });
    });
    return T(u, (b) => {
      b === "done" ? (h.value = !0, F.proceed()) : b === "loading" && F.pause();
    }), {
      ns: s,
      componentRef: w,
      fileList: c,
      deleteFile: (b) => {
        const g = c.value.findIndex((y) => y.id === b.id);
        c.value.splice(g, 1), h.value = !0;
      },
      selectFile: f,
      downloadFile: (b) => {
        e.controller.fileDownload(b);
      }
    };
  },
  render() {
    return d("div", {
      ref: "componentRef",
      style: "width:300px",
      class: this.ns.b()
    }, [d("div", {
      class: this.ns.b("file-list")
    }, [this.fileList.map((e) => d("div", {
      class: this.ns.b("file-item"),
      key: e.id
    }, [d("div", {
      class: this.ns.b("file-item-title"),
      on: {
        click: () => this.downloadFile(e)
      }
    }, [e.name]), d("div", {
      class: this.ns.b("file-item-action")
    }, [d("i-icon", {
      attrs: {
        type: "md-close"
      },
      on: {
        click: () => this.deleteFile(e)
      }
    })])]))]), d("div", {
      on: {
        click: () => this.selectFile()
      },
      class: this.ns.e("button")
    }, [d("i-icon", {
      attrs: {
        type: "md-add"
      }
    }), "添加文件"])]);
  }
});
const Ae = U({
  name: "SyEditGridFileUpload",
  props: A(),
  emits: q(),
  setup(e, {
    emit: t
  }) {
    const s = x("sy-edit-grid-file-upload"), {
      value: o,
      data: r,
      controller: n
    } = W(e), {
      downloadUrl: l,
      uploadUrl: c,
      valueList: u
    } = Q({
      value: o,
      data: r,
      controller: n
    }), f = p(), w = async () => {
      if (!f.value)
        throw new ve("容器元素不存在");
      const h = f.value.$el, F = h.offsetHeight, C = ibiz.overlay.createPopover((g) => g(We, {
        props: {
          value: u.value,
          uploadUrl: c.value,
          downloadUrl: l.value,
          controller: n.value
        },
        on: {
          close: (y) => {
            C.dismiss(y);
          }
        }
      }), void 0, {
        noArrow: !0,
        placement: "bottom-start",
        offsetOpts: {
          mainAxis: -F,
          crossAxis: 0
        }
      });
      await C.present(h);
      const {
        isModified: E,
        resultFiles: b
      } = await C.onWillDismiss();
      if (E) {
        const g = b.length > 0 ? JSON.stringify(b.map((y) => ({
          name: y.name,
          id: y.id
        }))) : null;
        t("change", g), t("rowSave");
      }
    };
    return de(f, "click", (h) => {
      e.disabled || w();
    }), {
      ns: s,
      valueList: u,
      componentRef: f
    };
  },
  render() {
    return d("grid-editor", {
      attrs: {
        disabled: this.disabled,
        readonly: this.readonly
      },
      ref: "componentRef",
      class: this.ns.b()
    }, [d("div", {
      class: this.ns.b("file-list")
    }, [this.valueList.map((e) => d("div", {
      class: this.ns.b("file-item"),
      key: e.id
    }, [d("div", {
      class: this.ns.b("file-item-title")
    }, [e.name])]))])]);
  }
});
class Me {
  constructor() {
    k(this, "component", Ue);
  }
}
class Ve {
  constructor() {
    k(this, "component", Fe);
  }
  async createController(t, s) {
    const o = new R(t, s);
    return await o.init(), o;
  }
}
class ze {
  constructor() {
    k(this, "component", "IndexView");
  }
}
const Z = 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
    } = G(), s = ue(t, e.modelPath);
    j(t, "deName", s.setDeName.bind(s));
    const o = x("wf-step-trace-grid"), r = p([]);
    s.nerve.self.evt.on("mounted", () => {
      var l;
      s.data && ((l = s.data.usertasks) == null || l.forEach((c) => {
        c.identitylinks.length > 0 || (c.comments.length > 0 && c.comments.forEach((u) => {
          r.value.push({
            nodeName: c.userTaskName,
            personName: u.authorName,
            time: u.time,
            content: u.type,
            comment: u.fullMessage
          });
        }), r.value.sort((u, f) => Date.parse(f.time) - Date.parse(u.time)));
      }));
    });
    const n = p([{
      title: "处理环节",
      key: "nodeName",
      width: 180,
      resizable: !0
    }, {
      title: "处理人",
      key: "personName",
      width: 180,
      resizable: !0
    }, {
      title: "处理时间",
      key: "time",
      width: 180,
      resizable: !0
    }, {
      title: "处理内容",
      key: "content",
      width: 180,
      resizable: !0
    }, {
      title: "处理意见",
      key: "comment"
    }]);
    return {
      c: s,
      ns: o,
      gridData: r,
      columns: n
    };
  },
  render() {
    return d("div", {
      class: this.ns.b()
    }, [d("div", {
      class: this.ns.e("title")
    }, ["审批信息"]), d("i-table", {
      attrs: {
        "disabled-hover": !0,
        columns: this.columns,
        data: this.gridData
      },
      class: this.ns.e("grid")
    })]);
  }
}), Be = U({
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    }
  },
  setup(e) {
    const {
      proxy: t
    } = G(), s = me(t, e.modelPath), o = x(`view-${ge.DE_WF_DYNA_EDIT_VIEW3}`.toLowerCase()), r = p(["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(Z, {
        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", {
        attrs: {
          context: o.context,
          params: o.params,
          modal: {
            mode: J.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 Re {
  constructor() {
    k(this, "component", Be);
  }
}
const $e = U({
  name: "SyEditView3",
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    }
  },
  setup(e) {
    const {
      proxy: t
    } = G(), s = pe(t, e.modelPath), o = x("view-deeditview3"), r = p(["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(Z, {
      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", {
          attrs: {
            context: s.context,
            params: s.params,
            modal: {
              mode: J.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 je {
  constructor() {
    k(this, "component", $e);
  }
}
class qe {
  constructor() {
    k(this, "formEditor", "SyFileUpload");
    k(this, "gridEditor", "SyGridFileUploadContainer");
  }
  async createController(t, s) {
    const o = new $(t, s);
    return await o.init(), o;
  }
}
const He = new ye(import.meta.url), ot = {
  mateUrl: import.meta.url,
  install(e) {
    He.loadStyle(["/style.css"]), ibiz.config.enableDataInfoBar = !1, ibiz.config.gridEditShowMode = "all", e.component("WfToolbar", Se), ibiz.register.view.register(
      "VIEW_CUSTOM_SyWebIndexView",
      new ze()
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_PresetWFChartView",
      new Me()
    ), ibiz.register.gridColumn.register(
      "GRID_COLRENDER_CodeListGridColumn",
      new Ve()
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_SyWfDynaEditView3",
      new Re()
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_SyEditView3",
      new je()
    ), e.component("SyFileUpload", _e), e.component("SyGridFileUpload", Ge), e.component("SyEditGridFileUpload", Ae), e.component("SyGridFileUploadContainer", Oe), ibiz.register.editor.register(
      "EDITOR_CUSTOMSTYLE_SyFileUpload",
      new qe()
    );
  }
};
export {
  ot as default
};
