@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
@@ -0,0 +1,24 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./FormStepView-DraPVoAN.js","./rolldown-runtime-B8BYMn-z.js","./vendor-NJP34MHU.js","./translator-B2N3PQBL.js","./preload-helper-VRuDKI9K.js","./bridgeInstance-DQk-c8L1.js","./dist-CRJyslwo.js","./dist-DgvQWhKm.js","./moddle-CGpeSs3G.js","./dist-BqwyxNP3.js","./engines-DU0BfbYM.js","./platform-CkWAyNst.js","./frontend-caI7mOAL.js","./dialog-CtGB1LHI.js","./httpHost-Dqit__mm.js","./ui-3pEQJ50t.js","./lib-DAKOOgix.js","./dist-CHluRwHI.js","./dist-TNwbKIWT.js","./index.es-DqkfrvWI.js","./dist--PmHUHDp.js","./dist-CxyFqsL2.js","./purify.es-DBLk-NVl.js","./Viewer-CZiVl0t6.js","./GraphAwareLayoutService-C8J8YHJI.js","./jspdf.es.min-CM3S4IDt.js","./useTrace-BAXnn0Bt.js","./documentBridge-QW0IZ9Bq.js","./testCaseRuns-DYKnccnc.js","./shortcut-DONH578b.js","./AgentSettings-C3Er_rlW.js","./preferences-nBrFGN89.js","./typing-CXvbBSPr.js","./bpmnTheme-cOvp4qFc.js","./dist-CsBP6QjA.js","./dist-DvFyMwGd.js","./dist-Gx7P7Pk_.js","./dist-DUkRqvKl.js","./dist-BaEGn3tp.js","./dist-CAxViutc.js","./dockLayout-CxOMo-Nl.js","./web-B2zkonPE.js","./BpmnCanvas-Dw5zgCN3.js","./duplicate-DNPpPVse.js","./dist-sl8LIbwu.js","./stackblur-es-Djj-lnDR.js","./array-move-Bc4mVEdq.js","./dist-Km3QNqlU.js","./groovy-DASguM_i.js","./dist-CnDXCEJ_.js","./apply-HqvoGwLE.js","./files-Chpd_QD0.js","./documents-KeXEdK1U.js","./commands-nPznxvPp.js","./web-BTVzb1W6.css"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-B8BYMn-z.js";import{_ as t,c as n,d as r,f as i,g as a,h as o,i as s,m as c,o as l,r as u,s as d,u as f}from"./vendor-NJP34MHU.js";import{i as p}from"./translator-B2N3PQBL.js";import{t as m}from"./preload-helper-VRuDKI9K.js";import{I as h,x as g}from"./frontend-caI7mOAL.js";import{$ as _,$t as v,A as y,An as b,Bn as x,Bt as S,C,Cn as w,Ct as T,D as E,Dt as D,E as O,En as k,Et as A,Fn as j,Ft as M,Gn as N,Gt as P,H as F,Hn as I,Ht as L,In as R,It as z,J as B,Jt as V,Kn as H,Kt as U,L as ee,Ln as te,Lt as W,M as G,Mt as K,Nt as ne,O as re,On as ie,Ot as ae,P as oe,Pn as se,Pt as q,Q as ce,Qt as le,R as ue,Rt as de,St as fe,T as pe,Tn as me,Tt as he,Ut as ge,Vn as _e,Vt as ve,Wt as ye,Xn as be,Xt as xe,Yn as Se,Yt as Ce,Z as we,Zt as Te,_ as Ee,_n as De,_t as Oe,a as ke,b as Ae,bn as je,bt as Me,c as Ne,ct as Pe,d as Fe,dt as Ie,en as J,et as Le,f as Re,ft as ze,g as Be,gn as Ve,gt as He,h as Ue,hn as We,ht as Ge,i as Ke,j as qe,k as Je,kn as Ye,l as Xe,m as Ze,mn as Qe,mt as $e,nn as et,nt as tt,o as nt,p as rt,pt as it,qt as ot,rn as st,rt as ct,s as lt,t as Y,tn as ut,tt as dt,u as ft,v as pt,vt as mt,w as ht,wn as gt,wt as _t,x as vt,xt as yt,y as bt,yn as xt,yt as St,zn as Ct,zt as wt}from"./bridgeInstance-DQk-c8L1.js";import{C as Tt,b as Et,f as Dt,g as Ot,h as kt,o as At,r as jt,s as Mt}from"./moddle-CGpeSs3G.js";import{$ as Nt,A as Pt,B as Ft,C as It,D as Lt,Dt as Rt,E as zt,Et as Bt,F as Vt,G as Ht,H as Ut,I as Wt,J as Gt,K as Kt,L as qt,M as Jt,N as Yt,O as Xt,Ot as Zt,P as Qt,Q as $t,R as en,S as tn,St as nn,T as rn,Tt as an,U as X,V as on,W as sn,X as cn,Y as ln,Z as un,_ as dn,_t as fn,a as pn,at as mn,b as hn,bt as gn,c as _n,ct as vn,d as yn,dt as bn,et as xn,f as Sn,ft as Cn,g as wn,gt as Tn,h as En,ht as Dn,i as On,it as kn,j as An,k as jn,l as Mn,lt as Nn,m as Pn,mt as Fn,n as In,nt as Ln,o as Rn,ot as zn,p as Bn,pt as Vn,q as Hn,r as Un,rt as Wn,s as Gn,st as Kn,t as qn,tt as Jn,u as Yn,ut as Xn,v as Zn,vt as Qn,w as $n,x as er,xt as tr,y as nr,yt as rr,z as ir}from"./BpmnCanvas-Dw5zgCN3.js";import{a as ar,r as Z,t as or}from"./platform-CkWAyNst.js";import{a as sr,c as cr,o as lr,s as ur}from"./engines-DU0BfbYM.js";import{a as dr,c as fr,i as pr,l as mr,o as hr,s as gr,t as _r}from"./samples-BVuIm-bu.js";import{a as vr,c as yr,d as br,i as xr,l as Sr,n as Cr,o as wr,p as Tr,r as Er,s as Dr,t as Or,u as kr}from"./testCaseRuns-DYKnccnc.js";import{a as Ar,i as jr,n as Mr,r as Nr,s as Pr,t as Fr}from"./useTrace-BAXnn0Bt.js";import{_ as Ir,a as Lr,c as Rr,d as zr,f as Br,g as Vr,i as Hr,n as Ur,o as Wr,p as Gr,r as Kr,s as qr,t as Jr,u as Yr,v as Xr}from"./documentBridge-QW0IZ9Bq.js";import{t as Zr}from"./shortcut-DONH578b.js";import{t as Qr}from"./typing-CXvbBSPr.js";import{i as $r,o as ei,s as ti}from"./dialog-CtGB1LHI.js";import{_ as ni,i as ri,k as ii,l as ai,n as oi,r as si,s as ci,t as li,u as ui,y as di}from"./bpmnTheme-cOvp4qFc.js";import{c as fi,d as pi,f as mi,h as hi,i as gi,l as Q,o as _i,p as vi,s as $,u as yi}from"./ui-3pEQJ50t.js";import{a as bi,i as xi,o as Si,r as Ci}from"./preferences-nBrFGN89.js";import{r as wi}from"./duplicate-DNPpPVse.js";import{K as Ti}from"./Viewer-CZiVl0t6.js";import{Ct as Ei,I as Di,P as Oi,Q as ki,St as Ai,Tt as ji,ht as Mi,vt as Ni,z as Pi}from"./dist-CsBP6QjA.js";import{l as Fi}from"./dist-DvFyMwGd.js";import{l as Ii,t as Li,u as Ri}from"./apply-HqvoGwLE.js";import{i as zi,r as Bi,s as Vi}from"./dockLayout-CxOMo-Nl.js";import{Ct as Hi,E as Ui,F as Wi,H as Gi,I as Ki,M as qi,N as Ji,P as Yi,R as Xi,U as Zi,W as Qi,at as $i,b as ea,h as ta,it as na,l as ra,n as ia,o as aa,ot as oa,rt as sa,st as ca,t as la,u as ua,w as da}from"./web-B2zkonPE.js";import{t as fa}from"./formChecks-sU20kKkU.js";function compareVariables(e,t){let n=new Set(t),r=new Set,i=new Map;for(let t of e){if(!t.name.trim()||(r.add(t.name),t.writes))continue;let e=i.get(t.name)??[];e.some(e=>e.elementId===t.elementId&&e.where===t.where)||e.push({elementId:t.elementId,where:t.where}),i.set(t.name,e)}let a=[...new Set(t.map(e=>e.trim()).filter(e=>e&&!r.has(e)))].sort(),o=[...i.entries()].filter(([e])=>!n.has(e)).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({name:e,elements:t}));return{unused:a.map(e=>({name:e,elements:[]})),neverSet:o}}function reached(e=[],t=[]){return{elements:new Set(e),flows:new Set(t)}}function join(e,t){return reached([...e.elements,...t.elements],[...e.flows,...t.flows])}function strings(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.trim()!==``):[]}function items(e){return Array.isArray(e)?e:[]}function add(e,t,n,r){if(typeof t!=`string`||!t)return;let i=e.get(t)??{processId:t,all:reached(),tests:new Map};i.all=join(i.all,r),n&&i.tests.set(n,join(i.tests.get(n)??reached(),r)),e.set(t,i)}function camunda8$1(e){return reached(strings(e?.completedElements),strings(e?.takenSequenceFlows))}e(camunda8$1,`camunda8`);function eventsByProcess(e){let t=new Map;return items(e).forEach(e=>{let n=typeof e?.modelKey==`string`?e.modelKey:``,r=t.get(n)??reached();e?.source===`FLOW_NODE`&&e?.type===`END`&&e.definitionKey&&r.elements.add(e.definitionKey),e?.source===`SEQUENCE_FLOW`&&e.definitionKey&&r.flows.add(e.definitionKey),t.set(n,r)}),t}function readCoverage(e){let t=new Map,n;try{n=JSON.parse(e)}catch{return t}return items(n?.suites).forEach(e=>{let n=String(e?.name??``).split(`.`).pop()??``;items(e?.runs).forEach(e=>{let r=[n,String(e?.name??``)].filter(e=>e).join(`.`);items(e?.processCoverages).forEach(e=>add(t,e?.processDefinitionId,r,camunda8$1(e))),eventsByProcess(e?.events).forEach((e,n)=>add(t,n,r,e))})}),items(n?.processCoverages).forEach(e=>add(t,e?.processDefinitionId,null,camunda8$1(e))),t}function mergeCoverage(e){let t=new Map;return e.forEach(e=>e.forEach(e=>{add(t,e.processId,null,e.all),e.tests.forEach((n,r)=>add(t,e.processId,r,n))})),t}function projectCoverage(e,t){return{reach:mergeCoverage(t.map(e=>readCoverage(e.text))),reports:t.map(t=>k(e,t.path)),updatedAt:t.length>0?Math.max(...t.map(e=>e.stamp)):null}}var pa=4,ma=2;function distanceWithin(e,t,n){if(Math.abs(e.length-t.length)>n)return n+1;let r=n+1,i=t.length+1,a=Array(i).fill(r),o=Array(i).fill(r);for(let e=0;e<=Math.min(n,t.length);e+=1)a[e]=e;for(let s=0;s<e.length;s+=1){let c=Math.max(0,s-n),l=Math.min(t.length-1,s+n);c>0&&(o[c]=r),o[0]=s+1<=n?s+1:r;let u=c===0?o[0]:r;for(let n=c;n<=l;n+=1){let i=Math.min(a[n+1]+1,o[n]+1,a[n]+(e[s]===t[n]?0:1),r);o[n+1]=i,i<u&&(u=i)}if(l+2<i&&(o[l+2]=r),u>n)return r;[a,o]=[o,a]}return Math.min(a[t.length],r)}function closest(e,t){let n=new Set(t),r=e.toLowerCase(),i=[...n].find(t=>t!==e&&t.toLowerCase()===r);if(i)return i;if(e.length<pa)return null;let a=null,o=1/0;return n.forEach(t=>{let n=distanceWithin(t.toLowerCase(),e.toLowerCase(),ma);n>=1&&n<=ma&&n<o&&(a=t,o=n)}),a}function folderAndName(e){return e.replace(/\\/g,`/`).split(`/`).filter(Boolean).slice(-2).join(`/`)}var ha=new Set([`JOB_TYPE`,`TOPIC`,`CLASS`,`BEAN`]),ga=/^[\w.-]+:[\w.-]+:\d+$/;function subjectKey(e){return`${e.kind}:${e.value}`}function isConnector(e){return e.kind===`JOB_TYPE`&&ga.test(e.value)}function needsCode(e){return ha.has(e.kind)&&!isConnector(e)}function codeSubjects(e,t){let n=new Map,add=e=>n.set(subjectKey(e),e);return e.forEach(({model:e})=>{e.workers.forEach(e=>add({kind:me(e.kind),value:e.value})),e.processes.forEach(e=>add({kind:`PROCESS`,value:e.id})),e.errors.forEach(e=>{e.code&&add({kind:`ERROR`,value:e.code})})}),t.filter(e=>e.kind===`VARIABLE`).forEach(e=>add({kind:`VARIABLE`,value:e.value})),[...n.values()]}function subjectsOf(e,t){let n=new Map,add=e=>n.set(subjectKey(e),e);return e.processes.some(e=>e.id===t)&&add({kind:`PROCESS`,value:t}),e.elements.some(e=>e.id===t)&&add({kind:`ELEMENT`,value:t}),e.workers.filter(e=>e.elementId===t).forEach(e=>add({kind:me(e.kind),value:e.value})),e.messageUses.filter(e=>e.elementId===t).forEach(t=>{let n=e.messages.find(e=>e.id===t.messageId)?.name;n&&add({kind:`MESSAGE`,value:n})}),e.decisionUses.filter(e=>e.elementId===t).forEach(e=>add({kind:`DECISION`,value:e.decisionId})),e.errors.filter(e=>e.elementId===t&&e.code).forEach(e=>add({kind:`ERROR`,value:e.code??``})),e.decisions.some(e=>e.id===t)&&add({kind:`DECISION`,value:t}),[...n.values()]}function linksOf(e,t){let n=new Set;return t.flatMap(t=>e?.links.get(subjectKey(t))??[]).filter(e=>{let t=[e.handle,e.label,e.declaration??``,e.implements,e.test].join(`|`);return!n.has(t)&&(n.add(t),!0)})}function nameOf$9(e){return e.binding?.name??null}e(nameOf$9,`nameOf`);function templateDrift(e,t){let n=new Map;for(let t of e.properties){if(t.binding?.type===`zeebe:output`||t.binding?.type===`camunda:taskDefinition`)continue;let e=nameOf$9(t);e&&n.set(e,t.type)}let r=new Map(t.inputs.map(e=>[e.name,e.type])),i=[...r.keys()].filter(e=>!n.has(e)),a=[...n.keys()].filter(e=>!r.has(e)),o=[...r.keys()].filter(e=>n.has(e)&&n.get(e)!==r.get(e));return i.length===0&&a.length===0&&o.length===0?null:{missing:i,extra:a,changed:o}}function driftText(e){return[...e.missing.map(e=>p(`app.templates.drift.noLongerRead`,{name:e})),...e.extra.map(e=>p(`app.templates.drift.notRead`,{name:e})),...e.changed.map(e=>p(`app.templates.drift.differentType`,{name:e}))].join(`; `)}function parse(e){if(!e)return null;try{let t=JSON.parse(e);return Array.isArray(t)?t[0]??null:t}catch{return null}}async function loadTemplates(e){let t=new Map;for(let n of await e.list()){let r=parse(await e.read(n));r?.id&&t.set(r.id,{path:n,template:r})}return t}var _a=[`JOB_TYPE`,`TOPIC`,`CLASS`,`BEAN`,`MESSAGE`,`ERROR`];function attribute$1(e,t){let n=e?.get?.(t)??e?.$attrs?.[t];return typeof n==`string`&&n.trim()?n:void 0}e(attribute$1,`attribute`);function extensions(e,t){return(e?.extensionElements?.values??[]).filter(e=>e.$type===t)}function eachElement(e,t){let walk=e=>{e?.id&&t(e),(e?.flowElements??[]).forEach(walk)};processesOf(e).forEach(e=>(e.flowElements??[]).forEach(walk))}function processesOf(e){return(e?.rootElements??[]).filter(e=>e.$type===`bpmn:Process`)}function lostUpdates(e){let t=[];return eachElement(e,e=>{extensions(e,`zeebe:LoopCharacteristics`).forEach(n=>{let r=attribute$1(n,`outputCollection`);r&&!attribute$1(n,`outputElement`)&&t.push({elementId:e.id,collection:r})})}),t}function mappingOrder(e){let t=[];return eachElement(e,e=>{extensions(e,`zeebe:IoMapping`).forEach(n=>{let r=[];[...n.inputParameters??[],...n.outputParameters??[]].forEach(n=>{let i=attribute$1(n,`target`);if(!i)return;let a=attribute$1(n,`source`)?.replace(/^=+/,``);if(a){let n=r.find(e=>e===a||e.startsWith(`${a}.`)||a.startsWith(`${e}.`));n&&t.push({elementId:e.id,path:a,target:n})}r.push(i)})})}),t}function nearNames(e,t){if(!t)return[];let n=[];return _a.forEach(r=>{let i=t[r]??[];i.length!==0&&e.filter(e=>e.kind===r&&!!e.elementId).forEach(e=>{if(i.includes(e.value))return;let t=closest(e.value,i);if(!t)return;let a={kind:r,name:e.value,near:t,caseOnly:t.toLowerCase()===e.value.toLowerCase()};n.some(t=>t.elementId===e.elementId&&t.near.kind===r)||n.push({elementId:e.elementId,near:a})})}),n}function workerContract(e){let{model:t,targets:n,answer:r,order:i,definitions:a,codeNames:o}=e,s=new Map,entryOf=e=>{let t=s.get(e);if(t)return t;let n={elementId:e,unfetched:[],unread:[],lateReads:[],near:[],lostUpdate:null,mappingOrder:[],implicit:[]};return s.set(e,n),n},c=new Map,l=new Map;t.variables.forEach(e=>{let t=e.writes?l:c,n=t.get(e.name)??new Set;n.add(e.elementId),t.set(e.name,n)});let writtenBefore=(e,t)=>{let n=l.get(e);if(!n)return!1;for(let e of n)if(e!==t&&j(i,e,t))return!0;return!1};return(r?.variables??[]).filter(e=>e.writes).forEach(e=>{let t=i.get(e.elementId)??new Set;[...c.get(e.name)??new Set].every(e=>!t.has(e))&&entryOf(e.elementId).unread.push(e.name)}),(r?.variables??[]).filter(e=>!e.writes).forEach(e=>{writtenBefore(e.name,e.elementId)||entryOf(e.elementId).lateReads.push(e.name);let t=w(r,e.elementId).find(e=>e.declared);t&&!t.names.includes(e.name)&&entryOf(e.elementId).unfetched.push({name:e.name,closest:closest(e.name,t.names)})}),(r?.implicitJobTypes??[]).forEach(e=>{entryOf(e.elementId).implicit.push({jobType:e.jobType,method:e.method})}),lostUpdates(a).forEach(({elementId:e,collection:t})=>{entryOf(e).lostUpdate=t}),mappingOrder(a).forEach(e=>{entryOf(e.elementId).mappingOrder.push({path:e.path,target:e.target})}),nearNames(n,o).forEach(e=>entryOf(e.elementId).near.push(e.near)),[...s.values()].filter(interesting)}function interesting(e){return e.unfetched.length>0||e.unread.length>0||e.lateReads.length>0||e.near.length>0||e.lostUpdate!==null||e.mappingOrder.length>0||e.implicit.length>0}var va=/^(serviceTask|sendTask|receiveTask|scriptTask)$/;function missingField(e,t,n){let r=t,i=e;for(let e of n){if(e.kind===`index`){if(r.kind!==`collection`)return null;r=r.element,i+=`[]`;continue}if(r.kind!==`object`)return null;let t=Zt(r.fields,e.name);if(!t)return{variable:i,field:e.name,type:r.name,fields:r.fields.filter(e=>e.serialised).map(e=>e.name)};if(!t.serialised)return null;r=t.type,i+=`.${e.name}`}return null}function writtenAt(e){let t=e.writers.find(e=>e.path!==null);return t&&t.path!==null?`${t.path}:${t.line??0}`:null}function variableFindings(e){let t={fields:[],names:[]};if(!e.entitled||e.mode===`off`)return t;let{model:n,definitions:r,order:i,types:a,inputs:o,linked:s}=e,c=R(r),anchorOf=e=>c.flows.get(e)?.target??e,l=new Map,scopeAt=e=>{let t=l.get(e);if(t)return t;let r=new Map(Rt({model:n,order:i,types:a,inputs:o},e,{wholeProcess:!0}).variables.map(e=>[e.name,e]));return l.set(e,r),r},u=[],d=new Set;for(let e of N(r))for(let t of be(e.expression)){let n=Se(t),r=scopeAt(anchorOf(e.elementId)).get(n.root);if(!r||r.certainty!==`exact`)continue;let i=missingField(n.root,r.shape,n.steps);if(!i)continue;let a=[e.elementId,i.variable,i.field].join(`\0`);d.has(a)||(d.add(a),u.push({elementId:e.elementId,...i,from:writtenAt(r)}))}let f=[];if(e.mode===`names`&&s.size>0){let e=new Set(n.variables.filter(e=>e.writes).map(e=>e.name)),t=new Set(o),r=n.elements.filter(e=>va.test(e.type)).map(e=>e.id),a=new Map;for(let e of n.variables.filter(e=>!e.writes))a.set(e.elementId,new Set([...a.get(e.elementId)??[],e.name]));for(let[n,o]of a){let a=anchorOf(n);if(!r.some(e=>e!==a&&j(i,e,a)&&!s.has(e)))for(let r of o)e.has(r)||t.has(r)||f.push({elementId:n,name:r})}}return{fields:u,names:f}}function fieldFindingTitle(e){return e.fields.length===0?p(`app.code.finding.variableFieldNone`,{variable:e.variable,field:e.field,type:e.type}):p(`app.code.finding.variableField`,{variable:e.variable,field:e.field,type:e.type,fields:e.fields.join(`, `)})}function fieldFindingWhere(e){return e.from===null?p(`app.code.finding.variableFieldWhereUnknown`):p(`app.code.finding.variableFieldWhere`,{from:e.from})}function nameFindingTitle(e){return p(`app.code.finding.variableUnknown`,{name:e})}function nameFindingWhere(){return p(`app.code.finding.variableUnknownWhere`)}function onePerName(e,t,n){let r=new Set(e.map(e=>e.name)),i=t.filter(e=>!r.has(e.name));return i.forEach(e=>r.add(e.name)),{unset:i,late:n.filter(e=>!r.has(e))}}function none(){return{unfetched:[],unread:[],lateReads:[],near:[],lostUpdate:null,mappingOrder:[],implicit:[],unknownFields:[],unknownNames:[]}}function titleOf$1(e,t){return e.elements.find(e=>e.id===t)?.label??e.processes.find(e=>e.id===t)?.label??e.decisions.find(e=>e.id===t)?.label??t}e(titleOf$1,`titleOf`);function elementInsight({model:e,code:t},n){let r=linksOf(t,subjectsOf(e,n)),i=r.filter(e=>e.test);return{elementId:n,title:titleOf$1(e,n),implementations:r.filter(e=>e.implements),tests:i,usages:r.filter(e=>!e.implements&&!e.test),...none()}}function diagramInsight(e){let{model:t,files:n,targets:r,code:i,order:a,definitions:o,workers:s,codeNames:c,variables:l,codeLinks:u}=e,d=new Map(workerContract({model:t,targets:r,answer:s&&!u?{...s,variables:[]}:s??null,order:a??new Map,definitions:o,codeNames:c}).map(e=>[e.elementId,e])),f=variableFindings({model:t,definitions:o,order:a??new Map,types:s?.types??[],inputs:l?.inputs??[],linked:new Set((s?.fetches??[]).map(e=>e.elementId)),mode:l?.mode??`off`,entitled:l?.entitled??!1}),p=new Map;f.fields.forEach(e=>p.set(e.elementId,[...p.get(e.elementId)??[],e]));let m=new Map;if(f.names.forEach(e=>m.set(e.elementId,[...m.get(e.elementId)??[],e.name])),!i)return[...new Set([...d.keys(),...p.keys(),...m.keys()])].map(t=>{let n=d.get(t)??{elementId:t,...none()};return{...elementInsight(e,t),missingImplementation:!1,neverThrown:!1,unsetReads:[],...n,unknownFields:p.get(t)??[],unknownNames:m.get(t)??[]}});let h=new Set(r.filter(e=>e.kind===`VARIABLE`&&e.writes).map(e=>e.value)),setInCode=e=>!i.precise||linksOf(i,[{kind:`VARIABLE`,value:e}]).some(e=>e.implements),g=codeSubjects(n,r).filter(needsCode).some(e=>linksOf(i,[e]).some(e=>e.implements)),_=codeSubjects(n,r).filter(e=>e.kind===`ERROR`),v=i.precise&&_.some(e=>linksOf(i,[e]).some(e=>e.implements)),y=new Set(n.flatMap(e=>e.model.errors.filter(e=>!e.catches&&e.code).map(e=>e.code)));return t.elements.flatMap(n=>{let r=elementInsight(e,n.id),a=[...new Set(t.variables.filter(e=>e.elementId===n.id&&!e.writes).map(e=>e.name))],o=i.precise&&subjectsOf(t,n.id).some(needsCode)&&r.implementations.length===0&&g,s=a.filter(e=>!h.has(e)&&!setInCode(e)).map(e=>({name:e,closest:closest(e,h)})),c=t.errors.find(e=>e.elementId===n.id&&e.catches&&e.code)?.code,l=!!c&&v&&r.implementations.length===0&&!y.has(c),u=d.get(n.id)??{elementId:n.id,...none()},f=onePerName(u.unfetched,s,u.lateReads),_=p.get(n.id)??[],b=(m.get(n.id)??[]).filter(e=>!f.unset.some(t=>t.name===e));return r.implementations.length>0||r.tests.length>0||r.usages.length>0||o||l||f.unset.length>0||u.unfetched.length>0||u.unread.length>0||f.late.length>0||u.near.length>0||u.lostUpdate!==null||u.mappingOrder.length>0||u.implicit.length>0||_.length>0||b.length>0?[{...r,missingImplementation:o,neverThrown:l,unsetReads:f.unset,...u,lateReads:f.late,unknownFields:_,unknownNames:b}]:[]})}var ya=100,Refused=class extends Error{};function json(e){if(e.status<200||e.status>=300)throw new Refused(e.status===401||e.status===403?p(`app.live.credentialsMayNotAllow`,{status:e.status}):e.status===0?e.body:p(`app.live.answeredStatus`,{status:e.status}));try{return JSON.parse(e.body)}catch{throw new Refused(p(`app.live.answeredNotJson`))}}function count$1(e){return typeof e==`number`&&Number.isFinite(e)?e:0}e(count$1,`count`);function list$1(e){return Array.isArray(e)?e:[]}e(list$1,`list`);async function camunda8(e,t){let n=json(await t({method:`POST`,path:`/process-definitions/search`,body:JSON.stringify({filter:{processDefinitionId:e},sort:[{field:`version`,order:`desc`}],page:{limit:1}})}))?.items?.[0];if(!n?.processDefinitionKey)return{process:{processId:e,key:null,version:null,deployed:!1,elements:new Map},incidents:[]};let r=String(n.processDefinitionKey),[i,a]=await Promise.all([t({method:`POST`,path:`/process-definitions/${encodeURIComponent(r)}/statistics/element-instances`,body:`{}`}).then(json),t({method:`POST`,path:`/incidents/search`,body:JSON.stringify({filter:{processDefinitionKey:r,state:`ACTIVE`},page:{limit:ya}})}).then(json)]),o=new Map(list$1(i?.items).map(e=>[String(e?.elementId),{waiting:count$1(e?.active)+count$1(e?.incidents),incidents:count$1(e?.incidents),completed:count$1(e?.completed)}]));return{process:{processId:e,key:r,version:typeof n.version==`number`?n.version:null,deployed:!0,elements:o},incidents:list$1(a?.items).map(t=>{let n={processId:e,elementId:String(t?.elementId??``),type:String(t?.errorType??``),message:String(t?.errorMessage??``),instance:String(t?.processInstanceKey??``)},r=t?.incidentKey??t?.key??t?.id;return r!=null&&(n.id=String(r)),n})}}async function camunda7(e,t){let n=await t({method:`GET`,path:`/process-definition/key/${encodeURIComponent(e)}`});if(n.status===404)return{process:{processId:e,key:null,version:null,deployed:!1,elements:new Map},incidents:[]};let r=json(n),i=encodeURIComponent(String(r?.id??``)),[a,o]=await Promise.all([t({method:`GET`,path:`/process-definition/${i}/statistics?incidents=true`}).then(json),t({method:`GET`,path:`/incident?processDefinitionId=${i}&maxResults=${ya}`}).then(json)]),s=new Map(list$1(a).map(e=>[String(e?.id),{waiting:count$1(e?.instances),incidents:list$1(e?.incidents).reduce((e,t)=>e+count$1(t?.incidentCount),0),completed:null}]));return{process:{processId:e,key:String(r?.id??``),version:typeof r?.version==`number`?r.version:null,deployed:!0,elements:s},incidents:list$1(o).map(t=>{let n={processId:e,elementId:String(t?.activityId??``),type:String(t?.incidentType??``),message:String(t?.incidentMessage??``),instance:String(t?.processInstanceId??``)};return t?.id!==void 0&&t?.id!==null&&(n.id=String(t.id)),n})}}async function readLive(e,t,n){try{let r=e===`CAMUNDA_8`?camunda8:camunda7,i=await Promise.all(t.map(e=>r(e,n)));return{processes:i.map(e=>e.process),incidents:i.flatMap(e=>e.incidents),problem:null}}catch(e){return{processes:[],incidents:[],problem:e instanceof Error?e.message:String(e)}}}function liveOf(e,t){for(let n of e?.processes??[]){let e=n.elements.get(t);if(e)return e}return null}function parseJson$1(e){if(e.status<200||e.status>=300){let t=e.status===401||e.status===403?p(`app.live.credentialsMayNotAllow`,{status:e.status}):p(`app.live.answeredStatus`,{status:e.status});throw Error(t)}try{return JSON.parse(e.body)}catch{throw Error(p(`app.live.answeredNotJson`))}}e(parseJson$1,`parseJson`);function isRecord$2(e){return typeof e==`object`&&!!e}e(isRecord$2,`isRecord`);function timeOf(e){return e?Date.parse(e.replace(/([+-]\d\d)(\d\d)$/,`$1:$2`)):NaN}function historyInstancesCall(e,t,n=10){if(e===`CAMUNDA_8`){let e=typeof t==`string`?t:t.key??t.id??``,r={state:{$in:[`COMPLETED`,`CANCELED`]}};return e&&(/^\d+$/.test(e)?r.processDefinitionKey=e:r.processDefinitionId=e),{method:`POST`,path:`/process-instances/search`,body:JSON.stringify({filter:r,sort:[{field:`endDate`,order:`desc`}],page:{limit:Math.max(1,n)}})}}let r=typeof t==`string`?t:t.key,i=typeof t==`object`?t.id:void 0;return{method:`GET`,path:`/history/process-instance?${i?`processDefinitionId=${encodeURIComponent(i)}`:`processDefinitionKey=${encodeURIComponent(r??``)}`}&finished=true&sortBy=endTime&sortOrder=desc&maxResults=${Math.max(1,n)}`}}function parseHistoryInstances(e,t){let n=parseJson$1(t);return e===`CAMUNDA_8`?(Array.isArray(n?.items)?n.items:[]).filter(isRecord$2).map(e=>{let t=String(e.processInstanceKey??e.key??``),n=e.businessKey??e.businessId??null,r=e.state===`CANCELED`?`CANCELED`:`COMPLETED`,i=String(e.startDate??``),a=String(e.endDate??``),o=timeOf(i),s=timeOf(a);return{id:t,businessKey:n,state:r,startTime:i,endTime:a,durationMs:Number.isFinite(o)&&Number.isFinite(s)&&s>=o?s-o:0}}):(Array.isArray(n)?n:[]).filter(isRecord$2).map(e=>{let t=String(e.id??``),n=e.businessKey??null,r=e.state===`COMPLETED`&&!e.deleteReason?`COMPLETED`:`CANCELED`,i=String(e.startTime??``),a=String(e.endTime??``),o=typeof e.durationInMillis==`number`&&e.durationInMillis>0?e.durationInMillis:0;if(o<=0){let e=timeOf(i),t=timeOf(a);Number.isFinite(e)&&Number.isFinite(t)&&t>=e&&(o=t-e)}return{id:t,businessKey:n,state:r,startTime:i,endTime:a,durationMs:o}})}function instancePathCall(e,t){return e===`CAMUNDA_8`?{method:`POST`,path:`/element-instances/search`,body:JSON.stringify({filter:{processInstanceKey:t},sort:[{field:`startDate`,order:`asc`}],page:{limit:500}})}:{method:`GET`,path:`/history/activity-instance?processInstanceId=${encodeURIComponent(t)}&sortBy=occurrence&sortOrder=asc`}}function parseInstancePath(e,t,n){let r=parseJson$1(n);if(e===`CAMUNDA_8`){let e=(Array.isArray(r?.items)?r.items:[]).filter(e=>e?.state===`COMPLETED`&&e?.type!==`PROCESS`).map(e=>({elementId:String(e.elementId??``),state:`COMPLETED`,mocked:!1,startedAt:e.startDate?String(e.startDate):null,endedAt:e.endDate?String(e.endDate):null}));return{instanceId:t,activityIds:e.map(e=>e.elementId),steps:e}}let i=(Array.isArray(r)?r:[]).filter(e=>e?.endTime&&!e?.canceled&&e?.activityType!==`process`).map(e=>({elementId:String(e.activityId??``),state:`COMPLETED`,mocked:!1,startedAt:e.startTime?String(e.startTime):null,endedAt:e.endTime?String(e.endTime):null}));return{instanceId:t,activityIds:i.map(e=>e.elementId),steps:i}}async function readFinishedInstances(e,t,n,r){return parseHistoryInstances(e,await r(historyInstancesCall(e,t,n)))}async function readInstancePath(e,t,n){return parseInstancePath(e,t,await n(instancePathCall(e,t)))}function centreOf(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function contains(e,t){return t.x>=e.x&&t.x<=e.x+e.width&&t.y>=e.y&&t.y<=e.y+e.height}function area(e){return e.width*e.height}function distanceToRect(e,t){let n=Math.max(e.x-t.x,0,t.x-(e.x+e.width)),r=Math.max(e.y-t.y,0,t.y-(e.y+e.height));return Math.hypot(n,r)}var ba=new Set([`startEvent`,`endEvent`,`intermediateCatchEvent`,`intermediateThrowEvent`,`boundaryEvent`]);function isRound(e){return ba.has(e.kind)}function isDiamond(e){return e.kind.endsWith(`Gateway`)}function borderPoint(e,t){let n=centreOf(e),r=t.x-n.x,i=t.y-n.y;if(r===0&&i===0)return n;let a;return a=isRound(e)?Math.min(e.width,e.height)/2/Math.hypot(r,i):isDiamond(e)?1/(Math.abs(r)/(e.width/2)+Math.abs(i)/(e.height/2)):Math.min(r===0?1/0:e.width/2/Math.abs(r),i===0?1/0:e.height/2/Math.abs(i)),{x:n.x+r*a,y:n.y+i*a}}function stepRoute(e,t){let n=centreOf(e),r=centreOf(t),horizontal=(e,t,n,r)=>{let i={x:e.x+e.width,y:n.y},a={x:t.x,y:r.y};if(Math.abs(n.y-r.y)<1)return[i,{x:a.x,y:i.y}];let o=(i.x+a.x)/2;return[i,{x:o,y:i.y},{x:o,y:a.y},a]},vertical=(e,t,n,r)=>{let i={x:n.x,y:e.y+e.height},a={x:r.x,y:t.y};if(Math.abs(n.x-r.x)<1)return[i,{x:i.x,y:a.y}];let o=(i.y+a.y)/2;return[i,{x:i.x,y:o},{x:a.x,y:o},a]};return t.x>=e.x+e.width?horizontal(e,t,n,r):e.x>=t.x+t.width?horizontal(t,e,r,n).reverse():t.y>=e.y+e.height?vertical(e,t,n,r):e.y>=t.y+t.height?vertical(t,e,r,n).reverse():null}function nestLanes(e){let t=e.filter(e=>e.kind===`pool`);for(let e of t)t.some(t=>t!==e&&contains(t,centreOf(e))&&area(t)>area(e))&&(e.kind=`lane`)}var xa=`http://www.omg.org/spec/BPMN/20100524/MODEL`,Sa=`http://www.omg.org/spec/BPMN/20100524/DI`,Ca=`http://www.omg.org/spec/DD/20100524/DC`,wa=`http://www.omg.org/spec/DD/20100524/DI`,Ta=new Set([`subProcess`,`transaction`,`eventSubProcess`]),Ea=new Set([`task`,`callActivity`,`subProcess`,`transaction`,`eventSubProcess`]),Da=new Set([`pool`,`lane`,`subProcess`,`transaction`,`eventSubProcess`]),Oa=new Set([`dataObject`,`dataStore`]),ka=new Set([`startEvent`,`endEvent`,`intermediateCatchEvent`,`intermediateThrowEvent`,`boundaryEvent`]),Aa=25,ja={task:`task`,user:`userTask`,service:`serviceTask`,script:`scriptTask`,send:`sendTask`,receive:`receiveTask`,manual:`manualTask`,businessRule:`businessRuleTask`},Ma={message:`messageEventDefinition`,timer:`timerEventDefinition`,error:`errorEventDefinition`,escalation:`escalationEventDefinition`,signal:`signalEventDefinition`,conditional:`conditionalEventDefinition`,link:`linkEventDefinition`,compensation:`compensateEventDefinition`,cancel:`cancelEventDefinition`,terminate:`terminateEventDefinition`},Na={task:`Activity`,callActivity:`Activity`,subProcess:`Activity`,transaction:`Activity`,eventSubProcess:`Activity`,startEvent:`Event`,endEvent:`Event`,intermediateCatchEvent:`Event`,intermediateThrowEvent:`Event`,boundaryEvent:`Event`,exclusiveGateway:`Gateway`,parallelGateway:`Gateway`,inclusiveGateway:`Gateway`,complexGateway:`Gateway`,eventBasedGateway:`Gateway`,dataObject:`DataObjectReference`,dataStore:`DataStoreReference`,textAnnotation:`TextAnnotation`,pool:`Participant`,lane:`Lane`};function escapeAttribute(e){return le(e).replace(/\r/g,``).replace(/\n/g,`&#10;`).replace(/\t/g,`&#9;`)}function tag(e,t,n=``){let r=Object.entries(t).filter(e=>e[1]!==void 0).map(([e,t])=>` ${e}="${escapeAttribute(t)}"`).join(``);return n?`<bpmn:${e}${r}>${n}</bpmn:${e}>`:`<bpmn:${e}${r}/>`}function documentation(e){return e?.trim()?`<bpmn:documentation>${Te(e.trim())}</bpmn:documentation>`:``}function round(e){return String(Math.round(e))}function buildBpmn(e){let t=[...e.notes],note=(e,n)=>t.push({level:e,message:n}),n=new Set,unique=(e,t)=>{let r=`${e}_${t.replace(/[^A-Za-z0-9_.-]/g,`_`)||`1`}`,i=r;for(let e=2;n.has(i);e+=1)i=`${r}_${e}`;return n.add(i),i},labelOf=e=>e.name.replace(/\s+$/g,``),describe=e=>e.name.trim()?`"${e.name.replace(/\s+/g,` `).trim()}"`:p(`app.import.note.unnamed`,{kind:p(`app.import.kind.${e.kind}`)}),r=e.nodes.map(e=>({...e,bpmnId:``})),i=new Map(r.map(e=>[e.id,e]));for(let e of r)e.kind===`lane`&&!r.some(t=>t!==e&&(t.kind===`pool`||t.kind===`lane`)&&contains(t,centreOf(e))&&area(t)>area(e))&&!(e.parent&&i.get(e.parent)?.kind===`pool`)&&(e.kind=`pool`,note(`assumed`,p(`app.import.note.laneAsPool`,{node:describe(e)})));let a=r.filter(e=>Da.has(e.kind)),ownerOf=e=>{if(e.kind===`pool`)return;let t=e.parent?i.get(e.parent):void 0,allowed=t=>t===e||!Da.has(t.kind)?!1:e.kind!==`lane`||t.kind===`pool`||t.kind===`lane`;if(t&&allowed(t)&&area(t)>area(e))return t;let n=centreOf(e);return a.filter(t=>allowed(t)&&contains(t,n)&&(!Da.has(e.kind)||area(t)>area(e))).sort((e,t)=>area(e)-area(t))[0]};for(let e of r)e.owner=ownerOf(e);let o=r.filter(e=>Ea.has(e.kind));for(let e of r){if(e.kind!==`boundaryEvent`)continue;let t=e.host?i.get(e.host):void 0,n=centreOf(e),r=o.filter(t=>t!==e).map(e=>({candidate:e,distance:distanceToRect(e,n)})).filter(e=>e.distance<=Aa).sort((e,t)=>e.distance-t.distance)[0],a=t&&Ea.has(t.kind)?t:r?.candidate;a?(e.hostNode=a,e.owner=a.owner):(e.kind=`intermediateCatchEvent`,note(`assumed`,p(`app.import.note.boundaryEvent`,{node:describe(e)})))}let poolOf=e=>{for(let t=e;t;t=t.owner)if(t.kind===`pool`)return t},s=r.filter(e=>e.kind===`pool`);if(s.length>0){let e=[];for(let t of r){if(t.kind===`pool`||poolOf(t))continue;let n=s.map(e=>({pool:e,distance:distanceToRect(e,centreOf(t))})).sort((e,t)=>e.distance-t.distance)[0].pool;t.owner=t.kind===`lane`?n:t.owner??n,t.kind!==`lane`&&t.owner&&t.owner!==n||e.push(t)}if(e.length>0){let t=e.slice(0,5).map(describe).join(`, `);note(`assumed`,p(`app.import.note.outsidePools`,{count:e.length,names:`${t}${e.length>5?`, ...`:``}`}))}}let laneOf=e=>{let t=e.owner;return t?.kind===`lane`?t:void 0},flowContainerOf=e=>{for(let t=e.owner;t;t=t.owner)if(t.kind===`pool`||Ta.has(t.kind))return t};for(let e of r)e.bpmnId=unique(e.kind===`pool`?`Participant`:e.kind===`lane`?`Lane`:Na[e.kind]??`Element`,e.id);let c=[],flowNote=e=>e.name.trim()?`"${e.name.replace(/\s+/g,` `).trim()}"`:p(`app.import.unnamedConnector`);for(let t of e.flows){let e=i.get(t.source),n=i.get(t.target);if(!e||!n){note(`unmapped`,p(`app.import.note.flowNotAttached`,{flow:flowNote(t)}));continue}if(e.kind===`lane`||n.kind===`lane`){note(`unmapped`,p(`app.import.note.flowOnLane`,{flow:flowNote(t)}));continue}let r=t.kind===`sequence`?`sequence`:t.kind===`message`?`message`:`association`,a=Oa.has(e.kind),o=Oa.has(n.kind);if(e.kind===`textAnnotation`||n.kind===`textAnnotation`)r=`association`;else if(a||o){let t=a?n:e,i=ka.has(t.kind),s=t.kind===`endEvent`||t.kind===`intermediateThrowEvent`,c=Ea.has(t.kind)||i&&(a?s:!s);a&&o?r=`association`:c&&r!==`message`?r=a?`dataInput`:`dataOutput`:(r=`association`,note(`assumed`,p(`app.import.note.dataAssociation`,{node:describe(t)})))}else if(e.kind===`pool`||n.kind===`pool`)r!==`message`&&note(`assumed`,p(`app.import.note.flowToPool`,{flow:flowNote(t)})),r=`message`;else{let i=poolOf(e)!==poolOf(n);r===`sequence`&&i?(r=`message`,note(`assumed`,p(`app.import.note.flowAcrossPools`,{flow:flowNote(t),from:describe(e),to:describe(n)}))):r===`message`&&!i?(r=`association`,note(`assumed`,p(`app.import.note.messageInsidePool`,{flow:flowNote(t)}))):r===`sequence`&&flowContainerOf(e)!==flowContainerOf(n)&&(r=`association`,note(`assumed`,p(`app.import.note.flowAcrossSubProcess`,{flow:flowNote(t)})))}c.push({flow:t,bpmnId:``,kind:r,source:e,target:n})}for(let e of c){let t={sequence:`Flow`,message:`Flow`,association:`Association`,dataInput:`DataInputAssociation`,dataOutput:`DataOutputAssociation`}[e.kind];if(e.bpmnId=unique(t,e.flow.id),e.kind===`sequence`)e.container=flowContainerOf(e.source);else if(e.kind===`association`){let t=flowContainerOf(e.source);e.container=t===flowContainerOf(e.target)?t:void 0}}let l=new Map,u=new Map;for(let e of c)e.kind===`sequence`&&e.flow.isDefault&&u.set(e.source,e);let childrenOf=e=>r.filter(t=>flowContainerOf(t)===e&&t.kind!==`pool`&&t.kind!==`lane`),eventDefinitionXml=e=>{if(!e.definition)return``;let t=Ma[e.definition];return t?e.definition===`conditional`?`<bpmn:conditionalEventDefinition><bpmn:condition xsi:type="bpmn:tFormalExpression"/></bpmn:conditionalEventDefinition>`:e.definition===`link`?tag(t,{name:e.name.trim()||`link`}):tag(t,{}):(note(`lost`,p(`app.import.note.multipleEvent`,{node:describe(e),kind:e.definition===`multiple`?`multiple`:p(`app.import.parallelMultiple`)})),``)},loopXml=e=>e.loop===`standard`?`<bpmn:standardLoopCharacteristics/>`:e.loop===`parallel`?`<bpmn:multiInstanceLoopCharacteristics/>`:e.loop===`sequential`?`<bpmn:multiInstanceLoopCharacteristics isSequential="true"/>`:``,dataXml=e=>{let t=c.filter(t=>t.kind===`dataInput`&&t.target===e||t.kind===`dataOutput`&&t.source===e),n=c.filter(t=>t.kind===`dataInput`&&t.target===e),r=c.filter(t=>t.kind===`dataOutput`&&t.source===e);if(t.length===0)return``;let i=n.length>0?unique(`Property`,e.id):``;return i&&l.set(e.id,i),(i?`<bpmn:property id="${i}" name="__targetRef_placeholder"/>`:``)+n.map(e=>`<bpmn:dataInputAssociation id="${e.bpmnId}"><bpmn:sourceRef>${e.source.bpmnId}</bpmn:sourceRef><bpmn:targetRef>${i}</bpmn:targetRef></bpmn:dataInputAssociation>`).join(``)+r.map(e=>`<bpmn:dataOutputAssociation id="${e.bpmnId}"><bpmn:targetRef>${e.target.bpmnId}</bpmn:targetRef></bpmn:dataOutputAssociation>`).join(``)},nodeXml=e=>{let t={id:e.bpmnId,name:labelOf(e)||void 0},n=u.get(e),r=n?{...t,default:n.bpmnId}:t,i=documentation(e.documentation);switch(e.kind){case`task`:return tag(ja[e.taskType??`task`],r,i+dataXml(e)+loopXml(e));case`callActivity`:return tag(`callActivity`,r,i+dataXml(e)+loopXml(e));case`subProcess`:case`transaction`:case`eventSubProcess`:return tag(e.kind===`transaction`?`transaction`:`subProcess`,{...r,triggeredByEvent:e.kind===`eventSubProcess`?`true`:void 0},i+dataXml(e)+loopXml(e)+containerXml(e));case`startEvent`:return tag(`startEvent`,{...t,isInterrupting:e.interrupting===!1?`false`:void 0},i+dataXml(e)+eventDefinitionXml(e));case`endEvent`:return tag(`endEvent`,t,i+dataXml(e)+eventDefinitionXml(e));case`intermediateCatchEvent`:return tag(`intermediateCatchEvent`,t,i+dataXml(e)+eventDefinitionXml(e));case`intermediateThrowEvent`:return tag(`intermediateThrowEvent`,t,i+dataXml(e)+eventDefinitionXml(e));case`boundaryEvent`:return tag(`boundaryEvent`,{...t,cancelActivity:e.interrupting===!1?`false`:void 0,attachedToRef:e.hostNode?.bpmnId},i+dataXml(e)+eventDefinitionXml(e));case`exclusiveGateway`:case`parallelGateway`:case`inclusiveGateway`:case`complexGateway`:case`eventBasedGateway`:return tag(e.kind,r,i);case`dataObject`:return`${tag(`dataObject`,{id:`${e.bpmnId}_object`})}${tag(`dataObjectReference`,{...t,dataObjectRef:`${e.bpmnId}_object`},``)}`;case`dataStore`:return tag(`dataStoreReference`,t,i);default:return``}},artifactXml=e=>{let t=childrenOf(e).filter(e=>e.kind===`textAnnotation`),n=c.filter(t=>t.kind===`association`&&t.container===e);return t.map(e=>tag(`textAnnotation`,{id:e.bpmnId},`<bpmn:text>${Te(e.name.trim())}</bpmn:text>`)).join(``)+n.map(e=>tag(`association`,{id:e.bpmnId,sourceRef:e.source.bpmnId,targetRef:e.target.bpmnId})).join(``)},flowElementsXml=e=>{let t=childrenOf(e).filter(e=>e.kind!==`textAnnotation`),n=c.filter(t=>t.kind===`sequence`&&t.container===e);return t.map(nodeXml).join(``)+n.map(e=>tag(`sequenceFlow`,{id:e.bpmnId,name:e.flow.name.trim()||void 0,sourceRef:e.source.bpmnId,targetRef:e.target.bpmnId})).join(``)};function containerXml(e){return flowElementsXml(e)+artifactXml(e)}let laneSetXml=e=>{let lanes=e=>r.filter(t=>t.kind===`lane`&&t.owner===e).map(e=>{let t=r.filter(t=>laneOf(t)===e&&t.kind!==`textAnnotation`&&t.kind!==`pool`&&t.kind!==`lane`&&!Oa.has(t.kind)).map(e=>`<bpmn:flowNodeRef>${e.bpmnId}</bpmn:flowNodeRef>`).join(``),n=lanes(e);return tag(`lane`,{id:e.bpmnId,name:labelOf(e)||void 0},t+(n?`<bpmn:childLaneSet id="${e.bpmnId}_children">${n}</bpmn:childLaneSet>`:``))}).join(``),t=lanes(e);return t?`<bpmn:laneSet id="${e.bpmnId}_lanes">${t}</bpmn:laneSet>`:``},d=s.length>0,f=new Map,m=``,h=``;if(d){h=unique(`Collaboration`,`1`);let e=[];for(let t of s)if(r.some(e=>e!==t&&poolOf(e)===t&&e.kind!==`lane`)||r.some(e=>e.kind===`lane`&&poolOf(e)===t)){let n=unique(`Process`,t.id);f.set(t,n),e.push(tag(`participant`,{id:t.bpmnId,name:labelOf(t)||void 0,processRef:n})),m+=tag(`process`,{id:n,isExecutable:`false`},documentation(t.documentation)+laneSetXml(t)+containerXml(t))}else e.push(tag(`participant`,{id:t.bpmnId,name:labelOf(t)||void 0}));let t=c.filter(e=>e.kind===`message`).map(e=>tag(`messageFlow`,{id:e.bpmnId,name:e.flow.name.trim()||void 0,sourceRef:e.source.bpmnId,targetRef:e.target.bpmnId})).join(``),n=c.filter(e=>e.kind===`association`&&!e.container).map(e=>tag(`association`,{id:e.bpmnId,sourceRef:e.source.bpmnId,targetRef:e.target.bpmnId})).join(``);m=tag(`collaboration`,{id:h},e.join(``)+t+n)+m}else{let e=unique(`Process`,`1`);f.set(void 0,e),h=e,m=tag(`process`,{id:e,isExecutable:`false`},containerXml(void 0))}let order=e=>e.kind===`pool`?0:e.kind===`lane`?1:Ta.has(e.kind)?2:3,expanded=e=>r.some(t=>t.owner===e),g=[...r].sort((e,t)=>order(e)-order(t)).map(e=>{let t={id:`${e.bpmnId}_di`,bpmnElement:e.bpmnId};(e.kind===`pool`||e.kind===`lane`)&&(t.isHorizontal=e.horizontal===!1?`false`:`true`),Ta.has(e.kind)&&(t.isExpanded=expanded(e)?`true`:`false`),e.kind===`exclusiveGateway`&&(t.isMarkerVisible=`true`);let n=`<dc:Bounds x="${round(e.x)}" y="${round(e.y)}" width="${round(e.width)}" height="${round(e.height)}"/>`;return`<bpmndi:BPMNShape${Object.entries(t).filter(e=>e[1]!==void 0).map(([e,t])=>` ${e}="${escapeAttribute(t)}"`).join(``)}>${n}</bpmndi:BPMNShape>`}).join(``),waypointsOf=e=>{let{source:t,target:n,flow:r}=e,i=r.points??[];if(i.length===0&&r.orthogonal){let e=stepRoute(t,n);if(e)return e}let a=borderPoint(t,i[0]??centreOf(n)),o=borderPoint(n,i[i.length-1]??centreOf(t));return[a,...i,o]},_=c.map(e=>{let t=waypointsOf(e).map(e=>`<di:waypoint x="${round(e.x)}" y="${round(e.y)}"/>`).join(``);return`<bpmndi:BPMNEdge id="${e.bpmnId}_di" bpmnElement="${e.bpmnId}">${t}</bpmndi:BPMNEdge>`}).join(``),v=h;return{xml:`<?xml version="1.0" encoding="UTF-8"?>\n<bpmn:definitions xmlns:bpmn="${xa}" xmlns:bpmndi="${Sa}" xmlns:dc="${Ca}" xmlns:di="${wa}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="${unique(`Definitions`,`1`)}" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Penstock">\n${m}\n<bpmndi:BPMNDiagram id="${unique(`BPMNDiagram`,`1`)}"><bpmndi:BPMNPlane id="${unique(`BPMNPlane`,`1`)}" bpmnElement="${v}">${g}${_}</bpmndi:BPMNPlane></bpmndi:BPMNDiagram>\n</bpmn:definitions>\n`,notes:t,summary:{elements:r.filter(e=>e.kind!==`pool`&&e.kind!==`lane`).length,flows:c.length,pools:s.length,lanes:r.filter(e=>e.kind===`lane`).length}}}var DialectError=class extends Error{},Pa=`http://www.omg.org/spec/BPMN/20100524/MODEL`,Fa=new Set([Pa,`http://www.omg.org/spec/BPMN/20100524/DI`,`http://www.omg.org/spec/DD/20100524/DC`,`http://www.omg.org/spec/DD/20100524/DI`,`http://www.w3.org/2001/XMLSchema-instance`,`http://www.w3.org/XML/1998/namespace`,`http://camunda.org/schema/1.0/bpmn`,`http://camunda.org/schema/zeebe/1.0`,`http://camunda.org/schema/modeler/1.0`,`http://bpmn.io/schema/bpmn/biocolor/1.0`,`http://www.omg.org/spec/BPMN/non-normative/color/1.0`]);function vendorOf(e,t){let n=`${t.slice(0,4e3)} ${e.attrs.exporter??``}`.toLowerCase();return n.includes(`signavio`)?`Signavio`:n.includes(`bizagi`)?`Bizagi`:`BPMN 2.0`}function vendorName(e){let t=e.toLowerCase();return t.includes(`signavio`)?`Signavio`:t.includes(`bizagi`)?`Bizagi`:e}function attributeNamespace(e,t){let n=t.indexOf(`:`);return n<0||t.startsWith(`xmlns`)?null:e.scope.get(t.slice(0,n))??``}function meaningful(e){return e.text.trim()!==``||e.children.length>0||Object.entries(e.attrs).some(([e,t])=>!e.startsWith(`xmlns`)&&t.trim()!==``)}function fromBpmnDialect(e){let t=J(e);if(t.local!==`definitions`||t.ns!==Pa)throw new DialectError(p(`app.import.failure.notBpmnXml`));let n=vendorOf(t,e),r=new Map,drop=(e,t)=>{let n=vendorName(e),i=r.get(n)??new Map;i.set(t,(i.get(t)??0)+1),r.set(n,i)},clean=e=>{for(let t of Object.keys(e.attrs)){let n=attributeNamespace(e,t);n===null||Fa.has(n)||(e.attrs[t].trim()!==``&&drop(n,t),delete e.attrs[t])}e.children=e.children.filter(e=>{if(Fa.has(e.ns))return!0;if(e.local===`signavioMetaData`||e.local===`signavioDiagramMetaData`)(e.attrs.metaValue??``).trim()!==``&&drop(e.ns,e.attrs.metaKey??e.local);else if(meaningful(e)){let t=e.children.filter(e=>meaningful(e)),n=Object.entries(e.attrs).filter(([e,t])=>!e.startsWith(`xmlns`)&&t.trim()!==``).map(([e])=>e);if(n.length>0)for(let t of n)drop(e.ns,t.includes(`:`)?t.slice(t.indexOf(`:`)+1):t);else if(t.length>0)for(let n of t)drop(e.ns,n.local);else drop(e.ns,e.local)}return!1});for(let t of e.children)clean(t);e.children=e.children.filter(e=>e.local!==`extensionElements`||e.ns!==Pa||e.children.length!==0||e.text.trim()!==``)};clean(t);let i=new Set,collect=e=>{i.add(e.prefix);for(let t of Object.keys(e.attrs))t.includes(`:`)&&!t.startsWith(`xmlns`)&&i.add(t.slice(0,t.indexOf(`:`)));e.children.forEach(collect)};collect(t);let prune=e=>{for(let t of Object.keys(e.attrs))t.startsWith(`xmlns:`)&&!Fa.has(e.attrs[t])&&!i.has(t.slice(6))&&delete e.attrs[t];e.children.forEach(prune)};prune(t);let a=[],o=new Set(findElements(t,`BPMNShape`).map(e=>e.attrs.bpmnElement));if(o.size===0||findElements(t,`BPMNPlane`).length===0)throw new DialectError(p(`app.import.failure.noPositions`));let s=findElements(t,`dataObject`).filter(e=>o.has(e.attrs.id));if(s.length>0){for(let e of s){let n={id:`${e.attrs.id}_reference`,dataObjectRef:e.attrs.id};e.attrs.name&&(n.name=e.attrs.name);let r={...e,name:prefixed(e,`dataObjectReference`),local:`dataObjectReference`,attrs:n,children:[]};delete e.attrs.name;let i=findParent(t,e);i?.children.splice(i.children.indexOf(e)+1,0,r);for(let n of findElements(t,`BPMNShape`))n.attrs.bpmnElement===e.attrs.id&&(n.attrs.bpmnElement=r.attrs.id);for(let n of[...findElements(t,`association`),...findElements(t,`sourceRef`),...findElements(t,`targetRef`)])n.attrs.sourceRef===e.attrs.id&&(n.attrs.sourceRef=r.attrs.id),n.attrs.targetRef===e.attrs.id&&(n.attrs.targetRef=r.attrs.id),n.text.trim()===e.attrs.id&&(n.text=r.attrs.id)}a.push({level:`assumed`,message:p(`app.import.note.dataObjects`,{count:s.length})})}for(let[e,t]of r){let n=[...t.values()].reduce((e,t)=>e+t,0),r=[...t.entries()].map(([e,t])=>t>1?`${e} (${t})`:e).join(`, `);a.push({level:`lost`,message:p(`app.import.note.vendorData`,{vendor:e,total:n,list:r})})}return t.attrs.id||(t.attrs.id=`Definitions_1`),{xml:`<?xml version="1.0" encoding="UTF-8"?>\n${ut(t)}\n`,format:n,notes:a}}function prefixed(e,t){return e.prefix?`${e.prefix}:${t}`:t}function findElements(e,t){let n=[],visit=e=>{e.local===t&&n.push(e),e.children.forEach(visit)};return visit(e),n}function findParent(e,t){if(e.children.includes(t))return e;for(let n of e.children){let e=findParent(n,t);if(e)return e}}var Ia={nbsp:` `,lt:`<`,gt:`>`,quot:`"`,apos:`'`,amp:`&`};function decodeEntities(e){return e.replace(/&(#x[0-9a-f]+|#\d+|[a-z]+);/gi,(e,t)=>t.startsWith(`#x`)||t.startsWith(`#X`)?String.fromCodePoint(parseInt(t.slice(2),16)):t.startsWith(`#`)?String.fromCodePoint(parseInt(t.slice(1),10)):Ia[t.toLowerCase()]??e)}function htmlToText(e){return decodeEntities(e.replace(/<br\s*\/?>/gi,`
3
+ `).replace(/<\/(div|p|li|h[1-6]|tr)>/gi,`
4
+ `).replace(/<[^>]*>/g,``)).replace(/ /g,` `).replace(/[ \t]+\n/g,`
5
+ `).replace(/\n{3,}/g,`
6
+
7
+ `).trim()}function plainLabel(e,t){return t?htmlToText(e):e.trim()}var DrawioError=class extends Error{},La=33554432;function inflateLimited(e){let t=[],n=0;new jr(e=>{if(n+=e.length,n>La)throw new DrawioError(p(`app.import.failure.pageTooLarge`));t.push(e)}).push(e,!0);let r=new Uint8Array(n),i=0;for(let e of t)r.set(e,i),i+=e.length;return r}function styleOf(e){let t=new Map,n=new Set;for(let r of e.split(`;`)){if(!r.trim())continue;let e=r.indexOf(`=`);e<0?n.add(r.trim().toLowerCase()):t.set(r.slice(0,e).trim(),r.slice(e+1).trim())}return{map:t,tokens:n}}function bytesOfBase64(e){let t=atob(e.replace(/\s+/g,``)),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return n}function graphModelOf(e){let t=e.children.find(e=>e.local===`mxGraphModel`);if(t)return t;let n=e.text.trim();if(!n)throw new DrawioError(p(`app.import.failure.pageEmpty`));try{return n.startsWith(`<`)?J(n):n.startsWith(`%3C`)?J(decodeURIComponent(n)):J(decodeURIComponent(Ar(inflateLimited(bytesOfBase64(n)))))}catch(e){throw e instanceof DrawioError?e:new DrawioError(p(`app.import.failure.compressedPage`))}}var number=(e,t=0)=>{let n=Number(e);return e!==void 0&&e!==``&&Number.isFinite(n)?n:t};function cellsOf$1(e){let t=e.children.find(e=>e.local===`root`);if(!t)throw new DrawioError(p(`app.import.failure.pageNoCells`));let n=[];for(let e of t.children){let t=e.local===`object`||e.local===`UserObject`,r=t?e.children.find(e=>e.local===`mxCell`):e.local===`mxCell`?e:void 0;if(!r)continue;let i=r.children.find(e=>e.local===`mxGeometry`),a=(i?.children.find(e=>e.local===`Array`&&e.attrs.as===`points`)?.children??[]).filter(e=>e.local===`mxPoint`).map(e=>({x:number(e.attrs.x),y:number(e.attrs.y)})),o={};if(t)for(let[t,n]of Object.entries(e.attrs))[`id`,`label`].includes(t)||(o[t]=n);n.push({id:(t?e.attrs.id:r.attrs.id)??``,value:t?e.attrs.label??r.attrs.value??``:r.attrs.value??``,style:r.attrs.style??``,vertex:r.attrs.vertex===`1`,edge:r.attrs.edge===`1`,parent:r.attrs.parent??``,source:r.attrs.source??``,target:r.attrs.target??``,geometry:{x:number(i?.attrs.x),y:number(i?.attrs.y),width:number(i?.attrs.width),height:number(i?.attrs.height),points:a},properties:o,hidden:r.attrs.visible===`0`})}return n}e(cellsOf$1,`cellsOf`);var Ra={service:`service`,user:`user`,script:`script`,send:`send`,receive:`receive`,manual:`manual`,businessrule:`businessRule`},za={general:void 0,none:void 0,message:`message`,timer:`timer`,escalation:`escalation`,conditional:`conditional`,link:`link`,error:`error`,cancel:`cancel`,compensation:`compensation`,signal:`signal`,multiple:`multiple`,parallelmultiple:`parallelMultiple`,terminate:`terminate`},Ba=new Set([``,`rect`,`rectangle`,`ellipse`,`rhombus`,`text`,`note`,`swimlane`,`partialrectangle`,`table`,`tablerow`]);function gatewayKind(e){let t=(e.map.get(`symbol`)??``).toLowerCase(),n=(e.map.get(`outline`)??``).toLowerCase();return t.includes(`parallelmultiple`)||t.includes(`event`)||t.includes(`multiple`)&&n!==`none`?`eventBasedGateway`:t.includes(`exclusive`)?`exclusiveGateway`:t.includes(`parallel`)?`parallelGateway`:t.includes(`complex`)?`complexGateway`:t.includes(`inclusive`)||n===`end`?`inclusiveGateway`:n===`catching`?`eventBasedGateway`:`exclusiveGateway`}function eventFields(e){let t=(e.map.get(`outline`)??`standard`).toLowerCase(),n=(e.map.get(`symbol`)??`general`).toLowerCase(),r=n in za,i=r?za[n]:void 0,a={standard:[`startEvent`],eventint:[`startEvent`],eventnonint:[`startEvent`,!1],end:[`endEvent`],throwing:[`intermediateThrowEvent`],catching:[`intermediateCatchEvent`],boundint:[`boundaryEvent`],boundnonint:[`boundaryEvent`,!1]},[o,s]=a[t]??a.standard;return{kind:o,fields:{definition:i,interrupting:s},unknownSymbol:r?void 0:n}}function loopOf$1(e){if(e.map.get(`isLoopMultiInstance`)===`1`)return e.map.get(`isSequential`)===`1`?`sequential`:`parallel`;if(e.map.get(`isLoopStandard`)===`1`)return`standard`}e(loopOf$1,`loopOf`);function classify$1(e,t){let n=(t.map.get(`shape`)??``).toLowerCase(),{tokens:r}=t,i=n.startsWith(`mxgraph.bpmn.`);if(r.has(`swimlane`)||n===`swimlane`||n===`table`)return{kind:`pool`,fields:{horizontal:t.map.get(`horizontal`)===`0`||n===`table`}};if(n===`tablerow`)return{kind:`lane`,fields:{horizontal:!0}};if(n.startsWith(`mxgraph.bpmn.shape`)||n.startsWith(`mxgraph.bpmn.event`)){let e=eventFields(t);return{kind:e.kind,fields:e.fields,note:e.unknownSymbol?{level:`lost`,message:p(`app.import.note.unknownEvent`,{symbol:e.unknownSymbol})}:void 0}}return n.startsWith(`mxgraph.bpmn.gateway`)?{kind:gatewayKind(t)}:n===`datastore`||i&&/store/.test(n)?{kind:`dataStore`}:i&&n.startsWith(`mxgraph.bpmn.data`)?{kind:`dataObject`,fields:{collection:t.map.get(`isCollection`)===`1`}}:i&&n.startsWith(`mxgraph.bpmn.annotation`)||n===`partialrectangle`?{kind:`textAnnotation`}:i&&n.startsWith(`mxgraph.bpmn.task`)?taskClass(t):n===`ext`?t.map.get(`double`)===`1`?{kind:`transaction`}:number(t.map.get(`strokeWidth`))>=3?{kind:`callActivity`}:t.map.get(`dashed`)===`1`?{kind:`eventSubProcess`}:taskClass(t):Ba.has(n)?r.has(`rhombus`)||n===`rhombus`?{kind:`exclusiveGateway`,note:{level:`assumed`,message:p(`app.import.note.diamond`,{shape:quoted(e)})}}:r.has(`ellipse`)||n===`ellipse`?{pending:`event`}:r.has(`text`)||n===`text`?{kind:`textAnnotation`,note:{level:`assumed`,message:p(`app.import.note.freeText`,{shape:quoted(e)})}}:n===`note`?{kind:`textAnnotation`,note:{level:`assumed`,message:p(`app.import.note.noteShape`,{shape:quoted(e)})}}:t.map.get(`rounded`)===`1`?taskClass(t):{kind:`task`,note:{level:`assumed`,message:p(`app.import.note.rectangle`,{shape:quoted(e)})}}:{}}e(classify$1,`classify`);function taskClass(e){let t=(e.map.get(`bpmnShapeType`)??``).toLowerCase();if(t===`call`)return{kind:`callActivity`,fields:{loop:loopOf$1(e)}};if(t===`transaction`)return{kind:`transaction`};if(t===`subprocess`)return{kind:`subProcess`};if(t===`event`)return{kind:`eventSubProcess`};let n=(e.map.get(`taskMarker`)??``).toLowerCase();return{kind:`task`,fields:{taskType:st(Ra,n)??`task`,loop:loopOf$1(e)}}}function quoted(e){let t=plainLabel(e.value,!0).replace(/\s+/g,` `);return t?`"${t}"`:p(`app.import.note.anUnlabelledShape`)}function describeUnmapped(e,t){let n=t.map.get(`shape`)??[...t.tokens][0]??`rectangle`,r=plainLabel(e.value,!0).replace(/\s+/g,` `);return r?p(`app.import.note.unmappedLabelled`,{label:r,shape:n}):p(`app.import.note.unlabelledShape`,{shape:n,count:1})}function kindOfEdge(e){let t=e.map.get(`dashed`)===`1`,n=e.map.get(`startArrow`)??``,r=e.map.get(`endArrow`)??`classic`;return t&&(n===`oval`||e.map.get(`endFill`)===`0`&&r!==`none`)?`message`:t?`association`:`sequence`}function fromDrawio(e){let t=J(e),n=[],r;if(t.local===`mxGraphModel`)r=t;else{let e=t.children.filter(e=>e.local===`diagram`);if(e.length===0)throw new DrawioError(p(`app.import.failure.noPages`));let i=e.map(e=>({page:e,model:graphModelOf(e)})),a=i.find(e=>cellsOf$1(e.model).some(e=>e.vertex))??i[0];r=a.model;for(let e of i){if(e===a)continue;let t=cellsOf$1(e.model).filter(e=>e.vertex).length;n.push({level:`unmapped`,message:p(`app.import.note.otherPage`,{page:e.page.attrs.name??p(`app.import.note.untitled`),shapes:t,count:t})})}}let i=cellsOf$1(r).filter(e=>e.id!==``&&!e.hidden),a=new Map(i.map(e=>[e.id,e])),o=new Map(i.map(e=>[e.id,styleOf(e.style)])),s=new Map,originOf=(e,t=0)=>{let n=s.get(e.id);if(n)return n;let r=a.get(e.parent),i=r&&r.vertex&&t<50?originOf(r,t+1):{x:0,y:0},o={x:i.x+e.geometry.x,y:i.y+e.geometry.y};return s.set(e.id,o),o},offsetOf=e=>{let t=a.get(e.parent);return t&&t.vertex?originOf(t):{x:0,y:0}},c=new Map,l=new Set;for(let e of i){let t=o.get(e.id);e.vertex&&t.tokens.has(`edgelabel`)&&a.get(e.parent)?.edge&&c.set(e.parent,plainLabel(e.value,t.map.get(`html`)===`1`));let n=a.get(e.parent);e.vertex&&n&&(o.get(n.id)?.map.get(`shape`)??``).toLowerCase()===`tablerow`&&l.add(e.id)}let u=[],d=[],f=[],m=new Map,h=0;for(let e of i){if(!e.vertex)continue;let t=o.get(e.id);if(t.tokens.has(`edgelabel`)&&a.get(e.parent)?.edge)continue;let r=a.get(e.parent);if(l.has(e.id)&&(o.get(e.id)?.map.get(`shape`)??``).toLowerCase()===`partialrectangle`){let n=u.find(e=>e.id===r?.id);n&&!n.name&&e.value&&(n.name=plainLabel(e.value,t.map.get(`html`)===`1`));continue}let i=classify$1(e,t);if(!i.kind&&!i.pending){let n=t.map.get(`shape`)??[...t.tokens][0]??`rectangle`;f.push({text:describeUnmapped(e,t),shape:n,labelled:plainLabel(e.value,!0)!==``});continue}i.note&&n.push(i.note);let s=originOf(e),c=t.map.get(`html`)===`1`,p=e.properties.documentation??e.properties.tooltip,g={id:e.id,kind:i.kind??`startEvent`,name:plainLabel(e.value,c),x:s.x,y:s.y,width:e.geometry.width||100,height:e.geometry.height||80,parent:r&&r.vertex?r.id:void 0,documentation:p?plainLabel(p,!1):void 0,...i.fields};u.push(g),i.pending&&d.push(g);let _=Object.keys(e.properties).filter(e=>![`documentation`,`tooltip`,`placeholders`,`link`].includes(e));if(_.length>0){h+=1;for(let e of _)m.set(e,(m.get(e)??0)+1)}}nestLanes(u);let g=[];for(let e of i){if(!e.edge)continue;let t=o.get(e.id),n=plainLabel(e.value,t.map.get(`html`)===`1`)||c.get(e.id)||``,r=offsetOf(e),i=(t.map.get(`edgeStyle`)??``).toLowerCase(),a=t.map.get(`startArrow`)??``;g.push({id:e.id,kind:kindOfEdge(t),source:e.source,target:e.target,name:n,points:e.geometry.points.map(e=>({x:e.x+r.x,y:e.y+r.y})),orthogonal:i.includes(`orthogonal`)||i.includes(`elbow`),isDefault:a===`dash`||a===`dashThin`,documentation:e.properties.documentation})}for(let e of d){let t=g.filter(t=>t.target===e.id&&t.kind===`sequence`).length,r=g.filter(t=>t.source===e.id&&t.kind===`sequence`).length;e.kind=t===0&&r>0?`startEvent`:r===0&&t>0?`endEvent`:`intermediateThrowEvent`,(e.width>80||e.height>80)&&(e.width=e.height=36);let i=e.kind===`startEvent`?p(`app.import.note.aStartEvent`):e.kind===`endEvent`?p(`app.import.note.anEndEvent`):p(`app.import.note.anIntermediateEvent`);n.push({level:`assumed`,message:p(`app.import.note.circle`,{shape:e.name?`"${e.name.replace(/\s+/g,` `)}"`:p(`app.import.note.anUnlabelledCircle`),kind:i})})}let _=f.filter(e=>e.labelled);for(let e of _)n.push({level:`unmapped`,message:e.text});let v=f.filter(e=>!e.labelled),y=new Map;for(let e of v)y.set(e.shape,(y.get(e.shape)??0)+1);for(let[e,t]of y)n.push({level:`unmapped`,message:p(`app.import.note.unlabelledShape`,{count:t,shape:e})});return m.size>0&&n.push({level:`lost`,message:p(`app.import.note.customData`,{count:h,keys:[...m.keys()].join(`, `)})}),{nodes:u,flows:g,notes:n}}var Va=67108864,Ha=268435456,ZipError=class extends Error{};function isZip(e){return e.length>4&&e[0]===80&&e[1]===75&&(e[2]===3||e[2]===5)&&(e[3]===4||e[3]===6)}function isOleFile(e){return e.length>8&&[208,207,17,224,161,177,26,225].every((t,n)=>e[n]===t)}function readZip(e,t){let n=0;try{let r=Pr(e,{filter(e){if(!t(e.name))return!1;if(e.originalSize>Va)throw new ZipError(p(`app.import.failure.entryTooLarge`,{name:e.name}));if(n+=e.originalSize,n>Ha)throw new ZipError(p(`app.import.failure.archiveTooLarge`));return!0}});return new Map(Object.entries(r))}catch(e){throw e instanceof ZipError?e:new ZipError(p(`app.import.failure.notZip`))}}function textOfEntry(e,t){let n=e.get(t);return n?Ar(n).replace(/^/,``):void 0}var VisioError=class extends Error{},Ua=96,Wa=8.5,Ga=25,key=e=>e.toLowerCase().replace(/[^a-z0-9]/g,``);function cellsOf(e){let t=new Map;for(let n of e.children){if(n.local!==`Cell`||!n.attrs.N)continue;let e=Number(n.attrs.V);n.attrs.V!==void 0&&n.attrs.V!==``&&Number.isFinite(e)&&t.set(n.attrs.N,e)}return t}function propsOf(e){let t=new Map;for(let n of e.children.filter(e=>e.local===`Section`&&e.attrs.N===`Property`))for(let e of n.children.filter(e=>e.local===`Row`)){let n=e.children.find(e=>e.local===`Cell`&&e.attrs.N===`Value`);e.attrs.N&&n?.attrs.V!==void 0&&t.set(key(e.attrs.N),n.attrs.V)}return t}function rowsOf$1(e){let t=e.children.find(e=>e.local===`Section`&&e.attrs.N===`Geometry`);if(!t)return[];let n=[];for(let e of t.children.filter(e=>e.local===`Row`)){let t=e.attrs.T??``;if(!e.attrs.T&&e.attrs.N)continue;if(t!==`MoveTo`&&t!==`LineTo`)return null;let r=cellsOf(e);n.push({type:t,x:r.get(`X`)??0,y:r.get(`Y`)??0})}return n}e(rowsOf$1,`rowsOf`);function relationTargets(e,t){let n=new Map,r=textOfEntry(e,t);if(!r)return n;for(let e of J(r).children.filter(e=>e.local===`Relationship`))e.attrs.Id&&e.attrs.Target&&n.set(e.attrs.Id,e.attrs.Target);return n}function shapesOf$1(e,t,n,r){if(e)for(let i of e.children.filter(e=>e.local===`Shape`)){let e=cellsOf(i),a={x:(e.get(`PinX`)??0)-(e.get(`LocPinX`)??0),y:(e.get(`PinY`)??0)-(e.get(`LocPinY`)??0)},o=i.attrs.Master??i.attrs.MasterShape,s=i.children.find(e=>e.local===`Shapes`);r.push({id:i.attrs.ID,master:(o?t.get(o):void 0)??(i.attrs.NameU??i.attrs.Name??``).replace(/\.\d+$/,``),text:(i.children.find(e=>e.local===`Text`)?.text??``).replace(/\s+$/g,``).replace(/^\s+/,``),cells:e,props:propsOf(i),rows:rowsOf$1(i)??[],node:i,origin:n,group:i.attrs.Type===`Group`}),s&&shapesOf$1(s,t,{x:n.x+a.x,y:n.y+a.y},r)}}e(shapesOf$1,`shapesOf`);var Ka=[[`parallelmultiple`,`parallelMultiple`],[`multiple`,`multiple`],[`message`,`message`],[`timer`,`timer`],[`error`,`error`],[`escalation`,`escalation`],[`cancel`,`cancel`],[`compensation`,`compensation`],[`conditional`,`conditional`],[`rule`,`conditional`],[`link`,`link`],[`signal`,`signal`],[`terminate`,`terminate`]],qa=[[`service`,`service`],[`send`,`send`],[`receive`,`receive`],[`user`,`user`],[`manual`,`manual`],[`businessrule`,`businessRule`],[`script`,`script`]];function first(e,t){for(let n of t){let t=e.get(n);if(t!==void 0)return key(t)}return``}function loopOf(e){let t=first(e,[`looptype`,`loop`,`loopcharacteristics`]);if(t.includes(`multi`)||t.includes(`parallel`))return`parallel`;if(t.includes(`sequential`))return`sequential`;if(t.includes(`standard`)||t===`loop`)return`standard`}function gatewayOf(e,t){let n=first(e,[`gatewaytype`,`type`])||key(t);return n.includes(`event`)?`eventBasedGateway`:n.includes(`parallel`)?`parallelGateway`:n.includes(`inclusive`)?`inclusiveGateway`:n.includes(`complex`)?`complexGateway`:`exclusiveGateway`}function classify(e){let t=key(e.master);if(e.cells.has(`BeginX`)&&e.cells.has(`EndX`))return t.includes(`message`)?{flow:`message`}:t.includes(`association`)?{flow:`association`}:t.includes(`default`)?{flow:`sequence`,isDefault:!0}:t.includes(`sequence`)||t.includes(`conditional`)?{flow:`sequence`}:{flow:`sequence`,generic:!0};if(t.includes(`pool`)||t.includes(`swimlane`))return{kind:`pool`,fields:{horizontal:(e.cells.get(`Width`)??0)>=(e.cells.get(`Height`)??0)}};if(t===`lane`||t.startsWith(`lane`))return{kind:`lane`,fields:{horizontal:!0}};if(t.includes(`startevent`)||t.includes(`intermediateevent`)||t.includes(`endevent`)||t===`event`){let n=first(e.props,[`eventtype`,`type`]),r=t.includes(`start`)||n===`start`?`start`:t.includes(`end`)||n===`end`?`end`:`intermediate`,i=first(e.props,[`triggerorresult`,`trigger`,`result`,`eventtrigger`,`eventdefinition`]),a=Ka.find(([e])=>i.includes(e))?.[1],o=[...e.props.entries()].some(([e,t])=>(e.includes(`throw`)||key(t).includes(`throw`))&&key(t)!==`false`&&key(t)!==`no`),s=r===`start`?`startEvent`:r===`end`?`endEvent`:o?`intermediateThrowEvent`:`intermediateCatchEvent`,c=first(e.props,[`interrupting`,`iscancelactivity`]);return{kind:s,fields:{definition:a,interrupting:c===`false`||c===`no`?!1:void 0}}}if(t.includes(`gateway`))return{kind:gatewayOf(e.props,e.master)};if(t.includes(`callactivity`))return{kind:`callActivity`,fields:{loop:loopOf(e.props)}};if(t.includes(`subprocess`)){let t=first(e.props,[`subprocesstype`,`type`]);return{kind:t.includes(`transaction`)?`transaction`:t.includes(`event`)?`eventSubProcess`:`subProcess`,fields:{loop:loopOf(e.props)}}}if(t===`task`||t.startsWith(`task`)){let t=first(e.props,[`tasktype`,`type`]);return{kind:`task`,fields:{taskType:qa.find(([e])=>t.includes(e))?.[1]??`task`,loop:loopOf(e.props)}}}return t.includes(`datastore`)?{kind:`dataStore`}:t.includes(`dataobject`)||t.includes(`datainput`)||t.includes(`dataoutput`)?{kind:`dataObject`,fields:{collection:first(e.props,[`iscollection`,`collection`])===`true`}}:t.includes(`annotation`)?{kind:`textAnnotation`}:null}function pixels(e){return e*Ua}function fromVisio(e){let t=readZip(e,e=>/^visio\/.*\.(xml|rels)$/i.test(e));if(!t.has(`visio/document.xml`))throw new VisioError(p(`app.import.failure.notVisio`));let n=textOfEntry(t,`visio/pages/pages.xml`);if(!n)throw new VisioError(p(`app.import.failure.noVisioPages`));let r=new Map,i=textOfEntry(t,`visio/masters/masters.xml`);if(i)for(let e of J(i).children.filter(e=>e.local===`Master`))r.set(e.attrs.ID,e.attrs.NameU??e.attrs.Name??``);let a=relationTargets(t,`visio/pages/_rels/pages.xml.rels`),o=J(n).children.filter(e=>e.local===`Page`).map(e=>{let t=e.children.find(e=>e.local===`PageSheet`),n=e.children.find(e=>e.local===`Rel`),r=n?a.get(n.attrs[`r:id`]??n.attrs.id??``):void 0,i=r?`visio/pages/${r.replace(/^\.?\//,``)}`:``;return{name:e.attrs.NameU??e.attrs.Name??`untitled`,height:(t?cellsOf(t).get(`PageHeight`):void 0)??Wa,file:i}}).map(e=>({page:e,text:textOfEntry(t,e.file)})).filter(e=>e.text!==void 0).map(e=>({...e,root:J(e.text)})).map(e=>({...e,shapes:[]}));for(let e of o)shapesOf$1(e.root.children.find(e=>e.local===`Shapes`),r,{x:0,y:0},e.shapes);let s=o.find(e=>e.shapes.length>0);if(!s)throw new VisioError(p(`app.import.failure.noShapes`));let c=[];for(let e of o)e!==s&&e.shapes.length!==0&&c.push({level:`unmapped`,message:p(`app.import.note.otherVisioPage`,{page:e.page.name,shapes:e.shapes.length,count:e.shapes.length})});let l=s.page.height,u=[],d=[],f=new Map,m=s.root.children.find(e=>e.local===`Connects`);for(let e of m?.children.filter(e=>e.local===`Connect`)??[]){let t=e.attrs.FromSheet,n=f.get(t)??{};(e.attrs.FromCell??``).startsWith(`Begin`)&&(n.source=e.attrs.ToSheet),(e.attrs.FromCell??``).startsWith(`End`)&&(n.target=e.attrs.ToSheet),f.set(t,n)}let h=0,g=0,_=[],label=e=>e.text.replace(/\s+/g,` `);for(let e of s.shapes){(e.cells.get(`Angle`)??0)!==0&&(g+=1);let t=classify(e);if(t&&`flow`in t){let n={x:pixels(e.cells.get(`BeginX`)??0),y:pixels(l-(e.cells.get(`BeginY`)??0))},r={x:pixels(e.cells.get(`EndX`)??0),y:pixels(l-(e.cells.get(`EndY`)??0))},i=e.origin.x+(e.cells.get(`PinX`)??0)-(e.cells.get(`LocPinX`)??0),a=e.origin.y+(e.cells.get(`PinY`)??0)-(e.cells.get(`LocPinY`)??0),o=e.rows.slice(1,-1).map(e=>({x:pixels(i+e.x),y:pixels(l-(a+e.y))})).filter(e=>!(Math.abs(e.x-n.x)<.5&&Math.abs(e.y-n.y)<.5)&&!(Math.abs(e.x-r.x)<.5&&Math.abs(e.y-r.y)<.5));t.generic&&(h+=1);let s=f.get(e.id)??{};d.push({id:e.id,kind:t.flow,source:s.source??``,target:s.target??``,name:label(e),points:o,isDefault:t.isDefault})}else if(t&&`kind`in t){let n=e.cells.get(`Width`)??1,r=e.cells.get(`Height`)??1,i=e.origin.x+(e.cells.get(`PinX`)??0)-(e.cells.get(`LocPinX`)??n/2),a=e.origin.y+(e.cells.get(`PinY`)??0)-(e.cells.get(`LocPinY`)??r/2);u.push({id:e.id,kind:t.kind,name:label(e),x:pixels(i),y:pixels(l-a-r),width:pixels(n),height:pixels(r),...t.fields})}else(!e.group||t)&&_.push(label(e)?p(`app.import.note.unmappedLabelled`,{label:label(e),shape:e.master||p(`app.import.note.aShape`)}):p(`app.import.note.unlabelledMaster`,{shape:e.master||p(`app.import.note.shape`)}))}c.push(..._.map(e=>({level:`unmapped`,message:e}))),h>0&&c.push({level:`assumed`,message:p(`app.import.note.genericConnectors`,{count:h})}),g>0&&c.push({level:`lost`,message:p(`app.import.note.rotated`,{count:g})}),nestLanes(u);let v=u.filter(e=>[`task`,`callActivity`,`subProcess`,`transaction`,`eventSubProcess`].includes(e.kind));for(let e of u){if(e.kind!==`intermediateCatchEvent`||d.some(t=>t.kind===`sequence`&&t.target===e.id))continue;let t=centreOf(e),n=v.map(e=>({candidate:e,distance:distanceToRect(e,t)})).filter(e=>e.distance<=Ga).sort((e,t)=>e.distance-t.distance)[0];n&&(e.kind=`boundaryEvent`,e.host=n.candidate.id)}return{nodes:u,flows:d,notes:c}}function textOf$3(e){return(typeof e==`string`?e:new TextDecoder(`utf-8`).decode(e)).replace(/^/,``)}e(textOf$3,`textOf`);function refuse(e,t=[]){return{ok:!1,message:e,notes:t}}function finish(e,t){if(t.nodes.length===0)return refuse(p(`app.import.failure.nothingToImport`,{format:e}),t.notes);let n=buildBpmn(t);return{ok:!0,bpmn:n.xml,report:{format:e,summary:n.summary,notes:n.notes,needsLayout:!1}}}function bizagiPackage(){return p(`app.import.failure.bizagiPackage`)}var Ja=/\.(bpmn|bpmn20\.xml)$/i;function dialect(e,t=[]){let n=fromBpmnDialect(e),r=[...t,...n.notes];return{ok:!0,bpmn:n.xml,report:{format:n.format,summary:summaryOf(n.xml),notes:r,needsLayout:!1}}}function summaryOf(e){let t=J(e),count=e=>v(t,e).length;return{elements:[`task`,`userTask`,`serviceTask`,`scriptTask`,`sendTask`,`receiveTask`,`manualTask`,`businessRuleTask`,`callActivity`,`subProcess`,`transaction`,`startEvent`,`endEvent`,`intermediateCatchEvent`,`intermediateThrowEvent`,`boundaryEvent`,`exclusiveGateway`,`parallelGateway`,`inclusiveGateway`,`complexGateway`,`eventBasedGateway`].reduce((e,t)=>e+count(t),0),flows:count(`sequenceFlow`)+count(`messageFlow`),pools:count(`participant`),lanes:count(`lane`)}}function importDiagram(e){try{if(typeof e.data!=`string`){if(isOleFile(e.data))return refuse(p(`app.import.failure.visioBinary`,{name:e.name}));if(isZip(e.data)){if(/\.bpm$/i.test(e.name)){let t=readZip(e.data,e=>Ja.test(e)),n=[...t.keys()].sort()[0],r=n?textOfEntry(t,n):void 0;return r?dialect(r,[{level:`assumed`,message:p(`app.import.note.packageImported`,{name:n??``})}]):refuse(bizagiPackage())}return finish(`Visio`,fromVisio(e.data))}}let t=textOf$3(e.data);if(/\.bpm$/i.test(e.name)&&!/^\s*</.test(t))return refuse(bizagiPackage());let n=J(t);return n.local===`mxfile`||n.local===`mxGraphModel`?finish(`draw.io`,fromDrawio(t)):n.local===`definitions`?dialect(t):n.local===`Package`&&n.ns.toLowerCase().includes(`xpdl`)?refuse(p(`app.import.failure.xpdl`)):refuse(p(`app.import.failure.unknownFormat`,{name:e.name}))}catch(e){if(e instanceof DrawioError||e instanceof VisioError||e instanceof DialectError||e instanceof ZipError||e instanceof xe)return refuse(e.message);throw e}}function groupedNotes(e){let pick=t=>e.notes.filter(e=>e.level===t).map(e=>e.message);return{unmapped:pick(`unmapped`),assumed:pick(`assumed`),lost:pick(`lost`)}}var Ya={elements:`element`,flows:`flow`,pools:`pool`,lanes:`lane`};function title(e){return p(`app.import.noteTitle.${e}`)}function part(e,t){return p(`app.import.count.${Ya[t]}`,{count:e})}function summaryLine(e){let{elements:t,flows:n,pools:r,lanes:i}=e.summary,a=[part(t,`elements`),part(n,`flows`)];return r>0&&a.push(part(r,`pools`)),i>0&&a.push(part(i,`lanes`)),p(`app.import.summary`,{format:e.format,counts:a.join(`, `)})}function noteHeading(e,t){return p(`app.import.noteHeading`,{count:t,title:title(e).toLowerCase()})}function importedFileName(e){let t=e.split(/[\\/]/).pop()??``;return/\.bpmn$/i.test(t)?`${t.replace(/\.bpmn$/i,``)}.penstock.bpmn`:`${t.replace(/\.(drawio|dio|vsdx|bpmn20\.xml|bpm|xml|xpdl)$/i,``)||p(`app.import.importedName`)}.bpmn`}function needsPan(e,t,n){let r=e.width*(1-n)/2,i=e.height*(1-n)/2,a=t.x>=e.x+r&&t.y>=e.y+i&&t.x+t.width<=e.x+e.width-r&&t.y+t.height<=e.y+e.height-i;return n>=1?t.x>=e.x+e.width||t.y>=e.y+e.height||t.x+t.width<=e.x||t.y+t.height<=e.y:!a}function panTarget(e,t,n){let r=e.width-n.left-n.right,i=t.x+t.width/2,a=t.y+t.height/2;return{x:i-n.left-r/2,y:a-e.height/2,width:e.width,height:e.height}}function stepsFor(e,t){return e.flatMap((e,n)=>e.elementId===t?[n]:[])}function barText(e,t){return e<0?p(`app.scenarios.barText.steps`,{count:t}):p(`app.scenarios.barText.stepOf`,{at:e+1,total:t})}function moveStep(e,t,n){return t===0?-1:e<0?0:Math.min(t-1,Math.max(0,e+n))}function parseJson(e){try{return JSON.parse(e)}catch{return null}}function reasonOf(e){if(e.status===0)return e.body||p(`app.live.unableToConnect`);let t=parseJson(e.body);if(t&&typeof t==`object`){let e=[t.message,t.detail,t.title].find(e=>typeof e==`string`);if(typeof e==`string`)return e}return e.body?e.body.slice(0,300):p(`app.live.unableToCompleteTask`,{status:e.status})}function listUserTasksCall(e,t){if(e===`CAMUNDA_8`){let e={state:`CREATED`};return t&&(e.processInstanceKey=t),{method:`POST`,path:`/user-tasks/search`,body:JSON.stringify({filter:e})}}return{method:`GET`,path:`/task${t?`?processInstanceId=${encodeURIComponent(t)}`:``}`}}function parseUserTasks(e,t){if(t.status<200||t.status>=300)return[];let n=parseJson(t.body);return e===`CAMUNDA_8`?(Array.isArray(n?.items)?n.items:[]).map(e=>({id:String(e?.userTaskKey??e?.key??``),elementId:String(e?.elementId??``),name:typeof e?.name==`string`?e.name:null,processInstanceId:String(e?.processInstanceKey??e?.processInstanceId??``),assignee:typeof e?.assignee==`string`?e.assignee:null,formKey:typeof e?.formKey==`string`?e.formKey:null})).filter(e=>!!e.id):(Array.isArray(n)?n:[]).map(e=>({id:String(e?.id??``),elementId:String(e?.taskDefinitionKey??e?.elementId??``),name:typeof e?.name==`string`?e.name:null,processInstanceId:String(e?.processInstanceId??``),assignee:typeof e?.assignee==`string`?e.assignee:null,formKey:typeof e?.formKey==`string`?e.formKey:null})).filter(e=>!!e.id)}function readUserTaskCall(e,t){return e===`CAMUNDA_8`?{method:`GET`,path:`/user-tasks/${encodeURIComponent(t)}`}:{method:`GET`,path:`/task/${encodeURIComponent(t)}`}}function parseUserTask(e,t){if(t.status<200||t.status>=300)return null;let n=parseJson(t.body);if(!n||typeof n!=`object`)return null;if(e===`CAMUNDA_8`){let e=String(n.userTaskKey??n.key??``);return e?{id:e,elementId:String(n.elementId??``),name:typeof n.name==`string`?n.name:null,processInstanceId:String(n.processInstanceKey??n.processInstanceId??``),assignee:typeof n.assignee==`string`?n.assignee:null,formKey:typeof n.formKey==`string`?n.formKey:null}:null}let r=String(n.id??``);return r?{id:r,elementId:String(n.taskDefinitionKey??n.elementId??``),name:typeof n.name==`string`?n.name:null,processInstanceId:String(n.processInstanceId??``),assignee:typeof n.assignee==`string`?n.assignee:null,formKey:typeof n.formKey==`string`?n.formKey:null}:null}function readTaskDeployedFormCall(e){return{method:`GET`,path:`/task/${encodeURIComponent(e)}/deployed-form`}}function parseDeployedForm(e){if(e.status<200||e.status>=300)return null;let t=parseJson(e.body);return t&&typeof t==`object`&&!Array.isArray(t)?t:null}function readTaskFormKeyCall(e){return{method:`GET`,path:`/task/${encodeURIComponent(e)}/form`}}function parseTaskFormKey(e){if(e.status<200||e.status>=300)return null;let t=parseJson(e.body);return typeof t?.key==`string`?t.key:null}function completeUserTaskCall(e,t,n){return e===`CAMUNDA_8`?{method:`POST`,path:`/user-tasks/${encodeURIComponent(t)}/completion`,body:JSON.stringify({variables:n})}:{method:`POST`,path:`/task/${encodeURIComponent(t)}/complete`,body:JSON.stringify({variables:sr(n)})}}function parseTaskCompletion(e){return e.status>=200&&e.status<300?{ok:!0}:{ok:!1,problem:reasonOf(e)}}var Xa=2;function segmentCuts(e,t,n){let r=Math.min(e.x,t.x),i=Math.max(e.x,t.x),a=Math.min(e.y,t.y),o=Math.max(e.y,t.y);return n.filter(e=>i>=e.x+Xa&&r<=e.x+e.width-Xa&&o>=e.y+Xa&&a<=e.y+e.height-Xa).length}function countCuts(e,t){let n=0;for(let r=0;r+1<e.length;r++)n+=segmentCuts(e[r],e[r+1],t);return n}function segmentCrossesBox(e,t,n,r){return Math.max(e.x,t.x)>n.x+r&&Math.min(e.x,t.x)<n.x+n.width-r&&Math.max(e.y,t.y)>n.y+r&&Math.min(e.y,t.y)<n.y+n.height-r}function axisRun(e,t){let n=Math.abs(e.y-t.y)<.5;return n?{flat:n,at:e.y,from:Math.min(e.x,t.x),to:Math.max(e.x,t.x)}:Math.abs(e.x-t.x)<.5?{flat:n,at:e.x,from:Math.min(e.y,t.y),to:Math.max(e.y,t.y)}:null}function grazesBox(e,t){let n=e.flat?t.x:t.y,r=e.flat?t.x+t.width:t.y+t.height;return Math.min(e.to,r)-Math.max(e.from,n)<40?!1:(e.flat?[t.y,t.y+t.height]:[t.x,t.x+t.width]).some(t=>Math.abs(t-e.at)<=6)}function projectOnSegment(e,t,n){let r=n.x-t.x,i=n.y-t.y,a=r*r+i*i,o=a===0?0:Math.max(0,Math.min(1,((e.x-t.x)*r+(e.y-t.y)*i)/a));return{x:t.x+o*r,y:t.y+o*i}}function pathLength(e){let t=0;for(let n=1;n<e.length;n++)t+=Math.abs(e[n].x-e[n-1].x)+Math.abs(e[n].y-e[n-1].y);return t}function isOrthogonal(e){return e.every((t,n)=>n===0||t.x===e[n-1].x||t.y===e[n-1].y)}function crossesAt(e,t,n,r){let side=(e,t,n)=>(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),i=side(n,r,e),a=side(n,r,t),o=side(e,t,n),s=side(e,t,r);return i*a<0&&o*s<0}function pathCrossings(e,t){let n=0;for(let r=0;r+1<e.length;r++)for(let i=0;i+1<t.length;i++)crossesAt(e[r],e[r+1],t[i],t[i+1])&&n++;return n}function dropRepeats(e){let t=[];return e.forEach(e=>{let n=t[t.length-1];n&&n.x===e.x&&n.y===e.y||t.push(e)}),t}function dropBacktracks(e){let t=[...e];for(let e=0;e+2<t.length;){let[n,r,i]=[t[e],t[e+1],t[e+2]],a=n.y===r.y&&r.y===i.y&&(r.x-n.x)*(i.x-r.x)<0,o=n.x===r.x&&r.x===i.x&&(r.y-n.y)*(i.y-r.y)<0;!a&&!o?e+=1:(t.splice(e+1,1),e>0&&--e)}return t}function rectsOverlap(e,t){return e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height}function withinRect(e,t,n){return e.x>=t.x-n&&e.x<=t.x+t.width+n&&e.y>=t.y-n&&e.y<=t.y+t.height+n}function rectClears(e,t){return e.x+e.width<=t.x||t.x+t.width<=e.x||e.y+e.height<=t.y||t.y+t.height<=e.y}function rectEncloses(e,t){return t.x>=e.x&&t.y>=e.y&&t.x+t.width<=e.x+e.width&&t.y+t.height<=e.y+e.height}function rectStraddles(e,t){return!rectEncloses(t,e)&&!rectClears(e,t)}function rectUnion(e,t){let n=Math.min(e.x,t.x),r=Math.min(e.y,t.y);return{x:n,y:r,width:Math.max(e.x+e.width,t.x+t.width)-n,height:Math.max(e.y+e.height,t.y+t.height)-r}}function runsOf(e){let t=[];for(let n=0;n+1<e.length;n++){let r=e[n],i=e[n+1];r.y===i.y&&r.x!==i.x?t.push({axis:`y`,at:r.y,from:Math.min(r.x,i.x),to:Math.max(r.x,i.x)}):r.x===i.x&&r.y!==i.y&&t.push({axis:`x`,at:r.x,from:Math.min(r.y,i.y),to:Math.max(r.y,i.y)})}return t}function sharedEnds(e,t){if(e.length===0||t.length===0)return[];let n=[e[0],e[e.length-1]],r=[t[0],t[t.length-1]];return n.filter(e=>r.some(t=>Math.abs(t.x-e.x)<1&&Math.abs(t.y-e.y)<1))}function mergedRuns(e,t,n=12){let r=runsOf(e),i=runsOf(t),a=sharedEnds(e,t),o={across:0,down:0};return r.forEach(e=>i.forEach(t=>{if(e.axis!==t.axis||Math.abs(e.at-t.at)>n)return;let r=Math.max(e.from,t.from),i=Math.min(e.to,t.to);if(i<=r)return;let s=a.every(t=>{let n=e.axis===`y`?t.x:t.y,a=e.axis===`y`?t.y:t.x;return Math.abs(a-e.at)>48||n<r-48||n>i+48})?i-r:Math.max(0,i-r-96);e.axis===`y`?o.across+=s:o.down+=s})),o}function mergedRun(e,t,n=12){let r=mergedRuns(e,t,n);return r.across+r.down}function mergesWith(e,t){return mergedRun(e,t)>=40}function backtracksIn(e){let t=0;for(let n=0;n+2<e.length;n++){let[r,i,a]=[e[n],e[n+1],e[n+2]],o=r.y===i.y&&i.y===a.y&&(i.x-r.x)*(a.x-i.x)<0,s=r.x===i.x&&i.x===a.x&&(i.y-r.y)*(a.y-i.y)<0;(o||s)&&(t+=1)}return t}function jogsIn(e,t=()=>!0,n=40,r=()=>!0){let i=0;for(let a=0;a+3<e.length;a++){let[o,s,c,l]=[e[a],e[a+1],e[a+2],e[a+3]],u=o.x===s.x&&c.x===l.x&&s.y===c.y,d=o.y===s.y&&c.y===l.y&&s.x===c.x,f=u?Math.abs(s.x-c.x):d?Math.abs(s.y-c.y):0;if(!u&&!d||f<=.5||f>=n)continue;let settles=n=>{let i=[o,s,c,l].map(e=>u?{x:n,y:e.y}:{x:e.x,y:n});return a===0&&!r(i[0],0)||a+3===e.length-1&&!r(i[3],e.length-1)?!1:t(i[0],i[3])};(settles(u?o.x:o.y)||settles(u?l.x:l.y))&&(i+=1)}return i}var Za=1e3,Qa=new Set([`bpmn:TextAnnotation`,`bpmn:DataObjectReference`,`bpmn:DataStoreReference`,`bpmn:Group`]),$a=new Set([`bpmn:TextAnnotation`,`bpmn:Group`]);function isConnection(e){return!!e.waypoints}function isLabelLike(e){return e.type===`label`||!!e.labelTarget}function isBoundaryEvent(e){return e.type===`bpmn:BoundaryEvent`}function isMessageFlow(e){return e.type===`bpmn:MessageFlow`}function poolOf$1(e){let t=e;for(;t;){if(t.type===`bpmn:Participant`)return t;t=t.parent}return null}e(poolOf$1,`poolOf`);function findDuplicateConnections(e){let t=new Map,n=[];return e.forEach(e=>{if(!e.source||!e.target)return;let r=`${e.type}:${e.source.id}:${e.target.id}`;t.has(r)?n.push(e):t.set(r,e)}),n}var eo=null;function codeLinksReloaded(){let e=eo;eo=null,e&&e()}async function explainedCodeLinks(e){let t=Y(),n=await t.getLicense().catch(()=>null);return!Qi(n)&&(await t.requestFeature(g.CODE_LINKS)&&(eo=e),!0)}function useTheme(){let[e,t]=n($i);return f(()=>{na(e)},[e]),{theme:e,setTheme:r(e=>{t(e)},[]),toggleDark:r(()=>{let e=oa();t(e)},[]),isDark:sa[e].isDark,availableThemes:sa}}var to=a(void 0);function ThemeProvider({children:e}){let t=useTheme();return u(to.Provider,{value:t,children:e})}var no={"label-required":[`name`],"compat/implementation":[`taskDefinitionType`,`scriptExpression`,`decisionId`],"compat/sequence-flow-condition":[`conditionExpression`,`conditionType`],"compat/user-task-definition":[`formType`],"compat/zeebe-user-task":[`userTaskImplementation`],"compat/user-task-form":[`formType`,`formId`,`customFormKey`],"compat/start-event-form":[`formId`,`customFormKey`],"compat/called-element":[`targetProcessId`],"compat/subscription":[`messageSubscriptionCorrelationKey`],"compat/history-time-to-live":[`historyTimeToLive`],"compat/message-reference":[`messageRef`,`messageName`],"compat/signal-reference":[`signalRef`,`signalName`],"compat/error-reference":[`errorRef`,`errorCode`],"compat/escalation-reference":[`escalationRef`,`escalationCode`],"compat/timer":[`timerEventDefinitionValue`,`timerEventDefinitionType`],"conditional-flows":[`conditionExpression`],"missing-implementation":[`taskDefinitionType`,`externalTopic`,`javaClass`,`delegateExpression`,`expression`],"never-thrown":[`errorRef`,`errorCode`],"worker-fetch":[`taskDefinitionType`,`externalTopic`,`javaClass`,`delegateExpression`],"writer-unread":[`taskDefinitionType`,`externalTopic`,`javaClass`,`delegateExpression`],"lost-update":[`loopCondition`,`loopMaximum`,`loopTestBefore`],"late-read":[`taskDefinitionType`,`externalTopic`,`javaClass`,`delegateExpression`],"near-name":[`taskDefinitionType`,`externalTopic`,`javaClass`,`delegateExpression`],"mapping-order":[`inputMapping`,`outputMapping`],"implicit-job-type":[`taskDefinitionType`],"variable-field":[`inputMapping`,`outputMapping`,`conditionExpression`],"variable-unknown":[`inputMapping`,`outputMapping`,`conditionExpression`]};function entriesFor(e){return no[e]??[]}var ro=`.bio-properties-panel-input, textarea, select, [contenteditable="true"], button:not(.bio-properties-panel-feel-icon)`;function focusEntry(e,t){for(let n of t){let t=e.querySelector(`[data-entry-id="${n}"]`);if(!t)continue;let r=t.closest(`.bio-properties-panel-group`),i=!!r&&!r.querySelector(`.bio-properties-panel-group-entries.open`);i&&r.querySelector(`.bio-properties-panel-group-header`)?.click(),t.scrollIntoView?.({block:`center`});let focus=()=>t.querySelector(ro)?.focus();return i&&r?focusWhenShown(r,focus,io):focus(),!0}return!1}var io=30;function focusWhenShown(e,t,n){requestAnimationFrame(()=>{n<=0||e.querySelector(`.bio-properties-panel-group-entries.open`)?t():focusWhenShown(e,t,n-1)})}var ao=[`input`,`keyup`,`mouseup`,`select`];function plainInput(e,t){let n=e.parentElement,r=document.createElement(`span`),i=document.createElement(`span`),a=document.createElement(`span`);r.className=e.tagName===`TEXTAREA`?`suggestion-ghost suggestion-ghost--block type-input`:`suggestion-ghost suggestion-ghost--line type-input`,r.setAttribute(`aria-hidden`,`true`),i.className=`suggestion-ghost__typed`,a.className=`suggestion-ghost__rest`,r.append(i,a),r.hidden=!0,e.after(r),n?.classList.add(`suggestion-host`);let place=()=>{let t=getComputedStyle(e);r.style.top=`${e.offsetTop}px`,r.style.left=`${e.offsetLeft}px`,r.style.width=`${e.offsetWidth}px`,r.style.height=`${e.offsetHeight}px`,r.style.padding=t.padding,r.style.borderWidth=t.borderWidth,r.style.borderStyle=`solid`,r.style.borderColor=`transparent`,r.style.boxSizing=`border-box`,r.style.whiteSpace=e.tagName===`TEXTAREA`?`pre-wrap`:`pre`},caretAtEnd=()=>{let t=e.value.length;return(e.selectionStart??t)===t&&(e.selectionEnd??t)===t};for(let n of ao)e.addEventListener(n,t);return{anchor:e,text:()=>e.value,caretAtEnd,busy:()=>!1,append(t){e.value=`${e.value}${t}`,e.dispatchEvent(new Event(`input`,{bubbles:!0}))},showGhost(t){r.hidden&&place(),i.textContent=e.value,a.textContent=t,r.hidden=!1,r.scrollLeft=e.scrollLeft,r.scrollTop=e.scrollTop},hideGhost(){r.hidden=!0},dispose(){for(let n of ao)e.removeEventListener(n,t);r.remove(),n?.classList.remove(`suggestion-host`)}}}var oo=Ai.define(),so=Ei.define({create:()=>null,update(e,t){for(let e of t.effects)if(e.is(oo))return e.value;return e}}),GhostWidget=class extends Pi{suffix;constructor(e){super(),this.suffix=e}eq(e){return e.suffix===this.suffix}toDOM(){let e=document.createElement(`span`);return e.className=`suggestion-ghost suggestion-ghost--inline`,e.setAttribute(`aria-hidden`,`true`),e.textContent=this.suffix,e}ignoreEvent(){return!0}},co=Di.decorations.compute([so],e=>{let t=e.field(so);return t===null?Oi.none:Oi.set(Oi.widget({widget:new GhostWidget(t),side:1}).range(e.doc.length))}),lo=new WeakMap,uo=[so,co,Di.updateListener.of(e=>{if(e.docChanged||e.selectionSet||e.focusChanged){let t=e.view;queueMicrotask(()=>lo.get(t)?.())}})],fo=new WeakSet;function expressionEditor(e,t){return fo.has(e)||(fo.add(e),e.dispatch({effects:Ai.appendConfig.of(uo)})),lo.set(e,t),{anchor:e.dom,text:()=>e.state.doc.toString(),caretAtEnd(){let{main:t}=e.state.selection;return t.empty&&t.head===e.state.doc.length},busy:()=>Fi(e.state)===`active`,append(t){let n=e.state.doc.length;e.dispatch({changes:{from:n,insert:t},selection:{anchor:n+t.length},userEvent:`input.complete`})},showGhost(t){e.state.field(so,!1)!==t&&e.dispatch({effects:oo.of(t)})},hideGhost(){e.state.field(so,!1)&&e.dispatch({effects:oo.of(null)})},dispose(){lo.delete(e),e.dom.isConnected&&e.state.field(so,!1)&&e.dispatch({effects:oo.of(null)})}}}function textOf$2(e){return e.tagName===`INPUT`||e.tagName===`TEXTAREA`?e.value:Di.findFromDOM(e)?.state.doc.toString()??null}e(textOf$2,`textOf`);function adapterFor(e,t){if(e.tagName===`INPUT`||e.tagName===`TEXTAREA`)return plainInput(e,t);let n=Di.findFromDOM(e);return n?expressionEditor(n,t):null}function certaintyOf(e){return e.probability??1}function topSuggestion(e){let t=null;for(let n of e)(t===null||certaintyOf(n)>certaintyOf(t))&&(t=n);return t}var po=/^=\s*/;function ghostSuffix(e,t){let n=e.replace(po,``);return t.length>n.length&&t.startsWith(n)?t.slice(n.length):null}function suggestionKey(e,t){return JSON.stringify([e,t])}var SuggestedField=class{adapter;spec;entryId;host;suggestion=null;key=null;showing=null;focused=!1;cancel=null;constructor(e,t,n,r){this.adapter=e,this.spec=t,this.entryId=n,this.host=r}focusIn(){this.focused||(this.focused=!0,this.restart())}focusOut(){this.focused&&(this.focused=!1,this.stop())}restart(){this.stop(),this.focused&&this.host.enabled()&&(this.cancel=this.host.schedule(()=>this.ask(),150))}stop(){this.cancel?.(),this.cancel=null,this.suggestion=null,this.key=null,this.hide()}input(){this.refresh()}accept(){if(this.showing===null||this.suggestion===null)return!1;let{value:e}=this.suggestion;return this.adapter.append(this.showing),this.suggestion=null,this.hide(),this.host.announce(p(`app.suggestions.status.added`,{value:e})),!0}dismiss(){return this.showing===null||this.key===null?!1:(this.host.dismiss(this.key),this.suggestion=null,this.key=null,this.hide(),this.host.announce(p(`app.suggestions.status.dismissed`)),!0)}explain(){return this.showing===null||this.suggestion===null?!1:(this.host.explain(this,this.suggestion),!0)}dispose(){this.stop(),this.focused=!1,this.adapter.dispose()}ask(){if(this.cancel=null,!this.focused||!this.host.enabled())return;let e=this.host.elementId(),t=this.host.provider();if(e===null||t===null)return;let n=suggestionKey(e,this.entryId);if(this.host.dismissed(n))return;let r=this.spec.named===null?this.adapter.text():this.host.namedText(this.spec.named);r!==null&&(this.key=n,this.suggestion=this.suggestionFor(t,e,r),this.refresh())}suggestionFor(e,t,n){if(this.spec.transform===!0){let r=topSuggestion(e.suggest({task:`expression`,elementId:t,field:n}));if(r!==null)return r}return topSuggestion(e.suggest({task:this.spec.task,elementId:t,field:n}))}refresh(){if(!this.focused||!this.host.enabled()||this.suggestion===null||this.adapter.busy()||!this.adapter.caretAtEnd()){this.hide();return}let e=ghostSuffix(this.adapter.text(),this.suggestion.value);if(e===null){this.hide();return}let t=this.showing===null;this.showing=e,this.adapter.showGhost(e),t&&this.host.announce(p(`app.suggestions.status.offered`,{value:this.suggestion.value}))}hide(){this.showing!==null&&(this.showing=null,this.adapter.hideGhost())}},mo=new Set([`resultVariable`,`expressionResultVariable`,`decisionRefResultVariable`,`scriptResultVariable`]),ho=[/-output-\d+-target$/,/-outMapping-\d+-target$/,/-outputParameter-\d+-name$/,/-dataOutput-\d+-name$/],go=/^(.*-input-\d+)-source$/,_o=/^(.*-inMapping-\d+)-source$/,vo=/^(.*-inMapping-\d+)-sourceExpression$/;function fieldSpecFor(e){if(mo.has(e)||ho.some(t=>t.test(e)))return{task:`output-name`,named:null};let t=go.exec(e);if(t)return{task:`input-source`,named:`${t[1]}-target`,transform:!0};let n=_o.exec(e);if(n)return{task:`input-source`,named:`${n[1]}-target`};let r=vo.exec(e);return r?{task:`expression`,named:`${r[1]}-target`}:null}function controlOf(e){return e.querySelector(`.cm-editor`)??e.querySelector(`input[type="text"], input:not([type]), textarea`)}var unitLabel=(e,t)=>e===null?``:t(`app.suggestions.unit.${e}`);function conversionLine(e,t){return t(`app.suggestions.reason.kindConvert`,{from:unitLabel(e.from,t),to:unitLabel(e.to,t),factor:e.factor??``})}function recognitionLines(e,t){switch(e.kind){case`convert`:return[conversionLine(e,t)];case`wholeMinorUnits`:return[conversionLine(e,t),t(`app.suggestions.reason.kindWholeMinorUnits`,{to:unitLabel(e.to,t)})];case`isoDuration`:return[...e.from===e.to?[]:[conversionLine(e,t)],t(`app.suggestions.reason.kindIsoDuration`)];case`durationText`:return[t(`app.suggestions.reason.kindDurationText`)];case`numberFromText`:return[t(`app.suggestions.reason.kindNumberFromText`)];case`textFromValue`:return[t(`app.suggestions.reason.kindTextFromValue`)];case`durationFromText`:return[t(`app.suggestions.reason.kindDurationFromText`)];case`constant`:return[t(e.constantOrigin===`diagram`?`app.suggestions.reason.constantInDiagram`:`app.suggestions.reason.constantInProject`,{text:e.constant??``})];case`identity`:return[]}}var yo=4;function wordFor(e){let t=`app.suggestions.reason.${e}`,n=p(t);return n===t?p(`app.suggestions.reason.other`):n}function percentOf(e){return Math.round(e*100)}function explanationLines(e){if(e.recognition)return recognitionLines(e.recognition,p);let t=[...e.reasons].sort((e,t)=>Math.abs(t.contribution)-Math.abs(e.contribution));return[...new Set(t.map(e=>wordFor(e.feature)))].slice(0,yo)}function Explanation({anchor:e,suggestion:t,onClose:n}){let r=explanationLines(t);return u(fi,{anchor:e,label:p(`app.suggestions.explain.title`),onClose:n,width:280,class:`suggestion-explain`,children:[u(`p`,{class:`suggestion-explain__title type-section-heading`,children:p(`app.suggestions.explain.title`)}),u(`p`,{class:`suggestion-explain__value type-input`,children:t.value}),u(`p`,{class:`suggestion-explain__origin type-help`,children:p(`app.suggestions.origin.${t.origin}`)}),t.probability!==null&&u(`p`,{class:`suggestion-explain__likelihood type-help`,children:p(`app.suggestions.explain.likelihood`,{percent:percentOf(t.probability)})}),r.length>0&&u(`ul`,{class:`suggestion-explain__reasons`,children:r.map(e=>u(`li`,{class:`type-help`,children:e}))}),u(`p`,{class:`suggestion-explain__keys type-help`,children:p(`app.suggestions.explain.keys`)})]})}function windowSchedule(e,t){let n=window.setTimeout(e,t);return()=>window.clearTimeout(n)}function plain(e){return!e.ctrlKey&&!e.metaKey&&!e.altKey&&!e.shiftKey}function explainKey(e){return e.code===`KeyE`&&e.altKey&&e.shiftKey&&!e.ctrlKey&&!e.metaKey}var FieldSuggestions=class{options;fields=new Map;dismissedKeys=new Set;root=null;observer=null;focused=null;open=null;on;constructor(e){this.options=e,this.on=e.enabled??ra()}attach(e){this.root=e,e.addEventListener(`focusin`,this.onFocusIn),e.addEventListener(`focusout`,this.onFocusOut),window.addEventListener(`keydown`,this.onKeyDown,!0),this.observer=new MutationObserver(()=>this.scan()),this.observer.observe(e,{childList:!0,subtree:!0}),this.scan()}dispose(){this.observer?.disconnect(),this.observer=null,this.root?.removeEventListener(`focusin`,this.onFocusIn),this.root?.removeEventListener(`focusout`,this.onFocusOut),this.root=null,window.removeEventListener(`keydown`,this.onKeyDown,!0),this.closeExplanation();for(let e of this.fields.values())e.dispose();this.fields.clear(),this.focused=null}setEnabled(e){this.on=e,e||this.closeExplanation();for(let e of this.fields.values())e.stop();this.focused?.restart()}provider(){return(this.options.provider??la)()}elementId(){return this.options.elementId()}enabled(){return this.on}dismissed(e){return this.dismissedKeys.has(e)}dismiss(e){this.dismissedKeys.add(e)}announce(e){this.options.announce(e)}schedule(e,t){return(this.options.schedule??windowSchedule)(e,t)}explain(e,t){this.openExplanation(e,t)}namedText(e){let t=[...this.root?.querySelectorAll(`[data-entry-id]`)??[]].find(t=>t.dataset.entryId===e),n=t?controlOf(t):null;return n?textOf$2(n):null}scan(){let e=this.root;if(e!==null){for(let t of e.querySelectorAll(`[data-entry-id]`)){let e=t.dataset.entryId??``,n=fieldSpecFor(e);if(n===null)continue;let r=controlOf(t);if(r===null||this.fields.has(r))continue;let i=adapterFor(r,()=>this.fields.get(r)?.input());if(i===null)continue;let a=new SuggestedField(i,n,e,this);this.fields.set(r,a),r.contains(document.activeElement)&&(this.focused=a,a.focusIn())}for(let[t,n]of this.fields)e.contains(t)||(this.focused===n&&(this.focused=null),n.dispose(),this.fields.delete(t))}}fieldAt(e){if(!(e instanceof Node))return null;for(let[t,n]of this.fields)if(t.contains(e))return n;return null}onFocusIn=e=>{let t=this.fieldAt(e.target);t!==null&&(this.focused=t,t.focusIn())};onFocusOut=e=>{let t=this.fieldAt(e.target);t!==null&&(e.relatedTarget instanceof Node&&t.adapter.anchor.contains(e.relatedTarget)||(this.focused===t&&(this.focused=null),t.focusOut(),this.open?.field===t&&this.closeExplanation()))};onKeyDown=e=>{if(e.isComposing)return;if(this.open!==null&&e.key===`Escape`){this.consume(e),this.closeExplanation();return}let t=this.fieldAt(e.target);if(t===null)return;let n=!1;e.key===`Tab`&&plain(e)?n=t.accept():e.key===`Escape`&&plain(e)?n=t.dismiss():explainKey(e)&&(n=t.explain()),n&&this.consume(e)};consume(e){e.preventDefault(),e.stopPropagation()}openExplanation(e,t){this.closeExplanation();let n=document.createElement(`div`);document.body.append(n),this.open={field:e,host:n},c(u(Explanation,{anchor:e.adapter.anchor,suggestion:t,onClose:()=>this.closeExplanation()}),n)}closeExplanation(){if(this.open===null)return;let{host:e}=this.open;this.open=null,c(null,e),e.remove()}};function useFieldSuggestions(e,t,n){let r=s(t);r.current=t;let i=s(n);i.current=n,f(()=>{let t=e.current;if(!t)return;let n=new FieldSuggestions({elementId:()=>r.current,announce:e=>i.current(e)});n.attach(t);let a=Ci(()=>n.setEnabled(ra()));return()=>{a(),n.dispose()}},[e])}var bo=`aeiou`,xo=[[`ational`,`ate`],[`tional`,`tion`],[`enci`,`ence`],[`anci`,`ance`],[`izer`,`ize`],[`abli`,`able`],[`alli`,`al`],[`entli`,`ent`],[`eli`,`e`],[`ousli`,`ous`],[`ization`,`ize`],[`ation`,`ate`],[`ator`,`ate`],[`alism`,`al`],[`iveness`,`ive`],[`fulness`,`ful`],[`ousness`,`ous`],[`aliti`,`al`],[`iviti`,`ive`],[`biliti`,`ble`]],So=[[`icate`,`ic`],[`ative`,``],[`alize`,`al`],[`iciti`,`ic`],[`ical`,`ic`],[`ful`,``],[`ness`,``]],Co=[`al`,`ance`,`ence`,`er`,`ic`,`able`,`ible`,`ant`,`ement`,`ment`,`ent`,`ion`,`ou`,`ism`,`ate`,`iti`,`ous`,`ive`,`ize`],wo=new Set([`s`,`t`]);function isConsonant(e,t){return bo.includes(e[t])?!1:e[t]!==`y`||t===0||!isConsonant(e,t-1)}function measure(e){let t=0,n=0;for(;n<e.length&&isConsonant(e,n);)n+=1;for(;n<e.length;){for(;n<e.length&&!isConsonant(e,n);)n+=1;if(n>=e.length)break;for(;n<e.length&&isConsonant(e,n);)n+=1;t+=1}return t}function hasVowel(e){return[...e].some((t,n)=>!isConsonant(e,n))}function endsDoubleConsonant(e){let t=e.length;return t>=2&&e[t-1]===e[t-2]&&isConsonant(e,t-1)}function endsConsonantVowelConsonant(e){let t=e.length;return t>=3&&isConsonant(e,t-3)&&!isConsonant(e,t-2)&&isConsonant(e,t-1)&&!`wxy`.includes(e[t-1])}function replaceSuffix(e,t,n){return e.slice(0,e.length-t.length)+n}function stepOneA(e){return e.endsWith(`sses`)?replaceSuffix(e,`sses`,`ss`):e.endsWith(`ies`)?replaceSuffix(e,`ies`,`i`):e.endsWith(`ss`)||e.endsWith(`us`)||e.endsWith(`is`)?e:e.endsWith(`s`)?e.slice(0,-1):e}function tidyAfterSuffix(e){return[`at`,`bl`,`iz`].some(t=>e.endsWith(t))?e+`e`:endsDoubleConsonant(e)&&!`lsz`.includes(e[e.length-1])?e.slice(0,-1):measure(e)===1&&endsConsonantVowelConsonant(e)?e+`e`:e}function stepOneB(e){if(e.endsWith(`eed`)){let t=e.slice(0,-3);return measure(t)>0?t+`ee`:e}for(let t of[`ed`,`ing`])if(e.endsWith(t)&&hasVowel(e.slice(0,-t.length)))return tidyAfterSuffix(e.slice(0,-t.length));return e}function stepOneC(e){return e.endsWith(`y`)&&hasVowel(e.slice(0,-1))?e.slice(0,-1)+`i`:e}function applyFirstRule(e,t){let n=t.find(([t])=>e.endsWith(t));if(!n)return e;let r=e.slice(0,e.length-n[0].length);return measure(r)>0?r+n[1]:e}function stepFour(e){let t=Co.find(t=>e.endsWith(t));if(!t)return e;let n=e.slice(0,e.length-t.length);return measure(n)<=1||t===`ion`&&!wo.has(n.slice(-1))?e:n}function stepFive(e){let t=e;if(t.endsWith(`e`)){let e=t.slice(0,-1),n=measure(e);(n>1||n===1&&!endsConsonantVowelConsonant(e))&&(t=e)}return measure(t)>1&&t.endsWith(`ll`)&&(t=t.slice(0,-1)),t}var To=new Map,Eo=1e4;function stemOf(e){if(e.length<=2)return e;let t=To.get(e);if(t!==void 0)return t;let n=stepFive(stepFour(applyFirstRule(applyFirstRule(stepOneC(stepOneB(stepOneA(e))),xo),So)));return To.size>=Eo&&To.clear(),To.set(e,n),n}var Do={version:1,stopWords:[`a`,`an`,`the`,`of`],abbreviations:{addr:[`address`],amt:[`amount`],cnt:[`count`],desc:[`description`],dob:[`birth`,`date`],dt:[`date`],id:[`identifier`],img:[`image`],max:[`maximum`],min:[`minimum`],msg:[`message`],no:[`number`],nr:[`number`],num:[`number`],pct:[`percent`],perc:[`percent`],qty:[`quantity`],tel:[`telephone`],tot:[`total`],ts:[`timestamp`],val:[`value`]},families:{number:[`int`,`integer`,`int32`,`int64`,`long`,`short`,`byte`,`double`,`float`,`float32`,`float64`,`decimal`,`bigdecimal`,`biginteger`,`number`],string:[`string`,`str`,`charsequence`,`char`,`character`],boolean:[`boolean`,`bool`],date:[`date`,`localdate`,`localdatetime`,`datetime`,`instant`,`zoneddatetime`,`offsetdatetime`,`time`,`localtime`,`timestamp`],duration:[`duration`,`timespan`],list:[`list`,`arraylist`,`linkedlist`,`array`,`collection`,`set`,`hashset`,`iterable`,`sequence`]},concepts:[{name:`email`,role:`content`,words:[`email`,`mail`,`e mail`],family:`string`,unit:null},{name:`identifier`,role:`attribute`,words:[`identifier`,`key`,`number`,`code`,`uuid`,`guid`],family:null,unit:null},{name:`flag`,role:`marker`,words:[`flag`,`is`,`has`,`can`,`should`,`was`,`will`,`does`],family:`boolean`,unit:null},{name:`percent`,role:`content`,words:[`percent`,`percentage`],family:`number`,unit:`%`},{name:`rate`,role:`content`,words:[`rate`,`factor`,`ratio`],family:`number`,unit:null},{name:`timeout`,role:`content`,words:[`timeout`,`expiry`,`expiration`,`ttl`],family:`duration`,unit:null},{name:`duration`,role:`content`,words:[`duration`,`period`,`elapsed`,`span`],family:`duration`,unit:null},{name:`count`,role:`content`,words:[`count`,`quantity`,`tally`],family:`number`,unit:null},{name:`amount`,role:`content`,words:[`amount`,`total`,`sum`,`price`,`cost`,`fee`],family:`number`,unit:null},{name:`date`,role:`content`,words:[`date`,`day`],family:`date`,unit:null},{name:`name`,role:`content`,words:[`name`,`title`,`label`],family:`string`,unit:null},{name:`address`,role:`content`,words:[`address`],family:`string`,unit:null},{name:`phone`,role:`content`,words:[`phone`,`telephone`,`mobile`],family:`string`,unit:null},{name:`status`,role:`content`,words:[`status`,`state`],family:`string`,unit:null},{name:`url`,role:`content`,words:[`url`,`link`,`uri`,`href`],family:`string`,unit:null},{name:`description`,role:`content`,words:[`description`,`summary`],family:`string`,unit:null}]},Oo=[`content`,`attribute`,`marker`],ko=[`number`,`string`,`boolean`,`date`,`duration`,`list`],Ao=1,jo=/^[\p{Ll}\p{Lo}\p{N}]+(?: [\p{Ll}\p{Lo}\p{N}]+)*$/u,Mo=/^[\p{Ll}\p{Lo}\p{N}]+$/u,No=class LexiconError extends Error{problems;constructor(e){super(JSON.stringify(e)),this.name=LexiconError.name,this.problems=e}},Po=e(e=>typeof e==`object`&&!!e&&!Array.isArray(e),`isRecord`),isRole=e=>Oo.includes(e),isFamily=e=>ko.includes(e),isWord=e=>typeof e==`string`&&Mo.test(e),phraseKeyOf=e=>e.map(e=>stemOf(e)).join(` `);function stopWordsOf(e,t){let n=new Set;return Array.isArray(e)?(e.forEach((e,r)=>{let i=`stopWords[${r}]`;isWord(e)?n.has(e)?t.push({code:`repeated`,path:i,value:e}):n.add(e):t.push({code:`notWord`,path:i,value:e})}),n):(t.push({code:`notList`,path:`stopWords`}),n)}function abbreviationsOf(e,t){let n=new Map;if(!Po(e))return t.push({code:`notObject`,path:`abbreviations`}),n;for(let[r,i]of Object.entries(e)){let e=`abbreviations.${r}`;isWord(r)?Array.isArray(i)?i.length===0?t.push({code:`emptyList`,path:e}):i.every(isWord)?n.set(r,i):t.push({code:`notWord`,path:e,value:i}):t.push({code:`notList`,path:e}):t.push({code:`notWord`,path:`abbreviations`,value:r})}return n}function typeNamesOf(e,t){let n=new Map;if(!Po(e))return t.push({code:`notObject`,path:`families`}),n;for(let[r,i]of Object.entries(e)){let e=`families.${r}`;isFamily(r)?Array.isArray(i)?i.forEach((i,a)=>{let o=`${e}[${a}]`;isWord(i)?n.has(i)?t.push({code:n.get(i)===r?`repeated`:`owned`,path:o,value:i,other:n.get(i)}):n.set(i,r):t.push({code:`notWord`,path:o,value:i})}):t.push({code:`notList`,path:e}):t.push({code:`unknownFamily`,path:e,value:r})}return n}function wordsOf$3(e,t,n){return Array.isArray(e)?e.length===0?(n.push({code:`emptyList`,path:t}),[]):e.flatMap((e,r)=>typeof e==`string`&&jo.test(e)?[e]:(n.push({code:`notPhrase`,path:`${t}[${r}]`,value:e}),[])):(n.push({code:`notList`,path:t}),[])}e(wordsOf$3,`wordsOf`);function conceptOf(e,t,n){let r=`concepts[${t}]`;if(!Po(e))return n.push({code:`notObject`,path:r}),null;let i=typeof e.name==`string`&&jo.test(e.name)?e.name:null;i===null&&n.push({code:`notPhrase`,path:`${r}.name`,value:e.name});let a=isRole(e.role)?e.role:null;a===null&&n.push({code:`unknownRole`,path:`${r}.role`,value:e.role});let o=wordsOf$3(e.words,`${r}.words`,n);i!==null&&!o.includes(i)&&n.push({code:`nameNotAmongWords`,path:r,value:i});let s=e.family===null||e.family===void 0?null:e.family;s!==null&&!isFamily(s)&&n.push({code:`unknownFamily`,path:`${r}.family`,value:s});let c=e.unit===null||e.unit===void 0?null:e.unit;return c!==null&&(typeof c!=`string`||c.trim()===``)&&n.push({code:`notText`,path:`${r}.unit`,value:c}),i===null||a===null||s!==null&&!isFamily(s)||c!==null&&typeof c!=`string`?null:{name:i,role:a,words:o,family:s,unit:c}}function conceptsOf(e,t){let n=new Map,r=new Map;return Array.isArray(e)?(e.forEach((e,i)=>{let a=conceptOf(e,i,t);a&&(n.has(a.name)&&t.push({code:`repeated`,path:`concepts[${i}]`,value:a.name}),n.set(a.name,a),a.words.forEach((e,n)=>{let o=phraseKeyOf(e.split(` `)),s=r.get(o);s&&s.name!==a.name?t.push({code:`owned`,path:`concepts[${i}].words[${n}]`,value:e,other:s.name}):r.set(o,a)}))}),{concepts:n,phrases:r}):(t.push({code:`notList`,path:`concepts`}),{concepts:n,phrases:r})}function loadLexicon(e){if(!Po(e))throw new No([{code:`notObject`,path:`$`}]);let t=[];e.version!==Ao&&t.push({code:`version`,path:`version`,value:e.version});let n=stopWordsOf(e.stopWords,t),r=abbreviationsOf(e.abbreviations,t),i=typeNamesOf(e.families,t),{concepts:a,phrases:o}=conceptsOf(e.concepts,t);if(t.length>0)throw new No(t);return{stopWords:n,abbreviations:r,typeNames:i,concepts:a,phrases:o,longestPhrase:Math.max(1,...[...o.keys()].map(e=>e.split(` `).length))}}function familyOf(e,t){if(e===null)return null;let n=e.trim().toLowerCase();return n===``?null:n.endsWith(`[]`)?`list`:t.typeNames.get(n.replace(/<.*$/s,``).trim())??null}var Fo=loadLexicon(Do),Io=/^([A-Za-z_]\w*)(?:\.[A-Za-z_]\w*|\[\s*\d+\s*\])*$/,Lo=/^[$#]\{([\s\S]*)\}$/,Ro=[`camunda`,`operaton`];function localName(e){return typeof e==`string`?(e.split(`:`).pop()??``).toLowerCase():``}function text(e){return typeof e==`string`&&e.trim()!==``?e.trim():null}function feelBody(e){return e!==null&&e.startsWith(`=`)?text(e.slice(1)):null}function juelBody(e){let t=e===null?null:Lo.exec(e.trim());return t?text(t[1]):null}function variableOf(e){let t=e===null?null:Io.exec(e);return t?t[1]:null}function mapping(e,t,n,r,i=variableOf(r)){return{elementId:e,direction:t,target:n,expression:r,variable:i}}function resultVariableOf(e){for(let t of Ro){let n=e?.get?.(`${t}:resultVariable`)??e?.$attrs?.[`${t}:resultVariable`];if(text(n)!==null)return text(n)}return null}function extensionMappings(e,t){switch(localName(t?.$type)){case`iomapping`:return[...(t.inputParameters??[]).map(t=>mapping(e,`input`,text(t.target),feelBody(text(t.source)))),...(t.outputParameters??[]).map(t=>mapping(e,`output`,text(t.target),feelBody(text(t.source)),null))];case`inputoutput`:return[...(t.inputParameters??[]).map(t=>mapping(e,`input`,text(t.name),juelBody(text(t.value)))),...(t.outputParameters??[]).map(t=>mapping(e,`output`,text(t.name),juelBody(text(t.value)),null))];case`connector`:return t.inputOutput?extensionMappings(e,t.inputOutput):[];case`in`:{let n=text(t.source);return[mapping(e,`input`,text(t.target),n??juelBody(text(t.sourceExpression)))]}case`out`:return[mapping(e,`output`,text(t.target),text(t.source),null)];case`script`:case`calleddecision`:return text(t.resultVariable)===null?[]:[mapping(e,`result`,text(t.resultVariable),null)];default:return[]}}function elementMappings(e){let t=String(e.id),n=resultVariableOf(e);return[...(e.extensionElements?.values??[]).flatMap(e=>extensionMappings(t,e)),...n===null?[]:[mapping(t,`result`,n,null)]]}function visit(e,t){e?.id&&(t.push(...elementMappings(e)),(e.flowElements??[]).forEach(e=>visit(e,t)))}function mappingsOf(e){let t=[];return(e?.rootElements??[]).filter(e=>e.$type===`bpmn:Process`).forEach(e=>(e.flowElements??[]).forEach(e=>visit(e,t))),t}var zo=/\p{Lu}+(?=\p{Lu}\p{Ll})|\p{Lu}?[\p{Ll}\p{M}]+|\p{Lu}+|\p{N}+|[\p{Lo}\p{Lm}\p{M}]+/gu,Bo=/\[\s*\d+\s*\]/g,Vo=/^\p{N}+$/u;function segmentsOf(e){return e.replace(Bo,`.`).split(`.`).filter(e=>e.length>0)}function wordsOf$2(e){return[...e.matchAll(zo)].map(e=>e[0].toLowerCase())}e(wordsOf$2,`wordsOf`);function nameWordsOf(e){return segmentsOf(e).flatMap(wordsOf$2)}function expandedWords(e,t){return e.flatMap(e=>t.stopWords.has(e)?[]:[...t.abbreviations.get(e)??[e]])}function conceptAt(e,t,n){for(let r=Math.min(n.longestPhrase,e.length-t);r>=1;--r){let i=n.phrases.get(phraseKeyOf(e.slice(t,t+r)));if(i)return{concept:i,length:r}}return null}function unitsOfWords(e,t,n){let r=[],i=0;for(;i<e.length;){let a=conceptAt(e,i,n);if(a)r.push({key:a.concept.name,text:e.slice(i,i+a.length).join(` `),role:a.concept.role,segment:t}),i+=a.length;else{let n=e[i];r.push({key:stemOf(n),text:n,role:Vo.test(n)?`attribute`:`content`,segment:t}),i+=1}}return r}function unitsOf(e,t){return segmentsOf(e).flatMap((e,n)=>unitsOfWords(expandedWords(wordsOf$2(e),t),n,t))}var Ho={names:0,content:0,last:0};function factsOf$1(e,t){let n=unitsOf(e,t),r=n.filter(e=>e.role===`content`);return{keys:[...new Set(n.map(e=>e.key))],contentKeys:[...new Set(r.map(e=>e.key))],last:r.at(-1)?.key??null,weight:0}}e(factsOf$1,`factsOf`);var Vocabulary=class{lexicon;sources=new Map;sourceWeights=new Map;holders=new Map;facts=new Map;statistics=new Map;mass=new Map;total=0;constructor(e=Fo){this.lexicon=e}get size(){return this.facts.size}replaceSource(e,t){let n=this.sources.get(e)??new Set,r=new Set(t);for(let t of n)r.has(t)||this.release(t,e);for(let t of r)n.has(t)||this.retain(t,e);r.size===0?this.sources.delete(e):this.sources.set(e,r)}removeSource(e){this.replaceSource(e,[])}setSourceWeight(e,t){if(!Number.isFinite(t)||t<0)throw RangeError(`sourceWeight:${t}`);this.sourceWeights.set(e,t);for(let t of this.sources.get(e)??[])this.refresh(t)}statisticsOf(e){return{...this.statistics.get(e)??Ho}}weight(e){return 1+Math.log((this.total+1)/((this.mass.get(e)??0)+1))}headness(e){let{content:t,last:n}=this.statisticsOf(e);return(n+1)/(t+2)}retain(e,t){let n=this.holders.get(e)??new Set;n.add(t),this.holders.set(e,n),this.facts.has(e)||this.enter(e),this.refresh(e)}release(e,t){let n=this.holders.get(e);n?.delete(t),n?.size===0?(this.holders.delete(e),this.leave(e)):this.refresh(e)}enter(e){let t=factsOf$1(e,this.lexicon);this.facts.set(e,t),t.keys.forEach(e=>this.bump(e,`names`,1)),t.contentKeys.forEach(e=>this.bump(e,`content`,1)),t.last!==null&&this.bump(t.last,`last`,1)}leave(e){let t=this.facts.get(e);t&&(this.reweigh(t,0),t.keys.forEach(e=>this.bump(e,`names`,-1)),t.contentKeys.forEach(e=>this.bump(e,`content`,-1)),t.last!==null&&this.bump(t.last,`last`,-1),this.facts.delete(e))}refresh(e){let t=this.facts.get(e);t&&this.reweigh(t,this.heaviestOf(e))}heaviestOf(e){return[...this.holders.get(e)??[]].reduce((e,t)=>Math.max(e,this.sourceWeights.get(t)??1),0)}reweigh(e,t){let n=t-e.weight;n!==0&&(e.weight=t,this.total+=n,e.keys.forEach(e=>this.mass.set(e,(this.mass.get(e)??0)+n)))}bump(e,t,n){let r=this.statistics.get(e)??{...Ho};r[t]+=n,this.statistics.set(e,r)}},Uo=.25,Wo=.05;function headOf$1(e,t){let n=e.filter(e=>e.role===`content`);if(n.length===0)return{keys:[],state:`none`};let r=n[n.length-1].key,[i,a]=[...new Set(n.map(e=>e.key))].map(e=>({key:e,score:t.headness(e)+(e===r?Uo:0)})).sort((e,t)=>t.score-e.score);return a&&i.score-a.score<Wo?{keys:[i.key,a.key],state:`ambiguous`}:{keys:[i.key],state:`decided`}}e(headOf$1,`headOf`);function analyse(e,t){let n=unitsOf(e,t.lexicon);return{name:e,units:n,head:headOf$1(n,t)}}function rolesOf(e){return e.units.map(t=>({key:t.key,text:t.text,segment:t.segment,role:roleOf(t,e.head)}))}function roleOf(e,t){return e.role===`marker`?`marker`:e.role===`attribute`?`attribute`:t.keys.includes(e.key)?`head`:`qualifier`}var Go=.1,Ko=4;function matchesOf$1(e,t){let n=Math.max(0,Math.floor(Math.max(e.length,t.length)/2)-1),r=Array.from({length:e.length},()=>!1),i=Array.from({length:t.length},()=>!1),a=0;for(let o=0;o<e.length;o+=1){let s=Math.min(o+n+1,t.length);for(let c=Math.max(0,o-n);c<s;c+=1)if(!i[c]&&e[o]===t[c]){r[o]=!0,i[c]=!0,a+=1;break}}return{aMatched:r,bMatched:i,count:a}}e(matchesOf$1,`matchesOf`);function transpositionsOf(e,t,n,r){let i=0,a=0;for(let o=0;o<e.length;o+=1)if(n[o]){for(;!r[a];)a+=1;e[o]!==t[a]&&(i+=1),a+=1}return i/2}function jaroWinkler$1(e,t){if(e===t)return 1;if(e.length===0||t.length===0)return 0;let{aMatched:n,bMatched:r,count:i}=matchesOf$1(e,t);if(i===0)return 0;let a=(i/e.length+i/t.length+(i-transpositionsOf(e,t,n,r))/i)/3,o=0;for(;o<Ko&&e[o]!==void 0&&e[o]===t[o];)o+=1;return a+o*Go*(1-a)}e(jaroWinkler$1,`jaroWinkler`);var qo={score:.5,margin:.1},Jo={head:1,qualifier:1,attribute:.5,marker:.25},Yo={same:1,ambiguous:.9,none:.8,different:.4},Xo=.9,Zo=5;function wordsOf$1(e,t){let n=new Map;for(let r of rolesOf(e))n.has(r.key)||n.set(r.key,{key:r.key,text:r.text,spelling:r.text.toLowerCase(),role:r.role,weight:t.weight(r.key)*Jo[r.role]});return n}e(wordsOf$1,`wordsOf`);var totalOf=e=>[...e.values()].reduce((e,t)=>e+t.weight,0),normOf=e=>Math.sqrt([...e.values()].reduce((e,t)=>e+t.weight*t.weight,0));function matchTextOf(e){let t=(e.owners??[]).filter(t=>e.name.length>t.length+1&&e.name.startsWith(`${t}_`)).sort((e,t)=>t.length-e.length)[0];return t===void 0?e.name:e.name.slice(t.length+1)}var Qo=/\d/,$o=.4;function mayBeSimilar(e,t){let n=Math.min(e.length,t.length),r=(n/e.length+n/t.length+1)/3;return r+$o*(1-r)>=Xo}function spellingSimilarity(e,t){if(Qo.test(e.spelling)||Qo.test(t.spelling)||!mayBeSimilar(e.spelling,t.spelling))return 0;let n=jaroWinkler$1(e.spelling,t.spelling);return n>=Xo?n:0}function softSimilarity(e,t,n){if(t===0||n.norm===0)return 0;let r=0;for(let t of e.values()){let e=0;for(let r of n.words.values()){let n=t.key===r.key?1:spellingSimilarity(t,r);e=Math.max(e,n*r.weight)}r+=t.weight*e}return Math.min(1,r/(t*n.norm))}function agreementOf(e,t){if(e.state===`none`||t.state===`none`)return`none`;let n=e.keys.some(e=>t.keys.includes(e));return e.state===`decided`&&t.state===`decided`?n?`same`:`different`:n?`ambiguous`:`different`}function conceptFamily(e,t){for(let n of e.units){let e=t.concepts.get(n.key)?.family;if(e)return e}return null}function expectedTypeOf(e,t,n){let r=familyOf(e.expectedType??null,n);if(r)return{family:r,from:`context`};let i=conceptFamily(t,n);return{family:i,from:i?`concept`:null}}function explain(e,t,n,r,i){let a=[],o=[],s=new Set;for(let n of e.values()){let e=t.get(n.key),i={key:e?.key??n.key,text:n.text,role:n.role,weight:n.weight,similarity:e?.similarity??0};e&&r.words.has(e.key)?(a.push(i),s.add(e.key)):o.push(i)}return{shared:a,onlyQuery:o,onlyCandidate:[...r.words.values()].filter(e=>!s.has(e.key)).map(e=>({key:e.key,text:e.text,role:e.role,weight:e.weight,similarity:1})),head:{query:n.head.keys,candidate:r.analysis.head.keys,agreement:agreementOf(n.head,r.analysis.head)},type:{expected:i.family,from:i.from,actual:r.family,fit:i.family!==null&&i.family===r.family?`fits`:`unknown`}}}function insertTop(e,t){let n=e.length;for(;n>0&&(e[n-1].score<t.score||e[n-1].score===t.score&&e[n-1].index>t.index);)--n;n>=Zo||(e.splice(n,0,t),e.length>Zo&&e.pop())}function preferSpelling(e,t,n){let r=e[0],i=e.findIndex(e=>e.candidate.name===t&&r.score-e.score<n);return!r||i<=0?[...e]:[e[i],...e.slice(0,i),...e.slice(i+1)]}function verdictOf(e,t,n){let[r,i]=e;if(!r)return{confident:!1,reason:`none`};if(r.score<n.score)return{confident:!1,reason:`weak`};let a=r.candidate.name===t&&i?.text!==t;return i&&r.score-i.score<n.margin&&!a?{confident:!1,reason:`tie`}:{confident:!0,reason:`confident`}}var CandidateIndex=class{vocabulary;entries;postings=new Map;postingWeights=new Map;spellings=new Map;shared;totals;constructor(e,t){this.vocabulary=t,this.entries=e.map(e=>{let n=matchTextOf(e),r=analyse(n,t),i=wordsOf$1(r,t);return{candidate:e,text:n,words:i,total:totalOf(i),norm:normOf(i),analysis:r,family:familyOf(e.type,t.lexicon)}}),this.entries.forEach((e,t)=>{for(let n of e.words.values()){let e=this.postings.get(n.key),r=this.postingWeights.get(n.key);e&&r?(e.push(t),r.push(n.weight)):(this.postings.set(n.key,[t]),this.postingWeights.set(n.key,[n.weight])),(n.role===`head`||n.role===`qualifier`)&&this.spellings.set(n.text,n.key)}}),this.shared=new Float64Array(this.entries.length),this.totals=Float64Array.from(this.entries,e=>e.total)}answer(e,t={}){let n=analyse(e,this.vocabulary),r=wordsOf$1(n,this.vocabulary),i=totalOf(r),a=normOf(r),o=t.scoring??`jaccard`,s=expectedTypeOf(t,n,this.vocabulary.lexicon),c=this.resolve(r),l=this.creditOf(r,c),u=[];for(let[e,t]of l){let n=this.postings.get(e)??[],r=this.postingWeights.get(e)??[];for(let e=0;e<n.length;e+=1){let i=n[e];this.shared[i]===0&&u.push(i),this.shared[i]+=Math.min(t,r[e])}}let d={...n,head:{...n.head,keys:n.head.keys.map(e=>c.get(e)?.key??e)}},f=[],p={type:0,scope:0};for(let e of u){let n=this.entries[e],c=this.shared[e];if(this.shared[e]=0,t.reachable&&!t.reachable.has(n.candidate.id))p.scope+=1;else if(s.family!==null&&n.family!==null&&s.family!==n.family)p.type+=1;else{let t=o===`jaccard`?c/(i+this.totals[e]-c):softSimilarity(r,a,n),s=f[4];(f.length<Zo||t>s.score||t===s.score&&e<s.index)&&insertTop(f,{index:e,score:t*Yo[agreementOf(d.head,n.analysis.head)]})}}let m=t.thresholds??qo,h=preferSpelling(f.map(({index:e,score:t})=>{let n=this.entries[e];return{candidate:n.candidate,text:n.text,score:t,explanation:explain(r,c,d,n,s)}}),e,m.margin),g=verdictOf(h,e,m);return{query:n,best:h[0]??null,ranked:h,confident:g.confident,reason:g.reason,excluded:p}}creditOf(e,t){let n=new Map;for(let r of e.values()){let e=t.get(r.key);e&&n.set(e.key,Math.max(n.get(e.key)??0,r.weight*e.similarity))}return n}resolve(e){let t=new Map;for(let n of e.values())if(this.postings.has(n.key))t.set(n.key,{key:n.key,similarity:1});else if(n.role===`head`||n.role===`qualifier`){let e=this.nearestSpelling(n.text);e&&t.set(n.key,e)}return t}nearestSpelling(e){let t=null;for(let[n,r]of this.spellings){let i=jaroWinkler$1(e,n);i>=Xo&&(t===null||i>t.similarity)&&(t={key:r,similarity:i})}return t}};function match(e,t,n){return new CandidateIndex(t,n.vocabulary).answer(e,n)}var es=[`kindIdentity`,`kindConvert`,`kindWholeMinorUnits`,`kindIsoDuration`,`kindDurationText`,`kindConstant`,`kindNumberFromText`,`kindTextFromValue`,`kindDurationFromText`,`sourceUnitExplicit`,`targetUnitExplicit`,`targetUnitAtHead`,`logFactor`,`dimensionKnown`,`nameOverlap`,`constantInDiagram`,`constantInProject`,`typeMatch`,`typeUnknown`,`resultSane`,`projectFrequency`];function featureValues(e={}){return Object.fromEntries(es.map(t=>[t,e[t]??0]))}var ts={version:1,dimensions:{ratio:{base:`ratio`,assumed:`ratio`,hints:[`rate`,`ratio`,`factor`,`proportion`],range:[0,1],integral:!1,iso:!1},duration:{base:`second`,assumed:null,hints:[`timeout`,`duration`,`time`,`period`,`delay`,`interval`,`elapsed`,`ttl`,`expiry`,`expiration`],range:[0,31536e3],integral:!1,iso:!0},data:{base:`byte`,assumed:null,hints:[],range:null,integral:!1,iso:!1},money:{base:`dollar`,assumed:null,hints:[],range:null,integral:!0,iso:!1}},units:[{name:`ratio`,dimension:`ratio`,per:1,words:[`fraction`],sample:.25},{name:`percent`,dimension:`ratio`,per:.01,words:[`percent`,`percentage`,`pct`],sample:25},{name:`basisPoint`,dimension:`ratio`,per:1e-4,words:[`basis point`,`bps`],sample:150},{name:`second`,dimension:`duration`,per:1,words:[`second`,`seconds`,`sec`,`secs`],iso:{prefix:`PT`,designator:`S`},sample:30},{name:`millisecond`,dimension:`duration`,per:.001,words:[`millisecond`,`milliseconds`,`ms`,`msec`,`msecs`],sample:1500},{name:`minute`,dimension:`duration`,per:60,words:[`minute`,`minutes`,`mins`],iso:{prefix:`PT`,designator:`M`},sample:5},{name:`hour`,dimension:`duration`,per:3600,words:[`hour`,`hours`,`hr`,`hrs`],iso:{prefix:`PT`,designator:`H`},sample:2},{name:`byte`,dimension:`data`,per:1,words:[`byte`,`bytes`],sample:512},{name:`kilobyte`,dimension:`data`,per:1e3,words:[`kilobyte`,`kilobytes`],sample:4},{name:`megabyte`,dimension:`data`,per:1e6,words:[`megabyte`,`megabytes`],sample:8},{name:`gigabyte`,dimension:`data`,per:1e9,words:[`gigabyte`,`gigabytes`],sample:2},{name:`dollar`,dimension:`money`,per:1,words:[`dollar`,`dollars`],sample:20},{name:`cent`,dimension:`money`,per:.01,words:[`cent`,`cents`],sample:250}]},ns=1,rs=/^[\p{Ll}\p{Lo}\p{N}]+(?: [\p{Ll}\p{Lo}\p{N}]+)*$/u,is=/^[a-z][A-Za-z]*$/,as=[`P`,`PT`],os=/^[YMWDHS]$/,ss=class UnitError extends Error{problems;constructor(e){super(JSON.stringify(e)),this.name=UnitError.name,this.problems=e}},isRecord=e=>typeof e==`object`&&!!e&&!Array.isArray(e),isPhrase=e=>typeof e==`string`&&rs.test(e),isFinitePositive=e=>typeof e==`number`&&Number.isFinite(e)&&e>0,keySequence=e=>e.join(` `),stemsOf=e=>e.split(` `).map(e=>stemOf(e)),keysOf=(e,t)=>unitsOf(e,t).map(e=>e.key);function phrasesOf(e,t,n){return Array.isArray(e)?e.flatMap((e,r)=>isPhrase(e)?[e]:(n.push({code:`notPhrase`,path:`${t}[${r}]`,value:e}),[])):(n.push({code:`notList`,path:t}),[])}function isoOf(e,t,n){if(e==null)return null;if(!isRecord(e))return n.push({code:`notIso`,path:t,value:e}),null;let r=typeof e.prefix==`string`&&as.includes(e.prefix),i=typeof e.designator==`string`&&os.test(e.designator);return r||n.push({code:`notIso`,path:`${t}.prefix`,value:e.prefix}),i||n.push({code:`notIso`,path:`${t}.designator`,value:e.designator}),r&&i?{prefix:e.prefix,designator:e.designator}:null}function unitOf(e,t,n,r){let i=`units[${t}]`;if(!isRecord(e))return r.push({code:`notObject`,path:i}),null;let a=typeof e.name==`string`&&is.test(e.name)?e.name:null;a===null&&r.push({code:`notName`,path:`${i}.name`,value:e.name});let o=typeof e.dimension==`string`&&n.has(e.dimension)?e.dimension:null;o===null&&r.push({code:`unknownDimension`,path:`${i}.dimension`,value:e.dimension}),isFinitePositive(e.per)||r.push({code:`notPositive`,path:`${i}.per`,value:e.per});let s=phrasesOf(e.words,`${i}.words`,r);Array.isArray(e.words)&&s.length===0&&r.push({code:`emptyList`,path:`${i}.words`});let c=isoOf(e.iso,`${i}.iso`,r);return isFinitePositive(e.sample)||r.push({code:`notPositive`,path:`${i}.sample`,value:e.sample}),a===null||o===null||!isFinitePositive(e.per)||!isFinitePositive(e.sample)?null:{name:a,dimension:o,per:e.per,words:s,iso:c,sample:e.sample}}function unitsByName(e,t){let n=new Map;return e.forEach((e,r)=>{n.has(e.name)?t.push({code:`repeated`,path:`units[${r}].name`,value:e.name}):n.set(e.name,e)}),n}function wordsOf(e,t,n){let r=new Map;return e.forEach(e=>{e.words.forEach(i=>{let a=keySequence(keysOf(i,t)),o=a===keySequence(stemsOf(i)),s=a===keySequence(stemsOf(e.name));if(!o&&!s){n.push({code:`shadowed`,path:`units.${e.name}.words`,value:i,other:a});return}let c=r.get(a);c&&c!==e?n.push({code:`owned`,path:`units.${e.name}.words`,value:i,other:c.name}):r.set(a,e)})}),r}function claimHints(e,t,n,r,i){t.forEach(t=>{let a=keySequence(keysOf(t,n)),o=r.get(a);o&&o!==e?i.push({code:`owned`,path:`dimensions.${e}.hints`,value:t,other:o}):r.set(a,e)})}function rangeOf(e,t,n){return e==null?null:Array.isArray(e)&&e.length===2&&e.every(e=>typeof e==`number`&&Number.isFinite(e))&&e[0]<=e[1]?[e[0],e[1]]:(n.push({code:`notRange`,path:t,value:e}),null)}function unitReference(e,t,n,r,i){if(e==null)return null;let a=typeof e==`string`?r.get(e):void 0;return a?a.dimension===t?a:(i.push({code:`dimensionMismatch`,path:n,value:e}),null):(i.push({code:`unknownUnit`,path:n,value:e}),null)}function dimensionOf(e,t,n,r,i,a){let o=`dimensions.${e}`;if(!isRecord(t))return a.push({code:`notObject`,path:o}),null;let s=unitReference(t.base,e,`${o}.base`,n,a);s&&s.per!==1&&a.push({code:`notBase`,path:`${o}.base`,value:s.name}),unitReference(t.assumed,e,`${o}.assumed`,n,a);let c=rangeOf(t.range,`${o}.range`,a);typeof t.integral!=`boolean`&&a.push({code:`notBoolean`,path:`${o}.integral`,value:t.integral}),typeof t.iso!=`boolean`&&a.push({code:`notBoolean`,path:`${o}.iso`,value:t.iso});let l=phrasesOf(t.hints,`${o}.hints`,a);return claimHints(e,l,r,i,a),typeof t.base==`string`?{name:e,base:t.base,assumed:typeof t.assumed==`string`?t.assumed:null,hints:l,range:c,integral:t.integral===!0,iso:t.iso===!0}:null}function longestOf(e){return Math.max(1,...[...e].map(e=>e.split(` `).length))}function loadUnits(e,t){if(!isRecord(e))throw new ss([{code:`notObject`,path:`$`}]);let n=[];e.version!==ns&&n.push({code:`version`,path:`version`,value:e.version}),isRecord(e.dimensions)||n.push({code:`notObject`,path:`dimensions`}),Array.isArray(e.units)||n.push({code:`notList`,path:`units`});let r=new Set(isRecord(e.dimensions)?Object.keys(e.dimensions):[]),i=(Array.isArray(e.units)?e.units.map((e,t)=>unitOf(e,t,r,n)):[]).filter(e=>e!==null),a=unitsByName(i,n),o=wordsOf(i,Fo,n),s=new Map,c=new Map;if(isRecord(e.dimensions))for(let[r,i]of Object.entries(e.dimensions)){let e=dimensionOf(r,i,a,t,s,n);e&&c.set(r,e)}if(n.length>0)throw new ss(n);return{dimensions:c,units:a,words:o,hints:s,longestWord:longestOf(o.keys()),longestHint:longestOf(s.keys())}}var cs=loadUnits(ts,Fo);function keysBySegment(e,t){let n=new Map;for(let r of unitsOf(e,t))n.set(r.segment,[...n.get(r.segment)??[],r.key]);return[...n.keys()].sort((e,t)=>e-t).map(e=>n.get(e)??[])}function matchesOf(e,t){let n=[],r=0;for(;r<e.length;){let i=longestMatchAt(e,r,t);i?(n.push(i),r=i.end+1):r+=1}return n}function longestMatchAt(e,t,n){for(let r=Math.min(n.longestWord,e.length-t);r>=1;--r){let i=n.words.get(keySequence(e.slice(t,t+r)));if(i)return{unit:i,start:t,end:t+r-1}}return null}function hintAtHead(e,t){for(let n=Math.min(t.longestHint,e.length);n>=1;--n){let r=t.hints.get(keySequence(e.slice(e.length-n)));if(r)return r}return null}function distinctUnits(e){return[...new Map(e.map(e=>[e.unit.name,e.unit])).values()]}function explicitReading(e,t,n,r){return{unit:e,unitExplicit:!0,unitAtHead:t,dimension:e.dimension,head:n,words:r}}function hintedReading(e,t,n,r){let i=t.dimensions.get(e)?.assumed;return{unit:i?t.units.get(i)??null:null,unitExplicit:!1,unitAtHead:!1,dimension:e,head:n,words:r}}function readName(e,t,n){let r=keysBySegment(e,n),i=r.at(-1)??[],a=i.at(-1)??null,o=matchesOf(i,t),s=new Set(o.flatMap(e=>Array.from({length:e.end-e.start+1},(t,n)=>e.start+n))),c=[...r.slice(0,-1).flat(),...i.filter((e,t)=>!s.has(t))],l=o.find(e=>e.end===i.length-1);if(l)return explicitReading(l.unit,!0,a,c);let u=hintAtHead(i,t),d=distinctUnits(o.filter(e=>u===null||e.unit.dimension===u));return d.length===1?explicitReading(d[0],!1,a,c):u===null?{unit:null,unitExplicit:!1,unitAtHead:!1,dimension:null,head:a,words:c}:hintedReading(u,t,a,c)}var ls={identity:`kindIdentity`,convert:`kindConvert`,wholeMinorUnits:`kindWholeMinorUnits`,isoDuration:`kindIsoDuration`,durationText:`kindDurationText`,constant:`kindConstant`,numberFromText:`kindNumberFromText`,textFromValue:`kindTextFromValue`,durationFromText:`kindDurationFromText`},us=/^[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)*$/,ds=/^P(?!$)(?:\d+(?:\.\d+)?[YMWD])*(?:T(?=\d)(?:\d+(?:\.\d+)?[HMS])+)?$/;function isIsoDuration(e){return ds.test(e)}function feelNameOf(e){return us.test(e)?e:e.trim()===``||e.includes("`")?null:`\`${e}\``}var fs=e(e=>Number(e.toPrecision(12)),`roundedOf`);function scaled(e,t){if(t===1)return e;let n=fs(t);if(Number.isInteger(n))return`${e} * ${n}`;let r=fs(1/t);return Number.isInteger(r)?`${e} / ${r}`:`${e} * ${n}`}function overlapOf(e,t){let n=new Set(e),r=new Set(t),i=new Set([...n,...r]);return i.size===0?0:[...n].filter(e=>r.has(e)).length/i.size}function accepts(e,t){return e===null||t===null||e===t||e===`string`&&(t===`duration`||t===`date`)}function transformOf(e,t){let n=t.factor??null,r=t.constant??null,i=featureValues({[ls[t.kind]]:1,sourceUnitExplicit:e.source.unitExplicit&&e.source.unit!==null?1:0,targetUnitExplicit:e.target.unitExplicit&&e.target.unit!==null?1:0,targetUnitAtHead:+!!e.target.unitAtHead,logFactor:n===null?0:fs(Math.log10(n)),dimensionKnown:e.target.dimension===null?0:1,nameOverlap:e.overlap,constantInDiagram:+(r?.origin===`diagram`),constantInProject:+(r?.origin===`project`)});return{kind:t.kind,expression:t.expression,resultFamily:t.resultFamily,from:t.from?.name??null,to:t.to?.name??null,factor:n,constant:r?.text??null,constantOrigin:r?.origin??null,features:i}}function identityOf(e){return transformOf(e,{kind:`identity`,expression:e.sourceName,resultFamily:e.sourceFamily})}function convertsOf(e){let{source:t,target:n,sourceName:r,sourceFamily:i,targetFamily:a,table:o}=e;if(t.unit===null||n.unit===null||t.unit.name===n.unit.name||t.unit.dimension!==n.unit.dimension||i!==null&&i!==`number`||!accepts(`number`,a))return[];let s=t.unit.per/n.unit.per,c=scaled(r,s),l=transformOf(e,{kind:`convert`,expression:c,resultFamily:`number`,from:t.unit,to:n.unit,factor:s});return o.dimensions.get(n.unit.dimension)?.integral===!0?[l,transformOf(e,{kind:`wholeMinorUnits`,expression:`decimal(${c}, 0)`,resultFamily:`number`,from:t.unit,to:n.unit,factor:s})]:[l]}function isIsoDimension(e,t){return e!==null&&t.dimensions.get(e)?.iso===!0}function isoDurationsOf(e){let{source:t,target:n,sourceName:r,targetFamily:i,table:a}=e;if(t.unit===null||!isIsoDimension(t.unit.dimension,a)||n.dimension!==t.unit.dimension||!accepts(`string`,i))return[];let o=a.units.get(a.dimensions.get(t.unit.dimension)?.base??``),s=t.unit.iso??o?.iso??null;if(s===null||o===void 0)return[];let c=t.unit.iso===null?t.unit.per/o.per:1;return[transformOf(e,{kind:`isoDuration`,expression:[JSON.stringify(s.prefix),`string(${scaled(r,c)})`,JSON.stringify(s.designator)].join(` + `),resultFamily:`string`,from:t.unit,to:o,factor:c})]}function typedTextsOf(e){let{sourceName:t,sourceFamily:n,targetFamily:r}=e,i=[];return n===`string`&&r===`number`&&i.push(transformOf(e,{kind:`numberFromText`,expression:`number(${t})`,resultFamily:`number`})),n!==null&&[`number`,`boolean`,`date`].includes(n)&&r===`string`&&i.push(transformOf(e,{kind:`textFromValue`,expression:`string(${t})`,resultFamily:`string`})),n===`duration`&&r===`string`&&i.push(transformOf(e,{kind:`durationText`,expression:`string(${t})`,resultFamily:`string`})),n===`string`&&r===`duration`&&i.push(transformOf(e,{kind:`durationFromText`,expression:`duration(${t})`,resultFamily:`duration`})),i}function constantsOf(e,t){return!isIsoDimension(e.target.dimension,e.table)||!accepts(`string`,e.targetFamily)?[]:[...new Map(t.filter(e=>isIsoDuration(e.text)).map(e=>[`${e.origin} ${e.text}`,e])).values()].map(t=>transformOf(e,{kind:`constant`,expression:JSON.stringify(t.text),resultFamily:`string`,constant:t}))}function transformsFor(e,t=cs,n=Fo){let r=feelNameOf(e.source.name);if(r===null)return[];let i=readName(e.source.name,t,n),a=readName(e.target.name,t,n),o={source:i,target:a,sourceName:r,sourceFamily:familyOf(e.source.type,n),targetFamily:familyOf(e.target.type,n),overlap:overlapOf(i.words,a.words),table:t};return[identityOf(o),...convertsOf(o),...isoDurationsOf(o),...typedTextsOf(o),...constantsOf(o,e.constants)]}var compact=e=>e.replace(/\s+/g,``);function historyOf(e,t=cs,n=Fo){let headOf=e=>readName(e,t,n).head,keyOf=(e,t,n)=>[e.kind,e.from,e.to,headOf(t),headOf(n)].join(`|`),r=new Map;for(let i of e){let e=compact(i.expression),a=transformsFor({source:{name:i.source,type:null},target:{name:i.target,type:null},constants:[]},t,n).find(t=>compact(t.expression)===e);if(a===void 0)continue;let o=keyOf(a,i.source,i.target);r.set(o,(r.get(o)??0)+1)}return{countOf:(e,t,n)=>r.get(keyOf(e,t,n))??0}}var roundedOf=e=>Number(e.toPrecision(12));function variablesOf(e,t){return e.split(`.`).reduceRight((e,t)=>({[t]:e}),t)}function typeMatches(e,t){if(t===null)return null;switch(t){case`number`:return typeof e==`number`&&Number.isFinite(e);case`string`:case`date`:return typeof e==`string`;case`duration`:return typeof e==`string`&&isIsoDuration(e);case`boolean`:return typeof e==`boolean`;case`list`:return Array.isArray(e)}}function saneOf(e,t,n){let r=t.to===null?void 0:n.units.get(t.to);if(r===void 0||typeof e!=`number`)return 1;let i=n.dimensions.get(r.dimension)?.range??null;return i===null?+(e>=0):+(e>=i[0]/r.per&&e<=i[1]/r.per)}function plausibleSource(e,t,n){if(e.from===null||typeof t.sample!=`number`)return!0;let r=n.units.get(e.from),i=r===void 0?null:n.dimensions.get(r.dimension)?.range??null;if(r===void 0||i===null)return!0;let a=t.sample*r.per;return a>=i[0]&&a<=i[1]}function dryRun(e,t,n,r){let i=e.kind===`constant`?{}:variablesOf(t.name,t.sample),a=pr(e.expression,i);if(a.status!==`value`||a.warnings.length>0)return null;let o=typeMatches(a.value,n);return o===!1?null:{result:a.value,features:{...e.features,typeMatch:+(o===!0),typeUnknown:+(o===null),resultSane:saneOf(a.value,e,r)}}}function candidatesOf(e,t=cs,n=Fo){let r=familyOf(e.target.type,n),i=new Set;return e.sources.flatMap(a=>transformsFor({source:a,target:e.target,constants:e.constants},t,n).flatMap(n=>{if(i.has(n.expression)||n.kind!==`constant`&&a.sample===void 0||!plausibleSource(n,a,t))return[];i.add(n.expression);let o=dryRun(n,a,r,t);if(o===null)return[];let s=e.history.countOf(n,a.name,e.target.name);return[{value:n.expression,origin:`transform`,source:a.name,features:{...o.features,projectFrequency:roundedOf(Math.log1p(s))},transform:n,result:o.result}]}))}var ps=new Set([`convert`,`wholeMinorUnits`]);function typicalSampleOf(e,t=cs,n=Fo){return readName(e,t,n).unit?.sample}function numericOf(e,t,n){if(!ps.has(e))return!1;let r=t.dimension!==null&&n.dimensions.get(t.dimension)?.integral===!0;return e===`wholeMinorUnits`?r:!r}function admits(e,t,n,r){let{kind:i}=e.transform;if(i===`identity`||e.features.resultSane!==1)return!1;let a=readName(e.source,n,r);return a.dimension===null||a.dimension!==t.dimension?!1:numericOf(i,t,n)?!0:!t.unitExplicit&&!ps.has(i)}function recogniseExpression(e,t=cs,n=Fo){if(e.target.name.trim()===``)return null;let r=readName(e.target.name,t,n),i=new Map;for(let a of e.sources)for(let o of candidatesOf({...e,sources:[a]},t,n))admits(o,r,t,n)&&!i.has(o.value)&&i.set(o.value,o);return i.size===1?[...i.values()][0]:null}function recognitionOf(e){let{transform:t}=e;return{source:e.source,kind:t.kind,from:t.from,to:t.to,factor:t.factor,constant:t.constant,constantOrigin:t.constantOrigin}}function timerTextsIn(e,t){for(let n of e?.eventDefinitions??[]){if(n?.$type!==`bpmn:TimerEventDefinition`)continue;let e=typeof n.timeDuration?.body==`string`?n.timeDuration.body.trim():``;isIsoDuration(e)&&t.push(e)}(e?.flowElements??[]).forEach(e=>timerTextsIn(e,t))}function timerTextsOf(e){let t=[];return(e?.rootElements??[]).filter(e=>e.$type===`bpmn:Process`).forEach(e=>timerTextsIn(e,t)),t}function labelKeyOf(e){return nameWordsOf(e).join(` `)}function peerOutputsOf(e){return e.flatMap(e=>{let t=new Map;return e.mappings.filter(e=>e.direction!==`input`&&e.target!==null).forEach(e=>t.set(e.elementId,[...t.get(e.elementId)??[],e.target])),[...t].map(([t,n])=>({diagram:e.path,elementId:t,label:e.elementNames.get(t)??``,outputs:n}))})}var ms=new Set([`input`,`loop element`]);function decisionOutputsOf(e){return new Map([...e].map(e=>[e.id,[...e.outputs]]))}function taskTypeOutputsOf(e){let t=new Map;for(let n of e){let e=t.get(n.workerKey)??new Map;e.set(n.diagram,new Set([...e.get(n.diagram)??[],...n.outputs])),t.set(n.workerKey,e)}return new Map([...t].map(([e,t])=>[e,[...new Set([...t.values()].flatMap(e=>[...e]))]]))}function scopeOf(e,t,n,r){return Rt({model:{variables:[...r]},order:e.order,types:[...t.types],inputs:[...t.inputs??[]]},n,{wholeProcess:!0}).variables}function writersOf(e){return[...new Set(e.writers.map(e=>e.elementId))]}function collect$2(e){let t=new Map;for(let[n,r,i,a]of e){let e=t.get(n)??{type:null,owners:new Set,origins:new Set};t.set(n,{type:e.type??r,owners:new Set([...e.owners,...i]),origins:new Set([...e.origins,a])})}return[...t].map(([e,{type:t,owners:n,origins:r}])=>({id:e,name:e,type:t,owners:[...n],origins:[...r]}))}e(collect$2,`collect`);function inputSourcePool(e,t,n,r){let i=scopeOf(e,t,n,e.variables.filter(e=>e.elementId!==n||e.where!==`input`)).map(e=>[e.name,e.type,writersOf(e),`scope`]),a=r===void 0||r===``?[]:[[r,null,[],`identity`]];return collect$2([...i,...a,...readInProject(t)])}function readInProject(e){return[...(e.reads??new Map).keys()].map(e=>[e,null,[],`readInProject`])}function outputNamePool(e,t,n,r){let i=new Set(scopeOf(e,t,n,e.variables).map(e=>e.name)),a=e.variables.filter(e=>e.writes&&e.elementId===n&&e.where===`script`).map(e=>[e.name,null,[n],`script`]),o=r.contractWrites.map(e=>[e,null,[n],`contract`]),s=e.decisionUses.filter(e=>e.elementId===n).flatMap(e=>t.decisionOutputs.get(e.decisionId)??[]).map(e=>[e,null,[],`decision`]),c=e.variables.filter(t=>!t.writes&&t.where!==`output`&&t.elementId!==n&&j(e.order,n,t.elementId)&&!i.has(t.name)).map(e=>[e.name,null,[],`downstream`]),l=[...new Set((r.workerKeys??[]).flatMap(e=>t.taskTypeOutputs?.get(e)??[]))].map(e=>[e,null,[],`taskType`]),u=e.variables.filter(e=>e.writes&&e.elementId!==n&&!ms.has(e.where)).map(e=>[e.name,null,[],`sibling`]),d=labelKeyOf(r.label??``),f=d===``?[]:(t.peers??[]).filter(e=>labelKeyOf(e.label)===d).flatMap(e=>e.outputs).map(e=>[e,null,[],`peerLabel`]),p=(r.composed??[]).map(e=>[e,null,[],`composed`]),m=[...c,...l,...u,...f];return collect$2([...o,...a,...s,...m,...p,...readInProject(t)])}function capitalisationOf(e){let t=e.replace(/[^\p{L}]/gu,``);if(t===``||t===t.toLowerCase())return`lower`;if(t===t.toUpperCase())return`upper`;let n=t.charAt(0),r=t.slice(1);return n===n.toUpperCase()&&r===r.toLowerCase()?`capital`:`mixed`}function signatureOf(e){let t=[...e.matchAll(zo)];if(t.length===0)return null;let n=capitalisationOf(t[0][0]);if(t.length===1)return{separator:``,first:n,rest:null};let r=t[0].index+t[0][0].length;return{separator:e.slice(r,t[1].index),first:n,rest:capitalisationOf(t[1][0])}}function signatureKey(e){return`${e.separator}|${e.first}|${e.rest??`null`}`}function compareText$2(e,t){return e<t?-1:+(e>t)}e(compareText$2,`compareText`);function styleDistributionOf(e){let t=new Map,n=0;for(let r of e){let e=signatureOf(r);if(e===null||e.rest===null)continue;n+=1;let i=signatureKey(e),a=t.get(i);t.set(i,{signature:e,count:(a?.count??0)+1})}return[...t].sort(([e,t],[n,r])=>r.count-t.count||compareText$2(e,n)).map(([,e])=>({signature:e.signature,share:e.count/n}))}function firstCapitalisationOf(e){let t=new Map,n=0;for(let r of e){let e=signatureOf(r);e!==null&&(n+=1,t.set(e.first,(t.get(e.first)??0)+1))}if(n===0)return null;let[r,i]=[...t].sort(([e,t],[n,r])=>r-t||compareText$2(e,n))[0];return{capitalisation:r,share:i/n}}function renderWord(e,t){return t===`upper`?e.toUpperCase():t===`capital`?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():e.toLowerCase()}function renderName(e,t){return e.map((e,n)=>renderWord(e,n===0?t.first:t.rest??`lower`)).join(t.separator)}var hs=1,gs=1e-12,_s=.5,vs=4,ys=3;function normal(e){return e.toLowerCase()}function uniqueOf(e){return[...new Set(e.map(normal))]}function countIn(e,t){return e!==void 0&&Object.hasOwn(e,t)?e[t]:0}function compareText$1(e,t){return e<t?-1:+(e>t)}e(compareText$1,`compareText`);function tokenPosteriorOf(e,t){let n=Object.keys(e.names),r=new Map;if(n.length===0)return r;let i=uniqueOf(t),a=Math.max(1,Object.keys(e.labels).length),o=n.reduce((t,n)=>t+e.names[n],0),s=new Map;for(let t of n){let r=e.names[t],c=Math.log((r+hs)/(o+hs*n.length));for(let n of i){let i=(countIn(Object.hasOwn(e.joint,n)?e.joint[n]:void 0,t)+hs)/(r+hs*a),o=(countIn(e.labels,n)+hs)/(e.pairs+hs*a);c+=Math.log(i)-Math.log(o)}s.set(t,c)}let c=Math.max(...s.values()),l=0;for(let[e,t]of s){let n=Math.exp(t-c);r.set(e,n),l+=n}for(let[e,t]of r)r.set(e,t/l);return r}function associationOf(e,t,n){if(n.length===0)return 0;let r=tokenPosteriorOf(e,t),i=n.map(e=>Math.log(Math.max(r.get(normal(e))??0,gs)));return Math.exp(i.reduce((e,t)=>e+t,0)/i.length)}function meanPositionOf(e,t){let n=Object.hasOwn(e.position,t)?e.position[t]:void 0;return n===void 0?_s:n.sum/n.count}function subsetsOf(e,t){let n=[],grow=(r,i)=>{if(i.length>0&&n.push([...i]),i.length!==t)for(let t=r;t<e.length;t+=1)i.push(e[t]),grow(t+1,i),i.pop()};return grow(0,[]),n}function composeNames(e,t,n,r={}){let i=r.maxTokens??ys,a=r.pool??vs,o=firstCapitalisationOf(n);if(o===null||t.length===0)return[];let[s]=styleDistributionOf(n);return subsetsOf([...tokenPosteriorOf(e,t)].sort(([e,t],[n,r])=>r-t||compareText$1(e,n)).slice(0,a).map(([e])=>e),i).flatMap(n=>{let r=[...n].sort((t,n)=>meanPositionOf(e,t)-meanPositionOf(e,n)||compareText$1(t,n)),i=associationOf(e,t,r);return r.length===1?[{value:renderName(r,{separator:``,first:o.capitalisation,rest:null}),tokens:r,association:i,styleShare:o.share}]:s===void 0?[]:[{value:renderName(r,s.signature),tokens:r,association:i,styleShare:s.share}]})}var bs={weightedOverlap:`share of the weight of the words the query and the candidate have in common, over the weight of the words either has; a word weighs by how rarely the project uses it`,softTfidf:`the matcher's soft TF-IDF similarity of the two names: a word that nearly matches another word of the other name counts as a match, weighted as the overlap is`,headEqual:`1 when the query and the candidate name the same head concept, else 0`,tailEqual:`1 when the last content word of the two names is the same concept, else 0`,jaroWinkler:`Jaro-Winkler similarity of the two names lower-cased and stripped of separators`,trigramCosine:`cosine of the character trigram counts of the two names stripped of separators`,lengthRatio:`the shorter over the longer length of the two names stripped of separators`,nameLength:`the length of the candidate name stripped of separators, over 32 and capped at 1`,casingAgrees:`1 when the query and the candidate are written in the same casing style (snake, kebab, camel, pascal, lower, upper, other), else 0`,ownerStripped:`1 when an element id prefix that owns the candidate was removed before matching, else 0`,typeKnown:`1 when the candidate has a known type, else 0`,typeNumber:`1 when the candidate type belongs to the number family of the lexicon, else 0`,readsInProject:`how often the project reads the candidate name outside its own writes, as n over n plus one`,siblingOverlap:`the largest weighted overlap of the candidate's words with the name of each field the same element already gave a name to, earlier in the document, over the weight of the words either has; 0 when there is none`,slotPosition:`the position of the field among the element's fields of the same kind, earlier fields first, over the number of such fields`,slotCount:`the number of the element's fields of the same kind, over eight and capped at 1`,originContract:`1 when the candidate is written by the element's own worker code`,originScript:`1 when the candidate is written by the element's own script body`,originDecision:`1 when the candidate is an output column of a decision the element calls`,originDownstream:`1 when a later element reads the candidate and nothing before this element writes it`,originScope:`1 when the candidate is in scope at the element: written by an element upstream on every path`,originTaskType:`1 when the same task or job type writes the candidate in another diagram of the project`,labelAssociation:`how well the name model's words for the element's label go with the candidate's words: the geometric mean over the candidate's words of the probability the name model gives each word for that label, between 0 and 1; 0 without a name model or a label`},xs=[`weightedOverlap`,`softTfidf`,`headEqual`,`tailEqual`,`jaroWinkler`,`trigramCosine`,`lengthRatio`,`nameLength`,`casingAgrees`,`ownerStripped`,`typeKnown`,`typeNumber`,`readsInProject`,`siblingOverlap`,`slotPosition`,`slotCount`,`originContract`,`originScript`,`originDecision`,`originDownstream`,`originScope`,`originTaskType`,`labelAssociation`],Ss=bs;xs.map(e=>({name:e,definition:Ss[e]}));var Cs=[`contract`,`script`,`decision`,`downstream`,`scope`,`taskType`],ws={contract:`originContract`,script:`originScript`,decision:`originDecision`,downstream:`originDownstream`,scope:`originScope`,taskType:`originTaskType`},Ts={reads:new Map,siblings:[],position:0,count:0},Es=32,Ds=8;function casingOf(e){return e.includes(`_`)?`snake`:e.includes(`-`)?`kebab`:/^[A-Za-z0-9]+$/.test(e)?e===e.toLowerCase()?`lower`:e===e.toUpperCase()?`upper`:/^[A-Z]/.test(e)?`pascal`:`camel`:`other`}var Os=/[^\p{L}\p{N}]+/gu;function normalForm(e){return e.toLowerCase().replace(Os,``)}function trigramCounts(e){let t=new Map,n=e.length<3?[e]:Array.from({length:e.length-2},(t,n)=>e.slice(n,n+3));for(let e of n)t.set(e,(t.get(e)??0)+1);return t}var ks=0xe8d4a51000;function rounded(e){return Math.round(e*ks)/ks}function trigramCosine(e,t){if(e===``||t===``)return 0;let n=trigramCounts(e),r=trigramCounts(t),i=0;for(let[e,t]of n)i+=t*(r.get(e)??0);let norm=e=>Math.sqrt([...e.values()].reduce((e,t)=>e+t*t,0));return rounded(i/(norm(n)*norm(r)))}function weightedOverlap(e,t,n){let r=new Set(e),i=new Set(t),weigh=e=>[...e].reduce((e,t)=>e+n.weight(t),0),a=weigh(new Set([...r,...i]));return a===0?0:weigh([...r].filter(e=>i.has(e)))/a}function lastContentKey(e){let t=e.filter(e=>e.role===`content`);return t.length===0?null:t[t.length-1].key}function labelAssociationOf(e,t){if(e.nameModel===void 0||e.label===void 0)return 0;let n=[...nameWordsOf(e.label),...e.workerWords??[]];return n.length===0?0:rounded(associationOf(e.nameModel,n,nameWordsOf(t)))}function siblingOverlapOf(e,t,n){if(t.siblings.length===0)return 0;let r=analyse(e,n).units.map(e=>e.key),i=t.siblings.map(e=>weightedOverlap(r,analyse(e,n).units.map(e=>e.key),n));return rounded(Math.max(...i))}function softTfidf(e,t,n){return rounded(match(e,[t],{vocabulary:n,scoring:`soft`}).ranked[0]?.score??0)}function featuresOf(e,t,n,r=Ts){let i=matchTextOf(t),a=analyse(e,n),o=analyse(i,n),s=normalForm(e),c=normalForm(i),l=Math.max(s.length,c.length),u=lastContentKey(a.units),d=lastContentKey(o.units),f=r.reads.get(t.name)??0,p={weightedOverlap:rounded(weightedOverlap(a.units.map(e=>e.key),o.units.map(e=>e.key),n)),softTfidf:softTfidf(e,t,n),headEqual:+!!a.head.keys.some(e=>o.head.keys.includes(e)),tailEqual:+(u!==null&&u===d),jaroWinkler:s===``||c===``?0:rounded(jaroWinkler$1(s,c)),trigramCosine:trigramCosine(s,c),lengthRatio:l===0?0:rounded(Math.min(s.length,c.length)/l),nameLength:rounded(Math.min(1,c.length/Es)),casingAgrees:+(casingOf(e)===casingOf(i)),ownerStripped:i===t.name?0:1,typeKnown:t.type===null?0:1,typeNumber:+(familyOf(t.type,n.lexicon)===`number`),readsInProject:rounded(f/(f+1)),siblingOverlap:siblingOverlapOf(i,r,n),slotPosition:r.count===0?0:rounded(r.position/r.count),slotCount:rounded(Math.min(r.count,Ds)/Ds),originContract:0,originScript:0,originDecision:0,originDownstream:0,originScope:0,originTaskType:0,labelAssociation:labelAssociationOf(r,i)};for(let e of t.origins??[])Cs.includes(e)&&(p[ws[e]]=1);return p}function workerWordsOf(e){return e.flatMap(e=>nameWordsOf(e.slice(e.indexOf(`:`)+1).split(`.`).pop()??``))}function labelWordsOf(e,t){return[...nameWordsOf(e),...workerWordsOf(t)]}var As=[`contract`,`script`,`decision`];function originOf(e){return e.some(e=>As.includes(e))?`fact`:e.length>0&&e.every(e=>e===`composed`)?`composed`:`pool`}function readsElsewhereOf(e,t,n){let r=new Map(t.reads);return e.variables.filter(e=>e.elementId===n&&!e.writes&&e.where!==`output`).forEach(e=>{let t=(r.get(e.name)??0)-1;t>0?r.set(e.name,t):r.delete(e.name)}),r}function poolProjectOf(e,t,n){return{types:[...t.types],inputs:t.inputs,decisionOutputs:t.decisionOutputs,taskTypeOutputs:taskTypeOutputsOf(t.taskOutputs.filter(t=>t.diagram!==e.path)),peers:(t.peers??[]).filter(t=>t.diagram!==e.path),reads:readsElsewhereOf(e,t,n)}}function nameOf$8(e,t){return e.elementNames.get(t)??``}e(nameOf$8,`nameOf`);function workerKeysOf(e,t){return e.workerKeys.get(t)??[]}function composedOf(e,t,n){if(t.nameModel===void 0)return[];let r=labelWordsOf(nameOf$8(e,n),workerKeysOf(e,n));if(r.length===0)return[];let i=(t.names??[]).filter(t=>t.diagram!==e.path||t.elementId!==n).map(e=>e.name);return composeNames(t.nameModel,r,i).map(e=>e.value)}function queryOf(e,t,n){return e===`output-name`?nameOf$8(t,n.elementId):n.field}function poolOf(e,t,n,r){let i=t,a=poolProjectOf(t,n,r.elementId);return e===`output-name`?outputNamePool(i,a,r.elementId,{contractWrites:t.codeWrites.get(r.elementId)??[],workerKeys:t.workerKeys.get(r.elementId)??[],label:nameOf$8(t,r.elementId),composed:composedOf(t,n,r.elementId)}):inputSourcePool(i,a,r.elementId,e===`input-source`?r.field:void 0)}function nameOfSlot(e,t){return t?e.target===null?[]:[e.target]:e.variable===null?[]:[e.variable]}function slotOf(e,t){let n=t.task===`output-name`,r=e.mappings.filter(e=>e.elementId===t.elementId&&e.direction!==`input`===n&&e.target!==null),i=r.findIndex(e=>e.target===t.field);return{given:(i<0?r:r.slice(0,i)).flatMap(e=>nameOfSlot(e,n)),position:i<0?r.length:i,count:i<0?r.length+1:r.length}}function requestPoolOf(e,t,n){let r=poolOf(n.task,e,t,n);if(n.task===`expression`)return r;let i=new Set(slotOf(e,n).given);return r.filter(e=>!i.has(e.name))}function contextOf$1(e,t,n){let r=slotOf(e,n);return{reads:readsElsewhereOf(e,t,n.elementId),siblings:r.given,position:r.position,count:r.count,label:nameOf$8(e,n.elementId),workerWords:workerWordsOf(workerKeysOf(e,n.elementId)),nameModel:t.nameModel}}e(contextOf$1,`contextOf`);function sourceOf$1(e,t,n,r){return{task:e,candidates(i){let a=queryOf(e,t,i);if(a===``)return[];let o=contextOf$1(t,n,i);return requestPoolOf(t,n,i).map(e=>({value:e.name,origin:originOf(e.origins??[]),features:featuresOf(a,e,r,o)}))}}}e(sourceOf$1,`sourceOf`);var js=[`output-name`,`input-source`,`expression`];function candidateSourcesOf(e,t,n){return js.map(r=>sourceOf$1(r,e,t,n))}var Ms=8,Ns=e(e=>e.filter(e=>typeof e==`string`&&e!==``),`present`);function namesOf$1(e,t){return[...Ns(t.map(e=>e.name)),...Ns(e.workers.map(e=>e.value)),...Ns(e.processes.map(e=>e.id)),...Ns(e.calls.map(e=>e.calledProcessId)),...Ns(e.decisions.map(e=>e.id)),...Ns(e.decisionUses.map(e=>e.decisionId))]}e(namesOf$1,`namesOf`);function codeUseOf(e){return{name:e.name,writes:e.writes,elementId:e.elementId,where:e.where,type:e.type??null}}function codeWritesOf(e){let t=new Map;for(let n of e)n.writes&&t.set(n.elementId,[...t.get(n.elementId)??[],n.name]);return t}function workerKeysByElement(e){let t=new Map;for(let n of e.workers)t.set(n.elementId,[...t.get(n.elementId)??[],`${n.kind}:${n.value}`]);return t}function diagramOf(e,t,n){let r=new Set(t.model.workers.map(e=>e.elementId)),i=(n?.variables??[]).filter(e=>r.has(e.elementId)).map(codeUseOf),a=[...t.model.variables,...i];return{path:e,kind:t.kind,model:t.model,order:t.order,mappings:t.mappings,elementNames:new Map(t.model.elements.filter(e=>e.name?.trim()).map(e=>[e.id,e.name])),variables:a,decisionUses:t.model.decisionUses,codeWrites:codeWritesOf(i),workerKeys:workerKeysByElement(t.model),names:namesOf$1(t.model,a),timers:t.timers}}function taskEntriesOf(e){return e.mappings.filter(e=>e.direction!==`input`&&e.target!==null).flatMap(t=>(e.workerKeys.get(t.elementId)??[]).map(n=>({diagram:e.path,elementId:t.elementId,workerKey:n,outputs:[t.target]})))}function readsOf(e){let t=new Map;for(let n of e)for(let e of n.variables)!e.writes&&e.where!==`output`&&t.set(e.name,(t.get(e.name)??0)+1);return t}function byPath(e,t){return e.path<t.path?-1:+(e.path>t.path)}function uniqueFiles(e,t){let n=new Map;for(let r of e.filter(e=>Ye(e.path)===`bpmn`||Ye(e.path)===`dmn`).sort(byPath))n.has(r.text)&&r.path!==t||n.set(r.text,r);return[...n.values()].sort(byPath)}async function parseFile(e){let t=Ye(e.path);if(t!==`bpmn`&&t!==`dmn`)return null;try{let n=t===`bpmn`?await jt(e.text):null;return t===`bpmn`&&n===null?null:{kind:t,model:await b(e.path,e.text),order:n?se(n):new Map,mappings:n?mappingsOf(n):[],timers:n?timerTextsOf(n):[]}}catch{return null}}function vocabularyOf(e){let t=new Vocabulary(Fo);return e.forEach(e=>t.replaceSource(e.path,e.names)),t}var SuggestionContextBuilder=class{cache=new Map;async build(e,t=null,n={}){let r=uniqueFiles(e,n.focus),i=new Set(r.map(e=>e.path));for(let e of[...this.cache.keys()])i.has(e)||this.cache.delete(e);let a=[],o=Date.now();for(let e of r){let t=await this.parse(e);t!==null&&a.push({path:e.path,file:t}),n.pause&&Date.now()-o>=Ms&&(await n.pause(),o=Date.now())}let s=a.map(({path:e,file:n})=>diagramOf(e,n,t)),c=s.filter(e=>e.kind===`bpmn`);return{diagrams:s,project:{types:t?.types??[],...t?.variableChecks?{inputs:t.variableChecks.inputs}:{},decisionOutputs:decisionOutputsOf(s.flatMap(e=>e.model.decisions)),taskOutputs:c.flatMap(taskEntriesOf),peers:peerOutputsOf(c.map(e=>({path:e.path,elementNames:e.elementNames,mappings:e.mappings}))),names:c.flatMap(e=>e.variables.map(t=>({name:t.name,diagram:e.path,elementId:t.elementId}))),reads:readsOf(s),timers:c.flatMap(e=>e.timers.map(t=>({diagram:e.path,text:t})))},vocabulary:vocabularyOf(s)}}async parse(e){let t=this.cache.get(e.path);if(t!==void 0&&t.text===e.text)return t.parsed;let n=await parseFile(e);return this.cache.set(e.path,{text:e.text,parsed:n}),n}};function ownMappingsOf(e,t){if(t.field===``)return[];let n=t.task!==`output-name`;return e.mappings.filter(e=>e.elementId===t.elementId&&e.target===t.field&&e.direction===`input`===n)}function spentOf(e){let t=e.direction===`input`?_r(e.expression??``):[];return[...new Set([...e.variable===null?[]:[e.variable],...t,...e.target===null?[]:[e.target]])]}function requestSpentOf(e,t){return[...new Set(ownMappingsOf(e,t).flatMap(spentOf))]}function inRequestScope(e,t,n,r,i){let a=e.diagrams.find(e=>e.path===t);if(a===void 0)throw RangeError(`focus:${t}`);e.vocabulary.replaceSource(t,withoutOccurrences(a.names,requestSpentOf(a,n)));try{return i({diagram:a,project:{...e.project,nameModel:r},vocabulary:e.vocabulary})}finally{e.vocabulary.replaceSource(t,a.names)}}function nameVerdictOf(e,t){let n=queryOf(t.task,e.diagram,t);if(n===``)return{confident:!1,reason:`none`};let r=match(n,requestPoolOf(e.diagram,e.project,t),{vocabulary:e.vocabulary});return{confident:r.confident,reason:r.reason}}function candidatesOfRequest(e,t){return candidateSourcesOf(e.diagram,e.project,e.vocabulary).find(e=>e.task===t.task)?.candidates(t)??[]}function expressionContextOf(e,t){let n=requestPoolOf(e.diagram,e.project,t).filter(e=>e.origins?.includes(`scope`)).map(e=>({name:e.name,type:e.type,sample:typicalSampleOf(e.name)})),r=(e.project.timers??[]).map(t=>({text:t.text,origin:t.diagram===e.diagram.path?`diagram`:`project`}));return{sources:n,target:{name:t.field,type:null},constants:r,history:historyOf([])}}function withoutOccurrences(e,t){let n=new Map;return e.forEach(e=>n.set(e,(n.get(e)??0)+1)),t.forEach(e=>n.set(e,(n.get(e)??0)-1)),[...n].filter(([,e])=>e>0).map(([e])=>e)}function cyrb53(e){let t=3735928559,n=1103547991;for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r);t=Math.imul(t^i,2654435761),n=Math.imul(n^i,1597334677)}return t=Math.imul(t^t>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(t^t>>>13,3266489909),4294967296*(2097151&n)+(t>>>0)}function schemaHashOf(e){return cyrb53(e.join(`
8
+ `)).toString(16).padStart(14,`0`)}var RankerModelError=class extends Error{problems;constructor(e){super(e.map(e=>`${e.path}:${e.code}`).join(`, `)),this.name=new.target.name,this.problems=e}};function fail(e,t){throw new RankerModelError([{path:e,code:t}])}function recordOf$1(e,t){return(typeof e!=`object`||!e||Array.isArray(e))&&fail(t,`not-an-object`),e}e(recordOf$1,`recordOf`);function listOf$1(e,t){return Array.isArray(e)||fail(t,`not-a-list`),e}e(listOf$1,`listOf`);function numberOf(e,t){return typeof e==`number`&&Number.isFinite(e)||fail(t,`not-a-number`),e}function integerOf(e,t,n,r){let i=numberOf(e,t);return(!Number.isInteger(i)||i<n||i>r)&&fail(t,`not-an-index`),i}function numbersOf(e,t,n){let r=listOf$1(e,t);return r.length!==n&&fail(t,`wrong-length`),r.map((e,n)=>numberOf(e,`${t}[${n}]`))}function parseScorer(e,t,n){let r=recordOf$1(e,n);if(r.family===`logistic`)return{family:`logistic`,mean:numbersOf(r.mean,`${n}.mean`,t),scale:numbersOf(r.scale,`${n}.scale`,t),low:numbersOf(r.low,`${n}.low`,t),high:numbersOf(r.high,`${n}.high`,t),weights:numbersOf(r.weights,`${n}.weights`,t)};r.family!==`trees`&&fail(n,`unknown-family`);let i=listOf$1(r.trees,`${n}.trees`).map((e,r)=>{let i=listOf$1(recordOf$1(e,`${n}.trees[${r}]`).nodes,`${n}.trees[${r}].nodes`);return{nodes:i.map((e,a)=>{let o=recordOf$1(e,`${n}.trees[${r}].nodes[${a}]`),s=o.feature===-1;return{feature:s?-1:integerOf(o.feature,`${n}.feature`,0,t-1),threshold:numberOf(o.threshold,`${n}.threshold`),left:s?-1:integerOf(o.left,`${n}.left`,0,i.length-1),right:s?-1:integerOf(o.right,`${n}.right`,0,i.length-1),value:numberOf(o.value,`${n}.value`)}})}});return{family:`trees`,base:numberOf(r.base,`${n}.base`),trees:i}}function parseCalibration(e,t){let n=recordOf$1(e,t);if(n.kind===`platt`)return{kind:`platt`,slope:numberOf(n.slope,`${t}.slope`),intercept:numberOf(n.intercept,`${t}.intercept`)};n.kind!==`isotonic`&&fail(t,`unknown-kind`);let r=listOf$1(n.upTo,`${t}.upTo`).map((e,n)=>numberOf(e,`${t}.upTo[${n}]`)),i=numbersOf(n.value,`${t}.value`,r.length);return r.some((e,t)=>t>0&&e<r[t-1])&&fail(`${t}.upTo`,`out-of-order`),{kind:`isotonic`,upTo:r,value:i}}var Ps=[`probability`,`margin`,`precision`,`lowerBound`,`coverage`,`shown`,`items`,`repositories`];function parseThreshold(e,t){if(e===null)return null;let n=recordOf$1(e,t);return Object.fromEntries(Ps.map(e=>[e,numberOf(n[e],`${t}.${e}`)]))}function parseOutOfFold(e,t){let n=recordOf$1(e,t);n.family!==`logistic`&&n.family!==`trees`&&fail(`${t}.family`,`unknown-family`);let r=recordOf$1(n.logLossByFamily,`${t}.logLossByFamily`),i={};for(let e of[`logistic`,`trees`])r[e]!==void 0&&(i[e]=numberOf(r[e],`${t}.logLossByFamily.${e}`));return{family:n.family,items:numberOf(n.items,`${t}.items`),candidates:numberOf(n.candidates,`${t}.candidates`),logLoss:numberOf(n.logLoss,`${t}.logLoss`),brier:numberOf(n.brier,`${t}.brier`),logLossByFamily:i}}function parseSettings(e,t){let n=recordOf$1(e,t),optional=(e,n)=>e===null?null:numberOf(e,`${t}.${n}`);return{penalty:optional(n.penalty,`penalty`),rounds:optional(n.rounds,`rounds`)}}function parseTask(e,t,n){let r=recordOf$1(e,n);return{scorer:parseScorer(r.scorer,t,`${n}.scorer`),calibration:parseCalibration(r.calibration,`${n}.calibration`),threshold:parseThreshold(r.threshold,`${n}.threshold`),settings:parseSettings(r.settings,`${n}.settings`),outOfFold:parseOutOfFold(r.outOfFold,`${n}.outOfFold`)}}function parseRankerModel(e){let t=recordOf$1(e,`file`);t.format!==1&&fail(`format`,`unsupported-format`);let n=listOf$1(t.features,`features`).map((e,t)=>(typeof e!=`string`&&fail(`features[${t}]`,`not-a-name`),e));t.schemaHash!==schemaHashOf(n)&&fail(`schema`,`schema-mismatch`);let r=recordOf$1(t.tasks,`tasks`),i=Object.fromEntries(Object.entries(r).map(([e,t])=>[e,parseTask(t,n.length,`tasks.${e}`)])),a={format:1,features:n,schemaHash:schemaHashOf(n),provenance:recordOf$1(t.provenance,`provenance`),tasks:i};return t.names===void 0?a:{...a,names:recordOf$1(t.names,`names`)}}var Fs=parseRankerModel({format:1,features:[`casingAgrees`,`headEqual`,`jaroWinkler`,`labelAssociation`,`lengthRatio`,`nameLength`,`originContract`,`originDecision`,`originDownstream`,`originScope`,`originScript`,`originTaskType`,`ownerStripped`,`readsInProject`,`siblingOverlap`,`slotCount`,`slotPosition`,`softTfidf`,`tailEqual`,`trigramCosine`,`typeKnown`,`typeNumber`,`weightedOverlap`],schemaHash:`1bf62edc3e6ada`,provenance:JSON.parse(`{"trainer":"suggestions-ranker/3","repositories":68,"items":1293,"candidates":73932,"folds":4,"families":["logistic","trees"],"repositoryCap":0.15,"penalties":[0.0001,0.001,0.01,0.1,1,10],"rounds":[25,50,100],"innerFolds":3,"directions":{"weightedOverlap":1,"softTfidf":1,"headEqual":1,"tailEqual":1,"jaroWinkler":1,"trigramCosine":1,"lengthRatio":1,"casingAgrees":1,"readsInProject":1,"originContract":1,"originScript":1,"originDecision":1,"originDownstream":1,"originScope":1,"originTaskType":1,"labelAssociation":1},"dataset":{"name":"ranking-dev-capped.jsonl","hash":"294c2721cd91caf3339f21eebb3cc05b084aba2f1d53fc84d40eee29c80775c9"},"date":"2026-10-15","shipping":{"rule":{"minimumShown":30,"minimumRepositories":5,"maximumRepositoryShare":0.3,"minimumLowerBound":0.5,"baselines":["current-matcher","same-last-word"],"margins":[0,0.01,0.02,0.05,0.1,0.15,0.2,0.3],"bootstrap":{"draws":2000,"seed":20261015,"level":0.95}},"scores":"a2dde04e0b1f3f998b08c2572f6024dbc5059ce5c4353980653ddacce66e20c9","tasks":{"expression":{"items":40,"repositories":15,"baselines":[{"source":"current-matcher","shown":5,"correct":0},{"source":"same-last-word","shown":10,"correct":0}],"candidate":null,"nested":{"reading":{"shown":0,"correct":0,"precision":null,"macro":null,"repositories":0,"largestShare":0,"interval":{"low":0,"high":1}},"cuts":[{"group":"DigiBP/digibp-camunda-examples","cut":null,"shown":0,"correct":0},{"group":"al66/imicros-core","cut":null,"shown":0,"correct":0},{"group":"aleksander-dytko/camunda-ai-agent-testing","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/bpmn-driven-testing","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/camunda-7-to-8-migration","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/pdf-merge-split-connector","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/vanillabp-camunda7-adapter","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/vanillabp-camunda8-adapter","cut":null,"shown":0,"correct":0},{"group":"camunda-consulting/camunda-7-code-examples","cut":null,"shown":0,"correct":0},{"group":"d-velop/example-bpmn-processes","cut":null,"shown":0,"correct":0},{"group":"holunda-io/bpm-ai-connectors-camunda-8","cut":null,"shown":0,"correct":0},{"group":"operaton/operaton","cut":null,"shown":0,"correct":0},{"group":"saig0/ccon-2025-cpt-demo","cut":null,"shown":0,"correct":0},{"group":"saig0/ccon-2026-cpt-demo","cut":null,"shown":0,"correct":0},{"group":"upgradingdave/camunda-deep-dives","cut":null,"shown":0,"correct":0}]},"shipped":false,"inSample":null},"input-source":{"items":431,"repositories":42,"baselines":[{"source":"current-matcher","shown":394,"correct":180},{"source":"same-last-word","shown":308,"correct":134}],"candidate":null,"nested":{"reading":{"shown":0,"correct":0,"precision":null,"macro":null,"repositories":0,"largestShare":0,"interval":{"low":0,"high":1}},"cuts":[{"group":"BPMNscript/bpmnscript","cut":null,"shown":0,"correct":0},{"group":"EximeeBPMS/eximeebpms-examples","cut":null,"shown":0,"correct":0},{"group":"Grom33/micronaut-zeebe","cut":null,"shown":0,"correct":0},{"group":"Miragon/consulting","cut":null,"shown":0,"correct":0},{"group":"NicolasCola7/MSA-Project","cut":null,"shown":0,"correct":0},{"group":"OrqueIO/OrqueIO","cut":null,"shown":0,"correct":0},{"group":"UST-QuAntiL/QuantME-UseCases","cut":null,"shown":0,"correct":0},{"group":"al66/imicros-core","cut":null,"shown":0,"correct":0},{"group":"aleksander-dytko/camunda-ai-agent-testing","cut":null,"shown":0,"correct":0},{"group":"bcgov/digital-journeys","cut":null,"shown":0,"correct":0},{"group":"berndruecker/flowing-retail","cut":null,"shown":0,"correct":0},{"group":"btrajkovski/camunda-example","cut":null,"shown":0,"correct":0},{"group":"camunda-academy/c8-custom-outbound-connectors-lab","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/Camunda-7-User-and-Tenant-Creator","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/bpmn-driven-testing","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/camunda-7-to-8-migration","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/pdf-merge-split-connector","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/process-orchestration-for-santa","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/pyzeebe","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/vanillabp-camunda7-adapter","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/vanillabp-camunda8-adapter","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/zeebe-cherry-runtime","cut":null,"shown":0,"correct":0},{"group":"camunda-consulting/bpmn-cmmn-example","cut":null,"shown":0,"correct":0},{"group":"camunda-consulting/camunda-7-code-examples","cut":null,"shown":0,"correct":0},{"group":"camunda/camunda-bpm-examples","cut":null,"shown":0,"correct":0},{"group":"camunda/camunda-bpm-platform","cut":null,"shown":0,"correct":0},{"group":"camunda/zeebe-chaos","cut":null,"shown":0,"correct":0},{"group":"ganeshkumargunaseelan-web/camunda-fnol-automation","cut":null,"shown":0,"correct":0},{"group":"holunda-io/bpm-ai-connectors-camunda-8","cut":null,"shown":0,"correct":0},{"group":"holunda-io/c7","cut":null,"shown":0,"correct":0},{"group":"operaton/operaton","cut":null,"shown":0,"correct":0},{"group":"operaton/operaton-examples","cut":null,"shown":0,"correct":0},{"group":"paed01/bpmn-engine","cut":null,"shown":0,"correct":0},{"group":"quarkiverse/quarkus-camunda","cut":null,"shown":0,"correct":0},{"group":"renatoctorres/template-spring-kotlin-camunda-8","cut":null,"shown":0,"correct":0},{"group":"saig0/ccon-2025-cpt-demo","cut":null,"shown":0,"correct":0},{"group":"saig0/ccon-2026-cpt-demo","cut":null,"shown":0,"correct":0},{"group":"thanhtai9606/camunda-sample","cut":null,"shown":0,"correct":0},{"group":"upgradingdave/camunda-deep-dives","cut":null,"shown":0,"correct":0},{"group":"viadee/c8-kubeflow-outbound-connector","cut":null,"shown":0,"correct":0},{"group":"viadee/vPAV","cut":null,"shown":0,"correct":0},{"group":"wkspower/wks-platform","cut":null,"shown":0,"correct":0}]},"shipped":false,"inSample":null},"output-name":{"items":822,"repositories":60,"baselines":[{"source":"current-matcher","shown":66,"correct":30},{"source":"same-last-word","shown":87,"correct":29}],"candidate":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5405405405405406,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"nested":{"reading":{"shown":121,"correct":91,"precision":0.7520661157024794,"macro":0.5662393162393162,"repositories":26,"largestShare":0.33884297520661155,"interval":{"low":0.4915254237288136,"high":0.8926829268292683}},"cuts":[{"group":"313hemant313/camunda-order-workflow","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7247706422018348,"lowerBound":0.5274725274725275,"coverage":0.13260340632603407,"shown":109,"items":822,"repositories":26},"shown":2,"correct":2},{"group":"BPMNscript/bpmnscript","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.719626168224299,"lowerBound":0.5205479452054794,"coverage":0.13017031630170317,"shown":107,"items":822,"repositories":26},"shown":4,"correct":4},{"group":"DigiBP/digibp-camunda-classroom","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7431192660550459,"lowerBound":0.5531914893617021,"coverage":0.13260340632603407,"shown":109,"items":822,"repositories":26},"shown":2,"correct":0},{"group":"DigiBP/digibp-camunda-examples","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5376344086021505,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"DigiBP/digibp-saentis","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5376344086021505,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"EximeeBPMS/eximeebpms-examples","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5376344086021505,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"Grom33/micronaut-zeebe","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5376344086021505,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"Miragon/consulting","cut":{"probability":0.26854415173172386,"margin":0.2,"precision":0.7247706422018348,"lowerBound":0.5263157894736842,"coverage":0.13260340632603407,"shown":109,"items":822,"repositories":26},"shown":1,"correct":1},{"group":"OrqueIO/OrqueIO","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7142857142857143,"lowerBound":0.5,"coverage":0.12773722627737227,"shown":105,"items":822,"repositories":26},"shown":6,"correct":6},{"group":"Tinkoff/camunda-delegator-lib","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5333333333333333,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"UST-QuAntiL/QuantME-UseCases","cut":null,"shown":0,"correct":0},{"group":"al66/imicros-core","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7425742574257426,"lowerBound":0.524390243902439,"coverage":0.12287104622871046,"shown":101,"items":822,"repositories":26},"shown":10,"correct":6},{"group":"aleksander-dytko/camunda-ai-agent-testing","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7452830188679245,"lowerBound":0.546875,"coverage":0.12895377128953772,"shown":106,"items":822,"repositories":26},"shown":5,"correct":2},{"group":"audit-kwazar-0/camunda8-tutorial","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5393258426966292,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"bcgov/digital-journeys","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5393258426966292,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"berndruecker/camunda-csharp-showcase","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5393258426966292,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"berndruecker/customer-onboarding-camunda-8-springboot-extended","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7272727272727273,"lowerBound":0.5362318840579711,"coverage":0.13381995133819952,"shown":110,"items":822,"repositories":26},"shown":1,"correct":1},{"group":"berndruecker/trip-booking-saga-serverless","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5421686746987951,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"bpm-crafters/process-engine-worker","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5421686746987951,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"btrajkovski/camunda-example","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7363636363636363,"lowerBound":0.5492957746478874,"coverage":0.13381995133819952,"shown":110,"items":822,"repositories":26},"shown":1,"correct":0},{"group":"camunda-community-hub/Make-Rest-Calls-From-Camunda-7-Example","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5357142857142857,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"camunda-community-hub/camunda-7-to-8-migration","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5357142857142857,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"camunda-community-hub/camunda-8-benchmark","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5357142857142857,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"camunda-community-hub/pdf-merge-split-connector","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5357142857142857,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"camunda-community-hub/process-orchestration-for-santa","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7247706422018348,"lowerBound":0.5142857142857142,"coverage":0.13260340632603407,"shown":109,"items":822,"repositories":26},"shown":2,"correct":2},{"group":"camunda-community-hub/pyzeebe","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5277777777777778,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"camunda-community-hub/zeebe-cherry-runtime","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7314814814814815,"lowerBound":0.5256410256410257,"coverage":0.13138686131386862,"shown":108,"items":822,"repositories":26},"shown":3,"correct":2},{"group":"camunda-consulting/bpmn-cmmn-example","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5319148936170213,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"camunda-consulting/camunda-7-code-examples","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7142857142857143,"lowerBound":0.5,"coverage":0.12773722627737227,"shown":105,"items":822,"repositories":26},"shown":6,"correct":6},{"group":"camunda/camunda-bpm-examples","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7363636363636363,"lowerBound":0.5441176470588235,"coverage":0.13381995133819952,"shown":110,"items":822,"repositories":26},"shown":1,"correct":0},{"group":"camunda/camunda-bpm-platform","cut":null,"shown":0,"correct":0},{"group":"camunda/zeebe-chaos","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7570093457943925,"lowerBound":0.5733333333333334,"coverage":0.13017031630170317,"shown":107,"items":822,"repositories":26},"shown":4,"correct":0},{"group":"d-velop/example-bpmn-processes","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5338983050847458,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"datakurre/operaton-python","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7339449541284404,"lowerBound":0.5344827586206896,"coverage":0.13260340632603407,"shown":109,"items":822,"repositories":26},"shown":2,"correct":1},{"group":"emaarco/easy-zeebe","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5333333333333333,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"envite-consulting/camunda-carbon-reductor","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.75,"lowerBound":0.5679012345679012,"coverage":0.13138686131386862,"shown":108,"items":822,"repositories":26},"shown":3,"correct":0},{"group":"ganeshkumargunaseelan-web/camunda-fnol-automation","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.75,"lowerBound":0.5679012345679012,"coverage":0.13138686131386862,"shown":108,"items":822,"repositories":26},"shown":3,"correct":0},{"group":"gerdreiss/learning-camunda","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5324675324675324,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"holunda-io/bpm-ai-connectors-camunda-8","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5324675324675324,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"holunda-io/c7","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5324675324675324,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"jhmfreitas/Enterprise-Integration","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5324675324675324,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"kwazar-0/credit-scoring-camunda","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5324675324675324,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"nhomble/zeebe-mock","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5324675324675324,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"operaton/operaton","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7156862745098039,"lowerBound":0.5079365079365079,"coverage":0.12408759124087591,"shown":102,"items":822,"repositories":26},"shown":9,"correct":8},{"group":"operaton/operaton-examples","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7352941176470589,"lowerBound":0.5245901639344263,"coverage":0.12408759124087591,"shown":102,"items":822,"repositories":26},"shown":9,"correct":6},{"group":"paed01/bpmn-engine","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5360824742268041,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"philips-labs/workflow-capability","cut":{"probability":0.22685999372172555,"margin":0.2,"precision":0.6666666666666666,"lowerBound":0.5,"coverage":0.10948905109489052,"shown":90,"items":822,"repositories":27},"shown":41,"correct":41},{"group":"quarkiverse/quarkus-camunda","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5267857142857143,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"renatoctorres/template-spring-kotlin-camunda-8","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5267857142857143,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"rob2universe/camunda-http-connector-example","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5267857142857143,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"saig0/ccon-2025-cpt-demo","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5267857142857143,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"saig0/ccon-2026-cpt-demo","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7363636363636363,"lowerBound":0.5333333333333333,"coverage":0.13381995133819952,"shown":110,"items":822,"repositories":26},"shown":1,"correct":0},{"group":"saig0/exploding-bpmn","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7272727272727273,"lowerBound":0.5230769230769231,"coverage":0.13381995133819952,"shown":110,"items":822,"repositories":26},"shown":1,"correct":1},{"group":"salaboy/zeebe-knative-worker","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.527027027027027,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"thanhtai9606/camunda-sample","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7363636363636363,"lowerBound":0.5344827586206896,"coverage":0.13381995133819952,"shown":110,"items":822,"repositories":26},"shown":1,"correct":0},{"group":"tobiasschaefer/token-run","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5268817204301075,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"underwaise/underwaise","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7363636363636363,"lowerBound":0.5346534653465347,"coverage":0.13381995133819952,"shown":110,"items":822,"repositories":26},"shown":1,"correct":0},{"group":"upgradingdave/camunda-deep-dives","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7272727272727273,"lowerBound":0.5222222222222223,"coverage":0.13381995133819952,"shown":110,"items":822,"repositories":26},"shown":1,"correct":1},{"group":"viadee/vPAV","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5285714285714286,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"wkspower/wks-platform","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7272727272727273,"lowerBound":0.5238095238095238,"coverage":0.13381995133819952,"shown":110,"items":822,"repositories":26},"shown":1,"correct":1}]},"shipped":true,"inSample":{"shown":49,"correct":38}}}}}`),tasks:JSON.parse(`{"expression":{"scorer":{"family":"trees","base":8.267391142697759e-17,"trees":[{"nodes":[{"feature":13,"threshold":0.8660714285715,"left":1,"right":6,"value":6.054748532776218e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.06583617921402614},{"feature":2,"threshold":0.778858274079,"left":3,"right":4,"value":-0.11569260454933475},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.14505626899592075},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0354333114455719},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04482598165819095},{"feature":4,"threshold":0.36181818181799996,"left":7,"right":8,"value":0.15548814253039592},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04482598165819095},{"feature":2,"threshold":0.4217083842085,"left":9,"right":10,"value":0.1655928888008516},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.10520943522952128},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.17664202177712054}]},{"nodes":[{"feature":13,"threshold":0.775,"left":1,"right":6,"value":1.3675614541016841e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.0698626923210247},{"feature":15,"threshold":0.1875,"left":3,"right":4,"value":-0.12746093242423598},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.054298717143490695},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1757514101236366},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01886349813725459},{"feature":5,"threshold":0.265625,"left":7,"right":10,"value":0.10758968859552354},{"feature":2,"threshold":0.4217083842085,"left":8,"right":9,"value":0.12565277920678625},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01886349813725459},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.1415106043801704},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01886349813725459}]},{"nodes":[{"feature":13,"threshold":0.775,"left":1,"right":6,"value":2.6678986267644406e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.05907722684967324},{"feature":15,"threshold":0.1875,"left":3,"right":4,"value":-0.11214268697277222},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.047914698852020314},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.15772415972746953},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.016313289268731587},{"feature":5,"threshold":0.265625,"left":7,"right":10,"value":0.09170380538713935},{"feature":2,"threshold":0.4217083842085,"left":8,"right":9,"value":0.10943073451045149},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.016313289268731587},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.12462324990754528},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.016313289268731587}]},{"nodes":[{"feature":13,"threshold":0.8660714285715,"left":1,"right":6,"value":-1.9957523359099204e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.04082737410409882},{"feature":2,"threshold":0.778858274079,"left":3,"right":4,"value":-0.07975970864516202},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10381973675560248},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.024539512073525938},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.030680684498110143},{"feature":4,"threshold":0.36181818181799996,"left":7,"right":8,"value":0.10218874310031348},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.030680684498110143},{"feature":2,"threshold":0.4217083842085,"left":9,"right":10,"value":0.11197622455332142},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07132845452571578},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.12206891202133635}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":3.5304991228069454e-17},{"feature":4,"threshold":0.36181818181799996,"left":2,"right":5,"value":0.02201516311973511},{"feature":0,"threshold":0.5,"left":3,"right":4,"value":-0.11645900804470605},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.15062138238689649},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.03781835649527586},{"feature":13,"threshold":0.8660714285715,"left":6,"right":7,"value":0.040822295054154085},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0074224687419105935},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.10437987365058682},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.15814875613306975}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":6,"value":2.9713529139169335e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":0.020245446120921686},{"feature":13,"threshold":0.775,"left":3,"right":4,"value":-0.000767123217373158},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07132841413775429},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06226693259546233},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.12530098840829848},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.14918929510261905}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":2.101799823062333e-17},{"feature":4,"threshold":0.377976190476,"left":2,"right":5,"value":0.01865213521714104},{"feature":3,"threshold":0.005051149207,"left":3,"right":4,"value":-0.09172183717314492},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.12408202610081552},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.02724380556307886},{"feature":5,"threshold":0.171875,"left":6,"right":7,"value":0.03723422604698675},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07874625396740045},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.006093636046154119},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1417327320946171}]},{"nodes":[{"feature":13,"threshold":0.8660714285715,"left":1,"right":6,"value":2.2653924992795168e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.02993021298783017},{"feature":15,"threshold":0.1875,"left":3,"right":4,"value":-0.06011255211849803},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.017802174267668083},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.11815682325242334},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.024508203583161865},{"feature":4,"threshold":0.43650793650749997,"left":7,"right":8,"value":0.07894662015414874},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.024508203583161865},{"feature":16,"threshold":0.1,"left":9,"right":10,"value":0.09602576639614435},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06026698498965309},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.10827630608251607}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":1.531232261210572e-17},{"feature":4,"threshold":0.377976190476,"left":2,"right":5,"value":0.01723180551446997},{"feature":3,"threshold":0.005051149207,"left":3,"right":4,"value":-0.08141142524122971},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.11281192364734388},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.024043980740193444},{"feature":5,"threshold":0.171875,"left":6,"right":7,"value":0.03332346376084276},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06989269817244774},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.003509841254715202},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.13471208598072895}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":1.5350447175324978e-17},{"feature":13,"threshold":0.8660714285715,"left":2,"right":5,"value":0.015804674645728895},{"feature":15,"threshold":0.5,"left":3,"right":4,"value":-0.008895403589325659},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.024449305451237125},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10785874649579599},{"feature":4,"threshold":0.43650793650749997,"left":6,"right":7,"value":0.07477816147795889},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.032941378944316306},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08848925850799229},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1299383699196339}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":6,"value":-7.62735239830658e-18},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":0.014691018998753459},{"feature":13,"threshold":0.775,"left":3,"right":4,"value":-0.0015406719132875434},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.051442384665431586},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.048756955361077894},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09905458263544137},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.12569485003652645}]},{"nodes":[{"feature":4,"threshold":0.40833333333349997,"left":1,"right":6,"value":2.887248966101442e-17},{"feature":3,"threshold":0.005051149207,"left":2,"right":5,"value":-0.08562601051969777},{"feature":16,"threshold":0.5357142857145001,"left":3,"right":4,"value":-0.11538940890535457},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.13167120311982822},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07417344491158707},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.032957480917819436},{"feature":5,"threshold":0.171875,"left":7,"right":10,"value":0.019711048684059342},{"feature":13,"threshold":0.775,"left":8,"right":9,"value":0.06466927233863475},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03811298848449726},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08867955642349613},{"feature":3,"threshold":9.03e-10,"left":11,"right":12,"value":-0.018757446235743495},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.032957480917819436},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0468794069550239}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":6,"value":-3.9665361177041975e-18},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":0.013133214419439546},{"feature":13,"threshold":0.775,"left":3,"right":4,"value":-0.000993804844724828},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04430525196605736},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04469808115754506},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09038996715981995},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.12094989182359579}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-3.332227901328767e-17},{"feature":5,"threshold":0.328125,"left":2,"right":5,"value":0.012240524634110184},{"feature":13,"threshold":0.775,"left":3,"right":4,"value":-0.003385423756669881},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05308662869789155},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04807112460445418},{"feature":15,"threshold":0.1875,"left":6,"right":7,"value":0.08396437359540133},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.1346048497361991},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0560226277788786},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1188773445206888}]},{"nodes":[{"feature":4,"threshold":0.40833333333349997,"left":1,"right":8,"value":-1.796310785975084e-17},{"feature":16,"threshold":0.242857142857,"left":2,"right":5,"value":-0.07729526442572342},{"feature":0,"threshold":0.5,"left":3,"right":4,"value":-0.11720474628736498},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1323451263582729},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0693243516524631},{"feature":5,"threshold":0.234375,"left":6,"right":7,"value":-0.030270303298066438},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10132375277057437},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.030270303298066438},{"feature":5,"threshold":0.171875,"left":9,"right":12,"value":0.01675465782959051},{"feature":13,"threshold":0.8819444444444999,"left":10,"right":11,"value":0.05838619491686077},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04199509775809052},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0905658651370276},{"feature":3,"threshold":9.03e-10,"left":13,"right":14,"value":-0.018115611114124307},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.030270303298066438},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04185951312224993}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":1.0367271421787465e-18},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.010647511430556006},{"feature":13,"threshold":0.775,"left":3,"right":4,"value":-0.00045977713154789733},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.034379494512112856},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04022416912960887},{"feature":3,"threshold":7.66205e-8,"left":6,"right":7,"value":0.10378019308498627},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0023736092422712296},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.13853291702390733},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.11322148032931197}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":8.176193639454762e-18},{"feature":13,"threshold":0.775,"left":2,"right":5,"value":-0.014198463901135045},{"feature":5,"threshold":0.328125,"left":3,"right":4,"value":-0.048995727264441624},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10468660658213186},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.00916319343044962},{"feature":2,"threshold":0.4217083842085,"left":6,"right":7,"value":0.03066934040354251},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.00916319343044962},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.035001205265726636},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08420087443259025}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":3.254476324009266e-17},{"feature":5,"threshold":0.328125,"left":2,"right":5,"value":0.010032795120815816},{"feature":5,"threshold":0.171875,"left":3,"right":4,"value":-0.005018971445616344},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03305454799811655},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05246008688037741},{"feature":15,"threshold":0.1875,"left":6,"right":7,"value":0.0733077865255627},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.1143826918147528},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.047351415474944876},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.11097838860695249}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":1.6825903510808226e-18},{"feature":13,"threshold":0.775,"left":2,"right":5,"value":-0.012670389081347154},{"feature":5,"threshold":0.265625,"left":3,"right":4,"value":-0.04512064048290898},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.11104739965453288},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.008547768137605232},{"feature":2,"threshold":0.4217083842085,"left":6,"right":7,"value":0.028025104207698655},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.008547768137605232},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03225080150879153},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07717199209892983}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":4.928145208017401e-18},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.009252307899984784},{"feature":4,"threshold":0.43650793650749997,"left":3,"right":4,"value":-0.0013074138243490225},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08174942901298127},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01485716709192777},{"feature":3,"threshold":7.66205e-8,"left":6,"right":7,"value":0.08954473335637386},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0017372372118366346},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.11884099037489862},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10805172411673623}]},{"nodes":[{"feature":2,"threshold":0.778858274079,"left":1,"right":6,"value":5.1234748455884885e-18},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.008294670709749933},{"feature":13,"threshold":0.8660714285715,"left":3,"right":4,"value":-0.021978575029050904},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05197194083346945},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.013861961765050937},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04970249855915278},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.10769966782805394}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-1.3025608921142894e-17},{"feature":5,"threshold":0.328125,"left":2,"right":5,"value":0.008363888630456406},{"feature":13,"threshold":0.775,"left":3,"right":4,"value":-0.006505824472621011},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04542122230022665},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.030748918316639447},{"feature":15,"threshold":0.1875,"left":6,"right":7,"value":0.06739300560222952},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.1033535916946698},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04234009238684914},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1060668373554648}]},{"nodes":[{"feature":2,"threshold":0.778858274079,"left":1,"right":6,"value":-9.401821304366014e-18},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.0076601843249156495},{"feature":13,"threshold":0.8660714285715,"left":3,"right":4,"value":-0.021175817218263903},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04891016286634864},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.013137290834476139},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04745039888721618},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.10256098209934528}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-8.707954538058852e-18},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.0075251593656691295},{"feature":4,"threshold":0.43650793650749997,"left":3,"right":4,"value":-0.0035602741070779316},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07778220734902049},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.011421565641899948},{"feature":3,"threshold":7.66205e-8,"left":6,"right":7,"value":0.08704510351359313},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.005552805654992489},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.11184433137674121},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10362313679421278}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-2.816032515302123e-17},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.006861850378826058},{"feature":4,"threshold":0.43650793650749997,"left":3,"right":4,"value":-0.0035129260831480106},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07341963810657187},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.010334451062259071},{"feature":15,"threshold":0.75,"left":6,"right":7,"value":0.08088228183533573},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09262949511097848},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.06696586847104628},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10202711441734842}]},{"nodes":[{"feature":2,"threshold":0.778858274079,"left":1,"right":6,"value":-3.6402816817745574e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.007181822354263997},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.019068832243241737},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.06302285323127103},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.013111908915986696},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04529265007521513},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09776712250469878}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":6,"value":-2.6129870467424935e-18},{"feature":5,"threshold":0.109375,"left":2,"right":3,"value":0.006313217530095516},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.12694737200811035},{"feature":5,"threshold":0.359375,"left":4,"right":5,"value":0.011664828917454809},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.002356988135305538},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07412492527564264},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1005450383188943}]},{"nodes":[{"feature":2,"threshold":0.778858274079,"left":1,"right":8,"value":-3.405870151876631e-17},{"feature":13,"threshold":0.8819444444444999,"left":2,"right":5,"value":-0.006649181452248857},{"feature":9,"threshold":0.5,"left":3,"right":4,"value":-0.023866049044128868},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04216727662709658},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.009482853352228383},{"feature":16,"threshold":0.1,"left":6,"right":7,"value":0.04283175574858622},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.009482853352228383},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0429456991932576},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09254057983876851}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":6,"value":2.27220128479038e-18},{"feature":5,"threshold":0.109375,"left":2,"right":3,"value":0.005768119125221676},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.12430492058593008},{"feature":5,"threshold":0.359375,"left":4,"right":5,"value":0.010690002464547781},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0014756274962359507},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0709977977851654},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0990057323737948}]},{"nodes":[{"feature":2,"threshold":0.778858274079,"left":1,"right":8,"value":-2.4710415128353123e-18},{"feature":13,"threshold":0.8660714285715,"left":2,"right":5,"value":-0.006159065948404231},{"feature":9,"threshold":0.5,"left":3,"right":4,"value":-0.02378921519463273},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04331944430282169},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.005564784632747122},{"feature":16,"threshold":0.1,"left":6,"right":7,"value":0.0349187844601268},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.005564784632747122},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.040750256004473684},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08765957795735174}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-1.2232772740696998e-17},{"feature":5,"threshold":0.328125,"left":2,"right":5,"value":0.005294934322101872},{"feature":5,"threshold":0.171875,"left":3,"right":4,"value":-0.00793612905124165},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02472667752326324},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.045208736277297046},{"feature":15,"threshold":0.1875,"left":6,"right":7,"value":0.0539022885086116},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08877816943346989},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.046781393520270415},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09759411478213223}]},{"nodes":[{"feature":5,"threshold":0.109375,"left":1,"right":2,"value":6.007735837985458e-18},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1233250697778158},{"feature":5,"threshold":0.171875,"left":3,"right":6,"value":0.004360168330280591},{"feature":4,"threshold":0.43650793650749997,"left":4,"right":5,"value":0.03517634918183817},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1145745099787465},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.045168704579628675},{"feature":5,"threshold":0.234375,"left":7,"right":8,"value":-0.015060993006501528},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1242088288780902},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.015566155255083442}]},{"nodes":[{"feature":5,"threshold":0.109375,"left":1,"right":2,"value":-2.5218491858271316e-18},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.12007573030737287},{"feature":9,"threshold":0.5,"left":3,"right":6,"value":0.004043512703427689},{"feature":2,"threshold":0.317385620915,"left":4,"right":5,"value":-0.005345727700294244},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08974683937884624},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.005683614886607962},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06114779465177972}]},{"nodes":[{"feature":19,"threshold":0.268063016521,"left":1,"right":8,"value":2.350308171000531e-17},{"feature":13,"threshold":0.8660714285715,"left":2,"right":5,"value":-0.00575801808649618},{"feature":5,"threshold":0.328125,"left":3,"right":4,"value":-0.022540577429660424},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05118449482000351},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.005105103932639696},{"feature":16,"threshold":0.1,"left":6,"right":7,"value":0.032750785294939196},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.005105103932639696},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.038635364753095175},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08302874759268526}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":1.6722222018675842e-17},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.005110242250038952},{"feature":3,"threshold":0.005930202625,"left":3,"right":4,"value":-0.003981743192506485},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.015276966577183257},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06308517424309677},{"feature":15,"threshold":0.1875,"left":6,"right":7,"value":0.06205088834155437},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08578880112775267},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.009659390734301818},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09578127903219996}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":6,"value":4.441675595006774e-18},{"feature":5,"threshold":0.109375,"left":2,"right":3,"value":0.004658764751228656},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.11677343806895715},{"feature":5,"threshold":0.359375,"left":4,"right":5,"value":0.008716264000980944},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0006964304692797908},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.057319065959824},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.094237788551945}]},{"nodes":[{"feature":22,"threshold":0.1774227797055,"left":1,"right":6,"value":2.6451444519886713e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.005495894871829305},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.015679012865945863},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05860981783916267},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.010801321684859849},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03728165623566556},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08005920734316185}]},{"nodes":[{"feature":4,"threshold":0.377976190476,"left":1,"right":8,"value":1.3551581134217446e-18},{"feature":15,"threshold":0.5,"left":2,"right":5,"value":-0.05195473263097747},{"feature":0,"threshold":0.5,"left":3,"right":4,"value":-0.09078541623235462},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1124436026063837},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.038251487431714415},{"feature":5,"threshold":0.171875,"left":6,"right":7,"value":-0.022047387435305623},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.06726109586631192},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.022047387435305623},{"feature":5,"threshold":0.171875,"left":9,"right":12,"value":0.007859957760365986},{"feature":15,"threshold":0.3125,"left":10,"right":11,"value":0.033876417140003764},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.01871008346291222},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0528894911138984},{"feature":3,"threshold":9.03e-10,"left":13,"right":14,"value":-0.01151668585289412},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.022047387435305623},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.030983712012719274}]},{"nodes":[{"feature":19,"threshold":0.268063016521,"left":1,"right":8,"value":-1.0273263359363686e-17},{"feature":13,"threshold":0.8660714285715,"left":2,"right":5,"value":-0.005246314539651562},{"feature":15,"threshold":0.75,"left":3,"right":4,"value":-0.02112762420332635},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0054163566847451015},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1028554824744995},{"feature":16,"threshold":0.1,"left":6,"right":7,"value":0.03033857606891261},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.00460547593279334},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.035733791599523286},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0767138977386981}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-3.427726097279986e-17},{"feature":5,"threshold":0.328125,"left":2,"right":5,"value":0.004311223589209733},{"feature":13,"threshold":0.775,"left":3,"right":4,"value":-0.007321239146424005},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.038835970732579786},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.020366431895433555},{"feature":15,"threshold":0.1875,"left":6,"right":7,"value":0.04329628954332143},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07301248320483021},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04364499463744836},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0923807447885269}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":-9.921719785543194e-18},{"feature":2,"threshold":0.317385620915,"left":2,"right":5,"value":-0.008253646456768507},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.08774829079161311},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.12155446463283347},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04263302697643593},{"feature":3,"threshold":9.03e-10,"left":6,"right":7,"value":0.002482236838741146},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.023104171320871978},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.019831747300230452},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.047917141057229766}]},{"nodes":[{"feature":2,"threshold":0.778858274079,"left":1,"right":8,"value":-1.559553501292488e-17},{"feature":5,"threshold":0.234375,"left":2,"right":5,"value":-0.005287168006369891},{"feature":15,"threshold":0.3125,"left":3,"right":4,"value":-0.026928646631776222},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1452994935192141},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.011184945516796219},{"feature":3,"threshold":9.03e-10,"left":6,"right":7,"value":0.01560971379652624},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07459849513968515},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03535078411954087},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0759887362454565}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-1.756588757959594e-19},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.0039487660903079844},{"feature":5,"threshold":0.171875,"left":3,"right":4,"value":-0.004093155627539711},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.023333854292769952},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.02869427055860061},{"feature":15,"threshold":0.75,"left":6,"right":7,"value":0.050733385264937696},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.059707668639745526},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05899801099597535},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08993204747831685}]},{"nodes":[{"feature":5,"threshold":0.109375,"left":1,"right":2,"value":6.486048504563046e-18},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10750455536747859},{"feature":5,"threshold":0.171875,"left":3,"right":6,"value":0.0032828898049980237},{"feature":4,"threshold":0.43650793650749997,"left":4,"right":5,"value":0.031063961116678918},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0986545522087217},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03980056195833159},{"feature":5,"threshold":0.234375,"left":7,"right":8,"value":-0.01368646098503703},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1156644589740321},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.012268162169664894}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":6,"value":-6.734138574111558e-18},{"feature":5,"threshold":0.109375,"left":2,"right":3,"value":0.0037770475519204555},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10418048855589526},{"feature":5,"threshold":0.171875,"left":4,"right":5,"value":0.007048445319118653},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.028907667503884696},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.007170840729706096},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08861096980774764}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":1.2470499439856705e-17},{"feature":2,"threshold":0.317385620915,"left":2,"right":5,"value":-0.007444451828059348},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.08184526840919303},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.11624858582437728},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.03982890931579126},{"feature":13,"threshold":0.8660714285715,"left":6,"right":7,"value":0.002187449777610497},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.014473276437613702},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01769025516114712},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04282496215035289}]},{"nodes":[{"feature":19,"threshold":0.268063016521,"left":1,"right":8,"value":2.4807484333942544e-17},{"feature":13,"threshold":0.8660714285715,"left":2,"right":5,"value":-0.004651894589806949},{"feature":15,"threshold":0.75,"left":3,"right":4,"value":-0.017914720337117118},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.004079338450100427},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09951965694169668},{"feature":5,"threshold":0.140625,"left":6,"right":7,"value":0.02487470358190456},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03255541282927463},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0034799916223936175},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0697627202483552}]},{"nodes":[{"feature":4,"threshold":0.8397435897434999,"left":1,"right":8,"value":1.5755276018977344e-17},{"feature":5,"threshold":0.171875,"left":2,"right":5,"value":-0.007552318043939079},{"feature":4,"threshold":0.43650793650749997,"left":3,"right":4,"value":0.018074676399926368},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1124819876424738},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.018074676399926368},{"feature":3,"threshold":9.395250000000001e-8,"left":6,"right":7,"value":-0.02867629584398463},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09686857487352572},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01550609574497734},{"feature":15,"threshold":0.1875,"left":9,"right":12,"value":0.04370167084379251},{"feature":3,"threshold":9.03e-10,"left":10,"right":11,"value":0.07924627546249458},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.018074676399926368},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.10462119700937478},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.018074676399926368}]},{"nodes":[{"feature":2,"threshold":0.778858274079,"left":1,"right":8,"value":-1.54834764076083e-17},{"feature":5,"threshold":0.234375,"left":2,"right":5,"value":-0.004472160971890671},{"feature":15,"threshold":0.3125,"left":3,"right":4,"value":-0.027215749505527756},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.13600645681777254},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.009336799395438189},{"feature":3,"threshold":9.03e-10,"left":6,"right":7,"value":0.016087101164666055},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.06184763112464491},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03162159060588459},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06771534218365803}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-5.522712623745842e-19},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.003482317537257222},{"feature":3,"threshold":0.005930202625,"left":3,"right":4,"value":-0.005382410628850098},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.015974890797185},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.051118914161371126},{"feature":15,"threshold":0.75,"left":6,"right":7,"value":0.05010104985245875},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.05691288928902876},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04968253045484382},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08539825979539128}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":5.883184703947521e-18},{"feature":2,"threshold":0.317385620915,"left":2,"right":5,"value":-0.007624634378507376},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.07902048134873046},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.11325758238173754},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.03882757649160573},{"feature":5,"threshold":0.140625,"left":6,"right":7,"value":0.0013653283655190931},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.016874970265860583},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.009477887925885244},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04137457491022707}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-2.3776675255736462e-17},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.0032441073963956134},{"feature":3,"threshold":0.005930202625,"left":3,"right":4,"value":-0.005030409389972363},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.015078182351416891},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04828319187255609},{"feature":15,"threshold":0.1875,"left":6,"right":7,"value":0.04625327572589169},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06144533523620324},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0006885274988083345},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08360105828185854}]},{"nodes":[{"feature":19,"threshold":0.268063016521,"left":1,"right":6,"value":-2.399349244878928e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.004232225342600378},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.012413207963401106},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05280695962771514},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.00886352975428899},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03014026747197909},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06451276028655481}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-3.15062570816179e-17},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.003026851770665257},{"feature":5,"threshold":0.171875,"left":3,"right":4,"value":-0.004658074507893083},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.019431640690382244},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.025764542049665686},{"feature":15,"threshold":0.75,"left":6,"right":7,"value":0.04250254485229999},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04915912581440204},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04963036183393196},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08183316343428375}]},{"nodes":[{"feature":5,"threshold":0.109375,"left":1,"right":2,"value":-2.1715386448701265e-17},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0948707309409283},{"feature":5,"threshold":0.171875,"left":3,"right":6,"value":0.002739257016191031},{"feature":4,"threshold":0.43650793650749997,"left":4,"right":5,"value":0.025922919794962796},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0859402033035092},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03367371736565405},{"feature":5,"threshold":0.234375,"left":7,"right":8,"value":-0.01105002677793437},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10757007064965154},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.010338046793873432}]},{"nodes":[{"feature":4,"threshold":0.8397435897434999,"left":1,"right":8,"value":-1.7044713404786746e-17},{"feature":5,"threshold":0.171875,"left":2,"right":5,"value":-0.0065214241611356825},{"feature":4,"threshold":0.43650793650749997,"left":3,"right":4,"value":0.015452813149234367},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10098705310547632},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.015452813149234367},{"feature":3,"threshold":9.395250000000001e-8,"left":6,"right":7,"value":-0.027017820308762226},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08817180320155954},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.009114764003300158},{"feature":15,"threshold":0.1875,"left":9,"right":12,"value":0.03742705045960475},{"feature":3,"threshold":9.03e-10,"left":10,"right":11,"value":0.07212728291022169},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.015452813149234367},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09350398352552775},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.015452813149234367}]},{"nodes":[{"feature":19,"threshold":0.268063016521,"left":1,"right":8,"value":-8.14426772444846e-19},{"feature":13,"threshold":0.8660714285715,"left":2,"right":5,"value":-0.003989201307942102},{"feature":15,"threshold":0.75,"left":3,"right":4,"value":-0.016061687426902053},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.00286281271597068},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09655230034787332},{"feature":5,"threshold":0.140625,"left":6,"right":7,"value":0.022337931738541626},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02884486212673708},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.003138122155819765},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.061678925561415715}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":4.930988972290541e-18},{"feature":5,"threshold":0.234375,"left":2,"right":5,"value":-0.006599729786984483},{"feature":2,"threshold":0.4536287299445,"left":3,"right":4,"value":-0.03410311680354008},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.11350472637653929},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.00011725442701311862},{"feature":3,"threshold":9.03e-10,"left":6,"right":7,"value":0.014438426636173896},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10091136247519505},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.014438426636173896},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.035476583059332344}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-7.566811035557406e-18},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.002872408258180647},{"feature":4,"threshold":0.8397435897434999,"left":3,"right":4,"value":-0.005239412280029054},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.015624703548585389},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.044826033549406855},{"feature":15,"threshold":0.1875,"left":6,"right":7,"value":0.04135660488283376},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.054784372582948986},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.00009808941983554898},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07851915997563072}]},{"nodes":[{"feature":2,"threshold":0.778858274079,"left":1,"right":8,"value":-3.984727385730123e-18},{"feature":5,"threshold":0.234375,"left":2,"right":5,"value":-0.0039043457407027964},{"feature":15,"threshold":0.3125,"left":3,"right":4,"value":-0.0224223092399169},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1229243070546199},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01008492186690493},{"feature":3,"threshold":0.005930202625,"left":6,"right":7,"value":0.011843106958506357},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.004088924513079856},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02812127995537429},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06014690565145145}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":8.831360934527712e-18},{"feature":2,"threshold":0.317385620915,"left":2,"right":5,"value":-0.0064938072390250574},{"feature":15,"threshold":0.3125,"left":3,"right":4,"value":-0.07055729856408881},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.03481915616337397},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10423086460231086},{"feature":5,"threshold":0.140625,"left":6,"right":7,"value":0.0009189862373410317},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.013841155171846269},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.009320781341330416},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.034176117582716874}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":3.32987921377419e-18},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.0026960367101936233},{"feature":3,"threshold":0.005930202625,"left":3,"right":4,"value":-0.00495117913188698},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.01414539328565023},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.040972044052130764},{"feature":15,"threshold":0.75,"left":6,"right":7,"value":0.03823432491066972},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04340169815060646},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.041887459579241004},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07636118949875924}]},{"nodes":[{"feature":19,"threshold":0.268063016521,"left":1,"right":8,"value":6.3175456849469176e-18},{"feature":13,"threshold":0.8660714285715,"left":2,"right":5,"value":-0.003656953212194826},{"feature":15,"threshold":0.75,"left":3,"right":4,"value":-0.014930641133971951},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0030092495940377863},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09380781520171522},{"feature":5,"threshold":0.140625,"left":6,"right":7,"value":0.020681257037553413},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02638136948029259},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0028753079517907336},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.05641969217277959}]},{"nodes":[{"feature":5,"threshold":0.109375,"left":1,"right":2,"value":9.008433670321698e-18},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08327810558034962},{"feature":5,"threshold":0.171875,"left":3,"right":6,"value":0.002418042485550141},{"feature":4,"threshold":0.43650793650749997,"left":4,"right":5,"value":0.024007125645083057},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07214374243498946},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.030437079878695445},{"feature":5,"threshold":0.234375,"left":7,"right":8,"value":-0.009792573114199375},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10282844542980399},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.008308663441077294}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":3.805442811305386e-18},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.0025906892582509295},{"feature":4,"threshold":0.8397435897434999,"left":3,"right":4,"value":-0.004833103023579699},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.014645912949949859},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04223716822291243},{"feature":15,"threshold":0.1875,"left":6,"right":7,"value":0.03586992325567945},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.048206980001537295},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0018946235819143863},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07446369492000901}]},{"nodes":[{"feature":2,"threshold":0.778858274079,"left":1,"right":6,"value":-2.89570696290555e-18},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.003674172140321676},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.01099250892057766},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05003023915658046},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.00751820017127826},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02602890926313418},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.055731990666589154}]},{"nodes":[{"feature":19,"threshold":0.268063016521,"left":1,"right":8,"value":-4.111848153354052e-18},{"feature":13,"threshold":0.8660714285715,"left":2,"right":5,"value":-0.003426244285540965},{"feature":15,"threshold":0.75,"left":3,"right":4,"value":-0.014364222107252175},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0030247617328909844},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09237992743527039},{"feature":5,"threshold":0.140625,"left":6,"right":7,"value":0.020175115379358316},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.024703417200071},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.00290544663605323},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.052833078685682835}]},{"nodes":[{"feature":5,"threshold":0.109375,"left":1,"right":2,"value":-1.115844327715153e-17},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07911509467566216},{"feature":5,"threshold":0.171875,"left":3,"right":6,"value":0.0022672913055511337},{"feature":2,"threshold":0.604107142857,"left":4,"right":5,"value":0.023713852565107704},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.012860888917949974},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08380522124821531},{"feature":5,"threshold":0.234375,"left":7,"right":8,"value":-0.00963352229372703},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0994483367659489},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.006413084203068575}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-1.1996780925827457e-17},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.002494710223264306},{"feature":4,"threshold":0.8397435897434999,"left":3,"right":4,"value":-0.0047450109749157445},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.014267859683670931},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04024764050375848},{"feature":15,"threshold":0.1875,"left":6,"right":7,"value":0.033723947683226375},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04619571604273703},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.00368645990209291},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07244530012679266}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":-3.8201939615613955e-18},{"feature":4,"threshold":0.377976190476,"left":2,"right":5,"value":-0.0061714560121515485},{"feature":3,"threshold":0.005051149207,"left":3,"right":4,"value":-0.06171115472652066},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09560549673298185},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.030161664629052235},{"feature":5,"threshold":0.234375,"left":6,"right":7,"value":0.0013878254684159238},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.026171518035010184},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.012556582726226572},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03128462146460438}]},{"nodes":[{"feature":13,"threshold":0.8660714285715,"left":1,"right":6,"value":1.0018747018744608e-17},{"feature":15,"threshold":0.75,"left":2,"right":5,"value":-0.008712388332220296},{"feature":5,"threshold":0.140625,"left":3,"right":4,"value":0.0018316876450361912},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08573260910192622},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.005715854216064819},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09098803962043317},{"feature":5,"threshold":0.140625,"left":7,"right":8,"value":0.020144096764349462},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06539846670562789},{"feature":5,"threshold":0.234375,"left":9,"right":10,"value":0.005715854216064819},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.005715854216064819},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04628447629725126}]},{"nodes":[{"feature":2,"threshold":0.778858274079,"left":1,"right":6,"value":1.17673211999304e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.0034518682139321045},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.009909868999841979},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0493820860148749},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007004691259228417},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.023919251518298813},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.05129037125053093}]},{"nodes":[{"feature":5,"threshold":0.171875,"left":1,"right":6,"value":6.33383421783981e-18},{"feature":4,"threshold":0.43650793650749997,"left":2,"right":3,"value":0.0173615272116098},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0824861405679741},{"feature":15,"threshold":0.3125,"left":4,"right":5,"value":0.027937315563662236},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.003160055889468608},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03748714932789992},{"feature":5,"threshold":0.234375,"left":7,"right":10,"value":-0.009778354626605918},{"feature":15,"threshold":0.9375,"left":8,"right":9,"value":-0.09537508951646817},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10277105827330527},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.033331170007570264},{"feature":3,"threshold":9.03e-10,"left":11,"right":12,"value":0.004186278611745333},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05459085821819368},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.017722501148695887}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":1.2096768229221714e-17},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.002409187068312851},{"feature":13,"threshold":0.775,"left":3,"right":4,"value":-0.005034152111967342},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.024927383112201766},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.014883962513969297},{"feature":15,"threshold":0.1875,"left":6,"right":7,"value":0.03245358188534128},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.043311356076348714},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.001173921821751427},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.06976203566437202}]},{"nodes":[{"feature":19,"threshold":0.268063016521,"left":1,"right":6,"value":1.4109270157969207e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.003364585159796306},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.009873325058498725},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.046093794890263766},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.006876269983398044},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.023625865025294814},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.050616315210385655}]},{"nodes":[{"feature":5,"threshold":0.171875,"left":1,"right":6,"value":8.557186261881517e-18},{"feature":4,"threshold":0.43650793650749997,"left":2,"right":3,"value":0.017635165775452648},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07944331023277638},{"feature":15,"threshold":0.3125,"left":4,"right":5,"value":0.027519156263797792},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0025379573483543597},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0364005319255018},{"feature":5,"threshold":0.234375,"left":7,"right":10,"value":-0.009972990261554966},{"feature":15,"threshold":0.9375,"left":8,"right":9,"value":-0.09263269121339085},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09969763662864671},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.03237876254198541},{"feature":3,"threshold":9.03e-10,"left":11,"right":12,"value":0.0027058060914608487},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.051166744462804475},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.014924477064909883}]},{"nodes":[{"feature":5,"threshold":0.171875,"left":1,"right":6,"value":-2.578438577662298e-18},{"feature":4,"threshold":0.43650793650749997,"left":2,"right":3,"value":0.01675317000535929},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0769122038514431},{"feature":15,"threshold":0.3125,"left":4,"right":5,"value":0.025964342430428236},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.003161963590045354},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03463442580446993},{"feature":5,"threshold":0.234375,"left":7,"right":10,"value":-0.00951069870490593},{"feature":2,"threshold":0.6131883394385,"left":8,"right":9,"value":-0.0903182648086374},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09689445075047554},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.028677076011367614},{"feature":13,"threshold":0.8166666666665,"left":11,"right":12,"value":0.002288823652980513},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.013038641666624249},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04023416286143663}]},{"nodes":[{"feature":19,"threshold":0.268063016521,"left":1,"right":8,"value":-9.304603924314294e-18},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":-0.003278634715368778},{"feature":4,"threshold":0.5683229813665001,"left":3,"right":4,"value":-0.010884190272006353},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.03865302316888919},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.012923660907595001},{"feature":5,"threshold":0.390625,"left":6,"right":7,"value":0.02242535141704674},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.022917066034392787},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.06630054925940114},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04911276678415485}]},{"nodes":[{"feature":5,"threshold":0.171875,"left":1,"right":6,"value":1.6232984263506177e-17},{"feature":4,"threshold":0.43650793650749997,"left":2,"right":3,"value":0.016302397001596407},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07379096151325627},{"feature":15,"threshold":0.3125,"left":4,"right":5,"value":0.024757951961782806},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0035662372435479326},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03305172397187652},{"feature":5,"threshold":0.234375,"left":7,"right":10,"value":-0.009328030290707242},{"feature":15,"threshold":0.9375,"left":8,"right":9,"value":-0.08783499634968255},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09494431827147884},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.02886333140435478},{"feature":3,"threshold":9.03e-10,"left":11,"right":12,"value":0.0016744473091128643},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04698578092322431},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.012618366378627413}]},{"nodes":[{"feature":19,"threshold":0.268063016521,"left":1,"right":8,"value":1.6735724835095066e-17},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":-0.0031485568033019873},{"feature":4,"threshold":0.5683229813665001,"left":3,"right":4,"value":-0.010614811088787856},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.03585584919448514},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.011104027816035705},{"feature":5,"threshold":0.390625,"left":6,"right":7,"value":0.021705784323871574},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.022168990506016055},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.06434804475108286},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04748653781533366}]},{"nodes":[{"feature":5,"threshold":0.171875,"left":1,"right":6,"value":5.145062008479144e-18},{"feature":2,"threshold":0.6131883394385,"left":2,"right":5,"value":0.015734270199378533},{"feature":15,"threshold":0.3125,"left":3,"right":4,"value":0.004458655579155277},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10073634434718014},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02923353577967172},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08416831397064913},{"feature":5,"threshold":0.234375,"left":7,"right":10,"value":-0.00904491210107204},{"feature":2,"threshold":0.6131883394385,"left":8,"right":9,"value":-0.08550543411218292},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09213049313194399},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.02529569963125628},{"feature":13,"threshold":0.8166666666665,"left":11,"right":12,"value":0.0012768902982304652},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.013645987827684714},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03886929075472165}]},{"nodes":[{"feature":5,"threshold":0.171875,"left":1,"right":6,"value":-8.038236018113453e-19},{"feature":4,"threshold":0.43650793650749997,"left":2,"right":3,"value":0.01545384359761547},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0688965411479687},{"feature":16,"threshold":0.5357142857145001,"left":4,"right":5,"value":0.02302079023086808},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02824708469200886},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.020035964931746465},{"feature":5,"threshold":0.234375,"left":7,"right":10,"value":-0.008877565365968437},{"feature":2,"threshold":0.6131883394385,"left":8,"right":9,"value":-0.08304781051151076},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08999259788042464},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.023827588684830026},{"feature":13,"threshold":0.8166666666665,"left":11,"right":12,"value":0.0007360102583719563},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.012812664250775586},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03514530200535713}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":9.895265792166276e-18},{"feature":15,"threshold":0.3125,"left":2,"right":5,"value":-0.00524737348056456},{"feature":3,"threshold":9.03e-10,"left":3,"right":4,"value":0.01035278746041293},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.037980645220400566},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01035278746041293},{"feature":13,"threshold":0.8166666666665,"left":6,"right":7,"value":-0.027342734927182158},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10000199401578147},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01035278746041293},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.025952948401391136}]},{"nodes":[{"feature":5,"threshold":0.359375,"left":1,"right":8,"value":7.960031071772683e-19},{"feature":5,"threshold":0.171875,"left":2,"right":5,"value":-0.006574076571013674},{"feature":2,"threshold":0.6131883394385,"left":3,"right":4,"value":0.014505501675267452},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0035593722053460976},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08078204838563069},{"feature":3,"threshold":0.005930202625,"left":6,"right":7,"value":-0.024793520798867815},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05590834903448107},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.061074161170862465},{"feature":5,"threshold":0.390625,"left":9,"right":12,"value":0.021516762842710948},{"feature":16,"threshold":0.46428571428550003,"left":10,"right":11,"value":0.033017812869242075},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.021627508543673943},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07313468620339944},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.06223294896826392}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-1.2403535582713082e-18},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.0020338383181124414},{"feature":4,"threshold":0.8397435897434999,"left":3,"right":4,"value":-0.006061564874971136},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.01567065977135991},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03658390254861139},{"feature":16,"threshold":0.46428571428550003,"left":6,"right":7,"value":0.030485186486573664},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01971873374545705},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06824294069952153},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.06081097556425724}]},{"nodes":[{"feature":5,"threshold":0.171875,"left":1,"right":6,"value":3.778219921260663e-18},{"feature":2,"threshold":0.6131883394385,"left":2,"right":5,"value":0.014673746521918786},{"feature":15,"threshold":0.3125,"left":3,"right":4,"value":0.0042885940331298025},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09661497502815336},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.027200271494730068},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07840653166034023},{"feature":5,"threshold":0.234375,"left":7,"right":10,"value":-0.008491234649883102},{"feature":15,"threshold":0.9375,"left":8,"right":9,"value":-0.07920696306021319},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08661216047997287},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0207273833517679},{"feature":4,"threshold":0.8397435897434999,"left":11,"right":12,"value":0.0001692261242986526},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.011531905617912508},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03745750669556632}]},{"nodes":[{"feature":5,"threshold":0.171875,"left":1,"right":6,"value":-2.5685134638232312e-18},{"feature":4,"threshold":0.43650793650749997,"left":2,"right":3,"value":0.014708059428255713},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.06342009367971733},{"feature":16,"threshold":0.5357142857145001,"left":4,"right":5,"value":0.021596117848586067},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.026825954646608127},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.019319259411466394},{"feature":5,"threshold":0.234375,"left":7,"right":10,"value":-0.008472901242117567},{"feature":15,"threshold":0.9375,"left":8,"right":9,"value":-0.07652491349774794},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08436052780302726},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.018967442762906742},{"feature":13,"threshold":0.8166666666665,"left":11,"right":12,"value":-0.0004145550632518106},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.012597044708891936},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.030925236453306405}]},{"nodes":[{"feature":5,"threshold":0.359375,"left":1,"right":8,"value":-1.2311346465547566e-17},{"feature":5,"threshold":0.265625,"left":2,"right":5,"value":-0.006310275814543323},{"feature":13,"threshold":0.7083333333335,"left":3,"right":4,"value":0.005082643815017221},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.026115926058933647},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.021544865648046578},{"feature":4,"threshold":0.8397435897434999,"left":6,"right":7,"value":-0.04118554570014258},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1151358425695027},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.05508905533117019},{"feature":5,"threshold":0.390625,"left":9,"right":12,"value":0.020041220710164877},{"feature":15,"threshold":0.75,"left":10,"right":11,"value":0.030061604076159668},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.034051272897768735},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.032827290887207775},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05825568157856551}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":4.012076570487409e-18},{"feature":2,"threshold":0.317385620915,"left":2,"right":5,"value":-0.005601534867613283},{"feature":15,"threshold":0.3125,"left":3,"right":4,"value":-0.06838042115218407},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.03360203821874975},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09639769618888143},{"feature":5,"threshold":0.140625,"left":6,"right":7,"value":0.001176344714684547},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.010843361647291671},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.009693142812499542},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.027288258162197262}]},{"nodes":[{"feature":5,"threshold":0.171875,"left":1,"right":6,"value":7.393129091300645e-18},{"feature":2,"threshold":0.6131883394385,"left":2,"right":5,"value":0.013954674494160697},{"feature":15,"threshold":0.3125,"left":3,"right":4,"value":0.004095409178376075},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0932542342109269},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.025290759350931277},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07453684386033367},{"feature":5,"threshold":0.234375,"left":7,"right":10,"value":-0.008127485293581368},{"feature":2,"threshold":0.6131883394385,"left":8,"right":9,"value":-0.07448891022702457},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08119747777005228},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.01770710743989013},{"feature":13,"threshold":0.8166666666665,"left":11,"right":12,"value":-0.0005067613277426546},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.012119030152196739},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.029550241800021027}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":6.580043923307925e-19},{"feature":15,"threshold":0.3125,"left":2,"right":5,"value":-0.004900634025368914},{"feature":3,"threshold":9.03e-10,"left":3,"right":4,"value":0.009489012122432939},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.03433777283999386},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.009489012122432939},{"feature":5,"threshold":0.140625,"left":6,"right":7,"value":-0.02646877306435624},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.009489012122432939},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.06793658062867855},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02387865827023492}]},{"nodes":[{"feature":5,"threshold":0.359375,"left":1,"right":8,"value":1.1730213898776507e-18},{"feature":5,"threshold":0.265625,"left":2,"right":5,"value":-0.00630978551013654},{"feature":13,"threshold":0.7083333333335,"left":3,"right":4,"value":0.004639861427958263},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.026991851830757287},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.020829114477187195},{"feature":4,"threshold":0.8397435897434999,"left":6,"right":7,"value":-0.03999130327959927},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.11240244438925835},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.05138396273545662},{"feature":5,"threshold":0.390625,"left":9,"right":12,"value":0.019180455671766267},{"feature":15,"threshold":0.1875,"left":10,"right":11,"value":0.028353655276762632},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03767924226857067},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0017553092438237945},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.055211220425563604}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":-2.223136644076449e-18},{"feature":2,"threshold":0.317385620915,"left":2,"right":5,"value":-0.0048735919208117845},{"feature":15,"threshold":0.3125,"left":3,"right":4,"value":-0.06571697563661788},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0321140303517747},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09288689231578812},{"feature":5,"threshold":0.140625,"left":6,"right":7,"value":0.001488914933068451},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.009423870172035248},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.008644452025214402},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.023721332264882208}]},{"nodes":[{"feature":19,"threshold":0.268063016521,"left":1,"right":8,"value":1.8592405844657973e-18},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":-0.00260152484350587},{"feature":13,"threshold":0.8660714285715,"left":3,"right":4,"value":-0.010422565455193796},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.028653150013908713},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.015127165734591053},{"feature":5,"threshold":0.390625,"left":6,"right":7,"value":0.01862194417774754},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01862194417774754},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05172876890154754},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03984541319900117}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":-1.3190259535196778e-17},{"feature":15,"threshold":0.3125,"left":2,"right":5,"value":-0.004500940116456366},{"feature":3,"threshold":9.03e-10,"left":3,"right":4,"value":0.008679328094494176},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.031669933615484494},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.008679328094494176},{"feature":13,"threshold":0.8166666666665,"left":6,"right":7,"value":-0.025770747166799127},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09654824999522611},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.008679328094494176},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.021859596305444772}]},{"nodes":[{"feature":19,"threshold":0.268063016521,"left":1,"right":8,"value":9.793409648455251e-18},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":-0.0025924237492034527},{"feature":4,"threshold":0.5683229813665001,"left":3,"right":4,"value":-0.010591548634280946},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.031889669717421014},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.00860223848739979},{"feature":5,"threshold":0.390625,"left":6,"right":7,"value":0.018142550626816904},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.018142550626816904},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05000807402923766},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.038877525002837365}]},{"nodes":[{"feature":5,"threshold":0.171875,"left":1,"right":6,"value":-3.0631333672392573e-18},{"feature":2,"threshold":0.6131883394385,"left":2,"right":5,"value":0.013215467856163815},{"feature":15,"threshold":0.3125,"left":3,"right":4,"value":0.0032625085403549903},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08823495111556927},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02295949356022317},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0716400636843455},{"feature":5,"threshold":0.234375,"left":7,"right":8,"value":-0.007505041526423566},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07296390012882194},{"feature":13,"threshold":0.8166666666665,"left":9,"right":10,"value":-0.0001828353972245942},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.011434984767951344},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02907149647413524}]},{"nodes":[{"feature":5,"threshold":0.359375,"left":1,"right":8,"value":-1.6106327170087874e-17},{"feature":5,"threshold":0.171875,"left":2,"right":5,"value":-0.005874911856877598},{"feature":2,"threshold":0.6131883394385,"left":3,"right":4,"value":0.013062147409138775},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0038776127828684935},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06793973229324955},{"feature":4,"threshold":0.6583333333335,"left":6,"right":7,"value":-0.022857401634520817},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0696311556288577},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02246611437760143},{"feature":5,"threshold":0.390625,"left":9,"right":12,"value":0.017114978960182107},{"feature":16,"threshold":0.46428571428550003,"left":10,"right":11,"value":0.02480690703647862},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.014777746296911776},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06055618281240788},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04979917801302956}]},{"nodes":[{"feature":5,"threshold":0.140625,"left":1,"right":4,"value":-7.60998558639253e-18},{"feature":13,"threshold":0.8660714285715,"left":2,"right":3,"value":0.021315487021910228},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07386786471212098},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.05595100636990367},{"feature":15,"threshold":0.75,"left":5,"right":8,"value":-0.004843733260483547},{"feature":5,"threshold":0.171875,"left":6,"right":7,"value":0.005185210941132804},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03173703700217261},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.002276719635252489},{"feature":16,"threshold":0.3095238095235,"left":9,"right":10,"value":-0.08125419309322028},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007251716865175263},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0897658217530174}]},{"nodes":[{"feature":5,"threshold":0.359375,"left":1,"right":8,"value":-1.8493174869161057e-18},{"feature":5,"threshold":0.265625,"left":2,"right":5,"value":-0.005410409044915361},{"feature":16,"threshold":0.6857142857145,"left":3,"right":4,"value":0.00447969172993312},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.010172728703770938},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07467155480958397},{"feature":4,"threshold":0.8397435897434999,"left":6,"right":7,"value":-0.035826188401027255},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10603203562192541},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.048431150264877425},{"feature":5,"threshold":0.390625,"left":9,"right":12,"value":0.015384200817071376},{"feature":16,"threshold":0.46428571428550003,"left":10,"right":11,"value":0.022696312233700305},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.012928876707718282},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.05790164023880395},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04849481329272294}]}]},"calibration":{"kind":"platt","slope":0.48424623386605475,"intercept":-3.0319726248304417},"threshold":null,"settings":{"penalty":null,"rounds":100},"outOfFold":{"family":"trees","items":40,"candidates":1719,"logLoss":0.09486333238440686,"brier":0.019533147095566483,"logLossByFamily":{"logistic":0.09863631107918631,"trees":0.09486333238440686}}},"input-source":{"scorer":{"family":"trees","base":7.831547644445928e-17,"trees":[{"nodes":[{"feature":19,"threshold":0.169436203034,"left":1,"right":8,"value":-1.0780745884619585e-19},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.15460697598546427},{"feature":16,"threshold":0.8660714285715,"left":3,"right":4,"value":-0.17172222183577732},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.17880239742685133},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08085549249629684},{"feature":5,"threshold":0.234375,"left":6,"right":7,"value":0.01001123684318364},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01001123684318364},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05384532969745492},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.1746294496718049},{"feature":5,"threshold":0.296875,"left":10,"right":11,"value":0.08484592112238286},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01001123684318364},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09979135126881741},{"feature":5,"threshold":0.609375,"left":13,"right":14,"value":0.19113427048999249},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.19167563943075475},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.1491116369599885}]},{"nodes":[{"feature":19,"threshold":0.169436203034,"left":1,"right":8,"value":-4.85587520984096e-18},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.1303576495268854},{"feature":16,"threshold":0.8660714285715,"left":3,"right":4,"value":-0.1456751418787052},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.15186295913450717},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.06851304672561578},{"feature":5,"threshold":0.234375,"left":6,"right":7,"value":0.008649048427473618},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.008649048427473618},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04347699136450328},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.14765574638185003},{"feature":5,"threshold":0.296875,"left":10,"right":11,"value":0.07054118898685005},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.008649048427473618},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0842821189286796},{"feature":5,"threshold":0.609375,"left":13,"right":14,"value":0.16209280479558322},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.16257889881148352},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.12475710697854842}]},{"nodes":[{"feature":19,"threshold":0.169436203034,"left":1,"right":8,"value":1.1842336287528805e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.11431971927546214},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.1288727477536778},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09305805781207979},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.15314249105970112},{"feature":5,"threshold":0.234375,"left":6,"right":7,"value":0.008031246559214292},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.008031246559214292},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.03555625409604088},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.1303822123939178},{"feature":5,"threshold":0.296875,"left":10,"right":11,"value":0.059760653949999215},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.008031246559214292},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07276555763284874},{"feature":5,"threshold":0.609375,"left":13,"right":14,"value":0.14418534306234318},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.1446671051384541},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.10802439088712841}]},{"nodes":[{"feature":19,"threshold":0.1349081768465,"left":1,"right":8,"value":9.554628007480614e-18},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.10350520946037783},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.11803504307997668},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08274886667748536},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.14318125538289636},{"feature":5,"threshold":0.390625,"left":6,"right":7,"value":0.006986354647379046},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.006986354647379046},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.055524344216298815},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.11747791875511998},{"feature":16,"threshold":0.3095238095235,"left":10,"right":11,"value":0.049976446179492894},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.006986354647379046},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07579198807706128},{"feature":5,"threshold":0.609375,"left":13,"right":14,"value":0.1321029568160594},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.13260795526017277},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09530487709486485}]},{"nodes":[{"feature":19,"threshold":0.1349081768465,"left":1,"right":8,"value":-1.9448891084969235e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.09435225803791963},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.10893442281269106},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07423802365436148},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.13502612781240755},{"feature":5,"threshold":0.390625,"left":6,"right":7,"value":0.006931569104348091},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.006931569104348091},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.051001426854171486},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.10821539624662285},{"feature":16,"threshold":0.3095238095235,"left":10,"right":11,"value":0.04332596709491544},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.006931569104348091},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06776436539751056},{"feature":5,"threshold":0.609375,"left":13,"right":14,"value":0.12327189121664434},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.12381537565847328},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08505480482617318}]},{"nodes":[{"feature":19,"threshold":0.21789460376199998,"left":1,"right":8,"value":1.592565230618096e-18},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.08344253979956051},{"feature":4,"threshold":0.925824175824,"left":3,"right":4,"value":-0.09727951320002112},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10706750625774333},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.043263637853850595},{"feature":5,"threshold":0.234375,"left":6,"right":7,"value":0.01075223749231994},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01075223749231994},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.018545890707993895},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.1049470147841874},{"feature":5,"threshold":0.296875,"left":10,"right":11,"value":0.04590925938472554},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01075223749231994},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06050735253350854},{"feature":5,"threshold":0.609375,"left":13,"right":14,"value":0.11653204512046367},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.11712631163713871},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08122065225259405}]},{"nodes":[{"feature":19,"threshold":0.1349081768465,"left":1,"right":8,"value":-2.4394977589412006e-18},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.0805167358423442},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.09555648189834882},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.058833272976699574},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.12602803550982658},{"feature":5,"threshold":0.234375,"left":6,"right":7,"value":0.007136926415691802},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007136926415691802},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.014248980385869648},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.09479058867373859},{"feature":16,"threshold":0.3095238095235,"left":10,"right":11,"value":0.03489978726702065},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007136926415691802},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.05792119207580962},{"feature":5,"threshold":0.609375,"left":13,"right":14,"value":0.11097099488785944},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.11162820887281517},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07293539107744006}]},{"nodes":[{"feature":19,"threshold":0.1349081768465,"left":1,"right":8,"value":-1.0343237035268499e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.07470512741355712},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.09010385405344216},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05345328420509021},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.12284063106221528},{"feature":5,"threshold":0.390625,"left":6,"right":7,"value":0.0072538365784615005},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0072538365784615005},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04142500873749033},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.08921280057046825},{"feature":16,"threshold":0.3095238095235,"left":10,"right":11,"value":0.03051011089011765},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0072538365784615005},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.05270573181503074},{"feature":5,"threshold":0.609375,"left":13,"right":14,"value":0.10637457306744812},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.1071015675103681},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0684423419787816}]},{"nodes":[{"feature":19,"threshold":0.1349081768465,"left":1,"right":8,"value":1.2041479835670403e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.06941995961204475},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.08518968986115684},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04867140609505756},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.12044364752691453},{"feature":15,"threshold":0.4375,"left":6,"right":7,"value":0.007359098091719585},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007359098091719585},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.00017889380090389101},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.08413815579548865},{"feature":16,"threshold":0.3095238095235,"left":10,"right":11,"value":0.026695012828057824},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007359098091719585},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04817192560064584},{"feature":5,"threshold":0.234375,"left":13,"right":14,"value":0.10232106689503269},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.10976106296534233},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09653494445643039}]},{"nodes":[{"feature":17,"threshold":0.061730965748,"left":1,"right":8,"value":-3.1079713595345424e-18},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.06119287531327261},{"feature":4,"threshold":0.925824175824,"left":3,"right":4,"value":-0.07587412624547824},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08823482536091506},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.03208332228901445},{"feature":15,"threshold":0.4375,"left":6,"right":7,"value":0.011707481667449334},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.011707481667449334},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0002033715138268818},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.08460783864817943},{"feature":15,"threshold":0.3125,"left":10,"right":11,"value":0.030594551537215936},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.011707481667449334},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03886083814822438},{"feature":19,"threshold":0.4341034208905,"left":13,"right":14,"value":0.09833790058264454},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06446622605993028},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09918347160895975}]},{"nodes":[{"feature":19,"threshold":0.26211694486299997,"left":1,"right":8,"value":8.775499439810098e-19},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.055381095853080924},{"feature":4,"threshold":0.925824175824,"left":3,"right":4,"value":-0.07004938211435034},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08232312362356198},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.02807182679732972},{"feature":15,"threshold":0.4375,"left":6,"right":7,"value":0.0139057285196909},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0139057285196909},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.004831219077902861},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.08319255289246141},{"feature":5,"threshold":0.296875,"left":10,"right":11,"value":0.03231397753472206},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0139057285196909},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.048197402883896956},{"feature":5,"threshold":0.609375,"left":13,"right":14,"value":0.09511822425760819},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09615784298985174},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06371610089616457}]},{"nodes":[{"feature":17,"threshold":0.061730965748,"left":1,"right":8,"value":1.3956193838813968e-17},{"feature":3,"threshold":0.0280301717035,"left":2,"right":5,"value":-0.05302025715400758},{"feature":4,"threshold":0.925824175824,"left":3,"right":4,"value":-0.06293262946157983},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0762889081819918},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.025506374982662696},{"feature":13,"threshold":0.9354166666665,"left":6,"right":7,"value":0.011919879496269874},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.025506374982662696},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.011919879496269874},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.07686001614651798},{"feature":15,"threshold":0.3125,"left":10,"right":11,"value":0.02873682583043314},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.011919879496269874},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03676897563542946},{"feature":19,"threshold":0.4341034208905,"left":13,"right":14,"value":0.0912175159488966},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.059977170889665025},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09218575513274047}]},{"nodes":[{"feature":19,"threshold":0.1349081768465,"left":1,"right":8,"value":-3.601928272560399e-18},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.052497895623926684},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.0694212052678669},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.030752675229962608},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1170194984529424},{"feature":15,"threshold":0.4375,"left":6,"right":7,"value":0.007915854807941679},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007915854807941679},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0050535740390539865},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.06832960523982035},{"feature":16,"threshold":0.3095238095235,"left":10,"right":11,"value":0.02265681797347663},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007915854807941679},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04241292908924117},{"feature":5,"threshold":0.234375,"left":13,"right":14,"value":0.0880726682529463},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09944006542585697},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07955605795458681}]},{"nodes":[{"feature":19,"threshold":0.26211694486299997,"left":1,"right":8,"value":1.251072957773217e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.04388690561882429},{"feature":4,"threshold":0.925824175824,"left":3,"right":4,"value":-0.05908445409819525},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07268111097893508},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.022639895044473893},{"feature":15,"threshold":0.4375,"left":6,"right":7,"value":0.013804664009247465},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.013804664009247465},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007945917690254371},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.07149623363731468},{"feature":5,"threshold":0.296875,"left":10,"right":11,"value":0.025566371017747908},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.013804664009247465},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04174126086460784},{"feature":5,"threshold":0.234375,"left":13,"right":14,"value":0.08482931507288226},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09712731599300656},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07580543082385428}]},{"nodes":[{"feature":17,"threshold":0.061730965748,"left":1,"right":8,"value":4.95689935366754e-18},{"feature":3,"threshold":0.0280301717035,"left":2,"right":5,"value":-0.04250633744279276},{"feature":4,"threshold":0.4522727272725,"left":3,"right":4,"value":-0.05270026016069192},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1088233275929871},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.028356758285660918},{"feature":13,"threshold":0.9354166666665,"left":6,"right":7,"value":0.011787867607813564},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.020456196276439426},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.011787867607813564},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.06608207265841962},{"feature":15,"threshold":0.3125,"left":10,"right":11,"value":0.025327122092522983},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.011787867607813564},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.033096207332437566},{"feature":19,"threshold":0.4341034208905,"left":13,"right":14,"value":0.08103052424097637},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.05317882316674923},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08218811185524913}]},{"nodes":[{"feature":19,"threshold":0.1349081768465,"left":1,"right":8,"value":-6.029210774917518e-18},{"feature":5,"threshold":0.234375,"left":2,"right":5,"value":-0.04253109984827941},{"feature":13,"threshold":0.7083333333335,"left":3,"right":4,"value":-0.002754627159572981},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05825843894185624},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007826972611252033},{"feature":9,"threshold":0.5,"left":6,"right":7,"value":-0.09188313009496572},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.11531237472840664},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007826972611252033},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.0581850450707903},{"feature":16,"threshold":0.3095238095235,"left":10,"right":11,"value":0.019976441392505206},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007826972611252033},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0389498595821466},{"feature":13,"threshold":0.5833333333335,"left":13,"right":14,"value":0.0780986312889409},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.05770099985731293},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0860892269660773}]},{"nodes":[{"feature":17,"threshold":0.061730965748,"left":1,"right":8,"value":1.547024923368333e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.03651450867020329},{"feature":13,"threshold":0.7083333333335,"left":3,"right":4,"value":-0.05218439036010314},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08947084769259946},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.02046289403146489},{"feature":15,"threshold":0.4375,"left":6,"right":7,"value":0.011258602297173358},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.011258602297173358},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.005540672883930337},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.0590317132645516},{"feature":15,"threshold":0.3125,"left":10,"right":11,"value":0.02188500598433167},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.011258602297173358},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.029569300055672983},{"feature":19,"threshold":0.4341034208905,"left":13,"right":14,"value":0.07426753914735},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.048076272565840836},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07557707912564429}]},{"nodes":[{"feature":17,"threshold":0.061730965748,"left":1,"right":8,"value":1.73558908058518e-17},{"feature":4,"threshold":0.3858560794045,"left":2,"right":5,"value":-0.03371588399841035},{"feature":2,"threshold":0.6184900284904999,"left":3,"right":4,"value":-0.10702736004740294},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.13153456182629472},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.059927172624780485},{"feature":5,"threshold":0.109375,"left":6,"right":7,"value":-0.01282698520216085},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.010948010558777178},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.02548618966774841},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.05561190511596467},{"feature":15,"threshold":0.3125,"left":10,"right":11,"value":0.020644921651094057},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.010948010558777178},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02825840948621754},{"feature":19,"threshold":0.4341034208905,"left":13,"right":14,"value":0.07077210175503133},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.045708511703062636},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0721682806414327}]},{"nodes":[{"feature":19,"threshold":0.1349081768465,"left":1,"right":8,"value":-3.645284829661969e-18},{"feature":5,"threshold":0.234375,"left":2,"right":5,"value":-0.03411426507031998},{"feature":3,"threshold":0.0016261749559999998,"left":3,"right":4,"value":0.003973653565746738},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.03277896993496387},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007262539835014636},{"feature":9,"threshold":0.5,"left":6,"right":7,"value":-0.08662987655466796},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.11320419315823603},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007262539835014636},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.0486393447403442},{"feature":16,"threshold":0.3095238095235,"left":10,"right":11,"value":0.017127706440967134},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007262539835014636},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.035468348404097634},{"feature":13,"threshold":0.5833333333335,"left":13,"right":14,"value":0.06780084598684856},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04246427621390772},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07830397109451814}]},{"nodes":[{"feature":2,"threshold":0.6075138641315001,"left":1,"right":8,"value":-3.160238337768306e-19},{"feature":3,"threshold":0.0016261749559999998,"left":2,"right":5,"value":-0.030803106808330677},{"feature":4,"threshold":0.4522727272725,"left":3,"right":4,"value":-0.05344229448737467},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.13073256739071462},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.022455731756504813},{"feature":5,"threshold":0.203125,"left":6,"right":7,"value":0.008530830974365716},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.008530830974365716},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.022455731756504813},{"feature":16,"threshold":0.8660714285715,"left":9,"right":12,"value":0.04786476875706043},{"feature":5,"threshold":0.234375,"left":10,"right":11,"value":0.04989843978556624},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08265533332602493},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.037365430841839985},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.008530830974365716}]},{"nodes":[{"feature":17,"threshold":0.061730965748,"left":1,"right":8,"value":8.88609351168923e-18},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.02796621440722163},{"feature":13,"threshold":0.7083333333335,"left":3,"right":4,"value":-0.04374526776062328},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0840178216120276},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.017078715062126187},{"feature":15,"threshold":0.4375,"left":6,"right":7,"value":0.009587837636370904},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.009587837636370904},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.008360727501054209},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.04714188967996492},{"feature":15,"threshold":0.3125,"left":10,"right":11,"value":0.016877102794628666},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.009587837636370904},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02431287249155885},{"feature":13,"threshold":0.5833333333335,"left":13,"right":14,"value":0.061855801881400566},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03936645233801441},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07359886267784085}]},{"nodes":[{"feature":4,"threshold":0.925824175824,"left":1,"right":8,"value":6.953399707924746e-18},{"feature":13,"threshold":0.7083333333335,"left":2,"right":5,"value":-0.02144631478610524},{"feature":9,"threshold":0.5,"left":3,"right":4,"value":-0.07355179597465444},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09757271772650343},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.027989764750283128},{"feature":5,"threshold":0.234375,"left":6,"right":7,"value":0.017572266474087453},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.017572266474087453},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.027989764750283128},{"feature":15,"threshold":0.9375,"left":9,"right":12,"value":0.05659084773425724},{"feature":15,"threshold":0.1875,"left":10,"right":11,"value":0.06185320677514233},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.10674449614439895},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.040566349727421076},{"feature":19,"threshold":0.1149012219665,"left":13,"right":14,"value":0.017572266474087453},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.017572266474087453},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.017572266474087453}]},{"nodes":[{"feature":19,"threshold":0.1349081768465,"left":1,"right":8,"value":5.664660599132904e-18},{"feature":5,"threshold":0.234375,"left":2,"right":5,"value":-0.027443484684707156},{"feature":3,"threshold":0.0016261749559999998,"left":3,"right":4,"value":0.005983868726240609},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.026602838092548927},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.005983868726240609},{"feature":9,"threshold":0.5,"left":6,"right":7,"value":-0.07951825103803888},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10898794283720187},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.005983868726240609},{"feature":13,"threshold":0.5833333333335,"left":9,"right":12,"value":0.0394112221371886},{"feature":17,"threshold":0.3093924705815,"left":10,"right":11,"value":0.005983868726240609},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.005983868726240609},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02936476785621949},{"feature":5,"threshold":0.359375,"left":13,"right":14,"value":0.05274566698619824},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07277055184521795},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03484536165125058}]},{"nodes":[{"feature":2,"threshold":0.6075138641315001,"left":1,"right":8,"value":9.963129683306329e-18},{"feature":3,"threshold":0.0016261749559999998,"left":2,"right":5,"value":-0.02495773724554704},{"feature":4,"threshold":0.4522727272725,"left":3,"right":4,"value":-0.04573029136491204},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1251709437956636},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.01933312058798866},{"feature":5,"threshold":0.203125,"left":6,"right":7,"value":0.007064050188934263},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007064050188934263},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.01933312058798866},{"feature":16,"threshold":0.8660714285715,"left":9,"right":12,"value":0.039085837623417066},{"feature":9,"threshold":0.5,"left":10,"right":11,"value":0.0413945526776358},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.028956109322950487},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08087121814943898},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007064050188934263}]},{"nodes":[{"feature":17,"threshold":0.061730965748,"left":1,"right":8,"value":5.853984456956939e-19},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.02274761406970018},{"feature":13,"threshold":0.7083333333335,"left":3,"right":4,"value":-0.0382324647602609},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07862213639481601},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0152209367758111},{"feature":15,"threshold":0.4375,"left":6,"right":7,"value":0.007790591208638694},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007790591208638694},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.006729806164542074},{"feature":13,"threshold":0.5833333333335,"left":9,"right":12,"value":0.038328796486981814},{"feature":17,"threshold":0.3093924705815,"left":10,"right":11,"value":0.007790591208638694},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007790591208638694},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.028431695032844137},{"feature":5,"threshold":0.265625,"left":13,"right":14,"value":0.05116744557079153},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08166084903256131},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03652624362659878}]}]},"calibration":{"kind":"platt","slope":1.3211409713762825,"intercept":-3.4121855818618347},"threshold":null,"settings":{"penalty":null,"rounds":25},"outOfFold":{"family":"trees","items":431,"candidates":23264,"logLoss":0.06456785575616061,"brier":0.013875264770263514,"logLossByFamily":{"logistic":0.13112689565596358,"trees":0.06456785575616061}}},"output-name":{"scorer":{"family":"logistic","mean":[0.0743978856540339,0.0336777752441727,0.4473489964593778,0.01470191654729164,0.5355106720807403,0.31553735954370443,0.0019074907609095755,0.0047444661039151926,0.033203108081068786,0,0.0003783930021527455,0.002051488466000604,0,0.4924459604591684,0.01064700229745052,0.2464091152693806,0.11981252584152502,0.01892592752540986,0.031523845847303174,0.027923006402410536,0,0,0.015352749019805129],"scale":[0.2624173017623382,0.18039839993404905,0.1768399778996851,0.0445136325986074,0.2511887822050353,0.1840609670020574,0.04363315528251818,0.06871649107239591,0.17916657527238694,1,0.01944864573404781,0.045246876810172955,1,0.32238547867494854,0.06616622008178241,0.1911604529185433,0.22486729220249935,0.08964454829466348,0.17472862670524686,0.0982913682235243,1,1,0.0682925110554829],"low":[0,0,0,1e-12,0.028571428571,0.03125,0,0,0,0,0,0,0,0,0,0.125,0,0,0,0,0,0,0],"high":[1,1,1,0.975888117264,1,1,1,1,1,0,1,1,0,0.981818181818,1,1,0.909090909091,1,1,1,0,0,1],"weights":[0.11907875604722326,0,0.1474407024856209,0.3415792012435416,0.20407281952755676,0.005808708017096443,0.01053093769199893,0.23195946661939548,0.39082601324337957,0,0.04647254399397004,0.12700835273331454,0,0,0.27927564496064045,0,0,0.10593804530131139,0,0.19557073998965827,0,0,0.22179797378576555]},"calibration":{"kind":"isotonic","upTo":[-3.292136180509086,-1.7812810407887976,-1.6669991659586119,-1.1889805028850784,-0.591131057933556,0.6509952543674626,1.3691053793069483,1.5627248086624541,1.6938035274743588,1.7255019474015354,2.334752234795677,2.3423983455931703,2.4046003618281224,2.6114818776608324,3.516985924104054,3.8383767729563467,5.3737931332977436,6.163306273881128,9.574545213064651,9.840431853201935,13.110287836210674,21.66372976774619],"value":[0.0007686483318311906,0.0012291243384544082,0.0016413311228310615,0.0031017840016388833,0.0038735620762267017,0.0047847029450589105,0.005175641311193911,0.00805627836158294,0.014916637056021212,0.01497940342199425,0.035056000611347574,0.03533585140163959,0.044293831058438086,0.05918495419244809,0.07021614588677301,0.18470897869207456,0.19653934715267668,0.23828702659004244,0.3362777425339646,0.4014469442924164,0.4835396029929583,0.9554223676429341]},"threshold":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5405405405405406,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"settings":{"penalty":0.1,"rounds":null},"outOfFold":{"family":"logistic","items":822,"candidates":48949,"logLoss":0.061909306087470396,"brier":0.014635305838926192,"logLossByFamily":{"logistic":0.061909306087470396,"trees":0.06732329839347435}}}}`),names:JSON.parse(`{"format":1,"pairs":884,"labels":{"0":6,"1":27,"2":1,"3":2,"15":1,"123":1,"12345":2,"123456":4,"neuantrags":3,"prüfung":3,"get":15,"account":4,"number":1,"check":87,"file":9,"size":19,"notwendige":1,"kompetenz":1,"bestimmen":5,"mitarbeiter":3,"erfahrung":1,"des":1,"mitarbeiters":1,"score":10,"eignung":1,"determine":26,"required":2,"skills":1,"employee":2,"suitability":1,"eployee":1,"underwriter":1,"underwriting":3,"unique":1,"rsp":2,"id":2,"against":1,"selected":1,"mandatory":1,"field":2,"values":2,"separate":1,"valid":1,"and":2,"faild":1,"claims":1,"length":1,"assign":21,"user":17,"decide":9,"on":9,"viral":1,"rating":1,"benefits":5,"handle":2,"request":4,"approver":18,"group":19,"generate":38,"data":7,"application":4,"automatically":3,"document":1,"test":6,"example":1,"dish":1,"beverages":1,"order":19,"discount":4,"decade":1,"video":1,"game":1,"band":1,"movie":1,"suitable":1,"consultants":1,"review":14,"invoice":13,"verify":3,"risks":3,"create":2,"complex":1,"object":1,"load":25,"generic":2,"config":2,"evaluate":34,"answers":1,"error":19,"handling":1,"initiated":1,"calculate":10,"orderitem":1,"price":5,"sum":1,"item":2,"fraud":5,"increase":1,"counter":2,"init":2,"northern":1,"teams":4,"southern":1,"other":1,"task":23,"assignment":4,"eval":2,"expression":1,"language":1,"global":7,"europe":1,"asia":1,"usa":1,"dokument":1,"eingegangen":1,"antrag":6,"automatisch":6,"prüfen":8,"pmml":4,"automatic":2,"approval":4,"dmn":8,"approve":2,"expense":1,"sparql":1,"say":2,"hello":6,"helloword":1,"extract":1,"pdf":9,"c":16,"function":5,"merge":1,"water":1,"mark":1,"images":2,"to":7,"ping":4,"worker":17,"connector":5,"pingconnector":1,"cmis":3,"storage":3,"files":8,"from":8,"disk":8,"folder":1,"temp":1,"json":9,"add":1,"top":1,"watermark":1,"input":8,"wait":1,"for":3,"service":4,"world":3,"call":24,"sync":2,"rest":2,"via":2,"post":1,"convert":7,"if":3,"date":5,"is":3,"holiday":3,"replace":12,"oracle":12,"execute":44,"circuit":55,"mitigate":15,"readout":15,"quantum":20,"delegate":16,"errors":3,"combine":3,"results":30,"cut":6,"circuits":39,"initialize":15,"optimizer":22,"parameters":7,"warm":8,"start":13,"algorithm":8,"distance":2,"graph":2,"locations":2,"m":1,"run":86,"portfolio":1,"optimization":1,"ai":2,"agent":5,"agenticai":17,"aiagent":17,"job":14,"foo":2,"send":15,"with":4,"stuffdoer":9,"activity":8,"process":4,"i":12,"external":2,"topic":2,"validate":4,"notify":1,"customer":9,"credit":19,"fetch":3,"exchange":1,"rate":3,"amount":1,"routing":4,"background":2,"assess":6,"risk":10,"query":1,"recruiter":2,"calendar":1,"draft":3,"invitation":1,"email":15,"summary":1,"rejection":1,"grant":1,"system":1,"access":3,"set":7,"high":1,"priority":2,"settlement":2,"some":2,"community":2,"profil":2,"popularity":1,"risiko":2,"details":1,"status":2,"a":9,"b":5,"rule":9,"evaluation":8,"policy":1,"guardrail":1,"assessment":1,"provided":2,"action":6,"timeout":4,"chaos":11,"experiment":7,"failed":8,"after":3,"hours":2,"experiments":4,"invalid":3,"expiry":1,"tweet":1,"business":1,"charge":18,"card":24,"accounts":2,"weather":4,"forecast":4,"soap":4,"script":1,"form":2,"检查是否通过":1,"mail":7,"complete":1,"prepare":2,"message":8,"pong":2,"new":7,"spot":3,"signal":1,"trade":1,"activty":1,"output":2,"serve":3,"customers":3,"metrics":1,"poll":1,"pizza":1,"orders":1,"grade":3,"retrieve":5,"payment":7,"ship":1,"goods":2,"notification":2,"adapter":9,"method":1,"result":2,"store":1,"receive":4,"echo":4,"do":4,"stuff":2,"book":4,"the":13,"carrier":1,"country":1,"supplier":1,"arrange":1,"an":1,"site":1,"audit":2,"bodywork":1,"mechanical":1,"damage":2,"repair":1,"submitted":1,"receipts":1,"daily":1,"allowance":2,"claim":10,"currency":1,"pay":2,"reimbursement":2,"label":1,"each":1,"parcel":1,"normal":1,"cheack":1,"coagulation":1,"time":3,"since":2,"blood":2,"loss":2,"level":2,"physiological":20,"measurements":20,"infection":18,"soberity":20,"camunda":11,"sign":1,"into":1,"google":1,"retry":4,"scope":1,"url":5,"encode":4,"token":2,"authorize":1,"attempt":1,"authorization":1,"code":4,"callback":1,"scopes":1,"sample":1,"received":12,"by":2,"sales":2,"department":1,"head":1,"of":2,"choose":2,"distributor":1,"value":1,"items":2,"delivery":1,"satisfaction":3,"survey":3,"confirm":3,"created":2,"construct":8,"supervisor":2,"submitter":2,"colleague":2,"direct":2,"reports":2,"variables":4,"template":1,"ticket":4,"reserved":3,"out":3,"cloudevents":3,"async":1,"void":1,"throw":1,"warn":4,"again":1,"notice":3,"about":5,"loaded":3,"blacklisting":1,"removal":1,"creation":1,"membership":14,"requested":10,"маршрут":1,"по":1,"сумме":1,"tree":1,"my":3,"saved":1,"master":2,"placed":1,"checked":1,"render":2,"body":1,"subject":1,"templates":2,"comfirmation":1,"support":2,"case":2,"owner":1,"homework":2,"made":1,"it":1,"played":2,"nope":7,"turn":1,"select":4,"play":4,"scoring":1,"rules":1,"carbon":12,"reductor":12,"character":1,"enter":2,"wishlist":2,"hotel":1,"http":10,"car":1,"flight":1,"incident":1,"team":1,"product":3,"catalog":1,"search":1,"knowledge":1,"base":1,"reply":1,"chat":1,"conversation":5,"human":2,"escalation":1,"minutes":1,"working":1,"upload":2,"demo":1,"kotlin":1,"simple":2,"params":2,"in":1,"java":1,"optional":1,"superflux":1,"calculation":1,"ask":1,"kyc":11,"screening":12,"agentcost":14,"capture":14,"identity":1,"screen":3,"sanctions":3,"pep":3,"additional":1,"information":1,"submit":1,"edd":3,"judge":3,"onboarding":1,"authority":1,"detection":3,"sla":1,"duration":1,"injury":1,"severity":1,"whether":1,"configurable":3,"validations":3,"general":1,"decision":1},"names":{"1":96,"2":29,"3":13,"completed":3,"case":6,"instance":4,"id":48,"account":1,"number":1,"file":2,"size":1,"ok":1,"skills":2,"selected":5,"employee":8,"experience":1,"score":10,"underwriter":1,"approved":4,"underwriting":2,"result":67,"check":4,"unique":1,"rsp":2,"against":1,"mandatory":1,"fields":1,"claims":1,"field":1,"length":1,"user":6,"name":14,"viral":1,"room":1,"upgrade":1,"free":1,"drinks":1,"breakfast":1,"email":8,"benefits":1,"async":1,"approver":18,"groups":19,"data":6,"risk":20,"dm":1,"nresult":1,"document":4,"dmn":2,"dish":1,"beverages":1,"discount":3,"decade":1,"video":1,"game":1,"band":1,"movie":1,"suitable":1,"consultants":1,"clarified":12,"assessment":6,"complex":1,"value":16,"general":2,"config":2,"json":3,"is":71,"included":1,"failing":1,"task":13,"complete":2,"price":6,"fraud":5,"counter":2,"chosen":3,"team":4,"assignee":1,"candidate":2,"users":1,"mypath":2,"the":1,"answer":2,"status":17,"transfer":4,"expense":4,"risikobewertung":2,"risks":2,"risikopruefung":2,"business":3,"decision":17,"output":10,"automatic":3,"approval":3,"mapping":4,"message":11,"welcome":1,"doc":4,"extracted":1,"merged":1,"watermark":1,"image":1,"to":3,"pdf":5,"list":1,"images":1,"time":7,"stamp":1,"ping":1,"jvm":1,"parameters":1,"cherry":9,"icon":1,"mime":1,"type":1,"in":7,"folder":1,"temp":1,"source":1,"destination":1,"greeting":2,"response":29,"xml":5,"holiday":3,"sub":48,"process":56,"circuit":66,"quantum":12,"programming":12,"language":12,"execution":18,"service":13,"mitigated":3,"counts":15,"cutting":3,"meta":3,"circuits":3,"meas":9,"qubits":19,"depth":19,"transpiled":9,"untranspiled":10,"num":10,"iterations":14,"converged":7,"obj":10,"evaluated":9,"costs":9,"max":5,"cut":5,"plot":9,"tsp":1,"ws":19,"bitstring":4,"optimizer":1,"init":1,"distance":1,"matrix":2,"duration":1,"probability":4,"distribution":4,"visualization":3,"agent":8,"error":3,"var":81,"out":7,"target":10,"order":19,"variable":32,"i":12,"foo":3,"valid":8,"customer":11,"notified":1,"loan":1,"exchange":1,"rate":2,"converted":1,"amount":3,"routing":3,"background":1,"rationale":2,"fit":1,"interview":1,"slot":1,"invitation":1,"recruiter":1,"summary":2,"rejection":3,"access":3,"granted":1,"required":1,"ignored":1,"claim":1,"level":2,"health":1,"percentage":1,"code":14,"popular":1,"repo":1,"my":8,"date":3,"long":1,"string":1,"boolean":1,"enum":1,"item":1,"a":4,"b":4,"rule":8,"reason":5,"policy":1,"successful":6,"run":2,"timeout":1,"test":14,"report":13,"failure":6,"messages":5,"experiment":3,"start":2,"end":2,"count":3,"credit":2,"card":1,"accounts":2,"forecast":2,"temperature":2,"percent":1,"passed":1,"arbval":1,"from":2,"received":3,"me":1,"took":2,"condition":3,"spot":2,"body":2,"basis":1,"of":5,"main":2,"parameter":2,"some":2,"mails":1,"final":1,"grade":3,"execute":1,"first":1,"last":3,"sheet":1,"url":4,"tracking":1,"supplier":1,"audit":2,"verdict":2,"bodywork":1,"mechanics":1,"repair":1,"cost":1,"review":3,"note":1,"daily":1,"allowance":1,"euro":1,"payout":1,"receipt":1,"payment":7,"reference":1,"parcel":1,"label":1,"normal":1,"medicine":1,"since":2,"blood":2,"loss":2,"suspected":20,"infection":18,"large":18,"sober":20,"gcp":1,"authorization":1,"token":3,"auth":4,"retries":4,"remaining":2,"refresh":2,"state":1,"callback":2,"microsoft":1,"authorize":1,"request":3,"azure":3,"encoded":2,"scopes":1,"send":2,"address":2,"e":1,"mail":2,"mobile":1,"phone":1,"accepted":3,"distributor":1,"items":1,"meal":1,"invoice":2,"deadline":2,"survey":1,"link":1,"template":1,"tickets":3,"throw":1,"membership":7,"has":7,"empty":7,"spots":7,"route":2,"notification":1,"path":1,"group":1,"stuff":1,"success":4,"subject":1,"templates":1,"sent":3,"failed":1,"resolved":1,"owner":1,"guess":1,"played":5,"nope":3,"cards":6,"correlation":2,"key":2,"noped":1,"player":1,"turn":2,"round":2,"action":1,"players":1,"discard":1,"pile":1,"tier":3,"delayed":4,"mapped":6,"by":2,"original":2,"carbon":8,"actual":2,"saved":2,"reduced":2,"character":1,"wishlist":1,"child":1,"support":4,"tool":16,"call":16,"conversation":4,"context":1,"delegate":1,"java":1,"screening":2,"identity":1,"verified":2,"sanctions":2,"match":4,"pep":2,"employment":1,"kyc":3,"recommendation":1,"raw":4,"judge":2,"reasoning":1,"onboarding":1,"indicators":1,"requires":1,"sla":1,"injury":1,"damage":1,"settlement":1,"processing":1},"joint":{"0":{"i":6},"1":{"agent":4,"result":4,"variable":1,"message":1,"arbval":1,"customer":1,"support":1,"screening":2,"report":1,"summary":1,"identity":1,"verified":2,"sanctions":2,"match":4,"pep":2,"risk":5,"tier":2,"score":2,"address":1,"employment":1,"kyc":3,"recommendation":1,"rationale":1,"tool":3,"call":3,"raw":4,"judge":2,"decision":1,"reasoning":1,"assessment":1},"2":{"condition":1},"3":{"test":1,"report":1,"failure":1,"messages":1,"successful":1,"experiment":1},"15":{"customer":1,"support":1,"agent":1},"123":{"iterations":1},"12345":{"iterations":2},"123456":{"iterations":4},"neuantrags":{"completed":3,"case":3,"instance":3,"id":3},"prüfung":{"completed":3,"case":3,"instance":3,"id":3},"get":{"account":1,"number":1,"health":1,"percentage":1,"status":2,"code":2,"accounts":2,"forecast":2,"temperature":2,"body":1,"spot":1,"price":1,"time":1,"since":1,"blood":1,"loss":1,"azure":1,"access":1,"token":1,"tool":1,"call":1,"result":1},"account":{"account":1,"number":1,"ws":3,"response":3},"number":{"account":1,"number":1},"check":{"file":1,"size":1,"ok":1,"result":6,"check":4,"unique":1,"rsp":2,"id":5,"against":1,"selected":1,"mandatory":1,"fields":1,"field":1,"length":1,"risk":7,"dm":1,"nresult":1,"assessment":2,"is":67,"holiday":3,"background":1,"rationale":1,"normal":1,"suspected":20,"infection":18,"large":18,"sober":20,"accepted":3,"valid":3,"order":1,"payment":3,"fraud":3,"score":1,"indicators":1,"requires":1,"review":1},"file":{"file":2,"size":1,"ok":1,"cherry":8,"icon":1,"name":1,"mime":1,"type":1,"in":4,"folder":1,"temp":1,"json":2,"source":1,"pdf":1,"document":1},"size":{"file":1,"size":1,"ok":1,"infection":18,"is":18,"large":18},"notwendige":{"skills":1},"kompetenz":{"skills":1},"bestimmen":{"skills":1,"selected":2,"employee":4,"experience":1,"score":1},"mitarbeiter":{"selected":2,"employee":3,"score":1},"erfahrung":{"employee":1,"experience":1},"des":{"employee":1,"experience":1},"mitarbeiters":{"employee":1,"experience":1},"score":{"employee":2,"score":7,"fraud":2,"fit":1,"assessment":1,"risk":3,"tool":1,"call":1,"result":2,"tier":1,"raw":2},"eignung":{"employee":1,"score":1},"determine":{"skills":1,"selected":2,"employee":2,"underwriter":1,"room":1,"upgrade":1,"free":1,"drinks":1,"breakfast":1,"email":1,"benefits":1,"dish":1,"beverages":1,"discount":1,"assignee":1,"candidate":2,"users":1,"groups":1,"dmn":1,"result":3,"automatic":2,"approval":2,"mapping":2,"routing":3,"claim":1,"decision":4,"templates":1,"onboarding":1,"review":1},"required":{"skills":1,"review":1,"decision":1},"skills":{"skills":1},"employee":{"employee":2,"score":1,"selected":1},"suitability":{"employee":1,"score":1},"eployee":{"selected":1,"employee":1},"underwriter":{"underwriter":1},"underwriting":{"approved":1,"underwriting":2,"case":1,"instance":1,"id":1,"decision":1,"result":1},"unique":{"result":1,"check":1,"unique":1,"rsp":1,"id":1},"rsp":{"result":2,"check":2,"unique":1,"rsp":2,"id":2,"against":1,"selected":1},"id":{"result":2,"check":2,"unique":1,"rsp":2,"id":2,"against":1,"selected":1},"against":{"result":1,"check":1,"rsp":1,"id":1,"against":1,"selected":1},"selected":{"result":1,"check":1,"rsp":1,"id":1,"against":1,"selected":1},"mandatory":{"result":1,"check":1,"mandatory":1,"fields":1},"field":{"result":2,"check":2,"mandatory":1,"fields":1,"field":1,"length":1},"values":{"result":1,"check":1,"mandatory":1,"fields":1,"is":1,"normal":1},"separate":{"claims":1},"valid":{"claims":1},"and":{"claims":1,"tool":1,"call":1,"result":1},"faild":{"claims":1},"claims":{"claims":1},"length":{"result":1,"check":1,"field":1,"length":1},"assign":{"user":2,"name":2,"approver":18,"groups":18,"team":1},"user":{"user":2,"name":2,"my":5,"date":1,"long":1,"string":1,"boolean":1,"enum":1,"ws":7,"response":7,"request":1,"tool":1,"call":1,"result":1,"conversation":1},"decide":{"viral":1,"score":1,"decade":1,"video":1,"game":1,"band":1,"movie":1,"suitable":1,"consultants":1,"approval":1,"required":1,"popular":1,"repo":1,"automatic":1,"processing":1},"on":{"viral":1,"score":1,"decade":1,"video":1,"game":1,"band":1,"movie":1,"suitable":1,"consultants":1,"approval":1,"required":1,"popular":1,"repo":1,"audit":1,"verdict":1},"viral":{"viral":1,"score":1},"rating":{"viral":1,"score":1},"benefits":{"room":1,"upgrade":1,"free":1,"drinks":1,"breakfast":1,"email":1,"benefits":1},"handle":{"async":1,"user":1,"id":1,"tool":1,"call":1,"result":1},"request":{"async":1,"user":1,"id":1,"document":1,"payment":1,"received":1,"tool":1,"call":1,"result":1},"approver":{"approver":18,"groups":18},"group":{"approver":18,"groups":18,"group":1},"generate":{"data":2,"circuit":33,"depth":10,"untranspiled":10,"num":10,"qubits":10,"distance":1,"matrix":2,"duration":1,"visualization":3,"result":1,"test":1},"data":{"data":2,"process":1,"variable":1,"response":1,"first":1,"name":2,"last":1,"sheet":1,"url":1,"tool":1,"call":1,"result":1},"application":{"risk":2,"dm":1,"nresult":1,"fit":1,"score":1,"assessment":2,"result":1},"automatically":{"risk":2,"dm":1,"nresult":1,"assessment":1,"result":1,"automatic":1,"processing":1},"document":{"document":1},"test":{"2":1,"dmn":1,"result":2,"output":1,"name":2,"of":2,"variable":2,"in":2,"main":2,"process":2,"message":1,"out":1},"example":{"dmn":1,"result":1},"dish":{"dish":1},"beverages":{"beverages":1},"order":{"discount":1,"complete":1,"price":1,"approved":1,"order":6,"valid":4,"repair":1,"cost":1,"risk":1,"customer":3,"name":1,"address":1,"e":1,"mail":1,"mobile":1,"phone":1,"is":2,"id":1,"path":1,"tool":1,"call":1,"result":1},"discount":{"discount":3,"percent":1,"result":2,"tool":1,"call":1},"decade":{"decade":1},"video":{"video":1,"game":1},"game":{"video":1,"game":1},"band":{"band":1},"movie":{"movie":1},"suitable":{"suitable":1,"consultants":1},"consultants":{"suitable":1,"consultants":1},"review":{"clarified":10,"status":1,"transfer":1,"expense":1,"approved":1,"review":2,"note":1,"decision":1},"invoice":{"clarified":12,"invoice":1,"id":1},"verify":{"clarified":2,"tool":1,"call":1,"result":1},"risks":{"risk":3,"assessment":1,"result":1},"create":{"complex":1,"value":1,"resolved":1},"complex":{"complex":1,"value":1},"object":{"complex":1,"value":1},"load":{"1":12,"general":2,"config":2,"json":3,"cherry":8,"icon":1,"file":1,"name":1,"mime":1,"type":1,"in":4,"folder":1,"temp":1,"source":1,"pdf":1,"document":1,"service":12,"task":12,"circuit":6,"id":3,"quantum":3,"programming":3,"language":3,"execution":3,"result":5,"ws":1,"response":1,"tool":2,"call":2},"generic":{"general":2,"config":2,"json":1},"config":{"general":2,"config":2,"json":1},"evaluate":{"is":1,"included":1,"obj":10,"value":10,"evaluated":9,"costs":9,"max":5,"cut":5,"plot":9,"tsp":1,"loan":1,"decision":1,"discount":2,"percent":1,"result":2,"final":1,"grade":1,"risk":1,"level":1},"answers":{"is":1,"included":1},"error":{"2":3,"3":12,"failing":1,"task":1,"sub":15,"process":12,"circuit":6,"id":3,"quantum":3,"programming":3,"language":3,"execution":3,"result":3,"error":2,"var":2,"variable":3,"customer":1,"support":1,"agent":1},"handling":{"failing":1,"task":1},"initiated":{"failing":1,"task":1},"calculate":{"complete":1,"price":1,"fraud":2,"score":3,"value":1,"of":1,"items":1,"tool":2,"call":2,"result":3,"risk":2,"tier":1,"raw":2,"sla":1,"decision":2,"settlement":1},"orderitem":{"complete":1,"price":1},"price":{"complete":2,"price":5,"spot":2},"sum":{"complete":1,"price":1},"item":{"complete":1,"price":1,"item":1,"response":1},"fraud":{"fraud":5,"score":3,"result":1,"indicators":1,"requires":1,"review":1},"increase":{"counter":1},"counter":{"counter":2},"init":{"counter":1,"time":1,"since":1,"blood":1,"loss":1},"northern":{"chosen":1,"team":1},"teams":{"chosen":3,"team":3,"send":1,"message":1},"southern":{"chosen":1,"team":1},"other":{"chosen":1,"team":1},"task":{"1":1,"2":1,"assignee":1,"candidate":2,"users":1,"groups":1,"dmn":1,"result":2,"error":2,"var":2,"foo":2,"my":5,"date":1,"long":1,"string":1,"boolean":1,"enum":1,"out":2,"variable":1,"message":3,"arbval":1,"took":2,"condition":3},"assignment":{"assignee":1,"candidate":2,"users":1,"groups":1,"dmn":1,"result":1},"eval":{"mypath":2},"expression":{"the":1,"answer":1},"language":{"the":1,"answer":1},"global":{"status":3,"transfer":3,"expense":3,"employee":1,"name":1,"deadline":2,"date":1,"time":1,"survey":1,"link":1},"europe":{"status":1,"transfer":1,"expense":1},"asia":{"status":1,"transfer":1,"expense":1},"usa":{"status":1,"transfer":1,"expense":1},"dokument":{"document":1},"eingegangen":{"document":1},"antrag":{"risikobewertung":2,"risks":2,"risikopruefung":2},"automatisch":{"risikobewertung":2,"risks":2,"risikopruefung":2},"prüfen":{"risikobewertung":2,"risks":2,"risikopruefung":2,"risk":2},"pmml":{"business":2,"decision":2,"output":1,"approved":1},"automatic":{"automatic":2,"approval":2,"mapping":2},"approval":{"automatic":2,"approval":3,"mapping":2,"required":1,"service":1,"route":1},"dmn":{"automatic":2,"approval":2,"mapping":2,"risk":2,"level":1,"decision":1,"result":1,"policy":1,"credit":1,"route":2,"service":1,"tier":1},"approve":{"approved":1,"price":1},"expense":{"approved":1},"sparql":{"business":1,"decision":1},"say":{"message":2,"welcome":1},"hello":{"message":2,"welcome":1,"greeting":2,"basis":1,"result":1},"helloword":{"message":1,"welcome":1},"extract":{"doc":1,"extracted":1},"pdf":{"doc":4,"extracted":1,"merged":1,"watermark":1,"image":1,"to":1,"pdf":5,"list":1,"images":1,"cherry":2,"source":1,"document":2,"destination":1},"c":{"doc":4,"extracted":1,"merged":1,"watermark":1,"image":1,"to":1,"pdf":3,"list":1,"images":1,"time":1,"stamp":1,"ping":1,"jvm":1,"parameters":1,"cherry":9,"icon":1,"file":1,"name":1,"mime":1,"type":1,"in":4,"folder":1,"temp":1,"json":2,"source":1,"document":2,"destination":1},"function":{"doc":4,"extracted":1,"merged":1,"watermark":1,"image":1,"to":1,"pdf":1,"list":1,"images":1},"merge":{"doc":1,"merged":1},"water":{"doc":1,"watermark":1},"mark":{"doc":1,"watermark":1},"images":{"doc":1,"image":1,"to":1,"pdf":1,"list":1,"images":1},"to":{"doc":1,"image":1,"to":1,"pdf":1,"list":1,"images":1,"allowance":1,"in":1,"euro":1,"request":1,"id":1,"team":1,"tool":1,"call":1,"result":1,"automatic":1,"processing":1},"ping":{"time":1,"stamp":1,"ping":1,"jvm":1,"parameters":1,"from":1,"to":1},"worker":{"time":1,"stamp":1,"ping":1,"agent":4,"out":1,"result":2,"throw":1,"customer":1,"support":1,"screening":2,"report":1,"summary":1,"identity":1,"verified":2,"sanctions":1,"match":2,"pep":1,"risk":2,"tier":1,"score":1,"address":1,"employment":1,"kyc":2,"recommendation":1,"rationale":1},"connector":{"1":2,"jvm":1,"parameters":1,"email":1,"response":1,"out":2},"pingconnector":{"jvm":1,"parameters":1},"cmis":{"cherry":3,"icon":1,"file":1,"name":1,"mime":1,"type":1},"storage":{"cherry":3,"icon":1,"file":1,"name":1,"mime":1,"type":1},"files":{"cherry":8,"icon":1,"file":1,"name":1,"mime":1,"type":1,"in":4,"folder":1,"temp":1,"json":2,"source":1,"pdf":1,"document":1},"from":{"cherry":8,"icon":1,"file":1,"name":1,"mime":1,"type":1,"in":4,"folder":1,"temp":1,"json":2,"source":1,"pdf":1,"document":1},"disk":{"cherry":8,"icon":1,"file":1,"name":1,"mime":1,"type":1,"in":4,"folder":1,"temp":1,"json":2,"source":1,"pdf":1,"document":1},"folder":{"cherry":1,"in":1,"folder":1},"temp":{"cherry":1,"in":1,"temp":1},"json":{"cherry":2,"in":2,"json":2,"tool":3,"call":3,"result":3,"sanctions":1,"match":2,"raw":4,"pep":1,"risk":2,"tier":1,"score":1},"add":{"cherry":1,"destination":1,"pdf":1,"document":1},"top":{"cherry":1,"destination":1,"pdf":1,"document":1},"watermark":{"cherry":1,"destination":1,"pdf":1,"document":1},"input":{"2":1,"cherry":1,"destination":1,"pdf":1,"document":1,"xml":5,"output":5,"name":2,"of":2,"variable":2,"in":2,"main":2,"process":2},"wait":{"greeting":1},"for":{"greeting":1,"distance":1,"matrix":2,"duration":1},"service":{"greeting":2,"result":1,"variable":1,"condition":1},"world":{"greeting":2,"result":1},"call":{"2":6,"3":1,"greeting":1,"email":1,"target":9,"order":9,"id":9,"sub":9,"variable":10,"test":1,"out":1,"my":1,"output":1,"var":1,"execute":1,"result":1,"data":1},"sync":{"greeting":1,"throw":1,"result":1},"rest":{"email":1,"response":1},"via":{"email":1,"response":1},"post":{"response":1},"convert":{"xml":5,"output":5,"converted":1,"amount":1,"allowance":1,"in":1,"euro":1},"if":{"is":3,"holiday":3},"date":{"is":3,"holiday":3,"credit":1,"card":1,"error":1,"message":1,"tool":1,"call":1,"result":1},"is":{"is":3,"holiday":3},"holiday":{"is":3,"holiday":3},"replace":{"1":12,"sub":12,"process":12,"circuit":6,"id":3,"quantum":3,"programming":3,"language":3,"execution":3,"result":3},"oracle":{"1":12,"sub":12,"process":12,"circuit":6,"id":3,"quantum":3,"programming":3,"language":3,"execution":3,"result":3},"execute":{"2":12,"sub":12,"process":12,"circuit":15,"id":3,"quantum":3,"programming":3,"language":3,"execution":7,"result":4,"counts":9,"meas":9,"qubits":9,"depth":9,"transpiled":9,"probability":4,"distribution":4,"decision":1},"circuit":{"1":12,"2":12,"sub":12,"process":12,"circuit":21,"id":6,"quantum":6,"programming":6,"language":6,"execution":10,"result":6,"service":12,"task":12,"counts":9,"meas":9,"qubits":9,"depth":9,"transpiled":9,"probability":4,"distribution":4},"mitigate":{"3":12,"sub":12,"process":12,"circuit":6,"id":3,"quantum":3,"programming":3,"language":3,"execution":3,"result":3,"mitigated":3,"counts":3},"readout":{"3":12,"sub":12,"process":12,"circuit":6,"id":3,"quantum":3,"programming":3,"language":3,"execution":3,"result":3,"mitigated":3,"counts":3},"quantum":{"1":12,"service":12,"task":12,"circuit":6,"id":3,"quantum":3,"programming":3,"language":3,"execution":3,"result":3,"ws":8,"bitstring":4,"value":4},"delegate":{"1":12,"service":12,"task":12,"circuit":6,"id":3,"quantum":3,"programming":3,"language":3,"execution":3,"result":6,"daily":1,"rate":1,"test":1,"delegate":1,"mapping":2,"java":1},"errors":{"mitigated":3,"counts":3},"combine":{"counts":3},"results":{"counts":3,"obj":9,"value":9,"evaluated":9,"costs":9,"max":5,"cut":5,"plot":9,"tsp":1},"cut":{"cutting":3,"meta":3,"data":3,"sub":3,"circuits":3},"circuits":{"cutting":3,"meta":3,"data":3,"sub":3,"circuits":3,"circuit":33,"depth":10,"untranspiled":10,"num":10,"qubits":10,"visualization":3},"initialize":{"iterations":7,"converged":7,"optimizer":1,"init":1},"optimizer":{"iterations":14,"converged":7,"optimizer":1,"init":1},"parameters":{"iterations":7},"warm":{"ws":8,"bitstring":4,"value":4},"start":{"ws":8,"bitstring":4,"value":4,"send":1,"message":1,"order":1,"id":1,"customer":1,"name":1,"meal":1,"turn":1,"of":1,"round":1},"algorithm":{"ws":8,"bitstring":4,"value":4},"distance":{"distance":1,"matrix":2,"duration":1},"graph":{"distance":1,"matrix":2,"duration":1},"locations":{"distance":1,"matrix":2,"duration":1},"m":{"obj":1,"value":1},"run":{"1":69,"2":9,"agent":1,"var":78,"background":1,"risk":1,"rationale":1,"successful":2,"run":1,"timeout":1,"experiment":1,"test":2,"report":2,"start":1,"time":1,"failure":1,"messages":1},"portfolio":{"agent":1},"optimization":{"agent":1},"ai":{"agent":2},"agent":{"agent":4,"customer":2,"support":2,"conversation":1},"agenticai":{"agent":4,"customer":1,"support":1,"screening":2,"report":1,"summary":1,"identity":1,"verified":2,"sanctions":1,"match":2,"pep":1,"risk":3,"tier":1,"score":1,"address":1,"employment":1,"kyc":3,"recommendation":1,"rationale":1,"judge":2,"decision":1,"reasoning":1,"assessment":1},"aiagent":{"agent":4,"customer":1,"support":1,"screening":2,"report":1,"summary":1,"identity":1,"verified":2,"sanctions":1,"match":2,"pep":1,"risk":3,"tier":1,"score":1,"address":1,"employment":1,"kyc":3,"recommendation":1,"rationale":1,"judge":2,"decision":1,"reasoning":1,"assessment":1},"job":{"agent":4,"customer":1,"support":1,"screening":2,"report":1,"summary":1,"identity":1,"verified":2,"sanctions":1,"match":2,"pep":1,"risk":2,"tier":1,"score":1,"address":1,"employment":1,"kyc":2,"recommendation":1,"rationale":1},"foo":{"error":2,"var":2},"send":{"1":2,"out":2,"message":2,"id":2,"status":2,"code":2,"ws":2,"response":2,"send":1,"mail":1,"result":3,"success":1,"sent":3,"conversation":1,"tool":2,"call":2,"email":2},"with":{"1":2,"out":2,"start":1,"date":1,"execute":1,"result":1,"variable":1,"data":1},"stuffdoer":{"target":9,"order":9,"id":9},"activity":{"2":3,"sub":6,"variable":6,"test":1,"out":1,"my":1,"output":1},"process":{"2":3,"sub":3,"variable":3,"automatic":1,"processing":1},"i":{"i":12},"external":{"foo":2},"topic":{"foo":2},"validate":{"order":1,"valid":1,"status":2,"a":1,"response":2,"b":1,"state":1},"notify":{"customer":1,"notified":1},"customer":{"customer":4,"notified":1,"process":1,"variable":1,"response":1,"first":1,"name":3,"last":1,"sheet":1,"url":1,"id":1,"support":1,"agent":1,"tool":1,"call":1,"result":1},"credit":{"loan":1,"decision":1,"approved":1,"process":10,"variable":10,"response":10,"status":7,"code":7},"fetch":{"exchange":1,"rate":1,"item":1,"response":2,"process":1,"variable":1},"exchange":{"exchange":1,"rate":1},"rate":{"exchange":1,"rate":2,"daily":1,"risk":1},"amount":{"converted":1,"amount":1},"routing":{"routing":3,"result":1,"service":1,"route":1,"decision":1},"background":{"background":1,"risk":1,"rationale":1},"assess":{"decision":1,"risk":1,"level":1,"bodywork":1,"report":1,"character":1,"injury":1,"assessment":2,"damage":1},"risk":{"decision":1,"risk":8,"level":2,"score":2,"result":2,"tool":1,"call":1,"tier":1,"raw":2},"query":{"interview":1,"slot":1},"recruiter":{"interview":1,"slot":1,"recruiter":1,"summary":1,"email":1},"calendar":{"interview":1,"slot":1},"draft":{"invitation":1,"email":3,"recruiter":1,"summary":1,"rejection":1},"invitation":{"invitation":1,"email":1},"email":{"invitation":1,"email":5,"recruiter":1,"summary":1,"rejection":1,"result":10,"template":1,"tool":2,"call":2,"sent":2},"summary":{"recruiter":1,"summary":1,"email":1},"rejection":{"rejection":1,"email":1},"grant":{"access":1,"granted":1},"system":{"access":1,"granted":1},"access":{"access":3,"granted":1,"microsoft":1,"token":2,"url":1,"azure":1},"set":{"ignored":1,"microsoft":1,"access":1,"token":1,"url":2,"authorize":1,"employee":1,"name":1,"deadline":2,"date":1,"time":1,"survey":1,"link":1},"high":{"ignored":1},"priority":{"ignored":1,"result":1,"test":1},"settlement":{"claim":1,"decision":2,"settlement":1},"some":{"decision":1,"result":1,"some":1,"stuff":1},"community":{"health":1,"percentage":1,"status":1,"code":1},"profil":{"health":1,"percentage":1,"status":1,"code":1},"popularity":{"popular":1,"repo":1},"risiko":{"risk":2},"details":{"item":1,"response":1},"status":{"status":2,"a":1,"response":2,"b":1},"a":{"status":1,"a":2,"response":1,"rule":4,"result":2,"name":1,"reason":1,"played":2,"nope":1,"cards":2,"players":1,"discard":1,"pile":1,"last":1},"b":{"status":1,"b":2,"response":1,"rule":4,"result":2,"name":1,"reason":1},"rule":{"rule":8,"result":4,"name":2,"reason":2,"a":1,"b":1,"approved":1},"evaluation":{"rule":8,"result":4,"name":2,"reason":2,"a":1,"b":1},"policy":{"policy":1},"guardrail":{"policy":1},"assessment":{"risk":1},"provided":{"successful":1,"run":1,"timeout":1},"action":{"successful":1,"run":1,"timeout":1,"cards":2,"last":1,"played":1,"action":1,"turn":1,"of":1,"round":1},"timeout":{"test":2,"report":2,"failure":2,"messages":2,"successful":2,"run":1,"experiment":1},"chaos":{"test":9,"report":9,"failure":4,"messages":3,"successful":2,"experiment":2,"start":1,"time":3,"end":2,"result":2,"count":1},"experiment":{"test":5,"report":5,"failure":3,"messages":2,"successful":2,"experiment":2,"count":1,"result":1,"end":1,"time":1},"failed":{"test":5,"report":5,"failure":3,"messages":2,"successful":1,"experiment":1,"count":1,"result":1,"end":1,"time":1,"payment":2,"failed":1,"reason":1,"amount":1},"after":{"test":1,"report":1,"failure":1,"messages":1,"successful":1,"experiment":1,"customer":1,"support":1,"agent":1},"hours":{"test":1,"report":1,"failure":1,"messages":1,"successful":1,"experiment":1},"experiments":{"test":4,"report":4,"start":1,"time":2,"failure":1,"messages":1,"end":1,"result":1},"invalid":{"credit":1,"card":1,"error":1,"message":1,"rejection":2,"reason":2},"expiry":{"credit":1,"card":1,"error":1,"message":1},"tweet":{"approved":1},"business":{"approved":1},"charge":{"approved":1,"process":10,"variable":10,"response":10,"status":7,"code":7},"card":{"approved":1,"process":10,"variable":10,"response":10,"status":7,"code":7,"played":3,"nope":2,"cards":3,"correlation":1,"key":1,"players":1,"discard":1,"pile":1,"last":1},"accounts":{"accounts":2},"weather":{"forecast":2,"temperature":2},"forecast":{"forecast":2,"temperature":2},"soap":{"forecast":2,"temperature":2},"script":{"message":1},"form":{"start":1,"date":1,"user":1,"id":1},"检查是否通过":{"passed":1},"mail":{"message":2,"id":2,"ws":2,"response":2,"send":1,"mail":1,"result":1,"success":1,"sent":1},"complete":{"message":1},"prepare":{"to":1,"value":1,"of":1,"items":1},"message":{"to":1,"received":1,"notification":1,"message":1,"conversation":2,"tool":2,"call":2,"result":2},"pong":{"received":1,"from":1,"me":1},"new":{"spot":1,"price":2,"conversation":2,"id":1,"user":2,"name":1,"request":1,"agent":1,"context":1},"spot":{"spot":2,"price":3},"signal":{"price":1},"trade":{"amount":1},"activty":{"3":1,"var":1},"output":{"2":1,"name":2,"of":2,"variable":2,"in":2,"main":2,"process":2},"serve":{"my":2,"output":2,"parameter":2,"some":1,"out":1,"variable":1,"target":1},"customers":{"my":2,"output":2,"parameter":2,"some":1,"out":1,"variable":1,"target":1},"metrics":{"message":1},"poll":{"mails":1},"pizza":{"mails":1},"orders":{"mails":1},"grade":{"final":1,"grade":3,"supplier":1,"mechanics":1},"retrieve":{"process":1,"variable":1,"response":1,"first":1,"name":2,"last":1,"sheet":1,"url":1,"request":1,"id":1},"payment":{"process":1,"variable":1,"response":1,"payment":3,"received":1,"valid":1,"invoice":1,"id":1,"is":1,"accepted":1,"failed":1,"reason":1,"amount":1},"ship":{"process":1,"variable":1,"response":1},"goods":{"process":2,"variable":2,"response":2},"notification":{"status":2,"code":2},"adapter":{"process":6,"variable":6,"response":6,"status":3,"code":3},"method":{"execute":1,"result":1,"variable":1,"data":1},"result":{"execute":1,"result":2,"variable":1,"data":1,"tool":1,"call":1},"store":{"process":1,"variable":1,"response":1},"receive":{"process":4,"variable":4,"a":2,"b":2},"echo":{"process":4,"variable":4,"a":2,"b":2},"do":{"foo":1,"some":1,"stuff":1,"guess":1,"answer":1},"stuff":{"foo":1,"some":1,"stuff":1},"book":{"tracking":1,"code":1,"success":3},"the":{"tracking":1,"code":1,"risk":2,"score":1,"supplier":1,"grade":2,"bodywork":1,"report":1,"mechanics":1,"repair":1,"cost":1,"review":1,"note":1,"daily":1,"rate":1,"allowance":1,"in":1,"euro":1,"audit":1,"verdict":1,"payout":1,"receipt":1,"payment":1,"reference":1},"carrier":{"tracking":1,"code":1},"country":{"risk":1,"score":1},"supplier":{"supplier":1,"grade":1},"arrange":{"audit":1,"verdict":1},"an":{"audit":1,"verdict":1},"site":{"audit":1,"verdict":1},"audit":{"audit":2,"verdict":2},"bodywork":{"bodywork":1,"report":1},"mechanical":{"mechanics":1,"grade":1},"damage":{"mechanics":1,"grade":1,"damage":1,"assessment":1},"repair":{"repair":1,"cost":1},"submitted":{"review":1,"note":1},"receipts":{"review":1,"note":1},"daily":{"daily":1,"rate":1},"allowance":{"daily":1,"rate":1,"allowance":1,"in":1,"euro":1},"claim":{"allowance":1,"in":1,"euro":1,"audit":1,"verdict":1,"has":7,"empty":7,"spots":7,"routing":1,"decision":1},"currency":{"allowance":1,"in":1,"euro":1},"pay":{"payout":1,"receipt":1,"payment":1,"reference":1},"reimbursement":{"payout":1,"receipt":1,"payment":1,"reference":1},"label":{"parcel":1,"label":1},"each":{"parcel":1,"label":1},"parcel":{"parcel":1,"label":1},"normal":{"is":1,"normal":1},"cheack":{"medicine":1},"coagulation":{"medicine":1},"time":{"time":2,"since":2,"blood":2,"loss":2,"tool":1,"call":1,"result":1},"since":{"time":2,"since":2,"blood":2,"loss":2},"blood":{"time":2,"since":2,"blood":2,"loss":2},"loss":{"time":2,"since":2,"blood":2,"loss":2},"level":{"risk":1,"damage":1,"assessment":1},"physiological":{"is":20,"suspected":20},"measurements":{"is":20,"suspected":20},"infection":{"infection":18,"is":18,"large":18},"soberity":{"is":20,"sober":20},"camunda":{"user":1,"id":1,"success":3,"tool":3,"call":3,"result":3,"sanctions":1,"match":2,"raw":4,"pep":1,"risk":2,"tier":1,"score":1},"sign":{"gcp":1,"authorization":1,"token":1},"into":{"gcp":1,"authorization":1,"token":1},"google":{"gcp":1,"authorization":1,"token":1},"retry":{"auth":2,"retries":4,"count":2,"remaining":2,"refresh":2},"scope":{"state":1},"url":{"result":1,"auth":2,"code":2,"callback":2,"microsoft":1,"access":1,"token":1,"url":3,"authorize":1,"azure":1,"encoded":1},"encode":{"result":1,"auth":2,"code":2,"callback":2,"azure":2,"encoded":2,"url":1,"scopes":1},"token":{"microsoft":1,"access":2,"token":2,"url":1,"azure":1},"authorize":{"authorize":1,"url":1},"attempt":{"request":1,"id":1},"authorization":{"request":1,"id":1},"code":{"request":1,"id":1,"received":1,"notification":1,"message":1},"callback":{"azure":1,"encoded":1,"auth":1,"code":1,"callback":1,"url":1},"scopes":{"azure":1,"encoded":1,"scopes":1},"sample":{"send":1,"message":1},"received":{"customer":3,"name":1,"address":1,"order":2,"e":1,"mail":1,"mobile":1,"phone":1,"id":2,"invoice":1,"received":1,"notification":1,"message":1,"tool":1,"call":1,"result":1,"conversation":1},"by":{"is":2,"accepted":2},"sales":{"is":2,"accepted":2},"department":{"is":1,"accepted":1},"head":{"is":1,"accepted":1},"of":{"is":1,"accepted":1,"value":1,"of":1,"items":1},"choose":{"distributor":1,"case":1,"owner":1,"email":1},"distributor":{"distributor":1},"value":{"value":1,"of":1,"items":1},"items":{"value":1,"of":1,"items":1,"tool":1,"call":1,"result":1},"delivery":{"value":1,"of":1,"items":1},"satisfaction":{"order":1,"id":1,"customer":1,"name":1,"meal":1},"survey":{"order":1,"id":1,"customer":1,"name":1,"meal":1},"confirm":{"valid":1,"ws":2,"response":2},"created":{"invoice":1,"id":1,"group":1},"construct":{"result":8},"supervisor":{"result":2},"submitter":{"result":2},"colleague":{"result":2},"direct":{"result":2},"reports":{"result":2},"variables":{"employee":1,"name":1,"deadline":2,"date":1,"time":1,"survey":1,"link":1},"template":{"template":1},"ticket":{"tickets":3,"resolved":1},"reserved":{"tickets":3},"out":{"payment":3,"id":3},"cloudevents":{"payment":3,"id":3},"async":{"out":1,"result":1},"void":{"out":1,"result":1},"throw":{"throw":1,"result":1},"warn":{"ws":4,"response":4},"again":{"ws":1,"response":1},"notice":{"ws":3,"response":3},"about":{"ws":5,"response":5},"loaded":{"ws":3,"response":3},"blacklisting":{"ws":1,"response":1},"removal":{"ws":1,"response":1},"creation":{"ws":1,"response":1},"membership":{"membership":7,"id":7,"has":7,"empty":7,"spots":7},"requested":{"membership":7,"id":8,"customer":2,"name":1,"request":1},"маршрут":{"credit":1,"route":1},"по":{"credit":1,"route":1},"сумме":{"credit":1,"route":1},"tree":{"service":1,"route":1},"my":{"received":1,"notification":1,"message":1},"saved":{"path":1},"master":{"customer":2,"id":1,"name":1},"placed":{"order":1},"checked":{"order":1},"render":{"body":1,"subject":1},"body":{"body":1},"subject":{"subject":1},"templates":{"result":1,"templates":1},"comfirmation":{"request":1},"support":{"resolved":1,"customer":1,"support":1,"agent":1},"case":{"case":2,"owner":1,"email":1,"successful":1},"owner":{"case":1,"owner":1,"email":1},"homework":{"guess":1,"answer":1},"made":{"test":1},"it":{"test":1},"played":{"played":1,"nope":1,"cards":1,"correlation":1,"key":1},"nope":{"noped":1,"player":1,"played":3,"nope":2,"cards":3,"correlation":1,"key":1,"players":1,"discard":1,"pile":1,"last":1},"turn":{"turn":1,"of":1,"round":1},"select":{"cards":2,"last":1,"played":1,"action":1,"turn":1,"of":1,"round":1},"play":{"played":2,"nope":1,"cards":2,"players":1,"discard":1,"pile":1,"last":1},"scoring":{"risk":1,"tier":1},"rules":{"risk":1,"tier":1},"carbon":{"execution":2,"delayed":4,"mapped":6,"by":2,"original":2,"carbon":8,"actual":2,"saved":2,"reduced":2},"reductor":{"execution":2,"delayed":4,"mapped":6,"by":2,"original":2,"carbon":8,"actual":2,"saved":2,"reduced":2},"character":{"character":1},"enter":{"wishlist":1,"child":1},"wishlist":{"wishlist":1,"child":1},"hotel":{"success":1},"http":{"success":3,"tool":3,"call":3,"result":3,"sanctions":1,"match":2,"raw":4,"pep":1,"risk":2,"tier":1,"score":1},"car":{"success":1},"flight":{"success":1},"incident":{"team":1},"team":{"team":1},"product":{"tool":2,"call":2,"result":3,"test":1},"catalog":{"tool":1,"call":1,"result":1},"search":{"tool":1,"call":1,"result":1},"knowledge":{"tool":1,"call":1,"result":1},"base":{"tool":1,"call":1,"result":1},"reply":{"conversation":1},"chat":{"conversation":1},"conversation":{"conversation":2,"id":1,"user":2,"name":1,"request":1,"agent":1,"context":1},"human":{"customer":1,"support":1,"agent":1,"tool":1,"call":1,"result":1},"escalation":{"customer":1,"support":1,"agent":1},"minutes":{"customer":1,"support":1,"agent":1},"working":{"case":1,"successful":1},"upload":{"pdf":2},"demo":{"result":1,"test":1},"kotlin":{"delegate":1,"result":1,"mapping":1},"simple":{"delegate":1,"result":2,"mapping":2,"java":1},"params":{"delegate":1,"result":2,"mapping":2,"java":1},"in":{"java":1,"result":1,"mapping":1},"java":{"java":1,"result":1,"mapping":1},"optional":{"java":1,"result":1,"mapping":1},"superflux":{"tool":1,"call":1,"result":1},"calculation":{"tool":1,"call":1,"result":1},"ask":{"tool":1,"call":1,"result":1},"kyc":{"agent":1,"screening":2,"report":1,"summary":1,"identity":1,"verified":2,"sanctions":1,"match":2,"pep":1,"risk":2,"tier":1,"score":1,"address":1,"employment":1,"kyc":2,"recommendation":1,"rationale":1},"screening":{"agent":1,"screening":2,"report":1,"summary":1,"identity":1,"verified":2,"sanctions":1,"match":2,"pep":1,"risk":2,"tier":1,"score":1,"address":1,"employment":1,"kyc":2,"recommendation":1,"rationale":1,"tool":1,"call":1,"result":1},"agentcost":{"agent":1,"screening":2,"report":1,"summary":1,"identity":1,"verified":2,"sanctions":1,"match":2,"pep":1,"risk":3,"tier":1,"score":1,"address":1,"employment":1,"kyc":3,"recommendation":1,"rationale":1,"judge":2,"decision":1,"reasoning":1,"assessment":1},"capture":{"agent":1,"screening":2,"report":1,"summary":1,"identity":1,"verified":2,"sanctions":1,"match":2,"pep":1,"risk":3,"tier":1,"score":1,"address":1,"employment":1,"kyc":3,"recommendation":1,"rationale":1,"judge":2,"decision":1,"reasoning":1,"assessment":1},"identity":{"tool":1,"call":1,"result":1},"screen":{"tool":1,"call":1,"result":1,"sanctions":1,"match":2,"raw":2,"pep":1},"sanctions":{"tool":1,"call":1,"result":1,"sanctions":1,"match":2,"raw":2,"pep":1},"pep":{"tool":1,"call":1,"result":1,"sanctions":1,"match":2,"raw":2,"pep":1},"additional":{"tool":1,"call":1,"result":1},"information":{"tool":1,"call":1,"result":1},"submit":{"tool":1,"call":1,"result":1},"edd":{"judge":2,"decision":1,"reasoning":1,"kyc":1,"risk":1,"assessment":1},"judge":{"judge":2,"decision":1,"reasoning":1,"kyc":1,"risk":1,"assessment":1},"onboarding":{"onboarding":1,"decision":1},"authority":{"onboarding":1,"decision":1},"detection":{"fraud":3,"score":1,"indicators":1,"requires":1,"review":1},"sla":{"sla":1,"decision":1},"duration":{"sla":1,"decision":1},"injury":{"injury":1,"assessment":1},"severity":{"injury":1,"assessment":1},"whether":{"automatic":1,"processing":1},"configurable":{"is":3,"order":3,"valid":3,"decision":3},"validations":{"is":3,"order":3,"valid":3,"decision":3},"general":{"is":1,"order":1,"valid":1,"decision":1},"decision":{"underwriting":1,"decision":1,"result":1}},"position":{"1":{"sum":84,"count":96},"2":{"sum":23,"count":29},"3":{"sum":7,"count":13},"completed":{"sum":0,"count":3},"case":{"sum":1.3333333333333333,"count":6},"instance":{"sum":2.6666666666666665,"count":4},"id":{"sum":47.6,"count":48},"account":{"sum":0,"count":1},"number":{"sum":1,"count":1},"file":{"sum":0.5,"count":2},"size":{"sum":0.5,"count":1},"ok":{"sum":1,"count":1},"skills":{"sum":1,"count":2},"selected":{"sum":1,"count":5},"employee":{"sum":4,"count":8},"experience":{"sum":1,"count":1},"score":{"sum":9,"count":10},"underwriter":{"sum":0.5,"count":1},"approved":{"sum":2,"count":4},"underwriting":{"sum":0,"count":2},"result":{"sum":53.33333333333333,"count":67},"check":{"sum":1.1166666666666667,"count":4},"unique":{"sum":0.5,"count":1},"rsp":{"sum":1.15,"count":2},"against":{"sum":0.8,"count":1},"mandatory":{"sum":0.6666666666666666,"count":1},"fields":{"sum":1,"count":1},"claims":{"sum":0.5,"count":1},"field":{"sum":0.6666666666666666,"count":1},"length":{"sum":1,"count":1},"user":{"sum":0.5,"count":6},"name":{"sum":12,"count":14},"viral":{"sum":0,"count":1},"room":{"sum":0,"count":1},"upgrade":{"sum":1,"count":1},"free":{"sum":0,"count":1},"drinks":{"sum":1,"count":1},"breakfast":{"sum":0.5,"count":1},"email":{"sum":5.75,"count":8},"benefits":{"sum":0.5,"count":1},"async":{"sum":0,"count":1},"approver":{"sum":0,"count":18},"groups":{"sum":19,"count":19},"data":{"sum":5,"count":6},"risk":{"sum":5,"count":20},"dm":{"sum":0.5,"count":1},"nresult":{"sum":1,"count":1},"document":{"sum":3,"count":4},"dmn":{"sum":0,"count":2},"dish":{"sum":0.5,"count":1},"beverages":{"sum":0.5,"count":1},"discount":{"sum":0.5,"count":3},"decade":{"sum":0.5,"count":1},"video":{"sum":0,"count":1},"game":{"sum":1,"count":1},"band":{"sum":0.5,"count":1},"movie":{"sum":0.5,"count":1},"suitable":{"sum":0,"count":1},"consultants":{"sum":1,"count":1},"clarified":{"sum":6,"count":12},"assessment":{"sum":4.5,"count":6},"complex":{"sum":0,"count":1},"value":{"sum":15,"count":16},"general":{"sum":0,"count":2},"config":{"sum":1.5,"count":2},"json":{"sum":3,"count":3},"is":{"sum":9,"count":71},"included":{"sum":1,"count":1},"failing":{"sum":0,"count":1},"task":{"sum":4,"count":13},"complete":{"sum":0,"count":2},"price":{"sum":5,"count":6},"fraud":{"sum":0,"count":5},"counter":{"sum":1,"count":2},"chosen":{"sum":0,"count":3},"team":{"sum":3.5,"count":4},"assignee":{"sum":0.5,"count":1},"candidate":{"sum":0,"count":2},"users":{"sum":1,"count":1},"mypath":{"sum":1,"count":2},"the":{"sum":0,"count":1},"answer":{"sum":1.5,"count":2},"status":{"sum":0,"count":17},"transfer":{"sum":2,"count":4},"expense":{"sum":4,"count":4},"risikobewertung":{"sum":1,"count":2},"risks":{"sum":1,"count":2},"risikopruefung":{"sum":1,"count":2},"business":{"sum":0,"count":3},"decision":{"sum":15,"count":17},"output":{"sum":8,"count":10},"automatic":{"sum":0,"count":3},"approval":{"sum":1,"count":3},"mapping":{"sum":4,"count":4},"message":{"sum":5,"count":11},"welcome":{"sum":1,"count":1},"doc":{"sum":0,"count":4},"extracted":{"sum":1,"count":1},"merged":{"sum":1,"count":1},"watermark":{"sum":1,"count":1},"image":{"sum":0.3333333333333333,"count":1},"to":{"sum":1.6666666666666665,"count":3},"pdf":{"sum":3.333333333333333,"count":5},"list":{"sum":0,"count":1},"images":{"sum":1,"count":1},"time":{"sum":4,"count":7},"stamp":{"sum":0.5,"count":1},"ping":{"sum":1,"count":1},"jvm":{"sum":0,"count":1},"parameters":{"sum":1,"count":1},"cherry":{"sum":0,"count":9},"icon":{"sum":1,"count":1},"mime":{"sum":0.5,"count":1},"type":{"sum":1,"count":1},"in":{"sum":3.6,"count":7},"folder":{"sum":1,"count":1},"temp":{"sum":1,"count":1},"source":{"sum":0.3333333333333333,"count":1},"destination":{"sum":0.3333333333333333,"count":1},"greeting":{"sum":1,"count":2},"response":{"sum":28.5,"count":29},"xml":{"sum":0,"count":5},"holiday":{"sum":3,"count":3},"sub":{"sum":0,"count":48},"process":{"sum":10.833333333333334,"count":56},"circuit":{"sum":26,"count":66},"quantum":{"sum":9,"count":12},"programming":{"sum":9,"count":12},"language":{"sum":12,"count":12},"execution":{"sum":9,"count":18},"service":{"sum":0,"count":13},"mitigated":{"sum":0,"count":3},"counts":{"sum":9,"count":15},"cutting":{"sum":0,"count":3},"meta":{"sum":1.5,"count":3},"circuits":{"sum":3,"count":3},"meas":{"sum":0,"count":9},"qubits":{"sum":19,"count":19},"depth":{"sum":9.5,"count":19},"transpiled":{"sum":9,"count":9},"untranspiled":{"sum":10,"count":10},"num":{"sum":5,"count":10},"iterations":{"sum":7,"count":14},"converged":{"sum":3.5,"count":7},"obj":{"sum":0,"count":10},"evaluated":{"sum":0,"count":9},"costs":{"sum":9,"count":9},"max":{"sum":0,"count":5},"cut":{"sum":2.5,"count":5},"plot":{"sum":7.5,"count":9},"tsp":{"sum":0,"count":1},"ws":{"sum":0,"count":19},"bitstring":{"sum":4,"count":4},"optimizer":{"sum":0,"count":1},"init":{"sum":1,"count":1},"distance":{"sum":0,"count":1},"matrix":{"sum":2,"count":2},"duration":{"sum":0,"count":1},"probability":{"sum":2,"count":4},"distribution":{"sum":4,"count":4},"visualization":{"sum":3,"count":3},"agent":{"sum":5.5,"count":8},"error":{"sum":0.6666666666666666,"count":3},"var":{"sum":2,"count":81},"out":{"sum":2.3333333333333335,"count":7},"target":{"sum":1,"count":10},"order":{"sum":7.499999999999999,"count":19},"variable":{"sum":19.066666666666666,"count":32},"i":{"sum":6,"count":12},"foo":{"sum":1.5,"count":3},"valid":{"sum":6.000000000000001,"count":8},"customer":{"sum":0,"count":11},"notified":{"sum":1,"count":1},"loan":{"sum":0,"count":1},"exchange":{"sum":0,"count":1},"rate":{"sum":2,"count":2},"converted":{"sum":0,"count":1},"amount":{"sum":2.5,"count":3},"routing":{"sum":0.5,"count":3},"background":{"sum":0,"count":1},"rationale":{"sum":1.5,"count":2},"fit":{"sum":0,"count":1},"interview":{"sum":0,"count":1},"slot":{"sum":1,"count":1},"invitation":{"sum":0,"count":1},"recruiter":{"sum":0,"count":1},"summary":{"sum":1.5,"count":2},"rejection":{"sum":0,"count":3},"access":{"sum":0.8333333333333333,"count":3},"granted":{"sum":1,"count":1},"required":{"sum":1,"count":1},"ignored":{"sum":0.5,"count":1},"claim":{"sum":0,"count":1},"level":{"sum":1.5,"count":2},"health":{"sum":0,"count":1},"percentage":{"sum":1,"count":1},"code":{"sum":13.1,"count":14},"popular":{"sum":0,"count":1},"repo":{"sum":1,"count":1},"my":{"sum":0,"count":8},"date":{"sum":3,"count":3},"long":{"sum":1,"count":1},"string":{"sum":1,"count":1},"boolean":{"sum":1,"count":1},"enum":{"sum":1,"count":1},"item":{"sum":0,"count":1},"a":{"sum":3,"count":4},"b":{"sum":3,"count":4},"rule":{"sum":0,"count":8},"reason":{"sum":5,"count":5},"policy":{"sum":0.5,"count":1},"successful":{"sum":1,"count":6},"run":{"sum":2,"count":2},"timeout":{"sum":0.5,"count":1},"test":{"sum":1.5,"count":14},"report":{"sum":5.666666666666667,"count":13},"failure":{"sum":3.9999999999999996,"count":6},"messages":{"sum":5,"count":5},"experiment":{"sum":3,"count":3},"start":{"sum":0.6666666666666666,"count":2},"end":{"sum":1.3333333333333333,"count":2},"count":{"sum":3,"count":3},"credit":{"sum":0,"count":2},"card":{"sum":0.3333333333333333,"count":1},"accounts":{"sum":1,"count":2},"forecast":{"sum":1,"count":2},"temperature":{"sum":1,"count":2},"percent":{"sum":1,"count":1},"passed":{"sum":0.5,"count":1},"arbval":{"sum":0.5,"count":1},"from":{"sum":1.5,"count":2},"received":{"sum":1.5,"count":3},"me":{"sum":0.5,"count":1},"took":{"sum":0,"count":2},"condition":{"sum":1.5,"count":3},"spot":{"sum":0,"count":2},"body":{"sum":1,"count":2},"basis":{"sum":0.5,"count":1},"of":{"sum":1.8666666666666667,"count":5},"main":{"sum":1.4666666666666668,"count":2},"parameter":{"sum":2,"count":2},"some":{"sum":0,"count":2},"mails":{"sum":0.5,"count":1},"final":{"sum":0,"count":1},"grade":{"sum":3,"count":3},"execute":{"sum":0,"count":1},"first":{"sum":0,"count":1},"last":{"sum":0,"count":3},"sheet":{"sum":0,"count":1},"url":{"sum":4,"count":4},"tracking":{"sum":0,"count":1},"supplier":{"sum":0,"count":1},"audit":{"sum":0,"count":2},"verdict":{"sum":2,"count":2},"bodywork":{"sum":0,"count":1},"mechanics":{"sum":0,"count":1},"repair":{"sum":0,"count":1},"cost":{"sum":1,"count":1},"review":{"sum":1,"count":3},"note":{"sum":1,"count":1},"daily":{"sum":0,"count":1},"allowance":{"sum":0,"count":1},"euro":{"sum":1,"count":1},"payout":{"sum":0,"count":1},"receipt":{"sum":1,"count":1},"payment":{"sum":0,"count":7},"reference":{"sum":1,"count":1},"parcel":{"sum":0,"count":1},"label":{"sum":1,"count":1},"normal":{"sum":1,"count":1},"medicine":{"sum":0.5,"count":1},"since":{"sum":0.6666666666666666,"count":2},"blood":{"sum":1.3333333333333333,"count":2},"loss":{"sum":2,"count":2},"suspected":{"sum":20,"count":20},"infection":{"sum":0,"count":18},"large":{"sum":18,"count":18},"sober":{"sum":20,"count":20},"gcp":{"sum":0,"count":1},"authorization":{"sum":0.5,"count":1},"token":{"sum":2.6666666666666665,"count":3},"auth":{"sum":0.4,"count":4},"retries":{"sum":2,"count":4},"remaining":{"sum":2,"count":2},"refresh":{"sum":0,"count":2},"state":{"sum":0.5,"count":1},"callback":{"sum":1.8,"count":2},"microsoft":{"sum":0,"count":1},"authorize":{"sum":0,"count":1},"request":{"sum":1.5,"count":3},"azure":{"sum":0,"count":3},"encoded":{"sum":0.7,"count":2},"scopes":{"sum":1,"count":1},"send":{"sum":0,"count":2},"address":{"sum":0.5,"count":2},"e":{"sum":0.5,"count":1},"mail":{"sum":1.5,"count":2},"mobile":{"sum":0.5,"count":1},"phone":{"sum":1,"count":1},"accepted":{"sum":3,"count":3},"distributor":{"sum":0.5,"count":1},"items":{"sum":1,"count":1},"meal":{"sum":0.5,"count":1},"invoice":{"sum":0,"count":2},"deadline":{"sum":0,"count":2},"survey":{"sum":0,"count":1},"link":{"sum":1,"count":1},"template":{"sum":0.5,"count":1},"tickets":{"sum":1.5,"count":3},"throw":{"sum":0,"count":1},"membership":{"sum":0,"count":7},"has":{"sum":0,"count":7},"empty":{"sum":3.5,"count":7},"spots":{"sum":7,"count":7},"route":{"sum":2,"count":2},"notification":{"sum":0.5,"count":1},"path":{"sum":0.5,"count":1},"group":{"sum":0.5,"count":1},"stuff":{"sum":1,"count":1},"success":{"sum":2,"count":4},"subject":{"sum":0.5,"count":1},"templates":{"sum":0.5,"count":1},"sent":{"sum":2.5,"count":3},"failed":{"sum":0.5,"count":1},"resolved":{"sum":0.5,"count":1},"owner":{"sum":0.5,"count":1},"guess":{"sum":0.5,"count":1},"played":{"sum":1,"count":5},"nope":{"sum":1.5,"count":3},"cards":{"sum":5.5,"count":6},"correlation":{"sum":0,"count":2},"key":{"sum":2,"count":2},"noped":{"sum":0,"count":1},"player":{"sum":1,"count":1},"turn":{"sum":0,"count":2},"round":{"sum":2,"count":2},"action":{"sum":0.5,"count":1},"players":{"sum":0.5,"count":1},"discard":{"sum":0,"count":1},"pile":{"sum":1,"count":1},"tier":{"sum":2.5,"count":3},"delayed":{"sum":1.5,"count":4},"mapped":{"sum":6,"count":6},"by":{"sum":1.5,"count":2},"original":{"sum":0,"count":2},"carbon":{"sum":6,"count":8},"actual":{"sum":0,"count":2},"saved":{"sum":0,"count":2},"reduced":{"sum":0,"count":2},"character":{"sum":0.5,"count":1},"wishlist":{"sum":0.5,"count":1},"child":{"sum":0.5,"count":1},"support":{"sum":2,"count":4},"tool":{"sum":0,"count":16},"call":{"sum":7.75,"count":16},"conversation":{"sum":1.5,"count":4},"context":{"sum":1,"count":1},"delegate":{"sum":0,"count":1},"java":{"sum":0,"count":1},"screening":{"sum":0,"count":2},"identity":{"sum":0,"count":1},"verified":{"sum":2,"count":2},"sanctions":{"sum":0,"count":2},"match":{"sum":3,"count":4},"pep":{"sum":0,"count":2},"employment":{"sum":0.5,"count":1},"kyc":{"sum":0,"count":3},"recommendation":{"sum":1,"count":1},"raw":{"sum":4,"count":4},"judge":{"sum":0,"count":2},"reasoning":{"sum":1,"count":1},"onboarding":{"sum":0,"count":1},"indicators":{"sum":1,"count":1},"requires":{"sum":0.5,"count":1},"sla":{"sum":0,"count":1},"injury":{"sum":0,"count":1},"damage":{"sum":0,"count":1},"settlement":{"sum":0,"count":1},"processing":{"sum":1,"count":1}}}`)});function sigmoid(e){return e>=0?1/(1+Math.exp(-e)):Math.exp(e)/(1+Math.exp(e))}function probabilityOf(e,t){if(e.kind===`platt`)return sigmoid(e.slope*t+e.intercept);if(e.upTo.length===0)return 0;let n=0,r=e.upTo.length-1;for(;n<r;){let i=n+r>>1;t<=e.upTo[i]?r=i:n=i+1}return e.value[n]}function vectorOf(e,t){return t.map(t=>{let n=e[t];if(typeof n!=`number`||!Number.isFinite(n))throw Error(`feature ${t} is missing or not a finite number`);return n})}function scoreLogistic(e,t){return contributionsLogistic(e,t).reduce((e,t)=>e+t,0)}function contributionsLogistic(e,t){return e.weights.map((n,r)=>n*(Math.min(e.high[r],Math.max(e.low[r],t[r]))-e.mean[r])/e.scale[r])}var Is=-1;function leafOf(e,t){let n=e.nodes[0];for(;n.feature!==Is;)n=e.nodes[t[n.feature]<=n.threshold?n.left:n.right];return n}function scoreTrees(e,t){return e.trees.reduce((e,n)=>e+leafOf(n,t).value,0)}function contributionsTrees(e,t){let n=Array(t.length).fill(0);for(let r of e.trees){let e=r.nodes[0];for(;e.feature!==Is;){let i=r.nodes[t[e.feature]<=e.threshold?e.left:e.right];n[e.feature]+=i.value-e.value,e=i}}return n}function scoreOf(e,t){return e.family===`logistic`?scoreLogistic(e,t):scoreTrees(e,t)}function contributionsOf(e,t){return e.family===`logistic`?contributionsLogistic(e,t):contributionsTrees(e,t)}function compareText(e,t){return e<t?-1:+(e>t)}function reasonsOf(e,t,n){return contributionsOf(t,n).map((t,n)=>({feature:e.features[n],contribution:t})).filter(e=>e.contribution!==0).sort((e,t)=>Math.abs(t.contribution)-Math.abs(e.contribution)||compareText(e.feature,t.feature)).slice(0,3)}function decide(e,t,n){if(n===null||e.length===0)return null;let[r,i]=e.map((e,t)=>t).sort((n,r)=>e[r]-e[n]||compareText(t[n],t[r])),a=e[r]-(i===void 0?0:e[i]);return a<=0||e[r]<n.probability||a<n.margin?null:r}function scoredOf(e,t,n){let r=n.map(t=>vectorOf(t.features,e.features));return{taskModel:t,rows:r,probabilities:r.map(e=>probabilityOf(t.calibration,scoreOf(t.scorer,e)))}}function rankTask(e,t,n){let r=e.tasks[t];if(r===void 0||r.threshold===null||n.length===0)return[];let i=scoredOf(e,r,n),a=decide(i.probabilities,n.map(e=>e.value),r.threshold);return a===null?[]:[suggestionAt(e,t,n,i,a)]}function suggestionAt(e,t,n,r,i){return{task:t,value:n[i].value,origin:n[i].origin,probability:r.probabilities[i],reasons:reasonsOf(e,r.taskModel.scorer,r.rows[i])}}function rankingOf(e,t,n){let r=e.tasks[t];if(r===void 0||n.length===0)return[];let i=scoredOf(e,r,n);return n.map((e,t)=>t).sort((e,t)=>i.probabilities[t]-i.probabilities[e]||compareText(n[e].value,n[t].value)).map(r=>suggestionAt(e,t,n,i,r))}function rankerOf(e){return{rank:(t,n)=>rankTask(e,t,n)}}var Ls={suggest:()=>[],ranking:()=>[],verdict:()=>({confident:!1,reason:`none`})};function suggestionProviderOf(e,t,n){if(!e.diagrams.some(e=>e.path===t))return Ls;let r=rankerOf(n),i=new Map,candidatesOf=r=>{let a=JSON.stringify([r.task,r.elementId,r.field]),o=i.get(a);if(o!==void 0)return o;let s=inRequestScope(e,t,r,n.names,e=>candidatesOfRequest(e,r));return i.set(a,s),s},expressionOf=r=>r.field.trim()===``?[]:inRequestScope(e,t,r,n.names,e=>{let t=recogniseExpression(expressionContextOf(e,r));return t===null?[]:[{task:`expression`,value:t.value,origin:`transform`,probability:null,reasons:[],recognition:recognitionOf(t)}]}),a=new Map,verdictOf=r=>{if(r.task===`expression`)return null;let i=JSON.stringify([r.task,r.elementId,r.field]),o=a.get(i);if(o!==void 0)return o;let s=inRequestScope(e,t,r,n.names,e=>nameVerdictOf(e,r));return a.set(i,s),s};return{suggest:e=>e.task===`expression`?expressionOf(e):r.rank(e.task,candidatesOf(e)),ranking:e=>e.task===`expression`?expressionOf(e):rankingOf(n,e.task,candidatesOf(e)),verdict:verdictOf}}var Rs=new SuggestionContextBuilder;function yieldToInput(){return new Promise(e=>setTimeout(e,0))}function shownWhenConfident(e){let shown=t=>{let n=e.verdict(t);return n===null||n.confident};return{suggest:t=>shown(t)?e.suggest(t):[],ranking:t=>shown(t)?e.ranking(t):[],verdict:t=>e.verdict(t)}}async function projectSuggestionsOf(e,t,n){return shownWhenConfident(suggestionProviderOf(await Rs.build(e,t,{pause:yieldToInput,focus:n}),n,Fs))}function useSuggestionProvider(e){f(()=>{if(e===null)return;let t=!0;return projectSuggestionsOf(e.texts,e.workers,e.focus).then(e=>{t&&ia(e)}).catch(e=>console.error(`Penstock could not build the suggestions of the project:`,e)),()=>{t=!1}},[e]),f(()=>()=>ia(null),[])}function publishProjectVariables(e){e.dataset.projectVariables=Nt().join(` `)}function popupIsOpen(e){try{return e.get(`feelPopup`)?.isOpen?.()===!0}catch{return!1}}function PropertiesPanel({selectedElementId:e,modeler:t,containerId:r=`js-properties-panel`,isPanelCollapsed:i=!1,reveal:a=null,onRevealed:c}){let l=s(!1),d=s(null),[p,m]=n(``);return useFieldSuggestions(d,e??null,m),f(()=>{if(t){try{let e=t.get(`propertiesPanel`);if(!e)return;if(i)l.current&&e.detach&&(e.detach(),l.current=!1);else if(!l.current&&e.attachTo){let t=d.current;t&&(e.attachTo(t),l.current=!0,publishProjectVariables(t))}}catch(e){console.error(`Error handling properties panel attach/detach:`,e)}return()=>{try{if(l.current){let e=t?.get?.(`propertiesPanel`);e?.detach&&e.detach(),l.current=!1}}catch(e){console.error(`Error detaching properties panel on unmount:`,e)}}}},[t,i,r]),f(()=>{let e=d.current;if(!t||!e)return;let n=t.get?.(`eventBus`),r=!1,busy=()=>e.contains(document.activeElement)||popupIsOpen(t),refresh=()=>{if(r&&!busy()){r=!1;try{let n=t.get(`propertiesPanel`);if(!l.current||!n?.detach||!n.attachTo)return;n.detach(),n.attachTo(e),publishProjectVariables(e)}catch(e){console.error(`Error refreshing the properties panel after the project variables changed:`,e)}}},later=()=>setTimeout(refresh,0);n?.on?.(`propertiesPanelPopup.close`,later),e.addEventListener(`focusout`,later);let i=Jn(()=>{r=!0,refresh()});return()=>{i(),e.removeEventListener(`focusout`,later),n?.off?.(`propertiesPanelPopup.close`,later)}},[t]),f(()=>{if(t&&!i)try{let e=t.get(`propertiesPanel`);e&&e._update&&l.current&&e._update()}catch(e){console.error(`Error updating properties panel:`,e)}},[t,e,i]),f(()=>{let e=d.current;if(!a?.length||!e)return;let attempt=()=>focusEntry(e,a)?(c?.(),!0):!1;if(attempt()||typeof MutationObserver>`u`)return;let t=new MutationObserver(()=>{attempt()&&t.disconnect()});return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()},[a,c]),u(o,{children:[u(`div`,{id:r,ref:d,className:`properties-panel-wrapper`,style:{display:i?`none`:`block`}}),u(`p`,{class:`suggestion-announce`,role:`status`,"aria-live":`polite`,children:p})]})}var zs={top:3,right:3},Bs={top:-12,right:-6};function badgePosition(e){let t=e?.businessObject?.$type??``;return/Task$|SubProcess$|CallActivity$|Transaction$/.test(t)?zs:Bs}var Vs={top:-12,left:-6};function stepPosition(e){let t=e?.businessObject?.$type??``;return/Task$|SubProcess$|CallActivity$|Transaction$/.test(t)?Vs:Bs}var Hs=[`marker-start`,`marker-end`];function endPainter(e){let t=(e??``).replace(/[^a-zA-Z0-9_-]/g,``)||`tag`,n=[],clear=()=>{n.forEach(({path:e,property:t,before:n})=>{try{n?e.style?.setProperty(t,n):e.style?.removeProperty(t)}catch{}}),n=[];try{document.querySelectorAll(`marker[data-${t}]`).forEach(e=>e.remove())}catch{}},paint=(e,r,i)=>{try{if(!e||typeof e.getGraphics!=`function`)return;let a=e.getGraphics(r),o=a?.ownerSVGElement;if(!a||!o)return;a.querySelectorAll(`.djs-visual > path, .djs-visual > polyline`).forEach(e=>{Hs.forEach(r=>{try{let a=e.style;if(!a)return;let s=a.getPropertyValue(r),c=/url\(["']?#([^"')]+)["']?\)/.exec(s),l=c?o.querySelector(`marker[id="${CSS.escape(c[1])}"]`):null;if(!l)return;let u=l.cloneNode(!0);u.id=`${c[1]}-${t}`,u.setAttribute(`data-${t}`,``),u.querySelectorAll(`path, circle, polyline`).forEach(e=>{let t=e,n=t.style?.getPropertyValue(`fill`);t.style?.setProperty(`stroke`,i),n&&n!==`none`&&n!==`transparent`&&t.style?.setProperty(`fill`,i)}),l.parentNode?.appendChild(u),a.setProperty(r,`url("#${u.id}")`),n.push({path:e,property:r,before:s})}catch{}})})}catch{}};return{paint,clear}}var Us=`penstock-run`,Ws={COMPLETED:`penstock-run-completed`,ACTIVE:`penstock-run-active`,FAILED:`penstock-run-failed`,TERMINATED:`penstock-run-terminated`},Gs=`penstock-run-selected`,Ks=`penstock-run-flow`,qs=[...Object.values(Ws),Gs,Ks],Js=endPainter(`penstock-run`),Ys=[];function clearPath(e){if(e){try{let t=e.get(`canvas`);t&&Ys.forEach(e=>qs.forEach(n=>{try{t.removeMarker(e,n)}catch{}}))}catch{}Ys=[];try{Js.clear()}catch{}try{e.get(`overlays`)?.remove?.({type:Us})}catch{}}}function showPath(e,t,n){if(clearPath(e),e&&Array.isArray(t))try{let r=e.get(`elementRegistry`),i=e.get(`canvas`),a=e.get(`overlays`);if(!r||!i||!a)return;for(let e of t){if(!e?.elementId)continue;let t=null;try{t=r.get(e.elementId)}catch{}if(!t)continue;let n=Ws[e.state];if(n)try{i.addMarker(e.elementId,n),Ys.push(e.elementId)}catch{}if(e.mocked)try{let n=document.createElement(`span`);n.className=`penstock-run-badge`,n.textContent=`Mocked`,n.title=p(`app.runs.theScenarioAnsweredThisStep`),a.add(e.elementId,Us,{position:badgePosition(t),html:n})}catch{}}let o=[];try{let e=r.filter(e=>e&&(e.type===`bpmn:SequenceFlow`||e.type===`bpmn:MessageFlow`)&&e.source?.id&&e.target?.id)??[];for(let t of e)o.push({id:t.id,sourceId:t.source.id,targetId:t.target.id,message:t.type===`bpmn:MessageFlow`,joins:t.target.type===`bpmn:ParallelGateway`||t.target.type===`bpmn:InclusiveGateway`})}catch{}try{let e=t.filter(e=>{if(!e?.elementId)return!1;try{return!!r.get(e.elementId)}catch{return!1}});Ue(e,o).forEach(e=>{try{i.addMarker(e,Ks),Ys.push(e),Js.paint(i,e,`var(--theme-success)`)}catch{}})}catch{}if(n&&r.get(n))try{i.addMarker(n,Gs),Ys.push(n)}catch{}}catch{}}var Xs=`penstock-scenario-hover`,Zs=`penstock-review-open`,Qs=112,$s=32;function leftCover(e){let t=e?.get?.(`canvas`)?.getContainer?.();return!t||typeof t.getBoundingClientRect!=`function`?0:Bi(t.getBoundingClientRect(),zi(t).map(e=>e.getBoundingClientRect())).left}function viewOf(e){try{let t=e?.get?.(`canvas`)?.viewbox?.();if(t&&Number.isFinite(t.x)&&Number.isFinite(t.y)&&Number.isFinite(t.width)&&Number.isFinite(t.height))return{x:t.x,y:t.y,width:t.width,height:t.height}}catch{}return{x:0,y:0,width:800,height:600}}function boxOf(e,t){try{let n=e?.get?.(`elementRegistry`)?.get?.(t);return n&&Number.isFinite(n.x)&&Number.isFinite(n.y)&&Number.isFinite(n.width)&&Number.isFinite(n.height)?{x:n.x,y:n.y,width:n.width,height:n.height}:null}catch{return null}}function glide(e,t){try{let n=e?.get?.(`canvas`);if(!n)return;if(Ki()){n.viewbox?.(t);return}let r=viewOf(e),i=performance.now(),a=Math.max(1,Wi(`--motion-base`)),step=e=>{try{let o=Math.min(1,(e-i)/a),s=1-(1-o)**3;n.viewbox?.({x:r.x+(t.x-r.x)*s,y:r.y+(t.y-r.y)*s,width:r.width,height:r.height}),o<1&&requestAnimationFrame(step)}catch{}};requestAnimationFrame(step)}catch{}}function preview(e,t,n,r){try{let i=e?.get?.(`canvas`),a=e?.get?.(`elementRegistry`);if(!i||!a)return;if(n&&a.get?.(n))try{i.removeMarker?.(n,Xs)}catch{}if(!t||!a.get?.(t))return;try{i.addMarker?.(t,Xs)}catch{}let o=boxOf(e,t),s=viewOf(e),c=i.zoom?.()||1;o&&needsPan(s,o,1)&&glide(e,panTarget(s,o,{left:leftCover(e)/c,right:r/c}))}catch{}}function pin(e,t,n){try{let r=boxOf(e,t);if(!r)return;let i=e?.get?.(`canvas`);if(!i)return;let a=viewOf(e),o=i.zoom?.()||1,s={left:leftCover(e)/o,right:n/o};needsPan({x:a.x+s.left,y:a.y,width:Math.max(1,a.width-s.left-s.right),height:a.height},r,.6)&&glide(e,panTarget(a,r,s))}catch{}}function refit(e,t){try{let n=Number.isFinite(t)?t:0,r=e?.get?.(`canvas`);if(!r)return;r.resized?.();let i=e?.get?.(`elementRegistry`);if(!i)return;let a=i.filter?.(e=>e&&!e.waypoints&&e.parent)??[];if(a.length===0)return;let o=1/0,s=1/0,c=-1/0,l=-1/0;for(let e of a){let t=Number.isFinite(e?.x)?e.x:0,n=Number.isFinite(e?.y)?e.y:0,r=Number.isFinite(e?.width)?e.width:0,i=Number.isFinite(e?.height)?e.height:0;t<o&&(o=t),n<s&&(s=n),t+r>c&&(c=t+r),n+i>l&&(l=n+i)}if(!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(c)||!Number.isFinite(l))return;let u=r.viewbox?.()?.outer;if(!u||!(u.width>0)||!(u.height>0))return;let d=Math.max(Qs,leftCover(e))+$s,f=u.width-n-d-$s,p=c-o,m=l-s;if(!(p>0)||!(m>0))return;let h=Math.min(1,f/p,(u.height-64)/m);if(!(h>0))return;r.viewbox?.({x:o-d/h,y:(s+l)/2-u.height/(2*h),width:u.width/h,height:u.height/h})}catch{}}function markReviewOpen(e,t){try{e?.get?.(`canvas`)?.getContainer?.()?.classList?.toggle?.(Zs,t)}catch{}}var ec=`penstock-scenario`,tc=`penstock-scenario-on`,nc=`penstock-scenario-flow`,rc=`penstock-scenario-unreached`,ic=`penstock-scenario-diff`,ac=`penstock-scenario-selected`,oc=[tc,nc,rc,ic,ac],sc=endPainter(`penstock-scenario`),cc=[];function clearScenarioOverlay(e){if(e){try{let t=e.get(`canvas`);t&&cc.forEach(e=>oc.forEach(n=>{try{t.removeMarker(e,n)}catch{}}))}catch{}cc=[];try{sc.clear()}catch{}try{e.get(`overlays`)?.remove?.({type:ec})}catch{}}}function showScenarioOverlay(e,t){if(clearScenarioOverlay(e),e&&t)try{let n=e.get(`elementRegistry`),r=e.get(`canvas`),i=e.get(`overlays`);if(!n||!r||!i)return;let mark=(e,t)=>{try{return n.get(e)?(r.addMarker(e,t),cc.push(e),!0):!1}catch{return!1}};if((t.unreachedFlows??[]).forEach(e=>mark(e,rc)),(t.unreachedEnds??[]).forEach(e=>mark(e,rc)),t.path){for(let e of t.path.flowIds??[])try{mark(e,nc)&&sc.paint(r,e,`var(--theme-accent-primary)`)}catch{}for(let e of t.path.elementIds??[])try{let r=n.get(e);if(!r)continue;mark(e,tc);let a=document.createElement(`span`),o=t.path.numbers?.get(e);a.className=`penstock-scenario-badge${t.differences?.has(e)?` is-different`:``}`,a.textContent=re(o),a.title=p(`app.runs.stepBadge`,{number:re(o),name:t.names?.get(e)??e}),i.add(e,ec,{position:stepPosition(r),html:a})}catch{}}t.differences?.forEach((e,t)=>mark(t,ic)),t.selected&&mark(t.selected,ac)}catch{}}var lc=new Map;async function loadScenarioTargets(){try{let e=Y(),t=await e.getProjectFiles().catch(()=>null);return!t||!Array.isArray(t.files)?{tables:new Map,forms:new Map,duplicates:[]}:await Ke(t.files,t=>e.readFileIfPresent(t).catch(()=>null),lc)}catch{return{tables:new Map,forms:new Map,duplicates:[]}}}function setFlowCondition(e,t,n,r){try{let i=e?.get?.(`elementRegistry`)?.get?.(t);if(!i||!i.businessObject)return!1;let a=Xe(n,r);if(Ne(i.businessObject.conditionExpression?.body,a))return!1;let o=e.get?.(`moddle`),s=a&&o?o.create(`bpmn:FormalExpression`,{body:a}):void 0,c=e.get?.(`modeling`);return c?(c.updateProperties(i,{conditionExpression:s}),!0):!1}catch{return!1}}var uc={tables:new Map,forms:new Map,duplicates:[]},dc=120;function useScenarioReview({active:e,mode:t,runs:i,getModeler:a,feelByDefault:o}){let[c,u]=n(null),[d,m]=n(uc),[h,g]=n(null),[_,v]=n({}),[y,b]=n([]),[x,C]=n([]),[w,T]=n(null),[E,D]=n(!1),[O,k]=n(!0),A=s(0),j=e?a():null;f(()=>{t===`generate`&&(v({}),b([]),C([])),T(null)},[t]),f(()=>{if(e){try{loadScenarioTargets().then(m,()=>m(uc))}catch{m(uc)}try{Y().getLicense().then(e=>k(Qi(e)),()=>k(!1)).catch(()=>k(!1))}catch{k(!1)}}},[e]),f(()=>{if(!j)return;let e=0,t,read=()=>{let t=e+=1;try{let n=j.saveXML?.({format:!0});n&&typeof n.then==`function`&&n.then(async({xml:n})=>{try{let r=await jt(n);if(t!==e)return;u(r),g(r?null:p(`app.runs.unreadable`))}catch{t===e&&g(p(`app.runs.unreadable`))}}).catch(()=>t===e&&g(p(`app.runs.unreadable`)))}catch{t===e&&g(p(`app.runs.unreadable`))}},later=()=>{clearTimeout(t),t=setTimeout(read,dc)};read();try{j.on?.(`commandStack.changed`,later),j.on?.(`import.done`,later)}catch{}return()=>{e+=1,clearTimeout(t);try{j.off?.(`commandStack.changed`,later),j.off?.(`import.done`,later)}catch{}}},[j]);let M=l(()=>c?pt(c,d.tables):null,[c,d]),N=l(()=>M?Fe(M,{mode:t,existing:i.cases,edits:_,unticked:y,added:x}):{items:[],capped:!1},[M,t,i.cases,_,y,x]),P=N.items,F=P.find(e=>e.id===w)??P[0]??null,I=l(()=>M?ft(M.definitions,P):null,[M,P]),L=l(()=>M?lt(M.index):[],[M]),R=l(()=>M?[...new Set([...L,...H(M.definitions).uses.map(e=>e.name)])]:[],[M,L]),z=l(()=>M?wt(M.definitions).map(e=>({id:e,starts:S(M.definitions,e)})):[],[M]),B=l(()=>M&&F?.planned&&i.trace&&i.last===F.name?rt(M,F.planned.scenario,F.steps,i.trace):null,[M,F,i.trace,i.last]),V=r(e=>T(e),[]),U=r(e=>b(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),[]),ee=r((e,t)=>{v(n=>({...n,[e]:t(n[e]??{})}))},[]),te=r((e,t)=>{let n=t.trim();v(t=>({...t,[e]:{...t[e]??{},name:n===``?void 0:n}}))},[]),W=r(e=>{A.current+=1;let t=`${Date.now().toString(36)}${A.current}`;return C(n=>[...n,{...e,id:t}]),T(`added:${t}`),`added:${t}`},[]),G=r(e=>{C(t=>t.filter(t=>`added:${t.id}`!==e)),T(null)},[]),K=M?nt(M.index,o?`feel`:`juel`):`feel`,ne=r((e,t)=>M?ke(M.index,e,t,K):null,[M,K]),re=r((e,t)=>!j||!M?null:ke(M.index,e,t,K)||(setFlowCondition(j,e,t,K),null),[j,M,K]),ie=r(async()=>{let e=Re(P);if(e.length===0)return!1;D(!0);try{return await i.writeScenarios(e)}catch(e){let t=i.file?.split(/[\\/]/).pop()??p(`app.runs.theScenarioFile`);try{Y().notifyUser(p(`app.runs.unableToWrite`,{name:t,error:Tr(e)}),!0).catch?.(()=>{})}catch{}return!1}finally{D(!1)}},[P,i]),ae=l(()=>P.filter(e=>e.edited&&e.origin===`file`),[P]),oe=r(async()=>{if(ae.length!==0){D(!0);try{await i.replaceScenarios(ae.map(e=>e.testCase))&&v({})}catch(e){let t=i.file?.split(/[\\/]/).pop()??p(`app.runs.theScenarioFile`);try{Y().notifyUser(p(`app.runs.unableToWrite`,{name:t,error:Tr(e)}),!0).catch?.(()=>{})}catch{}}finally{D(!1)}}},[ae,i]),se=r(()=>{F&&(F.origin===`file`&&!F.edited?i.run([F.name]):i.runCase(F.testCase))},[F,i]),q=r(()=>{v({}),b([]),C([]),T(null)},[]);return{mode:t,ready:!!M,problem:h,items:P,capped:N.capped,selected:F,coverage:I,actual:B,context:M,targets:d,suggestions:L,conditionNames:R,conditionStyle:K,processes:z,licensed:O,ticked:P.filter(e=>e.ticked).length,dirty:ae,select:V,toggle:U,edit:ee,rename:te,add:W,remove:G,conditionProblem:ne,setCondition:re,creating:E,create:ie,save:oe,run:se,reset:q}}var fc=a(null);function useScenarios(){let e=i(fc);if(!e)throw Error(`the scenarios tab needs its provider`);return e}function ScenariosProvider({file:e,runs:t,getModeler:i,feelByDefault:a,enabled:o,sidebar:c,onOpenWorker:d,onNavigate:p,onRunWithInput:m,onOpenRun:h,children:g}){let[_,v]=n({active:!1,view:`root`,mode:`file`}),[y,b]=n(null),[x,S]=n(!1),[C,w]=n(null),[T,E]=n(null),[D,O]=n(null),[k,A]=n(null),[j,M]=n(null),N=s(null),P=useScenarioReview({active:_.active||_.view!==`root`,mode:_.mode,runs:t,getModeler:i,feelByDefault:a}),F=_.active&&c.visible?i():null,I=P.selected,L=_.view!==`root`,R=r((e,t,n)=>{v(r=>r.active===e&&r.view===t&&r.mode===n?r:{active:e,view:t,mode:n})},[]);f(()=>{b(null),S(!1)},[I?.id]);let z=l(()=>I&&y?stepsFor(I.steps,y)[0]??-1:-1,[I,y]),B=l(()=>L?_.view===`add`&&j?Je(j.scenario):I&&!I.unplannable?I.path:null:null,[L,_.view,j,I]),V=l(()=>new Map((I?.steps??[]).map(e=>[e.elementId,e.name])),[I]);f(()=>{if(F)return showScenarioOverlay(F,{path:B,unreachedFlows:L?P.coverage?.unreachedFlows??[]:[],unreachedEnds:L?P.coverage?.unreachedEnds??[]:[],differences:P.actual?.byElement??null,selected:y,names:V}),()=>clearScenarioOverlay(F)},[F,B,L,P.coverage,P.actual,y,V]),f(()=>{let e=i();if(e)return markReviewOpen(e,!!F&&L),()=>markReviewOpen(e,!1)},[F,L]),f(()=>{if(!F||!L)return;let e,fit=()=>{clearTimeout(e),e=setTimeout(()=>refit(F,c.covered),100)};fit(),window.addEventListener(`resize`,fit);let t=F.get(`canvas`).getContainer(),n=new ResizeObserver(fit);return t&&n.observe(t),()=>{clearTimeout(e),n.disconnect(),window.removeEventListener(`resize`,fit)}},[F,L,c.covered,c.width,P.ready]),f(()=>{if(!F||!I)return;let onSelect=({newSelection:e})=>{let t=e[0];t&&L&&(stepsFor(I.steps,t.id).length===0?S(!0):(S(!1),b(t.id),requestAnimationFrame(()=>document.querySelector(`.penstock-review__step[data-element="${CSS.escape(t.id)}"]`)?.scrollIntoView({block:`nearest`}))))};return F.on(`selection.changed`,onSelect),()=>F.off(`selection.changed`,onSelect)},[F,I,L]);let H=r(e=>{b(e.elementId),S(!1);let t=i();t?.get(`elementRegistry`).get(e.elementId)&&(pin(t,e.elementId,c.covered),t.get(`selection`).select(t.get(`elementRegistry`).get(e.elementId)))},[i,c.covered]),U=r(e=>{let t=i();t&&(preview(t,e?.elementId??null,N.current,c.covered),N.current=e?.elementId??null)},[i,c.covered]);f(()=>()=>{let e=i();e&&N.current&&preview(e,null,N.current,0)},[i]);let ee=r(e=>{if(!I)return;let t=I.steps[moveStep(z,I.steps.length,e)];t&&H(t)},[I,z,H]),te=l(()=>({file:e,runs:t,review:P,enabled:o,view:_.view,setPresence:R,focus:y,stepAt:z,pinStep:H,hoverStep:U,stepBy:ee,offPath:x,ruleStep:C,showRule:w,formStep:T,showForm:E,timerStep:D,showTimer:O,mockWorkerStep:k,showMockWorker:A,preview:M,onOpenWorker:d,onNavigate:p,onRunWithInput:m,onOpenRun:h}),[e,t,P,o,_.view,R,y,z,H,U,ee,x,C,T,D,k,d,p,m,h]);return u(fc.Provider,{value:te,children:g})}var pc=160,mc=280,hc=60;function nameOf$7(e,t){try{return e?.get?.(`elementRegistry`)?.get?.(t)?.businessObject?.name?.trim()||t}catch{return t}}e(nameOf$7,`nameOf`);function shown$3(e){try{let t=JSON.stringify(e)??String(e);return t.length>hc?`${t.slice(0,59)}…`:t}catch{return String(e)}}e(shown$3,`shown`);function valueTitle(e,t){try{return`${JSON.stringify(e,null,2)}\n\n${p(`app.runs.source.${t}`)}`}catch{return`${String(e)}\n\n${p(`app.runs.source.${t}`)}`}}function Values({values:e,changed:t,plain:n}){return!Array.isArray(e)||e.length===0?u(`span`,{class:`penstock-runs__none`,children:`–`}):u(`ul`,{class:`penstock-runs__values`,children:e.map(e=>u(`li`,{title:valueTitle(e.value,e.source),children:[u(`span`,{class:`penstock-runs__name`,children:e.name}),t&&`before`in e&&u(`span`,{class:`penstock-runs__before`,children:[shown$3(e.before),` → `]}),u(`span`,{class:`penstock-runs__value`,children:shown$3(e.value)}),!n&&e.source!==`history`&&u(`span`,{class:`penstock-runs__tag`,children:e.source})]},e.name))})}function WaitingCard({wait:e,modeler:t,onAnswer:r,onStop:i}){let[a,s]=n(`{}`),[c,l]=n(``),[d,m]=n(null);f(()=>{s(`{}`),l(``),m(null)},[e]);let variables=()=>{try{let e=JSON.parse(a||`{}`);if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`an object`);return m(null),e}catch{return m(p(`app.runs.variablesAreAJsonObject`)),null}},answer=e=>{let t=variables();if(t){if(e===`error`){if(!c.trim()){m(p(`app.runs.errorNeedsItsCode`));return}r({kind:e,errorCode:c.trim(),variables:t})}else r({kind:e,variables:t})}},h=nameOf$7(t,e.elementId),g=e.kind===`job`?p(`app.runs.theJob`,{job:e.jobType}):e.kind===`userTask`?p(`app.runs.theUserTask`):e.kind===`message`?p(`app.runs.theMessage`,{message:e.name}):p(`app.runs.theSignal`,{signal:e.name});return u(`div`,{class:`penstock-runs__waiting`,role:`group`,"aria-label":p(`app.runs.theRunWaits`),children:[u(`div`,{class:`penstock-runs__waiting-title`,children:p(`app.runs.waitingAtFor`,{where:h,what:g})}),e.kind===`job`&&Object.keys(e.variables).length>0&&u(`div`,{class:`penstock-runs__waiting-received`,children:[u(`span`,{class:`penstock-runs__label`,children:p(`app.runs.received`)}),u(Values,{plain:!0,values:Object.entries(e.variables).map(([e,t])=>({name:e,value:t,source:`mock`}))})]}),u(`label`,{class:`penstock-runs__label`,for:`penstock-runs-variables`,children:p(`app.runs.variablesToSend`)}),u(`textarea`,{id:`penstock-runs-variables`,class:`penstock-runs__json`,rows:2,value:a,onInput:e=>s(e.target.value)}),d&&u(`p`,{class:`error-message`,children:d}),u(`div`,{class:`penstock-runs__actions`,children:[e.kind===`message`?u(`button`,{type:`button`,class:`ui-button ui-button--primary`,onClick:()=>answer(`correlate`),children:p(`app.runs.correlate`)}):u(`button`,{type:`button`,class:`ui-button ui-button--primary`,onClick:()=>answer(`complete`),children:p(e.kind===`signal`?`app.runs.broadcast`:`app.runs.complete`)}),e.kind===`job`&&u(o,{children:[u(`button`,{type:`button`,class:`ui-button`,onClick:()=>answer(`error`),children:p(`app.runs.throwError`)}),u(`input`,{class:`penstock-runs__code penstock-runs__code--inline`,placeholder:p(`app.runs.withErrorCode`),value:c,onInput:e=>l(e.target.value),"aria-label":p(`app.runs.errorCode`)})]}),u(`span`,{class:`penstock-runs__spacer`}),u(`button`,{type:`button`,class:`ui-button`,onClick:i,children:p(`app.runs.stop`)})]})]})}function stateWord(e){return p(`app.runs.state.${e.toLowerCase()}`)}function RunsPanel({isOpen:e,runs:t,getModeler:r,onClose:i,onRunWithInput:a,onOpenRun:c,onSaveAdHoc:l}){let d=useScenarios().view!==`root`,m=e?r():null,[h,g]=n(mc),_=s(null),v=t.trace?t.trace.steps.map(e=>({elementId:e.elementId,state:e.state,mocked:e.mocked,startedAt:e.startedAt,endedAt:e.endedAt})):t.steps;if(f(()=>{if(m)return showPath(m,v,t.selected),()=>clearPath(m)},[m,t.trace,t.steps,t.selected]),f(()=>{(r()?.get(`canvas`))?.resized()},[e,h]),!e)return null;let beginResize=e=>{_.current={start:e.clientY,height:h};let move=e=>{if(!_.current)return;let t=Math.max(pc,window.innerHeight-200);g(Math.min(t,Math.max(pc,_.current.height+_.current.start-e.clientY)))},end=()=>{_.current=null,window.removeEventListener(`pointermove`,move),window.removeEventListener(`pointerup`,end)};window.addEventListener(`pointermove`,move),window.addEventListener(`pointerup`,end)},selectStep=e=>{t.select(e);try{let t=m?.get?.(`elementRegistry`)?.get?.(e);if(!t)return;m.get(`canvas`)?.scrollToElement?.(t,{top:140,right:440,bottom:400,left:140}),m.get(`selection`)?.select?.(t)}catch{}},onKey=e=>t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),selectStep(e))},y=t.file?.split(/[\\/]/).pop()??null,b=t.target?t.target.profile??t.target.url??p(`app.live.theEngine`):null,x=t.trace?.steps??null,S=t.last&&!t.running?t.results.get(t.last)??null:null,C=t.adHoc&&!t.running&&t.adHoc.trace&&S?.outcome!==`skipped`;return u(`section`,{class:`penstock-runs`,style:{height:`${h}px`},"aria-label":p(`app.runs.runOutput`),children:[u(`div`,{class:`penstock-runs__resize`,onPointerDown:beginResize,role:`separator`,"aria-orientation":`horizontal`,"aria-label":p(`app.runs.resizeTheRunsPanel`)}),u(`header`,{class:`penstock-runs__bar`,children:[u(`span`,{class:`penstock-runs__title`,children:p(`app.runs.runOutput`)}),u(`span`,{class:`penstock-runs__where`,children:[[y,b].filter(Boolean).join(` · `),d?`${y||b?` · `:``}${p(`app.runs.aScenarioIsOpen`)}`:``]}),u(`span`,{class:`penstock-runs__controls`,children:[t.running?u(`button`,{type:`button`,class:`ui-button`,onClick:t.stop,children:p(`app.runs.stop`)}):u(o,{children:[u(`button`,{type:`button`,class:`ui-button`,onClick:()=>t.run(),disabled:t.cases.length===0||!t.target,children:p(`app.runs.runAll`)}),a&&u(`button`,{type:`button`,class:`ui-button`,onClick:a,children:p(`app.runs.runWithInputMore`)}),c&&u(`button`,{type:`button`,class:`ui-button`,onClick:c,children:p(`app.runs.openRunMore`)}),C&&l&&u(`button`,{type:`button`,class:`ui-button`,onClick:l,children:p(`app.runs.saveAsScenarioMore`)})]}),u(`button`,{type:`button`,class:`ui-button`,onClick:i,children:p(`app.runs.close`)})]})]}),u(`div`,{class:`penstock-runs__body`,children:u(`div`,{class:`penstock-runs__detail`,children:[!t.target&&u(`p`,{class:`penstock-runs__note`,children:p(`app.runs.runAllIsOff`,{reason:t.notice??p(`app.runs.noEngineToRunOn`)})}),t.cases.length===0&&t.target&&u(`p`,{class:`penstock-runs__note`,children:p(`app.runs.noScenariosToRunYet`)}),t.notice&&u(`p`,{class:`penstock-runs__note`,children:t.notice}),S&&u(`p`,{class:`penstock-runs__outcome penstock-runs__outcome--${S.outcome}`,children:[t.last,`: `,S.outcome,S.message?` - ${S.message}`:``]}),t.waiting&&u(WaitingCard,{wait:t.waiting,modeler:m,onAnswer:t.answer,onStop:t.stop}),t.running&&!x&&u(`ul`,{class:`penstock-runs__list`,children:t.steps.map(e=>u(`li`,{children:u(`button`,{type:`button`,class:`penstock-runs__row`,onClick:()=>selectStep(e.elementId),children:[u(`span`,{class:`penstock-runs__step`,children:nameOf$7(m,e.elementId)}),u(`span`,{class:`penstock-runs__state`,children:stateWord(e.state)}),e.mocked&&u(`span`,{class:`penstock-runs__tag penstock-runs__tag--mocked`,children:p(`app.runs.mocked`)})]})},e.elementId))}),x&&u(`table`,{class:`penstock-runs__table`,children:[u(`thead`,{children:u(`tr`,{children:[u(`th`,{children:p(`app.runs.step`)}),u(`th`,{children:p(`app.runs.stateColumn`)}),u(`th`,{children:p(`app.runs.in`)}),u(`th`,{children:p(`app.runs.out`)}),u(`th`,{children:p(`app.runs.changed`)})]})}),u(`tbody`,{children:x.map(e=>u(`tr`,{class:t.selected===e.elementId?`penstock-runs__selected`:void 0,tabIndex:0,"aria-selected":t.selected===e.elementId,onClick:()=>selectStep(e.elementId),onKeyDown:onKey(e.elementId),children:[u(`td`,{children:[u(`span`,{class:`penstock-runs__step`,children:nameOf$7(m,e.elementId)}),e.mocked&&u(`span`,{class:`penstock-runs__tag penstock-runs__tag--mocked`,title:p(`app.runs.theScenarioAnsweredThisStep`),children:p(`app.runs.mocked`)})]}),u(`td`,{class:`penstock-runs__state penstock-runs__state--${e.state.toLowerCase()}`,children:stateWord(e.state)}),u(`td`,{children:u(Values,{values:e.in})}),u(`td`,{children:u(Values,{values:e.out})}),u(`td`,{children:u(Values,{values:e.changed,changed:!0})})]},`${e.elementId}:${e.startedAt}`))})]}),t.log.length>0&&u(`div`,{class:`penstock-runs__log`,children:[u(`h3`,{class:`penstock-runs__heading`,children:p(`app.runs.log`)}),t.log.map((e,t)=>u(`p`,{class:e.error?`penstock-runs__line penstock-runs__line--error`:`penstock-runs__line`,children:e.text},`${t}:${e.text}`))]}),t.kept&&u(`p`,{class:`penstock-runs__note`,children:p(`app.runs.theTraceIsKeptIn`,{path:A(t.kept)})})]})})]})}function indexOf$2(e,t,n){let r=0;return e.testCases.findIndex(e=>e?.name===t&&(r+=1,r===n))}e(indexOf$2,`indexOf`);function nameProblem(e,t,n){let r=n.trim();return r===``?p(`app.testCases.edit.nameEmpty`):r!==t&&e.testCases.some(e=>e?.name===r)?p(`app.testCases.edit.nameTaken`,{name:r}):null}function renameTestCase(e,t,n,r){let i=indexOf$2(e,t,n);if(i<0)return{problem:p(`app.testCases.edit.notFound`,{name:t})};let a=r.trim(),o=nameProblem(e,t,a);return o?{problem:o}:a===t?{file:e}:{file:{...e,testCases:e.testCases.map((e,t)=>t===i?{...e,name:a}:e)}}}function copyNameOf(e,t){let n=new Set(e.testCases.map(e=>e?.name)),r=p(`app.testCases.edit.copyName`,{name:t});for(let e=2;n.has(r);e+=1)r=p(`app.testCases.edit.copyNumbered`,{name:t,number:e});return r}function duplicateTestCase(e,t,n){let r=indexOf$2(e,t,n);if(r<0)return{problem:p(`app.testCases.edit.notFound`,{name:t})};let i=copyNameOf(e,t),a={...e.testCases[r],name:i},o=[...e.testCases.slice(0,r+1),a,...e.testCases.slice(r+1)];return{file:{...e,testCases:o},name:i}}function deleteTestCase(e,t,n){let r=indexOf$2(e,t,n);return r<0?{problem:p(`app.testCases.edit.notFound`,{name:t})}:{file:{...e,testCases:e.testCases.filter((e,t)=>t!==r)}}}function useRuns(e,t,i,a=!0){let[o,c]=n(null),[l,u]=n([]),[d,m]=n([]),[h,g]=n(null),[_,v]=n(null),[y,b]=n(new Map),[x,S]=n(null),[C,w]=n(null),[T,E]=n(null),[O,k]=n([]),[A,j]=n([]),[M,N]=n(null),[P,F]=n(null),[I,L]=n(null),[R,z]=n(null),B=s(null),H=s({run:``,session:D()}),U=s(null),ee=s(!1),te=s(i);te.current=i;let W=s(!0),G=s(null);f(()=>(W.current=!0,()=>{W.current=!1,B.current?.abort(),B.current=null}),[]);let K=r(()=>{t&&te.current().then(e=>Dr(t,e)).then(({file:e,parsed:t})=>{W.current&&(c(e),u(t.file?.testCases??[]),m(t.problems))}).catch(e=>{W.current&&m([Tr(e)])})},[t]),ne=r(()=>{if(!t)return;K();let showTargetNotice=e=>{G.current=e,v(e)};Sr(t).then(e=>{if(W.current){if(g(e),e){let e=G.current;G.current=null,e!==null&&v(t=>t===e?null:t)}else return kr(t).then(e=>{W.current&&showTargetNotice(e)})}}).catch(e=>{W.current&&showTargetNotice(Tr(e))})},[t]);f(()=>{e&&a&&ne()},[e,a,ne]);let re=r(e=>{e.kind===`step`&&k(t=>{let n=t.filter(t=>t.elementId!==e.elementId);return n.push({elementId:e.elementId,state:e.state,mocked:e.mocked}),n}),e.kind===`log`&&j(t=>[...t,{at:new Date().toISOString(),text:e.text,...e.error?{error:!0}:{}}])},[]),ie=r(async(e,n,r,i)=>{let a=await te.current();if(!t||!a)return!1;let o=await yr(t,a),s=new AbortController;B.current=s,S(e.name),w(e.name),n||z(null),E(null),k([]),j([]),L(null),F(null),H.current.run!==r&&(H.current={run:r,session:D()});let{result:c,kept:l}=await ae(e,{engine:Cr(i,t),resources:o,runId:r,builds:Or(i),key:br(i),session:H.current.session,signal:s.signal,emit:re,note:e=>j(t=>[...t,{at:new Date().toISOString(),text:e}]),keep:Er,onWait:n?e=>new Promise(t=>{U.current=t,N(e)}):void 0});return W.current?(U.current=null,N(null),E(c.trace),b(t=>new Map(t).set(e.name,{outcome:c.outcome,...c.message?{message:c.message}:{}})),L(l),n&&z({testCase:e,recorded:c.recorded,trace:c.trace}),!s.signal.aborted):!1},[t,re]),oe=r(async()=>{let e=await Sr(t);if(!W.current)return null;if(g(e),!e){let e=await kr(t);return W.current&&v(e),null}if(!await vr())return null;let n=await xr(e);return W.current&&v(n),n?null:e},[t]),se=r((e,t)=>{ee.current||e.length===0||(ee.current=!0,(async()=>{try{let n=await oe();if(!n||!W.current)return;let r=Ce(new Date);for(let i of e)if(!W.current||!await ie(i,t,r,n))break}catch(e){W.current&&v(Tr(e))}finally{W.current&&S(null),B.current=null,ee.current=!1}})())},[oe,ie]),q=r(e=>{se(e?l.filter(t=>e.includes(t.name)):l,e?.length===1)},[l,se]),ce=r(e=>se([e],!0),[se]),le=r(()=>{B.current?.abort(),U.current?.({kind:`stop`})},[]);f(()=>(window.addEventListener(`pagehide`,le),()=>window.removeEventListener(`pagehide`,le)),[le]),f(()=>{e||le()},[e,le]);let ue=r(e=>{let t=U.current;U.current=null,N(null),t?.(e)},[]),de=r(async e=>{try{let n=await Sr(t);if(!W.current)return;if(g(n),!n){let e=await kr(t);W.current&&v(e);return}let r=Y(),i=await V(n.engine,e=>r.askEngine(n.profile,e,t??void 0),e,{runId:`existing`});if(!W.current)return;E(i),w(null),z(null),k([]),j(i.log),L(null),F(null),v(null)}catch(e){W.current&&v(Tr(e))}},[t]),fe=r(async e=>{try{let t=await Y().readFile(e);if(!W.current)return;let n=JSON.parse(t);E(n),k([]),j(n.log),L(e),F(null),v(null)}catch(e){W.current&&v(Tr(e))}},[]),pe=r(async e=>{if(!o)return!1;let t=Y(),n=o.split(/[\\/]/).pop()??o,r=Qe(await wr(o),[e]);if(`problem`in r)throw Error(`${n}: ${r.problem}`);if(r.kept.length>0)throw Error(p(`app.runs.nameTaken`,{name:n,scenario:e.name}));return await t.saveFile(o,De(r.file)),K(),!0},[o,K]),me=r(async e=>{if(!o)return!1;try{let t=Y(),n=Qe(await wr(o),e);if(`problem`in n)return W.current&&v(`${o.split(/[\\/]/).pop()}: ${n.problem}`),!1;n.added.length>0&&await t.saveFile(o,De(n.file));let r=e.filter(e=>n.added.includes(e.name)&&e.description?.startsWith(p(`app.runs.toFillIn`))).length;return W.current&&v([p(`app.runs.notice.added`,{count:n.added.length}),r?p(`app.runs.notice.toFillIn`,{count:r}):null,n.kept.length?p(`app.runs.notice.kept`,{count:n.kept.length}):null].filter(Boolean).join(`, `)),K(),!0}catch(e){return W.current&&v(Tr(e)),!1}},[o,K]),he=r(async e=>{if(!o||e.length===0)return!1;try{if(!await vr())return!1;let t=Y(),n=We(await wr(o)??``);if(!n.file)return W.current&&v(p(`app.runs.notice.leftAsIs`,{file:o.split(/[\\/]/).pop()??o,problems:n.problems.join(`; `)})),!1;let r=n.file;for(let t of e)r=xt(r,t);return await t.saveFile(o,De(r)),W.current&&v(p(`app.runs.notice.saved`,{count:e.length})),K(),!0}catch(e){return W.current&&v(Tr(e)),!1}},[o,K]),ge=r(async()=>vr(),[]),_e=r(async e=>{if(!o||!await vr())return null;let t=o.split(/[\\/]/).pop()??o,n=We(await wr(o)??``);if(!n.file)return W.current&&v(p(`app.runs.notice.leftAsIs`,{file:t,problems:n.problems.join(`; `)})),null;let r=e(n.file);return`problem`in r||r.file!==n.file&&(await Y().saveFile(o,De(r.file)),K()),r},[o,K]);return{file:o,cases:l,problems:d,target:h,notice:_,results:y,running:x,last:C,trace:T,steps:O,log:A,waiting:M,selected:P,kept:I,adHoc:R,writeScenarios:me,replaceScenarios:he,renameScenario:r(async(e,t,n)=>{let r=await _e(r=>renameTestCase(r,e,t,n));if(!r)return null;if(`problem`in r)return r;let i=n.trim();return W.current&&i!==e&&v(p(`app.runs.notice.renamedTo`,{name:i})),{name:i}},[_e]),duplicateScenario:r(async(e,t)=>{let n=await _e(n=>duplicateTestCase(n,e,t));return n?`problem`in n?n:(W.current&&v(p(`app.runs.notice.duplicated`,{name:n.name})),{name:n.name}):null},[_e]),deleteScenario:r(async(e,t)=>{let n=await _e(n=>deleteTestCase(n,e,t));return n?`problem`in n?n:(W.current&&v(p(`app.runs.notice.deleted`,{name:e})),{name:e}):null},[_e]),run:q,runCase:e=>se([e],!0),runAdHoc:ce,stop:le,answer:ue,openInstance:de,openTrace:fe,select:F,save:pe,generate:ge,reload:ne}}function runDialogSize(e){return Number.isFinite(e)&&e>0?`medium`:`small`}function objectOf$2(e){if(typeof e!=`string`)return null;try{let t=JSON.parse(e.trim()||`{}`);return typeof t==`object`&&t&&!Array.isArray(t)?t:null}catch{return null}}e(objectOf$2,`objectOf`);function runInputErrors(e){let t={};if(!e||typeof e!=`object`)return t.process=p(`app.runs.theDiagramHasNoExecutable`),t;objectOf$2(e.start)||(t.start=p(`app.runs.theStartVariablesShouldBe`));let n=Array.isArray(e.waiting)?e.waiting:[],r=e.rows&&typeof e.rows==`object`?e.rows:{};for(let e of n){if(!e||typeof e!=`object`||!e.id)continue;let n=r[e.id];n&&((n.kind===`complete`||n.kind===`error`||n.kind===`fail`)&&!objectOf$2(n.variables)?t[`step:${e.id}`]=p(`app.runs.theVariablesSendsShouldBe`,{name:e.name}):n.kind===`error`&&!(typeof n.errorCode==`string`&&n.errorCode.trim())?t[`step:${e.id}`]=p(`app.runs.enterTheErrorCodeShould`,{name:e.name}):n.kind===`fail`&&(!Number.isInteger(Number(n.times))||Number(n.times)<1)&&(t[`step:${e.id}`]=p(`app.runs.shouldFailAWholeNumberOfTimes`,{name:e.name})))}return e.processId||(t.process=p(`app.runs.theDiagramHasNoExecutable`)),t}var gc=[`ask`,`complete`,`error`,`fail`,`real`],_c=[`fire`,`real`];function startVariables(e){let t={};for(let n of e){let e=n.split(`.`),r=t;e.slice(0,-1).forEach(e=>{(typeof r[e]!=`object`||r[e]===null)&&(r[e]={}),r=r[e]}),e[e.length-1]in r||(r[e[e.length-1]]=null)}return t}function time(){return new Date().toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`})}function RunDialog({diagramPath:e,xml:t,onClose:r,onRun:i}){let[a,o]=n([]),[s,c]=n(``),[l,d]=n(new Map),[m,h]=n([]),[g,_]=n({}),[v,y]=n(`{}`),x=_i();f(()=>{let n=!1;return(async()=>{let r=await t();if(!r||n)return;let i=await jt(r),a=te(i),s=await b(e,r),l=s.processes.filter(e=>e.executable).map(e=>e.id),u=[...new Set(s.variables.filter(e=>!e.writes).map(e=>e.name))].sort();if(n)return;d(a),o(l),c(l[0]??``);let f=M(a);h(f),_(Object.fromEntries(f.map(e=>[e.id,{kind:e.kind===`timer`?`fire`:`ask`,variables:`{}`,errorCode:``,times:`1`}]))),y(JSON.stringify(startVariables(u),null,2))})(),()=>{n=!0}},[e,t]);let change=(e,t)=>_(n=>({...n,[e]:{...n[e],...t}})),S=runInputErrors({processId:s,start:v,rows:g,waiting:m}),submit=()=>{if(x.submit(),Object.keys(S).length>0){requestAnimationFrame(()=>document.querySelector(`.ui-dialog [aria-invalid="true"]`)?.focus());return}let e=objectOf$2(v),t=new Map;for(let e of m){let n=g[e.id];if(!n)continue;let r=objectOf$2(n.variables),i=Number(n.times);n.kind===`complete`?t.set(e.id,{kind:`complete`,variables:r}):n.kind===`error`?t.set(e.id,{kind:`error`,errorCode:n.errorCode.trim(),variables:r}):n.kind===`fail`?t.set(e.id,{kind:`fail`,times:i,variables:r}):t.set(e.id,{kind:n.kind})}i(ne(s,e,t,l,p(`app.runs.adHocRun`,{time:time()})))},C=m.map(e=>S[`step:${e.id}`]).filter(e=>!!e);return u(mi,{title:p(`app.runs.runWithInput`),size:runDialogSize(m.length),onClose:r,footer:u(vi,{actions:[{id:`cancel`,label:p(`app.common.cancel`),role:`cancel`,onClick:r},{id:`run`,label:p(`app.runs.run`),role:`primary`,onClick:submit}]}),children:[a.length>1&&u(Q,{label:p(`app.runs.process`),children:e=>u(`select`,{...e,value:s,onChange:e=>c(e.target.value),children:a.map(e=>u(`option`,{value:e,children:e},e))})}),x.submitted&&S.process&&u(yi,{children:S.process}),u(Q,{label:p(`app.runs.startVariables`),error:x.errorOf(`start`,S.start??null),children:e=>u(`textarea`,{...e,rows:6,value:v,onInput:e=>y(e.target.value),onBlur:()=>x.touch(`start`)})}),m.length>0&&u(Q,{label:p(`app.runs.steps`),group:`group`,hint:p(`app.runs.userTasksAndMessagesAsk`),children:e=>u(`div`,{...e,class:`penstock-run-dialog__steps`,children:[m.map(e=>{let t=g[e.id];if(!t)return null;let n=e.kind===`timer`?_c:gc,r=e.kind===`timer`?`timer`:`job`,i=t.kind===`complete`||t.kind===`error`||t.kind===`fail`,a=x.submitted&&!!S[`step:${e.id}`];return u(`div`,{class:`penstock-run-dialog__step`,children:[u(`span`,{class:`penstock-run-dialog__name`,title:e.jobType??e.id,children:e.name}),u(`select`,{class:`ui-input`,value:t.kind,"aria-label":p(`app.runs.whatDoes`,{name:e.name}),onChange:t=>change(e.id,{kind:t.target.value}),children:n.map(e=>u(`option`,{value:e,children:p(`app.runs.choice.${r}.${e}`)},e))}),t.kind===`error`&&u(`input`,{class:`ui-input`,placeholder:p(`app.runs.errorCode`),"aria-label":p(`app.runs.errorCode`),"aria-invalid":a||void 0,value:t.errorCode,onInput:t=>change(e.id,{errorCode:t.target.value})}),t.kind===`fail`&&u(`input`,{class:`ui-input penstock-run-dialog__times`,type:`number`,min:1,value:t.times,"aria-invalid":a||void 0,onInput:t=>change(e.id,{times:t.target.value}),"aria-label":p(`app.runs.timesToFail`)}),i&&u(`input`,{class:`ui-input`,placeholder:$r(`{"approved": true}`),value:t.variables,"aria-invalid":a||void 0,onInput:t=>change(e.id,{variables:t.target.value}),"aria-label":p(`app.runs.variablesSends`,{name:e.name})})]},e.id)}),x.submitted&&C.map(e=>u(yi,{children:e},e))]})})]})}function shown$2(e){let t=JSON.stringify(e)??String(e);return t.length>40?`${t.slice(0,39)}…`:t}e(shown$2,`shown`);function SaveRunDialog({run:e,file:t,onClose:r,onSave:i}){let a=e.trace?z(e.trace):[],[o,s]=n(e.testCase.name),[c,l]=n(new Set(a.map(e=>e.name))),[d,f]=n(!1),[m,h]=n(null),g=_i(),toggle=e=>l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),_=o.trim()?null:p(`app.runs.enterANameForThe`),save=async()=>{if(g.submit(),_)requestAnimationFrame(()=>document.querySelector(`.ui-dialog [aria-invalid="true"]`)?.focus());else{f(!0),h(null);try{let t=a.map(e=>e.name).filter(e=>c.has(e));await i(q(e,o.trim(),t,new Date))?r():h(p(`app.runs.unableToSaveTheScenario`))}catch(e){h(e instanceof Error?e.message:String(e))}finally{f(!1)}}};return u(mi,{title:p(`app.runs.saveAsScenario`),size:`medium`,onClose:r,onSubmit:()=>void save(),footer:u(vi,{actions:[{id:`cancel`,label:p(`app.common.cancel`),role:`cancel`,onClick:r,disabled:d},{id:`save`,label:p(`app.common.save`),role:`primary`,onClick:()=>void save(),busy:d}]}),children:[u(Q,{label:p(`app.runs.name`),hint:t?p(`app.runs.theScenarioStartsTheProcessInto`,{file:t.split(/[\\/]/).pop()}):p(`app.runs.theScenarioStartsTheProcess`),error:g.errorOf(`name`,_),children:e=>u(`input`,{...e,value:o,onInput:e=>s(e.target.value),onBlur:()=>g.touch(`name`)})}),a.length>0&&u(Q,{label:p(`app.runs.checkAtTheEnd`),group:`group`,children:e=>u(`div`,{...e,class:`ui-choice-group`,children:a.map(e=>u(`label`,{class:`ui-choice`,children:[u(`input`,{type:`checkbox`,checked:c.has(e.name),onChange:()=>toggle(e.name)}),u(`span`,{children:[e.name,` = `,shown$2(e.value)]})]},e.name))})}),m&&u(yi,{children:m})]})}function OpenRunDialog({onClose:e,onOpen:t}){let[r,i]=n(``),[a,o]=n(!1),[s,c]=n(null),[l,d]=n(!1),f=r.trim()?null:p(`app.runs.enterTheKeyOrId`),m=ti({fields:1,missingRequired:+!!f}),open=async()=>{if(d(!0),c(null),f)requestAnimationFrame(()=>document.querySelector(`.ui-dialog [aria-invalid="true"]`)?.focus());else{o(!0);try{await t(r.trim()),e()}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}};return u(mi,{title:p(`app.runs.openRun`),size:`small`,backdrop:`close`,onClose:e,onSubmit:()=>void open(),footer:u(vi,{actions:[{id:`cancel`,label:p(`app.common.cancel`),role:`cancel`,onClick:e,disabled:a},{id:`open`,label:p(`app.common.open`),role:`primary`,onClick:()=>void open(),busy:a,disabled:m}]}),children:u(Q,{label:p(`app.runs.processInstance`),hint:p(`app.runs.theKeyOfACamunda`),error:s??(l?f:null),children:e=>u(`input`,{...e,value:r,placeholder:$r(`2251799813685249`),onInput:e=>i(e.target.value)})})})}function caseTitle(e,t){return t&&t!==e?`${e}\n${t}`:e}var draftOf=e=>e.map(e=>({name:e.name,text:qe(e.value)}));function ValueRows({slot:e,suggestions:t=[],readOnly:r=!1,onUnlock:i,onChange:a}){let[o,c]=n(()=>draftOf(e.rows)),l=s(null),d=JSON.stringify(e.rows);f(()=>{let t=d===l.current;l.current=null,t||c(draftOf(e.rows))},[d]);let commit=e=>{c(e);let t=e.filter(e=>e.name.trim()!==``).map(e=>({name:e.name.trim(),value:G(e.text)}));l.current=JSON.stringify(t),a(t)},change=(e,t)=>c(n=>n.map((n,r)=>r===e?{...n,...t}:n)),m=t.filter(e=>!o.some(t=>t.name===e)),h=`penstock-suggest-${e.role}-${e.elementId}`;return u(`div`,{class:`penstock-review__values`,children:[u(`span`,{class:`penstock-review__label`,children:e.title}),o.length===0&&u(`p`,{class:`penstock-review__hint`,children:e.empty}),o.map((e,t)=>u(`div`,{class:`penstock-review__row`,children:[u(`input`,{class:`penstock-review__input penstock-review__input--name`,"aria-label":p(`app.runs.variableName`),list:h,value:e.name,readOnly:r,onInput:e=>change(t,{name:e.target.value}),onBlur:()=>commit(o),onKeyDown:e=>e.key===`Enter`&&commit(o)}),u(`input`,{class:`penstock-review__input penstock-review__input--value`,"aria-label":p(`app.runs.valueOf`,{name:e.name||p(`app.runs.theVariable`)}),value:e.text,readOnly:r,onInput:e=>change(t,{text:e.target.value}),onBlur:()=>commit(o),onKeyDown:e=>e.key===`Enter`&&commit(o)}),u(`button`,{type:`button`,class:`penstock-review__icon`,disabled:r,"aria-label":p(`app.runs.removeVariable`,{name:e.name||p(`app.runs.theVariable`)}),title:p(`app.common.remove`),onClick:()=>commit(o.filter((e,n)=>n!==t)),children:u(`svg`,{viewBox:`0 0 16 16`,width:`16`,height:`16`,"aria-hidden":`true`,children:u(`path`,{d:`M4 4l8 8M12 4l-8 8`,fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`})})})]},t)),r&&u(`div`,{class:`penstock-review__actions`,children:[u(`span`,{class:`penstock-review__hint`,children:p(`app.runs.readOnlyEditingIsPro`)}),i&&u(`button`,{type:`button`,class:`penstock-review__link`,onClick:i,children:p(`app.runs.buyOrSignIn`)})]}),u(`div`,{class:`penstock-review__adders`,hidden:r,children:[u(`button`,{type:`button`,class:`penstock-review__link`,onClick:()=>c(e=>[...e,{name:``,text:``}]),children:p(`app.runs.addAValue`)}),m.slice(0,4).map(e=>u(`button`,{type:`button`,class:`penstock-review__link`,title:p(`app.runs.addWhichAGatewayCondition`,{name:e}),onClick:()=>c(t=>[...t,{name:e,text:``}]),children:[`+ `,e]},e))]}),u(`datalist`,{id:h,children:t.map(e=>u(`option`,{value:e},e))})]})}function AddScenarioForm({context:e,suggestions:t,processes:r,onPreview:i,onAdd:a,onCancel:o}){let[s,c]=n(``),[d,m]=n([]),[h,g]=n(r.length===1?r[0].id:void 0),[_,v]=n(void 0),y=l(()=>Ee(d),[d]),b=r.find(e=>e.id===h)?.starts??[],x=l(()=>bt(e,s,y,{process:h,startId:_}),[e,s,y,h,_]),S=`planned`in x?x.planned:null;f(()=>(i(S),()=>i(null)),[S]);let C={role:`start`,elementId:`add`,title:p(`app.runs.startVariables`),rows:d,empty:t.length>0?p(`app.runs.chooseTheValuesThatTake`,{names:t.join(`, `)}):p(`app.runs.addTheVariablesTheScenario`)};return u(`section`,{class:`penstock-review__add`,"aria-label":p(`app.runs.addAScenarioWithChosen`),children:[u(Q,{label:p(`app.runs.name`),optional:!0,layout:`top`,hint:p(`app.runs.leaveItEmptyToName`),children:e=>u(`input`,{...e,value:s,onInput:e=>c(e.target.value)})}),r.length>1&&u(Q,{label:p(`app.runs.process`),layout:`top`,children:e=>u(`select`,{...e,value:h??``,onChange:e=>{g(e.target.value||void 0),v(void 0)},children:[u(`option`,{value:``,children:p(`app.runs.chooseAProcess`)}),r.map(e=>u(`option`,{value:e.id,children:e.id},e.id))]})}),b.length>1&&u(Q,{label:p(`app.runs.startsAt`),layout:`top`,children:e=>u(`select`,{...e,value:_??``,onChange:e=>v(e.target.value||void 0),children:[u(`option`,{value:``,children:p(`app.runs.thePlainStartEvent`)}),b.map(e=>u(`option`,{value:e.id,children:[e.name||e.id,e.plain?``:p(`app.runs.startedByAnEvent`)]},e.id))]})}),u(ValueRows,{slot:C,suggestions:t,onChange:m}),u(`p`,{class:`penstock-review__text`,children:S?p(`app.runs.theseValuesTake`,{scenario:W(S.scenario)}):`problem`in x?x.problem:``}),S&&S.notes.map(e=>u(`p`,{class:`penstock-review__issue is-stuck`,children:e},e)),u(`div`,{class:`penstock-review__actions`,children:u(pi,{actions:[{id:`cancel`,label:p(`app.common.cancel`),role:`cancel`,onClick:o},{id:`add`,label:p(`app.runs.addScenario`),role:`primary`,onClick:()=>a({name:s,values:y,process:h,startId:_}),disabled:!S}]})})]})}var vc=300;function toVariables(e){return e.map(e=>({name:e}))}function singleLine(){return Mi.transactionFilter.of(e=>{if(!e.docChanged)return e;let t=e.newDoc.sliceString(0);return t.includes(`
9
+ `)?[{changes:{from:0,to:e.startState.doc.length,insert:t.replace(/\n/g,` `)},userEvent:e.annotation(ji.userEvent)}]:e})}function FeelEditor({id:e,label:t,value:n,onChange:r,onBlur:i,onSubmit:a,variables:o=[],placeholder:c=``,readOnly:l=!1,autoFocus:d=!1,error:p=null,class:m}){let h=s(null),g=s(null),_=s(n),v=s(n),y=s(null),b=s({onChange:r,onBlur:i,onSubmit:a,variables:o,placeholder:c});b.current={onChange:r,onBlur:i,onSubmit:a,variables:o,placeholder:c};let x=`${e}-error`,flush=()=>{y.current!==null&&(clearTimeout(y.current),y.current=null),_.current!==v.current&&(v.current=_.current,b.current.onChange(_.current))};f(()=>{let n=h.current;if(!n)return;let r=new di({container:n,value:_.current,readOnly:l,placeholder:b.current.placeholder,variables:toVariables(b.current.variables),contentAttributes:{id:e,"aria-label":t},extensions:[ni(),singleLine(),Ni.high(ki.of([{key:`Enter`,run:e=>(Fi(e.state)===`active`||(flush(),b.current.onSubmit?.(_.current)),!0)}])),Di.domEventHandlers({blur:()=>(flush(),b.current.onBlur?.(_.current),!1)})],onChange:e=>{_.current=e,y.current!==null&&clearTimeout(y.current),y.current=setTimeout(flush,vc)}});return g.current=r,d&&r.focus(),()=>{flush();let e=n.querySelector(`.cm-editor`);e&&Di.findFromDOM(e)?.destroy(),g.current=null}},[l]),f(()=>{v.current=n,n!==_.current&&(y.current!==null&&(clearTimeout(y.current),y.current=null),_.current=n,g.current?.setValue(n))},[n]);let S=o.join(`
10
+ `);return f(()=>{g.current?.setVariables(toVariables(b.current.variables))},[S]),f(()=>{g.current?.setPlaceholder(c)},[c]),f(()=>{let e=h.current?.querySelector(`.cm-content`);e&&(p?(e.setAttribute(`aria-describedby`,x),e.setAttribute(`aria-invalid`,`true`)):(e.removeAttribute(`aria-describedby`),e.removeAttribute(`aria-invalid`)))},[p,l]),u(`div`,{class:`feel-editor${l?` is-readonly`:``}${p?` has-error`:``}${m?` ${m}`:``}`,children:[u(`div`,{ref:h,class:`feel-editor__box type-input`}),p&&u(yi,{id:x,children:p})]})}function liveHint(e,t,n){if(e.isDefault)return e.hint;let r=y(t,n);if(t.trim()===``)return p(`app.runs.noConditionAlwaysTaken`);if(!r.readable)return p(`app.runs.penstockCannotCheckThisExpression`);let i=r.used.map(e=>`${e.name} = ${oe(e.value)}`).join(`, `);return r.result===null?p(`app.runs.chooseVariablesSoThat`,{text:r.text}):p(`app.runs.trueOrFalseForTheValues`,{result:r.result?p(`app.runs.true`):p(`app.runs.false`),used:i?` (${i})`:``})}function shownText(e,t){return e===`feel`?t.replace(/^\s*=\s*/,``):t}function unreadable$1(e,t,n){return!e.isDefault&&t.trim()!==``&&!y(t,n).readable}e(unreadable$1,`unreadable`);function ConditionEditor({branches:e,scope:t,style:r,variables:i,onCommit:a,problem:o}){let[s,c]=n({}),[l,d]=n({}),m=JSON.stringify(e.map(e=>[e.flowId,e.condition]));f(()=>{c({}),d({})},[m]);let commit=(e,t)=>{let n=a(e,t);d(t=>({...t,[e]:n??``}))},h=[...new Set([...Object.keys(t),...i])];return u(`div`,{class:`penstock-review__conditions`,children:[u(`span`,{class:`penstock-review__label`,children:p(`app.runs.conditionsOnTheWayOut`)}),e.map(e=>{let n=s[e.flowId]??shownText(r,e.condition),i=l[e.flowId]||o(e.flowId,n),a=r===`feel`&&unreadable$1(e,n,t);return u(`div`,{class:`penstock-review__branch`,children:[u(`span`,{class:`penstock-review__dot${e.planned?` is-planned`:``}`,title:e.planned?p(`app.runs.theWayThisScenarioTakes`):p(`app.runs.notTakenByThisScenario`)}),u(`span`,{class:`penstock-review__branch-name`,title:e.name,children:e.name}),r===`feel`?u(FeelEditor,{id:`penstock-review-condition-${e.flowId}`,class:`penstock-review__condition`,label:p(`app.runs.conditionOf`,{name:e.name}),placeholder:e.isDefault?p(`app.runs.defaultFlowNoCondition`):$r(`amount > 100`),value:n,variables:h,readOnly:e.isDefault,error:i||(a?p(`app.runs.penstockCannotCheckThisExpression`):null),onChange:t=>c(n=>({...n,[e.flowId]:t})),onBlur:t=>t!==shownText(r,e.condition)&&commit(e.flowId,t),onSubmit:t=>commit(e.flowId,t)}):u(`input`,{class:`penstock-review__input penstock-review__input--condition`,"aria-label":p(`app.runs.conditionOf`,{name:e.name}),placeholder:e.isDefault?p(`app.runs.defaultFlowNoCondition`):$r(`amount > 100`),value:n,disabled:e.isDefault,onInput:t=>c(n=>({...n,[e.flowId]:t.target.value})),onBlur:()=>s[e.flowId]!==void 0&&commit(e.flowId,n),onKeyDown:t=>t.key===`Enter`&&commit(e.flowId,n)}),!(r===`feel`&&a)&&u(`span`,{class:`penstock-review__hint penstock-review__branch-hint`,children:liveHint(e,n,t)}),r!==`feel`&&i&&u(`span`,{class:`penstock-review__issue is-mismatch penstock-review__branch-hint`,children:i})]},e.flowId)}),u(`p`,{class:`penstock-review__hint`,children:p(`app.runs.aChangeIsMadeInThe`)})]})}function moveFocus(e,t,n){let r=e.currentTarget;if(e.target!==r)return;if(e.key===`Enter`||e.key===` `){e.preventDefault(),t.pin(n);return}let i=e.key===`ArrowDown`?r.nextElementSibling:e.key===`ArrowUp`?r.previousElementSibling:null;i instanceof HTMLElement&&(e.preventDefault(),i.focus(),i.click())}function ReviewStep({step:e,selected:t,differences:r,suggestions:i,conditionNames:a,conditionStyle:o,readOnly:s,onUnlock:c,actions:l}){let[d,f]=n(!1),m=e.issues.some(e=>e.kind===`mismatch`)||r.some(e=>e.kind===`branch`),h=e.branches&&(d||m);return u(`li`,{class:`penstock-review__step${t?` is-selected`:``}${r.length>0?` is-different`:``}`,"data-element":e.elementId,tabIndex:0,"aria-current":t?`step`:void 0,style:{marginLeft:`${e.depth*12}px`},onClick:()=>l.pin(e),onMouseEnter:()=>l.hover(e),onMouseLeave:()=>l.hover(null),onFocus:()=>l.hover(e),onBlur:()=>l.hover(null),onKeyDown:t=>moveFocus(t,l,e),children:[u(`div`,{class:`penstock-review__step-head`,children:[u(`span`,{class:`penstock-review__number`,children:e.number}),u(`span`,{class:`penstock-review__step-name`,title:e.name,children:e.name}),u(`span`,{class:`penstock-review__kind`,children:p(`app.runs.kind.${e.kind}`)})]}),u(`p`,{class:`penstock-review__text`,children:e.text}),e.issues.map(e=>u(`p`,{class:`penstock-review__issue is-${e.kind}`,children:e.text},e.text)),r.map(e=>u(`p`,{class:`penstock-review__difference`,children:e.text},`${e.kind}:${e.text}`)),u(`div`,{onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:[e.values&&u(ValueRows,{slot:e.values,suggestions:e.values.role===`start`?i:[],readOnly:s,onUnlock:c,onChange:t=>l.changeRows(e,t)}),e.branches&&h&&u(ConditionEditor,{branches:e.branches,scope:e.scope,style:o,variables:a,onCommit:l.setCondition,problem:l.conditionProblem}),u(`div`,{class:`penstock-review__actions`,children:[e.branches&&!m&&u(`button`,{type:`button`,class:`penstock-review__link`,onClick:()=>f(e=>!e),children:p(d?`app.runs.hideTheConditions`:`app.runs.fixTheConditions`)}),e.links.worker&&u(`button`,{type:`button`,class:`penstock-review__link`,onClick:()=>l.openWorker(e),children:p(`app.runs.goToTheWorker`)}),e.links.decision&&u(`button`,{type:`button`,class:`penstock-review__link`,"data-opens":`rule`,onClick:()=>l.openRule(e),children:p(`app.runs.showTheDecisionRule`)}),e.links.decision&&u(`button`,{type:`button`,class:`penstock-review__link`,onClick:()=>l.openDecision(e),children:p(`app.runs.openTheDecision`)}),e.links.form&&u(`button`,{type:`button`,class:`penstock-review__link`,"data-opens":`form`,onClick:()=>l.openForm(e),children:p(`app.runs.fillTheForm`)}),e.links.form&&u(`button`,{type:`button`,class:`penstock-review__link`,onClick:()=>l.revealForm?l.revealForm(e):l.openForm(e),children:p(`app.runs.goToTheForm`)}),e.kind===`timer`&&l.openTimer&&u(`button`,{type:`button`,class:`penstock-review__link`,"data-opens":`timer`,onClick:()=>l.openTimer(e),children:p(`app.runs.answerTimer`)}),e.kind===`worker`&&l.openMockWorker&&u(`button`,{type:`button`,class:`penstock-review__link`,"data-opens":`mock-worker`,onClick:()=>l.openMockWorker(e),children:p(`app.runs.mockWorker`)})]})]})]})}function RuleView({step:e,review:t,onOpen:n}){let r=e.links.decision,i=r?t.targets.tables.get(r.id):void 0;if(!i)return u(`p`,{class:`penstock-review__hint penstock-review__pad`,children:p(`app.runs.decisionTableNotInProject`,{id:r?.id??``})});let a=Ae(i,e.scope);return u(`div`,{class:`penstock-review__rule`,children:[u(`p`,{class:`penstock-review__text`,children:a.why}),a.problems.map(e=>u(`p`,{class:`penstock-review__issue is-mismatch`,children:e},e)),u(`div`,{class:`penstock-review__table-wrap`,children:u(`table`,{class:`penstock-review__table`,children:[u(`thead`,{children:u(`tr`,{children:[u(`th`,{scope:`col`,children:`#`}),i.inputs.map(e=>u(`th`,{scope:`col`,children:e.label},e.expression)),i.outputs.map(e=>u(`th`,{scope:`col`,children:e.name},e.name))]})}),u(`tbody`,{children:i.rules.map((e,t)=>u(`tr`,{class:a.rules.includes(t+1)?`is-match`:void 0,"aria-current":a.rules.includes(t+1)?`true`:void 0,children:[u(`td`,{children:t+1}),e.inputs.map((e,t)=>u(`td`,{children:e||`-`},t)),e.outputs.map((e,t)=>u(`td`,{children:e},t))]},e.id))})]})}),u(`div`,{class:`penstock-review__actions`,children:u(`button`,{type:`button`,class:`penstock-review__link`,onClick:()=>n(e),children:p(`app.runs.openTheDecisionIn`,{file:i.file?i.file.split(/[\\/]/).pop()??``:p(`app.runs.itsFile`)})})})]})}function LazyFormStepView(e){let[t,r]=n(null);return f(()=>{let e=!1;return m(()=>import(`./FormStepView-DraPVoAN.js`).then(t=>{e||r(()=>t.FormStepView)}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]),import.meta.url).catch(e=>console.error(`The form view did not load:`,e)),()=>{e=!0}},[]),t?u(t,{...e}):null}function TimerStepView({step:e,review:t,onFire:r,onRemove:i,onComplete:a}){let o=t.selected?.testCase,s=t.context?.index.steps.get(e.elementId)??{id:e.elementId,type:e.kind,event:e.kind===`timer`?`timer`:void 0,timer:e.timer},c=(o&&s?pe(o,s):void 0)??s.timer??`PT1S`,l=o&&s?C(o,s):!1,[d,f]=n(c),m=ht(d)?null:p(`app.runs.timerDurationProblem`);return u(`div`,{class:`penstock-review__form-wrap`,children:[u(`div`,{class:`penstock-review__body penstock-review__pad`,children:[u(`label`,{class:`ui-label`,htmlFor:`timer-duration-input`,children:p(`app.runs.advanceTimeBy`)}),u(`input`,{id:`timer-duration-input`,type:`text`,class:`ui-input`,value:d,"aria-invalid":m?`true`:void 0,onInput:e=>f(e.target.value)}),m&&u(`span`,{class:`penstock-review__issue is-mismatch`,children:m}),l&&u(`p`,{class:`penstock-review__hint`,children:p(`app.runs.timerFired`)})]}),u(`div`,{class:`penstock-review__footer penstock-review__pad`,children:[u(`button`,{type:`button`,class:`ui-button ui-button--primary`,disabled:m!==null,onClick:()=>{r?.(d.trim()),a?.()},children:p(`app.runs.fireTimer`)}),l&&i&&u(`button`,{type:`button`,class:`ui-button ui-button--secondary`,onClick:i,children:p(`app.runs.removeTimerAnswer`)})]})]})}function MockWorkerStepView({step:e,review:t,runs:r,onMock:i,onRemove:a,onComplete:o}){let s=t.selected?.testCase,c=t.context?.index.steps.get(e.elementId)??{id:e.elementId,type:e.kind,job:e.links.worker},l=s&&c?O(s,c):void 0,[d,f]=n(l?.kind??`complete`),[m,h]=n(JSON.stringify(l?.variables??{},null,2)),[g,_]=n(l?.errorCode??``),[v,y]=n(l?.errorMessage??``),[b,x]=n(null),S=r.waiting&&r.waiting.kind===`job`&&r.waiting.elementId===e.elementId,handleSave=()=>{x(null);let e;if(d===`complete`||d===`error`&&m.trim())try{let t=JSON.parse(m);if(typeof t!=`object`||!t||Array.isArray(t)){x(p(`app.runs.invalidJson`));return}e=t}catch{x(p(`app.runs.invalidJson`));return}if(d===`complete`)i?.({kind:`complete`,variables:e}),S&&o?.(e??{});else if(d===`error`){let t={kind:`error`,errorCode:g.trim()||`error`,errorMessage:v.trim()||void 0,variables:e};i?.(t)}else{let e={kind:`fail`,errorMessage:v.trim()||void 0};i?.(e)}};return u(`div`,{class:`penstock-review__form-wrap`,children:[u(`div`,{class:`penstock-review__body penstock-review__pad`,children:[u(`label`,{class:`ui-label`,htmlFor:`mock-worker-outcome-select`,children:p(`app.runs.workerOutcome`)}),u(`select`,{id:`mock-worker-outcome-select`,class:`ui-select`,value:d,onChange:e=>f(e.target.value),children:[u(`option`,{value:`complete`,children:p(`app.runs.completeJob`)}),u(`option`,{value:`error`,children:p(`app.runs.throwBpmnError`)}),u(`option`,{value:`fail`,children:p(`app.runs.failJob`)})]}),d===`complete`&&u(`div`,{class:`penstock-review__field-group`,children:[u(`label`,{class:`ui-label`,htmlFor:`mock-worker-variables-input`,children:p(`app.runs.workerVariables`)}),u(`textarea`,{id:`mock-worker-variables-input`,class:`ui-textarea`,rows:4,value:m,onInput:e=>h(e.target.value)})]}),d===`error`&&u(`div`,{class:`penstock-review__field-group`,children:[u(`label`,{class:`ui-label`,htmlFor:`mock-worker-error-code-input`,children:p(`app.runs.errorCode`)}),u(`input`,{id:`mock-worker-error-code-input`,type:`text`,class:`ui-input`,value:g,onInput:e=>_(e.target.value)}),u(`label`,{class:`ui-label`,htmlFor:`mock-worker-error-message-input`,children:p(`app.runs.errorMessage`)}),u(`input`,{id:`mock-worker-error-message-input`,type:`text`,class:`ui-input`,value:v,onInput:e=>y(e.target.value)})]}),d===`fail`&&u(`div`,{class:`penstock-review__field-group`,children:[u(`label`,{class:`ui-label`,htmlFor:`mock-worker-fail-message-input`,children:p(`app.runs.errorMessage`)}),u(`input`,{id:`mock-worker-fail-message-input`,type:`text`,class:`ui-input`,value:v,onInput:e=>y(e.target.value)})]}),b&&u(`p`,{class:`penstock-review__issue is-mismatch`,children:b})]}),u(`div`,{class:`penstock-review__footer penstock-review__pad`,children:[u(`button`,{type:`button`,class:`ui-button ui-button--primary`,onClick:handleSave,children:p(`app.runs.saveMock`)}),l&&a&&u(`button`,{type:`button`,class:`ui-button ui-button--secondary`,onClick:a,children:p(`app.runs.removeMock`)})]})]})}function occurrenceOf(e){let t=/#(\d+)$/.exec(e);return t?Number(t[1]):1}function topOf(e){let t=e[e.length-1]?.key;return t===`generate`||t===`scenario`||t===`add`||t===`rule`||t===`form`||t===`timer`||t===`mock-worker`?t:`root`}function problemsWord(e){return p(`app.runs.problemCount`,{count:e})}function ScenarioList({items:e,mode:t,selectedId:n,results:r,running:i,onSelect:a,onOpen:o,onToggle:c,onMenu:l,label:d}){let f=s(null),m=n&&e.some(e=>e.id===n)?n:e[0]?.id??null,move=e=>{a(e),requestAnimationFrame(()=>{try{let t=typeof CSS<`u`&&CSS.escape?CSS.escape(`scenario-option-${e}`):`scenario-option-${e}`;f.current?.querySelector(`[id="${t}"]`)?.scrollIntoView({block:`nearest`})}catch{}})},onKey=n=>{let r=e.findIndex(e=>e.id===m);if(n.key===`ArrowDown`&&r<e.length-1)move(e[r+1].id);else if(n.key===`ArrowUp`&&r>0)move(e[r-1].id);else if(n.key===`Home`&&e.length>0)move(e[0].id);else if(n.key===`End`&&e.length>0)move(e[e.length-1].id);else if(n.key===`Enter`&&r>=0)o(e[r]);else if(n.key===` `&&t===`generate`&&r>=0&&!e[r].inFile&&!e[r].unplannable)c(e[r].id);else if(l&&r>=0&&(n.key===`ContextMenu`||n.key===`F10`&&n.shiftKey)){let t=document.getElementById(`scenario-option-${e[r].id}`),n=t?.getBoundingClientRect();l(e[r],{x:n?n.left+8:0,y:n?n.bottom:0},t??null)}else return;n.preventDefault()};return u(`ul`,{class:`penstock-review__list`,role:`listbox`,tabIndex:0,"aria-label":d,"aria-activedescendant":m?`scenario-option-${m}`:void 0,ref:f,onKeyDown:onKey,children:e.map(e=>{let n=r.get(e.name),s=i===e.name?`running`:n?.outcome??`none`;return u(`li`,{id:`scenario-option-${e.id}`,role:`option`,"aria-selected":e.id===m,"data-opens":`scenario`,class:`penstock-review__item${e.id===m?` is-selected`:``}`,title:caseTitle(e.name,n?.message??e.testCase.description),onClick:()=>a(e.id),onDblClick:()=>o(e),onContextMenu:t=>{l&&(t.preventDefault(),a(e.id),l(e,{x:t.clientX,y:t.clientY},t.currentTarget))},children:[t===`generate`?u(`input`,{type:`checkbox`,class:`penstock-review__check`,tabIndex:-1,checked:e.ticked,disabled:e.inFile||!!e.unplannable,"aria-label":p(`app.runs.include`,{name:e.name}),onClick:e=>e.stopPropagation(),onChange:()=>c(e.id)}):u(`span`,{class:`penstock-runs__dot penstock-runs__dot--${s}`,"aria-label":s}),u(`span`,{class:`penstock-review__item-main`,children:[u(`span`,{class:`penstock-review__item-name`,children:e.name}),e.unplannable&&u(`span`,{class:`penstock-review__item-note is-problem`,children:e.unplannable}),e.origin!==`generated`&&Ve(e.testCase)&&!e.unplannable&&u(`span`,{class:`penstock-review__item-note`,children:p(`app.runs.penstockOnlyCamundaProcessTestWould`)}),e.inFile&&u(`span`,{class:`penstock-review__item-note`,children:p(`app.runs.alreadyInTheFileKeptAs`)})]}),e.origin===`added`&&u(`span`,{class:`penstock-review__tag`,children:p(`app.runs.added`)}),e.problems>0&&u(`span`,{class:`penstock-review__tag is-problem`,title:problemsWord(e.problems),"aria-label":problemsWord(e.problems),children:e.problems})]},e.id)})})}function ScenariosTab({active:e,views:t,push:r,back:i,reset:a}){let c=useScenarios(),{runs:d,review:m,enabled:h}=c,g=topOf(t),_=t.some(e=>e.key===`generate`)?`generate`:`file`,[v,y]=n(`steps`),b=s(null),x=s(g),[S,C]=n(null),[w,T]=n(null);f(()=>{c.setPresence(e,g,_)},[e,g,_]),f(()=>{if(e&&x.current!==g){let e=x.current;if(x.current=g,t.length<depthOf(e)){requestAnimationFrame(()=>{try{let t=document.querySelector(`[data-opens="${e}"]`);(t?.closest(`[role="listbox"]`)??t)?.focus()}catch{}});return}requestAnimationFrame(()=>{try{b.current?.querySelector(`[tabindex="0"], input, button`)?.focus()}catch{}})}},[e,g]),f(()=>y(`steps`),[m.selected?.id]);let D=m.selected,O=m.context,k=l(()=>({pin:c.pinStep,hover:c.hoverStep,changeRows:(e,t)=>{if(!D||!m.context)return;let n=e.values?.role??`returns`;m.edit(D.id,r=>Be(D.baseCase,m.context.index.steps,r,{role:n,elementId:e.elementId,rows:t}))},setCondition:m.setCondition,conditionProblem:m.conditionProblem,openWorker:e=>{let t=m.context?.index.steps.get(e.elementId);t?.delegateClass?c.onNavigate(t.delegateClass,`JAVA_CLASS`):t?.delegateBean?c.onNavigate(t.delegateBean,`BEAN`):c.onOpenWorker(e.elementId)},openRule:e=>{c.showRule(e),r({key:`rule`,title:e.links.decision?.name??p(`app.runs.decisionRule`)})},openDecision:e=>{let t=e.links.decision,n=t?.file??m.targets.tables.get(t?.id??``)?.file;try{n?Y().revealElement(n,t?.id).catch?.(()=>{}):Y().notifyUser(p(`app.runs.noDecisionTableWithId`,{id:t?.id??``}),!0).catch?.(()=>{})}catch{}},openForm:e=>{c.showForm(e),r({key:`form`,title:e.name||p(`app.runs.fillTheForm`)})},revealForm:e=>{let t=e.links.form??``,n=m.targets.forms.get(t);try{n?Y().revealElement(n).catch?.(()=>{}):Y().notifyUser(p(`app.runs.noFormWithTheId`,{id:t}),!0).catch?.(()=>{})}catch{}},openTimer:e=>{c.showTimer(e),r({key:`timer`,title:e.name||p(`app.runs.answerTimer`)})},openMockWorker:e=>{c.showMockWorker(e),r({key:`mock-worker`,title:e.name||p(`app.runs.mockWorker`)})}}),[c,m,D,r]);f(()=>{if(!d.waiting||d.waiting.kind!==`userTask`)return;let e=d.waiting.elementId,t=D??m.items.find(e=>e.name===d.running);if(!t)return;let n=t.steps.find(t=>t.elementId===e);n?.links.form&&(g!==`form`||c.formStep?.elementId!==n.elementId)&&(D?.id!==t.id&&m.select(t.id),c.showForm(n),r({key:`form`,title:n.name||p(`app.runs.fillTheForm`)}))},[d.waiting,D,m.items,d.running,g,c.formStep,r,m]);let A=Yi(c.file);if(f(()=>{let e=c.file;if(e===null||A===null||!m.ready||d.file===null)return;if(t.length>0){a();return}if(m.mode!==`file`)return;let n=Ji(e),i=n===null?void 0:m.items.find(e=>e.origin===`file`&&e.name===n);i&&(m.select(i.id),r({key:`scenario`,title:i.name}))},[c.file,A,m.ready,m.mode,m.items,m.select,d.file,t.length,a,r]),!h)return u($,{title:p(`app.runs.scenariosNeedAnEngine`),hint:p(`app.runs.scenariosRunACamunda7`),guide:`scenarios`});let j=d.file?.split(/[\\/]/).pop()??null,M=d.target?null:d.notice??p(`app.runs.runningNeedsAnEngineSet`),N=d.running?p(`app.runs.stop`):p(`app.runs.run`),open=e=>{m.select(e.id),r({key:`scenario`,title:e.name})},reportFailure=e=>{Y().notifyUser(e,!0).catch?.(()=>{})},renameItem=async(e,t)=>{try{let n=await d.renameScenario(e.name,occurrenceOf(e.id),t);return n&&`name`in n&&m.select(`file:${n.name}`),n&&`problem`in n?n.problem:null}catch(e){return reportFailure(Tr(e)),null}},duplicateItem=async e=>{try{let t=await d.duplicateScenario(e.name,occurrenceOf(e.id));t&&`name`in t?m.select(`file:${t.name}`):t&&`problem`in t&&reportFailure(t.problem)}catch(e){reportFailure(Tr(e))}},deleteItem=async e=>{let t=d.file?.split(/[\\/]/).pop()??``,n=!1;try{n=await Y().confirmWithUser({title:p(`app.runs.deleteScenarioTitle`,{name:e.name}),text:p(`app.runs.deleteScenarioText`,{name:e.name,file:t}),accept:p(`app.runs.deleteScenario`),decline:p(`app.common.cancel`),warning:!0})}catch{return}if(n)try{let t=await d.deleteScenario(e.name,occurrenceOf(e.id));if(t&&`problem`in t){reportFailure(t.problem);return}g===`scenario`&&i()}catch(e){reportFailure(Tr(e))}},startRename=e=>{(g!==`scenario`||D?.id!==e.id)&&open(e),T(e.id)},menuItems=e=>[{id:`rename`,label:p(`app.runs.rename`),run:()=>startRename(e)},{id:`duplicate`,label:p(`app.runs.duplicate`),run:()=>void duplicateItem(e)},{id:`delete`,label:p(`app.runs.deleteScenario`),danger:!0,separated:!0,run:()=>void deleteItem(e)}],openMenu=(e,t,n)=>C({item:e,at:t,returnTo:n}),P=u(o,{children:u(`button`,{type:`button`,class:`ui-button`,disabled:!d.running&&(!D||!!D.unplannable||!d.target),onClick:d.running?d.stop:m.run,children:N})}),renderView=()=>{if(g===`timer`&&c.timerStep){let e=c.timerStep;return u(`div`,{class:`penstock-review`,ref:b,children:u(`div`,{class:`penstock-review__scroll`,children:u(TimerStepView,{step:e,review:m,runs:d,onFire:t=>{D&&m.edit(D.id,n=>({...n,mocks:{...n.mocks,[e.elementId]:{kind:`timer`,duration:t}}}))},onRemove:()=>{D&&m.edit(D.id,t=>({...t,mocks:{...t.mocks,[e.elementId]:null}}))}})})})}if(g===`mock-worker`&&c.mockWorkerStep){let e=c.mockWorkerStep;return u(`div`,{class:`penstock-review`,ref:b,children:u(`div`,{class:`penstock-review__scroll`,children:u(MockWorkerStepView,{step:e,review:m,runs:d,onMock:t=>{D&&m.edit(D.id,n=>({...n,mocks:{...n.mocks,[e.elementId]:t}}))},onRemove:()=>{D&&m.edit(D.id,t=>({...t,mocks:{...t.mocks,[e.elementId]:null}}))},onComplete:e=>d.answer({kind:`complete`,variables:e})})})})}if(g===`form`&&c.formStep){let e=c.formStep;return u(`div`,{class:`penstock-review`,ref:b,children:u(`div`,{class:`penstock-review__scroll`,children:u(LazyFormStepView,{step:e,review:m,runs:d,onChange:t=>k.changeRows(e,t),onComplete:e=>d.answer({kind:`complete`,variables:e}),onRevealFile:k.revealForm})})})}if(g===`rule`&&c.ruleStep)return u(`div`,{class:`penstock-review`,ref:b,children:u(`div`,{class:`penstock-review__scroll`,children:u(RuleView,{step:c.ruleStep,review:m,onOpen:k.openDecision})})});if(g===`add`&&O)return u(`div`,{class:`penstock-review`,ref:b,children:u(`div`,{class:`penstock-review__scroll`,children:u(AddScenarioForm,{context:O,suggestions:m.suggestions,processes:m.processes,onPreview:c.preview,onAdd:e=>{m.add(e),i()},onCancel:i})})});if(g===`scenario`&&D){let e=m.licensed,unlock=()=>void vr();return u(`div`,{class:`penstock-review`,ref:b,children:[u(`div`,{class:`penstock-review__fixed`,children:[M&&!d.running&&u(`p`,{class:`penstock-review__hint`,children:M}),u(`div`,{class:`penstock-review__tabs`,role:`tablist`,"aria-label":p(`app.runs.view`),children:[u(`button`,{type:`button`,role:`tab`,"aria-selected":v===`steps`,class:`penstock-review__tab${v===`steps`?` is-active`:``}`,onClick:()=>y(`steps`),children:p(`app.runs.steps`)}),u(`button`,{type:`button`,role:`tab`,"aria-selected":v===`text`,class:`penstock-review__tab${v===`text`?` is-active`:``}`,onClick:()=>y(`text`),children:p(`app.runs.text`)})]}),D.notes.map(e=>u(`p`,{class:`penstock-review__issue is-mismatch`,children:e},e)),m.actual&&u(`p`,{class:`penstock-review__result${m.actual.matches?` is-same`:` is-different`}`,children:m.actual.matches?p(`app.runs.theRunMatches`,{against:m.actual.against}):p(`app.runs.theRunDiffersFrom`,{against:m.actual.against,count:m.actual.differences.length})}),c.offPath&&u(`p`,{class:`penstock-review__hint`,children:p(`app.runs.notOnThisScenariosPath`)})]}),u(`div`,{class:`penstock-review__scroll`,children:D.unplannable?u(`p`,{class:`penstock-review__issue is-mismatch`,children:D.unplannable}):v===`steps`?u(`ol`,{class:`penstock-review__steps`,children:D.steps.map(t=>u(ReviewStep,{step:t,selected:c.focus===t.elementId,differences:m.actual?.byElement.get(t.elementId)??[],suggestions:m.suggestions,conditionNames:m.conditionNames,conditionStyle:m.conditionStyle,readOnly:!e,onUnlock:unlock,actions:k},`${t.number}:${t.elementId}`))}):u(`pre`,{class:`penstock-review__json`,"aria-label":p(`app.runs.theScenarioAsItIs`),children:(()=>{try{return JSON.stringify(D.testCase,null,2)}catch{return String(D.testCase)}})()})}),u(`div`,{class:`penstock-review__footer`,children:[P,_===`file`&&u(`span`,{class:`penstock-review__extras`,children:u(`button`,{type:`button`,class:`ui-button ui-button--primary`,disabled:m.dirty.length===0||m.creating,onClick:()=>void m.save().catch(()=>{}),children:p(`app.runs.saveChanges`)})})]})]})}let e=m.coverage?E(m.coverage,m.capped):null,t=m.items.filter(e=>e.unplannable).length;return g===`generate`?u(`div`,{class:`penstock-review`,ref:b,children:[u(`div`,{class:`penstock-review__fixed`,children:[u(`p`,{class:`penstock-review__count`,children:[p(`app.runs.toCreate`,{ticked:m.ticked,items:m.items.length}),t>0?p(`app.runs.cannotBePlanned`,{count:t}):``]}),m.capped&&u(`p`,{class:`penstock-review__hint`,children:p(`app.runs.moreWaysThanShown`,{count:64})}),e&&u(`p`,{class:`penstock-review__coverage`,children:e})]}),u(`div`,{class:`penstock-review__scroll`,children:[m.problem&&u(`p`,{class:`penstock-review__issue is-mismatch`,children:m.problem}),!m.ready&&!m.problem&&u(`p`,{class:`penstock-review__hint`,children:p(`app.runs.planningTheScenarios`)}),m.ready&&m.items.length===0&&u(`p`,{class:`penstock-review__hint`,children:p(`app.runs.noWayThroughAProcess`)}),u(ScenarioList,{items:m.items,mode:`generate`,selectedId:D?.id??null,results:d.results,running:d.running,onSelect:m.select,onOpen:open,onToggle:m.toggle,label:p(`app.runs.scenariosToCreate`)}),m.targets.duplicates.map(e=>u(`p`,{class:`penstock-review__hint`,children:e},e))]}),u(`div`,{class:`penstock-review__footer`,children:[u(`button`,{type:`button`,class:`ui-button`,"data-opens":`add`,disabled:!O,onClick:()=>r({key:`add`,title:p(`app.runs.addScenario`)}),children:p(`app.runs.addScenario`)}),u(`span`,{class:`penstock-review__extras`,children:u(`button`,{type:`button`,class:`ui-button ui-button--primary`,disabled:m.ticked===0||m.creating,onClick:()=>void m.create().then(e=>{e&&(m.reset(),a())}).catch(()=>{}),children:p(`app.runs.createScenarios`)})})]})]}):u(`div`,{class:`penstock-review`,ref:b,children:[u(`div`,{class:`penstock-review__fixed`,children:[u(`div`,{class:`penstock-review__toolbar`,children:[u(`span`,{class:`penstock-review__file`,title:d.file??void 0,children:j??p(`app.runs.noScenarioFile`)}),u(`span`,{class:`penstock-review__row-actions`,children:[!(m.ready&&m.items.length===0&&d.problems.length===0)&&u(`button`,{type:`button`,class:`ui-button`,"data-opens":`generate`,disabled:!!d.running,onClick:()=>void d.generate().then(e=>e&&r({key:`generate`,title:p(`app.runs.reviewScenarios`)})).catch(()=>{}),children:p(`app.runs.generate`)}),d.running?u(`button`,{type:`button`,class:`ui-button`,onClick:d.stop,children:p(`app.runs.stop`)}):u(`button`,{type:`button`,class:`ui-button`,disabled:d.cases.length===0||!d.target,onClick:()=>d.run(),children:p(`app.runs.runAll`)})]})]}),M&&u(`p`,{class:`penstock-review__hint`,children:M}),d.problems.map(e=>u(`p`,{class:`penstock-review__issue is-mismatch`,children:e},e)),d.notice&&d.target&&u(`p`,{class:`penstock-review__hint`,children:d.notice})]}),u(`div`,{class:`penstock-review__scroll`,children:[m.ready&&m.items.length===0&&d.problems.length===0&&u($,{title:p(`app.runs.noScenariosAdded`),hint:p(`app.runs.noScenariosHint`),guide:`scenarios`,actions:[{label:p(`app.runs.generateThemFromTheDiagram`),run:()=>void d.generate().then(e=>e&&r({key:`generate`,title:p(`app.runs.reviewScenarios`)})).catch(()=>{})}]}),!m.ready&&d.cases.length>0&&u(`p`,{class:`penstock-review__hint`,children:p(`app.runs.planningTheScenarios`)}),m.items.length>0&&u(ScenarioList,{items:m.items,mode:`file`,selectedId:D?.id??null,results:d.results,running:d.running,onSelect:m.select,onOpen:open,onToggle:m.toggle,onMenu:openMenu,label:p(`app.runs.scenariosIn`,{file:j??p(`app.runs.theFile`)})})]}),u(`div`,{class:`penstock-review__footer`,children:[m.items.length>0&&u(o,{children:[u(`button`,{type:`button`,class:`ui-button`,disabled:!D,onClick:()=>D&&open(D),children:p(`app.runs.openScenario`)}),P]}),u(`span`,{class:`penstock-review__extras`,children:[c.onRunWithInput&&u(`button`,{type:`button`,class:`penstock-review__link`,onClick:c.onRunWithInput,children:p(`app.runs.runWithInputMore`)}),c.onOpenRun&&u(`button`,{type:`button`,class:`penstock-review__link`,onClick:c.onOpenRun,children:p(`app.runs.openARunMore`)})]})]})]})},F=g===`scenario`&&D&&_===`generate`&&!D.inFile&&!D.unplannable?D:null,I=g===`scenario`&&D&&_===`file`&&D.origin===`file`?D:null,L=g===`scenario`&&D?D.name:t[t.length-1]?.title??``,R=t.length>0?u(Ir,{title:L,backLabel:p(`app.runs.backTo`,{value:t.length>1?t[t.length-2].title:p(`app.common.scenarios`)}),onBack:()=>{g===`form`&&c.showForm(null),g===`rule`&&c.showRule(null),i()},editable:F?{label:p(`app.runs.nameOfTheScenario`),onCommit:e=>(m.rename(F.id,e),null)}:I?{label:p(`app.runs.nameOfTheScenario`),onCommit:e=>renameItem(I,e),start:w===I.id,onStarted:()=>T(null)}:void 0,trailing:F?u(`label`,{class:`penstock-review__include`,title:p(`app.runs.writeThisScenarioToThe`),children:[u(`input`,{type:`checkbox`,"aria-label":p(`app.runs.createThisScenario`),checked:F.ticked,onChange:()=>m.toggle(F.id)}),u(`span`,{children:p(`app.runs.create`)})]}):I?u(`button`,{type:`button`,class:`sidebar__icon`,"aria-label":p(`app.runs.scenarioActions`),title:p(`app.runs.scenarioActions`),"aria-haspopup":`menu`,"aria-expanded":S!==null,onClick:e=>{let t=e.currentTarget,n=t.getBoundingClientRect();openMenu(I,{x:n.left,y:n.bottom+4},t)},children:u(Gi,{name:`more`})}):void 0}):null;return u(o,{children:[R,renderView(),S&&u(gi,{label:p(`app.runs.scenarioActions`),at:S.at,items:menuItems(S.item),onClose:()=>C(null),returnFocusTo:S.returnTo})]})}function depthOf(e){return e===`root`?0:e===`generate`?1:e===`scenario`?2:3}function ScenariosBar({views:e}){let t=useScenarios(),n=t.review.selected,r=topOf(e)===`scenario`&&n&&!n.unplannable;return u(o,{children:r?u(o,{children:[u(`button`,{type:`button`,class:`sidebar__icon`,"aria-label":p(`app.runs.previousStep`),onClick:()=>t.stepBy(-1),children:`‹`}),u(`span`,{class:`sidebar-bar__title`,title:n.name,children:barText(t.stepAt,n.steps.length)}),u(`button`,{type:`button`,class:`sidebar__icon`,"aria-label":p(`app.runs.nextStep`),onClick:()=>t.stepBy(1),children:`›`})]}):u(`span`,{class:`sidebar-bar__title`,children:p(`app.runs.scenarios`)})})}function RuleHelp({family:e,name:t}){let n=P(e,t);return n?u(`div`,{class:`diagram-check__help`,children:[u(`p`,{class:`diagram-check__help-line`,children:[u(`span`,{class:`diagram-check__help-label`,children:p(`app.diagramCheck.why`)}),ye(e,t)]}),u(`p`,{class:`diagram-check__help-line`,children:[u(`span`,{class:`diagram-check__help-label`,children:p(`app.diagramCheck.fix`)}),L(e,t)]}),u(`a`,{class:`diagram-check__help-link`,href:U(n.id),target:`_blank`,rel:`noopener noreferrer`,children:n.id})]}):null}var yc={error:0,warning:1,info:2};function worstFirst(e){return[...e].sort((e,t)=>yc[e.severity]-yc[t.severity])}function migrationSections(e){return[{title:p(`app.migration.needsWork`),findings:worstFirst(e.filter(e=>e.conversion===`manual`)),collapsed:!1},{title:p(`app.migration.reviewAfterConverting`),findings:worstFirst(e.filter(e=>e.conversion===`review`)),collapsed:!1},{title:p(`app.migration.convertUnchanged`),findings:e.filter(e=>e.conversion===`automatic`),collapsed:!0}].filter(e=>e.findings.length>0)}function migrationTally(e){return{toDo:e.filter(e=>e.conversion===`manual`).length,toCheck:e.filter(e=>e.conversion===`review`).length,converts:e.filter(e=>e.conversion===`automatic`).length}}function migrationTallyText(e){return[e.toDo>0?p(`app.migration.tally.toDo`,{count:e.toDo}):null,e.toCheck>0?p(`app.migration.tally.toCheck`,{count:e.toCheck}):null,e.converts>0?p(`app.migration.tally.converts`,{count:e.converts}):null].filter(Boolean).join(`, `)}async function projectForms(){try{let e=Y(),t=await e.getProjectFiles(),n=(Array.isArray(t?.files)?t.files:[]).filter(e=>e&&typeof e.path==`string`&&/\.form$/i.test(e.path)),r=await Promise.all(n.map(async t=>({path:t.path,text:await e.readFile(t.path).catch(()=>``)})));return tt(r)}catch{return new Map}}var bc=600;function useMigration(e,t,i){let[a,o]=n({findings:null,failure:null}),c=s(null),l=s(!0);f(()=>(l.current=!0,()=>{l.current=!1}),[]);let u=r(async()=>{try{let e=typeof i==`function`?await i().catch(()=>void 0):void 0;if(!l.current)return;if(!e){o({findings:[],failure:null});return}c.current??=await projectForms();let t=await ct(e,{forms:c.current}).catch(()=>({ok:!1,failure:p(`app.migration.theDiagramCouldNotBe`)}));if(!l.current)return;let n=Array.isArray(t?.findings)?t.findings:[];o({findings:t?.ok&&t?.source?n:[],failure:t?.ok?null:t?.failure??p(`app.migration.theDiagramCouldNotBe`)})}catch(e){l.current&&o({findings:null,failure:e instanceof Error?e.message:String(e)})}},[i]);return f(()=>{if(!e)return;c.current=null,u();let n;try{n=typeof t==`function`?t()?.get?.(`eventBus`):void 0}catch{}if(!n)return;let r,handler=()=>{r&&clearTimeout(r),r=setTimeout(()=>void u(),bc)};try{n.on?.(`commandStack.changed`,handler),n.on?.(`import.done`,handler)}catch{}return()=>{r&&clearTimeout(r);try{n?.off?.(`commandStack.changed`,handler),n?.off?.(`import.done`,handler)}catch{}}},[e,u,t]),a}var xc={name:`Penstock deployment`,source:`penstock`,changedOnly:!0};function carried(e){let t={};return e?.name&&e.name!==xc.name&&(t.name=e.name),e?.source&&e.source!==xc.source&&(t.source=e.source),e?.tenantId&&(t.tenantId=e.tenantId),e?.changedOnly!==void 0&&e.changedOnly!==xc.changedOnly&&(t.changedOnly=e.changedOnly),t}function settingsFromTargets(e){let t=e.targets;return{deployment:carried(t.find(e=>!e.profile)?.deployment),profiles:t.filter(e=>e.profile).map(e=>({name:e.profile,deployment:carried(e.deployment)}))}}function migrationHost(e,t){return{unlock:()=>e.requestFeature(`MIGRATION`),previewMigration:(t,n)=>e.previewMigration(t,n),saveFile:(t,n)=>e.saveFile(t,n),createProjectFiles:(t,n)=>e.createProjectFiles(t,n),notifyUser:(t,n)=>e.notifyUser(t,n),openFile:t=>e.revealElement(t),projectRoot:t,readIfPresent:t=>e.readFileIfPresent(t),settings:async t=>settingsFromTargets(await e.getDeployTargets(t))}}var Sc=[`penstock.yaml`,`penstock.yml`,`penstock.json`];function messageOf(e){return e instanceof Error?e.message:String(e)}function nameOf$6(e){return e.split(/[\\/]/).pop()??e}e(nameOf$6,`nameOf`);function kindOf(e){return e===`bpmn`?`BPMN`:e===`dmn`?`DMN`:`FORM`}async function sourceFolderOf(e,t,n){let r=t.replace(/[\\/]+$/,``),i=dt(n);for(;i.length>r.length&&i.startsWith(r);){for(let t of Sc)if(await e.readIfPresent(`${i}/${t}`)!==null)return i;i=dt(i)}return r}async function convertWithPreview(e,t,n){let r=t.target??`8.8`,i=nameOf$6(t.path),a;try{a=await Le(t.path,t.text,{target:r,forms:t.forms})}catch(t){return await e.notifyUser(p(`app.project.couldNotBeRead`,{name:i,reason:messageOf(t)}),!0),`nothing`}if(!a||!a.ok)return await e.notifyUser(p(`app.project.couldNotBeRead`,{name:i,reason:a?.failure??p(`app.project.notADiagramDecisionOrForm`)}),!0),`nothing`;if(!a.source)return await e.notifyUser(p(`app.project.isNotACamunda7`,{name:i})),`nothing`;if(!await e.unlock())return`locked`;let o=(await e.projectRoot()).replace(/[\\/]+$/,``),s=await sourceFolderOf(e,o,t.path),c=_(s,s===o),l=[{path:t.path,content:a.text},...a.files],u;try{u=await e.previewMigration({name:i,kind:kindOf(a.kind),beforeText:t.text,afterText:a.text,folder:c,files:l.map(e=>k(c,ce(s,c,e.path))),target:r,changes:a.changes.map(({where:e,before:t,after:n,plain:r})=>({where:e,before:t,after:n,...r?{plain:r}:{}})),open:a.open.map(e=>({where:e.where,title:e.title,action:e.action,manual:e.conversion===`manual`}))},n)}catch(t){return await e.notifyUser(p(`app.project.nothingWasWritten`,{failure:messageOf(t)}),!0),`refused`}if(u.choice===`CANCEL`)return`cancelled`;let d=u.folder.replace(/[\\/]+$/,``),f=l.map(e=>({absolute:ce(s,d,e.path),content:e.content})),m=0;try{let n=await Promise.all(f.map(async t=>await e.readIfPresent(t.absolute)!==null)),r=f.filter((e,t)=>n[t]);if(r.length>0&&!u.replace)throw Error(p(`app.project.alreadyThere`,{files:r.map(e=>k(o,e.absolute)).join(`, `),count:r.length}));let i=(await Promise.all(Sc.map(t=>e.readIfPresent(`${d}/${t}`)))).some(e=>e!==null),a=f.filter((e,t)=>!n[t]).map(e=>({path:k(o,e.absolute),content:e.content}));i||a.push({path:k(o,`${d}/${Sc[0]}`),content:we(await e.settings(t.path))});for(let t of r)await e.saveFile(t.absolute,t.content);a.length>0&&await e.createProjectFiles(o,a),m=r.length}catch(t){return await e.notifyUser(p(`app.project.nothingWasWritten`,{failure:messageOf(t)}),!0),`refused`}return await e.notifyUser([p(`app.project.wasConvertedForCamundaInto`,{name:i,target:r,folder:k(o,d)}),...m>0?[p(`app.project.filesReplaced`,{count:m})]:[],p(`app.project.thingsStayOpen`,{count:a.open.length})].join(` `)),`converted`}async function convertOpenDiagram(e,t){try{let n=Y(),{path:r,xml:i}=e;if(!r||!i){try{await n.notifyUser(p(`app.migration.saveTheDiagramFirstOnly`),!0)}catch{}return`nothing`}return await convertWithPreview(migrationHost(n,async()=>{try{return(await n.getProjectFiles())?.root??``}catch{return``}}),{path:r,text:i,forms:await projectForms()},t)}catch{return`nothing`}}function namesOf(e,t){let n=e?.get?.(`elementRegistry`);return(t??[]).map(e=>{let t=n?.get?.(e);return t?.businessObject?.name?.replace(/\s+/g,` `).trim()||(t?.type?Pe(t.type):e)})}function DefectRow({defect:e,rowKey:t,check:n,severity:r}){let i=n.selected===t;return u(`li`,{children:[u(`button`,{type:`button`,class:i?`diagram-check__row has-severity is-selected`:`diagram-check__row has-severity`,onClick:()=>n.pickDefect(e,t),onMouseEnter:()=>n.peek(e),onMouseLeave:()=>n.peek(null),onFocus:()=>n.peek(e),onBlur:()=>n.peek(null),title:e.detail,children:[u(Gr,{severity:r}),u(`span`,{class:`diagram-check__row-text`,children:[u(`span`,{class:`diagram-check__row-title`,children:e.title}),u(`span`,{class:`diagram-check__row-where`,children:e.where})]})]}),i&&u(RuleHelp,{family:`drawing`,name:e.kind})]})}function FindingsList({check:e}){let[t,r]=n(!1),[i,a]=n(!1),s=e?.flow??[],c=e?.flowUnlocked??!1,l=e?.defects??{error:[],readability:[]},d=e?.rules??[],f=e?.rulesFailure??null,m=e?.codeFindings??[],h=e?.namespaceFinding??null,g=e?.migration??null,_=e?.selected??null,v=e?.getModeler?.()??null,rowClass=e=>_===e?`diagram-check__row has-severity is-selected`:`diagram-check__row has-severity`;return u(o,{children:[c&&s.length>0&&u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:p(`app.diagramCheck.howItRuns`)}),u(`ul`,{class:`diagram-check__list`,children:s.map((t,n)=>u(`li`,{children:[u(`button`,{type:`button`,class:rowClass(`flow-${n}`),onClick:()=>e.pickFlow(t,`flow-${n}`),title:t.detail,children:[u(Gr,{severity:`error`}),u(`span`,{class:`diagram-check__row-text`,children:[u(`span`,{class:`diagram-check__row-title`,children:t.title}),u(`span`,{class:`diagram-check__row-where diagram-check__row-where--wrap`,children:t.detail}),t.trace.length>0&&u(`span`,{class:`diagram-check__row-where diagram-check__row-where--wrap`,children:p(`app.rules.web.path`,{path:namesOf(v,t.trace).join(` → `)})})]})]}),_===`flow-${n}`&&u(RuleHelp,{family:`flow`,name:t.kind})]},`flow-${n}`))})]}),!c&&e.flowCount>0&&u(`section`,{class:`diagram-check__group`,children:u(`button`,{type:`button`,class:`diagram-check__row diagram-check__upsell`,onClick:e.onUnlockFlow,children:[u(`span`,{class:`diagram-check__row-title`,children:p(`app.rules.web.flowAnalysisFound`,{count:e.flowCount})}),` `,u(`span`,{class:`diagram-check__row-where diagram-check__row-where--wrap`,children:p(`app.rules.web.flowAnalysisHint`)})]})}),l.error.length>0&&u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:p(`app.diagramCheck.drawing`)}),u(`ul`,{class:`diagram-check__list`,children:l.error.map((t,n)=>u(DefectRow,{defect:t,rowKey:`error-${n}`,check:e,severity:`error`},`error-${n}`))})]}),h&&u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:p(`app.diagramCheck.engine`)}),u(`ul`,{class:`diagram-check__list`,children:u(`li`,{children:u(`div`,{class:`diagram-check__row has-severity diagram-check__row--fix`,children:[u(Gr,{severity:`error`}),u(`div`,{class:`diagram-check__row-text`,children:[u(`span`,{class:`diagram-check__row-title`,children:h.title}),u(`span`,{class:`diagram-check__row-where diagram-check__row-where--wrap`,children:h.message})]}),u(`button`,{type:`button`,class:`ui-button`,onClick:h.fix,children:p(`app.diagramCheck.fix`)})]})})})]}),m.some(e=>e.kind!==`template-rejected`)&&u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:p(`app.diagramCheck.code`)}),u(`ul`,{class:`diagram-check__list`,children:m.map((t,n)=>t.kind===`template-rejected`?null:u(`li`,{children:u(`button`,{type:`button`,class:rowClass(`code-${n}`),onClick:()=>e.pickCode(t,`code-${n}`),children:[u(Gr,{severity:t.severity}),u(`span`,{class:`diagram-check__row-text`,children:[u(`span`,{class:`diagram-check__row-title`,children:t.title}),u(`span`,{class:`diagram-check__row-where diagram-check__row-where--wrap`,children:t.where})]})]})},`code-${n}`))})]}),m.some(e=>e.kind===`template-rejected`)&&u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:p(`app.diagramCheck.templates`)}),u(`ul`,{class:`diagram-check__list`,children:m.map((e,t)=>e.kind===`template-rejected`?u(`li`,{children:u(`div`,{class:`diagram-check__row has-severity`,children:[u(Gr,{severity:e.severity}),u(`span`,{class:`diagram-check__row-text`,children:[u(`span`,{class:`diagram-check__row-title`,children:e.title}),u(`span`,{class:`diagram-check__row-where diagram-check__row-where--wrap`,children:e.where})]})]})},`template-${t}`):null)})]}),(d.length>0||f)&&u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:p(`app.diagramCheck.rules`)}),f&&u(`p`,{class:`diagram-check__row-where diagram-check__row-where--wrap diagram-check__note`,children:p(`app.rules.web.rulesCouldNotRun`,{failure:f})}),u(`ul`,{class:`diagram-check__list`,children:d.map((t,n)=>u(`li`,{children:[u(`button`,{type:`button`,class:rowClass(`rule-${n}`),onClick:()=>e.pickRule(t,`rule-${n}`),title:t.rule,children:[u(Gr,{severity:t.severity===`error`?`error`:`warning`}),u(`span`,{class:`diagram-check__row-text`,children:[u(`span`,{class:`diagram-check__row-title`,children:t.message}),u(`span`,{class:`diagram-check__row-where diagram-check__row-where--wrap`,children:[...namesOf(v,t.elements),t.rule].join(` · `)})]})]}),_===`rule-${n}`&&u(RuleHelp,{family:t.rule.startsWith(`compat/`)?`compat`:t.rule.startsWith(`engine/`)?`engine`:`bpmnlint`,name:t.rule})]},`rule-${n}`))})]}),g&&u(`section`,{class:`diagram-check__group diagram-check__migration`,children:[u(`div`,{class:`diagram-check__migration-bar`,children:[u(`h3`,{class:`diagram-check__heading`,children:p(`app.rules.web.migrateToCamunda8`)}),u(`button`,{type:`button`,class:`ui-button ui-button--primary`,onClick:g.onConvert,title:p(`app.diagramCheck.showTheDiagramConvertedFor`,{target:g.target}),children:p(`app.diagramCheck.convert`)})]}),g.failure&&u(`p`,{class:`diagram-check__row-where diagram-check__row-where--wrap diagram-check__note`,children:g.failure}),g.findings&&g.findings.length===0&&u(`p`,{class:`diagram-check__note`,children:p(`app.rules.web.nothingToConvert`)}),g.findings&&g.findings.length>0&&u(`p`,{class:`diagram-check__row-where diagram-check__row-where--wrap diagram-check__note`,children:migrationTallyText(migrationTally(g.findings))}),migrationSections(g.findings??[]).map(t=>u(`div`,{children:[t.collapsed?u(`button`,{type:`button`,class:`diagram-check__heading diagram-check__toggle`,onClick:()=>a(e=>!e),"aria-expanded":i,children:[t.title,` (`,t.findings.length,`)`]}):u(`h4`,{class:`diagram-check__heading`,children:[t.title,` (`,t.findings.length,`)`]}),(!t.collapsed||i)&&u(`ul`,{class:`diagram-check__list`,children:t.findings.map((n,r)=>u(`li`,{children:u(`button`,{type:`button`,class:rowClass(`migration-${t.title}-${r}`),onClick:()=>e.pickElements(n.elements,`migration-${t.title}-${r}`),title:n.detail,children:[u(Gr,{severity:`warning`}),u(`span`,{class:`diagram-check__row-text`,children:[u(`span`,{class:`diagram-check__row-title`,children:n.title}),u(`span`,{class:`diagram-check__row-where diagram-check__row-where--wrap`,children:[n.where,`. `,n.action]})]})]})},`${t.title}-${r}`))})]},t.title))]}),l.readability.length>0&&u(`section`,{class:`diagram-check__group`,children:[u(`button`,{type:`button`,class:`diagram-check__heading diagram-check__toggle`,onClick:()=>r(e=>!e),"aria-expanded":t,children:p(`app.rules.web.readability`,{number:l.readability.length})}),t&&u(`ul`,{class:`diagram-check__list`,children:l.readability.map((t,n)=>u(DefectRow,{defect:t,rowKey:`readability-${n}`,check:e,severity:`warning`},`readability-${n}`))})]})]})}function ProblemsTab({check:e,clientFacts:t}){let{counts:n}=e,r=!e.clean||e.migration!==null||n.readability>0;return u(`div`,{class:`problems`,children:[u(`header`,{class:`problems__bar`,children:[u(`span`,{class:`problems__count`,children:e.enabled&&e.checked>0&&r?gn(n,e.rulesFailure):``}),u(`button`,{type:`button`,class:`ui-button`,onClick:e.run,title:p(`app.common.checkAgain`),children:p(`app.common.recheck`)})]}),(!e.enabled||e.checked===0)&&u($,{title:p(`app.problems.waiting`),hint:p(`app.diagramCheck.theCheckStartsOnIts`),guide:`problems`}),e.enabled&&e.checked>0&&!r&&($t(t)?u(un,{facts:t}):u($,{title:p(`app.diagramCheck.noProblemsFound`),hint:p(`app.diagramCheck.nothingToReportAcrossElements`,{checked:e.checked}),guide:`problems`})),u(FindingsList,{check:e})]})}var Cc=60;function boxGap(e,t){let n=Math.max(0,e.x-(t.x+t.width),t.x-(e.x+e.width)),r=Math.max(0,e.y-(t.y+t.height),t.y-(e.y+e.height));return Math.round(Math.hypot(n,r))}function pathSegments(e){let t=[];for(let n=1;n<e.length;n++)t.push([e[n-1],e[n]]);return t}function segmentsCross(e,t,n,r){let i=e.y===t.y;if(i===(n.y===r.y))return!1;let[a,o,s,c]=i?[e,t,n,r]:[n,r,e,t],l=a.y,u=s.x,d=Math.min(a.x,o.x),f=Math.max(a.x,o.x),p=Math.min(s.y,c.y),m=Math.max(s.y,c.y);return u>d+.5&&u<f-.5&&l>p+.5&&l<m-.5}var wc=300,Tc=2,Ec=40,Dc=[`DANGLING-CONNECTION`,`LOST-CONNECTION`,`CONTAINMENT`,`OVERLAP`,`EDGE-THROUGH-NODE`,`EDGE-THROUGH-BOUNDARY`,`CROSSING`,`DETACHED-EDGE`,`BOUNDARY-OFF-HOST`,`LABEL-ADRIFT`,`DIAGONAL-EDGE`,`LABEL-OVERLAP`,`MERGED-EDGE`,`NOTE-ADRIFT`,`SEMANTIC-DRIFT`,`BACKTRACK`,`EDGE-THROUGH-LABEL`,`EDGE-ALONG-SHAPE`,`DETOUR`,`JOG`];function countsOf$2(e){return Object.fromEntries(Dc.map(t=>[t,e.filter(e=>e.kind===t).length]))}e(countsOf$2,`countsOf`);function wiringOf(e){return`${e.source?.id??``}>${e.target?.id??``}`}function measureElements(e,t,n={}){let{before:r,modelDefects:i,log:a,settled:o}=n,bothSettled=(e,t)=>!!o&&o.has(e.id)&&o.has(t.id);function*pairsOf(e){let t=o?e.map((e,t)=>o.has(e.id)?-1:t).filter(e=>e>=0):[];for(let n=0;n<e.length;n++)if(o&&o.has(e[n].id))for(let r of t)r>n&&(yield[e[n],e[r]]);else for(let t=n+1;t<e.length;t++)yield[e[n],e[t]]}let s=[],note=e=>a?.(e),record=(e,t,n)=>{s.push({kind:e,detail:t,elements:n}),note(`${e}: ${t}`)},c=findDuplicateConnections(t),l=t.filter(e=>!c.includes(e)),u=e.filter(e=>!isConnection(e)&&!isLabelLike(e)&&!isBoundaryEvent(e)&&e.type!==`bpmn:Lane`),d=e.filter(isBoundaryEvent);r&&[...e.map(e=>[e,`parent:${e.parent?.id??``}`]),...t.map(e=>[e,`wire:${wiringOf(e)}`])].forEach(([e,t])=>{let n=r.get(e.id);n!==void 0&&n!==t&&record(`SEMANTIC-DRIFT`,p(`app.rules.defects.semanticDrift`,{id:e.id,was:n,now:t}),[e.id])});let f=1/0,m=1/0,h=-1/0,g=-1/0;u.forEach(e=>{f=Math.min(f,e.x),m=Math.min(m,e.y),h=Math.max(h,e.x+e.width),g=Math.max(g,e.y+e.height)});let _=u.length===0?{width:0,height:0}:{width:Math.round(h-f),height:Math.round(g-m)};note(`bounding box: ${_.width} x ${_.height}`);let chainOf=e=>{let t=new Set,n=e?.parent;for(;n;)t.add(n.id),n=n.parent;return t};i&&s.push(...i);let v=0,y=[...u,...d];for(let[e,t]of pairsOf(y)){if(e.host?.id===t.id||t.host?.id===e.id||chainOf(e).has(t.id)||chainOf(t).has(e.id)||e.type===`bpmn:Group`||t.type===`bpmn:Group`)continue;let n=new Set([`bpmn:TextAnnotation`,`bpmn:Group`]),r=new Set([`bpmn:Participant`,`bpmn:Lane`,`bpmn:SubProcess`]);if(n.has(e.type??``)&&r.has(t.type??``)||n.has(t.type??``)&&r.has(e.type??``))continue;let i=e.type===`bpmn:Participant`&&t.type===`bpmn:Participant`,a=new Set([`bpmn:TextAnnotation`,`bpmn:DataObjectReference`,`bpmn:DataStoreReference`]),o=a.has(e.type??``)||a.has(t.type??``);(i||o||e.parent===t.parent||e.type===`bpmn:Participant`||t.type===`bpmn:Participant`)&&rectsOverlap(e,t)&&(record(`OVERLAP`,p(`app.rules.defects.overlap`,{a:e.id,b:t.id}),[e.id,t.id]),v++)}note(v===0?`no overlaps`:`${v} overlap(s) found`);let ancestorIds=e=>{let t=new Set,n=e?.parent;for(;n;)t.add(n.id),n=n.parent;return t},b=new Set([`bpmn:TextAnnotation`,`bpmn:Group`]),covers=(e,t)=>!!e&&b.has(e.type??``)&&e.x>=t.x&&e.y>=t.y&&e.x+e.width<=t.x+t.width&&e.y+e.height<=t.y+t.height,x=0;l.forEach(e=>{if(!e.waypoints||e.waypoints.length<2)return;let t=pathSegments(e.waypoints),n=ancestorIds(e.source),r=ancestorIds(e.target);u.forEach(i=>{i.id!==e.source?.id&&i.id!==e.target?.id&&(bothSettled(e,i)||n.has(i.id)||r.has(i.id)||b.has(i.type??``)||covers(e.source,i)||covers(e.target,i)||t.forEach(([t,n])=>{segmentCrossesBox(t,n,i,2)&&(record(`EDGE-THROUGH-NODE`,p(`app.rules.defects.edgeThroughNode`,{connection:e.id,shape:i.id}),[e.id,i.id]),x++)}))})}),note(x===0?`no edges cut through nodes`:`${x} violation(s) found`);let S=0;l.forEach(e=>{if(!e.waypoints||e.waypoints.length<2)return;let t=pathSegments(e.waypoints);d.forEach(n=>{n.id!==e.source?.id&&n.id!==e.target?.id&&t.some(([e,t])=>segmentCrossesBox(e,t,n,2))&&(record(`EDGE-THROUGH-BOUNDARY`,p(`app.rules.defects.edgeThroughBoundary`,{connection:e.id,event:n.id,host:n.host?.id}),[e.id,n.id]),S++)})}),note(S===0?`no edges through boundary events`:`${S} edge(s) through a boundary event`);let C=0;for(let[e,t]of pairsOf(l)){let n=pathSegments(e.waypoints||[]),r=pathSegments(t.waypoints||[]),i=!1;n.forEach(([n,a])=>{r.forEach(([r,o])=>{!i&&segmentsCross(n,a,r,o)&&(i=!0,record(`CROSSING`,p(`app.rules.defects.crossing`,{aType:e.type,bType:t.type,a:e.id,aFrom:e.source?.id,aTo:e.target?.id,b:t.id,bFrom:t.source?.id,bTo:t.target?.id}),[e.id,t.id]),C++)})})}note(C===0?`no crossings`:`${C} crossing(s) found`);let w=0;for(let[e,t]of pairsOf(l)){let n=mergedRuns(e.waypoints||[],t.waypoints||[]),r=n.across+n.down;r<40||(record(`MERGED-EDGE`,p(`app.rules.defects.mergedEdge`,{aType:e.type,bType:t.type,axis:n.across>=n.down?`across`:`down`,a:e.id,aFrom:e.source?.id,aTo:e.target?.id,b:t.id,bFrom:t.source?.id,bTo:t.target?.id,run:Math.round(r)}),[e.id,t.id]),w++)}note(w===0?`no merged edges`:`${w} merged edge pair(s) found`);let T=u.filter(e=>(e.children??[]).filter(e=>!isConnection(e)).length===0),segmentClear=(e,t,n)=>!T.some(r=>r.id!==n.source?.id&&r.id!==n.target?.id&&segmentCrossesBox(e,t,r,2)),E=0;l.forEach(e=>{if(e.type!==`bpmn:Association`&&e.type!==`bpmn:DataInputAssociation`&&e.type!==`bpmn:DataOutputAssociation`)return;let t=e.waypoints??[];if(t.length<2)return;let n=pathLength(t);n<=wc||(record(`NOTE-ADRIFT`,p(`app.rules.defects.noteAdrift`,{id:e.id,from:e.source?.id,to:e.target?.id,span:Math.round(n)}),[e.id]),E++)}),note(E===0?`no notes adrift`:`${E} note(s) adrift`);let D=0;l.forEach(e=>{let t=backtracksIn(e.waypoints||[]);for(let n=0;n<t;n++)record(`BACKTRACK`,p(`app.rules.defects.wire`,{id:e.id,from:e.source?.id,to:e.target?.id}),[e.id]),D++}),note(D===0?`no backtracks`:`${D} backtrack(s) found`);let O=0,k=e.filter(e=>e.label&&e.label.width>0&&e.label.height>0).map(e=>({owner:e,rect:e.label}));l.forEach(e=>{let t=pathSegments(e.waypoints||[]);k.forEach(({owner:n,rect:r})=>{n.id!==e.id&&t.some(([e,t])=>segmentCrossesBox(e,t,r,1))&&(record(`EDGE-THROUGH-LABEL`,p(`app.rules.defects.edgeOverLabel`,{connection:e.id,owner:n.id}),[e.id,n.id]),O+=1)})}),note(O===0?`no edges over labels`:`${O} edge(s) over a label`);let A=0,j=o?u.filter(e=>!o.has(e.id)):[];l.forEach(e=>{let t=e.waypoints||[],n=new Set([e.source?.id,e.target?.id,...ancestorIds(e.source),...ancestorIds(e.target)]),r=!!o&&o.has(e.id),grazing=(e,t)=>!n.has(e.id)&&!b.has(e.type??``)&&grazesBox(t,e);for(let n=0;n+1<t.length;n++){let i=axisRun(t[n],t[n+1]);if(!i||r&&!j.some(e=>grazing(e,i)))continue;let a=u.find(e=>grazing(e,i));a&&!(r&&o.has(a.id))&&(record(`EDGE-ALONG-SHAPE`,p(`app.rules.defects.edgeAlongShape`,{connection:e.id,shape:a.id}),[e.id,a.id]),A+=1)}}),note(A===0?`no edges along a shape border`:`${A} edge(s) along a shape border`);let M=0;l.forEach(e=>{let t=e.waypoints??[];if(t.length<2||!e.source||!e.target||e.type!==`bpmn:MessageFlow`&&e.type!==`bpmn:SequenceFlow`)return;let n=pathLength(t),r=Math.abs(e.source.x+e.source.width/2-(e.target.x+e.target.width/2))+Math.abs(e.source.y+e.source.height/2-(e.target.y+e.target.height/2));r<Ec||n<=r*Tc||(record(`DETOUR`,p(`app.rules.defects.detour`,{type:e.type,id:e.id,run:Math.round(n),apart:Math.round(r)}),[e.id]),M++)}),note(M===0?`no detours`:`${M} detour(s) found`);let N=0;l.forEach(e=>{let seatOk=(t,n)=>{let r=n===0?e.source:e.target;return!r||withinRect(t,r,2)},t=jogsIn(e.waypoints||[],(t,n)=>segmentClear(t,n,e),40,seatOk);for(let n=0;n<t;n++)record(`JOG`,p(`app.rules.defects.typedWire`,{type:e.type,id:e.id,from:e.source?.id,to:e.target?.id}),[e.id]),N++}),note(N===0?`no jogs`:`${N} jog(s) found`);let onShape=(e,t)=>{if(!t)return!0;let n=t.waypoints;if(n&&n.length>=2){for(let t=0;t+1<n.length;t++){let r=projectOnSegment(e,n[t],n[t+1]);if(Math.abs(r.x-e.x)<=2&&Math.abs(r.y-e.y)<=2)return!0}return!1}return withinRect(e,t,2)},P=0,F=0;l.forEach(e=>{let t=e.waypoints;if(!(!t||t.length<2)){onShape(t[0],e.source)&&onShape(t[t.length-1],e.target)||(record(`DETACHED-EDGE`,p(`app.rules.defects.wire`,{id:e.id,from:e.source?.id,to:e.target?.id}),[e.id]),P++);for(let n=0;n+1<t.length;n++)if(Math.abs(t[n].x-t[n+1].x)>.5&&Math.abs(t[n].y-t[n+1].y)>.5){record(`DIAGONAL-EDGE`,p(`app.rules.defects.wire`,{id:e.id,from:e.source?.id,to:e.target?.id}),[e.id]),F++;break}}}),note(P===0?`no detached edges`:`${P} detached edge(s) found`),note(F===0?`no diagonal edges`:`${F} diagonal edge(s) found`);let I=0,L=y.filter(e=>e.type===`bpmn:Participant`||e.type===`bpmn:SubProcess`||e.type===`bpmn:Lane`);y.forEach(e=>{if(e.type===`bpmn:Participant`||e.type===`bpmn:Lane`)return;let t=chainOf(e);L.forEach(n=>{if(n.id===e.id||e.host?.id===n.id||chainOf(n).has(e.id))return;let r=rectEncloses(n,e),i=rectClears(e,n);if(e.type===`bpmn:Group`)return;let a=e.type===`bpmn:TextAnnotation`;(a?!r&&!i:t.has(n.id)?!r:!i)&&(record(`CONTAINMENT`,p(`app.rules.defects.containment`,{id:e.id,relation:a?p(`app.rules.defects.straddles`):t.has(n.id)?p(`app.rules.defects.outsideIts`):p(`app.rules.defects.insideForeign`),box:n.id}),[e.id,n.id]),I++)})}),note(I===0?`containment ok`:`${I} containment break(s)`),y.filter(isBoundaryEvent).forEach(e=>{let t=e.host;if(!t)return;let n=e.x+e.width/2,r=e.y+e.height/2,i=Math.abs(n-t.x)<=2||Math.abs(n-(t.x+t.width))<=2,a=Math.abs(r-t.y)<=2||Math.abs(r-(t.y+t.height))<=2,o=n>=t.x-2&&n<=t.x+t.width+2,s=r>=t.y-2&&r<=t.y+t.height+2;i&&s||a&&o||record(`BOUNDARY-OFF-HOST`,p(`app.rules.defects.boundaryOffHost`,{event:e.id,host:t.id}),[e.id,t.id])}),y.filter(e=>e.label).forEach(e=>{let t=e.label;t.x+t.width>=e.x-Cc&&t.x<=e.x+e.width+Cc&&t.y+t.height>=e.y-Cc&&t.y<=e.y+e.height+Cc||record(`LABEL-ADRIFT`,p(`app.rules.defects.labelFromShape`,{id:e.id,gap:boxGap(e,t)}),[e.id])}),l.filter(e=>e.label).forEach(e=>{let t=e.label,n=e.waypoints??[];if(n.length<2)return;let r=t.x+t.width/2,i=t.y+t.height/2,a=1/0;for(let e=0;e+1<n.length;e++){let t=projectOnSegment({x:r,y:i},n[e],n[e+1]);a=Math.min(a,Math.abs(r-t.x)+Math.abs(i-t.y))}a>Cc&&record(`LABEL-ADRIFT`,p(`app.rules.defects.labelFromLine`,{id:e.id,gap:Math.round(a)}),[e.id])});let R=[...y,...l].filter(e=>e.label&&e.type!==`bpmn:Group`).map(e=>({owner:e,rect:e.label})),z=0;R.forEach(({owner:e,rect:t},n)=>{y.forEach(n=>{let r=ancestorIds(e).has(n.id)||ancestorIds(e.source).has(n.id)||ancestorIds(e.target).has(n.id),i=e.type===`bpmn:TextAnnotation`||e.type===`bpmn:Group`,a=[`bpmn:Participant`,`bpmn:Lane`,`bpmn:SubProcess`].includes(n.type??``);n.id===e.id||r||n.type===`bpmn:Group`||i&&a||rectsOverlap(t,n)&&(record(`LABEL-OVERLAP`,p(`app.rules.defects.labelOverShape`,{owner:e.id,shape:n.id}),[e.id,n.id]),z++)}),R.slice(n+1).forEach(n=>{bothSettled(e,n.owner)||rectsOverlap(t,n.rect)&&(record(`LABEL-OVERLAP`,p(`app.rules.defects.labelOverLabel`,{owner:e.id,other:n.owner.id}),[e.id,n.owner.id]),z++)})}),note(z===0?`no label overlaps`:`${z} label overlap(s) found`);let B=l.filter(e=>e.type===`bpmn:SequenceFlow`&&(e.waypoints?.length??0)>1);if(B.length>0){let compass=(e,t)=>{let n=(Math.atan2(-(t.y-e.y),t.x-e.x)*180/Math.PI+360)%360,near=e=>Math.min(Math.abs(n-e),360-Math.abs(n-e))<=67.5,r=[`E`,`N`,`W`,`S`].filter((e,t)=>near(t*90));return r.length?r:[`E`]},e=new Map;B.forEach(t=>{let n=t.waypoints;compass(n[0],n[n.length-1]).forEach(t=>e.set(t,(e.get(t)??0)+1))});let t=[...e.entries()].sort((e,t)=>t[1]-e[1])[0][0],n=B.filter(e=>{let n=e.waypoints;return compass(n[0],n[n.length-1]).includes(t)}).length,r=B.reduce((e,t)=>e+pathLength(t.waypoints),0),i=B.reduce((e,t)=>e+Math.max(0,t.waypoints.length-2),0),a=y.filter(e=>e.width>0&&e.height>0),o=Math.min(...a.map(e=>e.x)),s=Math.min(...a.map(e=>e.y)),c=Math.max(...a.map(e=>e.x+e.width)),l=Math.max(...a.map(e=>e.y+e.height));note(`readability: cons=${(n/B.length).toFixed(2)} span=${Math.round(r/B.length)} bends=${(i/B.length).toFixed(2)} shape=${((c-o)/(l-s)).toFixed(2)}`)}let V=countsOf$2(s),H={edges:0,bends:0,length:0,forward:0,area:_.width*_.height};return l.forEach(e=>{let t=e.waypoints??[];t.length<2||(H.edges+=1,H.bends+=t.length-2,H.length+=pathLength(t),t[t.length-1].x>=t[0].x&&(H.forward+=1))}),H.length=Math.round(H.length),note(`quality: bends=${(H.bends/Math.max(1,H.edges)).toFixed(2)} length=${Math.round(H.length/Math.max(1,H.edges))} forward=${Math.round(100*H.forward/Math.max(1,H.edges))}%`),{defects:s,counts:V,box:_,quality:H}}var Oc=new Set([`DANGLING-CONNECTION`,`LOST-CONNECTION`,`SEMANTIC-DRIFT`]);function labelOf$1(e,t){let n=(e?.businessObject)?.name?.trim();if(n)return n;let r=e?.type?.replace(`bpmn:`,``);return r?p(`app.rules.drawing.theElement`,{type:ve(r)}):t}e(labelOf$1,`labelOf`);function nameOf$5(e,t){let n=e.get(t),r=(n?.businessObject)?.name?.trim();if(r)return r;if(n&&isConnection(n)){let e=labelOf$1(n.source,n.source?.id??``),t=labelOf$1(n.target,n.target?.id??``);return p(`app.rules.drawing.theConnection`,{from:e,to:t})}return labelOf$1(n,t)}e(nameOf$5,`nameOf`);function checkDiagram(e){let t={defects:[],errors:0,readability:0,checkedElements:0};if(!e)return t;let n,r,i,a;try{if(n=e.get(`elementRegistry`),!n)return t;let o=n.getAll();if(r=o.filter(e=>!isConnection(e)&&!isLabelLike(e)&&!!e.parent),i=o.filter(isConnection),!r.length&&!i.length)return t;a=measureElements(r,i)}catch{return t}let o=n,s=a.defects.filter(e=>!Oc.has(e.kind)).map(e=>({kind:e.kind,severity:P(`drawing`,e.kind)?.severity===`error`?`error`:`readability`,title:ge(`drawing`,e.kind),detail:e.detail,where:ot(e.elements.map(e=>nameOf$5(o,e))),elements:e.elements}));return{defects:s,errors:s.filter(e=>e.severity===`error`).length,readability:s.filter(e=>e.severity===`readability`).length,checkedElements:r.length+i.length}}var kc=`diagram-check-flag`,Ac=`diagram-check-hit`,jc=`diagram-check-peek`;function withCanvas(e){if(!e)return null;try{let t=e.get(`canvas`),n=e.get(`elementRegistry`);return!t||!n?null:{canvas:t,registry:n}}catch{return null}}function shapeFor(e,t){return e.get(t)||e.getAll().find(e=>{let n=e.businessObject?.processRef;return e.type===`bpmn:Participant`&&n?.id===t})}function markElements(e,t,n){let r=withCanvas(e);r&&t.forEach(e=>{let t=shapeFor(r.registry,e);t&&r.canvas.addMarker(t,n)})}function clearMarker(e,t){let n=withCanvas(e);n&&n.registry.getAll().forEach(e=>n.canvas.removeMarker(e,t))}function focusDefect(e,t){let n=withCanvas(e);if(!n||!t.length)return;let r=t.map(e=>shapeFor(n.registry,e)).filter(e=>!!e);if(r.length){clearMarker(e,Ac),markElements(e,t,Ac);try{n.canvas.scrollToElement(r[0],{top:140,right:440,bottom:400,left:140}),(e?.get(`selection`))?.select(r)}catch{return}}}var Mc=`diagram-check-trace`,Nc=`diagram-check-migration`,Pc={defects:[],errors:0,readability:0,checkedElements:0};function flowProblemsOf(e){let t=e?.getDefinitions?.();if(!t)return[];try{return de(t).problems}catch(e){return console.error(`Flow analysis failed:`,e),[]}}function useDiagramCheck({enabled:e,getModeler:t,flowUnlocked:i,onUnlockFlow:a,loadRules:o,codeFindings:c=[],namespaceFinding:u=null,migration:d=null,onReveal:p}){let[m,h]=n(Pc),[g,_]=n([]),[v,y]=n([]),[b,x]=n(null),[S,C]=n(null),w=s(!0),T=r(()=>{let e=t(),n=checkDiagram(e);clearMarker(e,kc),n.defects.filter(e=>e.severity===`error`).forEach(t=>markElements(e,t.elements,kc));let r=flowProblemsOf(e);i&&r.forEach(t=>markElements(e,t.elements,kc)),h(n),_(r);let a=e?.getDefinitions?.();a&&o(a).then(e=>Tn(a,e)).then(t=>{w.current&&(t.filter(e=>e.severity===`error`).forEach(t=>markElements(e,t.elements,kc)),y(t),x(null))}).catch(e=>{w.current&&(y([]),x(e instanceof Error?e.message:String(e)))})},[t,i,o]);f(()=>{if(w.current=!0,!e)return;T();let n=t()?.get(`eventBus`);if(!n)return;let r,handler=()=>{r&&clearTimeout(r),r=setTimeout(T,400)};return n.on(`elements.changed`,handler),n.on(`import.done`,handler),()=>{w.current=!1,r&&clearTimeout(r),n.off(`elements.changed`,handler),n.off(`import.done`,handler);let e=t();e&&[kc,Ac,jc,Mc,Nc].forEach(t=>clearMarker(e,t))}},[e,T,t]),f(()=>{let n=t();if(clearMarker(n,Nc),e&&d?.findings)return migrationSections(d.findings).filter(e=>!e.collapsed).forEach(e=>e.findings.forEach(e=>markElements(n,e.elements,Nc))),()=>clearMarker(t(),Nc)},[e,d?.findings,t]);let E=l(()=>Fn(v,m.defects),[v,m.defects]),D=l(()=>{let bySeverity=e=>m.defects.filter(t=>t.severity===e);return{error:bySeverity(`error`),readability:bySeverity(`readability`)}},[m]),O=r((e,n)=>{C(n),focusDefect(t(),e.elements)},[t]),k=r((e,n)=>{C(n);let r=t();clearMarker(r,Mc),markElements(r,e.trace,Mc),focusDefect(r,[...new Set([...e.trace,...e.elements])])},[t]),A=r((e,n)=>{C(n),focusDefect(t(),e.elements),p?.(e.rule,e.elements)},[t,p]),j=r((e,n)=>{C(n),focusDefect(t(),e.elements),p?.(e.kind,e.elements)},[t,p]),M=r((e,n)=>{C(n),focusDefect(t(),e)},[t]),N=r((e,n)=>{C(n),focusDefect(t(),e.elements),e.rule&&p?.(e.rule,e.elements)},[t,p]),P=r(e=>{let n=t();clearMarker(n,jc),e&&markElements(n,e.elements,jc)},[t]),F=g.filter(e=>e.kind!==`TOO-COMPLEX`).length,I=E.filter(e=>e.severity===`error`).length,L=tr({defects:m.errors,ruleErrors:I,ruleWarnings:E.length-I,flowCount:F,flowUnlocked:i,code:c,namespace:!!u,readability:m.readability}),R=L.errors===0&&L.warnings===0&&!b&&(F===0||!i)&&!u,z=l(()=>rr([D.error.map(e=>({severity:`error`,title:e.title,where:e.where,elements:e.elements})),i?g.filter(e=>e.kind!==`TOO-COMPLEX`).map(e=>({severity:`error`,title:e.title,where:e.detail,elements:e.elements})):[],u?[{severity:`error`,title:u.title,where:u.message,elements:[]}]:[],c.map(e=>({severity:e.severity,title:e.title,where:e.where,elements:e.elements,rule:e.kind})),E.map(e=>({severity:e.severity===`error`?`error`:`warning`,title:e.message,where:namesOf(t(),e.elements).join(` · `),elements:e.elements,rule:e.rule}))],3),[D,g,i,u,c,E,t]);return{enabled:e,checked:m.checkedElements,defects:D,flow:g,flowCount:F,flowUnlocked:i,onUnlockFlow:a,rules:E,rulesFailure:b,codeFindings:c,namespaceFinding:u,migration:d,counts:L,clean:R,card:z,selected:S,run:T,getModeler:t,pickDefect:O,pickFlow:k,pickRule:A,pickCode:j,pickElements:M,pickSummary:N,peek:P}}var Fc={"camunda-7":`Camunda 7`,"camunda-8":`Camunda 8`,operaton:`Operaton`,"cib-seven":`CIB seven`,flowable:`Flowable`,activiti:`Activiti`};function isLocal(e){if(!e)return!1;try{let t=new URL(e).hostname;return t===`localhost`||t===`127.0.0.1`||t===`::1`||t===`[::1]`}catch{return!1}}function engineLabel(e,t,n){let r=e?e.toLowerCase().replace(/_/g,`-`):null,i=r?Fc[r]??e:null,a=i?isLocal(n)?p(`app.live.localEngine`,{engine:i}):i:null;return t&&a?t===r?a:`${t} (${a})`:t??a??p(`app.live.theEngine`)}function versionText(e){let t=(e??[]).filter(e=>e?.deployed&&e?.version!==null&&e?.version!==void 0);return t.map(e=>t.length===1?p(`app.live.processVersion`,{version:e.version}):p(`app.live.namedProcessVersion`,{process:e.processId,version:e.version}))}function groupIncidents(e){let t=new Map;return(e??[]).forEach(e=>{if(!e)return;let n=e.elementId??``,r=e.message??``,i=e.type??``,a=e.instance??``,o=e.id,s=`${n}\u0000${r||i}`,c=t.get(s);if(c)c.count+=1,c.instance||=a,!c.id&&o&&(c.id=o);else{let e={elementId:n,message:r,type:i,count:1,instance:a};o&&(e.id=o),t.set(s,e)}}),[...t.values()]}function incidentLine(e){let t=e?.message||e?.type||``,n=e?.count??1;return n===1?t:p(`app.live.incidentsOn`,{count:n,what:t})}function problemText$1(e){return e instanceof Error?e.message:String(e)}e(problemText$1,`problemText`);function silent(){return{result:null,warnings:[],secret:!1,secrets:[],problem:null,why:null}}function resultText(e){if(!e)return``;if(e.problem)return e.problem;let t;try{t=e.result===null?`null`:typeof e.result==`string`?e.result:JSON.stringify(e.result)}catch{t=String(e.result)}return e.secret?p(`app.live.secretNotResolved`,{value:t}):t}function useLiveTrial(e,t,i,a){let[o,c]=n([]),[u,d]=n(null),[p,m]=n(!1),[h,g]=n(null),[_,v]=n(new Map),[y,b]=n(null),[x,S]=n(null),[C,w]=n(null),[T,E]=n(!1),[D,O]=n(null),[k,A]=n(null),[j,M]=n(!1),[P,F]=n([]),[I,L]=n([]),R=s(0),z=e?.ask,B=e?.engineKind,V=(e?.state?.processes??[]).find(e=>e?.deployed&&e?.key)??null,U=V?.key??null,ee=B===`CAMUNDA_7`?V?.processId??null:U,te=l(()=>{try{return B?gr(B):null}catch{return null}},[B]);f(()=>{if(!a||!z||!B||!ee){c([]),d(null);return}let e=!1;return m(!0),mr(B,ee,z).then(t=>{e||(c(t),d(null))}).catch(t=>{e||(c([]),d(problemText$1(t)))}).finally(()=>!e&&m(!1)),()=>{e=!0}},[z,a,B,ee]),f(()=>{let read=()=>{try{let e=t?.getDefinitions?.();F(e?N(e):[]),L(e?H(e).uses:[])}catch{F([]),L([])}};read();try{t?.on?.(`commandStack.changed`,read)}catch{}return()=>{try{t?.off?.(`commandStack.changed`,read)}catch{}}},[t]);let W=l(()=>{try{return((i?t?.get?.(`elementRegistry`)?.get?.(i):null)?.outgoing??[]).map(e=>String(e?.id??``)).filter(Boolean)}catch{return[]}},[t,i]),G=r(e=>{R.current+=1,E(!1),g(t=>t===e?null:e),v(new Map),S(null),w(null)},[]),K=r(async()=>{if(!z||!B||!h)return;let e=R.current+=1,mineStill=()=>R.current===e;E(!0);try{let e=await fr(B,h,z);if(!mineStill())return;S(e),w(null)}catch(e){if(!mineStill())return;S(null),w(problemText$1(e))}finally{mineStill()&&E(!1)}},[z,B,h]),ne=r(async e=>{if(!z||!B||!h)return;let t=R.current+=1,mineStill=()=>R.current===t;b(e);try{let t=await fr(B,h,z);if(!mineStill())return;S(t),w(null);let n=await hr(B,e,t,z);if(!mineStill())return;v(t=>new Map(t).set(e,{outcome:n,variables:null}))}catch(t){if(!mineStill())return;v(n=>new Map(n).set(e,{outcome:{...silent(),problem:problemText$1(t)},variables:null}))}finally{mineStill()&&b(null)}},[z,B,h]),re=r(async()=>{if(z&&B&&U&&te?.names){M(!0),A(null);try{O(await dr(B,U,z))}catch(e){O(null),A(problemText$1(e))}finally{M(!1)}}},[z,B,U,te?.names]);return f(()=>{Ln({instance:h,kind:B,ask:z,trying:y,run:ne,results:new Map([..._].map(([e,t])=>[e,t.outcome]))})},[z,h,B,_,y,ne]),{instances:o,instancesProblem:u,askingInstances:p,instance:h,pick:G,pickable:!!(a&&z&&U),selected:i,selectedExpressions:i?P.filter(e=>e.elementId===i||W.includes(e.elementId)):[],uses:I,results:_,trying:y,tryOn:ne,variables:x,variablesProblem:C,readingVariables:T,readVariables:K,contract:D?.names&&!D.problem?(()=>{try{return compareVariables(I,D.names)}catch{return null}})():null,namesProblem:D?.problem??k,namesWhy:D?.why??null,askingNames:j,readNames:re,support:te}}var Ic={instance:null},Lc=new Set;function monitorPick(){return Ic}function publishMonitorPick(e){Ic={instance:e},Lc.forEach(e=>e(Ic))}function watchMonitorPick(e){return Lc.add(e),()=>{Lc.delete(e)}}function useHistory(e,t){let[i,a]=n([]),[o,s]=n(!1),[c,l]=n(null),[u,d]=n(null),[p,m]=n(null),[h,g]=n(!1),_=e?.ask,v=e?.engineKind,y=(e?.state?.processes??[]).find(e=>e.deployed&&e.key),b=r(async()=>{if(!_||!v||!y)a([]);else{s(!0),l(null);try{let e=v===`CAMUNDA_8`?y.key??y.processId:y.processId,t=await readFinishedInstances(v,e,10,_);a(t)}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!1)}}},[_,v,y]);f(()=>{b()},[b]);let x=r(async e=>{if(_&&v&&t){if(u===e)d(null),m(null),clearPath(t),publishMonitorPick(null);else{d(e),publishMonitorPick(e),g(!0);try{let n=await readInstancePath(v,e,_);m(n),showPath(t,n.steps,null)}catch(e){l(e instanceof Error?e.message:String(e))}finally{g(!1)}}}},[_,v,t,u]);return f(()=>()=>{t&&clearPath(t)},[t]),{instances:i,asking:o,problem:c,selected:u,path:p,loadingPath:h,pick:x,refresh:b}}function formatDuration(e){if(!Number.isFinite(e)||e<0)return`0ms`;if(e<1e3)return`${Math.round(e)}ms`;if(e<59950)return`${(e/1e3).toFixed(1)}s`;let t=Math.round(e/1e3);if(t<3600)return`${Math.floor(t/60)}m ${t%60}s`;let n=Math.round(e/6e4);if(n<1440)return`${Math.floor(n/60)}h ${n%60}m`;let r=Math.round(e/36e5);return`${Math.floor(r/24)}d ${r%24}h`}function at$1(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`})}e(at$1,`at`);function HistorySection({live:e,modeler:t}){let n=(e.state?.processes??[]).find(e=>e.deployed&&e.key),r=useHistory(e,t);return n?u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:p(`app.live.history`)}),r.asking&&u(`p`,{class:`diagram-check__note`,children:p(`app.live.askingHistory`)}),r.problem&&u(`p`,{class:`diagram-check__note`,children:r.problem}),!r.asking&&!r.problem&&r.instances.length===0&&u($,{title:p(`app.live.noFinishedInstances`),hint:p(`app.live.noFinishedInstancesHint`)}),r.instances.length>0&&u(`ul`,{class:`diagram-check__list`,children:r.instances.map(e=>u(`li`,{children:u(`button`,{type:`button`,class:`diagram-check__row${e.id===r.selected?` is-selected`:``}`,"aria-pressed":e.id===r.selected,onClick:()=>r.pick(e.id),children:[u(`span`,{class:`diagram-check__row-title`,children:e.businessKey??e.id}),u(`span`,{class:`diagram-check__row-where`,children:[e.businessKey?`${e.id} · `:``,at$1(e.startTime),` – `,at$1(e.endTime),` · `,formatDuration(e.durationMs),` · `,e.state.toLowerCase()]})]})},e.id))})]}):u(o,{})}function defaultProcessId(e,t){let n=t.state?.processes?.find(e=>e.deployed&&e.processId)?.processId??t.state?.processes?.[0]?.processId;if(n)return n;try{let t=e?.get?.(`canvas`)?.getRootElement?.()?.businessObject;if(t?.processRef?.id)return t.processRef.id;if(t?.$type===`bpmn:Process`&&t.id)return t.id;let n=e?.get?.(`elementRegistry`);if(n?.getAll){let e=n.getAll().find(e=>e?.type===`bpmn:Process`);if(e?.businessObject?.id)return e.businessObject.id}}catch{}return``}function StartInstance({live:e,modeler:t,onStarted:i}){let a=s(null),[c,l]=n(!1),[d,m]=n(``),[h,g]=n(`{}`),[_,v]=n(!1),[y,b]=n(null),x=Xi();f(()=>{c&&!d&&m(defaultProcessId(t,e))},[c,t,e,d]),f(()=>{if(!x)return;let handleTrigger=()=>{l(!0),b(null)};return window.addEventListener(`penstock:start-instance`,handleTrigger),()=>window.removeEventListener(`penstock:start-instance`,handleTrigger)},[x]);let S=ur(h),C=S.ok?null:S.error,w=r(async()=>{if(!_&&d.trim()&&S.ok&&e.ask){v(!0),b(null);try{let t=e.engineKind??`CAMUNDA_8`,n=cr(t,d.trim(),S.variables),r=await e.ask(n),a=lr(t,r);await e.refresh(),l(!1),i?.(a)}catch(e){let t=e instanceof Error?e.message:String(e);b(t)}finally{v(!1)}}},[_,d,S,e,i]),handleKeyDown=e=>{(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&(e.preventDefault(),w())};return u(o,{children:[u(`button`,{ref:a,type:`button`,class:`ui-button`,onClick:()=>{l(e=>!e),b(null)},title:p(`app.live.startInstanceTooltip`),children:p(`app.live.startInstanceEllipsis`)}),c&&u(fi,{anchor:a.current,label:p(`app.live.startInstance`),onClose:()=>l(!1),width:352,class:`start-instance-popover`,children:[u(`h3`,{class:`ui-popover__title`,children:p(`app.live.startInstance`)}),u(Q,{label:p(`app.live.processDefinition`),layout:`top`,children:e=>u(`input`,{...e,type:`text`,class:`ui-input`,value:d,onInput:e=>m(e.target.value)})}),u(Q,{label:p(`app.live.variablesJson`),hint:p(`app.live.variablesHelp`),error:C,layout:`top`,children:e=>u(`textarea`,{...e,class:`ui-input`,value:h,onInput:e=>g(e.target.value),onKeyDown:handleKeyDown,rows:5})}),y&&u(`p`,{class:`ui-field__error`,children:y}),u(`div`,{class:`ui-popover__actions`,children:[u(`button`,{type:`button`,class:`ui-button`,disabled:_,onClick:()=>l(!1),children:p(`app.common.cancel`)}),u(`button`,{type:`button`,class:`ui-button ui-button--primary`,disabled:_||!d.trim()||!S.ok||!e.ask,onClick:()=>void w(),children:p(_?`app.live.startingInstance`:`app.live.startInstance`)})]})]})]})}function useLiveUserTasks(e,t,i){let[a,o]=n([]),[c,l]=n(null),[u,d]=n(null),[m,h]=n(!1),[g,_]=n(null),[v,y]=n(!1),[b,x]=n(null),S=s(0),C=a.find(e=>e.id===c)??null,w=r(async()=>{let n=S.current+=1,isCurrent=()=>S.current===n;if(!e||!t)o([]),l(null),d(null),_(null);else{h(!0),_(null);try{let n=await t(listUserTasksCall(e,i??void 0));if(!isCurrent())return;let r=parseUserTasks(e,n);o(r),l(e=>e&&r.some(t=>t.id===e)?e:r[0]?.id??null)}catch(e){if(!isCurrent())return;o([]),l(null),_(e instanceof Error?e.message:p(`app.live.unableToLoadTasks`))}finally{isCurrent()&&h(!1)}}},[e,t,i]);return f(()=>{w()},[w]),f(()=>{let n=!1;if(!e||!t||!C)d(null);else return(async()=>{try{if(e===`CAMUNDA_8`){let r=await t(readUserTaskCall(e,C.id));if(n)return;let i=parseUserTask(e,r);d({formKey:i?.formKey??C.formKey??null,schema:null});return}let r=await t(readTaskDeployedFormCall(C.id)).catch(()=>null);if(n)return;if(r&&r.status>=200&&r.status<300){let e=parseDeployedForm(r);if(e){d({formKey:C.formKey??`deployed_${C.id}`,schema:e});return}}let i=await t(readTaskFormKeyCall(C.id)).catch(()=>null);if(n)return;let a=i?parseTaskFormKey(i):null;d({formKey:a??C.formKey??null,schema:null})}catch{n||d({formKey:C.formKey??null,schema:null})}})(),()=>{n=!0}},[e,t,C?.id]),{tasks:a,selectedTaskId:c,selectedTask:C,details:u,loading:m,problem:g,completing:v,completingProblem:b,selectTask:l,completeTask:r(async n=>{if(!e||!t||!C)return!1;y(!0),x(null);try{let r=parseTaskCompletion(await t(completeUserTaskCall(e,C.id,n)));return r.ok?(await w(),!0):(x(r.problem??p(`app.live.unableToCompleteTask`)),!1)}catch(e){return x(e instanceof Error?e.message:p(`app.live.unableToCompleteTask`)),!1}finally{y(!1)}},[e,t,C,w]),refresh:w}}function LiveUserTasks({live:e,instanceId:t,modeler:r}){let[i,a]=n(null);f(()=>{let e=!1;return m(()=>import(`./FormStepView-DraPVoAN.js`).then(t=>{e||a(()=>t.FormStepView)}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]),import.meta.url),()=>{e=!0}},[]);let{tasks:s,selectedTaskId:c,selectedTask:d,details:h,problem:g,completing:_,completingProblem:v,selectTask:y,completeTask:b}=useLiveUserTasks(e.engineKind,e.ask,t),x=l(()=>{try{let e=r?.get?.(`canvas`)?.getRootElement?.(),t=e?.businessObject?.$parent??e?.businessObject??r?._definitions;return h?.schema&&h.formKey?{rootElements:[...t?.rootElements??[],{extensionElements:{values:[{$type:`UserTaskForm`,id:h.formKey,body:JSON.stringify(h.schema)}]}}]}:t}catch{return null}},[r,h?.schema,h?.formKey]),S=l(()=>({targets:{forms:new Map},context:{definitions:x}}),[x]),C=l(()=>({waiting:d?{kind:`userTask`,elementId:d.elementId,name:d.name??d.elementId}:null}),[d]),w=l(()=>d?{elementId:d.elementId,type:`bpmn:UserTask`,kind:`user`,name:d.name??d.elementId,number:1,text:d.name??d.elementId,issues:[],links:{form:h?.formKey??d.formKey??void 0},values:{role:`returns`,title:``,empty:``,rows:[]}}:null,[d,h?.formKey]);return!e.engineKind||!e.ask?u(o,{}):u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:p(`app.live.userTasks`)}),g&&u(`p`,{class:`diagram-check__note`,children:g}),!g&&s.length===0&&u(`p`,{class:`diagram-check__note`,children:p(`app.live.noUserTasksWaiting`)}),s.length>0&&u(`ul`,{class:`diagram-check__list`,children:s.map(e=>u(`li`,{children:u(`button`,{type:`button`,class:`diagram-check__row${e.id===c?` is-selected`:``}`,"aria-pressed":e.id===c,onClick:()=>y(e.id),children:[u(`span`,{class:`diagram-check__row-title`,children:e.name??e.elementId}),u(`span`,{class:`diagram-check__row-where`,children:[e.id,e.assignee?` · ${e.assignee}`:``]})]})},e.id))}),d&&w&&(h?.formKey||h?.schema)&&i&&u(`div`,{class:`penstock-live-task-form`,children:u(i,{step:w,review:S,runs:C,onChange:()=>{},onComplete:e=>void b(e)})}),d&&!h?.formKey&&!h?.schema&&u(`div`,{class:`penstock-review__footer penstock-review__pad`,children:u(`button`,{type:`button`,class:`ui-button ui-button--primary`,disabled:_,onClick:()=>void b({}),children:p(_?`app.live.completing`:`app.runs.complete`)})}),v&&u(`div`,{class:`penstock-review__pad`,children:u(yi,{children:v})})]})}function isUserTaskElement(e,t){if(!t)return!1;try{let n=e?.get?.(`elementRegistry`)?.get?.(t);return n?.type===`bpmn:UserTask`||n?.businessObject?.$type===`bpmn:UserTask`}catch{return!1}}function nameOf$4(e,t){try{return e?.get?.(`elementRegistry`)?.get?.(t)?.businessObject?.name?.trim()||t}catch{return t}}e(nameOf$4,`nameOf`);function safeFocus(e,t){try{focusDefect(e,t)}catch{}}function shown$1(e){if(e==null)return`null`;if(typeof e==`string`)return e;let t;try{t=JSON.stringify(e)}catch{t=String(e)}return t.length>120?`${t.slice(0,117)}...`:t}e(shown$1,`shown`);function at(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`})}function InstanceSection({live:e,trial:t,where:n,onOpenTasklist:r,cancellingId:i,cancelErrors:a,onCancelInstance:s}){let c=(e.state?.processes??[]).find(e=>e.deployed&&e.key);return c?u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:p(`app.live.instance`)}),t.askingInstances&&u(`p`,{class:`diagram-check__note`,children:p(`app.live.askingWhichInstancesRun`,{where:n,process:c.processId})}),t.instancesProblem&&u(`p`,{class:`diagram-check__note`,children:t.instancesProblem}),!t.askingInstances&&!t.instancesProblem&&t.instances.length===0&&u(`p`,{class:`diagram-check__note`,children:p(`app.live.noInstanceRunning`,{process:c.processId,where:n})}),t.instances.length>0&&u(`ul`,{class:`diagram-check__list`,children:t.instances.map(n=>{let o=ue(e.engine?.kind,e.engine?.url,{instanceId:n.key});return u(`li`,{children:[u(`div`,{class:`penstock-live-row`,children:[u(`button`,{type:`button`,class:`diagram-check__row${n.key===t.instance?` is-selected`:``}`,"aria-pressed":n.key===t.instance,onClick:()=>t.pick(n.key),children:[u(`span`,{class:`diagram-check__row-title`,children:n.businessKey??n.key}),u(`span`,{class:`diagram-check__row-where`,children:[n.businessKey?`${n.key} · `:``,at(n.started),` `,n.state?.toLowerCase?.()??``]})]}),o&&u(`button`,{type:`button`,class:`ui-button`,onClick:()=>r(o),title:p(`app.live.openInTasklist`),children:p(`app.live.openInTasklist`)}),t.pickable&&u(`button`,{type:`button`,class:`ui-button`,disabled:i===n.key,onClick:()=>s(n.key),title:p(`app.live.cancelInstance`),children:i===n.key?p(`app.live.cancelling`):p(`app.live.cancelInstance`)})]}),a[n.key]&&u(`p`,{class:`diagram-check__note diagram-check__note--error`,children:p(`app.live.unableToCancelInstance`,{reason:a[n.key]})})]},n.key)})})]}):u(o,{})}function TrialSection({trial:e,modeler:t,selected:n}){let r=e.selectedExpressions,i=e.support;return u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:p(`app.live.tryOnInstance`)}),i?.evaluation&&r.length===0&&u(`p`,{class:`diagram-check__note`,children:p(`app.live.selectATaskToTryOn`,{instance:e.instance})}),i?.evaluation&&r.length>0&&u(`ul`,{class:`diagram-check__list`,children:r.map(t=>{let n=e.results.get(t.expression);return u(`li`,{children:[u(`div`,{class:`penstock-live-row`,children:[u(`span`,{class:`penstock-live-expr`,title:`${t.label} - ${t.where}`,children:t.expression}),u(`button`,{type:`button`,class:`ui-button`,disabled:e.trying!==null,onClick:()=>void e.tryOn(t.expression),children:e.trying===t.expression?p(`app.live.trying`):p(`app.live.try`)})]}),n&&u(`p`,{class:`penstock-live-outcome`,children:resultText(n.outcome)}),n?.outcome.warnings.map(e=>u(`p`,{class:`penstock-live-outcome penstock-live-outcome--warning`,children:e},e))]},`${t.elementId}:${t.expression}`)})}),i&&!i.evaluation&&u(`p`,{class:`diagram-check__note`,children:p(`app.live.sevenCannotEvaluateHere`)}),e.variables&&u(`ul`,{class:`diagram-check__list`,children:Object.entries(e.variables).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>u(`li`,{class:`penstock-live-variable`,children:[u(`span`,{class:`penstock-live-name`,children:e}),u(`span`,{class:`penstock-live-value`,title:shown$1(t),children:shown$1(t)})]},e))}),u(`div`,{class:`monitor__block`,children:[u(`button`,{type:`button`,class:`ui-button`,disabled:e.readingVariables,onClick:()=>void e.readVariables(),children:e.readingVariables?p(`app.live.reading`):p(`app.live.readTheVariables`)}),n&&u(`button`,{type:`button`,class:`diagram-check__link`,title:p(`app.live.showOnTheDiagram`,{selected:nameOf$4(t,n)}),onClick:()=>safeFocus(t,[n]),children:p(`app.live.select`,{name:nameOf$4(t,n)})})]}),e.variablesProblem&&u(`p`,{class:`diagram-check__note`,children:e.variablesProblem})]})}function ContractSection({trial:e,modeler:t}){let n=e.contract;return u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:p(`app.live.variables`)}),n&&n.neverSet.length===0&&n.unused.length===0&&u(`p`,{class:`diagram-check__note`,children:p(`app.live.theModelAndTheEngineAgree`)}),n&&n.neverSet.length>0&&u(o,{children:[u(`p`,{class:`monitor__label`,children:p(`app.live.neverSetInProduction`)}),u(`ul`,{class:`diagram-check__list`,children:n.neverSet.map(e=>u(`li`,{children:u(`button`,{type:`button`,class:`diagram-check__row`,onClick:()=>safeFocus(t,[e.elements[0].elementId]),children:[u(`span`,{class:`diagram-check__row-title`,children:e.name}),u(`span`,{class:`diagram-check__row-where`,children:e.elements.map(e=>`${nameOf$4(t,e.elementId)} · ${e.where}`).join(`, `)})]})},e.name))})]}),n&&n.unused.length>0&&u(o,{children:[u(`p`,{class:`monitor__label`,children:p(`app.live.unusedInTheModel`)}),u(`p`,{class:`diagram-check__note`,children:p(`app.live.theEngineHasSeenThese`)}),u(`ul`,{class:`monitor__names`,children:n.unused.map(e=>u(`li`,{class:`monitor__name`,children:e.name},e.name))})]}),!n&&u(`div`,{class:`monitor__block`,children:u(`button`,{type:`button`,class:`ui-button`,disabled:e.askingNames,onClick:()=>void e.readNames(),children:e.askingNames?p(`app.live.asking`):p(`app.live.compareWithWhatTheEngine`)})}),e.namesProblem&&u(`p`,{class:`diagram-check__note`,children:e.namesProblem}),e.namesWhy&&!e.namesProblem&&u(`p`,{class:`diagram-check__note`,children:p(`app.live.thisNeedsCamunda`,{version:e.namesWhy})})]})}function MonitorTab({live:e,trial:t,modeler:r,hasImplementation:i,onOpenImplementation:a,onConnect:o,onOpenTasklist:s,onStartInstance:c}){let[l,d]=n(null),[f,m]=n({}),[h,g]=n(null),[_,v]=n({}),[y,b]=n(null),[x,S]=n(``),[C,w]=n(``),[T,E]=n(``),[D,O]=n(null),[k,A]=n(!1),[j,M]=n(null),[N,P]=n(``),[F,I]=n(``),[L,R]=n(null),[z,B]=n(!1),V=e.state,H=e.engine?engineLabel(e.engine.kind,e.engine.profile,e.engine.url):null,U=(V?.processes??[]).filter(e=>!e.deployed),ee=versionText(V?.processes??[]),te=groupIncidents(V?.incidents??[]),W=(V?.processes??[]).flatMap(e=>{let t=e?.elements;return!t||typeof t[Symbol.iterator]!=`function`?[]:[...t].filter(([,e])=>e&&Number(e.waiting)>Number(e.incidents)).map(([e,t])=>({id:e,count:Number(t.waiting)-Number(t.incidents)}))}),G=s??(e=>{try{Y().openExternalLink(e)}catch{}}),K=ue(e.engine?.kind,e.engine?.url),handleCancelInstance=async t=>{if(e.ask&&e.engineKind&&await Y().confirmWithUser({title:p(`app.live.cancelInstanceTitle`),text:p(`app.live.cancelInstanceConfirm`,{instance:t}),accept:p(`app.live.cancelInstance`),decline:p(`app.common.cancel`),warning:!0})){g(t);try{let n=St(e.engineKind,t),r=await e.ask(n),i=Me(r);i.ok?(v(e=>{let n={...e};return delete n[t],n}),e.refresh()):v(e=>({...e,[t]:i.problem??String(i.status)}))}catch(e){v(n=>({...n,[t]:e instanceof Error?e.message:String(e)}))}finally{g(null)}}},handleRetryIncident=async t=>{if(e.ask&&e.engineKind===`CAMUNDA_8`){d(t);try{let n=fe(t),r=await e.ask(n),i=Me(r);i.ok?(m(e=>{let n={...e};return delete n[t],n}),e.refresh()):m(e=>({...e,[t]:i.problem??String(i.status)}))}catch(e){m(n=>({...n,[t]:e instanceof Error?e.message:String(e)}))}finally{d(null)}}},handleSendMessage=async()=>{if(!e.ask||!e.engineKind||!x.trim())return;let t;if(T.trim())try{t=JSON.parse(T)}catch(e){O(e instanceof Error?e.message:String(e));return}A(!0);try{let n=yt(e.engineKind,{name:x.trim(),correlationKey:C.trim()||void 0,variables:t}),r=await e.ask(n),i=Me(r);i.ok?(b(null),S(``),w(``),E(``),O(null),e.refresh()):O(i.problem??String(i.status))}catch(e){O(e instanceof Error?e.message:String(e))}finally{A(!1)}},handleBroadcastSignal=async()=>{if(!e.ask||!e.engineKind||!N.trim())return;let t;if(F.trim())try{t=JSON.parse(F)}catch(e){R(e instanceof Error?e.message:String(e));return}B(!0);try{let n=mt(e.engineKind,{name:N.trim(),variables:t}),r=await e.ask(n),i=Me(r);i.ok?(M(null),P(``),I(``),R(null),e.refresh()):R(i.problem??String(i.status))}catch(e){R(e instanceof Error?e.message:String(e))}finally{B(!1)}};if(!e.engine)return e.asking?u($,{title:p(`app.live.askingTheEngine`),hint:p(`app.live.readingWhichInstancesOfThis`)}):u($,{title:p(`app.live.noEngineConnected`),hint:p(`app.live.setUpADeploymentProfile`),guide:`monitor`,actions:[{label:p(`app.deploy.setUpConnection`),run:o}]});let ne=V&&!V.problem&&te.length===0&&W.length===0&&U.length===0;return u(`div`,{class:`monitor`,children:[u(`header`,{class:`problems__bar problems__bar--wrap`,children:[u(`span`,{class:`problems__count`,children:V&&!V.problem?[H,...ee].join(` · `):H}),u(StartInstance,{live:e,modeler:r,onStarted:c}),t.pickable&&u(`button`,{id:`monitor-send-message`,type:`button`,class:`ui-button`,onClick:e=>{b(y?null:e.currentTarget),M(null)},title:p(`app.live.sendMessage`),children:p(`app.live.sendMessage`)}),t.pickable&&u(`button`,{id:`monitor-broadcast-signal`,type:`button`,class:`ui-button`,onClick:e=>{M(j?null:e.currentTarget),b(null)},title:p(`app.live.broadcastSignal`),children:p(`app.live.broadcastSignal`)}),K&&u(`button`,{type:`button`,class:`ui-button`,onClick:()=>G(K),title:p(`app.live.openInTasklist`),children:p(`app.live.openInTasklist`)}),u(`button`,{type:`button`,class:`ui-button`,onClick:e.refresh,disabled:e.asking,title:p(`app.live.askTheEngineAgain`),children:e.asking?p(`app.live.asking`):p(`app.live.refresh`)})]}),V?.problem&&u($,{title:p(`app.live.theEngineCouldNotBe`),hint:V.problem,actions:[{label:p(`app.live.refresh`),run:e.refresh}]}),!V&&u($,{title:p(`app.live.askingTheEngine`),hint:p(`app.live.readingWhichInstancesOfThis`)}),U.map(e=>u($,{title:p(`app.live.isNotDeployed`,{processId:e.processId}),hint:p(`app.live.itIsNotOnYet`,{where:H})},e.processId)),ne&&u($,{title:p(`app.live.noInstanceIsRunning`),hint:p(`app.live.nothingIsWaitingOrHas`,{where:H}),guide:`monitor`}),te.length>0&&u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:p(`app.live.incidents`)}),u(`ul`,{class:`diagram-check__list`,children:te.map(n=>{let o=n.id??n.instance;return u(`li`,{children:[u(`div`,{class:`penstock-live-row`,children:[u(`button`,{type:`button`,class:`diagram-check__row`,onClick:()=>safeFocus(r,[n.elementId]),children:[u(`span`,{class:`diagram-check__row-title`,children:nameOf$4(r,n.elementId)}),u(`span`,{class:`diagram-check__row-where diagram-check__row-where--wrap`,title:n.message,children:incidentLine(n)})]}),o&&e.engineKind===`CAMUNDA_8`&&t.pickable&&u(`button`,{type:`button`,class:`ui-button`,disabled:l===o,onClick:()=>void handleRetryIncident(o),title:p(`app.live.retryIncident`),children:p(l===o?`app.live.retrying`:`app.live.retry`)}),n.instance&&t.pickable&&u(`button`,{type:`button`,class:`ui-button`,disabled:h===n.instance,onClick:()=>void handleCancelInstance(n.instance),title:p(`app.live.cancelInstance`),children:h===n.instance?p(`app.live.cancelling`):p(`app.live.cancelInstance`)}),n.instance&&t.pickable&&u(`button`,{type:`button`,class:`ui-button`,onClick:()=>t.pick(n.instance),title:p(`app.live.useThisInstanceForAn`),children:p(`app.live.use`)}),i(n.elementId)&&u(`button`,{type:`button`,class:`ui-button`,onClick:()=>a(n.elementId),title:p(`app.live.openTheCodeThatRuns`),children:p(`app.code.goToCode`)})]}),o&&f[o]&&u(`p`,{class:`diagram-check__note diagram-check__note--error`,children:p(`app.live.unableToRetryIncident`,{reason:f[o]})}),n.instance&&_[n.instance]&&u(`p`,{class:`diagram-check__note diagram-check__note--error`,children:p(`app.live.unableToCancelInstance`,{reason:_[n.instance]})})]},`${n.elementId}:${n.message}`)})})]}),W.length>0&&u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:p(`app.live.waiting`)}),u(`ul`,{class:`diagram-check__list`,children:W.map(t=>{let n=isUserTaskElement(r,t.id)?ue(e.engine?.kind,e.engine?.url,{elementId:t.id}):null;return u(`li`,{class:n?`penstock-live-row`:void 0,children:[u(`button`,{type:`button`,class:`diagram-check__row`,onClick:()=>safeFocus(r,[t.id]),children:[u(`span`,{class:`diagram-check__row-title`,children:nameOf$4(r,t.id)}),u(`span`,{class:`diagram-check__row-where`,children:p(`app.live.instancesHere`,{count:t.count})})]}),n&&u(`button`,{type:`button`,class:`ui-button`,onClick:()=>G(n),title:p(`app.live.openInTasklist`),children:p(`app.live.openInTasklist`)})]},t.id)})})]}),u(InstanceSection,{live:e,trial:t,where:H,onOpenTasklist:G,cancellingId:h,cancelErrors:_,onCancelInstance:handleCancelInstance}),t.instance&&u(LiveUserTasks,{live:e,instanceId:t.instance,modeler:r}),t.instance&&u(TrialSection,{trial:t,modeler:r,selected:t.selected}),t.support?.names&&u(ContractSection,{trial:t,modeler:r}),u(HistorySection,{live:e,modeler:r}),y&&u(fi,{anchor:y,label:p(`app.live.sendMessage`),onClose:()=>b(null),width:320,children:[u(`h3`,{class:`ui-popover__title`,children:p(`app.live.sendMessage`)}),u(Q,{label:p(`app.live.messageName`),children:e=>u(`input`,{...e,type:`text`,value:x,onInput:e=>S(e.target.value)})}),u(Q,{label:p(`app.live.correlationKey`),children:e=>u(`input`,{...e,type:`text`,value:C,onInput:e=>w(e.target.value)})}),u(Q,{label:p(`app.live.variablesJson`),children:e=>u(`input`,{...e,type:`text`,value:T,onInput:e=>E(e.target.value)})}),D&&u(`p`,{class:`diagram-check__note diagram-check__note--error`,children:p(`app.live.unableToSendMessage`,{reason:D})}),u(`div`,{class:`ui-popover__actions`,children:[u(`button`,{type:`button`,class:`ui-button`,onClick:()=>b(null),children:p(`app.common.cancel`)}),u(`button`,{type:`button`,class:`ui-button ui-button--primary`,disabled:!x.trim()||k,onClick:()=>void handleSendMessage(),children:p(k?`app.live.sending`:`app.live.send`)})]})]}),j&&u(fi,{anchor:j,label:p(`app.live.broadcastSignal`),onClose:()=>M(null),width:320,children:[u(`h3`,{class:`ui-popover__title`,children:p(`app.live.broadcastSignal`)}),u(Q,{label:p(`app.live.signalName`),children:e=>u(`input`,{...e,type:`text`,value:N,onInput:e=>P(e.target.value)})}),u(Q,{label:p(`app.live.variablesJson`),children:e=>u(`input`,{...e,type:`text`,value:F,onInput:e=>I(e.target.value)})}),L&&u(`p`,{class:`diagram-check__note diagram-check__note--error`,children:p(`app.live.unableToBroadcastSignal`,{reason:L})}),u(`div`,{class:`ui-popover__actions`,children:[u(`button`,{type:`button`,class:`ui-button`,onClick:()=>M(null),children:p(`app.common.cancel`)}),u(`button`,{type:`button`,class:`ui-button ui-button--primary`,disabled:!N.trim()||z,onClick:()=>void handleBroadcastSignal(),children:p(z?`app.live.broadcasting`:`app.live.broadcast`)})]})]}),e.at&&e.engine.url&&u(`p`,{class:`diagram-check__note`,children:p(`app.live.urlAt`,{url:e.engine.url,when:e.at})})]})}function useLive(e,t){let[i,a]=n(null),[o,c]=n(null),[l,u]=n(null),[d,p]=n(null),[m,h]=n(!1),[g,_]=n(null),v=s(0);f(()=>()=>{v.current+=1},[]);let y=r(()=>{let e=v.current+=1,mineStill=()=>v.current===e,n;try{n=Y()}catch(e){mineStill()&&(a({processes:[],incidents:[],problem:e instanceof Error?e.message:String(e)}),h(!1));return}h(!0);try{Promise.resolve(n?.getDeployTargets?.()).then(async e=>{if(!mineStill())return;let r=(Array.isArray(e?.targets)?e.targets:[]).find(t=>(t?.profile??null)===(e?.active??null));if(!r?.ready||!Ot(String(r.engine))){c(null),u(null),p(null),a(null);return}let i=r.profile??null,asker=e=>typeof n?.askEngine==`function`?n.askEngine(i,e):Promise.reject(Error(`no askEngine`));c({profile:i,url:r.url??null,kind:String(r.engine)}),u(r.engine),p(()=>asker);let o=[];try{o=typeof t==`function`?t():[]}catch{o=[]}let s=await readLive(r.engine,o,asker);mineStill()&&(a(s),_(new Date().toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`})))}).catch(e=>{mineStill()&&(c(null),u(null),p(null),a({processes:[],incidents:[],problem:e instanceof Error?e.message:String(e)}))}).finally(()=>mineStill()&&h(!1))}catch(e){mineStill()&&(c(null),u(null),p(null),a({processes:[],incidents:[],problem:e instanceof Error?e.message:String(e)}),h(!1))}},[t]);return f(()=>{e&&y()},[e,y]),{state:i,engine:o,engineKind:l,ask:d,asking:m,at:g,refresh:y}}var Rc=`penstock-live`;function clearBadges$1(e){try{e?.get?.(`overlays`)?.remove?.({type:Rc})}catch{}}e(clearBadges$1,`clearBadges`);function showBadges$1(e,t){if(clearBadges$1(e),!e||!t)return;let n,r;try{n=e.get(`elementRegistry`),r=e.get(`overlays`)}catch{return}n&&r&&(t.state?.processes??[]).forEach(e=>{let t=e?.elements;t&&typeof t.forEach==`function`&&t.forEach((e,t)=>{try{if(!n.get(t)||!e)return;let i=Number(e.waiting)||0,a=Number(e.incidents)||0;if(i===0&&a===0)return;let o=document.createElement(`div`);if(o.className=`penstock-live-badges`,i>a){let e=document.createElement(`span`);e.className=`penstock-live-badge`,e.textContent=String(i-a),e.title=p(`app.live.waitingHere`,{waiting:i-a}),o.appendChild(e)}if(a>0){let e=document.createElement(`span`);e.className=`penstock-live-badge penstock-live-badge--incident`,e.textContent=String(a),e.title=p(`app.live.incidentsBadge`,{count:a}),o.appendChild(e)}r.add(t,Rc,{position:badgePosition(n.get(t)),html:o})}catch{}})})}e(showBadges$1,`showBadges`);function useLiveBadges(e,t,n){f(()=>{if(n&&e)return showBadges$1(e,t),()=>clearBadges$1(e)},[e,t?.state,n])}function textOf$1(e){try{return JSON.stringify(e)??`null`}catch{return String(e)}}e(textOf$1,`textOf`);function rowsOf(e){return Object.entries(e).map(([e,t])=>({name:e,text:textOf$1(t),fixed:!0}))}function collect$1(e){let t={},n={};return e.forEach((e,r)=>{let i=e.name.trim();if(i!==``)try{Object.defineProperty(t,i,{value:JSON.parse(e.text),enumerable:!0,writable:!0,configurable:!0})}catch{n[r]=p(`app.processDebug.invalidValue`,{name:i})}}),{variables:t,errors:n}}e(collect$1,`collect`);function focus(e,t){try{focusDefect(e,[t])}catch{}}function Variables({debug:e,rows:t,setRows:n,errors:r}){return u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:p(`app.processDebug.variables`)}),u(`p`,{class:`type-help`,children:p(`app.processDebug.variablesHint`)}),t.length===0&&u(`p`,{class:`diagram-check__note`,children:p(`app.processDebug.noVariables`)}),u(`ul`,{class:`process-debug__variables`,children:t.map((e,i)=>u(`li`,{class:`process-debug__variable`,children:[u(`input`,{type:`text`,class:`ui-input process-debug__name`,"aria-label":p(`app.processDebug.variableName`),value:e.name,readOnly:e.fixed,placeholder:p(`app.processDebug.variableName`),onInput:e=>n(t.map((t,n)=>n===i?{...t,name:e.target.value}:t))}),u(`input`,{type:`text`,class:`ui-input process-debug__value`,"aria-label":p(`app.processDebug.variableValue`,{name:e.name}),"aria-invalid":r[i]?!0:void 0,value:e.text,placeholder:p(`app.processDebug.variableValueHint`),onInput:e=>n(t.map((t,n)=>n===i?{...t,text:e.target.value}:t))}),r[i]&&u(`p`,{class:`ui-field__error process-debug__error`,children:r[i]})]},i))}),u(`button`,{type:`button`,class:`ui-button`,onClick:()=>n([...t,{name:``,text:``,fixed:!1}]),children:p(`app.processDebug.addVariable`)}),e.problem&&u(`p`,{class:`diagram-check__note diagram-check__note--error`,children:e.problem})]})}function Breakpoints({debug:e,modeler:t}){return u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:p(`app.processDebug.breakpoints`)}),e.breakpoints.length===0&&u(`p`,{class:`diagram-check__note`,children:p(`app.processDebug.noBreakpoints`)}),u(`ul`,{class:`diagram-check__list`,children:e.breakpoints.map(n=>u(`li`,{class:`penstock-live-row`,children:[u(`button`,{type:`button`,class:`diagram-check__row`,onClick:()=>focus(t,n),children:[u(`span`,{class:`diagram-check__row-title`,children:e.nameOf(n)}),u(`span`,{class:`diagram-check__row-where`,children:n})]}),u(`button`,{type:`button`,class:`ui-button`,onClick:()=>e.toggle(n),"aria-label":p(`app.processDebug.removeBreakpoint`,{element:e.nameOf(n)}),children:p(`app.processDebug.remove`)})]},n))}),u(`button`,{type:`button`,class:`ui-button`,disabled:!e.canToggle,onClick:e.toggleSelected,children:p(`app.processDebug.toggleOnSelection`)})]})}function Cleanup({debug:e}){let t=e.snapshot;return!t||t.cleanup===`none`?null:t.cleanup===`pending`?u(`p`,{class:`diagram-check__note`,children:p(`app.processDebug.cleanupPending`)}):t.cleanup===`done`?u(`p`,{class:`diagram-check__note`,children:p(`app.processDebug.cleanupDone`,{copy:t.debugProcessId??``})}):u(`section`,{class:`diagram-check__group`,role:`alert`,children:[u(`h3`,{class:`diagram-check__heading`,children:p(`app.processDebug.cleanupFailed`)}),u(`ul`,{class:`diagram-check__list`,children:t.cleanupProblems.map(e=>u(`li`,{class:`diagram-check__note diagram-check__note--error`,children:e},e))}),t.leftover&&u(`p`,{class:`diagram-check__note`,children:p(`app.processDebug.leftOnTheEngine`,{deployment:t.leftover.deployment})}),u(`button`,{type:`button`,class:`ui-button`,onClick:e.retryCleanup,children:p(`app.processDebug.tryAgain`)})]})}function DebugTab({debug:e,modeler:t,onConnect:r}){let i=e.snapshot,a=i?.phase??`idle`,s=a===`paused`,[c,l]=n([]),[d,m]=n({});if(f(()=>{l(rowsOf(i?.phase===`paused`?i.variables:{})),m({})},[i?.phase===`paused`?i.variables:null,i?.element]),!e.target)return e.checking?u($,{title:p(`app.live.askingTheEngine`),hint:p(`app.processDebug.checkingTheEngine`)}):u($,{title:p(`app.processDebug.noEngine`),hint:e.targetProblem||p(`app.processDebug.noEngineHint`),actions:[{label:p(`app.deploy.setUpConnection`),run:r}]});let proceed=t=>{let{variables:n,errors:r}=collect$1(c);m(r),!(Object.keys(r).length>0)&&(t?e.stepOver(n):e.resume(n))},h=a===`deploying`||a===`running`||s,g=e.target.url??e.target.profile??``,_=i?.element??null;return u(`div`,{class:`monitor process-debug`,children:[u(`header`,{class:`problems__bar`,children:[u(`span`,{class:`problems__count`,children:[p(`app.processDebug.state.${a}`),g?` · ${g}`:``]}),!h&&u(o,{children:[u(`button`,{type:`button`,class:`ui-button ui-button--primary`,disabled:e.starting||e.processId===``||e.variablesError!==null,onClick:()=>e.start(!1),children:e.starting?p(`app.processDebug.starting`):p(`app.processDebug.start`)}),u(`button`,{type:`button`,class:`ui-button`,disabled:e.starting||e.processId===``||e.variablesError!==null,onClick:()=>e.start(!0),children:p(`app.processDebug.startAndStep`)})]}),s&&u(o,{children:[u(`button`,{type:`button`,class:`ui-button ui-button--primary`,onClick:()=>proceed(!1),children:p(`app.processDebug.continue`)}),u(`button`,{type:`button`,class:`ui-button`,onClick:()=>proceed(!0),children:p(`app.processDebug.step`)})]}),h&&u(`button`,{type:`button`,class:`ui-button`,onClick:e.stop,children:p(`app.processDebug.stop`)})]}),u(`p`,{class:`type-help process-debug__note`,children:p(`app.processDebug.copyNote`,{copy:e.copyId||p(`app.processDebug.copyIdFallback`)})}),a===`idle`&&u($,{title:p(`app.processDebug.emptyTitle`),hint:p(`app.processDebug.emptyHint`)}),s&&_&&u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:i?.atBreakpoint?p(`app.processDebug.pausedAtBreakpoint`):p(`app.processDebug.pausedAtStep`)}),u(`button`,{type:`button`,class:`diagram-check__row`,onClick:()=>focus(t,_),children:[u(`span`,{class:`diagram-check__row-title`,children:e.nameOf(_)}),u(`span`,{class:`diagram-check__row-where`,children:_})]})]}),(a===`running`||a===`deploying`)&&u(`p`,{class:`diagram-check__note`,role:`status`,children:a===`deploying`?p(`app.processDebug.deploying`):i?.waiting?p(`app.processDebug.waiting`):p(`app.processDebug.runningNote`,{count:i?.visited??0})}),(a===`finished`||a===`failed`||a===`stopped`)&&i?.message&&u(`p`,{class:`diagram-check__note${a===`failed`?` diagram-check__note--error`:``}`,role:a===`failed`?`alert`:`status`,children:i.message}),s&&u(Variables,{debug:e,rows:c,setRows:l,errors:d}),!h&&u(`section`,{class:`diagram-check__group`,children:[e.processIds.length>1&&u(Q,{label:p(`app.processDebug.process`),layout:`top`,children:t=>u(`select`,{...t,value:e.processId,onChange:t=>e.setProcessId(t.target.value),children:e.processIds.map(e=>u(`option`,{value:e,children:e},e))})}),e.processIds.length===0&&u(`p`,{class:`diagram-check__note diagram-check__note--error`,children:p(`app.processDebug.problem.noProcess`)}),u(Q,{label:p(`app.processDebug.startVariables`),hint:p(`app.processDebug.startVariablesHint`),error:e.variablesError,layout:`top`,children:t=>u(`textarea`,{...t,rows:4,value:e.variablesText,onInput:t=>e.setVariablesText(t.target.value)})}),e.problem&&e.variablesError===null&&u(`p`,{class:`diagram-check__note diagram-check__note--error`,children:e.problem})]}),u(Breakpoints,{debug:e,modeler:t}),u(Cleanup,{debug:e})]})}var zc=`penstock-covered`,Bc=`penstock-not-covered`;function union(e){return{elements:new Set(e.flatMap(e=>[...e.elements])),flows:new Set(e.flatMap(e=>[...e.flows]))}}function processOf(e){let t=e?.$parent;for(;t;){if(t.$instanceOf?.(`bpmn:Process`))return t.id;t=t.$parent}return null}function processIdsOf$1(e){return(e?.getDefinitions?.()?.rootElements??[]).filter(e=>e.$instanceOf?.(`bpmn:Process`)).map(e=>e.id)}e(processIdsOf$1,`processIdsOf`);function executableProcessIds(e){return e.filter(e=>e.isExecutable!==!1).map(e=>e.id)}function executableProcessIdsOf(e){let t=e?.getDefinitions?.();return executableProcessIds((t?.rootElements??[]).filter(e=>e.$instanceOf?.(`bpmn:Process`)))}function reachOf(e,t){let n=t.flatMap(t=>{let n=e?.reach.get(t);return n?[n]:[]});if(n.length===0)return null;let r=[...new Set(n.flatMap(e=>[...e.tests.keys()]))].sort();return{processIds:n.map(e=>e.processId),all:union(n.map(e=>e.all)),tests:r.map(e=>({name:e,reach:union(n.flatMap(t=>{let n=t.tests.get(e);return n?[n]:[]}))}))}}function countable$1(e,t){let n=e?.get?.(`elementRegistry`);return n?n.filter(e=>{let n=e.businessObject;return e.labelTarget||!n||e.type===`label`||!n.$instanceOf?.(`bpmn:FlowNode`)&&n.$type!==`bpmn:SequenceFlow`?!1:t.includes(processOf(n)??``)}):[]}e(countable$1,`countable`);function isReached(e,t){return e.businessObject.$type===`bpmn:SequenceFlow`?t.flows.has(e.id):t.elements.has(e.id)}function tally(e,t,n){let r=countable$1(e,t),i=r.filter(e=>isReached(e,n)),a=r.filter(e=>!isReached(e,n)&&e.businessObject.$type!==`bpmn:SequenceFlow`);return{covered:i.length,total:r.length,missed:a}}function clearCoverage(e){if(e)try{let t=e.get(`canvas`),n=e.get(`elementRegistry`);if(!t||!n)return;n.forEach(e=>{t.removeMarker(e,zc),t.removeMarker(e,Bc)})}catch(e){console.error(`Could not clear the coverage markers:`,e)}}function showCoverage(e,t,n){if(e){clearCoverage(e);try{let r=e.get(`canvas`);if(!r)return;countable$1(e,t).forEach(e=>{r.addMarker(e,isReached(e,n)?zc:Bc)})}catch(e){console.error(`Could not show the coverage:`,e)}}}function percent(e){return e.total?`${Math.round(e.covered/e.total*100)}%`:`0%`}function when(e){return e?new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`}):null}function nameOf$3(e){return e.businessObject?.name?.trim()||e.id}e(nameOf$3,`nameOf`);function CoveragePanel({isOpen:e,onClose:t,getModeler:r,coverage:i}){let[a,o]=n(null),[s,c]=n(0),d=e?r():null;f(()=>{if(!e||!d)return;let t=d.get(`eventBus`),changed=()=>c(e=>e+1);return t.on(`commandStack.changed`,changed),t.on(`import.done`,changed),()=>{t.off(`commandStack.changed`,changed),t.off(`import.done`,changed)}},[e,d]);let m=l(()=>{if(!d)return null;let e=reachOf(i,processIdsOf$1(d));if(!e)return null;let t=e.tests.find(e=>e.name===a)?.reach??e.all;return{diagram:e,reached:t,total:tally(d,e.processIds,e.all),shown:tally(d,e.processIds,t),tests:e.tests.map(t=>({name:t.name,tally:tally(d,e.processIds,t.reach)}))}},[d,i,a,s]);if(f(()=>{if(d)return m?showCoverage(d,m.diagram.processIds,m.reached):clearCoverage(d),()=>clearCoverage(d)},[d,m]),f(()=>{a&&m&&!m.tests.some(e=>e.name===a)&&o(null)},[a,m]),!e)return null;let h=when(i?.updatedAt),g=[i?.reports?.join(`, `),h].filter(Boolean).join(` · `);return u(`aside`,{class:`diagram-check`,"aria-label":p(`app.coverage.testCoverage`),children:[u(`header`,{class:`diagram-check__bar`,children:[u(`span`,{class:`diagram-check__title`,children:p(`app.coverage.coverage`)}),m&&u(`span`,{class:`diagram-check__counts`,children:u(`span`,{class:`diagram-check__tally`,children:[percent(m.shown),` · `,p(`app.coverage.coveredOf`,{covered:m.shown.covered,total:m.shown.total})]})}),u(`button`,{type:`button`,class:`ui-button`,onClick:t,title:p(`app.coverage.closeCoverage`),children:p(`app.common.close`)})]}),u(`div`,{class:`diagram-check__body`,children:[!m&&u(`p`,{class:`diagram-check__clean`,children:p(`app.coverage.noTestReportCoversThis`)}),m&&m.tests.length>0&&u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:p(`app.coverage.tests`)}),u(`ul`,{class:`diagram-check__list`,children:[u(`li`,{children:u(`button`,{type:`button`,class:a===null?`diagram-check__row is-selected`:`diagram-check__row`,onClick:()=>o(null),children:[u(`span`,{class:`diagram-check__row-title`,children:p(`app.coverage.allTests`)}),u(`span`,{class:`diagram-check__row-where`,children:[percent(m.total),` · `,p(`app.coverage.testCount`,{count:m.tests.length})]})]})}),m.tests.map(e=>u(`li`,{children:u(`button`,{type:`button`,class:a===e.name?`diagram-check__row is-selected`:`diagram-check__row`,onClick:()=>o(e.name),title:p(`app.coverage.showTheWayThisTest`),children:[u(`span`,{class:`diagram-check__row-title`,children:e.name}),u(`span`,{class:`diagram-check__row-where`,children:[percent(e.tally),` · `,p(`app.coverage.coveredOf`,{covered:e.tally.covered,total:e.tally.total})]})]})},e.name))]})]}),m&&m.shown.missed.length>0&&u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:p(`app.coverage.notReached`)}),u(`ul`,{class:`diagram-check__list`,children:m.shown.missed.map(e=>u(`li`,{children:u(`button`,{type:`button`,class:`diagram-check__row`,onClick:()=>focusDefect(d,[e.id]),children:[u(`span`,{class:`diagram-check__row-title`,children:nameOf$3(e)}),u(`span`,{class:`diagram-check__row-where`,children:e.businessObject.$type.replace(`bpmn:`,``)})]})},e.id))})]}),m&&g&&u(`p`,{class:`diagram-check__row-where diagram-check__row-where--wrap diagram-check__source`,children:g})]})]})}var Vc=`penstock.debug.breakpoints`,Hc=500;function read(e){try{let t=JSON.parse(e.getItem(`penstock.debug.breakpoints`)??`{}`);if(!t||typeof t!=`object`||Array.isArray(t))return{};let n={};for(let[e,r]of Object.entries(t))Array.isArray(r)&&Object.defineProperty(n,e,{value:r.filter(e=>typeof e==`string`),enumerable:!0,writable:!0,configurable:!0});return n}catch{return{}}}function loadBreakpoints(e,t){if(t===``)return[];let n=read(e);return Object.hasOwn(n,t)?n[t]:[]}function saveBreakpoints(e,t,n){if(t===``)return;let r=read(e);delete r[t];let i=Object.entries(r).slice(-199),a=Object.fromEntries(i);n.length>0&&Object.defineProperty(a,t,{value:n.slice(0,Hc),enumerable:!0,writable:!0,configurable:!0});try{e.setItem(Vc,JSON.stringify(a))}catch{}}function toggled(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function only(e,t){return e.filter(t)}var Uc=`penstock-breakpoint`,Wc=`penstock-process-debug`,Gc=`penstock-debug-current`;function escape$1(e){return e.replace(/[&<>"']/g,e=>({"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`})[e]??e)}e(escape$1,`escape`);function nameOf$2(e,t){try{return e?.get?.(`elementRegistry`)?.get?.(t)?.businessObject?.name?.trim()||t}catch{return t}}e(nameOf$2,`nameOf`);function exists(e,t){try{return!!e?.get?.(`elementRegistry`)?.get?.(t)}catch{return!1}}function showBreakpoints(e,t,n){try{let r=e?.get?.(`overlays`),i=e?.get?.(`elementRegistry`);if(!r||!i)return;r.remove({type:Uc});for(let a of t){if(!i.get(a))continue;let t=document.createElement(`button`);t.type=`button`,t.className=`penstock-breakpoint`,t.title=p(`app.processDebug.breakpointDot`,{element:nameOf$2(e,a)}),t.setAttribute(`aria-label`,t.title),t.addEventListener(`click`,e=>{e.stopPropagation(),n(a)}),r.add(a,Uc,{position:{top:-6,left:-6},html:t})}}catch(e){console.error(`Could not show the breakpoints:`,e)}}function clearBreakpoints(e){try{e?.get?.(`overlays`)?.remove?.({type:Uc})}catch{}}function showPaused(e,t){if(clearPaused(e),t)try{let n=e?.get?.(`canvas`),r=e?.get?.(`elementRegistry`),i=e?.get?.(`overlays`),a=r?.get?.(t);if(!n||!i||!a)return;n.addMarker(a,Gc),i.add(a,Wc,{position:{top:-28,left:0},html:`<div class="penstock-debug-badge">${escape$1(p(`app.debug.pausedHere`))}</div>`}),n.scrollToElement?.(a,{top:160,bottom:160,left:160,right:160})}catch(e){console.error(`Could not show where the debugger paused:`,e)}}function clearPaused(e){try{let t=e?.get?.(`canvas`);e?.get?.(`overlays`)?.remove?.({type:Wc}),e?.get?.(`elementRegistry`)?.forEach?.(e=>t?.removeMarker?.(e,Gc))}catch{}}var Kc=`penstock.debug.builds`;function selectionCanBreak(e,t){if(!t)return!1;try{return T(e?.get?.(`elementRegistry`)?.get?.(t)?.businessObject)}catch{return!1}}function processIdsOf(e){try{return e?executableProcessIdsOf(e):[]}catch{return[]}}function useProcessDebug({active:e,modeler:t,selectedElementId:i,diagramPath:a,exportXml:o}){let c=a??``,[u,d]=n(null),[m,h]=n(``),[g,_]=n(!1),[v,y]=n(()=>loadBreakpoints(localStorage,c)),[b,x]=n(``),[S,C]=n(`{}`),[w,T]=n(null),[E,D]=n(!1),[O,k]=n(null),A=l(()=>new Ge,[]),j=s(void 0),M=s(null),N=s(v);N.current=v;let P=l(()=>processIdsOf(t),[t,e,w?.phase]),F=P.includes(b)?b:P[0]??``;f(()=>{y(loadBreakpoints(localStorage,c))},[c]),f(()=>{if(!e)return;let t=!0;return _(!0),(async()=>{let e=await Sr(a),n=e?``:await kr(a);t&&(d(e),h(n),_(!1))})(),()=>{t=!1}},[e,a]);let I=u?br(u):``;f(()=>{if(!e||!u)return;let t=Y(),n=K(localStorage,Kc,br(u));n.list().then(e=>{if(e.length!==0)return Oe({engine:u.engine,call:e=>t.askEngine(u.profile,e,a??void 0,!0),sleep:e=>He.sleep(e)},n,Date.now())}).catch(()=>void 0)},[e,I]);let L=r(e=>{y(t=>{let n=t.filter(t=>t!==e);return saveBreakpoints(localStorage,c,n),j.current?.setBreakpoints(n),n})},[c]),R=r(e=>{y(t=>{let n=toggled(t,e);return saveBreakpoints(localStorage,c,n),j.current?.setBreakpoints(n),n})},[c]),z=r(()=>{i&&selectionCanBreak(t,i)&&R(i)},[t,i,R]);f(()=>{if(!t)return;let draw=()=>showBreakpoints(t,v,L);draw();let e=t.get?.(`eventBus`,!1);return e?.on?.(`import.done`,draw),()=>{e?.off?.(`import.done`,draw),clearBreakpoints(t)}},[t,v,L]);let B=w?.phase===`paused`?w.element:null;f(()=>{if(t)return showPaused(t,B),()=>clearPaused(t)},[t,B]);let V=r(e=>{M.current?.(),j.current=e,T(e.snapshot),M.current=e.subscribe(T)},[]),H=r(e=>{if(E||!u||F===``)return;let n=ur(S);n.ok?(k(null),D(!0),(async()=>{try{if(!await vr())return;let r=_t(F),i=await xr(u,{title:p(`app.processDebug.confirm.title`),text:p(`app.processDebug.confirm.text`,{copy:r,url:u.url??``}),accept:p(`app.processDebug.confirm.accept`)});if(i){k(i);return}let s=await o();if(!s){k(p(`app.processDebug.problem.unreadable`));return}let c=Y(),l=only(N.current,e=>exists(t,e)),d=await A.begin({engine:u.engine,ask:e=>c.askEngine(u.profile,e,a??void 0,!0),xml:s,processId:F,breakpoints:l,variables:n.variables,mode:e?`step`:`continue`,ledger:K(localStorage,Kc,br(u))});V(d),await d.start()}catch(e){k(e instanceof Error?e.message:String(e))}finally{D(!1)}})()):k(n.error)},[E,u,F,S,o,t,A,a,V]),U=r(e=>{j.current?.continue(e)},[]),ee=r(e=>{j.current?.step(e)},[]),te=r(()=>{j.current?.stop()},[]),W=r(()=>{j.current?.retryCleanup()},[]);f(()=>{let closing=()=>{A.disposeAll()};return window.addEventListener(`pagehide`,closing),()=>{window.removeEventListener(`pagehide`,closing),M.current?.(),closing()}},[A]);let G=ur(S),ne=r(e=>nameOf$2(t,e),[t]);return{target:u,targetProblem:m,checking:g,processIds:P,processId:F,setProcessId:x,copyId:F===``?``:_t(F),variablesText:S,setVariablesText:C,variablesError:G.ok?null:G.error,breakpoints:v,selected:i??null,canToggle:selectionCanBreak(t,i),toggle:R,toggleSelected:z,snapshot:w,starting:E,problem:O,start:H,resume:U,stepOver:ee,stop:te,retryCleanup:W,nameOf:ne}}function parseTime(e){return typeof e==`number`?Number.isFinite(e)?e:NaN:typeof e!=`string`||e===``?NaN:Date.parse(e.replace(/([+-]\d\d)(\d\d)$/,`$1:$2`))}function candidateOf(e,t){if(typeof e?.elementId!=`string`||e.elementId===``)return null;let n=parseTime(e.start);if(Number.isNaN(n))return null;let r=parseTime(e.end),i=Number.isNaN(r)?null:r,a=e.state,o=!1;return i!==null&&i<n&&(i=n,o=!0),i!==null&&a===`ACTIVE`&&(a=`COMPLETED`,o=!0),i===null&&(a===`COMPLETED`||a===`TERMINATED`)&&(i=n,o=!0),{sequence:t,elementId:e.elementId,elementType:e.elementType??``,instance:e.instance?String(e.instance):null,parent:e.parent?String(e.parent):null,start:n,end:i,state:a,incident:e.incident?String(e.incident):null,changed:[...new Set(e.changed??[])],mocked:e.mocked===!0,repaired:o}}function keyOf$2(e){return e.instance===null?`e:${e.elementId}|${e.start}|${e.end??``}`:`i:${e.instance}`}e(keyOf$2,`keyOf`);function fuller(e,t){let n=e.end===null&&t.end!==null?t:e,r=n===e?t:e;return{...n,incident:n.incident??r.incident,changed:[...new Set([...n.changed,...r.changed])],mocked:n.mocked||r.mocked,parent:n.parent??r.parent,sequence:Math.min(n.sequence,r.sequence)}}function deduplicated(e){let t=new Map,n=0;for(let r of e){let e=keyOf$2(r),i=t.get(e);i?(t.set(e,fuller(i,r)),n+=1):t.set(e,r)}return{kept:[...t.values()],merged:n}}var qc=0,Jc=1;function momentsOf(e){let t=[];for(let n of e)t.push({moment:{time:n.start,kind:`start`,event:n.index},bucket:Jc}),n.end!==null&&t.push({moment:{time:n.end,kind:`end`,event:n.index},bucket:n.instant?Jc:qc});let order=e=>e.kind===`start`?0:1;t.sort((e,t)=>e.moment.time-t.moment.time||e.bucket-t.bucket||e.moment.event-t.moment.event||order(e.moment)-order(t.moment));let n=Array(e.length).fill(-1),r=Array(e.length).fill(-1);return{moments:t.map(({moment:e},t)=>(e.kind===`start`?n[e.event]=t:r[e.event]=t,e)),startMoment:n,endMoment:r}}function beatsOf(e){let t=[];e.forEach((e,n)=>{e.kind===`start`&&t.push({applied:n+1,time:e.time,event:e.event})});let n=t[t.length-1];return n&&n.applied<e.length&&t.push({applied:e.length,time:e[e.length-1].time,event:null}),t}function runState(e,t){if(e.length===0)return t??`ACTIVE`;let n=e.filter(e=>e.end===null);return n.some(e=>e.state===`FAILED`)?`FAILED`:n.length>0?`ACTIVE`:t??(e.some(e=>e.state===`FAILED`)?`FAILED`:`COMPLETED`)}function iso(e){return new Date(e).toISOString()}function depthsOf(e){for(let t of e){let n=0,r=t.parent,i=new Set([t.index]);for(;r!==null&&!i.has(r);)i.add(r),n+=1,r=e[r].parent;t.depth=n}}function buildTimeline(e,t={}){let n=Array.isArray(e?.events)?e.events:[],r=[],i=0;n.forEach((e,t)=>{let n=candidateOf(e,t);n?r.push(n):i+=1});let{kept:a,merged:o}=deduplicated(r);a.sort((e,t)=>e.start-t.start||e.sequence-t.sequence);let s=new Map,c=new Map,l=a.map((e,t)=>{let n=(c.get(e.elementId)??0)+1;c.set(e.elementId,n);let r=e.instance??`${e.elementId}#${n}`;return s.set(r,t),{index:t,id:r,elementId:e.elementId,elementType:e.elementType,instance:r,parent:null,depth:0,visit:n,start:e.start,end:e.end,state:e.state,incident:e.incident,changed:e.changed,mocked:e.mocked,instant:e.end!==null&&e.end===e.start,repaired:e.repaired,via:[]}});a.forEach((e,t)=>{if(e.parent===null)return;let n=s.get(e.parent);n!==void 0&&n!==t&&(l[t].parent=n)}),depthsOf(l);let{moments:u,startMoment:d,endMoment:f}=momentsOf(l);if(t.flows&&t.flows.length>0&&l.length>0){let e=l.map(e=>({elementId:e.elementId,state:e.state,startedAt:iso(e.start),endedAt:e.end===null?null:iso(e.end)}));for(let n of Ze(e,[...t.flows]))l[n.arrival].via.push({flow:n.flow.id,from:n.from})}let p=1/0,m=-1/0;for(let e of l){e.start<p&&(p=e.start);let t=e.end??e.start;t>m&&(m=t)}let h=typeof e?.now==`number`&&Number.isFinite(e.now)?e.now:null;return l.length===0?(p=h??0,m=h??0):h!==null&&l.some(e=>e.end===null)&&h>m&&(m=h),{source:e?.source??`instance`,run:e?.run??``,state:runState(l,e?.state),events:l,moments:u,beats:beatsOf(u),startMoment:d,endMoment:f,origin:p,horizon:m,dropped:i,merged:o}}function clampCursor(e,t){return Number.isFinite(t)?Math.min(e.moments.length,Math.max(0,Math.trunc(t))):0}function cursorTime(e,t){let n=clampCursor(e,t);return n===0?null:e.moments[n-1].time}function nextCursor(e,t){let n=clampCursor(e,t),{beats:r}=e,i=0,a=r.length;for(;i<a;){let e=i+a>>1;r[e].applied>n?a=e:i=e+1}return i<r.length?r[i].applied:n}function previousCursor(e,t){let n=clampCursor(e,t),{beats:r}=e,i=0,a=r.length;for(;i<a;){let e=i+a>>1;r[e].applied>=n?a=e:i=e+1}return i>0?r[i-1].applied:0}function stepCursor(e,t,n){let r=clampCursor(e,t),i=Number.isFinite(n)?Math.trunc(n):0;for(let t=0;t<Math.abs(i);t+=1){let t=i>0?nextCursor(e,r):previousCursor(e,r);if(t===r)break;r=t}return r}function cursorOfEvent(e,t){let n=e.startMoment[t];return n===void 0||n<0?0:n+1}function visitCursor(e,t,n,r){let i=clampCursor(e,n),{beats:a,events:o}=e;if(r===1){for(let e of a)if(e.applied>i&&e.event!==null&&o[e.event].elementId===t)return e.applied;return null}for(let e=a.length-1;e>=0;--e){let n=a[e];if(n.applied<i&&n.event!==null&&o[n.event].elementId===t)return n.applied}return null}function toneOf(e){return e.tokens>0?e.openFailed>0?`failed`:`active`:e.outcome===`failed`?`failed`:e.outcome===`terminated`?`terminated`:e.visits>0?`done`:`idle`}function snapshotAt(e,t){let n=clampCursor(e,t),{events:r,moments:i}=e,a=new Uint8Array(r.length).fill(0),o=new Map;for(let e=0;e<n;e+=1){let t=i[e],n=r[t.event],s=o.get(n.elementId);s||(s={tokens:0,openFailed:0,outcome:null,visits:0},o.set(n.elementId,s)),t.kind===`start`?(a[n.index]=1,s.tokens+=1,s.visits+=1,n.state===`FAILED`&&n.end===null&&(s.openFailed+=1)):(a[n.index]=2,--s.tokens,s.outcome=n.state===`FAILED`?`failed`:n.state===`TERMINATED`?`terminated`:`done`)}let s=[],c=new Set;for(let e of r)a[e.index]===1&&(s.push(e.index),e.parent!==null&&c.add(e.parent));let l=s.filter(e=>c.has(e)),u=new Map;for(let[e,t]of o)u.set(e,{elementId:e,tone:toneOf(t),tokens:t.tokens,visits:t.visits});let d=[];for(let e of r)if(a[e.index]===0)for(let t of e.via)t.from!==null&&a[t.from]===2&&d.push({flow:t.flow,from:t.from,to:e.index});return{cursor:n,time:cursorTime(e,n),phase:a,tokens:s,containers:l,elements:u,inTransit:d}}function arrivalsOf(e,t){let n=clampCursor(e,t);if(n===0)return null;let r=e.moments[n-1];return r.kind===`start`?{event:r.event,arrivals:e.events[r.event].via}:null}function durationOf(e,t){return Math.max(0,(t.end??e.horizon)-t.start)}function coverageOf(e,t){let n=new Map;for(let t of e.events)n.set(t.elementId,(n.get(t.elementId)??0)+1);let r=new Map;for(let e of t){if(r.has(e))continue;let t=n.get(e)??0;r.set(e,{elementId:e,visits:t,covered:t>0})}let i=[...r.values()].filter(e=>!e.covered).map(e=>e.elementId),a=r.size,o=a-i.length;return{elements:r,covered:o,total:a,ratio:a===0?0:o/a,uncovered:i}}function lanesOf(e,t=[]){let n=new Map,r=[],i=new Map;for(let t of e.events){let a=n.get(t.elementId);a||(a={elementId:t.elementId,elementType:t.elementType,depth:t.depth,events:[],maxEnd:[],first:t.start,visits:0},n.set(t.elementId,a),r.push(a),i.set(a,t.parent===null?null:e.events[t.parent].elementId)),a.events.push(t.index),a.visits+=1;let o=t.end??e.horizon;a.maxEnd.push(Math.max(o,a.maxEnd[a.maxEnd.length-1]??o))}let a=new Map;for(let e of r){let t=i.get(e)??null,r=t!==null&&n.has(t)&&t!==e.elementId?t:null,o=a.get(r);o?o.push(e):a.set(r,[e])}let o=[],s=new Set,place=(e,t)=>{if(!s.has(e)){s.add(e),e.depth=t,o.push(e);for(let n of a.get(e.elementId)??[])place(n,t+1)}};for(let e of a.get(null)??[])place(e,0);for(let e of r)place(e,0);for(let e of t){if(n.has(e))continue;let t={elementId:e,elementType:``,depth:0,events:[],maxEnd:[],first:1/0,visits:0};n.set(e,t),o.push(t)}return o}function instantsOf(e){let t=new Set([e.origin,e.horizon]);for(let n of e.moments)t.add(n.time);return[...t].sort((e,t)=>e-t)}function foldedGaps(e,t,n){let r=new Set,i=e.slice(1).map((t,n)=>({index:n+1,span:t-e[n]})).sort((e,t)=>t.span-e.span),a=i.reduce((e,t)=>e+t.span,0);for(let e of i){let i=a-e.span;if(e.span<=t||i<=0||e.span<=n*i)break;r.add(e.index),a-=e.span}return r}function timeScale(e,t={}){let n=Math.max(1,t.idle??2e3),r=Math.max(0,Math.min(n,t.kept??400)),i=[],a=0,push=(e,t,n)=>{let o=n?r:t-e;i.push({from:e,to:t,x0:a,x1:a+o,collapsed:n}),a+=o},o=instantsOf(e),s=foldedGaps(o,n,t.ratio??8);if(o.length<2||o[0]===o[o.length-1])push(e.origin,e.origin,!1);else for(let e=1;e<o.length;e+=1){let t=o[e-1],n=o[e],r=i[i.length-1],c=s.has(e);r&&!c&&!r.collapsed?(r.to=n,r.x1+=n-t,a+=n-t):push(t,n,c)}let c=a,xOf=e=>{if(!(e>i[0].from))return 0;let t=0,n=i.length;for(;t<n;){let r=t+n>>1;i[r].from<=e?t=r+1:n=r}let r=i[t-1];if(e>=r.to)return r.x1;let a=r.to-r.from;return a===0?r.x0:r.x0+(e-r.from)/a*(r.x1-r.x0)},timeOf=e=>{if(!(e>0))return i[0].from;if(e>=c)return i[i.length-1].to;let t=0,n=i.length;for(;t<n;){let r=t+n>>1;i[r].x0<=e?t=r+1:n=r}let r=i[t-1],a=r.x1-r.x0;return a===0?r.from:r.from+(e-r.x0)/a*(r.to-r.from)};return{segments:i,width:c,xOf,timeOf}}var Yc=[1,2,5,10,20,50,100,200,500,1e3,2e3,5e3,1e4,15e3,3e4,6e4,12e4,3e5,6e5,18e5,36e5,72e5,216e5,432e5,864e5];function niceStep(e){let t=Yc.find(t=>t>=e);if(t!==void 0)return t;let n=Yc[Yc.length-1];return Math.ceil(e/n)*n}function ticksOf(e,t,n,r=72){if(!(n>0))return[];let i=niceStep(r/n),a=[];for(let o of e.segments){if(o.collapsed||o.to<=o.from)continue;let s=Math.ceil((o.from-t)/i)*i;for(let c=s;t+c<=o.to;c+=i){let i=e.xOf(t+c),o=a[a.length-1];o&&(i-o.x)*n<r*.75||a.push({x:i,elapsed:c})}}return a}function gapsOf(e){return e.segments.filter(e=>e.collapsed).map(e=>({x0:e.x0,x1:e.x1,span:e.to-e.from}))}function layoutOf(e,t,n){let r=new Float64Array(e.events.length),i=new Float64Array(e.events.length);for(let n of e.events)r[n.index]=t.xOf(n.start),i[n.index]=t.xOf(n.end??e.horizon);return{scale:t,start:r,end:i,reach:n.map(e=>{let t=new Float64Array(e.events.length),n=-1/0;return e.events.forEach((e,r)=>{n=Math.max(n,i[e]),t[r]=n}),t})}}function visibleBars(e,t,n,r,i,a){let o=t.events,s=e.reach[n];if(!o||o.length===0||!s)return[];let c=0,l=o.length;for(;c<l;){let e=c+l>>1;s[e]>=r?l=e:c=e+1}let u=[],d=null,flush=()=>{d&&u.push(d),d=null};for(let t=c;t<o.length;t+=1){let n=o[t],s=e.start[n];if(s>i)break;let c=e.end[n];if(!(c<r)){if(c-s>=a*2)flush(),u.push({event:n,x0:s,x1:c,merged:1});else if(d!==null&&s-d.x1<=a){let e=d;e.x1=Math.max(e.x1,c),e.merged+=1}else flush(),d={event:n,x0:s,x1:c,merged:1}}}return flush(),u}var Xc=/#multiInstanceBody$/;function isBody(e){return Xc.test(e.elementId)||e.elementType===`MULTI_INSTANCE_BODY`||e.elementType===`multiInstanceBody`}function isProcess(e){return e.elementType===`PROCESS`||e.elementType===`process`}function eventsOfTrace(e){let t=new Map;for(let n of e.incidents??[])t.has(n.elementId)||t.set(n.elementId,n.message);return(Array.isArray(e.steps)?e.steps:[]).filter(e=>!isBody(e)&&!isProcess(e)).map(e=>({elementId:e.elementId,elementType:e.elementType,...e.instance?{instance:e.instance}:{},...e.parent?{parent:e.parent}:{},start:e.startedAt,end:e.endedAt,state:e.state,incident:e.state===`FAILED`?t.get(e.elementId)??null:null,changed:(e.changed??[]).map(e=>e.name),mocked:e.mocked}))}function timelineOfTrace(e,t,n={}){return buildTimeline({source:t,run:e.instance,events:eventsOfTrace(e),state:e.state,...n.now===void 0?{}:{now:n.now}},n.flows?{flows:n.flows}:{})}function formatClock(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleTimeString([],{hourCycle:`h23`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,fractionalSecondDigits:3})}function formatElapsed(e,t){if(t>=1e3||!Number.isFinite(e)||e<0)return formatDuration(e);let n=t<10?3:t<100?2:1,r=Math.floor(e/6e4),i=(e%6e4/1e3).toFixed(n);return`${r>0?`${r}m `:``}${i}s`}var Zc=64,Qc=3,$c=256,el=[{id:`status`,label:()=>p(`app.timeline.channelStatus`)},{id:`duration`,label:()=>p(`app.timeline.channelDuration`)},{id:`coverage`,label:()=>p(`app.timeline.channelCoverage`)}],tl={COMPLETED:!0,ACTIVE:!0,FAILED:!0,TERMINATED:!0};function stateLabel(e){return p(e===`COMPLETED`?`app.timeline.stateCompleted`:e===`FAILED`?`app.timeline.stateFailed`:e===`TERMINATED`?`app.timeline.stateTerminated`:`app.timeline.stateActive`)}function heat(e,t){return t>0?Math.round(65+35*Math.sqrt(Math.min(1,Math.max(0,e/t)))):40}function Segmented({label:e,value:t,options:n,onPick:r}){return u(`div`,{class:`timeline__segmented`,role:`group`,"aria-label":e,children:n.map(e=>u(`button`,{type:`button`,class:`timeline__segment type-help`,"aria-pressed":e.id===t,onClick:()=>r(e.id),children:e.label},e.id))})}function Tool({icon:e,label:t,onClick:n,pressed:r,disabled:i}){return u(`button`,{type:`button`,class:`timeline__tool type-help`,"aria-label":t,title:t,"aria-pressed":r,disabled:i,onClick:n,children:u(ta,{name:e,className:`timeline__icon`})})}function Header({model:e,zoom:t}){let n=e.timeline,r=e.status===`ready`&&n!==null,i=n?n.beats.length:0,a=r&&e.snapshot?.time!=null?e.snapshot.time-n.origin:0,s=r?n.horizon-n.origin:0;return u(`header`,{class:`timeline__bar`,children:[u(`h2`,{class:`timeline__title type-section-heading`,children:p(`app.timeline.title`)}),r&&u(o,{children:[u(`div`,{class:`timeline__transport`,role:`group`,"aria-label":p(`app.timeline.region`),children:[u(Tool,{icon:`skip-back`,label:p(`app.timeline.toStart`),onClick:e.toStart,disabled:e.cursor===0}),u(Tool,{icon:`step-back`,label:p(`app.timeline.previousStep`),onClick:()=>e.step(-1),disabled:e.cursor===0}),u(Tool,{icon:e.playing?`pause`:`token-simulation`,label:p(`app.timeline.play`),pressed:e.playing,onClick:e.togglePlay}),u(Tool,{icon:`step-forward`,label:p(`app.timeline.nextStep`),onClick:()=>e.step(1),disabled:e.cursor>=n.moments.length}),u(Tool,{icon:`skip-forward`,label:p(`app.timeline.toEnd`),onClick:e.toEnd,disabled:e.cursor>=n.moments.length}),u(`button`,{type:`button`,class:`timeline__speed type-help`,"aria-label":p(`app.timeline.speed`,{speed:`${e.speed}x`}),title:p(`app.timeline.speed`,{speed:`${e.speed}x`}),onClick:e.cycleSpeed,children:[e.speed,`x`]})]}),u(`span`,{class:`timeline__readout`,"aria-hidden":`true`,children:[formatDuration(a),` / `,formatDuration(s),` · `,Math.min(i,beatNumber(n,e.cursor)),`/`,i]})]}),u(`span`,{class:`timeline__grow`}),r&&e.sources.instance&&e.sources.scenario&&u(Segmented,{label:p(`app.timeline.source`),value:e.source,options:[{id:`instance`,label:p(`app.timeline.sourceInstance`)},{id:`scenario`,label:p(`app.timeline.sourceScenario`)}],onPick:e.setSource}),r&&u(Segmented,{label:p(`app.timeline.channel`),value:e.channel,options:el.map(e=>({id:e.id,label:e.label()})),onPick:e.setChannel}),r&&u(o,{children:[u(Tool,{icon:`zoom-out`,label:p(`app.timeline.zoomOut`),onClick:t.out}),u(Tool,{icon:`zoom-in`,label:p(`app.timeline.zoomIn`),onClick:t.in}),u(Tool,{icon:`fit`,label:p(`app.timeline.fit`),onClick:t.fit})]}),e.sources.instance&&e.source===`instance`&&u(Tool,{icon:`refresh`,label:p(`app.timeline.refresh`),onClick:e.refresh,disabled:e.refreshing}),u(Tool,{icon:`close`,label:p(`app.timeline.close`),onClick:e.close})]})}function beatNumber(e,t){let n=0;for(let r of e.beats)if(r.applied<=t)n+=1;else break;return n}function Detail({model:e}){let t=e.timeline,n=e.selectedEvent===null?null:t.events[e.selectedEvent];if(!n)return u(`footer`,{class:`timeline__detail`,children:[u(`span`,{class:`timeline__info`,children:p(`app.timeline.detailNone`)}),legend(e)]});let r=e.stepOf(n.index),i=e.names.get(n.elementId)??n.elementId,a=r?.changed??[];return u(`footer`,{class:`timeline__detail`,children:[u(`div`,{class:`timeline__info`,children:[u(`div`,{class:`timeline__facts`,children:[u(`span`,{class:`timeline__fact-name`,children:i}),u(`span`,{class:`timeline__fact`,"data-state":n.state,children:stateLabel(n.state)}),u(`span`,{class:`timeline__fact`,children:[p(`app.timeline.detailVisit`),` `,n.visit]}),u(`span`,{class:`timeline__fact`,children:[p(`app.timeline.detailStarted`),` `,formatClock(n.start)]}),n.end!==null&&u(`span`,{class:`timeline__fact`,children:[p(`app.timeline.detailEnded`),` `,formatClock(n.end)]}),u(`span`,{class:`timeline__fact`,children:[p(`app.timeline.detailDuration`),` `,formatDuration(durationOf(t,n))]}),u(`span`,{class:`timeline__fact timeline__fact--id`,children:[p(`app.timeline.detailInstance`),` `,n.instance]}),n.mocked&&u(`span`,{class:`timeline__fact`,children:p(`app.timeline.detailMocked`)}),n.incident&&u(`span`,{class:`timeline__fact timeline__fact--error`,children:[p(`app.timeline.detailIncident`),`: `,n.incident]})]}),a.length>0&&u(`div`,{class:`timeline__changed`,children:[u(`span`,{class:`timeline__changed-label`,children:p(`app.timeline.detailChanged`)}),a.map(e=>u(`span`,{class:`timeline__chip`,title:shown(e.value),children:[e.name,e.before===void 0?`: ${shown(e.value)}`:`: ${shown(e.before)} → ${shown(e.value)}`]},e.name))]})]}),legend(e)]})}function shown(e){let t;try{t=typeof e==`string`?e:JSON.stringify(e)??String(e)}catch{t=String(e)}return t.length>60?`${t.slice(0,57)}...`:t}function legend(e){let t=e.timeline;if(e.channel===`status`)return u(`ul`,{class:`timeline__legend`,children:Object.keys(tl).map(e=>u(`li`,{class:`timeline__legend-item`,children:[u(`i`,{class:`timeline__swatch`,"data-state":e}),stateLabel(e)]},e))});if(e.channel===`duration`){let e=Math.max(0,...t.events.map(e=>durationOf(t,e)));return u(`p`,{class:`timeline__legend`,children:[u(`i`,{class:`timeline__ramp`}),`0 – `,formatDuration(e)]})}let n=coverageOf(t,e.elementIds);return u(`p`,{class:`timeline__legend`,children:p(`app.timeline.coverageSummary`,{covered:n.covered,total:n.total})})}function TimelineStrip({model:e}){let t=s(null),[i,a]=n({left:0,top:0,width:800,height:200}),[o,c]=n(1),[m,h]=n(0),g=s(0),_=r(e=>{g.current=e,h(e)},[]),v=e.timeline,y=e.status===`ready`&&v!==null&&e.snapshot!==null,b=r(()=>{let e=t.current;e&&a({left:e.scrollLeft,top:e.scrollTop,width:e.clientWidth,height:e.clientHeight})},[]);d(()=>{let e=t.current;if(!e||typeof ResizeObserver>`u`)return;let n=new ResizeObserver(b);return n.observe(e),b(),()=>n.disconnect()},[b,y]);let x=l(()=>v?timeScale(v):null,[v]),S=Math.max(1,i.width-176-Zc),C=x&&x.width>0?S/x.width:1,w=C*o,T=l(()=>v&&x?layoutOf(v,x,e.lanes):null,[v,x,e.lanes]),E=176+(x?x.width*w:0)+Zc,D=28+e.lanes.length*24,O=l(()=>v&&x?ticksOf(x,v.origin,w):[],[v,x,w]),k=l(()=>x?gapsOf(x):[],[x]),A=niceStep(72/w),j=l(()=>O.filter(e=>k.every(t=>!(e.x*w>t.x0*w-56&&e.x*w<t.x1*w))),[O,k,w]),M=l(()=>v?Math.max(0,...v.events.map(e=>durationOf(v,e))):0,[v]),N=l(()=>Math.max(1,...e.lanes.map(e=>e.visits)),[e.lanes]);f(()=>{c(1),_(0)},[v]),f(()=>{let t=e.selectedElementId?e.lanes.findIndex(t=>t.elementId===e.selectedElementId):-1;t>=0&&_(t)},[e.selectedElementId,e.lanes]);let P=e.snapshot&&e.snapshot.time!==null&&x?176+x.xOf(e.snapshot.time)*w:176;f(()=>{let n=t.current;n&&e.playing&&(P<n.scrollLeft+176||P>n.scrollLeft+i.width-8)&&(n.scrollLeft=Math.max(0,P-176-S/3))},[e.playing,P,i.width,S]);let F=r(e=>{let n=t.current;if(!n)return;let r=28+e*24;r<n.scrollTop+28?n.scrollTop=Math.max(0,r-28):r+24>n.scrollTop+n.clientHeight&&(n.scrollTop=r+24-n.clientHeight)},[]),I=r(e=>{let n=t.current,r=n&&x?(n.scrollLeft+176+S/2-176)/w:0;c(t=>{let i=Math.min($c,Math.max(1,t*e));return requestAnimationFrame(()=>{n&&(n.scrollLeft=Math.max(0,r*C*i-S/2))}),i})},[x,S,w,C]),L=l(()=>({in:()=>I(2),out:()=>I(.5),fit:()=>{c(1),t.current&&(t.current.scrollLeft=0)}}),[I]),R=r(n=>{let r=t.current;if(!r||!v||!x)return;let i=r.getBoundingClientRect(),a=(n.clientX-i.left+r.scrollLeft-176)/w;e.seek(cursorAt(v,x.timeOf(Math.max(0,a))))},[v,x,w,e.seek]),z=s(!1),onPointerDown=e=>{let n=e.target;if(e.button!==0||n.closest(`.timeline__bar-item, .timeline__label`))return;let r=t.current;if(!r)return;let i=r.getBoundingClientRect();e.clientX-i.left<176||(z.current=!0,r.setPointerCapture?.(e.pointerId),r.focus(),R(e))},onPointerMove=e=>{z.current&&R(e)},onPointerUp=e=>{z.current=!1,t.current?.releasePointerCapture?.(e.pointerId)},onKeyDown=t=>{if(!v)return;let n=t.key,move=t=>{let n=Math.min(e.lanes.length-1,Math.max(0,t));_(n),F(n);let r=e.lanes[n];r&&e.selectElement(r.elementId)};if(n===`ArrowRight`||n===`ArrowLeft`){t.preventDefault();let r=n===`ArrowRight`?1:-1;if(t.shiftKey){let t=e.lanes[g.current];t&&e.visit(t.elementId,r)}else e.step(r)}else if((n===`ArrowDown`||n===`ArrowUp`)&&t.shiftKey)t.preventDefault(),move(g.current+(n===`ArrowDown`?1:-1));else if(n===`Home`)t.preventDefault(),e.toStart();else if(n===`End`)t.preventDefault(),e.toEnd();else if(n===` `)t.preventDefault(),e.togglePlay();else if(n===`+`||n===`=`)t.preventDefault(),L.in();else if(n===`-`)t.preventDefault(),L.out();else if(n===`0`)t.preventDefault(),L.fit();else if(n===`Enter`){let n=e.lanes[g.current];n&&(t.preventDefault(),e.selectElement(n.elementId))}},onWheel=e=>{(e.ctrlKey||e.metaKey)&&(e.preventDefault(),I(e.deltaY<0?1.25:.8))},B=s(null),onGripDown=t=>{B.current={y:t.clientY,height:e.height},t.currentTarget.setPointerCapture?.(t.pointerId)},onGripMove=t=>{B.current&&e.setHeight(B.current.height+(B.current.y-t.clientY))},onGripUp=e=>{B.current=null,e.currentTarget.releasePointerCapture?.(e.pointerId)},onGripKey=t=>{(t.key===`ArrowUp`||t.key===`ArrowDown`)&&(t.preventDefault(),e.setHeight(e.height+(t.key===`ArrowUp`?24:-24)))};if(!e.open)return null;let V=u(`div`,{class:`timeline__grip`,role:`separator`,"aria-orientation":`horizontal`,"aria-label":p(`app.timeline.resize`),"aria-valuenow":e.height,tabIndex:0,onPointerDown:onGripDown,onPointerMove:onGripMove,onPointerUp:onGripUp,onKeyDown:onGripKey});if(!y||!v||!x||!T||!e.snapshot){let t=emptyOf(e);return u(`section`,{class:`timeline type-help`,"aria-label":p(`app.timeline.region`),style:{height:`${Math.min(e.height,240)}px`},children:[u(Header,{model:e,zoom:L}),u(`div`,{class:`timeline__empty`,children:u($,{title:t.title,hint:t.hint})}),V]})}let H=Math.max(0,Math.floor((i.top-28)/24)-2),U=Math.min(e.lanes.length-1,Math.ceil((i.top+i.height)/24)+2),ee=i.left/w,te=(i.left+i.width-176)/w,W=1/w,G=[];for(let n=H;n<=U;n+=1){let r=e.lanes[n];if(!r)continue;let i=visibleBars(T,r,n,ee,te,W),a=e.names.get(r.elementId)??r.elementId,o=e.snapshot.elements.get(r.elementId);G.push(u(`div`,{class:`timeline__row${n===m?` is-focused`:``}${r.elementId===e.selectedElementId?` is-selected`:``}${r.events.length===0?` is-unreached`:``}`,style:{top:`${28+n*24}px`,width:`${E}px`},"data-tone":o?.tone??`idle`,children:[u(`button`,{type:`button`,class:`timeline__label type-help`,style:{paddingLeft:`${12+r.depth*12}px`},tabIndex:-1,title:r.events.length===0?`${a} · ${p(`app.timeline.unvisited`)}`:a,"aria-label":p(`app.timeline.lane`,{name:a,count:r.visits}),onClick:()=>{_(n),e.selectElement(r.elementId),t.current?.focus()},children:[u(`i`,{class:`timeline__lane-dot`,"data-tone":o?.tone??`idle`}),u(`span`,{class:`timeline__label-text`,children:a}),r.visits>1&&u(`span`,{class:`timeline__count`,children:r.visits})]}),i.map(n=>{let i=v.events[n.event],o=Math.max(n.x1-n.x0,0)*w,s=n.merged>1,c=e.snapshot.phase[i.index]===0,l={left:`${176+n.x0*w}px`,width:`${Math.max(Qc,o)}px`};e.channel===`duration`&&(l[`--heat`]=String(heat(durationOf(v,i),M))),e.channel===`coverage`&&(l[`--heat`]=String(heat(r.visits,N)));let d=s?p(`app.timeline.merged`,{count:n.merged}):p(`app.timeline.bar`,{name:a,visit:i.visit,state:stateLabel(i.state),duration:formatDuration(durationOf(v,i))});return u(`button`,{type:`button`,tabIndex:-1,class:`timeline__bar-item${i.instant&&!s?` is-instant`:``}${s?` is-merged`:``}${c?` is-future`:``}${e.selectedEvent===i.index?` is-selected`:``}${i.incident?` has-incident`:``}${i.changed.length>0?` has-changes`:``}`,style:l,"data-channel":e.channel,"data-state":i.state,title:d,"aria-label":d,onClick:()=>{e.selectEvent(n.event),t.current?.focus()}},`${n.event}:${n.merged}`)})]},r.elementId))}let K=beatNumber(v,e.cursor),ne=e.snapshot.time===null?null:v.events[eventAt(v,e.cursor)],re=K===0?p(`app.timeline.beforeStart`):ne?p(`app.timeline.stepAt`,{step:K,total:v.beats.length,name:e.names.get(ne.elementId)??ne.elementId}):p(`app.timeline.step`,{step:K,total:v.beats.length});return u(`section`,{class:`timeline type-help`,"aria-label":p(`app.timeline.region`),style:{height:`${e.height}px`},children:[u(Header,{model:e,zoom:L}),u(`div`,{ref:t,class:`timeline__scroller`,role:`group`,"aria-label":p(`app.timeline.region`),"aria-describedby":`timeline-keys`,tabIndex:0,onScroll:b,onPointerDown,onPointerMove,onPointerUp,onPointerCancel:onPointerUp,onKeyDown,onWheel,children:u(`div`,{class:`timeline__content`,style:{width:`${E}px`,height:`${D}px`},children:[u(`div`,{class:`timeline__ruler`,style:{width:`${E}px`},children:[u(`span`,{class:`timeline__corner`}),j.map(e=>u(`span`,{class:`timeline__tick`,style:{left:`${176+e.x*w}px`},children:formatElapsed(e.elapsed,A)},e.elapsed)),k.map(e=>{let t=(e.x1-e.x0)*w>=140,n=p(`app.timeline.folded`,{span:formatDuration(e.span)});return u(`span`,{class:`timeline__gap-label`,title:n,style:{left:`${176+e.x0*w}px`,width:`${(e.x1-e.x0)*w}px`},children:t?n:formatDuration(e.span)},e.x0)})]}),k.map(e=>u(`i`,{class:`timeline__gap`,style:{left:`${176+e.x0*w}px`,width:`${(e.x1-e.x0)*w}px`,height:`${D-28}px`}},e.x0)),G,u(`div`,{class:`timeline__playhead`,"aria-hidden":`true`,style:{left:`${P}px`,height:`${D}px`}})]})}),u(Detail,{model:e}),u(`span`,{id:`timeline-keys`,class:`timeline__sr`,children:p(`app.timeline.keysHint`)}),u(`div`,{class:`timeline__sr`,role:`status`,"aria-live":e.playing?`off`:`polite`,children:re}),V]})}function cursorAt(e,t){let n=0,r=e.moments.length;for(;n<r;){let i=n+r>>1;e.moments[i].time<=t?n=i+1:r=i}return n}function eventAt(e,t){for(let n=Math.min(t,e.moments.length)-1;n>=0;--n)if(e.moments[n].kind===`start`)return e.moments[n].event;return 0}function emptyOf(e){return e.status===`loading`?{title:p(`app.timeline.loadingTitle`),hint:p(`app.timeline.loadingHint`)}:e.status===`problem`?{title:p(`app.timeline.problem`,{reason:e.problem??``}),hint:p(`app.timeline.emptyHint`)}:e.status===`noSteps`?{title:p(`app.timeline.noStepsTitle`),hint:p(`app.timeline.noStepsHint`)}:{title:p(`app.timeline.emptyTitle`),hint:p(`app.timeline.emptyHint`)}}var nl=`penstock-timeline`,rl=`http://www.w3.org/2000/svg`,il=new WeakMap;function stateOf(e){let t=il.get(e);return t||(t={markers:new Map,tokens:new Map,layer:null,travelling:[]},il.set(e,t)),t}function services(e){try{let t=e?.get?.(`canvas`),n=e?.get?.(`elementRegistry`);return t&&n?{canvas:t,registry:n}:null}catch{return null}}function layerOf(e,t){if(t.layer?.isConnected)return t.layer;try{let n=e.getLayer?.(nl,600)?.node??e.getLayer?.(nl,600);t.layer=n instanceof Element?n:null}catch{t.layer=null}return t.layer}var al={active:`penstock-run-active`,done:`penstock-run-completed`,failed:`penstock-run-failed`,terminated:`penstock-run-terminated`};function desiredMarkers(e,t){let n=new Map;for(let e of t.elements.values()){let t=al[e.tone];t&&n.set(e.elementId,t)}for(let r of e.events)if(t.phase[r.index]!==0)for(let e of r.via)n.set(e.flow,`penstock-run-flow`);for(let e of t.inTransit)n.set(e.flow,`penstock-run-flow`);return n}function applyMarkers(e,t,n,r){for(let[t,i]of n.markers)if(r.get(t)!==i){try{e.removeMarker(t,i)}catch{}n.markers.delete(t)}for(let[i,a]of r){if(n.markers.get(i)===a)continue;let r=null;try{r=t.get(i)}catch{}if(r)try{e.addMarker(i,a),n.markers.set(i,a)}catch{}}}function svg(e,t){let n=document.createElementNS(rl,e);for(let[e,r]of Object.entries(t))n.setAttribute(e,String(r));return n}function drawTokens(e,t,n,r,i){let a=new Map,o=new Set(i.containers);for(let e of i.tokens){let t=r.events[e].elementId,n=a.get(t)??{count:0,container:!0};n.count+=1,o.has(e)||(n.container=!1),a.set(t,n)}for(let[e,n]of t.tokens){let r=a.get(e);r&&n.dataset?.count===String(r.count)&&n.dataset?.container===String(r.container)||(n.remove(),t.tokens.delete(e))}for(let[r,i]of a){if(t.tokens.has(r))continue;let a=null;try{a=e.get(r)}catch{}if(!a||!Number.isFinite(a.x))continue;let o=svg(`g`,{transform:`translate(${a.x+(Number.isFinite(a.width)?a.width:0)-8} ${a.y+8})`});o.dataset.count=String(i.count),o.dataset.container=String(i.container);let s=svg(`g`,{class:`penstock-timeline-token${i.container?` is-container`:``}`});if(s.appendChild(svg(`circle`,{r:7})),i.count>1){let e=svg(`text`,{class:`type-badge`,"text-anchor":`middle`,y:3.5});e.textContent=String(i.count),s.appendChild(e)}o.appendChild(s),n.appendChild(o),t.tokens.set(r,o)}}function waypointsOf(e){return(Array.isArray(e?.waypoints)?e.waypoints:[]).filter(e=>Number.isFinite(e?.x)&&Number.isFinite(e?.y)).map(e=>({x:e.x,y:e.y}))}function pointAlong(e,t){if(e.length===0)return{x:0,y:0};if(e.length===1||t<=0)return e[0];let n=e.slice(1).map((t,n)=>Math.hypot(t.x-e[n].x,t.y-e[n].y)),r=n.reduce((e,t)=>e+t,0);if(r===0||t>=1)return e[e.length-1];let i=t*r;for(let t=0;t<n.length;t+=1){if(i<=n[t]||t===n.length-1){let r=n[t]===0?0:i/n[t];return{x:e[t].x+(e[t+1].x-e[t].x)*r,y:e[t].y+(e[t+1].y-e[t].y)*r}}i-=n[t]}return e[e.length-1]}function travel(e,t,n,r,i){let a=Wi(`--motion-slow`)/Math.max(1,i);for(let i of r){let r=null;try{r=e.get(i)}catch{}let o=waypointsOf(r);if(o.length<2)continue;let s=svg(`circle`,{class:`penstock-timeline-runner`,r:5,cx:o[0].x,cy:o[0].y});n.appendChild(s);let c=performance.now(),l=0,u={cancel:()=>{cancelAnimationFrame(l),s.remove()}},step=e=>{let t=Math.min(1,(e-c)/a),n=1-(1-t)**3,r=pointAlong(o,n);s.setAttribute(`cx`,String(r.x)),s.setAttribute(`cy`,String(r.y)),t<1?l=requestAnimationFrame(step):u.cancel()};l=requestAnimationFrame(step),t.travelling.push(u)}}function paintTimeline(e,t,n,r={}){let i=services(e);if(!i)return;let a=stateOf(e);a.travelling.forEach(e=>e.cancel()),a.travelling=[],applyMarkers(i.canvas,i.registry,a,desiredMarkers(t,n));let o=layerOf(i.canvas,a);o&&(drawTokens(i.registry,a,o,t,n),r.flowsToRun&&r.flowsToRun.length>0&&!Ki()&&travel(i.registry,a,o,r.flowsToRun,r.speed??1))}function clearTimeline(e){let t=services(e),n=il.get(e);if(n){if(n.travelling.forEach(e=>e.cancel()),n.travelling=[],t)for(let[e,r]of n.markers)try{t.canvas.removeMarker(e,r)}catch{}n.markers.clear(),n.tokens.forEach(e=>e.remove()),n.tokens.clear()}}var ol=[1,2,4];function problemText(e){return e instanceof Error?e.message:String(e)}function flowsOf(e){try{return((e?.get?.(`elementRegistry`))?.filter?.(e=>e?.type===`bpmn:SequenceFlow`&&e.source?.id&&e.target?.id)??[]).map(e=>({id:e.id,sourceId:e.source.id,targetId:e.target.id,message:!1,joins:e.target.type===`bpmn:ParallelGateway`||e.target.type===`bpmn:InclusiveGateway`}))}catch{return[]}}function flowNodesOf(e){let t=new Map,n=[];try{(e?.get?.(`elementRegistry`))?.forEach?.(e=>{if(!e?.id||e.waypoints||e.labelTarget||!ci(e.businessObject))return;let r=typeof e.businessObject?.name==`string`?e.businessObject.name.replace(/\s+/g,` `).trim():``;r&&t.set(e.id,r),n.push({id:e.id,x:Number.isFinite(e.x)?e.x:0,y:Number.isFinite(e.y)?e.y:0})})}catch{}return n.sort((e,t)=>e.x-t.x||e.y-t.y),{ids:n.map(e=>e.id),names:t}}function useTimeline({open:e,setOpen:t,live:i,trial:a,runs:o,modeler:c,selectedElementId:u}){let[d,p]=n(()=>monitorPick().instance),[m,h]=n(()=>monitorPick().instance?`finished`:`running`),[g,_]=n(null),[v,y]=n(!1),[b,x]=n(null),[S,C]=n(0),[w,T]=n(`instance`),[E,D]=n(0),[O,k]=n(!1),[A,j]=n(0),[M,N]=n(`status`),[P,F]=n(null),[I,L]=n(280),[R,z]=n(0),B=s(0),H=s(!1);f(()=>{a.instance&&h(`running`)},[a.instance]),f(()=>{let follow=({instance:e})=>{p(e),e&&h(`finished`)};return follow(monitorPick()),watchMonitorPick(follow)},[]);let U=m===`running`?a.instance??d:d??a.instance;f(()=>{U&&T(`instance`)},[U]),f(()=>{o.trace&&T(`scenario`)},[o.trace]);let ee=i.ask,te=i.engineKind,W=i.at;f(()=>{if(!e||!U||!ee||!te)return;let t=B.current+=1;return y(!0),x(null),V(te,ee,U,{runId:`timeline`}).then(e=>{B.current===t&&_({id:U,trace:e,at:Date.now()})}).catch(e=>{B.current===t&&(_(null),x(problemText(e)))}).finally(()=>{B.current===t&&y(!1)}),()=>{B.current+=1}},[e,U,ee,te,W,S]);let G=g&&U&&g.id===U?g:null,K=l(()=>({instance:U!==null,scenario:o.trace!==null}),[U,o.trace]),ne=K[w]?w:K[w===`instance`?`scenario`:`instance`]?w===`instance`?`scenario`:`instance`:w,re=ne===`instance`?G?.trace??null:o.trace,ie=ne===`instance`&&G&&(re?.state===`ACTIVE`||re?.state===`FAILED`)?G.at:void 0,ae=l(()=>e?flowNodesOf(c):{ids:[],names:new Map},[e,c,R,re]),oe=l(()=>e?flowsOf(c):[],[e,c,R,re]),se=l(()=>{if(!e||!re)return{timeline:null,failure:null};try{return{timeline:timelineOfTrace(re,ne,{flows:oe,...ie===void 0?{}:{now:ie}}),failure:null}}catch(e){return{timeline:null,failure:problemText(e)}}},[e,re,ne,oe,ie]),q=se.timeline;f(()=>{D(q?q.moments.length:0),k(!1),F(null),H.current=!1},[q]);let ce=l(()=>q?snapshotAt(q,E):null,[q,E]),le=l(()=>q?lanesOf(q,M===`coverage`?ae.ids:[]):[],[q,M,ae]);f(()=>{let e=c?.get?.(`eventBus`,!1);if(!e)return;let imported=()=>{clearTimeline(c),z(e=>e+1)};return e.on(`import.done`,imported),()=>e.off(`import.done`,imported)},[c]),f(()=>{if(!c)return;if(!e||!q||!ce){clearTimeline(c);return}let t=H.current?arrivalsOf(q,E)?.arrivals.map(e=>e.flow)??[]:[];H.current=!1,paintTimeline(c,q,ce,{flowsToRun:t,speed:ol[A]})},[c,e,q,ce,E,A,R]),f(()=>()=>clearTimeline(c),[c]);let ue=q?q.moments.length:0;f(()=>{if(!O||!q)return;if(E>=ue||Ki()){D(ue),k(!1);return}let e=setTimeout(()=>{H.current=!0,D(e=>nextCursor(q,e))},Wi(`--motion-beat`)/ol[A]);return()=>clearTimeout(e)},[O,E,ue,q,A]),f(()=>{try{c?.get?.(`canvas`)?.resized?.()}catch{}},[c,e,I]);let de=r(e=>{q&&(k(!1),D(Math.min(q.moments.length,Math.max(0,Math.trunc(e)))))},[q]),fe=r(e=>{q&&(k(!1),H.current=e===1,D(t=>stepCursor(q,t,e)))},[q]),pe=r(e=>{try{focusDefect(c,[e])}catch{}},[c]),me=r((e,t)=>{if(!q)return;let n=visitCursor(q,e,E,t);n!==null&&(k(!1),D(n))},[q,E]),he=r(e=>{q?.events[e]&&(k(!1),F(e),D(cursorOfEvent(q,e)),pe(q.events[e].elementId))},[q,pe]),ge=l(()=>{let e=new Map;for(let t of re?.steps??[])t.instance&&e.set(`${t.elementId}|i:${t.instance}`,t),e.set(`${t.elementId}|t:${parseTime(t.startedAt)}`,t);return e},[re]),_e=r(e=>{let t=q?.events[e];return t?ge.get(`${t.elementId}|i:${t.instance}`)??ge.get(`${t.elementId}|t:${t.start}`)??null:null},[q,ge]),ve=r(()=>t(!e),[e,t]),ye=r(()=>t(!1),[t]),be=r(()=>{q&&(O?k(!1):(E>=q.moments.length&&D(0),k(!0)))},[q,O,E]);return{open:e,toggle:ve,close:ye,status:!K.instance&&!K.scenario?`empty`:ne===`instance`&&!G?b?`problem`:ee?`loading`:`empty`:se.failure?`problem`:q?q.events.length===0?`noSteps`:`ready`:`loading`,problem:se.failure??b,source:ne,sources:K,setSource:T,label:q?.run??``,timeline:q,lanes:le,elementIds:ae.ids,names:ae.names,cursor:E,snapshot:ce,seek:de,step:fe,visit:me,toStart:r(()=>de(0),[de]),toEnd:r(()=>de(ue),[de,ue]),playing:O,togglePlay:be,speed:ol[A],cycleSpeed:r(()=>j(e=>(e+1)%ol.length),[]),channel:M,setChannel:N,selectedEvent:P,selectEvent:he,selectElement:pe,stepOf:_e,selectedElementId:u,refresh:r(()=>C(e=>e+1),[]),refreshing:v,height:I,setHeight:r(e=>L(Math.min(720,Math.max(160,Math.round(e)))),[])}}function withoutAbsenceClaims(e,t){return!t||t.files===0||t.status===`ready`?e:e.map(e=>({...e,missingImplementation:!1,neverThrown:!1,unsetReads:[],unfetched:[],unread:[],lateReads:[],unknownFields:[],unknownNames:[]}))}function codeSections(e,t){return e?[`implementations`,`tests`,`usages`].filter(t=>(e[t]?.length??0)>0).map(n=>{let r=e[n]??[];return{key:n,title:p(`app.code.section.${n}`),links:r,shown:r.slice(0,t),more:Math.max(0,r.length-t)}}):[]}function codeWarnings(e){if(!e)return[];let t=e.unsetReads??[],n=e.unfetched??[];return[...e.missingImplementation?[p(`app.code.warn.missingImplementation`)]:[],...e.neverThrown?[p(`app.code.warn.neverThrown`)]:[],...t.map(e=>e.closest?p(`app.code.warn.unsetTypo`,{name:e.name,closest:e.closest}):p(`app.code.warn.unset`,{name:e.name})),...n.map(e=>e.closest?p(`app.code.warn.unfetchedClosest`,{closest:e.closest,name:e.name}):p(`app.code.warn.unfetched`,{name:e.name})),...(e.unread??[]).map(e=>p(`app.code.warn.unread`,{name:e})),...(e.lateReads??[]).map(e=>p(`app.code.warn.lateRead`,{name:e})),...(e.near??[]).map(e=>e.caseOnly?p(`app.code.warn.nearCase`,{name:e.name,near:e.near}):p(`app.code.warn.near`,{name:e.name,near:e.near})),...(e.implicit??[]).map(e=>p(`app.code.warn.implicit`,{method:e.method})),...(e.mappingOrder??[]).map(e=>p(`app.code.warn.mappingOrder`,{path:e.path,target:e.target})),...e.lostUpdate?[p(`app.code.warn.lostUpdate`,{name:e.lostUpdate})]:[]]}var sl=5;function LinkRow({link:e,title:t,code:n}){return u(`li`,{children:u(`button`,{type:`button`,class:`code-tab__link`,title:e.declaration??e.label,onClick:()=>n.openLink(e,t),children:[u(`span`,{class:`code-tab__label`,children:e.label}),e.declaration&&e.declaration!==e.label&&u(`span`,{class:`code-tab__declaration`,children:e.declaration})]})})}function CodeTab({code:e,selectedElementId:t,views:n,push:r}){if(!t)return u($,{title:p(`app.code.selectATaskToSee`),hint:p(`app.code.theWorkersClassesBeansAnd`),guide:`code`});let i=e.found(t),a=i?.title??e.nameOf(t),o=i?codeSections(i,sl):[],s=codeWarnings(e.entry(t)),c=n[n.length-1];if(c){let t=o.find(e=>e.key===c.key);return u(`div`,{class:`code-tab`,children:[u(`h3`,{class:`code-tab__heading`,children:t?.title??c.title}),u(`ul`,{class:`code-tab__list`,children:(t?.links??[]).map(t=>u(LinkRow,{link:t,title:a,code:e},`${t.label}${t.declaration??``}`))})]})}return!i||o.length===0&&s.length===0?u(`div`,{class:`code-tab`,children:[u(`h2`,{class:`code-tab__title`,children:a}),$t(e.clientFacts)?u(un,{facts:e.clientFacts}):u($,{title:p(`app.code.noCodeFoundForThis`),guide:`code`,hint:e.hasProject?e.licensed?p(`app.code.nothingInTheProjectRuns`):p(`app.code.followingAStepToThe`):p(`app.code.theProjectHasNotBeen`),actions:e.hasProject?[{label:p(`app.code.findUsages`),run:()=>e.findUsages(t)}]:[]})]}):u(`div`,{class:`code-tab`,children:[u(`div`,{class:`code-tab__head`,children:[u(`h2`,{class:`code-tab__title`,title:a,children:a}),u(`div`,{class:`code-tab__actions`,children:[i.implementations.length>0&&u(`button`,{type:`button`,class:`ui-button ui-button--primary`,onClick:()=>e.openImplementation(t),children:p(`app.code.goToCode`)}),u(`button`,{type:`button`,class:`ui-button`,onClick:()=>e.findUsages(t),children:p(`app.code.findUsages`)})]})]}),o.length===0&&u(un,{facts:e.clientFacts}),s.map(e=>u(`p`,{class:`code-tab__warning`,children:e},e)),o.map(n=>u(`section`,{class:`code-tab__section`,children:[u(`h3`,{class:`code-tab__heading`,children:[n.title,` (`,n.links.length,`)`]}),u(`ul`,{class:`code-tab__list`,children:n.shown.map(t=>u(LinkRow,{link:t,title:a,code:e},`${t.label}${t.declaration??``}`))}),n.more>0&&u(`button`,{type:`button`,class:`code-tab__more`,onClick:()=>r({key:n.key,title:`${n.title} - ${a}`}),children:p(`app.code.showAllCount`,{count:n.links.length})}),n.key===`tests`&&e.runTests&&u(`div`,{class:`code-tab__actions`,children:[u(`button`,{type:`button`,class:`ui-button`,onClick:()=>e.runTests?.(t,!1),children:p(`app.code.runTests`)}),u(`button`,{type:`button`,class:`ui-button`,onClick:()=>e.runTests?.(t,!0),children:p(`app.code.debugTests`)})]}),n.key===`tests`&&!e.runTests&&u(`p`,{class:`code-tab__note type-help`,children:p(`app.webHost.testsNeedTheIde`)})]},n.key))]})}var cl=`properties-panel.multi-command-executor`;function author(){return on(window.appConfig)}function whenOf(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}function run(e,t){if(e?.execute&&Array.isArray(t)&&t.length)try{e.execute(cl,t)}catch{}}function Comment({element:e,comment:t,commandStack:r,bpmnFactory:i}){let a=Ht(t,author()),[s,c]=n(null),l={};try{l=(e?Ti(e):null)??{}}catch{}let d=t.resolved===!0;return u(`li`,{class:`penstock-comment${d?` is-resolved`:``}`,children:[u(`div`,{class:`penstock-comment__head`,children:[u(`span`,{class:`penstock-comment__author`,children:t.author||p(`app.comments.anonymous`)}),u(`span`,{class:`penstock-comment__date`,children:whenOf(t.date)}),d&&u(`span`,{class:`penstock-comment__state`,children:p(`app.comments.resolvedState`)})]}),s===null?u(`p`,{class:`penstock-comment__text`,children:t.text}):u(`textarea`,{class:`ui-input penstock-comment__editor`,"aria-label":p(`app.comments.comment`),value:s,onInput:e=>c(e.target.value)}),u(`div`,{class:`penstock-comment__actions`,children:[a&&(s===null?u(`button`,{type:`button`,class:`ui-button ui-button--quiet`,onClick:()=>c(t.text??``),children:p(`app.comments.edit`)}):u(o,{children:[u(`button`,{type:`button`,class:`ui-button ui-button--quiet ui-button--primary`,onClick:()=>{run(r,ln(e,l,i,t,s.trim())),c(null)},children:p(`app.comments.save`)}),u(`button`,{type:`button`,class:`ui-button ui-button--quiet`,onClick:()=>c(null),children:p(`app.comments.cancel`)})]})),u(`button`,{type:`button`,class:`ui-button ui-button--quiet`,onClick:()=>run(r,Gt(e,l,i,t,!d)),children:p(d?`app.comments.reopen`:`app.comments.resolve`)}),u(`button`,{type:`button`,class:`ui-button ui-button--quiet ui-button--danger`,onClick:()=>run(r,Hn(e,l,i,t)),children:p(`app.comments.delete`)})]})]})}function CommentAddField({element:e,commandStack:t,bpmnFactory:r}){let[i,a]=n(``),o={};try{o=(e?Ti(e):null)??{}}catch{}let s=author();return u(`div`,{class:`penstock-comment-add`,children:[u(`label`,{class:`penstock-comment-add__label`,for:`penstock-comment-new`,children:p(`app.comments.addAComment`)}),u(`textarea`,{id:`penstock-comment-new`,class:`ui-input penstock-comment-add__text`,placeholder:p(`app.comments.sayWhatThisElementIs`),value:i,onInput:e=>a(e.target.value)}),u(`div`,{class:`penstock-comment-add__row`,children:[s&&u(`span`,{class:`penstock-comment-add__author`,children:p(`app.comments.signedBy`,{name:s})}),u(`button`,{type:`button`,class:`ui-button ui-button--primary penstock-comment-add__submit`,disabled:!i.trim(),onClick:()=>{run(t,Ft(e,o,r,{author:s,text:i.trim()},new Date)),a(``)},children:p(`app.comments.addComment`)})]})]})}function CommentThread({element:e,comments:t,empty:n,commandStack:r,bpmnFactory:i}){return t.length===0?u(`p`,{class:`penstock-comments__empty`,children:n}):u(`ul`,{class:`penstock-comments__list`,children:t.map((t,n)=>u(Comment,{element:e,comment:t,commandStack:r,bpmnFactory:i},t.id??n))})}function CommentList({element:e,id:t,commandStack:n,bpmnFactory:r}){let i=[];try{let t=e?Ti(e):null;i=X(t)}catch{i=[]}return u(`div`,{class:`penstock-comments`,id:t,children:[i.length===0?u($,{title:p(`app.comments.noCommentsYet`),hint:p(`app.comments.writeTheFirstOneBelow`)}):u(CommentThread,{element:e,comments:i,empty:``,commandStack:n,bpmnFactory:r}),u(CommentAddField,{element:e,commandStack:n,bpmnFactory:r})]})}function revealElement(e,t){let n=e.get(`elementRegistry`),r=e.get(`canvas`),i=shapeFor(n,t);if(!i)return!1;let a=r.findRoot(i);return a&&a!==r.getRootElement()&&r.setRootElement(a),e.get(`selection`).select(i),r.scrollToElement(i,{top:120,bottom:120,left:120,right:120}),!0}var ll=[`selection.changed`,`commandStack.changed`,`import.done`];function service(e,t){try{return e?.get?.(t)??null}catch{return null}}function shapesOf(e){let t=service(e,`elementRegistry`),n=[];try{t?.forEach(e=>{e&&n.push(e)})}catch{return n}return n}function selectedIdOf(e){try{let[t]=service(e,`selection`)?.get?.()??[];return t?.id?t===service(e,`canvas`)?.getRootElement?.()?void 0:t.id:void 0}catch{return}}function openTotalOf(e){return Kt(shapesOf(e))}function useOpenCommentCount(e){let[t,r]=n(0);return d(()=>{if(!e){r(0);return}let t=service(e,`eventBus`),read=()=>{try{r(openTotalOf(e))}catch{r(0)}};if(read(),t)return t.on(ll,read),()=>{try{t.off(ll,read)}catch{}}},[e]),t}function useComments(e){let[,t]=n(0);d(()=>{if(!e)return;let n=service(e,`eventBus`);if(!n)return;let bump=()=>t(e=>e+1);return n.on(ll,bump),()=>{try{n.off(ll,bump)}catch{}}},[e]);let r=l(()=>({commandStack:service(e,`commandStack`)??{execute:()=>void 0},bpmnFactory:service(e,`bpmnFactory`)??{create:e=>({$type:e})}}),[e]),i=e?shapesOf(e):[],element=e=>i.find(t=>t.id===e)??null;return{ready:!!e,total:Kt(i),elements:Ut(i),selected:selectedIdOf(e),services:r,element,label:e=>sn(element(e)),reveal:t=>{if(e&&t)try{revealElement(e,t)}catch{}}}}function openCommentsTab(e){return t=>{try{e?.select?.(`comments`),t&&e?.reveal?.(t)}catch{}}}function whereText(e){let t=e.resolved.length;return e.open.length?t?p(`app.comments.openAndResolved`,{open:e.open.length,resolved:t}):p(`app.comments.openCount`,{count:e.open.length}):p(`app.comments.resolvedCount`,{count:t})}function resolvedTotal(e){return e.reduce((e,t)=>e+t.resolved.length,0)}function countText(e){return p(`app.comments.openCommentCount`,{count:e})}function Thread({shape:e,comments:t,empty:n,services:r}){return u(CommentThread,{element:e,comments:t,empty:n,commandStack:r.commandStack,bpmnFactory:r.bpmnFactory})}function ElementGroup({comments:e,entry:t,showResolved:n,onOpen:r}){return u(`section`,{class:`comments-tab__group`,children:[u(`button`,{type:`button`,class:`diagram-check__row comments-tab__element`,title:p(`app.comments.showOnTheDiagram`,{label:t.label}),onClick:()=>r(t.id),children:[u(`span`,{class:`diagram-check__row-title`,children:t.label}),u(`span`,{class:`diagram-check__row-where`,children:whereText(t)})]}),u(Thread,{shape:e.element(t.id),comments:n?[...t.open,...t.resolved]:t.open,empty:p(`app.comments.noOpenComments`),services:e.services})]})}function DiagramList({comments:e,showResolved:t,toggleResolved:n,onOpen:r}){let i=resolvedTotal(e.elements);return u(`div`,{class:`comments-tab`,children:[u(`header`,{class:`problems__bar comments-tab__bar`,children:[u(`span`,{class:`problems__count`,children:e.total?countText(e.total):``}),i>0&&u(`button`,{type:`button`,class:`ui-button`,"aria-pressed":t,onClick:n,children:t?p(`app.comments.hideResolved`):p(`app.comments.showResolved`,{resolved:i})})]}),e.elements.length===0?u($,{title:p(`app.comments.noCommentsYet`),hint:p(`app.comments.selectAnElementAndAdd`),guide:`comments`}):e.elements.map(n=>u(ElementGroup,{comments:e,entry:n,showResolved:t,onOpen:r},n.id))]})}function ElementThread({comments:e,id:t}){let n=e.element(t);return n?cn(n.businessObject)?u(`div`,{class:`comments-tab`,children:u(CommentList,{id:`js-comments`,element:n,commandStack:e.services.commandStack,bpmnFactory:e.services.bpmnFactory})}):u($,{title:p(`app.comments.thisElementCannotTakeComments`),hint:p(`app.comments.aCommentBelongsToAn`),guide:`comments`}):u($,{title:p(`app.comments.thisElementIsNoLonger`),hint:p(`app.comments.everyElementThatStillHas`)})}function CommentsTab({modeler:e,views:t,push:r,reset:i}){let a=useComments(e),[o,c]=n(!1),l=s(t);l.current=t;let d=t[t.length-1]?.key??``;return f(()=>{let e=l.current[l.current.length-1]?.key;if(a.selected){if(e===a.selected)return;i(),r({key:a.selected,title:a.label(a.selected)})}else e&&i()},[a.selected]),a.ready?d?u(ElementThread,{comments:a,id:d}):u(DiagramList,{comments:a,showResolved:o,toggleResolved:()=>c(e=>!e),onOpen:a.reveal}):u($,{title:p(`app.comments.waitingForADiagram`),hint:p(`app.comments.everyOpenCommentInThe`),guide:`comments`})}var ul=a(null),dl=ul.Provider;function facts(){let e=i(ul);if(!e)throw Error(`the editor tabs need their facts`);return e}function PropertiesTab({active:e}){let{selectedElementId:t,modeler:n,reveal:r}=facts();return u(`div`,{class:`sidebar-properties`,children:u(PropertiesPanel,{selectedElementId:t,modeler:n,containerId:`js-properties-panel`,isPanelCollapsed:!e,reveal:r?.entries??null,onRevealed:r?.onRevealed??(()=>{})})})}function ProblemsPanel(){let{check:e,clientFacts:t}=facts();return u(ProblemsTab,{check:e,clientFacts:t})}function MonitorPanel(){let{live:e,trial:t,modeler:n,monitor:r}=facts();return u(MonitorTab,{live:e,trial:t,modeler:n,hasImplementation:r?.hasImplementation??(()=>!1),onOpenImplementation:r?.onOpenImplementation??(()=>{}),onConnect:r?.onConnect??(()=>{})})}function DebugPanel(){let{debug:e,modeler:t,onConnectEngine:n}=facts();return u(DebugTab,{debug:e,modeler:t,onConnect:n??(()=>{})})}function TimelineSlot(){return u(TimelineStrip,{model:facts().timeline})}function CodePanel({views:e,push:t}){let{code:n,selectedElementId:r}=facts();return u(CodeTab,{code:n,selectedElementId:r,views:e,push:t})}function CommentsPanel({views:e,push:t,reset:n}){return u(CommentsTab,{modeler:facts().modeler,views:e,push:t,reset:n})}var fl=Hi([{id:`properties`,icon:`properties`,component:PropertiesTab},Ui,{id:`problems`,icon:`problems`,component:ProblemsPanel,padded:!0},{id:`scenarios`,icon:`scenarios`,component:ScenariosTab,bar:ScenariosBar,ownHeader:!0},{id:`comments`,icon:`comments`,component:CommentsPanel,padded:!0},{id:`code`,icon:`code`,component:CodePanel,padded:!0},{id:`monitor`,icon:`monitor`,component:MonitorPanel,padded:!0},{id:`debug`,icon:`debug`,component:DebugPanel,padded:!0}]),pl=`penstock-debug-current`,ml=`penstock-debug-active`,hl=`penstock-debug`;function escape(e){return e.replace(/[&<>"']/g,e=>({"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`})[e]??e)}function clearDebugPosition(e){if(e)try{let t=e.get(`canvas`),n=e.get(`elementRegistry`),r=e.get(`overlays`);if(!t||!n)return;n.forEach(e=>{t.removeMarker(e,pl),t.removeMarker(e,ml)}),r?.remove?.({type:hl})}catch(e){console.error(`Could not clear the debug position:`,e)}}function showDebugPosition(e,t){if(clearDebugPosition(e),e&&t)try{let n=e.get(`canvas`),r=e.get(`elementRegistry`),i=e.get(`overlays`);if(!n||!r||!i)return;(t.active??[]).filter(e=>r.get(e)).forEach(e=>n.addMarker(e,ml));let a=(t.current??[]).map(e=>r.get(e)).filter(Boolean),o=escape([t.source,t.instance&&p(`app.debug.instanceOf`,{id:t.instance})].filter(Boolean).join(` · `)),s=escape(p(`app.debug.pausedHere`));a.forEach(e=>{n.addMarker(e,pl),i.add(e,hl,{position:{top:-28,left:0},html:`<div class="penstock-debug-badge" title="${o}">${s}</div>`})});let c=a[0];if(!c)return;let l=n.findRoot?.(c);l&&l!==n.getRootElement?.()&&n.setRootElement?.(l),n.scrollToElement?.(c,{top:160,bottom:160,left:160,right:160})}catch(e){console.error(`Could not show the debug position:`,e)}}function attachScriptTabs(e,t){let n=e.get(`eventBus`),r=new Map,i=[],reportChanges=()=>{i.forEach(n=>{let i=mn(n),a=kn(e,n);a!==void 0&&r.get(i)!==a&&(r.set(i,a),t.reportScriptSlot(n,a).catch(e=>{console.error(`Penstock could not report a script to its tab:`,e)}))})};return n.on(`commandStack.changed`,reportChanges),{setOpen(e){i=e;let t=new Set(e.map(mn));[...r.keys()].filter(e=>!t.has(e)).forEach(e=>r.delete(e)),Wn(e),reportChanges()},applyHostWrite(t,n){let i=kn(e,t);return i!==void 0&&(r.set(mn(t),n),i===n||zn(e,t,n))},history(t){e.get(`commandStack`)[t]()},dispose(){n.off(`commandStack.changed`,reportChanges),i=[],r.clear(),Wn([])}}}var gl=function(e){return e.SVG=`SVG`,e.PNG=`PNG`,e.PDF=`PDF`,e}({}),_l=[h.LIGHT,h.DARK,h.DRACULA],vl={[h.LIGHT]:`app.export.themeLight`,[h.DARK]:`app.export.themeDark`,[h.DRACULA]:`app.export.themeDracula`},yl=_l.map(e=>({value:e,key:vl[e]}));function exportThemeOf(e){return _l.find(t=>t===e)??null}var bl=[{value:null,key:`app.export.schemaDefault`},{value:`SKETCHY`,key:`app.export.schemaSketchy`}],xl=[{value:gl.SVG,label:`SVG`},{value:gl.PNG,label:`PNG`},{value:gl.PDF,label:`PDF`}],Sl={[h.LIGHT]:si.light.defaultFillColor,[h.DARK]:si.dark.defaultFillColor,[h.DRACULA]:si.dracula.defaultFillColor},Cl={[h.LIGHT]:si.light.defaultStrokeColor,[h.DARK]:si.dark.defaultStrokeColor,[h.DRACULA]:si.dracula.defaultStrokeColor},wl={theme:h.LIGHT,useBackground:!0};function base64Of(e){let t=e.indexOf(`,`);return t>=0?e.slice(t+1):e}async function copyPicture(e,t){if(!e?.svg)return!1;try{let n=t.backgroundOf(e.theme),r=e.useBackground?t.withBackground(e.svg,n):e.svg,i=await t.toPng(r,e.useBackground?n:`transparent`);return await t.save(base64Of(i))}catch(e){return console.error(e),!1}}function previewModelerRun(){let e=null,t=!1,own=n=>t?(n.destroy(),!1):(e=n,!0),release=()=>{t=!0,e?.destroy(),e=null};return{own,cancelled:()=>t,release}}var Tl=16,El=`var(--theme-border-light)`,Dl=`var(--theme-bg-primary)`;function transparencyChecker(){let e=Tl/2;return{backgroundColor:Dl,backgroundImage:`linear-gradient(45deg,${El} 25%,transparent 25%),linear-gradient(-45deg,${El} 25%,transparent 25%),linear-gradient(45deg,transparent 75%,${El} 75%),linear-gradient(-45deg,transparent 75%,${El} 75%)`,backgroundSize:`${Tl}px ${Tl}px`,backgroundPosition:`0 0,0 ${e}px,${e}px -${e}px,-${e}px 0px`}}function colorOf(e,t,n){let r=_l.find(e=>e===t);return r?e[r]:n}function getThemeBackgroundColor(e){return colorOf(Sl,e,`#ffffff`)}function getThemeStrokeColor(e){return colorOf(Cl,e,`#000000`)}function hideGridPatterns(e){e?.querySelector(`defs`)?.querySelectorAll(`pattern`).forEach(e=>{e.style.display=`none`})}function applyStylesToMarkers(e,t){let n=e.querySelector(`svg[width="100%"][height="100%"]`);if(!n)return;let r=document.createElement(`style`);r.textContent=`
11
+ svg marker path,
12
+ svg marker polygon,
13
+ svg marker circle {
14
+ fill: ${t} !important;
15
+ stroke: ${t} !important;
16
+ }
17
+
18
+ svg g[class*="djs-connection"] path,
19
+ svg g[class*="djs-connection"] polyline,
20
+ svg g[class*="djs-connection"] line {
21
+ stroke: ${t} !important;
22
+ }
23
+ `,e.appendChild(r),n.querySelectorAll(`marker`).forEach(e=>{e.querySelectorAll(`path, polygon, circle`).forEach(e=>{let n=e;n.style.setProperty(`fill`,t,`important`),n.style.setProperty(`stroke`,t,`important`),n.setAttribute(`fill`,t),n.setAttribute(`stroke`,t)})}),n.querySelectorAll(`g[class*="djs-connection"]`).forEach(e=>{e.querySelectorAll(`path, polyline, line`).forEach(e=>{let n=e;n.style.setProperty(`stroke`,t,`important`),n.setAttribute(`stroke`,t)})})}function findCollapsedSubProcesses(e){let t=new DOMParser().parseFromString(e,`text/xml`),n=[],findSubProcessesRecursive=(e,r=[])=>{let i=e.getAttribute(`id`),a=e.getAttribute(`name`)||i||p(`app.export.unnamedSubprocess`),o=t.querySelector(`BPMNShape[bpmnElement="${i}"]`)?.getAttribute(`isExpanded`);if(i&&(!o||o===`false`)){let e=r.length>0?`${r.join(` > `)} > ${a}`:a;n.push({id:i,name:e})}e.querySelectorAll(`:scope > subProcess`).forEach(e=>{findSubProcessesRecursive(e,[...r,a])})};return t.querySelectorAll(`process > subProcess`).forEach(e=>findSubProcessesRecursive(e)),n}function createSubProcessXml(e,t){let n=new DOMParser().parseFromString(e,`text/xml`),r=n.querySelector(`subProcess[id="${t}"]`);if(!r)return e;let i=n.createElementNS(r.namespaceURI,`process`);i.setAttribute(`id`,`Process_SubProcess_Export`),i.setAttribute(`isExecutable`,`false`),Array.from(r.children).forEach(e=>{let t=e.tagName.toLowerCase();!t.includes(`incoming`)&&!t.includes(`outgoing`)&&i.appendChild(e.cloneNode(!0))});let a=n.querySelector(`definitions`);if(!a)return e;let o=a.querySelector(`process`);o&&a.replaceChild(i,o);let s=`http://www.omg.org/spec/BPMN/20100524/DI`,c=`http://www.omg.org/spec/DD/20100524/DI`,l=n.createElementNS(s,`bpmndi:BPMNDiagram`);l.setAttribute(`id`,`BPMNDiagram_SubProcess`);let u=n.createElementNS(s,`bpmndi:BPMNPlane`);u.setAttribute(`id`,`BPMNPlane_SubProcess`),u.setAttribute(`bpmnElement`,`Process_SubProcess_Export`);let d=n.querySelector(`BPMNPlane[bpmnElement="${t}"], bpmndi\\:BPMNPlane[bpmnElement="${t}"]`);if(d)Array.from(d.children).forEach(e=>{u.appendChild(e.cloneNode(!0))});else{let e=collectAllElementIds(r),t=new Map,i=100,a=100;e.forEach(e=>{let o=r.querySelector(`[id="${e}"]`);if(!o)return;let c=o.tagName.toLowerCase();if(c.includes(`flow`))return;let l=n.createElementNS(s,`bpmndi:BPMNShape`);l.setAttribute(`id`,`BPMNShape_${e}`),l.setAttribute(`bpmnElement`,e);let d=n.createElementNS(`http://www.omg.org/spec/DD/20100524/DC`,`dc:Bounds`),f=100,p=80;c.includes(`task`)||c.includes(`activity`)?(f=100,p=80):c.includes(`gateway`)?(f=50,p=50):c.includes(`event`)&&(f=36,p=36),d.setAttribute(`x`,i.toString()),d.setAttribute(`y`,a.toString()),d.setAttribute(`width`,f.toString()),d.setAttribute(`height`,p.toString()),t.set(e,{x:i,y:a,width:f,height:p}),i+=150,i>800&&(i=100,a+=150),l.appendChild(d),u.appendChild(l)}),e.forEach(e=>{let i=r.querySelector(`[id="${e}"]`);if(i&&i.tagName.toLowerCase().includes(`flow`)){let r=n.createElementNS(s,`bpmndi:BPMNEdge`);r.setAttribute(`id`,`BPMNEdge_${e}`),r.setAttribute(`bpmnElement`,e);let a=i.getAttribute(`sourceRef`),o=i.getAttribute(`targetRef`);if(a&&o){let e=t.get(a),i=t.get(o);if(e&&i){let t=n.createElementNS(c,`di:waypoint`);t.setAttribute(`x`,(e.x+e.width/2).toString()),t.setAttribute(`y`,(e.y+e.height/2).toString());let a=n.createElementNS(c,`di:waypoint`);a.setAttribute(`x`,(i.x+i.width/2).toString()),a.setAttribute(`y`,(i.y+i.height/2).toString()),r.appendChild(t),r.appendChild(a),u.appendChild(r)}}}})}function collectAllElementIds(e){let t=new Set,n=e.getAttribute(`id`);return n&&t.add(n),Array.from(e.children).forEach(e=>{collectAllElementIds(e).forEach(e=>t.add(e))}),t}return l.appendChild(u),a.querySelectorAll(`BPMNDiagram, bpmndi\\:BPMNDiagram`).forEach(e=>{a.removeChild(e)}),a.appendChild(l),new XMLSerializer().serializeToString(n)}function ExportDialog({isOpen:e,onClose:t,onExport:r,onCopy:i,bpmnXml:a,apiClient:o,isCamunda8:c,isCamunda7:l}){let d=hi(),[p,m]=n(wl.theme),[h,g]=n(``),[_,v]=n(gl.SVG),[y,b]=n(wl.useBackground),[x,S]=n(!1),[C,w]=n(`main`),[T,E]=n([]),[D,O]=n(!1),k=s(null),A=s(null);f(()=>{if(e){m(wl.theme),g(``),v(gl.SVG),b(wl.useBackground),w(`main`);let e=findCollapsedSubProcesses(a);E(e),x||S(!0)}else!e&&x&&S(!1)},[e]),f(()=>{if(!e||!k.current||!a)return;let t=null,n=previewModelerRun(),initializePreview=async()=>{let e=k.current;e.innerHTML=``,e.className=`export-preview-container`,e.style.cssText=``;let r=document.createElement(`div`);r.style.width=`100%`,r.style.height=`100%`,e.appendChild(r);let i={container:r,width:`100%`,height:`100%`},s=[];h===`SKETCHY`?(s.push(Kn),i.textRenderer=oi):i.textRenderer=li;let u=p.toLowerCase();si[u]?i.bpmnRenderer=si[u]:console.warn(`Theme not found in themeConfig:`,u,`Available:`,Object.keys(si));let f=C===`main`?a:createSubProcessXml(a,C);if(c?(s.push(Xn),t=new vn({...i,additionalModules:s,taskResizingEnabled:!0})):t=l?new Nn({...i,additionalModules:s}):new nn({...i,additionalModules:s}),!t)console.error(`Failed to create modeler instance`);else if(n.own(t))try{if(await t.importXML(f),n.cancelled())return;try{let e=await o.bpmn.getConfig();if(n.cancelled())return;let r=On(ca(e?.elementTemplatesContent),Tt(e?.engine)?.family??null).loadable;if(r.length>0){let e=t.get(`elementTemplates`);e&&e.set(r)}}catch(e){console.warn(`Element templates not loaded:`,e)}let i=t.get(`canvas`);i.zoom(`fit-viewport`,`auto`);let a=i.zoom();a<1&&i.zoom(a*.92,`auto`),t.get(`eventBus`).on([`element.click`,`element.dblclick`,`element.mousedown`,`element.hover`,`shape.move.start`,`connection.move.start`,`resize.start`,`canvas.viewbox.changing`],1e4,()=>!1);let s=e.querySelector(`.djs-context-pad`);s&&(s.style.display=`none`);let c=e.querySelector(`.djs-palette`);c&&(c.style.display=`none`);let l=e.querySelector(`svg[width="100%"][height="100%"]`),u=e.querySelector(`.djs-container`),d=getThemeStrokeColor(p);if(e.style.pointerEvents=`none`,r.style.pointerEvents=`none`,u&&(u.style.pointerEvents=`none`),y){let t=getThemeBackgroundColor(p);e.style.backgroundColor=t,e.style.backgroundImage=`none`,r.style.backgroundColor=t,r.style.backgroundImage=`none`,u&&(u.style.backgroundColor=t,u.style.backgroundImage=`none`),l&&(l.style.setProperty(`background-color`,t,`important`),l.style.setProperty(`background-image`,`none`,`important`))}else{let t=transparencyChecker();[e,r].forEach(e=>Object.assign(e.style,t)),u&&Object.assign(u.style,t),l&&(l.style.setProperty(`background-color`,`transparent`,`important`),l.style.setProperty(`background-image`,`none`,`important`))}if(hideGridPatterns(l),applyStylesToMarkers(e,d),l&&h!==`SKETCHY`&&l.querySelectorAll(`text`).forEach(e=>{e.style.setProperty(`font-family`,`Arial, sans-serif`,`important`)}),n.cancelled())return;A.current=t}catch(e){console.error(`Failed to import BPMN for preview:`,e),console.error(`Error details:`,e.message,e.stack),console.error(`XML length:`,f?.length),console.error(`Config:`,i),Z.error(d(`app.export.previewFailed`))}};return initializePreview(),()=>{n.release(),A.current===t&&(A.current=null)}},[e,a,p,h,y,C,c,l,o]);let handleCopy=async()=>{if(!D&&A.current){O(!0);try{let{svg:e}=await A.current.saveSVG();await i({theme:p,schema:h===``?null:h,format:_,useBackground:y,selectedDiagram:C,bpmnXml:``,svg:e})&&t()}catch(e){console.error(`Copy failed:`,e),Z.error(d(`app.export.copyFailed`))}finally{O(!1)}}},handleExport=async()=>{if(!D){if(!A.current)Z.error(d(`app.export.notLoaded`));else{O(!0);try{let{svg:e}=await A.current.saveSVG();await r({theme:p,schema:h===``?null:h,format:_,useBackground:y,selectedDiagram:C,bpmnXml:``,svg:e}),t()}catch(e){console.error(`Export failed:`,e)}finally{O(!1)}}}};return e?u(mi,{title:d(`app.export.title`),size:`large`,body:`split`,backdrop:`close`,labels:`top`,onClose:t,onSubmit:handleExport,footer:u(vi,{actions:[{id:`cancel`,label:d(`app.export.cancel`),role:`cancel`,onClick:t},{id:`copy`,label:d(`app.export.copy`),role:`secondary`,onClick:handleCopy,disabled:D,title:d(`app.export.copyTitle`)},{id:`save`,label:d(D?`app.export.exporting`:`app.export.export`),role:`primary`,onClick:handleExport,disabled:D}]}),children:[u(`div`,{className:`export-preview-container`,ref:k}),u(`div`,{className:`export-sidebar`,children:u(`div`,{className:`export-controls`,children:[T.length>0&&u(Q,{label:d(`app.export.diagram`),children:e=>u(`select`,{...e,value:C,onChange:e=>w(e.target.value),children:[u(`option`,{value:`main`,children:d(`app.export.mainDiagram`)}),T.map(e=>u(`option`,{value:e.id,children:e.name},e.id))]})}),u(Q,{label:d(`app.export.theme`),children:e=>u(`select`,{...e,value:p,onChange:e=>{let t=exportThemeOf(e.target.value);t&&m(t)},children:yl.map(e=>u(`option`,{value:e.value,children:d(e.key)},e.value))})}),u(Q,{label:d(`app.export.schema`),children:e=>u(`select`,{...e,value:h,onChange:e=>g(e.target.value),children:bl.map(e=>u(`option`,{value:e.value??``,children:d(e.key)},e.value??`default`))})}),u(Q,{label:d(`app.export.format`),children:e=>u(`select`,{...e,value:_,onChange:e=>v(e.target.value),children:xl.map(e=>u(`option`,{value:e.value,disabled:e.disabled,children:e.label},e.value))})}),u(`label`,{className:`ui-choice`,children:[u(`input`,{type:`checkbox`,checked:y,onChange:e=>b(e.target.checked)}),u(`span`,{children:d(`app.export.background`)})]})]})})]}):null}var Ol=kt(`camunda-7`),kl=kt(`operaton`),Al=[[Mt[`camunda-7`].bpmn,Mt.operaton.bpmn],[Mt[`camunda-7`].dmn,Mt.operaton.dmn]],jl=`${Et(`operaton`)}.`,Ml=[...new Set(At.map(e=>`${Et(e)}.`))],Nl=new RegExp(String.raw`(<${Ol}:[^>]*[^/]>)([^<]*)(</${Ol}:)`,`g`),Pl=new RegExp(String.raw`(^</?|\s)${Ol}:(?=[A-Za-z])`,`g`),Fl=RegExp(`xmlns:${Ol}=`,`g`);function movedPackages(e){return Ml.reduce((e,t)=>e.split(t).join(jl),e)}function toOperaton(e){return Al.some(([t])=>e.includes(`xmlns:${Ol}="${t}"`))?Al.reduce((e,[t,n])=>e.split(t).join(n),e.replace(Nl,(e,t,n,r)=>`${t}${movedPackages(n)}${r}`)).replace(/<[^>]*>/g,e=>movedPackages(e).replace(Pl,`$1${kl}:`).replace(Fl,`xmlns:${kl}=`)):e}var Il={error:`<path d="M4.5 4.5 11.5 11.5M11.5 4.5 4.5 11.5" />`,warning:`<path d="M8 3.5v6M8 12v.5" />`,readability:`<circle cx="8" cy="8" r="1" fill="currentColor" />`,success:`<path d="M3.5 8.5 6.5 11.5 12.5 4.5" />`};function pillOf(e){return e?.querySelector(`.bjsl-button`)??null}function glyph(e){let t=document.createElement(`span`);return t.className=`icon`,t.innerHTML=`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${Il[e]}</svg>`,t}function countOf(e,t){let n=document.createElement(`span`);n.className=`bjsl-count bjsl-count-${e}`,n.append(glyph(e));let r=document.createElement(`span`);return r.textContent=String(t),n.append(r),n}function paintPill(e,t,n){if(!e)return;let r=Qn(t,n),i=[];t.errors>0&&i.push(countOf(`error`,t.errors)),t.warnings>0&&i.push(countOf(`warning`,t.warnings)),t.readability>0&&i.push(countOf(`readability`,t.readability));let a=t.errors+t.warnings+t.readability>0;i.length===0&&i.push(glyph(`success`)),e.replaceChildren(...i);let o=p(a?`app.lint.showWhereTheyAreOn`:`app.lint.nothingToShowOnThe`);e.setAttribute(`aria-label`,`${r.replace(/\.$/,``)}. ${o}`),e.setAttribute(`title`,`${r.replace(/\.$/,``)}. ${o}`);let s=t.errors>0?`error`:t.warnings>0||n?`warning`:`success`;[`error`,`warning`,`success`,`inactive`].forEach(t=>e.classList.toggle(`bjsl-button-${t}`,t===s))}function segments(e){return e.replace(/\\/g,`/`).split(`/`).filter(Boolean)}function isFoundByFolder(e,t){let n=segments(e);if(n.length<3)return!1;let r=n.slice(0,-1);if(r[r.length-1]!==`element-templates`||r[r.length-2]!==`.camunda`)return!1;let i=r.slice(0,-2),a=segments(t).slice(0,-1);return i.length<=a.length&&i.every((e,t)=>e===a[t])}var Ll=null;function connectorsPrimitive(){let e=null;try{e=Y()}catch{e=null}return e?(Ll?.bridge!==e&&(Ll={bridge:e,primitive:{fetch:t=>typeof e?.fetchConnectorUrl==`function`?e.fetchConnectorUrl(t):Promise.reject(Error(`fetchConnectorUrl not supported`)),file:(t,n,r,i)=>typeof e?.connectorFile==`function`?e.connectorFile(t,n,r,i):Promise.reject(Error(`connectorFile not supported`))}}),Ll.primitive):{fetch:()=>Promise.reject(Error(`PlatformBridge is not initialized`)),file:()=>Promise.reject(Error(`PlatformBridge is not initialized`))}}function useTemplatesCatalog(){let[e,t]=n({catalog:null,isLoading:!1,error:null,nextAttempt:null}),i=s(!0);f(()=>(i.current=!0,()=>{i.current=!1}),[]);let a=r(async e=>{i.current&&t(e=>({...e,isLoading:!0}));try{let n=await Ie(connectorsPrimitive(),{forceRefresh:e});if(!i.current)return;t({catalog:n?.catalog??null,isLoading:!1,error:n?.error??null,nextAttempt:n?.nextAttempt??null})}catch(e){if(!i.current)return;t(t=>({...t,isLoading:!1,error:e instanceof Error?e.message:p(`app.marketplace.theConnectorTemplatesCouldNot`)}))}},[]),o=r(async e=>{let t=await ze(connectorsPrimitive(),e),n=e?.name??`template`;if(!t)throw Error(`The downloaded file for ${n} is missing; check for updates to download it again`);return t},[]);return{...e,load:a,templateOf:o}}function elementTypeOf(e){return e.elementType??e.appliesTo[0]??``}function elementTypeLabel(e){if(!e)return p(`app.marketplace.anyElement`);let t=e.replace(/^bpmn:/,``),n=`app.element.kind.${t[0].toLowerCase()}${t.slice(1)}`,r=p(n);if(r!==n)return r.charAt(0).toUpperCase()+r.slice(1);let i=t.replace(/([a-z])([A-Z])/g,`$1 $2`).toLowerCase();return i.charAt(0).toUpperCase()+i.slice(1)}function engineRequirement(e){return e.engines.camunda??null}function isCompatible(e,t){let n=engineRequirement(e);return!t||!n||$e(n,t)!==!1}function count(e){let t=new Map;for(let n of e)t.set(n,(t.get(n)??0)+1);return[...t.entries()].map(([e,t])=>({value:e,count:t})).sort((e,t)=>t.count-e.count||e.value.localeCompare(t.value))}function facetsOf(e){let t=count(e.map(e=>e.category).filter(e=>e!==null));return{elementTypes:count(e.map(elementTypeOf)),categories:t.length>1?t:[]}}function matchesQuery(e,t){let n=t.trim().toLowerCase();return!n||[e.name,e.description??``,e.id,e.category??``,...e.keywords].some(e=>e.toLowerCase().includes(n))}function variantOf(e){let t=e.elementType;return typeof t==`string`?t:t&&typeof t==`object`&&typeof t.value==`string`?t.value:Array.isArray(e.appliesTo)?e.appliesTo.join(`|`):``}function isAmbiguous(e,t){return t.some(t=>t.id===e.id&&variantOf(t)!==variantOf(e))}function fileNameOf(e,t){let n=t&&e.elementType?`-${e.elementType.replace(/^bpmn:/,``)}`:``,r=e.version===null?``:`-v${e.version}`;return`${e.id}${n}${r}.json`.replace(/[^A-Za-z0-9._-]+/g,`-`)}function isInstalled(e,t,n){return t.some(t=>typeof t==`string`?t.split(/[\\/]/).pop()===n:t.id===e.id&&(t.version??null)===e.version&&variantOf(t)===variantOf(e))}function visibleTemplates(e,t,n,r){return e.filter(e=>matchesQuery(e,t.query)&&(t.elementType===null||elementTypeOf(e)===t.elementType)&&(t.category===null||e.category===t.category)&&(!t.installedOnly||r(e))&&(t.showIncompatible||isCompatible(e,n))).sort((e,t)=>Number(e.deprecated)-Number(t.deprecated))}var Rl=new Set([`a`,`b`,`i`,`em`,`strong`,`p`,`br`,`ul`,`ol`,`li`,`code`,`pre`,`span`]),zl=new Set([`script`,`style`,`iframe`,`object`,`embed`,`noscript`]),Bl=/^(?:https?:|mailto:)/i;function childrenOf(e,t=0){return!e||!e.childNodes||t>20?[]:Array.from(e.childNodes).map(e=>toChild(e,t+1)).filter(e=>e!==null)}function toChild(e,n){if(!e)return null;let r=e.nodeType;if(r===3)return e.textContent??``;if(r!==1)return null;let i=e,a=(i.tagName??``).toLowerCase();if(!a||zl.has(a))return null;if(!Rl.has(a))return childrenOf(i,n);if(a===`a`){let e=i.getAttribute?.(`href`)??``;return Bl.test(e.trim())?t(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`},childrenOf(i,n)):childrenOf(i,n)}return t(a,null,childrenOf(i,n))}function RichText({html:e}){if(!e)return t(`span`,null);if(typeof DOMParser>`u`)return t(`span`,null,e);try{let n=new DOMParser().parseFromString(e,`text/html`);return t(`span`,null,childrenOf(n.body))}catch{return t(`span`,null,e)}}function typeLabel(e){let t=`app.marketplace.type.${e}`,n=p(t);return n===t?e:n}function installLabel(e,t){return e?`app.marketplace.installing`:t?`app.marketplace.installed`:`app.marketplace.install`}function asProperties(e){return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`&&typeof e.type==`string`):[]}function asGroups(e){return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`&&typeof e.id==`string`):[]}function PropertyItem({property:e}){let t=Array.isArray(e.choices)?e.choices:[];return u(`div`,{className:`template-detail-property`,children:[u(`div`,{className:`template-detail-property-header`,children:[u(`span`,{className:`template-detail-property-label`,children:[e.label||e.id||p(`app.marketplace.unnamed`),e.constraints?.notEmpty===!0&&u(`span`,{className:`template-detail-required`,children:`*`})]}),u(`span`,{className:`template-detail-property-type`,children:typeLabel(e.type)})]}),typeof e.description==`string`&&u(`p`,{className:`template-detail-property-description`,children:u(RichText,{html:e.description})}),u(`div`,{className:`template-detail-property-meta`,children:[u(`span`,{className:`template-detail-binding`,children:[e.binding?.type,e.binding?.name&&u(`code`,{className:`template-detail-binding-name`,children:e.binding.name})]}),e.feel&&u(`span`,{className:`template-detail-feel`,children:p(`app.marketplace.feelIs`,{feel:e.feel})})]}),t.length>0&&u(`div`,{className:`template-detail-choices`,children:[u(`span`,{className:`template-detail-choices-label`,children:p(`app.marketplace.options`)}),u(`ul`,{className:`template-detail-choices-list`,children:[t.slice(0,5).map((e,t)=>u(`li`,{children:String(e.name)},t)),t.length>5&&u(`li`,{className:`template-detail-choices-more`,children:p(`app.common.more`,{number:t.length-5})})]})]}),e.value!==void 0&&e.type!==`Hidden`&&u(`div`,{className:`template-detail-default`,children:[u(`span`,{children:p(`app.marketplace.default`)}),u(`code`,{children:String(e.value)})]})]})}function TemplateDetail({summary:e,engineVersion:t,onBack:r,onInstall:i,isInstalling:a,isInstalled:s,templateOf:c}){let[l,d]=n(null),[m,h]=n(null),[g,_]=n(new Set);f(()=>{d(null),h(null);let t=!1;return c(e).then(e=>{t||(d(e),_(new Set(asGroups(e.groups).slice(0,3).map(e=>e.id))))}).catch(e=>{t||h(e instanceof Error?e.message:String(e))}),()=>{t=!0}},[e,c]);let toggle=e=>_(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),v=asProperties(l?.properties).filter(e=>e.type!==`Hidden`),y=[...asGroups(l?.groups),{id:`_ungrouped`,label:p(`app.marketplace.otherProperties`)}],b=new Set(y.map(e=>e.id)),groupOf=e=>e.group&&b.has(e.group)?e.group:`_ungrouped`,x=engineRequirement(e),S=isCompatible(e,t);return u(`div`,{className:`template-detail`,children:[u(`div`,{className:`template-detail-header`,children:[u(`button`,{type:`button`,className:`sidebar__icon template-detail-back`,"aria-label":p(`app.marketplace.backToTheTemplates`),title:p(`app.marketplace.backToTheTemplates`),onClick:r,children:u(`svg`,{viewBox:`0 0 16 16`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:u(`path`,{d:`M10 3.5L5.5 8l4.5 4.5`})})}),u(`div`,{className:`template-detail-header-info`,children:[u(`h3`,{className:`template-detail-title`,children:e.name}),e.version!==null&&u(`span`,{className:`template-detail-version`,children:[`v`,e.version]})]}),u(`button`,{type:`button`,className:`ui-button ${s?``:`ui-button--primary`}`,onClick:()=>i(e),disabled:s||a,children:p(installLabel(a,s))})]}),u(`div`,{className:`template-detail-body`,children:[m&&u(`div`,{className:`template-detail-error`,children:u(`span`,{children:m})}),!m&&!l&&u(`div`,{className:`template-detail-loading`,children:[u(`div`,{className:`marketplace-spinner`}),u(`span`,{children:p(`app.marketplace.loadingTemplateDetails`)})]}),l&&u(o,{children:[u(`section`,{className:`template-detail-section`,children:[u(`h3`,{className:`template-detail-section-title`,children:p(`app.marketplace.overview`)}),e.deprecated&&u(`p`,{className:`template-detail-deprecated`,children:[p(`app.marketplace.deprecated`),e.deprecatedMessage?`: ${e.deprecatedMessage}`:``]}),e.description&&u(`p`,{className:`template-detail-description`,children:u(RichText,{html:e.description})}),u(`div`,{className:`template-detail-meta-grid`,children:[u(`div`,{className:`template-detail-meta-item`,children:[u(`span`,{className:`template-detail-meta-label`,children:p(`app.marketplace.elementType`)}),u(`span`,{className:`template-detail-meta-value`,children:elementTypeLabel(elementTypeOf(e))})]}),u(`div`,{className:`template-detail-meta-item`,children:[u(`span`,{className:`template-detail-meta-label`,children:p(`app.marketplace.appliesTo`)}),u(`span`,{className:`template-detail-meta-value`,children:(Array.isArray(e?.appliesTo)?e.appliesTo:[]).map(elementTypeLabel).join(`, `)})]}),x&&u(`div`,{className:`template-detail-meta-item`,children:[u(`span`,{className:`template-detail-meta-label`,children:p(`app.marketplace.engine`)}),u(`span`,{className:`template-detail-meta-value`,children:[`Camunda `,x,!S&&t&&p(`app.marketplace.thisDiagramTargets`,{version:t})]})]}),u(`div`,{className:`template-detail-meta-item`,children:[u(`span`,{className:`template-detail-meta-label`,children:p(`app.marketplace.properties`)}),u(`span`,{className:`template-detail-meta-value`,children:p(`app.marketplace.configurable`,{number:v.length})})]})]}),e.documentationRef&&u(`a`,{href:e.documentationRef,target:`_blank`,rel:`noopener noreferrer`,className:`template-detail-docs-link`,children:p(`app.marketplace.viewDocumentation`)})]}),u(`section`,{className:`template-detail-section`,children:[u(`h3`,{className:`template-detail-section-title`,children:p(`app.marketplace.configurationProperties`)}),u(`div`,{className:`template-detail-groups`,children:y.map(e=>{let t=v.filter(t=>groupOf(t)===e.id);if(t.length===0)return null;let n=g.has(e.id);return u(`div`,{className:`template-detail-group`,children:[u(`button`,{className:`template-detail-group-header ${n?`expanded`:``}`,onClick:()=>toggle(e.id),children:[u(`span`,{className:`template-detail-group-title`,children:[e.label,u(`span`,{className:`template-detail-group-count`,children:[`(`,t.length,`)`]})]}),u(`svg`,{className:`template-detail-group-chevron`,width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,children:u(`path`,{d:`M4 6l4 4 4-4`})})]}),n&&u(`div`,{className:`template-detail-group-content`,children:t.map((e,t)=>u(PropertyItem,{property:e},e.id??t))})]},e.id)})})]})]})]})]})}var Vl=864e5;function startOfDay(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function clockTime(e){return e.toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}function formatRelativeTime(e,t=new Date){if(!e)return``;let n=new Date(e);if(Number.isNaN(n.getTime()))return``;let r=Math.round((startOfDay(n)-startOfDay(t))/Vl);return r===0?n.getTime()>t.getTime()?p(`app.marketplace.todayAt`,{time:clockTime(n)}):p(`app.marketplace.today`):r===1?p(`app.marketplace.tomorrowAt`,{time:clockTime(n)}):r===-1?p(`app.marketplace.yesterday`):r<-1&&r>-7?p(`app.marketplace.daysAgo`,{count:-r}):n.toLocaleDateString()}var Hl={query:``,elementType:null,category:null,installedOnly:!1,showIncompatible:!1};function TemplateIcon({summary:e}){if(e?.icon&&typeof e.icon==`string`&&e.icon.startsWith(`data:image/`))return u(`img`,{src:e.icon,alt:``,className:`marketplace-card-icon-img`});let t=(e?.name??``).trim().charAt(0).toUpperCase()||`?`;return u(`span`,{className:`marketplace-card-letter`,children:t})}function TemplateCard({summary:e,compatible:t,installed:n,installing:r,onInstall:i,onDetails:a}){let o=engineRequirement(e);return u(`div`,{className:`marketplace-compact-card ${t?``:`marketplace-compact-card--incompatible`}`,children:[u(`div`,{className:`marketplace-card-icon`,children:u(TemplateIcon,{summary:e})}),u(`div`,{className:`marketplace-card-content`,children:[u(`div`,{className:`marketplace-card-header`,children:u(`h3`,{className:`marketplace-card-name`,title:e.name,children:e.name})}),e.description&&u(`p`,{className:`marketplace-card-description`,children:e.description}),u(`div`,{className:`marketplace-card-meta`,children:[u(`span`,{className:`marketplace-card-badge`,children:elementTypeLabel(elementTypeOf(e))}),e.version!==null&&u(`span`,{className:`marketplace-card-badge`,children:[`v`,e.version]}),o&&u(`span`,{className:`marketplace-card-badge ${t?``:`marketplace-card-badge--warning`}`,title:t?void 0:p(`app.marketplace.needsANewerCamundaEngine`),children:[`Camunda `,o]}),e.deprecated&&u(`span`,{className:`marketplace-card-badge marketplace-card-badge--warning`,title:e.deprecatedMessage??void 0,children:p(`app.marketplace.deprecated`)})]}),u(`div`,{className:`marketplace-card-actions`,children:[u(`button`,{className:`marketplace-card-details`,onClick:()=>a(e),children:p(`app.marketplace.details`)}),u(`button`,{className:`marketplace-card-install ${n?`installed`:``}`,onClick:()=>i(e),disabled:n||r,children:p(r?`app.marketplace.installing`:n?`app.marketplace.installed`:`app.marketplace.install`)})]})]})]})}function FacetList({title:e,facets:t,selected:n,label:r,onSelect:i,total:a}){return t.length===0?null:u(`div`,{className:`marketplace-sidebar-section`,children:[u(`h4`,{className:`marketplace-sidebar-title`,children:e}),u(`nav`,{className:`marketplace-sidebar-nav`,children:[u(`button`,{className:`marketplace-sidebar-item ${n===null?`active`:``}`,onClick:()=>i(null),children:[u(`span`,{className:`marketplace-sidebar-item-name`,children:p(`app.marketplace.all`)}),u(`span`,{className:`marketplace-sidebar-item-count`,children:a})]}),t.map(e=>u(`button`,{className:`marketplace-sidebar-item ${n===e.value?`active`:``}`,onClick:()=>i(e.value),children:[u(`span`,{className:`marketplace-sidebar-item-name`,children:r(e.value)}),u(`span`,{className:`marketplace-sidebar-item-count`,children:e.count})]},e.value))]})]})}function TemplatesMarketplace({isOpen:e,onClose:t,apiClient:i,installedTemplates:a,engineVersion:c,onTemplateInstalled:d}){let{catalog:m,isLoading:h,error:g,nextAttempt:_,load:v,templateOf:y}=useTemplatesCatalog(),[b,x]=n(Hl),[S,C]=n(null),[w,T]=n(null),E=s(!1);f(()=>{e?E.current||(E.current=!0,v(!1)):(E.current=!1,T(null))},[e,v]);let D=m?.newest??[],O=l(()=>{let e=new Map;for(let t of D)e.set(t.key,fileNameOf(t,isAmbiguous(t,D)));return e},[D]),k=r(e=>isInstalled(e,a,O.get(e.key)??fileNameOf(e,!1)),[a,O]),A=l(()=>D.filter(e=>isCompatible(e,c)).length,[D,c]),j=D.length-A,M=l(()=>b.showIncompatible?D:D.filter(e=>isCompatible(e,c)),[D,c,b.showIncompatible]),N=l(()=>facetsOf(M),[M]),P=l(()=>visibleTemplates(D,b,c,k),[D,b,c,k]),update=e=>x(t=>({...t,...e})),F=r(async e=>{C(e.key);try{let t=await i.bpmn.getConfig().catch(()=>null),n=JSON.stringify(await y(e),null,2),r=await i.file.chooseFile(`json`,{title:p(`app.marketplace.saveElementTemplate`,{name:e.name}),description:p(`app.marketplace.selectLocationToSaveThe`),mode:`save`,defaultFileName:O.get(e.key)??fileNameOf(e,!1),defaultDirectory:t?.elementTemplatesFolder??void 0});if(!r)return;await i.file.saveFile(r,n);let a=t?.bpmnFilePath??``;d(r,n),a&&!isFoundByFolder(r,a)?Z.info(p(`app.marketplace.templateSavedPenstockFindsTemplates`,{name:e.name})):Z.success(p(`app.marketplace.templateInstalled`,{name:e.name})),T(null)}catch(e){console.error(`Installing the template failed:`,e),Z.error(p(`app.marketplace.unableToInstallTheTemplate`,{failure:e instanceof Error?e.message:String(e)}))}finally{C(null)}},[i,O,d,y]);if(!e)return null;let I=b.query.trim()!==``||b.elementType!==null||b.category!==null||b.installedOnly;return u(mi,{title:p(`app.marketplace.connectorTemplates`),size:`xlarge`,body:`split`,backdrop:`close`,onClose:()=>w?T(null):t(),class:`marketplace-dialog`,children:u(`div`,{className:`marketplace-main`,children:[u(`aside`,{className:`marketplace-sidebar`,children:[u(`div`,{className:`marketplace-sidebar-search`,children:u(`input`,{type:`text`,placeholder:p(`app.common.search`),"aria-label":p(`app.marketplace.searchTemplatesByNameDescription`),value:b.query,onInput:e=>update({query:e.target.value}),className:`marketplace-sidebar-input`})}),u(`div`,{className:`marketplace-sidebar-installed-filter`,children:[u(`button`,{className:`marketplace-installed-checkbox ${b.installedOnly?`active`:``}`,onClick:()=>update({installedOnly:!b.installedOnly}),children:u(`span`,{className:`marketplace-installed-checkbox-label`,children:p(`app.marketplace.installedOnly`)})}),c&&j>0&&u(`button`,{className:`marketplace-installed-checkbox ${b.showIncompatible?`active`:``}`,onClick:()=>update({showIncompatible:!b.showIncompatible}),title:p(`app.marketplace.thisDiagramTargetsCamunda`,{engineVersion:c}),children:u(`span`,{className:`marketplace-installed-checkbox-label`,children:p(`app.marketplace.showForNewerEngines`,{number:j})})})]}),u(FacetList,{title:p(`app.marketplace.elementType`),facets:N.elementTypes,selected:b.elementType,label:elementTypeLabel,onSelect:e=>update({elementType:e}),total:M.length}),u(FacetList,{title:p(`app.marketplace.category`),facets:N.categories,selected:b.category,label:e=>e,onSelect:e=>update({category:e}),total:M.length})]}),u(`main`,{className:`marketplace-content`,children:[w&&u(TemplateDetail,{summary:w,engineVersion:c,onBack:()=>T(null),onInstall:e=>void F(e),isInstalling:S===w.key,isInstalled:k(w),templateOf:y}),!w&&m&&u(`div`,{className:`marketplace-source`,children:[p(`app.marketplace.camundaConnectors`,{ref:m.ref}),m.checkedAt?p(`app.marketplace.checked`,{when:formatRelativeTime(m.checkedAt)}):``,u(`button`,{onClick:()=>void v(!0),disabled:h,children:p(`app.marketplace.checkForUpdates`)})]}),!w&&m&&g&&!h&&u(`div`,{className:`marketplace-warning`,children:u(`span`,{children:p(`app.marketplace.couldNotCheckForANewerRelease`,{error:g})})}),!w&&!m&&g&&!h&&u(`div`,{className:`marketplace-error`,children:[u(`span`,{children:[p(`app.marketplace.couldNotDownloadConnectors`,{error:g}),_?p(`app.marketplace.triedAgainAfter`,{when:formatRelativeTime(_)}):``]}),u(`button`,{onClick:()=>void v(!0),children:p(`app.common.retry`)})]}),!w&&h&&u(`div`,{className:`marketplace-loading`,children:[u(`div`,{className:`marketplace-spinner`}),u(`span`,{children:p(m?`app.marketplace.checkingForANewerRelease`:`app.marketplace.downloadingTheConnectorTemplatesFrom`)})]}),!w&&m&&!h&&P.length===0&&u(`div`,{className:`marketplace-empty`,children:[u(`span`,{children:p(I?`app.marketplace.noTemplateMatchesTheFilters`:`app.marketplace.noTemplateFitsThisDiagram`)}),I&&u(`button`,{className:`marketplace-empty-action`,onClick:()=>x(Hl),children:p(`app.marketplace.clearFilters`)})]}),!w&&m&&!h&&P.length>0&&u(o,{children:[u(`div`,{className:`marketplace-results-header`,children:u(`span`,{className:`marketplace-results-count`,children:[p(`app.marketplace.templateCount`,{count:P.length}),c&&!b.showIncompatible?p(`app.marketplace.forCamunda`,{version:c}):``]})}),u(`div`,{className:`marketplace-cards-grid`,children:P.map(e=>u(TemplateCard,{summary:e,compatible:isCompatible(e,c),installed:k(e),installing:S===e.key,onInstall:e=>void F(e),onDetails:T},e.key))})]})]})]})})}var Ul=`penstock-missing-template`,Wl=[[`zeebe:modelerTemplate`,`zeebe:modelerTemplateVersion`],[`camunda:modelerTemplate`,`camunda:modelerTemplateVersion`]],Gl=new WeakMap;function keyOf$1(e){return`${e.id}@${e.version??`_`}`}e(keyOf$1,`keyOf`);function distinct(e){return[...new Map(e.map(e=>[keyOf$1(e),e])).values()]}function attribute(e,t){return e?.get?.(t)??e?.$attrs?.[t]}function engineVersionOf(e){let t=e?.getDefinitions?.();if(!t)return null;let n=attribute(t,`modeler:executionPlatform`),r=attribute(t,`modeler:executionPlatformVersion`);return typeof r!=`string`||!/^\d+\.\d+/.test(r)||typeof n==`string`&&n!==`Camunda Cloud`?null:r}function referencesOf$1(e){let t=new Map,n=new Set;for(let r of e.get(`elementRegistry`).getAll()){let e=r.businessObject;if(e&&!n.has(e)&&r.type!==`label`){n.add(e);for(let[n,i]of Wl){let a=attribute(e,n);if(typeof a!=`string`||!a)continue;let o=attribute(e,i),s=typeof o==`number`?o:typeof o==`string`?Number(o):NaN,c=Number.isInteger(s)?s:null,l=String(e.$type),u=`${a}@${c??`_`}#${l}`,d=t.get(u)??{id:a,version:c,elementType:l,elementIds:[],zeebe:n.startsWith(`zeebe:`)};d.elementIds.push(r.id),t.set(u,d)}}}return[...t.values()]}e(referencesOf$1,`referencesOf`);function cachedTemplatesOf(e){return e&&typeof e==`object`?Gl.get(e)??[]:[]}function clearBadges(e){e.get(`overlays`,!1)?.remove({type:Ul})}function showBadges(e,t,n){let r=e.get(`overlays`,!1),i=e.get(`elementRegistry`);if(r)for(let e of t)for(let t of e.elementIds){if(!i.get(t))continue;let a=document.createElement(`div`);a.className=`penstock-missing-template`;let o=document.createElement(`span`),s=e.version===null?``:` version ${e.version}`;o.textContent=p(`app.marketplace.templateNotDownloaded`),a.title=p(`app.marketplace.isNotInTheProject`,{id:e.id,version:s});let c=document.createElement(`button`);c.type=`button`,c.textContent=p(`app.marketplace.download`),c.addEventListener(`click`,e=>{e.stopPropagation(),c.disabled=!0,n()}),a.append(o,c),r.add(t,Ul,{position:{top:-28,left:0},html:a})}}async function applyCachedTemplates(e,t){let n=e?.get?.(`elementTemplates`,!1);if(!n)return{added:0,missing:[]};clearBadges(e);let r=referencesOf$1(e).filter(e=>!n.get(e.id,e.version??void 0));if(r.length===0)return{added:0,missing:[]};let{templates:i,missing:a}=await it(connectorsPrimitive(),r);if(i.length>0){let t=new Set(n.getAll().map(keyOf$1)),r=i.filter(e=>!t.has(keyOf$1(e)));n.set([...n.getAll(),...r]),Gl.set(e,distinct([...cachedTemplatesOf(e),...i]))}let o=r.filter(e=>e.zeebe&&a.some(t=>t.id===e.id&&t.version===e.version&&t.elementType===e.elementType));return showBadges(e,o,()=>{Ie(connectorsPrimitive(),{forceRefresh:!0}).then(({catalog:n,error:r})=>{if(!n)throw Error(r??`The connector templates could not be downloaded`);return applyCachedTemplates(e,t)}).then(e=>{e.missing.length>0&&t(p(`app.marketplace.notAmongConnectors`,{ids:e.missing.map(e=>e.id).join(`, `)}))}).catch(n=>{t(n instanceof Error?n.message:String(n)),applyCachedTemplates(e,t)})}),{added:i.length,missing:o}}var Kl=function(e){return e.CAMUNDA_8=`CAMUNDA_8`,e.CAMUNDA_7=`CAMUNDA_7`,e.OPERATON=`OPERATON`,e.CIB_SEVEN=`CIB_SEVEN`,e.FLOWABLE=`FLOWABLE`,e.ACTIVITI=`ACTIVITI`,e.CLASSIC_BPMN=`CLASSIC_BPMN`,e}({}),ql=function(e){return e.NONE=`NONE`,e.GROOVY=`GROOVY`,e.JAVASCRIPT=`JAVASCRIPT`,e}({}),Jl=[{engine:Kl.CAMUNDA_8,label:`Camunda 8`},{engine:Kl.OPERATON,label:`Operaton`},{engine:Kl.CIB_SEVEN,label:`CIB seven`},{engine:Kl.CAMUNDA_7,label:`Camunda 7`},{engine:Kl.FLOWABLE,label:`Flowable`},{engine:Kl.ACTIVITI,label:`Activiti`},{engine:Kl.CLASSIC_BPMN,label:`Classic BPMN`}];function EngineQuestion({apiClient:e,onChosen:t}){let[r,i]=n(!1),a=s(!0);f(()=>(a.current=!0,()=>{a.current=!1}),[]);let choose=async n=>{i(!0);try{let r={engine:n,scriptType:ql.NONE,elementTemplates:[]};await e?.bpmn?.saveProjectConfig(r),t(n)}catch(e){Z.error(p(`app.engineQuestion.theEngineCouldNotBe`,{error:e instanceof Error?e.message:String(e)}))}finally{a.current&&i(!1)}};return u(`div`,{class:`engine-question`,children:u(`div`,{class:`engine-question__card`,children:[u($,{title:p(`app.engineQuestion.whichEngineRunsThisDiagram`),hint:p(`app.engineQuestion.itDecidesThePaletteAnd`)}),u(`div`,{class:`engine-question__choices`,children:Jl.map(e=>u(`button`,{type:`button`,class:`ui-button`,disabled:r,onClick:()=>choose(e.engine),children:e.label},e.engine))})]})})}async function bpmnViewer(e){let{default:t}=await m(async()=>{let{default:e}=await import(`./Viewer-CZiVl0t6.js`).then(e=>e.n);return{default:e}},__vite__mapDeps([23,1,6,7,9,20]),import.meta.url);return new t({container:e})}function offScreen(){let e=document.createElement(`div`);return e.style.cssText=`position:fixed;left:-10000px;top:0;width:1200px;height:800px`,document.body.appendChild(e),e}async function drawingResult(e,t=bpmnViewer){let n=offScreen(),r=null;try{return r=await t(n),await r.importXML(e),checkDiagram(r)}finally{r?.destroy(),n.remove()}}var defaultDrawing=async e=>drawingResult(e);function of(e,t,n,r,i,a,o){return{family:e,rule:t,severity:n??`warning`,title:r,message:i,elements:a,...o?{where:o}:{}}}function severityOf$1(e,t){return P(e,t)?.severity===`error`?`error`:`warning`}e(severityOf$1,`severityOf`);function unreadable(e,t,n){let r=e.trim()===``;return of(`file`,`file-unreadable`,`error`,p(r?`app.findings.theFileIsEmpty`:`app.findings.theFileCannotBeRead`),r?p(`app.findings.nothingInIt`):p(`app.findings.notValid`,{what:t,reason:n?p(`app.findings.because`,{reason:n}):p(`app.findings.soItCannotBeOpened`)}),[])}async function bpmn(e,t,n){let r=await jt(e);if(!r)return[unreadable(e,`BPMN XML`,null)];let i=await n(e),a=i.defects.map(e=>of(`drawing`,e.kind,severityOf$1(`drawing`,e.kind),ge(`drawing`,e.kind),e.detail,e.elements,e.where)),o=t(r);if(!o)return a;let s=(await Tn(r,o)).map(e=>{let t=Dn(e.rule);return of(t,t===`bpmnlint`?`bpmnlint/${e.rule}`:e.rule,e.severity,ge(t,e.rule),e.message,e.elements)});return a.push(...Fn(s,i.defects)),a}async function dmn(e){let{rootElement:t}=await Ct(e);return vt(t).map(e=>of(`table`,e.kind,severityOf$1(`table`,e.kind),e.title,e.detail,[]))}function form(e){return fa(JSON.parse(e)).map(e=>of(`form`,e.kind,severityOf$1(`form`,e.kind),e.title,e.detail,e.ids))}async function findingsOf$1(e,t,n,r=defaultDrawing){let i=Ye(e);if(!i)return[];let a=ie(e);try{return i===`bpmn`?await bpmn(t,n??(()=>null),r):i===`dmn`?await dmn(t):form(t)}catch(e){return[unreadable(t,a,I(x(e)))]}}e(findingsOf$1,`findingsOf`);var Yl=`patch.bpmn`;function fingerprint(e){return`${e.rule}|${[...e.elements].sort().join(`,`)}|${e.message}`}function fresh(e,t){let n=new Map;for(let t of e)n.set(fingerprint(t),(n.get(fingerprint(t))??0)+1);let r=[];for(let e of t){let t=fingerprint(e),i=n.get(t)??0;i>0?n.set(t,i-1):r.push(e)}return{added:r,resolved:[...n.values()].reduce((e,t)=>e+t,0)}}function referencesOf(e){switch(e.op){case`add`:return[e.after];case`connect`:return[e.from,e.to];default:return[e.id]}}function statusOf$1(e){return e.some(e=>e.severity===`error`)?`error`:e.length>0?`warning`:`ok`}e(statusOf$1,`statusOf`);function applicable(e,t){let n=t.filter(e=>!e.error).map(e=>e.index);return{patch:{...e,operations:n.map(t=>e.operations[t])},indexes:n}}async function checkPatch(e,t,n){let r=await Li(e,t,n),i=r,a=t.operations.map((e,t)=>t);if(!r.ok&&r.steps.length>0){let o=applicable(t,r.steps);a=o.indexes,i=o.indexes.length>0?await Li(e,o.patch,n):{ok:!0,xml:e,steps:[]}}let o=r.steps.map(e=>({index:e.index,status:e.error?`error`:`ok`,...e.error?{error:e.error}:{},...e.skipped?{skipped:!0}:{},findings:[]}));if(!i.ok||!i.xml||a.length===0)return{ok:r.ok,steps:o,effects:r.steps,patchFindings:[],resolved:0,xml:r.xml};let[s,c]=await Promise.all([findingsOf$1(Yl,e,n.setup,n.drawing),findingsOf$1(Yl,i.xml,n.setup,n.drawing)]),{added:l,resolved:u}=fresh(s,c),d=i.steps.map((e,n)=>{let r=a[n],i=t.operations[r];return{original:r,touched:new Set(e.touched),referenced:new Set(referencesOf(i))}}),f=[];for(let e of l){let t=d.filter(t=>e.elements.some(e=>t.touched.has(e))),n=t.length>0?t:d.filter(t=>e.elements.some(e=>t.referenced.has(e)));if(n.length===0)f.push(e);else for(let t of n)o[t.original].findings.push(e)}for(let e of o)e.error||(e.status=statusOf$1(e.findings));return{ok:r.ok,steps:o,effects:r.steps,patchFindings:f,resolved:u,xml:r.xml}}function isDraft(e){return Object.hasOwn(e,`patch`)}var InMemoryProposalSource=class{listeners=new Set;counter=0;clock;name;constructor(e={}){this.clock=e.clock??Date.now,this.name=e.name??`memory`}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}propose(e){let t=isDraft(e)?e:{patch:e};this.counter+=1;let n={id:`proposal-${this.counter}`,patch:{...t.patch,operations:[...t.patch.operations]},source:t.source??this.name,createdAt:this.clock(),...t.title??t.patch.title?{title:t.title??t.patch.title}:{}};for(let e of[...this.listeners])e(n);return n}},Xl=new InMemoryProposalSource({name:`editor`});function Glyph({path:e}){return u(`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`,children:u(`path`,{d:e})})}var Zl=`M3.5 8.5l3 3 6-7`,Ql=`M4 4l8 8M12 4l-8 8`,$l=`M10 3.5L5.5 8l4.5 4.5`,eu=`M6 3.5L10.5 8 6 12.5`;function useReviewState(e){let[t,r]=n(e.getState());return f(()=>(r(e.getState()),e.subscribe(r)),[e]),t}function statusOf(e){return jn(e)?`error`:e.check.status}function statusWord(e){return jn(e)?p(`app.ghost.status.blocked`):e.check.status===`error`?p(`app.ghost.status.error`):e.check.status===`warning`?p(`app.ghost.status.warning`):p(`app.ghost.status.ok`)}function StatusGlyph({status:e}){return e===`ok`?u(`span`,{class:`ghost-bar__status-glyph ghost-bar__status-glyph--ok`,"aria-hidden":`true`,children:u(Glyph,{path:Zl})}):u(Gr,{severity:e})}function typingTarget(e){let t=e;return!t||!t.tagName?!1:t.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(t.tagName)}function GhostReviewBar({review:e,hidden:t=!1}){let r=useReviewState(e),[i,a]=n(!1),[c,l]=n(!1),[d,m]=n(``),h=s(null),g=r.phase===`review`&&!t;if(f(()=>{if(!g)return;let listen=t=>{if(t.defaultPrevented||t.altKey||t.ctrlKey||t.metaKey||typingTarget(t.target))return;let n=!!h.current?.contains(t.target),r=t.key;r===`j`||r===`J`||n&&(r===`ArrowDown`||r===`ArrowRight`)?(t.preventDefault(),e.next()):(r===`k`||r===`K`||n&&(r===`ArrowUp`||r===`ArrowLeft`))&&(t.preventDefault(),e.previous())};return document.addEventListener(`keydown`,listen),()=>document.removeEventListener(`keydown`,listen)},[g,e]),f(()=>m(``),[r.focus,r.proposalId]),r.phase===`idle`||t)return null;let _=Pt(r),v=r.items[r.focus],y=u(`div`,{class:`ghost-bar__announce`,role:`status`,children:r.announcement});if(r.phase===`checking`)return u(`aside`,{class:`ghost-bar`,ref:h,"aria-label":p(`app.ghost.region`),children:[u(`p`,{class:`ghost-bar__line type-body`,children:p(`app.ghost.checking`)}),y]});if(r.phase===`done`){let t=e.checkpoints.latest();return u(`aside`,{class:`ghost-bar`,ref:h,"aria-label":p(`app.ghost.region`),children:[u(`header`,{class:`ghost-bar__head`,children:[u(`h2`,{class:`ghost-bar__title type-dialog-title`,children:r.title??p(`app.ghost.title`)}),u(`button`,{type:`button`,class:`ui-button ui-button--quiet ghost-bar__icon`,onClick:()=>e.dismiss(),title:p(`app.ghost.close`),"aria-label":p(`app.ghost.close`),children:u(Glyph,{path:Ql})})]}),u(`p`,{class:`ghost-bar__line type-body`,children:p(`app.ghost.reviewed`,_)}),t&&u(`details`,{class:`ghost-bar__limits`,children:[u(`summary`,{class:`type-help`,children:p(`app.ghost.checkpoint.heading`)}),u(`p`,{class:`type-help`,children:p(`app.ghost.checkpoint.kept`)}),u(`ul`,{class:`type-help`,children:t.limits.map(e=>u(`li`,{children:e},e))})]}),y]})}let send=()=>{v&&e.comment(v.index,d)&&m(``)};return u(`aside`,{class:`ghost-bar`,ref:h,"aria-label":p(`app.ghost.region`),"data-testid":`ghost-bar`,children:[u(`header`,{class:`ghost-bar__head`,children:[u(`h2`,{class:`ghost-bar__title type-dialog-title`,children:r.title??p(`app.ghost.title`)}),u(`span`,{class:`ghost-bar__summary type-help`,children:p(`app.ghost.summary`,{pending:_.pending,total:_.total})}),_.attention>0&&u(`span`,{class:`ghost-bar__attention type-badge`,children:p(`app.ghost.attention`,{count:_.attention})}),r.queued>0&&u(`span`,{class:`ghost-bar__summary type-help`,children:p(`app.ghost.queued`,{count:r.queued})}),u(`button`,{type:`button`,class:`ui-button ui-button--quiet ghost-bar__icon`,"aria-expanded":!c,onClick:()=>l(!c),title:p(c?`app.ghost.expand`:`app.ghost.collapse`),"aria-label":p(c?`app.ghost.expand`:`app.ghost.collapse`),children:u(Glyph,{path:c?`M4 6.5l4 4 4-4`:`M4 9.5l4-4 4 4`})})]}),c?y:u(o,{children:[u(`div`,{class:`ghost-bar__actions`,children:[u(`button`,{type:`button`,class:`ui-button ui-button--quiet ghost-bar__icon`,onClick:()=>e.previous(),title:p(`app.ghost.previous`),"aria-label":p(`app.ghost.previous`),children:u(Glyph,{path:$l})}),u(`button`,{type:`button`,class:`ui-button ui-button--quiet ghost-bar__icon`,onClick:()=>e.next(),title:p(`app.ghost.next`),"aria-label":p(`app.ghost.next`),children:u(Glyph,{path:eu})}),u(`span`,{class:`ghost-bar__spacer`}),u(`button`,{type:`button`,class:`ui-button`,"data-safe":r.whole?`true`:void 0,onClick:()=>e.rejectAll(),children:r.whole?p(`app.ghost.rejectChange`):p(`app.ghost.rejectAll`)}),u(`button`,{type:`button`,class:`ui-button ui-button--primary`,onClick:()=>void e.acceptAll(),children:r.whole?p(`app.ghost.acceptChange`):p(`app.ghost.acceptAll`)})]}),r.whole&&u(`p`,{class:`ghost-bar__line type-help`,children:p(`app.ghost.wholeHint`)}),v&&u(`section`,{class:`ghost-bar__current`,"aria-label":v.label,children:[u(`div`,{class:`ghost-bar__row`,children:[u(`span`,{class:`ghost-bar__chip ghost-bar__chip--${v.kind} type-badge`,children:v.chip}),u(`span`,{class:`ghost-bar__label type-body`,children:v.label}),u(`span`,{class:`ghost-bar__status-word ghost-bar__status-word--${statusOf(v)} type-help`,children:[u(StatusGlyph,{status:statusOf(v)}),statusWord(v)]})]}),(v.check.error||v.check.messages.length>0)&&u(`ul`,{class:`ghost-bar__messages type-help`,children:(v.check.error?[v.check.error]:v.check.messages).map(e=>u(`li`,{children:e},e))}),!r.whole&&u(`div`,{class:`ghost-bar__actions`,children:[u(`button`,{type:`button`,class:`ui-button`,onClick:()=>e.reject(v.index),children:[u(Glyph,{path:Ql}),p(`app.ghost.reject`)]}),u(`button`,{type:`button`,class:`ui-button ui-button--primary`,disabled:jn(v),onClick:()=>void e.accept(v.index),children:[u(Glyph,{path:Zl}),p(`app.ghost.accept`)]})]}),u(`div`,{class:`ghost-bar__comment`,children:[u(`input`,{class:`ui-input type-input`,type:`text`,value:d,"aria-label":p(`app.ghost.comment`),onInput:e=>m(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),send())}}),u(`button`,{type:`button`,class:`ui-button`,disabled:!d.trim(),onClick:send,children:p(`app.ghost.sendComment`)})]})]}),u(`button`,{type:`button`,class:`ui-button ui-button--quiet ghost-bar__toggle`,"aria-expanded":i,onClick:()=>a(!i),children:p(i?`app.ghost.hideAll`:`app.ghost.showAll`)}),i&&u(`ul`,{class:`ghost-bar__list`,children:r.items.map(t=>u(`li`,{children:u(`button`,{type:`button`,class:`ghost-bar__item type-body`,"aria-current":t.index===r.focus?`true`:void 0,"data-decision":t.decision,onClick:()=>e.focus(t.index),children:[u(`span`,{class:`ghost-bar__chip ghost-bar__chip--${t.kind} type-badge`,children:t.chip}),u(`span`,{class:`ghost-bar__label`,children:t.label}),t.decision===`pending`?u(StatusGlyph,{status:statusOf(t)}):u(`span`,{class:`type-help`,children:t.decision===`accepted`?p(`app.ghost.decided.accepted`):p(`app.ghost.decided.rejected`)})]})},t.index))}),r.patchFindings.length>0&&u(`div`,{class:`ghost-bar__loose`,children:[u(`h3`,{class:`type-section-heading`,children:p(`app.ghost.patchFindings`)}),u(`ul`,{class:`type-help`,children:r.patchFindings.map(e=>u(`li`,{children:e},e))})]}),y]})]})}var tu=20;function limitsOfUndo(){return[p(`app.ghost.checkpoint.limit.comments`),p(`app.ghost.checkpoint.limit.otherFiles`),p(`app.ghost.checkpoint.limit.deployed`),p(`app.ghost.checkpoint.limit.memory`)]}var CheckpointLog=class{entries=[];counter=0;clock;constructor(e=Date.now){this.clock=e}record(e,t){this.counter+=1;let n={id:this.counter,takenAt:this.clock(),xml:e,labels:t.labels,limits:limitsOfUndo(),...t.title?{title:t.title}:{}};return this.entries.push(n),this.entries.length>tu&&this.entries.shift(),n}list(){return[...this.entries]}latest(){return this.entries[this.entries.length-1]}clear(){this.entries.length=0}};function checkResultOf(e){let t=[...e.steps.flatMap(e=>e.findings),...e.patchFindings];return{errors:t.filter(e=>e.severity===`error`).length,warnings:t.filter(e=>e.severity!==`error`).length,resolved:e.resolved}}function alignEffects(e,t){let n=new Map(t.nodes.map(e=>[e.id,e])),between=(e,n)=>t.flows.find(t=>t.source===e&&t.target===n);return e.map(e=>{let t=e.operation;if(e.error)return e;if(t.op===`add`){let r=e.added[0]&&n.get(e.added[0].id),i=e.addedFlows[0]&&between(t.after,e.added[0].id);return{...e,added:e.added.map(e=>r?.bounds&&e.id===r.id?{...e,bounds:r.bounds}:e),addedFlows:e.addedFlows.map(e=>i?.waypoints?{...e,waypoints:i.waypoints}:e)}}if(t.op===`connect`){let n=between(t.from,t.to);return n?.waypoints?{...e,addedFlows:e.addedFlows.map(e=>({...e,waypoints:n.waypoints}))}:e}return t.op===`move`?{...e,moved:e.moved.map(e=>({...e,to:n.get(e.id)?.bounds??e.to}))}:e})}function alignCheck(e,t){return t?{...e,effects:alignEffects(e.effects,t)}:e}var GhostReview=class{state=zt;listeners=new Set;queue=[];chain=Promise.resolve();options;checkpoints;detach=null;disposed=!1;applying=!1;covered=!1;whole=null;groups=[];onStack=()=>this.followUndo();constructor(e){this.options=e,this.checkpoints=e.checkpoints??new CheckpointLog,this.layer?.onPick(e=>this.focus(e)),e.modeler.get(`eventBus`,!1)?.on(`commandStack.changed`,this.onStack)}topAction(){let e=this.options.modeler.get(`commandStack`,!1);return e?._stack?.[e._stackIdx]?.id}liveActions(){let e=this.options.modeler.get(`commandStack`,!1),t=e?._stack??[];return new Set(t.slice(0,(e?._stackIdx??-1)+1).map(e=>e.id))}followUndo(){if(this.applying||this.disposed||this.groups.length===0||this.state.phase===`idle`)return;let e=this.liveActions(),t=[],n=[];for(let r of this.groups){let i=r.id!==void 0&&e.has(r.id);i!==r.live&&(r.live=i,(i?n:t).push(...r.indexes))}if(t.length===0&&n.length===0)return;let r=this.state.items.map(e=>t.includes(e.index)&&e.decision===`accepted`?{...e,decision:`pending`}:n.includes(e.index)&&e.decision===`pending`?{...e,decision:`accepted`}:e),i=r.find(e=>t.includes(e.index)),a=i?p(`app.ghost.undone`,{label:i.label}):this.state.announcement,o=r.some(e=>e.decision===`pending`);this.set({...this.state,items:r,phase:o?`review`:this.state.phase,focus:i?i.index:this.state.focus,announcement:a}),this.refresh()}get layer(){return this.options.modeler.get(`ghostLayer`,!1)}get applier(){return this.options.modeler.get(`patchApplier`)}getState=()=>this.state;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});connect(e){this.detach?.(),this.detach=e.subscribe(e=>this.propose(e))}dispose(){this.disposed=!0,this.options.modeler.get(`eventBus`,!1)?.off(`commandStack.changed`,this.onStack),this.detach?.(),this.layer?.clear(),this.listeners.clear()}set(e){this.state={...e,queued:this.queue.length},this.layer?.show(this.state.phase===`review`?this.state.items:[],this.state.focus);for(let e of[...this.listeners])e(this.state)}announce(e){this.set({...this.state,announcement:e})}enqueue(e){let t=this.chain.then(e,e);return this.chain=t.catch(()=>void 0),t}describe=e=>{let t=this.options.modeler.get(`elementRegistry`,!1)?.get(e);return t?.businessObject?{type:t.businessObject.$type,name:t.businessObject.name}:void 0};propose(e){return this.disposed?Promise.resolve():this.state.phase===`review`||this.state.phase===`checking`?(this.queue.push(e),this.set(this.state),Promise.resolve()):this.start(e)}start(e){return this.enqueue(async()=>{let t=e;this.groups=[],this.whole=t.whole??null,this.set({...zt,phase:`checking`,proposalId:e.id,title:e.title,source:e.source,whole:!!t.whole,announcement:p(`app.ghost.checking`)});let n;try{let r=(await this.options.modeler.saveXML({format:!1})).xml??``;n=alignCheck(await this.options.check(r,e.patch),t.after)}catch(t){if(console.error(`The proposed change could not be checked:`,t),!this.disposed&&this.state.proposalId===e.id){this.whole=null,this.set({...zt});let e=this.queue.shift();e&&this.start(e)}return}if(this.disposed||this.state.proposalId!==e.id)return;t.checked?.(checkResultOf(n));let r=Wt(e.id,e.patch,n,this.describe,{title:e.title,source:e.source});this.set({...r,whole:!!t.whole,patchFindings:[...r.patchFindings,...t.notes??[]],announcement:p(`app.ghost.proposed`,{count:r.items.length})});let i=r.items[r.focus];this.covered?this.layer?.revealAll():i&&this.layer?.reveal(i.index),r.phase===`done`&&this.finish()})}finish(){this.set({...this.state,phase:`done`})}dismiss(){if(this.state.phase!==`done`)return;this.groups=[],this.whole=null,this.set({...zt});let e=this.queue.shift();e&&this.start(e)}withdraw(e){let t=this.queue.findIndex(t=>t.id===e);if(t>=0){this.queue.splice(t,1),this.set(this.state);return}if(this.state.proposalId!==e||this.state.phase===`idle`)return;this.groups=[],this.whole=null,this.set({...zt});let n=this.queue.shift();n&&this.start(n)}decideWhole(e){let t=this.whole;if(!t||this.state.phase!==`review`)return!1;this.whole=null;let n=this.state.items.map(t=>({...t,decision:e?`accepted`:`rejected`}));this.set({...this.state,items:n,phase:`done`,announcement:p(e?`app.ghost.wholeAccepted`:`app.ghost.wholeRejected`)});try{e?t.accept():t.reject()}catch(e){console.error(`The decision could not be passed on:`,e)}return this.dismiss(),!0}fit(){this.state.phase===`review`&&this.layer?.revealAll()}setCover(e){let t=e!==null&&!this.covered;this.covered=e!==null,this.layer?.setCover(e??rn),t&&this.state.phase===`review`&&this.layer?.revealAll()}focus(e){if(this.state.phase!==`review`)return;let t=Jt(this.state,e);this.set({...t,announcement:this.positionOf(t)}),this.layer?.reveal(e)}next(){this.move(1)}previous(){this.move(-1)}move(e){if(this.state.phase!==`review`)return;let t=qt(this.state,e);this.set({...t,announcement:this.positionOf(t)}),this.layer?.reveal(t.focus)}positionOf(e){let t=e.items[e.focus];if(!t)return``;let n=Yt(e);return p(`app.ghost.position`,{position:n.findIndex(e=>e.index===t.index)+1,count:n.length,label:t.label})}reject(e){if(this.state.phase!==`review`)return;if(this.whole){this.decideWhole(!1);return}let t=this.state.items[e];if(!t||t.decision!==`pending`)return;let n=Vt(this.state,e),r=An(this.state,n,`rejected`);this.set({...r,announcement:this.afterDecision(`rejected`,t,r,n.length)}),this.settle()}rejectAll(){if(this.state.phase!==`review`)return;if(this.whole){this.decideWhole(!1);return}let e=Yt(this.state),t=An(this.state,e.map(e=>e.index),`rejected`);this.set({...t,announcement:p(`app.ghost.allRejected`,{count:e.length})}),this.settle()}accept(e){return this.enqueue(async()=>{if(this.state.phase!==`review`)return!1;if(this.whole)return this.decideWhole(!0);let t=this.state.items[e];if(!t||t.decision!==`pending`)return!1;let n=Lt(this.state,e);if(n.length>0){let e=n[0];return this.announce(p(`app.ghost.cannotAccept`,{label:e.label,reason:e.check.error??p(`app.ghost.alreadyRejected`)})),!1}return this.apply(Qt(this.state,e),(e,n)=>this.afterDecision(`accepted`,t,e,n.length))})}acceptAll(){return this.enqueue(async()=>{if(this.state.phase!==`review`)return!1;if(this.whole)return this.decideWhole(!0);let e=Xt(this.state).filter(e=>Lt(this.state,e.index).length===0).map(e=>e.index);return e.length===0?(this.announce(p(`app.ghost.nothingToAccept`)),!1):this.apply(e,(e,t)=>p(`app.ghost.allAccepted`,{count:t.length,left:Pt(e).pending}))})}afterDecision(e,t,n,r){let i=Pt(n).pending,a={label:t.label,extra:Math.max(0,r-1),left:i},o=p(e===`accepted`?`app.ghost.accepted`:`app.ghost.rejected`,a);return i===0?`${o} ${p(`app.ghost.reviewed`,Pt(n))}`:o}async apply(e,t){let n=this.state,r=(await this.options.modeler.saveXML({format:!1})).xml??``,i=e.map(e=>n.items[e].operation),a=await Li(r,{operations:i},{engine:this.options.engine,conventions:this.options.conventions});if(!a.ok){let t=a.steps.find(e=>e.error),r=t?n.items[e[t.index]]:void 0,i=n.items.map(t=>{let n=e.indexOf(t.index),r=n>=0?a.steps[n]?.error:void 0;return r?{...t,check:{...t.check,status:`error`,error:r}}:t});return this.set({...n,items:i,announcement:p(`app.ghost.noLongerApplies`,{label:r?.label??``,reason:t?.error??``})}),!1}this.checkpoints.record(r,{title:n.title,labels:e.map(e=>n.items[e].label)}),this.applying=!0;try{this.applier.apply(a.steps,this.options.engine)}finally{this.applying=!1}this.groups.push({id:this.topAction(),indexes:e,live:!0});let o=An(n,e,`accepted`);return this.set({...o,announcement:t(o,e)}),await this.refresh(),this.settle(),!0}async refresh(){let e=Yt(this.state);if(e.length===0)return;let t=(await this.options.modeler.saveXML({format:!1})).xml??``,n=await Li(t,{operations:e.map(e=>e.operation)},{engine:this.options.engine,conventions:this.options.conventions});if(this.disposed)return;let r=new Map(e.map((e,t)=>[e.index,n.steps[t]])),i=this.state.items.map(e=>{let t=r.get(e.index);return t&&!t.error?{...e,effect:{...t,index:e.index}}:e});this.set({...this.state,items:i})}settle(){this.state.phase===`review`&&Yt(this.state).length===0&&this.finish()}comment(e,t){let n=this.state.items[e],r=t.trim();if(!n||!r)return!1;let i=n.elementIds[0];return i?(this.options.onComment?.(i,r),this.set({...this.state,comments:[...this.state.comments,{index:e,elementId:i,text:r}],announcement:p(`app.ghost.commentSent`,{label:n.label})}),!0):!1}};async function lintSetup(){try{return await loadLintSetup()}catch(e){return console.error(`The lint rules could not be loaded for the proposed change:`,e),null}}async function loadLintSetup(){let e=Y(),t=await e.getConfig().catch(()=>null),n=t?.bpmnLint,r;r=n?.clientBundlePath?await Cn(await e.readFile(n.clientBundlePath)):bn(n?.configPath?await e.readFileIfPresent(n.configPath):null);let i=t?.engine??null;return e=>Vn(r,i,e)}function appConfig$1(){return window.appConfig??{}}e(appConfig$1,`appConfig`);function GhostEdits({modeler:e,onComment:t,source:r}){let i=l(()=>{let n=Dt(appConfig$1().engine)??`classic`,check=async(e,t)=>checkPatch(e,t,{engine:n,conventions:appConfig$1().conventions,setup:await lintSetup()});return new GhostReview({modeler:e,engine:n,conventions:appConfig$1().conventions,check,onComment:t})},[e]);f(()=>{i.connect(r??Xl);let e=r?.onWithdraw(e=>i.withdraw(e));return()=>{e?.(),i.dispose()}},[i,r]),f(()=>r?.onFit?.(()=>i.fit()),[i,r]);let[a,o]=n(!1);return f(()=>{if(!r?.cover||!r.onCover){o(!1);return}let sync=()=>{let e=r.cover?.()??null;i.setCover(e),o(e!==null)};return sync(),r.onCover(sync)},[i,r]),u(GhostReviewBar,{review:i,hidden:a})}var nu={gamma:4,groups:[`names`],levels:[`prior`,`project`,`neighbours`,`diagram`],calibration:[{upTo:.20502661667383773,correct:0,items:1},{upTo:.20503593959809777,correct:0,items:2},{upTo:.2051396623696803,correct:0,items:2},{upTo:.20685343859276628,correct:0,items:1},{upTo:.20764293812329382,correct:0,items:1},{upTo:.23137758393153432,correct:0,items:1},{upTo:.23526325069863852,correct:0,items:2},{upTo:.2361123923193512,correct:0,items:1},{upTo:.2393894788897236,correct:0,items:1},{upTo:.24055023077290497,correct:0,items:2},{upTo:.24215284160598688,correct:0,items:1},{upTo:.24290698022247126,correct:0,items:1},{upTo:.24293189890513545,correct:0,items:1},{upTo:.2432316346671474,correct:0,items:1},{upTo:.2462620533829887,correct:0,items:1},{upTo:.26034295976888244,correct:1,items:9},{upTo:.310298727460059,correct:48,items:163},{upTo:.35600916811348643,correct:70,items:224},{upTo:.3722818153298981,correct:28,items:76},{upTo:.39098825316866137,correct:117,items:296},{upTo:.6362539934065248,correct:433,items:999},{upTo:.6473699585251257,correct:16,items:32},{upTo:.6703068366818717,correct:53,items:78},{upTo:.6817805460582353,correct:22,items:32},{upTo:.7101738761030508,correct:52,items:72},{upTo:.8081468235776214,correct:147,items:201},{upTo:.8775787807683855,correct:90,items:118},{upTo:.8812946040140366,correct:4,items:5},{upTo:.903654407119196,correct:27,items:33},{upTo:.9576711258349487,correct:133,items:139},{upTo:.994982571647006,correct:98,items:100},{upTo:.9950301228039035,correct:3,items:3},{upTo:.9950453350125541,correct:1,items:1},{upTo:.9950457310291629,correct:1,items:1},{upTo:.995072821538367,correct:19,items:19},{upTo:.9953489604857675,correct:1,items:1},{upTo:.9953494542644095,correct:1,items:1},{upTo:.9956271672056477,correct:6,items:6},{upTo:.9956706465585562,correct:1,items:1},{upTo:.9956729666015965,correct:2,items:2},{upTo:.9961237674173211,correct:19,items:19},{upTo:.99818291713241,correct:1,items:1},{upTo:.9981832060885054,correct:2,items:2},{upTo:.998183384010037,correct:1,items:1},{upTo:.9982333916565098,correct:1,items:1},{upTo:.9982336725860469,correct:2,items:2},{upTo:.9982338455653138,correct:1,items:1},{upTo:.9996260994174716,correct:5,items:5},{upTo:.9998526618952058,correct:3,items:3},{upTo:.9999127822367043,correct:2,items:2},{upTo:.9999372835797259,correct:1,items:1},{upTo:.9999412312976551,correct:1,items:1}]},ru={unigram:{exclusiveGateway:375,serviceTask:485,endEvent:662,businessRuleTask:60,callActivity:91,userTask:481,subProcess:31,receiveTask:26,scriptTask:47,"intermediateCatchEvent:timer":35,sendTask:51,parallelGateway:85,"endEvent:terminate":3,eventBasedGateway:15,"intermediateCatchEvent:message":38,intermediateThrowEvent:22,task:56,"intermediateThrowEvent:message":11,"endEvent:signal":6,"intermediateCatchEvent:signal":5,inclusiveGateway:29,"endEvent:message":14,"intermediateCatchEvent:conditional":14,manualTask:16,"endEvent:cancel":1,transaction:1,"intermediateThrowEvent:signal":5,"endEvent:compensation":2,"intermediateThrowEvent:escalation":2,"intermediateThrowEvent:compensation":1},afterType:{startEvent:{exclusiveGateway:28,userTask:163,endEvent:27,serviceTask:162,receiveTask:4,businessRuleTask:25,parallelGateway:21,task:16,scriptTask:17,intermediateThrowEvent:5,"intermediateCatchEvent:signal":4,subProcess:14,inclusiveGateway:3,"endEvent:message":1,"intermediateCatchEvent:message":1,sendTask:11,manualTask:2,callActivity:12,"intermediateCatchEvent:timer":1,"intermediateCatchEvent:conditional":2,eventBasedGateway:1,"intermediateThrowEvent:signal":2,"intermediateThrowEvent:message":1},exclusiveGateway:{serviceTask:144,endEvent:91,callActivity:45,scriptTask:13,userTask:102,sendTask:10,exclusiveGateway:49,parallelGateway:8,intermediateThrowEvent:14,task:11,"intermediateThrowEvent:message":4,"endEvent:signal":4,"intermediateCatchEvent:timer":3,eventBasedGateway:1,"endEvent:compensation":1,"intermediateThrowEvent:escalation":1,inclusiveGateway:1,manualTask:2,businessRuleTask:5,"intermediateCatchEvent:message":1,"endEvent:message":5},boundaryEvent:{endEvent:30,userTask:28,sendTask:2,serviceTask:11,"endEvent:cancel":1,task:3,callActivity:1,exclusiveGateway:2,"endEvent:compensation":1,intermediateThrowEvent:1,scriptTask:1,subProcess:2,"intermediateThrowEvent:escalation":1},serviceTask:{serviceTask:72,businessRuleTask:10,endEvent:170,receiveTask:5,userTask:34,callActivity:7,exclusiveGateway:93,parallelGateway:14,"intermediateCatchEvent:timer":12,sendTask:12,subProcess:2,"intermediateCatchEvent:message":4,scriptTask:1,inclusiveGateway:13,eventBasedGateway:1,"endEvent:message":1,"intermediateCatchEvent:conditional":1,"intermediateThrowEvent:message":2},businessRuleTask:{callActivity:4,subProcess:2,serviceTask:6,exclusiveGateway:20,businessRuleTask:5,endEvent:3,scriptTask:1,userTask:16,parallelGateway:3},callActivity:{exclusiveGateway:38,userTask:8,endEvent:20,serviceTask:5,callActivity:6,parallelGateway:10},userTask:{exclusiveGateway:107,endEvent:169,serviceTask:39,"intermediateCatchEvent:timer":4,parallelGateway:20,"endEvent:terminate":2,sendTask:9,userTask:41,businessRuleTask:10,transaction:1,"intermediateCatchEvent:message":4,"intermediateThrowEvent:signal":3,receiveTask:3,callActivity:5,scriptTask:2,inclusiveGateway:7,intermediateThrowEvent:2,"intermediateCatchEvent:conditional":1,manualTask:12,"endEvent:message":4},subProcess:{exclusiveGateway:6,scriptTask:1,serviceTask:3,endEvent:15,parallelGateway:2,inclusiveGateway:2,subProcess:1},receiveTask:{userTask:9,exclusiveGateway:2,callActivity:1,parallelGateway:2,endEvent:9,serviceTask:1},scriptTask:{endEvent:24,userTask:5,"intermediateCatchEvent:timer":4,exclusiveGateway:6,sendTask:4,scriptTask:1,inclusiveGateway:3},intermediateCatchEvent:{exclusiveGateway:9,serviceTask:14,userTask:16,task:6,endEvent:27,scriptTask:7,"intermediateThrowEvent:message":4,"endEvent:message":1,eventBasedGateway:1,"intermediateThrowEvent:compensation":1,"intermediateCatchEvent:signal":1,parallelGateway:2},sendTask:{receiveTask:7,endEvent:20,eventBasedGateway:6,scriptTask:2,sendTask:1,"intermediateCatchEvent:message":8,userTask:2,parallelGateway:2},parallelGateway:{serviceTask:17,userTask:36,exclusiveGateway:3,businessRuleTask:5,endEvent:9,sendTask:2,"intermediateCatchEvent:message":3,task:1,subProcess:3,receiveTask:1,callActivity:10},eventBasedGateway:{"intermediateCatchEvent:message":11,"intermediateCatchEvent:timer":8,"intermediateCatchEvent:conditional":9},intermediateThrowEvent:{userTask:11,receiveTask:4,endEvent:13,exclusiveGateway:3,serviceTask:3,"intermediateCatchEvent:conditional":1,"intermediateCatchEvent:message":3,eventBasedGateway:2,"endEvent:signal":2,parallelGateway:1,"endEvent:message":1},task:{task:18,endEvent:16,exclusiveGateway:8,"intermediateCatchEvent:message":3,eventBasedGateway:3,"endEvent:terminate":1,"endEvent:message":1},inclusiveGateway:{serviceTask:8,endEvent:3,"intermediateCatchEvent:timer":3,scriptTask:1,receiveTask:2,subProcess:7,task:1,userTask:9,exclusiveGateway:1},manualTask:{endEvent:16},transaction:{userTask:1}}},iu=class PriorError extends Error{problems;constructor(e){super(`not-a-prior`),this.name=PriorError.name,this.problems=e}};function objectOf$1(e,t,n){return typeof e!=`object`||!e||Array.isArray(e)?(n.push({code:`not-an-object`,path:t,value:e}),{}):e}e(objectOf$1,`objectOf`);function countsOf$1(e,t,n){let r={};for(let[i,a]of Object.entries(objectOf$1(e,t,n)))typeof a==`number`&&Number.isInteger(a)&&a>=0?r[i]=a:n.push({code:`not-a-count`,path:`${t}.${i}`,value:a});return r}e(countsOf$1,`countsOf`);function loadPrior(e){let t=[],n=objectOf$1(e,`prior`,t),r=countsOf$1(n.unigram,`unigram`,t),i={};for(let[e,r]of Object.entries(objectOf$1(n.afterType,`afterType`,t)))i[e]=countsOf$1(r,`afterType.${e}`,t);if(t.length>0)throw new iu(t);return{unigram:r,afterType:i}}function sumOf(e){return Object.values(e).reduce((e,t)=>e+t,0)}function evidenceOf(e){let totalOf=(t,n)=>t===0?sumOf(e.unigram):t===1?sumOf(e.afterType[n.type]??{}):0,countOf=(t,n,r)=>t===0?e.unigram[r]??0:t===1?e.afterType[n.type]?.[r]??0:0;return{total:totalOf,count:countOf}}var accuracyOf=e=>e.correct/e.items;function curveOf(e){return t=>e.length===0?0:accuracyOf(e.find(e=>t<=e.upTo)??e[e.length-1])}var au=[`timer`,`message`,`error`,`signal`,`conditional`,`escalation`,`link`,`compensation`,`terminate`,`cancel`],ou=[`task`,`serviceTask`,`userTask`,`scriptTask`,`businessRuleTask`,`sendTask`,`receiveTask`,`manualTask`,`callActivity`,`subProcess`,`adHocSubProcess`,`transaction`],su=[`exclusiveGateway`,`parallelGateway`,`inclusiveGateway`,`eventBasedGateway`,`complexGateway`],cu=[`startEvent`,`endEvent`,`intermediateCatchEvent`,`intermediateThrowEvent`];function symbolOfKind(e,t){return t===null?e:`${e}:${t}`}var lu=new Set(su);function isGatewayType(e){return lu.has(e)}var uu=[...ou,...su,...cu.flatMap(e=>[e,...au.map(t=>symbolOfKind(e,t))])],du=[`definition`,`ids`,`names`,`mappings`,`script`,`position`,`layout`,`style`];new Set(du);var fu=[{below:0,token:`back`},{below:40,token:`tight`},{below:120,token:`normal`},{below:1/0,token:`wide`}],pu={flows:new Set,nodes:new Set};function headOf(e){return e===null?null:unitsOf(e,Fo).filter(e=>e.role===`content`).at(-1)?.key??null}function listBy(e,t,n){let r=new Map;for(let i of e){let e=t(i),a=n(i);e!==void 0&&a!==null&&r.set(e,[...r.get(e)??[],a])}return r}function mappingTokens(e){return listBy(e.mappings,e=>e.elementId,e=>{let t=headOf(e.target);return t===null?null:`${e.direction===`input`?`in`:`out`}:${t}`})}function idTokens(e){let t=e.model;return listBy([...t.workers.map(e=>({id:e.elementId,token:`${e.kind}:${e.value}`})),...t.calls.map(e=>({id:e.elementId,token:`CALL:${e.calledProcessId}`})),...t.decisionUses.map(e=>({id:e.elementId,token:`DECISION:${e.decisionId}`})),...t.formUses.map(e=>({id:e.elementId,token:`FORM:${e.formId}`})),...t.messageUses.map(e=>({id:e.elementId,token:`MESSAGE:${e.messageId}`})),...t.errors.map(e=>({id:e.elementId,token:`ERROR:${e.code??``}`}))],e=>e.id,e=>e.token)}function scriptTokens(e){let t=listBy(e.model.variables,e=>e.elementId,e=>e.name),n=listBy(e.model.variables.filter(e=>e.where===`condition`),e=>e.elementId,e=>e.name),r=new Map;for(let i of e.graph.nodes.values()){let e=[...t.get(i.id)??[],...i.incoming.flatMap(e=>n.get(e)??[])],a=[...new Set(e.map(e=>headOf(e)).filter(e=>e!==null))].sort();a.length>0&&r.set(i.id,a)}return r}function indexOf$1(e){let t=new Map;for(let n of e.graph.nodes.values())n.host!==null&&t.set(n.host,[...t.get(n.host)??[],n]);return{graph:e.graph,flows:new Map(e.graph.flows.map(e=>[e.id,e])),ids:idTokens(e),mappingHeads:mappingTokens(e),scriptHeads:scriptTokens(e),hosted:t}}e(indexOf$1,`indexOf`);function viewOfFlow(e,t){let n=e.flows.get(t);if(n===void 0)return pu;let r=e.graph.nodes.get(n.target),i=[...r?.incoming??[],...r?.outgoing??[]];return{flows:new Set([t,...i]),nodes:new Set([n.target])}}function visibleFlows(e,t,n){return t.map(t=>e.flows.get(t)).filter(t=>t!==void 0&&e.graph.nodes.has(t.source)&&e.graph.nodes.has(t.target)&&!n.flows.has(t.id)&&!n.nodes.has(t.source)&&!n.nodes.has(t.target))}function visibleIncoming(e,t,n){return visibleFlows(e,e.graph.nodes.get(t)?.incoming??[],n)}function visibleOutgoing(e,t,n){return visibleFlows(e,e.graph.nodes.get(t)?.outgoing??[],n)}function degreeOf(e){return e>=2?`2+`:String(e)}function gapTokenOf(e){return(fu.find(t=>e<t.below)??fu[fu.length-1]).token}function directionOf(e){let t=e[0],n=e[e.length-1];return Math.abs(n.x-t.x)>=Math.abs(n.y-t.y)?`horizontal`:`vertical`}function gapOf$1(e,t,n){return n===`horizontal`?t.x-(e.x+e.width):t.y-(e.y+e.height)}e(gapOf$1,`gapOf`);function layoutTokens(e,t,n){let r=visibleIncoming(e,t.id,n)[0],i=r===void 0?void 0:e.graph.waypoints.get(r.id);if(r===void 0||i===void 0||i.length<2)return[];let a=directionOf(i),o=e.graph.bounds.get(r.source),s=e.graph.bounds.get(t.id),c=o&&s?[`gap:${gapTokenOf(gapOf$1(o,s,a))}`]:[];return[`dir:${a}`,...c]}function branchTokens(e,t){if(t===void 0)return[];let n=e.graph.nodes.get(t.source);return n?.type===`boundaryEvent`?[`from:boundary`]:n===void 0||!isGatewayType(n.type)?[]:t.condition===null?[t.isDefault?`branch:default`:`branch:plain`]:[`branch:conditional`]}function positionTokens(e,t,n){let r=visibleIncoming(e,t.id,n),i=visibleOutgoing(e,t.id,n),a=(e.hosted.get(t.id)??[]).filter(e=>!n.nodes.has(e.id)).map(e=>`hosts:${e.definition??`other`}`);return[`in${degreeOf(r.length)}`,`out${degreeOf(i.length)}`,...t.scope===null?[]:[`scope:inside`],...branchTokens(e,r[0]),...new Set(a)]}function recordOf(e,t,n){let r=e.graph.nodes.get(t);if(r===void 0)throw Error(`no node ${t} in the diagram`);let i=headOf(r.name);return{type:r.type,tokens:new Map([[`definition`,r.definition===null?[]:[r.definition]],[`ids`,e.ids.get(t)??[]],[`names`,i===null?[]:[i]],[`mappings`,e.mappingHeads.get(t)??[]],[`script`,e.scriptHeads.get(t)??[]],[`position`,positionTokens(e,r,n)],[`layout`,layoutTokens(e,r,n)],[`style`,r.fill===null?[]:[`fill:${r.fill}`]]])}}function keyOf(e,t){let n=du.filter(e=>t.has(e)).map(t=>`${t}=${(e.tokens.get(t)??[]).join(`,`)}`);return JSON.stringify([e.type,...n])}function pathOf(e,t,n){let r=[t];for(;;){let t=r[r.length-1],i=visibleIncoming(e,t,n);if(i.length===0)return{nodes:r,headless:!0};if(r.length===3)return{nodes:r,headless:!1};let a=i[0].source;if(r.includes(a))return{nodes:r,headless:!1};r.push(a)}}function contextOf(e,t,n,r){let i=e.graph.nodes.get(t);if(i===void 0)throw Error(`no node ${t} in the diagram`);let a=pathOf(e,t,n).nodes.map(t=>keyOf(recordOf(e,t,n),r)),o=Array.from({length:4},(e,t)=>t<=a.length?JSON.stringify(a.slice(0,t)):null);return{type:i.type,keys:o}}function symbolOf(e){return symbolOfKind(e.type,e.definition)}var mu=[`prior`,`project`,`neighbours`,`diagram`],hu=.7,gu=class DecisionError extends Error{problems;constructor(e){super(`not-a-decision`),this.name=DecisionError.name,this.problems=e}};function objectOf(e,t,n){return typeof e!=`object`||!e||Array.isArray(e)?(n.push({code:`not-an-object`,path:t,value:e}),{}):e}function listOf(e,t,n,r,i){return Array.isArray(e)?e.flatMap((e,a)=>typeof e==`string`&&n.includes(e)?[e]:(i.push({code:r,path:`${t}[${a}]`,value:e}),[])):(i.push({code:`not-an-object`,path:t,value:e}),[])}function blocksOf(e,t,n){return Array.isArray(e)?e.flatMap((e,r)=>{let{upTo:i,correct:a,items:o}=objectOf(e,`${t}[${r}]`,n);return typeof i==`number`&&typeof a==`number`&&typeof o==`number`&&o>0&&a>=0&&a<=o?[{upTo:i,correct:a,items:o}]:(n.push({code:`not-a-block`,path:`${t}[${r}]`,value:e}),[])}):(n.push({code:`not-an-object`,path:t,value:e}),[])}function decisionOf(e){let t=[],n=objectOf(e,`decision`,t),r=n.gamma;typeof r==`number`&&r>0||t.push({code:`not-a-number`,path:`decision.gamma`,value:r});let i=listOf(n.groups,`decision.groups`,du,`unknown-group`,t),a=listOf(n.levels,`decision.levels`,mu,`unknown-level`,t),o=blocksOf(n.calibration,`decision.calibration`,t);if(t.length>0)throw new gu(t);return{gamma:r,groups:i,levels:a,calibration:o}}function modelOf(e,t){return{gamma:e.gamma,groups:new Set(e.groups),levels:mu.filter(t=>e.levels.includes(t)),prior:t,calibrate:curveOf(e.calibration)}}function bundledModel(){return modelOf(decisionOf(nu),evidenceOf(loadPrior(ru)))}var _u=[`calls`,`decision`,`form`,`message`,`error`,`job-type`,`folder`],messageNameOf=(e,t)=>e.messages.find(e=>e.id===t)?.name??null,present=e=>e.filter(e=>typeof e==`string`&&e!==``),vu=[{kind:`calls`,defined:e=>present(e.processes.map(e=>e.id)),used:e=>present(e.calls.map(e=>e.calledProcessId))},{kind:`decision`,defined:e=>present(e.decisions.map(e=>e.id)),used:e=>present(e.decisionUses.map(e=>e.decisionId))},{kind:`form`,defined:e=>present([e.formId]),used:e=>present(e.formUses.map(e=>e.formId))},{kind:`message`,defined:e=>present(e.messages.map(e=>e.name)),used:e=>present(e.messageUses.map(t=>messageNameOf(e,t.messageId)))},{kind:`error`,defined:()=>[],used:e=>present(e.errors.map(e=>e.code))},{kind:`job-type`,defined:()=>[],used:e=>present(e.workers.filter(e=>e.kind===`JOB_TYPE`).map(e=>e.value))}];function folderOf$1(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t<0?``:e.slice(0,t)}e(folderOf$1,`folderOf`);var Links=class{pairs=new Map;link(e,t,n){e!==t&&(this.add(e,t,n),this.add(t,e,n))}neighbours(e){return new Set(this.pairs.get(e)?.keys()??[])}kindsBetween(e,t){let n=this.pairs.get(e)?.get(t);return n?_u.filter(e=>n.has(e)):[]}add(e,t,n){let r=this.pairs.get(e)??new Map,i=r.get(t)??new Set;i.add(n),r.set(t,i),this.pairs.set(e,r)}};function indexOf(e,t){let n=new Map;for(let r of e)for(let e of t(r)){let t=n.get(e)??new Set;t.add(r.path),n.set(e,t)}return n}function unionOf(...e){let t=new Map;for(let n of e)for(let[e,r]of n)t.set(e,new Set([...t.get(e)??[],...r]));return t}function linkEveryKey(e,t,n){for(let r of n.values()){let n=[...r];n.forEach((r,i)=>n.slice(i+1).forEach(n=>e.link(r,n,t)))}}function relationsOf(e){let t=new Links;for(let n of vu){let r=indexOf(e,e=>n.defined(e.model)),i=indexOf(e,e=>n.used(e.model));linkEveryKey(t,n.kind,unionOf(r,i))}return linkEveryKey(t,`folder`,indexOf(e,e=>[folderOf$1(e.path)])),{neighbours:e=>t.neighbours(e),linksBetween:(e,n)=>t.kindsBetween(e,n)}}var Counts=class{rows=Array.from({length:4},()=>new Map);totals=Array.from({length:4},()=>new Map);add(e,t,n=1){e.keys.forEach((e,r)=>{if(e===null)return;let i=this.rows[r].get(e)??new Map;i.set(t,(i.get(t)??0)+n),this.rows[r].set(e,i),this.totals[r].set(e,(this.totals[r].get(e)??0)+n)})}addAll(e,t=1){e.rows.forEach((n,r)=>{n.forEach((n,i)=>{let a=this.rows[r].get(i)??new Map;n.forEach((e,n)=>a.set(n,(a.get(n)??0)+t*e)),this.rows[r].set(i,a),this.totals[r].set(i,(this.totals[r].get(i)??0)+t*(e.totals[r].get(i)??0))})})}total(e,t){let n=t.keys[e];return n===null?0:this.totals[e].get(n)??0}count(e,t,n){let r=t.keys[e];return r===null?0:this.rows[e].get(r)?.get(n)??0}};function combined(e,t=1){let n=new Counts;return e.forEach(e=>n.addAll(e,t)),n}function distributionOf(e,t,n,r){let i=n.map(()=>1/n.length);for(let a=0;a<=3;a+=1)for(let o of t){let t=o.total(a,e);if(t<=0)continue;let s=t+r;n.forEach((t,n)=>{i[n]=(o.count(a,e,t)+r*i[n])/s})}return new Map(n.map((e,t)=>[e,i[t]]))}function countsOf(e,t){let n=new Counts;return e.forEach(e=>n.add(t(e),e.symbol)),n}function nameKeyOf(e,t){let n=e.keys[1];return n===null?null:JSON.stringify([n,t])}var NameCounts=class{rows=new Map;add(e,t,n){let r=nameKeyOf(e,t);if(r===null)return;let i=this.rows.get(r)??new Map;i.set(n,(i.get(n)??0)+1),this.rows.set(r,i)}addAll(e){e.rows.forEach((e,t)=>{let n=this.rows.get(t)??new Map;e.forEach((e,t)=>n.set(t,(n.get(t)??0)+e)),this.rows.set(t,n)})}rowOf(e,t){let n=nameKeyOf(e,t);return(n===null?void 0:this.rows.get(n))??new Map}};function tallyOf$1(e){let t=new NameCounts;return e.forEach(e=>{e.name!==null&&t.add(e.context,e.symbol,e.name)}),{symbols:countsOf(e,e=>e.context),names:t}}e(tallyOf$1,`tallyOf`);function combinedTally(e){let t=new NameCounts;return e.forEach(e=>t.addAll(e.names)),{symbols:combined(e.map(e=>e.symbols)),names:t}}var yu={"bpmn:TimerEventDefinition":`timer`,"bpmn:MessageEventDefinition":`message`,"bpmn:ErrorEventDefinition":`error`,"bpmn:SignalEventDefinition":`signal`,"bpmn:ConditionalEventDefinition":`conditional`,"bpmn:EscalationEventDefinition":`escalation`,"bpmn:LinkEventDefinition":`link`,"bpmn:CompensateEventDefinition":`compensation`,"bpmn:TerminateEventDefinition":`terminate`,"bpmn:CancelEventDefinition":`cancel`};function localNameOf(e){let t=e.split(`:`).pop()??e;return t.charAt(0).toLowerCase()+t.slice(1)}function textOf(e){let t=e?.trim()??``;return t===``?null:t}function definitionOf(e){for(let t of e.eventDefinitions??[]){let e=yu[t.$type];if(e!==void 0)return e}return null}function collect(e,t,n,r,i){for(let a of r)a.$instanceOf(`bpmn:SequenceFlow`)?t.push(a):a.$instanceOf(`bpmn:FlowNode`)&&a.id&&(e.push({element:a,processId:n,scope:i}),collect(e,t,n,a.flowElements??[],a.id))}function flowIdsBy(e,t){let n=new Map;for(let r of e){let e=t(r);e!==void 0&&r.id!==void 0&&n.set(e,[...n.get(e)??[],r.id])}return n}function geometryOf(e){let t=new Map,n=new Map,r=new Map;for(let i of e.diagrams??[])for(let e of i.plane?.planeElement??[]){let i=e.bpmnElement?.id;i!==void 0&&(e.bounds&&t.set(i,{x:e.bounds.x,y:e.bounds.y,width:e.bounds.width,height:e.bounds.height}),e.waypoint&&n.set(i,e.waypoint.map(e=>({x:e.x,y:e.y}))),typeof e.fill==`string`&&e.fill!==``&&r.set(i,e.fill))}return{bounds:t,waypoints:n,fills:r}}function flowGraphOf(e){let t=e,n=[],r=[];for(let e of(t.rootElements??[]).filter(e=>e.$type===`bpmn:Process`))collect(n,r,e.id??``,e.flowElements??[],null);let i=flowIdsBy(r,e=>e.sourceRef?.id),a=flowIdsBy(r,e=>e.targetRef?.id),{bounds:o,waypoints:s,fills:c}=geometryOf(t),l=new Map;for(let{element:e,processId:t,scope:r}of n){let n=e.id;l.set(n,{id:n,processId:t,type:localNameOf(e.$type),definition:definitionOf(e),name:textOf(e.name),host:e.attachedToRef?.id??null,scope:r,defaultFlow:e.default?.id??null,fill:c.get(n)??null,incoming:a.get(n)??[],outgoing:i.get(n)??[]})}return{nodes:l,flows:r.map(e=>{let t=e.sourceRef?.id??``;return{id:e.id??``,source:t,target:e.targetRef?.id??``,name:textOf(e.name),condition:textOf(e.conditionExpression?.body),isDefault:l.get(t)?.defaultFlow===e.id}}),bounds:o,waypoints:s}}async function diagramFactsOf(e,t){let n=await jt(t);return n?{path:e,graph:flowGraphOf(n),model:await b(e,t),mappings:mappingsOf(n)}:null}function observationsOf(e,t){return e.graph.flows.flatMap(n=>{let r=e.graph.nodes.get(n.source),i=e.graph.nodes.get(n.target);return r===void 0||i===void 0||i.host!==null?[]:[{flow:n.id,source:n.source,target:n.target,symbol:symbolOf(i),name:i.name,context:contextOf(e,n.source,viewOfFlow(e,n.id),t)}]})}function labelOf(e,t){let n=e.nodes.get(t);return n===void 0?``:[n.type,n.definition??``,n.name??``].join(`|`)}function copyKeyOf(e){let t=[...e.nodes.values()].map(t=>labelOf(e,t.id)).sort(),n=e.flows.map(t=>`${labelOf(e,t.source)}>${labelOf(e,t.target)}|${t.name??``}`).sort();return JSON.stringify([t,n])}var bu=1e3,xu=2166136261,Su=16777619;function textHashOf(e){let t=xu;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,Su)>>>0;return t.toString(16).padStart(8,`0`)}function sourceOf(e,t){return{path:e,hash:textHashOf(t),text:t}}async function summarise(e,t){if(!e.path.endsWith(`.bpmn`))return{path:e.path,copyKey:``,model:await b(e.path,e.text),tally:tallyOf$1([])};let n=await diagramFactsOf(e.path,e.text);return n===null?null:{path:e.path,copyKey:copyKeyOf(n.graph),model:n.model,tally:tallyOf$1(observationsOf(indexOf$1(n),t))}}var NextBlockLibrary=class{groups;summaries=new Map;constructor(e){this.groups=e}async summaryOf(e){let t=JSON.stringify([e.path,e.hash]);if(this.summaries.has(t))return this.summaries.get(t)??null;let n=await summarise(e,this.groups);return this.summaries.set(t,n),this.summaries.size>bu&&this.summaries.delete(this.summaries.keys().next().value),n}async evidenceFor(e,t){let n=[];for(let r of t){if(r.path===e.path)continue;let t=await this.summaryOf(r);t!==null&&t.copyKey!==e.copyKey&&n.push(t)}let r=relationsOf([e,...n].map(({path:e,model:t})=>({path:e,model:t}))).neighbours(e.path);return{diagram:e.tally,neighbours:combinedTally(n.filter(e=>r.has(e.path)).map(e=>e.tally)),project:combinedTally(n.map(e=>e.tally))}}},Cu=`endEvent`;function nearestSplitTypeBehind(e,t,n){let r=new Set([t]),i=t;for(;;){let t=visibleIncoming(e,i,n)[0];if(t===void 0||r.has(t.source))return null;r.add(t.source),i=t.source;let a=e.graph.nodes.get(i);if(a!==void 0&&isGatewayType(a.type)&&a.outgoing.length>=2)return a.type}}function deadEndBranchOf(e,t,n){let r=e.graph.nodes.get(t);if(r===void 0||r.type===Cu||visibleOutgoing(e,t,n).length>0)return null;let i=nearestSplitTypeBehind(e,t,n);return{symbols:i===null?[Cu]:[Cu,i],rule:`dead-end-branch`}}var wu=3;function rankOf(e){return[...e].map(([e,t])=>({symbol:e,probability:t})).sort((e,t)=>t.probability-e.probability||(e.symbol<t.symbol?-1:+(e.symbol>t.symbol)))}function explanationOf(e,t){for(let n=3;n>=0;--n){let r=t.filter(t=>t.evidence.total(n,e)>0).map(e=>e.name);if(r.length>0)return{order:n,levels:r}}return{order:0,levels:[]}}function suggestionOf(e,t,n,r,i){let a=rankOf(distributionOf(e,t.map(e=>e.evidence),n,r)),o=a[0];if(o===void 0)return null;let s=i.calibrate(o.probability);return s<i.threshold?null:{symbol:o.symbol,confidence:s,alternatives:a.slice(0,wu),evidence:explanationOf(e,t)}}var Tu=2,Eu=.6,isElementKind=e=>Object.hasOwn(Ii,e),isEventKind=e=>Object.hasOwn(Ri,e);function kebabOf(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function patchKindOf(e){let[t,n]=e.split(`:`),r=kebabOf(t);return isElementKind(r)?n===void 0?{element:r}:isEventKind(n)?{element:r,event:n}:null:null}function tallyOf(e,t){return e===`prior`?null:t[e]}function nameOf$1(e,t,n){let r=new Map;for(let i of n)for(let[n,a]of i.names.rowOf(e,t))r.set(n,(r.get(n)??0)+a);let i=[...r].sort((e,t)=>t[1]-e[1]||(e[0]<t[0]?-1:+(e[0]>t[0]))),[a,o]=i;if(a===void 0)return null;let s=i.reduce((e,[,t])=>e+t,0);return s<Tu||a[1]/s<Eu||o!==void 0&&o[1]===a[1]?null:a[0]}e(nameOf$1,`nameOf`);function answerOf(e,t,n,r){if(deadEndBranchOf(e,t,pu)===null)return null;let i=contextOf(e,t,pu,r.groups),a=suggestionOf(i,r.levels.map(e=>({name:e,evidence:e===`prior`?r.prior:n[e].symbols})),uu,r.gamma,{calibrate:r.calibrate,threshold:hu});if(a===null)return null;let o=patchKindOf(a.symbol);if(o===null)return null;let s=r.levels.flatMap(e=>tallyOf(e,n)??[]);return{symbol:a.symbol,kind:o,name:nameOf$1(i,a.symbol,s),confidence:a.confidence,evidence:a.evidence}}function patchOf(e,t){return{operations:[{op:`add`,element:e.kind.element,after:t,...e.kind.event===void 0?{}:{event:e.kind.event},...e.name===null?{}:{name:e.name}}]}}function gapOf(e){let t=e.graph.flows.flatMap(t=>{let n=e.graph.bounds.get(t.source),r=e.graph.bounds.get(t.target);if(n===void 0||r===void 0)return[];let i=r.x-(n.x+n.width);return i>0?[i]:[]}).sort((e,t)=>e-t);return t.length===0?50:t[Math.floor(t.length/2)]}async function suggestNext(e,t,n){let r=await diagramFactsOf(n.path,n.xml);if(r===null)return null;let i=indexOf$1(r),a={path:n.path,copyKey:copyKeyOf(r.graph),model:r.model,tally:tallyOf$1(observationsOf(i,t.groups))},o=answerOf(i,n.nodeId,await e.evidenceFor(a,n.others),t);if(o===null)return null;let s=patchOf(o,n.nodeId),c=await Li(n.xml,s,{engine:n.engine,conventions:n.conventions,gap:Math.max(gapOf(i),n.minimumGap??0)});return c.ok?{answer:o,patch:s,steps:c.steps}:null}var NextBlockSession=class{hooks;schedule;dismissed=new Set;candidate=null;cancelPause=null;shown=null;generation=0;enabled=!0;constructor(e,t){this.hooks=e,this.schedule=t}select(e,t){this.disturb(),this.enabled&&e!==null&&t&&!this.dismissed.has(e)&&(this.candidate=e,this.cancelPause=this.schedule(()=>this.ask(),700))}disturb(){this.cancelPause?.(),this.cancelPause=null,this.candidate=null,this.generation+=1,this.shown!==null&&(this.shown=null,this.hooks.hide())}setEnabled(e){this.enabled=e,e||this.disturb()}isShown(){return this.shown!==null}shownNode(){return this.shown?.nodeId??null}accept(){if(this.shown===null)return null;let{suggestion:e}=this.shown;return this.shown=null,this.candidate=null,this.generation+=1,this.hooks.hide(),e}dismiss(){if(this.shown===null)return null;let{nodeId:e}=this.shown;return this.dismissed.add(e),this.shown=null,this.candidate=null,this.generation+=1,this.hooks.hide(),e}ask(){this.cancelPause=null;let e=this.candidate;if(e===null)return;let t=this.generation+=1;this.hooks.request(e,n=>this.answer(t,e,n))}answer(e,t,n){e===this.generation&&t===this.candidate&&n!==null&&(this.shown={nodeId:t,suggestion:n},this.hooks.show(t,n))}},Du=[`Shift`,`Control`,`Alt`,`Meta`,`AltGraph`,`CapsLock`],Ou=`.bio-properties-panel`,ku=16;function deadEndOf(e){let t=e?.businessObject;return!!e&&e.waypoints===void 0&&e.labelTarget===void 0&&t?.$instanceOf?.(`bpmn:FlowNode`)===!0&&t.$instanceOf(`bpmn:EndEvent`)!==!0&&(e.outgoing??[]).length===0}function withoutModifier(e){return!e.ctrlKey&&!e.metaKey&&!e.altKey&&!e.shiftKey}function inPropertiesPanel(){return!!document.activeElement?.closest?.(Ou)}var NextBlockController=class{options;library;model=bundledModel();session;bindings=[];dragging=!1;container;constructor(e){this.options=e,this.library=new NextBlockLibrary(this.model.groups),this.session=new NextBlockSession({request:(e,t)=>{this.suggest(e).then(t)},show:(e,t)=>{this.layer.show(t),this.options.announce(p(`app.nextBlock.status.suggested`,{type:$n(t)}))},hide:()=>this.layer.hide()},(e,t)=>{let n=window.setTimeout(e,t);return()=>window.clearTimeout(n)}),this.bind(`selection.changed`,this.reselect),this.bind(`elements.changed`,this.reselect),this.bind(`drag.start`,this.dragStart),this.bind(`drag.cleanup`,this.dragEnd),this.bind(`canvas.viewbox.changed`,this.disturb),this.container=this.options.modeler.get(`canvas`).getContainer(),document.addEventListener(`keydown`,this.onKeyDown)}setEnabled(e){this.session.setEnabled(e)}dispose(){for(let[e,t]of this.bindings.splice(0))this.eventBus.off(e,t);document.removeEventListener(`keydown`,this.onKeyDown),this.session.setEnabled(!1)}get eventBus(){return this.options.modeler.get(`eventBus`)}get layer(){return this.options.modeler.get(`nextBlockLayer`)}get registry(){return this.options.modeler.get(`elementRegistry`)}bind(e,t,n){this.bindings.push([e,t]),n===void 0?this.eventBus.on(e,t):this.eventBus.on(e,n,t)}disturb=()=>{this.session.disturb()};dragStart=()=>{this.dragging=!0,this.session.disturb()};dragEnd=()=>{this.dragging=!1,this.reselect()};reselect=()=>{if(this.dragging)return;let e=this.options.modeler.get(`selection`).get(),t=e.length===1?this.registry.get(e[0].id):void 0;this.session.select(t?.id??null,deadEndOf(t))};onKeyDown=e=>{let t=Qr(e.target);this.session.isShown()&&!t&&e.key===`Tab`&&withoutModifier(e)&&this.onCanvas(e.target)?(e.preventDefault(),this.accept()):this.session.isShown()&&!t&&e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),this.dismiss()):Du.includes(e.key)||this.session.disturb()};onCanvas(e){return e instanceof Node&&!!this.container?.contains(e)}accept(){let e=this.session.accept();if(e!==null)try{let t=this.options.modeler.get(`patchApplier`).apply(e.steps,this.options.engine()),n=t[0]?this.registry.get(t[0]):void 0;n&&this.options.modeler.get(`selection`).select(n),this.options.announce(p(`app.nextBlock.status.added`,{type:$n(e)}))}catch(e){console.error(`The next block suggestion could not be added:`,e)}}dismiss(){this.session.dismiss()!==null&&this.options.announce(p(`app.nextBlock.status.dismissed`))}padClearance(e){let t=this.container?.querySelector(`.djs-context-pad.open`),n=this.registry.get(e);if(!this.container||!t||!n)return 0;let{scale:r,x:i}=this.options.modeler.get(`canvas`).viewbox(),a=(t.getBoundingClientRect().right-this.container.getBoundingClientRect().left)/r+i;return Math.max(0,a+ku/r-(n.x+n.width))}async suggest(e){if(this.dragging||Qr(document.activeElement)||inPropertiesPanel())return null;let t=this.padClearance(e);try{let{xml:n}=await this.options.modeler.saveXML({format:!1});if(!n)return null;let r=this.options.path(),i=await this.options.sources.near(r);return await suggestNext(this.library,this.model,{path:r,xml:n,nodeId:e,others:i,engine:this.options.engine(),conventions:this.options.conventions(),minimumGap:t})}catch(e){return console.error(`The next block suggestion failed:`,e),null}}},folderOf=e=>e.replace(/[\\/][^\\/]*$/,``),turn=()=>new Promise(e=>setTimeout(e,0)),ProjectSources=class{bridge;reads=new Map;constructor(e){this.bridge=e}async near(e){let t=await this.list(),n=folderOf(e),r=[...t.filter(e=>folderOf(e.path)===n),...t.filter(e=>folderOf(e.path)!==n)].slice(0,400),i=new Set(r.map(e=>e.path));for(let e of[...this.reads.keys()])i.has(e)||this.reads.delete(e);let a=[];for(let e of r){let t=await this.sourceOf(e.path,e.stamp);t!==null&&a.push(t)}return a}async list(){try{let e=await this.bridge.getProjectFiles();return Array.isArray(e?.files)?e.files.map(e=>({path:e.path,stamp:e.stamp})):[]}catch{return[]}}async sourceOf(e,t){let n=this.reads.get(e);if(n!==void 0&&n.stamp===t)return n.source;await turn();let r=await this.bridge.readFile(e).catch(()=>null),i=r!==null&&r.length<=1e6?sourceOf(e,r):null;return this.reads.set(e,{stamp:t,source:i}),i}};function appConfig(){return window.appConfig??{}}function NextBlockSuggestions({modeler:e}){let[t,r]=n(``),i=l(()=>new NextBlockController({modeler:e,sources:new ProjectSources(Y()),path:()=>appConfig().bpmnFilePath??``,engine:()=>Dt(appConfig().engine)??`classic`,conventions:()=>appConfig().conventions,announce:r}),[e]);return f(()=>{i.setEnabled(ua());let e=Ci(()=>i.setEnabled(ua()));return()=>{e(),i.dispose()}},[i]),u(`div`,{class:`next-block-announce`,role:`status`,"aria-live":`polite`,children:t})}function useTokenSimulation(e){let[t,i]=n({isRunning:!1,isPaused:!1,tokens:[]}),[a,o]=n(null),[c,l]=n(!1),u=s(null),d=s(new Map);f(()=>{if(i({isRunning:!1,isPaused:!1,tokens:[],currentElement:void 0}),!e)l(!1);else{try{let t=e.get?.(`toggleMode`);if(t){if(u.current=t,l(!0),o(null),typeof t.init==`function`)try{t.init()}catch(e){console.warn(`Failed to initialize token simulation:`,e)}let n=e.get?.(`eventBus`),onToggleModeChange=e=>{i(t=>({...t,isRunning:e.active??t.isRunning,isPaused:!1}))};n&&typeof n.on==`function`&&(n.on(`tokenSimulation.toggleMode`,onToggleModeChange),d.current.set(`tokenSimulation.toggleMode`,onToggleModeChange))}else l(!1)}catch(e){let t=e instanceof Error?e:Error(String(e));o(t),l(!1)}return()=>{if(e){let t=e.get?.(`eventBus`);t&&typeof t.off==`function`&&(d.current.forEach((e,n)=>{t.off(n,e)}),d.current.clear())}if(u.current&&typeof u.current.toggleMode==`function`)try{u.current.toggleMode(!1)}catch(e){console.warn(`Failed to deactivate token simulation:`,e)}}}},[e]);let p=r(()=>{try{let e=u.current;if(!e)return;typeof e.toggleMode==`function`&&e.toggleMode(!0),i(e=>({...e,isRunning:!0,isPaused:!1}))}catch(e){let t=e instanceof Error?e:Error(String(e));o(t),console.error(`Failed to play token simulation:`,e)}},[]),m=r(()=>{try{let e=u.current;if(!e||!t.isRunning)return;typeof e.pause==`function`&&e.pause(),i(e=>({...e,isPaused:!0,isRunning:!1}))}catch(e){let t=e instanceof Error?e:Error(String(e));o(t),console.error(`Failed to pause token simulation:`,e)}},[t.isRunning]),h=r(()=>{try{let e=u.current;if(!e)return;typeof e.toggleMode==`function`&&e.toggleMode(!1),i({isRunning:!1,isPaused:!1,tokens:[]})}catch(e){let t=e instanceof Error?e:Error(String(e));o(t),console.error(`Failed to stop token simulation:`,e)}},[]),g=r(()=>{try{let e=u.current;if(!e)return;typeof e.reset==`function`&&e.reset(),i({isRunning:!1,isPaused:!1,tokens:[],currentElement:void 0})}catch(e){let t=e instanceof Error?e:Error(String(e));o(t),console.error(`Failed to reset token simulation:`,e)}},[]),_=r(()=>{try{let e=u.current;if(!e)return;typeof e.step==`function`&&e.step()}catch(e){let t=e instanceof Error?e:Error(String(e));o(t),console.error(`Failed to step token simulation:`,e)}},[]),v=r(()=>{try{h(),g(),p()}catch(e){let t=e instanceof Error?e:Error(String(e));o(t),console.error(`Failed to restart token simulation:`,e)}},[h,g,p]),y=r(e=>{try{let t=u.current;if(!t||typeof t.setTokens!=`function`)return;t.setTokens(e),i(t=>({...t,tokens:e}))}catch(e){let t=e instanceof Error?e:Error(String(e));o(t),console.error(`Failed to set tokens:`,e)}},[]),b=r(()=>{try{let e=u.current;return!e||typeof e.getTokens!=`function`?t.tokens:e.getTokens()}catch(e){return console.error(`Failed to get tokens:`,e),t.tokens}},[t.tokens]);return{state:t,controls:{play:p,pause:m,stop:h,reset:g,step:_,restart:v},error:a,isSupported:c,setTokens:y,getTokens:b}}function useMinimap(e,t={}){let[i,a]=n({isOpen:t.open??!1,isVisible:!1,isSupported:!1,currentScale:1}),[o,c]=n(null),l=s(null),u=s(new Map),d=s(null),p=s(null);f(()=>{if(!e)a(e=>({...e,isSupported:!1,isVisible:!1}));else{try{let n=e.get?.(`minimap`),r=Vi(t.container||`.minimap-container`);if(!n){a(e=>({...e,isSupported:!1}));return}if(l.current=n,d.current=r,c(null),a(e=>({...e,isSupported:!0,isVisible:!0})),t&&typeof n.setOptions==`function`&&n.setOptions(t),typeof n.isOpen==`function`){let e=n.isOpen();a(t=>({...t,isOpen:e}))}let onViewportChange=e=>{a(t=>({...t,viewport:e.viewport,currentScale:e.scale}))},onToggle=e=>{a(t=>({...t,isOpen:e.open}))},i=e.get?.(`eventBus`);typeof i?.on==`function`&&(i.on(`minimap.viewport.changed`,onViewportChange),i.on(`minimap.toggle`,onToggle),u.current.set(`minimap.viewport.changed`,onViewportChange),u.current.set(`minimap.toggle`,onToggle),p.current=i)}catch(e){let t=e instanceof Error?e:Error(String(e));c(t),a(e=>({...e,isSupported:!1}))}return()=>{if(p.current&&typeof p.current.off==`function`&&(u.current.forEach((e,t)=>{p.current?.off?.(t,e)}),u.current.clear()),p.current=null,l.current&&typeof l.current.destroy==`function`)try{l.current.destroy()}catch(e){console.warn(`Failed to destroy minimap:`,e)}l.current=null,d.current=null}}},[e,t.container]);let m=r(()=>{try{let e=l.current;if(!e)return;typeof e.open==`function`?e.open():typeof e.toggle==`function`&&e.toggle(!0)}catch(e){let t=e instanceof Error?e:Error(String(e));c(t),console.error(`Failed to open minimap:`,e)}},[]),h=r(()=>{try{let e=l.current;if(!e)return;typeof e.close==`function`?e.close():typeof e.toggle==`function`&&e.toggle(!1)}catch(e){let t=e instanceof Error?e:Error(String(e));c(t),console.error(`Failed to close minimap:`,e)}},[]);return{state:i,open:m,close:h,toggle:r(()=>{try{let e=l.current;if(!e)return;typeof e.toggle==`function`?e.toggle():i.isOpen?h():m()}catch(e){let t=e instanceof Error?e:Error(String(e));c(t),console.error(`Failed to toggle minimap:`,e)}},[i.isOpen,m,h]),setOptions:r(e=>{try{let t=l.current;if(!t||typeof t.setOptions!=`function`)return;t.setOptions(e),a(t=>({...t,isOpen:e.open??t.isOpen}))}catch(e){let t=e instanceof Error?e:Error(String(e));c(t),console.error(`Failed to set minimap options:`,e)}},[]),error:o}}var Au={async applyLayout(e){try{let{graphAwareLayoutService:t}=await m(async()=>{let{graphAwareLayoutService:e}=await import(`./GraphAwareLayoutService-C8J8YHJI.js`);return{graphAwareLayoutService:e}},__vite__mapDeps([24,1,3,4]),import.meta.url);return await t.applyLayout(e)}catch(e){return{success:!1,error:e}}}},ju=new Set([`bpmn:Process`,`bpmn:Collaboration`]);function laidOutMessage(e){return p(`app.autoLayout.laidOut`,{count:e})}function countLaidOut(e){return(e??[]).filter(e=>e&&e.type!==`label`&&!e.labelTarget&&!ju.has(e.type??``)).length}function watchNextEdit(e,t){return e?.on?.(`commandStack.changed`,t),()=>e?.off?.(`commandStack.changed`,t)}async function layOut(e,t){let n=await t(e);return n.success?{ok:!0,count:countLaidOut(e.get(`elementRegistry`).getAll())}:{ok:!1,error:n.error}}async function layOutAndFit(e,t,n){let r=await layOut(e,t);return r.ok&&n(),r}async function layOutInMemory(e,t,n){return e.quietly(async()=>{let r=await layOutAndFit(t,n,()=>e.fitToScreen());return t.get(`commandStack`).clear(),r})}function LayoutBar({count:e,onUndo:t,onClose:n}){return u(`aside`,{class:`layout-bar`,role:`status`,"aria-label":p(`app.autoLayout.autoLayout`),children:[u(`span`,{class:`layout-bar__message`,children:laidOutMessage(e)}),u(`button`,{type:`button`,class:`ui-button`,onClick:t,children:p(`app.common.undo`)}),u(`button`,{type:`button`,class:`layout-bar__close`,onClick:n,title:p(`app.common.close`),"aria-label":p(`app.common.close`),children:u(`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`,children:u(`path`,{d:`M4 4l8 8M12 4l-8 8`})})})]})}async function openDrawnFile(e,t,n,r){let i=null;try{i=await n.getLicense()}catch{i=null}if(!Qi(i))return`placed`;let a=await layOutInMemory(e,t,r);return a.ok?`laid-out`:(console.error(`Auto-layout error:`,a.error),`placed`)}function addBackgroundToSvg(e,t){let n=e.match(/viewBox="([^"]+)"/),r=e.match(/<svg[^>]*>/);if(!n||!r||r.index===void 0)return e;let i=n[1].trim().split(/[\s,]+/).map(Number);if(i.length<4||i.some(e=>!Number.isFinite(e)))return e;let[a,o,s,c]=i,l=r.index+r[0].length,u=`<rect x="${a}" y="${o}" width="${s}" height="${c}" fill="${t}"/>`;return e.slice(0,l)+u+e.slice(l)}var Mu={edgePixels:8192,maxScale:2},Nu={edgePixels:3300,maxScale:1/0};async function convertSvgToPng(e,t,n=Mu){return new Promise((r,i)=>{let a=e.match(/viewBox="([^"]+)"/);if(!a){i(Error(`Could not find viewBox in SVG`));return}let o=a[1].trim().split(/[\s,]+/).map(Number);if(o.length<4||o.some(e=>!Number.isFinite(e))){i(Error(`Could not find valid viewBox in SVG`));return}let[s,c,l,u]=o;if(l<=0||u<=0){i(Error(`Invalid SVG viewBox dimensions`));return}let d=Math.min(n.maxScale,n.edgePixels/Math.max(l,u,1)),f=document.createElement(`canvas`);f.width=l*d,f.height=u*d;let p=f.getContext(`2d`);if(!p){i(Error(`Could not get canvas context`));return}p.scale(d,d),t!==`transparent`&&(p.fillStyle=t,p.fillRect(0,0,l,u));let m=new Image,h=``,release=()=>{h&&URL.revokeObjectURL(h)};m.onload=()=>{release(),p.drawImage(m,0,0,l,u),r(f.toDataURL(`image/png`))},m.onerror=e=>{release(),i(Error(`Unable to load the SVG image: `+e))};let g=new Blob([e],{type:`image/svg+xml;charset=utf-8`});h=URL.createObjectURL(g),m.src=h})}async function createPdfFromPages(e){if(e.length===0)throw Error(`No pages to create PDF`);let t=e[0],n=(Number.isFinite(t.width)&&t.width>0?t.width:1)/(Number.isFinite(t.height)&&t.height>0?t.height:1),{jsPDF:r}=await m(async()=>{let{jsPDF:e}=await import(`./jspdf.es.min-CM3S4IDt.js`);return{jsPDF:e}},__vite__mapDeps([25,1,4,26,2,5,3,6,7,8,9,10,27,12,11,13,14,28,29,30,15,31,32,33,16,17,18,23,20,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54]),import.meta.url),i=new r({orientation:n>1?`landscape`:`portrait`,unit:`mm`,format:`a4`,compress:!0}),a=i.internal.pageSize.getWidth(),o=i.internal.pageSize.getHeight();for(let t=0;t<e.length;t++){let n=e[t];if(!n)continue;t>0&&i.addPage(),i.setFontSize(14),i.setTextColor(50,50,50),i.text(n.name,10,15),i.setDrawColor(200,200,200),i.line(10,18,a-10,18);let r=Math.max(1,a-20),s=Math.max(1,o-15-20),c=Number.isFinite(n.width)&&n.width>0?n.width:1,l=Number.isFinite(n.height)&&n.height>0?n.height:1,u=r,d=l/c*u;d>s&&(d=s,u=c/l*d);let f=10+(r-u)/2;i.addImage(n.png,`PNG`,f,25,u,d)}return i.output(`dataurlstring`)}var Pu=[`unmapped`,`assumed`,`lost`];function ImportReportDialog({outcome:e,onClose:t}){if(!e)return null;let{result:n}=e,r=groupedNotes({notes:n.ok?n.report.notes:n.notes}),i=Pu.every(e=>r[e].length===0);return u(mi,{title:n.ok?p(`app.importDiagram.diagramImported`):p(`app.importDiagram.thisFileCouldNotBe`),size:`medium`,initialFocus:`title`,backdrop:`close`,onClose:t,footer:u(vi,{actions:[{id:`close`,label:p(`app.common.close`),role:`primary`,onClick:t}]}),children:u(`div`,{className:`import-report__body`,children:[u(`p`,{className:n.ok?`import-report__lead`:`import-report__lead import-report__lead--failed`,children:n.ok?summaryLine(n.report):n.message}),n.ok&&e.savedTo&&u(`p`,{className:`import-report__saved`,children:p(`app.importDiagram.savedAs`,{path:folderAndName(e.savedTo)})}),n.ok&&i&&u(`p`,{className:`import-report__clean`,children:p(`app.importDiagram.everythingInTheFileWas`)}),Pu.map(e=>r[e].length===0?null:u(`section`,{className:`import-report__group import-report__group--${e}`,children:[u(`h3`,{children:noteHeading(e,r[e].length)}),u(`p`,{className:`import-report__why`,children:p(`app.importDiagram.why.${e}`)}),u(`ul`,{children:r[e].map((e,t)=>u(`li`,{children:e},t))})]},e)),n.ok&&u(`p`,{className:`import-report__why`,children:p(`app.importDiagram.connectorsKeepTheRoute`)})]})})}async function openImported(e,t){if(t?.savedTo&&typeof e?.revealElement==`function`)try{await e.revealElement(t.savedTo)}catch{}}async function importFromHost(e){let t=null;try{t=await e.chooseFile(``,{title:p(`app.importDiagram.importDiagram`),description:p(`app.importDiagram.aDrawIoVisioSignavio`),mode:`open`,selectFiles:!0,selectFolders:!1,multiSelect:!1})}catch{return null}if(!t)return null;let n=t.split(/[\\/]/).pop()??t,r;try{r=await e.readFileBytes(t)}catch(e){return{source:n,result:{ok:!1,message:e instanceof Error?e.message:String(e),notes:[]}}}let i;try{i=importDiagram({name:n,data:r})}catch(e){i={ok:!1,message:e instanceof Error?e.message:String(e),notes:[]}}if(!i.ok)return{source:n,result:i};let a=null;try{a=await e.chooseFile(`bpmn`,{title:p(`app.importDiagram.saveTheImportedDiagram`),description:p(`app.importDiagram.theBpmn20File`),mode:`save`,defaultFileName:importedFileName(n)})}catch{return null}if(!a)return null;try{return await e.saveFile(a,i.bpmn),{source:n,result:i,savedTo:a}}catch(e){return{source:n,result:{ok:!1,message:e instanceof Error?e.message:String(e),notes:i.report.notes??[]}}}}function useCodeBridgeState(){let[e,t]=n(Zn());return f(()=>(t(Zn()),It(()=>t(Zn()))),[]),e}var Fu=360,Iu=8,Lu=new Map;function snippetOf(e){let t=`${e.file}:${e.line}`,n=Lu.get(t);return n||(n=Zn().actions?.snippet(e).catch(()=>null)??Promise.resolve(null),Lu.set(t,n),n.then(e=>{e===null&&Lu.get(t)===n&&Lu.delete(t)})),n}function forgetSnippets(){Lu.clear()}function Snippet({anchor:e}){let[t,r]=n(void 0);return f(()=>{let t=!0;return r(void 0),snippetOf(e).then(e=>{t&&r(e)}),()=>{t=!1}},[e.file,e.line]),t===void 0?u(`p`,{class:`code-card__note type-help`,children:p(`app.codeBridge.snippetLoading`)}):!t||t.length===0?u(`p`,{class:`code-card__note type-help`,children:p(`app.codeBridge.snippetUnavailable`)}):u(`pre`,{class:`code-card__code type-code`,"aria-label":dn(e),children:t.slice(0,Iu).map((t,n)=>u(`div`,{class:`code-card__line`,children:[u(`span`,{class:`code-card__number`,children:e.line+n}),t]},n))})}function Places({binding:e,onOpen:t}){if(e.anchors.length===0)return null;let n=e.anchors.slice(0,5);return u(`ul`,{class:`code-card__places`,children:[n.map(e=>u(`li`,{children:u(`button`,{type:`button`,class:`code-card__place type-link`,onClick:()=>t(e),children:[u(`span`,{class:`code-card__where`,children:Sn(e.kind,dn(e))}),e.symbol&&e.kind!==`PROCESS`&&e.kind!==`DECISION`&&u(`span`,{class:`code-card__symbol type-help`,children:e.symbol})]})},`${e.file}:${e.line}`)),e.anchors.length>n.length&&u(`li`,{class:`code-card__note type-help`,children:p(`app.codeBridge.moreCount`,{count:e.anchors.length-n.length})})]})}function CodeCardBody({status:e}){let t=Zn().actions,n=yn(e),r=e.state===`bound`?e.anchors.find(e=>e.kind!==`PROCESS`&&e.kind!==`DECISION`):void 0,i=t?.stubFor(e)??null,open=e=>{t?.open(e),Gn()};return u(`div`,{class:`code-card`,children:[u(`div`,{class:`code-card__head`,children:[u(`span`,{class:`code-card__state type-section-heading code-card__state--${e.state}`,children:Pn(e)}),u(`span`,{class:`code-card__name type-dialog-title`,title:e.label,children:e.label})]}),e.bindings.filter(e=>e.state!==`notApplicable`).map(e=>u(`section`,{class:`code-card__binding`,children:[u(`div`,{class:`code-card__kind type-help`,children:[u(`span`,{children:Yn(e.kind)}),u(`code`,{class:`code-card__value type-body`,children:e.value})]}),Mn(e).map(e=>u(`p`,{class:`code-card__note type-help`,children:e},e)),u(Places,{binding:e,onOpen:open})]},`${e.kind}:${e.value}:${e.listener??``}`)),r&&u(Snippet,{anchor:r}),(e.tests.length>0||e.reached!==null||e.paused)&&u(`ul`,{class:`code-card__facts type-help`,children:[e.tests.length>0&&u(`li`,{children:p(`app.codeBridge.tests`,{count:e.tests.length})}),e.reached===!0&&u(`li`,{children:p(`app.codeBridge.reached`)}),e.reached===!1&&u(`li`,{children:p(`app.codeBridge.notReached`)}),e.paused&&u(`li`,{children:p(`app.codeBridge.paused`)})]}),(n?.anchors[0]||i)&&u(`div`,{class:`code-card__actions`,children:[i&&u(`button`,{type:`button`,class:`ui-button`,onClick:()=>{t?.createStub(e),Gn()},children:p(`app.codeBridge.createStub`)}),n?.anchors[0]&&u(`button`,{type:`button`,class:`ui-button ui-button--primary`,onClick:()=>open(n.anchors[0]),children:Sn(n.anchors[0].kind,``)})]})]})}function HoverCard({anchor:e,status:t}){let r=s(null),[i,a]=n(null);return d(()=>{let place=()=>{let t=r.current;if(!t)return;let n=e.getBoundingClientRect(),i=ei({left:n.left,top:n.top,width:n.width,height:n.height},{width:Fu,height:t.offsetHeight},{width:window.innerWidth||1024,height:window.innerHeight||768});a({top:i.top,left:i.left})};return place(),window.addEventListener(`resize`,place),()=>window.removeEventListener(`resize`,place)},[e,t]),u(`div`,{ref:r,class:`ui-popover code-card-popover`,role:`dialog`,"aria-label":p(`app.codeBridge.cardLabel`,{element:t.label}),style:{width:`${Fu}px`,top:`${i?.top??0}px`,left:`${i?.left??0}px`,visibility:i?`visible`:`hidden`},onPointerEnter:Rn,onPointerLeave:_n,children:u(CodeCardBody,{status:t})})}function CodeBridgeLayer(){let e=useCodeBridgeState(),t=e.card,n=t?e.statuses.get(t.elementId):void 0,r=t?.pinned===!0;return f(()=>{if(!r)return;let e=window.requestAnimationFrame(()=>{let e=document.querySelector(`.code-card-popover`);e&&!e.contains(document.activeElement)&&e.querySelector(`button`)?.focus()});return()=>window.cancelAnimationFrame(e)},[r,t?.elementId]),!t||!n?null:t.pinned?u(fi,{anchor:t.anchor,label:p(`app.codeBridge.cardLabel`,{element:n.label}),width:Fu,onClose:Gn,class:`code-card-popover`,children:u(CodeCardBody,{status:n})}):u(HoverCard,{anchor:t.anchor,status:n})}async function workerForTemplate(e,t,n,r=`8.8`){if(!await e.unlock())return`locked`;let i=(await loadTemplates(await e.store())).get(t);if(!i)return await e.notify(p(`app.project.theElementTemplateIsNot`,{id:t}),!0),`nothing`;let a=et(i.template,n,r),o=(await e.root()).replace(/[\\/]+$/,``),s=(await e.diagrams()).map(e=>e.replaceAll(`\\`,`/`).slice(0,Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`)))).find(e=>e===o||e.startsWith(`${o}/`)),c=s===o?``:s?s.slice(o.length+1):`workers`,l=c?`${c}/${a.fileName}`:a.fileName;try{await e.create(o,l,a.content)}catch(t){return await e.notify(p(`app.project.theJobWorkerWasNot`,{failure:t instanceof Error?t.message:String(t)}),!0),`refused`}return await e.notify(p(`app.project.wasWrittenForInMove`,{fileName:a.fileName,name:i.template.name,inside:c})),await e.open(`${o}/${l}`),`written`}function templateHost(e,t,n){return{unlock:()=>e.requestFeature(g.CODE_LINKS),root:t,notify:(t,n)=>e.notifyUser(t,n),open:t=>e.openAsText(t),create:(t,n,r)=>e.createProjectFiles(t,[{path:n,content:r}]),contracts:n,diagrams:async()=>(await e.getProjectFiles()).files.map(e=>e.path),store:async()=>{let n=(await t()).replace(/[\\/]+$/,``);return{root:t,list:async()=>((await e.getProjectFiles()).templates??[]).map(e=>e.path.replaceAll(`\\`,`/`).replace(`${n}/`,``)),read:t=>e.readFileIfPresent(`${n}/${t}`),write:(t,r)=>e.saveFile(`${n}/${t}`,r)}}}}var Ru=8;function templatesOf(e){return e.filter(e=>typeof e==`object`&&!!e&&typeof e.id==`string`)}function setPausedElements(e){er(new Set(e))}function useCodeBridge({project:e,active:t,installedTemplates:n}){let r=Y(),i=or(r,`codeBridge`)&&typeof r.findCodeStatus==`function`,a=l(()=>e?an(e.model):[],[e?.model]),o=l(()=>JSON.stringify(a),[a]),c=s({project:e,installedTemplates:n});c.current={project:e,installedTemplates:n};let u=e?.code??null;f(()=>{if(i)return hn({open:e=>{let t=Y();(e.kind===`PROCESS`||e.kind===`DECISION`?t.revealElement(e.file):t.openAsText(e.file,e.line)).catch(e=>console.error(`Could not open the code:`,e))},stubFor:e=>{let t=wn(e,templatesOf(c.current.installedTemplates));return t?{templateId:t.id,language:En(c.current.project?.sources??[])}:null},createStub:e=>{let t=wn(e,templatesOf(c.current.installedTemplates));if(!t)return;let n=Y(),root=async()=>(await n.getProjectFiles()).root??``,contracts=async()=>c.current.project?.contracts??[];workerForTemplate(templateHost(n,root,contracts),t.id,En(c.current.project?.sources??[])).catch(e=>console.error(`Could not create the worker:`,e))},snippet:async e=>{let t=await Y().readCodeSnippet?.(e.file,e.line,Ru);return t?t.lines:null}}),()=>{hn(null),nr()}},[i]),f(()=>{if(!i||!t||!e)return;let n=!0,r=Y().getBpmnFilePath()??``;return forgetSnippets(),Y().findCodeStatus?.(r,a).then(t=>{if(!n)return;let r=Bn(e.coverage);tn(t.licensed?Bt(t.statuses,{reached:r,paused:Zn().paused}):[])}).catch(()=>{n&&tn([])}),()=>{n=!1}},[i,t,o,u,e?.coverage])}var zu=[`missing-implementation`,`variable-typo`,`near-name`,`worker-fetch`,`mapping-order`,`template-drift`,`template-rejected`];function severityOf(e){return zu.includes(e)?`error`:`warning`}function list(e,t){return e.length<=t?e.join(`, `):`${e.slice(0,t).join(`, `)} +${e.length-t}`}function countable(e){let t=e?.businessObject;return!!t&&(t.$instanceOf?.(`bpmn:FlowNode`)||t.$type===`bpmn:SequenceFlow`)}function isError(e,t){return(e?.get?.(`elementRegistry`)?.get?.(t)?.businessObject?.eventDefinitions??[]).some(e=>e.$type===`bpmn:ErrorEventDefinition`)}function nameOf(e,t){return e?.get?.(`elementRegistry`)?.get?.(t)?.businessObject?.name?.trim()||t}function labels(e){return[...new Set(e.map(e=>e.label))]}function insightOf(e,t,n){return e?withoutAbsenceClaims(diagramInsight({model:e.model,files:e.files,targets:e.targets,code:e.code,workers:e.workers,codeNames:e.codeNames,order:se(t??null),definitions:t,codeLinks:n,variables:e.workers?.variableChecks?{mode:e.workers.variableChecks.check,inputs:e.workers.variableChecks.inputs,entitled:e.workers.variableChecks.entitled}:void 0}),e.clientFacts):[]}function factsOf(e,t,n,r,i){let a=[],o=r?.coverage??null,s=n.find(e=>e.elementId===t);if(s){let n=labels(s.implementations??[]),r=labels(s.tests??[]),i=isError(e,t);n.length>0?a.push({label:p(i?`app.code.fact.thrownBy`:`app.code.fact.runsIn`),value:list(n,2)}):s.missingImplementation?a.push({label:p(`app.code.fact.runsIn`),value:p(`app.code.fact.nothingInCode`),warning:!0}):s.neverThrown&&a.push({label:p(`app.code.fact.thrownBy`),value:p(`app.code.fact.nothingInCode`),warning:!0}),r.length>0&&a.push({label:p(`app.code.fact.tests`),value:`${r.length} · ${list(r,2)}`}),(s.usages??[]).length>0&&a.push({label:p(`app.code.fact.inCode`),value:p(`app.code.fact.places`,{count:(s.usages??[]).length})})}let c=e?.getDefinitions?.(),l=H(c).uses.filter(e=>e.elementId===t),u=[...new Set(l.filter(e=>e.writes).map(e=>e.name))],d=[...new Set(l.filter(e=>!e.writes).map(e=>e.name))];u.length>0&&a.push({label:p(`app.code.fact.sets`),value:list(u,5)}),d.length>0&&a.push({label:p(`app.code.fact.reads`),value:list(d,5)}),s&&((s.unfetched??[]).forEach(e=>a.push({label:e.name,value:e.closest?p(`app.code.fact.notFetchedClosest`,{closest:e.closest}):p(`app.code.fact.notFetched`),warning:!0})),(s.unread??[]).forEach(e=>a.push({label:e,value:p(`app.code.fact.unread`),warning:!0})),(s.lateReads??[]).forEach(e=>a.push({label:e,value:p(`app.code.fact.lateRead`),warning:!0})),(s.near??[]).forEach(e=>a.push({label:e.name,value:e.caseOnly?p(`app.code.fact.nearCase`,{near:e.near}):p(`app.code.fact.near`,{near:e.near}),warning:!0})),(s.implicit??[]).forEach(e=>a.push({label:e.jobType,value:p(`app.code.fact.implicit`,{method:e.method}),warning:!0})),(s.mappingOrder??[]).forEach(e=>a.push({label:e.path,value:p(`app.code.fact.mappingOrder`,{target:e.target}),warning:!0})),s.lostUpdate&&a.push({label:s.lostUpdate,value:p(`app.code.fact.lostUpdate`),warning:!0}),(s.unsetReads??[]).forEach(e=>a.push({label:e.name,value:e.closest?p(`app.code.fact.neverSetClosest`,{closest:e.closest}):p(`app.code.fact.neverSet`),warning:!0})));let f=e?.get?.(`elementRegistry`)?.get?.(t),m=countable(f)?reachOf(o,processIdsOf$1(e)):null;if(m){let e=m.all.elements.has(t)||m.all.flows.has(t),n=m.tests.filter(e=>e.reach.elements.has(t)||e.reach.flows.has(t)).length,r=e?m.tests.length>0?p(`app.code.fact.reachedBy`,{tests:n,total:m.tests.length}):p(`app.code.fact.reached`):p(`app.code.fact.noTestReaches`);a.push({label:p(`app.code.fact.coverage`),value:r,warning:!e})}let h=liveOf(i?.state??null,t);if(h&&(h.waiting>0||h.incidents>0)){let e=i?.engine?.profile??p(`app.code.fact.theEngine`),t=[p(`app.code.fact.here`,{count:h.waiting}),h.incidents>0&&p(`app.code.fact.withIncident`,{count:h.incidents})].filter(Boolean).join(` · `);a.push({label:p(`app.code.fact.on`,{where:e}),value:t,warning:h.incidents>0})}return a}function findingsOf(e,t){return e?t.flatMap(t=>{let n=nameOf(e,t.elementId),r=t.missingImplementation?[{title:p(`app.code.finding.missingImplementation`,{name:n}),where:p(`app.code.finding.missingImplementationWhere`),elements:[t.elementId],kind:`missing-implementation`,severity:`error`}]:t.neverThrown?[{title:p(`app.code.finding.neverThrown`,{name:n}),where:p(`app.code.finding.neverThrownWhere`),elements:[t.elementId],kind:`never-thrown`,severity:`error`}]:[],i=(t.unsetReads??[]).filter(e=>e.closest).map(e=>({title:p(`app.code.finding.typo`,{name:e.name,closest:e.closest}),where:n,elements:[t.elementId],kind:`variable-typo`,severity:`error`})),a=(t.unfetched??[]).map(e=>({title:p(`app.code.finding.unfetched`,{name:e.name}),where:e.closest?p(`app.code.finding.unfetchedClosestWhere`,{closest:e.closest,name:e.name}):p(`app.code.finding.unfetchedWhere`),elements:[t.elementId],kind:`worker-fetch`,severity:severityOf(`worker-fetch`)})),o=(t.unread??[]).map(e=>({title:p(`app.code.finding.unread`,{name:e}),where:p(`app.code.finding.unreadWhere`),elements:[t.elementId],kind:`writer-unread`,severity:severityOf(`writer-unread`)})),s=(t.lateReads??[]).map(e=>({title:p(`app.code.finding.lateRead`,{name:e}),where:p(`app.code.finding.lateReadWhere`),elements:[t.elementId],kind:`late-read`,severity:severityOf(`late-read`)})),c=(t.near??[]).map(e=>({title:e.caseOnly?p(`app.code.finding.nearCase`,{name:e.name,near:e.near}):p(`app.code.finding.near`,{name:e.name,near:e.near}),where:p(`app.code.finding.nearWhere`,{kind:p(`app.code.kind.${e.kind}`)}),elements:[t.elementId],kind:`near-name`,severity:severityOf(`near-name`)})),l=(t.implicit??[]).map(e=>({title:p(`app.code.finding.implicit`,{method:e.method}),where:p(`app.code.finding.implicitWhere`),elements:[t.elementId],kind:`implicit-job-type`,severity:severityOf(`implicit-job-type`)})),u=(t.mappingOrder??[]).map(e=>({title:p(`app.code.finding.mappingOrder`,{path:e.path,target:e.target}),where:p(`app.code.finding.mappingOrderWhere`),elements:[t.elementId],kind:`mapping-order`,severity:severityOf(`mapping-order`)})),d=t.lostUpdate?[{title:p(`app.code.finding.lostUpdate`,{name:t.lostUpdate}),where:p(`app.code.finding.lostUpdateWhere`),elements:[t.elementId],kind:`lost-update`,severity:severityOf(`lost-update`)}]:[],f=(t.unknownFields??[]).map(e=>({title:fieldFindingTitle(e),where:fieldFindingWhere(e),elements:[t.elementId],kind:`variable-field`,severity:severityOf(`variable-field`)})),m=(t.unknownNames??[]).map(e=>({title:nameFindingTitle(e),where:nameFindingWhere(),elements:[t.elementId],kind:`variable-unknown`,severity:severityOf(`variable-unknown`)}));return[...r,...i,...a,...o,...s,...c,...l,...u,...d,...f,...m]}):[]}function boundTo(e){let t=e.elementType??{};return t[`zeebe:taskDefinition`]??t[`camunda:topic`]??null}function templateFindings(e,t,n,r){return n.length===0||r.length===0?[]:r.flatMap(e=>{let r=boundTo(e),i=n.find(e=>e.value===r);if(!r||!i)return[];let a=templateDrift(e,i);if(!a)return[];let o=t.workers.filter(e=>e.value===r).map(e=>e.elementId);return o.length===0?[]:[{title:p(`app.code.finding.templateDrift`,{name:e.name||r,drift:driftText(a)}),where:`${r} · ${i.file}`,elements:[...new Set(o)],kind:`template-drift`,severity:severityOf(`template-drift`)}]})}var ProjectReader=class{core=new je;texts=new Map;async read(){try{let e=await Y().getProjectFiles(),t=Array.isArray(e?.files)?e.files:[],n=Array.isArray(e?.reports)?e.reports:[],r=Array.isArray(e?.sources)?e.sources:[],i=Array.isArray(e?.templates)?e.templates:[],a=new Set([...t,...n,...i].map(e=>e.path));[...this.texts.keys()].filter(e=>!a.has(e)).forEach(e=>this.texts.delete(e));let[o,s,c]=await Promise.all([this.load(t),this.load(n),this.load(i)]);return{root:e?.root??``,diagrams:o,reports:s,sources:r.map(e=>({path:e.path,stamp:e.stamp})),templates:c}}catch{return{root:``,diagrams:[],reports:[],sources:[],templates:[]}}}snapshot(e,t=null){return this.core.snapshot(e,t)}async workerVariables(){return Y().findWorkerVariables().catch(()=>null)}async code(e){return Y().findCode(e,!0,!0).catch(()=>null)}async contracts(){return(await Y().findCode([],!1,!0).catch(()=>null))?.structure?.workers??[]}async load(e){try{let t=Y();await Promise.all(e.filter(e=>this.texts.get(e.path)?.stamp!==e.stamp).map(async e=>{let n=await t.readFile(e.path).catch(()=>``);this.texts.set(e.path,{stamp:e.stamp,text:n})}))}catch{}return e.map(e=>({path:e.path,stamp:e.stamp,text:this.texts.get(e.path)?.text??``}))}},Bu=`diagram.bpmn`,Vu=new ProjectReader,Hu=300,Uu=null;function codeFor(e,t){let n=e.map(subjectKey).sort().join(`
24
+ `);return(Uu?.key!==n||Uu.version!==t)&&(Uu={key:n,version:t,code:Vu.code(e)}),Uu.code}async function load(e,t){let n=Y().getBpmnFilePath()??``,r=await Vu.read(),i=e??r.diagrams.find(e=>e.path===n)?.text??``,a=await b(n||Bu,i),o=await Vu.workerVariables(),s=await Vu.snapshot(r.diagrams.map(e=>e.path===n?{path:n,text:i}:e),o),c=gt(a,o),l=new Map;[...codeSubjects(s.files,s.targets),...c.elements.flatMap(e=>subjectsOf(c,e.id))].forEach(e=>l.set(subjectKey(e),e));let u=await codeFor([...l.values()],t);return{model:c,files:s.files,targets:s.targets,code:u,coverage:r.reports.length>0?projectCoverage(r.root,r.reports):null,workers:o,codeNames:u?.names??{},sources:r.sources.map(e=>({file:e.path})),contracts:u?.structure?.workers??[],clientFacts:u?.clientFacts??o?.clientFacts,suggestions:{texts:[...r.diagrams.filter(e=>e.path!==n).map(e=>({path:e.path,text:e.text})),{path:n||Bu,text:i}],workers:o,focus:n||Bu}}}function useProject(e){let[t,r]=n(null),[i,a]=n(0),o=Xi();return f(()=>{if(!o)return;let e=window,changed=()=>a(e=>e+1);return e.codeChanged=changed,e.coverageChanged=changed,()=>{e.codeChanged===changed&&(e.codeChanged=void 0),e.coverageChanged===changed&&(e.coverageChanged=void 0)}},[o]),f(()=>{if(!o)return;let t=!0,run=()=>{document.visibilityState===`visible`&&load(e,i).then(e=>{t&&(r(e),codeLinksReloaded())}).catch(e=>console.error(`Penstock could not read the project:`,e))},n=window.setTimeout(run,Hu),visible=()=>{document.visibilityState===`visible`&&run()};return document.addEventListener(`visibilitychange`,visible),()=>{t=!1,window.clearTimeout(n),document.removeEventListener(`visibilitychange`,visible)}},[e,i,o]),t}function objectsOf(e){return e.filter(e=>typeof e==`object`&&!!e)}function templateRejectionsOf(e,t,n){let r=On(objectsOf(t),n),i=r.unloadable.map(({template:e,reasons:t})=>({...Un(e),reasons:t})),a=e?.get?.(`templateRejections`,!1)?.rejected(r.loadable)??[];return[...i,...a].map(({name:e,id:t,reasons:n})=>({name:e,id:t,reasons:n}))}function templateRejectionFindings(e,t,n){return templateRejectionsOf(e,t,n).map(e=>({title:e.id?p(`app.templates.rejected.line`,{name:e.name,id:e.id,reason:e.reasons.join(`; `)}):p(`app.templates.rejected.anonymous`,{reason:e.reasons.join(`; `)}),where:e.id,elements:[],kind:`template-rejected`,severity:`error`}))}var Wu=[{id:`palette`,target:`.djs-palette`},{id:`properties`,target:`#js-properties-panel`},{id:`check`,target:`button#diagram-check`},{id:`tool-window`},{id:`deploy`,target:`button#deploy`},{id:`more`,target:`button#toolbar-more`}];function titleOf(e){return p(`app.tour.${e.id}.title`)}function bodyOf(e,t,n=!1){let r=p(n?`app.tour.profileChoice`:`app.tour.singleProfile`);return p(`app.tour.${e.id}.body`,{shortcut:t,profiles:r}).replace(/\s+/g,` `).trim()}function stepsPresent(e){return Wu.filter(t=>!t.target||e(t.target))}function tourDue(e){return e.available&&e.tourSeen!==!0}var Gu=16,Ku=8,qu={width:320,height:168};function cardSize(e){return{width:qu.width,height:e!==null&&e>0?Math.ceil(e):qu.height}}function placeCard(e,t,n){let clamp=(e,t,n)=>Math.max(Gu,Math.min(e,n-t-Gu));if(!e)return{left:Gu,top:n.height-t.height-Gu};let r=e.height>e.width,i=e.left+e.width/2<n.width/4&&r,a=e.left+e.width/2>n.width*3/4&&r,o=i?e.left+e.width+Ku:a?e.left-t.width-Ku:e.left+e.width/2-t.width/2,s=i||a?e.top:e.top+e.height+Ku;return{left:clamp(o,t.width,n.width),top:clamp(s,t.height,n.height)}}function useTour(e){let[t,r]=n(!1);f(()=>{if(!e||!tourDue({available:bi(),tourSeen:xi().tourSeen}))return;let t=window.setTimeout(()=>r(!0),400);return()=>window.clearTimeout(t)},[e]);let close=()=>{r(!1);try{xi().tourSeen!==!0&&Si({tourSeen:!0})}catch{}};return{open:t,close,show:()=>r(!0)}}function rectOf(e){if(!e?.target)return null;try{let t=document.querySelector(e.target)?.getBoundingClientRect();return t?{left:t.left,top:t.top,width:t.width,height:t.height}:null}catch{return null}}function Tour({open:e,onClose:t,profiles:r=1}){let[i,a]=n([]),[c,l]=n(0),[m,h]=n(null),[,g]=n(0),_=s(null),v=s(null);d(()=>{e&&(a(stepsPresent(e=>{try{return document.querySelector(e)!==null}catch{return!1}})),l(0))},[e]),d(()=>{if(e)try{let e=v.current?.getBoundingClientRect();h(e&&e.height>0?e.height:null)}catch{h(null)}},[e,c,i]),f(()=>{if(!e)return;let again=()=>g(e=>e+1),keys=e=>{e.key===`Escape`&&t()};return window.addEventListener(`resize`,again),document.addEventListener(`keydown`,keys),()=>{window.removeEventListener(`resize`,again),document.removeEventListener(`keydown`,keys)}},[e,t]),f(()=>{e&&!document.activeElement?.closest(`input, textarea, [contenteditable="true"]`)&&_.current?.focus()},[e,c,i]);let y=i[c];if(!e||!y)return null;let b=rectOf(y),x=cardSize(m),{left:S,top:C}=placeCard(b,x,{width:typeof window<`u`&&Number.isFinite(window.innerWidth)&&window.innerWidth>0?window.innerWidth:1024,height:typeof window<`u`&&Number.isFinite(window.innerHeight)&&window.innerHeight>0?window.innerHeight:768}),w=c===i.length-1;return u(o,{children:[b&&u(`div`,{className:`editor-tour__spot`,style:{left:b.left-2,top:b.top-2,width:b.width+4,height:b.height+4}}),u(`div`,{className:`editor-tour`,ref:v,role:`dialog`,"aria-label":p(`app.tour.label`),style:{left:S,top:C,width:x.width},children:[u(`span`,{className:`editor-tour__count`,children:p(`app.tour.step`,{index:c+1,total:i.length})}),u(`h2`,{className:`editor-tour__title`,children:titleOf(y)}),u(`p`,{className:`editor-tour__body`,children:bodyOf(y,Zr(B.shortcut,Br())??``,r>1)}),u(`div`,{className:`editor-tour__actions`,children:[u(`button`,{type:`button`,className:`ui-button`,onClick:t,children:p(`app.tour.skip`)}),u(`span`,{className:`editor-tour__gap`}),c>0&&u(`button`,{type:`button`,className:`ui-button`,onClick:()=>l(c-1),children:p(`app.common.back`)}),u(`button`,{type:`button`,className:`ui-button ui-button--primary`,ref:_,onClick:()=>w?t():l(c+1),children:p(w?`app.tour.done`:`app.tour.next`)})]})]})]})}function App({initialXml:e,apiClient:t,eventBus:i,file:a,scriptHost:o}){let c=da({kind:`bpmn`,file:a,fallbackName:`diagram.bpmn`}),d=c.canvas,m=Xi(),[h,_]=n({xml:e,selectedElementId:void 0,isExportDialogOpen:!1,isDiagramCheckOpen:!1,isMigrationOpen:!1,isCoverageOpen:!1,isRunsOpen:!1,isMarketplaceOpen:!1,currentBpmnXml:``,modeler:null,installedTemplates:[],isCamunda8:!1,isCamunda7:!1,isOperaton:!1,isCibSeven:!1,isFlowable:!1,isActiviti:!1,lintSource:null,isEngineConfigured:!1,isConfigLoading:!0,configLoadFailed:!1}),v=s(null),y=Vr(fl.map(e=>e.id),`bpmn`),b=ea(c.key,y.shownTab),S=Zi(),[C,w]=n(!1),T=h.modeler,E=h.isCamunda8?`camunda-8`:h.isOperaton?`operaton`:h.isCibSeven?`cib-seven`:h.isCamunda7?`camunda-7`:h.isFlowable?`flowable`:h.isActiviti?`activiti`:`classic`,D=r(async e=>{let n=h.lintSource,r=n?.clientBundlePath?await Cn(await t.file.readFile(n.clientBundlePath)):bn(n?.configPath?await t.file.readFile(n.configPath):null);return Vn(r,E,e)},[h.lintSource,t,E]);f(()=>{if(!T)return;let e=!1,apply=()=>{let t=T.getDefinitions?.();D(t).then(t=>{if(e)return;let n=T.get(`linting`,!1);n&&(fn(n),n.setLinterConfig(t))}).catch(e=>console.error(`Failed to load the bpmnlint rules:`,e))};apply();let t=window;m&&(t.lintRulesChanged=apply);let n=T.get(`eventBus`,!1);return n?.on(`import.done`,apply),()=>{e=!0,n?.off(`import.done`,apply),t.lintRulesChanged===apply&&delete t.lintRulesChanged}},[T,D,m]);let O=useTokenSimulation(T),k=useMinimap(T),A=r(e=>{_(t=>({...t,...e}))},[]);f(()=>{if(T)return wi(T,Y())},[T]);let j=r(async()=>{A({isConfigLoading:!0,configLoadFailed:!1});try{let e=await t.bpmn.getConfig();if(!e){A({isConfigLoading:!1,configLoadFailed:!0});return}let n=!!e.engine,r=Tt(e.engine),i=r?.family===`camunda-8`,a=r?.family===`camunda-7`,o=r?.key===`operaton`,s=r?.key===`cib-seven`,c=r?.key===`flowable`,l=r?.key===`activiti`,u=e.elementTemplates||[],d=e.elementTemplatesContent||[],f=Array.isArray(d)?d:[],p=[...u,...f];A({isCamunda8:!!i,isCamunda7:!!a,isOperaton:!!o,isCibSeven:!!s,isFlowable:c,isActiviti:l,lintSource:e.bpmnLint??null,installedTemplates:p,isEngineConfigured:n,isConfigLoading:!1,configLoadFailed:!1})}catch{A({isConfigLoading:!1,configLoadFailed:!0})}},[t,A]);f(()=>{j()},[j]);let M=l(()=>Lr({save:e=>t.bpmn.saveBpmnXml(e),onFailure:e=>{console.error(`Failed to save BPMN:`,e),Z.error(ar(e)?p(`app.editor.saveRefused`,{reason:e.message}):p(`app.editor.saveFailed`))}}),[t]);f(()=>t.bridge.onDocumentChanged?.(e=>{M.reloaded(e),v.current?v.current?.reloadXml(e).then(()=>A({xml:e,currentBpmnXml:e})).catch(e=>{console.error(`Failed to reload the diagram from its file:`,e),Z.error(p(`app.editor.reloadFailed`))}):(A({xml:e,currentBpmnXml:e}),H(e===``?_e():null))}),[A,M,t]);let[N,P]=n(null),I=r(e=>{P(null),A({xml:e,currentBpmnXml:e}),M.edited(e)},[A,M]),L=r(e=>{A({selectedElementId:e??void 0}),i.emit(`element.selected`,{id:e})},[A,i]),R=s(null),z=s(null);f(()=>()=>{z.current?.(),R.current?.dispose()},[]);let B=r(()=>{let e=v.current?.getModeler()??null;if(A({modeler:e}),!e)return;d?.attach(e);let n=window;z.current?.(),R.current?.dispose();let r=attachScriptTabs(e,o??t.bridge);R.current=r,z.current=o?.connect(r)??null,n.scriptTabsChanged=e=>r.setOpen(e),n.scriptSlotChanged=(e,t)=>r.applyHostWrite(e,t),n.pendingScriptTabs&&=(r.setOpen(n.pendingScriptTabs),void 0),n.revealElement=t=>{let n=revealElement(e,t);return n&&L(t),n},n.showDebugPosition=t=>{setPausedElements(t.current??[]),showDebugPosition(e,t)},n.clearDebugPosition=()=>{setPausedElements([]),clearDebugPosition(e)},n.pendingDebug&&=(showDebugPosition(e,n.pendingDebug),void 0),typeof n.pendingReveal==`string`&&(n.revealElement(n.pendingReveal),n.pendingReveal=void 0)},[A,L,d,t]);f(()=>()=>d?.detach(),[d]),f(()=>{let e=h.modeler;if(e)return t.bridge.onRevealElement?.(t=>{let n=revealElement(e,t);return n&&L(t),n})},[h.modeler,t,L]);let[V,H]=n(()=>e===``?_e():null),U=r(e=>{console.error(`Canvas import error:`,e),H(x(e))},[]),te=r(()=>{let e=Y().getBpmnFilePath();e&&Y().openAsText(e,V?.line??void 0)},[V]),W=r(e=>{console.error(`Canvas error:`,e),Z.error(p(`app.editor.loadFailed`,{message:e?.message??String(e)}))},[]),G=r(()=>O.state.isRunning?(Z.info(p(`app.editor.stopSimulation`)),!0):!1,[O.state.isRunning]),K=r(()=>{if(G())return;let e=Y();e.undo?e.undo().catch(e=>console.error(`Failed to undo:`,e)):v.current?.undo()},[G]),ne=r(()=>{if(G())return;let e=Y();e.redo?e.redo().catch(e=>console.error(`Failed to redo:`,e)):v.current?.redo()},[G]),re=r(()=>{G()||v.current?.copy()},[G]),ie=r(()=>{G()||v.current?.paste()},[G]),ae=r(()=>{G()||Mr(T)},[T,G]),oe=r(()=>Nr(T),[T]),se=r(()=>{if(T&&!G())try{let e=T.get(`selection`),t=T.get(`modeling`);if(!e||!t)return;let n=e.get();n.length>0&&t.removeElements(n)}catch(e){console.error(`Error deleting elements:`,e),Z.error(p(`app.editor.deleteFailed`))}},[T,G]),q=r(()=>{window.location.reload()},[]),ce=r(e=>{let t=window.appConfig;t&&(t.engine=e);let n=Tt(e);w(!0),A({isEngineConfigured:!0,isCamunda8:n?.family===`camunda-8`,isCamunda7:n?.family===`camunda-7`,isOperaton:n?.key===`operaton`,isCibSeven:n?.key===`cib-seven`,isFlowable:n?.key===`flowable`,isActiviti:n?.key===`activiti`})},[A]),[le,de]=n(ir.rendering()===`sketchy`),[fe,pe]=n(ir.commentBadges());f(()=>{(h.modeler?.get?.(`commentBadges`,!1))?.refresh?.()},[fe]);let[me,ge]=n(ir.codeBadges());f(()=>{(h.modeler?.get?.(`codeBadges`,!1))?.refresh?.()},[me]);let ve=useTour(h.modeler!==null),ye=Ur({ready:h.modeler!==null,suspended:ve.open}),be=qr(y.toggle),xe=useOpenCommentCount(T);f(()=>(en(openCommentsTab({select:y.select,reveal:e=>{T&&revealElement(T,e)}})),()=>en(()=>void 0)),[y.select,T]);let Se=r(async()=>{try{let e=await v.current?.exportXml();e&&A({currentBpmnXml:e,isExportDialogOpen:!0})}catch(e){console.error(`Error opening export dialog:`,e),Z.error(p(`app.editor.exportOpenFailed`))}},[A]),Ce=r(async()=>{try{let e=await v.current?.exportXml();e&&await Kr(`bpmn`,e,Y().getBpmnFilePath())}catch(e){Z.error(p(`app.share.couldNotShareThisDiagram`,{failure:e instanceof Error?e.message:String(e)}))}},[]),[we,Te]=n(null),Ee=r(async()=>{try{Te(await importFromHost(Y()))}catch(e){Z.error(p(`app.editor.importFailed`,{message:e instanceof Error?e.message:String(e)}))}},[]),De=r(()=>{A({isExportDialogOpen:!1})},[A]),Oe=y.state.tab===`problems`&&!y.state.hidden,ke=y.state.tab===`monitor`&&!y.state.hidden,Ae=y.state.tab===`debug`&&!y.state.hidden,je=Oe||h.isDiagramCheckOpen,Me=h.isDiagramCheckOpen&&!Oe,Ne=r(()=>{h.isMigrationOpen&&Oe?A({isMigrationOpen:!1}):(y.select(`problems`),_(e=>({...e,isMigrationOpen:!0,isCoverageOpen:!1})))},[h.isMigrationOpen,Oe,y.select,A]),Pe=r(()=>{h.isDiagramCheckOpen||Oe?(A({isDiagramCheckOpen:!1,isMigrationOpen:!1}),Oe&&y.select(`properties`)):_(e=>({...e,isDiagramCheckOpen:!0,isCoverageOpen:!1}))},[h.isDiagramCheckOpen,Oe,y.select,A]),Fe=r(()=>{A({isDiagramCheckOpen:!1})},[A]),Ie=r(()=>{_(e=>({...e,isCoverageOpen:!e.isCoverageOpen,isDiagramCheckOpen:!1,isRunsOpen:!1}))},[]),J=r(()=>y.select(`scenarios`),[y.select]);f(()=>a?qi(a,J):void 0,[a,J]),f(()=>{if(!m)return;let e=window;return e.openScenarios=J,e.pendingScenarios&&(e.pendingScenarios=void 0,J()),()=>{e.openScenarios===J&&(e.openScenarios=void 0)}},[J,m]);let Le=r(()=>y.select(`problems`),[y.select]),Re=r(()=>y.select(ke?`properties`:`monitor`),[ke,y.select]),ze=r(()=>y.select(Ae?`properties`:`debug`),[Ae,y.select]),Be=r(()=>{A({isRunsOpen:!1})},[A]),Ve=r(()=>{A({isCoverageOpen:!1})},[A]),[He,Ue]=n(null),We=r(()=>Ue(null),[]),Ge=r(e=>{y.select(`properties`);let t=entriesFor(e);t.length>0&&Ue(t)},[y.select]),Ke=useProject(h.xml);useSuggestionProvider(Ke?.suggestions??null);let qe=Ke?.coverage??null;f(()=>xn(Ke?.targets??[]),[Ke]);let Je=r(()=>v.current?.getModeler()??null,[]),Ye=r(async(e,t)=>{try{await Y().navigateToClass(e,t)||Z.error(p(`app.editor.noMatch`,{reference:e}))}catch{Z.error(p(`app.editor.noMatch`,{reference:e}))}},[]),Xe=r(e=>Ke?elementInsight(Ke,e):null,[Ke]),Ze=s(null),Qe=or(t.bridge,`ideTests`),$e=r(async(e,t)=>{let n=Xe(e);if(!n||n.tests.length===0){if(await explainedCodeLinks(()=>{Ze.current={kind:`tests`,elementId:e,debug:t}}))return;Z.info(p(`app.editor.noTest`,{name:n?.title??e}))}else try{await Y().runTestHandles(n.tests.map(e=>e.handle),n.title,t)}catch(e){Z.error(e instanceof Error?e.message:String(e))}},[Xe]),et=r(async e=>{let t=Xe(e),n=t?[...t.implementations,...t.tests,...t.usages]:[];if(!t||n.length===0){if(await explainedCodeLinks(()=>{Ze.current={kind:`usages`,elementId:e,debug:!1}}))return;Z.info(p(`app.editor.noUsage`,{name:t?.title??e}))}else try{await Y().openCode(n.map(e=>e.handle),t.title,!0)}catch(e){Z.error(e instanceof Error?e.message:String(e))}},[Xe]),tt=r(async e=>{let t=Xe(e);if(t&&t.implementations.length!==0)try{await Y().openCode(t.implementations.map(e=>e.handle),t.title)}catch(e){Z.error(e instanceof Error?e.message:String(e))}},[Xe]),nt=r(async e=>{let t=Xe(e);if(!t||t.implementations.length===0){if(await explainedCodeLinks(()=>{Ze.current={kind:`worker`,elementId:e,debug:!1}}))return;Z.info(p(`app.editor.noWorker`,{name:t?.title??e}))}else try{await Y().openCode(t.implementations.map(e=>e.handle),t.title)}catch(e){Z.error(e instanceof Error?e.message:String(e))}},[Xe]);f(()=>{let e=Ze.current;e&&(Ze.current=null,S.refresh(),e.kind===`worker`?nt(e.elementId):e.kind===`usages`?et(e.elementId):$e(e.elementId,e.debug))});let rt=r(()=>v.current?.getModeler()?executableProcessIdsOf(v.current.getModeler()):[],[]),[it,ot]=n(!1),st=useLive(ke||it,rt),ct=useLiveTrial(st,T,h.selectedElementId,ke);useLiveBadges(T,st,ke);let lt=window.appConfig?.bpmnFilePath??null,ut=r(async()=>await v.current?.exportXml()??h.currentBpmnXml??void 0,[h.currentBpmnXml]),dt=useProcessDebug({active:Ae,modeler:T,selectedElementId:h.selectedElementId,diagramPath:lt,exportXml:ut}),ft=y.state.tab===`scenarios`&&!y.state.hidden,pt=useRuns(h.isRunsOpen||ft,lt,ut,T!==null),mt=l(()=>{if(pt.cases.length===0||pt.results.size===0)return;let e=0;for(let t of pt.results.values())t.outcome===`passed`&&(e+=1);return{passed:e,all:pt.cases.length}},[pt.cases,pt.results]),ht=l(()=>{if(!st.state)return;let e=0;for(let t of st.state.processes)for(let n of t.elements.values())e+=n.waiting;return e>0?e:void 0},[st.state]),gt=useTimeline({open:it,setOpen:ot,live:st,trial:ct,runs:pt,modeler:T,selectedElementId:h.selectedElementId});f(()=>Y().onRunTrace?.(e=>{J(),pt.openTrace(e).catch(e=>{console.error(`Failed to read the trace of a run:`,e),Z.error(p(`app.editor.traceFailed`))})}),[J,pt.openTrace]);let[_t,vt]=n(null),yt=r(()=>vt(null),[]),bt=r(async()=>{let e=h.selectedElementId,t=await ut(),n=e&&t?await jt(t):null;if(!e||!n)return;let r=he(n,{element:e});`problem`in r?Z.error(r.problem):(J(),pt.runAdHoc(r.testCase))},[h.selectedElementId,ut,J,pt.runAdHoc]),xt=pt.select;f(()=>{h.isRunsOpen&&xt(h.selectedElementId??null)},[h.isRunsOpen,h.selectedElementId,xt]);let St=pt.running;f(()=>{St&&_(e=>e.isRunsOpen?e:{...e,isRunsOpen:!0,isCoverageOpen:!1})},[St]);let Ct=h.isMigrationOpen&&je&&h.isCamunda7,wt=useMigration(Ct,Je,ut),Et=s(null);f(()=>{let e=new AbortController;return Et.current=e,()=>{e.abort(),Et.current===e&&(Et.current=null)}},[]);let Dt=r(async()=>{try{await convertOpenDiagram({path:lt,xml:await ut()},Et.current?.signal)}catch(e){Z.error(e instanceof Error?e.message:String(e))}},[lt,ut]);useCodeBridge({project:Ke,active:m,installedTemplates:h.installedTemplates});let Ot=S.flags.flow,kt=S.flags.code,At=l(()=>insightOf(Ke,T?.getDefinitions?.(),kt),[Ke,T,kt]),Mt=r(e=>T?factsOf(T,e,At,Ke,st):[],[T,At,Ke,st]),Nt=r(e=>(Xe(e)?.implementations.length??0)>0,[Xe]),Pt=l(()=>({hasProject:Ke!==null,licensed:kt,nameOf:e=>T?.get(`elementRegistry`).get(e)?.businessObject?.name?.trim()||e,found:e=>Xe(e),clientFacts:Ke?.clientFacts,entry:e=>At.find(t=>t.elementId===e),openLink:async(e,t)=>{try{await Y().openCode([e.handle],t)}catch(e){Z.error(e instanceof Error?e.message:String(e))}},openImplementation:e=>void nt(e),findUsages:e=>void et(e),runTests:Qe?(e,t)=>void $e(e,t):void 0}),[Ke,T,Xe,At,nt,et,$e,Qe]),Ft=h.isCamunda8?`camunda-8`:h.isCamunda7?`camunda-7`:null,It=l(()=>[...kt&&T&&Ke?[...findingsOf(T,At),...templateFindings(T,Ke.model,Ke.contracts,h.installedTemplates)]:findingsOf(T,At),...templateRejectionFindings(T,h.installedTemplates,Ft)],[kt,T,Ke,At,h.installedTemplates,Ft]),Lt=r(async()=>{if(T)try{if(!await Y().confirmWithUser({title:p(`app.editor.convertTitle`),text:p(`app.editor.convertText`),accept:p(`app.editor.convert`),decline:p(`app.common.cancel`),warning:!1}))return;let{xml:e}=await T.saveXML({format:!0}),t=toOperaton(e);await T.importXML(t),await Y().saveBpmnXml(t)}catch(e){Z.error(e instanceof Error?e.message:String(e))}},[T]),Rt=l(()=>{if(!T)return null;let e=h.xml;return h.isOperaton&&e&&e.includes(`xmlns:camunda="http://camunda.org/schema/1.0/bpmn"`)?{title:p(`app.editor.namespaceTitle`),message:p(`app.editor.namespaceMessage`),fix:Lt}:null},[T,h.isOperaton,h.xml,Lt]),zt=r(()=>{A({isMarketplaceOpen:!0})},[A]),Bt=r(()=>{A({isMarketplaceOpen:!1})},[A]);f(()=>{if(!T)return;let e=T.get(`eventBus`),apply=()=>{applyCachedTemplates(T,e=>Z.error(e)).catch(e=>console.error(`Failed to load the cached connector templates:`,e))};return apply(),e.on(`import.done`,apply),()=>e.off(`import.done`,apply)},[T]);let Vt=r(async(e,n)=>{try{let e=await t.bpmn.getConfig(),r=e?.elementTemplates||[],i=e?.elementTemplatesContent||[],a=[...r,...Array.isArray(i)?i:[]];if(h.modeler)try{let t=JSON.parse(n),r=h.modeler.get(`elementTemplates`);if(r&&typeof r.set==`function`){let n=ca(i),a=Array.isArray(t)?t:[t],o=On([...n,...a],Tt(e?.engine)?.family??null).loadable,s=h.modeler.get(`elementTemplatesLoader`,!1);s?.setTemplates?s.setTemplates([...o,...cachedTemplatesOf(h.modeler)]):r.set([...o,...cachedTemplatesOf(h.modeler)])}}catch(e){console.error(`[App] Failed to apply template to modeler:`,e)}A({installedTemplates:a})}catch(e){console.error(`Failed to refresh installed templates:`,e)}},[t,A,h.modeler]),Ht=r(async e=>{try{let{format:t,svg:n,theme:r,useBackground:i}=e;if(!n)return;t===`SVG`?await exportAsSvg(n,i,r):t===`PNG`?await exportAsPng(n,i,r):t===`PDF`&&await exportAsPdf(n,i,r),Z.success(p(`app.editor.exported`,{format:t}))}catch(e){console.error(`Export failed:`,e),Z.error(p(`app.editor.exportFailed`,{message:e instanceof Error?e.message:p(`app.editor.unknownError`)}))}},[]),exportAsSvg=async(e,n,r)=>{let i=e;n&&(i=addBackgroundToSvg(e,getThemeBackgroundColor(r))),await t.file.exportSvg(i)},exportAsPng=async(e,n,r)=>{let i=e;n&&(i=addBackgroundToSvg(e,getThemeBackgroundColor(r)));let a=await convertSvgToPng(i,n?getThemeBackgroundColor(r):`transparent`),o=await(await fetch(a)).blob();await t.file.exportPng(o)},exportAsPdf=async(e,n,r)=>{let i=e;n&&(i=addBackgroundToSvg(e,getThemeBackgroundColor(r)));let a=await convertSvgToPng(i,n?getThemeBackgroundColor(r):`#ffffff`,Nu),o=(i.match(/viewBox="([^"]+)"/)?.[1]||`0 0 800 600`).split(` `).map(Number),s=await createPdfFromPages([{name:`BPMN Diagram`,png:a,width:o[2]??800,height:o[3]??600}]),c=await(await fetch(s)).blob();await t.file.exportPdf(c)},Ut=r(()=>{O.isSupported?O.state.isRunning?O.controls.stop():O.controls.play():console.warn(`Token simulation is not supported`)},[O]),Wt=r(()=>{k.toggle()},[k]),Gt=r(async e=>{try{let t=await copyPicture(e,{backgroundOf:getThemeBackgroundColor,withBackground:addBackgroundToSvg,toPng:convertSvgToPng,save:e=>Y().saveClipboardImage(e)});return Z.info(p(t?`app.editor.copiedImage`:`app.editor.copyImageFailed`)),t}catch(e){return console.error(`Failed to copy the diagram as an image:`,e),Z.info(p(`app.editor.copyImageFailed`)),!1}},[]),[Kt,qt]=n(!1),Jt=r(()=>{let e=h.modeler?.get(`transactionBoundaries`,!1);e&&qt(e.toggle())},[h.modeler]),Yt=r((e,t)=>ai(e,t,ci),[]),Xt=r(ri,[]),Zt=Fr({viewer:T,origin:h.selectedElementId,traceable:Yt,read:Xt,paint:ui,supportsMessages:!0});f(()=>(pn(e=>{let t=(T?.get?.(`elementRegistry`,!1))?.get?.(e.id);t&&(T?.get?.(`selection`,!1)?.select?.(t),e.id&&Zt.traceFrom(e.id))}),()=>pn(()=>void 0)),[T,Zt.traceFrom]);let Qt=r(()=>{S.unlock(g.FLOW_ANALYSIS)},[S.unlock]),[$t,tn]=n(null),nn=r(()=>tn(null),[]);f(()=>{let e=T?.get(`eventBus`,!1);if($t&&e)return watchNextEdit(e,nn)},[$t,T,nn]);let rn=r(async()=>{if(!G())try{let e=v.current?.getModeler();if(!e||!await S.unlock(g.AUTO_LAYOUT))return;let t=await layOut(e,e=>Au.applyLayout(e));if(!t.ok){console.error(`Auto-layout error:`,t.error),Z.error(t.error?.message||p(`app.editor.layoutFailed`));return}tn({count:t.count})}catch(e){console.error(`Auto-layout error:`,e),Z.error(p(`app.editor.layoutFailed`))}},[G,S.unlock]),an=r(async()=>{let e=v.current,t=e?.getModeler();e&&t&&P(await openDrawnFile(e,t,Y(),e=>Au.applyLayout(e)))},[]),X=useDiagramCheck({enabled:!!T,getModeler:Je,flowUnlocked:Ot,onUnlockFlow:Qt,loadRules:D,codeFindings:It,namespaceFinding:Rt,migration:Ct?{...wt,onConvert:Dt,target:`8.8`}:null,onReveal:Ge}),on=zr((window.appConfig?.bpmnFilePath??`process.bpmn`).split(/[\\/]/).pop()??`process.bpmn`,async()=>await v.current?.exportXml()??h.currentBpmnXml??void 0),sn=l(()=>!!T&&!!reachOf(qe,processIdsOf$1(T)),[qe,T,h.xml]),cn=h.isEngineConfigured||C,ln=st.engine?.profile??on.targets?.active??null,un=st.engine?.url??on.targets?.targets?.find(e=>(e.profile??null)===ln)?.url??null,dn=st.engine?.kind??on.targets?.targets?.find(e=>(e.profile??null)===ln)?.engine??null,mn=ue(dn,un),hn={camunda7:h.isCamunda7,camunda8:h.isCamunda8,convertible:h.isCamunda7&&!h.isOperaton,drawn:h.modeler!==null,breakpointable:dt.canToggle,coverageShown:sn,open:{check:h.isDiagramCheckOpen||Oe,simulation:O.state.isRunning,coverage:h.isCoverageOpen,monitor:ke,timeline:it,debug:Ae,scenarios:ft,migration:h.isMigrationOpen&&Oe,sidebar:!y.state.hidden,minimap:k.state.isOpen,boundaries:Kt,sketchy:le,commentBadges:fe,codeBadges:me,trace:Zt.tracing,traceable:Zt.traceable},deploy:Yr(on),chat:b,commands:{chat:()=>y.pressTab(Ui.id),undo:K,redo:ne,autoLayout:rn,openProblems:Pe,toggleSimulation:Ut,toggleCoverage:Ie,openMonitor:Re,toggleTimeline:gt.toggle,openDebug:ze,toggleBreakpoint:dt.toggleSelected,openScenarios:J,toggleMigration:Ne,convertToOperaton:Lt,toggleSidebar:be,focusCanvas:aa,fit:()=>v.current?.fitToScreen(),zoomIn:()=>v.current?.zoomIn(),zoomOut:()=>v.current?.zoomOut(),toggleBoundaries:Jt,toggleMinimap:Wt,toggleTrace:Zt.toggle,copy:re,paste:ie,exportDialog:Se,importDiagram:Ee,share:Ce,templates:zt,toggleSketchy:()=>{let e=le?`default`:`sketchy`;ir.setRendering(e),de(!le),h.modeler?.get?.(`sketchyRendering`,!1)?.set(e)},toggleCommentBadges:()=>{ir.setCommentBadges(!fe),pe(!fe)},toggleCodeBadges:()=>{ir.setCodeBadges(!me),ge(!me)},tour:ve.show,compareWithHead:or(t.bridge,`compare`)&&t.bridge.openComparison?()=>{let e=t.bridge.getBpmnFilePath();e&&t.bridge.openComparison?.(e)}:void 0,showLicence:t.bridge.showLicence?()=>void t.bridge.showLicence?.():void 0,chooseTheme:or(t.bridge,`editorTheme`)?F:void 0,openTasklist:mn?()=>{Y().openExternalLink(mn)}:void 0,testTask:(h.isCamunda7||h.isCamunda8)&&lt&&h.selectedElementId?()=>{bt()}:void 0,startInstance:st.engine?()=>{y.select(`monitor`),window.dispatchEvent(new CustomEvent(`penstock:start-instance`))}:void 0}},_n=Xr(ee,hn),vn=Hr(_n);f(()=>{let handler=()=>v.current?.getModeler()?.get(`diagramTheme`,!1)?.refresh();return window.addEventListener(`bpmn-theme-changed`,handler),()=>window.removeEventListener(`bpmn-theme-changed`,handler)},[]);let yn=r(e=>{let t=e.closest(`.resource-editor`)?.querySelector(`#js-properties-panel`);return In({container:e,propertiesPanelContainer:t??`#js-properties-panel`})},[]);f(()=>{let e=T?.get?.(`eventBus`,!1),write=()=>paintPill(pillOf(T?.get?.(`canvas`,!1)?.getContainer?.()),X.counts,X.rulesFailure);return e?.on(`linting.completed`,write),write(),()=>e?.off(`linting.completed`,write)},[T,X.counts.errors,X.counts.warnings,X.counts.readability,X.rulesFailure]);let Sn=s(Pe);Sn.current=Pe,f(()=>{let e=T?.get?.(`canvas`,!1)?.getContainer?.();if(!e)return;let press=e=>{e.target instanceof Element&&e.target.closest(`.bjsl-button`)&&(e.stopPropagation(),Sn.current())};return e.addEventListener(`click`,press,!0),()=>e.removeEventListener(`click`,press,!0)},[T]),f(()=>{pillOf(T?.get?.(`canvas`,!1)?.getContainer?.())?.setAttribute(`aria-expanded`,String(Me))},[T,Me]);let wn=Me?{title:p(`app.editor.checkTitle`),tally:X.checked>0?gn(X.counts,X.rulesFailure):p(`app.problems.waiting`),isError:X.counts.errors>0,clean:X.checked>0&&!X.rulesFailure&&X.counts.errors+X.counts.warnings+X.counts.readability===0?p(`app.diagramCheck.nothingToReportAcrossElements`,{checked:X.checked}):void 0,findings:X.card.rows.map(e=>({title:e.title,detail:e.where,severity:e.severity})),moreCount:X.card.more,onRecheck:X.run,onClose:Fe,onShowAll:Le,onPick:e=>X.pickSummary(X.card.rows[e],`card-${e}`)}:void 0,Tn=Zt.tracing&&Zt.reading?{label:Zt.reading.label,before:Zt.reading.before,after:Zt.reading.after,followMessages:Zt.followMessages,showMessages:Zt.supportsMessages,onFollowMessages:Zt.setFollowMessages,onClose:Zt.close}:void 0,En=cn?u(`div`,{class:`bpmn-editor__stage`,children:[u(qn,{ref:v,xml:h.xml,onXmlChange:I,onElementSelect:L,onReady:B,onError:W,onImportError:U,modelerFactory:yn,onDrawnWithoutLayout:an,onReload:q,onUndo:K,onRedo:ne,onCopy:re,onPaste:ie,onDelete:se,onExport:Se,onAutoLayout:rn,onToggleTokenSimulation:Ut,onToggleMinimap:Wt,onTogglePropertiesPanel:be,onNavigateToClass:Ye,onFindCodeUsages:et,onRunTests:Qe?$e:void 0,onOpenImplementation:tt,factsOf:Mt,hasImplementation:Nt}),$t&&u(LayoutBar,{count:$t.count,onUndo:K,onClose:nn}),T&&u(GhostEdits,{modeler:T,source:d?.feed,onComment:d?.onComment}),T&&u(NextBlockSuggestions,{modeler:T}),u(Tour,{open:ve.open,onClose:ve.close,profiles:on.targets?.targets.length??1}),u(ImportReportDialog,{outcome:we,onClose:()=>{let e=we;Te(null),openImported(Y(),e)}}),u(CoveragePanel,{isOpen:h.isCoverageOpen,onClose:Ve,getModeler:Je,coverage:qe})]}):u(`div`,{class:`bpmn-editor__stage`,children:u(EngineQuestion,{apiClient:t,onChosen:ce})});return h.isConfigLoading?u(ThemeProvider,{children:u(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100vh`},children:p(`app.editor.loading`)})}):h.configLoadFailed?u(ThemeProvider,{children:u(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,height:`100vh`,gap:`16px`},children:[u(`div`,{children:p(`app.editor.configFailed`)}),u(`button`,{onClick:j,children:p(`app.common.retry`)})]})}):V?u(ThemeProvider,{children:u(`div`,{class:`resource-editor bpmn-editor`,children:u(Wr,{problem:V,onOpenText:te,onReload:q})})}):u(ThemeProvider,{children:u(ScenariosProvider,{file:a??null,runs:pt,getModeler:Je,feelByDefault:!h.isCamunda7&&!h.isFlowable&&!h.isActiviti,enabled:h.isCamunda7||h.isCamunda8,sidebar:{visible:!y.state.hidden,width:y.width,covered:y.drawer&&!y.state.collapsed?y.width:0},onOpenWorker:nt,onNavigate:Ye,onRunWithInput:lt?()=>vt(`input`):void 0,onOpenRun:()=>vt(`open`),children:u(dl,{value:{selectedElementId:h.selectedElementId,modeler:T,check:X,live:st,trial:ct,debug:dt,timeline:gt,onConnectEngine:()=>on.edit(on.targets?.active??null),monitor:{hasImplementation:Nt,onOpenImplementation:tt,onConnect:()=>on.edit(on.targets?.active??null)},code:Pt,clientFacts:Ke?.clientFacts,reveal:{entries:He,onRevealed:We}},children:u(Rr,{className:`bpmn-editor`,toolbarItems:vn,tabs:fl,sidebar:y,edit:{undo:K,redo:ne,cut:ae,copy:re,paste:ie,selectAll:oe},badges:{problems:X.checked>0&&X.counts.errors+X.counts.warnings||void 0,comments:xe||void 0},notice:N?{text:p(N===`laid-out`?`app.editor.noLayout.laidOut`:`app.editor.noLayout.placed`),action:N===`placed`?{label:p(`app.actions.auto-layout.title`),run:()=>{P(null),rn()}}:void 0,dismiss:()=>P(null)}:ye,check:wn,statusShown:Oe,trace:Tn,timeline:u(TimelineSlot,{}),assistant:c,counts:{scenarios:mt,waiting:ht},deploy:{deploy:on,engine:h.isOperaton?`operaton`:h.isCibSeven?`cib-seven`:h.isCamunda8?`camunda-8`:`camunda-7`},shortcuts:{editor:`bpmn`,mode:`canvas`,actions:_n},children:[En,u(CodeBridgeLayer,{}),u(RunsPanel,{isOpen:h.isRunsOpen,runs:pt,getModeler:Je,onClose:Be,onRunWithInput:lt?()=>vt(`input`):void 0,onOpenRun:()=>vt(`open`),onSaveAdHoc:()=>vt(`save`)}),u(ExportDialog,{isOpen:h.isExportDialogOpen,onClose:De,onExport:Ht,onCopy:Gt,bpmnXml:h.currentBpmnXml,apiClient:t,isCamunda8:h.isCamunda8,isCamunda7:h.isCamunda7}),_t===`input`&&lt&&u(RunDialog,{diagramPath:lt,xml:ut,onClose:yt,onRun:e=>{vt(null),pt.runAdHoc(e)}}),_t===`save`&&pt.adHoc&&u(SaveRunDialog,{run:pt.adHoc,file:pt.file,onClose:yt,onSave:pt.save}),_t===`open`&&u(OpenRunDialog,{onClose:yt,onOpen:pt.openInstance}),u(TemplatesMarketplace,{isOpen:h.isMarketplaceOpen,onClose:Bt,apiClient:t,installedTemplates:h.installedTemplates,engineVersion:h.isMarketplaceOpen?engineVersionOf(h.modeler):null,onTemplateInstalled:Vt})]})})})})}var SimpleEventBus=class{listeners=new Map;on(e,t){return this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t),()=>this.off(e,t)}once(e,t){let wrappedHandler=async n=>{await t(n),this.off(e,wrappedHandler)};return this.on(e,wrappedHandler)}off(e,t){let n=this.listeners.get(e);if(n){let e=n.indexOf(t);e>-1&&n.splice(e,1)}}emit(e,t){let n=this.listeners.get(e);n&&n.forEach(n=>{try{n(t)}catch(t){console.error(`Error in event handler for ${e}:`,t)}})}clear(){this.listeners.clear()}};function BpmnDocument({handle:e}){let t=l(()=>new ii(Jr(Y(),e)),[e]),n=l(()=>new SimpleEventBus,[]),r=s(e.initialText);return u(App,{initialXml:r.current,apiClient:t,eventBus:n,file:e.rel,scriptHost:e.scriptTabs})}export{segmentCuts as A,BpmnDocument,projectOnSegment as C,rectUnion as D,rectStraddles as E,rectsOverlap as O,pathLength as S,rectEncloses as T,dropBacktracks as _,isBoundaryEvent as a,isOrthogonal as b,isMessageFlow as c,jogsIn as d,mergesWith as f,crossesAt as g,countCuts as h,findDuplicateConnections as i,withinRect as j,segmentCrossesBox as k,poolOf$1 as l,axisRun as m,Za as n,isConnection as o,runsOf as p,$a as r,isLabelLike as s,Qa as t,backtracksIn as u,dropRepeats as v,rectClears as w,pathCrossings as x,grazesBox as y};