dirigent-server 0.18.2__tar.gz → 0.18.3__tar.gz

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 (192) hide show
  1. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/PKG-INFO +5 -5
  2. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/pyproject.toml +5 -5
  3. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/pyproject.toml.orig +5 -5
  4. dirigent_server-0.18.2/src/dirigent_server/static/assets/AdminOnly-922QAPCr.js → dirigent_server-0.18.3/src/dirigent_server/static/assets/AdminOnly-CWzFAkRQ.js +1 -1
  5. dirigent_server-0.18.3/src/dirigent_server/static/assets/Alerting-nJ3zywCX.js +1 -0
  6. dirigent_server-0.18.3/src/dirigent_server/static/assets/Blocks-563Qyei5.js +1 -0
  7. dirigent_server-0.18.3/src/dirigent_server/static/assets/Connections-CemBNXn9.js +1 -0
  8. dirigent_server-0.18.3/src/dirigent_server/static/assets/Dashboard-ClXFOnm7.js +1 -0
  9. dirigent_server-0.18.2/src/dirigent_server/static/assets/ExamplePanel-CRFoKDQb.js → dirigent_server-0.18.3/src/dirigent_server/static/assets/ExamplePanel-DKQkiihz.js +1 -1
  10. dirigent_server-0.18.3/src/dirigent_server/static/assets/Examples-CpROEbSh.js +2 -0
  11. dirigent_server-0.18.2/src/dirigent_server/static/assets/JsonBlock-CkieF-4k.js → dirigent_server-0.18.3/src/dirigent_server/static/assets/JsonBlock-pzVtgv_p.js +1 -1
  12. dirigent_server-0.18.3/src/dirigent_server/static/assets/ListTable-Bf1eJYg4.js +1 -0
  13. dirigent_server-0.18.3/src/dirigent_server/static/assets/Overview-MqKejuFN.js +1 -0
  14. dirigent_server-0.18.2/src/dirigent_server/static/assets/PageState-CGVhOaOE.js → dirigent_server-0.18.3/src/dirigent_server/static/assets/PageState-BLuobMye.js +1 -1
  15. dirigent_server-0.18.3/src/dirigent_server/static/assets/Picker-DtmGXJxI.js +1 -0
  16. dirigent_server-0.18.3/src/dirigent_server/static/assets/PipelineEditor-qABxnDPq.js +2 -0
  17. dirigent_server-0.18.2/src/dirigent_server/static/assets/PipelineGraph-BuxdVBP6.js → dirigent_server-0.18.3/src/dirigent_server/static/assets/PipelineGraph-B3WZx-gR.js +1 -1
  18. dirigent_server-0.18.2/src/dirigent_server/static/assets/PipelinePreview-HADZRm5L.js → dirigent_server-0.18.3/src/dirigent_server/static/assets/PipelinePreview-Dx5PHeHj.js +1 -1
  19. dirigent_server-0.18.2/src/dirigent_server/static/assets/PipelineTab-Bhm8M_NG.js → dirigent_server-0.18.3/src/dirigent_server/static/assets/PipelineTab-ZN5ffD11.js +1 -1
  20. dirigent_server-0.18.2/src/dirigent_server/static/assets/Refusal-uzV5VL19.js → dirigent_server-0.18.3/src/dirigent_server/static/assets/Refusal-BWl1-jC1.js +1 -1
  21. dirigent_server-0.18.3/src/dirigent_server/static/assets/RunDetail-BuyAvO8p.js +3 -0
  22. dirigent_server-0.18.2/src/dirigent_server/static/assets/RunGraph-Bj8VAXbe.js → dirigent_server-0.18.3/src/dirigent_server/static/assets/RunGraph-DIT8xoN7.js +1 -1
  23. dirigent_server-0.18.3/src/dirigent_server/static/assets/SchemaForm-jWG6iOB3.js +1 -0
  24. dirigent_server-0.18.3/src/dirigent_server/static/assets/Schemas-DlqBZf9z.js +10 -0
  25. dirigent_server-0.18.3/src/dirigent_server/static/assets/SettingsDialog-CLU-oX36.js +1 -0
  26. dirigent_server-0.18.3/src/dirigent_server/static/assets/StarterPicker-7qIa398g.js +1 -0
  27. dirigent_server-0.18.3/src/dirigent_server/static/assets/StepPorts-Du1E90r1.js +7 -0
  28. dirigent_server-0.18.3/src/dirigent_server/static/assets/TileCard-D2tNIrMn.js +1 -0
  29. dirigent_server-0.18.3/src/dirigent_server/static/assets/Triggers-DW5RpE2Q.js +1 -0
  30. dirigent_server-0.18.3/src/dirigent_server/static/assets/Users-D-mDeTAh.js +1 -0
  31. dirigent_server-0.18.2/src/dirigent_server/static/assets/WindowedPane-CZpOBqK6.js → dirigent_server-0.18.3/src/dirigent_server/static/assets/WindowedPane-dMHnDqVB.js +1 -1
  32. dirigent_server-0.18.3/src/dirigent_server/static/assets/Workers-BHh_jWW5.js +1 -0
  33. dirigent_server-0.18.2/src/dirigent_server/static/assets/WorkersTable-CBWZYznS.js → dirigent_server-0.18.3/src/dirigent_server/static/assets/WorkersTable-C3cil-lW.js +1 -1
  34. dirigent_server-0.18.3/src/dirigent_server/static/assets/elk-engine-Bm7I_NRI.js +1 -0
  35. dirigent_server-0.18.3/src/dirigent_server/static/assets/elk-worker.min-DfmSo98M.js +22 -0
  36. dirigent_server-0.18.3/src/dirigent_server/static/assets/glyphs-C1sjljkh.js +1 -0
  37. dirigent_server-0.18.3/src/dirigent_server/static/assets/idle-DnO3aHK7.js +1 -0
  38. dirigent_server-0.18.3/src/dirigent_server/static/assets/index-C3S0GbYv.js +53 -0
  39. dirigent_server-0.18.3/src/dirigent_server/static/assets/index-DfjqILVM.css +2 -0
  40. dirigent_server-0.18.2/src/dirigent_server/static/assets/select-C9VBesB_.js → dirigent_server-0.18.3/src/dirigent_server/static/assets/select-BHa3vRob.js +1 -1
  41. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/index.html +6 -4
  42. dirigent_server-0.18.2/src/dirigent_server/static/assets/Alerting-CcBb0wRa.js +0 -1
  43. dirigent_server-0.18.2/src/dirigent_server/static/assets/Blocks-NviC0OXF.js +0 -1
  44. dirigent_server-0.18.2/src/dirigent_server/static/assets/Connections-BgdtNffu.js +0 -1
  45. dirigent_server-0.18.2/src/dirigent_server/static/assets/Dashboard-BN57Qzdj.js +0 -1
  46. dirigent_server-0.18.2/src/dirigent_server/static/assets/Examples-m_jw_Dn6.js +0 -2
  47. dirigent_server-0.18.2/src/dirigent_server/static/assets/ListTable-BykeouTl.js +0 -1
  48. dirigent_server-0.18.2/src/dirigent_server/static/assets/Overview-Dhpg9hCZ.js +0 -1
  49. dirigent_server-0.18.2/src/dirigent_server/static/assets/Picker-9y5l9djZ.js +0 -1
  50. dirigent_server-0.18.2/src/dirigent_server/static/assets/PipelineEditor-C1-I6Bej.js +0 -2
  51. dirigent_server-0.18.2/src/dirigent_server/static/assets/RunDetail-SL6w9BZ1.js +0 -3
  52. dirigent_server-0.18.2/src/dirigent_server/static/assets/SchemaForm-C-Wc8YiX.js +0 -1
  53. dirigent_server-0.18.2/src/dirigent_server/static/assets/Schemas-COYqGVZM.js +0 -10
  54. dirigent_server-0.18.2/src/dirigent_server/static/assets/SettingsDialog-BDKhHaNj.js +0 -1
  55. dirigent_server-0.18.2/src/dirigent_server/static/assets/StarterPicker-Be7o1w9Q.js +0 -1
  56. dirigent_server-0.18.2/src/dirigent_server/static/assets/StepPorts-KFpmX5hF.js +0 -30
  57. dirigent_server-0.18.2/src/dirigent_server/static/assets/TileCard-CkZS_VSw.js +0 -1
  58. dirigent_server-0.18.2/src/dirigent_server/static/assets/Triggers-CwtRten7.js +0 -1
  59. dirigent_server-0.18.2/src/dirigent_server/static/assets/Users-DL4AzW5v.js +0 -1
  60. dirigent_server-0.18.2/src/dirigent_server/static/assets/Workers-2_dwra03.js +0 -1
  61. dirigent_server-0.18.2/src/dirigent_server/static/assets/index-BDhFNSYw.css +0 -2
  62. dirigent_server-0.18.2/src/dirigent_server/static/assets/index-MYZXi-9R.js +0 -53
  63. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/LICENSE +0 -0
  64. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/README.md +0 -0
  65. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/THIRD_PARTY_NOTICES.md +0 -0
  66. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/__init__.py +0 -0
  67. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/app.py +0 -0
  68. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/dependencies.py +0 -0
  69. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/errors.py +0 -0
  70. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/health.py +0 -0
  71. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/logging.py +0 -0
  72. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/messages.py +0 -0
  73. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/pagination.py +0 -0
  74. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/py.typed +0 -0
  75. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/routes/__init__.py +0 -0
  76. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/routes/alerts.py +0 -0
  77. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/routes/auth.py +0 -0
  78. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/routes/blocks.py +0 -0
  79. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/routes/connections.py +0 -0
  80. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/routes/examples.py +0 -0
  81. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/routes/hooks.py +0 -0
  82. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/routes/pipelines.py +0 -0
  83. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/routes/runs.py +0 -0
  84. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/routes/schema.py +0 -0
  85. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/routes/schemas.py +0 -0
  86. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/routes/system.py +0 -0
  87. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/routes/trigger_documents.py +0 -0
  88. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/routes/triggers.py +0 -0
  89. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/routes/users.py +0 -0
  90. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/routes/workers.py +0 -0
  91. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/security.py +0 -0
  92. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/.gitkeep +0 -0
  93. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/Breadcrumb-x6p00HyX.js +0 -0
  94. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/CodeEditor-0KFNLzta.js +0 -0
  95. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/CodeEditor-C4OnjBMt.css +0 -0
  96. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/Description-MmXUnb-9.js +0 -0
  97. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/Instant-mr1E5jAK.js +0 -0
  98. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/KindChip-CwU_Xxdy.js +0 -0
  99. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/Mark-DQR2php6.js +0 -0
  100. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/Markdown-roa7jpVu.js +0 -0
  101. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/Panel-CqrOYByl.js +0 -0
  102. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ProgramReference-DF37mMAT.js +0 -0
  103. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/Segmented-KaDiGiyr.js +0 -0
  104. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/api-Bm1JZLuC.js +0 -0
  105. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/auth-CHgfcdt9.js +0 -0
  106. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/badge-BovCxjd1.js +0 -0
  107. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/blocks-CclbVd8c.js +0 -0
  108. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/chevron-down-DAO3SUWv.js +0 -0
  109. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/chunk-OB3PAWPO-DOp4K52_.js +0 -0
  110. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/codicon-DCmgc-ay.ttf +0 -0
  111. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/connections-DsdoSARb.js +0 -0
  112. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/copy-BeBwg8IR.js +0 -0
  113. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/dist-DD8kpv1W.js +0 -0
  114. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/docs-CCoB3shg.js +0 -0
  115. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/dropdown-menu-B-6CcHKw.js +0 -0
  116. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/editor.worker-CIvRzd4O.js +0 -0
  117. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/examples-DDWkSZ2u.js +0 -0
  118. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/file-braces-Ep8AP5Yq.js +0 -0
  119. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/format-B5YbYOY-.js +0 -0
  120. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
  121. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
  122. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
  123. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
  124. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-600-normal-CTOM6hUh.woff2 +0 -0
  125. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-600-normal-fLZuRloM.woff +0 -0
  126. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
  127. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
  128. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
  129. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
  130. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-ext-600-normal-9HEixskS.woff +0 -0
  131. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-ext-600-normal-V-xxqcpd.woff2 +0 -0
  132. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
  133. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
  134. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
  135. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
  136. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
  137. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-latin-600-normal-DWFSQ4vo.woff +0 -0
  138. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
  139. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
  140. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
  141. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
  142. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-latin-ext-600-normal-D38SheWl.woff2 +0 -0
  143. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-latin-ext-600-normal-DmB0ttJJ.woff +0 -0
  144. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
  145. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
  146. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
  147. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
  148. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-vietnamese-600-normal-D2EvbN8M.woff2 +0 -0
  149. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-mono-vietnamese-600-normal-iLQfcSjf.woff +0 -0
  150. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-sans-cyrillic-ext-wght-normal-d45eAU9y.woff2 +0 -0
  151. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-sans-cyrillic-wght-normal-BAAhND-U.woff2 +0 -0
  152. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-sans-greek-wght-normal-CmyJS8uq.woff2 +0 -0
  153. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-sans-latin-ext-wght-normal-CIII54If.woff2 +0 -0
  154. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-sans-latin-wght-normal-IvpUvPa2.woff2 +0 -0
  155. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/ibm-plex-sans-vietnamese-wght-normal-Dg1JeJN0.woff2 +0 -0
  156. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/identity-BNZxCf_y.js +0 -0
  157. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/input-1fShkFXn.js +0 -0
  158. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/json.worker-fczZDBja.js +0 -0
  159. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/jsonMode-tILOm4tQ.js +0 -0
  160. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/maximize-2-BdFIT4cn.js +0 -0
  161. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/nav-i7bJ0lrA.js +0 -0
  162. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/paging-CpRIkEky.js +0 -0
  163. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/pipelines-Pi3WL8R6.js +0 -0
  164. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/play-CPVSEWx6.js +0 -0
  165. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/preferences-DsqSnjg9.js +0 -0
  166. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/preload-helper-BZ1Pz5am.js +0 -0
  167. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/react-CQOZoUwg.js +0 -0
  168. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/resolveAriaLabelledBy-ClHvyYLK.js +0 -0
  169. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/rolldown-runtime-Dd_uD5pT.js +0 -0
  170. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/schemas-7KY_7aIc.js +0 -0
  171. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/shell-CC2rA5mh.js +0 -0
  172. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/sql-NEE52Syq.js +0 -0
  173. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/starters-CgC7I45V.js +0 -0
  174. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/status-Ctx8x8Mf.js +0 -0
  175. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/store-C2zgoyrT.js +0 -0
  176. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/textarea-ljIbN_md.js +0 -0
  177. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/tooltip-D7_KwbOU.js +0 -0
  178. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/triggers-BetQ4Leu.js +0 -0
  179. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/twig-De2hgUGE.js +0 -0
  180. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/use-heartbeat-CBT8848s.js +0 -0
  181. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/use-store-CfRquqZF.js +0 -0
  182. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/users-CTGHiHMA.js +0 -0
  183. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/utils-CT7ZGLfR.js +0 -0
  184. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/with-selector-BXYKoaOE.js +0 -0
  185. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/workers-BH2Za19E.js +0 -0
  186. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/x-Dltw6Vbs.js +0 -0
  187. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/yaml-DSCysg4a.js +0 -0
  188. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/assets/yaml.worker-B2SaT_wA.js +0 -0
  189. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/favicon-32.png +0 -0
  190. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/static/logo.png +0 -0
  191. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/transactions.py +0 -0
  192. {dirigent_server-0.18.2 → dirigent_server-0.18.3}/src/dirigent_server/ui.py +0 -0
@@ -1,16 +1,16 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dirigent-server
3
- Version: 0.18.2
3
+ Version: 0.18.3
4
4
  Summary: Dirigent FastAPI server: the REST API, its authentication, and the health probes.
5
5
  License-Expression: LicenseRef-Proprietary
6
6
  License-File: LICENSE
7
7
  License-File: THIRD_PARTY_NOTICES.md
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Programming Language :: Python :: 3.13
10
- Requires-Dist: dirigent-client==0.18.2
11
- Requires-Dist: dirigent-common==0.18.2
12
- Requires-Dist: dirigent-core==0.18.2
13
- Requires-Dist: dirigent-examples==0.18.2
10
+ Requires-Dist: dirigent-client==0.18.3
11
+ Requires-Dist: dirigent-common==0.18.3
12
+ Requires-Dist: dirigent-core==0.18.3
13
+ Requires-Dist: dirigent-examples==0.18.3
14
14
  Requires-Dist: fastapi>=0.141.1
15
15
  Requires-Python: >=3.13
16
16
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "dirigent-server"
3
- version = "0.18.2"
3
+ version = "0.18.3"
4
4
  description = "Dirigent FastAPI server: the REST API, its authentication, and the health probes."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -14,10 +14,10 @@ classifiers = [
14
14
  "Programming Language :: Python :: 3.13",
15
15
  ]
16
16
  dependencies = [
17
- "dirigent-client==0.18.2",
18
- "dirigent-common==0.18.2",
19
- "dirigent-core==0.18.2",
20
- "dirigent-examples==0.18.2",
17
+ "dirigent-client==0.18.3",
18
+ "dirigent-common==0.18.3",
19
+ "dirigent-core==0.18.3",
20
+ "dirigent-examples==0.18.3",
21
21
  "fastapi>=0.141.1",
22
22
  ]
23
23
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "dirigent-server"
3
- version = "0.18.2"
3
+ version = "0.18.3"
4
4
  description = "Dirigent FastAPI server: the REST API, its authentication, and the health probes."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -11,10 +11,10 @@ classifiers = [
11
11
  "Programming Language :: Python :: 3.13",
12
12
  ]
13
13
  dependencies = [
14
- "dirigent-client==0.18.2",
15
- "dirigent-common==0.18.2",
16
- "dirigent-core==0.18.2",
17
- "dirigent-examples==0.18.2",
14
+ "dirigent-client==0.18.3",
15
+ "dirigent-common==0.18.3",
16
+ "dirigent-core==0.18.3",
17
+ "dirigent-examples==0.18.3",
18
18
  "fastapi>=0.141.1",
19
19
  ]
20
20
 
