@rytass/bpm-core-react 0.14.0 → 0.16.2

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