@rytass/bpm-core-react 0.16.2 → 0.17.1

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