@rytass/bpm-core-react 0.2.0

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 (443) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +56 -0
  3. package/dist/AdminDelegationsView.css +1 -0
  4. package/dist/AdminOrgsView.css +1 -0
  5. package/dist/AdminUsersView.css +1 -0
  6. package/dist/DelegationsView.css +1 -0
  7. package/dist/InstanceDetailView.css +1 -0
  8. package/dist/LoginView.css +1 -0
  9. package/dist/SettingsNotificationsView.css +1 -0
  10. package/dist/admin-pickers.css +1 -0
  11. package/dist/app-navigation.css +1 -0
  12. package/dist/approval-instance-list-page.css +1 -0
  13. package/dist/auth-provider.css +1 -0
  14. package/dist/chunks/AdminDelegationsView-CqNmlVWx.cjs +2 -0
  15. package/dist/chunks/AdminDelegationsView-CqNmlVWx.cjs.map +1 -0
  16. package/dist/chunks/AdminDelegationsView-DydMZ9ED.js +642 -0
  17. package/dist/chunks/AdminDelegationsView-DydMZ9ED.js.map +1 -0
  18. package/dist/chunks/AdminOrgsView-DZaVAbaQ.js +1945 -0
  19. package/dist/chunks/AdminOrgsView-DZaVAbaQ.js.map +1 -0
  20. package/dist/chunks/AdminOrgsView-bSsIyMvk.cjs +2 -0
  21. package/dist/chunks/AdminOrgsView-bSsIyMvk.cjs.map +1 -0
  22. package/dist/chunks/AdminUsersView-C0oO05Br.js +215 -0
  23. package/dist/chunks/AdminUsersView-C0oO05Br.js.map +1 -0
  24. package/dist/chunks/AdminUsersView-DlArLlIr.cjs +2 -0
  25. package/dist/chunks/AdminUsersView-DlArLlIr.cjs.map +1 -0
  26. package/dist/chunks/CcView-BsVsya5F.cjs +2 -0
  27. package/dist/chunks/CcView-BsVsya5F.cjs.map +1 -0
  28. package/dist/chunks/CcView-Bv0GzA5C.js +19 -0
  29. package/dist/chunks/CcView-Bv0GzA5C.js.map +1 -0
  30. package/dist/chunks/DashboardView-Dk1ZQmmk.js +11 -0
  31. package/dist/chunks/DashboardView-Dk1ZQmmk.js.map +1 -0
  32. package/dist/chunks/DashboardView-_0zh-rxT.cjs +2 -0
  33. package/dist/chunks/DashboardView-_0zh-rxT.cjs.map +1 -0
  34. package/dist/chunks/DelegationsView-DQUqOUV5.js +569 -0
  35. package/dist/chunks/DelegationsView-DQUqOUV5.js.map +1 -0
  36. package/dist/chunks/DelegationsView-pKeFV2LN.cjs +2 -0
  37. package/dist/chunks/DelegationsView-pKeFV2LN.cjs.map +1 -0
  38. package/dist/chunks/FormBuilderView-BKtyW55e.cjs +3 -0
  39. package/dist/chunks/FormBuilderView-BKtyW55e.cjs.map +1 -0
  40. package/dist/chunks/FormBuilderView-CvChAvgD.js +1300 -0
  41. package/dist/chunks/FormBuilderView-CvChAvgD.js.map +1 -0
  42. package/dist/chunks/FormRendererView-BwVsH2eX.cjs +2 -0
  43. package/dist/chunks/FormRendererView-BwVsH2eX.cjs.map +1 -0
  44. package/dist/chunks/FormRendererView-DrHsuSVo.js +220 -0
  45. package/dist/chunks/FormRendererView-DrHsuSVo.js.map +1 -0
  46. package/dist/chunks/FormsView-DYEuik8W.js +185 -0
  47. package/dist/chunks/FormsView-DYEuik8W.js.map +1 -0
  48. package/dist/chunks/FormsView-RjJEkIfZ.cjs +2 -0
  49. package/dist/chunks/FormsView-RjJEkIfZ.cjs.map +1 -0
  50. package/dist/chunks/InboxView-DDWwmWhA.cjs +2 -0
  51. package/dist/chunks/InboxView-DDWwmWhA.cjs.map +1 -0
  52. package/dist/chunks/InboxView-YSoyrYLk.js +291 -0
  53. package/dist/chunks/InboxView-YSoyrYLk.js.map +1 -0
  54. package/dist/chunks/InstanceDetailView-C-A-LOCG.js +1519 -0
  55. package/dist/chunks/InstanceDetailView-C-A-LOCG.js.map +1 -0
  56. package/dist/chunks/InstanceDetailView-l_kNDCz2.cjs +2 -0
  57. package/dist/chunks/InstanceDetailView-l_kNDCz2.cjs.map +1 -0
  58. package/dist/chunks/InstanceNewView-B5hz-FWd.js +190 -0
  59. package/dist/chunks/InstanceNewView-B5hz-FWd.js.map +1 -0
  60. package/dist/chunks/InstanceNewView-CdCsxQIu.cjs +2 -0
  61. package/dist/chunks/InstanceNewView-CdCsxQIu.cjs.map +1 -0
  62. package/dist/chunks/LoginView-BED07v-7.cjs +2 -0
  63. package/dist/chunks/LoginView-BED07v-7.cjs.map +1 -0
  64. package/dist/chunks/LoginView-a1iu3cfc.js +157 -0
  65. package/dist/chunks/LoginView-a1iu3cfc.js.map +1 -0
  66. package/dist/chunks/RootClientView-rXJt4TDd.cjs +2 -0
  67. package/dist/chunks/RootClientView-rXJt4TDd.cjs.map +1 -0
  68. package/dist/chunks/RootClientView-wAkXUEZw.js +34 -0
  69. package/dist/chunks/RootClientView-wAkXUEZw.js.map +1 -0
  70. package/dist/chunks/SearchView-CgXPssgE.cjs +2 -0
  71. package/dist/chunks/SearchView-CgXPssgE.cjs.map +1 -0
  72. package/dist/chunks/SearchView-WXMbZwRw.js +19 -0
  73. package/dist/chunks/SearchView-WXMbZwRw.js.map +1 -0
  74. package/dist/chunks/SentView-BTDoFBrG.cjs +2 -0
  75. package/dist/chunks/SentView-BTDoFBrG.cjs.map +1 -0
  76. package/dist/chunks/SentView-CdOL92Rq.js +19 -0
  77. package/dist/chunks/SentView-CdOL92Rq.js.map +1 -0
  78. package/dist/chunks/SettingsNotificationsView-B6F6fa7U.js +194 -0
  79. package/dist/chunks/SettingsNotificationsView-B6F6fa7U.js.map +1 -0
  80. package/dist/chunks/SettingsNotificationsView-Bnz0CmoJ.cjs +2 -0
  81. package/dist/chunks/SettingsNotificationsView-Bnz0CmoJ.cjs.map +1 -0
  82. package/dist/chunks/TemplateCategoriesView-CgZciaSd.js +382 -0
  83. package/dist/chunks/TemplateCategoriesView-CgZciaSd.js.map +1 -0
  84. package/dist/chunks/TemplateCategoriesView-U0stGUBc.cjs +2 -0
  85. package/dist/chunks/TemplateCategoriesView-U0stGUBc.cjs.map +1 -0
  86. package/dist/chunks/TemplateDesignerView-A38DyYD4.cjs +51 -0
  87. package/dist/chunks/TemplateDesignerView-A38DyYD4.cjs.map +1 -0
  88. package/dist/chunks/TemplateDesignerView-Dffx-VZ-.js +2272 -0
  89. package/dist/chunks/TemplateDesignerView-Dffx-VZ-.js.map +1 -0
  90. package/dist/chunks/TemplateVersionsView-6sVQbBem.js +110 -0
  91. package/dist/chunks/TemplateVersionsView-6sVQbBem.js.map +1 -0
  92. package/dist/chunks/TemplateVersionsView-CMqw3ieU.cjs +2 -0
  93. package/dist/chunks/TemplateVersionsView-CMqw3ieU.cjs.map +1 -0
  94. package/dist/chunks/TemplatesView-BLj9f-XI.js +380 -0
  95. package/dist/chunks/TemplatesView-BLj9f-XI.js.map +1 -0
  96. package/dist/chunks/TemplatesView-DIOQTUUl.cjs +2 -0
  97. package/dist/chunks/TemplatesView-DIOQTUUl.cjs.map +1 -0
  98. package/dist/chunks/admin-pickers-Btvij1at.cjs +2 -0
  99. package/dist/chunks/admin-pickers-Btvij1at.cjs.map +1 -0
  100. package/dist/chunks/admin-pickers-DLlG_1du.js +140 -0
  101. package/dist/chunks/admin-pickers-DLlG_1du.js.map +1 -0
  102. package/dist/chunks/app-navigation-CATITRM7.js +263 -0
  103. package/dist/chunks/app-navigation-CATITRM7.js.map +1 -0
  104. package/dist/chunks/app-navigation-DAC5gFbG.cjs +2 -0
  105. package/dist/chunks/app-navigation-DAC5gFbG.cjs.map +1 -0
  106. package/dist/chunks/approval-instance-list-page-B6vAGvOb.js +278 -0
  107. package/dist/chunks/approval-instance-list-page-B6vAGvOb.js.map +1 -0
  108. package/dist/chunks/approval-instance-list-page-DIAmwhvl.cjs +2 -0
  109. package/dist/chunks/approval-instance-list-page-DIAmwhvl.cjs.map +1 -0
  110. package/dist/chunks/auth-provider-D2P-qWmY.cjs +2 -0
  111. package/dist/chunks/auth-provider-D2P-qWmY.cjs.map +1 -0
  112. package/dist/chunks/auth-provider-TTO9eNZV.js +83 -0
  113. package/dist/chunks/auth-provider-TTO9eNZV.js.map +1 -0
  114. package/dist/chunks/bpm-form-field-Bc6k4ZEO.cjs +2 -0
  115. package/dist/chunks/bpm-form-field-Bc6k4ZEO.cjs.map +1 -0
  116. package/dist/chunks/bpm-form-field-Cao0rMol.js +17 -0
  117. package/dist/chunks/bpm-form-field-Cao0rMol.js.map +1 -0
  118. package/dist/chunks/dashboard-page-BsW8t104.js +115 -0
  119. package/dist/chunks/dashboard-page-BsW8t104.js.map +1 -0
  120. package/dist/chunks/dashboard-page-udYhnyMW.cjs +2 -0
  121. package/dist/chunks/dashboard-page-udYhnyMW.cjs.map +1 -0
  122. package/dist/chunks/form-name-modal-C3OEvkCV.js +64 -0
  123. package/dist/chunks/form-name-modal-C3OEvkCV.js.map +1 -0
  124. package/dist/chunks/form-name-modal-uZCHbtRH.cjs +2 -0
  125. package/dist/chunks/form-name-modal-uZCHbtRH.cjs.map +1 -0
  126. package/dist/chunks/format-date-time-BQyH5U8z.cjs +2 -0
  127. package/dist/chunks/format-date-time-BQyH5U8z.cjs.map +1 -0
  128. package/dist/chunks/format-date-time-CB-LxzqT.js +9 -0
  129. package/dist/chunks/format-date-time-CB-LxzqT.js.map +1 -0
  130. package/dist/chunks/router-adapter-BdHZXLS3.js +23 -0
  131. package/dist/chunks/router-adapter-BdHZXLS3.js.map +1 -0
  132. package/dist/chunks/router-adapter-BybHrCNP.cjs +2 -0
  133. package/dist/chunks/router-adapter-BybHrCNP.cjs.map +1 -0
  134. package/dist/chunks/templates.module-B5bg_goX.js +8 -0
  135. package/dist/chunks/templates.module-B5bg_goX.js.map +1 -0
  136. package/dist/chunks/templates.module-ClRnQQX4.cjs +2 -0
  137. package/dist/chunks/templates.module-ClRnQQX4.cjs.map +1 -0
  138. package/dist/components/admin-pickers.d.ts +65 -0
  139. package/dist/components/app-navigation.d.ts +34 -0
  140. package/dist/components/approval-instance-list-page.d.ts +18 -0
  141. package/dist/components/bpm-form-field.d.ts +10 -0
  142. package/dist/components/dashboard-page.d.ts +10 -0
  143. package/dist/components/notification-drawer.d.ts +10 -0
  144. package/dist/components/org-unit-tree-draft-editor.d.ts +24 -0
  145. package/dist/components/pdf-preview.d.ts +12 -0
  146. package/dist/dashboard-page.css +1 -0
  147. package/dist/index.cjs +2 -0
  148. package/dist/index.cjs.map +1 -0
  149. package/dist/index.d.ts +12 -0
  150. package/dist/index.js +209 -0
  151. package/dist/index.js.map +1 -0
  152. package/dist/lib/auth-provider.d.ts +37 -0
  153. package/dist/lib/format-date-time.d.ts +5 -0
  154. package/dist/lib/notification-drawer-provider.d.ts +26 -0
  155. package/dist/lib/notification-unread-provider.d.ts +24 -0
  156. package/dist/lib/org-tree-draft.d.ts +27 -0
  157. package/dist/lib/providers.d.ts +30 -0
  158. package/dist/lib/router-adapter.d.ts +47 -0
  159. package/dist/pages/admin/delegations/AdminDelegationsClientView.cjs +2 -0
  160. package/dist/pages/admin/delegations/AdminDelegationsClientView.cjs.map +1 -0
  161. package/dist/pages/admin/delegations/AdminDelegationsClientView.d.ts +3 -0
  162. package/dist/pages/admin/delegations/AdminDelegationsClientView.js +28 -0
  163. package/dist/pages/admin/delegations/AdminDelegationsClientView.js.map +1 -0
  164. package/dist/pages/admin/delegations/index.cjs +2 -0
  165. package/dist/pages/admin/delegations/index.cjs.map +1 -0
  166. package/dist/pages/admin/delegations/index.d.ts +4 -0
  167. package/dist/pages/admin/delegations/index.js +14 -0
  168. package/dist/pages/admin/delegations/index.js.map +1 -0
  169. package/dist/pages/admin/orgs/AdminOrgsClientView.cjs +2 -0
  170. package/dist/pages/admin/orgs/AdminOrgsClientView.cjs.map +1 -0
  171. package/dist/pages/admin/orgs/AdminOrgsClientView.d.ts +3 -0
  172. package/dist/pages/admin/orgs/AdminOrgsClientView.js +28 -0
  173. package/dist/pages/admin/orgs/AdminOrgsClientView.js.map +1 -0
  174. package/dist/pages/admin/orgs/index.cjs +2 -0
  175. package/dist/pages/admin/orgs/index.cjs.map +1 -0
  176. package/dist/pages/admin/orgs/index.d.ts +4 -0
  177. package/dist/pages/admin/orgs/index.js +14 -0
  178. package/dist/pages/admin/orgs/index.js.map +1 -0
  179. package/dist/pages/admin/users/AdminUsersClientView.cjs +2 -0
  180. package/dist/pages/admin/users/AdminUsersClientView.cjs.map +1 -0
  181. package/dist/pages/admin/users/AdminUsersClientView.d.ts +3 -0
  182. package/dist/pages/admin/users/AdminUsersClientView.js +28 -0
  183. package/dist/pages/admin/users/AdminUsersClientView.js.map +1 -0
  184. package/dist/pages/admin/users/index.cjs +2 -0
  185. package/dist/pages/admin/users/index.cjs.map +1 -0
  186. package/dist/pages/admin/users/index.d.ts +4 -0
  187. package/dist/pages/admin/users/index.js +14 -0
  188. package/dist/pages/admin/users/index.js.map +1 -0
  189. package/dist/pages/cc/CcClientView.cjs +2 -0
  190. package/dist/pages/cc/CcClientView.cjs.map +1 -0
  191. package/dist/pages/cc/CcClientView.d.ts +7 -0
  192. package/dist/pages/cc/CcClientView.js +28 -0
  193. package/dist/pages/cc/CcClientView.js.map +1 -0
  194. package/dist/pages/cc/index.cjs +2 -0
  195. package/dist/pages/cc/index.cjs.map +1 -0
  196. package/dist/pages/cc/index.d.ts +16 -0
  197. package/dist/pages/cc/index.js +11 -0
  198. package/dist/pages/cc/index.js.map +1 -0
  199. package/dist/pages/dashboard/DashboardClientView.cjs +2 -0
  200. package/dist/pages/dashboard/DashboardClientView.cjs.map +1 -0
  201. package/dist/pages/dashboard/DashboardClientView.d.ts +9 -0
  202. package/dist/pages/dashboard/DashboardClientView.js +28 -0
  203. package/dist/pages/dashboard/DashboardClientView.js.map +1 -0
  204. package/dist/pages/dashboard/index.cjs +2 -0
  205. package/dist/pages/dashboard/index.cjs.map +1 -0
  206. package/dist/pages/dashboard/index.d.ts +16 -0
  207. package/dist/pages/dashboard/index.js +11 -0
  208. package/dist/pages/dashboard/index.js.map +1 -0
  209. package/dist/pages/delegations/DelegationsClientView.cjs +2 -0
  210. package/dist/pages/delegations/DelegationsClientView.cjs.map +1 -0
  211. package/dist/pages/delegations/DelegationsClientView.d.ts +3 -0
  212. package/dist/pages/delegations/DelegationsClientView.js +28 -0
  213. package/dist/pages/delegations/DelegationsClientView.js.map +1 -0
  214. package/dist/pages/delegations/index.cjs +2 -0
  215. package/dist/pages/delegations/index.cjs.map +1 -0
  216. package/dist/pages/delegations/index.d.ts +4 -0
  217. package/dist/pages/delegations/index.js +14 -0
  218. package/dist/pages/delegations/index.js.map +1 -0
  219. package/dist/pages/forms/FormsClientView.cjs +2 -0
  220. package/dist/pages/forms/FormsClientView.cjs.map +1 -0
  221. package/dist/pages/forms/FormsClientView.d.ts +10 -0
  222. package/dist/pages/forms/FormsClientView.js +28 -0
  223. package/dist/pages/forms/FormsClientView.js.map +1 -0
  224. package/dist/pages/forms/builder/FormBuilderClientView.cjs +2 -0
  225. package/dist/pages/forms/builder/FormBuilderClientView.cjs.map +1 -0
  226. package/dist/pages/forms/builder/FormBuilderClientView.d.ts +11 -0
  227. package/dist/pages/forms/builder/FormBuilderClientView.js +28 -0
  228. package/dist/pages/forms/builder/FormBuilderClientView.js.map +1 -0
  229. package/dist/pages/forms/builder/index.cjs +2 -0
  230. package/dist/pages/forms/builder/index.cjs.map +1 -0
  231. package/dist/pages/forms/builder/index.d.ts +23 -0
  232. package/dist/pages/forms/builder/index.js +15 -0
  233. package/dist/pages/forms/builder/index.js.map +1 -0
  234. package/dist/pages/forms/index.cjs +2 -0
  235. package/dist/pages/forms/index.cjs.map +1 -0
  236. package/dist/pages/forms/index.d.ts +17 -0
  237. package/dist/pages/forms/index.js +14 -0
  238. package/dist/pages/forms/index.js.map +1 -0
  239. package/dist/pages/inbox/InboxClientView.cjs +2 -0
  240. package/dist/pages/inbox/InboxClientView.cjs.map +1 -0
  241. package/dist/pages/inbox/InboxClientView.d.ts +9 -0
  242. package/dist/pages/inbox/InboxClientView.js +28 -0
  243. package/dist/pages/inbox/InboxClientView.js.map +1 -0
  244. package/dist/pages/inbox/index.cjs +2 -0
  245. package/dist/pages/inbox/index.cjs.map +1 -0
  246. package/dist/pages/inbox/index.d.ts +16 -0
  247. package/dist/pages/inbox/index.js +11 -0
  248. package/dist/pages/inbox/index.js.map +1 -0
  249. package/dist/pages/instances/detail/InstanceDetailClientView.cjs +2 -0
  250. package/dist/pages/instances/detail/InstanceDetailClientView.cjs.map +1 -0
  251. package/dist/pages/instances/detail/InstanceDetailClientView.d.ts +9 -0
  252. package/dist/pages/instances/detail/InstanceDetailClientView.js +28 -0
  253. package/dist/pages/instances/detail/InstanceDetailClientView.js.map +1 -0
  254. package/dist/pages/instances/detail/index.cjs +2 -0
  255. package/dist/pages/instances/detail/index.cjs.map +1 -0
  256. package/dist/pages/instances/detail/index.d.ts +23 -0
  257. package/dist/pages/instances/detail/index.js +12 -0
  258. package/dist/pages/instances/detail/index.js.map +1 -0
  259. package/dist/pages/instances/new/InstanceNewClientView.cjs +2 -0
  260. package/dist/pages/instances/new/InstanceNewClientView.cjs.map +1 -0
  261. package/dist/pages/instances/new/InstanceNewClientView.d.ts +8 -0
  262. package/dist/pages/instances/new/InstanceNewClientView.js +28 -0
  263. package/dist/pages/instances/new/InstanceNewClientView.js.map +1 -0
  264. package/dist/pages/instances/new/index.cjs +2 -0
  265. package/dist/pages/instances/new/index.cjs.map +1 -0
  266. package/dist/pages/instances/new/index.d.ts +16 -0
  267. package/dist/pages/instances/new/index.js +11 -0
  268. package/dist/pages/instances/new/index.js.map +1 -0
  269. package/dist/pages/login/LoginClientView.cjs +2 -0
  270. package/dist/pages/login/LoginClientView.cjs.map +1 -0
  271. package/dist/pages/login/LoginClientView.d.ts +11 -0
  272. package/dist/pages/login/LoginClientView.js +29 -0
  273. package/dist/pages/login/LoginClientView.js.map +1 -0
  274. package/dist/pages/login/index.cjs +2 -0
  275. package/dist/pages/login/index.cjs.map +1 -0
  276. package/dist/pages/login/index.d.ts +17 -0
  277. package/dist/pages/login/index.js +14 -0
  278. package/dist/pages/login/index.js.map +1 -0
  279. package/dist/pages/root/RootClientView.cjs +1 -0
  280. package/dist/pages/root/RootClientView.d.ts +8 -0
  281. package/dist/pages/root/RootClientView.js +2 -0
  282. package/dist/pages/root/index.cjs +2 -0
  283. package/dist/pages/root/index.cjs.map +1 -0
  284. package/dist/pages/root/index.d.ts +16 -0
  285. package/dist/pages/root/index.js +11 -0
  286. package/dist/pages/root/index.js.map +1 -0
  287. package/dist/pages/search/SearchClientView.cjs +2 -0
  288. package/dist/pages/search/SearchClientView.cjs.map +1 -0
  289. package/dist/pages/search/SearchClientView.d.ts +7 -0
  290. package/dist/pages/search/SearchClientView.js +28 -0
  291. package/dist/pages/search/SearchClientView.js.map +1 -0
  292. package/dist/pages/search/index.cjs +2 -0
  293. package/dist/pages/search/index.cjs.map +1 -0
  294. package/dist/pages/search/index.d.ts +16 -0
  295. package/dist/pages/search/index.js +11 -0
  296. package/dist/pages/search/index.js.map +1 -0
  297. package/dist/pages/sent/SentClientView.cjs +2 -0
  298. package/dist/pages/sent/SentClientView.cjs.map +1 -0
  299. package/dist/pages/sent/SentClientView.d.ts +7 -0
  300. package/dist/pages/sent/SentClientView.js +28 -0
  301. package/dist/pages/sent/SentClientView.js.map +1 -0
  302. package/dist/pages/sent/index.cjs +2 -0
  303. package/dist/pages/sent/index.cjs.map +1 -0
  304. package/dist/pages/sent/index.d.ts +16 -0
  305. package/dist/pages/sent/index.js +11 -0
  306. package/dist/pages/sent/index.js.map +1 -0
  307. package/dist/pages/settings/notifications/SettingsNotificationsClientView.cjs +2 -0
  308. package/dist/pages/settings/notifications/SettingsNotificationsClientView.cjs.map +1 -0
  309. package/dist/pages/settings/notifications/SettingsNotificationsClientView.d.ts +3 -0
  310. package/dist/pages/settings/notifications/SettingsNotificationsClientView.js +28 -0
  311. package/dist/pages/settings/notifications/SettingsNotificationsClientView.js.map +1 -0
  312. package/dist/pages/settings/notifications/index.cjs +2 -0
  313. package/dist/pages/settings/notifications/index.cjs.map +1 -0
  314. package/dist/pages/settings/notifications/index.d.ts +4 -0
  315. package/dist/pages/settings/notifications/index.js +14 -0
  316. package/dist/pages/settings/notifications/index.js.map +1 -0
  317. package/dist/pages/templates/TemplatesClientView.cjs +2 -0
  318. package/dist/pages/templates/TemplatesClientView.cjs.map +1 -0
  319. package/dist/pages/templates/TemplatesClientView.d.ts +3 -0
  320. package/dist/pages/templates/TemplatesClientView.js +28 -0
  321. package/dist/pages/templates/TemplatesClientView.js.map +1 -0
  322. package/dist/pages/templates/categories/TemplateCategoriesClientView.cjs +2 -0
  323. package/dist/pages/templates/categories/TemplateCategoriesClientView.cjs.map +1 -0
  324. package/dist/pages/templates/categories/TemplateCategoriesClientView.d.ts +3 -0
  325. package/dist/pages/templates/categories/TemplateCategoriesClientView.js +28 -0
  326. package/dist/pages/templates/categories/TemplateCategoriesClientView.js.map +1 -0
  327. package/dist/pages/templates/categories/index.cjs +2 -0
  328. package/dist/pages/templates/categories/index.cjs.map +1 -0
  329. package/dist/pages/templates/categories/index.d.ts +4 -0
  330. package/dist/pages/templates/categories/index.js +14 -0
  331. package/dist/pages/templates/categories/index.js.map +1 -0
  332. package/dist/pages/templates/designer/TemplateDesignerClientView.cjs +2 -0
  333. package/dist/pages/templates/designer/TemplateDesignerClientView.cjs.map +1 -0
  334. package/dist/pages/templates/designer/TemplateDesignerClientView.d.ts +3 -0
  335. package/dist/pages/templates/designer/TemplateDesignerClientView.js +28 -0
  336. package/dist/pages/templates/designer/TemplateDesignerClientView.js.map +1 -0
  337. package/dist/pages/templates/designer/index.cjs +2 -0
  338. package/dist/pages/templates/designer/index.cjs.map +1 -0
  339. package/dist/pages/templates/designer/index.d.ts +10 -0
  340. package/dist/pages/templates/designer/index.js +15 -0
  341. package/dist/pages/templates/designer/index.js.map +1 -0
  342. package/dist/pages/templates/index.cjs +2 -0
  343. package/dist/pages/templates/index.cjs.map +1 -0
  344. package/dist/pages/templates/index.d.ts +4 -0
  345. package/dist/pages/templates/index.js +14 -0
  346. package/dist/pages/templates/index.js.map +1 -0
  347. package/dist/pages/templates/versions/TemplateVersionsClientView.cjs +2 -0
  348. package/dist/pages/templates/versions/TemplateVersionsClientView.cjs.map +1 -0
  349. package/dist/pages/templates/versions/TemplateVersionsClientView.d.ts +3 -0
  350. package/dist/pages/templates/versions/TemplateVersionsClientView.js +28 -0
  351. package/dist/pages/templates/versions/TemplateVersionsClientView.js.map +1 -0
  352. package/dist/pages/templates/versions/index.cjs +2 -0
  353. package/dist/pages/templates/versions/index.cjs.map +1 -0
  354. package/dist/pages/templates/versions/index.d.ts +10 -0
  355. package/dist/pages/templates/versions/index.js +15 -0
  356. package/dist/pages/templates/versions/index.js.map +1 -0
  357. package/dist/templates.css +1 -0
  358. package/dist/views/admin/delegations/AdminDelegationsView.d.ts +5 -0
  359. package/dist/views/admin/delegations/index.cjs +1 -0
  360. package/dist/views/admin/delegations/index.d.ts +1 -0
  361. package/dist/views/admin/delegations/index.js +2 -0
  362. package/dist/views/admin/orgs/AdminOrgsView.d.ts +5 -0
  363. package/dist/views/admin/orgs/index.cjs +1 -0
  364. package/dist/views/admin/orgs/index.d.ts +1 -0
  365. package/dist/views/admin/orgs/index.js +2 -0
  366. package/dist/views/admin/users/AdminUsersView.d.ts +5 -0
  367. package/dist/views/admin/users/index.cjs +1 -0
  368. package/dist/views/admin/users/index.d.ts +1 -0
  369. package/dist/views/admin/users/index.js +2 -0
  370. package/dist/views/cc/CcView.d.ts +9 -0
  371. package/dist/views/cc/index.cjs +1 -0
  372. package/dist/views/cc/index.d.ts +1 -0
  373. package/dist/views/cc/index.js +2 -0
  374. package/dist/views/dashboard/DashboardView.d.ts +9 -0
  375. package/dist/views/dashboard/index.cjs +1 -0
  376. package/dist/views/dashboard/index.d.ts +1 -0
  377. package/dist/views/dashboard/index.js +2 -0
  378. package/dist/views/delegations/DelegationsView.d.ts +5 -0
  379. package/dist/views/delegations/index.cjs +1 -0
  380. package/dist/views/delegations/index.d.ts +1 -0
  381. package/dist/views/delegations/index.js +2 -0
  382. package/dist/views/forms/FormsView.d.ts +4 -0
  383. package/dist/views/forms/builder/FormBuilderView.d.ts +9 -0
  384. package/dist/views/forms/builder/index.cjs +1 -0
  385. package/dist/views/forms/builder/index.d.ts +1 -0
  386. package/dist/views/forms/builder/index.js +2 -0
  387. package/dist/views/forms/builder/json-code-editor.d.ts +11 -0
  388. package/dist/views/forms/form-name-modal.d.ts +12 -0
  389. package/dist/views/forms/index.cjs +1 -0
  390. package/dist/views/forms/index.d.ts +1 -0
  391. package/dist/views/forms/index.js +2 -0
  392. package/dist/views/forms/renderer/FormRendererView.d.ts +19 -0
  393. package/dist/views/forms/renderer/index.cjs +1 -0
  394. package/dist/views/forms/renderer/index.d.ts +1 -0
  395. package/dist/views/forms/renderer/index.js +2 -0
  396. package/dist/views/inbox/InboxView.d.ts +9 -0
  397. package/dist/views/inbox/index.cjs +1 -0
  398. package/dist/views/inbox/index.d.ts +1 -0
  399. package/dist/views/inbox/index.js +2 -0
  400. package/dist/views/instances/detail/InstanceDetailView.d.ts +12 -0
  401. package/dist/views/instances/detail/index.cjs +1 -0
  402. package/dist/views/instances/detail/index.d.ts +1 -0
  403. package/dist/views/instances/detail/index.js +2 -0
  404. package/dist/views/instances/new/InstanceNewView.d.ts +15 -0
  405. package/dist/views/instances/new/index.cjs +1 -0
  406. package/dist/views/instances/new/index.d.ts +1 -0
  407. package/dist/views/instances/new/index.js +2 -0
  408. package/dist/views/login/LoginView.d.ts +47 -0
  409. package/dist/views/login/index.cjs +1 -0
  410. package/dist/views/login/index.d.ts +1 -0
  411. package/dist/views/login/index.js +2 -0
  412. package/dist/views/root/RootView.d.ts +12 -0
  413. package/dist/views/root/index.d.ts +1 -0
  414. package/dist/views/search/SearchView.d.ts +9 -0
  415. package/dist/views/search/index.cjs +1 -0
  416. package/dist/views/search/index.d.ts +1 -0
  417. package/dist/views/search/index.js +2 -0
  418. package/dist/views/sent/SentView.d.ts +9 -0
  419. package/dist/views/sent/index.cjs +1 -0
  420. package/dist/views/sent/index.d.ts +1 -0
  421. package/dist/views/sent/index.js +2 -0
  422. package/dist/views/settings/notifications/SettingsNotificationsView.d.ts +5 -0
  423. package/dist/views/settings/notifications/index.cjs +1 -0
  424. package/dist/views/settings/notifications/index.d.ts +1 -0
  425. package/dist/views/settings/notifications/index.js +2 -0
  426. package/dist/views/templates/TemplatesView.d.ts +5 -0
  427. package/dist/views/templates/categories/TemplateCategoriesView.d.ts +5 -0
  428. package/dist/views/templates/categories/index.cjs +1 -0
  429. package/dist/views/templates/categories/index.d.ts +1 -0
  430. package/dist/views/templates/categories/index.js +2 -0
  431. package/dist/views/templates/designer/TemplateDesignerView.d.ts +6 -0
  432. package/dist/views/templates/designer/index.cjs +1 -0
  433. package/dist/views/templates/designer/index.d.ts +1 -0
  434. package/dist/views/templates/designer/index.js +2 -0
  435. package/dist/views/templates/index.cjs +1 -0
  436. package/dist/views/templates/index.d.ts +1 -0
  437. package/dist/views/templates/index.js +2 -0
  438. package/dist/views/templates/template-name-modal.d.ts +22 -0
  439. package/dist/views/templates/versions/TemplateVersionsView.d.ts +6 -0
  440. package/dist/views/templates/versions/index.cjs +1 -0
  441. package/dist/views/templates/versions/index.d.ts +1 -0
  442. package/dist/views/templates/versions/index.js +2 -0
  443. package/package.json +272 -0
