@rytass/bpm-core-react 0.21.4 → 0.23.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 (91) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/dist/chunks/{FormBuilderView-DbfbLZCI.js → FormBuilderView-D_bN9gzT.js} +675 -614
  3. package/dist/chunks/FormBuilderView-D_bN9gzT.js.map +1 -0
  4. package/dist/chunks/FormBuilderView-bm8P55hp.cjs +4 -0
  5. package/dist/chunks/FormBuilderView-bm8P55hp.cjs.map +1 -0
  6. package/dist/chunks/FormRendererView-BlQgJOkI.cjs +6 -0
  7. package/dist/chunks/FormRendererView-BlQgJOkI.cjs.map +1 -0
  8. package/dist/chunks/{FormRendererView-CAyPXhPq.js → FormRendererView-CemHvfAT.js} +298 -290
  9. package/dist/chunks/FormRendererView-CemHvfAT.js.map +1 -0
  10. package/dist/chunks/compose-CdKVQfjB.cjs +2 -0
  11. package/dist/chunks/compose-CdKVQfjB.cjs.map +1 -0
  12. package/dist/chunks/{compose-U1zs3Yof.js → compose-N9657E5u.js} +161 -147
  13. package/dist/chunks/compose-N9657E5u.js.map +1 -0
  14. package/dist/chunks/{designer-DPG7R_WP.js → designer-CKwG_vM5.js} +1913 -1715
  15. package/dist/chunks/designer-CKwG_vM5.js.map +1 -0
  16. package/dist/chunks/designer-JPs7EijM.cjs +69 -0
  17. package/dist/chunks/designer-JPs7EijM.cjs.map +1 -0
  18. package/dist/chunks/detail-Dqu0K9QM.cjs +5 -0
  19. package/dist/chunks/detail-Dqu0K9QM.cjs.map +1 -0
  20. package/dist/chunks/{detail-CHZDNNM6.js → detail-fW0vJudE.js} +902 -895
  21. package/dist/chunks/detail-fW0vJudE.js.map +1 -0
  22. package/dist/chunks/instance-error-message-BKt07-Bo.js +270 -0
  23. package/dist/chunks/instance-error-message-BKt07-Bo.js.map +1 -0
  24. package/dist/chunks/instance-error-message-BL_X7Af8.cjs +2 -0
  25. package/dist/chunks/instance-error-message-BL_X7Af8.cjs.map +1 -0
  26. package/dist/pages/instances/detail/index.cjs +1 -1
  27. package/dist/pages/instances/detail/index.js +1 -1
  28. package/dist/pages/templates/compose/index.cjs +1 -1
  29. package/dist/pages/templates/compose/index.js +1 -1
  30. package/dist/pages/templates/designer/index.cjs +1 -1
  31. package/dist/pages/templates/designer/index.js +1 -1
  32. package/dist/views/forms/builder/index.cjs +1 -1
  33. package/dist/views/forms/builder/index.js +1 -1
  34. package/dist/views/forms/renderer/FormRendererView.d.cts +26 -1
  35. package/dist/views/forms/renderer/FormRendererView.d.ts +26 -1
  36. package/dist/views/forms/renderer/index.cjs +1 -1
  37. package/dist/views/forms/renderer/index.js +1 -1
  38. package/dist/views/inbox/index.cjs +1 -1
  39. package/dist/views/inbox/index.cjs.map +1 -1
  40. package/dist/views/inbox/index.js +185 -94
  41. package/dist/views/inbox/index.js.map +1 -1
  42. package/dist/views/instances/approver-filled-form.d.cts +56 -20
  43. package/dist/views/instances/approver-filled-form.d.ts +56 -20
  44. package/dist/views/instances/detail/index.cjs +1 -1
  45. package/dist/views/instances/detail/index.js +1 -1
  46. package/dist/views/instances/detail/sections/InstanceFormSection.d.cts +7 -0
  47. package/dist/views/instances/detail/sections/InstanceFormSection.d.ts +7 -0
  48. package/dist/views/instances/detail/sections/InstanceTasksSection.d.cts +1 -1
  49. package/dist/views/instances/detail/sections/InstanceTasksSection.d.ts +1 -1
  50. package/dist/views/instances/new/index.cjs +1 -1
  51. package/dist/views/instances/new/index.js +2 -2
  52. package/dist/views/templates/compose/index.cjs +1 -1
  53. package/dist/views/templates/compose/index.js +1 -1
  54. package/dist/views/templates/compose/steps/ComposeReviewStep.d.cts +3 -1
  55. package/dist/views/templates/compose/steps/ComposeReviewStep.d.ts +3 -1
  56. package/dist/views/templates/compose/steps/ComposeWorkflowStep.d.cts +4 -1
  57. package/dist/views/templates/compose/steps/ComposeWorkflowStep.d.ts +4 -1
  58. package/dist/views/templates/compose/use-template-compose-wizard.d.cts +3 -1
  59. package/dist/views/templates/compose/use-template-compose-wizard.d.ts +3 -1
  60. package/dist/views/templates/designer/TemplateDesignerView.d.cts +10 -1
  61. package/dist/views/templates/designer/TemplateDesignerView.d.ts +10 -1
  62. package/dist/views/templates/designer/field-access-matrix/FieldAccessMatrixDrawer.d.cts +3 -1
  63. package/dist/views/templates/designer/field-access-matrix/FieldAccessMatrixDrawer.d.ts +3 -1
  64. package/dist/views/templates/designer/field-access-matrix/field-access-copy.d.cts +3 -2
  65. package/dist/views/templates/designer/field-access-matrix/field-access-copy.d.ts +3 -2
  66. package/dist/views/templates/designer/index.cjs +1 -1
  67. package/dist/views/templates/designer/index.js +1 -1
  68. package/dist/views/templates/designer/launch-mode.d.cts +19 -0
  69. package/dist/views/templates/designer/launch-mode.d.ts +19 -0
  70. package/dist/views/templates/designer/publish-default-value-check.d.cts +36 -0
  71. package/dist/views/templates/designer/publish-default-value-check.d.ts +36 -0
  72. package/package.json +3 -3
  73. package/dist/chunks/FormBuilderView-Bok4Y59D.cjs +0 -4
  74. package/dist/chunks/FormBuilderView-Bok4Y59D.cjs.map +0 -1
  75. package/dist/chunks/FormBuilderView-DbfbLZCI.js.map +0 -1
  76. package/dist/chunks/FormRendererView-CAyPXhPq.js.map +0 -1
  77. package/dist/chunks/FormRendererView-iLlHFIUR.cjs +0 -6
  78. package/dist/chunks/FormRendererView-iLlHFIUR.cjs.map +0 -1
  79. package/dist/chunks/compose-DP1N4twA.cjs +0 -2
  80. package/dist/chunks/compose-DP1N4twA.cjs.map +0 -1
  81. package/dist/chunks/compose-U1zs3Yof.js.map +0 -1
  82. package/dist/chunks/designer-CWL-dCQ_.cjs +0 -69
  83. package/dist/chunks/designer-CWL-dCQ_.cjs.map +0 -1
  84. package/dist/chunks/designer-DPG7R_WP.js.map +0 -1
  85. package/dist/chunks/detail-BUfsSal0.cjs +0 -5
  86. package/dist/chunks/detail-BUfsSal0.cjs.map +0 -1
  87. package/dist/chunks/detail-CHZDNNM6.js.map +0 -1
  88. package/dist/chunks/instance-error-message-BEM4O_Kj.js +0 -208
  89. package/dist/chunks/instance-error-message-BEM4O_Kj.js.map +0 -1
  90. package/dist/chunks/instance-error-message-BpCLCOjp.cjs +0 -2
  91. package/dist/chunks/instance-error-message-BpCLCOjp.cjs.map +0 -1
@@ -4,30 +4,30 @@ import { t as e } from "./bpm-form-field-9B-Det0u.js";
4
4
  import { t } from "./format-date-time-B0LdmWg4.js";
5
5
  import { n } from "./auth-provider-C2b-5mGt.js";
6
6
  import { t as r } from "./use-bpm-member-BPzcNU1g.js";
7
- import { l as i, n as a, o, t as s } from "./FormRendererView-CAyPXhPq.js";
7
+ import { l as i, n as a, o, t as s } from "./FormRendererView-CemHvfAT.js";
8
8
  import { a as c, n as l, o as u, r as d, t as f } from "./task-decision-3d17ZvZE.js";
9
9
  import { t as p } from "./format-member-label-C73FuP-d.js";
