@kern0x1b/penstock-cli 26.10.3 → 26.10.5

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 (182) hide show
  1. package/dist/chunk-account-C8EHysMH.js +1 -0
  2. package/dist/chunk-agentFailure-piRAFLGH.js +1 -0
  3. package/dist/chunk-agentLaunch-C5Uo40vv.js +1 -0
  4. package/dist/chunk-agentServe-4O0syoYQ.js +10 -0
  5. package/dist/chunk-analyze-Brxlb4U1.js +1 -0
  6. package/dist/chunk-analyze-CUxuBgNS.js +1 -0
  7. package/dist/chunk-apply-BAMwoXG9.js +1 -0
  8. package/dist/chunk-atomicWrite-C6J1gDtO.js +1 -0
  9. package/dist/chunk-baseline-DvS2S0am.js +1 -0
  10. package/dist/chunk-bot-I4kuhjyv.js +11 -0
  11. package/dist/chunk-cacheDirectory-7sa0970e.js +1 -0
  12. package/dist/chunk-codeFactSet-DOOlbIIj.js +1 -0
  13. package/dist/chunk-codeIndex-CzENd6hG.js +1 -0
  14. package/dist/chunk-codeLinks-D-gzUjYv.js +1 -0
  15. package/dist/chunk-codeLinks-DLxEBWPi.js +1 -0
  16. package/dist/chunk-command-BR4memGJ.js +1 -0
  17. package/dist/chunk-command-BctoT00W.js +5 -0
  18. package/dist/chunk-command-Jl1msVwF.js +1 -0
  19. package/dist/chunk-commands-CeRlfHY-.js +1 -0
  20. package/dist/chunk-compose-BV9Jg348.js +4 -0
  21. package/dist/chunk-connectors-CVfz5pSg.js +1 -0
  22. package/dist/chunk-connectors-eXPldvkc.js +2 -0
  23. package/dist/chunk-context-DPJmldqg.js +1 -0
  24. package/dist/chunk-convert-B1sgT9kl.js +1 -0
  25. package/dist/chunk-deploy-C4KJK-tw.js +1 -0
  26. package/dist/chunk-deploy-DOXu2-8q.js +2 -0
  27. package/dist/chunk-diagram-BaVwLa4h.js +1 -0
  28. package/dist/chunk-diagram-CCA1-fT5.js +1 -0
  29. package/dist/chunk-diagramDefects-7UG_Iwsr.js +1 -0
  30. package/dist/chunk-diagrams-6suPQBVQ.js +1 -0
  31. package/dist/chunk-diff-BC8gZX5w.js +1 -0
  32. package/dist/chunk-diff-D1m_eKvv.js +1 -0
  33. package/dist/chunk-diffModels-DYtf3au1.js +3 -0
  34. package/dist/chunk-dispatch-CW2CJI0C.js +6 -0
  35. package/dist/chunk-docs-CY6ICsip.js +1 -0
  36. package/dist/chunk-docs-CwY3Ce9M.js +30 -0
  37. package/dist/chunk-doctor-m0mnVdDE.js +1 -0
  38. package/dist/chunk-drawing-shRfnrs9.js +8 -0
  39. package/dist/chunk-editPreview-BgH1JVOD.js +1 -0
  40. package/dist/chunk-engine-CxgdJ2wO.js +1 -0
  41. package/dist/chunk-export-9AWsr5ai.js +1 -0
  42. package/dist/chunk-export-D5kPD4Or.js +20 -0
  43. package/dist/chunk-facts-DA3Y-k9a.js +1 -0
  44. package/dist/chunk-failure-BsimkHy_.js +1 -0
  45. package/dist/chunk-features-BfRg2kR5.js +1 -0
  46. package/dist/chunk-features-BwnwB6jL.js +1 -0
  47. package/dist/chunk-folders-13vx0i0n.js +1 -0
  48. package/dist/chunk-folders-C1Nes4Ap.js +1 -0
  49. package/dist/chunk-formChecks-acRgARZ3.js +1 -0
  50. package/dist/chunk-git-BOKyPQj7.js +3 -0
  51. package/dist/chunk-help-CFhmAhz8.js +85 -0
  52. package/dist/chunk-importCommand-5SJxu2k4.js +1 -0
  53. package/dist/chunk-init-AIh_7yE0.js +227 -0
  54. package/dist/chunk-license-B_To2110.js +1 -0
  55. package/dist/chunk-license-x3oHbKe2.js +1 -0
  56. package/dist/chunk-lint-C_fAcLIg.js +1 -0
  57. package/dist/chunk-load-BVJUBU5S.js +5 -0
  58. package/dist/chunk-main-D3S4Xr__.js +1 -0
  59. package/dist/chunk-mcp-ByMCWlXC.js +76 -0
  60. package/dist/chunk-mcpLaunch-C13ViiIP.js +592 -0
  61. package/dist/chunk-migrate-CLQ-hrae.js +1 -0
  62. package/dist/chunk-migrate-CVUR1K7f.js +1 -0
  63. package/dist/chunk-moddle-AjPH0QEc.js +1 -0
  64. package/dist/chunk-moddle-Dlk0NR-u.js +1 -0
  65. package/dist/chunk-own-CX-3lIbf.js +1 -0
  66. package/dist/chunk-penstockCli-CqiOKC75.js +1 -0
  67. package/dist/chunk-placeholderLayout-B18ekWmh.js +1 -0
  68. package/dist/chunk-plural-Bq_4vgOr.js +1 -0
  69. package/dist/chunk-pr-tC3-PSNM.js +1 -0
  70. package/dist/chunk-preferencesFile-F6bAlNrk.js +1 -0
  71. package/dist/chunk-project-qT-Fk_Rz.js +1 -0
  72. package/dist/chunk-report-CDz78nCI.js +1 -0
  73. package/dist/chunk-review-BqZSohXR.js +1 -0
  74. package/dist/chunk-rules-DJlL7K_Q.js +1 -0
  75. package/dist/chunk-security-5SU-bq3A.js +18 -0
  76. package/dist/chunk-share-YSewfw3F.js +239 -0
  77. package/dist/chunk-src-BLyg_6UX.js +879 -0
  78. package/dist/chunk-stages-C-nhLoBW.js +3 -0
  79. package/dist/chunk-status-DgeSOz3A.js +1 -0
  80. package/dist/chunk-systemError-2me5k57V.js +1 -0
  81. package/dist/chunk-systemError-B-1nL94i.js +1 -0
  82. package/dist/chunk-table-CJtiXv0e.js +1 -0
  83. package/dist/chunk-taskTest-4rIxp0rL.js +2 -0
  84. package/dist/chunk-taskTest-rng12v_b.js +1 -0
  85. package/dist/chunk-templates-Bxe3J0qy.js +1 -0
  86. package/dist/chunk-testCases-CwQ-Mi7L.js +1 -0
  87. package/dist/chunk-testCases-xculyxH_.js +4 -0
  88. package/dist/chunk-tests-C-kNQNpq.js +1 -0
  89. package/dist/chunk-tests-C3XJ9LMT.js +23 -0
  90. package/dist/chunk-translator-BFUJmSkR.js +21 -0
  91. package/dist/chunk-trust-u1vZ6Yk0.js +1 -0
  92. package/dist/chunk-trust-yKw_pXRj.js +1 -0
  93. package/dist/chunk-version-CdS8_QQd.js +1 -0
  94. package/dist/chunk-workerVariables-CCLcoR0U.js +1 -0
  95. package/dist/chunk-wrapper-AJWl6ru-.js +3 -0
  96. package/dist/chunk-wrapper-Bxz1Lgp5.js +1 -0
  97. package/dist/licensing.json +1 -1
  98. package/dist/locales/de.json +9176 -0
  99. package/dist/locales/es.json +9176 -0
  100. package/dist/locales/fr.json +9176 -0
  101. package/dist/locales/ja.json +9023 -0
  102. package/dist/locales/ko.json +9023 -0
  103. package/dist/locales/pt-BR.json +9176 -0
  104. package/dist/locales/ru.json +9482 -0
  105. package/dist/locales/zh.json +9023 -0
  106. package/dist/penstock.js +1 -2102
  107. package/dist/web/assets/{AgentSettings-C-1YBic4.js → AgentSettings-C3Er_rlW.js} +1 -1
  108. package/dist/web/assets/{AgentsDialog-CSu8pyh7.js → AgentsDialog-Bo7kikb6.js} +1 -1
  109. package/dist/web/assets/BpmnCanvas-Dw5zgCN3.js +1905 -0
  110. package/dist/web/assets/BpmnDocument-CuU0biX9.js +24 -0
  111. package/dist/web/assets/{ConflictDialog-nygfF7Dn.js → ConflictDialog-GxZ-d8SK.js} +1 -1
  112. package/dist/web/assets/{DiffDocument-DUrje9io.js → DiffDocument-Bh3hFmmi.js} +1 -1
  113. package/dist/web/assets/{DmnDocument-fn7AH7P1.js → DmnDocument-C8HpJAcE.js} +9 -9
  114. package/dist/web/assets/{FormDocument-BbyRqjib.js → FormDocument-CH-4KB3x.js} +1 -1
  115. package/dist/web/assets/{FormStepView-BYRMBW0U.js → FormStepView-DraPVoAN.js} +1 -1
  116. package/dist/web/assets/GraphAwareLayoutService-C8J8YHJI.js +21 -0
  117. package/dist/web/assets/NewFileDialog-j09JqpPj.js +47 -0
  118. package/dist/web/assets/{QuickOpen-D-u9hdSt.js → QuickOpen-CeBhsCzA.js} +1 -1
  119. package/dist/web/assets/{ScriptPane-BQorfmyv.js → ScriptPane-DDikZDv6.js} +2 -2
  120. package/dist/web/assets/{ScriptRunDialog-DjBW0LRD.js → ScriptRunDialog-DdzJ0pvT.js} +1 -1
  121. package/dist/web/assets/{SettingsDialog-DvYUAKpH.js → SettingsDialog-JUc5zUR9.js} +1 -1
  122. package/dist/web/assets/{ShortcutsDialog-BQ5BYHj3.js → ShortcutsDialog-DECqWPNE.js} +1 -1
  123. package/dist/web/assets/{SourceDocument-BfHVXxuk.js → SourceDocument-X8ajUcxM.js} +1 -1
  124. package/dist/web/assets/{TextDocument-BPepqeGu.js → TextDocument-0z7qojAh.js} +1 -1
  125. package/dist/web/assets/{UnreadableFileLayer-D5B6nixz.js → UnreadableFileLayer-D3G59F4u.js} +1 -1
  126. package/dist/web/assets/{UploadDialog-BzIvQ1YS.js → UploadDialog-CiahYkTc.js} +1 -1
  127. package/dist/web/assets/apply-HqvoGwLE.js +1 -0
  128. package/dist/web/assets/{bpmnTheme-Divwrkjy.js → bpmnTheme-cOvp4qFc.js} +1 -1
  129. package/dist/web/assets/bridgeInstance-DQk-c8L1.js +850 -0
  130. package/dist/web/assets/{commands-N2yKHjf_.js → commands-nPznxvPp.js} +1 -1
  131. package/dist/web/assets/de-Dj813wjn.js +1 -0
  132. package/dist/web/assets/{dialog-DSf66Ory.js → dialog-CtGB1LHI.js} +1 -1
  133. package/dist/web/assets/{diff-DkfgVbKD.js → diff-NgYeO98t.js} +1 -1
  134. package/dist/web/assets/{documentBridge-DSWBQZRP.js → documentBridge-QW0IZ9Bq.js} +8 -8
  135. package/dist/web/assets/{documents-C4vr2KnQ.js → documents-KeXEdK1U.js} +1 -1
  136. package/dist/web/assets/{duplicate-C-AiqE1T.js → duplicate-DNPpPVse.js} +1 -1
  137. package/dist/web/assets/{engines-DG8KgTeX.js → engines-DU0BfbYM.js} +1 -1
  138. package/dist/web/assets/es-CyJDEw4H.js +1 -0
  139. package/dist/web/assets/{formChecks-B_ZFz9DR.js → formChecks-sU20kKkU.js} +1 -1
  140. package/dist/web/assets/fr-B1lqrd3d.js +1 -0
  141. package/dist/web/assets/frontend-caI7mOAL.js +1 -0
  142. package/dist/web/assets/{httpHost-Cll6HteE.js → httpHost-Dqit__mm.js} +1 -1
  143. package/dist/web/assets/{index.es-B0wi5_fv.js → index.es-BqVUpGyA.js} +1 -1
  144. package/dist/web/assets/{index.es-DQAdm_u9.js → index.es-DqkfrvWI.js} +1 -1
  145. package/dist/web/assets/{intelligence-glU4hcHy.js → intelligence-Ck_Q9upa.js} +1 -1
  146. package/dist/web/assets/ja-BUAM_DzQ.js +1 -0
  147. package/dist/web/assets/{jspdf.es.min-xdeBAA_m.js → jspdf.es.min-CM3S4IDt.js} +3 -3
  148. package/dist/web/assets/ko-7l4EjTF9.js +1 -0
  149. package/dist/web/assets/{lib-DJ1i09sd.js → lib-DAKOOgix.js} +1 -1
  150. package/dist/web/assets/{engine-BPUfS3r2.js → moddle-CGpeSs3G.js} +1 -1
  151. package/dist/web/assets/{platform-BS7bgwr3.js → platform-CkWAyNst.js} +1 -1
  152. package/dist/web/assets/preferences-nBrFGN89.js +1 -0
  153. package/dist/web/assets/pt-BR-CxxRL7kF.js +1 -0
  154. package/dist/web/assets/ru-C4gbkVXL.js +1 -0
  155. package/dist/web/assets/{run-Df8AD_as.js → run-B3YvrVeP.js} +1 -1
  156. package/dist/web/assets/{samples-chRLnLcq.js → samples-BVuIm-bu.js} +1 -1
  157. package/dist/web/assets/testCaseRuns-DYKnccnc.js +1 -0
  158. package/dist/web/assets/translator-B2N3PQBL.js +1 -0
  159. package/dist/web/assets/{ui-AICOEtWR.js → ui-3pEQJ50t.js} +1 -1
  160. package/dist/web/assets/{useTrace-B3gDUL0X.js → useTrace-BAXnn0Bt.js} +1 -1
  161. package/dist/web/assets/{web-BtxFF0jJ.js → web-B2zkonPE.js} +8 -8
  162. package/dist/web/assets/zh-DIYPlVjz.js +1 -0
  163. package/dist/web/index.html +20 -20
  164. package/package.json +4 -1
  165. package/dist/web/assets/BpmnCanvas-DnBLxMNQ.js +0 -1905
  166. package/dist/web/assets/BpmnDocument-BPpyqTzJ.js +0 -24
  167. package/dist/web/assets/GraphAwareLayoutService-BiLVDmB7.js +0 -21
  168. package/dist/web/assets/NewFileDialog-Ce_cTeOv.js +0 -34
  169. package/dist/web/assets/apply-B0vauBJn.js +0 -1
  170. package/dist/web/assets/bridgeInstance-D0bzpNGz.js +0 -600
  171. package/dist/web/assets/de-izeWpfua.js +0 -1
  172. package/dist/web/assets/es-CRMYEYWD.js +0 -1
  173. package/dist/web/assets/fr-8pTyPyAI.js +0 -1
  174. package/dist/web/assets/frontend-BLfXy4OQ.js +0 -1
  175. package/dist/web/assets/ja-I1fjeFMy.js +0 -1
  176. package/dist/web/assets/ko-CFd9C-RA.js +0 -1
  177. package/dist/web/assets/preferences-C_EXTz45.js +0 -1
  178. package/dist/web/assets/pt-BR-Dl_APu95.js +0 -1
  179. package/dist/web/assets/ru-_vhcOTod.js +0 -1
  180. package/dist/web/assets/testCaseRuns-DLEqANBi.js +0 -1
  181. package/dist/web/assets/translator-CS9eR0My.js +0 -1
  182. package/dist/web/assets/zh-Do_q1RZ2.js +0 -1