@@ -1 +1 @@
1
- import{n as e}from"./PageState-CGVhOaOE.js";import{r as t}from"./utils-CT7ZGLfR.js";import{t as n}from"./use-store-CfRquqZF.js";import{n as r,t as i}from"./auth-CHgfcdt9.js";var a=t(),o={status:403,title:`Forbidden`,code:`server.forbidden`,params:{},detail:`This screen is an admin's. Operators may define, run and observe pipelines; managing accounts, tokens and connections is an admin's.`,problems:[],instance:null};function s({children:t}){let s=n(i);return r(s)?(0,a.jsx)(a.Fragment,{children:t}):(0,a.jsx)(e,{loading:!1,problem:o,empty:!1,children:null})}export{s as t};
1
+ import{n as e}from"./PageState-BLuobMye.js";import{r as t}from"./utils-CT7ZGLfR.js";import{t as n}from"./use-store-CfRquqZF.js";import{n as r,t as i}from"./auth-CHgfcdt9.js";var a=t(),o={status:403,title:`Forbidden`,code:`server.forbidden`,params:{},detail:`This screen is an admin's. Operators may define, run and observe pipelines; managing accounts, tokens and connections is an admin's.`,problems:[],instance:null};function s({children:t}){let s=n(i);return r(s)?(0,a.jsx)(a.Fragment,{children:t}):(0,a.jsx)(e,{loading:!1,problem:o,empty:!1,children:null})}export{s as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{r as n}from"./with-selector-BXYKoaOE.js";import{n as r}from"./chunk-OB3PAWPO-DOp4K52_.js";import{i,r as a}from"./api-Bm1JZLuC.js";import{N as o}from"./dropdown-menu-B-6CcHKw.js";import{r as s}from"./glyphs-C1sjljkh.js";import{n as c,o as l,s as u,t as d}from"./PageState-BLuobMye.js";import{a as f,n as p,t as m}from"./ListTable-Bf1eJYg4.js";import{r as h,t as g}from"./utils-CT7ZGLfR.js";import{i as _,n as v,t as y}from"./tooltip-D7_KwbOU.js";import{d as b,f as x}from"./paging-CpRIkEky.js";import{t as S}from"./input-1fShkFXn.js";import{l as C}from"./format-B5YbYOY-.js";import{t as w}from"./identity-BNZxCf_y.js";import{r as T,t as E,u as D}from"./pipelines-Pi3WL8R6.js";import{At as O,E as k,Ft as ee,It as A,Mt as te,Nt as ne,Pt as re,S as j,at as M,b as ie,ct as N,et as P,ft as F,g as ae,ht as oe,jt as se,kt as ce,lt as I,tt as le,v as L,y as R}from"./index-C3S0GbYv.js";import{t as ue}from"./Description-MmXUnb-9.js";import{t as de}from"./WindowedPane-dMHnDqVB.js";import{c as fe,f as pe,n as me,o as he}from"./connections-DsdoSARb.js";import{n as ge,t as z}from"./Refusal-BWl1-jC1.js";import{t as B}from"./Instant-mr1E5jAK.js";import{t as V}from"./Segmented-KaDiGiyr.js";import{t as H}from"./Mark-DQR2php6.js";import{t as _e}from"./ProgramReference-DF37mMAT.js";import{t as ve}from"./Picker-DtmGXJxI.js";import{t as ye}from"./AdminOnly-CWzFAkRQ.js";var be={name:`bell-plus`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M15 8h6`,key:`8ybuxh`}],[`path`,{d:`M18 5v6`,key:`g5ayrv`}],[`path`,{d:`M20.002 14.464a9 9 0 0 0 .738.863A1 1 0 0 1 20 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 8.75-5.332`,key:`1abcvy`}]]};be.node;var xe=n(be),Se={name:`send`,size:24,node:[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]};Se.node;var Ce=n(Se),U=e(t(),1),we=[`run_failed`,`run_completed_with_errors`,`run_succeeded`,`run_stuck`],W={run_failed:`Failed`,run_completed_with_errors:`Completed with errors`,run_succeeded:`Succeeded`,run_stuck:`Stuck`},Te=[`pending`,`sending`,`sent`,`failed`],Ee=`0s`;function De(e){return e===Ee?`none`:e}function Oe(e){return e.scope===`pipeline`&&e.pipeline!==null?e.pipeline:`every pipeline`}function ke(e){return e===null?null:`${e} and above`}function Ae(e){return e.active&&!e.paused}function je(e){return e===`sent`||e===`failed`}function Me(e,t=50){let n=new URLSearchParams({limit:String(t)});return e!==null&&n.set(`after`,e),`/alert-rules?${n.toString()}`}function Ne(e){return a(Me(e))}function Pe(e){return i(`/alert-rules`,`POST`,e)}function Fe(e,t){return i(`/alert-rules/${encodeURIComponent(e)}`,`PATCH`,t)}function Ie(e,t){return Fe(e,{paused:t})}function Le(e){return a(`/alert-rules/${encodeURIComponent(e)}`,{method:`DELETE`})}var Re={status:``,notifier:``};function ze(e,t,n=50){let r=new URLSearchParams({limit:String(n)});return e.status!==``&&r.set(`status`,e.status),e.notifier!==``&&r.set(`notifier`,e.notifier),t!==null&&r.set(`after`,t),`/notifications?${r.toString()}`}function Be(e,t){return a(ze(e,t))}function Ve(e){return a(`/notifications/${encodeURIComponent(e)}`)}function He(e){return i(`/notifications/${encodeURIComponent(e)}/$retry`,`POST`,{})}function Ue(e){return i(`/alert-rules/$test`,`POST`,e)}async function We(){return(await a(`/blocks`)).notifiers.map(e=>e.id)}function Ge(e,t){let n=[];for(let r of e){if(r===`log`){n.push({id:r,notifier:r,connection:null,reachable:!0,last_check_at:null,last_check_healthy:null,last_check_detail:null});continue}let e=t.filter(e=>e.kind===r);if(e.length===0){n.push({id:r,notifier:r,connection:null,reachable:!1,last_check_at:null,last_check_healthy:null,last_check_detail:null});continue}for(let t of e)n.push({id:`${r}:${t.code}`,notifier:r,connection:t.code,reachable:!0,last_check_at:t.last_check_at,last_check_healthy:t.last_check_healthy,last_check_detail:t.last_check_detail})}return Ye(n)}function Ke(e){return e.connection??e.notifier}function qe(e){return e.connection===null?e.notifier===`log`?null:fe(e.notifier):me(e.connection)}function G(e){if(e.notifier===`log`)return{tone:`good`,label:`ready`,detail:null};if(!e.reachable)return{tone:`quiet`,label:`not set up`,detail:null};let t=he(e);return{tone:t.tone??`quiet`,label:t.label,detail:t.detail}}var Je={good:0,critical:1,quiet:2};function Ye(e){return e.toSorted((e,t)=>{let n=Je[G(e).tone]-Je[G(t).tone];if(n!==0)return n;let r=e.notifier.localeCompare(t.notifier);return r===0?(e.connection??``).localeCompare(t.connection??``):r})}var Xe=/^[a-z0-9]+(?:[-_][a-z0-9]+)*$/u,Ze=/^(?:\d+(?:ms|s|m|h|d|w))+$/u,Qe=`A Jinja template: {{ run.* }} reads the run's pipeline, status, id, error, trigger, duration_ms and url.`,$e=`A Jinja template over the run's facts; report is the run's report document when it has one.`,K=`text/x-jinja`;function q(e){let t=e.trim();return t===``?null:t}var et=[{value:`global`,label:`Every pipeline`},{value:`pipeline`,label:`One pipeline`}],tt=[{value:``,label:`Any`},...E.map(e=>({value:e,label:e[0].toUpperCase()+e.slice(1)}))];function nt(e){return e===``?null:e}function rt(e){return e===``?null:e}var it=`The process log`;function at(e,t){let n=t.filter(t=>t.kind!==`log`&&e.includes(t.kind)).map(e=>({row:e,heading:w(e)})).toSorted((e,t)=>e.row.kind.localeCompare(t.row.kind)||e.heading.title.localeCompare(t.heading.title));return[{value:``,label:it,aside:``,mark:s(`log`)},...n.map(({row:e,heading:t})=>({value:e.code,label:`${t.title} · ${e.kind}`,aside:t.code??``,mark:s(e.kind)}))]}function ot(e){if(e.code.trim()===``)return`A rule is addressed by its code, and this one has none.`;if(!Xe.test(e.code.trim()))return`A code is lowercase words joined by - or _.`;if(e.scope===`pipeline`&&e.pipeline===``)return`A rule watching one pipeline names that pipeline, and this one names none.`;if(!Ze.test(e.throttle.trim()))return`A throttle is a duration, such as 15m.`}var J=h();function st({rule:e,onChanged:t,onDeleted:n,onTest:r}){let[i,a]=(0,U.useState)(!1),[o,s]=(0,U.useState)(null),c=o===e.code,u=R(),d=ke(e.importance),f=(0,U.useCallback)(e=>Be(Re,e),[]),{state:p}=L(f,ut),m=p.rows.filter(t=>t.rule===e.code);return(0,J.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,J.jsxs)(ht,{thing:e,children:[e.paused&&(0,J.jsx)(mt,{children:`paused`}),!e.active&&(0,J.jsx)(mt,{children:`off`})]}),(0,J.jsx)(ue,{text:e.description}),(0,J.jsxs)(`dl`,{className:`space-y-1.5`,children:[(0,J.jsx)(Y,{label:`Event`,children:W[e.event]}),(0,J.jsx)(Y,{label:`Scope`,children:(0,J.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-x-1.5`,children:[Oe(e),d!==null&&(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:d})]})}),(0,J.jsx)(Y,{label:`Delivers through`,children:(0,J.jsx)(dt,{notifier:e.notifier,connection:e.connection})}),(0,J.jsx)(Y,{label:`Throttle`,children:De(e.throttle)}),c?(0,J.jsx)(ct,{rule:e,onDone:()=>{s(null)},onSaved:e=>{t(e),s(null)}},e.code):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Y,{label:`Subject`,children:(0,J.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-2`,children:[e.template===null?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`none`}):(0,J.jsx)(`span`,{className:`font-mono text-xs break-all`,children:e.template}),(0,J.jsx)(l,{why:u.why,children:(0,J.jsx)(x,{variant:`ghost`,size:`xs`,disabled:!u.may,title:u.why,onClick:()=>{s(e.code)},children:`Edit`})})]})}),e.body!==null&&(0,J.jsx)(Y,{label:`Body`,children:(0,J.jsx)(`span`,{className:`line-clamp-3 font-mono text-xs break-words whitespace-pre-wrap`,children:e.body})})]}),(0,J.jsx)(Y,{label:`Last sent`,children:e.last_sent_at===null?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`never`}):(0,J.jsx)(B,{at:e.last_sent_at})})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,J.jsx)(l,{why:u.why,children:(0,J.jsx)(x,{variant:`outline`,size:`sm`,disabled:i||!u.may,title:u.why,onClick:()=>{a(!0),Ie(e.code,!e.paused).then(t,ge).finally(()=>{a(!1)})},children:e.paused?`Resume`:`Pause`})}),(0,J.jsx)(l,{why:u.why,children:(0,J.jsx)(x,{variant:`outline`,size:`sm`,disabled:!u.may,title:u.why,onClick:r,children:`Send a test`})}),(0,J.jsx)(l,{why:u.why,children:(0,J.jsx)(x,{variant:`outline`,size:`sm`,className:`destructive-action ml-auto`,disabled:i||!u.may,title:u.why,onClick:()=>{a(!0),Le(e.code).then(n,ge).finally(()=>{a(!1)})},children:`Delete`})})]}),(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Recent deliveries`}),!p.read&&(0,J.jsx)(`p`,{className:`text-xs text-faint`,children:`Reading from the server`}),p.read&&m.length===0&&(0,J.jsx)(`p`,{className:`text-xs text-faint`,children:`Nothing sent.`}),(0,J.jsx)(`ul`,{className:`divide-y divide-border`,children:m.map(e=>(0,J.jsxs)(`li`,{className:`row-hover -mx-4 flex items-center gap-2 px-4 py-2`,children:[(0,J.jsx)(j,{status:e.status}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs`,children:e.subject}),(0,J.jsx)(B,{className:`shrink-0 text-xs text-faint`,at:e.created_at})]},e.id))})]})]})}function ct({rule:e,onDone:t,onSaved:n}){let[r,i]=(0,U.useState)(e.template??``),[a,o]=(0,U.useState)(e.body??``),[s,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(!1),d=`alert-rule/${e.code}/body`,f=`rule-${e.code}-subject`;return(0,J.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-border bg-secondary/30 p-3`,children:[(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(k,{htmlFor:f,children:`Subject`}),(0,J.jsx)(S,{id:f,className:`font-mono`,spellCheck:!1,autoComplete:`off`,value:r,placeholder:`{{ run.pipeline }} run {{ run.status }}`,onChange:e=>{i(e.target.value)}}),(0,J.jsx)(`p`,{className:`text-xs text-faint`,children:Qe})]}),(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(k,{children:`Body`}),(0,J.jsx)(`p`,{className:`text-xs text-faint`,children:$e}),(0,J.jsx)(de,{name:`body`,className:`overflow-hidden rounded-md border border-border bg-background`,aside:(0,J.jsx)(_e,{mediaType:K}),windowed:(0,J.jsx)(M,{value:a,mediaType:K,path:d,label:`body, in a window`,className:`min-h-0 flex-1`,onChange:o}),children:(0,J.jsx)(M,{value:a,mediaType:K,path:d,label:`body`,placeholder:`{{ run.pipeline }} ended {{ run.status }}: {{ run.url }}`,className:`h-40 min-h-32`,onChange:o})})]}),s!==null&&(0,J.jsx)(z,{problem:s}),(0,J.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,J.jsx)(x,{variant:`ghost`,size:`sm`,onClick:t,children:`Cancel`}),(0,J.jsx)(x,{size:`sm`,disabled:l,onClick:()=>{let i={};if(q(r)!==e.template&&(i.template=q(r)),q(a)!==e.body&&(i.body=q(a)),Object.keys(i).length===0){t();return}u(!0),c(null),Fe(e.code,i).then(n,e=>{c(b(e))}).finally(()=>{u(!1)})},children:l?`Saving`:`Save`})]})]})}function lt({notification:e,onChanged:t}){let[n,i]=(0,U.useState)(!1),a=R();return(0,J.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,J.jsx)(`div`,{className:`space-y-1`,children:(0,J.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(j,{status:e.status}),(0,J.jsx)(`span`,{className:`text-sm font-semibold`,children:e.subject})]})}),(0,J.jsxs)(`dl`,{className:`space-y-1.5`,children:[e.rule===null?(0,J.jsx)(Y,{label:`Raised by`,children:(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`a test, not a rule`})}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Y,{label:`Event`,children:W[e.event]}),(0,J.jsx)(Y,{label:`Rule`,children:(0,J.jsx)(`span`,{className:`font-mono text-xs`,children:e.rule})})]}),(0,J.jsx)(Y,{label:`Delivers through`,children:(0,J.jsx)(ft,{notifier:e.notifier,connection:e.connection})}),(0,J.jsx)(Y,{label:`Run`,children:(0,J.jsx)(pt,{notification:e})}),(0,J.jsx)(Y,{label:`Queued`,children:(0,J.jsx)(B,{at:e.created_at})}),e.status===`sent`?(0,J.jsx)(Y,{label:`Sent`,children:(0,J.jsx)(B,{at:e.sent_at})}):(0,J.jsx)(Y,{label:`Next try`,children:(0,J.jsx)(B,{at:e.available_at})}),(0,J.jsxs)(Y,{label:`Attempts`,children:[e.attempt,` of `,e.max_attempts]})]}),e.error!==null&&(0,J.jsxs)(`div`,{className:`space-y-1`,children:[(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`What the channel said`}),(0,J.jsx)(`p`,{className:`text-xs break-words text-critical`,children:e.error}),(0,J.jsx)(`p`,{className:`text-xs text-faint`,children:`Only the latest refusal is kept. Earlier attempts are counted, not stored.`})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,J.jsx)(l,{why:a.why,children:(0,J.jsx)(x,{variant:`outline`,size:`sm`,disabled:n||!a.may,title:a.why,onClick:()=>{i(!0),He(e.id).then(t,ge).finally(()=>{i(!1)})},children:`Retry now`})}),e.run_id!==null&&(0,J.jsx)(x,{variant:`outline`,size:`sm`,render:(0,J.jsx)(r,{to:`/runs/${e.run_id}`}),children:`Open the run`})]})]})}var ut=e=>e.id;function dt({notifier:e,connection:t}){return(0,J.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(H,{glyph:s(e)}),(0,J.jsx)(`span`,{className:t===null?`text-sm`:`font-mono text-xs`,children:t??e})]})}function ft({notifier:e,connection:t}){return(0,J.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-1.5`,children:[(0,J.jsx)(`span`,{className:`text-sm`,children:e}),t!==null&&(0,J.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:t})]})}function pt({notification:e}){if(e.run_id===null)return(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`no run`});let t=e.run_pipeline??`a run`;return(0,J.jsxs)(r,{className:`text-primary hover:underline`,to:`/runs/${e.run_id}`,children:[(0,J.jsx)(`span`,{className:`text-sm`,children:t}),e.run_started_at!==null&&(0,J.jsx)(B,{className:`ml-1.5 text-xs text-muted-foreground`,at:e.run_started_at})]})}function mt({children:e}){return(0,J.jsx)(`span`,{className:`rounded-sm border border-border px-1.5 text-xs text-muted-foreground`,children:e})}function ht({thing:e,children:t}){let n=w(e);return(0,J.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:n.named?`text-sm font-semibold`:`font-mono text-sm font-semibold`,children:n.title}),t,n.code!==null&&(0,J.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:n.code})]})}function Y({label:e,children:t}){return(0,J.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,J.jsx)(`dt`,{className:`w-32 shrink-0 text-xs text-muted-foreground`,children:e}),(0,J.jsx)(`dd`,{className:`min-w-0 text-sm`,children:t})]})}var gt={good:`var(--good)`,critical:`var(--critical)`,quiet:`var(--faint)`},_t=`flex min-h-9 items-center gap-2 rounded-full border border-border bg-card py-1 pr-3 pl-2.5 transition-colors`,X=`hover:bg-muted focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`;function vt({channels:e,read:t}){let n=u(),r=yt(e.length,t);return n?(0,J.jsx)(St,{channels:e,note:r}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Channels`}),r===null?(0,J.jsx)(`ul`,{className:`flex flex-wrap gap-2`,children:e.map(e=>(0,J.jsx)(`li`,{className:`flex`,children:(0,J.jsx)(bt,{channel:e})},e.id))}):(0,J.jsx)(`p`,{className:r.tone,children:r.text})]})}function yt(e,t){return t?e===0?{text:`No channel is installed.`,tone:`text-sm text-muted-foreground`}:null:{text:`Reading from the server`,tone:`text-sm text-faint`}}function bt({channel:e}){let t=G(e),n=qe(e),i=(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(H,{glyph:s(e.notifier)}),(0,J.jsx)(`span`,{className:`truncate font-mono text-xs font-semibold`,children:Ke(e)}),(0,J.jsx)(Z,{tone:t.tone})]}),a=n===null?(0,J.jsx)(`button`,{type:`button`,className:g(_t,X),children:i}):(0,J.jsx)(r,{to:n,className:g(_t,X),children:i});return(0,J.jsxs)(y,{children:[(0,J.jsx)(_,{render:a}),(0,J.jsx)(v,{className:`flex-col items-start gap-1`,side:`bottom`,children:(0,J.jsx)(xt,{channel:e,view:t})})]})}function xt({channel:e,view:t}){return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{className:`font-medium`,children:[e.notifier,` · `,t.label,e.last_check_at!==null&&(0,J.jsxs)(`span`,{className:`font-normal opacity-70`,children:[` `,C(e.last_check_at)]})]}),e.connection!==null&&(0,J.jsx)(`span`,{className:`font-mono`,children:e.connection}),t.detail!==null&&(0,J.jsx)(`span`,{className:`opacity-70`,children:t.detail})]})}function St({channels:e,note:t}){let[n,r]=(0,U.useState)(!1);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>{r(!n)},className:g(`flex min-h-finger w-full items-center gap-2.5 border-b border-border px-1 text-left`,X),children:[(0,J.jsx)(o,{className:g(`size-4 shrink-0 text-muted-foreground`,n&&`rotate-90`),"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`text-sm font-semibold`,children:`Channels`}),(0,J.jsx)(`span`,{className:`ml-auto flex items-center gap-1.5`,"aria-hidden":!0,children:e.map(e=>(0,J.jsx)(Z,{tone:G(e).tone},e.id))})]}),n&&(t===null?(0,J.jsx)(`table`,{className:`w-full text-sm`,children:(0,J.jsx)(`tbody`,{children:e.map(e=>(0,J.jsx)(Ct,{channel:e},e.id))})}):(0,J.jsx)(`p`,{className:t.tone,children:t.text}))]})}function Ct({channel:e}){let t=G(e),n=qe(e),i=(0,J.jsxs)(`span`,{className:`flex items-center gap-2.5`,children:[(0,J.jsx)(H,{glyph:s(e.notifier)}),(0,J.jsx)(`span`,{className:`truncate font-mono text-xs font-semibold`,children:Ke(e)})]});return(0,J.jsxs)(`tr`,{className:`border-b border-border last:border-b-0`,children:[(0,J.jsx)(`td`,{className:`w-0 py-2 pr-2 align-middle`,children:(0,J.jsx)(Z,{tone:t.tone})}),(0,J.jsx)(`td`,{className:`min-w-0 py-2 align-middle`,children:e.connection===null||n===null?i:(0,J.jsx)(r,{to:n,className:g(`control-link flex items-center rounded-md px-1`,X),children:i})}),(0,J.jsx)(`td`,{className:`w-0 py-2 pl-2 text-right align-middle whitespace-nowrap`,children:t.label===`not set up`&&n!==null?(0,J.jsxs)(r,{to:n,className:g(`control-link inline-flex items-center rounded-md text-xs text-primary-ink`,X),children:[`Set up `,e.notifier]}):e.last_check_at!==null&&(0,J.jsx)(`span`,{className:`text-xs text-faint`,children:C(e.last_check_at)})})]})}function Z({tone:e}){return(0,J.jsx)(`span`,{className:`status-dot`,style:{"--chip":gt[e]}})}function Q({id:e,label:t,value:n,onChange:r,placeholder:i,mono:a,hint:o}){return(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(k,{htmlFor:e,children:t}),(0,J.jsx)(S,{id:e,className:a===!0?`font-mono`:void 0,spellCheck:!1,autoComplete:`off`,value:n,placeholder:i,onChange:e=>{r(e.target.value)}}),o!==void 0&&(0,J.jsx)(`p`,{className:`text-xs text-faint`,children:o})]})}function wt({id:e,options:t,value:n,onChange:r}){return(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(k,{htmlFor:e,children:`Deliver through`}),(0,J.jsx)(ve,{id:e,label:`Deliver through`,value:n,options:t,placeholder:`Search the channels this instance has`,onChange:r})]})}var Tt=`0s`,Et=`alert-rule/new/body`,Dt=`body`;function Ot({open:e,onOpenChange:t,notifiers:n,connections:r,onCreated:i}){let[a,o]=(0,U.useState)(``),[s,c]=(0,U.useState)(``),[u,d]=(0,U.useState)(``),[f,p]=(0,U.useState)(`run_failed`),[m,h]=(0,U.useState)(`global`),[g,_]=(0,U.useState)(``),[v,y]=(0,U.useState)(``),[S,C]=(0,U.useState)(``),[w,T]=(0,U.useState)(``),[E,D]=(0,U.useState)(``),[A,te]=(0,U.useState)(Tt),[j,N]=(0,U.useState)(null),[P,F]=(0,U.useState)(!1),ae=kt(e),oe=R(),I=ie(oe.why,ot({code:a,scope:m,pipeline:g,throttle:A}));return(0,J.jsx)(ce,{open:e,onOpenChange:t,children:(0,J.jsxs)(se,{className:`flex max-h-[calc(100vh-4rem)] flex-col sm:max-w-3xl`,showCloseButton:!1,children:[(0,J.jsx)(re,{children:(0,J.jsx)(ee,{children:`New rule`})}),(0,J.jsxs)(`div`,{className:`-mx-1 min-h-0 flex-1 space-y-4 overflow-y-auto px-1`,children:[(0,J.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:[(0,J.jsx)(Q,{id:`rule-code`,label:`Code`,value:a,onChange:o,placeholder:`ops-slack-failed`,mono:!0}),(0,J.jsx)(Q,{id:`rule-name`,label:`Name`,value:s,onChange:c,placeholder:`Tell the ops channel`})]}),(0,J.jsx)(Q,{id:`rule-description`,label:`Description`,value:u,onChange:d,placeholder:`What this rule is for`}),(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(k,{children:`Event`}),(0,J.jsx)(V,{label:`Event`,size:`md`,value:f,options:we.map(e=>({value:e,label:W[e]})),onChoose:p})]}),(0,J.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:[(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(k,{children:`Scope`}),(0,J.jsx)(V,{label:`Scope`,size:`md`,value:m,options:et,onChoose:h})]}),m===`pipeline`&&(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(k,{htmlFor:`rule-pipeline`,children:`Pipeline`}),(0,J.jsx)(ve,{id:`rule-pipeline`,label:`Pipeline`,value:g,options:ae,placeholder:`Search by name or code`,onChange:_})]})]}),(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(k,{children:`Importance`}),(0,J.jsx)(`p`,{className:`text-xs text-faint`,children:`Only pipelines that matter at least this much.`}),(0,J.jsx)(V,{label:`Importance`,size:`md`,value:v,options:tt,onChoose:y})]}),(0,J.jsx)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:(0,J.jsx)(wt,{id:`rule-connection`,options:at(n,r),value:S,onChange:C})}),(0,J.jsx)(Q,{id:`rule-subject`,label:`Subject`,value:w,onChange:T,placeholder:`{{ run.pipeline }} run {{ run.status }}`,mono:!0,hint:Qe}),(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(k,{children:`Body`}),(0,J.jsx)(`p`,{className:`text-xs text-faint`,children:$e}),(0,J.jsx)(de,{name:Dt,className:`overflow-hidden rounded-md border border-border`,aside:(0,J.jsx)(_e,{mediaType:K}),windowed:(0,J.jsx)(M,{value:E,mediaType:K,path:Et,label:`${Dt}, in a window`,className:`min-h-0 flex-1`,onChange:D}),children:(0,J.jsx)(M,{value:E,mediaType:K,path:Et,label:Dt,placeholder:`{{ run.pipeline }} ended {{ run.status }}: {{ run.url }}`,className:`h-40 min-h-32`,onChange:D})})]}),(0,J.jsx)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:(0,J.jsx)(Q,{id:`rule-throttle`,label:`Throttle`,value:A,onChange:te,placeholder:`15m`,mono:!0})})]}),j!==null&&(0,J.jsx)(z,{problem:j}),(0,J.jsxs)(ne,{children:[(0,J.jsx)(`p`,{className:`mr-auto self-center text-xs text-muted-foreground`,children:`A rule fires when a run settles. Nothing is sent now.`}),(0,J.jsx)(O,{render:(0,J.jsx)(x,{variant:`ghost`}),children:`Close`}),(0,J.jsx)(l,{why:I,children:(0,J.jsx)(x,{disabled:P||I!==void 0,title:I,onClick:()=>{F(!0),N(null),Pe({code:a.trim(),name:q(s),description:q(u),event:f,scope:m,pipeline:m===`pipeline`?g:null,importance:nt(v),connection:rt(S),template:q(w),body:q(E),throttle:A.trim()}).then(()=>{i(),o(``),c(``),d(``),T(``),D(``),t(!1)},e=>{N(b(e))}).finally(()=>{F(!1)})},children:P?`Creating`:`Create`})})]})]})})}function kt(e){let[t,n]=(0,U.useState)([]);return(0,U.useEffect)(()=>{if(!e)return;let t=!0;return D().then(e=>{t&&n(e.toSorted(T).map(e=>{let t=w(e);return{value:e.code,label:t.title,aside:t.code??``}}))},()=>{t&&n([])}),()=>{t=!1}},[e]),t}var At=1e3,jt=6e4,Mt=`dirigent test alert`,Nt={connection:``,subject:``};function Pt({open:e,draft:t,onOpenChange:n,notifiers:r,connections:i,onQueued:a,onOpenQueue:o}){let[s,c]=(0,U.useState)(t.connection),[u,d]=(0,U.useState)(t.subject),[f,p]=(0,U.useState)(null),[m,h]=(0,U.useState)(null),[g,_]=(0,U.useState)(!1),v=It(f),y=R(),S=v!==null&&je(v.status)?v.id:null;(0,U.useEffect)(()=>{S!==null&&a()},[S]);let C=y.why;return(0,J.jsx)(ce,{open:e,onOpenChange:n,children:(0,J.jsxs)(se,{className:`sm:max-w-lg`,showCloseButton:!1,children:[(0,J.jsxs)(re,{children:[(0,J.jsx)(ee,{children:`Send a test`}),(0,J.jsx)(te,{children:`The message goes through the same queue a real alert does, and a worker delivers it.`})]}),(0,J.jsx)(wt,{id:`test-connection`,options:at(r,i),value:s,onChange:c}),(0,J.jsx)(Q,{id:`test-subject`,label:`Subject`,value:u,onChange:d,placeholder:Mt}),m!==null&&(0,J.jsx)(z,{problem:m}),v!==null&&(0,J.jsx)(Ft,{row:v}),(0,J.jsxs)(ne,{children:[(0,J.jsx)(O,{render:(0,J.jsx)(x,{variant:`ghost`}),children:`Close`}),f!==null&&(0,J.jsx)(x,{variant:`outline`,onClick:()=>{o(f)},children:`Open in the queue`}),(0,J.jsx)(l,{why:C,children:(0,J.jsx)(x,{disabled:g||C!==void 0,title:C,onClick:()=>{_(!0),h(null),p(null),Ue({connection:rt(s),...u.trim()===``?{}:{subject:u.trim()}}).then(e=>{p(e.notification_id),a()},e=>{h(b(e))}).finally(()=>{_(!1)})},children:f===null?`Send`:`Send again`})})]})]})})}function Ft({row:e}){return(0,J.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-border bg-secondary/40 p-3`,"data-testid":`test-delivery`,"aria-live":`polite`,children:[(0,J.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(j,{status:e.status}),(0,J.jsx)(`span`,{className:`text-sm`,children:e.subject})]}),(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.status===`sent`?(0,J.jsxs)(J.Fragment,{children:[`Delivered `,(0,J.jsx)(B,{at:e.sent_at}),`.`]}):e.status===`failed`?(0,J.jsxs)(J.Fragment,{children:[`Given up after `,e.attempt,` of `,e.max_attempts,` attempts.`]}):e.attempt===0?`Queued for the next worker pass.`:(0,J.jsxs)(J.Fragment,{children:[`Attempt `,e.attempt,` of `,e.max_attempts,`, next try`,` `,(0,J.jsx)(B,{at:e.available_at}),`.`]})}),e.error!==null&&(0,J.jsx)(`p`,{className:`text-xs break-words text-critical`,children:e.error})]})}function It(e){let[t,n]=(0,U.useState)(null);return(0,U.useEffect)(()=>{if(e===null)return;let t=!0,r,i=Date.now()+jt,a=()=>{Ve(e).then(o=>{t&&(n({id:e,row:o}),!(je(o.status)||Date.now()>i)&&(r=setTimeout(a,At)))},()=>{})};return a(),()=>{t=!1,r!==void 0&&clearTimeout(r)}},[e]),t!==null&&t.id===e?t.row:null}var Lt=e=>e.id,Rt=e=>e.id;function zt(){return(0,J.jsx)(ye,{children:(0,J.jsx)(Bt,{})})}function Bt(){let[e,t]=(0,U.useState)(!1),[n,r]=(0,U.useState)(null),[i,a]=(0,U.useState)(null),[o,s]=(0,U.useState)(null),[l,u]=(0,U.useState)({status:``,notifier:``}),[p,h]=(0,U.useState)({}),[g,_]=(0,U.useState)({}),v=L((0,U.useCallback)(e=>Ne(e),[]),Lt),y=L((0,U.useCallback)(e=>Be(l,e),[l]),Rt),b=Ht(),{reload:x}=v,{reload:S}=y,C=(0,U.useMemo)(()=>v.state.rows.map(e=>p[e.id]??e),[p,v.state.rows]),w=(0,U.useMemo)(()=>y.state.rows.map(e=>g[e.id]??e),[g,y.state.rows]),T=C.find(e=>e.id===i)??null,E=w.find(e=>e.id===o)??null,D=(0,U.useCallback)(e=>{r(t=>({draft:e,opened:(t?.opened??0)+1}))},[]);(0,U.useEffect)(()=>(le({note:null,tone:`quiet`,identifier:null}),P),[]),(0,U.useEffect)(()=>{if(T!==null){let e=T;return N([{id:`rule`,label:`Rule`,render:()=>(0,J.jsx)(st,{rule:e,onChanged:e=>{h(t=>({...t,[e.id]:e}))},onDeleted:()=>{a(null),x()},onTest:()=>{D({connection:e.connection??``,subject:``})}})}],{screen:`alerting`})}if(E!==null){let e=E;return N([{id:`notification`,label:`Notification`,render:()=>(0,J.jsx)(lt,{notification:e,onChanged:e=>{_(t=>({...t,[e.id]:e}))}})}],{screen:`alerting`})}},[E,T,D,x]);let O=R(`admin`),k=O.may;return(0,U.useEffect)(()=>oe([...k?[{id:`alerting:rule`,title:`New alert rule`,group:F,screen:!0,icon:xe,keywords:[`alert`,`event`,`create`],run:()=>{t(!0)}},{id:`alerting:test`,title:`Send a test through a channel`,group:F,screen:!0,icon:Ce,keywords:[`alert`,`notification`,`try`],run:()=>{D(Nt)}}]:[],{id:`alerting:reload`,title:`Read the alert rules again`,group:F,screen:!0,icon:A,keywords:[`refresh`,`reload`],run:()=>{x(),S()}}]),[k,D,S,x]),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(d,{title:`Alerting`,aside:(0,J.jsx)(f,{tag:`alerts`}),actions:[{id:`test`,label:`Send a test`,icon:Ce,variant:`outline`,disabled:!O.may,why:O.why,onClick:()=>{D(Nt)}},{id:`rule`,label:`New rule`,icon:xe,disabled:!O.may,why:O.why,onClick:()=>{t(!0)}}]}),(0,J.jsx)(`section`,{className:`mb-6 space-y-2`,children:(0,J.jsx)(vt,{channels:b.rows,read:b.read})}),(0,J.jsxs)(`section`,{className:`space-y-2`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Rules`}),(0,J.jsx)(c,{loading:!v.state.read,problem:v.state.problem,empty:C.length===0,emptyMessage:`No rules.`,children:(0,J.jsx)(m,{columns:Wt,rows:C,rowKey:Lt,rowClassName:e=>Ae(e)?void 0:`opacity-60`,reading:v.state.reading,next:v.state.next,onMore:v.more,noun:`rules`,onSelect:e=>{s(null),a(e.id),I()},selected:e=>e.id===i})})]}),(0,J.jsxs)(`section`,{className:`mt-8 space-y-2`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Notifications`}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,J.jsx)(ae,{label:`Status`,value:l.status,anything:`Any status`,options:Te.map(e=>({value:e,label:e,mark:(0,J.jsx)(j,{status:e})})),onChange:e=>{u(t=>({...t,status:e}))}}),(0,J.jsx)(ae,{label:`Notifier`,value:l.notifier,anything:`Any notifier`,options:Vt(b.rows),onChange:e=>{u(t=>({...t,notifier:e}))}})]})]}),(0,J.jsx)(c,{loading:!y.state.read,problem:y.state.problem,empty:w.length===0,emptyMessage:`Nothing queued.`,children:(0,J.jsx)(m,{columns:Gt,rows:w,rowKey:Rt,reading:y.state.reading,next:y.state.next,onMore:y.more,noun:`notifications`,onSelect:e=>{a(null),s(e.id),I()},selected:e=>e.id===o})})]}),(0,J.jsx)(Ot,{open:e,onOpenChange:t,notifiers:$(b.rows),connections:b.connections,onCreated:x}),(0,J.jsx)(Pt,{open:n!==null,draft:n?.draft??Nt,onOpenChange:e=>{e||r(null)},notifiers:$(b.rows),connections:b.connections,onQueued:S,onOpenQueue:e=>{r(null),a(null),s(e),S(),I()}},n?.opened??0)]})}function $(e){return[...new Set(e.map(e=>e.notifier))]}function Vt(e){return $(e).map(e=>({value:e,label:e}))}function Ht(){let[e,t]=(0,U.useState)(null),[n,r]=(0,U.useState)(null);return(0,U.useEffect)(()=>{let e=!0;return We().then(n=>{e&&t(n)},()=>{e&&t([])}),pe().then(t=>{e&&r(t.items)},()=>{e&&r([])}),()=>{e=!1}},[]),{rows:(0,U.useMemo)(()=>Ge(e??[],n??[]),[n,e]),connections:n??[],read:e!==null&&n!==null}}function Ut({rule:e}){let t=ke(e.importance);return(0,J.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-x-1.5`,children:[(0,J.jsx)(`span`,{className:e.scope===`pipeline`?`font-mono text-xs`:`text-sm`,children:Oe(e)}),t!==null&&(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t})]})}var Wt=[{id:`rule`,header:`Rule`,className:p,cell:e=>{let t=w(e);return(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,J.jsx)(`span`,{className:g(`truncate`,t.named?`text-sm font-medium`:`font-mono text-sm font-medium`),title:t.title,children:t.title}),t.code!==null&&(0,J.jsx)(`span`,{className:`truncate font-mono text-xs text-muted-foreground`,title:t.code,children:t.code})]})}},{id:`event`,header:`Event`,cell:e=>(0,J.jsx)(`span`,{className:`text-sm`,children:W[e.event]})},{id:`scope`,header:`Scope`,cell:e=>(0,J.jsx)(Ut,{rule:e})},{id:`delivers`,header:`Delivers through`,cell:e=>(0,J.jsx)(dt,{notifier:e.notifier,connection:e.connection})},{id:`throttle`,header:`Throttle`,className:`font-mono text-xs`,cell:e=>(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:De(e.throttle)})},{id:`sent`,header:`Last sent`,className:`text-xs`,cell:e=>e.last_sent_at===null?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`never`}):(0,J.jsx)(B,{className:`text-muted-foreground`,at:e.last_sent_at})},{id:`live`,header:`State`,cell:e=>e.paused?(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`paused`}):e.active?(0,J.jsx)(`span`,{className:`text-xs text-good`,children:`active`}):(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`off`})}],Gt=[{id:`status`,header:`Status`,cell:e=>(0,J.jsx)(j,{status:e.status})},{id:`subject`,header:`Subject`,className:p,cell:e=>(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,J.jsx)(`span`,{className:`truncate text-sm`,title:e.subject,children:e.subject}),e.error!==null&&(0,J.jsx)(`span`,{className:`truncate text-xs text-critical`,title:e.error,children:e.error})]})},{id:`delivers`,header:`Delivers through`,cell:e=>(0,J.jsx)(ft,{notifier:e.notifier,connection:e.connection})},{id:`run`,header:`Run`,cell:e=>(0,J.jsx)(pt,{notification:e})},{id:`queued`,header:`Queued`,className:`text-xs`,cell:e=>(0,J.jsx)(B,{className:`text-muted-foreground`,at:e.created_at})},{id:`sent`,header:`Sent`,className:`text-xs`,cell:e=>e.status===`sent`?(0,J.jsx)(B,{className:`text-muted-foreground`,at:e.sent_at}):e.attempt>0?(0,J.jsxs)(`span`,{className:`text-faint`,children:[e.attempt,` of `,e.max_attempts,` attempts`]}):null}];export{zt as AdminAlerting};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{n}from"./chunk-OB3PAWPO-DOp4K52_.js";import{n as r,t as i}from"./PageState-BLuobMye.js";import{a,n as o,t as s}from"./ListTable-Bf1eJYg4.js";import{r as c}from"./utils-CT7ZGLfR.js";import{t as l}from"./input-1fShkFXn.js";import{_ as u,ct as d,et as f,lt as p,tt as m}from"./index-C3S0GbYv.js";import{t as h}from"./Markdown-roa7jpVu.js";import{n as g,r as _}from"./Panel-CqrOYByl.js";import{a as v,c as y,l as b,n as x,o as S,r as C,t as w}from"./blocks-CclbVd8c.js";import{y as T}from"./connections-DsdoSARb.js";import{l as E,r as D}from"./examples-DDWkSZ2u.js";import{t as O}from"./KindChip-CwU_Xxdy.js";var k=e(t(),1),A=c(),j=e=>e.id,M=[{key:`scheme`,title:`Storage schemes`,noun:`schemes`},{key:`notifier`,title:`Notifiers`,noun:`notifiers`},{key:`connection`,title:`Connection kinds`,noun:`connection kinds`}],N=e=>t=>`${e}:${t.id}`,P=()=>{};function F(){let[e,t]=(0,k.useState)(``),[n,o]=(0,k.useState)(null),{value:c,problem:h,read:g}=u(y),_=u(E),b=(0,k.useMemo)(()=>D(_.value??[]),[_.value]),x=(0,k.useMemo)(()=>c?.blocks??[],[c]),C=(0,k.useMemo)(()=>v(x,e),[x,e]),T=(0,k.useMemo)(()=>w(C),[C]),O=(0,k.useMemo)(()=>S(c?.storage_schemes??[],e),[c,e]),F=(0,k.useMemo)(()=>S(c?.notifiers??[],e),[c,e]),L=(0,k.useMemo)(()=>S(c?.connection_kinds??[],e),[c,e]),V=(0,k.useMemo)(()=>I(b),[b]),H=x.find(e=>`block:${e.id}`===n)??null,U={scheme:O,notifier:F,connection:L},W=M.flatMap(e=>U[e.key].map(t=>({registry:e,entry:t}))).find(({registry:e,entry:t})=>N(e.key)(t)===n)??null;(0,k.useEffect)(()=>{if(g)return m({note:null,tone:`quiet`,identifier:null}),f},[x,g,c]),(0,k.useEffect)(()=>{if(H!==null)return d([{id:`block`,label:`Block`,render:()=>(0,A.jsx)(B,{entry:H})}],{screen:`blocks`});if(W!==null){let{registry:e,entry:t}=W;return d([{id:`entry`,label:e.title,render:()=>(0,A.jsx)(z,{entry:t})}],{screen:`blocks`})}},[H,W]);let G=(0,k.useCallback)(e=>{o(`block:${e.id}`),p()},[]);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(i,{title:`Blocks`,aside:(0,A.jsx)(a,{tag:`blocks`})}),(0,A.jsx)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:(0,A.jsx)(l,{className:`w-56`,value:e,onChange:e=>{t(e.target.value)},placeholder:`Search blocks`,"aria-label":`Search blocks by id or summary`})}),(0,A.jsx)(r,{loading:!g,problem:h,empty:C.length===0&&O.length===0&&F.length===0&&L.length===0,emptyMessage:x.length===0?`No blocks installed — plugins contribute them.`:`Nothing in the catalog matches that.`,children:(0,A.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[T.map(([e,t])=>(0,A.jsxs)(`section`,{children:[(0,A.jsx)(`h2`,{className:`mb-1.5 font-mono text-xs font-semibold tracking-wide text-faint uppercase`,children:e}),(0,A.jsx)(s,{chrome:{footer:!1},columns:V,rows:t,rowKey:j,reading:!1,next:null,onMore:P,noun:`blocks`,onSelect:G,selected:e=>`block:${e.id}`===n})]},e)),M.map(e=>{let t=U[e.key];return t.length===0?null:(0,A.jsxs)(`section`,{children:[(0,A.jsx)(`h2`,{className:`mb-1.5 font-mono text-xs font-semibold tracking-wide text-faint uppercase`,children:e.title}),(0,A.jsx)(s,{chrome:{footer:!1},columns:R(e.key),rows:t,rowKey:N(e.key),reading:!1,next:null,onMore:P,noun:e.noun,onSelect:t=>{o(N(e.key)(t)),p()},selected:t=>N(e.key)(t)===n})]},e.key)})]})})]})}function I(e){return[{id:`block`,header:`Block`,className:o,cell:e=>(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`span`,{className:`font-mono text-sm font-semibold`,children:e.id}),(0,A.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:e.summary,children:e.summary})]})},{id:`kind`,header:`Kind`,className:`min-w-32 whitespace-nowrap`,cell:e=>(0,A.jsx)(O,{kind:e.kind})},{id:`examples`,header:`Examples`,className:`min-w-28 whitespace-nowrap`,cell:t=>(0,A.jsx)(L,{id:t.id,many:e.get(t.id)??0})},{id:`plugin`,header:`Plugin`,className:`min-w-36 font-mono text-xs whitespace-nowrap`,cell:e=>(0,A.jsx)(`span`,{className:`text-muted-foreground`,children:e.plugin})}]}function L({id:e,many:t}){if(t===0)return(0,A.jsx)(`span`,{className:`text-xs text-faint`,children:`none`});let r=`${String(t)} ${t===1?`example`:`examples`}`;return(0,A.jsx)(n,{className:`text-xs text-primary-ink hover:underline`,to:`/examples?block=${encodeURIComponent(e)}`,title:`The shipped documents that require ${e}`,onClick:e=>{e.stopPropagation()},children:r})}function R(e){let t=e===`scheme`?`storage`:e;return[{id:`entry`,header:`Entry`,className:o,cell:e=>{let t=typeof e.config_schema.description==`string`?e.config_schema.description:``;return(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`span`,{className:`font-mono text-sm font-semibold`,children:e.id}),(0,A.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:t,children:t})]})}},{id:`kind`,header:`Kind`,className:`min-w-32 whitespace-nowrap`,cell:()=>(0,A.jsx)(O,{kind:t})},{id:`plugin`,header:`Plugin`,className:`min-w-36 font-mono text-xs whitespace-nowrap`,cell:e=>(0,A.jsx)(`span`,{className:`text-muted-foreground`,children:e.plugin})}]}function z({entry:e}){let t=(0,k.useMemo)(()=>T(e.config_schema),[e]),n=typeof e.config_schema.description==`string`?e.config_schema.description:null;return(0,A.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,A.jsxs)(`div`,{className:`space-y-1`,children:[(0,A.jsx)(`h2`,{className:`font-mono text-sm font-semibold`,children:e.id}),n!==null&&(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n}),(0,A.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:(0,A.jsx)(g,{term:`plugin`,detail:e.plugin})})]}),(0,A.jsx)(_,{title:`Config`,children:t.length===0?(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This takes no configuration.`}):(0,A.jsx)(`div`,{className:`flex flex-col gap-4`,children:t.map(e=>(0,A.jsx)(V,{field:e},e.name))})})]})}function B({entry:e}){let t=(0,k.useMemo)(()=>T(e.config_schema),[e]),n=C(e);return(0,A.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,A.jsxs)(`div`,{className:`space-y-1`,children:[(0,A.jsx)(`h2`,{className:`font-mono text-sm font-semibold`,children:e.id}),(0,A.jsx)(`p`,{children:(0,A.jsx)(O,{kind:e.kind})}),(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.summary})]}),(0,A.jsx)(_,{title:`Facts`,children:(0,A.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:n.map(e=>(0,A.jsx)(g,{term:e.term,detail:e.detail},e.term))})}),(0,A.jsx)(_,{title:`Config`,children:t.length===0?(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This block takes no configuration.`}):(0,A.jsx)(`div`,{className:`flex flex-col gap-4`,children:t.map(e=>(0,A.jsx)(V,{field:e},e.name))})})]})}function V({field:e}){let t=x(e);return(0,A.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,A.jsx)(`span`,{className:`font-mono text-sm font-medium`,children:e.name}),(0,A.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:b(e)}),e.required&&(0,A.jsx)(`span`,{className:`text-xs text-primary`,children:`required`}),e.hint!==null&&(0,A.jsx)(`span`,{className:`text-xs text-faint`,children:e.hint}),t!==null&&(0,A.jsxs)(`span`,{className:`text-xs text-faint`,children:[`default `,t]})]}),e.options.length>0&&(0,A.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground`,children:e.options.map(e=>e.label).join(` · `)}),e.help!==null&&(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,A.jsx)(h,{text:e.help})})]})}export{F as Blocks};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{r as n}from"./with-selector-BXYKoaOE.js";import{c as r,l as i,u as a}from"./chunk-OB3PAWPO-DOp4K52_.js";import{a as o,i as s,n as c,r as l,t as u}from"./select-BHa3vRob.js";import{r as d}from"./glyphs-C1sjljkh.js";import{n as f,o as p,t as m}from"./PageState-BLuobMye.js";import{a as h,n as g,r as _,t as v}from"./ListTable-Bf1eJYg4.js";import{r as y,t as b}from"./utils-CT7ZGLfR.js";import{i as x,n as S,t as C}from"./tooltip-D7_KwbOU.js";import{d as w,f as T}from"./paging-CpRIkEky.js";import{t as E}from"./input-1fShkFXn.js";import{t as D}from"./SchemaForm-jWG6iOB3.js";import{t as O}from"./textarea-ljIbN_md.js";import{t as k}from"./use-store-CfRquqZF.js";import{d as A,l as j,s as M}from"./format-B5YbYOY-.js";import{t as N}from"./identity-BNZxCf_y.js";import{At as P,D as F,E as I,Ft as ee,It as L,Mt as te,Nt as ne,Pt as re,_ as R,b as ie,ct as z,et as B,ht as V,jt as ae,kt as oe,lt as H,mt as U,tt as se,v as W,y as G}from"./index-C3S0GbYv.js";import{t as ce}from"./Description-MmXUnb-9.js";import{F as K,P as q,S as le,a as ue,d as de,f as fe,g as pe,h as me,i as he,l as ge,n as _e,o as ve,p as ye,s as be,t as xe,u as Se}from"./connections-DsdoSARb.js";import{n as Ce,t as we}from"./Refusal-BWl1-jC1.js";import{t as Te}from"./KindChip-CwU_Xxdy.js";import{t as J}from"./Instant-mr1E5jAK.js";import{t as Y}from"./Mark-DQR2php6.js";var Ee={name:`plug-zap`,size:24,node:[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]],aliases:[`plug-zap-2`]};Ee.node;var De=n(Ee),X=e(t(),1),Z=y(),Oe={good:`var(--good)`,critical:`var(--critical)`};function ke(e){return e===null?`var(--faint)`:Oe[e]}function Q({view:e,className:t}){return(0,Z.jsxs)(`span`,{className:b(`flex items-center gap-2 text-xs`,t),children:[(0,Z.jsx)(`span`,{className:`status-dot`,style:{"--chip":ke(e.tone)},"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:b(`whitespace-nowrap`,e.tone===null&&`text-faint`),children:e.label})]})}function Ae({id:e,name:t,stored:n,value:r,onChange:i}){return(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(I,{htmlFor:e,className:`font-mono text-sm font-medium`,children:t}),(0,Z.jsx)(E,{id:e,type:`password`,autoComplete:`new-password`,value:r,onChange:e=>{i(e.target.value)},placeholder:n?`stored — typing replaces it, blank keeps it`:`not set — type to set one`})]})}function je({connection:e,schema:t,onSaved:n}){let r=k(F),[i,a]=(0,X.useState)(e.name??``),[o,s]=(0,X.useState)(e.description??``),[c,l]=(0,X.useState)(()=>Pe(e)),[u,f]=(0,X.useState)({}),[m,h]=(0,X.useState)(()=>new Set),[g,_]=(0,X.useState)(null),[v,y]=(0,X.useState)(!1),[b,x]=(0,X.useState)(!1),S=N(e),C=(0,X.useMemo)(()=>Ne(e,t),[e,t]),j=(0,X.useMemo)(()=>q(C,c),[C,c]),M=G(`admin`),P=ie(M.why,le(j,m)?void 0:`A setting above is not what this kind accepts.`);return(0,Z.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsxs)(`p`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Y,{glyph:d(e.kind,r)}),(0,Z.jsx)(`span`,{className:S.named?`text-sm font-semibold`:`font-mono text-sm font-semibold`,children:S.title}),S.code!==null&&(0,Z.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:S.code}),(0,Z.jsx)(Te,{kind:e.kind})]}),(0,Z.jsxs)(`p`,{className:`text-xs text-faint`,children:[`Created `,(0,Z.jsx)(J,{at:e.created_at}),A(e.created_at,e.updated_at)&&(0,Z.jsxs)(Z.Fragment,{children:[` · updated `,(0,Z.jsx)(J,{at:e.updated_at})]})]}),(0,Z.jsx)(Me,{connection:e}),(0,Z.jsx)(ce,{text:e.description})]}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(I,{htmlFor:`connection-name`,children:`Name`}),(0,Z.jsx)(E,{id:`connection-name`,value:i,onChange:e=>{a(e.target.value),x(!1)},placeholder:`What to call this on screen`}),(0,Z.jsxs)(`p`,{className:`text-xs text-faint`,children:[`Display only. Every reference to this credential is by its code, `,e.code,`.`]})]}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(I,{htmlFor:`connection-description`,children:`Description`}),(0,Z.jsx)(O,{id:`connection-description`,className:`h-24`,value:o,onChange:e=>{s(e.target.value),x(!1)},placeholder:`What this credential is for. Markdown is rendered.`})]}),(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(`p`,{className:`text-xs font-semibold tracking-wide text-faint uppercase`,children:`Settings`}),(0,Z.jsx)(D,{fields:C,values:c,problems:j,onChange:(e,t)=>{l(n=>({...n,[e]:t})),x(!1)},onUnreadable:(e,t)=>{h(n=>K(n,e,t))}}),e.secret_fields.map(t=>(0,Z.jsx)(Ae,{id:`secret-${t}`,name:t,stored:Fe(e.config[t]),value:u[t]??``,onChange:e=>{f(n=>({...n,[t]:e})),x(!1)}},t))]}),g!==null&&(0,Z.jsx)(we,{problem:g}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(p,{why:P,children:(0,Z.jsx)(T,{size:`sm`,onClick:()=>{let t=ge(e,Le(e,c,u),Ie(i),Ie(o));if(t===null){x(!0);return}y(!0),_(null),me(e.code,t).then(e=>{f({}),x(!0),n(e)},e=>{_(w(e))}).finally(()=>{y(!1)})},disabled:v||P!==void 0,title:P,children:v?`Saving`:`Save`})}),b&&(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Saved.`})]})]})}function Me({connection:e}){let t=ve(e);return(0,Z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Z.jsxs)(`p`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Q,{view:t}),t.checkedAt!==null&&(0,Z.jsxs)(`span`,{className:`text-xs text-faint`,children:[`checked `,(0,Z.jsx)(J,{at:t.checkedAt})]})]}),t.detail!==null&&(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.detail})]})}function Ne(e,t){let n=new Set(e.secret_fields);return t===null?Object.keys(e.config).filter(e=>!n.has(e)).map(t=>({name:t,kind:typeof e.config[t]==`string`?`text`:`json`,help:null,required:!1,nullable:!0,fallback:void 0,options:[],mediaType:null,refers:null,hint:null,placeholder:``,bounds:{},accepts:[],holds:[]})):ye(t,e.secret_fields)}function Pe(e){let t=new Set(e.secret_fields),n={};for(let[r,i]of Object.entries(e.config))t.has(r)||(n[r]=i);return n}function Fe(e){return e!=null}function Ie(e){let t=e.trim();return t===``?null:t}function Le(e,t,n){let r={};for(let[n,i]of Object.entries(t))Object.is(i,e.config[n])||(r[n]=i);for(let[e,t]of Object.entries(n))t!==``&&(r[e]=t);return r}function Re({open:e,kinds:t,startKind:n=``,onOpenChange:r,onCreated:i}){let[a,d]=(0,X.useState)(``),[f,m]=(0,X.useState)(``),[h,g]=(0,X.useState)(n),[_,v]=(0,X.useState)(``),[y,b]=(0,X.useState)({}),[x,S]=(0,X.useState)({}),[C,k]=(0,X.useState)(()=>new Set),[A,j]=(0,X.useState)(()=>new Set),[M,N]=(0,X.useState)(!1),[F,L]=(0,X.useState)(null),[R,z]=(0,X.useState)(!1),B=t.find(e=>e.id===h)??null,V=ye(B?.config_schema??null,B?.secret_fields??[]),H=q(V,y),U=M?void 0:C,se=G(`admin`),W=ie(se.why,Be(a,h,H,A));return(0,Z.jsx)(oe,{open:e,onOpenChange:r,children:(0,Z.jsxs)(ae,{className:`sm:max-w-xl`,showCloseButton:!1,children:[(0,Z.jsxs)(re,{children:[(0,Z.jsx)(ee,{children:`New connection`}),(0,Z.jsx)(te,{children:`Secret fields are sealed on the way in and never read back out.`})]}),(0,Z.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(I,{htmlFor:`connection-code`,children:`Code`}),(0,Z.jsx)(E,{id:`connection-code`,className:`font-mono`,value:a,onChange:e=>{d(e.target.value)},placeholder:`postman-echo`})]}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(I,{htmlFor:`connection-kind`,children:`Kind`}),(0,Z.jsxs)(u,{value:h,onValueChange:e=>{g(String(e)),b({}),S({}),k(new Set),j(new Set),N(!1)},children:[(0,Z.jsx)(s,{id:`connection-kind`,className:`w-full font-mono`,children:(0,Z.jsx)(o,{placeholder:`Choose a kind`,children:B===null?void 0:()=>(0,Z.jsx)(ze,{kind:B.id})})}),(0,Z.jsx)(c,{children:t.map(e=>(0,Z.jsx)(l,{value:e.id,className:`font-mono`,children:(0,Z.jsx)(ze,{kind:e.id})},e.id))})]})]})]}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(I,{htmlFor:`connection-name-new`,children:`Name`}),(0,Z.jsx)(E,{id:`connection-name-new`,value:f,onChange:e=>{m(e.target.value)},placeholder:`What to call it on screen. Optional; nothing references it.`})]}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(I,{htmlFor:`connection-description-new`,children:`Description`}),(0,Z.jsx)(O,{id:`connection-description-new`,className:`h-24`,value:_,onChange:e=>{v(e.target.value)},placeholder:`What this credential is for. Markdown is rendered.`})]}),B!==null&&(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(`p`,{className:`text-xs font-semibold tracking-wide text-faint uppercase`,children:`Settings`}),(0,Z.jsxs)(`div`,{className:`max-h-[40vh] space-y-3 overflow-y-auto pr-1`,children:[(0,Z.jsx)(D,{fields:V,values:y,problems:H,stated:U,onChange:(e,t)=>{b(n=>{let r={...n};return t===void 0?delete r[e]:r[e]=t,r})},onTouch:e=>{k(t=>t.has(e)?t:new Set(t).add(e))},onUnreadable:(e,t)=>{j(n=>K(n,e,t))}}),B.secret_fields.map(e=>(0,Z.jsx)(Ae,{id:`new-secret-${e}`,name:e,stored:!1,value:x[e]??``,onChange:t=>{S(n=>({...n,[e]:t}))}},e))]})]}),F!==null&&(0,Z.jsx)(we,{problem:F}),(0,Z.jsxs)(ne,{children:[(0,Z.jsx)(P,{render:(0,Z.jsx)(T,{variant:`ghost`}),children:`Close`}),(0,Z.jsx)(p,{why:W,children:(0,Z.jsx)(T,{disabled:R||W!==void 0,title:W,onClick:()=>{N(!0),z(!0),L(null),ue({code:a.trim(),name:Ve(f),kind:h,description:Ve(_),config:be(y,x)}).then(e=>{i(e),d(``),m(``),v(``),g(n),b({}),S({}),k(new Set),j(new Set),N(!1),r(!1)},e=>{L(w(e))}).finally(()=>{z(!1)})},children:R?`Creating`:`Create`})})]})]})})}function ze({kind:e}){let t=k(F);return(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Y,{glyph:d(e,t)}),e]})}function Be(e,t,n,r){if(e.trim()===``)return`A connection is addressed by its code, and this one has none.`;if(t===``)return`No kind is chosen, and a connection is a credential of one kind.`;if(r.size>0)return`A setting below holds text that is not a value.`;if(!le(n,r))return`A setting below is not what its kind accepts.`}function Ve(e){let t=e.trim();return t===``?null:t}var $=e=>e.code;function He(){let{code:e=null}=i(),t=r(),[n,o]=a(),s=n.get(`new`),[c,l]=(0,X.useState)(!1),u=c||s!==null,[d,g]=(0,X.useState)({}),[_,y]=(0,X.useState)(null),[b,x]=(0,X.useState)(null),{state:S,more:C,reload:w}=W(fe,$),E=(0,X.useMemo)(()=>S.rows.map(e=>d[e.code]??e),[d,S.rows]),D=E.find(t=>t.code===e)??null,O=(0,X.useCallback)(()=>e===null||D!==null?Promise.resolve(null):Se(e),[e,D]),k=R(O).value,A=D??(k===null?null:d[k.code]??k);(0,X.useEffect)(()=>{e!==null&&H()},[e]);let j=(0,X.useCallback)(e=>{g(t=>({...t,[e.code]:e}))},[]),M=(0,X.useCallback)(e=>{y(e.code),xe(e.code).then(t=>{j(pe(e,t,new Date().toISOString()))},Ce).finally(()=>{y(null)})},[j]),N=e!==null||u;(0,X.useEffect)(()=>{if(!N||b!==null)return;let e=!0;return de().then(t=>{e&&x(t)},()=>{}),()=>{e=!1}},[b,N]),(0,X.useEffect)(()=>{let e=he(E);if(e===null){B();return}return se({note:e,tone:`quiet`,identifier:null}),B},[E]),(0,X.useEffect)(()=>{if(A===null)return;let e=b?.find(e=>e.id===A.kind)?.config_schema??null;return z([{id:`connection`,label:`Connection`,render:()=>(0,Z.jsx)(je,{connection:A,schema:e,onSaved:j},A.code)}],{screen:`connections`})},[j,b,A]);let P=G(`admin`),F=P.may;(0,X.useEffect)(()=>V([...F?[{id:`connections:new`,title:`New connection`,group:U,screen:!0,icon:De,keywords:[`credential`,`create`,`add`],run:()=>{l(!0)}}]:[],{id:`connections:reload`,title:`Read the connections listing again`,group:U,screen:!0,icon:L,keywords:[`refresh`,`reload`],run:w}]),[F,w]);let I=(0,X.useMemo)(()=>Ue(M,_,P.why),[M,_,P.why]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(m,{title:`Connections`,aside:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(h,{tag:`connections`}),(0,Z.jsx)(p,{why:P.why,children:(0,Z.jsxs)(T,{size:`sm`,"aria-label":`New connection`,disabled:!P.may,title:P.why,onClick:()=>{l(!0)},children:[(0,Z.jsx)(De,{"aria-hidden":!0}),`New`]})})]})}),(0,Z.jsx)(f,{loading:!S.read,problem:S.problem,empty:E.length===0,emptyMessage:`No connections.`,children:(0,Z.jsx)(v,{columns:I,rows:E,rowKey:$,reading:S.reading,next:S.next,onMore:C,noun:`connections`,onSelect:e=>{t(_e(e.code),{replace:!0})},selected:t=>t.code===e})}),(0,Z.jsx)(Re,{open:u,kinds:b??[],startKind:s??``,onOpenChange:e=>{l(e),!e&&s!==null&&(n.delete(`new`),o(n,{replace:!0}))},onCreated:()=>{w()}},s??``)]})}function Ue(e,t,n){return[{id:`connection`,header:`Connection`,className:g,cell:e=>(0,Z.jsx)(We,{row:e})},{id:`health`,header:`Health`,cell:e=>(0,Z.jsx)(Ge,{row:e})},{id:`checked`,header:`Checked`,className:`text-xs`,cell:e=>e.last_check_at===null?null:(0,Z.jsx)(Ke,{at:e.last_check_at})},{id:`check`,header:``,className:`py-1 text-right`,cell:r=>(0,Z.jsx)(p,{why:n,children:(0,Z.jsx)(T,{variant:`outline`,size:`icon-lg`,"aria-label":`Check ${r.code}`,disabled:t===r.code||n!==void 0,title:n??`Check now`,onClick:t=>{t.stopPropagation(),e(r)},children:(0,Z.jsx)(L,{className:b(t===r.code&&`animate-spin`),"aria-hidden":!0})})})}]}function We({row:e}){let t=N(e),n=k(F);return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(Y,{glyph:d(e.kind,n)}),(0,Z.jsx)(`span`,{className:b(`truncate font-semibold`,!t.named&&`font-mono`),title:t.title,children:t.title}),t.code!==null&&(0,Z.jsx)(`span`,{className:`truncate font-mono text-xs text-muted-foreground`,title:t.code,children:t.code}),(0,Z.jsx)(Te,{kind:e.kind})]})}function Ge({row:e}){let t=ve(e),n=_();return t.detail===null||n?(0,Z.jsx)(Q,{view:t}):(0,Z.jsxs)(C,{children:[(0,Z.jsx)(x,{render:(0,Z.jsx)(`button`,{type:`button`,className:`rounded-sm focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Z.jsx)(Q,{view:t})})}),(0,Z.jsx)(S,{side:`bottom`,children:t.detail})]})}function Ke({at:e}){return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,title:M(e),children:j(e)})}export{He as Connections};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{c as n,n as r}from"./chunk-OB3PAWPO-DOp4K52_.js";import{n as i,r as a}from"./glyphs-C1sjljkh.js";import{i as o,n as s,r as c,t as l}from"./PageState-BLuobMye.js";import{a as u,t as d}from"./ListTable-Bf1eJYg4.js";import{r as f,t as p}from"./utils-CT7ZGLfR.js";import{t as m}from"./use-store-CfRquqZF.js";import{t as h}from"./auth-CHgfcdt9.js";import{v as g}from"./format-B5YbYOY-.js";import{t as _}from"./use-heartbeat-CBT8848s.js";import{t as v}from"./identity-BNZxCf_y.js";import{m as y}from"./pipelines-Pi3WL8R6.js";import{D as b,It as x,S,_ as C,ht as w,l as T,m as E,pt as D,t as O,u as k}from"./index-C3S0GbYv.js";import{f as A,i as j,o as M,r as N}from"./connections-DsdoSARb.js";import{t as P}from"./Instant-mr1E5jAK.js";import{t as F}from"./Mark-DQR2php6.js";import{f as ee,i as I,p as te,r as ne,s as re,t as ie,u as ae}from"./TileCard-D2tNIrMn.js";import{a as oe,i as L,r as R}from"./workers-BH2Za19E.js";import{f as z,s as B}from"./triggers-BetQ4Leu.js";var V=e(t(),1),H=f(),U={neutral:`bg-muted-foreground`,good:`bg-good`,info:`bg-info`,warning:`bg-warning`,critical:`bg-critical`};function W({rows:e,note:t,reading:n}){let i=m(h).identity?.role??null;return(0,H.jsx)(c,{className:`gap-0 p-0`,children:(0,H.jsxs)(o,{className:`flex h-full flex-col p-0`,children:[(0,H.jsxs)(`div`,{className:`space-y-1 px-3 py-3`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Health`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n?`Reading from the server`:`The workers claiming work, and every connection.`})]}),(0,H.jsx)(`ul`,{className:`max-h-64 grow overflow-y-auto`,children:e.map(e=>{let t=e.kind===`connection`?`/connections`:i===`admin`?`/admin/workers`:null,n=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,H.jsx)(`span`,{className:p(`size-2 shrink-0 rounded-full`,U[e.tone]),"aria-hidden":!0}),e.mark===null?(0,H.jsx)(`span`,{className:`size-4 shrink-0`,"aria-hidden":!0}):(0,H.jsx)(F,{glyph:e.mark})]}),(0,H.jsx)(`span`,{className:`max-w-[55%] shrink-0 truncate font-mono text-xs`,title:e.label,children:e.label}),(0,H.jsxs)(`span`,{className:`ml-auto flex min-w-0 items-baseline gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,title:e.detail,children:e.detail}),e.at!==null&&(0,H.jsx)(P,{className:`shrink-0 text-xs text-faint`,at:e.at})]})]});return(0,H.jsx)(`li`,{className:`border-t border-border`,children:t===null?(0,H.jsx)(`span`,{className:`flex items-center gap-2 px-3 py-1.5`,children:n}):(0,H.jsx)(r,{to:t,className:`control-link flex items-center gap-2 px-3 py-1.5 hover:bg-accent/60`,children:n})},`${e.kind}:${e.id}`)})}),(0,H.jsx)(`p`,{className:`border-t border-border px-3 py-2 text-xs text-muted-foreground`,children:t})]})})}function G(e,t){return`${String(e)}${t.next===null?``:`+`}`}function K(e,t){return e===0?`neutral`:t}function q(e,t){return e.items.filter(e=>e.status===t).length}function se(e,t,n){let r=(t,n,r)=>{if(e===null)return null;let i=q(e,t);return{id:t,label:n,value:G(i,e),note:``,tone:K(i,r),to:k({...O,status:t,since:`24h`})}},i=(e,t,n,r,i)=>{if(i===null)return null;let a=i.items.length;return{id:e,label:t,value:G(a,i),note:a===0?``:r,tone:K(a,n),to:k({...O,status:e})}};return[{id:`runs`,tile:e===null?null:{id:`runs`,label:`Runs`,value:G(e.items.length,e),note:`Last 24 hours.`,tone:`neutral`,to:k({...O,since:`24h`})}},{id:`succeeded`,tile:r(`succeeded`,`Succeeded`,`good`)},{id:`failed`,tile:r(`failed`,`Failed`,`critical`)},{id:`completed_with_errors`,tile:r(`completed_with_errors`,`With errors`,`warning`)},{id:`running`,tile:i(`running`,`Running`,`info`,`Being worked on now.`,t)},{id:`queued`,tile:i(`queued`,`Queued`,`neutral`,`Waiting for a worker.`,n)}]}var J=36e5,Y=864e5;function ce(e,t){let n=e+t*6e4;return Math.floor(n/J)*J-t*6e4}function le(e,t){let n=e+t*6e4;return Math.floor((n%Y+Y)%Y/J)}function ue(e,t,n,r=24){let i=ce(t.getTime(),n)-(r-1)*J,a=Array.from({length:r},(e,t)=>{let r=i+t*J;return{start:r,hour:le(r,n),succeeded:0,withErrors:0,failed:0,total:0}});for(let t of e){let e=Date.parse(t.created_at);if(Number.isNaN(e))continue;let n=Math.floor((e-i)/J);if(n<0||n>=r)continue;let o=a[n];o.total+=1,t.status===`succeeded`?o.succeeded+=1:t.status===`completed_with_errors`?o.withErrors+=1:t.status===`failed`&&(o.failed+=1)}return a}function X(e){return e.succeeded+e.withErrors+e.failed}function de(e){return e.reduce((e,t)=>Math.max(e,X(t)),0)}function fe(e){let t=t=>e.reduce((e,n)=>e+t(n),0),n=t(e=>e.total);if(n===0)return`No run was started in the last 24 hours.`;let r=[`${String(t(e=>e.succeeded))} succeeded`,`${String(t(e=>e.withErrors))} finished with errors`,`${String(t(e=>e.failed))} failed`];return`${String(n)} runs started in the last 24 hours, by the hour: ${r.join(`, `)}.`}function pe(e,t,n=i){let r=e.map(e=>{let t=R(e);return{id:e.id,kind:`worker`,mark:null,label:e.name,tone:t===null?`good`:I(t),detail:t===null?`worker · ${String(e.concurrency)} ${e.concurrency===1?`slot`:`slots`}`:L(t),at:t===null?null:e.last_seen_at}}),o=t.map(e=>{let t=M(e);return{id:e.id,kind:`connection`,mark:a(e.kind,n),label:e.code,tone:t.tone??`neutral`,detail:me(t),at:e.last_check_at}});return[...r,...o]}function me(e){switch(e.state){case`unchecked`:return`never checked`;case`unverified`:return`not verified`;case`healthy`:return e.detail??`healthy`;case`failed`:return e.detail??`did not answer`}}function he(e,t){let n=e.filter(e=>R(e)===null).length,{healthy:r,total:i}=N(t),a=[];if(e.length===0?a.push(`no worker has registered`):n<e.length&&a.push(`${String(n)} of ${String(e.length)} workers healthy`),r<i){let e=j(t,`connections`);e!==null&&a.push(e)}if(a.length>0){let e=a.join(` · `);return`${e.charAt(0).toUpperCase()}${e.slice(1)}.`}return t.length===0?`Every worker is healthy, and this instance holds no connections.`:`Every worker and every connection is healthy.`}function ge(e,t,n=6){return[...e,...t].toSorted((e,t)=>Date.parse(t.created_at)-Date.parse(e.created_at)).slice(0,n)}function _e(e,t=6){return e.flatMap(e=>{let t=B(e.schedule);return t.kind===`due`?[{...e,at:t.at}]:[]}).toSorted((e,t)=>Date.parse(e.at)-Date.parse(t.at)).slice(0,t)}async function ve(e){let t=e.filter(e=>e.schedules>0);return(await Promise.all(t.map(async e=>(await z(e.code,null)).items.map(t=>({pipeline:e.code,schedule:t}))))).flat()}async function ye(){let e=await y(null);return{pipelines:e.items,schedules:await ve(e.items)}}var be=6,Z=[{id:`failed`,label:`Failed`,fill:`bg-status-failed/80`},{id:`withErrors`,label:`With errors`,fill:`bg-status-completed-with-errors/80`},{id:`succeeded`,label:`Succeeded`,fill:`bg-status-succeeded/75`}];function xe(e){let t=`${String(e.hour).padStart(2,`0`)}:00`;if(e.total===0)return`${t} — nothing ran`;let n=Z.filter(t=>e[t.id]>0).map(t=>`${String(e[t.id])} ${t.label.toLowerCase()}`),r=n.length===0?`none finished`:n.join(`, `);return`${t} — ${String(e.total)} started, ${r}`}function Se({buckets:e,reading:t,className:n}){let r=de(e);return(0,H.jsx)(c,{className:p(`gap-0 p-0`,n),children:(0,H.jsxs)(o,{className:`space-y-3 p-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1`,children:[(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Runs over time`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t?`Reading from the server`:`Every run started in the last 24 hours, by the hour it started in.`})]}),(0,H.jsx)(`ul`,{className:`flex items-center gap-3`,children:Z.map(e=>(0,H.jsxs)(`li`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,H.jsx)(`span`,{className:p(`size-2 shrink-0 rounded-sm`,e.fill),"aria-hidden":!0}),e.label]},e.id))})]}),(0,H.jsx)(`div`,{className:`flex h-32 items-end gap-px`,role:`img`,"aria-label":fe(e),children:e.map(e=>(0,H.jsxs)(`div`,{className:`flex h-full flex-1 flex-col justify-end rounded-sm hover:bg-accent/40`,title:xe(e),children:[Z.map(t=>e[t.id]===0?null:(0,H.jsx)(`div`,{className:p(`min-h-0.5 w-full`,t.fill),style:{height:`${String(e[t.id]/Math.max(r,1)*100)}%`}},t.id)),X(e)===0&&(0,H.jsx)(`div`,{className:`h-px w-full bg-border`})]},e.start))}),(0,H.jsx)(`div`,{className:`flex gap-px font-mono text-xs text-faint`,"aria-hidden":!0,children:e.map((e,t)=>(0,H.jsx)(`span`,{className:`flex-1 text-center`,children:t%be===0?`${String(e.hour).padStart(2,`0`)}`:``},e.start))})]})})}function Ce(){let e=m(b),t=C((0,V.useCallback)(()=>T({...O,since:`24h`},null,500),[])),r=C((0,V.useCallback)(()=>T({...O,status:`running`},null),[])),i=C((0,V.useCallback)(()=>T({...O,status:`queued`},null),[])),a=C((0,V.useCallback)(()=>T({...O,status:`failed`},null),[])),o=C((0,V.useCallback)(()=>T({...O,status:`completed_with_errors`},null),[])),c=C(ye),f=C((0,V.useCallback)(()=>oe(null),[])),h=C((0,V.useCallback)(()=>A(null),[])),{again:v}=t,{again:y}=r,{again:S}=i,{again:k}=a,{again:j}=o,{again:M}=c,{again:N}=f,{again:P}=h,F=(0,V.useCallback)(()=>{v(),y(),S(),k(),j(),M(),N(),P()},[M,P,v,k,j,S,y,N]);(0,V.useEffect)(()=>w([{id:`dashboard:refresh`,title:`Refresh the dashboard`,group:D,screen:!0,icon:x,keywords:[`refresh`,`reload`,`home`],run:F}]),[F]);let I=n();_(F,m(E));let L=ge(r.value?.items??[],i.value?.items??[]),R=ae(re(a.value?.items??[],o.value?.items??[]),c.value?.pipelines??[]),z=_e(c.value?.schedules??[]),B=se(t.value,r.value,i.value),U=new Date,G=ue(t.value?.items??[],U,g(U)),K=f.problem===null&&h.problem===null;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(l,{title:`Dashboard`,aside:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(u,{tag:`runs`}),(0,H.jsx)(te,{onRefresh:F})]})}),(0,H.jsx)(`div`,{className:`mb-3 grid grid-cols-2 gap-3 sm:grid-cols-3 xl:grid-cols-6`,children:B.map(e=>e.tile===null?(0,H.jsx)(ne,{},e.id):(0,H.jsx)(ie,{tile:e.tile},e.id))}),(0,H.jsxs)(`div`,{className:`mb-6 grid gap-3 lg:grid-cols-3`,children:[(0,H.jsx)(`div`,{className:p(K?`lg:col-span-2`:`lg:col-span-3`),children:t.problem===null?(0,H.jsx)(Se,{buckets:G,reading:!t.read}):(0,H.jsx)(s,{loading:!1,problem:t.problem,empty:!1,children:null})}),K&&(0,H.jsx)(W,{rows:pe(f.value?.items??[],h.value?.items??[],e),note:he(f.value?.items??[],h.value?.items??[]),reading:!f.read||!h.read})]}),(0,H.jsx)(Q,{title:`Right now`,to:`/runs`,children:(0,H.jsx)(s,{loading:!r.read||!i.read,problem:r.problem??i.problem,empty:L.length===0,emptyMessage:`Nothing is running and nothing is waiting.`,children:(0,H.jsx)(d,{chrome:{footer:!1},columns:we,rows:L,rowKey:e=>e.id,reading:!1,next:null,onMore:$,noun:`runs`,onSelect:e=>void I(`/runs/${e.id}`)})})}),(0,H.jsx)(Q,{title:`Needs a look`,to:`/runs`,children:(0,H.jsx)(s,{loading:!a.read||!o.read,problem:a.problem??o.problem,empty:R.length===0,emptyMessage:`Nothing has failed or finished with errors.`,children:(0,H.jsx)(d,{chrome:{footer:!1},columns:ee,rows:R,rowKey:e=>e.run.id,reading:!1,next:null,onMore:$,noun:`runs`,onSelect:e=>void I(`/runs/${e.run.id}`)})})}),(0,H.jsx)(Q,{title:`Next fires`,to:`/triggers`,children:(0,H.jsx)(s,{loading:!c.read,problem:c.problem,empty:z.length===0,emptyMessage:`No schedule is due to fire.`,children:(0,H.jsx)(d,{chrome:{footer:!1},columns:Te,rows:z,rowKey:e=>`${e.pipeline}:${e.schedule.code}`,reading:!1,next:null,onMore:$,noun:`firings`,onSelect:e=>void I(`/pipelines/${encodeURIComponent(e.pipeline)}`)})})})]})}function Q({title:e,to:t,children:n}){return(0,H.jsxs)(`section`,{className:`mb-6 space-y-2 last:mb-0`,children:[(0,H.jsx)(`div`,{className:`space-y-1`,children:(0,H.jsx)(`h2`,{className:`text-sm font-semibold`,children:(0,H.jsx)(r,{to:t,className:`hover:text-primary`,children:e})})}),n]})}var $=()=>{},we=[{id:`status`,header:`Status`,cell:e=>(0,H.jsx)(S,{status:e.status})},{id:`pipeline`,header:`Pipeline`,cell:e=>(0,H.jsx)(`span`,{className:`font-mono text-sm`,children:v({code:e.pipeline}).title})},{id:`since`,header:`Since`,className:`text-right`,cell:e=>(0,H.jsx)(P,{className:`text-xs text-faint`,at:e.started_at??e.created_at})}],Te=[{id:`pipeline`,header:`Pipeline`,cell:e=>(0,H.jsx)(`span`,{className:`font-mono text-sm`,children:v({code:e.pipeline}).title})},{id:`schedule`,header:`Schedule`,cell:e=>{let t=v(e.schedule);return(0,H.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,H.jsx)(`span`,{className:p(`truncate text-xs`,t.named?`text-foreground`:`font-mono`),children:t.title}),t.code!==null&&(0,H.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:t.code})]})}},{id:`fires`,header:`Fires`,className:`text-right`,cell:e=>(0,H.jsx)(P,{className:`text-xs text-faint`,at:e.at})}];export{Ce as Dashboard};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{n}from"./PageState-CGVhOaOE.js";import{r,t as i}from"./utils-CT7ZGLfR.js";import{f as a}from"./paging-CpRIkEky.js";import{t as o}from"./identity-BNZxCf_y.js";import{T as s,_ as c,it as l}from"./index-MYZXi-9R.js";import{t as u}from"./Description-MmXUnb-9.js";import{n as d,r as f}from"./Panel-CqrOYByl.js";import{t as p}from"./badge-BovCxjd1.js";import{t as m}from"./WindowedPane-CZpOBqK6.js";import{f as h,n as g,u as _}from"./examples-DDWkSZ2u.js";import{t as v}from"./starters-CgC7I45V.js";var y=e(t(),1),b=r(),x=`The document`,S={connection:`connection`,schema:`schema`,block:`block`,pipeline:`pipeline`,storage:`storage`,worker:`worker tag`};function C({example:e,holdings:t,onUse:r}){let C=e.code,E=c((0,y.useCallback)(()=>_(C),[C])),D=o(e),O=(0,y.useMemo)(()=>h(e.requires,t),[e.requires,t]),k=g(e),A=e.tags.filter(e=>e!==v),j=E.value?.source??``;return(0,b.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,b.jsxs)(`div`,{className:`space-y-1`,children:[(0,b.jsx)(`h2`,{className:i(`text-sm font-semibold`,!D.named&&`font-mono`),children:D.title}),D.code!==null&&(0,b.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground`,children:D.code}),(e.starter||k!==null)&&(0,b.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2 pt-0.5`,children:[e.starter&&(0,b.jsx)(p,{variant:`outline`,children:`Starter`}),k!==null&&(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:k})]}),(0,b.jsx)(u,{text:e.description})]}),A.length>0&&(0,b.jsx)(`p`,{className:`flex flex-wrap items-center gap-1`,children:A.map(e=>(0,b.jsx)(s,{tag:e},e))}),(0,b.jsx)(f,{title:`Facts`,children:(0,b.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:[(0,b.jsx)(d,{term:`plugin`,detail:e.plugin}),(0,b.jsx)(d,{term:`shelf`,detail:e.shelf===``?`the root`:e.shelf}),E.value!==null&&(0,b.jsx)(d,{term:`path`,detail:(0,b.jsx)(`span`,{className:`font-mono break-all`,children:E.value.path})})]})}),(0,b.jsx)(f,{title:`Requires`,children:O.length===0?(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This document requires nothing in particular of an instance.`}):(0,b.jsx)(`ul`,{className:`space-y-1 text-xs`,children:O.map(e=>(0,b.jsxs)(`li`,{className:`flex items-baseline gap-2`,children:[(0,b.jsx)(`span`,{className:`text-faint`,children:S[e.kind]}),(0,b.jsx)(`span`,{className:`font-mono break-all`,children:e.name}),(0,b.jsx)(`span`,{className:i(`ml-auto shrink-0`,T(e)),children:w(e)})]},`${e.kind}:${e.name}`))})}),(0,b.jsx)(f,{title:`Source`,children:!E.read||E.problem!==null?(0,b.jsx)(n,{loading:!E.read,problem:E.problem,empty:!1,children:null}):(0,b.jsx)(m,{name:x,className:`overflow-hidden rounded-md border border-border`,windowed:(0,b.jsx)(l,{value:j,path:`example-${C}-window`,label:`${x}, in a window`,className:`min-h-0 flex-1`,readOnly:!0}),children:(0,b.jsx)(l,{value:j,path:`example-${C}`,label:x,className:`h-72 min-h-40`,readOnly:!0})})}),e.starter&&(0,b.jsx)(a,{size:`sm`,className:`self-start`,disabled:E.value===null,onClick:()=>{r(j,C)},children:`Use as starter`})]})}function w(e){return e.met===null?`not checked`:e.met?`here`:`missing`}function T(e){return e.met===null?`text-faint`:e.met?`text-good`:`text-critical`}export{C as ExamplePanel};
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{n}from"./PageState-BLuobMye.js";import{r,t as i}from"./utils-CT7ZGLfR.js";import{f as a}from"./paging-CpRIkEky.js";import{t as o}from"./identity-BNZxCf_y.js";import{T as s,_ as c,at as l}from"./index-C3S0GbYv.js";import{t as u}from"./Description-MmXUnb-9.js";import{n as d,r as f}from"./Panel-CqrOYByl.js";import{t as p}from"./badge-BovCxjd1.js";import{t as m}from"./WindowedPane-dMHnDqVB.js";import{f as h,n as g,u as _}from"./examples-DDWkSZ2u.js";import{t as v}from"./starters-CgC7I45V.js";var y=e(t(),1),b=r(),x=`The document`,S={connection:`connection`,schema:`schema`,block:`block`,pipeline:`pipeline`,storage:`storage`,worker:`worker tag`};function C({example:e,holdings:t,onUse:r}){let C=e.code,E=c((0,y.useCallback)(()=>_(C),[C])),D=o(e),O=(0,y.useMemo)(()=>h(e.requires,t),[e.requires,t]),k=g(e),A=e.tags.filter(e=>e!==v),j=E.value?.source??``;return(0,b.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,b.jsxs)(`div`,{className:`space-y-1`,children:[(0,b.jsx)(`h2`,{className:i(`text-sm font-semibold`,!D.named&&`font-mono`),children:D.title}),D.code!==null&&(0,b.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground`,children:D.code}),(e.starter||k!==null)&&(0,b.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2 pt-0.5`,children:[e.starter&&(0,b.jsx)(p,{variant:`outline`,children:`Starter`}),k!==null&&(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:k})]}),(0,b.jsx)(u,{text:e.description})]}),A.length>0&&(0,b.jsx)(`p`,{className:`flex flex-wrap items-center gap-1`,children:A.map(e=>(0,b.jsx)(s,{tag:e},e))}),(0,b.jsx)(f,{title:`Facts`,children:(0,b.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:[(0,b.jsx)(d,{term:`plugin`,detail:e.plugin}),(0,b.jsx)(d,{term:`shelf`,detail:e.shelf===``?`the root`:e.shelf}),E.value!==null&&(0,b.jsx)(d,{term:`path`,detail:(0,b.jsx)(`span`,{className:`font-mono break-all`,children:E.value.path})})]})}),(0,b.jsx)(f,{title:`Requires`,children:O.length===0?(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This document requires nothing in particular of an instance.`}):(0,b.jsx)(`ul`,{className:`space-y-1 text-xs`,children:O.map(e=>(0,b.jsxs)(`li`,{className:`flex items-baseline gap-2`,children:[(0,b.jsx)(`span`,{className:`text-faint`,children:S[e.kind]}),(0,b.jsx)(`span`,{className:`font-mono break-all`,children:e.name}),(0,b.jsx)(`span`,{className:i(`ml-auto shrink-0`,T(e)),children:w(e)})]},`${e.kind}:${e.name}`))})}),(0,b.jsx)(f,{title:`Source`,children:!E.read||E.problem!==null?(0,b.jsx)(n,{loading:!E.read,problem:E.problem,empty:!1,children:null}):(0,b.jsx)(m,{name:x,className:`overflow-hidden rounded-md border border-border`,windowed:(0,b.jsx)(l,{value:j,path:`example-${C}-window`,label:`${x}, in a window`,className:`min-h-0 flex-1`,readOnly:!0}),children:(0,b.jsx)(l,{value:j,path:`example-${C}`,label:x,className:`h-72 min-h-40`,readOnly:!0})})}),e.starter&&(0,b.jsx)(a,{size:`sm`,className:`self-start`,disabled:E.value===null,onClick:()=>{r(j,C)},children:`Use as starter`})]})}function w(e){return e.met===null?`not checked`:e.met?`here`:`missing`}function T(e){return e.met===null?`text-faint`:e.met?`text-good`:`text-critical`}export{C as ExamplePanel};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ExamplePanel-DKQkiihz.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/react-CQOZoUwg.js","assets/PageState-BLuobMye.js","assets/with-selector-BXYKoaOE.js","assets/dropdown-menu-B-6CcHKw.js","assets/api-Bm1JZLuC.js","assets/utils-CT7ZGLfR.js","assets/paging-CpRIkEky.js","assets/identity-BNZxCf_y.js","assets/index-C3S0GbYv.js","assets/dist-DD8kpv1W.js","assets/preload-helper-BZ1Pz5am.js","assets/chunk-OB3PAWPO-DOp4K52_.js","assets/nav-i7bJ0lrA.js","assets/play-CPVSEWx6.js","assets/file-braces-Ep8AP5Yq.js","assets/chevron-down-DAO3SUWv.js","assets/glyphs-C1sjljkh.js","assets/ListTable-Bf1eJYg4.js","assets/docs-CCoB3shg.js","assets/x-Dltw6Vbs.js","assets/tooltip-D7_KwbOU.js","assets/input-1fShkFXn.js","assets/textarea-ljIbN_md.js","assets/use-store-CfRquqZF.js","assets/store-C2zgoyrT.js","assets/auth-CHgfcdt9.js","assets/idle-DnO3aHK7.js","assets/format-B5YbYOY-.js","assets/status-Ctx8x8Mf.js","assets/use-heartbeat-CBT8848s.js","assets/pipelines-Pi3WL8R6.js","assets/index-DfjqILVM.css","assets/Description-MmXUnb-9.js","assets/Panel-CqrOYByl.js","assets/copy-BeBwg8IR.js","assets/badge-BovCxjd1.js","assets/WindowedPane-dMHnDqVB.js","assets/maximize-2-BdFIT4cn.js","assets/examples-DDWkSZ2u.js","assets/blocks-CclbVd8c.js","assets/connections-DsdoSARb.js","assets/schemas-7KY_7aIc.js","assets/starters-CgC7I45V.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{t as n}from"./preload-helper-BZ1Pz5am.js";import{c as r,u as i}from"./chunk-OB3PAWPO-DOp4K52_.js";import{n as a}from"./nav-i7bJ0lrA.js";import{n as o,t as s}from"./PageState-BLuobMye.js";import{a as c,n as l,t as u}from"./ListTable-Bf1eJYg4.js";import{r as d,t as f}from"./utils-CT7ZGLfR.js";import{t as p}from"./input-1fShkFXn.js";import{n as m,t as h}from"./identity-BNZxCf_y.js";import{It as g,Rt as _,T as v,_ as y,ct as b,et as x,g as S,ht as C,mt as w,tt as T,ut as ee,w as te,x as E}from"./index-C3S0GbYv.js";import{t as D}from"./badge-BovCxjd1.js";import{_ as O,a as k,c as A,d as j,f as M,h as N,i as P,l as F,n as I,o as L,p as R,s as z,t as B}from"./examples-DDWkSZ2u.js";import{n as V,t as H}from"./starters-CgC7I45V.js";import{t as U}from"./Segmented-KaDiGiyr.js";var W=e(t(),1),G=d(),K=(0,W.lazy)(()=>n(()=>import(`./ExamplePanel-DKQkiihz.js`).then(e=>({default:e.ExamplePanel})),__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,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44]))),q=`example`,J=()=>{},Y=e=>e.code,X=[{value:`all`,label:`All`},{value:`starters`,label:`Starters`}];function Z(){let e=r(),[t,n]=i(),[l,d]=(0,W.useState)(null),f=(0,W.useMemo)(()=>P(t),[t]),m=(0,W.useCallback)(e=>{n(A(e),{replace:!0})},[n]),h=y(F),E=y(j),D=(0,W.useMemo)(()=>E.value??{blocks:null,connections:null,schemas:null},[E.value]),k=(0,W.useMemo)(()=>h.value??[],[h.value]),M=(0,W.useMemo)(()=>L(k,f),[f,k]),I=(0,W.useMemo)(()=>N(k),[k]),R=(0,W.useMemo)(()=>z(k),[k]),H=(0,W.useMemo)(()=>O(k),[k]),Z=(0,W.useCallback)(e=>{f.tags.includes(e)||m({...f,tags:[...f.tags,e]})},[m,f]),Q=(0,W.useMemo)(()=>re(D,R,Z),[Z,D,R]),$=(0,W.useCallback)((t,n)=>{e(a,{state:{document:V(t,n)}})},[e]);return(0,W.useEffect)(()=>(T({note:null,tone:`quiet`,identifier:null}),x),[k.length]),(0,W.useEffect)(()=>C([{id:`examples:starters`,title:`Show only the starters`,group:w,screen:!0,icon:_,keywords:[`starter`,`copy`,`new`],run:()=>{m({...f,starters:!0})}},{id:`examples:clear`,title:`Clear the filters on the examples listing`,group:w,screen:!0,icon:g,keywords:[`reset`,`all`],run:()=>{m({needle:``,tags:[],shelf:``,plugin:``,starters:!1,block:``})}}]),[m,f]),(0,W.useEffect)(()=>{if(l!==null)return b([{id:q,label:`Example`,render:()=>(0,G.jsx)(W.Suspense,{fallback:(0,G.jsx)(ne,{}),children:(0,G.jsx)(K,{example:l,holdings:D,onUse:$},l.code)})}],{screen:`examples`})},[l,D,$]),(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(s,{title:`Examples`,aside:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(c,{tag:`examples`}),M.length!==k.length&&(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[String(M.length),` of `,String(k.length)]})]})}),(0,G.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(p,{className:`w-56`,value:f.needle,onChange:e=>{m({...f,needle:e.target.value})},placeholder:`Search examples`,"aria-label":`Search examples by code, name, description or tag`}),(0,G.jsx)(U,{label:`Which documents`,value:f.starters?`starters`:`all`,options:X,onChoose:e=>{m({...f,starters:e===`starters`})}}),(0,G.jsx)(te,{chosen:f.tags,offered:H,onChange:e=>{m({...f,tags:e})}}),(0,G.jsx)(S,{label:`Shelf`,value:f.shelf,anything:`Any shelf`,options:I.map(e=>({value:e,label:e})),onChange:e=>{m({...f,shelf:e===``?``:e})}}),R.length>1&&(0,G.jsx)(S,{label:`Plugin`,value:f.plugin,anything:`Any plugin`,options:R.map(e=>({value:e,label:e})),onChange:e=>{m({...f,plugin:e===``?``:e})}}),f.block!==``&&(0,G.jsx)(v,{tag:f.block,label:`Stop narrowing to ${f.block}`,onSelect:()=>{m({...f,block:``})}})]}),(0,G.jsx)(o,{loading:!h.read,problem:h.problem,empty:M.length===0,emptyMessage:k.length===0?`No examples installed — plugins contribute them.`:B(f)?`Nothing in the corpus matches that.`:`No examples.`,children:(0,G.jsx)(u,{columns:Q,rows:M,rowKey:Y,reading:!1,next:null,onMore:J,noun:`examples`,onSelect:e=>{d(e),ee(q)},selected:e=>e.code===l?.code})})]})}function ne(){return(0,G.jsx)(`div`,{className:`p-4`,children:(0,G.jsx)(o,{loading:!0,problem:null,empty:!1,children:null})})}function re(e,t,n){return[{id:`example`,header:`Example`,className:l,cell:e=>{let t=h(e),n=I(e);return(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:f(`truncate font-semibold`,`max-lg:overflow-visible max-lg:whitespace-normal`,!t.named&&`font-mono`),title:t.title,children:t.title}),e.starter&&(0,G.jsx)(D,{variant:`outline`,className:`shrink-0`,children:`Starter`}),n!==null&&(0,G.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,title:`An instance refuses a document that carries these, so a copy names them under requires instead.`,children:n})]}),(0,G.jsxs)(`p`,{className:`flex items-center gap-2 text-xs`,children:[t.code!==null&&(0,G.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:t.code}),e.description!==null&&(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,title:m(e.description),children:m(e.description)})]})]})}},{id:`tags`,header:`Tags`,cell:e=>(0,G.jsx)(E,{tags:e.tags.filter(e=>e!==H),onSelect:n})},{id:`requires`,header:`Requires`,className:`whitespace-nowrap`,cell:t=>(0,G.jsx)(Q,{example:t,holdings:e})},...t.length>1?[{id:`plugin`,header:`Plugin`,className:`w-32 font-mono text-xs whitespace-nowrap`,cell:e=>(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:e.plugin})}]:[]]}function Q({example:e,holdings:t}){let n=M(e.requires,t),r=R(n);if(r===null)return null;let i=k(n);return(0,G.jsx)(`span`,{className:f(`text-xs`,i===0?`text-muted-foreground`:`text-critical`),children:r})}export{Z as Examples};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{t as n}from"./maximize-2-BdFIT4cn.js";import{r,t as i}from"./utils-CT7ZGLfR.js";import{f as a}from"./paging-CpRIkEky.js";import{At as o,Ot as s,Pt as c,it as l}from"./index-MYZXi-9R.js";var u=e(t(),1),d=r();function f({title:e,text:t,mediaType:r,path:i}){let[f,p]=(0,u.useState)(!1);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a,{variant:`ghost`,size:`icon`,"aria-label":`Open ${e} in a window`,className:`absolute top-1.5 right-3.5 size-6 rounded-md border border-border bg-background/90 text-faint`,onClick:()=>{p(!0)},children:(0,d.jsx)(n,{className:`size-3.5`,"aria-hidden":!0})}),(0,d.jsx)(s,{open:f,onOpenChange:p,children:(0,d.jsxs)(o,{finalFocus:!1,className:`flex h-[85vh] w-[min(64rem,90vw)] max-w-[min(64rem,90vw)] flex-col gap-3 sm:max-w-[min(64rem,90vw)]`,children:[(0,d.jsx)(c,{className:`font-mono text-sm`,children:e}),(0,d.jsx)(l,{value:t,mediaType:r,path:i,label:e,readOnly:!0,className:`min-h-0 flex-1`})]})})]})}var p=/("(?:[^"\\]|\\.)*")(\s*:)?|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)|(true|false|null)/g;function m(e){let t=[],n=0;for(let r of e.matchAll(p)){r.index>n&&t.push({kind:`punctuation`,text:e.slice(n,r.index)});let[,i,a,o,s]=r;i===void 0?o===void 0?s!==void 0&&t.push({kind:`literal`,text:s}):t.push({kind:`number`,text:o}):(t.push({kind:a===void 0?`string`:`key`,text:i}),a!==void 0&&t.push({kind:`punctuation`,text:a})),n=r.index+r[0].length}return n<e.length&&t.push({kind:`punctuation`,text:e.slice(n)}),t}var h={key:`text-info-ink`,string:`text-good-ink`,number:`text-warning-ink`,literal:`text-warning-ink`,punctuation:`text-muted-foreground`};function g({title:e,text:t,className:n}){let r=(0,u.useMemo)(()=>m(t),[t]);return(0,d.jsxs)(`div`,{className:`relative`,children:[(0,d.jsx)(`pre`,{className:i(`overflow-auto rounded-lg border border-border bg-background p-2 font-mono text-xs`,n),children:r.map((e,t)=>(0,d.jsx)(`span`,{className:h[e.kind],children:e.text},t))}),(0,d.jsx)(f,{title:e,text:t,mediaType:`application/json`,path:`window/${e}`})]})}export{g as t};
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{t as n}from"./maximize-2-BdFIT4cn.js";import{r,t as i}from"./utils-CT7ZGLfR.js";import{f as a}from"./paging-CpRIkEky.js";import{Ft as o,at as s,jt as c,kt as l}from"./index-C3S0GbYv.js";var u=e(t(),1),d=r();function f({title:e,text:t,mediaType:r,path:i}){let[f,p]=(0,u.useState)(!1);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a,{variant:`ghost`,size:`icon`,"aria-label":`Open ${e} in a window`,className:`absolute top-1.5 right-3.5 size-6 rounded-md border border-border bg-background/90 text-faint`,onClick:()=>{p(!0)},children:(0,d.jsx)(n,{className:`size-3.5`,"aria-hidden":!0})}),(0,d.jsx)(l,{open:f,onOpenChange:p,children:(0,d.jsxs)(c,{finalFocus:!1,className:`flex h-[85vh] w-[min(64rem,90vw)] max-w-[min(64rem,90vw)] flex-col gap-3 sm:max-w-[min(64rem,90vw)]`,children:[(0,d.jsx)(o,{className:`font-mono text-sm`,children:e}),(0,d.jsx)(s,{value:t,mediaType:r,path:i,label:e,readOnly:!0,className:`min-h-0 flex-1`})]})})]})}var p=/("(?:[^"\\]|\\.)*")(\s*:)?|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)|(true|false|null)/g;function m(e){let t=[],n=0;for(let r of e.matchAll(p)){r.index>n&&t.push({kind:`punctuation`,text:e.slice(n,r.index)});let[,i,a,o,s]=r;i===void 0?o===void 0?s!==void 0&&t.push({kind:`literal`,text:s}):t.push({kind:`number`,text:o}):(t.push({kind:a===void 0?`string`:`key`,text:i}),a!==void 0&&t.push({kind:`punctuation`,text:a})),n=r.index+r[0].length}return n<e.length&&t.push({kind:`punctuation`,text:e.slice(n)}),t}var h={key:`text-info-ink`,string:`text-good-ink`,number:`text-warning-ink`,literal:`text-warning-ink`,punctuation:`text-muted-foreground`};function g({title:e,text:t,className:n}){let r=(0,u.useMemo)(()=>m(t),[t]);return(0,d.jsxs)(`div`,{className:`relative`,children:[(0,d.jsx)(`pre`,{className:i(`overflow-auto rounded-lg border border-border bg-background p-2 font-mono text-xs`,n),children:r.map((e,t)=>(0,d.jsx)(`span`,{className:h[e.kind],children:e.text},t))}),(0,d.jsx)(f,{title:e,text:t,mediaType:`application/json`,path:`window/${e}`})]})}export{g as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{r as n}from"./with-selector-BXYKoaOE.js";import{c as r}from"./PageState-BLuobMye.js";import{r as i,t as a}from"./utils-CT7ZGLfR.js";import{f as o,o as s}from"./paging-CpRIkEky.js";import{i as c}from"./docs-CCoB3shg.js";var l={name:`external-link`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]};l.node;var u=n(l),d=i();function f({tag:e}){return(0,d.jsxs)(`a`,{className:`control-link inline-flex items-center gap-1 rounded-sm border border-border px-3 py-0.5 text-xs text-muted-foreground hover:bg-secondary hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none md:px-1.5`,href:c(e),target:`_blank`,rel:`noreferrer`,title:`The ${e} section of this instance's API documentation`,children:[`API`,(0,d.jsx)(u,{className:`size-3`,"aria-hidden":!0})]})}var p=e(t(),1),m=(0,p.createContext)(0),h=(0,p.createContext)(!1);function g({width:e,cards:t,children:n}){return(0,d.jsx)(m,{value:e,children:(0,d.jsx)(h,{value:t,children:n})})}function _(){return(0,p.use)(m)}function v(){return(0,p.use)(h)}function y({className:e,containerClassName:t,...n}){return(0,d.jsx)(`div`,{"data-slot":`table-container`,className:a(`relative w-full overflow-x-auto`,t),children:(0,d.jsx)(`table`,{"data-slot":`table`,className:a(`w-full caption-bottom text-sm`,e),...n})})}function b({className:e,...t}){return(0,d.jsx)(`thead`,{"data-slot":`table-header`,className:a(`[&_tr]:border-b`,e),...t})}function x({className:e,...t}){return(0,d.jsx)(`tbody`,{"data-slot":`table-body`,className:a(`[&_tr:last-child]:border-0`,e),...t})}function S({className:e,...t}){return(0,d.jsx)(`tr`,{"data-slot":`table-row`,className:a(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function C({className:e,...t}){return(0,d.jsx)(`th`,{"data-slot":`table-head`,className:a(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function w({className:e,...t}){return(0,d.jsx)(`td`,{"data-slot":`table-cell`,className:a(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}var T={cards:!1,natural:0};function E(e,t,n){return t<=0?e:e.cards?t>=e.natural+16?T:e:n>t?{cards:!0,natural:n}:e}var D={width:0,form:T};function O(e){let[t,n]=(0,p.useState)(D),r=(0,p.useCallback)(()=>{if(e===null)return;let t=e.clientWidth,r=e.scrollWidth;n(e=>{if(t!==e.width)return{width:t,form:e.form};let n=E(e.form,t,r);return n===e.form?e:{width:t,form:n}})},[e]);return(0,p.useLayoutEffect)(r),(0,p.useEffect)(()=>{if(e===null||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(r);return t.observe(e),()=>{t.disconnect()}},[e,r]),(0,p.useEffect)(()=>{globalThis.document.fonts?.ready.then(r)},[r]),{width:t.width,cards:t.form.cards}}var k=`w-full max-w-0 min-w-36`,A=`300px`;function j(e){return e.cardLabel===void 0?typeof e.header==`string`&&e.header!==``?e.header:null:e.cardLabel}function M(e){return e!=null&&e!==!1&&e!==``}function N({chrome:e,fixed:t,columns:n,rows:i,rowKey:c,rowClassName:l,reading:u,next:f,onMore:m,noun:h,onSelect:_,selected:v}){let[T,E]=(0,p.useState)(null);(0,p.useEffect)(()=>{if(T===null)return;let e=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&m()},{rootMargin:A});return e.observe(T),()=>{e.disconnect()}},[m,T]);let D=e=>_===void 0?{}:{tabIndex:0,"aria-selected":v?.(e),onClick:()=>{_(e)},onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&t.target===t.currentTarget&&(t.preventDefault(),_(e))}},k=n[0],N=n.slice(1),[P,F]=(0,p.useState)(null),I=O(P),L=I.width,R=r()||I.cards;return(0,d.jsx)(g,{width:L,cards:R,children:(0,d.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden rounded-md border border-border-strong bg-card`,children:[(0,d.jsxs)(`div`,{ref:F,"data-headed":!R&&e?.header!==!1?``:void 0,className:`list-scroll @container min-h-0 flex-1 overflow-auto`,children:[R&&k!==void 0?(0,d.jsx)(`ul`,{className:`divide-y divide-border`,children:i.map(e=>(0,d.jsxs)(`li`,{...D(e),className:a(`row-hover flex min-h-finger flex-col justify-center gap-2 px-3 py-3`,v?.(e)===!0&&`bg-accent/70`,_!==void 0&&`cursor-pointer`,l?.(e)),children:[(0,d.jsx)(`div`,{className:`min-w-0`,children:k.cell(e)}),N.some(t=>M(t.cell(e)))&&(0,d.jsx)(`dl`,{className:`grid grid-cols-[7rem_minmax(0,1fr)] gap-x-3 gap-y-1 text-xs`,children:N.map(t=>{let n=t.cell(e);if(!M(n))return null;let r=j(t);return(0,d.jsxs)(p.Fragment,{children:[(0,d.jsx)(`dt`,{className:`text-faint`,children:r}),(0,d.jsx)(`dd`,{className:`min-w-0`,children:n})]},t.id)})})]},c(e)))}):(0,d.jsxs)(y,{containerClassName:`overflow-x-visible`,className:a(t&&`table-fixed`),children:[e?.header!==!1&&(0,d.jsx)(b,{className:`sticky top-0 z-10 bg-card`,children:(0,d.jsx)(S,{className:`border-border-strong hover:bg-transparent`,children:n.map(e=>(0,d.jsx)(C,{className:a(`px-3 text-xs font-medium text-muted-foreground`,e.className),children:e.header},e.id))})}),(0,d.jsx)(x,{children:i.map(e=>(0,d.jsx)(S,{className:a(`row-hover border-border`,v?.(e)===!0?`bg-accent/70 even:bg-accent/70 hover:bg-accent/70`:a(`even:bg-secondary/30`,_!==void 0&&`hover:bg-accent/60`),_!==void 0&&`cursor-pointer`,l?.(e)),...D(e),children:n.map(t=>(0,d.jsx)(w,{className:a(`px-3 py-2`,t.className),children:t.cell(e)},t.id))},c(e)))})]}),f!==null&&(0,d.jsx)(`div`,{ref:E,className:`border-t border-border p-1.5`,children:(0,d.jsx)(o,{variant:`ghost`,size:`sm`,className:`w-full text-muted-foreground`,onClick:m,disabled:u,children:u?`Reading`:`Load 50 more`})})]}),e?.footer!==!1&&(0,d.jsx)(`div`,{className:`shrink-0 border-t border-border px-3 py-2 text-xs text-faint`,children:s(i.length,h,f!==null)})]})})}export{f as a,_ as i,k as n,v as r,N as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{c as n}from"./chunk-OB3PAWPO-DOp4K52_.js";import{n as r,t as i}from"./PageState-BLuobMye.js";import{a,t as o}from"./ListTable-Bf1eJYg4.js";import{r as s}from"./utils-CT7ZGLfR.js";import{t as c}from"./use-store-CfRquqZF.js";import{t as l}from"./use-heartbeat-CBT8848s.js";import{m as u}from"./pipelines-Pi3WL8R6.js";import{It as d,_ as f,et as p,ft as m,ht as h,l as g,m as _,t as v,tt as y,v as b}from"./index-C3S0GbYv.js";import{f as x}from"./connections-DsdoSARb.js";import{a as S,c as ee,d as C,f as w,l as T,n as E,o as D,p as O,r as k,s as A,u as j}from"./TileCard-D2tNIrMn.js";import{a as M}from"./workers-BH2Za19E.js";import{t as N}from"./AdminOnly-CWzFAkRQ.js";import{t as P}from"./WorkersTable-C3cil-lW.js";var F=e(t(),1),I=s(),L=e=>e.id,R=()=>{};function z(){return(0,I.jsx)(N,{children:(0,I.jsx)(B,{})})}function B(){let e=f((0,F.useCallback)(()=>g({...v,since:`24h`},null,500),[])),t=f((0,F.useCallback)(()=>g({...v,status:`failed`},null),[])),s=f((0,F.useCallback)(()=>g({...v,status:`completed_with_errors`},null),[])),N=f((0,F.useCallback)(()=>x(null),[])),z=f((0,F.useCallback)(()=>u(null,[],500),[])),B=b((0,F.useCallback)(e=>M(e),[]),L),{again:V,value:H,problem:U,read:W}=e,{again:G}=t,{again:K}=s,{again:q}=N,{again:J}=z,{reload:Y}=B,X=(0,F.useCallback)(()=>{V(),G(),K(),q(),J(),Y()},[q,V,G,K,J,Y]),Z=n();l(X,c(_)),(0,F.useEffect)(()=>(y({note:null,tone:`quiet`,identifier:null}),p),[]),(0,F.useEffect)(()=>h([{id:`admin:reload`,title:`Refresh the overview`,group:m,screen:!0,icon:d,keywords:[`refresh`,`reload`,`dashboard`],run:X}]),[X]);let Q=[{id:`day`,tile:H===null?null:D(H)},{id:`now`,tile:H===null?null:ee(H)},{id:`workers`,tile:B.state.read?C({items:B.state.rows,next:B.state.next}):null},{id:`connections`,tile:N.value===null?null:S(N.value)},{id:`schedules`,tile:z.value===null?null:T(z.value)}],$=j(A(t.value?.items??[],s.value?.items??[]),z.value?.items??[]);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(i,{title:`Overview`,aside:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a,{tag:`system`}),(0,I.jsx)(O,{onRefresh:X})]})}),(0,I.jsx)(`div`,{className:`mb-6 grid gap-3 sm:grid-cols-2 xl:grid-cols-5`,children:Q.map(e=>e.tile===null?(0,I.jsx)(k,{},e.id):(0,I.jsx)(E,{tile:e.tile},e.id))}),W&&U!==null&&(0,I.jsx)(r,{loading:!1,problem:U,empty:!1,children:null}),(0,I.jsxs)(`section`,{className:`mb-6 space-y-2`,children:[(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Needs a look`}),(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Every run that failed or finished with errors, newest first.`})]}),(0,I.jsx)(r,{loading:!t.read||!s.read,problem:t.problem??s.problem,empty:$.length===0,emptyMessage:`Nothing has failed or finished with errors.`,children:(0,I.jsx)(o,{chrome:{footer:!1},columns:w,rows:$,rowKey:e=>e.run.id,reading:!1,next:null,onMore:R,noun:`runs`,onSelect:e=>void Z(`/runs/${e.run.id}`)})})]}),(0,I.jsxs)(`section`,{className:`space-y-2`,children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Workers`}),(0,I.jsx)(P,{state:B.state,more:B.more,empty:`No workers. Start one with dg worker; nothing is claimed until one registers.`})]})]})}export{z as AdminOverview};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{r as n}from"./with-selector-BXYKoaOE.js";import{i as r,r as i,t as a,u as o}from"./dropdown-menu-B-6CcHKw.js";import{r as s,t as c}from"./utils-CT7ZGLfR.js";import{f as l,u}from"./paging-CpRIkEky.js";var d={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};d.node;var f=n(d),p={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};p.node;var m=n(p),h={name:`server-crash`,size:24,node:[[`path`,{d:`M6 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-2`,key:`4b9dqc`}],[`path`,{d:`M6 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-2`,key:`22nnkd`}],[`path`,{d:`M6 6h.01`,key:`1utrut`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`m13 6-4 6h6l-4 6`,key:`14hqih`}]]};h.node;var g=n(h),_=s(),v=e(t(),1),y=`(max-width: 767px)`,b=`(max-width: 1023px)`;function x(e){let t=typeof window>`u`?null:window.matchMedia(e);return{subscribe:e=>(t?.addEventListener(`change`,e),()=>{t?.removeEventListener(`change`,e)}),read:()=>t?.matches??!1}}var S=x(y),C=x(b),w=()=>!1;function T(){return(0,v.useSyncExternalStore)(S.subscribe,S.read,w)}function E(){return(0,v.useSyncExternalStore)(C.subscribe,C.read,w)}function D({why:e,children:t}){return e===void 0?t:(0,_.jsx)(`span`,{title:e,children:t})}function O({actions:e}){let t=T();if(e.length===0)return null;let n=e[e.length-1],s=e.slice(0,-1);return t?(0,_.jsx)(_.Fragment,{children:(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s.length>0&&(0,_.jsxs)(a,{children:[(0,_.jsx)(o,{render:(0,_.jsx)(l,{variant:`ghost`,size:`icon-sm`,"aria-label":`More actions`}),children:(0,_.jsx)(f,{className:`size-4`,"aria-hidden":!0})}),(0,_.jsx)(i,{align:`end`,children:s.map(e=>(0,_.jsxs)(r,{disabled:e.disabled,onClick:e.onClick,variant:e.destructive===!0?`destructive`:`default`,children:[e.icon!==void 0&&(0,_.jsx)(e.icon,{className:`size-4`,"aria-hidden":!0}),e.label]},e.id))})]}),n!==void 0&&(0,_.jsx)(k,{action:n})]})}):(0,_.jsx)(`div`,{className:`flex items-center gap-2`,children:e.map(e=>(0,_.jsx)(k,{action:e},e.id))})}function k({action:e}){let t=e.icon;return(0,_.jsx)(D,{why:e.why,children:(0,_.jsxs)(l,{variant:e.variant??`outline`,size:`sm`,"aria-label":e.ariaLabel,disabled:e.disabled,title:e.why,className:e.destructive===!0?`destructive-action`:void 0,onClick:e.onClick,children:[t!==void 0&&(0,_.jsx)(t,{"aria-hidden":!0}),e.label]})})}function A({className:e,size:t=`default`,...n}){return(0,_.jsx)(`div`,{"data-slot":`card`,"data-size":t,className:c(`group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,e),...n})}function j({className:e,...t}){return(0,_.jsx)(`div`,{"data-slot":`card-content`,className:c(`px-(--card-spacing)`,e),...t})}function M({loading:e,problem:t,empty:n,emptyMessage:r,children:i}){if(e)return(0,_.jsx)(A,{children:(0,_.jsxs)(j,{className:`flex items-center gap-2 py-2 text-sm text-muted-foreground`,children:[(0,_.jsx)(m,{className:`size-4 animate-spin`,"aria-hidden":!0}),`Reading from the server`]})});if(t!==null){let e=u(t);return(0,_.jsx)(A,{children:(0,_.jsxs)(j,{className:`flex items-start gap-3 py-8`,children:[(0,_.jsx)(g,{className:`mt-0.5 size-4 shrink-0 text-destructive`,"aria-hidden":!0}),(0,_.jsxs)(`div`,{className:`space-y-1`,children:[(0,_.jsx)(`p`,{className:`text-sm font-medium`,children:t.title}),e.detail!==null&&(0,_.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:e.detail}),e.problems.length>0&&(0,_.jsx)(`ul`,{className:`list-disc space-y-0.5 pl-4 text-xs text-muted-foreground`,children:e.problems.map(e=>(0,_.jsx)(`li`,{className:`font-mono break-all`,children:e},e))})]})]})})}return n?(0,_.jsx)(A,{children:(0,_.jsx)(j,{className:`py-2 text-sm text-muted-foreground`,children:r})}):(0,_.jsx)(_.Fragment,{children:i})}function N({title:e,description:t,aside:n,actions:r}){return(0,_.jsxs)(`div`,{className:`mb-6 flex flex-nowrap items-start justify-between gap-4`,children:[(0,_.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,_.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight`,children:e}),t!==void 0&&(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]}),(n!==void 0||r!==void 0)&&(0,_.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pt-1`,children:[n,r!==void 0&&(0,_.jsx)(O,{actions:r})]})]})}export{O as a,T as c,j as i,m as l,M as n,D as o,A as r,E as s,N as t};
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{r as n}from"./with-selector-BXYKoaOE.js";import{i as r,r as i,t as a,u as o}from"./dropdown-menu-B-6CcHKw.js";import{r as s,t as c}from"./utils-CT7ZGLfR.js";import{f as l,u}from"./paging-CpRIkEky.js";var d={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};d.node;var f=n(d),p={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};p.node;var m=n(p),h={name:`server-crash`,size:24,node:[[`path`,{d:`M6 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-2`,key:`4b9dqc`}],[`path`,{d:`M6 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-2`,key:`22nnkd`}],[`path`,{d:`M6 6h.01`,key:`1utrut`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`m13 6-4 6h6l-4 6`,key:`14hqih`}]]};h.node;var g=n(h),_=s(),v=e(t(),1),y=`(max-width: 767px)`,b=`(max-width: 1023px)`;function x(e){let t=typeof window>`u`?null:window.matchMedia(e);return{subscribe:e=>(t?.addEventListener(`change`,e),()=>{t?.removeEventListener(`change`,e)}),read:()=>t?.matches??!1}}var S=x(y),C=x(b),w=()=>!1;function T(){return(0,v.useSyncExternalStore)(S.subscribe,S.read,w)}function E(){return(0,v.useSyncExternalStore)(C.subscribe,C.read,w)}function D({why:e,children:t}){return e===void 0?t:(0,_.jsx)(`span`,{title:e,children:t})}function O({actions:e}){let t=T();if(e.length===0)return null;let n=e[e.length-1],s=e.slice(0,-1);return t?(0,_.jsx)(_.Fragment,{children:(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s.length>0&&(0,_.jsxs)(a,{children:[(0,_.jsx)(o,{render:(0,_.jsx)(l,{variant:`ghost`,size:`icon-sm`,"aria-label":`More actions`}),children:(0,_.jsx)(f,{className:`size-4`,"aria-hidden":!0})}),(0,_.jsx)(i,{align:`end`,children:s.map(e=>(0,_.jsxs)(r,{disabled:e.disabled,onClick:e.onClick,variant:e.destructive===!0?`destructive`:`default`,children:[e.icon!==void 0&&(0,_.jsx)(e.icon,{className:`size-4`,"aria-hidden":!0}),e.label]},e.id))})]}),n!==void 0&&(0,_.jsx)(k,{action:n})]})}):(0,_.jsx)(`div`,{className:`flex items-center gap-2`,children:e.map(e=>(0,_.jsx)(k,{action:e},e.id))})}function k({action:e}){let t=e.icon;return(0,_.jsx)(D,{why:e.why,children:(0,_.jsxs)(l,{variant:e.variant??`outline`,size:`sm`,"aria-label":e.ariaLabel,disabled:e.disabled,title:e.why,className:e.destructive===!0?`destructive-action`:void 0,onClick:e.onClick,children:[t!==void 0&&(0,_.jsx)(t,{"aria-hidden":!0}),e.label]})})}function A({className:e,size:t=`default`,...n}){return(0,_.jsx)(`div`,{"data-slot":`card`,"data-size":t,className:c(`group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,e),...n})}function j({className:e,...t}){return(0,_.jsx)(`div`,{"data-slot":`card-content`,className:c(`px-(--card-spacing)`,e),...t})}function M({loading:e,problem:t,empty:n,emptyMessage:r,children:i}){if(e)return(0,_.jsx)(A,{children:(0,_.jsxs)(j,{className:`flex items-center gap-2 py-2 text-sm text-muted-foreground`,children:[(0,_.jsx)(m,{className:`size-4 animate-spin`,"aria-hidden":!0}),`Reading from the server`]})});if(t!==null){let e=u(t);return(0,_.jsx)(A,{children:(0,_.jsxs)(j,{className:`flex items-start gap-3 py-8`,children:[(0,_.jsx)(g,{className:`mt-0.5 size-4 shrink-0 text-destructive`,"aria-hidden":!0}),(0,_.jsxs)(`div`,{className:`space-y-1`,children:[(0,_.jsx)(`p`,{className:`text-sm font-medium`,children:t.title}),e.detail!==null&&(0,_.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:e.detail}),e.problems.length>0&&(0,_.jsx)(`ul`,{className:`list-disc space-y-0.5 pl-4 text-xs text-muted-foreground`,children:e.problems.map(e=>(0,_.jsx)(`li`,{className:`font-mono break-all`,children:e},e))})]})]})})}return n?(0,_.jsx)(A,{children:(0,_.jsx)(j,{className:`py-2 text-sm text-muted-foreground`,children:r})}):(0,_.jsx)(_.Fragment,{children:i})}function N({title:e,description:t,aside:n,actions:r}){return(0,_.jsxs)(`div`,{className:`mb-6 flex flex-nowrap items-start justify-between gap-4`,children:[(0,_.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,_.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight`,children:e}),t!==void 0&&(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]}),(n!==void 0||r!==void 0)&&(0,_.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pt-1`,children:[n,r!==void 0&&(0,_.jsx)(O,{actions:r})]})]})}export{O as a,E as c,j as i,m as l,M as n,D as o,A as r,T as s,N as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{i as n}from"./with-selector-BXYKoaOE.js";import{$ as r,$n as i,$t as a,Ar as o,Br as s,Dr as c,Er as l,Et as u,Fn as d,Fr as ee,Gn as f,Ir as p,J as m,Jt as h,K as g,Ln as _,Mr as v,N as y,Nr as b,O as te,Pr as x,Q as S,Qt as C,Rn as w,Sn as ne,St as T,Xt as E,Yt as re,Z as ie,_n as ae,an as D,bn as O,d as k,dt as oe,en as A,er as se,f as ce,fr as le,ft as ue,gn as de,hn as fe,in as pe,k as me,ln as he,lt as j,m as ge,mn as _e,on as ve,ot as ye,pn as be,rn as M,sn as xe,sr as Se,tr as Ce,vn as we,w as Te,wr as Ee,xr as N,zr as De}from"./api-Bm1JZLuC.js";import{t as P}from"./chevron-down-DAO3SUWv.js";import{C as Oe,_ as ke,b as Ae,d as je,f as Me,g as F,h as Ne,j as Pe,v as Fe,w as Ie,x as Le,y as Re}from"./dropdown-menu-B-6CcHKw.js";import{t as ze}from"./x-Dltw6Vbs.js";import{r as Be,t as Ve}from"./utils-CT7ZGLfR.js";import{_ as He,c as Ue,d as We,f as Ge,g as Ke,h as qe,i as Je,l as Ye,m as Xe,n as Ze,p as Qe,r as $e,s as et,t as tt,u as nt,v as rt}from"./resolveAriaLabelledBy-ClHvyYLK.js";import"./paging-CpRIkEky.js";import{a as it,c as at,i as ot,l as st,n as ct,o as lt,r as ut,s as dt,u as ft}from"./input-1fShkFXn.js";import{Dt as pt,Et as mt,Ot as ht,Tt as I}from"./index-C3S0GbYv.js";import{t as L}from"./Mark-DQR2php6.js";var R=e(t(),1),gt=e(n(),1),z=Be();function _t(e,t,n,r,i,a,o,s,c,l=2){let d=T(n.current,{event:e,orientation:r,loopFocus:i,rtl:a,cols:l,disabledIndices:o,minIndex:s,maxIndex:c,prevIndex:t>c?s:t,stopEvent:!0});return u(n.current,d)?void 0:d}var vt=R.createContext(void 0),yt=R.createContext(void 0),bt=R.createContext(void 0),xt=R.createContext(!1),St=R.createContext(``);function B(){let e=R.useContext(vt);if(!e)throw Error(v(22));return e}function Ct(){let e=R.useContext(yt);if(!e)throw Error(v(23));return e}function wt(){let e=R.useContext(bt);if(!e)throw Error(v(24));return e}function Tt(){return R.useContext(St)}function Et(){return R.useContext(xt)}var Dt={id:e=>e.id,labelId:e=>e.labelId,items:e=>e.items,selectedValue:e=>e.selectedValue,hasSelectionChips:e=>{let t=e.selectedValue;return Array.isArray(t)&&t.length>0},hasSelectedValue:e=>{let{selectedValue:t,selectionMode:n}=e;return t==null?!1:n===`multiple`&&Array.isArray(t)?t.length>0:!0},hasNullItemLabel:(e,t)=>t?$e(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMounted:e=>e.forceMounted,inline:e=>e.inline,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(e=>Ye(t,e,n)):Ye(t,r,n)},transitionStatus:e=>e.transitionStatus,popupProps:e=>e.popupProps,listProps:e=>e.listProps,inputProps:e=>e.inputProps,triggerProps:e=>e.triggerProps,itemProps:e=>e.itemProps,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupId:e=>e.popupId,triggerElement:e=>e.triggerElement,inputElement:e=>e.inputElement,inputGroupElement:e=>e.inputGroupElement,popupSide:e=>e.popupSide,openMethod:e=>e.openMethod,inputInsidePopup:e=>e.inputInsidePopup,inputOwnsFormValue:e=>e.inputOwnsFormValue,selectionMode:e=>e.selectionMode,name:e=>e.name,form:e=>e.form,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,grid:e=>e.grid,virtualized:e=>e.virtualized,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,modal:e=>e.modal,autoHighlight:e=>e.autoHighlight};function Ot(e){return e==null?void 0:`${e}-popup`}function kt(e,t){return(n,r)=>n!=null&&e.contains(n,r,t)}function At(e){return Array.isArray(e)?e.map(e=>At(e)).join(`,`):e==null?``:String(e)}var V=new Map;function jt(e={}){let t={usage:`search`,sensitivity:`base`,ignorePunctuation:!0,...e},n=`${At(e.locale)}|${JSON.stringify(t)}`,r=V.get(n);if(r)return r;let i=new Intl.Collator(e.locale,t),a={contains(e,t,n){if(!t)return!0;let r=et(e,n);for(let e=0;e<=r.length-t.length;e+=1)if(i.compare(r.slice(e,e+t.length),t)===0)return!0;return!1},startsWith(e,t,n){if(!t)return!0;let r=et(e,n);return i.compare(r.slice(0,t.length),t)===0},endsWith(e,t,n){if(!t)return!0;let r=et(e,n),a=t.length;return r.length>=a&&i.compare(r.slice(r.length-a),t)===0}};return V.set(n,a),a}var Mt=jt;function Nt(e,t=!1){let{overflowY:n}=Ce(e);return n!==`auto`&&n!==`scroll`?!1:t?e.clientHeight>0:e.scrollHeight>e.clientHeight}var Pt=Symbol(`none`),Ft={value:Pt,index:-1};function It(e,t,n){let r=e.get(t);if(r!==void 0||n===nt)return r;for(let[r,i]of e)if(Ye(r,t,n))return i}function Lt(e){let{id:t,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:o,onSelectedValueChange:s,defaultInputValue:c,inputValue:l,open:u,defaultOpen:d=!1,selectionMode:f,onItemHighlighted:_,name:te,form:w,disabled:T=!1,readOnly:E=!1,required:D=!1,inputRef:oe,grid:me=!1,items:he,filteredItems:j,filter:ge,filterQuery:ve,openOnInputClick:ye=!0,autoHighlight:xe=!1,keepHighlight:Ce=!1,highlightItemOnHover:we=!0,loopFocus:Te=!0,itemToStringLabel:Ee,itemToStringValue:N,isItemEqualToValue:P=nt,virtualized:Oe=!1,inline:Ae=!1,fillInputOnItemPress:je=!0,modal:Me=!1,limit:F=-1,autoComplete:Ne=`list`,formAutoComplete:Fe,locale:Re,submitOnItemClick:ze=!1}=e,{clearErrors:Be}=it(),{setDirty:Ve,validityData:qe,setFilled:$e,name:tt,disabled:ot,setTouched:st,setFocused:lt,validationMode:dt,validation:ft}=at(),pt=Le(),mt=ut({id:t}),ht=Mt({locale:Re}),I=Array.isArray(he)?null:he;if(I&&typeof I.label!=`function`)throw Error(v(100));let L=I?I.data:he,gt=I?.value,B=gt?void 0:L,Ct=R.useMemo(()=>{if(!j||!gt)return;let e=Ze(j),t=e.map(gt),n;return{values:t,findItem(r,i){if(!n){n=new Map;for(let r=0;r<t.length;r+=1)n.has(t[r])||n.set(t[r],e[r])}return It(n,r,i)}}},[j,gt]),wt=R.useMemo(()=>I?e=>I.label(e,P,e=>{let t=Ct?.findItem(e,P);return t==null?et(e,Ee):I.itemLabel(t)}):Ee,[I,Ee,Ct,P]),Tt=R.useMemo(()=>I?Object.assign(e=>I.itemLabel(e),{selected:e=>et(e,wt)}):Ee,[I,wt,Ee]);function Et(e){return et(e,wt)}let[Ot,At]=R.useState(!1),[V,jt]=R.useState(null),Lt=R.useRef(V),Rt=R.useRef([]),zt=R.useRef([]),Bt=R.useRef(null),H=R.useRef(null),Vt=R.useRef(null),Ht=R.useRef(null),Ut=R.useRef(null),Wt=R.useRef(!0),Gt=R.useRef(!1),Kt=R.useRef(null),qt=R.useRef(null),Jt=R.useRef(null),Yt=R.useRef(Ft),Xt=R.useRef(null),Zt=R.useRef([]),Qt=R.useRef(null),U=ot||T,$t=tt??te,W=f===`multiple`,en=f===`single`,tn=l!==void 0||c!==void 0,G=L!==void 0,nn=j!==void 0,K;K=xe===`always`?`always`:xe?`input-change`:!1;let[q,rn]=k({controlled:o,default:W?r??x:r,name:`Combobox`,state:`selectedValue`}),an=R.useMemo(()=>ge===null?()=>!0:ge===void 0?kt(ht,Tt):ge,[ge,ht,Tt]),on=De(()=>tn?c??``:en?Et(q):``).current,[J,sn]=k({controlled:l,default:on,name:`Combobox`,state:`inputValue`}),[Y,cn]=k({controlled:u,default:d,name:`Combobox`,state:`open`}),ln=Je(L),X=!Y&&V!==null?V:String(J).trim(),un=en?Et(q):``,dn=en&&!Ot&&X!==``&&un.length===X.length&&ht.contains(un,X),fn=dn?``:ve??X,pn=G&&nn&&dn&&(!I||I.hasValue(q,P)),mn=R.useMemo(()=>L?Ze(L):x,[L]),hn=R.useMemo(()=>{if(j&&!pn)return j;if(!L)return x;if(ln){let e=L,t=[],n=0;for(let r of e){if(F>-1&&n>=F)break;let e=F>-1?F-n:1/0,i=fn===``?r.items.slice(0,e):[];if(fn!==``)for(let t of r.items){if(i.length>=e)break;an(t,fn,Tt)&&i.push(t)}if(i.length>0){let e={...r,items:i};t.push(e),n+=i.length}}return t}if(fn===``)return F>-1?mn.slice(0,F):mn;let e=[];for(let t of mn){if(F>-1&&e.length>=F)break;an(t,fn,Tt)&&e.push(t)}return e},[j,pn,L,ln,fn,F,an,Tt,mn]),Z=R.useMemo(()=>{if(Ct&&hn===j)return Ct.values;let e=Ze(hn);return gt?e.map(e=>gt(e)):e},[hn,j,Ct,gt]),Q=De(()=>{let e=null;return Ae&&Y&&G&&f!==`none`&&(e=Ge(Z,q,P,W)),new ie({id:mt,labelId:void 0,selectedValue:q,open:Y,items:B,selectionMode:f,name:$t,form:w,disabled:U,readOnly:E,required:D,grid:me,virtualized:Oe,openOnInputClick:ye,itemToStringLabel:wt,isItemEqualToValue:P,modal:Me,autoHighlight:K,submitOnItemClick:ze,hasInputValue:tn,mounted:!1,forceMounted:!1,transitionStatus:`idle`,inline:Ae,activeIndex:null,selectedIndex:e,popupProps:{},listProps:{},inputProps:{},triggerProps:{},itemProps:ee,positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:f===`none`},{onOpenChangeComplete:p,setOpen:p,setInputValue:p,setSelectedValue:p,setIndices:p,handleSelection:p,forceMount:p,requestSubmit:p,listRef:Rt,labelsRef:zt,popupRef:Bt,emptyRef:Ut,inputRef:H,startDismissRef:Vt,endDismissRef:Ht,keyboardActiveRef:Wt,chipsContainerRef:Kt,clearRef:qt,valuesRef:Zt,pointerDownItemRef:Qt,selectionEventRef:Jt},Dt)}).current,gn=f===`none`?J:q,_n=R.useMemo(()=>f===`none`?gn:Array.isArray(q)?q.map(e=>Ue(e,N)):Ue(q,N),[gn,N,f,q]),vn=C(_),yn=C(n),bn=Q.useState(`activeIndex`),xn=Q.useState(`selectedIndex`),Sn=Q.useState(`positionerElement`),Cn=Q.useState(`listElement`),wn=Q.useState(`triggerElement`),Tn=Q.useState(`inputElement`),En=Q.useState(`inputGroupElement`),$=Q.useState(`inline`),Dn=Q.useState(`inputInsidePopup`),On=Q.useState(`inputOwnsFormValue`),kn=en&&!Dn&&J===un,An=a(wn),{mounted:jn,setMounted:Mn,transitionStatus:Nn}=m(Y),{openMethod:Pn,triggerProps:Fn}=ke(Y),In=C(()=>_n);ct(Dn?An:H,mt,gn,In,!U,te);let Ln=C(()=>{L?zt.current=Z.map(Et):Q.set(`forceMounted`,!0)}),Rn=C((e,t,n)=>{if(t===-1){if(Yt.current===Ft)return;Yt.current=Ft}else Yt.current={value:e,index:t};vn(e,pe(n,void 0,{index:t}))}),zn=C(e=>{let t={};e.activeIndex!==void 0&&(t.activeIndex=e.activeIndex),e.selectedIndex!==void 0&&(t.selectedIndex=e.selectedIndex),Q.update(t);let n=e.activeIndex;if(n===void 0)return;let r=e.type||`none`;n===null?Rn(void 0,-1,r):Rn(Zt.current[n],n,r)}),Bn=C((t,n)=>{if(e.onInputValueChange?.(t,n),!n.isCanceled){if(Gt.current=n.reason===_e,n.reason===`input-change`){Y&&V!==null&&jt(null);let e=n.event,r=e.inputType;if(e.type===`compositionend`||r!=null&&r!==``&&r!==`insertReplacementText`){let e=t.trim()!==``;e&&At(!0),Xt.current={hasQuery:e};let n=Q.state.listElement;if(!Q.state.virtualized&&n){let e=Bt.current;for(let t of Se(n.firstElementChild??n)){if(!le(t)||(e?!i(e,t):t.getAttribute(`role`)===`dialog`))break;if(Nt(t)){t.scrollTop=0;break}}}e&&K&&Q.state.activeIndex==null&&(Y||$)&&Q.set(`activeIndex`,0)}}else n.reason===`input-clear`&&t===``&&Q.state.inputInsidePopup&&(Xt.current={hasQuery:!1,selection:!0});sn(t)}}),Vn=C(e=>{let t=!e&&Dn&&!$&&J!==``&&(String(J).trim()===V||J===un);!e&&(t||J===``||kn)&&At(!1),jt(null),t&&Bn(``,M(_e))}),Hn=C((t,n)=>{if(Y!==t&&(n.reason===`escape-key`&&G&&Z.length===0&&!Ut.current&&n.allowPropagation(),e.onOpenChange?.(t,n),!n.isCanceled&&(t&&V!==null&&Vn(n.reason===be),!t&&Ot&&(en?($||jt(X),X===``&&At(!1)):W&&($||jt(X),Dn&&zn({activeIndex:null}),(!Dn||$)&&Bn(``,M(_e,n.event,void 0,{isItemPress:n.reason===de})))),cn(t),!t&&Dn&&(n.reason===`focus-out`||n.reason===`outside-press`)&&(st(!0),lt(!1),dt===`onBlur`)))){let e=f===`none`?J:q;ft.commit(e)}}),Un=C((e,t)=>{s?.(e,t),!t.isCanceled&&(rn(e),(f===`none`&&Bt.current&&je||en&&!Q.state.inputInsidePopup)&&Bn(Et(e),M(t.reason,t.event)))}),Wn=C((e,t)=>{let n=se(e),r=Jt.current??e;Jt.current=null;let i=M(de,r),a=n?.closest(`a`)?.getAttribute(`href`);if(a){a.startsWith(`#`)&&Hn(!1,i);return}if(W){let e=Array.isArray(q)?q:[],n=Ke(e,t,P),r=n?Xe(e,t,P):[...e,t];if(Un(r,i),i.isCanceled||!(H.current&&H.current.value.trim()!==``))return;if(Q.state.inputInsidePopup){Bn(``,M(_e,i.event,void 0,{isItemPress:!0}));let e=Xt.current;e&&!n&&(e.toggledValue=t)}else Hn(!1,i)}else{if(Un(t,i),i.isCanceled)return;Hn(!1,i)}}),Gn=C(()=>{let e=ft.inputRef.current?.form??Q.state.inputElement?.form;e&&typeof e.requestSubmit==`function`&&e.requestSubmit()}),Kn=C(()=>{if(Mn(!1),yn?.(!1),At(!1),jt(null),zn(f===`none`?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),W&&H.current&&H.current.value!==``&&!Gt.current&&Bn(``,M(_e)),en){if(Q.state.inputInsidePopup)H.current&&H.current.value!==``&&Bn(``,M(_e));else{let e=Et(q);H.current&&H.current.value!==e&&Bn(e,M(e===``?_e:O))}}}),qn=R.useMemo(()=>$&&Sn?{current:Sn.closest(`[role="dialog"]`)}:Bt,[$,Sn]);g({enabled:!e.actionsRef,open:Y,ref:qn,onComplete(){Y||Kn()}}),R.useImperativeHandle(e.actionsRef,()=>({unmount:Kn}),[Kn]),b(function(){let e=Lt.current!==null&&V===null;if(Lt.current=V,Y&&(!e||!G)||(Y||(Qt.current=null),f===`none`))return;let t=G?Z:Zt.current;zn({selectedIndex:Ge(t,q,P,W)})},[Y,V,q,f,W,G,Z,P,zn]),b(()=>{L&&(Zt.current=Z,Rt.current.length=Z.length)},[L,Z]),b(()=>{let e=Xt.current;if(e){let t=Y||$||Q.state.positionerElement?.hidden===!1;if(e.hasQuery)K&&t&&Q.set(`activeIndex`,0),Xt.current=null;else if(String(J).trim()===``&&(Xt.current=null,t)){let t=e.selection;K===`always`&&!t&&Q.state.selectionMode===`none`&&Q.set(`activeIndex`,0),queueMicrotask(()=>{if(!Q.state.open&&!Q.state.inline||H.current&&H.current.value.trim()!==``)return;let n=Q.state.selectedValue,r=Q.state.selectionMode===`multiple`;if(r&&Array.isArray(n)?n.length>0:Q.state.selectionMode!==`none`&&n!=null){let t=G||nn?Z:Zt.current,i=We(t,e.toggledValue,Q.state.isItemEqualToValue);Q.set(`activeIndex`,i===-1?Ge(t,n,Q.state.isItemEqualToValue,r):i)}else t?Q.set(`activeIndex`,null):K===`always`&&Q.set(`activeIndex`,0)})}}if(!Y&&!$)return;let t=G||nn?Z:Zt.current,n=Q.state.activeIndex;if(n==null){if(K===`always`&&t.length>0){Q.set(`activeIndex`,0);return}Rn(void 0,-1,O);return}if(n>=t.length){Rn(void 0,-1,O),Q.set(`activeIndex`,null);return}let r=t[n],i=Yt.current.value,a=i!==Pt&&Ye(r,i,Q.state.isItemEqualToValue);(Yt.current.index!==n||!a)&&Rn(r,n,O)},[bn,K,Rn,nn,G,Z,$,Y,Q,J]),b(()=>{if(f===`none`){$e(String(J)!==``);return}$e(W?Array.isArray(q)&&q.length>0:q!=null)},[$e,f,J,q,W]),R.useEffect(()=>{G&&K&&Z.length===0&&zn({activeIndex:null})},[G,K,Z.length,zn]);function Jn(){Y&&X!==``&&X!==String(on)&&!kn&&At(!0)}function Yn(){Y&&V!==null&&Vn(!1)}let Xn=!1;function Zn(){!Xn&&J!==un&&(Xn=!0,Bn(un,M(O)))}function Qn(){f!==`none`&&(Be($t),Ve(Qe(q,qe.initialValue,P)),ft.change(q),en&&!tn&&!Dn&&Zn())}function $n(){en&&!tn&&!Dn&&!Ot&&Zn()}function er(){f===`none`&&(Be($t),Ve(J!==qe.initialValue),ft.change(J))}ce(X,Jn),ce(Y,Yn),ce(q,Qn),ce(un,$n),ce(L,$n),ce(J,er);let tr=rt({open:$?!0:Y,onOpenChange:Hn,elements:{reference:Dn?wn:Tn,floating:Sn}}),nr=me?`grid`:`listbox`,rr=Y||$,ir=rr?`true`:`false`,ar=R.useMemo(()=>{let e=Tn?.tagName===`INPUT`,t=Tn==null||e,n=t||rr,r=t?{autoComplete:`off`,spellCheck:`false`,autoCorrect:`off`,autoCapitalize:`none`}:{};return n&&(r.role=`combobox`,r[`aria-expanded`]=ir,r[`aria-haspopup`]=nr,r[`aria-controls`]=rr?Cn?.id:void 0,r[`aria-autocomplete`]=E?`none`:Ne),{reference:r,floating:{role:`presentation`}}},[Tn,rr,ir,nr,Cn?.id,Ne,E]),or=Pe(tr,{enabled:!U&&ye,event:`mousedown-only`,toggle:!1,touchOpenDelay:Dn?0:100,reason:fe}),sr=S(tr,{enabled:!U&&!$,outsidePressEvent:{mouse:`sloppy`,touch:`intentional`},bubbles:$?!0:void 0,outsidePress(e){let t=se(e);return!i(wn,t)&&!i(qt.current,t)&&!i(Kt.current,t)&&!i(En,t)}}),cr=Ie(tr,{enabled:!U,id:mt,listRef:Rt,activeIndex:bn,selectedIndex:xn,virtual:!0,loopFocus:Te,allowEscape:Te&&!K,focusItemOnOpen:Ot||f===`none`&&!K?!1:`auto`,focusItemOnHover:we,resetOnPointerLeave:!Ce,orientation:me?`horizontal`:void 0,rtl:pt===`rtl`,disabledIndices:x,grid:me?_t:void 0,onNavigate(e,t){(t||Y)&&Nn!==`ending`&&zn(t?{activeIndex:e,type:Wt.current?ae:ne}:{activeIndex:e})}}),lr=R.useMemo(()=>ue(cr.reference,{onKeyDown(e){me&&Q.state.activeIndex==null&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&e.preventBaseUIHandler()}},sr.reference,or.reference,ar.reference),[cr.reference,sr.reference,or.reference,ar.reference,me,Q]),ur=R.useMemo(()=>ue(y,sr.floating),[sr.floating]),dr=R.useMemo(()=>ue(cr.floating,ar.floating),[cr.floating,ar.floating]),fr=R.useMemo(()=>{let e=cr.item;return e?{...e,onFocus:void 0}:ee},[cr.item]);Q.useContextCallback(`setOpen`,Hn),Q.useContextCallback(`setInputValue`,Bn),Q.useContextCallback(`setSelectedValue`,Un),Q.useContextCallback(`setIndices`,zn),Q.useContextCallback(`handleSelection`,Wn),Q.useContextCallback(`forceMount`,Ln),Q.useContextCallback(`requestSubmit`,Gn),Q.useContextCallback(`onOpenChangeComplete`,n),He(()=>{Q.update({inline:Ae,popupProps:ur,listProps:dr,inputProps:lr,triggerProps:Fn,itemProps:fr})});let pr={id:mt,selectedValue:q,open:Y,mounted:jn,transitionStatus:Nn,items:B,inline:Ae,popupProps:ur,listProps:dr,inputProps:lr,triggerProps:Fn,itemProps:fr,openMethod:Pn,selectionMode:f,name:$t,form:w,disabled:U,readOnly:E,required:D,grid:me,virtualized:Oe,openOnInputClick:ye,itemToStringLabel:wt,modal:Me,autoHighlight:K,isItemEqualToValue:P,submitOnItemClick:ze,hasInputValue:tn};b(()=>{Q.update({...pr,inputOwnsFormValue:f===`none`&&(Ae||!Q.state.inputInsidePopup)})},[Q,...Object.values(pr)]);let mr=A(oe,ft.inputRef),hr=R.useMemo(()=>({query:X,hasItems:G,filteredItems:hn,flatFilteredValues:Z}),[X,G,hn,Z]),gr=R.useMemo(()=>Array.isArray(gn)?``:Ue(gn,N),[gn,N]),_r=W&&Array.isArray(q)&&q.length>0,vr=W||f===`none`&&On?void 0:$t,yr=R.useMemo(()=>!W||!Array.isArray(q)||!$t?null:q.map(e=>{let t=Ue(e,N);return(0,z.jsx)(`input`,{type:`hidden`,form:w,name:$t,value:t,disabled:U},t)}),[W,q,w,$t,N,U]),br=(0,z.jsxs)(R.Fragment,{children:[e.children,(0,z.jsx)(`input`,{...ft.getValidationProps(U,{onFocus(){if(Dn){wn?.focus();return}(H.current||wn)?.focus()},onChange(e){if(e.nativeEvent.defaultPrevented||U||E)return;let t=e.currentTarget.value,n=t.toLowerCase(),r=M(O,e.nativeEvent),i=()=>Zt.current.findIndex(e=>Ue(e,N).toLowerCase()===n||Et(e).toLowerCase()===n);function a(){if(W)return;if(f===`none`){Bn(t,r);return}let e=i();e===-1&&(e=Zt.current.findIndex((e,t)=>{let r=zt.current[t];return r!=null&&r.toLowerCase()===n}));let a=e===-1?void 0:Zt.current[e];a!=null&&Un?.(a,r)}en&&(Ln(),L&&i()===-1&&Q.set(`forceMounted`,!0)),queueMicrotask(a)}}),id:mt&&vr==null?`${mt}-hidden-input`:void 0,form:w,name:vr,autoComplete:Fe,disabled:U,required:D&&!_r,readOnly:E,value:gr,ref:mr,style:vr?re:h,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),yr]});return(0,z.jsx)(vt.Provider,{value:Q,children:(0,z.jsx)(yt.Provider,{value:tr,children:(0,z.jsx)(xt.Provider,{value:G,children:(0,z.jsx)(bt.Provider,{value:hr,children:(0,z.jsx)(St.Provider,{value:J,children:br})})})})})}var Rt=`data-popup-side`,zt=`data-list-empty`,Bt={..._,...ft,popupSide:e=>e?{[Rt]:e}:null,listEmpty:e=>e?{[zt]:``}:null};function H(e){let t=e.useState(`mounted`),n=e.useState(`popupSide`),r=e.useState(`positionerElement`);return t&&r?n:null}function Vt(){return wt().filteredItems.length===0}function Ht(e){return e===`rtl`?[`ArrowRight`,`ArrowLeft`]:[`ArrowLeft`,`ArrowRight`]}function Ut(e,t){let n=e>=t-1?t-2:e;return n>=0?n:void 0}function Wt(e,t,n){let r=e.context.listRef.current[t];r&&(e.context.selectionEventRef.current=n,r.click(),e.context.selectionEventRef.current=null)}var Gt=R.forwardRef(function(e,t){let{render:n,className:r,nativeButton:a=!0,disabled:s=!1,id:c,style:l,...u}=e,{state:d,disabled:ee,setTouched:f,setFocused:p,validationMode:m,validation:h}=at(),{labelId:g}=ot(),_=B(),v=_.useState(`selectionMode`),y=_.useState(`disabled`),b=_.useState(`readOnly`),te=_.useState(`required`),x=_.useState(`positionerElement`),S=_.useState(`listElement`),w=_.useState(`popupId`),ne=_.useState(`triggerProps`),T=_.useState(`inputInsidePopup`),re=_.useState(`id`),ie=_.useState(`labelId`),ae=_.useState(`open`),k=_.useState(`selectedValue`),A=_.useState(`activeIndex`),ce=_.useState(`selectedIndex`),le=_.useState(`hasSelectedValue`),ue=Ct(),de=Tt(),fe=o(),pe=ee||y||s,me=Vt(),he=H(_);ut({id:T?c:void 0});let j=T?c??re:c,ge=tt(g,ie),_e;ae&&T?_e=w??Ot(re):ae&&(_e=S?.id);let ve=R.useRef(``);function ye(e){ve.current=e.pointerType}let{reference:be}=Oe(ue,{enabled:!ae&&!b&&!y&&v===`single`,listRef:_.context.labelsRef,activeIndex:A,selectedIndex:ce,onMatch(e){let t=_.context.valuesRef.current[e];t!==void 0&&_.context.setSelectedValue(t,M(O))}}),{reference:xe}=Pe(ue,{enabled:!y,event:`mousedown`}),{buttonRef:Se,getButtonProps:Ce}=Te({native:a,disabled:pe}),Ee={...d,readOnly:b,open:ae,disabled:pe,popupSide:he,listEmpty:me,placeholder:v!==`none`&&!le},De=C(e=>{_.set(`triggerElement`,e)});return oe(`button`,e,{ref:[t,Se,De],state:Ee,props:[ne,xe,be,{id:j,tabIndex:T?0:-1,role:T?`combobox`:void 0,"aria-expanded":ae,"aria-haspopup":T?`dialog`:`listbox`,"aria-controls":_e,"aria-required":T&&te||void 0,"aria-readonly":T&&b||void 0,"aria-labelledby":ge,onPointerDown:ye,onPointerEnter:ye,onFocus(){p(!0),!pe&&fe.start(0,_.context.forceMount)},onBlur(e){if(!i(x,e.relatedTarget)&&(f(!0),p(!1),m===`onBlur`)){let e=v===`none`?de:k;h.commit(e)}},onMouseDown(e){if(pe||(T||ue.set(`domReferenceElement`,e.currentTarget),_.context.forceMount(),ve.current!==`touch`&&(_.context.inputRef.current?.focus(),T||e.preventDefault()),ae))return;let t=E(e.currentTarget);function n(e){let t=_.state.triggerElement;if(!t)return;let n=se(e),r=_.state.positionerElement,a=_.state.listElement;i(t,n)||i(r,n)||i(a,n)||je(e,t)||_.context.setOpen(!1,M(D,e))}T&&t.addEventListener(`mouseup`,n,{once:!0})},onKeyDown(e){(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(N(e),_.context.setOpen(!0,M(we,e.nativeEvent)),_.context.inputRef.current?.focus())}},h.getValidationProps(pe,u),Ce],stateAttributesMapping:Bt})}),Kt=R.createContext(void 0);function qt(){return R.useContext(Kt)}var Jt=R.createContext(void 0);function Yt(e){let t=R.useContext(Jt);if(t===void 0&&!e)throw Error(v(21));return t}var Xt=R.forwardRef(function(e,t){let n=B(),{buttonRef:r,getButtonProps:i}=Te({native:!1}),a=A(t,r);function o(e){n.context.setOpen(!1,M(xe,e.nativeEvent,e.currentTarget))}let s=i({onClick:o});return(0,z.jsx)(`span`,{ref:a,...s,"aria-label":`Dismiss`,tabIndex:void 0,style:re})}),Zt=R.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,id:a,style:o,...s}=e,{state:c,disabled:u,setTouched:d,setFocused:ee,validationMode:f,validation:p}=at(),{labelId:m}=ot(),h=qt(),g=!!Yt(!0),_=B(),v=Tt(),y=Le(),b=_.useState(`required`),te=_.useState(`disabled`),x=_.useState(`readOnly`),S=_.useState(`name`),w=_.useState(`form`),T=_.useState(`selectionMode`),E=_.useState(`autoHighlight`),re=_.useState(`inputProps`),ie=_.useState(`triggerProps`),D=_.useState(`open`),k=_.useState(`mounted`),A=_.useState(`selectedValue`),se=_.useState(`id`),ce=_.useState(`inline`),le=_.useState(`modal`),ue=!!E,de=H(_),fe=u||te||i,pe=Vt(),j=g||ce,ge=!j||le,ve=me(a??(j?void 0:se)),ye=g?st:c,[xe,Se]=R.useState(null),Ce=R.useRef(!1),we=R.useRef(null),Te=R.useRef(!1),De=T===`none`&&!g,P=C(e=>{let t=g||_.state.inline;t&&!_.state.hasInputValue&&_.context.setInputValue(``,M(O)),_.update({inputElement:e,inputInsidePopup:t,inputOwnsFormValue:De})}),Oe=g?s:p.getValidationProps(fe,s);function ke(){_.context.setIndices({activeIndex:null,selectedIndex:null,type:_.context.keyboardActiveRef.current?ae:ne})}function Ae(){_.context.keyboardActiveRef.current=!1}let je={...ye,open:D,disabled:fe,readOnly:x,popupSide:de,listEmpty:pe};function Me(e){if(!h)return;let t,{highlightedChipIndex:n}=h,r=h.chipsRef.current.length,[i,a]=Ht(y);return n===void 0?(e.key===i&&(e.currentTarget.selectionStart??0)===0&&A.length>0&&(e.preventDefault(),t=r>0?r-1:void 0),t):(e.key===i?(e.preventDefault(),t=n>0?n-1:void 0):e.key===a?(e.preventDefault(),t=n<r-1?n+1:void 0):(e.key===`Backspace`||e.key===`Delete`)&&(e.preventDefault(),t=Ut(n,A.length),ke()),t)}let F=oe(`input`,e,{state:je,ref:[t,_.context.inputRef,P],props:[re,ie,{value:xe??v,"aria-readonly":x||void 0,"aria-required":b||void 0,"aria-labelledby":m,disabled:fe,readOnly:x,required:T===`none`?b:void 0,form:w,...De&&S&&{name:S},id:ve,onFocus(){if(ee(!0),!ce||!Te.current)return;Te.current=!1;let e=we.current;e!=null&&Object.hasOwn(_.context.valuesRef.current,e)&&_.context.setIndices({activeIndex:e})},onBlur(){d(!0),ee(!1);let e=_.state.activeIndex;if(ce&&e!==null&&E!==`always`&&(we.current=e,Te.current=!0,_.context.setIndices({activeIndex:null})),f===`onBlur`){let e=T===`none`?v:A;p.commit(e)}},onCompositionStart(e){l||(Ce.current=!0,Se(e.currentTarget.value))},onCompositionEnd(e){Ce.current=!1;let t=e.currentTarget.value;Se(null),_.context.setInputValue(t,M(be,e.nativeEvent))},onChange(e){let t=e.nativeEvent,n=t.inputType,r=!n||n===`insertReplacementText`,i=Ce.current||!r;function a(e){!x&&!fe&&e&&i&&(_.context.setOpen(!0,M(be,t)),ue||ke())}if(Ce.current){let n=e.currentTarget.value;Se(n),n===``&&!_.state.openOnInputClick&&!_.state.inputInsidePopup&&_.context.setOpen(!1,M(_e,t));let r=n.trim(),i=ue&&r!==``;a(r),D&&_.state.activeIndex!==null&&!i&&ke();return}let o=M(be,t);if(_.context.setInputValue(e.currentTarget.value,o),o.isCanceled)return;let s=e.currentTarget.value===``,c=M(_e,t);s&&!_.state.inputInsidePopup&&(T===`single`&&_.context.setSelectedValue(null,c),_.state.openOnInputClick||_.context.setOpen(!1,c)),a(e.currentTarget.value.trim()),D&&_.state.activeIndex!==null&&!ue&&ke()},onKeyDown(e){if(e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;if(_.context.keyboardActiveRef.current=!0,fe||x){x&&e.key===`Enter`&&D&&_.state.activeIndex!==null&&N(e);return}let t=e.currentTarget,n=t.scrollWidth-t.clientWidth,r=y===`rtl`;if(e.key===`Home`){N(e);let n=Ee&&r?t.value.length:0;t.setSelectionRange(n,n),t.scrollLeft=0;return}if(e.key===`End`){N(e);let i=Ee&&r?0:t.value.length;t.setSelectionRange(i,i),t.scrollLeft=r?-n:n;return}if(!k&&e.key===`Escape`){let t=T===`multiple`&&Array.isArray(A)?A.length===0:A===null,n=M(he,e.nativeEvent),r=T===`multiple`?[]:null;_.context.setInputValue(``,n),_.context.setSelectedValue(r,n),!t&&!_.state.inline&&!n.isPropagationAllowed&&e.stopPropagation();return}if(h&&e.key===`Backspace`&&t.value===``&&h.highlightedChipIndex===void 0&&Array.isArray(A)&&A.length>0){let t=h.chipsRef.current.length,n=t>0?t-1:A.length-1,r=A.filter((e,t)=>t!==n);ke(),_.context.setSelectedValue(r,M(O,e.nativeEvent));return}let i=h?.highlightedChipIndex!==void 0,a=Me(e);if(h?.setHighlightedChipIndex(a),a===void 0?i&&_.context.inputRef.current?.focus():h?.chipsRef.current[a]?.focus(),e.which!==229&&e.key===`Enter`&&D){let t=_.state.activeIndex,n=e.nativeEvent;if(t===null){if(ce)return;_.context.setOpen(!1,M(O,n));return}N(e),Wt(_,t,n)}},onPointerMove:Ae,onPointerDown:Ae},Oe],stateAttributesMapping:Bt}),Ne=g?(0,z.jsx)(dt.Provider,{value:lt,children:F}):F;return(0,z.jsxs)(R.Fragment,{children:[D&&ge&&(0,z.jsx)(Xt,{ref:_.context.startDismissRef}),Ne]})}),Qt={...f,...w},U=R.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,keepMounted:o=!1,style:s,...c}=e,{disabled:l}=at(),u=B(),d=u.useState(`selectionMode`),ee=u.useState(`disabled`),f=u.useState(`readOnly`),p=u.useState(`open`),h=u.useState(`selectedValue`),_=u.useState(`hasSelectionChips`),v=Tt(),y=!1;y=d===`none`?v!==``:d===`single`?h!=null:_;let b=l||ee||i,{buttonRef:te,getButtonProps:x}=Te({native:a,disabled:b}),{mounted:S,transitionStatus:C,setMounted:w}=m(y),T={disabled:b,visible:y,open:p,transitionStatus:C};g({open:y,ref:u.context.clearRef,onComplete(){y||w(!1)}});let E=oe(`button`,e,{state:T,ref:[t,te,u.context.clearRef],props:[{tabIndex:-1,children:`x`,onMouseDown(e){e.preventDefault()},onClick(e){if(b||f)return;let t=u.context.keyboardActiveRef.current?ae:ne;u.context.setInputValue(``,M(ve,e.nativeEvent)),d===`none`?u.context.setIndices({activeIndex:null,type:t}):(u.context.setSelectedValue(Array.isArray(h)?[]:null,M(ve,e.nativeEvent)),u.context.setIndices({activeIndex:null,selectedIndex:null,type:t})),u.context.inputRef.current?.focus()}},c,x],stateAttributesMapping:Qt});return o||S?E:null}),$t=R.createContext(null);function W(){return R.useContext($t)}function en(e){let{children:t}=e,{filteredItems:n}=wt(),r=W(),i=r?r.items:n;return(0,z.jsx)(R.Fragment,{children:i.map(t)})}var tn=R.forwardRef(function(e,t){var n;let{render:r,className:i,style:a,children:o,...s}=e,c=B(),l=Ct(),u=!!Yt(!0),{filteredItems:d,hasItems:ee}=wt(),f=c.useState(`selectionMode`),p=c.useState(`grid`),m=c.useState(`readOnly`),h=c.useState(`listProps`),g=c.useState(`virtualized`),_=c.useState(`forceMounted`),v=f===`multiple`,y=d.length===0,b=C(e=>{c.set(`positionerElement`,e)}),te=C(e=>{c.set(`listElement`,e)}),x=R.useMemo(()=>typeof o==`function`?n||=(0,z.jsx)(en,{children:o}):o,[o]),S={empty:y},w=l.useState(`floatingId`),ne=oe(`div`,e,{state:S,ref:[t,te,u?null:b],props:[h,{children:x,tabIndex:-1,id:w,role:p?`grid`:`listbox`,"aria-multiselectable":v?`true`:void 0,"aria-readonly":!p&&m?!0:void 0,onKeyDown(e){if(!(c.state.disabled||c.state.readOnly)&&e.key===`Enter`){let t=c.state.activeIndex;if(t==null)return;N(e),Wt(c,t,e.nativeEvent)}},onKeyDownCapture(){c.context.keyboardActiveRef.current=!0},onPointerMoveCapture(){c.context.keyboardActiveRef.current=!1}},s]});if(g)return ne;let T=ee&&!_?void 0:c.context.labelsRef;return(0,z.jsx)(F,{elementsRef:c.context.listRef,labelsRef:T,children:ne})}),G=`⁠`;function nn(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=null;for(;t.nextNode();){let e=t.currentNode;e.nodeValue!==``&&(n=e)}return n}function K(){let e=o(),t=R.useRef(null);return R.useEffect(()=>{if(c)return;let n=t.current;if(n==null)return;let r=nn(n);if(r==null)return;let i=r.data,a=`${i}${G}`;return r.nodeValue=a,e.start(200,()=>{r.nodeValue===a&&(r.nodeValue=i)}),()=>{e.clear(),r.nodeValue===a&&(r.nodeValue=i)}},[t,e]),t}var q=R.createContext(void 0);function rn(){let e=R.useContext(q);if(e===void 0)throw Error(v(20));return e}var an=R.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=B(),a=i.useState(`mounted`),o=i.useState(`forceMounted`);return a||n||o?(0,z.jsx)(q.Provider,{value:n,children:(0,z.jsx)(ye,{ref:t,...r})}):null}),on=R.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:ee,sticky:f,disableAnchorTracking:p=!1,collisionAvoidance:m=j,style:h,...g}=e,_=B(),v=Ct(),y=rn(),x=_.useState(`modal`),S=_.useState(`open`),w=_.useState(`mounted`),ne=_.useState(`openMethod`),T=_.useState(`positionerElement`),E=_.useState(`triggerElement`),re=_.useState(`inputElement`),ie=_.useState(`inputGroupElement`),ae=_.useState(`inputInsidePopup`),D=_.useState(`transitionStatus`),O=Vt(),k=Ae({anchor:i??(ae?E:ie??re),floatingRootContext:v,positionMethod:a,mounted:w,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:ee,collisionBoundary:u,collisionPadding:d,sticky:f,disableAnchorTracking:p,keepMounted:y,collisionAvoidance:m,lazyFlip:!0});Me(S&&x,ne===`touch`,T,E);let oe={open:S,side:k.side,align:k.align,anchorHidden:k.anchorHidden,empty:O};b(()=>{_.set(`popupSide`,k.side)},[_,k.side]);let A=C(e=>{_.set(`positionerElement`,e)}),se=Fe(e,oe,{styles:k.positionerStyles,transitionStatus:D,props:g,refs:[t,A],hidden:!w,inert:!S});return(0,z.jsxs)(Jt.Provider,{value:k,children:[w&&x&&(0,z.jsx)(ge,{inert:te(!S),cutout:ie??re??E}),se]})}),J={...d,...f},sn=R.forwardRef(function(e,t){let{render:n,className:a,style:o,initialFocus:s,finalFocus:c,...l}=e,u=B(),d=Yt(),ee=Ct(),f=u.useState(`mounted`),p=u.useState(`open`),m=u.useState(`openMethod`),h=u.useState(`popupProps`),_=u.useState(`transitionStatus`),v=u.useState(`inputInsidePopup`),y=u.useState(`inputElement`),te=u.useState(`modal`),x=u.useState(`id`),S=Vt(),C=l.id??(v?Ot(x):void 0);b(()=>(u.set(`popupId`,u.context.popupRef.current?.id||C),()=>{u.set(`popupId`,void 0)}),[u,C]),g({open:p,ref:u.context.popupRef,onComplete(){p&&u.context.onOpenChangeComplete(!0)}});let w={open:p,side:d.side,align:d.align,anchorHidden:d.anchorHidden,transitionStatus:_,empty:S},ne=oe(`div`,e,{state:w,ref:[t,u.context.popupRef],props:[h,{id:C,role:v?`dialog`:`presentation`,onFocus(e){let t=se(e.nativeEvent);m!==`touch`&&(i(u.state.listElement,t)||t===e.currentTarget)&&u.context.inputRef.current?.focus()}},Re(_),l],stateAttributesMapping:J}),T=s===void 0?v?e=>e===`touch`?u.context.popupRef.current:y:!1:s,E;E=c??(v?void 0:!1);let re=!v||te;return(0,z.jsx)(r,{context:ee,disabled:!f,modal:re,openInteractionType:m,initialFocus:T,returnFocus:E,getInsideElements:()=>[u.context.startDismissRef.current,u.context.endDismissRef.current],children:(0,z.jsxs)(R.Fragment,{children:[ne,re&&(0,z.jsx)(Xt,{ref:u.context.endDismissRef})]})})}),Y=R.createContext(void 0);function cn(){let e=R.useContext(Y);if(!e)throw Error(v(19));return e}var ln=R.createContext(!1);function X(){return R.useContext(ln)}function un(e){let{componentProps:t,forwardedRef:n,virtualized:r,indexFromFilter:i}=e,{render:a,className:o,style:s,value:c=null,index:l,disabled:u=!1,nativeButton:d=!1,...ee}=t,f=R.useRef(null),p=Ne({guess:!0,index:l,textRef:f}),m=B(),h=X(),g=Et(),_=m.useState(`selectionMode`),v=m.useState(`disabled`),y=m.useState(`readOnly`),te=m.useState(`isItemEqualToValue`),x=v||u,S=_!==`none`,C=l??i??p.index,w=C!==-1,ne=m.useState(`id`),T=m.useState(`isActive`,C),E=m.useState(`isSelected`,c),re=m.useState(`itemProps`),ie=R.useRef(null),ae=ne!=null&&w?`${ne}-${C}`:void 0,D=E&&S;b(()=>{if(!w||!r&&l==null)return;let e=m.context.listRef.current;return e[C]=ie.current,()=>{delete e[C]}},[w,r,C,l,m]),b(()=>{if(!w||g)return;let e=m.context.valuesRef.current;return e[C]=c,()=>{delete e[C]}},[w,g,C,c,m]),b(()=>{if(!w||g)return;let e=m.state.selectedValue,t=m.state.selectedIndex;m.state.selectionMode===`multiple`&&Array.isArray(e)?t=qe(C,c,m.context.valuesRef.current,e,te,t):Ye(c,e,te)&&(t=C),m.set(`selectedIndex`,t)},[w,g,m,C,c,te]);let{getButtonProps:O,buttonRef:k}=Te({disabled:x,focusableWhenDisabled:!0,native:d,composite:!0}),A={disabled:x,selected:D,highlighted:T};function se(e){function t(){m.context.handleSelection(e,c)}m.state.submitOnItemClick?(gt.flushSync(t),m.context.requestSubmit()):t()}let ce={id:ae,role:h?`gridcell`:`option`,"aria-selected":S?D:void 0,tabIndex:void 0,onPointerDownCapture(e){e.isPrimary&&(m.context.pointerDownItemRef.current=e.currentTarget),e.preventDefault()},onMouseDown(e){e.preventDefault()},onClick(e){x||y||se(e.nativeEvent)},onMouseUp(e){let t=m.context.pointerDownItemRef.current===e.currentTarget;m.context.pointerDownItemRef.current=null,!(x||y||e.button!==0||t||!T)&&se(e.nativeEvent)}},le=oe(`div`,t,{ref:[k,n,p.ref,ie],state:A,props:[re,ce,ee,O]}),ue=R.useMemo(()=>({selected:D,textRef:f}),[D,f]);return(0,z.jsx)(Y.Provider,{value:ue,children:le})}function dn(e){let{componentProps:t,forwardedRef:n}=e,r=B().useState(`isItemEqualToValue`),{flatFilteredValues:i}=wt(),a=t.value??null,o=We(i,a,r);return(0,z.jsx)(un,{componentProps:t,forwardedRef:n,virtualized:!0,indexFromFilter:o})}var fn=R.memo(R.forwardRef(function(e,t){let n=B().useState(`virtualized`);return n&&e.index==null?(0,z.jsx)(dn,{componentProps:e,forwardedRef:t}):(0,z.jsx)(un,{componentProps:e,forwardedRef:t,virtualized:n,indexFromFilter:void 0})})),pn=R.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{filteredItems:s}=wt(),c=B(),l=K(),u=s.length===0?a:null;return oe(`div`,e,{ref:[t,c.context.emptyRef,l],props:[{children:u,role:`status`,"aria-live":`polite`,"aria-atomic":!0},o]})});function mn(e){let{multiple:t=!1,defaultValue:n,value:r,onValueChange:i,autoComplete:a,...o}=e;return(0,z.jsx)(Lt,{...o,selectionMode:t?`multiple`:`single`,selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:i,formAutoComplete:a})}var hn=R.forwardRef(function(e,t){let{selected:n}=cn();return e.keepMounted||n?(0,z.jsx)(Z,{...e,ref:t}):null}),Z=R.memo(R.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=cn(),c=R.useRef(null),{transitionStatus:l,setMounted:u}=m(s),d=oe(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:f});return g({batch:!0,enabled:!s,open:s,ref:c,onComplete(){s||u(!1)}}),d})),Q=mn;function gn({className:e,children:t,...n}){return(0,z.jsxs)(Gt,{"data-slot":`combobox-trigger`,className:Ve(`[&_svg:not([class*='size-'])]:size-4`,e),...n,children:[t,(0,z.jsx)(P,{className:`pointer-events-none size-4 text-muted-foreground`})]})}function _n({className:e,...t}){return(0,z.jsx)(U,{"data-slot":`combobox-clear`,render:(0,z.jsx)(pt,{variant:`ghost`,size:`icon-xs`}),className:Ve(e),...t,children:(0,z.jsx)(ze,{className:`pointer-events-none`})})}function vn({className:e,children:t,disabled:n=!1,showTrigger:r=!0,showClear:i=!1,...a}){return(0,z.jsxs)(I,{className:Ve(`w-auto`,e),children:[(0,z.jsx)(Zt,{render:(0,z.jsx)(ht,{disabled:n}),...a}),(0,z.jsxs)(mt,{align:`inline-end`,children:[r&&(0,z.jsx)(pt,{size:`icon-xs`,variant:`ghost`,render:(0,z.jsx)(gn,{}),"data-slot":`input-group-button`,className:`group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent`,disabled:n}),i&&(0,z.jsx)(_n,{disabled:n})]}),t]})}function yn({className:e,side:t=`bottom`,sideOffset:n=6,align:r=`start`,alignOffset:i=0,anchor:a,...o}){return(0,z.jsx)(an,{children:(0,z.jsx)(on,{side:t,sideOffset:n,align:r,alignOffset:i,anchor:a,className:`isolate z-50`,children:(0,z.jsx)(sn,{"data-slot":`combobox-content`,"data-chips":!!a,className:Ve(`group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...o})})})}function bn({className:e,...t}){return(0,z.jsx)(tn,{"data-slot":`combobox-list`,className:Ve(`no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0`,e),...t})}function xn({className:e,children:t,...n}){return(0,z.jsxs)(fn,{"data-slot":`combobox-item`,className:Ve(`relative flex w-full cursor-default items-center gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n,children:[t,(0,z.jsx)(hn,{render:(0,z.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,z.jsx)(s,{className:`pointer-events-none`})})]})}function Sn({className:e,...t}){return(0,z.jsx)(pn,{"data-slot":`combobox-empty`,className:Ve(`hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex`,e),...t})}function Cn(){return R.useRef(null)}function wn(e,t){let n=t.toLowerCase().split(/\s+/u).filter(Boolean),r=`${e.label} ${e.aside}`.toLowerCase();return n.every(e=>r.includes(e))}function Tn({id:e,value:t,options:n,placeholder:r,label:i,onChange:a}){let o=n.find(e=>e.value===t)??null,s=Cn();return(0,z.jsxs)(Q,{items:n,value:o,itemToStringLabel:e=>e.label,filter:(e,t)=>wn(e,t),onValueChange:e=>{a(e===null?``:e.value)},children:[(0,z.jsx)(`div`,{ref:s,children:(0,z.jsxs)(vn,{id:e,"aria-label":i,placeholder:r,className:`bg-field dark:bg-field`,showTrigger:!1,children:[o?.mark!==void 0&&(0,z.jsx)(mt,{align:`inline-start`,children:(0,z.jsx)(L,{glyph:o.mark})}),(0,z.jsxs)(mt,{align:`inline-end`,children:[o!==null&&o.aside!==``&&(0,z.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:o.aside}),(0,z.jsx)(pt,{size:`icon-xs`,variant:`ghost`,render:(0,z.jsx)(gn,{})})]})]})}),(0,z.jsxs)(yn,{anchor:s,children:[(0,z.jsx)(Sn,{children:`No match.`}),(0,z.jsx)(bn,{children:e=>(0,z.jsxs)(xn,{value:e,children:[e.mark!==void 0&&(0,z.jsx)(L,{glyph:e.mark}),(0,z.jsx)(`span`,{className:`truncate`,children:e.label}),e.aside!==``&&(0,z.jsx)(`span`,{className:`ml-auto font-mono text-xs whitespace-nowrap text-muted-foreground`,children:e.aside})]},e.value)})]})]})}export{Tn as t};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PipelineGraph-B3WZx-gR.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/react-CQOZoUwg.js","assets/with-selector-BXYKoaOE.js","assets/dropdown-menu-B-6CcHKw.js","assets/api-Bm1JZLuC.js","assets/utils-CT7ZGLfR.js","assets/StepPorts-Du1E90r1.js","assets/maximize-2-BdFIT4cn.js","assets/index-C3S0GbYv.js","assets/dist-DD8kpv1W.js","assets/preload-helper-BZ1Pz5am.js","assets/chunk-OB3PAWPO-DOp4K52_.js","assets/nav-i7bJ0lrA.js","assets/play-CPVSEWx6.js","assets/file-braces-Ep8AP5Yq.js","assets/chevron-down-DAO3SUWv.js","assets/glyphs-C1sjljkh.js","assets/PageState-BLuobMye.js","assets/paging-CpRIkEky.js","assets/ListTable-Bf1eJYg4.js","assets/docs-CCoB3shg.js","assets/x-Dltw6Vbs.js","assets/tooltip-D7_KwbOU.js","assets/input-1fShkFXn.js","assets/textarea-ljIbN_md.js","assets/use-store-CfRquqZF.js","assets/store-C2zgoyrT.js","assets/auth-CHgfcdt9.js","assets/idle-DnO3aHK7.js","assets/format-B5YbYOY-.js","assets/status-Ctx8x8Mf.js","assets/use-heartbeat-CBT8848s.js","assets/identity-BNZxCf_y.js","assets/pipelines-Pi3WL8R6.js","assets/index-DfjqILVM.css","assets/KindChip-CwU_Xxdy.js","assets/PipelineTab-ZN5ffD11.js","assets/Description-MmXUnb-9.js","assets/Panel-CqrOYByl.js","assets/copy-BeBwg8IR.js","assets/connections-DsdoSARb.js","assets/Instant-mr1E5jAK.js","assets/StarterPicker-7qIa398g.js","assets/examples-DDWkSZ2u.js","assets/blocks-CclbVd8c.js","assets/schemas-7KY_7aIc.js","assets/starters-CgC7I45V.js","assets/Refusal-BWl1-jC1.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{r as n}from"./with-selector-BXYKoaOE.js";import{t as r}from"./preload-helper-BZ1Pz5am.js";import{c as i,l as a,s as o}from"./chunk-OB3PAWPO-DOp4K52_.js";import{n as s,t as c}from"./play-CPVSEWx6.js";import{t as l}from"./api-Bm1JZLuC.js";import{a as u,i as d,n as f,r as p,t as m}from"./select-BHa3vRob.js";import{a as ee,n as h,o as g,s as te}from"./PageState-BLuobMye.js";import{t as _}from"./x-Dltw6Vbs.js";import{r as v,t as y}from"./utils-CT7ZGLfR.js";import{d as b,f as x}from"./paging-CpRIkEky.js";import{t as S}from"./input-1fShkFXn.js";import{n as C,t as w}from"./SchemaForm-jWG6iOB3.js";import{t as ne}from"./use-store-CfRquqZF.js";import{t as T}from"./store-C2zgoyrT.js";import{t as re}from"./auth-CHgfcdt9.js";import{b as ie,l as ae,x as oe,y as se}from"./format-B5YbYOY-.js";import{r as E}from"./docs-CCoB3shg.js";import{r as ce,t as le}from"./identity-BNZxCf_y.js";import{a as ue,c as de,d as fe,f as pe,g as me,n as D,o as he,v as ge}from"./pipelines-Pi3WL8R6.js";import{Bt as _e,E as O,Ft as k,Lt as ve,Mt as A,Nt as ye,Pt as j,at as M,b as be,ct as N,et as xe,ht as Se,jt as Ce,kt as we,l as Te,t as Ee,tt as De,ut as Oe,y as ke,zt as Ae}from"./index-C3S0GbYv.js";import{r as je}from"./Panel-CqrOYByl.js";import{t as Me}from"./WindowedPane-dMHnDqVB.js";import{c as Ne,i as P,s as Pe,t as Fe}from"./blocks-CclbVd8c.js";import{F,M as Ie,P as I,S as Le,f as Re,y as L}from"./connections-DsdoSARb.js";import{i as ze}from"./schemas-7KY_7aIc.js";import{t as Be}from"./Refusal-BWl1-jC1.js";import{t as Ve}from"./KindChip-CwU_Xxdy.js";import{A as He,C as Ue,D as We,E as Ge,M as Ke,O as qe,S as Je,T as R,_ as Ye,a as Xe,b as Ze,c as z,d as Qe,f as B,g as $e,h as et,i as tt,j as nt,k as rt,l as it,n as at,o as ot,p as st,s as ct,t as lt,u as ut,v as dt,w as ft,x as pt}from"./PipelineTab-ZN5ffD11.js";import{t as mt}from"./Segmented-KaDiGiyr.js";import{t as V}from"./ProgramReference-DF37mMAT.js";import{t as ht}from"./Breadcrumb-x6p00HyX.js";var H={name:`layout-grid`,size:24,node:[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]};H.node;var gt=n(H),_t={name:`shield-check`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]};_t.node;var vt=n(_t),U=e(t(),1),W=v(),G=/^[a-z][a-z0-9_]*$/,yt={sensor:`sensor`,sensors:`sensor`,operator:`operator`,operators:`operator`};function K(e){let t=P(e.id),n=e.id.indexOf(`.`);return{entry:e,family:t,rest:n===-1?e.id:e.id.slice(n+1)}}function q(e){return Fe(e).map(([e,t])=>({shelf:e,blocks:t}))}function bt(e,t){let n=t.toLowerCase().split(/\s+/).filter(e=>e!==``);return n.length===0?[]:e.filter(e=>n.every(t=>xt(e,t))).toSorted((e,t)=>e.id.localeCompare(t.id)).map(K)}function xt(e,t){return yt[t]===e.kind||`${e.id} ${e.summary}`.toLowerCase().includes(t)}function St(e,t){let n=Ct(e);if(!t.includes(n))return n;for(let e=2;;e+=1){let r=`${n}_${String(e)}`;if(!t.includes(r))return r}}function Ct(e){let t=e.indexOf(`.`),n=(t===-1?e:e.slice(t+1)).toLowerCase().replaceAll(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``);return n===``||!G.test(n)?`step_${n}`.replace(/_$/,``):n}var wt=T(0);function Tt(){wt.set(wt.get()+1)}var Et=T(0);function Dt(){Et.set(Et.get()+1)}var Ot=`dirigent.layout.`;function kt(e){return`${Ot}${e}`}var J=T({pipeline:null,placements:{}});function At(e){let t=null;try{t=localStorage.getItem(kt(e))}catch{return{}}if(t===null)return{};let n;try{n=JSON.parse(t)}catch{return{}}if(typeof n!=`object`||!n||Array.isArray(n))return{};let r={};for(let[e,t]of Object.entries(n)){let n=t;typeof n==`object`&&n&&typeof n.x==`number`&&typeof n.y==`number`&&Number.isFinite(n.x)&&Number.isFinite(n.y)&&(r[e]={x:n.x,y:n.y})}return r}function jt(e,t){try{Object.keys(t).length===0?localStorage.removeItem(kt(e)):localStorage.setItem(kt(e),JSON.stringify(t))}catch{}}function Mt(e){J.set({pipeline:e,placements:At(e)})}function Nt(e,t){J.update(n=>({...n,placements:{...n.placements,[e]:t}}))}function Pt(){let e=J.get();e.pipeline!==null&&jt(e.pipeline,e.placements)}function Ft(e,t){Nt(e,t),Pt()}function It(){let e=J.get();e.pipeline!==null&&jt(e.pipeline,{}),J.set({pipeline:e.pipeline,placements:{}})}function Lt(e,t){return e.map(e=>{let n=t[e.id];return n===void 0?e:{...e,x:n.x,y:n.y}})}function Rt({view:e}){return(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(`p`,{className:e.tone===`critical`?`text-sm text-critical`:`text-sm`,children:e.headline}),e.changes.length>0&&(0,W.jsx)(`ul`,{className:`list-disc space-y-0.5 pl-4 text-xs text-muted-foreground`,children:e.changes.map(e=>(0,W.jsx)(`li`,{children:e},e))}),e.issues.length>0&&(0,W.jsxs)(`div`,{className:`space-y-1 rounded-md border border-critical/40 p-2`,role:`alert`,children:[(0,W.jsxs)(`p`,{className:`text-xs font-medium text-critical`,children:[e.issues.length,` issue`,e.issues.length===1?``:`s`,` — apply will refuse`]}),(0,W.jsx)(`ul`,{className:`space-y-0.5 text-xs`,children:e.issues.map(e=>(0,W.jsxs)(`li`,{children:[(0,W.jsx)(`span`,{className:`font-mono`,children:e.location}),` `,(0,W.jsx)(`span`,{className:`text-muted-foreground`,children:e.message})]},`${e.location}:${e.message}`))})]}),e.issues.length===0&&e.changes.length===0&&e.tone!==`critical`&&(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No changes from the stored version.`})]})}function zt(e){let t=e.issues;switch(e.action){case`invalid`:return{headline:`Apply will refuse ${e.code}`,tone:`critical`,changes:[],issues:t,applicable:!1};case`unchanged`:return{headline:`Apply writes nothing — ${e.code} is already at this document`,tone:`quiet`,changes:[],issues:t,applicable:!1};case`create`:return{headline:`Apply creates ${e.code} at version 1`,tone:`good`,changes:Bt(e.diff),issues:t,applicable:!0};case`update`:return{headline:`Apply writes version ${String(e.next_version??0)} of ${e.code}`,tone:`good`,changes:Bt(e.diff),issues:t,applicable:!0}}}function Bt(e){if(e===null)return[];let t=[];return e.steps_added.length>0&&t.push(`steps added: ${e.steps_added.join(`, `)}`),e.steps_removed.length>0&&t.push(`steps removed: ${e.steps_removed.join(`, `)}`),e.steps_changed.length>0&&t.push(`steps changed: ${e.steps_changed.join(`, `)}`),e.params_changed&&t.push(`the parameter schema changed`),e.triggers_changed&&t.push(`the triggers changed`),e.settings_changed&&t.push(`the name, description, or concurrency policy changed`),t}function Vt(e){return e.length===0?null:`${String(e.length)} issue${e.length===1?``:`s`} — apply will refuse`}var Ht=`Apply document`,Ut=`Validate document`,Wt=`Apply`;function Gt({open:e,mode:t,document:n,onOpenChange:r,onPlan:i,onApplied:a}){let[o,s]=(0,U.useState)(null),[c,l]=(0,U.useState)(null),[u,d]=(0,U.useState)(!1),f=ke();return(0,U.useEffect)(()=>{if(!e)return;let t=!1;return s(null),l(null),D(n,!0).then(e=>{t||(s(zt(e.plan)),i?.(e.plan))},e=>{t||l(b(e))}),()=>{t=!0}},[n,e]),(0,W.jsx)(we,{open:e,onOpenChange:r,children:(0,W.jsxs)(Ce,{className:`sm:max-w-lg`,children:[(0,W.jsxs)(j,{children:[(0,W.jsx)(k,{children:t===`apply`?Ht:Ut}),t===`validate`&&(0,W.jsx)(A,{children:`Nothing was written.`})]}),c!==null&&(0,W.jsx)(Be,{problem:c}),c===null&&o===null&&(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Checking the document.`}),o!==null&&(0,W.jsx)(Rt,{view:o}),(0,W.jsxs)(ye,{children:[(0,W.jsx)(x,{variant:`outline`,onClick:()=>r(!1),children:t===`apply`?`Cancel`:`Close`}),t===`apply`&&(0,W.jsx)(qt,{why:be(f.why,Kt(o)),busy:u,onApply:()=>{d(!0),D(n,!1).then(e=>{d(!1),a(e),r(!1)},e=>{d(!1),l(b(e))})}})]})]})})}function Kt(e){return e===null?`The document has not been checked yet.`:e.applicable?void 0:`This document is not one the instance would accept.`}function qt({why:e,busy:t,onApply:n}){return(0,W.jsx)(g,{why:e,children:(0,W.jsx)(x,{disabled:t||e!==void 0,title:e,onClick:n,children:Wt})})}var Jt=`report/template`,Yt=`report.template`,Xt=[{value:`none`,label:`No report`},{value:`builtin`,label:`Built-in template`},{value:`own`,label:`Own template`}];function Zt({document:e,disabled:t,onChange:n}){let r=Ye(e),i=r.declared?r.template===null?`builtin`:`own`:`none`,a=(0,U.useRef)(``);return e===null?(0,W.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:`This pipeline has no version, so there is no document to read.`}):(0,W.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(mt,{label:`What a run of this pipeline reports`,size:`md`,value:i,options:Xt,disabled:t!==void 0,onChoose:e=>{r.template!==null&&(a.current=r.template),n(e,a.current)}}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i===`none`?`A run of this pipeline writes no report document.`:(0,W.jsxs)(W.Fragment,{children:[i===`builtin`?`The built-in document is the run's facts, a table of its steps, and its error. It is not part of this document.`:`This template is rendered against the run's facts when the run settles.`,` `,(0,W.jsx)(`a`,{className:`text-primary-ink hover:underline`,href:E,target:`_blank`,rel:`noreferrer`,children:`What a template may read`})]})})]}),t!==void 0&&(0,W.jsx)(`p`,{className:`rounded-md border border-warning/40 p-2 text-xs text-warning`,children:t}),i===`own`&&(0,W.jsx)(Me,{name:Yt,className:`overflow-hidden rounded-md border border-border`,aside:(0,W.jsx)(V,{mediaType:`text/x-jinja`}),windowed:(0,W.jsx)(M,{value:r.template??``,mediaType:`text/x-jinja`,path:Jt,label:`${Yt}, in a window`,className:`min-h-0 flex-1`,readOnly:t!==void 0,onChange:e=>{n(`own`,e)}}),children:(0,W.jsx)(M,{value:r.template??``,mediaType:`text/x-jinja`,path:Jt,label:Yt,placeholder:`# {{ pipeline.code }} {{ run.status }}`,className:`h-64 min-h-40`,readOnly:t!==void 0,onChange:e=>{n(`own`,e)}})})]})}var Qt=`run.window`,$t=`This pipeline needs a window`,en=`A window has two ends: give both, or neither.`,tn=`A window runs forwards: the start is before the end.`,nn=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/;function rn(e){return an(e)}function an(e){return typeof e==`string`?e.includes(Qt):Array.isArray(e)?e.some(an):typeof e==`object`&&e?Object.values(e).some(an):!1}function on(e,t){return nn.test(e)?`${e}:00${sn(t)}`:null}function sn(e){if(e===0)return`Z`;let t=e<0?`-`:`+`,n=Math.abs(e);return`${t}${cn(Math.floor(n/60))}:${cn(n%60)}`}function cn(e){return String(e).padStart(2,`0`)}function ln(e,t,n,r){let i=on(e,r(e)),a=on(t,r(t));return i===null||a===null?i===null&&a===null?n?{kind:`unready`,why:$t}:{kind:`none`}:{kind:`unready`,why:n?$t:en}:Date.parse(i)>=Date.parse(a)?{kind:`unready`,why:n?$t:tn}:{kind:`window`,window:{window_start:i,window_end:a}}}var un=`Run now`;function dn({open:e,pipeline:t,document:n,username:r,warnings:i,onOpenChange:a,onStarted:o}){let s=(0,U.useMemo)(()=>L(de(n)),[n]),c=(0,U.useMemo)(()=>rn(n),[n]),[l,ee]=(0,U.useState)({}),[h,te]=(0,U.useState)(``),[_,v]=(0,U.useState)(``),[y,S]=(0,U.useState)(!1),C=ne(ie),[T,re]=(0,U.useState)(()=>new Set),[ae,E]=(0,U.useState)(()=>new Set),[ce,ue]=(0,U.useState)(!1),[fe,pe]=(0,U.useState)(null),[me,D]=(0,U.useState)(!1),[he,_e]=(0,U.useState)(`info`),ve=ke(),M=I(s,l),be=ce?void 0:T,N=ln(h,_,c,e=>se(C,new Date(`${e}:00`))),xe=(0,U.useRef)(null),Se=()=>{ue(!0),D(!0),ge(t.code,l,he===`debug`?{"*":`debug`}:null,N.kind===`window`?N.window:null).then(e=>{D(!1),o(e),a(!1)},e=>{D(!1),pe(b(e))})},Te=le(t),Ee=ve.why??(N.kind===`unready`?N.why:void 0);return(0,W.jsx)(we,{open:e,onOpenChange:a,children:(0,W.jsxs)(Ce,{className:`sm:max-w-lg`,initialFocus:s.length===0?xe:void 0,children:[(0,W.jsxs)(j,{children:[(0,W.jsx)(k,{children:`Run`}),(0,W.jsxs)(A,{children:[(0,W.jsx)(`span`,{className:`text-foreground`,children:Te.title}),Te.code!==null&&(0,W.jsxs)(`span`,{className:`font-mono`,children:[` `,Te.code]})]})]}),s.length>0&&(0,W.jsx)(`div`,{className:`max-h-[50vh] overflow-y-auto`,children:(0,W.jsx)(w,{fields:s,values:l,problems:M,stated:be,onChange:(e,t)=>{ee(n=>{let r={...n};return t===void 0?delete r[e]:r[e]=t,r})},onTouch:e=>{re(t=>t.has(e)?t:new Set(t).add(e))},onUnreadable:(e,t)=>{E(n=>F(n,e,t))}})}),c||y?(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,W.jsx)(O,{children:`Window`}),(0,W.jsx)(`span`,{className:`font-mono text-xs text-faint`,children:oe(C)})]}),(0,W.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:[(0,W.jsx)(fn,{id:`run-window-start`,label:`Start`,value:h,onChange:te}),(0,W.jsx)(fn,{id:`run-window-end`,label:`End`,value:_,onChange:v})]})]}):(0,W.jsx)(x,{variant:`link`,className:`w-fit px-0 text-primary-ink`,onClick:()=>{S(!0)},children:`Add a window`}),i.length>0&&(0,W.jsx)(`div`,{className:`space-y-0.5 rounded-md border border-warning/40 bg-warning/10 p-2`,children:i.map(e=>(0,W.jsx)(`p`,{className:`text-xs text-warning-ink`,children:e},e))}),fe!==null&&(0,W.jsx)(`p`,{className:`text-xs text-critical`,role:`alert`,children:fe.detail}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`log`}),(0,W.jsxs)(m,{value:he,onValueChange:e=>{_e(e===`debug`?`debug`:`info`)},children:[(0,W.jsx)(d,{size:`sm`,className:`w-40`,"aria-label":`log level`,children:(0,W.jsx)(u,{})}),(0,W.jsxs)(f,{children:[(0,W.jsx)(p,{value:`info`,children:`info and up`}),(0,W.jsx)(p,{value:`debug`,children:`debug too`})]})]})]}),(0,W.jsxs)(`p`,{className:`text-xs text-faint`,children:[`runs as `,r??`this session`,` · adhoc`]}),(0,W.jsxs)(ye,{children:[(0,W.jsx)(x,{variant:`outline`,onClick:()=>a(!1),children:`Cancel`}),(0,W.jsx)(g,{why:Ee,children:(0,W.jsx)(x,{ref:xe,disabled:me||!ve.may||!Le(M,ae)||Ee!==void 0,title:Ee,onClick:Se,children:un})})]})]})})}function fn({id:e,label:t,value:n,onChange:r}){return(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(O,{htmlFor:e,children:t}),(0,W.jsx)(S,{id:e,type:`datetime-local`,className:`font-mono`,value:n,onChange:e=>{r(e.target.value)}})]})}var pn=`document`,mn=`The document`,hn=250;function gn({document:e,source:t,schema:n,parseError:r,onWrite:i,readOnly:a=!1}){let o=(0,U.useMemo)(()=>t??(e===null?``:R(e)),[e,t]),[s,c]=(0,U.useState)(o),l=(0,U.useRef)(!1),u=(0,U.useRef)(null);return(0,U.useEffect)(()=>{l.current||c(o)},[o]),(0,U.useEffect)(()=>()=>{u.current!==null&&clearTimeout(u.current)},[]),e===null?(0,W.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:`This pipeline has no version, so there is no document to read.`}):(0,W.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[r!==null&&(0,W.jsxs)(`div`,{className:`border-b border-border p-2 text-xs text-critical`,role:`alert`,children:[(0,W.jsx)(`pre`,{className:`overflow-x-auto font-mono whitespace-pre-wrap`,children:r}),(0,W.jsx)(`p`,{className:`mt-1`,children:`The other tabs are showing the last document that parsed.`})]}),(0,W.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,W.jsx)(M,{value:s,schema:n,path:pn,label:mn,readOnly:a,onChange:e=>{l.current=!0,c(e),u.current!==null&&clearTimeout(u.current),u.current=setTimeout(()=>{l.current=!1,i(e)},hn)}})})]})}var _n=[`rule`,`for_each`,`items`,`timeout`,`poll`,`deadline`,`on_timeout`,`continue_on_failure`],Y={type:`string`,format:`duration`},vn={type:`object`,properties:{rule:{type:`string`,enum:[`all_success`,`all_done`,`one_failed`,`always`],default:`all_success`,description:`When this step becomes ready, over the steps it waits for.`},for_each:{anyOf:[{type:`string`},{type:`array`,items:{}}],description:"A reference to a list, or a literal list: one run item per element. A reference may read params, run, and an upstream fan-out's grid as ${steps.<name>.items}, which maps this step over that step's items.",examples:["${params.regions}","${steps.spread.items}"]},items:{type:`string`,enum:[`fail_fast`,`continue`],default:`fail_fast`,description:`Whether one failed item stops the batch, or the rest carry on.`},timeout:{...Y,description:`How long one attempt may take.`},poll:{...Y,description:`How often a sensor checks. Defaults to the sensor's own cadence.`},deadline:{...Y,description:`How long the step may wait before the timeout applies.`},on_timeout:{type:`string`,enum:[`fail`,`skip`],default:`fail`,description:`What an expired deadline does to the step.`},continue_on_failure:{type:`boolean`,default:!1,description:`Dependents still run when this step fails, and the run completes with errors.`}}},yn={type:`object`,properties:{max_attempts:{type:`integer`,minimum:1,maximum:100,default:1,description:`Total attempts, including the first.`},backoff:{...Y,default:`30s`,description:`The delay after the first failure.`},max_backoff:{...Y,default:`1h`,description:`The longest delay between attempts.`},multiplier:{type:`number`,minimum:1,maximum:10,default:2,description:`What each delay is multiplied by.`},jitter:{type:`number`,minimum:0,maximum:1,default:.2,description:`How much of the delay is spread randomly.`}}},X=L(vn),Z=L(yn);function bn(e,t){let n=ft(e)[t]??{},r={};for(let e of _n){let t=n[e];t!==void 0&&(r[e]=e===`for_each`?Sn(t):t)}return r}function xn(e,t){let n=ft(e)[t]?.retry;return typeof n!=`object`||!n||Array.isArray(n)?{}:n}function Sn(e){return typeof e==`string`?e:JSON.stringify(e)??``}function Cn(e){if(typeof e!=`string`)return e;let t=e.trim();if(!t.startsWith(`[`))return e;try{let n=JSON.parse(t);return Array.isArray(n)?n:e}catch{return e}}function wn(e,t,n,r){let i=X.find(e=>e.name===n),a=n===`for_each`?Cn(r):r;return En(e,t,n,a==null||a===``||Ie(a,i?.fallback)?void 0:a)}function Tn(e,t,n,r){let i=Z.find(e=>e.name===n),a={...xn(e,t)};return r==null||r===``||Ie(r,i?.fallback)?delete a[n]:a[n]=r,En(e,t,`retry`,Object.keys(a).length===0?void 0:a)}function En(e,t,n,r){let i=ft(e),a=i[t];if(a===void 0)return e;let o={...a};return r===void 0?delete o[n]:o[n]=r,{...e,steps:{...i,[t]:o}}}var Dn={rule:`rule`,continue_on_failure:`rule`,for_each:`fan_out`,items:`fan_out`,timeout:`timing`,poll:`timing`,deadline:`timing`,on_timeout:`timing`};function On(e){let t=_n.filter(t=>Dn[t]===e);return X.filter(e=>t.some(t=>t===e.name))}function Q(e,t){let n=e.find(e=>e.name===t)?.fallback;return n==null?``:String(n)}function $(e,t){let n=e[t];return n!=null&&n!==``}function kn(e){return e.length===0?[{text:`nothing; this step is a root`,set:!1}]:e.map(e=>({text:e,set:!0}))}function An(e){if(!$(e,`for_each`))return[{text:`off`,set:!1}];let t=$(e,`items`);return[{text:Sn(e.for_each),set:!0},{text:t?String(e.items):Q(X,`items`),set:t}]}function jn(e,t){let n=[Mn(e,`timeout`,`no timeout`)];(t||$(e,`poll`))&&n.push(Mn(e,`poll`,`poll its own cadence`)),n.push(Mn(e,`deadline`,`no deadline`));let r=$(e,`on_timeout`),i=r?String(e.on_timeout):Q(X,`on_timeout`);return n.push({text:`on_timeout ${i}`,set:r}),n}function Mn(e,t,n){return $(e,t)?{text:`${t} ${String(e[t])}`,set:!0}:{text:n,set:!1}}function Nn(e){let t=e.max_attempts;if(t===void 0||String(t)===Q(Z,`max_attempts`))return[{text:`off`,set:!1}];let n=$(e,`backoff`),r=$(e,`multiplier`)||$(e,`max_backoff`),i=$(e,`multiplier`)?String(e.multiplier):Q(Z,`multiplier`),a=$(e,`max_backoff`)?String(e.max_backoff):Q(Z,`max_backoff`),o=[{text:`${String(t)} attempts`,set:!0},{text:`${n?String(e.backoff):Q(Z,`backoff`)} backoff`,set:n},{text:`×${i} up to ${a}`,set:r}];return $(e,`jitter`)&&o.push({text:`jitter ${String(e.jitter)}`,set:!0}),o}function Pn(e){let t=$(e,`rule`),n=[{text:t?String(e.rule):Q(X,`rule`),set:t}];return e.continue_on_failure===!0&&n.push({text:`continues on failure`,set:!0}),n}function Fn({keys:e,retry:t,prerequisites:n,sensor:r}){return[{id:`depends_on`,title:`Waits for`,fields:[],summary:kn(n),chips:n.length>0},{id:`fan_out`,title:`Fan-out`,fields:On(`fan_out`),summary:An(e),chips:!1},{id:`timing`,title:`Timing`,fields:On(`timing`).filter(t=>t.name!==`poll`||r||$(e,`poll`)),summary:jn(e,r),chips:!1},{id:`retry`,title:`Retry`,fields:Z,summary:Nn(t),chips:!1},{id:`rule`,title:`Rule`,fields:On(`rule`),summary:Pn(e),chips:!1}]}function In(e,t){let n={};for(let r of e.fields){let e=t[r.name];e!==void 0&&(n[r.name]=e)}return n}function Ln({step:e,document:t,block:n,blockProblem:r,schemas:i,connections:a,disabled:o,onConfig:s,onDependsOn:c,onName:l}){let u=Ze(t,e),[d,f]=(0,U.useState)(pt(t,e)??``),p=it(t,e),m=(0,U.useMemo)(()=>L(n?.config_schema),[n]),ee=(0,U.useMemo)(()=>I(m,p),[m,p]),h=ut(t,e),g=Je(t).filter(t=>t!==e&&!h.includes(t)),te=bn(t,e),_=xn(t,e),v=I(X,te),y=I(Z,_),b=Object.entries({...v,...y,...ee}),x=Fn({keys:te,retry:_,prerequisites:h,sensor:n?.kind===`sensor`}),[C,ne]=(0,U.useState)(()=>new Set);return(0,W.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,W.jsxs)(`div`,{className:`space-y-1`,children:[(0,W.jsx)(`h2`,{className:u.named?`text-sm font-semibold`:`font-mono text-sm font-semibold`,children:u.title}),(0,W.jsxs)(`p`,{className:`flex items-center gap-2`,children:[u.code!==null&&(0,W.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:u.code}),(0,W.jsx)(`span`,{className:`font-mono text-xs`,children:ct(t,e)??`no block`}),n!==null&&(0,W.jsx)(Ve,{kind:n.kind})]}),n!==null&&(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n.summary})]}),o!==void 0&&(0,W.jsx)(`p`,{className:`rounded-md border border-warning/40 p-2 text-xs text-warning`,children:o}),(0,W.jsx)(je,{title:`Config`,children:r===null?n===null?(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Reading this block's schema.`}):(0,W.jsx)(w,{fields:m,values:p,problems:ee,disabled:o,fold:!0,references:{document:t,schemas:i,connections:a},onChange:(e,t)=>{let n={...p};t===void 0?delete n[e]:n[e]=t,s(n)}},e):(0,W.jsx)(`p`,{className:`text-xs text-critical`,children:r.detail})}),(0,W.jsx)(`div`,{className:`flex flex-col`,children:x.map(t=>{let n=In(t,t.id===`retry`?y:v),r=Object.keys(n).length>0;return(0,W.jsx)(zn,{group:t,open:r||C.has(t.id),onToggle:r?null:()=>{ne(Rn(C,t.id))},children:t.id===`depends_on`?(0,W.jsx)(Vn,{prerequisites:h,offered:g,disabled:o,onDependsOn:c}):t.id===`retry`?(0,W.jsx)(w,{fields:t.fields,values:_,problems:y,disabled:o,onChange:(t,n)=>{z(r=>Tn(r,e,t,n))}},`retry-${e}`):(0,W.jsx)(w,{fields:t.fields,values:te,problems:n,disabled:o,onChange:(t,n)=>{z(r=>wn(r,e,t,n))}},`${t.id}-${e}`)},t.id)})}),(0,W.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,W.jsx)(O,{htmlFor:`step-display-name`,children:`Name`}),(0,W.jsx)(S,{id:`step-display-name`,value:d,disabled:o!==void 0,onChange:e=>{f(e.target.value),l(e.target.value)},placeholder:`What to call this step on screen`}),(0,W.jsxs)(`p`,{className:`text-xs text-faint`,children:[`Display only. Every reference to this step is by its key, `,e,`.`]})]}),b.length>0&&(0,W.jsxs)(`div`,{className:`space-y-1 rounded-md border border-critical/40 p-2`,role:`alert`,children:[(0,W.jsx)(`p`,{className:`text-xs font-medium text-critical`,children:`This step will be refused at apply.`}),(0,W.jsx)(`ul`,{className:`list-disc space-y-0.5 pl-4 text-xs text-muted-foreground`,children:b.map(([e,t])=>(0,W.jsx)(`li`,{children:t},e))})]})]})}function Rn(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}function zn({group:e,open:t,onToggle:n,children:r}){return(0,W.jsx)(C,{title:e.title,summary:(0,W.jsx)(Bn,{parts:e.summary,chips:e.chips}),open:t,onToggle:n,children:r})}function Bn({parts:e,chips:t}){return t?(0,W.jsx)(`span`,{className:`ml-auto flex flex-wrap items-center justify-end gap-1`,children:e.map(e=>(0,W.jsx)(`span`,{className:`rounded-sm border border-border bg-secondary px-1.5 py-0.5 font-mono text-xs`,children:e.text},e.text))}):(0,W.jsx)(`span`,{className:`ml-auto min-w-0 text-right font-mono text-xs break-words`,children:e.map((e,t)=>(0,W.jsxs)(U.Fragment,{children:[t>0&&(0,W.jsx)(`span`,{className:`text-faint`,children:` · `}),(0,W.jsx)(`span`,{className:e.set?`text-foreground`:`text-muted-foreground`,children:e.text})]},e.text))})}function Vn({prerequisites:e,offered:t,disabled:n,onDependsOn:r}){return(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[e.length===0&&(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`nothing; this step is a root`}),e.map(t=>(0,W.jsxs)(`span`,{className:`flex items-center gap-1 rounded-sm border border-border bg-secondary px-1.5 py-0.5 text-xs`,children:[t,(0,W.jsx)(x,{variant:`ghost`,size:`icon-xs`,"aria-label":`Stop waiting for ${t}`,disabled:n!==void 0,onClick:()=>{r(e.filter(e=>e!==t))},children:(0,W.jsx)(_,{className:`size-3`,"aria-hidden":!0})})]},t))]}),t.length>0&&(0,W.jsxs)(m,{value:``,disabled:n!==void 0,onValueChange:t=>{let n=String(t);n!==``&&r([...e,n])},children:[(0,W.jsx)(d,{size:`sm`,className:`w-full`,"aria-label":`Add a prerequisite`,children:(0,W.jsx)(u,{placeholder:`Add a prerequisite`})}),(0,W.jsx)(f,{children:t.map(e=>(0,W.jsx)(p,{value:e,children:e},e))})]})]})}function Hn(e,t,n){let r=ut(e,n);return r.includes(t)?e:Ge(e,n,[...r,t])}function Un(e,t,n){let r=ut(e,n);return r.includes(t)?Ge(e,n,r.filter(e=>e!==t)):e}function Wn(e,t){let n=ft(e);if(!(t in n))return e;let r=Object.fromEntries(Object.entries(n).filter(([e])=>e!==t)),i={...e,steps:r};for(let e of Object.keys(r)){let n=ut(i,e);n.includes(t)&&(i=Ge(i,e,n.filter(e=>e!==t)))}return i}function Gn(e,t,n){if(t===n)return[n,n];let r=new Map;for(let[t,n]of B(e))r.set(t,[...r.get(t)??[],n]);let i=new Set([n]),a=[[n]];for(;a.length>0;){let e=[];for(let o of a)for(let a of r.get(o[o.length-1]??``)??[]){if(a===t)return[...o,t,n];i.has(a)||(i.add(a),e.push([...o,a]))}a=e}return null}function Kn(e,t,n){return`${t} cannot wait for ${e}: that closes a loop, ${n.join(` → `)}`}var qn=(0,U.lazy)(()=>r(()=>import(`./PipelineGraph-B3WZx-gR.js`).then(e=>({default:e.PipelineGraph})),__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,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42]))),Jn=(0,U.lazy)(()=>r(()=>import(`./StarterPicker-7qIa398g.js`).then(e=>({default:e.StarterPicker})),__vite__mapDeps([43,1,2,6,33,9,10,3,11,12,13,14,15,5,16,4,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,34,35,44,45,41,46,47,48]))),Yn=`From a starter`,Xn=`Validate document`,Zn=`Run pipeline`,Qn=`Apply document`,$n=3,er=5,tr=`new pipeline`,nr=`Apply this document before running it.`,rr=`Read only on a small screen`;function ir(){let{code:e}=a(),t=e===void 0,n=e??`new`,r=i(),u=o().state?.document,d=ne(re),f=te(),p=ke(),m=p.may,g=ne(Qe),[_,v]=(0,U.useState)({of:``,detail:null,problem:null}),[b,S]=(0,U.useState)([]),[C,w]=(0,U.useState)(null),[T,ie]=(0,U.useState)(null),[oe,se]=(0,U.useState)([]),[E,de]=(0,U.useState)([]),[D,ge]=(0,U.useState)(null),[O,k]=(0,U.useState)(null),[A,ye]=(0,U.useState)({of:null,block:null,problem:null}),[j,M]=(0,U.useState)(`none`),[Ce,we]=(0,U.useState)(null),[je,Me]=(0,U.useState)(!1),P=g.code===n?g.local:null,Fe=g.code===n?g.source:null,F=(0,U.useMemo)(()=>st(g.applied,P),[g.applied,P]),Ie=(0,U.useMemo)(()=>g.applied===null?{...F,steps:[]}:F,[F,g.applied]);(0,U.useEffect)(()=>{if(t){dt(u),Oe(u===void 0?`step`:`source`);return}let e=!1;return pe(n).then(t=>{e||(v({of:n,detail:t,problem:null}),$e(n,t.document))},t=>{e||v({of:n,detail:null,problem:t instanceof l?t.problem:null})}),()=>{e=!0}},[n,t,u]);let I=_.of===n?_.detail:null,Le=_.of===n?_.problem:null;(0,U.useEffect)(()=>et,[]),(0,U.useEffect)(()=>{let e=!1,r=(t,n)=>{t.then(t=>{e||n(t)},()=>{})};return t||(r(me(n,er),e=>{S(e.items)}),r(Te({...Ee,pipeline:n},null,$n),e=>{se(e.items)})),r(Re(),e=>{w(e.items)}),r(ze(),e=>{ie(e.items)}),r(Ne(),e=>{de(e.blocks)}),r(fe(),ge),()=>{e=!0}},[n,t]);let L=O===null?null:ct(P,O);(0,U.useEffect)(()=>{if(L===null)return;let e=!1;return Pe(L).then(t=>{e||ye({of:L,block:t,problem:null})},t=>{e||ye({of:L,block:null,problem:t instanceof l?t.problem:null})}),()=>{e=!0}},[L]);let Be=(0,U.useMemo)(()=>A.of===L?A:{of:L,block:null,problem:null},[L,A]),Ve=Je(P),R=b[0]??null,Ye=(0,U.useMemo)(()=>E.length===0?null:E.map(e=>e.id),[E]),Ze=(0,U.useMemo)(()=>C?.map(e=>e.code)??null,[C]),B=(0,U.useMemo)(()=>tt(P,Ye,Ze),[Ye,Ze,P]),it=(0,U.useMemo)(()=>Xe(B),[B]);(0,U.useEffect)(()=>{let e=[at(B)?`${String(it.length)} unmet here`:null,Ce].filter(e=>e!==null);return De({note:e.length===0?null:e.join(` · `),tone:e.length===0?`quiet`:`warn`,identifier:R===null?null:`v${String(R.version)} · applied ${ae(R.created_at)}${R.applied_by===null?``:` by ${R.applied_by}`}`}),xe},[R,Ce,B,it.length]);let ut=(0,U.useCallback)((e,t)=>{let n=Gn(P,e,t);if(n!==null){_e.warning(Kn(e,t,n));return}z(n=>Hn(n,e,t))},[P]),ft=(0,U.useCallback)((e,t)=>{z(n=>Un(n,e,t))},[]),pt=(0,U.useCallback)(e=>{z(t=>Wn(t,e)),k(t=>t===e?null:t)},[]),mt=(e,t,n)=>{let r=St(e,Ve);z(n=>{let i=qe(n,r,e);return t===null?i:Hn(i,t,r)})&&(n!==null&&Ft(r,n),k(r),Oe(`step`))},V=f?rr:g.parseError===null?void 0:`The source pane holds text that is not a document.`,H=be(p.why,V),_t=t?be(p.why,nr):H,G=`Run — ${t?tr:I===null?n:ce(I)}`;(0,U.useEffect)(()=>Se([...m&&!f?[{id:`pipeline:validate`,title:Xn,group:G,screen:!0,icon:vt,keywords:[`check`,`dry run`,`plan`],run:()=>{M(`validate`)}},{id:`pipeline:apply`,title:Qn,group:G,screen:!0,icon:Ae,keywords:[`write`,`version`,`save`],run:()=>{M(`apply`)}}]:[],...t||!m||f?[]:[{id:`pipeline:run`,title:Zn,group:G,screen:!0,icon:c,keywords:[`start`,`adhoc`],run:()=>{M(`run`)}}],...f?[]:[{id:`pipeline:add-step`,title:`Add step`,group:G,screen:!0,icon:ve,keywords:[`block`,`new`,`insert`],run:Tt}],{id:`pipeline:relayout`,title:`Re-layout the graph`,group:G,screen:!0,icon:gt,keywords:[`tidy`,`arrange`,`elk`],run:Dt}]),[t,m,G,f]);let yt=(0,U.useMemo)(()=>P===null&&I===null?[]:[{id:`step`,label:Ue(O),render:()=>O===null||P===null?(0,W.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:`No step chosen.`}):(0,W.jsx)(Ln,{step:O,document:P,block:Be.block,blockProblem:Be.problem,schemas:T,connections:C,disabled:V,onConfig:e=>{z(t=>rt(t,O,e))},onDependsOn:e=>{z(t=>Ge(t,O,e))},onName:e=>{z(t=>He(t,O,e))}},O)},...I===null?[]:[{id:`pipeline`,label:`Pipeline`,render:()=>(0,W.jsx)(lt,{pipeline:I,document:P,versions:b,connections:C,runs:oe,unmet:B})}],{id:`report`,label:`Report`,render:()=>(0,W.jsx)(Zt,{document:P,disabled:V,onChange:(e,t)=>{z(n=>e===`none`?nt(n):We(n,e===`own`?t:null))}})},{id:`source`,label:`Source`,render:()=>(0,W.jsx)(gn,{document:P,source:Fe,schema:D,parseError:g.parseError,readOnly:f,onWrite:Ke})}],[C,V,P,I,oe,D,T,O,f,Fe,g.parseError,Be,B,b]);if((0,U.useEffect)(()=>N(yt,{screen:`editor:${n}`,open:t&&u!==void 0?`source`:`step`}),[yt,n,t,u]),!t&&I===null)return(0,W.jsx)(h,{loading:Le===null,problem:Le,empty:!1,children:null});let K=I===null?null:le(I),q=ue(he(P));return(0,W.jsxs)(`div`,{className:`-mx-1 -my-3 flex min-h-0 flex-1 flex-col gap-3 md:-mx-5`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-x-2 md:gap-x-3`,children:[(0,W.jsx)(ht,{trail:[{label:`Pipelines`,to:`/pipelines`},K===null?{label:tr}:{label:K.title,mono:!K.named}],code:K?.code}),q!==null&&(0,W.jsx)(`span`,{className:y(`hidden shrink-0 rounded-sm border border-border px-1.5 py-0.5 text-xs md:inline-block`,q.className),title:q.title,children:q.label}),(0,W.jsx)(`span`,{className:`hidden shrink-0 rounded-sm border border-border px-1.5 py-0.5 font-mono text-xs md:inline-block`,title:I===null||I.current_version===null?`No version of this pipeline has been applied.`:`Version ${String(I.current_version)} of this pipeline, counting the applies that changed it.`,children:I===null||I.current_version===null?`no version`:`v${String(I.current_version)}`}),(0,W.jsx)(`div`,{className:`flex-1`}),f&&(0,W.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:rr}),(0,W.jsx)(ee,{actions:f?[]:[{id:`validate`,label:`Validate`,icon:vt,disabled:H!==void 0,why:H,onClick:()=>{M(`validate`)}},{id:`run`,label:`Run`,icon:c,disabled:_t!==void 0,why:_t,onClick:()=>{M(`run`)}},{id:`apply`,label:`Apply`,icon:Ae,variant:ot(F,t),disabled:H!==void 0,why:H,onClick:()=>{M(`apply`)}}]})]}),(0,W.jsxs)(`div`,{className:`relative min-h-96 flex-1 overflow-hidden rounded-md border border-border-strong bg-background`,children:[Ve.length===0&&P!==null&&(0,W.jsxs)(`div`,{className:`absolute top-4 left-4 z-10 flex items-center gap-3`,children:[(0,W.jsx)(`p`,{className:`pointer-events-none text-sm text-muted-foreground`,children:`No steps.`}),t&&!f&&m&&(0,W.jsxs)(x,{variant:`outline`,size:`sm`,onClick:()=>{Me(!0)},children:[(0,W.jsx)(s,{"aria-hidden":!0}),Yn]})]}),P===null?(0,W.jsx)(`div`,{className:`flex flex-col items-start gap-3 p-4`,children:(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No version to draw.`})}):(0,W.jsx)(U.Suspense,{fallback:(0,W.jsx)(h,{loading:!0,problem:null,empty:!1,children:null}),children:(0,W.jsx)(qn,{pipeline:n,document:P,blocks:E,edits:Ie,unmet:B,selected:O,onSelect:e=>{k(e),e!==null&&Oe(`step`)},onAddStep:e=>{mt(e,null,null)},onConnect:ut,onDisconnect:ft,onAddStepAfter:(e,t,n)=>{mt(t,e,n)},onRemoveStep:pt,readOnly:f})})]}),je&&(0,W.jsx)(U.Suspense,{fallback:null,children:(0,W.jsx)(Jn,{open:!0,onOpenChange:Me,onChoose:e=>{dt(e),Oe(`source`)}})}),P!==null&&(0,W.jsx)(Gt,{open:j===`apply`||j===`validate`,mode:j===`validate`?`validate`:`apply`,document:P,onOpenChange:e=>{e||M(`none`)},onPlan:e=>{we(Vt(e.issues))},onApplied:e=>{if(we(Vt(e.plan.issues)),_e.success(e.version===null?`${e.plan.code} was left as it was`:`${e.plan.code} is at version ${String(e.version)}`),t){r(`/pipelines/${encodeURIComponent(e.plan.code)}`);return}pe(n).then(e=>{v({of:n,detail:e,problem:null}),$e(n,e.document)},()=>{}),me(n,er).then(e=>{S(e.items)},()=>{})}}),I!==null&&(0,W.jsx)(dn,{open:j===`run`,pipeline:I,document:g.applied,username:d.identity?.username??null,warnings:it,onOpenChange:e=>{e||M(`none`)},onStarted:e=>{if(e.run_id===null){_e.warning(e.detail??`nothing started: ${e.status}`);return}r(`/runs/${e.run_id}`)}})]})}export{ir as PipelineEditor,Mt as a,Et as c,Pt as i,q as l,J as n,Lt as o,Nt as r,wt as s,It as t,bt as u};