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