@kern0x1b/penstock-cli 26.11.1 → 26.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (302) hide show
  1. package/THIRD-PARTY-NOTICES.md +16 -16
  2. package/dist/chunk-account-BaYNvO18.js +1 -0
  3. package/dist/{chunk-agentLaunch-D21uPuMr.js → chunk-agentLaunch-BnrpVME4.js} +1 -1
  4. package/dist/chunk-agentServe-BeOh1rjE.js +10 -0
  5. package/dist/chunk-agents-CZJoU2u2.js +1 -0
  6. package/dist/chunk-agentsMigrate-DnrqoXNz.js +2 -0
  7. package/dist/{chunk-analyze-BG-rlggA.js → chunk-analyze-ClE2LBCj.js} +1 -1
  8. package/dist/chunk-analyze-DgQqzEgb.js +1 -0
  9. package/dist/{chunk-analyzeFlow-2cYPgjh-.js → chunk-analyzeFlow-F2ZFmJhv.js} +1 -1
  10. package/dist/chunk-apiTemplates-Cl_z63FA.js +1 -0
  11. package/dist/{chunk-bot-DlhStBoG.js → chunk-bot-C2k8yaXA.js} +5 -5
  12. package/dist/chunk-cmmnFindings-DKpYqUZN.js +1 -0
  13. package/dist/{chunk-codeFactSet-LxSnQy8K.js → chunk-codeFactSet-DiAYqvbb.js} +1 -1
  14. package/dist/{chunk-codeIndex-N1gnP_sW.js → chunk-codeIndex-vStNh6Bm.js} +1 -1
  15. package/dist/chunk-codeLinks-BVpn4_Sr.js +1 -0
  16. package/dist/chunk-codeLinks-BrGduhsm.js +1 -0
  17. package/dist/chunk-command-8s6m3ZUw.js +5 -0
  18. package/dist/chunk-command-aMxPQdiV.js +1 -0
  19. package/dist/chunk-command-vH1_y5F0.js +1 -0
  20. package/dist/chunk-commands-B8YVT41b.js +5 -0
  21. package/dist/{chunk-commands-DcjlDt7B.js → chunk-commands-CJCSznbv.js} +1 -1
  22. package/dist/chunk-compose-BUJTvoFX.js +4 -0
  23. package/dist/chunk-connections-Drr67X9U.js +1 -0
  24. package/dist/chunk-connectors-DcMqy0u8.js +1 -0
  25. package/dist/chunk-convert-Ce1MZmsE.js +3 -0
  26. package/dist/chunk-convert-FkMnlxyi.js +1 -0
  27. package/dist/chunk-deploy-BHg8pB9x.js +1 -0
  28. package/dist/chunk-deploy-DZgCTgaY.js +6 -0
  29. package/dist/{chunk-diagrams-BukAOL0g.js → chunk-diagrams-CtGMGTa8.js} +1 -1
  30. package/dist/chunk-diff-9hjavV6V.js +1 -0
  31. package/dist/chunk-diff-Dp3fUALc.js +1 -0
  32. package/dist/chunk-dispatch-o-eqJb9Y.js +7 -0
  33. package/dist/chunk-dmnTests-BOxutoRs.js +1 -0
  34. package/dist/{chunk-dmnTests-ChwX1YVo.js → chunk-dmnTests-BzNA-u2k.js} +1 -1
  35. package/dist/{chunk-docs-D7yEDpa4.js → chunk-docs-B3C3pZpY.js} +17 -17
  36. package/dist/chunk-doctor-CRxbsAm7.js +1 -0
  37. package/dist/{chunk-editPreview-CC2vwhIW.js → chunk-editPreview-DCUnMkTU.js} +1 -1
  38. package/dist/chunk-evidence-ny_2ltVe.js +23 -0
  39. package/dist/{chunk-examples-0HkF-frb.js → chunk-examples-BG0lGXcZ.js} +9 -9
  40. package/dist/chunk-export-Blwjf23H.js +1 -0
  41. package/dist/chunk-export-kt3sBTZu.js +20 -0
  42. package/dist/{chunk-facts-DSVaURw5.js → chunk-facts-Dl5lLriU.js} +1 -1
  43. package/dist/chunk-failure-BRyRvObj.js +1 -0
  44. package/dist/{chunk-file-BswMa3FN.js → chunk-file-1YhfNmPn.js} +1 -1
  45. package/dist/chunk-import-Dh3az4BC.js +6 -0
  46. package/dist/chunk-importCommand-Dhikkmo0.js +1 -0
  47. package/dist/chunk-incident-LJe2-ohi.js +1 -0
  48. package/dist/chunk-init-D34Q4YA8.js +227 -0
  49. package/dist/chunk-lint-CnEhoYRB.js +1 -0
  50. package/dist/{chunk-lsp-7vA_mIt1.js → chunk-lsp-BzeJkpmf.js} +1 -1
  51. package/dist/chunk-main-BZF-ErAx.js +1 -0
  52. package/dist/chunk-mcp-B_B9bet5.js +95 -0
  53. package/dist/{chunk-mcpLaunch-LyfmIF_Z.js → chunk-mcpLaunch-BS709697.js} +1 -1
  54. package/dist/chunk-migrate-DVfXC-iJ.js +1 -0
  55. package/dist/chunk-migrate-DwWg0k5_.js +16 -0
  56. package/dist/{chunk-migrateApply-CzOkgKhB.js → chunk-migrateApply-e8O9oZXP.js} +3 -3
  57. package/dist/chunk-migrateVerify-oIBf-PM3.js +1 -0
  58. package/dist/{chunk-model-f8AzYUK7.js → chunk-model-BulEKnY1.js} +2 -2
  59. package/dist/{chunk-parse-B-uKGDy-.js → chunk-parse-DiOcpdOU.js} +1 -1
  60. package/dist/{chunk-penstockCli-CKMvaZ0O.js → chunk-penstockCli-C41P_G7i.js} +1 -1
  61. package/dist/chunk-policy-BVb7c7G_.js +1 -0
  62. package/dist/chunk-policyGate-BOgKsqLq.js +2 -0
  63. package/dist/chunk-pr-1jKcTNnP.js +1 -0
  64. package/dist/{chunk-project-DBYOlYRi.js → chunk-project-COaBZhMt.js} +1 -1
  65. package/dist/chunk-project-lO_6DX8G.js +1 -0
  66. package/dist/chunk-promotion-CTMPjXjZ.js +2 -0
  67. package/dist/chunk-promotion-DDLrgBqZ.js +1 -0
  68. package/dist/{chunk-promotion-DchO6xoC.js → chunk-promotion-NeRj4uTP.js} +1 -1
  69. package/dist/chunk-receipt-C4NqnSkH.js +1 -0
  70. package/dist/chunk-receiptDeps-B7MehyHT.js +1 -0
  71. package/dist/chunk-receiptGate-BZCKCMTV.js +1 -0
  72. package/dist/chunk-receiptGate-DRcw327y.js +1 -0
  73. package/dist/{chunk-receiptSnapshot-B6ruXw8z.js → chunk-receiptSnapshot-CHSk3_4N.js} +1 -1
  74. package/dist/{chunk-receiptStore-Cy-L0H1u.js → chunk-receiptStore-DhROtI2h.js} +1 -1
  75. package/dist/chunk-refactor-CO3qyIEv.js +17 -0
  76. package/dist/chunk-refactor-CWeCOl7w.js +1 -0
  77. package/dist/{chunk-render-Ci5d6mg4.js → chunk-render-DZd5hScS.js} +1 -1
  78. package/dist/chunk-report-w7YZwhyg.js +1 -0
  79. package/dist/chunk-review-DYMgFDSy.js +1 -0
  80. package/dist/chunk-say-CP1IyOSv.js +1 -0
  81. package/dist/{chunk-security-VgKwtohm.js → chunk-security-pgip-kdY.js} +2 -2
  82. package/dist/chunk-serve-CKt2rO05.js +10 -0
  83. package/dist/{chunk-share-CBV2FuKq.js → chunk-share-rsL0itIM.js} +18 -18
  84. package/dist/chunk-stages-B2sBBxUc.js +3 -0
  85. package/dist/chunk-systemError-O3vQ8hLb.js +1 -0
  86. package/dist/chunk-systemError-n2E6isvg.js +1 -0
  87. package/dist/chunk-taskTest-DWoME1mY.js +2 -0
  88. package/dist/chunk-taskTest-JErgWO6t.js +1 -0
  89. package/dist/{chunk-templateDiagnostics-BwH7RNkz.js → chunk-templateDiagnostics-6txfKwas.js} +2 -2
  90. package/dist/chunk-templates-Y3xfCO_3.js +1 -0
  91. package/dist/chunk-testCases-BwimUfDC.js +4 -0
  92. package/dist/chunk-testCases-DO2Rkyvd.js +1 -0
  93. package/dist/chunk-tests-Cy325OGw.js +1 -0
  94. package/dist/chunk-tests-DNkORsqB.js +23 -0
  95. package/dist/{chunk-trust-DXcsUJaK.js → chunk-trust-DSX-k3by.js} +1 -1
  96. package/dist/{chunk-trust-DubjEjlN.js → chunk-trust-Di4EYPah.js} +1 -1
  97. package/dist/{chunk-variableChecks-KnECGMR3.js → chunk-variableChecks-CBDpmI4d.js} +1 -1
  98. package/dist/{chunk-workerVariables-CajAcbwl.js → chunk-workerVariables-CNnCRijJ.js} +1 -1
  99. package/dist/{chunk-workerVariables-DIDoUpHF.js → chunk-workerVariables-CulLc3YH.js} +1 -1
  100. package/dist/chunk-wrapper-CGYED7G2.js +1 -0
  101. package/dist/chunk-wrapper-CK7Xtes6.js +3 -0
  102. package/dist/grammars/web-tree-sitter.wasm +0 -0
  103. package/dist/penstock.js +1 -1
  104. package/dist/web/assets/{AgentSettings-Cn5Vcph3.js → AgentSettings-D24jOuht.js} +1 -1
  105. package/dist/web/assets/{AgentsDialog-C6WqzlxZ.js → AgentsDialog-BMWv3Gyk.js} +1 -1
  106. package/dist/web/assets/{AgentsDialog-dpbwVSxk.js → AgentsDialog-DbY2O6O5.js} +1 -1
  107. package/dist/web/assets/{AgentsTab-C34OhVkw.js → AgentsTab-D6LbK6sG.js} +2 -2
  108. package/dist/web/assets/{BpmnCanvas-yur9daZa.js → BpmnCanvas-BcQRQ2Br.js} +27 -27
  109. package/dist/web/assets/BpmnDocument-Ce5F4K1e.js +27 -0
  110. package/dist/web/assets/CmmnDocument-C_UlPowC.js +17 -0
  111. package/dist/web/assets/{ConflictDialog-Bb5kduaR.js → ConflictDialog-DfFp8F7n.js} +1 -1
  112. package/dist/web/assets/{ConnectionsDialog-qtF7yDFw.js → ConnectionsDialog-BaYtHD5h.js} +1 -1
  113. package/dist/web/assets/{DiffDocument-LHOif5Ac.js → DiffDocument-BOPdBEN3.js} +1 -1
  114. package/dist/web/assets/{DmnDocument-0f5uS67x.css → DmnDocument-DZ9u2uk2.css} +1 -1
  115. package/dist/web/assets/DmnDocument-vtnARy7Q.js +41 -0
  116. package/dist/web/assets/{DriftDialog-Chl6BX6k.js → DriftDialog-dIbCbSK2.js} +1 -1
  117. package/dist/web/assets/FormDocument-B0q8DF9v.css +1 -0
  118. package/dist/web/assets/FormDocument-DHBUBUzO.js +32 -0
  119. package/dist/web/assets/FormStepView-CbHb32_8.js +1 -0
  120. package/dist/web/assets/{GraphAwareLayoutService-wsos3yPD.js → GraphAwareLayoutService-C5N8K9dm.js} +1 -1
  121. package/dist/web/assets/{MigrationDialog-CBJU7Oe3.js → MigrationDialog-DA3Vrzgw.js} +1 -1
  122. package/dist/web/assets/{NewFileDialog-B7075LWG.js → NewFileDialog-Dev41oA1.js} +1 -1
  123. package/dist/web/assets/PolicyDialog-qR19Csji.js +1 -0
  124. package/dist/web/assets/{QuickOpen-DJQrI7Od.js → QuickOpen-ps-rMjiS.js} +1 -1
  125. package/dist/web/assets/ScriptPane-BQLMNYzc.js +2 -0
  126. package/dist/web/assets/{ScriptRunDialog-BwE4cXnp.js → ScriptRunDialog-YivjHB6j.js} +1 -1
  127. package/dist/web/assets/{SettingsDialog-c307wPsg.js → SettingsDialog-DI0vZ6Ay.js} +1 -1
  128. package/dist/web/assets/ShortcutsDialog-DLXnv4Vm.js +1 -0
  129. package/dist/web/assets/SourceDocument-Cj8cGsoS.js +1 -0
  130. package/dist/web/assets/TemplateDocument-BRyFsofH.js +7 -0
  131. package/dist/web/assets/TextDocument-DB2hEuMA.js +1 -0
  132. package/dist/web/assets/{UnreadableFileLayer-CUP_30X8.js → UnreadableFileLayer-CRW3MM7w.js} +1 -1
  133. package/dist/web/assets/{UploadDialog-CaVBOxUL.js → UploadDialog-D-X6GG98.js} +1 -1
  134. package/dist/web/assets/Viewer-BcpDlvg_.js +4 -0
  135. package/dist/web/assets/apply-Nsj6ek02.js +1 -0
  136. package/dist/web/assets/{bpmnTheme-CZ7xp4R5.js → bpmnTheme-pKgl9Mrn.js} +2 -2
  137. package/dist/web/assets/{data-ZauKnQ2Z.js → data-CdiToGOq.js} +2 -2
  138. package/dist/web/assets/{data-Da5Nxzev.js → data-wU6sw6RY.js} +1 -1
  139. package/dist/web/assets/{dialog-DSLu1Bbo.js → dialog-BDJ5dDiU.js} +1 -1
  140. package/dist/web/assets/{diff-C4hitkRR.js → diff-BhYqTg4l.js} +1 -1
  141. package/dist/web/assets/dist-27z6Phtg.js +23 -0
  142. package/dist/web/assets/{dist-CofBTWz1.js → dist-B7TL-7R3.js} +4 -4
  143. package/dist/web/assets/dist-BEpeEbIu.js +1 -0
  144. package/dist/web/assets/{dist-CYCbBoYQ.js → dist-BTf7NfeQ.js} +1 -1
  145. package/dist/web/assets/{dist-CJKVV2_S.js → dist-BqGv7f4M.js} +10 -10
  146. package/dist/web/assets/dist-C-q1IWjr.js +6 -0
  147. package/dist/web/assets/{dist-Blylfrak.js → dist-CJx_2eBF.js} +2 -2
  148. package/dist/web/assets/dist-COUY_jv5.js +1 -0
  149. package/dist/web/assets/{dist-DpDu6Wz_.js → dist-CWjAtsKe.js} +1 -1
  150. package/dist/web/assets/{dist-gb3IfUZi.js → dist-Cv8_A_95.js} +2 -2
  151. package/dist/web/assets/dist-DDE6BjgI.js +5 -0
  152. package/dist/web/assets/{dist-7VC_hKpw.js → dist-DDNYYQtV.js} +1 -1
  153. package/dist/web/assets/dist-DW-S9iZN.js +1 -0
  154. package/dist/web/assets/dist-OnU5n5o1.js +1 -0
  155. package/dist/web/assets/dmn-Cgoh6wXm.js +3 -0
  156. package/dist/web/assets/{documentBridge-1Eg7H9yI.js → documentBridge-CHw4XsZH.js} +3 -3
  157. package/dist/web/assets/{documents-LG-7CTrn.js → documents-CEtohzAC.js} +1 -1
  158. package/dist/web/assets/duplicate-D_ic-m62.js +342 -0
  159. package/dist/web/assets/{engines-DhO6OW1S.js → engines-lyEvb0pH.js} +1 -1
  160. package/dist/web/assets/{executable-BTarDLry.js → executable--4381_Lf.js} +1 -1
  161. package/dist/web/assets/{file-CIeVSOHy.js → file-BbVBUuIH.js} +1 -1
  162. package/dist/web/assets/formChecks-CSClH9sH.js +1 -0
  163. package/dist/web/assets/frontend-uXAWaalt.js +1 -0
  164. package/dist/web/assets/{httpHost-DBSjdVth.js → httpHost-C973OTRe.js} +1 -1
  165. package/dist/web/assets/{index.es-pigASDxC.js → index.es-CMvq8Bhe.js} +3 -3
  166. package/dist/web/assets/index.es-GbdJvMnO.js +78 -0
  167. package/dist/web/assets/{index.esm-CTLpq4ik.js → index.esm-Ba6q0zSu.js} +1 -1
  168. package/dist/web/assets/{intelligence-_1C71hkQ.js → intelligence-DNqJNmdB.js} +3 -3
  169. package/dist/web/assets/{jspdf.es.min-PgZzOmkT.js → jspdf.es.min-C0L4zezU.js} +6 -6
  170. package/dist/web/assets/{kind-X3_nabTt.js → kind-DDHnk6dW.js} +1 -1
  171. package/dist/web/assets/{lib-BmLAen_d.js → lib-DrkEMJ65.js} +1 -1
  172. package/dist/web/assets/{list-DovB9lWV.js → list-TmXvCwja.js} +1 -1
  173. package/dist/web/assets/{migrationHost-BcguK4K5.js → migrationHost-DCWBb3L6.js} +1 -1
  174. package/dist/web/assets/moddle-f0Q4Guwd.js +1 -0
  175. package/dist/web/assets/{model--Bj28IOj.js → model-afHgSxJs.js} +1 -1
  176. package/dist/web/assets/{nudges-UF9_cBuO.js → nudges-DPG3WpyV.js} +1 -1
  177. package/dist/web/assets/{open-C9Kt9JLw.js → open-Vkx72dYx.js} +1 -1
  178. package/dist/web/assets/platform-G53Cenyw.js +2 -0
  179. package/dist/web/assets/{preload-helper-VRuDKI9K.js → preload-helper-DExCAR_V.js} +1 -1
  180. package/dist/web/assets/{run-BZgz1U9U.js → run-BMfRBe5O.js} +1 -1
  181. package/dist/web/assets/samples-BL3jA_Vd.js +1 -0
  182. package/dist/web/assets/{say-WvEHqIbO.js → say-BkdZMivA.js} +1 -1
  183. package/dist/web/assets/{say-ChFGKK2E.js → say-C7KqKcFr.js} +1 -1
  184. package/dist/web/assets/{sections-N6WYk7b8.js → sections-LJKSRDTS.js} +1 -1
  185. package/dist/web/assets/sharedReader-BsXfiBT8.js +1 -0
  186. package/dist/web/assets/{source-frame-DcptKpVq.js → source-frame-DC4W0A5-.js} +2 -2
  187. package/dist/web/assets/{syntax-DW10Wzg4.js → syntax-00Hk6Xv7.js} +4 -4
  188. package/dist/web/assets/{template-CMl68jPp.js → template-BQP7ZXdK.js} +1 -1
  189. package/dist/web/assets/testCaseRuns-liAhWMg7.js +1 -0
  190. package/dist/web/assets/{trace-DLziNpe2.js → trace-DXQU2N_l.js} +1 -1
  191. package/dist/web/assets/{translator-DLDFsUlE.js → translator-BLCeE6UY.js} +1 -1
  192. package/dist/web/assets/ui-BLtm3Y1J.js +1 -0
  193. package/dist/web/assets/{useTrace-UYBskc2k.js → useTrace-dZdQ805W.js} +1 -1
  194. package/dist/web/assets/web-C4k0NLZ9.js +982 -0
  195. package/dist/web/assets/web-CnDpD6qy.css +1 -0
  196. package/dist/web/assets/{workerVariables-DURgyUbG.js → workerVariables-O6VqwDzr.js} +1 -1
  197. package/dist/web/assets/xml-DIWt4von.js +1 -0
  198. package/dist/web/index.html +39 -40
  199. package/package.json +5 -5
  200. package/dist/chunk-account-CpZu-RTg.js +0 -1
  201. package/dist/chunk-agentServe-BYRtgGGD.js +0 -10
  202. package/dist/chunk-agents-B9oxdPTA.js +0 -1
  203. package/dist/chunk-agentsMigrate-BV8TeRXq.js +0 -2
  204. package/dist/chunk-analyze-pgzR-Cx-.js +0 -1
  205. package/dist/chunk-apiTemplates-cU7C8vap.js +0 -1
  206. package/dist/chunk-cmmnFindings-S2TGSnEp.js +0 -1
  207. package/dist/chunk-codeLinks-C8N6e8k3.js +0 -1
  208. package/dist/chunk-codeLinks-o0a8tBGk.js +0 -1
  209. package/dist/chunk-command-Bqlbgo-2.js +0 -1
  210. package/dist/chunk-command-DT84ioJb.js +0 -5
  211. package/dist/chunk-command-DrGP2kg8.js +0 -1
  212. package/dist/chunk-commands-B4PoZbpX.js +0 -5
  213. package/dist/chunk-compose-CWKKVtN5.js +0 -4
  214. package/dist/chunk-connections-DQpKbIGD.js +0 -1
  215. package/dist/chunk-connectors-PtAvE91B.js +0 -1
  216. package/dist/chunk-convert-CpgtOlZk.js +0 -1
  217. package/dist/chunk-convert-HbFpg8ab.js +0 -3
  218. package/dist/chunk-deploy-l4MdFfn8.js +0 -6
  219. package/dist/chunk-deploy-qRaaKGZb.js +0 -1
  220. package/dist/chunk-diff-BhTFlCE3.js +0 -1
  221. package/dist/chunk-diff-kBF83vzM.js +0 -1
  222. package/dist/chunk-dispatch-BnO-QhMh.js +0 -7
  223. package/dist/chunk-dmnTests-0x_yUH6S.js +0 -1
  224. package/dist/chunk-doctor-BuHK1dTm.js +0 -1
  225. package/dist/chunk-evidence-oLw_C6j8.js +0 -23
  226. package/dist/chunk-export-cIFHDXug.js +0 -1
  227. package/dist/chunk-export-jBVxtmCH.js +0 -20
  228. package/dist/chunk-failure-D5brrYW2.js +0 -1
  229. package/dist/chunk-import-BBOe-5RZ.js +0 -6
  230. package/dist/chunk-importCommand-DRjYoljA.js +0 -1
  231. package/dist/chunk-incident-BK1h37CD.js +0 -1
  232. package/dist/chunk-init-_OALJuKm.js +0 -227
  233. package/dist/chunk-lint-7KJFxyCN.js +0 -1
  234. package/dist/chunk-main-Cw2JXCil.js +0 -1
  235. package/dist/chunk-mcp-K63bhqnF.js +0 -95
  236. package/dist/chunk-migrate-BMwBV5sc.js +0 -16
  237. package/dist/chunk-migrate-CxfVmKt0.js +0 -1
  238. package/dist/chunk-migrateVerify-DSEXSpfR.js +0 -1
  239. package/dist/chunk-policy-BX0Ftdws.js +0 -1
  240. package/dist/chunk-policyGate-dmcufnwB.js +0 -2
  241. package/dist/chunk-pr-ByrGcfam.js +0 -1
  242. package/dist/chunk-project-DA3KnAZH.js +0 -1
  243. package/dist/chunk-promotion-Boedyq43.js +0 -1
  244. package/dist/chunk-promotion-D8Ti-vxp.js +0 -2
  245. package/dist/chunk-receipt-CusJaqNn.js +0 -1
  246. package/dist/chunk-receiptDeps-oVbX156d.js +0 -1
  247. package/dist/chunk-receiptGate-DrGChj7i.js +0 -1
  248. package/dist/chunk-receiptGate-xldHKMyJ.js +0 -1
  249. package/dist/chunk-refactor-B1W_MGTp.js +0 -1
  250. package/dist/chunk-refactor-BJXxEtVs.js +0 -17
  251. package/dist/chunk-report-D9pM09Nu.js +0 -1
  252. package/dist/chunk-review-UcqS5AAi.js +0 -1
  253. package/dist/chunk-say-CYb4HeJD.js +0 -1
  254. package/dist/chunk-serve-Dmqen1yd.js +0 -10
  255. package/dist/chunk-stages-BTQJrAMF.js +0 -3
  256. package/dist/chunk-systemError-BYrMzp2o.js +0 -1
  257. package/dist/chunk-systemError-CXvnhNPK.js +0 -1
  258. package/dist/chunk-taskTest-9gMsx0zu.js +0 -2
  259. package/dist/chunk-taskTest-BjXYpG5p.js +0 -1
  260. package/dist/chunk-templates-D3ouIwHD.js +0 -1
  261. package/dist/chunk-testCases-9jwT_Y7z.js +0 -4
  262. package/dist/chunk-testCases-BcpBPg9L.js +0 -1
  263. package/dist/chunk-tests-CEEXnWOp.js +0 -23
  264. package/dist/chunk-tests-CRVosdWp.js +0 -1
  265. package/dist/chunk-wrapper-B2WnOIoB.js +0 -3
  266. package/dist/chunk-wrapper-DiKCKZti.js +0 -1
  267. package/dist/web/assets/BpmnDocument-C247Rqim.js +0 -27
  268. package/dist/web/assets/CmmnDocument-Dj48bsUd.js +0 -17
  269. package/dist/web/assets/DmnDocument-Cb9Zi9fS.js +0 -41
  270. package/dist/web/assets/FormDocument-DoZaxWd-.js +0 -32
  271. package/dist/web/assets/FormDocument-URLcKn84.css +0 -1
  272. package/dist/web/assets/FormStepView-D8MFcpeI.js +0 -1
  273. package/dist/web/assets/PolicyDialog-CGdglmDn.js +0 -1
  274. package/dist/web/assets/ScriptPane-T6M5f6fc.js +0 -2
  275. package/dist/web/assets/ShortcutsDialog-BAoL9EHu.js +0 -1
  276. package/dist/web/assets/SourceDocument-C9KIzBA5.js +0 -1
  277. package/dist/web/assets/TemplateDocument-CNt2turg.js +0 -7
  278. package/dist/web/assets/TextDocument-CtkHoEqN.js +0 -1
  279. package/dist/web/assets/Viewer-DZske1C5.js +0 -4
  280. package/dist/web/assets/apply-nnKP9HIM.js +0 -1
  281. package/dist/web/assets/dist--PmHUHDp.js +0 -1
  282. package/dist/web/assets/dist-BoPrKCf2.js +0 -5
  283. package/dist/web/assets/dist-C1m02xAO.js +0 -1
  284. package/dist/web/assets/dist-CLqJMzT-.js +0 -1
  285. package/dist/web/assets/dist-D3jqq0XS.js +0 -1
  286. package/dist/web/assets/dist-DA-9F0U9.js +0 -1
  287. package/dist/web/assets/dist-DojzF5q2.js +0 -6
  288. package/dist/web/assets/dist-yvjzrXXf.js +0 -23
  289. package/dist/web/assets/dmn-DwdcYXGr.js +0 -3
  290. package/dist/web/assets/duplicate-D-ilQqKz.js +0 -342
  291. package/dist/web/assets/formChecks-CGox1z7R.js +0 -1
  292. package/dist/web/assets/frontend-Qq5hBH0U.js +0 -1
  293. package/dist/web/assets/index.es-CcNNw3VB.js +0 -78
  294. package/dist/web/assets/moddle-DJxj0oEU.js +0 -1
  295. package/dist/web/assets/platform-BLPhsye9.js +0 -2
  296. package/dist/web/assets/samples-oeXBsJ9Y.js +0 -1
  297. package/dist/web/assets/sharedReader-Bopy7Uk9.js +0 -1
  298. package/dist/web/assets/testCaseRuns-B_XdqGFh.js +0 -1
  299. package/dist/web/assets/ui-BTKMbWYG.js +0 -1
  300. package/dist/web/assets/web-FzNBw1kZ.css +0 -1
  301. package/dist/web/assets/web-jPMZVwbQ.js +0 -982
  302. package/dist/web/assets/xml-DTgZ-B-l.js +0 -1
@@ -1,342 +0,0 @@
1
- import{i as e,o as n}from"./rolldown-runtime-B8BYMn-z.js";import{_ as a,c,d as m,i as v,m as T,o as O,s as A,u as I}from"./vendor-NJP34MHU.js";import{i as L}from"./translator-DLDFsUlE.js";import{r as U}from"./lib-BmLAen_d.js";import{$ as G,$t as K,At as q,Bt as ee,Ct as te,Dt as ne,Et as J,Ft as re,Jt as ie,Kt as ae,Lt as oe,Mt as se,Ot as ce,Q as le,Qt as ue,Rt as de,S as fe,St as pe,Tt as me,Vt as he,Wt as ge,Xt as _e,Yt as ve,Z as ye,Zt as be,_ as xe,_t as Se,a as Ce,at as we,b as Te,bt as Ee,c as De,ct as Oe,d as ke,dt as Ae,en as je,et as Me,ft as Ne,g as Pe,gt as Fe,ht as Ie,i as Le,in as Re,kt as ze,l as Be,lt as Ve,mt as He,nn as Ue,o as We,ot as Ge,pt as Ke,r as qe,rn as Je,rt as Ye,s as Xe,st as Ze,tn as Qe,u as $e,ut as et,v as tt,vt as nt,wt as rt,x as it,xt as at,zt as ot}from"./Viewer-DZske1C5.js";import{A as st,D as ct,I as lt,L as ut,M as dt,N as ft,O as pt,T as mt,_ as ht,a as gt,b as _t,d as vt,f as yt,g as bt,h as xt,j as St,k as Ct,l as wt,m as Tt,n as Et,o as Dt,r as Ot,s as kt,t as At,u as Q,v as jt,w as Mt,x as Nt,y as Pt}from"./dist-CRJyslwo.js";import{o as Ft,s as It,u as Lt}from"./bpmnTheme-CZ7xp4R5.js";import{$ as Rt,H as zt,I as Bt,M as Vt,Q as Ht,X as Ut,f as Wt,g as Gt,ht as Kt,l as qt,lt as Jt,tt as Yt,v as Xt}from"./dist-BrFvWnvj.js";import{a as Zt,i as Qt}from"./dist-Bb5-DGtZ.js";import{i as $t,n as en,t as rn}from"./dist-7VC_hKpw.js";import{n as an,r as on}from"./dist-DpDu6Wz_.js";import{r as cn}from"./dist-CLqJMzT-.js";import{t as ln}from"./typing-CXvbBSPr.js";var un=`bpmn-js-clip----`,fn=`dmn-js-clip----`,gn=`penstock:clipboard-changed`;function createClipboardMirror(e){let n=null;return{read:()=>n,write(a){n=a;try{Promise.resolve(e.saveClipboard(a)).catch(()=>{})}catch{}},async refresh(){try{let a=await e.getClipboard();a&&(n=a)}catch{}}}}Tt();var xn=[`c`,`C`],Sn=[`v`,`V`],Cn=[`d`,`D`],wn=[`x`,`X`],Tn=[`y`,`Y`],En=[`z`,`Z`];function hasModifier(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function isCmd$1(e){return e.altKey?!1:e.ctrlKey||e.metaKey}e(isCmd$1,`isCmd`);function isKey(e,n){return e=xt(e)?e:[e],e.indexOf(n.key)!==-1||e.indexOf(n.code)!==-1||e.indexOf(getPhysicalLetter(n))!==-1}var Dn=/^(?!\p{Script_Extensions=Latin}|\p{Script=Common})\p{Letter}$/u,On=/^\P{Letter}$/u;function getPhysicalLetter(e){var n=e.key,a=/^Key([A-Z])$/.exec(e.code||``);if(!a||typeof n!=`string`)return null;var c=a[1];return Dn.test(n)?e.shiftKey?c:c.toLowerCase():e.shiftKey&&On.test(n)&&e.keyCode===c.charCodeAt(0)?c:null}function isShift(e){return e.shiftKey}function isCopy(e){return isCmd$1(e)&&isKey(xn,e)}function isPaste(e){return isCmd$1(e)&&isKey(Sn,e)}function isDuplicate(e){return isCmd$1(e)&&isKey(Cn,e)}function isCut(e){return isCmd$1(e)&&isKey(wn,e)}function isUndo(e){return isCmd$1(e)&&!isShift(e)&&isKey(En,e)}function isRedo(e){return isCmd$1(e)&&(isKey(Tn,e)||isKey(En,e)&&isShift(e))}Tt();var kn=`keyboard.keydown`,An=`keyboard.keyup`,jn=1e3,Mn=`Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661`;function Keyboard(e,n){var a=this;this._config=e||={},this._eventBus=n,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),n.on(`diagram.destroy`,function(){a._fire(`destroy`),a.unbind()}),e.bindTo&&console.error(`unsupported configuration <keyboard.bindTo>`,Error(Mn));var c=e&&e.bind!==!1;n.on(`canvas.init`,function(e){a._target=e.svg,c&&a.bind(),a._fire(`init`)})}Keyboard.$inject=[`config.keyboard`,`eventBus`],Keyboard.prototype._keydownHandler=function(e){this._keyHandler(e,kn)},Keyboard.prototype._keyupHandler=function(e){this._keyHandler(e,An)},Keyboard.prototype._keyHandler=function(e,n){var a;if(!this._isEventIgnored(e)){var c={keyEvent:e};a=this._eventBus.fire(n||kn,c),a&&e.preventDefault()}},Keyboard.prototype._isEventIgnored=function(e){return!1},Keyboard.prototype.bind=function(e){e&&console.error(`unsupported argument <node>`,Error(Mn)),this.unbind(),e=this._node=this._target,K.bind(e,`keydown`,this._keydownHandler),K.bind(e,`keyup`,this._keyupHandler),this._fire(`bind`)},Keyboard.prototype.getBinding=function(){return this._node},Keyboard.prototype.unbind=function(){var e=this._node;e&&(this._fire(`unbind`),K.unbind(e,`keydown`,this._keydownHandler),K.unbind(e,`keyup`,this._keyupHandler)),this._node=null},Keyboard.prototype._fire=function(e){this._eventBus.fire(`keyboard.`+e,{node:this._node})},Keyboard.prototype.addListener=function(e,n,a){ht(e)&&(a=n,n=e,e=jn),this._eventBus.on(a||kn,e,n)},Keyboard.prototype.removeListener=function(e,n){this._eventBus.off(n||kn,e)},Keyboard.prototype.hasModifier=hasModifier,Keyboard.prototype.isCmd=isCmd$1,Keyboard.prototype.isShift=isShift,Keyboard.prototype.isKey=isKey;var Nn=500;function KeyboardBindings(e,n){var a=this;e.on(`editorActions.init`,Nn,function(e){var c=e.editorActions;a.registerBindings(n,c)})}KeyboardBindings.$inject=[`eventBus`,`keyboard`],KeyboardBindings.prototype.registerBindings=function(e,n){function addListener(a,c){n.isRegistered(a)&&e.addListener(c)}addListener(`undo`,function(e){var a=e.keyEvent;if(isUndo(a))return n.trigger(`undo`),!0}),addListener(`redo`,function(e){var a=e.keyEvent;if(isRedo(a))return n.trigger(`redo`),!0}),addListener(`copy`,function(e){var a=e.keyEvent;if(isCopy(a))return n.trigger(`copy`),!0}),addListener(`paste`,function(e){var a=e.keyEvent;if(isPaste(a))return n.trigger(`paste`),!0}),addListener(`duplicate`,function(e){var a=e.keyEvent;if(isDuplicate(a))return n.trigger(`duplicate`),!0}),addListener(`cut`,function(e){var a=e.keyEvent;if(isCut(a))return n.trigger(`cut`),!0}),addListener(`stepZoom`,function(e){var a=e.keyEvent;if(isKey([`+`,`=`],a)&&isCmd$1(a))return n.trigger(`stepZoom`,{value:1}),!0}),addListener(`stepZoom`,function(e){var a=e.keyEvent;if(isKey(`-`,a)&&isCmd$1(a))return n.trigger(`stepZoom`,{value:-1}),!0}),addListener(`zoom`,function(e){var a=e.keyEvent;if(isKey(`0`,a)&&isCmd$1(a))return n.trigger(`zoom`,{value:1}),!0}),addListener(`removeSelection`,function(e){var a=e.keyEvent;if(isKey([`Backspace`,`Delete`],a))return n.trigger(`removeSelection`),!0})};var Pn={__init__:[`keyboard`,`keyboardBindings`],keyboard:[`type`,Keyboard],keyboardBindings:[`type`,KeyboardBindings]};Tt();var Fn={moveSpeed:50,moveSpeedAccelerated:200};function KeyboardMove(e,n,a){var c=this;this._config=At({},Fn,e||{}),n.addListener(arrowsListener);function arrowsListener(e){var a=e.keyEvent,m=c._config;if(n.isCmd(a)&&n.isKey([`ArrowLeft`,`ArrowUp`,`ArrowDown`,`ArrowRight`],a)){var v=n.isShift(a)?m.moveSpeedAccelerated:m.moveSpeed,T;switch(a.key){case`ArrowLeft`:T=`left`;break;case`ArrowUp`:T=`up`;break;case`ArrowRight`:T=`right`;break;case`ArrowDown`:T=`down`}return c.moveCanvas({speed:v,direction:T}),!0}}this.moveCanvas=function(e){var n=0,c=0,m=e.speed/Math.min(Math.sqrt(a.viewbox().scale),1);switch(e.direction){case`left`:n=m;break;case`up`:c=m;break;case`right`:n=-m;break;case`down`:c=-m}a.scroll({dx:n,dy:c})}}KeyboardMove.$inject=[`config.keyboardMove`,`keyboard`,`canvas`];var In={__depends__:[Pn],__init__:[`keyboardMove`],keyboardMove:[`type`,KeyboardMove]},Ln=/^djs-cursor-.*$/;function set(e){var n=ve(document.body);n.removeMatching(Ln),e&&n.add(`djs-cursor-`+e)}function unset(){set(null)}var Rn=5e3;function install(e,n){n||=`element.click`;function trap(){return!1}return e.once(n,Rn,trap),function(){e.off(n,trap)}}function center(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function delta(e,n){return{x:e.x-n.x,y:e.y-n.y}}var zn=15;function MoveCanvas(e,n){var a;function handleMousedown(e){return handleStart(e.originalEvent)}e.on(`canvas.focus.changed`,function(n){n.focused?e.on(`element.mousedown`,500,handleMousedown):e.off(`element.mousedown`,handleMousedown)}),e.on(`diagram.destroy`,function(){a&&handleEnd()});function handleMove(c){var m=a.start,v=a.button,T=ke(c),O=delta(T,m);!a.dragging&&length(O)>zn&&(a.dragging=!0,v===0&&install(e),set(`grab`)),a.dragging&&(O=delta(T,a.last||a.start),n.scroll({dx:O.x,dy:O.y}),a.last=T),c.preventDefault()}function handleEnd(e){K.unbind(document,`mousemove`,handleMove),K.unbind(document,`mouseup`,handleEnd),a=null,unset()}function handleStart(e){if(!be(e.target,`.djs-draggable`)){var n=e.button;if(!(n>=2||e.ctrlKey||e.shiftKey||e.altKey))return a={button:n,start:ke(e)},K.bind(document,`mousemove`,handleMove),K.bind(document,`mouseup`,handleEnd),!0}}this.isActive=function(){return!!a}}MoveCanvas.$inject=[`eventBus`,`canvas`];function length(e){return Math.sqrt(e.x**2+e.y**2)}var Bn={__init__:[`moveCanvas`],moveCanvas:[`type`,MoveCanvas]};function log10(e){return Math.log(e)/Math.log(10)}function getStepSize(e,n){var a=log10(e.min),c=log10(e.max);return(Math.abs(a)+Math.abs(c))/n}function cap(e,n){return Math.max(e.min,Math.min(e.max,n))}Tt();var Vn=Math.sign||function(e){return e>=0?1:-1},Hn={min:.2,max:4},Un=10,Wn=.1,Gn=.75;function ZoomScroll(e,n,a){e||={},this._enabled=!1,this._canvas=a,this._container=a._container,this._handleWheel=Et(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||Gn;var c=this;n.on(`canvas.mouseover`,function(){c._init(e.enabled!==!1)}),n.on(`canvas.mouseout`,function(){c._init(!1)})}ZoomScroll.$inject=[`config.zoomScroll`,`eventBus`,`canvas`],ZoomScroll.prototype.scroll=function scroll(e){this._canvas.scroll(e)},ZoomScroll.prototype.reset=function reset(){this._canvas.zoom(`fit-viewport`)},ZoomScroll.prototype.zoom=function zoom(e,n){var a=getStepSize(Hn,Un*2);this._totalDelta+=e,Math.abs(this._totalDelta)>Wn&&(this._zoom(e,n,a),this._totalDelta=0)},ZoomScroll.prototype._handleWheel=function handleWheel(e){if(this._enabled){var n=this._container;e.preventDefault();var a=e.ctrlKey||De()&&e.metaKey,c=e.shiftKey,m=-1*this._scale,v;if(m*=a?e.deltaMode===0?.02:.32:e.deltaMode===0?1:16,a){var T=n.getBoundingClientRect(),O={x:e.clientX-T.left,y:e.clientY-T.top};v=Math.sqrt(e.deltaY**2+e.deltaX**2)*Vn(e.deltaY)*m,this.zoom(v,O)}else v=c?{dx:m*e.deltaY,dy:0}:{dx:m*e.deltaX,dy:m*e.deltaY},this.scroll(v)}},ZoomScroll.prototype.stepZoom=function stepZoom(e,n){var a=getStepSize(Hn,Un);this._zoom(e,n,a)},ZoomScroll.prototype._zoom=function(e,n,a){var c=this._canvas,m=e>0?1:-1,v=log10(c.zoom()),T=Math.round(v/a)*a;T+=a*m;var O=10**T;c.zoom(cap(Hn,O),n)},ZoomScroll.prototype.toggle=function toggle(e){var n=this._container,a=this._handleWheel,c=this._enabled;return e===void 0&&(e=!c),c!==e&&K[e?`bind`:`unbind`](n,`wheel`,a,!1),this._enabled=e,e},ZoomScroll.prototype._init=function(e){this.toggle(e)};var Kn={__init__:[`zoomScroll`],zoomScroll:[`type`,ZoomScroll]};Tt();function last(e){return e&&e[e.length-1]}function sortTopOrMiddle(e){return e.y}function sortLeftOrCenter(e){return e.x}var qn={left:sortLeftOrCenter,center:sortLeftOrCenter,right:function(e){return e.x+e.width},top:sortTopOrMiddle,middle:sortTopOrMiddle,bottom:function(e){return e.y+e.height}};function AlignElements$1(e,n){this._modeling=e,this._rules=n}e(AlignElements$1,`AlignElements`),AlignElements$1.$inject=[`modeling`,`rules`],AlignElements$1.prototype._getOrientationDetails=function(e){var n=[`top`,`bottom`,`middle`],a=`x`,c=`width`;return n.indexOf(e)!==-1&&(a=`y`,c=`height`),{axis:a,dimension:c}},AlignElements$1.prototype._isType=function(e,n){return n.indexOf(e)!==-1},AlignElements$1.prototype._alignmentPosition=function(e,n){var a=this._getOrientationDetails(e),c=a.axis,m=a.dimension,v={},T={},O=!1,A,I,L;function getMiddleOrTop(e,n){return Math.round((e[c]+n[c]+n[m])/2)}if(this._isType(e,[`left`,`top`]))v[e]=n[0][c];else if(this._isType(e,[`right`,`bottom`]))L=last(n),v[e]=L[c]+L[m];else if(this._isType(e,[`center`,`middle`])){if(Q(n,function(e){var n=e[c]+Math.round(e[m]/2);T[n]?T[n].elements.push(e):T[n]={elements:[e],center:n}}),A=ft(T,function(e){return e.elements.length>1&&(O=!0),e.elements.length}),O)return v[e]=last(A).center,v;I=n[0],n=ft(n,function(e){return e[c]+e[m]}),L=last(n),v[e]=getMiddleOrTop(I,L)}return v},AlignElements$1.prototype.trigger=function(e,n){var a=this._modeling,c,m=Dt(e,function(e){return!(e.waypoints||e.host||e.labelTarget)});if(c=this._rules.allowed(`elements.align`,{elements:m}),xt(c)&&(m=c),!(m.length<2||!c)){var v=qn[n],T=ft(m,v),O=this._alignmentPosition(n,T);a.alignElements(T,O)}};var Jn={__init__:[`alignElements`],alignElements:[`type`,AlignElements$1]},Yn=new it;function Scheduler(e){this._scheduled={},e.on(`diagram.destroy`,()=>{Object.keys(this._scheduled).forEach(e=>{this.cancel(e)})})}Scheduler.$inject=[`eventBus`],Scheduler.prototype.schedule=function(e,n=Yn.next()){this.cancel(n);let a=this._schedule(e,n);return this._scheduled[n]=a,a.promise},Scheduler.prototype._schedule=function(e,n){let a=defer();return{executionId:setTimeout(()=>{try{this._scheduled[n]=null;try{a.resolve(e())}catch(e){a.reject(e)}}catch(e){console.error(`Scheduler#_schedule execution failed`,e)}}),promise:a.promise}},Scheduler.prototype.cancel=function(e){let n=this._scheduled[e];n&&(this._cancel(n),this._scheduled[e]=null)},Scheduler.prototype._cancel=function(e){clearTimeout(e.executionId)};function defer(){let e={};return e.promise=new Promise((n,a)=>{e.resolve=n,e.reject=a}),e}var Xn={scheduler:[`type`,Scheduler]};Tt();var Zn=`djs-element-hidden`,Qn=`.entry`,$n=1e3,er=8,tr=300;function ContextPad(e,n,a,c){this._canvas=e,this._elementRegistry=n,this._eventBus=a,this._scheduler=c,this._current=null,this._init()}ContextPad.$inject=[`canvas`,`elementRegistry`,`eventBus`,`scheduler`],ContextPad.prototype._init=function(){var e=this;this._eventBus.on(`selection.changed`,function(n){var a=n.newSelection,c=a.length?a.length===1?a[0]:a:null;c?e.open(c,!0):e.close()}),this._eventBus.on(`elements.changed`,function(n){var a=n.elements,c=e._current;if(c){var m=c.target,v=xt(m)?m:[m];if(v.filter(function(e){return a.includes(e)}).length){e.close();var T=v.filter(function(n){return e._elementRegistry.get(n.id)});T.length&&e._updateAndOpen(T.length>1?T:T[0])}}}),this._eventBus.on(`canvas.viewbox.changed`,function(){e._updatePosition()}),this._eventBus.on(`element.marker.update`,function(n){if(e.isOpen()){var a=n.element,c=e._current;(xt(c.target)?c.target:[c.target]).includes(a)&&e._updateVisibility()}}),this._container=this._createContainer()},ContextPad.prototype._createContainer=function(){var e=Je(`<div class="djs-context-pad-parent"></div>`);return this._canvas.getContainer().appendChild(e),e},ContextPad.prototype.registerProvider=function(e,n){n||(n=e,e=$n),this._eventBus.on(`contextPad.getProviders`,e,function(e){e.providers.push(n)})},ContextPad.prototype.getEntries=function(e){var n=this._getProviders(),a=xt(e)?`getMultiElementContextPadEntries`:`getContextPadEntries`,c={};return Q(n,function(n){if(ht(n[a])){var m=n[a](e);ht(m)?c=m(c):Q(m,function(e,n){c[n]=e})}}),c},ContextPad.prototype.trigger=function(e,n,a){var c=this,m,v,T=n.delegateTarget||n.target;if(!T)return n.preventDefault();if(m=ie(T,`data-action`),v=n.originalEvent||n,e===`mouseover`)this._timeout=setTimeout(function(){c._mouseout=c.triggerEntry(m,`hover`,v,a)},tr);else if(e===`mouseout`)clearTimeout(this._timeout),this._mouseout&&=(this._mouseout(),null);else return this.triggerEntry(m,e,v,a)},ContextPad.prototype.triggerEntry=function(e,n,a,c){if(this.isShown()){var m=this._current.target,v=this._current.entries[e];if(v){var T=v.action;if(this._eventBus.fire(`contextPad.trigger`,{entry:v,event:a})!==!1){if(ht(T)){if(n===`click`)return T(a,m,c)}else if(T[n])return T[n](a,m,c);a.preventDefault()}}}},ContextPad.prototype.open=function(e,n){(n||!this.isOpen(e))&&this._eventBus.fire(`contextPad.open.allowed`,{target:e})!==!1&&(this.close(),this._updateAndOpen(e))},ContextPad.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:`contextPad.getProviders`,providers:[]});return this._eventBus.fire(e),e.providers},ContextPad.prototype._updateAndOpen=function(e){var n=this.getEntries(e),a=this._createHtml(e),c;Q(n,function(e,n){var m=e.group||`default`,v=Je(e.html||`<div class="entry" draggable="true"></div>`),T;ie(v,`data-action`,n),T=Qe(`[data-group=`+Pe(m)+`]`,a),T||(T=Je(`<div class="group"></div>`),ie(T,`data-group`,m),a.appendChild(T)),T.appendChild(v),e.className&&addClasses$1(v,e.className),e.title&&ie(v,`title`,e.title),e.imageUrl&&(c=Je(`<img>`),ie(c,`src`,e.imageUrl),c.style.width=`100%`,c.style.height=`100%`,v.appendChild(c))}),ve(a).add(`open`),this._current={entries:n,html:a,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire(`contextPad.open`,{current:this._current})},ContextPad.prototype._createHtml=function(e){var n=this,a=Je(`<div class="djs-context-pad"></div>`);return ue.bind(a,Qn,`click`,function(e){n.trigger(`click`,e)}),ue.bind(a,Qn,`dragstart`,function(e){n.trigger(`dragstart`,e)}),ue.bind(a,Qn,`mouseover`,function(e){n.trigger(`mouseover`,e)}),ue.bind(a,Qn,`mouseout`,function(e){n.trigger(`mouseout`,e)}),K.bind(a,`mousedown`,function(e){e.stopPropagation()}),this._container.appendChild(a),this._eventBus.fire(`contextPad.create`,{target:e,pad:a}),a},ContextPad.prototype.getPad=function(e){console.warn(Error(`ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888`));let n;return n=this.isOpen()&&targetsEqual(this._current.target,e)?this._current.html:this._createHtml(e),{html:n}},ContextPad.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML=``,this._eventBus.fire(`contextPad.close`,{current:this._current}),this._current=null)},ContextPad.prototype.isOpen=function(e){var n=this._current;if(!n)return!1;if(!e)return!0;var a=n.target;return xt(e)===xt(a)?xt(e)?e.length===a.length&&gt(e,function(e){return a.includes(e)}):a===e:!1},ContextPad.prototype.isShown=function(){return this.isOpen()&&ve(this._current.html).has(`open`)},ContextPad.prototype.show=function(){this.isOpen()&&(ve(this._current.html).add(`open`),this._updatePosition(),this._eventBus.fire(`contextPad.show`,{current:this._current}))},ContextPad.prototype.hide=function(){this.isOpen()&&(ve(this._current.html).remove(`open`),this._eventBus.fire(`contextPad.hide`,{current:this._current}))},ContextPad.prototype._getPosition=function(e){if(!xt(e)&&Ke(e)){var n=this._canvas.viewbox(),a=getLastWaypoint(e),c=a.x*n.scale-n.x*n.scale,m=a.y*n.scale-n.y*n.scale;return{left:c+er*this._canvas.zoom(),top:m}}var v=this._canvas.getContainer().getBoundingClientRect(),T=this._getTargetBounds(e);return{left:T.right-v.left+er*this._canvas.zoom(),top:T.top-v.top}},ContextPad.prototype._updatePosition=function(){let updateFn=()=>{if(this.isOpen()){var e=this._current.html,n=this._getPosition(this._current.target);`x`in n&&`y`in n?(e.style.left=n.x+`px`,e.style.top=n.y+`px`):[`top`,`right`,`bottom`,`left`].forEach(function(a){a in n&&(e.style[a]=n[a]+`px`)})}};this._scheduler.schedule(updateFn,`ContextPad#_updatePosition`)},ContextPad.prototype._updateVisibility=function(){let updateFn=()=>{if(this.isOpen()){var e=this,n=this._current.target;(xt(n)?n:[n]).some(function(n){return e._canvas.hasMarker(n,Zn)})?e.hide():e.show()}};this._scheduler.schedule(updateFn,`ContextPad#_updateVisibility`)},ContextPad.prototype._getTargetBounds=function(e){var n=this;return(xt(e)?e:[e]).map(function(e){return n._canvas.getGraphics(e)}).reduce(function(e,n){let a=n.getBoundingClientRect();return e.top=Math.min(e.top,a.top),e.right=Math.max(e.right,a.right),e.bottom=Math.max(e.bottom,a.bottom),e.left=Math.min(e.left,a.left),e.x=e.left,e.y=e.top,e.width=e.right-e.left,e.height=e.bottom-e.top,e},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function addClasses$1(e,n){var a=ve(e);n=xt(n)?n:n.split(/\s+/g),n.forEach(function(e){a.add(e)})}e(addClasses$1,`addClasses`);function getLastWaypoint(e){return e.waypoints[e.waypoints.length-1]}function targetsEqual(e,n){return e=xt(e)?e:[e],n=xt(n)?n:[n],e.length===n.length&&gt(e,function(e){return n.includes(e)})}var nr={__depends__:[Le,Xn,Te],contextPad:[`type`,ContextPad]},rr=e(function(e,n,a,c){var m;n[0]=0;for(var v=1;v<n.length;v++){var T=n[v++],O=n[v]?(n[0]|=T?1:2,a[n[v++]]):n[++v];T===3?c[0]=O:T===4?c[1]=Object.assign(c[1]||{},O):T===5?(c[1]=c[1]||{})[n[++v]]=O:T===6?c[1][n[++v]]+=O+``:T?(m=e.apply(O,rr(e,O,a,[``,null])),c.push(m),O[0]?n[0]|=2:(n[v-2]=0,n[v]=m)):c.push(O)}return c},`n`),ir=new Map;function htm_module_default(e){var n=ir.get(this);return n||(n=new Map,ir.set(this,n)),(n=rr(this,n.get(e)||(n.set(e,n=function(e){for(var n,a,c=1,m=``,v=``,T=[0],p=function(e){c===1&&(e||(m=m.replace(/^\s*\n\s*|\s*\n\s*$/g,``)))?T.push(0,e,m):c===3&&(e||m)?(T.push(3,e,m),c=2):c===2&&m===`...`&&e?T.push(4,e,0):c===2&&m&&!e?T.push(5,0,!0,m):c>=5&&((m||!e&&c===5)&&(T.push(c,0,m,a),c=6),e&&(T.push(c,e,0,a),c=6)),m=``},O=0;O<e.length;O++){O&&(c===1&&p(),p(O));for(var A=0;A<e[O].length;A++)n=e[O][A],c===1?n===`<`?(p(),T=[T],c=3):m+=n:c===4?m===`--`&&n===`>`?(c=1,m=``):m=n+m[0]:v?n===v?v=``:m+=n:n===`"`||n===`'`?v=n:n===`>`?(p(),c=1):c&&(n===`=`?(c=5,a=m,m=``):n===`/`&&(c<5||e[O][A+1]===`>`)?(p(),c===3&&(T=T[0]),c=T,(T=T[0]).push(2,0,c),c=0):n===` `||n===` `||n===`
2
- `||n===`\r`?(p(),c=2):m+=n),c===3&&m===`!--`&&(c=4,T=T[0])}return p(),T}(e)),n),arguments,[])).length>1?n:n[0]}e(htm_module_default,`default`);var ar=htm_module_default.bind(a);function PopupMenuBreadcrumbs(e){let{navigationStack:n,setNavigationStack:a}=e,c=O(()=>n.length<=1?[]:n.slice(0,-1).map((e,n)=>({label:e.label,onClick:()=>a(e=>e.slice(0,n+1))})),[n,a]),m=n.length>0?()=>a([]):null,v=n.length>0?n[n.length-1].label:null;return ar`
3
- <div class="djs-popup-breadcrumbs">
4
- ${m&&ar`
5
- <button
6
- type="button"
7
- class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--back"
8
- title="Back"
9
- aria-label="Back"
10
- onClick=${m}
11
- >
12
- <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
13
- <path fill-rule="evenodd" clip-rule="evenodd" d="M8.03033 1.46967C8.32322 1.76256 8.32322 2.23744 8.03033 2.53033L4.56066 6L8.03033 9.46967C8.32322 9.76256 8.32322 10.2374 8.03033 10.5303C7.73744 10.8232 7.26256 10.8232 6.96967 10.5303L2.96967 6.53033C2.67678 6.23744 2.67678 5.76256 2.96967 5.46967L6.96967 1.46967C7.26256 1.17678 7.73744 1.17678 8.03033 1.46967Z" fill="currentColor"/>
14
- </svg>
15
- </button>
16
- `}
17
- ${c.map((e,n)=>ar`
18
- <button
19
- key=${n}
20
- type="button"
21
- class="djs-popup-breadcrumbs-item"
22
- onClick=${e.onClick}
23
- title=${e.label}
24
- >
25
- ${e.label}
26
- </button>
27
- <span class="djs-popup-breadcrumbs-item--separator" aria-hidden="true"></span>
28
- `)}
29
- ${v&&ar`
30
- <span class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--current" title=${v}>
31
- ${v}
32
- </span>
33
- `}
34
- </div>
35
- `}function r$2(e){var n,a,c=``;if(typeof e==`string`||typeof e==`number`)c+=e;else if(typeof e==`object`){if(Array.isArray(e)){var m=e.length;for(n=0;n<m;n++)e[n]&&(a=r$2(e[n]))&&(c&&(c+=` `),c+=a)}else for(a in e)e[a]&&(c&&(c+=` `),c+=a)}return c}e(r$2,`r`);function clsx(){for(var e,n,a=0,c=``,m=arguments.length;a<m;a++)(e=arguments[a])&&(n=r$2(e))&&(c&&(c+=` `),c+=n);return c}function PopupMenuHeader(e){let{headerEntries:n,onSelect:a,selectedEntry:c,setSelectedEntry:m,title:v}=e,T=O(()=>groupEntries$1(n),[n]),isActionable=e=>e.action&&!e.disabled,handleClick=(e,n)=>{if(isActionable(n))return a(e,n)};return ar`
36
- <div class="djs-popup-header">
37
- <h3 class="djs-popup-title" title=${v}>${v}</h3>
38
- ${T.map(e=>ar`
39
- <ul key=${e.id} class="djs-popup-header-group" data-header-group=${e.id}>
40
-
41
- ${e.entries.map(e=>ar`
42
- <li key=${e.id}>
43
- <${isActionable(e)?`button`:`span`}
44
- class=${getHeaderClasses(e,e===c)}
45
- onClick=${n=>handleClick(n,e)}
46
- title=${e.title||e.label}
47
- data-id=${e.id}
48
- aria-disabled=${e.disabled||void 0}
49
- onMouseEnter=${()=>isActionable(e)&&m(e)}
50
- onMouseLeave=${()=>isActionable(e)&&m(null)}
51
- onFocus=${()=>isActionable(e)&&m(e)}
52
- onBlur=${()=>isActionable(e)&&m(null)}
53
- >
54
- ${e.imageUrl&&ar`<img class="djs-popup-entry-icon" src=${e.imageUrl} alt="" />`||e.imageHtml&&ar`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:e.imageHtml}} />`}
55
- ${e.label?ar`
56
- <span class="djs-popup-label">${e.label}</span>
57
- `:null}
58
- </${e.action?`button`:`span`}>
59
- </li>
60
- `)}
61
- </ul>
62
- `)}
63
- </div>
64
- `}function groupEntries$1(e){return e.reduce((e,n)=>{let a=n.group||`default`,c=e.find(e=>e.id===a);return c?c.entries.push(n):e.push({id:a,entries:[n]}),e},[])}e(groupEntries$1,`groupEntries`);function getHeaderClasses(e,n){return clsx(`entry`,e.className,e.active?`active`:``,e.disabled?`disabled`:``,n?`selected`:``)}function getPopupMenuItemId(e,n){return`${e}-entry-${n.id}`}function PopupMenuItem(e){let{idPrefix:n,entry:a,selected:c,onMouseEnter:m,onMouseMove:v,onMouseLeave:T,onAction:O}=e,handleClick=(e,n)=>{if(!a.disabled)return O(e,a,n)},A=!a.entries;return ar`
65
- <li
66
- class=${clsx(`entry`,{selected:c,disabled:a.disabled})}
67
- data-id=${a.id}
68
- id=${getPopupMenuItemId(n,a)}
69
- role="option"
70
- aria-selected=${c||void 0}
71
- aria-haspopup=${a.entries?`true`:void 0}
72
- title=${a.title}
73
- aria-disabled=${a.disabled||void 0}
74
- onClick=${handleClick}
75
- onMouseEnter=${m}
76
- onMouseMove=${v}
77
- onMouseLeave=${T}
78
- onDragStart=${e=>A&&handleClick(e,`dragstart`)}
79
- draggable=${A}
80
- >
81
- <div class="djs-popup-entry-content">
82
- <span
83
- class=${clsx(`djs-popup-entry-name`,a.className)}
84
- >
85
- ${a.imageUrl&&ar`<img class="djs-popup-entry-icon" src=${a.imageUrl} alt="" />`||a.imageHtml&&ar`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:a.imageHtml}} />`}
86
-
87
- ${a.label?ar`
88
- <span class="djs-popup-label">
89
- ${a.label}
90
- </span>
91
- `:null}
92
- </span>
93
- ${a.description&&ar`
94
- <span
95
- class="djs-popup-entry-description"
96
- >
97
- ${a.description}
98
- </span>
99
- `}
100
- </div>
101
- ${(a.documentationRef||a.entries)&&ar`
102
- <div class="djs-popup-entry-actions">
103
- ${a.documentationRef&&ar`
104
- <a
105
- class="djs-popup-entry-docs"
106
- href=${a.documentationRef}
107
- onClick=${e=>e.stopPropagation()}
108
- title="Open entry documentation"
109
- tabIndex="-1"
110
- aria-hidden="true"
111
- target="_blank"
112
- rel="noopener"
113
- >
114
- <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
115
- <path fill-rule="evenodd" clip-rule="evenodd" d="M10.6368 10.6375V5.91761H11.9995V10.6382C11.9995 10.9973 11.8623 11.3141 11.5878 11.5885C11.3134 11.863 10.9966 12.0002 10.6375 12.0002H1.36266C0.982345 12.0002 0.660159 11.8681 0.396102 11.6041C0.132044 11.34 1.52588e-05 11.0178 1.52588e-05 10.6375V1.36267C1.52588e-05 0.98236 0.132044 0.660173 0.396102 0.396116C0.660159 0.132058 0.982345 2.95639e-05 1.36266 2.95639e-05H5.91624V1.36267H1.36266V10.6375H10.6368ZM12 0H7.2794L7.27873 1.36197H9.68701L3.06507 7.98391L4.01541 8.93425L10.6373 2.31231V4.72059H12V0Z" fill="currentColor"/>
116
- </svg>
117
- </a>
118
- `}
119
- ${a.entries&&ar`
120
- <div class="djs-popup-entry-chevron" aria-hidden="true">
121
- <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
122
- <path fill-rule="evenodd" clip-rule="evenodd" d="M3.96967 1.46967C4.26256 1.17678 4.73744 1.17678 5.03033 1.46967L9.03033 5.46967C9.32322 5.76256 9.32322 6.23744 9.03033 6.53033L5.03033 10.5303C4.73744 10.8232 4.26256 10.8232 3.96967 10.5303C3.67678 10.2374 3.67678 9.76256 3.96967 9.46967L7.43934 6L3.96967 2.53033C3.67678 2.23744 3.67678 1.76256 3.96967 1.46967Z" fill="currentColor"/>
123
- </svg>
124
- </div>
125
- `}
126
- </div>
127
- `}
128
- </li>
129
- `}function PopupMenuList(e){let{selectedEntry:n,setSelectedEntry:a,groupedEntries:c,keyboardSelection:m,onPointerInteraction:T,idPrefix:O,id:I,ariaLabel:L,tabIndex:U,ariaActivedescendant:G,...K}=e,q=v();A(()=>{if(!m||!m.current)return;let e=q.current;if(!e)return;let n=e.querySelector(`.selected`);n&&scrollIntoView$1(n)},[n]);let handleMouseMove=()=>{m.current=!1,T()},handleEntryMouseMove=e=>{e!==n&&a(e)},handleEntryMouseEnter=e=>{m.current||a(e)},handleEntryMouseLeave=()=>{m.current||a(null)};return ar`
130
- <div
131
- class="djs-popup-results"
132
- ref=${q}
133
- id=${I}
134
- role="listbox"
135
- aria-label=${L}
136
- tabIndex=${U}
137
- aria-activedescendant=${G}
138
- onMouseMove=${handleMouseMove}
139
- >
140
- ${c.map(e=>ar`
141
- ${e.name&&ar`
142
- <div key=${e.id} id=${getGroupHeaderId(O,e)} class="entry-header" title=${e.name}>
143
- ${e.name}
144
- </div>
145
- `}
146
- <ul
147
- class="djs-popup-group"
148
- data-group=${e.id}
149
- role="group"
150
- aria-labelledby=${e.name?getGroupHeaderId(O,e):void 0}
151
- >
152
- ${e.entries.map(e=>ar`
153
- <${PopupMenuItem}
154
- key=${e.id}
155
- idPrefix=${O}
156
- entry=${e}
157
- selected=${e===n}
158
- onMouseEnter=${()=>handleEntryMouseEnter(e)}
159
- onMouseMove=${()=>handleEntryMouseMove(e)}
160
- onMouseLeave=${handleEntryMouseLeave}
161
- ...${K}
162
- />
163
- `)}
164
- </ul>
165
- `)}
166
- </div>
167
- `}function getGroupHeaderId(e,n){return`${e}-group-${n.id}`}function scrollIntoView$1(e){typeof e.scrollIntoViewIfNeeded==`function`?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:`if-needed`,block:`nearest`})}e(scrollIntoView$1,`scrollIntoView`),Tt();var or=new it(`djs-popup`);function PopupMenuComponent(e){let{onClose:n,onSelect:a,className:T,headerEntries:L,position:U,title:G,width:K,scale:q,search:ee,emptyPlaceholder:te,searchFn:ne,entries:J,onOpened:re,onClosed:ie,defaultTab:ae}=e,[oe,se]=c([]);I(()=>{se([]),ue(null)},[J]);let ce=O(()=>{let e=[],n=new Set,a=!1;return J.forEach(({tab:c})=>{c?n.has(c.id)||(n.add(c.id),e.push(c)):a=!0}),!e.length||a&&!ae?[]:a?[ae,...e.filter(e=>e.id!==ae.id)]:e},[J,ae]),[le,ue]=c(null),de=ce.some(e=>e.id===le)?le:ce.length?ce[0].id:null,fe=v();A(()=>{let e=fe.current;if(!e)return;let n=e.querySelector(`[aria-selected="true"]`);n&&scrollIntoView(n)},[de]);let[pe,me]=c({start:!1,end:!1}),he=m(()=>{let{scrollLeft:e,scrollWidth:n,clientWidth:a}=fe.current;me({start:e>0,end:n-a-e>1})},[]),ge=m(e=>{let n=fe.current,a=Math.abs(e.deltaX)>Math.abs(e.deltaY)?e.deltaX:e.deltaY;if(!a)return;let{scrollLeft:c,scrollWidth:m,clientWidth:v}=n;m-v<1||(e.preventDefault(),n.scrollLeft=c+a,he())},[he]);A(()=>{let e=fe.current;if(e)return he(),e.addEventListener(`scroll`,he),e.addEventListener(`wheel`,ge,{passive:!1}),()=>{e.removeEventListener(`scroll`,he),e.removeEventListener(`wheel`,ge)}},[ce,de,he,ge]);let _e=m(e=>{let n=fe.current,a=e>0?[...n.children]:[...n.children].reverse(),c=n.getBoundingClientRect(),m=a.find(n=>{let a=n.getBoundingClientRect();return e>0?a.right>c.right+1:a.left<c.left-1});m&&(scrollIntoView(m),he())},[he]),ve=m(e=>e.tab&&e.tab.id||ae&&ae.id,[ae]),[ye,xe]=c(``),Se=ye.trim().length>0,Ce=O(()=>getActionableEntries(J),[J]),we=O(()=>bt(ee)?Ce.length>5:!1,[ee,Ce]),Te=O(()=>{let e=oe.length?oe[oe.length-1].entries:ce.length>1?J.filter(e=>ve(e)===de):J;return we?Se?ne(Ce.filter(({searchable:e})=>e!==!1),ye,{keys:[`label`,`search`,`description`]}).map(({item:e})=>e):e.filter(({rank:e=0})=>e>=0):e},[we,Se,Ce,ye,ne,oe,J,ce,de,ve]),Ee=O(()=>Se?Te.length?[{id:`default`,entries:Te}]:[]:groupEntries(Te),[Te,Se]),[De,Oe]=c(Te[0]),ke=v(null),Ae=v(!1),[Me,Ne]=c(`keyboard`),Pe=m(()=>{Ne(`keyboard`)},[]),Fe=m(()=>{Ne(`pointer`)},[]),Ie=O(()=>or.next(),[]),Le=`${Ie}-results`,Re=De&&getPopupMenuItemId(Ie,De);I(()=>{let e=ke.current;e&&Te.includes(e)?Oe(e):Oe(Te[0]),ke.current=null},[Te]);let ze=m(e=>{let n=getOrderedEntries(Ee),a=n.indexOf(De)+e;a<0&&(a=n.length-1),a>=n.length&&(a=0),Ae.current=!0,Oe(n[a])},[Ee,De]),Be=m(e=>{e>0&&De&&De.entries&&(Ae.current=!0,se(e=>[...e,De])),e<0&&oe.length>0&&(Ae.current=!0,ke.current=oe[oe.length+e],se(n=>n.slice(0,e)))},[De,oe]),Ve=m((e,n,c)=>{if(n&&!n.disabled)return n.entries?(e.preventDefault(),Be(1)):a(e,n,c)},[a,Be]),He=m(e=>{if(e.key===`Enter`&&De){let n=e.target;return be(n,`a, button`,!0)||De.disabled?void 0:Ve(e,De)}if(e.key===`Backspace`){let n=e.target;if(!(je(n,`input`)&&n.value!==``))return Be(-1),e.preventDefault()}if(e.key===`ArrowUp`)return ze(-1),e.preventDefault();if(e.key===`ArrowDown`)return ze(1),e.preventDefault();if(e.key===`ArrowRight`)return Be(1),e.preventDefault();if(e.key===`ArrowLeft`)return Be(-1),e.preventDefault()},[De,ze,Be,Ve]),Ue=m((e,n)=>{if(ue(n),!e.detail)return;let a=be(e.currentTarget,`.djs-popup`,!0),c=a&&a.querySelector(`input`);c&&c.focus()},[]),We=m(e=>{if(e.key===`Enter`||e.key===` `){e.stopPropagation();return}if(e.key===`ArrowDown`||e.key===`ArrowUp`){let n=be(e.currentTarget,`.djs-popup`,!0),a=n.querySelector(`input`)||n.querySelector(`[role="listbox"]`);a&&a.focus();return}let n=ce.findIndex(e=>e.id===de),a;if(e.key===`ArrowLeft`)a=(n-1+ce.length)%ce.length;else if(e.key===`ArrowRight`)a=(n+1)%ce.length;else if(e.key===`Home`)a=0;else if(e.key===`End`)a=ce.length-1;else return;e.preventDefault(),e.stopPropagation(),ue(ce[a].id);let c=e.currentTarget.parentNode,m=c&&c.children[a];m&&m.focus()},[ce,de]),Ge=m(e=>{je(e.target,`input`)&&xe(()=>e.target.value)},[xe]);I(()=>(re(),()=>{ie()}),[]);let Ke=!Se&&oe.length>0,qe=ce.length>1&&!Se&&oe.length===0;return ar`
168
- <${PopupMenuWrapper}
169
- onClose=${n}
170
- onKeyup=${Ge}
171
- onKeydown=${He}
172
- className=${T}
173
- position=${U}
174
- width=${K}
175
- scale=${q}
176
- navigationStack=${oe}
177
- interactionMode=${Me}
178
- onKeyboardInteraction=${Pe}
179
- >
180
- ${(G||L.length>0)&&!Ke&&ar`
181
- <${PopupMenuHeader}
182
- headerEntries=${L}
183
- onSelect=${a}
184
- selectedEntry=${De}
185
- setSelectedEntry=${Oe}
186
- title=${G}
187
- />
188
- `}
189
- ${Ke&&ar`
190
- <${PopupMenuBreadcrumbs}
191
- navigationStack=${oe}
192
- setNavigationStack=${se}
193
- />
194
- `}
195
- ${J.length>0&&ar`
196
- <div class="djs-popup-body">
197
-
198
- ${we&&ar`
199
- <div class="djs-popup-search">
200
- <svg class="djs-popup-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
201
- <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
202
- </svg>
203
- <input
204
- type="text"
205
- spellcheck=${!1}
206
- role="combobox"
207
- aria-label="${G||`Search`}"
208
- aria-expanded="true"
209
- aria-controls=${Le}
210
- aria-activedescendant=${Re||void 0}
211
- aria-autocomplete="list"
212
- />
213
- </div>
214
- `}
215
-
216
- ${qe&&ar`
217
- <div class="djs-popup-tabs-container">
218
- <div class="djs-popup-tabs" ref=${fe} role="tablist">
219
- ${ce.map(e=>ar`
220
- <button
221
- type="button"
222
- class="djs-popup-tab"
223
- role="tab"
224
- title=${e.title||void 0}
225
- aria-controls=${Le}
226
- aria-selected=${e.id===de}
227
- tabIndex=${e.id===de?0:-1}
228
- onClick=${n=>Ue(n,e.id)}
229
- onKeydown=${We}
230
- >${e.label}</button>
231
- `)}
232
- </div>
233
-
234
- ${``}
235
- ${[-1,1].map(e=>(e<0?pe.start:pe.end)&&ar`
236
- <button
237
- type="button"
238
- class=${`djs-popup-tabs-scroll djs-popup-tabs-scroll-${e<0?`start`:`end`}`}
239
- aria-hidden="true"
240
- tabIndex="-1"
241
- onMousedown=${e=>e.preventDefault()}
242
- onClick=${()=>_e(e)}
243
- >
244
- <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
245
- <path fill-rule="evenodd" clip-rule="evenodd" d="M3.96967 1.46967C4.26256 1.17678 4.73744 1.17678 5.03033 1.46967L9.03033 5.46967C9.32322 5.76256 9.32322 6.23744 9.03033 6.53033L5.03033 10.5303C4.73744 10.8232 4.26256 10.8232 3.96967 10.5303C3.67678 10.2374 3.67678 9.76256 3.96967 9.46967L7.43934 6L3.96967 2.53033C3.67678 2.23744 3.67678 1.76256 3.96967 1.46967Z" fill="currentColor"/>
246
- </svg>
247
- </button>
248
- `)}
249
- </div>
250
- `}
251
-
252
- ${Se&&ar`
253
- <div class="djs-popup-search-count" aria-live="polite">
254
- ${Te.length} ${Te.length===1?`result`:`results`} found
255
- </div>
256
- `}
257
-
258
- <${PopupMenuList}
259
- groupedEntries=${Ee}
260
- selectedEntry=${De}
261
- setSelectedEntry=${Oe}
262
- keyboardSelection=${Ae}
263
- onPointerInteraction=${Fe}
264
- onAction=${Ve}
265
- idPrefix=${Ie}
266
- id=${Le}
267
- ariaLabel=${G||`Results`}
268
- tabIndex=${we?-1:0}
269
- ariaActivedescendant=${we?void 0:Re||void 0}
270
- />
271
-
272
- ${De&&De.documentationRef&&ar`
273
- <div class="djs-popup-footer">
274
- <a
275
- class="djs-popup-footer-docs"
276
- href=${De.documentationRef}
277
- onClick=${e=>e.stopPropagation()}
278
- aria-label=${De.label?`Open entry documentation for ${De.label}`:`Open entry documentation`}
279
- target="_blank"
280
- rel="noopener"
281
- >
282
- Open entry documentation
283
-
284
- <svg aria-hidden="true" width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
285
- <path fill-rule="evenodd" clip-rule="evenodd" d="M10.6368 10.6375V5.91761H11.9995V10.6382C11.9995 10.9973 11.8623 11.3141 11.5878 11.5885C11.3134 11.863 10.9966 12.0002 10.6375 12.0002H1.36266C0.982345 12.0002 0.660159 11.8681 0.396102 11.6041C0.132044 11.34 1.52588e-05 11.0178 1.52588e-05 10.6375V1.36267C1.52588e-05 0.98236 0.132044 0.660173 0.396102 0.396116C0.660159 0.132058 0.982345 2.95639e-05 1.36266 2.95639e-05H5.91624V1.36267H1.36266V10.6375H10.6368ZM12 0H7.2794L7.27873 1.36197H9.68701L3.06507 7.98391L4.01541 8.93425L10.6373 2.31231V4.72059H12V0Z" fill="#818798"/>
286
- </svg>
287
- </a>
288
- </div>
289
- `}
290
- </div>
291
- `}
292
- ${te&&Te.length===0&&ar`
293
- <div class="djs-popup-no-results">${ht(te)?te(ye):te}</div>
294
- `}
295
- </${PopupMenuWrapper}>
296
- `}function scrollIntoView(e){typeof e.scrollIntoViewIfNeeded==`function`?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:`if-needed`,block:`nearest`,inline:`nearest`})}function PopupMenuWrapper(e){let{onClose:n,onKeydown:a,onKeyup:c,onKeyboardInteraction:m,className:T,children:O,navigationStack:L,interactionMode:U,position:G}=e,K=v();return A(()=>{if(typeof G!=`function`)return;let e=K.current,n=G(e);e.style.left=`${n.x}px`,e.style.top=`${n.y}px`},[K.current,G]),A(()=>{let e=K.current;e&&(e.querySelector(`input`)||e.querySelector(`[role="listbox"]`)||e).focus()},[L]),I(()=>{let handleKeyDown=e=>{if(e.key===`Escape`)return e.preventDefault(),n()},handleClick=e=>{if(!be(e.target,`.djs-popup`,!0))return n()};return document.documentElement.addEventListener(`keydown`,handleKeyDown),document.body.addEventListener(`click`,handleClick,!0),()=>{document.documentElement.removeEventListener(`keydown`,handleKeyDown),document.body.removeEventListener(`click`,handleClick,!0)}},[]),ar`
297
- <div
298
- class=${clsx(`djs-popup`,T,{"djs-popup--pointer":U===`pointer`})}
299
- style=${getPopupStyle(e)}
300
- onKeydownCapture=${m}
301
- onKeydown=${a}
302
- onKeyup=${c}
303
- ref=${K}
304
- tabIndex="-1"
305
- >
306
- ${O}
307
- </div>
308
- `}function getPopupStyle(e){let{width:n}=e,a=typeof n==`number`?`${n}px`:n;return{transform:`scale(${e.scale})`,width:bt(n)?a:void 0,maxWidth:bt(n)?`unset`:void 0,"transform-origin":`top left`}}function getOrderedEntries(e){let n=[];return e.forEach(e=>{e.entries.forEach(e=>{n.push(e)})}),n}function getActionableEntries(e){let n=[];function walk(e){e.forEach(e=>{e.entries?walk(e.entries):n.push(e)})}return walk(e),n}function groupEntries(e){let n=[],getGroup=e=>n.find(n=>e.id===n.id),containsGroup=e=>!!getGroup(e),formatGroup=e=>typeof e==`string`?{id:e}:e;return e.forEach(e=>{let a=e.group?formatGroup(e.group):{id:`default`};containsGroup(a)?getGroup(a).entries.push(e):n.push({...a,entries:[e]})}),n}Tt();var sr=`data-id`,cr=[`contextPad.close`,`canvas.viewbox.changing`,`commandStack.changed`],lr=1e3;function PopupMenu(e,n,a,c){this._eventBus=n,this._canvas=a,this._search=c,this._current=null;var m=bt(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:m,defaultTab:e&&e.defaultTab},n.on(`diagram.destroy`,()=>{this.close()}),n.on(`element.changed`,e=>{let n=this.isOpen()&&this._current.target;e.element===n&&this.refresh()})}PopupMenu.$inject=[`config.popupMenu`,`eventBus`,`canvas`,`search`],PopupMenu.prototype._render=function(){let{position:e,providerId:n,entries:a,headerEntries:c,emptyPlaceholder:m,options:v}=this._current,O=flattenEntries(a),A=Object.entries(c).map(([e,n])=>({id:e,...n})),I=e&&(n=>this._ensureVisible(n,e)),L=this._updateScale(this._current.container),onClose=e=>this.close(e),onSelect=(e,n,a)=>this.trigger(e,n,a);T(ar`
309
- <${PopupMenuComponent}
310
- onClose=${onClose}
311
- onSelect=${onSelect}
312
- position=${I}
313
- className=${n}
314
- entries=${O}
315
- headerEntries=${A}
316
- emptyPlaceholder=${m}
317
- scale=${L}
318
- onOpened=${this._onOpened.bind(this)}
319
- onClosed=${this._onClosed.bind(this)}
320
- searchFn=${this._search}
321
- defaultTab=${this._config.defaultTab}
322
- ...${{...v}}
323
- />
324
- `,this._current.container)},PopupMenu.prototype.open=function(e,n,a,c){if(!e)throw Error(`target is missing`);if(!n)throw Error(`providers for <`+n+`> not found`);if(!a)throw Error(`position is missing`);if(this._eventBus.fire(`popupMenu.open.allowed`,{target:e,providerId:n})===!1)return;this.isOpen()&&this.close();let{entries:m,headerEntries:v,emptyPlaceholder:T}=this._getContext(e,n);this._current={position:a,providerId:n,target:e,entries:m,headerEntries:v,emptyPlaceholder:T,container:this._createContainer({provider:n}),options:c},this._emit(`open`),this._bindAutoClose(),this._render()},PopupMenu.prototype.refresh=function(){if(!this.isOpen())return;let{target:e,providerId:n}=this._current,{entries:a,headerEntries:c,emptyPlaceholder:m}=this._getContext(e,n);this._current={...this._current,entries:a,headerEntries:c,emptyPlaceholder:m},this._emit(`refresh`),this._render()},PopupMenu.prototype._getContext=function(e,n){let a=this._getProviders(n);if(!a||!a.length)throw Error(`provider for <`+n+`> not found`);let c=this._getEntries(e,a),m=this._getHeaderEntries(e,a);return{entries:c,headerEntries:m,emptyPlaceholder:this._getEmptyPlaceholder(a),empty:!(Object.keys(c).length||Object.keys(m).length)}},PopupMenu.prototype.close=function(){this.isOpen()&&(this._emit(`close`),this.reset(),this._canvas.restoreFocus(),this._current=null)},PopupMenu.prototype.reset=function(){let e=this._current.container;T(null,e),Ue(e)},PopupMenu.prototype._emit=function(e,n){this._eventBus.fire(`popupMenu.${e}`,n)},PopupMenu.prototype._onOpened=function(){this._emit(`opened`)},PopupMenu.prototype._onClosed=function(){this._emit(`closed`)},PopupMenu.prototype._createContainer=function(e){var n=this._canvas.getContainer();let a=Je(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(a),a},PopupMenu.prototype._bindAutoClose=function(){this._eventBus.once(cr,this.close,this)},PopupMenu.prototype._unbindAutoClose=function(){this._eventBus.off(cr,this.close,this)},PopupMenu.prototype._updateScale=function(){var e=this._canvas.zoom(),n=this._config.scale,a,c,m=e;return n!==!0&&(n===!1?(a=1,c=1):(a=n.min,c=n.max),bt(a)&&e<a&&(m=a),bt(c)&&e>c&&(m=c)),m},PopupMenu.prototype._ensureVisible=function(e,n){var a=document.documentElement.getBoundingClientRect(),c=e.getBoundingClientRect(),m={},v=n.x,T=n.y;return n.x+c.width>a.width&&(m.x=!0),n.y+c.height>a.height&&(m.y=!0),m.x&&m.y?(v=n.x-c.width,T=n.y-c.height):m.x?(v=n.x-c.width,T=n.y):m.y&&n.y<c.height?(v=n.x,T=10):m.y&&(v=n.x,T=n.y-c.height),n.y<a.top&&(T=n.y+c.height),{x:v,y:T}},PopupMenu.prototype.isEmpty=function(e,n){if(!e)throw Error(`target is missing`);if(!n)throw Error(`provider ID is missing`);let a=this._getProviders(n);return!a||!a.length||this._getContext(e,n).empty},PopupMenu.prototype.registerProvider=function(e,n,a){a||(a=n,n=lr),this._eventBus.on(`popupMenu.getProviders.`+e,n,function(e){e.providers.push(a)})},PopupMenu.prototype._getProviders=function(e){var n=this._eventBus.createEvent({type:`popupMenu.getProviders.`+e,providers:[]});return this._eventBus.fire(n),n.providers},PopupMenu.prototype._getEntries=function(e,n){var a={};return Q(n,function(n){if(!n.getPopupMenuEntries)Q(n.getEntries(e),function(e){var n=e.id;if(!n)throw Error(`entry ID is missing`);a[n]=ct(e,[`id`])});else{var c=n.getPopupMenuEntries(e);ht(c)?a=c(a):Q(c,function(e,n){a[n]=e})}}),a},PopupMenu.prototype._getHeaderEntries=function(e,n){var a={};return Q(n,function(n){if(n.getPopupMenuHeaderEntries){var c=n.getPopupMenuHeaderEntries(e);ht(c)?a=c(a):Q(c,function(e,n){a[n]=e})}else{if(!n.getHeaderEntries)return;Q(n.getHeaderEntries(e),function(e){var n=e.id;if(!n)throw Error(`entry ID is missing`);a[n]=ct(e,[`id`])})}}),a},PopupMenu.prototype._getEmptyPlaceholder=function(e){let n=e.find(e=>ht(e.getEmptyPlaceholder));return n&&n.getEmptyPlaceholder()},PopupMenu.prototype.isOpen=function(){return!!this._current},PopupMenu.prototype.trigger=function(e,n,a=`click`){if(e.preventDefault(),!n){let a=be(e.delegateTarget||e.target,`.entry`,!0),c=ie(a,sr);n={id:c,...this._getEntry(c)}}let c=n.action;if(this._emit(`trigger`,{entry:n,event:e})!==!1){if(ht(c)){if(a===`click`)return c(e,n)}else if(c[a])return c[a](e,n)}},PopupMenu.prototype._getEntry=function(e){var n=this._current.entries[e]||this._current.headerEntries[e];if(!n)throw Error(`entry not found`);return n};function flattenEntries(e,n=[]){return Object.entries(e).map(([e,a])=>{let c={id:e,...a};return c.entries?c.entries=flattenEntries(c.entries,[...n,...asArray$1(c.search)]):n.length&&(c.search=[...n,...asArray$1(c.search)]),c})}function asArray$1(e){return e?xt(e)?e:[e]:[]}e(asArray$1,`asArray`),Tt();function search(e,n,a){let{keys:c}=a;if(n=n.trim().toLowerCase(),!n)throw Error(`<pattern> must not be empty`);let m=n.trim().toLowerCase().split(/\s+/);return e.flatMap(e=>{let n=matchItem(e,m,c);return n?{item:e,tokens:n}:[]}).sort(createResultSorter(c))}function matchItem(e,n,a){let{matchedWords:c,tokens:m}=a.reduce((a,c)=>{let m=e[c],{tokens:v,matchedWords:T}=xt(m)?m.reduce((e,a)=>{let{tokens:c,matchedWords:m}=matchString(a,n);return{tokens:[...e.tokens,c],matchedWords:{...e.matchedWords,...m}}},{matchedWords:{},tokens:[]}):matchString(m,n);return{tokens:{...a.tokens,[c]:v},matchedWords:{...a.matchedWords,...T}}},{matchedWords:{},tokens:{}});return Object.keys(c).length===n.length?m:null}function createResultSorter(e){return(n,a)=>{let c=0,m=1;for(let v of e){let e=compareTokens(n.tokens[v],a.tokens[v]);if(e!==0){c+=e*m,m*=ur;continue}let T=compareStrings(n.item[v],a.item[v]);T!==0&&(c+=T*m,m*=ur)}return c}}function compareTokens(e,n){return scoreTokens(n)-scoreTokens(e)}var ur=.5,dr={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function scoreTokens(e){let n=e.reduce((e,n)=>e+scoreToken(n),0),a=e.flat(),c=a.reduce((e,n)=>e+n.value.length,0),m=a.reduce((e,n)=>e+(n.match?n.value.length:0),0);return n*(1+(c?m/c:0))}function scoreToken(e){if(xt(e))return Math.max(...e.map(scoreToken));let n=Math.log(e.value.length);return e.match?(e.start?e.end?dr.FULL:e.wordEnd?dr.START_FULL_WORD:dr.START_WORD_PART:e.wordStart?dr.WORD_START:dr.WORD_PART)*n:dr.NO_MATCH*n}function stringJoin(e=``){return xt(e)?e.join(`, `):e}function compareStrings(e,n){return stringJoin(e).localeCompare(stringJoin(n))}function matchString(e,n){if(!e)return{tokens:[],matchedWords:{}};let a=[],c={},m=n.map(escapeRegexp),v=[`(?<all>${m.join(`\\s+`)})`,...m].join(`|`),T=new RegExp(v,`ig`),O,A=0;for(;O=T.exec(e);){let[m]=O,v=O.index,T=O.index+m.length,I=v===0,L=T===e.length,U=!!O.groups?.all,G=I||/\s/.test(e.charAt(v-1)),K=L||/\s/.test(e.charAt(T));O.index>A&&a.push({value:e.slice(A,O.index),index:A}),a.push({value:m,index:O.index,match:!0,wordStart:G,wordEnd:K,start:I,end:L,all:U});let q=U?n:[m];for(let e of q)c[e.toLowerCase()]=!0;A=O.index+m.length}return A<e.length&&a.push({value:e.slice(A),index:A}),{tokens:a,matchedWords:c}}function escapeRegexp(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,`\\$&`)}var fr={search:[`value`,search]},pr={__depends__:[fr],__init__:[`popupMenu`],popupMenu:[`type`,PopupMenu]};function RuleProvider(e){tt.call(this,e),this.init()}RuleProvider.$inject=[`eventBus`],Re(RuleProvider,tt),RuleProvider.prototype.addRule=function(e,n,a){var c=this;typeof e==`string`&&(e=[e]),e.forEach(function(e){c.canExecute(e,n,function(e,n,c){return a(e)},!0)})},RuleProvider.prototype.init=function(){},Tt();var mr=10,hr=250;function findFreePosition(e,n,a,c){for(var m;m=getConnectedAtPosition(e,a,n);)a=c(n,a,m);return a}function generateGetNextPosition(e){return function(n,a,c){var m={x:a.x,y:a.y};return[`x`,`y`].forEach(function(v){var T=e[v];if(T){var O=v===`x`?`width`:`height`,A=T.margin,I=T.minDistance;m[v]=A<0?Math.min(c[v]+A-n[O]/2,a[v]-I+A):Math.max(c[v]+c[O]+A+n[O]/2,a[v]+I+A)}}),m}}function getConnectedAtPosition(e,n,a){var c={x:n.x-a.width/2,y:n.y-a.height/2,width:a.width,height:a.height},m=getAutoPlaceClosure(e);return kt(m,function(e){return e!==a&&et(e,c,mr)===`intersect`})}function getConnectedDistance(e,n){n||={};function getDefaultWeight(n){return n.source===e?1:-1}var a=n.defaultDistance||50,c=n.direction||`e`,m=n.filter,v=n.getWeight||getDefaultWeight,T=n.maxDistance||hr,O=n.reference||`start`;m||=noneFilter;function getDistance(e,n){return c===`n`?O===`start`?Ge(e).top-Ge(n).bottom:O===`center`?Ge(e).top-Ve(n).y:Ge(e).top-Ge(n).top:c===`w`?O===`start`?Ge(e).left-Ge(n).right:O===`center`?Ge(e).left-Ve(n).x:Ge(e).left-Ge(n).left:c===`s`?O===`start`?Ge(n).top-Ge(e).bottom:O===`center`?Ve(n).y-Ge(e).bottom:Ge(n).bottom-Ge(e).bottom:O===`start`?Ge(n).left-Ge(e).right:O===`center`?Ve(n).x-Ge(e).right:Ge(n).right-Ge(e).right}var A=e.incoming.filter(m).map(function(n){var a=v(n),c=a<0?getDistance(n.source,e):getDistance(e,n.source);return{id:n.source.id,distance:c,weight:a}}),I=e.outgoing.filter(m).map(function(n){var a=v(n),c=a>0?getDistance(e,n.target):getDistance(n.target,e);return{id:n.target.id,distance:c,weight:a}}),L=A.concat(I).reduce(function(e,n){return e[n.id+`__weight_`+n.weight]=n,e},{});return Ct(L,function(e,n){var a=n.distance,c=n.weight;return a<0||a>T||(e[String(a)]||(e[String(a)]=0),e[String(a)]+=1*c,(!e.distance||e[e.distance]<e[String(a)])&&(e.distance=a)),e},{}).distance||a}function getAutoPlaceClosure(e){var n=getConnected(e);return e.host&&(n=n.concat(getConnected(e.host))),e.attachers&&(n=n.concat(e.attachers.reduce(function(e,n){return e.concat(getConnected(n))},[]))),n}function getConnected(e){return getTargets(e).concat(getSources(e))}function getSources(e){return e.incoming.map(function(e){return e.source})}function getTargets(e){return e.outgoing.map(function(e){return e.target})}function noneFilter(){return!0}var gr=100;function AutoPlace(e,n,a){e.on(`autoPlace`,gr,function(e){var n=e.shape,a=e.source;return getNewShapePosition(a,n)}),e.on(`autoPlace.end`,function(e){a.scrollToElement(e.shape)}),this.append=function(a,c,m){e.fire(`autoPlace.start`,{source:a,shape:c});var v=e.fire(`autoPlace`,{source:a,shape:c}),T=n.appendShape(a,c,v,a.parent,m);return e.fire(`autoPlace.end`,{source:a,shape:T}),T}}AutoPlace.$inject=[`eventBus`,`modeling`,`canvas`];function getNewShapePosition(e,n,a){a||={};var c=a.defaultDistance||50,m=Ve(e);return{x:Ge(e).right+c+n.width/2,y:m.y}}function AutoPlaceSelectionBehavior(e,n){e.on(`autoPlace.end`,500,function(e){n.select(e.shape)})}AutoPlaceSelectionBehavior.$inject=[`eventBus`,`selection`];var _r={__init__:[`autoPlaceSelectionBehavior`],autoPlace:[`type`,AutoPlace],autoPlaceSelectionBehavior:[`type`,AutoPlaceSelectionBehavior]};Tt();function AutoResize(e,n,a,c){tt.call(this,e),this._elementRegistry=n,this._modeling=a,this._rules=c;var m=this;this.postExecuted([`shape.create`],function(e){var n=e.context,a=n.hints||{},c=n.shape,v=n.parent||n.newParent;a.autoResize!==!1&&m._expand([c],v)}),this.postExecuted([`elements.move`],function(e){var n=e.context,a=wt(ut(n.closure.topLevel)),c=n.hints,v=!c||c.autoResize;if(v!==!1){var T=yt(a,function(e){return e.parent.id});Q(T,function(e,n){xt(v)&&(e=e.filter(function(e){return kt(v,mt({id:e.id}))})),m._expand(e,n)})}}),this.postExecuted([`shape.toggleCollapse`],function(e){var n=e.context,a=n.hints,c=n.shape;a&&a.autoResize===!1||c.collapsed||m._expand(c.children||[],c)}),this.postExecuted([`shape.resize`],function(e){var n=e.context,a=n.hints,c=n.shape,v=c.parent;a&&a.autoResize===!1||v&&m._expand([c],v)})}AutoResize.$inject=[`eventBus`,`elementRegistry`,`modeling`,`rules`],Re(AutoResize,tt),AutoResize.prototype._getOptimalBounds=function(e,n){var a=this.getOffset(n),c=this.getPadding(n),m=Ge(J(e)),v=Ge(n),T={};return m.top-v.top<c.top&&(T.top=m.top-a.top),m.left-v.left<c.left&&(T.left=m.left-a.left),v.right-m.right<c.right&&(T.right=m.right+a.right),v.bottom-m.bottom<c.bottom&&(T.bottom=m.bottom+a.bottom),we(At({},v,T))},AutoResize.prototype._expand=function(e,n){if(typeof n==`string`&&(n=this._elementRegistry.get(n)),this._rules.allowed(`element.autoResize`,{elements:e,target:n})){var a=this._getOptimalBounds(e,n);if(boundsChanged$1(a,n)){var c=getResizeDirections(pt(n,[`x`,`y`,`width`,`height`]),a);this.resize(n,a,{autoResize:c});var m=n.parent;m&&this._expand([n],m)}}},AutoResize.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},AutoResize.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},AutoResize.prototype.resize=function(e,n,a){this._modeling.resizeShape(e,n,null,a)};function boundsChanged$1(e,n){return e.x!==n.x||e.y!==n.y||e.width!==n.width||e.height!==n.height}e(boundsChanged$1,`boundsChanged`);function getResizeDirections(e,n){var a=``;return e=Ge(e),n=Ge(n),e.top>n.top&&(a=a.concat(`n`)),e.right<n.right&&(a=a.concat(`w`)),e.bottom<n.bottom&&(a=a.concat(`s`)),e.left>n.left&&(a=a.concat(`e`)),a}function AutoResizeProvider(e){RuleProvider.call(this,e);var n=this;this.addRule(`element.autoResize`,function(e){return n.canResize(e.elements,e.target)})}AutoResizeProvider.$inject=[`eventBus`],Re(AutoResizeProvider,RuleProvider),AutoResizeProvider.prototype.canResize=function(e,n){return!1};var vr=1500;function HoverFix(e,n,a){var c=this,m=a.get(`dragging`,!1);function ensureHover(n){if(!n.hover){var a=n.originalEvent,v=c._findTargetGfx(a),T=v&&e.get(v);v&&T&&(n.stopPropagation(),m.hover({element:T,gfx:v}),m.move(a))}}m&&n.on(`drag.start`,function(e){n.once(`drag.move`,vr,function(e){ensureHover(e)})}),(function(){var e,a;n.on(`element.hover`,function(n){e=n.gfx,a=n.element}),n.on(`element.hover`,vr,function(c){a&&n.fire(`element.out`,{element:a,gfx:e})}),n.on(`element.out`,function(){e=null,a=null})})(),this._findTargetGfx=function(e){var n,a;if(e instanceof MouseEvent)return n=ke(e),a=document.elementFromPoint(n.x,n.y),getGfx(a)}}HoverFix.$inject=[`elementRegistry`,`eventBus`,`injector`];function getGfx(e){return be(e,`svg, .djs-element`,!0)}var yr={__init__:[`hoverFix`],hoverFix:[`type`,HoverFix]};Tt();var br=Math.round,xr=`djs-drag-active`,Sr=500;function preventDefault$2(e){e.preventDefault()}e(preventDefault$2,`preventDefault`);function isTouchEvent(e){return typeof TouchEvent<`u`&&e instanceof TouchEvent}function getLength(e){return Math.sqrt(e.x**2+e.y**2)}function Dragging(e,n,a,c){var m={threshold:5,trapClick:!0},v;function toLocalPoint(e){var a=n.viewbox(),c=n._container.getBoundingClientRect();return{x:a.x+(e.x-c.left)/a.scale,y:a.y+(e.y-c.top)/a.scale}}function fire(n,a){a||=v;var c=e.createEvent(At({},a.payload,a.data,{isTouch:a.isTouch}));return e.fire(`drag.`+n,c)!==!1&&e.fire(a.prefix+`.`+n,c)}function restoreSelection(e){var n=e.filter(function(e){return c.get(e.id)});n.length&&a.select(n)}function move(e,c){var m=v.payload,T=v.displacement,O=v.globalStart,A=ke(e),I=delta(A,O),L=v.localStart,U=toLocalPoint(A),G=delta(U,L);if(!v.active&&(c||getLength(I)>v.threshold)){if(At(m,{x:br(L.x+T.x),y:br(L.y+T.y),dx:0,dy:0},{originalEvent:e}),!1===fire(`start`))return cancel();v.active=!0,v.keepSelection||(m.previousSelection=a.get(),a.select(null)),v.cursor&&set(v.cursor),n.addMarker(n.getRootElement(),xr)}$e(e),v.active&&(At(m,{x:br(U.x+T.x),y:br(U.y+T.y),dx:br(G.x),dy:br(G.y)},{originalEvent:e}),fire(`move`))}function end(e){var n,a=!0;v.active&&(e&&(v.payload.originalEvent=e,$e(e)),a=fire(`end`)),a===!1&&fire(`rejected`),n=cleanup(a!==!0),fire(`ended`,n)}function cancelOnError(){cancel()}function checkCancel(e){isKey(`Escape`,e)&&(preventDefault$2(e),cancel())}function trapClickAndEnd(n){var a;v.active&&(a=install(e),setTimeout(a,400),preventDefault$2(n)),end(n)}function trapTouch(e){move(e)}function hover(e){var n=v.payload;n.hoverGfx=e.gfx,n.hover=e.element,fire(`hover`)}function out(e){fire(`out`);var n=v.payload;n.hoverGfx=null,n.hover=null}function cancel(n){var a;if(v){var c=v.active;e.off(`error`,cancelOnError);try{c&&fire(`cancel`)}finally{a=cleanup(n)}c&&fire(`canceled`,a)}}function cleanup(n){var a;e.off(`error`,cancelOnError);try{fire(`cleanup`)}finally{a=finishCleanup(n)}return a}function finishCleanup(c){var m,T;unset(),T=v.trapClick?trapClickAndEnd:end,K.unbind(document,`mousemove`,move),K.unbind(document,`dragstart`,preventDefault$2),K.unbind(document,`selectstart`,preventDefault$2),K.unbind(document,`mousedown`,T,!0),K.unbind(document,`mouseup`,T,!0),K.unbind(document,`keyup`,checkCancel),K.unbind(document,`touchstart`,trapTouch,!0),K.unbind(document,`touchcancel`,cancel,!0),K.unbind(document,`touchmove`,move,!0),K.unbind(document,`touchend`,end,!0),e.off(`element.hover`,hover),e.off(`element.out`,out),n.removeMarker(n.getRootElement(),xr);var O=v.payload.previousSelection;return m=v,v=null,c!==!1&&O&&!a.get().length&&restoreSelection(O),m}function init(n,a,c,T){v&&cancel(!1),typeof a==`string`&&(T=c,c=a,a=null),T=At({},m,T||{});var O=T.data||{},A,I,L,U=T.trapClick?trapClickAndEnd:end,G;if(n?(A=Be(n)||n,I=ke(n),$e(n),A.type===`dragstart`&&preventDefault$2(A)):(A=null,I={x:0,y:0}),L=toLocalPoint(I),a||=L,G=isTouchEvent(A),v=At({prefix:c,data:O,payload:{},globalStart:I,displacement:delta(a,L),localStart:L,isTouch:G},T),e.once(`error`,Sr,cancelOnError),T.manual||(G?(K.bind(document,`touchstart`,trapTouch,!0),K.bind(document,`touchcancel`,cancel,!0),K.bind(document,`touchmove`,move,!0),K.bind(document,`touchend`,end,!0)):(K.bind(document,`mousemove`,move),K.bind(document,`dragstart`,preventDefault$2),K.bind(document,`selectstart`,preventDefault$2),K.bind(document,`mousedown`,U,!0),K.bind(document,`mouseup`,U,!0)),K.bind(document,`keyup`,checkCancel),e.on(`element.hover`,hover),e.on(`element.out`,out)),fire(`init`)===!1)return cancel(),!1;T.autoActivate&&move(n,!0)}e.on(`diagram.destroy`,cancel),this.init=init,this.move=move,this.hover=hover,this.out=out,this.end=end,this.cancel=cancel,this.context=function(){return v},this.setOptions=function(e){At(m,e)}}Dragging.$inject=[`eventBus`,`canvas`,`selection`,`elementRegistry`];var Cr={__depends__:[yr,qe],dragging:[`type`,Dragging]};Tt();function AutoScroll(e,n,a){this._canvas=a,this._opts=At({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var c=this;n.on(`drag.move`,function(e){var n=c._toBorderPoint(e);c.startScroll(n)}),n.on([`drag.cleanup`],function(){c.stopScroll()})}AutoScroll.$inject=[`config.autoScroll`,`eventBus`,`canvas`],AutoScroll.prototype.startScroll=function(e){var n=this._canvas,a=this._opts,c=this,m=n.getContainer().getBoundingClientRect(),v=[e.x,e.y,m.width-e.x,m.height-e.y];this.stopScroll();for(var T=0,O=0,A=0;A<4;A++)between(v[A],a.scrollThresholdOut[A],a.scrollThresholdIn[A])&&(A===0?T=a.scrollStep:A==1?O=a.scrollStep:A==2?T=-a.scrollStep:A==3&&(O=-a.scrollStep));(T!==0||O!==0)&&(n.scroll({dx:T,dy:O}),this._scrolling=setTimeout(function(){c.startScroll(e)},a.scrollRepeatTimeout))};function between(e,n,a){return n<e&&e<a}AutoScroll.prototype.stopScroll=function(){clearTimeout(this._scrolling)},AutoScroll.prototype.setOptions=function(e){this._opts=At({},this._opts,e)},AutoScroll.prototype._toBorderPoint=function(e){var n=this._canvas._container.getBoundingClientRect(),a=ke(e.originalEvent);return{x:a.x-n.left,y:a.y-n.top}};var wr={__depends__:[Cr],__init__:[`autoScroll`],autoScroll:[`type`,AutoScroll]};function Rules(e){this._commandStack=e.get(`commandStack`,!1)}Rules.$inject=[`injector`],Rules.prototype.allowed=function(e,n){var a=!0,c=this._commandStack;return c&&(a=c.canExecute(e,n)),a===void 0||a};var Tr={__init__:[`rules`],rules:[`type`,Rules]},Er=Math.round,Dr=Math.max;function circlePath(e,n){return[[`M`,e.x,e.y],[`m`,0,-n],[`a`,n,n,0,1,1,0,2*n],[`a`,n,n,0,1,1,0,-2*n],[`z`]]}function linePath(e){var n=[];return e.forEach(function(e,a){n.push([a===0?`M`:`L`,e.x,e.y])}),n}var Or=10;function getBendpointIntersection(e,n){for(var a=0,c;c=e[a];a++)if(nt(c,n)<=Or)return{point:e[a],bendpoint:!0,index:a};return null}function getPathIntersection(e,n){var a=Fe(circlePath(n,Or),linePath(e)),c=a[0],m=a[a.length-1],v;return c?c===m?{point:{x:Er(c.x),y:Er(c.y)},index:c.segment2}:c.segment2===m.segment2?{point:{x:Er(c.x+m.x)/2,y:Er(c.y+m.y)/2},index:c.segment2}:(v=Dr(c.segment2,m.segment2)-1,{point:e[v],bendpoint:!0,index:v}):null}function getApproxIntersection(e,n){return getBendpointIntersection(e,n)||getPathIntersection(e,n)}function vectorLength(e){return Math.sqrt(e.x**2+e.y**2)}function getAngle(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function rotateVector(e,n){return n?{x:Math.cos(n)*e.x-Math.sin(n)*e.y,y:Math.sin(n)*e.x+Math.cos(n)*e.y}:e}function solveLambaSystem(e,n,a){var c=[{n:e[0]-a[0],lambda:n[0]},{n:e[1]-a[1],lambda:n[1]}],m=c[0].n*n[0]+c[1].n*n[1],v=c[0].lambda*n[0]+c[1].lambda*n[1];return-m/v}function perpendicularFoot(e,n){var a=n[0],c=n[1],m={x:c.x-a.x,y:c.y-a.y},v=solveLambaSystem([a.x,a.y],[m.x,m.y],[e.x,e.y]);return{x:a.x+v*m.x,y:a.y+v*m.y}}function getDistancePointLine(e,n){var a=perpendicularFoot(e,n);return vectorLength({x:a.x-e.x,y:a.y-e.y})}function getDistancePointPoint(e,n){return vectorLength({x:e.x-n.x,y:e.y-n.y})}var kr=`djs-bendpoint`,Ar=`djs-segment-dragger`;function toCanvasCoordinates(e,n){var a=ke(n),c=e._container.getBoundingClientRect(),m={x:c.left,y:c.top},v=e.viewbox();return{x:v.x+(a.x-m.x)/v.scale,y:v.y+(a.y-m.y)/v.scale}}function getConnectionIntersection(e,n,a){return getApproxIntersection(n,toCanvasCoordinates(e,a))}function addBendpoint(e,n){var a=he(`g`);de(a).add(kr),re(e,a);var c=he(`circle`);oe(c,{cx:0,cy:0,r:4}),de(c).add(`djs-visual`),re(a,c);var m=he(`circle`);return oe(m,{cx:0,cy:0,r:10}),de(m).add(`djs-hit`),re(a,m),n&&de(a).add(n),a}function createParallelDragger(e,n,a,c){var m=he(`g`);re(e,m);var v=18,T=6,O=11,A=calculateHitWidth(n,a,c),I=T+O,L=he(`rect`);oe(L,{x:-v/2,y:-T/2,rx:3,width:v,height:T}),de(L).add(`djs-visual`),re(m,L);var U=he(`rect`);return oe(U,{x:-A/2,y:-I/2,width:A,height:I}),de(U).add(`djs-hit`),re(m,U),ye(m,c===`v`?90:0,0,0),m}function addSegmentDragger(e,n,a){var c=he(`g`),m=Se(n,a),v=Ee(n,a);return re(e,c),createParallelDragger(c,n,a,v),de(c).add(Ar),de(c).add(v===`h`?`horizontal`:`vertical`),G(c,m.x,m.y),c}function calculateSegmentMoveRegion(e){return Math.abs(Math.round(e*2/3))}function getClosestPointOnConnection(e,n){return perpendicularFoot(e,getClosestSegment(e,n))}function calculateHitWidth(e,n,a){var c=n.x-e.x,m=n.y-e.y;return calculateSegmentMoveRegion(a===`h`?c:m)}function getClosestSegment(e,n){for(var a=n.waypoints,c=1/0,m,v=0;v<a.length-1;v++){var T=a[v],O=a[v+1],A=getDistancePointLine(e,[T,O]);A<c&&(c=A,m=v)}return[a[m],a[m+1]]}Tt();function Bendpoints(e,n,a,c,m){function isIntersectionMiddle(e,n,a){var c=e.index,m=e.point,v,T,O,A,I,L;return c<=0||e.bendpoint?!1:(v=n[c-1],T=n[c],O=Se(v,T),A=Ee(v,T),I=Math.abs(m.x-O.x),L=Math.abs(m.y-O.y),A&&I<=a&&L<=a)}function calculateIntersectionThreshold(e,n){var a=e.waypoints,c,m,v,T;return n.index<=0||n.bendpoint||(c={start:a[n.index-1],end:a[n.index]},m=Ee(c.start,c.end),!m)?null:(v=m===`h`?c.end.x-c.start.x:c.end.y-c.start.y,T=calculateSegmentMoveRegion(v)/2,T)}function activateBendpointMove(e,a){var v=a.waypoints,T=getConnectionIntersection(n,v,e),O;if(T&&(O=calculateIntersectionThreshold(a,T),(isIntersectionMiddle(T,v,O)?m.start(e,a,T.index):c.start(e,a,T.index,!T.bendpoint))!==!1))return!0}function bindInteractionEvents(e,n,c){K.bind(e,n,function(e){a.triggerMouseEvent(n,e,c),e.stopPropagation()})}function getBendpointsContainer(e,a){var c=n.getLayer(`overlays`),m=Qe(`.djs-bendpoints[data-element-id="`+Pe(e.id)+`"]`,c);return!m&&a&&(m=he(`g`),oe(m,{"data-element-id":e.id}),de(m).add(`djs-bendpoints`),re(c,m),bindInteractionEvents(m,`mousedown`,e),bindInteractionEvents(m,`click`,e),bindInteractionEvents(m,`dblclick`,e)),m}function getSegmentDragger(e,n){return Qe(`.djs-segment-dragger[data-segment-idx="`+e+`"]`,n)}function createBendpoints(e,n){n.waypoints.forEach(function(n,a){var c=addBendpoint(e);re(e,c),G(c,n.x,n.y)}),addBendpoint(e,`floating`)}function createSegmentDraggers(e,n){for(var a=n.waypoints,c,m,v,T=1;T<a.length;T++)c=a[T-1],m=a[T],Ee(c,m)&&(v=addSegmentDragger(e,c,m),oe(v,{"data-segment-idx":T}),bindInteractionEvents(v,`mousemove`,n))}function clearBendpoints(e){Q(ae(`.`+kr,e),function(e){ge(e)})}function clearSegmentDraggers(e){Q(ae(`.`+Ar,e),function(e){ge(e)})}function addHandles(e){var n=getBendpointsContainer(e);return n||(n=getBendpointsContainer(e,!0),createBendpoints(n,e),createSegmentDraggers(n,e)),n}function updateHandles(e){var n=getBendpointsContainer(e);n&&(clearSegmentDraggers(n),clearBendpoints(n),createSegmentDraggers(n,e),createBendpoints(n,e))}function updateFloatingBendpointPosition(e,n){var a=Qe(`.floating`,e),c=n.point;a&&(G(a,c.x,c.y),de(a).add(`positioned`))}function updateSegmentDraggerPosition(e,n,a){var c=getSegmentDragger(n.index,e),m=a[n.index-1],v=a[n.index],T=n.point,O=Se(m,v),A=Ee(m,v),I,L;c&&(I=getDraggerVisual(c),L={x:T.x-O.x,y:T.y-O.y},A===`v`&&(L={x:L.y,y:L.x}),G(I,L.x,L.y))}e.on(`connection.changed`,function(e){updateHandles(e.element)}),e.on(`connection.remove`,function(e){var n=getBendpointsContainer(e.element);n&&ge(n)}),e.on(`element.marker.update`,function(e){var n=e.element,a;n.waypoints&&(a=addHandles(n),e.add?de(a).add(e.marker):de(a).remove(e.marker))}),e.on(`element.mousemove`,function(e){var a=e.element,c=a.waypoints,m,v;if(c){if(m=getBendpointsContainer(a,!0),v=getConnectionIntersection(n,c,e.originalEvent),!v)return;updateFloatingBendpointPosition(m,v),v.bendpoint||updateSegmentDraggerPosition(m,v,c)}}),e.on(`element.mousedown`,function(e){if(Xe(e)){var n=e.originalEvent,a=e.element;if(a.waypoints)return activateBendpointMove(n,a)}}),e.on(`selection.changed`,function(e){var n=e.newSelection[0];n&&n.waypoints&&addHandles(n)}),e.on(`element.hover`,function(e){var n=e.element;n.waypoints&&addHandles(n)}),e.on(`element.out`,function(e){var n=e.element;if(n.waypoints){var a=getBendpointsContainer(n);if(a){var c=Qe(`.floating`,a);c&&de(c).remove(`positioned`)}}}),e.on(`element.updateId`,function(e){var n=e.element,a=e.newId;if(n.waypoints){var c=getBendpointsContainer(n);c&&oe(c,{"data-element-id":a})}}),this.addHandles=addHandles,this.updateHandles=updateHandles,this.getBendpointsContainer=getBendpointsContainer,this.getSegmentDragger=getSegmentDragger}Bendpoints.$inject=[`eventBus`,`canvas`,`interactionEvents`,`bendpointMove`,`connectionSegmentMove`];function getDraggerVisual(e){return Qe(`.djs-visual`,e)}var jr=Math.round,Mr=`reconnectStart`,Nr=`reconnectEnd`,Pr=`updateWaypoints`;function BendpointMove(e,n,a,c,m,v){this._injector=e,this.start=function(e,n,v,T){var O=a.getGraphics(n),A=n.source,I=n.target,L=n.waypoints,U=!T&&v===0?Mr:!T&&v===L.length-1?Nr:Pr,G=U===Pr?`connection.updateWaypoints`:`connection.reconnect`,K=m.allowed(G,{connection:n,source:A,target:I});if(K===!1&&(K=m.allowed(G,{connection:n,source:I,target:A})),K!==!1)return c.init(e,`bendpoint.move`,{data:{connection:n,connectionGfx:O,context:{allowed:K,bendpointIndex:v,connection:n,source:A,target:I,insert:T,type:U}}})},n.on(`bendpoint.move.hover`,function(e){var n=e.context,a=n.connection,c=a.source,v=a.target,T=e.hover,O=n.type;n.hover=T;var A;if(T){var I=O===Pr?`connection.updateWaypoints`:`connection.reconnect`;A=n.allowed=m.allowed(I,{connection:a,source:O===Mr?T:c,target:O===Nr?T:v}),A?(n.source=O===Mr?T:c,n.target=O===Nr?T:v):(A===!1&&(A=n.allowed=m.allowed(I,{connection:a,source:O===Nr?T:v,target:O===Mr?T:c})),A&&(n.source=O===Nr?T:v,n.target=O===Mr?T:c))}}),n.on([`bendpoint.move.out`,`bendpoint.move.cleanup`],function(e){var n=e.context,a=n.type;n.hover=null,n.source=null,n.target=null,a!==Pr&&(n.allowed=!1)}),n.on(`bendpoint.move.end`,function(e){var n=e.context,a=n.allowed,c=n.bendpointIndex,m=n.connection,T=n.insert,O=m.waypoints.slice(),A=n.source,I=n.target,L=n.type,U=n.hints||{},G={x:jr(e.x),y:jr(e.y)};if(!a)return!1;L===Pr?(T?O.splice(c,0,G):O[c]=G,U.bendpointMove={insert:T,bendpointIndex:c},O=this.cropWaypoints(m,O),v.updateWaypoints(m,Ze(O),U)):(L===Mr?(U.docking=`source`,isReverse$1(n)&&(U.docking=`target`,U.newWaypoints=O.reverse())):L===Nr&&(U.docking=`target`,isReverse$1(n)&&(U.docking=`source`,U.newWaypoints=O.reverse())),v.reconnect(m,A,I,G,U))},this)}BendpointMove.$inject=[`injector`,`eventBus`,`canvas`,`dragging`,`rules`,`modeling`],BendpointMove.prototype.cropWaypoints=function(e,n){var a=this._injector.get(`connectionDocking`,!1);if(!a)return n;var c=e.waypoints;return e.waypoints=n,e.waypoints=a.getCroppedWaypoints(e),n=e.waypoints,e.waypoints=c,n};function isReverse$1(e){var n=e.hover,a=e.source,c=e.target,m=e.type;if(m===Mr)return n&&c&&n===c&&a!==c;if(m===Nr)return n&&a&&n===a&&a!==c}e(isReverse$1,`isReverse`);var Fr=`reconnectStart`,Ir=`reconnectEnd`,Lr=`updateWaypoints`,Rr=`connect-ok`,zr=`connect-not-ok`,Br=`connect-hover`,Vr=`djs-updating`,Hr=`djs-dragging`,Ur=1100;function BendpointMovePreview(e,n,a,c){this._injector=n;var m=n.get(`connectionPreview`,!1);a.on(`bendpoint.move.start`,function(e){var n=e.context,a=n.bendpointIndex,m=n.connection,v=n.insert,T=m.waypoints,O=T.slice();n.waypoints=T,v&&O.splice(a,0,{x:e.x,y:e.y}),m.waypoints=O;var A=n.draggerGfx=addBendpoint(c.getLayer(`overlays`));de(A).add(`djs-dragging`),c.addMarker(m,Hr),c.addMarker(m,Vr)}),a.on(`bendpoint.move.hover`,function(e){var n=e.context,a=n.allowed,m=n.hover,v=n.type;if(m){if(c.addMarker(m,Br),v===Lr)return;a?(c.removeMarker(m,zr),c.addMarker(m,Rr)):a===!1&&(c.removeMarker(m,Rr),c.addMarker(m,zr))}}),a.on([`bendpoint.move.out`,`bendpoint.move.cleanup`],Ur,function(e){var n=e.context,a=n.hover,m=n.target;a&&(c.removeMarker(a,Br),c.removeMarker(a,m?Rr:zr))}),a.on(`bendpoint.move.move`,function(n){var a=n.context,c=a.allowed,v=a.bendpointIndex,T=a.draggerGfx,O=a.hover,A=a.type,I=a.connection,L=I.source,U=I.target,K=I.waypoints.slice(),q={x:n.x,y:n.y},ee=a.hints||{},te={};m&&(ee.connectionStart&&(te.connectionStart=ee.connectionStart),ee.connectionEnd&&(te.connectionEnd=ee.connectionEnd),A===Fr?isReverse$1(a)?(te.connectionEnd=te.connectionEnd||q,te.source=U,te.target=O||L,K=K.reverse()):(te.connectionStart=te.connectionStart||q,te.source=O||L,te.target=U):A===Ir?isReverse$1(a)?(te.connectionStart=te.connectionStart||q,te.source=O||U,te.target=L,K=K.reverse()):(te.connectionEnd=te.connectionEnd||q,te.source=L,te.target=O||U):(te.noCropping=!0,te.noLayout=!0,K[v]=q),A===Lr&&(K=e.cropWaypoints(I,K)),te.waypoints=K,m.drawPreview(a,c,te)),G(T,n.x,n.y)},this),a.on([`bendpoint.move.end`,`bendpoint.move.cancel`],Ur,function(e){var n=e.context,a=n.connection,v=n.draggerGfx,T=n.hover,O=n.target;a.waypoints=n.waypoints,ge(v),c.removeMarker(a,Vr),c.removeMarker(a,Hr),T&&(c.removeMarker(T,Rr),c.removeMarker(T,O?Rr:zr)),m&&m.cleanUp(n)})}BendpointMovePreview.$inject=[`bendpointMove`,`injector`,`eventBus`,`canvas`];var Wr=`connect-hover`,Gr=`djs-updating`;function axisAdd(e,n,a){return axisSet(e,n,e[n]+a)}function axisSet(e,n,a){return{x:n===`x`?a:e.x,y:n===`y`?a:e.y}}function axisFenced(e,n,a,c){var m=Math.max(n[c],a[c]),v=Math.min(n[c],a[c]),T=20;return axisSet(n,c,Math.min(Math.max(v+T,e[c]),m-T))}function flipAxis(e){return e===`x`?`y`:`x`}function getDocking$1(e,n,a){var c,m;return e.original?e.original:(c=Ve(n),m=flipAxis(a),axisSet(e,m,c[m]))}e(getDocking$1,`getDocking`);function ConnectionSegmentMove(e,n,a,c,m,v){var T=e.get(`connectionDocking`,!1);this.start=function(e,n,m){var v,T=a.getGraphics(n),O=m-1,A=m,I=n.waypoints,L=I[O],U=I[A],G=getConnectionIntersection(a,I,e),K=Ee(L,U),q,ee;if(K)return q=K===`v`?`x`:`y`,O===0&&(L=getDocking$1(L,n.source,q)),A===I.length-1&&(U=getDocking$1(U,n.target,q)),ee=G?G.point:{x:(L.x+U.x)/2,y:(L.y+U.y)/2},v={connection:n,segmentStartIndex:O,segmentEndIndex:A,segmentStart:L,segmentEnd:U,axis:q,dragPosition:ee},c.init(e,ee,`connectionSegment.move`,{cursor:q===`x`?`resize-ew`:`resize-ns`,data:{connection:n,connectionGfx:T,context:v}})};function cropConnection(e,n){if(!T)return n;var a=e.waypoints,c;return e.waypoints=n,c=T.getCroppedWaypoints(e),e.waypoints=a,c}function redrawConnection(e){m.update(`connection`,e.connection,e.connectionGfx)}function updateDragger(e,n,a){var c=e.newWaypoints,m=c[e.segmentStartIndex+n],v=c[e.segmentEndIndex+n],T=axisFenced(a,m,v,flipAxis(e.axis));G(e.draggerGfx,T.x,T.y)}function filterRedundantWaypoints(e,n){var a=0;return{waypoints:e.filter(function(c,m){return!at(e[m-1],e[m+1],c)||(a=m<=n?a-1:a,!1)}),segmentOffset:a}}n.on(`connectionSegment.move.start`,function(e){var n=e.context,c=e.connection,m=a.getLayer(`overlays`);n.originalWaypoints=c.waypoints.slice(),n.draggerGfx=addSegmentDragger(m,n.segmentStart,n.segmentEnd),de(n.draggerGfx).add(`djs-dragging`),a.addMarker(c,Gr)}),n.on(`connectionSegment.move.move`,function(e){var n=e.context,a=n.connection,c=n.segmentStartIndex,m=n.segmentEndIndex,v=n.segmentStart,T=n.segmentEnd,O=n.axis,A=n.originalWaypoints.slice(),I=axisAdd(v,O,e[`d`+O]),L=axisAdd(T,O,e[`d`+O]),U=A.length,G=0;A[c]=I,A[m]=L;var K,q;c<2&&(K=et(a.source,I),c===1?K===`intersect`&&(A.shift(),A[0]=I,G--):K!==`intersect`&&(A.unshift(v),G++)),m>U-3&&(q=et(a.target,L),m===U-2?q===`intersect`&&(A.pop(),A[A.length-1]=L):q!==`intersect`&&A.push(T)),n.newWaypoints=a.waypoints=cropConnection(a,A),updateDragger(n,G,e),n.newSegmentStartIndex=c+G,redrawConnection(e)}),n.on(`connectionSegment.move.hover`,function(e){e.context.hover=e.hover,a.addMarker(e.hover,Wr)}),n.on([`connectionSegment.move.out`,`connectionSegment.move.cleanup`],function(e){var n=e.context.hover;n&&a.removeMarker(n,Wr)}),n.on(`connectionSegment.move.cleanup`,function(e){var n=e.context,c=n.connection;n.draggerGfx&&ge(n.draggerGfx),a.removeMarker(c,Gr)}),n.on([`connectionSegment.move.cancel`,`connectionSegment.move.end`],function(e){var n=e.context,a=n.connection;a.waypoints=n.originalWaypoints,redrawConnection(e)}),n.on(`connectionSegment.move.end`,function(e){var n=e.context,a=n.connection,c=n.newWaypoints,m=n.newSegmentStartIndex;c=c.map(function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}});var T=filterRedundantWaypoints(c,m),O=T.waypoints,A=cropConnection(a,O),I=T.segmentOffset,L={segmentMove:{segmentStartIndex:n.segmentStartIndex,newSegmentStartIndex:m+I}};v.updateWaypoints(a,A,L)})}ConnectionSegmentMove.$inject=[`injector`,`eventBus`,`canvas`,`dragging`,`graphicsFactory`,`modeling`];var Kr=Math.abs,qr=Math.round;function snapTo(e,n,a){a=a===void 0?10:a;for(var c=0,m;c<n.length;c++)if(m=n[c],Kr(m-e)<=a)return m}function topLeft(e){return{x:e.x,y:e.y}}function bottomRight(e){return{x:e.x+e.width,y:e.y+e.height}}function mid$1(e,n){return!e||isNaN(e.x)||isNaN(e.y)?n:{x:qr(e.x+e.width/2),y:qr(e.y+e.height/2)}}e(mid$1,`mid`);function isSnapped(e,n){var a=e.snapped;return a?typeof n==`string`?a[n]:a.x&&a.y:!1}function setSnapped(e,n,a){if(typeof n!=`string`)throw Error(`axis must be in [x, y]`);if(typeof a!=`number`&&a!==!1)throw Error(`value must be Number or false`);var c,m=e[n],v=e.snapped=e.snapped||{};return a===!1?v[n]=!1:(v[n]=!0,c=a-m,e[n]+=c,e[`d`+n]+=c),m}function getChildren(e){return e.children||[]}Tt();var Jr=Math.abs,Yr=Math.round,Xr=10;function BendpointSnapping(e){function snapTo(e,n){if(xt(e)){for(var a=e.length;a--;)if(Jr(e[a]-n)<=Xr)return e[a]}else{e=+e;var c=n%e;if(c<Xr)return n-c;if(c>e-Xr)return n-c+e}return n}function getSnapPoint(e,n){if(e.waypoints)return getClosestPointOnConnection(n,e);if(e.width)return{x:Yr(e.width/2+e.x),y:Yr(e.height/2+e.y)}}function getConnectionSegmentSnaps(e){var n=e.context,a=n.snapPoints,c=n.connection,m=c.waypoints,v=n.segmentStart,T=n.segmentStartIndex,O=n.segmentEnd,A=n.segmentEndIndex,I=n.axis;if(a)return a;var L=[m[T-1],v,O,m[A+1]];return T<2&&L.unshift(getSnapPoint(c.source,e)),A>m.length-3&&L.unshift(getSnapPoint(c.target,e)),n.snapPoints=a={horizontal:[],vertical:[]},Q(L,function(e){e&&(e=e.original||e,I===`y`&&a.horizontal.push(e.y),I===`x`&&a.vertical.push(e.x))}),a}e.on(`connectionSegment.move.move`,1500,function(e){var n=getConnectionSegmentSnaps(e),a=e.x,c=e.y,m,v;if(n){m=snapTo(n.vertical,a),v=snapTo(n.horizontal,c);var T=a-m,O=c-v;At(e,{dx:e.dx-T,dy:e.dy-O,x:m,y:v}),(T||n.vertical.indexOf(a)!==-1)&&setSnapped(e,`x`,m),(O||n.horizontal.indexOf(c)!==-1)&&setSnapped(e,`y`,v)}});function getBendpointSnaps(e){var n=e.snapPoints,a=e.connection.waypoints,c=e.bendpointIndex;if(n)return n;var m=[a[c-1],a[c+1]];return e.snapPoints=n={horizontal:[],vertical:[]},Q(m,function(e){e&&(e=e.original||e,n.horizontal.push(e.y),n.vertical.push(e.x))}),n}e.on([`connect.hover`,`connect.move`,`connect.end`],1500,function(e){var n=e.context.hover,a=n&&getSnapPoint(n,e);Ke(n)&&a&&a.x&&a.y&&(setSnapped(e,`x`,a.x),setSnapped(e,`y`,a.y))}),e.on([`bendpoint.move.move`,`bendpoint.move.end`],1500,function(e){var n=e.context,a=getBendpointSnaps(n),c=n.hover,m=c&&getSnapPoint(c,e),v=e.x,T=e.y,O,A;if(a){O=snapTo(m?a.vertical.concat([m.x]):a.vertical,v),A=snapTo(m?a.horizontal.concat([m.y]):a.horizontal,T);var I=v-O,L=T-A;At(e,{dx:e.dx-I,dy:e.dy-L,x:e.x-I,y:e.y-L}),(I||a.vertical.indexOf(v)!==-1)&&setSnapped(e,`x`,O),(L||a.horizontal.indexOf(T)!==-1)&&setSnapped(e,`y`,A)}})}BendpointSnapping.$inject=[`eventBus`];var Zr={__depends__:[Cr,Tr],__init__:[`bendpoints`,`bendpointSnapping`,`bendpointMovePreview`],bendpoints:[`type`,Bendpoints],bendpointMove:[`type`,BendpointMove],bendpointMovePreview:[`type`,BendpointMovePreview],connectionSegmentMove:[`type`,ConnectionSegmentMove],bendpointSnapping:[`type`,BendpointSnapping]};Tt();function Connect(e,n,a,c){function canConnect(e,n){return c.allowed(`connection.create`,{source:e,target:n})}function canConnectReverse(e,n){return canConnect(n,e)}e.on(`connect.hover`,function(e){var n=e.context,a=n.start,c=e.hover,m;n.hover=c,m=n.canExecute=canConnect(a,c),!jt(m)&&(m===!1?(m=n.canExecute=canConnectReverse(a,c),!jt(m)&&m!==!1&&(n.source=c,n.target=a)):(n.source=a,n.target=c))}),e.on([`connect.out`,`connect.cleanup`],function(e){var n=e.context;n.hover=null,n.source=null,n.target=null,n.canExecute=!1}),e.on(`connect.end`,function(e){var n=e.context,c=n.canExecute,m=n.connectionStart,v={x:e.x,y:e.y},T=n.source,O=n.target;if(!c)return!1;var A=null,I={connectionStart:isReverse(n)?v:m,connectionEnd:isReverse(n)?m:v};_t(c)&&(A=c),n.connection=a.connect(T,O,A,I)}),this.start=function(e,a,c,m){_t(c)||(m=c,c=Ve(a)),n.init(e,`connect`,{autoActivate:m,data:{shape:a,context:{start:a,connectionStart:c}}})}}Connect.$inject=[`eventBus`,`dragging`,`modeling`,`rules`];function isReverse(e){var n=e.hover,a=e.source,c=e.target;return n&&a&&n===a&&a!==c}var Qr=1100,$r=900,ei=`connect-ok`,ti=`connect-not-ok`;function ConnectPreview(e,n,a){var c=e.get(`connectionPreview`,!1);c&&n.on(`connect.move`,function(e){var n=e.context,a=n.canExecute,m=n.hover,v=n.source,T=n.start,O=n.startPosition,A=n.target,I=n.connectionStart||O,L=n.connectionEnd||{x:e.x,y:e.y},U=I,G=L;isReverse(n)&&(U=L,G=I),c.drawPreview(n,a,{source:v||T,target:A||m,connectionStart:U,connectionEnd:G})}),n.on(`connect.hover`,$r,function(e){var n=e.context,c=e.hover,m=n.canExecute;m!==null&&a.addMarker(c,m?ei:ti)}),n.on([`connect.out`,`connect.cleanup`],Qr,function(e){var n=e.hover;n&&(a.removeMarker(n,ei),a.removeMarker(n,ti))}),c&&n.on(`connect.cleanup`,function(e){c.cleanUp(e.context)})}ConnectPreview.$inject=[`injector`,`eventBus`,`canvas`];var ni={__depends__:[qe,Tr,Cr],__init__:[`connectPreview`],connect:[`type`,Connect],connectPreview:[`type`,ConnectPreview]};Tt();var ri=`djs-dragger`;function ConnectionPreview(e,n,a,c){this._canvas=n,this._graphicsFactory=a,this._elementFactory=c,this._connectionDocking=e.get(`connectionDocking`,!1),this._layouter=e.get(`layouter`,!1)}ConnectionPreview.$inject=[`injector`,`canvas`,`graphicsFactory`,`elementFactory`],ConnectionPreview.prototype.drawPreview=function(e,n,a){a||={};var c=e.connectionPreviewGfx,m=e.getConnection,v=a.source,T=a.target,O=a.waypoints,A=a.connectionStart,I=a.connectionEnd,L=a.noLayout,U=a.noCropping,G=a.noNoop,K,q=this;c||=e.connectionPreviewGfx=this.createConnectionPreviewGfx(),ot(c),m||=e.getConnection=cacheReturnValues(function(e,n,a){return q.getConnection(e,n,a)}),n&&(K=m(n,v,T)),K?(K.waypoints=O||[],this._layouter&&!L&&(K.waypoints=this._layouter.layoutConnection(K,{source:v,target:T,connectionStart:A,connectionEnd:I,waypoints:a.waypoints||K.waypoints})),K.waypoints&&K.waypoints.length||(K.waypoints=[v?Ve(v):A,T?Ve(T):I]),this._connectionDocking&&(v||T)&&!U&&(K.waypoints=this._connectionDocking.getCroppedWaypoints(K,v,T)),this._graphicsFactory.drawConnection(c,K,{stroke:`var(--element-dragger-color)`})):!G&&this.drawNoopPreview(c,a)},ConnectionPreview.prototype.drawNoopPreview=function(e,n){var a=n.source,c=n.target,m=n.connectionStart||Ve(a),v=n.connectionEnd||Ve(c),T=this.cropWaypoints(m,v,a,c),O=this.createNoopConnection(T[0],T[1]);re(e,O)},ConnectionPreview.prototype.cropWaypoints=function(e,n,a,c){var m=this._graphicsFactory,v=a&&m.getShapePath(a),T=c&&m.getShapePath(c),O=m.getConnectionPath({waypoints:[e,n]});return e=a&&Oe(v,O,!0)||e,n=c&&Oe(T,O,!1)||n,[e,n]},ConnectionPreview.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&ge(e.connectionPreviewGfx)},ConnectionPreview.prototype.getConnection=function(e){var n=ensureConnectionAttrs(e);return this._elementFactory.createConnection(n)},ConnectionPreview.prototype.createConnectionPreviewGfx=function(){var e=he(`g`);return oe(e,{pointerEvents:`none`}),de(e).add(ri),re(this._canvas.getActiveLayer(),e),e},ConnectionPreview.prototype.createNoopConnection=function(e,n){return se([e,n],{stroke:`#333`,strokeDasharray:[1],strokeWidth:2,"pointer-events":`none`})};function cacheReturnValues(e){var n={};return function(a){var c=JSON.stringify(a),m=n[c];return m||=n[c]=e.apply(null,arguments),m}}function ensureConnectionAttrs(e){return _t(e)?e:{}}var ii={__init__:[`connectionPreview`],connectionPreview:[`type`,ConnectionPreview]},ai=new it(`ps`),oi=[`marker-start`,`marker-mid`,`marker-end`],si=[`circle`,`ellipse`,`line`,`path`,`polygon`,`polyline`,`path`,`rect`];function PreviewSupport(e,n,a,c){this._elementRegistry=e,this._canvas=a,this._styles=c}PreviewSupport.$inject=[`elementRegistry`,`eventBus`,`canvas`,`styles`],PreviewSupport.prototype.cleanUp=function(){console.warn(`PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906`)},PreviewSupport.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},PreviewSupport.prototype.addDragger=function(e,n,a,c=`djs-dragger`){a||=this.getGfx(e);var m=ee(a);return this._cloneMarkers(Me(m),c),oe(m,this._styles.cls(c,[])),re(n,m),oe(m,`data-preview-support-element-id`,e.id),m},PreviewSupport.prototype.addFrame=function(e,n){var a=he(`rect`,{class:`djs-resize-overlay`,width:e.width,height:e.height,x:e.x,y:e.y});return re(n,a),oe(a,`data-preview-support-element-id`,e.id),a},PreviewSupport.prototype._cloneMarkers=function(e,n=`djs-dragger`,a=e){var c=this;e.childNodes&&e.childNodes.forEach(e=>{c._cloneMarkers(e,n,a)}),canHaveMarker(e)&&oi.forEach(function(m){if(oe(e,m)){var v=getMarker(e,m,c._canvas.getContainer());v&&c._cloneMarker(a,e,v,m,n)}})},PreviewSupport.prototype._cloneMarker=function(e,n,a,c,m=`djs-dragger`){var v=[a.id,m,ai.next()].join(`-`),T=Qe(`marker#`+a.id,e);e||=this._canvas._svg;var O=T||ee(a);O.id=v,de(O).add(m);var A=Qe(`:scope > defs`,e);A||(A=he(`defs`),re(e,A)),re(A,O);var I=idToReference(O.id);oe(n,c,I)};function getMarker(e,n,a){var c=referenceToId(oe(e,n));return Qe(`marker#`+c,a||document)}function referenceToId(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function idToReference(e){return`url(#`+e+`)`}function canHaveMarker(e){return si.indexOf(e.nodeName)!==-1}var ci={__init__:[`previewSupport`],previewSupport:[`type`,PreviewSupport]};Tt();var li=Math.max,ui=Math.min,di=20;function substractTRBL(e,n){return{top:e.top-n.top,right:e.right-n.right,bottom:e.bottom-n.bottom,left:e.left-n.left}}function resizeBounds$1(e,n,a){var c=a.x,m=a.y,v={x:e.x,y:e.y,width:e.width,height:e.height};return n.indexOf(`n`)===-1?n.indexOf(`s`)!==-1&&(v.height=e.height+m):(v.y=e.y+m,v.height=e.height-m),n.indexOf(`e`)===-1?n.indexOf(`w`)!==-1&&(v.x=e.x+c,v.width=e.width-c):v.width=e.width+c,v}e(resizeBounds$1,`resizeBounds`);function resizeTRBL(e,n){return{x:e.x+(n.left||0),y:e.y+(n.top||0),width:e.width-(n.left||0)+(n.right||0),height:e.height-(n.top||0)+(n.bottom||0)}}function applyConstraints(e,n,a){var c=n[e],m=a.min&&a.min[e],v=a.max&&a.max[e];return Pt(m)&&(c=(/top|left/.test(e)?ui:li)(c,m)),Pt(v)&&(c=(/top|left/.test(e)?li:ui)(c,v)),c}function ensureConstraints$1(e,n){if(!n)return e;var a=Ge(e);return we({top:applyConstraints(`top`,a,n),right:applyConstraints(`right`,a,n),bottom:applyConstraints(`bottom`,a,n),left:applyConstraints(`left`,a,n)})}e(ensureConstraints$1,`ensureConstraints`);function getMinResizeBounds(e,n,a,c){var m=Ge(n),v={top:/n/.test(e)?m.bottom-a.height:m.top,left:/w/.test(e)?m.right-a.width:m.left,bottom:/s/.test(e)?m.top+a.height:m.bottom,right:/e/.test(e)?m.left+a.width:m.right},T=c?Ge(c):v,O={top:ui(v.top,T.top),left:ui(v.left,T.left),bottom:li(v.bottom,T.bottom),right:li(v.right,T.right)};return we(O)}function asPadding(e,n){return e===void 0?di:e}function addPadding(e,n){var a,c,m,v;return typeof n==`object`?(a=asPadding(n.left),c=asPadding(n.right),m=asPadding(n.top),v=asPadding(n.bottom)):a=c=m=v=asPadding(n),{x:e.x-a,y:e.y-m,width:e.width+a+c,height:e.height+m+v}}function isBBoxChild(e){return!(e.waypoints||e.type===`label`)}function computeChildrenBBox(e,n){var a=e.length===void 0?Dt(e.children,isBBoxChild):e;if(a.length)return addPadding(J(a),n)}function getNewAttachPoint(e,n,a){var c=center(n),m=center(a),v=delta(e,c),T={x:v.x*(a.width/n.width),y:v.y*(a.height/n.height)};return Ne({x:m.x+T.x,y:m.y+T.y})}function getNewAttachShapeDelta(e,n,a){var c=center(e),m=center(n),v=center(a),T=delta(e,c),O=delta(c,m),A=getStickyPositionDelta(c,n,a);if(A)return A;var I={x:O.x*(a.width/n.width),y:O.y*(a.height/n.height)},L={x:v.x+I.x,y:v.y+I.y};return Ne({x:L.x+T.x-e.x,y:L.y+T.y-e.y})}function getStickyPositionDelta(e,n,a){var c=Ge(n),m=Ge(a);if(isMoved(c,m))return null;var v=et(n,e),T,O,A;if(v===`top`)T={x:0,y:m.bottom-c.bottom};else if(v===`bottom`)T={x:0,y:m.top-c.top};else if(v===`right`)T={x:m.left-c.left,y:0};else if(v===`left`)T={x:m.right-c.right,y:0};else return null;return O={x:e.x+T.x,y:e.y+T.y},A=et(a,O),A===v?T:null}function isMoved(e,n){return isHorizontallyMoved(e,n)||isVerticallyMoved(e,n)}function isHorizontallyMoved(e,n){return e.right!==n.right&&e.left!==n.left}function isVerticallyMoved(e,n){return e.top!==n.top&&e.bottom!==n.bottom}Tt();function getResizedSourceAnchor(e,n,a){var c=safeGetWaypoints(e),m=getWaypointsInsideBounds(c,n),v=c[0];return m.length?m[m.length-1]:getNewAttachPoint(v.original||v,a,n)}function getResizedTargetAnchor(e,n,a){var c=safeGetWaypoints(e),m=getWaypointsInsideBounds(c,n),v=c[c.length-1];return m.length?m[0]:getNewAttachPoint(v.original||v,a,n)}function getMovedSourceAnchor(e,n,a){var c=safeGetWaypoints(e),m=subtract(n,a),v=c[0];return getNewAttachPoint(v.original||v,m,n)}function getMovedTargetAnchor(e,n,a){var c=safeGetWaypoints(e),m=subtract(n,a),v=c[c.length-1];return getNewAttachPoint(v.original||v,m,n)}function subtract(e,n){return{x:e.x-n.x,y:e.y-n.y,width:e.width,height:e.height}}function safeGetWaypoints(e){var n=e.waypoints;if(!n.length)throw Error(`connection#`+e.id+`: no waypoints`);return n}function getWaypointsInsideBounds(e,n){var a=Mt(e,getOriginal);return Dt(a,function(e){return isInsideBounds(e,n)})}function isInsideBounds(e,n){return et(n,e,1)===`intersect`}function getOriginal(e){return e.original||e}function OrderingProvider(e){tt.call(this,e);var n=this;this.preExecute([`shape.create`,`connection.create`],function(e){var a=e.context,c=a.shape||a.connection,m=a.parent,v=n.getOrdering(c,m);v&&(v.parent!==void 0&&(a.parent=v.parent),a.parentIndex=v.index)}),this.preExecute([`shape.move`,`connection.move`],function(e){var a=e.context,c=a.shape||a.connection,m=a.newParent||c.parent,v=n.getOrdering(c,m);v&&(v.parent!==void 0&&(a.newParent=v.parent),a.newParentIndex=v.index)})}OrderingProvider.prototype.getOrdering=function(e,n){return null},Re(OrderingProvider,tt);function Clipboard(){}Clipboard.prototype.get=function(){return this._data},Clipboard.prototype.set=function(e){this._data=e},Clipboard.prototype.clear=function(){var e=this._data;return delete this._data,e},Clipboard.prototype.isEmpty=function(){return!this._data};var fi={clipboard:[`type`,Clipboard]};Tt();var pi=`drop-ok`,mi=`drop-not-ok`,hi=`attach-ok`,gi=`new-parent`,_i=`create`,vi=2e3;function Create$1(e,n,a,c,m){function canCreate(e,n,a,c,v){if(!n)return!1;e=Dt(e,function(n){var a=n.labelTarget;return!n.parent&&!(He(n)&&e.indexOf(a)!==-1)});var T=kt(e,function(e){return!Ke(e)}),O=!1,A=!1,I=!1;isSingleShape(e)&&(O=m.allowed(`shape.attach`,{position:a,shape:T,target:n})),O||(I=isSingleShape(e)?m.allowed(`shape.create`,{position:a,shape:T,source:c,target:n}):m.allowed(`elements.create`,{elements:e,position:a,target:n}));var L=v.connectionTarget;return I||O?(T&&c&&(A=m.allowed(`connection.create`,{source:L===c?T:c,target:L===c?c:T,hints:{targetParent:n,targetAttach:O}})),{attach:O,connect:A}):I===null||O===null?null:!1}function setMarker(n,a){[hi,pi,mi,gi].forEach(function(c){c===a?e.addMarker(n,c):e.removeMarker(n,c)})}a.on([`create.move`,`create.hover`],function(e){var n=e.context,a=n.elements,c=e.hover,m=n.source,v=n.hints||{};if(!c)n.canExecute=!1,n.target=null;else{ensureConstraints(e);var T={x:e.x,y:e.y},O=n.canExecute=c&&canCreate(a,c,T,m,v);c&&O!==null&&(n.target=c,O&&O.attach?setMarker(c,hi):setMarker(c,O?gi:mi))}}),a.on([`create.end`,`create.out`,`create.cleanup`],function(e){var n=e.hover;n&&setMarker(n,null)}),a.on(`create.end`,function(e){var n=e.context,a=n.source,m=n.shape,v=n.elements,T=n.target,O=n.canExecute,A=O&&O.attach,I=O&&O.connect,L=n.hints||{};if(O===!1||!T)return!1;ensureConstraints(e);var U={x:e.x,y:e.y};I?m=c.appendShape(a,m,U,T,{attach:A,connection:I===!0?{}:I,connectionTarget:L.connectionTarget}):(v=c.createElements(v,U,T,At({},L,{attach:A})),m=kt(v,function(e){return!Ke(e)})),At(n,{elements:v,shape:m}),At(e,{elements:v,shape:m})});function cancel(){var e=n.context();e&&e.prefix===_i&&n.cancel()}a.on(`create.init`,function(){a.on(`elements.changed`,cancel),a.once([`create.cancel`,`create.end`],vi,function(){a.off(`elements.changed`,cancel)})}),this.start=function(e,a,c){xt(a)||(a=[a]);var m=kt(a,function(e){return!Ke(e)});if(m){c=At({elements:a,hints:{},shape:m},c||{}),Q(a,function(e){Pt(e.x)||(e.x=0),Pt(e.y)||(e.y=0)});var v=Dt(a,function(e){return!e.hidden}),T=J(v);Q(a,function(e){Ke(e)&&(e.waypoints=Mt(e.waypoints,function(e){return{x:e.x-T.x-T.width/2,y:e.y-T.y-T.height/2}})),At(e,{x:e.x-T.x-T.width/2,y:e.y-T.y-T.height/2})}),n.init(e,_i,{cursor:`grabbing`,autoActivate:!0,data:{shape:m,elements:a,context:c}})}}}e(Create$1,`Create`),Create$1.$inject=[`canvas`,`dragging`,`eventBus`,`modeling`,`rules`];function ensureConstraints(e){var n=e.context.createConstraints;n&&(n.left&&(e.x=Math.max(e.x,n.left)),n.right&&(e.x=Math.min(e.x,n.right)),n.top&&(e.y=Math.max(e.y,n.top)),n.bottom&&(e.y=Math.min(e.y,n.bottom)))}function isSingleShape(e){return e&&e.length===1&&!Ke(e[0])}var yi=750;function CreatePreview(e,n,a,c,m){function createDragGroup(e){var n=he(`g`);oe(n,m.cls(`djs-drag-group`,[`no-events`]));var v=he(`g`);return e.forEach(function(e){var m;e.hidden||(e.waypoints?(m=a._createContainer(`connection`,v),a.drawConnection(Me(m),e)):(m=a._createContainer(`shape`,v),a.drawShape(Me(m),e),G(m,e.x,e.y)),c.addDragger(e,n,m))}),n}n.on(`create.move`,yi,function(n){var a=n.hover,c=n.context,m=c.elements,v=c.dragGroup;v||=c.dragGroup=createDragGroup(m);var T;a?(v.parentNode||(T=e.getActiveLayer(),re(T,v)),G(v,n.x,n.y)):ge(v)}),n.on(`create.cleanup`,function(e){var n=e.context.dragGroup;n&&ge(n)})}CreatePreview.$inject=[`canvas`,`eventBus`,`graphicsFactory`,`previewSupport`,`styles`];var bi={__depends__:[Cr,ci,Tr,qe],__init__:[`create`,`createPreview`],create:[`type`,Create$1],createPreview:[`type`,CreatePreview]};function Mouse(e){var n=this;this._lastMoveEvent=null;function setLastMoveEvent(e){n._lastMoveEvent=e}e.on(`canvas.init`,function(e){(n._svg=e.svg).addEventListener(`mousemove`,setLastMoveEvent)}),e.on(`canvas.destroy`,function(){n._lastMouseEvent=null,n._svg.removeEventListener(`mousemove`,setLastMoveEvent)})}Mouse.$inject=[`eventBus`],Mouse.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||createMoveEvent(0,0)};function createMoveEvent(e,n){var a=document.createEvent(`MouseEvent`),c=e,m=n,v=e,T=n;return a.initMouseEvent&&a.initMouseEvent(`mousemove`,!0,!0,window,0,c,m,v,T,!1,!1,!1,!1,0,null),a}var xi={__init__:[`mouse`],mouse:[`type`,Mouse]};Tt();var Si=2e3;function CopyPaste(e,n,a,c,m,v,T,O){this._canvas=e,this._create=n,this._elementFactory=c,this._eventBus=m,this._modeling=v,this._mouse=T,this._rules=O,m.on(`copyPaste.copyElement`,function(e){var n=e.descriptor,a=e.element,c=e.elementsSet;n.priority=1,n.id=a.id,c.has(a.parent)&&(n.parent=a.parent.id),isAttacher(a)&&(n.priority=2,n.host=a.host.id),Ke(a)&&(n.priority=3,n.source=a.source.id,n.target=a.target.id,n.waypoints=copyWaypoints$1(a)),He(a)&&(n.priority=4,n.labelTarget=a.labelTarget.id),Q([`x`,`y`,`width`,`height`],function(e){Pt(a[e])&&(n[e]=a[e])}),n.hidden=a.hidden,n.collapsed=a.collapsed}),m.on(`copyPaste.elementsCopied`,Si,function(e){e.hints?.clip!==!1&&a.set(e.tree)}),m.on(`copyPaste.pasteElements`,Si,function(e){e.tree||=a.get()}),m.on(`copyPaste.pasteElements`,function(e){var n=e.hints;At(n,{createElementsBehavior:!1})})}CopyPaste.$inject=[`canvas`,`create`,`clipboard`,`elementFactory`,`eventBus`,`modeling`,`mouse`,`rules`],CopyPaste.prototype.copy=function(e,n={}){var a,c;return xt(e)||(e=e?[e]:[]),a=this._eventBus.fire(`copyPaste.canCopyElements`,{elements:e}),c=a===!1?{}:this.createTree(xt(a)?a:e),this._eventBus.fire(`copyPaste.elementsCopied`,{elements:e,tree:c,hints:n}),c},CopyPaste.prototype.paste=function(e={}){var n=this._eventBus.createEvent({type:`copyPaste.pasteElements`,hints:{},...e});if(this._eventBus.fire(n)!==!1){var a=n.tree;if(a){var c=n.hints,m=this._createElements(a);if(n.element&&n.point)return this._paste(m,n.element,n.point,c);this._create.start(this._mouse.getLastMoveEvent(),m,{hints:c})}}},CopyPaste.prototype.duplicate=function(e,n={}){var a=this.copy(e,{clip:!1});return this.paste({...n,tree:a})},CopyPaste.prototype.cut=function(e){var n=this.copy(e),a=this._getElementIdsFromTree(n),c=e.filter(function(e){return a[e.id]});return c.length>0&&this._modeling.removeElements(c),n},CopyPaste.prototype._getElementIdsFromTree=function(e){var n={};return Q(e,function(e){Q(e,function(e){e.id&&(n[e.id]=!0)})}),n},CopyPaste.prototype._paste=function(e,n,a,c){Q(e,function(e){Pt(e.x)||(e.x=0),Pt(e.y)||(e.y=0)});var m=J(e);return Q(e,function(e){Ke(e)&&(e.waypoints=Mt(e.waypoints,function(e){return{x:e.x-m.x-m.width/2,y:e.y-m.y-m.height/2}})),At(e,{x:e.x-m.x-m.width/2,y:e.y-m.y-m.height/2})}),this._modeling.createElements(e,a,n,At({},c))},CopyPaste.prototype._createElements=function(e){var n=this,a=this._eventBus,c={},m=[];return Q(e,function(e,v){v=parseInt(v,10),e=ft(e,`priority`),Q(e,function(e){var v=At({},ct(e,[`priority`]));c[e.parent]?v.parent=c[e.parent]:delete v.parent,a.fire(`copyPaste.pasteElement`,{cache:c,descriptor:v});var T;Ke(v)?(v.source=c[e.source],v.target=c[e.target],T=c[e.id]=n.createConnection(v),m.push(T)):He(v)?(v.labelTarget=c[v.labelTarget],T=c[e.id]=n.createLabel(v),m.push(T)):(v.host&&=c[v.host],T=c[e.id]=n.createShape(v),m.push(T))})}),m},CopyPaste.prototype.createConnection=function(e){return this._elementFactory.createConnection(ct(e,[`id`]))},CopyPaste.prototype.createLabel=function(e){return this._elementFactory.createLabel(ct(e,[`id`]))},CopyPaste.prototype.createShape=function(e){return this._elementFactory.createShape(ct(e,[`id`]))},CopyPaste.prototype.hasRelations=function(e,n,a){return a||=new Set(n),!(Ke(e)&&(!a.has(e.source)||!a.has(e.target))||He(e)&&!a.has(e.labelTarget))},CopyPaste.prototype.createTree=function(e){var n=this._rules,a=this,c={},m=[],v=new Map,T=ze(e);function canCopy(e,a){return n.allowed(`element.copy`,{element:e,elements:a})}function addElementData(e,n){var a=v.get(e);if(!a){var c={element:e,depth:n};m.push(c),v.set(e,c)}else if(a.depth<n){m=removeElementData(a,m);var T={element:a.element,depth:n};m.push(T),v.set(e,T)}}function removeElementData(e,n){var a=n.indexOf(e);return a!==-1&&n.splice(a,1),n}me(T,function(e,n,c){if(He(e))return;Q(e.labels,function(e){addElementData(e,c)});function addRelatedElements(e){e&&e.length&&Q(e,function(e){Q(e.labels,function(e){addElementData(e,c)}),addElementData(e,c)})}Q([e.attachers,e.incoming,e.outgoing],addRelatedElements),addElementData(e,c);var m=[];return e.children&&(m=e.children.slice()),a._eventBus.fire(`copyPaste.createTree`,{element:e,children:m}),m}),e=Mt(m,function(e){return e.element});var O=new Set(e);return m=Mt(m,function(n){return n.descriptor={},a._eventBus.fire(`copyPaste.copyElement`,{descriptor:n.descriptor,element:n.element,elements:e,elementsSet:O}),n}),m=ft(m,function(e){return e.descriptor.priority}),e=Mt(m,function(e){return e.element}),Q(m,function(n){var m=n.depth;a.hasRelations(n.element,e,O)&&canCopy(n.element,e)?(c[m]||(c[m]=[]),c[m].push(n.descriptor)):(removeElement(n.element,e),O.delete(n.element))}),c};function isAttacher(e){return!!e.host}function copyWaypoints$1(e){return Mt(e.waypoints,function(e){return e=copyWaypoint$1(e),e.original&&(e.original=copyWaypoint$1(e.original)),e})}e(copyWaypoints$1,`copyWaypoints`);function copyWaypoint$1(e){return At({},e)}e(copyWaypoint$1,`copyWaypoint`);function removeElement(e,n){var a=n.indexOf(e);return a===-1?n:n.splice(a,1)}Tt();var Ci=Math.round;function Replace(e,n){this._modeling=e,this._eventBus=n}Replace.$inject=[`modeling`,`eventBus`],Replace.prototype.replaceElement=function(e,n,a){if(e.waypoints)return null;var c=this._modeling,m=this._eventBus;m.fire(`replace.start`,{element:e,attrs:n,hints:a});var v=n.width||e.width,T=n.height||e.height,O=n.x||e.x,A=n.y||e.y,I=Ci(O+v/2),L=Ci(A+T/2),U=c.replaceShape(e,At({},n,{x:I,y:L,width:v,height:T}),a);return m.fire(`replace.end`,{element:e,newElement:U,hints:a}),U};function ReplaceSelectionBehavior(e,n){n.on(`replace.end`,500,function(n){let{newElement:a,hints:c={}}=n;c.select!==!1&&e.select(a)})}ReplaceSelectionBehavior.$inject=[`selection`,`eventBus`];var wi={__init__:[`replace`,`replaceSelectionBehavior`],replaceSelectionBehavior:[`type`,ReplaceSelectionBehavior],replace:[`type`,Replace]};Tt();var Ti=250;function ToolManager(e){this._eventBus=e,this._tools=[],this._active=null}ToolManager.$inject=[`eventBus`],ToolManager.prototype.registerTool=function(e,n){var a=this._tools;if(!n)throw Error(`A tool has to be registered with it's "events"`);a.push(e),this.bindEvents(e,n)},ToolManager.prototype.isActive=function(e){return e&&this._active===e},ToolManager.prototype.length=function(e){return this._tools.length},ToolManager.prototype.setActive=function(e){var n=this._eventBus;this._active!==e&&(this._active=e,n.fire(`tool-manager.update`,{tool:e}))},ToolManager.prototype.bindEvents=function(e,n){var a=this._eventBus,c=[];a.on(n.tool+`.init`,function(n){!n.context.reactivate&&this.isActive(e)?this.setActive(null):this.setActive(e)},this),Q(n,function(e){c.push(e+`.ended`),c.push(e+`.canceled`)}),a.on(c,Ti,function(e){this._active&&(isPaletteClick(e)||this.setActive(null))},this)};function isPaletteClick(e){var n=e.originalEvent&&e.originalEvent.target;return n&&be(n,`.group[data-group="tools"]`)}var Ei={__depends__:[Cr],__init__:[`toolManager`],toolManager:[`type`,ToolManager]};Tt();function getDirection(e,n){if(e===`x`){if(n>0)return`e`;if(n<0)return`w`}if(e===`y`){if(n>0)return`s`;if(n<0)return`n`}return null}function getWaypointsUpdatingConnections(e,n){var a=[],c=new Set(e);Q(n,function(e){c.add(e)});var m=new Set;return c.forEach(function(e){var n=e.incoming,v=e.outgoing;Q(n.concat(v),function(e){var n=e.source,v=e.target;(c.has(n)||c.has(v))&&(m.has(e)||(m.add(e),a.push(e)))})}),a}function resizeBounds(e,n,a){var c=e.x,m=e.y,v=e.width,T=e.height,O=a.x,A=a.y;switch(n){case`n`:return{x:c,y:m+A,width:v,height:T-A};case`s`:return{x:c,y:m,width:v,height:T+A};case`w`:return{x:c+O,y:m,width:v-O,height:T};case`e`:return{x:c,y:m,width:v+O,height:T};default:throw Error(`unknown direction: `+n)}}Tt();function CommandStack(e,n){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=n,this._eventBus=e,this._uid=1,e.on([`diagram.destroy`,`diagram.clear`],function(){this.clear(!1)},this)}CommandStack.$inject=[`eventBus`,`injector`],CommandStack.prototype.execute=function(e,n){if(!e)throw Error(`command required`);this._currentExecution.trigger=`execute`;let a={command:e,context:n};this._pushAction(a),this._internalExecute(a),this._popAction()},CommandStack.prototype.canExecute=function(e,n){let a={command:e,context:n},c=this._getHandler(e),m=this._fire(e,`canExecute`,a);if(m===void 0){if(!c)return!1;c.canExecute&&(m=c.canExecute(n))}return m},CommandStack.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire(`changed`,{trigger:`clear`})},CommandStack.prototype.undo=function(){let e=this._getUndoAction(),n;if(e){for(this._currentExecution.trigger=`undo`,this._pushAction(e);e&&(this._internalUndo(e),n=this._getUndoAction(),n&&n.id===e.id);)e=n;this._popAction()}},CommandStack.prototype.redo=function(){let e=this._getRedoAction(),n;if(e){for(this._currentExecution.trigger=`redo`,this._pushAction(e);e&&(this._internalExecute(e,!0),n=this._getRedoAction(),n&&n.id===e.id);)e=n;this._popAction()}},CommandStack.prototype.register=function(e,n){this._setHandler(e,n)},CommandStack.prototype.registerHandler=function(e,n){if(!e||!n)throw Error(`command and handlerCls must be defined`);let a=this._injector.instantiate(n);this.register(e,a)},CommandStack.prototype.canUndo=function(){return!!this._getUndoAction()},CommandStack.prototype.canRedo=function(){return!!this._getRedoAction()},CommandStack.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},CommandStack.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},CommandStack.prototype._internalUndo=function(e){let n=e.command,a=e.context,c=this._getHandler(n);this._atomicDo(()=>{this._fire(n,`revert`,e),c.revert&&this._markDirty(c.revert(a)),this._revertedAction(e),this._fire(n,`reverted`,e)})},CommandStack.prototype._fire=function(e,n,a){arguments.length<3&&(a=n,n=null);let c=n?[e+`.`+n,n]:[e],m;a=this._eventBus.createEvent(a);for(let e of c)if(m=this._eventBus.fire(`commandStack.`+e,a),a.cancelBubble)break;return m},CommandStack.prototype._createId=function(){return this._uid++},CommandStack.prototype._atomicDo=function(e){let n=this._currentExecution;n.atomic=!0;try{e()}finally{n.atomic=!1}},CommandStack.prototype._internalExecute=function(e,n){let a=e.command,c=e.context,m=this._getHandler(a);if(!m)throw Error(`no command handler registered for <`+a+`>`);this._pushAction(e),n||(this._fire(a,`preExecute`,e),m.preExecute&&m.preExecute(c),this._fire(a,`preExecuted`,e)),this._atomicDo(()=>{this._fire(a,`execute`,e),m.execute&&this._markDirty(m.execute(c)),this._executedAction(e,n),this._fire(a,`executed`,e)}),n||(this._fire(a,`postExecute`,e),m.postExecute&&m.postExecute(c),this._fire(a,`postExecuted`,e)),this._popAction()},CommandStack.prototype._pushAction=function(e){let n=this._currentExecution,a=n.actions,c=a[0];if(n.atomic)throw Error(`illegal invocation in <execute> or <revert> phase (action: `+e.command+`)`);e.id||=c&&c.id||this._createId(),a.push(e)},CommandStack.prototype._popAction=function(){let e=this._currentExecution,n=e.trigger,a=e.actions,c=e.dirty;a.pop(),a.length||(this._eventBus.fire(`elements.changed`,{elements:lt(`id`,c.reverse())}),c.length=0,this._fire(`changed`,{trigger:n}),e.trigger=null)},CommandStack.prototype._markDirty=function(e){let n=this._currentExecution;e&&(e=xt(e)?e:[e],n.dirty=n.dirty.concat(e))},CommandStack.prototype._executedAction=function(e,n){let a=++this._stackIdx;n||this._stack.splice(a,this._stack.length,e)},CommandStack.prototype._revertedAction=function(e){this._stackIdx--},CommandStack.prototype._getHandler=function(e){return this._handlerMap[e]},CommandStack.prototype._setHandler=function(e,n){if(!e||!n)throw Error(`command and handler required`);if(this._handlerMap[e])throw Error(`overriding handler for command <`+e+`>`);this._handlerMap[e]=n};var Di={commandStack:[`type`,CommandStack]};function saveClear(e,n){if(typeof n!=`function`)throw Error(`removeFn iterator must be a function`);if(!e)return[];for(var a;a=e[0];)n(a);return e}Tt();function AlignElements(e,n){this._modeling=e,this._canvas=n}AlignElements.$inject=[`modeling`,`canvas`],AlignElements.prototype.preExecute=function(e){var n=this._modeling,a=e.elements,c=e.alignment;Q(a,function(e){var a={x:0,y:0};bt(c.left)?a.x=c.left-e.x:bt(c.right)?a.x=c.right-e.width-e.x:bt(c.center)?a.x=c.center-Math.round(e.width/2)-e.x:bt(c.top)?a.y=c.top-e.y:bt(c.bottom)?a.y=c.bottom-e.height-e.y:bt(c.middle)&&(a.y=c.middle-Math.round(e.height/2)-e.y),n.moveElements([e],a,e.parent)})},AlignElements.prototype.postExecute=function(e){},Tt();function AppendShapeHandler(e){this._modeling=e}AppendShapeHandler.$inject=[`modeling`],AppendShapeHandler.prototype.preExecute=function(e){var n=e.source;if(!n)throw Error(`source required`);var a=e.target||n.parent,c=e.shape,m=e.hints||{};c=e.shape=this._modeling.createShape(c,e.position,a,{attach:m.attach}),e.shape=c},AppendShapeHandler.prototype.postExecute=function(e){var n=e.hints||{};existsConnection(e.source,e.shape)||(n.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))};function existsConnection(e,n){return dt(e.outgoing,function(e){return e.target===n})}function CreateConnectionHandler(e,n){this._canvas=e,this._layouter=n}CreateConnectionHandler.$inject=[`canvas`,`layouter`],CreateConnectionHandler.prototype.execute=function(e){var n=e.connection,a=e.source,c=e.target,m=e.parent,v=e.parentIndex,T=e.hints;if(!a||!c)throw Error(`source and target required`);if(!m)throw Error(`parent required`);return n.source=a,n.target=c,n.waypoints||=this._layouter.layoutConnection(n,T),this._canvas.addConnection(n,m,v),n},CreateConnectionHandler.prototype.revert=function(e){var n=e.connection;return this._canvas.removeConnection(n),n.source=null,n.target=null,n},Tt();var Oi=Math.round;function CreateElementsHandler(e){this._modeling=e}CreateElementsHandler.$inject=[`modeling`],CreateElementsHandler.prototype.preExecute=function(e){var n=e.elements,a=e.parent,c=e.parentIndex,m=e.position,v=e.hints,T=this._modeling;Q(n,function(e){Pt(e.x)||(e.x=0),Pt(e.y)||(e.y=0)});var O=Dt(n,function(e){return!e.hidden}),A=J(O);Q(n,function(e){Ke(e)&&(e.waypoints=Mt(e.waypoints,function(e){return{x:Oi(e.x-A.x-A.width/2+m.x),y:Oi(e.y-A.y-A.height/2+m.y)}})),At(e,{x:Oi(e.x-A.x-A.width/2+m.x),y:Oi(e.y-A.y-A.height/2+m.y)})});var I=new Set(ze(n)),L={};Q(n,function(e){if(Ke(e))L[e.id]=Pt(c)?T.createConnection(L[e.source.id],L[e.target.id],c,e,e.parent||a,v):T.createConnection(L[e.source.id],L[e.target.id],e,e.parent||a,v);else{var n=At({},v);I.has(e)||(n.autoResize=!1),He(e)&&(n=ct(n,[`attach`])),L[e.id]=Pt(c)?T.createShape(e,pt(e,[`x`,`y`,`width`,`height`]),e.parent||a,c,n):T.createShape(e,pt(e,[`x`,`y`,`width`,`height`]),e.parent||a,n)}}),e.elements=ut(L)},Tt();var ki=Math.round;function CreateShapeHandler(e){this._canvas=e}CreateShapeHandler.$inject=[`canvas`],CreateShapeHandler.prototype.execute=function(e){var n=e.shape,a=e.position,c=e.parent,m=e.parentIndex;if(!c)throw Error(`parent required`);if(!a)throw Error(`position required`);return a.width===void 0?At(n,{x:a.x-ki(n.width/2),y:a.y-ki(n.height/2)}):At(n,a),this._canvas.addShape(n,c,m),n},CreateShapeHandler.prototype.revert=function(e){var n=e.shape;return this._canvas.removeShape(n),n};function CreateLabelHandler(e){CreateShapeHandler.call(this,e)}Re(CreateLabelHandler,CreateShapeHandler),CreateLabelHandler.$inject=[`canvas`];var Ai=CreateShapeHandler.prototype.execute;CreateLabelHandler.prototype.execute=function(e){var n=e.shape;return ensureValidDimensions(n),n.labelTarget=e.labelTarget,Ai.call(this,e)};var ji=CreateShapeHandler.prototype.revert;CreateLabelHandler.prototype.revert=function(e){return e.shape.labelTarget=null,ji.call(this,e)};function ensureValidDimensions(e){[`width`,`height`].forEach(function(n){e[n]===void 0&&(e[n]=0)})}function DeleteConnectionHandler(e,n){this._canvas=e,this._modeling=n}DeleteConnectionHandler.$inject=[`canvas`,`modeling`],DeleteConnectionHandler.prototype.preExecute=function(e){var n=this._modeling,a=e.connection;saveClear(a.incoming,function(e){n.removeConnection(e,{nested:!0})}),saveClear(a.outgoing,function(e){n.removeConnection(e,{nested:!0})})},DeleteConnectionHandler.prototype.execute=function(e){var n=e.connection,a=n.parent;return e.parent=a,e.parentIndex=te(a.children,n),e.source=n.source,e.target=n.target,this._canvas.removeConnection(n),n.source=null,n.target=null,n},DeleteConnectionHandler.prototype.revert=function(e){var n=e.connection,a=e.parent,c=e.parentIndex;return n.source=e.source,n.target=e.target,pe(a.children,n,c),this._canvas.addConnection(n,a),n},Tt();function DeleteElementsHandler(e,n){this._modeling=e,this._elementRegistry=n}DeleteElementsHandler.$inject=[`modeling`,`elementRegistry`],DeleteElementsHandler.prototype.postExecute=function(e){var n=this._modeling,a=this._elementRegistry,c=e.elements;Q(c,function(e){a.get(e.id)&&(e.waypoints?n.removeConnection(e):n.removeShape(e))})};function DeleteShapeHandler(e,n){this._canvas=e,this._modeling=n}DeleteShapeHandler.$inject=[`canvas`,`modeling`],DeleteShapeHandler.prototype.preExecute=function(e){var n=this._modeling,a=e.shape;saveClear(a.incoming,function(e){n.removeConnection(e,{nested:!0})}),saveClear(a.outgoing,function(e){n.removeConnection(e,{nested:!0})}),saveClear(a.children,function(e){Ke(e)?n.removeConnection(e,{nested:!0}):n.removeShape(e,{nested:!0})})},DeleteShapeHandler.prototype.execute=function(e){var n=this._canvas,a=e.shape,c=a.parent;return e.oldParent=c,e.oldParentIndex=te(c.children,a),n.removeShape(a),a},DeleteShapeHandler.prototype.revert=function(e){var n=this._canvas,a=e.shape,c=e.oldParent,m=e.oldParentIndex;return pe(c.children,a,m),n.addShape(a,c),a},Tt();function DistributeElements$1(e){this._modeling=e}e(DistributeElements$1,`DistributeElements`),DistributeElements$1.$inject=[`modeling`];var Mi={x:`y`,y:`x`};DistributeElements$1.prototype.preExecute=function(e){var n=this._modeling,a=e.groups,c=e.axis,m=e.dimension;function updateRange(e,n){e.range.min=Math.min(n[c],e.range.min),e.range.max=Math.max(n[c]+n[m],e.range.max)}function center(e){return e[c]+e[m]/2}function lastIdx(e){return e.length-1}function rangeDiff(e){return e.max-e.min}function centerElement(e,a){var m={y:0};m[c]=e-center(a),m[c]&&(m[Mi[c]]=0,n.moveElements([a],m,a.parent))}var v=a[0],T=lastIdx(a),O=a[T],A,I,L=0;Q(a,function(e,n){var v,O,A;e.elements.length<2?n&&n!==a.length-1&&(updateRange(e,e.elements[0]),L+=rangeDiff(e.range)):(v=ft(e.elements,c),O=v[0],n===T&&(O=v[lastIdx(v)]),A=center(O),e.range=null,Q(v,function(n){centerElement(A,n),e.range===null?e.range={min:n[c],max:n[c]+n[m]}:updateRange(e,n)}),n&&n!==a.length-1&&(L+=rangeDiff(e.range)))}),I=Math.abs(O.range.min-v.range.max),A=Math.round((I-L)/(a.length-1)),!(A<a.length-1)&&Q(a,function(e,T){var I={},L;e!==v&&e!==O&&(L=a[T-1],e.range.max=0,Q(e.elements,function(a,v){I[Mi[c]]=0,I[c]=L.range.max-a[c]+A,e.range.min!==a[c]&&(I[c]+=a[c]-e.range.min),I[c]&&n.moveElements([a],I,a.parent),e.range.max=Math.max(a[c]+a[m],v?e.range.max:0)}))})},DistributeElements$1.prototype.postExecute=function(e){},Tt();function LayoutConnectionHandler(e,n){this._layouter=e,this._canvas=n}LayoutConnectionHandler.$inject=[`layouter`,`canvas`],LayoutConnectionHandler.prototype.execute=function(e){var n=e.connection,a=n.waypoints;return At(e,{oldWaypoints:a}),n.waypoints=this._layouter.layoutConnection(n,e.hints),n},LayoutConnectionHandler.prototype.revert=function(e){var n=e.connection;return n.waypoints=e.oldWaypoints,n},Tt();function MoveConnectionHandler(){}MoveConnectionHandler.prototype.execute=function(e){var n=e.connection,a=e.delta,c=e.newParent||n.parent,m=e.newParentIndex,v=n.parent;return e.oldParent=v,e.oldParentIndex=rt(v.children,n),pe(c.children,n,m),n.parent=c,Q(n.waypoints,function(e){e.x+=a.x,e.y+=a.y,e.original&&(e.original.x+=a.x,e.original.y+=a.y)}),n},MoveConnectionHandler.prototype.revert=function(e){var n=e.connection,a=n.parent,c=e.oldParent,m=e.oldParentIndex,v=e.delta;return rt(a.children,n),pe(c.children,n,m),n.parent=c,Q(n.waypoints,function(e){e.x-=v.x,e.y-=v.y,e.original&&(e.original.x-=v.x,e.original.y-=v.y)}),n},Tt();function MoveClosure(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}MoveClosure.prototype.add=function(e,n){return this.addAll([e],n)},MoveClosure.prototype.addAll=function(e,n){var a=ne(e,!!n,this);return At(this,a),this},Tt();function MoveHelper(e){this._modeling=e}MoveHelper.prototype.moveRecursive=function(e,n,a){return e?this.moveClosure(this.getClosure(e),n,a):[]},MoveHelper.prototype.moveClosure=function(e,n,a,c,m){var v=this._modeling,T=e.allShapes,O=e.allConnections,A=e.enclosedConnections,I=e.topLevel,L=!1;m&&m.parent===a&&(L=!0),Q(T,function(e){v.moveShape(e,n,I[e.id]&&!L&&a,{recurse:!1,layout:!1})}),Q(O,function(e){var c=!!T[e.source.id],m=!!T[e.target.id];A[e.id]&&c&&m?v.moveConnection(e,n,I[e.id]&&!L&&a):v.layoutConnection(e,{connectionStart:c&&getMovedSourceAnchor(e,e.source,n),connectionEnd:m&&getMovedTargetAnchor(e,e.target,n)})})},MoveHelper.prototype.getClosure=function(e){return new MoveClosure().addAll(e,!0)};function MoveElementsHandler(e){this._helper=new MoveHelper(e)}MoveElementsHandler.$inject=[`modeling`],MoveElementsHandler.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},MoveElementsHandler.prototype.postExecute=function(e){var n=e.hints,a;n&&n.primaryShape&&(a=n.primaryShape,n.oldParent=a.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,a)},Tt();function MoveShapeHandler(e){this._modeling=e,this._helper=new MoveHelper(e)}MoveShapeHandler.$inject=[`modeling`],MoveShapeHandler.prototype.execute=function(e){var n=e.shape,a=e.delta,c=e.newParent||n.parent,m=e.newParentIndex,v=n.parent;return e.oldBounds=pt(n,[`x`,`y`,`width`,`height`]),e.oldParent=v,e.oldParentIndex=rt(v.children,n),pe(c.children,n,m),At(n,{parent:c,x:n.x+a.x,y:n.y+a.y}),n},MoveShapeHandler.prototype.postExecute=function(e){var n=e.shape,a=e.delta,c=e.hints,m=this._modeling;c.layout!==!1&&(Q(n.incoming,function(e){m.layoutConnection(e,{connectionEnd:getMovedTargetAnchor(e,n,a)})}),Q(n.outgoing,function(e){m.layoutConnection(e,{connectionStart:getMovedSourceAnchor(e,n,a)})})),c.recurse!==!1&&this.moveChildren(e)},MoveShapeHandler.prototype.revert=function(e){var n=e.shape,a=e.oldParent,c=e.oldParentIndex,m=e.delta;return pe(a.children,n,c),At(n,{parent:a,x:n.x-m.x,y:n.y-m.y}),n},MoveShapeHandler.prototype.moveChildren=function(e){var n=e.delta,a=e.shape;this._helper.moveRecursive(a.children,n,null)},MoveShapeHandler.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},Tt();function ReconnectConnectionHandler(e){this._modeling=e}ReconnectConnectionHandler.$inject=[`modeling`],ReconnectConnectionHandler.prototype.execute=function(e){var n=e.newSource,a=e.newTarget,c=e.connection,m=e.dockingOrPoints;if(!n&&!a)throw Error(`newSource or newTarget required`);return xt(m)&&(e.oldWaypoints=c.waypoints,c.waypoints=m),n&&(e.oldSource=c.source,c.source=n),a&&(e.oldTarget=c.target,c.target=a),c},ReconnectConnectionHandler.prototype.postExecute=function(e){var n=e.connection,a=e.newSource,c=e.newTarget,m=e.dockingOrPoints,v=e.hints||{},T={};v.connectionStart&&(T.connectionStart=v.connectionStart),v.connectionEnd&&(T.connectionEnd=v.connectionEnd),v.layoutConnection!==!1&&(a&&(!c||v.docking===`source`)&&(T.connectionStart=T.connectionStart||getDocking(xt(m)?m[0]:m)),c&&(!a||v.docking===`target`)&&(T.connectionEnd=T.connectionEnd||getDocking(xt(m)?m[m.length-1]:m)),v.newWaypoints&&(T.waypoints=v.newWaypoints),this._modeling.layoutConnection(n,T))},ReconnectConnectionHandler.prototype.revert=function(e){var n=e.oldSource,a=e.oldTarget,c=e.oldWaypoints,m=e.connection;return n&&(m.source=n),a&&(m.target=a),c&&(m.waypoints=c),m};function getDocking(e){return e.original||e}Tt();function ReplaceShapeHandler(e,n){this._modeling=e,this._rules=n}ReplaceShapeHandler.$inject=[`modeling`,`rules`],ReplaceShapeHandler.prototype.preExecute=function(e){var n=this,a=this._modeling,c=this._rules,m=e.oldShape,v=e.newData,T=e.hints||{},O;function canReconnect(e,n,a){return c.allowed(`connection.reconnect`,{connection:a,source:e,target:n})}var A={x:v.x,y:v.y},I={x:m.x,y:m.y,width:m.width,height:m.height};O=e.newShape=e.newShape||n.createShape(v,A,m.parent,T),m.host&&a.updateAttachment(O,m.host);var L;T.moveChildren!==!1&&(L=m.children.slice(),a.moveElements(L,{x:0,y:0},O,T));var U=m.incoming.slice(),G=m.outgoing.slice();Q(U,function(e){var a=e.source;canReconnect(a,O,e)&&n.reconnectEnd(e,O,getResizedTargetAnchor(e,O,I),T)}),Q(G,function(e){var a=e.target;canReconnect(O,a,e)&&n.reconnectStart(e,O,getResizedSourceAnchor(e,O,I),T)})},ReplaceShapeHandler.prototype.postExecute=function(e){var n=e.oldShape;this._modeling.removeShape(n)},ReplaceShapeHandler.prototype.execute=function(e){},ReplaceShapeHandler.prototype.revert=function(e){},ReplaceShapeHandler.prototype.createShape=function(e,n,a,c){return this._modeling.createShape(e,n,a,c)},ReplaceShapeHandler.prototype.reconnectStart=function(e,n,a,c){this._modeling.reconnectStart(e,n,a,c)},ReplaceShapeHandler.prototype.reconnectEnd=function(e,n,a,c){this._modeling.reconnectEnd(e,n,a,c)},Tt();function ResizeShapeHandler(e){this._modeling=e}ResizeShapeHandler.$inject=[`modeling`],ResizeShapeHandler.prototype.execute=function(e){var n=e.shape,a=e.newBounds,c=e.minBounds;if(a.x===void 0||a.y===void 0||a.width===void 0||a.height===void 0)throw Error(`newBounds must have {x, y, width, height} properties`);if(c&&(a.width<c.width||a.height<c.height))throw Error(`width and height cannot be less than minimum height and width`);if(!c&&a.width<10||a.height<10)throw Error(`width and height cannot be less than 10px`);return e.oldBounds={width:n.width,height:n.height,x:n.x,y:n.y},At(n,{width:a.width,height:a.height,x:a.x,y:a.y}),n},ResizeShapeHandler.prototype.postExecute=function(e){var n=this._modeling,a=e.shape,c=e.oldBounds;(e.hints||{}).layout!==!1&&(Q(a.incoming,function(e){n.layoutConnection(e,{connectionEnd:getResizedTargetAnchor(e,a,c)})}),Q(a.outgoing,function(e){n.layoutConnection(e,{connectionStart:getResizedSourceAnchor(e,a,c)})}))},ResizeShapeHandler.prototype.revert=function(e){var n=e.shape,a=e.oldBounds;return At(n,{width:a.width,height:a.height,x:a.x,y:a.y}),n},Tt();function SpaceToolHandler(e){this._modeling=e}SpaceToolHandler.$inject=[`modeling`],SpaceToolHandler.prototype.preExecute=function(e){var n=e.delta,a=e.direction,c=e.movingShapes,m=e.resizingShapes,v=e.start,T={};this.moveShapes(c,n),Q(m,function(e){T[e.id]=getBounds(e)}),this.resizeShapes(m,n,a),this.updateConnectionWaypoints(getWaypointsUpdatingConnections(c,m),n,a,v,c,m,T)},SpaceToolHandler.prototype.execute=function(){},SpaceToolHandler.prototype.revert=function(){},SpaceToolHandler.prototype.moveShapes=function(e,n){var a=this;Q(e,function(e){a._modeling.moveShape(e,n,null,{autoResize:!1,layout:!1,recurse:!1})})},SpaceToolHandler.prototype.resizeShapes=function(e,n,a){var c=this;Q(e,function(e){var m=resizeBounds(e,a,n);c._modeling.resizeShape(e,m,null,{attachSupport:!1,autoResize:!1,layout:!1})})},SpaceToolHandler.prototype.updateConnectionWaypoints=function(e,n,a,c,m,v,T){var O=this,A=new Set(m),I=new Set(v);Q(e,function(e){var m=e.source,v=e.target,L=copyWaypoints(e),U=getAxisFromDirection(a),G={},K=A.has(m)||I.has(m),q=A.has(v)||I.has(v);K&&q?(L=Mt(L,function(e){return shouldMoveWaypoint(e,c,a)&&(e[U]=e[U]+n[U]),e.original&&shouldMoveWaypoint(e.original,c,a)&&(e.original[U]=e.original[U]+n[U]),e}),O._modeling.updateWaypoints(e,L,{labelBehavior:!1})):(K||q)&&(A.has(m)?G.connectionStart=getMovedSourceAnchor(e,m,n):A.has(v)?G.connectionEnd=getMovedTargetAnchor(e,v,n):I.has(m)?G.connectionStart=getResizedSourceAnchor(e,m,T[m.id]):I.has(v)&&(G.connectionEnd=getResizedTargetAnchor(e,v,T[v.id])),O._modeling.layoutConnection(e,G))})};function copyWaypoint(e){return At({},e)}function copyWaypoints(e){return Mt(e.waypoints,function(e){return e=copyWaypoint(e),e.original&&(e.original=copyWaypoint(e.original)),e})}function getAxisFromDirection(e){switch(e){case`n`:return`y`;case`w`:return`x`;case`s`:return`y`;case`e`:return`x`}}function shouldMoveWaypoint(e,n,a){var c=getAxisFromDirection(a);if(/e|s/.test(a))return e[c]>n;if(/n|w/.test(a))return e[c]<n}function getBounds(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}Tt();function ToggleShapeCollapseHandler(e){this._modeling=e}ToggleShapeCollapseHandler.$inject=[`modeling`],ToggleShapeCollapseHandler.prototype.execute=function(e){var n=e.shape,a=n.children;e.oldChildrenVisibility=getElementsVisibilityRecursive(a),n.collapsed=!n.collapsed;var c=setHiddenRecursive(a,n.collapsed);return[n].concat(c)},ToggleShapeCollapseHandler.prototype.revert=function(e){var n=e.shape,a=e.oldChildrenVisibility,c=n.children,m=restoreVisibilityRecursive(c,a);return n.collapsed=!n.collapsed,[n].concat(m)};function getElementsVisibilityRecursive(e){var n={};return Q(e,function(e){n[e.id]=e.hidden,e.children&&(n=At({},n,getElementsVisibilityRecursive(e.children)))}),n}function setHiddenRecursive(e,n){var a=[];return Q(e,function(e){e.hidden=n,a=a.concat(e),e.children&&(a=a.concat(setHiddenRecursive(e.children,e.collapsed||n)))}),a}function restoreVisibilityRecursive(e,n){var a=[];return Q(e,function(e){e.hidden=n[e.id],a=a.concat(e),e.children&&(a=a.concat(restoreVisibilityRecursive(e.children,n)))}),a}function UpdateAttachmentHandler(e){this._modeling=e}UpdateAttachmentHandler.$inject=[`modeling`],UpdateAttachmentHandler.prototype.execute=function(e){var n=e.shape,a=e.newHost,c=n.host;return e.oldHost=c,e.attacherIdx=removeAttacher(c,n),addAttacher(a,n),n.host=a,n},UpdateAttachmentHandler.prototype.revert=function(e){var n=e.shape,a=e.newHost,c=e.oldHost,m=e.attacherIdx;return n.host=c,removeAttacher(a,n),addAttacher(c,n,m),n};function removeAttacher(e,n){return rt(e&&e.attachers,n)}function addAttacher(e,n,a){if(e){var c=e.attachers;c||(e.attachers=c=[]),pe(c,n,a)}}function UpdateWaypointsHandler(){}UpdateWaypointsHandler.prototype.execute=function(e){var n=e.connection,a=e.newWaypoints;return e.oldWaypoints=n.waypoints,n.waypoints=a,n},UpdateWaypointsHandler.prototype.revert=function(e){var n=e.connection;return n.waypoints=e.oldWaypoints,n},Tt();function Modeling(e,n,a){this._eventBus=e,this._elementFactory=n,this._commandStack=a;var c=this;e.on(`diagram.init`,function(){c.registerHandlers(a)})}Modeling.$inject=[`eventBus`,`elementFactory`,`commandStack`],Modeling.prototype.getHandlers=function(){return{"shape.append":AppendShapeHandler,"shape.create":CreateShapeHandler,"shape.delete":DeleteShapeHandler,"shape.move":MoveShapeHandler,"shape.resize":ResizeShapeHandler,"shape.replace":ReplaceShapeHandler,"shape.toggleCollapse":ToggleShapeCollapseHandler,spaceTool:SpaceToolHandler,"label.create":CreateLabelHandler,"connection.create":CreateConnectionHandler,"connection.delete":DeleteConnectionHandler,"connection.move":MoveConnectionHandler,"connection.layout":LayoutConnectionHandler,"connection.updateWaypoints":UpdateWaypointsHandler,"connection.reconnect":ReconnectConnectionHandler,"elements.create":CreateElementsHandler,"elements.move":MoveElementsHandler,"elements.delete":DeleteElementsHandler,"elements.distribute":DistributeElements$1,"elements.align":AlignElements,"element.updateAttachment":UpdateAttachmentHandler}},Modeling.prototype.registerHandlers=function(e){Q(this.getHandlers(),function(n,a){e.registerHandler(a,n)})},Modeling.prototype.moveShape=function(e,n,a,c,m){typeof c==`object`&&(m=c,c=null);var v={shape:e,delta:n,newParent:a,newParentIndex:c,hints:m||{}};this._commandStack.execute(`shape.move`,v)},Modeling.prototype.updateAttachment=function(e,n){var a={shape:e,newHost:n};this._commandStack.execute(`element.updateAttachment`,a)},Modeling.prototype.moveElements=function(e,n,a,c){c||={};var m=c.attach,v=a,T;m===!0?(T=a,v=a.parent):m===!1&&(T=null);var O={shapes:e,delta:n,newParent:v,newHost:T,hints:c};this._commandStack.execute(`elements.move`,O)},Modeling.prototype.moveConnection=function(e,n,a,c,m){typeof c==`object`&&(m=c,c=void 0);var v={connection:e,delta:n,newParent:a,newParentIndex:c,hints:m||{}};this._commandStack.execute(`connection.move`,v)},Modeling.prototype.layoutConnection=function(e,n){var a={connection:e,hints:n||{}};this._commandStack.execute(`connection.layout`,a)},Modeling.prototype.createConnection=function(e,n,a,c,m,v){typeof a==`object`&&(v=m,m=c,c=a,a=void 0),c=this._create(`connection`,c);var T={source:e,target:n,parent:m,parentIndex:a,connection:c,hints:v};return this._commandStack.execute(`connection.create`,T),T.connection},Modeling.prototype.createShape=function(e,n,a,c,m){typeof c!=`number`&&(m=c,c=void 0),m||={};var v=m.attach,T,O;e=this._create(`shape`,e),v?(T=a.parent,O=a):T=a;var A={position:n,shape:e,parent:T,parentIndex:c,host:O,hints:m};return this._commandStack.execute(`shape.create`,A),A.shape},Modeling.prototype.createElements=function(e,n,a,c,m){xt(e)||(e=[e]),typeof c!=`number`&&(m=c,c=void 0),m||={};var v={position:n,elements:e,parent:a,parentIndex:c,hints:m};return this._commandStack.execute(`elements.create`,v),v.elements},Modeling.prototype.createLabel=function(e,n,a,c){a=this._create(`label`,a);var m={labelTarget:e,position:n,parent:c||e.parent,shape:a};return this._commandStack.execute(`label.create`,m),m.shape},Modeling.prototype.appendShape=function(e,n,a,c,m){m||={},n=this._create(`shape`,n);var v={source:e,position:a,target:c,shape:n,connection:m.connection,connectionParent:m.connectionParent,hints:m};return this._commandStack.execute(`shape.append`,v),v.shape},Modeling.prototype.removeElements=function(e){var n={elements:e};this._commandStack.execute(`elements.delete`,n)},Modeling.prototype.distributeElements=function(e,n,a){var c={groups:e,axis:n,dimension:a};this._commandStack.execute(`elements.distribute`,c)},Modeling.prototype.removeShape=function(e,n){var a={shape:e,hints:n||{}};this._commandStack.execute(`shape.delete`,a)},Modeling.prototype.removeConnection=function(e,n){var a={connection:e,hints:n||{}};this._commandStack.execute(`connection.delete`,a)},Modeling.prototype.replaceShape=function(e,n,a){var c={oldShape:e,newData:n,hints:a||{}};return this._commandStack.execute(`shape.replace`,c),c.newShape},Modeling.prototype.alignElements=function(e,n){var a={elements:e,alignment:n};this._commandStack.execute(`elements.align`,a)},Modeling.prototype.resizeShape=function(e,n,a,c){var m={shape:e,newBounds:n,minBounds:a,hints:c};this._commandStack.execute(`shape.resize`,m)},Modeling.prototype.createSpace=function(e,n,a,c,m){var v={delta:a,direction:c,movingShapes:e,resizingShapes:n,start:m};this._commandStack.execute(`spaceTool`,v)},Modeling.prototype.updateWaypoints=function(e,n,a){var c={connection:e,newWaypoints:n,hints:a||{}};this._commandStack.execute(`connection.updateWaypoints`,c)},Modeling.prototype.reconnect=function(e,n,a,c,m){var v={connection:e,newSource:n,newTarget:a,dockingOrPoints:c,hints:m||{}};this._commandStack.execute(`connection.reconnect`,v)},Modeling.prototype.reconnectStart=function(e,n,a,c){c||={},this.reconnect(e,n,e.target,a,At(c,{docking:`source`}))},Modeling.prototype.reconnectEnd=function(e,n,a,c){c||={},this.reconnect(e,e.source,n,a,At(c,{docking:`target`}))},Modeling.prototype.connect=function(e,n,a,c){return this.createConnection(e,n,a||{},e.parent,c)},Modeling.prototype._create=function(e,n){return Ye(n)?n:this._elementFactory.create(e,n)},Modeling.prototype.toggleCollapse=function(e,n){var a={shape:e,hints:n||{}};this._commandStack.execute(`shape.toggleCollapse`,a)};function BaseLayouter(){}BaseLayouter.prototype.layoutConnection=function(e,n){return n||={},[n.connectionStart||Ve(n.source||e.source),n.connectionEnd||Ve(n.target||e.target)]},Tt();function dockingToPoint(e){return At({original:e.point.original||e.point},e.actual)}function CroppingConnectionDocking(e,n){this._elementRegistry=e,this._graphicsFactory=n}CroppingConnectionDocking.$inject=[`elementRegistry`,`graphicsFactory`],CroppingConnectionDocking.prototype.getCroppedWaypoints=function(e,n,a){n||=e.source,a||=e.target;var c=this.getDockingPoint(e,n,!0),m=this.getDockingPoint(e,a),v=e.waypoints.slice(c.idx+1,m.idx);return v.unshift(dockingToPoint(c)),v.push(dockingToPoint(m)),v},CroppingConnectionDocking.prototype.getDockingPoint=function(e,n,a){var c=e.waypoints,m=a?0:c.length-1,v=c[m];return{point:v,actual:this._getIntersection(n,e,a)||v,idx:m}},CroppingConnectionDocking.prototype._getIntersection=function(e,n,a){var c=this._getShapePath(e),m=this._getConnectionPath(n);return Oe(c,m,a)},CroppingConnectionDocking.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},CroppingConnectionDocking.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},CroppingConnectionDocking.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)},Tt();var Ni=Math.min,Pi=Math.max;function preventDefault$1(e){e.preventDefault()}e(preventDefault$1,`preventDefault`);function stopPropagation(e){e.stopPropagation()}function isTextNode(e){return e.nodeType===Node.TEXT_NODE}function toArray(e){return[].slice.call(e)}function TextBox(e){this.container=e.container,this.parent=Je(`<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>`),this.content=Qe(`[contenteditable]`,this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Et(this.autoResize,this),this.handlePaste=Et(this.handlePaste,this)}TextBox.prototype.create=function(e,n,a,c){var m=this,v=this.parent,T=this.content,O=this.container;c=this.options=c||{},n=this.style=n||{};var A=pt(n,[`width`,`height`,`maxWidth`,`maxHeight`,`minWidth`,`minHeight`,`left`,`top`,`backgroundColor`,`position`,`overflow`,`border`,`wordWrap`,`textAlign`,`outline`,`transform`]);At(v.style,{width:e.width+`px`,height:e.height+`px`,maxWidth:e.maxWidth+`px`,maxHeight:e.maxHeight+`px`,minWidth:e.minWidth+`px`,minHeight:e.minHeight+`px`,left:e.x+`px`,top:e.y+`px`,backgroundColor:`#ffffff`,position:`absolute`,overflow:`visible`,border:`1px solid #ccc`,boxSizing:`border-box`,wordWrap:`normal`,textAlign:`center`,outline:`none`},A);var I=pt(n,[`fontFamily`,`fontSize`,`fontWeight`,`lineHeight`,`padding`,`paddingTop`,`paddingRight`,`paddingBottom`,`paddingLeft`]);return At(T.style,{boxSizing:`border-box`,width:`100%`,outline:`none`,wordWrap:`break-word`},I),c.centerVertically&&At(T.style,{position:`absolute`,top:`50%`,transform:`translate(0, -50%)`},I),T.innerText=a,K.bind(T,`keydown`,this.keyHandler),K.bind(T,`mousedown`,stopPropagation),K.bind(T,`paste`,m.handlePaste),K.bind(T,`focusout`,this.focusoutHandler),c.autoResize&&K.bind(T,`input`,this.autoResize),c.resizable&&this.resizable(n),O.appendChild(v),this.setSelection(T.lastChild,T.lastChild&&T.lastChild.length),v},TextBox.prototype.handlePaste=function(e){var n=this.options,a=this.style;e.preventDefault();var c=e.clipboardData?e.clipboardData.getData(`text/plain`):window.clipboardData.getData(`Text`);if(this.insertText(c),n.autoResize){var m=this.autoResize(a);m&&this.resizeHandler(m)}},TextBox.prototype.insertText=function(e){e=normalizeEndOfLineSequences(e),!document.execCommand(`insertText`,!1,e)&&this._insertTextIE(e)},TextBox.prototype._insertTextIE=function(e){var n=this.getSelection(),a=n.startContainer,c=n.endContainer,m=n.startOffset,v=n.endOffset,T=n.commonAncestorContainer,O=toArray(T.childNodes),A,I;if(isTextNode(T)){var L=a.textContent;a.textContent=L.substring(0,m)+e+L.substring(v),A=a,I=m+e.length}else if(a===this.content&&c===this.content){var U=document.createTextNode(e);this.content.insertBefore(U,O[m]),A=U,I=U.textContent.length}else{var G=O.indexOf(a),K=O.indexOf(c);O.forEach(function(n,T){T===G?n.textContent=a.textContent.substring(0,m)+e+c.textContent.substring(v):T>G&&T<=K&&Ue(n)}),A=a,I=m+e.length}A&&I!==void 0&&setTimeout(function(){self.setSelection(A,I)})},TextBox.prototype.autoResize=function(){var e=this.parent,n=this.content,a=parseInt(this.style.fontSize)||12;if(n.scrollHeight>e.offsetHeight||n.scrollHeight<e.offsetHeight-a){var c=e.getBoundingClientRect(),m=n.scrollHeight;e.style.height=m+`px`,this.resizeHandler({width:c.width,height:c.height,dx:0,dy:m-c.height})}},TextBox.prototype.resizable=function(){var e=this,n=this.parent,a=this.resizeHandle,c=parseInt(this.style.minWidth)||0,m=parseInt(this.style.minHeight)||0,v=parseInt(this.style.maxWidth)||1/0,T=parseInt(this.style.maxHeight)||1/0;if(!a){a=this.resizeHandle=Je(`<div class="djs-direct-editing-resize-handle"></div>`);var O,A,I,L,onMouseDown=function(e){preventDefault$1(e),stopPropagation(e),O=e.clientX,A=e.clientY;var a=n.getBoundingClientRect();I=a.width,L=a.height,K.bind(document,`mousemove`,onMouseMove),K.bind(document,`mouseup`,onMouseUp)},onMouseMove=function(a){preventDefault$1(a),stopPropagation(a);var U=Ni(Pi(I+a.clientX-O,c),v),G=Ni(Pi(L+a.clientY-A,m),T);n.style.width=U+`px`,n.style.height=G+`px`,e.resizeHandler({width:I,height:L,dx:a.clientX-O,dy:a.clientY-A})},onMouseUp=function(e){preventDefault$1(e),stopPropagation(e),K.unbind(document,`mousemove`,onMouseMove,!1),K.unbind(document,`mouseup`,onMouseUp,!1)};K.bind(a,`mousedown`,onMouseDown)}At(a.style,{position:`absolute`,bottom:`0px`,right:`0px`,cursor:`nwse-resize`,width:`0`,height:`0`,borderTop:(parseInt(this.style.fontSize)/4||3)+`px solid transparent`,borderRight:(parseInt(this.style.fontSize)/4||3)+`px solid #ccc`,borderBottom:(parseInt(this.style.fontSize)/4||3)+`px solid #ccc`,borderLeft:(parseInt(this.style.fontSize)/4||3)+`px solid transparent`}),n.appendChild(a)},TextBox.prototype.destroy=function(){var e=this.parent,n=this.content,a=this.resizeHandle;n.innerText=``,e.removeAttribute(`style`),n.removeAttribute(`style`),K.unbind(n,`keydown`,this.keyHandler),K.unbind(n,`mousedown`,stopPropagation),K.unbind(n,`input`,this.autoResize),K.unbind(n,`paste`,this.handlePaste),K.unbind(n,`focusout`,this.focusoutHandler),a&&(a.removeAttribute(`style`),Ue(a)),Ue(e)},TextBox.prototype.getValue=function(){return this.content.innerText.trim()},TextBox.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},TextBox.prototype.setSelection=function(e,n){var a=document.createRange();e===null?a.selectNodeContents(this.content):(a.setStart(e,n),a.setEnd(e,n));var c=window.getSelection();c.removeAllRanges(),c.addRange(a)};function normalizeEndOfLineSequences(e){return e.replace(/\r\n|\r|\n/g,`
325
- `)}Tt();function DirectEditing(e,n){this._eventBus=e,this._canvas=n,this._providers=[],this._active=null,this._textbox=new TextBox({container:n.getContainer(),keyHandler:Et(this._handleKey,this),resizeHandler:Et(this._handleResize,this),focusoutHandler:Et(this._handleFocusout,this)}),e.on([`diagram.clear`,`diagram.destroy`],()=>this._cleanup())}DirectEditing.$inject=[`eventBus`,`canvas`],DirectEditing.prototype.registerProvider=function(e){this._providers.push(e)},DirectEditing.prototype.isActive=function(e){return!(!this._active||e&&this._active.element!==e)},DirectEditing.prototype.cancel=function(){this._active&&(this._fire(`cancel`),this.close())},DirectEditing.prototype._fire=function(e,n){this._eventBus.fire(`directEditing.`+e,n||{active:this._active})},DirectEditing.prototype.close=function(){this._fire(`deactivate`),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},DirectEditing.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},DirectEditing.prototype.complete=function(){var e=this._active;if(e){var n,a=e.context.bounds,c=this.$textbox.getBoundingClientRect(),m=this.getValue();(m!==e.context.text||c.height!==a.height||c.width!==a.width)&&(n=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,m,e.context.text,{x:c.left-n.left,y:c.top-n.top,width:c.width,height:c.height})),this._fire(`complete`),this.close()}},DirectEditing.prototype.getValue=function(){return this._textbox.getValue()},DirectEditing.prototype._handleKey=function(e){e.stopPropagation();var n=e.keyCode||e.charCode;if(n===27)return e.preventDefault(),this.cancel();if(n===13&&!e.shiftKey)return e.preventDefault(),this.complete()},DirectEditing.prototype._handleResize=function(e){this._fire(`resize`,e)},DirectEditing.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},DirectEditing.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire(`directEditing.activate.allowed`,{element:e})===!1)return!1;var n,a=kt(this._providers,function(a){return(n=a.activate(e))?a:null});return n&&(this.$textbox=this._textbox.create(n.bounds,n.style,n.text,n.options),this._active={element:e,context:n,provider:a},n.options&&n.options.resizable&&(this.resizable=!0),this._fire(`activate`)),!!n};var Fi={__depends__:[Le],__init__:[`directEditing`],directEditing:[`type`,DirectEditing]};Tt();var Ii={horizontal:[`x`,`width`],vertical:[`y`,`height`]},Li=5;function DistributeElements(e,n){this._modeling=e,this._filters=[],this.registerFilter(function(e){var a=n.allowed(`elements.distribute`,{elements:e});return xt(a)?a:a?e:[]})}DistributeElements.$inject=[`modeling`,`rules`],DistributeElements.prototype.registerFilter=function(e){if(typeof e!=`function`)throw Error(`the filter has to be a function`);this._filters.push(e)},DistributeElements.prototype.trigger=function(e,n){var a=this._modeling,c,m;if(!(e.length<3)&&(this._setOrientation(n),m=this._filterElements(e),c=this._createGroups(m),!(c.length<=2)))return a.distributeElements(c,this._axis,this._dimension),c},DistributeElements.prototype._filterElements=function(e){var n=this._filters,a=this._axis,c=this._dimension,m=[].concat(e);return n.length?(Q(n,function(e){m=e(m,a,c)}),m):e},DistributeElements.prototype._createGroups=function(e){var n=[],a=this,c=this._axis,m=this._dimension;if(!c)throw Error(`must have a defined "axis" and "dimension"`);var v=ft(e,c);return Q(v,function(e,v){var T=a._findRange(e,c,m),O,A=n[n.length-1];A&&a._hasIntersection(A.range,T)?n[n.length-1].elements.push(e):(O={range:T,elements:[e]},n.push(O))}),n},DistributeElements.prototype._setOrientation=function(e){var n=Ii[e];this._axis=n[0],this._dimension=n[1]},DistributeElements.prototype._hasIntersection=function(e,n){return Math.max(e.min,e.max)>=Math.min(n.min,n.max)&&Math.min(e.min,e.max)<=Math.max(n.min,n.max)},DistributeElements.prototype._findRange=function(e){var n=e[this._axis],a=e[this._dimension];return{min:n+Li,max:n+a-Li}};var Ri={__init__:[`distributeElements`],distributeElements:[`type`,DistributeElements]};Tt();var zi=`is not a registered action`,Bi=`is already registered`;function EditorActions(e,n){this._eventBus=e,this._actions={};var a=this;e.on(`diagram.init`,function(){a._registerDefaultActions(n),e.fire(`editorActions.init`,{editorActions:a})})}EditorActions.$inject=[`eventBus`,`injector`],EditorActions.prototype._registerDefaultActions=function(e){var n=e.get(`commandStack`,!1),a=e.get(`modeling`,!1),c=e.get(`selection`,!1),m=e.get(`zoomScroll`,!1),v=e.get(`copyPaste`,!1),T=e.get(`canvas`,!1),O=e.get(`rules`,!1),A=e.get(`keyboardMove`,!1),I=e.get(`keyboardMoveSelection`,!1);n&&(this.register(`undo`,function(){n.undo()}),this.register(`redo`,function(){n.redo()})),v&&c&&this.register(`copy`,function(){var e=c.get();if(e.length)return v.copy(e)}),v&&c&&this.register(`duplicate`,function(){var e=c.get();if(e.length)return v.duplicate(e)}),v&&this.register(`paste`,function(){v.paste()}),v&&c&&O&&this.register(`cut`,function(){var e=c.get();if(e.length){var n=O.allowed(`elements.delete`,{elements:e});if(n!==!1){var a=xt(n)?n:e;return v.cut(a.slice())}}}),m&&this.register(`stepZoom`,function(e){m.stepZoom(e.value)}),T&&this.register(`zoom`,function(e){T.zoom(e.value)}),a&&c&&O&&this.register(`removeSelection`,function(){var e=c.get();if(e.length){var n=O.allowed(`elements.delete`,{elements:e}),m;n!==!1&&(m=xt(n)?n:e,m.length&&a.removeElements(m.slice()))}}),A&&this.register(`moveCanvas`,function(e){A.moveCanvas(e)}),I&&this.register(`moveSelection`,function(e){I.moveSelection(e.direction,e.accelerated)})},EditorActions.prototype.trigger=function(e,n){if(!this._actions[e])throw error(e,zi);if(this._eventBus.fire(`editorActions.allowed`,{action:e,opts:n})!==!1)return this._actions[e](n)},EditorActions.prototype.register=function(e,n){var a=this;if(typeof e==`string`)return this._registerAction(e,n);Q(e,function(e,n){a._registerAction(n,e)})},EditorActions.prototype._registerAction=function(e,n){if(this.isRegistered(e))throw error(e,Bi);this._actions[e]=n},EditorActions.prototype.unregister=function(e){if(!this.isRegistered(e))throw error(e,zi);this._actions[e]=void 0},EditorActions.prototype.getActions=function(){return Object.keys(this._actions)},EditorActions.prototype.isRegistered=function(e){return!!this._actions[e]};function error(e,n){return Error(e+` `+n)}var Vi={__init__:[`editorActions`],editorActions:[`type`,EditorActions]};Tt();function ResizeBehavior(e,n){tt.call(this,e),this._gridSnapping=n;var a=this;this.preExecute(`shape.resize`,function(e){var n=e.context,c=(n.hints||{}).autoResize;if(c){var m=n.shape,v=n.newBounds;n.newBounds=Nt(c)?a.snapComplex(v,c):a.snapSimple(m,v)}})}ResizeBehavior.$inject=[`eventBus`,`gridSnapping`,`modeling`],Re(ResizeBehavior,tt),ResizeBehavior.prototype.snapSimple=function(e,n){var a=this._gridSnapping;return n.width=a.snapValue(n.width,{min:n.width}),n.height=a.snapValue(n.height,{min:n.height}),n.x=e.x+e.width/2-n.width/2,n.y=e.y+e.height/2-n.height/2,n},ResizeBehavior.prototype.snapComplex=function(e,n){return/w|e/.test(n)&&(e=this.snapHorizontally(e,n)),/n|s/.test(n)&&(e=this.snapVertically(e,n)),e},ResizeBehavior.prototype.snapHorizontally=function(e,n){var a=this._gridSnapping,c=/w/.test(n),m=/e/.test(n),v={};return v.width=a.snapValue(e.width,{min:e.width}),m&&(c?(v.x=a.snapValue(e.x,{max:e.x}),v.width+=a.snapValue(e.x-v.x,{min:e.x-v.x})):e.x=e.x+e.width-v.width),At(e,v),e},ResizeBehavior.prototype.snapVertically=function(e,n){var a=this._gridSnapping,c=/n/.test(n),m=/s/.test(n),v={};return v.height=a.snapValue(e.height,{min:e.height}),c&&(m?(v.y=a.snapValue(e.y,{max:e.y}),v.height+=a.snapValue(e.y-v.y,{min:e.y-v.y})):e.y=e.y+e.height-v.height),At(e,v),e};var Hi=2e3;function SpaceToolBehavior(e,n){e.on([`spaceTool.move`,`spaceTool.end`],Hi,function(e){var a=e.context;if(a.initialized){var c=a.axis,m;c===`x`?(m=n.snapValue(e.dx),e.x=e.x+m-e.dx,e.dx=m):(m=n.snapValue(e.dy),e.y=e.y+m-e.dy,e.dy=m)}})}SpaceToolBehavior.$inject=[`eventBus`,`gridSnapping`];var Ui={__init__:[`gridSnappingResizeBehavior`,`gridSnappingSpaceToolBehavior`],gridSnappingResizeBehavior:[`type`,ResizeBehavior],gridSnappingSpaceToolBehavior:[`type`,SpaceToolBehavior]};function quantize(e,n,a){return a||=`round`,Math[a](e/n)*n}Tt();var Wi=1200,Gi=800;function GridSnapping(e,n,a){var c=!a||a.active!==!1;this._eventBus=n;var m=this;n.on(`diagram.init`,Gi,function(){m.setActive(c)}),n.on([`create.move`,`create.end`,`bendpoint.move.move`,`bendpoint.move.end`,`connect.move`,`connect.end`,`connectionSegment.move.move`,`connectionSegment.move.end`,`resize.move`,`resize.end`,`shape.move.move`,`shape.move.end`],Wi,function(n){var a=n.originalEvent;if(!(!m.active||a&&isCmd$1(a))){var c=n.context,v=c.gridSnappingContext;v||=c.gridSnappingContext={},[`x`,`y`].forEach(function(a){var c={},v=getSnapOffset(n,a,e);v&&(c.offset=v);var T=getSnapConstraints(n,a);T&&At(c,T),isSnapped(n,a)||m.snapEvent(n,a,c)})}})}GridSnapping.prototype.snapEvent=function(e,n,a){setSnapped(e,n,this.snapValue(e[n],a))},GridSnapping.prototype.getGridSpacing=function(){return 10},GridSnapping.prototype.snapValue=function(e,n){var a=0;n&&n.offset&&(a=n.offset),e+=a,e=quantize(e,10);var c,m;return n&&n.min&&(c=n.min,Pt(c)&&(c=quantize(c+a,10,`ceil`),e=Math.max(e,c))),n&&n.max&&(m=n.max,Pt(m)&&(m=quantize(m+a,10,`floor`),e=Math.min(e,m))),e-=a,e},GridSnapping.prototype.isActive=function(){return this.active},GridSnapping.prototype.setActive=function(e){this.active=e,this._eventBus.fire(`gridSnapping.toggle`,{active:e})},GridSnapping.prototype.toggleActive=function(){this.setActive(!this.active)},GridSnapping.$inject=[`elementRegistry`,`eventBus`,`config.gridSnapping`];function getSnapConstraints(e,n){var a=e.context,c=a.createConstraints,m=a.resizeConstraints||{},v=a.gridSnappingContext,T=v.snapConstraints;if(T&&T[n])return T[n];T||=v.snapConstraints={},T[n]||(T[n]={});var O=a.direction;c&&(isHorizontal$1(n)?(T.x.min=c.left,T.x.max=c.right):(T.y.min=c.top,T.y.max=c.bottom));var A=m.min,I=m.max;return A&&(isHorizontal$1(n)?isWest(O)?T.x.max=A.left:T.x.min=A.right:isNorth(O)?T.y.max=A.top:T.y.min=A.bottom),I&&(isHorizontal$1(n)?isWest(O)?T.x.min=I.left:T.x.max=I.right:isNorth(O)?T.y.min=I.top:T.y.max=I.bottom),T[n]}function getSnapOffset(e,n,a){var c=e.context,m=e.shape,v=c.gridSnappingContext,T=v.snapLocation,O=v.snapOffset;return O&&Pt(O[n])||(O||=v.snapOffset={},Pt(O[n])||(O[n]=0),!m)||(a.get(m.id)||(isHorizontal$1(n)?O[n]+=m[n]+m.width/2:O[n]+=m[n]+m.height/2),!T)||(n===`x`?/left/.test(T)?O[n]-=m.width/2:/right/.test(T)&&(O[n]+=m.width/2):/top/.test(T)?O[n]-=m.height/2:/bottom/.test(T)&&(O[n]+=m.height/2)),O[n]}function isHorizontal$1(e){return e===`x`}e(isHorizontal$1,`isHorizontal`);function isNorth(e){return e.indexOf(`n`)!==-1}function isWest(e){return e.indexOf(`w`)!==-1}var Ki={__depends__:[Ui],__init__:[`gridSnapping`],gridSnapping:[`type`,GridSnapping]};Tt();var qi={moveSpeed:1,moveSpeedAccelerated:10},Ji=1500,Yi={ArrowLeft:`left`,ArrowUp:`up`,ArrowRight:`right`,ArrowDown:`down`},Xi={left:function(e){return{x:-e,y:0}},up:function(e){return{x:0,y:-e}},right:function(e){return{x:e,y:0}},down:function(e){return{x:0,y:e}}};function KeyboardMoveSelection(e,n,a,c,m){var v=this;this._config=At({},qi,e||{}),n.addListener(Ji,function(e){var a=e.keyEvent,c=Yi[a.key];if(c&&!n.isCmd(a)){var m=n.isShift(a);return v.moveSelection(c,m),!0}}),this.moveSelection=function(e,n){var v=m.get();if(v.length){var T=this._config[n?`moveSpeedAccelerated`:`moveSpeed`],O=Xi[e](T);c.allowed(`elements.move`,{shapes:v,hints:{keyboardMove:!0}})&&a.moveElements(v,O)}}}KeyboardMoveSelection.$inject=[`config.keyboardMoveSelection`,`keyboard`,`modeling`,`rules`,`selection`];var Zi={__depends__:[Pn,qe],__init__:[`keyboardMoveSelection`],keyboardMoveSelection:[`type`,KeyboardMoveSelection]};Tt();var Qi=10;function Resize(e,n,a,c){this._dragging=c,this._rules=n;var m=this;function handleMove(e,n){var a=e.shape,c=e.direction,v=e.resizeConstraints,T;e.delta=n,T=resizeBounds$1(a,c,n),e.newBounds=ensureConstraints$1(T,v),e.canExecute=m.canResize(e)}function handleStart(e){var n=e.resizeConstraints,a=e.minBounds;n===void 0&&(a===void 0&&(a=m.computeMinResizeBox(e)),e.resizeConstraints={min:Ge(a)})}function handleEnd(e){var n=e.shape,c=e.canExecute,m=e.newBounds;if(c){if(m=Ae(m),!boundsChanged(n,m))return;a.resizeShape(n,m)}}e.on(`resize.start`,function(e){handleStart(e.context)}),e.on(`resize.move`,function(e){var n={x:e.dx,y:e.dy};handleMove(e.context,n)}),e.on(`resize.end`,function(e){handleEnd(e.context)})}Resize.prototype.canResize=function(e){var n=this._rules,a=pt(e,[`newBounds`,`shape`,`delta`,`direction`]);return n.allowed(`shape.resize`,a)},Resize.prototype.activate=function(e,n,a){var c=this._dragging,m,v;if(typeof a==`string`&&(a={direction:a}),m=At({shape:n},a),v=m.direction,!v)throw Error(`must provide a direction (n|w|s|e|nw|se|ne|sw)`);c.init(e,getReferencePoint(n,v),`resize`,{autoActivate:!0,cursor:getCursor(v),data:{shape:n,context:m}})},Resize.prototype.computeMinResizeBox=function(e){var n=e.shape,a=e.direction;return getMinResizeBounds(a,n,e.minDimensions||{width:Qi,height:Qi},computeChildrenBBox(n,e.childrenBoxPadding))},Resize.$inject=[`eventBus`,`rules`,`modeling`,`dragging`];function boundsChanged(e,n){return e.x!==n.x||e.y!==n.y||e.width!==n.width||e.height!==n.height}function getReferencePoint(e,n){var a=Ve(e),c=Ge(e),m={x:a.x,y:a.y};return n.indexOf(`n`)===-1?n.indexOf(`s`)!==-1&&(m.y=c.bottom):m.y=c.top,n.indexOf(`e`)===-1?n.indexOf(`w`)!==-1&&(m.x=c.left):m.x=c.right,m}function getCursor(e){var n=`resize-`;return e===`n`||e===`s`?n+`ns`:e===`e`||e===`w`?n+`ew`:e===`nw`||e===`se`?n+`nwse`:n+`nesw`}var $i=`djs-resizing`,ea=`resize-not-ok`,ta=500;function ResizePreview(e,n,a){function updateFrame(e){var c=e.shape,m=e.newBounds,v=e.frame;v||(v=e.frame=a.addFrame(c,n.getActiveLayer()),n.addMarker(c,$i)),m.width>5&&oe(v,{x:m.x,width:m.width}),m.height>5&&oe(v,{y:m.y,height:m.height}),e.canExecute?de(v).remove(ea):de(v).add(ea)}function removeFrame(e){var a=e.shape;e.frame&&ge(e.frame),n.removeMarker(a,$i)}e.on(`resize.move`,ta,function(e){updateFrame(e.context)}),e.on(`resize.cleanup`,function(e){removeFrame(e.context)})}ResizePreview.$inject=[`eventBus`,`canvas`,`previewSupport`],Tt();var na=-6,ra=8,ia=20,aa=`djs-resizer`,oa=[`n`,`w`,`s`,`e`,`nw`,`ne`,`se`,`sw`];function ResizeHandles(e,n,a,c){this._resize=c,this._canvas=n;var m=this;e.on(`selection.changed`,function(e){var n=e.newSelection;m.removeResizers(),n.length===1&&Q(n,Et(m.addResizer,m))}),e.on(`shape.changed`,function(e){var n=e.element;a.isSelected(n)&&(m.removeResizers(),m.addResizer(n))})}ResizeHandles.prototype.makeDraggable=function(e,n,a){var c=this._resize;function startResize(n){Xe(n)&&c.activate(n,e,a)}K.bind(n,`mousedown`,startResize),K.bind(n,`touchstart`,startResize)},ResizeHandles.prototype._createResizer=function(e,n,a,c){var m=this._getResizersParent(),v=getHandleOffset(c),T=he(`g`);de(T).add(aa),de(T).add(aa+`-`+e.id),de(T).add(aa+`-`+c),re(m,T);var O=he(`rect`);oe(O,{x:-ra/2+v.x,y:-ra/2+v.y,rx:2,width:ra,height:ra}),de(O).add(aa+`-visual`),re(T,O);var A=he(`rect`);return oe(A,{x:-ia/2+v.x,y:-ia/2+v.y,width:ia,height:ia}),de(A).add(aa+`-hit`),re(T,A),le(T,n,a),T},ResizeHandles.prototype.createResizer=function(e,n){var a=getReferencePoint(e,n),c=this._createResizer(e,a.x,a.y,n);this.makeDraggable(e,c,n)},ResizeHandles.prototype.addResizer=function(e){var n=this;Ke(e)||Q(oa,function(a){n._resize.canResize({shape:e,direction:a})&&n.createResizer(e,a)})},ResizeHandles.prototype.removeResizers=function(){var e=this._getResizersParent();ot(e)},ResizeHandles.prototype._getResizersParent=function(){return this._canvas.getLayer(`resizers`)},ResizeHandles.$inject=[`eventBus`,`canvas`,`selection`,`resize`];function getHandleOffset(e){var n={x:0,y:0};return e.indexOf(`e`)===-1?e.indexOf(`w`)!==-1&&(n.x=na):n.x=-na,e.indexOf(`s`)===-1?e.indexOf(`n`)!==-1&&(n.y=na):n.y=-na,n}var sa={__depends__:[Tr,Cr,ci],__init__:[`resize`,`resizePreview`,`resizeHandles`],resize:[`type`,Resize],resizePreview:[`type`,ResizePreview],resizeHandles:[`type`,ResizeHandles]};Tt();var ca=500,la=1e3;function Outline(e,n,a){this._eventBus=e,this._elementRegistry=a,this._outlineOffset=5,this._outlineStyle=n.cls(`djs-outline`,[`no-fill`]);var c=this;function createElementOutline(e){Ie(e)||c.createOutline(e)}e.on(`element.hover`,function(e){createElementOutline(e.element)}),e.on(`selection.changed`,function(e){Q(e.newSelection,createElementOutline)}),e.on([`shape.changed`,`connection.changed`],ca,function(e){var n=e.element,a=e.gfx,m=Qe(`.djs-outline`,a);m&&c.updateOutline(n,m)})}Outline.prototype.createOutline=function(e){var n=this._elementRegistry.getGraphics(e);if(!n)throw Error(`cannot create outline for non-rendered element`);var a=Qe(`.djs-outline`,n);return a||(a=this.getOutline(e)||this._createOutlineGfx(),re(n,a),this.updateOutline(e,a)),a},Outline.prototype._createOutlineGfx=function(){var e=he(`rect`);return oe(e,At({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},Outline.prototype.updateOutline=function(e,n){e.waypoints?this.updateConnectionOutline(n,e):this.updateShapeOutline(n,e)},Outline.prototype.updateShapeOutline=function(e,n){var a=!1,c=this._getProviders();c.length&&Q(c,function(c){a||=c.updateOutline(n,e)}),a||oe(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},Outline.prototype.updateConnectionOutline=function(e,n){var a=J(n);oe(e,{x:a.x-this._outlineOffset,y:a.y-this._outlineOffset,width:a.width+this._outlineOffset*2,height:a.height+this._outlineOffset*2})},Outline.prototype.registerProvider=function(e,n){n||(n=e,e=la),this._eventBus.on(`outline.getProviders`,e,function(e){e.providers.push(n)})},Outline.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:`outline.getProviders`,providers:[]});return this._eventBus.fire(e),e.providers},Outline.prototype.getOutline=function(e){var n,a=this._getProviders();return Q(a,function(a){ht(a.getOutline)&&(n||=a.getOutline(e))}),n},Outline.$inject=[`eventBus`,`styles`,`elementRegistry`],Tt();var ua=6;function MultiSelectionOutline(e,n,a){this._canvas=n;var c=this;e.on(`element.changed`,function(e){a.isSelected(e.element)&&c._updateMultiSelectionOutline(a.get())}),e.on(`selection.changed`,function(e){var n=e.newSelection;c._updateMultiSelectionOutline(n)})}MultiSelectionOutline.prototype._updateMultiSelectionOutline=function(e){var n=this._canvas.getLayer(`selectionOutline`);ot(n);var a=e.length>1,c=this._canvas.getContainer();if(de(c)[a?`add`:`remove`](`djs-multi-select`),a){var m=addSelectionOutlinePadding(J(e)),v=he(`rect`);oe(v,At({rx:3},m)),de(v).add(`djs-selection-outline`),re(n,v)}},MultiSelectionOutline.$inject=[`eventBus`,`canvas`,`selection`];function addSelectionOutlinePadding(e){return{x:e.x-ua,y:e.y-ua,width:e.width+ua*2,height:e.height+ua*2}}var da={__depends__:[qe],__init__:[`outline`,`multiSelectionOutline`],outline:[`type`,Outline],multiSelectionOutline:[`type`,MultiSelectionOutline]};Tt();var fa=500,pa=1250,ma=1500,ha=Math.round;function mid(e){return{x:e.x+ha(e.width/2),y:e.y+ha(e.height/2)}}function MoveEvents(e,n,a,c,m){function canMove(e,n,a,c){return m.allowed(`elements.move`,{shapes:e,delta:n,position:a,target:c})}e.on(`shape.move.start`,ma,function(e){var n=e.context,a=e.shape,m=c.get().slice();m.indexOf(a)===-1&&(m=[a]),m=removeNested(m),At(n,{shapes:m,validatedShapes:m,shape:a})}),e.on(`shape.move.start`,pa,function(e){var n=e.context,a=n.validatedShapes;if(!(n.canExecute=canMove(a)))return!1}),e.on(`shape.move.move`,fa,function(e){var n=e.context,a=n.validatedShapes,c=e.hover,m={x:e.dx,y:e.dy},v=canMove(a,m,{x:e.x,y:e.y},c);n.delta=m,n.canExecute=v,n.target=v===null?null:c}),e.on(`shape.move.end`,function(e){var n=e.context,c=n.delta,m=n.canExecute,v=m===`attach`,T=n.shapes;if(m===!1)return!1;c.x=ha(c.x),c.y=ha(c.y),(c.x!==0||c.y!==0)&&a.moveElements(T,c,n.target,{primaryShape:n.shape,attach:v})}),e.on(`element.mousedown`,function(e){if(Xe(e)){var n=Be(e);if(!n)throw Error(`must supply DOM mousedown event`);return start(n,e.element)}});function start(e,a,c,m){if(_t(c)&&(m=c,c=!1),!a.waypoints&&a.parent&&!de(e.target).has(`djs-hit-no-move`)){var v=mid(a);if(n.init(e,v,`shape.move`,{cursor:`grabbing`,autoActivate:c,data:{shape:a,context:m||{}}})!==!1)return!0}}this.start=start}MoveEvents.$inject=[`eventBus`,`dragging`,`modeling`,`selection`,`rules`];function removeNested(e){var n=yt(e,`id`);return Dt(e,function(e){for(;e=e.parent;)if(n[e.id])return!1;return!0})}Tt();var ga=499,_a=`djs-dragging`,va=`drop-ok`,ya=`drop-not-ok`,ba=`new-parent`,xa=`attach-ok`;function MovePreview(e,n,a,c){function getVisualDragShapes(e){return removeEdges(getAllDraggedElements(e))}function getAllDraggedElements(e){var n=q(e),a=n.flatMap(e=>(e.incoming||[]).concat(e.outgoing||[])),c=n.concat(a);return[...new Set(c)]}function setMarker(e,a){[xa,va,ya,ba].forEach(function(c){c===a?n.addMarker(e,c):n.removeMarker(e,c)})}function makeDraggable(e,a,m){c.addDragger(a,e.dragGroup),m&&n.addMarker(a,_a),e.allDraggedElements?e.allDraggedElements.push(a):e.allDraggedElements=[a]}e.on(`shape.move.start`,ga,function(e){var m=e.context,v=m.shapes,T=m.allDraggedElements,O=getVisualDragShapes(v);if(!m.dragGroup){var A=he(`g`);oe(A,a.cls(`djs-drag-group`,[`no-events`]));var I=n.getActiveLayer();re(I,A),m.dragGroup=A}O.forEach(function(e){c.addDragger(e,m.dragGroup)}),T=T?wt([T,getAllDraggedElements(v)]):getAllDraggedElements(v),Q(T,function(e){n.addMarker(e,_a)}),m.allDraggedElements=T,m.differentParents=haveDifferentParents(v)}),e.on(`shape.move.move`,ga,function(e){var n=e.context,a=n.dragGroup,c=n.target,m=n.shape.parent,v=n.canExecute;c&&(v===`attach`?setMarker(c,xa):n.canExecute&&m&&c.id!==m.id?setMarker(c,ba):setMarker(c,n.canExecute?va:ya)),G(a,e.dx,e.dy)}),e.on([`shape.move.out`,`shape.move.cleanup`],function(e){var n=e.context.target;n&&setMarker(n,null)}),e.on(`shape.move.cleanup`,function(e){var a=e.context,c=a.allDraggedElements,m=a.dragGroup;Q(c,function(e){n.removeMarker(e,_a)}),m&&ge(m)}),this.makeDraggable=makeDraggable}MovePreview.$inject=[`eventBus`,`canvas`,`styles`,`previewSupport`];function removeEdges(e){var n=new Set;return e.forEach(function(e){n.add(e.id)}),Dt(e,function(e){return!Ke(e)||n.has(e.source.id)&&n.has(e.target.id)})}function haveDifferentParents(e){return St(yt(e,function(e){return e.parent&&e.parent.id}))!==1}var Sa={__depends__:[Le,qe,da,Tr,Cr,ci],__init__:[`move`,`movePreview`],move:[`type`,MoveEvents],movePreview:[`type`,MovePreview]},Ca=300;function HoverTooltip(e){this._canvas=e,this._mount=null,this._current=null,this._showTimer=null}HoverTooltip.$inject=[`canvas`],HoverTooltip.prototype.add=function(e){let{container:n,selector:a,showDelay:c=Ca}=e;ue.bind(n,a,`mouseover`,n=>this._show(n.delegateTarget,e,c)),ue.bind(n,a,`mouseout`,e=>{let{delegateTarget:n,relatedTarget:a}=e;a&&n.contains(a)||this._hide()})},HoverTooltip.prototype._show=function(e,n,a){let c=n.getContent(e);c&&(this._current={target:e,content:c,getPosition:n.getPosition},clearTimeout(this._showTimer),this._showTimer=setTimeout(()=>this._render(),a))},HoverTooltip.prototype._hide=function(){clearTimeout(this._showTimer),this._current=null,this._render()},HoverTooltip.prototype._render=function(){let e=this._getMount();if(!this._current){T(null,e);return}let{target:n,content:a,getPosition:c}=this._current,{x:m,y:v,placement:O=`right`}=c(n),A={left:`${m}px`,top:`${v}px`};T(ar`<div
326
- class="djs-hover-tooltip djs-hover-tooltip--${O}"
327
- style=${A}
328
- >${a}</div>`,e)},HoverTooltip.prototype._getMount=function(){return this._mount||(this._mount=Je(`<div class="djs-hover-tooltip-container"></div>`),this._canvas.getContainer().appendChild(this._mount)),this._mount};var wa={__init__:[`hoverTooltip`],hoverTooltip:[`type`,HoverTooltip]};Tt();var Ta=`.djs-palette-toggle`,Ea=`.entry`,Da=Ta+`, `+Ea,Oa=`djs-palette-`,ka=`shown`,Aa=`open`,ja=`two-column`,Ma=1e3;function Palette(e,n){this._eventBus=e,this._canvas=n;var a=this;e.on(`tool-manager.update`,function(e){var n=e.tool;a.updateToolHighlight(n)}),e.on(`i18n.changed`,function(){a._update()}),e.on(`diagram.init`,function(){a._diagramInitialized=!0,a._rebuild()})}Palette.$inject=[`eventBus`,`canvas`],Palette.prototype.registerProvider=function(e,n){n||(n=e,e=Ma),this._eventBus.on(`palette.getProviders`,e,function(e){e.providers.push(n)}),this._rebuild()},Palette.prototype.getEntries=function(){return this._getProviders().reduce(addPaletteEntries,{})},Palette.prototype._rebuild=function(){this._diagramInitialized&&this._getProviders().length&&(this._container||this._init(),this._update())},Palette.prototype._init=function(){var e=this,n=this._eventBus,a=this._getParentContainer(),c=this._container=Je(Palette.HTML_MARKUP);a.appendChild(c),ve(a).add(Oa+ka),ue.bind(c,Da,`click`,function(n){var a=n.delegateTarget;if(je(a,Ta))return e.toggle();e.trigger(`click`,n)}),K.bind(c,`mousedown`,function(e){e.stopPropagation()}),ue.bind(c,Ea,`dragstart`,function(n){e.trigger(`dragstart`,n)}),n.on(`canvas.resized`,this._layoutChanged,this),n.fire(`palette.create`,{container:c})},Palette.prototype._getProviders=function(e){var n=this._eventBus.createEvent({type:`palette.getProviders`,providers:[]});return this._eventBus.fire(n),n.providers},Palette.prototype._toggleState=function(e){e||={};var n=this._getParentContainer(),a=this._container,c=this._eventBus,m,v=ve(a),T=ve(n);m=`twoColumn`in e?e.twoColumn:this._needsCollapse(n.clientHeight,this._entries||{}),v.toggle(ja,m),T.toggle(Oa+ja,m),`open`in e&&(v.toggle(Aa,e.open),T.toggle(Oa+Aa,e.open)),c.fire(`palette.changed`,{twoColumn:m,open:this.isOpen()})},Palette.prototype._update=function(){var e=Qe(`.djs-palette-entries`,this._container),n=this._entries=this.getEntries();_e(e),Q(n,function(n,a){var c=n.group||`default`,m=Qe(`[data-group=`+Pe(c)+`]`,e);m||(m=Je(`<div class="group"></div>`),ie(m,`data-group`,c),e.appendChild(m));var v=n.html||(n.separator?`<hr class="separator" />`:`<div class="entry" draggable="true"></div>`),T=Je(v);if(m.appendChild(T),!n.separator&&(ie(T,`data-action`,a),n.title&&(ie(T,`aria-label`,n.title),ie(T,`role`,`button`)),n.className&&addClasses(T,n.className),n.imageUrl)){var O=Je(`<img>`);ie(O,`src`,n.imageUrl),T.appendChild(O)}}),this.open()},Palette.prototype.trigger=function(e,n,a){var c,m,v=n.delegateTarget||n.target;return v?(c=ie(v,`data-action`),m=n.originalEvent||n,this.triggerEntry(c,e,m,a)):n.preventDefault()},Palette.prototype.triggerEntry=function(e,n,a,c){var m=this._entries[e],v;if(m&&(v=m.action,this._eventBus.fire(`palette.trigger`,{entry:m,event:a})!==!1)){if(ht(v)){if(n===`click`)return v(a,c)}else if(v[n])return v[n](a,c);a.preventDefault()}},Palette.prototype._layoutChanged=function(){this._toggleState({})},Palette.prototype._needsCollapse=function(e,n){return e<Object.keys(n).length*46+50},Palette.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Palette.prototype.open=function(){this._toggleState({open:!0})},Palette.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Palette.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Palette.prototype.updateToolHighlight=function(e){var n,a;this._toolsContainer||=(n=Qe(`.djs-palette-entries`,this._container),Qe(`[data-group=tools]`,n)),a=this._toolsContainer,Q(a.children,function(n){var a=n.getAttribute(`data-action`);if(a){var c=ve(n);a=a.replace(`-tool`,``),c.contains(`entry`)&&a===e?c.add(`highlighted-entry`):c.remove(`highlighted-entry`)}})},Palette.prototype.isOpen=function(){return ve(this._container).has(Aa)},Palette.prototype._getParentContainer=function(){return this._canvas.getContainer()},Palette.HTML_MARKUP=`<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>`;function addClasses(e,n){var a=ve(e);(xt(n)?n:n.split(/\s+/g)).forEach(function(e){a.add(e)})}function addPaletteEntries(e,n){var a=n.getPaletteEntries();return ht(a)?a(e):(Q(a,function(n,a){e[a]=n}),e)}function PaletteTooltipComponent(e){let{title:n,shortcut:a}=e;return ar`
329
- <span class="djs-palette-tooltip-label">${n}</span>
330
- ${a?ar`<kbd class="djs-palette-tooltip-shortcut">${a}</kbd>`:null}
331
- `}var Na=`.djs-palette-entries .entry`,Pa=8;function PaletteTooltip(e,n,a){this._palette=n,this._hoverTooltip=a,this._entries={},e.on(`palette.create`,e=>this._init(e.container)),e.on(`palette.changed`,()=>this._updateEntries())}PaletteTooltip.$inject=[`eventBus`,`palette`,`hoverTooltip`],PaletteTooltip.prototype._init=function(e){this._updateEntries(),this._hoverTooltip.add({container:e,selector:Na,getContent:e=>{let n=this._entries[ie(e,`data-action`)];return!n||!n.title?null:ar`<${PaletteTooltipComponent}
332
- title=${n.title}
333
- shortcut=${n.shortcut}
334
- />`},getPosition:e=>{let n=e.getBoundingClientRect();return{x:n.right+Pa,y:n.top+n.height/2,placement:`right`}}})},PaletteTooltip.prototype._updateEntries=function(){this._entries=this._palette.getEntries()};var Fa={__depends__:[wa],__init__:[`palette`,`paletteTooltip`],palette:[`type`,Palette],paletteTooltip:[`type`,PaletteTooltip]};Tt();var Ia=`crosshair`,La=`selected`,Ra=`djs-dragging-active-lasso`;function LassoTool(e,n,a,c,m,v,T){this._selection=m,this._dragging=a,this._mouse=T;var O=this,A={create:function(e){var a=n.getActiveLayer(),c=e.frame=he(`rect`);oe(c,{class:`djs-lasso-overlay`,width:1,height:1,x:0,y:0}),re(a,c),toggleLassoMarkerClass(!0),this.update(e)},update:function(e){var a=e.frame,c=e.bbox;a&&c&&oe(a,{x:c.x,y:c.y,width:c.width,height:c.height});var m=e.marked,v=e.lastMarked;if(m&&v){for(let e of v)m.has(e)||n.removeMarker(e,La);for(let e of m)v.has(e)||n.addMarker(e,La)}},remove:function(e){this.update(e),e.frame&&ge(e.frame),toggleLassoMarkerClass(!1)}};function toggleLassoMarkerClass(e){de(n.getContainer()).toggle(Ra,e)}function getAllEnclosedElements(e){var n=c.getAll();return new Set(ut(ce(n,e)))}v.registerTool(`lasso`,{tool:`lasso.selection`,dragging:`lasso`}),e.on(`lasso.selection.end`,function(n){var a=n.originalEvent.target;(n.hover||a instanceof SVGElement)&&e.once(`lasso.selection.ended`,function(){O.activateLasso(n.originalEvent,!0)})}),e.on(`lasso.end`,0,function(e){var n=e.context;O._select(Array.from(n.marked))}),e.on(`lasso.start`,function(e){var n=e.context;n.bbox=toBBox(e),n.add=We(e),n.lastMarked=new Set(m.get()),n.marked=n.add?n.lastMarked:new Set,n.initialMarked=n.marked,A.create(n)}),e.on(`lasso.move`,function(e){var n=e.context,a=getAllEnclosedElements(n.bbox=toBBox(e)),c=n.initialMarked.union(a);n.lastMarked=n.marked,n.marked=c,A.update(n)}),e.on(`lasso.cleanup`,function(e){var n=e.context;n.lastMarked=n.marked,n.marked=new Set(m.get()),A.remove(e.context)}),e.on(`element.mousedown`,1500,function(e){if(We(e))return O.activateLasso(e.originalEvent),!0})}LassoTool.$inject=[`eventBus`,`canvas`,`dragging`,`elementRegistry`,`selection`,`toolManager`,`mouse`],LassoTool.prototype.activateLasso=function(e,n){this._dragging.init(e,`lasso`,{autoActivate:n,cursor:Ia,data:{context:{}},keepSelection:!0})},LassoTool.prototype.activateSelection=function(e,n){this._dragging.init(e,`lasso.selection`,{trapClick:!1,autoActivate:n,cursor:Ia,data:{context:{}},keepSelection:!0})},LassoTool.prototype._select=function(e){this._selection.select(e)},LassoTool.prototype.select=function(e,n,a=[]){var c=ut(ce(e,n));this._select([...a,...c])},LassoTool.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},LassoTool.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function toBBox(e){var n={x:e.x-e.dx,y:e.y-e.dy},a={x:e.x,y:e.y};return n.x<=a.x&&n.y<a.y||n.x<a.x&&n.y<=a.y?{x:n.x,y:n.y,width:a.x-n.x,height:a.y-n.y}:n.x>=a.x&&n.y<a.y||n.x>a.x&&n.y<=a.y?{x:a.x,y:n.y,width:n.x-a.x,height:a.y-n.y}:n.x<=a.x&&n.y>a.y||n.x<a.x&&n.y>=a.y?{x:n.x,y:a.y,width:a.x-n.x,height:n.y-a.y}:n.x>=a.x&&n.y>a.y||n.x>a.x&&n.y>=a.y?{x:a.x,y:a.y,width:n.x-a.x,height:n.y-a.y}:{x:a.x,y:a.y,width:0,height:0}}var za={__depends__:[Ei,xi],__init__:[`lassoTool`],lassoTool:[`type`,LassoTool]},Ba=1500,Va=`grab`;function HandTool(e,n,a,c,m,v){this._dragging=a,this._mouse=v;var T=this,O=c.get(`keyboard`,!1);m.registerTool(`hand`,{tool:`hand`,dragging:`hand.move`}),e.on(`element.mousedown`,Ba,function(e){if(Ce(e))return T.activateMove(e.originalEvent,!0),!1}),O&&O.addListener(Ba,function(e){if(isSpace(e.keyEvent)&&!T.isActive()){var n=T._mouse.getLastMoveEvent();T.activateMove(n,!!n)}},`keyboard.keydown`),O&&O.addListener(Ba,function(e){isSpace(e.keyEvent)&&T.isActive()&&T.toggle()},`keyboard.keyup`),e.on(`hand.end`,function(n){var a=n.originalEvent.target;if(!n.hover&&!(a instanceof SVGElement))return!1;e.once(`hand.ended`,function(){T.activateMove(n.originalEvent,{reactivate:!0})})}),e.on(`hand.move.move`,function(e){var a=n.viewbox().scale;n.scroll({dx:e.dx*a,dy:e.dy*a})}),e.on(`hand.move.end`,function(n){var a=n.context.reactivate;return!Ce(n)&&a&&e.once(`hand.move.ended`,function(e){T.activateHand(e.originalEvent,!0,!0)}),!1})}HandTool.$inject=[`eventBus`,`canvas`,`dragging`,`injector`,`toolManager`,`mouse`],HandTool.prototype.activateMove=function(e,n,a){typeof n==`object`&&(a=n,n=!1),this._dragging.init(e,`hand.move`,{autoActivate:n,cursor:Va,data:{context:a||{}}})},HandTool.prototype.activateHand=function(e,n,a){this._dragging.init(e,`hand`,{trapClick:!1,autoActivate:n,cursor:Va,data:{context:{reactivate:a}}})},HandTool.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},HandTool.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function isSpace(e){return isKey(`Space`,e)}var Ha={__depends__:[Ei,xi],__init__:[`handTool`],handTool:[`type`,HandTool]};Tt();function SnapContext(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}SnapContext.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},SnapContext.prototype.setSnapOrigin=function(e,n){this._snapOrigins[e]=n,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},SnapContext.prototype.addDefaultSnap=function(e,n){var a=this._defaultSnaps[e];a||=this._defaultSnaps[e]=[],a.push(n)},SnapContext.prototype.getSnapLocations=function(){return this._snapLocations},SnapContext.prototype.setSnapLocations=function(e){this._snapLocations=e},SnapContext.prototype.pointsForTarget=function(e){var n=e.id||e,a=this._targets[n];return a||(a=this._targets[n]=new SnapPoints,a.initDefaults(this._defaultSnaps)),a};function SnapPoints(){this._snapValues={}}SnapPoints.prototype.add=function(e,n){var a=this._snapValues[e];a||=this._snapValues[e]={x:[],y:[]},a.x.indexOf(n.x)===-1&&a.x.push(n.x),a.y.indexOf(n.y)===-1&&a.y.push(n.y)},SnapPoints.prototype.snap=function(e,n,a,c){var m=this._snapValues[n];return m&&snapTo(e[a],m[a],c)},SnapPoints.prototype.initDefaults=function(e){var n=this;Q(e||{},function(e,a){Q(e,function(e){n.add(a,e)})})},Tt();var Ua=1250;function CreateMoveSnapping(e,n,a){var c=this;this._elementRegistry=e,n.on([`create.start`,`shape.move.start`],function(e){c.initSnap(e)}),n.on([`create.move`,`create.end`,`shape.move.move`,`shape.move.end`],Ua,function(e){var n=e.context,m=n.shape,v=n.snapContext,T=n.target;if(!(e.originalEvent&&isCmd$1(e.originalEvent))&&!isSnapped(e)&&T){var O=v.pointsForTarget(T);O.initialized||(O=c.addSnapTargetPoints(O,m,T),O.initialized=!0),a.snap(e,O)}}),n.on([`create.cleanup`,`shape.move.cleanup`],function(){a.hide()})}CreateMoveSnapping.$inject=[`elementRegistry`,`eventBus`,`snapping`],CreateMoveSnapping.prototype.initSnap=function(e){var n=this._elementRegistry,a=e.context,c=a.shape,m=a.snapContext;m||=a.snapContext=new SnapContext;var v=n.get(c.id)?mid$1(c,e):{x:e.x+mid$1(c).x,y:e.y+mid$1(c).y},T={x:v.x-c.width/2,y:v.y-c.height/2},O={x:v.x+c.width/2,y:v.y+c.height/2};return m.setSnapOrigin(`mid`,{x:v.x-e.x,y:v.y-e.y}),He(c)||(m.setSnapOrigin(`top-left`,{x:T.x-e.x,y:T.y-e.y}),m.setSnapOrigin(`bottom-right`,{x:O.x-e.x,y:O.y-e.y})),m},CreateMoveSnapping.prototype.addSnapTargetPoints=function(e,n,a){var c=this.getSnapTargets(n,a);return Q(c,function(a){if(He(a))He(n)&&e.add(`mid`,mid$1(a));else if(Ke(a)){if(a.waypoints.length<3)return;var c=a.waypoints.slice(1,-1);Q(c,function(n){e.add(`mid`,n)})}else e.add(`mid`,mid$1(a))}),!Pt(n.x)||!Pt(n.y)||this._elementRegistry.get(n.id)&&e.add(`mid`,mid$1(n)),e},CreateMoveSnapping.prototype.getSnapTargets=function(e,n){return getChildren(n).filter(function(e){return!isHidden$1(e)})};function isHidden$1(e){return!!e.hidden}e(isHidden$1,`isHidden`),Tt();var Wa=1250;function ResizeSnapping(e,n){var a=this;e.on([`resize.start`],function(e){a.initSnap(e)}),e.on([`resize.move`,`resize.end`],Wa,function(e){var c=e.context,m=c.shape,v=m.parent,T=c.direction,O=c.snapContext;if(!(e.originalEvent&&isCmd$1(e.originalEvent))&&!isSnapped(e)){var A=O.pointsForTarget(v);A.initialized||(A=a.addSnapTargetPoints(A,m,v,T),A.initialized=!0),isHorizontal(T)&&setSnapped(e,`x`,e.x),isVertical(T)&&setSnapped(e,`y`,e.y),n.snap(e,A)}}),e.on([`resize.cleanup`],function(){n.hide()})}ResizeSnapping.prototype.initSnap=function(e){var n=e.context,a=n.shape,c=n.direction,m=n.snapContext;m||=n.snapContext=new SnapContext;var v=getSnapOrigin(a,c);return m.setSnapOrigin(`corner`,{x:v.x-e.x,y:v.y-e.y}),m},ResizeSnapping.prototype.addSnapTargetPoints=function(e,n,a,c){var m=this.getSnapTargets(n,a);return Q(m,function(n){e.add(`corner`,bottomRight(n)),e.add(`corner`,topLeft(n))}),e.add(`corner`,getSnapOrigin(n,c)),e},ResizeSnapping.$inject=[`eventBus`,`snapping`],ResizeSnapping.prototype.getSnapTargets=function(e,n){return getChildren(n).filter(function(n){return!isAttached(n,e)&&!Ke(n)&&!isHidden(n)&&!He(n)})};function getSnapOrigin(e,n){var a=Ve(e),c=Ge(e),m={x:a.x,y:a.y};return n.indexOf(`n`)===-1?n.indexOf(`s`)!==-1&&(m.y=c.bottom):m.y=c.top,n.indexOf(`e`)===-1?n.indexOf(`w`)!==-1&&(m.x=c.left):m.x=c.right,m}function isAttached(e,n){return e.host===n}function isHidden(e){return!!e.hidden}function isHorizontal(e){return e===`n`||e===`s`}function isVertical(e){return e===`e`||e===`w`}Tt();var Ga=7,Ka=1e3;function Snapping(e){this._canvas=e,this._asyncHide=Ot(Et(this.hide,this),Ka)}Snapping.$inject=[`canvas`],Snapping.prototype.snap=function(e,n){var a=e.context.snapContext,c=a.getSnapLocations(),m={x:isSnapped(e,`x`),y:isSnapped(e,`y`)};Q(c,function(c){var v=a.getSnapOrigin(c),T={x:e.x+v.x,y:e.y+v.y};if(Q([`x`,`y`],function(e){var a;m[e]||(a=n.snap(T,c,e,Ga),a!==void 0&&(m[e]={value:a,originValue:a-v[e]}))}),m.x&&m.y)return!1}),this.showSnapLine(`vertical`,m.x&&m.x.value),this.showSnapLine(`horizontal`,m.y&&m.y.value),Q([`x`,`y`],function(n){var a=m[n];_t(a)&&setSnapped(e,n,a.originValue)})},Snapping.prototype._createLine=function(e){var n=this._canvas.getLayer(`snap`),a=he(`path`);return oe(a,{d:`M0,0 L0,0`}),de(a).add(`djs-snap-line`),re(n,a),{update:function(n){Pt(n)?e===`horizontal`?oe(a,{d:`M-100000,`+n+` L+100000,`+n,display:``}):oe(a,{d:`M `+n+`,-100000 L `+n+`, +100000`,display:``}):oe(a,{display:`none`})}}},Snapping.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine(`horizontal`),vertical:this._createLine(`vertical`)}},Snapping.prototype.showSnapLine=function(e,n){var a=this.getSnapLine(e);a&&a.update(n),this._asyncHide()},Snapping.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Snapping.prototype.hide=function(){Q(this._snapLines,function(e){e.update()})};var qa={__init__:[`createMoveSnapping`,`resizeSnapping`,`snapping`],createMoveSnapping:[`type`,CreateMoveSnapping],resizeSnapping:[`type`,ResizeSnapping],snapping:[`type`,Snapping]},Ja=300;function SearchPad(e,n,a,c){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=n,this._selection=a,this._translate=c,this._container=this._getBoxHtml(),this._searchInput=Qe(SearchPad.INPUT_SELECTOR,this._container),this._resultsContainer=Qe(SearchPad.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),n.on([`canvas.destroy`,`diagram.destroy`,`drag.init`,`elements.changed`],this.close,this)}SearchPad.$inject=[`canvas`,`eventBus`,`selection`,`translate`],SearchPad.prototype._bindEvents=function(){var e=this;function listen(n,a,c,m){e._eventMaps.push({el:n,type:c,listener:ue.bind(n,a,c,m)})}listen(document,`html`,`click`,function(n){e.close(!1)}),listen(this._container,SearchPad.INPUT_SELECTOR,`click`,function(e){e.stopPropagation(),e.delegateTarget.focus()}),listen(this._container,SearchPad.RESULT_SELECTOR,`mouseover`,function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),listen(this._container,SearchPad.RESULT_SELECTOR,`click`,function(n){n.stopPropagation(),e._select(n.delegateTarget)}),listen(this._container,SearchPad.INPUT_SELECTOR,`keydown`,function(e){isKey(`ArrowUp`,e)&&e.preventDefault(),isKey(`ArrowDown`,e)&&e.preventDefault()}),listen(this._container,SearchPad.INPUT_SELECTOR,`keyup`,function(n){if(isKey(`Escape`,n))return e.close();if(isKey(`Enter`,n)){var a=e._getCurrentResult();return a?e._select(a):e.close(!1)}if(isKey(`ArrowUp`,n))return e._scrollToDirection(!0);if(isKey(`ArrowDown`,n))return e._scrollToDirection();isKey([`ArrowLeft`,`ArrowRight`],n)||e._search(n.delegateTarget.value)})},SearchPad.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){ue.unbind(e.el,e.type,e.listener)})},SearchPad.prototype._search=function(e){var n=this;if(this._clearResults(),e.trim()){var a=this._searchProvider.find(e);if(a=a.filter(function(e){return!n._canvas.getRootElements().includes(e.element)}),!a.length)this._selection.select(null);else{a.forEach(function(e){var a=e.element.id,c=n._createResultNode(e,a);n._results[a]={element:e.element,node:c}});var c=Qe(SearchPad.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(c),this._preselect(c)}}},SearchPad.prototype._scrollToDirection=function(e){var n=this._getCurrentResult();if(n){var a=e?n.previousElementSibling:n.nextElementSibling;a&&(this._scrollToNode(a),this._preselect(a))}},SearchPad.prototype._scrollToNode=function(e){if(e&&e!==this._getCurrentResult()){var n=e.offsetTop,a=this._resultsContainer.scrollTop,c=n-this._resultsContainer.clientHeight+e.clientHeight;n<a?this._resultsContainer.scrollTop=n:a<c&&(this._resultsContainer.scrollTop=c)}},SearchPad.prototype._clearResults=function(){_e(this._resultsContainer),this._results={},this._eventBus.fire(`searchPad.cleared`)},SearchPad.prototype._getCurrentResult=function(){return Qe(SearchPad.RESULT_SELECTED_SELECTOR,this._resultsContainer)},SearchPad.prototype._createResultNode=function(e,n){var a=Je(SearchPad.RESULT_HTML);return e.primaryTokens.length>0&&createInnerTextNode(a,e.primaryTokens,SearchPad.RESULT_PRIMARY_HTML),createInnerTextNode(a,e.secondaryTokens,SearchPad.RESULT_SECONDARY_HTML),ie(a,SearchPad.RESULT_ID_ATTRIBUTE,n),this._resultsContainer.appendChild(a),a},SearchPad.prototype.registerProvider=function(e){this._searchProvider=e},SearchPad.prototype.open=function(){if(!this._searchProvider)throw Error(`no search provider registered`);this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,ve(this._canvas.getContainer()).add(`djs-search-open`),ve(this._container).add(`open`),this._searchInput.focus(),this._eventBus.fire(`searchPad.opened`))},SearchPad.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire(`searchPad.restored`)),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,ve(this._canvas.getContainer()).remove(`djs-search-open`),ve(this._container).remove(`open`),this._clearResults(),this._searchInput.value=``,this._searchInput.blur(),this._eventBus.fire(`searchPad.closed`),this._canvas.restoreFocus())},SearchPad.prototype.toggle=function(){this.isOpen()?this.close():this.open()},SearchPad.prototype.isOpen=function(){return this._open},SearchPad.prototype._preselect=function(e){var n=this._getCurrentResult();if(e!==n){n&&ve(n).remove(SearchPad.RESULT_SELECTED_CLASS);var a=ie(e,SearchPad.RESULT_ID_ATTRIBUTE),c=this._results[a].element;ve(e).add(SearchPad.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(c,{top:Ja}),this._selection.select(c),this._eventBus.fire(`searchPad.preselected`,c)}},SearchPad.prototype._select=function(e){var n=ie(e,SearchPad.RESULT_ID_ATTRIBUTE),a=this._results[n].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(a,{top:Ja}),this._selection.select(a),this._eventBus.fire(`searchPad.selected`,a)},SearchPad.prototype._getBoxHtml=function(){let e=Je(SearchPad.BOX_HTML),n=Qe(SearchPad.INPUT_SELECTOR,e);return n&&n.setAttribute(`aria-label`,this._translate(`Search in diagram`)),e};function createInnerTextNode(e,n,a){var c=createHtmlText(n),m=Je(a);m.innerHTML=c,e.appendChild(m)}function createHtmlText(e){var n=``;return e.forEach(function(e){var a=xe(e.value||e.matched||e.normal);e.match||e.matched?n+=`<b class="`+SearchPad.RESULT_HIGHLIGHT_CLASS+`">`+a+`</b>`:n+=a}),n===``?null:n}SearchPad.CONTAINER_SELECTOR=`.djs-search-container`,SearchPad.INPUT_SELECTOR=`.djs-search-input input`,SearchPad.RESULTS_CONTAINER_SELECTOR=`.djs-search-results`,SearchPad.RESULT_SELECTOR=`.djs-search-result`,SearchPad.RESULT_SELECTED_CLASS=`djs-search-result-selected`,SearchPad.RESULT_SELECTED_SELECTOR=`.`+SearchPad.RESULT_SELECTED_CLASS,SearchPad.RESULT_ID_ATTRIBUTE=`data-result-id`,SearchPad.RESULT_HIGHLIGHT_CLASS=`djs-search-highlight`,SearchPad.BOX_HTML=`<div class="djs-search-container djs-scrollable">
335
- <div class="djs-search-input">
336
- <svg class="djs-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
337
- <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
338
- </svg>
339
- <input type="text" spellcheck="false" />
340
- </div>
341
- <div class="djs-search-results" />
342
- </div>`,SearchPad.RESULT_HTML=`<div class="djs-search-result"></div>`,SearchPad.RESULT_PRIMARY_HTML=`<div class="djs-search-result-primary"></div>`,SearchPad.RESULT_SECONDARY_HTML=`<p class="djs-search-result-secondary"></p>`;var Ya={__depends__:[fe,Te,qe],searchPad:[`type`,SearchPad]},Xa=`#ccc`,Za=`djs-grid`,Qa={width:1e5,height:1e5};function Grid(e,n){this._canvas=e;var a=this;n.on(`diagram.init`,function(){a._init(),a.toggle(!0)}),n.on(`gridSnapping.toggle`,function(e){var n=e.active;a.toggle(n),a._centerGridAroundViewbox()}),n.on(`canvas.viewbox.changed`,function(e){var n=e.viewbox;a._centerGridAroundViewbox(n)})}Grid.prototype._init=function(){var e=Qe(`defs`,this._canvas._svg);e||(e=he(`defs`),re(this._canvas._svg,e));var n=this._pattern=he(`pattern`),a=`djs-grid-pattern-`+randomNumber();oe(n,{id:a,width:10,height:10,patternUnits:`userSpaceOnUse`});var c=this._circle=he(`circle`);oe(c,{cx:.5,cy:.5,r:.5,fill:Xa}),re(n,c),re(e,n);var m=this._gfx=he(`rect`);oe(m,{x:-5e4,y:-5e4,width:Qa.width,height:Qa.height,fill:`url(#${a})`})},Grid.prototype._centerGridAroundViewbox=function(e){e||=this._canvas.viewbox();var n=Ve(e);oe(this._gfx,{x:-5e4+quantize(n.x,10),y:-5e4+quantize(n.y,10)})},Grid.prototype.isVisible=function(){return this._visible},Grid.prototype.toggle=function(e){if(e===void 0&&(e=!this._visible),e!==this._visible){var n=this._getParent();e?re(n,this._gfx):ot(n),this._visible=e}},Grid.prototype._getParent=function(){return this._canvas.getLayer(Za,-2)},Grid.$inject=[`canvas`,`eventBus`];function randomNumber(){return Math.trunc(Math.random()*1e6)}var $a={__init__:[`grid`],grid:[`type`,Grid]},eo,to,no,ro,io,ao,oo,so,co,lo,uo,fo,po,mo,ho,go={},_o=[],vo=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,yo=Array.isArray;function m$1(e,n){for(var a in n)e[a]=n[a];return e}e(m$1,`m`);function b(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function k$2(e,n,a){var c,m,v,T={};for(v in n)v==`key`?c=n[v]:v==`ref`?m=n[v]:T[v]=n[v];if(arguments.length>2&&(T.children=arguments.length>3?eo.call(arguments,2):a),typeof e==`function`&&e.defaultProps!=null)for(v in e.defaultProps)T[v]===void 0&&(T[v]=e.defaultProps[v]);return x$2(e,T,c,m,null)}e(k$2,`k`);function x$2(e,n,a,c,m){var v={type:e,props:n,key:a,ref:c,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:m??++no,__i:-1,__u:0};return m==null&&to.vnode!=null&&to.vnode(v),v}e(x$2,`x`);function M$1(){return{current:null}}e(M$1,`M`);function S(e){return e.children}function C$2(e,n){this.props=e,this.context=n}e(C$2,`C`);function $$1(e,n){if(n==null)return e.__?$$1(e.__,e.__i+1):null;for(var a;n<e.__k.length;n++)if((a=e.__k[n])!=null&&a.__e!=null)return a.__e;return typeof e.type==`function`?$$1(e):null}e($$1,`$`);function I$1(e){if(e.__P&&e.__d){var n=e.__v,a=n.__e,c=[],m=[],v=m$1({},n);v.__v=n.__v+1,to.vnode&&to.vnode(v),q$2(e.__P,v,n,e.__n,e.__P.namespaceURI,32&n.__u?[a]:null,c,a??$$1(n),!!(32&n.__u),m),v.__v=n.__v,v.__.__k[v.__i]=v,D$2(c,v,m),n.__e=n.__=null,v.__e!=a&&P$2(v)}}e(I$1,`I`);function P$2(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(n){if(n!=null&&n.__e!=null)return e.__e=e.__c.base=n.__e}),P$2(e)}e(P$2,`P`);function A$2(e){(!e.__d&&(e.__d=!0)&&ro.push(e)&&!H$1.__r++||io!=to.debounceRendering)&&((io=to.debounceRendering)||ao)(H$1)}e(A$2,`A`);function H$1(){try{for(var e,n=1;ro.length;)ro.length>n&&ro.sort(oo),e=ro.shift(),n=ro.length,I$1(e)}finally{ro.length=H$1.__r=0}}e(H$1,`H`);function L$1(e,n,a,c,m,v,T,O,A,I,L){var U,G,K,q,ee,te,ne=c&&c.__k||_o,J=n.length;for(A=T$2(a,n,ne,A,J),U=0;U<J;U++)(K=a.__k[U])!=null&&(G=K.__i!=-1&&ne[K.__i]||go,K.__i=U,te=q$2(e,K,G,m,v,T,O,A,I,L),q=K.__e,K.ref&&G.ref!=K.ref&&(G.ref&&J$1(G.ref,null,K),L.push(K.ref,K.__c||q,K)),ee==null&&q!=null&&(ee=q),4&K.__u?(A=j$2(K,A,e),G.__e&&(G.__e=null)):typeof K.type==`function`&&te!==void 0?A=te:q&&(A=q.nextSibling),K.__u&=-7);return a.__e=ee,A}e(L$1,`L`);function T$2(e,n,a,c,m){var v,T,O,A,I,L=a.length,U=L,G=0;for(e.__k=Array(m),v=0;v<m;v++)(T=n[v])!=null&&typeof T!=`boolean`&&typeof T!=`function`?(typeof T==`string`||typeof T==`number`||typeof T==`bigint`||T.constructor==String?T=e.__k[v]=x$2(null,T,null,null,null):yo(T)?T=e.__k[v]=x$2(S,{children:T},null,null,null):T.constructor===void 0&&T.__b>0?T=e.__k[v]=x$2(T.type,T.props,T.key,T.ref?T.ref:null,T.__v):e.__k[v]=T,A=v+G,T.__=e,T.__b=e.__b+1,O=null,(I=T.__i=O$1(T,a,A,U))!=-1&&(U--,(O=a[I])&&(O.__u|=2)),O==null||O.__v==null?(I==-1&&(m>L?G--:m<L&&G++),typeof T.type!=`function`&&(T.__u|=4)):I!=A&&(I==A-1?G--:I==A+1?G++:(I>A?G--:G++,T.__u|=4))):e.__k[v]=null;if(U)for(v=0;v<L;v++)(O=a[v])!=null&&!(2&O.__u)&&(O.__e==c&&(c=$$1(O)),K$1(O,O));return c}e(T$2,`T`);function j$2(e,n,a){var c,m;if(typeof e.type==`function`){for(c=e.__k,m=0;c&&m<c.length;m++)c[m]&&(c[m].__=e,n=j$2(c[m],n,a));return n}e.__e!=n&&(n&&e.type&&!n.parentNode&&(n=$$1(e)),n=a.insertBefore(e.__e,n||null));do n&&=n.nextSibling;while(n!=null&&n.nodeType==8);return n}e(j$2,`j`);function F$2(e,n){return n||=[],e==null||typeof e==`boolean`||(yo(e)?e.some(function(e){F$2(e,n)}):n.push(e)),n}e(F$2,`F`);function O$1(e,n,a,c){var m,v,T,O=e.key,A=e.type,I=n[a],L=I!=null&&!(2&I.__u);if(I===null&&O==null||L&&O==I.key&&A==I.type)return a;if(c>+!!L){for(m=a-1,v=a+1;m>=0||v<n.length;)if((I=n[T=m>=0?m--:v++])!=null&&!(2&I.__u)&&O==I.key&&A==I.type)return T}return-1}e(O$1,`O`);function z$2(e,n,a){n[0]==`-`?e.setProperty(n,a??``):e[n]=a==null?``:typeof a!=`number`||vo.test(n)?a:a+`px`}e(z$2,`z`);function N$1(e,n,a,c,m){var v,T;n:if(n==`style`){if(typeof a==`string`)e.style.cssText=a;else{if(typeof c==`string`&&(e.style.cssText=c=``),c)for(n in c)a&&n in a||z$2(e.style,n,``);if(a)for(n in a)c&&a[n]==c[n]||z$2(e.style,n,a[n])}}else if(n[0]==`o`&&n[1]==`n`)v=n!=(n=n.replace(uo,`$1`)),T=n.toLowerCase(),n=T in e||n==`onFocusOut`||n==`onFocusIn`?T.slice(2):n.slice(2),e.l||={},e.l[n+v]=a,a?c?a[lo]=c[lo]:(a[lo]=fo,e.addEventListener(n,v?mo:po,v)):e.removeEventListener(n,v?mo:po,v);else{if(m==`http://www.w3.org/2000/svg`)n=n.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(n!=`width`&&n!=`height`&&n!=`href`&&n!=`list`&&n!=`form`&&n!=`tabIndex`&&n!=`download`&&n!=`rowSpan`&&n!=`colSpan`&&n!=`role`&&n!=`popover`&&n in e)try{e[n]=a??``;break n}catch{}typeof a==`function`||(a==null||!1===a&&n[4]!=`-`?e.removeAttribute(n):e.setAttribute(n,n==`popover`&&a==1?``:a))}}e(N$1,`N`);function V$1(e){return function(n){if(this.l){var a=this.l[n.type+e];if(n[co]==null)n[co]=fo++;else if(n[co]<a[lo])return;return a(to.event?to.event(n):n)}}}e(V$1,`V`);function q$2(e,n,a,c,m,v,T,O,A,I){var L,U,G,K,q,ee,te,ne,J,re,ie,ae,oe,se,ce,le,ue=n.type;if(n.constructor!==void 0)return null;128&a.__u&&(A=!!(32&a.__u),v=[O=n.__e=a.__e]),(L=to.__b)&&L(n);n:if(typeof ue==`function`){U=T.length;try{if(J=n.props,re=ue.prototype&&ue.prototype.render,ie=(L=ue.contextType)&&c[L.__c],ae=L?ie?ie.props.value:L.__:c,a.__c?ne=(G=n.__c=a.__c).__=G.__E:(re?n.__c=G=new ue(J,ae):(n.__c=G=new C$2(J,ae),G.constructor=ue,G.render=Q$1),ie&&ie.sub(G),G.state||(G.state={}),G.__n=c,K=G.__d=!0,G.__h=[],G._sb=[]),re&&G.__s==null&&(G.__s=G.state),re&&ue.getDerivedStateFromProps!=null&&(G.__s==G.state&&(G.__s=m$1({},G.__s)),m$1(G.__s,ue.getDerivedStateFromProps(J,G.__s))),q=G.props,ee=G.state,G.__v=n,K)re&&ue.getDerivedStateFromProps==null&&G.componentWillMount!=null&&G.componentWillMount(),re&&G.componentDidMount!=null&&G.__h.push(G.componentDidMount);else{if(re&&ue.getDerivedStateFromProps==null&&J!==q&&G.componentWillReceiveProps!=null&&G.componentWillReceiveProps(J,ae),n.__v==a.__v||!G.__e&&G.shouldComponentUpdate!=null&&!1===G.shouldComponentUpdate(J,G.__s,ae)){n.__v!=a.__v&&(G.props=J,G.state=G.__s,G.__d=!1),n.__e=a.__e,n.__k=a.__k,n.__k.some(function(e){e&&(e.__=n)}),_o.push.apply(G.__h,G._sb),G._sb=[],G.__h.length&&T.push(G),O=$$1(a);break n}G.componentWillUpdate!=null&&G.componentWillUpdate(J,G.__s,ae),re&&G.componentDidUpdate!=null&&G.__h.push(function(){G.componentDidUpdate(q,ee,te)})}if(G.context=ae,G.props=J,G.__P=e,G.__e=!1,oe=to.__r,se=0,re)G.state=G.__s,G.__d=!1,oe&&oe(n),L=G.render(G.props,G.state,G.context),_o.push.apply(G.__h,G._sb),G._sb=[];else do G.__d=!1,oe&&oe(n),L=G.render(G.props,G.state,G.context),G.state=G.__s;while(G.__d&&++se<25);G.state=G.__s,G.getChildContext!=null&&(c=m$1(m$1({},c),G.getChildContext())),re&&!K&&G.getSnapshotBeforeUpdate!=null&&(te=G.getSnapshotBeforeUpdate(q,ee)),ce=L!=null&&L.type===S&&L.key==null?E$1(L.props.children):L,O=L$1(e,yo(ce)?ce:[ce],n,a,c,m,v,T,O,A,I),G.base=n.__e,n.__u&=-161,G.__h.length&&T.push(G),ne&&(G.__E=G.__=null)}catch(e){if(T.length=U,n.__v=null,A||v!=null){if(e.then){for(n.__u|=A?160:128;O&&O.nodeType==8&&O.nextSibling;)O=O.nextSibling;v!=null&&(v[v.indexOf(O)]=null),n.__e=O}else if(v!=null)for(le=v.length;le--;)b(v[le])}else n.__e=a.__e;n.__k??=a.__k||[],e.then||B$2(n),to.__e(e,n,a)}}else v==null&&n.__v==a.__v?(n.__k=a.__k,n.__e=a.__e):O=n.__e=G$1(a.__e,n,a,c,m,v,T,A,I);return(L=to.diffed)&&L(n),128&n.__u?void 0:O}e(q$2,`q`);function B$2(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(B$2))}e(B$2,`B`);function D$2(e,n,a){for(var c=0;c<a.length;c++)J$1(a[c],a[++c],a[++c]);to.__c&&to.__c(n,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(e){e.call(n)})}catch(e){to.__e(e,n.__v)}})}e(D$2,`D`);function E$1(e){return typeof e!=`object`||!e||e.__b>0?e:yo(e)?e.map(E$1):e.constructor===void 0?m$1({},e):null}e(E$1,`E`);function G$1(e,n,a,c,m,v,T,O,A){var I,L,U,G,K,q,ee,te=a.props||go,ne=n.props,J=n.type;if(J==`svg`?m=`http://www.w3.org/2000/svg`:J==`math`?m=`http://www.w3.org/1998/Math/MathML`:m||=`http://www.w3.org/1999/xhtml`,v!=null){for(I=0;I<v.length;I++)if((K=v[I])&&`setAttribute`in K==!!J&&(J?K.localName==J:K.nodeType==3)){e=K,v[I]=null;break}}if(e==null){if(J==null)return document.createTextNode(ne);e=document.createElementNS(m,J,ne.is&&ne),O&&=(to.__m&&to.__m(n,v),!1),v=null}if(J==null)te===ne||O&&e.data==ne||(e.data=ne);else{if(v=J==`textarea`&&ne.defaultValue!=null?null:v&&eo.call(e.childNodes),!O&&v!=null)for(te={},I=0;I<e.attributes.length;I++)te[(K=e.attributes[I]).name]=K.value;for(I in te)K=te[I],I==`dangerouslySetInnerHTML`?U=K:I==`children`||I in ne||I==`value`&&`defaultValue`in ne||I==`checked`&&`defaultChecked`in ne||N$1(e,I,null,K,m);for(I in ne)K=ne[I],I==`children`?G=K:I==`dangerouslySetInnerHTML`?L=K:I==`value`?q=K:I==`checked`?ee=K:O&&typeof K!=`function`||te[I]===K||N$1(e,I,K,te[I],m);if(L)O||U&&(L.__html==U.__html||L.__html==e.innerHTML)||(e.innerHTML=L.__html),n.__k=[];else if(U&&(e.innerHTML=``),L$1(n.type==`template`?e.content:e,yo(G)?G:[G],n,a,c,J==`foreignObject`?`http://www.w3.org/1999/xhtml`:m,v,T,v?v[0]:a.__k&&$$1(a,0),O,A),v!=null)for(I=v.length;I--;)b(v[I]);O&&J!=`textarea`||(I=`value`,J==`progress`&&q==null?e.removeAttribute(`value`):q!=null&&(q!==e[I]||J==`progress`&&!q||J==`option`&&q!=te[I])&&N$1(e,I,q,te[I],m),I=`checked`,ee!=null&&ee!=e[I]&&N$1(e,I,ee,te[I],m))}return e}e(G$1,`G`);function J$1(e,n,a){try{if(typeof e==`function`){var c=typeof e.__u==`function`;c&&e.__u(),c&&n==null||(e.__u=e(n))}else e.current=n}catch(e){to.__e(e,a)}}e(J$1,`J`);function K$1(e,n,a){var c,m;if(to.unmount&&to.unmount(e),(c=e.ref)&&(c.current&&c.current!=e.__e||J$1(c,null,n)),(c=e.__c)!=null){if(c.componentWillUnmount)try{c.componentWillUnmount()}catch(e){to.__e(e,n)}c.base=c.__P=c.__n=null}if(c=e.__k)for(m=0;m<c.length;m++)c[m]&&K$1(c[m],n,a||typeof e.type!=`function`);a||b(e.__e),e.__c=e.__=e.__e=void 0}e(K$1,`K`);function Q$1(e,n,a){return this.constructor(e,a)}e(Q$1,`Q`);function R$1(e,n,a){var c,m,v,T;n==document&&(n=document.documentElement),to.__&&to.__(e,n),m=(c=typeof a==`function`)?null:a&&a.__k||n.__k,v=[],T=[],q$2(n,e=(!c&&a||n).__k=k$2(S,null,[e]),m||go,go,n.namespaceURI,!c&&a?[a]:m?null:n.firstChild?eo.call(n.childNodes):null,v,!c&&a?a:m?m.__e:n.firstChild,c,T),D$2(v,e,T),e.props.children=null}e(R$1,`R`);function U$1(e,n){R$1(e,n,U$1)}e(U$1,`U`);function W$1(e,n,a){var c,m,v,T,O=m$1({},e.props);for(v in e.type&&e.type.defaultProps&&(T=e.type.defaultProps),n)v==`key`?c=n[v]:v==`ref`?m=n[v]:O[v]=n[v]===void 0&&T!=null?T[v]:n[v];return arguments.length>2&&(O.children=arguments.length>3?eo.call(arguments,2):a),x$2(e.type,O,c||e.key,m||e.ref,null)}e(W$1,`W`);function X$1(e){function l(e){var n,a;return this.getChildContext||(n=new Set,(a={})[l.__c]=this,this.getChildContext=function(){return a},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,A$2(e)})},this.sub=function(e){n.add(e);var a=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),a&&a.call(e)}}),e.children}return l.__c=`__cC`+ho++,l.__=e,l.Provider=l.__l=(l.Consumer=function(e,n){return e.children(n)}).contextType=l,l}e(X$1,`X`),eo=_o.slice,to={__e:function(e,n,a,c){for(var m,v,T;n=n.__;)if((m=n.__c)&&!m.__)try{if((v=m.constructor)&&v.getDerivedStateFromError!=null&&(m.setState(v.getDerivedStateFromError(e)),T=m.__d),m.componentDidCatch!=null&&(m.componentDidCatch(e,c||{}),T=m.__d),T)return m.__E=m}catch(n){e=n}throw e}},no=0,C$2.prototype.setState=function(e,n){var a=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=m$1({},this.state);typeof e==`function`&&(e=e(m$1({},a),this.props)),e&&m$1(a,e),e!=null&&this.__v&&(n&&this._sb.push(n),A$2(this))},C$2.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),A$2(this))},C$2.prototype.render=S,ro=[],ao=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,oo=e(function(e,n){return e.__v.__b-n.__v.__b},`e`),H$1.__r=0,so=Math.random().toString(8),co=`__d`+so,lo=`__a`+so,uo=/(PointerCapture)$|Capture$/i,fo=0,po=V$1(!1),mo=V$1(!0),ho=0;var bo,xo,So,Co,wo=0,To=[],Eo=to,Do=Eo.__b,Oo=Eo.__r,ko=Eo.diffed,Ao=Eo.__c,jo=Eo.unmount,Mo=Eo.__;function s(e,n){Eo.__h&&Eo.__h(xo,e,wo||n),wo=0;var a=xo.__H||(xo.__H={__:[],__h:[]});return e>=a.__.length&&a.__.push({}),a.__[e]}function d(e){return wo=1,y(D$1,e)}function y(e,n,a){var c=s(bo++,2);if(c.t=e,!c.__c&&(c.__=[a?a(n):D$1(void 0,n),function(e){var n=c.__N?c.__N[0]:c.__[0],a=c.t(n,e);n!==a&&(c.__N=[a,c.__[1]],c.__c.setState({}))}],c.__c=xo,!xo.__f)){var f=function(e,n,a){if(!c.__c.__H)return!0;var v=!1,T=c.__c.props!==e;if(c.__c.__H.__.some(function(e){if(e.__N){v=!0;var n=e.__[0];e.__=e.__N,e.__N=void 0,n!==e.__[0]&&(T=!0)}}),m){var O=m.call(this,e,n,a);return v?O||T:O}return!v||T};xo.__f=!0;var m=xo.shouldComponentUpdate,v=xo.componentWillUpdate;xo.componentWillUpdate=function(e,n,a){if(this.__e){var c=m;m=void 0,f(e,n,a),m=c}v&&v.call(this,e,n,a)},xo.shouldComponentUpdate=f}return c.__N||c.__}function h(e,n){var a=s(bo++,3);!Eo.__s&&C$1(a.__H,n)&&(a.__=e,a.u=n,xo.__H.__h.push(a))}function _(e,n){var a=s(bo++,4);!Eo.__s&&C$1(a.__H,n)&&(a.__=e,a.u=n,xo.__h.push(a))}function A$1(e){return wo=5,T$1(function(){return{current:e}},[])}e(A$1,`A`);function F$1(e,n,a){wo=6,_(function(){if(typeof e==`function`){var a=e(n());return function(){e(null),a&&typeof a==`function`&&a()}}if(e)return e.current=n(),function(){return e.current=null}},a==null?a:a.concat(e))}e(F$1,`F`);function T$1(e,n){var a=s(bo++,7);return C$1(a.__H,n)&&(a.__=e(),a.__H=n,a.__h=e),a.__}e(T$1,`T`);function q$1(e,n){return wo=8,T$1(function(){return e},n)}e(q$1,`q`);function x$1(e){var n=xo.context[e.__c],a=s(bo++,9);return a.c=e,n?(a.__??(a.__=!0,n.sub(xo)),n.props.value):e.__}e(x$1,`x`);function P$1(e,n){Eo.useDebugValue&&Eo.useDebugValue(n?n(e):e)}e(P$1,`P`);function g$1(){var e=s(bo++,11);if(!e.__){for(var n=xo.__v;n!==null&&!n.__m&&n.__!==null;)n=n.__;var a=n.__m||(n.__m=[0,0]);e.__=`P`+a[0]+`-`+a[1]++}return e.__}e(g$1,`g`);function j$1(){for(var e;e=To.shift();){var n=e.__H;if(e.__P&&n)try{n.__h.some(z$1),n.__h.some(B$1),n.__h=[]}catch(a){n.__h=[],Eo.__e(a,e.__v)}}}e(j$1,`j`),Eo.__b=function(e){xo=null,Do&&Do(e)},Eo.__=function(e,n){e&&n.__k&&n.__k.__m&&(e.__m=n.__k.__m),Mo&&Mo(e,n)},Eo.__r=function(e){Oo&&Oo(e),bo=0;var n=(xo=e.__c).__H;n&&(So===xo?(n.__h=[],xo.__h=[],n.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(n.__h.some(z$1),n.__h.some(B$1),n.__h=[],bo=0)),So=xo},Eo.diffed=function(e){ko&&ko(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(To.push(n)!==1&&Co===Eo.requestAnimationFrame||((Co=Eo.requestAnimationFrame)||w$1)(j$1)),n.__H.__.some(function(e){e.u&&=(e.__H=e.u,void 0)})),So=xo=null},Eo.__c=function(e,n){n.some(function(e){try{e.__h.some(z$1),e.__h=e.__h.filter(function(e){return!e.__||B$1(e)})}catch(a){n.some(function(e){e.__h&&=[]}),n=[],Eo.__e(a,e.__v)}}),Ao&&Ao(e,n)},Eo.unmount=function(e){jo&&jo(e);var n,a=e.__c;a&&a.__H&&(a.__H.__.some(function(e){try{z$1(e)}catch(e){n=e}}),a.__H=void 0,n&&Eo.__e(n,a.__v))};var No=typeof requestAnimationFrame==`function`;function w$1(e){var n,r=function(){clearTimeout(a),No&&cancelAnimationFrame(n),setTimeout(e)},a=setTimeout(r,35);No&&(n=requestAnimationFrame(r))}e(w$1,`w`);function z$1(e){var n=xo,a=e.__c;typeof a==`function`&&(e.__c=void 0,a()),xo=n}e(z$1,`z`);function B$1(e){var n=xo;e.__c=e.__(),xo=n}e(B$1,`B`);function C$1(e,n){return!e||e.length!==n.length||n.some(function(n,a){return n!==e[a]})}e(C$1,`C`);function D$1(e,n){return typeof n==`function`?n(e):n}e(D$1,`D`);function g(e,n){for(var a in n)e[a]=n[a];return e}function E(e,n){for(var a in e)if(a!==`__source`&&!(a in n))return!0;for(var c in n)if(c!==`__source`&&e[c]!==n[c])return!0;return!1}function C(e,n){var a=n(),c=d({t:{__:a,u:n}}),m=c[0].t,v=c[1];return _(function(){m.__=a,m.u=n,R(m)&&v({t:m})},[e,a,n]),h(function(){return R(m)&&v({t:m}),e(function(){R(m)&&v({t:m})})},[e]),a}function R(e){try{return!((n=e.__)===(a=e.u())&&(n!==0||1/n==1/a)||n!=n&&a!=a)}catch{return!0}var n,a}function x(e){e()}function w(e){return e}function k(){return[!1,x]}var Po=_;function M(e,n){this.props=e,this.context=n}function N(e,n){function r(e){var a=this.props.ref;return a!=e.ref&&a&&(typeof a==`function`?a(null):a.current=null),n?!n(this.props,e)||a!=e.ref:E(this.props,e)}function u(n){return this.shouldComponentUpdate=r,k$2(e,n)}return u.displayName=`Memo(`+(e.displayName||e.name)+`)`,u.__f=u.prototype.isReactComponent=!0,u.type=e,u}(M.prototype=new C$2).isPureReactComponent=!0,M.prototype.shouldComponentUpdate=function(e,n){return E(this.props,e)||E(this.state,n)};var Fo=to.__b;to.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Fo&&Fo(e)};var Io=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.forward_ref`)||3911;function D(e){function t(n){var a=g({},n);return delete a.ref,e(a,n.ref||null)}return t.$$typeof=Io,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName=`ForwardRef(`+(e.displayName||e.name)+`)`,t}var F=function(e,n){return e==null?null:F$2(F$2(e).map(n))},Lo={map:F,forEach:F,count:function(e){return e?F$2(e).length:0},only:function(e){var n=F$2(e);if(n.length!==1)throw`Children.only`;return n[0]},toArray:F$2},Ro=to.__e;to.__e=function(e,n,a,c){if(e.then){for(var m,v=n;v=v.__;)if((m=v.__c)&&m.__c)return n.__e??(n.__e=a.__e,n.__k=a.__k||[]),m.__c(e,n)}Ro(e,n,a,c)};var zo=to.unmount;function V(e,n,a){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){typeof e.__c==`function`&&e.__c()}),e.__c.__H=null),(e=g({},e)).__c!=null&&(e.__c.__P===a&&(e.__c.__P=n),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return V(e,n,a)})),e}function W(e,n,a){return e&&a&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return W(e,n,a)}),e.__c&&e.__c.__P===n&&(e.__e&&a.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=a)),e}function P(){this.__u=0,this.o=null,this.__b=null}function j(e){var n=e.__&&e.__.__c;return n&&n.__a&&n.__a(e)}function z(e){var n,a,c,m=null;function i(v){if(n||(n=e()).then(function(e){e&&(m=e.default||e),c=!0},function(e){a=e,c=!0}),a)throw a;if(!c)throw n;return m?k$2(m,v):null}return i.displayName=`Lazy`,i.__f=!0,i}function B(){this.i=null,this.l=null}to.unmount=function(e){var n=e.__c;n&&(n.__z=!0),n&&n.__R&&n.__R(),n&&32&e.__u&&(e.type=null),zo&&zo(e)},(P.prototype=new C$2).__c=function(e,n){var a=n.__c,c=this;c.o??=[],c.o.push(a);var m=j(c.__v),v=!1,i=function(){v||c.__z||(v=!0,a.__R=null,m?m(f):f())};a.__R=i;var T=a.__P;a.__P=null;var f=function(){if(!--c.__u){if(c.state.__a){var e=c.state.__a;c.__v.__k[0]=W(e,e.__c.__P,e.__c.__O)}var n;for(c.setState({__a:c.__b=null});n=c.o.pop();)n.__P=T,n.forceUpdate()}};c.__u++||32&n.__u||c.setState({__a:c.__b=c.__v.__k[0]}),e.then(i,i)},P.prototype.componentWillUnmount=function(){this.o=[]},P.prototype.render=function(e,n){if(this.__b){if(this.__v.__k){var a=document.createElement(`div`),c=this.__v.__k[0].__c;this.__v.__k[0]=V(this.__b,a,c.__O=c.__P)}this.__b=null}var m=n.__a&&k$2(S,null,e.fallback);return m&&(m.__u&=-33),[k$2(S,null,n.__a?null:e.children),m]};var H=function(e,n,a){if(++a[1]===a[0]&&e.l.delete(n),e.props.revealOrder&&(e.props.revealOrder[0]!==`t`||!e.l.size))for(a=e.i;a;){for(;a.length>3;)a.pop()();if(a[1]<a[0])break;e.i=a=a[2]}};function Z(e){return this.getChildContext=function(){return e.context},e.children}function Y(e){var n=this,a=e.h;if(n.componentWillUnmount=function(){R$1(null,n.v),n.v=null,n.h=null},n.h&&n.h!==a&&n.componentWillUnmount(),!n.v){for(var c=n.__v;c!==null&&!c.__m&&c.__!==null;)c=c.__;n.h=a,n.v={nodeType:1,parentNode:a,childNodes:[],__k:{__m:c.__m},contains:function(){return!0},namespaceURI:a.namespaceURI,insertBefore:function(e,a){this.childNodes.push(e),n.h.insertBefore(e,a)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),n.h.removeChild(e)}}}R$1(k$2(Z,{context:n.context},e.__v),n.v)}function $(e,n){var a=k$2(Y,{__v:e,h:n});return a.containerInfo=n,a}(B.prototype=new C$2).__a=function(e){var n=this,a=j(n.__v),c=n.l.get(e);return c[0]++,function(m){var o=function(){n.props.revealOrder?(c.push(m),H(n,e,c)):m()};a?a(o):o()}},B.prototype.render=function(e){this.i=null,this.l=new Map;var n=F$2(e.children);e.revealOrder&&e.revealOrder[0]===`b`&&n.reverse();for(var a=n.length;a--;)this.l.set(n[a],this.i=[1,0,this.i]);return e.children},B.prototype.componentDidUpdate=B.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(n,a){H(e,a,n)})};var Bo=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,Vo=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Ho=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Uo=/[A-Z0-9]/g,Wo=typeof document<`u`,X=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)};function nn(e,n,a){return n.__k??(n.textContent=``),R$1(e,n),typeof a==`function`&&a(),e?e.__c:null}function tn(e,n,a){return U$1(e,n),typeof a==`function`&&a(),e?e.__c:null}C$2.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(C$2.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(n){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:n})}})});var Go=to.event;to.event=function(e){return Go&&(e=Go(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Ko,qo={configurable:!0,get:function(){return this.class}},Jo=to.vnode;to.vnode=function(e){typeof e.type==`string`&&function(e){var n=e.props,a=e.type,c={},m=a.indexOf(`-`)==-1;for(var v in n){var T=n[v];if(!(v===`value`&&`defaultValue`in n&&T==null||Wo&&v===`children`&&a===`noscript`||v===`class`||v===`className`)){var O=v.toLowerCase();v===`defaultValue`&&`value`in n&&n.value==null?v=`value`:v===`download`&&!0===T?T=``:O===`translate`&&T===`no`?T=!1:O[0]===`o`&&O[1]===`n`?O===`ondoubleclick`?v=`ondblclick`:O!==`onchange`||a!==`input`&&a!==`textarea`||X(n.type)?O===`onfocus`?v=`onfocusin`:O===`onblur`?v=`onfocusout`:Ho.test(v)&&(v=O):O=v=`oninput`:m&&Vo.test(v)?v=v.replace(Uo,`-$&`).toLowerCase():T===null&&(T=void 0),O===`oninput`&&c[v=O]&&(v=`oninputCapture`),c[v]=T}}a==`select`&&(c.multiple&&Array.isArray(c.value)&&(c.value=F$2(n.children).forEach(function(e){e.props.selected=c.value.indexOf(e.props.value)!=-1})),c.defaultValue!=null&&(c.value=F$2(n.children).forEach(function(e){e.props.selected=c.multiple?c.defaultValue.indexOf(e.props.value)!=-1:c.defaultValue==e.props.value}))),n.class&&!n.className?(c.class=n.class,Object.defineProperty(c,"className",qo)):n.className&&(c.class=c.className=n.className),e.props=c}(e),e.$$typeof=Bo,Jo&&Jo(e)};var Yo=to.__r;to.__r=function(e){Yo&&Yo(e),Ko=e.__c};var Xo=to.diffed;to.diffed=function(e){Xo&&Xo(e);var n=e.props,a=e.__e;a!=null&&e.type===`textarea`&&`value`in n&&n.value!==a.value&&(a.value=n.value==null?``:n.value),Ko=null};var Zo={ReactCurrentDispatcher:{current:{readContext:function(e){return Ko.__n[e.__c].props.value},useCallback:q$1,useContext:x$1,useDebugValue:P$1,useDeferredValue:w,useEffect:h,useId:g$1,useImperativeHandle:F$1,useInsertionEffect:Po,useLayoutEffect:_,useMemo:T$1,useReducer:y,useRef:A$1,useState:d,useSyncExternalStore:C,useTransition:k}}};function sn(e){return k$2.bind(null,e)}function hn(e){return!!e&&e.$$typeof===Bo}function vn(e){return hn(e)&&e.type===S}function dn(e){return!!e&&typeof e.displayName==`string`&&e.displayName.indexOf(`Memo(`)==0}function mn(e){return hn(e)?W$1.apply(null,arguments):e}function pn(e){return!!e.__k&&(R$1(null,e),!0)}function yn(e){return e&&(e.base||e.nodeType===1&&e)||null}var _n=function(e,n){return e(n)},bn=function(e,n){var a,c=to.debounceRendering;to.debounceRendering=function(e){a=e};try{var m=e(n);return a&&a(),m}finally{to.debounceRendering=c}},Qo={useState:d,useId:g$1,useReducer:y,useEffect:h,useLayoutEffect:_,useInsertionEffect:Po,useTransition:k,useDeferredValue:w,useSyncExternalStore:C,startTransition:x,useRef:A$1,useImperativeHandle:F$1,useMemo:T$1,useCallback:q$1,useContext:x$1,useDebugValue:P$1,version:`18.3.1`,Children:Lo,render:nn,hydrate:tn,unmountComponentAtNode:pn,createPortal:$,createElement:k$2,createContext:X$1,createFactory:sn,cloneElement:mn,createRef:M$1,Fragment:S,isValidElement:hn,isElement:hn,isFragment:vn,isMemo:dn,findDOMNode:yn,Component:C$2,PureComponent:M,memo:N,forwardRef:D,flushSync:bn,unstable_batchedUpdates:_n,StrictMode:S,Suspense:P,SuspenseList:B,lazy:z,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Zo},$o=0;Array.isArray;function u(e,n,a,c,m,v){n||={};var T,O,A=n;if(`ref`in A)for(O in A={},n)O==`ref`?T=n[O]:A[O]=n[O];var I={type:e,props:A,key:a,ref:T,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--$o,__i:-1,__u:0,__source:m,__self:v};if(typeof e==`function`&&(T=e.defaultProps))for(O in T)A[O]===void 0&&(A[O]=T[O]);return to.vnode&&to.vnode(I),I}Tt();var es=n(U());function Arrow(e){return u(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,...e,children:u(`path`,{fillRule:`evenodd`,d:`M10,12 L3,12 C2.44771525,12 2,11.5522847 2,11 C2,10.4477153 2.44771525,10 3,10 L8,10 L8,5 C8,4.44771525 8.44771525,4 9,4 C9.55228475,4 10,4.44771525 10,5 L10,12 Z`,transform:`rotate(-45 6 8)`})})}function Close(e){return u(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,...e,children:u(`path`,{fillRule:`evenodd`,d:`M12 4.7L11.3 4L8 7.3L4.7 4L4 4.7L7.3 8L4 11.3L4.7 12L8 8.7L11.3 12L12 11.3L8.7 8L12 4.7Z`,fill:`currentColor`})})}function Create(e){return u(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,...e,children:u(`path`,{fillRule:`evenodd`,d:`M9,13 L9,9 L9,9 L13,9 C13.5522847,9 14,8.55228475 14,8 C14,7.44771525 13.5522847,7 13,7 L9,7 L9,7 L9,3 C9,2.44771525 8.55228475,2 8,2 C7.44771525,2 7,2.44771525 7,3 L7,7 L7,7 L3,7 C2.44771525,7 2,7.44771525 2,8 C2,8.55228475 2.44771525,9 3,9 L7,9 L7,9 L7,13 C7,13.5522847 7.44771525,14 8,14 C8.55228475,14 9,13.5522847 9,13 Z`})})}function Delete(e){return u(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,...e,children:u(`path`,{fillRule:`evenodd`,d:`M9,4 L9,11 C9,12.1 8.6,12.55 7.5,12.55 L2.5,12.55 C1.4,12.55 1,12.1 1,11 L1,4 L9,4 Z M7.5,5.5 L2.5,5.5 L2.5,9.8 C2.5,10.46 3,11 3.61111111,11 L6.38888889,11 C7,11 7.5,10.46 7.5,9.8 L7.5,5.5 Z M10,1 L8,1 L7,0 L3,0 L2,1 L0,1 L0,2.5 L10,2.5 L10,1 Z`,transform:`translate(3 2)`})})}function Drag(e){return u(`svg`,{width:`16`,height:`16`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[u(`path`,{fill:`#fff`,style:{mixBlendMode:`multiply`},d:`M0 0h16v16H0z`}),u(`path`,{fill:`#fff`,style:{mixBlendMode:`multiply`},d:`M0 0h16v16H0z`}),u(`path`,{d:`M7 3H5v2h2V3zM11 3H9v2h2V3zM7 7H5v2h2V7zM11 7H9v2h2V7zM7 11H5v2h2v-2zM11 11H9v2h2v-2z`,fill:`#161616`})]})}function ExternalLink(e){return u(`svg`,{width:`16`,height:`16`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:u(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12.637 12.637v-4.72h1.362v4.721c0 .36-.137.676-.411.95-.275.275-.591.412-.95.412H3.362c-.38 0-.703-.132-.967-.396A1.315 1.315 0 0 1 2 12.638V3.362c0-.38.132-.703.396-.967S2.982 2 3.363 2h4.553v1.363H3.363v9.274h9.274ZM14 2H9.28l-.001 1.362h2.408L5.065 9.984l.95.95 6.622-6.622v2.409H14V2Z`,fill:`currentcolor`})})}function Feel(e){return u(`svg`,{width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[u(`path`,{d:`M3.6168 11.9894C3.47957 12.6745 3.22473 13.1809 2.85227 13.5085C2.48961 13.8362 1.97012 14 1.29381 14H0L0.308751 12.4213H1.57316L3.08751 4.78085H2.17596L2.48471 3.20213H3.39626L3.6315 2.01064C3.76872 1.32553 4.01866 0.819149 4.38132 0.491489C4.75378 0.16383 5.27817 0 5.95448 0H7.2483L6.93954 1.57872H5.67514L5.35168 3.20213H6.61609L6.30734 4.78085H5.04293L3.6168 11.9894Z`,fill:`currentcolor`}),u(`path`,{d:`M5.60492 11.0213L8.63361 6.86596L7.28099 3.20213H9.35403L10.0598 5.74894H10.2362L11.927 3.20213H14L10.986 7.25319L12.3239 11.0213H10.2509L9.54517 8.41489H9.36874L7.67796 11.0213H5.60492Z`,fill:`currentcolor`})]})}function Info(e){return u(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,...e,children:[u(`circle`,{cx:`12`,cy:`12`,r:`9`}),u(`path`,{d:`M12 16v-4`}),u(`path`,{d:`M12 8h.01`})]})}function Launch(e){return u(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,...e,children:[u(`path`,{d:`M26,28H6a2.0027,2.0027,0,0,1-2-2V6A2.0027,2.0027,0,0,1,6,4H16V6H6V26H26V16h2V26A2.0027,2.0027,0,0,1,26,28Z`}),u(`polygon`,{points:`20 2 20 4 26.586 4 18 12.586 19.414 14 28 5.414 28 12 30 12 30 2 20 2`})]})}function OpenPopup(e){return u(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,...e,children:u(`path`,{d:`M6 15L6 14 2.7 14 7 9.7 6.3 9 2 13.3 2 10 1 10 1 15zM10 1L10 2 13.3 2 9 6.3 9.7 7 14 2.7 14 6 15 6 15 1z`})})}function translateFallback(e,n){return n||={},e.replace(/{([^}]+)}/g,function(e,a){return n[a]||`{`+a+`}`})}function Header(e){let{element:n,headerProvider:a,translate:c=translateFallback}=e,{getElementIcon:m,getDocumentationRef:v,getElementLabel:T,getTypeLabel:O}=a,A=T(n),I=O(n),L=v&&v(n),U=m(n);return u(`div`,{class:`bio-properties-panel-header`,children:[u(`div`,{class:`bio-properties-panel-header-icon`,children:U&&u(U,{width:`32`,height:`32`,viewBox:`0 0 32 32`})}),u(`div`,{class:`bio-properties-panel-header-labels`,children:[u(`div`,{class:`bio-properties-panel-header-type`,children:I}),A?u(`div`,{class:`bio-properties-panel-header-label`,children:A}):null]}),u(`div`,{class:`bio-properties-panel-header-actions`,children:L?u(`a`,{rel:`noreferrer`,class:`bio-properties-panel-header-link`,href:L,title:c(`Open documentation`),target:`_blank`,children:u(ExternalLink,{})}):null})]})}var ts=X$1({description:{},getDescriptionForId:()=>{}}),ns=X$1({diagnostics:{}}),rs=X$1({errors:{}}),is=X$1({eventBus:null}),as=X$1({}),os=X$1({layout:{},setLayout:()=>{},getLayoutForKey:()=>{},setLayoutForKey:()=>{}}),ss=X$1({tooltip:{},getTooltipForId:()=>{}});function useTooltipContext(e,n){let{getTooltipForId:a}=x$1(ss);return a(e,n)}var cs=`bio-properties-panel-tooltip`;function TooltipWrapper(e){let{forId:n,element:a}=e,c=useTooltipContext(n,a),m=e.value||c;return m?u(Tooltip,{...e,value:m,forId:`bio-properties-panel-${n}`}):e.children}function Tooltip(e){let{forId:n,value:a,parent:c,direction:m=`right`,position:v,showDelay:T=250,hideDelay:O=250,focusable:A=!0}=e,[I,L]=d(!1),[U,G]=d(null),[K,q]=d(null),ee=A$1(null),te=A$1(null),ne=A$1(null),J=A$1(null),show=(e,n)=>{clearTimeout(ee.current),clearTimeout(te.current),!I&&(n?ee.current=setTimeout(()=>{L(!0)},T):L(!0))},handleWrapperMouseEnter=e=>{show(e,!0)},hide=(e=!1)=>{clearTimeout(ee.current),clearTimeout(te.current),e?te.current=setTimeout(()=>{L(!1)},O):L(!1)};h(()=>()=>{clearTimeout(ee.current),clearTimeout(te.current)},[]),h(()=>{if(!I)return;let handleClickOutside=e=>{ne.current&&!ne.current.contains(e.target)&&J.current&&!J.current.contains(e.target)&&hide(!1)};return document.addEventListener(`mousedown`,handleClickOutside),()=>{document.removeEventListener(`mousedown`,handleClickOutside)}},[I,hide]),_(()=>{if(!I||v){G(null),q(null);return}if(!ne.current||!J.current)return;let{tooltipPosition:e,arrowOffset:n}=getTooltipPosition(ne.current,J.current,m);G(e),q(n)},[I,v]);let handleMouseLeave=({relatedTarget:e})=>{if(e===ne.current||e===J.current||e?.parentElement===J.current)return;let n=window.getSelection();if(n&&n.toString().length>0){let e=n.getRangeAt(0);if(J.current?.contains(e.commonAncestorContainer)||J.current?.contains(n.anchorNode)||J.current?.contains(n.focusNode))return}hide(!0)},handleTooltipMouseEnter=()=>{clearTimeout(te.current)},handleFocusOut=e=>{let{relatedTarget:n}=e;J.current?.contains(n)||ne.current?.contains(n)||hide(!1)},hideTooltipViaEscape=e=>{e.code===`Escape`&&hide(!1)},renderTooltip=()=>{let e=v||(U?`right: ${U.right}; top: ${U.top}px;`:void 0),c=K==null?void 0:`margin-top: ${K}px;`;return u(`div`,{class:`bio-properties-panel-tooltip bio-theme-parent ${m}`,role:`tooltip`,id:cs,"aria-labelledby":n,style:e,ref:J,onClick:e=>e.stopPropagation(),onMouseEnter:handleTooltipMouseEnter,onMouseLeave:handleMouseLeave,children:[u(`div`,{class:`bio-properties-panel-tooltip-content`,children:a}),u(`div`,{class:`bio-properties-panel-tooltip-arrow`,style:c})]})};return u(`div`,{class:`bio-properties-panel-tooltip-wrapper`,tabIndex:A?`0`:void 0,ref:ne,onMouseEnter:handleWrapperMouseEnter,onMouseLeave:handleMouseLeave,onFocusIn:show,onFocusOut:handleFocusOut,onKeyDown:hideTooltipViaEscape,children:[e.children,I?c?$(renderTooltip(),c.current):renderTooltip():null]})}function getTooltipPosition(e,n,a){if(!e)return{tooltipPosition:null,arrowOffset:null};let c=e.getBoundingClientRect(),m=`calc(100% - ${c.x}px)`,v=c.top-10,T=null;if(n&&a===`right`){let e=n.getBoundingClientRect(),a=window.innerHeight-e.height,c=v;v>a&&(v=a),v<0&&(v=0),v!==c&&(T=16-(v-c))}return{tooltipPosition:{right:m,top:v},arrowOffset:T}}function useDescriptionContext(e,n){let{getDescriptionForId:a}=x$1(ts);return a(e,n)}function useDebounce(e,n){let a=q$1(n(e),[e,n]);return h(()=>()=>{a.flush?.()},[a]),a}var ls=[`info`,`warning`,`error`],us={error:`has-error`,warning:`has-warning`},ds=`error`;function getDiagnosticClass(e){return us[e?.severity]}function toDiagnostic(e,n=ds){return e?Nt(e)?{severity:n,message:e}:{...e,message:e.message||``,severity:ls.includes(e.severity)?e.severity:n}:null}var fs=ls.length-1;function getMostSevere(e){let n=null;for(let a of e||[]){let e=toDiagnostic(a);if(e&&(!n||getRank(e)>getRank(n))&&(n=e,getRank(n)===fs))break}return n}function toErrorDiagnostic(e){if(!e)return null;let n=Nt(e)?e:e.message;return n?{severity:ds,message:n}:null}function getMostSevereForIds(e,n){return getMostSevere(n.flatMap(n=>e[n]||[]))}function getGroupDiagnostic(e,n){return getMostSevereForIds(e,n.map(e=>e.id))}function getListDiagnostic(e,n){return getMostSevereForIds(e,n.flatMap(e=>[e.id,...(e.entries||[]).map(e=>e.id)]))}function getRank(e){return ls.indexOf(e.severity)}var ps=[];function useDiagnostics(e){let{diagnostics:n}=x$1(ns),{errors:a}=x$1(rs),c=n[e];if(c&&c.length)return c;let m=toErrorDiagnostic(a[e]);return m?[m]:ps}function useDisplayedDiagnostic(e){return getMostSevere(useDiagnostics(e))}function useAllDiagnostics(){let{diagnostics:e}=x$1(ns),{errors:n}=x$1(rs);return T$1(()=>{let a={...e};for(let e in n){if(a[e]&&a[e].length)continue;let c=toErrorDiagnostic(n[e]);c&&(a[e]=[c])}return a},[e,n])}function useGroupDiagnostic(e){return getGroupDiagnostic(useAllDiagnostics(),e)}function useListDiagnostic(e){return getListDiagnostic(useAllDiagnostics(),e)}function useError(e){let{errors:n}=x$1(rs);return n[e]}function useEvent(e,n,a){let c=x$1(is);a||({eventBus:a}=c);let m=A$1(!1);a&&!m.current&&a.on(e,n),h(()=>(a&&m.current&&a.on(e,n),m.current=!0,()=>{a&&a.off(e,n)}),[n,e,a])}function useKeyFactory(e=[]){let n=T$1(()=>new Map,e),getKey=e=>{let a=n.get(e);return a||(a=Math.random().toString().slice(-6),n.set(e,a)),a};return getKey}function useLayoutState(e,n){let{getLayoutForKey:a,setLayoutForKey:c}=x$1(os);return[a(e,n),q$1(n=>{c(e,n)},[c])]}function usePrevious(e){let n=A$1();return h(()=>{n.current=e}),n.current}function useShowEntryEvent(e){let{onShow:n}=x$1(os),a=A$1(),c=A$1(!1),m=q$1(a=>{a.id===e&&(n(),c.current||=!0)},[e]);return h(()=>{c.current&&a.current&&(ht(a.current.focus)&&a.current.focus(),ht(a.current.select)&&a.current.select(),c.current=!1)}),useEvent(`propertiesPanel.showEntry`,m),a}function getScrollContainer(e,n){return e.current?be(e.current,n,!0):null}function useStickyIntersectionObserver(e,n,a){let[c,m]=d(null),v=q$1(()=>{let a=getScrollContainer(e,n);a!==c&&m(a)},[e,n,c]);h(()=>{v()},[v]),useEvent(`propertiesPanel.attach`,v),useEvent(`propertiesPanel.detach`,v),h(()=>{let n=IntersectionObserver;if(!n)return;let m=e.current;if(!m||!c)return;let v=new n(e=>{c.scrollHeight!==0&&e.forEach(e=>{e.intersectionRatio<1?a(!0):e.intersectionRatio===1&&a(!1)})},{root:c,rootMargin:`0px 0px 999999% 0px`,threshold:[1]});return v.observe(m),()=>{v.unobserve(m)}},[e,c,a])}function useStaticCallback(e){let n=A$1(e);return _(()=>{n.current=e}),q$1((...e)=>n.current(...e),[])}function Group(e){let{element:n,entries:a=[],id:c,label:m,shouldOpen:v=!1,translate:T=translateFallback}=e,O=A$1(null),[A,I]=useLayoutState([`groups`,c,`open`],v),L=q$1(()=>I(!0),[I]),toggleOpen=()=>I(!A),[U,G]=d(!1),[K,q]=d(!1);h(()=>{let e=requestAnimationFrame(()=>{let e=a.find(e=>{let{id:n,isEdited:a}=e,c=Qe(`[data-entry-id="${n}"]`);return!ht(a)||!c?!1:a(Qe(`.bio-properties-panel-input`,c))});G(e)});return()=>cancelAnimationFrame(e)},[a,G]);let ee=useGroupDiagnostic(a);useStickyIntersectionObserver(O,`div.bio-properties-panel-scroll-container`,q);let te={...x$1(os),onShow:L};return u(`div`,{class:`bio-properties-panel-group`,"data-group-id":`group-`+c,ref:O,children:[u(`div`,{class:(0,es.default)(`bio-properties-panel-group-header`,U?``:`empty`,A?`open`:``,K&&A?`sticky`:``),onClick:toggleOpen,children:[u(`div`,{class:`bio-properties-panel-group-header-title`,children:u(TooltipWrapper,{value:e.tooltip,forId:`group-`+c,element:n,children:m})}),u(`div`,{class:`bio-properties-panel-group-header-buttons`,children:[u(DataMarker,{edited:U,severity:ee?.severity,translate:T}),u(`button`,{type:`button`,title:T(`Toggle section`),class:`bio-properties-panel-group-header-button bio-properties-panel-arrow`,children:u(Arrow,{class:A?`bio-properties-panel-arrow-down`:`bio-properties-panel-arrow-right`})})]})]}),u(`div`,{class:(0,es.default)(`bio-properties-panel-group-entries`,A?`open`:``),children:u(os.Provider,{value:te,children:a.map(e=>{let{component:a,id:c}=e;return k$2(a,{...e,element:n,key:c})})})})]})}function DataMarker(e){let{edited:n,severity:a,translate:c=translateFallback}=e;return a===`error`?u(`div`,{title:c(`Section contains an error`),class:`bio-properties-panel-dot bio-properties-panel-dot--error`}):a===`warning`?u(`div`,{title:c(`Section contains a warning`),class:`bio-properties-panel-dot bio-properties-panel-dot--warning`}):n?u(`div`,{title:c(`Section contains edits`),class:`bio-properties-panel-dot`}):null}function Placeholder(e){let{text:n,icon:a}=e;return u(`div`,{class:`bio-properties-panel open`,children:u(`section`,{class:`bio-properties-panel-placeholder`,children:[a&&u(a,{class:`bio-properties-panel-placeholder-icon`}),u(`p`,{class:`bio-properties-panel-placeholder-text`,children:n})]})})}var ms={},hs={},gs={};function PropertiesPanel(e){let{element:n,headerProvider:a,placeholderProvider:c,groups:m,layoutConfig:v,layoutChanged:T,descriptionConfig:O,descriptionLoaded:A,tooltipConfig:I,tooltipLoaded:L,eventBus:U}=e,[G,K]=d(createLayout(v));useUpdateLayoutEffect(()=>{let e=createLayout(v);K(e)},[v]),h(()=>{typeof T==`function`&&T(G)},[G,T]);let getLayoutForKey=(e,n)=>vt(G,e,n),setLayoutForKey=(e,n)=>{K(a=>{let c=At({},a);return st(c,e,n),c})},q={layout:G,setLayout:K,getLayoutForKey,setLayoutForKey},ee=T$1(()=>createDescriptionContext(O),[O]);h(()=>{typeof A==`function`&&A(ee)},[ee,A]);let getDescriptionForId=(e,n)=>ee[e]&&ee[e](n),te={description:ee,getDescriptionForId},ne=T$1(()=>createTooltipContext(I),[I]);h(()=>{typeof L==`function`&&L(ne)},[ne,L]);let getTooltipForId=(e,n)=>ne[e]&&ne[e](n),J={tooltip:ne,getTooltipForId},[re,ie]=d({}),onSetDiagnostics=({diagnostics:e})=>ie(normalizeDiagnostics(e));useEvent(`propertiesPanel.setDiagnostics`,onSetDiagnostics,U);let onSetErrors=({errors:e})=>ie(toDiagnosticsMap(e));useEvent(`propertiesPanel.setErrors`,onSetErrors,U);let ae=T$1(()=>({diagnostics:re}),[re]),oe=T$1(()=>({errors:createErrors(re)}),[re]),se={eventBus:U},ce={element:n};return c&&!n?u(Placeholder,{...c.getEmpty()}):c&&xt(n)?u(Placeholder,{...c.getMultiple()}):u(os.Provider,{value:ce,children:u(ns.Provider,{value:ae,children:u(rs.Provider,{value:oe,children:u(ts.Provider,{value:te,children:u(ss.Provider,{value:J,children:u(os.Provider,{value:q,children:u(is.Provider,{value:se,children:u(`div`,{class:`bio-properties-panel bio-theme-parent`,children:[a?u(Header,{element:n,headerProvider:a}):null,u(`div`,{class:`bio-properties-panel-scroll-container`,children:m.map(e=>{let{component:a=Group,id:c}=e;return k$2(a,{...e,key:c,element:n})})})]})})})})})})})})}function normalizeDiagnostics(e){let n={};for(let a in e)n[a]=asArray(e[a]).map(e=>toDiagnostic(e)).filter(Boolean);return n}function toDiagnosticsMap(e){let n={};for(let a in e){let c=toErrorDiagnostic(e[a]);c&&(n[a]=[c])}return n}function createErrors(e){let n={};for(let a in e){let c=e[a].find(({severity:e})=>e===`error`);c&&(n[a]=c.message)}return n}function asArray(e){return xt(e)?e:[e]}function createLayout(e={},n=ms){return{...n,...e}}function createDescriptionContext(e={}){return{...hs,...e}}function createTooltipContext(e={}){return{...gs,...e}}function useUpdateLayoutEffect(e,n){let a=A$1(!1);_(()=>{if(a.current)return e();a.current=!0},n)}function DropdownButton(e){let{class:n,children:a,menuItems:c=[]}=e,m=A$1(null),v=A$1(null),[T,O]=d(!1),close=()=>O(!1);function onDropdownToggle(e){v.current&&v.current.contains(e.target)||(e.stopPropagation(),O(e=>!e))}function onActionClick(e,n){e.stopPropagation(),close(),n()}return useGlobalClick([m.current],()=>close()),u(`div`,{class:(0,es.default)(`bio-properties-panel-dropdown-button`,{open:T},n),onClick:onDropdownToggle,ref:m,children:[a,u(`div`,{class:`bio-properties-panel-dropdown-button__menu`,ref:v,children:c.map((e,n)=>u(MenuItem,{onClick:onActionClick,item:e},n))})]})}function MenuItem({item:e,onClick:n}){return e.separator?u(`div`,{class:`bio-properties-panel-dropdown-button__menu-item bio-properties-panel-dropdown-button__menu-item--separator`}):e.action?u(`button`,{type:`button`,class:`bio-properties-panel-dropdown-button__menu-item bio-properties-panel-dropdown-button__menu-item--actionable`,onClick:a=>n(a,e.action),children:e.entry}):u(`div`,{class:`bio-properties-panel-dropdown-button__menu-item`,children:e.entry})}function useGlobalClick(e,n){h(()=>{function listener(a){e.some(e=>e&&e.contains(a.target))||n()}return document.addEventListener(`click`,listener,{capture:!0}),()=>document.removeEventListener(`click`,listener,{capture:!0})},[...e,n])}function HeaderButton(e){let{children:n=null,class:a,onClick=()=>{},...c}=e;return u(`button`,{type:`button`,...c,onClick,class:(0,es.default)(`bio-properties-panel-group-header-button`,a),children:n})}function CollapsibleEntry(e){let{element:n,entries:a=[],id:c,label:m,open:v,remove:T,translate:O=translateFallback}=e,[A,I]=d(v),toggleOpen=()=>I(!A),{onShow:L}=x$1(os),U={...x$1(os),onShow:q$1(()=>{I(!0),ht(L)&&L()},[L,I])},G=O(`<empty>`),K=a.length>0;return u(`div`,{"data-entry-id":c,class:(0,es.default)(`bio-properties-panel-collapsible-entry`,A?`open`:``),children:[u(`div`,{class:`bio-properties-panel-collapsible-entry-header`,onClick:K?toggleOpen:null,children:[u(`div`,{class:(0,es.default)(`bio-properties-panel-collapsible-entry-header-title`,!m&&`empty`),children:m||G}),K&&u(`button`,{type:`button`,title:O(`Toggle list item`),class:`bio-properties-panel-arrow bio-properties-panel-collapsible-entry-arrow`,children:u(Arrow,{class:A?`bio-properties-panel-arrow-down`:`bio-properties-panel-arrow-right`})}),T?u(`button`,{type:`button`,title:O(`Delete item`),class:`bio-properties-panel-remove-entry`,onClick:T,children:u(Delete,{})}):null]}),u(`div`,{class:(0,es.default)(`bio-properties-panel-collapsible-entry-entries`,A?`open`:``),children:u(os.Provider,{value:U,children:a.map(e=>{let{component:a,id:c}=e;return k$2(a,{...e,element:n,key:c})})})})]})}function ListItem(e){let{autoFocusEntry:n,autoOpen:a,translate:c=translateFallback}=e;return h(()=>{if(a&&n){let e=Qe(`[data-entry-id="${n}"]`),a=Qe(`.bio-properties-panel-input`,e);a&&(ht(a.select)?a.select():ht(a.focus)&&a.focus(),a.scrollIntoView())}},[a,n]),u(`div`,{class:`bio-properties-panel-list-item`,children:u(CollapsibleEntry,{...e,open:a,translate:c})})}var noop$6=()=>{},_s={error:`bio-properties-panel-list-badge--error`,warning:`bio-properties-panel-list-badge--warning`};function ListGroup(e){let{add:n,element:a,id:c,items:m,label:v,shouldOpen:T=!1,translate:O=translateFallback}=e;h(()=>{e.shouldSort!=null&&console.warn(`the property 'shouldSort' is no longer supported`)},[e.shouldSort]);let A=A$1(null),[I,L]=useLayoutState([`groups`,c,`open`],T),[U,G]=d(!1),K=q$1(()=>L(!0),[L]),[q,ee]=d([]),[te,ne]=d(!1),J=usePrevious(a),re=q$1(()=>L(!I),[I]),ie=a===J&&I&&te?getNewItemIds(m,q):[];h(()=>{ee(m),ne(!1)},[m]),useStickyIntersectionObserver(A,`div.bio-properties-panel-scroll-container`,G);let ae=!!m.length,oe={...x$1(os),onShow:K},handleAddClick=e=>{ne(!0),L(!0),n(e)},se=useListDiagnostic(m);return u(`div`,{class:`bio-properties-panel-group`,"data-group-id":`group-`+c,ref:A,children:[u(`div`,{class:(0,es.default)(`bio-properties-panel-group-header`,ae?``:`empty`,ae&&I?`open`:``,U&&I?`sticky`:``),onClick:ae?re:noop$6,children:[u(`div`,{class:`bio-properties-panel-group-header-title`,children:u(TooltipWrapper,{value:e.tooltip,forId:`group-`+c,element:a,children:v})}),u(`div`,{class:`bio-properties-panel-group-header-buttons`,children:[n?u(`button`,{type:`button`,title:O(`Create new list item`),class:`bio-properties-panel-group-header-button bio-properties-panel-add-entry`,onClick:handleAddClick,children:[u(Create,{}),ae?null:u(`span`,{class:`bio-properties-panel-add-entry-label`,children:O(`Create`)})]}):null,ae?u(`div`,{title:O(`List contains {numOfItems} item${m.length==1?``:`s`}`,{numOfItems:m.length}),class:(0,es.default)(`bio-properties-panel-list-badge`,_s[se?.severity]),children:m.length}):null,ae?u(`button`,{type:`button`,title:O(`Toggle section`),class:`bio-properties-panel-group-header-button bio-properties-panel-arrow`,children:u(Arrow,{class:I?`bio-properties-panel-arrow-down`:`bio-properties-panel-arrow-right`})}):null]})]}),u(`div`,{class:(0,es.default)(`bio-properties-panel-list`,I&&ae?`open`:``),children:u(os.Provider,{value:oe,children:m.map((e,n)=>{if(!e)return;let{id:c}=e,m=ie.includes(e.id);return k$2(ListItem,{...e,autoOpen:m,element:a,index:n,key:c,translate:O})})})})]})}function getNewItemIds(e,n){let a=e.map(e=>e.id),c=n.map(e=>e.id);return a.filter(e=>!c.includes(e))}function Description(e){let{element:n,forId:a,value:c}=e,m=useDescriptionContext(a,n),v=c||m;if(v)return u(`div`,{class:`bio-properties-panel-description`,children:v})}var vs={error:`bio-properties-panel-error`,warning:`bio-properties-panel-warning`,info:`bio-properties-panel-info`};function DiagnosticMessage(e){let{diagnostic:n,forId:a,element:c}=e;if(!n)return null;let{action:m,message:v,severity:T}=n;return u(`div`,{class:vs[T],children:[v&&u(`span`,{class:(0,es.default)(`bio-properties-panel-error-message`,`bio-properties-panel-diagnostic-message`),children:[T===`info`&&u(Info,{class:`bio-properties-panel-diagnostic-icon`,"aria-hidden":`true`}),v]}),m&&u(DiagnosticAction,{action:m,forId:a,element:c})]})}function DiagnosticAction(e){let{action:n,forId:a,element:c}=e,m=A$1();return h(()=>()=>{let e=m.current;if(e&&e===document.activeElement){let e=document.getElementById(prefixId$a(a));e&&e.focus()}},[a]),u(TooltipWrapper,{value:n.tooltip,forId:`${a}-diagnostic-action`,element:c,focusable:!1,children:u(`button`,{type:`button`,ref:m,id:prefixId$a(`${a}-diagnostic-action`),class:(0,es.default)(`bio-properties-panel-error-action`,`bio-properties-panel-diagnostic-action`),onClick:n.onClick,"aria-label":n.ariaLabel,"aria-describedby":n.tooltip?cs:void 0,children:n.label})})}function prefixId$a(e){return`bio-properties-panel-${e}`}function Checkbox(e){let{id:n,label:a,onChange:c,disabled:m,value:v=!1,onFocus:T,onBlur:O,tooltip:A}=e,[I,L]=d(v),handleChangeCallback=({target:e})=>{c(e.checked)},handleChange=e=>{handleChangeCallback(e),L(e.target.value)};return h(()=>{v!==I&&L(v)},[v]),u(`div`,{class:`bio-properties-panel-checkbox`,children:[u(`input`,{ref:useShowEntryEvent(n),id:prefixId$9(n),name:n,onFocus:T,onBlur:O,type:`checkbox`,class:`bio-properties-panel-input`,onChange:handleChange,checked:I,disabled:m}),u(`label`,{for:prefixId$9(n),class:`bio-properties-panel-label`,children:u(TooltipWrapper,{value:A,forId:n,element:e.element,children:a})})]})}function CheckboxEntry(e){let{element:n,id:a,description:c,label:m,getValue:v,setValue:T,disabled:O,onFocus:A,onBlur:I,tooltip:L}=e,U=v(n),G=useDisplayedDiagnostic(a);return u(`div`,{class:(0,es.default)(`bio-properties-panel-entry`,`bio-properties-panel-checkbox-entry`,getDiagnosticClass(G)),"data-entry-id":a,children:[u(Checkbox,{disabled:O,id:a,label:m,onChange:T,onFocus:A,onBlur:I,value:U,tooltip:L,element:n},n),u(DiagnosticMessage,{diagnostic:G,forId:a,element:n}),u(Description,{forId:a,element:n,value:c})]})}function isEdited$9(e){return e&&!!e.checked}function prefixId$9(e){return`bio-properties-panel-${e}`}function CheckboxGroup(e){let{element:n,id:a,label:c,description:m,tooltip:v,options:T=[],getValue:O,setValue:A,disabled:I,onFocus:L,onBlur:U}=e,G=O(n)||[],handleOptionChange=(e,n)=>{let a=n?[...G,e]:G.filter(n=>n!==e);A(a)};return u(`div`,{class:`bio-properties-panel-entry bio-properties-panel-checkbox-group`,"data-entry-id":a,children:[u(`div`,{class:`bio-properties-panel-group-header`,children:u(`p`,{class:`bio-properties-panel-label`,children:u(TooltipWrapper,{value:v,forId:a,element:n,children:c})})}),u(`div`,{class:`bio-properties-panel-checkbox-group-entries`,children:T.map(e=>u(CheckboxEntry,{id:`${a}-${e.value}`,label:e.label,setValue:n=>handleOptionChange(e.value,n),getValue:()=>G.includes(e.value),disabled:I,onFocus:L,onBlur:U,element:n},e.value))}),u(Description,{forId:a,element:n,value:m})]})}var ys=Jt.define(),bs=on();function JsonEditor(e){let{id:n,label:a,debounce:c,value:m=``,onInput:v,disabled:T,placeholder:O,tooltip:A,element:I}=e,L=A$1(null),U=A$1(null),G=useShowEntryEvent(n),K=useDebounce(useStaticCallback(e=>{v(e===``?void 0:e)}),c);h(()=>{let e=new Bt({state:Kt.create({doc:m,extensions:[Ut(),en(),zt(),Vt(Wt,{fallback:!0}),Gt(),qt(),Qt(),Ht.of([...rn,...$t,...Zt,...Xt]),Kt.tabSize.of(2),Bt.lineWrapping,Kt.readOnly.of(!!T),...O?[Yt(O)]:[],Bt.updateListener.of(e=>{let n=e.transactions.some(e=>e.annotation(ys));e.docChanged&&!n&&K(e.state.doc.toString())}),an(),cn(e=>e.state.doc.toString().trim()?bs(e):[],{delay:300})]}),parent:L.current});U.current=e,G.current=e.contentDOM;let c=`bio-properties-panel-${n}`;return e.contentDOM.setAttribute(`id`,c),e.contentDOM.setAttribute(`aria-label`,a),()=>{e.destroy()}},[]),h(()=>{let e=U.current;if(!e)return;let n=e.state.doc.toString();m!==n&&e.dispatch({changes:{from:0,to:n.length,insert:m||``},annotations:ys.of(!0)})},[m]);let focusEditor=()=>{U.current&&U.current.focus()};return u(`div`,{class:`bio-properties-panel-json-editor`,children:[u(`label`,{class:`bio-properties-panel-label`,onClick:focusEditor,children:u(TooltipWrapper,{value:A,forId:n,element:I,children:a})}),u(`div`,{class:(0,es.default)(`bio-properties-panel-input`,m&&`edited`),ref:L})]})}function JsonEditorEntry(e){let{element:n,id:a,description:c,debounce:m,label:v,getValue:T,setValue:O,disabled:A,placeholder:I,tooltip:L,validate:U,translate:G=translateFallback}=e,K=useDiagnostics(a),q=T(n),[ee,te]=d(()=>computeDiagnostic(ht(U)?U(q):null,q,G)),[ne,J]=d(q);h(()=>{q!==ne&&(J(q),te(computeDiagnostic(ht(U)?U(q):null,q,G)))},[q,U]);let re=useStaticCallback(e=>{if(J(e),e!==T(n)){let n=ht(U)?U(e):null;O(e,n),te(computeDiagnostic(n,e,G))}}),ie=getMostSevere([...K,ee]);return u(`div`,{class:(0,es.default)(`bio-properties-panel-entry`,getDiagnosticClass(ie)),"data-entry-id":a,children:[u(JsonEditor,{id:a,label:v,debounce:m,value:q,onInput:re,disabled:A,placeholder:I,tooltip:L,element:n},n),u(DiagnosticMessage,{diagnostic:ie,forId:a,element:n}),u(Description,{forId:a,element:n,value:c})]})}function isEdited$8(e){return e&&e.classList.contains(`edited`)}function computeDiagnostic(e,n,a){return getMostSevere([e,validateJson(n,a)])}function validateJson(e,n=translateFallback){if(!e||!e.trim())return null;try{return _t(JSON.parse(e))?null:n(`JSON contains errors`)}catch{return n(`JSON contains errors`)}}function OpenPopupButton({onClick:e,title:n,translate:a=translateFallback}){return n??=a(`Open pop-up editor`),u(`button`,{type:`button`,title:n,class:`bio-properties-panel-open-feel-popup`,onClick:e,children:u(OpenPopup,{})})}var noop$5=()=>{},useBufferedFocus$1=function(e,n){let[a,c]=d(void 0);n.current=T$1(()=>({focus:n=>{e?e.focus(n):(n===void 0&&(n=1/0),c(n))}}),[e]),h(()=>{a!==void 0&&e&&(e.focus(a),c(!1))},[e,a])},xs=D((e,n)=>{let{onInput:a,disabled:c,tooltipContainer:m,enableGutters:v,value:T,onLint:O=noop$5,onOpenPopup:A=noop$5,popupOpen:I,contentAttributes:L={},hostLanguage:U=null,singleLine:G=!1}=e,K=A$1(),[q,ee]=d(),[te,ne]=d(T||``);useBufferedFocus$1(q,n);let J=useStaticCallback(e=>{a(e),ne(e)});h(()=>{let e;return e=new Lt({container:K.current,onChange:J,value:te,onLint:O,contentAttributes:L,tooltipContainer:m,enableGutters:v,hostLanguage:U,singleLine:G,lineWrap:!0}),ee(e),()=>{O([]),K.current.innerHTML=``,ee(null)}},[]),h(()=>{q&&T!==te&&(q.setValue(T),ne(T))},[T]);let handleClick=()=>{n.current.focus()};return u(`div`,{class:(0,es.default)(`bio-properties-panel-feelers-editor-container`,I?`popupOpen`:null),children:[I&&u(`div`,{class:`bio-properties-panel-feelers-editor__popup-placeholder`,children:`Opened in popup`}),u(`div`,{name:e.name,class:(0,es.default)(`bio-properties-panel-feelers-editor bio-properties-panel-input`,te?`edited`:null,c?`disabled`:null),ref:K,onClick:handleClick}),!c&&u(OpenPopupButton,{onClick:()=>A(`feelers`)})]})}),noop$4=()=>{},useBufferedFocus=function(e,n){let[a,c]=d(void 0);n.current=T$1(()=>({focus:n=>{e?e.focus(n):(n===void 0&&(n=1/0),c(n))}}),[e]),h(()=>{a!==void 0&&e&&(e.focus(a),c(!1))},[e,a])},Ss=D((e,n)=>{let{contentAttributes:a,enableGutters:c,value:m,onInput:v,onKeyDown:T=noop$4,onBlur:O=noop$4,onFeelToggle:A=noop$4,onLint:I=noop$4,onOpenPopup:L=noop$4,placeholder:U,popupOpen:G,disabled:K,tooltipContainer:q,variables:ee,feelLanguageContext:te,translate:ne=translateFallback}=e,J=A$1(),[re,ie]=d(),[ae,oe]=d(m||``),{builtins:se,dialect:ce,parserDialect:le,engines:ue}=te||{};useBufferedFocus(re,n);let de=useStaticCallback(e=>{v(e),oe(e)}),fe=useStaticCallback(()=>{O()});h(()=>{let e,onKeyDown=n=>{if(T(n),n.key!==`Backspace`||!e)return;let a=e.getSelection(),c=a.ranges[a.mainIndex];c.from===0&&c.to===0&&A()};return e=new It({container:J.current,onChange:de,onKeyDown,onLint:I,placeholder:U,readOnly:K,tooltipContainer:q,value:ae,variables:ee,builtins:se,dialect:ce,parserDialect:le,engines:ue,extensions:[...c?[Rt()]:[],Bt.lineWrapping,Bt.domEventHandlers({blur:fe})],contentAttributes:a}),ie(e),()=>{I([]),J.current.innerHTML=``,ie(null)}},[]),h(()=>{re&&m!==ae&&(re.setValue(m),oe(m))},[m]),h(()=>{re&&re.setVariables(ee)},[ee]),h(()=>{re&&re.setPlaceholder(U)},[U]),h(()=>{re&&re.setEngines(ue)},[ue]);let handleClick=()=>{n.current.focus()};return u(`div`,{class:(0,es.default)(`bio-properties-panel-feel-editor-container`,K?`disabled`:null,G?`popupOpen`:null),children:[G&&u(`div`,{class:`bio-properties-panel-feel-editor__open-popup-placeholder`,children:ne(`Opened in editor`)}),u(`div`,{name:e.name,class:(0,es.default)(`bio-properties-panel-input`,ae?`edited`:null),ref:J,onClick:handleClick}),!K&&u(OpenPopupButton,{onClick:()=>L(`feel`),translate:ne})]})});function FeelIndicator(e){let{active:n}=e;return n?u(`span`,{class:`bio-properties-panel-feel-indicator`,children:`=`}):null}var noop$3=()=>{};function FeelIcon(e){let{feel:n=!1,active:a,disabled:c=!1,onClick:m=noop$3,translate:v=translateFallback}=e,T=v(`FEEL expression is mandatory`),O=v(`Click to ${a?`remove`:`set a`} dynamic value with FEEL expression`),handleClick=e=>{m(e),e.pointerType||e.stopPropagation()};return u(`button`,{type:`button`,class:(0,es.default)(`bio-properties-panel-feel-icon`,a?`active`:null,n===`required`?`required`:`optional`),onClick:handleClick,disabled:n===`required`||c,title:n===`required`?T:O,children:u(Feel,{})})}function isCmd(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function isCmdWithChar(e){return isCmd(e)&&e.key.length===1&&/^[a-zA-Z]$/.test(e.key)}function ToggleSwitch(e){let{id:n,label:a,onInput:c,value:m,switcherLabel:v,inline:T,onFocus:O,onBlur:A,inputRef:I,tooltip:L}=e,[U,G]=d(m),handleInputCallback=async()=>{c(!m)},handleInput=e=>{handleInputCallback(),G(e.target.value)};return h(()=>{m!==U&&G(m)},[m]),u(`div`,{class:(0,es.default)(`bio-properties-panel-toggle-switch`,{inline:T}),children:[u(`label`,{class:`bio-properties-panel-label`,for:prefixId$8(n),children:u(TooltipWrapper,{value:L,forId:n,element:e.element,children:a})}),u(`div`,{class:`bio-properties-panel-field-wrapper`,children:[u(`label`,{class:`bio-properties-panel-toggle-switch__switcher`,children:[u(`input`,{ref:I,id:prefixId$8(n),class:`bio-properties-panel-input`,type:`checkbox`,onFocus:O,onBlur:A,name:n,onInput:handleInput,checked:!!U}),u(`span`,{class:`bio-properties-panel-toggle-switch__slider`})]}),v&&u(`p`,{class:`bio-properties-panel-toggle-switch__label`,children:v})]})]})}function ToggleSwitchEntry(e){let{element:n,id:a,description:c,label:m,switcherLabel:v,inline:T,getValue:O,setValue:A,onFocus:I,onBlur:L,tooltip:U}=e;return u(`div`,{class:`bio-properties-panel-entry bio-properties-panel-toggle-switch-entry`,"data-entry-id":a,children:[u(ToggleSwitch,{id:a,label:m,value:O(n),onInput:A,onFocus:I,onBlur:L,switcherLabel:v,inline:T,tooltip:U,element:n},n),u(Description,{forId:a,element:n,value:c})]})}function isEdited$7(e){return e&&!!e.checked}function prefixId$8(e){return`bio-properties-panel-${e}`}function NumberField(e){let{debounce:n,disabled:a,displayLabel:c=!0,id:m,inputRef:v,label:T,max:O,min:A,onInput:I,step:L,value:U=``,onFocus:G,onBlur:K,onKeyDown:q,tooltip:ee}=e,[te,ne]=d(U),J=T$1(()=>n(e=>{e.validity.valid&&I(e.value?parseFloat(e.value):void 0)}),[I,n]),handleInput=e=>{J(e.target),ne(e.target.value)};return h(()=>{U!==te&&ne(U)},[U]),u(`div`,{class:`bio-properties-panel-numberfield`,children:[c&&u(`label`,{for:prefixId$7(m),class:`bio-properties-panel-label`,children:u(TooltipWrapper,{value:ee,forId:m,element:e.element,children:T})}),u(`input`,{id:prefixId$7(m),ref:v,type:`number`,name:m,spellCheck:`false`,autoComplete:`off`,disabled:a,class:`bio-properties-panel-input`,max:O,min:A,onInput:handleInput,onFocus:G,onBlur:K,onKeyDown:q,step:L,value:te})]})}function NumberFieldEntry(e){let{debounce:n,description:a,disabled:c,element:m,getValue:v,id:T,label:O,max:A,min:I,setValue:L,step:U,onFocus:G,onBlur:K,validate:q,tooltip:ee}=e,te=useDiagnostics(T),[ne,J]=d(null),re=v(m);h(()=>{if(ht(q)){let e=q(re)||null;J(e)}},[re,q]);let onInput=e=>{if(e!==re){let n=null;ht(q)&&(n=q(e)||null),L(e,n),J(n)}},ie=getMostSevere([...te,ne]);return u(`div`,{class:(0,es.default)(`bio-properties-panel-entry`,getDiagnosticClass(ie)),"data-entry-id":T,children:[u(NumberField,{debounce:n,disabled:c,id:T,label:O,onFocus:G,onBlur:K,onInput,max:A,min:I,step:U,value:re,tooltip:ee},m),u(DiagnosticMessage,{diagnostic:ie,forId:T,element:m}),u(Description,{forId:T,element:m,value:a})]})}function isEdited$6(e){return e&&!!e.value}function prefixId$7(e){return`bio-properties-panel-${e}`}var noop$2=()=>{};function FeelTextfield(e){let{debounce:n,id:a,element:c,label:m,hostLanguage:v,onInput:T,onBlur:O,onError:A,placeholder:I,feel:L,value:U=``,disabled:G=!1,variables:K,singleLine:q,tooltipContainer:ee,OptionalComponent:te=Cs,tooltip:ne,translate:J}=e,[re,ie]=d(getInitialFeelLocalValue(L,U)),ae=useShowEntryEvent(a),oe=A$1(),se=q$1(e=>{T(e===``||e===`=`?void 0:e)},[T]),ce=isFeelActive(L,re),le=getFeelValue(re),ue=x$1(as),[de,fe]=d(void 0),{eventBus:pe}=x$1(is),[me,he]=d(!1),setFocus=(e=0)=>{let n=oe.current.contains(document.activeElement)?document.activeElement.selectionStart:1/0;fe(n+e)},ge=useDebounce(se,n),setAndCommitValue=e=>{ge.cancel?.(),ie(e),se(e)},_e=useStaticCallback(()=>{L!==`required`&&setAndCommitValue(ce?le:`=`+re)}),handleInputChange=e=>{ce&&(e=`=`+e),e!==re&&(ie(e),ge(e),!ce&&Nt(e)&&e.startsWith(`=`)&&setFocus(-1))},handleOptionalInputOnBlur=e=>{if(e.target.type===`checkbox`)setAndCommitValue(e.target.checked);else{let n=e.target.value.trim();n===re?ge.flush?.():setAndCommitValue(n)}O&&O(e)},handleFeelEditorOnBlur=()=>{ge.flush?.()},handleOnKeyDown=e=>{let n=(e.ctrlKey||e.metaKey)&&!e.getModifierState?.(`AltGraph`);e.key===`=`&&!n&&!ce&&isFeelOptional(L)&&!G&&e.target.type===`number`&&!e.target.value?(e.preventDefault(),_e(),fe(1/0)):isCmdWithChar(e)&&ge.flush?.()},ve=useStaticCallback((e=[])=>{e.some(e=>e.type===`Syntax Error`)?A(J(`Unparsable FEEL expression.`)):A(void 0)}),handleOpenPopup=(e=`feel`)=>{let n=pe.fire(`propertiesPanel.openPopup`,{element:c,entryId:a,hostLanguage:v,label:m,onInput:handleInputChange,singleLine:q,sourceElement:ae.current,tooltipContainer:ee,type:e,value:le,variables:K,feelLanguageContext:ue});n&&pe.once(`propertiesPanelPopup.close`,()=>{he(!1)}),he(n===!0)};return h(()=>{de!==void 0&&(ae.current.focus(de),fe(void 0))},[de]),h(()=>{U!==re&&ie(U||(ce?`=`:``))},[U]),h(()=>()=>{pe.fire(`propertiesPanel.closePopup`)},[]),h(()=>{let copyHandler=e=>{ce&&e.clipboardData.setData(`application/FEEL`,e.clipboardData.getData(`text`))},pasteHandler=e=>{if(ce||me)return;if(e.clipboardData.getData(`application/FEEL`)){setTimeout(()=>{_e(),setFocus()});return}let n=e.target;if(!(n instanceof HTMLInputElement)&&!(n instanceof HTMLTextAreaElement))return;let a=!n.value,c=n.selectionStart===0&&n.selectionEnd===n.value.length;if(a||c){let n=e.clipboardData.getData(`text`).trim();setAndCommitValue(n),!ce&&Nt(n)&&n.startsWith(`=`)&&setFocus(n.length-1),e.preventDefault()}};return oe.current.addEventListener(`copy`,copyHandler),oe.current.addEventListener(`cut`,copyHandler),oe.current.addEventListener(`paste`,pasteHandler),()=>{oe.current.removeEventListener(`copy`,copyHandler),oe.current.removeEventListener(`cut`,copyHandler),oe.current.removeEventListener(`paste`,pasteHandler)}},[oe,ce,_e,setFocus]),u(`div`,{class:(0,es.default)(`bio-properties-panel-feel-entry`,{"feel-active":ce}),children:[u(`label`,{for:prefixId$6(a),class:`bio-properties-panel-label`,onClick:()=>setFocus(),children:[u(TooltipWrapper,{value:ne,forId:a,element:e.element,children:m}),u(FeelIcon,{label:m,feel:L,onClick:_e,active:ce,translate:J})]}),u(`div`,{class:`bio-properties-panel-feel-container`,ref:oe,children:[u(FeelIndicator,{active:ce,disabled:!isFeelOptional(L)||G,onClick:_e}),ce?u(Ss,{name:a,onInput:handleInputChange,onBlur:handleFeelEditorOnBlur,onKeyDown:handleOnKeyDown,contentAttributes:{id:prefixId$6(a),"aria-label":m},disabled:G,popupOpen:me,onFeelToggle:()=>{_e(),setFocus(!0)},onLint:ve,onOpenPopup:handleOpenPopup,placeholder:I,value:le,variables:K,feelLanguageContext:ue,ref:ae,tooltipContainer:ee,translate:J}):u(te,{...e,popupOpen:me,onInput:handleInputChange,onKeyDown:handleOnKeyDown,onBlur:handleOptionalInputOnBlur,contentAttributes:{id:prefixId$6(a),"aria-label":m},value:re,ref:ae,onOpenPopup:handleOpenPopup,containerRef:oe})]})]})}var Cs=D((e,n)=>{let{id:a,disabled:c,onInput:m,onKeyDown:v,value:T,onFocus:O,onBlur:A,placeholder:I}=e,L=A$1();return n.current={focus:e=>{let n=L.current;n&&(n.focus(),typeof e==`number`&&(e>T.length&&(e=T.length),n.setSelectionRange(e,e)))}},u(`input`,{id:prefixId$6(a),type:`text`,ref:L,name:a,spellCheck:`false`,autoComplete:`off`,disabled:c,class:`bio-properties-panel-input`,onInput:e=>m(e.target.value),onFocus:O,onKeyDown:v,onBlur:A,placeholder:I,value:T||``})}),ws=D((e,n)=>{let{id:a,debounce:c,disabled:m,onInput:v,value:T,min:O,max:A,step:I,onFocus:L,onBlur:U,onKeyDown:G}=e,K=A$1();return n.current={focus:()=>{let e=K.current;e&&e.focus()}},u(NumberField,{id:a,debounce:c,disabled:m,displayLabel:!1,inputRef:K,max:A,min:O,onInput:v,step:I,value:T,onFocus:L,onBlur:U,onKeyDown:G})}),Ts=D((e,n)=>{let{id:a,disabled:c,onInput:m,value:v,onFocus:T,onBlur:O,placeholder:A}=e,I=A$1();return n.current={focus:()=>{let e=I.current;e&&(e.focus(),e.setSelectionRange(0,0))}},u(`textarea`,{id:prefixId$6(a),type:`text`,ref:I,name:a,spellCheck:`false`,autoComplete:`off`,disabled:c,class:`bio-properties-panel-input`,onInput:e=>m(e.target.value),onFocus:T,onBlur:O,placeholder:A,value:v||``,"data-gramm":`false`})});D((e,n)=>{let{id:a,onInput:c,value:m,onFocus:v,onBlur:T,switcherLabel:O}=e,A=A$1();return n.current={focus:()=>{let e=A.current;e&&e.focus()}},u(ToggleSwitch,{id:a,value:m,inputRef:A,onInput:c,onFocus:v,onBlur:T,switcherLabel:O})});var Es=D((e,n)=>{let{id:a,disabled:c,onInput:m,value:v,onFocus:T,onBlur:O}=e,A=A$1(),handleChange=({target:e})=>{m(e.checked)};return n.current={focus:()=>{let e=A.current;e&&e.focus()}},u(`input`,{ref:A,id:prefixId$6(a),name:a,onFocus:T,onBlur:O,type:`checkbox`,class:`bio-properties-panel-input`,onChange:handleChange,checked:v,disabled:c})});function FeelEntry(e){let{element:n,id:a,description:c,debounce:m,disabled:v,feel:T,label:O,getValue:A,setValue:I,tooltipContainer:L,hostLanguage:U,singleLine:G,validate:K,show:q=noop$2,example:ee,variables:te,onFocus:ne,onBlur:J,placeholder:re,tooltip:ie,translate:ae=translateFallback}=e,[oe,se]=d(null),[ce,le]=d(null),ue=A(n);h(()=>{if(ht(K)){let e=K(ue)||null;se(e)}},[ue,K]);let de=useStaticCallback(e=>{if(e!==A(n)){let n=null;ht(K)&&(n=K(e)||null),I(e,n),se(n)}}),fe=q$1(e=>{le(e)},[]),pe=getMostSevere([...useDiagnostics(a),ce,oe]);return u(`div`,{class:(0,es.default)(e.class,`bio-properties-panel-entry`,getDiagnosticClass(pe)),"data-entry-id":a,children:[k$2(FeelTextfield,{...e,debounce:m,disabled:v,feel:T,id:a,key:n,label:O,onInput:de,onError:fe,onFocus:ne,onBlur:J,placeholder:re,example:ee,hostLanguage:U,singleLine:G,show:q,translate:ae,value:ue,variables:te,tooltipContainer:L,OptionalComponent:e.OptionalComponent,tooltip:ie}),u(DiagnosticMessage,{diagnostic:pe,forId:a,element:n}),u(Description,{forId:a,element:n,value:c})]})}function FeelNumberEntry(e){return u(FeelEntry,{class:`bio-properties-panel-feel-number`,OptionalComponent:ws,...e})}function FeelTextAreaEntry(e){return u(FeelEntry,{class:`bio-properties-panel-feel-textarea`,OptionalComponent:Ts,...e})}function FeelCheckboxEntry(e){return u(FeelEntry,{class:`bio-properties-panel-feel-checkbox`,OptionalComponent:Es,...e})}function isEdited$5(e){return e?e.type===`checkbox`?!!e.checked||e.classList.contains(`edited`):!!e.value||e.classList.contains(`edited`):!1}function prefixId$6(e){return`bio-properties-panel-${e}`}function isFeelOptional(e){return e===`optional`||e===`optional-default-enabled`}function isFeelActive(e,n){return!!(e===`required`||Nt(n)&&n.startsWith(`=`))}function getFeelValue(e){return Nt(e)&&e.startsWith(`=`)?e.substring(1):e}function getInitialFeelLocalValue(e,n){return e===`optional-default-enabled`&&(n===void 0||n===``)?`=`:n}function List(e){let{id:n,element:a,items:c=[],component:m,label:v=`<empty>`,open:T,onAdd:O,onRemove:A,autoFocusEntry:I,translate:L=translateFallback,...U}=e,G=A$1(null),[K,q]=d(!!T),[ee,te]=d(!1),ne=!!c.length,toggleOpen=()=>ne&&q(!K),J=useNewItems(c,usePrevious(a)!==a);h(()=>{K&&!ne&&q(!1)},[K,ne]);function addItem(e){e.stopPropagation(),O(),K||q(!0)}return useStickyIntersectionObserver(G,`div.bio-properties-panel-scroll-container`,te),u(`div`,{"data-entry-id":n,class:(0,es.default)(`bio-properties-panel-entry`,`bio-properties-panel-list-entry`,ne?``:`empty`,K?`open`:``),ref:G,children:[u(`div`,{class:(0,es.default)(`bio-properties-panel-list-entry-header`,ee&&K?`sticky`:``),onClick:toggleOpen,children:[u(`div`,{class:(0,es.default)(`bio-properties-panel-list-entry-header-title`,K&&`open`),children:v}),u(`div`,{class:`bio-properties-panel-list-entry-header-buttons`,children:[u(`button`,{type:`button`,title:L(`Create new list item`),onClick:addItem,class:`bio-properties-panel-add-entry`,children:[u(Create,{}),ne?null:u(`span`,{class:`bio-properties-panel-add-entry-label`,children:L(`Create`)})]}),ne&&u(`div`,{title:L(`List contains {numOfItems} item${c.length==1?``:`s`}`,{numOfItems:c.length}),class:`bio-properties-panel-list-badge`,children:c.length}),ne&&u(`button`,{type:`button`,title:L(`Toggle list item`),class:`bio-properties-panel-arrow`,children:u(Arrow,{class:K?`bio-properties-panel-arrow-down`:`bio-properties-panel-arrow-right`})})]})]}),ne&&u(ItemsList,{...U,autoFocusEntry:I,component:m,element:a,id:n,items:c,newItems:J,onRemove:A,open:K,translate:L})]})}function ItemsList(e){let{autoFocusEntry:n,component:a,element:c,id:m,items:v,newItems:T,onRemove:O,open:A,translate:I,...L}=e,U=useKeyFactory(),G=T[0];return h(()=>{if(G&&n){let e=Qe(`[data-entry-id="${m}"]`),a=Qe(typeof n==`boolean`?`.bio-properties-panel-input`:n,e);a&&(ht(a.select)?a.select():ht(a.focus)&&a.focus())}},[G,n,m]),u(`ol`,{class:(0,es.default)(`bio-properties-panel-list-entry-items`,A?`open`:``),children:v.map((e,n)=>{let v=U(e);return u(`li`,{class:`bio-properties-panel-list-entry-item`,children:[u(a,{...L,element:c,id:m,index:n,item:e,open:e===G}),O&&u(`button`,{type:`button`,title:I(`Delete item`),class:`bio-properties-panel-remove-entry bio-properties-panel-remove-list-entry`,onClick:()=>O&&O(e),children:u(Delete,{})})]},v)})})}function useNewItems(e=[],n){let a=usePrevious(e.slice())||[];return n?[]:a?e.filter(e=>!a.includes(e)):[]}function Select(e){let{id:n,label:a,onChange:c,options:m=[],value:v=``,disabled:T,onFocus:O,onBlur:A,tooltip:I}=e,L=useShowEntryEvent(n),[U,G]=d(v),handleChangeCallback=({target:e})=>{c(e.value)},handleChange=e=>{handleChangeCallback(e),G(e.target.value)};return h(()=>{v!==U&&G(v)},[v]),u(`div`,{class:`bio-properties-panel-select`,children:[u(`label`,{for:prefixId$4(n),class:`bio-properties-panel-label`,children:u(TooltipWrapper,{value:I,forId:n,element:e.element,children:a})}),u(`select`,{ref:L,id:prefixId$4(n),name:n,class:`bio-properties-panel-input`,onInput:handleChange,onFocus:O,onBlur:A,value:U,disabled:T,children:m.map((e,n)=>e.children?u(`optgroup`,{label:e.label,children:e.children.map((e,n)=>u(`option`,{value:e.value,disabled:e.disabled,children:e.label},n))},n):u(`option`,{value:e.value,disabled:e.disabled,children:e.label},n))})]})}function SelectEntry(e){let{element:n,id:a,description:c,label:m,getValue:v,setValue:T,getOptions:O,disabled:A,onFocus:I,onBlur:L,validate:U,tooltip:G}=e,K=O(n),q=useDiagnostics(a),[ee,te]=d(null),ne=v(n);h(()=>{if(ht(U)){let e=U(ne)||null;te(e)}},[ne,U]);let onChange=e=>{if(e!==ne){let n=null;ht(U)&&(n=U(e)||null),T(e,n),te(n)}},J=getMostSevere([...q,ee]);return u(`div`,{class:(0,es.default)(`bio-properties-panel-entry`,getDiagnosticClass(J)),"data-entry-id":a,children:[u(Select,{id:a,label:m,value:ne,onChange,onFocus:I,onBlur:L,options:K,disabled:A,tooltip:G,element:n},n),u(DiagnosticMessage,{diagnostic:J,forId:a,element:n}),u(Description,{forId:a,element:n,value:c})]})}function isEdited$3(e){return e&&!!e.value}function prefixId$4(e){return`bio-properties-panel-${e}`}function Simple(e){let{debounce:n,disabled:a,element:c,getValue:m,id:v,onBlur:T,onFocus:O,setValue:A,translate:I=translateFallback}=e,L=m(c),[U,G]=d(L),K=T$1(()=>n(e=>A(e.value.length?e.value:void 0)),[A,n]),handleInput=e=>{K(e.target),G(e.target.value)};return h(()=>{L!==U&&G(L)},[L]),u(`div`,{class:`bio-properties-panel-simple`,children:u(`input`,{id:prefixId$3(v),type:`text`,name:v,spellCheck:`false`,autoComplete:`off`,disabled:a,class:`bio-properties-panel-input`,onInput:handleInput,"aria-label":U||I(`<empty>`),onFocus:O,onBlur:T,value:U},c)})}function prefixId$3(e){return`bio-properties-panel-${e}`}function TextArea(e){let{id:n,element:a,label:c,debounce:m,onInput:v,value:T=``,disabled:O,monospace:A,onFocus:I,onBlur:L,onPaste:U,autoResize:G=!0,placeholder:K,rows:q=G?1:2,tooltip:ee,translate:te=translateFallback}=e,[ne,J]=d(T),re=useShowEntryEvent(n),ie=A$1(),ae=A$1(ne);ae.current=ne;let{eventBus:oe}=x$1(is),[se,ce]=d(!1),le=q$1(e=>{v(e===``?void 0:e)},[v]),ue=useDebounce(le,m),handleLocalInput=e=>{e.target.value!==ne&&(J(e.target.value),ue(e.target.value))},handleOnBlur=e=>{let n=e.target.value.trim();ue.cancel?.(),le(n),J(n),L&&L(e)},handleOnPaste=e=>{let n=e.target,a=!n.value,c=n.selectionStart===0&&n.selectionEnd===n.value.length;if(a||c){let n=e.clipboardData.getData(`text`).trim();J(n),ue(n),U&&U(e),e.preventDefault()}else U&&U(e)},handleOnKeyDown=e=>{isCmdWithChar(e)&&ue.flush?.()},handlePopupInput=e=>{e!==ae.current&&(J(e),ue(e))},handleOpenPopup=()=>{let e=oe.fire(`propertiesPanel.openPopup`,{element:a,entryId:n,label:c,onInput:handlePopupInput,sourceElement:re.current,value:ne});e&&oe.once(`propertiesPanelPopup.close`,()=>{ue.flush?.(),ce(!1)}),ce(e===!0)};return h(()=>()=>{oe&&oe.fire(`propertiesPanel.closePopup`)},[]),h(()=>{T!==ne&&J(T)},[T]),u(`div`,{class:`bio-properties-panel-textarea`,children:[u(`label`,{for:prefixId$2(n),class:`bio-properties-panel-label`,children:u(TooltipWrapper,{value:ee,forId:n,element:a,children:c})}),u(`div`,{class:(0,es.default)(`bio-properties-panel-textarea-container`,se?`popupOpen`:null),ref:ie,children:[se&&u(`div`,{class:`bio-properties-panel-textarea__open-popup-placeholder`,children:te(`Opened in editor`)}),u(`textarea`,{ref:re,id:prefixId$2(n),name:n,spellCheck:`false`,class:(0,es.default)(`bio-properties-panel-input`,A?`bio-properties-panel-input-monospace`:``,G?`auto-resize`:``),onInput:handleLocalInput,onFocus:I,onKeyDown:handleOnKeyDown,onBlur:handleOnBlur,onPaste:handleOnPaste,placeholder:K,rows:q,value:ne,disabled:O,"data-gramm":`false`}),oe&&!O&&u(OpenPopupButton,{onClick:handleOpenPopup,translate:te})]})]})}function TextAreaEntry(e){let{element:n,id:a,description:c,debounce:m,label:v,getValue:T,setValue:O,rows:A,monospace:I,disabled:L,validate:U,onFocus:G,onBlur:K,onPaste:q,placeholder:ee,autoResize:te,tooltip:ne,translate:J}=e,re=useDiagnostics(a),[ie,ae]=d(null),oe=T(n);h(()=>{if(ht(U)){let e=U(oe)||null;ae(e)}},[oe,U]);let se=useStaticCallback(e=>{if(e!==T(n)){let n=null;ht(U)&&(n=U(e)||null),O(e,n),ae(n)}}),ce=getMostSevere([...re,ie]);return u(`div`,{class:(0,es.default)(`bio-properties-panel-entry`,getDiagnosticClass(ce)),"data-entry-id":a,children:[u(TextArea,{id:a,label:v,value:oe,onInput:se,onFocus:G,onBlur:K,onPaste:q,rows:A,debounce:m,monospace:I,disabled:L,placeholder:ee,autoResize:te,tooltip:ne,translate:J,element:n},n),u(DiagnosticMessage,{diagnostic:ce,forId:a,element:n}),u(Description,{forId:a,element:n,value:c})]})}function isEdited$1(e){return e&&!!e.value}function prefixId$2(e){return`bio-properties-panel-${e}`}function Textfield(e){let{debounce:n,disabled:a=!1,id:c,label:m,onInput:v,onFocus:T,onBlur:O,onPaste:A,placeholder:I,value:L=``,tooltip:U}=e,[G,K]=d(L||``),q=useShowEntryEvent(c),ee=q$1(e=>{v(e===``?void 0:e)},[v]),te=useDebounce(ee,n),handleOnBlur=e=>{let n=e.target.value.trim();te.cancel?.(),ee(n),K(n),O&&O(e)},handleOnPaste=e=>{let n=e.target,a=!n.value,c=n.selectionStart===0&&n.selectionEnd===n.value.length;if(a||c){let n=e.clipboardData.getData(`text`).trim();K(n),te(n),A&&A(e),e.preventDefault()}else A&&A(e)},handleLocalInput=e=>{e.target.value!==G&&(K(e.target.value),te(e.target.value))};h(()=>{L!==G&&K(L)},[L]);let handleOnKeyDown=e=>{isCmdWithChar(e)&&te.flush?.()};return u(`div`,{class:`bio-properties-panel-textfield`,children:[u(`label`,{for:prefixId$1(c),class:`bio-properties-panel-label`,children:u(TooltipWrapper,{value:U,forId:c,element:e.element,children:m})}),u(`input`,{ref:q,id:prefixId$1(c),type:`text`,name:c,spellCheck:`false`,autoComplete:`off`,disabled:a,class:`bio-properties-panel-input`,onInput:handleLocalInput,onFocus:T,onKeyDown:handleOnKeyDown,onBlur:handleOnBlur,onPaste:handleOnPaste,placeholder:I,value:G})]})}function TextfieldEntry(e){let{element:n,id:a,description:c,debounce:m,disabled:v,label:T,getValue:O,setValue:A,validate:I,onFocus:L,onBlur:U,onPaste:G,placeholder:K,tooltip:q}=e,ee=useDiagnostics(a),[te,ne]=d(null),J=O(n);h(()=>{if(ht(I)){let e=I(J)||null;ne(e)}},[J,I]);let re=useStaticCallback(e=>{if(e!==O(n)){let n=null;ht(I)&&(n=I(e)||null),A(e,n),ne(n)}}),ie=getMostSevere([...ee,te]);return u(`div`,{class:(0,es.default)(`bio-properties-panel-entry`,getDiagnosticClass(ie)),"data-entry-id":a,children:[u(Textfield,{debounce:m,disabled:v,id:a,label:T,onInput:re,onFocus:L,onBlur:U,onPaste:G,placeholder:K,value:J,tooltip:q,element:n},n),u(DiagnosticMessage,{diagnostic:ie,forId:a,element:n}),u(Description,{forId:a,element:n,value:c})]})}function isEdited(e){return e&&!!e.value}function prefixId$1(e){return`bio-properties-panel-${e}`}var Ds=600;function debounceInput(e){return function debounce$1(n){if(e===!1)return n;var a=Pt(e)?e:Ds;return Ot(n,a)}}debounceInput.$inject=[`config.debounceInput`];var Os={debounceInput:[`factory`,debounceInput]};function getPopupTitle({element:e,label:n}){let a=``;return e&&e.type&&(a=`${e.type} / `),`${a}${n}`}function createDragger(e,n){let a,c,m;function onDragStart(e){a=this,c=e.clientX,m=e.clientY,e.dataTransfer&&e.dataTransfer.setDragImage(n||emptyCanvas(),0,0),document.addEventListener(`dragover`,onDrag,!0),document.addEventListener(`dragenter`,preventDefault,!0),document.addEventListener(`dragend`,onEnd),document.addEventListener(`drop`,preventDefault)}function onDrag(n){let v={x:n.clientX-c,y:n.clientY-m};return e.call(a,n,v)}function onEnd(){document.removeEventListener(`dragover`,onDrag,!0),document.removeEventListener(`dragenter`,preventDefault,!0),document.removeEventListener(`dragend`,onEnd),document.removeEventListener(`drop`,preventDefault)}return onDragStart}function preventDefault(e){e.preventDefault(),e.stopPropagation()}function emptyCanvas(){return Je(`<canvas width="0" height="0" />`)}var noop=()=>{};function PopupComponent(e,n){let{className:a,delayInitialFocus:c,position:m,width:v,height:T,onClose:O,onPostActivate:A=noop,onPostDeactivate:I=noop,returnFocus:L=!0,closeOnEscape:U=!0,allowFocusMove=()=>!0,title:G}=e,K=A$1(null),q=A$1(null),ee=n||q,handleKeydown=e=>{e.stopPropagation(),U&&e.key===`Escape`&&O()},handleFocus=()=>{K.current&&K.current.activate()},{top:te,left:ne}=m||getCenterPosition(v,T),J={};return bt(te)&&bt(ne)&&(J.top=te+`px`,J.left=ne+`px`),v&&(J.width=v+`px`),T&&(J.height=T+`px`),h(()=>(ee.current&&ee.current.addEventListener(`focusin`,handleFocus),()=>{ee.current&&ee.current.removeEventListener(`focusin`,handleFocus)}),[ee]),h(()=>(ee.current&&(K.current=Ft(ee.current,{clickOutsideDeactivates:!0,delayInitialFocus:c,fallbackFocus:ee.current,isKeyForward:e=>isTab(e)&&!e.shiftKey&&allowFocusMove(e),isKeyBackward:e=>isTab(e)&&e.shiftKey&&allowFocusMove(e),onPostActivate:A,onPostDeactivate:I,returnFocusOnDeactivate:L}),K.current.activate()),()=>K.current&&K.current.deactivate()),[ee]),u(`div`,{"aria-label":G,tabIndex:-1,ref:ee,onKeyDown:handleKeydown,role:`dialog`,class:(0,es.default)(`bio-properties-panel-popup`,`bio-theme-parent`,a),style:J,children:e.children})}var ks=D(PopupComponent);ks.Title=Title,ks.Body=Body,ks.Footer=Footer;function Title(e){let{eventBus:n}=x$1(is),{children:a,className:c,draggable:m,title:v,showCloseButton:T=!1,closeButtonTooltip:O=`Close popup`,onClose:A,...I}=e,L=A$1({startPosition:null,newPosition:null}),U=A$1(),G=A$1(),onMove=(e,a)=>{cancel(e);let{x:c,y:m}=a,v={x:L.current.startPosition.x+c,y:L.current.startPosition.y+m},T=getPopupParent(G.current);T.style.top=v.y+`px`,T.style.left=v.x+`px`,n?.fire(`feelPopup.dragover`,{newPosition:v,delta:a})},onMoveStart=e=>{createDragger(onMove,U.current)(e),e.stopPropagation();let a=getPopupParent(G.current).getBoundingClientRect();L.current.startPosition={x:a.left,y:a.top},n?.fire(`feelPopup.dragstart`)},onMoveEnd=()=>{L.current.newPosition=null,n?.fire(`feelPopup.dragend`)};return u(`div`,{class:(0,es.default)(`bio-properties-panel-popup__header`,m&&`draggable`,c),ref:G,draggable:m,onDragStart:onMoveStart,onDragEnd:onMoveEnd,...I,children:[m&&u(S,{children:[u(`div`,{ref:U,class:`bio-properties-panel-popup__drag-preview`}),u(`div`,{class:`bio-properties-panel-popup__drag-handle`,children:u(Drag,{})})]}),u(`div`,{class:`bio-properties-panel-popup__title`,children:v}),a,T&&u(`button`,{type:`button`,title:O,class:`bio-properties-panel-popup__close`,onClick:A,children:u(Close,{})})]})}function Body(e){let{children:n,className:a,...c}=e;return u(`div`,{class:(0,es.default)(`bio-properties-panel-popup__body`,a),...c,children:n})}function Footer(e){let{children:n,className:a,...c}=e;return u(`div`,{class:(0,es.default)(`bio-properties-panel-popup__footer`,a),...c,children:e.children})}function getCenterPosition(e,n){if(!e||!n)return{};let a=window.innerWidth||document.documentElement.clientWidth,c=window.innerHeight||document.documentElement.clientHeight;return{left:Math.max(0,(a-e)/2),top:Math.max(0,(c-n)/2)}}function isTab(e){return e.key===`Tab`}function getPopupParent(e){return e.closest(`.bio-properties-panel-popup`)}function cancel(e){e.preventDefault(),e.stopPropagation()}var As=700,js=400;function FeelPopup(e){let{entryId:n,onInput:a,onClose:c,title:m,type:v,value:T,links:O,variables:A,hostLanguage:I,singleLine:L,sourceElement:U,tooltipContainer:G,feelLanguageContext:K}=e,q=A$1(),ee=A$1(),te=A$1(!1),handleSetReturnFocus=()=>{U&&U.focus()},onKeyDownCapture=e=>{e.key===`Escape`&&(te.current=autoCompletionOpen(e.target))},onKeyDown=e=>{e.key===`Escape`&&(te.current||=(c(),!1))};return h(()=>{q.current&&q.current.focus()},[q]),u(ks,{className:`bio-properties-panel-feel-popup`,title:m,returnFocus:!1,closeOnEscape:!1,delayInitialFocus:!1,allowFocusMove:e=>!isSnippetNavigation(e),onPostDeactivate:handleSetReturnFocus,height:js,width:As,ref:ee,children:[u(ks.Title,{title:m,showCloseButton:!0,closeButtonTooltip:`Save and close`,onClose:c,draggable:!0,children:u(S,{children:(O||[]).map((e,n)=>u(`a`,{rel:`noreferrer`,href:e.href,target:`_blank`,class:`bio-properties-panel-feel-popup__title-link`,children:[e.title,u(Launch,{})]},n))})}),u(ks.Body,{children:u(`div`,{onKeyDownCapture,onKeyDown,class:`bio-properties-panel-feel-popup__body`,children:[v===`feel`&&u(Ss,{enableGutters:!0,name:n,onInput:a,value:T,variables:A,feelLanguageContext:K,ref:q,tooltipContainer:G}),v===`feelers`&&u(xs,{contentAttributes:{"aria-label":m},enableGutters:!0,hostLanguage:I,name:n,onInput:a,value:T,ref:q,singleLine:L,tooltipContainer:G})]})})]})}function autoCompletionOpen(e){let n=e.closest(`.cm-editor`);return n?n.querySelector(`.cm-tooltip-autocomplete`):null}function isSnippetNavigation(e){let n=e.target.closest(`.cm-editor`);return!!(n&&n.querySelector(`.cm-snippetField`))}var Ms=700,Ns=400;function TextPopup(e){let{entryId:n,onInput:a,onClose:c,title:m,value:v,sourceElement:T}=e,O=A$1(),A=A$1(),handleSetReturnFocus=()=>{T&&T.focus()};return h(()=>{O.current&&O.current.focus()},[O]),u(ks,{className:`bio-properties-panel-text-popup`,title:m,returnFocus:!1,closeOnEscape:!0,delayInitialFocus:!1,onClose:c,onPostDeactivate:handleSetReturnFocus,height:Ns,width:Ms,ref:A,children:[u(ks.Title,{title:m,showCloseButton:!0,closeButtonTooltip:`Save and close`,onClose:c,draggable:!0}),u(ks.Body,{children:u(`textarea`,{id:prefixId(n),name:n,class:`bio-properties-panel-input`,ref:O,onInput:e=>a(e.target.value),value:v||``,spellCheck:`false`,autoComplete:`off`,"aria-label":m,"data-gramm":`false`})})]})}function prefixId(e){return`bio-properties-panel-popup-${e}`}var Ps=`text`,Fs=1e3,Is=500,Popup=class{constructor(e,n={}){this._eventBus=e,this._config=n,this._isOpen=!1,this.registerProvider(`feel`,Is,FeelPopup),this.registerProvider(`feelers`,Is,FeelPopup),this.registerProvider(`text`,Is,TextPopup),e.on(`propertiesPanel.openPopup`,(e,n)=>this.open(n.entryId,n,n.sourceElement)),e.on([`propertiesPanel.closePopup`,`propertiesPanel.detach`],()=>{this.close()})}registerProvider(e,n,a){a||(a=n,n=Fs),this._eventBus.on(`propertiesPanelPopup.getProviders.`+e,n,function(e){e.providers.push(a)})}_getProviders(e){let n=this._eventBus.createEvent({type:`propertiesPanelPopup.getProviders.`+e,providers:[]});return this._eventBus.fire(n),n.providers}isOpen(){return this._isOpen}open(e,n,a){return this.close(),this._openPopup({...n,entryId:e,sourceElement:a})}close(){this._closePopup()}_openPopup(e){let{element:n,label:a,sourceElement:c,type:m=Ps}=e,v=this._getProviders(m)[0];return v?(this._isOpen=!0,this._eventBus.fire(`propertiesPanelPopup.open`,{container:this._config.feelPopupContainer,config:{...e,component:v,links:this._config.getFeelPopupLinks?.(m)||[],onClose:()=>{this._closePopup(),setTimeout(()=>{c&&c.focus()},0)},title:getPopupTitle({element:n,label:a})}}),!0):!1}_closePopup(){this._isOpen&&(this._isOpen=!1,this._eventBus.fire(`propertiesPanelPopup.close`))}};Popup.$inject=[`eventBus`,`config.propertiesPanel`];var PopupRenderer=class{constructor(e){this._eventBus=e,this._container=null,this._element=null,e.on(`propertiesPanelPopup.open`,e=>{this._renderPopup(e)}),e.on(`propertiesPanelPopup.close`,()=>{this._removePopup()})}_renderPopup(e){let{container:n,config:a}=e;n=this._container=getContainer(n)||document.body;let c=this._element=createElement();n.appendChild(c),this._emit(`feelPopup.open`);let m=a.component;R$1(u(is.Provider,{value:{eventBus:this._eventBus},children:u(m,{...a,eventBus:this._eventBus})}),c),this._emit(`feelPopup.opened`,{domNode:c})}_removePopup(){this._container&&(this._emit(`feelPopup.close`,{domNode:this._element}),R$1(null,this._element),this._container.removeChild(this._element),this._container=null,this._element=null,this._emit(`feelPopup.closed`))}_emit(e,n){this._eventBus.fire(e,n)}};PopupRenderer.$inject=[`eventBus`];function createElement(){let e=document.createElement(`div`);return e.classList.add(`bio-properties-panel-popup-container`),e}function getContainer(e){return Nt(e)?Qe(e):e}var Ls={__init__:[`feelPopup`,`feelPopupRenderer`],feelPopup:[`type`,Popup],feelPopupRenderer:[`type`,PopupRenderer]},Rs=`--diagram-fill-color`,zs=`--diagram-stroke-color`;function diagramColorsFrom(e){try{let n=(e(Rs)??``).trim(),a=(e(zs)??``).trim();return n&&a?{fill:n,stroke:a}:null}catch{return null}}function resolvedColor(e,n){try{let a=n?.ownerDocument??(typeof document<`u`?document:null);if(!a||!n?.appendChild)return``;let c=a.createElement(`span`);c.style.color=`var(${e})`,c.style.display=`none`,n.appendChild(c);let m=(typeof getComputedStyle==`function`?getComputedStyle(c)?.color:``)||``;c.remove();let v=a.createElement(`canvas`)?.getContext?.(`2d`);return v?(v.fillStyle=`#000000`,v.fillStyle=m,String(v.fillStyle)):m}catch{return``}}function diagramColors(e=typeof document<`u`?document.documentElement:null){try{return!e||typeof getComputedStyle!=`function`||!getComputedStyle(e)?.getPropertyValue?.(Rs)?.trim()?null:diagramColorsFrom(n=>resolvedColor(n,e))}catch{return null}}function themeDiagramColorsFrom(e,n){if(e)return e;try{return{fill:(n(`--theme-bg-primary`)??``).trim()||`white`,stroke:(n(`--theme-fg-primary`)??``).trim()||`black`}}catch{return{fill:`white`,stroke:`black`}}}function themeDiagramColors(e=typeof document<`u`?document.documentElement:null){try{if(!e||typeof getComputedStyle!=`function`)return{fill:`white`,stroke:`black`};let n=getComputedStyle(e);return themeDiagramColorsFrom(diagramColors(e),e=>n?.getPropertyValue?.(e)??``)}catch{return{fill:`white`,stroke:`black`}}}var Bs={__init__:[`diagramTheme`],diagramTheme:[`type`,DiagramTheme]};DiagramTheme.$inject=[`graphicsFactory`,`elementRegistry`];var Vs=/^(none|url\(|transparent)/;function isLabel(e){return e.tagName===`text`||e.tagName===`tspan`||!!e.closest(`.djs-label`)}function paintsOwnColour(e){let n=e?.di;return n?!!(n.get(`color:background-color`)||n.get(`color:border-color`)||n.get(`bioc:fill`)):!1}var Hs=/(^|;)\s*(fill|stroke)\s*:\s*([^;]*)/gi;function paintDiagramShapes(e,n,a){if(!paintsOwnColour(a))for(let a of Array.from(e.querySelectorAll(`*`))){let e=a.getAttribute(`style`);if(e===null)continue;let c=isLabel(a),m=e.replace(Hs,(e,a,m,v)=>Vs.test(v.trim())?e:`${a}${m}: ${m===`fill`?c?n.stroke:n.fill:n.stroke}`);m!==e&&a.setAttribute(`style`,m)}}var Us=Symbol(`diagramTheme.painted`);function paintEveryDraw(e,n){if(!e?.[Us]){for(let a of[`drawShape`,`drawConnection`]){let c=e[a].bind(e);e[a]=(e,a,m)=>{let v=c(e,a,m);return paintDiagramShapes(e,n(),a),v}}e[Us]=!0}}function DiagramTheme(e,n){let a=themeDiagramColors();paintEveryDraw(e,()=>a);let refresh=()=>{a=themeDiagramColors(),n.getAll().forEach(a=>{let c=n.getGraphics(a);c&&e.update(a.waypoints?`connection`:`shape`,a,c)})};return{colors:()=>a,refresh}}var Ws=.75,Gs=32;function paletteRoom(e,n,a){return Math.min(e*Ws,e-n-Gs,e+n-2*a-Gs)}var PaletteIslandFit=class{static $inject=[`palette`];palette;constructor(e){this.palette=e,e._needsCollapse=()=>this.doesNotFit()}edge(e,n){return parseFloat(e[n])||0}heightOfOneColumn(e,n){if(!n)return e.getBoundingClientRect().height;let a=e.closest(`.djs-palette`);if(!a)return e.getBoundingClientRect().height;a.classList.remove(`two-column`);let c=e.getBoundingClientRect().height;return a.classList.add(`two-column`),c}doesNotFit(){let e=this.palette._container,n=e?.parentElement,a=e?.querySelector(`.djs-palette-entries`);if(!e||!n||!a)return!1;let c=getComputedStyle(e),m=n.closest(`.editor-canvas`),v=parseFloat(m?.style.getPropertyValue(`--corner-height`)??``)||0,T=parseFloat(m?.style.getPropertyValue(`--input-inset`)??``)||0,O=e.querySelector(`.palette-island__head`)?.getBoundingClientRect().height??0;return paletteRoom(n.clientHeight,T,v)-this.edge(c,`borderTopWidth`)-this.edge(c,`borderBottomWidth`)-this.edge(c,`paddingTop`)-this.edge(c,`paddingBottom`)-O<this.heightOfOneColumn(a,e.classList.contains(`two-column`))}},Ks={__init__:[`paletteIslandFit`],paletteIslandFit:[`type`,PaletteIslandFit]},qs=.85,Js=1,Ys=1500,Xs=16,Zs=80;function clearOfInsets(e,n,a){let{inner:c}=e,m=n<=0||(c.x-e.x)*e.scale>=n-Js,v=a<=0||(e.y+e.height-c.y-c.height)*e.scale>=a-Js;return m&&v}function clearInsets(e,n,a){let c=e.viewbox(),{inner:m,outer:v}=c;if(m.width<=0||m.height<=0||v.width<=0||v.height<=0||clearOfInsets(c,n,a))return;let T=v.height-a,O=Math.min(c.scale,(v.width-n-Xs)/m.width,T/m.height);O<=0||!Number.isFinite(O)||e.viewbox({x:n>0?m.x-n/O:m.x+m.width/2-v.width/O/2,y:m.y+m.height/2-T/O/2,width:v.width/O,height:v.height/O})}function anchorAtStart(e,n,a,c){let{inner:m,outer:v}=e.viewbox(),T=v.height-a.bottom,O=c??{x:m.x,y:m.y},A=m.y-Xs/n,I=c&&(c.y-A)*n>T-Zs?c.y-T/n/2:A;e.viewbox({x:O.x-Math.max(a.left,Xs)/n,y:I,width:v.width/n,height:v.height/n})}function createViewFit(e,n={}){let insets=()=>({left:n.insetLeft?.()??0,bottom:n.insetBottom?.()??0}),fit=()=>{let{outer:n}=e.viewbox();if(n.width<=0||n.height<=0)return;e.zoom(`fit-viewport`,`auto`);let{left:a,bottom:c}=insets();(a>0||c>0)&&clearInsets(e,a,c)},firstView=()=>{let{outer:a}=e.viewbox();a.width<=0||a.height<=0||(fit(),!(e.viewbox().scale>=.85)&&anchorAtStart(e,qs,insets(),n.startOf?.()??null))};return{fit,firstView}}function bindFitKey(e,n){e.addListener(Ys,({keyEvent:e})=>{if(e.key===`0`&&(e.ctrlKey||e.metaKey))return n(),!0})}function captureView(e,n){if(!e)return null;let{x:a,y:c,scale:m}=e.viewbox();return{x:a,y:c,scale:m,selected:(n?.get()??[]).map(e=>e.id)}}function restoreView(e,n,a,c){if(!e||!c)return;let{outer:m}=e.viewbox();if(e.viewbox({x:c.x,y:c.y,width:m.width/c.scale,height:m.height/c.scale}),!n||!a)return;let v=c.selected.flatMap(e=>a.get(e)??[]);v.length>0&&n.select(v)}var Qs=[`dmn:Decision`,`dmn:InputData`,`dmn:BusinessKnowledgeModel`,`dmn:KnowledgeSource`],$s=[`dmn:InformationRequirement`,`dmn:KnowledgeRequirement`,`dmn:AuthorityRequirement`],ec=[...Qs,...$s],tc=[`informationRequirement`,`knowledgeRequirement`,`authorityRequirement`];function isCopyableElement(e){let n=e?.businessObject;return ec.some(e=>n?.$instanceOf?.(e))}function relationsToSkip(e){return Qs.some(n=>n===e)?tc:[]}var nc=new Set([`__proto__`,`constructor`,`prototype`]);function assertCreatable(e,n){if(Array.isArray(e)){e.forEach(e=>assertCreatable(e,n));return}if(!e||typeof e!=`object`)return;let{$type:a,...c}=e;typeof a==`string`&&n.create(a),Object.values(c).forEach(e=>assertCreatable(e,n))}function pastableTree(e,n){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`the clipboard tree is not an object`);let a={};for(let c of Object.keys(e)){if(nc.has(c))continue;let m=e[c];Array.isArray(m)&&(a[c]=m.map(e=>{let a=e?.businessObject?.$type;if(typeof a!=`string`||!ec.includes(a))throw Error(`${String(a)} is not a requirements diagram element`);return assertCreatable(e,n),e}))}return a}var rc=new Set([`__proto__`,`constructor`,`prototype`]),ic=2e3,ac={empty:`app.editor.pasteEmpty`,text:`app.editor.pasteNotDiagram`,other:`app.editor.pasteOtherDiagram`,unreadable:`app.editor.pasteUnreadable`},oc=[un,fn];function hydrate(e,n){if(!e||typeof e!=`object`)return e;if(Array.isArray(e))return e.map(e=>hydrate(e,n));if(!e.$type){let a={};for(let c of Object.keys(e))rc.has(c)||(a[c]=hydrate(e[c],n));return a}let{$type:a,...c}=e,m={};for(let e of Object.keys(c))rc.has(e)||(m[e]=hydrate(c[e],n));try{return n.create(a,m)}catch{return e}}function hydrateTree(e,n){let a={};for(let c of Object.keys(e)){if(rc.has(c))continue;let m=e[c];Array.isArray(m)&&(a[c]=m.map(e=>({...e,businessObject:e.businessObject?hydrate(e.businessObject,n):e.businessObject,di:e.di?hydrate(e.di,n):e.di,processRef:e.processRef?hydrate(e.processRef,n):e.processRef,referencedRootElement:e.referencedRootElement?hydrate(e.referencedRootElement,n):e.referencedRootElement})))}return a}function dialectOf(e){let n=e.get(`bpmnFactory`,!1);if(n)return{prefix:un,hydrate:e=>hydrateTree(e,n),paste:(e,n)=>{let a=e.get(`canvas`),c=a.viewbox();e.get(`copyPaste`).paste({element:a.getRootElement(),point:{x:c.x+c.width/2,y:c.y+c.height/2},tree:n})}};if(e.get(`drdFactory`,!1)){let n=e.get(`moddle`);return{prefix:fn,hydrate:e=>pastableTree(e,n),paste:(e,n)=>e.get(`copyPaste`).paste({tree:n})}}}function parseTree(e,n){if(!e.startsWith(n))return null;try{return JSON.parse(e.slice(n.length))}catch(e){return console.error(`Failed to read clipboard from IDE`,e),null}}function holdsOtherDiagram(e,n){return oc.some(a=>a!==n&&e.startsWith(a))}function holdsElements$1(e){return Object.values(e).some(e=>Array.isArray(e)&&e.length>0)}e(holdsElements$1,`holdsElements`);async function refuse(e,n){return await e.notifyUser(L(ac[n]),n===`unreadable`),n}async function pasteFromClipboard(e,n){let a=dialectOf(e);if(!a)return refuse(n,`text`);let c;try{c=await n.readClipboardNow()}catch{if(c=await n.getClipboard().catch(()=>null),!c?.startsWith(a.prefix))return refuse(n,`unreadable`)}if(!c)return refuse(n,`empty`);let m=parseTree(c,a.prefix);if(!m)return refuse(n,holdsOtherDiagram(c,a.prefix)?`other`:`text`);if(!holdsElements$1(m))return refuse(n,`empty`);let v;try{v=a.hydrate(m)}catch(e){return console.error(`Failed to hydrate pasted clipboard tree`,e),refuse(n,`text`)}return a.paste(e,v),`pasted`}function bindDiagramClipboard(e,n){let a=dialectOf(e),c=e.get(`eventBus`);if(!a||!c)return;let m=e.get(`canvas`).getContainer().ownerDocument.defaultView,v=createClipboardMirror(n);v.refresh();let refresh=()=>void v.refresh();m.addEventListener(`focus`,refresh),m.addEventListener(gn,refresh);let readSync=()=>{try{let e=v.read()??``;return e?(e.startsWith(a.prefix)&&(e=e.slice(a.prefix.length)),JSON.parse(e)):null}catch(e){return console.error(`Failed to read clipboard from IDE`,e),null}},writeSync=e=>{v.write(a.prefix+JSON.stringify(e))},onCopied=e=>{e?.hints?.clip!==!1&&e?.tree&&holdsElements$1(e.tree)&&writeSync(e.tree)},onPaste=e=>{if(e.tree)return;let n=readSync();try{e.tree=n?a.hydrate(n):{}}catch(n){console.error(`Failed to hydrate pasted clipboard tree`,n),e.tree={}}},T=e.get(`canvas`).getContainer(),O=e.get(`copyPaste`),A=e.get(`selection`),selected=()=>(A.get()??[]).filter(Boolean).map(e=>e.labelTarget??e),holdText=e=>{e.clipboardData?.setData(`text/plain`,v.read()??``),e.preventDefault()},onNativeCopy=e=>{ln(e.target)||selected().length===0||holdsElements$1(O.copy(selected()))&&holdText(e)},onNativeCut=e=>{ln(e.target)||selected().length===0||holdsElements$1(O.cut(selected()))&&holdText(e)},onNativePaste=n=>{let c=n.clipboardData?.getData(`text/plain`)??``;if(ln(n.target)||!c.startsWith(a.prefix))return;n.preventDefault();let m;try{m=a.hydrate(JSON.parse(c.slice(a.prefix.length)))}catch(e){console.error(`Failed to hydrate pasted clipboard tree`,e);return}a.paste(e,m)},onKeyDown=e=>isCopy(e.keyEvent)||isCut(e.keyEvent)||isPaste(e.keyEvent)?!1:void 0;return c.on(`copyPaste.elementsCopied`,1e5,onCopied),c.on(`copyPaste.pasteElements`,1e5,onPaste),c.on(`keyboard.keydown`,ic,onKeyDown),T.addEventListener(`copy`,onNativeCopy),T.addEventListener(`cut`,onNativeCut),T.addEventListener(`paste`,onNativePaste),()=>{m.removeEventListener(`focus`,refresh),m.removeEventListener(gn,refresh),c.off(`copyPaste.elementsCopied`,onCopied),c.off(`copyPaste.pasteElements`,onPaste),c.off(`keyboard.keydown`,onKeyDown),T.removeEventListener(`copy`,onNativeCopy),T.removeEventListener(`cut`,onNativeCut),T.removeEventListener(`paste`,onNativePaste)}}function descriptorsOf(e){return Object.values(e??{}).flatMap(e=>Array.isArray(e)?e:[])}function holdsElements(e){return descriptorsOf(e).length>0}function isPlaced(e){return Array.isArray(e.waypoints)||[e.x,e.y,e.width,e.height].every(e=>typeof e==`number`)}function besideTree(e){let n=descriptorsOf(e).filter(isPlaced);if(n.length===0)return;let a=J(n);return{x:a.x+a.width/2+20,y:a.y+a.height/2+20}}function copiedWithHosts(e){let n=new Set(e);return[...n].filter(e=>!e.host||n.has(e.host))}function duplicateSelection(e){let n=e.get(`selection`,!1),a=e.get(`copyPaste`,!1),c=e.get(`canvas`,!1);if(!n||!a||!c)return;let m=copiedWithHosts((n.get()??[]).filter(Boolean).map(e=>e.labelTarget??e));if(m.length===0)return;let v=a.copy(m,{clip:!1});if(!holdsElements(v))return;let T=besideTree(v);if(!T)return;let O=a.paste({element:c.getRootElement(),point:T,tree:v});if(O?.length)return n.select(O.filter(e=>!e.labelTarget)),O}function bindDuplicate(e){let n=e.get(`editorActions`,!1);n?.isRegistered(`duplicate`)&&(n.unregister(`duplicate`),n.register(`duplicate`,()=>duplicateSelection(e)))}export{useLayoutState as $,ci as $t,HeaderButton as A,set as An,Ri as At,ToggleSwitchEntry as B,wi as Bt,FeelCheckboxEntry as C,fr as Cn,Sa as Ct,FeelTextAreaEntry as D,Kn as Dn,Ki as Dt,FeelNumberEntry as E,Jn as En,Zi as Et,PropertiesPanel as F,isRedo as Fn,saveClear as Ft,isEdited$1 as G,OrderingProvider as Gt,Ls as H,xi as Ht,SelectEntry as I,isUndo as In,Di as It,isEdited$6 as J,getNewAttachPoint as Jt,isEdited$3 as K,getResizedSourceAnchor as Kt,Simple as L,gn as Ln,CommandStack as Lt,List as M,Pn as Mn,CroppingConnectionDocking as Mt,ListGroup as N,KeyboardBindings as Nn,BaseLayouter as Nt,Group as O,Bn as On,Vi as Ot,NumberFieldEntry as P,isCmd$1 as Pn,Modeling as Pt,useError as Q,substractTRBL as Qt,TextAreaEntry as R,un as Rn,getDirection as Rt,DropdownButton as S,pr as Sn,Fa as St,as as T,nr as Tn,sa as Tt,Os as U,bi as Ut,TooltipWrapper as V,CopyPaste as Vt,isEdited as W,fi as Wt,isEdited$8 as X,computeChildrenBBox as Xt,isEdited$7 as Y,getNewAttachShapeDelta as Yt,isEdited$9 as Z,resizeTRBL as Zt,CheckboxEntry as _,_r as _n,Ya as _t,Qs as a,mid$1 as an,A$1 as at,Create as b,getConnectedDistance as bn,Ha as bt,captureView as c,getAngle as cn,h as ct,createViewFit as d,getApproxIntersection as dn,C$2 as dt,ii as en,usePrevious as et,Ks as f,Tr as fn,R$1 as ft,Arrow as g,AutoResize as gn,$a as gt,themeDiagramColors as h,AutoResizeProvider as hn,k$2 as ht,pasteFromClipboard as i,isSnapped as in,Qo as it,JsonEditorEntry as j,In as jn,Fi as jt,Header as k,delta as kn,EditorActions as kt,restoreView as l,getDistancePointPoint as ln,q$1 as lt,paintEveryDraw as m,Cr as mn,X$1 as mt,bindDuplicate as n,Zr as nn,u as nt,isCopyableElement as o,setSnapped as on,T$1 as ot,Bs as p,wr as pn,S as pt,isEdited$5 as q,getResizedTargetAnchor as qt,bindDiagramClipboard as r,bottomRight as rn,$ as rt,relationsToSkip as s,topLeft as sn,d as st,besideTree as t,ni as tn,useShowEntryEvent as tt,bindFitKey as u,rotateVector as un,x$1 as ut,CheckboxGroup as v,findFreePosition as vn,qa as vt,FeelEntry as w,ar as wn,da as wt,DiagnosticMessage as x,RuleProvider as xn,za as xt,CollapsibleEntry as y,generateGetNextPosition as yn,CreateMoveSnapping as yt,TextfieldEntry as z,Ei as zt};