@uipath/flow-tool 1.201.0 → 1.202.0-preview.136

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 (234) hide show
  1. package/dist/{authoring-7r6g06c7.js → authoring-wpa6d0vf.js} +74 -48
  2. package/dist/binding-service-dh91hw9e.js +141 -0
  3. package/dist/{browser-strategy-rkcvc6tn.js → browser-strategy-6atc7v8s.js} +3 -3
  4. package/dist/connector-service-d9ph9kx1.js +948 -0
  5. package/dist/{conversion-H2VEEYLB-ng48mbf7.js → conversion-QANACVCM-zs0hhfjv.js} +39 -33
  6. package/dist/{de-5KVP66U6-f7knj511.js → de-5KVP66U6-1bnf4zt5.js} +52 -52
  7. package/dist/de-6U7ECGHH-xwsw33fk.js +35 -0
  8. package/dist/{de-5HU6GFWV-4EZK6G7N-yrh21f52.js → de-7XQXX2DK-IDWR6CAR-n4z245kt.js} +857 -845
  9. package/dist/{de-5HU6GFWV-zheyw6d2.js → de-7XQXX2DK-tqdy5n2b.js} +857 -845
  10. package/dist/{de-HKTOVV4H-d5yw5j21.js → de-HKTOVV4H-pe9w0xn8.js} +46 -46
  11. package/dist/{de-XLT4QPIP-0rtw349w.js → de-XLT4QPIP-kj81dxjc.js} +9 -9
  12. package/dist/debug-conversation-trigger-452frzyz.js +41 -0
  13. package/dist/debug-http-client-wd6xb8v4.js +31 -0
  14. package/dist/debug-service-fvyexnb1.js +58 -0
  15. package/dist/edge-service-e77bndbe.js +162 -0
  16. package/dist/{elk.bundled-pydbzeez.js → elk.bundled-vpsbxz0p.js} +3 -3
  17. package/dist/{en-MABQK6C4-REWE2WG2-8dp4cqdg.js → en-5ZGC5VQ3-EWX7ILY7-rmtj70fk.js} +898 -898
  18. package/dist/{en-MABQK6C4-nkzq2j8t.js → en-5ZGC5VQ3-h581y30k.js} +897 -897
  19. package/dist/en-EPWMLP2N-2wvge238.js +28 -0
  20. package/dist/{en-UNT7BE26-rhh65jry.js → en-LQHKFSEY-vvbe8ve9.js} +13 -11
  21. package/dist/{en-P4AS26D7-szrzfxz1.js → en-P4AS26D7-zptp77bm.js} +45 -45
  22. package/dist/{en-4KXU7N7B-66fntxa2.js → en-X3S6IZ5J-nhkg6pwn.js} +54 -60
  23. package/dist/{es-MX-H2EAXLYI-qwnqt48x.js → es-MX-H2EAXLYI-j42kfkxy.js} +46 -46
  24. package/dist/es-MX-NHTIP5YM-ar6zfx95.js +35 -0
  25. package/dist/{es-MX-OKNDG2NH-c1k1s1tg.js → es-MX-OKNDG2NH-tcac6j4g.js} +9 -9
  26. package/dist/{es-MX-POESXYP2-UW6VP5QI-cd3a79g9.js → es-MX-U2VN3SZW-KYAJ2ONK-kdram1g1.js} +857 -845
  27. package/dist/{es-MX-POESXYP2-9538722k.js → es-MX-U2VN3SZW-anynsmd8.js} +857 -845
  28. package/dist/{es-MX-XAVLOQW3-9b3cp9n8.js → es-MX-XAVLOQW3-q00km2y7.js} +52 -52
  29. package/dist/{es-NQICVYSQ-aa9z3nhs.js → es-NQICVYSQ-3dtqgget.js} +9 -9
  30. package/dist/{es-O4PAV2CR-jwfaawwk.js → es-O4PAV2CR-0g23ve3v.js} +46 -46
  31. package/dist/es-PQ3RA33Q-y4kxhjfr.js +35 -0
  32. package/dist/{es-VFPNVMP5-thm0z9sr.js → es-VFPNVMP5-bx2c337j.js} +52 -52
  33. package/dist/{es-LUTYN7U7-IY5QWOUF-k2aefzc0.js → es-ZGCPPOME-24PJEGPV-rn86z9kn.js} +857 -845
  34. package/dist/{es-LUTYN7U7-ye5zn4sn.js → es-ZGCPPOME-8gazspjj.js} +857 -845
  35. package/dist/flow-api-wv8p8xbd.js +36 -0
  36. package/dist/flow-debug-service-tfbefas6.js +741 -0
  37. package/dist/flow-eval-node-target-c6wea7rz.js +44 -0
  38. package/dist/flow-eval-run-service-01kdky72.js +961 -0
  39. package/dist/flow-eval-service-ft8e16jz.js +1338 -0
  40. package/dist/flow-init-service-mva4crty.js +35 -0
  41. package/dist/flow-io-r318sjrw.js +36 -0
  42. package/dist/flow-migrate-service-rwcdx60q.js +119 -0
  43. package/dist/flow-pack-service-p4hxyj9e.js +280 -0
  44. package/dist/flow-validate-service-j25pxpwz.js +57 -0
  45. package/dist/{fr-5YRGHXF5-q6b63yg0.js → fr-5YRGHXF5-kz1ywpv6.js} +46 -46
  46. package/dist/{fr-E5MDO4EG-exvrs7ge.js → fr-E5MDO4EG-c3mkty2t.js} +52 -52
  47. package/dist/{fr-PFHIL7YZ-cxnshwa8.js → fr-PFHIL7YZ-2n589p47.js} +9 -9
  48. package/dist/fr-R4L3OAWI-30khpsmn.js +35 -0
  49. package/dist/{fr-LJIK56LW-STG6QR3T-cextvv8q.js → fr-T3G5GZCT-TU4IKBEG-k6xz1s1f.js} +857 -845
  50. package/dist/{fr-LJIK56LW-xf3xf2kh.js → fr-T3G5GZCT-y3f7xb1q.js} +857 -845
  51. package/dist/governance-fetcher-j9cx4f1d.js +391 -0
  52. package/dist/headless-h1myzz32.js +177196 -0
  53. package/dist/hitl-service-kvt5wms4.js +256 -0
  54. package/dist/index-1kgxzh8x.js +143 -0
  55. package/dist/index-4zrwgb3c.js +111 -0
  56. package/dist/index-ev4mdg5y.js +4801 -0
  57. package/dist/{index-er6vy3jk.js → index-eybzsdcc.js} +295 -317
  58. package/dist/{index-hsadteg4.js → index-h8cph72k.js} +4 -4
  59. package/dist/{index-p50kx6jv.js → index-k5tbd184.js} +276 -276
  60. package/dist/index-n33np76r.js +630 -0
  61. package/dist/{index-9f8q2ege.js → index-p3vk57z7.js} +27 -27
  62. package/dist/{index-dhcd9b82.js → index-w0z4s69j.js} +166 -81
  63. package/dist/index.js +29 -32
  64. package/dist/{index.umd.min-drpc57vn.js → index.umd.min-fqefd9kn.js} +3 -3
  65. package/dist/init.js +24 -25
  66. package/dist/input-reader-6pwhtp8v.js +11 -0
  67. package/dist/{ja-FGEGLBJ3-w9byjhze.js → ja-BI5K3JDZ-77zat4z2.js} +857 -845
  68. package/dist/{ja-FGEGLBJ3-MG3BSWXD-vq19zt2p.js → ja-BI5K3JDZ-GTIHISTZ-s6n3r2ab.js} +857 -845
  69. package/dist/{ja-DPO5PPLO-s2a7j3nj.js → ja-DPO5PPLO-mysfmznx.js} +52 -52
  70. package/dist/{ja-P4OSE367-8ywxep9a.js → ja-P4OSE367-srr3qypg.js} +9 -9
  71. package/dist/{ja-SDAPAVCR-943p5gx7.js → ja-SDAPAVCR-kg39dfap.js} +46 -46
  72. package/dist/ja-ZHKCBE5W-x73w6x3e.js +35 -0
  73. package/dist/{js-yaml-cggj6w7q.js → js-yaml-87cdx6bm.js} +27 -19
  74. package/dist/known-types-a20evmmg.js +20 -0
  75. package/dist/ko-6W7OGLLB-mnmqc584.js +35 -0
  76. package/dist/{ko-ITOPNIYI-qz39kamf.js → ko-ITOPNIYI-hmxd2asd.js} +52 -52
  77. package/dist/{ko-TUAK3G3A-s25w0ckg.js → ko-JOBF5V7N-4bv0mjje.js} +857 -845
  78. package/dist/{ko-TUAK3G3A-TBEBKOTM-ns78t2rv.js → ko-JOBF5V7N-O7T4HKIE-ape840y0.js} +857 -845
  79. package/dist/{ko-NAGOZLC3-wb3y9yhh.js → ko-NAGOZLC3-gaxxsnd2.js} +46 -46
  80. package/dist/{ko-PYOS2KJP-5sbj5bp8.js → ko-PYOS2KJP-e7dshyxy.js} +9 -9
  81. package/dist/localization-h8a53z6p.js +47 -0
  82. package/dist/{node-gd4469ea.js → node-cnrcrrb0.js} +7973 -7166
  83. package/dist/node-service-8g5x5d2y.js +70 -0
  84. package/dist/{node-strategy-8gzp67xs.js → node-strategy-gc4sg6a2.js} +132 -16
  85. package/dist/node-sync-service-e2reh33c.js +42 -0
  86. package/dist/{packager-tool-9qecd4wb.js → packager-tool-0gctz400.js} +5 -2
  87. package/dist/{packager-tool-1cb0d5e0.js → packager-tool-0v3s8r01.js} +2 -2
  88. package/dist/{packager-tool-wckvcay0.js → packager-tool-1yh8g550.js} +9 -7
  89. package/dist/packager-tool-27avrkyk.js +15 -0
  90. package/dist/packager-tool-2wefykg9.js +106 -0
  91. package/dist/packager-tool-4fhgws0x.js +757 -0
  92. package/dist/{packager-tool-7yjpwj92.js → packager-tool-4hx14snw.js} +49 -48
  93. package/dist/{packager-tool-3wygxefb.js → packager-tool-58q3tvh7.js} +10 -10
  94. package/dist/{packager-tool-cvwr40ax.js → packager-tool-5qaxht3k.js} +1425 -550
  95. package/dist/packager-tool-5z1eg3ea.js +33289 -0
  96. package/dist/{packager-tool-17cn3xb7.js → packager-tool-6m078z5s.js} +13388 -19366
  97. package/dist/packager-tool-7b6tpg7y.js +77 -0
  98. package/dist/packager-tool-7exrv6w7.js +23 -0
  99. package/dist/packager-tool-8dszjcg5.js +4892 -0
  100. package/dist/packager-tool-8j92afwp.js +58 -0
  101. package/dist/packager-tool-94w17vf8.js +85 -0
  102. package/dist/{packager-tool-vdd02vns.js → packager-tool-9bec251q.js} +543 -1493
  103. package/dist/packager-tool-a1hbfmws.js +399 -0
  104. package/dist/{packager-tool-tq9q9m77.js → packager-tool-a42jnpy5.js} +3 -9
  105. package/dist/packager-tool-abbtfk2v.js +54 -0
  106. package/dist/packager-tool-cdwpc9fh.js +4945 -0
  107. package/dist/packager-tool-e0p2zsyc.js +97 -0
  108. package/dist/packager-tool-eebq62fq.js +540 -0
  109. package/dist/{packager-tool-m6x5sczh.js → packager-tool-em5r6g6j.js} +14 -21
  110. package/dist/packager-tool-eypvc2kv.js +23 -0
  111. package/dist/packager-tool-f0kd5kq4.js +2327 -0
  112. package/dist/packager-tool-fjaa8d3v.js +289 -0
  113. package/dist/packager-tool-g0eha8ge.js +121 -0
  114. package/dist/packager-tool-g9y14b10.js +54 -0
  115. package/dist/packager-tool-gbgfwx8f.js +2 -0
  116. package/dist/packager-tool-jc34wvrw.js +64 -0
  117. package/dist/packager-tool-k99nf3pq.js +25 -0
  118. package/dist/{packager-tool-hr0xg6q8.js → packager-tool-kn91khp6.js} +17 -13
  119. package/dist/{packager-tool-jysvpt8p.js → packager-tool-m3wkcxf5.js} +2 -2
  120. package/dist/{packager-tool-78a3szsp.js → packager-tool-m5qfverj.js} +1720 -2014
  121. package/dist/packager-tool-mwvbq6ef.js +79 -0
  122. package/dist/packager-tool-nq4rcqqg.js +87 -0
  123. package/dist/packager-tool-nxx8naxv.js +4234 -0
  124. package/dist/{packager-tool-3y0k15sv.js → packager-tool-p9stswjj.js} +2858 -19342
  125. package/dist/packager-tool-r0xpcqwg.js +188 -0
  126. package/dist/packager-tool-raq2wbwp.js +18 -0
  127. package/dist/{packager-tool-y3dezh8k.js → packager-tool-rs6jm14d.js} +6 -4
  128. package/dist/packager-tool-s9ff3kk4.js +6 -0
  129. package/dist/{packager-tool-pbsghbmj.js → packager-tool-sykgshez.js} +2 -2
  130. package/dist/packager-tool-tf3d2y8z.js +31 -0
  131. package/dist/packager-tool-tn5e7wnb.js +384 -0
  132. package/dist/packager-tool-v2rkcehq.js +457 -0
  133. package/dist/packager-tool-v86fdwvs.js +262 -0
  134. package/dist/packager-tool-v9psxdy5.js +8185 -0
  135. package/dist/packager-tool-v9rrz038.js +602 -0
  136. package/dist/packager-tool-vpqyvh4c.js +304 -0
  137. package/dist/packager-tool-wcha0e5r.js +443 -0
  138. package/dist/{packager-tool-1gt6js73.js → packager-tool-xhzfwa5p.js} +6 -4
  139. package/dist/{packager-tool-5arsyj36.js → packager-tool-yc4kw997.js} +4 -2
  140. package/dist/{packager-tool-pkq70dec.js → packager-tool-ywqc9rtf.js} +31 -3
  141. package/dist/{packager-tool-0567pxpm.js → packager-tool-z9bfhmm5.js} +10 -10
  142. package/dist/{packager-tool-gmrwvnyh.js → packager-tool-zfrp8ecz.js} +8 -58
  143. package/dist/{packager-tool-3vdpx9ng.js → packager-tool-zke08y39.js} +1121 -1846
  144. package/dist/packager-tool.js +17 -17
  145. package/dist/{pt-7TR74ZMB-1g8my56g.js → pt-7TR74ZMB-bmphh4x2.js} +46 -46
  146. package/dist/{pt-BR-7XGDXRDJ-TR5D7JYL-533wvy7p.js → pt-BR-7DYX2YPT-LZYH4YFD-bx43vx3z.js} +857 -845
  147. package/dist/{pt-BR-7XGDXRDJ-espnkgrj.js → pt-BR-7DYX2YPT-fqxqzqtf.js} +857 -845
  148. package/dist/{pt-BR-BXURWX4W-dqr4dnf9.js → pt-BR-BXURWX4W-bwfcwhk1.js} +52 -52
  149. package/dist/{pt-BR-DXXSYJDO-bn84ewp7.js → pt-BR-DXXSYJDO-a2tp13v7.js} +46 -46
  150. package/dist/pt-BR-UQCYHKMJ-q78n7q70.js +35 -0
  151. package/dist/{pt-BR-Z3TUDJHM-n7ngej6s.js → pt-BR-Z3TUDJHM-8v73x9s7.js} +9 -9
  152. package/dist/pt-D6A6MVB2-yvxca8vz.js +35 -0
  153. package/dist/{pt-TMVOOITK-myha14p9.js → pt-HTXGGX6Y-97t21dty.js} +857 -845
  154. package/dist/{pt-TMVOOITK-H2ADYHSD-ezpggv33.js → pt-HTXGGX6Y-ZHQSDFKI-vehfxadc.js} +857 -845
  155. package/dist/{pt-KSBWHAVQ-hd52bpsz.js → pt-KSBWHAVQ-mhvhgr2p.js} +9 -9
  156. package/dist/{pt-YI4VE4YQ-v7gjeg82.js → pt-YI4VE4YQ-wdkn2dcf.js} +52 -52
  157. package/dist/ro-4TMBHS5M-jz0anpt6.js +35 -0
  158. package/dist/{ro-BJFER5OI-334n28rj.js → ro-BJFER5OI-83tq8vxh.js} +46 -46
  159. package/dist/{ro-2VALF3S5-NXBJUEZN-nqw1zs33.js → ro-KTNQ3MNU-XIE6YPQN-gen8p82z.js} +857 -845
  160. package/dist/{ro-2VALF3S5-cdz5afkr.js → ro-KTNQ3MNU-y08n1x5g.js} +857 -845
  161. package/dist/{ro-RKXZUG7Z-cm3xn3fj.js → ro-RKXZUG7Z-nndrrsq7.js} +52 -52
  162. package/dist/{ro-VZUZTAMR-tccygznf.js → ro-VZUZTAMR-f4q0g3em.js} +9 -9
  163. package/dist/{ru-GSCT4ARZ-qj8dm4dp.js → ru-GSCT4ARZ-1sa9wbr8.js} +1 -1
  164. package/dist/{ru-GSCT4ARZ-FTVCGQTL-5nh4jf2e.js → ru-GSCT4ARZ-FTVCGQTL-gee86v14.js} +1 -1
  165. package/dist/{ru-T73OPRTC-mp5gn7gs.js → ru-T73OPRTC-4knxw497.js} +1 -1
  166. package/dist/{ru-WBLQ5B2U-awt245ky.js → ru-WBLQ5B2U-8r3c7v6d.js} +1 -1
  167. package/dist/ru-WBLQ5B2U-kdey8qa4.js +10 -0
  168. package/dist/{ru-WBLQ5B2U-57ezmxzz.js → ru-WBLQ5B2U-wemdzdqd.js} +1 -1
  169. package/dist/{serialization-GAW7UFOK-9hkdmmd2.js → serialization-J5QK3HPY-bgewpt6f.js} +158 -152
  170. package/dist/services/expression-validator.d.ts +28 -0
  171. package/dist/services/flow-eval-schema/types.d.ts +17 -0
  172. package/dist/services/flow-validate-service.d.ts +26 -0
  173. package/dist/services/node-validators/js-expression-syntax-validator.d.ts +6 -3
  174. package/dist/services/tidy-service.d.ts +26 -0
  175. package/dist/services/vars-reference-rule.d.ts +156 -0
  176. package/dist/shared-utils-8xdq6f04.js +20 -0
  177. package/dist/tidy-service-ashgyfwj.js +34 -0
  178. package/dist/tool.js +30 -33
  179. package/dist/{tr-AA6O2WSR-ga1xnymp.js → tr-AA6O2WSR-86ba4bdf.js} +52 -52
  180. package/dist/tr-GSQQ6SOT-hv1gyeaa.js +35 -0
  181. package/dist/{tr-RQTZ2DMS-bpgd4kma.js → tr-RQTZ2DMS-w3cwv8s4.js} +46 -46
  182. package/dist/{tr-W4AVRSQ4-bt3qqqdy.js → tr-W4AVRSQ4-hjr81xzk.js} +9 -9
  183. package/dist/{tr-RIFCEXFH-BZS7S7QK-q465b62g.js → tr-XHSSPNK7-GW5KVXR3-2w3f1ss6.js} +857 -845
  184. package/dist/{tr-RIFCEXFH-hgkb4g8y.js → tr-XHSSPNK7-cmqyc4wd.js} +857 -845
  185. package/dist/utils/handle-expansion.d.ts +16 -0
  186. package/dist/validation.js +47 -27
  187. package/dist/variable-service-er7ph4br.js +152 -0
  188. package/dist/wait-for-flow-job-45p1a444.js +134 -0
  189. package/dist/{zh-CN-IP3FMXWM-H3JI2XUM-ta4yac7h.js → zh-CN-2EHQT23P-T5XRQCVS-ac17dpc1.js} +857 -845
  190. package/dist/{zh-CN-IP3FMXWM-1cfarhcp.js → zh-CN-2EHQT23P-mr63c4xz.js} +857 -845
  191. package/dist/{zh-CN-6YRAN57T-j7jp34ws.js → zh-CN-6YRAN57T-rd7x2tqs.js} +9 -9
  192. package/dist/zh-CN-EDFRBU32-vvj7tmaq.js +35 -0
  193. package/dist/{zh-CN-R2KLHXQV-wttmznep.js → zh-CN-R2KLHXQV-agqr45ds.js} +52 -52
  194. package/dist/{zh-CN-ZC6LT4IN-vty9mvv8.js → zh-CN-ZC6LT4IN-kbzvvzz5.js} +46 -46
  195. package/dist/zh-TW-HAICM6DE-rh7k3cq7.js +35 -0
  196. package/dist/{zh-TW-AGIDXIPF-R4XZRDJZ-cgxxz5k4.js → zh-TW-MGZCE5BT-P6FLIUAR-zmq07vhs.js} +857 -845
  197. package/dist/{zh-TW-AGIDXIPF-n6r6w7vy.js → zh-TW-MGZCE5BT-c4ekmrz9.js} +857 -845
  198. package/dist/{zh-TW-R7Y5KVMU-q81f4z2p.js → zh-TW-R7Y5KVMU-m61y07e3.js} +46 -46
  199. package/dist/{zh-TW-RJGCQANM-gqn0aca0.js → zh-TW-RJGCQANM-w0x3qc1p.js} +52 -52
  200. package/dist/{zh-TW-SO2245GN-m5kh88bg.js → zh-TW-SO2245GN-n2bn1gg4.js} +9 -9
  201. package/package.json +2 -2
  202. package/dist/de-5KVP66U6-t37qr521.js +0 -161
  203. package/dist/de-WMKOGI7B-6dc1zdnp.js +0 -143
  204. package/dist/en-4KXU7N7B-24v330b5.js +0 -118
  205. package/dist/en-X4DLPKLJ-1h9gj5c1.js +0 -110
  206. package/dist/es-BVPGJUWA-0k59eqfv.js +0 -143
  207. package/dist/es-MX-U6YL5KQX-k4qvpgd4.js +0 -143
  208. package/dist/es-MX-XAVLOQW3-47a405kf.js +0 -161
  209. package/dist/es-VFPNVMP5-6sftsdxe.js +0 -161
  210. package/dist/fr-E5MDO4EG-f3x1jeqw.js +0 -161
  211. package/dist/fr-EKTTDR7Z-m2t68j0m.js +0 -143
  212. package/dist/ja-DPO5PPLO-fmbg7zt2.js +0 -161
  213. package/dist/ja-Y2YBTXNN-5sszk2zv.js +0 -143
  214. package/dist/ko-ITOPNIYI-aqy82jk8.js +0 -161
  215. package/dist/ko-S33XAV26-rfsv9myd.js +0 -143
  216. package/dist/packager-tool-0sz8se22.js +0 -10671
  217. package/dist/packager-tool-8mqydhz8.js +0 -9850
  218. package/dist/packager-tool-p9j43p8h.js +0 -115
  219. package/dist/packager-tool-v74yk918.js +0 -107
  220. package/dist/packager-tool-xj0agqpk.js +0 -11
  221. package/dist/pt-BR-BXURWX4W-xzyndmrx.js +0 -161
  222. package/dist/pt-BR-JO45SCNI-mt93s33c.js +0 -143
  223. package/dist/pt-W3NA4LIZ-fwd1q4j0.js +0 -143
  224. package/dist/pt-YI4VE4YQ-521681zf.js +0 -161
  225. package/dist/ro-RKXZUG7Z-pdztdafr.js +0 -161
  226. package/dist/ro-WLKX6HF5-b9tj8q67.js +0 -143
  227. package/dist/ru-WBLQ5B2U-8xd4gpv2.js +0 -10
  228. package/dist/ru-WBLQ5B2U-mswqs9wc.js +0 -10
  229. package/dist/tr-3U2W2XCA-43ptfc0m.js +0 -143
  230. package/dist/tr-AA6O2WSR-bj9n80k8.js +0 -161
  231. package/dist/zh-CN-IPZYQR3P-egjmvyjf.js +0 -143
  232. package/dist/zh-CN-R2KLHXQV-x6gnk2n0.js +0 -161
  233. package/dist/zh-TW-RJGCQANM-tt8j5wv2.js +0 -161
  234. package/dist/zh-TW-YPVSQVGT-b378ztph.js +0 -143