@@ -0,0 +1,2272 @@
1
+ "use client";
2
+ import { r as e } from "./router-adapter-BdHZXLS3.js";
3
+ import { t } from "./app-navigation-CATITRM7.js";
4
+ import { a as n, n as r, o as i, r as a } from "./admin-pickers-DLlG_1du.js";
5
+ import { t as o } from "./bpm-form-field-Cao0rMol.js";
6
+ import { useCallback as s, useEffect as c, useMemo as l, useRef as ee, useState as u } from "react";
7
+ import { AutoComplete as te, Button as d, Icon as ne, Input as re, Layout as ie, Modal as ae, PageHeader as oe, Section as se, SectionGroup as ce, Select as f, Textarea as le, Toggle as ue, Typography as p } from "@mezzanine-ui/react";
8
+ import { Fragment as de, jsx as m, jsxs as h } from "react/jsx-runtime";
9
+ import { CheckedIcon as fe, DotGridIcon as pe, EyeIcon as me, FilterIcon as he, MailIcon as ge, SaveIcon as _e, TrashIcon as ve, UserIcon as ye } from "@mezzanine-ui/icons";
10
+ import be from "@mezzanine-ui/react/ContentHeader";
11
+ import { dryRunApprovalWorkflow as xe, forkApprovalTemplate as Se, publishApprovalTemplateVersion as Ce, readTemplateDesigner as we, resolveMemberOptions as Te, searchMemberOptions as Ee, searchPublishedFormVersionOptions as De, updateApprovalTemplateDraft as Oe } from "@rytass/bpm-core-client/template";
12
+ import { Background as ke, ConnectionMode as Ae, ControlButton as je, Controls as Me, Handle as g, MiniMap as Ne, Panel as _, Position as v, ReactFlow as Pe, applyNodeChanges as Fe, getViewportForBounds as Ie } from "@xyflow/react";
13
+ import * as Le from "dagre";
14
+ import { readOrganizationDashboard as Re } from "@rytass/bpm-core-client/organization";
15
+ //#region src/views/templates/designer/TemplateDesignerView.tsx
16
+ var ze = {
17
+ display: "grid",
18
+ gap: 16
19
+ }, Be = {
20
+ alignItems: "start",
21
+ display: "grid",
22
+ gap: 16,
23
+ gridTemplateColumns: "minmax(0, 1fr) 420px"
24
+ }, Ve = {
25
+ border: "1px solid var(--mzn-color-border-neutral)",
26
+ borderRadius: 6,
27
+ height: 620,
28
+ minWidth: 0,
29
+ overflow: "hidden"
30
+ }, He = {
31
+ alignItems: "center",
32
+ boxSizing: "border-box",
33
+ color: "var(--mzn-color-text-error)",
34
+ display: "flex",
35
+ height: 26,
36
+ justifyContent: "center",
37
+ lineHeight: 0,
38
+ padding: 0,
39
+ width: 26
40
+ }, Ue = {
41
+ alignItems: "center",
42
+ display: "flex",
43
+ height: "100%",
44
+ justifyContent: "center",
45
+ width: "100%"
46
+ }, We = "workflow-designer-side-panel", y = 96, Ge = `
47
+ .${We} .mzn-form-field--stretch .mzn-form-field__label-area,
48
+ .${We} .mzn-form-field--horizontal .mzn-form-field__label-area {
49
+ flex: 0 0 ${y}px;
50
+ width: ${y}px;
51
+ }
52
+
53
+ .${We} .mzn-form-field--stretch .mzn-form-field__data-entry,
54
+ .${We} .mzn-form-field--horizontal .mzn-form-field__data-entry {
55
+ min-width: 0;
56
+ }
57
+ `, Ke = "#2563eb", b = "#64748b", qe = "var(--mzn-color-text-error, #dc2626)", Je = "drop-shadow(0 0 3px rgba(0, 87, 255, 0.85)) drop-shadow(0 0 9px rgba(0, 87, 255, 0.36))", Ye = `
58
+ .workflow-selection-delete-control.react-flow__controls-button {
59
+ align-items: center !important;
60
+ display: flex !important;
61
+ height: 26px !important;
62
+ justify-content: center !important;
63
+ padding: 0 !important;
64
+ width: 26px !important;
65
+ }
66
+
67
+ .workflow-selection-delete-control .mzn-icon {
68
+ align-items: center;
69
+ display: flex;
70
+ justify-content: center;
71
+ }
72
+
73
+ .workflow-selection-delete-control .mzn-icon svg {
74
+ height: 16px !important;
75
+ max-height: none !important;
76
+ max-width: none !important;
77
+ width: 16px !important;
78
+ }
79
+
80
+ .workflow-edge--selected .react-flow__edge-path,
81
+ .react-flow__edge-path.workflow-edge--selected {
82
+ filter: ${Je};
83
+ opacity: 1 !important;
84
+ stroke: ${b} !important;
85
+ stroke-opacity: 1 !important;
86
+ stroke-width: 1.5px !important;
87
+ }
88
+
89
+ .workflow-edge--selected {
90
+ --xy-edge-stroke: ${b};
91
+ --xy-edge-stroke-selected: ${b};
92
+ --xy-edge-stroke-width: 1.5px;
93
+ }
94
+
95
+ `, Xe = {
96
+ display: "grid",
97
+ gap: 12
98
+ }, x = {
99
+ display: "grid",
100
+ gap: 12
101
+ }, Ze = {
102
+ border: "1px solid var(--mzn-color-border-neutral)",
103
+ borderRadius: 6,
104
+ display: "grid",
105
+ gap: 8,
106
+ maxHeight: 360,
107
+ overflow: "auto",
108
+ padding: 12
109
+ }, Qe = {
110
+ borderBottom: "1px solid var(--mzn-color-border-neutral)",
111
+ display: "grid",
112
+ gap: 4,
113
+ padding: "0 0 8px"
114
+ }, $e = {
115
+ display: "flex",
116
+ flexWrap: "wrap",
117
+ gap: 8
118
+ }, et = {
119
+ display: "grid",
120
+ gap: 8
121
+ }, S = {
122
+ alignContent: "center",
123
+ background: "var(--mzn-color-bg-surface)",
124
+ border: "1px solid var(--mzn-color-border-neutral)",
125
+ borderRadius: 6,
126
+ boxShadow: "0 8px 20px rgba(15, 23, 42, 0.08)",
127
+ boxSizing: "border-box",
128
+ display: "grid",
129
+ gap: 4,
130
+ height: "100%",
131
+ minWidth: 132,
132
+ overflow: "visible",
133
+ padding: "10px 12px",
134
+ textAlign: "center",
135
+ width: "100%"
136
+ }, tt = "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)", nt = 64, C = 160, w = 20, T = 64, E = 180, D = {
137
+ ...S,
138
+ display: "grid",
139
+ gap: 8,
140
+ padding: "10px 12px"
141
+ }, rt = {
142
+ ...D,
143
+ background: "#eff6ff",
144
+ border: "1px solid #2563eb"
145
+ }, O = {
146
+ ...D,
147
+ background: "#f0fdfa",
148
+ border: "1px solid #0f766e"
149
+ }, it = {
150
+ ...S,
151
+ background: "#ffffff"
152
+ }, k = {
153
+ ...S,
154
+ background: "#ecfdf3",
155
+ border: "1px solid #2f855a"
156
+ }, at = {
157
+ ...S,
158
+ background: "#fff4ed",
159
+ border: "1px solid #c2410c"
160
+ }, ot = {
161
+ display: "block",
162
+ maxWidth: "100%",
163
+ minWidth: 0
164
+ }, st = {
165
+ display: "grid",
166
+ gap: 2,
167
+ minWidth: 0
168
+ }, A = "input", j = "output", ct = {
169
+ endEvent: "結束",
170
+ exclusiveGateway: "條件分流",
171
+ parallelGateway: "並行處理",
172
+ serviceTask: "系統",
173
+ startEvent: "開始",
174
+ userTask: "簽核"
175
+ }, lt = [{
176
+ icon: ye,
177
+ label: "簽核節點",
178
+ type: "userTask"
179
+ }, {
180
+ icon: ge,
181
+ label: "知會節點",
182
+ type: "serviceTask"
183
+ }], ut = [{
184
+ icon: he,
185
+ label: "條件分流",
186
+ type: "exclusiveGateway"
187
+ }], dt = [{
188
+ id: "AND",
189
+ name: "全部前置完成"
190
+ }, {
191
+ id: "OR",
192
+ name: "任一前置完成"
193
+ }], ft = [{
194
+ id: "RESTART",
195
+ name: "重新送出後從開始重跑"
196
+ }, {
197
+ id: "FROM_RETURN_POINT",
198
+ name: "重新送出後回到退回節點"
199
+ }], pt = [
200
+ {
201
+ id: "DIRECT",
202
+ name: "指定會員"
203
+ },
204
+ {
205
+ id: "ORG_MANAGER",
206
+ name: "發起人主管"
207
+ },
208
+ {
209
+ id: "ORG_UNIT_MANAGER",
210
+ name: "指定組織主管"
211
+ },
212
+ {
213
+ id: "ORG_UNIT_MEMBER",
214
+ name: "組織任一人"
215
+ },
216
+ {
217
+ id: "ORG_UNIT_POSITION",
218
+ name: "組織特定職位"
219
+ },
220
+ {
221
+ id: "POSITION",
222
+ name: "指定職位"
223
+ }
224
+ ], M = [
225
+ {
226
+ id: "1",
227
+ name: "直屬主管",
228
+ value: 1
229
+ },
230
+ {
231
+ id: "2",
232
+ name: "第二層主管",
233
+ value: 2
234
+ },
235
+ {
236
+ id: "3",
237
+ name: "第三層主管",
238
+ value: 3
239
+ }
240
+ ], mt = [{
241
+ id: "NONE",
242
+ name: "停止流程並提示"
243
+ }, {
244
+ id: "DIRECT",
245
+ name: "固定改派"
246
+ }], ht = [
247
+ {
248
+ id: "EQUALS",
249
+ name: "等於"
250
+ },
251
+ {
252
+ id: "NOT_EQUALS",
253
+ name: "不等於"
254
+ },
255
+ {
256
+ id: "GREATER_THAN",
257
+ name: "大於"
258
+ },
259
+ {
260
+ id: "GREATER_THAN_OR_EQUALS",
261
+ name: "大於等於"
262
+ },
263
+ {
264
+ id: "LESS_THAN",
265
+ name: "小於"
266
+ },
267
+ {
268
+ id: "LESS_THAN_OR_EQUALS",
269
+ name: "小於等於"
270
+ },
271
+ {
272
+ id: "IS_FILLED",
273
+ name: "已填寫"
274
+ },
275
+ {
276
+ id: "IS_EMPTY",
277
+ name: "未填寫"
278
+ }
279
+ ], gt = [
280
+ "EQUALS",
281
+ "GREATER_THAN",
282
+ "GREATER_THAN_OR_EQUALS",
283
+ "LESS_THAN",
284
+ "LESS_THAN_OR_EQUALS",
285
+ "NOT_EQUALS"
286
+ ], _t = [
287
+ {
288
+ id: "NONE",
289
+ name: "未設定"
290
+ },
291
+ {
292
+ id: "ALL",
293
+ name: "所有人"
294
+ },
295
+ {
296
+ id: "ORG_UNIT",
297
+ name: "指定組織"
298
+ },
299
+ {
300
+ id: "ORG_UNIT_POSITION",
301
+ name: "指定組織職位"
302
+ }
303
+ ], vt = {
304
+ id: "CUSTOM",
305
+ name: "既有自訂規則"
306
+ }, yt = "member-001", bt = {
307
+ endEvent: N,
308
+ exclusiveGateway: N,
309
+ parallelGateway: N,
310
+ serviceTask: N,
311
+ startEvent: N,
312
+ userTask: N
313
+ };
314
+ function xt({ templateId: n, activeHref: i = "/templates" }) {
315
+ let pe = e(), [he, ge] = u(null), [ye, g] = u(null), [_, v] = u(Bt()), [Ie, Le] = u(""), [y, Ke] = u(null), [b, Je] = u(null), [S, tt] = u(null), [nt, C] = u(null), [w, T] = u("start"), [E, D] = u([]), [rt, O] = u(null), [it, k] = u(null), [at, ot] = u(!0), [st, A] = u(!1), [j, ht] = u(!1), [gt, xt] = u([]), N = l(() => JSON.stringify({
316
+ formDefinitionVersionId: y,
317
+ initiatorPolicyCel: b,
318
+ workflowDefinition: _
319
+ }), [
320
+ y,
321
+ b,
322
+ _
323
+ ]), Ct = !!Ie && N !== Ie, [wt, Tt] = u(!1), [P, F] = u([]), [I, Dt] = u([]), [L, Mt] = u([]), [Nt, Lt] = u([]), [Rt, zt] = u(!1), [Qt, tn] = u(!1), [rn, B] = u("{}"), [V, ln] = u(null), [pn, hn] = u(null), [H, U] = u(void 0), En = ee(null);
324
+ c(() => {
325
+ $n();
326
+ }, [n]), c(() => {
327
+ function e(e) {
328
+ Ct && (e.preventDefault(), e.returnValue = "");
329
+ }
330
+ return window.addEventListener("beforeunload", e), () => {
331
+ window.removeEventListener("beforeunload", e);
332
+ };
333
+ }, [Ct]), c(() => {
334
+ rr(_);
335
+ }, [_, P]), c(() => {
336
+ v((e) => jt(e));
337
+ }, [_.edges, _.nodes]);
338
+ function Dn() {
339
+ Ct && !window.confirm("目前有尚未儲存的流程草稿,確定要離開嗎?") || pe.push("/templates");
340
+ }
341
+ let W = l(() => _.nodes.find((e) => e.id === w) ?? null, [w, _.nodes]), On = W ? cn(W) : !1, An = E.length > 0 || On, Nn = s(() => {
342
+ let e = W && cn(W) ? W.id : null;
343
+ v((t) => ({
344
+ ...t,
345
+ edges: t.edges.filter((t) => !E.includes(t.id) && t.source !== e && t.target !== e),
346
+ nodes: e ? t.nodes.filter((t) => t.id !== e) : t.nodes
347
+ })), D([]), O(null), e && T("start");
348
+ }, [E, W]);
349
+ c(() => {
350
+ if (!An) return;
351
+ function e(e) {
352
+ e.key !== "Delete" && e.key !== "Backspace" || un(e.target) || (e.preventDefault(), Nn());
353
+ }
354
+ return window.addEventListener("keydown", e), () => {
355
+ window.removeEventListener("keydown", e);
356
+ };
357
+ }, [An, Nn]);
358
+ let Pn = l(() => _.edges.find((e) => e.id === rt) ?? null, [rt, _.edges]), Fn = l(() => E.length === 1 ? _.edges.find((e) => e.id === E[0]) ?? null : null, [E, _.edges]), In = l(() => E.map((e) => _.edges.find((t) => t.id === e) ?? null).filter((e) => !!e), [E, _.edges]), G = l(() => nt ?? $t(b, S), [
359
+ b,
360
+ nt,
361
+ S
362
+ ]), zn = l(() => _.nodes.map((e) => Et(e, P, I, L, e.id === w, G)), [
363
+ G,
364
+ P,
365
+ I,
366
+ L,
367
+ w,
368
+ _.nodes
369
+ ]), Gn = l(() => _.edges.map((e) => Ot(e, _.nodes, E.includes(e.id))), [
370
+ E,
371
+ _.edges,
372
+ _.nodes
373
+ ]), K = l(() => z(gt, y) ?? z(dn(he?.formVersions ?? []), y), [
374
+ y,
375
+ gt,
376
+ he?.formVersions
377
+ ]), Zn = l(() => vn(gt, K), [gt, K]), q = l(() => Rn(_), [_]), J = l(() => Bn(_), [_]), Y = l(() => en(G), [G]);
378
+ async function $n() {
379
+ ot(!0), k(null);
380
+ try {
381
+ let [e, t] = await Promise.all([we(n), Re()]), r = e.versions.find((e) => e.status === "DRAFT") ?? null, i = r ?? e.versions[0] ?? null;
382
+ ge(e), g(r), Dt(t.orgUnits), Mt(t.positions), Lt(t.memberships), xt(dn(e.formVersions));
383
+ let a = i?.workflowDefinition ?? Bt(), o = i?.formDefinitionVersionId ?? e.formVersions[0]?.id ?? null, s = i?.initiatorPolicyCel ?? null;
384
+ v(a), Ke(o), Je(s), Le(JSON.stringify({
385
+ formDefinitionVersionId: o,
386
+ initiatorPolicyCel: s,
387
+ workflowDefinition: a
388
+ })), tt(i && !e.template.currentVersionId && !i.initiatorPolicyCel && Vt(i.workflowDefinition) ? "NONE" : null), C(null), T(i?.workflowDefinition.nodes[0]?.id ?? "start"), D([]), O(null);
389
+ } catch (e) {
390
+ k(Q(e));
391
+ } finally {
392
+ ot(!1);
393
+ }
394
+ }
395
+ async function tr(e) {
396
+ ht(!0), k(null);
397
+ try {
398
+ xt(vn(dn(await De(e)), K));
399
+ } catch (e) {
400
+ k(Q(e));
401
+ } finally {
402
+ ht(!1);
403
+ }
404
+ }
405
+ async function Z(e) {
406
+ Tt(!0), k(null);
407
+ try {
408
+ let t = await Ee(e);
409
+ F((e) => jn(e, yn(t)));
410
+ } catch (e) {
411
+ k(Q(e));
412
+ } finally {
413
+ Tt(!1);
414
+ }
415
+ }
416
+ async function rr(e) {
417
+ let t = Mn(e).filter((e) => !P.some((t) => t.memberId === e));
418
+ if (t.length !== 0) try {
419
+ let e = await Te(t);
420
+ F((t) => jn(t, yn(e)));
421
+ } catch {
422
+ F((e) => jn(e, t.map(bn)));
423
+ }
424
+ }
425
+ async function ir() {
426
+ A(!0), k(null);
427
+ try {
428
+ let e = Rn(_), t = en(G);
429
+ if (e || t) {
430
+ let n = e ?? t ?? "流程設定未完成";
431
+ throw k(n), Error(n);
432
+ }
433
+ let r = await Oe({
434
+ formDefinitionVersionId: y,
435
+ initiatorPolicyCel: b,
436
+ versionId: (ye ?? await Se(n)).id,
437
+ workflowDefinition: _
438
+ });
439
+ return g(r), await $n(), r;
440
+ } catch (e) {
441
+ throw k(Q(e)), e;
442
+ } finally {
443
+ A(!1);
444
+ }
445
+ }
446
+ async function ar() {
447
+ A(!0), k(null);
448
+ try {
449
+ await Ce((await ir()).id), await $n();
450
+ } catch (e) {
451
+ k(Q(e));
452
+ } finally {
453
+ A(!1);
454
+ }
455
+ }
456
+ function or() {
457
+ B(JSON.stringify(fn(K), null, 2)), ln(null), hn(null), zt(!0);
458
+ }
459
+ function sr() {
460
+ Qt || zt(!1);
461
+ }
462
+ async function cr() {
463
+ tn(!0), hn(null), ln(null);
464
+ try {
465
+ ln(await xe({
466
+ formData: mn(rn),
467
+ initiatorMemberId: yt,
468
+ initiatorMetadataSnapshot: Tn(yt, Nt),
469
+ workflowDefinition: _
470
+ }));
471
+ } catch (e) {
472
+ hn(Q(e));
473
+ } finally {
474
+ tn(!1);
475
+ }
476
+ }
477
+ function lr(e) {
478
+ let t = Fe(e, zn);
479
+ v((e) => ({
480
+ ...e,
481
+ nodes: e.nodes.map((e) => {
482
+ let n = t.find((t) => t.id === e.id);
483
+ return n ? {
484
+ ...e,
485
+ position: n.position
486
+ } : e;
487
+ })
488
+ }));
489
+ }
490
+ function ur(e) {
491
+ if (!on(e, _.nodes)) return;
492
+ let t = _.nodes.some((t) => t.id === e.source && t.type === "exclusiveGateway"), n = R(e.source, e.target, {});
493
+ v((e) => ({
494
+ ...e,
495
+ edges: [...e.edges, n]
496
+ })), T(null), D([n.id]), O(t ? n.id : null);
497
+ }
498
+ function dr(e, t) {
499
+ e.stopPropagation(), D((n) => e.shiftKey || e.metaKey || e.ctrlKey ? sn(n, t.id) : [t.id]), T(null);
500
+ }
501
+ function fr() {
502
+ O(null);
503
+ }
504
+ function pr(e) {
505
+ let t = It({
506
+ definition: _,
507
+ node: Pt(e, Ft(_.nodes, e)),
508
+ selectedEdgeId: E.length === 1 ? E[0] : null,
509
+ selectedNodeId: w
510
+ }), n = Ht(t.definition), r = Ln(n, En.current);
511
+ v(n), T(t.selectedNodeId), D(t.selectedEdgeIds), O(t.editingEdgeId), r && U(r);
512
+ }
513
+ function mr(e) {
514
+ W && yr(W.id, (t) => kt(t, e));
515
+ }
516
+ function $(e) {
517
+ !W || W.type !== "userTask" || yr(W.id, (t) => t.type === "userTask" ? {
518
+ ...t,
519
+ data: {
520
+ ...t.data,
521
+ approverResolver: e,
522
+ decisionPolicy: { type: "SINGLE" }
523
+ }
524
+ } : t);
525
+ }
526
+ function hr(e) {
527
+ !W || W.type !== "userTask" || yr(W.id, (t) => t.type === "userTask" ? {
528
+ ...t,
529
+ data: {
530
+ ...t.data,
531
+ returnBehavior: {
532
+ ...t.data.returnBehavior,
533
+ resubmitStrategy: e
534
+ }
535
+ }
536
+ } : t);
537
+ }
538
+ function gr(e) {
539
+ !W || W.type !== "serviceTask" || yr(W.id, (t) => t.type === "serviceTask" ? {
540
+ ...t,
541
+ data: {
542
+ ...t.data,
543
+ action: e
544
+ }
545
+ } : t);
546
+ }
547
+ function _r(e) {
548
+ C(e.mode === "ALL" || e.mode === "CUSTOM" ? null : e), tt(e.mode === "ALL" || e.mode === "CUSTOM" ? null : e.mode), Je(nn(e, I));
549
+ }
550
+ function vr(e) {
551
+ !W || W.type === "startEvent" || yr(W.id, (t) => At(t, e));
552
+ }
553
+ function yr(e, t) {
554
+ v((n) => ({
555
+ ...n,
556
+ nodes: n.nodes.map((n) => n.id === e ? t(n) : n)
557
+ }));
558
+ }
559
+ function br(e, t) {
560
+ v((n) => ({
561
+ ...n,
562
+ edges: n.edges.map((n) => n.id === e ? t(n) : n)
563
+ }));
564
+ }
565
+ function xr(e, t) {
566
+ v((n) => {
567
+ let r = n.edges.find((t) => t.id === e);
568
+ return r ? {
569
+ ...n,
570
+ edges: n.edges.map((e) => t && e.source === r.source && e.id !== r.id && X(e, n.nodes) ? {
571
+ ...e,
572
+ data: {
573
+ ...e.data,
574
+ isDefault: !1
575
+ }
576
+ } : e.id === r.id ? {
577
+ ...e,
578
+ data: {
579
+ ...e.data,
580
+ isDefault: t
581
+ }
582
+ } : e)
583
+ } : n;
584
+ });
585
+ }
586
+ function Sr({ edgeId: e, fieldKey: t, operator: n, value: r }) {
587
+ let i = K?.schema ?? null;
588
+ br(e, (e) => {
589
+ let a = Hn(i, t ?? e.data.conditionFieldKey ?? null), o = qn(a, n ?? e.data.conditionOperator ?? null), s = Jn(a, o, r ?? e.data.conditionValue ?? null), c = Xn(a, o, s);
590
+ return {
591
+ ...e,
592
+ data: {
593
+ ...e.data,
594
+ condition: Qn(a, o, s),
595
+ conditionFieldKey: a?.fieldKey,
596
+ conditionOperator: o,
597
+ conditionValue: s,
598
+ isDefault: !1,
599
+ label: c
600
+ }
601
+ };
602
+ });
603
+ }
604
+ function Cr() {
605
+ let e = Ht(_), t = Ln(e, En.current);
606
+ v(e), t && U(t);
607
+ }
608
+ return /* @__PURE__ */ h(ie, { children: [/* @__PURE__ */ m(t, { activeHref: i }), /* @__PURE__ */ h(ie.Main, { children: [
609
+ /* @__PURE__ */ m("style", { children: Ge }),
610
+ /* @__PURE__ */ m(oe, { children: /* @__PURE__ */ h(be, {
611
+ description: `${ye ? `草稿 v${ye.version}` : "尚未建立草稿"} ·${he?.template.currentVersionId ? " 已發布版本" : " 尚未發布"}`,
612
+ onBackClick: Dn,
613
+ title: he?.template.name ?? "流程設計器",
614
+ children: [
615
+ /* @__PURE__ */ m(d, {
616
+ "aria-label": "儲存草稿",
617
+ disabled: st || !!q || !!Y,
618
+ icon: _e,
619
+ iconType: "icon-only",
620
+ onClick: () => void ir(),
621
+ variant: "base-secondary",
622
+ children: "儲存草稿"
623
+ }),
624
+ /* @__PURE__ */ m(d, {
625
+ disabled: at || !!q || !!Y,
626
+ icon: me,
627
+ iconType: "leading",
628
+ onClick: or,
629
+ variant: "base-secondary",
630
+ children: "試跑流程"
631
+ }),
632
+ /* @__PURE__ */ m(d, {
633
+ disabled: st || !ye || !!q || !!Y,
634
+ icon: fe,
635
+ iconType: "leading",
636
+ onClick: () => void ar(),
637
+ variant: "base-primary",
638
+ children: "發布版本"
639
+ })
640
+ ]
641
+ }) }),
642
+ /* @__PURE__ */ m(ce, { children: /* @__PURE__ */ m(se, { children: /* @__PURE__ */ h("div", {
643
+ style: ze,
644
+ children: [
645
+ it ? /* @__PURE__ */ m(p, {
646
+ color: "text-error",
647
+ variant: "body",
648
+ children: it
649
+ }) : null,
650
+ q ? /* @__PURE__ */ m(p, {
651
+ color: "text-error",
652
+ variant: "body",
653
+ children: q
654
+ }) : null,
655
+ Y ? /* @__PURE__ */ m(p, {
656
+ color: "text-error",
657
+ variant: "body",
658
+ children: Y
659
+ }) : null,
660
+ /* @__PURE__ */ m("div", {
661
+ style: x,
662
+ children: /* @__PURE__ */ m(o, {
663
+ hintText: J ? "已設定條件分流條件。請先移除所有條件,才能更換綁定表單版本。" : void 0,
664
+ label: "綁定表單版本",
665
+ name: "formDefinitionVersionId",
666
+ required: !0,
667
+ children: /* @__PURE__ */ m(te, {
668
+ asyncData: !0,
669
+ disabled: at || J,
670
+ disabledOptionsFilter: !0,
671
+ emptyText: "沒有符合的已發布表單版本",
672
+ isForceClearable: !!y && !J,
673
+ loading: j,
674
+ loadingText: "搜尋表單版本中...",
675
+ mode: "single",
676
+ onChange: (e) => {
677
+ J || Ke(e?.id ?? null);
678
+ },
679
+ onClear: () => {
680
+ J || Ke(null);
681
+ },
682
+ onSearch: tr,
683
+ onVisibilityChange: (e) => {
684
+ e && !J && tr("");
685
+ },
686
+ options: [...Zn],
687
+ placeholder: "選擇已發布表單版本",
688
+ searchDebounceTime: 300,
689
+ value: K
690
+ })
691
+ })
692
+ }),
693
+ /* @__PURE__ */ h("div", {
694
+ style: Be,
695
+ children: [/* @__PURE__ */ m("div", {
696
+ ref: En,
697
+ style: Ve,
698
+ children: /* @__PURE__ */ h(Pe, {
699
+ connectionMode: Ae.Strict,
700
+ edges: Gn,
701
+ fitView: !0,
702
+ isValidConnection: (e) => on(e, _.nodes),
703
+ nodeTypes: bt,
704
+ nodes: zn,
705
+ deleteKeyCode: null,
706
+ multiSelectionKeyCode: [
707
+ "Shift",
708
+ "Meta",
709
+ "Control"
710
+ ],
711
+ onConnect: ur,
712
+ onEdgeClick: dr,
713
+ onNodeClick: (e, t) => {
714
+ T(t.id), D([]);
715
+ },
716
+ onNodesChange: lr,
717
+ onPaneClick: () => {
718
+ T(null), D([]);
719
+ },
720
+ onViewportChange: U,
721
+ viewport: H,
722
+ children: [
723
+ /* @__PURE__ */ m(ke, {}),
724
+ /* @__PURE__ */ m("style", { children: Ye }),
725
+ /* @__PURE__ */ m(Me, { children: An ? /* @__PURE__ */ m(je, {
726
+ "aria-label": "刪除選取項目",
727
+ className: "workflow-selection-delete-control",
728
+ onClick: Nn,
729
+ style: He,
730
+ title: "刪除選取項目",
731
+ children: /* @__PURE__ */ m("span", {
732
+ style: Ue,
733
+ children: /* @__PURE__ */ m(ne, {
734
+ color: "error",
735
+ icon: ve,
736
+ size: 16
737
+ })
738
+ })
739
+ }) : null }),
740
+ /* @__PURE__ */ m(St, { onApplyAutoLayout: Cr }),
741
+ /* @__PURE__ */ m(Ne, {})
742
+ ]
743
+ })
744
+ }), /* @__PURE__ */ h("div", {
745
+ className: We,
746
+ style: Xe,
747
+ children: [
748
+ /* @__PURE__ */ m(p, {
749
+ component: "h2",
750
+ variant: "h3",
751
+ children: "流程工具"
752
+ }),
753
+ /* @__PURE__ */ h("div", {
754
+ style: et,
755
+ children: [/* @__PURE__ */ m(p, {
756
+ color: "text-neutral",
757
+ variant: "caption",
758
+ children: "動作節點"
759
+ }), /* @__PURE__ */ m("div", {
760
+ style: $e,
761
+ children: lt.map((e) => /* @__PURE__ */ m(d, {
762
+ icon: e.icon,
763
+ iconType: "leading",
764
+ onClick: () => pr(e.type),
765
+ size: "sub",
766
+ variant: "base-secondary",
767
+ children: e.label
768
+ }, e.type))
769
+ })]
770
+ }),
771
+ /* @__PURE__ */ h("div", {
772
+ style: et,
773
+ children: [/* @__PURE__ */ m(p, {
774
+ color: "text-neutral",
775
+ variant: "caption",
776
+ children: "流程控制"
777
+ }), /* @__PURE__ */ m("div", {
778
+ style: $e,
779
+ children: ut.map((e) => /* @__PURE__ */ m(d, {
780
+ icon: e.icon,
781
+ iconType: "leading",
782
+ onClick: () => pr(e.type),
783
+ size: "sub",
784
+ variant: "base-secondary",
785
+ children: e.label
786
+ }, e.type))
787
+ })]
788
+ }),
789
+ In.length > 1 ? Ar(In) : null,
790
+ In.length === 1 && Fn ? jr(Fn) : null,
791
+ In.length === 0 && W ? Tr(W) : null
792
+ ]
793
+ })]
794
+ })
795
+ ]
796
+ }) }) }),
797
+ Mr(Pn),
798
+ wr()
799
+ ] })] });
800
+ function wr() {
801
+ return /* @__PURE__ */ m(ae, {
802
+ cancelText: "關閉",
803
+ confirmText: "執行試跑",
804
+ loading: Qt,
805
+ modalType: "standard",
806
+ onCancel: sr,
807
+ onClose: sr,
808
+ onConfirm: () => void cr(),
809
+ open: Rt,
810
+ showModalFooter: !0,
811
+ showModalHeader: !0,
812
+ size: "wide",
813
+ supportingText: `使用 ${yt} 與範例表單資料模擬目前畫布流程,不會建立案件。`,
814
+ title: "試跑流程",
815
+ children: /* @__PURE__ */ h("div", {
816
+ style: x,
817
+ children: [
818
+ /* @__PURE__ */ m(o, {
819
+ label: "表單資料 JSON",
820
+ name: "dryRunFormDataJson",
821
+ required: !0,
822
+ children: /* @__PURE__ */ m(le, {
823
+ onChange: (e) => B(e.target.value),
824
+ resize: "vertical",
825
+ rows: 8,
826
+ value: rn
827
+ })
828
+ }),
829
+ pn ? /* @__PURE__ */ m(p, {
830
+ color: "text-error",
831
+ variant: "body",
832
+ children: pn
833
+ }) : null,
834
+ V ? /* @__PURE__ */ h("div", {
835
+ style: Ze,
836
+ children: [
837
+ /* @__PURE__ */ m(p, {
838
+ color: V.valid ? "text-success" : "text-error",
839
+ variant: "label-primary-highlight",
840
+ children: V.valid ? "試跑通過" : "試跑失敗"
841
+ }),
842
+ V.errors.map((e) => /* @__PURE__ */ m(p, {
843
+ color: "text-error",
844
+ variant: "body",
845
+ children: e
846
+ }, e)),
847
+ V.steps.map((e) => /* @__PURE__ */ h("div", {
848
+ style: Qe,
849
+ children: [
850
+ /* @__PURE__ */ h(p, {
851
+ variant: "label-primary-highlight",
852
+ children: [
853
+ e.nodeLabel,
854
+ " · ",
855
+ gn(e.status)
856
+ ]
857
+ }),
858
+ /* @__PURE__ */ h(p, {
859
+ color: "text-neutral",
860
+ variant: "caption",
861
+ children: [
862
+ _n(e.nodeType),
863
+ e.assigneeMemberId ? ` · 處理者:${e.assigneeMemberId}` : "",
864
+ e.edgeLabel ? ` · 來源線段:${e.edgeLabel}` : ""
865
+ ]
866
+ }),
867
+ e.edgeReason ? /* @__PURE__ */ m(p, {
868
+ color: "text-neutral",
869
+ variant: "caption",
870
+ children: e.edgeReason
871
+ }) : null,
872
+ e.entryCondition ? /* @__PURE__ */ h(p, {
873
+ color: "text-neutral",
874
+ variant: "caption",
875
+ children: [
876
+ "進入條件:",
877
+ e.entryConditionMatched ? "符合" : "不符合",
878
+ " ·",
879
+ " ",
880
+ e.entryCondition
881
+ ]
882
+ }) : null,
883
+ /* @__PURE__ */ m(p, {
884
+ color: "text-neutral",
885
+ variant: "body",
886
+ children: e.message
887
+ })
888
+ ]
889
+ }, e.id))
890
+ ]
891
+ }) : null
892
+ ]
893
+ })
894
+ });
895
+ }
896
+ function Tr(e) {
897
+ return /* @__PURE__ */ h("div", {
898
+ style: x,
899
+ children: [
900
+ /* @__PURE__ */ m(p, {
901
+ component: "h2",
902
+ variant: "h3",
903
+ children: "節點屬性"
904
+ }),
905
+ /* @__PURE__ */ h(p, {
906
+ color: "text-neutral",
907
+ variant: "body",
908
+ children: [
909
+ ct[e.type],
910
+ " · ",
911
+ e.id
912
+ ]
913
+ }),
914
+ /* @__PURE__ */ m(o, {
915
+ label: "顯示名稱",
916
+ name: "nodeLabel",
917
+ required: !0,
918
+ children: /* @__PURE__ */ m(re, {
919
+ onChange: (e) => mr(e.target.value),
920
+ value: e.data.label,
921
+ variant: "base"
922
+ })
923
+ }),
924
+ e.type === "startEvent" ? Er() : null,
925
+ e.type === "startEvent" ? null : Dr(e),
926
+ e.type === "userTask" ? Or(e) : null,
927
+ e.type === "serviceTask" ? kr(e) : null
928
+ ]
929
+ });
930
+ }
931
+ function Er() {
932
+ let e = G.mode === "CUSTOM" ? [..._t, vt] : [..._t], t = G.mode === "ORG_UNIT" || G.mode === "ORG_UNIT_POSITION" ? Cn(I, G.orgUnitId ?? "") : null, n = G.mode === "ORG_UNIT_POSITION" ? wn(L, G.positionId ?? "") : null, i = G.mode === "ORG_UNIT_POSITION" ? kn({
933
+ includeDescendants: !!G.includeDescendants,
934
+ memberships: Nt,
935
+ orgUnitId: G.orgUnitId ?? "",
936
+ orgUnits: I,
937
+ positions: L
938
+ }) : [];
939
+ return /* @__PURE__ */ h(de, { children: [
940
+ /* @__PURE__ */ m(o, {
941
+ hintText: G.mode === "CUSTOM" ? "這是舊版表達式規則;切換成標準選項後會改由 UI 管理。" : void 0,
942
+ label: "發起權限",
943
+ name: "initiatorPolicyMode",
944
+ required: !0,
945
+ children: /* @__PURE__ */ m(f, {
946
+ clearable: !1,
947
+ onChange: (e) => {
948
+ if (e?.id === "CUSTOM") {
949
+ tt(null), C(null);
950
+ return;
951
+ }
952
+ let t = Zt(e?.id ?? null), n = an(t);
953
+ tt(t === "ALL" ? null : t), C(t === "ALL" ? null : n), Je(nn(n, I));
954
+ },
955
+ options: e,
956
+ placeholder: "選擇誰可以發起",
957
+ value: z(e, G.mode)
958
+ })
959
+ }),
960
+ G.mode === "ORG_UNIT" || G.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ m(o, {
961
+ label: "組織",
962
+ name: "initiatorOrgUnitId",
963
+ required: !0,
964
+ children: /* @__PURE__ */ m(r, {
965
+ name: "initiatorOrgUnitId",
966
+ onChange: (e) => _r({
967
+ ...G,
968
+ orgUnitId: e?.id ?? "",
969
+ positionId: "",
970
+ value: e?.id ?? ""
971
+ }),
972
+ orgUnits: I,
973
+ placeholder: "選擇組織",
974
+ value: t
975
+ })
976
+ }) : null,
977
+ G.mode === "ORG_UNIT" || G.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ m(o, {
978
+ label: "包含下層",
979
+ name: "initiatorIncludeDescendants",
980
+ children: /* @__PURE__ */ m(ue, {
981
+ checked: !!G.includeDescendants,
982
+ onChange: (e) => _r({
983
+ ...G,
984
+ includeDescendants: e.target.checked,
985
+ ...G.mode === "ORG_UNIT_POSITION" ? { positionId: "" } : {}
986
+ })
987
+ })
988
+ }) : null,
989
+ G.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ m(o, {
990
+ label: "職位",
991
+ name: "initiatorPositionId",
992
+ required: !0,
993
+ children: /* @__PURE__ */ m(a, {
994
+ disabled: !G.orgUnitId?.trim(),
995
+ name: "initiatorPositionId",
996
+ onChange: (e) => _r({
997
+ ...G,
998
+ positionId: e?.id ?? ""
999
+ }),
1000
+ placeholder: G.orgUnitId?.trim() ? "選擇職位" : "請先選擇組織",
1001
+ positions: i,
1002
+ value: n
1003
+ })
1004
+ }) : null
1005
+ ] });
1006
+ }
1007
+ function Dr(e) {
1008
+ let t = _.edges.filter((t) => t.target === e.id).length, n = t < 2, r = n ? "AND" : e.data.triggerMode ?? "AND";
1009
+ return /* @__PURE__ */ m(o, {
1010
+ hintText: n ? "需要至少兩條前置連線,才可切換為任一前置完成。" : t > 1 ? `${t} 條前置連線會依此規則觸發。` : "只有一條前置連線時,兩種設定效果相同。",
1011
+ label: "前置條件",
1012
+ name: "triggerMode",
1013
+ required: !0,
1014
+ children: /* @__PURE__ */ m(f, {
1015
+ clearable: !1,
1016
+ onChange: (e) => n ? void 0 : vr(Ut(e?.id ?? null)),
1017
+ options: [...dt],
1018
+ readOnly: n,
1019
+ value: z(dt, r)
1020
+ })
1021
+ });
1022
+ }
1023
+ function Or(e) {
1024
+ let t = e.data.approverResolver, n = Gt(t.type), i = t.type === "DIRECT" ? Sn(t.memberIds, P) : null, s = t.type === "ORG_UNIT_MANAGER" || t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? Cn(I, t.orgUnitId) : null, c = t.type === "POSITION" || t.type === "ORG_UNIT_POSITION" ? wn(L, t.positionId) : null, l = t.type === "ORG_UNIT_POSITION" ? kn({
1025
+ includeDescendants: !!t.includeDescendants,
1026
+ memberships: Nt,
1027
+ orgUnitId: t.orgUnitId,
1028
+ orgUnits: I,
1029
+ positions: L
1030
+ }) : [], ee = t.type === "ORG_MANAGER" ? Yt(t.levelsUp) : M[0], u = t.type === "ORG_MANAGER" || t.type === "ORG_UNIT_MANAGER" ? t.fallback ?? { type: "NONE" } : { type: "NONE" }, d = u.type === "DIRECT" ? xn(P, u.memberId) : null, ne = e.data.returnBehavior.resubmitStrategy ?? "RESTART";
1031
+ return /* @__PURE__ */ h(de, { children: [
1032
+ /* @__PURE__ */ m(o, {
1033
+ label: "簽核來源",
1034
+ name: "approverResolverType",
1035
+ required: !0,
1036
+ children: /* @__PURE__ */ m(f, {
1037
+ clearable: !1,
1038
+ onChange: (e) => $(Kt(e?.id ?? null)),
1039
+ options: [...pt],
1040
+ value: z(pt, n)
1041
+ })
1042
+ }),
1043
+ t.type === "DIRECT" ? /* @__PURE__ */ m(o, {
1044
+ label: "簽核者",
1045
+ name: "memberId",
1046
+ required: !0,
1047
+ children: /* @__PURE__ */ m(te, {
1048
+ asyncData: !0,
1049
+ disabledOptionsFilter: !0,
1050
+ emptyText: "沒有符合的成員",
1051
+ inputProps: {
1052
+ autoCapitalize: "none",
1053
+ autoCorrect: "off",
1054
+ name: "workflow-approver-search",
1055
+ spellCheck: !1
1056
+ },
1057
+ loading: wt,
1058
+ loadingText: "搜尋成員中...",
1059
+ mode: "single",
1060
+ onChange: (e) => $({
1061
+ memberIds: e?.id ? [e.id] : [],
1062
+ type: "DIRECT"
1063
+ }),
1064
+ onSearch: Z,
1065
+ onVisibilityChange: (e) => {
1066
+ e && Z("");
1067
+ },
1068
+ options: [...P],
1069
+ placeholder: "搜尋姓名或信箱",
1070
+ searchDebounceTime: 300,
1071
+ value: i
1072
+ })
1073
+ }) : null,
1074
+ t.type === "ORG_MANAGER" ? /* @__PURE__ */ m(o, {
1075
+ hintText: "依發起人的有效會員歸屬與主管解析規則決定簽核人。",
1076
+ label: "主管層級",
1077
+ name: "managerLevelsUp",
1078
+ required: !0,
1079
+ children: /* @__PURE__ */ m(f, {
1080
+ clearable: !1,
1081
+ onChange: (e) => $({
1082
+ baseFromInitiator: !0,
1083
+ levelsUp: Xt(e?.id ?? null).value,
1084
+ type: "ORG_MANAGER"
1085
+ }),
1086
+ options: [...M],
1087
+ value: ee
1088
+ })
1089
+ }) : null,
1090
+ t.type === "ORG_UNIT_MANAGER" || t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ m(o, {
1091
+ hintText: t.type === "ORG_UNIT_MANAGER" ? "依指定組織或其上層的主管解析規則決定簽核人。" : "依指定組織目前有效會員歸屬建立候選簽核人。",
1092
+ label: "組織",
1093
+ name: "orgUnitId",
1094
+ required: !0,
1095
+ children: /* @__PURE__ */ m(r, {
1096
+ name: "orgUnitId",
1097
+ onChange: (e) => $(t.type === "ORG_UNIT_MEMBER" ? {
1098
+ includeDescendants: t.includeDescendants,
1099
+ orgUnitId: e?.id ?? "",
1100
+ type: "ORG_UNIT_MEMBER"
1101
+ } : t.type === "ORG_UNIT_POSITION" ? {
1102
+ includeDescendants: t.includeDescendants,
1103
+ orgUnitId: e?.id ?? "",
1104
+ positionId: "",
1105
+ type: "ORG_UNIT_POSITION"
1106
+ } : {
1107
+ fallback: t.fallback,
1108
+ orgUnitId: e?.id ?? "",
1109
+ type: "ORG_UNIT_MANAGER"
1110
+ }),
1111
+ orgUnits: I,
1112
+ placeholder: "選擇組織",
1113
+ value: s
1114
+ })
1115
+ }) : null,
1116
+ t.type === "ORG_MANAGER" || t.type === "ORG_UNIT_MANAGER" ? /* @__PURE__ */ h(de, { children: [/* @__PURE__ */ m(o, {
1117
+ hintText: "預設會停止流程並提示;若設定固定人,找不到主管時會改派給該會員。",
1118
+ label: "無主管時",
1119
+ name: "approverFallbackMode",
1120
+ required: !0,
1121
+ children: /* @__PURE__ */ m(f, {
1122
+ clearable: !1,
1123
+ onChange: (e) => $(Jt(t, qt(e?.id ?? null) === "DIRECT" ? {
1124
+ memberId: "",
1125
+ type: "DIRECT"
1126
+ } : { type: "NONE" })),
1127
+ options: [...mt],
1128
+ value: z(mt, u.type)
1129
+ })
1130
+ }), u.type === "DIRECT" ? /* @__PURE__ */ h(de, { children: [/* @__PURE__ */ m(o, {
1131
+ label: "改派人員",
1132
+ name: "approverFallbackMemberId",
1133
+ required: !0,
1134
+ children: /* @__PURE__ */ m(te, {
1135
+ asyncData: !0,
1136
+ disabledOptionsFilter: !0,
1137
+ emptyText: "沒有符合的成員",
1138
+ inputProps: {
1139
+ autoCapitalize: "none",
1140
+ autoCorrect: "off",
1141
+ name: "workflow-approver-fallback-search",
1142
+ spellCheck: !1
1143
+ },
1144
+ loading: wt,
1145
+ loadingText: "搜尋成員中...",
1146
+ mode: "single",
1147
+ onChange: (e) => $(Jt(t, {
1148
+ allowInitiatorSelfApproval: u.allowInitiatorSelfApproval,
1149
+ memberId: e?.id ?? "",
1150
+ type: "DIRECT"
1151
+ })),
1152
+ onSearch: Z,
1153
+ onVisibilityChange: (e) => {
1154
+ e && Z("");
1155
+ },
1156
+ options: [...P],
1157
+ placeholder: "搜尋姓名或信箱",
1158
+ searchDebounceTime: 300,
1159
+ value: d
1160
+ })
1161
+ }), /* @__PURE__ */ m(o, {
1162
+ hintText: "預設禁止申請人簽自己的案件;只有此流程允許自簽時才開啟。",
1163
+ label: "允許自簽",
1164
+ name: "allowInitiatorSelfApproval",
1165
+ children: /* @__PURE__ */ m(ue, {
1166
+ checked: !!u.allowInitiatorSelfApproval,
1167
+ onChange: (e) => $(Jt(t, {
1168
+ allowInitiatorSelfApproval: e.target.checked,
1169
+ memberId: u.memberId,
1170
+ type: "DIRECT"
1171
+ }))
1172
+ })
1173
+ })] }) : null] }) : null,
1174
+ t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ m(o, {
1175
+ label: "包含下層",
1176
+ name: "includeDescendants",
1177
+ children: /* @__PURE__ */ m(ue, {
1178
+ checked: !!t.includeDescendants,
1179
+ onChange: (e) => $({
1180
+ ...t,
1181
+ includeDescendants: e.target.checked,
1182
+ ...t.type === "ORG_UNIT_POSITION" ? { positionId: "" } : {}
1183
+ })
1184
+ })
1185
+ }) : null,
1186
+ t.type === "POSITION" ? /* @__PURE__ */ m(o, {
1187
+ hintText: "指派給目前有效歸屬中擁有此職位的會員;主要歸屬優先。",
1188
+ label: "職位",
1189
+ name: "positionId",
1190
+ required: !0,
1191
+ children: /* @__PURE__ */ m(a, {
1192
+ name: "positionId",
1193
+ onChange: (e) => $({
1194
+ positionId: e?.id ?? "",
1195
+ type: "POSITION"
1196
+ }),
1197
+ placeholder: "選擇職位",
1198
+ positions: L,
1199
+ value: c
1200
+ })
1201
+ }) : null,
1202
+ t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ m(o, {
1203
+ hintText: "只納入指定組織範圍內擁有此職位的有效會員。",
1204
+ label: "職位",
1205
+ name: "orgUnitPositionId",
1206
+ required: !0,
1207
+ children: /* @__PURE__ */ m(a, {
1208
+ disabled: !t.orgUnitId.trim(),
1209
+ name: "orgUnitPositionId",
1210
+ onChange: (e) => $({
1211
+ includeDescendants: t.includeDescendants,
1212
+ orgUnitId: t.orgUnitId,
1213
+ positionId: e?.id ?? "",
1214
+ type: "ORG_UNIT_POSITION"
1215
+ }),
1216
+ placeholder: t.orgUnitId.trim() ? "選擇職位" : "請先選擇組織",
1217
+ positions: l,
1218
+ value: c
1219
+ })
1220
+ }) : null,
1221
+ e.data.returnBehavior.allowReturn ? /* @__PURE__ */ m(o, {
1222
+ hintText: "退回發起人後,重新送出時要從流程開始重跑,或直接回到退回的簽核節點。",
1223
+ label: "重送策略",
1224
+ name: "returnResubmitStrategy",
1225
+ required: !0,
1226
+ children: /* @__PURE__ */ m(f, {
1227
+ clearable: !1,
1228
+ onChange: (e) => hr(Wt(e?.id ?? null)),
1229
+ options: [...ft],
1230
+ value: z(ft, ne)
1231
+ })
1232
+ }) : null
1233
+ ] });
1234
+ }
1235
+ function kr(e) {
1236
+ let t = nr(e.data.action).map((e) => xn(P, e));
1237
+ return /* @__PURE__ */ m(o, {
1238
+ label: "知會對象",
1239
+ name: "notifyMemberIds",
1240
+ required: !0,
1241
+ children: /* @__PURE__ */ m(te, {
1242
+ asyncData: !0,
1243
+ disabledOptionsFilter: !0,
1244
+ emptyText: "沒有符合的成員",
1245
+ loading: wt,
1246
+ loadingText: "搜尋成員中...",
1247
+ mode: "multiple",
1248
+ onChange: (e) => gr({
1249
+ channels: ["IN_APP"],
1250
+ recipients: {
1251
+ memberIds: e.map((e) => e.id),
1252
+ type: "DIRECT"
1253
+ },
1254
+ type: "NOTIFY"
1255
+ }),
1256
+ onSearch: Z,
1257
+ onVisibilityChange: (e) => {
1258
+ e && Z("");
1259
+ },
1260
+ options: [...P],
1261
+ overflowStrategy: "wrap",
1262
+ placeholder: "搜尋姓名或信箱",
1263
+ searchDebounceTime: 300,
1264
+ value: [...t]
1265
+ })
1266
+ });
1267
+ }
1268
+ function Ar(e) {
1269
+ return /* @__PURE__ */ h("div", {
1270
+ style: x,
1271
+ children: [/* @__PURE__ */ m(p, {
1272
+ component: "h2",
1273
+ variant: "h3",
1274
+ children: "已選取線段"
1275
+ }), /* @__PURE__ */ h(p, {
1276
+ color: "text-neutral",
1277
+ variant: "body",
1278
+ children: [
1279
+ "已選取 ",
1280
+ e.length,
1281
+ " 條線段,可使用 Delete 或控制面板刪除。"
1282
+ ]
1283
+ })]
1284
+ });
1285
+ }
1286
+ function jr(e) {
1287
+ let t = X(e, _.nodes);
1288
+ return /* @__PURE__ */ h("div", {
1289
+ style: x,
1290
+ children: [
1291
+ /* @__PURE__ */ m(p, {
1292
+ component: "h2",
1293
+ variant: "h3",
1294
+ children: t ? "條件設定" : "線段屬性"
1295
+ }),
1296
+ /* @__PURE__ */ h(p, {
1297
+ color: "text-neutral",
1298
+ variant: "body",
1299
+ children: [
1300
+ e.source,
1301
+ " → ",
1302
+ e.target
1303
+ ]
1304
+ }),
1305
+ t ? Nr(e) : /* @__PURE__ */ m(p, {
1306
+ color: "text-neutral",
1307
+ variant: "body",
1308
+ children: "這條線會直接把流程送到下一個節點。"
1309
+ })
1310
+ ]
1311
+ });
1312
+ }
1313
+ function Mr(e) {
1314
+ return !e || !X(e, _.nodes) ? null : /* @__PURE__ */ m(ae, {
1315
+ cancelText: "取消",
1316
+ confirmButtonProps: { disabled: !e.data.isDefault && !e.data.condition },
1317
+ confirmText: "完成",
1318
+ modalType: "standard",
1319
+ onCancel: fr,
1320
+ onClose: fr,
1321
+ onConfirm: fr,
1322
+ open: !!rt,
1323
+ showModalFooter: !0,
1324
+ showModalHeader: !0,
1325
+ size: "regular",
1326
+ supportingText: "條件分流的輸出連線需要指定條件,條件會直接顯示在線上。",
1327
+ title: "條件設定",
1328
+ children: Nr(e)
1329
+ });
1330
+ }
1331
+ function Nr(e) {
1332
+ let t = er(e, _.nodes), n = Vn(K?.schema ?? null), r = Hn(K?.schema ?? null, e.data.conditionFieldKey ?? null), i = Un(r), a = Kn(r), s = z(i, e.data.conditionOperator ?? null);
1333
+ return /* @__PURE__ */ h("div", {
1334
+ style: x,
1335
+ children: [
1336
+ /* @__PURE__ */ h(p, {
1337
+ color: "text-neutral",
1338
+ variant: "body",
1339
+ children: [
1340
+ "畫布上的這條線目前會顯示「",
1341
+ /* @__PURE__ */ m("span", {
1342
+ style: { color: !e.data.isDefault && !e.data.condition ? qe : void 0 },
1343
+ children: t ?? "請設定條件"
1344
+ }),
1345
+ "」。"
1346
+ ]
1347
+ }),
1348
+ /* @__PURE__ */ m(ue, {
1349
+ checked: !!e.data.isDefault,
1350
+ label: "其他情況走這條",
1351
+ onChange: (t) => xr(e.id, t.target.checked)
1352
+ }),
1353
+ e.data.isDefault ? /* @__PURE__ */ m(p, {
1354
+ color: "text-neutral",
1355
+ variant: "body",
1356
+ children: "其他條件都不符合時,流程會走這條線。"
1357
+ }) : /* @__PURE__ */ h(de, { children: [
1358
+ K ? null : /* @__PURE__ */ m(p, {
1359
+ color: "text-neutral",
1360
+ variant: "body",
1361
+ children: "請先綁定表單版本,才能選擇條件欄位。"
1362
+ }),
1363
+ /* @__PURE__ */ m(o, {
1364
+ label: "條件欄位",
1365
+ name: "edgeConditionField",
1366
+ required: !0,
1367
+ children: /* @__PURE__ */ m(f, {
1368
+ clearable: !1,
1369
+ onChange: (t) => Sr({
1370
+ edgeId: e.id,
1371
+ fieldKey: t?.id ?? null,
1372
+ operator: null,
1373
+ value: null
1374
+ }),
1375
+ options: [...n],
1376
+ placeholder: "選擇條件欄位",
1377
+ value: z(n, e.data.conditionFieldKey ?? null)
1378
+ })
1379
+ }),
1380
+ /* @__PURE__ */ m(o, {
1381
+ label: "條件判斷",
1382
+ name: "edgeConditionOperator",
1383
+ required: !0,
1384
+ children: /* @__PURE__ */ m(f, {
1385
+ clearable: !1,
1386
+ onChange: (t) => Sr({
1387
+ edgeId: e.id,
1388
+ operator: Wn(t?.id ?? null),
1389
+ value: null
1390
+ }),
1391
+ options: [...i],
1392
+ placeholder: "選擇判斷方式",
1393
+ value: s
1394
+ })
1395
+ }),
1396
+ s && Yn(s.id) ? /* @__PURE__ */ m(o, {
1397
+ label: "條件值",
1398
+ name: "edgeConditionValue",
1399
+ required: !0,
1400
+ children: a.length > 0 ? /* @__PURE__ */ m(f, {
1401
+ clearable: !1,
1402
+ onChange: (t) => Sr({
1403
+ edgeId: e.id,
1404
+ value: t?.id ?? null
1405
+ }),
1406
+ options: [...a],
1407
+ placeholder: "選擇條件值",
1408
+ value: z(a, e.data.conditionValue ?? null)
1409
+ }) : /* @__PURE__ */ m(re, {
1410
+ onChange: (t) => Sr({
1411
+ edgeId: e.id,
1412
+ value: t.target.value
1413
+ }),
1414
+ placeholder: "輸入要比對的值",
1415
+ value: e.data.conditionValue ?? "",
1416
+ variant: "base"
1417
+ })
1418
+ }) : null
1419
+ ] })
1420
+ ]
1421
+ });
1422
+ }
1423
+ }
1424
+ function St({ onApplyAutoLayout: e }) {
1425
+ function t() {
1426
+ e();
1427
+ }
1428
+ return /* @__PURE__ */ m(_, {
1429
+ position: "top-right",
1430
+ children: /* @__PURE__ */ m(d, {
1431
+ icon: pe,
1432
+ iconType: "leading",
1433
+ onClick: t,
1434
+ size: "sub",
1435
+ variant: "base-secondary",
1436
+ children: "自動排版"
1437
+ })
1438
+ });
1439
+ }
1440
+ function N({ data: e, selected: t, type: n }) {
1441
+ let r = e.approverLines ?? [e.approverSummary ?? e.label], i = Ct(e);
1442
+ return /* @__PURE__ */ h("div", {
1443
+ style: wt(n, t),
1444
+ children: [
1445
+ P(e),
1446
+ /* @__PURE__ */ m("div", {
1447
+ style: st,
1448
+ children: r.map((e, t) => /* @__PURE__ */ m(p, {
1449
+ component: "span",
1450
+ ellipsis: !0,
1451
+ style: ot,
1452
+ title: e,
1453
+ variant: "label-primary",
1454
+ children: e
1455
+ }, `${e}_${t}`))
1456
+ }),
1457
+ /* @__PURE__ */ m(p, {
1458
+ color: "text-neutral",
1459
+ component: "span",
1460
+ ellipsis: !0,
1461
+ style: ot,
1462
+ title: i,
1463
+ variant: "caption",
1464
+ children: i
1465
+ })
1466
+ ]
1467
+ });
1468
+ }
1469
+ function Ct(e) {
1470
+ return e.nodeKind === "startEvent" ? e.initiatorPolicySummary ?? "所有人" : e.approverSummary || e.approverLines ? e.label : e.nodeKind === "exclusiveGateway" ? "條件在線上" : e.nodeKind === "parallelGateway" ? "多條路徑同時進行" : ct[e.nodeKind];
1471
+ }
1472
+ function wt(e, t) {
1473
+ let n = Tt(e);
1474
+ return t ? {
1475
+ ...n,
1476
+ border: "1px solid var(--mzn-color-primary, #0057ff)",
1477
+ boxShadow: tt
1478
+ } : n;
1479
+ }
1480
+ function Tt(e) {
1481
+ return e === "exclusiveGateway" ? rt : e === "parallelGateway" ? O : e === "startEvent" ? k : e === "endEvent" ? at : e === "userTask" ? it : S;
1482
+ }
1483
+ function P(e) {
1484
+ return !e.hasInput && e.hasOutput ? /* @__PURE__ */ m(g, {
1485
+ id: j,
1486
+ position: v.Right,
1487
+ type: "source"
1488
+ }) : e.hasInput && !e.hasOutput ? /* @__PURE__ */ m(g, {
1489
+ id: A,
1490
+ position: v.Left,
1491
+ type: "target"
1492
+ }) : !e.hasInput && !e.hasOutput ? null : [/* @__PURE__ */ m(g, {
1493
+ id: A,
1494
+ position: v.Left,
1495
+ type: "target"
1496
+ }, "target"), /* @__PURE__ */ m(g, {
1497
+ id: j,
1498
+ position: v.Right,
1499
+ type: "source"
1500
+ }, "source")];
1501
+ }
1502
+ function Et(e, t, n, r, i, a) {
1503
+ let o = F(e);
1504
+ return {
1505
+ data: {
1506
+ approverLines: Fn(e, t),
1507
+ approverSummary: Nn(e, t, n, r),
1508
+ hasInput: B(e),
1509
+ hasOutput: V(e),
1510
+ initiatorPolicySummary: e.type === "startEvent" ? rn(a, n, r) : null,
1511
+ label: e.data.label,
1512
+ nodeKind: e.type
1513
+ },
1514
+ height: o.height,
1515
+ handles: I(e),
1516
+ id: e.id,
1517
+ initialHeight: o.height,
1518
+ initialWidth: o.width,
1519
+ position: e.position,
1520
+ selected: i,
1521
+ sourcePosition: v.Right,
1522
+ targetPosition: v.Left,
1523
+ type: e.type,
1524
+ width: o.width
1525
+ };
1526
+ }
1527
+ function F(e) {
1528
+ return e.type === "exclusiveGateway" || e.type === "parallelGateway" ? {
1529
+ height: T,
1530
+ width: E
1531
+ } : e.type === "serviceTask" ? {
1532
+ height: nt + (Math.max(1, nr(e.data.action).length) - 1) * w,
1533
+ width: C
1534
+ } : {
1535
+ height: nt,
1536
+ width: C
1537
+ };
1538
+ }
1539
+ function I(e) {
1540
+ let t = F(e);
1541
+ return [...B(e) ? [Dt(t)] : [], ...V(e) ? [L(t)] : []];
1542
+ }
1543
+ function Dt({ height: e }) {
1544
+ let t = e / 2 - 9 / 2;
1545
+ return {
1546
+ height: 9,
1547
+ id: A,
1548
+ position: v.Left,
1549
+ type: "target",
1550
+ width: 9,
1551
+ x: -9 / 2,
1552
+ y: t
1553
+ };
1554
+ }
1555
+ function L({ height: e, width: t }) {
1556
+ let n = e / 2 - 9 / 2;
1557
+ return {
1558
+ height: 9,
1559
+ id: j,
1560
+ position: v.Right,
1561
+ type: "source",
1562
+ width: 9,
1563
+ x: t - 9 / 2,
1564
+ y: n
1565
+ };
1566
+ }
1567
+ function Ot(e, t, n) {
1568
+ let r = er(e, t), i = X(e, t), a = i && !e.data.isDefault && !e.data.condition, o = a ? qe : i ? Ke : "#475569", s = a ? "#fef2f2" : i ? "#eff6ff" : "#ffffff", c = a ? qe : i ? Ke : b;
1569
+ return {
1570
+ className: n ? "workflow-edge--selected" : void 0,
1571
+ data: e.data,
1572
+ id: e.id,
1573
+ label: r,
1574
+ labelBgBorderRadius: 6,
1575
+ labelBgPadding: [8, 4],
1576
+ labelBgStyle: {
1577
+ fill: s,
1578
+ stroke: c,
1579
+ strokeWidth: 1
1580
+ },
1581
+ labelShowBg: !!r,
1582
+ labelStyle: {
1583
+ fill: o,
1584
+ fontSize: 12,
1585
+ fontWeight: 600
1586
+ },
1587
+ selected: n,
1588
+ source: e.source,
1589
+ sourceHandle: e.sourceHandle,
1590
+ style: {
1591
+ filter: n ? Je : void 0,
1592
+ opacity: 1,
1593
+ stroke: b,
1594
+ strokeOpacity: 1,
1595
+ strokeWidth: 1.5
1596
+ },
1597
+ target: e.target,
1598
+ targetHandle: e.targetHandle,
1599
+ type: e.type ?? "smoothstep"
1600
+ };
1601
+ }
1602
+ function kt(e, t) {
1603
+ return e.type === "startEvent" || e.type === "endEvent" || e.type === "userTask" || e.type === "serviceTask" || e.type, {
1604
+ ...e,
1605
+ data: {
1606
+ ...e.data,
1607
+ label: t
1608
+ }
1609
+ };
1610
+ }
1611
+ function At(e, t) {
1612
+ return e.type === "startEvent" ? e : (e.type === "endEvent" || e.type === "userTask" || e.type === "serviceTask" || e.type, {
1613
+ ...e,
1614
+ data: {
1615
+ ...e.data,
1616
+ triggerMode: t
1617
+ }
1618
+ });
1619
+ }
1620
+ function jt(e) {
1621
+ return Nt(Mt(e));
1622
+ }
1623
+ function Mt(e) {
1624
+ let t = new Set(e.nodes.filter((e) => ln(e)).map((e) => e.id)), n = e.edges.filter((e) => !t.has(e.source));
1625
+ return n.length === e.edges.length ? e : {
1626
+ ...e,
1627
+ edges: n
1628
+ };
1629
+ }
1630
+ function Nt(e) {
1631
+ let t = e.edges.reduce((e, t) => ({
1632
+ ...e,
1633
+ [t.target]: (e[t.target] ?? 0) + 1
1634
+ }), {}), n = e.nodes.map((e) => e.type === "startEvent" ? e : (t[e.id] ?? 0) < 2 && e.data.triggerMode !== "AND" ? At(e, "AND") : e);
1635
+ return n.some((t, n) => t !== e.nodes[n]) ? {
1636
+ ...e,
1637
+ nodes: n
1638
+ } : e;
1639
+ }
1640
+ function Pt(e, t) {
1641
+ let n = {
1642
+ id: `${e}_${t}`,
1643
+ position: {
1644
+ x: 260 + t * 48,
1645
+ y: 120 + t * 42
1646
+ }
1647
+ };
1648
+ return e === "userTask" ? {
1649
+ ...n,
1650
+ data: {
1651
+ allowAddSigner: !1,
1652
+ allowReject: !0,
1653
+ allowTransfer: !0,
1654
+ approverResolver: {
1655
+ memberIds: ["member-001"],
1656
+ type: "DIRECT"
1657
+ },
1658
+ decisionPolicy: { type: "SINGLE" },
1659
+ label: `簽核節點 ${t}`,
1660
+ returnBehavior: {
1661
+ allowReturn: !0,
1662
+ allowedTargets: "INITIATOR",
1663
+ resubmitStrategy: "RESTART"
1664
+ },
1665
+ triggerMode: "AND"
1666
+ },
1667
+ type: e
1668
+ } : e === "serviceTask" ? {
1669
+ ...n,
1670
+ data: {
1671
+ action: {
1672
+ channels: ["IN_APP"],
1673
+ recipients: {
1674
+ memberIds: ["member-001"],
1675
+ type: "DIRECT"
1676
+ },
1677
+ type: "NOTIFY"
1678
+ },
1679
+ label: `知會節點 ${t}`,
1680
+ triggerMode: "AND"
1681
+ },
1682
+ type: e
1683
+ } : {
1684
+ ...n,
1685
+ data: {
1686
+ direction: "split",
1687
+ label: `條件分流 ${t}`,
1688
+ triggerMode: "AND"
1689
+ },
1690
+ type: e
1691
+ };
1692
+ }
1693
+ function Ft(e, t) {
1694
+ let n = new Set(e.filter((e) => e.type === t).map((e) => Number(e.id.replace(`${t}_`, ""))).filter((e) => Number.isInteger(e) && e > 0));
1695
+ return Array.from({ length: e.length + 1 }, (e, t) => t + 1).find((e) => !n.has(e)) ?? e.length + 1;
1696
+ }
1697
+ function It({ definition: e, node: t, selectedEdgeId: n, selectedNodeId: r }) {
1698
+ let i = n ? e.edges.find((e) => e.id === n) ?? null : null, a = r ? e.nodes.find((e) => e.id === r) ?? null : null;
1699
+ return i ? Lt(e, t, i) : a ? Rt(e, t, a) : {
1700
+ definition: {
1701
+ ...e,
1702
+ nodes: [...e.nodes, t]
1703
+ },
1704
+ editingEdgeId: null,
1705
+ selectedEdgeIds: [],
1706
+ selectedNodeId: t.id
1707
+ };
1708
+ }
1709
+ function Lt(e, t, n) {
1710
+ if (!B(t)) return {
1711
+ definition: e,
1712
+ editingEdgeId: null,
1713
+ selectedEdgeIds: [n.id],
1714
+ selectedNodeId: null
1715
+ };
1716
+ if (!V(t)) {
1717
+ let r = R(n.source, t.id, {});
1718
+ return {
1719
+ definition: {
1720
+ ...e,
1721
+ edges: [...e.edges, r],
1722
+ nodes: [...e.nodes, t]
1723
+ },
1724
+ editingEdgeId: null,
1725
+ selectedEdgeIds: [],
1726
+ selectedNodeId: t.id
1727
+ };
1728
+ }
1729
+ let r = R(n.source, t.id, n.data), i = R(t.id, n.target, zt(t, n)), a = X(i, [...e.nodes, t]);
1730
+ return {
1731
+ definition: {
1732
+ ...e,
1733
+ edges: e.edges.flatMap((e) => e.id === n.id ? [r, i] : [e]),
1734
+ nodes: [...e.nodes, t]
1735
+ },
1736
+ editingEdgeId: a ? i.id : null,
1737
+ selectedEdgeIds: a ? [i.id] : [],
1738
+ selectedNodeId: a ? null : t.id
1739
+ };
1740
+ }
1741
+ function Rt(e, t, n) {
1742
+ if (!V(n)) return {
1743
+ definition: {
1744
+ ...e,
1745
+ nodes: [...e.nodes, t]
1746
+ },
1747
+ editingEdgeId: null,
1748
+ selectedEdgeIds: [],
1749
+ selectedNodeId: t.id
1750
+ };
1751
+ let r = e.edges.find((e) => e.source === n.id) ?? null;
1752
+ if (r && V(t)) return Lt(e, t, r);
1753
+ let i = e.nodes.find((e) => e.type === "endEvent");
1754
+ if (i && n.id !== i.id && V(t)) {
1755
+ let r = R(n.id, t.id, {}), a = R(t.id, i.id, zt(t, r)), o = X(a, [...e.nodes, t]);
1756
+ return {
1757
+ definition: {
1758
+ ...e,
1759
+ edges: [
1760
+ ...e.edges,
1761
+ r,
1762
+ a
1763
+ ],
1764
+ nodes: [...e.nodes, t]
1765
+ },
1766
+ editingEdgeId: o ? a.id : null,
1767
+ selectedEdgeIds: o ? [a.id] : [],
1768
+ selectedNodeId: o ? null : t.id
1769
+ };
1770
+ }
1771
+ let a = R(n.id, t.id, {});
1772
+ return {
1773
+ definition: {
1774
+ ...e,
1775
+ edges: [...e.edges, a],
1776
+ nodes: [...e.nodes, t]
1777
+ },
1778
+ editingEdgeId: null,
1779
+ selectedEdgeIds: [],
1780
+ selectedNodeId: t.id
1781
+ };
1782
+ }
1783
+ function R(e, t, n) {
1784
+ return {
1785
+ data: n,
1786
+ id: `edge_${e}_${t}_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
1787
+ source: e,
1788
+ sourceHandle: j,
1789
+ target: t,
1790
+ targetHandle: A,
1791
+ type: "smoothstep"
1792
+ };
1793
+ }
1794
+ function zt(e, t) {
1795
+ return e.type === "exclusiveGateway" ? {
1796
+ isDefault: !0,
1797
+ label: "其他情況"
1798
+ } : {};
1799
+ }
1800
+ function Bt() {
1801
+ return {
1802
+ edges: [],
1803
+ meta: { schemaVersion: 1 },
1804
+ nodes: [{
1805
+ data: { label: "開始" },
1806
+ id: "start",
1807
+ position: {
1808
+ x: 80,
1809
+ y: 160
1810
+ },
1811
+ type: "startEvent"
1812
+ }, {
1813
+ data: {
1814
+ endState: "APPROVED",
1815
+ label: "完成",
1816
+ triggerMode: "AND"
1817
+ },
1818
+ id: "end",
1819
+ position: {
1820
+ x: 560,
1821
+ y: 160
1822
+ },
1823
+ type: "endEvent"
1824
+ }]
1825
+ };
1826
+ }
1827
+ function Vt(e) {
1828
+ return e.edges.length === 0 && e.nodes.length === 2 && e.nodes.some((e) => e.type === "startEvent") && e.nodes.some((e) => e.type === "endEvent");
1829
+ }
1830
+ function Ht(e) {
1831
+ let t = new Le.graphlib.Graph();
1832
+ return t.setDefaultEdgeLabel(() => ({})), t.setGraph({
1833
+ rankdir: "LR",
1834
+ ranksep: 120
1835
+ }), e.nodes.forEach((e) => {
1836
+ t.setNode(e.id, F(e));
1837
+ }), e.edges.forEach((e) => {
1838
+ t.setEdge(e.source, e.target);
1839
+ }), Le.layout(t), {
1840
+ ...e,
1841
+ nodes: e.nodes.map((e) => {
1842
+ let n = t.node(e.id);
1843
+ return n ? {
1844
+ ...e,
1845
+ position: {
1846
+ x: n.x - F(e).width / 2,
1847
+ y: n.y - F(e).height / 2
1848
+ }
1849
+ } : e;
1850
+ })
1851
+ };
1852
+ }
1853
+ function z(e, t) {
1854
+ return t ? e.find((e) => e.id === t) ?? null : null;
1855
+ }
1856
+ function Ut(e) {
1857
+ return e === "OR" ? "OR" : "AND";
1858
+ }
1859
+ function Wt(e) {
1860
+ return e === "FROM_RETURN_POINT" ? "FROM_RETURN_POINT" : "RESTART";
1861
+ }
1862
+ function Gt(e) {
1863
+ return e === "ORG_MANAGER" || e === "ORG_UNIT_MANAGER" || e === "ORG_UNIT_MEMBER" || e === "ORG_UNIT_POSITION" || e === "POSITION" ? e : "DIRECT";
1864
+ }
1865
+ function Kt(e) {
1866
+ let t = Gt(e ?? "DIRECT");
1867
+ return t === "ORG_MANAGER" ? {
1868
+ baseFromInitiator: !0,
1869
+ levelsUp: 1,
1870
+ type: "ORG_MANAGER"
1871
+ } : t === "ORG_UNIT_MANAGER" ? {
1872
+ orgUnitId: "",
1873
+ type: "ORG_UNIT_MANAGER"
1874
+ } : t === "ORG_UNIT_MEMBER" ? {
1875
+ includeDescendants: !1,
1876
+ orgUnitId: "",
1877
+ type: "ORG_UNIT_MEMBER"
1878
+ } : t === "ORG_UNIT_POSITION" ? {
1879
+ includeDescendants: !1,
1880
+ orgUnitId: "",
1881
+ positionId: "",
1882
+ type: "ORG_UNIT_POSITION"
1883
+ } : t === "POSITION" ? {
1884
+ positionId: "",
1885
+ type: "POSITION"
1886
+ } : {
1887
+ memberIds: [],
1888
+ type: "DIRECT"
1889
+ };
1890
+ }
1891
+ function qt(e) {
1892
+ return e === "DIRECT" ? "DIRECT" : "NONE";
1893
+ }
1894
+ function Jt(e, t) {
1895
+ return e.type === "ORG_MANAGER" || e.type === "ORG_UNIT_MANAGER" ? {
1896
+ ...e,
1897
+ fallback: t
1898
+ } : e;
1899
+ }
1900
+ function Yt(e) {
1901
+ return M.find((t) => t.value === e) ?? M[0];
1902
+ }
1903
+ function Xt(e) {
1904
+ return M.find((t) => t.id === e) ?? M[0];
1905
+ }
1906
+ function Zt(e) {
1907
+ return e === "ORG_UNIT" || e === "ORG_UNIT_POSITION" || e === "NONE" ? e : "ALL";
1908
+ }
1909
+ function Qt(e) {
1910
+ let t = e?.trim();
1911
+ if (!t) return {
1912
+ mode: "ALL",
1913
+ value: ""
1914
+ };
1915
+ let n = tn(t, /"([^"]+)" in subject\.orgUnitIds/gu), r = tn(t, /"([^"]+)" in subject\.positionIds/gu);
1916
+ return n.length > 0 && r.length > 0 ? {
1917
+ includeDescendants: n.length > 1,
1918
+ mode: "ORG_UNIT_POSITION",
1919
+ orgUnitId: n[0],
1920
+ positionId: r[0],
1921
+ value: n[0] ?? ""
1922
+ } : n.length > 0 ? {
1923
+ includeDescendants: n.length > 1,
1924
+ mode: "ORG_UNIT",
1925
+ orgUnitId: n[0],
1926
+ value: n[0] ?? ""
1927
+ } : {
1928
+ mode: "CUSTOM",
1929
+ value: t
1930
+ };
1931
+ }
1932
+ function $t(e, t) {
1933
+ let n = Qt(e);
1934
+ return !t || t === "ALL" || t === "NONE" ? t === "ALL" || t === "NONE" ? {
1935
+ mode: t,
1936
+ value: ""
1937
+ } : n : n.mode === t ? n : an(t);
1938
+ }
1939
+ function en(e) {
1940
+ 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;
1941
+ }
1942
+ function tn(e, t) {
1943
+ return [...e.matchAll(t)].map((e) => e[1]).filter((e) => !!e);
1944
+ }
1945
+ function nn(e, t) {
1946
+ if (e.mode === "ALL" || e.mode === "NONE") return null;
1947
+ let n = e.orgUnitId?.trim() ?? "";
1948
+ if (!n) return null;
1949
+ let r = An(t, n, !!e.includeDescendants).map((e) => `${JSON.stringify(e)} in subject.orgUnitIds`).join(" || ");
1950
+ if (e.mode === "ORG_UNIT") return r ? `(${r})` : null;
1951
+ let i = e.positionId?.trim() ?? "";
1952
+ return i && r ? `(${r}) && ${JSON.stringify(i)} in subject.positionIds` : null;
1953
+ }
1954
+ function rn(e, t, n) {
1955
+ return e.mode === "NONE" ? "未設定" : e.mode === "ORG_UNIT" ? e.orgUnitId ? `組織:${H(t, e.orgUnitId)}` : "指定組織" : e.mode === "ORG_UNIT_POSITION" ? e.orgUnitId && e.positionId ? `組織職位:${H(t, e.orgUnitId)} / ${U(n, e.positionId)}` : "指定組織職位" : e.mode === "CUSTOM" ? "既有自訂規則" : "所有人";
1956
+ }
1957
+ function an(e) {
1958
+ return {
1959
+ includeDescendants: !0,
1960
+ mode: e,
1961
+ orgUnitId: "",
1962
+ positionId: "",
1963
+ value: ""
1964
+ };
1965
+ }
1966
+ function on(e, t) {
1967
+ 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;
1968
+ return !!n && !!r && e.source !== e.target && e.sourceHandle === j && e.targetHandle === A && !!(n && V(n)) && !!(r && B(r));
1969
+ }
1970
+ function sn(e, t) {
1971
+ return e.includes(t) ? e.filter((e) => e !== t) : [...e, t];
1972
+ }
1973
+ function cn(e) {
1974
+ return e.type !== "startEvent" && e.type !== "endEvent";
1975
+ }
1976
+ function B(e) {
1977
+ return e.type !== "startEvent";
1978
+ }
1979
+ function V(e) {
1980
+ return e.type !== "endEvent" && !ln(e);
1981
+ }
1982
+ function ln(e) {
1983
+ return e.type === "serviceTask" && e.data.action.type === "NOTIFY";
1984
+ }
1985
+ function un(e) {
1986
+ return e instanceof HTMLElement ? e.isContentEditable || e.tagName === "INPUT" || e.tagName === "TEXTAREA" || e.tagName === "SELECT" || !!e.closest("[contenteditable=\"true\"]") : !1;
1987
+ }
1988
+ function dn(e) {
1989
+ return e.map((e) => ({
1990
+ id: e.id,
1991
+ name: `${e.formName} | v${e.version}`,
1992
+ schema: e.schema
1993
+ }));
1994
+ }
1995
+ function fn(e) {
1996
+ return (e?.schema.fields ?? []).reduce((e, t) => ({
1997
+ ...e,
1998
+ [t.fieldKey]: pn(t)
1999
+ }), {});
2000
+ }
2001
+ function pn(e) {
2002
+ return e.type === "number" ? 1e3 : e.type === "boolean" ? !0 : e.type === "select" ? e.options[0]?.value ?? "" : e.type === "checkbox" ? e.options[0] ? [e.options[0].value] : [] : e.type === "date" ? "2026-05-08" : e.type === "datetime" ? "2026-05-08T09:00:00+08:00" : e.placeholder ?? e.label;
2003
+ }
2004
+ function mn(e) {
2005
+ let t = JSON.parse(e);
2006
+ if (!hn(t)) throw Error("表單資料 JSON 必須是物件。");
2007
+ return t;
2008
+ }
2009
+ function hn(e) {
2010
+ return typeof e == "object" && !!e && !Array.isArray(e);
2011
+ }
2012
+ function gn(e) {
2013
+ return e === "COMPLETED" ? "完成" : e === "PASSED" ? "通過" : e === "SKIPPED" ? "略過" : e === "STOPPED" ? "已停止" : e === "WAITING" ? "將等待簽核" : e;
2014
+ }
2015
+ function _n(e) {
2016
+ return e in ct ? ct[e] : e;
2017
+ }
2018
+ function vn(e, t) {
2019
+ return t && !e.some((e) => e.id === t.id) ? [t, ...e] : e;
2020
+ }
2021
+ function yn(e) {
2022
+ return e.map((e) => ({
2023
+ displayName: e.name,
2024
+ email: e.email,
2025
+ id: e.memberId,
2026
+ memberId: e.memberId,
2027
+ name: G(e.name, e.email)
2028
+ }));
2029
+ }
2030
+ function bn(e) {
2031
+ return {
2032
+ displayName: "未知會員",
2033
+ email: "",
2034
+ id: e,
2035
+ memberId: e,
2036
+ name: "未知會員"
2037
+ };
2038
+ }
2039
+ function xn(e, t) {
2040
+ return e.find((e) => e.memberId === t) ?? bn(t);
2041
+ }
2042
+ function Sn(e, t) {
2043
+ let n = e[0];
2044
+ return n ? xn(t, n) : null;
2045
+ }
2046
+ function Cn(e, t) {
2047
+ let r = e.find((e) => e.id === t);
2048
+ return r ? n(r) : null;
2049
+ }
2050
+ function wn(e, t) {
2051
+ let n = e.find((e) => e.id === t);
2052
+ return n ? i(n) : null;
2053
+ }
2054
+ function H(e, t) {
2055
+ return Cn(e, t)?.name ?? "未指定組織";
2056
+ }
2057
+ function U(e, t) {
2058
+ return wn(e, t)?.name ?? "未指定職位";
2059
+ }
2060
+ function Tn(e, t) {
2061
+ let n = En(), r = t.filter((t) => t.memberId === e && Dn(t, n)), i = r.reduce((e, t) => e && W(e, t) <= 0 ? e : t, null);
2062
+ return {
2063
+ customFields: {},
2064
+ managerMemberId: "member-002",
2065
+ memberId: e,
2066
+ orgCode: "HQ",
2067
+ orgUnitIds: On(r.map((e) => e.orgUnitId)),
2068
+ positionId: i?.positionId ?? null,
2069
+ positionIds: On(r.map((e) => e.positionId)),
2070
+ primaryOrgUnitId: i?.orgUnitId ?? null,
2071
+ roles: ["manager"]
2072
+ };
2073
+ }
2074
+ function En() {
2075
+ return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
2076
+ }
2077
+ function Dn(e, t) {
2078
+ return e.effectiveFrom <= t && (!e.effectiveTo || e.effectiveTo >= t);
2079
+ }
2080
+ function W(e, t) {
2081
+ return e.isPrimary === t.isPrimary ? t.effectiveFrom.localeCompare(e.effectiveFrom) : e.isPrimary ? -1 : 1;
2082
+ }
2083
+ function On(e) {
2084
+ return e.reduce((e, t) => t && !e.includes(t) ? [...e, t] : e, []);
2085
+ }
2086
+ function kn({ includeDescendants: e, memberships: t, orgUnitId: n, orgUnits: r, positions: i }) {
2087
+ let a = new Set(An(r, n, e)), o = new Set(t.filter((e) => a.has(e.orgUnitId)).map((e) => e.positionId).filter((e) => !!e));
2088
+ return i.filter((e) => o.has(e.id));
2089
+ }
2090
+ function An(e, t, n) {
2091
+ let r = e.find((e) => e.id === t);
2092
+ return r ? n ? e.filter((e) => e.id === r.id || e.path.startsWith(`${r.path}.`)).map((e) => e.id) : [r.id] : t.trim() ? [t] : [];
2093
+ }
2094
+ function jn(e, t) {
2095
+ let n = new Set(e.map((e) => e.memberId)), r = t.filter((e) => !n.has(e.memberId));
2096
+ return [...e, ...r];
2097
+ }
2098
+ function Mn(e) {
2099
+ return [...new Set(e.nodes.flatMap((e) => e.type === "userTask" ? e.data.approverResolver.type === "DIRECT" ? e.data.approverResolver.memberIds : [] : e.type === "serviceTask" ? nr(e.data.action) : []))];
2100
+ }
2101
+ function Nn(e, t, n, r) {
2102
+ return e.type === "userTask" ? Pn(e.data.approverResolver, t, n, r) : null;
2103
+ }
2104
+ function Pn(e, t, n, r) {
2105
+ return e.type === "DIRECT" ? In(e.memberIds, t, "未指定簽核者") : e.type === "ORG_MANAGER" ? Yt(e.levelsUp).name : e.type === "ORG_UNIT_MANAGER" ? `組織主管:${H(n, e.orgUnitId)}` : e.type === "ORG_UNIT_MEMBER" ? `組織任一人:${H(n, e.orgUnitId)}` : e.type === "ORG_UNIT_POSITION" ? `組織職位:${H(n, e.orgUnitId)} / ${U(r, e.positionId)}` : e.type === "POSITION" ? `職位:${U(r, e.positionId)}` : e.type === "DYNAMIC_FORM" ? `表單欄位:${e.formPath || "未設定"}` : "自訂表達式";
2106
+ }
2107
+ function Fn(e, t) {
2108
+ if (e.type !== "serviceTask") return null;
2109
+ let n = nr(e.data.action);
2110
+ return n.length === 0 ? ["未指定知會對象"] : n.map((e) => xn(t, e).name);
2111
+ }
2112
+ function In(e, t, n) {
2113
+ let r = e.map((e) => xn(t, e).name);
2114
+ return r.length === 0 ? n : r.length <= 2 ? r.join("、") : `${r.slice(0, 2).join("、")} 等 ${r.length} 人`;
2115
+ }
2116
+ function G(e, t) {
2117
+ return `${e} (${t})`;
2118
+ }
2119
+ function Ln(e, t) {
2120
+ let n = t?.getBoundingClientRect();
2121
+ if (!n || e.nodes.length === 0) return null;
2122
+ let r = e.nodes.reduce((e, t) => {
2123
+ let n = F(t);
2124
+ return {
2125
+ maxX: Math.max(e.maxX, t.position.x + n.width),
2126
+ maxY: Math.max(e.maxY, t.position.y + n.height),
2127
+ minX: Math.min(e.minX, t.position.x),
2128
+ minY: Math.min(e.minY, t.position.y)
2129
+ };
2130
+ }, {
2131
+ maxX: -Infinity,
2132
+ maxY: -Infinity,
2133
+ minX: Infinity,
2134
+ minY: Infinity
2135
+ });
2136
+ return Ie({
2137
+ height: r.maxY - r.minY,
2138
+ width: r.maxX - r.minX,
2139
+ x: r.minX,
2140
+ y: r.minY
2141
+ }, n.width, n.height, .1, 1, .2);
2142
+ }
2143
+ function Rn(e) {
2144
+ let t = e.nodes.find((e) => e.type === "userTask" && !!zn(e.data.approverResolver)), n = e.nodes.find((e) => e.type === "serviceTask" && e.data.action.type === "NOTIFY" && nr(e.data.action).length === 0), r = e.edges.find((t) => X(t, e.nodes) && !t.data.isDefault && !t.data.condition);
2145
+ return t && t.type === "userTask" ? zn(t.data.approverResolver) : n ? "知會節點需要至少一位知會對象。" : r ? "條件分流的每條輸出連線都需要先設定條件。" : null;
2146
+ }
2147
+ function zn(e) {
2148
+ return e.type === "DIRECT" && e.memberIds.length === 0 ? "簽核節點需要指定簽核會員。" : e.type === "ORG_MANAGER" && e.levelsUp < 1 ? "簽核節點需要指定有效的主管層級。" : e.type === "ORG_UNIT_MANAGER" && !e.orgUnitId.trim() || e.type === "ORG_UNIT_MEMBER" && !e.orgUnitId.trim() ? "簽核節點需要指定組織。" : e.type === "ORG_UNIT_POSITION" && (!e.orgUnitId.trim() || !e.positionId.trim()) ? "簽核節點需要指定組織與職位。" : (e.type === "ORG_MANAGER" || e.type === "ORG_UNIT_MANAGER") && e.fallback?.type === "DIRECT" && !e.fallback.memberId.trim() ? "簽核節點需要指定改派固定人。" : e.type === "POSITION" && !e.positionId.trim() ? "簽核節點需要指定職位。" : null;
2149
+ }
2150
+ function Bn(e) {
2151
+ return e.edges.some((t) => X(t, e.nodes) && !!(t.data.condition || t.data.conditionFieldKey || t.data.conditionOperator || t.data.conditionValue));
2152
+ }
2153
+ function Vn(e) {
2154
+ return e?.fields.map((e) => ({
2155
+ fieldType: e.type,
2156
+ id: e.fieldKey,
2157
+ name: `${e.label} (${e.fieldKey})`
2158
+ })) ?? [];
2159
+ }
2160
+ function Hn(e, t) {
2161
+ return t ? e?.fields.find((e) => e.fieldKey === t) ?? null : null;
2162
+ }
2163
+ function Un(e) {
2164
+ if (!e) return [];
2165
+ let t = Gn(e);
2166
+ return ht.filter((e) => t.includes(e.id));
2167
+ }
2168
+ function Wn(e) {
2169
+ return ht.some((t) => t.id === e) ? e : null;
2170
+ }
2171
+ function Gn(e) {
2172
+ return e.type === "file_upload" ? ["IS_FILLED", "IS_EMPTY"] : e.type === "boolean" ? [
2173
+ "EQUALS",
2174
+ "NOT_EQUALS",
2175
+ "IS_FILLED",
2176
+ "IS_EMPTY"
2177
+ ] : e.type === "date" || e.type === "datetime" || e.type === "money" || e.type === "number" ? [
2178
+ "EQUALS",
2179
+ "NOT_EQUALS",
2180
+ "GREATER_THAN",
2181
+ "GREATER_THAN_OR_EQUALS",
2182
+ "LESS_THAN",
2183
+ "LESS_THAN_OR_EQUALS",
2184
+ "IS_FILLED",
2185
+ "IS_EMPTY"
2186
+ ] : [
2187
+ "EQUALS",
2188
+ "NOT_EQUALS",
2189
+ "IS_FILLED",
2190
+ "IS_EMPTY"
2191
+ ];
2192
+ }
2193
+ function Kn(e) {
2194
+ return e ? e.type === "boolean" ? [{
2195
+ id: "true",
2196
+ name: "是"
2197
+ }, {
2198
+ id: "false",
2199
+ name: "否"
2200
+ }] : e.type === "checkbox" || e.type === "radio" || e.type === "select" ? e.options.map((e) => ({
2201
+ id: e.value,
2202
+ name: e.label
2203
+ })) : [] : [];
2204
+ }
2205
+ function qn(e, t) {
2206
+ if (!e) return;
2207
+ let n = Gn(e);
2208
+ return t && n.includes(t) ? t : n[0];
2209
+ }
2210
+ function Jn(e, t, n) {
2211
+ if (!e || !t || !Yn(t)) return;
2212
+ let r = Kn(e);
2213
+ return r.length === 0 || r.some((e) => e.id === n) ? n ?? void 0 : r[0]?.id;
2214
+ }
2215
+ function Yn(e) {
2216
+ return gt.includes(e);
2217
+ }
2218
+ function Xn(e, t, n) {
2219
+ if (!e || !t) return;
2220
+ let r = K(t);
2221
+ if (!Yn(t)) return `${e.label} ${r}`;
2222
+ if (n) return `${e.label} ${r} ${Zn(e, n)}`;
2223
+ }
2224
+ function K(e) {
2225
+ return ht.find((t) => t.id === e)?.name ?? e;
2226
+ }
2227
+ function Zn(e, t) {
2228
+ return e.type === "boolean" ? t === "true" ? "是" : "否" : e.type === "checkbox" || e.type === "radio" || e.type === "select" ? q(e.options, t)?.label ?? t : t;
2229
+ }
2230
+ function q(e, t) {
2231
+ return e.find((e) => e.value === t) ?? null;
2232
+ }
2233
+ function Qn(e, t, n) {
2234
+ if (!e || !t) return;
2235
+ let r = J(e.fieldKey);
2236
+ if (t === "IS_FILLED") return `${r} != null && ${r} != ""`;
2237
+ if (t === "IS_EMPTY") return `${r} == null || ${r} == ""`;
2238
+ if (n) return `${r} ${Y(t)} ${$n(e, n)}`;
2239
+ }
2240
+ function J(e) {
2241
+ return /^[A-Za-z_][A-Za-z0-9_]*$/u.test(e) ? `form.${e}` : `form[${JSON.stringify(e)}]`;
2242
+ }
2243
+ function Y(e) {
2244
+ return e === "EQUALS" ? "==" : e === "NOT_EQUALS" ? "!=" : e === "GREATER_THAN" ? ">" : e === "GREATER_THAN_OR_EQUALS" ? ">=" : e === "LESS_THAN" ? "<" : "<=";
2245
+ }
2246
+ function $n(e, t) {
2247
+ return e.type === "boolean" ? t === "true" ? "true" : "false" : (e.type === "money" || e.type === "number") && Number.isFinite(Number(t)) ? t : JSON.stringify(t);
2248
+ }
2249
+ function er(e, t) {
2250
+ if (e.data.label) return e.data.label;
2251
+ if (X(e, t)) return tr(e);
2252
+ if (Z(e, t)) return "同時進行";
2253
+ }
2254
+ function tr(e) {
2255
+ return e.data.isDefault ? "其他情況" : "請設定條件";
2256
+ }
2257
+ function X(e, t) {
2258
+ return t.some((t) => t.id === e.source && t.type === "exclusiveGateway");
2259
+ }
2260
+ function Z(e, t) {
2261
+ return t.some((t) => t.id === e.source && t.type === "parallelGateway");
2262
+ }
2263
+ function nr(e) {
2264
+ return e.type === "NOTIFY" && e.recipients.type === "DIRECT" ? e.recipients.memberIds : [];
2265
+ }
2266
+ function Q(e) {
2267
+ return e instanceof Error ? e.message : "發生未知錯誤";
2268
+ }
2269
+ //#endregion
2270
+ export { xt as t };
2271
+
2272
+ //# sourceMappingURL=TemplateDesignerView-Dffx-VZ-.js.map