@rytass/bpm-core-react 0.13.5 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/CHANGELOG.md +97 -0
  2. package/dist/chunks/FormBuilderView-6bCbIkz6.cjs +3 -0
  3. package/dist/chunks/FormBuilderView-6bCbIkz6.cjs.map +1 -0
  4. package/dist/chunks/{FormBuilderView-BYLN6W-P.js → FormBuilderView-CLg-JYmu.js} +495 -452
  5. package/dist/chunks/FormBuilderView-CLg-JYmu.js.map +1 -0
  6. package/dist/chunks/FormRendererView-DU9LLrOF.js +999 -0
  7. package/dist/chunks/FormRendererView-DU9LLrOF.js.map +1 -0
  8. package/dist/chunks/FormRendererView-gctFIqwC.cjs +4 -0
  9. package/dist/chunks/FormRendererView-gctFIqwC.cjs.map +1 -0
  10. package/dist/chunks/{compose-6P64PO1i.js → compose-BtQPBd1Q.js} +6 -5
  11. package/dist/chunks/compose-BtQPBd1Q.js.map +1 -0
  12. package/dist/chunks/compose-DZhTQOt4.cjs +2 -0
  13. package/dist/chunks/compose-DZhTQOt4.cjs.map +1 -0
  14. package/dist/chunks/{designer-C3s2kSna.js → designer-CrbBRPUU.js} +1382 -1199
  15. package/dist/chunks/designer-CrbBRPUU.js.map +1 -0
  16. package/dist/chunks/designer-D3_lWmfa.cjs +65 -0
  17. package/dist/chunks/designer-D3_lWmfa.cjs.map +1 -0
  18. package/dist/chunks/detail-CVXb5Vy8.cjs +2 -0
  19. package/dist/chunks/detail-CVXb5Vy8.cjs.map +1 -0
  20. package/dist/chunks/{detail-pYEIk-jW.js → detail-_c21WQla.js} +862 -815
  21. package/dist/chunks/detail-_c21WQla.js.map +1 -0
  22. package/dist/chunks/routes-config-C1j_vFKo.cjs.map +1 -1
  23. package/dist/chunks/routes-config-yZbESPlw.js.map +1 -1
  24. package/dist/chunks/task-node-label-BF6UllxP.cjs +2 -0
  25. package/dist/chunks/task-node-label-BF6UllxP.cjs.map +1 -0
  26. package/dist/chunks/task-node-label-CWZgOBj0.js +9 -0
  27. package/dist/chunks/task-node-label-CWZgOBj0.js.map +1 -0
  28. package/dist/lib/member-profile-resolution.d.ts +48 -0
  29. package/dist/lib/routes-config.d.ts +1 -1
  30. package/dist/lib/task-node-label.d.ts +10 -0
  31. package/dist/pages/instances/detail/index.cjs +1 -1
  32. package/dist/pages/instances/detail/index.js +1 -1
  33. package/dist/pages/templates/compose/index.cjs +1 -1
  34. package/dist/pages/templates/compose/index.js +1 -1
  35. package/dist/pages/templates/designer/index.cjs +1 -1
  36. package/dist/pages/templates/designer/index.js +1 -1
  37. package/dist/views/forms/builder/index.cjs +1 -1
  38. package/dist/views/forms/builder/index.js +1 -1
  39. package/dist/views/forms/renderer/form-field-link.d.ts +16 -0
  40. package/dist/views/forms/renderer/index.cjs +1 -1
  41. package/dist/views/forms/renderer/index.js +2 -2
  42. package/dist/views/forms/renderer/member-field-options.d.ts +39 -0
  43. package/dist/views/forms/renderer/member-field.d.ts +21 -0
  44. package/dist/views/inbox/index.cjs +1 -1
  45. package/dist/views/inbox/index.cjs.map +1 -1
  46. package/dist/views/inbox/index.js +100 -97
  47. package/dist/views/inbox/index.js.map +1 -1
  48. package/dist/views/instances/detail/index.cjs +1 -1
  49. package/dist/views/instances/detail/index.js +1 -1
  50. package/dist/views/instances/detail/sections/container-helpers.d.ts +3 -2
  51. package/dist/views/instances/detail/sections/shared.d.ts +5 -0
  52. package/dist/views/instances/detail/submitted-by.d.ts +23 -0
  53. package/dist/views/instances/new/index.cjs +1 -1
  54. package/dist/views/instances/new/index.js +1 -1
  55. package/dist/views/sent/SentView.d.ts +1 -1
  56. package/dist/views/sent/index.cjs +1 -1
  57. package/dist/views/sent/index.cjs.map +1 -1
  58. package/dist/views/sent/index.js +2 -2
  59. package/dist/views/sent/index.js.map +1 -1
  60. package/dist/views/templates/compose/index.cjs +1 -1
  61. package/dist/views/templates/compose/index.js +1 -1
  62. package/dist/views/templates/designer/decision-policy-options.d.ts +8 -0
  63. package/dist/views/templates/designer/designer-version-labels.d.ts +12 -0
  64. package/dist/views/templates/designer/dry-run-assignee-label.d.ts +28 -0
  65. package/dist/views/templates/designer/dry-run-sample-data.d.ts +9 -0
  66. package/dist/views/templates/designer/dynamic-form-resolver-options.d.ts +35 -0
  67. package/dist/views/templates/designer/index.cjs +1 -1
  68. package/dist/views/templates/designer/index.js +1 -1
  69. package/dist/views/templates/designer/position-level-options.d.ts +17 -0
  70. package/package.json +3 -3
  71. package/dist/chunks/FormBuilderView-BYLN6W-P.js.map +0 -1
  72. package/dist/chunks/FormBuilderView-VmdPVbg7.cjs +0 -3
  73. package/dist/chunks/FormBuilderView-VmdPVbg7.cjs.map +0 -1
  74. package/dist/chunks/FormRendererView-Bs8lTb4k.cjs +0 -2
  75. package/dist/chunks/FormRendererView-Bs8lTb4k.cjs.map +0 -1
  76. package/dist/chunks/FormRendererView-UPowZZgw.js +0 -798
  77. package/dist/chunks/FormRendererView-UPowZZgw.js.map +0 -1
  78. package/dist/chunks/compose-6P64PO1i.js.map +0 -1
  79. package/dist/chunks/compose-BnSRL4ml.cjs +0 -2
  80. package/dist/chunks/compose-BnSRL4ml.cjs.map +0 -1
  81. package/dist/chunks/designer-C3s2kSna.js.map +0 -1
  82. package/dist/chunks/designer-_g58R6rQ.cjs +0 -65
  83. package/dist/chunks/designer-_g58R6rQ.cjs.map +0 -1
  84. package/dist/chunks/detail-Db-UOELp.cjs +0 -2
  85. package/dist/chunks/detail-Db-UOELp.cjs.map +0 -1
  86. package/dist/chunks/detail-pYEIk-jW.js.map +0 -1
@@ -3,29 +3,67 @@ import { r as e } from "./router-adapter-DftlFTOd.js";
3
3
  import { r as t } from "./routes-config-yZbESPlw.js";
4
4
  import { t as n } from "./bpm-form-field-Cao0rMol.js";
5
5
  import { a as r, n as i, o as a, r as o } from "./admin-pickers-DLlG_1du.js";
6
+ import { n as s, r as c } from "./FormRendererView-DU9LLrOF.js";
6
7
  import '../style.css';/* empty css */
7
- import { t as s } from "./FormBuilderView-BYLN6W-P.js";
8
- import { Fragment as c, useCallback as l, useEffect as u, useMemo as d, useRef as f, useState as p } from "react";
9
- import { AutoComplete as m, Button as h, Icon as g, Input as _, Modal as v, PageHeader as ee, Section as te, SectionGroup as ne, Select as y, Textarea as b, Toggle as x, Typography as S } from "@mezzanine-ui/react";
10
- import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
11
- import re from "@mezzanine-ui/react/Drawer";
12
- import ie from "@mezzanine-ui/react/ContentHeader";
13
- import { CheckedIcon as ae, DotGridIcon as oe, EyeIcon as se, FilterIcon as ce, MailIcon as le, PlusIcon as ue, SaveIcon as de, TrashIcon as fe, UserIcon as pe } from "@mezzanine-ui/icons";
14
- import { DefaultChatTransport as me, getToolName as he, isToolUIPart as ge, lastAssistantMessageIsCompleteWithToolCalls as _e } from "ai";
15
- import { WORKFLOW_TOOLSET as E, applyWorkflowCommand as ve, applyWorkflowMacroCommand as ye, executeWorkflowTool as be, readWorkflowSnapshot as xe } from "@rytass/bpm-core-shared";
16
- import { readFormBuilder as Se, readFormSchemaLintMessage as Ce } from "@rytass/bpm-core-client/form";
17
- import { isFormStaticOptionFieldDefinition as we } from "@rytass/bpm-core-shared/form";
18
- import { readOrganizationDashboard as Te } from "@rytass/bpm-core-client/organization";
19
- import { Background as Ee, ConnectionMode as De, ControlButton as Oe, Controls as ke, Handle as D, MiniMap as Ae, Panel as je, Position as O, ReactFlow as Me, applyNodeChanges as Ne, getViewportForBounds as Pe } from "@xyflow/react";
20
- import * as Fe from "dagre";
21
- import { composeApprovalTemplateWithForm as Ie, dryRunApprovalWorkflow as Le, forkApprovalTemplate as Re, listWorkflowWebhookEndpoints as ze, publishApprovalTemplateVersion as Be, readTemplateDesigner as Ve, resolveMemberOptions as He, searchMemberOptions as Ue, searchPublishedFormVersionOptions as We, updateApprovalTemplateDraft as Ge } from "@rytass/bpm-core-client/template";
22
- import { useChat as Ke } from "@ai-sdk/react";
23
- import { DEFAULT_QUORUM_THRESHOLD as qe, DEFAULT_SLA_CONFIG as Je, NOTIFY_WEBHOOK_CONTEXT_PATHS as Ye, NOTIFY_WEBHOOK_TARGET_LIMIT as k, SLA_CALENDAR_MODE_OPTIONS as Xe, SLA_DURATION_UNIT_OPTIONS as Ze, SLA_TIMEOUT_ACTION_OPTIONS as Qe, composeQuorumThreshold as $e, composeSlaDuration as A, createNotifyWebhookTarget as j, hasConfiguredConditionEdges as et, isDecisionPolicyUnsatisfiable as tt, isFormFieldCompatibleWithWebhookParameter as M, isNotifyWebhookContextPath as nt, readApproverResolverIssue as N, readDesignTimeApproverCount as rt, readNotifyServiceTaskIssue as it, readNotifyWebhookCatalogIssueMessage as at, readNotifyWebhookStructureIssues as ot, readNotifyWebhookTargetCatalogIssues as st, readNotifyWebhookTargets as ct, readSlaDurationParts as lt } from "@rytass/bpm-core-shared/workflow-graph";
8
+ import { t as l } from "./FormBuilderView-CLg-JYmu.js";
9
+ import { Fragment as u, useCallback as d, useEffect as f, useMemo as p, useRef as m, useState as h } from "react";
10
+ import { AutoComplete as g, Button as _, Icon as v, Input as y, Modal as b, PageHeader as ee, Section as te, SectionGroup as ne, Select as x, Textarea as re, Toggle as S, Typography as C } from "@mezzanine-ui/react";
11
+ import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
12
+ import ie from "@mezzanine-ui/react/Drawer";
13
+ import ae from "@mezzanine-ui/react/ContentHeader";
14
+ import { CheckedIcon as oe, DotGridIcon as se, EyeIcon as ce, FilterIcon as le, MailIcon as ue, PlusIcon as de, SaveIcon as fe, TrashIcon as pe, UserIcon as me } from "@mezzanine-ui/icons";
15
+ import { DefaultChatTransport as he, getToolName as ge, isToolUIPart as _e, lastAssistantMessageIsCompleteWithToolCalls as ve } from "ai";
16
+ import { WORKFLOW_TOOLSET as D, applyWorkflowCommand as ye, applyWorkflowMacroCommand as be, executeWorkflowTool as xe, readWorkflowSnapshot as Se } from "@rytass/bpm-core-shared";
17
+ import { readFormBuilder as Ce, readFormSchemaLintMessage as we } from "@rytass/bpm-core-client/form";
18
+ import { isFormStaticOptionFieldDefinition as Te, isMemberFieldDefinition as Ee } from "@rytass/bpm-core-shared/form";
19
+ import { readOrganizationDashboard as De } from "@rytass/bpm-core-client/organization";
20
+ import { Background as Oe, ConnectionMode as ke, ControlButton as Ae, Controls as je, Handle as Me, MiniMap as Ne, Panel as Pe, Position as O, ReactFlow as Fe, applyNodeChanges as Ie, getViewportForBounds as Le } from "@xyflow/react";
21
+ import * as Re from "dagre";
22
+ import { composeApprovalTemplateWithForm as ze, dryRunApprovalWorkflow as Be, forkApprovalTemplate as Ve, listWorkflowWebhookEndpoints as He, publishApprovalTemplateVersion as Ue, readTemplateDesigner as We, resolveMemberOptions as Ge, searchMemberOptions as Ke, searchPublishedFormVersionOptions as qe, updateApprovalTemplateDraft as Je } from "@rytass/bpm-core-client/template";
23
+ import { useChat as Ye } from "@ai-sdk/react";
24
+ import { DEFAULT_QUORUM_THRESHOLD as Xe, DEFAULT_SLA_CONFIG as Ze, NOTIFY_WEBHOOK_CONTEXT_PATHS as k, NOTIFY_WEBHOOK_TARGET_LIMIT as A, SLA_CALENDAR_MODE_OPTIONS as Qe, SLA_DURATION_UNIT_OPTIONS as $e, SLA_TIMEOUT_ACTION_OPTIONS as et, composeQuorumThreshold as tt, composeSlaDuration as j, createNotifyWebhookTarget as M, hasConfiguredConditionEdges as nt, isDecisionPolicyUnsatisfiable as rt, isFormFieldCompatibleWithWebhookParameter as it, isNotifyWebhookContextPath as N, isOrgManagerChainDecisionPolicyInvalid as at, readApproverResolverIssue as ot, readConditionOperatorIds as st, readDesignTimeApproverCount as ct, readExcludeInitiatorIssue as lt, readNotifyServiceTaskIssue as ut, readNotifyWebhookCatalogIssueMessage as dt, readNotifyWebhookStructureIssues as ft, readNotifyWebhookTargetCatalogIssues as pt, readNotifyWebhookTargets as mt, readSlaDurationParts as ht } from "@rytass/bpm-core-shared/workflow-graph";
25
+ //#region src/views/templates/designer/decision-policy-options.ts
26
+ var gt = [
27
+ {
28
+ id: "SINGLE",
29
+ name: "單人簽核"
30
+ },
31
+ {
32
+ id: "PARALLEL_ANY",
33
+ name: "任一人同意"
34
+ },
35
+ {
36
+ id: "PARALLEL_ALL",
37
+ name: "全部同意"
38
+ },
39
+ {
40
+ id: "SEQUENTIAL",
41
+ name: "依序簽核"
42
+ },
43
+ {
44
+ id: "QUORUM",
45
+ name: "達到指定門檻"
46
+ }
47
+ ];
48
+ function _t(e) {
49
+ if (!e || e.type === "SINGLE" || e.type === "PARALLEL_ANY") return "可指定多位;多位時所有人都會收到待辦,任一人同意即可通過。";
50
+ if (e.type === "PARALLEL_ALL") return "可指定多位;多位時所有人都會收到待辦,全部同意後才會通過。";
51
+ if (e.type === "SEQUENTIAL") return "依簽核人順序一次開放一位,前一位核准後才輪到下一位;任一位拒絕或退回即結束此關。";
52
+ let t = e.thresholdType === "PERCENTAGE" ? "%" : " 位簽核者";
53
+ return `可指定多位;需達到 ${e.threshold}${t} 才會通過。`;
54
+ }
55
+ function vt(e) {
56
+ return gt.find((t) => t.id === e) || {
57
+ id: e,
58
+ name: `未知決策方式(${e})`
59
+ };
60
+ }
61
+ //#endregion
24
62
  //#region src/views/templates/designer/use-workflow-designer-controller.ts
