@rytass/bpm-core-react 0.14.0 → 0.15.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 (83) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/dist/chunks/FormBuilderView-6bCbIkz6.cjs +3 -0
  3. package/dist/chunks/FormBuilderView-6bCbIkz6.cjs.map +1 -0
  4. package/dist/chunks/{FormBuilderView-BYLN6W-P.js → FormBuilderView-CLg-JYmu.js} +495 -452
  5. package/dist/chunks/FormBuilderView-CLg-JYmu.js.map +1 -0
  6. package/dist/chunks/FormRendererView-DU9LLrOF.js +999 -0
  7. package/dist/chunks/FormRendererView-DU9LLrOF.js.map +1 -0
  8. package/dist/chunks/FormRendererView-gctFIqwC.cjs +4 -0
  9. package/dist/chunks/FormRendererView-gctFIqwC.cjs.map +1 -0
  10. package/dist/chunks/{compose-CSWbRgJJ.js → compose-BtQPBd1Q.js} +5 -5
  11. package/dist/chunks/compose-BtQPBd1Q.js.map +1 -0
  12. package/dist/chunks/compose-DZhTQOt4.cjs +2 -0
  13. package/dist/chunks/compose-DZhTQOt4.cjs.map +1 -0
  14. package/dist/chunks/{designer-BtsIL0BB.js → designer-CrbBRPUU.js} +1285 -1197
  15. package/dist/chunks/designer-CrbBRPUU.js.map +1 -0
  16. package/dist/chunks/designer-D3_lWmfa.cjs +65 -0
  17. package/dist/chunks/designer-D3_lWmfa.cjs.map +1 -0
  18. package/dist/chunks/detail-CVXb5Vy8.cjs +2 -0
  19. package/dist/chunks/detail-CVXb5Vy8.cjs.map +1 -0
  20. package/dist/chunks/{detail-C8NOqY0p.js → detail-_c21WQla.js} +655 -630
  21. package/dist/chunks/detail-_c21WQla.js.map +1 -0
  22. package/dist/chunks/routes-config-C1j_vFKo.cjs.map +1 -1
  23. package/dist/chunks/routes-config-yZbESPlw.js.map +1 -1
  24. package/dist/chunks/task-node-label-BF6UllxP.cjs +2 -0
  25. package/dist/chunks/task-node-label-BF6UllxP.cjs.map +1 -0
  26. package/dist/chunks/task-node-label-CWZgOBj0.js +9 -0
  27. package/dist/chunks/task-node-label-CWZgOBj0.js.map +1 -0
  28. package/dist/lib/member-profile-resolution.d.ts +48 -0
  29. package/dist/lib/routes-config.d.ts +1 -1
  30. package/dist/lib/task-node-label.d.ts +10 -0
  31. package/dist/pages/instances/detail/index.cjs +1 -1
  32. package/dist/pages/instances/detail/index.js +1 -1
  33. package/dist/pages/templates/compose/index.cjs +1 -1
  34. package/dist/pages/templates/compose/index.js +1 -1
  35. package/dist/pages/templates/designer/index.cjs +1 -1
  36. package/dist/pages/templates/designer/index.js +1 -1
  37. package/dist/views/forms/builder/index.cjs +1 -1
  38. package/dist/views/forms/builder/index.js +1 -1
  39. package/dist/views/forms/renderer/form-field-link.d.ts +16 -0
  40. package/dist/views/forms/renderer/index.cjs +1 -1
  41. package/dist/views/forms/renderer/index.js +2 -2
  42. package/dist/views/forms/renderer/member-field-options.d.ts +39 -0
  43. package/dist/views/forms/renderer/member-field.d.ts +21 -0
  44. package/dist/views/inbox/index.cjs +1 -1
  45. package/dist/views/inbox/index.cjs.map +1 -1
  46. package/dist/views/inbox/index.js +100 -97
  47. package/dist/views/inbox/index.js.map +1 -1
  48. package/dist/views/instances/detail/index.cjs +1 -1
  49. package/dist/views/instances/detail/index.js +1 -1
  50. package/dist/views/instances/detail/sections/container-helpers.d.ts +3 -2
  51. package/dist/views/instances/detail/submitted-by.d.ts +23 -0
  52. package/dist/views/instances/new/index.cjs +1 -1
  53. package/dist/views/instances/new/index.js +1 -1
  54. package/dist/views/sent/SentView.d.ts +1 -1
  55. package/dist/views/sent/index.cjs +1 -1
  56. package/dist/views/sent/index.cjs.map +1 -1
  57. package/dist/views/sent/index.js +2 -2
  58. package/dist/views/sent/index.js.map +1 -1
  59. package/dist/views/templates/compose/index.cjs +1 -1
  60. package/dist/views/templates/compose/index.js +1 -1
  61. package/dist/views/templates/designer/designer-version-labels.d.ts +12 -0
  62. package/dist/views/templates/designer/dry-run-assignee-label.d.ts +28 -0
  63. package/dist/views/templates/designer/dry-run-sample-data.d.ts +9 -0
  64. package/dist/views/templates/designer/dynamic-form-resolver-options.d.ts +35 -0
  65. package/dist/views/templates/designer/index.cjs +1 -1
  66. package/dist/views/templates/designer/index.js +1 -1
  67. package/package.json +3 -3
  68. package/dist/chunks/FormBuilderView-BYLN6W-P.js.map +0 -1
  69. package/dist/chunks/FormBuilderView-VmdPVbg7.cjs +0 -3
  70. package/dist/chunks/FormBuilderView-VmdPVbg7.cjs.map +0 -1
  71. package/dist/chunks/FormRendererView-Bs8lTb4k.cjs +0 -2
  72. package/dist/chunks/FormRendererView-Bs8lTb4k.cjs.map +0 -1
  73. package/dist/chunks/FormRendererView-UPowZZgw.js +0 -798
  74. package/dist/chunks/FormRendererView-UPowZZgw.js.map +0 -1
  75. package/dist/chunks/compose-CHZoX-H0.cjs +0 -2
  76. package/dist/chunks/compose-CHZoX-H0.cjs.map +0 -1
  77. package/dist/chunks/compose-CSWbRgJJ.js.map +0 -1
  78. package/dist/chunks/designer-BtsIL0BB.js.map +0 -1
  79. package/dist/chunks/designer-Dm6cX2kZ.cjs +0 -65
  80. package/dist/chunks/designer-Dm6cX2kZ.cjs.map +0 -1
  81. package/dist/chunks/detail-C8NOqY0p.js.map +0 -1
  82. package/dist/chunks/detail-CX-3hZoL.cjs +0 -2
  83. package/dist/chunks/detail-CX-3hZoL.cjs.map +0 -1
@@ -3,20 +3,21 @@ import { n as e } from "./auth-provider-B5oPmvk2.js";
3
3
  import { t } from "./format-date-time-CB-LxzqT.js";
4
4
  import { t as n } from "./bpm-form-field-Cao0rMol.js";
5
5
  import { t as r } from "./use-bpm-member-D57LKe_u.js";
6
- import { i, t as a } from "./FormRendererView-UPowZZgw.js";
6
+ import { t as i } from "./task-node-label-CWZgOBj0.js";
7
+ import { o as a, t as o } from "./FormRendererView-DU9LLrOF.js";
7
8
  import '../style.css';import '../detail.css';/* empty css */
8
- import { Fragment as o, forwardRef as s, useCallback as c, useEffect as l, useImperativeHandle as u, useMemo as d, useRef as f, useState as p } from "react";
9
- import { AutoComplete as m, Badge as h, Button as g, Input as ee, Modal as _, PageHeader as v, Section as y, SectionGroup as te, Select as ne, Stepper as b, Table as x, Textarea as re, Tooltip as ie, Typography as S } from "@mezzanine-ui/react";
9
+ import { Fragment as s, forwardRef as c, useCallback as l, useEffect as u, useImperativeHandle as d, useMemo as f, useRef as p, useState as m } from "react";
10
+ import { AutoComplete as ee, Badge as h, Button as g, Input as te, Modal as _, PageHeader as v, Section as y, SectionGroup as ne, Select as b, Stepper as x, Table as re, Textarea as ie, Tooltip as ae, Typography as S } from "@mezzanine-ui/react";
10
11
  import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
