@rytass/bpm-core-react 0.17.9 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +8 -0
  3. package/dist/chunks/{FormBuilderView-ClLnQ1e_.js → FormBuilderView-BVKY1j_0.js} +504 -452
  4. package/dist/chunks/FormBuilderView-BVKY1j_0.js.map +1 -0
  5. package/dist/chunks/FormBuilderView-SrGltzFT.cjs +3 -0
  6. package/dist/chunks/FormBuilderView-SrGltzFT.cjs.map +1 -0
  7. package/dist/chunks/approver-filled-form-Dm3Iw7iw.cjs +2 -0
  8. package/dist/chunks/approver-filled-form-Dm3Iw7iw.cjs.map +1 -0
  9. package/dist/chunks/{approver-filled-form-DuQGPtNB.js → approver-filled-form-ZEwpmsHJ.js} +21 -8
  10. package/dist/chunks/approver-filled-form-ZEwpmsHJ.js.map +1 -0
  11. package/dist/chunks/{compose-jnvnnVfN.js → compose-B1GlrZW9.js} +3 -3
  12. package/dist/chunks/{compose-jnvnnVfN.js.map → compose-B1GlrZW9.js.map} +1 -1
  13. package/dist/chunks/{compose-Cock_B2Q.cjs → compose-DZk-SfHT.cjs} +2 -2
  14. package/dist/chunks/{compose-Cock_B2Q.cjs.map → compose-DZk-SfHT.cjs.map} +1 -1
  15. package/dist/chunks/{designer-B8Gvew_k.js → designer-BCLrjb4H.js} +886 -851
  16. package/dist/chunks/designer-BCLrjb4H.js.map +1 -0
  17. package/dist/chunks/designer-BYYxEN9L.cjs +65 -0
  18. package/dist/chunks/designer-BYYxEN9L.cjs.map +1 -0
  19. package/dist/chunks/{detail-CExpbazF.js → detail-4F39ggBn.js} +580 -572
  20. package/dist/chunks/detail-4F39ggBn.js.map +1 -0
  21. package/dist/chunks/detail-BkMtA_0K.cjs +2 -0
  22. package/dist/chunks/detail-BkMtA_0K.cjs.map +1 -0
  23. package/dist/pages/instances/detail/index.cjs +1 -1
  24. package/dist/pages/instances/detail/index.js +1 -1
  25. package/dist/pages/templates/compose/index.cjs +1 -1
  26. package/dist/pages/templates/compose/index.js +1 -1
  27. package/dist/pages/templates/designer/index.cjs +1 -1
  28. package/dist/pages/templates/designer/index.js +1 -1
  29. package/dist/views/forms/builder/index.cjs +1 -1
  30. package/dist/views/forms/builder/index.js +1 -1
  31. package/dist/views/instances/detail/index.cjs +1 -1
  32. package/dist/views/instances/detail/index.js +1 -1
  33. package/dist/views/instances/new/index.cjs +1 -1
  34. package/dist/views/instances/new/index.cjs.map +1 -1
  35. package/dist/views/instances/new/index.js +15 -11
  36. package/dist/views/instances/new/index.js.map +1 -1
  37. package/dist/views/templates/compose/index.cjs +1 -1
  38. package/dist/views/templates/compose/index.js +1 -1
  39. package/dist/views/templates/designer/index.cjs +1 -1
  40. package/dist/views/templates/designer/index.js +1 -1
  41. package/package.json +3 -3
  42. package/dist/chunks/FormBuilderView-CUOyS07f.cjs +0 -3
  43. package/dist/chunks/FormBuilderView-CUOyS07f.cjs.map +0 -1
  44. package/dist/chunks/FormBuilderView-ClLnQ1e_.js.map +0 -1
  45. package/dist/chunks/approver-filled-form-D1DmqDVP.cjs +0 -2
  46. package/dist/chunks/approver-filled-form-D1DmqDVP.cjs.map +0 -1
  47. package/dist/chunks/approver-filled-form-DuQGPtNB.js.map +0 -1
  48. package/dist/chunks/designer-B8Gvew_k.js.map +0 -1
  49. package/dist/chunks/designer-CAEFV1ve.cjs +0 -65
  50. package/dist/chunks/designer-CAEFV1ve.cjs.map +0 -1
  51. package/dist/chunks/detail-CExpbazF.js.map +0 -1
  52. package/dist/chunks/detail-DIY-L4i-.cjs +0 -2
  53. package/dist/chunks/detail-DIY-L4i-.cjs.map +0 -1
@@ -5,7 +5,7 @@ import { t as n } from "./bpm-form-field-Cao0rMol.js";
5
5
  import { t as r } from "./use-bpm-member-D57LKe_u.js";
6
6
  import { t as i } from "./format-member-label-DudVI55w.js";
7
7
  import { t as a } from "./task-node-label-CWZgOBj0.js";
8
- import { a as o, c as s, i as c, l, n as u, o as d, r as f, s as p, t as ee, u as te } from "./approver-filled-form-DuQGPtNB.js";
8
+ import { a as o, c as s, i as c, l, n as u, o as d, r as f, s as p, t as ee, u as te } from "./approver-filled-form-ZEwpmsHJ.js";
9
9
  import { o as m, t as ne } from "./FormRendererView-BsTwZkqU.js";
10
10
  import '../style.css';import '../detail.css';/* empty css */
11
11
  import { Fragment as re, forwardRef as ie, useCallback as h, useEffect as g, useImperativeHandle as ae, useMemo as _, useRef as v, useState as y } from "react";