@@ -0,0 +1,757 @@
1
+ import {
2
+ enableErrorHandlingForErrorEdges,
3
+ expandHandleIds
4
+ } from "./packager-tool-nq4rcqqg.js";
5
+ import {
6
+ readFlowWorkflow,
7
+ writeFlowWorkflow
8
+ } from "./packager-tool-94w17vf8.js";
9
+ import {
10
+ DEFAULT_LAYOUT_OPTIONS,
11
+ GRID_SPACING,
12
+ resolveHeight,
13
+ resolveWidth,
14
+ snapToGrid
15
+ } from "./packager-tool-tn5e7wnb.js";
16
+ import {
17
+ generateNodeVariables
18
+ } from "./packager-tool-vpqyvh4c.js";
19
+ import {
20
+ __require,
21
+ __toESM
22
+ } from "./packager-tool-1yh8g550.js";
23
+
24
+ // ../../node_modules/@uipath/flow-core/dist/layout.js
25
+ function analyzeArtifactConnections(edges, nodePortsMap) {
26
+ const groupMap = /* @__PURE__ */ new Map;
27
+ const artifactNodeIds = /* @__PURE__ */ new Set;
28
+ for (const edge of edges) {
29
+ const sourceHandle = edge.sourceHandle;
30
+ if (!sourceHandle)
31
+ continue;
32
+ const sourcePorts = nodePortsMap.get(edge.source);
33
+ if (!sourcePorts)
34
+ continue;
35
+ const port = sourcePorts.find((p) => p.id === sourceHandle);
36
+ if (!port || port.side !== "NORTH" && port.side !== "SOUTH")
37
+ continue;
38
+ const parentId = edge.source;
39
+ const artifactId = edge.target;
40
+ artifactNodeIds.add(artifactId);
41
+ let parentGroups = groupMap.get(parentId);
42
+ if (!parentGroups) {
43
+ parentGroups = /* @__PURE__ */ new Map;
44
+ groupMap.set(parentId, parentGroups);
45
+ }
46
+ let group = parentGroups.get(sourceHandle);
47
+ if (!group) {
48
+ group = { side: port.side, nodeIds: [], artifactHandleMap: /* @__PURE__ */ new Map };
49
+ parentGroups.set(sourceHandle, group);
50
+ }
51
+ if (!group.nodeIds.includes(artifactId)) {
52
+ group.nodeIds.push(artifactId);
53
+ if (edge.targetHandle) {
54
+ group.artifactHandleMap.set(artifactId, edge.targetHandle);
55
+ }
56
+ }
57
+ }
58
+ const artifactGroups = [];
59
+ for (const [parentId, handleMap] of groupMap) {
60
+ const parentPorts = nodePortsMap.get(parentId) ?? [];
61
+ for (const [sourceHandle, group] of handleMap) {
62
+ const parentPort = parentPorts.find((p) => p.id === sourceHandle);
63
+ artifactGroups.push({
64
+ parentId,
65
+ side: group.side,
66
+ sourceHandle,
67
+ parentPortIndex: parentPort?.index ?? 0,
68
+ artifactNodeIds: [...group.nodeIds],
69
+ artifactToHandle: group.artifactHandleMap
70
+ });
71
+ }
72
+ }
73
+ return { artifactGroups, artifactNodeIds };
74
+ }
75
+ function buildArtifactParentWrappers(artifactGroups) {
76
+ const wrapperMap = /* @__PURE__ */ new Map;
77
+ for (const group of artifactGroups) {
78
+ let wrapper = wrapperMap.get(group.parentId);
79
+ if (!wrapper) {
80
+ wrapper = { parentId: group.parentId, northGroups: [], southGroups: [] };
81
+ wrapperMap.set(group.parentId, wrapper);
82
+ }
83
+ if (group.side === "NORTH")
84
+ wrapper.northGroups.push(group);
85
+ else
86
+ wrapper.southGroups.push(group);
87
+ }
88
+ for (const wrapper of wrapperMap.values()) {
89
+ wrapper.northGroups.sort((a, b) => a.parentPortIndex - b.parentPortIndex);
90
+ wrapper.southGroups.sort((a, b) => a.parentPortIndex - b.parentPortIndex);
91
+ }
92
+ return Array.from(wrapperMap.values());
93
+ }
94
+ var ARTIFACT_GROUP_SPACING = 96;
95
+ var ARTIFACT_HORIZONTAL_SPACING = ARTIFACT_GROUP_SPACING / 2;
96
+ var edgeNodeClearance = (options) => snapToGrid(options.layerSpacing / 2);
97
+ var EDGE_EDGE_CLEARANCE_PX = GRID_SPACING;
98
+ var GRID_PADDING = `[top=${GRID_SPACING},left=${GRID_SPACING},bottom=${GRID_SPACING},right=${GRID_SPACING}]`;
99
+ function makeGroupId(group) {
100
+ return `${group.parentId}__${group.sourceHandle}_group`;
101
+ }
102
+ function computeElkPortIndices(ports) {
103
+ const bySide = /* @__PURE__ */ new Map;
104
+ for (const p of ports) {
105
+ if (!bySide.has(p.side))
106
+ bySide.set(p.side, []);
107
+ bySide.get(p.side).push(p);
108
+ }
109
+ const result = /* @__PURE__ */ new Map;
110
+ for (const [side, sidePorts] of bySide) {
111
+ const sorted = [...sidePorts].sort((a, b) => a.index - b.index);
112
+ const reverse = side === "SOUTH" || side === "WEST";
113
+ sorted.forEach((p, i) => {
114
+ result.set(p.id, reverse ? sorted.length - 1 - i : i);
115
+ });
116
+ }
117
+ return result;
118
+ }
119
+ var warmElkLayoutChunk = () => import("./elk.bundled-vpsbxz0p.js").then((m)=>__toESM(m.default,1));
120
+ var ElkLayoutEngine = class {
121
+ constructor(elk) {
122
+ this.elkPromise = null;
123
+ if (elk)
124
+ this.elkPromise = Promise.resolve(elk);
125
+ }
126
+ getElk() {
127
+ if (!this.elkPromise) {
128
+ this.elkPromise = warmElkLayoutChunk().then((m) => new m.default);
129
+ }
130
+ return this.elkPromise;
131
+ }
132
+ async layoutHierarchical(root) {
133
+ const elk = await this.getElk();
134
+ return elk.layout(root);
135
+ }
136
+ async layout(nodes, edges, options, resolveNodePorts) {
137
+ const startTime = performance.now();
138
+ const nodePortsMap = this.collectPorts(nodes, options, resolveNodePorts);
139
+ const { artifactGroups, artifactNodeIds } = analyzeArtifactConnections(edges, nodePortsMap);
140
+ const graph = this.buildHierarchicalGraph(nodes, edges, nodePortsMap, artifactGroups, artifactNodeIds, options);
141
+ const elk = await this.getElk();
142
+ const layouted = await elk.layout(graph);
143
+ const updatedNodes = this.extractNodePositions(nodes, layouted);
144
+ const edgeWaypoints = this.extractEdgeWaypoints(layouted, new Set(edges.map((e) => e.id)));
145
+ const endTime = performance.now();
146
+ const metrics = this.calculateMetrics(layouted, endTime - startTime);
147
+ return { nodes: updatedNodes, edgeWaypoints, metrics };
148
+ }
149
+ collectPorts(nodes, options, resolveNodePorts) {
150
+ const nodePortsMap = /* @__PURE__ */ new Map;
151
+ for (const node of nodes) {
152
+ const ports = resolveNodePorts(node, options);
153
+ if (ports.length > 0) {
154
+ nodePortsMap.set(node.id, ports);
155
+ }
156
+ }
157
+ return nodePortsMap;
158
+ }
159
+ buildHierarchicalGraph(nodes, edges, nodePortsMap, artifactGroups, artifactNodeIds, options) {
160
+ const nodeMap = new Map(nodes.map((n) => [n.id, n]));
161
+ const parentWrappers = buildArtifactParentWrappers(artifactGroups);
162
+ const wrappedParentIds = new Set(parentWrappers.map((w) => w.parentId));
163
+ const rootChildren = [];
164
+ for (const node of nodes) {
165
+ if (artifactNodeIds.has(node.id) || wrappedParentIds.has(node.id))
166
+ continue;
167
+ rootChildren.push(this.createElkNode(node, nodePortsMap));
168
+ }
169
+ for (const wrapper of parentWrappers) {
170
+ const parentNode = nodeMap.get(wrapper.parentId);
171
+ rootChildren.push(this.createWrapperNode(wrapper, parentNode, nodePortsMap, nodeMap, options));
172
+ }
173
+ const elkEdges = this.buildEdges(edges, wrappedParentIds, artifactNodeIds, nodePortsMap);
174
+ return {
175
+ id: "root",
176
+ layoutOptions: this.getLayoutOptions(options),
177
+ children: rootChildren,
178
+ edges: elkEdges
179
+ };
180
+ }
181
+ createElkNode(node, nodePortsMap) {
182
+ const ports = nodePortsMap.get(node.id) ?? [];
183
+ const elkIndices = computeElkPortIndices(ports);
184
+ const elkPorts = ports.map((port) => ({
185
+ id: `${node.id}_${port.id}`,
186
+ layoutOptions: { "port.side": port.side, "port.index": (elkIndices.get(port.id) ?? port.index).toString() }
187
+ }));
188
+ return {
189
+ id: node.id,
190
+ width: resolveWidth(node),
191
+ height: resolveHeight(node),
192
+ ports: elkPorts.length > 0 ? elkPorts : undefined,
193
+ layoutOptions: elkPorts.length > 0 ? { portConstraints: "FIXED_ORDER" } : undefined
194
+ };
195
+ }
196
+ createWrapperNode(wrapper, parentNode, nodePortsMap, nodeMap, options) {
197
+ const wrapperId = `${wrapper.parentId}_wrapper`;
198
+ const wrapperChildren = [];
199
+ for (const group of wrapper.northGroups) {
200
+ const child = this.createGroupNode(group, nodePortsMap, nodeMap, options);
201
+ child.layoutOptions = { ...child.layoutOptions, "elk.partitioning.partition": "0" };
202
+ wrapperChildren.push(child);
203
+ }
204
+ const parentPorts = nodePortsMap.get(wrapper.parentId) ?? [];
205
+ const parentElkIndices = computeElkPortIndices(parentPorts);
206
+ const parentElkPorts = parentPorts.map((port) => ({
207
+ id: `${wrapper.parentId}_${port.id}`,
208
+ layoutOptions: { "port.side": port.side, "port.index": (parentElkIndices.get(port.id) ?? port.index).toString() }
209
+ }));
210
+ wrapperChildren.push({
211
+ id: wrapper.parentId,
212
+ width: resolveWidth(parentNode),
213
+ height: resolveHeight(parentNode),
214
+ ports: parentElkPorts.length > 0 ? parentElkPorts : undefined,
215
+ layoutOptions: {
216
+ ...parentElkPorts.length > 0 ? { portConstraints: "FIXED_ORDER" } : {},
217
+ "elk.partitioning.partition": "1"
218
+ }
219
+ });
220
+ for (const group of wrapper.southGroups) {
221
+ const child = this.createGroupNode(group, nodePortsMap, nodeMap, options);
222
+ child.layoutOptions = { ...child.layoutOptions, "elk.partitioning.partition": "2" };
223
+ wrapperChildren.push(child);
224
+ }
225
+ const wrapperPorts = parentPorts.filter((p) => p.side === "WEST" || p.side === "EAST").map((port) => ({
226
+ id: `${wrapperId}_${port.id}`,
227
+ layoutOptions: { "port.side": port.side, "port.index": (parentElkIndices.get(port.id) ?? port.index).toString() }
228
+ }));
229
+ const internalEdges = [];
230
+ for (const group of [...wrapper.northGroups, ...wrapper.southGroups]) {
231
+ const groupId = makeGroupId(group);
232
+ internalEdges.push({
233
+ id: `internal_${wrapper.parentId}_${group.sourceHandle}_to_${groupId}`,
234
+ sources: [`${wrapper.parentId}_${group.sourceHandle}`],
235
+ targets: [`${groupId}_port`]
236
+ });
237
+ }
238
+ return {
239
+ id: wrapperId,
240
+ children: wrapperChildren,
241
+ edges: internalEdges.length > 0 ? internalEdges : undefined,
242
+ ports: wrapperPorts.length > 0 ? wrapperPorts : undefined,
243
+ layoutOptions: {
244
+ "elk.algorithm": "layered",
245
+ "elk.direction": "DOWN",
246
+ "elk.spacing.nodeNode": ARTIFACT_GROUP_SPACING.toString(),
247
+ "elk.layered.spacing.nodeNodeBetweenLayers": ARTIFACT_GROUP_SPACING.toString(),
248
+ "elk.padding": "[top=0,left=0,bottom=0,right=0]",
249
+ portConstraints: "FIXED_SIDE",
250
+ "elk.alignment": "CENTER",
251
+ "elk.layered.nodePlacement.strategy": "BRANDES_KOEPF",
252
+ "elk.layered.nodePlacement.bk.fixedAlignment": "BALANCED",
253
+ "elk.layered.nodePlacement.bk.edgeStraightening": "IMPROVE_STRAIGHTNESS",
254
+ "elk.partitioning.activate": "true"
255
+ }
256
+ };
257
+ }
258
+ createGroupNode(group, nodePortsMap, nodeMap, _options) {
259
+ const groupId = makeGroupId(group);
260
+ const children = group.artifactNodeIds.map((artifactId, index) => {
261
+ const node = nodeMap.get(artifactId);
262
+ const ports = nodePortsMap.get(artifactId) ?? [];
263
+ const elkIndices = computeElkPortIndices(ports);
264
+ const elkPorts = ports.map((port) => ({
265
+ id: `${artifactId}_${port.id}`,
266
+ layoutOptions: { "port.side": port.side, "port.index": (elkIndices.get(port.id) ?? port.index).toString() }
267
+ }));
268
+ if (index > 0) {
269
+ elkPorts.push({ id: `${artifactId}_chain_in`, layoutOptions: { "port.side": "WEST", "port.index": "100" } });
270
+ }
271
+ if (index < group.artifactNodeIds.length - 1) {
272
+ elkPorts.push({ id: `${artifactId}_chain_out`, layoutOptions: { "port.side": "EAST", "port.index": "100" } });
273
+ }
274
+ return {
275
+ id: artifactId,
276
+ width: node ? resolveWidth(node) : 96,
277
+ height: node ? resolveHeight(node) : 96,
278
+ ports: elkPorts.length > 0 ? elkPorts : undefined,
279
+ layoutOptions: { portConstraints: "FIXED_SIDE" }
280
+ };
281
+ });
282
+ const chainEdges = [];
283
+ for (let i = 0;i < group.artifactNodeIds.length - 1; i++) {
284
+ const sourceId = group.artifactNodeIds[i];
285
+ const targetId = group.artifactNodeIds[i + 1];
286
+ chainEdges.push({
287
+ id: `${groupId}_chain_${i}`,
288
+ sources: [`${sourceId}_chain_out`],
289
+ targets: [`${targetId}_chain_in`]
290
+ });
291
+ }
292
+ const groupPort = {
293
+ id: `${groupId}_port`,
294
+ layoutOptions: {
295
+ "port.side": group.side === "NORTH" ? "SOUTH" : "NORTH",
296
+ "port.index": "0"
297
+ }
298
+ };
299
+ return {
300
+ id: groupId,
301
+ children,
302
+ edges: chainEdges.length > 0 ? chainEdges : undefined,
303
+ ports: [groupPort],
304
+ layoutOptions: {
305
+ "elk.algorithm": "layered",
306
+ "elk.direction": "RIGHT",
307
+ "elk.spacing.nodeNode": ARTIFACT_HORIZONTAL_SPACING.toString(),
308
+ "elk.layered.spacing.nodeNodeBetweenLayers": ARTIFACT_HORIZONTAL_SPACING.toString(),
309
+ "elk.padding": "[top=0,left=0,bottom=0,right=0]",
310
+ portConstraints: "FIXED_SIDE"
311
+ }
312
+ };
313
+ }
314
+ buildEdges(edges, wrappedParentIds, artifactNodeIds, nodePortsMap) {
315
+ const elkEdges = [];
316
+ for (const edge of edges) {
317
+ const sourceHandle = edge.sourceHandle;
318
+ const targetHandle = edge.targetHandle;
319
+ if (artifactNodeIds.has(edge.target))
320
+ continue;
321
+ let sourceRef;
322
+ if (wrappedParentIds.has(edge.source) && sourceHandle) {
323
+ sourceRef = `${edge.source}_wrapper_${sourceHandle}`;
324
+ } else if (sourceHandle && this.hasPort(nodePortsMap, edge.source, sourceHandle)) {
325
+ sourceRef = `${edge.source}_${sourceHandle}`;
326
+ } else {
327
+ sourceRef = edge.source;
328
+ }
329
+ let targetRef;
330
+ if (wrappedParentIds.has(edge.target) && targetHandle) {
331
+ targetRef = `${edge.target}_wrapper_${targetHandle}`;
332
+ } else if (targetHandle && this.hasPort(nodePortsMap, edge.target, targetHandle)) {
333
+ targetRef = `${edge.target}_${targetHandle}`;
334
+ } else {
335
+ targetRef = edge.target;
336
+ }
337
+ elkEdges.push({ id: edge.id, sources: [sourceRef], targets: [targetRef] });
338
+ }
339
+ return elkEdges;
340
+ }
341
+ hasPort(nodePortsMap, nodeId, handleId) {
342
+ const ports = nodePortsMap.get(nodeId);
343
+ return ports != null && ports.some((p) => p.id === handleId);
344
+ }
345
+ extractNodePositions(nodes, layouted) {
346
+ const nodePositions = /* @__PURE__ */ new Map;
347
+ for (const child of layouted.children ?? []) {
348
+ if (child.id.endsWith("_wrapper")) {
349
+ const wrapperX = child.x ?? 0;
350
+ const wrapperY = child.y ?? 0;
351
+ for (const wrapperChild of child.children ?? []) {
352
+ if (wrapperChild.id.endsWith("_group")) {
353
+ const groupX = wrapperX + (wrapperChild.x ?? 0);
354
+ const groupY = wrapperY + (wrapperChild.y ?? 0);
355
+ for (const artifact of wrapperChild.children ?? []) {
356
+ nodePositions.set(artifact.id, {
357
+ x: snapToGrid(groupX + (artifact.x ?? 0)),
358
+ y: snapToGrid(groupY + (artifact.y ?? 0))
359
+ });
360
+ }
361
+ } else {
362
+ nodePositions.set(wrapperChild.id, {
363
+ x: snapToGrid(wrapperX + (wrapperChild.x ?? 0)),
364
+ y: snapToGrid(wrapperY + (wrapperChild.y ?? 0))
365
+ });
366
+ }
367
+ }
368
+ } else {
369
+ nodePositions.set(child.id, {
370
+ x: snapToGrid(child.x ?? 0),
371
+ y: snapToGrid(child.y ?? 0)
372
+ });
373
+ }
374
+ }
375
+ return nodes.map((node) => {
376
+ const pos = nodePositions.get(node.id);
377
+ if (!pos)
378
+ return node;
379
+ return { ...node, position: { x: pos.x, y: pos.y } };
380
+ });
381
+ }
382
+ extractEdgeWaypoints(root, realEdgeIds) {
383
+ const result = /* @__PURE__ */ new Map;
384
+ for (const edge of root.edges ?? []) {
385
+ if (!realEdgeIds.has(edge.id))
386
+ continue;
387
+ const points = (edge.sections ?? []).flatMap((s) => s.bendPoints ?? []).map((p) => ({ x: snapToGrid(p.x), y: snapToGrid(p.y) }));
388
+ if (points.length > 0)
389
+ result.set(edge.id, points);
390
+ }
391
+ return result;
392
+ }
393
+ getLayoutOptions(options) {
394
+ const opts = {
395
+ "elk.algorithm": options.algorithm,
396
+ "elk.direction": options.direction,
397
+ "elk.spacing.nodeNode": options.nodeSpacing.toString(),
398
+ "elk.layered.considerModelOrder.strategy": "NODES_AND_EDGES",
399
+ "elk.padding": GRID_PADDING
400
+ };
401
+ switch (options.algorithm) {
402
+ case "layered":
403
+ opts["elk.layered.spacing.nodeNodeBetweenLayers"] = options.layerSpacing.toString();
404
+ opts["elk.layered.nodePlacement.strategy"] = "NETWORK_SIMPLEX";
405
+ opts["elk.layered.layering.strategy"] = "NETWORK_SIMPLEX";
406
+ if (options.minimizeCrossings) {
407
+ opts["elk.layered.crossingMinimization.strategy"] = "LAYER_SWEEP";
408
+ }
409
+ opts["elk.layered.cycleBreaking.strategy"] = "GREEDY_MODEL_ORDER";
410
+ opts["elk.spacing.edgeNode"] = options.nodeSpacing.toString();
411
+ opts["elk.spacing.edgeEdge"] = EDGE_EDGE_CLEARANCE_PX.toString();
412
+ opts["elk.layered.spacing.edgeNodeBetweenLayers"] = edgeNodeClearance(options).toString();
413
+ opts["elk.edgeRouting"] = "ORTHOGONAL";
414
+ break;
415
+ case "mrtree":
416
+ opts["elk.spacing.nodeNode"] = options.nodeSpacing.toString();
417
+ break;
418
+ }
419
+ return opts;
420
+ }
421
+ calculateMetrics(elkGraph, executionTime) {
422
+ const children = elkGraph.children || [];
423
+ let minX = Infinity;
424
+ let minY = Infinity;
425
+ let maxX = -Infinity;
426
+ let maxY = -Infinity;
427
+ for (const node of children) {
428
+ const x = node.x || 0;
429
+ const y = node.y || 0;
430
+ const width = node.width || 0;
431
+ const height = node.height || 0;
432
+ minX = Math.min(minX, x);
433
+ minY = Math.min(minY, y);
434
+ maxX = Math.max(maxX, x + width);
435
+ maxY = Math.max(maxY, y + height);
436
+ }
437
+ return { totalWidth: maxX - minX, totalHeight: maxY - minY, executionTime };
438
+ }
439
+ };
440
+
441
+ // src/services/tidy-service.ts
442
+ var COLLAPSED_NODE_SIZE = 96;
443
+ var EXPANDED_RECTANGLE_WIDTH = 288;
444
+ var CONTAINER_SIZE = { width: 560, height: 320 };
445
+ function expandedSizeForShape(shape) {
446
+ if (shape === "container") {
447
+ return { ...CONTAINER_SIZE };
448
+ }
449
+ return {
450
+ width: shape === "rectangle" ? EXPANDED_RECTANGLE_WIDTH : COLLAPSED_NODE_SIZE,
451
+ height: COLLAPSED_NODE_SIZE
452
+ };
453
+ }
454
+ var UI_ONLY_NODE_TYPES = new Set(["stickyNote"]);
455
+ function identifyArtifactChildIds(edges, portResolver, nodes) {
456
+ const ids = new Set;
457
+ for (const edge of edges) {
458
+ if (!edge.sourceHandle)
459
+ continue;
460
+ const sourceNode = nodes.find((n) => n.id === edge.source);
461
+ if (!sourceNode)
462
+ continue;
463
+ const ports = portResolver(sourceNode, DEFAULT_LAYOUT_OPTIONS);
464
+ const port = ports.find((p) => p.id === edge.sourceHandle);
465
+ if (port && (port.side === "NORTH" || port.side === "SOUTH")) {
466
+ ids.add(edge.target);
467
+ }
468
+ }
469
+ return ids;
470
+ }
471
+ function collectArtifactDescendants(startIds, edges, artifactChildIds) {
472
+ const result = new Set;
473
+ const queue = [...startIds];
474
+ while (queue.length > 0) {
475
+ const id = queue.shift();
476
+ if (!id)
477
+ break;
478
+ for (const edge of edges) {
479
+ if (edge.source === id && artifactChildIds.has(edge.target) && !result.has(edge.target)) {
480
+ result.add(edge.target);
481
+ queue.push(edge.target);
482
+ }
483
+ }
484
+ }
485
+ return result;
486
+ }
487
+ function propagateHiddenArtifactPositions(layoutedNodes, preLayoutPositions, hiddenNodes, edges, artifactChildIds) {
488
+ const layoutPositionMap = new Map(layoutedNodes.map((n) => [n.id, n.position]));
489
+ const updates = [];
490
+ const collapsedLayouted = layoutedNodes.filter((n) => n.data?.ui?.isCollapsed);
491
+ const updatedIds = new Set;
492
+ for (const collapsed of collapsedLayouted) {
493
+ const oldPos = preLayoutPositions.get(collapsed.id);
494
+ if (!oldPos)
495
+ continue;
496
+ const dx = collapsed.position.x - oldPos.x;
497
+ const dy = collapsed.position.y - oldPos.y;
498
+ if (Math.abs(dx) < 1 && Math.abs(dy) < 1)
499
+ continue;
500
+ const descendants = collectArtifactDescendants(new Set([collapsed.id]), edges, artifactChildIds);
501
+ for (const childId of descendants) {
502
+ if (layoutPositionMap.has(childId))
503
+ continue;
504
+ if (updatedIds.has(childId))
505
+ continue;
506
+ const child = hiddenNodes.find((n) => n.id === childId);
507
+ if (!child)
508
+ continue;
509
+ updatedIds.add(childId);
510
+ updates.push({
511
+ ...child,
512
+ position: {
513
+ x: snapToGrid((child.position.x || 0) + dx),
514
+ y: snapToGrid((child.position.y || 0) + dy)
515
+ }
516
+ });
517
+ }
518
+ }
519
+ return updates;
520
+ }
521
+ function positionToSide(position) {
522
+ switch (position) {
523
+ case "left":
524
+ return "WEST";
525
+ case "right":
526
+ return "EAST";
527
+ case "top":
528
+ return "NORTH";
529
+ case "bottom":
530
+ case "bottom-left":
531
+ case "bottom-right":
532
+ return "SOUTH";
533
+ default:
534
+ return "EAST";
535
+ }
536
+ }
537
+ function buildPortResolver(definitions) {
538
+ const defMap = new Map;
539
+ for (const raw of definitions) {
540
+ if (raw != null && typeof raw === "object" && "nodeType" in raw && "version" in raw) {
541
+ const def = raw;
542
+ defMap.set(`${def.nodeType}:${def.version}`, def);
543
+ }
544
+ }
545
+ return (layoutNode) => {
546
+ const nodeInstance = layoutNode.data;
547
+ if (!nodeInstance) {
548
+ return defaultPorts();
549
+ }
550
+ const def = defMap.get(`${nodeInstance.type}:${nodeInstance.typeVersion}`);
551
+ if (!def?.handleConfiguration?.length) {
552
+ return defaultPorts();
553
+ }
554
+ const ports = [];
555
+ let portIndex = 0;
556
+ for (const group of def.handleConfiguration) {
557
+ const side = positionToSide(group.position);
558
+ for (const handle of group.handles) {
559
+ const expandedIds = expandHandleIds(handle, nodeInstance);
560
+ for (const id of expandedIds) {
561
+ ports.push({ id, side, index: portIndex++ });
562
+ }
563
+ }
564
+ }
565
+ return ports.length > 0 ? ports : defaultPorts();
566
+ };
567
+ }
568
+ function defaultPorts() {
569
+ return [
570
+ { id: "input", side: "WEST", index: 0 },
571
+ { id: "output", side: "EAST", index: 1 }
572
+ ];
573
+ }
574
+ function buildShapeResolver(definitions) {
575
+ const byKey = new Map;
576
+ const byType = new Map;
577
+ for (const raw of definitions) {
578
+ if (raw != null && typeof raw === "object" && "nodeType" in raw) {
579
+ const def = raw;
580
+ const shape = def.display?.shape;
581
+ if (def.version !== undefined) {
582
+ byKey.set(`${def.nodeType}:${def.version}`, shape);
583
+ }
584
+ if (!byType.has(def.nodeType)) {
585
+ byType.set(def.nodeType, shape);
586
+ }
587
+ }
588
+ }
589
+ return (node) => {
590
+ const instanceShape = node.display?.shape;
591
+ if (instanceShape) {
592
+ return instanceShape;
593
+ }
594
+ const keyed = byKey.get(`${node.type}:${node.typeVersion}`);
595
+ return keyed ?? byType.get(node.type);
596
+ };
597
+ }
598
+ function nodesToLayoutNodes(nodes, shapeOf) {
599
+ return nodes.map((node) => {
600
+ const size = UI_ONLY_NODE_TYPES.has(node.type) ? node.ui.size ?? {
601
+ width: COLLAPSED_NODE_SIZE,
602
+ height: COLLAPSED_NODE_SIZE
603
+ } : expandedSizeForShape(shapeOf(node));
604
+ return {
605
+ id: node.id,
606
+ position: { ...node.ui.position },
607
+ width: size.width,
608
+ height: size.height,
609
+ type: node.type,
610
+ data: node
611
+ };
612
+ });
613
+ }
614
+ function edgesToLayoutEdges(edges) {
615
+ return edges.map((edge) => ({
616
+ id: edge.id,
617
+ source: edge.sourceNodeId,
618
+ target: edge.targetNodeId,
619
+ sourceHandle: edge.sourcePort,
620
+ targetHandle: edge.targetPort
621
+ }));
622
+ }
623
+ function applyLayoutToNodes(nodes, layoutedNodes, shapeOf) {
624
+ const positionMap = new Map(layoutedNodes.map((n) => [n.id, n.position]));
625
+ let repositioned = 0;
626
+ let resized = 0;
627
+ for (const node of nodes) {
628
+ const newPos = positionMap.get(node.id);
629
+ if (!newPos)
630
+ continue;
631
+ const oldX = node.ui.position.x;
632
+ const oldY = node.ui.position.y;
633
+ if (oldX !== newPos.x || oldY !== newPos.y) {
634
+ node.ui.position = { x: newPos.x, y: newPos.y };
635
+ repositioned++;
636
+ }
637
+ if (UI_ONLY_NODE_TYPES.has(node.type)) {
638
+ continue;
639
+ }
640
+ const targetSize = expandedSizeForShape(shapeOf(node));
641
+ const currentSize = node.ui.size;
642
+ const sizeNeedsUpdate = currentSize?.width !== targetSize.width || currentSize?.height !== targetSize.height;
643
+ if (sizeNeedsUpdate) {
644
+ node.ui.size = targetSize;
645
+ resized++;
646
+ }
647
+ }
648
+ return { repositioned, resized };
649
+ }
650
+ async function tidyNodesAndEdges(engine, nodes, edges, portResolver, shapeOf) {
651
+ if (nodes.length === 0) {
652
+ return { repositioned: 0, resized: 0 };
653
+ }
654
+ const allNodes = nodesToLayoutNodes(nodes, shapeOf);
655
+ const allEdges = edgesToLayoutEdges(edges);
656
+ const artifactChildIds = identifyArtifactChildIds(allEdges, portResolver, allNodes);
657
+ const collapsedIds = new Set(allNodes.filter((n) => n.data?.ui?.isCollapsed).map((n) => n.id));
658
+ const hiddenIds = collectArtifactDescendants(collapsedIds, allEdges, artifactChildIds);
659
+ const layoutNodes = allNodes.filter((n) => !hiddenIds.has(n.id));
660
+ const layoutEdges = allEdges.filter((e) => !hiddenIds.has(e.source) && !hiddenIds.has(e.target));
661
+ const hiddenNodes = allNodes.filter((n) => hiddenIds.has(n.id));
662
+ if (layoutNodes.length === 0) {
663
+ return { repositioned: 0, resized: 0 };
664
+ }
665
+ const preLayoutPositions = new Map(layoutNodes.map((n) => [n.id, { ...n.position }]));
666
+ const leftmostNode = layoutNodes.reduce((left, node) => node.position.x < left.position.x ? node : left);
667
+ const originalLeftX = leftmostNode.position.x;
668
+ const originalLeftY = leftmostNode.position.y;
669
+ const { nodes: layoutedNodes } = await engine.layout(layoutNodes, layoutEdges, { ...DEFAULT_LAYOUT_OPTIONS, animate: false }, portResolver);
670
+ const layoutedLeftmost = layoutedNodes.find((n) => n.id === leftmostNode.id);
671
+ if (layoutedLeftmost) {
672
+ const offsetX = originalLeftX - layoutedLeftmost.position.x;
673
+ const offsetY = originalLeftY - layoutedLeftmost.position.y;
674
+ for (const node of layoutedNodes) {
675
+ node.position.x = snapToGrid(node.position.x + offsetX);
676
+ node.position.y = snapToGrid(node.position.y + offsetY);
677
+ }
678
+ }
679
+ const hiddenUpdates = propagateHiddenArtifactPositions(layoutedNodes, preLayoutPositions, hiddenNodes, allEdges, artifactChildIds);
680
+ const allUpdated = [...layoutedNodes, ...hiddenUpdates];
681
+ return applyLayoutToNodes(nodes, allUpdated, shapeOf);
682
+ }
683
+ async function tidyFlow(filePath) {
684
+ const { workflow, refMap } = await readFlowWorkflow(filePath);
685
+ const engine = new ElkLayoutEngine;
686
+ const portResolver = buildPortResolver(workflow.definitions);
687
+ const shapeResolver = buildShapeResolver(workflow.definitions);
688
+ const top = await tidyNodesAndEdges(engine, workflow.nodes, workflow.edges, portResolver, shapeResolver);
689
+ let nodeCount = workflow.nodes.length;
690
+ let edgeCount = workflow.edges.length;
691
+ let nodesRepositioned = top.repositioned;
692
+ let nodesResized = top.resized;
693
+ let subflowsTidied = 0;
694
+ if (workflow.subflows) {
695
+ const subflows = workflow.subflows;
696
+ for (const subflow of Object.values(subflows)) {
697
+ const sub = await tidyNodesAndEdges(engine, subflow.nodes, subflow.edges, portResolver, shapeResolver);
698
+ nodeCount += subflow.nodes.length;
699
+ edgeCount += subflow.edges.length;
700
+ nodesRepositioned += sub.repositioned;
701
+ nodesResized += sub.resized;
702
+ subflowsTidied += 1;
703
+ }
704
+ }
705
+ enableErrorHandlingForErrorEdges(workflow.nodes, workflow.edges);
706
+ if (workflow.subflows) {
707
+ const subflows = workflow.subflows;
708
+ for (const subflow of Object.values(subflows)) {
709
+ enableErrorHandlingForErrorEdges(subflow.nodes, subflow.edges);
710
+ }
711
+ }
712
+ if (nodeCount === 0) {
713
+ return {
714
+ nodeCount: 0,
715
+ edgeCount: 0,
716
+ nodesRepositioned: 0,
717
+ nodesResized: 0,
718
+ subflowsTidied: 0,
719
+ variableCount: 0
720
+ };
721
+ }
722
+ const variableCount = regenerateNodeVariables(workflow);
723
+ await writeFlowWorkflow(filePath, workflow, refMap);
724
+ return {
725
+ nodeCount,
726
+ edgeCount,
727
+ nodesRepositioned,
728
+ nodesResized,
729
+ subflowsTidied,
730
+ variableCount
731
+ };
732
+ }
733
+ function regenerateNodeVariables(workflow) {
734
+ const definitions = workflow.definitions ?? [];
735
+ const topNodeVars = generateNodeVariables(workflow.nodes, definitions);
736
+ workflow.variables = {
737
+ ...workflow.variables ?? {},
738
+ nodes: topNodeVars
739
+ };
740
+ let total = topNodeVars.length;
741
+ if (workflow.subflows) {
742
+ const subflows = workflow.subflows;
743
+ for (const subflow of Object.values(subflows)) {
744
+ const subNodeVars = generateNodeVariables(subflow.nodes, definitions);
745
+ subflow.variables = {
746
+ ...subflow.variables ?? {},
747
+ nodes: subNodeVars
748
+ };
749
+ total += subNodeVars.length;
750
+ }
751
+ }
752
+ return total;
753
+ }
754
+
755
+ export { UI_ONLY_NODE_TYPES, tidyFlow };
756
+
757
+ //# debugId=61782660AAF1BE9364756E2164756E21