@rytass/bpm-core-react 0.17.1 → 0.17.3

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