@rytass/bpm-core-react 0.2.0 → 0.3.1

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