10
- import { a as m, c as h, d as g, f as ee, i as te, l as ne, n as re, o as ie, r as ae, s as oe, t as _, u as v } from "./instance-error-message-BEM4O_Kj.js";
11
- import { Fragment as se, forwardRef as y, useCallback as ce, useEffect as le, useImperativeHandle as ue, useMemo as b, useRef as de, useState as x } from "react";
12
- import { AutoComplete as fe, Badge as pe, Button as S, Description as C, DescriptionContent as me, InlineMessage as he, Input as ge, Message as _e, Modal as w, PageHeader as ve, Section as T, SectionGroup as ye, Select as be, Stepper as xe, Table as Se, Textarea as Ce, Tooltip as we, Typography as E } from "@mezzanine-ui/react";
13
- import { readFormDataIssues as Te } from "@rytass/bpm-core-client";
14
- import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
15
- import { cancelAdhocDirective as Ee, cancelApprovalInstance as De, configureAdhocCompletionNotification as Oe, configureAdhocStageNotification as ke, decideTask as A, listAdhocDirectives as Ae, listAttachments as je, listTaskDecisions as Me, listWorkflowWebhookDeliveries as Ne, readApprovalInstance as Pe, readAttachmentDownloadUrl as Fe, readAttachmentPreviewUrl as Ie, readInstanceSignatures as Le, requestAdhocCountersign as Re, requestAdhocPreApproval as ze, resolveMemberProfiles as Be, resubmitApprovalInstance as Ve, retryWorkflowWebhookDelivery as He, searchMembers as Ue, uploadAttachment as We } from "@rytass/bpm-core-client/workflow";
16
- import { readNodeFillableFieldKeys as Ge, readRevealedFieldKeys as Ke, readTopLevelFieldKey as j, resolveFieldAccess as qe } from "@rytass/bpm-core-shared";
17
- import M from "@mezzanine-ui/react/ContentHeader";
18
- import { buildFormRendererValues as Je, focusFormRendererField as Ye, validateFormRendererValuesInWorker as Xe } from "@rytass/bpm-core-client/form";
19
- import { CheckedIcon as Ze, ChevronLeftIcon as Qe, ChevronRightIcon as $e, DangerousOutlineIcon as et, DownloadIcon as N, FileSearchIcon as tt, NotificationUnreadIcon as nt, PlusIcon as rt, RefreshCcwIcon as it, ResetIcon as at, ShareIcon as P, UserIcon as F, ZoomInIcon as ot, ZoomOutIcon as st } from "@mezzanine-ui/icons";
20
- import { resolveOrgUnitOptions as ct } from "@rytass/bpm-core-client/organization";
21
- import { Background as lt, Controls as ut, Handle as I, Position as L, ReactFlow as dt } from "@xyflow/react";
22
- import * as ft from "dagre";
23
- import { Document as pt, Page as mt } from "react-pdf";
24
- import { readSelectableReturnTargetNodeIds as ht } from "@rytass/bpm-core-shared/workflow-graph";
25
- import { stepClasses as R } from "@mezzanine-ui/core/stepper";
26
- function gt(e) {
10
+ import { a as m, c as h, d as g, f as ee, h as te, i as ne, l as re, m as ie, o as ae, p as oe, r as _, s as se, t as v, u as ce } from "./instance-error-message-BKt07-Bo.js";
11
+ import { Fragment as le, forwardRef as y, useCallback as ue, useEffect as de, useImperativeHandle as fe, useMemo as b, useRef as pe, useState as x } from "react";
12
+ import { AutoComplete as me, Badge as he, Button as S, Description as C, DescriptionContent as ge, InlineMessage as _e, Input as ve, Message as w, Modal as T, PageHeader as ye, Section as E, SectionGroup as be, Select as xe, Stepper as Se, Table as D, Textarea as Ce, Tooltip as we, Typography as O } from "@mezzanine-ui/react";
13
+ import { readFormDataIssues as Te, readRequestErrorCode as Ee } from "@rytass/bpm-core-client";
14
+ import { Fragment as k, jsx as A, jsxs as j } from "react/jsx-runtime";
15
+ import { cancelAdhocDirective as De, cancelApprovalInstance as Oe, configureAdhocCompletionNotification as ke, configureAdhocStageNotification as M, decideTask as Ae, listAdhocDirectives as je, listAttachments as Me, listTaskDecisions as Ne, listWorkflowWebhookDeliveries as Pe, readApprovalInstance as Fe, readAttachmentDownloadUrl as Ie, readAttachmentPreviewUrl as Le, readInstanceSignatures as Re, requestAdhocCountersign as ze, requestAdhocPreApproval as Be, resolveMemberProfiles as Ve, resubmitApprovalInstance as He, retryWorkflowWebhookDelivery as Ue, searchMembers as We, uploadAttachment as Ge } from "@rytass/bpm-core-client/workflow";
16
+ import { readNodeFillGrantFieldKeys as Ke, readRevealedFieldKeys as N, readTopLevelFieldKey as P, resolveFieldAccess as qe } from "@rytass/bpm-core-shared";
17
+ import Je from "@mezzanine-ui/react/ContentHeader";
18
+ import { buildFormRendererValues as Ye, focusFormRendererField as Xe, validateFormRendererValuesInWorker as Ze } from "@rytass/bpm-core-client/form";
19
+ import { CheckedIcon as Qe, ChevronLeftIcon as $e, ChevronRightIcon as F, DangerousOutlineIcon as et, DownloadIcon as tt, FileSearchIcon as nt, NotificationUnreadIcon as rt, PlusIcon as it, RefreshCcwIcon as I, ResetIcon as L, ShareIcon as at, UserIcon as ot, ZoomInIcon as st, ZoomOutIcon as ct } from "@mezzanine-ui/icons";
20
+ import { resolveOrgUnitOptions as lt } from "@rytass/bpm-core-client/organization";
21
+ import { Background as ut, Controls as dt, Handle as ft, Position as R, ReactFlow as pt } from "@xyflow/react";
22
+ import * as mt from "dagre";
23
+ import { Document as ht, Page as gt } from "react-pdf";
24
+ import { readSelectableReturnTargetNodeIds as _t } from "@rytass/bpm-core-shared/workflow-graph";
25
+ import { stepClasses as z } from "@mezzanine-ui/core/stepper";
26
+ function vt(e) {
27
27
  let [t, n] = x(/* @__PURE__ */ new Map()), r = e.join("\n");
28
- return le(() => {
28
+ return de(() => {
29
29
  let e = r ? [...new Set(r.split("\n"))].filter((e) => !t.has(e)) : [], i = !1;
30
- return e.length === 0 ? () => void 0 : (ct(e).then((e) => e.map(a)).catch(() => []).then((t) => {
30
+ return e.length === 0 ? () => void 0 : (lt(e).then((e) => e.map(a)).catch(() => []).then((t) => {
31
31
  i || n((n) => new Map([...n, ...e.map((e) => [e, t.find((t) => t.id.toLowerCase() === e.toLowerCase())?.name ?? null])]));
32
32
  }), () => {
33
33
  i = !0;
@@ -37,7 +37,7 @@ function gt(e) {
37
37
  return n === null ? [] : [[e, n ?? "讀取中…"]];
38
38
  })), [r, t]);
39
39
  }
40
- var z = {
40
+ var B = {
41
41
  root: "bpm_root_ehm7w",
42
42
  toolbar: "bpm_toolbar_R-tis",
43
43
  pageControls: "bpm_pageControls_jM-rC",
@@ -46,10 +46,10 @@ var z = {
46
46
  viewport: "bpm_viewport_DQXms",
47
47
  page: "bpm_page_Cv5Rg",
48
48
  state: "bpm_state_bpgp3"
49
- }, _t = 760, vt = 920, yt = 320, bt = 32, xt = .75, St = 1.75, B = .25;
50
- function Ct({ filename: e, fileUrl: t, onDownload: n }) {
51
- let r = de(null), [i, a] = x(null), [o, s] = x(1), [c, l] = x(1), [u, d] = x(_t);
52
- le(() => {
49
+ }, yt = 760, bt = 920, xt = 320, St = 32, Ct = .75, wt = 1.75, Tt = .25;
50
+ function Et({ filename: e, fileUrl: t, onDownload: n }) {
51
+ let r = pe(null), [i, a] = x(null), [o, s] = x(1), [c, l] = x(1), [u, d] = x(yt);
52
+ de(() => {
53
53
  let e = r.current;
54
54
  if (!e || typeof ResizeObserver > "u") return;
55
55
  let t = new ResizeObserver((e) => {
@@ -57,45 +57,45 @@ function Ct({ filename: e, fileUrl: t, onDownload: n }) {
57
57
  t && d(t);
58
58
  });
59
59
  return t.observe(e), () => t.disconnect();
60
- }, []), le(() => {
60
+ }, []), de(() => {
61
61
  a(null), s(1), l(1);
62
62
  }, [t]);
63
63
  let f = b(() => {
64
- let e = Math.max(yt, u - bt);
65
- return Math.round(Math.min(vt, e) * c);
66
- }, [c, u]), p = ce((e) => {
64
+ let e = Math.max(xt, u - St);
65
+ return Math.round(Math.min(bt, e) * c);
66
+ }, [c, u]), p = ue((e) => {
67
67
  a(e.numPages), s(1);
68
- }, []), m = o > 1, h = i !== null && o < i, g = c > xt, ee = c < St, te = i === null ? `第 ${o} 頁` : `第 ${o} / ${i} 頁`, ne = `${Math.round(c * 100)}%`;
69
- return /* @__PURE__ */ k("section", {
68
+ }, []), m = o > 1, h = i !== null && o < i, g = c > Ct, ee = c < wt, te = i === null ? `第 ${o} 頁` : `第 ${o} / ${i} 頁`, ne = `${Math.round(c * 100)}%`;
69
+ return /* @__PURE__ */ j("section", {
70
70
  "aria-label": `${e} PDF 預覽`,
71
- className: z.root,
72
- children: [/* @__PURE__ */ k("div", {
73
- className: z.toolbar,
71
+ className: B.root,
72
+ children: [/* @__PURE__ */ j("div", {
73
+ className: B.toolbar,
74
74
  children: [
75
- /* @__PURE__ */ k("div", {
76
- className: z.pageControls,
75
+ /* @__PURE__ */ j("div", {
76
+ className: B.pageControls,
77
77
  "aria-label": "頁面切換",
78
78
  children: [
79
- /* @__PURE__ */ O(S, {
79
+ /* @__PURE__ */ A(S, {
80
80
  "aria-label": "上一頁",
81
81
  disabled: !m,
82
- icon: Qe,
82
+ icon: $e,
83
83
  onClick: () => {
84
84
  s((e) => Math.max(1, e - 1));
85
85
  },
86
86
  size: "minor",
87
87
  variant: "base-secondary"
88
88
  }),
89
- /* @__PURE__ */ O(E, {
90
- className: z.counter,
89
+ /* @__PURE__ */ A(O, {
90
+ className: B.counter,
91
91
  component: "span",
92
92
  variant: "body",
93
93
  children: te
94
94
  }),
95
- /* @__PURE__ */ O(S, {
95
+ /* @__PURE__ */ A(S, {
96
96
  "aria-label": "下一頁",
97
97
  disabled: !h,
98
- icon: $e,
98
+ icon: F,
99
99
  onClick: () => {
100
100
  s((e) => i === null ? e : Math.min(i, e + 1));
101
101
  },
@@ -104,40 +104,40 @@ function Ct({ filename: e, fileUrl: t, onDownload: n }) {
104
104
  })
105
105
  ]
106
106
  }),
107
- /* @__PURE__ */ k("div", {
108
- className: z.zoomControls,
107
+ /* @__PURE__ */ j("div", {
108
+ className: B.zoomControls,
109
109
  "aria-label": "縮放",
110
110
  children: [
111
- /* @__PURE__ */ O(S, {
111
+ /* @__PURE__ */ A(S, {
112
112
  "aria-label": "縮小",
113
113
  disabled: !g,
114
- icon: st,
114
+ icon: ct,
115
115
  onClick: () => {
116
- l((e) => Math.max(xt, e - B));
116
+ l((e) => Math.max(Ct, e - Tt));
117
117
  },
118
118
  size: "minor",
119
119
  variant: "base-secondary"
120
120
  }),
121
- /* @__PURE__ */ O(E, {
122
- className: z.counter,
121
+ /* @__PURE__ */ A(O, {
122
+ className: B.counter,
123
123
  component: "span",
124
124
  variant: "body",
125
125
  children: ne
126
126
  }),
127
- /* @__PURE__ */ O(S, {
127
+ /* @__PURE__ */ A(S, {
128
128
  "aria-label": "放大",
129
129
  disabled: !ee,
130
- icon: ot,
130
+ icon: st,
131
131
  onClick: () => {
132
- l((e) => Math.min(St, e + B));
132
+ l((e) => Math.min(wt, e + Tt));
133
133
  },
134
134
  size: "minor",
135
135
  variant: "base-secondary"
136
136
  })
137
137
  ]
138
138
  }),
139
- n ? /* @__PURE__ */ O(S, {
140
- icon: N,
139
+ n ? /* @__PURE__ */ A(S, {
140
+ icon: tt,
141
141
  iconType: "leading",
142
142
  onClick: n,
143
143
  size: "minor",
@@ -145,19 +145,19 @@ function Ct({ filename: e, fileUrl: t, onDownload: n }) {
145
145
  children: "下載"
146
146
  }) : null
147
147
  ]
148
- }), /* @__PURE__ */ O("div", {
149
- className: z.viewport,
148
+ }), /* @__PURE__ */ A("div", {
149
+ className: B.viewport,
150
150
  ref: r,
151
- children: /* @__PURE__ */ O(pt, {
152
- error: /* @__PURE__ */ O(V, { message: "PDF 無法載入。" }),
151
+ children: /* @__PURE__ */ A(ht, {
152
+ error: /* @__PURE__ */ A(Dt, { message: "PDF 無法載入。" }),
153
153
  file: t,
154
- loading: /* @__PURE__ */ O(V, { message: "正在載入 PDF..." }),
155
- noData: /* @__PURE__ */ O(V, { message: "沒有可預覽的 PDF。" }),
154
+ loading: /* @__PURE__ */ A(Dt, { message: "正在載入 PDF..." }),
155
+ noData: /* @__PURE__ */ A(Dt, { message: "沒有可預覽的 PDF。" }),
156
156
  onLoadSuccess: p,
157
157
  suspense: !1,
158
- children: /* @__PURE__ */ O(mt, {
159
- className: z.page,
160
- loading: /* @__PURE__ */ O(V, { message: "正在載入頁面..." }),
158
+ children: /* @__PURE__ */ A(gt, {
159
+ className: B.page,
160
+ loading: /* @__PURE__ */ A(Dt, { message: "正在載入頁面..." }),
161
161
  pageNumber: o,
162
162
  renderAnnotationLayer: !0,
163
163
  renderTextLayer: !0,
@@ -167,10 +167,10 @@ function Ct({ filename: e, fileUrl: t, onDownload: n }) {
167
167
  })]
168
168
  });
169
169
  }
170
- function V({ message: e }) {
171
- return /* @__PURE__ */ O("div", {
172
- className: z.state,
173
- children: /* @__PURE__ */ O(E, {
170
+ function Dt({ message: e }) {
171
+ return /* @__PURE__ */ A("div", {
172
+ className: B.state,
173
+ children: /* @__PURE__ */ A(O, {
174
174
  color: "text-neutral",
175
175
  variant: "body",
176
176
  children: e
@@ -178,121 +178,121 @@ function V({ message: e }) {
178
178
  });
179
179
  }
180
180
  // src/views/instances/detail/submitted-by.ts
181
- function wt({ initiatorMemberId: e, submittedByMemberId: t }) {
181
+ function Ot({ initiatorMemberId: e, submittedByMemberId: t }) {
182
182
  return t && t !== e ? t : null;
183
183
  }
184
- function Tt(e, t) {
185
- let n = wt(e);
184
+ function kt(e, t) {
185
+ let n = Ot(e);
186
186
  if (!n || !e.initiatorMemberId) return null;
187
187
  let r = (e) => t.get(e)?.name ?? e;
188
188
  return `由 ${r(n)} 代 ${r(e.initiatorMemberId)} 送出`;
189
189
  }
190
190
  // src/views/instances/detail/sections/shared.ts
191
- function Et(e) {
192
- let t = H(e, "from"), n = H(e, "to"), r = H(e, "reason");
191
+ function At(e) {
192
+ let t = V(e, "from"), n = V(e, "to"), r = V(e, "reason");
193
193
  return !t || !n || !r ? null : {
194
194
  from: t,
195
195
  reason: r,
196
- ruleId: H(e, "ruleId"),
196
+ ruleId: V(e, "ruleId"),
197
197
  to: n
198
198
  };
199
199
  }
200
- function Dt(e) {
200
+ function jt(e) {
201
201
  try {
202
202
  let t = JSON.parse(e);
203
- return Array.isArray(t) ? t.map((e) => kt(e) ? Et(e) : null).filter((e) => e !== null) : [];
203
+ return Array.isArray(t) ? t.map((e) => W(e) ? At(e) : null).filter((e) => e !== null) : [];
204
204
  } catch {
205
205
  return [];
206
206
  }
207
207
  }
208
- function H(e, t) {
208
+ function V(e, t) {
209
209
  let n = e[t];
210
210
  return typeof n == "string" ? n : null;
211
211
  }
212
- function Ot(e, t) {
212
+ function H(e, t) {
213
213
  let n = e[t];
214
214
  return Array.isArray(n) ? n.filter((e) => typeof e == "string") : [];
215
215
  }
216
- function U(e, t) {
216
+ function Mt(e, t) {
217
217
  let n = e[t];
218
218
  return typeof n == "number" ? n : null;
219
219
  }
220
- function W(e) {
220
+ function U(e) {
221
221
  return typeof e == "string" && e.trim().length > 0;
222
222
  }
223
- function kt(e) {
223
+ function W(e) {
224
224
  return typeof e == "object" && !!e;
225
225
  }
226
- function At(e) {
226
+ function Nt(e) {
227
227
  return e.status === "PENDING" || e.status === "IN_PROGRESS";
228
228
  }
229
- function jt(e) {
229
+ function G(e) {
230
230
  return !Number.isFinite(e) || e <= 0 ? "-" : e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1024 / 1024).toFixed(1)} MB`;
231
231
  }
232
- function G(e) {
232
+ function K(e) {
233
233
  return e.length > 16 ? `${e.slice(0, 12)}...` : e;
234
234
  }
235
- function Mt(e) {
235
+ function Pt(e) {
236
236
  return e === "APPROVED" ? "已同意" : e === "CANCELLED" ? "已取消" : e === "DRAFT" ? "草稿" : e === "EXPIRED" ? "已逾期" : e === "REJECTED" ? "已拒絕" : e === "RETURNED" ? "已退回" : e === "RUNNING" ? "進行中" : e;
237
237
  }
238
- function K(e) {
238
+ function Ft(e) {
239
239
  return e === "PENDING" ? "待處理" : e === "IN_PROGRESS" ? "處理中" : e === "COMPLETED" ? "已完成" : e === "CANCELLED" ? "已取消" : e === "TRANSFERRED" ? "已轉派" : e;
240
240
  }
241
- function Nt(e) {
241
+ function It(e) {
242
242
  return e === "APPROVED" ? "同意" : e === "REJECTED" ? "拒絕" : e === "RETURNED" ? "退回" : e === "TRANSFERRED" ? "轉派" : e;
243
243
  }
244
- function Pt(e) {
244
+ function Lt(e) {
245
245
  return e === "startEvent" ? "開始" : e === "endEvent" ? "完成" : e === "userTask" ? "簽核節點" : e === "serviceTask" ? "知會節點" : e === "exclusiveGateway" ? "條件分流" : "平行處理";
246
246
  }
247
- function Ft(e, t) {
247
+ function Rt(e, t) {
248
248
  return t?.nodes.find((t) => t.id === e)?.data.label ?? e;
249
249
  }
250
- function It(e, t) {
250
+ function zt(e, t) {
251
251
  return e.name.trim() ? e.name : t;
252
252
  }
253
253
  function q(e, t) {
254
254
  if (!e) return "-";
255
255
  let n = t.get(e);
256
- return n ? p(It(n, e), n.email, "fullwidth") : e;
256
+ return n ? p(zt(n, e), n.email, "fullwidth") : e;
257
257
  }
258
- function Lt(e) {
259
- return !!e.assigneeMemberId && !!e.originalAssigneeMemberId && e.originalAssigneeMemberId !== e.assigneeMemberId && Dt(e.delegationChainJson).length > 0;
258
+ function Bt(e) {
259
+ return !!e.assigneeMemberId && !!e.originalAssigneeMemberId && e.originalAssigneeMemberId !== e.assigneeMemberId && jt(e.delegationChainJson).length > 0;
260
260
  }
261
- function Rt(e, t = /* @__PURE__ */ new Map()) {
261
+ function Vt(e, t = /* @__PURE__ */ new Map()) {
262
262
  if (!e.assigneeMemberId) return e.candidateMemberIds.length ? `候選 ${e.candidateMemberIds.map((e) => q(e, t)).join("、")}` : "未指定";
263
263
  let n = q(e.assigneeMemberId, t);
264
- return Lt(e) ? `${n}(原:${q(e.originalAssigneeMemberId, t)})` : n;
264
+ return Bt(e) ? `${n}(原:${q(e.originalAssigneeMemberId, t)})` : n;
265
265
  }
266
- function zt(e, t) {
266
+ function J(e, t) {
267
267
  return t ? e.assigneeMemberId === t || (e.openCandidateMemberIds ?? e.candidateMemberIds).includes(t) : !1;
268
268
  }
269
- function Bt(e, t) {
270
- let n = e.filter((e) => zt(e, t) && (e.status === "PENDING" || e.status === "IN_PROGRESS"));
269
+ function Ht(e, t) {
270
+ let n = e.filter((e) => J(e, t) && (e.status === "PENDING" || e.status === "IN_PROGRESS"));
271
271
  return n.find((e) => !e.isAdhoc) ?? n[0] ?? null;
272
272
  }
273
- function J(e, t) {
273
+ function Ut(e, t) {
274
274
  if (t.type !== "userTask" || !t.data.returnBehavior.allowReturn) return [];
275
275
  if (t.data.returnBehavior.allowedTargets === "ANY") {
276
- let n = ht(e, t.id);
276
+ let n = _t(e, t.id);
277
277
  return e.nodes.filter((e) => n.includes(e.id)).map((e) => ({
278
278
  id: e.id,
279
- name: `${e.data.label}(${Pt(e.type)})`
279
+ name: `${e.data.label}(${Lt(e.type)})`
280
280
  }));
281
281
  }
282
282
  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);
283
283
  return r ? [{
284
284
  id: r.id,
285
- name: `${r.data.label}(${Pt(r.type)})`
285
+ name: `${r.data.label}(${Lt(r.type)})`
286
286
  }] : [];
287
287
  }
288
- function Vt(e) {
288
+ function Wt(e) {
289
289
  return {
290
290
  email: e.email,
291
291
  id: e.memberId,
292
292
  name: p(e.name, e.email, "dot")
293
293
  };
294
294
  }
295
- function Ht({ memberIds: e, useWebhookTarget: t, webhookUrl: n }) {
295
+ function Gt({ memberIds: e, useWebhookTarget: t, webhookUrl: n }) {
296
296
  if (t) {
297
297
  let e = n.trim();
298
298
  return e ? {
@@ -317,11 +317,11 @@ function Ht({ memberIds: e, useWebhookTarget: t, webhookUrl: n }) {
317
317
  valid: !1
318
318
  };
319
319
  }
320
- function Ut(e) {
320
+ function Kt(e) {
321
321
  return !!e;
322
322
  }
323
- function Wt(e) {
324
- if (!kt(e)) return null;
323
+ function qt(e) {
324
+ if (!W(e)) return null;
325
325
  let t = e.email, n = e.id, r = e.name;
326
326
  return typeof n == "string" && typeof r == "string" ? {
327
327
  email: typeof t == "string" ? t : null,
@@ -329,7 +329,7 @@ function Wt(e) {
329
329
  name: r
330
330
  } : null;
331
331
  }
332
- function Gt(e, t) {
332
+ function Jt(e, t) {
333
333
  let n = e.trim().toLocaleLowerCase();
334
334
  if (!n) return null;
335
335
  let r = t.filter((e) => [
@@ -340,78 +340,78 @@ function Gt(e, t) {
340
340
  return r.length === 1 ? r[0] ?? null : null;
341
341
  }
342
342
  function Y(e) {
343
- return W(e) ? {
343
+ return U(e) ? {
344
344
  text: e,
345
345
  type: "text"
346
346
  } : null;
347
347
  }
348
- function Kt(e, t, n = "neutral") {
349
- return W(t) ? {
348
+ function Yt(e, t, n = "neutral") {
349
+ return U(t) ? {
350
350
  label: e,
351
351
  text: t,
352
352
  tone: n,
353
353
  type: "comment"
354
354
  } : null;
355
355
  }
356
- function qt(e, t, n, r) {
356
+ function X(e, t, n, r) {
357
357
  let i = t ? n.get(t) : null;
358
358
  return {
359
359
  email: i?.email ?? null,
360
- label: i ? It(i, r) : r,
360
+ label: i ? zt(i, r) : r,
361
361
  memberId: t,
362
362
  prefix: e,
363
363
  type: "member"
364
364
  };
365
365
  }
366
- function X(e, t) {
366
+ function Z(e, t) {
367
367
  let n = e.originalAssigneeMemberId;
368
- return !n || !Lt(e) ? null : qt("原簽核人", n, t, n);
368
+ return !n || !Bt(e) ? null : X("原簽核人", n, t, n);
369
369
  }
370
- function Z(e) {
370
+ function Q(e) {
371
371
  return !!e;
372
372
  }
373
- function Q(e) {
373
+ function Xt(e) {
374
374
  let t = e.findIndex((e) => e.id.startsWith("pending-task-") || e.id.startsWith("future-node-"));
375
375
  return t === -1 ? e.length : t;
376
376
  }
377
- function Jt(e) {
378
- return e.eventType === "INSTANCE_STARTED" || e.eventType === "INSTANCE_CANCELLED" || e.eventType === "INSTANCE_EXPIRED" || e.eventType === "INSTANCE_RESUBMITTED" || e.eventType === "TASK_DECIDED" || e.eventType === "SLA_TRIGGERED" || e.eventType === "TASK_CANDIDATE_ACTIVATED" || e.eventType === "TASK_REASSIGNED" || Yt(e) || Qt(e.eventType, nn(e));
377
+ function Zt(e) {
378
+ return e.eventType === "INSTANCE_STARTED" || e.eventType === "INSTANCE_CANCELLED" || e.eventType === "INSTANCE_EXPIRED" || e.eventType === "INSTANCE_RESUBMITTED" || e.eventType === "TASK_DECIDED" || e.eventType === "SLA_TRIGGERED" || e.eventType === "TASK_CANDIDATE_ACTIVATED" || e.eventType === "TASK_REASSIGNED" || Qt(e) || tn(e.eventType, on(e));
379
379
  }
380
- function Yt(e) {
381
- return e.eventType === "TASK_CREATED" && Ot(nn(e), "sequentialCandidateMemberIds").length > 0;
380
+ function Qt(e) {
381
+ return e.eventType === "TASK_CREATED" && H(on(e), "sequentialCandidateMemberIds").length > 0;
382
382
  }
383
- function Xt(e) {
383
+ function $t(e) {
384
384
  if (e.eventType === "TASK_REASSIGNED") {
385
- let t = nn(e);
385
+ let t = on(e);
386
386
  return [
387
- H(t, "fromMemberId"),
388
- H(t, "toMemberId"),
389
- H(t, "actorMemberId")
390
- ].filter(W);
387
+ V(t, "fromMemberId"),
388
+ V(t, "toMemberId"),
389
+ V(t, "actorMemberId")
390
+ ].filter(U);
391
391
  }
392
392
  if (e.eventType !== "TASK_CANDIDATE_ACTIVATED" && e.eventType !== "TASK_CREATED") return [];
393
- let t = nn(e);
393
+ let t = on(e);
394
394
  return [
395
- ...Ot(t, "sequentialCandidateMemberIds"),
396
- H(t, "candidateMemberId"),
397
- H(t, "previousMemberId")
398
- ].filter(W);
395
+ ...H(t, "sequentialCandidateMemberIds"),
396
+ V(t, "candidateMemberId"),
397
+ V(t, "previousMemberId")
398
+ ].filter(U);
399
399
  }
400
- var Zt = /* @__PURE__ */ new Set([
400
+ var en = /* @__PURE__ */ new Set([
401
401
  "SERVICE_TASK_EXECUTED",
402
402
  "SERVICE_TASK_FAILED",
403
403
  "WEBHOOK_DELIVERY_RETRIED"
404
404
  ]);
405
- function Qt(e, t) {
406
- return Zt.has(e) && H(t, "action") === "NOTIFY_WEBHOOK";
405
+ function tn(e, t) {
406
+ return en.has(e) && V(t, "action") === "NOTIFY_WEBHOOK";
407
407
  }
408
- function $t(e) {
409
- return H(e, "endpointLabel") ?? H(e, "endpointKey") ?? "外部系統";
408
+ function nn(e) {
409
+ return V(e, "endpointLabel") ?? V(e, "endpointKey") ?? "外部系統";
410
410
  }
411
- function en(e) {
411
+ function rn(e) {
412
412
  return e === "APPROVED" ? "已同意" : e === "REJECTED" ? "已拒絕" : e === "RETURNED" ? "已退回" : e === "TRANSFERRED" ? "已轉派" : "簽核已決議";
413
413
  }
414
- function tn(e, t) {
414
+ function an(e, t) {
415
415
  if (e === "INSTANCE_STARTED") return "案件已發起";
416
416
  if (e === "INSTANCE_CANCELLED") return "案件已取消";
417
417
  if (e === "INSTANCE_EXPIRED") return "案件逾期,已由系統終止";
@@ -421,107 +421,107 @@ function tn(e, t) {
421
421
  if (e === "TOKEN_ADVANCED") return "流程已前進";
422
422
  if (e === "TASK_CREATED") return "待簽任務已建立";
423
423
  if (e === "TASK_CANDIDATE_ACTIVATED") return "輪到下一位簽核";
424
- if (e === "TASK_DECIDED") return en(H(t, "action"));
424
+ if (e === "TASK_DECIDED") return rn(V(t, "action"));
425
425
  if (e === "SLA_TRIGGERED") return "時限提醒已觸發";
426
426
  if (e === "TASK_REASSIGNED") return "管理者改派待辦";
427
- if (Qt(e, t)) {
428
- let n = $t(t);
427
+ if (tn(e, t)) {
428
+ let n = nn(t);
429
429
  return e === "SERVICE_TASK_EXECUTED" ? `已通知外部系統:${n}` : e === "SERVICE_TASK_FAILED" ? `通知外部系統失敗:${n}` : `管理者重新傳送外部系統通知:${n}`;
430
430
  }
431
431
  return e;
432
432
  }
433
- function nn(e) {
433
+ function on(e) {
434
434
  try {
435
435
  let t = JSON.parse(e.payloadJson);
436
- return kt(t) ? t : {};
436
+ return W(t) ? t : {};
437
437
  } catch {
438
438
  return {};
439
439
  }
440
440
  }
441
- function rn(e, t) {
442
- return e.eventType === "SLA_TRIGGERED" || e.eventType === "INSTANCE_EXPIRED" || e.eventType === "SERVICE_TASK_FAILED" && Qt(e.eventType, t) || H(t, "action") === "REJECTED" || H(t, "instanceState") === "REJECTED";
441
+ function sn(e, t) {
442
+ return e.eventType === "SLA_TRIGGERED" || e.eventType === "INSTANCE_EXPIRED" || e.eventType === "SERVICE_TASK_FAILED" && tn(e.eventType, t) || V(t, "action") === "REJECTED" || V(t, "instanceState") === "REJECTED";
443
443
  }
444
- function an(e) {
444
+ function cn(e) {
445
445
  return t(e);
446
446
  }
447
- function on(e, t) {
448
- let n = H(e, "fromMemberId"), r = H(e, "toMemberId"), i = H(e, "reason"), a = e.assigneeChanged === !1 ? "原座位" : "原簽核人", o = i?.trim();
449
- return [[n ? `${a}:${q(n, t)}` : null, r ? `改派給:${q(r, t)}` : null].filter(W).join(" → "), o ? `原因:${o}` : null].filter(W).join(" · ") || null;
447
+ function ln(e, t) {
448
+ let n = V(e, "fromMemberId"), r = V(e, "toMemberId"), i = V(e, "reason"), a = e.assigneeChanged === !1 ? "原座位" : "原簽核人", o = i?.trim();
449
+ return [[n ? `${a}:${q(n, t)}` : null, r ? `改派給:${q(r, t)}` : null].filter(U).join(" → "), o ? `原因:${o}` : null].filter(U).join(" · ") || null;
450
450
  }
451
- function sn(e, t, n, r) {
452
- if (e.eventType === "INSTANCE_STARTED") return Tt({
451
+ function un(e, t, n, r) {
452
+ if (e.eventType === "INSTANCE_STARTED") return kt({
453
453
  initiatorMemberId: e.actorMemberId,
454
- submittedByMemberId: H(t, "submittedByMemberId")
454
+ submittedByMemberId: V(t, "submittedByMemberId")
455
455
  }, r);
456
- if (e.eventType === "TASK_REASSIGNED") return on(t, r);
456
+ if (e.eventType === "TASK_REASSIGNED") return ln(t, r);
457
457
  if (e.eventType === "TASK_CANDIDATE_ACTIVATED") {
458
- let e = H(t, "candidateMemberId"), n = H(t, "previousMemberId");
458
+ let e = V(t, "candidateMemberId"), n = V(t, "previousMemberId");
459
459
  if (!e) return null;
460
460
  let i = q(e, r);
461
461
  return n ? `輪到:${i}(前一位:${q(n, r)})` : `輪到:${i}`;
462
462
  }
463
463
  if (e.eventType === "TASK_CREATED") {
464
- let e = Ot(t, "sequentialCandidateMemberIds");
464
+ let e = H(t, "sequentialCandidateMemberIds");
465
465
  if (e.length) return `簽核順序:${e.map((e) => q(e, r)).join(" → ")}`;
466
- let n = H(t, "assigneeMemberId"), i = H(t, "originalAssigneeMemberId");
466
+ let n = V(t, "assigneeMemberId"), i = V(t, "originalAssigneeMemberId");
467
467
  if (!n) {
468
- let e = Ot(t, "candidateMemberIds");
468
+ let e = H(t, "candidateMemberIds");
469
469
  return e.length ? `候選簽核人:${e.map((e) => q(e, r)).join("、")}` : null;
470
470
  }
471
471
  let a = q(n, r), o = q(i, r);
472
472
  return i && i !== n ? `待簽人:${a}(原簽核人:${o})` : `待簽人:${a}`;
473
473
  }
474
474
  if (e.eventType === "TASK_DECIDED") {
475
- let e = H(t, "action"), n = H(t, "comment"), i = e ? `決議:${Nt(e)}` : null, a = H(t, "transferToMemberId");
476
- return e === "REJECTED" && n ? [i, `拒絕原因:${n}`].filter(W).join(" · ") : e === "APPROVED" && n ? [i, `同意說明:${n}`].filter(W).join(" · ") : e === "TRANSFERRED" ? [i, `轉派給:${q(a, r)}`].filter(W).join(" · ") : i;
475
+ let e = V(t, "action"), n = V(t, "comment"), i = e ? `決議:${It(e)}` : null, a = V(t, "transferToMemberId");
476
+ return e === "REJECTED" && n ? [i, `拒絕原因:${n}`].filter(U).join(" · ") : e === "APPROVED" && n ? [i, `同意說明:${n}`].filter(U).join(" · ") : e === "TRANSFERRED" ? [i, `轉派給:${q(a, r)}`].filter(U).join(" · ") : i;
477
477
  }
478
478
  if (e.eventType === "TOKEN_ADVANCED") {
479
- let e = H(t, "action");
480
- if (e) return `流程結果:${Nt(e)}`;
481
- let r = U(t, "arrivedCount"), i = U(t, "requiredCount");
479
+ let e = V(t, "action");
480
+ if (e) return `流程結果:${It(e)}`;
481
+ let r = Mt(t, "arrivedCount"), i = Mt(t, "requiredCount");
482
482
  if (r !== null && i !== null) return `等待匯合:${r}/${i}`;
483
- let a = H(t, "fromNodeId"), o = H(t, "toNodeId");
484
- if (a && o) return `由 ${Ft(a, n)} 前進至 ${Ft(o, n)}`;
483
+ let a = V(t, "fromNodeId"), o = V(t, "toNodeId");
484
+ if (a && o) return `由 ${Rt(a, n)} 前進至 ${Rt(o, n)}`;
485
485
  }
486
486
  if (e.eventType === "ENGINE_PROCESS_REQUESTED") {
487
- let e = H(t, "state");
488
- return e ? `案件狀態:${Mt(e)}` : null;
487
+ let e = V(t, "state");
488
+ return e ? `案件狀態:${Pt(e)}` : null;
489
489
  }
490
490
  return null;
491
491
  }
492
- function cn(e, t, n, r, i, a, o, s = null, c = null) {
493
- if (e.eventType === "INSTANCE_RESUBMITTED") return [Kt("簽核意見", H(t, "comment"))].filter(Z);
494
- if (e.eventType !== "TASK_DECIDED") return [Y(sn(e, t, n, o))].filter(Z);
495
- let l = ln(e, t, r, c), u = H(t, "action") ?? l?.action ?? null, d = H(t, "comment") ?? l?.comment ?? null, f = H(t, "transferToMemberId") ?? l?.transferToMemberId ?? null, p = H(t, "signatureId") ?? l?.signatureId ?? null, m = p ? i.get(p) : null;
492
+ function dn(e, t, n, r, i, a, o, s = null, c = null) {
493
+ if (e.eventType === "INSTANCE_RESUBMITTED") return [Yt("簽核意見", V(t, "comment"))].filter(Q);
494
+ if (e.eventType !== "TASK_DECIDED") return [Y(un(e, t, n, o))].filter(Q);
495
+ let l = fn(e, t, r, c), u = V(t, "action") ?? l?.action ?? null, d = V(t, "comment") ?? l?.comment ?? null, f = V(t, "transferToMemberId") ?? l?.transferToMemberId ?? null, p = V(t, "signatureId") ?? l?.signatureId ?? null, m = p ? i.get(p) : null;
496
496
  return [
497
- Y(u ? `決議:${Nt(u)}` : null),
498
- u === "REJECTED" ? Kt("拒絕原因", d ?? "-", "danger") : null,
499
- u === "APPROVED" ? Kt("同意說明", d) : null,
500
- u === "RETURNED" ? Kt("退回說明", d ?? "-") : null,
497
+ Y(u ? `決議:${It(u)}` : null),
498
+ u === "REJECTED" ? Yt("拒絕原因", d ?? "-", "danger") : null,
499
+ u === "APPROVED" ? Yt("同意說明", d) : null,
500
+ u === "RETURNED" ? Yt("退回說明", d ?? "-") : null,
501
501
  u === "TRANSFERRED" ? Y(`轉派給:${q(f, o)}`) : null,
502
- u === "TRANSFERRED" ? Kt("轉派說明", d ?? "-") : null,
503
- Y(dn(t, s)),
504
- m ? Y(a?.valid ? `簽章:已驗證(${G(m.signedPayloadHash)})` : `簽章:待檢查(${G(m.signedPayloadHash)})`) : null
505
- ].filter(Z);
502
+ u === "TRANSFERRED" ? Yt("轉派說明", d ?? "-") : null,
503
+ Y(mn(t, s)),
504
+ m ? Y(a?.valid ? `簽章:已驗證(${K(m.signedPayloadHash)})` : `簽章:待檢查(${K(m.signedPayloadHash)})`) : null
505
+ ].filter(Q);
506
506
  }
507
- function ln(e, t, n, r) {
507
+ function fn(e, t, n, r) {
508
508
  let i = e.taskId;
509
509
  if (!i) return null;
510
- let a = H(t, "decisionId"), o = (t) => a ? t.id === a : t.decidedByMemberId === e.actorMemberId;
510
+ let a = V(t, "decisionId"), o = (t) => a ? t.id === a : t.decidedByMemberId === e.actorMemberId;
511
511
  if (!r) {
512
512
  let e = n.get(i) ?? null;
513
513
  return e && o(e) ? e : null;
514
514
  }
515
- return un(r.filter((e) => e.taskId === i && o(e)), new Date(e.createdAt).getTime());
515
+ return pn(r.filter((e) => e.taskId === i && o(e)), new Date(e.createdAt).getTime());
516
516
  }
517
- function un(e, t) {
517
+ function pn(e, t) {
518
518
  let n = (e) => Math.abs(d(e) - t), r = (e, t) => {
519
519
  let r = n(e) - n(t);
520
520
  return r < 0 || !(r > 0) && f(e, t) < 0;
521
521
  };
522
522
  return e.reduce((e, t) => !e || r(t, e) ? t : e, null);
523
523
  }
524
- function dn(e, t) {
524
+ function mn(e, t) {
525
525
  let n = e.changedFieldKeys;
526
526
  if (!Array.isArray(n)) return null;
527
527
  let r = n.filter((e) => typeof e == "string" && e !== "");
@@ -529,87 +529,87 @@ function dn(e, t) {
529
529
  let i = r.map((e) => t?.fields.find((t) => t.fieldKey === e)?.label || e);
530
530
  return `補填 ${r.length} 個欄位:${i.join("、")}`;
531
531
  }
532
- function fn(e, t, n, r, i) {
532
+ function hn(e, t, n, r, i) {
533
533
  if (e.type === "startEvent" || i.has(e.id)) return !1;
534
534
  if (r === "REJECTED") return !0;
535
- let a = xn(e, t, n, r);
535
+ let a = wn(e, t, n, r);
536
536
  return a.tone === "neutral" || a.tone === "waiting";
537
537
  }
538
- function pn(e, t, n, r, i) {
538
+ function gn(e, t, n, r, i) {
539
539
  if (r !== "RUNNING" && r !== "REJECTED") return [];
540
- let a = e.nodes.filter((e) => fn(e, t, n, r, i)), o = mn(e, a, t, n, i), s = new Map(e.nodes.map((e, t) => [e.id, t]));
540
+ let a = e.nodes.filter((e) => hn(e, t, n, r, i)), o = _n(e, a, t, n, i), s = new Map(e.nodes.map((e, t) => [e.id, t]));
541
541
  return a.filter((e) => o.has(e.id)).sort((e, t) => {
542
542
  let n = o.get(e.id) ?? 0, r = o.get(t.id) ?? 0;
543
543
  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;
544
544
  });
545
545
  }
546
- function mn(e, t, n, r, i) {
546
+ function _n(e, t, n, r, i) {
547
547
  let a = new Set(t.map((e) => e.id)), o = e.edges.reduce((e, t) => {
548
548
  let n = [...e.get(t.source) ?? [], t.target];
549
549
  return new Map(e).set(t.source, n);
550
550
  }, /* @__PURE__ */ new Map());
551
- return hn(e, n, r, i).reduce((e, t) => vn(e, gn(t, o, a)), /* @__PURE__ */ new Map());
551
+ return vn(e, n, r, i).reduce((e, t) => xn(e, yn(t, o, a)), /* @__PURE__ */ new Map());
552
552
  }
553
- function hn(e, t, n, r) {
554
- let i = n.filter((e) => e.status === "ACTIVE" || e.status === "WAITING").map((e) => e.currentNodeId), a = t.filter(At).map((e) => e.nodeId), o = e.nodes.filter((e) => r.has(e.id)).map((e) => e.id), s = [.../* @__PURE__ */ new Set([
553
+ function vn(e, t, n, r) {
554
+ 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([
555
555
  ...i,
556
556
  ...a,
557
557
  ...o
558
558
  ])], c = e.nodes.filter((e) => e.type === "startEvent").map((e) => e.id);
559
559
  return s.length > 0 ? s : c;
560
560
  }
561
- function gn(e, t, n) {
562
- return _n([{
561
+ function yn(e, t, n) {
562
+ return bn([{
563
563
  distance: 0,
564
564
  nodeId: e
565
565
  }], t, n);
566
566
  }
567
- function _n(e, t, n, r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map()) {
567
+ function bn(e, t, n, r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map()) {
568
568
  let [a, ...o] = e;
569
569
  if (!a) return i;
570
- if (r.has(a.nodeId)) return _n(o, t, n, r, i);
570
+ if (r.has(a.nodeId)) return bn(o, t, n, r, i);
571
571
  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;
572
- return _n([...o, ...(t.get(a.nodeId) ?? []).map((e) => ({
572
+ return bn([...o, ...(t.get(a.nodeId) ?? []).map((e) => ({
573
573
  distance: a.distance + 1,
574
574
  nodeId: e
575
575
  }))], t, n, s, c);
576
576
  }
577
- function vn(e, t) {
577
+ function xn(e, t) {
578
578
  return [...t.entries()].reduce((e, [t, n]) => new Map(e).set(t, Math.min(e.get(t) ?? n, n)), e);
579
579
  }
580
- function yn(e) {
580
+ function Sn(e) {
581
581
  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}`;
582
582
  }
583
583
  function $(e, t, n, r, i, a, o, s, c, u = null, d = null) {
584
- let f = d ? l(d) : null, p = e.filter(Jt).map((e) => {
585
- let t = nn(e), n = e.nodeId ? Ft(e.nodeId, r) : null;
584
+ let f = d ? l(d) : null, p = e.filter(Zt).map((e) => {
585
+ let t = on(e), n = e.nodeId ? Rt(e.nodeId, r) : null;
586
586
  return {
587
587
  descriptionParts: [
588
588
  Y(n ? `節點:${n}` : "節點:全流程"),
589
- qt("操作者", e.actorMemberId, a, "系統"),
590
- Y(`時間:${an(e.createdAt)}`),
591
- ...cn(e, t, r, o, s, c, a, u, f ? f.get(e.taskId ?? "") ?? [] : null)
592
- ].filter(Z),
593
- error: rn(e, t),
589
+ X("操作者", e.actorMemberId, a, "系統"),
590
+ Y(`時間:${cn(e.createdAt)}`),
591
+ ...dn(e, t, r, o, s, c, a, u, f ? f.get(e.taskId ?? "") ?? [] : null)
592
+ ].filter(Q),
593
+ error: sn(e, t),
594
594
  id: e.id,
595
- title: tn(e.eventType, t)
595
+ title: an(e.eventType, t)
596
596
  };
597
- }), m = t.filter(At).map((e) => ({
597
+ }), m = t.filter(Nt).map((e) => ({
598
598
  descriptionParts: [
599
- Y(`節點:${Ft(e.nodeId, r)}`),
600
- qt("處理者", e.assigneeMemberId, a, "未指定"),
601
- X(e, a),
602
- Y(`建立時間:${an(e.createdAt)}`)
603
- ].filter(Z),
599
+ Y(`節點:${Rt(e.nodeId, r)}`),
600
+ X("處理者", e.assigneeMemberId, a, "未指定"),
601
+ Z(e, a),
602
+ Y(`建立時間:${cn(e.createdAt)}`)
603
+ ].filter(Q),
604
604
  error: !1,
605
605
  id: `pending-task-${e.id}`,
606
606
  title: e.status === "IN_PROGRESS" ? "簽核處理中" : "等待簽核處理"
607
- })), h = new Set([...e.filter(Jt).map((e) => e.nodeId), ...t.map((e) => e.nodeId)].filter(W)), g = r ? pn(r, t, n, i, h).map((e) => ({
608
- descriptionParts: [Y(`${Pt(e.type)} · 尚未抵達`)].filter(Z),
607
+ })), h = new Set([...e.filter(Zt).map((e) => e.nodeId), ...t.map((e) => e.nodeId)].filter(U)), g = r ? gn(r, t, n, i, h).map((e) => ({
608
+ descriptionParts: [Y(`${Lt(e.type)} · 尚未抵達`)].filter(Q),
609
609
  error: !1,
610
610
  forcePending: !0,
611
611
  id: `future-node-${e.id}`,
612
- title: yn(e)
612
+ title: Sn(e)
613
613
  })) : [];
614
614
  return [
615
615
  ...p,
@@ -617,7 +617,7 @@ function $(e, t, n, r, i, a, o, s, c, u = null, d = null) {
617
617
  ...g
618
618
  ];
619
619
  }
620
- var bn = {
620
+ var Cn = {
621
621
  APPROVED: {
622
622
  statusLabel: "已完成",
623
623
  tone: "completed"
@@ -635,20 +635,20 @@ var bn = {
635
635
  tone: "cancelled"
636
636
  }
637
637
  };
638
- function xn(e, t, n, r) {
638
+ function wn(e, t, n, r) {
639
639
  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");
640
640
  if (a) return {
641
- secondaryLabel: `處理者 ${Rt(a)}`,
641
+ secondaryLabel: `處理者 ${Vt(a)}`,
642
642
  statusLabel: "待處理",
643
643
  tone: "current"
644
644
  };
645
645
  if (o) return {
646
- secondaryLabel: `已取消 ${Rt(o)}`,
646
+ secondaryLabel: `已取消 ${Vt(o)}`,
647
647
  statusLabel: "已取消",
648
648
  tone: "cancelled"
649
649
  };
650
650
  if (s) return {
651
- secondaryLabel: `已完成 ${Rt(s)}`,
651
+ secondaryLabel: `已完成 ${Vt(s)}`,
652
652
  statusLabel: "已完成",
653
653
  tone: "completed"
654
654
  };
@@ -667,56 +667,56 @@ function xn(e, t, n, r) {
667
667
  statusLabel: "已發起",
668
668
  tone: "completed"
669
669
  };
670
- let d = e.type === "endEvent" ? bn[r] : void 0;
670
+ let d = e.type === "endEvent" ? Cn[r] : void 0;
671
671
  return d ? {
672
672
  ...d,
673
673
  secondaryLabel: r
674
674
  } : {
675
- secondaryLabel: Pt(e.type),
675
+ secondaryLabel: Lt(e.type),
676
676
  statusLabel: "未抵達",
677
677
  tone: "neutral"
678
678
  };
679
679
  }
680
680
  // src/views/instances/detail/sections/container-helpers.ts
681
- async function Sn({ activityLogs: e, adhocDirectives: t = [], instance: n, tasks: r }) {
681
+ async function Tn({ activityLogs: e, adhocDirectives: t = [], instance: n, tasks: r }) {
682
682
  let i = [...new Set([
683
683
  n?.initiatorMemberId ?? null,
684
684
  n?.submittedByMemberId ?? null,
685
685
  ...e.map((e) => e.actorMemberId),
686
- ...e.flatMap(Xt),
686
+ ...e.flatMap($t),
687
687
  ...r.map((e) => e.assigneeMemberId),
688
688
  ...r.map((e) => e.originalAssigneeMemberId),
689
689
  ...r.flatMap((e) => e.candidateMemberIds),
690
- ...r.flatMap((e) => Dt(e.delegationChainJson).flatMap((e) => [e.from, e.to])),
691
- ...t.flatMap((e) => [e.createdByMemberId, ...Cn(e.targetValueJson)])
692
- ].filter(W))];
690
+ ...r.flatMap((e) => jt(e.delegationChainJson).flatMap((e) => [e.from, e.to])),
691
+ ...t.flatMap((e) => [e.createdByMemberId, ...En(e.targetValueJson)])
692
+ ].filter(U))];
693
693
  try {
694
- return await Be(i);
694
+ return await Ve(i);
695
695
  } catch {
696
696
  return [];
697
697
  }
698
698
  }
699
- function Cn(e) {
699
+ function En(e) {
700
700
  try {
701
701
  return (JSON.parse(e).memberIds ?? []).filter((e) => typeof e == "string");
702
702
  } catch {
703
703
  return [];
704
704
  }
705
705
  }
706
- async function wn(e) {
707
- return (await Promise.all(e.map((e) => Me(e.id)))).flat();
706
+ async function Dn(e) {
707
+ return (await Promise.all(e.map((e) => Ne(e.id)))).flat();
708
708
  }
709
709
  // src/views/instances/detail/use-resubmit-comment-draft.ts
710
- function Tn(e) {
710
+ function On(e) {
711
711
  let [t, n] = x({
712
712
  instanceId: e,
713
713
  text: ""
714
- }), r = ce((t) => n({
714
+ }), r = ue((t) => n({
715
715
  instanceId: e,
716
716
  text: t
717
717
  }), [e]);
718
718
  return {
719
- clearAfterResubmit: ce((e) => n((t) => t.instanceId === e ? {
719
+ clearAfterResubmit: ue((e) => n((t) => t.instanceId === e ? {
720
720
  instanceId: e,
721
721
  text: ""
722
722
  } : t), []),
@@ -725,50 +725,50 @@ function Tn(e) {
725
725
  };
726
726
  }
727
727
  // src/views/instances/detail/sections/InstanceFormSection.tsx
728
- var En = {
728
+ var kn = {
729
729
  display: "grid",
730
730
  gap: 16
731
- }, Dn = {
731
+ }, An = {
732
732
  display: "flex",
733
733
  flexWrap: "wrap",
734
734
  gap: 8
735
- }, On = 2e3, kn = {
735
+ }, jn = 2e3, Mn = {
736
736
  minWidth: "100%",
737
737
  width: "100%"
738
738
  };
739
- function An(e) {
739
+ function Nn(e) {
740
740
  e && (e.style.width = "100%");
741
741
  }
742
- function jn({ attachments: t, canResubmitInstance: n, deciding: r, error: i, fieldAccess: a, fieldLabelMarkers: o, fill: c = null, instance: l, loading: u, onDataSourceStateChange: d, onDownloadAttachment: f, onFileUploadStateChange: p, onResubmitFormChange: m, onReloadAfterConflict: h = null, onResubmitCommentChange: g = null, onResubmitInstance: ee, onUploadAttachment: te, resubmitComment: ne = "", resubmitFormData: re, resubmitFormErrors: ie }) {
743
- let oe = l?.formDefinitionSnapshot.schema, _ = l?.workflowSnapshot, v = b(() => n && oe && _ ? ae(oe, _) : c?.schema ?? oe, [
742
+ function Pn({ attachments: t, canResubmitInstance: n, deciding: r, error: i, fieldAccess: a, fieldLabelMarkers: o, fill: c = null, instance: l, loading: u, onDataSourceStateChange: d, onDownloadAttachment: f, onFileUploadStateChange: p, onResubmitFormChange: m, onReloadAfterConflict: h = null, onResubmitCommentChange: g = null, onResubmitInstance: ee, onUploadAttachment: te, resubmitComment: re = "", resubmitFormData: ie, resubmitFormErrors: ae }) {
743
+ let oe = l?.formDefinitionSnapshot.schema, _ = l?.workflowSnapshot, se = b(() => n && oe && _ ? ne(oe, _) : c?.schema ?? oe, [
744
744
  n,
745
745
  c?.schema,
746
746
  oe,
747
747
  _
748
- ]), se = !n && c !== null;
749
- return /* @__PURE__ */ k("div", {
750
- style: En,
748
+ ]), v = !n && c !== null;
749
+ return /* @__PURE__ */ j("div", {
750
+ style: kn,
751
751
  children: [
752
- i ? /* @__PURE__ */ O(E, {
752
+ i ? /* @__PURE__ */ A(O, {
753
753
  color: "text-error",
754
754
  variant: "body",
755
755
  children: i
756
756
  }) : null,
757
- u ? /* @__PURE__ */ O(E, {
757
+ u ? /* @__PURE__ */ A(O, {
758
758
  color: "text-neutral",
759
759
  variant: "body",
760
760
  children: "載入中..."
761
761
  }) : null,
762
- h ? /* @__PURE__ */ k("div", {
763
- style: En,
764
- children: [/* @__PURE__ */ O(he, {
762
+ h ? /* @__PURE__ */ j("div", {
763
+ style: kn,
764
+ children: [/* @__PURE__ */ A(_e, {
765
765
  content: "表單在你填寫期間被更新了,你填的內容還在。請重新載入後確認再同意。",
766
766
  severity: "error"
767
- }), /* @__PURE__ */ O("div", {
768
- style: Dn,
769
- children: /* @__PURE__ */ O(S, {
767
+ }), /* @__PURE__ */ A("div", {
768
+ style: An,
769
+ children: /* @__PURE__ */ A(S, {
770
770
  disabled: u,
771
- icon: it,
771
+ icon: I,
772
772
  iconType: "leading",
773
773
  onClick: h,
774
774
  variant: "base-secondary",
@@ -776,61 +776,62 @@ function jn({ attachments: t, canResubmitInstance: n, deciding: r, error: i, fie
776
776
  })
777
777
  })]
778
778
  }) : null,
779
- se && c.fieldCount > 0 ? /* @__PURE__ */ O(he, {
779
+ v && c.fieldCount > 0 ? /* @__PURE__ */ A(_e, {
780
780
  content: `本關需要你補填 ${c.fieldCount} 個欄位,按「同意」時會一起送出並納入簽章。`,
781
781
  severity: "info"
782
782
  }) : null,
783
- v && l?.formDefinitionSnapshot.uiSchema ? /* @__PURE__ */ k(D, { children: [
784
- /* @__PURE__ */ O(s, {
783
+ se && l?.formDefinitionSnapshot.uiSchema ? /* @__PURE__ */ j(k, { children: [
784
+ /* @__PURE__ */ A(s, {
785
785
  attachments: t,
786
- dataSourceContext: n ? {
786
+ dataSourceContext: n || v ? {
787
787
  instanceId: l.id,
788
788
  kind: "runtime"
789
789
  } : void 0,
790
790
  dataSourceInitialValues: l.formData,
791
- errors: se ? c.errors : ie,
791
+ errors: v ? c.errors : ae,
792
792
  ...!n && a ? { fieldAccess: a } : {},
793
793
  ...!n && o ? { fieldLabelMarkers: o } : {},
794
+ ...v && c.tableAccess ? { tableAccess: c.tableAccess } : {},
794
795
  onChange: (e) => {
795
- se ? c.onChange(e) : m(e);
796
+ v ? c.onChange(e) : m(e);
796
797
  },
797
798
  onDataSourceStateChange: d,
798
799
  onDownloadAttachment: f,
799
800
  onFileUploadStateChange: p,
800
801
  onUploadAttachment: n ? te : void 0,
801
802
  optionSnapshots: l.formDataOptionSnapshot,
802
- readonly: !n,
803
- schema: v,
803
+ readonly: !n && !v,
804
+ schema: se,
804
805
  uiSchema: l.formDefinitionSnapshot.uiSchema,
805
- value: n ? re : se ? c.value : l.formData
806
+ value: n ? ie : v ? c.value : l.formData
806
807
  }),
807
- n && g ? /* @__PURE__ */ O(e, {
808
+ n && g ? /* @__PURE__ */ A(e, {
808
809
  label: "簽核意見",
809
810
  name: "resubmitComment",
810
- children: /* @__PURE__ */ O(Ce, {
811
+ children: /* @__PURE__ */ A(Ce, {
811
812
  disabled: r,
812
813
  onChange: (e) => g(e.target.value),
813
814
  placeholder: "選填,例如說明這次補正或修改了哪些內容",
814
- maxLength: On,
815
- ref: An,
815
+ maxLength: jn,
816
+ ref: Nn,
816
817
  resize: "vertical",
817
818
  rows: 4,
818
- style: kn,
819
- value: ne
819
+ style: Mn,
820
+ value: re
820
821
  })
821
822
  }) : null,
822
- n ? /* @__PURE__ */ O("div", {
823
- style: Dn,
824
- children: /* @__PURE__ */ O(S, {
823
+ n ? /* @__PURE__ */ A("div", {
824
+ style: An,
825
+ children: /* @__PURE__ */ A(S, {
825
826
  disabled: r,
826
- icon: it,
827
+ icon: I,
827
828
  iconType: "leading",
828
829
  onClick: ee,
829
830
  variant: "base-primary",
830
831
  children: "重新送出"
831
832
  })
832
833
  }) : null
833
- ] }) : /* @__PURE__ */ O(E, {
834
+ ] }) : /* @__PURE__ */ A(O, {
834
835
  color: "text-neutral",
835
836
  variant: "body",
836
837
  children: "此案件沒有可顯示的表單快照。"
@@ -839,11 +840,11 @@ function jn({ attachments: t, canResubmitInstance: n, deciding: r, error: i, fie
839
840
  });
840
841
  }
841
842
  // src/views/instances/detail/sections/InstanceAttachmentsSection.tsx
842
- var Mn = {
843
+ var Fn = {
843
844
  display: "grid",
844
845
  gap: 16
845
846
  };
846
- function Nn({ attachments: e, onDownload: n, onPreview: r }) {
847
+ function In({ attachments: e, onDownload: n, onPreview: r }) {
847
848
  let i = b(() => e.map((e) => ({
848
849
  attachment: e,
849
850
  createdAt: e.createdAt,
@@ -851,7 +852,7 @@ function Nn({ attachments: e, onDownload: n, onPreview: r }) {
851
852
  id: e.id,
852
853
  key: e.id,
853
854
  mimeType: e.mimeType,
854
- sizeLabel: jt(Number(e.sizeBytes))
855
+ sizeLabel: G(Number(e.sizeBytes))
855
856
  })), [e]), a = b(() => [
856
857
  {
857
858
  dataIndex: "filename",
@@ -873,7 +874,7 @@ function Nn({ attachments: e, onDownload: n, onPreview: r }) {
873
874
  },
874
875
  {
875
876
  key: "createdAt",
876
- render: (e) => /* @__PURE__ */ O(E, {
877
+ render: (e) => /* @__PURE__ */ A(O, {
877
878
  component: "span",
878
879
  variant: "body",
879
880
  children: t(e.createdAt)
@@ -883,14 +884,14 @@ function Nn({ attachments: e, onDownload: n, onPreview: r }) {
883
884
  }
884
885
  ], []), o = b(() => ({
885
886
  render: (e) => [...e.mimeType === "application/pdf" ? [{
886
- icon: tt,
887
+ icon: nt,
887
888
  iconType: "leading",
888
889
  name: "預覽",
889
890
  onClick: () => {
890
891
  r(e.attachment);
891
892
  }
892
893
  }] : [], {
893
- icon: N,
894
+ icon: tt,
894
895
  iconType: "leading",
895
896
  name: "下載",
896
897
  onClick: () => {
@@ -900,18 +901,18 @@ function Nn({ attachments: e, onDownload: n, onPreview: r }) {
900
901
  variant: "base-secondary",
901
902
  width: 160
902
903
  }), [n, r]);
903
- return /* @__PURE__ */ k("div", {
904
- style: Mn,
905
- children: [/* @__PURE__ */ O(E, {
904
+ return /* @__PURE__ */ j("div", {
905
+ style: Fn,
906
+ children: [/* @__PURE__ */ A(O, {
906
907
  component: "h2",
907
908
  variant: "h3",
908
909
  children: "附件"
909
- }), i.length > 0 ? /* @__PURE__ */ O(Se, {
910
+ }), i.length > 0 ? /* @__PURE__ */ A(D, {
910
911
  actions: o,
911
912
  columns: a,
912
913
  dataSource: i,
913
914
  fullWidth: !0
914
- }) : /* @__PURE__ */ O(E, {
915
+ }) : /* @__PURE__ */ A(O, {
915
916
  color: "text-neutral",
916
917
  variant: "body",
917
918
  children: "此案件沒有附件。"
@@ -919,58 +920,58 @@ function Nn({ attachments: e, onDownload: n, onPreview: r }) {
919
920
  });
920
921
  }
921
922
  // src/views/instances/detail/sections/InstanceTasksSection.tsx
922
- var Pn = {
923
+ var Ln = {
923
924
  display: "grid",
924
925
  gap: 12,
925
926
  width: "100%"
926
- }, Fn = {
927
+ }, Rn = {
927
928
  minWidth: "100%",
928
929
  width: "100%"
929
- }, In = {
930
+ }, zn = {
930
931
  display: "grid",
931
932
  gap: 12,
932
933
  width: "100%"
933
- }, Ln = { marginTop: 12 }, Rn = { marginTop: 24 };
934
- function zn(e) {
934
+ }, Bn = { marginTop: 12 }, Vn = { marginTop: 24 };
935
+ function Hn(e) {
935
936
  e && (e.style.width = "100%");
936
937
  }
937
- var Bn = {
938
+ var Un = {
938
939
  COMPLETION_NOTIFY: "結案通知",
939
940
  COUNTERSIGN: "臨時會簽",
940
941
  PRE_APPROVAL: "臨時加簽",
941
942
  STAGE_NOTIFY: "階段完成通知"
942
- }, Vn = {
943
+ }, Wn = {
943
944
  COMPLETION_NOTIFY: "本張單到達結案狀態(核准 / 拒絕 / 取消)後,通知指定對象。",
944
945
  COUNTERSIGN: "指定對象會併入下一層簽核,下一層需所有人都完成才會繼續。",
945
946
  PRE_APPROVAL: "指定對象需先完成加簽,本階段才會往下一層繼續。",
946
947
  STAGE_NOTIFY: "本階段完成後(不論通過與否)通知指定對象。"
947
- }, Hn = [{
948
+ }, Gn = [{
948
949
  id: "REJECT_INSTANCE",
949
950
  name: "加簽拒絕時整單駁回"
950
951
  }, {
951
952
  id: "RETURN_TO_ORIGIN",
952
953
  name: "加簽拒絕時退回給我重新處理"
953
- }], Un = [{
954
+ }], Kn = [{
954
955
  id: "MEMBER",
955
956
  name: "指定成員"
956
957
  }, {
957
958
  id: "WEBHOOK",
958
959
  name: "Webhook"
959
- }], Wn = y(function({ adhocDirectives: n, currentMemberId: r, fill: i = null, instance: a, memberProfilesById: o, onChanged: s, onDecidingChange: c, onFillApproveError: l, tasks: d }, f) {
960
+ }], qn = y(function({ adhocDirectives: n, currentMemberId: r, fill: i = null, instance: a, memberProfilesById: o, onChanged: s, onDecidingChange: c, onFillApproveError: l, tasks: d }, f) {
960
961
  let [p, m] = x(!1), [h, g] = x(null);
961
- le(() => {
962
+ de(() => {
962
963
  c?.(p);
963
964
  }, [p, c]);
964
- let [ee, te] = x(""), [ne, re] = x(!1), [ie, ae] = x(""), [oe, v] = x(null), [se, y] = x(!1), [ce, de] = x(""), [he, _e] = x(!1), [ve, T] = x(null), [ye, xe] = x(""), [we, De] = x(null), [Ae, je] = x(!1), [Me, Ne] = x([]), [Pe, Fe] = x(!1), [Ie, Le] = x(""), [Be, Ve] = x([]), [He, We] = x(!1), [Ge, Ke] = x([]), [j, qe] = x(!1), [M, Je] = x("COUNTERSIGN"), [Ye, Xe] = x("REJECT_INSTANCE"), [Ze, Qe] = x(!1), [$e, et] = x("MEMBER"), [N, tt] = x(""), nt = ie.trim(), rt = ee.trim(), it = ce.trim(), at = ye.trim(), P = b(() => Bt(d, r), [r, d]), F = b(() => P && a ? a.workflowSnapshot.nodes.find((e) => e.id === P.nodeId) ?? null : null, [P, a]), ot = b(() => F && a ? J(a.workflowSnapshot, F) : [], [F, a]), st = F?.type === "userTask" && F.data.returnBehavior.allowReturn, ct = F?.type === "userTask" && F.data.allowReject !== !1, lt = F?.type === "userTask" && F.data.allowTransfer !== !1, ut = F?.type === "userTask" && F.data.returnBehavior.requireComment === !0, I = F?.type === "userTask" && F.data.requireApprovalComment === !0, L = I && !rt, dt = F?.type === "userTask" && F.data.allowAddSigner, ft = b(() => n.filter((e) => e.status === "PENDING"), [n]), pt = ot.find((e) => e.id === ve) ?? ot[0] ?? null, mt = b(() => d.map((e) => ({
965
+ let [ee, te] = x(""), [ne, re] = x(!1), [ie, ae] = x(""), [oe, _] = x(null), [se, ce] = x(!1), [le, y] = x(""), [ue, pe] = x(!1), [_e, w] = x(null), [ye, E] = x(""), [be, Se] = x(null), [we, Oe] = x(!1), [je, Me] = x([]), [Ne, Pe] = x(!1), [Fe, Ie] = x(""), [Le, Re] = x([]), [Ve, He] = x(!1), [Ue, Ge] = x([]), [Ke, N] = x(!1), [P, qe] = x("COUNTERSIGN"), [Je, Ye] = x("REJECT_INSTANCE"), [Xe, Ze] = x(!1), [Qe, $e] = x("MEMBER"), [F, et] = x(""), tt = ie.trim(), nt = ee.trim(), rt = le.trim(), it = ye.trim(), I = b(() => Ht(d, r), [r, d]), L = b(() => I && a ? a.workflowSnapshot.nodes.find((e) => e.id === I.nodeId) ?? null : null, [I, a]), at = b(() => L && a ? Ut(a.workflowSnapshot, L) : [], [L, a]), ot = L?.type === "userTask" && L.data.returnBehavior.allowReturn, st = L?.type === "userTask" && L.data.allowReject !== !1, ct = L?.type === "userTask" && L.data.allowTransfer !== !1, lt = L?.type === "userTask" && L.data.returnBehavior.requireComment === !0, ut = L?.type === "userTask" && L.data.requireApprovalComment === !0, dt = ut && !nt, ft = L?.type === "userTask" && L.data.allowAddSigner, R = b(() => n.filter((e) => e.status === "PENDING"), [n]), pt = at.find((e) => e.id === _e) ?? at[0] ?? null, mt = b(() => d.map((e) => ({
965
966
  ...e,
966
- assigneeLabel: Rt(e, o),
967
- fillFieldCount: Kn(e, a?.workflowSnapshot ?? null),
967
+ assigneeLabel: Vt(e, o),
968
+ fillFieldCount: Yn(e, a?.workflowSnapshot ?? null),
968
969
  key: e.id,
969
970
  nodeLabel: u({
970
971
  ...e,
971
- nodeLabel: Ft(e.nodeId, a?.workflowSnapshot ?? null)
972
+ nodeLabel: Rt(e.nodeId, a?.workflowSnapshot ?? null)
972
973
  }),
973
- statusLabel: K(e.status)
974
+ statusLabel: Ft(e.status)
974
975
  })), [
975
976
  a,
976
977
  o,
@@ -985,7 +986,7 @@ var Bn = {
985
986
  {
986
987
  key: "assigneeMemberId",
987
988
  title: "處理者",
988
- render: (e) => /* @__PURE__ */ O(E, {
989
+ render: (e) => /* @__PURE__ */ A(O, {
989
990
  component: "span",
990
991
  variant: "body",
991
992
  children: e.assigneeLabel
@@ -1000,7 +1001,7 @@ var Bn = {
1000
1001
  },
1001
1002
  {
1002
1003
  key: "fill",
1003
- render: (e) => e.fillFieldCount > 0 ? /* @__PURE__ */ O(pe, {
1004
+ render: (e) => e.fillFieldCount > 0 ? /* @__PURE__ */ A(he, {
1004
1005
  size: "sub",
1005
1006
  text: `需補填 ${e.fillFieldCount} 欄`,
1006
1007
  variant: "dot-warning"
@@ -1010,7 +1011,7 @@ var Bn = {
1010
1011
  },
1011
1012
  {
1012
1013
  key: "createdAt",
1013
- render: (e) => /* @__PURE__ */ O(E, {
1014
+ render: (e) => /* @__PURE__ */ A(O, {
1014
1015
  component: "span",
1015
1016
  variant: "body",
1016
1017
  children: t(e.createdAt)
@@ -1018,13 +1019,13 @@ var Bn = {
1018
1019
  title: "建立時間",
1019
1020
  width: 220
1020
1021
  }
1021
- ], []), R = b(() => ft.map((e) => ({
1022
+ ], []), gt = b(() => R.map((e) => ({
1022
1023
  ...e,
1023
1024
  createdByLabel: q(e.createdByMemberId, o),
1024
1025
  key: e.id,
1025
- targetLabel: Gn(e, o),
1026
- typeLabel: Bn[e.type]
1027
- })), [o, ft]), gt = b(() => [
1026
+ targetLabel: Jn(e, o),
1027
+ typeLabel: Un[e.type]
1028
+ })), [o, R]), _t = b(() => [
1028
1029
  {
1029
1030
  dataIndex: "typeLabel",
1030
1031
  key: "typeLabel",
@@ -1033,7 +1034,7 @@ var Bn = {
1033
1034
  },
1034
1035
  {
1035
1036
  key: "targetLabel",
1036
- render: (e) => /* @__PURE__ */ O(E, {
1037
+ render: (e) => /* @__PURE__ */ A(O, {
1037
1038
  component: "span",
1038
1039
  variant: "body",
1039
1040
  children: e.targetLabel
@@ -1043,7 +1044,7 @@ var Bn = {
1043
1044
  },
1044
1045
  {
1045
1046
  key: "createdByLabel",
1046
- render: (e) => /* @__PURE__ */ O(E, {
1047
+ render: (e) => /* @__PURE__ */ A(O, {
1047
1048
  component: "span",
1048
1049
  variant: "body",
1049
1050
  children: e.createdByLabel
@@ -1053,7 +1054,7 @@ var Bn = {
1053
1054
  },
1054
1055
  {
1055
1056
  key: "createdAt",
1056
- render: (e) => /* @__PURE__ */ O(E, {
1057
+ render: (e) => /* @__PURE__ */ A(O, {
1057
1058
  component: "span",
1058
1059
  variant: "body",
1059
1060
  children: t(e.createdAt)
@@ -1063,282 +1064,282 @@ var Bn = {
1063
1064
  },
1064
1065
  {
1065
1066
  key: "actions",
1066
- render: (e) => e.createdByMemberId === r ? /* @__PURE__ */ O(S, {
1067
- disabled: Ze,
1068
- onClick: () => void At(e.id),
1067
+ render: (e) => e.createdByMemberId === r ? /* @__PURE__ */ A(S, {
1068
+ disabled: Xe,
1069
+ onClick: () => void U(e.id),
1069
1070
  size: "minor",
1070
1071
  variant: "destructive-secondary",
1071
1072
  children: "撤回"
1072
- }) : /* @__PURE__ */ O(D, {}),
1073
+ }) : /* @__PURE__ */ A(k, {}),
1073
1074
  title: "操作",
1074
1075
  width: 100
1075
1076
  }
1076
- ], [Ze, r]);
1077
+ ], [Xe, r]);
1077
1078
  async function z({ action: e, comment: t, returnToNodeId: n = null, transferToMemberId: a = null }) {
1078
- if (!r || !P || e === "REJECTED" && !ct || e === "TRANSFERRED" && !lt) return !1;
1079
+ if (!r || !I || e === "REJECTED" && !st || e === "TRANSFERRED" && !ct) return !1;
1079
1080
  m(!0), g(null);
1080
- let o = e === "APPROVED" && i !== null && !P.isAdhoc ? {
1081
+ let o = e === "APPROVED" && i !== null && !I.isAdhoc ? {
1081
1082
  expectedFormDataFingerprint: i.expectedFormDataFingerprint,
1082
1083
  formData: i.formData
1083
1084
  } : null;
1084
1085
  try {
1085
- await A({
1086
+ await Ae({
1086
1087
  action: e,
1087
1088
  comment: t,
1088
1089
  decidedByMemberId: r,
1089
1090
  fill: o,
1090
1091
  returnToNodeId: n,
1091
- taskId: P.id,
1092
+ taskId: I.id,
1092
1093
  transferToMemberId: a
1093
- }), y(!1), _e(!1), Fe(!1), ae(""), de(""), xe(""), De(null), T(null), v(null);
1094
+ }), ce(!1), pe(!1), Pe(!1), ae(""), y(""), E(""), Se(null), w(null), _(null);
1094
1095
  } catch (e) {
1095
- return m(!1), o !== null && e instanceof Error && l?.(e.message, Te(e)) === !0 ? (re(!1), !1) : (g(_(e)), !1);
1096
+ return m(!1), o !== null && e instanceof Error && l?.(e.message, Te(e), Ee(e)) === !0 ? (re(!1), !1) : (g(v(e)), !1);
1096
1097
  }
1097
1098
  try {
1098
1099
  await s();
1099
1100
  } catch (e) {
1100
- g(_(e));
1101
+ g(v(e));
1101
1102
  } finally {
1102
1103
  m(!1);
1103
1104
  }
1104
1105
  return !0;
1105
1106
  }
1106
- function _t() {
1107
- r && P && (g(null), re(!0));
1108
- }
1109
1107
  function vt() {
1108
+ r && I && (g(null), re(!0));
1109
+ }
1110
+ function B() {
1110
1111
  p || (re(!1), te(""));
1111
1112
  }
1112
1113
  async function yt() {
1113
- p || L || await z({
1114
+ p || dt || await z({
1114
1115
  action: "APPROVED",
1115
- comment: rt || null
1116
+ comment: nt || null
1116
1117
  }) && (re(!1), te(""));
1117
1118
  }
1118
1119
  function bt() {
1119
- ct && (ae(""), v(null), y(!0));
1120
+ st && (ae(""), _(null), ce(!0));
1120
1121
  }
1121
1122
  function xt() {
1122
- p || (y(!1), ae(""), v(null));
1123
+ p || (ce(!1), ae(""), _(null));
1123
1124
  }
1124
1125
  function St() {
1125
- de(""), T(ot[0]?.id ?? null), _e(!0);
1126
- }
1127
- function B() {
1128
- p || (_e(!1), de(""), T(null));
1126
+ y(""), w(at[0]?.id ?? null), pe(!0);
1129
1127
  }
1130
1128
  function Ct() {
1131
- lt && (xe(""), De(null), Fe(!0), wt(""));
1129
+ p || (pe(!1), y(""), w(null));
1132
1130
  }
1133
- function V() {
1134
- p || (Fe(!1), xe(""), De(null));
1131
+ function wt() {
1132
+ ct && (E(""), Se(null), Pe(!0), Et(""));
1133
+ }
1134
+ function Tt() {
1135
+ p || (Pe(!1), E(""), Se(null));
1135
1136
  }
1136
- async function wt(e) {
1137
- je(!0);
1137
+ async function Et(e) {
1138
+ Oe(!0);
1138
1139
  try {
1139
- Ne((await Ue(e)).filter((e) => e.memberId !== r).map(Vt));
1140
+ Me((await We(e)).filter((e) => e.memberId !== r).map(Wt));
1140
1141
  } catch (e) {
1141
- g(_(e));
1142
+ g(v(e));
1142
1143
  } finally {
1143
- je(!1);
1144
+ Oe(!1);
1144
1145
  }
1145
1146
  }
1146
- async function Tt() {
1147
- ct && (nt ? await z({
1147
+ async function Dt() {
1148
+ st && (tt ? await z({
1148
1149
  action: "REJECTED",
1149
- comment: nt
1150
- }) : v("請輸入拒絕原因"));
1150
+ comment: tt
1151
+ }) : _("請輸入拒絕原因"));
1151
1152
  }
1152
- async function Et() {
1153
- lt && (we ? await z({
1153
+ async function Ot() {
1154
+ ct && (be ? await z({
1154
1155
  action: "TRANSFERRED",
1155
- comment: at || null,
1156
- transferToMemberId: we.id
1156
+ comment: it || null,
1157
+ transferToMemberId: be.id
1157
1158
  }) : g("請選擇轉派對象"));
1158
1159
  }
1159
- async function Dt() {
1160
+ async function kt() {
1160
1161
  await z({
1161
1162
  action: "RETURNED",
1162
- comment: it || null,
1163
+ comment: rt || null,
1163
1164
  returnToNodeId: pt?.id ?? null
1164
1165
  });
1165
1166
  }
1166
- function H() {
1167
- Le(""), Ve([]), Xe("REJECT_INSTANCE"), et("MEMBER"), tt("");
1167
+ function At() {
1168
+ Ie(""), Re([]), Ye("REJECT_INSTANCE"), $e("MEMBER"), et("");
1168
1169
  }
1169
- function Ot(e) {
1170
- Je(e), H(), qe(!0), W("");
1170
+ function jt(e) {
1171
+ qe(e), At(), N(!0), H("");
1171
1172
  }
1172
- function U() {
1173
- Ze || (qe(!1), H());
1173
+ function V() {
1174
+ Xe || (N(!1), At());
1174
1175
  }
1175
- async function W(e) {
1176
- We(!0);
1176
+ async function H(e) {
1177
+ He(!0);
1177
1178
  try {
1178
- Ke((await Ue(e)).map(Vt));
1179
+ Ge((await We(e)).map(Wt));
1179
1180
  } catch (e) {
1180
- g(_(e));
1181
+ g(v(e));
1181
1182
  } finally {
1182
- We(!1);
1183
+ He(!1);
1183
1184
  }
1184
1185
  }
1185
- async function kt() {
1186
- if (!P) return;
1187
- let e = (M === "STAGE_NOTIFY" || M === "COMPLETION_NOTIFY") && $e === "WEBHOOK", t = Ht({
1188
- memberIds: Be.map((e) => e.id),
1186
+ async function Mt() {
1187
+ if (!I) return;
1188
+ let e = (P === "STAGE_NOTIFY" || P === "COMPLETION_NOTIFY") && Qe === "WEBHOOK", t = Gt({
1189
+ memberIds: Le.map((e) => e.id),
1189
1190
  useWebhookTarget: e,
1190
- webhookUrl: N
1191
+ webhookUrl: F
1191
1192
  });
1192
1193
  if (!t.valid) {
1193
1194
  g(t.error);
1194
1195
  return;
1195
1196
  }
1196
- let { target: n } = t, r = Ie.trim() || null;
1197
- Qe(!0), g(null);
1197
+ let { target: n } = t, r = Fe.trim() || null;
1198
+ Ze(!0), g(null);
1198
1199
  try {
1199
- M === "COUNTERSIGN" ? await Re({
1200
+ P === "COUNTERSIGN" ? await ze({
1200
1201
  comment: r,
1201
1202
  target: n,
1202
- taskId: P.id
1203
- }) : M === "PRE_APPROVAL" ? await ze({
1203
+ taskId: I.id
1204
+ }) : P === "PRE_APPROVAL" ? await Be({
1204
1205
  comment: r,
1205
- onReject: Ye,
1206
+ onReject: Je,
1206
1207
  target: n,
1207
- taskId: P.id
1208
- }) : M === "STAGE_NOTIFY" ? await ke({
1208
+ taskId: I.id
1209
+ }) : P === "STAGE_NOTIFY" ? await M({
1209
1210
  target: n,
1210
- taskId: P.id
1211
- }) : await Oe({
1211
+ taskId: I.id
1212
+ }) : await ke({
1212
1213
  target: n,
1213
- taskId: P.id
1214
- }), qe(!1), H(), await s();
1214
+ taskId: I.id
1215
+ }), N(!1), At(), await s();
1215
1216
  } catch (e) {
1216
- g(_(e));
1217
+ g(v(e));
1217
1218
  } finally {
1218
- Qe(!1);
1219
+ Ze(!1);
1219
1220
  }
1220
1221
  }
1221
- async function At(e) {
1222
- Qe(!0), g(null);
1222
+ async function U(e) {
1223
+ Ze(!0), g(null);
1223
1224
  try {
1224
- await Ee(e), await s();
1225
+ await De(e), await s();
1225
1226
  } catch (e) {
1226
- g(_(e));
1227
+ g(v(e));
1227
1228
  } finally {
1228
- Qe(!1);
1229
+ Ze(!1);
1229
1230
  }
1230
1231
  }
1231
- ue(f, () => ({
1232
- canAddSignerCurrentTask: dt,
1233
- canRejectCurrentTask: ct,
1234
- canReturnCurrentTask: st,
1235
- canTransferCurrentTask: lt,
1232
+ fe(f, () => ({
1233
+ canAddSignerCurrentTask: ft,
1234
+ canRejectCurrentTask: st,
1235
+ canReturnCurrentTask: ot,
1236
+ canTransferCurrentTask: ct,
1236
1237
  deciding: p,
1237
- handleApprove: _t,
1238
- hasCurrentTask: P !== null,
1239
- openAdhocModal: Ot,
1238
+ handleApprove: vt,
1239
+ hasCurrentTask: I !== null,
1240
+ openAdhocModal: jt,
1240
1241
  openRejectModal: bt,
1241
1242
  openReturnModal: St,
1242
- openTransferModal: Ct
1243
+ openTransferModal: wt
1243
1244
  }), [
1244
- dt,
1245
- ct,
1245
+ ft,
1246
1246
  st,
1247
- lt,
1247
+ ot,
1248
+ ct,
1248
1249
  r,
1249
- P,
1250
+ I,
1250
1251
  p
1251
1252
  ]);
1252
- let jt = M === "STAGE_NOTIFY" || M === "COMPLETION_NOTIFY", G = jt && $e === "WEBHOOK" ? !N.trim() : Be.length === 0, Mt = Hn.find((e) => e.id === Ye) ?? Hn[0], Nt = Un.find((e) => e.id === $e) ?? Un[0];
1253
- return /* @__PURE__ */ k(D, { children: [
1254
- /* @__PURE__ */ O(E, {
1253
+ let W = P === "STAGE_NOTIFY" || P === "COMPLETION_NOTIFY", Nt = W && Qe === "WEBHOOK" ? !F.trim() : Le.length === 0, G = Gn.find((e) => e.id === Je) ?? Gn[0], K = Kn.find((e) => e.id === Qe) ?? Kn[0];
1254
+ return /* @__PURE__ */ j(k, { children: [
1255
+ /* @__PURE__ */ A(O, {
1255
1256
  component: "h2",
1256
1257
  variant: "h3",
1257
1258
  children: "任務"
1258
1259
  }),
1259
- h ? /* @__PURE__ */ O(E, {
1260
+ h ? /* @__PURE__ */ A(O, {
1260
1261
  color: "text-error",
1261
1262
  variant: "body",
1262
1263
  children: h
1263
1264
  }) : null,
1264
- /* @__PURE__ */ O("div", {
1265
- style: Ln,
1266
- children: /* @__PURE__ */ O(Se, {
1265
+ /* @__PURE__ */ A("div", {
1266
+ style: Bn,
1267
+ children: /* @__PURE__ */ A(D, {
1267
1268
  columns: ht,
1268
1269
  dataSource: mt,
1269
1270
  fullWidth: !0
1270
1271
  })
1271
1272
  }),
1272
- ft.length > 0 ? /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O(E, {
1273
+ R.length > 0 ? /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A(O, {
1273
1274
  component: "h3",
1274
- style: Rn,
1275
+ style: Vn,
1275
1276
  variant: "h3",
1276
1277
  children: "待生效的臨時設定"
1277
- }), /* @__PURE__ */ O("div", {
1278
- style: Ln,
1279
- children: /* @__PURE__ */ O(Se, {
1280
- columns: gt,
1281
- dataSource: R,
1278
+ }), /* @__PURE__ */ A("div", {
1279
+ style: Bn,
1280
+ children: /* @__PURE__ */ A(D, {
1281
+ columns: _t,
1282
+ dataSource: gt,
1282
1283
  fullWidth: !0
1283
1284
  })
1284
1285
  })] }) : null,
1285
- /* @__PURE__ */ k(w, {
1286
+ /* @__PURE__ */ j(T, {
1286
1287
  cancelText: "取消",
1287
- confirmButtonProps: { disabled: L },
1288
+ confirmButtonProps: { disabled: dt },
1288
1289
  confirmText: "送出同意",
1289
1290
  loading: p,
1290
1291
  modalType: "standard",
1291
- onCancel: vt,
1292
- onClose: vt,
1292
+ onCancel: B,
1293
+ onClose: B,
1293
1294
  onConfirm: () => void yt(),
1294
1295
  open: ne,
1295
1296
  showModalFooter: !0,
1296
1297
  showModalHeader: !0,
1297
1298
  size: "regular",
1298
- supportingText: I ? "此關卡設定核准時必須填寫意見,內容會記錄在簽核歷程。" : "可以留下同意的說明,內容會記錄在簽核歷程;不填也可以直接送出。",
1299
+ supportingText: ut ? "此關卡設定核准時必須填寫意見,內容會記錄在簽核歷程。" : "可以留下同意的說明,內容會記錄在簽核歷程;不填也可以直接送出。",
1299
1300
  title: "簽核意見",
1300
1301
  children: [
1301
- h ? /* @__PURE__ */ O(E, {
1302
+ h ? /* @__PURE__ */ A(O, {
1302
1303
  color: "text-error",
1303
1304
  role: "alert",
1304
1305
  variant: "body",
1305
1306
  children: h
1306
1307
  }) : null,
1307
- i !== null && i.summary.length > 0 ? /* @__PURE__ */ k("div", {
1308
- style: Pn,
1309
- children: [/* @__PURE__ */ O(E, {
1308
+ i !== null && i.summary.length > 0 ? /* @__PURE__ */ j("div", {
1309
+ style: Ln,
1310
+ children: [/* @__PURE__ */ A(O, {
1310
1311
  variant: "body",
1311
1312
  children: "將一併送出的補填欄位:"
1312
- }), i.summary.map((e) => /* @__PURE__ */ O(C, {
1313
+ }), i.summary.map((e) => /* @__PURE__ */ A(C, {
1313
1314
  title: e.label,
1314
- children: /* @__PURE__ */ O(me, { children: e.text })
1315
+ children: /* @__PURE__ */ A(ge, { children: e.text })
1315
1316
  }, e.fieldKey))]
1316
1317
  }) : null,
1317
- /* @__PURE__ */ O("div", {
1318
- style: Pn,
1319
- children: /* @__PURE__ */ O(e, {
1320
- hintText: I ? "此關卡設定核准時必須填寫意見。" : void 0,
1318
+ /* @__PURE__ */ A("div", {
1319
+ style: Ln,
1320
+ children: /* @__PURE__ */ A(e, {
1321
+ hintText: ut ? "此關卡設定核准時必須填寫意見。" : void 0,
1321
1322
  label: "簽核意見",
1322
1323
  name: "approveComment",
1323
- required: I,
1324
- children: /* @__PURE__ */ O(Ce, {
1324
+ required: ut,
1325
+ children: /* @__PURE__ */ A(Ce, {
1325
1326
  autoFocus: !0,
1326
1327
  onChange: (e) => te(e.target.value),
1327
- placeholder: I ? "請說明同意的原因或條件" : "選填,例如補充核准的條件或提醒事項",
1328
- ref: zn,
1328
+ placeholder: ut ? "請說明同意的原因或條件" : "選填,例如補充核准的條件或提醒事項",
1329
+ ref: Hn,
1329
1330
  resize: "vertical",
1330
1331
  rows: 4,
1331
- style: Fn,
1332
+ style: Rn,
1332
1333
  value: ee
1333
1334
  })
1334
1335
  })
1335
1336
  })
1336
1337
  ]
1337
1338
  }),
1338
- /* @__PURE__ */ O(w, {
1339
+ /* @__PURE__ */ A(T, {
1339
1340
  cancelText: "取消",
1340
1341
  confirmButtonProps: {
1341
- disabled: !nt,
1342
+ disabled: !tt,
1342
1343
  variant: "destructive-primary"
1343
1344
  },
1344
1345
  confirmText: "送出拒絕",
@@ -1347,61 +1348,61 @@ var Bn = {
1347
1348
  modalType: "standard",
1348
1349
  onCancel: xt,
1349
1350
  onClose: xt,
1350
- onConfirm: () => void Tt(),
1351
+ onConfirm: () => void Dt(),
1351
1352
  open: se,
1352
1353
  showModalFooter: !0,
1353
1354
  showModalHeader: !0,
1354
1355
  size: "regular",
1355
1356
  supportingText: "拒絕案件時必須留下原因,供發起人與後續追蹤查看。",
1356
1357
  title: "拒絕原因",
1357
- children: /* @__PURE__ */ k("div", {
1358
- style: Pn,
1359
- children: [/* @__PURE__ */ O(e, {
1358
+ children: /* @__PURE__ */ j("div", {
1359
+ style: Ln,
1360
+ children: [/* @__PURE__ */ A(e, {
1360
1361
  label: "拒絕原因",
1361
1362
  name: "rejectReason",
1362
1363
  required: !0,
1363
- children: /* @__PURE__ */ O(Ce, {
1364
+ children: /* @__PURE__ */ A(Ce, {
1364
1365
  autoFocus: !0,
1365
1366
  onChange: (e) => {
1366
- ae(e.target.value), v(null);
1367
+ ae(e.target.value), _(null);
1367
1368
  },
1368
1369
  placeholder: "請說明拒絕原因",
1369
- ref: zn,
1370
+ ref: Hn,
1370
1371
  resize: "vertical",
1371
1372
  rows: 4,
1372
- style: Fn,
1373
+ style: Rn,
1373
1374
  type: oe ? "error" : "default",
1374
1375
  value: ie
1375
1376
  })
1376
- }), oe ? /* @__PURE__ */ O(E, {
1377
+ }), oe ? /* @__PURE__ */ A(O, {
1377
1378
  color: "text-error",
1378
1379
  variant: "body",
1379
1380
  children: oe
1380
1381
  }) : null]
1381
1382
  })
1382
1383
  }),
1383
- /* @__PURE__ */ O(w, {
1384
+ /* @__PURE__ */ A(T, {
1384
1385
  cancelText: "取消",
1385
- confirmButtonProps: { disabled: !we },
1386
+ confirmButtonProps: { disabled: !be },
1386
1387
  confirmText: "送出轉派",
1387
1388
  loading: p,
1388
1389
  modalType: "standard",
1389
- onCancel: V,
1390
- onClose: V,
1391
- onConfirm: () => void Et(),
1392
- open: Pe,
1390
+ onCancel: Tt,
1391
+ onClose: Tt,
1392
+ onConfirm: () => void Ot(),
1393
+ open: Ne,
1393
1394
  showModalFooter: !0,
1394
1395
  showModalHeader: !0,
1395
1396
  size: "regular",
1396
1397
  supportingText: "轉派後,原任務會保留轉派紀錄,新的待簽任務會指派給指定成員。",
1397
1398
  title: "轉派簽核",
1398
- children: /* @__PURE__ */ k("div", {
1399
- style: In,
1400
- children: [/* @__PURE__ */ O(e, {
1399
+ children: /* @__PURE__ */ j("div", {
1400
+ style: zn,
1401
+ children: [/* @__PURE__ */ A(e, {
1401
1402
  label: "轉派對象",
1402
1403
  name: "transferToMemberId",
1403
1404
  required: !0,
1404
- children: /* @__PURE__ */ O(fe, {
1405
+ children: /* @__PURE__ */ A(me, {
1405
1406
  asyncData: !0,
1406
1407
  disabledOptionsFilter: !0,
1407
1408
  emptyText: "沒有符合的成員",
@@ -1411,147 +1412,147 @@ var Bn = {
1411
1412
  name: "transfer-member-search",
1412
1413
  spellCheck: !1
1413
1414
  },
1414
- loading: Ae,
1415
+ loading: we,
1415
1416
  loadingText: "搜尋成員中...",
1416
1417
  mode: "single",
1417
- onChange: (e) => De(Wt(e)),
1418
- onSearch: wt,
1419
- onSearchTextChange: (e) => De(Gt(e, Me)),
1418
+ onChange: (e) => Se(qt(e)),
1419
+ onSearch: Et,
1420
+ onSearchTextChange: (e) => Se(Jt(e, je)),
1420
1421
  onVisibilityChange: (e) => {
1421
- e && wt("");
1422
+ e && Et("");
1422
1423
  },
1423
- options: [...Me],
1424
+ options: [...je],
1424
1425
  placeholder: "搜尋姓名或信箱",
1425
1426
  searchDebounceTime: 300,
1426
- value: we
1427
+ value: be
1427
1428
  })
1428
- }), /* @__PURE__ */ O(e, {
1429
+ }), /* @__PURE__ */ A(e, {
1429
1430
  label: "轉派說明",
1430
1431
  name: "transferComment",
1431
- children: /* @__PURE__ */ O(Ce, {
1432
- onChange: (e) => xe(e.target.value),
1432
+ children: /* @__PURE__ */ A(Ce, {
1433
+ onChange: (e) => E(e.target.value),
1433
1434
  placeholder: "可補充轉派原因",
1434
- ref: zn,
1435
+ ref: Hn,
1435
1436
  resize: "vertical",
1436
1437
  rows: 4,
1437
- style: Fn,
1438
+ style: Rn,
1438
1439
  value: ye
1439
1440
  })
1440
1441
  })]
1441
1442
  })
1442
1443
  }),
1443
- /* @__PURE__ */ O(w, {
1444
+ /* @__PURE__ */ A(T, {
1444
1445
  cancelText: "取消",
1445
- confirmButtonProps: { disabled: !pt || ut && !it },
1446
+ confirmButtonProps: { disabled: !pt || lt && !rt },
1446
1447
  confirmText: "送出退回",
1447
1448
  loading: p,
1448
1449
  modalType: "standard",
1449
- onCancel: B,
1450
- onClose: B,
1451
- onConfirm: () => void Dt(),
1452
- open: he,
1450
+ onCancel: Ct,
1451
+ onClose: Ct,
1452
+ onConfirm: () => void kt(),
1453
+ open: ue,
1453
1454
  showModalFooter: !0,
1454
1455
  showModalHeader: !0,
1455
1456
  size: "regular",
1456
1457
  supportingText: "退回後,流程會回到指定節點並等待重新處理。",
1457
1458
  title: "退回簽核",
1458
- children: /* @__PURE__ */ k("div", {
1459
- style: In,
1460
- children: [/* @__PURE__ */ O(e, {
1459
+ children: /* @__PURE__ */ j("div", {
1460
+ style: zn,
1461
+ children: [/* @__PURE__ */ A(e, {
1461
1462
  label: "退回節點",
1462
1463
  name: "returnTargetNodeId",
1463
1464
  required: !0,
1464
- children: /* @__PURE__ */ O(be, {
1465
+ children: /* @__PURE__ */ A(xe, {
1465
1466
  clearable: !1,
1466
1467
  fullWidth: !0,
1467
- onChange: (e) => T(e?.id ?? null),
1468
- options: [...ot],
1468
+ onChange: (e) => w(e?.id ?? null),
1469
+ options: [...at],
1469
1470
  placeholder: "選擇退回節點",
1470
1471
  value: pt
1471
1472
  })
1472
- }), /* @__PURE__ */ O(e, {
1473
- hintText: ut ? "此關卡設定退回時必須填寫意見。" : void 0,
1473
+ }), /* @__PURE__ */ A(e, {
1474
+ hintText: lt ? "此關卡設定退回時必須填寫意見。" : void 0,
1474
1475
  label: "退回說明",
1475
1476
  name: "returnComment",
1476
- required: ut,
1477
- children: /* @__PURE__ */ O(Ce, {
1478
- onChange: (e) => de(e.target.value),
1479
- placeholder: ut ? "請說明退回原因" : "可補充需要修改的內容",
1480
- ref: zn,
1477
+ required: lt,
1478
+ children: /* @__PURE__ */ A(Ce, {
1479
+ onChange: (e) => y(e.target.value),
1480
+ placeholder: lt ? "請說明退回原因" : "可補充需要修改的內容",
1481
+ ref: Hn,
1481
1482
  resize: "vertical",
1482
1483
  rows: 4,
1483
- style: Fn,
1484
- value: ce
1484
+ style: Rn,
1485
+ value: le
1485
1486
  })
1486
1487
  })]
1487
1488
  })
1488
1489
  }),
1489
- /* @__PURE__ */ O(w, {
1490
+ /* @__PURE__ */ A(T, {
1490
1491
  cancelText: "取消",
1491
- confirmButtonProps: { disabled: G },
1492
+ confirmButtonProps: { disabled: Nt },
1492
1493
  confirmText: "送出",
1493
- loading: Ze,
1494
+ loading: Xe,
1494
1495
  modalType: "standard",
1495
- onCancel: U,
1496
- onClose: U,
1497
- onConfirm: () => void kt(),
1498
- open: j,
1496
+ onCancel: V,
1497
+ onClose: V,
1498
+ onConfirm: () => void Mt(),
1499
+ open: Ke,
1499
1500
  showModalFooter: !0,
1500
1501
  showModalHeader: !0,
1501
1502
  size: "regular",
1502
- supportingText: Vn[M],
1503
- title: Bn[M],
1504
- children: /* @__PURE__ */ k("div", {
1505
- style: In,
1503
+ supportingText: Wn[P],
1504
+ title: Un[P],
1505
+ children: /* @__PURE__ */ j("div", {
1506
+ style: zn,
1506
1507
  children: [
1507
- jt ? /* @__PURE__ */ O(e, {
1508
+ W ? /* @__PURE__ */ A(e, {
1508
1509
  label: "通知時機",
1509
1510
  name: "adhocNotifyMode",
1510
1511
  required: !0,
1511
- children: /* @__PURE__ */ O(be, {
1512
+ children: /* @__PURE__ */ A(xe, {
1512
1513
  clearable: !1,
1513
1514
  fullWidth: !0,
1514
- onChange: (e) => Je(e?.id === "COMPLETION_NOTIFY" ? "COMPLETION_NOTIFY" : "STAGE_NOTIFY"),
1515
+ onChange: (e) => qe(e?.id === "COMPLETION_NOTIFY" ? "COMPLETION_NOTIFY" : "STAGE_NOTIFY"),
1515
1516
  options: [{
1516
1517
  id: "STAGE_NOTIFY",
1517
- name: Bn.STAGE_NOTIFY
1518
+ name: Un.STAGE_NOTIFY
1518
1519
  }, {
1519
1520
  id: "COMPLETION_NOTIFY",
1520
- name: Bn.COMPLETION_NOTIFY
1521
+ name: Un.COMPLETION_NOTIFY
1521
1522
  }],
1522
1523
  value: {
1523
- id: M,
1524
- name: Bn[M]
1524
+ id: P,
1525
+ name: Un[P]
1525
1526
  }
1526
1527
  })
1527
1528
  }) : null,
1528
- jt ? /* @__PURE__ */ O(e, {
1529
+ W ? /* @__PURE__ */ A(e, {
1529
1530
  label: "通知對象類型",
1530
1531
  name: "adhocTargetKind",
1531
1532
  required: !0,
1532
- children: /* @__PURE__ */ O(be, {
1533
+ children: /* @__PURE__ */ A(xe, {
1533
1534
  clearable: !1,
1534
1535
  fullWidth: !0,
1535
- onChange: (e) => et(e?.id === "WEBHOOK" ? "WEBHOOK" : "MEMBER"),
1536
- options: [...Un],
1537
- value: Nt
1536
+ onChange: (e) => $e(e?.id === "WEBHOOK" ? "WEBHOOK" : "MEMBER"),
1537
+ options: [...Kn],
1538
+ value: K
1538
1539
  })
1539
1540
  }) : null,
1540
- jt && $e === "WEBHOOK" ? /* @__PURE__ */ O(e, {
1541
+ W && Qe === "WEBHOOK" ? /* @__PURE__ */ A(e, {
1541
1542
  label: "Webhook URL",
1542
1543
  name: "adhocWebhookUrl",
1543
1544
  required: !0,
1544
- children: /* @__PURE__ */ O(ge, {
1545
+ children: /* @__PURE__ */ A(ve, {
1545
1546
  fullWidth: !0,
1546
- onChange: (e) => tt(e.target.value),
1547
+ onChange: (e) => et(e.target.value),
1547
1548
  placeholder: "https://example.com/webhook",
1548
- value: N
1549
+ value: F
1549
1550
  })
1550
- }) : /* @__PURE__ */ O(e, {
1551
- label: jt ? "通知對象" : "簽核對象",
1551
+ }) : /* @__PURE__ */ A(e, {
1552
+ label: W ? "通知對象" : "簽核對象",
1552
1553
  name: "adhocMemberId",
1553
1554
  required: !0,
1554
- children: /* @__PURE__ */ O(fe, {
1555
+ children: /* @__PURE__ */ A(me, {
1555
1556
  asyncData: !0,
1556
1557
  disabledOptionsFilter: !0,
1557
1558
  emptyText: "沒有符合的成員",
@@ -1561,45 +1562,45 @@ var Bn = {
1561
1562
  name: "adhoc-member-search",
1562
1563
  spellCheck: !1
1563
1564
  },
1564
- loading: He,
1565
+ loading: Ve,
1565
1566
  loadingText: "搜尋成員中...",
1566
1567
  menuMaxHeight: 320,
1567
1568
  mode: "multiple",
1568
- onChange: (e) => Ve(e.map(Wt).filter(Ut)),
1569
- onSearch: W,
1569
+ onChange: (e) => Re(e.map(qt).filter(Kt)),
1570
+ onSearch: H,
1570
1571
  onVisibilityChange: (e) => {
1571
- e && W("");
1572
+ e && H("");
1572
1573
  },
1573
- options: [...Ge],
1574
+ options: [...Ue],
1574
1575
  overflowStrategy: "wrap",
1575
1576
  placeholder: "搜尋姓名或信箱,可加入多位",
1576
1577
  searchDebounceTime: 300,
1577
- value: [...Be]
1578
+ value: [...Le]
1578
1579
  })
1579
1580
  }),
1580
- M === "PRE_APPROVAL" ? /* @__PURE__ */ O(e, {
1581
+ P === "PRE_APPROVAL" ? /* @__PURE__ */ A(e, {
1581
1582
  label: "拒簽處理方式",
1582
1583
  name: "adhocOnReject",
1583
1584
  required: !0,
1584
- children: /* @__PURE__ */ O(be, {
1585
+ children: /* @__PURE__ */ A(xe, {
1585
1586
  clearable: !1,
1586
1587
  fullWidth: !0,
1587
- onChange: (e) => Xe(e?.id === "RETURN_TO_ORIGIN" ? "RETURN_TO_ORIGIN" : "REJECT_INSTANCE"),
1588
- options: [...Hn],
1589
- value: Mt
1588
+ onChange: (e) => Ye(e?.id === "RETURN_TO_ORIGIN" ? "RETURN_TO_ORIGIN" : "REJECT_INSTANCE"),
1589
+ options: [...Gn],
1590
+ value: G
1590
1591
  })
1591
1592
  }) : null,
1592
- jt ? null : /* @__PURE__ */ O(e, {
1593
+ W ? null : /* @__PURE__ */ A(e, {
1593
1594
  label: "說明",
1594
1595
  name: "adhocComment",
1595
- children: /* @__PURE__ */ O(Ce, {
1596
- onChange: (e) => Le(e.target.value),
1596
+ children: /* @__PURE__ */ A(Ce, {
1597
+ onChange: (e) => Ie(e.target.value),
1597
1598
  placeholder: "可補充原因",
1598
- ref: zn,
1599
+ ref: Hn,
1599
1600
  resize: "vertical",
1600
1601
  rows: 3,
1601
- style: Fn,
1602
- value: Ie
1602
+ style: Rn,
1603
+ value: Fe
1603
1604
  })
1604
1605
  })
1605
1606
  ]
@@ -1607,7 +1608,7 @@ var Bn = {
1607
1608
  })
1608
1609
  ] });
1609
1610
  });
1610
- function Gn(e, t) {
1611
+ function Jn(e, t) {
1611
1612
  try {
1612
1613
  let n = JSON.parse(e.targetValueJson);
1613
1614
  if (n.memberIds?.length) return n.memberIds.map((e) => q(e, t)).join("、");
@@ -1617,20 +1618,20 @@ function Gn(e, t) {
1617
1618
  } catch {}
1618
1619
  return e.targetKind;
1619
1620
  }
1620
- function Kn(e, t) {
1621
+ function Yn(e, t) {
1621
1622
  if (e.isAdhoc || e.status !== "PENDING" && e.status !== "IN_PROGRESS") return 0;
1622
1623
  let n = t?.nodes.find((t) => t.id === e.nodeId);
1623
- return n?.type === "userTask" ? Ge(n).size : 0;
1624
+ return n?.type === "userTask" ? Ke(n).size : 0;
1624
1625
  }
1625
1626
  // src/views/instances/detail/sections/InstanceSignaturesSection.tsx
1626
- var qn = {
1627
+ var Xn = {
1627
1628
  display: "grid",
1628
1629
  gap: 16
1629
1630
  };
1630
- function Jn({ signatureVerification: e, signatures: n }) {
1631
+ function Zn({ signatureVerification: e, signatures: n }) {
1631
1632
  let r = b(() => n.map((e) => ({
1632
1633
  algorithm: e.algorithm,
1633
- hashLabel: G(e.signedPayloadHash),
1634
+ hashLabel: K(e.signedPayloadHash),
1634
1635
  key: e.id,
1635
1636
  keyVersion: e.keyVersion,
1636
1637
  signedAtLabel: t(e.signedAt),
@@ -1667,20 +1668,20 @@ function Jn({ signatureVerification: e, signatures: n }) {
1667
1668
  width: 220
1668
1669
  }
1669
1670
  ], []);
1670
- return /* @__PURE__ */ k("div", {
1671
- style: qn,
1671
+ return /* @__PURE__ */ j("div", {
1672
+ style: Xn,
1672
1673
  children: [
1673
- /* @__PURE__ */ O(E, {
1674
+ /* @__PURE__ */ A(O, {
1674
1675
  component: "h2",
1675
1676
  variant: "h3",
1676
1677
  children: "簽章"
1677
1678
  }),
1678
- /* @__PURE__ */ O(E, {
1679
+ /* @__PURE__ */ A(O, {
1679
1680
  color: e?.valid ? "text-success" : "text-error",
1680
1681
  variant: "body",
1681
1682
  children: e ? e.valid ? `簽章鏈已驗證,共 ${e.checkedCount} 筆。` : `簽章鏈驗證失敗:${e.errors.join("、")}` : "尚無簽章紀錄。"
1682
1683
  }),
1683
- r.length > 0 ? /* @__PURE__ */ O(Se, {
1684
+ r.length > 0 ? /* @__PURE__ */ A(D, {
1684
1685
  columns: i,
1685
1686
  dataSource: r,
1686
1687
  fullWidth: !0
@@ -1689,14 +1690,14 @@ function Jn({ signatureVerification: e, signatures: n }) {
1689
1690
  });
1690
1691
  }
1691
1692
  // src/views/instances/detail/sections/InstanceHistorySection.tsx
1692
- var Yn = {
1693
+ var Qn = {
1693
1694
  display: "grid",
1694
1695
  gap: 16
1695
- }, Xn = {
1696
+ }, $n = {
1696
1697
  cursor: "help",
1697
1698
  textDecoration: "underline dotted",
1698
1699
  textUnderlineOffset: 3
1699
- }, Zn = {
1700
+ }, er = {
1700
1701
  borderLeftColor: "var(--mzn-color-border)",
1701
1702
  borderLeftStyle: "solid",
1702
1703
  borderLeftWidth: 2,
@@ -1705,42 +1706,42 @@ var Yn = {
1705
1706
  marginTop: 4,
1706
1707
  paddingLeft: 8,
1707
1708
  whiteSpace: "pre-wrap"
1708
- }, Qn = { color: "var(--mzn-color-text-secondary)" }, $n = {
1709
- ...Zn,
1709
+ }, tr = { color: "var(--mzn-color-text-secondary)" }, nr = {
1710
+ ...er,
1710
1711
  borderLeftColor: "var(--mzn-color-text-error)",
1711
1712
  color: "var(--mzn-color-text-error)"
1712
1713
  };
1713
- function er(...e) {
1714
- return e.filter((e) => W(e ?? null)).join(" ");
1714
+ function rr(...e) {
1715
+ return e.filter((e) => U(e ?? null)).join(" ");
1715
1716
  }
1716
- var tr = y(function({ className: e, descriptionParts: t, error: n, forcePending: r = !1, index: i = 0, orientation: a, status: o = "pending", title: s, type: c = "number", ...l }, u) {
1717
+ var ir = y(function({ className: e, descriptionParts: t, error: n, forcePending: r = !1, index: i = 0, orientation: a, status: o = "pending", title: s, type: c = "number", ...l }, u) {
1717
1718
  let d = r ? "pending" : o, f = t.filter((e) => e.type !== "comment"), p = t.filter((e) => e.type === "comment");
1718
- return /* @__PURE__ */ k("div", {
1719
+ return /* @__PURE__ */ j("div", {
1719
1720
  ...l,
1720
- className: er(R.host, c === "dot" ? R.dot : null, n && d !== "processing" ? R.error : null, a === "horizontal" ? R.horizontal : null, c === "number" ? R.number : null, d === "pending" ? R.pending : null, d === "processing" ? R.processing : null, n && d === "processing" ? R.processingError : null, !n && d === "succeeded" ? R.succeeded : null, a === "vertical" ? R.vertical : null, e),
1721
+ className: rr(z.host, c === "dot" ? z.dot : null, n && d !== "processing" ? z.error : null, a === "horizontal" ? z.horizontal : null, c === "number" ? z.number : null, d === "pending" ? z.pending : null, d === "processing" ? z.processing : null, n && d === "processing" ? z.processingError : null, !n && d === "succeeded" ? z.succeeded : null, a === "vertical" ? z.vertical : null, e),
1721
1722
  ref: u,
1722
- children: [c === "dot" ? /* @__PURE__ */ O("span", { className: er(R.statusIndicator, R.statusIndicatorDot) }) : /* @__PURE__ */ O("span", {
1723
- className: R.statusIndicator,
1723
+ children: [c === "dot" ? /* @__PURE__ */ A("span", { className: rr(z.statusIndicator, z.statusIndicatorDot) }) : /* @__PURE__ */ A("span", {
1724
+ className: z.statusIndicator,
1724
1725
  children: i + 1
1725
- }), /* @__PURE__ */ k("div", {
1726
- className: R.textContainer,
1726
+ }), /* @__PURE__ */ j("div", {
1727
+ className: z.textContainer,
1727
1728
  children: [
1728
- /* @__PURE__ */ k(E, {
1729
- className: R.title,
1729
+ /* @__PURE__ */ j(O, {
1730
+ className: z.title,
1730
1731
  variant: "label-primary-highlight",
1731
- children: [s, /* @__PURE__ */ O("span", { className: R.titleConnectLine })]
1732
+ children: [s, /* @__PURE__ */ A("span", { className: z.titleConnectLine })]
1732
1733
  }),
1733
- f.length > 0 ? /* @__PURE__ */ O(E, {
1734
- className: R.description,
1734
+ f.length > 0 ? /* @__PURE__ */ A(O, {
1735
+ className: z.description,
1735
1736
  component: "div",
1736
1737
  variant: "body",
1737
- children: f.map((e, t) => /* @__PURE__ */ k(se, { children: [t > 0 ? " · " : null, nr(e)] }, `${e.type}-${t}`))
1738
+ children: f.map((e, t) => /* @__PURE__ */ j(le, { children: [t > 0 ? " · " : null, ar(e)] }, `${e.type}-${t}`))
1738
1739
  }) : null,
1739
- p.map((e, t) => /* @__PURE__ */ k(E, {
1740
- style: e.tone === "danger" ? $n : Zn,
1740
+ p.map((e, t) => /* @__PURE__ */ j(O, {
1741
+ style: e.tone === "danger" ? nr : er,
1741
1742
  variant: "body",
1742
- children: [/* @__PURE__ */ k("span", {
1743
- style: e.tone === "danger" ? void 0 : Qn,
1743
+ children: [/* @__PURE__ */ j("span", {
1744
+ style: e.tone === "danger" ? void 0 : tr,
1744
1745
  children: [e.label, ":"]
1745
1746
  }), e.text]
1746
1747
  }, `comment-${t}`))
@@ -1748,23 +1749,23 @@ var tr = y(function({ className: e, descriptionParts: t, error: n, forcePending:
1748
1749
  })]
1749
1750
  });
1750
1751
  });
1751
- function nr(e) {
1752
- return e.type === "text" ? e.text : e.email?.trim() ? /* @__PURE__ */ k(D, { children: [
1752
+ function ar(e) {
1753
+ return e.type === "text" ? e.text : e.email?.trim() ? /* @__PURE__ */ j(k, { children: [
1753
1754
  e.prefix,
1754
1755
  ":",
1755
- /* @__PURE__ */ O(we, {
1756
+ /* @__PURE__ */ A(we, {
1756
1757
  title: e.email,
1757
- children: ({ ref: t, ...n }) => /* @__PURE__ */ O("span", {
1758
+ children: ({ ref: t, ...n }) => /* @__PURE__ */ A("span", {
1758
1759
  ...n,
1759
1760
  "data-testid": e.memberId ? `member-tooltip-${e.memberId}` : void 0,
1760
1761
  ref: t,
1761
- style: Xn,
1762
+ style: $n,
1762
1763
  children: e.label
1763
1764
  })
1764
1765
  })
1765
1766
  ] }) : `${e.prefix}:${e.label}`;
1766
1767
  }
1767
- function rr({ activityLogs: e, formSchema: t = null, instanceState: n, memberProfilesById: r, signatureVerification: i, signaturesById: a, taskDecisions: o = null, taskDecisionsByTaskId: s, tasks: c, workflowSnapshot: l, workflowTokens: u }) {
1768
+ function or({ activityLogs: e, formSchema: t = null, instanceState: n, memberProfilesById: r, signatureVerification: i, signaturesById: a, taskDecisions: o = null, taskDecisionsByTaskId: s, tasks: c, workflowSnapshot: l, workflowTokens: u }) {
1768
1769
  let d = b(() => $(e, c, u, l, n, r, s, a, i, t, o), [
1769
1770
  e,
1770
1771
  t,
@@ -1777,27 +1778,27 @@ function rr({ activityLogs: e, formSchema: t = null, instanceState: n, memberPro
1777
1778
  c,
1778
1779
  l,
1779
1780
  u
1780
- ]), f = Q(d), p = d.map((e) => ({
1781
+ ]), f = Xt(d), p = d.map((e) => ({
1781
1782
  ...e,
1782
- descriptionParts: e.descriptionParts.filter(Z)
1783
+ descriptionParts: e.descriptionParts.filter(Q)
1783
1784
  }));
1784
- return /* @__PURE__ */ k("div", {
1785
- style: Yn,
1786
- children: [/* @__PURE__ */ O(E, {
1785
+ return /* @__PURE__ */ j("div", {
1786
+ style: Qn,
1787
+ children: [/* @__PURE__ */ A(O, {
1787
1788
  component: "h2",
1788
1789
  variant: "h3",
1789
1790
  children: "歷程"
1790
- }), p.length > 0 ? /* @__PURE__ */ O(xe, {
1791
+ }), p.length > 0 ? /* @__PURE__ */ A(Se, {
1791
1792
  currentStep: f,
1792
1793
  orientation: "vertical",
1793
1794
  type: "dot",
1794
- children: p.map((e) => /* @__PURE__ */ O(tr, {
1795
+ children: p.map((e) => /* @__PURE__ */ A(ir, {
1795
1796
  descriptionParts: e.descriptionParts,
1796
1797
  error: e.error,
1797
1798
  forcePending: e.forcePending,
1798
1799
  title: e.title
1799
1800
  }, e.id))
1800
- }) : /* @__PURE__ */ O(E, {
1801
+ }) : /* @__PURE__ */ A(O, {
1801
1802
  color: "text-neutral",
1802
1803
  variant: "body",
1803
1804
  children: "尚無歷程紀錄。"
@@ -1805,30 +1806,30 @@ function rr({ activityLogs: e, formSchema: t = null, instanceState: n, memberPro
1805
1806
  });
1806
1807
  }
1807
1808
  // src/views/instances/detail/sections/InstanceWebhookDeliveriesSection.tsx
1808
- var ir = {
1809
+ var sr = {
1809
1810
  display: "grid",
1810
1811
  gap: 16
1811
- }, ar = {
1812
+ }, cr = {
1812
1813
  display: "grid",
1813
1814
  gap: 2
1814
- }, or = {
1815
+ }, lr = {
1815
1816
  overflowWrap: "anywhere",
1816
1817
  whiteSpace: "pre-wrap"
1817
1818
  };
1818
- function sr({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1819
+ function ur({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1819
1820
  let [r, i] = x(null), [a, o] = x(!1), [s, c] = x(null), l = b(() => e.map((e) => ({
1820
1821
  delivery: e,
1821
1822
  key: e.id
1822
1823
  })), [e]), u = b(() => [
1823
1824
  {
1824
1825
  key: "endpoint",
1825
- render: ({ delivery: e }) => /* @__PURE__ */ k("div", {
1826
- style: ar,
1827
- children: [/* @__PURE__ */ O(E, {
1826
+ render: ({ delivery: e }) => /* @__PURE__ */ j("div", {
1827
+ style: cr,
1828
+ children: [/* @__PURE__ */ A(O, {
1828
1829
  component: "span",
1829
1830
  variant: "body",
1830
1831
  children: e.endpointLabel ?? e.endpointKey
1831
- }), /* @__PURE__ */ k(E, {
1832
+ }), /* @__PURE__ */ j(O, {
1832
1833
  color: "text-neutral",
1833
1834
  component: "span",
1834
1835
  variant: "caption",
@@ -1847,13 +1848,13 @@ function sr({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1847
1848
  },
1848
1849
  {
1849
1850
  key: "status",
1850
- render: ({ delivery: e }) => /* @__PURE__ */ O(cr, { status: e.status }),
1851
+ render: ({ delivery: e }) => /* @__PURE__ */ A(dr, { status: e.status }),
1851
1852
  title: "狀態",
1852
1853
  width: 120
1853
1854
  },
1854
1855
  {
1855
1856
  key: "attemptCount",
1856
- render: ({ delivery: e }) => /* @__PURE__ */ O(E, {
1857
+ render: ({ delivery: e }) => /* @__PURE__ */ A(O, {
1857
1858
  component: "span",
1858
1859
  variant: "body",
1859
1860
  children: e.attemptCount
@@ -1863,21 +1864,21 @@ function sr({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1863
1864
  },
1864
1865
  {
1865
1866
  key: "lastError",
1866
- render: ({ delivery: e }) => e.lastErrorCode && e.status !== "SENT" ? /* @__PURE__ */ k("div", {
1867
- style: ar,
1868
- children: [/* @__PURE__ */ O(E, {
1867
+ render: ({ delivery: e }) => e.lastErrorCode && e.status !== "SENT" ? /* @__PURE__ */ j("div", {
1868
+ style: cr,
1869
+ children: [/* @__PURE__ */ A(O, {
1869
1870
  color: "text-error",
1870
1871
  component: "span",
1871
1872
  variant: "body",
1872
1873
  children: e.lastErrorCode
1873
- }), e.lastErrorDetail ? /* @__PURE__ */ O(E, {
1874
+ }), e.lastErrorDetail ? /* @__PURE__ */ A(O, {
1874
1875
  color: "text-neutral",
1875
1876
  component: "span",
1876
- style: or,
1877
+ style: lr,
1877
1878
  variant: "caption",
1878
1879
  children: e.lastErrorDetail
1879
1880
  }) : null]
1880
- }) : /* @__PURE__ */ O(E, {
1881
+ }) : /* @__PURE__ */ A(O, {
1881
1882
  color: "text-neutral",
1882
1883
  component: "span",
1883
1884
  variant: "body",
@@ -1888,10 +1889,10 @@ function sr({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1888
1889
  },
1889
1890
  {
1890
1891
  key: "time",
1891
- render: ({ delivery: e }) => /* @__PURE__ */ O(E, {
1892
+ render: ({ delivery: e }) => /* @__PURE__ */ A(O, {
1892
1893
  component: "span",
1893
1894
  variant: "body",
1894
- children: lr(e)
1895
+ children: fr(e)
1895
1896
  }),
1896
1897
  title: "時間",
1897
1898
  width: 220
@@ -1899,7 +1900,7 @@ function sr({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1899
1900
  ], [n]), d = b(() => ({
1900
1901
  render: ({ delivery: e }) => e.status === "FAILED" && e.attemptCount > 0 ? [{
1901
1902
  disabled: () => a,
1902
- icon: at,
1903
+ icon: L,
1903
1904
  iconType: "leading",
1904
1905
  name: "重新傳送",
1905
1906
  onClick: () => {
@@ -1921,30 +1922,30 @@ function sr({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1921
1922
  }
1922
1923
  }
1923
1924
  }
1924
- return /* @__PURE__ */ k("div", {
1925
- style: ir,
1925
+ return /* @__PURE__ */ j("div", {
1926
+ style: sr,
1926
1927
  children: [
1927
- /* @__PURE__ */ O(E, {
1928
+ /* @__PURE__ */ A(O, {
1928
1929
  component: "h2",
1929
1930
  variant: "h3",
1930
1931
  children: "外部系統通知"
1931
1932
  }),
1932
- s ? /* @__PURE__ */ O(E, {
1933
+ s ? /* @__PURE__ */ A(O, {
1933
1934
  color: "text-error",
1934
1935
  variant: "body",
1935
1936
  children: s
1936
1937
  }) : null,
1937
- l.length > 0 ? /* @__PURE__ */ O(Se, {
1938
+ l.length > 0 ? /* @__PURE__ */ A(D, {
1938
1939
  actions: d,
1939
1940
  columns: u,
1940
1941
  dataSource: l,
1941
1942
  fullWidth: !0
1942
- }) : /* @__PURE__ */ O(E, {
1943
+ }) : /* @__PURE__ */ A(O, {
1943
1944
  color: "text-neutral",
1944
1945
  variant: "body",
1945
1946
  children: "此案件沒有外部系統通知。"
1946
1947
  }),
1947
- /* @__PURE__ */ O(w, {
1948
+ /* @__PURE__ */ A(T, {
1948
1949
  cancelText: "取消",
1949
1950
  confirmText: "重新傳送",
1950
1951
  loading: a,
@@ -1958,7 +1959,7 @@ function sr({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1958
1959
  showModalHeader: !0,
1959
1960
  supportingText: "會以相同的投遞編號重新送出,接收端可據此避免重複處理。",
1960
1961
  title: "重新傳送通知",
1961
- children: /* @__PURE__ */ k(E, {
1962
+ children: /* @__PURE__ */ j(O, {
1962
1963
  variant: "body",
1963
1964
  children: [
1964
1965
  "確定要重新通知「",
@@ -1970,47 +1971,48 @@ function sr({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1970
1971
  ]
1971
1972
  });
1972
1973
  }
1973
- function cr({ status: e }) {
1974
- return e === "SENT" ? /* @__PURE__ */ O(pe, {
1974
+ function dr({ status: e }) {
1975
+ return e === "SENT" ? /* @__PURE__ */ A(he, {
1975
1976
  size: "sub",
1976
1977
  text: "已送達",
1977
1978
  variant: "dot-success"
1978
- }) : e === "FAILED" ? /* @__PURE__ */ O(pe, {
1979
+ }) : e === "FAILED" ? /* @__PURE__ */ A(he, {
1979
1980
  size: "sub",
1980
1981
  text: "失敗",
1981
1982
  variant: "dot-error"
1982
- }) : /* @__PURE__ */ O(pe, {
1983
+ }) : /* @__PURE__ */ A(he, {
1983
1984
  size: "sub",
1984
1985
  text: e === "PENDING" ? "等待傳送" : "傳送中",
1985
1986
  variant: "dot-info"
1986
1987
  });
1987
1988
  }
1988
- function lr(e) {
1989
+ function fr(e) {
1989
1990
  return e.sentAt ? `送達:${t(e.sentAt)}` : e.status === "PENDING" && e.nextRetryAt ? `下次重試:${t(e.nextRetryAt)}` : e.lastAttemptAt ? `最後嘗試:${t(e.lastAttemptAt)}` : `建立:${t(e.createdAt)}`;
1990
1991
  }
1991
1992
  // src/views/instances/viewer-field-access.ts
1992
- function ur(e, t) {
1993
+ function pr(e, t) {
1993
1994
  let n = new Map(t.map((e) => [e.id, e]));
1994
1995
  return new Set(e.filter((e) => e.eventType === "TASK_CREATED").map((e) => e.taskId === null ? void 0 : n.get(e.taskId)).filter((e) => e !== void 0 && !e.isAdhoc).map((e) => e.nodeId));
1995
1996
  }
1996
- function dr({ activityLogs: e, actingTask: t, instance: n, tasks: r }) {
1997
+ function mr({ activityLogs: e, actingTask: t, instance: n, tasks: r }) {
1997
1998
  let i = n.workflowSnapshot;
1998
1999
  return qe({
1999
2000
  definition: i,
2000
2001
  fieldKeys: (n.formDefinitionSnapshot.schema?.fields ?? []).map((e) => e.fieldKey),
2001
2002
  isAdhocTask: t?.isAdhoc ?? !1,
2002
2003
  nodeId: t?.nodeId ?? null,
2003
- revealedFieldKeys: Ke(i, ur(e, r))
2004
+ revealedFieldKeys: N(i, pr(e, r))
2004
2005
  });
2005
2006
  }
2006
2007
  // src/views/instances/detail/InstanceDetailView.tsx
2007
- function fr(e) {
2008
- return `還有 ${new Set(Object.keys(e).map(j)).size} 個補填欄位需要完成`;
2008
+ var hr = "補填時不能新增、刪除或調整明細列的順序,請只修改開放的欄位。";
2009
+ function gr(e) {
2010
+ return `還有 ${new Set(Object.keys(e).map(P)).size} 個補填欄位需要完成`;
2009
2011
  }
2010
- var pr = 3e3, mr = 40, hr = 184, gr = 96, _r = {
2012
+ var _r = 3e3, vr = 40, yr = 184, br = 96, xr = {
2011
2013
  display: "grid",
2012
2014
  gap: 16
2013
- }, vr = {
2015
+ }, Sr = {
2014
2016
  background: "#f8fafc",
2015
2017
  border: "1px solid #e2e8f0",
2016
2018
  borderRadius: 8,
@@ -2018,7 +2020,7 @@ var pr = 3e3, mr = 40, hr = 184, gr = 96, _r = {
2018
2020
  minHeight: 440,
2019
2021
  overflow: "hidden",
2020
2022
  width: "min(80vw, 1040px)"
2021
- }, yr = {
2023
+ }, Cr = {
2022
2024
  background: "#ffffff",
2023
2025
  border: "1px solid #cbd5e1",
2024
2026
  borderRadius: 8,
@@ -2028,24 +2030,24 @@ var pr = 3e3, mr = 40, hr = 184, gr = 96, _r = {
2028
2030
  minHeight: 82,
2029
2031
  padding: 12,
2030
2032
  width: 184
2031
- }, br = {
2033
+ }, wr = {
2032
2034
  borderRadius: 999,
2033
2035
  fontSize: 12,
2034
2036
  fontWeight: 600,
2035
2037
  justifySelf: "start",
2036
2038
  lineHeight: "18px",
2037
2039
  padding: "0 8px"
2038
- }, xr = {
2040
+ }, Tr = {
2039
2041
  color: "#64748b",
2040
2042
  fontSize: 12,
2041
2043
  overflow: "hidden",
2042
2044
  textOverflow: "ellipsis",
2043
2045
  whiteSpace: "nowrap"
2044
- }, Sr = { opacity: 0 }, Cr = {
2046
+ }, Er = { opacity: 0 }, Dr = {
2045
2047
  display: "flex",
2046
2048
  flexWrap: "wrap",
2047
2049
  gap: 8
2048
- }, wr = {
2050
+ }, Or = {
2049
2051
  alignItems: "center",
2050
2052
  background: "#ffffff",
2051
2053
  border: "1px solid #cbd5e1",
@@ -2057,29 +2059,29 @@ var pr = 3e3, mr = 40, hr = 184, gr = 96, _r = {
2057
2059
  gap: 6,
2058
2060
  lineHeight: "20px",
2059
2061
  padding: "4px 8px"
2060
- }, Tr = {
2062
+ }, kr = {
2061
2063
  display: "grid",
2062
2064
  gap: 16
2063
- }, Er = { workflowRuntime: Ir };
2064
- function Dr({ instanceId: a, showAttachments: s = !0, showForm: l = !0, showHistory: u = !0, showSignatures: d = !0, showTasks: f = !0, showWebhookDeliveries: p = !0 }) {
2065
- let { member: se } = n(), y = se?.memberId ?? null, ue = p && r(se), [fe, pe] = x([]), [C, me] = x(null), [he, ge] = x([]), [be, xe] = x([]), [Se, we] = x([]), [Te, Ee] = x([]), [Oe, ke] = x(null), [A, Me] = x([]), [Re, ze] = x([]), [Be, Ue] = x([]), [Ke, j] = x(null), [qe, Qe] = x(!0), [$e, N] = x(!1), [tt, at] = x(!1), [ot, st] = x(!1), [ct, I] = x(!1), [L, ft] = x(""), [pt, mt] = x(!1), [ht, R] = x({}), [z, _t] = x({}), { clearAfterResubmit: vt, comment: yt, setComment: bt } = Tn(a), [xt, St] = x({}), [B, V] = x(null), [wt, Et] = x(null), [Dt, H] = x([]), Ot = L.trim(), U = de(null), kt = de(0), At = Te.some((e) => e.status === "PENDING" || e.status === "DELIVERY_IN_PROGRESS");
2066
- le(() => {
2067
- dn();
2068
- }, [y, a]), le(() => {
2069
- if (!ue || !At || kt.current >= mr) return;
2065
+ }, Ar = { workflowRuntime: Br };
2066
+ function jr({ instanceId: a, showAttachments: s = !0, showForm: l = !0, showHistory: u = !0, showSignatures: d = !0, showTasks: f = !0, showWebhookDeliveries: p = !0 }) {
2067
+ let { member: le } = n(), y = le?.memberId ?? null, fe = p && r(le), [me, he] = x([]), [C, ge] = x(null), [_e, ve] = x([]), [xe, Se] = x([]), [D, we] = x([]), [Te, Ee] = x([]), [De, ke] = x(null), [M, Ae] = x([]), [Ne, ze] = x([]), [Be, Ve] = x([]), [We, N] = x(null), [P, qe] = x(!0), [$e, F] = x(!1), [tt, nt] = x(!1), [L, st] = x(!1), [ct, lt] = x(!1), [ft, R] = x(""), [mt, ht] = x(!1), [gt, _t] = x({}), [z, B] = x({}), { clearAfterResubmit: yt, comment: bt, setComment: xt } = On(a), [St, Ct] = x({}), [wt, Tt] = x(null), [Dt, Ot] = x(null), [At, jt] = x([]), V = ft.trim(), H = pe(null), Mt = pe(0), W = Te.some((e) => e.status === "PENDING" || e.status === "DELIVERY_IN_PROGRESS");
2068
+ de(() => {
2069
+ mn();
2070
+ }, [y, a]), de(() => {
2071
+ if (!fe || !W || Mt.current >= vr) return;
2070
2072
  let e = setTimeout(() => {
2071
- kt.current += 1, mn();
2072
- }, pr);
2073
+ Mt.current += 1, _n();
2074
+ }, _r);
2073
2075
  return () => clearTimeout(e);
2074
2076
  }, [
2075
- ue,
2076
- At,
2077
+ fe,
2078
+ W,
2077
2079
  Te
2078
- ]), le(() => {
2079
- _t(C?.formData ?? {}), St({});
2080
+ ]), de(() => {
2081
+ B(C?.formData ?? {}), Ct({});
2080
2082
  }, [C]);
2081
- let jt = ce((e, t) => {
2082
- St((n) => {
2083
+ let Nt = ue((e, t) => {
2084
+ Ct((n) => {
2083
2085
  let r = n[e];
2084
2086
  return r?.hasValue === t.hasValue && r.selectionExpired === (t.selectionExpired === !0) && r.status === t.status ? n : {
2085
2087
  ...n,
@@ -2090,281 +2092,285 @@ function Dr({ instanceId: a, showAttachments: s = !0, showForm: l = !0, showHist
2090
2092
  }
2091
2093
  };
2092
2094
  });
2093
- }, []), G = b(() => Bt(A, y), [y, A]), K = b(() => G && C ? C.workflowSnapshot.nodes.find((e) => e.id === G.nodeId) ?? null : null, [G, C]), Nt = K?.type === "userTask" && K.data.returnBehavior.allowReturn, Pt = K?.type === "userTask" && K.data.allowReject !== !1, It = K?.type === "userTask" && K.data.allowTransfer !== !1, Lt = K?.type === "userTask" && K.data.allowAddSigner, Rt = !(!C || C.initiatorMemberId !== y || C.state !== "RUNNING" && C.state !== "RETURNED"), zt = !!(C && C.initiatorMemberId === y && C.state === "RETURNED"), J = b(() => G && !G.isAdhoc && K?.type === "userTask" && Ge(K).size > 0 ? K : null, [G, K]), Vt = J ? G?.id ?? null : null, Ht = o(), [Ut, Wt] = x({}), [Gt, Y] = x({}), [Kt, qt] = x(!1);
2094
- le(() => {
2095
- Wt({}), Y({}), qt(!1);
2096
- }, [Vt]);
2097
- let X = C?.formDefinitionSnapshot.schema ?? null, Z = b(() => J && X ? ie(X, J) : null, [J, X]), Q = b(() => Z && C ? Je(Z.fields, {
2095
+ }, []), G = b(() => Ht(M, y), [y, M]), K = b(() => G && C ? C.workflowSnapshot.nodes.find((e) => e.id === G.nodeId) ?? null : null, [G, C]), Ft = K?.type === "userTask" && K.data.returnBehavior.allowReturn, It = K?.type === "userTask" && K.data.allowReject !== !1, Lt = K?.type === "userTask" && K.data.allowTransfer !== !1, zt = K?.type === "userTask" && K.data.allowAddSigner, Bt = !(!C || C.initiatorMemberId !== y || C.state !== "RUNNING" && C.state !== "RETURNED"), Vt = !!(C && C.initiatorMemberId === y && C.state === "RETURNED"), J = b(() => G && !G.isAdhoc && K?.type === "userTask" && Ke(K).size > 0 ? K : null, [G, K]), Ut = J ? G?.id ?? null : null, Wt = o(), [Gt, Kt] = x({}), [qt, Jt] = x({}), [Y, Yt] = x(!1);
2096
+ de(() => {
2097
+ Kt({}), Jt({}), Yt(!1);
2098
+ }, [Ut]);
2099
+ let X = C?.formDefinitionSnapshot.schema ?? null, Z = b(() => J && X ? h(X, J) : null, [J, X]), Q = b(() => Z && C ? Ye(Z.fields, {
2098
2100
  ...C.formData,
2099
- ...Ut
2101
+ ...Gt
2100
2102
  }) : null, [
2101
- Ut,
2103
+ Gt,
2102
2104
  Z,
2103
2105
  C
2104
- ]), Jt = b(() => J && Z && Q && C ? m({
2105
- draft: Ut,
2106
+ ]), Xt = b(() => J && Z && Q && C ? ae({
2107
+ draft: Gt,
2106
2108
  node: J,
2107
2109
  schema: Z,
2108
2110
  stored: C.formData,
2109
2111
  values: Q
2110
2112
  }) : {}, [
2111
- Ut,
2113
+ Gt,
2112
2114
  J,
2113
2115
  Z,
2114
2116
  Q,
2115
2117
  C
2116
- ]), Yt = b(() => C ? dr({
2117
- activityLogs: fe,
2118
+ ]), Zt = b(() => C ? mr({
2119
+ activityLogs: me,
2118
2120
  actingTask: G,
2119
2121
  instance: C,
2120
- tasks: A
2122
+ tasks: M
2121
2123
  }) : void 0, [
2122
- fe,
2124
+ me,
2123
2125
  G,
2124
2126
  C,
2125
- A
2126
- ]), Xt = b(() => C ? oe(C.workflowSnapshot, J) : void 0, [J, C]), Zt = b(() => new Map(Be.map((e) => [e.memberId, e])), [Be]), Qt = gt(b(() => X ? h(X, Jt) : [], [Jt, X])), $t = b(() => J && Q && X && C?.formDataFingerprint ? {
2127
+ M
2128
+ ]), Qt = b(() => J ? Object.fromEntries([...se(J)].map((e) => [e, {
2129
+ editableColumns: [...ce(J, e).keys()],
2130
+ lockRows: !0
2131
+ }])) : void 0, [J]), $t = b(() => C ? re(C.workflowSnapshot, J) : void 0, [J, C]), en = b(() => new Map(Be.map((e) => [e.memberId, e])), [Be]), tn = vt(b(() => X ? g(X, Xt) : [], [Xt, X])), nn = b(() => J && Q && X && C?.formDataFingerprint ? {
2127
2132
  expectedFormDataFingerprint: C.formDataFingerprint,
2128
- formData: ne(Jt, J),
2129
- summary: g(X, J, Jt, new Map([...Zt.keys()].map((e) => [e, q(e, Zt)])), Qt)
2133
+ formData: ee(Xt, J, C.formData),
2134
+ summary: ie(X, J, Xt, new Map([...en.keys()].map((e) => [e, q(e, en)])), tn)
2130
2135
  } : null, [
2131
- Jt,
2136
+ Xt,
2132
2137
  J,
2133
- Qt,
2138
+ tn,
2134
2139
  Q,
2135
2140
  C,
2136
- Zt,
2141
+ en,
2137
2142
  X
2138
2143
  ]);
2139
- function en(e) {
2144
+ function rn(e) {
2140
2145
  if (!J) return;
2141
- let t = Ge(J), n = Object.entries(e).filter(([e, n]) => t.has(e) && JSON.stringify(n) !== JSON.stringify(Q?.[e]));
2142
- Wt((e) => ({
2146
+ let t = Ke(J), n = Object.entries(e).filter(([e, n]) => t.has(e) && JSON.stringify(n) !== JSON.stringify(Q?.[e]));
2147
+ Kt((e) => ({
2143
2148
  ...e,
2144
2149
  ...Object.fromEntries(n)
2145
- })), Y({});
2150
+ })), Jt({});
2146
2151
  }
2147
- async function tn() {
2148
- if (J && !C?.formDataFingerprint) _e.error("無法確認表單版本,請重新整理頁面後再同意。");
2152
+ async function an() {
2153
+ if (J && !C?.formDataFingerprint) w.error("無法確認表單版本,請重新整理頁面後再同意。");
2149
2154
  else {
2150
2155
  if (J && Q && X && C?.formDefinitionSnapshot.uiSchema) {
2151
- at(!0);
2152
- let e = await Xe({
2153
- schema: ee(X, J),
2156
+ nt(!0);
2157
+ let e = await Ze({
2158
+ schema: te(X, J),
2154
2159
  uiSchema: C.formDefinitionSnapshot.uiSchema,
2155
2160
  values: Q
2156
- }).catch((e) => (_e.error(_(e)), null)).finally(() => at(!1));
2161
+ }).catch((e) => (w.error(v(e)), null)).finally(() => nt(!1));
2157
2162
  if (!e) return;
2158
2163
  if (!e.valid) {
2159
- Y(e.errors), e.firstInvalidFieldKey && Ye(e.firstInvalidFieldKey), _e.warning(fr(e.errors));
2164
+ Jt(e.errors), e.firstInvalidFieldKey && Xe(e.firstInvalidFieldKey), w.warning(gr(e.errors));
2160
2165
  return;
2161
2166
  }
2162
2167
  }
2163
- U.current?.handleApprove();
2168
+ H.current?.handleApprove();
2164
2169
  }
2165
2170
  }
2166
- function nn(e, t = []) {
2171
+ function on(e, t = [], n = null) {
2167
2172
  if (!J || !X) return !1;
2168
- if (re(e)) return qt(!0), !0;
2169
- let n = v(e, X, J, t);
2170
- return n ? (Y(n), Ye(Object.keys(n)[0] ?? ""), _e.warning(fr(n)), !0) : !1;
2173
+ if (n === "FORM_FIELD_ACCESS_TABLE_ROWS_LOCKED") return w.warning(hr), !0;
2174
+ if (_(e)) return Yt(!0), !0;
2175
+ let r = oe(e, X, J, t);
2176
+ return r ? (Jt(r), Xe(Object.keys(r)[0] ?? ""), w.warning(gr(r)), !0) : !1;
2171
2177
  }
2172
- async function rn() {
2173
- await dn(), qt(!1);
2178
+ async function sn() {
2179
+ await mn(), Yt(!1);
2174
2180
  }
2175
- let an = b(() => c(he), [he]), on = b(() => new Map(Se.map((e) => [e.id, e])), [Se]), sn = b(() => C ? Mr(C.workflowSnapshot) : null, [C]), cn = b(() => C && sn ? jr(sn, A, Re, C.state) : [], [
2181
+ let cn = b(() => c(_e), [_e]), ln = b(() => new Map(D.map((e) => [e.id, e])), [D]), un = b(() => C ? Ir(C.workflowSnapshot) : null, [C]), dn = b(() => C && un ? Fr(un, M, Ne, C.state) : [], [
2176
2182
  C,
2177
- sn,
2178
- A,
2179
- Re
2180
- ]), ln = b(() => sn ? Nr(sn) : [], [sn]), un = b(() => C ? kr(C.workflowSnapshot) : [], [C]);
2181
- async function dn() {
2182
- Qe(!0), j(null);
2183
+ un,
2184
+ M,
2185
+ Ne
2186
+ ]), fn = b(() => un ? Lr(un) : [], [un]), pn = b(() => C ? Nr(C.workflowSnapshot) : [], [C]);
2187
+ async function mn() {
2188
+ qe(!0), N(null);
2183
2189
  try {
2184
- let e = await Pe(a);
2185
- pe(e.activityLogs), me(e.instance), Me(e.tasks), ze(e.workflowTokens);
2186
- let t = await Ae(e.instance.id), [n, r, i, o, s] = await Promise.all([
2187
- wn(e.tasks),
2188
- Sn({
2190
+ let e = await Fe(a);
2191
+ he(e.activityLogs), ge(e.instance), Ae(e.tasks), ze(e.workflowTokens);
2192
+ let t = await je(e.instance.id), [n, r, i, o, s] = await Promise.all([
2193
+ Dn(e.tasks),
2194
+ Tn({
2189
2195
  ...e,
2190
2196
  adhocDirectives: t
2191
2197
  }),
2192
- je(e.instance.id),
2193
- Le(e.instance.id),
2194
- fn(e.instance.id)
2198
+ Me(e.instance.id),
2199
+ Re(e.instance.id),
2200
+ hn(e.instance.id)
2195
2201
  ]);
2196
- ge(n), Ue(r), xe(i), we(o.signatures), ke(o.verification), H(t), Ee(s);
2202
+ ve(n), Ve(r), Se(i), we(o.signatures), ke(o.verification), jt(t), Ee(s);
2197
2203
  } catch (e) {
2198
- j(_(e));
2204
+ N(v(e));
2199
2205
  } finally {
2200
- Qe(!1);
2206
+ qe(!1);
2201
2207
  }
2202
2208
  }
2203
- async function fn(e) {
2204
- return ue ? Ne(e).catch(() => []) : [];
2209
+ async function hn(e) {
2210
+ return fe ? Pe(e).catch(() => []) : [];
2205
2211
  }
2206
- async function pn(e) {
2207
- await He(e.id), kt.current = 0, await dn();
2212
+ async function gn(e) {
2213
+ await Ue(e.id), Mt.current = 0, await mn();
2208
2214
  }
2209
- async function mn() {
2210
- let e = await fn(a);
2211
- e.some((e) => e.status === "PENDING" || e.status === "DELIVERY_IN_PROGRESS") ? Ee(e) : await dn();
2215
+ async function _n() {
2216
+ let e = await hn(a);
2217
+ e.some((e) => e.status === "PENDING" || e.status === "DELIVERY_IN_PROGRESS") ? Ee(e) : await mn();
2212
2218
  }
2213
- async function hn(e, t) {
2219
+ async function vn(e, t) {
2214
2220
  if (!y) throw Error("尚未登入,無法上傳附件");
2215
- return { id: (await We({
2221
+ return { id: (await Ge({
2216
2222
  file: t,
2217
2223
  formFieldPath: `form.${e.fieldKey}`
2218
2224
  })).id };
2219
2225
  }
2220
- async function gn(e) {
2226
+ async function yn(e) {
2221
2227
  if (y) try {
2222
- let t = await Fe({ id: e });
2228
+ let t = await Ie({ id: e });
2223
2229
  window.open(t, "_blank", "noopener,noreferrer");
2224
2230
  } catch (e) {
2225
- _e.error(_(e));
2231
+ w.error(v(e));
2226
2232
  }
2227
2233
  }
2228
- async function _n(e) {
2234
+ async function bn(e) {
2229
2235
  if (!y) return;
2230
- let t = await Ie({ id: e.id });
2231
- V(e), Et(t);
2236
+ let t = await Le({ id: e.id });
2237
+ Tt(e), Ot(t);
2232
2238
  }
2233
- async function vn() {
2234
- if (y && C && Rt) {
2235
- N(!0), j(null), R({});
2239
+ async function xn() {
2240
+ if (y && C && Bt) {
2241
+ F(!0), N(null), _t({});
2236
2242
  try {
2237
- await De({
2243
+ await Oe({
2238
2244
  cancelledByMemberId: y,
2239
- comment: Ot || null,
2245
+ comment: V || null,
2240
2246
  instanceId: C.id
2241
- }), ft(""), mt(!1), await dn();
2247
+ }), R(""), ht(!1), await mn();
2242
2248
  } catch (e) {
2243
- j(_(e));
2249
+ N(v(e));
2244
2250
  } finally {
2245
- N(!1);
2251
+ F(!1);
2246
2252
  }
2247
2253
  }
2248
2254
  }
2249
- async function yn() {
2250
- if (!y || !C || !zt) return;
2251
- N(!0), j(null), R({});
2252
- let e = i(Object.values(xt));
2255
+ async function Sn() {
2256
+ if (!y || !C || !Vt) return;
2257
+ F(!0), N(null), _t({});
2258
+ let e = i(Object.values(St));
2253
2259
  if (e) {
2254
- j(e), N(!1);
2260
+ N(e), F(!1);
2255
2261
  return;
2256
2262
  }
2257
- if (Ht.blockMessage) {
2258
- j(Ht.blockMessage), N(!1);
2263
+ if (Wt.blockMessage) {
2264
+ N(Wt.blockMessage), F(!1);
2259
2265
  return;
2260
2266
  }
2261
- let t = C.formDefinitionSnapshot.schema ? ae(C.formDefinitionSnapshot.schema, C.workflowSnapshot) : null, n = te(t ? Je(t.fields, z) : z, C.workflowSnapshot);
2267
+ let t = C.formDefinitionSnapshot.schema ? ne(C.formDefinitionSnapshot.schema, C.workflowSnapshot) : null, n = m(t ? Ye(t.fields, z) : z, C.workflowSnapshot);
2262
2268
  try {
2263
2269
  if (t && C.formDefinitionSnapshot.uiSchema) {
2264
- let e = await Xe({
2270
+ let e = await Ze({
2265
2271
  schema: t,
2266
2272
  uiSchema: C.formDefinitionSnapshot.uiSchema,
2267
2273
  values: n
2268
2274
  });
2269
2275
  if (!e.valid) {
2270
- R(e.errors), j("請先修正表單中標示的欄位。"), e.firstInvalidFieldKey && Ye(e.firstInvalidFieldKey);
2276
+ _t(e.errors), N("請先修正表單中標示的欄位。"), e.firstInvalidFieldKey && Xe(e.firstInvalidFieldKey);
2271
2277
  return;
2272
2278
  }
2273
2279
  }
2274
- await Ve({
2275
- comment: yt,
2280
+ await He({
2281
+ comment: bt,
2276
2282
  formData: n,
2277
2283
  initiatorMemberId: y,
2278
2284
  instanceId: C.id,
2279
2285
  title: C.title
2280
- }), vt(C.id), await dn();
2286
+ }), yt(C.id), await mn();
2281
2287
  } catch (e) {
2282
- j(_(e));
2288
+ N(v(e));
2283
2289
  } finally {
2284
- N(!1);
2290
+ F(!1);
2285
2291
  }
2286
2292
  }
2287
- let $ = $e || ot || tt;
2288
- return /* @__PURE__ */ k(D, { children: [
2289
- /* @__PURE__ */ O(ve, { children: /* @__PURE__ */ k(M, {
2293
+ let $ = $e || L || tt;
2294
+ return /* @__PURE__ */ j(k, { children: [
2295
+ /* @__PURE__ */ A(ye, { children: /* @__PURE__ */ j(Je, {
2290
2296
  description: C ? [
2291
- Mt(C.state),
2297
+ Pt(C.state),
2292
2298
  t(C.startedAt),
2293
- Tt(C, Zt)
2294
- ].filter(W).join(" · ") : "載入案件內容。",
2299
+ kt(C, en)
2300
+ ].filter(U).join(" · ") : "載入案件內容。",
2295
2301
  title: C?.title ?? "簽核案件",
2296
2302
  children: [
2297
- C ? /* @__PURE__ */ O(S, {
2303
+ C ? /* @__PURE__ */ A(S, {
2298
2304
  "aria-label": "查看流程圖",
2299
- icon: P,
2305
+ icon: at,
2300
2306
  iconType: "icon-only",
2301
- onClick: () => I(!0),
2307
+ onClick: () => lt(!0),
2302
2308
  title: "查看流程圖",
2303
2309
  variant: "base-secondary",
2304
2310
  children: "流程圖"
2305
2311
  }) : null,
2306
- Rt ? /* @__PURE__ */ O(S, {
2312
+ Bt ? /* @__PURE__ */ A(S, {
2307
2313
  disabled: $,
2308
2314
  icon: et,
2309
2315
  iconType: "leading",
2310
- onClick: () => mt(!0),
2316
+ onClick: () => ht(!0),
2311
2317
  variant: "destructive-secondary",
2312
2318
  children: "取消案件"
2313
2319
  }) : null,
2314
- G ? /* @__PURE__ */ k(D, { children: [
2315
- Lt ? /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O(S, {
2320
+ G ? /* @__PURE__ */ j(k, { children: [
2321
+ zt ? /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A(S, {
2316
2322
  disabled: $,
2317
- icon: rt,
2323
+ icon: it,
2318
2324
  iconType: "leading",
2319
- onClick: () => U.current?.openAdhocModal("COUNTERSIGN"),
2325
+ onClick: () => H.current?.openAdhocModal("COUNTERSIGN"),
2320
2326
  variant: "base-secondary",
2321
2327
  children: "會簽"
2322
- }, "adhoc-countersign"), /* @__PURE__ */ O(S, {
2328
+ }, "adhoc-countersign"), /* @__PURE__ */ A(S, {
2323
2329
  disabled: $,
2324
- icon: rt,
2330
+ icon: it,
2325
2331
  iconType: "leading",
2326
- onClick: () => U.current?.openAdhocModal("PRE_APPROVAL"),
2332
+ onClick: () => H.current?.openAdhocModal("PRE_APPROVAL"),
2327
2333
  variant: "base-secondary",
2328
2334
  children: "加簽"
2329
2335
  }, "adhoc-pre-approval")] }) : null,
2330
- /* @__PURE__ */ O(S, {
2336
+ /* @__PURE__ */ A(S, {
2331
2337
  disabled: $,
2332
- icon: nt,
2338
+ icon: rt,
2333
2339
  iconType: "leading",
2334
- onClick: () => U.current?.openAdhocModal("STAGE_NOTIFY"),
2340
+ onClick: () => H.current?.openAdhocModal("STAGE_NOTIFY"),
2335
2341
  variant: "base-secondary",
2336
2342
  children: "通知設定"
2337
2343
  }, "adhoc-notify"),
2338
- Nt ? /* @__PURE__ */ O(S, {
2344
+ Ft ? /* @__PURE__ */ A(S, {
2339
2345
  disabled: $,
2340
- icon: it,
2346
+ icon: I,
2341
2347
  iconType: "leading",
2342
- onClick: () => U.current?.openReturnModal(),
2348
+ onClick: () => H.current?.openReturnModal(),
2343
2349
  variant: "base-secondary",
2344
2350
  children: "退回"
2345
2351
  }, "task-return") : null,
2346
- It ? /* @__PURE__ */ O(S, {
2352
+ Lt ? /* @__PURE__ */ A(S, {
2347
2353
  disabled: $,
2348
- icon: F,
2354
+ icon: ot,
2349
2355
  iconType: "leading",
2350
- onClick: () => U.current?.openTransferModal(),
2356
+ onClick: () => H.current?.openTransferModal(),
2351
2357
  variant: "base-secondary",
2352
2358
  children: "轉派"
2353
2359
  }, "task-transfer") : null,
2354
- Pt ? /* @__PURE__ */ O(S, {
2360
+ It ? /* @__PURE__ */ A(S, {
2355
2361
  disabled: $,
2356
2362
  icon: et,
2357
2363
  iconType: "leading",
2358
- onClick: () => U.current?.openRejectModal(),
2364
+ onClick: () => H.current?.openRejectModal(),
2359
2365
  variant: "destructive-secondary",
2360
2366
  children: "拒絕"
2361
2367
  }, "task-reject") : null,
2362
- /* @__PURE__ */ O(S, {
2368
+ /* @__PURE__ */ A(S, {
2363
2369
  disabled: $,
2364
- icon: Ze,
2370
+ icon: Qe,
2365
2371
  iconType: "leading",
2366
2372
  onClick: () => {
2367
- tn();
2373
+ an();
2368
2374
  },
2369
2375
  variant: "base-primary",
2370
2376
  children: "同意"
@@ -2372,188 +2378,189 @@ function Dr({ instanceId: a, showAttachments: s = !0, showForm: l = !0, showHist
2372
2378
  ] }) : null
2373
2379
  ]
2374
2380
  }) }),
2375
- /* @__PURE__ */ k(ye, { children: [
2376
- l ? /* @__PURE__ */ O(T, { children: /* @__PURE__ */ O(jn, {
2377
- attachments: be,
2378
- canResubmitInstance: zt,
2381
+ /* @__PURE__ */ j(be, { children: [
2382
+ l ? /* @__PURE__ */ A(E, { children: /* @__PURE__ */ A(Pn, {
2383
+ attachments: xe,
2384
+ canResubmitInstance: Vt,
2379
2385
  deciding: $e,
2380
- error: Ke,
2381
- fieldAccess: Yt,
2382
- fieldLabelMarkers: Xt,
2386
+ error: We,
2387
+ fieldAccess: Zt,
2388
+ fieldLabelMarkers: $t,
2383
2389
  fill: Z && Q && J ? {
2384
- errors: Gt,
2385
- fieldCount: Ge(J).size,
2386
- onChange: en,
2390
+ errors: qt,
2391
+ fieldCount: Ke(J).size,
2392
+ onChange: rn,
2387
2393
  schema: Z,
2394
+ tableAccess: Qt,
2388
2395
  value: Q
2389
2396
  } : null,
2390
2397
  instance: C,
2391
- loading: qe,
2392
- onDataSourceStateChange: jt,
2398
+ loading: P,
2399
+ onDataSourceStateChange: Nt,
2393
2400
  onDownloadAttachment: (e) => {
2394
- gn(e);
2401
+ yn(e);
2395
2402
  },
2396
- onFileUploadStateChange: Ht.onFileUploadStateChange,
2397
- onReloadAfterConflict: Kt ? () => void rn() : null,
2403
+ onFileUploadStateChange: Wt.onFileUploadStateChange,
2404
+ onReloadAfterConflict: Y ? () => void sn() : null,
2398
2405
  onResubmitFormChange: (e) => {
2399
- _t(e), R({});
2406
+ B(e), _t({});
2400
2407
  },
2401
- onResubmitCommentChange: bt,
2402
- onResubmitInstance: () => void yn(),
2403
- onUploadAttachment: hn,
2404
- resubmitComment: yt,
2408
+ onResubmitCommentChange: xt,
2409
+ onResubmitInstance: () => void Sn(),
2410
+ onUploadAttachment: vn,
2411
+ resubmitComment: bt,
2405
2412
  resubmitFormData: z,
2406
- resubmitFormErrors: ht
2413
+ resubmitFormErrors: gt
2407
2414
  }) }) : null,
2408
- s ? /* @__PURE__ */ O(T, { children: /* @__PURE__ */ O(Nn, {
2409
- attachments: be,
2415
+ s ? /* @__PURE__ */ A(E, { children: /* @__PURE__ */ A(In, {
2416
+ attachments: xe,
2410
2417
  onDownload: (e) => {
2411
- gn(e.id);
2418
+ yn(e.id);
2412
2419
  },
2413
2420
  onPreview: (e) => {
2414
- _n(e);
2421
+ bn(e);
2415
2422
  }
2416
2423
  }) }) : null,
2417
- f ? /* @__PURE__ */ O(T, { children: /* @__PURE__ */ O(Wn, {
2418
- adhocDirectives: Dt,
2424
+ f ? /* @__PURE__ */ A(E, { children: /* @__PURE__ */ A(qn, {
2425
+ adhocDirectives: At,
2419
2426
  currentMemberId: y,
2420
- fill: $t,
2427
+ fill: nn,
2421
2428
  instance: C,
2422
- memberProfilesById: Zt,
2423
- onChanged: dn,
2429
+ memberProfilesById: en,
2430
+ onChanged: mn,
2424
2431
  onDecidingChange: st,
2425
- onFillApproveError: nn,
2426
- ref: U,
2427
- tasks: A
2432
+ onFillApproveError: on,
2433
+ ref: H,
2434
+ tasks: M
2428
2435
  }) }) : null,
2429
- d ? /* @__PURE__ */ O(T, { children: /* @__PURE__ */ O(Jn, {
2430
- signatureVerification: Oe,
2431
- signatures: Se
2436
+ d ? /* @__PURE__ */ A(E, { children: /* @__PURE__ */ A(Zn, {
2437
+ signatureVerification: De,
2438
+ signatures: D
2432
2439
  }) }) : null,
2433
- ue && Te.length > 0 ? /* @__PURE__ */ O(T, { children: /* @__PURE__ */ O(sr, {
2440
+ fe && Te.length > 0 ? /* @__PURE__ */ A(E, { children: /* @__PURE__ */ A(ur, {
2434
2441
  deliveries: Te,
2435
- onRetry: pn,
2436
- readNodeLabel: (e) => Ft(e, C?.workflowSnapshot ?? null)
2442
+ onRetry: gn,
2443
+ readNodeLabel: (e) => Rt(e, C?.workflowSnapshot ?? null)
2437
2444
  }) }) : null,
2438
- u ? /* @__PURE__ */ O(T, { children: /* @__PURE__ */ O(rr, {
2439
- activityLogs: fe,
2445
+ u ? /* @__PURE__ */ A(E, { children: /* @__PURE__ */ A(or, {
2446
+ activityLogs: me,
2440
2447
  formSchema: X,
2441
2448
  instanceState: C?.state ?? "RUNNING",
2442
- memberProfilesById: Zt,
2443
- signatureVerification: Oe,
2444
- signaturesById: on,
2445
- taskDecisions: he,
2446
- taskDecisionsByTaskId: an,
2447
- tasks: A,
2449
+ memberProfilesById: en,
2450
+ signatureVerification: De,
2451
+ signaturesById: ln,
2452
+ taskDecisions: _e,
2453
+ taskDecisionsByTaskId: cn,
2454
+ tasks: M,
2448
2455
  workflowSnapshot: C?.workflowSnapshot ?? null,
2449
- workflowTokens: Re
2456
+ workflowTokens: Ne
2450
2457
  }) }) : null
2451
2458
  ] }),
2452
- C ? /* @__PURE__ */ O(w, {
2459
+ C ? /* @__PURE__ */ A(T, {
2453
2460
  modalType: "standard",
2454
- onClose: () => I(!1),
2461
+ onClose: () => lt(!1),
2455
2462
  open: ct,
2456
2463
  showModalHeader: !0,
2457
2464
  size: "wide",
2458
- supportingText: `${Mt(C.state)} · ${t(C.startedAt)}`,
2465
+ supportingText: `${Pt(C.state)} · ${t(C.startedAt)}`,
2459
2466
  title: "流程圖",
2460
- children: /* @__PURE__ */ k("div", {
2461
- style: _r,
2462
- children: [/* @__PURE__ */ O("div", {
2463
- style: vr,
2464
- children: /* @__PURE__ */ k(dt, {
2465
- edges: ln,
2467
+ children: /* @__PURE__ */ j("div", {
2468
+ style: xr,
2469
+ children: [/* @__PURE__ */ A("div", {
2470
+ style: Sr,
2471
+ children: /* @__PURE__ */ j(pt, {
2472
+ edges: fn,
2466
2473
  fitView: !0,
2467
2474
  fitViewOptions: { padding: .18 },
2468
2475
  maxZoom: 1.2,
2469
2476
  minZoom: .2,
2470
- nodes: cn,
2477
+ nodes: dn,
2471
2478
  nodesDraggable: !1,
2472
2479
  nodesFocusable: !1,
2473
- nodeTypes: Er,
2480
+ nodeTypes: Ar,
2474
2481
  panOnDrag: !0,
2475
2482
  proOptions: { hideAttribution: !0 },
2476
- children: [/* @__PURE__ */ O(lt, {}), /* @__PURE__ */ O(ut, { showInteractive: !1 })]
2483
+ children: [/* @__PURE__ */ A(ut, {}), /* @__PURE__ */ A(dt, { showInteractive: !1 })]
2477
2484
  })
2478
- }), un.length > 0 ? /* @__PURE__ */ O("div", {
2479
- style: Cr,
2480
- children: un.map((e) => /* @__PURE__ */ O("span", {
2481
- style: wr,
2485
+ }), pn.length > 0 ? /* @__PURE__ */ A("div", {
2486
+ style: Dr,
2487
+ children: pn.map((e) => /* @__PURE__ */ A("span", {
2488
+ style: Or,
2482
2489
  children: e
2483
2490
  }, e))
2484
2491
  }) : null]
2485
2492
  })
2486
2493
  }) : null,
2487
- /* @__PURE__ */ O(w, {
2494
+ /* @__PURE__ */ A(T, {
2488
2495
  modalType: "standard",
2489
2496
  onClose: () => {
2490
- V(null), Et(null);
2497
+ Tt(null), Ot(null);
2491
2498
  },
2492
- open: !!(B && wt),
2499
+ open: !!(wt && Dt),
2493
2500
  showModalHeader: !0,
2494
2501
  size: "wide",
2495
- supportingText: B?.filename ?? void 0,
2502
+ supportingText: wt?.filename ?? void 0,
2496
2503
  title: "PDF 預覽",
2497
- children: wt ? /* @__PURE__ */ O(Ct, {
2498
- filename: B?.filename ?? "PDF 預覽",
2499
- fileUrl: wt,
2500
- onDownload: B ? () => void gn(B.id) : void 0
2504
+ children: Dt ? /* @__PURE__ */ A(Et, {
2505
+ filename: wt?.filename ?? "PDF 預覽",
2506
+ fileUrl: Dt,
2507
+ onDownload: wt ? () => void yn(wt.id) : void 0
2501
2508
  }) : null
2502
2509
  }),
2503
- /* @__PURE__ */ O(w, {
2510
+ /* @__PURE__ */ A(T, {
2504
2511
  cancelText: "保留案件",
2505
2512
  confirmButtonProps: { variant: "destructive-primary" },
2506
2513
  confirmText: "確認取消",
2507
2514
  loading: $e,
2508
2515
  modalStatusType: "error",
2509
2516
  modalType: "standard",
2510
- onCancel: () => mt(!1),
2511
- onClose: () => mt(!1),
2512
- onConfirm: () => void vn(),
2513
- open: pt,
2517
+ onCancel: () => ht(!1),
2518
+ onClose: () => ht(!1),
2519
+ onConfirm: () => void xn(),
2520
+ open: mt,
2514
2521
  showModalFooter: !0,
2515
2522
  showModalHeader: !0,
2516
2523
  supportingText: "取消後會關閉目前待簽任務與候選簽核人。",
2517
2524
  title: "取消案件",
2518
- children: /* @__PURE__ */ k("div", {
2519
- style: Tr,
2520
- children: [/* @__PURE__ */ k(E, {
2525
+ children: /* @__PURE__ */ j("div", {
2526
+ style: kr,
2527
+ children: [/* @__PURE__ */ j(O, {
2521
2528
  variant: "body",
2522
2529
  children: [
2523
2530
  "確定要取消「",
2524
2531
  C?.title ?? "",
2525
2532
  "」嗎?"
2526
2533
  ]
2527
- }), /* @__PURE__ */ O(e, {
2534
+ }), /* @__PURE__ */ A(e, {
2528
2535
  label: "取消原因",
2529
2536
  name: "cancelComment",
2530
- children: /* @__PURE__ */ O(Ce, {
2531
- onChange: (e) => ft(e.target.value),
2537
+ children: /* @__PURE__ */ A(Ce, {
2538
+ onChange: (e) => R(e.target.value),
2532
2539
  placeholder: "可填寫取消原因",
2533
2540
  resize: "vertical",
2534
2541
  rows: 3,
2535
- value: L
2542
+ value: ft
2536
2543
  })
2537
2544
  })]
2538
2545
  })
2539
2546
  })
2540
2547
  ] });
2541
2548
  }
2542
- function Or(e) {
2549
+ function Mr(e) {
2543
2550
  return e.data.label ? e.data.label : e.data.isDefault ? "其他情況" : e.data.condition ?? "";
2544
2551
  }
2545
- function kr(e) {
2546
- return e.edges.map(Or).filter((e) => e.trim().length > 0);
2552
+ function Nr(e) {
2553
+ return e.edges.map(Mr).filter((e) => e.trim().length > 0);
2547
2554
  }
2548
- function Ar(e) {
2555
+ function Pr(e) {
2549
2556
  return e === "startEvent" ? "開始" : e === "endEvent" ? "完成" : e === "userTask" ? "簽核節點" : e === "serviceTask" ? "知會節點" : e === "exclusiveGateway" ? "條件分流" : "平行處理";
2550
2557
  }
2551
- function jr(e, t, n, r) {
2558
+ function Fr(e, t, n, r) {
2552
2559
  return e.nodes.map((e) => {
2553
- let i = xn(e, t, n, r);
2560
+ let i = wn(e, t, n, r);
2554
2561
  return {
2555
2562
  data: {
2556
- kindLabel: Ar(e.type),
2563
+ kindLabel: Pr(e.type),
2557
2564
  label: e.data.label,
2558
2565
  secondaryLabel: i.secondaryLabel,
2559
2566
  statusLabel: i.statusLabel,
@@ -2561,42 +2568,42 @@ function jr(e, t, n, r) {
2561
2568
  },
2562
2569
  id: e.id,
2563
2570
  position: e.position,
2564
- sourcePosition: L.Right,
2565
- targetPosition: L.Left,
2571
+ sourcePosition: R.Right,
2572
+ targetPosition: R.Left,
2566
2573
  type: "workflowRuntime"
2567
2574
  };
2568
2575
  });
2569
2576
  }
2570
- function Mr(e) {
2571
- let t = new ft.graphlib.Graph();
2577
+ function Ir(e) {
2578
+ let t = new mt.graphlib.Graph();
2572
2579
  return t.setDefaultEdgeLabel(() => ({})), t.setGraph({
2573
2580
  nodesep: 56,
2574
2581
  rankdir: "LR",
2575
2582
  ranksep: 120
2576
2583
  }), e.nodes.forEach((e) => {
2577
2584
  t.setNode(e.id, {
2578
- height: gr,
2579
- width: hr
2585
+ height: br,
2586
+ width: yr
2580
2587
  });
2581
2588
  }), e.edges.forEach((e) => {
2582
2589
  t.setEdge(e.source, e.target);
2583
- }), ft.layout(t), {
2590
+ }), mt.layout(t), {
2584
2591
  ...e,
2585
2592
  nodes: e.nodes.map((e) => {
2586
2593
  let n = t.node(e.id);
2587
2594
  return n ? {
2588
2595
  ...e,
2589
2596
  position: {
2590
- x: n.x - hr / 2,
2591
- y: n.y - gr / 2
2597
+ x: n.x - yr / 2,
2598
+ y: n.y - br / 2
2592
2599
  }
2593
2600
  } : e;
2594
2601
  })
2595
2602
  };
2596
2603
  }
2597
- function Nr(e) {
2604
+ function Lr(e) {
2598
2605
  return e.edges.map((e) => {
2599
- let t = Or(e);
2606
+ let t = Mr(e);
2600
2607
  return {
2601
2608
  animated: !1,
2602
2609
  id: e.id,
@@ -2624,25 +2631,25 @@ function Nr(e) {
2624
2631
  };
2625
2632
  });
2626
2633
  }
2627
- function Pr(e) {
2634
+ function Rr(e) {
2628
2635
  return e === "current" ? {
2629
- ...yr,
2636
+ ...Cr,
2630
2637
  border: "1px solid var(--mzn-color-primary, #0057ff)",
2631
2638
  boxShadow: "0 0 0 3px rgba(0, 87, 255, 0.14)"
2632
2639
  } : e === "completed" ? {
2633
- ...yr,
2640
+ ...Cr,
2634
2641
  border: "1px solid #16a34a"
2635
2642
  } : e === "cancelled" ? {
2636
- ...yr,
2643
+ ...Cr,
2637
2644
  border: "1px solid #dc2626",
2638
2645
  opacity: .72
2639
2646
  } : e === "waiting" ? {
2640
- ...yr,
2647
+ ...Cr,
2641
2648
  border: "1px dashed #64748b"
2642
- } : yr;
2649
+ } : Cr;
2643
2650
  }
2644
- function Fr(e) {
2645
- let t = br;
2651
+ function zr(e) {
2652
+ let t = wr;
2646
2653
  return e === "current" ? {
2647
2654
  ...t,
2648
2655
  background: "#eff6ff",
@@ -2665,41 +2672,41 @@ function Fr(e) {
2665
2672
  color: "#64748b"
2666
2673
  };
2667
2674
  }
2668
- function Ir({ data: e }) {
2669
- return /* @__PURE__ */ k("div", {
2670
- style: Pr(e.tone),
2675
+ function Br({ data: e }) {
2676
+ return /* @__PURE__ */ j("div", {
2677
+ style: Rr(e.tone),
2671
2678
  children: [
2672
- /* @__PURE__ */ O(I, {
2679
+ /* @__PURE__ */ A(ft, {
2673
2680
  isConnectable: !1,
2674
- position: L.Left,
2675
- style: Sr,
2681
+ position: R.Left,
2682
+ style: Er,
2676
2683
  type: "target"
2677
2684
  }),
2678
- /* @__PURE__ */ O(E, {
2685
+ /* @__PURE__ */ A(O, {
2679
2686
  component: "span",
2680
2687
  ellipsis: !0,
2681
2688
  title: e.label,
2682
2689
  variant: "label-primary",
2683
2690
  children: e.label
2684
2691
  }),
2685
- /* @__PURE__ */ O("span", {
2686
- style: Fr(e.tone),
2692
+ /* @__PURE__ */ A("span", {
2693
+ style: zr(e.tone),
2687
2694
  children: e.statusLabel
2688
2695
  }),
2689
- /* @__PURE__ */ O("span", {
2696
+ /* @__PURE__ */ A("span", {
2690
2697
  title: e.secondaryLabel,
2691
- style: xr,
2698
+ style: Tr,
2692
2699
  children: e.secondaryLabel || e.kindLabel
2693
2700
  }),
2694
- /* @__PURE__ */ O(I, {
2701
+ /* @__PURE__ */ A(ft, {
2695
2702
  isConnectable: !1,
2696
- position: L.Right,
2697
- style: Sr,
2703
+ position: R.Right,
2704
+ style: Er,
2698
2705
  type: "source"
2699
2706
  })
2700
2707
  ]
2701
2708
  });
2702
2709
  }
2703
- export { Wn as a, Jn as i, sr as n, Nn as o, rr as r, jn as s, Dr as t };
2710
+ export { qn as a, Zn as i, ur as n, In as o, or as r, Pn as s, jr as t };
2704
2711
 
2705
- //# sourceMappingURL=detail-CHZDNNM6.js.map
2712
+ //# sourceMappingURL=detail-fW0vJudE.js.map