11
- import { cancelAdhocDirective as ae, cancelApprovalInstance as oe, configureAdhocCompletionNotification as E, configureAdhocStageNotification as se, decideTask as ce, listAdhocDirectives as le, listAttachments as ue, listTaskDecisions as de, listWorkflowWebhookDeliveries as fe, readApprovalInstance as pe, readAttachmentDownloadUrl as me, readAttachmentPreviewUrl as he, readInstanceSignatures as ge, requestAdhocCountersign as _e, requestAdhocPreApproval as ve, resolveMemberProfiles as ye, resubmitApprovalInstance as be, retryWorkflowWebhookDelivery as xe, searchMembers as Se, uploadAttachment as Ce } from "@rytass/bpm-core-client/workflow";
12
- import we from "@mezzanine-ui/react/ContentHeader";
13
- import { CheckedIcon as Te, ChevronLeftIcon as D, ChevronRightIcon as Ee, DangerousOutlineIcon as De, DownloadIcon as Oe, FileSearchIcon as ke, NotificationUnreadIcon as Ae, PlusIcon as je, RefreshCcwIcon as Me, ResetIcon as O, ShareIcon as Ne, UserIcon as Pe, ZoomInIcon as Fe, ZoomOutIcon as Ie } from "@mezzanine-ui/icons";
14
- import { buildFormRendererValues as Le, focusFormRendererField as Re, readFormDataSourceErrorMessage as ze, validateFormRendererValues as Be } from "@rytass/bpm-core-client/form";
15
- import { Background as k, Controls as Ve, Handle as He, Position as Ue, ReactFlow as We } from "@xyflow/react";
16
- import * as Ge from "dagre";
17
- import { Document as A, Page as Ke } from "react-pdf";
18
- import { stepClasses as j } from "@mezzanine-ui/core/stepper";
19
- var M = {
12
+ import { cancelAdhocDirective as E, cancelApprovalInstance as oe, configureAdhocCompletionNotification as se, configureAdhocStageNotification as ce, decideTask as le, listAdhocDirectives as ue, listAttachments as de, listTaskDecisions as fe, listWorkflowWebhookDeliveries as pe, readApprovalInstance as me, readAttachmentDownloadUrl as he, readAttachmentPreviewUrl as ge, readInstanceSignatures as _e, requestAdhocCountersign as ve, requestAdhocPreApproval as ye, resolveMemberProfiles as be, resubmitApprovalInstance as xe, retryWorkflowWebhookDelivery as Se, searchMembers as Ce, uploadAttachment as we } from "@rytass/bpm-core-client/workflow";
13
+ import Te from "@mezzanine-ui/react/ContentHeader";
14
+ import { CheckedIcon as Ee, ChevronLeftIcon as D, ChevronRightIcon as De, DangerousOutlineIcon as Oe, DownloadIcon as ke, FileSearchIcon as O, NotificationUnreadIcon as Ae, PlusIcon as je, RefreshCcwIcon as Me, ResetIcon as Ne, ShareIcon as Pe, UserIcon as Fe, ZoomInIcon as Ie, ZoomOutIcon as Le } from "@mezzanine-ui/icons";
15
+ import { buildFormRendererValues as Re, focusFormRendererField as ze, readFormDataSourceErrorMessage as Be, validateFormRendererValues as Ve } from "@rytass/bpm-core-client/form";
16
+ import { Background as k, Controls as He, Handle as Ue, Position as A, ReactFlow as We } from "@xyflow/react";
17
+ import * as j from "dagre";
18
+ import { Document as Ge, Page as Ke } from "react-pdf";
19
+ import { stepClasses as M } from "@mezzanine-ui/core/stepper";
20
+ var N = {
20
21
  root: "bpm_root_ehm7w",
21
22
  toolbar: "bpm_toolbar_R-tis",
22
23
  pageControls: "bpm_pageControls_jM-rC",
@@ -25,39 +26,39 @@ var M = {
25
26
  viewport: "bpm_viewport_DQXms",
26
27
  page: "bpm_page_Cv5Rg",
27
28
  state: "bpm_state_bpgp3"
28
- }, N = 760, qe = 920, Je = 320, P = 32, F = .75, Ye = 1.75, I = .25;
29
- function Xe({ filename: e, fileUrl: t, onDownload: n }) {
30
- let r = f(null), [i, a] = p(null), [o, s] = p(1), [u, m] = p(1), [h, ee] = p(N);
31
- l(() => {
29
+ }, qe = 760, Je = 920, Ye = 320, P = 32, F = .75, I = 1.75, Xe = .25;
30
+ function Ze({ filename: e, fileUrl: t, onDownload: n }) {
31
+ let r = p(null), [i, a] = m(null), [o, s] = m(1), [c, d] = m(1), [ee, h] = m(qe);
32
+ u(() => {
32
33
  let e = r.current;
33
34
  if (!e || typeof ResizeObserver > "u") return;
34
35
  let t = new ResizeObserver((e) => {
35
36
  let t = e[0]?.contentRect.width;
36
- t && ee(t);
37
+ t && h(t);
37
38
  });
38
39
  return t.observe(e), () => t.disconnect();
39
- }, []), l(() => {
40
- a(null), s(1), m(1);
40
+ }, []), u(() => {
41
+ a(null), s(1), d(1);
41
42
  }, [t]);
42
- let _ = d(() => {
43
- let e = Math.max(Je, h - P);
44
- return Math.round(Math.min(qe, e) * u);
45
- }, [u, h]), v = c((e) => {
43
+ let te = f(() => {
44
+ let e = Math.max(Ye, ee - P);
45
+ return Math.round(Math.min(Je, e) * c);
46
+ }, [c, ee]), _ = l((e) => {
46
47
  a(e.numPages), s(1);
47
- }, []), y = o > 1, te = i !== null && o < i, ne = u > F, b = u < Ye, x = i === null ? `第 ${o} 頁` : `第 ${o} / ${i} 頁`, re = `${Math.round(u * 100)}%`;
48
+ }, []), v = o > 1, y = i !== null && o < i, ne = c > F, b = c < I, x = i === null ? `第 ${o} 頁` : `第 ${o} / ${i} 頁`, re = `${Math.round(c * 100)}%`;
48
49
  return /* @__PURE__ */ T("section", {
49
50
  "aria-label": `${e} PDF 預覽`,
50
- className: M.root,
51
+ className: N.root,
51
52
  children: [/* @__PURE__ */ T("div", {
52
- className: M.toolbar,
53
+ className: N.toolbar,
53
54
  children: [
54
55
  /* @__PURE__ */ T("div", {
55
- className: M.pageControls,
56
+ className: N.pageControls,
56
57
  "aria-label": "頁面切換",
57
58
  children: [
58
59
  /* @__PURE__ */ w(g, {
59
60
  "aria-label": "上一頁",
60
- disabled: !y,
61
+ disabled: !v,
61
62
  icon: D,
62
63
  onClick: () => {
63
64
  s((e) => Math.max(1, e - 1));
@@ -66,15 +67,15 @@ function Xe({ filename: e, fileUrl: t, onDownload: n }) {
66
67
  variant: "base-secondary"
67
68
  }),
68
69
  /* @__PURE__ */ w(S, {
69
- className: M.counter,
70
+ className: N.counter,
70
71
  component: "span",
71
72
  variant: "body",
72
73
  children: x
73
74
  }),
74
75
  /* @__PURE__ */ w(g, {
75
76
  "aria-label": "下一頁",
76
- disabled: !te,
77
- icon: Ee,
77
+ disabled: !y,
78
+ icon: De,
78
79
  onClick: () => {
79
80
  s((e) => i === null ? e : Math.min(i, e + 1));
80
81
  },
@@ -84,21 +85,21 @@ function Xe({ filename: e, fileUrl: t, onDownload: n }) {
84
85
  ]
85
86
  }),
86
87
  /* @__PURE__ */ T("div", {
87
- className: M.zoomControls,
88
+ className: N.zoomControls,
88
89
  "aria-label": "縮放",
89
90
  children: [
90
91
  /* @__PURE__ */ w(g, {
91
92
  "aria-label": "縮小",
92
93
  disabled: !ne,
93
- icon: Ie,
94
+ icon: Le,
94
95
  onClick: () => {
95
- m((e) => Math.max(F, e - I));
96
+ d((e) => Math.max(F, e - Xe));
96
97
  },
97
98
  size: "minor",
98
99
  variant: "base-secondary"
99
100
  }),
100
101
  /* @__PURE__ */ w(S, {
101
- className: M.counter,
102
+ className: N.counter,
102
103
  component: "span",
103
104
  variant: "body",
104
105
  children: re
@@ -106,9 +107,9 @@ function Xe({ filename: e, fileUrl: t, onDownload: n }) {
106
107
  /* @__PURE__ */ w(g, {
107
108
  "aria-label": "放大",
108
109
  disabled: !b,
109
- icon: Fe,
110
+ icon: Ie,
110
111
  onClick: () => {
111
- m((e) => Math.min(Ye, e + I));
112
+ d((e) => Math.min(I, e + Xe));
112
113
  },
113
114
  size: "minor",
114
115
  variant: "base-secondary"
@@ -116,7 +117,7 @@ function Xe({ filename: e, fileUrl: t, onDownload: n }) {
116
117
  ]
117
118
  }),
118
119
  n ? /* @__PURE__ */ w(g, {
119
- icon: Oe,
120
+ icon: ke,
120
121
  iconType: "leading",
121
122
  onClick: n,
122
123
  size: "minor",
@@ -125,21 +126,21 @@ function Xe({ filename: e, fileUrl: t, onDownload: n }) {
125
126
  }) : null
126
127
  ]
127
128
  }), /* @__PURE__ */ w("div", {
128
- className: M.viewport,
129
+ className: N.viewport,
129
130
  ref: r,
130
- children: /* @__PURE__ */ w(A, {
131
+ children: /* @__PURE__ */ w(Ge, {
131
132
  error: /* @__PURE__ */ w(L, { message: "PDF 無法載入。" }),
132
133
  file: t,
133
134
  loading: /* @__PURE__ */ w(L, { message: "正在載入 PDF..." }),
134
135
  noData: /* @__PURE__ */ w(L, { message: "沒有可預覽的 PDF。" }),
135
- onLoadSuccess: v,
136
+ onLoadSuccess: _,
136
137
  children: /* @__PURE__ */ w(Ke, {
137
- className: M.page,
138
+ className: N.page,
138
139
  loading: /* @__PURE__ */ w(L, { message: "正在載入頁面..." }),
139
140
  pageNumber: o,
140
141
  renderAnnotationLayer: !0,
141
142
  renderTextLayer: !0,
142
- width: _
143
+ width: te
143
144
  })
144
145
  })
145
146
  })]
@@ -147,7 +148,7 @@ function Xe({ filename: e, fileUrl: t, onDownload: n }) {
147
148
  }
148
149
  function L({ message: e }) {
149
150
  return /* @__PURE__ */ w("div", {
150
- className: M.state,
151
+ className: N.state,
151
152
  children: /* @__PURE__ */ w(S, {
152
153
  color: "text-neutral",
153
154
  variant: "body",
@@ -156,8 +157,19 @@ function L({ message: e }) {
156
157
  });
157
158
  }
158
159
  //#endregion
160
+ //#region src/views/instances/detail/submitted-by.ts
161
+ function R({ initiatorMemberId: e, submittedByMemberId: t }) {
162
+ return t && t !== e ? t : null;
163
+ }
164
+ function Qe(e, t) {
165
+ let n = R(e);
166
+ if (!n || !e.initiatorMemberId) return null;
167
+ let r = (e) => t.get(e)?.name ?? e;
168
+ return `由 ${r(n)} 代 ${r(e.initiatorMemberId)} 送出`;
169
+ }
170
+ //#endregion
159
171
  //#region src/views/instances/detail/sections/shared.ts
160
- function R(e) {
172
+ function $e(e) {
161
173
  let t = z(e, "from"), n = z(e, "to"), r = z(e, "reason");
162
174
  return !t || !n || !r ? null : {
163
175
  from: t,
@@ -166,10 +178,10 @@ function R(e) {
166
178
  to: n
167
179
  };
168
180
  }
169
- function Ze(e) {
181
+ function et(e) {
170
182
  try {
171
183
  let t = JSON.parse(e);
172
- return Array.isArray(t) ? t.map((e) => $e(e) ? R(e) : null).filter((e) => e !== null) : [];
184
+ return Array.isArray(t) ? t.map((e) => H(e) ? $e(e) : null).filter((e) => e !== null) : [];
173
185
  } catch {
174
186
  return [];
175
187
  }
@@ -182,77 +194,77 @@ function B(e, t) {
182
194
  let n = e[t];
183
195
  return Array.isArray(n) ? n.filter((e) => typeof e == "string") : [];
184
196
  }
185
- function Qe(e, t) {
197
+ function tt(e, t) {
186
198
  let n = e[t];
187
199
  return typeof n == "number" ? n : null;
188
200
  }
189
201
  function V(e) {
190
202
  return typeof e == "string" && e.trim().length > 0;
191
203
  }
192
- function $e(e) {
204
+ function H(e) {
193
205
  return typeof e == "object" && !!e;
194
206
  }
195
- function et(e) {
207
+ function nt(e) {
196
208
  return e.status === "PENDING" || e.status === "IN_PROGRESS";
197
209
  }
198
- function H(e) {
199
- return ze(e) || (e instanceof Error ? e.message : "發生未知錯誤");
200
- }
201
210
  function U(e) {
211
+ return Be(e) || (e instanceof Error ? e.message : "發生未知錯誤");
212
+ }
213
+ function rt(e) {
202
214
  return !Number.isFinite(e) || e <= 0 ? "-" : e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1024 / 1024).toFixed(1)} MB`;
203
215
  }
204
- function tt(e) {
216
+ function it(e) {
205
217
  return e.length > 16 ? `${e.slice(0, 12)}...` : e;
206
218
  }
207
- function nt(e) {
219
+ function at(e) {
208
220
  return e === "APPROVED" ? "已同意" : e === "CANCELLED" ? "已取消" : e === "DRAFT" ? "草稿" : e === "EXPIRED" ? "已逾期" : e === "REJECTED" ? "已拒絕" : e === "RETURNED" ? "已退回" : e === "RUNNING" ? "進行中" : e;
209
221
  }
210
- function rt(e) {
222
+ function ot(e) {
211
223
  return e === "PENDING" ? "待處理" : e === "IN_PROGRESS" ? "處理中" : e === "COMPLETED" ? "已完成" : e === "CANCELLED" ? "已取消" : e === "TRANSFERRED" ? "已轉派" : e;
212
224
  }
213
- function it(e) {
225
+ function W(e) {
214
226
  return e === "APPROVED" ? "同意" : e === "REJECTED" ? "拒絕" : e === "RETURNED" ? "退回" : e === "TRANSFERRED" ? "轉派" : e;
215
227
  }
216
- function W(e) {
228
+ function G(e) {
217
229
  return e === "startEvent" ? "開始" : e === "endEvent" ? "完成" : e === "userTask" ? "簽核節點" : e === "serviceTask" ? "知會節點" : e === "exclusiveGateway" ? "條件分流" : "平行處理";
218
230
  }
219
- function at(e, t) {
231
+ function st(e, t) {
220
232
  return t?.nodes.find((t) => t.id === e)?.data.label ?? e;
221
233
  }
222
- function G(e, t) {
234
+ function K(e, t) {
223
235
  if (!e) return "-";
224
236
  let n = t.get(e);
225
237
  return n ? `${n.name}(${n.email})` : e;
226
238
  }
227
- function ot(e, t = /* @__PURE__ */ new Map()) {
228
- let n = Ze(e.delegationChainJson);
229
- if (!e.assigneeMemberId) return e.candidateMemberIds.length ? `候選 ${e.candidateMemberIds.map((e) => G(e, t)).join("、")}` : "未指定";
230
- let r = G(e.assigneeMemberId, t), i = G(e.originalAssigneeMemberId, t);
239
+ function ct(e, t = /* @__PURE__ */ new Map()) {
240
+ let n = et(e.delegationChainJson);
241
+ if (!e.assigneeMemberId) return e.candidateMemberIds.length ? `候選 ${e.candidateMemberIds.map((e) => K(e, t)).join("、")}` : "未指定";
242
+ let r = K(e.assigneeMemberId, t), i = K(e.originalAssigneeMemberId, t);
231
243
  return n.length === 0 || e.originalAssigneeMemberId === e.assigneeMemberId ? r : `${r}(原:${i})`;
232
244
  }
233
- function st(e, t) {
245
+ function lt(e, t) {
234
246
  return t ? e.assigneeMemberId === t || (e.openCandidateMemberIds ?? e.candidateMemberIds).includes(t) : !1;
235
247
  }
236
- function ct(e, t) {
248
+ function ut(e, t) {
237
249
  if (t.type !== "userTask" || !t.data.returnBehavior.allowReturn) return [];
238
250
  if (t.data.returnBehavior.allowedTargets === "ANY") return e.nodes.filter((e) => e.id !== t.id).map((e) => ({
239
251
  id: e.id,
240
- name: `${e.data.label}(${W(e.type)})`
252
+ name: `${e.data.label}(${G(e.type)})`
241
253
  }));
242
254
  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);
243
255
  return r ? [{
244
256
  id: r.id,
245
- name: `${r.data.label}(${W(r.type)})`
257
+ name: `${r.data.label}(${G(r.type)})`
246
258
  }] : [];
247
259
  }
248
- function lt(e) {
260
+ function q(e) {
249
261
  return {
250
262
  email: e.email,
251
263
  id: e.memberId,
252
264
  name: `${e.name} · ${e.email}`
253
265
  };
254
266
  }
255
- function K({ memberIds: e, useWebhookTarget: t, webhookUrl: n }) {
267
+ function dt({ memberIds: e, useWebhookTarget: t, webhookUrl: n }) {
256
268
  if (t) {
257
269
  let e = n.trim();
258
270
  return e ? {
@@ -277,11 +289,11 @@ function K({ memberIds: e, useWebhookTarget: t, webhookUrl: n }) {
277
289
  valid: !1
278
290
  };
279
291
  }
280
- function ut(e) {
292
+ function ft(e) {
281
293
  return !!e;
282
294
  }
283
- function dt(e) {
284
- if (!$e(e)) return null;
295
+ function pt(e) {
296
+ if (!H(e)) return null;
285
297
  let t = e.email, n = e.id, r = e.name;
286
298
  return typeof n == "string" && typeof r == "string" ? {
287
299
  email: typeof t == "string" ? t : null,
@@ -289,7 +301,7 @@ function dt(e) {
289
301
  name: r
290
302
  } : null;
291
303
  }
292
- function ft(e, t) {
304
+ function mt(e, t) {
293
305
  let n = e.trim().toLocaleLowerCase();
294
306
  if (!n) return null;
295
307
  let r = t.filter((e) => [
@@ -299,13 +311,13 @@ function ft(e, t) {
299
311
  ].some((e) => e.toLocaleLowerCase().includes(n)));
300
312
  return r.length === 1 ? r[0] ?? null : null;
301
313
  }
302
- function q(e) {
314
+ function J(e) {
303
315
  return V(e) ? {
304
316
  text: e,
305
317
  type: "text"
306
318
  } : null;
307
319
  }
308
- function pt(e, t, n = "neutral") {
320
+ function ht(e, t, n = "neutral") {
309
321
  return V(t) ? {
310
322
  label: e,
311
323
  text: t,
@@ -313,7 +325,7 @@ function pt(e, t, n = "neutral") {
313
325
  type: "comment"
314
326
  } : null;
315
327
  }
316
- function mt(e, t, n, r) {
328
+ function gt(e, t, n, r) {
317
329
  let i = t ? n.get(t) : null;
318
330
  return {
319
331
  email: i?.email ?? null,
@@ -323,200 +335,204 @@ function mt(e, t, n, r) {
323
335
  type: "member"
324
336
  };
325
337
  }
326
- function J(e) {
338
+ function Y(e) {
327
339
  return !!e;
328
340
  }
329
- function ht(e) {
341
+ function _t(e) {
330
342
  let t = e.findIndex((e) => e.id.startsWith("pending-task-") || e.id.startsWith("future-node-"));
331
343
  return t === -1 ? e.length : t;
332
344
  }
333
- function gt(e) {
334
- return e.eventType === "INSTANCE_STARTED" || e.eventType === "TASK_DECIDED" || e.eventType === "SLA_TRIGGERED" || e.eventType === "TASK_CANDIDATE_ACTIVATED" || Y(e) || X(e.eventType, xt(e));
345
+ function X(e) {
346
+ return e.eventType === "INSTANCE_STARTED" || e.eventType === "TASK_DECIDED" || e.eventType === "SLA_TRIGGERED" || e.eventType === "TASK_CANDIDATE_ACTIVATED" || vt(e) || Z(e.eventType, Q(e));
335
347
  }
336
- function Y(e) {
337
- return e.eventType === "TASK_CREATED" && B(xt(e), "sequentialCandidateMemberIds").length > 0;
348
+ function vt(e) {
349
+ return e.eventType === "TASK_CREATED" && B(Q(e), "sequentialCandidateMemberIds").length > 0;
338
350
  }
339
- function _t(e) {
351
+ function yt(e) {
340
352
  if (e.eventType !== "TASK_CANDIDATE_ACTIVATED" && e.eventType !== "TASK_CREATED") return [];
341
- let t = xt(e);
353
+ let t = Q(e);
342
354
  return [
343
355
  ...B(t, "sequentialCandidateMemberIds"),
344
356
  z(t, "candidateMemberId"),
345
357
  z(t, "previousMemberId")
346
358
  ].filter(V);
347
359
  }
348
- var vt = /* @__PURE__ */ new Set([
360
+ var bt = /* @__PURE__ */ new Set([
349
361
  "SERVICE_TASK_EXECUTED",
350
362
  "SERVICE_TASK_FAILED",
351
363
  "WEBHOOK_DELIVERY_RETRIED"
352
364
  ]);
353
- function X(e, t) {
354
- return vt.has(e) && z(t, "action") === "NOTIFY_WEBHOOK";
365
+ function Z(e, t) {
366
+ return bt.has(e) && z(t, "action") === "NOTIFY_WEBHOOK";
355
367
  }
356
- function Z(e) {
368
+ function xt(e) {
357
369
  return z(e, "endpointLabel") ?? z(e, "endpointKey") ?? "外部系統";
358
370
  }
359
- function yt(e) {
371
+ function St(e) {
360
372
  return e === "APPROVED" ? "已同意" : e === "REJECTED" ? "已拒絕" : e === "RETURNED" ? "已退回" : e === "TRANSFERRED" ? "已轉派" : "簽核已決議";
361
373
  }
362
- function bt(e, t) {
374
+ function Ct(e, t) {
363
375
  if (e === "INSTANCE_STARTED") return "案件已發起";
364
376
  if (e === "TOKEN_CREATED") return "流程路徑已建立";
365
377
  if (e === "ENGINE_PROCESS_REQUESTED") return "流程引擎已處理";
366
378
  if (e === "TOKEN_ADVANCED") return "流程已前進";
367
379
  if (e === "TASK_CREATED") return "待簽任務已建立";
368
380
  if (e === "TASK_CANDIDATE_ACTIVATED") return "輪到下一位簽核";
369
- if (e === "TASK_DECIDED") return yt(z(t, "action"));
381
+ if (e === "TASK_DECIDED") return St(z(t, "action"));
370
382
  if (e === "SLA_TRIGGERED") return "時限提醒已觸發";
371
- if (X(e, t)) {
372
- let n = Z(t);
383
+ if (Z(e, t)) {
384
+ let n = xt(t);
373
385
  return e === "SERVICE_TASK_EXECUTED" ? `已通知外部系統:${n}` : e === "SERVICE_TASK_FAILED" ? `通知外部系統失敗:${n}` : `管理者重新傳送外部系統通知:${n}`;
374
386
  }
375
387
  return e;
376
388
  }
377
- function xt(e) {
389
+ function Q(e) {
378
390
  try {
379
391
  let t = JSON.parse(e.payloadJson);
380
- return $e(t) ? t : {};
392
+ return H(t) ? t : {};
381
393
  } catch {
382
394
  return {};
383
395
  }
384
396
  }
385
- function St(e, t) {
386
- return e.eventType === "SLA_TRIGGERED" || e.eventType === "SERVICE_TASK_FAILED" && X(e.eventType, t) || z(t, "action") === "REJECTED" || z(t, "instanceState") === "REJECTED";
397
+ function wt(e, t) {
398
+ return e.eventType === "SLA_TRIGGERED" || e.eventType === "SERVICE_TASK_FAILED" && Z(e.eventType, t) || z(t, "action") === "REJECTED" || z(t, "instanceState") === "REJECTED";
387
399
  }
388
- function Q(e) {
400
+ function Tt(e) {
389
401
  return t(e);
390
402
  }
391
- function Ct(e, t, n, r) {
403
+ function Et(e, t, n, r) {
404
+ if (e.eventType === "INSTANCE_STARTED") return Qe({
405
+ initiatorMemberId: e.actorMemberId,
406
+ submittedByMemberId: z(t, "submittedByMemberId")
407
+ }, r);
392
408
  if (e.eventType === "TASK_CANDIDATE_ACTIVATED") {
393
409
  let e = z(t, "candidateMemberId"), n = z(t, "previousMemberId");
394
410
  if (!e) return null;
395
- let i = G(e, r);
396
- return n ? `輪到:${i}(前一位:${G(n, r)})` : `輪到:${i}`;
411
+ let i = K(e, r);
412
+ return n ? `輪到:${i}(前一位:${K(n, r)})` : `輪到:${i}`;
397
413
  }
398
414
  if (e.eventType === "TASK_CREATED") {
399
415
  let e = B(t, "sequentialCandidateMemberIds");
400
- if (e.length) return `簽核順序:${e.map((e) => G(e, r)).join(" → ")}`;
416
+ if (e.length) return `簽核順序:${e.map((e) => K(e, r)).join(" → ")}`;
401
417
  let n = z(t, "assigneeMemberId"), i = z(t, "originalAssigneeMemberId");
402
418
  if (!n) {
403
419
  let e = B(t, "candidateMemberIds");
404
- return e.length ? `候選簽核人:${e.map((e) => G(e, r)).join("、")}` : null;
420
+ return e.length ? `候選簽核人:${e.map((e) => K(e, r)).join("、")}` : null;
405
421
  }
406
- let a = G(n, r), o = G(i, r);
422
+ let a = K(n, r), o = K(i, r);
407
423
  return i && i !== n ? `待簽人:${a}(原簽核人:${o})` : `待簽人:${a}`;
408
424
  }
409
425
  if (e.eventType === "TASK_DECIDED") {
410
- let e = z(t, "action"), n = z(t, "comment"), i = e ? `決議:${it(e)}` : null, a = z(t, "transferToMemberId");
411
- return e === "REJECTED" && n ? [i, `拒絕原因:${n}`].filter(V).join(" · ") : e === "APPROVED" && n ? [i, `同意說明:${n}`].filter(V).join(" · ") : e === "TRANSFERRED" ? [i, `轉派給:${G(a, r)}`].filter(V).join(" · ") : i;
426
+ let e = z(t, "action"), n = z(t, "comment"), i = e ? `決議:${W(e)}` : null, a = z(t, "transferToMemberId");
427
+ return e === "REJECTED" && n ? [i, `拒絕原因:${n}`].filter(V).join(" · ") : e === "APPROVED" && n ? [i, `同意說明:${n}`].filter(V).join(" · ") : e === "TRANSFERRED" ? [i, `轉派給:${K(a, r)}`].filter(V).join(" · ") : i;
412
428
  }
413
429
  if (e.eventType === "TOKEN_ADVANCED") {
414
430
  let e = z(t, "action");
415
- if (e) return `流程結果:${it(e)}`;
416
- let r = Qe(t, "arrivedCount"), i = Qe(t, "requiredCount");
431
+ if (e) return `流程結果:${W(e)}`;
432
+ let r = tt(t, "arrivedCount"), i = tt(t, "requiredCount");
417
433
  if (r !== null && i !== null) return `等待匯合:${r}/${i}`;
418
434
  let a = z(t, "fromNodeId"), o = z(t, "toNodeId");
419
- if (a && o) return `由 ${at(a, n)} 前進至 ${at(o, n)}`;
435
+ if (a && o) return `由 ${st(a, n)} 前進至 ${st(o, n)}`;
420
436
  }
421
437
  if (e.eventType === "ENGINE_PROCESS_REQUESTED") {
422
438
  let e = z(t, "state");
423
- return e ? `案件狀態:${nt(e)}` : null;
439
+ return e ? `案件狀態:${at(e)}` : null;
424
440
  }
425
441
  return null;
426
442
  }
427
- function wt(e, t, n, r, i, a, o) {
428
- if (e.eventType !== "TASK_DECIDED") return [q(Ct(e, t, n, o))].filter(J);
443
+ function Dt(e, t, n, r, i, a, o) {
444
+ if (e.eventType !== "TASK_DECIDED") return [J(Et(e, t, n, o))].filter(Y);
429
445
  let s = e.taskId ? r.get(e.taskId) : null, c = z(t, "action") ?? s?.action ?? null, l = z(t, "comment") ?? s?.comment ?? null, u = z(t, "transferToMemberId") ?? s?.transferToMemberId ?? null, d = z(t, "signatureId") ?? s?.signatureId ?? null, f = d ? i.get(d) : null;
430
446
  return [
431
- q(c ? `決議:${it(c)}` : null),
432
- c === "REJECTED" ? pt("拒絕原因", l ?? "-", "danger") : null,
433
- c === "APPROVED" ? pt("同意說明", l) : null,
434
- c === "RETURNED" ? pt("退回說明", l ?? "-") : null,
435
- c === "TRANSFERRED" ? q(`轉派給:${G(u, o)}`) : null,
436
- c === "TRANSFERRED" ? pt("轉派說明", l ?? "-") : null,
437
- f ? q(a?.valid ? `簽章:已驗證(${tt(f.signedPayloadHash)})` : `簽章:待檢查(${tt(f.signedPayloadHash)})`) : null
438
- ].filter(J);
439
- }
440
- function Tt(e, t, n, r, i) {
447
+ J(c ? `決議:${W(c)}` : null),
448
+ c === "REJECTED" ? ht("拒絕原因", l ?? "-", "danger") : null,
449
+ c === "APPROVED" ? ht("同意說明", l) : null,
450
+ c === "RETURNED" ? ht("退回說明", l ?? "-") : null,
451
+ c === "TRANSFERRED" ? J(`轉派給:${K(u, o)}`) : null,
452
+ c === "TRANSFERRED" ? ht("轉派說明", l ?? "-") : null,
453
+ f ? J(a?.valid ? `簽章:已驗證(${it(f.signedPayloadHash)})` : `簽章:待檢查(${it(f.signedPayloadHash)})`) : null
454
+ ].filter(Y);
455
+ }
456
+ function Ot(e, t, n, r, i) {
441
457
  if (e.type === "startEvent" || i.has(e.id)) return !1;
442
458
  if (r === "REJECTED") return !0;
443
- let a = Nt(e, t, n, r);
459
+ let a = It(e, t, n, r);
444
460
  return a.tone === "neutral" || a.tone === "waiting";
445
461
  }
446
- function Et(e, t, n, r, i) {
462
+ function $(e, t, n, r, i) {
447
463
  if (r !== "RUNNING" && r !== "REJECTED") return [];
448
- let a = e.nodes.filter((e) => Tt(e, t, n, r, i)), o = $(e, a, t, n, i), s = new Map(e.nodes.map((e, t) => [e.id, t]));
464
+ let a = e.nodes.filter((e) => Ot(e, t, n, r, i)), o = kt(e, a, t, n, i), s = new Map(e.nodes.map((e, t) => [e.id, t]));
449
465
  return a.filter((e) => o.has(e.id)).sort((e, t) => {
450
466
  let n = o.get(e.id) ?? 0, r = o.get(t.id) ?? 0;
451
467
  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;
452
468
  });
453
469
  }
454
- function $(e, t, n, r, i) {
470
+ function kt(e, t, n, r, i) {
455
471
  let a = new Set(t.map((e) => e.id)), o = e.edges.reduce((e, t) => {
456
472
  let n = [...e.get(t.source) ?? [], t.target];
457
473
  return new Map(e).set(t.source, n);
458
474
  }, /* @__PURE__ */ new Map());
459
- return Dt(e, n, r, i).reduce((e, t) => At(e, Ot(t, o, a)), /* @__PURE__ */ new Map());
475
+ return At(e, n, r, i).reduce((e, t) => Nt(e, jt(t, o, a)), /* @__PURE__ */ new Map());
460
476
  }
461
- function Dt(e, t, n, r) {
462
- let i = n.filter((e) => e.status === "ACTIVE" || e.status === "WAITING").map((e) => e.currentNodeId), a = t.filter(et).map((e) => e.nodeId), o = e.nodes.filter((e) => r.has(e.id)).map((e) => e.id), s = [.../* @__PURE__ */ new Set([
477
+ function At(e, t, n, r) {
478
+ let i = n.filter((e) => e.status === "ACTIVE" || e.status === "WAITING").map((e) => e.currentNodeId), a = t.filter(nt).map((e) => e.nodeId), o = e.nodes.filter((e) => r.has(e.id)).map((e) => e.id), s = [.../* @__PURE__ */ new Set([
463
479
  ...i,
464
480
  ...a,
465
481
  ...o
466
482
  ])], c = e.nodes.filter((e) => e.type === "startEvent").map((e) => e.id);
467
483
  return s.length > 0 ? s : c;
468
484
  }
469
- function Ot(e, t, n) {
470
- return kt([{
485
+ function jt(e, t, n) {
486
+ return Mt([{
471
487
  distance: 0,
472
488
  nodeId: e
473
489
  }], t, n);
474
490
  }
475
- function kt(e, t, n, r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map()) {
491
+ function Mt(e, t, n, r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map()) {
476
492
  let [a, ...o] = e;
477
493
  if (!a) return i;
478
- if (r.has(a.nodeId)) return kt(o, t, n, r, i);
494
+ if (r.has(a.nodeId)) return Mt(o, t, n, r, i);
479
495
  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;
480
- return kt([...o, ...(t.get(a.nodeId) ?? []).map((e) => ({
496
+ return Mt([...o, ...(t.get(a.nodeId) ?? []).map((e) => ({
481
497
  distance: a.distance + 1,
482
498
  nodeId: e
483
499
  }))], t, n, s, c);
484
500
  }
485
- function At(e, t) {
501
+ function Nt(e, t) {
486
502
  return [...t.entries()].reduce((e, [t, n]) => new Map(e).set(t, Math.min(e.get(t) ?? n, n)), e);
487
503
  }
488
- function jt(e) {
504
+ function Pt(e) {
489
505
  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}`;
490
506
  }
491
- function Mt(e, t, n, r, i, a, o, s, c) {
492
- let l = e.filter(gt).map((e) => {
493
- let t = xt(e), n = e.nodeId ? at(e.nodeId, r) : null;
507
+ function Ft(e, t, n, r, i, a, o, s, c) {
508
+ let l = e.filter(X).map((e) => {
509
+ let t = Q(e), n = e.nodeId ? st(e.nodeId, r) : null;
494
510
  return {
495
511
  descriptionParts: [
496
- q(n ? `節點:${n}` : "節點:全流程"),
497
- mt("操作者", e.actorMemberId, a, "系統"),
498
- q(`時間:${Q(e.createdAt)}`),
499
- ...wt(e, t, r, o, s, c, a)
500
- ].filter(J),
501
- error: St(e, t),
512
+ J(n ? `節點:${n}` : "節點:全流程"),
513
+ gt("操作者", e.actorMemberId, a, "系統"),
514
+ J(`時間:${Tt(e.createdAt)}`),
515
+ ...Dt(e, t, r, o, s, c, a)
516
+ ].filter(Y),
517
+ error: wt(e, t),
502
518
  id: e.id,
503
- title: bt(e.eventType, t)
519
+ title: Ct(e.eventType, t)
504
520
  };
505
- }), u = t.filter(et).map((e) => ({
521
+ }), u = t.filter(nt).map((e) => ({
506
522
  descriptionParts: [
507
- q(`節點:${at(e.nodeId, r)}`),
508
- mt("處理者", e.assigneeMemberId, a, "未指定"),
509
- q(`建立時間:${Q(e.createdAt)}`)
510
- ].filter(J),
523
+ J(`節點:${st(e.nodeId, r)}`),
524
+ gt("處理者", e.assigneeMemberId, a, "未指定"),
525
+ J(`建立時間:${Tt(e.createdAt)}`)
526
+ ].filter(Y),
511
527
  error: !1,
512
528
  id: `pending-task-${e.id}`,
513
529
  title: e.status === "IN_PROGRESS" ? "簽核處理中" : "等待簽核處理"
514
- })), d = new Set([...e.filter(gt).map((e) => e.nodeId), ...t.map((e) => e.nodeId)].filter(V)), f = r ? Et(r, t, n, i, d).map((e) => ({
515
- descriptionParts: [q(`${W(e.type)} · 尚未抵達`)].filter(J),
530
+ })), d = new Set([...e.filter(X).map((e) => e.nodeId), ...t.map((e) => e.nodeId)].filter(V)), f = r ? $(r, t, n, i, d).map((e) => ({
531
+ descriptionParts: [J(`${G(e.type)} · 尚未抵達`)].filter(Y),
516
532
  error: !1,
517
533
  forcePending: !0,
518
534
  id: `future-node-${e.id}`,
519
- title: jt(e)
535
+ title: Pt(e)
520
536
  })) : [];
521
537
  return [
522
538
  ...l,
@@ -524,18 +540,18 @@ function Mt(e, t, n, r, i, a, o, s, c) {
524
540
  ...f
525
541
  ];
526
542
  }
527
- function Nt(e, t, n, r) {
543
+ function It(e, t, n, r) {
528
544
  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");
529
545
  return a ? {
530
- secondaryLabel: `處理者 ${ot(a)}`,
546
+ secondaryLabel: `處理者 ${ct(a)}`,
531
547
  statusLabel: "待處理",
532
548
  tone: "current"
533
549
  } : o ? {
534
- secondaryLabel: `已取消 ${ot(o)}`,
550
+ secondaryLabel: `已取消 ${ct(o)}`,
535
551
  statusLabel: "已取消",
536
552
  tone: "cancelled"
537
553
  } : s ? {
538
- secondaryLabel: `已完成 ${ot(s)}`,
554
+ secondaryLabel: `已完成 ${ct(s)}`,
539
555
  statusLabel: "已完成",
540
556
  tone: "completed"
541
557
  } : l ? {
@@ -555,40 +571,42 @@ function Nt(e, t, n, r) {
555
571
  statusLabel: r === "REJECTED" ? "已拒絕" : "已完成",
556
572
  tone: r === "REJECTED" ? "cancelled" : "completed"
557
573
  } : {
558
- secondaryLabel: W(e.type),
574
+ secondaryLabel: G(e.type),
559
575
  statusLabel: "未抵達",
560
576
  tone: "neutral"
561
577
  };
562
578
  }
563
579
  //#endregion
564
580
  //#region src/views/instances/detail/sections/container-helpers.ts
565
- async function Pt({ activityLogs: e, adhocDirectives: t = [], tasks: n }) {
566
- let r = [...new Set([
581
+ async function Lt({ activityLogs: e, adhocDirectives: t = [], instance: n, tasks: r }) {
582
+ let i = [...new Set([
583
+ n?.initiatorMemberId ?? null,
584
+ n?.submittedByMemberId ?? null,
567
585
  ...e.map((e) => e.actorMemberId),
568
- ...e.flatMap(_t),
569
- ...n.map((e) => e.assigneeMemberId),
570
- ...n.map((e) => e.originalAssigneeMemberId),
571
- ...n.flatMap((e) => e.candidateMemberIds),
572
- ...n.flatMap((e) => Ze(e.delegationChainJson).flatMap((e) => [e.from, e.to])),
573
- ...t.flatMap((e) => [e.createdByMemberId, ...Ft(e.targetValueJson)])
586
+ ...e.flatMap(yt),
587
+ ...r.map((e) => e.assigneeMemberId),
588
+ ...r.map((e) => e.originalAssigneeMemberId),
589
+ ...r.flatMap((e) => e.candidateMemberIds),
590
+ ...r.flatMap((e) => et(e.delegationChainJson).flatMap((e) => [e.from, e.to])),
591
+ ...t.flatMap((e) => [e.createdByMemberId, ...Rt(e.targetValueJson)])
574
592
  ].filter(V))];
575
593
  try {
576
- return await ye(r);
594
+ return await be(i);
577
595
  } catch {
578
596
  return [];
579
597
  }
580
598
  }
581
- function Ft(e) {
599
+ function Rt(e) {
582
600
  try {
583
601
  return (JSON.parse(e).memberIds ?? []).filter((e) => typeof e == "string");
584
602
  } catch {
585
603
  return [];
586
604
  }
587
605
  }
588
- async function It(e) {
589
- return (await Promise.all(e.map((e) => de(e.id)))).flat();
606
+ async function zt(e) {
607
+ return (await Promise.all(e.map((e) => fe(e.id)))).flat();
590
608
  }
591
- function Lt(e) {
609
+ function Bt(e) {
592
610
  return e.reduce((e, t) => {
593
611
  let n = e.get(t.taskId), r = !n || new Date(t.decidedAt).getTime() > new Date(n.decidedAt).getTime() ? t : n;
594
612
  return new Map(e).set(t.taskId, r);
@@ -596,17 +614,17 @@ function Lt(e) {
596
614
  }
597
615
  //#endregion
598
616
  //#region src/views/instances/detail/sections/InstanceFormSection.tsx
599
- var Rt = {
617
+ var Vt = {
600
618
  display: "grid",
601
619
  gap: 16
602
- }, zt = {
620
+ }, Ht = {
603
621
  display: "flex",
604
622
  flexWrap: "wrap",
605
623
  gap: 8
606
624
  };
607
- function Bt({ canResubmitInstance: e, deciding: t, error: n, instance: r, loading: i, onDataSourceStateChange: o, onResubmitFormChange: s, onResubmitInstance: c, onUploadAttachment: l, resubmitFormData: u, resubmitFormErrors: d }) {
625
+ function Ut({ canResubmitInstance: e, deciding: t, error: n, instance: r, loading: i, onDataSourceStateChange: a, onResubmitFormChange: s, onResubmitInstance: c, onUploadAttachment: l, resubmitFormData: u, resubmitFormErrors: d }) {
608
626
  return /* @__PURE__ */ T("div", {
609
- style: Rt,
627
+ style: Vt,
610
628
  children: [
611
629
  n ? /* @__PURE__ */ w(S, {
612
630
  color: "text-error",
@@ -618,7 +636,7 @@ function Bt({ canResubmitInstance: e, deciding: t, error: n, instance: r, loadin
618
636
  variant: "body",
619
637
  children: "載入中..."
620
638
  }) : null,
621
- r?.formDefinitionSnapshot.schema && r.formDefinitionSnapshot.uiSchema ? /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(a, {
639
+ r?.formDefinitionSnapshot.schema && r.formDefinitionSnapshot.uiSchema ? /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(o, {
622
640
  dataSourceContext: e ? {
623
641
  instanceId: r.id,
624
642
  kind: "runtime"
@@ -628,7 +646,7 @@ function Bt({ canResubmitInstance: e, deciding: t, error: n, instance: r, loadin
628
646
  onChange: (e) => {
629
647
  s(e);
630
648
  },
631
- onDataSourceStateChange: o,
649
+ onDataSourceStateChange: a,
632
650
  onUploadAttachment: e ? l : void 0,
633
651
  optionSnapshots: r.formDataOptionSnapshot,
634
652
  readonly: !e,
@@ -636,7 +654,7 @@ function Bt({ canResubmitInstance: e, deciding: t, error: n, instance: r, loadin
636
654
  uiSchema: r.formDefinitionSnapshot.uiSchema,
637
655
  value: e ? u : r.formData
638
656
  }), e ? /* @__PURE__ */ w("div", {
639
- style: zt,
657
+ style: Ht,
640
658
  children: /* @__PURE__ */ w(g, {
641
659
  disabled: t,
642
660
  icon: Me,
@@ -655,20 +673,20 @@ function Bt({ canResubmitInstance: e, deciding: t, error: n, instance: r, loadin
655
673
  }
656
674
  //#endregion
657
675
  //#region src/views/instances/detail/sections/InstanceAttachmentsSection.tsx
658
- var Vt = {
676
+ var Wt = {
659
677
  display: "grid",
660
678
  gap: 16
661
679
  };
662
- function Ht({ attachments: e, onDownload: n, onPreview: r }) {
663
- let i = d(() => e.map((e) => ({
680
+ function Gt({ attachments: e, onDownload: n, onPreview: r }) {
681
+ let i = f(() => e.map((e) => ({
664
682
  attachment: e,
665
683
  createdAt: e.createdAt,
666
684
  filename: e.filename,
667
685
  id: e.id,
668
686
  key: e.id,
669
687
  mimeType: e.mimeType,
670
- sizeLabel: U(Number(e.sizeBytes))
671
- })), [e]), a = d(() => [
688
+ sizeLabel: rt(Number(e.sizeBytes))
689
+ })), [e]), a = f(() => [
672
690
  {
673
691
  dataIndex: "filename",
674
692
  key: "filename",
@@ -697,16 +715,16 @@ function Ht({ attachments: e, onDownload: n, onPreview: r }) {
697
715
  title: "上傳時間",
698
716
  width: 220
699
717
  }
700
- ], []), o = d(() => ({
718
+ ], []), o = f(() => ({
701
719
  render: (e) => [...e.mimeType === "application/pdf" ? [{
702
- icon: ke,
720
+ icon: O,
703
721
  iconType: "leading",
704
722
  name: "預覽",
705
723
  onClick: () => {
706
724
  r(e.attachment);
707
725
  }
708
726
  }] : [], {
709
- icon: Oe,
727
+ icon: ke,
710
728
  iconType: "leading",
711
729
  name: "下載",
712
730
  onClick: () => {
@@ -717,12 +735,12 @@ function Ht({ attachments: e, onDownload: n, onPreview: r }) {
717
735
  width: 160
718
736
  }), [n, r]);
719
737
  return /* @__PURE__ */ T("div", {
720
- style: Vt,
738
+ style: Wt,
721
739
  children: [/* @__PURE__ */ w(S, {
722
740
  component: "h2",
723
741
  variant: "h3",
724
742
  children: "附件"
725
- }), i.length > 0 ? /* @__PURE__ */ w(x, {
743
+ }), i.length > 0 ? /* @__PURE__ */ w(re, {
726
744
  actions: o,
727
745
  columns: a,
728
746
  dataSource: i,
@@ -736,55 +754,58 @@ function Ht({ attachments: e, onDownload: n, onPreview: r }) {
736
754
  }
737
755
  //#endregion
738
756
  //#region src/views/instances/detail/sections/InstanceTasksSection.tsx
739
- var Ut = {
757
+ var Kt = {
740
758
  display: "grid",
741
759
  gap: 12,
742
760
  width: "100%"
743
- }, Wt = {
761
+ }, qt = {
744
762
  minWidth: "100%",
745
763
  width: "100%"
746
- }, Gt = {
764
+ }, Jt = {
747
765
  display: "grid",
748
766
  gap: 12,
749
767
  width: "100%"
750
- }, Kt = { marginTop: 12 }, qt = { marginTop: 24 };
751
- function Jt(e) {
768
+ }, Yt = { marginTop: 12 }, Xt = { marginTop: 24 };
769
+ function Zt(e) {
752
770
  e && (e.style.width = "100%");
753
771
  }
754
- var Yt = {
772
+ var Qt = {
755
773
  COMPLETION_NOTIFY: "結案通知",
756
774
  COUNTERSIGN: "臨時會簽",
757
775
  PRE_APPROVAL: "臨時加簽",
758
776
  STAGE_NOTIFY: "階段完成通知"
759
- }, Xt = {
777
+ }, $t = {
760
778
  COMPLETION_NOTIFY: "本張單到達結案狀態(核准 / 拒絕 / 取消)後,通知指定對象。",
761
779
  COUNTERSIGN: "指定對象會併入下一層簽核,下一層需所有人都完成才會繼續。",
762
780
  PRE_APPROVAL: "指定對象需先完成加簽,本階段才會往下一層繼續。",
763
781
  STAGE_NOTIFY: "本階段完成後(不論通過與否)通知指定對象。"
764
- }, Zt = [{
782
+ }, en = [{
765
783
  id: "REJECT_INSTANCE",
766
784
  name: "加簽拒絕時整單駁回"
767
785
  }, {
768
786
  id: "RETURN_TO_ORIGIN",
769
787
  name: "加簽拒絕時退回給我重新處理"
770
- }], Qt = [{
788
+ }], tn = [{
771
789
  id: "MEMBER",
772
790
  name: "指定成員"
773
791
  }, {
774
792
  id: "WEBHOOK",
775
793
  name: "Webhook"
776
- }], $t = s(function({ adhocDirectives: e, currentMemberId: r, instance: i, memberProfilesById: a, onChanged: o, tasks: s }, c) {
777
- let [l, f] = p(!1), [h, v] = p(null), [y, te] = p(""), [b, ie] = p(!1), [oe, le] = p(""), [ue, de] = p(null), [fe, pe] = p(!1), [me, he] = p(""), [ge, ye] = p(!1), [be, xe] = p(null), [Ce, we] = p(""), [Te, D] = p(null), [Ee, De] = p(!1), [Oe, ke] = p([]), [Ae, je] = p(!1), [Me, O] = p(""), [Ne, Pe] = p([]), [Fe, Ie] = p(!1), [Le, Re] = p([]), [ze, Be] = p(!1), [k, Ve] = p("COUNTERSIGN"), [He, Ue] = p("REJECT_INSTANCE"), [We, Ge] = p(!1), [A, Ke] = p("MEMBER"), [j, M] = p(""), N = oe.trim(), qe = me.trim(), Je = Ce.trim(), P = d(() => s.find((e) => st(e, r) && (e.status === "PENDING" || e.status === "IN_PROGRESS")) ?? null, [r, s]), F = d(() => P && i ? i.workflowSnapshot.nodes.find((e) => e.id === P.nodeId) ?? null : null, [P, i]), Ye = d(() => F && i ? ct(i.workflowSnapshot, F) : [], [F, i]), I = F?.type === "userTask" && F.data.returnBehavior.allowReturn, Xe = F?.type === "userTask" && F.data.allowReject !== !1, L = F?.type === "userTask" && F.data.allowTransfer !== !1, R = F?.type === "userTask" && F.data.returnBehavior.requireComment === !0, Ze = F?.type === "userTask" && F.data.allowAddSigner, z = d(() => e.filter((e) => e.status === "PENDING"), [e]), B = Ye.find((e) => e.id === be) ?? Ye[0] ?? null, Qe = d(() => s.map((e) => ({
794
+ }], nn = c(function({ adhocDirectives: e, currentMemberId: r, instance: a, memberProfilesById: o, onChanged: s, tasks: c }, l) {
795
+ let [u, p] = m(!1), [h, v] = m(null), [y, ne] = m(""), [x, ae] = m(!1), [oe, ue] = m(""), [de, fe] = m(null), [pe, me] = m(!1), [he, ge] = m(""), [_e, be] = m(!1), [xe, Se] = m(null), [we, Te] = m(""), [Ee, D] = m(null), [De, Oe] = m(!1), [ke, O] = m([]), [Ae, je] = m(!1), [Me, Ne] = m(""), [Pe, Fe] = m([]), [Ie, Le] = m(!1), [Re, ze] = m([]), [Be, Ve] = m(!1), [k, He] = m("COUNTERSIGN"), [Ue, A] = m("REJECT_INSTANCE"), [We, j] = m(!1), [Ge, Ke] = m("MEMBER"), [M, N] = m(""), qe = oe.trim(), Je = he.trim(), Ye = we.trim(), P = f(() => c.find((e) => lt(e, r) && (e.status === "PENDING" || e.status === "IN_PROGRESS")) ?? null, [r, c]), F = f(() => P && a ? a.workflowSnapshot.nodes.find((e) => e.id === P.nodeId) ?? null : null, [P, a]), I = f(() => F && a ? ut(a.workflowSnapshot, F) : [], [F, a]), Xe = F?.type === "userTask" && F.data.returnBehavior.allowReturn, Ze = F?.type === "userTask" && F.data.allowReject !== !1, L = F?.type === "userTask" && F.data.allowTransfer !== !1, R = F?.type === "userTask" && F.data.returnBehavior.requireComment === !0, Qe = F?.type === "userTask" && F.data.allowAddSigner, $e = f(() => e.filter((e) => e.status === "PENDING"), [e]), et = I.find((e) => e.id === xe) ?? I[0] ?? null, z = f(() => c.map((e) => ({
778
796
  ...e,
779
- assigneeLabel: ot(e, a),
797
+ assigneeLabel: ct(e, o),
780
798
  key: e.id,
781
- nodeLabel: `${at(e.nodeId, i?.workflowSnapshot ?? null)}${e.isAdhoc ? e.adhocType === "COUNTERSIGN" ? "(臨時會簽)" : "(臨時加簽)" : ""}`,
782
- statusLabel: rt(e.status)
799
+ nodeLabel: i({
800
+ ...e,
801
+ nodeLabel: st(e.nodeId, a?.workflowSnapshot ?? null)
802
+ }),
803
+ statusLabel: ot(e.status)
783
804
  })), [
784
- i,
785
805
  a,
786
- s
787
- ]), V = d(() => [
806
+ o,
807
+ c
808
+ ]), B = f(() => [
788
809
  {
789
810
  dataIndex: "nodeLabel",
790
811
  key: "nodeLabel",
@@ -817,13 +838,13 @@ var Yt = {
817
838
  title: "建立時間",
818
839
  width: 220
819
840
  }
820
- ], []), $e = d(() => z.map((e) => ({
841
+ ], []), tt = f(() => $e.map((e) => ({
821
842
  ...e,
822
- createdByLabel: G(e.createdByMemberId, a),
843
+ createdByLabel: K(e.createdByMemberId, o),
823
844
  key: e.id,
824
- targetLabel: en(e, a),
825
- typeLabel: Yt[e.type]
826
- })), [a, z]), et = d(() => [
845
+ targetLabel: rn(e, o),
846
+ typeLabel: Qt[e.type]
847
+ })), [o, $e]), V = f(() => [
827
848
  {
828
849
  dataIndex: "typeLabel",
829
850
  key: "typeLabel",
@@ -864,7 +885,7 @@ var Yt = {
864
885
  key: "actions",
865
886
  render: (e) => e.createdByMemberId === r ? /* @__PURE__ */ w(g, {
866
887
  disabled: We,
867
- onClick: () => void St(e.id),
888
+ onClick: () => void Ct(e.id),
868
889
  size: "minor",
869
890
  variant: "destructive-secondary",
870
891
  children: "撤回"
@@ -873,189 +894,189 @@ var Yt = {
873
894
  width: 100
874
895
  }
875
896
  ], [We, r]);
876
- async function U({ action: e, comment: t, returnToNodeId: n = null, transferToMemberId: i = null }) {
877
- if (!r || !P || e === "REJECTED" && !Xe || e === "TRANSFERRED" && !L) return !1;
878
- f(!0), v(null);
897
+ async function H({ action: e, comment: t, returnToNodeId: n = null, transferToMemberId: i = null }) {
898
+ if (!r || !P || e === "REJECTED" && !Ze || e === "TRANSFERRED" && !L) return !1;
899
+ p(!0), v(null);
879
900
  try {
880
- await ce({
901
+ await le({
881
902
  action: e,
882
903
  comment: t,
883
904
  decidedByMemberId: r,
884
905
  returnToNodeId: n,
885
906
  taskId: P.id,
886
907
  transferToMemberId: i
887
- }), pe(!1), ye(!1), je(!1), le(""), he(""), we(""), D(null), xe(null), de(null);
908
+ }), me(!1), be(!1), je(!1), ue(""), ge(""), Te(""), D(null), Se(null), fe(null);
888
909
  } catch (e) {
889
- return v(H(e)), f(!1), !1;
910
+ return v(U(e)), p(!1), !1;
890
911
  }
891
912
  try {
892
- await o();
913
+ await s();
893
914
  } catch (e) {
894
- v(H(e));
915
+ v(U(e));
895
916
  } finally {
896
- f(!1);
917
+ p(!1);
897
918
  }
898
919
  return !0;
899
920
  }
900
- function tt() {
901
- r && P && (v(null), te(""), ie(!0));
902
- }
903
921
  function nt() {
904
- l || (ie(!1), te(""));
922
+ r && P && (v(null), ne(""), ae(!0));
923
+ }
924
+ function rt() {
925
+ u || (ae(!1), ne(""));
905
926
  }
906
927
  async function it() {
907
- l || await U({
928
+ u || await H({
908
929
  action: "APPROVED",
909
930
  comment: y.trim() || null
910
- }) && (ie(!1), te(""));
911
- }
912
- function W() {
913
- Xe && (le(""), de(null), pe(!0));
931
+ }) && (ae(!1), ne(""));
914
932
  }
915
- function q() {
916
- l || (pe(!1), le(""), de(null));
933
+ function at() {
934
+ Ze && (ue(""), fe(null), me(!0));
917
935
  }
918
- function pt() {
919
- he(""), xe(Ye[0]?.id ?? null), ye(!0);
936
+ function W() {
937
+ u || (me(!1), ue(""), fe(null));
920
938
  }
921
- function mt() {
922
- l || (ye(!1), he(""), xe(null));
939
+ function G() {
940
+ ge(""), Se(I[0]?.id ?? null), be(!0);
923
941
  }
924
942
  function J() {
925
- L && (we(""), D(null), je(!0), gt(""));
943
+ u || (be(!1), ge(""), Se(null));
926
944
  }
927
945
  function ht() {
928
- l || (je(!1), we(""), D(null));
946
+ L && (Te(""), D(null), je(!0), Y(""));
947
+ }
948
+ function gt() {
949
+ u || (je(!1), Te(""), D(null));
929
950
  }
930
- async function gt(e) {
931
- De(!0);
951
+ async function Y(e) {
952
+ Oe(!0);
932
953
  try {
933
- ke((await Se(e)).filter((e) => e.memberId !== r).map(lt));
954
+ O((await Ce(e)).filter((e) => e.memberId !== r).map(q));
934
955
  } catch (e) {
935
- v(H(e));
956
+ v(U(e));
936
957
  } finally {
937
- De(!1);
958
+ Oe(!1);
938
959
  }
939
960
  }
940
- async function Y() {
941
- if (Xe) {
942
- if (!N) {
943
- de("請輸入拒絕原因");
961
+ async function _t() {
962
+ if (Ze) {
963
+ if (!qe) {
964
+ fe("請輸入拒絕原因");
944
965
  return;
945
966
  }
946
- await U({
967
+ await H({
947
968
  action: "REJECTED",
948
- comment: N
969
+ comment: qe
949
970
  });
950
971
  }
951
972
  }
952
- async function _t() {
973
+ async function X() {
953
974
  if (L) {
954
- if (!Te) {
975
+ if (!Ee) {
955
976
  v("請選擇轉派對象");
956
977
  return;
957
978
  }
958
- await U({
979
+ await H({
959
980
  action: "TRANSFERRED",
960
- comment: Je || null,
961
- transferToMemberId: Te.id
981
+ comment: Ye || null,
982
+ transferToMemberId: Ee.id
962
983
  });
963
984
  }
964
985
  }
965
986
  async function vt() {
966
- await U({
987
+ await H({
967
988
  action: "RETURNED",
968
- comment: qe || null,
969
- returnToNodeId: B?.id ?? null
989
+ comment: Je || null,
990
+ returnToNodeId: et?.id ?? null
970
991
  });
971
992
  }
972
- function X() {
973
- O(""), Pe([]), Ue("REJECT_INSTANCE"), Ke("MEMBER"), M("");
993
+ function yt() {
994
+ Ne(""), Fe([]), A("REJECT_INSTANCE"), Ke("MEMBER"), N("");
974
995
  }
975
- function Z(e) {
976
- Ve(e), X(), Be(!0), bt("");
996
+ function bt(e) {
997
+ He(e), yt(), Ve(!0), xt("");
977
998
  }
978
- function yt() {
979
- We || (Be(!1), X());
999
+ function Z() {
1000
+ We || (Ve(!1), yt());
980
1001
  }
981
- async function bt(e) {
982
- Ie(!0);
1002
+ async function xt(e) {
1003
+ Le(!0);
983
1004
  try {
984
- Re((await Se(e)).map(lt));
1005
+ ze((await Ce(e)).map(q));
985
1006
  } catch (e) {
986
- v(H(e));
1007
+ v(U(e));
987
1008
  } finally {
988
- Ie(!1);
1009
+ Le(!1);
989
1010
  }
990
1011
  }
991
- async function xt() {
1012
+ async function St() {
992
1013
  if (!P) return;
993
- let e = (k === "STAGE_NOTIFY" || k === "COMPLETION_NOTIFY") && A === "WEBHOOK", t = K({
994
- memberIds: Ne.map((e) => e.id),
1014
+ let e = (k === "STAGE_NOTIFY" || k === "COMPLETION_NOTIFY") && Ge === "WEBHOOK", t = dt({
1015
+ memberIds: Pe.map((e) => e.id),
995
1016
  useWebhookTarget: e,
996
- webhookUrl: j
1017
+ webhookUrl: M
997
1018
  });
998
1019
  if (!t.valid) {
999
1020
  v(t.error);
1000
1021
  return;
1001
1022
  }
1002
1023
  let { target: n } = t, r = Me.trim() || null;
1003
- Ge(!0), v(null);
1024
+ j(!0), v(null);
1004
1025
  try {
1005
- k === "COUNTERSIGN" ? await _e({
1026
+ k === "COUNTERSIGN" ? await ve({
1006
1027
  comment: r,
1007
1028
  target: n,
1008
1029
  taskId: P.id
1009
- }) : k === "PRE_APPROVAL" ? await ve({
1030
+ }) : k === "PRE_APPROVAL" ? await ye({
1010
1031
  comment: r,
1011
- onReject: He,
1032
+ onReject: Ue,
1012
1033
  target: n,
1013
1034
  taskId: P.id
1014
- }) : k === "STAGE_NOTIFY" ? await se({
1035
+ }) : k === "STAGE_NOTIFY" ? await ce({
1015
1036
  target: n,
1016
1037
  taskId: P.id
1017
- }) : await E({
1038
+ }) : await se({
1018
1039
  target: n,
1019
1040
  taskId: P.id
1020
- }), Be(!1), X(), await o();
1041
+ }), Ve(!1), yt(), await s();
1021
1042
  } catch (e) {
1022
- v(H(e));
1043
+ v(U(e));
1023
1044
  } finally {
1024
- Ge(!1);
1045
+ j(!1);
1025
1046
  }
1026
1047
  }
1027
- async function St(e) {
1028
- Ge(!0), v(null);
1048
+ async function Ct(e) {
1049
+ j(!0), v(null);
1029
1050
  try {
1030
- await ae(e), await o();
1051
+ await E(e), await s();
1031
1052
  } catch (e) {
1032
- v(H(e));
1053
+ v(U(e));
1033
1054
  } finally {
1034
- Ge(!1);
1055
+ j(!1);
1035
1056
  }
1036
1057
  }
1037
- u(c, () => ({
1038
- canAddSignerCurrentTask: Ze,
1039
- canRejectCurrentTask: Xe,
1040
- canReturnCurrentTask: I,
1058
+ d(l, () => ({
1059
+ canAddSignerCurrentTask: Qe,
1060
+ canRejectCurrentTask: Ze,
1061
+ canReturnCurrentTask: Xe,
1041
1062
  canTransferCurrentTask: L,
1042
- deciding: l,
1043
- handleApprove: tt,
1063
+ deciding: u,
1064
+ handleApprove: nt,
1044
1065
  hasCurrentTask: P !== null,
1045
- openAdhocModal: Z,
1046
- openRejectModal: W,
1047
- openReturnModal: pt,
1048
- openTransferModal: J
1066
+ openAdhocModal: bt,
1067
+ openRejectModal: at,
1068
+ openReturnModal: G,
1069
+ openTransferModal: ht
1049
1070
  }), [
1071
+ Qe,
1050
1072
  Ze,
1051
1073
  Xe,
1052
- I,
1053
1074
  L,
1054
1075
  r,
1055
1076
  P,
1056
- l
1077
+ u
1057
1078
  ]);
1058
- let Q = k === "STAGE_NOTIFY" || k === "COMPLETION_NOTIFY", Ct = Q && A === "WEBHOOK" ? !j.trim() : Ne.length === 0, wt = Zt.find((e) => e.id === He) ?? Zt[0], Tt = Qt.find((e) => e.id === A) ?? Qt[0];
1079
+ let Q = k === "STAGE_NOTIFY" || k === "COMPLETION_NOTIFY", wt = Q && Ge === "WEBHOOK" ? !M.trim() : Pe.length === 0, Tt = en.find((e) => e.id === Ue) ?? en[0], Et = tn.find((e) => e.id === Ge) ?? tn[0];
1059
1080
  return /* @__PURE__ */ T(C, { children: [
1060
1081
  /* @__PURE__ */ w(S, {
1061
1082
  component: "h2",
@@ -1068,35 +1089,35 @@ var Yt = {
1068
1089
  children: h
1069
1090
  }) : null,
1070
1091
  /* @__PURE__ */ w("div", {
1071
- style: Kt,
1072
- children: /* @__PURE__ */ w(x, {
1073
- columns: V,
1074
- dataSource: Qe,
1092
+ style: Yt,
1093
+ children: /* @__PURE__ */ w(re, {
1094
+ columns: B,
1095
+ dataSource: z,
1075
1096
  fullWidth: !0
1076
1097
  })
1077
1098
  }),
1078
- z.length > 0 ? /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(S, {
1099
+ $e.length > 0 ? /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(S, {
1079
1100
  component: "h3",
1080
- style: qt,
1101
+ style: Xt,
1081
1102
  variant: "h3",
1082
1103
  children: "待生效的臨時設定"
1083
1104
  }), /* @__PURE__ */ w("div", {
1084
- style: Kt,
1085
- children: /* @__PURE__ */ w(x, {
1086
- columns: et,
1087
- dataSource: $e,
1105
+ style: Yt,
1106
+ children: /* @__PURE__ */ w(re, {
1107
+ columns: V,
1108
+ dataSource: tt,
1088
1109
  fullWidth: !0
1089
1110
  })
1090
1111
  })] }) : null,
1091
1112
  /* @__PURE__ */ T(_, {
1092
1113
  cancelText: "取消",
1093
1114
  confirmText: "送出同意",
1094
- loading: l,
1115
+ loading: u,
1095
1116
  modalType: "standard",
1096
- onCancel: nt,
1097
- onClose: nt,
1117
+ onCancel: rt,
1118
+ onClose: rt,
1098
1119
  onConfirm: () => void it(),
1099
- open: b,
1120
+ open: x,
1100
1121
  showModalFooter: !0,
1101
1122
  showModalHeader: !0,
1102
1123
  size: "regular",
@@ -1108,18 +1129,18 @@ var Yt = {
1108
1129
  variant: "body",
1109
1130
  children: h
1110
1131
  }) : null, /* @__PURE__ */ w("div", {
1111
- style: Ut,
1132
+ style: Kt,
1112
1133
  children: /* @__PURE__ */ w(n, {
1113
1134
  label: "簽核意見",
1114
1135
  name: "approveComment",
1115
- children: /* @__PURE__ */ w(re, {
1136
+ children: /* @__PURE__ */ w(ie, {
1116
1137
  autoFocus: !0,
1117
- onChange: (e) => te(e.target.value),
1138
+ onChange: (e) => ne(e.target.value),
1118
1139
  placeholder: "選填,例如補充核准的條件或提醒事項",
1119
- ref: Jt,
1140
+ ref: Zt,
1120
1141
  resize: "vertical",
1121
1142
  rows: 4,
1122
- style: Wt,
1143
+ style: qt,
1123
1144
  value: y
1124
1145
  })
1125
1146
  })
@@ -1128,57 +1149,57 @@ var Yt = {
1128
1149
  /* @__PURE__ */ w(_, {
1129
1150
  cancelText: "取消",
1130
1151
  confirmButtonProps: {
1131
- disabled: !N,
1152
+ disabled: !qe,
1132
1153
  variant: "destructive-primary"
1133
1154
  },
1134
1155
  confirmText: "送出拒絕",
1135
- loading: l,
1156
+ loading: u,
1136
1157
  modalStatusType: "error",
1137
1158
  modalType: "standard",
1138
- onCancel: q,
1139
- onClose: q,
1140
- onConfirm: () => void Y(),
1141
- open: fe,
1159
+ onCancel: W,
1160
+ onClose: W,
1161
+ onConfirm: () => void _t(),
1162
+ open: pe,
1142
1163
  showModalFooter: !0,
1143
1164
  showModalHeader: !0,
1144
1165
  size: "regular",
1145
1166
  supportingText: "拒絕案件時必須留下原因,供發起人與後續追蹤查看。",
1146
1167
  title: "拒絕原因",
1147
1168
  children: /* @__PURE__ */ T("div", {
1148
- style: Ut,
1169
+ style: Kt,
1149
1170
  children: [/* @__PURE__ */ w(n, {
1150
1171
  label: "拒絕原因",
1151
1172
  name: "rejectReason",
1152
1173
  required: !0,
1153
- children: /* @__PURE__ */ w(re, {
1174
+ children: /* @__PURE__ */ w(ie, {
1154
1175
  autoFocus: !0,
1155
1176
  onChange: (e) => {
1156
- le(e.target.value), de(null);
1177
+ ue(e.target.value), fe(null);
1157
1178
  },
1158
1179
  placeholder: "請說明拒絕原因",
1159
- ref: Jt,
1180
+ ref: Zt,
1160
1181
  resize: "vertical",
1161
1182
  rows: 4,
1162
- style: Wt,
1163
- type: ue ? "error" : "default",
1183
+ style: qt,
1184
+ type: de ? "error" : "default",
1164
1185
  value: oe
1165
1186
  })
1166
- }), ue ? /* @__PURE__ */ w(S, {
1187
+ }), de ? /* @__PURE__ */ w(S, {
1167
1188
  color: "text-error",
1168
1189
  variant: "body",
1169
- children: ue
1190
+ children: de
1170
1191
  }) : null]
1171
1192
  })
1172
1193
  }),
1173
1194
  /* @__PURE__ */ w(_, {
1174
1195
  cancelText: "取消",
1175
- confirmButtonProps: { disabled: !Te },
1196
+ confirmButtonProps: { disabled: !Ee },
1176
1197
  confirmText: "送出轉派",
1177
- loading: l,
1198
+ loading: u,
1178
1199
  modalType: "standard",
1179
- onCancel: ht,
1180
- onClose: ht,
1181
- onConfirm: () => void _t(),
1200
+ onCancel: gt,
1201
+ onClose: gt,
1202
+ onConfirm: () => void X(),
1182
1203
  open: Ae,
1183
1204
  showModalFooter: !0,
1184
1205
  showModalHeader: !0,
@@ -1186,12 +1207,12 @@ var Yt = {
1186
1207
  supportingText: "轉派後,原任務會保留轉派紀錄,新的待簽任務會指派給指定成員。",
1187
1208
  title: "轉派簽核",
1188
1209
  children: /* @__PURE__ */ T("div", {
1189
- style: Gt,
1210
+ style: Jt,
1190
1211
  children: [/* @__PURE__ */ w(n, {
1191
1212
  label: "轉派對象",
1192
1213
  name: "transferToMemberId",
1193
1214
  required: !0,
1194
- children: /* @__PURE__ */ w(m, {
1215
+ children: /* @__PURE__ */ w(ee, {
1195
1216
  asyncData: !0,
1196
1217
  disabledOptionsFilter: !0,
1197
1218
  emptyText: "沒有符合的成員",
@@ -1201,117 +1222,117 @@ var Yt = {
1201
1222
  name: "transfer-member-search",
1202
1223
  spellCheck: !1
1203
1224
  },
1204
- loading: Ee,
1225
+ loading: De,
1205
1226
  loadingText: "搜尋成員中...",
1206
1227
  mode: "single",
1207
- onChange: (e) => D(dt(e)),
1208
- onSearch: gt,
1209
- onSearchTextChange: (e) => D(ft(e, Oe)),
1228
+ onChange: (e) => D(pt(e)),
1229
+ onSearch: Y,
1230
+ onSearchTextChange: (e) => D(mt(e, ke)),
1210
1231
  onVisibilityChange: (e) => {
1211
- e && gt("");
1232
+ e && Y("");
1212
1233
  },
1213
- options: [...Oe],
1234
+ options: [...ke],
1214
1235
  placeholder: "搜尋姓名或信箱",
1215
1236
  searchDebounceTime: 300,
1216
- value: Te
1237
+ value: Ee
1217
1238
  })
1218
1239
  }), /* @__PURE__ */ w(n, {
1219
1240
  label: "轉派說明",
1220
1241
  name: "transferComment",
1221
- children: /* @__PURE__ */ w(re, {
1222
- onChange: (e) => we(e.target.value),
1242
+ children: /* @__PURE__ */ w(ie, {
1243
+ onChange: (e) => Te(e.target.value),
1223
1244
  placeholder: "可補充轉派原因",
1224
- ref: Jt,
1245
+ ref: Zt,
1225
1246
  resize: "vertical",
1226
1247
  rows: 4,
1227
- style: Wt,
1228
- value: Ce
1248
+ style: qt,
1249
+ value: we
1229
1250
  })
1230
1251
  })]
1231
1252
  })
1232
1253
  }),
1233
1254
  /* @__PURE__ */ w(_, {
1234
1255
  cancelText: "取消",
1235
- confirmButtonProps: { disabled: !B || R && !qe },
1256
+ confirmButtonProps: { disabled: !et || R && !Je },
1236
1257
  confirmText: "送出退回",
1237
- loading: l,
1258
+ loading: u,
1238
1259
  modalType: "standard",
1239
- onCancel: mt,
1240
- onClose: mt,
1260
+ onCancel: J,
1261
+ onClose: J,
1241
1262
  onConfirm: () => void vt(),
1242
- open: ge,
1263
+ open: _e,
1243
1264
  showModalFooter: !0,
1244
1265
  showModalHeader: !0,
1245
1266
  size: "regular",
1246
1267
  supportingText: "退回後,流程會回到指定節點並等待重新處理。",
1247
1268
  title: "退回簽核",
1248
1269
  children: /* @__PURE__ */ T("div", {
1249
- style: Gt,
1270
+ style: Jt,
1250
1271
  children: [/* @__PURE__ */ w(n, {
1251
1272
  label: "退回節點",
1252
1273
  name: "returnTargetNodeId",
1253
1274
  required: !0,
1254
- children: /* @__PURE__ */ w(ne, {
1275
+ children: /* @__PURE__ */ w(b, {
1255
1276
  clearable: !1,
1256
1277
  fullWidth: !0,
1257
- onChange: (e) => xe(e?.id ?? null),
1258
- options: [...Ye],
1278
+ onChange: (e) => Se(e?.id ?? null),
1279
+ options: [...I],
1259
1280
  placeholder: "選擇退回節點",
1260
- value: B
1281
+ value: et
1261
1282
  })
1262
1283
  }), /* @__PURE__ */ w(n, {
1263
1284
  hintText: R ? "此關卡設定退回時必須填寫意見。" : void 0,
1264
1285
  label: "退回說明",
1265
1286
  name: "returnComment",
1266
1287
  required: R,
1267
- children: /* @__PURE__ */ w(re, {
1268
- onChange: (e) => he(e.target.value),
1288
+ children: /* @__PURE__ */ w(ie, {
1289
+ onChange: (e) => ge(e.target.value),
1269
1290
  placeholder: R ? "請說明退回原因" : "可補充需要修改的內容",
1270
- ref: Jt,
1291
+ ref: Zt,
1271
1292
  resize: "vertical",
1272
1293
  rows: 4,
1273
- style: Wt,
1274
- value: me
1294
+ style: qt,
1295
+ value: he
1275
1296
  })
1276
1297
  })]
1277
1298
  })
1278
1299
  }),
1279
1300
  /* @__PURE__ */ w(_, {
1280
1301
  cancelText: "取消",
1281
- confirmButtonProps: { disabled: Ct },
1302
+ confirmButtonProps: { disabled: wt },
1282
1303
  confirmText: "送出",
1283
1304
  loading: We,
1284
1305
  modalType: "standard",
1285
- onCancel: yt,
1286
- onClose: yt,
1287
- onConfirm: () => void xt(),
1288
- open: ze,
1306
+ onCancel: Z,
1307
+ onClose: Z,
1308
+ onConfirm: () => void St(),
1309
+ open: Be,
1289
1310
  showModalFooter: !0,
1290
1311
  showModalHeader: !0,
1291
1312
  size: "regular",
1292
- supportingText: Xt[k],
1293
- title: Yt[k],
1313
+ supportingText: $t[k],
1314
+ title: Qt[k],
1294
1315
  children: /* @__PURE__ */ T("div", {
1295
- style: Gt,
1316
+ style: Jt,
1296
1317
  children: [
1297
1318
  Q ? /* @__PURE__ */ w(n, {
1298
1319
  label: "通知時機",
1299
1320
  name: "adhocNotifyMode",
1300
1321
  required: !0,
1301
- children: /* @__PURE__ */ w(ne, {
1322
+ children: /* @__PURE__ */ w(b, {
1302
1323
  clearable: !1,
1303
1324
  fullWidth: !0,
1304
- onChange: (e) => Ve(e?.id === "COMPLETION_NOTIFY" ? "COMPLETION_NOTIFY" : "STAGE_NOTIFY"),
1325
+ onChange: (e) => He(e?.id === "COMPLETION_NOTIFY" ? "COMPLETION_NOTIFY" : "STAGE_NOTIFY"),
1305
1326
  options: [{
1306
1327
  id: "STAGE_NOTIFY",
1307
- name: Yt.STAGE_NOTIFY
1328
+ name: Qt.STAGE_NOTIFY
1308
1329
  }, {
1309
1330
  id: "COMPLETION_NOTIFY",
1310
- name: Yt.COMPLETION_NOTIFY
1331
+ name: Qt.COMPLETION_NOTIFY
1311
1332
  }],
1312
1333
  value: {
1313
1334
  id: k,
1314
- name: Yt[k]
1335
+ name: Qt[k]
1315
1336
  }
1316
1337
  })
1317
1338
  }) : null,
@@ -1319,29 +1340,29 @@ var Yt = {
1319
1340
  label: "通知對象類型",
1320
1341
  name: "adhocTargetKind",
1321
1342
  required: !0,
1322
- children: /* @__PURE__ */ w(ne, {
1343
+ children: /* @__PURE__ */ w(b, {
1323
1344
  clearable: !1,
1324
1345
  fullWidth: !0,
1325
1346
  onChange: (e) => Ke(e?.id === "WEBHOOK" ? "WEBHOOK" : "MEMBER"),
1326
- options: [...Qt],
1327
- value: Tt
1347
+ options: [...tn],
1348
+ value: Et
1328
1349
  })
1329
1350
  }) : null,
1330
- Q && A === "WEBHOOK" ? /* @__PURE__ */ w(n, {
1351
+ Q && Ge === "WEBHOOK" ? /* @__PURE__ */ w(n, {
1331
1352
  label: "Webhook URL",
1332
1353
  name: "adhocWebhookUrl",
1333
1354
  required: !0,
1334
- children: /* @__PURE__ */ w(ee, {
1355
+ children: /* @__PURE__ */ w(te, {
1335
1356
  fullWidth: !0,
1336
- onChange: (e) => M(e.target.value),
1357
+ onChange: (e) => N(e.target.value),
1337
1358
  placeholder: "https://example.com/webhook",
1338
- value: j
1359
+ value: M
1339
1360
  })
1340
1361
  }) : /* @__PURE__ */ w(n, {
1341
1362
  label: Q ? "通知對象" : "簽核對象",
1342
1363
  name: "adhocMemberId",
1343
1364
  required: !0,
1344
- children: /* @__PURE__ */ w(m, {
1365
+ children: /* @__PURE__ */ w(ee, {
1345
1366
  asyncData: !0,
1346
1367
  disabledOptionsFilter: !0,
1347
1368
  emptyText: "沒有符合的成員",
@@ -1351,44 +1372,44 @@ var Yt = {
1351
1372
  name: "adhoc-member-search",
1352
1373
  spellCheck: !1
1353
1374
  },
1354
- loading: Fe,
1375
+ loading: Ie,
1355
1376
  loadingText: "搜尋成員中...",
1356
1377
  menuMaxHeight: 320,
1357
1378
  mode: "multiple",
1358
- onChange: (e) => Pe(e.map(dt).filter(ut)),
1359
- onSearch: bt,
1379
+ onChange: (e) => Fe(e.map(pt).filter(ft)),
1380
+ onSearch: xt,
1360
1381
  onVisibilityChange: (e) => {
1361
- e && bt("");
1382
+ e && xt("");
1362
1383
  },
1363
- options: [...Le],
1384
+ options: [...Re],
1364
1385
  overflowStrategy: "wrap",
1365
1386
  placeholder: "搜尋姓名或信箱,可加入多位",
1366
1387
  searchDebounceTime: 300,
1367
- value: [...Ne]
1388
+ value: [...Pe]
1368
1389
  })
1369
1390
  }),
1370
1391
  k === "PRE_APPROVAL" ? /* @__PURE__ */ w(n, {
1371
1392
  label: "拒簽處理方式",
1372
1393
  name: "adhocOnReject",
1373
1394
  required: !0,
1374
- children: /* @__PURE__ */ w(ne, {
1395
+ children: /* @__PURE__ */ w(b, {
1375
1396
  clearable: !1,
1376
1397
  fullWidth: !0,
1377
- onChange: (e) => Ue(e?.id === "RETURN_TO_ORIGIN" ? "RETURN_TO_ORIGIN" : "REJECT_INSTANCE"),
1378
- options: [...Zt],
1379
- value: wt
1398
+ onChange: (e) => A(e?.id === "RETURN_TO_ORIGIN" ? "RETURN_TO_ORIGIN" : "REJECT_INSTANCE"),
1399
+ options: [...en],
1400
+ value: Tt
1380
1401
  })
1381
1402
  }) : null,
1382
1403
  Q ? null : /* @__PURE__ */ w(n, {
1383
1404
  label: "說明",
1384
1405
  name: "adhocComment",
1385
- children: /* @__PURE__ */ w(re, {
1386
- onChange: (e) => O(e.target.value),
1406
+ children: /* @__PURE__ */ w(ie, {
1407
+ onChange: (e) => Ne(e.target.value),
1387
1408
  placeholder: "可補充原因",
1388
- ref: Jt,
1409
+ ref: Zt,
1389
1410
  resize: "vertical",
1390
1411
  rows: 3,
1391
- style: Wt,
1412
+ style: qt,
1392
1413
  value: Me
1393
1414
  })
1394
1415
  })
@@ -1397,10 +1418,10 @@ var Yt = {
1397
1418
  })
1398
1419
  ] });
1399
1420
  });
1400
- function en(e, t) {
1421
+ function rn(e, t) {
1401
1422
  try {
1402
1423
  let n = JSON.parse(e.targetValueJson);
1403
- if (n.memberIds?.length) return n.memberIds.map((e) => G(e, t)).join("、");
1424
+ if (n.memberIds?.length) return n.memberIds.map((e) => K(e, t)).join("、");
1404
1425
  if (n.webhookUrl) return n.webhookUrl;
1405
1426
  if (n.positionId) return `職位 ${n.positionId}`;
1406
1427
  if (n.orgUnitId) return `部門 ${n.orgUnitId}`;
@@ -1409,19 +1430,19 @@ function en(e, t) {
1409
1430
  }
1410
1431
  //#endregion
1411
1432
  //#region src/views/instances/detail/sections/InstanceSignaturesSection.tsx
1412
- var tn = {
1433
+ var an = {
1413
1434
  display: "grid",
1414
1435
  gap: 16
1415
1436
  };
1416
- function nn({ signatureVerification: e, signatures: n }) {
1417
- let r = d(() => n.map((e) => ({
1437
+ function on({ signatureVerification: e, signatures: n }) {
1438
+ let r = f(() => n.map((e) => ({
1418
1439
  algorithm: e.algorithm,
1419
- hashLabel: tt(e.signedPayloadHash),
1440
+ hashLabel: it(e.signedPayloadHash),
1420
1441
  key: e.id,
1421
1442
  keyVersion: e.keyVersion,
1422
1443
  signedAtLabel: t(e.signedAt),
1423
1444
  signerMemberId: e.signerMemberId
1424
- })), [n]), i = d(() => [
1445
+ })), [n]), i = f(() => [
1425
1446
  {
1426
1447
  dataIndex: "signerMemberId",
1427
1448
  key: "signerMemberId",
@@ -1454,7 +1475,7 @@ function nn({ signatureVerification: e, signatures: n }) {
1454
1475
  }
1455
1476
  ], []);
1456
1477
  return /* @__PURE__ */ T("div", {
1457
- style: tn,
1478
+ style: an,
1458
1479
  children: [
1459
1480
  /* @__PURE__ */ w(S, {
1460
1481
  component: "h2",
@@ -1466,7 +1487,7 @@ function nn({ signatureVerification: e, signatures: n }) {
1466
1487
  variant: "body",
1467
1488
  children: e ? e.valid ? `簽章鏈已驗證,共 ${e.checkedCount} 筆。` : `簽章鏈驗證失敗:${e.errors.join("、")}` : "尚無簽章紀錄。"
1468
1489
  }),
1469
- r.length > 0 ? /* @__PURE__ */ w(x, {
1490
+ r.length > 0 ? /* @__PURE__ */ w(re, {
1470
1491
  columns: i,
1471
1492
  dataSource: r,
1472
1493
  fullWidth: !0
@@ -1476,55 +1497,55 @@ function nn({ signatureVerification: e, signatures: n }) {
1476
1497
  }
1477
1498
  //#endregion
1478
1499
  //#region src/views/instances/detail/sections/InstanceHistorySection.tsx
1479
- var rn = {
1500
+ var sn = {
1480
1501
  display: "grid",
1481
1502
  gap: 16
1482
- }, an = {
1503
+ }, cn = {
1483
1504
  cursor: "help",
1484
1505
  textDecoration: "underline dotted",
1485
1506
  textUnderlineOffset: 3
1486
- }, on = {
1507
+ }, ln = {
1487
1508
  borderLeftColor: "var(--mzn-color-border)",
1488
1509
  borderLeftStyle: "solid",
1489
1510
  borderLeftWidth: 2,
1490
1511
  marginTop: 4,
1491
1512
  paddingLeft: 8,
1492
1513
  whiteSpace: "pre-wrap"
1493
- }, sn = { color: "var(--mzn-color-text-secondary)" }, cn = {
1494
- ...on,
1514
+ }, un = { color: "var(--mzn-color-text-secondary)" }, dn = {
1515
+ ...ln,
1495
1516
  borderLeftColor: "var(--mzn-color-text-error)",
1496
1517
  color: "var(--mzn-color-text-error)"
1497
1518
  };
1498
- function ln(...e) {
1519
+ function fn(...e) {
1499
1520
  return e.filter((e) => V(e ?? null)).join(" ");
1500
1521
  }
1501
- var un = s(function({ className: e, descriptionParts: t, error: n, forcePending: r = !1, index: i = 0, orientation: a, status: s = "pending", title: c, type: l = "number", ...u }, d) {
1502
- let f = r ? "pending" : s, p = t.filter((e) => e.type !== "comment"), m = t.filter((e) => e.type === "comment");
1522
+ var pn = c(function({ className: e, descriptionParts: t, error: n, forcePending: r = !1, index: i = 0, orientation: a, status: o = "pending", title: c, type: l = "number", ...u }, d) {
1523
+ let f = r ? "pending" : o, p = t.filter((e) => e.type !== "comment"), m = t.filter((e) => e.type === "comment");
1503
1524
  return /* @__PURE__ */ T("div", {
1504
1525
  ...u,
1505
- className: ln(j.host, l === "dot" ? j.dot : null, n && f !== "processing" ? j.error : null, a === "horizontal" ? j.horizontal : null, l === "number" ? j.number : null, f === "pending" ? j.pending : null, f === "processing" ? j.processing : null, n && f === "processing" ? j.processingError : null, !n && f === "succeeded" ? j.succeeded : null, a === "vertical" ? j.vertical : null, e),
1526
+ className: fn(M.host, l === "dot" ? M.dot : null, n && f !== "processing" ? M.error : null, a === "horizontal" ? M.horizontal : null, l === "number" ? M.number : null, f === "pending" ? M.pending : null, f === "processing" ? M.processing : null, n && f === "processing" ? M.processingError : null, !n && f === "succeeded" ? M.succeeded : null, a === "vertical" ? M.vertical : null, e),
1506
1527
  ref: d,
1507
- children: [l === "dot" ? /* @__PURE__ */ w("span", { className: ln(j.statusIndicator, j.statusIndicatorDot) }) : /* @__PURE__ */ w("span", {
1508
- className: j.statusIndicator,
1528
+ children: [l === "dot" ? /* @__PURE__ */ w("span", { className: fn(M.statusIndicator, M.statusIndicatorDot) }) : /* @__PURE__ */ w("span", {
1529
+ className: M.statusIndicator,
1509
1530
  children: i + 1
1510
1531
  }), /* @__PURE__ */ T("div", {
1511
- className: j.textContainer,
1532
+ className: M.textContainer,
1512
1533
  children: [
1513
1534
  /* @__PURE__ */ T(S, {
1514
- className: j.title,
1535
+ className: M.title,
1515
1536
  variant: "label-primary-highlight",
1516
- children: [c, /* @__PURE__ */ w("span", { className: j.titleConnectLine })]
1537
+ children: [c, /* @__PURE__ */ w("span", { className: M.titleConnectLine })]
1517
1538
  }),
1518
1539
  p.length > 0 ? /* @__PURE__ */ w(S, {
1519
- className: j.description,
1540
+ className: M.description,
1520
1541
  variant: "caption",
1521
- children: p.map((e, t) => /* @__PURE__ */ T(o, { children: [t > 0 ? " · " : null, dn(e)] }, `${e.type}-${t}`))
1542
+ children: p.map((e, t) => /* @__PURE__ */ T(s, { children: [t > 0 ? " · " : null, mn(e)] }, `${e.type}-${t}`))
1522
1543
  }) : null,
1523
1544
  m.map((e, t) => /* @__PURE__ */ T(S, {
1524
- style: e.tone === "danger" ? cn : on,
1545
+ style: e.tone === "danger" ? dn : ln,
1525
1546
  variant: "body",
1526
1547
  children: [/* @__PURE__ */ T("span", {
1527
- style: e.tone === "danger" ? void 0 : sn,
1548
+ style: e.tone === "danger" ? void 0 : un,
1528
1549
  children: [e.label, ":"]
1529
1550
  }), e.text]
1530
1551
  }, `comment-${t}`))
@@ -1532,38 +1553,38 @@ var un = s(function({ className: e, descriptionParts: t, error: n, forcePending:
1532
1553
  })]
1533
1554
  });
1534
1555
  });
1535
- function dn(e) {
1556
+ function mn(e) {
1536
1557
  return e.type === "text" ? e.text : e.email ? /* @__PURE__ */ T(C, { children: [
1537
1558
  e.prefix,
1538
1559
  ":",
1539
- /* @__PURE__ */ w(ie, {
1560
+ /* @__PURE__ */ w(ae, {
1540
1561
  title: e.email,
1541
1562
  children: ({ ref: t, ...n }) => /* @__PURE__ */ w("span", {
1542
1563
  ...n,
1543
1564
  "data-testid": e.memberId ? `member-tooltip-${e.memberId}` : void 0,
1544
1565
  ref: t,
1545
- style: an,
1566
+ style: cn,
1546
1567
  children: e.label
1547
1568
  })
1548
1569
  })
1549
1570
  ] }) : `${e.prefix}:${e.label}`;
1550
1571
  }
1551
- function fn({ activityLogs: e, instanceState: t, memberProfilesById: n, signatureVerification: r, signaturesById: i, taskDecisionsByTaskId: a, tasks: o, workflowSnapshot: s, workflowTokens: c }) {
1552
- let l = Mt(e, o, c, s, t, n, a, i, r), u = ht(l), d = l.map((e) => ({
1572
+ function hn({ activityLogs: e, instanceState: t, memberProfilesById: n, signatureVerification: r, signaturesById: i, taskDecisionsByTaskId: a, tasks: o, workflowSnapshot: s, workflowTokens: c }) {
1573
+ let l = Ft(e, o, c, s, t, n, a, i, r), u = _t(l), d = l.map((e) => ({
1553
1574
  ...e,
1554
- descriptionParts: e.descriptionParts.filter(J)
1575
+ descriptionParts: e.descriptionParts.filter(Y)
1555
1576
  }));
1556
1577
  return /* @__PURE__ */ T("div", {
1557
- style: rn,
1578
+ style: sn,
1558
1579
  children: [/* @__PURE__ */ w(S, {
1559
1580
  component: "h2",
1560
1581
  variant: "h3",
1561
1582
  children: "歷程"
1562
- }), d.length > 0 ? /* @__PURE__ */ w(b, {
1583
+ }), d.length > 0 ? /* @__PURE__ */ w(x, {
1563
1584
  currentStep: u,
1564
1585
  orientation: "vertical",
1565
1586
  type: "dot",
1566
- children: d.map((e) => /* @__PURE__ */ w(un, {
1587
+ children: d.map((e) => /* @__PURE__ */ w(pn, {
1567
1588
  descriptionParts: e.descriptionParts,
1568
1589
  error: e.error,
1569
1590
  forcePending: e.forcePending,
@@ -1578,25 +1599,25 @@ function fn({ activityLogs: e, instanceState: t, memberProfilesById: n, signatur
1578
1599
  }
1579
1600
  //#endregion
1580
1601
  //#region src/views/instances/detail/sections/InstanceWebhookDeliveriesSection.tsx
1581
- var pn = {
1602
+ var gn = {
1582
1603
  display: "grid",
1583
1604
  gap: 16
1584
- }, mn = {
1605
+ }, _n = {
1585
1606
  display: "grid",
1586
1607
  gap: 2
1587
- }, hn = {
1608
+ }, vn = {
1588
1609
  overflowWrap: "anywhere",
1589
1610
  whiteSpace: "pre-wrap"
1590
1611
  };
1591
- function gn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1592
- let [r, i] = p(null), [a, o] = p(!1), [s, c] = p(null), l = d(() => e.map((e) => ({
1612
+ function yn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1613
+ let [r, i] = m(null), [a, o] = m(!1), [s, c] = m(null), l = f(() => e.map((e) => ({
1593
1614
  delivery: e,
1594
1615
  key: e.id
1595
- })), [e]), u = d(() => [
1616
+ })), [e]), u = f(() => [
1596
1617
  {
1597
1618
  key: "endpoint",
1598
1619
  render: ({ delivery: e }) => /* @__PURE__ */ T("div", {
1599
- style: mn,
1620
+ style: _n,
1600
1621
  children: [/* @__PURE__ */ w(S, {
1601
1622
  component: "span",
1602
1623
  variant: "body",
@@ -1620,7 +1641,7 @@ function gn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1620
1641
  },
1621
1642
  {
1622
1643
  key: "status",
1623
- render: ({ delivery: e }) => /* @__PURE__ */ w(_n, { status: e.status }),
1644
+ render: ({ delivery: e }) => /* @__PURE__ */ w(bn, { status: e.status }),
1624
1645
  title: "狀態",
1625
1646
  width: 120
1626
1647
  },
@@ -1637,7 +1658,7 @@ function gn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1637
1658
  {
1638
1659
  key: "lastError",
1639
1660
  render: ({ delivery: e }) => e.lastErrorCode && e.status !== "SENT" ? /* @__PURE__ */ T("div", {
1640
- style: mn,
1661
+ style: _n,
1641
1662
  children: [/* @__PURE__ */ w(S, {
1642
1663
  color: "text-error",
1643
1664
  component: "span",
@@ -1646,7 +1667,7 @@ function gn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1646
1667
  }), e.lastErrorDetail ? /* @__PURE__ */ w(S, {
1647
1668
  color: "text-neutral",
1648
1669
  component: "span",
1649
- style: hn,
1670
+ style: vn,
1650
1671
  variant: "caption",
1651
1672
  children: e.lastErrorDetail
1652
1673
  }) : null]
@@ -1664,15 +1685,15 @@ function gn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1664
1685
  render: ({ delivery: e }) => /* @__PURE__ */ w(S, {
1665
1686
  component: "span",
1666
1687
  variant: "body",
1667
- children: vn(e)
1688
+ children: xn(e)
1668
1689
  }),
1669
1690
  title: "時間",
1670
1691
  width: 220
1671
1692
  }
1672
- ], [n]), f = d(() => ({
1693
+ ], [n]), d = f(() => ({
1673
1694
  render: ({ delivery: e }) => e.status === "FAILED" && e.attemptCount > 0 ? [{
1674
1695
  disabled: () => a,
1675
- icon: O,
1696
+ icon: Ne,
1676
1697
  iconType: "leading",
1677
1698
  name: "重新傳送",
1678
1699
  onClick: () => {
@@ -1682,7 +1703,7 @@ function gn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1682
1703
  variant: "base-secondary",
1683
1704
  width: 140
1684
1705
  }), [a]);
1685
- async function m() {
1706
+ async function p() {
1686
1707
  if (r) {
1687
1708
  o(!0), c(null);
1688
1709
  try {
@@ -1695,7 +1716,7 @@ function gn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1695
1716
  }
1696
1717
  }
1697
1718
  return /* @__PURE__ */ T("div", {
1698
- style: pn,
1719
+ style: gn,
1699
1720
  children: [
1700
1721
  /* @__PURE__ */ w(S, {
1701
1722
  component: "h2",
@@ -1707,8 +1728,8 @@ function gn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1707
1728
  variant: "body",
1708
1729
  children: s
1709
1730
  }) : null,
1710
- l.length > 0 ? /* @__PURE__ */ w(x, {
1711
- actions: f,
1731
+ l.length > 0 ? /* @__PURE__ */ w(re, {
1732
+ actions: d,
1712
1733
  columns: u,
1713
1734
  dataSource: l,
1714
1735
  fullWidth: !0
@@ -1725,7 +1746,7 @@ function gn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1725
1746
  modalType: "standard",
1726
1747
  onCancel: () => i(null),
1727
1748
  onClose: () => i(null),
1728
- onConfirm: () => void m(),
1749
+ onConfirm: () => void p(),
1729
1750
  open: !!r,
1730
1751
  showModalFooter: !0,
1731
1752
  showModalHeader: !0,
@@ -1743,7 +1764,7 @@ function gn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1743
1764
  ]
1744
1765
  });
1745
1766
  }
1746
- function _n({ status: e }) {
1767
+ function bn({ status: e }) {
1747
1768
  return e === "SENT" ? /* @__PURE__ */ w(h, {
1748
1769
  size: "sub",
1749
1770
  text: "已送達",
@@ -1758,15 +1779,15 @@ function _n({ status: e }) {
1758
1779
  variant: "dot-info"
1759
1780
  });
1760
1781
  }
1761
- function vn(e) {
1782
+ function xn(e) {
1762
1783
  return e.sentAt ? `送達:${t(e.sentAt)}` : e.status === "PENDING" && e.nextRetryAt ? `下次重試:${t(e.nextRetryAt)}` : e.lastAttemptAt ? `最後嘗試:${t(e.lastAttemptAt)}` : `建立:${t(e.createdAt)}`;
1763
1784
  }
1764
1785
  //#endregion
1765
1786
  //#region src/views/instances/detail/InstanceDetailView.tsx
1766
- var yn = 3e3, bn = 40, xn = 184, Sn = 96, Cn = {
1787
+ var Sn = 3e3, Cn = 40, wn = 184, Tn = 96, En = {
1767
1788
  display: "grid",
1768
1789
  gap: 16
1769
- }, wn = {
1790
+ }, Dn = {
1770
1791
  background: "#f8fafc",
1771
1792
  border: "1px solid #e2e8f0",
1772
1793
  borderRadius: 8,
@@ -1774,7 +1795,7 @@ var yn = 3e3, bn = 40, xn = 184, Sn = 96, Cn = {
1774
1795
  minHeight: 440,
1775
1796
  overflow: "hidden",
1776
1797
  width: "min(80vw, 1040px)"
1777
- }, Tn = {
1798
+ }, On = {
1778
1799
  background: "#ffffff",
1779
1800
  border: "1px solid #cbd5e1",
1780
1801
  borderRadius: 8,
@@ -1784,24 +1805,24 @@ var yn = 3e3, bn = 40, xn = 184, Sn = 96, Cn = {
1784
1805
  minHeight: 82,
1785
1806
  padding: 12,
1786
1807
  width: 184
1787
- }, En = {
1808
+ }, kn = {
1788
1809
  borderRadius: 999,
1789
1810
  fontSize: 12,
1790
1811
  fontWeight: 600,
1791
1812
  justifySelf: "start",
1792
1813
  lineHeight: "18px",
1793
1814
  padding: "0 8px"
1794
- }, Dn = {
1815
+ }, An = {
1795
1816
  color: "#64748b",
1796
1817
  fontSize: 12,
1797
1818
  overflow: "hidden",
1798
1819
  textOverflow: "ellipsis",
1799
1820
  whiteSpace: "nowrap"
1800
- }, On = { opacity: 0 }, kn = {
1821
+ }, jn = { opacity: 0 }, Mn = {
1801
1822
  display: "flex",
1802
1823
  flexWrap: "wrap",
1803
1824
  gap: 8
1804
- }, An = {
1825
+ }, Nn = {
1805
1826
  alignItems: "center",
1806
1827
  background: "#ffffff",
1807
1828
  border: "1px solid #cbd5e1",
@@ -1813,29 +1834,29 @@ var yn = 3e3, bn = 40, xn = 184, Sn = 96, Cn = {
1813
1834
  gap: 6,
1814
1835
  lineHeight: "20px",
1815
1836
  padding: "4px 8px"
1816
- }, jn = {
1837
+ }, Pn = {
1817
1838
  display: "grid",
1818
1839
  gap: 16
1819
- }, Mn = { workflowRuntime: Hn };
1820
- function Nn({ instanceId: a, showAttachments: o = !0, showForm: s = !0, showHistory: u = !0, showSignatures: m = !0, showTasks: h = !0, showWebhookDeliveries: ee = !0 }) {
1821
- let { member: ne } = e(), b = ne?.memberId ?? null, x = ee && r(ne), [ie, ae] = p([]), [E, se] = p(null), [ce, de] = p([]), [_e, ve] = p([]), [ye, Se] = p([]), [D, Ee] = p([]), [Oe, ke] = p(null), [O, Fe] = p([]), [Ie, ze] = p([]), [He, Ue] = p([]), [Ge, A] = p(null), [Ke, j] = p(!0), [M, N] = p(!1), [qe, Je] = p(!1), [P, F] = p(""), [Ye, I] = p(!1), [L, R] = p({}), [Ze, z] = p({}), [B, Qe] = p({}), [V, $e] = p(null), [et, U] = p(null), [tt, rt] = p([]), it = P.trim(), W = f(null), G = f(0), ot = D.some((e) => e.status === "PENDING" || e.status === "DELIVERY_IN_PROGRESS");
1822
- l(() => {
1840
+ }, Fn = { workflowRuntime: Gn };
1841
+ function In({ instanceId: i, showAttachments: o = !0, showForm: s = !0, showHistory: c = !0, showSignatures: d = !0, showTasks: ee = !0, showWebhookDeliveries: h = !0 }) {
1842
+ let { member: te } = e(), b = te?.memberId ?? null, x = h && r(te), [re, ae] = m([]), [E, se] = m(null), [ce, le] = m([]), [fe, ve] = m([]), [ye, be] = m([]), [Ce, D] = m([]), [De, ke] = m(null), [O, Ne] = m([]), [Ie, Le] = m([]), [Be, Ue] = m([]), [A, j] = m(null), [Ge, Ke] = m(!0), [M, N] = m(!1), [qe, Je] = m(!1), [Ye, P] = m(""), [F, I] = m(!1), [Xe, L] = m({}), [R, $e] = m({}), [et, z] = m({}), [B, tt] = m(null), [H, nt] = m(null), [rt, it] = m([]), ot = Ye.trim(), W = p(null), G = p(0), K = Ce.some((e) => e.status === "PENDING" || e.status === "DELIVERY_IN_PROGRESS");
1843
+ u(() => {
1823
1844
  Z();
1824
- }, [b, a]), l(() => {
1825
- if (!x || !ot || G.current >= bn) return;
1845
+ }, [b, i]), u(() => {
1846
+ if (!x || !K || G.current >= Cn) return;
1826
1847
  let e = setTimeout(() => {
1827
- G.current += 1, xt();
1828
- }, yn);
1848
+ G.current += 1, Ct();
1849
+ }, Sn);
1829
1850
  return () => clearTimeout(e);
1830
1851
  }, [
1831
1852
  x,
1832
- ot,
1833
- D
1834
- ]), l(() => {
1835
- z(E?.formData ?? {}), Qe({});
1853
+ K,
1854
+ Ce
1855
+ ]), u(() => {
1856
+ $e(E?.formData ?? {}), z({});
1836
1857
  }, [E]);
1837
- let ct = c((e, t) => {
1838
- Qe((n) => {
1858
+ let ct = l((e, t) => {
1859
+ z((n) => {
1839
1860
  let r = n[e];
1840
1861
  return r?.hasValue === t.hasValue && r.status === t.status ? n : {
1841
1862
  ...n,
@@ -1845,139 +1866,143 @@ function Nn({ instanceId: a, showAttachments: o = !0, showForm: s = !0, showHist
1845
1866
  }
1846
1867
  };
1847
1868
  });
1848
- }, []), lt = d(() => O.find((e) => st(e, b) && (e.status === "PENDING" || e.status === "IN_PROGRESS")) ?? null, [b, O]), K = d(() => lt && E ? E.workflowSnapshot.nodes.find((e) => e.id === lt.nodeId) ?? null : null, [lt, E]), ut = K?.type === "userTask" && K.data.returnBehavior.allowReturn, dt = K?.type === "userTask" && K.data.allowReject !== !1, ft = K?.type === "userTask" && K.data.allowTransfer !== !1, q = K?.type === "userTask" && K.data.allowAddSigner, pt = !(!E || E.initiatorMemberId !== b || E.state !== "RUNNING" && E.state !== "RETURNED"), mt = !!(E && E.initiatorMemberId === b && E.state === "RETURNED"), J = d(() => new Map(He.map((e) => [e.memberId, e])), [He]), ht = d(() => Lt(ce), [ce]), gt = d(() => new Map(ye.map((e) => [e.id, e])), [ye]), Y = d(() => E ? Rn(E.workflowSnapshot) : null, [E]), _t = d(() => E && Y ? Ln(Y, O, Ie, E.state) : [], [
1869
+ }, []), ut = f(() => O.find((e) => lt(e, b) && (e.status === "PENDING" || e.status === "IN_PROGRESS")) ?? null, [b, O]), q = f(() => ut && E ? E.workflowSnapshot.nodes.find((e) => e.id === ut.nodeId) ?? null : null, [ut, E]), dt = q?.type === "userTask" && q.data.returnBehavior.allowReturn, ft = q?.type === "userTask" && q.data.allowReject !== !1, pt = q?.type === "userTask" && q.data.allowTransfer !== !1, mt = q?.type === "userTask" && q.data.allowAddSigner, J = !(!E || E.initiatorMemberId !== b || E.state !== "RUNNING" && E.state !== "RETURNED"), ht = !!(E && E.initiatorMemberId === b && E.state === "RETURNED"), gt = f(() => new Map(Be.map((e) => [e.memberId, e])), [Be]), Y = f(() => Bt(ce), [ce]), _t = f(() => new Map(ye.map((e) => [e.id, e])), [ye]), X = f(() => E ? Vn(E.workflowSnapshot) : null, [E]), vt = f(() => E && X ? Bn(X, O, Ie, E.state) : [], [
1849
1870
  E,
1850
- Y,
1871
+ X,
1851
1872
  O,
1852
1873
  Ie
1853
- ]), vt = d(() => Y ? zn(Y) : [], [Y]), X = d(() => E ? Fn(E.workflowSnapshot) : [], [E]);
1874
+ ]), yt = f(() => X ? Hn(X) : [], [X]), bt = f(() => E ? Rn(E.workflowSnapshot) : [], [E]);
1854
1875
  async function Z() {
1855
- j(!0), A(null);
1876
+ Ke(!0), j(null);
1856
1877
  try {
1857
- let e = await pe(a);
1858
- ae(e.activityLogs), se(e.instance), Fe(e.tasks), ze(e.workflowTokens);
1859
- let t = await le(e.instance.id), [n, r, i, o, s] = await Promise.all([
1860
- It(e.tasks),
1861
- Pt({
1878
+ let e = await me(i);
1879
+ ae(e.activityLogs), se(e.instance), Ne(e.tasks), Le(e.workflowTokens);
1880
+ let t = await ue(e.instance.id), [n, r, a, o, s] = await Promise.all([
1881
+ zt(e.tasks),
1882
+ Lt({
1862
1883
  ...e,
1863
1884
  adhocDirectives: t
1864
1885
  }),
1865
- ue(e.instance.id),
1866
- ge(e.instance.id),
1867
- yt(e.instance.id)
1886
+ de(e.instance.id),
1887
+ _e(e.instance.id),
1888
+ xt(e.instance.id)
1868
1889
  ]);
1869
- de(n), Ue(r), ve(i), Se(o.signatures), ke(o.verification), rt(t), Ee(s);
1890
+ le(n), Ue(r), ve(a), be(o.signatures), ke(o.verification), it(t), D(s);
1870
1891
  } catch (e) {
1871
- A(H(e));
1892
+ j(U(e));
1872
1893
  } finally {
1873
- j(!1);
1894
+ Ke(!1);
1874
1895
  }
1875
1896
  }
1876
- async function yt(e) {
1877
- return x ? fe(e).catch(() => []) : [];
1897
+ async function xt(e) {
1898
+ return x ? pe(e).catch(() => []) : [];
1878
1899
  }
1879
- async function bt(e) {
1880
- await xe(e.id), G.current = 0, await Z();
1900
+ async function St(e) {
1901
+ await Se(e.id), G.current = 0, await Z();
1881
1902
  }
1882
- async function xt() {
1883
- let e = await yt(a);
1903
+ async function Ct() {
1904
+ let e = await xt(i);
1884
1905
  if (!e.some((e) => e.status === "PENDING" || e.status === "DELIVERY_IN_PROGRESS")) {
1885
1906
  await Z();
1886
1907
  return;
1887
1908
  }
1888
- Ee(e);
1909
+ D(e);
1889
1910
  }
1890
- async function St(e, t) {
1911
+ async function Q(e, t) {
1891
1912
  if (!b) throw Error("尚未登入,無法上傳附件");
1892
- return { id: (await Ce({
1913
+ return { id: (await we({
1893
1914
  file: t,
1894
1915
  formFieldPath: `form.${e.fieldKey}`
1895
1916
  })).id };
1896
1917
  }
1897
- async function Q(e) {
1918
+ async function wt(e) {
1898
1919
  if (!b) return;
1899
- let t = await me({ id: e.id });
1920
+ let t = await he({ id: e.id });
1900
1921
  window.open(t, "_blank", "noopener,noreferrer");
1901
1922
  }
1902
- async function Ct(e) {
1923
+ async function Tt(e) {
1903
1924
  if (!b) return;
1904
- let t = await he({ id: e.id });
1905
- $e(e), U(t);
1925
+ let t = await ge({ id: e.id });
1926
+ tt(e), nt(t);
1906
1927
  }
1907
- async function wt() {
1908
- if (b && E && pt) {
1909
- N(!0), A(null), R({});
1928
+ async function Et() {
1929
+ if (b && E && J) {
1930
+ N(!0), j(null), L({});
1910
1931
  try {
1911
1932
  await oe({
1912
1933
  cancelledByMemberId: b,
1913
- comment: it || null,
1934
+ comment: ot || null,
1914
1935
  instanceId: E.id
1915
- }), F(""), I(!1), await Z();
1936
+ }), P(""), I(!1), await Z();
1916
1937
  } catch (e) {
1917
- A(H(e));
1938
+ j(U(e));
1918
1939
  } finally {
1919
1940
  N(!1);
1920
1941
  }
1921
1942
  }
1922
1943
  }
1923
- async function Tt() {
1924
- if (!b || !E || !mt) return;
1925
- N(!0), A(null), R({});
1926
- let e = i(Object.values(B));
1944
+ async function Dt() {
1945
+ if (!b || !E || !ht) return;
1946
+ N(!0), j(null), L({});
1947
+ let e = a(Object.values(et));
1927
1948
  if (e) {
1928
- A(e), N(!1);
1949
+ j(e), N(!1);
1929
1950
  return;
1930
1951
  }
1931
- let t = E.formDefinitionSnapshot.schema ? Le(E.formDefinitionSnapshot.schema.fields, Ze) : Ze;
1952
+ let t = E.formDefinitionSnapshot.schema ? Re(E.formDefinitionSnapshot.schema.fields, R) : R;
1932
1953
  if (E.formDefinitionSnapshot.schema && E.formDefinitionSnapshot.uiSchema) {
1933
- let e = Be({
1954
+ let e = Ve({
1934
1955
  schema: E.formDefinitionSnapshot.schema,
1935
1956
  uiSchema: E.formDefinitionSnapshot.uiSchema,
1936
1957
  values: t
1937
1958
  });
1938
1959
  if (!e.valid) {
1939
- R(e.errors), A("請先補齊必填欄位。"), e.firstInvalidFieldKey && Re(e.firstInvalidFieldKey), N(!1);
1960
+ L(e.errors), j("請先補齊必填欄位。"), e.firstInvalidFieldKey && ze(e.firstInvalidFieldKey), N(!1);
1940
1961
  return;
1941
1962
  }
1942
1963
  }
1943
1964
  try {
1944
- await be({
1965
+ await xe({
1945
1966
  formData: t,
1946
1967
  initiatorMemberId: b,
1947
1968
  instanceId: E.id,
1948
1969
  title: E.title
1949
1970
  }), await Z();
1950
1971
  } catch (e) {
1951
- A(H(e));
1972
+ j(U(e));
1952
1973
  } finally {
1953
1974
  N(!1);
1954
1975
  }
1955
1976
  }
1956
- let Et = W.current?.deciding ?? !1, $ = M || Et;
1977
+ let Ot = W.current?.deciding ?? !1, $ = M || Ot;
1957
1978
  return /* @__PURE__ */ T(C, { children: [
1958
- /* @__PURE__ */ w(v, { children: /* @__PURE__ */ T(we, {
1959
- description: E ? `${nt(E.state)} · ${t(E.startedAt)}` : "載入案件內容。",
1979
+ /* @__PURE__ */ w(v, { children: /* @__PURE__ */ T(Te, {
1980
+ description: E ? [
1981
+ at(E.state),
1982
+ t(E.startedAt),
1983
+ Qe(E, gt)
1984
+ ].filter(V).join(" · ") : "載入案件內容。",
1960
1985
  title: E?.title ?? "簽核案件",
1961
1986
  children: [
1962
1987
  E ? /* @__PURE__ */ w(g, {
1963
1988
  "aria-label": "查看流程圖",
1964
- icon: Ne,
1989
+ icon: Pe,
1965
1990
  iconType: "icon-only",
1966
1991
  onClick: () => Je(!0),
1967
1992
  title: "查看流程圖",
1968
1993
  variant: "base-secondary",
1969
1994
  children: "流程圖"
1970
1995
  }) : null,
1971
- pt ? /* @__PURE__ */ w(g, {
1996
+ J ? /* @__PURE__ */ w(g, {
1972
1997
  disabled: $,
1973
- icon: De,
1998
+ icon: Oe,
1974
1999
  iconType: "leading",
1975
2000
  onClick: () => I(!0),
1976
2001
  variant: "destructive-secondary",
1977
2002
  children: "取消案件"
1978
2003
  }) : null,
1979
- lt ? /* @__PURE__ */ T(C, { children: [
1980
- q ? /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(g, {
2004
+ ut ? /* @__PURE__ */ T(C, { children: [
2005
+ mt ? /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(g, {
1981
2006
  disabled: $,
1982
2007
  icon: je,
1983
2008
  iconType: "leading",
@@ -2000,7 +2025,7 @@ function Nn({ instanceId: a, showAttachments: o = !0, showForm: s = !0, showHist
2000
2025
  variant: "base-secondary",
2001
2026
  children: "通知設定"
2002
2027
  }, "adhoc-notify"),
2003
- ut ? /* @__PURE__ */ w(g, {
2028
+ dt ? /* @__PURE__ */ w(g, {
2004
2029
  disabled: $,
2005
2030
  icon: Me,
2006
2031
  iconType: "leading",
@@ -2008,17 +2033,17 @@ function Nn({ instanceId: a, showAttachments: o = !0, showForm: s = !0, showHist
2008
2033
  variant: "base-secondary",
2009
2034
  children: "退回"
2010
2035
  }, "task-return") : null,
2011
- ft ? /* @__PURE__ */ w(g, {
2036
+ pt ? /* @__PURE__ */ w(g, {
2012
2037
  disabled: $,
2013
- icon: Pe,
2038
+ icon: Fe,
2014
2039
  iconType: "leading",
2015
2040
  onClick: () => W.current?.openTransferModal(),
2016
2041
  variant: "base-secondary",
2017
2042
  children: "轉派"
2018
2043
  }, "task-transfer") : null,
2019
- dt ? /* @__PURE__ */ w(g, {
2044
+ ft ? /* @__PURE__ */ w(g, {
2020
2045
  disabled: $,
2021
- icon: De,
2046
+ icon: Oe,
2022
2047
  iconType: "leading",
2023
2048
  onClick: () => W.current?.openRejectModal(),
2024
2049
  variant: "destructive-secondary",
@@ -2026,7 +2051,7 @@ function Nn({ instanceId: a, showAttachments: o = !0, showForm: s = !0, showHist
2026
2051
  }, "task-reject") : null,
2027
2052
  /* @__PURE__ */ w(g, {
2028
2053
  disabled: $,
2029
- icon: Te,
2054
+ icon: Ee,
2030
2055
  iconType: "leading",
2031
2056
  onClick: () => W.current?.handleApprove(),
2032
2057
  variant: "base-primary",
@@ -2035,56 +2060,56 @@ function Nn({ instanceId: a, showAttachments: o = !0, showForm: s = !0, showHist
2035
2060
  ] }) : null
2036
2061
  ]
2037
2062
  }) }),
2038
- /* @__PURE__ */ T(te, { children: [
2039
- s ? /* @__PURE__ */ w(y, { children: /* @__PURE__ */ w(Bt, {
2040
- canResubmitInstance: mt,
2063
+ /* @__PURE__ */ T(ne, { children: [
2064
+ s ? /* @__PURE__ */ w(y, { children: /* @__PURE__ */ w(Ut, {
2065
+ canResubmitInstance: ht,
2041
2066
  deciding: M,
2042
- error: Ge,
2067
+ error: A,
2043
2068
  instance: E,
2044
- loading: Ke,
2069
+ loading: Ge,
2045
2070
  onDataSourceStateChange: ct,
2046
2071
  onResubmitFormChange: (e) => {
2047
- z(e), R({});
2072
+ $e(e), L({});
2048
2073
  },
2049
- onResubmitInstance: () => void Tt(),
2050
- onUploadAttachment: St,
2051
- resubmitFormData: Ze,
2052
- resubmitFormErrors: L
2074
+ onResubmitInstance: () => void Dt(),
2075
+ onUploadAttachment: Q,
2076
+ resubmitFormData: R,
2077
+ resubmitFormErrors: Xe
2053
2078
  }) }) : null,
2054
- o ? /* @__PURE__ */ w(y, { children: /* @__PURE__ */ w(Ht, {
2055
- attachments: _e,
2079
+ o ? /* @__PURE__ */ w(y, { children: /* @__PURE__ */ w(Gt, {
2080
+ attachments: fe,
2056
2081
  onDownload: (e) => {
2057
- Q(e);
2082
+ wt(e);
2058
2083
  },
2059
2084
  onPreview: (e) => {
2060
- Ct(e);
2085
+ Tt(e);
2061
2086
  }
2062
2087
  }) }) : null,
2063
- h ? /* @__PURE__ */ w(y, { children: /* @__PURE__ */ w($t, {
2064
- adhocDirectives: tt,
2088
+ ee ? /* @__PURE__ */ w(y, { children: /* @__PURE__ */ w(nn, {
2089
+ adhocDirectives: rt,
2065
2090
  currentMemberId: b,
2066
2091
  instance: E,
2067
- memberProfilesById: J,
2092
+ memberProfilesById: gt,
2068
2093
  onChanged: Z,
2069
2094
  ref: W,
2070
2095
  tasks: O
2071
2096
  }) }) : null,
2072
- m ? /* @__PURE__ */ w(y, { children: /* @__PURE__ */ w(nn, {
2073
- signatureVerification: Oe,
2097
+ d ? /* @__PURE__ */ w(y, { children: /* @__PURE__ */ w(on, {
2098
+ signatureVerification: De,
2074
2099
  signatures: ye
2075
2100
  }) }) : null,
2076
- x && D.length > 0 ? /* @__PURE__ */ w(y, { children: /* @__PURE__ */ w(gn, {
2077
- deliveries: D,
2078
- onRetry: bt,
2079
- readNodeLabel: (e) => at(e, E?.workflowSnapshot ?? null)
2101
+ x && Ce.length > 0 ? /* @__PURE__ */ w(y, { children: /* @__PURE__ */ w(yn, {
2102
+ deliveries: Ce,
2103
+ onRetry: St,
2104
+ readNodeLabel: (e) => st(e, E?.workflowSnapshot ?? null)
2080
2105
  }) }) : null,
2081
- u ? /* @__PURE__ */ w(y, { children: /* @__PURE__ */ w(fn, {
2082
- activityLogs: ie,
2106
+ c ? /* @__PURE__ */ w(y, { children: /* @__PURE__ */ w(hn, {
2107
+ activityLogs: re,
2083
2108
  instanceState: E?.state ?? "RUNNING",
2084
- memberProfilesById: J,
2085
- signatureVerification: Oe,
2086
- signaturesById: gt,
2087
- taskDecisionsByTaskId: ht,
2109
+ memberProfilesById: gt,
2110
+ signatureVerification: De,
2111
+ signaturesById: _t,
2112
+ taskDecisionsByTaskId: Y,
2088
2113
  tasks: O,
2089
2114
  workflowSnapshot: E?.workflowSnapshot ?? null,
2090
2115
  workflowTokens: Ie
@@ -2096,30 +2121,30 @@ function Nn({ instanceId: a, showAttachments: o = !0, showForm: s = !0, showHist
2096
2121
  open: qe,
2097
2122
  showModalHeader: !0,
2098
2123
  size: "wide",
2099
- supportingText: `${nt(E.state)} · ${t(E.startedAt)}`,
2124
+ supportingText: `${at(E.state)} · ${t(E.startedAt)}`,
2100
2125
  title: "流程圖",
2101
2126
  children: /* @__PURE__ */ T("div", {
2102
- style: Cn,
2127
+ style: En,
2103
2128
  children: [/* @__PURE__ */ w("div", {
2104
- style: wn,
2129
+ style: Dn,
2105
2130
  children: /* @__PURE__ */ T(We, {
2106
- edges: vt,
2131
+ edges: yt,
2107
2132
  fitView: !0,
2108
2133
  fitViewOptions: { padding: .18 },
2109
2134
  maxZoom: 1.2,
2110
2135
  minZoom: .2,
2111
- nodes: _t,
2136
+ nodes: vt,
2112
2137
  nodesDraggable: !1,
2113
2138
  nodesFocusable: !1,
2114
- nodeTypes: Mn,
2139
+ nodeTypes: Fn,
2115
2140
  panOnDrag: !0,
2116
2141
  proOptions: { hideAttribution: !0 },
2117
- children: [/* @__PURE__ */ w(k, {}), /* @__PURE__ */ w(Ve, { showInteractive: !1 })]
2142
+ children: [/* @__PURE__ */ w(k, {}), /* @__PURE__ */ w(He, { showInteractive: !1 })]
2118
2143
  })
2119
- }), X.length > 0 ? /* @__PURE__ */ w("div", {
2120
- style: kn,
2121
- children: X.map((e) => /* @__PURE__ */ w("span", {
2122
- style: An,
2144
+ }), bt.length > 0 ? /* @__PURE__ */ w("div", {
2145
+ style: Mn,
2146
+ children: bt.map((e) => /* @__PURE__ */ w("span", {
2147
+ style: Nn,
2123
2148
  children: e
2124
2149
  }, e))
2125
2150
  }) : null]
@@ -2128,17 +2153,17 @@ function Nn({ instanceId: a, showAttachments: o = !0, showForm: s = !0, showHist
2128
2153
  /* @__PURE__ */ w(_, {
2129
2154
  modalType: "standard",
2130
2155
  onClose: () => {
2131
- $e(null), U(null);
2156
+ tt(null), nt(null);
2132
2157
  },
2133
- open: !!(V && et),
2158
+ open: !!(B && H),
2134
2159
  showModalHeader: !0,
2135
2160
  size: "wide",
2136
- supportingText: V?.filename ?? void 0,
2161
+ supportingText: B?.filename ?? void 0,
2137
2162
  title: "PDF 預覽",
2138
- children: et ? /* @__PURE__ */ w(Xe, {
2139
- filename: V?.filename ?? "PDF 預覽",
2140
- fileUrl: et,
2141
- onDownload: V ? () => void Q(V) : void 0
2163
+ children: H ? /* @__PURE__ */ w(Ze, {
2164
+ filename: B?.filename ?? "PDF 預覽",
2165
+ fileUrl: H,
2166
+ onDownload: B ? () => void wt(B) : void 0
2142
2167
  }) : null
2143
2168
  }),
2144
2169
  /* @__PURE__ */ w(_, {
@@ -2150,14 +2175,14 @@ function Nn({ instanceId: a, showAttachments: o = !0, showForm: s = !0, showHist
2150
2175
  modalType: "standard",
2151
2176
  onCancel: () => I(!1),
2152
2177
  onClose: () => I(!1),
2153
- onConfirm: () => void wt(),
2154
- open: Ye,
2178
+ onConfirm: () => void Et(),
2179
+ open: F,
2155
2180
  showModalFooter: !0,
2156
2181
  showModalHeader: !0,
2157
2182
  supportingText: "取消後會關閉目前待簽任務與候選簽核人。",
2158
2183
  title: "取消案件",
2159
2184
  children: /* @__PURE__ */ T("div", {
2160
- style: jn,
2185
+ style: Pn,
2161
2186
  children: [/* @__PURE__ */ T(S, {
2162
2187
  variant: "body",
2163
2188
  children: [
@@ -2168,33 +2193,33 @@ function Nn({ instanceId: a, showAttachments: o = !0, showForm: s = !0, showHist
2168
2193
  }), /* @__PURE__ */ w(n, {
2169
2194
  label: "取消原因",
2170
2195
  name: "cancelComment",
2171
- children: /* @__PURE__ */ w(re, {
2172
- onChange: (e) => F(e.target.value),
2196
+ children: /* @__PURE__ */ w(ie, {
2197
+ onChange: (e) => P(e.target.value),
2173
2198
  placeholder: "可填寫取消原因",
2174
2199
  resize: "vertical",
2175
2200
  rows: 3,
2176
- value: P
2201
+ value: Ye
2177
2202
  })
2178
2203
  })]
2179
2204
  })
2180
2205
  })
2181
2206
  ] });
2182
2207
  }
2183
- function Pn(e) {
2208
+ function Ln(e) {
2184
2209
  return e.data.label ? e.data.label : e.data.isDefault ? "其他情況" : e.data.condition ?? "";
2185
2210
  }
2186
- function Fn(e) {
2187
- return e.edges.map(Pn).filter((e) => e.trim().length > 0);
2211
+ function Rn(e) {
2212
+ return e.edges.map(Ln).filter((e) => e.trim().length > 0);
2188
2213
  }
2189
- function In(e) {
2214
+ function zn(e) {
2190
2215
  return e === "startEvent" ? "開始" : e === "endEvent" ? "完成" : e === "userTask" ? "簽核節點" : e === "serviceTask" ? "知會節點" : e === "exclusiveGateway" ? "條件分流" : "平行處理";
2191
2216
  }
2192
- function Ln(e, t, n, r) {
2217
+ function Bn(e, t, n, r) {
2193
2218
  return e.nodes.map((e) => {
2194
- let i = Nt(e, t, n, r);
2219
+ let i = It(e, t, n, r);
2195
2220
  return {
2196
2221
  data: {
2197
- kindLabel: In(e.type),
2222
+ kindLabel: zn(e.type),
2198
2223
  label: e.data.label,
2199
2224
  secondaryLabel: i.secondaryLabel,
2200
2225
  statusLabel: i.statusLabel,
@@ -2202,42 +2227,42 @@ function Ln(e, t, n, r) {
2202
2227
  },
2203
2228
  id: e.id,
2204
2229
  position: e.position,
2205
- sourcePosition: Ue.Right,
2206
- targetPosition: Ue.Left,
2230
+ sourcePosition: A.Right,
2231
+ targetPosition: A.Left,
2207
2232
  type: "workflowRuntime"
2208
2233
  };
2209
2234
  });
2210
2235
  }
2211
- function Rn(e) {
2212
- let t = new Ge.graphlib.Graph();
2236
+ function Vn(e) {
2237
+ let t = new j.graphlib.Graph();
2213
2238
  return t.setDefaultEdgeLabel(() => ({})), t.setGraph({
2214
2239
  nodesep: 56,
2215
2240
  rankdir: "LR",
2216
2241
  ranksep: 120
2217
2242
  }), e.nodes.forEach((e) => {
2218
2243
  t.setNode(e.id, {
2219
- height: Sn,
2220
- width: xn
2244
+ height: Tn,
2245
+ width: wn
2221
2246
  });
2222
2247
  }), e.edges.forEach((e) => {
2223
2248
  t.setEdge(e.source, e.target);
2224
- }), Ge.layout(t), {
2249
+ }), j.layout(t), {
2225
2250
  ...e,
2226
2251
  nodes: e.nodes.map((e) => {
2227
2252
  let n = t.node(e.id);
2228
2253
  return n ? {
2229
2254
  ...e,
2230
2255
  position: {
2231
- x: n.x - xn / 2,
2232
- y: n.y - Sn / 2
2256
+ x: n.x - wn / 2,
2257
+ y: n.y - Tn / 2
2233
2258
  }
2234
2259
  } : e;
2235
2260
  })
2236
2261
  };
2237
2262
  }
2238
- function zn(e) {
2263
+ function Hn(e) {
2239
2264
  return e.edges.map((e) => {
2240
- let t = Pn(e);
2265
+ let t = Ln(e);
2241
2266
  return {
2242
2267
  animated: !1,
2243
2268
  id: e.id,
@@ -2265,25 +2290,25 @@ function zn(e) {
2265
2290
  };
2266
2291
  });
2267
2292
  }
2268
- function Bn(e) {
2293
+ function Un(e) {
2269
2294
  return e === "current" ? {
2270
- ...Tn,
2295
+ ...On,
2271
2296
  border: "1px solid var(--mzn-color-primary, #0057ff)",
2272
2297
  boxShadow: "0 0 0 3px rgba(0, 87, 255, 0.14)"
2273
2298
  } : e === "completed" ? {
2274
- ...Tn,
2299
+ ...On,
2275
2300
  border: "1px solid #16a34a"
2276
2301
  } : e === "cancelled" ? {
2277
- ...Tn,
2302
+ ...On,
2278
2303
  border: "1px solid #dc2626",
2279
2304
  opacity: .72
2280
2305
  } : e === "waiting" ? {
2281
- ...Tn,
2306
+ ...On,
2282
2307
  border: "1px dashed #64748b"
2283
- } : Tn;
2308
+ } : On;
2284
2309
  }
2285
- function Vn(e) {
2286
- let t = En;
2310
+ function Wn(e) {
2311
+ let t = kn;
2287
2312
  return e === "current" ? {
2288
2313
  ...t,
2289
2314
  background: "#eff6ff",
@@ -2306,14 +2331,14 @@ function Vn(e) {
2306
2331
  color: "#64748b"
2307
2332
  };
2308
2333
  }
2309
- function Hn({ data: e }) {
2334
+ function Gn({ data: e }) {
2310
2335
  return /* @__PURE__ */ T("div", {
2311
- style: Bn(e.tone),
2336
+ style: Un(e.tone),
2312
2337
  children: [
2313
- /* @__PURE__ */ w(He, {
2338
+ /* @__PURE__ */ w(Ue, {
2314
2339
  isConnectable: !1,
2315
- position: Ue.Left,
2316
- style: On,
2340
+ position: A.Left,
2341
+ style: jn,
2317
2342
  type: "target"
2318
2343
  }),
2319
2344
  /* @__PURE__ */ w(S, {
@@ -2324,24 +2349,24 @@ function Hn({ data: e }) {
2324
2349
  children: e.label
2325
2350
  }),
2326
2351
  /* @__PURE__ */ w("span", {
2327
- style: Vn(e.tone),
2352
+ style: Wn(e.tone),
2328
2353
  children: e.statusLabel
2329
2354
  }),
2330
2355
  /* @__PURE__ */ w("span", {
2331
2356
  title: e.secondaryLabel,
2332
- style: Dn,
2357
+ style: An,
2333
2358
  children: e.secondaryLabel || e.kindLabel
2334
2359
  }),
2335
- /* @__PURE__ */ w(He, {
2360
+ /* @__PURE__ */ w(Ue, {
2336
2361
  isConnectable: !1,
2337
- position: Ue.Right,
2338
- style: On,
2362
+ position: A.Right,
2363
+ style: jn,
2339
2364
  type: "source"
2340
2365
  })
2341
2366
  ]
2342
2367
  });
2343
2368
  }
2344
2369
  //#endregion
2345
- export { $t as a, nn as i, gn as n, Ht as o, fn as r, Bt as s, Nn as t };
2370
+ export { nn as a, on as i, yn as n, Gt as o, hn as r, Ut as s, In as t };
2346
2371
 
2347
- //# sourceMappingURL=detail-C8NOqY0p.js.map
2372
+ //# sourceMappingURL=detail-_c21WQla.js.map