25
- function ut({ directory: e, initialState: t, layout: n, onLayout: r }) {
26
- let [i, a] = p(t), o = f(t), s = f(e);
63
+ function yt({ directory: e, initialState: t, layout: n, onLayout: r }) {
64
+ let [i, a] = h(t), o = m(t), s = m(e);
27
65
  s.current = e;
28
- let c = l((e) => {
66
+ let c = d((e) => {
29
67
  if (!e.changed && !e.error) return e;
30
68
  let t = e.effects.layout ? n(e.state.definition) : e.state.definition, i = {
31
69
  ...e.state,
@@ -35,34 +73,34 @@ function ut({ directory: e, initialState: t, layout: n, onLayout: r }) {
35
73
  ...e,
36
74
  state: i
37
75
  };
38
- }, [n, r]), u = l((e) => c(ve(o.current, e)), [c]), m = l((e) => c(ye(o.current, e)), [c]), h = l(async (e, t) => {
39
- let n = await be(o.current, e, t, { directory: s.current });
76
+ }, [n, r]), l = d((e) => c(ye(o.current, e)), [c]), u = d((e) => c(be(o.current, e)), [c]), f = d(async (e, t) => {
77
+ let n = await xe(o.current, e, t, { directory: s.current });
40
78
  if (n.ok && (n.kind === "mutation" || n.kind === "macro")) {
41
79
  let e = c(n.result);
42
80
  return {
43
81
  ...n,
44
82
  result: e,
45
- snapshot: xe(e.state)
83
+ snapshot: Se(e.state)
46
84
  };
47
85
  }
48
86
  return n;
49
- }, [c]), g = l((e) => {
87
+ }, [c]), g = d((e) => {
50
88
  let t = typeof e == "function" ? e(o.current) : e;
51
89
  o.current = t, a(t);
52
- }, []), _ = l(() => o.current, []), v = d(() => xe(i), [i]);
53
- return d(() => ({
54
- dispatch: u,
55
- dispatchMacro: m,
56
- executeTool: h,
90
+ }, []), _ = d(() => o.current, []), v = p(() => Se(i), [i]);
91
+ return p(() => ({
92
+ dispatch: l,
93
+ dispatchMacro: u,
94
+ executeTool: f,
57
95
  getState: _,
58
96
  replaceState: g,
59
97
  snapshot: v,
60
98
  state: i,
61
- tools: E
99
+ tools: D
62
100
  }), [
101
+ l,
63
102
  u,
64
- m,
65
- h,
103
+ f,
66
104
  _,
67
105
  g,
68
106
  v,
@@ -71,10 +109,10 @@ function ut({ directory: e, initialState: t, layout: n, onLayout: r }) {
71
109
  }
72
110
  //#endregion
73
111
  //#region src/views/templates/designer/use-workflow-chat.ts
74
- function dt({ controller: e, api: t = "/api/chat" }) {
75
- let n = d(() => new me({ api: t }), [t]), r = Ke({
112
+ function bt({ controller: e, api: t = "/api/chat" }) {
113
+ let n = p(() => new he({ api: t }), [t]), r = Ye({
76
114
  transport: n,
77
- sendAutomaticallyWhen: _e,
115
+ sendAutomaticallyWhen: ve,
78
116
  async onToolCall({ toolCall: t }) {
79
117
  let n = await e.executeTool(t.toolName, t.input);
80
118
  if (n.ok) {
@@ -97,12 +135,12 @@ function dt({ controller: e, api: t = "/api/chat" }) {
97
135
  }
98
136
  //#endregion
99
137
  //#region src/views/templates/designer/chrome-workflow-chat.ts
100
- var ft = 12;
101
- function pt() {
138
+ var P = 12;
139
+ function xt() {
102
140
  let e = globalThis.LanguageModel;
103
141
  return e && typeof e == "object" ? e : null;
104
142
  }
105
- var mt = {
143
+ var F = {
106
144
  additionalProperties: !1,
107
145
  properties: {
108
146
  action: {
@@ -116,7 +154,7 @@ var mt = {
116
154
  required: ["action"],
117
155
  type: "object"
118
156
  };
119
- function P() {
157
+ function St() {
120
158
  return `你是「簽核流程設計器」頁面的離線 AI 助理。只能透過下列工具操作這個流程畫布,其他請求一律婉拒並引導回流程設計。
121
159
 
122
160
  每一步只輸出一個 JSON 決策物件:
@@ -126,17 +164,17 @@ function P() {
126
164
  規則:先用 get_workflow_snapshot 了解現況再規劃;完成後用 validate_workflow 檢查並以 message 說明做了什麼。
127
165
 
128
166
  可用工具:
129
- ${E.map((e) => `- ${e.name}(${JSON.stringify(e.inputSchema.properties ?? {})}): ${e.description}`).join("\n")}`;
167
+ ${D.map((e) => `- ${e.name}(${JSON.stringify(e.inputSchema.properties ?? {})}): ${e.description}`).join("\n")}`;
130
168
  }
131
- function ht({ controller: e }) {
132
- let [t, n] = p(!1), [r, i] = p([]), [a, o] = p("ready"), s = f(0);
133
- u(() => {
134
- let e = pt();
169
+ function Ct({ controller: e }) {
170
+ let [t, n] = h(!1), [r, i] = h([]), [a, o] = h("ready"), s = m(0);
171
+ f(() => {
172
+ let e = xt();
135
173
  e && e.availability().then((e) => {
136
174
  n(e !== "unavailable");
137
175
  }).catch(() => n(!1));
138
176
  }, []);
139
- let c = l((e, t) => {
177
+ let c = d((e, t) => {
140
178
  s.current += 1, i((n) => [...n, {
141
179
  id: `chrome-${s.current}`,
142
180
  parts: [{
@@ -149,15 +187,15 @@ function ht({ controller: e }) {
149
187
  return {
150
188
  available: t,
151
189
  messages: r,
152
- send: l((t) => {
153
- let n = pt();
154
- n && a === "ready" && (c("user", t), o("submitted"), gt({
190
+ send: d((t) => {
191
+ let n = xt();
192
+ n && a === "ready" && (c("user", t), o("submitted"), wt({
155
193
  appendMessage: c,
156
194
  controller: e,
157
195
  model: n,
158
196
  userText: t
159
197
  }).then(() => o("ready")).catch((e) => {
160
- c("assistant", vt(e)), o("error");
198
+ c("assistant", Et(e)), o("error");
161
199
  }));
162
200
  }, [
163
201
  c,
@@ -167,15 +205,15 @@ function ht({ controller: e }) {
167
205
  status: a
168
206
  };
169
207
  }
170
- async function gt({ appendMessage: e, controller: t, model: n, userText: r }) {
208
+ async function wt({ appendMessage: e, controller: t, model: n, userText: r }) {
171
209
  let i = await n.create({ initialPrompts: [{
172
- content: P(),
210
+ content: St(),
173
211
  role: "system"
174
212
  }] });
175
213
  try {
176
214
  let n = `使用者需求:${r}\n目前流程:${JSON.stringify(t.snapshot)}`;
177
- for (let r = 0; r < ft; r += 1) {
178
- let r = _t(await i.prompt(n, { responseConstraint: mt }));
215
+ for (let r = 0; r < P; r += 1) {
216
+ let r = Tt(await i.prompt(n, { responseConstraint: F }));
179
217
  if (!r || r.action === "message") {
180
218
  e("assistant", r?.text ?? "我已完成可處理的部分。");
181
219
  return;
@@ -195,7 +233,7 @@ async function gt({ appendMessage: e, controller: t, model: n, userText: r }) {
195
233
  i.destroy();
196
234
  }
197
235
  }
198
- function _t(e) {
236
+ function Tt(e) {
199
237
  try {
200
238
  let t = JSON.parse(e);
201
239
  return typeof t == "object" && t && t.action !== void 0 ? t : null;
@@ -203,51 +241,51 @@ function _t(e) {
203
241
  return null;
204
242
  }
205
243
  }
206
- function vt(e) {
244
+ function Et(e) {
207
245
  return e instanceof Error ? `離線模式發生錯誤:${e.message}` : "離線模式發生未知錯誤。";
208
246
  }
209
247
  //#endregion
210
248
  //#region src/views/templates/designer/workflow-chat-drawer.tsx
211
- var yt = {
249
+ var Dt = {
212
250
  display: "flex",
213
251
  flexDirection: "column",
214
252
  gap: 12,
215
253
  height: "100%"
216
- }, bt = {
254
+ }, Ot = {
217
255
  display: "flex",
218
256
  flex: 1,
219
257
  flexDirection: "column",
220
258
  gap: 12,
221
259
  minHeight: 0,
222
260
  overflowY: "auto"
223
- }, xt = {
261
+ }, kt = {
224
262
  display: "flex",
225
263
  gap: 8,
226
264
  paddingBottom: 4
227
- }, St = {
265
+ }, At = {
228
266
  borderTop: "1px solid var(--mzn-color-border-neutral, #e5e7eb)",
229
267
  display: "flex",
230
268
  flexDirection: "column",
231
269
  gap: 8,
232
270
  paddingTop: 12
233
- }, Ct = {
271
+ }, jt = {
234
272
  display: "flex",
235
273
  justifyContent: "flex-end"
236
- }, wt = { width: "100%" }, Tt = "workflow-chat-input-field", Et = `
237
- .${Tt}.mzn-text-field {
274
+ }, Mt = { width: "100%" }, Nt = "workflow-chat-input-field", I = `
275
+ .${Nt}.mzn-text-field {
238
276
  width: 100%;
239
277
  }
240
- `, Dt = {
278
+ `, Pt = {
241
279
  color: "var(--mzn-color-text-secondary, #6b7280)",
242
280
  fontSize: 12,
243
281
  padding: "2px 0"
244
- }, Ot = {
282
+ }, Ft = {
245
283
  "input-available": "執行中…",
246
284
  "input-streaming": "準備中…",
247
285
  "output-available": "完成",
248
286
  "output-error": "失敗"
249
287
  };
250
- function F(e) {
288
+ function It(e) {
251
289
  let t = e === "user";
252
290
  return {
253
291
  alignSelf: t ? "flex-end" : "flex-start",
@@ -260,11 +298,11 @@ function F(e) {
260
298
  wordBreak: "break-word"
261
299
  };
262
300
  }
263
- function kt({ api: e, controller: t, onClose: n, open: r }) {
264
- let i = dt({
301
+ function Lt({ api: e, controller: t, onClose: n, open: r }) {
302
+ let i = bt({
265
303
  api: e,
266
304
  controller: t
267
- }), a = ht({ controller: t }), [o, s] = p("online"), [u, d] = p(""), f = o === "offline" ? {
305
+ }), a = Ct({ controller: t }), [o, s] = h("online"), [c, l] = h(""), f = o === "offline" ? {
268
306
  messages: a.messages,
269
307
  send: a.send,
270
308
  status: a.status
@@ -274,71 +312,71 @@ function kt({ api: e, controller: t, onClose: n, open: r }) {
274
312
  i.sendMessage({ text: e });
275
313
  },
276
314
  status: i.status
277
- }, { messages: m, send: g } = f, _ = f.status === "submitted" || f.status === "streaming", v = l(() => {
278
- let e = u.trim();
279
- e && !_ && (d(""), g(e));
315
+ }, { messages: p, send: m } = f, g = f.status === "submitted" || f.status === "streaming", v = d(() => {
316
+ let e = c.trim();
317
+ e && !g && (l(""), m(e));
280
318
  }, [
281
- _,
282
- u,
283
- g
284
- ]), ee = l((e) => {
319
+ g,
320
+ c,
321
+ m
322
+ ]), y = d((e) => {
285
323
  e.nativeEvent.isComposing || e.key === "Enter" && !e.shiftKey && (e.preventDefault(), v());
286
324
  }, [v]);
287
- return /* @__PURE__ */ T(re, {
325
+ return /* @__PURE__ */ E(ie, {
288
326
  headerTitle: "AI 流程助理",
289
327
  isHeaderDisplay: !0,
290
328
  onClose: n,
291
329
  open: r,
292
330
  size: "medium",
293
- children: [/* @__PURE__ */ w("style", { children: Et }), /* @__PURE__ */ T("div", {
294
- style: yt,
331
+ children: [/* @__PURE__ */ T("style", { children: I }), /* @__PURE__ */ E("div", {
332
+ style: Dt,
295
333
  children: [
296
- a.available ? /* @__PURE__ */ T("div", {
297
- style: xt,
298
- children: [/* @__PURE__ */ w(h, {
334
+ a.available ? /* @__PURE__ */ E("div", {
335
+ style: kt,
336
+ children: [/* @__PURE__ */ T(_, {
299
337
  onClick: () => s("online"),
300
338
  variant: o === "online" ? "base-primary" : "base-tertiary",
301
339
  children: "線上"
302
- }), /* @__PURE__ */ w(h, {
340
+ }), /* @__PURE__ */ T(_, {
303
341
  onClick: () => s("offline"),
304
342
  variant: o === "offline" ? "base-primary" : "base-tertiary",
305
343
  children: "離線(裝置內,實驗)"
306
344
  })]
307
345
  }) : null,
308
- /* @__PURE__ */ T("div", {
346
+ /* @__PURE__ */ E("div", {
309
347
  role: "log",
310
- style: bt,
348
+ style: Ot,
311
349
  children: [
312
- m.length === 0 ? /* @__PURE__ */ w(S, {
350
+ p.length === 0 ? /* @__PURE__ */ T(C, {
313
351
  color: "text-neutral",
314
352
  variant: "body",
315
353
  children: "用一句話描述你想要的流程,例如:「建立三關簽核:部門主管 → 經理 → 財務,金額大於十萬走財務複核」。我會直接在畫布上幫你繪製。"
316
354
  }) : null,
317
- m.map((e) => /* @__PURE__ */ w(c, { children: At(e) }, e.id)),
318
- _ ? /* @__PURE__ */ w(S, {
355
+ p.map((e) => /* @__PURE__ */ T(u, { children: Rt(e) }, e.id)),
356
+ g ? /* @__PURE__ */ T(C, {
319
357
  color: "text-neutral",
320
358
  variant: "body",
321
359
  children: "思考中…"
322
360
  }) : null
323
361
  ]
324
362
  }),
325
- /* @__PURE__ */ T("div", {
326
- style: St,
327
- children: [/* @__PURE__ */ w(b, {
328
- className: Tt,
329
- disabled: _,
363
+ /* @__PURE__ */ E("div", {
364
+ style: At,
365
+ children: [/* @__PURE__ */ T(re, {
366
+ className: Nt,
367
+ disabled: g,
330
368
  maxLength: 2e3,
331
- onChange: (e) => d(e.target.value),
332
- onKeyDown: ee,
369
+ onChange: (e) => l(e.target.value),
370
+ onKeyDown: y,
333
371
  placeholder: "描述你想要的流程…(Enter 送出,Shift + Enter 換行)",
334
372
  rows: 3,
335
- style: wt,
336
- value: u
337
- }), /* @__PURE__ */ w("div", {
338
- style: Ct,
339
- children: /* @__PURE__ */ w(h, {
340
- disabled: _ || u.trim().length === 0,
341
- loading: _,
373
+ style: Mt,
374
+ value: c
375
+ }), /* @__PURE__ */ T("div", {
376
+ style: jt,
377
+ children: /* @__PURE__ */ T(_, {
378
+ disabled: g || c.trim().length === 0,
379
+ loading: g,
342
380
  onClick: v,
343
381
  type: "button",
344
382
  variant: "base-primary",
@@ -350,16 +388,16 @@ function kt({ api: e, controller: t, onClose: n, open: r }) {
350
388
  })]
351
389
  });
352
390
  }
353
- function At(e) {
391
+ function Rt(e) {
354
392
  return e.parts.map((t, n) => {
355
- if (t.type === "text") return /* @__PURE__ */ w("div", {
356
- style: F(e.role),
393
+ if (t.type === "text") return /* @__PURE__ */ T("div", {
394
+ style: It(e.role),
357
395
  children: t.text
358
396
  }, `${e.id}-${n}`);
359
- if (t.type === "dynamic-tool" || ge(t)) {
360
- let r = he(t), i = Ot[t.state] ?? t.state;
361
- return /* @__PURE__ */ w("div", {
362
- style: Dt,
397
+ if (t.type === "dynamic-tool" || _e(t)) {
398
+ let r = ge(t), i = Ft[t.state] ?? t.state;
399
+ return /* @__PURE__ */ T("div", {
400
+ style: Pt,
363
401
  children: `⚙ ${r} · ${i}`
364
402
  }, `${e.id}-${n}`);
365
403
  }
@@ -367,8 +405,24 @@ function At(e) {
367
405
  });
368
406
  }
369
407
  //#endregion
408
+ //#region src/views/templates/designer/position-level-options.ts
409
+ function zt(e, t) {
410
+ let n = [...new Set(e.map((e) => e.level))];
411
+ return [...n.includes(t) ? n : [...n, t]].sort((e, t) => t - e).map((t) => {
412
+ let n = e.filter((e) => e.level === t).map((e) => e.name);
413
+ return {
414
+ id: String(t),
415
+ name: n.length > 0 ? `職等 ${t}(${n.join("、")})` : `職等 ${t}`,
416
+ value: t
417
+ };
418
+ });
419
+ }
420
+ function Bt(e) {
421
+ return e.reduce((e, t) => Math.max(e, t.level), 1);
422
+ }
423
+ //#endregion
370
424
  //#region src/views/templates/designer/notify-webhook-designer.ts
371
- var jt = {
425
+ var L = {
372
426
  "initiator.memberId": "發起人會員編號",
373
427
  "instance.id": "案件編號",
374
428
  "instance.templateId": "模板編號",
@@ -376,32 +430,32 @@ var jt = {
376
430
  "instance.title": "案件主旨",
377
431
  "node.id": "節點編號",
378
432
  "node.label": "節點名稱"
379
- }, Mt = {
433
+ }, Vt = {
380
434
  boolean: "是/否",
381
435
  json: "JSON",
382
436
  number: "數字",
383
437
  string: "文字",
384
438
  stringArray: "文字清單"
385
439
  };
386
- function I(e) {
440
+ function R(e) {
387
441
  return `${e.key}@${e.version}`;
388
442
  }
389
- function L(e, t) {
443
+ function Ht(e, t) {
390
444
  return e.find((e) => e.key === t.key && e.version === t.version) ?? null;
391
445
  }
392
- function Nt(e) {
446
+ function Ut(e) {
393
447
  return [
394
448
  "FIELD",
395
449
  ...e === "stringArray" ? [] : ["CONSTANT"],
396
450
  ...e === "string" || e === "json" ? ["CONTEXT"] : []
397
451
  ];
398
452
  }
399
- function R(e, t) {
400
- return e.filter((e) => M(e, t));
453
+ function Wt(e, t) {
454
+ return e.filter((e) => it(e, t));
401
455
  }
402
- function Pt(e, t, n) {
456
+ function Gt(e, t, n) {
403
457
  return e === "FIELD" ? {
404
- fieldKey: R(n, t.type)[0]?.fieldKey ?? "",
458
+ fieldKey: Wt(n, t.type)[0]?.fieldKey ?? "",
405
459
  kind: "FIELD"
406
460
  } : e === "CONTEXT" ? {
407
461
  kind: "CONTEXT",
@@ -411,16 +465,16 @@ function Pt(e, t, n) {
411
465
  value: t.type === "boolean" ? !0 : t.type === "number" ? null : ""
412
466
  };
413
467
  }
414
- var Ft = /^-?\d+(\.\d+)?$/;
415
- function It(e, t) {
468
+ var Kt = /^-?\d+(\.\d+)?$/;
469
+ function qt(e, t) {
416
470
  if (e !== "number") return t;
417
471
  let n = t.trim();
418
- return n ? Ft.test(n) ? Number(n) : t : null;
472
+ return n ? Kt.test(n) ? Number(n) : t : null;
419
473
  }
420
- function Lt(e) {
421
- return !ot(e).some((e) => Rt.has(e.code));
474
+ function Jt(e) {
475
+ return !ft(e).some((e) => Yt.has(e.code));
422
476
  }
423
- var Rt = /* @__PURE__ */ new Set([
477
+ var Yt = /* @__PURE__ */ new Set([
424
478
  "BINDING_INVALID",
425
479
  "BINDING_SOURCE_INVALID",
426
480
  "BINDINGS_NOT_ARRAY",
@@ -430,7 +484,7 @@ var Rt = /* @__PURE__ */ new Set([
430
484
  "TARGET_INVALID",
431
485
  "WEBHOOKS_NOT_ARRAY"
432
486
  ]);
433
- function zt(e, t, n) {
487
+ function Xt(e, t, n) {
434
488
  let r = e.bindings.filter((e) => e.parameter !== t), i = e.bindings.findIndex((e) => e.parameter === t);
435
489
  if (!n) return {
436
490
  ...e,
@@ -445,11 +499,11 @@ function zt(e, t, n) {
445
499
  bindings: i === -1 ? [...e.bindings, a] : e.bindings.map((e, t) => t === i ? a : e)
446
500
  };
447
501
  }
448
- function Bt(e, t, n) {
502
+ function Zt(e, t, n) {
449
503
  return {
450
504
  bindings: e.bindings.filter((r) => {
451
505
  let i = t.parameters.find((e) => e.key === r.parameter);
452
- return i !== void 0 && !st({
506
+ return i !== void 0 && !pt({
453
507
  endpoint: { parameters: [{
454
508
  ...i,
455
509
  required: !1
@@ -468,15 +522,15 @@ function Bt(e, t, n) {
468
522
  id: e.id
469
523
  };
470
524
  }
471
- function Vt({ definition: e, endpoints: t, formFields: n }) {
472
- return e.nodes.flatMap((e) => e.type !== "serviceTask" || e.data.action.type !== "NOTIFY" || ot(e.data.action.webhooks).length ? [] : ct(e.data.action).flatMap((r, i) => {
473
- let a = L(t, r.endpoint);
474
- return st({
525
+ function Qt({ definition: e, endpoints: t, formFields: n }) {
526
+ return e.nodes.flatMap((e) => e.type !== "serviceTask" || e.data.action.type !== "NOTIFY" || ft(e.data.action.webhooks).length ? [] : mt(e.data.action).flatMap((r, i) => {
527
+ let a = Ht(t, r.endpoint);
528
+ return pt({
475
529
  endpoint: a,
476
530
  formFields: n,
477
531
  target: r
478
- }).map((t) => at({
479
- endpointLabel: a?.label ?? I(r.endpoint),
532
+ }).map((t) => dt({
533
+ endpointLabel: a?.label ?? R(r.endpoint),
480
534
  issue: t,
481
535
  nodeLabel: e.data.label,
482
536
  targetIndex: i
@@ -485,10 +539,10 @@ function Vt({ definition: e, endpoints: t, formFields: n }) {
485
539
  }
486
540
  //#endregion
487
541
  //#region src/views/templates/designer/NotifyWebhookTargetsEditor.tsx
488
- var Ht = {
542
+ var $t = {
489
543
  display: "grid",
490
544
  gap: "var(--mzn-spacing-gap-base)"
491
- }, Ut = {
545
+ }, en = {
492
546
  borderColor: "var(--mzn-color-border-neutral)",
493
547
  borderRadius: "var(--mzn-radius-base)",
494
548
  borderStyle: "solid",
@@ -496,19 +550,19 @@ var Ht = {
496
550
  display: "grid",
497
551
  gap: "var(--mzn-spacing-gap-base)",
498
552
  padding: "var(--mzn-spacing-padding-horizontal-base)"
499
- }, Wt = {
553
+ }, tn = {
500
554
  alignItems: "center",
501
555
  display: "flex",
502
556
  gap: "var(--mzn-spacing-gap-base)",
503
557
  justifyContent: "space-between"
504
- }, Gt = {
558
+ }, nn = {
505
559
  display: "grid",
506
560
  gap: "var(--mzn-spacing-gap-base)",
507
561
  gridTemplateColumns: "minmax(0, 2fr) minmax(0, 3fr)"
508
- }, Kt = {
562
+ }, rn = {
509
563
  id: "NONE",
510
564
  name: "不傳送"
511
- }, qt = {
565
+ }, an = {
512
566
  CONSTANT: {
513
567
  id: "CONSTANT",
514
568
  name: "固定值"
@@ -521,17 +575,17 @@ var Ht = {
521
575
  id: "FIELD",
522
576
  name: "表單欄位"
523
577
  }
524
- }, Jt = [{
578
+ }, on = [{
525
579
  id: "true",
526
580
  name: "是"
527
581
  }, {
528
582
  id: "false",
529
583
  name: "否"
530
- }], Yt = Ye.map((e) => ({
584
+ }], sn = k.map((e) => ({
531
585
  id: e,
532
- name: jt[e]
586
+ name: L[e]
533
587
  }));
534
- function Xt({ catalog: e, catalogState: t, formFields: n, onChange: r, targets: i }) {
588
+ function cn({ catalog: e, catalogState: t, formFields: n, onChange: r, targets: i }) {
535
589
  let a = e.filter((e) => !e.deprecated);
536
590
  if (!i.length && (t === "unavailable" || t === "ready" && !a.length)) return null;
537
591
  function o(e, t) {
@@ -539,34 +593,34 @@ function Xt({ catalog: e, catalogState: t, formFields: n, onChange: r, targets:
539
593
  }
540
594
  function s() {
541
595
  let [e] = a;
542
- e && r([...i, j({
596
+ e && r([...i, M({
543
597
  key: e.key,
544
598
  version: e.version
545
599
  })]);
546
600
  }
547
- return /* @__PURE__ */ T("div", {
548
- style: Ht,
601
+ return /* @__PURE__ */ E("div", {
602
+ style: $t,
549
603
  children: [
550
- /* @__PURE__ */ w(S, {
604
+ /* @__PURE__ */ T(C, {
551
605
  variant: "label-primary-highlight",
552
606
  children: "Webhook"
553
607
  }),
554
- /* @__PURE__ */ w(S, {
608
+ /* @__PURE__ */ T(C, {
555
609
  color: "text-neutral",
556
610
  variant: "caption",
557
611
  children: "知會節點抵達時,將指定的表單欄位或案件資訊送到外部系統。"
558
612
  }),
559
- t === "loading" ? /* @__PURE__ */ w(S, {
613
+ t === "loading" ? /* @__PURE__ */ T(C, {
560
614
  color: "text-neutral",
561
615
  variant: "body",
562
616
  children: "正在載入可用的 Webhook 端點…"
563
617
  }) : null,
564
- t === "unavailable" ? /* @__PURE__ */ w(S, {
618
+ t === "unavailable" ? /* @__PURE__ */ T(C, {
565
619
  color: "text-error",
566
620
  variant: "body",
567
621
  children: "目前無法載入 Webhook 端點,已設定的內容會保留,請稍後重試。"
568
622
  }) : null,
569
- i.map((s, c) => /* @__PURE__ */ w(Zt, {
623
+ i.map((s, c) => /* @__PURE__ */ T(ln, {
570
624
  activeEndpoints: a,
571
625
  catalog: e,
572
626
  catalogState: t,
@@ -576,104 +630,104 @@ function Xt({ catalog: e, catalogState: t, formFields: n, onChange: r, targets:
576
630
  onRemove: () => r(i.filter((e, t) => t !== c)),
577
631
  target: s
578
632
  }, s.id)),
579
- /* @__PURE__ */ w("div", { children: /* @__PURE__ */ w(h, {
580
- disabled: t !== "ready" || !a.length || i.length >= k,
581
- icon: ue,
633
+ /* @__PURE__ */ T("div", { children: /* @__PURE__ */ T(_, {
634
+ disabled: t !== "ready" || !a.length || i.length >= A,
635
+ icon: de,
582
636
  iconType: "leading",
583
637
  onClick: s,
584
638
  variant: "base-dashed",
585
639
  children: "新增 Webhook"
586
640
  }) }),
587
- i.length >= k ? /* @__PURE__ */ T(S, {
641
+ i.length >= A ? /* @__PURE__ */ E(C, {
588
642
  color: "text-neutral",
589
643
  variant: "caption",
590
644
  children: [
591
645
  "每個知會節點最多 ",
592
- k,
646
+ A,
593
647
  " 個 Webhook。"
594
648
  ]
595
649
  }) : null
596
650
  ]
597
651
  });
598
652
  }
599
- function Zt({ activeEndpoints: e, catalog: t, catalogState: r, formFields: i, index: a, onChange: o, onRemove: s, target: c }) {
600
- let l = L(t, c.endpoint), u = I(c.endpoint), d = [...e.map((e) => ({
601
- id: I(e),
602
- name: tn(e)
653
+ function ln({ activeEndpoints: e, catalog: t, catalogState: r, formFields: i, index: a, onChange: o, onRemove: s, target: c }) {
654
+ let l = Ht(t, c.endpoint), u = R(c.endpoint), d = [...e.map((e) => ({
655
+ id: R(e),
656
+ name: z(e)
603
657
  })), ...l && !l.deprecated ? [] : [{
604
658
  id: u,
605
- name: l ? tn(l) : `${u}(找不到端點)`
659
+ name: l ? z(l) : `${u}(找不到端點)`
606
660
  }]], f = new Set((l?.parameters ?? []).map((e) => e.key)), p = l ? c.bindings.filter((e) => !f.has(e.parameter)) : [];
607
- return /* @__PURE__ */ T("div", {
608
- style: Ut,
661
+ return /* @__PURE__ */ E("div", {
662
+ style: en,
609
663
  children: [
610
- /* @__PURE__ */ T("div", {
611
- style: Wt,
612
- children: [/* @__PURE__ */ T(S, {
664
+ /* @__PURE__ */ E("div", {
665
+ style: tn,
666
+ children: [/* @__PURE__ */ E(C, {
613
667
  variant: "label-primary",
614
668
  children: [
615
669
  "第 ",
616
670
  a + 1,
617
671
  " 個 Webhook"
618
672
  ]
619
- }), /* @__PURE__ */ w(h, {
620
- icon: fe,
673
+ }), /* @__PURE__ */ T(_, {
674
+ icon: pe,
621
675
  iconType: "leading",
622
676
  onClick: s,
623
677
  variant: "destructive-text-link",
624
678
  children: "移除"
625
679
  })]
626
680
  }),
627
- /* @__PURE__ */ w(n, {
681
+ /* @__PURE__ */ T(n, {
628
682
  label: "端點",
629
683
  name: `webhookEndpoint-${c.id}`,
630
684
  required: !0,
631
- children: /* @__PURE__ */ w(y, {
685
+ children: /* @__PURE__ */ T(x, {
632
686
  clearable: !1,
633
687
  disabled: r !== "ready",
634
688
  onChange: (t) => {
635
- let n = e.find((e) => I(e) === t?.id);
636
- n && o(Bt(c, n, i ?? []));
689
+ let n = e.find((e) => R(e) === t?.id);
690
+ n && o(Zt(c, n, i ?? []));
637
691
  },
638
692
  options: [...d],
639
693
  placeholder: "選擇端點",
640
694
  value: d.find((e) => e.id === u) ?? null
641
695
  })
642
696
  }),
643
- r === "ready" && !l ? /* @__PURE__ */ w(S, {
697
+ r === "ready" && !l ? /* @__PURE__ */ T(C, {
644
698
  color: "text-warning",
645
699
  variant: "body",
646
700
  children: "找不到這個端點,設定會保留;請改選其他端點或移除,否則無法發布。"
647
701
  }) : null,
648
- l?.disabled ? /* @__PURE__ */ w(S, {
702
+ l?.disabled ? /* @__PURE__ */ T(C, {
649
703
  color: "text-warning",
650
704
  variant: "body",
651
705
  children: "這個端點已被管理者停用,不會再送出;設定會保留,請改選其他端點,否則無法發布。"
652
- }) : l?.deprecated ? /* @__PURE__ */ w(S, {
706
+ }) : l?.deprecated ? /* @__PURE__ */ T(C, {
653
707
  color: "text-warning",
654
708
  variant: "body",
655
709
  children: "這個端點不建議再使用,設定會保留;請改選其他端點,否則無法發布。"
656
710
  }) : null,
657
- l?.description ? /* @__PURE__ */ w(S, {
711
+ l?.description ? /* @__PURE__ */ T(C, {
658
712
  color: "text-neutral",
659
713
  variant: "caption",
660
714
  children: l.description
661
715
  }) : null,
662
- l && !l.parameters.length ? /* @__PURE__ */ w(S, {
716
+ l && !l.parameters.length ? /* @__PURE__ */ T(C, {
663
717
  color: "text-neutral",
664
718
  variant: "caption",
665
719
  children: "這個端點不需要參數。"
666
720
  }) : null,
667
- (l?.parameters ?? []).map((e) => /* @__PURE__ */ w(Qt, {
721
+ (l?.parameters ?? []).map((e) => /* @__PURE__ */ T(un, {
668
722
  formFields: i,
669
- onChange: (t) => o(zt(c, e.key, t)),
723
+ onChange: (t) => o(Xt(c, e.key, t)),
670
724
  parameter: e,
671
725
  source: c.bindings.find((t) => t.parameter === e.key)?.from ?? null,
672
726
  targetId: c.id
673
727
  }, e.key)),
674
- p.map((e) => /* @__PURE__ */ T("div", {
675
- style: Wt,
676
- children: [/* @__PURE__ */ T(S, {
728
+ p.map((e) => /* @__PURE__ */ E("div", {
729
+ style: tn,
730
+ children: [/* @__PURE__ */ E(C, {
677
731
  color: "text-warning",
678
732
  variant: "body",
679
733
  children: [
@@ -681,8 +735,8 @@ function Zt({ activeEndpoints: e, catalog: t, catalogState: r, formFields: i, in
681
735
  e.parameter,
682
736
  "」已不在端點定義中。"
683
737
  ]
684
- }), /* @__PURE__ */ w(h, {
685
- onClick: () => o(zt(c, e.parameter, null)),
738
+ }), /* @__PURE__ */ T(_, {
739
+ onClick: () => o(Xt(c, e.parameter, null)),
686
740
  variant: "base-text-link",
687
741
  children: "移除設定"
688
742
  })]
@@ -690,9 +744,9 @@ function Zt({ activeEndpoints: e, catalog: t, catalogState: r, formFields: i, in
690
744
  ]
691
745
  });
692
746
  }
693
- function Qt({ formFields: e, onChange: t, parameter: r, source: i, targetId: a }) {
694
- let o = i?.kind === "FIELD" || R(e ?? [], r.type).length > 0, s = [...r.required ? [] : [Kt], ...Nt(r.type).filter((e) => e !== "FIELD" || o).map((e) => qt[e])], c = Mt[r.type];
695
- return /* @__PURE__ */ w(n, {
747
+ function un({ formFields: e, onChange: t, parameter: r, source: i, targetId: a }) {
748
+ let o = i?.kind === "FIELD" || Wt(e ?? [], r.type).length > 0, s = [...r.required ? [] : [rn], ...Ut(r.type).filter((e) => e !== "FIELD" || o).map((e) => an[e])], c = Vt[r.type];
749
+ return /* @__PURE__ */ T(n, {
696
750
  hintText: [
697
751
  r.key,
698
752
  c,
@@ -701,18 +755,18 @@ function Qt({ formFields: e, onChange: t, parameter: r, source: i, targetId: a }
701
755
  label: r.label,
702
756
  name: `webhookBinding-${a}-${r.key}`,
703
757
  required: r.required,
704
- children: /* @__PURE__ */ T("div", {
705
- style: Gt,
706
- children: [/* @__PURE__ */ w(y, {
758
+ children: /* @__PURE__ */ E("div", {
759
+ style: nn,
760
+ children: [/* @__PURE__ */ T(x, {
707
761
  clearable: !1,
708
762
  onChange: (n) => {
709
- let i = nn(n?.id ?? null);
710
- t(i ? Pt(i, r, e ?? []) : null);
763
+ let i = pn(n?.id ?? null);
764
+ t(i ? Gt(i, r, e ?? []) : null);
711
765
  },
712
766
  options: [...s],
713
767
  placeholder: "選擇來源",
714
- value: i ? qt[i.kind] : r.required ? null : Kt
715
- }), i ? /* @__PURE__ */ w($t, {
768
+ value: i ? an[i.kind] : r.required ? null : rn
769
+ }), i ? /* @__PURE__ */ T(dn, {
716
770
  formFields: e,
717
771
  onChange: t,
718
772
  parameter: r,
@@ -721,21 +775,21 @@ function Qt({ formFields: e, onChange: t, parameter: r, source: i, targetId: a }
721
775
  })
722
776
  });
723
777
  }
724
- function $t({ formFields: e, onChange: t, parameter: n, source: r }) {
778
+ function dn({ formFields: e, onChange: t, parameter: n, source: r }) {
725
779
  if (r.kind === "FIELD") {
726
- if (!e) return /* @__PURE__ */ w(S, {
780
+ if (!e) return /* @__PURE__ */ T(C, {
727
781
  color: "text-neutral",
728
782
  variant: "caption",
729
783
  children: "請先綁定表單版本,才能選擇表單欄位。"
730
784
  });
731
- let i = R(e, n.type).map((e) => ({
785
+ let i = Wt(e, n.type).map((e) => ({
732
786
  id: e.fieldKey,
733
787
  name: `${e.label}(${e.fieldKey})`
734
788
  })), a = r.fieldKey && !i.some((e) => e.id === r.fieldKey) ? [...i, {
735
789
  id: r.fieldKey,
736
790
  name: `${r.fieldKey}(找不到相容欄位)`
737
791
  }] : i;
738
- return /* @__PURE__ */ w(y, {
792
+ return /* @__PURE__ */ T(x, {
739
793
  clearable: !1,
740
794
  onChange: (e) => t({
741
795
  fieldKey: e?.id ?? "",
@@ -746,25 +800,25 @@ function $t({ formFields: e, onChange: t, parameter: n, source: r }) {
746
800
  value: a.find((e) => e.id === r.fieldKey) ?? null
747
801
  });
748
802
  }
749
- return r.kind === "CONTEXT" ? /* @__PURE__ */ w(y, {
803
+ return r.kind === "CONTEXT" ? /* @__PURE__ */ T(x, {
750
804
  clearable: !1,
751
805
  onChange: (e) => {
752
- nt(e?.id) && t({
806
+ N(e?.id) && t({
753
807
  kind: "CONTEXT",
754
808
  path: e.id
755
809
  });
756
810
  },
757
- options: [...Yt],
758
- value: Yt.find((e) => e.id === r.path) ?? null
759
- }) : n.type === "boolean" ? /* @__PURE__ */ w(y, {
811
+ options: [...sn],
812
+ value: sn.find((e) => e.id === r.path) ?? null
813
+ }) : n.type === "boolean" ? /* @__PURE__ */ T(x, {
760
814
  clearable: !1,
761
815
  onChange: (e) => t({
762
816
  kind: "CONSTANT",
763
817
  value: e?.id === "true"
764
818
  }),
765
- options: [...Jt],
766
- value: typeof r.value == "boolean" ? Jt.find((e) => e.id === String(r.value)) ?? null : null
767
- }) : /* @__PURE__ */ w(en, {
819
+ options: [...on],
820
+ value: typeof r.value == "boolean" ? on.find((e) => e.id === String(r.value)) ?? null : null
821
+ }) : /* @__PURE__ */ T(fn, {
768
822
  onChange: (e) => t({
769
823
  kind: "CONSTANT",
770
824
  value: e
@@ -773,21 +827,21 @@ function $t({ formFields: e, onChange: t, parameter: n, source: r }) {
773
827
  value: r.value
774
828
  });
775
829
  }
776
- function en({ onChange: e, type: t, value: n }) {
777
- let [r, i] = p(n === null ? "" : String(n));
778
- return u(() => {
779
- i((e) => It(t, e) === n ? e : n === null ? "" : String(n));
780
- }, [t, n]), /* @__PURE__ */ w(_, {
830
+ function fn({ onChange: e, type: t, value: n }) {
831
+ let [r, i] = h(n === null ? "" : String(n));
832
+ return f(() => {
833
+ i((e) => qt(t, e) === n ? e : n === null ? "" : String(n));
834
+ }, [t, n]), /* @__PURE__ */ T(y, {
781
835
  inputProps: { inputMode: t === "number" ? "decimal" : void 0 },
782
836
  onChange: (n) => {
783
- i(n.target.value), e(It(t, n.target.value));
837
+ i(n.target.value), e(qt(t, n.target.value));
784
838
  },
785
839
  placeholder: t === "number" ? "輸入數字" : "輸入固定值",
786
840
  value: r,
787
841
  variant: "base"
788
842
  });
789
843
  }
790
- function tn(e) {
844
+ function z(e) {
791
845
  let t = [
792
846
  `v${e.version}`,
793
847
  ...e.source === "DATABASE" ? ["後台維護"] : [],
@@ -795,26 +849,113 @@ function tn(e) {
795
849
  ];
796
850
  return `${e.label}(${t.join(",")})`;
797
851
  }
798
- function nn(e) {
852
+ function pn(e) {
799
853
  return e === "FIELD" || e === "CONSTANT" || e === "CONTEXT" ? e : null;
800
854
  }
801
855
  //#endregion
856
+ //#region src/views/templates/designer/dry-run-sample-data.ts
857
+ function mn(e) {
858
+ return (e?.fields ?? []).reduce((e, t) => ({
859
+ ...e,
860
+ [t.fieldKey]: gn(t)
861
+ }), {});
862
+ }
863
+ function hn(e) {
864
+ return `formMember:${e}`;
865
+ }
866
+ function gn(e) {
867
+ if (e.type === "number") return 1e3;
868
+ if (e.type === "boolean") return !0;
869
+ if (e.type === "member") {
870
+ let t = hn(e.fieldKey);
871
+ return e.multiple ? [t] : t;
872
+ }
873
+ return Te(e) ? e.type === "checkbox" ? e.options[0] ? [e.options[0].value] : [] : e.options[0]?.value ?? "" : e.type === "date" ? "2026-05-08" : e.type === "datetime" ? "2026-05-08T09:00:00+08:00" : e.placeholder ?? e.label;
874
+ }
875
+ //#endregion
876
+ //#region src/views/templates/designer/dry-run-assignee-label.ts
877
+ function _n(e, t) {
878
+ let [n, ...r] = e.split(":"), i = (e) => t.orgUnits.find((t) => t.id === e)?.name ?? e, a = (e) => t.positions.find((t) => t.id === e)?.name ?? e;
879
+ return n === "position" && r.length === 1 && r[0] ? `職位:${a(r[0])}(送出時依當下人員決定)` : n === "orgUnitMember" && r.length === 1 && r[0] ? `組織任一人:${i(r[0])}` : n === "orgUnitPosition" && r.length === 2 && r[0] && r[1] ? `組織職位:${i(r[0])}/${a(r[1])}` : n === "orgUnitManager" && r.length === 1 && r[0] ? `組織主管:${i(r[0])}` : n === "formMember" && r.length === 1 && r[0] ? `表單欄位「${((e) => t.formFields.find((t) => t.fieldKey === e)?.label || e)(r[0])}」選的人(送出時依填寫內容決定)` : n === "orgManagerChain" && r.length === 1 && r[0] ? `主管鏈:簽到職等 ${r[0]}(送出時依組織決定實際主管)` : t.memberName(e) ?? e;
880
+ }
881
+ //#endregion
882
+ //#region src/views/templates/designer/dynamic-form-resolver-options.ts
883
+ var vn = "表單中沒有「人員選擇」欄位,請先到表單設計加入", yn = "原本指定的欄位已不在表單中,或已不是「人員選擇」欄位,請重新選擇。", bn = "此欄位非必填", xn = "此欄位可能被條件隱藏", B = "此欄位為隱藏欄位,申請人無法填寫", Sn = ",空白時此關會找不到人員,發佈時會被拒絕;請在表單設計將它設為必填且不隱藏";
884
+ function Cn(e) {
885
+ let t = [
886
+ ...e.required ? [] : [bn],
887
+ ...e.visibleWhen?.trim() ? [xn] : [],
888
+ ...e.hidden ? [B] : []
889
+ ];
890
+ return t.length > 0 ? `${t.join("、")}${Sn}` : void 0;
891
+ }
892
+ function wn(e) {
893
+ return `${e.required ? "" : "(非必填)"}${e.visibleWhen?.trim() ? "(可能被條件隱藏)" : ""}${e.hidden ? "(隱藏欄位)" : ""}`;
894
+ }
895
+ function Tn(e) {
896
+ return (e?.fields ?? []).filter(Ee).map((e) => {
897
+ let t = Cn(e);
898
+ return {
899
+ id: e.fieldKey,
900
+ name: `${e.label} (${e.fieldKey})${wn(e)}`,
901
+ ...t ? { warning: t } : {}
902
+ };
903
+ });
904
+ }
905
+ function En(e, t) {
906
+ let n = Tn(e), r = n.find((e) => e.id === t) ?? null;
907
+ if (r) return {
908
+ options: n,
909
+ problem: r.warning ?? null,
910
+ selected: r
911
+ };
912
+ if (t.trim()) {
913
+ let e = {
914
+ id: t,
915
+ name: `${t}(無效欄位)`
916
+ };
917
+ return {
918
+ options: [...n, e],
919
+ problem: yn,
920
+ selected: e
921
+ };
922
+ }
923
+ return {
924
+ options: n,
925
+ problem: n.length === 0 ? vn : null,
926
+ selected: null
927
+ };
928
+ }
929
+ function Dn(e, t) {
930
+ if (!t.trim()) return "依表單欄位:未設定";
931
+ let n = e?.fields.find((e) => e.fieldKey === t);
932
+ return n && !Ee(n) ? `依表單欄位:${n.label || t}(非人員選擇欄位)` : `依表單欄位:${n?.label || t}`;
933
+ }
934
+ //#endregion
935
+ //#region src/views/templates/designer/designer-version-labels.ts
936
+ function On(e) {
937
+ return `${e.draftVersion === null ? "尚未建立草稿" : `草稿 v${e.draftVersion}`} · ${e.publishedVersion === null ? e.hasPublishedVersion ? "已發布版本" : "尚未發布" : `已發布 v${e.publishedVersion}`}`;
938
+ }
939
+ function kn(e, t) {
940
+ return `表單:${e} v${t}`;
941
+ }
942
+ //#endregion
802
943
  //#region src/views/templates/designer/TemplateDesignerView.tsx
803
- var rn = {
944
+ var An = {
804
945
  display: "grid",
805
946
  gap: 16
806
- }, an = {
947
+ }, jn = {
807
948
  alignItems: "start",
808
949
  display: "grid",
809
950
  gap: 16,
810
951
  gridTemplateColumns: "minmax(0, 1fr) 420px"
811
- }, on = {
952
+ }, Mn = {
812
953
  border: "1px solid var(--mzn-color-border-neutral)",
813
954
  borderRadius: 6,
814
955
  height: 620,
815
956
  minWidth: 0,
816
957
  overflow: "hidden"
817
- }, sn = {
958
+ }, Nn = {
818
959
  alignItems: "center",
819
960
  boxSizing: "border-box",
820
961
  color: "var(--mzn-color-text-error)",
@@ -824,24 +965,24 @@ var rn = {
824
965
  lineHeight: 0,
825
966
  padding: 0,
826
967
  width: 26
827
- }, cn = {
968
+ }, Pn = {
828
969
  alignItems: "center",
829
970
  display: "flex",
830
971
  height: "100%",
831
972
  justifyContent: "center",
832
973
  width: "100%"
833
- }, ln = "workflow-designer-side-panel", un = 96, dn = `
834
- .${ln} .mzn-form-field--stretch .mzn-form-field__label-area,
835
- .${ln} .mzn-form-field--horizontal .mzn-form-field__label-area {
836
- flex: 0 0 ${un}px;
837
- width: ${un}px;
974
+ }, Fn = "workflow-designer-side-panel", V = 96, In = `
975
+ .${Fn} .mzn-form-field--stretch .mzn-form-field__label-area,
976
+ .${Fn} .mzn-form-field--horizontal .mzn-form-field__label-area {
977
+ flex: 0 0 ${V}px;
978
+ width: ${V}px;
838
979
  }
839
980
 
840
- .${ln} .mzn-form-field--stretch .mzn-form-field__data-entry,
841
- .${ln} .mzn-form-field--horizontal .mzn-form-field__data-entry {
981
+ .${Fn} .mzn-form-field--stretch .mzn-form-field__data-entry,
982
+ .${Fn} .mzn-form-field--horizontal .mzn-form-field__data-entry {
842
983
  min-width: 0;
843
984
  }
844
- `, z = "#2563eb", B = "#64748b", fn = "var(--mzn-color-text-error, #dc2626)", pn = "drop-shadow(0 0 3px rgba(0, 87, 255, 0.85)) drop-shadow(0 0 9px rgba(0, 87, 255, 0.36))", mn = `
985
+ `, Ln = "#2563eb", H = "#64748b", Rn = "var(--mzn-color-text-error, #dc2626)", zn = "drop-shadow(0 0 3px rgba(0, 87, 255, 0.85)) drop-shadow(0 0 9px rgba(0, 87, 255, 0.36))", Bn = `
845
986
  .workflow-selection-delete-control.react-flow__controls-button {
846
987
  align-items: center !important;
847
988
  display: flex !important;
@@ -866,26 +1007,26 @@ var rn = {
866
1007
 
867
1008
  .workflow-edge--selected .react-flow__edge-path,
868
1009
  .react-flow__edge-path.workflow-edge--selected {
869
- filter: ${pn};
1010
+ filter: ${zn};
870
1011
  opacity: 1 !important;
871
- stroke: ${B} !important;
1012
+ stroke: ${H} !important;
872
1013
  stroke-opacity: 1 !important;
873
1014
  stroke-width: 1.5px !important;
874
1015
  }
875
1016
 
876
1017
  .workflow-edge--selected {
877
- --xy-edge-stroke: ${B};
878
- --xy-edge-stroke-selected: ${B};
1018
+ --xy-edge-stroke: ${H};
1019
+ --xy-edge-stroke-selected: ${H};
879
1020
  --xy-edge-stroke-width: 1.5px;
880
1021
  }
881
1022
 
882
- `, hn = {
1023
+ `, Vn = {
883
1024
  display: "grid",
884
1025
  gap: 12
885
- }, V = {
1026
+ }, U = {
886
1027
  display: "grid",
887
1028
  gap: 12
888
- }, gn = {
1029
+ }, Hn = {
889
1030
  border: "1px solid var(--mzn-color-border-neutral)",
890
1031
  borderRadius: 6,
891
1032
  display: "grid",
@@ -893,26 +1034,26 @@ var rn = {
893
1034
  maxHeight: 360,
894
1035
  overflow: "auto",
895
1036
  padding: 12
896
- }, _n = {
1037
+ }, Un = {
897
1038
  borderBottom: "1px solid var(--mzn-color-border-neutral)",
898
1039
  display: "grid",
899
1040
  gap: 4,
900
1041
  padding: "0 0 8px"
901
- }, vn = {
1042
+ }, Wn = {
902
1043
  display: "flex",
903
1044
  flexWrap: "wrap",
904
1045
  gap: 8
905
- }, yn = {
1046
+ }, Gn = {
906
1047
  alignItems: "center",
907
1048
  display: "flex",
908
1049
  gap: 8
909
- }, bn = {
1050
+ }, Kn = {
910
1051
  flex: "1 1 auto",
911
1052
  minWidth: 0
912
- }, xn = { flex: "0 0 auto" }, Sn = {
1053
+ }, qn = { flex: "0 0 auto" }, Jn = {
913
1054
  display: "grid",
914
1055
  gap: 8
915
- }, H = {
1056
+ }, Yn = {
916
1057
  alignContent: "center",
917
1058
  background: "var(--mzn-color-bg-surface)",
918
1059
  border: "1px solid var(--mzn-color-border-neutral)",
@@ -927,70 +1068,70 @@ var rn = {
927
1068
  padding: "10px 12px",
928
1069
  textAlign: "center",
929
1070
  width: "100%"
930
- }, Cn = "0 8px 20px rgba(15, 23, 42, 0.08), 0 0 0 1px var(--mzn-color-primary, #0057ff), 0 0 10px rgba(0, 87, 255, 0.3)", wn = 64, Tn = 160, En = 20, U = 64, Dn = 180, On = {
931
- ...H,
1071
+ }, Xn = "0 8px 20px rgba(15, 23, 42, 0.08), 0 0 0 1px var(--mzn-color-primary, #0057ff), 0 0 10px rgba(0, 87, 255, 0.3)", W = 64, G = 160, Zn = 20, Qn = 64, K = 180, q = {
1072
+ ...Yn,
932
1073
  display: "grid",
933
1074
  gap: 8,
934
1075
  padding: "10px 12px"
935
- }, kn = {
936
- ...On,
1076
+ }, $n = {
1077
+ ...q,
937
1078
  background: "#eff6ff",
938
1079
  border: "1px solid #2563eb"
939
- }, An = {
940
- ...On,
1080
+ }, er = {
1081
+ ...q,
941
1082
  background: "#f0fdfa",
942
1083
  border: "1px solid #0f766e"
943
- }, jn = {
944
- ...H,
1084
+ }, tr = {
1085
+ ...Yn,
945
1086
  background: "#ffffff"
946
- }, Mn = {
947
- ...H,
1087
+ }, J = {
1088
+ ...Yn,
948
1089
  background: "#ecfdf3",
949
1090
  border: "1px solid #2f855a"
950
- }, W = {
951
- ...H,
1091
+ }, nr = {
1092
+ ...Yn,
952
1093
  background: "#fff4ed",
953
1094
  border: "1px solid #c2410c"
954
- }, Nn = {
1095
+ }, rr = {
955
1096
  display: "block",
956
1097
  maxWidth: "100%",
957
1098
  minWidth: 0
958
- }, Pn = {
1099
+ }, ir = {
959
1100
  display: "grid",
960
1101
  gap: 2,
961
1102
  minWidth: 0
962
- }, G = "input", Fn = "output", In = {
1103
+ }, ar = "input", or = "output", sr = {
963
1104
  endEvent: "結束",
964
1105
  exclusiveGateway: "條件分流",
965
1106
  parallelGateway: "並行處理",
966
1107
  serviceTask: "系統",
967
1108
  startEvent: "開始",
968
1109
  userTask: "簽核"
969
- }, Ln = [{
970
- icon: pe,
1110
+ }, cr = [{
1111
+ icon: me,
971
1112
  label: "簽核節點",
972
1113
  type: "userTask"
973
1114
  }, {
974
- icon: le,
1115
+ icon: ue,
975
1116
  label: "知會節點",
976
1117
  type: "serviceTask"
977
- }], Rn = [{
978
- icon: ce,
1118
+ }], lr = [{
1119
+ icon: le,
979
1120
  label: "條件分流",
980
1121
  type: "exclusiveGateway"
981
- }], zn = [{
1122
+ }], ur = [{
982
1123
  id: "AND",
983
1124
  name: "全部前置完成"
984
1125
  }, {
985
1126
  id: "OR",
986
1127
  name: "任一前置完成"
987
- }], Bn = [{
1128
+ }], dr = [{
988
1129
  id: "RESTART",
989
1130
  name: "重新送出後從開始重跑"
990
1131
  }, {
991
1132
  id: "FROM_RETURN_POINT",
992
1133
  name: "重新送出後回到退回節點"
993
- }], Vn = [
1134
+ }], fr = [
994
1135
  {
995
1136
  id: "NONE",
996
1137
  name: "不提醒",
@@ -1011,15 +1152,23 @@ var rn = {
1011
1152
  name: "剩十分之一時提醒",
1012
1153
  value: .9
1013
1154
  }
1014
- ], Hn = [
1155
+ ], pr = [
1015
1156
  {
1016
1157
  id: "DIRECT",
1017
1158
  name: "指定會員"
1018
1159
  },
1160
+ {
1161
+ id: "DYNAMIC_FORM",
1162
+ name: "依表單欄位指定"
1163
+ },
1019
1164
  {
1020
1165
  id: "ORG_MANAGER",
1021
1166
  name: "發起人主管"
1022
1167
  },
1168
+ {
1169
+ id: "ORG_MANAGER_CHAIN",
1170
+ name: "主管鏈(簽到指定職等)"
1171
+ },
1023
1172
  {
1024
1173
  id: "ORG_UNIT_MANAGER",
1025
1174
  name: "指定組織主管"
@@ -1036,30 +1185,13 @@ var rn = {
1036
1185
  id: "POSITION",
1037
1186
  name: "指定職位"
1038
1187
  }
1039
- ], Un = [
1040
- {
1041
- id: "SINGLE",
1042
- name: "單人簽核"
1043
- },
1044
- {
1045
- id: "PARALLEL_ANY",
1046
- name: "任一人同意"
1047
- },
1048
- {
1049
- id: "PARALLEL_ALL",
1050
- name: "全部同意"
1051
- },
1052
- {
1053
- id: "QUORUM",
1054
- name: "達到指定門檻"
1055
- }
1056
- ], Wn = [{
1188
+ ], mr = [{
1057
1189
  id: "COUNT",
1058
1190
  name: "人數"
1059
1191
  }, {
1060
1192
  id: "PERCENTAGE",
1061
1193
  name: "百分比"
1062
- }], K = [
1194
+ }], Y = [
1063
1195
  {
1064
1196
  id: "1",
1065
1197
  name: "直屬主管",
@@ -1075,13 +1207,26 @@ var rn = {
1075
1207
  name: "第三層主管",
1076
1208
  value: 3
1077
1209
  }
1078
- ], Gn = [{
1210
+ ], hr = [{
1079
1211
  id: "NONE",
1080
1212
  name: "停止流程並提示"
1081
1213
  }, {
1082
1214
  id: "DIRECT",
1083
1215
  name: "固定改派"
1084
- }], Kn = [
1216
+ }], gr = [
1217
+ {
1218
+ id: "INITIATOR_MANAGER",
1219
+ name: "改由申請人的直屬主管簽核"
1220
+ },
1221
+ {
1222
+ id: "SKIP_NODE",
1223
+ name: "跳過此關"
1224
+ },
1225
+ {
1226
+ id: "FAIL",
1227
+ name: "停止流程並提示"
1228
+ }
1229
+ ], _r = { whenEmpty: "INITIATOR_MANAGER" }, vr = [
1085
1230
  {
1086
1231
  id: "EQUALS",
1087
1232
  name: "等於"
@@ -1114,14 +1259,14 @@ var rn = {
1114
1259
  id: "IS_EMPTY",
1115
1260
  name: "未填寫"
1116
1261
  }
1117
- ], qn = [
1262
+ ], yr = [
1118
1263
  "EQUALS",
1119
1264
  "GREATER_THAN",
1120
1265
  "GREATER_THAN_OR_EQUALS",
1121
1266
  "LESS_THAN",
1122
1267
  "LESS_THAN_OR_EQUALS",
1123
1268
  "NOT_EQUALS"
1124
- ], Jn = [
1269
+ ], br = [
1125
1270
  {
1126
1271
  id: "NONE",
1127
1272
  name: "未設定"
@@ -1138,93 +1283,93 @@ var rn = {
1138
1283
  id: "ORG_UNIT_POSITION",
1139
1284
  name: "指定組織職位"
1140
1285
  }
1141
- ], Yn = {
1286
+ ], xr = {
1142
1287
  id: "CUSTOM",
1143
1288
  name: "既有自訂規則"
1144
- }, Xn = "member-001", Zn = {
1289
+ }, Sr = "member-001", Cr = {
1145
1290
  display: "flex",
1146
1291
  flexDirection: "column",
1147
1292
  height: "100%"
1148
- }, Qn = {
1293
+ }, wr = {
1149
1294
  flex: 1,
1150
1295
  minHeight: 0,
1151
1296
  overflowY: "auto"
1152
- }, $n = {
1297
+ }, Tr = {
1153
1298
  borderTop: "1px solid var(--mzn-color-border-neutral)",
1154
1299
  display: "flex",
1155
1300
  gap: 8,
1156
1301
  paddingTop: 12
1157
- }, er = {
1302
+ }, Er = {
1158
1303
  fields: [],
1159
1304
  schemaVersion: 1
1160
- }, tr = {
1305
+ }, Dr = {
1161
1306
  layout: [],
1162
1307
  schemaVersion: 1
1163
- }, nr = {
1164
- endEvent: q,
1165
- exclusiveGateway: q,
1166
- parallelGateway: q,
1167
- serviceTask: q,
1168
- startEvent: q,
1169
- userTask: q
1308
+ }, Or = {
1309
+ endEvent: X,
1310
+ exclusiveGateway: X,
1311
+ parallelGateway: X,
1312
+ serviceTask: X,
1313
+ startEvent: X,
1314
+ userTask: X
1170
1315
  };
1171
- function rr(e, t) {
1316
+ function kr(e, t) {
1172
1317
  return typeof e == "function" ? e(t) : e;
1173
1318
  }
1174
- function ir({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride: c, initialInitiatorPolicyCel: oe, initialWorkflowDefinition: ce, onInitiatorPolicyChange: le, onWorkflowChange: ue, showAiAssistant: pe = !1, showDryRun: me = !0, templateId: he }) {
1175
- let ge = e(), _e = t(), [E, ve] = p(null), [ye, be] = p(null), [xe, Ce] = p(""), [we, D] = p(null), [je, O] = p(null), Pe = f(null), [Fe, Ke] = p(void 0), qe = f([]), Ye = f([]), k = ut({
1176
- directory: d(() => ({
1177
- listOrgUnits: async () => qe.current.map((e) => ({
1319
+ function Ar({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride: u, initialInitiatorPolicyCel: se, initialWorkflowDefinition: le, onInitiatorPolicyChange: ue, onWorkflowChange: de, showAiAssistant: me = !1, showDryRun: he = !0, templateId: ge }) {
1320
+ let _e = e(), ve = t(), [D, ye] = h(null), [be, xe] = h(null), [Se, we] = h(""), [Te, Ee] = h(null), [Me, Pe] = h(null), O = m(null), [Le, Re] = h(void 0), Ye = m([]), Xe = m([]), k = yt({
1321
+ directory: p(() => ({
1322
+ listOrgUnits: async () => Ye.current.map((e) => ({
1178
1323
  id: e.id,
1179
1324
  name: e.name
1180
1325
  })),
1181
- listPositions: async () => Ye.current.map((e) => ({
1326
+ listPositions: async () => Xe.current.map((e) => ({
1182
1327
  id: e.id,
1183
1328
  name: e.name
1184
1329
  })),
1185
- searchMembers: async (e) => mi(await Ue(e)).map((e) => ({
1330
+ searchMembers: async (e) => Li(await Ke(e)).map((e) => ({
1186
1331
  email: e.email,
1187
1332
  id: e.memberId,
1188
1333
  name: e.name
1189
1334
  }))
1190
1335
  }), []),
1191
1336
  initialState: {
1192
- definition: a && ce != null ? hr(ce) : br(),
1337
+ definition: a && le != null ? Vr(le) : Kr(),
1193
1338
  editingEdgeId: null,
1194
1339
  formDefinitionVersionId: null,
1195
1340
  formSchema: null,
1196
- initiatorPolicyCel: a && oe !== void 0 ? oe : null,
1341
+ initiatorPolicyCel: a && se !== void 0 ? se : null,
1197
1342
  selectedEdgeIds: [],
1198
- selectedNodeId: a && ce != null ? ce.nodes[0]?.id ?? "start" : "start"
1343
+ selectedNodeId: a && le != null ? le.nodes[0]?.id ?? "start" : "start"
1199
1344
  },
1200
- layout: Sr,
1345
+ layout: Jr,
1201
1346
  onLayout: (e) => {
1202
- let t = Li(e, Pe.current);
1203
- t && Ke(t);
1347
+ let t = sa(e, O.current);
1348
+ t && Re(t);
1204
1349
  }
1205
- }), A = k.state.definition, j = k.state.formDefinitionVersionId, M = k.state.initiatorPolicyCel, nt = k.state.selectedNodeId, N = k.state.selectedEdgeIds, it = k.state.editingEdgeId, at = (e) => k.replaceState((t) => ({
1350
+ }), A = k.state.definition, j = k.state.formDefinitionVersionId, M = k.state.initiatorPolicyCel, it = k.state.selectedNodeId, N = k.state.selectedEdgeIds, ot = k.state.editingEdgeId, st = (e) => k.replaceState((t) => ({
1206
1351
  ...t,
1207
- definition: rr(e, t.definition)
1208
- })), ot = (e) => k.replaceState((t) => ({
1352
+ definition: kr(e, t.definition)
1353
+ })), lt = (e) => k.replaceState((t) => ({
1209
1354
  ...t,
1210
- formDefinitionVersionId: rr(e, t.formDefinitionVersionId)
1211
- })), st = (e) => k.replaceState((t) => ({
1355
+ formDefinitionVersionId: kr(e, t.formDefinitionVersionId)
1356
+ })), ut = (e) => k.replaceState((t) => ({
1212
1357
  ...t,
1213
- initiatorPolicyCel: rr(e, t.initiatorPolicyCel)
1358
+ initiatorPolicyCel: kr(e, t.initiatorPolicyCel)
1214
1359
  })), dt = (e) => k.replaceState((t) => ({
1215
1360
  ...t,
1216
- selectedNodeId: rr(e, t.selectedNodeId)
1361
+ selectedNodeId: kr(e, t.selectedNodeId)
1217
1362
  })), ft = (e) => k.replaceState((t) => ({
1218
1363
  ...t,
1219
- selectedEdgeIds: rr(e, t.selectedEdgeIds)
1364
+ selectedEdgeIds: kr(e, t.selectedEdgeIds)
1220
1365
  })), pt = (e) => k.replaceState((t) => ({
1221
1366
  ...t,
1222
- editingEdgeId: rr(e, t.editingEdgeId)
1223
- })), [mt, P] = p(null), [ht, gt] = p(null);
1224
- u(() => {
1225
- gt(null);
1226
- }, [nt]);
1227
- let [_t, vt] = p(!0), [yt, bt] = p(!1), [xt, St] = p(!1), [Ct, wt] = p([]), Tt = d(() => JSON.stringify({
1367
+ editingEdgeId: kr(e, t.editingEdgeId)
1368
+ })), [bt, P] = h(null), [xt, F] = h(null);
1369
+ f(() => {
1370
+ F(null);
1371
+ }, [it]);
1372
+ let [St, Ct] = h(!0), [wt, Tt] = h(!1), [Et, Dt] = h(!1), [Ot, kt] = h([]), At = p(() => JSON.stringify({
1228
1373
  formDefinitionVersionId: j,
1229
1374
  initiatorPolicyCel: M,
1230
1375
  workflowDefinition: A
@@ -1232,250 +1377,248 @@ function ir({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
1232
1377
  j,
1233
1378
  M,
1234
1379
  A
1235
- ]), Et = !!xe && Tt !== xe, [Dt, Ot] = p(!1), [F, At] = p([]), [jt, Mt] = p([]), I = f(0), [L, Nt] = p([]), [R, Pt] = p([]), [Ft, It] = p([]);
1236
- qe.current = L, Ye.current = R;
1237
- let [Rt, zt] = p(!1), [Bt, Ht] = p(!1), [Ut, Wt] = p("{}"), [Gt, Kt] = p(null), [qt, Jt] = p(null), [Yt, Zt] = p([]), [Qt, $t] = p("loading"), [en, tn] = p(!1), [nn, un] = p(!1), [z, B] = p(null), [pn, H] = p(!1), [Cn, wn] = p(!1), Tn = Et || pn ? "保存並發布" : ye ? "發布草稿" : "已發布";
1238
- u(() => {
1239
- a ? lr() : J();
1240
- }, [a, he]), u(() => {
1380
+ ]), jt = !!Se && At !== Se, [Mt, Nt] = h(!1), [I, Pt] = h([]), [Ft, It] = h([]), Rt = m(0), Bt = m(/* @__PURE__ */ new Set()), [L, Vt] = h([]), [R, Ht] = h([]), [Ut, Wt] = h([]);
1381
+ Ye.current = L, Xe.current = R;
1382
+ let [Gt, Kt] = h(!1), [qt, Yt] = h(!1), [Xt, Zt] = h("{}"), [$t, en] = h(null), [tn, nn] = h(null), [rn, an] = h([]), [on, sn] = h("loading"), [ln, un] = h(!1), [dn, fn] = h(!1), [z, pn] = h(null), [hn, gn] = h(!1), [vn, yn] = h(!1), bn = jt || hn ? "保存並發布" : be ? "發布草稿" : "已發布";
1383
+ f(() => {
1384
+ a ? $n() : er();
1385
+ }, [a, ge]), f(() => {
1241
1386
  function e(e) {
1242
- Et && (e.preventDefault(), e.returnValue = "");
1387
+ jt && (e.preventDefault(), e.returnValue = "");
1243
1388
  }
1244
1389
  return window.addEventListener("beforeunload", e), () => {
1245
1390
  window.removeEventListener("beforeunload", e);
1246
1391
  };
1247
- }, [Et]), u(() => {
1248
- fr(A);
1249
- }, [A, F]), u(() => {
1250
- at((e) => hr(e));
1392
+ }, [jt]), f(() => {
1393
+ nr(A);
1394
+ }, [A, I]), f(() => {
1395
+ st((e) => Vr(e));
1251
1396
  }, [A.edges, A.nodes]);
1252
- function En() {
1253
- (!Et || window.confirm("目前有尚未儲存的流程草稿,確定要離開嗎?")) && ge.push(_e.templates());
1397
+ function xn() {
1398
+ (!jt || window.confirm("目前有尚未儲存的流程草稿,確定要離開嗎?")) && _e.push(ve.templates());
1254
1399
  }
1255
- let U = d(() => A.nodes.find((e) => e.id === nt) ?? null, [nt, A.nodes]), Dn = U ? ni(U) : !1, On = N.length > 0 || Dn, kn = l(() => {
1400
+ let B = p(() => A.nodes.find((e) => e.id === it) ?? null, [it, A.nodes]), Sn = B ? Ei(B) : !1, Cn = N.length > 0 || Sn, wn = d(() => {
1256
1401
  k.getState().selectedEdgeIds.forEach((e) => k.dispatch({
1257
1402
  edgeId: e,
1258
1403
  type: "deleteEdge"
1259
- })), U && ni(U) && k.dispatch({
1260
- nodeId: U.id,
1404
+ })), B && Ei(B) && k.dispatch({
1405
+ nodeId: B.id,
1261
1406
  type: "deleteNode"
1262
1407
  });
1263
- }, [k, U]);
1264
- u(() => {
1265
- if (!On) return;
1408
+ }, [k, B]);
1409
+ f(() => {
1410
+ if (!Cn) return;
1266
1411
  function e(e) {
1267
- (e.key === "Delete" || e.key === "Backspace") && (oi(e.target) || (e.preventDefault(), kn()));
1412
+ (e.key === "Delete" || e.key === "Backspace") && (Ai(e.target) || (e.preventDefault(), wn()));
1268
1413
  }
1269
1414
  return window.addEventListener("keydown", e), () => {
1270
1415
  window.removeEventListener("keydown", e);
1271
1416
  };
1272
- }, [On, kn]);
1273
- let An = d(() => A.edges.find((e) => e.id === it) ?? null, [it, A.edges]), jn = d(() => N.length === 1 ? A.edges.find((e) => e.id === N[0]) ?? null : null, [N, A.edges]), Mn = d(() => N.map((e) => A.edges.find((t) => t.id === e) ?? null).filter((e) => !!e), [N, A.edges]), W = d(() => je ?? Jr(M, we), [
1417
+ }, [Cn, wn]);
1418
+ let Tn = p(() => A.edges.find((e) => e.id === ot) ?? null, [ot, A.edges]), Dn = p(() => N.length === 1 ? A.edges.find((e) => e.id === N[0]) ?? null : null, [N, A.edges]), kn = p(() => N.map((e) => A.edges.find((t) => t.id === e) ?? null).filter((e) => !!e), [N, A.edges]), V = p(() => Me ?? vi(M, Te), [
1274
1419
  M,
1275
- je,
1276
- we
1277
- ]), Nn = d(() => A.nodes.map((e) => ur(e, F, L, R, e.id === nt, W)), [
1278
- W,
1279
- F,
1280
- L,
1281
- R,
1282
- nt,
1283
- A.nodes
1284
- ]), Pn = d(() => A.edges.map((e) => pr(e, A.nodes, N.includes(e.id))), [
1420
+ Me,
1421
+ Te
1422
+ ]), Ln = p(() => A.edges.map((e) => Br(e, A.nodes, N.includes(e.id))), [
1285
1423
  N,
1286
1424
  A.edges,
1287
1425
  A.nodes
1288
- ]), G = d(() => X(Ct, j) ?? X(si(E?.formVersions ?? []), j), [
1426
+ ]), H = p(() => $(Ot, j) ?? $(ji(D?.formVersions ?? []), j), [
1289
1427
  j,
1290
- Ct,
1291
- E?.formVersions
1292
- ]), Fn = d(() => pi(Ct, G), [Ct, G]), Kn = G?.schema ?? null, qn = a ? c ?? null : Kn;
1293
- u(() => {
1294
- k.getState().formSchema !== qn && k.replaceState((e) => ({
1428
+ Ot,
1429
+ D?.formVersions
1430
+ ]), zn = p(() => Ii(Ot, H), [Ot, H]), Yn = H?.schema ?? null, Xn = a ? u ?? null : Yn;
1431
+ f(() => {
1432
+ k.getState().formSchema !== Xn && k.replaceState((e) => ({
1295
1433
  ...e,
1296
- formSchema: qn
1434
+ formSchema: Xn
1297
1435
  }));
1298
- }, [k, qn]);
1299
- let ir = d(() => Ri(A), [A]);
1300
- u(() => {
1436
+ }, [k, Xn]);
1437
+ let W = p(() => ca(A), [A]);
1438
+ f(() => {
1301
1439
  let e = !0;
1302
- return ze({ includeDeprecated: !0 }).then((t) => {
1303
- e && (Zt(t), $t("ready"));
1440
+ return He({ includeDeprecated: !0 }).then((t) => {
1441
+ e && (an(t), sn("ready"));
1304
1442
  }).catch(() => {
1305
- e && $t("unavailable");
1443
+ e && sn("unavailable");
1306
1444
  }), () => {
1307
1445
  e = !1;
1308
1446
  };
1309
1447
  }, []);
1310
- let q = pn && z ? z.schema : qn, or = d(() => Qt === "ready" ? Vt({
1448
+ let G = hn && z ? z.schema : Xn, Zn = p(() => on === "ready" ? Qt({
1311
1449
  definition: A,
1312
- endpoints: Yt,
1313
- formFields: q?.fields ?? []
1450
+ endpoints: rn,
1451
+ formFields: G?.fields ?? []
1314
1452
  })[0] ?? null : null, [
1315
- Yt,
1316
- Qt,
1317
- q,
1453
+ rn,
1454
+ on,
1455
+ G,
1318
1456
  A
1319
- ]), sr = d(() => et(A), [A]), cr = d(() => Yr(W), [W]);
1320
- u(() => {
1321
- a && ue?.(A);
1322
- }, [a, A]), u(() => {
1323
- a && le?.(M);
1457
+ ]), Qn = p(() => A.nodes.map((e) => Ir(e, I, L, R, e.id === it, V, G)), [
1458
+ V,
1459
+ I,
1460
+ L,
1461
+ R,
1462
+ it,
1463
+ G,
1464
+ A.nodes
1465
+ ]), K = p(() => nt(A), [A]), q = p(() => yi(V), [V]);
1466
+ f(() => {
1467
+ a && de?.(A);
1468
+ }, [a, A]), f(() => {
1469
+ a && ue?.(M);
1324
1470
  }, [a, M]);
1325
- async function lr() {
1326
- vt(!0), P(null);
1471
+ async function $n() {
1472
+ Ct(!0), P(null);
1327
1473
  try {
1328
- let e = await Te();
1329
- Nt(e.orgUnits), Pt(e.positions), It(e.memberships);
1474
+ let e = await De();
1475
+ Vt(e.orgUnits), Ht(e.positions), Wt(e.memberships);
1330
1476
  } catch (e) {
1331
- P($(e));
1477
+ P(ba(e));
1332
1478
  } finally {
1333
- vt(!1);
1479
+ Ct(!1);
1334
1480
  }
1335
1481
  }
1336
- async function J() {
1337
- vt(!0), P(null), gt(null);
1482
+ async function er() {
1483
+ Ct(!0), P(null), F(null);
1338
1484
  try {
1339
- let [e, t] = await Promise.all([Ve(he), Te()]), n = e.versions.find((e) => e.status === "DRAFT") ?? null, r = n ?? e.versions[0] ?? null;
1340
- ve(e), be(n), Nt(t.orgUnits), Pt(t.positions), It(t.memberships), wt(si(e.formVersions));
1341
- let i = hr(r?.workflowDefinition ?? br()), a = r?.formDefinitionVersionId ?? e.formVersions[0]?.id ?? null, o = r?.initiatorPolicyCel ?? null;
1342
- at(i), ot(a), st(o), Ce(JSON.stringify({
1485
+ let [e, t] = await Promise.all([We(ge), De()]), n = e.versions.find((e) => e.status === "DRAFT") ?? null, r = n ?? e.versions[0] ?? null;
1486
+ ye(e), xe(n), Vt(t.orgUnits), Ht(t.positions), Wt(t.memberships), kt(ji(e.formVersions));
1487
+ let i = Vr(r?.workflowDefinition ?? Kr()), a = r?.formDefinitionVersionId ?? e.formVersions[0]?.id ?? null, o = r?.initiatorPolicyCel ?? null;
1488
+ st(i), lt(a), ut(o), we(JSON.stringify({
1343
1489
  formDefinitionVersionId: a,
1344
1490
  initiatorPolicyCel: o,
1345
1491
  workflowDefinition: i
1346
- })), D(r && !e.template.currentVersionId && !r.initiatorPolicyCel && xr(r.workflowDefinition) ? "NONE" : null), O(null), dt(r?.workflowDefinition.nodes[0]?.id ?? "start"), ft([]), pt(null), B(null), H(!1);
1492
+ })), Ee(r && !e.template.currentVersionId && !r.initiatorPolicyCel && qr(r.workflowDefinition) ? "NONE" : null), Pe(null), dt(r?.workflowDefinition.nodes[0]?.id ?? "start"), ft([]), pt(null), pn(null), gn(!1);
1347
1493
  } catch (e) {
1348
- P($(e));
1494
+ P(ba(e));
1349
1495
  } finally {
1350
- vt(!1);
1496
+ Ct(!1);
1351
1497
  }
1352
1498
  }
1353
- async function dr(e) {
1354
- St(!0), P(null);
1499
+ async function tr(e) {
1500
+ Dt(!0), P(null);
1355
1501
  try {
1356
- let t = await We(e);
1357
- wt(pi(si(t), G));
1502
+ let t = await qe(e);
1503
+ kt(Ii(ji(t), H));
1358
1504
  } catch (e) {
1359
- P($(e));
1505
+ P(ba(e));
1360
1506
  } finally {
1361
- St(!1);
1507
+ Dt(!1);
1362
1508
  }
1363
1509
  }
1364
- async function Y(e) {
1365
- Ot(!0), P(null);
1366
- let t = ++I.current;
1510
+ async function J(e) {
1511
+ Nt(!0), P(null);
1512
+ let t = ++Rt.current;
1367
1513
  try {
1368
- let n = mi(await Ue(e));
1369
- At((e) => Di(e, n)), t === I.current && Mt(n);
1514
+ let n = Li(await Ke(e));
1515
+ Pt((e) => Zi(e, n)), t === Rt.current && It(n);
1370
1516
  } catch (e) {
1371
- t === I.current && P($(e));
1517
+ t === Rt.current && P(ba(e));
1372
1518
  } finally {
1373
- t === I.current && Ot(!1);
1519
+ t === Rt.current && Nt(!1);
1374
1520
  }
1375
1521
  }
1376
- async function fr(e) {
1377
- let t = ki(e).filter((e) => !F.some((t) => t.memberId === e && !t.unresolved));
1378
- if (t.length !== 0) try {
1379
- let e = await He(t);
1380
- At((t) => Di(t, mi(e)));
1381
- } catch {
1382
- At((e) => Di(e, t.map(hi)));
1383
- }
1522
+ async function nr(e) {
1523
+ let t = $i(e), n = s(t.filter((e) => !I.some((t) => t.memberId === e && !t.unresolved)), Bt.current);
1524
+ if (n.length === 0) return;
1525
+ let { profiles: r, skippedIds: i } = await c(n, Ge), a = new Set(r.map((e) => e.memberId)), o = n.filter((e) => !a.has(e) && !i.includes(e));
1526
+ o.forEach((e) => Bt.current.add(e)), Pt((e) => Zi(e, [...Li(r), ...[...o, ...i].map(Ri)]));
1384
1527
  }
1385
- async function mr(e) {
1386
- bt(!0), P(null);
1528
+ async function rr(e) {
1529
+ Tt(!0), P(null);
1387
1530
  try {
1388
- let t = Ri(A), n = Yr(W), r = e ? or : null;
1531
+ let t = ca(A), n = yi(V), r = e ? Zn : null;
1389
1532
  if (t || n || r) {
1390
1533
  let e = t ?? n ?? r ?? "流程設定未完成";
1391
1534
  throw P(e), Error(e);
1392
1535
  }
1393
- if (pn && z !== null) await Ie({
1394
- category: E?.template.category ?? null,
1395
- categoryId: E?.template.categoryId ?? null,
1396
- formDefinitionId: G?.formDefinitionId ?? null,
1536
+ if (hn && z !== null) await ze({
1537
+ category: D?.template.category ?? null,
1538
+ categoryId: D?.template.categoryId ?? null,
1539
+ formDefinitionId: H?.formDefinitionId ?? null,
1397
1540
  formDescription: null,
1398
- formName: G?.formName ?? E?.template.name ?? "表單",
1541
+ formName: H?.formName ?? D?.template.name ?? "表單",
1399
1542
  initiatorPolicyCel: M,
1400
1543
  notificationConfig: null,
1401
1544
  publish: e,
1402
1545
  schema: z.schema,
1403
1546
  slaDefaults: null,
1404
1547
  templateDescription: null,
1405
- templateId: he ?? null,
1406
- templateName: E?.template.name ?? "模板",
1548
+ templateId: ge ?? null,
1549
+ templateName: D?.template.name ?? "模板",
1407
1550
  uiSchema: z.uiSchema,
1408
1551
  workflowDefinition: A
1409
- }), H(!1), B(null), await J();
1552
+ }), gn(!1), pn(null), await er();
1410
1553
  else {
1411
- let t = ye ?? await Re(he), n = await Ge({
1554
+ let t = be ?? await Ve(ge), n = await Je({
1412
1555
  formDefinitionVersionId: j,
1413
1556
  initiatorPolicyCel: M,
1414
1557
  versionId: t.id,
1415
1558
  workflowDefinition: A
1416
1559
  });
1417
- be(n), e && await Be(n.id), await J();
1560
+ xe(n), e && await Ue(n.id), await er();
1418
1561
  }
1419
1562
  } catch (e) {
1420
- throw P($(e)), e;
1563
+ throw P(ba(e)), e;
1421
1564
  } finally {
1422
- bt(!1);
1565
+ Tt(!1);
1423
1566
  }
1424
1567
  }
1425
- async function gr() {
1426
- await mr(!1);
1568
+ async function ir() {
1569
+ await rr(!1);
1427
1570
  }
1428
- async function _r() {
1429
- await mr(!0);
1571
+ async function ar() {
1572
+ await rr(!0);
1430
1573
  }
1431
- function vr() {
1432
- Wt(JSON.stringify(ci(G), null, 2)), Kt(null), Jt(null), zt(!0);
1574
+ function or() {
1575
+ Zt(JSON.stringify(mn(G), null, 2)), en(null), nn(null), Kt(!0);
1433
1576
  }
1434
- function yr() {
1435
- Bt || zt(!1);
1577
+ function vr() {
1578
+ qt || Kt(!1);
1436
1579
  }
1437
- async function zr() {
1438
- Ht(!0), Jt(null), Kt(null);
1580
+ async function yr() {
1581
+ Yt(!0), nn(null), en(null);
1439
1582
  try {
1440
- let e = ui(Ut), t = await Le({
1583
+ let e = Mi(Xt), t = await Be({
1441
1584
  formData: e,
1442
- initiatorMemberId: Xn,
1443
- initiatorMetadataSnapshot: xi(Xn, Ft),
1585
+ initiatorMemberId: Sr,
1586
+ initiatorMetadataSnapshot: Wi(Sr, Ut),
1444
1587
  workflowDefinition: A
1445
1588
  });
1446
- Kt(t);
1589
+ en(t);
1447
1590
  } catch (e) {
1448
- Jt($(e));
1591
+ nn(ba(e));
1449
1592
  } finally {
1450
- Ht(!1);
1593
+ Yt(!1);
1451
1594
  }
1452
1595
  }
1453
- async function qr() {
1454
- if (un(!0), z !== null) return;
1455
- let e = G?.formDefinitionId ?? null;
1596
+ async function Ar() {
1597
+ if (fn(!0), z !== null) return;
1598
+ let e = H?.formDefinitionId ?? null;
1456
1599
  if (!e) {
1457
- B({
1458
- schema: er,
1459
- uiSchema: tr
1600
+ pn({
1601
+ schema: Er,
1602
+ uiSchema: Dr
1460
1603
  });
1461
1604
  return;
1462
1605
  }
1463
- wn(!0);
1606
+ yn(!0);
1464
1607
  try {
1465
- let t = await Se(e), n = t.versions.find((e) => e.status === "DRAFT") ?? t.versions.find((e) => e.id === t.definition.currentVersionId) ?? t.versions[0] ?? null;
1466
- B({
1467
- schema: n?.schema ?? er,
1468
- uiSchema: n?.uiSchema ?? tr
1608
+ let t = await Ce(e), n = t.versions.find((e) => e.status === "DRAFT") ?? t.versions.find((e) => e.id === t.definition.currentVersionId) ?? t.versions[0] ?? null;
1609
+ pn({
1610
+ schema: n?.schema ?? Er,
1611
+ uiSchema: n?.uiSchema ?? Dr
1469
1612
  });
1470
1613
  } catch (e) {
1471
- P($(e));
1614
+ P(ba(e));
1472
1615
  } finally {
1473
- wn(!1);
1616
+ yn(!1);
1474
1617
  }
1475
1618
  }
1476
- function Xr(e) {
1477
- let t = Ne(e, Nn);
1478
- at((e) => ({
1619
+ function X(e) {
1620
+ let t = Ie(e, Qn);
1621
+ st((e) => ({
1479
1622
  ...e,
1480
1623
  nodes: e.nodes.map((e) => {
1481
1624
  let n = t.find((t) => t.id === e.id);
@@ -1486,110 +1629,126 @@ function ir({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
1486
1629
  })
1487
1630
  }));
1488
1631
  }
1489
- function Qr(e) {
1490
- ei(e, A.nodes) && e.source && e.target && k.dispatch({
1632
+ function Mr(e) {
1633
+ wi(e, A.nodes) && e.source && e.target && k.dispatch({
1491
1634
  source: e.source,
1492
1635
  target: e.target,
1493
1636
  type: "connectEdge"
1494
1637
  });
1495
1638
  }
1496
- function ri(e, t) {
1497
- e.stopPropagation(), ft((n) => e.shiftKey || e.metaKey || e.ctrlKey ? ti(n, t.id) : [t.id]), dt(null);
1639
+ function Nr(e, t) {
1640
+ e.stopPropagation(), ft((n) => e.shiftKey || e.metaKey || e.ctrlKey ? Ti(n, t.id) : [t.id]), dt(null);
1498
1641
  }
1499
- function ii() {
1642
+ function Pr() {
1500
1643
  pt(null);
1501
1644
  }
1502
- function ai(e) {
1645
+ function Fr(e) {
1503
1646
  k.dispatch({
1504
1647
  nodeType: e,
1505
1648
  type: "addNode"
1506
1649
  });
1507
1650
  }
1508
- function li(e) {
1509
- U && k.dispatch({
1651
+ function Lr(e) {
1652
+ B && k.dispatch({
1510
1653
  label: e,
1511
- nodeId: U.id,
1654
+ nodeId: B.id,
1512
1655
  type: "renameNode"
1513
1656
  });
1514
1657
  }
1515
1658
  function Z(e) {
1516
- if (!U || U.type !== "userTask") return;
1517
- let t = U.id, n = U.data.decisionPolicy;
1518
- k.dispatch({
1659
+ if (!B || B.type !== "userTask") return;
1660
+ let t = B.id, n = B.data.decisionPolicy;
1661
+ if (k.dispatch({
1519
1662
  approverResolver: e,
1520
1663
  nodeId: t,
1521
1664
  type: "setUserTaskApprover"
1522
- }), gt(null), tt(n, e) && gt({
1523
- message: `簽核者已變更為 ${rt(e)} 位,不足原本設定的 ${n?.type === "QUORUM" ? n.threshold : 0} 位門檻,簽核政策已重設為單人簽核,請重新設定。`,
1524
- nodeId: t
1665
+ }), F(null), at(e, n)) {
1666
+ F({
1667
+ message: "主管鏈會依序加入多位主管,簽核方式已改為「依序簽核」。",
1668
+ nodeId: t,
1669
+ policyType: "SEQUENTIAL"
1670
+ });
1671
+ return;
1672
+ }
1673
+ rt(n, e) && F({
1674
+ message: `簽核者已變更為 ${ct(e)} 位,不足原本設定的 ${n?.type === "QUORUM" ? n.threshold : 0} 位門檻,簽核政策已重設為單人簽核,請重新設定。`,
1675
+ nodeId: t,
1676
+ policyType: "SINGLE"
1525
1677
  });
1526
1678
  }
1527
- function yi(e) {
1528
- U && U.type === "userTask" && k.dispatch({
1529
- nodeId: U.id,
1679
+ function Rr(e) {
1680
+ B && B.type === "userTask" && k.dispatch({
1681
+ nodeId: B.id,
1530
1682
  resubmitStrategy: e,
1531
1683
  type: "setUserTaskReturnResubmitStrategy"
1532
1684
  });
1533
1685
  }
1534
- function bi(e) {
1535
- U && U.type === "userTask" && k.dispatch({
1536
- nodeId: U.id,
1686
+ function zr(e) {
1687
+ B && B.type === "userTask" && k.dispatch({
1688
+ nodeId: B.id,
1537
1689
  requireComment: e,
1538
1690
  type: "setUserTaskReturnRequireComment"
1539
1691
  });
1540
1692
  }
1541
1693
  function Q(e) {
1542
- U && U.type === "userTask" && k.dispatch({
1543
- nodeId: U.id,
1694
+ B && B.type === "userTask" && k.dispatch({
1695
+ nodeId: B.id,
1544
1696
  sla: e,
1545
1697
  type: "setUserTaskSla"
1546
1698
  });
1547
1699
  }
1548
- function Si(e) {
1549
- if (!U || U.type !== "userTask") return;
1550
- gt(null);
1700
+ function Hr(e) {
1701
+ B && B.type === "userTask" && k.dispatch({
1702
+ excludeInitiator: e,
1703
+ nodeId: B.id,
1704
+ type: "setUserTaskExcludeInitiator"
1705
+ });
1706
+ }
1707
+ function Ur(e) {
1708
+ if (!B || B.type !== "userTask") return;
1709
+ F(null);
1551
1710
  let t = e.type === "QUORUM" ? {
1552
1711
  ...e,
1553
- threshold: $e(e.threshold, e.thresholdType)
1712
+ threshold: tt(e.threshold, e.thresholdType)
1554
1713
  } : e;
1555
1714
  k.dispatch({
1556
1715
  decisionPolicy: t,
1557
- nodeId: U.id,
1716
+ nodeId: B.id,
1558
1717
  type: "setUserTaskDecisionPolicy"
1559
1718
  });
1560
1719
  }
1561
- function Ci(e) {
1562
- U && U.type === "userTask" && k.dispatch({
1720
+ function Wr(e) {
1721
+ B && B.type === "userTask" && k.dispatch({
1563
1722
  ...e,
1564
- nodeId: U.id,
1723
+ nodeId: B.id,
1565
1724
  type: "setUserTaskOptions"
1566
1725
  });
1567
1726
  }
1568
- function wi(e) {
1569
- U && U.type === "serviceTask" && k.dispatch({
1727
+ function Gr(e) {
1728
+ B && B.type === "serviceTask" && k.dispatch({
1570
1729
  action: e,
1571
- nodeId: U.id,
1730
+ nodeId: B.id,
1572
1731
  type: "setServiceAction"
1573
1732
  });
1574
1733
  }
1575
- function Ei(e) {
1576
- O(e.mode === "ALL" || e.mode === "CUSTOM" ? null : e), D(e.mode === "ALL" || e.mode === "CUSTOM" ? null : e.mode), st(Zr(e, L));
1734
+ function li(e) {
1735
+ Pe(e.mode === "ALL" || e.mode === "CUSTOM" ? null : e), Ee(e.mode === "ALL" || e.mode === "CUSTOM" ? null : e.mode), ut(xi(e, L));
1577
1736
  }
1578
- function Oi(e) {
1579
- U && U.type !== "startEvent" && k.dispatch({
1580
- nodeId: U.id,
1737
+ function _i(e) {
1738
+ B && B.type !== "startEvent" && k.dispatch({
1739
+ nodeId: B.id,
1581
1740
  triggerMode: e,
1582
1741
  type: "setNodeTriggerMode"
1583
1742
  });
1584
1743
  }
1585
- function Ai(e, t) {
1744
+ function bi(e, t) {
1586
1745
  k.dispatch({
1587
1746
  edgeId: e,
1588
1747
  isDefault: t,
1589
1748
  type: "setEdgeDefault"
1590
1749
  });
1591
1750
  }
1592
- function Mi({ edgeId: e, fieldKey: t, operator: n, value: r }) {
1751
+ function Si({ edgeId: e, fieldKey: t, operator: n, value: r }) {
1593
1752
  k.dispatch({
1594
1753
  edgeId: e,
1595
1754
  fieldKey: t,
@@ -1598,289 +1757,293 @@ function ir({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
1598
1757
  value: r
1599
1758
  });
1600
1759
  }
1601
- function Ni() {
1760
+ function Di() {
1602
1761
  k.dispatch({ type: "autoLayout" });
1603
1762
  }
1604
- return /* @__PURE__ */ T(C, { children: [
1605
- /* @__PURE__ */ w("style", { children: dn }),
1606
- a ? null : /* @__PURE__ */ w(ee, { children: /* @__PURE__ */ T(ie, {
1607
- description: `${ye ? `草稿 v${ye.version}` : "尚未建立草稿"} ·${E?.template.currentVersionId ? " 已發布版本" : " 尚未發布"}`,
1608
- onBackClick: En,
1609
- title: E?.template.name ?? "流程設計器",
1763
+ return /* @__PURE__ */ E(w, { children: [
1764
+ /* @__PURE__ */ T("style", { children: In }),
1765
+ a ? null : /* @__PURE__ */ T(ee, { children: /* @__PURE__ */ E(ae, {
1766
+ description: On({
1767
+ draftVersion: be?.version ?? null,
1768
+ hasPublishedVersion: !!D?.template.currentVersionId,
1769
+ publishedVersion: D?.versions.find((e) => e.id === D.template.currentVersionId)?.version ?? null
1770
+ }),
1771
+ onBackClick: xn,
1772
+ title: D?.template.name ?? "流程設計器",
1610
1773
  children: [
1611
- pe ? /* @__PURE__ */ w(h, {
1774
+ me ? /* @__PURE__ */ T(_, {
1612
1775
  disabled: !r,
1613
- onClick: () => tn((e) => !e),
1614
- variant: en ? "base-primary" : "base-secondary",
1776
+ onClick: () => un((e) => !e),
1777
+ variant: ln ? "base-primary" : "base-secondary",
1615
1778
  children: r ? "AI 助理" : "AI 助理(未設定)"
1616
1779
  }) : null,
1617
- /* @__PURE__ */ w(h, {
1780
+ /* @__PURE__ */ T(_, {
1618
1781
  "aria-label": "儲存草稿",
1619
- disabled: yt || !!ir || !!cr,
1620
- icon: de,
1782
+ disabled: wt || !!W || !!q,
1783
+ icon: fe,
1621
1784
  iconType: "icon-only",
1622
- onClick: () => void gr(),
1785
+ onClick: () => void ir(),
1623
1786
  variant: "base-secondary",
1624
1787
  children: "儲存草稿"
1625
1788
  }),
1626
- me ? /* @__PURE__ */ w(h, {
1627
- disabled: _t || !!ir || !!cr,
1628
- icon: se,
1789
+ he ? /* @__PURE__ */ T(_, {
1790
+ disabled: St || !!W || !!q,
1791
+ icon: ce,
1629
1792
  iconType: "leading",
1630
- onClick: vr,
1793
+ onClick: or,
1631
1794
  variant: "base-secondary",
1632
1795
  children: "試跑流程"
1633
1796
  }) : null,
1634
- /* @__PURE__ */ w(h, {
1635
- disabled: yt || !ye && !Et && !pn || !!ir || !!cr || !!or,
1636
- icon: ae,
1797
+ /* @__PURE__ */ T(_, {
1798
+ disabled: wt || !be && !jt && !hn || !!W || !!q || !!Zn,
1799
+ icon: oe,
1637
1800
  iconType: "leading",
1638
- onClick: () => void _r(),
1801
+ onClick: () => void ar(),
1639
1802
  variant: "base-primary",
1640
- children: Tn
1803
+ children: bn
1641
1804
  })
1642
1805
  ]
1643
1806
  }) }),
1644
- /* @__PURE__ */ w(ne, { children: /* @__PURE__ */ w(te, { children: /* @__PURE__ */ T("div", {
1645
- style: rn,
1807
+ /* @__PURE__ */ T(ne, { children: /* @__PURE__ */ T(te, { children: /* @__PURE__ */ E("div", {
1808
+ style: An,
1646
1809
  children: [
1647
- mt ? /* @__PURE__ */ w(S, {
1810
+ bt ? /* @__PURE__ */ T(C, {
1648
1811
  color: "text-error",
1649
1812
  variant: "body",
1650
- children: mt
1813
+ children: bt
1651
1814
  }) : null,
1652
- ht && ht.nodeId === U?.id && U.type === "userTask" && (U.data.decisionPolicy?.type ?? "SINGLE") === "SINGLE" ? /* @__PURE__ */ w(S, {
1815
+ xt && xt.nodeId === B?.id && B.type === "userTask" && (B.data.decisionPolicy?.type ?? "SINGLE") === xt.policyType ? /* @__PURE__ */ T(C, {
1653
1816
  color: "text-warning",
1654
1817
  variant: "body",
1655
- children: ht.message
1818
+ children: xt.message
1656
1819
  }) : null,
1657
- ir ? /* @__PURE__ */ w(S, {
1820
+ W ? /* @__PURE__ */ T(C, {
1658
1821
  color: "text-error",
1659
1822
  variant: "body",
1660
- children: ir
1823
+ children: W
1661
1824
  }) : null,
1662
- cr ? /* @__PURE__ */ w(S, {
1825
+ q ? /* @__PURE__ */ T(C, {
1663
1826
  color: "text-error",
1664
1827
  variant: "body",
1665
- children: cr
1828
+ children: q
1666
1829
  }) : null,
1667
- !ir && or ? /* @__PURE__ */ T(S, {
1830
+ !W && Zn ? /* @__PURE__ */ E(C, {
1668
1831
  color: "text-error",
1669
1832
  variant: "body",
1670
- children: ["發布前需修正:", or]
1833
+ children: ["發布前需修正:", Zn]
1671
1834
  }) : null,
1672
- a ? null : /* @__PURE__ */ w("div", {
1673
- style: V,
1674
- children: /* @__PURE__ */ w(n, {
1675
- hintText: sr ? "已設定條件分流條件。請先移除所有條件,才能更換綁定表單版本。" : void 0,
1835
+ a ? null : /* @__PURE__ */ T("div", {
1836
+ style: U,
1837
+ children: /* @__PURE__ */ T(n, {
1838
+ hintText: K ? "已設定條件分流條件。請先移除所有條件,才能更換綁定表單版本。" : void 0,
1676
1839
  label: "綁定表單版本",
1677
1840
  name: "formDefinitionVersionId",
1678
1841
  required: !0,
1679
- children: /* @__PURE__ */ T("div", {
1680
- style: yn,
1681
- children: [/* @__PURE__ */ w("div", {
1682
- style: bn,
1683
- children: /* @__PURE__ */ w(m, {
1842
+ children: /* @__PURE__ */ E("div", {
1843
+ style: Gn,
1844
+ children: [/* @__PURE__ */ T("div", {
1845
+ style: Kn,
1846
+ children: /* @__PURE__ */ T(g, {
1684
1847
  asyncData: !0,
1685
- disabled: _t || sr,
1848
+ disabled: St || K,
1686
1849
  disabledOptionsFilter: !0,
1687
1850
  emptyText: "沒有符合的已發布表單版本",
1688
- isForceClearable: !!j && !sr,
1689
- loading: xt,
1851
+ isForceClearable: !!j && !K,
1852
+ loading: Et,
1690
1853
  loadingText: "搜尋表單版本中...",
1691
1854
  mode: "single",
1692
1855
  onChange: (e) => {
1693
- sr || ot(e?.id ?? null);
1856
+ K || lt(e?.id ?? null);
1694
1857
  },
1695
1858
  onClear: () => {
1696
- sr || ot(null);
1859
+ K || lt(null);
1697
1860
  },
1698
- onSearch: dr,
1861
+ onSearch: tr,
1699
1862
  onVisibilityChange: (e) => {
1700
- e && !sr && dr("");
1863
+ e && !K && tr("");
1701
1864
  },
1702
- options: [...Fn],
1865
+ options: [...zn],
1703
1866
  placeholder: "選擇已發布表單版本",
1704
1867
  searchDebounceTime: 300,
1705
- value: G
1868
+ value: H
1706
1869
  })
1707
- }), /* @__PURE__ */ w(h, {
1708
- disabled: _t,
1870
+ }), /* @__PURE__ */ T(_, {
1871
+ disabled: St,
1709
1872
  onClick: () => {
1710
- qr();
1873
+ Ar();
1711
1874
  },
1712
- style: xn,
1875
+ style: qn,
1713
1876
  variant: "base-secondary",
1714
1877
  children: "編輯表單"
1715
1878
  })]
1716
1879
  })
1717
1880
  })
1718
1881
  }),
1719
- /* @__PURE__ */ T("div", {
1720
- style: an,
1721
- children: [/* @__PURE__ */ w("div", {
1722
- ref: Pe,
1723
- style: on,
1724
- children: /* @__PURE__ */ T(Me, {
1725
- connectionMode: De.Strict,
1726
- edges: Pn,
1882
+ /* @__PURE__ */ E("div", {
1883
+ style: jn,
1884
+ children: [/* @__PURE__ */ T("div", {
1885
+ ref: O,
1886
+ style: Mn,
1887
+ children: /* @__PURE__ */ E(Fe, {
1888
+ connectionMode: ke.Strict,
1889
+ edges: Ln,
1727
1890
  fitView: !0,
1728
- isValidConnection: (e) => ei(e, A.nodes),
1729
- nodeTypes: nr,
1730
- nodes: Nn,
1891
+ isValidConnection: (e) => wi(e, A.nodes),
1892
+ nodeTypes: Or,
1893
+ nodes: Qn,
1731
1894
  deleteKeyCode: null,
1732
1895
  multiSelectionKeyCode: [
1733
1896
  "Shift",
1734
1897
  "Meta",
1735
1898
  "Control"
1736
1899
  ],
1737
- onConnect: Qr,
1738
- onEdgeClick: ri,
1900
+ onConnect: Mr,
1901
+ onEdgeClick: Nr,
1739
1902
  onNodeClick: (e, t) => {
1740
1903
  dt(t.id), ft([]);
1741
1904
  },
1742
- onNodesChange: Xr,
1905
+ onNodesChange: X,
1743
1906
  onPaneClick: () => {
1744
1907
  dt(null), ft([]);
1745
1908
  },
1746
- onViewportChange: Ke,
1747
- viewport: Fe,
1909
+ onViewportChange: Re,
1910
+ viewport: Le,
1748
1911
  children: [
1749
- /* @__PURE__ */ w(Ee, {}),
1750
- /* @__PURE__ */ w("style", { children: mn }),
1751
- /* @__PURE__ */ w(ke, { children: On ? /* @__PURE__ */ w(Oe, {
1912
+ /* @__PURE__ */ T(Oe, {}),
1913
+ /* @__PURE__ */ T("style", { children: Bn }),
1914
+ /* @__PURE__ */ T(je, { children: Cn ? /* @__PURE__ */ T(Ae, {
1752
1915
  "aria-label": "刪除選取項目",
1753
1916
  className: "workflow-selection-delete-control",
1754
- onClick: kn,
1755
- style: sn,
1917
+ onClick: wn,
1918
+ style: Nn,
1756
1919
  title: "刪除選取項目",
1757
- children: /* @__PURE__ */ w("span", {
1758
- style: cn,
1759
- children: /* @__PURE__ */ w(g, {
1920
+ children: /* @__PURE__ */ T("span", {
1921
+ style: Pn,
1922
+ children: /* @__PURE__ */ T(v, {
1760
1923
  color: "error",
1761
- icon: fe,
1924
+ icon: pe,
1762
1925
  size: 16
1763
1926
  })
1764
1927
  })
1765
1928
  }) : null }),
1766
- /* @__PURE__ */ w(ar, { onApplyAutoLayout: Ni }),
1767
- /* @__PURE__ */ w(Ae, {})
1929
+ /* @__PURE__ */ T(jr, { onApplyAutoLayout: Di }),
1930
+ /* @__PURE__ */ T(Ne, {})
1768
1931
  ]
1769
1932
  })
1770
- }), /* @__PURE__ */ T("div", {
1771
- className: ln,
1772
- style: hn,
1933
+ }), /* @__PURE__ */ E("div", {
1934
+ className: Fn,
1935
+ style: Vn,
1773
1936
  children: [
1774
- /* @__PURE__ */ w(S, {
1937
+ /* @__PURE__ */ T(C, {
1775
1938
  component: "h2",
1776
1939
  variant: "h3",
1777
1940
  children: "流程工具"
1778
1941
  }),
1779
- a && pe ? /* @__PURE__ */ T("div", {
1780
- style: Sn,
1781
- children: [/* @__PURE__ */ w(S, {
1942
+ a && me ? /* @__PURE__ */ E("div", {
1943
+ style: Jn,
1944
+ children: [/* @__PURE__ */ T(C, {
1782
1945
  color: "text-neutral",
1783
1946
  variant: "caption",
1784
1947
  children: "AI 協助"
1785
- }), /* @__PURE__ */ w("div", {
1786
- style: vn,
1787
- children: /* @__PURE__ */ w(h, {
1948
+ }), /* @__PURE__ */ T("div", {
1949
+ style: Wn,
1950
+ children: /* @__PURE__ */ T(_, {
1788
1951
  disabled: !r,
1789
- onClick: () => tn((e) => !e),
1952
+ onClick: () => un((e) => !e),
1790
1953
  size: "sub",
1791
- variant: en ? "base-primary" : "base-secondary",
1954
+ variant: ln ? "base-primary" : "base-secondary",
1792
1955
  children: r ? "AI 助理" : "AI 助理(未設定)"
1793
1956
  })
1794
1957
  })]
1795
1958
  }) : null,
1796
- /* @__PURE__ */ T("div", {
1797
- style: Sn,
1798
- children: [/* @__PURE__ */ w(S, {
1959
+ /* @__PURE__ */ E("div", {
1960
+ style: Jn,
1961
+ children: [/* @__PURE__ */ T(C, {
1799
1962
  color: "text-neutral",
1800
1963
  variant: "caption",
1801
1964
  children: "動作節點"
1802
- }), /* @__PURE__ */ w("div", {
1803
- style: vn,
1804
- children: Ln.map((e) => /* @__PURE__ */ w(h, {
1965
+ }), /* @__PURE__ */ T("div", {
1966
+ style: Wn,
1967
+ children: cr.map((e) => /* @__PURE__ */ T(_, {
1805
1968
  icon: e.icon,
1806
1969
  iconType: "leading",
1807
- onClick: () => ai(e.type),
1970
+ onClick: () => Fr(e.type),
1808
1971
  size: "sub",
1809
1972
  variant: "base-secondary",
1810
1973
  children: e.label
1811
1974
  }, e.type))
1812
1975
  })]
1813
1976
  }),
1814
- /* @__PURE__ */ T("div", {
1815
- style: Sn,
1816
- children: [/* @__PURE__ */ w(S, {
1977
+ /* @__PURE__ */ E("div", {
1978
+ style: Jn,
1979
+ children: [/* @__PURE__ */ T(C, {
1817
1980
  color: "text-neutral",
1818
1981
  variant: "caption",
1819
1982
  children: "流程控制"
1820
- }), /* @__PURE__ */ w("div", {
1821
- style: vn,
1822
- children: Rn.map((e) => /* @__PURE__ */ w(h, {
1983
+ }), /* @__PURE__ */ T("div", {
1984
+ style: Wn,
1985
+ children: lr.map((e) => /* @__PURE__ */ T(_, {
1823
1986
  icon: e.icon,
1824
1987
  iconType: "leading",
1825
- onClick: () => ai(e.type),
1988
+ onClick: () => Fr(e.type),
1826
1989
  size: "sub",
1827
1990
  variant: "base-secondary",
1828
1991
  children: e.label
1829
1992
  }, e.type))
1830
1993
  })]
1831
1994
  }),
1832
- Mn.length > 1 ? Qi(Mn) : null,
1833
- Mn.length === 1 && jn ? $i(jn) : null,
1834
- Mn.length === 0 && U ? Ii(U) : null
1995
+ kn.length > 1 ? Ki(kn) : null,
1996
+ kn.length === 1 && Dn ? qi(Dn) : null,
1997
+ kn.length === 0 && B ? ki(B) : null
1835
1998
  ]
1836
1999
  })]
1837
2000
  })
1838
2001
  ]
1839
2002
  }) }) }),
1840
- ea(An),
1841
- !a && me ? Fi() : null,
1842
- pe && r ? /* @__PURE__ */ w(kt, {
2003
+ Ji(Tn),
2004
+ !a && he ? Oi() : null,
2005
+ me && r ? /* @__PURE__ */ T(Lt, {
1843
2006
  controller: k,
1844
- onClose: () => tn(!1),
1845
- open: en
2007
+ onClose: () => un(!1),
2008
+ open: ln
1846
2009
  }) : null,
1847
- a ? null : /* @__PURE__ */ w(re, {
2010
+ a ? null : /* @__PURE__ */ T(ie, {
1848
2011
  headerTitle: "編輯表單",
1849
2012
  isHeaderDisplay: !0,
1850
- onClose: () => un(!1),
1851
- open: nn,
2013
+ onClose: () => fn(!1),
2014
+ open: dn,
1852
2015
  size: "wide",
1853
- children: /* @__PURE__ */ T("div", {
1854
- style: Zn,
1855
- children: [/* @__PURE__ */ w("div", {
1856
- style: Qn,
1857
- children: Cn ? /* @__PURE__ */ w(S, {
2016
+ children: /* @__PURE__ */ E("div", {
2017
+ style: Cr,
2018
+ children: [/* @__PURE__ */ T("div", {
2019
+ style: wr,
2020
+ children: vn ? /* @__PURE__ */ T(C, {
1858
2021
  color: "text-neutral",
1859
2022
  variant: "body",
1860
2023
  children: "載入中…"
1861
- }) : /* @__PURE__ */ w(s, {
2024
+ }) : /* @__PURE__ */ T(l, {
1862
2025
  onChange: (e) => {
1863
- B(e);
2026
+ pn(e);
1864
2027
  },
1865
2028
  value: z ?? {
1866
- schema: er,
1867
- uiSchema: tr
2029
+ schema: Er,
2030
+ uiSchema: Dr
1868
2031
  }
1869
2032
  })
1870
- }), /* @__PURE__ */ T("div", {
1871
- style: $n,
1872
- children: [/* @__PURE__ */ w(h, {
1873
- disabled: Cn,
2033
+ }), /* @__PURE__ */ E("div", {
2034
+ style: Tr,
2035
+ children: [/* @__PURE__ */ T(_, {
2036
+ disabled: vn,
1874
2037
  onClick: () => {
1875
- z !== null && (H(!0), k.replaceState((e) => ({
2038
+ z !== null && (gn(!0), k.replaceState((e) => ({
1876
2039
  ...e,
1877
2040
  formSchema: z.schema
1878
- }))), un(!1);
2041
+ }))), fn(!1);
1879
2042
  },
1880
2043
  variant: "base-primary",
1881
2044
  children: "套用"
1882
- }), /* @__PURE__ */ w(h, {
1883
- onClick: () => un(!1),
2045
+ }), /* @__PURE__ */ T(_, {
2046
+ onClick: () => fn(!1),
1884
2047
  variant: "base-secondary",
1885
2048
  children: "取消"
1886
2049
  })]
@@ -1888,179 +2051,185 @@ function ir({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
1888
2051
  })
1889
2052
  })
1890
2053
  ] });
1891
- function Fi() {
1892
- return /* @__PURE__ */ w(v, {
2054
+ function Oi() {
2055
+ let e = {
2056
+ formFields: G?.fields ?? [],
2057
+ memberName: (e) => I.find((t) => t.memberId === e && !t.unresolved)?.displayName ?? null,
2058
+ orgUnits: L,
2059
+ positions: R
2060
+ };
2061
+ return /* @__PURE__ */ T(b, {
1893
2062
  cancelText: "關閉",
1894
2063
  confirmText: "執行試跑",
1895
- loading: Bt,
2064
+ loading: qt,
1896
2065
  modalType: "standard",
1897
- onCancel: yr,
1898
- onClose: yr,
1899
- onConfirm: () => void zr(),
1900
- open: Rt,
2066
+ onCancel: vr,
2067
+ onClose: vr,
2068
+ onConfirm: () => void yr(),
2069
+ open: Gt,
1901
2070
  showModalFooter: !0,
1902
2071
  showModalHeader: !0,
1903
2072
  size: "wide",
1904
- supportingText: `使用 ${Xn} 與範例表單資料模擬目前畫布流程,不會建立案件。`,
2073
+ supportingText: `使用 ${Sr} 與範例表單資料模擬目前畫布流程,不會建立案件。`,
1905
2074
  title: "試跑流程",
1906
- children: /* @__PURE__ */ T("div", {
1907
- style: V,
2075
+ children: /* @__PURE__ */ E("div", {
2076
+ style: U,
1908
2077
  children: [
1909
- /* @__PURE__ */ w(n, {
2078
+ /* @__PURE__ */ T(n, {
1910
2079
  label: "表單資料 JSON",
1911
2080
  name: "dryRunFormDataJson",
1912
2081
  required: !0,
1913
- children: /* @__PURE__ */ w(b, {
1914
- onChange: (e) => Wt(e.target.value),
2082
+ children: /* @__PURE__ */ T(re, {
2083
+ onChange: (e) => Zt(e.target.value),
1915
2084
  resize: "vertical",
1916
2085
  rows: 8,
1917
- value: Ut
2086
+ value: Xt
1918
2087
  })
1919
2088
  }),
1920
- qt ? /* @__PURE__ */ w(S, {
2089
+ tn ? /* @__PURE__ */ T(C, {
1921
2090
  color: "text-error",
1922
2091
  variant: "body",
1923
- children: qt
2092
+ children: tn
1924
2093
  }) : null,
1925
- Gt ? /* @__PURE__ */ T("div", {
1926
- style: gn,
2094
+ $t ? /* @__PURE__ */ E("div", {
2095
+ style: Hn,
1927
2096
  children: [
1928
- /* @__PURE__ */ w(S, {
1929
- color: Gt.valid ? "text-success" : "text-error",
2097
+ /* @__PURE__ */ T(C, {
2098
+ color: $t.valid ? "text-success" : "text-error",
1930
2099
  variant: "label-primary-highlight",
1931
- children: Gt.valid ? "試跑通過" : "試跑失敗"
2100
+ children: $t.valid ? "試跑通過" : "試跑失敗"
1932
2101
  }),
1933
- Gt.errors.map((e) => /* @__PURE__ */ w(S, {
2102
+ $t.errors.map((e) => /* @__PURE__ */ T(C, {
1934
2103
  color: "text-error",
1935
2104
  variant: "body",
1936
2105
  children: e
1937
2106
  }, e)),
1938
- Gt.steps.map((e) => /* @__PURE__ */ T("div", {
1939
- style: _n,
2107
+ $t.steps.map((t) => /* @__PURE__ */ E("div", {
2108
+ style: Un,
1940
2109
  children: [
1941
- /* @__PURE__ */ T(S, {
2110
+ /* @__PURE__ */ E(C, {
1942
2111
  variant: "label-primary-highlight",
1943
2112
  children: [
1944
- e.nodeLabel,
2113
+ t.nodeLabel,
1945
2114
  " · ",
1946
- di(e.status)
2115
+ Pi(t.status)
1947
2116
  ]
1948
2117
  }),
1949
- /* @__PURE__ */ T(S, {
2118
+ /* @__PURE__ */ E(C, {
1950
2119
  color: "text-neutral",
1951
2120
  variant: "caption",
1952
2121
  children: [
1953
- fi(e.nodeType),
1954
- e.assigneeMemberId ? ` · 處理者:${e.assigneeMemberId}` : "",
1955
- e.edgeLabel ? ` · 來源線段:${e.edgeLabel}` : ""
2122
+ Fi(t.nodeType),
2123
+ t.assigneeMemberId ? ` · 處理者:${_n(t.assigneeMemberId, e)}` : "",
2124
+ t.edgeLabel ? ` · 來源線段:${t.edgeLabel}` : ""
1956
2125
  ]
1957
2126
  }),
1958
- e.edgeReason ? /* @__PURE__ */ w(S, {
2127
+ t.edgeReason ? /* @__PURE__ */ T(C, {
1959
2128
  color: "text-neutral",
1960
2129
  variant: "caption",
1961
- children: e.edgeReason
2130
+ children: t.edgeReason
1962
2131
  }) : null,
1963
- e.entryCondition ? /* @__PURE__ */ T(S, {
2132
+ t.entryCondition ? /* @__PURE__ */ E(C, {
1964
2133
  color: "text-neutral",
1965
2134
  variant: "caption",
1966
2135
  children: [
1967
2136
  "進入條件:",
1968
- e.entryConditionMatched ? "符合" : "不符合",
2137
+ t.entryConditionMatched ? "符合" : "不符合",
1969
2138
  " ·",
1970
2139
  " ",
1971
- e.entryCondition
2140
+ t.entryCondition
1972
2141
  ]
1973
2142
  }) : null,
1974
- /* @__PURE__ */ w(S, {
2143
+ /* @__PURE__ */ T(C, {
1975
2144
  color: "text-neutral",
1976
2145
  variant: "body",
1977
- children: e.message
2146
+ children: t.message
1978
2147
  }),
1979
- (e.status === "SKIPPED" ? [] : Pi(A, e.nodeId, Yt)).map((e) => /* @__PURE__ */ T(S, {
2148
+ (t.status === "SKIPPED" ? [] : ia(A, t.nodeId, rn)).map((e) => /* @__PURE__ */ E(C, {
1980
2149
  color: "text-neutral",
1981
2150
  variant: "caption",
1982
2151
  children: ["將送出 Webhook:", e.label]
1983
2152
  }, e.key))
1984
2153
  ]
1985
- }, e.id))
2154
+ }, t.id))
1986
2155
  ]
1987
2156
  }) : null
1988
2157
  ]
1989
2158
  })
1990
2159
  });
1991
2160
  }
1992
- function Ii(e) {
1993
- return /* @__PURE__ */ T("div", {
1994
- style: V,
2161
+ function ki(e) {
2162
+ return /* @__PURE__ */ E("div", {
2163
+ style: U,
1995
2164
  children: [
1996
- /* @__PURE__ */ w(S, {
2165
+ /* @__PURE__ */ T(C, {
1997
2166
  component: "h2",
1998
2167
  variant: "h3",
1999
2168
  children: "節點屬性"
2000
2169
  }),
2001
- /* @__PURE__ */ T(S, {
2170
+ /* @__PURE__ */ E(C, {
2002
2171
  color: "text-neutral",
2003
2172
  variant: "body",
2004
2173
  children: [
2005
- In[e.type],
2174
+ sr[e.type],
2006
2175
  " · ",
2007
2176
  e.id
2008
2177
  ]
2009
2178
  }),
2010
- /* @__PURE__ */ w(n, {
2179
+ /* @__PURE__ */ T(n, {
2011
2180
  label: "顯示名稱",
2012
2181
  name: "nodeLabel",
2013
2182
  required: !0,
2014
- children: /* @__PURE__ */ w(_, {
2015
- onChange: (e) => li(e.target.value),
2183
+ children: /* @__PURE__ */ T(y, {
2184
+ onChange: (e) => Lr(e.target.value),
2016
2185
  value: e.data.label,
2017
2186
  variant: "base"
2018
2187
  })
2019
2188
  }),
2020
- e.type === "startEvent" ? Ui() : null,
2021
- e.type === "startEvent" ? null : qi(e),
2022
- e.type === "userTask" ? Yi(e) : null,
2023
- e.type === "serviceTask" ? Zi(e) : null
2189
+ e.type === "startEvent" ? Ni() : null,
2190
+ e.type === "startEvent" ? null : Hi(e),
2191
+ e.type === "userTask" ? Ui(e) : null,
2192
+ e.type === "serviceTask" ? Gi(e) : null
2024
2193
  ]
2025
2194
  });
2026
2195
  }
2027
- function Ui() {
2028
- let e = W.mode === "CUSTOM" ? [...Jn, Yn] : [...Jn], t = W.mode === "ORG_UNIT" || W.mode === "ORG_UNIT_POSITION" ? _i(L, W.orgUnitId ?? "") : null, r = W.mode === "ORG_UNIT_POSITION" ? vi(R, W.positionId ?? "") : null, a = W.mode === "ORG_UNIT_POSITION" ? Ti({
2029
- includeDescendants: !!W.includeDescendants,
2030
- memberships: Ft,
2031
- orgUnitId: W.orgUnitId ?? "",
2196
+ function Ni() {
2197
+ let e = V.mode === "CUSTOM" ? [...br, xr] : [...br], t = V.mode === "ORG_UNIT" || V.mode === "ORG_UNIT_POSITION" ? Bi(L, V.orgUnitId ?? "") : null, r = V.mode === "ORG_UNIT_POSITION" ? Vi(R, V.positionId ?? "") : null, a = V.mode === "ORG_UNIT_POSITION" ? Yi({
2198
+ includeDescendants: !!V.includeDescendants,
2199
+ memberships: Ut,
2200
+ orgUnitId: V.orgUnitId ?? "",
2032
2201
  orgUnits: L,
2033
2202
  positions: R
2034
2203
  }) : [];
2035
- return /* @__PURE__ */ T(C, { children: [
2036
- /* @__PURE__ */ w(n, {
2037
- hintText: W.mode === "CUSTOM" ? "這是舊版表達式規則;切換成標準選項後會改由 UI 管理。" : void 0,
2204
+ return /* @__PURE__ */ E(w, { children: [
2205
+ /* @__PURE__ */ T(n, {
2206
+ hintText: V.mode === "CUSTOM" ? "這是舊版表達式規則;切換成標準選項後會改由 UI 管理。" : void 0,
2038
2207
  label: "發起權限",
2039
2208
  name: "initiatorPolicyMode",
2040
2209
  required: !0,
2041
- children: /* @__PURE__ */ w(y, {
2210
+ children: /* @__PURE__ */ T(x, {
2042
2211
  clearable: !1,
2043
2212
  onChange: (e) => {
2044
2213
  if (e?.id === "CUSTOM") {
2045
- D(null), O(null);
2214
+ Ee(null), Pe(null);
2046
2215
  return;
2047
2216
  }
2048
- let t = Kr(e?.id ?? null), n = $r(t);
2049
- D(t === "ALL" ? null : t), O(t === "ALL" ? null : n), st(Zr(n, L));
2217
+ let t = gi(e?.id ?? null), n = Ci(t);
2218
+ Ee(t === "ALL" ? null : t), Pe(t === "ALL" ? null : n), ut(xi(n, L));
2050
2219
  },
2051
2220
  options: e,
2052
2221
  placeholder: "選擇誰可以發起",
2053
- value: X(e, W.mode)
2222
+ value: $(e, V.mode)
2054
2223
  })
2055
2224
  }),
2056
- W.mode === "ORG_UNIT" || W.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ w(n, {
2225
+ V.mode === "ORG_UNIT" || V.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ T(n, {
2057
2226
  label: "組織",
2058
2227
  name: "initiatorOrgUnitId",
2059
2228
  required: !0,
2060
- children: /* @__PURE__ */ w(i, {
2229
+ children: /* @__PURE__ */ T(i, {
2061
2230
  name: "initiatorOrgUnitId",
2062
- onChange: (e) => Ei({
2063
- ...W,
2231
+ onChange: (e) => li({
2232
+ ...V,
2064
2233
  orgUnitId: e?.id ?? "",
2065
2234
  positionId: "",
2066
2235
  value: e?.id ?? ""
@@ -2070,78 +2239,78 @@ function ir({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2070
2239
  value: t
2071
2240
  })
2072
2241
  }) : null,
2073
- W.mode === "ORG_UNIT" || W.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ w(n, {
2242
+ V.mode === "ORG_UNIT" || V.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ T(n, {
2074
2243
  label: "包含下層",
2075
2244
  name: "initiatorIncludeDescendants",
2076
- children: /* @__PURE__ */ w(x, {
2077
- checked: !!W.includeDescendants,
2078
- onChange: (e) => Ei({
2079
- ...W,
2245
+ children: /* @__PURE__ */ T(S, {
2246
+ checked: !!V.includeDescendants,
2247
+ onChange: (e) => li({
2248
+ ...V,
2080
2249
  includeDescendants: e.target.checked,
2081
- ...W.mode === "ORG_UNIT_POSITION" ? { positionId: "" } : {}
2250
+ ...V.mode === "ORG_UNIT_POSITION" ? { positionId: "" } : {}
2082
2251
  })
2083
2252
  })
2084
2253
  }) : null,
2085
- W.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ w(n, {
2254
+ V.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ T(n, {
2086
2255
  label: "職位",
2087
2256
  name: "initiatorPositionId",
2088
2257
  required: !0,
2089
- children: /* @__PURE__ */ w(o, {
2090
- disabled: !W.orgUnitId?.trim(),
2258
+ children: /* @__PURE__ */ T(o, {
2259
+ disabled: !V.orgUnitId?.trim(),
2091
2260
  name: "initiatorPositionId",
2092
- onChange: (e) => Ei({
2093
- ...W,
2261
+ onChange: (e) => li({
2262
+ ...V,
2094
2263
  positionId: e?.id ?? ""
2095
2264
  }),
2096
- placeholder: W.orgUnitId?.trim() ? "選擇職位" : "請先選擇組織",
2265
+ placeholder: V.orgUnitId?.trim() ? "選擇職位" : "請先選擇組織",
2097
2266
  positions: a,
2098
2267
  value: r
2099
2268
  })
2100
2269
  }) : null
2101
2270
  ] });
2102
2271
  }
2103
- function qi(e) {
2272
+ function Hi(e) {
2104
2273
  let t = A.edges.filter((t) => t.target === e.id).length, r = t < 2, i = r ? "AND" : e.data.triggerMode ?? "AND";
2105
- return /* @__PURE__ */ w(n, {
2274
+ return /* @__PURE__ */ T(n, {
2106
2275
  hintText: r ? "需要至少兩條前置連線,才可切換為任一前置完成。" : t > 1 ? `${t} 條前置連線會依此規則觸發。` : "只有一條前置連線時,兩種設定效果相同。",
2107
2276
  label: "前置條件",
2108
2277
  name: "triggerMode",
2109
2278
  required: !0,
2110
- children: /* @__PURE__ */ w(y, {
2279
+ children: /* @__PURE__ */ T(x, {
2111
2280
  clearable: !1,
2112
- onChange: (e) => r ? void 0 : Oi(Cr(e?.id ?? null)),
2113
- options: [...zn],
2281
+ onChange: (e) => r ? void 0 : _i(Yr(e?.id ?? null)),
2282
+ options: [...ur],
2114
2283
  readOnly: r,
2115
- value: X(zn, i)
2284
+ value: $(ur, i)
2116
2285
  })
2117
2286
  });
2118
2287
  }
2119
- function Yi(e) {
2120
- let t = e.data.approverResolver, r = Br(t.type), a = t.type === "DIRECT" ? t.memberIds.map((e) => gi(F, e)) : [], s = t.type === "ORG_UNIT_MANAGER" || t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? _i(L, t.orgUnitId) : null, c = t.type === "POSITION" || t.type === "ORG_UNIT_POSITION" ? vi(R, t.positionId) : null, l = t.type === "ORG_UNIT_POSITION" ? Ti({
2288
+ function Ui(e) {
2289
+ let t = e.data.approverResolver, r = ui(t.type), a = t.type === "DIRECT" ? t.memberIds.map((e) => zi(I, e)) : [], s = t.type === "ORG_UNIT_MANAGER" || t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? Bi(L, t.orgUnitId) : null, c = t.type === "POSITION" || t.type === "ORG_UNIT_POSITION" ? Vi(R, t.positionId) : null, l = t.type === "ORG_UNIT_POSITION" ? Yi({
2121
2290
  includeDescendants: !!t.includeDescendants,
2122
- memberships: Ft,
2291
+ memberships: Ut,
2123
2292
  orgUnitId: t.orgUnitId,
2124
2293
  orgUnits: L,
2125
2294
  positions: R
2126
- }) : [], u = t.type === "ORG_MANAGER" ? Wr(t.levelsUp) : K[0], d = t.type === "ORG_MANAGER" || t.type === "ORG_UNIT_MANAGER" ? t.fallback ?? { type: "NONE" } : { type: "NONE" }, f = d.type === "DIRECT" && d.memberId ? gi(F, d.memberId) : null, p = e.data.returnBehavior.resubmitStrategy ?? "RESTART", h = e.data.sla ?? null, g = h ? lt(h.duration) : null, v = g?.unit ?? "DAY", ee = Pr(h?.warningAt ?? null), te = Wr(h?.escalateLevelsUp ?? 1), ne = Er(e.data.decisionPolicy), b = kr(e.data.decisionPolicy);
2127
- return /* @__PURE__ */ T(C, { children: [
2128
- /* @__PURE__ */ w(n, {
2295
+ }) : [], u = t.type === "DYNAMIC_FORM" ? En(G, t.formPath) : null, d = t.type === "ORG_MANAGER" ? mi(t.levelsUp) : Y[0], f = t.type === "ORG_MANAGER" || t.type === "ORG_MANAGER_CHAIN" || t.type === "ORG_UNIT_MANAGER" ? t.fallback ?? { type: "NONE" } : { type: "NONE" }, p = t.type === "ORG_MANAGER_CHAIN" ? zt(R, t.minPositionLevel) : [], m = f.type === "DIRECT" && f.memberId ? zi(I, f.memberId) : null, h = e.data.returnBehavior.resubmitStrategy ?? "RESTART", _ = e.data.sla ?? null, v = e.data.excludeInitiator ?? null, b = _ ? ht(_.duration) : null, ee = b?.unit ?? "DAY", te = ii(_?.warningAt ?? null), ne = mi(_?.escalateLevelsUp ?? 1), re = Zr(e.data.decisionPolicy), C = $r(e.data.decisionPolicy);
2296
+ return /* @__PURE__ */ E(w, { children: [
2297
+ /* @__PURE__ */ T(n, {
2129
2298
  label: "簽核來源",
2130
2299
  name: "approverResolverType",
2131
2300
  required: !0,
2132
- children: /* @__PURE__ */ w(y, {
2301
+ children: /* @__PURE__ */ T(x, {
2133
2302
  clearable: !1,
2134
- onChange: (e) => Z(Vr(e?.id ?? null)),
2135
- options: [...Hn],
2136
- value: X(Hn, r)
2303
+ onChange: (e) => Z(di(e?.id ?? null, R)),
2304
+ options: [...pr],
2305
+ value: $(pr, r)
2137
2306
  })
2138
2307
  }),
2139
- t.type === "DIRECT" ? /* @__PURE__ */ w(n, {
2140
- hintText: Tr(e.data.decisionPolicy),
2308
+ t.type === "DIRECT" ? /* @__PURE__ */ T(n, {
2309
+ hintText: _t(e.data.decisionPolicy),
2141
2310
  label: "簽核者",
2142
2311
  name: "memberId",
2143
2312
  required: !0,
2144
- children: /* @__PURE__ */ w(m, {
2313
+ children: /* @__PURE__ */ T(g, {
2145
2314
  asyncData: !0,
2146
2315
  disabledOptionsFilter: !0,
2147
2316
  emptyText: "沒有符合的成員",
@@ -2151,45 +2320,76 @@ function ir({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2151
2320
  name: "workflow-approver-search",
2152
2321
  spellCheck: !1
2153
2322
  },
2154
- loading: Dt,
2323
+ loading: Mt,
2155
2324
  loadingText: "搜尋成員中...",
2156
2325
  mode: "multiple",
2157
2326
  onChange: (e) => Z({
2158
2327
  memberIds: e.map((e) => e.id),
2159
2328
  type: "DIRECT"
2160
2329
  }),
2161
- onSearch: Y,
2330
+ onSearch: J,
2162
2331
  onVisibilityChange: (e) => {
2163
- e && (Mt([]), Y(""));
2332
+ e && (It([]), J(""));
2164
2333
  },
2165
- options: [...Di(a, jt)],
2334
+ options: [...Zi(a, Ft)],
2166
2335
  placeholder: "搜尋姓名或信箱",
2167
2336
  searchDebounceTime: 300,
2168
2337
  value: a
2169
2338
  })
2170
2339
  }) : null,
2171
- t.type === "ORG_MANAGER" ? /* @__PURE__ */ w(n, {
2340
+ t.type === "DYNAMIC_FORM" ? /* @__PURE__ */ T(n, {
2341
+ hintText: u?.problem ?? "簽核人取自申請人送出表單時在該欄位選的人員。",
2342
+ label: "表單欄位",
2343
+ name: "approverFormPath",
2344
+ required: !0,
2345
+ children: /* @__PURE__ */ T(x, {
2346
+ clearable: !1,
2347
+ onChange: (e) => Z({
2348
+ formPath: e?.id ?? "",
2349
+ type: "DYNAMIC_FORM"
2350
+ }),
2351
+ options: [...u?.options ?? []],
2352
+ placeholder: "選擇人員選擇欄位",
2353
+ value: u?.selected ?? void 0
2354
+ })
2355
+ }) : null,
2356
+ t.type === "ORG_MANAGER" ? /* @__PURE__ */ T(n, {
2172
2357
  hintText: "依發起人的有效會員歸屬與主管解析規則決定簽核人。",
2173
2358
  label: "主管層級",
2174
2359
  name: "managerLevelsUp",
2175
2360
  required: !0,
2176
- children: /* @__PURE__ */ w(y, {
2361
+ children: /* @__PURE__ */ T(x, {
2177
2362
  clearable: !1,
2178
2363
  onChange: (e) => Z({
2179
2364
  baseFromInitiator: !0,
2180
- levelsUp: Gr(e?.id ?? null).value,
2365
+ levelsUp: hi(e?.id ?? null).value,
2181
2366
  type: "ORG_MANAGER"
2182
2367
  }),
2183
- options: [...K],
2184
- value: u
2368
+ options: [...Y],
2369
+ value: d
2370
+ })
2371
+ }) : null,
2372
+ t.type === "ORG_MANAGER_CHAIN" ? /* @__PURE__ */ T(n, {
2373
+ hintText: "從發起人的直屬主管開始往上,職等比前一位高的主管依序加入,簽到職等達此值的主管為止。沒有職位的主管會略過。",
2374
+ label: "簽到職等",
2375
+ name: "minPositionLevel",
2376
+ required: !0,
2377
+ children: /* @__PURE__ */ T(x, {
2378
+ clearable: !1,
2379
+ onChange: (e) => Z({
2380
+ ...t,
2381
+ minPositionLevel: Number(e?.id ?? t.minPositionLevel)
2382
+ }),
2383
+ options: [...p],
2384
+ value: $(p, String(t.minPositionLevel))
2185
2385
  })
2186
2386
  }) : null,
2187
- t.type === "ORG_UNIT_MANAGER" || t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ w(n, {
2387
+ t.type === "ORG_UNIT_MANAGER" || t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ T(n, {
2188
2388
  hintText: t.type === "ORG_UNIT_MANAGER" ? "依指定組織或其上層的主管解析規則決定簽核人。" : "依指定組織目前有效會員歸屬建立候選簽核人。",
2189
2389
  label: "組織",
2190
2390
  name: "orgUnitId",
2191
2391
  required: !0,
2192
- children: /* @__PURE__ */ w(i, {
2392
+ children: /* @__PURE__ */ T(i, {
2193
2393
  name: "orgUnitId",
2194
2394
  onChange: (e) => Z(t.type === "ORG_UNIT_MEMBER" ? {
2195
2395
  includeDescendants: t.includeDescendants,
@@ -2210,12 +2410,12 @@ function ir({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2210
2410
  value: s
2211
2411
  })
2212
2412
  }) : null,
2213
- t.type === "ORG_MANAGER" || t.type === "ORG_UNIT_MANAGER" ? /* @__PURE__ */ T(C, { children: [
2214
- /* @__PURE__ */ w(n, {
2413
+ t.type === "ORG_MANAGER" || t.type === "ORG_MANAGER_CHAIN" || t.type === "ORG_UNIT_MANAGER" ? /* @__PURE__ */ E(w, { children: [
2414
+ t.type === "ORG_MANAGER_CHAIN" ? null : /* @__PURE__ */ T(n, {
2215
2415
  hintText: "開啟後只取離該員最近一層的主管規則;掛在上層單位、涵蓋範圍較大的規則不會再一併加入簽核人。",
2216
2416
  label: "只取最近一層主管",
2217
2417
  name: "preferClosestOrgUnit",
2218
- children: /* @__PURE__ */ w(x, {
2418
+ children: /* @__PURE__ */ T(S, {
2219
2419
  checked: !!t.preferClosestOrgUnit,
2220
2420
  inputProps: {
2221
2421
  id: "preferClosestOrgUnit",
@@ -2227,26 +2427,26 @@ function ir({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2227
2427
  })
2228
2428
  })
2229
2429
  }),
2230
- /* @__PURE__ */ w(n, {
2231
- hintText: "預設會停止流程並提示;若設定固定人,找不到主管時會改派給該會員。",
2430
+ /* @__PURE__ */ T(n, {
2431
+ hintText: t.type === "ORG_MANAGER_CHAIN" ? "預設會停止流程並提示;若設定固定人,主管鏈在達到簽核職等前就結束時,會再加上該會員作為最後一關。" : "預設會停止流程並提示;若設定固定人,找不到主管時會改派給該會員。",
2232
2432
  label: "無主管時",
2233
2433
  name: "approverFallbackMode",
2234
2434
  required: !0,
2235
- children: /* @__PURE__ */ w(y, {
2435
+ children: /* @__PURE__ */ T(x, {
2236
2436
  clearable: !1,
2237
- onChange: (e) => Z(Ur(t, Hr(e?.id ?? null) === "DIRECT" ? {
2437
+ onChange: (e) => Z(pi(t, fi(e?.id ?? null) === "DIRECT" ? {
2238
2438
  memberId: "",
2239
2439
  type: "DIRECT"
2240
2440
  } : { type: "NONE" })),
2241
- options: [...Gn],
2242
- value: X(Gn, d.type)
2441
+ options: [...hr],
2442
+ value: $(hr, f.type)
2243
2443
  })
2244
2444
  }),
2245
- d.type === "DIRECT" ? /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(n, {
2445
+ f.type === "DIRECT" ? /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(n, {
2246
2446
  label: "改派人員",
2247
2447
  name: "approverFallbackMemberId",
2248
2448
  required: !0,
2249
- children: /* @__PURE__ */ w(m, {
2449
+ children: /* @__PURE__ */ T(g, {
2250
2450
  asyncData: !0,
2251
2451
  disabledOptionsFilter: !0,
2252
2452
  emptyText: "沒有符合的成員",
@@ -2256,45 +2456,45 @@ function ir({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2256
2456
  name: "workflow-approver-fallback-search",
2257
2457
  spellCheck: !1
2258
2458
  },
2259
- loading: Dt,
2459
+ loading: Mt,
2260
2460
  loadingText: "搜尋成員中...",
2261
2461
  mode: "single",
2262
- onChange: (e) => Z(Ur(t, {
2263
- allowInitiatorSelfApproval: d.allowInitiatorSelfApproval,
2462
+ onChange: (e) => Z(pi(t, {
2463
+ allowInitiatorSelfApproval: f.allowInitiatorSelfApproval,
2264
2464
  memberId: e?.id ?? "",
2265
2465
  type: "DIRECT"
2266
2466
  })),
2267
- onSearch: Y,
2467
+ onSearch: J,
2268
2468
  onVisibilityChange: (e) => {
2269
- e && (Mt([]), Y(""));
2469
+ e && (It([]), J(""));
2270
2470
  },
2271
- options: [...Di(jt, f ? [f] : [])],
2471
+ options: [...Zi(Ft, m ? [m] : [])],
2272
2472
  placeholder: "搜尋姓名或信箱",
2273
2473
  searchDebounceTime: 300,
2274
- value: f
2474
+ value: m
2275
2475
  })
2276
- }), /* @__PURE__ */ w(n, {
2476
+ }), /* @__PURE__ */ T(n, {
2277
2477
  hintText: "預設禁止申請人簽自己的案件;只有此流程允許自簽時才開啟。",
2278
2478
  label: "允許自簽",
2279
2479
  name: "allowInitiatorSelfApproval",
2280
- children: /* @__PURE__ */ w(x, {
2281
- checked: !!d.allowInitiatorSelfApproval,
2480
+ children: /* @__PURE__ */ T(S, {
2481
+ checked: !!f.allowInitiatorSelfApproval,
2282
2482
  inputProps: {
2283
2483
  id: "allowInitiatorSelfApproval",
2284
2484
  name: "allowInitiatorSelfApproval"
2285
2485
  },
2286
- onChange: (e) => Z(Ur(t, {
2486
+ onChange: (e) => Z(pi(t, {
2287
2487
  allowInitiatorSelfApproval: e.target.checked,
2288
- memberId: d.memberId,
2488
+ memberId: f.memberId,
2289
2489
  type: "DIRECT"
2290
2490
  }))
2291
2491
  })
2292
2492
  })] }) : null
2293
2493
  ] }) : null,
2294
- t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ w(n, {
2494
+ t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ T(n, {
2295
2495
  label: "包含下層",
2296
2496
  name: "includeDescendants",
2297
- children: /* @__PURE__ */ w(x, {
2497
+ children: /* @__PURE__ */ T(S, {
2298
2498
  checked: !!t.includeDescendants,
2299
2499
  inputProps: {
2300
2500
  id: "includeDescendants",
@@ -2307,12 +2507,12 @@ function ir({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2307
2507
  })
2308
2508
  })
2309
2509
  }) : null,
2310
- t.type === "POSITION" ? /* @__PURE__ */ w(n, {
2510
+ t.type === "POSITION" ? /* @__PURE__ */ T(n, {
2311
2511
  hintText: "指派給目前有效歸屬中擁有此職位的會員;主要歸屬優先。",
2312
2512
  label: "職位",
2313
2513
  name: "positionId",
2314
2514
  required: !0,
2315
- children: /* @__PURE__ */ w(o, {
2515
+ children: /* @__PURE__ */ T(o, {
2316
2516
  name: "positionId",
2317
2517
  onChange: (e) => Z({
2318
2518
  positionId: e?.id ?? "",
@@ -2323,12 +2523,12 @@ function ir({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2323
2523
  value: c
2324
2524
  })
2325
2525
  }) : null,
2326
- t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ w(n, {
2526
+ t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ T(n, {
2327
2527
  hintText: "只納入指定組織範圍內擁有此職位的有效會員。",
2328
2528
  label: "職位",
2329
2529
  name: "orgUnitPositionId",
2330
2530
  required: !0,
2331
- children: /* @__PURE__ */ w(o, {
2531
+ children: /* @__PURE__ */ T(o, {
2332
2532
  disabled: !t.orgUnitId.trim(),
2333
2533
  name: "orgUnitPositionId",
2334
2534
  onChange: (e) => Z({
@@ -2342,233 +2542,257 @@ function ir({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2342
2542
  value: c
2343
2543
  })
2344
2544
  }) : null,
2345
- /* @__PURE__ */ w(n, {
2545
+ /* @__PURE__ */ T(n, {
2346
2546
  hintText: "決定這一關要幾位簽核者同意才會通過;單人簽核與任一人同意的效果完全相同,皆為其中一人同意即通過。",
2347
2547
  label: "決策方式",
2348
2548
  name: "decisionPolicy",
2349
2549
  required: !0,
2350
- children: /* @__PURE__ */ w(y, {
2550
+ children: /* @__PURE__ */ T(x, {
2351
2551
  clearable: !1,
2352
- onChange: (t) => Si(Or(t?.id ?? null, e.data.decisionPolicy)),
2353
- options: [...Un],
2354
- value: Dr(ne)
2552
+ onChange: (t) => Ur(Qr(t?.id ?? null, e.data.decisionPolicy)),
2553
+ options: [...gt.filter((e) => t.type !== "ORG_MANAGER_CHAIN" || e.id === "SEQUENTIAL" || e.id === "PARALLEL_ALL")],
2554
+ value: vt(re)
2355
2555
  })
2356
2556
  }),
2357
- ne === "QUORUM" ? /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(n, {
2557
+ re === "QUORUM" ? /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(n, {
2358
2558
  label: "門檻計算方式",
2359
2559
  name: "quorumThresholdType",
2360
2560
  required: !0,
2361
- children: /* @__PURE__ */ w(y, {
2561
+ children: /* @__PURE__ */ T(x, {
2362
2562
  clearable: !1,
2363
- onChange: (e) => Si({
2364
- threshold: b.threshold,
2365
- thresholdType: Ar(e?.id ?? null),
2563
+ onChange: (e) => Ur({
2564
+ threshold: C.threshold,
2565
+ thresholdType: ei(e?.id ?? null),
2366
2566
  type: "QUORUM"
2367
2567
  }),
2368
- options: [...Wn],
2369
- value: X(Wn, b.thresholdType)
2568
+ options: [...mr],
2569
+ value: $(mr, C.thresholdType)
2370
2570
  })
2371
- }), /* @__PURE__ */ w(n, {
2372
- hintText: b.thresholdType === "PERCENTAGE" ? "達到簽核者總數的這個百分比即通過,換算人數時無條件進位;超過 100 的輸入會自動夾至 100。" : "達到這個同意人數即通過;門檻超過實際簽核者人數時,這一關將永遠無法通過,請勿設定超過實際簽核者人數。",
2373
- label: b.thresholdType === "PERCENTAGE" ? "門檻百分比" : "門檻人數",
2571
+ }), /* @__PURE__ */ T(n, {
2572
+ hintText: C.thresholdType === "PERCENTAGE" ? "達到簽核者總數的這個百分比即通過,換算人數時無條件進位;超過 100 的輸入會自動夾至 100。" : "達到這個同意人數即通過;門檻超過實際簽核者人數時,這一關將永遠無法通過,請勿設定超過實際簽核者人數。",
2573
+ label: C.thresholdType === "PERCENTAGE" ? "門檻百分比" : "門檻人數",
2374
2574
  name: "quorumThreshold",
2375
2575
  required: !0,
2376
- children: /* @__PURE__ */ w(_, {
2576
+ children: /* @__PURE__ */ T(y, {
2377
2577
  id: "quorumThreshold",
2378
- inputProps: b.thresholdType === "PERCENTAGE" ? {
2578
+ inputProps: C.thresholdType === "PERCENTAGE" ? {
2379
2579
  max: 100,
2380
2580
  min: 1
2381
2581
  } : { min: 1 },
2382
2582
  inputType: "number",
2383
2583
  name: "quorumThreshold",
2384
- onChange: (e) => Si({
2385
- threshold: $e(Number(e.target.value), b.thresholdType),
2386
- thresholdType: b.thresholdType,
2584
+ onChange: (e) => Ur({
2585
+ threshold: tt(Number(e.target.value), C.thresholdType),
2586
+ thresholdType: C.thresholdType,
2387
2587
  type: "QUORUM"
2388
2588
  }),
2389
- value: String(b.threshold),
2589
+ value: String(C.threshold),
2390
2590
  variant: "base"
2391
2591
  })
2392
2592
  })] }) : null,
2393
- e.data.returnBehavior.allowReturn ? /* @__PURE__ */ w(n, {
2593
+ e.data.returnBehavior.allowReturn ? /* @__PURE__ */ T(n, {
2394
2594
  hintText: "退回發起人後,重新送出時要從流程開始重跑,或直接回到退回的簽核節點。",
2395
2595
  label: "重送策略",
2396
2596
  name: "returnResubmitStrategy",
2397
2597
  required: !0,
2398
- children: /* @__PURE__ */ w(y, {
2598
+ children: /* @__PURE__ */ T(x, {
2399
2599
  clearable: !1,
2400
- onChange: (e) => yi(wr(e?.id ?? null)),
2401
- options: [...Bn],
2402
- value: X(Bn, p)
2600
+ onChange: (e) => Rr(Xr(e?.id ?? null)),
2601
+ options: [...dr],
2602
+ value: $(dr, h)
2403
2603
  })
2404
2604
  }) : null,
2405
- e.data.returnBehavior.allowReturn ? /* @__PURE__ */ w(n, {
2605
+ e.data.returnBehavior.allowReturn ? /* @__PURE__ */ T(n, {
2406
2606
  hintText: "開啟後,簽核者按下退回時必須填寫意見,未填寫會被擋下。",
2407
2607
  label: "退回時意見必填",
2408
2608
  name: "returnRequireComment",
2409
- children: /* @__PURE__ */ w(x, {
2609
+ children: /* @__PURE__ */ T(S, {
2410
2610
  checked: e.data.returnBehavior.requireComment === !0,
2411
2611
  inputProps: {
2412
2612
  id: "returnRequireComment",
2413
2613
  name: "returnRequireComment"
2414
2614
  },
2415
- onChange: (e) => bi(e.target.checked)
2615
+ onChange: (e) => zr(e.target.checked)
2416
2616
  })
2417
2617
  }) : null,
2418
- /* @__PURE__ */ w(n, {
2618
+ /* @__PURE__ */ T(n, {
2419
2619
  hintText: "開啟後可設定簽核期限,逾時將依下方設定處理。",
2420
2620
  label: "啟用時效",
2421
2621
  name: "slaEnabled",
2422
- children: /* @__PURE__ */ w(x, {
2423
- checked: !!h,
2622
+ children: /* @__PURE__ */ T(S, {
2623
+ checked: !!_,
2424
2624
  inputProps: {
2425
2625
  id: "slaEnabled",
2426
2626
  name: "slaEnabled"
2427
2627
  },
2428
- onChange: (e) => Q(e.target.checked ? Je : null)
2628
+ onChange: (e) => Q(e.target.checked ? Ze : null)
2429
2629
  })
2430
2630
  }),
2431
- h && !g ? /* @__PURE__ */ w(n, {
2631
+ _ && !b ? /* @__PURE__ */ T(n, {
2432
2632
  hintText: "此期限混用了日與時,無法在表單中編輯。請改以單一單位設定,或透過 API 維護。",
2433
2633
  label: "時效期限",
2434
2634
  name: "slaDurationRaw",
2435
- children: /* @__PURE__ */ w(_, {
2635
+ children: /* @__PURE__ */ T(y, {
2436
2636
  disabled: !0,
2437
- value: h.duration,
2637
+ value: _.duration,
2438
2638
  variant: "base"
2439
2639
  })
2440
2640
  }) : null,
2441
- h && g ? /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(n, {
2641
+ _ && b ? /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(n, {
2442
2642
  label: "時效期限",
2443
2643
  name: "slaDurationValue",
2444
2644
  required: !0,
2445
- children: /* @__PURE__ */ w(_, {
2645
+ children: /* @__PURE__ */ T(y, {
2446
2646
  id: "slaDurationValue",
2447
2647
  inputProps: { min: 1 },
2448
2648
  inputType: "number",
2449
2649
  name: "slaDurationValue",
2450
- onChange: (e) => Q(Ir(h, {
2451
- unit: v,
2650
+ onChange: (e) => Q(oi(_, {
2651
+ unit: ee,
2452
2652
  value: Number(e.target.value)
2453
2653
  })),
2454
- value: String(g.value),
2654
+ value: String(b.value),
2455
2655
  variant: "base"
2456
2656
  })
2457
- }), /* @__PURE__ */ w(n, {
2657
+ }), /* @__PURE__ */ T(n, {
2458
2658
  label: "期限單位",
2459
2659
  name: "slaDurationUnit",
2460
2660
  required: !0,
2461
- children: /* @__PURE__ */ w(y, {
2661
+ children: /* @__PURE__ */ T(x, {
2462
2662
  clearable: !1,
2463
- onChange: (e) => Q(Ir(h, {
2464
- unit: jr(e?.id ?? null),
2465
- value: g.value
2663
+ onChange: (e) => Q(oi(_, {
2664
+ unit: ti(e?.id ?? null),
2665
+ value: b.value
2466
2666
  })),
2467
- options: [...Ze],
2468
- value: X(Ze, v)
2667
+ options: [...$e],
2668
+ value: $($e, ee)
2469
2669
  })
2470
2670
  })] }) : null,
2471
- h && v === "DAY" ? /* @__PURE__ */ w(n, {
2671
+ _ && ee === "DAY" ? /* @__PURE__ */ T(n, {
2472
2672
  hintText: "工作日會跳過週末與行事曆上的假日,補班日仍計為工作日;行事曆由系統管理者設定。",
2473
2673
  label: "計算方式",
2474
2674
  name: "slaCalendar",
2475
2675
  required: !0,
2476
- children: /* @__PURE__ */ w(y, {
2676
+ children: /* @__PURE__ */ T(x, {
2477
2677
  clearable: !1,
2478
2678
  onChange: (e) => Q({
2479
- ...h,
2480
- calendar: Mr(e?.id ?? null)
2679
+ ..._,
2680
+ calendar: ni(e?.id ?? null)
2481
2681
  }),
2482
- options: [...Xe],
2483
- value: X(Xe, h.calendar ?? "CALENDAR")
2682
+ options: [...Qe],
2683
+ value: $(Qe, _.calendar ?? "CALENDAR")
2484
2684
  })
2485
2685
  }) : null,
2486
- h ? /* @__PURE__ */ w(n, {
2686
+ _ ? /* @__PURE__ */ T(n, {
2487
2687
  label: "逾時處理",
2488
2688
  name: "slaOnTimeout",
2489
2689
  required: !0,
2490
- children: /* @__PURE__ */ w(y, {
2690
+ children: /* @__PURE__ */ T(x, {
2491
2691
  clearable: !1,
2492
- onChange: (e) => Q(Lr(h, Nr(e?.id ?? null))),
2493
- options: [...Qe],
2494
- value: X(Qe, h.onTimeout)
2692
+ onChange: (e) => Q(si(_, ri(e?.id ?? null))),
2693
+ options: [...et],
2694
+ value: $(et, _.onTimeout)
2495
2695
  })
2496
2696
  }) : null,
2497
- h?.onTimeout === "ESCALATE" ? /* @__PURE__ */ w(n, {
2697
+ _?.onTimeout === "ESCALATE" ? /* @__PURE__ */ T(n, {
2498
2698
  hintText: "逾時後改派給簽核者的上層主管,只會升級一次。",
2499
2699
  label: "升級層級",
2500
2700
  name: "slaEscalateLevelsUp",
2501
2701
  required: !0,
2502
- children: /* @__PURE__ */ w(y, {
2702
+ children: /* @__PURE__ */ T(x, {
2503
2703
  clearable: !1,
2504
2704
  onChange: (e) => Q({
2505
- ...h,
2506
- escalateLevelsUp: Gr(e?.id ?? null).value
2705
+ ..._,
2706
+ escalateLevelsUp: hi(e?.id ?? null).value
2507
2707
  }),
2508
- options: [...K],
2509
- value: te
2708
+ options: [...Y],
2709
+ value: ne
2510
2710
  })
2511
2711
  }) : null,
2512
- h ? /* @__PURE__ */ w(n, {
2712
+ _ ? /* @__PURE__ */ T(n, {
2513
2713
  hintText: "在期限到達前先送出一次提醒。",
2514
2714
  label: "預警提醒",
2515
2715
  name: "slaWarningAt",
2516
- children: /* @__PURE__ */ w(y, {
2716
+ children: /* @__PURE__ */ T(x, {
2517
2717
  clearable: !1,
2518
- onChange: (e) => Q(Rr(h, Fr(e?.id ?? null).value)),
2519
- options: [...Vn],
2520
- value: ee
2718
+ onChange: (e) => Q(ci(_, ai(e?.id ?? null).value)),
2719
+ options: [...fr],
2720
+ value: te
2521
2721
  })
2522
2722
  }) : null,
2523
- /* @__PURE__ */ w(n, {
2723
+ /* @__PURE__ */ T(n, {
2524
2724
  hintText: "關閉後,簽核者在此關卡看不到「拒絕」按鈕。",
2525
2725
  label: "允許拒絕",
2526
2726
  name: "allowReject",
2527
- children: /* @__PURE__ */ w(x, {
2727
+ children: /* @__PURE__ */ T(S, {
2528
2728
  checked: e.data.allowReject,
2529
2729
  inputProps: {
2530
2730
  id: "allowReject",
2531
2731
  name: "allowReject"
2532
2732
  },
2533
- onChange: (e) => Ci({ allowReject: e.target.checked })
2733
+ onChange: (e) => Wr({ allowReject: e.target.checked })
2534
2734
  })
2535
2735
  }),
2536
- /* @__PURE__ */ w(n, {
2736
+ /* @__PURE__ */ T(n, {
2537
2737
  hintText: "關閉後,簽核者無法把此關卡的任務轉派給其他人。",
2538
2738
  label: "允許轉派",
2539
2739
  name: "allowTransfer",
2540
- children: /* @__PURE__ */ w(x, {
2740
+ children: /* @__PURE__ */ T(S, {
2541
2741
  checked: e.data.allowTransfer,
2542
2742
  inputProps: {
2543
2743
  id: "allowTransfer",
2544
2744
  name: "allowTransfer"
2545
2745
  },
2546
- onChange: (e) => Ci({ allowTransfer: e.target.checked })
2746
+ onChange: (e) => Wr({ allowTransfer: e.target.checked })
2547
2747
  })
2548
2748
  }),
2549
- /* @__PURE__ */ w(n, {
2749
+ /* @__PURE__ */ T(n, {
2550
2750
  hintText: "開啟後,簽核者可在此關卡臨時加入其他簽核人;會簽為平行處理,加簽則需等加入者簽完才往下。",
2551
2751
  label: "允許加簽",
2552
2752
  name: "allowAddSigner",
2553
- children: /* @__PURE__ */ w(x, {
2753
+ children: /* @__PURE__ */ T(S, {
2554
2754
  checked: e.data.allowAddSigner,
2555
2755
  inputProps: {
2556
2756
  id: "allowAddSigner",
2557
2757
  name: "allowAddSigner"
2558
2758
  },
2559
- onChange: (e) => Ci({ allowAddSigner: e.target.checked })
2759
+ onChange: (e) => Wr({ allowAddSigner: e.target.checked })
2560
2760
  })
2561
- })
2761
+ }),
2762
+ /* @__PURE__ */ T(n, {
2763
+ hintText: "開啟後,申請人本人(含其代理人)不會成為此關的簽核人,也不能被轉簽或加簽到此關。",
2764
+ label: "申請人不可簽核自己的單",
2765
+ name: "excludeInitiator",
2766
+ children: /* @__PURE__ */ T(S, {
2767
+ checked: !!v,
2768
+ inputProps: {
2769
+ id: "excludeInitiator",
2770
+ name: "excludeInitiator"
2771
+ },
2772
+ onChange: (e) => Hr(e.target.checked ? _r : null)
2773
+ })
2774
+ }),
2775
+ v ? /* @__PURE__ */ T(n, {
2776
+ label: "排除後沒有簽核人時",
2777
+ name: "excludeInitiatorWhenEmpty",
2778
+ required: !0,
2779
+ children: /* @__PURE__ */ T(x, {
2780
+ clearable: !1,
2781
+ onChange: (e) => Hr({ whenEmpty: $(gr, e?.id ?? null)?.id ?? _r.whenEmpty }),
2782
+ options: [...gr],
2783
+ value: $(gr, v.whenEmpty)
2784
+ })
2785
+ }) : null
2562
2786
  ] });
2563
2787
  }
2564
- function Zi(e) {
2565
- let t = e.data.action, r = Xi(t).map((e) => gi(F, e)), i = t.type === "NOTIFY" && t.recipients.type !== "DIRECT" ? ji(t.recipients, F, L, R) : null;
2788
+ function Gi(e) {
2789
+ let t = e.data.action, r = ya(t).map((e) => zi(I, e)), i = t.type === "NOTIFY" && t.recipients.type !== "DIRECT" ? ta(t.recipients, I, L, R, G) : null;
2566
2790
  function a(e) {
2567
2791
  let n = {
2568
2792
  memberIds: [...e],
2569
2793
  type: "DIRECT"
2570
2794
  };
2571
- wi(t.type === "NOTIFY" ? {
2795
+ Gr(t.type === "NOTIFY" ? {
2572
2796
  ...t,
2573
2797
  recipients: n
2574
2798
  } : {
@@ -2578,64 +2802,64 @@ function ir({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2578
2802
  });
2579
2803
  }
2580
2804
  function o(e) {
2581
- t.type === "NOTIFY" && wi({
2805
+ t.type === "NOTIFY" && Gr({
2582
2806
  ...t,
2583
2807
  webhooks: e
2584
2808
  });
2585
2809
  }
2586
- return /* @__PURE__ */ T(C, { children: [
2587
- /* @__PURE__ */ w(n, {
2810
+ return /* @__PURE__ */ E(w, { children: [
2811
+ /* @__PURE__ */ T(n, {
2588
2812
  hintText: i ? `目前知會對象為「${i}」;在此選擇成員會改為指定成員。` : t.type === "NOTIFY" ? "可只設定 Webhook,不指定知會對象。" : void 0,
2589
2813
  label: "知會對象",
2590
2814
  name: "notifyMemberIds",
2591
- children: /* @__PURE__ */ w(m, {
2815
+ children: /* @__PURE__ */ T(g, {
2592
2816
  asyncData: !0,
2593
2817
  disabledOptionsFilter: !0,
2594
2818
  emptyText: "沒有符合的成員",
2595
- loading: Dt,
2819
+ loading: Mt,
2596
2820
  loadingText: "搜尋成員中...",
2597
2821
  mode: "multiple",
2598
2822
  onChange: (e) => a(e.map((e) => e.id)),
2599
- onSearch: Y,
2823
+ onSearch: J,
2600
2824
  onVisibilityChange: (e) => {
2601
- e && (Mt([]), Y(""));
2825
+ e && (It([]), J(""));
2602
2826
  },
2603
- options: [...Di(r, jt)],
2827
+ options: [...Zi(r, Ft)],
2604
2828
  overflowStrategy: "wrap",
2605
2829
  placeholder: "搜尋姓名或信箱",
2606
2830
  searchDebounceTime: 300,
2607
2831
  value: [...r]
2608
2832
  })
2609
2833
  }),
2610
- t.type === "NOTIFY" && !Lt(t.webhooks) ? /* @__PURE__ */ T("div", {
2611
- style: V,
2612
- children: [/* @__PURE__ */ w(S, {
2834
+ t.type === "NOTIFY" && !Jt(t.webhooks) ? /* @__PURE__ */ E("div", {
2835
+ style: U,
2836
+ children: [/* @__PURE__ */ T(C, {
2613
2837
  color: "text-warning",
2614
2838
  variant: "body",
2615
2839
  children: "這個節點的 Webhook 設定格式錯誤,無法在此編輯。清除後可重新新增。"
2616
- }), /* @__PURE__ */ w("div", { children: /* @__PURE__ */ w(h, {
2840
+ }), /* @__PURE__ */ T("div", { children: /* @__PURE__ */ T(_, {
2617
2841
  onClick: () => o([]),
2618
2842
  variant: "destructive-secondary",
2619
2843
  children: "清除 Webhook 設定"
2620
2844
  }) })]
2621
2845
  }) : null,
2622
- t.type === "NOTIFY" && Lt(t.webhooks) ? /* @__PURE__ */ w(Xt, {
2623
- catalog: Yt,
2624
- catalogState: Qt,
2625
- formFields: q?.fields ?? null,
2846
+ t.type === "NOTIFY" && Jt(t.webhooks) ? /* @__PURE__ */ T(cn, {
2847
+ catalog: rn,
2848
+ catalogState: on,
2849
+ formFields: G?.fields ?? null,
2626
2850
  onChange: o,
2627
- targets: ct(t)
2851
+ targets: mt(t)
2628
2852
  }) : null
2629
2853
  ] });
2630
2854
  }
2631
- function Qi(e) {
2632
- return /* @__PURE__ */ T("div", {
2633
- style: V,
2634
- children: [/* @__PURE__ */ w(S, {
2855
+ function Ki(e) {
2856
+ return /* @__PURE__ */ E("div", {
2857
+ style: U,
2858
+ children: [/* @__PURE__ */ T(C, {
2635
2859
  component: "h2",
2636
2860
  variant: "h3",
2637
2861
  children: "已選取線段"
2638
- }), /* @__PURE__ */ T(S, {
2862
+ }), /* @__PURE__ */ E(C, {
2639
2863
  color: "text-neutral",
2640
2864
  variant: "body",
2641
2865
  children: [
@@ -2646,17 +2870,17 @@ function ir({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2646
2870
  })]
2647
2871
  });
2648
2872
  }
2649
- function $i(e) {
2650
- let t = Ji(e, A.nodes);
2651
- return /* @__PURE__ */ T("div", {
2652
- style: V,
2873
+ function qi(e) {
2874
+ let t = _a(e, A.nodes);
2875
+ return /* @__PURE__ */ E("div", {
2876
+ style: U,
2653
2877
  children: [
2654
- /* @__PURE__ */ w(S, {
2878
+ /* @__PURE__ */ T(C, {
2655
2879
  component: "h2",
2656
2880
  variant: "h3",
2657
2881
  children: t ? "條件設定" : "線段屬性"
2658
2882
  }),
2659
- /* @__PURE__ */ T(S, {
2883
+ /* @__PURE__ */ E(C, {
2660
2884
  color: "text-neutral",
2661
2885
  variant: "body",
2662
2886
  children: [
@@ -2665,7 +2889,7 @@ function ir({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2665
2889
  e.target
2666
2890
  ]
2667
2891
  }),
2668
- t ? ta(e) : /* @__PURE__ */ w(S, {
2892
+ t ? Xi(e) : /* @__PURE__ */ T(C, {
2669
2893
  color: "text-neutral",
2670
2894
  variant: "body",
2671
2895
  children: "這條線會直接把流程送到下一個節點。"
@@ -2673,63 +2897,63 @@ function ir({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2673
2897
  ]
2674
2898
  });
2675
2899
  }
2676
- function ea(e) {
2677
- return !e || !Ji(e, A.nodes) ? null : /* @__PURE__ */ w(v, {
2900
+ function Ji(e) {
2901
+ return !e || !_a(e, A.nodes) ? null : /* @__PURE__ */ T(b, {
2678
2902
  cancelText: "取消",
2679
2903
  confirmButtonProps: { disabled: !e.data.isDefault && !e.data.condition },
2680
2904
  confirmText: "完成",
2681
2905
  modalType: "standard",
2682
- onCancel: ii,
2683
- onClose: ii,
2684
- onConfirm: ii,
2685
- open: !!it,
2906
+ onCancel: Pr,
2907
+ onClose: Pr,
2908
+ onConfirm: Pr,
2909
+ open: !!ot,
2686
2910
  showModalFooter: !0,
2687
2911
  showModalHeader: !0,
2688
2912
  size: "regular",
2689
2913
  supportingText: "條件分流的輸出連線需要指定條件,條件會直接顯示在線上。",
2690
2914
  title: "條件設定",
2691
- children: ta(e)
2915
+ children: Xi(e)
2692
2916
  });
2693
2917
  }
2694
- function ta(e) {
2695
- let t = Ki(e, A.nodes), r = zi(G?.schema ?? null), i = Bi(G?.schema ?? null, e.data.conditionFieldKey ?? null), a = Vi(i), o = Wi(i), s = X(a, e.data.conditionOperator ?? null), c = !e.data.isDefault && !e.data.condition;
2696
- return /* @__PURE__ */ T("div", {
2697
- style: V,
2918
+ function Xi(e) {
2919
+ let t = ha(e, A.nodes), r = la(H?.schema ?? null), i = ua(H?.schema ?? null, e.data.conditionFieldKey ?? null), a = da(i), o = pa(i), s = $(a, e.data.conditionOperator ?? null), c = !e.data.isDefault && !e.data.condition;
2920
+ return /* @__PURE__ */ E("div", {
2921
+ style: U,
2698
2922
  children: [
2699
- /* @__PURE__ */ T(S, {
2923
+ /* @__PURE__ */ E(C, {
2700
2924
  color: "text-neutral",
2701
2925
  variant: "body",
2702
2926
  children: [
2703
2927
  "畫布上的這條線目前會顯示「",
2704
- /* @__PURE__ */ w("span", {
2705
- style: { color: c ? fn : void 0 },
2928
+ /* @__PURE__ */ T("span", {
2929
+ style: { color: c ? Rn : void 0 },
2706
2930
  children: t ?? "請設定條件"
2707
2931
  }),
2708
2932
  "」。"
2709
2933
  ]
2710
2934
  }),
2711
- /* @__PURE__ */ w(x, {
2935
+ /* @__PURE__ */ T(S, {
2712
2936
  checked: !!e.data.isDefault,
2713
2937
  label: "其他情況走這條",
2714
- onChange: (t) => Ai(e.id, t.target.checked)
2938
+ onChange: (t) => bi(e.id, t.target.checked)
2715
2939
  }),
2716
- e.data.isDefault ? /* @__PURE__ */ w(S, {
2940
+ e.data.isDefault ? /* @__PURE__ */ T(C, {
2717
2941
  color: "text-neutral",
2718
2942
  variant: "body",
2719
2943
  children: "其他條件都不符合時,流程會走這條線。"
2720
- }) : /* @__PURE__ */ T(C, { children: [
2721
- G ? null : /* @__PURE__ */ w(S, {
2944
+ }) : /* @__PURE__ */ E(w, { children: [
2945
+ H ? null : /* @__PURE__ */ T(C, {
2722
2946
  color: "text-neutral",
2723
2947
  variant: "body",
2724
2948
  children: "請先綁定表單版本,才能選擇條件欄位。"
2725
2949
  }),
2726
- /* @__PURE__ */ w(n, {
2950
+ /* @__PURE__ */ T(n, {
2727
2951
  label: "條件欄位",
2728
2952
  name: "edgeConditionField",
2729
2953
  required: !0,
2730
- children: /* @__PURE__ */ w(y, {
2954
+ children: /* @__PURE__ */ T(x, {
2731
2955
  clearable: !1,
2732
- onChange: (t) => Mi({
2956
+ onChange: (t) => Si({
2733
2957
  edgeId: e.id,
2734
2958
  fieldKey: t?.id ?? null,
2735
2959
  operator: null,
@@ -2737,18 +2961,18 @@ function ir({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2737
2961
  }),
2738
2962
  options: [...r],
2739
2963
  placeholder: "選擇條件欄位",
2740
- value: X(r, e.data.conditionFieldKey ?? null)
2964
+ value: $(r, e.data.conditionFieldKey ?? null)
2741
2965
  })
2742
2966
  }),
2743
- /* @__PURE__ */ w(n, {
2967
+ /* @__PURE__ */ T(n, {
2744
2968
  label: "條件判斷",
2745
2969
  name: "edgeConditionOperator",
2746
2970
  required: !0,
2747
- children: /* @__PURE__ */ w(y, {
2971
+ children: /* @__PURE__ */ T(x, {
2748
2972
  clearable: !1,
2749
- onChange: (t) => Mi({
2973
+ onChange: (t) => Si({
2750
2974
  edgeId: e.id,
2751
- operator: Hi(t?.id ?? null),
2975
+ operator: fa(t?.id ?? null),
2752
2976
  value: null
2753
2977
  }),
2754
2978
  options: [...a],
@@ -2756,21 +2980,21 @@ function ir({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2756
2980
  value: s
2757
2981
  })
2758
2982
  }),
2759
- s && Gi(s.id) ? /* @__PURE__ */ w(n, {
2983
+ s && ma(s.id) ? /* @__PURE__ */ T(n, {
2760
2984
  label: "條件值",
2761
2985
  name: "edgeConditionValue",
2762
2986
  required: !0,
2763
- children: o.length > 0 ? /* @__PURE__ */ w(y, {
2987
+ children: o.length > 0 ? /* @__PURE__ */ T(x, {
2764
2988
  clearable: !1,
2765
- onChange: (t) => Mi({
2989
+ onChange: (t) => Si({
2766
2990
  edgeId: e.id,
2767
2991
  value: t?.id ?? null
2768
2992
  }),
2769
2993
  options: [...o],
2770
2994
  placeholder: "選擇條件值",
2771
- value: X(o, e.data.conditionValue ?? null)
2772
- }) : /* @__PURE__ */ w(_, {
2773
- onChange: (t) => Mi({
2995
+ value: $(o, e.data.conditionValue ?? null)
2996
+ }) : /* @__PURE__ */ T(y, {
2997
+ onChange: (t) => Si({
2774
2998
  edgeId: e.id,
2775
2999
  value: t.target.value
2776
3000
  }),
@@ -2784,14 +3008,14 @@ function ir({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride
2784
3008
  });
2785
3009
  }
2786
3010
  }
2787
- function ar({ onApplyAutoLayout: e }) {
3011
+ function jr({ onApplyAutoLayout: e }) {
2788
3012
  function t() {
2789
3013
  e();
2790
3014
  }
2791
- return /* @__PURE__ */ w(je, {
3015
+ return /* @__PURE__ */ T(Pe, {
2792
3016
  position: "top-right",
2793
- children: /* @__PURE__ */ w(h, {
2794
- icon: oe,
3017
+ children: /* @__PURE__ */ T(_, {
3018
+ icon: se,
2795
3019
  iconType: "leading",
2796
3020
  onClick: t,
2797
3021
  size: "sub",
@@ -2800,28 +3024,28 @@ function ar({ onApplyAutoLayout: e }) {
2800
3024
  })
2801
3025
  });
2802
3026
  }
2803
- function q({ data: e, selected: t, type: n }) {
2804
- let r = e.approverLines ?? [e.approverSummary ?? e.label], i = or(e), a = sr(n, t);
2805
- return /* @__PURE__ */ T("div", {
3027
+ function X({ data: e, selected: t, type: n }) {
3028
+ let r = e.approverLines ?? [e.approverSummary ?? e.label], i = Mr(e), a = Nr(n, t);
3029
+ return /* @__PURE__ */ E("div", {
2806
3030
  style: a,
2807
3031
  children: [
2808
- lr(e),
2809
- /* @__PURE__ */ w("div", {
2810
- style: Pn,
2811
- children: r.map((e, t) => /* @__PURE__ */ w(S, {
3032
+ Fr(e),
3033
+ /* @__PURE__ */ T("div", {
3034
+ style: ir,
3035
+ children: r.map((e, t) => /* @__PURE__ */ T(C, {
2812
3036
  component: "span",
2813
3037
  ellipsis: !0,
2814
- style: Nn,
3038
+ style: rr,
2815
3039
  title: e,
2816
3040
  variant: "label-primary",
2817
3041
  children: e
2818
3042
  }, `${e}_${t}`))
2819
3043
  }),
2820
- /* @__PURE__ */ w(S, {
3044
+ /* @__PURE__ */ T(C, {
2821
3045
  color: "text-neutral",
2822
3046
  component: "span",
2823
3047
  ellipsis: !0,
2824
- style: Nn,
3048
+ style: rr,
2825
3049
  title: i,
2826
3050
  variant: "caption",
2827
3051
  children: i
@@ -2829,85 +3053,85 @@ function q({ data: e, selected: t, type: n }) {
2829
3053
  ]
2830
3054
  });
2831
3055
  }
2832
- function or(e) {
2833
- return e.nodeKind === "startEvent" ? e.initiatorPolicySummary ?? "所有人" : e.approverSummary || e.approverLines ? e.label : e.nodeKind === "exclusiveGateway" ? "條件在線上" : e.nodeKind === "parallelGateway" ? "多條路徑同時進行" : In[e.nodeKind];
3056
+ function Mr(e) {
3057
+ return e.nodeKind === "startEvent" ? e.initiatorPolicySummary ?? "所有人" : e.approverSummary || e.approverLines ? e.label : e.nodeKind === "exclusiveGateway" ? "條件在線上" : e.nodeKind === "parallelGateway" ? "多條路徑同時進行" : sr[e.nodeKind];
2834
3058
  }
2835
- function sr(e, t) {
2836
- let n = cr(e);
3059
+ function Nr(e, t) {
3060
+ let n = Pr(e);
2837
3061
  return t ? {
2838
3062
  ...n,
2839
3063
  border: "1px solid var(--mzn-color-primary, #0057ff)",
2840
- boxShadow: Cn
3064
+ boxShadow: Xn
2841
3065
  } : n;
2842
3066
  }
2843
- function cr(e) {
2844
- return e === "exclusiveGateway" ? kn : e === "parallelGateway" ? An : e === "startEvent" ? Mn : e === "endEvent" ? W : e === "userTask" ? jn : H;
3067
+ function Pr(e) {
3068
+ return e === "exclusiveGateway" ? $n : e === "parallelGateway" ? er : e === "startEvent" ? J : e === "endEvent" ? nr : e === "userTask" ? tr : Yn;
2845
3069
  }
2846
- function lr(e) {
2847
- return !e.hasInput && e.hasOutput ? /* @__PURE__ */ w(D, {
2848
- id: Fn,
3070
+ function Fr(e) {
3071
+ return !e.hasInput && e.hasOutput ? /* @__PURE__ */ T(Me, {
3072
+ id: or,
2849
3073
  position: O.Right,
2850
3074
  type: "source"
2851
- }) : e.hasInput && !e.hasOutput ? /* @__PURE__ */ w(D, {
2852
- id: G,
3075
+ }) : e.hasInput && !e.hasOutput ? /* @__PURE__ */ T(Me, {
3076
+ id: ar,
2853
3077
  position: O.Left,
2854
3078
  type: "target"
2855
- }) : !e.hasInput && !e.hasOutput ? null : [/* @__PURE__ */ w(D, {
2856
- id: G,
3079
+ }) : !e.hasInput && !e.hasOutput ? null : [/* @__PURE__ */ T(Me, {
3080
+ id: ar,
2857
3081
  position: O.Left,
2858
3082
  type: "target"
2859
- }, "target"), /* @__PURE__ */ w(D, {
2860
- id: Fn,
3083
+ }, "target"), /* @__PURE__ */ T(Me, {
3084
+ id: or,
2861
3085
  position: O.Right,
2862
3086
  type: "source"
2863
3087
  }, "source")];
2864
3088
  }
2865
- function ur(e, t, n, r, i, a) {
2866
- let o = J(e);
3089
+ function Ir(e, t, n, r, i, a, o) {
3090
+ let s = Lr(e);
2867
3091
  return {
2868
3092
  data: {
2869
- approverLines: Mi(e, t, n, r),
2870
- approverSummary: Ai(e, t, n, r),
2871
- hasInput: ri(e),
2872
- hasOutput: ii(e),
2873
- initiatorPolicySummary: e.type === "startEvent" ? Qr(a, n, r) : null,
3093
+ approverLines: na(e, t, n, r, o),
3094
+ approverSummary: ea(e, t, n, r, o),
3095
+ hasInput: Di(e),
3096
+ hasOutput: Oi(e),
3097
+ initiatorPolicySummary: e.type === "startEvent" ? Si(a, n, r) : null,
2874
3098
  label: e.data.label,
2875
3099
  nodeKind: e.type
2876
3100
  },
2877
- height: o.height,
2878
- handles: dr(e),
3101
+ height: s.height,
3102
+ handles: Z(e),
2879
3103
  id: e.id,
2880
- initialHeight: o.height,
2881
- initialWidth: o.width,
3104
+ initialHeight: s.height,
3105
+ initialWidth: s.width,
2882
3106
  position: e.position,
2883
3107
  selected: i,
2884
3108
  sourcePosition: O.Right,
2885
3109
  targetPosition: O.Left,
2886
3110
  type: e.type,
2887
- width: o.width
3111
+ width: s.width
2888
3112
  };
2889
3113
  }
2890
- function J(e) {
3114
+ function Lr(e) {
2891
3115
  return e.type === "exclusiveGateway" || e.type === "parallelGateway" ? {
2892
- height: U,
2893
- width: Dn
3116
+ height: Qn,
3117
+ width: K
2894
3118
  } : e.type === "serviceTask" ? {
2895
- height: wn + (Ni(e.data.action) - 1) * En,
2896
- width: Tn
3119
+ height: W + (ra(e.data.action) - 1) * Zn,
3120
+ width: G
2897
3121
  } : {
2898
- height: wn,
2899
- width: Tn
3122
+ height: W,
3123
+ width: G
2900
3124
  };
2901
3125
  }
2902
- function dr(e) {
2903
- let t = J(e);
2904
- return [...ri(e) ? [Y(t)] : [], ...ii(e) ? [fr(t)] : []];
3126
+ function Z(e) {
3127
+ let t = Lr(e);
3128
+ return [...Di(e) ? [Rr(t)] : [], ...Oi(e) ? [zr(t)] : []];
2905
3129
  }
2906
- function Y({ height: e }) {
3130
+ function Rr({ height: e }) {
2907
3131
  let t = e / 2 - 9 / 2;
2908
3132
  return {
2909
3133
  height: 9,
2910
- id: G,
3134
+ id: ar,
2911
3135
  position: O.Left,
2912
3136
  type: "target",
2913
3137
  width: 9,
@@ -2915,11 +3139,11 @@ function Y({ height: e }) {
2915
3139
  y: t
2916
3140
  };
2917
3141
  }
2918
- function fr({ height: e, width: t }) {
3142
+ function zr({ height: e, width: t }) {
2919
3143
  let n = e / 2 - 9 / 2;
2920
3144
  return {
2921
3145
  height: 9,
2922
- id: Fn,
3146
+ id: or,
2923
3147
  position: O.Right,
2924
3148
  type: "source",
2925
3149
  width: 9,
@@ -2927,8 +3151,8 @@ function fr({ height: e, width: t }) {
2927
3151
  y: n
2928
3152
  };
2929
3153
  }
2930
- function pr(e, t, n) {
2931
- let r = Ki(e, t), i = Ji(e, t), a = i && !e.data.isDefault && !e.data.condition, o = a ? fn : i ? z : "#475569", s = a ? "#fef2f2" : i ? "#eff6ff" : "#ffffff", c = a ? fn : i ? z : B;
3154
+ function Br(e, t, n) {
3155
+ let r = ha(e, t), i = _a(e, t), a = i && !e.data.isDefault && !e.data.condition, o = a ? Rn : i ? Ln : "#475569", s = a ? "#fef2f2" : i ? "#eff6ff" : "#ffffff", c = a ? Rn : i ? Ln : H;
2932
3156
  return {
2933
3157
  className: n ? "workflow-edge--selected" : void 0,
2934
3158
  data: e.data,
@@ -2951,9 +3175,9 @@ function pr(e, t, n) {
2951
3175
  source: e.source,
2952
3176
  sourceHandle: e.sourceHandle,
2953
3177
  style: {
2954
- filter: n ? pn : void 0,
3178
+ filter: n ? zn : void 0,
2955
3179
  opacity: 1,
2956
- stroke: B,
3180
+ stroke: H,
2957
3181
  strokeOpacity: 1,
2958
3182
  strokeWidth: 1.5
2959
3183
  },
@@ -2962,7 +3186,7 @@ function pr(e, t, n) {
2962
3186
  type: e.type ?? "smoothstep"
2963
3187
  };
2964
3188
  }
2965
- function mr(e, t) {
3189
+ function Q(e, t) {
2966
3190
  return e.type === "startEvent" ? e : (e.type === "endEvent" || e.type === "userTask" || e.type === "serviceTask" || e.type, {
2967
3191
  ...e,
2968
3192
  data: {
@@ -2971,10 +3195,10 @@ function mr(e, t) {
2971
3195
  }
2972
3196
  });
2973
3197
  }
2974
- function hr(e) {
2975
- return yr(_r(vr(gr(e))));
3198
+ function Vr(e) {
3199
+ return Gr(Ur(Wr(Hr(e))));
2976
3200
  }
2977
- function gr(e) {
3201
+ function Hr(e) {
2978
3202
  let t = e.edges.map((e) => {
2979
3203
  let t = e.data ?? {};
2980
3204
  return e.data === t ? e : {
@@ -2987,7 +3211,7 @@ function gr(e) {
2987
3211
  edges: t
2988
3212
  } : e;
2989
3213
  }
2990
- function _r(e) {
3214
+ function Ur(e) {
2991
3215
  let t = e.nodes.map((e) => {
2992
3216
  if (e.type !== "userTask") return e;
2993
3217
  let t = e.data.allowAddSigner ?? !1, n = e.data.allowReject ?? !0, r = e.data.allowTransfer ?? !0, i = !e.data.decisionPolicy;
@@ -3007,24 +3231,24 @@ function _r(e) {
3007
3231
  nodes: t
3008
3232
  } : e;
3009
3233
  }
3010
- function vr(e) {
3011
- let t = new Set(e.nodes.filter((e) => ai(e)).map((e) => e.id)), n = e.edges.filter((e) => !t.has(e.source));
3234
+ function Wr(e) {
3235
+ let t = new Set(e.nodes.filter((e) => ki(e)).map((e) => e.id)), n = e.edges.filter((e) => !t.has(e.source));
3012
3236
  return n.length === e.edges.length ? e : {
3013
3237
  ...e,
3014
3238
  edges: n
3015
3239
  };
3016
3240
  }
3017
- function yr(e) {
3241
+ function Gr(e) {
3018
3242
  let t = e.edges.reduce((e, t) => ({
3019
3243
  ...e,
3020
3244
  [t.target]: (e[t.target] ?? 0) + 1
3021
- }), {}), n = e.nodes.map((e) => e.type === "startEvent" ? e : (t[e.id] ?? 0) < 2 && e.data.triggerMode !== "AND" ? mr(e, "AND") : e);
3245
+ }), {}), n = e.nodes.map((e) => e.type === "startEvent" ? e : (t[e.id] ?? 0) < 2 && e.data.triggerMode !== "AND" ? Q(e, "AND") : e);
3022
3246
  return n.some((t, n) => t !== e.nodes[n]) ? {
3023
3247
  ...e,
3024
3248
  nodes: n
3025
3249
  } : e;
3026
3250
  }
3027
- function br() {
3251
+ function Kr() {
3028
3252
  return {
3029
3253
  edges: [],
3030
3254
  meta: { schemaVersion: 1 },
@@ -3051,96 +3275,80 @@ function br() {
3051
3275
  }]
3052
3276
  };
3053
3277
  }
3054
- function xr(e) {
3278
+ function qr(e) {
3055
3279
  return e.edges.length === 0 && e.nodes.length === 2 && e.nodes.some((e) => e.type === "startEvent") && e.nodes.some((e) => e.type === "endEvent");
3056
3280
  }
3057
- function Sr(e) {
3058
- let t = new Fe.graphlib.Graph();
3281
+ function Jr(e) {
3282
+ let t = new Re.graphlib.Graph();
3059
3283
  return t.setDefaultEdgeLabel(() => ({})), t.setGraph({
3060
3284
  rankdir: "LR",
3061
3285
  ranksep: 120
3062
3286
  }), e.nodes.forEach((e) => {
3063
- t.setNode(e.id, J(e));
3287
+ t.setNode(e.id, Lr(e));
3064
3288
  }), e.edges.forEach((e) => {
3065
3289
  t.setEdge(e.source, e.target);
3066
- }), Fe.layout(t), {
3290
+ }), Re.layout(t), {
3067
3291
  ...e,
3068
3292
  nodes: e.nodes.map((e) => {
3069
3293
  let n = t.node(e.id);
3070
3294
  return n ? {
3071
3295
  ...e,
3072
3296
  position: {
3073
- x: n.x - J(e).width / 2,
3074
- y: n.y - J(e).height / 2
3297
+ x: n.x - Lr(e).width / 2,
3298
+ y: n.y - Lr(e).height / 2
3075
3299
  }
3076
3300
  } : e;
3077
3301
  })
3078
3302
  };
3079
3303
  }
3080
- function X(e, t) {
3304
+ function $(e, t) {
3081
3305
  return t ? e.find((e) => e.id === t) ?? null : null;
3082
3306
  }
3083
- function Cr(e) {
3307
+ function Yr(e) {
3084
3308
  return e === "OR" ? "OR" : "AND";
3085
3309
  }
3086
- function wr(e) {
3310
+ function Xr(e) {
3087
3311
  return e === "FROM_RETURN_POINT" ? "FROM_RETURN_POINT" : "RESTART";
3088
3312
  }
3089
- function Tr(e) {
3090
- if (!e || e.type === "SINGLE" || e.type === "PARALLEL_ANY") return "可指定多位;多位時所有人都會收到待辦,任一人同意即可通過。";
3091
- if (e.type === "PARALLEL_ALL") return "可指定多位;多位時所有人都會收到待辦,全部同意後才會通過。";
3092
- if (e.type === "SEQUENTIAL") return "可指定多位;所有人會同時收到待辦,需全部同意後才會通過。";
3093
- let t = e.thresholdType === "PERCENTAGE" ? "%" : " 位簽核者";
3094
- return `可指定多位;需達到 ${e.threshold}${t} 才會通過。`;
3095
- }
3096
- function Er(e) {
3313
+ function Zr(e) {
3097
3314
  return e?.type ?? "SINGLE";
3098
3315
  }
3099
- function Dr(e) {
3100
- return Un.find((t) => t.id === e) || (e === "SEQUENTIAL" ? {
3101
- id: e,
3102
- name: "全部同意(既有設定)"
3103
- } : {
3104
- id: e,
3105
- name: `未知決策方式(${e})`
3106
- });
3107
- }
3108
- function Or(e, t) {
3316
+ function Qr(e, t) {
3109
3317
  return e === "QUORUM" ? t?.type === "QUORUM" ? t : {
3110
- threshold: qe,
3318
+ threshold: Xe,
3111
3319
  thresholdType: "COUNT",
3112
3320
  type: "QUORUM"
3113
3321
  } : e === "PARALLEL_ALL" || e === "PARALLEL_ANY" || e === "SEQUENTIAL" ? { type: e } : { type: "SINGLE" };
3114
3322
  }
3115
- function kr(e) {
3323
+ function $r(e) {
3116
3324
  return e?.type === "QUORUM" ? {
3117
- threshold: Number.isFinite(e.threshold) ? e.threshold : qe,
3118
- thresholdType: Ar(e.thresholdType ?? null)
3325
+ threshold: Number.isFinite(e.threshold) ? e.threshold : Xe,
3326
+ thresholdType: ei(e.thresholdType ?? null)
3119
3327
  } : {
3120
- threshold: qe,
3328
+ threshold: Xe,
3121
3329
  thresholdType: "COUNT"
3122
3330
  };
3123
3331
  }
3124
- function Ar(e) {
3332
+ function ei(e) {
3125
3333
  return e === "PERCENTAGE" ? "PERCENTAGE" : "COUNT";
3126
3334
  }
3127
- function jr(e) {
3335
+ function ti(e) {
3128
3336
  return e === "HOUR" ? "HOUR" : "DAY";
3129
3337
  }
3130
- function Mr(e) {
3338
+ function ni(e) {
3131
3339
  return e === "BUSINESS_DAY" ? "BUSINESS_DAY" : "CALENDAR";
3132
3340
  }
3133
- function Nr(e) {
3134
- return Qe.find((t) => t.id === e)?.id ?? "REMIND";
3341
+ function ri(e) {
3342
+ return et.find((t) => t.id === e)?.id ?? "REMIND";
3135
3343
  }
3136
- function Pr(e) {
3137
- return Vn.find((t) => t.value === e) ?? Vn[0];
3344
+ function ii(e) {
3345
+ return fr.find((t) => t.value === e) ?? fr[0];
3138
3346
  }
3139
- function Fr(e) {
3140
- return Vn.find((t) => t.id === e) ?? Vn[0];
3347
+ function ai(e) {
3348
+ return fr.find((t) => t.id === e) ?? fr[0];
3141
3349
  }
3142
- function Ir(e, t) {
3143
- let n = Number.isFinite(t.value) ? Math.trunc(t.value) : 1, r = A({
3350
+ function oi(e, t) {
3351
+ let n = Number.isFinite(t.value) ? Math.trunc(t.value) : 1, r = j({
3144
3352
  unit: t.unit,
3145
3353
  value: n
3146
3354
  });
@@ -3150,47 +3358,53 @@ function Ir(e, t) {
3150
3358
  duration: r
3151
3359
  };
3152
3360
  }
3153
- function Lr(e, t) {
3361
+ function si(e, t) {
3154
3362
  return t === "ESCALATE" ? {
3155
3363
  ...e,
3156
3364
  escalateLevelsUp: e.escalateLevelsUp ?? 1,
3157
3365
  onTimeout: t
3158
3366
  } : {
3159
- ...zr(e, "escalateLevelsUp"),
3367
+ ...li(e, "escalateLevelsUp"),
3160
3368
  onTimeout: t
3161
3369
  };
3162
3370
  }
3163
- function Rr(e, t) {
3164
- return t === null ? zr(e, "warningAt") : {
3371
+ function ci(e, t) {
3372
+ return t === null ? li(e, "warningAt") : {
3165
3373
  ...e,
3166
3374
  warningAt: t
3167
3375
  };
3168
3376
  }
3169
- function zr(e, t) {
3377
+ function li(e, t) {
3170
3378
  return Object.fromEntries(Object.entries(e).filter(([e]) => e !== t));
3171
3379
  }
3172
- function Br(e) {
3173
- return e === "ORG_MANAGER" || e === "ORG_UNIT_MANAGER" || e === "ORG_UNIT_MEMBER" || e === "ORG_UNIT_POSITION" || e === "POSITION" ? e : "DIRECT";
3174
- }
3175
- function Vr(e) {
3176
- let t = Br(e ?? "DIRECT");
3177
- return t === "ORG_MANAGER" ? {
3380
+ function ui(e) {
3381
+ return e === "DYNAMIC_FORM" || e === "ORG_MANAGER" || e === "ORG_MANAGER_CHAIN" || e === "ORG_UNIT_MANAGER" || e === "ORG_UNIT_MEMBER" || e === "ORG_UNIT_POSITION" || e === "POSITION" ? e : "DIRECT";
3382
+ }
3383
+ function di(e, t) {
3384
+ let n = ui(e ?? "DIRECT");
3385
+ return n === "DYNAMIC_FORM" ? {
3386
+ formPath: "",
3387
+ type: "DYNAMIC_FORM"
3388
+ } : n === "ORG_MANAGER" ? {
3178
3389
  baseFromInitiator: !0,
3179
3390
  levelsUp: 1,
3180
3391
  type: "ORG_MANAGER"
3181
- } : t === "ORG_UNIT_MANAGER" ? {
3392
+ } : n === "ORG_MANAGER_CHAIN" ? {
3393
+ minPositionLevel: Bt(t),
3394
+ type: "ORG_MANAGER_CHAIN"
3395
+ } : n === "ORG_UNIT_MANAGER" ? {
3182
3396
  orgUnitId: "",
3183
3397
  type: "ORG_UNIT_MANAGER"
3184
- } : t === "ORG_UNIT_MEMBER" ? {
3398
+ } : n === "ORG_UNIT_MEMBER" ? {
3185
3399
  includeDescendants: !1,
3186
3400
  orgUnitId: "",
3187
3401
  type: "ORG_UNIT_MEMBER"
3188
- } : t === "ORG_UNIT_POSITION" ? {
3402
+ } : n === "ORG_UNIT_POSITION" ? {
3189
3403
  includeDescendants: !1,
3190
3404
  orgUnitId: "",
3191
3405
  positionId: "",
3192
3406
  type: "ORG_UNIT_POSITION"
3193
- } : t === "POSITION" ? {
3407
+ } : n === "POSITION" ? {
3194
3408
  positionId: "",
3195
3409
  type: "POSITION"
3196
3410
  } : {
@@ -3198,31 +3412,31 @@ function Vr(e) {
3198
3412
  type: "DIRECT"
3199
3413
  };
3200
3414
  }
3201
- function Hr(e) {
3415
+ function fi(e) {
3202
3416
  return e === "DIRECT" ? "DIRECT" : "NONE";
3203
3417
  }
3204
- function Ur(e, t) {
3205
- return e.type === "ORG_MANAGER" || e.type === "ORG_UNIT_MANAGER" ? {
3418
+ function pi(e, t) {
3419
+ return e.type === "ORG_MANAGER" || e.type === "ORG_MANAGER_CHAIN" || e.type === "ORG_UNIT_MANAGER" ? {
3206
3420
  ...e,
3207
3421
  fallback: t
3208
3422
  } : e;
3209
3423
  }
3210
- function Wr(e) {
3211
- return K.find((t) => t.value === e) ?? K[0];
3424
+ function mi(e) {
3425
+ return Y.find((t) => t.value === e) ?? Y[0];
3212
3426
  }
3213
- function Gr(e) {
3214
- return K.find((t) => t.id === e) ?? K[0];
3427
+ function hi(e) {
3428
+ return Y.find((t) => t.id === e) ?? Y[0];
3215
3429
  }
3216
- function Kr(e) {
3430
+ function gi(e) {
3217
3431
  return e === "ORG_UNIT" || e === "ORG_UNIT_POSITION" || e === "NONE" ? e : "ALL";
3218
3432
  }
3219
- function qr(e) {
3433
+ function _i(e) {
3220
3434
  let t = e?.trim();
3221
3435
  if (!t) return {
3222
3436
  mode: "ALL",
3223
3437
  value: ""
3224
3438
  };
3225
- let n = Xr(t, /"([^"]+)" in subject\.orgUnitIds/gu), r = Xr(t, /"([^"]+)" in subject\.positionIds/gu);
3439
+ let n = bi(t, /"([^"]+)" in subject\.orgUnitIds/gu), r = bi(t, /"([^"]+)" in subject\.positionIds/gu);
3226
3440
  return n.length > 0 && r.length > 0 ? {
3227
3441
  includeDescendants: n.length > 1,
3228
3442
  mode: "ORG_UNIT_POSITION",
@@ -3239,32 +3453,32 @@ function qr(e) {
3239
3453
  value: t
3240
3454
  };
3241
3455
  }
3242
- function Jr(e, t) {
3243
- let n = qr(e);
3456
+ function vi(e, t) {
3457
+ let n = _i(e);
3244
3458
  return !t || t === "ALL" || t === "NONE" ? t === "ALL" || t === "NONE" ? {
3245
3459
  mode: t,
3246
3460
  value: ""
3247
- } : n : n.mode === t ? n : $r(t);
3461
+ } : n : n.mode === t ? n : Ci(t);
3248
3462
  }
3249
- function Yr(e) {
3463
+ function yi(e) {
3250
3464
  return e.mode === "NONE" ? "發起權限需要選擇誰可以發起。" : (e.mode === "ORG_UNIT" || e.mode === "ORG_UNIT_POSITION") && !e.orgUnitId?.trim() ? "指定組織發起時,需要選擇組織。" : e.mode === "ORG_UNIT_POSITION" && !e.positionId?.trim() ? "指定組織職位發起時,需要選擇職位。" : null;
3251
3465
  }
3252
- function Xr(e, t) {
3466
+ function bi(e, t) {
3253
3467
  return [...e.matchAll(t)].map((e) => e[1]).filter((e) => !!e);
3254
3468
  }
3255
- function Zr(e, t) {
3469
+ function xi(e, t) {
3256
3470
  if (e.mode === "ALL" || e.mode === "NONE") return null;
3257
3471
  let n = e.orgUnitId?.trim() ?? "";
3258
3472
  if (!n) return null;
3259
- let r = Ei(t, n, !!e.includeDescendants).map((e) => `${JSON.stringify(e)} in subject.orgUnitIds`).join(" || ");
3473
+ let r = Xi(t, n, !!e.includeDescendants).map((e) => `${JSON.stringify(e)} in subject.orgUnitIds`).join(" || ");
3260
3474
  if (e.mode === "ORG_UNIT") return r ? `(${r})` : null;
3261
3475
  let i = e.positionId?.trim() ?? "";
3262
3476
  return i && r ? `(${r}) && ${JSON.stringify(i)} in subject.positionIds` : null;
3263
3477
  }
3264
- function Qr(e, t, n) {
3265
- return e.mode === "NONE" ? "未設定" : e.mode === "ORG_UNIT" ? e.orgUnitId ? `組織:${yi(t, e.orgUnitId)}` : "指定組織" : e.mode === "ORG_UNIT_POSITION" ? e.orgUnitId && e.positionId ? `組織職位:${yi(t, e.orgUnitId)} / ${bi(n, e.positionId)}` : "指定組織職位" : e.mode === "CUSTOM" ? "既有自訂規則" : "所有人";
3478
+ function Si(e, t, n) {
3479
+ return e.mode === "NONE" ? "未設定" : e.mode === "ORG_UNIT" ? e.orgUnitId ? `組織:${Hi(t, e.orgUnitId)}` : "指定組織" : e.mode === "ORG_UNIT_POSITION" ? e.orgUnitId && e.positionId ? `組織職位:${Hi(t, e.orgUnitId)} / ${Ui(n, e.positionId)}` : "指定組織職位" : e.mode === "CUSTOM" ? "既有自訂規則" : "所有人";
3266
3480
  }
3267
- function $r(e) {
3481
+ function Ci(e) {
3268
3482
  return {
3269
3483
  includeDescendants: !0,
3270
3484
  mode: e,
@@ -3273,73 +3487,64 @@ function $r(e) {
3273
3487
  value: ""
3274
3488
  };
3275
3489
  }
3276
- function ei(e, t) {
3490
+ function wi(e, t) {
3277
3491
  let n = e.source ? t.find((t) => t.id === e.source) ?? null : null, r = e.target ? t.find((t) => t.id === e.target) ?? null : null;
3278
- return !!n && !!r && e.source !== e.target && e.sourceHandle === Fn && e.targetHandle === G && !!(n && ii(n)) && !!(r && ri(r));
3492
+ return !!n && !!r && e.source !== e.target && e.sourceHandle === or && e.targetHandle === ar && !!(n && Oi(n)) && !!(r && Di(r));
3279
3493
  }
3280
- function ti(e, t) {
3494
+ function Ti(e, t) {
3281
3495
  return e.includes(t) ? e.filter((e) => e !== t) : [...e, t];
3282
3496
  }
3283
- function ni(e) {
3497
+ function Ei(e) {
3284
3498
  return e.type !== "startEvent" && e.type !== "endEvent";
3285
3499
  }
3286
- function ri(e) {
3500
+ function Di(e) {
3287
3501
  return e.type !== "startEvent";
3288
3502
  }
3289
- function ii(e) {
3290
- return e.type !== "endEvent" && !ai(e);
3503
+ function Oi(e) {
3504
+ return e.type !== "endEvent" && !ki(e);
3291
3505
  }
3292
- function ai(e) {
3506
+ function ki(e) {
3293
3507
  return e.type === "serviceTask" && e.data.action.type === "NOTIFY";
3294
3508
  }
3295
- function oi(e) {
3509
+ function Ai(e) {
3296
3510
  return e instanceof HTMLElement ? e.isContentEditable || e.tagName === "INPUT" || e.tagName === "TEXTAREA" || e.tagName === "SELECT" || !!e.closest("[contenteditable=\"true\"]") : !1;
3297
3511
  }
3298
- function si(e) {
3512
+ function ji(e) {
3299
3513
  return e.map((e) => ({
3300
3514
  formDefinitionId: e.formDefinitionId,
3301
3515
  formName: e.formName,
3302
3516
  id: e.id,
3303
- name: `${e.formName} | v${e.version}`,
3517
+ name: kn(e.formName, e.version),
3304
3518
  schema: e.schema
3305
3519
  }));
3306
3520
  }
3307
- function ci(e) {
3308
- return (e?.schema.fields ?? []).reduce((e, t) => ({
3309
- ...e,
3310
- [t.fieldKey]: li(t)
3311
- }), {});
3312
- }
3313
- function li(e) {
3314
- return e.type === "number" ? 1e3 : e.type === "boolean" ? !0 : we(e) ? e.type === "checkbox" ? e.options[0] ? [e.options[0].value] : [] : e.options[0]?.value ?? "" : e.type === "date" ? "2026-05-08" : e.type === "datetime" ? "2026-05-08T09:00:00+08:00" : e.placeholder ?? e.label;
3315
- }
3316
- function ui(e) {
3521
+ function Mi(e) {
3317
3522
  let t = JSON.parse(e);
3318
- if (!Z(t)) throw Error("表單資料 JSON 必須是物件。");
3523
+ if (!Ni(t)) throw Error("表單資料 JSON 必須是物件。");
3319
3524
  return t;
3320
3525
  }
3321
- function Z(e) {
3526
+ function Ni(e) {
3322
3527
  return typeof e == "object" && !!e && !Array.isArray(e);
3323
3528
  }
3324
- function di(e) {
3529
+ function Pi(e) {
3325
3530
  return e === "COMPLETED" ? "完成" : e === "PASSED" ? "通過" : e === "SKIPPED" ? "略過" : e === "STOPPED" ? "已停止" : e === "WAITING" ? "將等待簽核" : e;
3326
3531
  }
3327
- function fi(e) {
3328
- return e in In ? In[e] : e;
3532
+ function Fi(e) {
3533
+ return e in sr ? sr[e] : e;
3329
3534
  }
3330
- function pi(e, t) {
3535
+ function Ii(e, t) {
3331
3536
  return t && !e.some((e) => e.id === t.id) ? [t, ...e] : e;
3332
3537
  }
3333
- function mi(e) {
3538
+ function Li(e) {
3334
3539
  return e.map((e) => ({
3335
3540
  displayName: e.name,
3336
3541
  email: e.email,
3337
3542
  id: e.memberId,
3338
3543
  memberId: e.memberId,
3339
- name: Ii(e.name, e.email)
3544
+ name: oa(e.name, e.email)
3340
3545
  }));
3341
3546
  }
3342
- function hi(e) {
3547
+ function Ri(e) {
3343
3548
  return {
3344
3549
  displayName: "未知會員",
3345
3550
  email: "",
@@ -3349,101 +3554,101 @@ function hi(e) {
3349
3554
  unresolved: !0
3350
3555
  };
3351
3556
  }
3352
- function gi(e, t) {
3353
- return e.find((e) => e.memberId === t) ?? hi(t);
3557
+ function zi(e, t) {
3558
+ return e.find((e) => e.memberId === t) ?? Ri(t);
3354
3559
  }
3355
- function _i(e, t) {
3560
+ function Bi(e, t) {
3356
3561
  let n = e.find((e) => e.id === t);
3357
3562
  return n ? r(n) : null;
3358
3563
  }
3359
- function vi(e, t) {
3564
+ function Vi(e, t) {
3360
3565
  let n = e.find((e) => e.id === t);
3361
3566
  return n ? a(n) : null;
3362
3567
  }
3363
- function yi(e, t) {
3364
- return _i(e, t)?.name ?? "未指定組織";
3568
+ function Hi(e, t) {
3569
+ return Bi(e, t)?.name ?? "未指定組織";
3365
3570
  }
3366
- function bi(e, t) {
3367
- return vi(e, t)?.name ?? "未指定職位";
3571
+ function Ui(e, t) {
3572
+ return Vi(e, t)?.name ?? "未指定職位";
3368
3573
  }
3369
- function xi(e, t) {
3370
- let n = Q(), r = t.filter((t) => t.memberId === e && Si(t, n)), i = r.reduce((e, t) => e && Ci(e, t) <= 0 ? e : t, null);
3574
+ function Wi(e, t) {
3575
+ let n = Gi(), r = t.filter((t) => t.memberId === e && Ki(t, n)), i = r.reduce((e, t) => e && qi(e, t) <= 0 ? e : t, null);
3371
3576
  return {
3372
3577
  customFields: {},
3373
3578
  managerMemberId: "member-002",
3374
3579
  memberId: e,
3375
3580
  orgCode: "HQ",
3376
- orgUnitIds: wi(r.map((e) => e.orgUnitId)),
3581
+ orgUnitIds: Ji(r.map((e) => e.orgUnitId)),
3377
3582
  positionId: i?.positionId ?? null,
3378
- positionIds: wi(r.map((e) => e.positionId)),
3583
+ positionIds: Ji(r.map((e) => e.positionId)),
3379
3584
  primaryOrgUnitId: i?.orgUnitId ?? null,
3380
3585
  roles: ["manager"]
3381
3586
  };
3382
3587
  }
3383
- function Q() {
3588
+ function Gi() {
3384
3589
  return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
3385
3590
  }
3386
- function Si(e, t) {
3591
+ function Ki(e, t) {
3387
3592
  return e.effectiveFrom <= t && (!e.effectiveTo || e.effectiveTo >= t);
3388
3593
  }
3389
- function Ci(e, t) {
3594
+ function qi(e, t) {
3390
3595
  return e.isPrimary === t.isPrimary ? t.effectiveFrom.localeCompare(e.effectiveFrom) : e.isPrimary ? -1 : 1;
3391
3596
  }
3392
- function wi(e) {
3597
+ function Ji(e) {
3393
3598
  return e.reduce((e, t) => t && !e.includes(t) ? [...e, t] : e, []);
3394
3599
  }
3395
- function Ti({ includeDescendants: e, memberships: t, orgUnitId: n, orgUnits: r, positions: i }) {
3396
- let a = new Set(Ei(r, n, e)), o = new Set(t.filter((e) => a.has(e.orgUnitId)).map((e) => e.positionId).filter((e) => !!e));
3600
+ function Yi({ includeDescendants: e, memberships: t, orgUnitId: n, orgUnits: r, positions: i }) {
3601
+ let a = new Set(Xi(r, n, e)), o = new Set(t.filter((e) => a.has(e.orgUnitId)).map((e) => e.positionId).filter((e) => !!e));
3397
3602
  return i.filter((e) => o.has(e.id));
3398
3603
  }
3399
- function Ei(e, t, n) {
3604
+ function Xi(e, t, n) {
3400
3605
  let r = e.find((e) => e.id === t);
3401
3606
  return r ? n ? e.filter((e) => e.id === r.id || e.path.startsWith(`${r.path}.`)).map((e) => e.id) : [r.id] : t.trim() ? [t] : [];
3402
3607
  }
3403
- function Di(e, t) {
3608
+ function Zi(e, t) {
3404
3609
  let n = new Map(t.filter((e) => !e.unresolved).map((e) => [e.memberId, e])), r = new Set(e.map((e) => e.memberId)), i = t.filter((e) => !r.has(e.memberId)), a = e.map((e) => (e.unresolved ? n.get(e.memberId) : null) ?? e);
3405
3610
  return i.length > 0 || a.some((t, n) => t !== e[n]) ? [...a, ...i] : e;
3406
3611
  }
3407
- function Oi(e) {
3408
- return e.type === "DIRECT" ? e.memberIds : (e.type === "ORG_MANAGER" || e.type === "ORG_UNIT_MANAGER") && e.fallback?.type === "DIRECT" && e.fallback.memberId ? [e.fallback.memberId] : [];
3612
+ function Qi(e) {
3613
+ return e.type === "DIRECT" ? e.memberIds : (e.type === "ORG_MANAGER" || e.type === "ORG_MANAGER_CHAIN" || e.type === "ORG_UNIT_MANAGER") && e.fallback?.type === "DIRECT" && e.fallback.memberId ? [e.fallback.memberId] : [];
3409
3614
  }
3410
- function ki(e) {
3411
- return [...new Set(e.nodes.flatMap((e) => e.type === "userTask" ? Oi(e.data.approverResolver) : e.type === "serviceTask" ? Xi(e.data.action) : []))];
3615
+ function $i(e) {
3616
+ return [...new Set(e.nodes.flatMap((e) => e.type === "userTask" ? Qi(e.data.approverResolver) : e.type === "serviceTask" ? ya(e.data.action) : []))];
3412
3617
  }
3413
- function Ai(e, t, n, r) {
3414
- return e.type === "userTask" ? ji(e.data.approverResolver, t, n, r) : null;
3618
+ function ea(e, t, n, r, i) {
3619
+ return e.type === "userTask" ? ta(e.data.approverResolver, t, n, r, i) : null;
3415
3620
  }
3416
- function ji(e, t, n, r) {
3417
- return e.type === "DIRECT" ? Fi(e.memberIds, t, "未指定簽核者") : e.type === "ORG_MANAGER" ? Wr(e.levelsUp).name : e.type === "ORG_UNIT_MANAGER" ? `組織主管:${yi(n, e.orgUnitId)}` : e.type === "ORG_UNIT_MEMBER" ? `組織任一人:${yi(n, e.orgUnitId)}` : e.type === "ORG_UNIT_POSITION" ? `組織職位:${yi(n, e.orgUnitId)} / ${bi(r, e.positionId)}` : e.type === "POSITION" ? `職位:${bi(r, e.positionId)}` : e.type === "DYNAMIC_FORM" ? `表單欄位:${e.formPath || "未設定"}` : "自訂表達式";
3621
+ function ta(e, t, n, r, i) {
3622
+ return e.type === "DIRECT" ? aa(e.memberIds, t, "未指定簽核者") : e.type === "ORG_MANAGER" ? mi(e.levelsUp).name : e.type === "ORG_MANAGER_CHAIN" ? `主管鏈:簽到職等 ${e.minPositionLevel}` : e.type === "ORG_UNIT_MANAGER" ? `組織主管:${Hi(n, e.orgUnitId)}` : e.type === "ORG_UNIT_MEMBER" ? `組織任一人:${Hi(n, e.orgUnitId)}` : e.type === "ORG_UNIT_POSITION" ? `組織職位:${Hi(n, e.orgUnitId)} / ${Ui(r, e.positionId)}` : e.type === "POSITION" ? `職位:${Ui(r, e.positionId)}` : e.type === "DYNAMIC_FORM" ? Dn(i, e.formPath) : "自訂表達式";
3418
3623
  }
3419
- function Mi(e, t, n, r) {
3624
+ function na(e, t, n, r, i) {
3420
3625
  if (e.type !== "serviceTask") return null;
3421
- let i = e.data.action, a = i.type === "NOTIFY" && i.recipients.type !== "DIRECT" ? [ji(i.recipients, t, n, r)] : Xi(i).map((e) => gi(t, e).name), o = ct(i).length, s = [...a, ...o ? [`Webhook ${o} 個`] : []];
3422
- return s.length ? s : ["未指定知會對象"];
3626
+ let a = e.data.action, o = a.type === "NOTIFY" && a.recipients.type !== "DIRECT" ? [ta(a.recipients, t, n, r, i)] : ya(a).map((e) => zi(t, e).name), s = mt(a).length, c = [...o, ...s ? [`Webhook ${s} 個`] : []];
3627
+ return c.length ? c : ["未指定知會對象"];
3423
3628
  }
3424
- function Ni(e) {
3425
- let t = e.type === "NOTIFY" && e.recipients.type !== "DIRECT" ? 1 : Xi(e).length, n = +!!ct(e).length;
3629
+ function ra(e) {
3630
+ let t = e.type === "NOTIFY" && e.recipients.type !== "DIRECT" ? 1 : ya(e).length, n = +!!mt(e).length;
3426
3631
  return Math.max(1, t + n);
3427
3632
  }
3428
- function Pi(e, t, n) {
3633
+ function ia(e, t, n) {
3429
3634
  let r = e.nodes.find((e) => e.id === t);
3430
- return r?.type === "serviceTask" && r.data.action.type === "NOTIFY" && Lt(r.data.action.webhooks) ? ct(r.data.action).map((e) => ({
3635
+ return r?.type === "serviceTask" && r.data.action.type === "NOTIFY" && Jt(r.data.action.webhooks) ? mt(r.data.action).map((e) => ({
3431
3636
  key: e.id,
3432
- label: L(n, e.endpoint)?.label ?? I(e.endpoint)
3637
+ label: Ht(n, e.endpoint)?.label ?? R(e.endpoint)
3433
3638
  })) : [];
3434
3639
  }
3435
- function Fi(e, t, n) {
3436
- let r = e.map((e) => gi(t, e).name);
3640
+ function aa(e, t, n) {
3641
+ let r = e.map((e) => zi(t, e).name);
3437
3642
  return r.length === 0 ? n : r.length <= 2 ? r.join("、") : `${r.slice(0, 2).join("、")} 等 ${r.length} 人`;
3438
3643
  }
3439
- function Ii(e, t) {
3644
+ function oa(e, t) {
3440
3645
  return `${e} (${t})`;
3441
3646
  }
3442
- function Li(e, t) {
3647
+ function sa(e, t) {
3443
3648
  let n = t?.getBoundingClientRect();
3444
3649
  if (!n || e.nodes.length === 0) return null;
3445
3650
  let r = e.nodes.reduce((e, t) => {
3446
- let n = J(t);
3651
+ let n = Lr(t);
3447
3652
  return {
3448
3653
  maxX: Math.max(e.maxX, t.position.x + n.width),
3449
3654
  maxY: Math.max(e.maxY, t.position.y + n.height),
@@ -3456,93 +3661,71 @@ function Li(e, t) {
3456
3661
  minX: Infinity,
3457
3662
  minY: Infinity
3458
3663
  });
3459
- return Pe({
3664
+ return Le({
3460
3665
  height: r.maxY - r.minY,
3461
3666
  width: r.maxX - r.minX,
3462
3667
  x: r.minX,
3463
3668
  y: r.minY
3464
3669
  }, n.width, n.height, .1, 1, .2);
3465
3670
  }
3466
- function Ri(e) {
3467
- let t = e.nodes.find((e) => e.type === "userTask" && !!N(e.data.approverResolver)), n = e.nodes.map((e) => it(e)).find((e) => e !== null) ?? null, r = e.edges.find((t) => Ji(t, e.nodes) && !t.data.isDefault && !t.data.condition);
3468
- return t && t.type === "userTask" ? N(t.data.approverResolver) : n || (r ? "條件分流的每條輸出連線都需要先設定條件。" : null);
3671
+ function ca(e) {
3672
+ let t = e.nodes.find((e) => e.type === "userTask" && !!ot(e.data.approverResolver)), n = e.nodes.find((e) => e.type === "userTask" && !!lt(e.data.excludeInitiator)), r = e.nodes.map((e) => ut(e)).find((e) => e !== null) ?? null, i = e.edges.find((t) => _a(t, e.nodes) && !t.data.isDefault && !t.data.condition), a = e.nodes.find((e) => e.type === "userTask" && at(e.data.approverResolver, e.data.decisionPolicy));
3673
+ return t && t.type === "userTask" ? ot(t.data.approverResolver) : a && a.type === "userTask" ? `簽核節點「${a.data.label}」使用「沿主管鏈簽核」時,決策方式必須是「依序簽核或全部同意」,否則任一位主管簽完就會結案。` : n && n.type === "userTask" ? lt(n.data.excludeInitiator) : r || (i ? "條件分流的每條輸出連線都需要先設定條件。" : null);
3469
3674
  }
3470
- function zi(e) {
3675
+ function la(e) {
3471
3676
  return e?.fields.map((e) => ({
3472
3677
  fieldType: e.type,
3473
3678
  id: e.fieldKey,
3474
3679
  name: `${e.label} (${e.fieldKey})`
3475
3680
  })) ?? [];
3476
3681
  }
3477
- function Bi(e, t) {
3682
+ function ua(e, t) {
3478
3683
  return t ? e?.fields.find((e) => e.fieldKey === t) ?? null : null;
3479
3684
  }
3480
- function Vi(e) {
3685
+ function da(e) {
3481
3686
  if (!e) return [];
3482
- let t = Ui(e);
3483
- return Kn.filter((e) => t.includes(e.id));
3484
- }
3485
- function Hi(e) {
3486
- return Kn.some((t) => t.id === e) ? e : null;
3487
- }
3488
- function Ui(e) {
3489
- return e.type === "file_upload" ? ["IS_FILLED", "IS_EMPTY"] : e.type === "boolean" ? [
3490
- "EQUALS",
3491
- "NOT_EQUALS",
3492
- "IS_FILLED",
3493
- "IS_EMPTY"
3494
- ] : e.type === "date" || e.type === "datetime" || e.type === "money" || e.type === "number" ? [
3495
- "EQUALS",
3496
- "NOT_EQUALS",
3497
- "GREATER_THAN",
3498
- "GREATER_THAN_OR_EQUALS",
3499
- "LESS_THAN",
3500
- "LESS_THAN_OR_EQUALS",
3501
- "IS_FILLED",
3502
- "IS_EMPTY"
3503
- ] : [
3504
- "EQUALS",
3505
- "NOT_EQUALS",
3506
- "IS_FILLED",
3507
- "IS_EMPTY"
3508
- ];
3687
+ let t = st(e);
3688
+ return vr.filter((e) => t.includes(e.id));
3509
3689
  }
3510
- function Wi(e) {
3690
+ function fa(e) {
3691
+ return vr.some((t) => t.id === e) ? e : null;
3692
+ }
3693
+ function pa(e) {
3511
3694
  return e ? e.type === "boolean" ? [{
3512
3695
  id: "true",
3513
3696
  name: "是"
3514
3697
  }, {
3515
3698
  id: "false",
3516
3699
  name: "否"
3517
- }] : we(e) ? e.options.map((e) => ({
3700
+ }] : Te(e) ? e.options.map((e) => ({
3518
3701
  id: e.value,
3519
3702
  name: e.label
3520
3703
  })) : [] : [];
3521
3704
  }
3522
- function Gi(e) {
3523
- return qn.includes(e);
3705
+ function ma(e) {
3706
+ return yr.includes(e);
3524
3707
  }
3525
- function Ki(e, t) {
3708
+ function ha(e, t) {
3526
3709
  if (e.data.label) return e.data.label;
3527
- if (Ji(e, t)) return qi(e);
3528
- if (Yi(e, t)) return "同時進行";
3710
+ if (_a(e, t)) return ga(e);
3711
+ if (va(e, t)) return "同時進行";
3529
3712
  }
3530
- function qi(e) {
3713
+ function ga(e) {
3531
3714
  return e.data.isDefault ? "其他情況" : "請設定條件";
3532
3715
  }
3533
- function Ji(e, t) {
3716
+ function _a(e, t) {
3534
3717
  return t.some((t) => t.id === e.source && t.type === "exclusiveGateway");
3535
3718
  }
3536
- function Yi(e, t) {
3719
+ function va(e, t) {
3537
3720
  return t.some((t) => t.id === e.source && t.type === "parallelGateway");
3538
3721
  }
3539
- function Xi(e) {
3722
+ function ya(e) {
3540
3723
  return e.type === "NOTIFY" && e.recipients.type === "DIRECT" ? e.recipients.memberIds : [];
3541
3724
  }
3542
- function $(e) {
3543
- return e instanceof Error ? e.message.includes("WORKFLOW_WEBHOOK_") ? `Webhook 設定未通過發布檢查:${e.message}` : Ce(e.message) : "發生未知錯誤";
3725
+ function ba(e) {
3726
+ return e instanceof Error ? e.message.includes("WORKFLOW_WEBHOOK_") ? `Webhook 設定未通過發布檢查:${e.message}` : we(e.message) : "發生未知錯誤";
3544
3727
  }
3545
3728
  //#endregion
3546
- export { ir as t };
3729
+ export { Ar as t };
3547
3730
 
3548
- //# sourceMappingURL=designer-C3s2kSna.js.map
3731
+ //# sourceMappingURL=designer-CrbBRPUU.js.map