@@ -15,12 +15,13 @@ import { cancelAdhocDirective as ye, cancelApprovalInstance as be, configureAdho
15
15
  import Le from "@mezzanine-ui/react/ContentHeader";
16
16
  import { CheckedIcon as Re, ChevronLeftIcon as ze, ChevronRightIcon as Be, DangerousOutlineIcon as Ve, DownloadIcon as He, FileSearchIcon as Ue, NotificationUnreadIcon as We, PlusIcon as Ge, RefreshCcwIcon as Ke, ResetIcon as qe, ShareIcon as A, UserIcon as Je, ZoomInIcon as Ye, ZoomOutIcon as j } from "@mezzanine-ui/icons";
17
17
  import { readNodeFillableFieldKeys as Xe, readRevealedFieldKeys as Ze, readTopLevelFieldKey as Qe, resolveFieldAccess as $e } from "@rytass/bpm-core-shared";
18
- import { buildFormRendererValues as et, focusFormRendererField as tt, readFormDataSourceErrorMessage as M, validateFormRendererValues as nt } from "@rytass/bpm-core-client/form";
18
+ import { buildFormRendererValues as et, focusFormRendererField as tt, readFormDataSourceErrorMessage as M, validateFormRendererValuesInWorker as nt } from "@rytass/bpm-core-client/form";
19
19
  import { Background as rt, Controls as N, Handle as P, Position as F, ReactFlow as it } from "@xyflow/react";
20
- import * as I from "dagre";
21
- import { Document as at, Page as ot } from "react-pdf";
22
- import { stepClasses as L } from "@mezzanine-ui/core/stepper";
23
- var R = {
20
+ import * as at from "dagre";
21
+ import { Document as ot, Page as st } from "react-pdf";
22
+ import { readSelectableReturnTargetNodeIds as ct } from "@rytass/bpm-core-shared/workflow-graph";
23
+ import { stepClasses as I } from "@mezzanine-ui/core/stepper";
24
+ var L = {
24
25
  root: "bpm_root_ehm7w",
25
26
  toolbar: "bpm_toolbar_R-tis",
26
27
  pageControls: "bpm_pageControls_jM-rC",
@@ -29,9 +30,9 @@ var R = {
29
30
  viewport: "bpm_viewport_DQXms",
30
31
  page: "bpm_page_Cv5Rg",
31
32
  state: "bpm_state_bpgp3"
32
- }, st = 760, ct = 920, lt = 320, ut = 32, dt = .75, ft = 1.75, pt = .25;
33
- function mt({ filename: e, fileUrl: t, onDownload: n }) {
34
- let r = v(null), [i, a] = y(null), [o, s] = y(1), [c, l] = y(1), [u, d] = y(st);
33
+ }, lt = 760, ut = 920, dt = 320, ft = 32, R = .75, pt = 1.75, mt = .25;
34
+ function ht({ filename: e, fileUrl: t, onDownload: n }) {
35
+ let r = v(null), [i, a] = y(null), [o, s] = y(1), [c, l] = y(1), [u, d] = y(lt);
35
36
  g(() => {
36
37
  let e = r.current;
37
38
  if (!e || typeof ResizeObserver > "u") return;
@@ -44,19 +45,19 @@ function mt({ filename: e, fileUrl: t, onDownload: n }) {
44
45
  a(null), s(1), l(1);
45
46
  }, [t]);
46
47
  let f = _(() => {
47
- let e = Math.max(lt, u - ut);
48
- return Math.round(Math.min(ct, e) * c);
48
+ let e = Math.max(dt, u - ft);
49
+ return Math.round(Math.min(ut, e) * c);
49
50
  }, [c, u]), p = h((e) => {
50
51
  a(e.numPages), s(1);
51
- }, []), ee = o > 1, te = i !== null && o < i, m = c > dt, ne = c < ft, re = i === null ? `第 ${o} 頁` : `第 ${o} / ${i} 頁`, ie = `${Math.round(c * 100)}%`;
52
+ }, []), ee = o > 1, te = i !== null && o < i, m = c > R, ne = c < pt, re = i === null ? `第 ${o} 頁` : `第 ${o} / ${i} 頁`, ie = `${Math.round(c * 100)}%`;
52
53
  return /* @__PURE__ */ D("section", {
53
54
  "aria-label": `${e} PDF 預覽`,
54
- className: R.root,
55
+ className: L.root,
55
56
  children: [/* @__PURE__ */ D("div", {
56
- className: R.toolbar,
57
+ className: L.toolbar,
57
58
  children: [
58
59
  /* @__PURE__ */ D("div", {
59
- className: R.pageControls,
60
+ className: L.pageControls,
60
61
  "aria-label": "頁面切換",
61
62
  children: [
62
63
  /* @__PURE__ */ E(b, {
@@ -70,7 +71,7 @@ function mt({ filename: e, fileUrl: t, onDownload: n }) {
70
71
  variant: "base-secondary"
71
72
  }),
72
73
  /* @__PURE__ */ E(T, {
73
- className: R.counter,
74
+ className: L.counter,
74
75
  component: "span",
75
76
  variant: "body",
76
77
  children: re
@@ -88,7 +89,7 @@ function mt({ filename: e, fileUrl: t, onDownload: n }) {
88
89
  ]
89
90
  }),
90
91
  /* @__PURE__ */ D("div", {
91
- className: R.zoomControls,
92
+ className: L.zoomControls,
92
93
  "aria-label": "縮放",
93
94
  children: [
94
95
  /* @__PURE__ */ E(b, {
@@ -96,13 +97,13 @@ function mt({ filename: e, fileUrl: t, onDownload: n }) {
96
97
  disabled: !m,
97
98
  icon: j,
98
99
  onClick: () => {
99
- l((e) => Math.max(dt, e - pt));
100
+ l((e) => Math.max(R, e - mt));
100
101
  },
101
102
  size: "minor",
102
103
  variant: "base-secondary"
103
104
  }),
104
105
  /* @__PURE__ */ E(T, {
105
- className: R.counter,
106
+ className: L.counter,
106
107
  component: "span",
107
108
  variant: "body",
108
109
  children: ie
@@ -112,7 +113,7 @@ function mt({ filename: e, fileUrl: t, onDownload: n }) {
112
113
  disabled: !ne,
113
114
  icon: Ye,
114
115
  onClick: () => {
115
- l((e) => Math.min(ft, e + pt));
116
+ l((e) => Math.min(pt, e + mt));
116
117
  },
117
118
  size: "minor",
118
119
  variant: "base-secondary"
@@ -129,18 +130,18 @@ function mt({ filename: e, fileUrl: t, onDownload: n }) {
129
130
  }) : null
130
131
  ]
131
132
  }), /* @__PURE__ */ E("div", {
132
- className: R.viewport,
133
+ className: L.viewport,
133
134
  ref: r,
134
- children: /* @__PURE__ */ E(at, {
135
- error: /* @__PURE__ */ E(ht, { message: "PDF 無法載入。" }),
135
+ children: /* @__PURE__ */ E(ot, {
136
+ error: /* @__PURE__ */ E(gt, { message: "PDF 無法載入。" }),
136
137
  file: t,
137
- loading: /* @__PURE__ */ E(ht, { message: "正在載入 PDF..." }),
138
- noData: /* @__PURE__ */ E(ht, { message: "沒有可預覽的 PDF。" }),
138
+ loading: /* @__PURE__ */ E(gt, { message: "正在載入 PDF..." }),
139
+ noData: /* @__PURE__ */ E(gt, { message: "沒有可預覽的 PDF。" }),
139
140
  onLoadSuccess: p,
140
141
  suspense: !1,
141
- children: /* @__PURE__ */ E(ot, {
142
- className: R.page,
143
- loading: /* @__PURE__ */ E(ht, { message: "正在載入頁面..." }),
142
+ children: /* @__PURE__ */ E(st, {
143
+ className: L.page,
144
+ loading: /* @__PURE__ */ E(gt, { message: "正在載入頁面..." }),
144
145
  pageNumber: o,
145
146
  renderAnnotationLayer: !0,
146
147
  renderTextLayer: !0,
@@ -150,9 +151,9 @@ function mt({ filename: e, fileUrl: t, onDownload: n }) {
150
151
  })]
151
152
  });
152
153
  }
153
- function ht({ message: e }) {
154
+ function gt({ message: e }) {
154
155
  return /* @__PURE__ */ E("div", {
155
- className: R.state,
156
+ className: L.state,
156
157
  children: /* @__PURE__ */ E(T, {
157
158
  color: "text-neutral",
158
159
  variant: "body",
@@ -162,117 +163,120 @@ function ht({ message: e }) {
162
163
  }
163
164
  //#endregion
164
165
  //#region src/views/instances/detail/submitted-by.ts
165
- function gt({ initiatorMemberId: e, submittedByMemberId: t }) {
166
+ function _t({ initiatorMemberId: e, submittedByMemberId: t }) {
166
167
  return t && t !== e ? t : null;
167
168
  }
168
- function _t(e, t) {
169
- let n = gt(e);
169
+ function vt(e, t) {
170
+ let n = _t(e);
170
171
  if (!n || !e.initiatorMemberId) return null;
171
172
  let r = (e) => t.get(e)?.name ?? e;
172
173
  return `由 ${r(n)} 代 ${r(e.initiatorMemberId)} 送出`;
173
174
  }
174
175
  //#endregion
175
176
  //#region src/views/instances/detail/sections/shared.ts
176
- function vt(e) {
177
- let t = B(e, "from"), n = B(e, "to"), r = B(e, "reason");
177
+ function yt(e) {
178
+ let t = z(e, "from"), n = z(e, "to"), r = z(e, "reason");
178
179
  return !t || !n || !r ? null : {
179
180
  from: t,
180
181
  reason: r,
181
- ruleId: B(e, "ruleId"),
182
+ ruleId: z(e, "ruleId"),
182
183
  to: n
183
184
  };
184
185
  }
185
- function z(e) {
186
+ function bt(e) {
186
187
  try {
187
188
  let t = JSON.parse(e);
188
- return Array.isArray(t) ? t.map((e) => bt(e) ? vt(e) : null).filter((e) => e !== null) : [];
189
+ return Array.isArray(t) ? t.map((e) => St(e) ? yt(e) : null).filter((e) => e !== null) : [];
189
190
  } catch {
190
191
  return [];
191
192
  }
192
193
  }
193
- function B(e, t) {
194
+ function z(e, t) {
194
195
  let n = e[t];
195
196
  return typeof n == "string" ? n : null;
196
197
  }
197
- function V(e, t) {
198
+ function B(e, t) {
198
199
  let n = e[t];
199
200
  return Array.isArray(n) ? n.filter((e) => typeof e == "string") : [];
200
201
  }
201
- function yt(e, t) {
202
+ function xt(e, t) {
202
203
  let n = e[t];
203
204
  return typeof n == "number" ? n : null;
204
205
  }
205
- function H(e) {
206
+ function V(e) {
206
207
  return typeof e == "string" && e.trim().length > 0;
207
208
  }
208
- function bt(e) {
209
+ function St(e) {
209
210
  return typeof e == "object" && !!e;
210
211
  }
211
- function xt(e) {
212
+ function Ct(e) {
212
213
  return e.status === "PENDING" || e.status === "IN_PROGRESS";
213
214
  }
214
- function U(e) {
215
+ function H(e) {
215
216
  return M(e) || (e instanceof Error ? e.message : "發生未知錯誤");
216
217
  }
217
- function St(e) {
218
+ function wt(e) {
218
219
  return !Number.isFinite(e) || e <= 0 ? "-" : e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1024 / 1024).toFixed(1)} MB`;
219
220
  }
220
- function W(e) {
221
+ function Tt(e) {
221
222
  return e.length > 16 ? `${e.slice(0, 12)}...` : e;
222
223
  }
223
- function Ct(e) {
224
+ function Et(e) {
224
225
  return e === "APPROVED" ? "已同意" : e === "CANCELLED" ? "已取消" : e === "DRAFT" ? "草稿" : e === "EXPIRED" ? "已逾期" : e === "REJECTED" ? "已拒絕" : e === "RETURNED" ? "已退回" : e === "RUNNING" ? "進行中" : e;
225
226
  }
226
- function wt(e) {
227
+ function U(e) {
227
228
  return e === "PENDING" ? "待處理" : e === "IN_PROGRESS" ? "處理中" : e === "COMPLETED" ? "已完成" : e === "CANCELLED" ? "已取消" : e === "TRANSFERRED" ? "已轉派" : e;
228
229
  }
229
- function Tt(e) {
230
+ function Dt(e) {
230
231
  return e === "APPROVED" ? "同意" : e === "REJECTED" ? "拒絕" : e === "RETURNED" ? "退回" : e === "TRANSFERRED" ? "轉派" : e;
231
232
  }
232
- function Et(e) {
233
+ function Ot(e) {
233
234
  return e === "startEvent" ? "開始" : e === "endEvent" ? "完成" : e === "userTask" ? "簽核節點" : e === "serviceTask" ? "知會節點" : e === "exclusiveGateway" ? "條件分流" : "平行處理";
234
235
  }
235
- function Dt(e, t) {
236
+ function kt(e, t) {
236
237
  return t?.nodes.find((t) => t.id === e)?.data.label ?? e;
237
238
  }
238
- function G(e, t) {
239
+ function W(e, t) {
239
240
  if (!e) return "-";
240
241
  let n = t.get(e);
241
242
  return n ? i(n.name, n.email, "fullwidth") : e;
242
243
  }
243
- function K(e, t = /* @__PURE__ */ new Map()) {
244
- let n = z(e.delegationChainJson);
245
- if (!e.assigneeMemberId) return e.candidateMemberIds.length ? `候選 ${e.candidateMemberIds.map((e) => G(e, t)).join("、")}` : "未指定";
246
- let r = G(e.assigneeMemberId, t), i = G(e.originalAssigneeMemberId, t);
244
+ function At(e, t = /* @__PURE__ */ new Map()) {
245
+ let n = bt(e.delegationChainJson);
246
+ if (!e.assigneeMemberId) return e.candidateMemberIds.length ? `候選 ${e.candidateMemberIds.map((e) => W(e, t)).join("、")}` : "未指定";
247
+ let r = W(e.assigneeMemberId, t), i = W(e.originalAssigneeMemberId, t);
247
248
  return n.length === 0 || e.originalAssigneeMemberId === e.assigneeMemberId ? r : `${r}(原:${i})`;
248
249
  }
249
- function q(e, t) {
250
+ function G(e, t) {
250
251
  return t ? e.assigneeMemberId === t || (e.openCandidateMemberIds ?? e.candidateMemberIds).includes(t) : !1;
251
252
  }
252
- function Ot(e, t) {
253
- let n = e.filter((e) => q(e, t) && (e.status === "PENDING" || e.status === "IN_PROGRESS"));
253
+ function jt(e, t) {
254
+ let n = e.filter((e) => G(e, t) && (e.status === "PENDING" || e.status === "IN_PROGRESS"));
254
255
  return n.find((e) => !e.isAdhoc) ?? n[0] ?? null;
255
256
  }
256
- function kt(e, t) {
257
+ function K(e, t) {
257
258
  if (t.type !== "userTask" || !t.data.returnBehavior.allowReturn) return [];
258
- if (t.data.returnBehavior.allowedTargets === "ANY") return e.nodes.filter((e) => e.id !== t.id).map((e) => ({
259
- id: e.id,
260
- name: `${e.data.label}(${Et(e.type)})`
261
- }));
259
+ if (t.data.returnBehavior.allowedTargets === "ANY") {
260
+ let n = ct(e, t.id);
261
+ return e.nodes.filter((e) => n.includes(e.id)).map((e) => ({
262
+ id: e.id,
263
+ name: `${e.data.label}(${Ot(e.type)})`
264
+ }));
265
+ }
262
266
  let n = t.data.returnBehavior.allowedTargets === "INITIATOR" ? e.nodes.find((e) => e.type === "startEvent")?.id : e.edges.find((e) => e.target === t.id)?.source, r = e.nodes.find((e) => e.id === n);
263
267
  return r ? [{
264
268
  id: r.id,
265
- name: `${r.data.label}(${Et(r.type)})`
269
+ name: `${r.data.label}(${Ot(r.type)})`
266
270
  }] : [];
267
271
  }
268
- function At(e) {
272
+ function Mt(e) {
269
273
  return {
270
274
  email: e.email,
271
275
  id: e.memberId,
272
276
  name: i(e.name, e.email, "dot")
273
277
  };
274
278
  }
275
- function jt({ memberIds: e, useWebhookTarget: t, webhookUrl: n }) {
279
+ function Nt({ memberIds: e, useWebhookTarget: t, webhookUrl: n }) {
276
280
  if (t) {
277
281
  let e = n.trim();
278
282
  return e ? {
@@ -297,11 +301,11 @@ function jt({ memberIds: e, useWebhookTarget: t, webhookUrl: n }) {
297
301
  valid: !1
298
302
  };
299
303
  }
300
- function Mt(e) {
304
+ function Pt(e) {
301
305
  return !!e;
302
306
  }
303
- function Nt(e) {
304
- if (!bt(e)) return null;
307
+ function Ft(e) {
308
+ if (!St(e)) return null;
305
309
  let t = e.email, n = e.id, r = e.name;
306
310
  return typeof n == "string" && typeof r == "string" ? {
307
311
  email: typeof t == "string" ? t : null,
@@ -309,7 +313,7 @@ function Nt(e) {
309
313
  name: r
310
314
  } : null;
311
315
  }
312
- function Pt(e, t) {
316
+ function It(e, t) {
313
317
  let n = e.trim().toLocaleLowerCase();
314
318
  if (!n) return null;
315
319
  let r = t.filter((e) => [
@@ -319,21 +323,21 @@ function Pt(e, t) {
319
323
  ].some((e) => e.toLocaleLowerCase().includes(n)));
320
324
  return r.length === 1 ? r[0] ?? null : null;
321
325
  }
322
- function J(e) {
323
- return H(e) ? {
326
+ function q(e) {
327
+ return V(e) ? {
324
328
  text: e,
325
329
  type: "text"
326
330
  } : null;
327
331
  }
328
- function Ft(e, t, n = "neutral") {
329
- return H(t) ? {
332
+ function J(e, t, n = "neutral") {
333
+ return V(t) ? {
330
334
  label: e,
331
335
  text: t,
332
336
  tone: n,
333
337
  type: "comment"
334
338
  } : null;
335
339
  }
336
- function It(e, t, n, r) {
340
+ function Lt(e, t, n, r) {
337
341
  let i = t ? n.get(t) : null;
338
342
  return {
339
343
  email: i?.email ?? null,
@@ -346,40 +350,40 @@ function It(e, t, n, r) {
346
350
  function Y(e) {
347
351
  return !!e;
348
352
  }
349
- function Lt(e) {
353
+ function Rt(e) {
350
354
  let t = e.findIndex((e) => e.id.startsWith("pending-task-") || e.id.startsWith("future-node-"));
351
355
  return t === -1 ? e.length : t;
352
356
  }
353
- function Rt(e) {
354
- return e.eventType === "INSTANCE_STARTED" || e.eventType === "INSTANCE_CANCELLED" || e.eventType === "INSTANCE_EXPIRED" || e.eventType === "INSTANCE_RESUBMITTED" || e.eventType === "TASK_DECIDED" || e.eventType === "SLA_TRIGGERED" || e.eventType === "TASK_CANDIDATE_ACTIVATED" || e.eventType === "TASK_REASSIGNED" || zt(e) || Z(e.eventType, Ut(e));
355
- }
356
357
  function zt(e) {
357
- return e.eventType === "TASK_CREATED" && V(Ut(e), "sequentialCandidateMemberIds").length > 0;
358
+ return e.eventType === "INSTANCE_STARTED" || e.eventType === "INSTANCE_CANCELLED" || e.eventType === "INSTANCE_EXPIRED" || e.eventType === "INSTANCE_RESUBMITTED" || e.eventType === "TASK_DECIDED" || e.eventType === "SLA_TRIGGERED" || e.eventType === "TASK_CANDIDATE_ACTIVATED" || e.eventType === "TASK_REASSIGNED" || Bt(e) || X(e.eventType, Wt(e));
358
359
  }
359
360
  function Bt(e) {
361
+ return e.eventType === "TASK_CREATED" && B(Wt(e), "sequentialCandidateMemberIds").length > 0;
362
+ }
363
+ function Vt(e) {
360
364
  if (e.eventType !== "TASK_CANDIDATE_ACTIVATED" && e.eventType !== "TASK_CREATED") return [];
361
- let t = Ut(e);
365
+ let t = Wt(e);
362
366
  return [
363
- ...V(t, "sequentialCandidateMemberIds"),
364
- B(t, "candidateMemberId"),
365
- B(t, "previousMemberId")
366
- ].filter(H);
367
+ ...B(t, "sequentialCandidateMemberIds"),
368
+ z(t, "candidateMemberId"),
369
+ z(t, "previousMemberId")
370
+ ].filter(V);
367
371
  }
368
- var X = /* @__PURE__ */ new Set([
372
+ var Ht = /* @__PURE__ */ new Set([
369
373
  "SERVICE_TASK_EXECUTED",
370
374
  "SERVICE_TASK_FAILED",
371
375
  "WEBHOOK_DELIVERY_RETRIED"
372
376
  ]);
373
- function Z(e, t) {
374
- return X.has(e) && B(t, "action") === "NOTIFY_WEBHOOK";
377
+ function X(e, t) {
378
+ return Ht.has(e) && z(t, "action") === "NOTIFY_WEBHOOK";
375
379
  }
376
- function Q(e) {
377
- return B(e, "endpointLabel") ?? B(e, "endpointKey") ?? "外部系統";
380
+ function Z(e) {
381
+ return z(e, "endpointLabel") ?? z(e, "endpointKey") ?? "外部系統";
378
382
  }
379
- function Vt(e) {
383
+ function Q(e) {
380
384
  return e === "APPROVED" ? "已同意" : e === "REJECTED" ? "已拒絕" : e === "RETURNED" ? "已退回" : e === "TRANSFERRED" ? "已轉派" : "簽核已決議";
381
385
  }
382
- function Ht(e, t) {
386
+ function Ut(e, t) {
383
387
  if (e === "INSTANCE_STARTED") return "案件已發起";
384
388
  if (e === "INSTANCE_CANCELLED") return "案件已取消";
385
389
  if (e === "INSTANCE_EXPIRED") return "案件逾期,已由系統終止";
@@ -389,85 +393,85 @@ function Ht(e, t) {
389
393
  if (e === "TOKEN_ADVANCED") return "流程已前進";
390
394
  if (e === "TASK_CREATED") return "待簽任務已建立";
391
395
  if (e === "TASK_CANDIDATE_ACTIVATED") return "輪到下一位簽核";
392
- if (e === "TASK_DECIDED") return Vt(B(t, "action"));
396
+ if (e === "TASK_DECIDED") return Q(z(t, "action"));
393
397
  if (e === "SLA_TRIGGERED") return "時限提醒已觸發";
394
398
  if (e === "TASK_REASSIGNED") return "管理者改派待辦";
395
- if (Z(e, t)) {
396
- let n = Q(t);
399
+ if (X(e, t)) {
400
+ let n = Z(t);
397
401
  return e === "SERVICE_TASK_EXECUTED" ? `已通知外部系統:${n}` : e === "SERVICE_TASK_FAILED" ? `通知外部系統失敗:${n}` : `管理者重新傳送外部系統通知:${n}`;
398
402
  }
399
403
  return e;
400
404
  }
401
- function Ut(e) {
405
+ function Wt(e) {
402
406
  try {
403
407
  let t = JSON.parse(e.payloadJson);
404
- return bt(t) ? t : {};
408
+ return St(t) ? t : {};
405
409
  } catch {
406
410
  return {};
407
411
  }
408
412
  }
409
- function Wt(e, t) {
410
- return e.eventType === "SLA_TRIGGERED" || e.eventType === "INSTANCE_EXPIRED" || e.eventType === "SERVICE_TASK_FAILED" && Z(e.eventType, t) || B(t, "action") === "REJECTED" || B(t, "instanceState") === "REJECTED";
413
+ function Gt(e, t) {
414
+ return e.eventType === "SLA_TRIGGERED" || e.eventType === "INSTANCE_EXPIRED" || e.eventType === "SERVICE_TASK_FAILED" && X(e.eventType, t) || z(t, "action") === "REJECTED" || z(t, "instanceState") === "REJECTED";
411
415
  }
412
- function Gt(e) {
416
+ function Kt(e) {
413
417
  return t(e);
414
418
  }
415
- function Kt(e, t, n, r) {
416
- if (e.eventType === "INSTANCE_STARTED") return _t({
419
+ function qt(e, t, n, r) {
420
+ if (e.eventType === "INSTANCE_STARTED") return vt({
417
421
  initiatorMemberId: e.actorMemberId,
418
- submittedByMemberId: B(t, "submittedByMemberId")
422
+ submittedByMemberId: z(t, "submittedByMemberId")
419
423
  }, r);
420
424
  if (e.eventType === "TASK_CANDIDATE_ACTIVATED") {
421
- let e = B(t, "candidateMemberId"), n = B(t, "previousMemberId");
425
+ let e = z(t, "candidateMemberId"), n = z(t, "previousMemberId");
422
426
  if (!e) return null;
423
- let i = G(e, r);
424
- return n ? `輪到:${i}(前一位:${G(n, r)})` : `輪到:${i}`;
427
+ let i = W(e, r);
428
+ return n ? `輪到:${i}(前一位:${W(n, r)})` : `輪到:${i}`;
425
429
  }
426
430
  if (e.eventType === "TASK_CREATED") {
427
- let e = V(t, "sequentialCandidateMemberIds");
428
- if (e.length) return `簽核順序:${e.map((e) => G(e, r)).join(" → ")}`;
429
- let n = B(t, "assigneeMemberId"), i = B(t, "originalAssigneeMemberId");
431
+ let e = B(t, "sequentialCandidateMemberIds");
432
+ if (e.length) return `簽核順序:${e.map((e) => W(e, r)).join(" → ")}`;
433
+ let n = z(t, "assigneeMemberId"), i = z(t, "originalAssigneeMemberId");
430
434
  if (!n) {
431
- let e = V(t, "candidateMemberIds");
432
- return e.length ? `候選簽核人:${e.map((e) => G(e, r)).join("、")}` : null;
435
+ let e = B(t, "candidateMemberIds");
436
+ return e.length ? `候選簽核人:${e.map((e) => W(e, r)).join("、")}` : null;
433
437
  }
434
- let a = G(n, r), o = G(i, r);
438
+ let a = W(n, r), o = W(i, r);
435
439
  return i && i !== n ? `待簽人:${a}(原簽核人:${o})` : `待簽人:${a}`;
436
440
  }
437
441
  if (e.eventType === "TASK_DECIDED") {
438
- let e = B(t, "action"), n = B(t, "comment"), i = e ? `決議:${Tt(e)}` : null, a = B(t, "transferToMemberId");
439
- return e === "REJECTED" && n ? [i, `拒絕原因:${n}`].filter(H).join(" · ") : e === "APPROVED" && n ? [i, `同意說明:${n}`].filter(H).join(" · ") : e === "TRANSFERRED" ? [i, `轉派給:${G(a, r)}`].filter(H).join(" · ") : i;
442
+ let e = z(t, "action"), n = z(t, "comment"), i = e ? `決議:${Dt(e)}` : null, a = z(t, "transferToMemberId");
443
+ return e === "REJECTED" && n ? [i, `拒絕原因:${n}`].filter(V).join(" · ") : e === "APPROVED" && n ? [i, `同意說明:${n}`].filter(V).join(" · ") : e === "TRANSFERRED" ? [i, `轉派給:${W(a, r)}`].filter(V).join(" · ") : i;
440
444
  }
441
445
  if (e.eventType === "TOKEN_ADVANCED") {
442
- let e = B(t, "action");
443
- if (e) return `流程結果:${Tt(e)}`;
444
- let r = yt(t, "arrivedCount"), i = yt(t, "requiredCount");
446
+ let e = z(t, "action");
447
+ if (e) return `流程結果:${Dt(e)}`;
448
+ let r = xt(t, "arrivedCount"), i = xt(t, "requiredCount");
445
449
  if (r !== null && i !== null) return `等待匯合:${r}/${i}`;
446
- let a = B(t, "fromNodeId"), o = B(t, "toNodeId");
447
- if (a && o) return `由 ${Dt(a, n)} 前進至 ${Dt(o, n)}`;
450
+ let a = z(t, "fromNodeId"), o = z(t, "toNodeId");
451
+ if (a && o) return `由 ${kt(a, n)} 前進至 ${kt(o, n)}`;
448
452
  }
449
453
  if (e.eventType === "ENGINE_PROCESS_REQUESTED") {
450
- let e = B(t, "state");
451
- return e ? `案件狀態:${Ct(e)}` : null;
454
+ let e = z(t, "state");
455
+ return e ? `案件狀態:${Et(e)}` : null;
452
456
  }
453
457
  return null;
454
458
  }
455
- function qt(e, t, n, r, i, a, o, s = null) {
456
- if (e.eventType === "INSTANCE_RESUBMITTED") return [Ft("簽核意見", B(t, "comment"))].filter(Y);
457
- if (e.eventType !== "TASK_DECIDED") return [J(Kt(e, t, n, o))].filter(Y);
458
- let c = e.taskId ? r.get(e.taskId) : null, l = B(t, "action") ?? c?.action ?? null, u = B(t, "comment") ?? c?.comment ?? null, d = B(t, "transferToMemberId") ?? c?.transferToMemberId ?? null, f = B(t, "signatureId") ?? c?.signatureId ?? null, p = f ? i.get(f) : null;
459
+ function Jt(e, t, n, r, i, a, o, s = null) {
460
+ if (e.eventType === "INSTANCE_RESUBMITTED") return [J("簽核意見", z(t, "comment"))].filter(Y);
461
+ if (e.eventType !== "TASK_DECIDED") return [q(qt(e, t, n, o))].filter(Y);
462
+ let c = e.taskId ? r.get(e.taskId) : null, l = z(t, "action") ?? c?.action ?? null, u = z(t, "comment") ?? c?.comment ?? null, d = z(t, "transferToMemberId") ?? c?.transferToMemberId ?? null, f = z(t, "signatureId") ?? c?.signatureId ?? null, p = f ? i.get(f) : null;
459
463
  return [
460
- J(l ? `決議:${Tt(l)}` : null),
461
- l === "REJECTED" ? Ft("拒絕原因", u ?? "-", "danger") : null,
462
- l === "APPROVED" ? Ft("同意說明", u) : null,
463
- l === "RETURNED" ? Ft("退回說明", u ?? "-") : null,
464
- l === "TRANSFERRED" ? J(`轉派給:${G(d, o)}`) : null,
465
- l === "TRANSFERRED" ? Ft("轉派說明", u ?? "-") : null,
466
- J(Jt(t, s)),
467
- p ? J(a?.valid ? `簽章:已驗證(${W(p.signedPayloadHash)})` : `簽章:待檢查(${W(p.signedPayloadHash)})`) : null
464
+ q(l ? `決議:${Dt(l)}` : null),
465
+ l === "REJECTED" ? J("拒絕原因", u ?? "-", "danger") : null,
466
+ l === "APPROVED" ? J("同意說明", u) : null,
467
+ l === "RETURNED" ? J("退回說明", u ?? "-") : null,
468
+ l === "TRANSFERRED" ? q(`轉派給:${W(d, o)}`) : null,
469
+ l === "TRANSFERRED" ? J("轉派說明", u ?? "-") : null,
470
+ q(Yt(t, s)),
471
+ p ? q(a?.valid ? `簽章:已驗證(${Tt(p.signedPayloadHash)})` : `簽章:待檢查(${Tt(p.signedPayloadHash)})`) : null
468
472
  ].filter(Y);
469
473
  }
470
- function Jt(e, t) {
474
+ function Yt(e, t) {
471
475
  let n = e.changedFieldKeys;
472
476
  if (!Array.isArray(n)) return null;
473
477
  let r = n.filter((e) => typeof e == "string" && e !== "");
@@ -475,86 +479,86 @@ function Jt(e, t) {
475
479
  let i = r.map((e) => t?.fields.find((t) => t.fieldKey === e)?.label || e);
476
480
  return `補填 ${r.length} 個欄位:${i.join("、")}`;
477
481
  }
478
- function Yt(e, t, n, r, i) {
482
+ function Xt(e, t, n, r, i) {
479
483
  if (e.type === "startEvent" || i.has(e.id)) return !1;
480
484
  if (r === "REJECTED") return !0;
481
- let a = on(e, t, n, r);
485
+ let a = sn(e, t, n, r);
482
486
  return a.tone === "neutral" || a.tone === "waiting";
483
487
  }
484
- function Xt(e, t, n, r, i) {
488
+ function Zt(e, t, n, r, i) {
485
489
  if (r !== "RUNNING" && r !== "REJECTED") return [];
486
- let a = e.nodes.filter((e) => Yt(e, t, n, r, i)), o = Zt(e, a, t, n, i), s = new Map(e.nodes.map((e, t) => [e.id, t]));
490
+ let a = e.nodes.filter((e) => Xt(e, t, n, r, i)), o = Qt(e, a, t, n, i), s = new Map(e.nodes.map((e, t) => [e.id, t]));
487
491
  return a.filter((e) => o.has(e.id)).sort((e, t) => {
488
492
  let n = o.get(e.id) ?? 0, r = o.get(t.id) ?? 0;
489
493
  return n === r ? e.position.x === t.position.x ? e.position.y === t.position.y ? (s.get(e.id) ?? 0) - (s.get(t.id) ?? 0) : e.position.y - t.position.y : e.position.x - t.position.x : n - r;
490
494
  });
491
495
  }
492
- function Zt(e, t, n, r, i) {
496
+ function Qt(e, t, n, r, i) {
493
497
  let a = new Set(t.map((e) => e.id)), o = e.edges.reduce((e, t) => {
494
498
  let n = [...e.get(t.source) ?? [], t.target];
495
499
  return new Map(e).set(t.source, n);
496
500
  }, /* @__PURE__ */ new Map());
497
- return Qt(e, n, r, i).reduce((e, t) => tn(e, $t(t, o, a)), /* @__PURE__ */ new Map());
501
+ return $t(e, n, r, i).reduce((e, t) => nn(e, en(t, o, a)), /* @__PURE__ */ new Map());
498
502
  }
499
- function Qt(e, t, n, r) {
500
- let i = n.filter((e) => e.status === "ACTIVE" || e.status === "WAITING").map((e) => e.currentNodeId), a = t.filter(xt).map((e) => e.nodeId), o = e.nodes.filter((e) => r.has(e.id)).map((e) => e.id), s = [.../* @__PURE__ */ new Set([
503
+ function $t(e, t, n, r) {
504
+ let i = n.filter((e) => e.status === "ACTIVE" || e.status === "WAITING").map((e) => e.currentNodeId), a = t.filter(Ct).map((e) => e.nodeId), o = e.nodes.filter((e) => r.has(e.id)).map((e) => e.id), s = [.../* @__PURE__ */ new Set([
501
505
  ...i,
502
506
  ...a,
503
507
  ...o
504
508
  ])], c = e.nodes.filter((e) => e.type === "startEvent").map((e) => e.id);
505
509
  return s.length > 0 ? s : c;
506
510
  }
507
- function $t(e, t, n) {
508
- return en([{
511
+ function en(e, t, n) {
512
+ return tn([{
509
513
  distance: 0,
510
514
  nodeId: e
511
515
  }], t, n);
512
516
  }
513
- function en(e, t, n, r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map()) {
517
+ function tn(e, t, n, r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map()) {
514
518
  let [a, ...o] = e;
515
519
  if (!a) return i;
516
- if (r.has(a.nodeId)) return en(o, t, n, r, i);
520
+ if (r.has(a.nodeId)) return tn(o, t, n, r, i);
517
521
  let s = new Set(r).add(a.nodeId), c = n.has(a.nodeId) ? new Map(i).set(a.nodeId, Math.min(i.get(a.nodeId) ?? a.distance, a.distance)) : i;
518
- return en([...o, ...(t.get(a.nodeId) ?? []).map((e) => ({
522
+ return tn([...o, ...(t.get(a.nodeId) ?? []).map((e) => ({
519
523
  distance: a.distance + 1,
520
524
  nodeId: e
521
525
  }))], t, n, s, c);
522
526
  }
523
- function tn(e, t) {
527
+ function nn(e, t) {
524
528
  return [...t.entries()].reduce((e, [t, n]) => new Map(e).set(t, Math.min(e.get(t) ?? n, n)), e);
525
529
  }
526
- function nn(e) {
530
+ function rn(e) {
527
531
  return e.type === "userTask" ? `未來簽核:${e.data.label}` : e.type === "serviceTask" ? `未來知會:${e.data.label}` : e.type === "exclusiveGateway" ? `未來分流:${e.data.label}` : e.type === "parallelGateway" ? `未來匯合:${e.data.label}` : e.type === "endEvent" ? `流程完成:${e.data.label}` : `未來節點:${e.data.label}`;
528
532
  }
529
- function rn(e, t, n, r, i, a, o, s, c, l = null) {
530
- let u = e.filter(Rt).map((e) => {
531
- let t = Ut(e), n = e.nodeId ? Dt(e.nodeId, r) : null;
533
+ function an(e, t, n, r, i, a, o, s, c, l = null) {
534
+ let u = e.filter(zt).map((e) => {
535
+ let t = Wt(e), n = e.nodeId ? kt(e.nodeId, r) : null;
532
536
  return {
533
537
  descriptionParts: [
534
- J(n ? `節點:${n}` : "節點:全流程"),
535
- It("操作者", e.actorMemberId, a, "系統"),
536
- J(`時間:${Gt(e.createdAt)}`),
537
- ...qt(e, t, r, o, s, c, a, l)
538
+ q(n ? `節點:${n}` : "節點:全流程"),
539
+ Lt("操作者", e.actorMemberId, a, "系統"),
540
+ q(`時間:${Kt(e.createdAt)}`),
541
+ ...Jt(e, t, r, o, s, c, a, l)
538
542
  ].filter(Y),
539
- error: Wt(e, t),
543
+ error: Gt(e, t),
540
544
  id: e.id,
541
- title: Ht(e.eventType, t)
545
+ title: Ut(e.eventType, t)
542
546
  };
543
- }), d = t.filter(xt).map((e) => ({
547
+ }), d = t.filter(Ct).map((e) => ({
544
548
  descriptionParts: [
545
- J(`節點:${Dt(e.nodeId, r)}`),
546
- It("處理者", e.assigneeMemberId, a, "未指定"),
547
- J(`建立時間:${Gt(e.createdAt)}`)
549
+ q(`節點:${kt(e.nodeId, r)}`),
550
+ Lt("處理者", e.assigneeMemberId, a, "未指定"),
551
+ q(`建立時間:${Kt(e.createdAt)}`)
548
552
  ].filter(Y),
549
553
  error: !1,
550
554
  id: `pending-task-${e.id}`,
551
555
  title: e.status === "IN_PROGRESS" ? "簽核處理中" : "等待簽核處理"
552
- })), f = new Set([...e.filter(Rt).map((e) => e.nodeId), ...t.map((e) => e.nodeId)].filter(H)), p = r ? Xt(r, t, n, i, f).map((e) => ({
553
- descriptionParts: [J(`${Et(e.type)} · 尚未抵達`)].filter(Y),
556
+ })), f = new Set([...e.filter(zt).map((e) => e.nodeId), ...t.map((e) => e.nodeId)].filter(V)), p = r ? Zt(r, t, n, i, f).map((e) => ({
557
+ descriptionParts: [q(`${Ot(e.type)} · 尚未抵達`)].filter(Y),
554
558
  error: !1,
555
559
  forcePending: !0,
556
560
  id: `future-node-${e.id}`,
557
- title: nn(e)
561
+ title: rn(e)
558
562
  })) : [];
559
563
  return [
560
564
  ...u,
@@ -562,7 +566,7 @@ function rn(e, t, n, r, i, a, o, s, c, l = null) {
562
566
  ...p
563
567
  ];
564
568
  }
565
- var an = {
569
+ var on = {
566
570
  APPROVED: {
567
571
  statusLabel: "已完成",
568
572
  tone: "completed"
@@ -580,20 +584,20 @@ var an = {
580
584
  tone: "cancelled"
581
585
  }
582
586
  };
583
- function on(e, t, n, r) {
587
+ function sn(e, t, n, r) {
584
588
  let i = t.filter((t) => t.nodeId === e.id), a = i.find((e) => e.status === "PENDING" || e.status === "IN_PROGRESS"), o = i.find((e) => e.status === "CANCELLED"), s = i.find((e) => e.status === "COMPLETED"), c = n.filter((t) => t.currentNodeId === e.id), l = c.find((e) => e.status === "ACTIVE"), u = c.find((e) => e.status === "WAITING");
585
589
  if (a) return {
586
- secondaryLabel: `處理者 ${K(a)}`,
590
+ secondaryLabel: `處理者 ${At(a)}`,
587
591
  statusLabel: "待處理",
588
592
  tone: "current"
589
593
  };
590
594
  if (o) return {
591
- secondaryLabel: `已取消 ${K(o)}`,
595
+ secondaryLabel: `已取消 ${At(o)}`,
592
596
  statusLabel: "已取消",
593
597
  tone: "cancelled"
594
598
  };
595
599
  if (s) return {
596
- secondaryLabel: `已完成 ${K(s)}`,
600
+ secondaryLabel: `已完成 ${At(s)}`,
597
601
  statusLabel: "已完成",
598
602
  tone: "completed"
599
603
  };
@@ -612,47 +616,47 @@ function on(e, t, n, r) {
612
616
  statusLabel: "已發起",
613
617
  tone: "completed"
614
618
  };
615
- let d = e.type === "endEvent" ? an[r] : void 0;
619
+ let d = e.type === "endEvent" ? on[r] : void 0;
616
620
  return d ? {
617
621
  ...d,
618
622
  secondaryLabel: r
619
623
  } : {
620
- secondaryLabel: Et(e.type),
624
+ secondaryLabel: Ot(e.type),
621
625
  statusLabel: "未抵達",
622
626
  tone: "neutral"
623
627
  };
624
628
  }
625
629
  //#endregion
626
630
  //#region src/views/instances/detail/sections/container-helpers.ts
627
- async function sn({ activityLogs: e, adhocDirectives: t = [], instance: n, tasks: r }) {
631
+ async function cn({ activityLogs: e, adhocDirectives: t = [], instance: n, tasks: r }) {
628
632
  let i = [...new Set([
629
633
  n?.initiatorMemberId ?? null,
630
634
  n?.submittedByMemberId ?? null,
631
635
  ...e.map((e) => e.actorMemberId),
632
- ...e.flatMap(Bt),
636
+ ...e.flatMap(Vt),
633
637
  ...r.map((e) => e.assigneeMemberId),
634
638
  ...r.map((e) => e.originalAssigneeMemberId),
635
639
  ...r.flatMap((e) => e.candidateMemberIds),
636
- ...r.flatMap((e) => z(e.delegationChainJson).flatMap((e) => [e.from, e.to])),
637
- ...t.flatMap((e) => [e.createdByMemberId, ...cn(e.targetValueJson)])
638
- ].filter(H))];
640
+ ...r.flatMap((e) => bt(e.delegationChainJson).flatMap((e) => [e.from, e.to])),
641
+ ...t.flatMap((e) => [e.createdByMemberId, ...ln(e.targetValueJson)])
642
+ ].filter(V))];
639
643
  try {
640
644
  return await Ne(i);
641
645
  } catch {
642
646
  return [];
643
647
  }
644
648
  }
645
- function cn(e) {
649
+ function ln(e) {
646
650
  try {
647
651
  return (JSON.parse(e).memberIds ?? []).filter((e) => typeof e == "string");
648
652
  } catch {
649
653
  return [];
650
654
  }
651
655
  }
652
- async function ln(e) {
656
+ async function un(e) {
653
657
  return (await Promise.all(e.map((e) => O(e.id)))).flat();
654
658
  }
655
- function un(e) {
659
+ function dn(e) {
656
660
  return e.reduce((e, t) => {
657
661
  let n = e.get(t.taskId), r = !n || new Date(t.decidedAt).getTime() > new Date(n.decidedAt).getTime() ? t : n;
658
662
  return new Map(e).set(t.taskId, r);
@@ -660,7 +664,7 @@ function un(e) {
660
664
  }
661
665
  //#endregion
662
666
  //#region src/views/instances/detail/use-resubmit-comment-draft.ts
663
- function dn(e) {
667
+ function fn(e) {
664
668
  let [t, n] = y({
665
669
  instanceId: e,
666
670
  text: ""
@@ -679,21 +683,21 @@ function dn(e) {
679
683
  }
680
684
  //#endregion
681
685
  //#region src/views/instances/detail/sections/InstanceFormSection.tsx
682
- var fn = {
686
+ var pn = {
683
687
  display: "grid",
684
688
  gap: 16
685
- }, pn = {
689
+ }, mn = {
686
690
  display: "flex",
687
691
  flexWrap: "wrap",
688
692
  gap: 8
689
- }, mn = 2e3, hn = {
693
+ }, hn = 2e3, gn = {
690
694
  minWidth: "100%",
691
695
  width: "100%"
692
696
  };
693
- function $(e) {
697
+ function _n(e) {
694
698
  e && (e.style.width = "100%");
695
699
  }
696
- function gn({ canResubmitInstance: e, deciding: t, error: r, fieldAccess: i, fieldLabelMarkers: a, fill: o = null, instance: s, loading: c, onDataSourceStateChange: l, onResubmitFormChange: d, onReloadAfterConflict: f = null, onResubmitCommentChange: p = null, onResubmitInstance: ee, onUploadAttachment: te, resubmitComment: m = "", resubmitFormData: re, resubmitFormErrors: ie }) {
700
+ function vn({ canResubmitInstance: e, deciding: t, error: r, fieldAccess: i, fieldLabelMarkers: a, fill: o = null, instance: s, loading: c, onDataSourceStateChange: l, onResubmitFormChange: d, onReloadAfterConflict: f = null, onResubmitCommentChange: p = null, onResubmitInstance: ee, onUploadAttachment: te, resubmitComment: m = "", resubmitFormData: re, resubmitFormErrors: ie }) {
697
701
  let h = s?.formDefinitionSnapshot.schema, g = s?.workflowSnapshot, ae = _(() => e && h && g ? u(h, g) : o?.schema ?? h, [
698
702
  e,
699
703
  o?.schema,
@@ -701,7 +705,7 @@ function gn({ canResubmitInstance: e, deciding: t, error: r, fieldAccess: i, fie
701
705
  g
702
706
  ]), v = !e && o !== null;
703
707
  return /* @__PURE__ */ D("div", {
704
- style: fn,
708
+ style: pn,
705
709
  children: [
706
710
  r ? /* @__PURE__ */ E(T, {
707
711
  color: "text-error",
@@ -714,12 +718,12 @@ function gn({ canResubmitInstance: e, deciding: t, error: r, fieldAccess: i, fie
714
718
  children: "載入中..."
715
719
  }) : null,
716
720
  f ? /* @__PURE__ */ D("div", {
717
- style: fn,
721
+ style: pn,
718
722
  children: [/* @__PURE__ */ E(S, {
719
723
  content: "表單在你填寫期間被更新了,你填的內容還在。請重新載入後確認再同意。",
720
724
  severity: "error"
721
725
  }), /* @__PURE__ */ E("div", {
722
- style: pn,
726
+ style: mn,
723
727
  children: /* @__PURE__ */ E(b, {
724
728
  disabled: c,
725
729
  icon: Ke,
@@ -762,16 +766,16 @@ function gn({ canResubmitInstance: e, deciding: t, error: r, fieldAccess: i, fie
762
766
  disabled: t,
763
767
  onChange: (e) => p(e.target.value),
764
768
  placeholder: "選填,例如說明這次補正或修改了哪些內容",
765
- maxLength: mn,
766
- ref: $,
769
+ maxLength: hn,
770
+ ref: _n,
767
771
  resize: "vertical",
768
772
  rows: 4,
769
- style: hn,
773
+ style: gn,
770
774
  value: m
771
775
  })
772
776
  }) : null,
773
777
  e ? /* @__PURE__ */ E("div", {
774
- style: pn,
778
+ style: mn,
775
779
  children: /* @__PURE__ */ E(b, {
776
780
  disabled: t,
777
781
  icon: Ke,
@@ -791,11 +795,11 @@ function gn({ canResubmitInstance: e, deciding: t, error: r, fieldAccess: i, fie
791
795
  }
792
796
  //#endregion
793
797
  //#region src/views/instances/detail/sections/InstanceAttachmentsSection.tsx
794
- var _n = {
798
+ var $ = {
795
799
  display: "grid",
796
800
  gap: 16
797
801
  };
798
- function vn({ attachments: e, onDownload: n, onPreview: r }) {
802
+ function yn({ attachments: e, onDownload: n, onPreview: r }) {
799
803
  let i = _(() => e.map((e) => ({
800
804
  attachment: e,
801
805
  createdAt: e.createdAt,
@@ -803,7 +807,7 @@ function vn({ attachments: e, onDownload: n, onPreview: r }) {
803
807
  id: e.id,
804
808
  key: e.id,
805
809
  mimeType: e.mimeType,
806
- sizeLabel: St(Number(e.sizeBytes))
810
+ sizeLabel: wt(Number(e.sizeBytes))
807
811
  })), [e]), a = _(() => [
808
812
  {
809
813
  dataIndex: "filename",
@@ -853,7 +857,7 @@ function vn({ attachments: e, onDownload: n, onPreview: r }) {
853
857
  width: 160
854
858
  }), [n, r]);
855
859
  return /* @__PURE__ */ D("div", {
856
- style: _n,
860
+ style: $,
857
861
  children: [/* @__PURE__ */ E(T, {
858
862
  component: "h2",
859
863
  variant: "h3",
@@ -872,63 +876,63 @@ function vn({ attachments: e, onDownload: n, onPreview: r }) {
872
876
  }
873
877
  //#endregion
874
878
  //#region src/views/instances/detail/sections/InstanceTasksSection.tsx
875
- var yn = {
879
+ var bn = {
876
880
  display: "grid",
877
881
  gap: 12,
878
882
  width: "100%"
879
- }, bn = {
883
+ }, xn = {
880
884
  minWidth: "100%",
881
885
  width: "100%"
882
- }, xn = {
886
+ }, Sn = {
883
887
  display: "grid",
884
888
  gap: 12,
885
889
  width: "100%"
886
- }, Sn = { marginTop: 12 }, Cn = { marginTop: 24 };
887
- function wn(e) {
890
+ }, Cn = { marginTop: 12 }, wn = { marginTop: 24 };
891
+ function Tn(e) {
888
892
  e && (e.style.width = "100%");
889
893
  }
890
- var Tn = {
894
+ var En = {
891
895
  COMPLETION_NOTIFY: "結案通知",
892
896
  COUNTERSIGN: "臨時會簽",
893
897
  PRE_APPROVAL: "臨時加簽",
894
898
  STAGE_NOTIFY: "階段完成通知"
895
- }, En = {
899
+ }, Dn = {
896
900
  COMPLETION_NOTIFY: "本張單到達結案狀態(核准 / 拒絕 / 取消)後,通知指定對象。",
897
901
  COUNTERSIGN: "指定對象會併入下一層簽核,下一層需所有人都完成才會繼續。",
898
902
  PRE_APPROVAL: "指定對象需先完成加簽,本階段才會往下一層繼續。",
899
903
  STAGE_NOTIFY: "本階段完成後(不論通過與否)通知指定對象。"
900
- }, Dn = [{
904
+ }, On = [{
901
905
  id: "REJECT_INSTANCE",
902
906
  name: "加簽拒絕時整單駁回"
903
907
  }, {
904
908
  id: "RETURN_TO_ORIGIN",
905
909
  name: "加簽拒絕時退回給我重新處理"
906
- }], On = [{
910
+ }], kn = [{
907
911
  id: "MEMBER",
908
912
  name: "指定成員"
909
913
  }, {
910
914
  id: "WEBHOOK",
911
915
  name: "Webhook"
912
- }], kn = ie(function({ adhocDirectives: e, currentMemberId: r, fill: i = null, instance: o, memberProfilesById: s, onChanged: c, onDecidingChange: l, onFillApproveError: u, tasks: d }, f) {
916
+ }], An = ie(function({ adhocDirectives: e, currentMemberId: r, fill: i = null, instance: o, memberProfilesById: s, onChanged: c, onDecidingChange: l, onFillApproveError: u, tasks: d }, f) {
913
917
  let [p, ee] = y(!1), [te, m] = y(null);
914
918
  g(() => {
915
919
  l?.(p);
916
920
  }, [p, l]);
917
- let [ne, re] = y(""), [ie, h] = y(!1), [v, S] = y(""), [ue, de] = y(null), [fe, pe] = y(!1), [me, _e] = y(""), [be, we] = y(!1), [Te, O] = y(null), [Ee, De] = y(""), [Oe, ke] = y(null), [Ae, Ne] = y(!1), [Pe, Fe] = y([]), [Ie, Le] = y(!1), [Re, ze] = y(""), [Be, Ve] = y([]), [He, Ue] = y(!1), [We, Ge] = y([]), [Ke, qe] = y(!1), [A, Je] = y("COUNTERSIGN"), [Ye, j] = y("REJECT_INSTANCE"), [Xe, Ze] = y(!1), [Qe, $e] = y("MEMBER"), [et, tt] = y(""), M = v.trim(), nt = me.trim(), rt = Ee.trim(), N = _(() => Ot(d, r), [r, d]), P = _(() => N && o ? o.workflowSnapshot.nodes.find((e) => e.id === N.nodeId) ?? null : null, [N, o]), F = _(() => P && o ? kt(o.workflowSnapshot, P) : [], [P, o]), it = P?.type === "userTask" && P.data.returnBehavior.allowReturn, I = P?.type === "userTask" && P.data.allowReject !== !1, at = P?.type === "userTask" && P.data.allowTransfer !== !1, ot = P?.type === "userTask" && P.data.returnBehavior.requireComment === !0, L = P?.type === "userTask" && P.data.allowAddSigner, R = _(() => e.filter((e) => e.status === "PENDING"), [e]), st = F.find((e) => e.id === Te) ?? F[0] ?? null, ct = _(() => d.map((e) => ({
921
+ let [ne, re] = y(""), [ie, h] = y(!1), [v, S] = y(""), [ue, de] = y(null), [fe, pe] = y(!1), [me, _e] = y(""), [be, we] = y(!1), [Te, O] = y(null), [Ee, De] = y(""), [Oe, ke] = y(null), [Ae, Ne] = y(!1), [Pe, Fe] = y([]), [Ie, Le] = y(!1), [Re, ze] = y(""), [Be, Ve] = y([]), [He, Ue] = y(!1), [We, Ge] = y([]), [Ke, qe] = y(!1), [A, Je] = y("COUNTERSIGN"), [Ye, j] = y("REJECT_INSTANCE"), [Xe, Ze] = y(!1), [Qe, $e] = y("MEMBER"), [et, tt] = y(""), M = v.trim(), nt = me.trim(), rt = Ee.trim(), N = _(() => jt(d, r), [r, d]), P = _(() => N && o ? o.workflowSnapshot.nodes.find((e) => e.id === N.nodeId) ?? null : null, [N, o]), F = _(() => P && o ? K(o.workflowSnapshot, P) : [], [P, o]), it = P?.type === "userTask" && P.data.returnBehavior.allowReturn, at = P?.type === "userTask" && P.data.allowReject !== !1, ot = P?.type === "userTask" && P.data.allowTransfer !== !1, st = P?.type === "userTask" && P.data.returnBehavior.requireComment === !0, ct = P?.type === "userTask" && P.data.allowAddSigner, I = _(() => e.filter((e) => e.status === "PENDING"), [e]), L = F.find((e) => e.id === Te) ?? F[0] ?? null, lt = _(() => d.map((e) => ({
918
922
  ...e,
919
- assigneeLabel: K(e, s),
920
- fillFieldCount: jn(e, o?.workflowSnapshot ?? null),
923
+ assigneeLabel: At(e, s),
924
+ fillFieldCount: Mn(e, o?.workflowSnapshot ?? null),
921
925
  key: e.id,
922
926
  nodeLabel: a({
923
927
  ...e,
924
- nodeLabel: Dt(e.nodeId, o?.workflowSnapshot ?? null)
928
+ nodeLabel: kt(e.nodeId, o?.workflowSnapshot ?? null)
925
929
  }),
926
- statusLabel: wt(e.status)
930
+ statusLabel: U(e.status)
927
931
  })), [
928
932
  o,
929
933
  s,
930
934
  d
931
- ]), lt = _(() => [
935
+ ]), ut = _(() => [
932
936
  {
933
937
  dataIndex: "nodeLabel",
934
938
  key: "nodeLabel",
@@ -971,13 +975,13 @@ var Tn = {
971
975
  title: "建立時間",
972
976
  width: 220
973
977
  }
974
- ], []), ut = _(() => R.map((e) => ({
978
+ ], []), dt = _(() => I.map((e) => ({
975
979
  ...e,
976
- createdByLabel: G(e.createdByMemberId, s),
980
+ createdByLabel: W(e.createdByMemberId, s),
977
981
  key: e.id,
978
- targetLabel: An(e, s),
979
- typeLabel: Tn[e.type]
980
- })), [s, R]), dt = _(() => [
982
+ targetLabel: jn(e, s),
983
+ typeLabel: En[e.type]
984
+ })), [s, I]), ft = _(() => [
981
985
  {
982
986
  dataIndex: "typeLabel",
983
987
  key: "typeLabel",
@@ -1018,7 +1022,7 @@ var Tn = {
1018
1022
  key: "actions",
1019
1023
  render: (e) => e.createdByMemberId === r ? /* @__PURE__ */ E(b, {
1020
1024
  disabled: Xe,
1021
- onClick: () => void q(e.id),
1025
+ onClick: () => void Ot(e.id),
1022
1026
  size: "minor",
1023
1027
  variant: "destructive-secondary",
1024
1028
  children: "撤回"
@@ -1027,8 +1031,8 @@ var Tn = {
1027
1031
  width: 100
1028
1032
  }
1029
1033
  ], [Xe, r]);
1030
- async function ft({ action: e, comment: t, returnToNodeId: n = null, transferToMemberId: a = null }) {
1031
- if (!r || !N || e === "REJECTED" && !I || e === "TRANSFERRED" && !at) return !1;
1034
+ async function R({ action: e, comment: t, returnToNodeId: n = null, transferToMemberId: a = null }) {
1035
+ if (!r || !N || e === "REJECTED" && !at || e === "TRANSFERRED" && !ot) return !1;
1032
1036
  ee(!0), m(null);
1033
1037
  let o = e === "APPROVED" && i !== null && !N.isAdhoc ? {
1034
1038
  expectedFormDataFingerprint: i.expectedFormDataFingerprint,
@@ -1045,12 +1049,12 @@ var Tn = {
1045
1049
  transferToMemberId: a
1046
1050
  }), pe(!1), we(!1), Le(!1), S(""), _e(""), De(""), ke(null), O(null), de(null);
1047
1051
  } catch (e) {
1048
- return ee(!1), o !== null && e instanceof Error && u?.(e.message) === !0 ? (h(!1), !1) : (m(U(e)), !1);
1052
+ return ee(!1), o !== null && e instanceof Error && u?.(e.message) === !0 ? (h(!1), !1) : (m(H(e)), !1);
1049
1053
  }
1050
1054
  try {
1051
1055
  await c();
1052
1056
  } catch (e) {
1053
- m(U(e));
1057
+ m(H(e));
1054
1058
  } finally {
1055
1059
  ee(!1);
1056
1060
  }
@@ -1063,13 +1067,13 @@ var Tn = {
1063
1067
  p || (h(!1), re(""));
1064
1068
  }
1065
1069
  async function ht() {
1066
- p || await ft({
1070
+ p || await R({
1067
1071
  action: "APPROVED",
1068
1072
  comment: ne.trim() || null
1069
1073
  }) && (h(!1), re(""));
1070
1074
  }
1071
1075
  function gt() {
1072
- I && (S(""), de(null), pe(!0));
1076
+ at && (S(""), de(null), pe(!0));
1073
1077
  }
1074
1078
  function _t() {
1075
1079
  p || (pe(!1), S(""), de(null));
@@ -1077,67 +1081,67 @@ var Tn = {
1077
1081
  function vt() {
1078
1082
  _e(""), O(F[0]?.id ?? null), we(!0);
1079
1083
  }
1080
- function z() {
1084
+ function yt() {
1081
1085
  p || (we(!1), _e(""), O(null));
1082
1086
  }
1083
- function B() {
1084
- at && (De(""), ke(null), Le(!0), yt(""));
1087
+ function bt() {
1088
+ ot && (De(""), ke(null), Le(!0), B(""));
1085
1089
  }
1086
- function V() {
1090
+ function z() {
1087
1091
  p || (Le(!1), De(""), ke(null));
1088
1092
  }
1089
- async function yt(e) {
1093
+ async function B(e) {
1090
1094
  Ne(!0);
1091
1095
  try {
1092
- Fe((await k(e)).filter((e) => e.memberId !== r).map(At));
1096
+ Fe((await k(e)).filter((e) => e.memberId !== r).map(Mt));
1093
1097
  } catch (e) {
1094
- m(U(e));
1098
+ m(H(e));
1095
1099
  } finally {
1096
1100
  Ne(!1);
1097
1101
  }
1098
1102
  }
1099
- async function H() {
1100
- I && (M ? await ft({
1103
+ async function xt() {
1104
+ at && (M ? await R({
1101
1105
  action: "REJECTED",
1102
1106
  comment: M
1103
1107
  }) : de("請輸入拒絕原因"));
1104
1108
  }
1105
- async function bt() {
1106
- at && (Oe ? await ft({
1109
+ async function V() {
1110
+ ot && (Oe ? await R({
1107
1111
  action: "TRANSFERRED",
1108
1112
  comment: rt || null,
1109
1113
  transferToMemberId: Oe.id
1110
1114
  }) : m("請選擇轉派對象"));
1111
1115
  }
1112
- async function xt() {
1113
- await ft({
1116
+ async function St() {
1117
+ await R({
1114
1118
  action: "RETURNED",
1115
1119
  comment: nt || null,
1116
- returnToNodeId: st?.id ?? null
1120
+ returnToNodeId: L?.id ?? null
1117
1121
  });
1118
1122
  }
1119
- function St() {
1123
+ function Ct() {
1120
1124
  ze(""), Ve([]), j("REJECT_INSTANCE"), $e("MEMBER"), tt("");
1121
1125
  }
1122
- function W(e) {
1123
- Je(e), St(), qe(!0), Tt("");
1126
+ function wt(e) {
1127
+ Je(e), Ct(), qe(!0), Et("");
1124
1128
  }
1125
- function Ct() {
1126
- Xe || (qe(!1), St());
1129
+ function Tt() {
1130
+ Xe || (qe(!1), Ct());
1127
1131
  }
1128
- async function Tt(e) {
1132
+ async function Et(e) {
1129
1133
  Ue(!0);
1130
1134
  try {
1131
- Ge((await k(e)).map(At));
1135
+ Ge((await k(e)).map(Mt));
1132
1136
  } catch (e) {
1133
- m(U(e));
1137
+ m(H(e));
1134
1138
  } finally {
1135
1139
  Ue(!1);
1136
1140
  }
1137
1141
  }
1138
- async function Et() {
1142
+ async function Dt() {
1139
1143
  if (!N) return;
1140
- let e = (A === "STAGE_NOTIFY" || A === "COMPLETION_NOTIFY") && Qe === "WEBHOOK", t = jt({
1144
+ let e = (A === "STAGE_NOTIFY" || A === "COMPLETION_NOTIFY") && Qe === "WEBHOOK", t = Nt({
1141
1145
  memberIds: Be.map((e) => e.id),
1142
1146
  useWebhookTarget: e,
1143
1147
  webhookUrl: et
@@ -1164,45 +1168,45 @@ var Tn = {
1164
1168
  }) : await xe({
1165
1169
  target: n,
1166
1170
  taskId: N.id
1167
- }), qe(!1), St(), await c();
1171
+ }), qe(!1), Ct(), await c();
1168
1172
  } catch (e) {
1169
- m(U(e));
1173
+ m(H(e));
1170
1174
  } finally {
1171
1175
  Ze(!1);
1172
1176
  }
1173
1177
  }
1174
- async function q(e) {
1178
+ async function Ot(e) {
1175
1179
  Ze(!0), m(null);
1176
1180
  try {
1177
1181
  await ye(e), await c();
1178
1182
  } catch (e) {
1179
- m(U(e));
1183
+ m(H(e));
1180
1184
  } finally {
1181
1185
  Ze(!1);
1182
1186
  }
1183
1187
  }
1184
1188
  ae(f, () => ({
1185
- canAddSignerCurrentTask: L,
1186
- canRejectCurrentTask: I,
1189
+ canAddSignerCurrentTask: ct,
1190
+ canRejectCurrentTask: at,
1187
1191
  canReturnCurrentTask: it,
1188
- canTransferCurrentTask: at,
1192
+ canTransferCurrentTask: ot,
1189
1193
  deciding: p,
1190
1194
  handleApprove: pt,
1191
1195
  hasCurrentTask: N !== null,
1192
- openAdhocModal: W,
1196
+ openAdhocModal: wt,
1193
1197
  openRejectModal: gt,
1194
1198
  openReturnModal: vt,
1195
- openTransferModal: B
1199
+ openTransferModal: bt
1196
1200
  }), [
1197
- L,
1198
- I,
1199
- it,
1201
+ ct,
1200
1202
  at,
1203
+ it,
1204
+ ot,
1201
1205
  r,
1202
1206
  N,
1203
1207
  p
1204
1208
  ]);
1205
- let J = A === "STAGE_NOTIFY" || A === "COMPLETION_NOTIFY", Ft = J && Qe === "WEBHOOK" ? !et.trim() : Be.length === 0, It = Dn.find((e) => e.id === Ye) ?? Dn[0], Y = On.find((e) => e.id === Qe) ?? On[0];
1209
+ let G = A === "STAGE_NOTIFY" || A === "COMPLETION_NOTIFY", q = G && Qe === "WEBHOOK" ? !et.trim() : Be.length === 0, J = On.find((e) => e.id === Ye) ?? On[0], Lt = kn.find((e) => e.id === Qe) ?? kn[0];
1206
1210
  return /* @__PURE__ */ D(ve, { children: [
1207
1211
  /* @__PURE__ */ E(T, {
1208
1212
  component: "h2",
@@ -1215,23 +1219,23 @@ var Tn = {
1215
1219
  children: te
1216
1220
  }) : null,
1217
1221
  /* @__PURE__ */ E("div", {
1218
- style: Sn,
1222
+ style: Cn,
1219
1223
  children: /* @__PURE__ */ E(he, {
1220
- columns: lt,
1221
- dataSource: ct,
1224
+ columns: ut,
1225
+ dataSource: lt,
1222
1226
  fullWidth: !0
1223
1227
  })
1224
1228
  }),
1225
- R.length > 0 ? /* @__PURE__ */ D(ve, { children: [/* @__PURE__ */ E(T, {
1229
+ I.length > 0 ? /* @__PURE__ */ D(ve, { children: [/* @__PURE__ */ E(T, {
1226
1230
  component: "h3",
1227
- style: Cn,
1231
+ style: wn,
1228
1232
  variant: "h3",
1229
1233
  children: "待生效的臨時設定"
1230
1234
  }), /* @__PURE__ */ E("div", {
1231
- style: Sn,
1235
+ style: Cn,
1232
1236
  children: /* @__PURE__ */ E(he, {
1233
- columns: dt,
1234
- dataSource: ut,
1237
+ columns: ft,
1238
+ dataSource: dt,
1235
1239
  fullWidth: !0
1236
1240
  })
1237
1241
  })] }) : null,
@@ -1257,7 +1261,7 @@ var Tn = {
1257
1261
  children: te
1258
1262
  }) : null,
1259
1263
  i !== null && i.summary.length > 0 ? /* @__PURE__ */ D("div", {
1260
- style: yn,
1264
+ style: bn,
1261
1265
  children: [/* @__PURE__ */ E(T, {
1262
1266
  variant: "body",
1263
1267
  children: "將一併送出的補填欄位:"
@@ -1267,7 +1271,7 @@ var Tn = {
1267
1271
  }, e.fieldKey))]
1268
1272
  }) : null,
1269
1273
  /* @__PURE__ */ E("div", {
1270
- style: yn,
1274
+ style: bn,
1271
1275
  children: /* @__PURE__ */ E(n, {
1272
1276
  label: "簽核意見",
1273
1277
  name: "approveComment",
@@ -1275,10 +1279,10 @@ var Tn = {
1275
1279
  autoFocus: !0,
1276
1280
  onChange: (e) => re(e.target.value),
1277
1281
  placeholder: "選填,例如補充核准的條件或提醒事項",
1278
- ref: wn,
1282
+ ref: Tn,
1279
1283
  resize: "vertical",
1280
1284
  rows: 4,
1281
- style: bn,
1285
+ style: xn,
1282
1286
  value: ne
1283
1287
  })
1284
1288
  })
@@ -1297,7 +1301,7 @@ var Tn = {
1297
1301
  modalType: "standard",
1298
1302
  onCancel: _t,
1299
1303
  onClose: _t,
1300
- onConfirm: () => void H(),
1304
+ onConfirm: () => void xt(),
1301
1305
  open: fe,
1302
1306
  showModalFooter: !0,
1303
1307
  showModalHeader: !0,
@@ -1305,7 +1309,7 @@ var Tn = {
1305
1309
  supportingText: "拒絕案件時必須留下原因,供發起人與後續追蹤查看。",
1306
1310
  title: "拒絕原因",
1307
1311
  children: /* @__PURE__ */ D("div", {
1308
- style: yn,
1312
+ style: bn,
1309
1313
  children: [/* @__PURE__ */ E(n, {
1310
1314
  label: "拒絕原因",
1311
1315
  name: "rejectReason",
@@ -1316,10 +1320,10 @@ var Tn = {
1316
1320
  S(e.target.value), de(null);
1317
1321
  },
1318
1322
  placeholder: "請說明拒絕原因",
1319
- ref: wn,
1323
+ ref: Tn,
1320
1324
  resize: "vertical",
1321
1325
  rows: 4,
1322
- style: bn,
1326
+ style: xn,
1323
1327
  type: ue ? "error" : "default",
1324
1328
  value: v
1325
1329
  })
@@ -1336,9 +1340,9 @@ var Tn = {
1336
1340
  confirmText: "送出轉派",
1337
1341
  loading: p,
1338
1342
  modalType: "standard",
1339
- onCancel: V,
1340
- onClose: V,
1341
- onConfirm: () => void bt(),
1343
+ onCancel: z,
1344
+ onClose: z,
1345
+ onConfirm: () => void V(),
1342
1346
  open: Ie,
1343
1347
  showModalFooter: !0,
1344
1348
  showModalHeader: !0,
@@ -1346,7 +1350,7 @@ var Tn = {
1346
1350
  supportingText: "轉派後,原任務會保留轉派紀錄,新的待簽任務會指派給指定成員。",
1347
1351
  title: "轉派簽核",
1348
1352
  children: /* @__PURE__ */ D("div", {
1349
- style: xn,
1353
+ style: Sn,
1350
1354
  children: [/* @__PURE__ */ E(n, {
1351
1355
  label: "轉派對象",
1352
1356
  name: "transferToMemberId",
@@ -1364,11 +1368,11 @@ var Tn = {
1364
1368
  loading: Ae,
1365
1369
  loadingText: "搜尋成員中...",
1366
1370
  mode: "single",
1367
- onChange: (e) => ke(Nt(e)),
1368
- onSearch: yt,
1369
- onSearchTextChange: (e) => ke(Pt(e, Pe)),
1371
+ onChange: (e) => ke(Ft(e)),
1372
+ onSearch: B,
1373
+ onSearchTextChange: (e) => ke(It(e, Pe)),
1370
1374
  onVisibilityChange: (e) => {
1371
- e && yt("");
1375
+ e && B("");
1372
1376
  },
1373
1377
  options: [...Pe],
1374
1378
  placeholder: "搜尋姓名或信箱",
@@ -1381,10 +1385,10 @@ var Tn = {
1381
1385
  children: /* @__PURE__ */ E(ge, {
1382
1386
  onChange: (e) => De(e.target.value),
1383
1387
  placeholder: "可補充轉派原因",
1384
- ref: wn,
1388
+ ref: Tn,
1385
1389
  resize: "vertical",
1386
1390
  rows: 4,
1387
- style: bn,
1391
+ style: xn,
1388
1392
  value: Ee
1389
1393
  })
1390
1394
  })]
@@ -1392,13 +1396,13 @@ var Tn = {
1392
1396
  }),
1393
1397
  /* @__PURE__ */ E(C, {
1394
1398
  cancelText: "取消",
1395
- confirmButtonProps: { disabled: !st || ot && !nt },
1399
+ confirmButtonProps: { disabled: !L || st && !nt },
1396
1400
  confirmText: "送出退回",
1397
1401
  loading: p,
1398
1402
  modalType: "standard",
1399
- onCancel: z,
1400
- onClose: z,
1401
- onConfirm: () => void xt(),
1403
+ onCancel: yt,
1404
+ onClose: yt,
1405
+ onConfirm: () => void St(),
1402
1406
  open: be,
1403
1407
  showModalFooter: !0,
1404
1408
  showModalHeader: !0,
@@ -1406,7 +1410,7 @@ var Tn = {
1406
1410
  supportingText: "退回後,流程會回到指定節點並等待重新處理。",
1407
1411
  title: "退回簽核",
1408
1412
  children: /* @__PURE__ */ D("div", {
1409
- style: xn,
1413
+ style: Sn,
1410
1414
  children: [/* @__PURE__ */ E(n, {
1411
1415
  label: "退回節點",
1412
1416
  name: "returnTargetNodeId",
@@ -1417,20 +1421,20 @@ var Tn = {
1417
1421
  onChange: (e) => O(e?.id ?? null),
1418
1422
  options: [...F],
1419
1423
  placeholder: "選擇退回節點",
1420
- value: st
1424
+ value: L
1421
1425
  })
1422
1426
  }), /* @__PURE__ */ E(n, {
1423
- hintText: ot ? "此關卡設定退回時必須填寫意見。" : void 0,
1427
+ hintText: st ? "此關卡設定退回時必須填寫意見。" : void 0,
1424
1428
  label: "退回說明",
1425
1429
  name: "returnComment",
1426
- required: ot,
1430
+ required: st,
1427
1431
  children: /* @__PURE__ */ E(ge, {
1428
1432
  onChange: (e) => _e(e.target.value),
1429
- placeholder: ot ? "請說明退回原因" : "可補充需要修改的內容",
1430
- ref: wn,
1433
+ placeholder: st ? "請說明退回原因" : "可補充需要修改的內容",
1434
+ ref: Tn,
1431
1435
  resize: "vertical",
1432
1436
  rows: 4,
1433
- style: bn,
1437
+ style: xn,
1434
1438
  value: me
1435
1439
  })
1436
1440
  })]
@@ -1438,23 +1442,23 @@ var Tn = {
1438
1442
  }),
1439
1443
  /* @__PURE__ */ E(C, {
1440
1444
  cancelText: "取消",
1441
- confirmButtonProps: { disabled: Ft },
1445
+ confirmButtonProps: { disabled: q },
1442
1446
  confirmText: "送出",
1443
1447
  loading: Xe,
1444
1448
  modalType: "standard",
1445
- onCancel: Ct,
1446
- onClose: Ct,
1447
- onConfirm: () => void Et(),
1449
+ onCancel: Tt,
1450
+ onClose: Tt,
1451
+ onConfirm: () => void Dt(),
1448
1452
  open: Ke,
1449
1453
  showModalFooter: !0,
1450
1454
  showModalHeader: !0,
1451
1455
  size: "regular",
1452
- supportingText: En[A],
1453
- title: Tn[A],
1456
+ supportingText: Dn[A],
1457
+ title: En[A],
1454
1458
  children: /* @__PURE__ */ D("div", {
1455
- style: xn,
1459
+ style: Sn,
1456
1460
  children: [
1457
- J ? /* @__PURE__ */ E(n, {
1461
+ G ? /* @__PURE__ */ E(n, {
1458
1462
  label: "通知時機",
1459
1463
  name: "adhocNotifyMode",
1460
1464
  required: !0,
@@ -1464,18 +1468,18 @@ var Tn = {
1464
1468
  onChange: (e) => Je(e?.id === "COMPLETION_NOTIFY" ? "COMPLETION_NOTIFY" : "STAGE_NOTIFY"),
1465
1469
  options: [{
1466
1470
  id: "STAGE_NOTIFY",
1467
- name: Tn.STAGE_NOTIFY
1471
+ name: En.STAGE_NOTIFY
1468
1472
  }, {
1469
1473
  id: "COMPLETION_NOTIFY",
1470
- name: Tn.COMPLETION_NOTIFY
1474
+ name: En.COMPLETION_NOTIFY
1471
1475
  }],
1472
1476
  value: {
1473
1477
  id: A,
1474
- name: Tn[A]
1478
+ name: En[A]
1475
1479
  }
1476
1480
  })
1477
1481
  }) : null,
1478
- J ? /* @__PURE__ */ E(n, {
1482
+ G ? /* @__PURE__ */ E(n, {
1479
1483
  label: "通知對象類型",
1480
1484
  name: "adhocTargetKind",
1481
1485
  required: !0,
@@ -1483,11 +1487,11 @@ var Tn = {
1483
1487
  clearable: !1,
1484
1488
  fullWidth: !0,
1485
1489
  onChange: (e) => $e(e?.id === "WEBHOOK" ? "WEBHOOK" : "MEMBER"),
1486
- options: [...On],
1487
- value: Y
1490
+ options: [...kn],
1491
+ value: Lt
1488
1492
  })
1489
1493
  }) : null,
1490
- J && Qe === "WEBHOOK" ? /* @__PURE__ */ E(n, {
1494
+ G && Qe === "WEBHOOK" ? /* @__PURE__ */ E(n, {
1491
1495
  label: "Webhook URL",
1492
1496
  name: "adhocWebhookUrl",
1493
1497
  required: !0,
@@ -1498,7 +1502,7 @@ var Tn = {
1498
1502
  value: et
1499
1503
  })
1500
1504
  }) : /* @__PURE__ */ E(n, {
1501
- label: J ? "通知對象" : "簽核對象",
1505
+ label: G ? "通知對象" : "簽核對象",
1502
1506
  name: "adhocMemberId",
1503
1507
  required: !0,
1504
1508
  children: /* @__PURE__ */ E(oe, {
@@ -1515,10 +1519,10 @@ var Tn = {
1515
1519
  loadingText: "搜尋成員中...",
1516
1520
  menuMaxHeight: 320,
1517
1521
  mode: "multiple",
1518
- onChange: (e) => Ve(e.map(Nt).filter(Mt)),
1519
- onSearch: Tt,
1522
+ onChange: (e) => Ve(e.map(Ft).filter(Pt)),
1523
+ onSearch: Et,
1520
1524
  onVisibilityChange: (e) => {
1521
- e && Tt("");
1525
+ e && Et("");
1522
1526
  },
1523
1527
  options: [...We],
1524
1528
  overflowStrategy: "wrap",
@@ -1535,20 +1539,20 @@ var Tn = {
1535
1539
  clearable: !1,
1536
1540
  fullWidth: !0,
1537
1541
  onChange: (e) => j(e?.id === "RETURN_TO_ORIGIN" ? "RETURN_TO_ORIGIN" : "REJECT_INSTANCE"),
1538
- options: [...Dn],
1539
- value: It
1542
+ options: [...On],
1543
+ value: J
1540
1544
  })
1541
1545
  }) : null,
1542
- J ? null : /* @__PURE__ */ E(n, {
1546
+ G ? null : /* @__PURE__ */ E(n, {
1543
1547
  label: "說明",
1544
1548
  name: "adhocComment",
1545
1549
  children: /* @__PURE__ */ E(ge, {
1546
1550
  onChange: (e) => ze(e.target.value),
1547
1551
  placeholder: "可補充原因",
1548
- ref: wn,
1552
+ ref: Tn,
1549
1553
  resize: "vertical",
1550
1554
  rows: 3,
1551
- style: bn,
1555
+ style: xn,
1552
1556
  value: Re
1553
1557
  })
1554
1558
  })
@@ -1557,31 +1561,31 @@ var Tn = {
1557
1561
  })
1558
1562
  ] });
1559
1563
  });
1560
- function An(e, t) {
1564
+ function jn(e, t) {
1561
1565
  try {
1562
1566
  let n = JSON.parse(e.targetValueJson);
1563
- if (n.memberIds?.length) return n.memberIds.map((e) => G(e, t)).join("、");
1567
+ if (n.memberIds?.length) return n.memberIds.map((e) => W(e, t)).join("、");
1564
1568
  if (n.webhookUrl) return n.webhookUrl;
1565
1569
  if (n.positionId) return `職位 ${n.positionId}`;
1566
1570
  if (n.orgUnitId) return `部門 ${n.orgUnitId}`;
1567
1571
  } catch {}
1568
1572
  return e.targetKind;
1569
1573
  }
1570
- function jn(e, t) {
1574
+ function Mn(e, t) {
1571
1575
  if (e.isAdhoc || e.status !== "PENDING" && e.status !== "IN_PROGRESS") return 0;
1572
1576
  let n = t?.nodes.find((t) => t.id === e.nodeId);
1573
1577
  return n?.type === "userTask" ? Xe(n).size : 0;
1574
1578
  }
1575
1579
  //#endregion
1576
1580
  //#region src/views/instances/detail/sections/InstanceSignaturesSection.tsx
1577
- var Mn = {
1581
+ var Nn = {
1578
1582
  display: "grid",
1579
1583
  gap: 16
1580
1584
  };
1581
- function Nn({ signatureVerification: e, signatures: n }) {
1585
+ function Pn({ signatureVerification: e, signatures: n }) {
1582
1586
  let r = _(() => n.map((e) => ({
1583
1587
  algorithm: e.algorithm,
1584
- hashLabel: W(e.signedPayloadHash),
1588
+ hashLabel: Tt(e.signedPayloadHash),
1585
1589
  key: e.id,
1586
1590
  keyVersion: e.keyVersion,
1587
1591
  signedAtLabel: t(e.signedAt),
@@ -1619,7 +1623,7 @@ function Nn({ signatureVerification: e, signatures: n }) {
1619
1623
  }
1620
1624
  ], []);
1621
1625
  return /* @__PURE__ */ D("div", {
1622
- style: Mn,
1626
+ style: Nn,
1623
1627
  children: [
1624
1628
  /* @__PURE__ */ E(T, {
1625
1629
  component: "h2",
@@ -1641,14 +1645,14 @@ function Nn({ signatureVerification: e, signatures: n }) {
1641
1645
  }
1642
1646
  //#endregion
1643
1647
  //#region src/views/instances/detail/sections/InstanceHistorySection.tsx
1644
- var Pn = {
1648
+ var Fn = {
1645
1649
  display: "grid",
1646
1650
  gap: 16
1647
- }, Fn = {
1651
+ }, In = {
1648
1652
  cursor: "help",
1649
1653
  textDecoration: "underline dotted",
1650
1654
  textUnderlineOffset: 3
1651
- }, In = {
1655
+ }, Ln = {
1652
1656
  borderLeftColor: "var(--mzn-color-border)",
1653
1657
  borderLeftStyle: "solid",
1654
1658
  borderLeftWidth: 2,
@@ -1657,41 +1661,41 @@ var Pn = {
1657
1661
  marginTop: 4,
1658
1662
  paddingLeft: 8,
1659
1663
  whiteSpace: "pre-wrap"
1660
- }, Ln = { color: "var(--mzn-color-text-secondary)" }, Rn = {
1661
- ...In,
1664
+ }, Rn = { color: "var(--mzn-color-text-secondary)" }, zn = {
1665
+ ...Ln,
1662
1666
  borderLeftColor: "var(--mzn-color-text-error)",
1663
1667
  color: "var(--mzn-color-text-error)"
1664
1668
  };
1665
- function zn(...e) {
1666
- return e.filter((e) => H(e ?? null)).join(" ");
1669
+ function Bn(...e) {
1670
+ return e.filter((e) => V(e ?? null)).join(" ");
1667
1671
  }
1668
- var Bn = ie(function({ className: e, descriptionParts: t, error: n, forcePending: r = !1, index: i = 0, orientation: a, status: o = "pending", title: s, type: c = "number", ...l }, u) {
1672
+ var Vn = ie(function({ className: e, descriptionParts: t, error: n, forcePending: r = !1, index: i = 0, orientation: a, status: o = "pending", title: s, type: c = "number", ...l }, u) {
1669
1673
  let d = r ? "pending" : o, f = t.filter((e) => e.type !== "comment"), p = t.filter((e) => e.type === "comment");
1670
1674
  return /* @__PURE__ */ D("div", {
1671
1675
  ...l,
1672
- className: zn(L.host, c === "dot" ? L.dot : null, n && d !== "processing" ? L.error : null, a === "horizontal" ? L.horizontal : null, c === "number" ? L.number : null, d === "pending" ? L.pending : null, d === "processing" ? L.processing : null, n && d === "processing" ? L.processingError : null, !n && d === "succeeded" ? L.succeeded : null, a === "vertical" ? L.vertical : null, e),
1676
+ className: Bn(I.host, c === "dot" ? I.dot : null, n && d !== "processing" ? I.error : null, a === "horizontal" ? I.horizontal : null, c === "number" ? I.number : null, d === "pending" ? I.pending : null, d === "processing" ? I.processing : null, n && d === "processing" ? I.processingError : null, !n && d === "succeeded" ? I.succeeded : null, a === "vertical" ? I.vertical : null, e),
1673
1677
  ref: u,
1674
- children: [c === "dot" ? /* @__PURE__ */ E("span", { className: zn(L.statusIndicator, L.statusIndicatorDot) }) : /* @__PURE__ */ E("span", {
1675
- className: L.statusIndicator,
1678
+ children: [c === "dot" ? /* @__PURE__ */ E("span", { className: Bn(I.statusIndicator, I.statusIndicatorDot) }) : /* @__PURE__ */ E("span", {
1679
+ className: I.statusIndicator,
1676
1680
  children: i + 1
1677
1681
  }), /* @__PURE__ */ D("div", {
1678
- className: L.textContainer,
1682
+ className: I.textContainer,
1679
1683
  children: [
1680
1684
  /* @__PURE__ */ D(T, {
1681
- className: L.title,
1685
+ className: I.title,
1682
1686
  variant: "label-primary-highlight",
1683
- children: [s, /* @__PURE__ */ E("span", { className: L.titleConnectLine })]
1687
+ children: [s, /* @__PURE__ */ E("span", { className: I.titleConnectLine })]
1684
1688
  }),
1685
1689
  f.length > 0 ? /* @__PURE__ */ E(T, {
1686
- className: L.description,
1690
+ className: I.description,
1687
1691
  variant: "caption",
1688
- children: f.map((e, t) => /* @__PURE__ */ D(re, { children: [t > 0 ? " · " : null, Vn(e)] }, `${e.type}-${t}`))
1692
+ children: f.map((e, t) => /* @__PURE__ */ D(re, { children: [t > 0 ? " · " : null, Hn(e)] }, `${e.type}-${t}`))
1689
1693
  }) : null,
1690
1694
  p.map((e, t) => /* @__PURE__ */ D(T, {
1691
- style: e.tone === "danger" ? Rn : In,
1695
+ style: e.tone === "danger" ? zn : Ln,
1692
1696
  variant: "body",
1693
1697
  children: [/* @__PURE__ */ D("span", {
1694
- style: e.tone === "danger" ? void 0 : Ln,
1698
+ style: e.tone === "danger" ? void 0 : Rn,
1695
1699
  children: [e.label, ":"]
1696
1700
  }), e.text]
1697
1701
  }, `comment-${t}`))
@@ -1699,7 +1703,7 @@ var Bn = ie(function({ className: e, descriptionParts: t, error: n, forcePending
1699
1703
  })]
1700
1704
  });
1701
1705
  });
1702
- function Vn(e) {
1706
+ function Hn(e) {
1703
1707
  return e.type === "text" ? e.text : e.email?.trim() ? /* @__PURE__ */ D(ve, { children: [
1704
1708
  e.prefix,
1705
1709
  ":",
@@ -1709,19 +1713,19 @@ function Vn(e) {
1709
1713
  ...n,
1710
1714
  "data-testid": e.memberId ? `member-tooltip-${e.memberId}` : void 0,
1711
1715
  ref: t,
1712
- style: Fn,
1716
+ style: In,
1713
1717
  children: e.label
1714
1718
  })
1715
1719
  })
1716
1720
  ] }) : `${e.prefix}:${e.label}`;
1717
1721
  }
1718
- function Hn({ activityLogs: e, formSchema: t = null, instanceState: n, memberProfilesById: r, signatureVerification: i, signaturesById: a, taskDecisionsByTaskId: o, tasks: s, workflowSnapshot: c, workflowTokens: l }) {
1719
- let u = rn(e, s, l, c, n, r, o, a, i, t), d = Lt(u), f = u.map((e) => ({
1722
+ function Un({ activityLogs: e, formSchema: t = null, instanceState: n, memberProfilesById: r, signatureVerification: i, signaturesById: a, taskDecisionsByTaskId: o, tasks: s, workflowSnapshot: c, workflowTokens: l }) {
1723
+ let u = an(e, s, l, c, n, r, o, a, i, t), d = Rt(u), f = u.map((e) => ({
1720
1724
  ...e,
1721
1725
  descriptionParts: e.descriptionParts.filter(Y)
1722
1726
  }));
1723
1727
  return /* @__PURE__ */ D("div", {
1724
- style: Pn,
1728
+ style: Fn,
1725
1729
  children: [/* @__PURE__ */ E(T, {
1726
1730
  component: "h2",
1727
1731
  variant: "h3",
@@ -1730,7 +1734,7 @@ function Hn({ activityLogs: e, formSchema: t = null, instanceState: n, memberPro
1730
1734
  currentStep: d,
1731
1735
  orientation: "vertical",
1732
1736
  type: "dot",
1733
- children: f.map((e) => /* @__PURE__ */ E(Bn, {
1737
+ children: f.map((e) => /* @__PURE__ */ E(Vn, {
1734
1738
  descriptionParts: e.descriptionParts,
1735
1739
  error: e.error,
1736
1740
  forcePending: e.forcePending,
@@ -1745,17 +1749,17 @@ function Hn({ activityLogs: e, formSchema: t = null, instanceState: n, memberPro
1745
1749
  }
1746
1750
  //#endregion
1747
1751
  //#region src/views/instances/detail/sections/InstanceWebhookDeliveriesSection.tsx
1748
- var Un = {
1752
+ var Wn = {
1749
1753
  display: "grid",
1750
1754
  gap: 16
1751
- }, Wn = {
1755
+ }, Gn = {
1752
1756
  display: "grid",
1753
1757
  gap: 2
1754
- }, Gn = {
1758
+ }, Kn = {
1755
1759
  overflowWrap: "anywhere",
1756
1760
  whiteSpace: "pre-wrap"
1757
1761
  };
1758
- function Kn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1762
+ function qn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1759
1763
  let [r, i] = y(null), [a, o] = y(!1), [s, c] = y(null), l = _(() => e.map((e) => ({
1760
1764
  delivery: e,
1761
1765
  key: e.id
@@ -1763,7 +1767,7 @@ function Kn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1763
1767
  {
1764
1768
  key: "endpoint",
1765
1769
  render: ({ delivery: e }) => /* @__PURE__ */ D("div", {
1766
- style: Wn,
1770
+ style: Gn,
1767
1771
  children: [/* @__PURE__ */ E(T, {
1768
1772
  component: "span",
1769
1773
  variant: "body",
@@ -1787,7 +1791,7 @@ function Kn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1787
1791
  },
1788
1792
  {
1789
1793
  key: "status",
1790
- render: ({ delivery: e }) => /* @__PURE__ */ E(qn, { status: e.status }),
1794
+ render: ({ delivery: e }) => /* @__PURE__ */ E(Jn, { status: e.status }),
1791
1795
  title: "狀態",
1792
1796
  width: 120
1793
1797
  },
@@ -1804,7 +1808,7 @@ function Kn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1804
1808
  {
1805
1809
  key: "lastError",
1806
1810
  render: ({ delivery: e }) => e.lastErrorCode && e.status !== "SENT" ? /* @__PURE__ */ D("div", {
1807
- style: Wn,
1811
+ style: Gn,
1808
1812
  children: [/* @__PURE__ */ E(T, {
1809
1813
  color: "text-error",
1810
1814
  component: "span",
@@ -1813,7 +1817,7 @@ function Kn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1813
1817
  }), e.lastErrorDetail ? /* @__PURE__ */ E(T, {
1814
1818
  color: "text-neutral",
1815
1819
  component: "span",
1816
- style: Gn,
1820
+ style: Kn,
1817
1821
  variant: "caption",
1818
1822
  children: e.lastErrorDetail
1819
1823
  }) : null]
@@ -1831,7 +1835,7 @@ function Kn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1831
1835
  render: ({ delivery: e }) => /* @__PURE__ */ E(T, {
1832
1836
  component: "span",
1833
1837
  variant: "body",
1834
- children: Jn(e)
1838
+ children: Yn(e)
1835
1839
  }),
1836
1840
  title: "時間",
1837
1841
  width: 220
@@ -1862,7 +1866,7 @@ function Kn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1862
1866
  }
1863
1867
  }
1864
1868
  return /* @__PURE__ */ D("div", {
1865
- style: Un,
1869
+ style: Wn,
1866
1870
  children: [
1867
1871
  /* @__PURE__ */ E(T, {
1868
1872
  component: "h2",
@@ -1910,7 +1914,7 @@ function Kn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1910
1914
  ]
1911
1915
  });
1912
1916
  }
1913
- function qn({ status: e }) {
1917
+ function Jn({ status: e }) {
1914
1918
  return e === "SENT" ? /* @__PURE__ */ E(se, {
1915
1919
  size: "sub",
1916
1920
  text: "已送達",
@@ -1925,34 +1929,34 @@ function qn({ status: e }) {
1925
1929
  variant: "dot-info"
1926
1930
  });
1927
1931
  }
1928
- function Jn(e) {
1932
+ function Yn(e) {
1929
1933
  return e.sentAt ? `送達:${t(e.sentAt)}` : e.status === "PENDING" && e.nextRetryAt ? `下次重試:${t(e.nextRetryAt)}` : e.lastAttemptAt ? `最後嘗試:${t(e.lastAttemptAt)}` : `建立:${t(e.createdAt)}`;
1930
1934
  }
1931
1935
  //#endregion
1932
1936
  //#region src/views/instances/viewer-field-access.ts
1933
- function Yn(e, t) {
1937
+ function Xn(e, t) {
1934
1938
  let n = new Map(t.map((e) => [e.id, e]));
1935
1939
  return new Set(e.filter((e) => e.eventType === "TASK_CREATED").map((e) => e.taskId === null ? void 0 : n.get(e.taskId)).filter((e) => e !== void 0 && !e.isAdhoc).map((e) => e.nodeId));
1936
1940
  }
1937
- function Xn({ activityLogs: e, actingTask: t, instance: n, tasks: r }) {
1941
+ function Zn({ activityLogs: e, actingTask: t, instance: n, tasks: r }) {
1938
1942
  let i = n.workflowSnapshot;
1939
1943
  return $e({
1940
1944
  definition: i,
1941
1945
  fieldKeys: (n.formDefinitionSnapshot.schema?.fields ?? []).map((e) => e.fieldKey),
1942
1946
  isAdhocTask: t?.isAdhoc ?? !1,
1943
1947
  nodeId: t?.nodeId ?? null,
1944
- revealedFieldKeys: Ze(i, Yn(e, r))
1948
+ revealedFieldKeys: Ze(i, Xn(e, r))
1945
1949
  });
1946
1950
  }
1947
1951
  //#endregion
1948
1952
  //#region src/views/instances/detail/InstanceDetailView.tsx
1949
- function Zn(e) {
1953
+ function Qn(e) {
1950
1954
  return `還有 ${new Set(Object.keys(e).map(Qe)).size} 個補填欄位需要完成`;
1951
1955
  }
1952
- var Qn = 3e3, $n = 40, er = 184, tr = 96, nr = {
1956
+ var $n = 3e3, er = 40, tr = 184, nr = 96, rr = {
1953
1957
  display: "grid",
1954
1958
  gap: 16
1955
- }, rr = {
1959
+ }, ir = {
1956
1960
  background: "#f8fafc",
1957
1961
  border: "1px solid #e2e8f0",
1958
1962
  borderRadius: 8,
@@ -1960,7 +1964,7 @@ var Qn = 3e3, $n = 40, er = 184, tr = 96, nr = {
1960
1964
  minHeight: 440,
1961
1965
  overflow: "hidden",
1962
1966
  width: "min(80vw, 1040px)"
1963
- }, ir = {
1967
+ }, ar = {
1964
1968
  background: "#ffffff",
1965
1969
  border: "1px solid #cbd5e1",
1966
1970
  borderRadius: 8,
@@ -1970,24 +1974,24 @@ var Qn = 3e3, $n = 40, er = 184, tr = 96, nr = {
1970
1974
  minHeight: 82,
1971
1975
  padding: 12,
1972
1976
  width: 184
1973
- }, ar = {
1977
+ }, or = {
1974
1978
  borderRadius: 999,
1975
1979
  fontSize: 12,
1976
1980
  fontWeight: 600,
1977
1981
  justifySelf: "start",
1978
1982
  lineHeight: "18px",
1979
1983
  padding: "0 8px"
1980
- }, or = {
1984
+ }, sr = {
1981
1985
  color: "#64748b",
1982
1986
  fontSize: 12,
1983
1987
  overflow: "hidden",
1984
1988
  textOverflow: "ellipsis",
1985
1989
  whiteSpace: "nowrap"
1986
- }, sr = { opacity: 0 }, cr = {
1990
+ }, cr = { opacity: 0 }, lr = {
1987
1991
  display: "flex",
1988
1992
  flexWrap: "wrap",
1989
1993
  gap: 8
1990
- }, lr = {
1994
+ }, ur = {
1991
1995
  alignItems: "center",
1992
1996
  background: "#ffffff",
1993
1997
  border: "1px solid #cbd5e1",
@@ -1999,29 +2003,29 @@ var Qn = 3e3, $n = 40, er = 184, tr = 96, nr = {
1999
2003
  gap: 6,
2000
2004
  lineHeight: "20px",
2001
2005
  padding: "4px 8px"
2002
- }, ur = {
2006
+ }, dr = {
2003
2007
  display: "grid",
2004
2008
  gap: 16
2005
- }, dr = { workflowRuntime: xr };
2006
- function fr({ instanceId: i, showAttachments: a = !0, showForm: ne = !0, showHistory: re = !0, showSignatures: ie = !0, showTasks: ae = !0, showWebhookDeliveries: oe = !0 }) {
2007
- let { member: se } = e(), x = se?.memberId ?? null, ce = oe && r(se), [S, le] = y([]), [w, me] = y(null), [he, _e] = y([]), [ye, xe] = y([]), [Se, Ce] = y([]), [O, je] = y([]), [Me, Ne] = y(null), [k, ze] = y([]), [Be, He] = y([]), [Ue, qe] = y([]), [Ye, j] = y(null), [Ze, Qe] = y(!0), [$e, M] = y(!1), [P, F] = y(!1), [I, at] = y(!1), [ot, L] = y(""), [R, st] = y(!1), [ct, lt] = y({}), [ut, dt] = y({}), { clearAfterResubmit: ft, comment: pt, setComment: ht } = dn(i), [gt, vt] = y({}), [z, B] = y(null), [V, yt] = y(null), [bt, xt] = y([]), St = ot.trim(), W = v(null), wt = v(0), Tt = O.some((e) => e.status === "PENDING" || e.status === "DELIVERY_IN_PROGRESS");
2009
+ }, fr = { workflowRuntime: Sr };
2010
+ function pr({ instanceId: i, showAttachments: a = !0, showForm: ne = !0, showHistory: re = !0, showSignatures: ie = !0, showTasks: ae = !0, showWebhookDeliveries: oe = !0 }) {
2011
+ let { member: se } = e(), x = se?.memberId ?? null, ce = oe && r(se), [S, le] = y([]), [w, me] = y(null), [he, _e] = y([]), [ye, xe] = y([]), [Se, Ce] = y([]), [O, je] = y([]), [Me, Ne] = y(null), [k, ze] = y([]), [Be, He] = y([]), [Ue, qe] = y([]), [Ye, j] = y(null), [Ze, Qe] = y(!0), [$e, M] = y(!1), [P, F] = y(!1), [at, ot] = y(!1), [st, ct] = y(!1), [I, L] = y(""), [lt, ut] = y(!1), [dt, ft] = y({}), [R, pt] = y({}), { clearAfterResubmit: mt, comment: gt, setComment: _t } = fn(i), [yt, bt] = y({}), [z, B] = y(null), [xt, St] = y(null), [Ct, wt] = y([]), Tt = I.trim(), U = v(null), Dt = v(0), Ot = O.some((e) => e.status === "PENDING" || e.status === "DELIVERY_IN_PROGRESS");
2008
2012
  g(() => {
2009
- nn();
2013
+ an();
2010
2014
  }, [x, i]), g(() => {
2011
- if (!ce || !Tt || wt.current >= $n) return;
2015
+ if (!ce || !Ot || Dt.current >= er) return;
2012
2016
  let e = setTimeout(() => {
2013
- wt.current += 1, on();
2014
- }, Qn);
2017
+ Dt.current += 1, ln();
2018
+ }, $n);
2015
2019
  return () => clearTimeout(e);
2016
2020
  }, [
2017
2021
  ce,
2018
- Tt,
2022
+ Ot,
2019
2023
  O
2020
2024
  ]), g(() => {
2021
- dt(w?.formData ?? {}), vt({});
2025
+ pt(w?.formData ?? {}), bt({});
2022
2026
  }, [w]);
2023
- let Et = h((e, t) => {
2024
- vt((n) => {
2027
+ let At = h((e, t) => {
2028
+ bt((n) => {
2025
2029
  let r = n[e];
2026
2030
  return r?.hasValue === t.hasValue && r.status === t.status ? n : {
2027
2031
  ...n,
@@ -2031,230 +2035,232 @@ function fr({ instanceId: i, showAttachments: a = !0, showForm: ne = !0, showHis
2031
2035
  }
2032
2036
  };
2033
2037
  });
2034
- }, []), K = _(() => Ot(k, x), [x, k]), q = _(() => K && w ? w.workflowSnapshot.nodes.find((e) => e.id === K.nodeId) ?? null : null, [K, w]), kt = q?.type === "userTask" && q.data.returnBehavior.allowReturn, At = q?.type === "userTask" && q.data.allowReject !== !1, jt = q?.type === "userTask" && q.data.allowTransfer !== !1, Mt = q?.type === "userTask" && q.data.allowAddSigner, Nt = !(!w || w.initiatorMemberId !== x || w.state !== "RUNNING" && w.state !== "RETURNED"), Pt = !!(w && w.initiatorMemberId === x && w.state === "RETURNED"), J = _(() => K && !K.isAdhoc && q?.type === "userTask" && Xe(q).size > 0 ? q : null, [K, q]), Ft = J ? K?.id ?? null : null, [It, Y] = y({}), [Lt, Rt] = y({}), [zt, Bt] = y(!1);
2038
+ }, []), G = _(() => jt(k, x), [x, k]), K = _(() => G && w ? w.workflowSnapshot.nodes.find((e) => e.id === G.nodeId) ?? null : null, [G, w]), Mt = K?.type === "userTask" && K.data.returnBehavior.allowReturn, Nt = K?.type === "userTask" && K.data.allowReject !== !1, Pt = K?.type === "userTask" && K.data.allowTransfer !== !1, Ft = K?.type === "userTask" && K.data.allowAddSigner, It = !(!w || w.initiatorMemberId !== x || w.state !== "RUNNING" && w.state !== "RETURNED"), q = !!(w && w.initiatorMemberId === x && w.state === "RETURNED"), J = _(() => G && !G.isAdhoc && K?.type === "userTask" && Xe(K).size > 0 ? K : null, [G, K]), Lt = J ? G?.id ?? null : null, [Y, Rt] = y({}), [zt, Bt] = y({}), [Vt, Ht] = y(!1);
2035
2039
  g(() => {
2036
- Y({}), Rt({}), Bt(!1);
2037
- }, [Ft]);
2040
+ Rt({}), Bt({}), Ht(!1);
2041
+ }, [Lt]);
2038
2042
  let X = w?.formDefinitionSnapshot.schema ?? null, Z = _(() => J && X ? o(X, J) : null, [J, X]), Q = _(() => Z && w ? et(Z.fields, {
2039
2043
  ...w.formData,
2040
- ...It
2044
+ ...Y
2041
2045
  }) : null, [
2042
- It,
2046
+ Y,
2043
2047
  Z,
2044
2048
  w
2045
- ]), Vt = _(() => J && Z && Q && w ? c({
2046
- draft: It,
2049
+ ]), Ut = _(() => J && Z && Q && w ? c({
2050
+ draft: Y,
2047
2051
  node: J,
2048
2052
  schema: Z,
2049
2053
  stored: w.formData,
2050
2054
  values: Q
2051
2055
  }) : {}, [
2052
- It,
2056
+ Y,
2053
2057
  J,
2054
2058
  Z,
2055
2059
  Q,
2056
2060
  w
2057
- ]), Ht = _(() => w ? Xn({
2061
+ ]), Wt = _(() => w ? Zn({
2058
2062
  activityLogs: S,
2059
- actingTask: K,
2063
+ actingTask: G,
2060
2064
  instance: w,
2061
2065
  tasks: k
2062
2066
  }) : void 0, [
2063
2067
  S,
2064
- K,
2068
+ G,
2065
2069
  w,
2066
2070
  k
2067
- ]), Ut = _(() => w ? d(w.workflowSnapshot, J) : void 0, [J, w]), Wt = _(() => new Map(Ue.map((e) => [e.memberId, e])), [Ue]), Gt = _(() => J && Q && X && w?.formDataFingerprint ? {
2071
+ ]), Gt = _(() => w ? d(w.workflowSnapshot, J) : void 0, [J, w]), Kt = _(() => new Map(Ue.map((e) => [e.memberId, e])), [Ue]), qt = _(() => J && Q && X && w?.formDataFingerprint ? {
2068
2072
  expectedFormDataFingerprint: w.formDataFingerprint,
2069
- formData: p(Vt, J),
2070
- summary: l(X, J, Vt, new Map([...Wt.keys()].map((e) => [e, G(e, Wt)])))
2073
+ formData: p(Ut, J),
2074
+ summary: l(X, J, Ut, new Map([...Kt.keys()].map((e) => [e, W(e, Kt)])))
2071
2075
  } : null, [
2072
- Vt,
2076
+ Ut,
2073
2077
  J,
2074
2078
  Q,
2075
2079
  w,
2076
- Wt,
2080
+ Kt,
2077
2081
  X
2078
2082
  ]);
2079
- function Kt(e) {
2083
+ function Jt(e) {
2080
2084
  if (!J) return;
2081
2085
  let t = Xe(J), n = Object.entries(e).filter(([e, n]) => t.has(e) && JSON.stringify(n) !== JSON.stringify(Q?.[e]));
2082
- Y((e) => ({
2086
+ Rt((e) => ({
2083
2087
  ...e,
2084
2088
  ...Object.fromEntries(n)
2085
- })), Rt({});
2089
+ })), Bt({});
2086
2090
  }
2087
- function qt() {
2091
+ async function Yt() {
2088
2092
  if (J && !w?.formDataFingerprint) ue.error("無法確認表單版本,請重新整理頁面後再同意。");
2089
2093
  else {
2090
2094
  if (J && Q && X && w?.formDefinitionSnapshot.uiSchema) {
2091
- let e = nt({
2095
+ F(!0);
2096
+ let e = await nt({
2092
2097
  schema: te(X, J),
2093
2098
  uiSchema: w.formDefinitionSnapshot.uiSchema,
2094
2099
  values: Q
2095
- });
2100
+ }).catch((e) => (ue.error(H(e)), null)).finally(() => F(!1));
2101
+ if (!e) return;
2096
2102
  if (!e.valid) {
2097
- Rt(e.errors), e.firstInvalidFieldKey && tt(e.firstInvalidFieldKey), ue.warning(Zn(e.errors));
2103
+ Bt(e.errors), e.firstInvalidFieldKey && tt(e.firstInvalidFieldKey), ue.warning(Qn(e.errors));
2098
2104
  return;
2099
2105
  }
2100
2106
  }
2101
- W.current?.handleApprove();
2107
+ U.current?.handleApprove();
2102
2108
  }
2103
2109
  }
2104
- function Jt(e) {
2110
+ function Xt(e) {
2105
2111
  if (!J || !X) return !1;
2106
- if (ee(e)) return Bt(!0), !0;
2112
+ if (ee(e)) return Ht(!0), !0;
2107
2113
  let t = s(e, X, J);
2108
- return t ? (Rt(t), tt(Object.keys(t)[0] ?? ""), ue.warning(Zn(t)), !0) : !1;
2114
+ return t ? (Bt(t), tt(Object.keys(t)[0] ?? ""), ue.warning(Qn(t)), !0) : !1;
2109
2115
  }
2110
- async function Yt() {
2111
- await nn(), Bt(!1);
2116
+ async function Zt() {
2117
+ await an(), Ht(!1);
2112
2118
  }
2113
- let Xt = _(() => un(he), [he]), Zt = _(() => new Map(Se.map((e) => [e.id, e])), [Se]), Qt = _(() => w ? _r(w.workflowSnapshot) : null, [w]), $t = _(() => w && Qt ? gr(Qt, k, Be, w.state) : [], [
2119
+ let Qt = _(() => dn(he), [he]), $t = _(() => new Map(Se.map((e) => [e.id, e])), [Se]), en = _(() => w ? vr(w.workflowSnapshot) : null, [w]), tn = _(() => w && en ? _r(en, k, Be, w.state) : [], [
2114
2120
  w,
2115
- Qt,
2121
+ en,
2116
2122
  k,
2117
2123
  Be
2118
- ]), en = _(() => Qt ? vr(Qt) : [], [Qt]), tn = _(() => w ? mr(w.workflowSnapshot) : [], [w]);
2119
- async function nn() {
2124
+ ]), nn = _(() => en ? yr(en) : [], [en]), rn = _(() => w ? hr(w.workflowSnapshot) : [], [w]);
2125
+ async function an() {
2120
2126
  Qe(!0), j(null);
2121
2127
  try {
2122
2128
  let e = await De(i);
2123
2129
  le(e.activityLogs), me(e.instance), ze(e.tasks), He(e.workflowTokens);
2124
2130
  let t = await we(e.instance.id), [n, r, a, o, s] = await Promise.all([
2125
- ln(e.tasks),
2126
- sn({
2131
+ un(e.tasks),
2132
+ cn({
2127
2133
  ...e,
2128
2134
  adhocDirectives: t
2129
2135
  }),
2130
2136
  Te(e.instance.id),
2131
2137
  Ae(e.instance.id),
2132
- rn(e.instance.id)
2138
+ on(e.instance.id)
2133
2139
  ]);
2134
- _e(n), qe(r), xe(a), Ce(o.signatures), Ne(o.verification), xt(t), je(s);
2140
+ _e(n), qe(r), xe(a), Ce(o.signatures), Ne(o.verification), wt(t), je(s);
2135
2141
  } catch (e) {
2136
- j(U(e));
2142
+ j(H(e));
2137
2143
  } finally {
2138
2144
  Qe(!1);
2139
2145
  }
2140
2146
  }
2141
- async function rn(e) {
2147
+ async function on(e) {
2142
2148
  return ce ? Ee(e).catch(() => []) : [];
2143
2149
  }
2144
- async function an(e) {
2145
- await Fe(e.id), wt.current = 0, await nn();
2150
+ async function sn(e) {
2151
+ await Fe(e.id), Dt.current = 0, await an();
2146
2152
  }
2147
- async function on() {
2148
- let e = await rn(i);
2149
- e.some((e) => e.status === "PENDING" || e.status === "DELIVERY_IN_PROGRESS") ? je(e) : await nn();
2153
+ async function ln() {
2154
+ let e = await on(i);
2155
+ e.some((e) => e.status === "PENDING" || e.status === "DELIVERY_IN_PROGRESS") ? je(e) : await an();
2150
2156
  }
2151
- async function cn(e, t) {
2157
+ async function pn(e, t) {
2152
2158
  if (!x) throw Error("尚未登入,無法上傳附件");
2153
2159
  return { id: (await Ie({
2154
2160
  file: t,
2155
2161
  formFieldPath: `form.${e.fieldKey}`
2156
2162
  })).id };
2157
2163
  }
2158
- async function fn(e) {
2164
+ async function mn(e) {
2159
2165
  if (!x) return;
2160
2166
  let t = await Oe({ id: e.id });
2161
2167
  window.open(t, "_blank", "noopener,noreferrer");
2162
2168
  }
2163
- async function pn(e) {
2169
+ async function hn(e) {
2164
2170
  if (!x) return;
2165
2171
  let t = await ke({ id: e.id });
2166
- B(e), yt(t);
2172
+ B(e), St(t);
2167
2173
  }
2168
- async function mn() {
2169
- if (x && w && Nt) {
2170
- M(!0), j(null), lt({});
2174
+ async function gn() {
2175
+ if (x && w && It) {
2176
+ M(!0), j(null), ft({});
2171
2177
  try {
2172
2178
  await be({
2173
2179
  cancelledByMemberId: x,
2174
- comment: St || null,
2180
+ comment: Tt || null,
2175
2181
  instanceId: w.id
2176
- }), L(""), st(!1), await nn();
2182
+ }), L(""), ut(!1), await an();
2177
2183
  } catch (e) {
2178
- j(U(e));
2184
+ j(H(e));
2179
2185
  } finally {
2180
2186
  M(!1);
2181
2187
  }
2182
2188
  }
2183
2189
  }
2184
- async function hn() {
2185
- if (!x || !w || !Pt) return;
2186
- M(!0), j(null), lt({});
2187
- let e = m(Object.values(gt));
2190
+ async function _n() {
2191
+ if (!x || !w || !q) return;
2192
+ M(!0), j(null), ft({});
2193
+ let e = m(Object.values(yt));
2188
2194
  if (e) {
2189
2195
  j(e), M(!1);
2190
2196
  return;
2191
2197
  }
2192
- let t = w.formDefinitionSnapshot.schema ? u(w.formDefinitionSnapshot.schema, w.workflowSnapshot) : null, n = f(t ? et(t.fields, ut) : ut, w.workflowSnapshot);
2193
- if (t && w.formDefinitionSnapshot.uiSchema) {
2194
- let e = nt({
2195
- schema: t,
2196
- uiSchema: w.formDefinitionSnapshot.uiSchema,
2197
- values: n
2198
- });
2199
- if (!e.valid) {
2200
- lt(e.errors), j("請先補齊必填欄位。"), e.firstInvalidFieldKey && tt(e.firstInvalidFieldKey), M(!1);
2201
- return;
2202
- }
2203
- }
2198
+ let t = w.formDefinitionSnapshot.schema ? u(w.formDefinitionSnapshot.schema, w.workflowSnapshot) : null, n = f(t ? et(t.fields, R) : R, w.workflowSnapshot);
2204
2199
  try {
2200
+ if (t && w.formDefinitionSnapshot.uiSchema) {
2201
+ let e = await nt({
2202
+ schema: t,
2203
+ uiSchema: w.formDefinitionSnapshot.uiSchema,
2204
+ values: n
2205
+ });
2206
+ if (!e.valid) {
2207
+ ft(e.errors), j("請先修正表單中標示的欄位。"), e.firstInvalidFieldKey && tt(e.firstInvalidFieldKey);
2208
+ return;
2209
+ }
2210
+ }
2205
2211
  await Pe({
2206
- comment: pt,
2212
+ comment: gt,
2207
2213
  formData: n,
2208
2214
  initiatorMemberId: x,
2209
2215
  instanceId: w.id,
2210
2216
  title: w.title
2211
- }), ft(w.id), await nn();
2217
+ }), mt(w.id), await an();
2212
2218
  } catch (e) {
2213
- j(U(e));
2219
+ j(H(e));
2214
2220
  } finally {
2215
2221
  M(!1);
2216
2222
  }
2217
2223
  }
2218
- let $ = $e || P;
2224
+ let $ = $e || at || P;
2219
2225
  return /* @__PURE__ */ D(ve, { children: [
2220
2226
  /* @__PURE__ */ E(de, { children: /* @__PURE__ */ D(Le, {
2221
2227
  description: w ? [
2222
- Ct(w.state),
2228
+ Et(w.state),
2223
2229
  t(w.startedAt),
2224
- _t(w, Wt)
2225
- ].filter(H).join(" · ") : "載入案件內容。",
2230
+ vt(w, Kt)
2231
+ ].filter(V).join(" · ") : "載入案件內容。",
2226
2232
  title: w?.title ?? "簽核案件",
2227
2233
  children: [
2228
2234
  w ? /* @__PURE__ */ E(b, {
2229
2235
  "aria-label": "查看流程圖",
2230
2236
  icon: A,
2231
2237
  iconType: "icon-only",
2232
- onClick: () => at(!0),
2238
+ onClick: () => ct(!0),
2233
2239
  title: "查看流程圖",
2234
2240
  variant: "base-secondary",
2235
2241
  children: "流程圖"
2236
2242
  }) : null,
2237
- Nt ? /* @__PURE__ */ E(b, {
2243
+ It ? /* @__PURE__ */ E(b, {
2238
2244
  disabled: $,
2239
2245
  icon: Ve,
2240
2246
  iconType: "leading",
2241
- onClick: () => st(!0),
2247
+ onClick: () => ut(!0),
2242
2248
  variant: "destructive-secondary",
2243
2249
  children: "取消案件"
2244
2250
  }) : null,
2245
- K ? /* @__PURE__ */ D(ve, { children: [
2246
- Mt ? /* @__PURE__ */ D(ve, { children: [/* @__PURE__ */ E(b, {
2251
+ G ? /* @__PURE__ */ D(ve, { children: [
2252
+ Ft ? /* @__PURE__ */ D(ve, { children: [/* @__PURE__ */ E(b, {
2247
2253
  disabled: $,
2248
2254
  icon: Ge,
2249
2255
  iconType: "leading",
2250
- onClick: () => W.current?.openAdhocModal("COUNTERSIGN"),
2256
+ onClick: () => U.current?.openAdhocModal("COUNTERSIGN"),
2251
2257
  variant: "base-secondary",
2252
2258
  children: "會簽"
2253
2259
  }, "adhoc-countersign"), /* @__PURE__ */ E(b, {
2254
2260
  disabled: $,
2255
2261
  icon: Ge,
2256
2262
  iconType: "leading",
2257
- onClick: () => W.current?.openAdhocModal("PRE_APPROVAL"),
2263
+ onClick: () => U.current?.openAdhocModal("PRE_APPROVAL"),
2258
2264
  variant: "base-secondary",
2259
2265
  children: "加簽"
2260
2266
  }, "adhoc-pre-approval")] }) : null,
@@ -2262,31 +2268,31 @@ function fr({ instanceId: i, showAttachments: a = !0, showForm: ne = !0, showHis
2262
2268
  disabled: $,
2263
2269
  icon: We,
2264
2270
  iconType: "leading",
2265
- onClick: () => W.current?.openAdhocModal("STAGE_NOTIFY"),
2271
+ onClick: () => U.current?.openAdhocModal("STAGE_NOTIFY"),
2266
2272
  variant: "base-secondary",
2267
2273
  children: "通知設定"
2268
2274
  }, "adhoc-notify"),
2269
- kt ? /* @__PURE__ */ E(b, {
2275
+ Mt ? /* @__PURE__ */ E(b, {
2270
2276
  disabled: $,
2271
2277
  icon: Ke,
2272
2278
  iconType: "leading",
2273
- onClick: () => W.current?.openReturnModal(),
2279
+ onClick: () => U.current?.openReturnModal(),
2274
2280
  variant: "base-secondary",
2275
2281
  children: "退回"
2276
2282
  }, "task-return") : null,
2277
- jt ? /* @__PURE__ */ E(b, {
2283
+ Pt ? /* @__PURE__ */ E(b, {
2278
2284
  disabled: $,
2279
2285
  icon: Je,
2280
2286
  iconType: "leading",
2281
- onClick: () => W.current?.openTransferModal(),
2287
+ onClick: () => U.current?.openTransferModal(),
2282
2288
  variant: "base-secondary",
2283
2289
  children: "轉派"
2284
2290
  }, "task-transfer") : null,
2285
- At ? /* @__PURE__ */ E(b, {
2291
+ Nt ? /* @__PURE__ */ E(b, {
2286
2292
  disabled: $,
2287
2293
  icon: Ve,
2288
2294
  iconType: "leading",
2289
- onClick: () => W.current?.openRejectModal(),
2295
+ onClick: () => U.current?.openRejectModal(),
2290
2296
  variant: "destructive-secondary",
2291
2297
  children: "拒絕"
2292
2298
  }, "task-reject") : null,
@@ -2294,7 +2300,9 @@ function fr({ instanceId: i, showAttachments: a = !0, showForm: ne = !0, showHis
2294
2300
  disabled: $,
2295
2301
  icon: Re,
2296
2302
  iconType: "leading",
2297
- onClick: qt,
2303
+ onClick: () => {
2304
+ Yt();
2305
+ },
2298
2306
  variant: "base-primary",
2299
2307
  children: "同意"
2300
2308
  }, "task-approve")
@@ -2302,71 +2310,71 @@ function fr({ instanceId: i, showAttachments: a = !0, showForm: ne = !0, showHis
2302
2310
  ]
2303
2311
  }) }),
2304
2312
  /* @__PURE__ */ D(pe, { children: [
2305
- ne ? /* @__PURE__ */ E(fe, { children: /* @__PURE__ */ E(gn, {
2306
- canResubmitInstance: Pt,
2313
+ ne ? /* @__PURE__ */ E(fe, { children: /* @__PURE__ */ E(vn, {
2314
+ canResubmitInstance: q,
2307
2315
  deciding: $e,
2308
2316
  error: Ye,
2309
- fieldAccess: Ht,
2310
- fieldLabelMarkers: Ut,
2317
+ fieldAccess: Wt,
2318
+ fieldLabelMarkers: Gt,
2311
2319
  fill: Z && Q && J ? {
2312
- errors: Lt,
2320
+ errors: zt,
2313
2321
  fieldCount: Xe(J).size,
2314
- onChange: Kt,
2322
+ onChange: Jt,
2315
2323
  schema: Z,
2316
2324
  value: Q
2317
2325
  } : null,
2318
2326
  instance: w,
2319
2327
  loading: Ze,
2320
- onDataSourceStateChange: Et,
2321
- onReloadAfterConflict: zt ? () => void Yt() : null,
2328
+ onDataSourceStateChange: At,
2329
+ onReloadAfterConflict: Vt ? () => void Zt() : null,
2322
2330
  onResubmitFormChange: (e) => {
2323
- dt(e), lt({});
2331
+ pt(e), ft({});
2324
2332
  },
2325
- onResubmitCommentChange: ht,
2326
- onResubmitInstance: () => void hn(),
2327
- onUploadAttachment: cn,
2328
- resubmitComment: pt,
2329
- resubmitFormData: ut,
2330
- resubmitFormErrors: ct
2333
+ onResubmitCommentChange: _t,
2334
+ onResubmitInstance: () => void _n(),
2335
+ onUploadAttachment: pn,
2336
+ resubmitComment: gt,
2337
+ resubmitFormData: R,
2338
+ resubmitFormErrors: dt
2331
2339
  }) }) : null,
2332
- a ? /* @__PURE__ */ E(fe, { children: /* @__PURE__ */ E(vn, {
2340
+ a ? /* @__PURE__ */ E(fe, { children: /* @__PURE__ */ E(yn, {
2333
2341
  attachments: ye,
2334
2342
  onDownload: (e) => {
2335
- fn(e);
2343
+ mn(e);
2336
2344
  },
2337
2345
  onPreview: (e) => {
2338
- pn(e);
2346
+ hn(e);
2339
2347
  }
2340
2348
  }) }) : null,
2341
- ae ? /* @__PURE__ */ E(fe, { children: /* @__PURE__ */ E(kn, {
2342
- adhocDirectives: bt,
2349
+ ae ? /* @__PURE__ */ E(fe, { children: /* @__PURE__ */ E(An, {
2350
+ adhocDirectives: Ct,
2343
2351
  currentMemberId: x,
2344
- fill: Gt,
2352
+ fill: qt,
2345
2353
  instance: w,
2346
- memberProfilesById: Wt,
2347
- onChanged: nn,
2348
- onDecidingChange: F,
2349
- onFillApproveError: Jt,
2350
- ref: W,
2354
+ memberProfilesById: Kt,
2355
+ onChanged: an,
2356
+ onDecidingChange: ot,
2357
+ onFillApproveError: Xt,
2358
+ ref: U,
2351
2359
  tasks: k
2352
2360
  }) }) : null,
2353
- ie ? /* @__PURE__ */ E(fe, { children: /* @__PURE__ */ E(Nn, {
2361
+ ie ? /* @__PURE__ */ E(fe, { children: /* @__PURE__ */ E(Pn, {
2354
2362
  signatureVerification: Me,
2355
2363
  signatures: Se
2356
2364
  }) }) : null,
2357
- ce && O.length > 0 ? /* @__PURE__ */ E(fe, { children: /* @__PURE__ */ E(Kn, {
2365
+ ce && O.length > 0 ? /* @__PURE__ */ E(fe, { children: /* @__PURE__ */ E(qn, {
2358
2366
  deliveries: O,
2359
- onRetry: an,
2360
- readNodeLabel: (e) => Dt(e, w?.workflowSnapshot ?? null)
2367
+ onRetry: sn,
2368
+ readNodeLabel: (e) => kt(e, w?.workflowSnapshot ?? null)
2361
2369
  }) }) : null,
2362
- re ? /* @__PURE__ */ E(fe, { children: /* @__PURE__ */ E(Hn, {
2370
+ re ? /* @__PURE__ */ E(fe, { children: /* @__PURE__ */ E(Un, {
2363
2371
  activityLogs: S,
2364
2372
  formSchema: X,
2365
2373
  instanceState: w?.state ?? "RUNNING",
2366
- memberProfilesById: Wt,
2374
+ memberProfilesById: Kt,
2367
2375
  signatureVerification: Me,
2368
- signaturesById: Zt,
2369
- taskDecisionsByTaskId: Xt,
2376
+ signaturesById: $t,
2377
+ taskDecisionsByTaskId: Qt,
2370
2378
  tasks: k,
2371
2379
  workflowSnapshot: w?.workflowSnapshot ?? null,
2372
2380
  workflowTokens: Be
@@ -2374,34 +2382,34 @@ function fr({ instanceId: i, showAttachments: a = !0, showForm: ne = !0, showHis
2374
2382
  ] }),
2375
2383
  w ? /* @__PURE__ */ E(C, {
2376
2384
  modalType: "standard",
2377
- onClose: () => at(!1),
2378
- open: I,
2385
+ onClose: () => ct(!1),
2386
+ open: st,
2379
2387
  showModalHeader: !0,
2380
2388
  size: "wide",
2381
- supportingText: `${Ct(w.state)} · ${t(w.startedAt)}`,
2389
+ supportingText: `${Et(w.state)} · ${t(w.startedAt)}`,
2382
2390
  title: "流程圖",
2383
2391
  children: /* @__PURE__ */ D("div", {
2384
- style: nr,
2392
+ style: rr,
2385
2393
  children: [/* @__PURE__ */ E("div", {
2386
- style: rr,
2394
+ style: ir,
2387
2395
  children: /* @__PURE__ */ D(it, {
2388
- edges: en,
2396
+ edges: nn,
2389
2397
  fitView: !0,
2390
2398
  fitViewOptions: { padding: .18 },
2391
2399
  maxZoom: 1.2,
2392
2400
  minZoom: .2,
2393
- nodes: $t,
2401
+ nodes: tn,
2394
2402
  nodesDraggable: !1,
2395
2403
  nodesFocusable: !1,
2396
- nodeTypes: dr,
2404
+ nodeTypes: fr,
2397
2405
  panOnDrag: !0,
2398
2406
  proOptions: { hideAttribution: !0 },
2399
2407
  children: [/* @__PURE__ */ E(rt, {}), /* @__PURE__ */ E(N, { showInteractive: !1 })]
2400
2408
  })
2401
- }), tn.length > 0 ? /* @__PURE__ */ E("div", {
2402
- style: cr,
2403
- children: tn.map((e) => /* @__PURE__ */ E("span", {
2404
- style: lr,
2409
+ }), rn.length > 0 ? /* @__PURE__ */ E("div", {
2410
+ style: lr,
2411
+ children: rn.map((e) => /* @__PURE__ */ E("span", {
2412
+ style: ur,
2405
2413
  children: e
2406
2414
  }, e))
2407
2415
  }) : null]
@@ -2410,17 +2418,17 @@ function fr({ instanceId: i, showAttachments: a = !0, showForm: ne = !0, showHis
2410
2418
  /* @__PURE__ */ E(C, {
2411
2419
  modalType: "standard",
2412
2420
  onClose: () => {
2413
- B(null), yt(null);
2421
+ B(null), St(null);
2414
2422
  },
2415
- open: !!(z && V),
2423
+ open: !!(z && xt),
2416
2424
  showModalHeader: !0,
2417
2425
  size: "wide",
2418
2426
  supportingText: z?.filename ?? void 0,
2419
2427
  title: "PDF 預覽",
2420
- children: V ? /* @__PURE__ */ E(mt, {
2428
+ children: xt ? /* @__PURE__ */ E(ht, {
2421
2429
  filename: z?.filename ?? "PDF 預覽",
2422
- fileUrl: V,
2423
- onDownload: z ? () => void fn(z) : void 0
2430
+ fileUrl: xt,
2431
+ onDownload: z ? () => void mn(z) : void 0
2424
2432
  }) : null
2425
2433
  }),
2426
2434
  /* @__PURE__ */ E(C, {
@@ -2430,16 +2438,16 @@ function fr({ instanceId: i, showAttachments: a = !0, showForm: ne = !0, showHis
2430
2438
  loading: $e,
2431
2439
  modalStatusType: "error",
2432
2440
  modalType: "standard",
2433
- onCancel: () => st(!1),
2434
- onClose: () => st(!1),
2435
- onConfirm: () => void mn(),
2436
- open: R,
2441
+ onCancel: () => ut(!1),
2442
+ onClose: () => ut(!1),
2443
+ onConfirm: () => void gn(),
2444
+ open: lt,
2437
2445
  showModalFooter: !0,
2438
2446
  showModalHeader: !0,
2439
2447
  supportingText: "取消後會關閉目前待簽任務與候選簽核人。",
2440
2448
  title: "取消案件",
2441
2449
  children: /* @__PURE__ */ D("div", {
2442
- style: ur,
2450
+ style: dr,
2443
2451
  children: [/* @__PURE__ */ D(T, {
2444
2452
  variant: "body",
2445
2453
  children: [
@@ -2455,28 +2463,28 @@ function fr({ instanceId: i, showAttachments: a = !0, showForm: ne = !0, showHis
2455
2463
  placeholder: "可填寫取消原因",
2456
2464
  resize: "vertical",
2457
2465
  rows: 3,
2458
- value: ot
2466
+ value: I
2459
2467
  })
2460
2468
  })]
2461
2469
  })
2462
2470
  })
2463
2471
  ] });
2464
2472
  }
2465
- function pr(e) {
2466
- return e.data.label ? e.data.label : e.data.isDefault ? "其他情況" : e.data.condition ?? "";
2467
- }
2468
2473
  function mr(e) {
2469
- return e.edges.map(pr).filter((e) => e.trim().length > 0);
2474
+ return e.data.label ? e.data.label : e.data.isDefault ? "其他情況" : e.data.condition ?? "";
2470
2475
  }
2471
2476
  function hr(e) {
2477
+ return e.edges.map(mr).filter((e) => e.trim().length > 0);
2478
+ }
2479
+ function gr(e) {
2472
2480
  return e === "startEvent" ? "開始" : e === "endEvent" ? "完成" : e === "userTask" ? "簽核節點" : e === "serviceTask" ? "知會節點" : e === "exclusiveGateway" ? "條件分流" : "平行處理";
2473
2481
  }
2474
- function gr(e, t, n, r) {
2482
+ function _r(e, t, n, r) {
2475
2483
  return e.nodes.map((e) => {
2476
- let i = on(e, t, n, r);
2484
+ let i = sn(e, t, n, r);
2477
2485
  return {
2478
2486
  data: {
2479
- kindLabel: hr(e.type),
2487
+ kindLabel: gr(e.type),
2480
2488
  label: e.data.label,
2481
2489
  secondaryLabel: i.secondaryLabel,
2482
2490
  statusLabel: i.statusLabel,
@@ -2490,36 +2498,36 @@ function gr(e, t, n, r) {
2490
2498
  };
2491
2499
  });
2492
2500
  }
2493
- function _r(e) {
2494
- let t = new I.graphlib.Graph();
2501
+ function vr(e) {
2502
+ let t = new at.graphlib.Graph();
2495
2503
  return t.setDefaultEdgeLabel(() => ({})), t.setGraph({
2496
2504
  nodesep: 56,
2497
2505
  rankdir: "LR",
2498
2506
  ranksep: 120
2499
2507
  }), e.nodes.forEach((e) => {
2500
2508
  t.setNode(e.id, {
2501
- height: tr,
2502
- width: er
2509
+ height: nr,
2510
+ width: tr
2503
2511
  });
2504
2512
  }), e.edges.forEach((e) => {
2505
2513
  t.setEdge(e.source, e.target);
2506
- }), I.layout(t), {
2514
+ }), at.layout(t), {
2507
2515
  ...e,
2508
2516
  nodes: e.nodes.map((e) => {
2509
2517
  let n = t.node(e.id);
2510
2518
  return n ? {
2511
2519
  ...e,
2512
2520
  position: {
2513
- x: n.x - er / 2,
2514
- y: n.y - tr / 2
2521
+ x: n.x - tr / 2,
2522
+ y: n.y - nr / 2
2515
2523
  }
2516
2524
  } : e;
2517
2525
  })
2518
2526
  };
2519
2527
  }
2520
- function vr(e) {
2528
+ function yr(e) {
2521
2529
  return e.edges.map((e) => {
2522
- let t = pr(e);
2530
+ let t = mr(e);
2523
2531
  return {
2524
2532
  animated: !1,
2525
2533
  id: e.id,
@@ -2547,25 +2555,25 @@ function vr(e) {
2547
2555
  };
2548
2556
  });
2549
2557
  }
2550
- function yr(e) {
2558
+ function br(e) {
2551
2559
  return e === "current" ? {
2552
- ...ir,
2560
+ ...ar,
2553
2561
  border: "1px solid var(--mzn-color-primary, #0057ff)",
2554
2562
  boxShadow: "0 0 0 3px rgba(0, 87, 255, 0.14)"
2555
2563
  } : e === "completed" ? {
2556
- ...ir,
2564
+ ...ar,
2557
2565
  border: "1px solid #16a34a"
2558
2566
  } : e === "cancelled" ? {
2559
- ...ir,
2567
+ ...ar,
2560
2568
  border: "1px solid #dc2626",
2561
2569
  opacity: .72
2562
2570
  } : e === "waiting" ? {
2563
- ...ir,
2571
+ ...ar,
2564
2572
  border: "1px dashed #64748b"
2565
- } : ir;
2573
+ } : ar;
2566
2574
  }
2567
- function br(e) {
2568
- let t = ar;
2575
+ function xr(e) {
2576
+ let t = or;
2569
2577
  return e === "current" ? {
2570
2578
  ...t,
2571
2579
  background: "#eff6ff",
@@ -2588,14 +2596,14 @@ function br(e) {
2588
2596
  color: "#64748b"
2589
2597
  };
2590
2598
  }
2591
- function xr({ data: e }) {
2599
+ function Sr({ data: e }) {
2592
2600
  return /* @__PURE__ */ D("div", {
2593
- style: yr(e.tone),
2601
+ style: br(e.tone),
2594
2602
  children: [
2595
2603
  /* @__PURE__ */ E(P, {
2596
2604
  isConnectable: !1,
2597
2605
  position: F.Left,
2598
- style: sr,
2606
+ style: cr,
2599
2607
  type: "target"
2600
2608
  }),
2601
2609
  /* @__PURE__ */ E(T, {
@@ -2606,24 +2614,24 @@ function xr({ data: e }) {
2606
2614
  children: e.label
2607
2615
  }),
2608
2616
  /* @__PURE__ */ E("span", {
2609
- style: br(e.tone),
2617
+ style: xr(e.tone),
2610
2618
  children: e.statusLabel
2611
2619
  }),
2612
2620
  /* @__PURE__ */ E("span", {
2613
2621
  title: e.secondaryLabel,
2614
- style: or,
2622
+ style: sr,
2615
2623
  children: e.secondaryLabel || e.kindLabel
2616
2624
  }),
2617
2625
  /* @__PURE__ */ E(P, {
2618
2626
  isConnectable: !1,
2619
2627
  position: F.Right,
2620
- style: sr,
2628
+ style: cr,
2621
2629
  type: "source"
2622
2630
  })
2623
2631
  ]
2624
2632
  });
2625
2633
  }
2626
2634
  //#endregion
2627
- export { kn as a, Nn as i, Kn as n, vn as o, Hn as r, gn as s, fr as t };
2635
+ export { An as a, Pn as i, qn as n, yn as o, Un as r, vn as s, pr as t };
2628
2636
 
2629
- //# sourceMappingURL=detail-CExpbazF.js.map
2637
+ //# sourceMappingURL=detail-4F39ggBn.js.map