@rytass/bpm-core-react 0.17.2 → 0.17.4

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