@@ -1 +1 @@
1
- import"./rolldown-runtime-B8BYMn-z.js";import{i as e}from"./translator-CS9eR0My.js";function appliesNothing(e){return e.id===`apply`&&e.changed===!1}function buttonOrderOf(e){return e===`LEFT`?`primary-left`:`primary-right`}function orderActions(e,t){let n=e.filter(e=>e.role===`cancel`),r=e.filter(e=>e.role===`secondary`),i=e.filter(e=>e.role===`primary`);return t===`primary-right`?[...n,...r,...i]:[...i,...r,...n]}function focusAfterTab(e,t,n){return e===0?null:t<0?n?e-1:0:n&&t===0?e-1:!n&&t===e-1?0:null}function submitsOn(e){return e.key!==`Enter`||e.destructive||e.shiftKey?!1:e.tag===`TEXTAREA`?!!(e.ctrlKey||e.metaKey):e.tag===`INPUT`&&e.type!==`checkbox`&&e.type!==`radio`&&e.type!==`button`&&e.type!==`submit`}function shownError(e){return e.error&&(e.touched||e.submitted)?e.error:null}function revealedError(e){return e.revealed?null:e.shown}function primaryLocked(e){return e.fields<=2&&e.missingRequired>0}function formatHint(t){return e(`app.dialog.exampleHint`,{example:t})}var t=8,n=4;function popoverPlacement(e,r,i){let a=e.top+e.height+n,o=a+r.height<=i.height-t,s=e.top-n-r.height,c=o||s<t?`bottom`:`top`,l=e.left+e.width-r.width,u=Math.max(t,Math.min(l,i.width-t-r.width));return{top:c===`bottom`?a:s,left:u,placement:c}}export{orderActions as a,revealedError as c,formatHint as i,shownError as l,buttonOrderOf as n,popoverPlacement as o,focusAfterTab as r,primaryLocked as s,appliesNothing as t,submitsOn as u};
1
+ import"./rolldown-runtime-B8BYMn-z.js";import{i as e}from"./translator-B2N3PQBL.js";function appliesNothing(e){return e.id===`apply`&&e.changed===!1}function buttonOrderOf(e){return e===`LEFT`?`primary-left`:`primary-right`}function orderActions(e,t){let n=e.filter(e=>e.role===`cancel`),r=e.filter(e=>e.role===`secondary`),i=e.filter(e=>e.role===`primary`);return t===`primary-right`?[...n,...r,...i]:[...i,...r,...n]}function focusAfterTab(e,t,n){return e===0?null:t<0?n?e-1:0:n&&t===0?e-1:!n&&t===e-1?0:null}function submitsOn(e){return e.key!==`Enter`||e.destructive||e.shiftKey?!1:e.tag===`TEXTAREA`?!!(e.ctrlKey||e.metaKey):e.tag===`INPUT`&&e.type!==`checkbox`&&e.type!==`radio`&&e.type!==`button`&&e.type!==`submit`}function shownError(e){return e.error&&(e.touched||e.submitted)?e.error:null}function revealedError(e){return e.revealed?null:e.shown}function primaryLocked(e){return e.fields<=2&&e.missingRequired>0}function formatHint(t){return e(`app.dialog.exampleHint`,{example:t})}var t=8,n=4;function popoverPlacement(e,r,i){let a=e.top+e.height+n,o=a+r.height<=i.height-t,s=e.top-n-r.height,c=o||s<t?`bottom`:`top`,l=e.left+e.width-r.width,u=Math.max(t,Math.min(l,i.width-t-r.width));return{top:c===`bottom`?a:s,left:u,placement:c}}export{orderActions as a,revealedError as c,formatHint as i,shownError as l,buttonOrderOf as n,popoverPlacement as o,focusAfterTab as r,primaryLocked as s,appliesNothing as t,submitsOn as u};
@@ -1 +1 @@
1
- import"./rolldown-runtime-B8BYMn-z.js";import{a as e}from"./engine-BPUfS3r2.js";import{d as t,l as n,o as r,u as i}from"./apply-B0vauBJn.js";var a=new Map(Object.entries(n).map(([e,t])=>[t.type,e])),BARE=e=>e.startsWith(`bpmn:`)?e:`bpmn:${e}`;function stable(e){return e&&typeof e==`object`&&!Array.isArray(e)?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${stable(e[t])}`).join(`,`)}}`:JSON.stringify(e)}function same(e,t){return!!e&&!!t&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function pointsKey(e){return(e??[]).map(e=>`${e.x},${e.y}`).join(` `)}var o={elements:[],nodes:[],flows:[]};async function diffDiagrams(n,s,c){let l=c??e(s)??(n?e(n):null)??`classic`,[u,d]=await Promise.all([n?r(n,l):Promise.resolve(o),r(s,l)]);if(!u||!d)return null;let f=new Map(u.elements.map(e=>[e.id,e])),p=new Map(d.elements.map(e=>[e.id,e])),m=new Map(u.nodes.map(e=>[e.id,e])),h=new Map(d.nodes.map(e=>[e.id,e])),g=new Map(u.flows.map(e=>[e.id,e])),_=new Map(d.flows.map(e=>[e.id,e])),v=[],y=[],b=[],x=[],S=d.nodes.filter(e=>!m.has(e.id)),C=d.flows.filter(e=>!g.has(e.id)),w=u.nodes.filter(e=>!h.has(e.id)),T=u.flows.filter(e=>!_.has(e.id)),E=new Set(w.map(e=>e.id)),gone=e=>E.has(e.parent??``)||E.has(e.attachedTo??``);for(let e of w)gone(e)||v.push({op:`remove`,id:e.id});for(let e of T)E.has(e.source??``)||E.has(e.target??``)||v.push({op:`remove`,id:e.id});let propertyKeys=(e,t)=>{let n={};if(!e)return n;let r=new Set([...Object.keys(e.properties),...Object.keys(t?.properties??{})]);for(let i of r)stable(e.properties[i])!==stable(t?.properties[i])&&e.properties[i]!==void 0&&(n[i]=e.properties[i]);return n};for(let e of[...h.keys(),..._.keys()]){let n=f.get(e),r=p.get(e);if(!n||!r)continue;let i={};if((n.name??``)!==(r.name??``)&&(r.name===void 0?y.push({kind:`property`,id:e,type:r.type,detail:`name`}):i.name=r.name),n.type!==r.type){y.push({kind:`type`,id:e,type:r.type,detail:n.type});continue}if(_.has(e)&&(n.source!==r.source||n.target!==r.target)){y.push({kind:`reconnect`,id:e,type:r.type});continue}let a=propertyKeys(r,n);for(let o of new Set([...Object.keys(r.properties),...Object.keys(n.properties)]))stable(r.properties[o])!==stable(n.properties[o])&&(o===`event`?y.push({kind:`event`,id:e,type:r.type}):a[o]===void 0?y.push({kind:`property`,id:e,type:r.type,detail:o}):t(l,o,BARE(r.type))?i[o]=a[o]:y.push({kind:`property`,id:e,type:r.type,detail:o}));Object.keys(i).length>0&&(v.push({op:`set`,id:e,properties:i}),b.push({id:e,keys:Object.keys(i),bounds:h.get(e)?.bounds}))}let D=new Map;for(let e of d.nodes){let t=m.get(e.id);t?.bounds&&e.bounds&&!same(t.bounds,e.bounds)&&(t.bounds.width!==e.bounds.width||t.bounds.height!==e.bounds.height?(y.push({kind:`resize`,id:e.id,type:e.type}),x.push({id:e.id,from:t.bounds,to:e.bounds})):(D.set(e.id,{dx:e.bounds.x-t.bounds.x,dy:e.bounds.y-t.bounds.y}),x.push({id:e.id,from:t.bounds,to:e.bounds})))}let carried=e=>{let t=D.get(e.id);if(!t)return!1;for(let n of[e.attachedTo,e.parent]){let e=n;for(;e;){let n=D.get(e);if(n&&n.dx===t.dx&&n.dy===t.dy)return!0;e=h.get(e)?.parent}}return!1};for(let[e,t]of D)carried(h.get(e))||v.push({op:`move`,id:e,dx:t.dx,dy:t.dy});let O=new Set([...m.keys()].filter(e=>h.has(e))),k=[...S],A=new Set;for(;k.length>0;){let e=!1;for(let n=0;n<k.length;n+=1){let r=k[n],o=p.get(r.id),s=a.get(BARE(r.type));if(!o||!s){y.push({kind:`element`,id:r.id,type:r.type}),k.splice(n,1),e=!0;break}let c=C.filter(e=>e.target===r.id&&!A.has(e.id)&&O.has(e.source??``)),u=c.find(e=>h.get(e.source??``)?.parent===r.parent)??c[0];if(!u)continue;if(k.splice(n,1),e=!0,A.add(u.id),O.add(r.id),h.get(u.source??``)?.parent!==r.parent){y.push({kind:`scope`,id:r.id,type:r.type});break}let d={};for(let[e,n]of Object.entries(o.properties))e!==`event`&&(t(l,e,BARE(r.type))?d[e]=n:y.push({kind:`property`,id:r.id,type:r.type,detail:e}));let f=o.properties.event,m=typeof f==`string`&&Object.hasOwn(i,f)?f:void 0;v.push({op:`add`,element:s,after:u.source,id:r.id,...r.name?{name:r.name}:{},...m?{event:m}:{},...Object.keys(d).length>0?{properties:d}:{}});break}if(!e)break}for(let e of k)y.push({kind:a.has(BARE(e.type))?`attach`:`element`,id:e.id,type:e.type});for(let e of C){if(A.has(e.id))continue;if(!O.has(e.source??``)||!O.has(e.target??``)){y.push({kind:`attach`,id:e.id,type:e.type});continue}let t=p.get(e.id)?.properties.condition;v.push({op:`connect`,from:e.source,to:e.target,...e.name?{name:e.name}:{},...typeof t==`string`?{condition:t}:{}})}for(let e of d.flows){let t=g.get(e.id);t&&pointsKey(t.waypoints)!==pointsKey(e.waypoints)&&(b.some(t=>t.id===e.id)||b.push({id:e.id,keys:[`waypoints`]}))}let j=[...T,...w];return{engine:l,created:!n,before:{nodes:u.nodes,flows:u.flows},after:{nodes:d.nodes,flows:d.flows},operations:v,loose:y,added:S,addedFlows:C,removed:j,changed:b,moved:x,empty:v.length===0&&y.length===0&&x.length===0&&b.length===0&&j.length===0&&S.length===0&&C.length===0}}export{diffDiagrams};
1
+ import"./rolldown-runtime-B8BYMn-z.js";import{d as e}from"./moddle-CGpeSs3G.js";import{d as t,l as n,o as r,u as i}from"./apply-HqvoGwLE.js";var a=new Map(Object.entries(n).map(([e,t])=>[t.type,e])),BARE=e=>e.startsWith(`bpmn:`)?e:`bpmn:${e}`;function stable(e){return e&&typeof e==`object`&&!Array.isArray(e)?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${stable(e[t])}`).join(`,`)}}`:JSON.stringify(e)}function same(e,t){return!!e&&!!t&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function pointsKey(e){return(e??[]).map(e=>`${e.x},${e.y}`).join(` `)}var o={elements:[],nodes:[],flows:[]};async function diffDiagrams(n,s,c){let l=c??e(s)??(n?e(n):null)??`classic`,[u,d]=await Promise.all([n?r(n,l):Promise.resolve(o),r(s,l)]);if(!u||!d)return null;let f=new Map(u.elements.map(e=>[e.id,e])),p=new Map(d.elements.map(e=>[e.id,e])),m=new Map(u.nodes.map(e=>[e.id,e])),h=new Map(d.nodes.map(e=>[e.id,e])),g=new Map(u.flows.map(e=>[e.id,e])),_=new Map(d.flows.map(e=>[e.id,e])),v=[],y=[],b=[],x=[],S=d.nodes.filter(e=>!m.has(e.id)),C=d.flows.filter(e=>!g.has(e.id)),w=u.nodes.filter(e=>!h.has(e.id)),T=u.flows.filter(e=>!_.has(e.id)),E=new Set(w.map(e=>e.id)),gone=e=>E.has(e.parent??``)||E.has(e.attachedTo??``);for(let e of w)gone(e)||v.push({op:`remove`,id:e.id});for(let e of T)E.has(e.source??``)||E.has(e.target??``)||v.push({op:`remove`,id:e.id});let propertyKeys=(e,t)=>{let n={};if(!e)return n;let r=new Set([...Object.keys(e.properties),...Object.keys(t?.properties??{})]);for(let i of r)stable(e.properties[i])!==stable(t?.properties[i])&&e.properties[i]!==void 0&&(n[i]=e.properties[i]);return n};for(let e of[...h.keys(),..._.keys()]){let n=f.get(e),r=p.get(e);if(!n||!r)continue;let i={};if((n.name??``)!==(r.name??``)&&(r.name===void 0?y.push({kind:`property`,id:e,type:r.type,detail:`name`}):i.name=r.name),n.type!==r.type){y.push({kind:`type`,id:e,type:r.type,detail:n.type});continue}if(_.has(e)&&(n.source!==r.source||n.target!==r.target)){y.push({kind:`reconnect`,id:e,type:r.type});continue}let a=propertyKeys(r,n);for(let o of new Set([...Object.keys(r.properties),...Object.keys(n.properties)]))stable(r.properties[o])!==stable(n.properties[o])&&(o===`event`?y.push({kind:`event`,id:e,type:r.type}):a[o]===void 0?y.push({kind:`property`,id:e,type:r.type,detail:o}):t(l,o,BARE(r.type))?i[o]=a[o]:y.push({kind:`property`,id:e,type:r.type,detail:o}));Object.keys(i).length>0&&(v.push({op:`set`,id:e,properties:i}),b.push({id:e,keys:Object.keys(i),bounds:h.get(e)?.bounds}))}let D=new Map;for(let e of d.nodes){let t=m.get(e.id);t?.bounds&&e.bounds&&!same(t.bounds,e.bounds)&&(t.bounds.width!==e.bounds.width||t.bounds.height!==e.bounds.height?(y.push({kind:`resize`,id:e.id,type:e.type}),x.push({id:e.id,from:t.bounds,to:e.bounds})):(D.set(e.id,{dx:e.bounds.x-t.bounds.x,dy:e.bounds.y-t.bounds.y}),x.push({id:e.id,from:t.bounds,to:e.bounds})))}let carried=e=>{let t=D.get(e.id);if(!t)return!1;for(let n of[e.attachedTo,e.parent]){let e=n;for(;e;){let n=D.get(e);if(n&&n.dx===t.dx&&n.dy===t.dy)return!0;e=h.get(e)?.parent}}return!1};for(let[e,t]of D)carried(h.get(e))||v.push({op:`move`,id:e,dx:t.dx,dy:t.dy});let O=new Set([...m.keys()].filter(e=>h.has(e))),k=[...S],A=new Set;for(;k.length>0;){let e=!1;for(let n=0;n<k.length;n+=1){let r=k[n],o=p.get(r.id),s=a.get(BARE(r.type));if(!o||!s){y.push({kind:`element`,id:r.id,type:r.type}),k.splice(n,1),e=!0;break}let c=C.filter(e=>e.target===r.id&&!A.has(e.id)&&O.has(e.source??``)),u=c.find(e=>h.get(e.source??``)?.parent===r.parent)??c[0];if(!u)continue;if(k.splice(n,1),e=!0,A.add(u.id),O.add(r.id),h.get(u.source??``)?.parent!==r.parent){y.push({kind:`scope`,id:r.id,type:r.type});break}let d={};for(let[e,n]of Object.entries(o.properties))e!==`event`&&(t(l,e,BARE(r.type))?d[e]=n:y.push({kind:`property`,id:r.id,type:r.type,detail:e}));let f=o.properties.event,m=typeof f==`string`&&Object.hasOwn(i,f)?f:void 0;v.push({op:`add`,element:s,after:u.source,id:r.id,...r.name?{name:r.name}:{},...m?{event:m}:{},...Object.keys(d).length>0?{properties:d}:{}});break}if(!e)break}for(let e of k)y.push({kind:a.has(BARE(e.type))?`attach`:`element`,id:e.id,type:e.type});for(let e of C){if(A.has(e.id))continue;if(!O.has(e.source??``)||!O.has(e.target??``)){y.push({kind:`attach`,id:e.id,type:e.type});continue}let t=p.get(e.id)?.properties.condition;v.push({op:`connect`,from:e.source,to:e.target,...e.name?{name:e.name}:{},...typeof t==`string`?{condition:t}:{}})}for(let e of d.flows){let t=g.get(e.id);t&&pointsKey(t.waypoints)!==pointsKey(e.waypoints)&&(b.some(t=>t.id===e.id)||b.push({id:e.id,keys:[`waypoints`]}))}let j=[...T,...w];return{engine:l,created:!n,before:{nodes:u.nodes,flows:u.flows},after:{nodes:d.nodes,flows:d.flows},operations:v,loose:y,added:S,addedFlows:C,removed:j,changed:b,moved:x,empty:v.length===0&&y.length===0&&x.length===0&&b.length===0&&j.length===0&&S.length===0&&C.length===0}}export{diffDiagrams};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./testCaseRuns-DLEqANBi.js","./rolldown-runtime-B8BYMn-z.js","./translator-CS9eR0My.js","./preload-helper-VRuDKI9K.js","./frontend-BLfXy4OQ.js","./bridgeInstance-D0bzpNGz.js","./dist-CRJyslwo.js","./dist-DgvQWhKm.js","./engine-BPUfS3r2.js","./dist-BqwyxNP3.js","./engines-DG8KgTeX.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-B8BYMn-z.js";import{c as t,d as n,h as r,i,o as a,p as o,r as s,s as c,u as l}from"./vendor-NJP34MHU.js";import{i as u,n as d}from"./translator-CS9eR0My.js";import{t as f}from"./preload-helper-VRuDKI9K.js";import{N as p}from"./frontend-BLfXy4OQ.js";import{$t as m,B as h,Bn as g,J as _,Ln as v,Qt as y,U as b,V as x,X as S,Zt as C,at as w,ct as T,ot as E,st as D,t as O}from"./bridgeInstance-D0bzpNGz.js";import{f as k,s as A}from"./engine-BPUfS3r2.js";import{r as j}from"./platform-BS7bgwr3.js";import{p as M}from"./testCaseRuns-DLEqANBi.js";import{n as N,r as P,t as F}from"./shortcut-DONH578b.js";import{v as ee}from"./AgentSettings-C-1YBic4.js";import{t as I}from"./typing-CXvbBSPr.js";import{i as L}from"./dialog-DSf66Ory.js";import{f as R,m as te,r as z,t as B}from"./bpmnTheme-Divwrkjy.js";import{c as V,d as ne,f as H,h as re,l as U,o as ie,p as W,r as ae,s as oe,u as se}from"./ui-AICOEtWR.js";import{i as G,o as K,r as ce}from"./preferences-C_EXTz45.js";import{G as le,t as ue}from"./Viewer-CZiVl0t6.js";import{a as de}from"./dockLayout-CxOMo-Nl.js";import{A as fe,C as pe,D as me,Dt as he,E as ge,Et as _e,H as q,L as ve,O as ye,Ot as be,R as J,S as xe,St as Se,T as Ce,Tt as we,W as Te,_ as Ee,_t as De,a as Y,bt as Oe,c as ke,ct as Ae,dt as je,et as Me,ft as Ne,g as Pe,gt as Fe,h as X,ht as Ie,i as Le,j as Re,k as ze,lt as Be,mt as Ve,nt as He,pt as Ue,q as We,s as Ge,tt as Ke,ut as qe,v as Je,vt as Ye,wt as Xe,x as Ze,xt as Qe,y as $e,yt as et,z as tt}from"./web-BtxFF0jJ.js";function sayAction(e,t){let n=u(e);return n===e?t:n}function sayKeywords(e,t){let n=u(`app.actions.${e}.keywords`),r=n===`app.actions.${e}.keywords`?[]:n.split(`,`).map(e=>e.trim()).filter(Boolean);return r.length>0?[...t,...r]:t}var nt={"Check & run":`checkRun`,"Layout & convert":`layoutConvert`,"Deploy & share":`deployShare`,View:`view`,File:`file`,Edit:`edit`,Help:`help`,Recent:`recent`};function saySection(e){return u(`app.actions.section.${nt[e]??e}`)}function resolveActions(e,t){return e.map((e,t)=>({def:e,order:t})).filter(({def:e})=>e.available?.(t)??!0).map(({def:e,order:n})=>{let r=e.l10n??e.id,i=typeof e.tooltip==`function`?e.tooltip(t):e.tooltip&&sayAction(`app.actions.${r}.tooltip`,e.tooltip),a={id:e.id,title:sayAction(`app.actions.${r}.title`,e.title),section:e.section,icon:e.icon,keywords:sayKeywords(r,e.keywords),place:e.place,listed:e.listed??!0,slot:e.slot??`start`,order:n,enabled:e.enabled?.(t)??!0,run:()=>e.run(t)};if(e.presentation&&(a.presentation=e.presentation),e.shortcut&&(a.shortcut=e.shortcut),e.tier&&(a.tier=e.tier),i&&(a.tooltip=i),!a.enabled&&e.disabledReason){let n=e.disabledReason(t);n&&(a.disabledReason=n)}e.checked&&(a.checked=e.checked(t));let o=e.status?.(t);return o&&(a.status=o),e.popup&&(a.popup=e.popup(t)),e.menu&&(a.menu=e.menu(t).map(n=>({id:n.id,title:sayAction(`app.actions.${e.id}.menu.${n.id}.title`,n.title),icon:n.icon,...n.tooltip?{tooltip:sayAction(`app.actions.${e.id}.menu.${n.id}.tooltip`,n.tooltip)}:{},run:()=>n.run(t)}))),a})}var rt=500,it=400,at=300,ot=200,st=80,ct=12,lt=10,ut=1,dt=4;function startsWord(e,t){return t===0||!/[a-z0-9]/i.test(e[t-1])}function contiguous(e,t){let n=null;for(let r=t.indexOf(e);r>=0;r=t.indexOf(e,r+1)){let e=(r===0?rt:startsWord(t,r)?it:at)-Math.min(r,50)*.1;(n===null||e>n.score)&&(n={score:e,from:r})}return n===null?null:{score:n.score,at:Array.from({length:e.length},(e,t)=>n.from+t)}}function initials(e,t){let n=t.length,r=e.split(``).map(()=>Array(n).fill(-1/0)),i=e.split(``).map(()=>Array(n).fill(-1));for(let a=0;a<e.length;a++)for(let o=a;o<n;o++)if(t[o]===e[a]){if(a===0)startsWord(t,o)&&(r[a][o]=lt);else for(let e=a-1;e<o;e++){if(r[a-1][e]===-1/0)continue;let n=e===o-1;if(!n&&!startsWord(t,o))continue;let s=r[a-1][e]+lt+(n?ct:-Math.min(o-e-1,dt)*ut);s>r[a][o]&&(r[a][o]=s,i[a][o]=e)}}let a=e.length-1,o=-1;for(let e=0;e<n;e++)r[a][e]>(o<0?-1/0:r[a][o])&&(o=e);if(o<0||r[a][o]===-1/0)return null;let s=[];for(let e=a,t=o;e>=0;e--)s.unshift(t),t=i[e][t];return{score:ot+r[a][o],at:s}}function inTitle(e,t){let n=t.toLowerCase();return contiguous(e,n)??initials(e,n)}function keyword(e,t){for(let n of t){let t=n.toLowerCase();if(t.startsWith(e)||t.split(/\s+/).some(t=>t.startsWith(e)))return st}return 0}function merged(e){let t=[];for(let n of[...new Set(e)].sort((e,t)=>e-t)){let e=t[t.length-1];e&&e[1]===n?e[1]=n+1:t.push([n,n+1])}return t}function matchOf(e,t){let n=0,r=[];for(let i of t){let t=inTitle(i,e.title);if(t){n+=t.score,r.push(...t.at);continue}let a=keyword(i,e.keywords);if(a>0)n+=a;else return null}return{action:e,score:n,ranges:merged(r)}}function rankActions(e,t){let n=t.toLowerCase().split(/\s+/).filter(Boolean);return n.length===0?e.map(e=>({action:e,score:0,ranges:[]})):e.map((e,t)=>({match:matchOf(e,n),order:t})).filter(e=>e.match!==null).sort((e,t)=>t.match.score-e.match.score||e.order-t.order).map(e=>e.match)}var ft=[`Check & run`,`Layout & convert`,`Deploy & share`,`View`,`File`,`Edit`,`Help`];function pushRecent(e,t){return[t,...e.filter(e=>e!==t)].slice(0,5)}function browseGroups(e,t){let n=new Map(e.map(e=>[e.id,e])),r=t.map(e=>n.get(e)).filter(e=>e!==void 0),i=new Set(r.map(e=>e.id)),a=r.length>0?[{title:saySection(`Recent`),items:r}]:[];for(let t of ft){let n=e.filter(e=>e.section===t&&!i.has(e.id));n.length>0&&a.push({title:saySection(t),items:n})}return a}function moveSelection(e,t,n){return n===0?-1:((e+t)%n+n)%n}function publishedActions(e,t){return e.filter(e=>e.listed).map(e=>{let n=F(e.shortcut,t);return{id:e.id,title:e.title,section:e.section,enabled:e.enabled,...e.checked===void 0?{}:{checked:e.checked},...n?{shortcut:n}:{}}})}function trailingToDrop(e,t){let n=0,r=0;for(let i=e.length-1;i>=0&&n<t;--i)n+=e[i],r+=1;return r}function beginWidthDrag(e,t){let n=t?.target??(typeof window<`u`?window:null);if(!n||typeof n.addEventListener!=`function`)return()=>{};let r=Number.isFinite(e)?e:0,i=Number.isFinite(t.min)?t.min:0,a=Number.isFinite(t.max)?t.max:Math.max(i,1e3),o=Math.min(i,a),s=Math.max(i,a),c=Number.isFinite(t.width)?Math.min(s,Math.max(o,t.width)):o,l=!1,move=e=>{let n=Number.isFinite(e?.clientX)?e.clientX:0;c=Math.min(s,Math.max(o,t.width+r-n));try{t.onWidth?.(c)}catch{}},end=()=>{if(!l){stop();try{t.onCommit(c)}catch{}}};function stop(){if(!l){l=!0;try{n.removeEventListener(`pointermove`,move),n.removeEventListener(`pointerup`,end),n.removeEventListener(`pointercancel`,end)}catch{}}}try{n.addEventListener(`pointermove`,move),n.addEventListener(`pointerup`,end),n.addEventListener(`pointercancel`,end)}catch{}return stop}function EditableTitle({title:e,editable:n,problem:r,onProblem:a}){let[o,c]=t(!1),d=i(null),f=i(null);l(()=>{n.start&&(c(!0),n.onStarted?.())},[n.start]),l(()=>{o&&(d.current?.focus(),d.current?.select())},[o]);let close=()=>{c(!1),requestAnimationFrame(()=>f.current?.focus())},settle=(e,t)=>{a(e),!(e&&t)&&close()},finish=(t,r)=>{let i=d.current?.value??e;if(!t){a(null),close();return}let o=Xe(e,i);if(!o){settle(null,!1);return}let s=n.onCommit(o);s instanceof Promise?s.then(e=>settle(e,r)):settle(s,r)};return o?s(`input`,{ref:d,class:`sidebar__nav-field type-input`,"aria-label":n.label,"aria-invalid":r?!0:void 0,defaultValue:e,onBlur:()=>o&&finish(!0,!1),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),finish(!0,!0)):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),finish(!1,!1))}}):s(`button`,{ref:f,type:`button`,class:`sidebar__nav-title type-section-heading is-editable`,title:u(`app.sidebar.clickOrPressF2To`,{title:e}),"aria-label":u(`app.sidebar.pressF2OrEnterTo`,{title:e,label:n.label}),onClick:()=>c(!0),onKeyDown:e=>Ve(e.key)&&c(!0),children:e})}function NavRow({title:e,backLabel:n,onBack:i,editable:a,trailing:o}){let[c,l]=t(null);return s(r,{children:[s(`div`,{class:`sidebar__nav`,children:[s(`button`,{type:`button`,class:`sidebar__icon`,"aria-label":n,title:u(`app.common.back`),onClick:i,children:s(q,{name:`back`})}),a?s(EditableTitle,{title:e,editable:a,problem:c,onProblem:l}):s(`span`,{class:`sidebar__nav-title type-section-heading`,title:e,children:e}),o?s(`span`,{class:`sidebar__nav-actions`,children:o}):null]}),c&&s(`p`,{class:`penstock-review__issue is-mismatch`,role:`alert`,children:c})]})}var pt=16,mt=28;function tabTitle(e){return u(`app.sidebar.tab.${e}`)}function sameIds(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function useFit$1(e,n,r){let[a,o]=t([]),s=i(new Map);return c(()=>{let t=e.current;if(!t||r===void 0||t.clientWidth===0)return;let i=getComputedStyle(t),a=parseFloat(i.columnGap)||0,c=(parseFloat(i.paddingLeft)||0)+(parseFloat(i.paddingRight)||0);for(let e of t.querySelectorAll(`:scope > [data-tab]`))s.current.set(e.getAttribute(`data-tab`)??``,e.offsetWidth);let l=Array.from(t.children).filter(e=>!e.hasAttribute(`data-tab`)&&!e.hasAttribute(`data-more`)).reduce((e,t)=>e+t.offsetWidth+a,0),u=je(n.map(e=>({id:e,width:(s.current.get(e)??mt)+a})),r,t.clientWidth-c-l,mt+a);o(e=>sameIds(e,u)?e:u)}),a}e(useFit$1,`useFit`);function Sidebar({tabs:e,api:n,badges:r={},statuses:a={},hidden:o=!1}){let{state:d,width:f,limits:p,drawer:m}=n,h=i(null),g=i(null),_=e.map(e=>e.id),v=e.find(e=>e.id===d.tab)??e[0],y=v?d.stacks[v.id]??[]:[],b=!d.hidden&&!(m&&d.collapsed),x=useFit$1(h,_,v?.id),[S,C]=t(!1),[w,T]=t(null);l(()=>{T(e=>e===v?.id?e:null)},[v?.id]);let E=i(null);if(c(()=>()=>{E.current?.(),E.current=null},[b]),d.hidden||o||!v)return null;if(m&&d.collapsed){let e=v.bar;return s(`div`,{class:`sidebar-bar`,role:`toolbar`,"aria-label":u(`app.sidebar.collapsedLabel`,{title:tabTitle(v.id)}),children:[e?s(e,{active:!0,views:y,width:f,push:e=>n.push(v.id,e),back:()=>n.back(v.id),reset:()=>n.reset(v.id)}):s(`span`,{class:`sidebar-bar__title`,children:tabTitle(v.id)}),s(`button`,{type:`button`,class:`sidebar__icon`,"aria-label":u(`app.sidebar.openTheSidebar`),title:u(`app.sidebar.openTheSidebar`),onClick:n.toggleCollapsed,children:s(q,{name:`expand`})})]})}let onTabKey=e=>{let t=Ae(_,v.id,e.key);t&&(e.preventDefault(),T(t),n.select(t),requestAnimationFrame(()=>{try{let e=typeof CSS<`u`&&CSS.escape?CSS.escape(t):t;h.current?.querySelector(`[data-tab="${e}"]`)?.focus()}catch{}}))},startDrag=e=>{e.preventDefault(),E.current?.(),E.current=beginWidthDrag(e.clientX,{width:f,min:p.min,max:p.max,onWidth:n.setWidth,onCommit:n.commitWidth})},onSeparatorKey=e=>{let t=e.key===`ArrowLeft`?pt:e.key===`ArrowRight`?-16:0;if(t===0)return;e.preventDefault();let r=Math.min(p.max,Math.max(p.min,f+t));n.setWidth(r),n.commitWidth(r)},onBodyKey=e=>{e.key===`Escape`&&y.length>0&&!(e.target instanceof Element&&e.target.closest(`input, textarea, select`))&&(e.preventDefault(),n.back(v.id))},D=e.filter(e=>x.includes(e.id));return s(`aside`,{ref:g,class:`sidebar${m?` is-drawer`:``}`,style:{width:`${f}px`},"aria-label":u(`app.sidebar.sidebar`),children:[s(`div`,{class:`sidebar__separator`,role:`separator`,"aria-orientation":`vertical`,"aria-label":u(`app.sidebar.resizeTheSidebar`),"aria-valuenow":f,"aria-valuemin":p.min,"aria-valuemax":p.max,tabIndex:0,onPointerDown:startDrag,onDblClick:()=>{n.setWidth(null),n.commitWidth(null)},onKeyDown:onSeparatorKey}),s(`div`,{class:`sidebar__tabs`,role:`tablist`,"aria-label":u(`app.sidebar.sidebar`),ref:h,onKeyDown:onTabKey,children:[e.filter(e=>!x.includes(e.id)).map(e=>{let t=qe(r[e.id]),i=e.id===v.id,o=a[e.id],c=o?u(`app.sidebar.status.${o}`):null;return s(`button`,{type:`button`,role:`tab`,id:`sidebar-tab-${e.id}`,"data-tab":e.id,"aria-selected":i,"aria-controls":`sidebar-panel-${e.id}`,tabIndex:i?0:-1,class:`sidebar__tab type-sidebar-tab${i?` type-sidebar-tab-selected is-selected`:``}`,title:i?void 0:tabTitle(e.id),"aria-label":i?void 0:[tabTitle(e.id),t?Be(r[e.id]):null,c].filter(Boolean).join(`, `),onClick:()=>n.select(e.id),children:[s(q,{name:e.icon}),i&&s(`span`,{class:`sidebar__tab-label`,children:tabTitle(e.id)}),o===`working`&&s(`span`,{class:`sidebar__status is-working`,"aria-hidden":`true`,children:s(ae,{})}),o===`waiting`&&s(`span`,{class:`sidebar__status is-waiting`,"aria-hidden":`true`}),t&&s(`span`,{class:`sidebar__badge`,"aria-label":Be(r[e.id]),children:t})]},e.id)}),D.length>0&&s(`div`,{class:`sidebar__more-wrap`,"data-more":!0,children:[s(`button`,{type:`button`,class:`sidebar__icon sidebar__more`,"aria-label":u(`app.sidebar.moreTabs`),title:u(`app.sidebar.moreTabs`),"aria-haspopup":`menu`,"aria-expanded":S,onClick:()=>C(e=>!e),onKeyDown:e=>{e.key===`Escape`&&C(!1)},children:s(q,{name:`more`})}),S&&s(`div`,{class:`sidebar__menu`,role:`menu`,"aria-label":u(`app.sidebar.moreTabs`),children:D.map(e=>s(`button`,{type:`button`,role:`menuitem`,class:`sidebar__menu-item type-sidebar-tab`,"data-tab-more":e.id,onClick:()=>{C(!1),n.select(e.id)},children:[s(q,{name:e.icon}),s(`span`,{children:tabTitle(e.id)})]},e.id))})]}),m&&s(`button`,{type:`button`,class:`sidebar__icon sidebar__collapse`,"aria-label":u(`app.sidebar.collapseTheSidebar`),title:u(`app.sidebar.collapseTheSidebar`),onClick:n.toggleCollapsed,children:s(q,{name:`close`})})]}),y.length>0&&!v.ownHeader&&s(NavRow,{title:y[y.length-1].title,backLabel:u(`app.sidebar.backTo`,{title:y.length>1?y[y.length-2].title:tabTitle(v.id)}),onBack:()=>n.back(v.id)}),s(`div`,{class:`sidebar__body`,"data-switch":w===v.id?`key`:`pointer`,onKeyDown:onBodyKey,children:e.map(e=>{let t=e.component,r=e.id===v.id;return s(`div`,{role:`tabpanel`,id:`sidebar-panel-${e.id}`,"aria-labelledby":`sidebar-tab-${e.id}`,class:`sidebar__panel${e.padded?` sidebar__content`:``}`,hidden:!r,children:s(t,{active:r,views:d.stacks[e.id]??[],width:f,push:t=>n.push(e.id,t),back:()=>n.back(e.id),reset:()=>n.reset(e.id)})},e.id)})})]})}var Z=1100;function useSidebar(e,r){let[o,s]=t(()=>Ne(G(),e,r)),[c,u]=t(Z),[d,f]=t(!1),[p,m]=t(null),h=i(null),g=n(e=>{if(h.current?.disconnect(),h.current=null,e){try{u(e.getBoundingClientRect().width||Z)}catch{u(Z)}typeof ResizeObserver<`u`&&(h.current=new ResizeObserver(()=>{if(e)try{u(e.getBoundingClientRect().width||Z)}catch{}}),h.current.observe(e))}},[]);l(()=>()=>{h.current?.disconnect(),h.current=null},[]);let _=i(we(o,r,G())),v=n(e=>{let t=we(e,r,_.current);if(JSON.stringify(t)!==JSON.stringify(_.current)){_.current=t;try{K(t)}catch{}}},[r]);l(()=>{v({...o,width:_.current.sidebarWidth??null})},[o.tab,o.hidden,o.collapsed]);let y=Ue(c),b=o.tab,x=o.collapsed,S=i(y);S.current=y;let C=n(t=>{S.current?e.includes(t)&&(m({tab:t,collapsed:!1}),f(!0)):s(n=>Qe(n,e,t))},[e.join(`|`)]),w=n(()=>{S.current?f(e=>!e):s(he)},[]),T=n(()=>{S.current?m(e=>({tab:e?.tab??b,collapsed:!(e?.collapsed??x)})):s(_e)},[b,x]),E=n((e,t)=>s(n=>Ye(n,e,t)),[]),D=n(e=>s(t=>De(t,e)),[]),O=n(e=>s(t=>et(t,e)),[]),k=n(e=>s(t=>({...t,width:e})),[]),A=i(o);A.current=o;let j=n(e=>v(e===void 0?A.current:{...A.current,width:e}),[v]),M=a(()=>y?{...o,tab:p?.tab??o.tab,collapsed:p?.collapsed??o.collapsed,hidden:!d}:o,[o,y,d,p]),N=Se(M,y),P=i(null),F=n(t=>{if(N===t){let n=P.current;P.current=null,C(n&&e.includes(n)?n:e.find(e=>e!==t)??t)}else P.current=N??A.current.tab,C(t)},[N,C,e.join(`|`)]);return a(()=>({state:M,width:Oe(o.width,c),limits:be(c),drawer:y,editorWidth:c,measure:g,select:C,toggle:w,toggleCollapsed:T,push:E,back:D,reset:O,setWidth:k,commitWidth:j,shownTab:N,pressTab:F}),[M,o.width,y,c,g,C,w,T,E,D,O,k,j,N,F])}function createPanelHost(){return document.createElement(`div`)}function PanelHost({host:e,id:t,class:n,shown:r}){let a=i(null);return c(()=>{t!==void 0&&(e.id=t),n!==void 0&&(e.className=n),r!==void 0&&(e.style.display=r?`block`:`none`)},[e,t,n,r]),c(()=>{let t=a.current;if(t)return t.appendChild(e),()=>{e.parentNode===t&&t.removeChild(e)}},[e]),s(`div`,{ref:a,style:{display:`contents`}})}var ht={error:`M 339.07183,256.00001 463.66713,131.4047 c 15.28961,-15.2896 15.28961,-40.079175 0,-55.381227 l -27.6906,-27.690611 c -15.28961,-15.289602 -40.07917,-15.289602 -55.38123,0 L 256,172.92818 131.4047,48.332862 c -15.2896,-15.289602 -40.079177,-15.289602 -55.381228,0 L 48.332861,76.023473 c -15.2896,15.2896 -15.2896,40.079177 0,55.381227 L 172.92815,256.00001 48.332861,380.59531 c -15.2896,15.2896 -15.2896,40.07917 0,55.38123 l 27.690611,27.69061 c 15.289601,15.28959 40.091628,15.28959 55.381228,0 L 256,339.07184 380.5953,463.66715 c 15.2896,15.28959 40.09162,15.28959 55.38123,0 l 27.6906,-27.69061 c 15.28961,-15.2896 15.28961,-40.07918 0,-55.38123 z`,warning:`m256 323.95c-45.518 0-82.419 34.576-82.419 77.229 0 42.652 36.9 77.229 82.419 77.229 45.518 0 82.419-34.577 82.419-77.23 0-42.652-36.9-77.229-82.419-77.229zm-80.561-271.8 11.61 204.35c.544 9.334 8.78 16.64 18.755 16.64h100.39c9.975 0 18.211-7.306 18.754-16.64l11.611-204.35c.587-10.082-7.98-18.56-18.754-18.56h-123.62c-10.775 0-19.34 8.478-18.753 18.56z`};function SeverityIcon({severity:e}){return s(`span`,{class:`severity severity--${e}`,role:`img`,"aria-label":u(e===`error`?`app.diagramCheck.error`:`app.diagramCheck.warning`),children:s(`svg`,{viewBox:`0 0 512 512`,"aria-hidden":`true`,children:s(`path`,{d:ht[e],fill:`currentColor`})})})}function usePinning(){let[,e]=t(0);l(()=>{try{return ce(()=>e(e=>e+1))}catch{return}},[]);let n=G()||{},r=Array.isArray(n.toolbarPinned)?n.toolbarPinned:[],i=Array.isArray(n.toolbarUnpinned)?n.toolbarUnpinned:[],isPinned=e=>!e||!e.id?!1:e.place===`pinned`?!i.includes(e.id):r.includes(e.id),toggle=e=>{if(!e||!e.id)return;let flip=t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id];try{K(e.place===`pinned`?{toolbarUnpinned:flip(i)}:{toolbarPinned:flip(r)})}catch{}};return{isPinned,toggle}}function hostIsMac(){return typeof navigator<`u`&&typeof navigator?.platform==`string`&&N(navigator.platform)}var gt=`palette-list`,optionId=e=>`palette-option-${e}`;function Highlighted({title:e,ranges:t}){let n=typeof e==`string`?e:String(e??``),i=Array.isArray(t)?t:[];if(i.length===0)return s(r,{children:n});let a=[],o=0;return i.forEach(([e,t])=>{let i=Math.max(0,Math.min(n.length,Number.isFinite(e)?e:0)),c=Math.max(i,Math.min(n.length,Number.isFinite(t)?t:i));i>o&&a.push(s(r,{children:n.slice(o,i)})),a.push(s(`span`,{className:`palette__match`,children:n.slice(i,c)})),o=c}),o<n.length&&a.push(s(r,{children:n.slice(o)})),s(r,{children:a})}function Palette({entries:e,recent:n,pinning:r,locked:o,onRun:u,onClose:d,returnFocusTo:f}){let p=re(),[m,h]=t(``),[g,_]=t(0),v=i(null),y=i(null),b=hostIsMac(),x=a(()=>(Array.isArray(e)?e:[]).filter(Boolean).map(e=>({id:e.id,title:e.title,section:e.section,keywords:e.keywords,entry:e,ranges:[]})),[e]),S=m.trim().length>0,C=a(()=>{if(S){let e=rankActions(x,m).map(e=>({...e.action,ranges:e.ranges}));return e.length>0?[{title:``,items:e}]:[]}return browseGroups(x,Array.isArray(n)?n:[])},[x,n,m,S]),w=a(()=>(Array.isArray(C)?C:[]).flatMap(e=>Array.isArray(e?.items)?e.items:[]),[C]),T=w[g];l(()=>_(0),[m]),l(()=>{if(T)try{let e=typeof CSS<`u`&&CSS.escape?CSS.escape(optionId(T.id)):optionId(T.id);v.current?.querySelector(`#${e}`)?.scrollIntoView({block:`nearest`})}catch{}},[T?.id]),c(()=>{let e=y.current;if(!e)return;let t=f,n=[],r=e,i=0;for(;r&&r.parentElement&&i<50;){i+=1;let e=r.parentElement;for(let t of Array.from(e.children))t===r||t.hasAttribute(`inert`)||(t.setAttribute(`inert`,``),n.push(t));r=e}return()=>{n.forEach(e=>e.removeAttribute(`inert`));let r=document.activeElement,i=r!==null&&e.contains(r),a=r===null||r===document.body||!document.contains(r);if((i||a)&&t)try{t.focus()}catch{}}},[]);let run=e=>{if(e&&e.entry.enabled)try{u(e.entry)}catch{}},keys=e=>{if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),d();else if(e.key===`ArrowDown`||e.key===`ArrowUp`)e.preventDefault(),_(t=>moveSelection(t,e.key===`ArrowDown`?1:-1,w.length));else if(e.key===`Home`&&e.ctrlKey)e.preventDefault(),_(0);else if(e.key===`End`&&e.ctrlKey)e.preventDefault(),_(Math.max(0,w.length-1));else if(e.key===`Enter`){if(e.preventDefault(),e.shiftKey){if(T)try{r?.toggle?.(T.entry)}catch{}}else run(T)}else e.key===`Tab`&&e.preventDefault()},flatIndex=e=>w.findIndex(t=>t.id===e.id);return s(`div`,{ref:y,className:`palette-overlay`,onMouseDown:e=>{e.target===e.currentTarget&&d()},children:s(`div`,{className:`palette`,role:`dialog`,"aria-modal":`true`,"aria-label":p(`app.palette.label`),children:[s(`input`,{className:`palette__field`,type:`text`,role:`combobox`,"aria-expanded":`true`,"aria-controls":gt,"aria-autocomplete":`list`,"aria-activedescendant":T?optionId(T.id):void 0,"aria-describedby":`palette-hint`,placeholder:p(`app.palette.search`),spellcheck:!1,autoComplete:`off`,autoFocus:!0,value:m,onInput:e=>h(e.currentTarget.value),onKeyDown:keys,ref:e=>e?.focus()}),s(`span`,{id:`palette-hint`,className:`palette__hint`,children:p(`app.palette.hint`)}),s(`ul`,{className:`palette__list`,id:gt,role:`listbox`,"aria-label":p(`app.palette.actions`),ref:v,children:[C.map(e=>s(`li`,{role:`presentation`,className:`palette__group`,children:[e.title&&s(`div`,{className:`palette__heading`,role:`presentation`,children:e.title}),s(`ul`,{role:`group`,"aria-label":e.title||p(`app.palette.matches`,{count:e.items.length}),className:`palette__group`,children:e.items.map(e=>{let t=e.entry,n=!!r?.isPinned?.(t),i=t.place!==`bar`,a=F(t.shortcut,b);return s(`li`,{id:optionId(e.id),role:`option`,"aria-selected":flatIndex(e)===g,"aria-disabled":!t.enabled,"aria-checked":t.checked===void 0?void 0:t.checked,className:`palette__row${flatIndex(e)===g?` is-active`:``}`,"aria-label":t.tier?`${e.title}, Penstock ${t.tier}`:e.title,title:t.tooltip,onMouseMove:()=>_(flatIndex(e)),onClick:()=>run(e),children:[s(`span`,{className:`palette__icon`,children:s(X,{name:t.icon})}),s(`span`,{className:`palette__title`,children:s(Highlighted,{title:e.title,ranges:e.ranges})}),S&&s(`span`,{className:`palette__section`,children:e.section}),t.tier&&s(`span`,{className:`palette__tier`,children:[o&&s(X,{name:`lock`}),t.tier]}),a&&s(`span`,{className:`palette__shortcut`,children:a}),t.checked&&s(`span`,{className:`palette__check`,children:s(X,{name:`check`})}),i&&s(`button`,{type:`button`,tabIndex:-1,"aria-hidden":`true`,className:n?`palette__pin is-pinned`:`palette__pin`,title:p(n?`app.palette.unpin`:`app.palette.pin`),onMouseDown:e=>e.preventDefault(),onClick:e=>{e.stopPropagation();try{r?.toggle?.(t)}catch{}},children:s(X,{name:`pin`})})]},e.id)})})]},e.title||`results`)),w.length===0&&s(`li`,{className:`palette__empty`,role:`presentation`,children:p(`app.palette.noMatch`,{query:m.trim()})})]})]})})}function useHostActions(e,t){let n=J(),r=i({actions:e,openPalette:t});r.current={actions:e,openPalette:t};let a=`[]`;try{a=JSON.stringify(publishedActions(Array.isArray(e)?e:[],hostIsMac()))}catch{a=`[]`}l(()=>{if(n)try{let e=O();e?.publishActions&&e.publishActions(JSON.parse(a)).catch(()=>{})}catch{}},[a,n]),l(()=>{if(n)try{let e=O();return e?.onRunAction?e.onRunAction(e=>{try{if(e===_.id){r.current.openPalette();return}let t=(Array.isArray(r.current.actions)?r.current.actions:[]).find(t=>t?.id===e);if(t?.enabled){let e=t.run();e&&typeof e.catch==`function`&&e.catch(e=>console.error(e))}}catch(e){console.error(e)}}):void 0}catch{return}},[n])}function isAction(e){return!(`type`in e)}function TextButton({entry:e,wrapped:t=!1}){let n=[`toolbar-button`,`type-toolbar-button`,`with-label`];return e.presentation===`primary`&&n.push(`primary`),e.checked&&n.push(`active`),s(`button`,{type:`button`,id:e.id,className:n.join(` `),onClick:e.run,disabled:!e.enabled,title:e.disabledReason??P(e.tooltip,e.title,e.shortcut,hostIsMac()),"aria-description":e.disabledReason,"aria-pressed":e.checked,"aria-haspopup":e.popup===void 0?void 0:`dialog`,"aria-expanded":e.popup,"data-droppable":!t&&e.presentation!==`primary`&&e.place!==`bar`?``:void 0,children:s(`span`,{className:`toolbar-button-label`,children:e.title})})}function inPalette(e){return isAction(e)&&e.listed}function usePopup(e,t,n,r){l(()=>{if(!e)return;let away=e=>{n.current?.contains(e.target)||t(!1)},keys=e=>{if(e.key===`Escape`&&t(!1),e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let n=Array.from(r.current?.querySelectorAll(`.toolbar-menu__item:not(:disabled)`)??[]);if(n.length===0)return;e.preventDefault();let i=n.indexOf(document.activeElement);n[e.key===`ArrowDown`?(i+1)%n.length:(i-1+n.length)%n.length].focus()};return document.addEventListener(`mousedown`,away),document.addEventListener(`keydown`,keys),r.current?.querySelector(`.toolbar-menu__item:not(:disabled)`)?.focus(),()=>{document.removeEventListener(`mousedown`,away),document.removeEventListener(`keydown`,keys)}},[e])}function SplitButton({entry:e,menu:n}){let[r,a]=t(!1),o=i(null),c=i(null);usePopup(r,a,o,c);let l=e.presentation===`primary`?` primary`:``;return s(`div`,{className:`toolbar-menu toolbar-split`,ref:o,"data-droppable":e.presentation!==`primary`&&e.place!==`bar`?``:void 0,children:[s(TextButton,{entry:e,wrapped:!0}),s(`button`,{type:`button`,className:`toolbar-button type-toolbar-button toolbar-split__more${l}${r?` active`:``}`,onClick:()=>a(e=>!e),title:u(`app.toolbar.moreWaysTo`,{title:e.title.toLowerCase()}),"aria-label":u(`app.toolbar.moreWaysTo`,{title:e.title.toLowerCase()}),"aria-haspopup":`menu`,"aria-expanded":r,children:s(`span`,{className:`toolbar-button-icon`,role:`presentation`,children:s(X,{name:`chevron`})})}),r&&s(`div`,{className:`toolbar-menu__list toolbar-menu__list--end`,role:`menu`,ref:c,children:n.map(e=>s(`div`,{className:`toolbar-menu__row`,children:s(`button`,{type:`button`,id:e.id,role:`menuitem`,className:`toolbar-menu__item`,title:e.tooltip,onClick:()=>{a(!1),e.run()},children:[s(X,{name:e.icon}),s(`span`,{className:`toolbar-menu__label`,children:e.title})]})},e.id))})]})}function PaletteTrigger({open:e,onOpen:t,trigger:n}){let r=u(`app.toolbar.moreActionsHint`,{shortcut:F(_.shortcut,hostIsMac())});return s(`button`,{type:`button`,id:`toolbar-more`,ref:n,className:e?`toolbar-button type-toolbar-button active`:`toolbar-button type-toolbar-button`,onClick:t,title:r,"aria-label":u(`app.toolbar.moreActions`),"aria-haspopup":`dialog`,"aria-expanded":e,children:s(`span`,{className:`toolbar-button-icon`,role:`presentation`,children:s(X,{name:`more`})})})}function Action({entry:e}){return e.menu&&e.menu.length>0?s(SplitButton,{entry:e,menu:e.menu}):e.presentation===`text`||e.presentation===`primary`?s(TextButton,{entry:e}):s(Pe,{id:e.id,label:e.title,icon:e.icon,action:e.run,disabled:!e.enabled,tooltip:e.disabledReason??P(e.tooltip,e.title,e.shortcut,hostIsMac()),description:e.disabledReason,isActive:e.checked,checked:e.checked,status:e.status})}function useLocked(e){let[n,r]=t(!1);return l(()=>{if(!e)return;let t=!0;try{O()?.getLicense?.()?.then(e=>t&&r(!Te(e)))?.catch(()=>void 0)}catch{}return()=>{t=!1}},[e]),n}function useRecent(){let[,e]=t(0);l(()=>{try{return ce(()=>e(e=>e+1))}catch{return}},[]);let n=G()?.recentActions;return Array.isArray(n)?n:[]}var _t=4;function useFit(e){let t=n(()=>{let t=e.current;if(!t)return;let n=Array.from(t.querySelectorAll(`[data-droppable]`));n.forEach(e=>{e.style.display=``});let r=t.scrollWidth-t.clientWidth;if(r<=0)return;let i=trailingToDrop(n.map(e=>e.offsetWidth+_t),r);n.slice(n.length-i).forEach(e=>{e.style.display=`none`})},[e]);c(t),l(()=>{let n=e.current;if(!n||typeof ResizeObserver>`u`)return;let r=new ResizeObserver(t);return r.observe(n),()=>r.disconnect()},[t,e])}function Toolbar({items:e,visible:r=!0,className:a=``}){let o=usePinning(),c=i(null);useFit(c);let[u,d]=t(!1),f=i(null),p=i(null),m=useLocked(u),h=useRecent(),g=e.filter(isAction),v=e.filter(inPalette).sort((e,t)=>e.order-t.order),y=n(()=>{let e=document.activeElement;p.current=e instanceof HTMLElement&&e!==document.body?e:f.current,d(!0)},[]),b=n(()=>{d(!1)},[]),x=v.length>0;useHostActions(g,y);let C=J();l(()=>{if(!x||!C)return;let keys=e=>{S(e,_.shortcut,hostIsMac())&&(e.preventDefault(),u||y())};return document.addEventListener(`keydown`,keys),()=>document.removeEventListener(`keydown`,keys)},[x,u,y,C]);let w=n(e=>{if(b(),e){try{K({recentActions:pushRecent(G()?.recentActions??[],e.id)})}catch{}setTimeout(()=>{try{e.run()}catch(e){console.error(`Error executing toolbar action:`,e)}},0)}},[b]);if(!r)return null;let T=e.some(e=>`type`in e&&e.type===`overflow`)||!x?e:[...e,{type:`overflow`}];return s(`div`,{className:`toolbar ${a}`.trim(),ref:c,children:[T.map((e,t)=>isAction(e)?e.place===`menu`||e.place===`pinned`&&!o.isPinned(e)?null:s(Action,{entry:e},e.id):e.type===`separator`?s(`div`,{className:`toolbar-separator`},`sep-${t}`):e.type===`spacer`?s(`div`,{className:`toolbar-spacer`},`spacer-${t}`):x?[...v.filter(e=>e.place===`menu`&&o.isPinned(e)).map(e=>s(TextButton,{entry:{...e,id:`pinned-${e.id}`,title:e.title.replace(/…$/,``)}},`pinned-${e.id}`)),s(PaletteTrigger,{open:u,onOpen:y,trigger:f},`overflow`)]:null),u&&s(Palette,{entries:v,recent:h,pinning:o,locked:m,onRun:w,onClose:b,returnFocusTo:p.current})]})}function connectionActions(e){let t={id:`save-deploy`,label:u(`app.deploy.saveAndDeploy`),deploy:!0,role:e===`edit`?`secondary`:`primary`};return e===`edit`?[{id:`save`,label:u(`app.common.save`),deploy:!1,role:`primary`},t]:[t]}var vt=[`url`,`username`,`password`,`clientId`,`clientSecret`,`tokenUrl`];function isWebAddress(e){try{return/^https?:$/.test(new URL(e).protocol)}catch{return!1}}function connectionErrors(e){let t={},n=e.authType??`none`;return isWebAddress(e.url??``)||(t.url=u(`app.deploy.addressScheme`)),n===`basic`&&(e.username?.trim()||(t.username=u(`app.deploy.enterTheUserNameTo`)),!e.password&&!e.passwordSaved&&(t.password=u(`app.deploy.enterThePasswordToSign`))),n===`oauth`&&(e.clientId?.trim()||(t.clientId=u(`app.deploy.enterTheClientId`)),!e.clientSecret&&!e.clientSecretSaved&&(t.clientSecret=u(`app.deploy.enterTheClientSecret`)),isWebAddress(e.tokenUrl??``)||(t.tokenUrl=u(`app.deploy.tokenAddressScheme`))),t}var yt={none:[],basic:[`username`,`password`],oauth:[`clientId`,`clientSecret`,`tokenUrl`,`audience`]};function connectionFieldsOf(e){return yt[e??`none`]??[]}function firstInvalid(e){return vt.find(t=>t in e)??null}var bt=Object.values(p),xt=L(`http://localhost:8080/engine-rest`),St=L(`http://localhost:8088`),Ct=L(`https://login.cloud.camunda.io/oauth/token`);function ConnectionDialog({profile:e,engine:n,opened:r,onClose:i,onSaved:a}){let[o,c]=t({profile:e}),[d,f]=t(!1),[p,m]=t(!1),[h,g]=t(null),_=ie();l(()=>{let t=!1;return O().getDeploymentSettings(e).then(n=>{t||c({...n,profile:e})}).catch(e=>console.error(`Failed to read the connection settings:`,e)).finally(()=>{t||f(!0)}),()=>{t=!0}},[e]),l(()=>{d&&document.querySelector(`.ui-dialog__body input`)?.focus()},[d]);let v=o.authType??`none`,set=e=>c(t=>({...t,...e})),y=connectionErrors(o),save=async e=>{if(_.submit(),firstInvalid(y))requestAnimationFrame(()=>document.querySelector(`.ui-dialog [aria-invalid="true"]`)?.focus());else{m(!0),g(null);try{await O().saveDeploymentSettings(o),a(e)}catch(e){g(u(`app.deploy.unableToSaveTheConnection`,{failure:M(e)}))}finally{m(!1)}}},field=(e,t,n={})=>s(U,{label:e,hint:n.hint,optional:n.optional,error:_.errorOf(t,y[t]??null),children:e=>s(`input`,{...e,type:n.type??`text`,value:o[t]??``,placeholder:n.placeholder,disabled:!d||p,onInput:e=>set({[t]:e.target.value}),onBlur:()=>_.touch(t)})}),b=connectionActions(r),x=b.find(e=>e.role===`primary`)??b[0];return s(H,{title:u(`app.deploy.engineConnection`),subtitle:`${A(n)} · ${Y({profile:e})}`,size:`medium`,onClose:i,onSubmit:()=>void save(x.deploy),footer:s(W,{actions:[{id:`cancel`,label:u(`app.common.cancel`),role:`cancel`,onClick:i,disabled:p},...b.map(e=>({id:e.id,label:e.label,role:e.role,onClick:()=>void save(e.deploy),disabled:!d,busy:p}))]}),children:[field(u(`app.deploy.engineAddress`),`url`,{placeholder:k(n)?St:xt,hint:u(`app.deploy.keptInPenstockLocalYaml`)}),s(U,{label:u(`app.deploy.signIn`),group:`radiogroup`,children:e=>s(`div`,{...e,class:`ui-choice-group`,children:bt.map(e=>s(`label`,{class:`ui-choice`,children:[s(`input`,{type:`radio`,name:`auth`,checked:v===e,disabled:!d||p,onChange:()=>{_.reveal(connectionFieldsOf(e)),set({authType:e})}}),s(`span`,{children:u(e===`none`?`app.deploy.notNeeded`:e===`basic`?`app.deploy.userAndPassword`:`app.deploy.oauthClient`)})]},e))})}),v===`basic`&&field(u(`app.deploy.user`),`username`),v===`basic`&&field(u(`app.deploy.password`),`password`,{type:`password`,hint:o.passwordSaved?u(`app.deploy.savedInTheIdeS`):u(`app.deploy.keptInTheIdeS`)}),v===`oauth`&&field(u(`app.deploy.clientId`),`clientId`),v===`oauth`&&field(u(`app.deploy.clientSecret`),`clientSecret`,{type:`password`,hint:o.clientSecretSaved?u(`app.deploy.savedInTheIdeS`):u(`app.deploy.keptInTheIdeS`)}),v===`oauth`&&field(u(`app.deploy.tokenAddress`),`tokenUrl`,{placeholder:Ct}),v===`oauth`&&field(u(`app.deploy.audience`),`audience`,{optional:!0}),s(`p`,{class:`ui-field__hint`,children:u(`app.deploy.nameTenantAndTheRest`)}),h&&s(se,{children:h})]})}var wt=4;function sentFiles(e){return e.length>wt?{names:e.slice(0,wt),more:e.length-wt}:{names:e,more:0}}function hookLines(e){let[t,...n]=e;return{command:t??u(`app.deploy.runningTheDeployHook`),said:n.filter(e=>e.trim().length>0)}}function deployPopover(e,t){let n=e?.targets??[],r=n.find(e=>(e.profile??null)===t)??null,i=r?.ready===!0;return{profiles:n.map(e=>({value:e.profile??null,label:e.profile??`default`})),chooseProfile:n.length>1,target:r,address:r?.url??null,canDeploy:i,action:u(i?`app.deploy.deploy`:`app.deploy.setUpConnection`)}}function DeployPopover({deploy:e}){let[n,i]=t(e.targets?.active??null),[a,o]=t(null),c=deployPopover(e.targets,n),d=sentFiles(a??[]),f=tt(`deploy`),p=e.running,m=hookLines(p?.lines??[]);l(()=>{let t=!1;return e.filesToSend().then(e=>!t&&o(e)).catch(()=>!t&&o([])),()=>{t=!0}},[]);let run=()=>{e.deployTo(n)},edit=()=>{e.edit(n)};return s(V,{anchor:f,label:u(`app.deploy.deploy`),onClose:e.closePopover,width:352,class:`deploy-popover`,children:[s(`h3`,{class:`ui-popover__title`,children:u(`app.deploy.deploy`)}),c.chooseProfile&&s(U,{label:u(`app.deploy.profile`),layout:`top`,children:e=>s(`select`,{...e,value:n??``,onChange:e=>i(e.target.value||null),children:c.profiles.map(e=>s(`option`,{value:e.value??``,children:e.label},e.value??`default`))})}),s(`dl`,{class:`ui-popover__facts`,children:[s(`dt`,{children:u(`app.deploy.engineAddress`)}),s(`dd`,{children:c.address??u(`app.deploy.notSetYet`)}),s(`dt`,{children:u(`app.deploy.whatWillBeSent`)}),s(`dd`,{children:[a===null&&u(`app.deploy.readingTheDiagram`),a!==null&&d.names.length===0&&u(`app.deploy.nothingToDeploy`),d.names.map(e=>s(`span`,{class:`ui-popover__file`,children:e},e)),d.more>0&&s(`span`,{class:`ui-popover__file`,children:u(`app.deploy.andNMore`,{number:d.more})})]}),p&&s(r,{children:[s(`dt`,{children:u(`app.deploy.deployHook`)}),s(`dd`,{"aria-busy":`true`,children:[s(`span`,{class:`ui-popover__file`,children:m.command}),m.said.map(e=>s(`span`,{class:`ui-popover__file`,children:e},e))]})]})]}),s(`div`,{class:`ui-popover__actions`,children:s(ne,{actions:[...p&&p.cancellable?[{id:`cancel`,label:u(`app.common.cancel`),role:`cancel`,onClick:e.cancelDeploy}]:[],...c.canDeploy&&!p?[{id:`edit`,label:u(`app.deploy.editConnection`),role:`secondary`,onClick:edit}]:[],{id:`deploy`,label:c.action,role:`primary`,onClick:run,busy:p!==null,disabled:p!==null||c.target===null&&e.targets!==null}]})})]})}function DeployLayer({deploy:e,engine:t}){return s(r,{children:[e.popover&&s(DeployPopover,{deploy:e}),e.editing&&s(ConnectionDialog,{profile:e.editing.profile??null,engine:t,onClose:e.closeEditor,opened:e.editingFor,onSaved:t=>void e.saved(t)})]})}function deployFailure(e){return{message:e.message,editConnection:e.status===401||e.status===403}}function useDeploy(e,r){let[a,o]=t(null),[s,c]=t(null),[d,p]=t(`deploy`),[m,h]=t(!1),[g,_]=t(null),v=i(null),y=i(!0),b=n((e,t)=>{h(!1),p(e),c(t)},[]),x=n(async()=>{try{let e=await O().getDeployTargets();return y.current&&o(e),e}catch(e){return console.error(`Failed to read the deployment targets:`,e),null}},[]);l(()=>(y.current=!0,x(),()=>{y.current=!1,v.current?.abort()}),[x]);let find=(e,t)=>e?.targets?.find(e=>(e?.profile??null)===t)??{profile:t,ready:!1},S=n(async t=>{let n=window.appConfig?.bpmnFilePath,r=n?await f(()=>import(`./testCaseRuns-DLEqANBi.js`).then(e=>e.f).then(e=>e.resourcesOf(n,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url).catch(()=>null):null;return r&&r.length>0?r.map(e=>({name:e.name,content:e.content})):[{name:e,content:t}]},[e]),C=n(async()=>{try{let e=await r();return e?(await S(e)).map(e=>e.name):[]}catch{return[]}},[r,S]),w=n(async t=>{let n;try{n=await r()}catch(e){j.error(u(`app.deploy.unableToDeploy`,{reason:e instanceof Error?e.message:String(e)}));return}if(!n){j.error(u(`app.deploy.nothingInToDeploy`,{fileName:e}));return}let i=j.info(u(`app.deploy.deployingTo`,{fileName:e,target:Y(t)})),a=new AbortController;v.current=a,_({lines:[],cancellable:O().hookRunsInBackground===!0});let o=null,s=``;try{o=await Le(t,await S(n),void 0,{signal:a.signal,onLines:e=>_(t=>t&&{...t,lines:e})})}catch(e){s=e instanceof Error?e.message:String(e)}finally{j.hide(i)}if(v.current=null,_(null),!o)j.error(u(`app.deploy.unableToDeploy`,{reason:s}));else if(a.signal.aborted)j.info(u(`app.deploy.deployToCancelled`,{target:Y(t)}));else if(o.ok)j.success(u(`app.deploy.succeededOn`,{message:o.message,target:t.url??Y(t)}));else{let e=deployFailure(o);j.error(e.message,e.editConnection?{label:u(`app.deploy.editConnection2`),run:()=>b(`deploy`,t)}:void 0)}},[r,e,S,b]),T=n(async e=>{let t=find(a??await x(),e);t.ready?await w(t):b(`deploy`,t)},[a,x,w,b]),E=n(async e=>{let t=s?.profile??null;c(null);let n=find(await x(),t);e&&n.ready&&await w(n)},[s,x,w]);return{targets:a,running:g,cancelDeploy:n(()=>v.current?.abort(),[]),editing:s,editingFor:d,popover:m,togglePopover:()=>h(e=>!e),closePopover:()=>h(!1),filesToSend:C,deployTo:T,edit:e=>b(`edit`,find(a,e)),closeEditor:()=>c(null),saved:E}}function deployState(e){return{active:e?.targets?.active??null,targets:(e?.targets?.targets??[]).map(e=>({profile:e?.profile??null,label:Y(e),url:e?.url})),popover:e?.popover??!1,open:e?.togglePopover??(()=>{}),deployTo:t=>void e?.deployTo?.(t),edit:t=>e?.edit?.(t)}}var Tt=4;function problemTally(e){return u(`app.problems.tally`,{count:e})}function CheckCard({title:e,tally:t,isError:n,findings:r,moreCount:i,clean:a,onRecheck:o,onClose:c,onShowAll:l,onPick:d}){let f=Array.isArray(r)?r:[],p=i===void 0?f.slice(0,Tt):f,m=i??Math.max(0,f.length-p.length);return p.length===0&&m===0&&!n&&a?s(`aside`,{class:`diagram-check diagram-check--clean`,"aria-label":e,"aria-description":a,"aria-live":`polite`,title:a,children:[s(`svg`,{class:`diagram-check__ok`,viewBox:`0 0 16 16`,width:`16`,height:`16`,"aria-hidden":`true`,children:s(`path`,{d:`M3.5 8.5 6.5 11.5 12.5 4.5`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`})}),s(`span`,{class:`diagram-check__tally is-clean`,children:u(`app.diagramCheck.noProblemsFound`)}),s(`button`,{type:`button`,class:`ui-button`,onClick:o,title:u(`app.common.checkAgain`),children:u(`app.common.recheck`)})]}):s(`aside`,{class:`diagram-check`,"aria-label":e,"aria-live":`polite`,children:[s(`header`,{class:`diagram-check__bar`,children:[s(`span`,{class:`diagram-check__title`,children:e}),s(`span`,{class:n?`diagram-check__tally is-error`:`diagram-check__tally`,children:t}),s(`button`,{type:`button`,class:`ui-button`,onClick:o,title:u(`app.common.checkAgain`),children:u(`app.common.recheck`)}),s(`button`,{type:`button`,class:`diagram-check__close`,onClick:c,title:u(`app.editorShell.close`,{title:e.toLowerCase()}),"aria-label":u(`app.editorShell.close`,{title:e.toLowerCase()}),children:s(`svg`,{viewBox:`0 0 16 16`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"aria-hidden":`true`,children:s(`path`,{d:`M4.5 4.5 11.5 11.5M11.5 4.5 4.5 11.5`})})})]}),s(`div`,{class:`diagram-check__body`,children:p.length>0&&s(`ul`,{class:`diagram-check__list diagram-check__summary`,children:p.map((e,t)=>e?s(`li`,{children:s(`button`,{type:`button`,class:e.severity?`diagram-check__row has-severity`:`diagram-check__row`,onClick:()=>d(t),children:[e.severity&&s(SeverityIcon,{severity:e.severity}),s(`span`,{class:`diagram-check__row-text`,children:[s(`span`,{class:`diagram-check__row-title`,children:e.title}),s(`span`,{class:`diagram-check__row-where diagram-check__row-where--wrap`,children:e.detail})]})]})},t):null)})}),(p.length>0||m>0)&&s(`footer`,{class:`diagram-check__more`,children:s(`button`,{type:`button`,class:`diagram-check__link`,onClick:l,children:m>0?u(`app.editorShell.showAllMore`,{more:m}):u(`app.common.showAll`)})})]})}var Et=u(`app.tracePaths.tracePaths`);function TraceCard({label:e,before:t,after:n,followMessages:i,showMessages:a,open:o,onToggle:c,onFollowMessages:l,onClose:d}){let f=R(e,t,n);return s(r,{children:[s(`button`,{type:`button`,class:o?`trace-pill is-open`:`trace-pill`,"aria-expanded":o,"aria-label":f,title:f,onClick:c,children:[s(`svg`,{viewBox:`0 0 16 16`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,dangerouslySetInnerHTML:{__html:te}}),s(`span`,{class:`trace-pill__counts`,children:`${t} → ${n}`})]}),o&&s(`aside`,{class:`diagram-check trace-card`,"aria-label":Et,children:[s(`div`,{class:`trace-card__row`,children:[s(`span`,{class:`trace-card__tally`,children:f}),s(`button`,{type:`button`,class:`trace-card__close`,onClick:d,title:u(`app.tracePaths.closeTrace`),"aria-label":u(`app.tracePaths.closeTrace`),children:s(`svg`,{viewBox:`0 0 16 16`,width:`16`,height:`16`,stroke:`currentColor`,fill:`none`,"stroke-width":`1.5`,"stroke-linecap":`round`,"aria-hidden":`true`,children:s(`path`,{d:`M4.5 4.5 11.5 11.5M11.5 4.5 4.5 11.5`})})})]}),a&&s(`label`,{class:`trace-card__option`,children:[s(`input`,{type:`checkbox`,checked:i,onChange:e=>l(e.currentTarget.checked)}),u(`app.tracePaths.followMessageFlows`)]})]})]})}var Dt=[`Canvas`,`Modeling`,`Edit`,`Penstock`],Ot={undo:{keys:[`Mod+Z`],action:`undo`},redo:{keys:[`Mod+Y`,`Mod+Shift+Y`,`Mod+Shift+Z`],action:`redo`},cut:{keys:[`Mod+X`],action:`cut`},copy:{keys:[`Mod+C`],action:`copy`},paste:{keys:[`Mod+V`],action:`paste`},duplicate:{keys:[`Mod+D`],action:`duplicate`},remove:{keys:[`Backspace`,`Delete`],action:`removeSelection`}},kt={selectAll:{keys:[`Mod+A`],action:`selectElements`},find:{keys:[`Mod+F`],action:`find`},zoomIn:{keys:[`Mod+=`],action:`stepZoom`},zoomOut:{keys:[`Mod+-`],action:`stepZoom`},fit:{keys:[`Mod+0`],action:`zoom`},pan:{keys:[`Mod+Arrow`],action:`moveCanvas`},moveSelection:{keys:[`Arrow`],action:`moveSelection`}},row=(e,t,n)=>({id:e,group:t,...n}),At=[`selectAll`,`find`,`zoomIn`,`zoomOut`,`fit`,`pan`,`moveSelection`].map(e=>row(`canvas-${e}`,`Canvas`,kt[e])),jt=[`undo`,`redo`,`cut`,`copy`,`paste`,`duplicate`,`remove`].map(e=>row(`edit-${e}`,`Edit`,Ot[e])),Mt={bpmn:{canvas:[...At,row(`model-space-tool`,`Modeling`,{keys:[`S`],action:`spaceTool`}),row(`model-lasso`,`Modeling`,{keys:[`L`],action:`lassoTool`}),row(`model-hand`,`Modeling`,{keys:[`H`],action:`handTool`}),row(`model-connect`,`Modeling`,{keys:[`C`],action:`globalConnectTool`}),row(`model-direct-edit`,`Modeling`,{keys:[`E`],action:`directEditing`}),row(`model-replace`,`Modeling`,{keys:[`R`],action:`replaceElement`}),...jt],drd:[],table:[],form:[]},dmn:{canvas:[],drd:[...At,row(`model-lasso`,`Modeling`,{keys:[`L`],action:`lassoTool`}),row(`model-hand`,`Modeling`,{keys:[`H`],action:`handTool`}),row(`model-direct-edit`,`Modeling`,{keys:[`E`],action:`directEditing`}),...jt],table:[],form:[]},form:{canvas:[],drd:[],table:[],form:[row(`edit-undo`,`Edit`,Ot.undo),row(`edit-redo`,`Edit`,Ot.redo)]}};function libraryRows(e,t){return(Mt[e]?.[t]??[]).map(e=>({...e,label:u(`app.shortcuts.row.${e.id}`)}))}function penstockRows(e=[]){return[{id:`penstock-palette`,label:u(`app.shortcuts.row.penstock-palette`),group:`Penstock`,keys:[_.shortcut]},...(e??[]).filter(e=>e?.id&&e?.shortcut).map(e=>({id:`penstock-${e.id}`,label:e.title??``,group:`Penstock`,keys:[String(e.shortcut)],action:e.id}))]}function shortcutRows(e=[],t,n){return penstockRows(e).reduce((e,t)=>{let n=e.findIndex(e=>(e?.keys??[]).some(e=>(t?.keys??[]).includes(e)));if(n<0)return[...e,t];let r={...e[n],...t.action?{action:t.action}:{}};return[...e.slice(0,n),r,...e.slice(n+1)]},[...libraryRows(t,n)])}function shortcutSections(e=[],t,n){let r=shortcutRows(e,t,n);return Dt.map(e=>({group:e,rows:r.filter(t=>t.group===e)})).filter(e=>e.rows.length>0)}function splitSections(e=[]){let t=e??[],n=t.reduce((e,t)=>e+(t?.rows?.length??0),0)/2,r=[],i=0;for(let e of t)if(e){if(i>=n&&r.length>0)break;r.push(e),i+=e.rows?.length??0}return[r,t.filter(e=>!r.includes(e))]}function rowMatches(e,t,n){return e?(e.label??``).toLowerCase().includes(t)?!0:(e.keys??[]).some(e=>(e??``).toLowerCase().includes(t)||(F(e,n)??``).toLowerCase().includes(t)):!1}function filterShortcutSections(e=[],t=``,n=!1){let r=(t??``).trim().toLowerCase(),i=e??[];return r?i.map(e=>({group:e.group,rows:(e.rows??[]).filter(e=>rowMatches(e,r,n))})).filter(e=>e.rows.length>0):[...i]}function KeyboardShortcutsDialog({editor:e,mode:n,actions:r,onClose:i}){let[o,c]=t(``),l=hostIsMac(),d=a(()=>filterShortcutSections(shortcutSections(r,e,n),o,l),[r,e,n,o,l]),[f,p]=a(()=>splitSections(d),[d]);return s(H,{title:u(`app.shortcuts.title`),size:`large`,initialFocus:`title`,onClose:i,class:`keyboard-shortcuts-dialog`,footer:s(W,{actions:[{id:`close`,label:u(`app.common.close`),role:`primary`,onClick:i}]}),children:[s(`input`,{class:`ui-input type-input keyboard-shortcuts__search`,type:`text`,"aria-label":u(`app.shortcuts.search`),placeholder:u(`app.shortcuts.search`),value:o,onInput:e=>c(e.target.value)}),d.length===0?s(oe,{title:u(`app.shortcuts.noMatch`),hint:u(`app.shortcuts.noMatchHint`)}):s(`div`,{class:`keyboard-shortcuts__list`,children:[f,p].map(e=>s(`div`,{class:`keyboard-shortcuts__column`,children:e.map(e=>s(`section`,{class:`keyboard-shortcuts__group`,children:[s(`h3`,{class:`type-section-heading keyboard-shortcuts__group-title`,children:u(`app.shortcuts.group.${e.group}`)}),e.rows.map(e=>s(`div`,{class:`keyboard-shortcuts__row`,children:[s(`span`,{class:`type-body keyboard-shortcuts__label`,children:e.label}),s(`span`,{class:`keyboard-shortcuts__keys`,children:e.keys.map(e=>s(`kbd`,{class:`type-code keyboard-shortcuts__key`,children:F(e,l)},e))})]},e.id))]},e.group))},e.length===0?`right`:e[0].group))})]})}var Nt=`#js-properties-panel, #dmn-properties-panel, .sidebar-properties`;function blockedBy(e){try{if(I(e))return!0;let t=e;return typeof t?.closest==`function`&&!!t.closest(Nt)}catch{return!1}}function KeyboardShortcutsLayer({editor:e,mode:n,actions:r}){let[i,a]=t(!1),o=J();return l(()=>{if(o)try{let e=h(()=>a(!0));return()=>e?.()}catch{return}},[o]),l(()=>{if(!o)return;let listener=e=>{i||e.defaultPrevented||S(e,`Shift+/`,hostIsMac())&&(blockedBy(e.target)||(e.preventDefault(),a(!0)))};return document.addEventListener(`keydown`,listener,!0),()=>document.removeEventListener(`keydown`,listener,!0)},[i,o]),i?s(KeyboardShortcutsDialog,{editor:e,mode:n,actions:r,onClose:()=>a(!1)}):null}function label(e){return u(`app.themeChoice.${e}`)}function ThemeChoiceLayer(){let[e,n]=t(!1),[r,i]=t(He()),a=J(),o=tt(`toolbar-more`);if(l(()=>{if(!a)return;let e=x(()=>{i(He()),n(!0)});return()=>e()},[a]),!e)return null;let pick=e=>{Ke(e),i(e)};return s(V,{anchor:o,label:u(`app.themeChoice.title`),onClose:()=>n(!1),width:240,class:`theme-choice`,children:[s(`h3`,{class:`ui-popover__title`,children:u(`app.themeChoice.title`)}),s(`div`,{role:`radiogroup`,"aria-label":u(`app.themeChoice.title`),class:`theme-choice__list`,children:Me.map(e=>s(`label`,{class:`theme-choice__row type-body`,children:[s(`input`,{type:`radio`,name:`editor-theme`,value:e,checked:r===e,tabIndex:r===e?0:-1,onChange:()=>pick(e)}),s(`span`,{children:label(e)})]},e))})]})}function useDocumentationLink(e){l(()=>b(t=>{Promise.resolve().then(()=>e(t)).catch(()=>{window.open(t,`_blank`,`noopener,noreferrer`)})}),[e])}var ErrorBoundary=class extends o{state={hasError:!1};static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e){console.error(e)}handleReload=()=>{this.props.onReload?this.props.onReload():window.location.reload()};render(){return this.state.hasError?s(`div`,{class:`editor-error-boundary`,role:`alert`,children:s(oe,{title:u(`app.startup.theEditorCouldNotStart`),hint:u(`app.startup.retryingReloadsTheEditorAnd`),actions:[{label:u(`app.common.reload`),run:this.handleReload}]})}):this.props.children}};function useCornerLayout(e){let[n,r]=t(!1);return l(()=>{let t=e.current;if(!t)return;let publish=()=>{let e=ze(t);t.style.setProperty(`--corner-height`,`${e.height}px`),t.style.setProperty(`--dock-inset`,`${e.dock}px`),t.style.setProperty(`--input-inset`,`${e.input}px`),t.style.setProperty(`--corner-left`,`${e.left}px`),t.style.setProperty(`--corner-covered-left`,`${e.coveredLeft}px`),t.style.setProperty(`--corner-bottom`,`${e.bottom}px`),t.style.setProperty(`--corner-trace-left`,`${e.traceLeft}px`),r(e.folded)};publish();let n=fe(t,[],publish),i=de(t,publish);return window.addEventListener(`resize`,publish),()=>{n(),i(),window.removeEventListener(`resize`,publish),t.style.removeProperty(`--corner-height`),t.style.removeProperty(`--dock-inset`),t.style.removeProperty(`--input-inset`),t.style.removeProperty(`--corner-left`),t.style.removeProperty(`--corner-covered-left`),t.style.removeProperty(`--corner-bottom`),t.style.removeProperty(`--corner-trace-left`)}},[e]),n}function isSmallCanvas(e,t){return e<720||t<560}function paletteCollapsed({preference:e,small:t,openedWhileSmall:n}){return e===!0||t&&!n}var Pt=`palette-island__head`,Ft=`palette-island__toggle`,It=new WeakMap,Lt=`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 4 6 8l4 4" /></svg>`;function headOf(e){let t=e.querySelector(`:scope > .${Pt} > .${Ft}`);if(t)return t;let n=document.createElement(`div`);n.className=Pt;let r=document.createElement(`button`);return r.type=`button`,r.className=Ft,r.innerHTML=Lt,r.addEventListener(`click`,()=>It.get(r)?.()),n.appendChild(r),e.insertBefore(n,e.firstChild),r}function syncPaletteHeads(e,t,n){e.querySelectorAll(ye).forEach(e=>{let r=headOf(e);It.set(r,n);let i=u(t?`app.editorShell.openPalette`:`app.editorShell.collapsePalette`);r.setAttribute(`aria-label`,i),r.setAttribute(`aria-expanded`,String(!t)),r.title=i})}function usePaletteIsland(e){let[r,i]=t(()=>G().paletteCollapsed??null),[a,o]=t(!1),[s,c]=t(!1);l(()=>{let t=e.current;if(!t)return;let measure=()=>{let e=t.getBoundingClientRect();o(isSmallCanvas(e.width,e.height))};if(measure(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(measure);return n.observe(t),()=>n.disconnect()},[e]);let u=paletteCollapsed({preference:r,small:a,openedWhileSmall:s}),d=n(()=>{let e=!u;i(e),c(!e&&a),K({paletteCollapsed:e})},[u,a]);return l(()=>{let t=e.current;if(!t)return;let sync=()=>syncPaletteHeads(t,u,d);if(sync(),typeof MutationObserver>`u`)return;let n=new MutationObserver(sync);return n.observe(t,{childList:!0,subtree:!0}),()=>n.disconnect()},[e,u,d]),{collapsed:u,toggle:d}}function EditorShell({className:e,toolbarItems:r,tabs:a,sidebar:o,badges:c,notice:d,check:f,trace:p,timeline:m,statusShown:h,deploy:g,assistant:_,counts:v,shortcuts:y,edit:b,children:x,onReload:S}){let C=J(),w=i(Symbol(`editor`)),T=(y?.actions??[]).filter(e=>e.enabled).map(e=>e.id).join(`,`),E=c?.problems,D=v?.scenarios,k=v?.waiting;l(()=>{if(C)return Ee(w.current,{problems:E,scenarios:D,waiting:k,actions:T===``?[]:T.split(`,`)}),()=>Je(w.current)},[C,E,D?.passed,D?.all,k,T]);let A=i(b);A.current=b,l(()=>{if(C)return We(w.current,()=>A.current??{})},[C]),useDocumentationLink(e=>O().openExternalLink(e));let j=i(null),M=i(null),N=useCornerLayout(j),P=usePaletteIsland(j),F=Ge();ke();let[I,L]=t(!1),R=f!==void 0,te=n(()=>{I||f?.onClose(),L(!I)},[I,f?.onClose]);l(()=>{R&&L(!1)},[R]);let z=R||I;l(()=>{if(!z)return;let escape=e=>{e.key===`Escape`&&(I?L(!1):f?.onClose())};return document.addEventListener(`keydown`,escape),()=>document.removeEventListener(`keydown`,escape)},[z,I,f?.onClose]);let B=_?.key??null,V=ee($e()),ne=Ze(B),H=pe(B),re=i(H);l(()=>{re.current!==H&&(re.current=H,o.select(ge.id))},[H]);let U=V.chatTab&&o.shownTab===ge.id;xe(B,U);let ie=a.filter(e=>e.needs!==`ai-chat`||V.chatTab),W=[f||h?`editor-canvas diagram-check-open`:`editor-canvas`,p?p.showMessages?`has-trace-card`:`has-trace-card is-one-row`:``,N?`is-corner-folded`:``,P.collapsed?`is-palette-collapsed`:``].filter(Boolean).join(` `);return s(ErrorBoundary,{onReload:S,children:s(ve,{value:M,children:s(`div`,{class:`resource-editor ${e}`,ref:M,children:[s(`div`,{class:`editor-shell`,ref:o.measure,children:[s(`div`,{class:`editor-main`,children:[s(`div`,{id:`toolbar-container`,class:`app-toolbar`,style:{flexShrink:0},children:s(Toolbar,{items:r})}),d&&s(`div`,{class:`resource-editor__notice`,role:`status`,children:[s(`span`,{children:d.text}),d.action&&s(`button`,{type:`button`,class:`resource-editor__notice-action`,onClick:d.action.run,children:d.action.label}),d.secondary&&s(`button`,{type:`button`,class:`resource-editor__notice-action`,onClick:d.secondary.run,children:d.secondary.label}),s(`button`,{type:`button`,class:`resource-editor__notice-action`,onClick:d.dismiss,children:u(`app.dmnMode.gotIt`)})]}),s(`div`,{id:`js-canvas`,class:W,ref:j,children:[x,p&&s(TraceCard,{...p,open:I,onToggle:te}),f&&s(CheckCard,{...f}),_&&s(me,{editor:_,hidden:U})]}),m]}),s(Ce.Provider,{value:_??null,children:s(Sidebar,{tabs:ie,api:o,badges:c,statuses:ne?{[ge.id]:ne}:void 0,hidden:F})})]}),_&&s(Re,{editor:_}),g&&s(DeployLayer,{deploy:g.deploy,engine:g.engine}),y&&s(KeyboardShortcutsLayer,{...y}),s(ThemeChoiceLayer,{})]})})})}var Rt=`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./testCaseRuns-DYKnccnc.js","./rolldown-runtime-B8BYMn-z.js","./translator-B2N3PQBL.js","./preload-helper-VRuDKI9K.js","./frontend-caI7mOAL.js","./bridgeInstance-DQk-c8L1.js","./dist-CRJyslwo.js","./dist-DgvQWhKm.js","./moddle-CGpeSs3G.js","./dist-BqwyxNP3.js","./engines-DU0BfbYM.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-B8BYMn-z.js";import{c as t,d as n,h as r,i,o as a,p as o,r as s,s as c,u as l}from"./vendor-NJP34MHU.js";import{i as u,n as d}from"./translator-B2N3PQBL.js";import{t as f}from"./preload-helper-VRuDKI9K.js";import{N as p}from"./frontend-caI7mOAL.js";import{$t as m,B as h,Hn as g,J as _,Qt as v,U as y,V as b,X as x,at as S,ct as C,en as w,ot as T,st as E,t as D,zn as O}from"./bridgeInstance-DQk-c8L1.js";import{p as k,v as A}from"./moddle-CGpeSs3G.js";import{r as j}from"./platform-CkWAyNst.js";import{p as M}from"./testCaseRuns-DYKnccnc.js";import{n as N,r as P,t as F}from"./shortcut-DONH578b.js";import{v as ee}from"./AgentSettings-C3Er_rlW.js";import{t as I}from"./typing-CXvbBSPr.js";import{i as L}from"./dialog-CtGB1LHI.js";import{f as R,m as te,r as z,t as B}from"./bpmnTheme-cOvp4qFc.js";import{c as V,d as H,f as U,h as ne,l as W,o as re,p as ie,r as ae,s as oe,u as se}from"./ui-3pEQJ50t.js";import{i as G,o as K,r as ce}from"./preferences-nBrFGN89.js";import{G as le,t as ue}from"./Viewer-CZiVl0t6.js";import{a as de}from"./dockLayout-CxOMo-Nl.js";import{A as fe,C as pe,D as me,Dt as he,E as ge,Et as _e,H as q,L as ve,O as ye,Ot as be,R as J,S as xe,St as Se,T as Ce,Tt as we,W as Te,_ as Ee,_t as De,a as Y,bt as Oe,c as ke,ct as Ae,dt as je,et as Me,ft as Ne,g as Pe,gt as Fe,h as X,ht as Ie,i as Le,j as Re,k as ze,lt as Be,mt as Ve,nt as He,pt as Ue,q as We,s as Ge,tt as Ke,ut as qe,v as Je,vt as Ye,wt as Xe,x as Ze,xt as Qe,y as $e,yt as et,z as tt}from"./web-B2zkonPE.js";function sayAction(e,t){let n=u(e);return n===e?t:n}function sayKeywords(e,t){let n=u(`app.actions.${e}.keywords`),r=n===`app.actions.${e}.keywords`?[]:n.split(`,`).map(e=>e.trim()).filter(Boolean);return r.length>0?[...t,...r]:t}var nt={"Check & run":`checkRun`,"Layout & convert":`layoutConvert`,"Deploy & share":`deployShare`,View:`view`,File:`file`,Edit:`edit`,Help:`help`,Recent:`recent`};function saySection(e){return u(`app.actions.section.${nt[e]??e}`)}function resolveActions(e,t){return e.map((e,t)=>({def:e,order:t})).filter(({def:e})=>e.available?.(t)??!0).map(({def:e,order:n})=>{let r=e.l10n??e.id,i=typeof e.tooltip==`function`?e.tooltip(t):e.tooltip&&sayAction(`app.actions.${r}.tooltip`,e.tooltip),a={id:e.id,title:sayAction(`app.actions.${r}.title`,e.title),section:e.section,icon:e.icon,keywords:sayKeywords(r,e.keywords),place:e.place,listed:e.listed??!0,slot:e.slot??`start`,order:n,enabled:e.enabled?.(t)??!0,run:()=>e.run(t)};if(e.presentation&&(a.presentation=e.presentation),e.shortcut&&(a.shortcut=e.shortcut),e.tier&&(a.tier=e.tier),i&&(a.tooltip=i),!a.enabled&&e.disabledReason){let n=e.disabledReason(t);n&&(a.disabledReason=n)}e.checked&&(a.checked=e.checked(t));let o=e.status?.(t);return o&&(a.status=o),e.popup&&(a.popup=e.popup(t)),e.menu&&(a.menu=e.menu(t).map(n=>({id:n.id,title:sayAction(`app.actions.${e.id}.menu.${n.id}.title`,n.title),icon:n.icon,...n.tooltip?{tooltip:sayAction(`app.actions.${e.id}.menu.${n.id}.tooltip`,n.tooltip)}:{},run:()=>n.run(t)}))),a})}var rt=500,it=400,at=300,ot=200,st=80,ct=12,lt=10,ut=1,dt=4;function startsWord(e,t){return t===0||!/[a-z0-9]/i.test(e[t-1])}function contiguous(e,t){let n=null;for(let r=t.indexOf(e);r>=0;r=t.indexOf(e,r+1)){let e=(r===0?rt:startsWord(t,r)?it:at)-Math.min(r,50)*.1;(n===null||e>n.score)&&(n={score:e,from:r})}return n===null?null:{score:n.score,at:Array.from({length:e.length},(e,t)=>n.from+t)}}function initials(e,t){let n=t.length,r=e.split(``).map(()=>Array(n).fill(-1/0)),i=e.split(``).map(()=>Array(n).fill(-1));for(let a=0;a<e.length;a++)for(let o=a;o<n;o++)if(t[o]===e[a]){if(a===0)startsWord(t,o)&&(r[a][o]=lt);else for(let e=a-1;e<o;e++){if(r[a-1][e]===-1/0)continue;let n=e===o-1;if(!n&&!startsWord(t,o))continue;let s=r[a-1][e]+lt+(n?ct:-Math.min(o-e-1,dt)*ut);s>r[a][o]&&(r[a][o]=s,i[a][o]=e)}}let a=e.length-1,o=-1;for(let e=0;e<n;e++)r[a][e]>(o<0?-1/0:r[a][o])&&(o=e);if(o<0||r[a][o]===-1/0)return null;let s=[];for(let e=a,t=o;e>=0;e--)s.unshift(t),t=i[e][t];return{score:ot+r[a][o],at:s}}function inTitle(e,t){let n=t.toLowerCase();return contiguous(e,n)??initials(e,n)}function keyword(e,t){for(let n of t){let t=n.toLowerCase();if(t.startsWith(e)||t.split(/\s+/).some(t=>t.startsWith(e)))return st}return 0}function merged(e){let t=[];for(let n of[...new Set(e)].sort((e,t)=>e-t)){let e=t[t.length-1];e&&e[1]===n?e[1]=n+1:t.push([n,n+1])}return t}function matchOf(e,t){let n=0,r=[];for(let i of t){let t=inTitle(i,e.title);if(t){n+=t.score,r.push(...t.at);continue}let a=keyword(i,e.keywords);if(a>0)n+=a;else return null}return{action:e,score:n,ranges:merged(r)}}function rankActions(e,t){let n=t.toLowerCase().split(/\s+/).filter(Boolean);return n.length===0?e.map(e=>({action:e,score:0,ranges:[]})):e.map((e,t)=>({match:matchOf(e,n),order:t})).filter(e=>e.match!==null).sort((e,t)=>t.match.score-e.match.score||e.order-t.order).map(e=>e.match)}var ft=[`Check & run`,`Layout & convert`,`Deploy & share`,`View`,`File`,`Edit`,`Help`];function pushRecent(e,t){return[t,...e.filter(e=>e!==t)].slice(0,5)}function browseGroups(e,t){let n=new Map(e.map(e=>[e.id,e])),r=t.map(e=>n.get(e)).filter(e=>e!==void 0),i=new Set(r.map(e=>e.id)),a=r.length>0?[{title:saySection(`Recent`),items:r}]:[];for(let t of ft){let n=e.filter(e=>e.section===t&&!i.has(e.id));n.length>0&&a.push({title:saySection(t),items:n})}return a}function moveSelection(e,t,n){return n===0?-1:((e+t)%n+n)%n}function publishedActions(e,t){return e.filter(e=>e.listed).map(e=>{let n=F(e.shortcut,t);return{id:e.id,title:e.title,section:e.section,enabled:e.enabled,...e.checked===void 0?{}:{checked:e.checked},...n?{shortcut:n}:{}}})}function trailingToDrop(e,t){let n=0,r=0;for(let i=e.length-1;i>=0&&n<t;--i)n+=e[i],r+=1;return r}function beginWidthDrag(e,t){let n=t?.target??(typeof window<`u`?window:null);if(!n||typeof n.addEventListener!=`function`)return()=>{};let r=Number.isFinite(e)?e:0,i=Number.isFinite(t.min)?t.min:0,a=Number.isFinite(t.max)?t.max:Math.max(i,1e3),o=Math.min(i,a),s=Math.max(i,a),c=Number.isFinite(t.width)?Math.min(s,Math.max(o,t.width)):o,l=!1,move=e=>{let n=Number.isFinite(e?.clientX)?e.clientX:0;c=Math.min(s,Math.max(o,t.width+r-n));try{t.onWidth?.(c)}catch{}},end=()=>{if(!l){stop();try{t.onCommit(c)}catch{}}};function stop(){if(!l){l=!0;try{n.removeEventListener(`pointermove`,move),n.removeEventListener(`pointerup`,end),n.removeEventListener(`pointercancel`,end)}catch{}}}try{n.addEventListener(`pointermove`,move),n.addEventListener(`pointerup`,end),n.addEventListener(`pointercancel`,end)}catch{}return stop}function EditableTitle({title:e,editable:n,problem:r,onProblem:a}){let[o,c]=t(!1),d=i(null),f=i(null);l(()=>{n.start&&(c(!0),n.onStarted?.())},[n.start]),l(()=>{o&&(d.current?.focus(),d.current?.select())},[o]);let close=()=>{c(!1),requestAnimationFrame(()=>f.current?.focus())},settle=(e,t)=>{a(e),!(e&&t)&&close()},finish=(t,r)=>{let i=d.current?.value??e;if(!t){a(null),close();return}let o=Xe(e,i);if(!o){settle(null,!1);return}let s=n.onCommit(o);s instanceof Promise?s.then(e=>settle(e,r)):settle(s,r)};return o?s(`input`,{ref:d,class:`sidebar__nav-field type-input`,"aria-label":n.label,"aria-invalid":r?!0:void 0,defaultValue:e,onBlur:()=>o&&finish(!0,!1),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),finish(!0,!0)):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),finish(!1,!1))}}):s(`button`,{ref:f,type:`button`,class:`sidebar__nav-title type-section-heading is-editable`,title:u(`app.sidebar.clickOrPressF2To`,{title:e}),"aria-label":u(`app.sidebar.pressF2OrEnterTo`,{title:e,label:n.label}),onClick:()=>c(!0),onKeyDown:e=>Ve(e.key)&&c(!0),children:e})}function NavRow({title:e,backLabel:n,onBack:i,editable:a,trailing:o}){let[c,l]=t(null);return s(r,{children:[s(`div`,{class:`sidebar__nav`,children:[s(`button`,{type:`button`,class:`sidebar__icon`,"aria-label":n,title:u(`app.common.back`),onClick:i,children:s(q,{name:`back`})}),a?s(EditableTitle,{title:e,editable:a,problem:c,onProblem:l}):s(`span`,{class:`sidebar__nav-title type-section-heading`,title:e,children:e}),o?s(`span`,{class:`sidebar__nav-actions`,children:o}):null]}),c&&s(`p`,{class:`penstock-review__issue is-mismatch`,role:`alert`,children:c})]})}var pt=16,mt=28;function tabTitle(e){return u(`app.sidebar.tab.${e}`)}function sameIds(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function useFit$1(e,n,r){let[a,o]=t([]),s=i(new Map);return c(()=>{let t=e.current;if(!t||r===void 0||t.clientWidth===0)return;let i=getComputedStyle(t),a=parseFloat(i.columnGap)||0,c=(parseFloat(i.paddingLeft)||0)+(parseFloat(i.paddingRight)||0);for(let e of t.querySelectorAll(`:scope > [data-tab]`))s.current.set(e.getAttribute(`data-tab`)??``,e.offsetWidth);let l=Array.from(t.children).filter(e=>!e.hasAttribute(`data-tab`)&&!e.hasAttribute(`data-more`)).reduce((e,t)=>e+t.offsetWidth+a,0),u=je(n.map(e=>({id:e,width:(s.current.get(e)??mt)+a})),r,t.clientWidth-c-l,mt+a);o(e=>sameIds(e,u)?e:u)}),a}e(useFit$1,`useFit`);function Sidebar({tabs:e,api:n,badges:r={},statuses:a={},hidden:o=!1}){let{state:d,width:f,limits:p,drawer:m}=n,h=i(null),g=i(null),_=e.map(e=>e.id),v=e.find(e=>e.id===d.tab)??e[0],y=v?d.stacks[v.id]??[]:[],b=!d.hidden&&!(m&&d.collapsed),x=useFit$1(h,_,v?.id),[S,C]=t(!1),[w,T]=t(null);l(()=>{T(e=>e===v?.id?e:null)},[v?.id]);let E=i(null);if(c(()=>()=>{E.current?.(),E.current=null},[b]),d.hidden||o||!v)return null;if(m&&d.collapsed){let e=v.bar;return s(`div`,{class:`sidebar-bar`,role:`toolbar`,"aria-label":u(`app.sidebar.collapsedLabel`,{title:tabTitle(v.id)}),children:[e?s(e,{active:!0,views:y,width:f,push:e=>n.push(v.id,e),back:()=>n.back(v.id),reset:()=>n.reset(v.id)}):s(`span`,{class:`sidebar-bar__title`,children:tabTitle(v.id)}),s(`button`,{type:`button`,class:`sidebar__icon`,"aria-label":u(`app.sidebar.openTheSidebar`),title:u(`app.sidebar.openTheSidebar`),onClick:n.toggleCollapsed,children:s(q,{name:`expand`})})]})}let onTabKey=e=>{let t=Ae(_,v.id,e.key);t&&(e.preventDefault(),T(t),n.select(t),requestAnimationFrame(()=>{try{let e=typeof CSS<`u`&&CSS.escape?CSS.escape(t):t;h.current?.querySelector(`[data-tab="${e}"]`)?.focus()}catch{}}))},startDrag=e=>{e.preventDefault(),E.current?.(),E.current=beginWidthDrag(e.clientX,{width:f,min:p.min,max:p.max,onWidth:n.setWidth,onCommit:n.commitWidth})},onSeparatorKey=e=>{let t=e.key===`ArrowLeft`?pt:e.key===`ArrowRight`?-16:0;if(t===0)return;e.preventDefault();let r=Math.min(p.max,Math.max(p.min,f+t));n.setWidth(r),n.commitWidth(r)},onBodyKey=e=>{e.key===`Escape`&&y.length>0&&!(e.target instanceof Element&&e.target.closest(`input, textarea, select`))&&(e.preventDefault(),n.back(v.id))},D=e.filter(e=>x.includes(e.id));return s(`aside`,{ref:g,class:`sidebar${m?` is-drawer`:``}`,style:{width:`${f}px`},"aria-label":u(`app.sidebar.sidebar`),children:[s(`div`,{class:`sidebar__separator`,role:`separator`,"aria-orientation":`vertical`,"aria-label":u(`app.sidebar.resizeTheSidebar`),"aria-valuenow":f,"aria-valuemin":p.min,"aria-valuemax":p.max,tabIndex:0,onPointerDown:startDrag,onDblClick:()=>{n.setWidth(null),n.commitWidth(null)},onKeyDown:onSeparatorKey}),s(`div`,{class:`sidebar__tabs`,role:`tablist`,"aria-label":u(`app.sidebar.sidebar`),ref:h,onKeyDown:onTabKey,children:[e.filter(e=>!x.includes(e.id)).map(e=>{let t=qe(r[e.id]),i=e.id===v.id,o=a[e.id],c=o?u(`app.sidebar.status.${o}`):null;return s(`button`,{type:`button`,role:`tab`,id:`sidebar-tab-${e.id}`,"data-tab":e.id,"aria-selected":i,"aria-controls":`sidebar-panel-${e.id}`,tabIndex:i?0:-1,class:`sidebar__tab type-sidebar-tab${i?` type-sidebar-tab-selected is-selected`:``}`,title:i?void 0:tabTitle(e.id),"aria-label":i?void 0:[tabTitle(e.id),t?Be(r[e.id]):null,c].filter(Boolean).join(`, `),onClick:()=>n.select(e.id),children:[s(q,{name:e.icon}),i&&s(`span`,{class:`sidebar__tab-label`,children:tabTitle(e.id)}),o===`working`&&s(`span`,{class:`sidebar__status is-working`,"aria-hidden":`true`,children:s(ae,{})}),o===`waiting`&&s(`span`,{class:`sidebar__status is-waiting`,"aria-hidden":`true`}),t&&s(`span`,{class:`sidebar__badge`,"aria-label":Be(r[e.id]),children:t})]},e.id)}),D.length>0&&s(`div`,{class:`sidebar__more-wrap`,"data-more":!0,children:[s(`button`,{type:`button`,class:`sidebar__icon sidebar__more`,"aria-label":u(`app.sidebar.moreTabs`),title:u(`app.sidebar.moreTabs`),"aria-haspopup":`menu`,"aria-expanded":S,onClick:()=>C(e=>!e),onKeyDown:e=>{e.key===`Escape`&&C(!1)},children:s(q,{name:`more`})}),S&&s(`div`,{class:`sidebar__menu`,role:`menu`,"aria-label":u(`app.sidebar.moreTabs`),children:D.map(e=>s(`button`,{type:`button`,role:`menuitem`,class:`sidebar__menu-item type-sidebar-tab`,"data-tab-more":e.id,onClick:()=>{C(!1),n.select(e.id)},children:[s(q,{name:e.icon}),s(`span`,{children:tabTitle(e.id)})]},e.id))})]}),m&&s(`button`,{type:`button`,class:`sidebar__icon sidebar__collapse`,"aria-label":u(`app.sidebar.collapseTheSidebar`),title:u(`app.sidebar.collapseTheSidebar`),onClick:n.toggleCollapsed,children:s(q,{name:`close`})})]}),y.length>0&&!v.ownHeader&&s(NavRow,{title:y[y.length-1].title,backLabel:u(`app.sidebar.backTo`,{title:y.length>1?y[y.length-2].title:tabTitle(v.id)}),onBack:()=>n.back(v.id)}),s(`div`,{class:`sidebar__body`,"data-switch":w===v.id?`key`:`pointer`,onKeyDown:onBodyKey,children:e.map(e=>{let t=e.component,r=e.id===v.id;return s(`div`,{role:`tabpanel`,id:`sidebar-panel-${e.id}`,"aria-labelledby":`sidebar-tab-${e.id}`,class:`sidebar__panel${e.padded?` sidebar__content`:``}`,hidden:!r,children:s(t,{active:r,views:d.stacks[e.id]??[],width:f,push:t=>n.push(e.id,t),back:()=>n.back(e.id),reset:()=>n.reset(e.id)})},e.id)})})]})}var Z=1100;function useSidebar(e,r){let[o,s]=t(()=>Ne(G(),e,r)),[c,u]=t(Z),[d,f]=t(!1),[p,m]=t(null),h=i(null),g=n(e=>{if(h.current?.disconnect(),h.current=null,e){try{u(e.getBoundingClientRect().width||Z)}catch{u(Z)}typeof ResizeObserver<`u`&&(h.current=new ResizeObserver(()=>{if(e)try{u(e.getBoundingClientRect().width||Z)}catch{}}),h.current.observe(e))}},[]);l(()=>()=>{h.current?.disconnect(),h.current=null},[]);let _=i(we(o,r,G())),v=n(e=>{let t=we(e,r,_.current);if(JSON.stringify(t)!==JSON.stringify(_.current)){_.current=t;try{K(t)}catch{}}},[r]);l(()=>{v({...o,width:_.current.sidebarWidth??null})},[o.tab,o.hidden,o.collapsed]);let y=Ue(c),b=o.tab,x=o.collapsed,S=i(y);S.current=y;let C=n(t=>{S.current?e.includes(t)&&(m({tab:t,collapsed:!1}),f(!0)):s(n=>Qe(n,e,t))},[e.join(`|`)]),w=n(()=>{S.current?f(e=>!e):s(he)},[]),T=n(()=>{S.current?m(e=>({tab:e?.tab??b,collapsed:!(e?.collapsed??x)})):s(_e)},[b,x]),E=n((e,t)=>s(n=>Ye(n,e,t)),[]),D=n(e=>s(t=>De(t,e)),[]),O=n(e=>s(t=>et(t,e)),[]),k=n(e=>s(t=>({...t,width:e})),[]),A=i(o);A.current=o;let j=n(e=>v(e===void 0?A.current:{...A.current,width:e}),[v]),M=a(()=>y?{...o,tab:p?.tab??o.tab,collapsed:p?.collapsed??o.collapsed,hidden:!d}:o,[o,y,d,p]),N=Se(M,y),P=i(null),F=n(t=>{if(N===t){let n=P.current;P.current=null,C(n&&e.includes(n)?n:e.find(e=>e!==t)??t)}else P.current=N??A.current.tab,C(t)},[N,C,e.join(`|`)]);return a(()=>({state:M,width:Oe(o.width,c),limits:be(c),drawer:y,editorWidth:c,measure:g,select:C,toggle:w,toggleCollapsed:T,push:E,back:D,reset:O,setWidth:k,commitWidth:j,shownTab:N,pressTab:F}),[M,o.width,y,c,g,C,w,T,E,D,O,k,j,N,F])}function createPanelHost(){return document.createElement(`div`)}function PanelHost({host:e,id:t,class:n,shown:r}){let a=i(null);return c(()=>{t!==void 0&&(e.id=t),n!==void 0&&(e.className=n),r!==void 0&&(e.style.display=r?`block`:`none`)},[e,t,n,r]),c(()=>{let t=a.current;if(t)return t.appendChild(e),()=>{e.parentNode===t&&t.removeChild(e)}},[e]),s(`div`,{ref:a,style:{display:`contents`}})}var ht={error:`M 339.07183,256.00001 463.66713,131.4047 c 15.28961,-15.2896 15.28961,-40.079175 0,-55.381227 l -27.6906,-27.690611 c -15.28961,-15.289602 -40.07917,-15.289602 -55.38123,0 L 256,172.92818 131.4047,48.332862 c -15.2896,-15.289602 -40.079177,-15.289602 -55.381228,0 L 48.332861,76.023473 c -15.2896,15.2896 -15.2896,40.079177 0,55.381227 L 172.92815,256.00001 48.332861,380.59531 c -15.2896,15.2896 -15.2896,40.07917 0,55.38123 l 27.690611,27.69061 c 15.289601,15.28959 40.091628,15.28959 55.381228,0 L 256,339.07184 380.5953,463.66715 c 15.2896,15.28959 40.09162,15.28959 55.38123,0 l 27.6906,-27.69061 c 15.28961,-15.2896 15.28961,-40.07918 0,-55.38123 z`,warning:`m256 323.95c-45.518 0-82.419 34.576-82.419 77.229 0 42.652 36.9 77.229 82.419 77.229 45.518 0 82.419-34.577 82.419-77.23 0-42.652-36.9-77.229-82.419-77.229zm-80.561-271.8 11.61 204.35c.544 9.334 8.78 16.64 18.755 16.64h100.39c9.975 0 18.211-7.306 18.754-16.64l11.611-204.35c.587-10.082-7.98-18.56-18.754-18.56h-123.62c-10.775 0-19.34 8.478-18.753 18.56z`};function SeverityIcon({severity:e}){return s(`span`,{class:`severity severity--${e}`,role:`img`,"aria-label":u(e===`error`?`app.diagramCheck.error`:`app.diagramCheck.warning`),children:s(`svg`,{viewBox:`0 0 512 512`,"aria-hidden":`true`,children:s(`path`,{d:ht[e],fill:`currentColor`})})})}function usePinning(){let[,e]=t(0);l(()=>{try{return ce(()=>e(e=>e+1))}catch{return}},[]);let n=G()||{},r=Array.isArray(n.toolbarPinned)?n.toolbarPinned:[],i=Array.isArray(n.toolbarUnpinned)?n.toolbarUnpinned:[],isPinned=e=>!e||!e.id?!1:e.place===`pinned`?!i.includes(e.id):r.includes(e.id),toggle=e=>{if(!e||!e.id)return;let flip=t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id];try{K(e.place===`pinned`?{toolbarUnpinned:flip(i)}:{toolbarPinned:flip(r)})}catch{}};return{isPinned,toggle}}function hostIsMac(){return typeof navigator<`u`&&typeof navigator?.platform==`string`&&N(navigator.platform)}var gt=`palette-list`,optionId=e=>`palette-option-${e}`;function Highlighted({title:e,ranges:t}){let n=typeof e==`string`?e:String(e??``),i=Array.isArray(t)?t:[];if(i.length===0)return s(r,{children:n});let a=[],o=0;return i.forEach(([e,t])=>{let i=Math.max(0,Math.min(n.length,Number.isFinite(e)?e:0)),c=Math.max(i,Math.min(n.length,Number.isFinite(t)?t:i));i>o&&a.push(s(r,{children:n.slice(o,i)})),a.push(s(`span`,{className:`palette__match`,children:n.slice(i,c)})),o=c}),o<n.length&&a.push(s(r,{children:n.slice(o)})),s(r,{children:a})}function Palette({entries:e,recent:n,pinning:r,locked:o,onRun:u,onClose:d,returnFocusTo:f}){let p=ne(),[m,h]=t(``),[g,_]=t(0),v=i(null),y=i(null),b=hostIsMac(),x=a(()=>(Array.isArray(e)?e:[]).filter(Boolean).map(e=>({id:e.id,title:e.title,section:e.section,keywords:e.keywords,entry:e,ranges:[]})),[e]),S=m.trim().length>0,C=a(()=>{if(S){let e=rankActions(x,m).map(e=>({...e.action,ranges:e.ranges}));return e.length>0?[{title:``,items:e}]:[]}return browseGroups(x,Array.isArray(n)?n:[])},[x,n,m,S]),w=a(()=>(Array.isArray(C)?C:[]).flatMap(e=>Array.isArray(e?.items)?e.items:[]),[C]),T=w[g];l(()=>_(0),[m]),l(()=>{if(T)try{let e=typeof CSS<`u`&&CSS.escape?CSS.escape(optionId(T.id)):optionId(T.id);v.current?.querySelector(`#${e}`)?.scrollIntoView({block:`nearest`})}catch{}},[T?.id]),c(()=>{let e=y.current;if(!e)return;let t=f,n=[],r=e,i=0;for(;r&&r.parentElement&&i<50;){i+=1;let e=r.parentElement;for(let t of Array.from(e.children))t===r||t.hasAttribute(`inert`)||(t.setAttribute(`inert`,``),n.push(t));r=e}return()=>{n.forEach(e=>e.removeAttribute(`inert`));let r=document.activeElement,i=r!==null&&e.contains(r),a=r===null||r===document.body||!document.contains(r);if((i||a)&&t)try{t.focus()}catch{}}},[]);let run=e=>{if(e&&e.entry.enabled)try{u(e.entry)}catch{}},keys=e=>{if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),d();else if(e.key===`ArrowDown`||e.key===`ArrowUp`)e.preventDefault(),_(t=>moveSelection(t,e.key===`ArrowDown`?1:-1,w.length));else if(e.key===`Home`&&e.ctrlKey)e.preventDefault(),_(0);else if(e.key===`End`&&e.ctrlKey)e.preventDefault(),_(Math.max(0,w.length-1));else if(e.key===`Enter`){if(e.preventDefault(),e.shiftKey){if(T)try{r?.toggle?.(T.entry)}catch{}}else run(T)}else e.key===`Tab`&&e.preventDefault()},flatIndex=e=>w.findIndex(t=>t.id===e.id);return s(`div`,{ref:y,className:`palette-overlay`,onMouseDown:e=>{e.target===e.currentTarget&&d()},children:s(`div`,{className:`palette`,role:`dialog`,"aria-modal":`true`,"aria-label":p(`app.palette.label`),children:[s(`input`,{className:`palette__field`,type:`text`,role:`combobox`,"aria-expanded":`true`,"aria-controls":gt,"aria-autocomplete":`list`,"aria-activedescendant":T?optionId(T.id):void 0,"aria-describedby":`palette-hint`,placeholder:p(`app.palette.search`),spellcheck:!1,autoComplete:`off`,autoFocus:!0,value:m,onInput:e=>h(e.currentTarget.value),onKeyDown:keys,ref:e=>e?.focus()}),s(`span`,{id:`palette-hint`,className:`palette__hint`,children:p(`app.palette.hint`)}),s(`ul`,{className:`palette__list`,id:gt,role:`listbox`,"aria-label":p(`app.palette.actions`),ref:v,children:[C.map(e=>s(`li`,{role:`presentation`,className:`palette__group`,children:[e.title&&s(`div`,{className:`palette__heading`,role:`presentation`,children:e.title}),s(`ul`,{role:`group`,"aria-label":e.title||p(`app.palette.matches`,{count:e.items.length}),className:`palette__group`,children:e.items.map(e=>{let t=e.entry,n=!!r?.isPinned?.(t),i=t.place!==`bar`,a=F(t.shortcut,b);return s(`li`,{id:optionId(e.id),role:`option`,"aria-selected":flatIndex(e)===g,"aria-disabled":!t.enabled,"aria-checked":t.checked===void 0?void 0:t.checked,className:`palette__row${flatIndex(e)===g?` is-active`:``}`,"aria-label":t.tier?`${e.title}, Penstock ${t.tier}`:e.title,title:t.tooltip,onMouseMove:()=>_(flatIndex(e)),onClick:()=>run(e),children:[s(`span`,{className:`palette__icon`,children:s(X,{name:t.icon})}),s(`span`,{className:`palette__title`,children:s(Highlighted,{title:e.title,ranges:e.ranges})}),S&&s(`span`,{className:`palette__section`,children:e.section}),t.tier&&s(`span`,{className:`palette__tier`,children:[o&&s(X,{name:`lock`}),t.tier]}),a&&s(`span`,{className:`palette__shortcut`,children:a}),t.checked&&s(`span`,{className:`palette__check`,children:s(X,{name:`check`})}),i&&s(`button`,{type:`button`,tabIndex:-1,"aria-hidden":`true`,className:n?`palette__pin is-pinned`:`palette__pin`,title:p(n?`app.palette.unpin`:`app.palette.pin`),onMouseDown:e=>e.preventDefault(),onClick:e=>{e.stopPropagation();try{r?.toggle?.(t)}catch{}},children:s(X,{name:`pin`})})]},e.id)})})]},e.title||`results`)),w.length===0&&s(`li`,{className:`palette__empty`,role:`presentation`,children:p(`app.palette.noMatch`,{query:m.trim()})})]})]})})}function useHostActions(e,t){let n=J(),r=i({actions:e,openPalette:t});r.current={actions:e,openPalette:t};let a=`[]`;try{a=JSON.stringify(publishedActions(Array.isArray(e)?e:[],hostIsMac()))}catch{a=`[]`}l(()=>{if(n)try{let e=D();e?.publishActions&&e.publishActions(JSON.parse(a)).catch(()=>{})}catch{}},[a,n]),l(()=>{if(n)try{let e=D();return e?.onRunAction?e.onRunAction(e=>{try{if(e===_.id){r.current.openPalette();return}let t=(Array.isArray(r.current.actions)?r.current.actions:[]).find(t=>t?.id===e);if(t?.enabled){let e=t.run();e&&typeof e.catch==`function`&&e.catch(e=>console.error(e))}}catch(e){console.error(e)}}):void 0}catch{return}},[n])}function isAction(e){return!(`type`in e)}function TextButton({entry:e,wrapped:t=!1}){let n=[`toolbar-button`,`type-toolbar-button`,`with-label`];return e.presentation===`primary`&&n.push(`primary`),e.checked&&n.push(`active`),s(`button`,{type:`button`,id:e.id,className:n.join(` `),onClick:e.run,disabled:!e.enabled,title:e.disabledReason??P(e.tooltip,e.title,e.shortcut,hostIsMac()),"aria-description":e.disabledReason,"aria-pressed":e.checked,"aria-haspopup":e.popup===void 0?void 0:`dialog`,"aria-expanded":e.popup,"data-droppable":!t&&e.presentation!==`primary`&&e.place!==`bar`?``:void 0,children:s(`span`,{className:`toolbar-button-label`,children:e.title})})}function inPalette(e){return isAction(e)&&e.listed}function usePopup(e,t,n,r){l(()=>{if(!e)return;let away=e=>{n.current?.contains(e.target)||t(!1)},keys=e=>{if(e.key===`Escape`&&t(!1),e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let n=Array.from(r.current?.querySelectorAll(`.toolbar-menu__item:not(:disabled)`)??[]);if(n.length===0)return;e.preventDefault();let i=n.indexOf(document.activeElement);n[e.key===`ArrowDown`?(i+1)%n.length:(i-1+n.length)%n.length].focus()};return document.addEventListener(`mousedown`,away),document.addEventListener(`keydown`,keys),r.current?.querySelector(`.toolbar-menu__item:not(:disabled)`)?.focus(),()=>{document.removeEventListener(`mousedown`,away),document.removeEventListener(`keydown`,keys)}},[e])}function SplitButton({entry:e,menu:n}){let[r,a]=t(!1),o=i(null),c=i(null);usePopup(r,a,o,c);let l=e.presentation===`primary`?` primary`:``;return s(`div`,{className:`toolbar-menu toolbar-split`,ref:o,"data-droppable":e.presentation!==`primary`&&e.place!==`bar`?``:void 0,children:[s(TextButton,{entry:e,wrapped:!0}),s(`button`,{type:`button`,className:`toolbar-button type-toolbar-button toolbar-split__more${l}${r?` active`:``}`,onClick:()=>a(e=>!e),title:u(`app.toolbar.moreWaysTo`,{title:e.title.toLowerCase()}),"aria-label":u(`app.toolbar.moreWaysTo`,{title:e.title.toLowerCase()}),"aria-haspopup":`menu`,"aria-expanded":r,children:s(`span`,{className:`toolbar-button-icon`,role:`presentation`,children:s(X,{name:`chevron`})})}),r&&s(`div`,{className:`toolbar-menu__list toolbar-menu__list--end`,role:`menu`,ref:c,children:n.map(e=>s(`div`,{className:`toolbar-menu__row`,children:s(`button`,{type:`button`,id:e.id,role:`menuitem`,className:`toolbar-menu__item`,title:e.tooltip,onClick:()=>{a(!1),e.run()},children:[s(X,{name:e.icon}),s(`span`,{className:`toolbar-menu__label`,children:e.title})]})},e.id))})]})}function PaletteTrigger({open:e,onOpen:t,trigger:n}){let r=u(`app.toolbar.moreActionsHint`,{shortcut:F(_.shortcut,hostIsMac())});return s(`button`,{type:`button`,id:`toolbar-more`,ref:n,className:e?`toolbar-button type-toolbar-button active`:`toolbar-button type-toolbar-button`,onClick:t,title:r,"aria-label":u(`app.toolbar.moreActions`),"aria-haspopup":`dialog`,"aria-expanded":e,children:s(`span`,{className:`toolbar-button-icon`,role:`presentation`,children:s(X,{name:`more`})})})}function Action({entry:e}){return e.menu&&e.menu.length>0?s(SplitButton,{entry:e,menu:e.menu}):e.presentation===`text`||e.presentation===`primary`?s(TextButton,{entry:e}):s(Pe,{id:e.id,label:e.title,icon:e.icon,action:e.run,disabled:!e.enabled,tooltip:e.disabledReason??P(e.tooltip,e.title,e.shortcut,hostIsMac()),description:e.disabledReason,isActive:e.checked,checked:e.checked,status:e.status})}function useLocked(e){let[n,r]=t(!1);return l(()=>{if(!e)return;let t=!0;try{D()?.getLicense?.()?.then(e=>t&&r(!Te(e)))?.catch(()=>void 0)}catch{}return()=>{t=!1}},[e]),n}function useRecent(){let[,e]=t(0);l(()=>{try{return ce(()=>e(e=>e+1))}catch{return}},[]);let n=G()?.recentActions;return Array.isArray(n)?n:[]}var _t=4;function useFit(e){let t=n(()=>{let t=e.current;if(!t)return;let n=Array.from(t.querySelectorAll(`[data-droppable]`));n.forEach(e=>{e.style.display=``});let r=t.scrollWidth-t.clientWidth;if(r<=0)return;let i=trailingToDrop(n.map(e=>e.offsetWidth+_t),r);n.slice(n.length-i).forEach(e=>{e.style.display=`none`})},[e]);c(t),l(()=>{let n=e.current;if(!n||typeof ResizeObserver>`u`)return;let r=new ResizeObserver(t);return r.observe(n),()=>r.disconnect()},[t,e])}function Toolbar({items:e,visible:r=!0,className:a=``}){let o=usePinning(),c=i(null);useFit(c);let[u,d]=t(!1),f=i(null),p=i(null),m=useLocked(u),h=useRecent(),g=e.filter(isAction),v=e.filter(inPalette).sort((e,t)=>e.order-t.order),y=n(()=>{let e=document.activeElement;p.current=e instanceof HTMLElement&&e!==document.body?e:f.current,d(!0)},[]),b=n(()=>{d(!1)},[]),S=v.length>0;useHostActions(g,y);let C=J();l(()=>{if(!S||!C)return;let keys=e=>{x(e,_.shortcut,hostIsMac())&&(e.preventDefault(),u||y())};return document.addEventListener(`keydown`,keys),()=>document.removeEventListener(`keydown`,keys)},[S,u,y,C]);let w=n(e=>{if(b(),e){try{K({recentActions:pushRecent(G()?.recentActions??[],e.id)})}catch{}setTimeout(()=>{try{e.run()}catch(e){console.error(`Error executing toolbar action:`,e)}},0)}},[b]);if(!r)return null;let T=e.some(e=>`type`in e&&e.type===`overflow`)||!S?e:[...e,{type:`overflow`}];return s(`div`,{className:`toolbar ${a}`.trim(),ref:c,children:[T.map((e,t)=>isAction(e)?e.place===`menu`||e.place===`pinned`&&!o.isPinned(e)?null:s(Action,{entry:e},e.id):e.type===`separator`?s(`div`,{className:`toolbar-separator`},`sep-${t}`):e.type===`spacer`?s(`div`,{className:`toolbar-spacer`},`spacer-${t}`):S?[...v.filter(e=>e.place===`menu`&&o.isPinned(e)).map(e=>s(TextButton,{entry:{...e,id:`pinned-${e.id}`,title:e.title.replace(/…$/,``)}},`pinned-${e.id}`)),s(PaletteTrigger,{open:u,onOpen:y,trigger:f},`overflow`)]:null),u&&s(Palette,{entries:v,recent:h,pinning:o,locked:m,onRun:w,onClose:b,returnFocusTo:p.current})]})}function connectionActions(e){let t={id:`save-deploy`,label:u(`app.deploy.saveAndDeploy`),deploy:!0,role:e===`edit`?`secondary`:`primary`};return e===`edit`?[{id:`save`,label:u(`app.common.save`),deploy:!1,role:`primary`},t]:[t]}var vt=[`url`,`username`,`password`,`clientId`,`clientSecret`,`tokenUrl`];function isWebAddress(e){try{return/^https?:$/.test(new URL(e).protocol)}catch{return!1}}function connectionErrors(e){let t={},n=e.authType??`none`;return isWebAddress(e.url??``)||(t.url=u(`app.deploy.addressScheme`)),n===`basic`&&(e.username?.trim()||(t.username=u(`app.deploy.enterTheUserNameTo`)),!e.password&&!e.passwordSaved&&(t.password=u(`app.deploy.enterThePasswordToSign`))),n===`oauth`&&(e.clientId?.trim()||(t.clientId=u(`app.deploy.enterTheClientId`)),!e.clientSecret&&!e.clientSecretSaved&&(t.clientSecret=u(`app.deploy.enterTheClientSecret`)),isWebAddress(e.tokenUrl??``)||(t.tokenUrl=u(`app.deploy.tokenAddressScheme`))),t}var yt={none:[],basic:[`username`,`password`],oauth:[`clientId`,`clientSecret`,`tokenUrl`,`audience`]};function connectionFieldsOf(e){return yt[e??`none`]??[]}function firstInvalid(e){return vt.find(t=>t in e)??null}var bt=Object.values(p),xt=L(`http://localhost:8080/engine-rest`),St=L(`http://localhost:8088`),Ct=L(`https://login.cloud.camunda.io/oauth/token`);function ConnectionDialog({profile:e,engine:n,opened:r,onClose:i,onSaved:a}){let[o,c]=t({profile:e}),[d,f]=t(!1),[p,m]=t(!1),[h,g]=t(null),_=re();l(()=>{let t=!1;return D().getDeploymentSettings(e).then(n=>{t||c({...n,profile:e})}).catch(e=>console.error(`Failed to read the connection settings:`,e)).finally(()=>{t||f(!0)}),()=>{t=!0}},[e]),l(()=>{d&&document.querySelector(`.ui-dialog__body input`)?.focus()},[d]);let v=o.authType??`none`,set=e=>c(t=>({...t,...e})),y=connectionErrors(o),save=async e=>{if(_.submit(),firstInvalid(y))requestAnimationFrame(()=>document.querySelector(`.ui-dialog [aria-invalid="true"]`)?.focus());else{m(!0),g(null);try{await D().saveDeploymentSettings(o),a(e)}catch(e){g(u(`app.deploy.unableToSaveTheConnection`,{failure:M(e)}))}finally{m(!1)}}},field=(e,t,n={})=>s(W,{label:e,hint:n.hint,optional:n.optional,error:_.errorOf(t,y[t]??null),children:e=>s(`input`,{...e,type:n.type??`text`,value:o[t]??``,placeholder:n.placeholder,disabled:!d||p,onInput:e=>set({[t]:e.target.value}),onBlur:()=>_.touch(t)})}),b=connectionActions(r),x=b.find(e=>e.role===`primary`)??b[0];return s(U,{title:u(`app.deploy.engineConnection`),subtitle:`${k(n)} · ${Y({profile:e})}`,size:`medium`,onClose:i,onSubmit:()=>void save(x.deploy),footer:s(ie,{actions:[{id:`cancel`,label:u(`app.common.cancel`),role:`cancel`,onClick:i,disabled:p},...b.map(e=>({id:e.id,label:e.label,role:e.role,onClick:()=>void save(e.deploy),disabled:!d,busy:p}))]}),children:[field(u(`app.deploy.engineAddress`),`url`,{placeholder:A(n)?St:xt,hint:u(`app.deploy.keptInPenstockLocalYaml`)}),s(W,{label:u(`app.deploy.signIn`),group:`radiogroup`,children:e=>s(`div`,{...e,class:`ui-choice-group`,children:bt.map(e=>s(`label`,{class:`ui-choice`,children:[s(`input`,{type:`radio`,name:`auth`,checked:v===e,disabled:!d||p,onChange:()=>{_.reveal(connectionFieldsOf(e)),set({authType:e})}}),s(`span`,{children:u(e===`none`?`app.deploy.notNeeded`:e===`basic`?`app.deploy.userAndPassword`:`app.deploy.oauthClient`)})]},e))})}),v===`basic`&&field(u(`app.deploy.user`),`username`),v===`basic`&&field(u(`app.deploy.password`),`password`,{type:`password`,hint:o.passwordSaved?u(`app.deploy.savedInTheIdeS`):u(`app.deploy.keptInTheIdeS`)}),v===`oauth`&&field(u(`app.deploy.clientId`),`clientId`),v===`oauth`&&field(u(`app.deploy.clientSecret`),`clientSecret`,{type:`password`,hint:o.clientSecretSaved?u(`app.deploy.savedInTheIdeS`):u(`app.deploy.keptInTheIdeS`)}),v===`oauth`&&field(u(`app.deploy.tokenAddress`),`tokenUrl`,{placeholder:Ct}),v===`oauth`&&field(u(`app.deploy.audience`),`audience`,{optional:!0}),s(`p`,{class:`ui-field__hint`,children:u(`app.deploy.nameTenantAndTheRest`)}),h&&s(se,{children:h})]})}var wt=4;function sentFiles(e){return e.length>wt?{names:e.slice(0,wt),more:e.length-wt}:{names:e,more:0}}function hookLines(e){let[t,...n]=e;return{command:t??u(`app.deploy.runningTheDeployHook`),said:n.filter(e=>e.trim().length>0)}}function deployPopover(e,t){let n=e?.targets??[],r=n.find(e=>(e.profile??null)===t)??null,i=r?.ready===!0;return{profiles:n.map(e=>({value:e.profile??null,label:e.profile??`default`})),chooseProfile:n.length>1,target:r,address:r?.url??null,canDeploy:i,action:u(i?`app.deploy.deploy`:`app.deploy.setUpConnection`)}}function DeployPopover({deploy:e}){let[n,i]=t(e.targets?.active??null),[a,o]=t(null),c=deployPopover(e.targets,n),d=sentFiles(a??[]),f=tt(`deploy`),p=e.running,m=hookLines(p?.lines??[]);l(()=>{let t=!1;return e.filesToSend().then(e=>!t&&o(e)).catch(()=>!t&&o([])),()=>{t=!0}},[]);let run=()=>{e.deployTo(n)},edit=()=>{e.edit(n)};return s(V,{anchor:f,label:u(`app.deploy.deploy`),onClose:e.closePopover,width:352,class:`deploy-popover`,children:[s(`h3`,{class:`ui-popover__title`,children:u(`app.deploy.deploy`)}),c.chooseProfile&&s(W,{label:u(`app.deploy.profile`),layout:`top`,children:e=>s(`select`,{...e,value:n??``,onChange:e=>i(e.target.value||null),children:c.profiles.map(e=>s(`option`,{value:e.value??``,children:e.label},e.value??`default`))})}),s(`dl`,{class:`ui-popover__facts`,children:[s(`dt`,{children:u(`app.deploy.engineAddress`)}),s(`dd`,{children:c.address??u(`app.deploy.notSetYet`)}),s(`dt`,{children:u(`app.deploy.whatWillBeSent`)}),s(`dd`,{children:[a===null&&u(`app.deploy.readingTheDiagram`),a!==null&&d.names.length===0&&u(`app.deploy.nothingToDeploy`),d.names.map(e=>s(`span`,{class:`ui-popover__file`,children:e},e)),d.more>0&&s(`span`,{class:`ui-popover__file`,children:u(`app.deploy.andNMore`,{number:d.more})})]}),p&&s(r,{children:[s(`dt`,{children:u(`app.deploy.deployHook`)}),s(`dd`,{"aria-busy":`true`,children:[s(`span`,{class:`ui-popover__file`,children:m.command}),m.said.map(e=>s(`span`,{class:`ui-popover__file`,children:e},e))]})]})]}),s(`div`,{class:`ui-popover__actions`,children:s(H,{actions:[...p&&p.cancellable?[{id:`cancel`,label:u(`app.common.cancel`),role:`cancel`,onClick:e.cancelDeploy}]:[],...c.canDeploy&&!p?[{id:`edit`,label:u(`app.deploy.editConnection`),role:`secondary`,onClick:edit}]:[],{id:`deploy`,label:c.action,role:`primary`,onClick:run,busy:p!==null,disabled:p!==null||c.target===null&&e.targets!==null}]})})]})}function DeployLayer({deploy:e,engine:t}){return s(r,{children:[e.popover&&s(DeployPopover,{deploy:e}),e.editing&&s(ConnectionDialog,{profile:e.editing.profile??null,engine:t,onClose:e.closeEditor,opened:e.editingFor,onSaved:t=>void e.saved(t)})]})}function deployFailure(e){return{message:e.message,editConnection:e.status===401||e.status===403}}function useDeploy(e,r){let[a,o]=t(null),[s,c]=t(null),[d,p]=t(`deploy`),[m,h]=t(!1),[g,_]=t(null),v=i(null),y=i(!0),b=n((e,t)=>{h(!1),p(e),c(t)},[]),x=n(async()=>{try{let e=await D().getDeployTargets();return y.current&&o(e),e}catch(e){return console.error(`Failed to read the deployment targets:`,e),null}},[]);l(()=>(y.current=!0,x(),()=>{y.current=!1,v.current?.abort()}),[x]);let find=(e,t)=>e?.targets?.find(e=>(e?.profile??null)===t)??{profile:t,ready:!1},S=n(async t=>{let n=window.appConfig?.bpmnFilePath,r=n?await f(()=>import(`./testCaseRuns-DYKnccnc.js`).then(e=>e.f).then(e=>e.resourcesOf(n,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url).catch(()=>null):null;return r&&r.length>0?r.map(e=>({name:e.name,content:e.content})):[{name:e,content:t}]},[e]),C=n(async()=>{try{let e=await r();return e?(await S(e)).map(e=>e.name):[]}catch{return[]}},[r,S]),w=n(async t=>{let n;try{n=await r()}catch(e){j.error(u(`app.deploy.unableToDeploy`,{reason:e instanceof Error?e.message:String(e)}));return}if(!n){j.error(u(`app.deploy.nothingInToDeploy`,{fileName:e}));return}let i=j.info(u(`app.deploy.deployingTo`,{fileName:e,target:Y(t)})),a=new AbortController;v.current=a,_({lines:[],cancellable:D().hookRunsInBackground===!0});let o=null,s=``;try{o=await Le(t,await S(n),void 0,{signal:a.signal,onLines:e=>_(t=>t&&{...t,lines:e})})}catch(e){s=e instanceof Error?e.message:String(e)}finally{j.hide(i)}if(v.current=null,_(null),!o)j.error(u(`app.deploy.unableToDeploy`,{reason:s}));else if(a.signal.aborted)j.info(u(`app.deploy.deployToCancelled`,{target:Y(t)}));else if(o.ok)j.success(u(`app.deploy.succeededOn`,{message:o.message,target:t.url??Y(t)}));else{let e=deployFailure(o);j.error(e.message,e.editConnection?{label:u(`app.deploy.editConnection2`),run:()=>b(`deploy`,t)}:void 0)}},[r,e,S,b]),T=n(async e=>{let t=find(a??await x(),e);t.ready?await w(t):b(`deploy`,t)},[a,x,w,b]),E=n(async e=>{let t=s?.profile??null;c(null);let n=find(await x(),t);e&&n.ready&&await w(n)},[s,x,w]);return{targets:a,running:g,cancelDeploy:n(()=>v.current?.abort(),[]),editing:s,editingFor:d,popover:m,togglePopover:()=>h(e=>!e),closePopover:()=>h(!1),filesToSend:C,deployTo:T,edit:e=>b(`edit`,find(a,e)),closeEditor:()=>c(null),saved:E}}function deployState(e){return{active:e?.targets?.active??null,targets:(e?.targets?.targets??[]).map(e=>({profile:e?.profile??null,label:Y(e),url:e?.url})),popover:e?.popover??!1,open:e?.togglePopover??(()=>{}),deployTo:t=>void e?.deployTo?.(t),edit:t=>e?.edit?.(t)}}var Tt=4;function problemTally(e){return u(`app.problems.tally`,{count:e})}function CheckCard({title:e,tally:t,isError:n,findings:r,moreCount:i,clean:a,onRecheck:o,onClose:c,onShowAll:l,onPick:d}){let f=Array.isArray(r)?r:[],p=i===void 0?f.slice(0,Tt):f,m=i??Math.max(0,f.length-p.length);return p.length===0&&m===0&&!n&&a?s(`aside`,{class:`diagram-check diagram-check--clean`,"aria-label":e,"aria-description":a,"aria-live":`polite`,title:a,children:[s(`svg`,{class:`diagram-check__ok`,viewBox:`0 0 16 16`,width:`16`,height:`16`,"aria-hidden":`true`,children:s(`path`,{d:`M3.5 8.5 6.5 11.5 12.5 4.5`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`})}),s(`span`,{class:`diagram-check__tally is-clean`,children:u(`app.diagramCheck.noProblemsFound`)}),s(`button`,{type:`button`,class:`ui-button`,onClick:o,title:u(`app.common.checkAgain`),children:u(`app.common.recheck`)})]}):s(`aside`,{class:`diagram-check`,"aria-label":e,"aria-live":`polite`,children:[s(`header`,{class:`diagram-check__bar`,children:[s(`span`,{class:`diagram-check__title`,children:e}),s(`span`,{class:n?`diagram-check__tally is-error`:`diagram-check__tally`,children:t}),s(`button`,{type:`button`,class:`ui-button`,onClick:o,title:u(`app.common.checkAgain`),children:u(`app.common.recheck`)}),s(`button`,{type:`button`,class:`diagram-check__close`,onClick:c,title:u(`app.editorShell.close`,{title:e.toLowerCase()}),"aria-label":u(`app.editorShell.close`,{title:e.toLowerCase()}),children:s(`svg`,{viewBox:`0 0 16 16`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"aria-hidden":`true`,children:s(`path`,{d:`M4.5 4.5 11.5 11.5M11.5 4.5 4.5 11.5`})})})]}),s(`div`,{class:`diagram-check__body`,children:p.length>0&&s(`ul`,{class:`diagram-check__list diagram-check__summary`,children:p.map((e,t)=>e?s(`li`,{children:s(`button`,{type:`button`,class:e.severity?`diagram-check__row has-severity`:`diagram-check__row`,onClick:()=>d(t),children:[e.severity&&s(SeverityIcon,{severity:e.severity}),s(`span`,{class:`diagram-check__row-text`,children:[s(`span`,{class:`diagram-check__row-title`,children:e.title}),s(`span`,{class:`diagram-check__row-where diagram-check__row-where--wrap`,children:e.detail})]})]})},t):null)})}),(p.length>0||m>0)&&s(`footer`,{class:`diagram-check__more`,children:s(`button`,{type:`button`,class:`diagram-check__link`,onClick:l,children:m>0?u(`app.editorShell.showAllMore`,{more:m}):u(`app.common.showAll`)})})]})}var Et=u(`app.tracePaths.tracePaths`);function TraceCard({label:e,before:t,after:n,followMessages:i,showMessages:a,open:o,onToggle:c,onFollowMessages:l,onClose:d}){let f=R(e,t,n);return s(r,{children:[s(`button`,{type:`button`,class:o?`trace-pill is-open`:`trace-pill`,"aria-expanded":o,"aria-label":f,title:f,onClick:c,children:[s(`svg`,{viewBox:`0 0 16 16`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,dangerouslySetInnerHTML:{__html:te}}),s(`span`,{class:`trace-pill__counts`,children:`${t} → ${n}`})]}),o&&s(`aside`,{class:`diagram-check trace-card`,"aria-label":Et,children:[s(`div`,{class:`trace-card__row`,children:[s(`span`,{class:`trace-card__tally`,children:f}),s(`button`,{type:`button`,class:`trace-card__close`,onClick:d,title:u(`app.tracePaths.closeTrace`),"aria-label":u(`app.tracePaths.closeTrace`),children:s(`svg`,{viewBox:`0 0 16 16`,width:`16`,height:`16`,stroke:`currentColor`,fill:`none`,"stroke-width":`1.5`,"stroke-linecap":`round`,"aria-hidden":`true`,children:s(`path`,{d:`M4.5 4.5 11.5 11.5M11.5 4.5 4.5 11.5`})})})]}),a&&s(`label`,{class:`trace-card__option`,children:[s(`input`,{type:`checkbox`,checked:i,onChange:e=>l(e.currentTarget.checked)}),u(`app.tracePaths.followMessageFlows`)]})]})]})}var Dt=[`Canvas`,`Modeling`,`Edit`,`Penstock`],Ot={undo:{keys:[`Mod+Z`],action:`undo`},redo:{keys:[`Mod+Y`,`Mod+Shift+Y`,`Mod+Shift+Z`],action:`redo`},cut:{keys:[`Mod+X`],action:`cut`},copy:{keys:[`Mod+C`],action:`copy`},paste:{keys:[`Mod+V`],action:`paste`},duplicate:{keys:[`Mod+D`],action:`duplicate`},remove:{keys:[`Backspace`,`Delete`],action:`removeSelection`}},kt={selectAll:{keys:[`Mod+A`],action:`selectElements`},find:{keys:[`Mod+F`],action:`find`},zoomIn:{keys:[`Mod+=`],action:`stepZoom`},zoomOut:{keys:[`Mod+-`],action:`stepZoom`},fit:{keys:[`Mod+0`],action:`zoom`},pan:{keys:[`Mod+Arrow`],action:`moveCanvas`},moveSelection:{keys:[`Arrow`],action:`moveSelection`}},row=(e,t,n)=>({id:e,group:t,...n}),At=[`selectAll`,`find`,`zoomIn`,`zoomOut`,`fit`,`pan`,`moveSelection`].map(e=>row(`canvas-${e}`,`Canvas`,kt[e])),jt=[`undo`,`redo`,`cut`,`copy`,`paste`,`duplicate`,`remove`].map(e=>row(`edit-${e}`,`Edit`,Ot[e])),Mt={bpmn:{canvas:[...At,row(`model-space-tool`,`Modeling`,{keys:[`S`],action:`spaceTool`}),row(`model-lasso`,`Modeling`,{keys:[`L`],action:`lassoTool`}),row(`model-hand`,`Modeling`,{keys:[`H`],action:`handTool`}),row(`model-connect`,`Modeling`,{keys:[`C`],action:`globalConnectTool`}),row(`model-direct-edit`,`Modeling`,{keys:[`E`],action:`directEditing`}),row(`model-replace`,`Modeling`,{keys:[`R`],action:`replaceElement`}),...jt],drd:[],table:[],form:[]},dmn:{canvas:[],drd:[...At,row(`model-lasso`,`Modeling`,{keys:[`L`],action:`lassoTool`}),row(`model-hand`,`Modeling`,{keys:[`H`],action:`handTool`}),row(`model-direct-edit`,`Modeling`,{keys:[`E`],action:`directEditing`}),...jt],table:[],form:[]},form:{canvas:[],drd:[],table:[],form:[row(`edit-undo`,`Edit`,Ot.undo),row(`edit-redo`,`Edit`,Ot.redo)]}};function libraryRows(e,t){return(Mt[e]?.[t]??[]).map(e=>({...e,label:u(`app.shortcuts.row.${e.id}`)}))}function penstockRows(e=[]){return[{id:`penstock-palette`,label:u(`app.shortcuts.row.penstock-palette`),group:`Penstock`,keys:[_.shortcut]},...(e??[]).filter(e=>e?.id&&e?.shortcut).map(e=>({id:`penstock-${e.id}`,label:e.title??``,group:`Penstock`,keys:[String(e.shortcut)],action:e.id}))]}function shortcutRows(e=[],t,n){return penstockRows(e).reduce((e,t)=>{let n=e.findIndex(e=>(e?.keys??[]).some(e=>(t?.keys??[]).includes(e)));if(n<0)return[...e,t];let r={...e[n],...t.action?{action:t.action}:{}};return[...e.slice(0,n),r,...e.slice(n+1)]},[...libraryRows(t,n)])}function shortcutSections(e=[],t,n){let r=shortcutRows(e,t,n);return Dt.map(e=>({group:e,rows:r.filter(t=>t.group===e)})).filter(e=>e.rows.length>0)}function splitSections(e=[]){let t=e??[],n=t.reduce((e,t)=>e+(t?.rows?.length??0),0)/2,r=[],i=0;for(let e of t)if(e){if(i>=n&&r.length>0)break;r.push(e),i+=e.rows?.length??0}return[r,t.filter(e=>!r.includes(e))]}function rowMatches(e,t,n){return e?(e.label??``).toLowerCase().includes(t)?!0:(e.keys??[]).some(e=>(e??``).toLowerCase().includes(t)||(F(e,n)??``).toLowerCase().includes(t)):!1}function filterShortcutSections(e=[],t=``,n=!1){let r=(t??``).trim().toLowerCase(),i=e??[];return r?i.map(e=>({group:e.group,rows:(e.rows??[]).filter(e=>rowMatches(e,r,n))})).filter(e=>e.rows.length>0):[...i]}function KeyboardShortcutsDialog({editor:e,mode:n,actions:r,onClose:i}){let[o,c]=t(``),l=hostIsMac(),d=a(()=>filterShortcutSections(shortcutSections(r,e,n),o,l),[r,e,n,o,l]),[f,p]=a(()=>splitSections(d),[d]);return s(U,{title:u(`app.shortcuts.title`),size:`large`,initialFocus:`title`,onClose:i,class:`keyboard-shortcuts-dialog`,footer:s(ie,{actions:[{id:`close`,label:u(`app.common.close`),role:`primary`,onClick:i}]}),children:[s(`input`,{class:`ui-input type-input keyboard-shortcuts__search`,type:`text`,"aria-label":u(`app.shortcuts.search`),placeholder:u(`app.shortcuts.search`),value:o,onInput:e=>c(e.target.value)}),d.length===0?s(oe,{title:u(`app.shortcuts.noMatch`),hint:u(`app.shortcuts.noMatchHint`)}):s(`div`,{class:`keyboard-shortcuts__list`,children:[f,p].map(e=>s(`div`,{class:`keyboard-shortcuts__column`,children:e.map(e=>s(`section`,{class:`keyboard-shortcuts__group`,children:[s(`h3`,{class:`type-section-heading keyboard-shortcuts__group-title`,children:u(`app.shortcuts.group.${e.group}`)}),e.rows.map(e=>s(`div`,{class:`keyboard-shortcuts__row`,children:[s(`span`,{class:`type-body keyboard-shortcuts__label`,children:e.label}),s(`span`,{class:`keyboard-shortcuts__keys`,children:e.keys.map(e=>s(`kbd`,{class:`type-code keyboard-shortcuts__key`,children:F(e,l)},e))})]},e.id))]},e.group))},e.length===0?`right`:e[0].group))})]})}var Nt=`#js-properties-panel, #dmn-properties-panel, .sidebar-properties`;function blockedBy(e){try{if(I(e))return!0;let t=e;return typeof t?.closest==`function`&&!!t.closest(Nt)}catch{return!1}}function KeyboardShortcutsLayer({editor:e,mode:n,actions:r}){let[i,a]=t(!1),o=J();return l(()=>{if(o)try{let e=h(()=>a(!0));return()=>e?.()}catch{return}},[o]),l(()=>{if(!o)return;let listener=e=>{i||e.defaultPrevented||x(e,`Shift+/`,hostIsMac())&&(blockedBy(e.target)||(e.preventDefault(),a(!0)))};return document.addEventListener(`keydown`,listener,!0),()=>document.removeEventListener(`keydown`,listener,!0)},[i,o]),i?s(KeyboardShortcutsDialog,{editor:e,mode:n,actions:r,onClose:()=>a(!1)}):null}function label(e){return u(`app.themeChoice.${e}`)}function ThemeChoiceLayer(){let[e,n]=t(!1),[r,i]=t(He()),a=J(),o=tt(`toolbar-more`);if(l(()=>{if(!a)return;let e=b(()=>{i(He()),n(!0)});return()=>e()},[a]),!e)return null;let pick=e=>{Ke(e),i(e)};return s(V,{anchor:o,label:u(`app.themeChoice.title`),onClose:()=>n(!1),width:240,class:`theme-choice`,children:[s(`h3`,{class:`ui-popover__title`,children:u(`app.themeChoice.title`)}),s(`div`,{role:`radiogroup`,"aria-label":u(`app.themeChoice.title`),class:`theme-choice__list`,children:Me.map(e=>s(`label`,{class:`theme-choice__row type-body`,children:[s(`input`,{type:`radio`,name:`editor-theme`,value:e,checked:r===e,tabIndex:r===e?0:-1,onChange:()=>pick(e)}),s(`span`,{children:label(e)})]},e))})]})}function useDocumentationLink(e){l(()=>y(t=>{Promise.resolve().then(()=>e(t)).catch(()=>{window.open(t,`_blank`,`noopener,noreferrer`)})}),[e])}var ErrorBoundary=class extends o{state={hasError:!1};static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e){console.error(e)}handleReload=()=>{this.props.onReload?this.props.onReload():window.location.reload()};render(){return this.state.hasError?s(`div`,{class:`editor-error-boundary`,role:`alert`,children:s(oe,{title:u(`app.startup.theEditorCouldNotStart`),hint:u(`app.startup.retryingReloadsTheEditorAnd`),actions:[{label:u(`app.common.reload`),run:this.handleReload}]})}):this.props.children}};function useCornerLayout(e){let[n,r]=t(!1);return l(()=>{let t=e.current;if(!t)return;let publish=()=>{let e=ze(t);t.style.setProperty(`--corner-height`,`${e.height}px`),t.style.setProperty(`--dock-inset`,`${e.dock}px`),t.style.setProperty(`--input-inset`,`${e.input}px`),t.style.setProperty(`--corner-left`,`${e.left}px`),t.style.setProperty(`--corner-covered-left`,`${e.coveredLeft}px`),t.style.setProperty(`--corner-bottom`,`${e.bottom}px`),t.style.setProperty(`--corner-trace-left`,`${e.traceLeft}px`),r(e.folded)};publish();let n=fe(t,[],publish),i=de(t,publish);return window.addEventListener(`resize`,publish),()=>{n(),i(),window.removeEventListener(`resize`,publish),t.style.removeProperty(`--corner-height`),t.style.removeProperty(`--dock-inset`),t.style.removeProperty(`--input-inset`),t.style.removeProperty(`--corner-left`),t.style.removeProperty(`--corner-covered-left`),t.style.removeProperty(`--corner-bottom`),t.style.removeProperty(`--corner-trace-left`)}},[e]),n}function isSmallCanvas(e,t){return e<720||t<560}function paletteCollapsed({preference:e,small:t,openedWhileSmall:n}){return e===!0||t&&!n}var Pt=`palette-island__head`,Ft=`palette-island__toggle`,It=new WeakMap,Lt=`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 4 6 8l4 4" /></svg>`;function headOf(e){let t=e.querySelector(`:scope > .${Pt} > .${Ft}`);if(t)return t;let n=document.createElement(`div`);n.className=Pt;let r=document.createElement(`button`);return r.type=`button`,r.className=Ft,r.innerHTML=Lt,r.addEventListener(`click`,()=>It.get(r)?.()),n.appendChild(r),e.insertBefore(n,e.firstChild),r}function syncPaletteHeads(e,t,n){e.querySelectorAll(ye).forEach(e=>{let r=headOf(e);It.set(r,n);let i=u(t?`app.editorShell.openPalette`:`app.editorShell.collapsePalette`);r.setAttribute(`aria-label`,i),r.setAttribute(`aria-expanded`,String(!t)),r.title=i})}function usePaletteIsland(e){let[r,i]=t(()=>G().paletteCollapsed??null),[a,o]=t(!1),[s,c]=t(!1);l(()=>{let t=e.current;if(!t)return;let measure=()=>{let e=t.getBoundingClientRect();o(isSmallCanvas(e.width,e.height))};if(measure(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(measure);return n.observe(t),()=>n.disconnect()},[e]);let u=paletteCollapsed({preference:r,small:a,openedWhileSmall:s}),d=n(()=>{let e=!u;i(e),c(!e&&a),K({paletteCollapsed:e})},[u,a]);return l(()=>{let t=e.current;if(!t)return;let sync=()=>syncPaletteHeads(t,u,d);if(sync(),typeof MutationObserver>`u`)return;let n=new MutationObserver(sync);return n.observe(t,{childList:!0,subtree:!0}),()=>n.disconnect()},[e,u,d]),{collapsed:u,toggle:d}}function EditorShell({className:e,toolbarItems:r,tabs:a,sidebar:o,badges:c,notice:d,check:f,trace:p,timeline:m,statusShown:h,deploy:g,assistant:_,counts:v,shortcuts:y,edit:b,children:x,onReload:S}){let C=J(),w=i(Symbol(`editor`)),T=(y?.actions??[]).filter(e=>e.enabled).map(e=>e.id).join(`,`),E=c?.problems,O=v?.scenarios,k=v?.waiting;l(()=>{if(C)return Ee(w.current,{problems:E,scenarios:O,waiting:k,actions:T===``?[]:T.split(`,`)}),()=>Je(w.current)},[C,E,O?.passed,O?.all,k,T]);let A=i(b);A.current=b,l(()=>{if(C)return We(w.current,()=>A.current??{})},[C]),useDocumentationLink(e=>D().openExternalLink(e));let j=i(null),M=i(null),N=useCornerLayout(j),P=usePaletteIsland(j),F=Ge();ke();let[I,L]=t(!1),R=f!==void 0,te=n(()=>{I||f?.onClose(),L(!I)},[I,f?.onClose]);l(()=>{R&&L(!1)},[R]);let z=R||I;l(()=>{if(!z)return;let escape=e=>{e.key===`Escape`&&(I?L(!1):f?.onClose())};return document.addEventListener(`keydown`,escape),()=>document.removeEventListener(`keydown`,escape)},[z,I,f?.onClose]);let B=_?.key??null,V=ee($e()),H=Ze(B),U=pe(B),ne=i(U);l(()=>{ne.current!==U&&(ne.current=U,o.select(ge.id))},[U]);let W=V.chatTab&&o.shownTab===ge.id;xe(B,W);let re=a.filter(e=>e.needs!==`ai-chat`||V.chatTab),ie=[f||h?`editor-canvas diagram-check-open`:`editor-canvas`,p?p.showMessages?`has-trace-card`:`has-trace-card is-one-row`:``,N?`is-corner-folded`:``,P.collapsed?`is-palette-collapsed`:``].filter(Boolean).join(` `);return s(ErrorBoundary,{onReload:S,children:s(ve,{value:M,children:s(`div`,{class:`resource-editor ${e}`,ref:M,children:[s(`div`,{class:`editor-shell`,ref:o.measure,children:[s(`div`,{class:`editor-main`,children:[s(`div`,{id:`toolbar-container`,class:`app-toolbar`,style:{flexShrink:0},children:s(Toolbar,{items:r})}),d&&s(`div`,{class:`resource-editor__notice`,role:`status`,children:[s(`span`,{children:d.text}),d.action&&s(`button`,{type:`button`,class:`resource-editor__notice-action`,onClick:d.action.run,children:d.action.label}),d.secondary&&s(`button`,{type:`button`,class:`resource-editor__notice-action`,onClick:d.secondary.run,children:d.secondary.label}),s(`button`,{type:`button`,class:`resource-editor__notice-action`,onClick:d.dismiss,children:u(`app.dmnMode.gotIt`)})]}),s(`div`,{id:`js-canvas`,class:ie,ref:j,children:[x,p&&s(TraceCard,{...p,open:I,onToggle:te}),f&&s(CheckCard,{...f}),_&&s(me,{editor:_,hidden:W})]}),m]}),s(Ce.Provider,{value:_??null,children:s(Sidebar,{tabs:re,api:o,badges:c,statuses:H?{[ge.id]:H}:void 0,hidden:F})})]}),_&&s(Re,{editor:_}),g&&s(DeployLayer,{deploy:g.deploy,engine:g.engine}),y&&s(KeyboardShortcutsLayer,{...y}),s(ThemeChoiceLayer,{})]})})})}var Rt=`
3
3
  :root{color-scheme:light dark;--bg:#ffffff;--surface:#f7f8fa;--border:#ebecf0;--fg:#27282c;--muted:#6c707e;--accent:#3574f0;--hover:#ebecf0}
4
4
  @media (prefers-color-scheme: dark){:root{--bg:#1e1f22;--surface:#2b2d30;--border:#43454a;--fg:#ced0d6;--muted:#868a91;--accent:#548af7;--hover:#393b40}#canvas svg{filter:invert(.9) hue-rotate(180deg)}}
5
5
  *{box-sizing:border-box}
@@ -218,12 +218,12 @@ footer{padding:8px 16px;color:var(--muted);font-size:12px;line-height:24px}
218
218
  });
219
219
 
220
220
  fit();
221
- })();`}var Bt=`http://www.omg.org/spec/BPMN/20100524/MODEL`,Vt=new Set([`definitions`,`process`,`collaboration`,`laneSet`,`message`,`signal`,`error`,`escalation`,`itemDefinition`,`dataStore`,`documentation`]),Ht=`default-src 'none'; img-src data:; style-src 'unsafe-inline'; script-src 'unsafe-inline'; base-uri 'none'; form-action 'none'`,Ut={"zoom-in":`<path d="M3 8h10M8 3v10"/>`,"zoom-out":`<path d="M3 8h10"/>`,"zoom-fit":`<path d="M2 6V2h4M10 2h4v4M14 10v4h-4M6 14H2v-4"/>`};function typeName(e){let t=T(e);return t.charAt(0).toUpperCase()+t.slice(1)}function documentationOf(e){let t=e.children.find(e=>e.local===`documentation`);return t?t.text.trim():``}function elementDocs(e){let t=m(e),n=[],visit=e=>{for(let t of e.children){if(t.ns===Bt&&t.attrs.id&&!Vt.has(t.local)){let e=(t.attrs.name??``).replace(/\s+/g,` `).trim(),r=documentationOf(t);(e||r)&&n.push({id:t.attrs.id,type:typeName(t.local),name:e,documentation:r})}t.ns===Bt&&visit(t)}};return visit(t),n}function diagramTitle(e,t){let n=m(e),named=e=>y(n,e).map(e=>(e.attrs.name??``).replace(/\s+/g,` `).trim()).find(Boolean),r=(n.attrs.name??``).trim();return named(`collaboration`)||(y(n,`participant`).length>1?r||t:named(`participant`)??named(`process`)??(r||t))}function prepareSvg(e){let t=e.indexOf(`<svg`);if(t<0)throw Error(u(`app.share.couldNotBeDrawn`));let n=e.slice(t),r=/^<svg[^>]*>/.exec(n);if(!r)throw Error(u(`app.share.couldNotBeDrawn`));let i=r[0];if(!/viewBox="/.test(i)){let e=/\swidth="([\d.]+)/.exec(i)?.[1]??`100`,t=/\sheight="([\d.]+)/.exec(i)?.[1]??`100`;i=i.replace(`<svg`,`<svg viewBox="0 0 ${e} ${t}"`)}return i=i.replace(/\s(width|height|preserveAspectRatio)="[^"]*"/g,``).replace(`<svg`,`<svg preserveAspectRatio="xMidYMid meet" role="img"`),n=i+n.slice(r[0].length),n}function json(e){return JSON.stringify(e).replace(/</g,`\\u003c`).replace(RegExp(`\u2028`,`g`),`\\u2028`).replace(RegExp(`\u2029`,`g`),`\\u2029`)}function table(e,t){return`<table><thead><tr>${e.map(e=>`<th>${C(e)}</th>`).join(``)}</tr></thead><tbody>\n${t.map(e=>`<tr>${e.map(e=>`<td>${C(e)}</td>`).join(``)}</tr>`).join(`
222
- `)}\n</tbody></table>`}function sectionHtml(e,t){return`<section><h2${t?` class="name"`:``}>${C(e.title)}</h2>${e.description?`<p>${C(e.description)}</p>`:``}${e.note?`<p class="note">${C(e.note)}</p>`:``}${table(e.head,e.rows)}</section>`}function controls(){let button=(e,t)=>`<button type="button" id="${e}" aria-label="${t}" title="${t}"><svg viewBox="0 0 16 16" aria-hidden="true">${Ut[e]}</svg></button>`;return`<div id="controls">${button(`zoom-in`,u(`app.share.zoomIn`))}${button(`zoom-out`,u(`app.share.zoomOut`))}${button(`zoom-fit`,u(`app.share.fitToScreen`))}</div>`}function buildShareHtml(e){let t=C(e.title),n=`<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="Content-Security-Policy" content="${Ht}"><meta name="generator" content="Penstock"><title>${t}</title><style>${Rt}${e.kind===`bpmn`?zt:``}</style>`,r=`<footer>${C(u(`app.share.madeWith`))}</footer>`;if(e.kind===`bpmn`){let i=e.subtitle??u(`app.share.clickAnElement`);return`<!doctype html>
221
+ })();`}var Bt=`http://www.omg.org/spec/BPMN/20100524/MODEL`,Vt=new Set([`definitions`,`process`,`collaboration`,`laneSet`,`message`,`signal`,`error`,`escalation`,`itemDefinition`,`dataStore`,`documentation`]),Ht=`default-src 'none'; img-src data:; style-src 'unsafe-inline'; script-src 'unsafe-inline'; base-uri 'none'; form-action 'none'`,Ut={"zoom-in":`<path d="M3 8h10M8 3v10"/>`,"zoom-out":`<path d="M3 8h10"/>`,"zoom-fit":`<path d="M2 6V2h4M10 2h4v4M14 10v4h-4M6 14H2v-4"/>`};function typeName(e){let t=C(e);return t.charAt(0).toUpperCase()+t.slice(1)}function documentationOf(e){let t=e.children.find(e=>e.local===`documentation`);return t?t.text.trim():``}function elementDocs(e){let t=w(e),n=[],visit=e=>{for(let t of e.children){if(t.ns===Bt&&t.attrs.id&&!Vt.has(t.local)){let e=(t.attrs.name??``).replace(/\s+/g,` `).trim(),r=documentationOf(t);(e||r)&&n.push({id:t.attrs.id,type:typeName(t.local),name:e,documentation:r})}t.ns===Bt&&visit(t)}};return visit(t),n}function diagramTitle(e,t){let n=w(e),named=e=>m(n,e).map(e=>(e.attrs.name??``).replace(/\s+/g,` `).trim()).find(Boolean),r=(n.attrs.name??``).trim();return named(`collaboration`)||(m(n,`participant`).length>1?r||t:named(`participant`)??named(`process`)??(r||t))}function prepareSvg(e){let t=e.indexOf(`<svg`);if(t<0)throw Error(u(`app.share.couldNotBeDrawn`));let n=e.slice(t),r=/^<svg[^>]*>/.exec(n);if(!r)throw Error(u(`app.share.couldNotBeDrawn`));let i=r[0];if(!/viewBox="/.test(i)){let e=/\swidth="([\d.]+)/.exec(i)?.[1]??`100`,t=/\sheight="([\d.]+)/.exec(i)?.[1]??`100`;i=i.replace(`<svg`,`<svg viewBox="0 0 ${e} ${t}"`)}return i=i.replace(/\s(width|height|preserveAspectRatio)="[^"]*"/g,``).replace(`<svg`,`<svg preserveAspectRatio="xMidYMid meet" role="img"`),n=i+n.slice(r[0].length),n}function json(e){return JSON.stringify(e).replace(/</g,`\\u003c`).replace(RegExp(`\u2028`,`g`),`\\u2028`).replace(RegExp(`\u2029`,`g`),`\\u2029`)}function table(e,t){return`<table><thead><tr>${e.map(e=>`<th>${v(e)}</th>`).join(``)}</tr></thead><tbody>\n${t.map(e=>`<tr>${e.map(e=>`<td>${v(e)}</td>`).join(``)}</tr>`).join(`
222
+ `)}\n</tbody></table>`}function sectionHtml(e,t){return`<section><h2${t?` class="name"`:``}>${v(e.title)}</h2>${e.description?`<p>${v(e.description)}</p>`:``}${e.note?`<p class="note">${v(e.note)}</p>`:``}${table(e.head,e.rows)}</section>`}function controls(){let button=(e,t)=>`<button type="button" id="${e}" aria-label="${t}" title="${t}"><svg viewBox="0 0 16 16" aria-hidden="true">${Ut[e]}</svg></button>`;return`<div id="controls">${button(`zoom-in`,u(`app.share.zoomIn`))}${button(`zoom-out`,u(`app.share.zoomOut`))}${button(`zoom-fit`,u(`app.share.fitToScreen`))}</div>`}function buildShareHtml(e){let t=v(e.title),n=`<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="Content-Security-Policy" content="${Ht}"><meta name="generator" content="Penstock"><title>${t}</title><style>${Rt}${e.kind===`bpmn`?zt:``}</style>`,r=`<footer>${v(u(`app.share.madeWith`))}</footer>`;if(e.kind===`bpmn`){let i=e.subtitle??u(`app.share.clickAnElement`);return`<!doctype html>
223
223
  <html lang="${d()}"><head>${n}</head>
224
224
  <body>
225
- <header><h1>${t}</h1><p class="hint">${C(i)}</p></header>
226
- <main><div id="canvas" tabindex="0">${prepareSvg(e.svg)}</div>${controls()}<aside id="info" role="region" aria-live="polite" aria-label="${C(u(`app.share.elementDocumentation`))}" hidden></aside></main>
225
+ <header><h1>${t}</h1><p class="hint">${v(i)}</p></header>
226
+ <main><div id="canvas" tabindex="0">${prepareSvg(e.svg)}</div>${controls()}<aside id="info" role="region" aria-live="polite" aria-label="${v(u(`app.share.elementDocumentation`))}" hidden></aside></main>
227
227
  ${r}
228
228
  <a class="bjs-powered-by" href="https://bpmn.io" target="_blank" rel="noopener" title="Powered by bpmn.io" aria-label="Powered by bpmn.io">${le}</a>
229
229
  <script type="application/json" id="docs">${json(e.docs)}<\/script>
@@ -232,9 +232,9 @@ ${r}
232
232
  `}let i=e.sections.filter(e=>e.rows.length>0),a=i.length>1;return`<!doctype html>
233
233
  <html lang="${d()}"><head>${n}</head>
234
234
  <body>
235
- <header><h1>${t}</h1>${e.subtitle?`<p class="hint">${C(e.subtitle)}</p>`:``}</header>
235
+ <header><h1>${t}</h1>${e.subtitle?`<p class="hint">${v(e.subtitle)}</p>`:``}</header>
236
236
  <div class="document">${i.map(e=>sectionHtml(e,a)).join(`
237
237
  `)}</div>
238
238
  ${r}
239
239
  </body></html>
240
- `}function shareBpmn(e,t,n){return buildShareHtml({kind:`bpmn`,title:diagramTitle(e,n),svg:t,docs:elementDocs(e)})}async function shareDmn(e,t){let{rootElement:n}=await v(e),r=w(n.drgElement??[]);return buildShareHtml({kind:`sections`,title:n.name?.trim()||t,subtitle:u(`app.toolWindow.section.decisions`),sections:r})}function shareForm(e,t){let n=JSON.parse(e);return buildShareHtml({kind:`sections`,title:t,subtitle:u(`app.sections.form`),sections:[E(D(n.components??[],[]))]})}function shareFileName(e,t){return`${((e??``).split(/[\\/]/).pop()??``).replace(/\.(bpmn(\.xml|20\.xml)?|dmn|form)$/i,``)||t}.html`}var Wt=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform);function useSidebarToggle(e){let t=i(null),r=J(),a=n(()=>{let n=Date.now();Ie(t.current,n)||(t.current=n,e())},[e]);return l(()=>{if(!r)return;let onKey=e=>{Fe(e,Wt)&&(e.preventDefault(),a())};return window.addEventListener(`keydown`,onKey),()=>window.removeEventListener(`keydown`,onKey)},[a,r]),a}function UnreadableDiagramView({problem:e,kind:t=`diagram`,onOpenText:n,onReload:r}){return s(`main`,{class:`unreadable-diagram`,role:`alert`,children:[s(`h1`,{class:`unreadable-diagram__title`,children:u(`app.unreadable.title.${t}`)}),s(`p`,{class:`unreadable-diagram__reason`,children:g(e)}),s(`p`,{class:`unreadable-diagram__note`,children:u(`app.unreadable.note.${t}`)}),s(`div`,{class:`unreadable-diagram__actions`,children:[s(`button`,{type:`button`,class:`ui-button ui-button--primary`,onClick:n,children:u(`app.unreadable.open.${t}`)}),s(`button`,{type:`button`,class:`ui-button`,onClick:r,children:u(`app.common.reload`)})]})]})}function bindSaveQueue({save:e,onFailure:t}){let n=null,r=!1,flush=()=>{if(r||n===null)return;let i=n;n=null,r=!0;let a;try{a=e(i)}catch(e){a=Promise.reject(e)}Promise.resolve(a).catch(e=>{try{t?.(e)}catch{}}).finally(()=>{r=!1,flush()})};return{edited:e=>{n=e,flush()},reloaded:e=>{r&&(n=e,flush())}}}function toolbarLayout(e,t={}){let n=Array.isArray(e)?e.filter(Boolean):[],inSlot=e=>n.filter(t=>t?.slot===e),r=inSlot(`view`),i=inSlot(`lead`),a=inSlot(`start`),o=inSlot(`end`);return t?.overflow===`right`?[...r,...i,...a,{type:`spacer`},{type:`overflow`},...o]:[...i,...i.length>0?[{type:`separator`}]:[],...r,...a,{type:`overflow`},{type:`spacer`},...o]}async function drawLight(e){if(typeof document>`u`||!document.body)return``;let t=document.createElement(`div`);t.style.cssText=`position:fixed;left:-10000px;top:0;width:1200px;height:800px`,document.body.appendChild(t);let n=new ue({container:t,textRenderer:B,bpmnRenderer:z.light});try{return await n.importXML(e),(await n.saveSVG().catch(()=>({svg:``})))?.svg??``}catch{return``}finally{try{n.destroy()}catch{}t.remove()}}async function pageOf(e,t,n){let r=shareFileName(n,`diagram`).replace(/\.html$/,``);return e===`bpmn`?shareBpmn(t,await drawLight(t),r):e===`dmn`?shareDmn(t,r):shareForm(t,r)}async function shareToFile(e,t,n){try{let r=O(),i=await pageOf(e,t,n),a=await r.chooseFile(`html`,{title:u(`app.share.shareAsHtml`),description:u(`app.share.oneFileThatOpensOffline`),mode:`save`,defaultFileName:shareFileName(n,`diagram`)});if(!a)return;await r.saveFile(a,i),j.success(u(`app.share.savedItOpensOfflineIn`,{target:a}))}catch(e){try{j.error(u(`app.share.couldNotShareThisDiagram`,{failure:e instanceof Error?e.message:String(e)}))}catch{}}}var Q={trialDays:30,currency:`USD`,pro:{monthly:9,yearly:90},team:{monthly:29,yearly:290}};function money(e){return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:Q.currency,maximumFractionDigits:0}).format(e)}function priceLine(e){return e(`app.nudges.price`,{monthly:money(Q.pro.monthly),yearly:money(Q.pro.yearly)})}var Gt=Q.trialDays,Kt=[`autoLayout`,`flowAnalysis`,`migration`,`codeLinks`,`conventions`,`testRuns`,`visualDiff`,`aiChat`,`variableChecks`],qt=3;function namedTools(e){return Kt.slice(0,qt).map(t=>e(`app.vscode.licence.feature.${t}.title`)).join(`, `)}function trialSentence(e,t){return e.trial===`running`?t(`app.nudges.freeNotice.trialRunning`,{days:Gt}):e.trial===`ended`?t(`app.nudges.freeNotice.trialEnded`):``}function copyOf(e,t){let n=namedTools(t),r=priceLine(t);switch(e.id){case`trialEnded`:return{text:t(`app.nudges.trialEnded.text`,{features:n,price:r}),action:t(`app.nudges.trialEnded.start`),secondary:t(`app.nudges.trialEnded.later`)};case`trialLastDay`:return{text:t(`app.nudges.lastDay.text`,{price:r}),action:t(`app.nudges.lastDay.start`)};case`trialDay23`:return{text:t(`app.nudges.day23.text`,{count:e.daysLeft??0,features:n}),action:t(`app.nudges.day23.action`)};case`freeNotice`:return{text:t(`app.nudges.freeNotice.text`,{features:n,trial:trialSentence(e,t)}).trim(),action:t(`app.nudges.freeNotice.action`)}}}var Jt=864e5,Yt=1,Xt=7;function dayOf(e){let t=String(e.getMonth()+1).padStart(2,`0`),n=String(e.getDate()).padStart(2,`0`);return`${e.getFullYear()}-${t}-${n}`}function trialOf(e,t){let n=typeof e.trialEndsAt==`string`?Date.parse(e.trialEndsAt):NaN;return Number.isNaN(n)?{state:`none`,daysLeft:null}:e.tier===`FREE`?n<=t.getTime()?{state:`ended`,daysLeft:null}:{state:`none`,daysLeft:null}:e.tier===`PRO`&&e.trialDaysLeft!=null&&n>t.getTime()?{state:`running`,daysLeft:Math.ceil((n-t.getTime())/Jt)}:{state:`none`,daysLeft:null}}function due(e,t,n){if(t.dismissed?.includes(e))return!1;let r=t.snoozedUntil?.[e];return r?n>=r:!t.shown?.[e]}function pickNudge({licence:e,record:t,sessionShown:n,now:r}){if(!e||n||t?.off===!0||e.tier!==`FREE`&&trialOf(e,r).state!==`running`)return null;let i=t??{},a=dayOf(r),{state:o,daysLeft:s}=trialOf(e,r);if(o===`ended`&&due(`trialEnded`,i,a))return{id:`trialEnded`,reason:`TRIAL_ENDED`,trial:o,daysLeft:s};if(o===`running`&&s!==null){if(s<=Yt&&due(`trialLastDay`,i,a))return{id:`trialLastDay`,reason:`TRIAL_LAST_DAY`,trial:o,daysLeft:s};if(s>Yt&&s<=Xt&&due(`trialDay23`,i,a))return{id:`trialDay23`,reason:`TRIAL_ENDING`,trial:o,daysLeft:s}}return i.existingUser===!0&&due(`freeNotice`,i,a)?{id:`freeNotice`,reason:`FREE_NOTICE`,trial:o,daysLeft:s}:null}var Zt=3;function shown(e,t,n){let r={...e??{},shown:{...e?.shown??{},[t]:n}},i=Object.fromEntries(Object.entries(e?.snoozedUntil??{}).filter(([e])=>e!==t));return Object.keys(i).length>0?r.snoozedUntil=i:delete r.snoozedUntil,r}function dismissed(e,t){let n=e?.dismissed??[];return{...e??{},dismissed:n.includes(t)?[...n]:[...n,t]}}function remindLater(e,t,n){let r=new Date(n.getFullYear(),n.getMonth(),n.getDate()+Zt);return{...e??{},snoozedUntil:{...e?.snoozedUntil??{},[t]:dayOf(r)}}}var $=!1;async function attempt(e){try{return await e()}catch{return null}}async function recordOf(){let e=O(),[t,n]=await Promise.all([attempt(()=>e.getLicense()),attempt(()=>e.getPreferences())]);return{licence:t,record:n}}async function currentRecord(){let e=O();return(await attempt(()=>e.getPreferences()))?.nudges}async function openLicence(e){let t=O();try{t.showLicenceOffer?await t.showLicenceOffer(e.reason,`banner:${e.id}`):await t.showLicence?.()}catch(e){console.error(`Failed to open the licence screen:`,e)}}function useNudge({ready:e,suspended:n}){let[r,a]=t(null),o=i(!0);if(l(()=>(o.current=!0,()=>{o.current=!1}),[]),l(()=>{if(!e||n||$)return;let t=!0;return(async()=>{try{let{licence:e,record:n}=await recordOf();if(!t||$)return;let r=new Date,i=pickNudge({licence:e,record:n?.nudges,sessionShown:$,now:r});if(!i)return;$=!0,K({nudges:shown(n?.nudges,i.id,dayOf(r))}),o.current&&a({nudge:i,copy:copyOf(i,u)})}catch(e){console.error(`Failed to choose a banner:`,e)}})(),()=>{t=!1}},[e,n]),!r)return null;let{nudge:s,copy:c}=r,close=()=>a(null),change=async e=>{K({nudges:e(await currentRecord())})};return{text:c.text,action:{label:c.action,run:()=>{close(),change(e=>dismissed(e,s.id)),openLicence(s)}},secondary:c.secondary?{label:c.secondary,run:()=>{close(),change(e=>remindLater(e,s.id,new Date))}}:void 0,dismiss:()=>{close(),change(e=>dismissed(e,s.id))}}}function revealers(e){let t=e.registerRevealer;return t?t.bind(e):void 0}function documentBridge(e,t){let n=Object.create(e);return Object.assign(n,{getBpmnFilePath:()=>t.path,getBpmnXml:()=>t.initialText,saveBpmnXml:async e=>t.edit(e),onDocumentChanged:e=>t.onReload(e),onRevealElement:n=>revealers(e)?.(t.path,n)??(()=>{}),openScriptFile:(n,r,i,a,o,s=t.path)=>e.openScriptFile(n,r,i,a,o,s)}),n}export{NavRow as _,bindSaveQueue as a,EditorShell as c,useDeploy as d,hostIsMac as f,useSidebar as g,createPanelHost as h,toolbarLayout as i,problemTally as l,PanelHost as m,useNudge as n,UnreadableDiagramView as o,SeverityIcon as p,shareToFile as r,useSidebarToggle as s,documentBridge as t,deployState as u,resolveActions as v};
240
+ `}function shareBpmn(e,t,n){return buildShareHtml({kind:`bpmn`,title:diagramTitle(e,n),svg:t,docs:elementDocs(e)})}async function shareDmn(e,t){let{rootElement:n}=await O(e),r=S(n.drgElement??[]);return buildShareHtml({kind:`sections`,title:n.name?.trim()||t,subtitle:u(`app.toolWindow.section.decisions`),sections:r})}function shareForm(e,t){let n=JSON.parse(e);return buildShareHtml({kind:`sections`,title:t,subtitle:u(`app.sections.form`),sections:[T(E(n.components??[],[]))]})}function shareFileName(e,t){return`${((e??``).split(/[\\/]/).pop()??``).replace(/\.(bpmn(\.xml|20\.xml)?|dmn|form)$/i,``)||t}.html`}var Wt=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform);function useSidebarToggle(e){let t=i(null),r=J(),a=n(()=>{let n=Date.now();Ie(t.current,n)||(t.current=n,e())},[e]);return l(()=>{if(!r)return;let onKey=e=>{Fe(e,Wt)&&(e.preventDefault(),a())};return window.addEventListener(`keydown`,onKey),()=>window.removeEventListener(`keydown`,onKey)},[a,r]),a}function UnreadableDiagramView({problem:e,kind:t=`diagram`,onOpenText:n,onReload:r}){return s(`main`,{class:`unreadable-diagram`,role:`alert`,children:[s(`h1`,{class:`unreadable-diagram__title`,children:u(`app.unreadable.title.${t}`)}),s(`p`,{class:`unreadable-diagram__reason`,children:g(e)}),s(`p`,{class:`unreadable-diagram__note`,children:u(`app.unreadable.note.${t}`)}),s(`div`,{class:`unreadable-diagram__actions`,children:[s(`button`,{type:`button`,class:`ui-button ui-button--primary`,onClick:n,children:u(`app.unreadable.open.${t}`)}),s(`button`,{type:`button`,class:`ui-button`,onClick:r,children:u(`app.common.reload`)})]})]})}function bindSaveQueue({save:e,onFailure:t}){let n=null,r=!1,flush=()=>{if(r||n===null)return;let i=n;n=null,r=!0;let a;try{a=e(i)}catch(e){a=Promise.reject(e)}Promise.resolve(a).catch(e=>{try{t?.(e)}catch{}}).finally(()=>{r=!1,flush()})};return{edited:e=>{n=e,flush()},reloaded:e=>{r&&(n=e,flush())}}}function toolbarLayout(e,t={}){let n=Array.isArray(e)?e.filter(Boolean):[],inSlot=e=>n.filter(t=>t?.slot===e),r=inSlot(`view`),i=inSlot(`lead`),a=inSlot(`start`),o=inSlot(`end`);return t?.overflow===`right`?[...r,...i,...a,{type:`spacer`},{type:`overflow`},...o]:[...i,...i.length>0?[{type:`separator`}]:[],...r,...a,{type:`overflow`},{type:`spacer`},...o]}async function drawLight(e){if(typeof document>`u`||!document.body)return``;let t=document.createElement(`div`);t.style.cssText=`position:fixed;left:-10000px;top:0;width:1200px;height:800px`,document.body.appendChild(t);let n=new ue({container:t,textRenderer:B,bpmnRenderer:z.light});try{return await n.importXML(e),(await n.saveSVG().catch(()=>({svg:``})))?.svg??``}catch{return``}finally{try{n.destroy()}catch{}t.remove()}}async function pageOf(e,t,n){let r=shareFileName(n,`diagram`).replace(/\.html$/,``);return e===`bpmn`?shareBpmn(t,await drawLight(t),r):e===`dmn`?shareDmn(t,r):shareForm(t,r)}async function shareToFile(e,t,n){try{let r=D(),i=await pageOf(e,t,n),a=await r.chooseFile(`html`,{title:u(`app.share.shareAsHtml`),description:u(`app.share.oneFileThatOpensOffline`),mode:`save`,defaultFileName:shareFileName(n,`diagram`)});if(!a)return;await r.saveFile(a,i),j.success(u(`app.share.savedItOpensOfflineIn`,{target:a}))}catch(e){try{j.error(u(`app.share.couldNotShareThisDiagram`,{failure:e instanceof Error?e.message:String(e)}))}catch{}}}var Q={trialDays:30,currency:`USD`,pro:{monthly:9,yearly:90},team:{monthly:29,yearly:290}};function money(e){return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:Q.currency,maximumFractionDigits:0}).format(e)}function priceLine(e){return e(`app.nudges.price`,{monthly:money(Q.pro.monthly),yearly:money(Q.pro.yearly)})}var Gt=Q.trialDays,Kt=[`autoLayout`,`flowAnalysis`,`migration`,`codeLinks`,`conventions`,`testRuns`,`aiChat`,`variableChecks`],qt=3;function namedTools(e){return Kt.slice(0,qt).map(t=>e(`app.vscode.licence.feature.${t}.title`)).join(`, `)}function trialSentence(e,t){return e.trial===`running`?t(`app.nudges.freeNotice.trialRunning`,{days:Gt}):e.trial===`ended`?t(`app.nudges.freeNotice.trialEnded`):``}function copyOf(e,t){let n=namedTools(t),r=priceLine(t);switch(e.id){case`trialEnded`:return{text:t(`app.nudges.trialEnded.text`,{features:n,price:r}),action:t(`app.nudges.trialEnded.start`),secondary:t(`app.nudges.trialEnded.later`)};case`trialLastDay`:return{text:t(`app.nudges.lastDay.text`,{price:r}),action:t(`app.nudges.lastDay.start`)};case`trialDay23`:return{text:t(`app.nudges.day23.text`,{count:e.daysLeft??0,features:n}),action:t(`app.nudges.day23.action`)};case`freeNotice`:return{text:t(`app.nudges.freeNotice.text`,{features:n,trial:trialSentence(e,t)}).trim(),action:t(`app.nudges.freeNotice.action`)}}}var Jt=864e5,Yt=1,Xt=7;function dayOf(e){let t=String(e.getMonth()+1).padStart(2,`0`),n=String(e.getDate()).padStart(2,`0`);return`${e.getFullYear()}-${t}-${n}`}function trialOf(e,t){let n=typeof e.trialEndsAt==`string`?Date.parse(e.trialEndsAt):NaN;return Number.isNaN(n)?{state:`none`,daysLeft:null}:e.tier===`FREE`?n<=t.getTime()?{state:`ended`,daysLeft:null}:{state:`none`,daysLeft:null}:e.tier===`PRO`&&e.trialDaysLeft!=null&&n>t.getTime()?{state:`running`,daysLeft:Math.ceil((n-t.getTime())/Jt)}:{state:`none`,daysLeft:null}}function due(e,t,n){if(t.dismissed?.includes(e))return!1;let r=t.snoozedUntil?.[e];return r?n>=r:!t.shown?.[e]}function pickNudge({licence:e,record:t,sessionShown:n,now:r}){if(!e||n||t?.off===!0||e.tier!==`FREE`&&trialOf(e,r).state!==`running`)return null;let i=t??{},a=dayOf(r),{state:o,daysLeft:s}=trialOf(e,r);if(o===`ended`&&due(`trialEnded`,i,a))return{id:`trialEnded`,reason:`TRIAL_ENDED`,trial:o,daysLeft:s};if(o===`running`&&s!==null){if(s<=Yt&&due(`trialLastDay`,i,a))return{id:`trialLastDay`,reason:`TRIAL_LAST_DAY`,trial:o,daysLeft:s};if(s>Yt&&s<=Xt&&due(`trialDay23`,i,a))return{id:`trialDay23`,reason:`TRIAL_ENDING`,trial:o,daysLeft:s}}return i.existingUser===!0&&due(`freeNotice`,i,a)?{id:`freeNotice`,reason:`FREE_NOTICE`,trial:o,daysLeft:s}:null}var Zt=3;function shown(e,t,n){let r={...e??{},shown:{...e?.shown??{},[t]:n}},i=Object.fromEntries(Object.entries(e?.snoozedUntil??{}).filter(([e])=>e!==t));return Object.keys(i).length>0?r.snoozedUntil=i:delete r.snoozedUntil,r}function dismissed(e,t){let n=e?.dismissed??[];return{...e??{},dismissed:n.includes(t)?[...n]:[...n,t]}}function remindLater(e,t,n){let r=new Date(n.getFullYear(),n.getMonth(),n.getDate()+Zt);return{...e??{},snoozedUntil:{...e?.snoozedUntil??{},[t]:dayOf(r)}}}var $=!1;async function attempt(e){try{return await e()}catch{return null}}async function recordOf(){let e=D(),[t,n]=await Promise.all([attempt(()=>e.getLicense()),attempt(()=>e.getPreferences())]);return{licence:t,record:n}}async function currentRecord(){let e=D();return(await attempt(()=>e.getPreferences()))?.nudges}async function openLicence(e){let t=D();try{t.showLicenceOffer?await t.showLicenceOffer(e.reason,`banner:${e.id}`):await t.showLicence?.()}catch(e){console.error(`Failed to open the licence screen:`,e)}}function useNudge({ready:e,suspended:n}){let[r,a]=t(null),o=i(!0);if(l(()=>(o.current=!0,()=>{o.current=!1}),[]),l(()=>{if(!e||n||$)return;let t=!0;return(async()=>{try{let{licence:e,record:n}=await recordOf();if(!t||$)return;let r=new Date,i=pickNudge({licence:e,record:n?.nudges,sessionShown:$,now:r});if(!i)return;$=!0,K({nudges:shown(n?.nudges,i.id,dayOf(r))}),o.current&&a({nudge:i,copy:copyOf(i,u)})}catch(e){console.error(`Failed to choose a banner:`,e)}})(),()=>{t=!1}},[e,n]),!r)return null;let{nudge:s,copy:c}=r,close=()=>a(null),change=async e=>{K({nudges:e(await currentRecord())})};return{text:c.text,action:{label:c.action,run:()=>{close(),change(e=>dismissed(e,s.id)),openLicence(s)}},secondary:c.secondary?{label:c.secondary,run:()=>{close(),change(e=>remindLater(e,s.id,new Date))}}:void 0,dismiss:()=>{close(),change(e=>dismissed(e,s.id))}}}function revealers(e){let t=e.registerRevealer;return t?t.bind(e):void 0}function documentBridge(e,t){let n=Object.create(e);return Object.assign(n,{getBpmnFilePath:()=>t.path,getBpmnXml:()=>t.initialText,saveBpmnXml:async e=>t.edit(e),onDocumentChanged:e=>t.onReload(e),onRevealElement:n=>revealers(e)?.(t.path,n)??(()=>{}),openScriptFile:(n,r,i,a,o,s=t.path)=>e.openScriptFile(n,r,i,a,o,s)}),n}export{NavRow as _,bindSaveQueue as a,EditorShell as c,useDeploy as d,hostIsMac as f,useSidebar as g,createPanelHost as h,toolbarLayout as i,problemTally as l,PanelHost as m,useNudge as n,UnreadableDiagramView as o,SeverityIcon as p,shareToFile as r,useSidebarToggle as s,documentBridge as t,deployState as u,resolveActions as v};
@@ -1 +1 @@
1
- import"./rolldown-runtime-B8BYMn-z.js";import{i as e}from"./translator-CS9eR0My.js";import{a as t,c as n,n as r,r as i,s as a,t as o,u as s}from"./files-Chpd_QD0.js";var c=3e4,l=3e4,u=30,d=6e4;function isDirty(e){return!!e&&e.phase===`ready`&&e.current!==e.baseline}function messageOf(t){return t instanceof Error&&t.message?t.message:typeof t==`string`&&t?t:e(`app.web.unknownFailure`)}function timed(e,t,n){return new Promise((r,i)=>{let a=setTimeout(()=>i(Error(n)),t);e.then(e=>{clearTimeout(a),r(e)},e=>{clearTimeout(a),i(e)})})}function denied(e){return e?.response?.status===401}function missing(e){return e?.response?.status===404||/\b404\b|not found|no such file|does not exist/i.test(messageOf(e))}function refusedAsChanged(e){return e?.response?.status===409}var DocumentStore=class{host;notify;readTimeout;writeTimeout;listeners=new Set;reloads=new Map;writers=new Map;opening=new Map;drafts;secondMs;timers=new Map;attempts=new Map;autosaveSeconds=null;state={docs:new Map,order:[],active:null,listing:o,connection:`ok`,listed:!1,recent:[]};polling=null;constructor(e){this.host=e.host,this.notify=e.notify??(()=>void 0),this.readTimeout=e.readTimeoutMs??c,this.writeTimeout=e.writeTimeoutMs??l,this.drafts=e.drafts??null,this.secondMs=e.secondMs??1e3}snapshot(){return this.state}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}subscribeReload(e,t){let n=this.reloads.get(e);return n||(n=new Set,this.reloads.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&this.reloads.delete(e)}}doc(e){return this.state.docs.get(e)}readOnly(t){return timed(this.host.read(t),this.readTimeout,e(`app.web.serverTimeout`))}dirtyPaths(){return this.state.order.filter(e=>isDirty(this.state.docs.get(e)))}commit(e){this.state={...this.state,...e},[...this.listeners].forEach(e=>{try{e()}catch(e){console.error(`A store listener failed:`,e)}})}patch(e,t){let n=this.state.docs.get(e);if(!n)return;let r={...n,...t},i=new Map(this.state.docs);return i.set(e,r),this.commit({docs:i}),r}async refresh(){if(this.polling)return this.polling;let t=(async()=>{let t;try{t=n(await timed(this.host.list(),this.readTimeout,e(`app.web.serverTimeout`)))}catch(e){let t=denied(e)?`denied`:`lost`;this.state.connection!==t&&this.commit({connection:t}),console.warn(`The project could not be listed:`,e);return}let r=this.state.connection===`lost`,i=t.signature!==this.state.listing.signature||!this.state.listed;(i||r)&&this.commit({listing:t,listed:!0,connection:`ok`}),(i||r)&&await this.reconcile(t)})();return this.polling=t.finally(()=>{this.polling=null}),this.polling}async reconcile(n){let r=new Map(n.files.map(e=>[e.path,e]));for(let n of[...this.state.order]){let a=this.state.docs.get(n);if(!a||a.phase!==`ready`||t(a.kind))continue;let o=r.get(i(n));o?(a.disk===`deleted`&&this.patch(n,{disk:`in-sync`,stamp:null}),this.state.docs.get(n).stamp!==o.stamp&&await this.compareWithDisk(n,o.stamp)):a.disk!==`deleted`&&(this.patch(n,{disk:`deleted`,diskText:null}),this.notify(e(`app.web.deletedOnDisk`,{name:a.name}),!0))}}async compareWithDisk(t,n){let r;try{r=await timed(this.host.read(t),this.readTimeout,e(`app.web.serverTimeout`))}catch(e){missing(e)&&this.patch(t,{disk:`deleted`,diskText:null});return}let i=this.state.docs.get(t);i&&i.phase===`ready`&&(r===i.onDisk||r===i.baseline?this.patch(t,{stamp:n,disk:`in-sync`,diskText:null}):r===i.current?(this.patch(t,{stamp:n,baseline:r,onDisk:r,disk:`in-sync`,diskText:null}),this.syncDraft(t)):isDirty(i)||this.writers.get(t)?.running?(this.patch(t,{stamp:n,disk:`changed`,diskText:r}),this.notify(e(`app.web.changedOnDisk`,{name:i.name}),!0)):(this.adopt(t,r,n),this.notify(e(`app.web.reloadedFromDisk`,{name:i.name}))))}adopt(e,t,n){this.patch(e,{baseline:t,onDisk:t,current:t,stamp:n,disk:`in-sync`,diskText:null,saveError:null,revision:(this.state.docs.get(e)?.revision??0)+1}),this.syncDraft(e),this.reloads.get(e)?.forEach(e=>{try{e(t)}catch(e){console.error(`A document listener failed:`,e)}})}reloadFromDisk(e){let t=this.state.docs.get(e);if(!t||t.diskText===null)return;let n=this.entryOf(e);this.adopt(e,t.diskText,n?.stamp??t.stamp)}keepMine(e){let t=this.state.docs.get(e);if(!t)return;let n=this.state.listing.files.find(t=>t.path===e);this.patch(e,{disk:`in-sync`,baseline:t.diskText??t.baseline,onDisk:t.diskText??t.onDisk,diskText:null,stamp:n?.stamp??t.stamp}),this.syncDraft(e),this.scheduleAutosave(e)}async reload(t){try{let n=await timed(this.host.read(t),this.readTimeout,e(`app.web.serverTimeout`)),r=this.entryOf(t);return this.adopt(t,n,r?.stamp??null),!0}catch(n){return this.notify(e(`app.web.reloadFailed`,{name:r(t),reason:messageOf(n)}),!0),!1}}entryOf(e){let t=i(e);return this.state.listing.files.find(e=>e.path===t)}open(e,t,n){let o=this.state.docs.get(e);if(o)return this.activate(e),o.phase===`failed`?this.load(e):Promise.resolve();let c=t??a(e)??`template`,l=this.entryOf(e),u={path:e,rel:l?.rel??s(this.state.listing.root,i(e)),name:n??r(i(e)),kind:c,phase:`loading`,loadError:null,baseline:``,onDisk:``,current:``,stamp:l?.stamp??null,saving:!1,saveError:null,disk:`in-sync`,diskText:null,revision:0},d=new Map(this.state.docs);return d.set(e,u),this.commit({docs:d,order:[...this.state.order,e],active:e,recent:this.remembered(e)}),this.load(e)}load(t){let n=this.opening.get(t);if(n)return n;this.patch(t,{phase:`loading`,loadError:null});let r=(async()=>{try{let n=await timed(this.host.read(t),this.readTimeout,e(`app.web.serverTimeout`));if(!this.state.docs.has(t))return;let r=this.entryOf(t);this.patch(t,{phase:`ready`,baseline:n,onDisk:n,current:n,stamp:r?.stamp??this.state.docs.get(t)?.stamp??null,loadError:null})}catch(n){if(!this.state.docs.has(t))return;let r=missing(n)?e(`app.web.fileNotFound`):messageOf(n);this.patch(t,{phase:`failed`,loadError:r})}})().finally(()=>{this.opening.delete(t)});return this.opening.set(t,r),r}remembered(e){let t=this.state.docs.get(e)?.rel??this.state.listing.files.find(t=>t.path===e)?.rel??s(this.state.listing.root,e);return[t,...this.state.recent.filter(e=>e!==t)].slice(0,u)}activate(e){this.state.active!==e&&this.state.docs.has(e)&&this.commit({active:e,recent:this.remembered(e)})}setRecent(e){this.commit({recent:e.slice(0,u)})}move(e,t){let n=this.state.order.indexOf(e);if(n<0)return;let r=Math.max(0,Math.min(t,this.state.order.length-1));if(r===n)return;let i=[...this.state.order];i.splice(n,1),i.splice(r,0,e),this.commit({order:i})}close(e){if(!this.state.docs.has(e))return;let t=new Map(this.state.docs);t.delete(e);let n=this.state.order.indexOf(e),r=this.state.order.filter(t=>t!==e),i=this.state.active;i===e&&(i=r[Math.min(n,r.length-1)]??null),this.reloads.delete(e),this.writers.delete(e),this.opening.delete(e),this.forgetTimers(e),this.drafts?.drop(this.state.listing.root,e),this.commit({docs:t,order:r,active:i})}edit(e,t){let n=this.state.docs.get(e);n&&n.phase===`ready`&&n.current!==t&&(this.patch(e,{current:t,saveError:null}),this.syncDraft(e),this.scheduleAutosave(e))}syncDraft(e){let t=this.state.docs.get(e);if(!this.drafts||!t||t.phase!==`ready`)return;let n=this.state.listing.root;isDirty(t)?this.drafts.keep(n,{path:e,rel:t.rel,text:t.current,baseline:t.onDisk,stamp:t.stamp}):this.drafts.drop(n,e)}applyDraft(e,t){let n=this.state.docs.get(e);if(!n||n.phase!==`ready`||n.current===t.text)return!1;let r=n.onDisk!==t.baseline;return this.patch(e,{current:t.text,saveError:null,disk:r?`changed`:n.disk,diskText:r?n.onDisk:n.diskText,revision:n.revision+1}),this.reloads.get(e)?.forEach(e=>{try{e(t.text)}catch(e){console.error(`A document listener failed:`,e)}}),this.syncDraft(e),!0}adoptMissing(e,t,n){if(this.state.docs.has(e))return;let i={path:e,rel:s(this.state.listing.root,e),name:r(e),kind:t,phase:`ready`,loadError:null,baseline:n.baseline,onDisk:n.baseline,current:n.text,stamp:null,saving:!1,saveError:null,disk:`deleted`,diskText:null,revision:0},a=new Map(this.state.docs);a.set(e,i),this.commit({docs:a,order:[...this.state.order,e],active:e,recent:this.remembered(e)}),this.syncDraft(e)}setAutosave(e){this.autosaveSeconds=e!==null&&e>0?e:null;for(let e of[...this.timers.keys()])this.forgetTimers(e);if(this.autosaveSeconds!==null)for(let e of this.dirtyPaths())this.scheduleAutosave(e)}forgetTimers(e){let t=this.timers.get(e);t&&clearTimeout(t),this.timers.delete(e),this.attempts.delete(e)}scheduleAutosave(e,t){let n=this.timers.get(e);if(n&&clearTimeout(n),this.timers.delete(e),this.autosaveSeconds===null||!isDirty(this.state.docs.get(e)))return;let r=t??this.autosaveSeconds*this.secondMs,i=setTimeout(()=>{this.timers.delete(e),this.autosave(e)},r);this.timers.set(e,i)}async autosave(e){let t=this.state.docs.get(e);if(this.autosaveSeconds===null||!t||t.phase!==`ready`||!isDirty(t)||t.disk!==`in-sync`)return;let n=this.state.connection!==`ok`||!await this.save(e),r=this.state.docs.get(e);if(!r||!isDirty(r))this.attempts.delete(e);else if(r.disk===`in-sync`){if(n||r.saveError){let t=(this.attempts.get(e)??0)+1;this.attempts.set(e,t),this.scheduleAutosave(e,Math.min(this.autosaveSeconds*this.secondMs*2**Math.min(t,6),d))}else this.scheduleAutosave(e)}}save(e){let t=this.state.docs.get(e);if(!t||t.phase!==`ready`)return Promise.resolve(!1);let n=this.writers.get(e);if(n||(n={running:null,again:!1},this.writers.set(e,n)),n.running)return n.again=!0,n.running.then(()=>!isDirty(this.state.docs.get(e)));let r=n;return r.running=this.drain(e,r).finally(()=>{r.running=null}),r.running.then(()=>this.state.docs.has(e)&&!isDirty(this.state.docs.get(e)))}async drain(t,n){do{n.again=!1;let r=this.state.docs.get(t);if(!r||r.phase!==`ready`||r.current===r.baseline&&r.disk!==`deleted`||r.disk===`changed`||r.disk===`in-sync`&&!await this.unchangedOnDisk(t))return;let i=this.state.docs.get(t);if(!i||i.phase!==`ready`)return;let a=i.current;if(a===i.baseline&&i.disk!==`deleted`)return;this.patch(t,{saving:!0,saveError:null});let o;try{o=await timed(this.host.write(t,a,i.kind,i.disk===`deleted`?null:i.stamp),this.writeTimeout,e(`app.web.serverTimeout`))}catch(n){if(refusedAsChanged(n)){await this.refused(t);return}let i=messageOf(n);this.patch(t,{saving:!1,saveError:i}),this.notify(e(`app.web.saveFailed`,{name:r.name,reason:i}),!0);return}if(!this.state.docs.has(t))return;this.patch(t,{saving:!1,baseline:a,onDisk:o.stored,saveError:null,disk:`in-sync`,diskText:null,stamp:o.stamp}),this.syncDraft(t)}while(n.again);this.refresh()}async refused(e){this.patch(e,{saving:!1,disk:`changed`}),await this.refresh()}async unchangedOnDisk(e){await this.refresh();let t=this.state.docs.get(e);return!!t&&t.phase===`ready`&&t.disk!==`changed`}async saveAll(){return(await Promise.all(this.dirtyPaths().map(e=>this.save(e)))).every(Boolean)}async create(e,t){let n=this.state.listing.root;return await this.host.create(n,[{path:e,content:t}]),await this.refresh(),this.state.listing.files.find(t=>t.rel===e)?.path??``}};export{isDirty as n,DocumentStore as t};
1
+ import"./rolldown-runtime-B8BYMn-z.js";import{i as e}from"./translator-B2N3PQBL.js";import{a as t,c as n,n as r,r as i,s as a,t as o,u as s}from"./files-Chpd_QD0.js";var c=3e4,l=3e4,u=30,d=6e4;function isDirty(e){return!!e&&e.phase===`ready`&&e.current!==e.baseline}function messageOf(t){return t instanceof Error&&t.message?t.message:typeof t==`string`&&t?t:e(`app.web.unknownFailure`)}function timed(e,t,n){return new Promise((r,i)=>{let a=setTimeout(()=>i(Error(n)),t);e.then(e=>{clearTimeout(a),r(e)},e=>{clearTimeout(a),i(e)})})}function denied(e){return e?.response?.status===401}function missing(e){return e?.response?.status===404||/\b404\b|not found|no such file|does not exist/i.test(messageOf(e))}function refusedAsChanged(e){return e?.response?.status===409}var DocumentStore=class{host;notify;readTimeout;writeTimeout;listeners=new Set;reloads=new Map;writers=new Map;opening=new Map;drafts;secondMs;timers=new Map;attempts=new Map;autosaveSeconds=null;state={docs:new Map,order:[],active:null,listing:o,connection:`ok`,listed:!1,recent:[]};polling=null;constructor(e){this.host=e.host,this.notify=e.notify??(()=>void 0),this.readTimeout=e.readTimeoutMs??c,this.writeTimeout=e.writeTimeoutMs??l,this.drafts=e.drafts??null,this.secondMs=e.secondMs??1e3}snapshot(){return this.state}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}subscribeReload(e,t){let n=this.reloads.get(e);return n||(n=new Set,this.reloads.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&this.reloads.delete(e)}}doc(e){return this.state.docs.get(e)}readOnly(t){return timed(this.host.read(t),this.readTimeout,e(`app.web.serverTimeout`))}dirtyPaths(){return this.state.order.filter(e=>isDirty(this.state.docs.get(e)))}commit(e){this.state={...this.state,...e},[...this.listeners].forEach(e=>{try{e()}catch(e){console.error(`A store listener failed:`,e)}})}patch(e,t){let n=this.state.docs.get(e);if(!n)return;let r={...n,...t},i=new Map(this.state.docs);return i.set(e,r),this.commit({docs:i}),r}async refresh(){if(this.polling)return this.polling;let t=(async()=>{let t;try{t=n(await timed(this.host.list(),this.readTimeout,e(`app.web.serverTimeout`)))}catch(e){let t=denied(e)?`denied`:`lost`;this.state.connection!==t&&this.commit({connection:t}),console.warn(`The project could not be listed:`,e);return}let r=this.state.connection===`lost`,i=t.signature!==this.state.listing.signature||!this.state.listed;(i||r)&&this.commit({listing:t,listed:!0,connection:`ok`}),(i||r)&&await this.reconcile(t)})();return this.polling=t.finally(()=>{this.polling=null}),this.polling}async reconcile(n){let r=new Map(n.files.map(e=>[e.path,e]));for(let n of[...this.state.order]){let a=this.state.docs.get(n);if(!a||a.phase!==`ready`||t(a.kind))continue;let o=r.get(i(n));o?(a.disk===`deleted`&&this.patch(n,{disk:`in-sync`,stamp:null}),this.state.docs.get(n).stamp!==o.stamp&&await this.compareWithDisk(n,o.stamp)):a.disk!==`deleted`&&(this.patch(n,{disk:`deleted`,diskText:null}),this.notify(e(`app.web.deletedOnDisk`,{name:a.name}),!0))}}async compareWithDisk(t,n){let r;try{r=await timed(this.host.read(t),this.readTimeout,e(`app.web.serverTimeout`))}catch(e){missing(e)&&this.patch(t,{disk:`deleted`,diskText:null});return}let i=this.state.docs.get(t);i&&i.phase===`ready`&&(r===i.onDisk||r===i.baseline?this.patch(t,{stamp:n,disk:`in-sync`,diskText:null}):r===i.current?(this.patch(t,{stamp:n,baseline:r,onDisk:r,disk:`in-sync`,diskText:null}),this.syncDraft(t)):isDirty(i)||this.writers.get(t)?.running?(this.patch(t,{stamp:n,disk:`changed`,diskText:r}),this.notify(e(`app.web.changedOnDisk`,{name:i.name}),!0)):(this.adopt(t,r,n),this.notify(e(`app.web.reloadedFromDisk`,{name:i.name}))))}adopt(e,t,n){this.patch(e,{baseline:t,onDisk:t,current:t,stamp:n,disk:`in-sync`,diskText:null,saveError:null,revision:(this.state.docs.get(e)?.revision??0)+1}),this.syncDraft(e),this.reloads.get(e)?.forEach(e=>{try{e(t)}catch(e){console.error(`A document listener failed:`,e)}})}reloadFromDisk(e){let t=this.state.docs.get(e);if(!t||t.diskText===null)return;let n=this.entryOf(e);this.adopt(e,t.diskText,n?.stamp??t.stamp)}keepMine(e){let t=this.state.docs.get(e);if(!t)return;let n=this.state.listing.files.find(t=>t.path===e);this.patch(e,{disk:`in-sync`,baseline:t.diskText??t.baseline,onDisk:t.diskText??t.onDisk,diskText:null,stamp:n?.stamp??t.stamp}),this.syncDraft(e),this.scheduleAutosave(e)}async reload(t){try{let n=await timed(this.host.read(t),this.readTimeout,e(`app.web.serverTimeout`)),r=this.entryOf(t);return this.adopt(t,n,r?.stamp??null),!0}catch(n){return this.notify(e(`app.web.reloadFailed`,{name:r(t),reason:messageOf(n)}),!0),!1}}entryOf(e){let t=i(e);return this.state.listing.files.find(e=>e.path===t)}open(e,t,n){let o=this.state.docs.get(e);if(o)return this.activate(e),o.phase===`failed`?this.load(e):Promise.resolve();let c=t??a(e)??`template`,l=this.entryOf(e),u={path:e,rel:l?.rel??s(this.state.listing.root,i(e)),name:n??r(i(e)),kind:c,phase:`loading`,loadError:null,baseline:``,onDisk:``,current:``,stamp:l?.stamp??null,saving:!1,saveError:null,disk:`in-sync`,diskText:null,revision:0},d=new Map(this.state.docs);return d.set(e,u),this.commit({docs:d,order:[...this.state.order,e],active:e,recent:this.remembered(e)}),this.load(e)}load(t){let n=this.opening.get(t);if(n)return n;this.patch(t,{phase:`loading`,loadError:null});let r=(async()=>{try{let n=await timed(this.host.read(t),this.readTimeout,e(`app.web.serverTimeout`));if(!this.state.docs.has(t))return;let r=this.entryOf(t);this.patch(t,{phase:`ready`,baseline:n,onDisk:n,current:n,stamp:r?.stamp??this.state.docs.get(t)?.stamp??null,loadError:null})}catch(n){if(!this.state.docs.has(t))return;let r=missing(n)?e(`app.web.fileNotFound`):messageOf(n);this.patch(t,{phase:`failed`,loadError:r})}})().finally(()=>{this.opening.delete(t)});return this.opening.set(t,r),r}remembered(e){let t=this.state.docs.get(e)?.rel??this.state.listing.files.find(t=>t.path===e)?.rel??s(this.state.listing.root,e);return[t,...this.state.recent.filter(e=>e!==t)].slice(0,u)}activate(e){this.state.active!==e&&this.state.docs.has(e)&&this.commit({active:e,recent:this.remembered(e)})}setRecent(e){this.commit({recent:e.slice(0,u)})}move(e,t){let n=this.state.order.indexOf(e);if(n<0)return;let r=Math.max(0,Math.min(t,this.state.order.length-1));if(r===n)return;let i=[...this.state.order];i.splice(n,1),i.splice(r,0,e),this.commit({order:i})}close(e){if(!this.state.docs.has(e))return;let t=new Map(this.state.docs);t.delete(e);let n=this.state.order.indexOf(e),r=this.state.order.filter(t=>t!==e),i=this.state.active;i===e&&(i=r[Math.min(n,r.length-1)]??null),this.reloads.delete(e),this.writers.delete(e),this.opening.delete(e),this.forgetTimers(e),this.drafts?.drop(this.state.listing.root,e),this.commit({docs:t,order:r,active:i})}edit(e,t){let n=this.state.docs.get(e);n&&n.phase===`ready`&&n.current!==t&&(this.patch(e,{current:t,saveError:null}),this.syncDraft(e),this.scheduleAutosave(e))}syncDraft(e){let t=this.state.docs.get(e);if(!this.drafts||!t||t.phase!==`ready`)return;let n=this.state.listing.root;isDirty(t)?this.drafts.keep(n,{path:e,rel:t.rel,text:t.current,baseline:t.onDisk,stamp:t.stamp}):this.drafts.drop(n,e)}applyDraft(e,t){let n=this.state.docs.get(e);if(!n||n.phase!==`ready`||n.current===t.text)return!1;let r=n.onDisk!==t.baseline;return this.patch(e,{current:t.text,saveError:null,disk:r?`changed`:n.disk,diskText:r?n.onDisk:n.diskText,revision:n.revision+1}),this.reloads.get(e)?.forEach(e=>{try{e(t.text)}catch(e){console.error(`A document listener failed:`,e)}}),this.syncDraft(e),!0}adoptMissing(e,t,n){if(this.state.docs.has(e))return;let i={path:e,rel:s(this.state.listing.root,e),name:r(e),kind:t,phase:`ready`,loadError:null,baseline:n.baseline,onDisk:n.baseline,current:n.text,stamp:null,saving:!1,saveError:null,disk:`deleted`,diskText:null,revision:0},a=new Map(this.state.docs);a.set(e,i),this.commit({docs:a,order:[...this.state.order,e],active:e,recent:this.remembered(e)}),this.syncDraft(e)}setAutosave(e){this.autosaveSeconds=e!==null&&e>0?e:null;for(let e of[...this.timers.keys()])this.forgetTimers(e);if(this.autosaveSeconds!==null)for(let e of this.dirtyPaths())this.scheduleAutosave(e)}forgetTimers(e){let t=this.timers.get(e);t&&clearTimeout(t),this.timers.delete(e),this.attempts.delete(e)}scheduleAutosave(e,t){let n=this.timers.get(e);if(n&&clearTimeout(n),this.timers.delete(e),this.autosaveSeconds===null||!isDirty(this.state.docs.get(e)))return;let r=t??this.autosaveSeconds*this.secondMs,i=setTimeout(()=>{this.timers.delete(e),this.autosave(e)},r);this.timers.set(e,i)}async autosave(e){let t=this.state.docs.get(e);if(this.autosaveSeconds===null||!t||t.phase!==`ready`||!isDirty(t)||t.disk!==`in-sync`)return;let n=this.state.connection!==`ok`||!await this.save(e),r=this.state.docs.get(e);if(!r||!isDirty(r))this.attempts.delete(e);else if(r.disk===`in-sync`){if(n||r.saveError){let t=(this.attempts.get(e)??0)+1;this.attempts.set(e,t),this.scheduleAutosave(e,Math.min(this.autosaveSeconds*this.secondMs*2**Math.min(t,6),d))}else this.scheduleAutosave(e)}}save(e){let t=this.state.docs.get(e);if(!t||t.phase!==`ready`)return Promise.resolve(!1);let n=this.writers.get(e);if(n||(n={running:null,again:!1},this.writers.set(e,n)),n.running)return n.again=!0,n.running.then(()=>!isDirty(this.state.docs.get(e)));let r=n;return r.running=this.drain(e,r).finally(()=>{r.running=null}),r.running.then(()=>this.state.docs.has(e)&&!isDirty(this.state.docs.get(e)))}async drain(t,n){do{n.again=!1;let r=this.state.docs.get(t);if(!r||r.phase!==`ready`||r.current===r.baseline&&r.disk!==`deleted`||r.disk===`changed`||r.disk===`in-sync`&&!await this.unchangedOnDisk(t))return;let i=this.state.docs.get(t);if(!i||i.phase!==`ready`)return;let a=i.current;if(a===i.baseline&&i.disk!==`deleted`)return;this.patch(t,{saving:!0,saveError:null});let o;try{o=await timed(this.host.write(t,a,i.kind,i.disk===`deleted`?null:i.stamp),this.writeTimeout,e(`app.web.serverTimeout`))}catch(n){if(refusedAsChanged(n)){await this.refused(t);return}let i=messageOf(n);this.patch(t,{saving:!1,saveError:i}),this.notify(e(`app.web.saveFailed`,{name:r.name,reason:i}),!0);return}if(!this.state.docs.has(t))return;this.patch(t,{saving:!1,baseline:a,onDisk:o.stored,saveError:null,disk:`in-sync`,diskText:null,stamp:o.stamp}),this.syncDraft(t)}while(n.again);this.refresh()}async refused(e){this.patch(e,{saving:!1,disk:`changed`}),await this.refresh()}async unchangedOnDisk(e){await this.refresh();let t=this.state.docs.get(e);return!!t&&t.phase===`ready`&&t.disk!==`changed`}async saveAll(){return(await Promise.all(this.dirtyPaths().map(e=>this.save(e)))).every(Boolean)}async create(e,t){let n=this.state.listing.root;return await this.host.create(n,[{path:e,content:t}]),await this.refresh(),this.state.listing.files.find(t=>t.rel===e)?.path??``}};export{isDirty as n,DocumentStore as t};
@@ -1,4 +1,4 @@
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-CS9eR0My.js";import{A as U,D as G,I as K,L as q,M as ee,N as te,O as ne,T as J,_ as re,a as ie,b as ae,d as oe,f as se,g as ce,h as le,j as ue,k as de,l as fe,m as pe,n as me,o as he,r as ge,s as _e,t as ve,u as Q,v as ye,w as be,x as xe,y as Se}from"./dist-CRJyslwo.js";import{t as Ce}from"./typing-CXvbBSPr.js";import{S as we,v as Te,y as Ee}from"./bpmnTheme-Divwrkjy.js";import{r as De}from"./lib-DJ1i09sd.js";import{$ as Oe,$t as ke,At as Ae,Bt as je,Ct as Me,Dt as Ne,Et as Pe,Ft as Fe,Jt as Ie,Kt as Le,Lt as Re,Mt as ze,Ot as Be,Q as Ve,Qt as He,Rt as Ue,S as We,St as Ge,Tt as Ke,Vt as qe,Wt as Je,Xt as Ye,Yt as Xe,Z as Ze,Zt as Qe,_ as $e,_t as et,a as tt,at as nt,b as rt,bt as it,c as at,ct as ot,d as st,dt as ct,en as lt,et as ut,ft as dt,g as ft,gt as pt,ht as mt,i as ht,in as gt,kt as _t,l as vt,lt as yt,mt as bt,nn as xt,o as St,ot as Ct,pt as wt,r as Tt,rn as Et,rt as Dt,s as Ot,st as kt,tn as At,u as jt,ut as Mt,v as Nt,vt as Pt,wt as Ft,x as It,xt as Lt,zt as Rt}from"./Viewer-CZiVl0t6.js";import{$ as zt,H as Bt,I as Vt,M as Ht,Q as Ut,X as Wt,f as Gt,g as Kt,ht as qt,l as Jt,lt as Yt,tt as Xt,v as Zt}from"./dist-CsBP6QjA.js";import{a as Qt,i as $t}from"./dist-DvFyMwGd.js";import{i as en,n as rn,t as an}from"./dist-Gx7P7Pk_.js";import{n as on,r as cn}from"./dist-sl8LIbwu.js";import{r as ln}from"./dist-DUkRqvKl.js";pe();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{}}}}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=le(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))}pe();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,ke.bind(e,`keydown`,this._keydownHandler),ke.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`),ke.unbind(e,`keydown`,this._keydownHandler),ke.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){re(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]};pe();var Fn={moveSpeed:50,moveSpeedAccelerated:200};function KeyboardMove(e,n,a){var c=this;this._config=ve({},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=Xe(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=st(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){ke.unbind(document,`mousemove`,handleMove),ke.unbind(document,`mouseup`,handleEnd),a=null,unset()}function handleStart(e){if(!Qe(e.target,`.djs-draggable`)){var n=e.button;if(!(n>=2||e.ctrlKey||e.shiftKey||e.altKey))return a={button:n,start:st(e)},ke.bind(document,`mousemove`,handleMove),ke.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))}pe();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=me(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||at()&&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&&ke[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]};pe();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=te(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=te(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=he(e,function(e){return!(e.waypoints||e.host||e.labelTarget)});if(c=this._rules.allowed(`elements.align`,{elements:m}),le(c)&&(m=c),!(m.length<2||!c)){var v=qn[n],T=te(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]};pe();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=le(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;(le(c.target)?c.target:[c.target]).includes(a)&&e._updateVisibility()}}),this._container=this._createContainer()},ContextPad.prototype._createContainer=function(){var e=Et(`<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=le(e)?`getMultiElementContextPadEntries`:`getContextPadEntries`,c={};return Q(n,function(n){if(re(n[a])){var m=n[a](e);re(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(re(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=Et(e.html||`<div class="entry" draggable="true"></div>`),T;Ie(v,`data-action`,n),T=At(`[data-group=`+ft(m)+`]`,a),T||(T=Et(`<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=Et(`<img>`),Ie(c,`src`,e.imageUrl),c.style.width=`100%`,c.style.height=`100%`,v.appendChild(c))}),Xe(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=Et(`<div class="djs-context-pad"></div>`);return He.bind(a,Qn,`click`,function(e){n.trigger(`click`,e)}),He.bind(a,Qn,`dragstart`,function(e){n.trigger(`dragstart`,e)}),He.bind(a,Qn,`mouseover`,function(e){n.trigger(`mouseover`,e)}),He.bind(a,Qn,`mouseout`,function(e){n.trigger(`mouseout`,e)}),ke.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 le(e)===le(a)?le(e)?e.length===a.length&&ie(e,function(e){return a.includes(e)}):a===e:!1},ContextPad.prototype.isShown=function(){return this.isOpen()&&Xe(this._current.html).has(`open`)},ContextPad.prototype.show=function(){this.isOpen()&&(Xe(this._current.html).add(`open`),this._updatePosition(),this._eventBus.fire(`contextPad.show`,{current:this._current}))},ContextPad.prototype.hide=function(){this.isOpen()&&(Xe(this._current.html).remove(`open`),this._eventBus.fire(`contextPad.hide`,{current:this._current}))},ContextPad.prototype._getPosition=function(e){if(!le(e)&&wt(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;(le(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(le(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=Xe(e);n=le(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=le(e)?e:[e],n=le(n)?n:[n],e.length===n.length&&ie(e,function(e){return n.includes(e)})}var nr={__depends__:[ht,Xn,rt],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===`
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-B2N3PQBL.js";import{A as U,D as G,I as K,L as q,M as ee,N as te,O as ne,T as J,_ as re,a as ie,b as ae,d as oe,f as se,g as ce,h as le,j as ue,k as de,l as fe,m as pe,n as me,o as he,r as ge,s as _e,t as ve,u as Q,v as ye,w as be,x as xe,y as Se}from"./dist-CRJyslwo.js";import{t as Ce}from"./typing-CXvbBSPr.js";import{S as we,v as Te,y as Ee}from"./bpmnTheme-cOvp4qFc.js";import{r as De}from"./lib-DAKOOgix.js";import{$ as Oe,$t as ke,At as Ae,Bt as je,Ct as Me,Dt as Ne,Et as Pe,Ft as Fe,Jt as Ie,Kt as Le,Lt as Re,Mt as ze,Ot as Be,Q as Ve,Qt as He,Rt as Ue,S as We,St as Ge,Tt as Ke,Vt as qe,Wt as Je,Xt as Ye,Yt as Xe,Z as Ze,Zt as Qe,_ as $e,_t as et,a as tt,at as nt,b as rt,bt as it,c as at,ct as ot,d as st,dt as ct,en as lt,et as ut,ft as dt,g as ft,gt as pt,ht as mt,i as ht,in as gt,kt as _t,l as vt,lt as yt,mt as bt,nn as xt,o as St,ot as Ct,pt as wt,r as Tt,rn as Et,rt as Dt,s as Ot,st as kt,tn as At,u as jt,ut as Mt,v as Nt,vt as Pt,wt as Ft,x as It,xt as Lt,zt as Rt}from"./Viewer-CZiVl0t6.js";import{$ as zt,H as Bt,I as Vt,M as Ht,Q as Ut,X as Wt,f as Gt,g as Kt,ht as qt,l as Jt,lt as Yt,tt as Xt,v as Zt}from"./dist-CsBP6QjA.js";import{a as Qt,i as $t}from"./dist-DvFyMwGd.js";import{i as en,n as rn,t as an}from"./dist-Gx7P7Pk_.js";import{n as on,r as cn}from"./dist-sl8LIbwu.js";import{r as ln}from"./dist-DUkRqvKl.js";pe();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{}}}}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=le(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))}pe();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,ke.bind(e,`keydown`,this._keydownHandler),ke.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`),ke.unbind(e,`keydown`,this._keydownHandler),ke.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){re(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]};pe();var Fn={moveSpeed:50,moveSpeedAccelerated:200};function KeyboardMove(e,n,a){var c=this;this._config=ve({},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=Xe(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=st(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){ke.unbind(document,`mousemove`,handleMove),ke.unbind(document,`mouseup`,handleEnd),a=null,unset()}function handleStart(e){if(!Qe(e.target,`.djs-draggable`)){var n=e.button;if(!(n>=2||e.ctrlKey||e.shiftKey||e.altKey))return a={button:n,start:st(e)},ke.bind(document,`mousemove`,handleMove),ke.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))}pe();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=me(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||at()&&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&&ke[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]};pe();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=te(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=te(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=he(e,function(e){return!(e.waypoints||e.host||e.labelTarget)});if(c=this._rules.allowed(`elements.align`,{elements:m}),le(c)&&(m=c),!(m.length<2||!c)){var v=qn[n],T=te(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]};pe();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=le(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;(le(c.target)?c.target:[c.target]).includes(a)&&e._updateVisibility()}}),this._container=this._createContainer()},ContextPad.prototype._createContainer=function(){var e=Et(`<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=le(e)?`getMultiElementContextPadEntries`:`getContextPadEntries`,c={};return Q(n,function(n){if(re(n[a])){var m=n[a](e);re(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(re(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=Et(e.html||`<div class="entry" draggable="true"></div>`),T;Ie(v,`data-action`,n),T=At(`[data-group=`+ft(m)+`]`,a),T||(T=Et(`<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=Et(`<img>`),Ie(c,`src`,e.imageUrl),c.style.width=`100%`,c.style.height=`100%`,v.appendChild(c))}),Xe(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=Et(`<div class="djs-context-pad"></div>`);return He.bind(a,Qn,`click`,function(e){n.trigger(`click`,e)}),He.bind(a,Qn,`dragstart`,function(e){n.trigger(`dragstart`,e)}),He.bind(a,Qn,`mouseover`,function(e){n.trigger(`mouseover`,e)}),He.bind(a,Qn,`mouseout`,function(e){n.trigger(`mouseout`,e)}),ke.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 le(e)===le(a)?le(e)?e.length===a.length&&ie(e,function(e){return a.includes(e)}):a===e:!1},ContextPad.prototype.isShown=function(){return this.isOpen()&&Xe(this._current.html).has(`open`)},ContextPad.prototype.show=function(){this.isOpen()&&(Xe(this._current.html).add(`open`),this._updatePosition(),this._eventBus.fire(`contextPad.show`,{current:this._current}))},ContextPad.prototype.hide=function(){this.isOpen()&&(Xe(this._current.html).remove(`open`),this._eventBus.fire(`contextPad.hide`,{current:this._current}))},ContextPad.prototype._getPosition=function(e){if(!le(e)&&wt(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;(le(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(le(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=Xe(e);n=le(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=le(e)?e:[e],n=le(n)?n:[n],e.length===n.length&&ie(e,function(e){return n.includes(e)})}var nr={__depends__:[ht,Xn,rt],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
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
3
  <div class="djs-popup-breadcrumbs">
4
4
  ${m&&ar`
@@ -1,4 +1,4 @@
1
- import{i as e}from"./rolldown-runtime-B8BYMn-z.js";import{i as t}from"./translator-CS9eR0My.js";var n=30,r=1e3;function contentTypeOf(e){return/\.form$/i.test(e)?`application/json`:`application/xml`}function deploymentCall(e,t){let field=(e,t)=>({name:e,content:t}),n=[];return e.engine===`CAMUNDA_8`?e.tenantId&&n.push(field(`tenantId`,e.tenantId)):(n.push(field(`deployment-name`,e.name),field(`deployment-source`,e.source)),n.push(field(`enable-duplicate-filtering`,String(e.changedOnly)),field(`deploy-changed-only`,String(e.changedOnly))),e.tenantId&&n.push(field(`tenant-id`,e.tenantId)),e.activationTime&&n.push(field(`deployment-activation-time`,e.activationTime))),t.forEach(t=>n.push({name:e.engine===`CAMUNDA_8`?`resources`:t.name,filename:t.name,contentType:contentTypeOf(t.name),content:t.content})),{method:`POST`,path:e.engine===`CAMUNDA_8`?`/deployments`:`/deployment/create`,parts:n}}function versionNumber(e){let t=Number(e??0);return Number.isFinite(t)?t:0}function definitionsIn(e,t){try{let n=JSON.parse(t);if(e===`CAMUNDA_8`)return(n.deployments??[]).flatMap(e=>[...e.processDefinition?[{kind:`process`,id:String(e.processDefinition.processDefinitionKey??``),key:String(e.processDefinition.processDefinitionId??``),version:versionNumber(e.processDefinition.processDefinitionVersion)}]:[],...e.decisionDefinition?[{kind:`decision`,id:String(e.decisionDefinition.decisionDefinitionKey??``),key:String(e.decisionDefinition.decisionDefinitionId??``),version:versionNumber(e.decisionDefinition.version)}]:[]]);let of=(e,t)=>Object.values(n[e]??{}).map(e=>({kind:t,id:String(e?.id??``),key:String(e?.key??``),version:versionNumber(e?.version)}));return[...of(`deployedProcessDefinitions`,`process`),...of(`deployedDecisionDefinitions`,`decision`)]}catch{return[]}}function definitionCall(e,t){let n=t.kind===`decision`?`decision`:`process`;return{method:`GET`,path:e===`CAMUNDA_8`?`/${n}-definitions/${encodeURIComponent(t.id)}`:`/${n}-definition/${encodeURIComponent(t.id)}`}}function bodyOf(e){return typeof e.body==`string`?e.body:``}function failureText(e){return e instanceof Error?e.message:String(e)}function fullReasonOf(e){let t=bodyOf(e);if(e.status===0)return t;try{let e=JSON.parse(t),n=[e.message,e.detail,e.title].find(e=>typeof e==`string`);if(typeof n==`string`)return n}catch{return t}return t}function reasonOf$1(e){let t=fullReasonOf(e);return t===bodyOf(e)?t.slice(0,300):t}e(reasonOf$1,`reasonOf`);function camunda8Problems(e){let t=[],n=null,r=null;for(let i of e.split(`
1
+ import{i as e}from"./rolldown-runtime-B8BYMn-z.js";import{i as t}from"./translator-B2N3PQBL.js";var n=30,r=1e3;function contentTypeOf(e){return/\.form$/i.test(e)?`application/json`:`application/xml`}function deploymentCall(e,t){let field=(e,t)=>({name:e,content:t}),n=[];return e.engine===`CAMUNDA_8`?e.tenantId&&n.push(field(`tenantId`,e.tenantId)):(n.push(field(`deployment-name`,e.name),field(`deployment-source`,e.source)),n.push(field(`enable-duplicate-filtering`,String(e.changedOnly)),field(`deploy-changed-only`,String(e.changedOnly))),e.tenantId&&n.push(field(`tenant-id`,e.tenantId)),e.activationTime&&n.push(field(`deployment-activation-time`,e.activationTime))),t.forEach(t=>n.push({name:e.engine===`CAMUNDA_8`?`resources`:t.name,filename:t.name,contentType:contentTypeOf(t.name),content:t.content})),{method:`POST`,path:e.engine===`CAMUNDA_8`?`/deployments`:`/deployment/create`,parts:n}}function versionNumber(e){let t=Number(e??0);return Number.isFinite(t)?t:0}function definitionsIn(e,t){try{let n=JSON.parse(t);if(e===`CAMUNDA_8`)return(n.deployments??[]).flatMap(e=>[...e.processDefinition?[{kind:`process`,id:String(e.processDefinition.processDefinitionKey??``),key:String(e.processDefinition.processDefinitionId??``),version:versionNumber(e.processDefinition.processDefinitionVersion)}]:[],...e.decisionDefinition?[{kind:`decision`,id:String(e.decisionDefinition.decisionDefinitionKey??``),key:String(e.decisionDefinition.decisionDefinitionId??``),version:versionNumber(e.decisionDefinition.version)}]:[]]);let of=(e,t)=>Object.values(n[e]??{}).map(e=>({kind:t,id:String(e?.id??``),key:String(e?.key??``),version:versionNumber(e?.version)}));return[...of(`deployedProcessDefinitions`,`process`),...of(`deployedDecisionDefinitions`,`decision`)]}catch{return[]}}function definitionCall(e,t){let n=t.kind===`decision`?`decision`:`process`;return{method:`GET`,path:e===`CAMUNDA_8`?`/${n}-definitions/${encodeURIComponent(t.id)}`:`/${n}-definition/${encodeURIComponent(t.id)}`}}function bodyOf(e){return typeof e.body==`string`?e.body:``}function failureText(e){return e instanceof Error?e.message:String(e)}function fullReasonOf(e){let t=bodyOf(e);if(e.status===0)return t;try{let e=JSON.parse(t),n=[e.message,e.detail,e.title].find(e=>typeof e==`string`);if(typeof n==`string`)return n}catch{return t}return t}function reasonOf$1(e){let t=fullReasonOf(e);return t===bodyOf(e)?t.slice(0,300):t}e(reasonOf$1,`reasonOf`);function camunda8Problems(e){let t=[],n=null,r=null;for(let i of e.split(`
2
2
  `)){let e=i.trim(),a=/^'([^']+)':\s*(.*)$/.exec(e);a&&(n=a[1],r=null,e=a[2]);let o=/^-?\s*Element:\s*(\S+)/.exec(e);if(o){r=o[1];continue}let s=/^-?\s*ERROR:\s*(.+)$/.exec(e);s&&t.push({file:n,element:r,text:s[1].trim(),line:null})}return t}function firstSentence(e){let t=e.split(`
3
3
  `)[0].trim(),n=t.indexOf(`. `);return(n>0?t.slice(0,n):t).replace(/:$/,``)}function camunda7Details(e){try{let t=JSON.parse(e).details??{};return Object.entries(t).flatMap(([e,t])=>(t.errors??[]).map(t=>({file:e,element:null,text:firstSentence(String(t.message??``)),line:typeof t.line==`number`?t.line:null})))}catch{return[]}}function camunda7Problems(e){let t=[];for(let n of e.split(`Warnings:`)[0].split(`
4
4
  `)){let e=n.trim();if(!e.startsWith(`*`))continue;let r=e.slice(1).split(`|`).map(e=>e.trim());if(r.length<2||!r[1])continue;let i=/line\s+(\d+)/.exec(r[2]??``);t.push({file:r[1].replace(/^resource\s+/,``),element:null,text:firstSentence(r[0]),line:i?Number(i[1]):null})}return t}function escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function refusalsIn(e,n,r,i=``){let a=e===`CAMUNDA_8`?[]:camunda7Details(i),o=e===`CAMUNDA_8`?camunda8Problems(r):a.length>0?a:camunda7Problems(r),s=n.map(e=>e.name),c=new Map;for(let e of o){let t=(e.file&&s.find(t=>t===e.file||e.file?.endsWith(`/${t}`)))??(e.element?n.find(t=>RegExp(`\\bid=["']${escapeRegExp(e.element)}["']`).test(t.content))?.name:void 0);t&&c.set(t,[...c.get(t)??[],e])}return[...c].map(([e,n])=>{let[r,...i]=n,a=[r.line===null?``:t(`app.deploy.problemLine`,{line:r.line}),i.length>0?t(`app.deploy.andNMore`,{number:i.length}):``].filter(Boolean),o=`${r.element?`${r.element}: `:``}${r.text}`;return{file:e,reason:a.length>0?`${o} (${a.join(`, `)})`:o}})}async function confirmed(e,i,a,o){let s=a.sleep??(e=>new Promise(t=>setTimeout(t,e))),c=a.now??(()=>performance.now());for(let l of i){let i=c()+n*r,u=!1;for(let t=0;t<n&&!u&&c()<i;t+=1){let t=await a.ask(definitionCall(e,l)).catch(()=>({status:0,body:``}));u=t.status>=200&&t.status<300,u||await s(r)}if(o.push(u?t(`app.deploy.definitionIsLive`,{key:l.key,version:l.version}):t(`app.deploy.notConfirmedInTime`,{seconds:n,key:l.key})),!u)return!1}return!0}async function deploy(e,n,r){let i=n.map(e=>e.name),a=[],hook=async e=>{if(!r.hook)return{ok:!0,lines:[]};try{return await r.hook(e,i)}catch(e){return{ok:!1,lines:[failureText(e)]}}},o=await hook(`preDeploy`);if(a.push(...o.lines),!o.ok)return{ok:!1,status:0,message:t(`app.deploy.preDeployHookFailed`),definitions:[],lines:a};let s;try{s=await r.ask(deploymentCall(e,n))}catch(e){return{ok:!1,status:0,message:t(`app.deploy.unableToDeploy`,{reason:failureText(e)}),definitions:[],lines:a}}if(s.status<200||s.status>=300){let r=s.status===0?[]:refusalsIn(e.engine,n,fullReasonOf(s),bodyOf(s)),i=s.status===0?bodyOf(s):r.length>0?[t(`app.deploy.refusedNothingDeployed`,{count:r.length}),...r.map(e=>`${e.file}: ${e.reason}`)].join(`