@gguf/claw 2026.2.9 → 2026.2.13

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 (715) hide show
  1. package/CHANGELOG.md +159 -0
  2. package/LICENSE +1 -1
  3. package/dist/{accounts-MyAvfCVH.js → accounts-54zZMYCo.js} +5 -2
  4. package/dist/{accounts-DbzMEfKN.js → accounts-Bvh0DFxS.js} +5 -2
  5. package/dist/{acp-cli-MZ3h1E1n.js → acp-cli-BslcOPdx.js} +146 -25
  6. package/dist/{acp-cli-DKJRTfwB.js → acp-cli-D6rk5cOh.js} +145 -24
  7. package/dist/{agent-whSJT2Lk.js → agent-C0yL70cy.js} +26 -20
  8. package/dist/{agent-c1QNeDmV.js → agent-DjZxytiC.js} +26 -20
  9. package/dist/{agent-scope-D3me2AZa.js → agent-scope-Bkr9fZtl.js} +31 -14
  10. package/dist/{agent-scope-Dp8sREli.js → agent-scope-DASgjz2_.js} +199 -14
  11. package/dist/{agent-scope-DnyDZ5RH.js → agent-scope-GYIs5dyU.js} +30 -13
  12. package/dist/{agent-scope-Dpav7C-i.js → agent-scope-okUOVjE5.js} +32 -11
  13. package/dist/audio-preflight-B0kLz-Ma.js +60 -0
  14. package/dist/audio-preflight-BCs_J33s.js +60 -0
  15. package/dist/audio-preflight-CTl2RCyF.js +71 -0
  16. package/dist/audio-preflight-MhF6YlAY.js +74 -0
  17. package/dist/{audit-BFYy1qSw.js → audit-BYfhZ7LA.js} +454 -31
  18. package/dist/{audit-Dn2cBl2x.js → audit-CfPZ_5Id.js} +452 -29
  19. package/dist/auth-9nTeB2Je.js +602 -0
  20. package/dist/auth-CLhyWwAU.js +593 -0
  21. package/dist/{auth-health-Cx5exPMV.js → auth-health-CWiLyzSr.js} +1 -1
  22. package/dist/{auth-health-DjT4fUpw.js → auth-health-qD4RND47.js} +1 -1
  23. package/dist/{auth-profiles-FJ3VY25a.js → auth-profiles-Cp9MtUdM.js} +353 -33
  24. package/dist/build-info.json +2 -2
  25. package/dist/bundled/boot-md/handler.js +33 -25
  26. package/dist/bundled/session-memory/handler.js +33 -22
  27. package/dist/{call-CD2IZCHT.js → call-CjEdFGAf.js} +7 -7
  28. package/dist/{call-CM25qgxz.js → call-DAfkvtVq.js} +6 -6
  29. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  30. package/dist/canvas-host/a2ui/a2ui.bundle.js +7 -1
  31. package/dist/{channel-options-CremuJyh.js → channel-options-B8dPzlyO.js} +4 -4
  32. package/dist/{channel-options-D-JnJ4Ft.js → channel-options-Bq5IC5Tv.js} +12 -7
  33. package/dist/{channel-selection-DAHCVAX4.js → channel-selection-BaW1xXEa.js} +2 -2
  34. package/dist/{channel-selection-DPV9hvY8.js → channel-selection-dR0jCgTn.js} +2 -2
  35. package/dist/{channels-cli-6deHFr9t.js → channels-cli-hPo28hWS.js} +61 -56
  36. package/dist/{channels-cli-D3tKmhlt.js → channels-cli-zi3rO0jq.js} +62 -57
  37. package/dist/{channels-status-issues-BN1ICfdy.js → channels-status-issues-kb-M2Fi0.js} +1 -1
  38. package/dist/{channels-status-issues-DFhI_u0p.js → channels-status-issues-ketdwZun.js} +1 -1
  39. package/dist/{chrome-B2UjqY-9.js → chrome--Fe8F5Kf.js} +24 -12
  40. package/dist/{chrome-COabMr6f.js → chrome-BWeMtFGf.js} +24 -12
  41. package/dist/{chrome-CQd_MVOA.js → chrome-Bx24uq7B.js} +27 -15
  42. package/dist/{chrome-CxRJz4ZD.js → chrome-n_3rtK2c.js} +22 -11
  43. package/dist/{clack-prompter-BkNZ4Xdw.js → clack-prompter-B-tJmODa.js} +5 -5
  44. package/dist/{clack-prompter-DuBVnTKy.js → clack-prompter-DpuKn_Uy.js} +5 -5
  45. package/dist/cli/daemon-cli.js +8 -1
  46. package/dist/cli-9lwO6Ttx.js +94 -0
  47. package/dist/cli-CNNdyxPO.js +91 -0
  48. package/dist/{client-DMloFP_O.js → client-BhZjzrH2.js} +73 -9
  49. package/dist/{client-C0gQ7hrj.js → client-DyAxKXKY.js} +73 -9
  50. package/dist/{command-format-ayFsmwwz.js → command-format-Bxe0mWee.js} +1 -1
  51. package/dist/{command-options-BQdH6qnK.js → command-options-BDV7Xgs-.js} +9 -4
  52. package/dist/{commands-BWHYcc83.js → commands-gOiRcfoU.js} +4 -4
  53. package/dist/{tui-formatters-BDP_71Xt.js → commands-registry-6NUFrejL.js} +6 -114
  54. package/dist/{tui-formatters-CIx4sCQO.js → commands-registry-DGgkLQ7A.js} +6 -114
  55. package/dist/{completion-cli-DEJia0V1.js → completion-cli-B1kHKJZX.js} +30 -30
  56. package/dist/{completion-cli-D_0fx2O6.js → completion-cli-Drks7xRK.js} +3 -3
  57. package/dist/{config-CQt4vGxI.js → config-7NCznPmF.js} +336 -97
  58. package/dist/{config-fCnPoWjU.js → config-B8v0zg48.js} +295 -99
  59. package/dist/{config-Bj2eDa02.js → config-CeWMHOiQ.js} +295 -99
  60. package/dist/{config-ethqi73X.js → config-D8pgDSNo.js} +358 -99
  61. package/dist/{config-guard-BJuqQvng.js → config-guard-RbHxYc9j.js} +212 -63
  62. package/dist/{configure-skrLiSwW.js → configure-DLp2Xz7L.js} +59 -40
  63. package/dist/{configure-C-pYuYg_.js → configure-Su1S0gi-.js} +58 -39
  64. package/dist/control-auth-BlWU-jBl.js +54 -0
  65. package/dist/control-auth-C8rIqEdA.js +54 -0
  66. package/dist/{control-service-BDgF-FZ0.js → control-service-BNDthc1N.js} +11 -5
  67. package/dist/{control-service-Djd_WI3_.js → control-service-COF59GQe.js} +10 -4
  68. package/dist/control-ui/assets/{index-CnB9IO4a.js → index-BECn2L1T.js} +369 -368
  69. package/dist/control-ui/assets/index-BECn2L1T.js.map +1 -0
  70. package/dist/control-ui/assets/index-DRPcd1Z4.css +1 -0
  71. package/dist/control-ui/index.html +2 -2
  72. package/dist/{cron-cli-CB6CufAb.js → cron-cli-CSy4-JGS.js} +20 -20
  73. package/dist/{cron-cli-Db6fardJ.js → cron-cli-Db3uCDIT.js} +21 -21
  74. package/dist/{daemon-cli-Xe22v7lZ.js → daemon-cli-BLbzcTuD.js} +61 -22
  75. package/dist/{daemon-cli-BlHK0ly2.js → daemon-cli-DR0D35MO.js} +60 -21
  76. package/dist/{daemon-runtime-CMqH8BUE.js → daemon-runtime-ZWXvLDxx.js} +3 -3
  77. package/dist/{daemon-runtime-DwQFvDXZ.js → daemon-runtime-pVcZ2KDE.js} +3 -3
  78. package/dist/{deliver-CD7-BhYD.js → deliver-BHNoC9Yk.js} +396 -290
  79. package/dist/{deliver-BdGjIcTC.js → deliver-C_5eGQrX.js} +392 -286
  80. package/dist/{deliver-nTKaXF--.js → deliver-DPHZlWgr.js} +392 -287
  81. package/dist/{deliver-CDMGxRoW.js → deliver-geVWJ52I.js} +394 -288
  82. package/dist/{deps-BDQ_K8zf.js → deps-CP0dcOgD.js} +2 -2
  83. package/dist/{deps-D60FbgTP.js → deps-DW5r2IEk.js} +2 -2
  84. package/dist/{devices-cli-N559801X.js → devices-cli-BViqX5pl.js} +15 -15
  85. package/dist/{devices-cli-IxmPLIk8.js → devices-cli-DpYaY-iM.js} +14 -14
  86. package/dist/{directory-cli-Caq-OYk8.js → directory-cli-BWD1DdKf.js} +16 -16
  87. package/dist/{directory-cli-ClrdmQL-.js → directory-cli-BcvZfkfo.js} +17 -17
  88. package/dist/{dispatcher-BfXtm4Dl.js → dispatcher-4Qn951N3.js} +5 -3
  89. package/dist/{dns-cli-DgVO0Pkw.js → dns-cli-_Ych2tu9.js} +12 -12
  90. package/dist/{dns-cli-BTNZkWHs.js → dns-cli-gQCxUXgU.js} +13 -13
  91. package/dist/{docs-cli-9Xan7C6D.js → docs-cli-Bseiau7J.js} +7 -7
  92. package/dist/{docs-cli-DZULc91f.js → docs-cli-DzBTlWQE.js} +8 -8
  93. package/dist/{doctor-D39rZvNH.js → doctor-BNkYYahD.js} +37 -36
  94. package/dist/{doctor-Dq1YeYdH.js → doctor-DzIgdPx1.js} +37 -36
  95. package/dist/entry.js +77 -21
  96. package/dist/{env-B5YXooWp.js → env-BUuSkE19.js} +1 -1
  97. package/dist/{exec-DFOtZbI0.js → exec-BPQSKwGa.js} +5 -3
  98. package/dist/{exec-B8JKbXKW.js → exec-DqZFMawz.js} +5 -3
  99. package/dist/{exec-Bas1hoSJ.js → exec-EKUaAU91.js} +57 -18
  100. package/dist/{exec-CiH_vkWn.js → exec-_PSUrMP8.js} +528 -19
  101. package/dist/{exec-approvals-DGPTjO0N.js → exec-approvals-Bqk-tIxY.js} +134 -51
  102. package/dist/{exec-approvals-C9InMoAB.js → exec-approvals-C67V-ljH.js} +134 -51
  103. package/dist/{exec-approvals-cli-EASbqFd-.js → exec-approvals-cli-D6vfSqQu.js} +22 -22
  104. package/dist/{exec-approvals-cli-DPHItoxG.js → exec-approvals-cli-DAdoki_R.js} +21 -21
  105. package/dist/extensionAPI.js +8518 -9140
  106. package/dist/fetch-Bz1WxfzV.js +285 -0
  107. package/dist/fetch-D2O8s8I1.js +285 -0
  108. package/dist/fetch-Dm-nCwa_.js +285 -0
  109. package/dist/fetch-wuOZDzdT.js +285 -0
  110. package/dist/{gateway-cli-BFqUIif8.js → gateway-cli-C-k7JPlr.js} +1868 -1072
  111. package/dist/{gateway-cli-v4kSPsLE.js → gateway-cli-DIIJ9Z0Y.js} +1870 -1074
  112. package/dist/{gateway-rpc-D6LrkcSA.js → gateway-rpc-D6jLh81b.js} +3 -3
  113. package/dist/{gateway-rpc-dHFK02Kk.js → gateway-rpc-aqysUyf5.js} +3 -3
  114. package/dist/{github-copilot-auth-CQIWc0hC.js → github-copilot-auth-BUqfX7hG.js} +316 -52
  115. package/dist/{github-copilot-auth-D2jfnapd.js → github-copilot-auth-By-nyRb6.js} +316 -52
  116. package/dist/{github-copilot-token-SLWintYd.js → github-copilot-token-C9W4SY9o.js} +7 -4
  117. package/dist/{github-copilot-token-BW-SEg7E.js → github-copilot-token-CiF5Iyi2.js} +6 -3
  118. package/dist/{github-copilot-token-C9IJh2Pn.js → github-copilot-token-DatTe1w-.js} +6 -3
  119. package/dist/{github-copilot-token-wCk9Fg_E.js → github-copilot-token-c9Igt3ZH.js} +6 -3
  120. package/dist/{gmail-setup-utils-CVNgLkXL.js → gmail-setup-utils-HvKMdooP.js} +4 -4
  121. package/dist/{gmail-setup-utils-CAM1vbUS.js → gmail-setup-utils-c-iF00aL.js} +3 -3
  122. package/dist/{health-format-C77hrjEQ.js → health-format-BORnJOeS.js} +106 -44
  123. package/dist/{health-format-DDYtlkB9.js → health-format-Nd0jcoqM.js} +105 -43
  124. package/dist/{help-format-CUnac_bT.js → help-format-Cd5PLwXe.js} +1 -1
  125. package/dist/{help-format-aiW76js8.js → help-format-DYBEvMOX.js} +1 -1
  126. package/dist/{hooks-cli-DsflBRxX.js → hooks-cli-3KdsbdRi.js} +53 -47
  127. package/dist/{hooks-cli-C7kctMuZ.js → hooks-cli-BThja6wK.js} +53 -47
  128. package/dist/{hooks-status-DRAVHSPg.js → hooks-status-BbIz0zmm.js} +6 -5
  129. package/dist/{hooks-status-lHWrY64E.js → hooks-status-DPJORMB6.js} +6 -5
  130. package/dist/{image--gbzucyh.js → image-BaJKrmCs.js} +12 -8
  131. package/dist/{image-ORs4LLwg.js → image-D-5pUELC.js} +13 -9
  132. package/dist/{image-DMnjYGdA.js → image-TvL5YI_W.js} +13 -9
  133. package/dist/{image-BVNytEIn.js → image-bodq5cUH.js} +13 -9
  134. package/dist/index.js +261 -109
  135. package/dist/{installs-CXGV291R.js → installs-BrOMqREO.js} +7 -6
  136. package/dist/{installs-89zeUsVn.js → installs-z69au9Te.js} +7 -6
  137. package/dist/{links-Dg90NTyF.js → links-AVB88xxH.js} +1 -1
  138. package/dist/{links-7M-j83As.js → links-DpxpaKe1.js} +1 -1
  139. package/dist/llm-slug-generator.js +18 -19
  140. package/dist/{loader-BnzQyT31.js → loader-CS-5lMQa.js} +3694 -4531
  141. package/dist/{logging-DuK6YXuK.js → logging-B3KnAryz.js} +2 -2
  142. package/dist/{logging-CNq0UUgf.js → logging-DEPo2hji.js} +1 -1
  143. package/dist/{login-qr-CJ__cE3-.js → login-qr--28WL1TN.js} +11 -5
  144. package/dist/{login-qr-BVeOFfNW.js → login-qr-4o2aC2UE.js} +9 -4
  145. package/dist/{login-qr-BJChByHH.js → login-qr-BUdeu1Sl.js} +8 -2
  146. package/dist/{login-qr-KUOtNJaQ.js → login-qr-BsYM2E1y.js} +12 -6
  147. package/dist/{logs-cli-Cm7AiarR.js → logs-cli-DDMD5w5_.js} +38 -22
  148. package/dist/{logs-cli-BWmtAsjp.js → logs-cli-DvPoVKCN.js} +38 -22
  149. package/dist/{manager-C-jXr9ks.js → manager-CXo1uqmO.js} +102 -86
  150. package/dist/{manager-CMFBuvVd.js → manager-ChW0jk7T.js} +101 -85
  151. package/dist/{manager-D2Ndphg3.js → manager-DUOe7ud6.js} +100 -85
  152. package/dist/{manager-BsdlwsL5.js → manager-PoxUqdN_.js} +98 -82
  153. package/dist/{manifest-registry-D5SiA3xq.js → manifest-registry-CVsqjgX0.js} +40 -2
  154. package/dist/{manifest-registry-DyMRD3rY.js → manifest-registry-jeAPx6AW.js} +40 -2
  155. package/dist/{message-channel-CHRYQtAM.js → message-channel-CTtrEkmW.js} +1 -1
  156. package/dist/{message-channel-BlgPSDAh.js → message-channel-DWcu72r7.js} +1 -1
  157. package/dist/{model-auth-BqjMkNFs.js → model-auth-BvODRbV0.js} +362 -35
  158. package/dist/{model-selection-DbsbOAoh.js → model-selection-B53OvWCf.js} +353 -33
  159. package/dist/{model-selection-DlV6wnTr.js → model-selection-vC82fEiP.js} +331 -30
  160. package/dist/{models-cli-DIFBrK4W.js → models-cli-DqsKsOgd.js} +66 -55
  161. package/dist/{models-cli-0XhQQbMW.js → models-cli-NV0bnh8l.js} +66 -55
  162. package/dist/{node-cli-BMUfVCSq.js → node-cli-C7YleuBk.js} +54 -44
  163. package/dist/{node-cli-DY4lzhDA.js → node-cli-CxwoHnZ6.js} +54 -44
  164. package/dist/{node-service-DQ-tiSie.js → node-service-C7f_uvx9.js} +2 -2
  165. package/dist/{node-service-u8g85nD3.js → node-service-De_WkxJe.js} +2 -2
  166. package/dist/{nodes-cli-BX6oWnLC.js → nodes-cli-BxrMVI9V.js} +25 -23
  167. package/dist/{nodes-cli-CVHzcQo2.js → nodes-cli-Clb0ocwB.js} +24 -22
  168. package/dist/{nodes-screen-DGlNPbk4.js → nodes-screen-CVL9363A.js} +48 -6
  169. package/dist/{nodes-screen-lykd2cny.js → nodes-screen-DsHJIN2I.js} +47 -5
  170. package/dist/{note-Ci08TSbV.js → note-Duiadw1g.js} +1 -1
  171. package/dist/{note-DVO1KLaW.js → note-uC6iDp4y.js} +2 -2
  172. package/dist/{onboard-channels-DTkFFbzS.js → onboard-channels-C5Iaafwb.js} +10 -10
  173. package/dist/{onboard-channels-CtDnwaF5.js → onboard-channels-C5uL3i8d.js} +11 -11
  174. package/dist/{onboard-skills-BnAcpzfX.js → onboard-skills-BFxdI1Y1.js} +1143 -112
  175. package/dist/{onboard-skills-DuoDzEmI.js → onboard-skills-DUG8Y0se.js} +1142 -111
  176. package/dist/{onboarding-DvhiiHh0.js → onboarding-ClzElK4D.js} +56 -48
  177. package/dist/{openclaw-root-93W6UrUK.js → openclaw-root-BKsZvO6K.js} +6 -2
  178. package/dist/{openclaw-root-9ILYSmJ9.js → openclaw-root-CEnmuBUN.js} +6 -2
  179. package/dist/{pairing-cli-BKJHBxwT.js → pairing-cli-BWWFZF7Q.js} +16 -16
  180. package/dist/{pairing-cli-DJHjPBwu.js → pairing-cli-BrFLxnug.js} +16 -16
  181. package/dist/{pairing-labels-xImhiJax.js → pairing-labels-C8KULWNH.js} +1 -1
  182. package/dist/{pairing-labels-CHxlh3tT.js → pairing-labels-Dt2vXyI7.js} +1 -1
  183. package/dist/{pairing-store-CO6umWFP.js → pairing-store-Dz-ArTQS.js} +3 -3
  184. package/dist/{pairing-store-BpPUNzmB.js → pairing-store-gQdv7Ruh.js} +2 -2
  185. package/dist/{path-env-Nq83EHH9.js → path-env-BRKerjt1.js} +2 -2
  186. package/dist/{path-env-CXWUFfFv.js → path-env-OJAyUeWW.js} +1 -1
  187. package/dist/paths-BZK4Ct0I.js +81 -0
  188. package/dist/paths-DWYi0R_2.js +78 -0
  189. package/dist/{paths-Bkhd_qY8.js → paths-DdKf4lHp.js} +35 -5
  190. package/dist/paths-SFzVNGbc.js +78 -0
  191. package/dist/pi-auth-json-D7hGObyW.js +12 -0
  192. package/dist/pi-auth-json-DgvHjfJy.js +8 -0
  193. package/dist/pi-auth-json-la6lnAzY.js +79 -0
  194. package/dist/pi-auth-json-p3vsMR7W.js +79 -0
  195. package/dist/{pi-embedded-C1qKCgDT.js → pi-embedded-De6SeAPs.js} +9518 -9968
  196. package/dist/{pi-embedded-helpers-DtPn5RC8.js → pi-embedded-helpers-BrUBxrE2.js} +70 -10
  197. package/dist/{pi-embedded-helpers-DhEkdWB1.js → pi-embedded-helpers-D0mqOwwq.js} +821 -128
  198. package/dist/{pi-embedded-helpers-7AjuNiiJ.js → pi-embedded-helpers-DpJb0kUk.js} +69 -9
  199. package/dist/{pi-embedded-helpers-BTkXgwJ7.js → pi-embedded-helpers-ZI1UCSRM.js} +927 -136
  200. package/dist/{pi-tools.policy-gG96mWwA.js → pi-tools.policy-z5Wd_2WN.js} +4 -4
  201. package/dist/{plugin-auto-enable-D5ye7QnB.js → plugin-auto-enable-B8mX3rX3.js} +14 -5
  202. package/dist/{plugin-auto-enable-BROgMZcf.js → plugin-auto-enable-OO0eDINB.js} +14 -5
  203. package/dist/plugin-sdk/agents/apply-patch-update.d.ts +3 -1
  204. package/dist/plugin-sdk/agents/apply-patch.d.ts +11 -3
  205. package/dist/plugin-sdk/agents/auth-profiles/profiles.d.ts +5 -0
  206. package/dist/plugin-sdk/agents/auth-profiles.d.ts +1 -1
  207. package/dist/plugin-sdk/agents/bash-process-registry.d.ts +1 -0
  208. package/dist/plugin-sdk/agents/bash-tools.exec.d.ts +26 -0
  209. package/dist/plugin-sdk/agents/current-time.d.ts +17 -0
  210. package/dist/plugin-sdk/agents/huggingface-models.d.ts +17 -0
  211. package/dist/plugin-sdk/agents/models-config.providers.d.ts +10 -0
  212. package/dist/plugin-sdk/agents/openclaw-tools.d.ts +2 -0
  213. package/dist/plugin-sdk/agents/pi-auth-json.d.ts +14 -0
  214. package/dist/plugin-sdk/agents/pi-embedded-helpers/errors.d.ts +5 -1
  215. package/dist/plugin-sdk/agents/pi-embedded-helpers.d.ts +1 -1
  216. package/dist/plugin-sdk/agents/pi-embedded-runner/google.d.ts +1 -0
  217. package/dist/plugin-sdk/agents/pi-embedded-runner/run/images.d.ts +9 -4
  218. package/dist/plugin-sdk/agents/pi-embedded-runner/run/params.d.ts +2 -0
  219. package/dist/plugin-sdk/agents/pi-embedded-runner/run/payloads.d.ts +1 -0
  220. package/dist/plugin-sdk/agents/pi-embedded-runner/run/types.d.ts +2 -0
  221. package/dist/plugin-sdk/agents/pi-embedded-runner/types.d.ts +15 -0
  222. package/dist/plugin-sdk/agents/pi-embedded-subscribe.handlers.tools.d.ts +1 -1
  223. package/dist/plugin-sdk/agents/pi-embedded-subscribe.handlers.types.d.ts +2 -0
  224. package/dist/plugin-sdk/agents/pi-embedded-subscribe.types.d.ts +2 -0
  225. package/dist/plugin-sdk/agents/pi-tools.read.d.ts +8 -3
  226. package/dist/plugin-sdk/agents/sandbox/constants.d.ts +1 -1
  227. package/dist/plugin-sdk/agents/sandbox/docker.d.ts +14 -3
  228. package/dist/plugin-sdk/agents/sandbox/fs-bridge.d.ts +56 -0
  229. package/dist/plugin-sdk/agents/sandbox/types.d.ts +2 -0
  230. package/dist/plugin-sdk/agents/session-tool-result-guard-wrapper.d.ts +2 -0
  231. package/dist/plugin-sdk/agents/session-tool-result-guard.d.ts +4 -0
  232. package/dist/plugin-sdk/agents/subagent-registry.d.ts +3 -1
  233. package/dist/plugin-sdk/agents/tools/agent-step.d.ts +3 -0
  234. package/dist/plugin-sdk/agents/tools/browser-tool.schema.d.ts +2 -2
  235. package/dist/plugin-sdk/agents/tools/common.d.ts +4 -0
  236. package/dist/plugin-sdk/agents/tools/image-tool.d.ts +9 -1
  237. package/dist/plugin-sdk/agents/tools/web-search.d.ts +10 -1
  238. package/dist/plugin-sdk/agents/usage.d.ts +1 -0
  239. package/dist/plugin-sdk/auto-reply/reply/commands-status.d.ts +1 -0
  240. package/dist/plugin-sdk/auto-reply/reply/get-reply-directives.d.ts +1 -0
  241. package/dist/plugin-sdk/auto-reply/reply/memory-flush.d.ts +2 -2
  242. package/dist/plugin-sdk/auto-reply/reply/mentions.d.ts +1 -0
  243. package/dist/plugin-sdk/auto-reply/reply/model-selection.d.ts +3 -0
  244. package/dist/plugin-sdk/auto-reply/reply/reply-reference.d.ts +1 -1
  245. package/dist/plugin-sdk/auto-reply/reply/session-run-accounting.d.ts +11 -0
  246. package/dist/plugin-sdk/auto-reply/reply/session-usage.d.ts +8 -0
  247. package/dist/plugin-sdk/auto-reply/status.d.ts +2 -0
  248. package/dist/plugin-sdk/auto-reply/templating.d.ts +3 -0
  249. package/dist/plugin-sdk/auto-reply/thinking.d.ts +1 -1
  250. package/dist/plugin-sdk/auto-reply/types.d.ts +2 -0
  251. package/dist/plugin-sdk/browser/cdp.helpers.d.ts +2 -1
  252. package/dist/plugin-sdk/browser/client-actions-core.d.ts +1 -0
  253. package/dist/plugin-sdk/browser/control-auth.d.ts +13 -0
  254. package/dist/plugin-sdk/browser/pw-ai.d.ts +1 -1
  255. package/dist/plugin-sdk/browser/pw-session.d.ts +25 -0
  256. package/dist/plugin-sdk/browser/pw-tools-core.interactions.d.ts +2 -0
  257. package/dist/plugin-sdk/browser/routes/dispatcher.d.ts +1 -0
  258. package/dist/plugin-sdk/browser/routes/types.d.ts +5 -0
  259. package/dist/plugin-sdk/channels/plugins/onboarding/signal.d.ts +1 -0
  260. package/dist/plugin-sdk/channels/registry.d.ts +2 -2
  261. package/dist/plugin-sdk/cli/nodes-camera.d.ts +8 -2
  262. package/dist/plugin-sdk/cli/prompt.d.ts +1 -0
  263. package/dist/plugin-sdk/commands/agent/types.d.ts +2 -0
  264. package/dist/plugin-sdk/commands/onboard-helpers.d.ts +1 -0
  265. package/dist/plugin-sdk/commands/onboard-types.d.ts +9 -1
  266. package/dist/plugin-sdk/commands/signal-install.d.ts +20 -0
  267. package/dist/plugin-sdk/config/config.d.ts +1 -1
  268. package/dist/plugin-sdk/config/group-policy.d.ts +3 -0
  269. package/dist/plugin-sdk/config/merge-patch.d.ts +1 -0
  270. package/dist/plugin-sdk/config/sessions/paths.d.ts +14 -4
  271. package/dist/plugin-sdk/config/sessions/store.d.ts +8 -0
  272. package/dist/plugin-sdk/config/sessions/types.d.ts +8 -0
  273. package/dist/plugin-sdk/config/types.agents.d.ts +2 -0
  274. package/dist/plugin-sdk/config/types.channels.d.ts +2 -0
  275. package/dist/plugin-sdk/config/types.d.ts +1 -0
  276. package/dist/plugin-sdk/config/types.discord.d.ts +5 -0
  277. package/dist/plugin-sdk/config/types.gateway.d.ts +35 -0
  278. package/dist/plugin-sdk/config/types.hooks.d.ts +23 -1
  279. package/dist/plugin-sdk/config/types.irc.d.ts +96 -0
  280. package/dist/plugin-sdk/config/types.memory.d.ts +2 -0
  281. package/dist/plugin-sdk/config/types.openclaw.d.ts +6 -0
  282. package/dist/plugin-sdk/config/types.queue.d.ts +1 -0
  283. package/dist/plugin-sdk/config/types.slack.d.ts +2 -0
  284. package/dist/plugin-sdk/config/types.telegram.d.ts +2 -0
  285. package/dist/plugin-sdk/config/validation.d.ts +20 -0
  286. package/dist/plugin-sdk/config/zod-schema.agents.d.ts +1 -0
  287. package/dist/plugin-sdk/config/zod-schema.core.d.ts +2 -0
  288. package/dist/plugin-sdk/config/zod-schema.d.ts +193 -2
  289. package/dist/plugin-sdk/config/zod-schema.hooks.d.ts +3 -2
  290. package/dist/plugin-sdk/config/zod-schema.providers-core.d.ts +378 -0
  291. package/dist/plugin-sdk/config/zod-schema.providers.d.ts +176 -0
  292. package/dist/plugin-sdk/config/zod-schema.sensitive.d.ts +2 -0
  293. package/dist/plugin-sdk/config/zod-schema.session.d.ts +1 -0
  294. package/dist/plugin-sdk/cron/service/jobs.d.ts +8 -0
  295. package/dist/plugin-sdk/cron/service/state.d.ts +1 -0
  296. package/dist/plugin-sdk/cron/types.d.ts +2 -0
  297. package/dist/plugin-sdk/discord/monitor/allow-list.d.ts +15 -0
  298. package/dist/plugin-sdk/discord/send.types.d.ts +5 -0
  299. package/dist/plugin-sdk/gateway/auth-rate-limit.d.ts +59 -0
  300. package/dist/plugin-sdk/gateway/auth.d.ts +47 -0
  301. package/dist/plugin-sdk/gateway/net.d.ts +5 -0
  302. package/dist/plugin-sdk/gateway/protocol/index.d.ts +7 -7
  303. package/dist/plugin-sdk/gateway/protocol/schema/agent.d.ts +7 -1
  304. package/dist/plugin-sdk/gateway/protocol/schema/channels.d.ts +21 -0
  305. package/dist/plugin-sdk/gateway/protocol/schema/types.d.ts +3 -1
  306. package/dist/plugin-sdk/gateway/session-utils.fs.d.ts +3 -1
  307. package/dist/plugin-sdk/gateway/session-utils.types.d.ts +1 -0
  308. package/dist/plugin-sdk/imessage/send.d.ts +12 -0
  309. package/dist/plugin-sdk/index.js +2147 -900
  310. package/dist/plugin-sdk/infra/binaries.d.ts +3 -0
  311. package/dist/plugin-sdk/infra/brew.d.ts +8 -0
  312. package/dist/plugin-sdk/infra/heartbeat-active-hours.d.ts +5 -0
  313. package/dist/plugin-sdk/infra/heartbeat-runner.d.ts +1 -0
  314. package/dist/plugin-sdk/infra/heartbeat-wake.d.ts +8 -1
  315. package/dist/plugin-sdk/infra/net/fetch-guard.d.ts +1 -0
  316. package/dist/plugin-sdk/infra/net/ssrf.d.ts +1 -0
  317. package/dist/plugin-sdk/infra/outbound/message.d.ts +2 -0
  318. package/dist/plugin-sdk/infra/outbound/outbound-send-service.d.ts +2 -0
  319. package/dist/plugin-sdk/infra/session-cost-usage.d.ts +3 -0
  320. package/dist/plugin-sdk/infra/tailscale.d.ts +34 -0
  321. package/dist/plugin-sdk/infra/tmp-openclaw-dir.d.ts +10 -0
  322. package/dist/plugin-sdk/logging/console.d.ts +4 -0
  323. package/dist/plugin-sdk/logging/logger.d.ts +1 -1
  324. package/dist/plugin-sdk/logging/state.d.ts +1 -0
  325. package/dist/plugin-sdk/logging.d.ts +2 -2
  326. package/dist/plugin-sdk/markdown/ir.d.ts +1 -1
  327. package/dist/plugin-sdk/markdown/whatsapp.d.ts +14 -0
  328. package/dist/plugin-sdk/media/input-files.d.ts +5 -0
  329. package/dist/plugin-sdk/media/store.d.ts +10 -0
  330. package/dist/plugin-sdk/media-understanding/audio-preflight.d.ts +16 -0
  331. package/dist/plugin-sdk/media-understanding/types.d.ts +1 -0
  332. package/dist/plugin-sdk/memory/backend-config.d.ts +2 -1
  333. package/dist/plugin-sdk/memory/embedding-chunk-limits.d.ts +3 -0
  334. package/dist/plugin-sdk/memory/embedding-input-limits.d.ts +2 -0
  335. package/dist/plugin-sdk/memory/embedding-model-limits.d.ts +2 -0
  336. package/dist/plugin-sdk/memory/embeddings.d.ts +1 -0
  337. package/dist/plugin-sdk/memory/internal.d.ts +11 -0
  338. package/dist/plugin-sdk/memory/manager.d.ts +0 -6
  339. package/dist/plugin-sdk/memory/qmd-manager.d.ts +2 -0
  340. package/dist/plugin-sdk/memory/qmd-query-parser.d.ts +8 -0
  341. package/dist/plugin-sdk/memory/session-files.d.ts +2 -0
  342. package/dist/plugin-sdk/process/command-queue.d.ts +16 -0
  343. package/dist/plugin-sdk/providers/github-copilot-token.d.ts +3 -0
  344. package/dist/plugin-sdk/routing/resolve-route.d.ts +3 -1
  345. package/dist/plugin-sdk/security/external-content.d.ts +1 -1
  346. package/dist/plugin-sdk/security/secret-equal.d.ts +1 -0
  347. package/dist/plugin-sdk/sessions/input-provenance.d.ts +16 -0
  348. package/dist/plugin-sdk/signal/monitor/event-handler.types.d.ts +8 -0
  349. package/dist/plugin-sdk/signal/monitor/mentions.d.ts +2 -0
  350. package/dist/plugin-sdk/slack/monitor/commands.d.ts +5 -0
  351. package/dist/plugin-sdk/slack/monitor/media.d.ts +21 -0
  352. package/dist/plugin-sdk/slack/types.d.ts +1 -0
  353. package/dist/plugin-sdk/telegram/bot-message-context.d.ts +2 -1
  354. package/dist/plugin-sdk/telegram/fetch.d.ts +1 -0
  355. package/dist/plugin-sdk/telegram/monitor.d.ts +1 -0
  356. package/dist/plugin-sdk/telegram/send.d.ts +3 -0
  357. package/dist/plugin-sdk/tts/tts.d.ts +2 -2
  358. package/dist/plugin-sdk/utils/fetch-timeout.d.ts +2 -0
  359. package/dist/plugin-sdk/web/media.d.ts +12 -2
  360. package/dist/{plugins-CQw3z3Nw.js → plugins-CTjLu-z-.js} +4 -4
  361. package/dist/{plugins-B7F0Ly9G.js → plugins-CxrdL_IZ.js} +3 -3
  362. package/dist/{plugins-cli-CJ74eHvr.js → plugins-cli-CbX97Kvt.js} +259 -49
  363. package/dist/{plugins-cli-ubDwUAzK.js → plugins-cli-Dn9OeO53.js} +257 -47
  364. package/dist/{ports-kYsTYQdA.js → ports-C8YYHVlc.js} +2 -2
  365. package/dist/{program-1bQ15ivo.js → program-D-mNC0It.js} +86 -83
  366. package/dist/{progress-Da1ehW-x.js → progress-COHv-uNT.js} +1 -1
  367. package/dist/{progress-COzt9PNY.js → progress-DZb6yPcJ.js} +1 -1
  368. package/dist/{prompt-style-Dc0C5HC9.js → prompt-style-Cf1r1L6k.js} +1 -1
  369. package/dist/{prompt-style-DjZDxcFg.js → prompt-style-lSlXMhsd.js} +1 -1
  370. package/dist/{pw-ai-CQ4-gUNR.js → pw-ai-6GzTgK5g.js} +205 -32
  371. package/dist/{pw-ai-1NN0FrJb.js → pw-ai-C8YhJRaI.js} +207 -32
  372. package/dist/{pw-ai-qEMUq5Mt.js → pw-ai-CKGenizV.js} +203 -29
  373. package/dist/{pw-ai-IOqEXO1O.js → pw-ai-D7devT89.js} +206 -32
  374. package/dist/{qmd-manager-CEwp3el1.js → qmd-manager-CQzWovq-.js} +71 -90
  375. package/dist/{qmd-manager-D6N3qvQ5.js → qmd-manager-Cs8RJVQp.js} +73 -90
  376. package/dist/{qmd-manager-C48QzrRe.js → qmd-manager-DdgrQ2kc.js} +71 -88
  377. package/dist/{qmd-manager-DaUqCKB_.js → qmd-manager-dyIoOvKl.js} +73 -90
  378. package/dist/{register.subclis-Cm-VJ5nP.js → register.subclis-ifHtmF3e.js} +29 -29
  379. package/dist/{reply-CBs4e9Rm.js → reply-VIHqsQ-k.js} +7906 -8743
  380. package/dist/{routes-9ygR0GOk.js → routes-CaCvio4Q.js} +36 -15
  381. package/dist/{routes-BrWrBk2R.js → routes-Cpfxk96k.js} +36 -14
  382. package/dist/{rpc-Cjuz2Gv1.js → rpc-BhB01Bhj.js} +3 -3
  383. package/dist/{rpc-DhkLVY5H.js → rpc-C5WsS_Ne.js} +3 -3
  384. package/dist/{run-main-BlZ5l-X9.js → run-main-DVy6KJTe.js} +88 -85
  385. package/dist/runner-B7CKBC80.js +1800 -0
  386. package/dist/runner-BEy5ZGFv.js +1901 -0
  387. package/dist/runner-Bv0BmJPF.js +1800 -0
  388. package/dist/runner-ChqVEgPx.js +1901 -0
  389. package/dist/{sandbox-qt49csTr.js → sandbox-BAChxjC5.js} +627 -157
  390. package/dist/{sandbox-CPZiaKcS.js → sandbox-DNHDwHw8.js} +628 -158
  391. package/dist/{sandbox-cli-C6_iNuqO.js → sandbox-cli-9oq67QEg.js} +22 -22
  392. package/dist/{sandbox-cli-C_wK-KAE.js → sandbox-cli-BiNq9yUe.js} +22 -22
  393. package/dist/{security-cli-CTTD1vms.js → security-cli-CRg03hvq.js} +28 -28
  394. package/dist/{security-cli-DRpGF2Yc.js → security-cli-LmBBHnmh.js} +28 -28
  395. package/dist/{server-context-lyNcqJYD.js → server-context-FwqBRH3K.js} +10 -10
  396. package/dist/{server-context-39mkstUs.js → server-context-RY7lRaxl.js} +9 -9
  397. package/dist/{server-node-events-V_G9BRRw.js → server-node-events-BbHOZX3O.js} +48 -43
  398. package/dist/{server-node-events-o9G18PaE.js → server-node-events-CngNLVL-.js} +50 -45
  399. package/dist/{service-DOlJdIqe.js → service-BnqdBTAK.js} +8 -4
  400. package/dist/{service-DDPRbf8a.js → service-DZN7KRok.js} +8 -4
  401. package/dist/{service-audit-VDRrWefh.js → service-audit-0Eil3ISN.js} +4 -4
  402. package/dist/{service-audit-CVy00Ze_.js → service-audit-B8KIOe8A.js} +4 -4
  403. package/dist/{session-cost-usage-CcCEQNuc.js → session-cost-usage-B-tyjp76.js} +14 -14
  404. package/dist/{session-cost-usage-PvyVZz-g.js → session-cost-usage-BYUb7fov.js} +14 -14
  405. package/dist/{shared-BnpC3wMU.js → shared-BCdNboU1.js} +3 -3
  406. package/dist/{shared-CagUDdmp.js → shared-CsAwU6-q.js} +3 -3
  407. package/dist/{shared-BDk_zC9p.js → shared-Csn6DLBA.js} +5 -5
  408. package/dist/{shared-C92wo-6f.js → shared-DEanAgja.js} +4 -4
  409. package/dist/{skill-scanner-C_fQzVDu.js → skill-scanner-BrGkh5K7.js} +1 -1
  410. package/dist/{skill-scanner-DrVEHfC6.js → skill-scanner-CucvxYhu.js} +1 -1
  411. package/dist/{skills-Ccsv3IQq.js → skills-CE7by2IF.js} +151 -8
  412. package/dist/{skills-_eKGrw9z.js → skills-Dz15dAM4.js} +152 -9
  413. package/dist/{skills-cli-DqvLjooh.js → skills-cli-B5b75pDK.js} +13 -13
  414. package/dist/{skills-cli-DUncybht.js → skills-cli-CbCDrYwp.js} +13 -13
  415. package/dist/{skills-status-Cp2ZFhIx.js → skills-status-B99Us6yS.js} +2 -2
  416. package/dist/{skills-status-Ck0CCFZG.js → skills-status-ChM7JE47.js} +3 -3
  417. package/dist/{sqlite-DODNHWJb.js → sqlite-2UsPaJz5.js} +97 -2
  418. package/dist/{sqlite-cSdsHVEw.js → sqlite-CASnHrgX.js} +97 -1
  419. package/dist/{sqlite-Bwo2rASR.js → sqlite-CVWiMkGu.js} +97 -1
  420. package/dist/{sqlite-CpqIbY4-.js → sqlite-CcIWkGaM.js} +97 -1
  421. package/dist/{status-Bmx9_1C7.js → status-CKuX1-zb.js} +3 -3
  422. package/dist/{status-CBGgwlTW.js → status-Cm4q6o-I.js} +57 -49
  423. package/dist/{status-DkJgtvSz.js → status-DD2iqGc9.js} +4 -4
  424. package/dist/{subsystem-DPnkvS73.js → subsystem-DHfJG4gk.js} +73 -20
  425. package/dist/{system-cli-9fQ1uLiz.js → system-cli-BVJDR474.js} +87 -15
  426. package/dist/{system-cli-Gq8OWHFg.js → system-cli-C3Y_9VpI.js} +88 -16
  427. package/dist/{systemd-Pa7LURHB.js → systemd-DxddcFsa.js} +3 -3
  428. package/dist/{systemd-hints-zi4ohCOY.js → systemd-hints-BVLopJ9O.js} +1 -1
  429. package/dist/{systemd-linger-CDo2UbHM.js → systemd-linger-BThjV1Sr.js} +2 -2
  430. package/dist/{systemd-linger-6_naJcJp.js → systemd-linger-D3Va1Cv7.js} +2 -2
  431. package/dist/{systemd-BEWwfwn0.js → systemd-s3S2HVog.js} +3 -3
  432. package/dist/{table-Bb9gAVIp.js → table-BIk8Aan_.js} +2 -2
  433. package/dist/{table-cCoGqLsk.js → table-Bvka_vkc.js} +1 -1
  434. package/dist/{tool-display-DUVhO36P.js → tool-display-DbdMQFZx.js} +2 -2
  435. package/dist/{tool-display-DNOVCI6J.js → tool-display-kpW5Hg2z.js} +2 -2
  436. package/dist/{tui-DDVqLwqT.js → tui-B40Z2jMa.js} +120 -14
  437. package/dist/{tui-cli-CurbazQf.js → tui-cli-Bwa6K7xR.js} +28 -28
  438. package/dist/{tui-cli-BeN2K38I.js → tui-cli-DD6g7uZb.js} +27 -27
  439. package/dist/{tui-B9zLJxf6.js → tui-lFMZUnx6.js} +121 -13
  440. package/dist/{update-Ct9sqJC_.js → update-Bos8PPCG.js} +3 -3
  441. package/dist/{update--i077azM.js → update-Cg8MtrEr.js} +3 -3
  442. package/dist/{update-cli-CT5W0kpw.js → update-cli-CC-wTeje.js} +92 -73
  443. package/dist/{update-cli-C87lNK1S.js → update-cli-CULnXFL_.js} +91 -72
  444. package/dist/{update-runner-BIttRDyV.js → update-runner-BaLsla0c.js} +11 -11
  445. package/dist/{update-runner-xbeVkAD9.js → update-runner-Dbsdl5AU.js} +10 -10
  446. package/dist/{utils-Dk86IbEs.js → utils-BLJAc3ZV.js} +1 -1
  447. package/dist/{utils-BTaR--Ln.js → utils-BtIMES3N.js} +1 -1
  448. package/dist/{webhooks-cli-Db3zyJaw.js → webhooks-cli-ClHLUu_j.js} +21 -13
  449. package/dist/{webhooks-cli-DUUa8gVY.js → webhooks-cli-DVXr2uyN.js} +21 -13
  450. package/dist/{widearea-dns-BgYasW6m.js → widearea-dns-C4RnIR9O.js} +3 -3
  451. package/dist/{widearea-dns-CMIG6-74.js → widearea-dns-Ypwgjpsr.js} +3 -3
  452. package/dist/{ws-C0k_dhCP.js → ws-BcJt4pcg.js} +24 -2
  453. package/dist/{ws-DtDKpbLR.js → ws-MC-rTJLe.js} +24 -2
  454. package/dist/{ws-log-cMNgAyLy.js → ws-log-WrJ4QYu7.js} +1 -1
  455. package/dist/{ws-log-C6vm_XMA.js → ws-log-lip4ETlm.js} +2 -2
  456. package/dist/{wsl-rfIr_Sde.js → wsl-BvTIzy-8.js} +5 -3
  457. package/docs/assets/install-script.svg +1 -0
  458. package/docs/automation/hooks.md +1 -38
  459. package/docs/automation/webhook.md +52 -2
  460. package/docs/channels/discord.md +389 -381
  461. package/docs/channels/grammy.md +1 -1
  462. package/docs/channels/imessage.md +229 -218
  463. package/docs/channels/index.md +1 -0
  464. package/docs/channels/irc.md +234 -0
  465. package/docs/channels/msteams.md +2 -0
  466. package/docs/channels/pairing.md +1 -1
  467. package/docs/channels/slack.md +295 -415
  468. package/docs/channels/telegram.md +397 -460
  469. package/docs/channels/whatsapp.md +338 -310
  470. package/docs/ci.md +0 -12
  471. package/docs/cli/hooks.md +1 -14
  472. package/docs/cli/index.md +6 -1
  473. package/docs/cli/logs.md +4 -0
  474. package/docs/cli/onboard.md +33 -0
  475. package/docs/cli/plugins.md +20 -1
  476. package/docs/cli/security.md +2 -0
  477. package/docs/concepts/architecture.md +0 -16
  478. package/docs/concepts/memory.md +7 -4
  479. package/docs/concepts/model-providers.md +27 -0
  480. package/docs/concepts/session-tool.md +1 -0
  481. package/docs/concepts/system-prompt.md +13 -0
  482. package/docs/docs.json +18 -12
  483. package/docs/experiments/plans/browser-evaluate-cdp-refactor.md +229 -0
  484. package/docs/gateway/configuration-examples.md +9 -2
  485. package/docs/gateway/configuration-reference.md +2345 -0
  486. package/docs/gateway/configuration.md +338 -3297
  487. package/docs/gateway/index.md +162 -238
  488. package/docs/gateway/openai-http-api.md +1 -0
  489. package/docs/gateway/openresponses-http-api.md +16 -0
  490. package/docs/gateway/remote-gateway-readme.md +0 -16
  491. package/docs/gateway/security/index.md +4 -16
  492. package/docs/gateway/tools-invoke-http-api.md +26 -1
  493. package/docs/help/faq.md +9 -0
  494. package/docs/help/testing.md +11 -0
  495. package/docs/install/docker.md +18 -0
  496. package/docs/install/hetzner.md +21 -0
  497. package/docs/install/installer.md +20 -0
  498. package/docs/nodes/audio.md +19 -0
  499. package/docs/platforms/mac/release.md +7 -7
  500. package/docs/providers/glm.md +3 -3
  501. package/docs/providers/huggingface.md +209 -0
  502. package/docs/providers/index.md +3 -0
  503. package/docs/providers/litellm.md +153 -0
  504. package/docs/providers/together.md +2 -2
  505. package/docs/providers/vllm.md +92 -0
  506. package/docs/providers/zai.md +2 -2
  507. package/docs/reference/credits.md +4 -28
  508. package/docs/reference/test.md +2 -1
  509. package/docs/reference/token-use.md +1 -1
  510. package/docs/reference/transcript-hygiene.md +18 -0
  511. package/docs/start/getting-started.md +5 -0
  512. package/docs/start/onboarding-overview.md +51 -0
  513. package/docs/start/onboarding.md +1 -0
  514. package/docs/start/openclaw.md +0 -16
  515. package/docs/start/wizard-cli-automation.md +17 -0
  516. package/docs/start/wizard-cli-reference.md +12 -0
  517. package/docs/start/wizard.md +3 -1
  518. package/docs/tools/browser.md +6 -0
  519. package/docs/zh-CN/automation/hooks.md +1 -38
  520. package/docs/zh-CN/cli/hooks.md +1 -14
  521. package/extensions/bluebubbles/package.json +1 -1
  522. package/extensions/bluebubbles/src/monitor.test.ts +40 -28
  523. package/extensions/bluebubbles/src/monitor.ts +0 -4
  524. package/extensions/copilot-proxy/package.json +1 -1
  525. package/extensions/diagnostics-otel/package.json +10 -10
  526. package/extensions/discord/package.json +1 -1
  527. package/extensions/feishu/package.json +2 -5
  528. package/extensions/feishu/src/bot.checkBotMentioned.test.ts +64 -0
  529. package/extensions/feishu/src/bot.test.ts +265 -0
  530. package/extensions/feishu/src/bot.ts +73 -18
  531. package/extensions/feishu/src/channel.test.ts +48 -0
  532. package/extensions/feishu/src/channel.ts +1 -3
  533. package/extensions/feishu/src/config-schema.ts +6 -0
  534. package/extensions/feishu/src/docx.ts +14 -4
  535. package/extensions/feishu/src/media.test.ts +151 -0
  536. package/extensions/feishu/src/media.ts +27 -13
  537. package/extensions/feishu/src/reply-dispatcher.test.ts +116 -0
  538. package/extensions/feishu/src/reply-dispatcher.ts +124 -67
  539. package/extensions/feishu/src/streaming-card.ts +223 -0
  540. package/extensions/feishu/src/targets.test.ts +16 -0
  541. package/extensions/feishu/src/targets.ts +1 -1
  542. package/extensions/google-antigravity-auth/package.json +1 -1
  543. package/extensions/google-gemini-cli-auth/oauth.test.ts +4 -1
  544. package/extensions/google-gemini-cli-auth/package.json +1 -1
  545. package/extensions/googlechat/package.json +1 -1
  546. package/extensions/googlechat/src/channel.ts +3 -20
  547. package/extensions/googlechat/src/resolve-target.test.ts +138 -0
  548. package/extensions/imessage/package.json +1 -1
  549. package/extensions/irc/index.ts +17 -0
  550. package/extensions/irc/openclaw.plugin.json +9 -0
  551. package/extensions/irc/package.json +14 -0
  552. package/extensions/irc/src/accounts.ts +268 -0
  553. package/extensions/irc/src/channel.ts +367 -0
  554. package/extensions/irc/src/client.test.ts +43 -0
  555. package/extensions/irc/src/client.ts +439 -0
  556. package/extensions/irc/src/config-schema.test.ts +27 -0
  557. package/extensions/irc/src/config-schema.ts +97 -0
  558. package/extensions/irc/src/control-chars.ts +22 -0
  559. package/extensions/irc/src/inbound.ts +334 -0
  560. package/extensions/irc/src/monitor.test.ts +43 -0
  561. package/extensions/irc/src/monitor.ts +158 -0
  562. package/extensions/irc/src/normalize.test.ts +46 -0
  563. package/extensions/irc/src/normalize.ts +117 -0
  564. package/extensions/irc/src/onboarding.test.ts +118 -0
  565. package/extensions/irc/src/onboarding.ts +479 -0
  566. package/extensions/irc/src/policy.test.ts +132 -0
  567. package/extensions/irc/src/policy.ts +157 -0
  568. package/extensions/irc/src/probe.ts +64 -0
  569. package/extensions/irc/src/protocol.test.ts +44 -0
  570. package/extensions/irc/src/protocol.ts +169 -0
  571. package/extensions/irc/src/runtime.ts +14 -0
  572. package/extensions/irc/src/send.ts +99 -0
  573. package/extensions/irc/src/types.ts +94 -0
  574. package/extensions/line/package.json +1 -1
  575. package/extensions/llm-task/package.json +1 -1
  576. package/extensions/lobster/package.json +1 -1
  577. package/extensions/matrix/CHANGELOG.md +6 -0
  578. package/extensions/matrix/node_modules/.bin/markdown-it +2 -2
  579. package/extensions/matrix/node_modules/.bin/markdown-it.CMD +2 -2
  580. package/extensions/matrix/node_modules/.bin/markdown-it.ps1 +2 -2
  581. package/extensions/matrix/package.json +2 -2
  582. package/extensions/matrix/src/matrix/monitor/media.ts +4 -2
  583. package/extensions/mattermost/package.json +1 -1
  584. package/extensions/memory-core/package.json +1 -1
  585. package/extensions/memory-lancedb/index.ts +6 -2
  586. package/extensions/memory-lancedb/node_modules/.bin/openai +2 -2
  587. package/extensions/memory-lancedb/node_modules/.bin/openai.CMD +2 -2
  588. package/extensions/memory-lancedb/node_modules/.bin/openai.ps1 +2 -2
  589. package/extensions/memory-lancedb/package.json +2 -2
  590. package/extensions/minimax-portal-auth/index.ts +7 -5
  591. package/extensions/minimax-portal-auth/package.json +1 -1
  592. package/extensions/msteams/CHANGELOG.md +6 -0
  593. package/extensions/msteams/package.json +1 -1
  594. package/extensions/msteams/src/media-helpers.test.ts +9 -0
  595. package/extensions/msteams/src/media-helpers.ts +15 -1
  596. package/extensions/msteams/src/mentions.test.ts +235 -0
  597. package/extensions/msteams/src/mentions.ts +114 -0
  598. package/extensions/msteams/src/messenger.test.ts +81 -1
  599. package/extensions/msteams/src/messenger.ts +11 -2
  600. package/extensions/nextcloud-talk/package.json +1 -1
  601. package/extensions/nostr/CHANGELOG.md +6 -0
  602. package/extensions/nostr/package.json +2 -2
  603. package/extensions/open-prose/package.json +1 -1
  604. package/extensions/signal/package.json +1 -1
  605. package/extensions/slack/package.json +1 -1
  606. package/extensions/telegram/package.json +1 -1
  607. package/extensions/telegram/src/channel.ts +1 -0
  608. package/extensions/tlon/package.json +1 -1
  609. package/extensions/twitch/CHANGELOG.md +6 -0
  610. package/extensions/twitch/package.json +1 -1
  611. package/extensions/twitch/src/onboarding.test.ts +5 -0
  612. package/extensions/twitch/src/outbound.test.ts +17 -6
  613. package/extensions/twitch/src/outbound.ts +12 -10
  614. package/extensions/voice-call/CHANGELOG.md +6 -0
  615. package/extensions/voice-call/package.json +1 -1
  616. package/extensions/voice-call/src/media-stream.ts +7 -1
  617. package/extensions/voice-call/src/providers/twilio.test.ts +5 -3
  618. package/extensions/voice-call/src/providers/twilio.ts +12 -1
  619. package/extensions/whatsapp/package.json +1 -1
  620. package/extensions/whatsapp/src/channel.ts +6 -16
  621. package/extensions/whatsapp/src/resolve-target.test.ts +154 -0
  622. package/extensions/zalo/CHANGELOG.md +6 -0
  623. package/extensions/zalo/package.json +1 -1
  624. package/extensions/zalouser/CHANGELOG.md +6 -0
  625. package/extensions/zalouser/package.json +1 -1
  626. package/package.json +26 -22
  627. package/dist/auth-BcNHFK-i.js +0 -184
  628. package/dist/auth-DkjJ3pm-.js +0 -184
  629. package/dist/boolean-M-esQJt6.js +0 -30
  630. package/dist/bundled/soul-evil/HOOK.md +0 -71
  631. package/dist/bundled/soul-evil/handler.js +0 -194
  632. package/dist/cli-B631__JU.js +0 -89
  633. package/dist/cli-DVhCVZZ6.js +0 -86
  634. package/dist/config-CI7EpvlP.js +0 -15
  635. package/dist/constants-DuoCkWRh.js +0 -65
  636. package/dist/control-ui/assets/index-CnB9IO4a.js.map +0 -1
  637. package/dist/control-ui/assets/index-DWhx-9JL.css +0 -1
  638. package/dist/date-time-c6HTX6IW.js +0 -187
  639. package/dist/frontmatter-xwTm0734.js +0 -105
  640. package/dist/parse-DqAvJRIf.js +0 -23
  641. package/dist/parse-duration-De_tAQSe.js +0 -24
  642. package/dist/parse-timeout-DV8NQQWk.js +0 -16
  643. package/dist/paths-IivnSNkP.js +0 -51
  644. package/dist/paths-MnZaxqPw.js +0 -48
  645. package/dist/paths-uoGO2aiO.js +0 -48
  646. package/dist/pi-model-discovery-DzFOAbQt.js +0 -20
  647. package/dist/plugin-sdk/tui/tui-formatters.d.ts +0 -31
  648. package/dist/session-key-nXYQSv-a.js +0 -167
  649. package/dist/tailscale-DU6DgqVy.js +0 -225
  650. package/dist/tailscale-DzJUWmKf.js +0 -252
  651. package/dist/utils-dp_OM900.js +0 -476
  652. package/docs/hooks/soul-evil.md +0 -69
  653. package/docs/zh-CN/hooks/soul-evil.md +0 -72
  654. package/skills/local-places/SERVER_README.md +0 -101
  655. package/skills/local-places/SKILL.md +0 -102
  656. package/skills/local-places/pyproject.toml +0 -21
  657. package/skills/local-places/src/local_places/__init__.py +0 -2
  658. package/skills/local-places/src/local_places/google_places.py +0 -314
  659. package/skills/local-places/src/local_places/main.py +0 -65
  660. package/skills/local-places/src/local_places/schemas.py +0 -107
  661. /package/dist/{archive-CXhvR9nU.js → archive-aSMUcOc6.js} +0 -0
  662. /package/dist/{archive-D0z3LZDK.js → archive-beaSfAzA.js} +0 -0
  663. /package/dist/{brew-BIrWdDps.js → brew-DlQQMJ3n.js} +0 -0
  664. /package/dist/{brew-B7YK4ZoL.js → brew-ROHf0-Xp.js} +0 -0
  665. /package/dist/{cli-utils-PlLcDZlM.js → cli-utils-CRhVAaLV.js} +0 -0
  666. /package/dist/{cli-utils-R-ECs5cY.js → cli-utils-CodyYLHe.js} +0 -0
  667. /package/dist/{command-format-BUxhT1xL.js → command-format-qUVxzqYm.js} +0 -0
  668. /package/dist/{constants-CNTiY-ZN.js → constants-BvQ6S8j5.js} +0 -0
  669. /package/dist/{errors-D3tYRJWG.js → errors-B91HIDPD.js} +0 -0
  670. /package/dist/{errors-B0eT3jVv.js → errors-Bv81hF2P.js} +0 -0
  671. /package/dist/{errors-x4NYs-1P.js → errors-Cojm0Kl7.js} +0 -0
  672. /package/dist/{format-CaxeRcue.js → format-CL8VOhxX.js} +0 -0
  673. /package/dist/{format-DLOJPZmo.js → format-DcfK-dwd.js} +0 -0
  674. /package/dist/{format-duration-CEmFWLyX.js → format-duration--hQihAvf.js} +0 -0
  675. /package/dist/{format-duration-DCXJx2ba.js → format-duration-84n6_DgO.js} +0 -0
  676. /package/dist/{format-relative-79_Y1n2Y.js → format-relative-Cywx6ldk.js} +0 -0
  677. /package/dist/{format-relative-Db7eqEu8.js → format-relative-cegC_FF5.js} +0 -0
  678. /package/dist/{helpers-CQI-5xS9.js → helpers-8O7IVGO-.js} +0 -0
  679. /package/dist/{helpers-DdwqKAAS.js → helpers-ByYj2Aq5.js} +0 -0
  680. /package/dist/{helpers-CRzoyyXS.js → helpers-CUVSCDJV.js} +0 -0
  681. /package/dist/{helpers-C89IG08W.js → helpers-HyeZXsnu.js} +0 -0
  682. /package/dist/{is-main-qJ675wPV.js → is-main-B9A8S9YC.js} +0 -0
  683. /package/dist/{is-main-WWuz28Ip.js → is-main-BWoXGz7p.js} +0 -0
  684. /package/dist/{logging-BzvBIA3Y.js → logging-D-Jq2wIo.js} +0 -0
  685. /package/dist/{logging-CfEk_PnX.js → logging-fywhKCmE.js} +0 -0
  686. /package/dist/{parse-Cjiudy6x.js → parse-Bw0oH-rT.js} +0 -0
  687. /package/dist/{parse-log-line-CUrpqe1w.js → parse-log-line-BuRiE-Ij.js} +0 -0
  688. /package/dist/{parse-log-line-D2UGw0wR.js → parse-log-line-CfVgwy6x.js} +0 -0
  689. /package/dist/{parse-timeout-DFSPLxpY.js → parse-timeout-D1XX_zN_.js} +0 -0
  690. /package/dist/{pi-model-discovery-CV2V1HHz.js → pi-model-discovery-DqgqUyAv.js} +0 -0
  691. /package/dist/{pi-model-discovery-DzEIEgHL.js → pi-model-discovery-EwKVHlZB.js} +0 -0
  692. /package/dist/{prompts--d-6l5Ln.js → prompts-Bg96reub.js} +0 -0
  693. /package/dist/{prompts-CXLLIBwP.js → prompts-Dszjy1n_.js} +0 -0
  694. /package/dist/{redact-BRmQPYDR.js → redact-BIMJ3ntQ.js} +0 -0
  695. /package/dist/{redact-BHmk44DI.js → redact-BRsnXqwD.js} +0 -0
  696. /package/dist/{redact-DAKeu7PA.js → redact-UvkXqguc.js} +0 -0
  697. /package/dist/{status-Cv36yYdi.js → status-C_dMhoE0.js} +0 -0
  698. /package/dist/{status-Drziap9H.js → status-DCkF_L3U.js} +0 -0
  699. /package/dist/{systemd-hints-CH4pbCFD.js → systemd-hints-CXNtLw9Q.js} +0 -0
  700. /package/dist/{tailnet-CL5GtL7t.js → tailnet-DATIFSsY.js} +0 -0
  701. /package/dist/{tailnet-DGRSvYuQ.js → tailnet-uoFvUSsw.js} +0 -0
  702. /package/dist/{transcript-events-BlIONGVn.js → transcript-events-BHS7QoRl.js} +0 -0
  703. /package/dist/{transcript-events-C1hdue6u.js → transcript-events-Bp7fGnwv.js} +0 -0
  704. /package/dist/{transcript-events-CZ8CG4ht.js → transcript-events-Ch7wLX-j.js} +0 -0
  705. /package/dist/{usage-format-6Uar63S0.js → usage-format-Bhl_WCWP.js} +0 -0
  706. /package/dist/{usage-format-hd37en6b.js → usage-format-CpORtVCG.js} +0 -0
  707. /package/extensions/{feishu → irc}/node_modules/.bin/claw +0 -0
  708. /package/extensions/{feishu → irc}/node_modules/.bin/claw.CMD +0 -0
  709. /package/extensions/{feishu → irc}/node_modules/.bin/claw.ps1 +0 -0
  710. /package/extensions/{feishu → irc}/node_modules/.bin/moltbot +0 -0
  711. /package/extensions/{feishu → irc}/node_modules/.bin/moltbot.CMD +0 -0
  712. /package/extensions/{feishu → irc}/node_modules/.bin/moltbot.ps1 +0 -0
  713. /package/extensions/{feishu → irc}/node_modules/.bin/pigbot +0 -0
  714. /package/extensions/{feishu → irc}/node_modules/.bin/pigbot.CMD +0 -0
  715. /package/extensions/{feishu → irc}/node_modules/.bin/pigbot.ps1 +0 -0
@@ -1,7 +1,7 @@
1
- (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();const Ln=globalThis,xi=Ln.ShadowRoot&&(Ln.ShadyCSS===void 0||Ln.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,$i=Symbol(),_a=new WeakMap;let nr=class{constructor(t,n,s){if(this._$cssResult$=!0,s!==$i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=n}get styleSheet(){let t=this.o;const n=this.t;if(xi&&t===void 0){const s=n!==void 0&&n.length===1;s&&(t=_a.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&_a.set(n,t))}return t}toString(){return this.cssText}};const Yl=e=>new nr(typeof e=="string"?e:e+"",void 0,$i),Jl=(e,...t)=>{const n=e.length===1?e[0]:t.reduce((s,i,a)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[a+1],e[0]);return new nr(n,e,$i)},Zl=(e,t)=>{if(xi)e.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of t){const s=document.createElement("style"),i=Ln.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=n.cssText,e.appendChild(s)}},Ea=xi?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let n="";for(const s of t.cssRules)n+=s.cssText;return Yl(n)})(e):e;const{is:Xl,defineProperty:ec,getOwnPropertyDescriptor:tc,getOwnPropertyNames:nc,getOwnPropertySymbols:sc,getPrototypeOf:ic}=Object,Gn=globalThis,La=Gn.trustedTypes,ac=La?La.emptyScript:"",oc=Gn.reactiveElementPolyfillSupport,qt=(e,t)=>e,Dn={toAttribute(e,t){switch(t){case Boolean:e=e?ac:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},wi=(e,t)=>!Xl(e,t),Ma={attribute:!0,type:String,converter:Dn,reflect:!1,useDefault:!1,hasChanged:wi};Symbol.metadata??=Symbol("metadata"),Gn.litPropertyMetadata??=new WeakMap;let Ct=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,n=Ma){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(t,n),!n.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,n);i!==void 0&&ec(this.prototype,t,i)}}static getPropertyDescriptor(t,n,s){const{get:i,set:a}=tc(this.prototype,t)??{get(){return this[n]},set(o){this[n]=o}};return{get:i,set(o){const l=i?.call(this);a?.call(this,o),this.requestUpdate(t,l,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ma}static _$Ei(){if(this.hasOwnProperty(qt("elementProperties")))return;const t=ic(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(qt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(qt("properties"))){const n=this.properties,s=[...nc(n),...sc(n)];for(const i of s)this.createProperty(i,n[i])}const t=this[Symbol.metadata];if(t!==null){const n=litPropertyMetadata.get(t);if(n!==void 0)for(const[s,i]of n)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[n,s]of this.elementProperties){const i=this._$Eu(n,s);i!==void 0&&this._$Eh.set(i,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const n=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const i of s)n.unshift(Ea(i))}else t!==void 0&&n.push(Ea(t));return n}static _$Eu(t,n){const s=n.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,n=this.constructor.elementProperties;for(const s of n.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Zl(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,n,s){this._$AK(t,s)}_$ET(t,n){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===!0){const a=(s.converter?.toAttribute!==void 0?s.converter:Dn).toAttribute(n,s.type);this._$Em=t,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._$Em=null}}_$AK(t,n){const s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){const a=s.getPropertyOptions(i),o=typeof a.converter=="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:Dn;this._$Em=i;const l=o.fromAttribute(n,a.type);this[i]=l??this._$Ej?.get(i)??l,this._$Em=null}}requestUpdate(t,n,s,i=!1,a){if(t!==void 0){const o=this.constructor;if(i===!1&&(a=this[t]),s??=o.getPropertyOptions(t),!((s.hasChanged??wi)(a,n)||s.useDefault&&s.reflect&&a===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,s))))return;this.C(t,n,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,n,{useDefault:s,reflect:i,wrapped:a},o){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??n??this[t]),a!==!0||o!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(n=void 0),this._$AL.set(t,n)),i===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(n){Promise.reject(n)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,a]of this._$Ep)this[i]=a;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,a]of s){const{wrapped:o}=a,l=this[i];o!==!0||this._$AL.has(i)||l===void 0||this.C(i,void 0,a,l)}}let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(n)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(n)}willUpdate(t){}_$AE(t){this._$EO?.forEach(n=>n.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(n=>this._$ET(n,this[n])),this._$EM()}updated(t){}firstUpdated(t){}};Ct.elementStyles=[],Ct.shadowRootOptions={mode:"open"},Ct[qt("elementProperties")]=new Map,Ct[qt("finalized")]=new Map,oc?.({ReactiveElement:Ct}),(Gn.reactiveElementVersions??=[]).push("2.1.2");const ki=globalThis,Ia=e=>e,Fn=ki.trustedTypes,Ra=Fn?Fn.createPolicy("lit-html",{createHTML:e=>e}):void 0,sr="$lit$",Ge=`lit$${Math.random().toFixed(9).slice(2)}$`,ir="?"+Ge,rc=`<${ir}>`,gt=document,Zt=()=>gt.createComment(""),Xt=e=>e===null||typeof e!="object"&&typeof e!="function",Si=Array.isArray,lc=e=>Si(e)||typeof e?.[Symbol.iterator]=="function",$s=`[
2
- \f\r]`,Dt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Pa=/-->/g,Da=/>/g,nt=RegExp(`>|${$s}(?:([^\\s"'>=/]+)(${$s}*=${$s}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Fa=/'/g,Na=/"/g,ar=/^(?:script|style|textarea|title)$/i,or=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),r=or(1),mn=or(2),Qe=Symbol.for("lit-noChange"),v=Symbol.for("lit-nothing"),Oa=new WeakMap,dt=gt.createTreeWalker(gt,129);function rr(e,t){if(!Si(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ra!==void 0?Ra.createHTML(t):t}const cc=(e,t)=>{const n=e.length-1,s=[];let i,a=t===2?"<svg>":t===3?"<math>":"",o=Dt;for(let l=0;l<n;l++){const c=e[l];let u,g,p=-1,h=0;for(;h<c.length&&(o.lastIndex=h,g=o.exec(c),g!==null);)h=o.lastIndex,o===Dt?g[1]==="!--"?o=Pa:g[1]!==void 0?o=Da:g[2]!==void 0?(ar.test(g[2])&&(i=RegExp("</"+g[2],"g")),o=nt):g[3]!==void 0&&(o=nt):o===nt?g[0]===">"?(o=i??Dt,p=-1):g[1]===void 0?p=-2:(p=o.lastIndex-g[2].length,u=g[1],o=g[3]===void 0?nt:g[3]==='"'?Na:Fa):o===Na||o===Fa?o=nt:o===Pa||o===Da?o=Dt:(o=nt,i=void 0);const d=o===nt&&e[l+1].startsWith("/>")?" ":"";a+=o===Dt?c+rc:p>=0?(s.push(u),c.slice(0,p)+sr+c.slice(p)+Ge+d):c+Ge+(p===-2?l:d)}return[rr(e,a+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};let qs=class lr{constructor({strings:t,_$litType$:n},s){let i;this.parts=[];let a=0,o=0;const l=t.length-1,c=this.parts,[u,g]=cc(t,n);if(this.el=lr.createElement(u,s),dt.currentNode=this.el.content,n===2||n===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=dt.nextNode())!==null&&c.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(const p of i.getAttributeNames())if(p.endsWith(sr)){const h=g[o++],d=i.getAttribute(p).split(Ge),f=/([.?@])?(.*)/.exec(h);c.push({type:1,index:a,name:f[2],strings:d,ctor:f[1]==="."?uc:f[1]==="?"?gc:f[1]==="@"?pc:Qn}),i.removeAttribute(p)}else p.startsWith(Ge)&&(c.push({type:6,index:a}),i.removeAttribute(p));if(ar.test(i.tagName)){const p=i.textContent.split(Ge),h=p.length-1;if(h>0){i.textContent=Fn?Fn.emptyScript:"";for(let d=0;d<h;d++)i.append(p[d],Zt()),dt.nextNode(),c.push({type:2,index:++a});i.append(p[h],Zt())}}}else if(i.nodeType===8)if(i.data===ir)c.push({type:2,index:a});else{let p=-1;for(;(p=i.data.indexOf(Ge,p+1))!==-1;)c.push({type:7,index:a}),p+=Ge.length-1}a++}}static createElement(t,n){const s=gt.createElement("template");return s.innerHTML=t,s}};function Et(e,t,n=e,s){if(t===Qe)return t;let i=s!==void 0?n._$Co?.[s]:n._$Cl;const a=Xt(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,s)),s!==void 0?(n._$Co??=[])[s]=i:n._$Cl=i),i!==void 0&&(t=Et(e,i._$AS(e,t.values),i,s)),t}class dc{constructor(t,n){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:n},parts:s}=this._$AD,i=(t?.creationScope??gt).importNode(n,!0);dt.currentNode=i;let a=dt.nextNode(),o=0,l=0,c=s[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new Vn(a,a.nextSibling,this,t):c.type===1?u=new c.ctor(a,c.name,c.strings,this,t):c.type===6&&(u=new fc(a,this,t)),this._$AV.push(u),c=s[++l]}o!==c?.index&&(a=dt.nextNode(),o++)}return dt.currentNode=gt,i}p(t){let n=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,n),n+=s.strings.length-2):s._$AI(t[n])),n++}}let Vn=class cr{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,n,s,i){this.type=2,this._$AH=v,this._$AN=void 0,this._$AA=t,this._$AB=n,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const n=this._$AM;return n!==void 0&&t?.nodeType===11&&(t=n.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,n=this){t=Et(this,t,n),Xt(t)?t===v||t==null||t===""?(this._$AH!==v&&this._$AR(),this._$AH=v):t!==this._$AH&&t!==Qe&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):lc(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==v&&Xt(this._$AH)?this._$AA.nextSibling.data=t:this.T(gt.createTextNode(t)),this._$AH=t}$(t){const{values:n,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=qs.createElement(rr(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(n);else{const a=new dc(i,this),o=a.u(this.options);a.p(n),this.T(o),this._$AH=a}}_$AC(t){let n=Oa.get(t.strings);return n===void 0&&Oa.set(t.strings,n=new qs(t)),n}k(t){Si(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let s,i=0;for(const a of t)i===n.length?n.push(s=new cr(this.O(Zt()),this.O(Zt()),this,this.options)):s=n[i],s._$AI(a),i++;i<n.length&&(this._$AR(s&&s._$AB.nextSibling,i),n.length=i)}_$AR(t=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);t!==this._$AB;){const s=Ia(t).nextSibling;Ia(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}};class Qn{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,s,i,a){this.type=1,this._$AH=v,this._$AN=void 0,this.element=t,this.name=n,this._$AM=i,this.options=a,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=v}_$AI(t,n=this,s,i){const a=this.strings;let o=!1;if(a===void 0)t=Et(this,t,n,0),o=!Xt(t)||t!==this._$AH&&t!==Qe,o&&(this._$AH=t);else{const l=t;let c,u;for(t=a[0],c=0;c<a.length-1;c++)u=Et(this,l[s+c],n,c),u===Qe&&(u=this._$AH[c]),o||=!Xt(u)||u!==this._$AH[c],u===v?t=v:t!==v&&(t+=(u??"")+a[c+1]),this._$AH[c]=u}o&&!i&&this.j(t)}j(t){t===v?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}let uc=class extends Qn{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===v?void 0:t}},gc=class extends Qn{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==v)}},pc=class extends Qn{constructor(t,n,s,i,a){super(t,n,s,i,a),this.type=5}_$AI(t,n=this){if((t=Et(this,t,n,0)??v)===Qe)return;const s=this._$AH,i=t===v&&s!==v||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,a=t!==v&&(s===v||i);i&&this.element.removeEventListener(this.name,this,s),a&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},fc=class{constructor(t,n,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=n,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){Et(this,t)}};const hc={I:Vn},vc=ki.litHtmlPolyfillSupport;vc?.(qs,Vn),(ki.litHtmlVersions??=[]).push("3.3.2");const mc=(e,t,n)=>{const s=n?.renderBefore??t;let i=s._$litPart$;if(i===void 0){const a=n?.renderBefore??null;s._$litPart$=i=new Vn(t.insertBefore(Zt(),a),a,void 0,n??{})}return i._$AI(e),i};const Ai=globalThis;let _t=class extends Ct{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=mc(n,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Qe}};_t._$litElement$=!0,_t.finalized=!0,Ai.litElementHydrateSupport?.({LitElement:_t});const bc=Ai.litElementPolyfillSupport;bc?.({LitElement:_t});(Ai.litElementVersions??=[]).push("4.2.2");const dr=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const yc={attribute:!0,type:String,converter:Dn,reflect:!1,hasChanged:wi},xc=(e=yc,t,n)=>{const{kind:s,metadata:i}=n;let a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),s==="setter"&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),s==="accessor"){const{name:o}=n;return{set(l){const c=t.get.call(this);t.set.call(this,l),this.requestUpdate(o,c,e,!0,l)},init(l){return l!==void 0&&this.C(o,void 0,e,l),l}}}if(s==="setter"){const{name:o}=n;return function(l){const c=this[o];t.call(this,l),this.requestUpdate(o,c,e,!0,l)}}throw Error("Unsupported decorator location: "+s)};function Yn(e){return(t,n)=>typeof n=="object"?xc(e,t,n):((s,i,a)=>{const o=i.hasOwnProperty(a);return i.constructor.createProperty(a,s),o?Object.getOwnPropertyDescriptor(i,a):void 0})(e,t,n)}function w(e){return Yn({...e,state:!0,attribute:!1})}async function ye(e,t){if(!(!e.client||!e.connected)&&!e.channelsLoading){e.channelsLoading=!0,e.channelsError=null;try{const n=await e.client.request("channels.status",{probe:t,timeoutMs:8e3});e.channelsSnapshot=n,e.channelsLastSuccess=Date.now()}catch(n){e.channelsError=String(n)}finally{e.channelsLoading=!1}}}async function $c(e,t){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const n=await e.client.request("web.login.start",{force:t,timeoutMs:3e4});e.whatsappLoginMessage=n.message??null,e.whatsappLoginQrDataUrl=n.qrDataUrl??null,e.whatsappLoginConnected=null}catch(n){e.whatsappLoginMessage=String(n),e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function wc(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const t=await e.client.request("web.login.wait",{timeoutMs:12e4});e.whatsappLoginMessage=t.message??null,e.whatsappLoginConnected=t.connected??null,t.connected&&(e.whatsappLoginQrDataUrl=null)}catch(t){e.whatsappLoginMessage=String(t),e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function kc(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{await e.client.request("channels.logout",{channel:"whatsapp"}),e.whatsappLoginMessage="Logged out.",e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}catch(t){e.whatsappLoginMessage=String(t)}finally{e.whatsappBusy=!1}}}function pt(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function Lt(e){return`${JSON.stringify(e,null,2).trimEnd()}
4
- `}function ur(e,t,n){if(t.length===0)return;let s=e;for(let a=0;a<t.length-1;a+=1){const o=t[a],l=t[a+1];if(typeof o=="number"){if(!Array.isArray(s))return;s[o]==null&&(s[o]=typeof l=="number"?[]:{}),s=s[o]}else{if(typeof s!="object"||s==null)return;const c=s;c[o]==null&&(c[o]=typeof l=="number"?[]:{}),s=c[o]}}const i=t[t.length-1];if(typeof i=="number"){Array.isArray(s)&&(s[i]=n);return}typeof s=="object"&&s!=null&&(s[i]=n)}function gr(e,t){if(t.length===0)return;let n=e;for(let i=0;i<t.length-1;i+=1){const a=t[i];if(typeof a=="number"){if(!Array.isArray(n))return;n=n[a]}else{if(typeof n!="object"||n==null)return;n=n[a]}if(n==null)return}const s=t[t.length-1];if(typeof s=="number"){Array.isArray(n)&&n.splice(s,1);return}typeof n=="object"&&n!=null&&delete n[s]}async function Ee(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});Ac(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function pr(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});Sc(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function Sc(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function Ac(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?Lt(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=Lt(e.configForm):e.configRaw=n,e.configValid=typeof t.valid=="boolean"?t.valid:null,e.configIssues=Array.isArray(t.issues)?t.issues:[],e.configFormDirty||(e.configForm=pt(t.config??{}),e.configFormOriginal=pt(t.config??{}),e.configRawOriginal=n)}async function Mn(e){if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const t=e.configFormMode==="form"&&e.configForm?Lt(e.configForm):e.configRaw,n=e.configSnapshot?.hash;if(!n){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.set",{raw:t,baseHash:n}),e.configFormDirty=!1,await Ee(e)}catch(t){e.lastError=String(t)}finally{e.configSaving=!1}}}async function Cc(e){if(!(!e.client||!e.connected)){e.configApplying=!0,e.lastError=null;try{const t=e.configFormMode==="form"&&e.configForm?Lt(e.configForm):e.configRaw,n=e.configSnapshot?.hash;if(!n){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.apply",{raw:t,baseHash:n,sessionKey:e.applySessionKey}),e.configFormDirty=!1,await Ee(e)}catch(t){e.lastError=String(t)}finally{e.configApplying=!1}}}async function Tc(e){if(!(!e.client||!e.connected)){e.updateRunning=!0,e.lastError=null;try{await e.client.request("update.run",{sessionKey:e.applySessionKey})}catch(t){e.lastError=String(t)}finally{e.updateRunning=!1}}}function $e(e,t,n){const s=pt(e.configForm??e.configSnapshot?.config??{});ur(s,t,n),e.configForm=s,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=Lt(s))}function ze(e,t){const n=pt(e.configForm??e.configSnapshot?.config??{});gr(n,t),e.configForm=n,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=Lt(n))}function _c(e){const{values:t,original:n}=e;return t.name!==n.name||t.displayName!==n.displayName||t.about!==n.about||t.picture!==n.picture||t.banner!==n.banner||t.website!==n.website||t.nip05!==n.nip05||t.lud16!==n.lud16}function Ec(e){const{state:t,callbacks:n,accountId:s}=e,i=_c(t),a=(l,c,u={})=>{const{type:g="text",placeholder:p,maxLength:h,help:d}=u,f=t.values[l]??"",m=t.fieldErrors[l],S=`nostr-profile-${l}`;return g==="textarea"?r`
1
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();const In=globalThis,xi=In.ShadowRoot&&(In.ShadyCSS===void 0||In.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,$i=Symbol(),Ea=new WeakMap;let ar=class{constructor(t,n,s){if(this._$cssResult$=!0,s!==$i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=n}get styleSheet(){let t=this.o;const n=this.t;if(xi&&t===void 0){const s=n!==void 0&&n.length===1;s&&(t=Ea.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Ea.set(n,t))}return t}toString(){return this.cssText}};const ic=e=>new ar(typeof e=="string"?e:e+"",void 0,$i),ac=(e,...t)=>{const n=e.length===1?e[0]:t.reduce((s,i,a)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[a+1],e[0]);return new ar(n,e,$i)},oc=(e,t)=>{if(xi)e.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of t){const s=document.createElement("style"),i=In.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=n.cssText,e.appendChild(s)}},La=xi?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let n="";for(const s of t.cssRules)n+=s.cssText;return ic(n)})(e):e;const{is:rc,defineProperty:lc,getOwnPropertyDescriptor:cc,getOwnPropertyNames:dc,getOwnPropertySymbols:uc,getPrototypeOf:gc}=Object,Qn=globalThis,Ma=Qn.trustedTypes,pc=Ma?Ma.emptyScript:"",fc=Qn.reactiveElementPolyfillSupport,Gt=(e,t)=>e,Nn={toAttribute(e,t){switch(t){case Boolean:e=e?pc:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},wi=(e,t)=>!rc(e,t),Ia={attribute:!0,type:String,converter:Nn,reflect:!1,useDefault:!1,hasChanged:wi};Symbol.metadata??=Symbol("metadata"),Qn.litPropertyMetadata??=new WeakMap;let _t=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,n=Ia){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(t,n),!n.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,n);i!==void 0&&lc(this.prototype,t,i)}}static getPropertyDescriptor(t,n,s){const{get:i,set:a}=cc(this.prototype,t)??{get(){return this[n]},set(o){this[n]=o}};return{get:i,set(o){const l=i?.call(this);a?.call(this,o),this.requestUpdate(t,l,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ia}static _$Ei(){if(this.hasOwnProperty(Gt("elementProperties")))return;const t=gc(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Gt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Gt("properties"))){const n=this.properties,s=[...dc(n),...uc(n)];for(const i of s)this.createProperty(i,n[i])}const t=this[Symbol.metadata];if(t!==null){const n=litPropertyMetadata.get(t);if(n!==void 0)for(const[s,i]of n)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[n,s]of this.elementProperties){const i=this._$Eu(n,s);i!==void 0&&this._$Eh.set(i,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const n=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const i of s)n.unshift(La(i))}else t!==void 0&&n.push(La(t));return n}static _$Eu(t,n){const s=n.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,n=this.constructor.elementProperties;for(const s of n.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return oc(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,n,s){this._$AK(t,s)}_$ET(t,n){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===!0){const a=(s.converter?.toAttribute!==void 0?s.converter:Nn).toAttribute(n,s.type);this._$Em=t,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._$Em=null}}_$AK(t,n){const s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){const a=s.getPropertyOptions(i),o=typeof a.converter=="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:Nn;this._$Em=i;const l=o.fromAttribute(n,a.type);this[i]=l??this._$Ej?.get(i)??l,this._$Em=null}}requestUpdate(t,n,s,i=!1,a){if(t!==void 0){const o=this.constructor;if(i===!1&&(a=this[t]),s??=o.getPropertyOptions(t),!((s.hasChanged??wi)(a,n)||s.useDefault&&s.reflect&&a===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,s))))return;this.C(t,n,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,n,{useDefault:s,reflect:i,wrapped:a},o){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??n??this[t]),a!==!0||o!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(n=void 0),this._$AL.set(t,n)),i===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(n){Promise.reject(n)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,a]of this._$Ep)this[i]=a;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,a]of s){const{wrapped:o}=a,l=this[i];o!==!0||this._$AL.has(i)||l===void 0||this.C(i,void 0,a,l)}}let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(n)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(n)}willUpdate(t){}_$AE(t){this._$EO?.forEach(n=>n.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(n=>this._$ET(n,this[n])),this._$EM()}updated(t){}firstUpdated(t){}};_t.elementStyles=[],_t.shadowRootOptions={mode:"open"},_t[Gt("elementProperties")]=new Map,_t[Gt("finalized")]=new Map,fc?.({ReactiveElement:_t}),(Qn.reactiveElementVersions??=[]).push("2.1.2");const ki=globalThis,Ra=e=>e,On=ki.trustedTypes,Pa=On?On.createPolicy("lit-html",{createHTML:e=>e}):void 0,or="$lit$",Ve=`lit$${Math.random().toFixed(9).slice(2)}$`,rr="?"+Ve,hc=`<${rr}>`,ft=document,Zt=()=>ft.createComment(""),Xt=e=>e===null||typeof e!="object"&&typeof e!="function",Si=Array.isArray,vc=e=>Si(e)||typeof e?.[Symbol.iterator]=="function",ws=`[
2
+ \f\r]`,Ft=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Da=/-->/g,Fa=/>/g,st=RegExp(`>|${ws}(?:([^\\s"'>=/]+)(${ws}*=${ws}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Na=/'/g,Oa=/"/g,lr=/^(?:script|style|textarea|title)$/i,cr=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),r=cr(1),yn=cr(2),Ye=Symbol.for("lit-noChange"),v=Symbol.for("lit-nothing"),Ba=new WeakMap,gt=ft.createTreeWalker(ft,129);function dr(e,t){if(!Si(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Pa!==void 0?Pa.createHTML(t):t}const mc=(e,t)=>{const n=e.length-1,s=[];let i,a=t===2?"<svg>":t===3?"<math>":"",o=Ft;for(let l=0;l<n;l++){const c=e[l];let u,g,p=-1,h=0;for(;h<c.length&&(o.lastIndex=h,g=o.exec(c),g!==null);)h=o.lastIndex,o===Ft?g[1]==="!--"?o=Da:g[1]!==void 0?o=Fa:g[2]!==void 0?(lr.test(g[2])&&(i=RegExp("</"+g[2],"g")),o=st):g[3]!==void 0&&(o=st):o===st?g[0]===">"?(o=i??Ft,p=-1):g[1]===void 0?p=-2:(p=o.lastIndex-g[2].length,u=g[1],o=g[3]===void 0?st:g[3]==='"'?Oa:Na):o===Oa||o===Na?o=st:o===Da||o===Fa?o=Ft:(o=st,i=void 0);const d=o===st&&e[l+1].startsWith("/>")?" ":"";a+=o===Ft?c+hc:p>=0?(s.push(u),c.slice(0,p)+or+c.slice(p)+Ve+d):c+Ve+(p===-2?l:d)}return[dr(e,a+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};class en{constructor({strings:t,_$litType$:n},s){let i;this.parts=[];let a=0,o=0;const l=t.length-1,c=this.parts,[u,g]=mc(t,n);if(this.el=en.createElement(u,s),gt.currentNode=this.el.content,n===2||n===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=gt.nextNode())!==null&&c.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(const p of i.getAttributeNames())if(p.endsWith(or)){const h=g[o++],d=i.getAttribute(p).split(Ve),f=/([.?@])?(.*)/.exec(h);c.push({type:1,index:a,name:f[2],strings:d,ctor:f[1]==="."?yc:f[1]==="?"?xc:f[1]==="@"?$c:Jn}),i.removeAttribute(p)}else p.startsWith(Ve)&&(c.push({type:6,index:a}),i.removeAttribute(p));if(lr.test(i.tagName)){const p=i.textContent.split(Ve),h=p.length-1;if(h>0){i.textContent=On?On.emptyScript:"";for(let d=0;d<h;d++)i.append(p[d],Zt()),gt.nextNode(),c.push({type:2,index:++a});i.append(p[h],Zt())}}}else if(i.nodeType===8)if(i.data===rr)c.push({type:2,index:a});else{let p=-1;for(;(p=i.data.indexOf(Ve,p+1))!==-1;)c.push({type:7,index:a}),p+=Ve.length-1}a++}}static createElement(t,n){const s=ft.createElement("template");return s.innerHTML=t,s}}function Mt(e,t,n=e,s){if(t===Ye)return t;let i=s!==void 0?n._$Co?.[s]:n._$Cl;const a=Xt(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,s)),s!==void 0?(n._$Co??=[])[s]=i:n._$Cl=i),i!==void 0&&(t=Mt(e,i._$AS(e,t.values),i,s)),t}class bc{constructor(t,n){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:n},parts:s}=this._$AD,i=(t?.creationScope??ft).importNode(n,!0);gt.currentNode=i;let a=gt.nextNode(),o=0,l=0,c=s[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new Yn(a,a.nextSibling,this,t):c.type===1?u=new c.ctor(a,c.name,c.strings,this,t):c.type===6&&(u=new wc(a,this,t)),this._$AV.push(u),c=s[++l]}o!==c?.index&&(a=gt.nextNode(),o++)}return gt.currentNode=ft,i}p(t){let n=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,n),n+=s.strings.length-2):s._$AI(t[n])),n++}}let Yn=class ur{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,n,s,i){this.type=2,this._$AH=v,this._$AN=void 0,this._$AA=t,this._$AB=n,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const n=this._$AM;return n!==void 0&&t?.nodeType===11&&(t=n.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,n=this){t=Mt(this,t,n),Xt(t)?t===v||t==null||t===""?(this._$AH!==v&&this._$AR(),this._$AH=v):t!==this._$AH&&t!==Ye&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):vc(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==v&&Xt(this._$AH)?this._$AA.nextSibling.data=t:this.T(ft.createTextNode(t)),this._$AH=t}$(t){const{values:n,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=en.createElement(dr(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(n);else{const a=new bc(i,this),o=a.u(this.options);a.p(n),this.T(o),this._$AH=a}}_$AC(t){let n=Ba.get(t.strings);return n===void 0&&Ba.set(t.strings,n=new en(t)),n}k(t){Si(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let s,i=0;for(const a of t)i===n.length?n.push(s=new ur(this.O(Zt()),this.O(Zt()),this,this.options)):s=n[i],s._$AI(a),i++;i<n.length&&(this._$AR(s&&s._$AB.nextSibling,i),n.length=i)}_$AR(t=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);t!==this._$AB;){const s=Ra(t).nextSibling;Ra(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},Jn=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,s,i,a){this.type=1,this._$AH=v,this._$AN=void 0,this.element=t,this.name=n,this._$AM=i,this.options=a,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=v}_$AI(t,n=this,s,i){const a=this.strings;let o=!1;if(a===void 0)t=Mt(this,t,n,0),o=!Xt(t)||t!==this._$AH&&t!==Ye,o&&(this._$AH=t);else{const l=t;let c,u;for(t=a[0],c=0;c<a.length-1;c++)u=Mt(this,l[s+c],n,c),u===Ye&&(u=this._$AH[c]),o||=!Xt(u)||u!==this._$AH[c],u===v?t=v:t!==v&&(t+=(u??"")+a[c+1]),this._$AH[c]=u}o&&!i&&this.j(t)}j(t){t===v?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},yc=class extends Jn{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===v?void 0:t}},xc=class extends Jn{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==v)}},$c=class extends Jn{constructor(t,n,s,i,a){super(t,n,s,i,a),this.type=5}_$AI(t,n=this){if((t=Mt(this,t,n,0)??v)===Ye)return;const s=this._$AH,i=t===v&&s!==v||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,a=t!==v&&(s===v||i);i&&this.element.removeEventListener(this.name,this,s),a&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},wc=class{constructor(t,n,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=n,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){Mt(this,t)}};const kc={I:Yn},Sc=ki.litHtmlPolyfillSupport;Sc?.(en,Yn),(ki.litHtmlVersions??=[]).push("3.3.2");const Ac=(e,t,n)=>{const s=n?.renderBefore??t;let i=s._$litPart$;if(i===void 0){const a=n?.renderBefore??null;s._$litPart$=i=new Yn(t.insertBefore(Zt(),a),a,void 0,n??{})}return i._$AI(e),i};const Ai=globalThis;let Lt=class extends _t{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Ac(n,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Ye}};Lt._$litElement$=!0,Lt.finalized=!0,Ai.litElementHydrateSupport?.({LitElement:Lt});const Cc=Ai.litElementPolyfillSupport;Cc?.({LitElement:Lt});(Ai.litElementVersions??=[]).push("4.2.2");const gr=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const Tc={attribute:!0,type:String,converter:Nn,reflect:!1,hasChanged:wi},_c=(e=Tc,t,n)=>{const{kind:s,metadata:i}=n;let a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),s==="setter"&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),s==="accessor"){const{name:o}=n;return{set(l){const c=t.get.call(this);t.set.call(this,l),this.requestUpdate(o,c,e,!0,l)},init(l){return l!==void 0&&this.C(o,void 0,e,l),l}}}if(s==="setter"){const{name:o}=n;return function(l){const c=this[o];t.call(this,l),this.requestUpdate(o,c,e,!0,l)}}throw Error("Unsupported decorator location: "+s)};function Zn(e){return(t,n)=>typeof n=="object"?_c(e,t,n):((s,i,a)=>{const o=i.hasOwnProperty(a);return i.constructor.createProperty(a,s),o?Object.getOwnPropertyDescriptor(i,a):void 0})(e,t,n)}function w(e){return Zn({...e,state:!0,attribute:!1})}async function ye(e,t){if(!(!e.client||!e.connected)&&!e.channelsLoading){e.channelsLoading=!0,e.channelsError=null;try{const n=await e.client.request("channels.status",{probe:t,timeoutMs:8e3});e.channelsSnapshot=n,e.channelsLastSuccess=Date.now()}catch(n){e.channelsError=String(n)}finally{e.channelsLoading=!1}}}async function Ec(e,t){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const n=await e.client.request("web.login.start",{force:t,timeoutMs:3e4});e.whatsappLoginMessage=n.message??null,e.whatsappLoginQrDataUrl=n.qrDataUrl??null,e.whatsappLoginConnected=null}catch(n){e.whatsappLoginMessage=String(n),e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function Lc(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const t=await e.client.request("web.login.wait",{timeoutMs:12e4});e.whatsappLoginMessage=t.message??null,e.whatsappLoginConnected=t.connected??null,t.connected&&(e.whatsappLoginQrDataUrl=null)}catch(t){e.whatsappLoginMessage=String(t),e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function Mc(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{await e.client.request("channels.logout",{channel:"whatsapp"}),e.whatsappLoginMessage="Logged out.",e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}catch(t){e.whatsappLoginMessage=String(t)}finally{e.whatsappBusy=!1}}}function we(e){if(e)return Array.isArray(e.type)?e.type.filter(n=>n!=="null")[0]??e.type[0]:e.type}function pr(e){if(!e)return"";if(e.default!==void 0)return e.default;switch(we(e)){case"object":return{};case"array":return[];case"boolean":return!1;case"number":case"integer":return 0;case"string":return"";default:return""}}function Ci(e){return e.filter(t=>typeof t=="string").join(".")}function Ae(e,t){const n=Ci(e),s=t[n];if(s)return s;const i=n.split(".");for(const[a,o]of Object.entries(t)){if(!a.includes("*"))continue;const l=a.split(".");if(l.length!==i.length)continue;let c=!0;for(let u=0;u<i.length;u+=1)if(l[u]!=="*"&&l[u]!==i[u]){c=!1;break}if(c)return o}}function We(e){return e.replace(/_/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\s+/g," ").replace(/^./,t=>t.toUpperCase())}function Ua(e,t){const n=e.trim();if(n==="")return;const s=Number(n);return!Number.isFinite(s)||t&&!Number.isInteger(s)?e:s}function za(e){const t=e.trim();return t==="true"?!0:t==="false"?!1:e}function Ge(e,t){if(e==null)return e;if(t.allOf&&t.allOf.length>0){let s=e;for(const i of t.allOf)s=Ge(s,i);return s}const n=we(t);if(t.anyOf||t.oneOf){const s=(t.anyOf??t.oneOf??[]).filter(i=>!(i.type==="null"||Array.isArray(i.type)&&i.type.includes("null")));if(s.length===1)return Ge(e,s[0]);if(typeof e=="string")for(const i of s){const a=we(i);if(a==="number"||a==="integer"){const o=Ua(e,a==="integer");if(o===void 0||typeof o=="number")return o}if(a==="boolean"){const o=za(e);if(typeof o=="boolean")return o}}for(const i of s){const a=we(i);if(a==="object"&&typeof e=="object"&&!Array.isArray(e)||a==="array"&&Array.isArray(e))return Ge(e,i)}return e}if(n==="number"||n==="integer"){if(typeof e=="string"){const s=Ua(e,n==="integer");if(s===void 0||typeof s=="number")return s}return e}if(n==="boolean"){if(typeof e=="string"){const s=za(e);if(typeof s=="boolean")return s}return e}if(n==="object"){if(typeof e!="object"||Array.isArray(e))return e;const s=e,i=t.properties??{},a=t.additionalProperties&&typeof t.additionalProperties=="object"?t.additionalProperties:null,o={};for(const[l,c]of Object.entries(s)){const u=i[l]??a,g=u?Ge(c,u):c;g!==void 0&&(o[l]=g)}return o}if(n==="array"){if(!Array.isArray(e))return e;if(Array.isArray(t.items)){const i=t.items;return e.map((a,o)=>{const l=o<i.length?i[o]:void 0;return l?Ge(a,l):a})}const s=t.items;return s?e.map(i=>Ge(i,s)).filter(i=>i!==void 0):e}return e}function ht(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function tn(e){return`${JSON.stringify(e,null,2).trimEnd()}
4
+ `}function fr(e,t,n){if(t.length===0)return;let s=e;for(let a=0;a<t.length-1;a+=1){const o=t[a],l=t[a+1];if(typeof o=="number"){if(!Array.isArray(s))return;s[o]==null&&(s[o]=typeof l=="number"?[]:{}),s=s[o]}else{if(typeof s!="object"||s==null)return;const c=s;c[o]==null&&(c[o]=typeof l=="number"?[]:{}),s=c[o]}}const i=t[t.length-1];if(typeof i=="number"){Array.isArray(s)&&(s[i]=n);return}typeof s=="object"&&s!=null&&(s[i]=n)}function hr(e,t){if(t.length===0)return;let n=e;for(let i=0;i<t.length-1;i+=1){const a=t[i];if(typeof a=="number"){if(!Array.isArray(n))return;n=n[a]}else{if(typeof n!="object"||n==null)return;n=n[a]}if(n==null)return}const s=t[t.length-1];if(typeof s=="number"){Array.isArray(n)&&n.splice(s,1);return}typeof n=="object"&&n!=null&&delete n[s]}async function Le(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});Rc(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function vr(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});Ic(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function Ic(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function Rc(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?tn(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=tn(e.configForm):e.configRaw=n,e.configValid=typeof t.valid=="boolean"?t.valid:null,e.configIssues=Array.isArray(t.issues)?t.issues:[],e.configFormDirty||(e.configForm=ht(t.config??{}),e.configFormOriginal=ht(t.config??{}),e.configRawOriginal=n)}function Pc(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function mr(e){if(e.configFormMode!=="form"||!e.configForm)return e.configRaw;const t=Pc(e.configSchema),n=t?Ge(e.configForm,t):e.configForm;return tn(n)}async function Rn(e){if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const t=mr(e),n=e.configSnapshot?.hash;if(!n){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.set",{raw:t,baseHash:n}),e.configFormDirty=!1,await Le(e)}catch(t){e.lastError=String(t)}finally{e.configSaving=!1}}}async function Dc(e){if(!(!e.client||!e.connected)){e.configApplying=!0,e.lastError=null;try{const t=mr(e),n=e.configSnapshot?.hash;if(!n){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.apply",{raw:t,baseHash:n,sessionKey:e.applySessionKey}),e.configFormDirty=!1,await Le(e)}catch(t){e.lastError=String(t)}finally{e.configApplying=!1}}}async function Fc(e){if(!(!e.client||!e.connected)){e.updateRunning=!0,e.lastError=null;try{await e.client.request("update.run",{sessionKey:e.applySessionKey})}catch(t){e.lastError=String(t)}finally{e.updateRunning=!1}}}function $e(e,t,n){const s=ht(e.configForm??e.configSnapshot?.config??{});fr(s,t,n),e.configForm=s,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=tn(s))}function ze(e,t){const n=ht(e.configForm??e.configSnapshot?.config??{});hr(n,t),e.configForm=n,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=tn(n))}function Nc(e){const{values:t,original:n}=e;return t.name!==n.name||t.displayName!==n.displayName||t.about!==n.about||t.picture!==n.picture||t.banner!==n.banner||t.website!==n.website||t.nip05!==n.nip05||t.lud16!==n.lud16}function Oc(e){const{state:t,callbacks:n,accountId:s}=e,i=Nc(t),a=(l,c,u={})=>{const{type:g="text",placeholder:p,maxLength:h,help:d}=u,f=t.values[l]??"",m=t.fieldErrors[l],S=`nostr-profile-${l}`;return g==="textarea"?r`
5
5
  <div class="form-field" style="margin-bottom: 12px;">
6
6
  <label for="${S}" style="display: block; margin-bottom: 4px; font-weight: 500;">
7
7
  ${c}
@@ -121,19 +121,19 @@
121
121
  </div>
122
122
  `:v}
123
123
  </div>
124
- `}function Lc(e){const t={name:e?.name??"",displayName:e?.displayName??"",about:e?.about??"",picture:e?.picture??"",banner:e?.banner??"",website:e?.website??"",nip05:e?.nip05??"",lud16:e?.lud16??""};return{values:t,original:{...t},saving:!1,importing:!1,error:null,success:null,fieldErrors:{},showAdvanced:!!(e?.banner||e?.website||e?.nip05||e?.lud16)}}async function Mc(e,t){await $c(e,t),await ye(e,!0)}async function Ic(e){await wc(e),await ye(e,!0)}async function Rc(e){await kc(e),await ye(e,!0)}async function Pc(e){await Mn(e),await Ee(e),await ye(e,!0)}async function Dc(e){await Ee(e),await ye(e,!0)}function Fc(e){if(!Array.isArray(e))return{};const t={};for(const n of e){if(typeof n!="string")continue;const[s,...i]=n.split(":");if(!s||i.length===0)continue;const a=s.trim(),o=i.join(":").trim();a&&o&&(t[a]=o)}return t}function fr(e){return(e.channelsSnapshot?.channelAccounts?.nostr??[])[0]?.accountId??e.nostrProfileAccountId??"default"}function hr(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function Nc(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=Lc(n??void 0)}function Oc(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function Bc(e,t,n){const s=e.nostrProfileFormState;s&&(e.nostrProfileFormState={...s,values:{...s.values,[t]:n},fieldErrors:{...s.fieldErrors,[t]:""}})}function Uc(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function zc(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=fr(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const s=await fetch(hr(n),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.values)}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const a=i?.error??`Profile update failed (${s.status})`;e.nostrProfileFormState={...t,saving:!1,error:a,success:null,fieldErrors:Fc(i?.details)};return}if(!i.persisted){e.nostrProfileFormState={...t,saving:!1,error:"Profile publish failed on all relays.",success:null};return}e.nostrProfileFormState={...t,saving:!1,error:null,success:"Profile published to relays.",fieldErrors:{},original:{...t.values}},await ye(e,!0)}catch(s){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(s)}`,success:null}}}async function Hc(e){const t=e.nostrProfileFormState;if(!t||t.importing)return;const n=fr(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const s=await fetch(hr(n,"/import"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({autoMerge:!0})}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const c=i?.error??`Profile import failed (${s.status})`;e.nostrProfileFormState={...t,importing:!1,error:c,success:null};return}const a=i.merged??i.imported??null,o=a?{...t.values,...a}:t.values,l=!!(o.banner||o.website||o.nip05||o.lud16);e.nostrProfileFormState={...t,importing:!1,values:o,error:null,success:i.saved?"Profile imported from relays. Review and publish.":"Profile imported. Review and publish.",showAdvanced:l},i.saved&&await ye(e,!0)}catch(s){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(s)}`,success:null}}}function vr(e){const t=(e??"").trim();if(!t)return null;const n=t.split(":").filter(Boolean);if(n.length<3||n[0]!=="agent")return null;const s=n[1]?.trim(),i=n.slice(2).join(":");return!s||!i?null:{agentId:s,rest:i}}const Gs=450;function an(e,t=!1,n=!1){e.chatScrollFrame&&cancelAnimationFrame(e.chatScrollFrame),e.chatScrollTimeout!=null&&(clearTimeout(e.chatScrollTimeout),e.chatScrollTimeout=null);const s=()=>{const i=e.querySelector(".chat-thread");if(i){const a=getComputedStyle(i).overflowY;if(a==="auto"||a==="scroll"||i.scrollHeight-i.clientHeight>1)return i}return document.scrollingElement??document.documentElement};e.updateComplete.then(()=>{e.chatScrollFrame=requestAnimationFrame(()=>{e.chatScrollFrame=null;const i=s();if(!i)return;const a=i.scrollHeight-i.scrollTop-i.clientHeight,o=t&&!e.chatHasAutoScrolled;if(!(o||e.chatUserNearBottom||a<Gs)){e.chatNewMessagesBelow=!0;return}o&&(e.chatHasAutoScrolled=!0);const c=n&&(typeof window>"u"||typeof window.matchMedia!="function"||!window.matchMedia("(prefers-reduced-motion: reduce)").matches),u=i.scrollHeight;typeof i.scrollTo=="function"?i.scrollTo({top:u,behavior:c?"smooth":"auto"}):i.scrollTop=u,e.chatUserNearBottom=!0,e.chatNewMessagesBelow=!1;const g=o?150:120;e.chatScrollTimeout=window.setTimeout(()=>{e.chatScrollTimeout=null;const p=s();if(!p)return;const h=p.scrollHeight-p.scrollTop-p.clientHeight;(o||e.chatUserNearBottom||h<Gs)&&(p.scrollTop=p.scrollHeight,e.chatUserNearBottom=!0)},g)})})}function mr(e,t=!1){e.logsScrollFrame&&cancelAnimationFrame(e.logsScrollFrame),e.updateComplete.then(()=>{e.logsScrollFrame=requestAnimationFrame(()=>{e.logsScrollFrame=null;const n=e.querySelector(".log-stream");if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;(t||s<80)&&(n.scrollTop=n.scrollHeight)})})}function jc(e,t){const n=t.currentTarget;if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;e.chatUserNearBottom=s<Gs,e.chatUserNearBottom&&(e.chatNewMessagesBelow=!1)}function Kc(e,t){const n=t.currentTarget;if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;e.logsAtBottom=s<80}function Ba(e){e.chatHasAutoScrolled=!1,e.chatUserNearBottom=!0,e.chatNewMessagesBelow=!1}function Wc(e,t){if(e.length===0)return;const n=new Blob([`${e.join(`
124
+ `}function Bc(e){const t={name:e?.name??"",displayName:e?.displayName??"",about:e?.about??"",picture:e?.picture??"",banner:e?.banner??"",website:e?.website??"",nip05:e?.nip05??"",lud16:e?.lud16??""};return{values:t,original:{...t},saving:!1,importing:!1,error:null,success:null,fieldErrors:{},showAdvanced:!!(e?.banner||e?.website||e?.nip05||e?.lud16)}}async function Uc(e,t){await Ec(e,t),await ye(e,!0)}async function zc(e){await Lc(e),await ye(e,!0)}async function Hc(e){await Mc(e),await ye(e,!0)}async function jc(e){await Rn(e),await Le(e),await ye(e,!0)}async function Kc(e){await Le(e),await ye(e,!0)}function Wc(e){if(!Array.isArray(e))return{};const t={};for(const n of e){if(typeof n!="string")continue;const[s,...i]=n.split(":");if(!s||i.length===0)continue;const a=s.trim(),o=i.join(":").trim();a&&o&&(t[a]=o)}return t}function br(e){return(e.channelsSnapshot?.channelAccounts?.nostr??[])[0]?.accountId??e.nostrProfileAccountId??"default"}function yr(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function qc(e){const t=e.hello?.auth?.deviceToken?.trim();if(t)return`Bearer ${t}`;const n=e.settings.token.trim();if(n)return`Bearer ${n}`;const s=e.password.trim();return s?`Bearer ${s}`:null}function xr(e){const t=qc(e);return t?{Authorization:t}:{}}function Gc(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=Bc(n??void 0)}function Vc(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function Qc(e,t,n){const s=e.nostrProfileFormState;s&&(e.nostrProfileFormState={...s,values:{...s.values,[t]:n},fieldErrors:{...s.fieldErrors,[t]:""}})}function Yc(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function Jc(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=br(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const s=await fetch(yr(n),{method:"PUT",headers:{"Content-Type":"application/json",...xr(e)},body:JSON.stringify(t.values)}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const a=i?.error??`Profile update failed (${s.status})`;e.nostrProfileFormState={...t,saving:!1,error:a,success:null,fieldErrors:Wc(i?.details)};return}if(!i.persisted){e.nostrProfileFormState={...t,saving:!1,error:"Profile publish failed on all relays.",success:null};return}e.nostrProfileFormState={...t,saving:!1,error:null,success:"Profile published to relays.",fieldErrors:{},original:{...t.values}},await ye(e,!0)}catch(s){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(s)}`,success:null}}}async function Zc(e){const t=e.nostrProfileFormState;if(!t||t.importing)return;const n=br(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const s=await fetch(yr(n,"/import"),{method:"POST",headers:{"Content-Type":"application/json",...xr(e)},body:JSON.stringify({autoMerge:!0})}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const c=i?.error??`Profile import failed (${s.status})`;e.nostrProfileFormState={...t,importing:!1,error:c,success:null};return}const a=i.merged??i.imported??null,o=a?{...t.values,...a}:t.values,l=!!(o.banner||o.website||o.nip05||o.lud16);e.nostrProfileFormState={...t,importing:!1,values:o,error:null,success:i.saved?"Profile imported from relays. Review and publish.":"Profile imported. Review and publish.",showAdvanced:l},i.saved&&await ye(e,!0)}catch(s){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(s)}`,success:null}}}function $r(e){const t=(e??"").trim();if(!t)return null;const n=t.split(":").filter(Boolean);if(n.length<3||n[0]!=="agent")return null;const s=n[1]?.trim(),i=n.slice(2).join(":");return!s||!i?null:{agentId:s,rest:i}}const Gs=450;function rn(e,t=!1,n=!1){e.chatScrollFrame&&cancelAnimationFrame(e.chatScrollFrame),e.chatScrollTimeout!=null&&(clearTimeout(e.chatScrollTimeout),e.chatScrollTimeout=null);const s=()=>{const i=e.querySelector(".chat-thread");if(i){const a=getComputedStyle(i).overflowY;if(a==="auto"||a==="scroll"||i.scrollHeight-i.clientHeight>1)return i}return document.scrollingElement??document.documentElement};e.updateComplete.then(()=>{e.chatScrollFrame=requestAnimationFrame(()=>{e.chatScrollFrame=null;const i=s();if(!i)return;const a=i.scrollHeight-i.scrollTop-i.clientHeight,o=t&&!e.chatHasAutoScrolled;if(!(o||e.chatUserNearBottom||a<Gs)){e.chatNewMessagesBelow=!0;return}o&&(e.chatHasAutoScrolled=!0);const c=n&&(typeof window>"u"||typeof window.matchMedia!="function"||!window.matchMedia("(prefers-reduced-motion: reduce)").matches),u=i.scrollHeight;typeof i.scrollTo=="function"?i.scrollTo({top:u,behavior:c?"smooth":"auto"}):i.scrollTop=u,e.chatUserNearBottom=!0,e.chatNewMessagesBelow=!1;const g=o?150:120;e.chatScrollTimeout=window.setTimeout(()=>{e.chatScrollTimeout=null;const p=s();if(!p)return;const h=p.scrollHeight-p.scrollTop-p.clientHeight;(o||e.chatUserNearBottom||h<Gs)&&(p.scrollTop=p.scrollHeight,e.chatUserNearBottom=!0)},g)})})}function wr(e,t=!1){e.logsScrollFrame&&cancelAnimationFrame(e.logsScrollFrame),e.updateComplete.then(()=>{e.logsScrollFrame=requestAnimationFrame(()=>{e.logsScrollFrame=null;const n=e.querySelector(".log-stream");if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;(t||s<80)&&(n.scrollTop=n.scrollHeight)})})}function Xc(e,t){const n=t.currentTarget;if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;e.chatUserNearBottom=s<Gs,e.chatUserNearBottom&&(e.chatNewMessagesBelow=!1)}function ed(e,t){const n=t.currentTarget;if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;e.logsAtBottom=s<80}function Ha(e){e.chatHasAutoScrolled=!1,e.chatUserNearBottom=!0,e.chatNewMessagesBelow=!1}function td(e,t){if(e.length===0)return;const n=new Blob([`${e.join(`
125
125
  `)}
126
- `],{type:"text/plain"}),s=URL.createObjectURL(n),i=document.createElement("a"),a=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");i.href=s,i.download=`openclaw-logs-${t}-${a}.log`,i.click(),URL.revokeObjectURL(s)}function qc(e){if(typeof ResizeObserver>"u")return;const t=e.querySelector(".topbar");if(!t)return;const n=()=>{const{height:s}=t.getBoundingClientRect();e.style.setProperty("--topbar-height",`${s}px`)};n(),e.topbarObserver=new ResizeObserver(()=>n()),e.topbarObserver.observe(t)}async function Jn(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,s,i]=await Promise.all([e.client.request("status",{}),e.client.request("health",{}),e.client.request("models.list",{}),e.client.request("last-heartbeat",{})]);e.debugStatus=t,e.debugHealth=n;const a=s;e.debugModels=Array.isArray(a?.models)?a?.models:[],e.debugHeartbeat=i}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}async function Gc(e){if(!(!e.client||!e.connected)){e.debugCallError=null,e.debugCallResult=null;try{const t=e.debugCallParams.trim()?JSON.parse(e.debugCallParams):{},n=await e.client.request(e.debugCallMethod.trim(),t);e.debugCallResult=JSON.stringify(n,null,2)}catch(t){e.debugCallError=String(t)}}}const Vc=2e3,Qc=new Set(["trace","debug","info","warn","error","fatal"]);function Yc(e){if(typeof e!="string")return null;const t=e.trim();if(!t.startsWith("{")||!t.endsWith("}"))return null;try{const n=JSON.parse(t);return!n||typeof n!="object"?null:n}catch{return null}}function Jc(e){if(typeof e!="string")return null;const t=e.toLowerCase();return Qc.has(t)?t:null}function Zc(e){if(!e.trim())return{raw:e,message:e};try{const t=JSON.parse(e),n=t&&typeof t._meta=="object"&&t._meta!==null?t._meta:null,s=typeof t.time=="string"?t.time:typeof n?.date=="string"?n?.date:null,i=Jc(n?.logLevelName??n?.level),a=typeof t[0]=="string"?t[0]:typeof n?.name=="string"?n?.name:null,o=Yc(a);let l=null;o&&(typeof o.subsystem=="string"?l=o.subsystem:typeof o.module=="string"&&(l=o.module)),!l&&a&&a.length<120&&(l=a);let c=null;return typeof t[1]=="string"?c=t[1]:!o&&typeof t[0]=="string"?c=t[0]:typeof t.message=="string"&&(c=t.message),{raw:e,time:s,level:i,subsystem:l,message:c??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Ci(e,t){if(!(!e.client||!e.connected)&&!(e.logsLoading&&!t?.quiet)){t?.quiet||(e.logsLoading=!0),e.logsError=null;try{const s=await e.client.request("logs.tail",{cursor:t?.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),a=(Array.isArray(s.lines)?s.lines.filter(l=>typeof l=="string"):[]).map(Zc),o=!!(t?.reset||s.reset||e.logsCursor==null);e.logsEntries=o?a:[...e.logsEntries,...a].slice(-Vc),typeof s.cursor=="number"&&(e.logsCursor=s.cursor),typeof s.file=="string"&&(e.logsFile=s.file),e.logsTruncated=!!s.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t?.quiet||(e.logsLoading=!1)}}}async function Zn(e,t){if(!(!e.client||!e.connected)&&!e.nodesLoading){e.nodesLoading=!0,t?.quiet||(e.lastError=null);try{const n=await e.client.request("node.list",{});e.nodes=Array.isArray(n.nodes)?n.nodes:[]}catch(n){t?.quiet||(e.lastError=String(n))}finally{e.nodesLoading=!1}}}function Xc(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{Zn(e,{quiet:!0})},5e3))}function ed(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function Ti(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&Ci(e,{quiet:!0})},2e3))}function _i(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function Ei(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&Jn(e)},3e3))}function Li(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}async function br(e,t){if(!(!e.client||!e.connected||e.agentIdentityLoading)&&!e.agentIdentityById[t]){e.agentIdentityLoading=!0,e.agentIdentityError=null;try{const n=await e.client.request("agent.identity.get",{agentId:t});n&&(e.agentIdentityById={...e.agentIdentityById,[t]:n})}catch(n){e.agentIdentityError=String(n)}finally{e.agentIdentityLoading=!1}}}async function yr(e,t){if(!e.client||!e.connected||e.agentIdentityLoading)return;const n=t.filter(s=>!e.agentIdentityById[s]);if(n.length!==0){e.agentIdentityLoading=!0,e.agentIdentityError=null;try{for(const s of n){const i=await e.client.request("agent.identity.get",{agentId:s});i&&(e.agentIdentityById={...e.agentIdentityById,[s]:i})}}catch(s){e.agentIdentityError=String(s)}finally{e.agentIdentityLoading=!1}}}async function In(e,t){if(!(!e.client||!e.connected)&&!e.agentSkillsLoading){e.agentSkillsLoading=!0,e.agentSkillsError=null;try{const n=await e.client.request("skills.status",{agentId:t});n&&(e.agentSkillsReport=n,e.agentSkillsAgentId=t)}catch(n){e.agentSkillsError=String(n)}finally{e.agentSkillsLoading=!1}}}async function Mi(e){if(!(!e.client||!e.connected)&&!e.agentsLoading){e.agentsLoading=!0,e.agentsError=null;try{const t=await e.client.request("agents.list",{});if(t){e.agentsList=t;const n=e.agentsSelectedId,s=t.agents.some(i=>i.id===n);(!n||!s)&&(e.agentsSelectedId=t.defaultId??t.agents[0]?.id??null)}}catch(t){e.agentsError=String(t)}finally{e.agentsLoading=!1}}}function Ii(e,t){if(e==null||!Number.isFinite(e)||e<=0)return;if(e<1e3)return`${Math.round(e)}ms`;const n=t?.spaced?" ":"",s=Math.round(e/1e3),i=Math.floor(s/3600),a=Math.floor(s%3600/60),o=s%60;if(i>=24){const l=Math.floor(i/24),c=i%24;return c>0?`${l}d${n}${c}h`:`${l}d`}return i>0?a>0?`${i}h${n}${a}m`:`${i}h`:a>0?o>0?`${a}m${n}${o}s`:`${a}m`:`${o}s`}function Ri(e,t="n/a"){if(e==null||!Number.isFinite(e)||e<0)return t;if(e<1e3)return`${Math.round(e)}ms`;const n=Math.round(e/1e3);if(n<60)return`${n}s`;const s=Math.round(n/60);if(s<60)return`${s}m`;const i=Math.round(s/60);return i<24?`${i}h`:`${Math.round(i/24)}d`}function V(e,t){const n=t?.fallback??"n/a";if(e==null||!Number.isFinite(e))return n;const s=Date.now()-e,i=Math.abs(s),a=s>=0,o=Math.round(i/1e3);if(o<60)return a?"just now":"in <1m";const l=Math.round(o/60);if(l<60)return a?`${l}m ago`:`in ${l}m`;const c=Math.round(l/60);if(c<48)return a?`${c}h ago`:`in ${c}h`;const u=Math.round(c/24);return a?`${u}d ago`:`in ${u}d`}const td=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,bn=/<\s*\/?\s*final\b[^<>]*>/gi,Ua=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^<>]*>/gi;function za(e){const t=[],n=/(^|\n)(```|~~~)[^\n]*\n[\s\S]*?(?:\n\2(?:\n|$)|$)/g;for(const i of e.matchAll(n)){const a=(i.index??0)+i[1].length;t.push({start:a,end:a+i[0].length-i[1].length})}const s=/`+[^`]+`+/g;for(const i of e.matchAll(s)){const a=i.index??0,o=a+i[0].length;t.some(c=>a>=c.start&&o<=c.end)||t.push({start:a,end:o})}return t.sort((i,a)=>i.start-a.start),t}function Ha(e,t){return t.some(n=>e>=n.start&&e<n.end)}function nd(e,t){return e.trimStart()}function sd(e,t){if(!e||!td.test(e))return e;let n=e;if(bn.test(n)){bn.lastIndex=0;const l=[],c=za(n);for(const u of n.matchAll(bn)){const g=u.index??0;l.push({start:g,length:u[0].length,inCode:Ha(g,c)})}for(let u=l.length-1;u>=0;u--){const g=l[u];g.inCode||(n=n.slice(0,g.start)+n.slice(g.start+g.length))}}else bn.lastIndex=0;const s=za(n);Ua.lastIndex=0;let i="",a=0,o=!1;for(const l of n.matchAll(Ua)){const c=l.index??0,u=l[1]==="/";Ha(c,s)||(o?u&&(o=!1):(i+=n.slice(a,c),u||(o=!0)),a=c+l[0].length)}return i+=n.slice(a),nd(i)}function ft(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString()}function Vs(e){return!e||e.length===0?"none":e.filter(t=>!!(t&&t.trim())).join(", ")}function Qs(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function xr(e,t){return e.length<=t?{text:e,truncated:!1,total:e.length}:{text:e.slice(0,Math.max(0,t)),truncated:!0,total:e.length}}function Nn(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function ws(e){return sd(e)}async function on(e){if(!(!e.client||!e.connected))try{const t=await e.client.request("cron.status",{});e.cronStatus=t}catch(t){e.cronError=String(t)}}async function Xn(e){if(!(!e.client||!e.connected)&&!e.cronLoading){e.cronLoading=!0,e.cronError=null;try{const t=await e.client.request("cron.list",{includeDisabled:!0});e.cronJobs=Array.isArray(t.jobs)?t.jobs:[]}catch(t){e.cronError=String(t)}finally{e.cronLoading=!1}}}function id(e){if(e.scheduleKind==="at"){const n=Date.parse(e.scheduleAt);if(!Number.isFinite(n))throw new Error("Invalid run time.");return{kind:"at",at:new Date(n).toISOString()}}if(e.scheduleKind==="every"){const n=Nn(e.everyAmount,0);if(n<=0)throw new Error("Invalid interval amount.");const s=e.everyUnit;return{kind:"every",everyMs:n*(s==="minutes"?6e4:s==="hours"?36e5:864e5)}}const t=e.cronExpr.trim();if(!t)throw new Error("Cron expression required.");return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0}}function ad(e){if(e.payloadKind==="systemEvent"){const i=e.payloadText.trim();if(!i)throw new Error("System event text required.");return{kind:"systemEvent",text:i}}const t=e.payloadText.trim();if(!t)throw new Error("Agent message required.");const n={kind:"agentTurn",message:t},s=Nn(e.timeoutSeconds,0);return s>0&&(n.timeoutSeconds=s),n}async function od(e){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const t=id(e.cronForm),n=ad(e.cronForm),s=e.cronForm.sessionTarget==="isolated"&&e.cronForm.payloadKind==="agentTurn"&&e.cronForm.deliveryMode?{mode:e.cronForm.deliveryMode==="announce"?"announce":"none",channel:e.cronForm.deliveryChannel.trim()||"last",to:e.cronForm.deliveryTo.trim()||void 0}:void 0,i=e.cronForm.agentId.trim(),a={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:i||void 0,enabled:e.cronForm.enabled,schedule:t,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:n,delivery:s};if(!a.name)throw new Error("Name required.");await e.client.request("cron.add",a),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await Xn(e),await on(e)}catch(t){e.cronError=String(t)}finally{e.cronBusy=!1}}}async function rd(e,t,n){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.update",{id:t.id,patch:{enabled:n}}),await Xn(e),await on(e)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function ld(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.run",{id:t.id,mode:"force"}),await $r(e,t.id)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function cd(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.remove",{id:t.id}),e.cronRunsJobId===t.id&&(e.cronRunsJobId=null,e.cronRuns=[]),await Xn(e),await on(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function $r(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("cron.runs",{id:t,limit:50});e.cronRunsJobId=t,e.cronRuns=Array.isArray(n.entries)?n.entries:[]}catch(n){e.cronError=String(n)}}const wr="openclaw.device.auth.v1";function Pi(e){return e.trim()}function dd(e){if(!Array.isArray(e))return[];const t=new Set;for(const n of e){const s=n.trim();s&&t.add(s)}return[...t].toSorted()}function Di(){try{const e=window.localStorage.getItem(wr);if(!e)return null;const t=JSON.parse(e);return!t||t.version!==1||!t.deviceId||typeof t.deviceId!="string"||!t.tokens||typeof t.tokens!="object"?null:t}catch{return null}}function kr(e){try{window.localStorage.setItem(wr,JSON.stringify(e))}catch{}}function ud(e){const t=Di();if(!t||t.deviceId!==e.deviceId)return null;const n=Pi(e.role),s=t.tokens[n];return!s||typeof s.token!="string"?null:s}function Sr(e){const t=Pi(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},s=Di();s&&s.deviceId===e.deviceId&&(n.tokens={...s.tokens});const i={token:e.token,role:t,scopes:dd(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=i,kr(n),i}function Ar(e){const t=Di();if(!t||t.deviceId!==e.deviceId)return;const n=Pi(e.role);if(!t.tokens[n])return;const s={...t,tokens:{...t.tokens}};delete s.tokens[n],kr(s)}const Cr={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:ue,n:Rn,Gx:ja,Gy:Ka,a:ks,d:Ss,h:gd}=Cr,ht=32,Fi=64,pd=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},oe=(e="")=>{const t=new Error(e);throw pd(t,oe),t},fd=e=>typeof e=="bigint",hd=e=>typeof e=="string",vd=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",Je=(e,t,n="")=>{const s=vd(e),i=e?.length,a=t!==void 0;if(!s||a&&i!==t){const o=n&&`"${n}" `,l=a?` of length ${t}`:"",c=s?`length=${i}`:`type=${typeof e}`;oe(o+"expected Uint8Array"+l+", got "+c)}return e},es=e=>new Uint8Array(e),Tr=e=>Uint8Array.from(e),_r=(e,t)=>e.toString(16).padStart(t,"0"),Er=e=>Array.from(Je(e)).map(t=>_r(t,2)).join(""),He={_0:48,_9:57,A:65,F:70,a:97,f:102},Wa=e=>{if(e>=He._0&&e<=He._9)return e-He._0;if(e>=He.A&&e<=He.F)return e-(He.A-10);if(e>=He.a&&e<=He.f)return e-(He.a-10)},Lr=e=>{const t="hex invalid";if(!hd(e))return oe(t);const n=e.length,s=n/2;if(n%2)return oe(t);const i=es(s);for(let a=0,o=0;a<s;a++,o+=2){const l=Wa(e.charCodeAt(o)),c=Wa(e.charCodeAt(o+1));if(l===void 0||c===void 0)return oe(t);i[a]=l*16+c}return i},Mr=()=>globalThis?.crypto,md=()=>Mr()?.subtle??oe("crypto.subtle must be defined, consider polyfill"),en=(...e)=>{const t=es(e.reduce((s,i)=>s+Je(i).length,0));let n=0;return e.forEach(s=>{t.set(s,n),n+=s.length}),t},bd=(e=ht)=>Mr().getRandomValues(es(e)),On=BigInt,ot=(e,t,n,s="bad number: out of range")=>fd(e)&&t<=e&&e<n?e:oe(s),D=(e,t=ue)=>{const n=e%t;return n>=0n?n:t+n},Ir=e=>D(e,Rn),yd=(e,t)=>{(e===0n||t<=0n)&&oe("no inverse n="+e+" mod="+t);let n=D(e,t),s=t,i=0n,a=1n;for(;n!==0n;){const o=s/n,l=s%n,c=i-a*o;s=n,n=l,i=a,a=c}return s===1n?D(i,t):oe("no inverse")},xd=e=>{const t=Fr[e];return typeof t!="function"&&oe("hashes."+e+" not set"),t},As=e=>e instanceof ke?e:oe("Point expected"),Ys=2n**256n;class ke{static BASE;static ZERO;X;Y;Z;T;constructor(t,n,s,i){const a=Ys;this.X=ot(t,0n,a),this.Y=ot(n,0n,a),this.Z=ot(s,1n,a),this.T=ot(i,0n,a),Object.freeze(this)}static CURVE(){return Cr}static fromAffine(t){return new ke(t.x,t.y,1n,D(t.x*t.y))}static fromBytes(t,n=!1){const s=Ss,i=Tr(Je(t,ht)),a=t[31];i[31]=a&-129;const o=Pr(i);ot(o,0n,n?Ys:ue);const c=D(o*o),u=D(c-1n),g=D(s*c+1n);let{isValid:p,value:h}=wd(u,g);p||oe("bad point: y not sqrt");const d=(h&1n)===1n,f=(a&128)!==0;return!n&&h===0n&&f&&oe("bad point: x==0, isLastByteOdd"),f!==d&&(h=D(-h)),new ke(h,o,1n,D(h*o))}static fromHex(t,n){return ke.fromBytes(Lr(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=ks,n=Ss,s=this;if(s.is0())return oe("bad point: ZERO");const{X:i,Y:a,Z:o,T:l}=s,c=D(i*i),u=D(a*a),g=D(o*o),p=D(g*g),h=D(c*t),d=D(g*D(h+u)),f=D(p+D(n*D(c*u)));if(d!==f)return oe("bad point: equation left != right (1)");const m=D(i*a),S=D(o*l);return m!==S?oe("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:s,Z:i}=this,{X:a,Y:o,Z:l}=As(t),c=D(n*l),u=D(a*i),g=D(s*l),p=D(o*i);return c===u&&g===p}is0(){return this.equals(Tt)}negate(){return new ke(D(-this.X),this.Y,this.Z,D(-this.T))}double(){const{X:t,Y:n,Z:s}=this,i=ks,a=D(t*t),o=D(n*n),l=D(2n*D(s*s)),c=D(i*a),u=t+n,g=D(D(u*u)-a-o),p=c+o,h=p-l,d=c-o,f=D(g*h),m=D(p*d),S=D(g*d),k=D(h*p);return new ke(f,m,k,S)}add(t){const{X:n,Y:s,Z:i,T:a}=this,{X:o,Y:l,Z:c,T:u}=As(t),g=ks,p=Ss,h=D(n*o),d=D(s*l),f=D(a*p*u),m=D(i*c),S=D((n+s)*(o+l)-h-d),k=D(m-f),$=D(m+f),A=D(d-g*h),C=D(S*k),_=D($*A),T=D(S*A),I=D(k*$);return new ke(C,_,I,T)}subtract(t){return this.add(As(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return Tt;if(ot(t,1n,Rn),t===1n)return this;if(this.equals(vt))return Rd(t).p;let s=Tt,i=vt;for(let a=this;t>0n;a=a.double(),t>>=1n)t&1n?s=s.add(a):n&&(i=i.add(a));return s}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:s}=this;if(this.equals(Tt))return{x:0n,y:1n};const i=yd(s,ue);D(s*i)!==1n&&oe("invalid inverse");const a=D(t*i),o=D(n*i);return{x:a,y:o}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),s=Rr(n);return s[31]|=t&1n?128:0,s}toHex(){return Er(this.toBytes())}clearCofactor(){return this.multiply(On(gd),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Rn/2n,!1).double();return Rn%2n&&(t=t.add(this)),t.is0()}}const vt=new ke(ja,Ka,1n,D(ja*Ka)),Tt=new ke(0n,1n,1n,0n);ke.BASE=vt;ke.ZERO=Tt;const Rr=e=>Lr(_r(ot(e,0n,Ys),Fi)).reverse(),Pr=e=>On("0x"+Er(Tr(Je(e)).reverse())),Ie=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=ue;return n},$d=e=>{const n=e*e%ue*e%ue,s=Ie(n,2n)*n%ue,i=Ie(s,1n)*e%ue,a=Ie(i,5n)*i%ue,o=Ie(a,10n)*a%ue,l=Ie(o,20n)*o%ue,c=Ie(l,40n)*l%ue,u=Ie(c,80n)*c%ue,g=Ie(u,80n)*c%ue,p=Ie(g,10n)*a%ue;return{pow_p_5_8:Ie(p,2n)*e%ue,b2:n}},qa=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,wd=(e,t)=>{const n=D(t*t*t),s=D(n*n*t),i=$d(e*s).pow_p_5_8;let a=D(e*n*i);const o=D(t*a*a),l=a,c=D(a*qa),u=o===e,g=o===D(-e),p=o===D(-e*qa);return u&&(a=l),(g||p)&&(a=c),(D(a)&1n)===1n&&(a=D(-a)),{isValid:u||g,value:a}},Js=e=>Ir(Pr(e)),Ni=(...e)=>Fr.sha512Async(en(...e)),kd=(...e)=>xd("sha512")(en(...e)),Dr=e=>{const t=e.slice(0,ht);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(ht,Fi),s=Js(t),i=vt.multiply(s),a=i.toBytes();return{head:t,prefix:n,scalar:s,point:i,pointBytes:a}},Oi=e=>Ni(Je(e,ht)).then(Dr),Sd=e=>Dr(kd(Je(e,ht))),Ad=e=>Oi(e).then(t=>t.pointBytes),Cd=e=>Ni(e.hashable).then(e.finish),Td=(e,t,n)=>{const{pointBytes:s,scalar:i}=e,a=Js(t),o=vt.multiply(a).toBytes();return{hashable:en(o,s,n),finish:u=>{const g=Ir(a+Js(u)*i);return Je(en(o,Rr(g)),Fi)}}},_d=async(e,t)=>{const n=Je(e),s=await Oi(t),i=await Ni(s.prefix,n);return Cd(Td(s,i,n))},Fr={sha512Async:async e=>{const t=md(),n=en(e);return es(await t.digest("SHA-512",n.buffer))},sha512:void 0},Ed=(e=bd(ht))=>e,Ld={getExtendedPublicKeyAsync:Oi,getExtendedPublicKey:Sd,randomSecretKey:Ed},Bn=8,Md=256,Nr=Math.ceil(Md/Bn)+1,Zs=2**(Bn-1),Id=()=>{const e=[];let t=vt,n=t;for(let s=0;s<Nr;s++){n=t,e.push(n);for(let i=1;i<Zs;i++)n=n.add(t),e.push(n);t=n.double()}return e};let Ga;const Va=(e,t)=>{const n=t.negate();return e?n:t},Rd=e=>{const t=Ga||(Ga=Id());let n=Tt,s=vt;const i=2**Bn,a=i,o=On(i-1),l=On(Bn);for(let c=0;c<Nr;c++){let u=Number(e&o);e>>=l,u>Zs&&(u-=a,e+=1n);const g=c*Zs,p=g,h=g+Math.abs(u)-1,d=c%2!==0,f=u<0;u===0?s=s.add(Va(d,t[p])):n=n.add(Va(f,t[h]))}return e!==0n&&oe("invalid wnaf"),{p:n,f:s}},Cs="openclaw-device-identity-v1";function Xs(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/g,"")}function Or(e){const t=e.replaceAll("-","+").replaceAll("_","/"),n=t+"=".repeat((4-t.length%4)%4),s=atob(n),i=new Uint8Array(s.length);for(let a=0;a<s.length;a+=1)i[a]=s.charCodeAt(a);return i}function Pd(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Br(e){const t=await crypto.subtle.digest("SHA-256",e.slice().buffer);return Pd(new Uint8Array(t))}async function Dd(){const e=Ld.randomSecretKey(),t=await Ad(e);return{deviceId:await Br(t),publicKey:Xs(t),privateKey:Xs(e)}}async function Bi(){try{const n=localStorage.getItem(Cs);if(n){const s=JSON.parse(n);if(s?.version===1&&typeof s.deviceId=="string"&&typeof s.publicKey=="string"&&typeof s.privateKey=="string"){const i=await Br(Or(s.publicKey));if(i!==s.deviceId){const a={...s,deviceId:i};return localStorage.setItem(Cs,JSON.stringify(a)),{deviceId:i,publicKey:s.publicKey,privateKey:s.privateKey}}return{deviceId:s.deviceId,publicKey:s.publicKey,privateKey:s.privateKey}}}}catch{}const e=await Dd(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(Cs,JSON.stringify(t)),e}async function Fd(e,t){const n=Or(e),s=new TextEncoder().encode(t),i=await _d(s,n);return Xs(i)}async function Ze(e,t){if(!(!e.client||!e.connected)&&!e.devicesLoading){e.devicesLoading=!0,t?.quiet||(e.devicesError=null);try{const n=await e.client.request("device.pair.list",{});e.devicesList={pending:Array.isArray(n?.pending)?n.pending:[],paired:Array.isArray(n?.paired)?n.paired:[]}}catch(n){t?.quiet||(e.devicesError=String(n))}finally{e.devicesLoading=!1}}}async function Nd(e,t){if(!(!e.client||!e.connected))try{await e.client.request("device.pair.approve",{requestId:t}),await Ze(e)}catch(n){e.devicesError=String(n)}}async function Od(e,t){if(!(!e.client||!e.connected||!window.confirm("Reject this device pairing request?")))try{await e.client.request("device.pair.reject",{requestId:t}),await Ze(e)}catch(s){e.devicesError=String(s)}}async function Bd(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("device.token.rotate",t);if(n?.token){const s=await Bi(),i=n.role??t.role;(n.deviceId===s.deviceId||t.deviceId===s.deviceId)&&Sr({deviceId:s.deviceId,role:i,token:n.token,scopes:n.scopes??t.scopes??[]}),window.prompt("New device token (copy and store securely):",n.token)}await Ze(e)}catch(n){e.devicesError=String(n)}}async function Ud(e,t){if(!(!e.client||!e.connected||!window.confirm(`Revoke token for ${t.deviceId} (${t.role})?`)))try{await e.client.request("device.token.revoke",t);const s=await Bi();t.deviceId===s.deviceId&&Ar({deviceId:s.deviceId,role:t.role}),await Ze(e)}catch(s){e.devicesError=String(s)}}function zd(e){if(!e||e.kind==="gateway")return{method:"exec.approvals.get",params:{}};const t=e.nodeId.trim();return t?{method:"exec.approvals.node.get",params:{nodeId:t}}:null}function Hd(e,t){if(!e||e.kind==="gateway")return{method:"exec.approvals.set",params:t};const n=e.nodeId.trim();return n?{method:"exec.approvals.node.set",params:{...t,nodeId:n}}:null}async function Ui(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=zd(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const s=await e.client.request(n.method,n.params);jd(e,s)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function jd(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=pt(t.file??{}))}async function Kd(e,t){if(!(!e.client||!e.connected)){e.execApprovalsSaving=!0,e.lastError=null;try{const n=e.execApprovalsSnapshot?.hash;if(!n){e.lastError="Exec approvals hash missing; reload and retry.";return}const s=e.execApprovalsForm??e.execApprovalsSnapshot?.file??{},i=Hd(t,{file:s,baseHash:n});if(!i){e.lastError="Select a node before saving exec approvals.";return}await e.client.request(i.method,i.params),e.execApprovalsDirty=!1,await Ui(e,t)}catch(n){e.lastError=String(n)}finally{e.execApprovalsSaving=!1}}}function Wd(e,t,n){const s=pt(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});ur(s,t,n),e.execApprovalsForm=s,e.execApprovalsDirty=!0}function qd(e,t){const n=pt(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});gr(n,t),e.execApprovalsForm=n,e.execApprovalsDirty=!0}async function zi(e){if(!(!e.client||!e.connected)&&!e.presenceLoading){e.presenceLoading=!0,e.presenceError=null,e.presenceStatus=null;try{const t=await e.client.request("system-presence",{});Array.isArray(t)?(e.presenceEntries=t,e.presenceStatus=t.length===0?"No instances yet.":null):(e.presenceEntries=[],e.presenceStatus="No presence payload.")}catch(t){e.presenceError=String(t)}finally{e.presenceLoading=!1}}}async function bt(e,t){if(!(!e.client||!e.connected)&&!e.sessionsLoading){e.sessionsLoading=!0,e.sessionsError=null;try{const n=t?.includeGlobal??e.sessionsIncludeGlobal,s=t?.includeUnknown??e.sessionsIncludeUnknown,i=t?.activeMinutes??Nn(e.sessionsFilterActive,0),a=t?.limit??Nn(e.sessionsFilterLimit,0),o={includeGlobal:n,includeUnknown:s};i>0&&(o.activeMinutes=i),a>0&&(o.limit=a);const l=await e.client.request("sessions.list",o);l&&(e.sessionsResult=l)}catch(n){e.sessionsError=String(n)}finally{e.sessionsLoading=!1}}}async function Gd(e,t,n){if(!e.client||!e.connected)return;const s={key:t};"label"in n&&(s.label=n.label),"thinkingLevel"in n&&(s.thinkingLevel=n.thinkingLevel),"verboseLevel"in n&&(s.verboseLevel=n.verboseLevel),"reasoningLevel"in n&&(s.reasoningLevel=n.reasoningLevel);try{await e.client.request("sessions.patch",s),await bt(e)}catch(i){e.sessionsError=String(i)}}async function Vd(e,t){if(!(!e.client||!e.connected||e.sessionsLoading||!window.confirm(`Delete session "${t}"?
126
+ `],{type:"text/plain"}),s=URL.createObjectURL(n),i=document.createElement("a"),a=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");i.href=s,i.download=`openclaw-logs-${t}-${a}.log`,i.click(),URL.revokeObjectURL(s)}function nd(e){if(typeof ResizeObserver>"u")return;const t=e.querySelector(".topbar");if(!t)return;const n=()=>{const{height:s}=t.getBoundingClientRect();e.style.setProperty("--topbar-height",`${s}px`)};n(),e.topbarObserver=new ResizeObserver(()=>n()),e.topbarObserver.observe(t)}async function Xn(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,s,i]=await Promise.all([e.client.request("status",{}),e.client.request("health",{}),e.client.request("models.list",{}),e.client.request("last-heartbeat",{})]);e.debugStatus=t,e.debugHealth=n;const a=s;e.debugModels=Array.isArray(a?.models)?a?.models:[],e.debugHeartbeat=i}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}async function sd(e){if(!(!e.client||!e.connected)){e.debugCallError=null,e.debugCallResult=null;try{const t=e.debugCallParams.trim()?JSON.parse(e.debugCallParams):{},n=await e.client.request(e.debugCallMethod.trim(),t);e.debugCallResult=JSON.stringify(n,null,2)}catch(t){e.debugCallError=String(t)}}}const id=2e3,ad=new Set(["trace","debug","info","warn","error","fatal"]);function od(e){if(typeof e!="string")return null;const t=e.trim();if(!t.startsWith("{")||!t.endsWith("}"))return null;try{const n=JSON.parse(t);return!n||typeof n!="object"?null:n}catch{return null}}function rd(e){if(typeof e!="string")return null;const t=e.toLowerCase();return ad.has(t)?t:null}function ld(e){if(!e.trim())return{raw:e,message:e};try{const t=JSON.parse(e),n=t&&typeof t._meta=="object"&&t._meta!==null?t._meta:null,s=typeof t.time=="string"?t.time:typeof n?.date=="string"?n?.date:null,i=rd(n?.logLevelName??n?.level),a=typeof t[0]=="string"?t[0]:typeof n?.name=="string"?n?.name:null,o=od(a);let l=null;o&&(typeof o.subsystem=="string"?l=o.subsystem:typeof o.module=="string"&&(l=o.module)),!l&&a&&a.length<120&&(l=a);let c=null;return typeof t[1]=="string"?c=t[1]:!o&&typeof t[0]=="string"?c=t[0]:typeof t.message=="string"&&(c=t.message),{raw:e,time:s,level:i,subsystem:l,message:c??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Ti(e,t){if(!(!e.client||!e.connected)&&!(e.logsLoading&&!t?.quiet)){t?.quiet||(e.logsLoading=!0),e.logsError=null;try{const s=await e.client.request("logs.tail",{cursor:t?.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),a=(Array.isArray(s.lines)?s.lines.filter(l=>typeof l=="string"):[]).map(ld),o=!!(t?.reset||s.reset||e.logsCursor==null);e.logsEntries=o?a:[...e.logsEntries,...a].slice(-id),typeof s.cursor=="number"&&(e.logsCursor=s.cursor),typeof s.file=="string"&&(e.logsFile=s.file),e.logsTruncated=!!s.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t?.quiet||(e.logsLoading=!1)}}}async function es(e,t){if(!(!e.client||!e.connected)&&!e.nodesLoading){e.nodesLoading=!0,t?.quiet||(e.lastError=null);try{const n=await e.client.request("node.list",{});e.nodes=Array.isArray(n.nodes)?n.nodes:[]}catch(n){t?.quiet||(e.lastError=String(n))}finally{e.nodesLoading=!1}}}function cd(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{es(e,{quiet:!0})},5e3))}function dd(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function _i(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&Ti(e,{quiet:!0})},2e3))}function Ei(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function Li(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&Xn(e)},3e3))}function Mi(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}async function kr(e,t){if(!(!e.client||!e.connected||e.agentIdentityLoading)&&!e.agentIdentityById[t]){e.agentIdentityLoading=!0,e.agentIdentityError=null;try{const n=await e.client.request("agent.identity.get",{agentId:t});n&&(e.agentIdentityById={...e.agentIdentityById,[t]:n})}catch(n){e.agentIdentityError=String(n)}finally{e.agentIdentityLoading=!1}}}async function Sr(e,t){if(!e.client||!e.connected||e.agentIdentityLoading)return;const n=t.filter(s=>!e.agentIdentityById[s]);if(n.length!==0){e.agentIdentityLoading=!0,e.agentIdentityError=null;try{for(const s of n){const i=await e.client.request("agent.identity.get",{agentId:s});i&&(e.agentIdentityById={...e.agentIdentityById,[s]:i})}}catch(s){e.agentIdentityError=String(s)}finally{e.agentIdentityLoading=!1}}}async function Pn(e,t){if(!(!e.client||!e.connected)&&!e.agentSkillsLoading){e.agentSkillsLoading=!0,e.agentSkillsError=null;try{const n=await e.client.request("skills.status",{agentId:t});n&&(e.agentSkillsReport=n,e.agentSkillsAgentId=t)}catch(n){e.agentSkillsError=String(n)}finally{e.agentSkillsLoading=!1}}}async function Ii(e){if(!(!e.client||!e.connected)&&!e.agentsLoading){e.agentsLoading=!0,e.agentsError=null;try{const t=await e.client.request("agents.list",{});if(t){e.agentsList=t;const n=e.agentsSelectedId,s=t.agents.some(i=>i.id===n);(!n||!s)&&(e.agentsSelectedId=t.defaultId??t.agents[0]?.id??null)}}catch(t){e.agentsError=String(t)}finally{e.agentsLoading=!1}}}function Ri(e,t){if(e==null||!Number.isFinite(e)||e<=0)return;if(e<1e3)return`${Math.round(e)}ms`;const n=t?.spaced?" ":"",s=Math.round(e/1e3),i=Math.floor(s/3600),a=Math.floor(s%3600/60),o=s%60;if(i>=24){const l=Math.floor(i/24),c=i%24;return c>0?`${l}d${n}${c}h`:`${l}d`}return i>0?a>0?`${i}h${n}${a}m`:`${i}h`:a>0?o>0?`${a}m${n}${o}s`:`${a}m`:`${o}s`}function Pi(e,t="n/a"){if(e==null||!Number.isFinite(e)||e<0)return t;if(e<1e3)return`${Math.round(e)}ms`;const n=Math.round(e/1e3);if(n<60)return`${n}s`;const s=Math.round(n/60);if(s<60)return`${s}m`;const i=Math.round(s/60);return i<24?`${i}h`:`${Math.round(i/24)}d`}function V(e,t){const n=t?.fallback??"n/a";if(e==null||!Number.isFinite(e))return n;const s=Date.now()-e,i=Math.abs(s),a=s>=0,o=Math.round(i/1e3);if(o<60)return a?"just now":"in <1m";const l=Math.round(o/60);if(l<60)return a?`${l}m ago`:`in ${l}m`;const c=Math.round(l/60);if(c<48)return a?`${c}h ago`:`in ${c}h`;const u=Math.round(c/24);return a?`${u}d ago`:`in ${u}d`}const ud=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,xn=/<\s*\/?\s*final\b[^<>]*>/gi,ja=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^<>]*>/gi;function Ka(e){const t=[],n=/(^|\n)(```|~~~)[^\n]*\n[\s\S]*?(?:\n\2(?:\n|$)|$)/g;for(const i of e.matchAll(n)){const a=(i.index??0)+i[1].length;t.push({start:a,end:a+i[0].length-i[1].length})}const s=/`+[^`]+`+/g;for(const i of e.matchAll(s)){const a=i.index??0,o=a+i[0].length;t.some(c=>a>=c.start&&o<=c.end)||t.push({start:a,end:o})}return t.sort((i,a)=>i.start-a.start),t}function Wa(e,t){return t.some(n=>e>=n.start&&e<n.end)}function gd(e,t){return e.trimStart()}function pd(e,t){if(!e||!ud.test(e))return e;let n=e;if(xn.test(n)){xn.lastIndex=0;const l=[],c=Ka(n);for(const u of n.matchAll(xn)){const g=u.index??0;l.push({start:g,length:u[0].length,inCode:Wa(g,c)})}for(let u=l.length-1;u>=0;u--){const g=l[u];g.inCode||(n=n.slice(0,g.start)+n.slice(g.start+g.length))}}else xn.lastIndex=0;const s=Ka(n);ja.lastIndex=0;let i="",a=0,o=!1;for(const l of n.matchAll(ja)){const c=l.index??0,u=l[1]==="/";Wa(c,s)||(o?u&&(o=!1):(i+=n.slice(a,c),u||(o=!0)),a=c+l[0].length)}return i+=n.slice(a),gd(i)}function vt(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString()}function Vs(e){return!e||e.length===0?"none":e.filter(t=>!!(t&&t.trim())).join(", ")}function Qs(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function Ar(e,t){return e.length<=t?{text:e,truncated:!1,total:e.length}:{text:e.slice(0,Math.max(0,t)),truncated:!0,total:e.length}}function Bn(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function ks(e){return pd(e)}async function ln(e){if(!(!e.client||!e.connected))try{const t=await e.client.request("cron.status",{});e.cronStatus=t}catch(t){e.cronError=String(t)}}async function ts(e){if(!(!e.client||!e.connected)&&!e.cronLoading){e.cronLoading=!0,e.cronError=null;try{const t=await e.client.request("cron.list",{includeDisabled:!0});e.cronJobs=Array.isArray(t.jobs)?t.jobs:[]}catch(t){e.cronError=String(t)}finally{e.cronLoading=!1}}}function fd(e){if(e.scheduleKind==="at"){const n=Date.parse(e.scheduleAt);if(!Number.isFinite(n))throw new Error("Invalid run time.");return{kind:"at",at:new Date(n).toISOString()}}if(e.scheduleKind==="every"){const n=Bn(e.everyAmount,0);if(n<=0)throw new Error("Invalid interval amount.");const s=e.everyUnit;return{kind:"every",everyMs:n*(s==="minutes"?6e4:s==="hours"?36e5:864e5)}}const t=e.cronExpr.trim();if(!t)throw new Error("Cron expression required.");return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0}}function hd(e){if(e.payloadKind==="systemEvent"){const i=e.payloadText.trim();if(!i)throw new Error("System event text required.");return{kind:"systemEvent",text:i}}const t=e.payloadText.trim();if(!t)throw new Error("Agent message required.");const n={kind:"agentTurn",message:t},s=Bn(e.timeoutSeconds,0);return s>0&&(n.timeoutSeconds=s),n}async function vd(e){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const t=fd(e.cronForm),n=hd(e.cronForm),s=e.cronForm.sessionTarget==="isolated"&&e.cronForm.payloadKind==="agentTurn"&&e.cronForm.deliveryMode?{mode:e.cronForm.deliveryMode==="announce"?"announce":"none",channel:e.cronForm.deliveryChannel.trim()||"last",to:e.cronForm.deliveryTo.trim()||void 0}:void 0,i=e.cronForm.agentId.trim(),a={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:i||void 0,enabled:e.cronForm.enabled,schedule:t,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:n,delivery:s};if(!a.name)throw new Error("Name required.");await e.client.request("cron.add",a),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await ts(e),await ln(e)}catch(t){e.cronError=String(t)}finally{e.cronBusy=!1}}}async function md(e,t,n){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.update",{id:t.id,patch:{enabled:n}}),await ts(e),await ln(e)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function bd(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.run",{id:t.id,mode:"force"}),await Cr(e,t.id)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function yd(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.remove",{id:t.id}),e.cronRunsJobId===t.id&&(e.cronRunsJobId=null,e.cronRuns=[]),await ts(e),await ln(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function Cr(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("cron.runs",{id:t,limit:50});e.cronRunsJobId=t,e.cronRuns=Array.isArray(n.entries)?n.entries:[]}catch(n){e.cronError=String(n)}}const Tr="openclaw.device.auth.v1";function Di(e){return e.trim()}function xd(e){if(!Array.isArray(e))return[];const t=new Set;for(const n of e){const s=n.trim();s&&t.add(s)}return[...t].toSorted()}function Fi(){try{const e=window.localStorage.getItem(Tr);if(!e)return null;const t=JSON.parse(e);return!t||t.version!==1||!t.deviceId||typeof t.deviceId!="string"||!t.tokens||typeof t.tokens!="object"?null:t}catch{return null}}function _r(e){try{window.localStorage.setItem(Tr,JSON.stringify(e))}catch{}}function $d(e){const t=Fi();if(!t||t.deviceId!==e.deviceId)return null;const n=Di(e.role),s=t.tokens[n];return!s||typeof s.token!="string"?null:s}function Er(e){const t=Di(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},s=Fi();s&&s.deviceId===e.deviceId&&(n.tokens={...s.tokens});const i={token:e.token,role:t,scopes:xd(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=i,_r(n),i}function Lr(e){const t=Fi();if(!t||t.deviceId!==e.deviceId)return;const n=Di(e.role);if(!t.tokens[n])return;const s={...t,tokens:{...t.tokens}};delete s.tokens[n],_r(s)}const Mr={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:ue,n:Dn,Gx:qa,Gy:Ga,a:Ss,d:As,h:wd}=Mr,mt=32,Ni=64,kd=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},oe=(e="")=>{const t=new Error(e);throw kd(t,oe),t},Sd=e=>typeof e=="bigint",Ad=e=>typeof e=="string",Cd=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",Ze=(e,t,n="")=>{const s=Cd(e),i=e?.length,a=t!==void 0;if(!s||a&&i!==t){const o=n&&`"${n}" `,l=a?` of length ${t}`:"",c=s?`length=${i}`:`type=${typeof e}`;oe(o+"expected Uint8Array"+l+", got "+c)}return e},ns=e=>new Uint8Array(e),Ir=e=>Uint8Array.from(e),Rr=(e,t)=>e.toString(16).padStart(t,"0"),Pr=e=>Array.from(Ze(e)).map(t=>Rr(t,2)).join(""),He={_0:48,_9:57,A:65,F:70,a:97,f:102},Va=e=>{if(e>=He._0&&e<=He._9)return e-He._0;if(e>=He.A&&e<=He.F)return e-(He.A-10);if(e>=He.a&&e<=He.f)return e-(He.a-10)},Dr=e=>{const t="hex invalid";if(!Ad(e))return oe(t);const n=e.length,s=n/2;if(n%2)return oe(t);const i=ns(s);for(let a=0,o=0;a<s;a++,o+=2){const l=Va(e.charCodeAt(o)),c=Va(e.charCodeAt(o+1));if(l===void 0||c===void 0)return oe(t);i[a]=l*16+c}return i},Fr=()=>globalThis?.crypto,Td=()=>Fr()?.subtle??oe("crypto.subtle must be defined, consider polyfill"),nn=(...e)=>{const t=ns(e.reduce((s,i)=>s+Ze(i).length,0));let n=0;return e.forEach(s=>{t.set(s,n),n+=s.length}),t},_d=(e=mt)=>Fr().getRandomValues(ns(e)),Un=BigInt,rt=(e,t,n,s="bad number: out of range")=>Sd(e)&&t<=e&&e<n?e:oe(s),D=(e,t=ue)=>{const n=e%t;return n>=0n?n:t+n},Nr=e=>D(e,Dn),Ed=(e,t)=>{(e===0n||t<=0n)&&oe("no inverse n="+e+" mod="+t);let n=D(e,t),s=t,i=0n,a=1n;for(;n!==0n;){const o=s/n,l=s%n,c=i-a*o;s=n,n=l,i=a,a=c}return s===1n?D(i,t):oe("no inverse")},Ld=e=>{const t=zr[e];return typeof t!="function"&&oe("hashes."+e+" not set"),t},Cs=e=>e instanceof Se?e:oe("Point expected"),Ys=2n**256n;class Se{static BASE;static ZERO;X;Y;Z;T;constructor(t,n,s,i){const a=Ys;this.X=rt(t,0n,a),this.Y=rt(n,0n,a),this.Z=rt(s,1n,a),this.T=rt(i,0n,a),Object.freeze(this)}static CURVE(){return Mr}static fromAffine(t){return new Se(t.x,t.y,1n,D(t.x*t.y))}static fromBytes(t,n=!1){const s=As,i=Ir(Ze(t,mt)),a=t[31];i[31]=a&-129;const o=Br(i);rt(o,0n,n?Ys:ue);const c=D(o*o),u=D(c-1n),g=D(s*c+1n);let{isValid:p,value:h}=Id(u,g);p||oe("bad point: y not sqrt");const d=(h&1n)===1n,f=(a&128)!==0;return!n&&h===0n&&f&&oe("bad point: x==0, isLastByteOdd"),f!==d&&(h=D(-h)),new Se(h,o,1n,D(h*o))}static fromHex(t,n){return Se.fromBytes(Dr(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=Ss,n=As,s=this;if(s.is0())return oe("bad point: ZERO");const{X:i,Y:a,Z:o,T:l}=s,c=D(i*i),u=D(a*a),g=D(o*o),p=D(g*g),h=D(c*t),d=D(g*D(h+u)),f=D(p+D(n*D(c*u)));if(d!==f)return oe("bad point: equation left != right (1)");const m=D(i*a),S=D(o*l);return m!==S?oe("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:s,Z:i}=this,{X:a,Y:o,Z:l}=Cs(t),c=D(n*l),u=D(a*i),g=D(s*l),p=D(o*i);return c===u&&g===p}is0(){return this.equals(Et)}negate(){return new Se(D(-this.X),this.Y,this.Z,D(-this.T))}double(){const{X:t,Y:n,Z:s}=this,i=Ss,a=D(t*t),o=D(n*n),l=D(2n*D(s*s)),c=D(i*a),u=t+n,g=D(D(u*u)-a-o),p=c+o,h=p-l,d=c-o,f=D(g*h),m=D(p*d),S=D(g*d),k=D(h*p);return new Se(f,m,k,S)}add(t){const{X:n,Y:s,Z:i,T:a}=this,{X:o,Y:l,Z:c,T:u}=Cs(t),g=Ss,p=As,h=D(n*o),d=D(s*l),f=D(a*p*u),m=D(i*c),S=D((n+s)*(o+l)-h-d),k=D(m-f),$=D(m+f),A=D(d-g*h),C=D(S*k),_=D($*A),T=D(S*A),I=D(k*$);return new Se(C,_,I,T)}subtract(t){return this.add(Cs(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return Et;if(rt(t,1n,Dn),t===1n)return this;if(this.equals(bt))return jd(t).p;let s=Et,i=bt;for(let a=this;t>0n;a=a.double(),t>>=1n)t&1n?s=s.add(a):n&&(i=i.add(a));return s}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:s}=this;if(this.equals(Et))return{x:0n,y:1n};const i=Ed(s,ue);D(s*i)!==1n&&oe("invalid inverse");const a=D(t*i),o=D(n*i);return{x:a,y:o}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),s=Or(n);return s[31]|=t&1n?128:0,s}toHex(){return Pr(this.toBytes())}clearCofactor(){return this.multiply(Un(wd),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Dn/2n,!1).double();return Dn%2n&&(t=t.add(this)),t.is0()}}const bt=new Se(qa,Ga,1n,D(qa*Ga)),Et=new Se(0n,1n,1n,0n);Se.BASE=bt;Se.ZERO=Et;const Or=e=>Dr(Rr(rt(e,0n,Ys),Ni)).reverse(),Br=e=>Un("0x"+Pr(Ir(Ze(e)).reverse())),Re=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=ue;return n},Md=e=>{const n=e*e%ue*e%ue,s=Re(n,2n)*n%ue,i=Re(s,1n)*e%ue,a=Re(i,5n)*i%ue,o=Re(a,10n)*a%ue,l=Re(o,20n)*o%ue,c=Re(l,40n)*l%ue,u=Re(c,80n)*c%ue,g=Re(u,80n)*c%ue,p=Re(g,10n)*a%ue;return{pow_p_5_8:Re(p,2n)*e%ue,b2:n}},Qa=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,Id=(e,t)=>{const n=D(t*t*t),s=D(n*n*t),i=Md(e*s).pow_p_5_8;let a=D(e*n*i);const o=D(t*a*a),l=a,c=D(a*Qa),u=o===e,g=o===D(-e),p=o===D(-e*Qa);return u&&(a=l),(g||p)&&(a=c),(D(a)&1n)===1n&&(a=D(-a)),{isValid:u||g,value:a}},Js=e=>Nr(Br(e)),Oi=(...e)=>zr.sha512Async(nn(...e)),Rd=(...e)=>Ld("sha512")(nn(...e)),Ur=e=>{const t=e.slice(0,mt);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(mt,Ni),s=Js(t),i=bt.multiply(s),a=i.toBytes();return{head:t,prefix:n,scalar:s,point:i,pointBytes:a}},Bi=e=>Oi(Ze(e,mt)).then(Ur),Pd=e=>Ur(Rd(Ze(e,mt))),Dd=e=>Bi(e).then(t=>t.pointBytes),Fd=e=>Oi(e.hashable).then(e.finish),Nd=(e,t,n)=>{const{pointBytes:s,scalar:i}=e,a=Js(t),o=bt.multiply(a).toBytes();return{hashable:nn(o,s,n),finish:u=>{const g=Nr(a+Js(u)*i);return Ze(nn(o,Or(g)),Ni)}}},Od=async(e,t)=>{const n=Ze(e),s=await Bi(t),i=await Oi(s.prefix,n);return Fd(Nd(s,i,n))},zr={sha512Async:async e=>{const t=Td(),n=nn(e);return ns(await t.digest("SHA-512",n.buffer))},sha512:void 0},Bd=(e=_d(mt))=>e,Ud={getExtendedPublicKeyAsync:Bi,getExtendedPublicKey:Pd,randomSecretKey:Bd},zn=8,zd=256,Hr=Math.ceil(zd/zn)+1,Zs=2**(zn-1),Hd=()=>{const e=[];let t=bt,n=t;for(let s=0;s<Hr;s++){n=t,e.push(n);for(let i=1;i<Zs;i++)n=n.add(t),e.push(n);t=n.double()}return e};let Ya;const Ja=(e,t)=>{const n=t.negate();return e?n:t},jd=e=>{const t=Ya||(Ya=Hd());let n=Et,s=bt;const i=2**zn,a=i,o=Un(i-1),l=Un(zn);for(let c=0;c<Hr;c++){let u=Number(e&o);e>>=l,u>Zs&&(u-=a,e+=1n);const g=c*Zs,p=g,h=g+Math.abs(u)-1,d=c%2!==0,f=u<0;u===0?s=s.add(Ja(d,t[p])):n=n.add(Ja(f,t[h]))}return e!==0n&&oe("invalid wnaf"),{p:n,f:s}},Ts="openclaw-device-identity-v1";function Xs(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/g,"")}function jr(e){const t=e.replaceAll("-","+").replaceAll("_","/"),n=t+"=".repeat((4-t.length%4)%4),s=atob(n),i=new Uint8Array(s.length);for(let a=0;a<s.length;a+=1)i[a]=s.charCodeAt(a);return i}function Kd(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Kr(e){const t=await crypto.subtle.digest("SHA-256",e.slice().buffer);return Kd(new Uint8Array(t))}async function Wd(){const e=Ud.randomSecretKey(),t=await Dd(e);return{deviceId:await Kr(t),publicKey:Xs(t),privateKey:Xs(e)}}async function Ui(){try{const n=localStorage.getItem(Ts);if(n){const s=JSON.parse(n);if(s?.version===1&&typeof s.deviceId=="string"&&typeof s.publicKey=="string"&&typeof s.privateKey=="string"){const i=await Kr(jr(s.publicKey));if(i!==s.deviceId){const a={...s,deviceId:i};return localStorage.setItem(Ts,JSON.stringify(a)),{deviceId:i,publicKey:s.publicKey,privateKey:s.privateKey}}return{deviceId:s.deviceId,publicKey:s.publicKey,privateKey:s.privateKey}}}}catch{}const e=await Wd(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(Ts,JSON.stringify(t)),e}async function qd(e,t){const n=jr(e),s=new TextEncoder().encode(t),i=await Od(s,n);return Xs(i)}async function Xe(e,t){if(!(!e.client||!e.connected)&&!e.devicesLoading){e.devicesLoading=!0,t?.quiet||(e.devicesError=null);try{const n=await e.client.request("device.pair.list",{});e.devicesList={pending:Array.isArray(n?.pending)?n.pending:[],paired:Array.isArray(n?.paired)?n.paired:[]}}catch(n){t?.quiet||(e.devicesError=String(n))}finally{e.devicesLoading=!1}}}async function Gd(e,t){if(!(!e.client||!e.connected))try{await e.client.request("device.pair.approve",{requestId:t}),await Xe(e)}catch(n){e.devicesError=String(n)}}async function Vd(e,t){if(!(!e.client||!e.connected||!window.confirm("Reject this device pairing request?")))try{await e.client.request("device.pair.reject",{requestId:t}),await Xe(e)}catch(s){e.devicesError=String(s)}}async function Qd(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("device.token.rotate",t);if(n?.token){const s=await Ui(),i=n.role??t.role;(n.deviceId===s.deviceId||t.deviceId===s.deviceId)&&Er({deviceId:s.deviceId,role:i,token:n.token,scopes:n.scopes??t.scopes??[]}),window.prompt("New device token (copy and store securely):",n.token)}await Xe(e)}catch(n){e.devicesError=String(n)}}async function Yd(e,t){if(!(!e.client||!e.connected||!window.confirm(`Revoke token for ${t.deviceId} (${t.role})?`)))try{await e.client.request("device.token.revoke",t);const s=await Ui();t.deviceId===s.deviceId&&Lr({deviceId:s.deviceId,role:t.role}),await Xe(e)}catch(s){e.devicesError=String(s)}}function Jd(e){if(!e||e.kind==="gateway")return{method:"exec.approvals.get",params:{}};const t=e.nodeId.trim();return t?{method:"exec.approvals.node.get",params:{nodeId:t}}:null}function Zd(e,t){if(!e||e.kind==="gateway")return{method:"exec.approvals.set",params:t};const n=e.nodeId.trim();return n?{method:"exec.approvals.node.set",params:{...t,nodeId:n}}:null}async function zi(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=Jd(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const s=await e.client.request(n.method,n.params);Xd(e,s)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function Xd(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=ht(t.file??{}))}async function eu(e,t){if(!(!e.client||!e.connected)){e.execApprovalsSaving=!0,e.lastError=null;try{const n=e.execApprovalsSnapshot?.hash;if(!n){e.lastError="Exec approvals hash missing; reload and retry.";return}const s=e.execApprovalsForm??e.execApprovalsSnapshot?.file??{},i=Zd(t,{file:s,baseHash:n});if(!i){e.lastError="Select a node before saving exec approvals.";return}await e.client.request(i.method,i.params),e.execApprovalsDirty=!1,await zi(e,t)}catch(n){e.lastError=String(n)}finally{e.execApprovalsSaving=!1}}}function tu(e,t,n){const s=ht(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});fr(s,t,n),e.execApprovalsForm=s,e.execApprovalsDirty=!0}function nu(e,t){const n=ht(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});hr(n,t),e.execApprovalsForm=n,e.execApprovalsDirty=!0}async function Hi(e){if(!(!e.client||!e.connected)&&!e.presenceLoading){e.presenceLoading=!0,e.presenceError=null,e.presenceStatus=null;try{const t=await e.client.request("system-presence",{});Array.isArray(t)?(e.presenceEntries=t,e.presenceStatus=t.length===0?"No instances yet.":null):(e.presenceEntries=[],e.presenceStatus="No presence payload.")}catch(t){e.presenceError=String(t)}finally{e.presenceLoading=!1}}}async function xt(e,t){if(!(!e.client||!e.connected)&&!e.sessionsLoading){e.sessionsLoading=!0,e.sessionsError=null;try{const n=t?.includeGlobal??e.sessionsIncludeGlobal,s=t?.includeUnknown??e.sessionsIncludeUnknown,i=t?.activeMinutes??Bn(e.sessionsFilterActive,0),a=t?.limit??Bn(e.sessionsFilterLimit,0),o={includeGlobal:n,includeUnknown:s};i>0&&(o.activeMinutes=i),a>0&&(o.limit=a);const l=await e.client.request("sessions.list",o);l&&(e.sessionsResult=l)}catch(n){e.sessionsError=String(n)}finally{e.sessionsLoading=!1}}}async function su(e,t,n){if(!e.client||!e.connected)return;const s={key:t};"label"in n&&(s.label=n.label),"thinkingLevel"in n&&(s.thinkingLevel=n.thinkingLevel),"verboseLevel"in n&&(s.verboseLevel=n.verboseLevel),"reasoningLevel"in n&&(s.reasoningLevel=n.reasoningLevel);try{await e.client.request("sessions.patch",s),await xt(e)}catch(i){e.sessionsError=String(i)}}async function iu(e,t){if(!(!e.client||!e.connected||e.sessionsLoading||!window.confirm(`Delete session "${t}"?
127
127
 
128
- Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,e.sessionsError=null;try{await e.client.request("sessions.delete",{key:t,deleteTranscript:!0}),await bt(e)}catch(s){e.sessionsError=String(s)}finally{e.sessionsLoading=!1}}}function Mt(e,t,n){if(!t.trim())return;const s={...e.skillMessages};n?s[t]=n:delete s[t],e.skillMessages=s}function ts(e){return e instanceof Error?e.message:String(e)}async function rn(e,t){if(t?.clearMessages&&Object.keys(e.skillMessages).length>0&&(e.skillMessages={}),!(!e.client||!e.connected)&&!e.skillsLoading){e.skillsLoading=!0,e.skillsError=null;try{const n=await e.client.request("skills.status",{});n&&(e.skillsReport=n)}catch(n){e.skillsError=ts(n)}finally{e.skillsLoading=!1}}}function Qd(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function Yd(e,t,n){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{await e.client.request("skills.update",{skillKey:t,enabled:n}),await rn(e),Mt(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(s){const i=ts(s);e.skillsError=i,Mt(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function Jd(e,t){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const n=e.skillEdits[t]??"";await e.client.request("skills.update",{skillKey:t,apiKey:n}),await rn(e),Mt(e,t,{kind:"success",message:"API key saved"})}catch(n){const s=ts(n);e.skillsError=s,Mt(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function Zd(e,t,n,s){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const i=await e.client.request("skills.install",{name:n,installId:s,timeoutMs:12e4});await rn(e),Mt(e,t,{kind:"success",message:i?.message??"Installed"})}catch(i){const a=ts(i);e.skillsError=a,Mt(e,t,{kind:"error",message:a})}finally{e.skillsBusyKey=null}}}const Xd=[{label:"Chat",tabs:["chat"]},{label:"Control",tabs:["overview","channels","instances","sessions","usage","cron"]},{label:"Agent",tabs:["agents","skills","nodes"]},{label:"Settings",tabs:["config","debug","logs"]}],Ur={agents:"/agents",overview:"/overview",channels:"/channels",instances:"/instances",sessions:"/sessions",usage:"/usage",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",config:"/config",debug:"/debug",logs:"/logs"},zr=new Map(Object.entries(Ur).map(([e,t])=>[t,e]));function ln(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function tn(e){if(!e)return"/";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t}function ns(e,t=""){const n=ln(t),s=Ur[e];return n?`${n}${s}`:s}function Hr(e,t=""){const n=ln(t);let s=e||"/";n&&(s===n?s="/":s.startsWith(`${n}/`)&&(s=s.slice(n.length)));let i=tn(s).toLowerCase();return i.endsWith("/index.html")&&(i="/"),i==="/"?"chat":zr.get(i)??null}function eu(e){let t=tn(e);if(t.endsWith("/index.html")&&(t=tn(t.slice(0,-11))),t==="/")return"";const n=t.split("/").filter(Boolean);if(n.length===0)return"";for(let s=0;s<n.length;s++){const i=`/${n.slice(s).join("/")}`.toLowerCase();if(zr.has(i)){const a=n.slice(0,s);return a.length?`/${a.join("/")}`:""}}return`/${n.join("/")}`}function tu(e){switch(e){case"agents":return"folder";case"chat":return"messageSquare";case"overview":return"barChart";case"channels":return"link";case"instances":return"radio";case"sessions":return"fileText";case"usage":return"barChart";case"cron":return"loader";case"skills":return"zap";case"nodes":return"monitor";case"config":return"settings";case"debug":return"bug";case"logs":return"scrollText";default:return"folder"}}function ei(e){switch(e){case"agents":return"Agents";case"overview":return"Overview";case"channels":return"Channels";case"instances":return"Instances";case"sessions":return"Sessions";case"usage":return"Usage";case"cron":return"Cron Jobs";case"skills":return"Skills";case"nodes":return"Nodes";case"chat":return"Chat";case"config":return"Config";case"debug":return"Debug";case"logs":return"Logs";default:return"Control"}}function nu(e){switch(e){case"agents":return"Manage agent workspaces, tools, and identities.";case"overview":return"Gateway status, entry points, and a fast health read.";case"channels":return"Manage channels and settings.";case"instances":return"Presence beacons from connected clients and nodes.";case"sessions":return"Inspect active sessions and adjust per-session defaults.";case"usage":return"";case"cron":return"Schedule wakeups and recurring agent runs.";case"skills":return"Manage skill availability and API key injection.";case"nodes":return"Paired devices, capabilities, and command exposure.";case"chat":return"Direct gateway chat session for quick interventions.";case"config":return"Edit ~/.openclaw/openclaw.json safely.";case"debug":return"Gateway snapshots, events, and manual RPC calls.";case"logs":return"Live tail of the gateway file logs.";default:return""}}const jr="openclaw.control.settings.v1";function su(){const t={gatewayUrl:`${location.protocol==="https:"?"wss":"ws"}://${location.host}`,token:"",sessionKey:"main",lastActiveSessionKey:"main",theme:"system",chatFocusMode:!1,chatShowThinking:!0,splitRatio:.6,navCollapsed:!1,navGroupsCollapsed:{}};try{const n=localStorage.getItem(jr);if(!n)return t;const s=JSON.parse(n);return{gatewayUrl:typeof s.gatewayUrl=="string"&&s.gatewayUrl.trim()?s.gatewayUrl.trim():t.gatewayUrl,token:typeof s.token=="string"?s.token:t.token,sessionKey:typeof s.sessionKey=="string"&&s.sessionKey.trim()?s.sessionKey.trim():t.sessionKey,lastActiveSessionKey:typeof s.lastActiveSessionKey=="string"&&s.lastActiveSessionKey.trim()?s.lastActiveSessionKey.trim():typeof s.sessionKey=="string"&&s.sessionKey.trim()||t.lastActiveSessionKey,theme:s.theme==="light"||s.theme==="dark"||s.theme==="system"?s.theme:t.theme,chatFocusMode:typeof s.chatFocusMode=="boolean"?s.chatFocusMode:t.chatFocusMode,chatShowThinking:typeof s.chatShowThinking=="boolean"?s.chatShowThinking:t.chatShowThinking,splitRatio:typeof s.splitRatio=="number"&&s.splitRatio>=.4&&s.splitRatio<=.7?s.splitRatio:t.splitRatio,navCollapsed:typeof s.navCollapsed=="boolean"?s.navCollapsed:t.navCollapsed,navGroupsCollapsed:typeof s.navGroupsCollapsed=="object"&&s.navGroupsCollapsed!==null?s.navGroupsCollapsed:t.navGroupsCollapsed}}catch{return t}}function iu(e){localStorage.setItem(jr,JSON.stringify(e))}const yn=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,au=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,xn=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},ou=({nextTheme:e,applyTheme:t,context:n,currentTheme:s})=>{if(s===e)return;const i=globalThis.document??null;if(!i){t();return}const a=i.documentElement,o=i,l=au();if(!!o.startViewTransition&&!l){let u=.5,g=.5;if(n?.pointerClientX!==void 0&&n?.pointerClientY!==void 0&&typeof window<"u")u=yn(n.pointerClientX/window.innerWidth),g=yn(n.pointerClientY/window.innerHeight);else if(n?.element){const p=n.element.getBoundingClientRect();p.width>0&&p.height>0&&typeof window<"u"&&(u=yn((p.left+p.width/2)/window.innerWidth),g=yn((p.top+p.height/2)/window.innerHeight))}a.style.setProperty("--theme-switch-x",`${u*100}%`),a.style.setProperty("--theme-switch-y",`${g*100}%`),a.classList.add("theme-transition");try{const p=o.startViewTransition?.(()=>{t()});p?.finished?p.finished.finally(()=>xn(a)):xn(a)}catch{xn(a),t()}return}t(),xn(a)};function ru(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Hi(e){return e==="system"?ru():e}function Ye(e,t){const n={...t,lastActiveSessionKey:t.lastActiveSessionKey?.trim()||t.sessionKey.trim()||"main"};e.settings=n,iu(n),t.theme!==e.theme&&(e.theme=t.theme,ss(e,Hi(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function Kr(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&Ye(e,{...e.settings,lastActiveSessionKey:n})}function lu(e){if(!window.location.search&&!window.location.hash)return;const t=new URL(window.location.href),n=new URLSearchParams(t.search),s=new URLSearchParams(t.hash.startsWith("#")?t.hash.slice(1):t.hash),i=n.get("token")??s.get("token"),a=n.get("password")??s.get("password"),o=n.get("session")??s.get("session"),l=n.get("gatewayUrl")??s.get("gatewayUrl");let c=!1;if(i!=null){const g=i.trim();g&&g!==e.settings.token&&Ye(e,{...e.settings,token:g}),n.delete("token"),s.delete("token"),c=!0}if(a!=null){const g=a.trim();g&&(e.password=g),n.delete("password"),s.delete("password"),c=!0}if(o!=null){const g=o.trim();g&&(e.sessionKey=g,Ye(e,{...e.settings,sessionKey:g,lastActiveSessionKey:g}))}if(l!=null){const g=l.trim();g&&g!==e.settings.gatewayUrl&&(e.pendingGatewayUrl=g),n.delete("gatewayUrl"),s.delete("gatewayUrl"),c=!0}if(!c)return;t.search=n.toString();const u=s.toString();t.hash=u?`#${u}`:"",window.history.replaceState({},"",t.toString())}function cu(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?Ti(e):_i(e),t==="debug"?Ei(e):Li(e),ji(e),qr(e,t,!1)}function du(e,t,n){ou({nextTheme:t,applyTheme:()=>{e.theme=t,Ye(e,{...e.settings,theme:t}),ss(e,Hi(t))},context:n,currentTheme:e.theme})}async function ji(e){if(e.tab==="overview"&&await Gr(e),e.tab==="channels"&&await bu(e),e.tab==="instances"&&await zi(e),e.tab==="sessions"&&await bt(e),e.tab==="cron"&&await Un(e),e.tab==="skills"&&await rn(e),e.tab==="agents"){await Mi(e),await Ee(e);const t=e.agentsList?.agents?.map(s=>s.id)??[];t.length>0&&yr(e,t);const n=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id;n&&(br(e,n),e.agentsPanel==="skills"&&In(e,n),e.agentsPanel==="channels"&&ye(e,!1),e.agentsPanel==="cron"&&Un(e))}e.tab==="nodes"&&(await Zn(e),await Ze(e),await Ee(e),await Ui(e)),e.tab==="chat"&&(await el(e),an(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await pr(e),await Ee(e)),e.tab==="debug"&&(await Jn(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"&&(e.logsAtBottom=!0,await Ci(e,{reset:!0}),mr(e,!0))}function uu(){if(typeof window>"u")return"";const e=window.__OPENCLAW_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?ln(e):eu(window.location.pathname)}function gu(e){e.theme=e.settings.theme??"system",ss(e,Hi(e.theme))}function ss(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function pu(e){if(typeof window>"u"||typeof window.matchMedia!="function")return;if(e.themeMedia=window.matchMedia("(prefers-color-scheme: dark)"),e.themeMediaHandler=n=>{e.theme==="system"&&ss(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function fu(e){if(!e.themeMedia||!e.themeMediaHandler)return;if(typeof e.themeMedia.removeEventListener=="function"){e.themeMedia.removeEventListener("change",e.themeMediaHandler);return}e.themeMedia.removeListener(e.themeMediaHandler),e.themeMedia=null,e.themeMediaHandler=null}function hu(e,t){if(typeof window>"u")return;const n=Hr(window.location.pathname,e.basePath)??"chat";Wr(e,n),qr(e,n,t)}function vu(e){if(typeof window>"u")return;const t=Hr(window.location.pathname,e.basePath);if(!t)return;const s=new URL(window.location.href).searchParams.get("session")?.trim();s&&(e.sessionKey=s,Ye(e,{...e.settings,sessionKey:s,lastActiveSessionKey:s})),Wr(e,t)}function Wr(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?Ti(e):_i(e),t==="debug"?Ei(e):Li(e),e.connected&&ji(e)}function qr(e,t,n){if(typeof window>"u")return;const s=tn(ns(t,e.basePath)),i=tn(window.location.pathname),a=new URL(window.location.href);t==="chat"&&e.sessionKey?a.searchParams.set("session",e.sessionKey):a.searchParams.delete("session"),i!==s&&(a.pathname=s),n?window.history.replaceState({},"",a.toString()):window.history.pushState({},"",a.toString())}function mu(e,t,n){if(typeof window>"u")return;const s=new URL(window.location.href);s.searchParams.set("session",t),window.history.replaceState({},"",s.toString())}async function Gr(e){await Promise.all([ye(e,!1),zi(e),bt(e),on(e),Jn(e)])}async function bu(e){await Promise.all([ye(e,!0),pr(e),Ee(e)])}async function Un(e){await Promise.all([ye(e,!1),on(e),Xn(e)])}const Qa=50,yu=80,xu=12e4;function $u(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.text=="string")return t.text;const n=t.content;if(!Array.isArray(n))return null;const s=n.map(i=>{if(!i||typeof i!="object")return null;const a=i;return a.type==="text"&&typeof a.text=="string"?a.text:null}).filter(i=>!!i);return s.length===0?null:s.join(`
129
- `)}function Ya(e){if(e==null)return null;if(typeof e=="number"||typeof e=="boolean")return String(e);const t=$u(e);let n;if(typeof e=="string")n=e;else if(t)n=t;else try{n=JSON.stringify(e,null,2)}catch{n=String(e)}const s=xr(n,xu);return s.truncated?`${s.text}
128
+ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,e.sessionsError=null;try{await e.client.request("sessions.delete",{key:t,deleteTranscript:!0}),await xt(e)}catch(s){e.sessionsError=String(s)}finally{e.sessionsLoading=!1}}}function It(e,t,n){if(!t.trim())return;const s={...e.skillMessages};n?s[t]=n:delete s[t],e.skillMessages=s}function ss(e){return e instanceof Error?e.message:String(e)}async function cn(e,t){if(t?.clearMessages&&Object.keys(e.skillMessages).length>0&&(e.skillMessages={}),!(!e.client||!e.connected)&&!e.skillsLoading){e.skillsLoading=!0,e.skillsError=null;try{const n=await e.client.request("skills.status",{});n&&(e.skillsReport=n)}catch(n){e.skillsError=ss(n)}finally{e.skillsLoading=!1}}}function au(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function ou(e,t,n){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{await e.client.request("skills.update",{skillKey:t,enabled:n}),await cn(e),It(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(s){const i=ss(s);e.skillsError=i,It(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function ru(e,t){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const n=e.skillEdits[t]??"";await e.client.request("skills.update",{skillKey:t,apiKey:n}),await cn(e),It(e,t,{kind:"success",message:"API key saved"})}catch(n){const s=ss(n);e.skillsError=s,It(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function lu(e,t,n,s){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const i=await e.client.request("skills.install",{name:n,installId:s,timeoutMs:12e4});await cn(e),It(e,t,{kind:"success",message:i?.message??"Installed"})}catch(i){const a=ss(i);e.skillsError=a,It(e,t,{kind:"error",message:a})}finally{e.skillsBusyKey=null}}}const cu=[{label:"Chat",tabs:["chat"]},{label:"Control",tabs:["overview","channels","instances","sessions","usage","cron"]},{label:"Agent",tabs:["agents","skills","nodes"]},{label:"Settings",tabs:["config","debug","logs"]}],Wr={agents:"/agents",overview:"/overview",channels:"/channels",instances:"/instances",sessions:"/sessions",usage:"/usage",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",config:"/config",debug:"/debug",logs:"/logs"},qr=new Map(Object.entries(Wr).map(([e,t])=>[t,e]));function dn(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function sn(e){if(!e)return"/";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t}function is(e,t=""){const n=dn(t),s=Wr[e];return n?`${n}${s}`:s}function Gr(e,t=""){const n=dn(t);let s=e||"/";n&&(s===n?s="/":s.startsWith(`${n}/`)&&(s=s.slice(n.length)));let i=sn(s).toLowerCase();return i.endsWith("/index.html")&&(i="/"),i==="/"?"chat":qr.get(i)??null}function du(e){let t=sn(e);if(t.endsWith("/index.html")&&(t=sn(t.slice(0,-11))),t==="/")return"";const n=t.split("/").filter(Boolean);if(n.length===0)return"";for(let s=0;s<n.length;s++){const i=`/${n.slice(s).join("/")}`.toLowerCase();if(qr.has(i)){const a=n.slice(0,s);return a.length?`/${a.join("/")}`:""}}return`/${n.join("/")}`}function uu(e){switch(e){case"agents":return"folder";case"chat":return"messageSquare";case"overview":return"barChart";case"channels":return"link";case"instances":return"radio";case"sessions":return"fileText";case"usage":return"barChart";case"cron":return"loader";case"skills":return"zap";case"nodes":return"monitor";case"config":return"settings";case"debug":return"bug";case"logs":return"scrollText";default:return"folder"}}function ei(e){switch(e){case"agents":return"Agents";case"overview":return"Overview";case"channels":return"Channels";case"instances":return"Instances";case"sessions":return"Sessions";case"usage":return"Usage";case"cron":return"Cron Jobs";case"skills":return"Skills";case"nodes":return"Nodes";case"chat":return"Chat";case"config":return"Config";case"debug":return"Debug";case"logs":return"Logs";default:return"Control"}}function gu(e){switch(e){case"agents":return"Manage agent workspaces, tools, and identities.";case"overview":return"Gateway status, entry points, and a fast health read.";case"channels":return"Manage channels and settings.";case"instances":return"Presence beacons from connected clients and nodes.";case"sessions":return"Inspect active sessions and adjust per-session defaults.";case"usage":return"";case"cron":return"Schedule wakeups and recurring agent runs.";case"skills":return"Manage skill availability and API key injection.";case"nodes":return"Paired devices, capabilities, and command exposure.";case"chat":return"Direct gateway chat session for quick interventions.";case"config":return"Edit ~/.openclaw/openclaw.json safely.";case"debug":return"Gateway snapshots, events, and manual RPC calls.";case"logs":return"Live tail of the gateway file logs.";default:return""}}const Vr="openclaw.control.settings.v1";function pu(){const t={gatewayUrl:`${location.protocol==="https:"?"wss":"ws"}://${location.host}`,token:"",sessionKey:"main",lastActiveSessionKey:"main",theme:"system",chatFocusMode:!1,chatShowThinking:!0,splitRatio:.6,navCollapsed:!1,navGroupsCollapsed:{}};try{const n=localStorage.getItem(Vr);if(!n)return t;const s=JSON.parse(n);return{gatewayUrl:typeof s.gatewayUrl=="string"&&s.gatewayUrl.trim()?s.gatewayUrl.trim():t.gatewayUrl,token:typeof s.token=="string"?s.token:t.token,sessionKey:typeof s.sessionKey=="string"&&s.sessionKey.trim()?s.sessionKey.trim():t.sessionKey,lastActiveSessionKey:typeof s.lastActiveSessionKey=="string"&&s.lastActiveSessionKey.trim()?s.lastActiveSessionKey.trim():typeof s.sessionKey=="string"&&s.sessionKey.trim()||t.lastActiveSessionKey,theme:s.theme==="light"||s.theme==="dark"||s.theme==="system"?s.theme:t.theme,chatFocusMode:typeof s.chatFocusMode=="boolean"?s.chatFocusMode:t.chatFocusMode,chatShowThinking:typeof s.chatShowThinking=="boolean"?s.chatShowThinking:t.chatShowThinking,splitRatio:typeof s.splitRatio=="number"&&s.splitRatio>=.4&&s.splitRatio<=.7?s.splitRatio:t.splitRatio,navCollapsed:typeof s.navCollapsed=="boolean"?s.navCollapsed:t.navCollapsed,navGroupsCollapsed:typeof s.navGroupsCollapsed=="object"&&s.navGroupsCollapsed!==null?s.navGroupsCollapsed:t.navGroupsCollapsed}}catch{return t}}function fu(e){localStorage.setItem(Vr,JSON.stringify(e))}const $n=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,hu=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,wn=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},vu=({nextTheme:e,applyTheme:t,context:n,currentTheme:s})=>{if(s===e)return;const i=globalThis.document??null;if(!i){t();return}const a=i.documentElement,o=i,l=hu();if(!!o.startViewTransition&&!l){let u=.5,g=.5;if(n?.pointerClientX!==void 0&&n?.pointerClientY!==void 0&&typeof window<"u")u=$n(n.pointerClientX/window.innerWidth),g=$n(n.pointerClientY/window.innerHeight);else if(n?.element){const p=n.element.getBoundingClientRect();p.width>0&&p.height>0&&typeof window<"u"&&(u=$n((p.left+p.width/2)/window.innerWidth),g=$n((p.top+p.height/2)/window.innerHeight))}a.style.setProperty("--theme-switch-x",`${u*100}%`),a.style.setProperty("--theme-switch-y",`${g*100}%`),a.classList.add("theme-transition");try{const p=o.startViewTransition?.(()=>{t()});p?.finished?p.finished.finally(()=>wn(a)):wn(a)}catch{wn(a),t()}return}t(),wn(a)};function mu(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function ji(e){return e==="system"?mu():e}function Je(e,t){const n={...t,lastActiveSessionKey:t.lastActiveSessionKey?.trim()||t.sessionKey.trim()||"main"};e.settings=n,fu(n),t.theme!==e.theme&&(e.theme=t.theme,as(e,ji(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function Qr(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&Je(e,{...e.settings,lastActiveSessionKey:n})}function bu(e){if(!window.location.search&&!window.location.hash)return;const t=new URL(window.location.href),n=new URLSearchParams(t.search),s=new URLSearchParams(t.hash.startsWith("#")?t.hash.slice(1):t.hash),i=n.get("token")??s.get("token"),a=n.get("password")??s.get("password"),o=n.get("session")??s.get("session"),l=n.get("gatewayUrl")??s.get("gatewayUrl");let c=!1;if(i!=null){const g=i.trim();g&&g!==e.settings.token&&Je(e,{...e.settings,token:g}),n.delete("token"),s.delete("token"),c=!0}if(a!=null){const g=a.trim();g&&(e.password=g),n.delete("password"),s.delete("password"),c=!0}if(o!=null){const g=o.trim();g&&(e.sessionKey=g,Je(e,{...e.settings,sessionKey:g,lastActiveSessionKey:g}))}if(l!=null){const g=l.trim();g&&g!==e.settings.gatewayUrl&&(e.pendingGatewayUrl=g),n.delete("gatewayUrl"),s.delete("gatewayUrl"),c=!0}if(!c)return;t.search=n.toString();const u=s.toString();t.hash=u?`#${u}`:"",window.history.replaceState({},"",t.toString())}function yu(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?_i(e):Ei(e),t==="debug"?Li(e):Mi(e),Ki(e),Jr(e,t,!1)}function xu(e,t,n){vu({nextTheme:t,applyTheme:()=>{e.theme=t,Je(e,{...e.settings,theme:t}),as(e,ji(t))},context:n,currentTheme:e.theme})}async function Ki(e){if(e.tab==="overview"&&await Zr(e),e.tab==="channels"&&await _u(e),e.tab==="instances"&&await Hi(e),e.tab==="sessions"&&await xt(e),e.tab==="cron"&&await Hn(e),e.tab==="skills"&&await cn(e),e.tab==="agents"){await Ii(e),await Le(e);const t=e.agentsList?.agents?.map(s=>s.id)??[];t.length>0&&Sr(e,t);const n=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id;n&&(kr(e,n),e.agentsPanel==="skills"&&Pn(e,n),e.agentsPanel==="channels"&&ye(e,!1),e.agentsPanel==="cron"&&Hn(e))}e.tab==="nodes"&&(await es(e),await Xe(e),await Le(e),await zi(e)),e.tab==="chat"&&(await al(e),rn(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await vr(e),await Le(e)),e.tab==="debug"&&(await Xn(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"&&(e.logsAtBottom=!0,await Ti(e,{reset:!0}),wr(e,!0))}function $u(){if(typeof window>"u")return"";const e=window.__OPENCLAW_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?dn(e):du(window.location.pathname)}function wu(e){e.theme=e.settings.theme??"system",as(e,ji(e.theme))}function as(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function ku(e){if(typeof window>"u"||typeof window.matchMedia!="function")return;if(e.themeMedia=window.matchMedia("(prefers-color-scheme: dark)"),e.themeMediaHandler=n=>{e.theme==="system"&&as(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function Su(e){if(!e.themeMedia||!e.themeMediaHandler)return;if(typeof e.themeMedia.removeEventListener=="function"){e.themeMedia.removeEventListener("change",e.themeMediaHandler);return}e.themeMedia.removeListener(e.themeMediaHandler),e.themeMedia=null,e.themeMediaHandler=null}function Au(e,t){if(typeof window>"u")return;const n=Gr(window.location.pathname,e.basePath)??"chat";Yr(e,n),Jr(e,n,t)}function Cu(e){if(typeof window>"u")return;const t=Gr(window.location.pathname,e.basePath);if(!t)return;const s=new URL(window.location.href).searchParams.get("session")?.trim();s&&(e.sessionKey=s,Je(e,{...e.settings,sessionKey:s,lastActiveSessionKey:s})),Yr(e,t)}function Yr(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?_i(e):Ei(e),t==="debug"?Li(e):Mi(e),e.connected&&Ki(e)}function Jr(e,t,n){if(typeof window>"u")return;const s=sn(is(t,e.basePath)),i=sn(window.location.pathname),a=new URL(window.location.href);t==="chat"&&e.sessionKey?a.searchParams.set("session",e.sessionKey):a.searchParams.delete("session"),i!==s&&(a.pathname=s),n?window.history.replaceState({},"",a.toString()):window.history.pushState({},"",a.toString())}function Tu(e,t,n){if(typeof window>"u")return;const s=new URL(window.location.href);s.searchParams.set("session",t),window.history.replaceState({},"",s.toString())}async function Zr(e){await Promise.all([ye(e,!1),Hi(e),xt(e),ln(e),Xn(e)])}async function _u(e){await Promise.all([ye(e,!0),vr(e),Le(e)])}async function Hn(e){await Promise.all([ye(e,!1),ln(e),ts(e)])}const Za=50,Eu=80,Lu=12e4;function Mu(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.text=="string")return t.text;const n=t.content;if(!Array.isArray(n))return null;const s=n.map(i=>{if(!i||typeof i!="object")return null;const a=i;return a.type==="text"&&typeof a.text=="string"?a.text:null}).filter(i=>!!i);return s.length===0?null:s.join(`
129
+ `)}function Xa(e){if(e==null)return null;if(typeof e=="number"||typeof e=="boolean")return String(e);const t=Mu(e);let n;if(typeof e=="string")n=e;else if(t)n=t;else try{n=JSON.stringify(e,null,2)}catch{n=String(e)}const s=Ar(n,Lu);return s.truncated?`${s.text}
130
130
 
131
- … truncated (${s.total} chars, showing first ${s.text.length}).`:s.text}function wu(e){const t=[];return t.push({type:"toolcall",name:e.name,arguments:e.args??{}}),e.output&&t.push({type:"toolresult",name:e.name,text:e.output}),{role:"assistant",toolCallId:e.toolCallId,runId:e.runId,content:t,timestamp:e.startedAt}}function ku(e){if(e.toolStreamOrder.length<=Qa)return;const t=e.toolStreamOrder.length-Qa,n=e.toolStreamOrder.splice(0,t);for(const s of n)e.toolStreamById.delete(s)}function Su(e){e.chatToolMessages=e.toolStreamOrder.map(t=>e.toolStreamById.get(t)?.message).filter(t=>!!t)}function ti(e){e.toolStreamSyncTimer!=null&&(clearTimeout(e.toolStreamSyncTimer),e.toolStreamSyncTimer=null),Su(e)}function Au(e,t=!1){if(t){ti(e);return}e.toolStreamSyncTimer==null&&(e.toolStreamSyncTimer=window.setTimeout(()=>ti(e),yu))}function is(e){e.toolStreamById.clear(),e.toolStreamOrder=[],e.chatToolMessages=[],ti(e)}const Cu=5e3;function Tu(e,t){const n=t.data??{},s=typeof n.phase=="string"?n.phase:"";e.compactionClearTimer!=null&&(window.clearTimeout(e.compactionClearTimer),e.compactionClearTimer=null),s==="start"?e.compactionStatus={active:!0,startedAt:Date.now(),completedAt:null}:s==="end"&&(e.compactionStatus={active:!1,startedAt:e.compactionStatus?.startedAt??null,completedAt:Date.now()},e.compactionClearTimer=window.setTimeout(()=>{e.compactionStatus=null,e.compactionClearTimer=null},Cu))}function _u(e,t){if(!t)return;if(t.stream==="compaction"){Tu(e,t);return}if(t.stream!=="tool")return;const n=typeof t.sessionKey=="string"?t.sessionKey:void 0;if(n&&n!==e.sessionKey||!n&&e.chatRunId&&t.runId!==e.chatRunId||e.chatRunId&&t.runId!==e.chatRunId||!e.chatRunId)return;const s=t.data??{},i=typeof s.toolCallId=="string"?s.toolCallId:"";if(!i)return;const a=typeof s.name=="string"?s.name:"tool",o=typeof s.phase=="string"?s.phase:"",l=o==="start"?s.args:void 0,c=o==="update"?Ya(s.partialResult):o==="result"?Ya(s.result):void 0,u=Date.now();let g=e.toolStreamById.get(i);g?(g.name=a,l!==void 0&&(g.args=l),c!==void 0&&(g.output=c||void 0),g.updatedAt=u):(g={toolCallId:i,runId:t.runId,sessionKey:n,name:a,args:l,output:c||void 0,startedAt:typeof t.ts=="number"?t.ts:u,updatedAt:u,message:{}},e.toolStreamById.set(i,g),e.toolStreamOrder.push(i)),g.message=wu(g),ku(e),Au(e,o==="result")}const Eu=/^\[([^\]]+)\]\s*/,Lu=["WebChat","WhatsApp","Telegram","Signal","Slack","Discord","iMessage","Teams","Matrix","Zalo","Zalo Personal","BlueBubbles"],Ts=new WeakMap,_s=new WeakMap;function Mu(e){return/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}Z\b/.test(e)||/\d{4}-\d{2}-\d{2} \d{2}:\d{2}\b/.test(e)?!0:Lu.some(t=>e.startsWith(`${t} `))}function Es(e){const t=e.match(Eu);if(!t)return e;const n=t[1]??"";return Mu(n)?e.slice(t[0].length):e}function ni(e){const t=e,n=typeof t.role=="string"?t.role:"",s=t.content;if(typeof s=="string")return n==="assistant"?ws(s):Es(s);if(Array.isArray(s)){const i=s.map(a=>{const o=a;return o.type==="text"&&typeof o.text=="string"?o.text:null}).filter(a=>typeof a=="string");if(i.length>0){const a=i.join(`
132
- `);return n==="assistant"?ws(a):Es(a)}}return typeof t.text=="string"?n==="assistant"?ws(t.text):Es(t.text):null}function Vr(e){if(!e||typeof e!="object")return ni(e);const t=e;if(Ts.has(t))return Ts.get(t)??null;const n=ni(e);return Ts.set(t,n),n}function Ja(e){const n=e.content,s=[];if(Array.isArray(n))for(const l of n){const c=l;if(c.type==="thinking"&&typeof c.thinking=="string"){const u=c.thinking.trim();u&&s.push(u)}}if(s.length>0)return s.join(`
133
- `);const i=Ru(e);if(!i)return null;const o=[...i.matchAll(/<\s*think(?:ing)?\s*>([\s\S]*?)<\s*\/\s*think(?:ing)?\s*>/gi)].map(l=>(l[1]??"").trim()).filter(Boolean);return o.length>0?o.join(`
134
- `):null}function Iu(e){if(!e||typeof e!="object")return Ja(e);const t=e;if(_s.has(t))return _s.get(t)??null;const n=Ja(e);return _s.set(t,n),n}function Ru(e){const t=e,n=t.content;if(typeof n=="string")return n;if(Array.isArray(n)){const s=n.map(i=>{const a=i;return a.type==="text"&&typeof a.text=="string"?a.text:null}).filter(i=>typeof i=="string");if(s.length>0)return s.join(`
135
- `)}return typeof t.text=="string"?t.text:null}function Pu(e){const t=e.trim();if(!t)return"";const n=t.split(/\r?\n/).map(s=>s.trim()).filter(Boolean).map(s=>`_${s}_`);return n.length?["_Reasoning:_",...n].join(`
136
- `):""}let Za=!1;function Xa(e){e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<e.length;n++)t+=e[n].toString(16).padStart(2,"0");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function Du(){const e=new Uint8Array(16),t=Date.now();for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*256);return e[0]^=t&255,e[1]^=t>>>8&255,e[2]^=t>>>16&255,e[3]^=t>>>24&255,e}function Fu(){Za||(Za=!0,console.warn("[uuid] crypto API missing; falling back to weak randomness"))}function Ki(e=globalThis.crypto){if(e&&typeof e.randomUUID=="function")return e.randomUUID();if(e&&typeof e.getRandomValues=="function"){const t=new Uint8Array(16);return e.getRandomValues(t),Xa(t)}return Fu(),Xa(Du())}async function nn(e){if(!(!e.client||!e.connected)){e.chatLoading=!0,e.lastError=null;try{const t=await e.client.request("chat.history",{sessionKey:e.sessionKey,limit:200});e.chatMessages=Array.isArray(t.messages)?t.messages:[],e.chatThinkingLevel=t.thinkingLevel??null}catch(t){e.lastError=String(t)}finally{e.chatLoading=!1}}}function Nu(e){const t=/^data:([^;]+);base64,(.+)$/.exec(e);return t?{mimeType:t[1],content:t[2]}:null}async function Ou(e,t,n){if(!e.client||!e.connected)return null;const s=t.trim(),i=n&&n.length>0;if(!s&&!i)return null;const a=Date.now(),o=[];if(s&&o.push({type:"text",text:s}),i)for(const u of n)o.push({type:"image",source:{type:"base64",media_type:u.mimeType,data:u.dataUrl}});e.chatMessages=[...e.chatMessages,{role:"user",content:o,timestamp:a}],e.chatSending=!0,e.lastError=null;const l=Ki();e.chatRunId=l,e.chatStream="",e.chatStreamStartedAt=a;const c=i?n.map(u=>{const g=Nu(u.dataUrl);return g?{type:"image",mimeType:g.mimeType,content:g.content}:null}).filter(u=>u!==null):void 0;try{return await e.client.request("chat.send",{sessionKey:e.sessionKey,message:s,deliver:!1,idempotencyKey:l,attachments:c}),l}catch(u){const g=String(u);return e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,e.lastError=g,e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:"Error: "+g}],timestamp:Date.now()}],null}finally{e.chatSending=!1}}async function Bu(e){if(!e.client||!e.connected)return!1;const t=e.chatRunId;try{return await e.client.request("chat.abort",t?{sessionKey:e.sessionKey,runId:t}:{sessionKey:e.sessionKey}),!0}catch(n){return e.lastError=String(n),!1}}function Uu(e,t){if(!t||t.sessionKey!==e.sessionKey)return null;if(t.runId&&e.chatRunId&&t.runId!==e.chatRunId)return t.state==="final"?"final":null;if(t.state==="delta"){const n=ni(t.message);if(typeof n=="string"){const s=e.chatStream??"";(!s||n.length>=s.length)&&(e.chatStream=n)}}else t.state==="final"||t.state==="aborted"?(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null):t.state==="error"&&(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.lastError=t.errorMessage??"chat error");return t.state}const Qr=120;function Yr(e){return e.chatSending||!!e.chatRunId}function zu(e){const t=e.trim();if(!t)return!1;const n=t.toLowerCase();return n==="/stop"?!0:n==="stop"||n==="esc"||n==="abort"||n==="wait"||n==="exit"}function Hu(e){const t=e.trim();if(!t)return!1;const n=t.toLowerCase();return n==="/new"||n==="/reset"?!0:n.startsWith("/new ")||n.startsWith("/reset ")}async function Jr(e){e.connected&&(e.chatMessage="",await Bu(e))}function ju(e,t,n,s){const i=t.trim(),a=!!(n&&n.length>0);!i&&!a||(e.chatQueue=[...e.chatQueue,{id:Ki(),text:i,createdAt:Date.now(),attachments:a?n?.map(o=>({...o})):void 0,refreshSessions:s}])}async function Zr(e,t,n){is(e);const s=await Ou(e,t,n?.attachments),i=!!s;return!i&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!i&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),i&&Kr(e,e.sessionKey),i&&n?.restoreDraft&&n.previousDraft?.trim()&&(e.chatMessage=n.previousDraft),i&&n?.restoreAttachments&&n.previousAttachments?.length&&(e.chatAttachments=n.previousAttachments),an(e),i&&!e.chatRunId&&Xr(e),i&&n?.refreshSessions&&s&&e.refreshSessionsAfterChat.add(s),i}async function Xr(e){if(!e.connected||Yr(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await Zr(e,t.text,{attachments:t.attachments,refreshSessions:t.refreshSessions})||(e.chatQueue=[t,...e.chatQueue])}function Ku(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function Wu(e,t,n){if(!e.connected)return;const s=e.chatMessage,i=(t??e.chatMessage).trim(),a=e.chatAttachments??[],o=t==null?a:[],l=o.length>0;if(!i&&!l)return;if(zu(i)){await Jr(e);return}const c=Hu(i);if(t==null&&(e.chatMessage="",e.chatAttachments=[]),Yr(e)){ju(e,i,o,c);return}await Zr(e,i,{previousDraft:t==null?s:void 0,restoreDraft:!!(t&&n?.restoreDraft),attachments:l?o:void 0,previousAttachments:t==null?a:void 0,restoreAttachments:!!(t&&n?.restoreDraft),refreshSessions:c})}async function el(e,t){await Promise.all([nn(e),bt(e,{activeMinutes:Qr}),si(e)]),t?.scheduleScroll!==!1&&an(e)}const qu=Xr;function Gu(e){const t=vr(e.sessionKey);return t?.agentId?t.agentId:e.hello?.snapshot?.sessionDefaults?.defaultAgentId?.trim()||"main"}function Vu(e,t){const n=ln(e),s=encodeURIComponent(t);return n?`${n}/avatar/${s}?meta=1`:`/avatar/${s}?meta=1`}async function si(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=Gu(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Vu(e.basePath,t);try{const s=await fetch(n,{method:"GET"});if(!s.ok){e.chatAvatarUrl=null;return}const i=await s.json(),a=typeof i.avatarUrl=="string"?i.avatarUrl.trim():"";e.chatAvatarUrl=a||null}catch{e.chatAvatarUrl=null}}const Qu={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},Yu={name:"",description:"",agentId:"",enabled:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",sessionTarget:"isolated",wakeMode:"now",payloadKind:"agentTurn",payloadText:"",deliveryMode:"announce",deliveryChannel:"last",deliveryTo:"",timeoutSeconds:""},Ju=50,Zu=200,Xu="Assistant";function eo(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}function ii(e){const t=eo(e?.name,Ju)??Xu,n=eo(e?.avatar??void 0,Zu)??null;return{agentId:typeof e?.agentId=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}function eg(){return ii(typeof window>"u"?{}:{name:window.__OPENCLAW_ASSISTANT_NAME__,avatar:window.__OPENCLAW_ASSISTANT_AVATAR__})}async function tl(e,t){if(!e.client||!e.connected)return;const n=e.sessionKey.trim(),s=n?{sessionKey:n}:{};try{const i=await e.client.request("agent.identity.get",s);if(!i)return;const a=ii(i);e.assistantName=a.name,e.assistantAvatar=a.avatar,e.assistantAgentId=a.agentId??null}catch{}}function ai(e){return typeof e=="object"&&e!==null}function tg(e){if(!ai(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!ai(n))return null;const s=typeof n.command=="string"?n.command.trim():"";if(!s)return null;const i=typeof e.createdAtMs=="number"?e.createdAtMs:0,a=typeof e.expiresAtMs=="number"?e.expiresAtMs:0;return!i||!a?null:{id:t,request:{command:s,cwd:typeof n.cwd=="string"?n.cwd:null,host:typeof n.host=="string"?n.host:null,security:typeof n.security=="string"?n.security:null,ask:typeof n.ask=="string"?n.ask:null,agentId:typeof n.agentId=="string"?n.agentId:null,resolvedPath:typeof n.resolvedPath=="string"?n.resolvedPath:null,sessionKey:typeof n.sessionKey=="string"?n.sessionKey:null},createdAtMs:i,expiresAtMs:a}}function ng(e){if(!ai(e))return null;const t=typeof e.id=="string"?e.id.trim():"";return t?{id:t,decision:typeof e.decision=="string"?e.decision:null,resolvedBy:typeof e.resolvedBy=="string"?e.resolvedBy:null,ts:typeof e.ts=="number"?e.ts:null}:null}function nl(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function sg(e,t){const n=nl(e).filter(s=>s.id!==t.id);return n.push(t),n}function to(e,t){return nl(e).filter(n=>n.id!==t)}function ig(e){const t=e.version??(e.nonce?"v2":"v1"),n=e.scopes.join(","),s=e.token??"",i=[t,e.deviceId,e.clientId,e.clientMode,e.role,n,String(e.signedAtMs),s];return t==="v2"&&i.push(e.nonce??""),i.join("|")}const sl={WEBCHAT_UI:"webchat-ui",CONTROL_UI:"openclaw-control-ui",WEBCHAT:"webchat",CLI:"cli",GATEWAY_CLIENT:"gateway-client",MACOS_APP:"openclaw-macos",IOS_APP:"openclaw-ios",ANDROID_APP:"openclaw-android",NODE_HOST:"node-host",TEST:"test",FINGERPRINT:"fingerprint",PROBE:"openclaw-probe"},no=sl,oi={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(sl));new Set(Object.values(oi));const ag=4008;class og{constructor(t){this.opts=t,this.ws=null,this.pending=new Map,this.closed=!1,this.lastSeq=null,this.connectNonce=null,this.connectSent=!1,this.connectTimer=null,this.backoffMs=800}start(){this.closed=!1,this.connect()}stop(){this.closed=!0,this.ws?.close(),this.ws=null,this.flushPending(new Error("gateway client stopped"))}get connected(){return this.ws?.readyState===WebSocket.OPEN}connect(){this.closed||(this.ws=new WebSocket(this.opts.url),this.ws.addEventListener("open",()=>this.queueConnect()),this.ws.addEventListener("message",t=>this.handleMessage(String(t.data??""))),this.ws.addEventListener("close",t=>{const n=String(t.reason??"");this.ws=null,this.flushPending(new Error(`gateway closed (${t.code}): ${n}`)),this.opts.onClose?.({code:t.code,reason:n}),this.scheduleReconnect()}),this.ws.addEventListener("error",()=>{}))}scheduleReconnect(){if(this.closed)return;const t=this.backoffMs;this.backoffMs=Math.min(this.backoffMs*1.7,15e3),window.setTimeout(()=>this.connect(),t)}flushPending(t){for(const[,n]of this.pending)n.reject(t);this.pending.clear()}async sendConnect(){if(this.connectSent)return;this.connectSent=!0,this.connectTimer!==null&&(window.clearTimeout(this.connectTimer),this.connectTimer=null);const t=typeof crypto<"u"&&!!crypto.subtle,n=["operator.admin","operator.approvals","operator.pairing"],s="operator";let i=null,a=!1,o=this.opts.token;if(t){i=await Bi();const g=ud({deviceId:i.deviceId,role:s})?.token;o=g??this.opts.token,a=!!(g&&this.opts.token)}const l=o||this.opts.password?{token:o,password:this.opts.password}:void 0;let c;if(t&&i){const g=Date.now(),p=this.connectNonce??void 0,h=ig({deviceId:i.deviceId,clientId:this.opts.clientName??no.CONTROL_UI,clientMode:this.opts.mode??oi.WEBCHAT,role:s,scopes:n,signedAtMs:g,token:o??null,nonce:p}),d=await Fd(i.privateKey,h);c={id:i.deviceId,publicKey:i.publicKey,signature:d,signedAt:g,nonce:p}}const u={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??no.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??oi.WEBCHAT,instanceId:this.opts.instanceId},role:s,scopes:n,device:c,caps:[],auth:l,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",u).then(g=>{g?.auth?.deviceToken&&i&&Sr({deviceId:i.deviceId,role:g.auth.role??s,token:g.auth.deviceToken,scopes:g.auth.scopes??[]}),this.backoffMs=800,this.opts.onHello?.(g)}).catch(()=>{a&&i&&Ar({deviceId:i.deviceId,role:s}),this.ws?.close(ag,"connect failed")})}handleMessage(t){let n;try{n=JSON.parse(t)}catch{return}const s=n;if(s.type==="event"){const i=n;if(i.event==="connect.challenge"){const o=i.payload,l=o&&typeof o.nonce=="string"?o.nonce:null;l&&(this.connectNonce=l,this.sendConnect());return}const a=typeof i.seq=="number"?i.seq:null;a!==null&&(this.lastSeq!==null&&a>this.lastSeq+1&&this.opts.onGap?.({expected:this.lastSeq+1,received:a}),this.lastSeq=a);try{this.opts.onEvent?.(i)}catch(o){console.error("[gateway] event handler error:",o)}return}if(s.type==="res"){const i=n,a=this.pending.get(i.id);if(!a)return;this.pending.delete(i.id),i.ok?a.resolve(i.payload):a.reject(new Error(i.error?.message??"request failed"));return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const s=Ki(),i={type:"req",id:s,method:t,params:n},a=new Promise((o,l)=>{this.pending.set(s,{resolve:c=>o(c),reject:l})});return this.ws.send(JSON.stringify(i)),a}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.connectTimer!==null&&window.clearTimeout(this.connectTimer),this.connectTimer=window.setTimeout(()=>{this.sendConnect()},750)}}function Ls(e,t){const n=(e??"").trim(),s=t.mainSessionKey?.trim();if(!s)return n;if(!n)return s;const i=t.mainKey?.trim()||"main",a=t.defaultAgentId?.trim();return n==="main"||n===i||a&&(n===`agent:${a}:main`||n===`agent:${a}:${i}`)?s:n}function rg(e,t){if(!t?.mainSessionKey)return;const n=Ls(e.sessionKey,t),s=Ls(e.settings.sessionKey,t),i=Ls(e.settings.lastActiveSessionKey,t),a=n||s||e.sessionKey,o={...e.settings,sessionKey:s||a,lastActiveSessionKey:i||a},l=o.sessionKey!==e.settings.sessionKey||o.lastActiveSessionKey!==e.settings.lastActiveSessionKey;a!==e.sessionKey&&(e.sessionKey=a),l&&Ye(e,o)}function il(e){e.lastError=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null,e.client?.stop(),e.client=new og({url:e.settings.gatewayUrl,token:e.settings.token.trim()?e.settings.token:void 0,password:e.password.trim()?e.password:void 0,clientName:"openclaw-control-ui",mode:"webchat",onHello:t=>{e.connected=!0,e.lastError=null,e.hello=t,dg(e,t),e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,is(e),tl(e),Mi(e),Zn(e,{quiet:!0}),Ze(e,{quiet:!0}),ji(e)},onClose:({code:t,reason:n})=>{e.connected=!1,t!==1012&&(e.lastError=`disconnected (${t}): ${n||"no reason"}`)},onEvent:t=>lg(e,t),onGap:({expected:t,received:n})=>{e.lastError=`event gap detected (expected seq ${t}, got ${n}); refresh recommended`}}),e.client.start()}function lg(e,t){try{cg(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function cg(e,t){if(e.eventLogBuffer=[{ts:Date.now(),event:t.event,payload:t.payload},...e.eventLogBuffer].slice(0,250),e.tab==="debug"&&(e.eventLog=e.eventLogBuffer),t.event==="agent"){if(e.onboarding)return;_u(e,t.payload);return}if(t.event==="chat"){const n=t.payload;n?.sessionKey&&Kr(e,n.sessionKey);const s=Uu(e,n);if(s==="final"||s==="error"||s==="aborted"){is(e),qu(e);const i=n?.runId;i&&e.refreshSessionsAfterChat.has(i)&&(e.refreshSessionsAfterChat.delete(i),s==="final"&&bt(e,{activeMinutes:Qr}))}s==="final"&&nn(e);return}if(t.event==="presence"){const n=t.payload;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event==="cron"&&e.tab==="cron"&&Un(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&Ze(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=tg(t.payload);if(n){e.execApprovalQueue=sg(e.execApprovalQueue,n),e.execApprovalError=null;const s=Math.max(0,n.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=to(e.execApprovalQueue,n.id)},s)}return}if(t.event==="exec.approval.resolved"){const n=ng(t.payload);n&&(e.execApprovalQueue=to(e.execApprovalQueue,n.id))}}function dg(e,t){const n=t.snapshot;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n?.health&&(e.debugHealth=n.health),n?.sessionDefaults&&rg(e,n.sessionDefaults)}function ug(e){e.basePath=uu(),lu(e),hu(e,!0),gu(e),pu(e),window.addEventListener("popstate",e.popStateHandler),il(e),Xc(e),e.tab==="logs"&&Ti(e),e.tab==="debug"&&Ei(e)}function gg(e){qc(e)}function pg(e){window.removeEventListener("popstate",e.popStateHandler),ed(e),_i(e),Li(e),fu(e),e.topbarObserver?.disconnect(),e.topbarObserver=null}function fg(e,t){if(!(e.tab==="chat"&&e.chatManualRefreshInFlight)){if(e.tab==="chat"&&(t.has("chatMessages")||t.has("chatToolMessages")||t.has("chatStream")||t.has("chatLoading")||t.has("tab"))){const n=t.has("tab"),s=t.has("chatLoading")&&t.get("chatLoading")===!0&&!e.chatLoading;an(e,n||s||!e.chatHasAutoScrolled)}e.tab==="logs"&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&mr(e,t.has("tab")||t.has("logsAutoFollow"))}}const Wi={CHILD:2},qi=e=>(...t)=>({_$litDirective$:e,values:t});let Gi=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,n,s){this._$Ct=t,this._$AM=n,this._$Ci=s}_$AS(t,n){return this.update(t,n)}update(t,n){return this.render(...n)}};const{I:hg}=hc,so=e=>e,vg=e=>e.strings===void 0,io=()=>document.createComment(""),Ft=(e,t,n)=>{const s=e._$AA.parentNode,i=t===void 0?e._$AB:t._$AA;if(n===void 0){const a=s.insertBefore(io(),i),o=s.insertBefore(io(),i);n=new hg(a,o,e,e.options)}else{const a=n._$AB.nextSibling,o=n._$AM,l=o!==e;if(l){let c;n._$AQ?.(e),n._$AM=e,n._$AP!==void 0&&(c=e._$AU)!==o._$AU&&n._$AP(c)}if(a!==i||l){let c=n._$AA;for(;c!==a;){const u=so(c).nextSibling;so(s).insertBefore(c,i),c=u}}}return n},st=(e,t,n=e)=>(e._$AI(t,n),e),mg={},bg=(e,t=mg)=>e._$AH=t,yg=e=>e._$AH,Ms=e=>{e._$AR(),e._$AA.remove()};const ao=(e,t,n)=>{const s=new Map;for(let i=t;i<=n;i++)s.set(e[i],i);return s},al=qi(class extends Gi{constructor(e){if(super(e),e.type!==Wi.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let s;n===void 0?n=t:t!==void 0&&(s=t);const i=[],a=[];let o=0;for(const l of e)i[o]=s?s(l,o):o,a[o]=n(l,o),o++;return{values:a,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,s]){const i=yg(e),{values:a,keys:o}=this.dt(t,n,s);if(!Array.isArray(i))return this.ut=o,a;const l=this.ut??=[],c=[];let u,g,p=0,h=i.length-1,d=0,f=a.length-1;for(;p<=h&&d<=f;)if(i[p]===null)p++;else if(i[h]===null)h--;else if(l[p]===o[d])c[d]=st(i[p],a[d]),p++,d++;else if(l[h]===o[f])c[f]=st(i[h],a[f]),h--,f--;else if(l[p]===o[f])c[f]=st(i[p],a[f]),Ft(e,c[f+1],i[p]),p++,f--;else if(l[h]===o[d])c[d]=st(i[h],a[d]),Ft(e,i[p],i[h]),h--,d++;else if(u===void 0&&(u=ao(o,d,f),g=ao(l,p,h)),u.has(l[p]))if(u.has(l[h])){const m=g.get(o[d]),S=m!==void 0?i[m]:null;if(S===null){const k=Ft(e,i[p]);st(k,a[d]),c[d]=k}else c[d]=st(S,a[d]),Ft(e,i[p],S),i[m]=null;d++}else Ms(i[h]),h--;else Ms(i[p]),p++;for(;d<=f;){const m=Ft(e,c[f+1]);st(m,a[d]),c[d++]=m}for(;p<=h;){const m=i[p++];m!==null&&Ms(m)}return this.ut=o,bg(e,c),Qe}}),le={messageSquare:r`
131
+ … truncated (${s.total} chars, showing first ${s.text.length}).`:s.text}function Iu(e){const t=[];return t.push({type:"toolcall",name:e.name,arguments:e.args??{}}),e.output&&t.push({type:"toolresult",name:e.name,text:e.output}),{role:"assistant",toolCallId:e.toolCallId,runId:e.runId,content:t,timestamp:e.startedAt}}function Ru(e){if(e.toolStreamOrder.length<=Za)return;const t=e.toolStreamOrder.length-Za,n=e.toolStreamOrder.splice(0,t);for(const s of n)e.toolStreamById.delete(s)}function Pu(e){e.chatToolMessages=e.toolStreamOrder.map(t=>e.toolStreamById.get(t)?.message).filter(t=>!!t)}function ti(e){e.toolStreamSyncTimer!=null&&(clearTimeout(e.toolStreamSyncTimer),e.toolStreamSyncTimer=null),Pu(e)}function Du(e,t=!1){if(t){ti(e);return}e.toolStreamSyncTimer==null&&(e.toolStreamSyncTimer=window.setTimeout(()=>ti(e),Eu))}function os(e){e.toolStreamById.clear(),e.toolStreamOrder=[],e.chatToolMessages=[],ti(e)}const Fu=5e3;function Nu(e,t){const n=t.data??{},s=typeof n.phase=="string"?n.phase:"";e.compactionClearTimer!=null&&(window.clearTimeout(e.compactionClearTimer),e.compactionClearTimer=null),s==="start"?e.compactionStatus={active:!0,startedAt:Date.now(),completedAt:null}:s==="end"&&(e.compactionStatus={active:!1,startedAt:e.compactionStatus?.startedAt??null,completedAt:Date.now()},e.compactionClearTimer=window.setTimeout(()=>{e.compactionStatus=null,e.compactionClearTimer=null},Fu))}function Ou(e,t){if(!t)return;if(t.stream==="compaction"){Nu(e,t);return}if(t.stream!=="tool")return;const n=typeof t.sessionKey=="string"?t.sessionKey:void 0;if(n&&n!==e.sessionKey||!n&&e.chatRunId&&t.runId!==e.chatRunId||e.chatRunId&&t.runId!==e.chatRunId||!e.chatRunId)return;const s=t.data??{},i=typeof s.toolCallId=="string"?s.toolCallId:"";if(!i)return;const a=typeof s.name=="string"?s.name:"tool",o=typeof s.phase=="string"?s.phase:"",l=o==="start"?s.args:void 0,c=o==="update"?Xa(s.partialResult):o==="result"?Xa(s.result):void 0,u=Date.now();let g=e.toolStreamById.get(i);g?(g.name=a,l!==void 0&&(g.args=l),c!==void 0&&(g.output=c||void 0),g.updatedAt=u):(g={toolCallId:i,runId:t.runId,sessionKey:n,name:a,args:l,output:c||void 0,startedAt:typeof t.ts=="number"?t.ts:u,updatedAt:u,message:{}},e.toolStreamById.set(i,g),e.toolStreamOrder.push(i)),g.message=Iu(g),Ru(e),Du(e,o==="result")}const Bu=/^\[([^\]]+)\]\s*/,Uu=["WebChat","WhatsApp","Telegram","Signal","Slack","Discord","iMessage","Teams","Matrix","Zalo","Zalo Personal","BlueBubbles"],_s=new WeakMap,Es=new WeakMap;function zu(e){return/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}Z\b/.test(e)||/\d{4}-\d{2}-\d{2} \d{2}:\d{2}\b/.test(e)?!0:Uu.some(t=>e.startsWith(`${t} `))}function Ls(e){const t=e.match(Bu);if(!t)return e;const n=t[1]??"";return zu(n)?e.slice(t[0].length):e}function ni(e){const t=e,n=typeof t.role=="string"?t.role:"",s=t.content;if(typeof s=="string")return n==="assistant"?ks(s):Ls(s);if(Array.isArray(s)){const i=s.map(a=>{const o=a;return o.type==="text"&&typeof o.text=="string"?o.text:null}).filter(a=>typeof a=="string");if(i.length>0){const a=i.join(`
132
+ `);return n==="assistant"?ks(a):Ls(a)}}return typeof t.text=="string"?n==="assistant"?ks(t.text):Ls(t.text):null}function Xr(e){if(!e||typeof e!="object")return ni(e);const t=e;if(_s.has(t))return _s.get(t)??null;const n=ni(e);return _s.set(t,n),n}function eo(e){const n=e.content,s=[];if(Array.isArray(n))for(const l of n){const c=l;if(c.type==="thinking"&&typeof c.thinking=="string"){const u=c.thinking.trim();u&&s.push(u)}}if(s.length>0)return s.join(`
133
+ `);const i=ju(e);if(!i)return null;const o=[...i.matchAll(/<\s*think(?:ing)?\s*>([\s\S]*?)<\s*\/\s*think(?:ing)?\s*>/gi)].map(l=>(l[1]??"").trim()).filter(Boolean);return o.length>0?o.join(`
134
+ `):null}function Hu(e){if(!e||typeof e!="object")return eo(e);const t=e;if(Es.has(t))return Es.get(t)??null;const n=eo(e);return Es.set(t,n),n}function ju(e){const t=e,n=t.content;if(typeof n=="string")return n;if(Array.isArray(n)){const s=n.map(i=>{const a=i;return a.type==="text"&&typeof a.text=="string"?a.text:null}).filter(i=>typeof i=="string");if(s.length>0)return s.join(`
135
+ `)}return typeof t.text=="string"?t.text:null}function Ku(e){const t=e.trim();if(!t)return"";const n=t.split(/\r?\n/).map(s=>s.trim()).filter(Boolean).map(s=>`_${s}_`);return n.length?["_Reasoning:_",...n].join(`
136
+ `):""}let to=!1;function no(e){e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<e.length;n++)t+=e[n].toString(16).padStart(2,"0");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function Wu(){const e=new Uint8Array(16),t=Date.now();for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*256);return e[0]^=t&255,e[1]^=t>>>8&255,e[2]^=t>>>16&255,e[3]^=t>>>24&255,e}function qu(){to||(to=!0,console.warn("[uuid] crypto API missing; falling back to weak randomness"))}function Wi(e=globalThis.crypto){if(e&&typeof e.randomUUID=="function")return e.randomUUID();if(e&&typeof e.getRandomValues=="function"){const t=new Uint8Array(16);return e.getRandomValues(t),no(t)}return qu(),no(Wu())}async function an(e){if(!(!e.client||!e.connected)){e.chatLoading=!0,e.lastError=null;try{const t=await e.client.request("chat.history",{sessionKey:e.sessionKey,limit:200});e.chatMessages=Array.isArray(t.messages)?t.messages:[],e.chatThinkingLevel=t.thinkingLevel??null}catch(t){e.lastError=String(t)}finally{e.chatLoading=!1}}}function Gu(e){const t=/^data:([^;]+);base64,(.+)$/.exec(e);return t?{mimeType:t[1],content:t[2]}:null}async function Vu(e,t,n){if(!e.client||!e.connected)return null;const s=t.trim(),i=n&&n.length>0;if(!s&&!i)return null;const a=Date.now(),o=[];if(s&&o.push({type:"text",text:s}),i)for(const u of n)o.push({type:"image",source:{type:"base64",media_type:u.mimeType,data:u.dataUrl}});e.chatMessages=[...e.chatMessages,{role:"user",content:o,timestamp:a}],e.chatSending=!0,e.lastError=null;const l=Wi();e.chatRunId=l,e.chatStream="",e.chatStreamStartedAt=a;const c=i?n.map(u=>{const g=Gu(u.dataUrl);return g?{type:"image",mimeType:g.mimeType,content:g.content}:null}).filter(u=>u!==null):void 0;try{return await e.client.request("chat.send",{sessionKey:e.sessionKey,message:s,deliver:!1,idempotencyKey:l,attachments:c}),l}catch(u){const g=String(u);return e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,e.lastError=g,e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:"Error: "+g}],timestamp:Date.now()}],null}finally{e.chatSending=!1}}async function Qu(e){if(!e.client||!e.connected)return!1;const t=e.chatRunId;try{return await e.client.request("chat.abort",t?{sessionKey:e.sessionKey,runId:t}:{sessionKey:e.sessionKey}),!0}catch(n){return e.lastError=String(n),!1}}function Yu(e,t){if(!t||t.sessionKey!==e.sessionKey)return null;if(t.runId&&e.chatRunId&&t.runId!==e.chatRunId)return t.state==="final"?"final":null;if(t.state==="delta"){const n=ni(t.message);if(typeof n=="string"){const s=e.chatStream??"";(!s||n.length>=s.length)&&(e.chatStream=n)}}else t.state==="final"||t.state==="aborted"?(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null):t.state==="error"&&(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.lastError=t.errorMessage??"chat error");return t.state}const el=120;function tl(e){return e.chatSending||!!e.chatRunId}function Ju(e){const t=e.trim();if(!t)return!1;const n=t.toLowerCase();return n==="/stop"?!0:n==="stop"||n==="esc"||n==="abort"||n==="wait"||n==="exit"}function Zu(e){const t=e.trim();if(!t)return!1;const n=t.toLowerCase();return n==="/new"||n==="/reset"?!0:n.startsWith("/new ")||n.startsWith("/reset ")}async function nl(e){e.connected&&(e.chatMessage="",await Qu(e))}function Xu(e,t,n,s){const i=t.trim(),a=!!(n&&n.length>0);!i&&!a||(e.chatQueue=[...e.chatQueue,{id:Wi(),text:i,createdAt:Date.now(),attachments:a?n?.map(o=>({...o})):void 0,refreshSessions:s}])}async function sl(e,t,n){os(e);const s=await Vu(e,t,n?.attachments),i=!!s;return!i&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!i&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),i&&Qr(e,e.sessionKey),i&&n?.restoreDraft&&n.previousDraft?.trim()&&(e.chatMessage=n.previousDraft),i&&n?.restoreAttachments&&n.previousAttachments?.length&&(e.chatAttachments=n.previousAttachments),rn(e),i&&!e.chatRunId&&il(e),i&&n?.refreshSessions&&s&&e.refreshSessionsAfterChat.add(s),i}async function il(e){if(!e.connected||tl(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await sl(e,t.text,{attachments:t.attachments,refreshSessions:t.refreshSessions})||(e.chatQueue=[t,...e.chatQueue])}function eg(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function tg(e,t,n){if(!e.connected)return;const s=e.chatMessage,i=(t??e.chatMessage).trim(),a=e.chatAttachments??[],o=t==null?a:[],l=o.length>0;if(!i&&!l)return;if(Ju(i)){await nl(e);return}const c=Zu(i);if(t==null&&(e.chatMessage="",e.chatAttachments=[]),tl(e)){Xu(e,i,o,c);return}await sl(e,i,{previousDraft:t==null?s:void 0,restoreDraft:!!(t&&n?.restoreDraft),attachments:l?o:void 0,previousAttachments:t==null?a:void 0,restoreAttachments:!!(t&&n?.restoreDraft),refreshSessions:c})}async function al(e,t){await Promise.all([an(e),xt(e,{activeMinutes:el}),si(e)]),t?.scheduleScroll!==!1&&rn(e)}const ng=il;function sg(e){const t=$r(e.sessionKey);return t?.agentId?t.agentId:e.hello?.snapshot?.sessionDefaults?.defaultAgentId?.trim()||"main"}function ig(e,t){const n=dn(e),s=encodeURIComponent(t);return n?`${n}/avatar/${s}?meta=1`:`/avatar/${s}?meta=1`}async function si(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=sg(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=ig(e.basePath,t);try{const s=await fetch(n,{method:"GET"});if(!s.ok){e.chatAvatarUrl=null;return}const i=await s.json(),a=typeof i.avatarUrl=="string"?i.avatarUrl.trim():"";e.chatAvatarUrl=a||null}catch{e.chatAvatarUrl=null}}const ag={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},og={name:"",description:"",agentId:"",enabled:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",sessionTarget:"isolated",wakeMode:"now",payloadKind:"agentTurn",payloadText:"",deliveryMode:"announce",deliveryChannel:"last",deliveryTo:"",timeoutSeconds:""},rg=50,lg=200,cg="Assistant";function so(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}function ii(e){const t=so(e?.name,rg)??cg,n=so(e?.avatar??void 0,lg)??null;return{agentId:typeof e?.agentId=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}function dg(){return ii(typeof window>"u"?{}:{name:window.__OPENCLAW_ASSISTANT_NAME__,avatar:window.__OPENCLAW_ASSISTANT_AVATAR__})}async function ol(e,t){if(!e.client||!e.connected)return;const n=e.sessionKey.trim(),s=n?{sessionKey:n}:{};try{const i=await e.client.request("agent.identity.get",s);if(!i)return;const a=ii(i);e.assistantName=a.name,e.assistantAvatar=a.avatar,e.assistantAgentId=a.agentId??null}catch{}}function ai(e){return typeof e=="object"&&e!==null}function ug(e){if(!ai(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!ai(n))return null;const s=typeof n.command=="string"?n.command.trim():"";if(!s)return null;const i=typeof e.createdAtMs=="number"?e.createdAtMs:0,a=typeof e.expiresAtMs=="number"?e.expiresAtMs:0;return!i||!a?null:{id:t,request:{command:s,cwd:typeof n.cwd=="string"?n.cwd:null,host:typeof n.host=="string"?n.host:null,security:typeof n.security=="string"?n.security:null,ask:typeof n.ask=="string"?n.ask:null,agentId:typeof n.agentId=="string"?n.agentId:null,resolvedPath:typeof n.resolvedPath=="string"?n.resolvedPath:null,sessionKey:typeof n.sessionKey=="string"?n.sessionKey:null},createdAtMs:i,expiresAtMs:a}}function gg(e){if(!ai(e))return null;const t=typeof e.id=="string"?e.id.trim():"";return t?{id:t,decision:typeof e.decision=="string"?e.decision:null,resolvedBy:typeof e.resolvedBy=="string"?e.resolvedBy:null,ts:typeof e.ts=="number"?e.ts:null}:null}function rl(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function pg(e,t){const n=rl(e).filter(s=>s.id!==t.id);return n.push(t),n}function io(e,t){return rl(e).filter(n=>n.id!==t)}function fg(e){const t=e.version??(e.nonce?"v2":"v1"),n=e.scopes.join(","),s=e.token??"",i=[t,e.deviceId,e.clientId,e.clientMode,e.role,n,String(e.signedAtMs),s];return t==="v2"&&i.push(e.nonce??""),i.join("|")}const ll={WEBCHAT_UI:"webchat-ui",CONTROL_UI:"openclaw-control-ui",WEBCHAT:"webchat",CLI:"cli",GATEWAY_CLIENT:"gateway-client",MACOS_APP:"openclaw-macos",IOS_APP:"openclaw-ios",ANDROID_APP:"openclaw-android",NODE_HOST:"node-host",TEST:"test",FINGERPRINT:"fingerprint",PROBE:"openclaw-probe"},ao=ll,oi={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(ll));new Set(Object.values(oi));const hg=4008;class vg{constructor(t){this.opts=t,this.ws=null,this.pending=new Map,this.closed=!1,this.lastSeq=null,this.connectNonce=null,this.connectSent=!1,this.connectTimer=null,this.backoffMs=800}start(){this.closed=!1,this.connect()}stop(){this.closed=!0,this.ws?.close(),this.ws=null,this.flushPending(new Error("gateway client stopped"))}get connected(){return this.ws?.readyState===WebSocket.OPEN}connect(){this.closed||(this.ws=new WebSocket(this.opts.url),this.ws.addEventListener("open",()=>this.queueConnect()),this.ws.addEventListener("message",t=>this.handleMessage(String(t.data??""))),this.ws.addEventListener("close",t=>{const n=String(t.reason??"");this.ws=null,this.flushPending(new Error(`gateway closed (${t.code}): ${n}`)),this.opts.onClose?.({code:t.code,reason:n}),this.scheduleReconnect()}),this.ws.addEventListener("error",()=>{}))}scheduleReconnect(){if(this.closed)return;const t=this.backoffMs;this.backoffMs=Math.min(this.backoffMs*1.7,15e3),window.setTimeout(()=>this.connect(),t)}flushPending(t){for(const[,n]of this.pending)n.reject(t);this.pending.clear()}async sendConnect(){if(this.connectSent)return;this.connectSent=!0,this.connectTimer!==null&&(window.clearTimeout(this.connectTimer),this.connectTimer=null);const t=typeof crypto<"u"&&!!crypto.subtle,n=["operator.admin","operator.approvals","operator.pairing"],s="operator";let i=null,a=!1,o=this.opts.token;if(t){i=await Ui();const g=$d({deviceId:i.deviceId,role:s})?.token;o=g??this.opts.token,a=!!(g&&this.opts.token)}const l=o||this.opts.password?{token:o,password:this.opts.password}:void 0;let c;if(t&&i){const g=Date.now(),p=this.connectNonce??void 0,h=fg({deviceId:i.deviceId,clientId:this.opts.clientName??ao.CONTROL_UI,clientMode:this.opts.mode??oi.WEBCHAT,role:s,scopes:n,signedAtMs:g,token:o??null,nonce:p}),d=await qd(i.privateKey,h);c={id:i.deviceId,publicKey:i.publicKey,signature:d,signedAt:g,nonce:p}}const u={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??ao.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??oi.WEBCHAT,instanceId:this.opts.instanceId},role:s,scopes:n,device:c,caps:[],auth:l,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",u).then(g=>{g?.auth?.deviceToken&&i&&Er({deviceId:i.deviceId,role:g.auth.role??s,token:g.auth.deviceToken,scopes:g.auth.scopes??[]}),this.backoffMs=800,this.opts.onHello?.(g)}).catch(()=>{a&&i&&Lr({deviceId:i.deviceId,role:s}),this.ws?.close(hg,"connect failed")})}handleMessage(t){let n;try{n=JSON.parse(t)}catch{return}const s=n;if(s.type==="event"){const i=n;if(i.event==="connect.challenge"){const o=i.payload,l=o&&typeof o.nonce=="string"?o.nonce:null;l&&(this.connectNonce=l,this.sendConnect());return}const a=typeof i.seq=="number"?i.seq:null;a!==null&&(this.lastSeq!==null&&a>this.lastSeq+1&&this.opts.onGap?.({expected:this.lastSeq+1,received:a}),this.lastSeq=a);try{this.opts.onEvent?.(i)}catch(o){console.error("[gateway] event handler error:",o)}return}if(s.type==="res"){const i=n,a=this.pending.get(i.id);if(!a)return;this.pending.delete(i.id),i.ok?a.resolve(i.payload):a.reject(new Error(i.error?.message??"request failed"));return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const s=Wi(),i={type:"req",id:s,method:t,params:n},a=new Promise((o,l)=>{this.pending.set(s,{resolve:c=>o(c),reject:l})});return this.ws.send(JSON.stringify(i)),a}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.connectTimer!==null&&window.clearTimeout(this.connectTimer),this.connectTimer=window.setTimeout(()=>{this.sendConnect()},750)}}function Ms(e,t){const n=(e??"").trim(),s=t.mainSessionKey?.trim();if(!s)return n;if(!n)return s;const i=t.mainKey?.trim()||"main",a=t.defaultAgentId?.trim();return n==="main"||n===i||a&&(n===`agent:${a}:main`||n===`agent:${a}:${i}`)?s:n}function mg(e,t){if(!t?.mainSessionKey)return;const n=Ms(e.sessionKey,t),s=Ms(e.settings.sessionKey,t),i=Ms(e.settings.lastActiveSessionKey,t),a=n||s||e.sessionKey,o={...e.settings,sessionKey:s||a,lastActiveSessionKey:i||a},l=o.sessionKey!==e.settings.sessionKey||o.lastActiveSessionKey!==e.settings.lastActiveSessionKey;a!==e.sessionKey&&(e.sessionKey=a),l&&Je(e,o)}function cl(e){e.lastError=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null,e.client?.stop(),e.client=new vg({url:e.settings.gatewayUrl,token:e.settings.token.trim()?e.settings.token:void 0,password:e.password.trim()?e.password:void 0,clientName:"openclaw-control-ui",mode:"webchat",onHello:t=>{e.connected=!0,e.lastError=null,e.hello=t,xg(e,t),e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,os(e),ol(e),Ii(e),es(e,{quiet:!0}),Xe(e,{quiet:!0}),Ki(e)},onClose:({code:t,reason:n})=>{e.connected=!1,t!==1012&&(e.lastError=`disconnected (${t}): ${n||"no reason"}`)},onEvent:t=>bg(e,t),onGap:({expected:t,received:n})=>{e.lastError=`event gap detected (expected seq ${t}, got ${n}); refresh recommended`}}),e.client.start()}function bg(e,t){try{yg(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function yg(e,t){if(e.eventLogBuffer=[{ts:Date.now(),event:t.event,payload:t.payload},...e.eventLogBuffer].slice(0,250),e.tab==="debug"&&(e.eventLog=e.eventLogBuffer),t.event==="agent"){if(e.onboarding)return;Ou(e,t.payload);return}if(t.event==="chat"){const n=t.payload;n?.sessionKey&&Qr(e,n.sessionKey);const s=Yu(e,n);if(s==="final"||s==="error"||s==="aborted"){os(e),ng(e);const i=n?.runId;i&&e.refreshSessionsAfterChat.has(i)&&(e.refreshSessionsAfterChat.delete(i),s==="final"&&xt(e,{activeMinutes:el}))}s==="final"&&an(e);return}if(t.event==="presence"){const n=t.payload;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event==="cron"&&e.tab==="cron"&&Hn(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&Xe(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=ug(t.payload);if(n){e.execApprovalQueue=pg(e.execApprovalQueue,n),e.execApprovalError=null;const s=Math.max(0,n.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=io(e.execApprovalQueue,n.id)},s)}return}if(t.event==="exec.approval.resolved"){const n=gg(t.payload);n&&(e.execApprovalQueue=io(e.execApprovalQueue,n.id))}}function xg(e,t){const n=t.snapshot;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n?.health&&(e.debugHealth=n.health),n?.sessionDefaults&&mg(e,n.sessionDefaults)}function $g(e){e.basePath=$u(),bu(e),Au(e,!0),wu(e),ku(e),window.addEventListener("popstate",e.popStateHandler),cl(e),cd(e),e.tab==="logs"&&_i(e),e.tab==="debug"&&Li(e)}function wg(e){nd(e)}function kg(e){window.removeEventListener("popstate",e.popStateHandler),dd(e),Ei(e),Mi(e),Su(e),e.topbarObserver?.disconnect(),e.topbarObserver=null}function Sg(e,t){if(!(e.tab==="chat"&&e.chatManualRefreshInFlight)){if(e.tab==="chat"&&(t.has("chatMessages")||t.has("chatToolMessages")||t.has("chatStream")||t.has("chatLoading")||t.has("tab"))){const n=t.has("tab"),s=t.has("chatLoading")&&t.get("chatLoading")===!0&&!e.chatLoading;rn(e,n||s||!e.chatHasAutoScrolled)}e.tab==="logs"&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&wr(e,t.has("tab")||t.has("logsAutoFollow"))}}const qi={CHILD:2},Gi=e=>(...t)=>({_$litDirective$:e,values:t});let Vi=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,n,s){this._$Ct=t,this._$AM=n,this._$Ci=s}_$AS(t,n){return this.update(t,n)}update(t,n){return this.render(...n)}};const{I:Ag}=kc,oo=e=>e,Cg=e=>e.strings===void 0,ro=()=>document.createComment(""),Nt=(e,t,n)=>{const s=e._$AA.parentNode,i=t===void 0?e._$AB:t._$AA;if(n===void 0){const a=s.insertBefore(ro(),i),o=s.insertBefore(ro(),i);n=new Ag(a,o,e,e.options)}else{const a=n._$AB.nextSibling,o=n._$AM,l=o!==e;if(l){let c;n._$AQ?.(e),n._$AM=e,n._$AP!==void 0&&(c=e._$AU)!==o._$AU&&n._$AP(c)}if(a!==i||l){let c=n._$AA;for(;c!==a;){const u=oo(c).nextSibling;oo(s).insertBefore(c,i),c=u}}}return n},it=(e,t,n=e)=>(e._$AI(t,n),e),Tg={},_g=(e,t=Tg)=>e._$AH=t,Eg=e=>e._$AH,Is=e=>{e._$AR(),e._$AA.remove()};const lo=(e,t,n)=>{const s=new Map;for(let i=t;i<=n;i++)s.set(e[i],i);return s},dl=Gi(class extends Vi{constructor(e){if(super(e),e.type!==qi.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let s;n===void 0?n=t:t!==void 0&&(s=t);const i=[],a=[];let o=0;for(const l of e)i[o]=s?s(l,o):o,a[o]=n(l,o),o++;return{values:a,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,s]){const i=Eg(e),{values:a,keys:o}=this.dt(t,n,s);if(!Array.isArray(i))return this.ut=o,a;const l=this.ut??=[],c=[];let u,g,p=0,h=i.length-1,d=0,f=a.length-1;for(;p<=h&&d<=f;)if(i[p]===null)p++;else if(i[h]===null)h--;else if(l[p]===o[d])c[d]=it(i[p],a[d]),p++,d++;else if(l[h]===o[f])c[f]=it(i[h],a[f]),h--,f--;else if(l[p]===o[f])c[f]=it(i[p],a[f]),Nt(e,c[f+1],i[p]),p++,f--;else if(l[h]===o[d])c[d]=it(i[h],a[d]),Nt(e,i[p],i[h]),h--,d++;else if(u===void 0&&(u=lo(o,d,f),g=lo(l,p,h)),u.has(l[p]))if(u.has(l[h])){const m=g.get(o[d]),S=m!==void 0?i[m]:null;if(S===null){const k=Nt(e,i[p]);it(k,a[d]),c[d]=k}else c[d]=it(S,a[d]),Nt(e,i[p],S),i[m]=null;d++}else Is(i[h]),h--;else Is(i[p]),p++;for(;d<=f;){const m=Nt(e,c[f+1]);it(m,a[d]),c[d++]=m}for(;p<=h;){const m=i[p++];m!==null&&Is(m)}return this.ut=o,_g(e,c),Ye}}),le={messageSquare:r`
137
137
  <svg viewBox="0 0 24 24">
138
138
  <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" />
139
139
  </svg>
@@ -321,17 +321,17 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
321
321
  d="M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.076.874.54 1.02 1.02a2.5 2.5 0 1 0 3.237-3.237c-.48-.146-.944-.505-1.02-1.02a.98.98 0 0 1 .303-.917l1.526-1.526A2.402 2.402 0 0 1 11.998 2c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.236 3.236c-.464.18-.894.527-.967 1.02Z"
322
322
  />
323
323
  </svg>
324
- `};function xg(e,t){const n=ns(t,e.basePath);return r`
324
+ `};function Lg(e,t){const n=is(t,e.basePath);return r`
325
325
  <a
326
326
  href=${n}
327
327
  class="nav-item ${e.tab===t?"active":""}"
328
328
  @click=${s=>{s.defaultPrevented||s.button!==0||s.metaKey||s.ctrlKey||s.shiftKey||s.altKey||(s.preventDefault(),e.setTab(t))}}
329
329
  title=${ei(t)}
330
330
  >
331
- <span class="nav-item__icon" aria-hidden="true">${le[tu(t)]}</span>
331
+ <span class="nav-item__icon" aria-hidden="true">${le[uu(t)]}</span>
332
332
  <span class="nav-item__text">${ei(t)}</span>
333
333
  </a>
334
- `}function $g(e){const t=wg(e.hello,e.sessionsResult),n=kg(e.sessionKey,e.sessionsResult,t),s=e.onboarding,i=e.onboarding,a=e.onboarding?!1:e.settings.chatShowThinking,o=e.onboarding?!0:e.settings.chatFocusMode,l=r`
334
+ `}function Mg(e){const t=Ig(e.hello,e.sessionsResult),n=Rg(e.sessionKey,e.sessionsResult,t),s=e.onboarding,i=e.onboarding,a=e.onboarding?!1:e.settings.chatShowThinking,o=e.onboarding?!0:e.settings.chatFocusMode,l=r`
335
335
  <svg
336
336
  width="18"
337
337
  height="18"
@@ -368,9 +368,9 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
368
368
  <select
369
369
  .value=${e.sessionKey}
370
370
  ?disabled=${!e.connected}
371
- @change=${u=>{const g=u.target.value;e.sessionKey=g,e.chatMessage="",e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:g,lastActiveSessionKey:g}),e.loadAssistantIdentity(),mu(e,g),nn(e)}}
371
+ @change=${u=>{const g=u.target.value;e.sessionKey=g,e.chatMessage="",e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:g,lastActiveSessionKey:g}),e.loadAssistantIdentity(),Tu(e,g),an(e)}}
372
372
  >
373
- ${al(n,u=>u.key,u=>r`<option value=${u.key}>
373
+ ${dl(n,u=>u.key,u=>r`<option value=${u.key}>
374
374
  ${u.displayName??u.key}
375
375
  </option>`)}
376
376
  </select>
@@ -378,7 +378,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
378
378
  <button
379
379
  class="btn btn--sm btn--icon"
380
380
  ?disabled=${e.chatLoading||!e.connected}
381
- @click=${async()=>{const u=e;u.chatManualRefreshInFlight=!0,u.chatNewMessagesBelow=!1,await u.updateComplete,u.resetToolStream();try{await el(e,{scheduleScroll:!1}),u.scrollToBottom({smooth:!0})}finally{requestAnimationFrame(()=>{u.chatManualRefreshInFlight=!1,u.chatNewMessagesBelow=!1})}}}
381
+ @click=${async()=>{const u=e;u.chatManualRefreshInFlight=!0,u.chatNewMessagesBelow=!1,await u.updateComplete,u.resetToolStream();try{await al(e,{scheduleScroll:!1}),u.scrollToBottom({smooth:!0})}finally{requestAnimationFrame(()=>{u.chatManualRefreshInFlight=!1,u.chatNewMessagesBelow=!1})}}}
382
382
  title="Refresh chat data"
383
383
  >
384
384
  ${l}
@@ -403,7 +403,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
403
403
  ${c}
404
404
  </button>
405
405
  </div>
406
- `}function wg(e,t){const n=e?.snapshot,s=n?.sessionDefaults?.mainSessionKey?.trim();if(s)return s;const i=n?.sessionDefaults?.mainKey?.trim();return i||(t?.sessions?.some(a=>a.key==="main")?"main":null)}function Is(e,t){const n=t?.displayName?.trim()||"",s=t?.label?.trim()||"";return n&&n!==e?`${n} (${e})`:s&&s!==e?`${s} (${e})`:e}function kg(e,t,n){const s=new Set,i=[],a=n&&t?.sessions?.find(l=>l.key===n),o=t?.sessions?.find(l=>l.key===e);if(n&&(s.add(n),i.push({key:n,displayName:Is(n,a||void 0)})),s.has(e)||(s.add(e),i.push({key:e,displayName:Is(e,o)})),t?.sessions)for(const l of t.sessions)s.has(l.key)||(s.add(l.key),i.push({key:l.key,displayName:Is(l.key,l)}));return i}const Sg=["system","light","dark"];function Ag(e){const t=Math.max(0,Sg.indexOf(e.theme)),n=s=>i=>{const o={element:i.currentTarget};(i.clientX||i.clientY)&&(o.pointerClientX=i.clientX,o.pointerClientY=i.clientY),e.setTheme(s,o)};return r`
406
+ `}function Ig(e,t){const n=e?.snapshot,s=n?.sessionDefaults?.mainSessionKey?.trim();if(s)return s;const i=n?.sessionDefaults?.mainKey?.trim();return i||(t?.sessions?.some(a=>a.key==="main")?"main":null)}function Rs(e,t){const n=t?.displayName?.trim()||"",s=t?.label?.trim()||"";return n&&n!==e?`${n} (${e})`:s&&s!==e?`${s} (${e})`:e}function Rg(e,t,n){const s=new Set,i=[],a=n&&t?.sessions?.find(l=>l.key===n),o=t?.sessions?.find(l=>l.key===e);if(n&&(s.add(n),i.push({key:n,displayName:Rs(n,a||void 0)})),s.has(e)||(s.add(e),i.push({key:e,displayName:Rs(e,o)})),t?.sessions)for(const l of t.sessions)s.has(l.key)||(s.add(l.key),i.push({key:l.key,displayName:Rs(l.key,l)}));return i}const Pg=["system","light","dark"];function Dg(e){const t=Math.max(0,Pg.indexOf(e.theme)),n=s=>i=>{const o={element:i.currentTarget};(i.clientX||i.clientY)&&(o.pointerClientX=i.clientX,o.pointerClientY=i.clientY),e.setTheme(s,o)};return r`
407
407
  <div class="theme-toggle" style="--theme-index: ${t};">
408
408
  <div class="theme-toggle__track" role="group" aria-label="Theme">
409
409
  <span class="theme-toggle__indicator"></span>
@@ -414,7 +414,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
414
414
  aria-label="System theme"
415
415
  title="System"
416
416
  >
417
- ${_g()}
417
+ ${Og()}
418
418
  </button>
419
419
  <button
420
420
  class="theme-toggle__button ${e.theme==="light"?"active":""}"
@@ -423,7 +423,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
423
423
  aria-label="Light theme"
424
424
  title="Light"
425
425
  >
426
- ${Cg()}
426
+ ${Fg()}
427
427
  </button>
428
428
  <button
429
429
  class="theme-toggle__button ${e.theme==="dark"?"active":""}"
@@ -432,11 +432,11 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
432
432
  aria-label="Dark theme"
433
433
  title="Dark"
434
434
  >
435
- ${Tg()}
435
+ ${Ng()}
436
436
  </button>
437
437
  </div>
438
438
  </div>
439
- `}function Cg(){return r`
439
+ `}function Fg(){return r`
440
440
  <svg class="theme-icon" viewBox="0 0 24 24" aria-hidden="true">
441
441
  <circle cx="12" cy="12" r="4"></circle>
442
442
  <path d="M12 2v2"></path>
@@ -448,21 +448,21 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
448
448
  <path d="m6.34 17.66-1.41 1.41"></path>
449
449
  <path d="m19.07 4.93-1.41 1.41"></path>
450
450
  </svg>
451
- `}function Tg(){return r`
451
+ `}function Ng(){return r`
452
452
  <svg class="theme-icon" viewBox="0 0 24 24" aria-hidden="true">
453
453
  <path
454
454
  d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"
455
455
  ></path>
456
456
  </svg>
457
- `}function _g(){return r`
457
+ `}function Og(){return r`
458
458
  <svg class="theme-icon" viewBox="0 0 24 24" aria-hidden="true">
459
459
  <rect width="20" height="14" x="2" y="3" rx="2"></rect>
460
460
  <line x1="8" x2="16" y1="21" y2="21"></line>
461
461
  <line x1="12" x2="12" y1="17" y2="21"></line>
462
462
  </svg>
463
- `}function ol(e,t){if(!e)return e;const s=e.files.some(i=>i.name===t.name)?e.files.map(i=>i.name===t.name?t:i):[...e.files,t];return{...e,files:s}}async function Rs(e,t){if(!(!e.client||!e.connected||e.agentFilesLoading)){e.agentFilesLoading=!0,e.agentFilesError=null;try{const n=await e.client.request("agents.files.list",{agentId:t});n&&(e.agentFilesList=n,e.agentFileActive&&!n.files.some(s=>s.name===e.agentFileActive)&&(e.agentFileActive=null))}catch(n){e.agentFilesError=String(n)}finally{e.agentFilesLoading=!1}}}async function Eg(e,t,n,s){if(!(!e.client||!e.connected||e.agentFilesLoading)&&!Object.hasOwn(e.agentFileContents,n)){e.agentFilesLoading=!0,e.agentFilesError=null;try{const i=await e.client.request("agents.files.get",{agentId:t,name:n});if(i?.file){const a=i.file.content??"",o=e.agentFileContents[n]??"",l=e.agentFileDrafts[n],c=s?.preserveDraft??!0;e.agentFilesList=ol(e.agentFilesList,i.file),e.agentFileContents={...e.agentFileContents,[n]:a},(!c||!Object.hasOwn(e.agentFileDrafts,n)||l===o)&&(e.agentFileDrafts={...e.agentFileDrafts,[n]:a})}}catch(i){e.agentFilesError=String(i)}finally{e.agentFilesLoading=!1}}}async function Lg(e,t,n,s){if(!(!e.client||!e.connected||e.agentFileSaving)){e.agentFileSaving=!0,e.agentFilesError=null;try{const i=await e.client.request("agents.files.set",{agentId:t,name:n,content:s});i?.file&&(e.agentFilesList=ol(e.agentFilesList,i.file),e.agentFileContents={...e.agentFileContents,[n]:s},e.agentFileDrafts={...e.agentFileDrafts,[n]:s})}catch(i){e.agentFilesError=String(i)}finally{e.agentFileSaving=!1}}}async function rl(e,t){if(!(!e.client||!e.connected)&&!e.usageLoading){e.usageLoading=!0,e.usageError=null;try{const n=t?.startDate??e.usageStartDate,s=t?.endDate??e.usageEndDate,[i,a]=await Promise.all([e.client.request("sessions.usage",{startDate:n,endDate:s,limit:1e3,includeContextWeight:!0}),e.client.request("usage.cost",{startDate:n,endDate:s})]);i&&(e.usageResult=i),a&&(e.usageCostSummary=a)}catch(n){e.usageError=String(n)}finally{e.usageLoading=!1}}}async function Mg(e,t){if(!(!e.client||!e.connected)&&!e.usageTimeSeriesLoading){e.usageTimeSeriesLoading=!0,e.usageTimeSeries=null;try{const n=await e.client.request("sessions.usage.timeseries",{key:t});n&&(e.usageTimeSeries=n)}catch{e.usageTimeSeries=null}finally{e.usageTimeSeriesLoading=!1}}}async function Ig(e,t){if(!(!e.client||!e.connected)&&!e.usageSessionLogsLoading){e.usageSessionLogsLoading=!0,e.usageSessionLogs=null;try{const n=await e.client.request("sessions.usage.logs",{key:t,limit:500});n&&Array.isArray(n.logs)&&(e.usageSessionLogs=n.logs)}catch{e.usageSessionLogs=null}finally{e.usageSessionLogsLoading=!1}}}const Rg={bash:"exec","apply-patch":"apply_patch"},Pg={"group:memory":["memory_search","memory_get"],"group:web":["web_search","web_fetch"],"group:fs":["read","write","edit","apply_patch"],"group:runtime":["exec","process"],"group:sessions":["sessions_list","sessions_history","sessions_send","sessions_spawn","session_status"],"group:ui":["browser","canvas"],"group:automation":["cron","gateway"],"group:messaging":["message"],"group:nodes":["nodes"],"group:openclaw":["browser","canvas","nodes","cron","message","gateway","agents_list","sessions_list","sessions_history","sessions_send","sessions_spawn","session_status","memory_search","memory_get","web_search","web_fetch","image"]},Dg={minimal:{allow:["session_status"]},coding:{allow:["group:fs","group:runtime","group:sessions","group:memory","image"]},messaging:{allow:["group:messaging","sessions_list","sessions_history","sessions_send","session_status"]},full:{}};function Pe(e){const t=e.trim().toLowerCase();return Rg[t]??t}function Fg(e){return e?e.map(Pe).filter(Boolean):[]}function Ng(e){const t=Fg(e),n=[];for(const s of t){const i=Pg[s];if(i){n.push(...i);continue}n.push(s)}return Array.from(new Set(n))}function Og(e){if(!e)return;const t=Dg[e];if(t&&!(!t.allow&&!t.deny))return{allow:t.allow?[...t.allow]:void 0,deny:t.deny?[...t.deny]:void 0}}function Bg(e){const t=e.host??"unknown",n=e.ip?`(${e.ip})`:"",s=e.mode??"",i=e.version??"";return`${t} ${n} ${s} ${i}`.trim()}function Ug(e){const t=e.ts??null;return t?V(t):"n/a"}function Vi(e){return e?`${ft(e)} (${V(e)})`:"n/a"}function zg(e){if(e.totalTokens==null)return"n/a";const t=e.totalTokens??0,n=e.contextTokens??0;return n?`${t} / ${n}`:String(t)}function Hg(e){if(e==null)return"";try{return JSON.stringify(e,null,2)}catch{return String(e)}}function jg(e){const t=e.state??{},n=t.nextRunAtMs?ft(t.nextRunAtMs):"n/a",s=t.lastRunAtMs?ft(t.lastRunAtMs):"n/a";return`${t.lastStatus??"n/a"} · next ${n} · last ${s}`}function ll(e){const t=e.schedule;if(t.kind==="at"){const n=Date.parse(t.at);return Number.isFinite(n)?`At ${ft(n)}`:`At ${t.at}`}return t.kind==="every"?`Every ${Ri(t.everyMs)}`:`Cron ${t.expr}${t.tz?` (${t.tz})`:""}`}function Kg(e){const t=e.payload;if(t.kind==="systemEvent")return`System: ${t.text}`;const n=`Agent: ${t.message}`,s=e.delivery;if(s&&s.mode!=="none"){const i=s.channel||s.to?` (${s.channel??"last"}${s.to?` -> ${s.to}`:""})`:"";return`${n} · ${s.mode}${i}`}return n}const oo=[{id:"fs",label:"Files",tools:[{id:"read",label:"read",description:"Read file contents"},{id:"write",label:"write",description:"Create or overwrite files"},{id:"edit",label:"edit",description:"Make precise edits"},{id:"apply_patch",label:"apply_patch",description:"Patch files (OpenAI)"}]},{id:"runtime",label:"Runtime",tools:[{id:"exec",label:"exec",description:"Run shell commands"},{id:"process",label:"process",description:"Manage background processes"}]},{id:"web",label:"Web",tools:[{id:"web_search",label:"web_search",description:"Search the web"},{id:"web_fetch",label:"web_fetch",description:"Fetch web content"}]},{id:"memory",label:"Memory",tools:[{id:"memory_search",label:"memory_search",description:"Semantic search"},{id:"memory_get",label:"memory_get",description:"Read memory files"}]},{id:"sessions",label:"Sessions",tools:[{id:"sessions_list",label:"sessions_list",description:"List sessions"},{id:"sessions_history",label:"sessions_history",description:"Session history"},{id:"sessions_send",label:"sessions_send",description:"Send to session"},{id:"sessions_spawn",label:"sessions_spawn",description:"Spawn sub-agent"},{id:"session_status",label:"session_status",description:"Session status"}]},{id:"ui",label:"UI",tools:[{id:"browser",label:"browser",description:"Control web browser"},{id:"canvas",label:"canvas",description:"Control canvases"}]},{id:"messaging",label:"Messaging",tools:[{id:"message",label:"message",description:"Send messages"}]},{id:"automation",label:"Automation",tools:[{id:"cron",label:"cron",description:"Schedule tasks"},{id:"gateway",label:"gateway",description:"Gateway control"}]},{id:"nodes",label:"Nodes",tools:[{id:"nodes",label:"nodes",description:"Nodes + devices"}]},{id:"agents",label:"Agents",tools:[{id:"agents_list",label:"agents_list",description:"List agents"}]},{id:"media",label:"Media",tools:[{id:"image",label:"image",description:"Image understanding"}]}],Wg=[{id:"minimal",label:"Minimal"},{id:"coding",label:"Coding"},{id:"messaging",label:"Messaging"},{id:"full",label:"Full"}];function ri(e){return e.name?.trim()||e.identity?.name?.trim()||e.id}function $n(e){const t=e.trim();if(!t||t.length>16)return!1;let n=!1;for(let s=0;s<t.length;s+=1)if(t.charCodeAt(s)>127){n=!0;break}return!(!n||t.includes("://")||t.includes("/")||t.includes("."))}function as(e,t){const n=t?.emoji?.trim();if(n&&$n(n))return n;const s=e.identity?.emoji?.trim();if(s&&$n(s))return s;const i=t?.avatar?.trim();if(i&&$n(i))return i;const a=e.identity?.avatar?.trim();return a&&$n(a)?a:""}function cl(e,t){return t&&e===t?"default":null}function qg(e){if(e==null||!Number.isFinite(e))return"-";if(e<1024)return`${e} B`;const t=["KB","MB","GB","TB"];let n=e/1024,s=0;for(;n>=1024&&s<t.length-1;)n/=1024,s+=1;return`${n.toFixed(n<10?1:0)} ${t[s]}`}function os(e,t){const n=e;return{entry:(n?.agents?.list??[]).find(a=>a?.id===t),defaults:n?.agents?.defaults,globalTools:n?.tools}}function dl(e,t,n,s,i){const a=os(t,e.id),l=(n&&n.agentId===e.id?n.workspace:null)||a.entry?.workspace||a.defaults?.workspace||"default",c=a.entry?.model?Gt(a.entry?.model):Gt(a.defaults?.model),u=i?.name?.trim()||e.identity?.name?.trim()||e.name?.trim()||a.entry?.name||e.id,g=as(e,i)||"-",p=Array.isArray(a.entry?.skills)?a.entry?.skills:null,h=p?.length??null;return{workspace:l,model:c,identityName:u,identityEmoji:g,skillsLabel:p?`${h} selected`:"all skills",isDefault:!!(s&&e.id===s)}}function Gt(e){if(!e)return"-";if(typeof e=="string")return e.trim()||"-";if(typeof e=="object"&&e){const t=e,n=t.primary?.trim();if(n){const s=Array.isArray(t.fallbacks)?t.fallbacks.length:0;return s>0?`${n} (+${s} fallback)`:n}}return"-"}function ro(e){const t=e.match(/^(.+) \(\+\d+ fallback\)$/);return t?t[1]:e}function lo(e){if(!e)return null;if(typeof e=="string")return e.trim()||null;if(typeof e=="object"&&e){const t=e;return(typeof t.primary=="string"?t.primary:typeof t.model=="string"?t.model:typeof t.id=="string"?t.id:typeof t.value=="string"?t.value:null)?.trim()||null}return null}function Gg(e){if(!e||typeof e=="string")return null;if(typeof e=="object"&&e){const t=e,n=Array.isArray(t.fallbacks)?t.fallbacks:Array.isArray(t.fallback)?t.fallback:null;return n?n.filter(s=>typeof s=="string"):null}return null}function Vg(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function Qg(e){const n=e?.agents?.defaults?.models;if(!n||typeof n!="object")return[];const s=[];for(const[i,a]of Object.entries(n)){const o=i.trim();if(!o)continue;const l=a&&typeof a=="object"&&"alias"in a&&typeof a.alias=="string"?a.alias?.trim():void 0,c=l&&l!==o?`${l} (${o})`:o;s.push({value:o,label:c})}return s}function Yg(e,t){const n=Qg(e),s=t?n.some(i=>i.value===t):!1;return t&&!s&&n.unshift({value:t,label:`Current (${t})`}),n.length===0?r`
463
+ `}function ul(e,t){if(!e)return e;const s=e.files.some(i=>i.name===t.name)?e.files.map(i=>i.name===t.name?t:i):[...e.files,t];return{...e,files:s}}async function Ps(e,t){if(!(!e.client||!e.connected||e.agentFilesLoading)){e.agentFilesLoading=!0,e.agentFilesError=null;try{const n=await e.client.request("agents.files.list",{agentId:t});n&&(e.agentFilesList=n,e.agentFileActive&&!n.files.some(s=>s.name===e.agentFileActive)&&(e.agentFileActive=null))}catch(n){e.agentFilesError=String(n)}finally{e.agentFilesLoading=!1}}}async function Bg(e,t,n,s){if(!(!e.client||!e.connected||e.agentFilesLoading)&&!Object.hasOwn(e.agentFileContents,n)){e.agentFilesLoading=!0,e.agentFilesError=null;try{const i=await e.client.request("agents.files.get",{agentId:t,name:n});if(i?.file){const a=i.file.content??"",o=e.agentFileContents[n]??"",l=e.agentFileDrafts[n],c=s?.preserveDraft??!0;e.agentFilesList=ul(e.agentFilesList,i.file),e.agentFileContents={...e.agentFileContents,[n]:a},(!c||!Object.hasOwn(e.agentFileDrafts,n)||l===o)&&(e.agentFileDrafts={...e.agentFileDrafts,[n]:a})}}catch(i){e.agentFilesError=String(i)}finally{e.agentFilesLoading=!1}}}async function Ug(e,t,n,s){if(!(!e.client||!e.connected||e.agentFileSaving)){e.agentFileSaving=!0,e.agentFilesError=null;try{const i=await e.client.request("agents.files.set",{agentId:t,name:n,content:s});i?.file&&(e.agentFilesList=ul(e.agentFilesList,i.file),e.agentFileContents={...e.agentFileContents,[n]:s},e.agentFileDrafts={...e.agentFileDrafts,[n]:s})}catch(i){e.agentFilesError=String(i)}finally{e.agentFileSaving=!1}}}async function gl(e,t){if(!(!e.client||!e.connected)&&!e.usageLoading){e.usageLoading=!0,e.usageError=null;try{const n=t?.startDate??e.usageStartDate,s=t?.endDate??e.usageEndDate,[i,a]=await Promise.all([e.client.request("sessions.usage",{startDate:n,endDate:s,limit:1e3,includeContextWeight:!0}),e.client.request("usage.cost",{startDate:n,endDate:s})]);i&&(e.usageResult=i),a&&(e.usageCostSummary=a)}catch(n){e.usageError=String(n)}finally{e.usageLoading=!1}}}async function zg(e,t){if(!(!e.client||!e.connected)&&!e.usageTimeSeriesLoading){e.usageTimeSeriesLoading=!0,e.usageTimeSeries=null;try{const n=await e.client.request("sessions.usage.timeseries",{key:t});n&&(e.usageTimeSeries=n)}catch{e.usageTimeSeries=null}finally{e.usageTimeSeriesLoading=!1}}}async function Hg(e,t){if(!(!e.client||!e.connected)&&!e.usageSessionLogsLoading){e.usageSessionLogsLoading=!0,e.usageSessionLogs=null;try{const n=await e.client.request("sessions.usage.logs",{key:t,limit:500});n&&Array.isArray(n.logs)&&(e.usageSessionLogs=n.logs)}catch{e.usageSessionLogs=null}finally{e.usageSessionLogsLoading=!1}}}const jg={bash:"exec","apply-patch":"apply_patch"},Kg={"group:memory":["memory_search","memory_get"],"group:web":["web_search","web_fetch"],"group:fs":["read","write","edit","apply_patch"],"group:runtime":["exec","process"],"group:sessions":["sessions_list","sessions_history","sessions_send","sessions_spawn","session_status"],"group:ui":["browser","canvas"],"group:automation":["cron","gateway"],"group:messaging":["message"],"group:nodes":["nodes"],"group:openclaw":["browser","canvas","nodes","cron","message","gateway","agents_list","sessions_list","sessions_history","sessions_send","sessions_spawn","session_status","memory_search","memory_get","web_search","web_fetch","image"]},Wg={minimal:{allow:["session_status"]},coding:{allow:["group:fs","group:runtime","group:sessions","group:memory","image"]},messaging:{allow:["group:messaging","sessions_list","sessions_history","sessions_send","session_status"]},full:{}};function De(e){const t=e.trim().toLowerCase();return jg[t]??t}function qg(e){return e?e.map(De).filter(Boolean):[]}function Gg(e){const t=qg(e),n=[];for(const s of t){const i=Kg[s];if(i){n.push(...i);continue}n.push(s)}return Array.from(new Set(n))}function Vg(e){if(!e)return;const t=Wg[e];if(t&&!(!t.allow&&!t.deny))return{allow:t.allow?[...t.allow]:void 0,deny:t.deny?[...t.deny]:void 0}}function Qg(e){const t=e.host??"unknown",n=e.ip?`(${e.ip})`:"",s=e.mode??"",i=e.version??"";return`${t} ${n} ${s} ${i}`.trim()}function Yg(e){const t=e.ts??null;return t?V(t):"n/a"}function Qi(e){return e?`${vt(e)} (${V(e)})`:"n/a"}function Jg(e){if(e.totalTokens==null)return"n/a";const t=e.totalTokens??0,n=e.contextTokens??0;return n?`${t} / ${n}`:String(t)}function Zg(e){if(e==null)return"";try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Xg(e){const t=e.state??{},n=t.nextRunAtMs?vt(t.nextRunAtMs):"n/a",s=t.lastRunAtMs?vt(t.lastRunAtMs):"n/a";return`${t.lastStatus??"n/a"} · next ${n} · last ${s}`}function pl(e){const t=e.schedule;if(t.kind==="at"){const n=Date.parse(t.at);return Number.isFinite(n)?`At ${vt(n)}`:`At ${t.at}`}return t.kind==="every"?`Every ${Pi(t.everyMs)}`:`Cron ${t.expr}${t.tz?` (${t.tz})`:""}`}function ep(e){const t=e.payload;if(t.kind==="systemEvent")return`System: ${t.text}`;const n=`Agent: ${t.message}`,s=e.delivery;if(s&&s.mode!=="none"){const i=s.channel||s.to?` (${s.channel??"last"}${s.to?` -> ${s.to}`:""})`:"";return`${n} · ${s.mode}${i}`}return n}const co=[{id:"fs",label:"Files",tools:[{id:"read",label:"read",description:"Read file contents"},{id:"write",label:"write",description:"Create or overwrite files"},{id:"edit",label:"edit",description:"Make precise edits"},{id:"apply_patch",label:"apply_patch",description:"Patch files (OpenAI)"}]},{id:"runtime",label:"Runtime",tools:[{id:"exec",label:"exec",description:"Run shell commands"},{id:"process",label:"process",description:"Manage background processes"}]},{id:"web",label:"Web",tools:[{id:"web_search",label:"web_search",description:"Search the web"},{id:"web_fetch",label:"web_fetch",description:"Fetch web content"}]},{id:"memory",label:"Memory",tools:[{id:"memory_search",label:"memory_search",description:"Semantic search"},{id:"memory_get",label:"memory_get",description:"Read memory files"}]},{id:"sessions",label:"Sessions",tools:[{id:"sessions_list",label:"sessions_list",description:"List sessions"},{id:"sessions_history",label:"sessions_history",description:"Session history"},{id:"sessions_send",label:"sessions_send",description:"Send to session"},{id:"sessions_spawn",label:"sessions_spawn",description:"Spawn sub-agent"},{id:"session_status",label:"session_status",description:"Session status"}]},{id:"ui",label:"UI",tools:[{id:"browser",label:"browser",description:"Control web browser"},{id:"canvas",label:"canvas",description:"Control canvases"}]},{id:"messaging",label:"Messaging",tools:[{id:"message",label:"message",description:"Send messages"}]},{id:"automation",label:"Automation",tools:[{id:"cron",label:"cron",description:"Schedule tasks"},{id:"gateway",label:"gateway",description:"Gateway control"}]},{id:"nodes",label:"Nodes",tools:[{id:"nodes",label:"nodes",description:"Nodes + devices"}]},{id:"agents",label:"Agents",tools:[{id:"agents_list",label:"agents_list",description:"List agents"}]},{id:"media",label:"Media",tools:[{id:"image",label:"image",description:"Image understanding"}]}],tp=[{id:"minimal",label:"Minimal"},{id:"coding",label:"Coding"},{id:"messaging",label:"Messaging"},{id:"full",label:"Full"}];function ri(e){return e.name?.trim()||e.identity?.name?.trim()||e.id}function kn(e){const t=e.trim();if(!t||t.length>16)return!1;let n=!1;for(let s=0;s<t.length;s+=1)if(t.charCodeAt(s)>127){n=!0;break}return!(!n||t.includes("://")||t.includes("/")||t.includes("."))}function rs(e,t){const n=t?.emoji?.trim();if(n&&kn(n))return n;const s=e.identity?.emoji?.trim();if(s&&kn(s))return s;const i=t?.avatar?.trim();if(i&&kn(i))return i;const a=e.identity?.avatar?.trim();return a&&kn(a)?a:""}function fl(e,t){return t&&e===t?"default":null}function np(e){if(e==null||!Number.isFinite(e))return"-";if(e<1024)return`${e} B`;const t=["KB","MB","GB","TB"];let n=e/1024,s=0;for(;n>=1024&&s<t.length-1;)n/=1024,s+=1;return`${n.toFixed(n<10?1:0)} ${t[s]}`}function ls(e,t){const n=e;return{entry:(n?.agents?.list??[]).find(a=>a?.id===t),defaults:n?.agents?.defaults,globalTools:n?.tools}}function hl(e,t,n,s,i){const a=ls(t,e.id),l=(n&&n.agentId===e.id?n.workspace:null)||a.entry?.workspace||a.defaults?.workspace||"default",c=a.entry?.model?Vt(a.entry?.model):Vt(a.defaults?.model),u=i?.name?.trim()||e.identity?.name?.trim()||e.name?.trim()||a.entry?.name||e.id,g=rs(e,i)||"-",p=Array.isArray(a.entry?.skills)?a.entry?.skills:null,h=p?.length??null;return{workspace:l,model:c,identityName:u,identityEmoji:g,skillsLabel:p?`${h} selected`:"all skills",isDefault:!!(s&&e.id===s)}}function Vt(e){if(!e)return"-";if(typeof e=="string")return e.trim()||"-";if(typeof e=="object"&&e){const t=e,n=t.primary?.trim();if(n){const s=Array.isArray(t.fallbacks)?t.fallbacks.length:0;return s>0?`${n} (+${s} fallback)`:n}}return"-"}function uo(e){const t=e.match(/^(.+) \(\+\d+ fallback\)$/);return t?t[1]:e}function go(e){if(!e)return null;if(typeof e=="string")return e.trim()||null;if(typeof e=="object"&&e){const t=e;return(typeof t.primary=="string"?t.primary:typeof t.model=="string"?t.model:typeof t.id=="string"?t.id:typeof t.value=="string"?t.value:null)?.trim()||null}return null}function sp(e){if(!e||typeof e=="string")return null;if(typeof e=="object"&&e){const t=e,n=Array.isArray(t.fallbacks)?t.fallbacks:Array.isArray(t.fallback)?t.fallback:null;return n?n.filter(s=>typeof s=="string"):null}return null}function ip(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function ap(e){const n=e?.agents?.defaults?.models;if(!n||typeof n!="object")return[];const s=[];for(const[i,a]of Object.entries(n)){const o=i.trim();if(!o)continue;const l=a&&typeof a=="object"&&"alias"in a&&typeof a.alias=="string"?a.alias?.trim():void 0,c=l&&l!==o?`${l} (${o})`:o;s.push({value:o,label:c})}return s}function op(e,t){const n=ap(e),s=t?n.some(i=>i.value===t):!1;return t&&!s&&n.unshift({value:t,label:`Current (${t})`}),n.length===0?r`
464
464
  <option value="" disabled>No configured models</option>
465
- `:n.map(i=>r`<option value=${i.value}>${i.label}</option>`)}function Jg(e){const t=Pe(e);if(!t)return{kind:"exact",value:""};if(t==="*")return{kind:"all"};if(!t.includes("*"))return{kind:"exact",value:t};const n=t.replace(/[.*+?^${}()|[\\]\\]/g,"\\$&");return{kind:"regex",value:new RegExp(`^${n.replaceAll("\\*",".*")}$`)}}function li(e){return Array.isArray(e)?Ng(e).map(Jg).filter(t=>t.kind!=="exact"||t.value.length>0):[]}function Vt(e,t){for(const n of t)if(n.kind==="all"||n.kind==="exact"&&e===n.value||n.kind==="regex"&&n.value.test(e))return!0;return!1}function Zg(e,t){if(!t)return!0;const n=Pe(e),s=li(t.deny);if(Vt(n,s))return!1;const i=li(t.allow);return!!(i.length===0||Vt(n,i)||n==="apply_patch"&&Vt("exec",i))}function co(e,t){if(!Array.isArray(t)||t.length===0)return!1;const n=Pe(e),s=li(t);return!!(Vt(n,s)||n==="apply_patch"&&Vt("exec",s))}function Xg(e){const t=e.agentsList?.agents??[],n=e.agentsList?.defaultId??null,s=e.selectedAgentId??n??t[0]?.id??null,i=s?t.find(a=>a.id===s)??null:null;return r`
465
+ `:n.map(i=>r`<option value=${i.value}>${i.label}</option>`)}function rp(e){const t=De(e);if(!t)return{kind:"exact",value:""};if(t==="*")return{kind:"all"};if(!t.includes("*"))return{kind:"exact",value:t};const n=t.replace(/[.*+?^${}()|[\\]\\]/g,"\\$&");return{kind:"regex",value:new RegExp(`^${n.replaceAll("\\*",".*")}$`)}}function li(e){return Array.isArray(e)?Gg(e).map(rp).filter(t=>t.kind!=="exact"||t.value.length>0):[]}function Qt(e,t){for(const n of t)if(n.kind==="all"||n.kind==="exact"&&e===n.value||n.kind==="regex"&&n.value.test(e))return!0;return!1}function lp(e,t){if(!t)return!0;const n=De(e),s=li(t.deny);if(Qt(n,s))return!1;const i=li(t.allow);return!!(i.length===0||Qt(n,i)||n==="apply_patch"&&Qt("exec",i))}function po(e,t){if(!Array.isArray(t)||t.length===0)return!1;const n=De(e),s=li(t);return!!(Qt(n,s)||n==="apply_patch"&&Qt("exec",s))}function cp(e){const t=e.agentsList?.agents??[],n=e.agentsList?.defaultId??null,s=e.selectedAgentId??n??t[0]?.id??null,i=s?t.find(a=>a.id===s)??null:null;return r`
466
466
  <div class="agents-layout">
467
467
  <section class="card agents-sidebar">
468
468
  <div class="row" style="justify-content: space-between;">
@@ -478,7 +478,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
478
478
  <div class="agent-list" style="margin-top: 12px;">
479
479
  ${t.length===0?r`
480
480
  <div class="muted">No agents found.</div>
481
- `:t.map(a=>{const o=cl(a.id,n),l=as(a,e.agentIdentityById[a.id]??null);return r`
481
+ `:t.map(a=>{const o=fl(a.id,n),l=rs(a,e.agentIdentityById[a.id]??null);return r`
482
482
  <button
483
483
  type="button"
484
484
  class="agent-row ${s===a.id?"active":""}"
@@ -498,14 +498,14 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
498
498
  </section>
499
499
  <section class="agents-main">
500
500
  ${i?r`
501
- ${ep(i,n,e.agentIdentityById[i.id]??null)}
502
- ${tp(e.activePanel,a=>e.onSelectPanel(a))}
503
- ${e.activePanel==="overview"?np({agent:i,defaultId:n,configForm:e.configForm,agentFilesList:e.agentFilesList,agentIdentity:e.agentIdentityById[i.id]??null,agentIdentityError:e.agentIdentityError,agentIdentityLoading:e.agentIdentityLoading,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configDirty,onConfigReload:e.onConfigReload,onConfigSave:e.onConfigSave,onModelChange:e.onModelChange,onModelFallbacksChange:e.onModelFallbacksChange}):v}
504
- ${e.activePanel==="files"?gp({agentId:i.id,agentFilesList:e.agentFilesList,agentFilesLoading:e.agentFilesLoading,agentFilesError:e.agentFilesError,agentFileActive:e.agentFileActive,agentFileContents:e.agentFileContents,agentFileDrafts:e.agentFileDrafts,agentFileSaving:e.agentFileSaving,onLoadFiles:e.onLoadFiles,onSelectFile:e.onSelectFile,onFileDraftChange:e.onFileDraftChange,onFileReset:e.onFileReset,onFileSave:e.onFileSave}):v}
505
- ${e.activePanel==="tools"?fp({agentId:i.id,configForm:e.configForm,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configDirty,onProfileChange:e.onToolsProfileChange,onOverridesChange:e.onToolsOverridesChange,onConfigReload:e.onConfigReload,onConfigSave:e.onConfigSave}):v}
506
- ${e.activePanel==="skills"?vp({agentId:i.id,report:e.agentSkillsReport,loading:e.agentSkillsLoading,error:e.agentSkillsError,activeAgentId:e.agentSkillsAgentId,configForm:e.configForm,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configDirty,filter:e.skillsFilter,onFilterChange:e.onSkillsFilterChange,onRefresh:e.onSkillsRefresh,onToggle:e.onAgentSkillToggle,onClear:e.onAgentSkillsClear,onDisableAll:e.onAgentSkillsDisableAll,onConfigReload:e.onConfigReload,onConfigSave:e.onConfigSave}):v}
507
- ${e.activePanel==="channels"?dp({agent:i,defaultId:n,configForm:e.configForm,agentFilesList:e.agentFilesList,agentIdentity:e.agentIdentityById[i.id]??null,snapshot:e.channelsSnapshot,loading:e.channelsLoading,error:e.channelsError,lastSuccess:e.channelsLastSuccess,onRefresh:e.onChannelsRefresh}):v}
508
- ${e.activePanel==="cron"?up({agent:i,defaultId:n,configForm:e.configForm,agentFilesList:e.agentFilesList,agentIdentity:e.agentIdentityById[i.id]??null,jobs:e.cronJobs,status:e.cronStatus,loading:e.cronLoading,error:e.cronError,onRefresh:e.onCronRefresh}):v}
501
+ ${dp(i,n,e.agentIdentityById[i.id]??null)}
502
+ ${up(e.activePanel,a=>e.onSelectPanel(a))}
503
+ ${e.activePanel==="overview"?gp({agent:i,defaultId:n,configForm:e.configForm,agentFilesList:e.agentFilesList,agentIdentity:e.agentIdentityById[i.id]??null,agentIdentityError:e.agentIdentityError,agentIdentityLoading:e.agentIdentityLoading,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configDirty,onConfigReload:e.onConfigReload,onConfigSave:e.onConfigSave,onModelChange:e.onModelChange,onModelFallbacksChange:e.onModelFallbacksChange}):v}
504
+ ${e.activePanel==="files"?wp({agentId:i.id,agentFilesList:e.agentFilesList,agentFilesLoading:e.agentFilesLoading,agentFilesError:e.agentFilesError,agentFileActive:e.agentFileActive,agentFileContents:e.agentFileContents,agentFileDrafts:e.agentFileDrafts,agentFileSaving:e.agentFileSaving,onLoadFiles:e.onLoadFiles,onSelectFile:e.onSelectFile,onFileDraftChange:e.onFileDraftChange,onFileReset:e.onFileReset,onFileSave:e.onFileSave}):v}
505
+ ${e.activePanel==="tools"?Sp({agentId:i.id,configForm:e.configForm,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configDirty,onProfileChange:e.onToolsProfileChange,onOverridesChange:e.onToolsOverridesChange,onConfigReload:e.onConfigReload,onConfigSave:e.onConfigSave}):v}
506
+ ${e.activePanel==="skills"?Cp({agentId:i.id,report:e.agentSkillsReport,loading:e.agentSkillsLoading,error:e.agentSkillsError,activeAgentId:e.agentSkillsAgentId,configForm:e.configForm,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configDirty,filter:e.skillsFilter,onFilterChange:e.onSkillsFilterChange,onRefresh:e.onSkillsRefresh,onToggle:e.onAgentSkillToggle,onClear:e.onAgentSkillsClear,onDisableAll:e.onAgentSkillsDisableAll,onConfigReload:e.onConfigReload,onConfigSave:e.onConfigSave}):v}
507
+ ${e.activePanel==="channels"?xp({agent:i,defaultId:n,configForm:e.configForm,agentFilesList:e.agentFilesList,agentIdentity:e.agentIdentityById[i.id]??null,snapshot:e.channelsSnapshot,loading:e.channelsLoading,error:e.channelsError,lastSuccess:e.channelsLastSuccess,onRefresh:e.onChannelsRefresh}):v}
508
+ ${e.activePanel==="cron"?$p({agent:i,defaultId:n,configForm:e.configForm,agentFilesList:e.agentFilesList,agentIdentity:e.agentIdentityById[i.id]??null,jobs:e.cronJobs,status:e.cronStatus,loading:e.cronLoading,error:e.cronError,onRefresh:e.onCronRefresh}):v}
509
509
  `:r`
510
510
  <div class="card">
511
511
  <div class="card-title">Select an agent</div>
@@ -514,7 +514,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
514
514
  `}
515
515
  </section>
516
516
  </div>
517
- `}function ep(e,t,n){const s=cl(e.id,t),i=ri(e),a=e.identity?.theme?.trim()||"Agent workspace and routing.",o=as(e,n);return r`
517
+ `}function dp(e,t,n){const s=fl(e.id,t),i=ri(e),a=e.identity?.theme?.trim()||"Agent workspace and routing.",o=rs(e,n);return r`
518
518
  <section class="card agent-header">
519
519
  <div class="agent-header-main">
520
520
  <div class="agent-avatar agent-avatar--lg">
@@ -530,7 +530,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
530
530
  ${s?r`<span class="agent-pill">${s}</span>`:v}
531
531
  </div>
532
532
  </section>
533
- `}function tp(e,t){return r`
533
+ `}function up(e,t){return r`
534
534
  <div class="agent-tabs">
535
535
  ${[{id:"overview",label:"Overview"},{id:"files",label:"Files"},{id:"tools",label:"Tools"},{id:"skills",label:"Skills"},{id:"channels",label:"Channels"},{id:"cron",label:"Cron Jobs"}].map(s=>r`
536
536
  <button
@@ -542,7 +542,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
542
542
  </button>
543
543
  `)}
544
544
  </div>
545
- `}function np(e){const{agent:t,configForm:n,agentFilesList:s,agentIdentity:i,agentIdentityLoading:a,agentIdentityError:o,configLoading:l,configSaving:c,configDirty:u,onConfigReload:g,onConfigSave:p,onModelChange:h,onModelFallbacksChange:d}=e,f=os(n,t.id),S=(s&&s.agentId===t.id?s.workspace:null)||f.entry?.workspace||f.defaults?.workspace||"default",k=f.entry?.model?Gt(f.entry?.model):Gt(f.defaults?.model),$=Gt(f.defaults?.model),A=lo(f.entry?.model)||(k!=="-"?ro(k):null),C=lo(f.defaults?.model)||($!=="-"?ro($):null),_=A??C??null,T=Gg(f.entry?.model),I=T?T.join(", "):"",z=i?.name?.trim()||t.identity?.name?.trim()||t.name?.trim()||f.entry?.name||"-",se=as(t,i)||"-",F=Array.isArray(f.entry?.skills)?f.entry?.skills:null,H=F?.length??null,ce=a?"Loading…":o?"Unavailable":"",E=!!(e.defaultId&&t.id===e.defaultId);return r`
545
+ `}function gp(e){const{agent:t,configForm:n,agentFilesList:s,agentIdentity:i,agentIdentityLoading:a,agentIdentityError:o,configLoading:l,configSaving:c,configDirty:u,onConfigReload:g,onConfigSave:p,onModelChange:h,onModelFallbacksChange:d}=e,f=ls(n,t.id),S=(s&&s.agentId===t.id?s.workspace:null)||f.entry?.workspace||f.defaults?.workspace||"default",k=f.entry?.model?Vt(f.entry?.model):Vt(f.defaults?.model),$=Vt(f.defaults?.model),A=go(f.entry?.model)||(k!=="-"?uo(k):null),C=go(f.defaults?.model)||($!=="-"?uo($):null),_=A??C??null,T=sp(f.entry?.model),I=T?T.join(", "):"",z=i?.name?.trim()||t.identity?.name?.trim()||t.name?.trim()||f.entry?.name||"-",se=rs(t,i)||"-",F=Array.isArray(f.entry?.skills)?f.entry?.skills:null,H=F?.length??null,ce=a?"Loading…":o?"Unavailable":"",E=!!(e.defaultId&&t.id===e.defaultId);return r`
546
546
  <section class="card">
547
547
  <div class="card-title">Overview</div>
548
548
  <div class="card-sub">Workspace paths and identity metadata.</div>
@@ -589,7 +589,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
589
589
  ${C?`Inherit default (${C})`:"Inherit default"}
590
590
  </option>
591
591
  `}
592
- ${Yg(n,_??void 0)}
592
+ ${op(n,_??void 0)}
593
593
  </select>
594
594
  </label>
595
595
  <label class="field" style="min-width: 260px; flex: 1;">
@@ -598,7 +598,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
598
598
  .value=${I}
599
599
  ?disabled=${!n||l||c}
600
600
  placeholder="provider/model, provider/model"
601
- @input=${B=>d(t.id,Vg(B.target.value))}
601
+ @input=${B=>d(t.id,ip(B.target.value))}
602
602
  />
603
603
  </label>
604
604
  </div>
@@ -620,7 +620,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
620
620
  </div>
621
621
  </div>
622
622
  </section>
623
- `}function ul(e,t){return r`
623
+ `}function vl(e,t){return r`
624
624
  <section class="card">
625
625
  <div class="card-title">Agent Context</div>
626
626
  <div class="card-sub">${t}</div>
@@ -651,9 +651,9 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
651
651
  </div>
652
652
  </div>
653
653
  </section>
654
- `}function sp(e,t){const n=e.channelMeta?.find(s=>s.id===t);return n?.label?n.label:e.channelLabels?.[t]??t}function ip(e){if(!e)return[];const t=new Set;for(const i of e.channelOrder??[])t.add(i);for(const i of e.channelMeta??[])t.add(i.id);for(const i of Object.keys(e.channelAccounts??{}))t.add(i);const n=[],s=e.channelOrder?.length?e.channelOrder:Array.from(t);for(const i of s)t.has(i)&&(n.push(i),t.delete(i));for(const i of t)n.push(i);return n.map(i=>({id:i,label:sp(e,i),accounts:e.channelAccounts?.[i]??[]}))}const ap=["groupPolicy","streamMode","dmPolicy"];function op(e,t){if(!e)return null;const s=(e.channels??{})[t];if(s&&typeof s=="object")return s;const i=e[t];return i&&typeof i=="object"?i:null}function rp(e){if(e==null)return"n/a";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return"n/a"}}function lp(e,t){const n=op(e,t);return n?ap.flatMap(s=>s in n?[{label:s,value:rp(n[s])}]:[]):[]}function cp(e){let t=0,n=0,s=0;for(const i of e){const a=i.probe&&typeof i.probe=="object"&&"ok"in i.probe?!!i.probe.ok:!1;(i.connected===!0||i.running===!0||a)&&(t+=1),i.configured&&(n+=1),i.enabled&&(s+=1)}return{total:e.length,connected:t,configured:n,enabled:s}}function dp(e){const t=dl(e.agent,e.configForm,e.agentFilesList,e.defaultId,e.agentIdentity),n=ip(e.snapshot),s=e.lastSuccess?V(e.lastSuccess):"never";return r`
654
+ `}function pp(e,t){const n=e.channelMeta?.find(s=>s.id===t);return n?.label?n.label:e.channelLabels?.[t]??t}function fp(e){if(!e)return[];const t=new Set;for(const i of e.channelOrder??[])t.add(i);for(const i of e.channelMeta??[])t.add(i.id);for(const i of Object.keys(e.channelAccounts??{}))t.add(i);const n=[],s=e.channelOrder?.length?e.channelOrder:Array.from(t);for(const i of s)t.has(i)&&(n.push(i),t.delete(i));for(const i of t)n.push(i);return n.map(i=>({id:i,label:pp(e,i),accounts:e.channelAccounts?.[i]??[]}))}const hp=["groupPolicy","streamMode","dmPolicy"];function vp(e,t){if(!e)return null;const s=(e.channels??{})[t];if(s&&typeof s=="object")return s;const i=e[t];return i&&typeof i=="object"?i:null}function mp(e){if(e==null)return"n/a";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return"n/a"}}function bp(e,t){const n=vp(e,t);return n?hp.flatMap(s=>s in n?[{label:s,value:mp(n[s])}]:[]):[]}function yp(e){let t=0,n=0,s=0;for(const i of e){const a=i.probe&&typeof i.probe=="object"&&"ok"in i.probe?!!i.probe.ok:!1;(i.connected===!0||i.running===!0||a)&&(t+=1),i.configured&&(n+=1),i.enabled&&(s+=1)}return{total:e.length,connected:t,configured:n,enabled:s}}function xp(e){const t=hl(e.agent,e.configForm,e.agentFilesList,e.defaultId,e.agentIdentity),n=fp(e.snapshot),s=e.lastSuccess?V(e.lastSuccess):"never";return r`
655
655
  <section class="grid grid-cols-2">
656
- ${ul(t,"Workspace, identity, and model configuration.")}
656
+ ${vl(t,"Workspace, identity, and model configuration.")}
657
657
  <section class="card">
658
658
  <div class="row" style="justify-content: space-between;">
659
659
  <div>
@@ -675,7 +675,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
675
675
  <div class="muted" style="margin-top: 16px">No channels found.</div>
676
676
  `:r`
677
677
  <div class="list" style="margin-top: 16px;">
678
- ${n.map(i=>{const a=cp(i.accounts),o=a.total?`${a.connected}/${a.total} connected`:"no accounts",l=a.configured?`${a.configured} configured`:"not configured",c=a.total?`${a.enabled} enabled`:"disabled",u=lp(e.configForm,i.id);return r`
678
+ ${n.map(i=>{const a=yp(i.accounts),o=a.total?`${a.connected}/${a.total} connected`:"no accounts",l=a.configured?`${a.configured} configured`:"not configured",c=a.total?`${a.enabled} enabled`:"disabled",u=bp(e.configForm,i.id);return r`
679
679
  <div class="list-item">
680
680
  <div class="list-main">
681
681
  <div class="list-title">${i.label}</div>
@@ -693,9 +693,9 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
693
693
  `}
694
694
  </section>
695
695
  </section>
696
- `}function up(e){const t=dl(e.agent,e.configForm,e.agentFilesList,e.defaultId,e.agentIdentity),n=e.jobs.filter(s=>s.agentId===e.agent.id);return r`
696
+ `}function $p(e){const t=hl(e.agent,e.configForm,e.agentFilesList,e.defaultId,e.agentIdentity),n=e.jobs.filter(s=>s.agentId===e.agent.id);return r`
697
697
  <section class="grid grid-cols-2">
698
- ${ul(t,"Workspace and scheduling targets.")}
698
+ ${vl(t,"Workspace and scheduling targets.")}
699
699
  <section class="card">
700
700
  <div class="row" style="justify-content: space-between;">
701
701
  <div>
@@ -719,7 +719,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
719
719
  </div>
720
720
  <div class="stat">
721
721
  <div class="stat-label">Next wake</div>
722
- <div class="stat-value">${Vi(e.status?.nextWakeAtMs??null)}</div>
722
+ <div class="stat-value">${Qi(e.status?.nextWakeAtMs??null)}</div>
723
723
  </div>
724
724
  </div>
725
725
  ${e.error?r`<div class="callout danger" style="margin-top: 12px;">${e.error}</div>`:v}
@@ -738,7 +738,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
738
738
  <div class="list-title">${s.name}</div>
739
739
  ${s.description?r`<div class="list-sub">${s.description}</div>`:v}
740
740
  <div class="chip-row" style="margin-top: 6px;">
741
- <span class="chip">${ll(s)}</span>
741
+ <span class="chip">${pl(s)}</span>
742
742
  <span class="chip ${s.enabled?"chip-ok":"chip-warn"}">
743
743
  ${s.enabled?"enabled":"disabled"}
744
744
  </span>
@@ -746,15 +746,15 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
746
746
  </div>
747
747
  </div>
748
748
  <div class="list-meta">
749
- <div class="mono">${jg(s)}</div>
750
- <div class="muted">${Kg(s)}</div>
749
+ <div class="mono">${Xg(s)}</div>
750
+ <div class="muted">${ep(s)}</div>
751
751
  </div>
752
752
  </div>
753
753
  `)}
754
754
  </div>
755
755
  `}
756
756
  </section>
757
- `}function gp(e){const t=e.agentFilesList?.agentId===e.agentId?e.agentFilesList:null,n=t?.files??[],s=e.agentFileActive??null,i=s?n.find(c=>c.name===s)??null:null,a=s?e.agentFileContents[s]??"":"",o=s?e.agentFileDrafts[s]??a:"",l=s?o!==a:!1;return r`
757
+ `}function wp(e){const t=e.agentFilesList?.agentId===e.agentId?e.agentFilesList:null,n=t?.files??[],s=e.agentFileActive??null,i=s?n.find(c=>c.name===s)??null:null,a=s?e.agentFileContents[s]??"":"",o=s?e.agentFileDrafts[s]??a:"",l=s?o!==a:!1;return r`
758
758
  <section class="card">
759
759
  <div class="row" style="justify-content: space-between;">
760
760
  <div>
@@ -776,7 +776,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
776
776
  <div class="agent-files-list">
777
777
  ${n.length===0?r`
778
778
  <div class="muted">No files found.</div>
779
- `:n.map(c=>pp(c,s,()=>e.onSelectFile(c.name)))}
779
+ `:n.map(c=>kp(c,s,()=>e.onSelectFile(c.name)))}
780
780
  </div>
781
781
  <div class="agent-files-editor">
782
782
  ${i?r`
@@ -825,7 +825,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
825
825
  </div>
826
826
  `}
827
827
  </section>
828
- `}function pp(e,t,n){const s=e.missing?"Missing":`${qg(e.size)} · ${V(e.updatedAtMs??null)}`;return r`
828
+ `}function kp(e,t,n){const s=e.missing?"Missing":`${np(e.size)} · ${V(e.updatedAtMs??null)}`;return r`
829
829
  <button
830
830
  type="button"
831
831
  class="agent-file-row ${t===e.name?"active":""}"
@@ -839,7 +839,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
839
839
  <span class="agent-pill warn">missing</span>
840
840
  `:v}
841
841
  </button>
842
- `}function fp(e){const t=os(e.configForm,e.agentId),n=t.entry?.tools??{},s=t.globalTools??{},i=n.profile??s.profile??"full",a=n.profile?"agent override":s.profile?"global default":"default",o=Array.isArray(n.allow)&&n.allow.length>0,l=Array.isArray(s.allow)&&s.allow.length>0,c=!!e.configForm&&!e.configLoading&&!e.configSaving&&!o,u=o?[]:Array.isArray(n.alsoAllow)?n.alsoAllow:[],g=o?[]:Array.isArray(n.deny)?n.deny:[],p=o?{allow:n.allow??[],deny:n.deny??[]}:Og(i)??void 0,h=oo.flatMap(k=>k.tools.map($=>$.id)),d=k=>{const $=Zg(k,p),A=co(k,u),C=co(k,g);return{allowed:($||A)&&!C,baseAllowed:$,denied:C}},f=h.filter(k=>d(k).allowed).length,m=(k,$)=>{const A=new Set(u.map(I=>Pe(I)).filter(I=>I.length>0)),C=new Set(g.map(I=>Pe(I)).filter(I=>I.length>0)),_=d(k).baseAllowed,T=Pe(k);$?(C.delete(T),_||A.add(T)):(A.delete(T),C.add(T)),e.onOverridesChange(e.agentId,[...A],[...C])},S=k=>{const $=new Set(u.map(C=>Pe(C)).filter(C=>C.length>0)),A=new Set(g.map(C=>Pe(C)).filter(C=>C.length>0));for(const C of h){const _=d(C).baseAllowed,T=Pe(C);k?(A.delete(T),_||$.add(T)):($.delete(T),A.add(T))}e.onOverridesChange(e.agentId,[...$],[...A])};return r`
842
+ `}function Sp(e){const t=ls(e.configForm,e.agentId),n=t.entry?.tools??{},s=t.globalTools??{},i=n.profile??s.profile??"full",a=n.profile?"agent override":s.profile?"global default":"default",o=Array.isArray(n.allow)&&n.allow.length>0,l=Array.isArray(s.allow)&&s.allow.length>0,c=!!e.configForm&&!e.configLoading&&!e.configSaving&&!o,u=o?[]:Array.isArray(n.alsoAllow)?n.alsoAllow:[],g=o?[]:Array.isArray(n.deny)?n.deny:[],p=o?{allow:n.allow??[],deny:n.deny??[]}:Vg(i)??void 0,h=co.flatMap(k=>k.tools.map($=>$.id)),d=k=>{const $=lp(k,p),A=po(k,u),C=po(k,g);return{allowed:($||A)&&!C,baseAllowed:$,denied:C}},f=h.filter(k=>d(k).allowed).length,m=(k,$)=>{const A=new Set(u.map(I=>De(I)).filter(I=>I.length>0)),C=new Set(g.map(I=>De(I)).filter(I=>I.length>0)),_=d(k).baseAllowed,T=De(k);$?(C.delete(T),_||A.add(T)):(A.delete(T),C.add(T)),e.onOverridesChange(e.agentId,[...A],[...C])},S=k=>{const $=new Set(u.map(C=>De(C)).filter(C=>C.length>0)),A=new Set(g.map(C=>De(C)).filter(C=>C.length>0));for(const C of h){const _=d(C).baseAllowed,T=De(C);k?(A.delete(T),_||$.add(T)):($.delete(T),A.add(T))}e.onOverridesChange(e.agentId,[...$],[...A])};return r`
843
843
  <section class="card">
844
844
  <div class="row" style="justify-content: space-between;">
845
845
  <div>
@@ -917,7 +917,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
917
917
  <div class="agent-tools-presets" style="margin-top: 16px;">
918
918
  <div class="label">Quick Presets</div>
919
919
  <div class="agent-tools-buttons">
920
- ${Wg.map(k=>r`
920
+ ${tp.map(k=>r`
921
921
  <button
922
922
  class="btn btn--sm ${i===k.id?"active":""}"
923
923
  ?disabled=${!c}
@@ -937,7 +937,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
937
937
  </div>
938
938
 
939
939
  <div class="agent-tools-grid" style="margin-top: 20px;">
940
- ${oo.map(k=>r`
940
+ ${co.map(k=>r`
941
941
  <div class="agent-tools-section">
942
942
  <div class="agent-tools-header">${k.label}</div>
943
943
  <div class="agent-tools-list">
@@ -963,7 +963,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
963
963
  `)}
964
964
  </div>
965
965
  </section>
966
- `}const wn=[{id:"workspace",label:"Workspace Skills",sources:["openclaw-workspace"]},{id:"built-in",label:"Built-in Skills",sources:["openclaw-bundled"]},{id:"installed",label:"Installed Skills",sources:["openclaw-managed"]},{id:"extra",label:"Extra Skills",sources:["openclaw-extra"]}];function hp(e){const t=new Map;for(const a of wn)t.set(a.id,{id:a.id,label:a.label,skills:[]});const n=wn.find(a=>a.id==="built-in"),s={id:"other",label:"Other Skills",skills:[]};for(const a of e){const o=a.bundled?n:wn.find(l=>l.sources.includes(a.source));o?t.get(o.id)?.skills.push(a):s.skills.push(a)}const i=wn.map(a=>t.get(a.id)).filter(a=>!!(a&&a.skills.length>0));return s.skills.length>0&&i.push(s),i}function vp(e){const t=!!e.configForm&&!e.configLoading&&!e.configSaving,n=os(e.configForm,e.agentId),s=Array.isArray(n.entry?.skills)?n.entry?.skills:void 0,i=new Set((s??[]).map(d=>d.trim()).filter(Boolean)),a=s!==void 0,o=!!(e.report&&e.activeAgentId===e.agentId),l=o?e.report?.skills??[]:[],c=e.filter.trim().toLowerCase(),u=c?l.filter(d=>[d.name,d.description,d.source].join(" ").toLowerCase().includes(c)):l,g=hp(u),p=a?l.filter(d=>i.has(d.name)).length:l.length,h=l.length;return r`
966
+ `}const Sn=[{id:"workspace",label:"Workspace Skills",sources:["openclaw-workspace"]},{id:"built-in",label:"Built-in Skills",sources:["openclaw-bundled"]},{id:"installed",label:"Installed Skills",sources:["openclaw-managed"]},{id:"extra",label:"Extra Skills",sources:["openclaw-extra"]}];function Ap(e){const t=new Map;for(const a of Sn)t.set(a.id,{id:a.id,label:a.label,skills:[]});const n=Sn.find(a=>a.id==="built-in"),s={id:"other",label:"Other Skills",skills:[]};for(const a of e){const o=a.bundled?n:Sn.find(l=>l.sources.includes(a.source));o?t.get(o.id)?.skills.push(a):s.skills.push(a)}const i=Sn.map(a=>t.get(a.id)).filter(a=>!!(a&&a.skills.length>0));return s.skills.length>0&&i.push(s),i}function Cp(e){const t=!!e.configForm&&!e.configLoading&&!e.configSaving,n=ls(e.configForm,e.agentId),s=Array.isArray(n.entry?.skills)?n.entry?.skills:void 0,i=new Set((s??[]).map(d=>d.trim()).filter(Boolean)),a=s!==void 0,o=!!(e.report&&e.activeAgentId===e.agentId),l=o?e.report?.skills??[]:[],c=e.filter.trim().toLowerCase(),u=c?l.filter(d=>[d.name,d.description,d.source].join(" ").toLowerCase().includes(c)):l,g=Ap(u),p=a?l.filter(d=>i.has(d.name)).length:l.length,h=l.length;return r`
967
967
  <section class="card">
968
968
  <div class="row" style="justify-content: space-between;">
969
969
  <div>
@@ -1035,21 +1035,21 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1035
1035
  <div class="muted" style="margin-top: 16px">No skills found.</div>
1036
1036
  `:r`
1037
1037
  <div class="agent-skills-groups" style="margin-top: 16px;">
1038
- ${g.map(d=>mp(d,{agentId:e.agentId,allowSet:i,usingAllowlist:a,editable:t,onToggle:e.onToggle}))}
1038
+ ${g.map(d=>Tp(d,{agentId:e.agentId,allowSet:i,usingAllowlist:a,editable:t,onToggle:e.onToggle}))}
1039
1039
  </div>
1040
1040
  `}
1041
1041
  </section>
1042
- `}function mp(e,t){const n=e.id==="workspace"||e.id==="built-in";return r`
1042
+ `}function Tp(e,t){const n=e.id==="workspace"||e.id==="built-in";return r`
1043
1043
  <details class="agent-skills-group" ?open=${!n}>
1044
1044
  <summary class="agent-skills-header">
1045
1045
  <span>${e.label}</span>
1046
1046
  <span class="muted">${e.skills.length}</span>
1047
1047
  </summary>
1048
1048
  <div class="list skills-grid">
1049
- ${e.skills.map(s=>bp(s,{agentId:t.agentId,allowSet:t.allowSet,usingAllowlist:t.usingAllowlist,editable:t.editable,onToggle:t.onToggle}))}
1049
+ ${e.skills.map(s=>_p(s,{agentId:t.agentId,allowSet:t.allowSet,usingAllowlist:t.usingAllowlist,editable:t.editable,onToggle:t.onToggle}))}
1050
1050
  </div>
1051
1051
  </details>
1052
- `}function bp(e,t){const n=t.usingAllowlist?t.allowSet.has(e.name):!0,s=[...e.missing.bins.map(a=>`bin:${a}`),...e.missing.env.map(a=>`env:${a}`),...e.missing.config.map(a=>`config:${a}`),...e.missing.os.map(a=>`os:${a}`)],i=[];return e.disabled&&i.push("disabled"),e.blockedByAllowlist&&i.push("blocked by allowlist"),r`
1052
+ `}function _p(e,t){const n=t.usingAllowlist?t.allowSet.has(e.name):!0,s=[...e.missing.bins.map(a=>`bin:${a}`),...e.missing.env.map(a=>`env:${a}`),...e.missing.config.map(a=>`config:${a}`),...e.missing.os.map(a=>`os:${a}`)],i=[];return e.disabled&&i.push("disabled"),e.blockedByAllowlist&&i.push("blocked by allowlist"),r`
1053
1053
  <div class="list-item agent-skill-row">
1054
1054
  <div class="list-main">
1055
1055
  <div class="list-title">
@@ -1080,7 +1080,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1080
1080
  </label>
1081
1081
  </div>
1082
1082
  </div>
1083
- `}function De(e){if(e)return Array.isArray(e.type)?e.type.filter(n=>n!=="null")[0]??e.type[0]:e.type}function gl(e){if(!e)return"";if(e.default!==void 0)return e.default;switch(De(e)){case"object":return{};case"array":return[];case"boolean":return!1;case"number":case"integer":return 0;case"string":return"";default:return""}}function rs(e){return e.filter(t=>typeof t=="string").join(".")}function Se(e,t){const n=rs(e),s=t[n];if(s)return s;const i=n.split(".");for(const[a,o]of Object.entries(t)){if(!a.includes("*"))continue;const l=a.split(".");if(l.length!==i.length)continue;let c=!0;for(let u=0;u<i.length;u+=1)if(l[u]!=="*"&&l[u]!==i[u]){c=!1;break}if(c)return o}}function We(e){return e.replace(/_/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\s+/g," ").replace(/^./,t=>t.toUpperCase())}function yp(e){const t=rs(e).toLowerCase();return t.includes("token")||t.includes("password")||t.includes("secret")||t.includes("apikey")||t.endsWith("key")}const xp=new Set(["title","description","default","nullable"]);function $p(e){return Object.keys(e??{}).filter(n=>!xp.has(n)).length===0}function wp(e){if(e===void 0)return"";try{return JSON.stringify(e,null,2)??""}catch{return""}}const sn={chevronDown:r`
1083
+ `}const Ep=new Set(["title","description","default","nullable"]);function Lp(e){return Object.keys(e??{}).filter(n=>!Ep.has(n)).length===0}function Mp(e){if(e===void 0)return"";try{return JSON.stringify(e,null,2)??""}catch{return""}}const on={chevronDown:r`
1084
1084
  <svg
1085
1085
  viewBox="0 0 24 24"
1086
1086
  fill="none"
@@ -1138,7 +1138,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1138
1138
  <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path>
1139
1139
  <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path>
1140
1140
  </svg>
1141
- `};function Ke(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:l}=e,c=e.showLabel??!0,u=De(t),g=Se(s,i),p=g?.label??t.title??We(String(s.at(-1))),h=g?.help??t.description,d=rs(s);if(a.has(d))return r`<div class="cfg-field cfg-field--error">
1141
+ `};function Ke(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:l}=e,c=e.showLabel??!0,u=we(t),g=Ae(s,i),p=g?.label??t.title??We(String(s.at(-1))),h=g?.help??t.description,d=Ci(s);if(a.has(d))return r`<div class="cfg-field cfg-field--error">
1142
1142
  <div class="cfg-field__label">${p}</div>
1143
1143
  <div class="cfg-field__error">Unsupported schema node. Use Raw mode.</div>
1144
1144
  </div>`;if(t.anyOf||t.oneOf){const m=(t.anyOf??t.oneOf??[]).filter(_=>!(_.type==="null"||Array.isArray(_.type)&&_.type.includes("null")));if(m.length===1)return Ke({...e,schema:m[0]});const S=_=>{if(_.const!==void 0)return _.const;if(_.enum&&_.enum.length===1)return _.enum[0]},k=m.map(S),$=k.every(_=>_!==void 0);if($&&k.length>0&&k.length<=5){const _=n??t.default;return r`
@@ -1158,7 +1158,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1158
1158
  `)}
1159
1159
  </div>
1160
1160
  </div>
1161
- `}if($&&k.length>5)return go({...e,options:k,value:n??t.default});const A=new Set(m.map(_=>De(_)).filter(Boolean)),C=new Set([...A].map(_=>_==="integer"?"number":_));if([...C].every(_=>["string","number","boolean"].includes(_))){const _=C.has("string"),T=C.has("number");if(C.has("boolean")&&C.size===1)return Ke({...e,schema:{...t,type:"boolean",anyOf:void 0,oneOf:void 0}});if(_||T)return uo({...e,inputType:T&&!_?"number":"text"})}}if(t.enum){const f=t.enum;if(f.length<=5){const m=n??t.default;return r`
1161
+ `}if($&&k.length>5)return ho({...e,options:k,value:n??t.default});const A=new Set(m.map(_=>we(_)).filter(Boolean)),C=new Set([...A].map(_=>_==="integer"?"number":_));if([...C].every(_=>["string","number","boolean"].includes(_))){const _=C.has("string"),T=C.has("number");if(C.has("boolean")&&C.size===1)return Ke({...e,schema:{...t,type:"boolean",anyOf:void 0,oneOf:void 0}});if(_||T)return fo({...e,inputType:T&&!_?"number":"text"})}}if(t.enum){const f=t.enum;if(f.length<=5){const m=n??t.default;return r`
1162
1162
  <div class="cfg-field">
1163
1163
  ${c?r`<label class="cfg-field__label">${p}</label>`:v}
1164
1164
  ${h?r`<div class="cfg-field__help">${h}</div>`:v}
@@ -1175,7 +1175,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1175
1175
  `)}
1176
1176
  </div>
1177
1177
  </div>
1178
- `}return go({...e,options:f,value:n??t.default})}if(u==="object")return Sp(e);if(u==="array")return Ap(e);if(u==="boolean"){const f=typeof n=="boolean"?n:typeof t.default=="boolean"?t.default:!1;return r`
1178
+ `}return ho({...e,options:f,value:n??t.default})}if(u==="object")return Rp(e);if(u==="array")return Pp(e);if(u==="boolean"){const f=typeof n=="boolean"?n:typeof t.default=="boolean"?t.default:!1;return r`
1179
1179
  <label class="cfg-toggle-row ${o?"disabled":""}">
1180
1180
  <div class="cfg-toggle-row__content">
1181
1181
  <span class="cfg-toggle-row__label">${p}</span>
@@ -1191,12 +1191,12 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1191
1191
  <span class="cfg-toggle__track"></span>
1192
1192
  </div>
1193
1193
  </label>
1194
- `}return u==="number"||u==="integer"?kp(e):u==="string"?uo({...e,inputType:"text"}):r`
1194
+ `}return u==="number"||u==="integer"?Ip(e):u==="string"?fo({...e,inputType:"text"}):r`
1195
1195
  <div class="cfg-field cfg-field--error">
1196
1196
  <div class="cfg-field__label">${p}</div>
1197
1197
  <div class="cfg-field__error">Unsupported type: ${u}. Use Raw mode.</div>
1198
1198
  </div>
1199
- `}function uo(e){const{schema:t,value:n,path:s,hints:i,disabled:a,onPatch:o,inputType:l}=e,c=e.showLabel??!0,u=Se(s,i),g=u?.label??t.title??We(String(s.at(-1))),p=u?.help??t.description,h=u?.sensitive??yp(s),d=u?.placeholder??(h?"••••":t.default!==void 0?`Default: ${String(t.default)}`:""),f=n??"";return r`
1199
+ `}function fo(e){const{schema:t,value:n,path:s,hints:i,disabled:a,onPatch:o,inputType:l}=e,c=e.showLabel??!0,u=Ae(s,i),g=u?.label??t.title??We(String(s.at(-1))),p=u?.help??t.description,h=(u?.sensitive??!1)&&!/^\$\{[^}]*\}$/.test(String(n??"").trim()),d=u?.placeholder??(h?"••••":t.default!==void 0?`Default: ${String(t.default)}`:""),f=n??"";return r`
1200
1200
  <div class="cfg-field">
1201
1201
  ${c?r`<label class="cfg-field__label">${g}</label>`:v}
1202
1202
  ${p?r`<div class="cfg-field__help">${p}</div>`:v}
@@ -1221,7 +1221,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1221
1221
  `:v}
1222
1222
  </div>
1223
1223
  </div>
1224
- `}function kp(e){const{schema:t,value:n,path:s,hints:i,disabled:a,onPatch:o}=e,l=e.showLabel??!0,c=Se(s,i),u=c?.label??t.title??We(String(s.at(-1))),g=c?.help??t.description,p=n??t.default??"",h=typeof p=="number"?p:0;return r`
1224
+ `}function Ip(e){const{schema:t,value:n,path:s,hints:i,disabled:a,onPatch:o}=e,l=e.showLabel??!0,c=Ae(s,i),u=c?.label??t.title??We(String(s.at(-1))),g=c?.help??t.description,p=n??t.default??"",h=typeof p=="number"?p:0;return r`
1225
1225
  <div class="cfg-field">
1226
1226
  ${l?r`<label class="cfg-field__label">${u}</label>`:v}
1227
1227
  ${g?r`<div class="cfg-field__help">${g}</div>`:v}
@@ -1247,7 +1247,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1247
1247
  >+</button>
1248
1248
  </div>
1249
1249
  </div>
1250
- `}function go(e){const{schema:t,value:n,path:s,hints:i,disabled:a,options:o,onPatch:l}=e,c=e.showLabel??!0,u=Se(s,i),g=u?.label??t.title??We(String(s.at(-1))),p=u?.help??t.description,h=n??t.default,d=o.findIndex(m=>m===h||String(m)===String(h)),f="__unset__";return r`
1250
+ `}function ho(e){const{schema:t,value:n,path:s,hints:i,disabled:a,options:o,onPatch:l}=e,c=e.showLabel??!0,u=Ae(s,i),g=u?.label??t.title??We(String(s.at(-1))),p=u?.help??t.description,h=n??t.default,d=o.findIndex(m=>m===h||String(m)===String(h)),f="__unset__";return r`
1251
1251
  <div class="cfg-field">
1252
1252
  ${c?r`<label class="cfg-field__label">${g}</label>`:v}
1253
1253
  ${p?r`<div class="cfg-field__help">${p}</div>`:v}
@@ -1263,24 +1263,24 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1263
1263
  `)}
1264
1264
  </select>
1265
1265
  </div>
1266
- `}function Sp(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:l}=e,c=Se(s,i),u=c?.label??t.title??We(String(s.at(-1))),g=c?.help??t.description,p=n??t.default,h=p&&typeof p=="object"&&!Array.isArray(p)?p:{},d=t.properties??{},m=Object.entries(d).toSorted((A,C)=>{const _=Se([...s,A[0]],i)?.order??0,T=Se([...s,C[0]],i)?.order??0;return _!==T?_-T:A[0].localeCompare(C[0])}),S=new Set(Object.keys(d)),k=t.additionalProperties,$=!!k&&typeof k=="object";return s.length===1?r`
1266
+ `}function Rp(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:l}=e,c=Ae(s,i),u=c?.label??t.title??We(String(s.at(-1))),g=c?.help??t.description,p=n??t.default,h=p&&typeof p=="object"&&!Array.isArray(p)?p:{},d=t.properties??{},m=Object.entries(d).toSorted((A,C)=>{const _=Ae([...s,A[0]],i)?.order??0,T=Ae([...s,C[0]],i)?.order??0;return _!==T?_-T:A[0].localeCompare(C[0])}),S=new Set(Object.keys(d)),k=t.additionalProperties,$=!!k&&typeof k=="object";return s.length===1?r`
1267
1267
  <div class="cfg-fields">
1268
1268
  ${m.map(([A,C])=>Ke({schema:C,value:h[A],path:[...s,A],hints:i,unsupported:a,disabled:o,onPatch:l}))}
1269
- ${$?po({schema:k,value:h,path:s,hints:i,unsupported:a,disabled:o,reservedKeys:S,onPatch:l}):v}
1269
+ ${$?vo({schema:k,value:h,path:s,hints:i,unsupported:a,disabled:o,reservedKeys:S,onPatch:l}):v}
1270
1270
  </div>
1271
1271
  `:r`
1272
1272
  <details class="cfg-object" open>
1273
1273
  <summary class="cfg-object__header">
1274
1274
  <span class="cfg-object__title">${u}</span>
1275
- <span class="cfg-object__chevron">${sn.chevronDown}</span>
1275
+ <span class="cfg-object__chevron">${on.chevronDown}</span>
1276
1276
  </summary>
1277
1277
  ${g?r`<div class="cfg-object__help">${g}</div>`:v}
1278
1278
  <div class="cfg-object__content">
1279
1279
  ${m.map(([A,C])=>Ke({schema:C,value:h[A],path:[...s,A],hints:i,unsupported:a,disabled:o,onPatch:l}))}
1280
- ${$?po({schema:k,value:h,path:s,hints:i,unsupported:a,disabled:o,reservedKeys:S,onPatch:l}):v}
1280
+ ${$?vo({schema:k,value:h,path:s,hints:i,unsupported:a,disabled:o,reservedKeys:S,onPatch:l}):v}
1281
1281
  </div>
1282
1282
  </details>
1283
- `}function Ap(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:l}=e,c=e.showLabel??!0,u=Se(s,i),g=u?.label??t.title??We(String(s.at(-1))),p=u?.help??t.description,h=Array.isArray(t.items)?t.items[0]:t.items;if(!h)return r`
1283
+ `}function Pp(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:l}=e,c=e.showLabel??!0,u=Ae(s,i),g=u?.label??t.title??We(String(s.at(-1))),p=u?.help??t.description,h=Array.isArray(t.items)?t.items[0]:t.items;if(!h)return r`
1284
1284
  <div class="cfg-field cfg-field--error">
1285
1285
  <div class="cfg-field__label">${g}</div>
1286
1286
  <div class="cfg-field__error">Unsupported array schema. Use Raw mode.</div>
@@ -1294,9 +1294,9 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1294
1294
  type="button"
1295
1295
  class="cfg-array__add"
1296
1296
  ?disabled=${o}
1297
- @click=${()=>{const f=[...d,gl(h)];l(s,f)}}
1297
+ @click=${()=>{const f=[...d,pr(h)];l(s,f)}}
1298
1298
  >
1299
- <span class="cfg-array__add-icon">${sn.plus}</span>
1299
+ <span class="cfg-array__add-icon">${on.plus}</span>
1300
1300
  Add
1301
1301
  </button>
1302
1302
  </div>
@@ -1317,7 +1317,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1317
1317
  ?disabled=${o}
1318
1318
  @click=${()=>{const S=[...d];S.splice(m,1),l(s,S)}}
1319
1319
  >
1320
- ${sn.trash}
1320
+ ${on.trash}
1321
1321
  </button>
1322
1322
  </div>
1323
1323
  <div class="cfg-array__item-content">
@@ -1328,7 +1328,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1328
1328
  </div>
1329
1329
  `}
1330
1330
  </div>
1331
- `}function po(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,reservedKeys:l,onPatch:c}=e,u=$p(t),g=Object.entries(n??{}).filter(([p])=>!l.has(p));return r`
1331
+ `}function vo(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,reservedKeys:l,onPatch:c}=e,u=Lp(t),g=Object.entries(n??{}).filter(([p])=>!l.has(p));return r`
1332
1332
  <div class="cfg-map">
1333
1333
  <div class="cfg-map__header">
1334
1334
  <span class="cfg-map__label">Custom entries</span>
@@ -1336,9 +1336,9 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1336
1336
  type="button"
1337
1337
  class="cfg-map__add"
1338
1338
  ?disabled=${o}
1339
- @click=${()=>{const p={...n};let h=1,d=`custom-${h}`;for(;d in p;)h+=1,d=`custom-${h}`;p[d]=u?{}:gl(t),c(s,p)}}
1339
+ @click=${()=>{const p={...n};let h=1,d=`custom-${h}`;for(;d in p;)h+=1,d=`custom-${h}`;p[d]=u?{}:pr(t),c(s,p)}}
1340
1340
  >
1341
- <span class="cfg-map__add-icon">${sn.plus}</span>
1341
+ <span class="cfg-map__add-icon">${on.plus}</span>
1342
1342
  Add Entry
1343
1343
  </button>
1344
1344
  </div>
@@ -1347,7 +1347,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1347
1347
  <div class="cfg-map__empty">No custom entries.</div>
1348
1348
  `:r`
1349
1349
  <div class="cfg-map__items">
1350
- ${g.map(([p,h])=>{const d=[...s,p],f=wp(h);return r`
1350
+ ${g.map(([p,h])=>{const d=[...s,p],f=Mp(h);return r`
1351
1351
  <div class="cfg-map__item">
1352
1352
  <div class="cfg-map__item-key">
1353
1353
  <input
@@ -1378,14 +1378,14 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1378
1378
  ?disabled=${o}
1379
1379
  @click=${()=>{const m={...n};delete m[p],c(s,m)}}
1380
1380
  >
1381
- ${sn.trash}
1381
+ ${on.trash}
1382
1382
  </button>
1383
1383
  </div>
1384
1384
  `})}
1385
1385
  </div>
1386
1386
  `}
1387
1387
  </div>
1388
- `}const fo={env:r`
1388
+ `}const mo={env:r`
1389
1389
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
1390
1390
  <circle cx="12" cy="12" r="3"></circle>
1391
1391
  <path
@@ -1572,11 +1572,11 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1572
1572
  <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
1573
1573
  <polyline points="14 2 14 8 20 8"></polyline>
1574
1574
  </svg>
1575
- `},Qi={env:{label:"Environment Variables",description:"Environment variables passed to the gateway process"},update:{label:"Updates",description:"Auto-update settings and release channel"},agents:{label:"Agents",description:"Agent configurations, models, and identities"},auth:{label:"Authentication",description:"API keys and authentication profiles"},channels:{label:"Channels",description:"Messaging channels (Telegram, Discord, Slack, etc.)"},messages:{label:"Messages",description:"Message handling and routing settings"},commands:{label:"Commands",description:"Custom slash commands"},hooks:{label:"Hooks",description:"Webhooks and event hooks"},skills:{label:"Skills",description:"Skill packs and capabilities"},tools:{label:"Tools",description:"Tool configurations (browser, search, etc.)"},gateway:{label:"Gateway",description:"Gateway server settings (port, auth, binding)"},wizard:{label:"Setup Wizard",description:"Setup wizard state and history"},meta:{label:"Metadata",description:"Gateway metadata and version information"},logging:{label:"Logging",description:"Log levels and output configuration"},browser:{label:"Browser",description:"Browser automation settings"},ui:{label:"UI",description:"User interface preferences"},models:{label:"Models",description:"AI model configurations and providers"},bindings:{label:"Bindings",description:"Key bindings and shortcuts"},broadcast:{label:"Broadcast",description:"Broadcast and notification settings"},audio:{label:"Audio",description:"Audio input/output settings"},session:{label:"Session",description:"Session management and persistence"},cron:{label:"Cron",description:"Scheduled tasks and automation"},web:{label:"Web",description:"Web server and API settings"},discovery:{label:"Discovery",description:"Service discovery and networking"},canvasHost:{label:"Canvas Host",description:"Canvas rendering and display"},talk:{label:"Talk",description:"Voice and speech settings"},plugins:{label:"Plugins",description:"Plugin management and extensions"}};function ho(e){return fo[e]??fo.default}function Cp(e,t,n){if(!n)return!0;const s=n.toLowerCase(),i=Qi[e];return e.toLowerCase().includes(s)||i&&(i.label.toLowerCase().includes(s)||i.description.toLowerCase().includes(s))?!0:Kt(t,s)}function Kt(e,t){if(e.title?.toLowerCase().includes(t)||e.description?.toLowerCase().includes(t)||e.enum?.some(s=>String(s).toLowerCase().includes(t)))return!0;if(e.properties){for(const[s,i]of Object.entries(e.properties))if(s.toLowerCase().includes(t)||Kt(i,t))return!0}if(e.items){const s=Array.isArray(e.items)?e.items:[e.items];for(const i of s)if(i&&Kt(i,t))return!0}if(e.additionalProperties&&typeof e.additionalProperties=="object"&&Kt(e.additionalProperties,t))return!0;const n=e.anyOf??e.oneOf??e.allOf;if(n){for(const s of n)if(s&&Kt(s,t))return!0}return!1}function Tp(e){if(!e.schema)return r`
1575
+ `},Yi={env:{label:"Environment Variables",description:"Environment variables passed to the gateway process"},update:{label:"Updates",description:"Auto-update settings and release channel"},agents:{label:"Agents",description:"Agent configurations, models, and identities"},auth:{label:"Authentication",description:"API keys and authentication profiles"},channels:{label:"Channels",description:"Messaging channels (Telegram, Discord, Slack, etc.)"},messages:{label:"Messages",description:"Message handling and routing settings"},commands:{label:"Commands",description:"Custom slash commands"},hooks:{label:"Hooks",description:"Webhooks and event hooks"},skills:{label:"Skills",description:"Skill packs and capabilities"},tools:{label:"Tools",description:"Tool configurations (browser, search, etc.)"},gateway:{label:"Gateway",description:"Gateway server settings (port, auth, binding)"},wizard:{label:"Setup Wizard",description:"Setup wizard state and history"},meta:{label:"Metadata",description:"Gateway metadata and version information"},logging:{label:"Logging",description:"Log levels and output configuration"},browser:{label:"Browser",description:"Browser automation settings"},ui:{label:"UI",description:"User interface preferences"},models:{label:"Models",description:"AI model configurations and providers"},bindings:{label:"Bindings",description:"Key bindings and shortcuts"},broadcast:{label:"Broadcast",description:"Broadcast and notification settings"},audio:{label:"Audio",description:"Audio input/output settings"},session:{label:"Session",description:"Session management and persistence"},cron:{label:"Cron",description:"Scheduled tasks and automation"},web:{label:"Web",description:"Web server and API settings"},discovery:{label:"Discovery",description:"Service discovery and networking"},canvasHost:{label:"Canvas Host",description:"Canvas rendering and display"},talk:{label:"Talk",description:"Voice and speech settings"},plugins:{label:"Plugins",description:"Plugin management and extensions"}};function bo(e){return mo[e]??mo.default}function Dp(e,t,n){if(!n)return!0;const s=n.toLowerCase(),i=Yi[e];return e.toLowerCase().includes(s)||i&&(i.label.toLowerCase().includes(s)||i.description.toLowerCase().includes(s))?!0:Wt(t,s)}function Wt(e,t){if(e.title?.toLowerCase().includes(t)||e.description?.toLowerCase().includes(t)||e.enum?.some(s=>String(s).toLowerCase().includes(t)))return!0;if(e.properties){for(const[s,i]of Object.entries(e.properties))if(s.toLowerCase().includes(t)||Wt(i,t))return!0}if(e.items){const s=Array.isArray(e.items)?e.items:[e.items];for(const i of s)if(i&&Wt(i,t))return!0}if(e.additionalProperties&&typeof e.additionalProperties=="object"&&Wt(e.additionalProperties,t))return!0;const n=e.anyOf??e.oneOf??e.allOf;if(n){for(const s of n)if(s&&Wt(s,t))return!0}return!1}function Fp(e){if(!e.schema)return r`
1576
1576
  <div class="muted">Schema unavailable.</div>
1577
- `;const t=e.schema,n=e.value??{};if(De(t)!=="object"||!t.properties)return r`
1577
+ `;const t=e.schema,n=e.value??{};if(we(t)!=="object"||!t.properties)return r`
1578
1578
  <div class="callout danger">Unsupported schema. Use Raw.</div>
1579
- `;const s=new Set(e.unsupportedPaths??[]),i=t.properties,a=e.searchQuery??"",o=e.activeSection,l=e.activeSubsection??null,u=Object.entries(i).toSorted((p,h)=>{const d=Se([p[0]],e.uiHints)?.order??50,f=Se([h[0]],e.uiHints)?.order??50;return d!==f?d-f:p[0].localeCompare(h[0])}).filter(([p,h])=>!(o&&p!==o||a&&!Cp(p,h,a)));let g=null;if(o&&l&&u.length===1){const p=u[0]?.[1];p&&De(p)==="object"&&p.properties&&p.properties[l]&&(g={sectionKey:o,subsectionKey:l,schema:p.properties[l]})}return u.length===0?r`
1579
+ `;const s=new Set(e.unsupportedPaths??[]),i=t.properties,a=e.searchQuery??"",o=e.activeSection,l=e.activeSubsection??null,u=Object.entries(i).toSorted((p,h)=>{const d=Ae([p[0]],e.uiHints)?.order??50,f=Ae([h[0]],e.uiHints)?.order??50;return d!==f?d-f:p[0].localeCompare(h[0])}).filter(([p,h])=>!(o&&p!==o||a&&!Dp(p,h,a)));let g=null;if(o&&l&&u.length===1){const p=u[0]?.[1];p&&we(p)==="object"&&p.properties&&p.properties[l]&&(g={sectionKey:o,subsectionKey:l,schema:p.properties[l]})}return u.length===0?r`
1580
1580
  <div class="config-empty">
1581
1581
  <div class="config-empty__icon">${le.search}</div>
1582
1582
  <div class="config-empty__text">
@@ -1585,10 +1585,10 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1585
1585
  </div>
1586
1586
  `:r`
1587
1587
  <div class="config-form config-form--modern">
1588
- ${g?(()=>{const{sectionKey:p,subsectionKey:h,schema:d}=g,f=Se([p,h],e.uiHints),m=f?.label??d.title??We(h),S=f?.help??d.description??"",k=n[p],$=k&&typeof k=="object"?k[h]:void 0,A=`config-section-${p}-${h}`;return r`
1588
+ ${g?(()=>{const{sectionKey:p,subsectionKey:h,schema:d}=g,f=Ae([p,h],e.uiHints),m=f?.label??d.title??We(h),S=f?.help??d.description??"",k=n[p],$=k&&typeof k=="object"?k[h]:void 0,A=`config-section-${p}-${h}`;return r`
1589
1589
  <section class="config-section-card" id=${A}>
1590
1590
  <div class="config-section-card__header">
1591
- <span class="config-section-card__icon">${ho(p)}</span>
1591
+ <span class="config-section-card__icon">${bo(p)}</span>
1592
1592
  <div class="config-section-card__titles">
1593
1593
  <h3 class="config-section-card__title">${m}</h3>
1594
1594
  ${S?r`<p class="config-section-card__desc">${S}</p>`:v}
@@ -1598,10 +1598,10 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1598
1598
  ${Ke({schema:d,value:$,path:[p,h],hints:e.uiHints,unsupported:s,disabled:e.disabled??!1,showLabel:!1,onPatch:e.onPatch})}
1599
1599
  </div>
1600
1600
  </section>
1601
- `})():u.map(([p,h])=>{const d=Qi[p]??{label:p.charAt(0).toUpperCase()+p.slice(1),description:h.description??""};return r`
1601
+ `})():u.map(([p,h])=>{const d=Yi[p]??{label:p.charAt(0).toUpperCase()+p.slice(1),description:h.description??""};return r`
1602
1602
  <section class="config-section-card" id="config-section-${p}">
1603
1603
  <div class="config-section-card__header">
1604
- <span class="config-section-card__icon">${ho(p)}</span>
1604
+ <span class="config-section-card__icon">${bo(p)}</span>
1605
1605
  <div class="config-section-card__titles">
1606
1606
  <h3 class="config-section-card__title">${d.label}</h3>
1607
1607
  ${d.description?r`<p class="config-section-card__desc">${d.description}</p>`:v}
@@ -1613,29 +1613,29 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1613
1613
  </section>
1614
1614
  `})}
1615
1615
  </div>
1616
- `}const _p=new Set(["title","description","default","nullable"]);function Ep(e){return Object.keys(e??{}).filter(n=>!_p.has(n)).length===0}function pl(e){const t=e.filter(i=>i!=null),n=t.length!==e.length,s=[];for(const i of t)s.some(a=>Object.is(a,i))||s.push(i);return{enumValues:s,nullable:n}}function fl(e){return!e||typeof e!="object"?{schema:null,unsupportedPaths:["<root>"]}:Qt(e,[])}function Qt(e,t){const n=new Set,s={...e},i=rs(t)||"<root>";if(e.anyOf||e.oneOf||e.allOf){const l=Lp(e,t);return l||{schema:e,unsupportedPaths:[i]}}const a=Array.isArray(e.type)&&e.type.includes("null"),o=De(e)??(e.properties||e.additionalProperties?"object":void 0);if(s.type=o??e.type,s.nullable=a||e.nullable,s.enum){const{enumValues:l,nullable:c}=pl(s.enum);s.enum=l,c&&(s.nullable=!0),l.length===0&&n.add(i)}if(o==="object"){const l=e.properties??{},c={};for(const[u,g]of Object.entries(l)){const p=Qt(g,[...t,u]);p.schema&&(c[u]=p.schema);for(const h of p.unsupportedPaths)n.add(h)}if(s.properties=c,e.additionalProperties===!0)n.add(i);else if(e.additionalProperties===!1)s.additionalProperties=!1;else if(e.additionalProperties&&typeof e.additionalProperties=="object"&&!Ep(e.additionalProperties)){const u=Qt(e.additionalProperties,[...t,"*"]);s.additionalProperties=u.schema??e.additionalProperties,u.unsupportedPaths.length>0&&n.add(i)}}else if(o==="array"){const l=Array.isArray(e.items)?e.items[0]:e.items;if(!l)n.add(i);else{const c=Qt(l,[...t,"*"]);s.items=c.schema??l,c.unsupportedPaths.length>0&&n.add(i)}}else o!=="string"&&o!=="number"&&o!=="integer"&&o!=="boolean"&&!s.enum&&n.add(i);return{schema:s,unsupportedPaths:Array.from(n)}}function Lp(e,t){if(e.allOf)return null;const n=e.anyOf??e.oneOf;if(!n)return null;const s=[],i=[];let a=!1;for(const l of n){if(!l||typeof l!="object")return null;if(Array.isArray(l.enum)){const{enumValues:c,nullable:u}=pl(l.enum);s.push(...c),u&&(a=!0);continue}if("const"in l){if(l.const==null){a=!0;continue}s.push(l.const);continue}if(De(l)==="null"){a=!0;continue}i.push(l)}if(s.length>0&&i.length===0){const l=[];for(const c of s)l.some(u=>Object.is(u,c))||l.push(c);return{schema:{...e,enum:l,nullable:a,anyOf:void 0,oneOf:void 0,allOf:void 0},unsupportedPaths:[]}}if(i.length===1){const l=Qt(i[0],t);return l.schema&&(l.schema.nullable=a||l.schema.nullable),l}const o=new Set(["string","number","integer","boolean"]);return i.length>0&&s.length===0&&i.every(l=>l.type&&o.has(String(l.type)))?{schema:{...e,nullable:a},unsupportedPaths:[]}:null}function Mp(e,t){let n=e;for(const s of t){if(!n)return null;const i=De(n);if(i==="object"){const a=n.properties??{};if(typeof s=="string"&&a[s]){n=a[s];continue}const o=n.additionalProperties;if(typeof s=="string"&&o&&typeof o=="object"){n=o;continue}return null}if(i==="array"){if(typeof s!="number")return null;n=(Array.isArray(n.items)?n.items[0]:n.items)??null;continue}return null}return n}function Ip(e,t){const s=(e.channels??{})[t],i=e[t];return(s&&typeof s=="object"?s:null)??(i&&typeof i=="object"?i:null)??{}}const Rp=["groupPolicy","streamMode","dmPolicy"];function Pp(e){if(e==null)return"n/a";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return"n/a"}}function Dp(e){const t=Rp.flatMap(n=>n in e?[[n,e[n]]]:[]);return t.length===0?null:r`
1616
+ `}const Np=new Set(["title","description","default","nullable"]);function Op(e){return Object.keys(e??{}).filter(n=>!Np.has(n)).length===0}function ml(e){const t=e.filter(i=>i!=null),n=t.length!==e.length,s=[];for(const i of t)s.some(a=>Object.is(a,i))||s.push(i);return{enumValues:s,nullable:n}}function bl(e){return!e||typeof e!="object"?{schema:null,unsupportedPaths:["<root>"]}:Yt(e,[])}function Yt(e,t){const n=new Set,s={...e},i=Ci(t)||"<root>";if(e.anyOf||e.oneOf||e.allOf){const l=Bp(e,t);return l||{schema:e,unsupportedPaths:[i]}}const a=Array.isArray(e.type)&&e.type.includes("null"),o=we(e)??(e.properties||e.additionalProperties?"object":void 0);if(s.type=o??e.type,s.nullable=a||e.nullable,s.enum){const{enumValues:l,nullable:c}=ml(s.enum);s.enum=l,c&&(s.nullable=!0),l.length===0&&n.add(i)}if(o==="object"){const l=e.properties??{},c={};for(const[u,g]of Object.entries(l)){const p=Yt(g,[...t,u]);p.schema&&(c[u]=p.schema);for(const h of p.unsupportedPaths)n.add(h)}if(s.properties=c,e.additionalProperties===!0)n.add(i);else if(e.additionalProperties===!1)s.additionalProperties=!1;else if(e.additionalProperties&&typeof e.additionalProperties=="object"&&!Op(e.additionalProperties)){const u=Yt(e.additionalProperties,[...t,"*"]);s.additionalProperties=u.schema??e.additionalProperties,u.unsupportedPaths.length>0&&n.add(i)}}else if(o==="array"){const l=Array.isArray(e.items)?e.items[0]:e.items;if(!l)n.add(i);else{const c=Yt(l,[...t,"*"]);s.items=c.schema??l,c.unsupportedPaths.length>0&&n.add(i)}}else o!=="string"&&o!=="number"&&o!=="integer"&&o!=="boolean"&&!s.enum&&n.add(i);return{schema:s,unsupportedPaths:Array.from(n)}}function Bp(e,t){if(e.allOf)return null;const n=e.anyOf??e.oneOf;if(!n)return null;const s=[],i=[];let a=!1;for(const l of n){if(!l||typeof l!="object")return null;if(Array.isArray(l.enum)){const{enumValues:c,nullable:u}=ml(l.enum);s.push(...c),u&&(a=!0);continue}if("const"in l){if(l.const==null){a=!0;continue}s.push(l.const);continue}if(we(l)==="null"){a=!0;continue}i.push(l)}if(s.length>0&&i.length===0){const l=[];for(const c of s)l.some(u=>Object.is(u,c))||l.push(c);return{schema:{...e,enum:l,nullable:a,anyOf:void 0,oneOf:void 0,allOf:void 0},unsupportedPaths:[]}}if(i.length===1){const l=Yt(i[0],t);return l.schema&&(l.schema.nullable=a||l.schema.nullable),l}const o=new Set(["string","number","integer","boolean"]);return i.length>0&&s.length===0&&i.every(l=>l.type&&o.has(String(l.type)))?{schema:{...e,nullable:a},unsupportedPaths:[]}:null}function Up(e,t){let n=e;for(const s of t){if(!n)return null;const i=we(n);if(i==="object"){const a=n.properties??{};if(typeof s=="string"&&a[s]){n=a[s];continue}const o=n.additionalProperties;if(typeof s=="string"&&o&&typeof o=="object"){n=o;continue}return null}if(i==="array"){if(typeof s!="number")return null;n=(Array.isArray(n.items)?n.items[0]:n.items)??null;continue}return null}return n}function zp(e,t){const s=(e.channels??{})[t],i=e[t];return(s&&typeof s=="object"?s:null)??(i&&typeof i=="object"?i:null)??{}}const Hp=["groupPolicy","streamMode","dmPolicy"];function jp(e){if(e==null)return"n/a";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return"n/a"}}function Kp(e){const t=Hp.flatMap(n=>n in e?[[n,e[n]]]:[]);return t.length===0?null:r`
1617
1617
  <div class="status-list" style="margin-top: 12px;">
1618
1618
  ${t.map(([n,s])=>r`
1619
1619
  <div>
1620
1620
  <span class="label">${n}</span>
1621
- <span>${Pp(s)}</span>
1621
+ <span>${jp(s)}</span>
1622
1622
  </div>
1623
1623
  `)}
1624
1624
  </div>
1625
- `}function Fp(e){const t=fl(e.schema),n=t.schema;if(!n)return r`
1625
+ `}function Wp(e){const t=bl(e.schema),n=t.schema;if(!n)return r`
1626
1626
  <div class="callout danger">Schema unavailable. Use Raw.</div>
1627
- `;const s=Mp(n,["channels",e.channelId]);if(!s)return r`
1627
+ `;const s=Up(n,["channels",e.channelId]);if(!s)return r`
1628
1628
  <div class="callout danger">Channel config schema unavailable.</div>
1629
- `;const i=e.configValue??{},a=Ip(i,e.channelId);return r`
1629
+ `;const i=e.configValue??{},a=zp(i,e.channelId);return r`
1630
1630
  <div class="config-form">
1631
1631
  ${Ke({schema:s,value:a,path:["channels",e.channelId],hints:e.uiHints,unsupported:new Set(t.unsupportedPaths),disabled:e.disabled,showLabel:!1,onPatch:e.onPatch})}
1632
1632
  </div>
1633
- ${Dp(a)}
1633
+ ${Kp(a)}
1634
1634
  `}function qe(e){const{channelId:t,props:n}=e,s=n.configSaving||n.configSchemaLoading;return r`
1635
1635
  <div style="margin-top: 16px;">
1636
1636
  ${n.configSchemaLoading?r`
1637
1637
  <div class="muted">Loading config schema…</div>
1638
- `:Fp({channelId:t,configValue:n.configForm,schema:n.configSchema,uiHints:n.configUiHints,disabled:s,onPatch:n.onConfigPatch})}
1638
+ `:Wp({channelId:t,configValue:n.configForm,schema:n.configSchema,uiHints:n.configUiHints,disabled:s,onPatch:n.onConfigPatch})}
1639
1639
  <div class="row" style="margin-top: 12px;">
1640
1640
  <button
1641
1641
  class="btn primary"
@@ -1653,7 +1653,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1653
1653
  </button>
1654
1654
  </div>
1655
1655
  </div>
1656
- `}function Np(e){const{props:t,discord:n,accountCountLabel:s}=e;return r`
1656
+ `}function qp(e){const{props:t,discord:n,accountCountLabel:s}=e;return r`
1657
1657
  <div class="card">
1658
1658
  <div class="card-title">Discord</div>
1659
1659
  <div class="card-sub">Bot status and channel configuration.</div>
@@ -1695,7 +1695,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1695
1695
  </button>
1696
1696
  </div>
1697
1697
  </div>
1698
- `}function Op(e){const{props:t,googleChat:n,accountCountLabel:s}=e;return r`
1698
+ `}function Gp(e){const{props:t,googleChat:n,accountCountLabel:s}=e;return r`
1699
1699
  <div class="card">
1700
1700
  <div class="card-title">Google Chat</div>
1701
1701
  <div class="card-sub">Chat API webhook status and channel configuration.</div>
@@ -1747,7 +1747,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1747
1747
  </button>
1748
1748
  </div>
1749
1749
  </div>
1750
- `}function Bp(e){const{props:t,imessage:n,accountCountLabel:s}=e;return r`
1750
+ `}function Vp(e){const{props:t,imessage:n,accountCountLabel:s}=e;return r`
1751
1751
  <div class="card">
1752
1752
  <div class="card-title">iMessage</div>
1753
1753
  <div class="card-sub">macOS bridge status and channel configuration.</div>
@@ -1789,7 +1789,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1789
1789
  </button>
1790
1790
  </div>
1791
1791
  </div>
1792
- `}function vo(e){return e?e.length<=20?e:`${e.slice(0,8)}...${e.slice(-8)}`:"n/a"}function Up(e){const{props:t,nostr:n,nostrAccounts:s,accountCountLabel:i,profileFormState:a,profileFormCallbacks:o,onEditProfile:l}=e,c=s[0],u=n?.configured??c?.configured??!1,g=n?.running??c?.running??!1,p=n?.publicKey??c?.publicKey,h=n?.lastStartAt??c?.lastStartAt??null,d=n?.lastError??c?.lastError??null,f=s.length>1,m=a!=null,S=$=>{const A=$.publicKey,C=$.profile,_=C?.displayName??C?.name??$.name??$.accountId;return r`
1792
+ `}function yo(e){return e?e.length<=20?e:`${e.slice(0,8)}...${e.slice(-8)}`:"n/a"}function Qp(e){const{props:t,nostr:n,nostrAccounts:s,accountCountLabel:i,profileFormState:a,profileFormCallbacks:o,onEditProfile:l}=e,c=s[0],u=n?.configured??c?.configured??!1,g=n?.running??c?.running??!1,p=n?.publicKey??c?.publicKey,h=n?.lastStartAt??c?.lastStartAt??null,d=n?.lastError??c?.lastError??null,f=s.length>1,m=a!=null,S=$=>{const A=$.publicKey,C=$.profile,_=C?.displayName??C?.name??$.name??$.accountId;return r`
1793
1793
  <div class="account-card">
1794
1794
  <div class="account-card-header">
1795
1795
  <div class="account-card-title">${_}</div>
@@ -1806,7 +1806,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1806
1806
  </div>
1807
1807
  <div>
1808
1808
  <span class="label">Public Key</span>
1809
- <span class="monospace" title="${A??""}">${vo(A)}</span>
1809
+ <span class="monospace" title="${A??""}">${yo(A)}</span>
1810
1810
  </div>
1811
1811
  <div>
1812
1812
  <span class="label">Last inbound</span>
@@ -1817,7 +1817,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1817
1817
  `:v}
1818
1818
  </div>
1819
1819
  </div>
1820
- `},k=()=>{if(m&&o)return Ec({state:a,callbacks:o,accountId:s[0]?.accountId??"default"});const $=c?.profile??n?.profile,{name:A,displayName:C,about:_,picture:T,nip05:I}=$??{},z=A||C||_||T||I;return r`
1820
+ `},k=()=>{if(m&&o)return Oc({state:a,callbacks:o,accountId:s[0]?.accountId??"default"});const $=c?.profile??n?.profile,{name:A,displayName:C,about:_,picture:T,nip05:I}=$??{},z=A||C||_||T||I;return r`
1821
1821
  <div style="margin-top: 16px; padding: 12px; background: var(--bg-secondary); border-radius: 8px;">
1822
1822
  <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;">
1823
1823
  <div style="font-weight: 500;">Profile</div>
@@ -1877,7 +1877,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1877
1877
  <div>
1878
1878
  <span class="label">Public Key</span>
1879
1879
  <span class="monospace" title="${p??""}"
1880
- >${vo(p)}</span
1880
+ >${yo(p)}</span
1881
1881
  >
1882
1882
  </div>
1883
1883
  <div>
@@ -1897,7 +1897,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1897
1897
  <button class="btn" @click=${()=>t.onRefresh(!1)}>Refresh</button>
1898
1898
  </div>
1899
1899
  </div>
1900
- `}function zp(e,t){const n=t.snapshot,s=n?.channels;if(!n||!s)return!1;const i=s[e],a=typeof i?.configured=="boolean"&&i.configured,o=typeof i?.running=="boolean"&&i.running,l=typeof i?.connected=="boolean"&&i.connected,u=(n.channelAccounts?.[e]??[]).some(g=>g.configured||g.running||g.connected);return a||o||l||u}function Hp(e,t){return t?.[e]?.length??0}function hl(e,t){const n=Hp(e,t);return n<2?v:r`<div class="account-count">Accounts (${n})</div>`}function jp(e){const{props:t,signal:n,accountCountLabel:s}=e;return r`
1900
+ `}function Yp(e,t){const n=t.snapshot,s=n?.channels;if(!n||!s)return!1;const i=s[e],a=typeof i?.configured=="boolean"&&i.configured,o=typeof i?.running=="boolean"&&i.running,l=typeof i?.connected=="boolean"&&i.connected,u=(n.channelAccounts?.[e]??[]).some(g=>g.configured||g.running||g.connected);return a||o||l||u}function Jp(e,t){return t?.[e]?.length??0}function yl(e,t){const n=Jp(e,t);return n<2?v:r`<div class="account-count">Accounts (${n})</div>`}function Zp(e){const{props:t,signal:n,accountCountLabel:s}=e;return r`
1901
1901
  <div class="card">
1902
1902
  <div class="card-title">Signal</div>
1903
1903
  <div class="card-sub">signal-cli status and channel configuration.</div>
@@ -1943,7 +1943,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1943
1943
  </button>
1944
1944
  </div>
1945
1945
  </div>
1946
- `}function Kp(e){const{props:t,slack:n,accountCountLabel:s}=e;return r`
1946
+ `}function Xp(e){const{props:t,slack:n,accountCountLabel:s}=e;return r`
1947
1947
  <div class="card">
1948
1948
  <div class="card-title">Slack</div>
1949
1949
  <div class="card-sub">Socket mode status and channel configuration.</div>
@@ -1985,7 +1985,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1985
1985
  </button>
1986
1986
  </div>
1987
1987
  </div>
1988
- `}function Wp(e){const{props:t,telegram:n,telegramAccounts:s,accountCountLabel:i}=e,a=s.length>1,o=l=>{const u=l.probe?.bot?.username,g=l.name||l.accountId;return r`
1988
+ `}function ef(e){const{props:t,telegram:n,telegramAccounts:s,accountCountLabel:i}=e,a=s.length>1,o=l=>{const u=l.probe?.bot?.username,g=l.name||l.accountId;return r`
1989
1989
  <div class="account-card">
1990
1990
  <div class="account-card-header">
1991
1991
  <div class="account-card-title">
@@ -2065,7 +2065,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
2065
2065
  </button>
2066
2066
  </div>
2067
2067
  </div>
2068
- `}function qp(e){const{props:t,whatsapp:n,accountCountLabel:s}=e;return r`
2068
+ `}function tf(e){const{props:t,whatsapp:n,accountCountLabel:s}=e;return r`
2069
2069
  <div class="card">
2070
2070
  <div class="card-title">WhatsApp</div>
2071
2071
  <div class="card-sub">Link WhatsApp Web and monitor connection health.</div>
@@ -2103,7 +2103,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
2103
2103
  <div>
2104
2104
  <span class="label">Auth age</span>
2105
2105
  <span>
2106
- ${n?.authAgeMs!=null?Ri(n.authAgeMs):"n/a"}
2106
+ ${n?.authAgeMs!=null?Pi(n.authAgeMs):"n/a"}
2107
2107
  </span>
2108
2108
  </div>
2109
2109
  </div>
@@ -2156,9 +2156,9 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
2156
2156
 
2157
2157
  ${qe({channelId:"whatsapp",props:t})}
2158
2158
  </div>
2159
- `}function Gp(e){const t=e.snapshot?.channels,n=t?.whatsapp??void 0,s=t?.telegram??void 0,i=t?.discord??null,a=t?.googlechat??null,o=t?.slack??null,l=t?.signal??null,c=t?.imessage??null,u=t?.nostr??null,p=Vp(e.snapshot).map((h,d)=>({key:h,enabled:zp(h,e),order:d})).toSorted((h,d)=>h.enabled!==d.enabled?h.enabled?-1:1:h.order-d.order);return r`
2159
+ `}function nf(e){const t=e.snapshot?.channels,n=t?.whatsapp??void 0,s=t?.telegram??void 0,i=t?.discord??null,a=t?.googlechat??null,o=t?.slack??null,l=t?.signal??null,c=t?.imessage??null,u=t?.nostr??null,p=sf(e.snapshot).map((h,d)=>({key:h,enabled:Yp(h,e),order:d})).toSorted((h,d)=>h.enabled!==d.enabled?h.enabled?-1:1:h.order-d.order);return r`
2160
2160
  <section class="grid grid-cols-2">
2161
- ${p.map(h=>Qp(h.key,e,{whatsapp:n,telegram:s,discord:i,googlechat:a,slack:o,signal:l,imessage:c,nostr:u,channelAccounts:e.snapshot?.channelAccounts??null}))}
2161
+ ${p.map(h=>af(h.key,e,{whatsapp:n,telegram:s,discord:i,googlechat:a,slack:o,signal:l,imessage:c,nostr:u,channelAccounts:e.snapshot?.channelAccounts??null}))}
2162
2162
  </section>
2163
2163
 
2164
2164
  <section class="card" style="margin-top: 18px;">
@@ -2176,7 +2176,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
2176
2176
  ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
2177
2177
  </pre>
2178
2178
  </section>
2179
- `}function Vp(e){return e?.channelMeta?.length?e.channelMeta.map(t=>t.id):e?.channelOrder?.length?e.channelOrder:["whatsapp","telegram","discord","googlechat","slack","signal","imessage","nostr"]}function Qp(e,t,n){const s=hl(e,n.channelAccounts);switch(e){case"whatsapp":return qp({props:t,whatsapp:n.whatsapp,accountCountLabel:s});case"telegram":return Wp({props:t,telegram:n.telegram,telegramAccounts:n.channelAccounts?.telegram??[],accountCountLabel:s});case"discord":return Np({props:t,discord:n.discord,accountCountLabel:s});case"googlechat":return Op({props:t,googleChat:n.googlechat,accountCountLabel:s});case"slack":return Kp({props:t,slack:n.slack,accountCountLabel:s});case"signal":return jp({props:t,signal:n.signal,accountCountLabel:s});case"imessage":return Bp({props:t,imessage:n.imessage,accountCountLabel:s});case"nostr":{const i=n.channelAccounts?.nostr??[],a=i[0],o=a?.accountId??"default",l=a?.profile??null,c=t.nostrProfileAccountId===o?t.nostrProfileFormState:null,u=c?{onFieldChange:t.onNostrProfileFieldChange,onSave:t.onNostrProfileSave,onImport:t.onNostrProfileImport,onCancel:t.onNostrProfileCancel,onToggleAdvanced:t.onNostrProfileToggleAdvanced}:null;return Up({props:t,nostr:n.nostr,nostrAccounts:i,accountCountLabel:s,profileFormState:c,profileFormCallbacks:u,onEditProfile:()=>t.onNostrProfileEdit(o,l)})}default:return Yp(e,t,n.channelAccounts??{})}}function Yp(e,t,n){const s=Zp(t.snapshot,e),i=t.snapshot?.channels?.[e],a=typeof i?.configured=="boolean"?i.configured:void 0,o=typeof i?.running=="boolean"?i.running:void 0,l=typeof i?.connected=="boolean"?i.connected:void 0,c=typeof i?.lastError=="string"?i.lastError:void 0,u=n[e]??[],g=hl(e,n);return r`
2179
+ `}function sf(e){return e?.channelMeta?.length?e.channelMeta.map(t=>t.id):e?.channelOrder?.length?e.channelOrder:["whatsapp","telegram","discord","googlechat","slack","signal","imessage","nostr"]}function af(e,t,n){const s=yl(e,n.channelAccounts);switch(e){case"whatsapp":return tf({props:t,whatsapp:n.whatsapp,accountCountLabel:s});case"telegram":return ef({props:t,telegram:n.telegram,telegramAccounts:n.channelAccounts?.telegram??[],accountCountLabel:s});case"discord":return qp({props:t,discord:n.discord,accountCountLabel:s});case"googlechat":return Gp({props:t,googleChat:n.googlechat,accountCountLabel:s});case"slack":return Xp({props:t,slack:n.slack,accountCountLabel:s});case"signal":return Zp({props:t,signal:n.signal,accountCountLabel:s});case"imessage":return Vp({props:t,imessage:n.imessage,accountCountLabel:s});case"nostr":{const i=n.channelAccounts?.nostr??[],a=i[0],o=a?.accountId??"default",l=a?.profile??null,c=t.nostrProfileAccountId===o?t.nostrProfileFormState:null,u=c?{onFieldChange:t.onNostrProfileFieldChange,onSave:t.onNostrProfileSave,onImport:t.onNostrProfileImport,onCancel:t.onNostrProfileCancel,onToggleAdvanced:t.onNostrProfileToggleAdvanced}:null;return Qp({props:t,nostr:n.nostr,nostrAccounts:i,accountCountLabel:s,profileFormState:c,profileFormCallbacks:u,onEditProfile:()=>t.onNostrProfileEdit(o,l)})}default:return of(e,t,n.channelAccounts??{})}}function of(e,t,n){const s=lf(t.snapshot,e),i=t.snapshot?.channels?.[e],a=typeof i?.configured=="boolean"?i.configured:void 0,o=typeof i?.running=="boolean"?i.running:void 0,l=typeof i?.connected=="boolean"?i.connected:void 0,c=typeof i?.lastError=="string"?i.lastError:void 0,u=n[e]??[],g=yl(e,n);return r`
2180
2180
  <div class="card">
2181
2181
  <div class="card-title">${s}</div>
2182
2182
  <div class="card-sub">Channel status and configuration.</div>
@@ -2184,7 +2184,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
2184
2184
 
2185
2185
  ${u.length>0?r`
2186
2186
  <div class="account-card-list">
2187
- ${u.map(p=>nf(p))}
2187
+ ${u.map(p=>gf(p))}
2188
2188
  </div>
2189
2189
  `:r`
2190
2190
  <div class="status-list" style="margin-top: 16px;">
@@ -2209,7 +2209,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
2209
2209
 
2210
2210
  ${qe({channelId:e,props:t})}
2211
2211
  </div>
2212
- `}function Jp(e){return e?.channelMeta?.length?Object.fromEntries(e.channelMeta.map(t=>[t.id,t])):{}}function Zp(e,t){return Jp(e)[t]?.label??e?.channelLabels?.[t]??t}const Xp=600*1e3;function vl(e){return e.lastInboundAt?Date.now()-e.lastInboundAt<Xp:!1}function ef(e){return e.running?"Yes":vl(e)?"Active":"No"}function tf(e){return e.connected===!0?"Yes":e.connected===!1?"No":vl(e)?"Active":"n/a"}function nf(e){const t=ef(e),n=tf(e);return r`
2212
+ `}function rf(e){return e?.channelMeta?.length?Object.fromEntries(e.channelMeta.map(t=>[t.id,t])):{}}function lf(e,t){return rf(e)[t]?.label??e?.channelLabels?.[t]??t}const cf=600*1e3;function xl(e){return e.lastInboundAt?Date.now()-e.lastInboundAt<cf:!1}function df(e){return e.running?"Yes":xl(e)?"Active":"No"}function uf(e){return e.connected===!0?"Yes":e.connected===!1?"No":xl(e)?"Active":"n/a"}function gf(e){const t=df(e),n=uf(e);return r`
2213
2213
  <div class="account-card">
2214
2214
  <div class="account-card-header">
2215
2215
  <div class="account-card-title">${e.name||e.accountId}</div>
@@ -2239,13 +2239,13 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
2239
2239
  `:v}
2240
2240
  </div>
2241
2241
  </div>
2242
- `}const Yt=(e,t)=>{const n=e._$AN;if(n===void 0)return!1;for(const s of n)s._$AO?.(t,!1),Yt(s,t);return!0},zn=e=>{let t,n;do{if((t=e._$AM)===void 0)break;n=t._$AN,n.delete(e),e=t}while(n?.size===0)},ml=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(n===void 0)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),of(t)}};function sf(e){this._$AN!==void 0?(zn(this),this._$AM=e,ml(this)):this._$AM=e}function af(e,t=!1,n=0){const s=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(s))for(let a=n;a<s.length;a++)Yt(s[a],!1),zn(s[a]);else s!=null&&(Yt(s,!1),zn(s));else Yt(this,e)}const of=e=>{e.type==Wi.CHILD&&(e._$AP??=af,e._$AQ??=sf)};class rf extends Gi{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,n,s){super._$AT(t,n,s),ml(this),this.isConnected=t._$AU}_$AO(t,n=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),n&&(Yt(this,t),zn(this))}setValue(t){if(vg(this._$Ct))this._$Ct._$AI(t,this);else{const n=[...this._$Ct._$AH];n[this._$Ci]=t,this._$Ct._$AI(n,this,0)}}disconnected(){}reconnected(){}}const Ps=new WeakMap,lf=qi(class extends rf{render(e){return v}update(e,[t]){const n=t!==this.G;return n&&this.G!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.G=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),v}rt(e){if(this.isConnected||(e=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let n=Ps.get(t);n===void 0&&(n=new WeakMap,Ps.set(t,n)),n.get(this.G)!==void 0&&this.G.call(this.ht,void 0),n.set(this.G,e),e!==void 0&&this.G.call(this.ht,e)}else this.G.value=e}get lt(){return typeof this.G=="function"?Ps.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});class ci extends Gi{constructor(t){if(super(t),this.it=v,t.type!==Wi.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===v||t==null)return this._t=void 0,this.it=t;if(t===Qe)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const n=[t];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}}ci.directiveName="unsafeHTML",ci.resultType=1;const di=qi(ci);const{entries:bl,setPrototypeOf:mo,isFrozen:cf,getPrototypeOf:df,getOwnPropertyDescriptor:uf}=Object;let{freeze:ve,seal:Ae,create:ui}=Object,{apply:gi,construct:pi}=typeof Reflect<"u"&&Reflect;ve||(ve=function(t){return t});Ae||(Ae=function(t){return t});gi||(gi=function(t,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),a=2;a<s;a++)i[a-2]=arguments[a];return t.apply(n,i)});pi||(pi=function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return new t(...s)});const kn=me(Array.prototype.forEach),gf=me(Array.prototype.lastIndexOf),bo=me(Array.prototype.pop),Nt=me(Array.prototype.push),pf=me(Array.prototype.splice),Pn=me(String.prototype.toLowerCase),Ds=me(String.prototype.toString),Fs=me(String.prototype.match),Ot=me(String.prototype.replace),ff=me(String.prototype.indexOf),hf=me(String.prototype.trim),Ce=me(Object.prototype.hasOwnProperty),fe=me(RegExp.prototype.test),Bt=vf(TypeError);function me(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return gi(e,t,s)}}function vf(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return pi(e,n)}}function K(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Pn;mo&&mo(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const a=n(i);a!==i&&(cf(t)||(t[s]=a),i=a)}e[i]=!0}return e}function mf(e){for(let t=0;t<e.length;t++)Ce(e,t)||(e[t]=null);return e}function Re(e){const t=ui(null);for(const[n,s]of bl(e))Ce(e,n)&&(Array.isArray(s)?t[n]=mf(s):s&&typeof s=="object"&&s.constructor===Object?t[n]=Re(s):t[n]=s);return t}function Ut(e,t){for(;e!==null;){const s=uf(e,t);if(s){if(s.get)return me(s.get);if(typeof s.value=="function")return me(s.value)}e=df(e)}function n(){return null}return n}const yo=ve(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Ns=ve(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Os=ve(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),bf=ve(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Bs=ve(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),yf=ve(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),xo=ve(["#text"]),$o=ve(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Us=ve(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),wo=ve(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Sn=ve(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),xf=Ae(/\{\{[\w\W]*|[\w\W]*\}\}/gm),$f=Ae(/<%[\w\W]*|[\w\W]*%>/gm),wf=Ae(/\$\{[\w\W]*/gm),kf=Ae(/^data-[\-\w.\u00B7-\uFFFF]+$/),Sf=Ae(/^aria-[\-\w]+$/),yl=Ae(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Af=Ae(/^(?:\w+script|data):/i),Cf=Ae(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),xl=Ae(/^html$/i),Tf=Ae(/^[a-z][.\w]*(-[.\w]+)+$/i);var ko=Object.freeze({__proto__:null,ARIA_ATTR:Sf,ATTR_WHITESPACE:Cf,CUSTOM_ELEMENT:Tf,DATA_ATTR:kf,DOCTYPE_NAME:xl,ERB_EXPR:$f,IS_ALLOWED_URI:yl,IS_SCRIPT_OR_DATA:Af,MUSTACHE_EXPR:xf,TMPLIT_EXPR:wf});const zt={element:1,text:3,progressingInstruction:7,comment:8,document:9},_f=function(){return typeof window>"u"?null:window},Ef=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(s=n.getAttribute(i));const a="dompurify"+(s?"#"+s:"");try{return t.createPolicy(a,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},So=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function $l(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_f();const t=U=>$l(U);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==zt.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const s=n,i=s.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:l,Element:c,NodeFilter:u,NamedNodeMap:g=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:h,trustedTypes:d}=e,f=c.prototype,m=Ut(f,"cloneNode"),S=Ut(f,"remove"),k=Ut(f,"nextSibling"),$=Ut(f,"childNodes"),A=Ut(f,"parentNode");if(typeof o=="function"){const U=n.createElement("template");U.content&&U.content.ownerDocument&&(n=U.content.ownerDocument)}let C,_="";const{implementation:T,createNodeIterator:I,createDocumentFragment:z,getElementsByTagName:Y}=n,{importNode:se}=s;let F=So();t.isSupported=typeof bl=="function"&&typeof A=="function"&&T&&T.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:H,ERB_EXPR:ce,TMPLIT_EXPR:E,DATA_ATTR:B,ARIA_ATTR:ie,IS_SCRIPT_OR_DATA:ae,ATTR_WHITESPACE:Z,CUSTOM_ELEMENT:te}=ko;let{IS_ALLOWED_URI:M}=ko,R=null;const P=K({},[...yo,...Ns,...Os,...Bs,...xo]);let j=null;const xe=K({},[...$o,...Us,...wo,...Sn]);let Q=Object.seal(ui(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),we=null,X=null;const pe=Object.seal(ui(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Fe=!0,Ne=!0,Xe=!1,da=!0,xt=!1,dn=!0,et=!1,us=!1,gs=!1,$t=!1,un=!1,gn=!1,ua=!0,ga=!1;const Hl="user-content-";let ps=!0,Rt=!1,wt={},Le=null;const fs=K({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let pa=null;const fa=K({},["audio","video","img","source","image","track"]);let hs=null;const ha=K({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pn="http://www.w3.org/1998/Math/MathML",fn="http://www.w3.org/2000/svg",Oe="http://www.w3.org/1999/xhtml";let kt=Oe,vs=!1,ms=null;const jl=K({},[pn,fn,Oe],Ds);let hn=K({},["mi","mo","mn","ms","mtext"]),vn=K({},["annotation-xml"]);const Kl=K({},["title","style","font","a","script"]);let Pt=null;const Wl=["application/xhtml+xml","text/html"],ql="text/html";let ne=null,St=null;const Gl=n.createElement("form"),va=function(b){return b instanceof RegExp||b instanceof Function},bs=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(St&&St===b)){if((!b||typeof b!="object")&&(b={}),b=Re(b),Pt=Wl.indexOf(b.PARSER_MEDIA_TYPE)===-1?ql:b.PARSER_MEDIA_TYPE,ne=Pt==="application/xhtml+xml"?Ds:Pn,R=Ce(b,"ALLOWED_TAGS")?K({},b.ALLOWED_TAGS,ne):P,j=Ce(b,"ALLOWED_ATTR")?K({},b.ALLOWED_ATTR,ne):xe,ms=Ce(b,"ALLOWED_NAMESPACES")?K({},b.ALLOWED_NAMESPACES,Ds):jl,hs=Ce(b,"ADD_URI_SAFE_ATTR")?K(Re(ha),b.ADD_URI_SAFE_ATTR,ne):ha,pa=Ce(b,"ADD_DATA_URI_TAGS")?K(Re(fa),b.ADD_DATA_URI_TAGS,ne):fa,Le=Ce(b,"FORBID_CONTENTS")?K({},b.FORBID_CONTENTS,ne):fs,we=Ce(b,"FORBID_TAGS")?K({},b.FORBID_TAGS,ne):Re({}),X=Ce(b,"FORBID_ATTR")?K({},b.FORBID_ATTR,ne):Re({}),wt=Ce(b,"USE_PROFILES")?b.USE_PROFILES:!1,Fe=b.ALLOW_ARIA_ATTR!==!1,Ne=b.ALLOW_DATA_ATTR!==!1,Xe=b.ALLOW_UNKNOWN_PROTOCOLS||!1,da=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,xt=b.SAFE_FOR_TEMPLATES||!1,dn=b.SAFE_FOR_XML!==!1,et=b.WHOLE_DOCUMENT||!1,$t=b.RETURN_DOM||!1,un=b.RETURN_DOM_FRAGMENT||!1,gn=b.RETURN_TRUSTED_TYPE||!1,gs=b.FORCE_BODY||!1,ua=b.SANITIZE_DOM!==!1,ga=b.SANITIZE_NAMED_PROPS||!1,ps=b.KEEP_CONTENT!==!1,Rt=b.IN_PLACE||!1,M=b.ALLOWED_URI_REGEXP||yl,kt=b.NAMESPACE||Oe,hn=b.MATHML_TEXT_INTEGRATION_POINTS||hn,vn=b.HTML_INTEGRATION_POINTS||vn,Q=b.CUSTOM_ELEMENT_HANDLING||{},b.CUSTOM_ELEMENT_HANDLING&&va(b.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Q.tagNameCheck=b.CUSTOM_ELEMENT_HANDLING.tagNameCheck),b.CUSTOM_ELEMENT_HANDLING&&va(b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Q.attributeNameCheck=b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),b.CUSTOM_ELEMENT_HANDLING&&typeof b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),xt&&(Ne=!1),un&&($t=!0),wt&&(R=K({},xo),j=[],wt.html===!0&&(K(R,yo),K(j,$o)),wt.svg===!0&&(K(R,Ns),K(j,Us),K(j,Sn)),wt.svgFilters===!0&&(K(R,Os),K(j,Us),K(j,Sn)),wt.mathMl===!0&&(K(R,Bs),K(j,wo),K(j,Sn))),b.ADD_TAGS&&(typeof b.ADD_TAGS=="function"?pe.tagCheck=b.ADD_TAGS:(R===P&&(R=Re(R)),K(R,b.ADD_TAGS,ne))),b.ADD_ATTR&&(typeof b.ADD_ATTR=="function"?pe.attributeCheck=b.ADD_ATTR:(j===xe&&(j=Re(j)),K(j,b.ADD_ATTR,ne))),b.ADD_URI_SAFE_ATTR&&K(hs,b.ADD_URI_SAFE_ATTR,ne),b.FORBID_CONTENTS&&(Le===fs&&(Le=Re(Le)),K(Le,b.FORBID_CONTENTS,ne)),b.ADD_FORBID_CONTENTS&&(Le===fs&&(Le=Re(Le)),K(Le,b.ADD_FORBID_CONTENTS,ne)),ps&&(R["#text"]=!0),et&&K(R,["html","head","body"]),R.table&&(K(R,["tbody"]),delete we.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw Bt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Bt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=b.TRUSTED_TYPES_POLICY,_=C.createHTML("")}else C===void 0&&(C=Ef(d,i)),C!==null&&typeof _=="string"&&(_=C.createHTML(""));ve&&ve(b),St=b}},ma=K({},[...Ns,...Os,...bf]),ba=K({},[...Bs,...yf]),Vl=function(b){let L=A(b);(!L||!L.tagName)&&(L={namespaceURI:kt,tagName:"template"});const N=Pn(b.tagName),J=Pn(L.tagName);return ms[b.namespaceURI]?b.namespaceURI===fn?L.namespaceURI===Oe?N==="svg":L.namespaceURI===pn?N==="svg"&&(J==="annotation-xml"||hn[J]):!!ma[N]:b.namespaceURI===pn?L.namespaceURI===Oe?N==="math":L.namespaceURI===fn?N==="math"&&vn[J]:!!ba[N]:b.namespaceURI===Oe?L.namespaceURI===fn&&!vn[J]||L.namespaceURI===pn&&!hn[J]?!1:!ba[N]&&(Kl[N]||!ma[N]):!!(Pt==="application/xhtml+xml"&&ms[b.namespaceURI]):!1},Me=function(b){Nt(t.removed,{element:b});try{A(b).removeChild(b)}catch{S(b)}},tt=function(b,L){try{Nt(t.removed,{attribute:L.getAttributeNode(b),from:L})}catch{Nt(t.removed,{attribute:null,from:L})}if(L.removeAttribute(b),b==="is")if($t||un)try{Me(L)}catch{}else try{L.setAttribute(b,"")}catch{}},ya=function(b){let L=null,N=null;if(gs)b="<remove></remove>"+b;else{const ee=Fs(b,/^[\r\n\t ]+/);N=ee&&ee[0]}Pt==="application/xhtml+xml"&&kt===Oe&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");const J=C?C.createHTML(b):b;if(kt===Oe)try{L=new h().parseFromString(J,Pt)}catch{}if(!L||!L.documentElement){L=T.createDocument(kt,"template",null);try{L.documentElement.innerHTML=vs?_:J}catch{}}const de=L.body||L.documentElement;return b&&N&&de.insertBefore(n.createTextNode(N),de.childNodes[0]||null),kt===Oe?Y.call(L,et?"html":"body")[0]:et?L.documentElement:de},xa=function(b){return I.call(b.ownerDocument||b,b,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},ys=function(b){return b instanceof p&&(typeof b.nodeName!="string"||typeof b.textContent!="string"||typeof b.removeChild!="function"||!(b.attributes instanceof g)||typeof b.removeAttribute!="function"||typeof b.setAttribute!="function"||typeof b.namespaceURI!="string"||typeof b.insertBefore!="function"||typeof b.hasChildNodes!="function")},$a=function(b){return typeof l=="function"&&b instanceof l};function Be(U,b,L){kn(U,N=>{N.call(t,b,L,St)})}const wa=function(b){let L=null;if(Be(F.beforeSanitizeElements,b,null),ys(b))return Me(b),!0;const N=ne(b.nodeName);if(Be(F.uponSanitizeElement,b,{tagName:N,allowedTags:R}),dn&&b.hasChildNodes()&&!$a(b.firstElementChild)&&fe(/<[/\w!]/g,b.innerHTML)&&fe(/<[/\w!]/g,b.textContent)||b.nodeType===zt.progressingInstruction||dn&&b.nodeType===zt.comment&&fe(/<[/\w]/g,b.data))return Me(b),!0;if(!(pe.tagCheck instanceof Function&&pe.tagCheck(N))&&(!R[N]||we[N])){if(!we[N]&&Sa(N)&&(Q.tagNameCheck instanceof RegExp&&fe(Q.tagNameCheck,N)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(N)))return!1;if(ps&&!Le[N]){const J=A(b)||b.parentNode,de=$(b)||b.childNodes;if(de&&J){const ee=de.length;for(let be=ee-1;be>=0;--be){const Ue=m(de[be],!0);Ue.__removalCount=(b.__removalCount||0)+1,J.insertBefore(Ue,k(b))}}}return Me(b),!0}return b instanceof c&&!Vl(b)||(N==="noscript"||N==="noembed"||N==="noframes")&&fe(/<\/no(script|embed|frames)/i,b.innerHTML)?(Me(b),!0):(xt&&b.nodeType===zt.text&&(L=b.textContent,kn([H,ce,E],J=>{L=Ot(L,J," ")}),b.textContent!==L&&(Nt(t.removed,{element:b.cloneNode()}),b.textContent=L)),Be(F.afterSanitizeElements,b,null),!1)},ka=function(b,L,N){if(ua&&(L==="id"||L==="name")&&(N in n||N in Gl))return!1;if(!(Ne&&!X[L]&&fe(B,L))){if(!(Fe&&fe(ie,L))){if(!(pe.attributeCheck instanceof Function&&pe.attributeCheck(L,b))){if(!j[L]||X[L]){if(!(Sa(b)&&(Q.tagNameCheck instanceof RegExp&&fe(Q.tagNameCheck,b)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(b))&&(Q.attributeNameCheck instanceof RegExp&&fe(Q.attributeNameCheck,L)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(L,b))||L==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&fe(Q.tagNameCheck,N)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(N))))return!1}else if(!hs[L]){if(!fe(M,Ot(N,Z,""))){if(!((L==="src"||L==="xlink:href"||L==="href")&&b!=="script"&&ff(N,"data:")===0&&pa[b])){if(!(Xe&&!fe(ae,Ot(N,Z,"")))){if(N)return!1}}}}}}}return!0},Sa=function(b){return b!=="annotation-xml"&&Fs(b,te)},Aa=function(b){Be(F.beforeSanitizeAttributes,b,null);const{attributes:L}=b;if(!L||ys(b))return;const N={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:j,forceKeepAttr:void 0};let J=L.length;for(;J--;){const de=L[J],{name:ee,namespaceURI:be,value:Ue}=de,At=ne(ee),xs=Ue;let re=ee==="value"?xs:hf(xs);if(N.attrName=At,N.attrValue=re,N.keepAttr=!0,N.forceKeepAttr=void 0,Be(F.uponSanitizeAttribute,b,N),re=N.attrValue,ga&&(At==="id"||At==="name")&&(tt(ee,b),re=Hl+re),dn&&fe(/((--!?|])>)|<\/(style|title|textarea)/i,re)){tt(ee,b);continue}if(At==="attributename"&&Fs(re,"href")){tt(ee,b);continue}if(N.forceKeepAttr)continue;if(!N.keepAttr){tt(ee,b);continue}if(!da&&fe(/\/>/i,re)){tt(ee,b);continue}xt&&kn([H,ce,E],Ta=>{re=Ot(re,Ta," ")});const Ca=ne(b.nodeName);if(!ka(Ca,At,re)){tt(ee,b);continue}if(C&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!be)switch(d.getAttributeType(Ca,At)){case"TrustedHTML":{re=C.createHTML(re);break}case"TrustedScriptURL":{re=C.createScriptURL(re);break}}if(re!==xs)try{be?b.setAttributeNS(be,ee,re):b.setAttribute(ee,re),ys(b)?Me(b):bo(t.removed)}catch{tt(ee,b)}}Be(F.afterSanitizeAttributes,b,null)},Ql=function U(b){let L=null;const N=xa(b);for(Be(F.beforeSanitizeShadowDOM,b,null);L=N.nextNode();)Be(F.uponSanitizeShadowNode,L,null),wa(L),Aa(L),L.content instanceof a&&U(L.content);Be(F.afterSanitizeShadowDOM,b,null)};return t.sanitize=function(U){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},L=null,N=null,J=null,de=null;if(vs=!U,vs&&(U="<!-->"),typeof U!="string"&&!$a(U))if(typeof U.toString=="function"){if(U=U.toString(),typeof U!="string")throw Bt("dirty is not a string, aborting")}else throw Bt("toString is not a function");if(!t.isSupported)return U;if(us||bs(b),t.removed=[],typeof U=="string"&&(Rt=!1),Rt){if(U.nodeName){const Ue=ne(U.nodeName);if(!R[Ue]||we[Ue])throw Bt("root node is forbidden and cannot be sanitized in-place")}}else if(U instanceof l)L=ya("<!---->"),N=L.ownerDocument.importNode(U,!0),N.nodeType===zt.element&&N.nodeName==="BODY"||N.nodeName==="HTML"?L=N:L.appendChild(N);else{if(!$t&&!xt&&!et&&U.indexOf("<")===-1)return C&&gn?C.createHTML(U):U;if(L=ya(U),!L)return $t?null:gn?_:""}L&&gs&&Me(L.firstChild);const ee=xa(Rt?U:L);for(;J=ee.nextNode();)wa(J),Aa(J),J.content instanceof a&&Ql(J.content);if(Rt)return U;if($t){if(un)for(de=z.call(L.ownerDocument);L.firstChild;)de.appendChild(L.firstChild);else de=L;return(j.shadowroot||j.shadowrootmode)&&(de=se.call(s,de,!0)),de}let be=et?L.outerHTML:L.innerHTML;return et&&R["!doctype"]&&L.ownerDocument&&L.ownerDocument.doctype&&L.ownerDocument.doctype.name&&fe(xl,L.ownerDocument.doctype.name)&&(be="<!DOCTYPE "+L.ownerDocument.doctype.name+`>
2243
- `+be),xt&&kn([H,ce,E],Ue=>{be=Ot(be,Ue," ")}),C&&gn?C.createHTML(be):be},t.setConfig=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};bs(U),us=!0},t.clearConfig=function(){St=null,us=!1},t.isValidAttribute=function(U,b,L){St||bs({});const N=ne(U),J=ne(b);return ka(N,J,L)},t.addHook=function(U,b){typeof b=="function"&&Nt(F[U],b)},t.removeHook=function(U,b){if(b!==void 0){const L=gf(F[U],b);return L===-1?void 0:pf(F[U],L,1)[0]}return bo(F[U])},t.removeHooks=function(U){F[U]=[]},t.removeAllHooks=function(){F=So()},t}var fi=$l();function Yi(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var yt=Yi();function wl(e){yt=e}var Jt={exec:()=>null};function W(e,t=""){let n=typeof e=="string"?e:e.source,s={replace:(i,a)=>{let o=typeof a=="string"?a:a.source;return o=o.replace(he.caret,"$1"),n=n.replace(i,o),s},getRegex:()=>new RegExp(n,t)};return s}var Lf=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),he={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},Mf=/^(?:[ \t]*(?:\n|$))+/,If=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Rf=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,cn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Pf=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ji=/(?:[*+-]|\d{1,9}[.)])/,kl=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Sl=W(kl).replace(/bull/g,Ji).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Df=W(kl).replace(/bull/g,Ji).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Zi=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Ff=/^[^\n]+/,Xi=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Nf=W(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Xi).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Of=W(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ji).getRegex(),ls="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ea=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Bf=W("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ea).replace("tag",ls).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Al=W(Zi).replace("hr",cn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ls).getRegex(),Uf=W(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Al).getRegex(),ta={blockquote:Uf,code:If,def:Nf,fences:Rf,heading:Pf,hr:cn,html:Bf,lheading:Sl,list:Of,newline:Mf,paragraph:Al,table:Jt,text:Ff},Ao=W("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",cn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ls).getRegex(),zf={...ta,lheading:Df,table:Ao,paragraph:W(Zi).replace("hr",cn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ao).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ls).getRegex()},Hf={...ta,html:W(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ea).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Jt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:W(Zi).replace("hr",cn).replace("heading",` *#{1,6} *[^
2244
- ]`).replace("lheading",Sl).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},jf=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Kf=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Cl=/^( {2,}|\\)\n(?!\s*$)/,Wf=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,cs=/[\p{P}\p{S}]/u,na=/[\s\p{P}\p{S}]/u,Tl=/[^\s\p{P}\p{S}]/u,qf=W(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,na).getRegex(),_l=/(?!~)[\p{P}\p{S}]/u,Gf=/(?!~)[\s\p{P}\p{S}]/u,Vf=/(?:[^\s\p{P}\p{S}]|~)/u,Qf=W(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Lf?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),El=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Yf=W(El,"u").replace(/punct/g,cs).getRegex(),Jf=W(El,"u").replace(/punct/g,_l).getRegex(),Ll="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Zf=W(Ll,"gu").replace(/notPunctSpace/g,Tl).replace(/punctSpace/g,na).replace(/punct/g,cs).getRegex(),Xf=W(Ll,"gu").replace(/notPunctSpace/g,Vf).replace(/punctSpace/g,Gf).replace(/punct/g,_l).getRegex(),eh=W("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Tl).replace(/punctSpace/g,na).replace(/punct/g,cs).getRegex(),th=W(/\\(punct)/,"gu").replace(/punct/g,cs).getRegex(),nh=W(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),sh=W(ea).replace("(?:-->|$)","-->").getRegex(),ih=W("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",sh).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Hn=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,ah=W(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Hn).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ml=W(/^!?\[(label)\]\[(ref)\]/).replace("label",Hn).replace("ref",Xi).getRegex(),Il=W(/^!?\[(ref)\](?:\[\])?/).replace("ref",Xi).getRegex(),oh=W("reflink|nolink(?!\\()","g").replace("reflink",Ml).replace("nolink",Il).getRegex(),Co=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,sa={_backpedal:Jt,anyPunctuation:th,autolink:nh,blockSkip:Qf,br:Cl,code:Kf,del:Jt,emStrongLDelim:Yf,emStrongRDelimAst:Zf,emStrongRDelimUnd:eh,escape:jf,link:ah,nolink:Il,punctuation:qf,reflink:Ml,reflinkSearch:oh,tag:ih,text:Wf,url:Jt},rh={...sa,link:W(/^!?\[(label)\]\((.*?)\)/).replace("label",Hn).getRegex(),reflink:W(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Hn).getRegex()},hi={...sa,emStrongRDelimAst:Xf,emStrongLDelim:Jf,url:W(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Co).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:W(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Co).getRegex()},lh={...hi,br:W(Cl).replace("{2,}","*").getRegex(),text:W(hi.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},An={normal:ta,gfm:zf,pedantic:Hf},Ht={normal:sa,gfm:hi,breaks:lh,pedantic:rh},ch={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},To=e=>ch[e];function je(e,t){if(t){if(he.escapeTest.test(e))return e.replace(he.escapeReplace,To)}else if(he.escapeTestNoEncode.test(e))return e.replace(he.escapeReplaceNoEncode,To);return e}function _o(e){try{e=encodeURI(e).replace(he.percentDecode,"%")}catch{return null}return e}function Eo(e,t){let n=e.replace(he.findPipe,(a,o,l)=>{let c=!1,u=o;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),s=n.split(he.splitPipe),i=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length<t;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(he.slashPipe,"|");return s}function jt(e,t,n){let s=e.length;if(s===0)return"";let i=0;for(;i<s&&e.charAt(s-i-1)===t;)i++;return e.slice(0,s-i)}function dh(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let s=0;s<e.length;s++)if(e[s]==="\\")s++;else if(e[s]===t[0])n++;else if(e[s]===t[1]&&(n--,n<0))return s;return n>0?-2:-1}function Lo(e,t,n,s,i){let a=t.href,o=t.title||null,l=e[1].replace(i.other.outputLinkReplace,"$1");s.state.inLink=!0;let c={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:a,title:o,text:l,tokens:s.inlineTokens(l)};return s.state.inLink=!1,c}function uh(e,t,n){let s=e.match(n.other.indentCodeCompensation);if(s===null)return t;let i=s[1];return t.split(`
2242
+ `}const Jt=(e,t)=>{const n=e._$AN;if(n===void 0)return!1;for(const s of n)s._$AO?.(t,!1),Jt(s,t);return!0},jn=e=>{let t,n;do{if((t=e._$AM)===void 0)break;n=t._$AN,n.delete(e),e=t}while(n?.size===0)},$l=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(n===void 0)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),hf(t)}};function pf(e){this._$AN!==void 0?(jn(this),this._$AM=e,$l(this)):this._$AM=e}function ff(e,t=!1,n=0){const s=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(s))for(let a=n;a<s.length;a++)Jt(s[a],!1),jn(s[a]);else s!=null&&(Jt(s,!1),jn(s));else Jt(this,e)}const hf=e=>{e.type==qi.CHILD&&(e._$AP??=ff,e._$AQ??=pf)};class vf extends Vi{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,n,s){super._$AT(t,n,s),$l(this),this.isConnected=t._$AU}_$AO(t,n=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),n&&(Jt(this,t),jn(this))}setValue(t){if(Cg(this._$Ct))this._$Ct._$AI(t,this);else{const n=[...this._$Ct._$AH];n[this._$Ci]=t,this._$Ct._$AI(n,this,0)}}disconnected(){}reconnected(){}}const Ds=new WeakMap,mf=Gi(class extends vf{render(e){return v}update(e,[t]){const n=t!==this.G;return n&&this.G!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.G=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),v}rt(e){if(this.isConnected||(e=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let n=Ds.get(t);n===void 0&&(n=new WeakMap,Ds.set(t,n)),n.get(this.G)!==void 0&&this.G.call(this.ht,void 0),n.set(this.G,e),e!==void 0&&this.G.call(this.ht,e)}else this.G.value=e}get lt(){return typeof this.G=="function"?Ds.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});class ci extends Vi{constructor(t){if(super(t),this.it=v,t.type!==qi.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===v||t==null)return this._t=void 0,this.it=t;if(t===Ye)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const n=[t];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}}ci.directiveName="unsafeHTML",ci.resultType=1;const di=Gi(ci);const{entries:wl,setPrototypeOf:xo,isFrozen:bf,getPrototypeOf:yf,getOwnPropertyDescriptor:xf}=Object;let{freeze:ve,seal:Ce,create:ui}=Object,{apply:gi,construct:pi}=typeof Reflect<"u"&&Reflect;ve||(ve=function(t){return t});Ce||(Ce=function(t){return t});gi||(gi=function(t,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),a=2;a<s;a++)i[a-2]=arguments[a];return t.apply(n,i)});pi||(pi=function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return new t(...s)});const An=me(Array.prototype.forEach),$f=me(Array.prototype.lastIndexOf),$o=me(Array.prototype.pop),Ot=me(Array.prototype.push),wf=me(Array.prototype.splice),Fn=me(String.prototype.toLowerCase),Fs=me(String.prototype.toString),Ns=me(String.prototype.match),Bt=me(String.prototype.replace),kf=me(String.prototype.indexOf),Sf=me(String.prototype.trim),Te=me(Object.prototype.hasOwnProperty),fe=me(RegExp.prototype.test),Ut=Af(TypeError);function me(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return gi(e,t,s)}}function Af(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return pi(e,n)}}function K(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Fn;xo&&xo(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const a=n(i);a!==i&&(bf(t)||(t[s]=a),i=a)}e[i]=!0}return e}function Cf(e){for(let t=0;t<e.length;t++)Te(e,t)||(e[t]=null);return e}function Pe(e){const t=ui(null);for(const[n,s]of wl(e))Te(e,n)&&(Array.isArray(s)?t[n]=Cf(s):s&&typeof s=="object"&&s.constructor===Object?t[n]=Pe(s):t[n]=s);return t}function zt(e,t){for(;e!==null;){const s=xf(e,t);if(s){if(s.get)return me(s.get);if(typeof s.value=="function")return me(s.value)}e=yf(e)}function n(){return null}return n}const wo=ve(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Os=ve(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Bs=ve(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Tf=ve(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Us=ve(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),_f=ve(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ko=ve(["#text"]),So=ve(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),zs=ve(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Ao=ve(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Cn=ve(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ef=Ce(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Lf=Ce(/<%[\w\W]*|[\w\W]*%>/gm),Mf=Ce(/\$\{[\w\W]*/gm),If=Ce(/^data-[\-\w.\u00B7-\uFFFF]+$/),Rf=Ce(/^aria-[\-\w]+$/),kl=Ce(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Pf=Ce(/^(?:\w+script|data):/i),Df=Ce(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Sl=Ce(/^html$/i),Ff=Ce(/^[a-z][.\w]*(-[.\w]+)+$/i);var Co=Object.freeze({__proto__:null,ARIA_ATTR:Rf,ATTR_WHITESPACE:Df,CUSTOM_ELEMENT:Ff,DATA_ATTR:If,DOCTYPE_NAME:Sl,ERB_EXPR:Lf,IS_ALLOWED_URI:kl,IS_SCRIPT_OR_DATA:Pf,MUSTACHE_EXPR:Ef,TMPLIT_EXPR:Mf});const Ht={element:1,text:3,progressingInstruction:7,comment:8,document:9},Nf=function(){return typeof window>"u"?null:window},Of=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(s=n.getAttribute(i));const a="dompurify"+(s?"#"+s:"");try{return t.createPolicy(a,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},To=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Al(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Nf();const t=U=>Al(U);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Ht.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const s=n,i=s.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:l,Element:c,NodeFilter:u,NamedNodeMap:g=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:h,trustedTypes:d}=e,f=c.prototype,m=zt(f,"cloneNode"),S=zt(f,"remove"),k=zt(f,"nextSibling"),$=zt(f,"childNodes"),A=zt(f,"parentNode");if(typeof o=="function"){const U=n.createElement("template");U.content&&U.content.ownerDocument&&(n=U.content.ownerDocument)}let C,_="";const{implementation:T,createNodeIterator:I,createDocumentFragment:z,getElementsByTagName:Y}=n,{importNode:se}=s;let F=To();t.isSupported=typeof wl=="function"&&typeof A=="function"&&T&&T.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:H,ERB_EXPR:ce,TMPLIT_EXPR:E,DATA_ATTR:B,ARIA_ATTR:ie,IS_SCRIPT_OR_DATA:ae,ATTR_WHITESPACE:Z,CUSTOM_ELEMENT:te}=Co;let{IS_ALLOWED_URI:M}=Co,R=null;const P=K({},[...wo,...Os,...Bs,...Us,...ko]);let j=null;const xe=K({},[...So,...zs,...Ao,...Cn]);let Q=Object.seal(ui(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ke=null,X=null;const pe=Object.seal(ui(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Fe=!0,Ne=!0,et=!1,ua=!0,wt=!1,gn=!0,tt=!1,gs=!1,ps=!1,kt=!1,pn=!1,fn=!1,ga=!0,pa=!1;const Yl="user-content-";let fs=!0,Pt=!1,St={},Me=null;const hs=K({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let fa=null;const ha=K({},["audio","video","img","source","image","track"]);let vs=null;const va=K({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),hn="http://www.w3.org/1998/Math/MathML",vn="http://www.w3.org/2000/svg",Oe="http://www.w3.org/1999/xhtml";let At=Oe,ms=!1,bs=null;const Jl=K({},[hn,vn,Oe],Fs);let mn=K({},["mi","mo","mn","ms","mtext"]),bn=K({},["annotation-xml"]);const Zl=K({},["title","style","font","a","script"]);let Dt=null;const Xl=["application/xhtml+xml","text/html"],ec="text/html";let ne=null,Ct=null;const tc=n.createElement("form"),ma=function(b){return b instanceof RegExp||b instanceof Function},ys=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ct&&Ct===b)){if((!b||typeof b!="object")&&(b={}),b=Pe(b),Dt=Xl.indexOf(b.PARSER_MEDIA_TYPE)===-1?ec:b.PARSER_MEDIA_TYPE,ne=Dt==="application/xhtml+xml"?Fs:Fn,R=Te(b,"ALLOWED_TAGS")?K({},b.ALLOWED_TAGS,ne):P,j=Te(b,"ALLOWED_ATTR")?K({},b.ALLOWED_ATTR,ne):xe,bs=Te(b,"ALLOWED_NAMESPACES")?K({},b.ALLOWED_NAMESPACES,Fs):Jl,vs=Te(b,"ADD_URI_SAFE_ATTR")?K(Pe(va),b.ADD_URI_SAFE_ATTR,ne):va,fa=Te(b,"ADD_DATA_URI_TAGS")?K(Pe(ha),b.ADD_DATA_URI_TAGS,ne):ha,Me=Te(b,"FORBID_CONTENTS")?K({},b.FORBID_CONTENTS,ne):hs,ke=Te(b,"FORBID_TAGS")?K({},b.FORBID_TAGS,ne):Pe({}),X=Te(b,"FORBID_ATTR")?K({},b.FORBID_ATTR,ne):Pe({}),St=Te(b,"USE_PROFILES")?b.USE_PROFILES:!1,Fe=b.ALLOW_ARIA_ATTR!==!1,Ne=b.ALLOW_DATA_ATTR!==!1,et=b.ALLOW_UNKNOWN_PROTOCOLS||!1,ua=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,wt=b.SAFE_FOR_TEMPLATES||!1,gn=b.SAFE_FOR_XML!==!1,tt=b.WHOLE_DOCUMENT||!1,kt=b.RETURN_DOM||!1,pn=b.RETURN_DOM_FRAGMENT||!1,fn=b.RETURN_TRUSTED_TYPE||!1,ps=b.FORCE_BODY||!1,ga=b.SANITIZE_DOM!==!1,pa=b.SANITIZE_NAMED_PROPS||!1,fs=b.KEEP_CONTENT!==!1,Pt=b.IN_PLACE||!1,M=b.ALLOWED_URI_REGEXP||kl,At=b.NAMESPACE||Oe,mn=b.MATHML_TEXT_INTEGRATION_POINTS||mn,bn=b.HTML_INTEGRATION_POINTS||bn,Q=b.CUSTOM_ELEMENT_HANDLING||{},b.CUSTOM_ELEMENT_HANDLING&&ma(b.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Q.tagNameCheck=b.CUSTOM_ELEMENT_HANDLING.tagNameCheck),b.CUSTOM_ELEMENT_HANDLING&&ma(b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Q.attributeNameCheck=b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),b.CUSTOM_ELEMENT_HANDLING&&typeof b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),wt&&(Ne=!1),pn&&(kt=!0),St&&(R=K({},ko),j=[],St.html===!0&&(K(R,wo),K(j,So)),St.svg===!0&&(K(R,Os),K(j,zs),K(j,Cn)),St.svgFilters===!0&&(K(R,Bs),K(j,zs),K(j,Cn)),St.mathMl===!0&&(K(R,Us),K(j,Ao),K(j,Cn))),b.ADD_TAGS&&(typeof b.ADD_TAGS=="function"?pe.tagCheck=b.ADD_TAGS:(R===P&&(R=Pe(R)),K(R,b.ADD_TAGS,ne))),b.ADD_ATTR&&(typeof b.ADD_ATTR=="function"?pe.attributeCheck=b.ADD_ATTR:(j===xe&&(j=Pe(j)),K(j,b.ADD_ATTR,ne))),b.ADD_URI_SAFE_ATTR&&K(vs,b.ADD_URI_SAFE_ATTR,ne),b.FORBID_CONTENTS&&(Me===hs&&(Me=Pe(Me)),K(Me,b.FORBID_CONTENTS,ne)),b.ADD_FORBID_CONTENTS&&(Me===hs&&(Me=Pe(Me)),K(Me,b.ADD_FORBID_CONTENTS,ne)),fs&&(R["#text"]=!0),tt&&K(R,["html","head","body"]),R.table&&(K(R,["tbody"]),delete ke.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ut('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ut('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=b.TRUSTED_TYPES_POLICY,_=C.createHTML("")}else C===void 0&&(C=Of(d,i)),C!==null&&typeof _=="string"&&(_=C.createHTML(""));ve&&ve(b),Ct=b}},ba=K({},[...Os,...Bs,...Tf]),ya=K({},[...Us,..._f]),nc=function(b){let L=A(b);(!L||!L.tagName)&&(L={namespaceURI:At,tagName:"template"});const N=Fn(b.tagName),J=Fn(L.tagName);return bs[b.namespaceURI]?b.namespaceURI===vn?L.namespaceURI===Oe?N==="svg":L.namespaceURI===hn?N==="svg"&&(J==="annotation-xml"||mn[J]):!!ba[N]:b.namespaceURI===hn?L.namespaceURI===Oe?N==="math":L.namespaceURI===vn?N==="math"&&bn[J]:!!ya[N]:b.namespaceURI===Oe?L.namespaceURI===vn&&!bn[J]||L.namespaceURI===hn&&!mn[J]?!1:!ya[N]&&(Zl[N]||!ba[N]):!!(Dt==="application/xhtml+xml"&&bs[b.namespaceURI]):!1},Ie=function(b){Ot(t.removed,{element:b});try{A(b).removeChild(b)}catch{S(b)}},nt=function(b,L){try{Ot(t.removed,{attribute:L.getAttributeNode(b),from:L})}catch{Ot(t.removed,{attribute:null,from:L})}if(L.removeAttribute(b),b==="is")if(kt||pn)try{Ie(L)}catch{}else try{L.setAttribute(b,"")}catch{}},xa=function(b){let L=null,N=null;if(ps)b="<remove></remove>"+b;else{const ee=Ns(b,/^[\r\n\t ]+/);N=ee&&ee[0]}Dt==="application/xhtml+xml"&&At===Oe&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");const J=C?C.createHTML(b):b;if(At===Oe)try{L=new h().parseFromString(J,Dt)}catch{}if(!L||!L.documentElement){L=T.createDocument(At,"template",null);try{L.documentElement.innerHTML=ms?_:J}catch{}}const de=L.body||L.documentElement;return b&&N&&de.insertBefore(n.createTextNode(N),de.childNodes[0]||null),At===Oe?Y.call(L,tt?"html":"body")[0]:tt?L.documentElement:de},$a=function(b){return I.call(b.ownerDocument||b,b,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},xs=function(b){return b instanceof p&&(typeof b.nodeName!="string"||typeof b.textContent!="string"||typeof b.removeChild!="function"||!(b.attributes instanceof g)||typeof b.removeAttribute!="function"||typeof b.setAttribute!="function"||typeof b.namespaceURI!="string"||typeof b.insertBefore!="function"||typeof b.hasChildNodes!="function")},wa=function(b){return typeof l=="function"&&b instanceof l};function Be(U,b,L){An(U,N=>{N.call(t,b,L,Ct)})}const ka=function(b){let L=null;if(Be(F.beforeSanitizeElements,b,null),xs(b))return Ie(b),!0;const N=ne(b.nodeName);if(Be(F.uponSanitizeElement,b,{tagName:N,allowedTags:R}),gn&&b.hasChildNodes()&&!wa(b.firstElementChild)&&fe(/<[/\w!]/g,b.innerHTML)&&fe(/<[/\w!]/g,b.textContent)||b.nodeType===Ht.progressingInstruction||gn&&b.nodeType===Ht.comment&&fe(/<[/\w]/g,b.data))return Ie(b),!0;if(!(pe.tagCheck instanceof Function&&pe.tagCheck(N))&&(!R[N]||ke[N])){if(!ke[N]&&Aa(N)&&(Q.tagNameCheck instanceof RegExp&&fe(Q.tagNameCheck,N)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(N)))return!1;if(fs&&!Me[N]){const J=A(b)||b.parentNode,de=$(b)||b.childNodes;if(de&&J){const ee=de.length;for(let be=ee-1;be>=0;--be){const Ue=m(de[be],!0);Ue.__removalCount=(b.__removalCount||0)+1,J.insertBefore(Ue,k(b))}}}return Ie(b),!0}return b instanceof c&&!nc(b)||(N==="noscript"||N==="noembed"||N==="noframes")&&fe(/<\/no(script|embed|frames)/i,b.innerHTML)?(Ie(b),!0):(wt&&b.nodeType===Ht.text&&(L=b.textContent,An([H,ce,E],J=>{L=Bt(L,J," ")}),b.textContent!==L&&(Ot(t.removed,{element:b.cloneNode()}),b.textContent=L)),Be(F.afterSanitizeElements,b,null),!1)},Sa=function(b,L,N){if(ga&&(L==="id"||L==="name")&&(N in n||N in tc))return!1;if(!(Ne&&!X[L]&&fe(B,L))){if(!(Fe&&fe(ie,L))){if(!(pe.attributeCheck instanceof Function&&pe.attributeCheck(L,b))){if(!j[L]||X[L]){if(!(Aa(b)&&(Q.tagNameCheck instanceof RegExp&&fe(Q.tagNameCheck,b)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(b))&&(Q.attributeNameCheck instanceof RegExp&&fe(Q.attributeNameCheck,L)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(L,b))||L==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&fe(Q.tagNameCheck,N)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(N))))return!1}else if(!vs[L]){if(!fe(M,Bt(N,Z,""))){if(!((L==="src"||L==="xlink:href"||L==="href")&&b!=="script"&&kf(N,"data:")===0&&fa[b])){if(!(et&&!fe(ae,Bt(N,Z,"")))){if(N)return!1}}}}}}}return!0},Aa=function(b){return b!=="annotation-xml"&&Ns(b,te)},Ca=function(b){Be(F.beforeSanitizeAttributes,b,null);const{attributes:L}=b;if(!L||xs(b))return;const N={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:j,forceKeepAttr:void 0};let J=L.length;for(;J--;){const de=L[J],{name:ee,namespaceURI:be,value:Ue}=de,Tt=ne(ee),$s=Ue;let re=ee==="value"?$s:Sf($s);if(N.attrName=Tt,N.attrValue=re,N.keepAttr=!0,N.forceKeepAttr=void 0,Be(F.uponSanitizeAttribute,b,N),re=N.attrValue,pa&&(Tt==="id"||Tt==="name")&&(nt(ee,b),re=Yl+re),gn&&fe(/((--!?|])>)|<\/(style|title|textarea)/i,re)){nt(ee,b);continue}if(Tt==="attributename"&&Ns(re,"href")){nt(ee,b);continue}if(N.forceKeepAttr)continue;if(!N.keepAttr){nt(ee,b);continue}if(!ua&&fe(/\/>/i,re)){nt(ee,b);continue}wt&&An([H,ce,E],_a=>{re=Bt(re,_a," ")});const Ta=ne(b.nodeName);if(!Sa(Ta,Tt,re)){nt(ee,b);continue}if(C&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!be)switch(d.getAttributeType(Ta,Tt)){case"TrustedHTML":{re=C.createHTML(re);break}case"TrustedScriptURL":{re=C.createScriptURL(re);break}}if(re!==$s)try{be?b.setAttributeNS(be,ee,re):b.setAttribute(ee,re),xs(b)?Ie(b):$o(t.removed)}catch{nt(ee,b)}}Be(F.afterSanitizeAttributes,b,null)},sc=function U(b){let L=null;const N=$a(b);for(Be(F.beforeSanitizeShadowDOM,b,null);L=N.nextNode();)Be(F.uponSanitizeShadowNode,L,null),ka(L),Ca(L),L.content instanceof a&&U(L.content);Be(F.afterSanitizeShadowDOM,b,null)};return t.sanitize=function(U){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},L=null,N=null,J=null,de=null;if(ms=!U,ms&&(U="<!-->"),typeof U!="string"&&!wa(U))if(typeof U.toString=="function"){if(U=U.toString(),typeof U!="string")throw Ut("dirty is not a string, aborting")}else throw Ut("toString is not a function");if(!t.isSupported)return U;if(gs||ys(b),t.removed=[],typeof U=="string"&&(Pt=!1),Pt){if(U.nodeName){const Ue=ne(U.nodeName);if(!R[Ue]||ke[Ue])throw Ut("root node is forbidden and cannot be sanitized in-place")}}else if(U instanceof l)L=xa("<!---->"),N=L.ownerDocument.importNode(U,!0),N.nodeType===Ht.element&&N.nodeName==="BODY"||N.nodeName==="HTML"?L=N:L.appendChild(N);else{if(!kt&&!wt&&!tt&&U.indexOf("<")===-1)return C&&fn?C.createHTML(U):U;if(L=xa(U),!L)return kt?null:fn?_:""}L&&ps&&Ie(L.firstChild);const ee=$a(Pt?U:L);for(;J=ee.nextNode();)ka(J),Ca(J),J.content instanceof a&&sc(J.content);if(Pt)return U;if(kt){if(pn)for(de=z.call(L.ownerDocument);L.firstChild;)de.appendChild(L.firstChild);else de=L;return(j.shadowroot||j.shadowrootmode)&&(de=se.call(s,de,!0)),de}let be=tt?L.outerHTML:L.innerHTML;return tt&&R["!doctype"]&&L.ownerDocument&&L.ownerDocument.doctype&&L.ownerDocument.doctype.name&&fe(Sl,L.ownerDocument.doctype.name)&&(be="<!DOCTYPE "+L.ownerDocument.doctype.name+`>
2243
+ `+be),wt&&An([H,ce,E],Ue=>{be=Bt(be,Ue," ")}),C&&fn?C.createHTML(be):be},t.setConfig=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ys(U),gs=!0},t.clearConfig=function(){Ct=null,gs=!1},t.isValidAttribute=function(U,b,L){Ct||ys({});const N=ne(U),J=ne(b);return Sa(N,J,L)},t.addHook=function(U,b){typeof b=="function"&&Ot(F[U],b)},t.removeHook=function(U,b){if(b!==void 0){const L=$f(F[U],b);return L===-1?void 0:wf(F[U],L,1)[0]}return $o(F[U])},t.removeHooks=function(U){F[U]=[]},t.removeAllHooks=function(){F=To()},t}var fi=Al();function Ji(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var $t=Ji();function Cl(e){$t=e}var ct={exec:()=>null};function W(e,t=""){let n=typeof e=="string"?e:e.source,s={replace:(i,a)=>{let o=typeof a=="string"?a:a.source;return o=o.replace(he.caret,"$1"),n=n.replace(i,o),s},getRegex:()=>new RegExp(n,t)};return s}var Bf=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),he={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}>`)},Uf=/^(?:[ \t]*(?:\n|$))+/,zf=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Hf=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,un=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,jf=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Zi=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Tl=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_l=W(Tl).replace(/bull/g,Zi).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Kf=W(Tl).replace(/bull/g,Zi).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Xi=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Wf=/^[^\n]+/,ea=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,qf=W(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ea).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Gf=W(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Zi).getRegex(),cs="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ta=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Vf=W("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ta).replace("tag",cs).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),El=W(Xi).replace("hr",un).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",cs).getRegex(),Qf=W(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",El).getRegex(),na={blockquote:Qf,code:zf,def:qf,fences:Hf,heading:jf,hr:un,html:Vf,lheading:_l,list:Gf,newline:Uf,paragraph:El,table:ct,text:Wf},_o=W("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",un).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",cs).getRegex(),Yf={...na,lheading:Kf,table:_o,paragraph:W(Xi).replace("hr",un).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",_o).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",cs).getRegex()},Jf={...na,html:W(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ta).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:ct,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:W(Xi).replace("hr",un).replace("heading",` *#{1,6} *[^
2244
+ ]`).replace("lheading",_l).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Zf=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Xf=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ll=/^( {2,}|\\)\n(?!\s*$)/,eh=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ds=/[\p{P}\p{S}]/u,sa=/[\s\p{P}\p{S}]/u,Ml=/[^\s\p{P}\p{S}]/u,th=W(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,sa).getRegex(),Il=/(?!~)[\p{P}\p{S}]/u,nh=/(?!~)[\s\p{P}\p{S}]/u,sh=/(?:[^\s\p{P}\p{S}]|~)/u,Rl=/(?![*_])[\p{P}\p{S}]/u,ih=/(?![*_])[\s\p{P}\p{S}]/u,ah=/(?:[^\s\p{P}\p{S}]|[*_])/u,oh=W(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Bf?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Pl=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,rh=W(Pl,"u").replace(/punct/g,ds).getRegex(),lh=W(Pl,"u").replace(/punct/g,Il).getRegex(),Dl="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ch=W(Dl,"gu").replace(/notPunctSpace/g,Ml).replace(/punctSpace/g,sa).replace(/punct/g,ds).getRegex(),dh=W(Dl,"gu").replace(/notPunctSpace/g,sh).replace(/punctSpace/g,nh).replace(/punct/g,Il).getRegex(),uh=W("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ml).replace(/punctSpace/g,sa).replace(/punct/g,ds).getRegex(),gh=W(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Rl).getRegex(),ph="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",fh=W(ph,"gu").replace(/notPunctSpace/g,ah).replace(/punctSpace/g,ih).replace(/punct/g,Rl).getRegex(),hh=W(/\\(punct)/,"gu").replace(/punct/g,ds).getRegex(),vh=W(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),mh=W(ta).replace("(?:-->|$)","-->").getRegex(),bh=W("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",mh).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Kn=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,yh=W(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Kn).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Fl=W(/^!?\[(label)\]\[(ref)\]/).replace("label",Kn).replace("ref",ea).getRegex(),Nl=W(/^!?\[(ref)\](?:\[\])?/).replace("ref",ea).getRegex(),xh=W("reflink|nolink(?!\\()","g").replace("reflink",Fl).replace("nolink",Nl).getRegex(),Eo=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ia={_backpedal:ct,anyPunctuation:hh,autolink:vh,blockSkip:oh,br:Ll,code:Xf,del:ct,delLDelim:ct,delRDelim:ct,emStrongLDelim:rh,emStrongRDelimAst:ch,emStrongRDelimUnd:uh,escape:Zf,link:yh,nolink:Nl,punctuation:th,reflink:Fl,reflinkSearch:xh,tag:bh,text:eh,url:ct},$h={...ia,link:W(/^!?\[(label)\]\((.*?)\)/).replace("label",Kn).getRegex(),reflink:W(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Kn).getRegex()},hi={...ia,emStrongRDelimAst:dh,emStrongLDelim:lh,delLDelim:gh,delRDelim:fh,url:W(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Eo).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:W(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Eo).getRegex()},wh={...hi,br:W(Ll).replace("{2,}","*").getRegex(),text:W(hi.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Tn={normal:na,gfm:Yf,pedantic:Jf},jt={normal:ia,gfm:hi,breaks:wh,pedantic:$h},kh={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Lo=e=>kh[e];function je(e,t){if(t){if(he.escapeTest.test(e))return e.replace(he.escapeReplace,Lo)}else if(he.escapeTestNoEncode.test(e))return e.replace(he.escapeReplaceNoEncode,Lo);return e}function Mo(e){try{e=encodeURI(e).replace(he.percentDecode,"%")}catch{return null}return e}function Io(e,t){let n=e.replace(he.findPipe,(a,o,l)=>{let c=!1,u=o;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),s=n.split(he.splitPipe),i=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length<t;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(he.slashPipe,"|");return s}function Kt(e,t,n){let s=e.length;if(s===0)return"";let i=0;for(;i<s&&e.charAt(s-i-1)===t;)i++;return e.slice(0,s-i)}function Sh(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let s=0;s<e.length;s++)if(e[s]==="\\")s++;else if(e[s]===t[0])n++;else if(e[s]===t[1]&&(n--,n<0))return s;return n>0?-2:-1}function Ah(e,t=0){let n=t,s="";for(let i of e)if(i===" "){let a=4-n%4;s+=" ".repeat(a),n+=a}else s+=i,n++;return s}function Ro(e,t,n,s,i){let a=t.href,o=t.title||null,l=e[1].replace(i.other.outputLinkReplace,"$1");s.state.inLink=!0;let c={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:a,title:o,text:l,tokens:s.inlineTokens(l)};return s.state.inLink=!1,c}function Ch(e,t,n){let s=e.match(n.other.indentCodeCompensation);if(s===null)return t;let i=s[1];return t.split(`
2245
2245
  `).map(a=>{let o=a.match(n.other.beginningSpace);if(o===null)return a;let[l]=o;return l.length>=i.length?a.slice(i.length):a}).join(`
2246
- `)}var jn=class{options;rules;lexer;constructor(e){this.options=e||yt}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:jt(n,`
2247
- `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],s=uh(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let s=jt(n,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(n=s.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:jt(t[0],`
2248
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=jt(t[0],`
2246
+ `)}var Wn=class{options;rules;lexer;constructor(e){this.options=e||$t}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Kt(n,`
2247
+ `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],s=Ch(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let s=Kt(n,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(n=s.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Kt(t[0],`
2248
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Kt(t[0],`
2249
2249
  `).split(`
2250
2250
  `),s="",i="",a=[];for(;n.length>0;){let o=!1,l=[],c;for(c=0;c<n.length;c++)if(this.rules.other.blockquoteStart.test(n[c]))l.push(n[c]),o=!0;else if(!o)l.push(n[c]);else break;n=n.slice(c);let u=l.join(`
2251
2251
  `),g=u.replace(this.rules.other.blockquoteSetextReplace,`
@@ -2256,16 +2256,16 @@ ${g}`:g;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
2256
2256
  `),m=this.blockquote(f);a[a.length-1]=m,s=s.substring(0,s.length-d.raw.length)+m.raw,i=i.substring(0,i.length-d.text.length)+m.text;break}else if(h?.type==="list"){let d=h,f=d.raw+`
2257
2257
  `+n.join(`
2258
2258
  `),m=this.list(f);a[a.length-1]=m,s=s.substring(0,s.length-h.raw.length)+m.raw,i=i.substring(0,i.length-d.raw.length)+m.raw,n=f.substring(a.at(-1).raw.length).split(`
2259
- `);continue}}return{type:"blockquote",raw:s,tokens:a,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),s=n.length>1,i={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let c=!1,u="",g="";if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;u=t[0],e=e.substring(u.length);let p=t[2].split(`
2260
- `,1)[0].replace(this.rules.other.listReplaceTabs,m=>" ".repeat(3*m.length)),h=e.split(`
2261
- `,1)[0],d=!p.trim(),f=0;if(this.options.pedantic?(f=2,g=p.trimStart()):d?f=t[1].length+1:(f=t[2].search(this.rules.other.nonSpaceChar),f=f>4?1:f,g=p.slice(f),f+=t[1].length),d&&this.rules.other.blankLine.test(h)&&(u+=h+`
2262
- `,e=e.substring(h.length+1),c=!0),!c){let m=this.rules.other.nextBulletRegex(f),S=this.rules.other.hrRegex(f),k=this.rules.other.fencesBeginRegex(f),$=this.rules.other.headingBeginRegex(f),A=this.rules.other.htmlBeginRegex(f);for(;e;){let C=e.split(`
2263
- `,1)[0],_;if(h=C,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),_=h):_=h.replace(this.rules.other.tabCharGlobal," "),k.test(h)||$.test(h)||A.test(h)||m.test(h)||S.test(h))break;if(_.search(this.rules.other.nonSpaceChar)>=f||!h.trim())g+=`
2264
- `+_.slice(f);else{if(d||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||k.test(p)||$.test(p)||S.test(p))break;g+=`
2265
- `+h}!d&&!h.trim()&&(d=!0),u+=C+`
2266
- `,e=e.substring(C.length+1),p=_.slice(f)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(o=!0)),i.items.push({type:"list_item",raw:u,task:!!this.options.gfm&&this.rules.other.listIsTask.test(g),loose:!1,text:g,tokens:[]}),i.raw+=u}let l=i.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let c of i.items){if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),c.task){if(c.text=c.text.replace(this.rules.other.listReplaceTask,""),c.tokens[0]?.type==="text"||c.tokens[0]?.type==="paragraph"){c.tokens[0].raw=c.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),c.tokens[0].text=c.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let g=this.lexer.inlineQueue.length-1;g>=0;g--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)){this.lexer.inlineQueue[g].src=this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask,"");break}}let u=this.rules.other.listTaskCheckbox.exec(c.raw);if(u){let g={type:"checkbox",raw:u[0]+" ",checked:u[0]!=="[ ]"};c.checked=g.checked,i.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=g.raw+c.tokens[0].raw,c.tokens[0].text=g.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(g)):c.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):c.tokens.unshift(g)}}if(!i.loose){let u=c.tokens.filter(p=>p.type==="space"),g=u.length>0&&u.some(p=>this.rules.other.anyLine.test(p.raw));i.loose=g}}if(i.loose)for(let c of i.items){c.loose=!0;for(let u of c.tokens)u.type==="text"&&(u.type="paragraph")}return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:s,title:i}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Eo(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
2267
- `):[],a={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?a.align.push("right"):this.rules.other.tableAlignCenter.test(o)?a.align.push("center"):this.rules.other.tableAlignLeft.test(o)?a.align.push("left"):a.align.push(null);for(let o=0;o<n.length;o++)a.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:a.align[o]});for(let o of i)a.rows.push(Eo(o,a.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:a.align[c]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
2268
- `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let a=jt(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{let a=dh(t[2],"()");if(a===-2)return;if(a>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+a;t[2]=t[2].substring(0,a),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let s=t[2],i="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(s);a&&(s=a[1],i=a[3])}else i=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),Lo(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[s.toLowerCase()];if(!i){let a=n[0].charAt(0);return{type:"text",raw:a,text:a}}return Lo(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!(!s||s[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[2])||!n||this.rules.inline.punctuation.exec(n))){let i=[...s[0]].length-1,a,o,l=i,c=0,u=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+i);(s=u.exec(t))!=null;){if(a=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!a)continue;if(o=[...a].length,s[3]||s[4]){l+=o;continue}else if((s[5]||s[6])&&i%3&&!((i+o)%3)){c+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+c);let g=[...s[0]][0].length,p=e.slice(0,i+s.index+g+o);if(Math.min(i,o)%2){let d=p.slice(1,-1);return{type:"em",raw:p,text:d,tokens:this.lexer.inlineTokens(d)}}let h=p.slice(2,-2);return{type:"strong",raw:p,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,s;return t[2]==="@"?(n=t[1],s="mailto:"+n):(n=t[1],s=n),{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,s;if(t[2]==="@")n=t[0],s="mailto:"+n;else{let i;do i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(i!==t[0]);n=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},Te=class vi{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||yt,this.options.tokenizer=this.options.tokenizer||new jn,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:he,block:An.normal,inline:Ht.normal};this.options.pedantic?(n.block=An.pedantic,n.inline=Ht.pedantic):this.options.gfm&&(n.block=An.gfm,this.options.breaks?n.inline=Ht.breaks:n.inline=Ht.gfm),this.tokenizer.rules=n}static get rules(){return{block:An,inline:Ht}}static lex(t,n){return new vi(n).lex(t)}static lexInline(t,n){return new vi(n).inlineTokens(t)}lex(t){t=t.replace(he.carriageReturn,`
2259
+ `);continue}}return{type:"blockquote",raw:s,tokens:a,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),s=n.length>1,i={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let c=!1,u="",g="";if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;u=t[0],e=e.substring(u.length);let p=Ah(t[2].split(`
2260
+ `,1)[0],t[1].length),h=e.split(`
2261
+ `,1)[0],d=!p.trim(),f=0;if(this.options.pedantic?(f=2,g=p.trimStart()):d?f=t[1].length+1:(f=p.search(this.rules.other.nonSpaceChar),f=f>4?1:f,g=p.slice(f),f+=t[1].length),d&&this.rules.other.blankLine.test(h)&&(u+=h+`
2262
+ `,e=e.substring(h.length+1),c=!0),!c){let m=this.rules.other.nextBulletRegex(f),S=this.rules.other.hrRegex(f),k=this.rules.other.fencesBeginRegex(f),$=this.rules.other.headingBeginRegex(f),A=this.rules.other.htmlBeginRegex(f),C=this.rules.other.blockquoteBeginRegex(f);for(;e;){let _=e.split(`
2263
+ `,1)[0],T;if(h=_,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),T=h):T=h.replace(this.rules.other.tabCharGlobal," "),k.test(h)||$.test(h)||A.test(h)||C.test(h)||m.test(h)||S.test(h))break;if(T.search(this.rules.other.nonSpaceChar)>=f||!h.trim())g+=`
2264
+ `+T.slice(f);else{if(d||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||k.test(p)||$.test(p)||S.test(p))break;g+=`
2265
+ `+h}d=!h.trim(),u+=_+`
2266
+ `,e=e.substring(_.length+1),p=T.slice(f)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(o=!0)),i.items.push({type:"list_item",raw:u,task:!!this.options.gfm&&this.rules.other.listIsTask.test(g),loose:!1,text:g,tokens:[]}),i.raw+=u}let l=i.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let c of i.items){if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),c.task){if(c.text=c.text.replace(this.rules.other.listReplaceTask,""),c.tokens[0]?.type==="text"||c.tokens[0]?.type==="paragraph"){c.tokens[0].raw=c.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),c.tokens[0].text=c.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let g=this.lexer.inlineQueue.length-1;g>=0;g--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)){this.lexer.inlineQueue[g].src=this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask,"");break}}let u=this.rules.other.listTaskCheckbox.exec(c.raw);if(u){let g={type:"checkbox",raw:u[0]+" ",checked:u[0]!=="[ ]"};c.checked=g.checked,i.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=g.raw+c.tokens[0].raw,c.tokens[0].text=g.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(g)):c.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):c.tokens.unshift(g)}}if(!i.loose){let u=c.tokens.filter(p=>p.type==="space"),g=u.length>0&&u.some(p=>this.rules.other.anyLine.test(p.raw));i.loose=g}}if(i.loose)for(let c of i.items){c.loose=!0;for(let u of c.tokens)u.type==="text"&&(u.type="paragraph")}return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:s,title:i}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Io(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
2267
+ `):[],a={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?a.align.push("right"):this.rules.other.tableAlignCenter.test(o)?a.align.push("center"):this.rules.other.tableAlignLeft.test(o)?a.align.push("left"):a.align.push(null);for(let o=0;o<n.length;o++)a.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:a.align[o]});for(let o of i)a.rows.push(Io(o,a.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:a.align[c]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
2268
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let a=Kt(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{let a=Sh(t[2],"()");if(a===-2)return;if(a>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+a;t[2]=t[2].substring(0,a),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let s=t[2],i="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(s);a&&(s=a[1],i=a[3])}else i=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),Ro(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[s.toLowerCase()];if(!i){let a=n[0].charAt(0);return{type:"text",raw:a,text:a}}return Ro(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!(!s||s[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[2])||!n||this.rules.inline.punctuation.exec(n))){let i=[...s[0]].length-1,a,o,l=i,c=0,u=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+i);(s=u.exec(t))!=null;){if(a=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!a)continue;if(o=[...a].length,s[3]||s[4]){l+=o;continue}else if((s[5]||s[6])&&i%3&&!((i+o)%3)){c+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+c);let g=[...s[0]][0].length,p=e.slice(0,i+s.index+g+o);if(Math.min(i,o)%2){let d=p.slice(1,-1);return{type:"em",raw:p,text:d,tokens:this.lexer.inlineTokens(d)}}let h=p.slice(2,-2);return{type:"strong",raw:p,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let s=this.rules.inline.delLDelim.exec(e);if(s&&(!s[1]||!n||this.rules.inline.punctuation.exec(n))){let i=[...s[0]].length-1,a,o,l=i,c=this.rules.inline.delRDelim;for(c.lastIndex=0,t=t.slice(-1*e.length+i);(s=c.exec(t))!=null;){if(a=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!a||(o=[...a].length,o!==i))continue;if(s[3]||s[4]){l+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l);let u=[...s[0]][0].length,g=e.slice(0,i+s.index+u+o),p=g.slice(i,-i);return{type:"del",raw:g,text:p,tokens:this.lexer.inlineTokens(p)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,s;return t[2]==="@"?(n=t[1],s="mailto:"+n):(n=t[1],s=n),{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,s;if(t[2]==="@")n=t[0],s="mailto:"+n;else{let i;do i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(i!==t[0]);n=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},_e=class vi{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||$t,this.options.tokenizer=this.options.tokenizer||new Wn,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:he,block:Tn.normal,inline:jt.normal};this.options.pedantic?(n.block=Tn.pedantic,n.inline=jt.pedantic):this.options.gfm&&(n.block=Tn.gfm,this.options.breaks?n.inline=jt.breaks:n.inline=jt.gfm),this.tokenizer.rules=n}static get rules(){return{block:Tn,inline:jt}}static lex(t,n){return new vi(n).lex(t)}static lexInline(t,n){return new vi(n).inlineTokens(t)}lex(t){t=t.replace(he.carriageReturn,`
2269
2269
  `),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let s=this.inlineQueue[n];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],s=!1){for(this.options.pedantic&&(t=t.replace(he.tabCharGlobal," ").replace(he.spaceLine,""));t;){let i;if(this.options.extensions?.block?.some(o=>(i=o.call({lexer:this},t,n))?(t=t.substring(i.raw.length),n.push(i),!0):!1))continue;if(i=this.tokenizer.space(t)){t=t.substring(i.raw.length);let o=n.at(-1);i.raw.length===1&&o!==void 0?o.raw+=`
2270
2270
  `:n.push(i);continue}if(i=this.tokenizer.code(t)){t=t.substring(i.raw.length);let o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
2271
2271
  `)?"":`
@@ -2279,7 +2279,7 @@ ${g}`:g;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
2279
2279
  `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i),s=a.length!==t.length,t=t.substring(i.raw.length);continue}if(i=this.tokenizer.text(t)){t=t.substring(i.raw.length);let o=n.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(`
2280
2280
  `)?"":`
2281
2281
  `)+i.raw,o.text+=`
2282
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i);continue}if(t){let o="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){let s=t,i=null;if(this.tokens.links){let c=Object.keys(this.tokens.links);if(c.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)c.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,i.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let a;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)a=i[2]?i[2].length:0,s=s.slice(0,i.index+a)+"["+"a".repeat(i[0].length-a-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let o=!1,l="";for(;t;){o||(l=""),o=!1;let c;if(this.options.extensions?.inline?.some(g=>(c=g.call({lexer:this},t,n))?(t=t.substring(c.raw.length),n.push(c),!0):!1))continue;if(c=this.tokenizer.escape(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.tag(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.link(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(c.raw.length);let g=n.at(-1);c.type==="text"&&g?.type==="text"?(g.raw+=c.raw,g.text+=c.text):n.push(c);continue}if(c=this.tokenizer.emStrong(t,s,l)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.codespan(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.br(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.del(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.autolink(t)){t=t.substring(c.raw.length),n.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(t))){t=t.substring(c.raw.length),n.push(c);continue}let u=t;if(this.options.extensions?.startInline){let g=1/0,p=t.slice(1),h;this.options.extensions.startInline.forEach(d=>{h=d.call({lexer:this},p),typeof h=="number"&&h>=0&&(g=Math.min(g,h))}),g<1/0&&g>=0&&(u=t.substring(0,g+1))}if(c=this.tokenizer.inlineText(u)){t=t.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(l=c.raw.slice(-1)),o=!0;let g=n.at(-1);g?.type==="text"?(g.raw+=c.raw,g.text+=c.text):n.push(c);continue}if(t){let g="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(g);break}else throw new Error(g)}}return n}},Kn=class{options;parser;constructor(e){this.options=e||yt}space(e){return""}code({text:e,lang:t,escaped:n}){let s=(t||"").match(he.notSpaceStart)?.[0],i=e.replace(he.endingNewline,"")+`
2282
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i);continue}if(t){let o="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){let s=t,i=null;if(this.tokens.links){let c=Object.keys(this.tokens.links);if(c.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)c.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,i.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let a;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)a=i[2]?i[2].length:0,s=s.slice(0,i.index+a)+"["+"a".repeat(i[0].length-a-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let o=!1,l="";for(;t;){o||(l=""),o=!1;let c;if(this.options.extensions?.inline?.some(g=>(c=g.call({lexer:this},t,n))?(t=t.substring(c.raw.length),n.push(c),!0):!1))continue;if(c=this.tokenizer.escape(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.tag(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.link(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(c.raw.length);let g=n.at(-1);c.type==="text"&&g?.type==="text"?(g.raw+=c.raw,g.text+=c.text):n.push(c);continue}if(c=this.tokenizer.emStrong(t,s,l)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.codespan(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.br(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.del(t,s,l)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.autolink(t)){t=t.substring(c.raw.length),n.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(t))){t=t.substring(c.raw.length),n.push(c);continue}let u=t;if(this.options.extensions?.startInline){let g=1/0,p=t.slice(1),h;this.options.extensions.startInline.forEach(d=>{h=d.call({lexer:this},p),typeof h=="number"&&h>=0&&(g=Math.min(g,h))}),g<1/0&&g>=0&&(u=t.substring(0,g+1))}if(c=this.tokenizer.inlineText(u)){t=t.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(l=c.raw.slice(-1)),o=!0;let g=n.at(-1);g?.type==="text"?(g.raw+=c.raw,g.text+=c.text):n.push(c);continue}if(t){let g="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(g);break}else throw new Error(g)}}return n}},qn=class{options;parser;constructor(e){this.options=e||$t}space(e){return""}code({text:e,lang:t,escaped:n}){let s=(t||"").match(he.notSpaceStart)?.[0],i=e.replace(he.endingNewline,"")+`
2283
2283
  `;return s?'<pre><code class="language-'+je(s)+'">'+(n?i:je(i,!0))+`</code></pre>
2284
2284
  `:"<pre><code>"+(n?i:je(i,!0))+`</code></pre>
2285
2285
  `}blockquote({tokens:e}){return`<blockquote>
@@ -2297,29 +2297,29 @@ ${this.parser.parse(e)}</blockquote>
2297
2297
  `}tablerow({text:e}){return`<tr>
2298
2298
  ${e}</tr>
2299
2299
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
2300
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${je(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let s=this.parser.parseInline(n),i=_o(e);if(i===null)return s;e=i;let a='<a href="'+e+'"';return t&&(a+=' title="'+je(t)+'"'),a+=">"+s+"</a>",a}image({href:e,title:t,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let i=_o(e);if(i===null)return je(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${je(t)}"`),a+=">",a}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:je(e.text)}},ia=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},_e=class mi{options;renderer;textRenderer;constructor(t){this.options=t||yt,this.options.renderer=this.options.renderer||new Kn,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ia}static parse(t,n){return new mi(n).parse(t)}static parseInline(t,n){return new mi(n).parseInline(t)}parse(t){let n="";for(let s=0;s<t.length;s++){let i=t[s];if(this.options.extensions?.renderers?.[i.type]){let o=i,l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(o.type)){n+=l||"";continue}}let a=i;switch(a.type){case"space":{n+=this.renderer.space(a);break}case"hr":{n+=this.renderer.hr(a);break}case"heading":{n+=this.renderer.heading(a);break}case"code":{n+=this.renderer.code(a);break}case"table":{n+=this.renderer.table(a);break}case"blockquote":{n+=this.renderer.blockquote(a);break}case"list":{n+=this.renderer.list(a);break}case"checkbox":{n+=this.renderer.checkbox(a);break}case"html":{n+=this.renderer.html(a);break}case"def":{n+=this.renderer.def(a);break}case"paragraph":{n+=this.renderer.paragraph(a);break}case"text":{n+=this.renderer.text(a);break}default:{let o='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}parseInline(t,n=this.renderer){let s="";for(let i=0;i<t.length;i++){let a=t[i];if(this.options.extensions?.renderers?.[a.type]){let l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){s+=l||"";continue}}let o=a;switch(o.type){case"escape":{s+=n.text(o);break}case"html":{s+=n.html(o);break}case"link":{s+=n.link(o);break}case"image":{s+=n.image(o);break}case"checkbox":{s+=n.checkbox(o);break}case"strong":{s+=n.strong(o);break}case"em":{s+=n.em(o);break}case"codespan":{s+=n.codespan(o);break}case"br":{s+=n.br(o);break}case"del":{s+=n.del(o);break}case"text":{s+=n.text(o);break}default:{let l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return s}},Wt=class{options;block;constructor(e){this.options=e||yt}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?Te.lex:Te.lexInline}provideParser(){return this.block?_e.parse:_e.parseInline}},gh=class{defaults=Yi();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=_e;Renderer=Kn;TextRenderer=ia;Lexer=Te;Tokenizer=jn;Hooks=Wt;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{let i=s;for(let a of i.header)n=n.concat(this.walkTokens(a.tokens,t));for(let a of i.rows)for(let o of a)n=n.concat(this.walkTokens(o.tokens,t));break}case"list":{let i=s;n=n.concat(this.walkTokens(i.items,t));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(a=>{let o=i[a].flat(1/0);n=n.concat(this.walkTokens(o,t))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let a=t.renderers[i.name];a?t.renderers[i.name]=function(...o){let l=i.renderer.apply(this,o);return l===!1&&(l=a.apply(this,o)),l}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=t[i.level];a?a.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),s.extensions=t),n.renderer){let i=this.defaults.renderer||new Kn(this.defaults);for(let a in n.renderer){if(!(a in i))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let o=a,l=n.renderer[o],c=i[o];i[o]=(...u)=>{let g=l.apply(i,u);return g===!1&&(g=c.apply(i,u)),g||""}}s.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new jn(this.defaults);for(let a in n.tokenizer){if(!(a in i))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let o=a,l=n.tokenizer[o],c=i[o];i[o]=(...u)=>{let g=l.apply(i,u);return g===!1&&(g=c.apply(i,u)),g}}s.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new Wt;for(let a in n.hooks){if(!(a in i))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let o=a,l=n.hooks[o],c=i[o];Wt.passThroughHooks.has(a)?i[o]=u=>{if(this.defaults.async&&Wt.passThroughHooksRespectAsync.has(a))return(async()=>{let p=await l.call(i,u);return c.call(i,p)})();let g=l.call(i,u);return c.call(i,g)}:i[o]=(...u)=>{if(this.defaults.async)return(async()=>{let p=await l.apply(i,u);return p===!1&&(p=await c.apply(i,u)),p})();let g=l.apply(i,u);return g===!1&&(g=c.apply(i,u)),g}}s.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,a=n.walkTokens;s.walkTokens=function(o){let l=[];return l.push(a.call(this,o)),i&&(l=l.concat(i.call(this,o))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Te.lex(e,t??this.defaults)}parser(e,t){return _e.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let s={...n},i={...this.defaults,...s},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(t):t,l=await(i.hooks?await i.hooks.provideLexer():e?Te.lex:Te.lexInline)(o,i),c=i.hooks?await i.hooks.processAllTokens(l):l;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser():e?_e.parse:_e.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let o=(i.hooks?i.hooks.provideLexer():e?Te.lex:Te.lexInline)(t,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let l=(i.hooks?i.hooks.provideParser():e?_e.parse:_e.parseInline)(o,i);return i.hooks&&(l=i.hooks.postprocess(l)),l}catch(o){return a(o)}}}onError(e,t){return n=>{if(n.message+=`
2301
- Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+je(n.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}},mt=new gh;function G(e,t){return mt.parse(e,t)}G.options=G.setOptions=function(e){return mt.setOptions(e),G.defaults=mt.defaults,wl(G.defaults),G};G.getDefaults=Yi;G.defaults=yt;G.use=function(...e){return mt.use(...e),G.defaults=mt.defaults,wl(G.defaults),G};G.walkTokens=function(e,t){return mt.walkTokens(e,t)};G.parseInline=mt.parseInline;G.Parser=_e;G.parser=_e.parse;G.Renderer=Kn;G.TextRenderer=ia;G.Lexer=Te;G.lexer=Te.lex;G.Tokenizer=jn;G.Hooks=Wt;G.parse=G;G.options;G.setOptions;G.use;G.walkTokens;G.parseInline;_e.parse;Te.lex;G.setOptions({gfm:!0,breaks:!0});const Mo=["a","b","blockquote","br","code","del","em","h1","h2","h3","h4","hr","i","li","ol","p","pre","strong","table","tbody","td","th","thead","tr","ul"],Io=["class","href","rel","target","title","start"];let Ro=!1;const ph=14e4,fh=4e4,hh=200,zs=5e4,ut=new Map;function vh(e){const t=ut.get(e);return t===void 0?null:(ut.delete(e),ut.set(e,t),t)}function Po(e,t){if(ut.set(e,t),ut.size<=hh)return;const n=ut.keys().next().value;n&&ut.delete(n)}function mh(){Ro||(Ro=!0,fi.addHook("afterSanitizeAttributes",e=>{!(e instanceof HTMLAnchorElement)||!e.getAttribute("href")||(e.setAttribute("rel","noreferrer noopener"),e.setAttribute("target","_blank"))}))}function bi(e){const t=e.trim();if(!t)return"";if(mh(),t.length<=zs){const o=vh(t);if(o!==null)return o}const n=xr(t,ph),s=n.truncated?`
2300
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${je(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let s=this.parser.parseInline(n),i=Mo(e);if(i===null)return s;e=i;let a='<a href="'+e+'"';return t&&(a+=' title="'+je(t)+'"'),a+=">"+s+"</a>",a}image({href:e,title:t,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let i=Mo(e);if(i===null)return je(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${je(t)}"`),a+=">",a}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:je(e.text)}},aa=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},Ee=class mi{options;renderer;textRenderer;constructor(t){this.options=t||$t,this.options.renderer=this.options.renderer||new qn,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new aa}static parse(t,n){return new mi(n).parse(t)}static parseInline(t,n){return new mi(n).parseInline(t)}parse(t){let n="";for(let s=0;s<t.length;s++){let i=t[s];if(this.options.extensions?.renderers?.[i.type]){let o=i,l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(o.type)){n+=l||"";continue}}let a=i;switch(a.type){case"space":{n+=this.renderer.space(a);break}case"hr":{n+=this.renderer.hr(a);break}case"heading":{n+=this.renderer.heading(a);break}case"code":{n+=this.renderer.code(a);break}case"table":{n+=this.renderer.table(a);break}case"blockquote":{n+=this.renderer.blockquote(a);break}case"list":{n+=this.renderer.list(a);break}case"checkbox":{n+=this.renderer.checkbox(a);break}case"html":{n+=this.renderer.html(a);break}case"def":{n+=this.renderer.def(a);break}case"paragraph":{n+=this.renderer.paragraph(a);break}case"text":{n+=this.renderer.text(a);break}default:{let o='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}parseInline(t,n=this.renderer){let s="";for(let i=0;i<t.length;i++){let a=t[i];if(this.options.extensions?.renderers?.[a.type]){let l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){s+=l||"";continue}}let o=a;switch(o.type){case"escape":{s+=n.text(o);break}case"html":{s+=n.html(o);break}case"link":{s+=n.link(o);break}case"image":{s+=n.image(o);break}case"checkbox":{s+=n.checkbox(o);break}case"strong":{s+=n.strong(o);break}case"em":{s+=n.em(o);break}case"codespan":{s+=n.codespan(o);break}case"br":{s+=n.br(o);break}case"del":{s+=n.del(o);break}case"text":{s+=n.text(o);break}default:{let l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return s}},qt=class{options;block;constructor(e){this.options=e||$t}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?_e.lex:_e.lexInline}provideParser(){return this.block?Ee.parse:Ee.parseInline}},Th=class{defaults=Ji();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Ee;Renderer=qn;TextRenderer=aa;Lexer=_e;Tokenizer=Wn;Hooks=qt;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{let i=s;for(let a of i.header)n=n.concat(this.walkTokens(a.tokens,t));for(let a of i.rows)for(let o of a)n=n.concat(this.walkTokens(o.tokens,t));break}case"list":{let i=s;n=n.concat(this.walkTokens(i.items,t));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(a=>{let o=i[a].flat(1/0);n=n.concat(this.walkTokens(o,t))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let a=t.renderers[i.name];a?t.renderers[i.name]=function(...o){let l=i.renderer.apply(this,o);return l===!1&&(l=a.apply(this,o)),l}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=t[i.level];a?a.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),s.extensions=t),n.renderer){let i=this.defaults.renderer||new qn(this.defaults);for(let a in n.renderer){if(!(a in i))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let o=a,l=n.renderer[o],c=i[o];i[o]=(...u)=>{let g=l.apply(i,u);return g===!1&&(g=c.apply(i,u)),g||""}}s.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new Wn(this.defaults);for(let a in n.tokenizer){if(!(a in i))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let o=a,l=n.tokenizer[o],c=i[o];i[o]=(...u)=>{let g=l.apply(i,u);return g===!1&&(g=c.apply(i,u)),g}}s.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new qt;for(let a in n.hooks){if(!(a in i))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let o=a,l=n.hooks[o],c=i[o];qt.passThroughHooks.has(a)?i[o]=u=>{if(this.defaults.async&&qt.passThroughHooksRespectAsync.has(a))return(async()=>{let p=await l.call(i,u);return c.call(i,p)})();let g=l.call(i,u);return c.call(i,g)}:i[o]=(...u)=>{if(this.defaults.async)return(async()=>{let p=await l.apply(i,u);return p===!1&&(p=await c.apply(i,u)),p})();let g=l.apply(i,u);return g===!1&&(g=c.apply(i,u)),g}}s.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,a=n.walkTokens;s.walkTokens=function(o){let l=[];return l.push(a.call(this,o)),i&&(l=l.concat(i.call(this,o))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return _e.lex(e,t??this.defaults)}parser(e,t){return Ee.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let s={...n},i={...this.defaults,...s},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(t):t,l=await(i.hooks?await i.hooks.provideLexer():e?_e.lex:_e.lexInline)(o,i),c=i.hooks?await i.hooks.processAllTokens(l):l;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser():e?Ee.parse:Ee.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let o=(i.hooks?i.hooks.provideLexer():e?_e.lex:_e.lexInline)(t,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let l=(i.hooks?i.hooks.provideParser():e?Ee.parse:Ee.parseInline)(o,i);return i.hooks&&(l=i.hooks.postprocess(l)),l}catch(o){return a(o)}}}onError(e,t){return n=>{if(n.message+=`
2301
+ Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+je(n.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}},yt=new Th;function q(e,t){return yt.parse(e,t)}q.options=q.setOptions=function(e){return yt.setOptions(e),q.defaults=yt.defaults,Cl(q.defaults),q};q.getDefaults=Ji;q.defaults=$t;q.use=function(...e){return yt.use(...e),q.defaults=yt.defaults,Cl(q.defaults),q};q.walkTokens=function(e,t){return yt.walkTokens(e,t)};q.parseInline=yt.parseInline;q.Parser=Ee;q.parser=Ee.parse;q.Renderer=qn;q.TextRenderer=aa;q.Lexer=_e;q.lexer=_e.lex;q.Tokenizer=Wn;q.Hooks=qt;q.parse=q;q.options;q.setOptions;q.use;q.walkTokens;q.parseInline;Ee.parse;_e.lex;q.setOptions({gfm:!0,breaks:!0});const Po=["a","b","blockquote","br","code","del","em","h1","h2","h3","h4","hr","i","li","ol","p","pre","strong","table","tbody","td","th","thead","tr","ul"],Do=["class","href","rel","target","title","start"];let Fo=!1;const _h=14e4,Eh=4e4,Lh=200,Hs=5e4,pt=new Map;function Mh(e){const t=pt.get(e);return t===void 0?null:(pt.delete(e),pt.set(e,t),t)}function No(e,t){if(pt.set(e,t),pt.size<=Lh)return;const n=pt.keys().next().value;n&&pt.delete(n)}function Ih(){Fo||(Fo=!0,fi.addHook("afterSanitizeAttributes",e=>{!(e instanceof HTMLAnchorElement)||!e.getAttribute("href")||(e.setAttribute("rel","noreferrer noopener"),e.setAttribute("target","_blank"))}))}function bi(e){const t=e.trim();if(!t)return"";if(Ih(),t.length<=Hs){const o=Mh(t);if(o!==null)return o}const n=Ar(t,_h),s=n.truncated?`
2302
2302
 
2303
- … truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>fh){const l=`<pre class="code-block">${bh(`${n.text}${s}`)}</pre>`,c=fi.sanitize(l,{ALLOWED_TAGS:Mo,ALLOWED_ATTR:Io});return t.length<=zs&&Po(t,c),c}const i=G.parse(`${n.text}${s}`),a=fi.sanitize(i,{ALLOWED_TAGS:Mo,ALLOWED_ATTR:Io});return t.length<=zs&&Po(t,a),a}function bh(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}const yh=1500,xh=2e3,Rl="Copy as markdown",$h="Copied",wh="Copy failed";async function kh(e){if(!e)return!1;try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}function Cn(e,t){e.title=t,e.setAttribute("aria-label",t)}function Sh(e){const t=e.label??Rl;return r`
2303
+ … truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>Eh){const l=`<pre class="code-block">${Bl(`${n.text}${s}`)}</pre>`,c=fi.sanitize(l,{ALLOWED_TAGS:Po,ALLOWED_ATTR:Do});return t.length<=Hs&&No(t,c),c}const i=q.parse(`${n.text}${s}`,{renderer:Ol}),a=fi.sanitize(i,{ALLOWED_TAGS:Po,ALLOWED_ATTR:Do});return t.length<=Hs&&No(t,a),a}const Ol=new q.Renderer;Ol.html=({text:e})=>Bl(e);function Bl(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}const Rh=new RegExp("\\p{Script=Hebrew}|\\p{Script=Arabic}|\\p{Script=Syriac}|\\p{Script=Thaana}|\\p{Script=Nko}|\\p{Script=Samaritan}|\\p{Script=Mandaic}|\\p{Script=Adlam}|\\p{Script=Phoenician}|\\p{Script=Lydian}","u");function Ul(e,t=/[\s\p{P}\p{S}]/u){if(!e)return"ltr";for(const n of e)if(!t.test(n))return Rh.test(n)?"rtl":"ltr";return"ltr"}const Ph=1500,Dh=2e3,zl="Copy as markdown",Fh="Copied",Nh="Copy failed";async function Oh(e){if(!e)return!1;try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}function _n(e,t){e.title=t,e.setAttribute("aria-label",t)}function Bh(e){const t=e.label??zl;return r`
2304
2304
  <button
2305
2305
  class="chat-copy-btn"
2306
2306
  type="button"
2307
2307
  title=${t}
2308
2308
  aria-label=${t}
2309
- @click=${async n=>{const s=n.currentTarget;if(!s||s.dataset.copying==="1")return;s.dataset.copying="1",s.setAttribute("aria-busy","true"),s.disabled=!0;const i=await kh(e.text());if(s.isConnected){if(delete s.dataset.copying,s.removeAttribute("aria-busy"),s.disabled=!1,!i){s.dataset.error="1",Cn(s,wh),window.setTimeout(()=>{s.isConnected&&(delete s.dataset.error,Cn(s,t))},xh);return}s.dataset.copied="1",Cn(s,$h),window.setTimeout(()=>{s.isConnected&&(delete s.dataset.copied,Cn(s,t))},yh)}}}
2309
+ @click=${async n=>{const s=n.currentTarget;if(!s||s.dataset.copying==="1")return;s.dataset.copying="1",s.setAttribute("aria-busy","true"),s.disabled=!0;const i=await Oh(e.text());if(s.isConnected){if(delete s.dataset.copying,s.removeAttribute("aria-busy"),s.disabled=!1,!i){s.dataset.error="1",_n(s,Nh),window.setTimeout(()=>{s.isConnected&&(delete s.dataset.error,_n(s,t))},Dh);return}s.dataset.copied="1",_n(s,Fh),window.setTimeout(()=>{s.isConnected&&(delete s.dataset.copied,_n(s,t))},Ph)}}}
2310
2310
  >
2311
2311
  <span class="chat-copy-btn__icon" aria-hidden="true">
2312
2312
  <span class="chat-copy-btn__icon-copy">${le.copy}</span>
2313
2313
  <span class="chat-copy-btn__icon-check">${le.check}</span>
2314
2314
  </span>
2315
2315
  </button>
2316
- `}function Ah(e){return Sh({text:()=>e,label:Rl})}function Pl(e){const t=e;let n=typeof t.role=="string"?t.role:"unknown";const s=typeof t.toolCallId=="string"||typeof t.tool_call_id=="string",i=t.content,a=Array.isArray(i)?i:null,o=Array.isArray(a)&&a.some(p=>{const h=p,d=(typeof h.type=="string"?h.type:"").toLowerCase();return d==="toolresult"||d==="tool_result"}),l=typeof t.toolName=="string"||typeof t.tool_name=="string";(s||o||l)&&(n="toolResult");let c=[];typeof t.content=="string"?c=[{type:"text",text:t.content}]:Array.isArray(t.content)?c=t.content.map(p=>({type:p.type||"text",text:p.text,name:p.name,args:p.args||p.arguments})):typeof t.text=="string"&&(c=[{type:"text",text:t.text}]);const u=typeof t.timestamp=="number"?t.timestamp:Date.now(),g=typeof t.id=="string"?t.id:void 0;return{role:n,content:c,timestamp:u,id:g}}function aa(e){const t=e.toLowerCase();return e==="user"||e==="User"?e:e==="assistant"?"assistant":e==="system"?"system":t==="toolresult"||t==="tool_result"||t==="tool"||t==="function"?"tool":e}function Dl(e){const t=e,n=typeof t.role=="string"?t.role.toLowerCase():"";return n==="toolresult"||n==="tool_result"}const Ch={icon:"puzzle",detailKeys:["command","path","url","targetUrl","targetId","ref","element","node","nodeId","id","requestId","to","channelId","guildId","userId","name","query","pattern","messageId"]},Th={bash:{icon:"wrench",title:"Bash",detailKeys:["command"]},process:{icon:"wrench",title:"Process",detailKeys:["sessionId"]},read:{icon:"fileText",title:"Read",detailKeys:["path"]},write:{icon:"edit",title:"Write",detailKeys:["path"]},edit:{icon:"penLine",title:"Edit",detailKeys:["path"]},attach:{icon:"paperclip",title:"Attach",detailKeys:["path","url","fileName"]},browser:{icon:"globe",title:"Browser",actions:{status:{label:"status"},start:{label:"start"},stop:{label:"stop"},tabs:{label:"tabs"},open:{label:"open",detailKeys:["targetUrl"]},focus:{label:"focus",detailKeys:["targetId"]},close:{label:"close",detailKeys:["targetId"]},snapshot:{label:"snapshot",detailKeys:["targetUrl","targetId","ref","element","format"]},screenshot:{label:"screenshot",detailKeys:["targetUrl","targetId","ref","element"]},navigate:{label:"navigate",detailKeys:["targetUrl","targetId"]},console:{label:"console",detailKeys:["level","targetId"]},pdf:{label:"pdf",detailKeys:["targetId"]},upload:{label:"upload",detailKeys:["paths","ref","inputRef","element","targetId"]},dialog:{label:"dialog",detailKeys:["accept","promptText","targetId"]},act:{label:"act",detailKeys:["request.kind","request.ref","request.selector","request.text","request.value"]}}},canvas:{icon:"image",title:"Canvas",actions:{present:{label:"present",detailKeys:["target","node","nodeId"]},hide:{label:"hide",detailKeys:["node","nodeId"]},navigate:{label:"navigate",detailKeys:["url","node","nodeId"]},eval:{label:"eval",detailKeys:["javaScript","node","nodeId"]},snapshot:{label:"snapshot",detailKeys:["format","node","nodeId"]},a2ui_push:{label:"A2UI push",detailKeys:["jsonlPath","node","nodeId"]},a2ui_reset:{label:"A2UI reset",detailKeys:["node","nodeId"]}}},nodes:{icon:"smartphone",title:"Nodes",actions:{status:{label:"status"},describe:{label:"describe",detailKeys:["node","nodeId"]},pending:{label:"pending"},approve:{label:"approve",detailKeys:["requestId"]},reject:{label:"reject",detailKeys:["requestId"]},notify:{label:"notify",detailKeys:["node","nodeId","title","body"]},camera_snap:{label:"camera snap",detailKeys:["node","nodeId","facing","deviceId"]},camera_list:{label:"camera list",detailKeys:["node","nodeId"]},camera_clip:{label:"camera clip",detailKeys:["node","nodeId","facing","duration","durationMs"]},screen_record:{label:"screen record",detailKeys:["node","nodeId","duration","durationMs","fps","screenIndex"]}}},cron:{icon:"loader",title:"Cron",actions:{status:{label:"status"},list:{label:"list"},add:{label:"add",detailKeys:["job.name","job.id","job.schedule","job.cron"]},update:{label:"update",detailKeys:["id"]},remove:{label:"remove",detailKeys:["id"]},run:{label:"run",detailKeys:["id"]},runs:{label:"runs",detailKeys:["id"]},wake:{label:"wake",detailKeys:["text","mode"]}}},gateway:{icon:"plug",title:"Gateway",actions:{restart:{label:"restart",detailKeys:["reason","delayMs"]},"config.get":{label:"config get"},"config.schema":{label:"config schema"},"config.apply":{label:"config apply",detailKeys:["restartDelayMs"]},"update.run":{label:"update run",detailKeys:["restartDelayMs"]}}},whatsapp_login:{icon:"circle",title:"WhatsApp Login",actions:{start:{label:"start"},wait:{label:"wait"}}},discord:{icon:"messageSquare",title:"Discord",actions:{react:{label:"react",detailKeys:["channelId","messageId","emoji"]},reactions:{label:"reactions",detailKeys:["channelId","messageId"]},sticker:{label:"sticker",detailKeys:["to","stickerIds"]},poll:{label:"poll",detailKeys:["question","to"]},permissions:{label:"permissions",detailKeys:["channelId"]},readMessages:{label:"read messages",detailKeys:["channelId","limit"]},sendMessage:{label:"send",detailKeys:["to","content"]},editMessage:{label:"edit",detailKeys:["channelId","messageId"]},deleteMessage:{label:"delete",detailKeys:["channelId","messageId"]},threadCreate:{label:"thread create",detailKeys:["channelId","name"]},threadList:{label:"thread list",detailKeys:["guildId","channelId"]},threadReply:{label:"thread reply",detailKeys:["channelId","content"]},pinMessage:{label:"pin",detailKeys:["channelId","messageId"]},unpinMessage:{label:"unpin",detailKeys:["channelId","messageId"]},listPins:{label:"list pins",detailKeys:["channelId"]},searchMessages:{label:"search",detailKeys:["guildId","content"]},memberInfo:{label:"member",detailKeys:["guildId","userId"]},roleInfo:{label:"roles",detailKeys:["guildId"]},emojiList:{label:"emoji list",detailKeys:["guildId"]},roleAdd:{label:"role add",detailKeys:["guildId","userId","roleId"]},roleRemove:{label:"role remove",detailKeys:["guildId","userId","roleId"]},channelInfo:{label:"channel",detailKeys:["channelId"]},channelList:{label:"channels",detailKeys:["guildId"]},voiceStatus:{label:"voice",detailKeys:["guildId","userId"]},eventList:{label:"events",detailKeys:["guildId"]},eventCreate:{label:"event create",detailKeys:["guildId","name"]},timeout:{label:"timeout",detailKeys:["guildId","userId"]},kick:{label:"kick",detailKeys:["guildId","userId"]},ban:{label:"ban",detailKeys:["guildId","userId"]}}},slack:{icon:"messageSquare",title:"Slack",actions:{react:{label:"react",detailKeys:["channelId","messageId","emoji"]},reactions:{label:"reactions",detailKeys:["channelId","messageId"]},sendMessage:{label:"send",detailKeys:["to","content"]},editMessage:{label:"edit",detailKeys:["channelId","messageId"]},deleteMessage:{label:"delete",detailKeys:["channelId","messageId"]},readMessages:{label:"read messages",detailKeys:["channelId","limit"]},pinMessage:{label:"pin",detailKeys:["channelId","messageId"]},unpinMessage:{label:"unpin",detailKeys:["channelId","messageId"]},listPins:{label:"list pins",detailKeys:["channelId"]},memberInfo:{label:"member",detailKeys:["userId"]},emojiList:{label:"emoji list"}}}},_h={fallback:Ch,tools:Th},Fl=_h,Do=Fl.fallback??{icon:"puzzle"},Eh=Fl.tools??{};function Lh(e){return(e??"tool").trim()}function Mh(e){const t=e.replace(/_/g," ").trim();return t?t.split(/\s+/).map(n=>n.length<=2&&n.toUpperCase()===n?n:`${n.at(0)?.toUpperCase()??""}${n.slice(1)}`).join(" "):"Tool"}function Ih(e){const t=e?.trim();if(t)return t.replace(/_/g," ")}function Nl(e){if(e!=null){if(typeof e=="string"){const t=e.trim();if(!t)return;const n=t.split(/\r?\n/)[0]?.trim()??"";return n?n.length>160?`${n.slice(0,157)}…`:n:void 0}if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e)){const t=e.map(s=>Nl(s)).filter(s=>!!s);if(t.length===0)return;const n=t.slice(0,3).join(", ");return t.length>3?`${n}…`:n}}}function Rh(e,t){if(!e||typeof e!="object")return;let n=e;for(const s of t.split(".")){if(!s||!n||typeof n!="object")return;n=n[s]}return n}function Ph(e,t){for(const n of t){const s=Rh(e,n),i=Nl(s);if(i)return i}}function Dh(e){if(!e||typeof e!="object")return;const t=e,n=typeof t.path=="string"?t.path:void 0;if(!n)return;const s=typeof t.offset=="number"?t.offset:void 0,i=typeof t.limit=="number"?t.limit:void 0;return s!==void 0&&i!==void 0?`${n}:${s}-${s+i}`:n}function Fh(e){if(!e||typeof e!="object")return;const t=e;return typeof t.path=="string"?t.path:void 0}function Nh(e,t){if(!(!e||!t))return e.actions?.[t]??void 0}function Oh(e){const t=Lh(e.name),n=t.toLowerCase(),s=Eh[n],i=s?.icon??Do.icon??"puzzle",a=s?.title??Mh(t),o=s?.label??t,l=e.args&&typeof e.args=="object"?e.args.action:void 0,c=typeof l=="string"?l.trim():void 0,u=Nh(s,c),g=Ih(u?.label??c);let p;n==="read"&&(p=Dh(e.args)),!p&&(n==="write"||n==="edit"||n==="attach")&&(p=Fh(e.args));const h=u?.detailKeys??s?.detailKeys??Do.detailKeys??[];return!p&&h.length>0&&(p=Ph(e.args,h)),!p&&e.meta&&(p=e.meta),p&&(p=Uh(p)),{name:t,icon:i,title:a,label:o,verb:g,detail:p}}function Bh(e){const t=[];if(e.verb&&t.push(e.verb),e.detail&&t.push(e.detail),t.length!==0)return t.join(" · ")}function Uh(e){return e&&e.replace(/\/Users\/[^/]+/g,"~").replace(/\/home\/[^/]+/g,"~")}const zh=80,Hh=2,Fo=100;function jh(e){const t=e.trim();if(t.startsWith("{")||t.startsWith("["))try{const n=JSON.parse(t);return"```json\n"+JSON.stringify(n,null,2)+"\n```"}catch{}return e}function Kh(e){const t=e.split(`
2317
- `),n=t.slice(0,Hh),s=n.join(`
2318
- `);return s.length>Fo?s.slice(0,Fo)+"…":n.length<t.length?s+"…":s}function Wh(e){const t=e,n=qh(t.content),s=[];for(const i of n){const a=(typeof i.type=="string"?i.type:"").toLowerCase();(["toolcall","tool_call","tooluse","tool_use"].includes(a)||typeof i.name=="string"&&i.arguments!=null)&&s.push({kind:"call",name:i.name??"tool",args:Gh(i.arguments??i.args)})}for(const i of n){const a=(typeof i.type=="string"?i.type:"").toLowerCase();if(a!=="toolresult"&&a!=="tool_result")continue;const o=Vh(i),l=typeof i.name=="string"?i.name:"tool";s.push({kind:"result",name:l,text:o})}if(Dl(e)&&!s.some(i=>i.kind==="result")){const i=typeof t.toolName=="string"&&t.toolName||typeof t.tool_name=="string"&&t.tool_name||"tool",a=Vr(e)??void 0;s.push({kind:"result",name:i,text:a})}return s}function No(e,t){const n=Oh({name:e.name,args:e.args}),s=Bh(n),i=!!e.text?.trim(),a=!!t,o=a?()=>{if(i){t(jh(e.text));return}const p=`## ${n.label}
2316
+ `}function Uh(e){return Bh({text:()=>e,label:zl})}function Hl(e){const t=e;let n=typeof t.role=="string"?t.role:"unknown";const s=typeof t.toolCallId=="string"||typeof t.tool_call_id=="string",i=t.content,a=Array.isArray(i)?i:null,o=Array.isArray(a)&&a.some(p=>{const h=p,d=(typeof h.type=="string"?h.type:"").toLowerCase();return d==="toolresult"||d==="tool_result"}),l=typeof t.toolName=="string"||typeof t.tool_name=="string";(s||o||l)&&(n="toolResult");let c=[];typeof t.content=="string"?c=[{type:"text",text:t.content}]:Array.isArray(t.content)?c=t.content.map(p=>({type:p.type||"text",text:p.text,name:p.name,args:p.args||p.arguments})):typeof t.text=="string"&&(c=[{type:"text",text:t.text}]);const u=typeof t.timestamp=="number"?t.timestamp:Date.now(),g=typeof t.id=="string"?t.id:void 0;return{role:n,content:c,timestamp:u,id:g}}function oa(e){const t=e.toLowerCase();return e==="user"||e==="User"?e:e==="assistant"?"assistant":e==="system"?"system":t==="toolresult"||t==="tool_result"||t==="tool"||t==="function"?"tool":e}function jl(e){const t=e,n=typeof t.role=="string"?t.role.toLowerCase():"";return n==="toolresult"||n==="tool_result"}const zh={icon:"puzzle",detailKeys:["command","path","url","targetUrl","targetId","ref","element","node","nodeId","id","requestId","to","channelId","guildId","userId","name","query","pattern","messageId"]},Hh={bash:{icon:"wrench",title:"Bash",detailKeys:["command"]},process:{icon:"wrench",title:"Process",detailKeys:["sessionId"]},read:{icon:"fileText",title:"Read",detailKeys:["path"]},write:{icon:"edit",title:"Write",detailKeys:["path"]},edit:{icon:"penLine",title:"Edit",detailKeys:["path"]},attach:{icon:"paperclip",title:"Attach",detailKeys:["path","url","fileName"]},browser:{icon:"globe",title:"Browser",actions:{status:{label:"status"},start:{label:"start"},stop:{label:"stop"},tabs:{label:"tabs"},open:{label:"open",detailKeys:["targetUrl"]},focus:{label:"focus",detailKeys:["targetId"]},close:{label:"close",detailKeys:["targetId"]},snapshot:{label:"snapshot",detailKeys:["targetUrl","targetId","ref","element","format"]},screenshot:{label:"screenshot",detailKeys:["targetUrl","targetId","ref","element"]},navigate:{label:"navigate",detailKeys:["targetUrl","targetId"]},console:{label:"console",detailKeys:["level","targetId"]},pdf:{label:"pdf",detailKeys:["targetId"]},upload:{label:"upload",detailKeys:["paths","ref","inputRef","element","targetId"]},dialog:{label:"dialog",detailKeys:["accept","promptText","targetId"]},act:{label:"act",detailKeys:["request.kind","request.ref","request.selector","request.text","request.value"]}}},canvas:{icon:"image",title:"Canvas",actions:{present:{label:"present",detailKeys:["target","node","nodeId"]},hide:{label:"hide",detailKeys:["node","nodeId"]},navigate:{label:"navigate",detailKeys:["url","node","nodeId"]},eval:{label:"eval",detailKeys:["javaScript","node","nodeId"]},snapshot:{label:"snapshot",detailKeys:["format","node","nodeId"]},a2ui_push:{label:"A2UI push",detailKeys:["jsonlPath","node","nodeId"]},a2ui_reset:{label:"A2UI reset",detailKeys:["node","nodeId"]}}},nodes:{icon:"smartphone",title:"Nodes",actions:{status:{label:"status"},describe:{label:"describe",detailKeys:["node","nodeId"]},pending:{label:"pending"},approve:{label:"approve",detailKeys:["requestId"]},reject:{label:"reject",detailKeys:["requestId"]},notify:{label:"notify",detailKeys:["node","nodeId","title","body"]},camera_snap:{label:"camera snap",detailKeys:["node","nodeId","facing","deviceId"]},camera_list:{label:"camera list",detailKeys:["node","nodeId"]},camera_clip:{label:"camera clip",detailKeys:["node","nodeId","facing","duration","durationMs"]},screen_record:{label:"screen record",detailKeys:["node","nodeId","duration","durationMs","fps","screenIndex"]}}},cron:{icon:"loader",title:"Cron",actions:{status:{label:"status"},list:{label:"list"},add:{label:"add",detailKeys:["job.name","job.id","job.schedule","job.cron"]},update:{label:"update",detailKeys:["id"]},remove:{label:"remove",detailKeys:["id"]},run:{label:"run",detailKeys:["id"]},runs:{label:"runs",detailKeys:["id"]},wake:{label:"wake",detailKeys:["text","mode"]}}},gateway:{icon:"plug",title:"Gateway",actions:{restart:{label:"restart",detailKeys:["reason","delayMs"]},"config.get":{label:"config get"},"config.schema":{label:"config schema"},"config.apply":{label:"config apply",detailKeys:["restartDelayMs"]},"update.run":{label:"update run",detailKeys:["restartDelayMs"]}}},whatsapp_login:{icon:"circle",title:"WhatsApp Login",actions:{start:{label:"start"},wait:{label:"wait"}}},discord:{icon:"messageSquare",title:"Discord",actions:{react:{label:"react",detailKeys:["channelId","messageId","emoji"]},reactions:{label:"reactions",detailKeys:["channelId","messageId"]},sticker:{label:"sticker",detailKeys:["to","stickerIds"]},poll:{label:"poll",detailKeys:["question","to"]},permissions:{label:"permissions",detailKeys:["channelId"]},readMessages:{label:"read messages",detailKeys:["channelId","limit"]},sendMessage:{label:"send",detailKeys:["to","content"]},editMessage:{label:"edit",detailKeys:["channelId","messageId"]},deleteMessage:{label:"delete",detailKeys:["channelId","messageId"]},threadCreate:{label:"thread create",detailKeys:["channelId","name"]},threadList:{label:"thread list",detailKeys:["guildId","channelId"]},threadReply:{label:"thread reply",detailKeys:["channelId","content"]},pinMessage:{label:"pin",detailKeys:["channelId","messageId"]},unpinMessage:{label:"unpin",detailKeys:["channelId","messageId"]},listPins:{label:"list pins",detailKeys:["channelId"]},searchMessages:{label:"search",detailKeys:["guildId","content"]},memberInfo:{label:"member",detailKeys:["guildId","userId"]},roleInfo:{label:"roles",detailKeys:["guildId"]},emojiList:{label:"emoji list",detailKeys:["guildId"]},roleAdd:{label:"role add",detailKeys:["guildId","userId","roleId"]},roleRemove:{label:"role remove",detailKeys:["guildId","userId","roleId"]},channelInfo:{label:"channel",detailKeys:["channelId"]},channelList:{label:"channels",detailKeys:["guildId"]},voiceStatus:{label:"voice",detailKeys:["guildId","userId"]},eventList:{label:"events",detailKeys:["guildId"]},eventCreate:{label:"event create",detailKeys:["guildId","name"]},timeout:{label:"timeout",detailKeys:["guildId","userId"]},kick:{label:"kick",detailKeys:["guildId","userId"]},ban:{label:"ban",detailKeys:["guildId","userId"]}}},slack:{icon:"messageSquare",title:"Slack",actions:{react:{label:"react",detailKeys:["channelId","messageId","emoji"]},reactions:{label:"reactions",detailKeys:["channelId","messageId"]},sendMessage:{label:"send",detailKeys:["to","content"]},editMessage:{label:"edit",detailKeys:["channelId","messageId"]},deleteMessage:{label:"delete",detailKeys:["channelId","messageId"]},readMessages:{label:"read messages",detailKeys:["channelId","limit"]},pinMessage:{label:"pin",detailKeys:["channelId","messageId"]},unpinMessage:{label:"unpin",detailKeys:["channelId","messageId"]},listPins:{label:"list pins",detailKeys:["channelId"]},memberInfo:{label:"member",detailKeys:["userId"]},emojiList:{label:"emoji list"}}}},jh={fallback:zh,tools:Hh},Kl=jh,Oo=Kl.fallback??{icon:"puzzle"},Kh=Kl.tools??{};function Wh(e){return(e??"tool").trim()}function qh(e){const t=e.replace(/_/g," ").trim();return t?t.split(/\s+/).map(n=>n.length<=2&&n.toUpperCase()===n?n:`${n.at(0)?.toUpperCase()??""}${n.slice(1)}`).join(" "):"Tool"}function Gh(e){const t=e?.trim();if(t)return t.replace(/_/g," ")}function Wl(e){if(e!=null){if(typeof e=="string"){const t=e.trim();if(!t)return;const n=t.split(/\r?\n/)[0]?.trim()??"";return n?n.length>160?`${n.slice(0,157)}…`:n:void 0}if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e)){const t=e.map(s=>Wl(s)).filter(s=>!!s);if(t.length===0)return;const n=t.slice(0,3).join(", ");return t.length>3?`${n}…`:n}}}function Vh(e,t){if(!e||typeof e!="object")return;let n=e;for(const s of t.split(".")){if(!s||!n||typeof n!="object")return;n=n[s]}return n}function Qh(e,t){for(const n of t){const s=Vh(e,n),i=Wl(s);if(i)return i}}function Yh(e){if(!e||typeof e!="object")return;const t=e,n=typeof t.path=="string"?t.path:void 0;if(!n)return;const s=typeof t.offset=="number"?t.offset:void 0,i=typeof t.limit=="number"?t.limit:void 0;return s!==void 0&&i!==void 0?`${n}:${s}-${s+i}`:n}function Jh(e){if(!e||typeof e!="object")return;const t=e;return typeof t.path=="string"?t.path:void 0}function Zh(e,t){if(!(!e||!t))return e.actions?.[t]??void 0}function Xh(e){const t=Wh(e.name),n=t.toLowerCase(),s=Kh[n],i=s?.icon??Oo.icon??"puzzle",a=s?.title??qh(t),o=s?.label??t,l=e.args&&typeof e.args=="object"?e.args.action:void 0,c=typeof l=="string"?l.trim():void 0,u=Zh(s,c),g=Gh(u?.label??c);let p;n==="read"&&(p=Yh(e.args)),!p&&(n==="write"||n==="edit"||n==="attach")&&(p=Jh(e.args));const h=u?.detailKeys??s?.detailKeys??Oo.detailKeys??[];return!p&&h.length>0&&(p=Qh(e.args,h)),!p&&e.meta&&(p=e.meta),p&&(p=tv(p)),{name:t,icon:i,title:a,label:o,verb:g,detail:p}}function ev(e){const t=[];if(e.verb&&t.push(e.verb),e.detail&&t.push(e.detail),t.length!==0)return t.join(" · ")}function tv(e){return e&&e.replace(/\/Users\/[^/]+/g,"~").replace(/\/home\/[^/]+/g,"~")}const nv=80,sv=2,Bo=100;function iv(e){const t=e.trim();if(t.startsWith("{")||t.startsWith("["))try{const n=JSON.parse(t);return"```json\n"+JSON.stringify(n,null,2)+"\n```"}catch{}return e}function av(e){const t=e.split(`
2317
+ `),n=t.slice(0,sv),s=n.join(`
2318
+ `);return s.length>Bo?s.slice(0,Bo)+"…":n.length<t.length?s+"…":s}function ov(e){const t=e,n=rv(t.content),s=[];for(const i of n){const a=(typeof i.type=="string"?i.type:"").toLowerCase();(["toolcall","tool_call","tooluse","tool_use"].includes(a)||typeof i.name=="string"&&i.arguments!=null)&&s.push({kind:"call",name:i.name??"tool",args:lv(i.arguments??i.args)})}for(const i of n){const a=(typeof i.type=="string"?i.type:"").toLowerCase();if(a!=="toolresult"&&a!=="tool_result")continue;const o=cv(i),l=typeof i.name=="string"?i.name:"tool";s.push({kind:"result",name:l,text:o})}if(jl(e)&&!s.some(i=>i.kind==="result")){const i=typeof t.toolName=="string"&&t.toolName||typeof t.tool_name=="string"&&t.tool_name||"tool",a=Xr(e)??void 0;s.push({kind:"result",name:i,text:a})}return s}function Uo(e,t){const n=Xh({name:e.name,args:e.args}),s=ev(n),i=!!e.text?.trim(),a=!!t,o=a?()=>{if(i){t(iv(e.text));return}const p=`## ${n.label}
2319
2319
 
2320
2320
  ${s?`**Command:** \`${s}\`
2321
2321
 
2322
- `:""}*No output — tool completed successfully.*`;t(p)}:void 0,l=i&&(e.text?.length??0)<=zh,c=i&&!l,u=i&&l,g=!i;return r`
2322
+ `:""}*No output — tool completed successfully.*`;t(p)}:void 0,l=i&&(e.text?.length??0)<=nv,c=i&&!l,u=i&&l,g=!i;return r`
2323
2323
  <div
2324
2324
  class="chat-tool-card ${a?"chat-tool-card--clickable":""}"
2325
2325
  @click=${o}
@@ -2339,12 +2339,12 @@ ${s?`**Command:** \`${s}\`
2339
2339
  ${g?r`
2340
2340
  <div class="chat-tool-card__status-text muted">Completed</div>
2341
2341
  `:v}
2342
- ${c?r`<div class="chat-tool-card__preview mono">${Kh(e.text)}</div>`:v}
2342
+ ${c?r`<div class="chat-tool-card__preview mono">${av(e.text)}</div>`:v}
2343
2343
  ${u?r`<div class="chat-tool-card__inline mono">${e.text}</div>`:v}
2344
2344
  </div>
2345
- `}function qh(e){return Array.isArray(e)?e.filter(Boolean):[]}function Gh(e){if(typeof e!="string")return e;const t=e.trim();if(!t||!t.startsWith("{")&&!t.startsWith("["))return e;try{return JSON.parse(t)}catch{return e}}function Vh(e){if(typeof e.text=="string")return e.text;if(typeof e.content=="string")return e.content}function Qh(e){const n=e.content,s=[];if(Array.isArray(n))for(const i of n){if(typeof i!="object"||i===null)continue;const a=i;if(a.type==="image"){const o=a.source;if(o?.type==="base64"&&typeof o.data=="string"){const l=o.data,c=o.media_type||"image/png",u=l.startsWith("data:")?l:`data:${c};base64,${l}`;s.push({url:u})}else typeof a.url=="string"&&s.push({url:a.url})}else if(a.type==="image_url"){const o=a.image_url;typeof o?.url=="string"&&s.push({url:o.url})}}return s}function Yh(e){return r`
2345
+ `}function rv(e){return Array.isArray(e)?e.filter(Boolean):[]}function lv(e){if(typeof e!="string")return e;const t=e.trim();if(!t||!t.startsWith("{")&&!t.startsWith("["))return e;try{return JSON.parse(t)}catch{return e}}function cv(e){if(typeof e.text=="string")return e.text;if(typeof e.content=="string")return e.content}function dv(e){const n=e.content,s=[];if(Array.isArray(n))for(const i of n){if(typeof i!="object"||i===null)continue;const a=i;if(a.type==="image"){const o=a.source;if(o?.type==="base64"&&typeof o.data=="string"){const l=o.data,c=o.media_type||"image/png",u=l.startsWith("data:")?l:`data:${c};base64,${l}`;s.push({url:u})}else typeof a.url=="string"&&s.push({url:a.url})}else if(a.type==="image_url"){const o=a.image_url;typeof o?.url=="string"&&s.push({url:o.url})}}return s}function uv(e){return r`
2346
2346
  <div class="chat-group assistant">
2347
- ${oa("assistant",e)}
2347
+ ${ra("assistant",e)}
2348
2348
  <div class="chat-group-messages">
2349
2349
  <div class="chat-bubble chat-reading-indicator" aria-hidden="true">
2350
2350
  <span class="chat-reading-indicator__dots">
@@ -2353,33 +2353,33 @@ ${s?`**Command:** \`${s}\`
2353
2353
  </div>
2354
2354
  </div>
2355
2355
  </div>
2356
- `}function Jh(e,t,n,s){const i=new Date(t).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}),a=s?.name??"Assistant";return r`
2356
+ `}function gv(e,t,n,s){const i=new Date(t).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}),a=s?.name??"Assistant";return r`
2357
2357
  <div class="chat-group assistant">
2358
- ${oa("assistant",s)}
2358
+ ${ra("assistant",s)}
2359
2359
  <div class="chat-group-messages">
2360
- ${Ol({role:"assistant",content:[{type:"text",text:e}],timestamp:t},{isStreaming:!0,showReasoning:!1},n)}
2360
+ ${ql({role:"assistant",content:[{type:"text",text:e}],timestamp:t},{isStreaming:!0,showReasoning:!1},n)}
2361
2361
  <div class="chat-group-footer">
2362
2362
  <span class="chat-sender-name">${a}</span>
2363
2363
  <span class="chat-group-timestamp">${i}</span>
2364
2364
  </div>
2365
2365
  </div>
2366
2366
  </div>
2367
- `}function Zh(e,t){const n=aa(e.role),s=t.assistantName??"Assistant",i=n==="user"?"You":n==="assistant"?s:n,a=n==="user"?"user":n==="assistant"?"assistant":"other",o=new Date(e.timestamp).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"});return r`
2367
+ `}function pv(e,t){const n=oa(e.role),s=t.assistantName??"Assistant",i=n==="user"?"You":n==="assistant"?s:n,a=n==="user"?"user":n==="assistant"?"assistant":"other",o=new Date(e.timestamp).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"});return r`
2368
2368
  <div class="chat-group ${a}">
2369
- ${oa(e.role,{name:s,avatar:t.assistantAvatar??null})}
2369
+ ${ra(e.role,{name:s,avatar:t.assistantAvatar??null})}
2370
2370
  <div class="chat-group-messages">
2371
- ${e.messages.map((l,c)=>Ol(l.message,{isStreaming:e.isStreaming&&c===e.messages.length-1,showReasoning:t.showReasoning},t.onOpenSidebar))}
2371
+ ${e.messages.map((l,c)=>ql(l.message,{isStreaming:e.isStreaming&&c===e.messages.length-1,showReasoning:t.showReasoning},t.onOpenSidebar))}
2372
2372
  <div class="chat-group-footer">
2373
2373
  <span class="chat-sender-name">${i}</span>
2374
2374
  <span class="chat-group-timestamp">${o}</span>
2375
2375
  </div>
2376
2376
  </div>
2377
2377
  </div>
2378
- `}function oa(e,t){const n=aa(e),s=t?.name?.trim()||"Assistant",i=t?.avatar?.trim()||"",a=n==="user"?"U":n==="assistant"?s.charAt(0).toUpperCase()||"A":n==="tool"?"⚙":"?",o=n==="user"?"user":n==="assistant"?"assistant":n==="tool"?"tool":"other";return i&&n==="assistant"?Xh(i)?r`<img
2378
+ `}function ra(e,t){const n=oa(e),s=t?.name?.trim()||"Assistant",i=t?.avatar?.trim()||"",a=n==="user"?"U":n==="assistant"?s.charAt(0).toUpperCase()||"A":n==="tool"?"⚙":"?",o=n==="user"?"user":n==="assistant"?"assistant":n==="tool"?"tool":"other";return i&&n==="assistant"?fv(i)?r`<img
2379
2379
  class="chat-avatar ${o}"
2380
2380
  src="${i}"
2381
2381
  alt="${s}"
2382
- />`:r`<div class="chat-avatar ${o}">${i}</div>`:r`<div class="chat-avatar ${o}">${a}</div>`}function Xh(e){return/^https?:\/\//i.test(e)||/^data:image\//i.test(e)||e.startsWith("/")}function ev(e){return e.length===0?v:r`
2382
+ />`:r`<div class="chat-avatar ${o}">${i}</div>`:r`<div class="chat-avatar ${o}">${a}</div>`}function fv(e){return/^https?:\/\//i.test(e)||/^data:image\//i.test(e)||e.startsWith("/")}function hv(e){return e.length===0?v:r`
2383
2383
  <div class="chat-message-images">
2384
2384
  ${e.map(t=>r`
2385
2385
  <img
@@ -2390,15 +2390,15 @@ ${s?`**Command:** \`${s}\`
2390
2390
  />
2391
2391
  `)}
2392
2392
  </div>
2393
- `}function Ol(e,t,n){const s=e,i=typeof s.role=="string"?s.role:"unknown",a=Dl(e)||i.toLowerCase()==="toolresult"||i.toLowerCase()==="tool_result"||typeof s.toolCallId=="string"||typeof s.tool_call_id=="string",o=Wh(e),l=o.length>0,c=Qh(e),u=c.length>0,g=Vr(e),p=t.showReasoning&&i==="assistant"?Iu(e):null,h=g?.trim()?g:null,d=p?Pu(p):null,f=h,m=i==="assistant"&&!!f?.trim(),S=["chat-bubble",m?"has-copy":"",t.isStreaming?"streaming":"","fade-in"].filter(Boolean).join(" ");return!f&&l&&a?r`${o.map(k=>No(k,n))}`:!f&&!l&&!u?v:r`
2393
+ `}function ql(e,t,n){const s=e,i=typeof s.role=="string"?s.role:"unknown",a=jl(e)||i.toLowerCase()==="toolresult"||i.toLowerCase()==="tool_result"||typeof s.toolCallId=="string"||typeof s.tool_call_id=="string",o=ov(e),l=o.length>0,c=dv(e),u=c.length>0,g=Xr(e),p=t.showReasoning&&i==="assistant"?Hu(e):null,h=g?.trim()?g:null,d=p?Ku(p):null,f=h,m=i==="assistant"&&!!f?.trim(),S=["chat-bubble",m?"has-copy":"",t.isStreaming?"streaming":"","fade-in"].filter(Boolean).join(" ");return!f&&l&&a?r`${o.map(k=>Uo(k,n))}`:!f&&!l&&!u?v:r`
2394
2394
  <div class="${S}">
2395
- ${m?Ah(f):v}
2396
- ${ev(c)}
2395
+ ${m?Uh(f):v}
2396
+ ${hv(c)}
2397
2397
  ${d?r`<div class="chat-thinking">${di(bi(d))}</div>`:v}
2398
- ${f?r`<div class="chat-text">${di(bi(f))}</div>`:v}
2399
- ${o.map(k=>No(k,n))}
2398
+ ${f?r`<div class="chat-text" dir="${Ul(f)}">${di(bi(f))}</div>`:v}
2399
+ ${o.map(k=>Uo(k,n))}
2400
2400
  </div>
2401
- `}function tv(e){return r`
2401
+ `}function vv(e){return r`
2402
2402
  <div class="sidebar-panel">
2403
2403
  <div class="sidebar-header">
2404
2404
  <div class="sidebar-title">Tool Output</div>
@@ -2417,7 +2417,7 @@ ${s?`**Command:** \`${s}\`
2417
2417
  `}
2418
2418
  </div>
2419
2419
  </div>
2420
- `}var nv=Object.defineProperty,sv=Object.getOwnPropertyDescriptor,ds=(e,t,n,s)=>{for(var i=s>1?void 0:s?sv(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(s?o(t,n,i):o(i))||i);return s&&i&&nv(t,n,i),i};let It=class extends _t{constructor(){super(...arguments),this.splitRatio=.6,this.minRatio=.4,this.maxRatio=.7,this.isDragging=!1,this.startX=0,this.startRatio=0,this.handleMouseDown=e=>{this.isDragging=!0,this.startX=e.clientX,this.startRatio=this.splitRatio,this.classList.add("dragging"),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp),e.preventDefault()},this.handleMouseMove=e=>{if(!this.isDragging)return;const t=this.parentElement;if(!t)return;const n=t.getBoundingClientRect().width,i=(e.clientX-this.startX)/n;let a=this.startRatio+i;a=Math.max(this.minRatio,Math.min(this.maxRatio,a)),this.dispatchEvent(new CustomEvent("resize",{detail:{splitRatio:a},bubbles:!0,composed:!0}))},this.handleMouseUp=()=>{this.isDragging=!1,this.classList.remove("dragging"),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}}render(){return v}connectedCallback(){super.connectedCallback(),this.addEventListener("mousedown",this.handleMouseDown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}};It.styles=Jl`
2420
+ `}var mv=Object.defineProperty,bv=Object.getOwnPropertyDescriptor,us=(e,t,n,s)=>{for(var i=s>1?void 0:s?bv(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(s?o(t,n,i):o(i))||i);return s&&i&&mv(t,n,i),i};let Rt=class extends Lt{constructor(){super(...arguments),this.splitRatio=.6,this.minRatio=.4,this.maxRatio=.7,this.isDragging=!1,this.startX=0,this.startRatio=0,this.handleMouseDown=e=>{this.isDragging=!0,this.startX=e.clientX,this.startRatio=this.splitRatio,this.classList.add("dragging"),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp),e.preventDefault()},this.handleMouseMove=e=>{if(!this.isDragging)return;const t=this.parentElement;if(!t)return;const n=t.getBoundingClientRect().width,i=(e.clientX-this.startX)/n;let a=this.startRatio+i;a=Math.max(this.minRatio,Math.min(this.maxRatio,a)),this.dispatchEvent(new CustomEvent("resize",{detail:{splitRatio:a},bubbles:!0,composed:!0}))},this.handleMouseUp=()=>{this.isDragging=!1,this.classList.remove("dragging"),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}}render(){return v}connectedCallback(){super.connectedCallback(),this.addEventListener("mousedown",this.handleMouseDown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}};Rt.styles=ac`
2421
2421
  :host {
2422
2422
  width: 4px;
2423
2423
  cursor: col-resize;
@@ -2440,15 +2440,15 @@ ${s?`**Command:** \`${s}\`
2440
2440
  :host(.dragging) {
2441
2441
  background: var(--accent, #007bff);
2442
2442
  }
2443
- `;ds([Yn({type:Number})],It.prototype,"splitRatio",2);ds([Yn({type:Number})],It.prototype,"minRatio",2);ds([Yn({type:Number})],It.prototype,"maxRatio",2);It=ds([dr("resizable-divider")],It);const iv=5e3;function Oo(e){e.style.height="auto",e.style.height=`${e.scrollHeight}px`}function av(e){return e?e.active?r`
2443
+ `;us([Zn({type:Number})],Rt.prototype,"splitRatio",2);us([Zn({type:Number})],Rt.prototype,"minRatio",2);us([Zn({type:Number})],Rt.prototype,"maxRatio",2);Rt=us([gr("resizable-divider")],Rt);const yv=5e3;function zo(e){e.style.height="auto",e.style.height=`${e.scrollHeight}px`}function xv(e){return e?e.active?r`
2444
2444
  <div class="compaction-indicator compaction-indicator--active" role="status" aria-live="polite">
2445
2445
  ${le.loader} Compacting context...
2446
2446
  </div>
2447
- `:e.completedAt&&Date.now()-e.completedAt<iv?r`
2447
+ `:e.completedAt&&Date.now()-e.completedAt<yv?r`
2448
2448
  <div class="compaction-indicator compaction-indicator--complete" role="status" aria-live="polite">
2449
2449
  ${le.check} Context compacted
2450
2450
  </div>
2451
- `:v:v}function ov(){return`att-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function rv(e,t){const n=e.clipboardData?.items;if(!n||!t.onAttachmentsChange)return;const s=[];for(let i=0;i<n.length;i++){const a=n[i];a.type.startsWith("image/")&&s.push(a)}if(s.length!==0){e.preventDefault();for(const i of s){const a=i.getAsFile();if(!a)continue;const o=new FileReader;o.addEventListener("load",()=>{const l=o.result,c={id:ov(),dataUrl:l,mimeType:a.type},u=t.attachments??[];t.onAttachmentsChange?.([...u,c])}),o.readAsDataURL(a)}}}function lv(e){const t=e.attachments??[];return t.length===0?v:r`
2451
+ `:v:v}function $v(){return`att-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function wv(e,t){const n=e.clipboardData?.items;if(!n||!t.onAttachmentsChange)return;const s=[];for(let i=0;i<n.length;i++){const a=n[i];a.type.startsWith("image/")&&s.push(a)}if(s.length!==0){e.preventDefault();for(const i of s){const a=i.getAsFile();if(!a)continue;const o=new FileReader;o.addEventListener("load",()=>{const l=o.result,c={id:$v(),dataUrl:l,mimeType:a.type},u=t.attachments??[];t.onAttachmentsChange?.([...u,c])}),o.readAsDataURL(a)}}}function kv(e){const t=e.attachments??[];return t.length===0?v:r`
2452
2452
  <div class="chat-attachments">
2453
2453
  ${t.map(n=>r`
2454
2454
  <div class="chat-attachment">
@@ -2468,7 +2468,7 @@ ${s?`**Command:** \`${s}\`
2468
2468
  </div>
2469
2469
  `)}
2470
2470
  </div>
2471
- `}function cv(e){const t=e.connected,n=e.sending||e.stream!==null,s=!!(e.canAbort&&e.onAbort),a=e.sessions?.sessions?.find(d=>d.key===e.sessionKey)?.reasoningLevel??"off",o=e.showThinking&&a!=="off",l={name:e.assistantName,avatar:e.assistantAvatar??e.assistantAvatarUrl??null},c=(e.attachments?.length??0)>0,u=e.connected?c?"Add a message or paste more images...":"Message (↩ to send, Shift+↩ for line breaks, paste images)":"Connect to the gateway to start chatting…",g=e.splitRatio??.6,p=!!(e.sidebarOpen&&e.onCloseSidebar),h=r`
2471
+ `}function Sv(e){const t=e.connected,n=e.sending||e.stream!==null,s=!!(e.canAbort&&e.onAbort),a=e.sessions?.sessions?.find(d=>d.key===e.sessionKey)?.reasoningLevel??"off",o=e.showThinking&&a!=="off",l={name:e.assistantName,avatar:e.assistantAvatar??e.assistantAvatarUrl??null},c=(e.attachments?.length??0)>0,u=e.connected?c?"Add a message or paste more images...":"Message (↩ to send, Shift+↩ for line breaks, paste images)":"Connect to the gateway to start chatting…",g=e.splitRatio??.6,p=!!(e.sidebarOpen&&e.onCloseSidebar),h=r`
2472
2472
  <div
2473
2473
  class="chat-thread"
2474
2474
  role="log"
@@ -2478,13 +2478,13 @@ ${s?`**Command:** \`${s}\`
2478
2478
  ${e.loading?r`
2479
2479
  <div class="muted">Loading chat…</div>
2480
2480
  `:v}
2481
- ${al(uv(e),d=>d.key,d=>d.kind==="divider"?r`
2481
+ ${dl(Cv(e),d=>d.key,d=>d.kind==="divider"?r`
2482
2482
  <div class="chat-divider" role="separator" data-ts=${String(d.timestamp)}>
2483
2483
  <span class="chat-divider__line"></span>
2484
2484
  <span class="chat-divider__label">${d.label}</span>
2485
2485
  <span class="chat-divider__line"></span>
2486
2486
  </div>
2487
- `:d.kind==="reading-indicator"?Yh(l):d.kind==="stream"?Jh(d.text,d.startedAt,e.onOpenSidebar,l):d.kind==="group"?Zh(d,{onOpenSidebar:e.onOpenSidebar,showReasoning:o,assistantName:e.assistantName,assistantAvatar:l.avatar}):v)}
2487
+ `:d.kind==="reading-indicator"?uv(l):d.kind==="stream"?gv(d.text,d.startedAt,e.onOpenSidebar,l):d.kind==="group"?pv(d,{onOpenSidebar:e.onOpenSidebar,showReasoning:o,assistantName:e.assistantName,assistantAvatar:l.avatar}):v)}
2488
2488
  </div>
2489
2489
  `;return r`
2490
2490
  <section class="card chat">
@@ -2520,7 +2520,7 @@ ${s?`**Command:** \`${s}\`
2520
2520
  @resize=${d=>e.onSplitRatioChange?.(d.detail.splitRatio)}
2521
2521
  ></resizable-divider>
2522
2522
  <div class="chat-sidebar">
2523
- ${tv({content:e.sidebarContent??null,error:e.sidebarError??null,onClose:e.onCloseSidebar,onViewRawText:()=>{!e.sidebarContent||!e.onOpenSidebar||e.onOpenSidebar(`\`\`\`
2523
+ ${vv({content:e.sidebarContent??null,error:e.sidebarError??null,onClose:e.onCloseSidebar,onViewRawText:()=>{!e.sidebarContent||!e.onOpenSidebar||e.onOpenSidebar(`\`\`\`
2524
2524
  ${e.sidebarContent}
2525
2525
  \`\`\``)}})}
2526
2526
  </div>
@@ -2550,7 +2550,7 @@ ${e.sidebarContent}
2550
2550
  </div>
2551
2551
  `:v}
2552
2552
 
2553
- ${av(e.compactionStatus)}
2553
+ ${xv(e.compactionStatus)}
2554
2554
 
2555
2555
  ${e.showNewMessages?r`
2556
2556
  <button
@@ -2563,17 +2563,18 @@ ${e.sidebarContent}
2563
2563
  `:v}
2564
2564
 
2565
2565
  <div class="chat-compose">
2566
- ${lv(e)}
2566
+ ${kv(e)}
2567
2567
  <div class="chat-compose__row">
2568
2568
  <label class="field chat-compose__field">
2569
2569
  <span>Message</span>
2570
2570
  <textarea
2571
- ${lf(d=>d&&Oo(d))}
2571
+ ${mf(d=>d&&zo(d))}
2572
2572
  .value=${e.draft}
2573
+ dir=${Ul(e.draft)}
2573
2574
  ?disabled=${!e.connected}
2574
2575
  @keydown=${d=>{d.key==="Enter"&&(d.isComposing||d.keyCode===229||d.shiftKey||e.connected&&(d.preventDefault(),t&&e.onSend()))}}
2575
- @input=${d=>{const f=d.target;Oo(f),e.onDraftChange(f.value)}}
2576
- @paste=${d=>rv(d,e)}
2576
+ @input=${d=>{const f=d.target;zo(f),e.onDraftChange(f.value)}}
2577
+ @paste=${d=>wv(d,e)}
2577
2578
  placeholder=${u}
2578
2579
  ></textarea>
2579
2580
  </label>
@@ -2596,7 +2597,7 @@ ${e.sidebarContent}
2596
2597
  </div>
2597
2598
  </div>
2598
2599
  </section>
2599
- `}const Bo=200;function dv(e){const t=[];let n=null;for(const s of e){if(s.kind!=="message"){n&&(t.push(n),n=null),t.push(s);continue}const i=Pl(s.message),a=aa(i.role),o=i.timestamp||Date.now();!n||n.role!==a?(n&&t.push(n),n={kind:"group",key:`group:${a}:${s.key}`,role:a,messages:[{message:s.message,key:s.key}],timestamp:o,isStreaming:!1}):n.messages.push({message:s.message,key:s.key})}return n&&t.push(n),t}function uv(e){const t=[],n=Array.isArray(e.messages)?e.messages:[],s=Array.isArray(e.toolMessages)?e.toolMessages:[],i=Math.max(0,n.length-Bo);i>0&&t.push({kind:"message",key:"chat:history:notice",message:{role:"system",content:`Showing last ${Bo} messages (${i} hidden).`,timestamp:Date.now()}});for(let a=i;a<n.length;a++){const o=n[a],l=Pl(o),u=o.__openclaw;if(u&&u.kind==="compaction"){t.push({kind:"divider",key:typeof u.id=="string"?`divider:compaction:${u.id}`:`divider:compaction:${l.timestamp}:${a}`,label:"Compaction",timestamp:l.timestamp??Date.now()});continue}!e.showThinking&&l.role.toLowerCase()==="toolresult"||t.push({kind:"message",key:Uo(o,a),message:o})}if(e.showThinking)for(let a=0;a<s.length;a++)t.push({kind:"message",key:Uo(s[a],a+n.length),message:s[a]});if(e.stream!==null){const a=`stream:${e.sessionKey}:${e.streamStartedAt??"live"}`;e.stream.trim().length>0?t.push({kind:"stream",key:a,text:e.stream,startedAt:e.streamStartedAt??Date.now()}):t.push({kind:"reading-indicator",key:a})}return dv(t)}function Uo(e,t){const n=e,s=typeof n.toolCallId=="string"?n.toolCallId:"";if(s)return`tool:${s}`;const i=typeof n.id=="string"?n.id:"";if(i)return`msg:${i}`;const a=typeof n.messageId=="string"?n.messageId:"";if(a)return`msg:${a}`;const o=typeof n.timestamp=="number"?n.timestamp:null,l=typeof n.role=="string"?n.role:"unknown";return o!=null?`msg:${l}:${o}:${t}`:`msg:${l}:${t}`}const yi={all:r`
2600
+ `}const Ho=200;function Av(e){const t=[];let n=null;for(const s of e){if(s.kind!=="message"){n&&(t.push(n),n=null),t.push(s);continue}const i=Hl(s.message),a=oa(i.role),o=i.timestamp||Date.now();!n||n.role!==a?(n&&t.push(n),n={kind:"group",key:`group:${a}:${s.key}`,role:a,messages:[{message:s.message,key:s.key}],timestamp:o,isStreaming:!1}):n.messages.push({message:s.message,key:s.key})}return n&&t.push(n),t}function Cv(e){const t=[],n=Array.isArray(e.messages)?e.messages:[],s=Array.isArray(e.toolMessages)?e.toolMessages:[],i=Math.max(0,n.length-Ho);i>0&&t.push({kind:"message",key:"chat:history:notice",message:{role:"system",content:`Showing last ${Ho} messages (${i} hidden).`,timestamp:Date.now()}});for(let a=i;a<n.length;a++){const o=n[a],l=Hl(o),u=o.__openclaw;if(u&&u.kind==="compaction"){t.push({kind:"divider",key:typeof u.id=="string"?`divider:compaction:${u.id}`:`divider:compaction:${l.timestamp}:${a}`,label:"Compaction",timestamp:l.timestamp??Date.now()});continue}!e.showThinking&&l.role.toLowerCase()==="toolresult"||t.push({kind:"message",key:jo(o,a),message:o})}if(e.showThinking)for(let a=0;a<s.length;a++)t.push({kind:"message",key:jo(s[a],a+n.length),message:s[a]});if(e.stream!==null){const a=`stream:${e.sessionKey}:${e.streamStartedAt??"live"}`;e.stream.trim().length>0?t.push({kind:"stream",key:a,text:e.stream,startedAt:e.streamStartedAt??Date.now()}):t.push({kind:"reading-indicator",key:a})}return Av(t)}function jo(e,t){const n=e,s=typeof n.toolCallId=="string"?n.toolCallId:"";if(s)return`tool:${s}`;const i=typeof n.id=="string"?n.id:"";if(i)return`msg:${i}`;const a=typeof n.messageId=="string"?n.messageId:"";if(a)return`msg:${a}`;const o=typeof n.timestamp=="number"?n.timestamp:null,l=typeof n.role=="string"?n.role:"unknown";return o!=null?`msg:${l}:${o}:${t}`:`msg:${l}:${t}`}const yi={all:r`
2600
2601
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
2601
2602
  <rect x="3" y="3" width="7" height="7"></rect>
2602
2603
  <rect x="14" y="3" width="7" height="7"></rect>
@@ -2790,7 +2791,7 @@ ${e.sidebarContent}
2790
2791
  <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
2791
2792
  <polyline points="14 2 14 8 20 8"></polyline>
2792
2793
  </svg>
2793
- `},zo=[{key:"env",label:"Environment"},{key:"update",label:"Updates"},{key:"agents",label:"Agents"},{key:"auth",label:"Authentication"},{key:"channels",label:"Channels"},{key:"messages",label:"Messages"},{key:"commands",label:"Commands"},{key:"hooks",label:"Hooks"},{key:"skills",label:"Skills"},{key:"tools",label:"Tools"},{key:"gateway",label:"Gateway"},{key:"wizard",label:"Setup Wizard"}],Ho="__all__";function jo(e){return yi[e]??yi.default}function gv(e,t){const n=Qi[e];return n||{label:t?.title??We(e),description:t?.description??""}}function pv(e){const{key:t,schema:n,uiHints:s}=e;if(!n||De(n)!=="object"||!n.properties)return[];const i=Object.entries(n.properties).map(([a,o])=>{const l=Se([t,a],s),c=l?.label??o.title??We(a),u=l?.help??o.description??"",g=l?.order??50;return{key:a,label:c,description:u,order:g}});return i.sort((a,o)=>a.order!==o.order?a.order-o.order:a.key.localeCompare(o.key)),i}function fv(e,t){if(!e||!t)return[];const n=[];function s(i,a,o){if(i===a)return;if(typeof i!=typeof a){n.push({path:o,from:i,to:a});return}if(typeof i!="object"||i===null||a===null){i!==a&&n.push({path:o,from:i,to:a});return}if(Array.isArray(i)&&Array.isArray(a)){JSON.stringify(i)!==JSON.stringify(a)&&n.push({path:o,from:i,to:a});return}const l=i,c=a,u=new Set([...Object.keys(l),...Object.keys(c)]);for(const g of u)s(l[g],c[g],o?`${o}.${g}`:g)}return s(e,t,""),n}function Ko(e,t=40){let n;try{n=JSON.stringify(e)??String(e)}catch{n=String(e)}return n.length<=t?n:n.slice(0,t-3)+"..."}function hv(e){const t=e.valid==null?"unknown":e.valid?"valid":"invalid",n=fl(e.schema),s=n.schema?n.unsupportedPaths.length>0:!1,i=n.schema?.properties??{},a=zo.filter(T=>T.key in i),o=new Set(zo.map(T=>T.key)),l=Object.keys(i).filter(T=>!o.has(T)).map(T=>({key:T,label:T.charAt(0).toUpperCase()+T.slice(1)})),c=[...a,...l],u=e.activeSection&&n.schema&&De(n.schema)==="object"?n.schema.properties?.[e.activeSection]:void 0,g=e.activeSection?gv(e.activeSection,u):null,p=e.activeSection?pv({key:e.activeSection,schema:u,uiHints:e.uiHints}):[],h=e.formMode==="form"&&!!e.activeSection&&p.length>0,d=e.activeSubsection===Ho,f=e.searchQuery||d?null:e.activeSubsection??p[0]?.key??null,m=e.formMode==="form"?fv(e.originalValue,e.formValue):[],S=e.formMode==="raw"&&e.raw!==e.originalRaw,k=e.formMode==="form"?m.length>0:S,$=!!e.formValue&&!e.loading&&!!n.schema,A=e.connected&&!e.saving&&k&&(e.formMode==="raw"?!0:$),C=e.connected&&!e.applying&&!e.updating&&k&&(e.formMode==="raw"?!0:$),_=e.connected&&!e.applying&&!e.updating;return r`
2794
+ `},Ko=[{key:"env",label:"Environment"},{key:"update",label:"Updates"},{key:"agents",label:"Agents"},{key:"auth",label:"Authentication"},{key:"channels",label:"Channels"},{key:"messages",label:"Messages"},{key:"commands",label:"Commands"},{key:"hooks",label:"Hooks"},{key:"skills",label:"Skills"},{key:"tools",label:"Tools"},{key:"gateway",label:"Gateway"},{key:"wizard",label:"Setup Wizard"}],Wo="__all__";function qo(e){return yi[e]??yi.default}function Tv(e,t){const n=Yi[e];return n||{label:t?.title??We(e),description:t?.description??""}}function _v(e){const{key:t,schema:n,uiHints:s}=e;if(!n||we(n)!=="object"||!n.properties)return[];const i=Object.entries(n.properties).map(([a,o])=>{const l=Ae([t,a],s),c=l?.label??o.title??We(a),u=l?.help??o.description??"",g=l?.order??50;return{key:a,label:c,description:u,order:g}});return i.sort((a,o)=>a.order!==o.order?a.order-o.order:a.key.localeCompare(o.key)),i}function Ev(e,t){if(!e||!t)return[];const n=[];function s(i,a,o){if(i===a)return;if(typeof i!=typeof a){n.push({path:o,from:i,to:a});return}if(typeof i!="object"||i===null||a===null){i!==a&&n.push({path:o,from:i,to:a});return}if(Array.isArray(i)&&Array.isArray(a)){JSON.stringify(i)!==JSON.stringify(a)&&n.push({path:o,from:i,to:a});return}const l=i,c=a,u=new Set([...Object.keys(l),...Object.keys(c)]);for(const g of u)s(l[g],c[g],o?`${o}.${g}`:g)}return s(e,t,""),n}function Go(e,t=40){let n;try{n=JSON.stringify(e)??String(e)}catch{n=String(e)}return n.length<=t?n:n.slice(0,t-3)+"..."}function Lv(e){const t=e.valid==null?"unknown":e.valid?"valid":"invalid",n=bl(e.schema),s=n.schema?n.unsupportedPaths.length>0:!1,i=n.schema?.properties??{},a=Ko.filter(T=>T.key in i),o=new Set(Ko.map(T=>T.key)),l=Object.keys(i).filter(T=>!o.has(T)).map(T=>({key:T,label:T.charAt(0).toUpperCase()+T.slice(1)})),c=[...a,...l],u=e.activeSection&&n.schema&&we(n.schema)==="object"?n.schema.properties?.[e.activeSection]:void 0,g=e.activeSection?Tv(e.activeSection,u):null,p=e.activeSection?_v({key:e.activeSection,schema:u,uiHints:e.uiHints}):[],h=e.formMode==="form"&&!!e.activeSection&&p.length>0,d=e.activeSubsection===Wo,f=e.searchQuery||d?null:e.activeSubsection??p[0]?.key??null,m=e.formMode==="form"?Ev(e.originalValue,e.formValue):[],S=e.formMode==="raw"&&e.raw!==e.originalRaw,k=e.formMode==="form"?m.length>0:S,$=!!e.formValue&&!e.loading&&!!n.schema,A=e.connected&&!e.saving&&k&&(e.formMode==="raw"?!0:$),C=e.connected&&!e.applying&&!e.updating&&k&&(e.formMode==="raw"?!0:$),_=e.connected&&!e.applying&&!e.updating;return r`
2794
2795
  <div class="config-layout">
2795
2796
  <!-- Sidebar -->
2796
2797
  <aside class="config-sidebar">
@@ -2846,7 +2847,7 @@ ${e.sidebarContent}
2846
2847
  @click=${()=>e.onSectionChange(T.key)}
2847
2848
  >
2848
2849
  <span class="config-nav__icon"
2849
- >${jo(T.key)}</span
2850
+ >${qo(T.key)}</span
2850
2851
  >
2851
2852
  <span class="config-nav__label">${T.label}</span>
2852
2853
  </button>
@@ -2942,11 +2943,11 @@ ${e.sidebarContent}
2942
2943
  <div class="config-diff__path">${T.path}</div>
2943
2944
  <div class="config-diff__values">
2944
2945
  <span class="config-diff__from"
2945
- >${Ko(T.from)}</span
2946
+ >${Go(T.from)}</span
2946
2947
  >
2947
2948
  <span class="config-diff__arrow">→</span>
2948
2949
  <span class="config-diff__to"
2949
- >${Ko(T.to)}</span
2950
+ >${Go(T.to)}</span
2950
2951
  >
2951
2952
  </div>
2952
2953
  </div>
@@ -2957,7 +2958,7 @@ ${e.sidebarContent}
2957
2958
  ${g&&e.formMode==="form"?r`
2958
2959
  <div class="config-section-hero">
2959
2960
  <div class="config-section-hero__icon">
2960
- ${jo(e.activeSection??"")}
2961
+ ${qo(e.activeSection??"")}
2961
2962
  </div>
2962
2963
  <div class="config-section-hero__text">
2963
2964
  <div class="config-section-hero__title">
@@ -2973,7 +2974,7 @@ ${e.sidebarContent}
2973
2974
  <div class="config-subnav">
2974
2975
  <button
2975
2976
  class="config-subnav__item ${f===null?"active":""}"
2976
- @click=${()=>e.onSubsectionChange(Ho)}
2977
+ @click=${()=>e.onSubsectionChange(Wo)}
2977
2978
  >
2978
2979
  All
2979
2980
  </button>
@@ -2997,7 +2998,7 @@ ${e.sidebarContent}
2997
2998
  <div class="config-loading__spinner"></div>
2998
2999
  <span>Loading schema…</span>
2999
3000
  </div>
3000
- `:Tp({schema:n.schema,uiHints:e.uiHints,value:e.formValue,disabled:e.loading||!e.formValue,unsupportedPaths:n.unsupportedPaths,onPatch:e.onFormPatch,searchQuery:e.searchQuery,activeSection:e.activeSection,activeSubsection:f})}
3001
+ `:Fp({schema:n.schema,uiHints:e.uiHints,value:e.formValue,disabled:e.loading||!e.formValue,unsupportedPaths:n.unsupportedPaths,onPatch:e.onFormPatch,searchQuery:e.searchQuery,activeSection:e.activeSection,activeSubsection:f})}
3001
3002
  ${s?r`
3002
3003
  <div class="callout danger" style="margin-top: 12px">
3003
3004
  Form view can't safely edit some fields. Use Raw to avoid losing config entries.
@@ -3021,7 +3022,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
3021
3022
  </div>`:v}
3022
3023
  </main>
3023
3024
  </div>
3024
- `}function vv(e){const t=["last",...e.channels.filter(Boolean)],n=e.form.deliveryChannel?.trim();n&&!t.includes(n)&&t.push(n);const s=new Set;return t.filter(i=>s.has(i)?!1:(s.add(i),!0))}function mv(e,t){if(t==="last")return"last";const n=e.channelMeta?.find(s=>s.id===t);return n?.label?n.label:e.channelLabels?.[t]??t}function bv(e){const t=vv(e),s=(e.runsJobId==null?void 0:e.jobs.find(a=>a.id===e.runsJobId))?.name??e.runsJobId??"(select a job)",i=e.runs.toSorted((a,o)=>o.ts-a.ts);return r`
3025
+ `}function Mv(e){const t=["last",...e.channels.filter(Boolean)],n=e.form.deliveryChannel?.trim();n&&!t.includes(n)&&t.push(n);const s=new Set;return t.filter(i=>s.has(i)?!1:(s.add(i),!0))}function Iv(e,t){if(t==="last")return"last";const n=e.channelMeta?.find(s=>s.id===t);return n?.label?n.label:e.channelLabels?.[t]??t}function Rv(e){const t=Mv(e),s=(e.runsJobId==null?void 0:e.jobs.find(a=>a.id===e.runsJobId))?.name??e.runsJobId??"(select a job)",i=e.runs.toSorted((a,o)=>o.ts-a.ts);return r`
3025
3026
  <section class="grid grid-cols-2">
3026
3027
  <div class="card">
3027
3028
  <div class="card-title">Scheduler</div>
@@ -3039,7 +3040,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
3039
3040
  </div>
3040
3041
  <div class="stat">
3041
3042
  <div class="stat-label">Next wake</div>
3042
- <div class="stat-value">${Vi(e.status?.nextWakeAtMs??null)}</div>
3043
+ <div class="stat-value">${Qi(e.status?.nextWakeAtMs??null)}</div>
3043
3044
  </div>
3044
3045
  </div>
3045
3046
  <div class="row" style="margin-top: 12px;">
@@ -3096,7 +3097,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
3096
3097
  </select>
3097
3098
  </label>
3098
3099
  </div>
3099
- ${yv(e)}
3100
+ ${Pv(e)}
3100
3101
  <div class="form-grid" style="margin-top: 12px;">
3101
3102
  <label class="field">
3102
3103
  <span>Session</span>
@@ -3164,7 +3165,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
3164
3165
  @change=${a=>e.onFormChange({deliveryChannel:a.target.value})}
3165
3166
  >
3166
3167
  ${t.map(a=>r`<option value=${a}>
3167
- ${mv(e,a)}
3168
+ ${Iv(e,a)}
3168
3169
  </option>`)}
3169
3170
  </select>
3170
3171
  </label>
@@ -3194,7 +3195,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
3194
3195
  <div class="muted" style="margin-top: 12px">No jobs yet.</div>
3195
3196
  `:r`
3196
3197
  <div class="list" style="margin-top: 12px;">
3197
- ${e.jobs.map(a=>xv(a,e))}
3198
+ ${e.jobs.map(a=>Dv(a,e))}
3198
3199
  </div>
3199
3200
  `}
3200
3201
  </section>
@@ -3208,11 +3209,11 @@ ${JSON.stringify(e.issues,null,2)}</pre
3208
3209
  <div class="muted" style="margin-top: 12px">No runs yet.</div>
3209
3210
  `:r`
3210
3211
  <div class="list" style="margin-top: 12px;">
3211
- ${i.map(a=>kv(a,e.basePath))}
3212
+ ${i.map(a=>Ov(a,e.basePath))}
3212
3213
  </div>
3213
3214
  `}
3214
3215
  </section>
3215
- `}function yv(e){const t=e.form;return t.scheduleKind==="at"?r`
3216
+ `}function Pv(e){const t=e.form;return t.scheduleKind==="at"?r`
3216
3217
  <label class="field" style="margin-top: 12px;">
3217
3218
  <span>Run at</span>
3218
3219
  <input
@@ -3259,16 +3260,16 @@ ${JSON.stringify(e.issues,null,2)}</pre
3259
3260
  />
3260
3261
  </label>
3261
3262
  </div>
3262
- `}function xv(e,t){const s=`list-item list-item-clickable cron-job${t.runsJobId===e.id?" list-item-selected":""}`;return r`
3263
+ `}function Dv(e,t){const s=`list-item list-item-clickable cron-job${t.runsJobId===e.id?" list-item-selected":""}`;return r`
3263
3264
  <div class=${s} @click=${()=>t.onLoadRuns(e.id)}>
3264
3265
  <div class="list-main">
3265
3266
  <div class="list-title">${e.name}</div>
3266
- <div class="list-sub">${ll(e)}</div>
3267
- ${$v(e)}
3267
+ <div class="list-sub">${pl(e)}</div>
3268
+ ${Fv(e)}
3268
3269
  ${e.agentId?r`<div class="muted cron-job-agent">Agent: ${e.agentId}</div>`:v}
3269
3270
  </div>
3270
3271
  <div class="list-meta">
3271
- ${wv(e)}
3272
+ ${Nv(e)}
3272
3273
  </div>
3273
3274
  <div class="cron-job-footer">
3274
3275
  <div class="chip-row cron-job-chips">
@@ -3310,7 +3311,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
3310
3311
  </div>
3311
3312
  </div>
3312
3313
  </div>
3313
- `}function $v(e){if(e.payload.kind==="systemEvent")return r`<div class="cron-job-detail">
3314
+ `}function Fv(e){if(e.payload.kind==="systemEvent")return r`<div class="cron-job-detail">
3314
3315
  <span class="cron-job-detail-label">System</span>
3315
3316
  <span class="muted cron-job-detail-value">${e.payload.text}</span>
3316
3317
  </div>`;const t=e.delivery,n=t?.channel||t?.to?` (${t.channel??"last"}${t.to?` -> ${t.to}`:""})`:"";return r`
@@ -3322,7 +3323,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
3322
3323
  <span class="cron-job-detail-label">Delivery</span>
3323
3324
  <span class="muted cron-job-detail-value">${t.mode}${n}</span>
3324
3325
  </div>`:v}
3325
- `}function Wo(e){return typeof e!="number"||!Number.isFinite(e)?"n/a":V(e)}function wv(e){const t=e.state?.lastStatus??"n/a",n=t==="ok"?"cron-job-status-ok":t==="error"?"cron-job-status-error":t==="skipped"?"cron-job-status-skipped":"cron-job-status-na",s=e.state?.nextRunAtMs,i=e.state?.lastRunAtMs;return r`
3326
+ `}function Vo(e){return typeof e!="number"||!Number.isFinite(e)?"n/a":V(e)}function Nv(e){const t=e.state?.lastStatus??"n/a",n=t==="ok"?"cron-job-status-ok":t==="error"?"cron-job-status-error":t==="skipped"?"cron-job-status-skipped":"cron-job-status-na",s=e.state?.nextRunAtMs,i=e.state?.lastRunAtMs;return r`
3326
3327
  <div class="cron-job-state">
3327
3328
  <div class="cron-job-state-row">
3328
3329
  <span class="cron-job-state-key">Status</span>
@@ -3330,31 +3331,31 @@ ${JSON.stringify(e.issues,null,2)}</pre
3330
3331
  </div>
3331
3332
  <div class="cron-job-state-row">
3332
3333
  <span class="cron-job-state-key">Next</span>
3333
- <span class="cron-job-state-value" title=${ft(s)}>
3334
- ${Wo(s)}
3334
+ <span class="cron-job-state-value" title=${vt(s)}>
3335
+ ${Vo(s)}
3335
3336
  </span>
3336
3337
  </div>
3337
3338
  <div class="cron-job-state-row">
3338
3339
  <span class="cron-job-state-key">Last</span>
3339
- <span class="cron-job-state-value" title=${ft(i)}>
3340
- ${Wo(i)}
3340
+ <span class="cron-job-state-value" title=${vt(i)}>
3341
+ ${Vo(i)}
3341
3342
  </span>
3342
3343
  </div>
3343
3344
  </div>
3344
- `}function kv(e,t){const n=typeof e.sessionKey=="string"&&e.sessionKey.trim().length>0?`${ns("chat",t)}?session=${encodeURIComponent(e.sessionKey)}`:null;return r`
3345
+ `}function Ov(e,t){const n=typeof e.sessionKey=="string"&&e.sessionKey.trim().length>0?`${is("chat",t)}?session=${encodeURIComponent(e.sessionKey)}`:null;return r`
3345
3346
  <div class="list-item">
3346
3347
  <div class="list-main">
3347
3348
  <div class="list-title">${e.status}</div>
3348
3349
  <div class="list-sub">${e.summary??""}</div>
3349
3350
  </div>
3350
3351
  <div class="list-meta">
3351
- <div>${ft(e.ts)}</div>
3352
+ <div>${vt(e.ts)}</div>
3352
3353
  <div class="muted">${e.durationMs??0}ms</div>
3353
3354
  ${n?r`<div><a class="session-link" href=${n}>Open run chat</a></div>`:v}
3354
3355
  ${e.error?r`<div class="muted">${e.error}</div>`:v}
3355
3356
  </div>
3356
3357
  </div>
3357
- `}function Sv(e){const n=(e.status&&typeof e.status=="object"?e.status.securityAudit:null)?.summary??null,s=n?.critical??0,i=n?.warn??0,a=n?.info??0,o=s>0?"danger":i>0?"warn":"success",l=s>0?`${s} critical`:i>0?`${i} warnings`:"No critical issues";return r`
3358
+ `}function Bv(e){const n=(e.status&&typeof e.status=="object"?e.status.securityAudit:null)?.summary??null,s=n?.critical??0,i=n?.warn??0,a=n?.info??0,o=s>0?"danger":i>0?"warn":"success",l=s>0?`${s} critical`:i>0?`${i} warnings`:"No critical issues";return r`
3358
3359
  <section class="grid grid-cols-2">
3359
3360
  <div class="card">
3360
3361
  <div class="row" style="justify-content: space-between;">
@@ -3437,14 +3438,14 @@ ${JSON.stringify(e.issues,null,2)}</pre
3437
3438
  <div class="list-sub">${new Date(c.ts).toLocaleTimeString()}</div>
3438
3439
  </div>
3439
3440
  <div class="list-meta">
3440
- <pre class="code-block">${Hg(c.payload)}</pre>
3441
+ <pre class="code-block">${Zg(c.payload)}</pre>
3441
3442
  </div>
3442
3443
  </div>
3443
3444
  `)}
3444
3445
  </div>
3445
3446
  `}
3446
3447
  </section>
3447
- `}function Av(e){const t=Math.max(0,e),n=Math.floor(t/1e3);if(n<60)return`${n}s`;const s=Math.floor(n/60);return s<60?`${s}m`:`${Math.floor(s/60)}h`}function it(e,t){return t?r`<div class="exec-approval-meta-row"><span>${e}</span><span>${t}</span></div>`:v}function Cv(e){const t=e.execApprovalQueue[0];if(!t)return v;const n=t.request,s=t.expiresAtMs-Date.now(),i=s>0?`expires in ${Av(s)}`:"expired",a=e.execApprovalQueue.length;return r`
3448
+ `}function Uv(e){const t=Math.max(0,e),n=Math.floor(t/1e3);if(n<60)return`${n}s`;const s=Math.floor(n/60);return s<60?`${s}m`:`${Math.floor(s/60)}h`}function at(e,t){return t?r`<div class="exec-approval-meta-row"><span>${e}</span><span>${t}</span></div>`:v}function zv(e){const t=e.execApprovalQueue[0];if(!t)return v;const n=t.request,s=t.expiresAtMs-Date.now(),i=s>0?`expires in ${Uv(s)}`:"expired",a=e.execApprovalQueue.length;return r`
3448
3449
  <div class="exec-approval-overlay" role="dialog" aria-live="polite">
3449
3450
  <div class="exec-approval-card">
3450
3451
  <div class="exec-approval-header">
@@ -3456,13 +3457,13 @@ ${JSON.stringify(e.issues,null,2)}</pre
3456
3457
  </div>
3457
3458
  <div class="exec-approval-command mono">${n.command}</div>
3458
3459
  <div class="exec-approval-meta">
3459
- ${it("Host",n.host)}
3460
- ${it("Agent",n.agentId)}
3461
- ${it("Session",n.sessionKey)}
3462
- ${it("CWD",n.cwd)}
3463
- ${it("Resolved",n.resolvedPath)}
3464
- ${it("Security",n.security)}
3465
- ${it("Ask",n.ask)}
3460
+ ${at("Host",n.host)}
3461
+ ${at("Agent",n.agentId)}
3462
+ ${at("Session",n.sessionKey)}
3463
+ ${at("CWD",n.cwd)}
3464
+ ${at("Resolved",n.resolvedPath)}
3465
+ ${at("Security",n.security)}
3466
+ ${at("Ask",n.ask)}
3466
3467
  </div>
3467
3468
  ${e.execApprovalError?r`<div class="exec-approval-error">${e.execApprovalError}</div>`:v}
3468
3469
  <div class="exec-approval-actions">
@@ -3490,7 +3491,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
3490
3491
  </div>
3491
3492
  </div>
3492
3493
  </div>
3493
- `}function Tv(e){const{pendingGatewayUrl:t}=e;return t?r`
3494
+ `}function Hv(e){const{pendingGatewayUrl:t}=e;return t?r`
3494
3495
  <div class="exec-approval-overlay" role="dialog" aria-modal="true" aria-live="polite">
3495
3496
  <div class="exec-approval-card">
3496
3497
  <div class="exec-approval-header">
@@ -3519,7 +3520,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
3519
3520
  </div>
3520
3521
  </div>
3521
3522
  </div>
3522
- `:v}function _v(e){return r`
3523
+ `:v}function jv(e){return r`
3523
3524
  <section class="card">
3524
3525
  <div class="row" style="justify-content: space-between;">
3525
3526
  <div>
@@ -3539,14 +3540,14 @@ ${JSON.stringify(e.issues,null,2)}</pre
3539
3540
  <div class="list" style="margin-top: 16px;">
3540
3541
  ${e.entries.length===0?r`
3541
3542
  <div class="muted">No instances reported yet.</div>
3542
- `:e.entries.map(t=>Ev(t))}
3543
+ `:e.entries.map(t=>Kv(t))}
3543
3544
  </div>
3544
3545
  </section>
3545
- `}function Ev(e){const t=e.lastInputSeconds!=null?`${e.lastInputSeconds}s ago`:"n/a",n=e.mode??"unknown",s=Array.isArray(e.roles)?e.roles.filter(Boolean):[],i=Array.isArray(e.scopes)?e.scopes.filter(Boolean):[],a=i.length>0?i.length>3?`${i.length} scopes`:`scopes: ${i.join(", ")}`:null;return r`
3546
+ `}function Kv(e){const t=e.lastInputSeconds!=null?`${e.lastInputSeconds}s ago`:"n/a",n=e.mode??"unknown",s=Array.isArray(e.roles)?e.roles.filter(Boolean):[],i=Array.isArray(e.scopes)?e.scopes.filter(Boolean):[],a=i.length>0?i.length>3?`${i.length} scopes`:`scopes: ${i.join(", ")}`:null;return r`
3546
3547
  <div class="list-item">
3547
3548
  <div class="list-main">
3548
3549
  <div class="list-title">${e.host??"unknown host"}</div>
3549
- <div class="list-sub">${Bg(e)}</div>
3550
+ <div class="list-sub">${Qg(e)}</div>
3550
3551
  <div class="chip-row">
3551
3552
  <span class="chip">${n}</span>
3552
3553
  ${s.map(o=>r`<span class="chip">${o}</span>`)}
@@ -3558,12 +3559,12 @@ ${JSON.stringify(e.issues,null,2)}</pre
3558
3559
  </div>
3559
3560
  </div>
3560
3561
  <div class="list-meta">
3561
- <div>${Ug(e)}</div>
3562
+ <div>${Yg(e)}</div>
3562
3563
  <div class="muted">Last input ${t}</div>
3563
3564
  <div class="muted">Reason ${e.reason??""}</div>
3564
3565
  </div>
3565
3566
  </div>
3566
- `}const qo=["trace","debug","info","warn","error","fatal"];function Lv(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString()}function Mv(e,t){return t?[e.message,e.subsystem,e.raw].filter(Boolean).join(" ").toLowerCase().includes(t):!0}function Iv(e){const t=e.filterText.trim().toLowerCase(),n=qo.some(a=>!e.levelFilters[a]),s=e.entries.filter(a=>a.level&&!e.levelFilters[a.level]?!1:Mv(a,t)),i=t||n?"filtered":"visible";return r`
3567
+ `}const Qo=["trace","debug","info","warn","error","fatal"];function Wv(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString()}function qv(e,t){return t?[e.message,e.subsystem,e.raw].filter(Boolean).join(" ").toLowerCase().includes(t):!0}function Gv(e){const t=e.filterText.trim().toLowerCase(),n=Qo.some(a=>!e.levelFilters[a]),s=e.entries.filter(a=>a.level&&!e.levelFilters[a.level]?!1:qv(a,t)),i=t||n?"filtered":"visible";return r`
3567
3568
  <section class="card">
3568
3569
  <div class="row" style="justify-content: space-between;">
3569
3570
  <div>
@@ -3604,7 +3605,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
3604
3605
  </div>
3605
3606
 
3606
3607
  <div class="chip-row" style="margin-top: 12px;">
3607
- ${qo.map(a=>r`
3608
+ ${Qo.map(a=>r`
3608
3609
  <label class="chip log-chip ${a}">
3609
3610
  <input
3610
3611
  type="checkbox"
@@ -3627,7 +3628,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
3627
3628
  <div class="muted" style="padding: 12px">No log entries.</div>
3628
3629
  `:s.map(a=>r`
3629
3630
  <div class="log-row">
3630
- <div class="log-time mono">${Lv(a.time)}</div>
3631
+ <div class="log-time mono">${Wv(a.time)}</div>
3631
3632
  <div class="log-level ${a.level??""}">${a.level??""}</div>
3632
3633
  <div class="log-subsystem mono">${a.subsystem??""}</div>
3633
3634
  <div class="log-message mono">${a.message??a.raw}</div>
@@ -3635,10 +3636,10 @@ ${JSON.stringify(e.issues,null,2)}</pre
3635
3636
  `)}
3636
3637
  </div>
3637
3638
  </section>
3638
- `}function Rv(e){const t=Bv(e),n=Wv(e);return r`
3639
- ${Gv(n)}
3640
- ${qv(t)}
3641
- ${Pv(e)}
3639
+ `}function Vv(e){const t=em(e),n=om(e);return r`
3640
+ ${lm(n)}
3641
+ ${rm(t)}
3642
+ ${Qv(e)}
3642
3643
  <section class="card">
3643
3644
  <div class="row" style="justify-content: space-between;">
3644
3645
  <div>
@@ -3652,10 +3653,10 @@ ${JSON.stringify(e.issues,null,2)}</pre
3652
3653
  <div class="list" style="margin-top: 16px;">
3653
3654
  ${e.nodes.length===0?r`
3654
3655
  <div class="muted">No nodes found.</div>
3655
- `:e.nodes.map(s=>sm(s))}
3656
+ `:e.nodes.map(s=>bm(s))}
3656
3657
  </div>
3657
3658
  </section>
3658
- `}function Pv(e){const t=e.devicesList??{pending:[],paired:[]},n=Array.isArray(t.pending)?t.pending:[],s=Array.isArray(t.paired)?t.paired:[];return r`
3659
+ `}function Qv(e){const t=e.devicesList??{pending:[],paired:[]},n=Array.isArray(t.pending)?t.pending:[],s=Array.isArray(t.paired)?t.paired:[];return r`
3659
3660
  <section class="card">
3660
3661
  <div class="row" style="justify-content: space-between;">
3661
3662
  <div>
@@ -3670,18 +3671,18 @@ ${JSON.stringify(e.issues,null,2)}</pre
3670
3671
  <div class="list" style="margin-top: 16px;">
3671
3672
  ${n.length>0?r`
3672
3673
  <div class="muted" style="margin-bottom: 8px;">Pending</div>
3673
- ${n.map(i=>Dv(i,e))}
3674
+ ${n.map(i=>Yv(i,e))}
3674
3675
  `:v}
3675
3676
  ${s.length>0?r`
3676
3677
  <div class="muted" style="margin-top: 12px; margin-bottom: 8px;">Paired</div>
3677
- ${s.map(i=>Fv(i,e))}
3678
+ ${s.map(i=>Jv(i,e))}
3678
3679
  `:v}
3679
3680
  ${n.length===0&&s.length===0?r`
3680
3681
  <div class="muted">No paired devices.</div>
3681
3682
  `:v}
3682
3683
  </div>
3683
3684
  </section>
3684
- `}function Dv(e,t){const n=e.displayName?.trim()||e.deviceId,s=typeof e.ts=="number"?V(e.ts):"n/a",i=e.role?.trim()?`role: ${e.role}`:"role: -",a=e.isRepair?" · repair":"",o=e.remoteIp?` · ${e.remoteIp}`:"";return r`
3685
+ `}function Yv(e,t){const n=e.displayName?.trim()||e.deviceId,s=typeof e.ts=="number"?V(e.ts):"n/a",i=e.role?.trim()?`role: ${e.role}`:"role: -",a=e.isRepair?" · repair":"",o=e.remoteIp?` · ${e.remoteIp}`:"";return r`
3685
3686
  <div class="list-item">
3686
3687
  <div class="list-main">
3687
3688
  <div class="list-title">${n}</div>
@@ -3701,7 +3702,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
3701
3702
  </div>
3702
3703
  </div>
3703
3704
  </div>
3704
- `}function Fv(e,t){const n=e.displayName?.trim()||e.deviceId,s=e.remoteIp?` · ${e.remoteIp}`:"",i=`roles: ${Vs(e.roles)}`,a=`scopes: ${Vs(e.scopes)}`,o=Array.isArray(e.tokens)?e.tokens:[];return r`
3705
+ `}function Jv(e,t){const n=e.displayName?.trim()||e.deviceId,s=e.remoteIp?` · ${e.remoteIp}`:"",i=`roles: ${Vs(e.roles)}`,a=`scopes: ${Vs(e.scopes)}`,o=Array.isArray(e.tokens)?e.tokens:[];return r`
3705
3706
  <div class="list-item">
3706
3707
  <div class="list-main">
3707
3708
  <div class="list-title">${n}</div>
@@ -3712,12 +3713,12 @@ ${JSON.stringify(e.issues,null,2)}</pre
3712
3713
  `:r`
3713
3714
  <div class="muted" style="margin-top: 10px;">Tokens</div>
3714
3715
  <div style="display: flex; flex-direction: column; gap: 8px; margin-top: 6px;">
3715
- ${o.map(l=>Nv(e.deviceId,l,t))}
3716
+ ${o.map(l=>Zv(e.deviceId,l,t))}
3716
3717
  </div>
3717
3718
  `}
3718
3719
  </div>
3719
3720
  </div>
3720
- `}function Nv(e,t,n){const s=t.revokedAtMs?"revoked":"active",i=`scopes: ${Vs(t.scopes)}`,a=V(t.rotatedAtMs??t.createdAtMs??t.lastUsedAtMs??null);return r`
3721
+ `}function Zv(e,t,n){const s=t.revokedAtMs?"revoked":"active",i=`scopes: ${Vs(t.scopes)}`,a=V(t.rotatedAtMs??t.createdAtMs??t.lastUsedAtMs??null);return r`
3721
3722
  <div class="row" style="justify-content: space-between; gap: 8px;">
3722
3723
  <div class="list-sub">${t.role} · ${s} · ${i} · ${a}</div>
3723
3724
  <div class="row" style="justify-content: flex-end; gap: 6px; flex-wrap: wrap;">
@@ -3737,7 +3738,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
3737
3738
  `}
3738
3739
  </div>
3739
3740
  </div>
3740
- `}const Ve="__defaults__",Go=[{value:"deny",label:"Deny"},{value:"allowlist",label:"Allowlist"},{value:"full",label:"Full"}],Ov=[{value:"off",label:"Off"},{value:"on-miss",label:"On miss"},{value:"always",label:"Always"}];function Bv(e){const t=e.configForm,n=em(e.nodes),{defaultBinding:s,agents:i}=nm(t),a=!!t,o=e.configSaving||e.configFormMode==="raw";return{ready:a,disabled:o,configDirty:e.configDirty,configLoading:e.configLoading,configSaving:e.configSaving,defaultBinding:s,agents:i,nodes:n,onBindDefault:e.onBindDefault,onBindAgent:e.onBindAgent,onSave:e.onSaveBindings,onLoadConfig:e.onLoadConfig,formMode:e.configFormMode}}function Vo(e){return e==="allowlist"||e==="full"||e==="deny"?e:"deny"}function Uv(e){return e==="always"||e==="off"||e==="on-miss"?e:"on-miss"}function zv(e){const t=e?.defaults??{};return{security:Vo(t.security),ask:Uv(t.ask),askFallback:Vo(t.askFallback??"deny"),autoAllowSkills:!!(t.autoAllowSkills??!1)}}function Hv(e){const t=e?.agents??{},n=Array.isArray(t.list)?t.list:[],s=[];return n.forEach(i=>{if(!i||typeof i!="object")return;const a=i,o=typeof a.id=="string"?a.id.trim():"";if(!o)return;const l=typeof a.name=="string"?a.name.trim():void 0,c=a.default===!0;s.push({id:o,name:l||void 0,isDefault:c})}),s}function jv(e,t){const n=Hv(e),s=Object.keys(t?.agents??{}),i=new Map;n.forEach(o=>i.set(o.id,o)),s.forEach(o=>{i.has(o)||i.set(o,{id:o})});const a=Array.from(i.values());return a.length===0&&a.push({id:"main",isDefault:!0}),a.sort((o,l)=>{if(o.isDefault&&!l.isDefault)return-1;if(!o.isDefault&&l.isDefault)return 1;const c=o.name?.trim()?o.name:o.id,u=l.name?.trim()?l.name:l.id;return c.localeCompare(u)}),a}function Kv(e,t){return e===Ve?Ve:e&&t.some(n=>n.id===e)?e:Ve}function Wv(e){const t=e.execApprovalsForm??e.execApprovalsSnapshot?.file??null,n=!!t,s=zv(t),i=jv(e.configForm,t),a=tm(e.nodes),o=e.execApprovalsTarget;let l=o==="node"&&e.execApprovalsTargetNodeId?e.execApprovalsTargetNodeId:null;o==="node"&&l&&!a.some(p=>p.id===l)&&(l=null);const c=Kv(e.execApprovalsSelectedAgent,i),u=c!==Ve?(t?.agents??{})[c]??null:null,g=Array.isArray(u?.allowlist)?u.allowlist??[]:[];return{ready:n,disabled:e.execApprovalsSaving||e.execApprovalsLoading,dirty:e.execApprovalsDirty,loading:e.execApprovalsLoading,saving:e.execApprovalsSaving,form:t,defaults:s,selectedScope:c,selectedAgent:u,agents:i,allowlist:g,target:o,targetNodeId:l,targetNodes:a,onSelectScope:e.onExecApprovalsSelectAgent,onSelectTarget:e.onExecApprovalsTargetChange,onPatch:e.onExecApprovalsPatch,onRemove:e.onExecApprovalsRemove,onLoad:e.onLoadExecApprovals,onSave:e.onSaveExecApprovals}}function qv(e){const t=e.nodes.length>0,n=e.defaultBinding??"";return r`
3741
+ `}const Qe="__defaults__",Yo=[{value:"deny",label:"Deny"},{value:"allowlist",label:"Allowlist"},{value:"full",label:"Full"}],Xv=[{value:"off",label:"Off"},{value:"on-miss",label:"On miss"},{value:"always",label:"Always"}];function em(e){const t=e.configForm,n=hm(e.nodes),{defaultBinding:s,agents:i}=mm(t),a=!!t,o=e.configSaving||e.configFormMode==="raw";return{ready:a,disabled:o,configDirty:e.configDirty,configLoading:e.configLoading,configSaving:e.configSaving,defaultBinding:s,agents:i,nodes:n,onBindDefault:e.onBindDefault,onBindAgent:e.onBindAgent,onSave:e.onSaveBindings,onLoadConfig:e.onLoadConfig,formMode:e.configFormMode}}function Jo(e){return e==="allowlist"||e==="full"||e==="deny"?e:"deny"}function tm(e){return e==="always"||e==="off"||e==="on-miss"?e:"on-miss"}function nm(e){const t=e?.defaults??{};return{security:Jo(t.security),ask:tm(t.ask),askFallback:Jo(t.askFallback??"deny"),autoAllowSkills:!!(t.autoAllowSkills??!1)}}function sm(e){const t=e?.agents??{},n=Array.isArray(t.list)?t.list:[],s=[];return n.forEach(i=>{if(!i||typeof i!="object")return;const a=i,o=typeof a.id=="string"?a.id.trim():"";if(!o)return;const l=typeof a.name=="string"?a.name.trim():void 0,c=a.default===!0;s.push({id:o,name:l||void 0,isDefault:c})}),s}function im(e,t){const n=sm(e),s=Object.keys(t?.agents??{}),i=new Map;n.forEach(o=>i.set(o.id,o)),s.forEach(o=>{i.has(o)||i.set(o,{id:o})});const a=Array.from(i.values());return a.length===0&&a.push({id:"main",isDefault:!0}),a.sort((o,l)=>{if(o.isDefault&&!l.isDefault)return-1;if(!o.isDefault&&l.isDefault)return 1;const c=o.name?.trim()?o.name:o.id,u=l.name?.trim()?l.name:l.id;return c.localeCompare(u)}),a}function am(e,t){return e===Qe?Qe:e&&t.some(n=>n.id===e)?e:Qe}function om(e){const t=e.execApprovalsForm??e.execApprovalsSnapshot?.file??null,n=!!t,s=nm(t),i=im(e.configForm,t),a=vm(e.nodes),o=e.execApprovalsTarget;let l=o==="node"&&e.execApprovalsTargetNodeId?e.execApprovalsTargetNodeId:null;o==="node"&&l&&!a.some(p=>p.id===l)&&(l=null);const c=am(e.execApprovalsSelectedAgent,i),u=c!==Qe?(t?.agents??{})[c]??null:null,g=Array.isArray(u?.allowlist)?u.allowlist??[]:[];return{ready:n,disabled:e.execApprovalsSaving||e.execApprovalsLoading,dirty:e.execApprovalsDirty,loading:e.execApprovalsLoading,saving:e.execApprovalsSaving,form:t,defaults:s,selectedScope:c,selectedAgent:u,agents:i,allowlist:g,target:o,targetNodeId:l,targetNodes:a,onSelectScope:e.onExecApprovalsSelectAgent,onSelectTarget:e.onExecApprovalsTargetChange,onPatch:e.onExecApprovalsPatch,onRemove:e.onExecApprovalsRemove,onLoad:e.onLoadExecApprovals,onSave:e.onSaveExecApprovals}}function rm(e){const t=e.nodes.length>0,n=e.defaultBinding??"";return r`
3741
3742
  <section class="card">
3742
3743
  <div class="row" style="justify-content: space-between; align-items: center;">
3743
3744
  <div>
@@ -3792,7 +3793,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
3792
3793
 
3793
3794
  ${e.agents.length===0?r`
3794
3795
  <div class="muted">No agents found.</div>
3795
- `:e.agents.map(s=>Xv(s,e))}
3796
+ `:e.agents.map(s=>fm(s,e))}
3796
3797
  </div>
3797
3798
  `:r`<div class="row" style="margin-top: 12px; gap: 12px;">
3798
3799
  <div class="muted">Load config to edit bindings.</div>
@@ -3801,7 +3802,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
3801
3802
  </button>
3802
3803
  </div>`}
3803
3804
  </section>
3804
- `}function Gv(e){const t=e.ready,n=e.target!=="node"||!!e.targetNodeId;return r`
3805
+ `}function lm(e){const t=e.ready,n=e.target!=="node"||!!e.targetNodeId;return r`
3805
3806
  <section class="card">
3806
3807
  <div class="row" style="justify-content: space-between; align-items: center;">
3807
3808
  <div>
@@ -3819,12 +3820,12 @@ ${JSON.stringify(e.issues,null,2)}</pre
3819
3820
  </button>
3820
3821
  </div>
3821
3822
 
3822
- ${Vv(e)}
3823
+ ${cm(e)}
3823
3824
 
3824
3825
  ${t?r`
3825
- ${Qv(e)}
3826
- ${Yv(e)}
3827
- ${e.selectedScope===Ve?v:Jv(e)}
3826
+ ${dm(e)}
3827
+ ${um(e)}
3828
+ ${e.selectedScope===Qe?v:gm(e)}
3828
3829
  `:r`<div class="row" style="margin-top: 12px; gap: 12px;">
3829
3830
  <div class="muted">Load exec approvals to edit allowlists.</div>
3830
3831
  <button class="btn" ?disabled=${e.loading||!n} @click=${e.onLoad}>
@@ -3832,7 +3833,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
3832
3833
  </button>
3833
3834
  </div>`}
3834
3835
  </section>
3835
- `}function Vv(e){const t=e.targetNodes.length>0,n=e.targetNodeId??"";return r`
3836
+ `}function cm(e){const t=e.targetNodes.length>0,n=e.targetNodeId??"";return r`
3836
3837
  <div class="list" style="margin-top: 12px;">
3837
3838
  <div class="list-item">
3838
3839
  <div class="list-main">
@@ -3875,13 +3876,13 @@ ${JSON.stringify(e.issues,null,2)}</pre
3875
3876
  <div class="muted">No nodes advertise exec approvals yet.</div>
3876
3877
  `:v}
3877
3878
  </div>
3878
- `}function Qv(e){return r`
3879
+ `}function dm(e){return r`
3879
3880
  <div class="row" style="margin-top: 12px; gap: 8px; flex-wrap: wrap;">
3880
3881
  <span class="label">Scope</span>
3881
3882
  <div class="row" style="gap: 8px; flex-wrap: wrap;">
3882
3883
  <button
3883
- class="btn btn--sm ${e.selectedScope===Ve?"active":""}"
3884
- @click=${()=>e.onSelectScope(Ve)}
3884
+ class="btn btn--sm ${e.selectedScope===Qe?"active":""}"
3885
+ @click=${()=>e.onSelectScope(Qe)}
3885
3886
  >
3886
3887
  Defaults
3887
3888
  </button>
@@ -3895,7 +3896,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
3895
3896
  `})}
3896
3897
  </div>
3897
3898
  </div>
3898
- `}function Yv(e){const t=e.selectedScope===Ve,n=e.defaults,s=e.selectedAgent??{},i=t?["defaults"]:["agents",e.selectedScope],a=typeof s.security=="string"?s.security:void 0,o=typeof s.ask=="string"?s.ask:void 0,l=typeof s.askFallback=="string"?s.askFallback:void 0,c=t?n.security:a??"__default__",u=t?n.ask:o??"__default__",g=t?n.askFallback:l??"__default__",p=typeof s.autoAllowSkills=="boolean"?s.autoAllowSkills:void 0,h=p??n.autoAllowSkills,d=p==null;return r`
3899
+ `}function um(e){const t=e.selectedScope===Qe,n=e.defaults,s=e.selectedAgent??{},i=t?["defaults"]:["agents",e.selectedScope],a=typeof s.security=="string"?s.security:void 0,o=typeof s.ask=="string"?s.ask:void 0,l=typeof s.askFallback=="string"?s.askFallback:void 0,c=t?n.security:a??"__default__",u=t?n.ask:o??"__default__",g=t?n.askFallback:l??"__default__",p=typeof s.autoAllowSkills=="boolean"?s.autoAllowSkills:void 0,h=p??n.autoAllowSkills,d=p==null;return r`
3899
3900
  <div class="list" style="margin-top: 16px;">
3900
3901
  <div class="list-item">
3901
3902
  <div class="list-main">
@@ -3914,7 +3915,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
3914
3915
  ${t?v:r`<option value="__default__" ?selected=${c==="__default__"}>
3915
3916
  Use default (${n.security})
3916
3917
  </option>`}
3917
- ${Go.map(f=>r`<option
3918
+ ${Yo.map(f=>r`<option
3918
3919
  value=${f.value}
3919
3920
  ?selected=${c===f.value}
3920
3921
  >
@@ -3942,7 +3943,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
3942
3943
  ${t?v:r`<option value="__default__" ?selected=${u==="__default__"}>
3943
3944
  Use default (${n.ask})
3944
3945
  </option>`}
3945
- ${Ov.map(f=>r`<option
3946
+ ${Xv.map(f=>r`<option
3946
3947
  value=${f.value}
3947
3948
  ?selected=${u===f.value}
3948
3949
  >
@@ -3970,7 +3971,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
3970
3971
  ${t?v:r`<option value="__default__" ?selected=${g==="__default__"}>
3971
3972
  Use default (${n.askFallback})
3972
3973
  </option>`}
3973
- ${Go.map(f=>r`<option
3974
+ ${Yo.map(f=>r`<option
3974
3975
  value=${f.value}
3975
3976
  ?selected=${g===f.value}
3976
3977
  >
@@ -4008,7 +4009,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
4008
4009
  </div>
4009
4010
  </div>
4010
4011
  </div>
4011
- `}function Jv(e){const t=["agents",e.selectedScope,"allowlist"],n=e.allowlist;return r`
4012
+ `}function gm(e){const t=["agents",e.selectedScope,"allowlist"],n=e.allowlist;return r`
4012
4013
  <div class="row" style="margin-top: 18px; justify-content: space-between;">
4013
4014
  <div>
4014
4015
  <div class="card-title">Allowlist</div>
@@ -4025,9 +4026,9 @@ ${JSON.stringify(e.issues,null,2)}</pre
4025
4026
  <div class="list" style="margin-top: 12px;">
4026
4027
  ${n.length===0?r`
4027
4028
  <div class="muted">No allowlist entries yet.</div>
4028
- `:n.map((s,i)=>Zv(e,s,i))}
4029
+ `:n.map((s,i)=>pm(e,s,i))}
4029
4030
  </div>
4030
- `}function Zv(e,t,n){const s=t.lastUsedAt?V(t.lastUsedAt):"never",i=t.lastUsedCommand?Qs(t.lastUsedCommand,120):null,a=t.lastResolvedPath?Qs(t.lastResolvedPath,120):null;return r`
4031
+ `}function pm(e,t,n){const s=t.lastUsedAt?V(t.lastUsedAt):"never",i=t.lastUsedCommand?Qs(t.lastUsedCommand,120):null,a=t.lastResolvedPath?Qs(t.lastResolvedPath,120):null;return r`
4031
4032
  <div class="list-item">
4032
4033
  <div class="list-main">
4033
4034
  <div class="list-title">${t.pattern?.trim()?t.pattern:"New pattern"}</div>
@@ -4054,7 +4055,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
4054
4055
  </button>
4055
4056
  </div>
4056
4057
  </div>
4057
- `}function Xv(e,t){const n=e.binding??"__default__",s=e.name?.trim()?`${e.name} (${e.id})`:e.id,i=t.nodes.length>0;return r`
4058
+ `}function fm(e,t){const n=e.binding??"__default__",s=e.name?.trim()?`${e.name} (${e.id})`:e.id,i=t.nodes.length>0;return r`
4058
4059
  <div class="list-item">
4059
4060
  <div class="list-main">
4060
4061
  <div class="list-title">${s}</div>
@@ -4083,7 +4084,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
4083
4084
  </label>
4084
4085
  </div>
4085
4086
  </div>
4086
- `}function em(e){const t=[];for(const n of e){if(!(Array.isArray(n.commands)?n.commands:[]).some(l=>String(l)==="system.run"))continue;const a=typeof n.nodeId=="string"?n.nodeId.trim():"";if(!a)continue;const o=typeof n.displayName=="string"&&n.displayName.trim()?n.displayName.trim():a;t.push({id:a,label:o===a?a:`${o} · ${a}`})}return t.sort((n,s)=>n.label.localeCompare(s.label)),t}function tm(e){const t=[];for(const n of e){if(!(Array.isArray(n.commands)?n.commands:[]).some(l=>String(l)==="system.execApprovals.get"||String(l)==="system.execApprovals.set"))continue;const a=typeof n.nodeId=="string"?n.nodeId.trim():"";if(!a)continue;const o=typeof n.displayName=="string"&&n.displayName.trim()?n.displayName.trim():a;t.push({id:a,label:o===a?a:`${o} · ${a}`})}return t.sort((n,s)=>n.label.localeCompare(s.label)),t}function nm(e){const t={id:"main",name:void 0,index:0,isDefault:!0,binding:null};if(!e||typeof e!="object")return{defaultBinding:null,agents:[t]};const s=(e.tools??{}).exec??{},i=typeof s.node=="string"&&s.node.trim()?s.node.trim():null,a=e.agents??{},o=Array.isArray(a.list)?a.list:[];if(o.length===0)return{defaultBinding:i,agents:[t]};const l=[];return o.forEach((c,u)=>{if(!c||typeof c!="object")return;const g=c,p=typeof g.id=="string"?g.id.trim():"";if(!p)return;const h=typeof g.name=="string"?g.name.trim():void 0,d=g.default===!0,m=(g.tools??{}).exec??{},S=typeof m.node=="string"&&m.node.trim()?m.node.trim():null;l.push({id:p,name:h||void 0,index:u,isDefault:d,binding:S})}),l.length===0&&l.push(t),{defaultBinding:i,agents:l}}function sm(e){const t=!!e.connected,n=!!e.paired,s=typeof e.displayName=="string"&&e.displayName.trim()||(typeof e.nodeId=="string"?e.nodeId:"unknown"),i=Array.isArray(e.caps)?e.caps:[],a=Array.isArray(e.commands)?e.commands:[];return r`
4087
+ `}function hm(e){const t=[];for(const n of e){if(!(Array.isArray(n.commands)?n.commands:[]).some(l=>String(l)==="system.run"))continue;const a=typeof n.nodeId=="string"?n.nodeId.trim():"";if(!a)continue;const o=typeof n.displayName=="string"&&n.displayName.trim()?n.displayName.trim():a;t.push({id:a,label:o===a?a:`${o} · ${a}`})}return t.sort((n,s)=>n.label.localeCompare(s.label)),t}function vm(e){const t=[];for(const n of e){if(!(Array.isArray(n.commands)?n.commands:[]).some(l=>String(l)==="system.execApprovals.get"||String(l)==="system.execApprovals.set"))continue;const a=typeof n.nodeId=="string"?n.nodeId.trim():"";if(!a)continue;const o=typeof n.displayName=="string"&&n.displayName.trim()?n.displayName.trim():a;t.push({id:a,label:o===a?a:`${o} · ${a}`})}return t.sort((n,s)=>n.label.localeCompare(s.label)),t}function mm(e){const t={id:"main",name:void 0,index:0,isDefault:!0,binding:null};if(!e||typeof e!="object")return{defaultBinding:null,agents:[t]};const s=(e.tools??{}).exec??{},i=typeof s.node=="string"&&s.node.trim()?s.node.trim():null,a=e.agents??{},o=Array.isArray(a.list)?a.list:[];if(o.length===0)return{defaultBinding:i,agents:[t]};const l=[];return o.forEach((c,u)=>{if(!c||typeof c!="object")return;const g=c,p=typeof g.id=="string"?g.id.trim():"";if(!p)return;const h=typeof g.name=="string"?g.name.trim():void 0,d=g.default===!0,m=(g.tools??{}).exec??{},S=typeof m.node=="string"&&m.node.trim()?m.node.trim():null;l.push({id:p,name:h||void 0,index:u,isDefault:d,binding:S})}),l.length===0&&l.push(t),{defaultBinding:i,agents:l}}function bm(e){const t=!!e.connected,n=!!e.paired,s=typeof e.displayName=="string"&&e.displayName.trim()||(typeof e.nodeId=="string"?e.nodeId:"unknown"),i=Array.isArray(e.caps)?e.caps:[],a=Array.isArray(e.commands)?e.commands:[];return r`
4087
4088
  <div class="list-item">
4088
4089
  <div class="list-main">
4089
4090
  <div class="list-title">${s}</div>
@@ -4102,7 +4103,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
4102
4103
  </div>
4103
4104
  </div>
4104
4105
  </div>
4105
- `}function im(e){const t=e.hello?.snapshot,n=t?.uptimeMs?Ri(t.uptimeMs):"n/a",s=t?.policy?.tickIntervalMs?`${t.policy.tickIntervalMs}ms`:"n/a",i=(()=>{if(e.connected||!e.lastError)return null;const o=e.lastError.toLowerCase();if(!(o.includes("unauthorized")||o.includes("connect failed")))return null;const c=!!e.settings.token.trim(),u=!!e.password.trim();return!c&&!u?r`
4106
+ `}function ym(e){const t=e.hello?.snapshot,n=t?.uptimeMs?Pi(t.uptimeMs):"n/a",s=t?.policy?.tickIntervalMs?`${t.policy.tickIntervalMs}ms`:"n/a",i=(()=>{if(e.connected||!e.lastError)return null;const o=e.lastError.toLowerCase();if(!(o.includes("unauthorized")||o.includes("connect failed")))return null;const c=!!e.settings.token.trim(),u=!!e.password.trim();return!c&&!u?r`
4106
4107
  <div class="muted" style="margin-top: 8px">
4107
4108
  This gateway requires auth. Add a token or password, then click Connect.
4108
4109
  <div style="margin-top: 6px">
@@ -4261,7 +4262,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
4261
4262
  <div class="stat-value">
4262
4263
  ${e.cronEnabled==null?"n/a":e.cronEnabled?"Enabled":"Disabled"}
4263
4264
  </div>
4264
- <div class="muted">Next wake ${Vi(e.cronNext)}</div>
4265
+ <div class="muted">Next wake ${Qi(e.cronNext)}</div>
4265
4266
  </div>
4266
4267
  </section>
4267
4268
 
@@ -4285,7 +4286,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
4285
4286
  </div>
4286
4287
  </div>
4287
4288
  </section>
4288
- `}const am=["","off","minimal","low","medium","high","xhigh"],om=["","off","on"],rm=[{value:"",label:"inherit"},{value:"off",label:"off (explicit)"},{value:"on",label:"on"},{value:"full",label:"full"}],lm=["","off","on","stream"];function cm(e){if(!e)return"";const t=e.trim().toLowerCase();return t==="z.ai"||t==="z-ai"?"zai":t}function Bl(e){return cm(e)==="zai"}function dm(e){return Bl(e)?om:am}function Qo(e,t){return t?e.includes(t)?[...e]:[...e,t]:[...e]}function um(e,t){return t?e.some(n=>n.value===t)?[...e]:[...e,{value:t,label:`${t} (custom)`}]:[...e]}function gm(e,t){return!t||!e||e==="off"?e:"on"}function pm(e,t){return e?t&&e==="on"?"low":e:null}function fm(e){const t=e.result?.sessions??[];return r`
4289
+ `}const xm=["","off","minimal","low","medium","high","xhigh"],$m=["","off","on"],wm=[{value:"",label:"inherit"},{value:"off",label:"off (explicit)"},{value:"on",label:"on"},{value:"full",label:"full"}],km=["","off","on","stream"];function Sm(e){if(!e)return"";const t=e.trim().toLowerCase();return t==="z.ai"||t==="z-ai"?"zai":t}function Gl(e){return Sm(e)==="zai"}function Am(e){return Gl(e)?$m:xm}function Zo(e,t){return t?e.includes(t)?[...e]:[...e,t]:[...e]}function Cm(e,t){return t?e.some(n=>n.value===t)?[...e]:[...e,{value:t,label:`${t} (custom)`}]:[...e]}function Tm(e,t){return!t||!e||e==="off"?e:"on"}function _m(e,t){return e?t&&e==="on"?"low":e:null}function Em(e){const t=e.result?.sessions??[];return r`
4289
4290
  <section class="card">
4290
4291
  <div class="row" style="justify-content: space-between;">
4291
4292
  <div>
@@ -4350,10 +4351,10 @@ ${JSON.stringify(e.issues,null,2)}</pre
4350
4351
  </div>
4351
4352
  ${t.length===0?r`
4352
4353
  <div class="muted">No sessions found.</div>
4353
- `:t.map(n=>hm(n,e.basePath,e.onPatch,e.onDelete,e.loading))}
4354
+ `:t.map(n=>Lm(n,e.basePath,e.onPatch,e.onDelete,e.loading))}
4354
4355
  </div>
4355
4356
  </section>
4356
- `}function hm(e,t,n,s,i){const a=e.updatedAt?V(e.updatedAt):"n/a",o=e.thinkingLevel??"",l=Bl(e.modelProvider),c=gm(o,l),u=Qo(dm(e.modelProvider),c),g=e.verboseLevel??"",p=um(rm,g),h=e.reasoningLevel??"",d=Qo(lm,h),f=typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName.trim():null,m=typeof e.label=="string"?e.label.trim():"",S=!!(f&&f!==e.key&&f!==m),k=e.kind!=="global",$=k?`${ns("chat",t)}?session=${encodeURIComponent(e.key)}`:null;return r`
4357
+ `}function Lm(e,t,n,s,i){const a=e.updatedAt?V(e.updatedAt):"n/a",o=e.thinkingLevel??"",l=Gl(e.modelProvider),c=Tm(o,l),u=Zo(Am(e.modelProvider),c),g=e.verboseLevel??"",p=Cm(wm,g),h=e.reasoningLevel??"",d=Zo(km,h),f=typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName.trim():null,m=typeof e.label=="string"?e.label.trim():"",S=!!(f&&f!==e.key&&f!==m),k=e.kind!=="global",$=k?`${is("chat",t)}?session=${encodeURIComponent(e.key)}`:null;return r`
4357
4358
  <div class="table-row">
4358
4359
  <div class="mono session-key-cell">
4359
4360
  ${k?r`<a href=${$} class="session-link">${e.key}</a>`:e.key}
@@ -4369,11 +4370,11 @@ ${JSON.stringify(e.issues,null,2)}</pre
4369
4370
  </div>
4370
4371
  <div>${e.kind}</div>
4371
4372
  <div>${a}</div>
4372
- <div>${zg(e)}</div>
4373
+ <div>${Jg(e)}</div>
4373
4374
  <div>
4374
4375
  <select
4375
4376
  ?disabled=${i}
4376
- @change=${A=>{const C=A.target.value;n(e.key,{thinkingLevel:pm(C,l)})}}
4377
+ @change=${A=>{const C=A.target.value;n(e.key,{thinkingLevel:_m(C,l)})}}
4377
4378
  >
4378
4379
  ${u.map(A=>r`<option value=${A} ?selected=${c===A}>
4379
4380
  ${A||"inherit"}
@@ -4406,7 +4407,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
4406
4407
  </button>
4407
4408
  </div>
4408
4409
  </div>
4409
- `}const Tn=[{id:"workspace",label:"Workspace Skills",sources:["openclaw-workspace"]},{id:"built-in",label:"Built-in Skills",sources:["openclaw-bundled"]},{id:"installed",label:"Installed Skills",sources:["openclaw-managed"]},{id:"extra",label:"Extra Skills",sources:["openclaw-extra"]}];function vm(e){const t=new Map;for(const a of Tn)t.set(a.id,{id:a.id,label:a.label,skills:[]});const n=Tn.find(a=>a.id==="built-in"),s={id:"other",label:"Other Skills",skills:[]};for(const a of e){const o=a.bundled?n:Tn.find(l=>l.sources.includes(a.source));o?t.get(o.id)?.skills.push(a):s.skills.push(a)}const i=Tn.map(a=>t.get(a.id)).filter(a=>!!(a&&a.skills.length>0));return s.skills.length>0&&i.push(s),i}function mm(e){const t=e.report?.skills??[],n=e.filter.trim().toLowerCase(),s=n?t.filter(a=>[a.name,a.description,a.source].join(" ").toLowerCase().includes(n)):t,i=vm(s);return r`
4410
+ `}const En=[{id:"workspace",label:"Workspace Skills",sources:["openclaw-workspace"]},{id:"built-in",label:"Built-in Skills",sources:["openclaw-bundled"]},{id:"installed",label:"Installed Skills",sources:["openclaw-managed"]},{id:"extra",label:"Extra Skills",sources:["openclaw-extra"]}];function Mm(e){const t=new Map;for(const a of En)t.set(a.id,{id:a.id,label:a.label,skills:[]});const n=En.find(a=>a.id==="built-in"),s={id:"other",label:"Other Skills",skills:[]};for(const a of e){const o=a.bundled?n:En.find(l=>l.sources.includes(a.source));o?t.get(o.id)?.skills.push(a):s.skills.push(a)}const i=En.map(a=>t.get(a.id)).filter(a=>!!(a&&a.skills.length>0));return s.skills.length>0&&i.push(s),i}function Im(e){const t=e.report?.skills??[],n=e.filter.trim().toLowerCase(),s=n?t.filter(a=>[a.name,a.description,a.source].join(" ").toLowerCase().includes(n)):t,i=Mm(s);return r`
4410
4411
  <section class="card">
4411
4412
  <div class="row" style="justify-content: space-between;">
4412
4413
  <div>
@@ -4443,14 +4444,14 @@ ${JSON.stringify(e.issues,null,2)}</pre
4443
4444
  <span class="muted">${a.skills.length}</span>
4444
4445
  </summary>
4445
4446
  <div class="list skills-grid">
4446
- ${a.skills.map(l=>bm(l,e))}
4447
+ ${a.skills.map(l=>Rm(l,e))}
4447
4448
  </div>
4448
4449
  </details>
4449
4450
  `})}
4450
4451
  </div>
4451
4452
  `}
4452
4453
  </section>
4453
- `}function bm(e,t){const n=t.busyKey===e.skillKey,s=t.edits[e.skillKey]??"",i=t.messages[e.skillKey]??null,a=e.install.length>0&&e.missing.bins.length>0,o=!!(e.bundled&&e.source!=="openclaw-bundled"),l=[...e.missing.bins.map(u=>`bin:${u}`),...e.missing.env.map(u=>`env:${u}`),...e.missing.config.map(u=>`config:${u}`),...e.missing.os.map(u=>`os:${u}`)],c=[];return e.disabled&&c.push("disabled"),e.blockedByAllowlist&&c.push("blocked by allowlist"),r`
4454
+ `}function Rm(e,t){const n=t.busyKey===e.skillKey,s=t.edits[e.skillKey]??"",i=t.messages[e.skillKey]??null,a=e.install.length>0&&e.missing.bins.length>0,o=!!(e.bundled&&e.source!=="openclaw-bundled"),l=[...e.missing.bins.map(u=>`bin:${u}`),...e.missing.env.map(u=>`env:${u}`),...e.missing.config.map(u=>`config:${u}`),...e.missing.os.map(u=>`os:${u}`)],c=[];return e.disabled&&c.push("disabled"),e.blockedByAllowlist&&c.push("blocked by allowlist"),r`
4454
4455
  <div class="list-item">
4455
4456
  <div class="list-main">
4456
4457
  <div class="list-title">
@@ -4523,9 +4524,9 @@ ${JSON.stringify(e.issues,null,2)}</pre
4523
4524
  `:v}
4524
4525
  </div>
4525
4526
  </div>
4526
- `}const ym=new Set(["agent","channel","chat","provider","model","tool","label","key","session","id","has","mintokens","maxtokens","mincost","maxcost","minmessages","maxmessages"]),Wn=e=>e.trim().toLowerCase(),xm=e=>{const t=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp(`^${t}$`,"i")},rt=e=>{let t=e.trim().toLowerCase();if(!t)return null;t.startsWith("$")&&(t=t.slice(1));let n=1;t.endsWith("k")?(n=1e3,t=t.slice(0,-1)):t.endsWith("m")&&(n=1e6,t=t.slice(0,-1));const s=Number(t);return Number.isFinite(s)?s*n:null},ra=e=>(e.match(/"[^"]+"|\S+/g)??[]).map(n=>{const s=n.replace(/^"|"$/g,""),i=s.indexOf(":");if(i>0){const a=s.slice(0,i),o=s.slice(i+1);return{key:a,value:o,raw:s}}return{value:s,raw:s}}),$m=e=>[e.label,e.key,e.sessionId].filter(n=>!!n).map(n=>n.toLowerCase()),Yo=e=>{const t=new Set;e.modelProvider&&t.add(e.modelProvider.toLowerCase()),e.providerOverride&&t.add(e.providerOverride.toLowerCase()),e.origin?.provider&&t.add(e.origin.provider.toLowerCase());for(const n of e.usage?.modelUsage??[])n.provider&&t.add(n.provider.toLowerCase());return Array.from(t)},Jo=e=>{const t=new Set;e.model&&t.add(e.model.toLowerCase());for(const n of e.usage?.modelUsage??[])n.model&&t.add(n.model.toLowerCase());return Array.from(t)},wm=e=>(e.usage?.toolUsage?.tools??[]).map(t=>t.name.toLowerCase()),km=(e,t)=>{const n=Wn(t.value??"");if(!n)return!0;if(!t.key)return $m(e).some(i=>i.includes(n));switch(Wn(t.key)){case"agent":return e.agentId?.toLowerCase().includes(n)??!1;case"channel":return e.channel?.toLowerCase().includes(n)??!1;case"chat":return e.chatType?.toLowerCase().includes(n)??!1;case"provider":return Yo(e).some(i=>i.includes(n));case"model":return Jo(e).some(i=>i.includes(n));case"tool":return wm(e).some(i=>i.includes(n));case"label":return e.label?.toLowerCase().includes(n)??!1;case"key":case"session":case"id":if(n.includes("*")||n.includes("?")){const i=xm(n);return i.test(e.key)||(e.sessionId?i.test(e.sessionId):!1)}return e.key.toLowerCase().includes(n)||(e.sessionId?.toLowerCase().includes(n)??!1);case"has":switch(n){case"tools":return(e.usage?.toolUsage?.totalCalls??0)>0;case"errors":return(e.usage?.messageCounts?.errors??0)>0;case"context":return!!e.contextWeight;case"usage":return!!e.usage;case"model":return Jo(e).length>0;case"provider":return Yo(e).length>0;default:return!0}case"mintokens":{const i=rt(n);return i===null?!0:(e.usage?.totalTokens??0)>=i}case"maxtokens":{const i=rt(n);return i===null?!0:(e.usage?.totalTokens??0)<=i}case"mincost":{const i=rt(n);return i===null?!0:(e.usage?.totalCost??0)>=i}case"maxcost":{const i=rt(n);return i===null?!0:(e.usage?.totalCost??0)<=i}case"minmessages":{const i=rt(n);return i===null?!0:(e.usage?.messageCounts?.total??0)>=i}case"maxmessages":{const i=rt(n);return i===null?!0:(e.usage?.messageCounts?.total??0)<=i}default:return!0}},Sm=(e,t)=>{const n=ra(t);if(n.length===0)return{sessions:e,warnings:[]};const s=[];for(const a of n){if(!a.key)continue;const o=Wn(a.key);if(!ym.has(o)){s.push(`Unknown filter: ${a.key}`);continue}if(a.value===""&&s.push(`Missing value for ${a.key}`),o==="has"){const l=new Set(["tools","errors","context","usage","model","provider"]);a.value&&!l.has(Wn(a.value))&&s.push(`Unknown has:${a.value}`)}["mintokens","maxtokens","mincost","maxcost","minmessages","maxmessages"].includes(o)&&a.value&&rt(a.value)===null&&s.push(`Invalid number for ${a.key}`)}return{sessions:e.filter(a=>n.every(o=>km(a,o))),warnings:s}};function Am(e){const t=e.split(`
4527
+ `}const Pm=new Set(["agent","channel","chat","provider","model","tool","label","key","session","id","has","mintokens","maxtokens","mincost","maxcost","minmessages","maxmessages"]),Gn=e=>e.trim().toLowerCase(),Dm=e=>{const t=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp(`^${t}$`,"i")},lt=e=>{let t=e.trim().toLowerCase();if(!t)return null;t.startsWith("$")&&(t=t.slice(1));let n=1;t.endsWith("k")?(n=1e3,t=t.slice(0,-1)):t.endsWith("m")&&(n=1e6,t=t.slice(0,-1));const s=Number(t);return Number.isFinite(s)?s*n:null},la=e=>(e.match(/"[^"]+"|\S+/g)??[]).map(n=>{const s=n.replace(/^"|"$/g,""),i=s.indexOf(":");if(i>0){const a=s.slice(0,i),o=s.slice(i+1);return{key:a,value:o,raw:s}}return{value:s,raw:s}}),Fm=e=>[e.label,e.key,e.sessionId].filter(n=>!!n).map(n=>n.toLowerCase()),Xo=e=>{const t=new Set;e.modelProvider&&t.add(e.modelProvider.toLowerCase()),e.providerOverride&&t.add(e.providerOverride.toLowerCase()),e.origin?.provider&&t.add(e.origin.provider.toLowerCase());for(const n of e.usage?.modelUsage??[])n.provider&&t.add(n.provider.toLowerCase());return Array.from(t)},er=e=>{const t=new Set;e.model&&t.add(e.model.toLowerCase());for(const n of e.usage?.modelUsage??[])n.model&&t.add(n.model.toLowerCase());return Array.from(t)},Nm=e=>(e.usage?.toolUsage?.tools??[]).map(t=>t.name.toLowerCase()),Om=(e,t)=>{const n=Gn(t.value??"");if(!n)return!0;if(!t.key)return Fm(e).some(i=>i.includes(n));switch(Gn(t.key)){case"agent":return e.agentId?.toLowerCase().includes(n)??!1;case"channel":return e.channel?.toLowerCase().includes(n)??!1;case"chat":return e.chatType?.toLowerCase().includes(n)??!1;case"provider":return Xo(e).some(i=>i.includes(n));case"model":return er(e).some(i=>i.includes(n));case"tool":return Nm(e).some(i=>i.includes(n));case"label":return e.label?.toLowerCase().includes(n)??!1;case"key":case"session":case"id":if(n.includes("*")||n.includes("?")){const i=Dm(n);return i.test(e.key)||(e.sessionId?i.test(e.sessionId):!1)}return e.key.toLowerCase().includes(n)||(e.sessionId?.toLowerCase().includes(n)??!1);case"has":switch(n){case"tools":return(e.usage?.toolUsage?.totalCalls??0)>0;case"errors":return(e.usage?.messageCounts?.errors??0)>0;case"context":return!!e.contextWeight;case"usage":return!!e.usage;case"model":return er(e).length>0;case"provider":return Xo(e).length>0;default:return!0}case"mintokens":{const i=lt(n);return i===null?!0:(e.usage?.totalTokens??0)>=i}case"maxtokens":{const i=lt(n);return i===null?!0:(e.usage?.totalTokens??0)<=i}case"mincost":{const i=lt(n);return i===null?!0:(e.usage?.totalCost??0)>=i}case"maxcost":{const i=lt(n);return i===null?!0:(e.usage?.totalCost??0)<=i}case"minmessages":{const i=lt(n);return i===null?!0:(e.usage?.messageCounts?.total??0)>=i}case"maxmessages":{const i=lt(n);return i===null?!0:(e.usage?.messageCounts?.total??0)<=i}default:return!0}},Bm=(e,t)=>{const n=la(t);if(n.length===0)return{sessions:e,warnings:[]};const s=[];for(const a of n){if(!a.key)continue;const o=Gn(a.key);if(!Pm.has(o)){s.push(`Unknown filter: ${a.key}`);continue}if(a.value===""&&s.push(`Missing value for ${a.key}`),o==="has"){const l=new Set(["tools","errors","context","usage","model","provider"]);a.value&&!l.has(Gn(a.value))&&s.push(`Unknown has:${a.value}`)}["mintokens","maxtokens","mincost","maxcost","minmessages","maxmessages"].includes(o)&&a.value&&lt(a.value)===null&&s.push(`Invalid number for ${a.key}`)}return{sessions:e.filter(a=>n.every(o=>Om(a,o))),warnings:s}};function Um(e){const t=e.split(`
4527
4528
  `),n=new Map,s=[];for(const l of t){const c=/^\[Tool:\s*([^\]]+)\]/.exec(l.trim());if(c){const u=c[1];n.set(u,(n.get(u)??0)+1);continue}l.trim().startsWith("[Tool Result]")||s.push(l)}const i=Array.from(n.entries()).toSorted((l,c)=>c[1]-l[1]),a=i.reduce((l,[,c])=>l+c,0),o=i.length>0?`Tools: ${i.map(([l,c])=>`${l}×${c}`).join(", ")} (${a} calls)`:"";return{tools:i,summary:o,cleanContent:s.join(`
4528
- `).trim()}}const Cm=`
4529
+ `).trim()}}const zm=`
4529
4530
  .usage-page-header {
4530
4531
  margin: 4px 0 12px;
4531
4532
  }
@@ -6435,7 +6436,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
6435
6436
  height: 22px;
6436
6437
  }
6437
6438
  }
6438
- `,Tm=4;function at(e){return Math.round(e/Tm)}function O(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function _m(e){const t=new Date;return t.setHours(e,0,0,0),t.toLocaleTimeString(void 0,{hour:"numeric"})}function Em(e,t){const n=Array.from({length:24},()=>0),s=Array.from({length:24},()=>0);for(const i of e){const a=i.usage;if(!a?.messageCounts||a.messageCounts.total===0)continue;const o=a.firstActivity??i.updatedAt,l=a.lastActivity??i.updatedAt;if(!o||!l)continue;const c=Math.min(o,l),u=Math.max(o,l),p=Math.max(u-c,1)/6e4;let h=c;for(;h<u;){const d=new Date(h),f=la(d,t),m=ca(d,t),S=Math.min(m.getTime(),u),$=Math.max((S-h)/6e4,0)/p;n[f]+=a.messageCounts.errors*$,s[f]+=a.messageCounts.total*$,h=S+1}}return s.map((i,a)=>{const o=n[a],l=i>0?o/i:0;return{hour:a,rate:l,errors:o,msgs:i}}).filter(i=>i.msgs>0&&i.errors>0).toSorted((i,a)=>a.rate-i.rate).slice(0,5).map(i=>({label:_m(i.hour),value:`${(i.rate*100).toFixed(2)}%`,sub:`${Math.round(i.errors)} errors · ${Math.round(i.msgs)} msgs`}))}const Lm=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function la(e,t){return t==="utc"?e.getUTCHours():e.getHours()}function Mm(e,t){return t==="utc"?e.getUTCDay():e.getDay()}function ca(e,t){const n=new Date(e);return t==="utc"?n.setUTCMinutes(59,59,999):n.setMinutes(59,59,999),n}function Im(e,t){const n=Array.from({length:24},()=>0),s=Array.from({length:7},()=>0);let i=0,a=!1;for(const l of e){const c=l.usage;if(!c||!c.totalTokens||c.totalTokens<=0)continue;i+=c.totalTokens;const u=c.firstActivity??l.updatedAt,g=c.lastActivity??l.updatedAt;if(!u||!g)continue;a=!0;const p=Math.min(u,g),h=Math.max(u,g),f=Math.max(h-p,1)/6e4;let m=p;for(;m<h;){const S=new Date(m),k=la(S,t),$=Mm(S,t),A=ca(S,t),C=Math.min(A.getTime(),h),T=Math.max((C-m)/6e4,0)/f;n[k]+=c.totalTokens*T,s[$]+=c.totalTokens*T,m=C+1}}const o=Lm.map((l,c)=>({label:l,tokens:s[c]}));return{hasData:a,totalTokens:i,hourTotals:n,weekdayTotals:o}}function Rm(e,t,n,s){const i=Im(e,t);if(!i.hasData)return r`
6439
+ `,Hm=4;function ot(e){return Math.round(e/Hm)}function O(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function jm(e){const t=new Date;return t.setHours(e,0,0,0),t.toLocaleTimeString(void 0,{hour:"numeric"})}function Km(e,t){const n=Array.from({length:24},()=>0),s=Array.from({length:24},()=>0);for(const i of e){const a=i.usage;if(!a?.messageCounts||a.messageCounts.total===0)continue;const o=a.firstActivity??i.updatedAt,l=a.lastActivity??i.updatedAt;if(!o||!l)continue;const c=Math.min(o,l),u=Math.max(o,l),p=Math.max(u-c,1)/6e4;let h=c;for(;h<u;){const d=new Date(h),f=ca(d,t),m=da(d,t),S=Math.min(m.getTime(),u),$=Math.max((S-h)/6e4,0)/p;n[f]+=a.messageCounts.errors*$,s[f]+=a.messageCounts.total*$,h=S+1}}return s.map((i,a)=>{const o=n[a],l=i>0?o/i:0;return{hour:a,rate:l,errors:o,msgs:i}}).filter(i=>i.msgs>0&&i.errors>0).toSorted((i,a)=>a.rate-i.rate).slice(0,5).map(i=>({label:jm(i.hour),value:`${(i.rate*100).toFixed(2)}%`,sub:`${Math.round(i.errors)} errors · ${Math.round(i.msgs)} msgs`}))}const Wm=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function ca(e,t){return t==="utc"?e.getUTCHours():e.getHours()}function qm(e,t){return t==="utc"?e.getUTCDay():e.getDay()}function da(e,t){const n=new Date(e);return t==="utc"?n.setUTCMinutes(59,59,999):n.setMinutes(59,59,999),n}function Gm(e,t){const n=Array.from({length:24},()=>0),s=Array.from({length:7},()=>0);let i=0,a=!1;for(const l of e){const c=l.usage;if(!c||!c.totalTokens||c.totalTokens<=0)continue;i+=c.totalTokens;const u=c.firstActivity??l.updatedAt,g=c.lastActivity??l.updatedAt;if(!u||!g)continue;a=!0;const p=Math.min(u,g),h=Math.max(u,g),f=Math.max(h-p,1)/6e4;let m=p;for(;m<h;){const S=new Date(m),k=ca(S,t),$=qm(S,t),A=da(S,t),C=Math.min(A.getTime(),h),T=Math.max((C-m)/6e4,0)/f;n[k]+=c.totalTokens*T,s[$]+=c.totalTokens*T,m=C+1}}const o=Wm.map((l,c)=>({label:l,tokens:s[c]}));return{hasData:a,totalTokens:i,hourTotals:n,weekdayTotals:o}}function Vm(e,t,n,s){const i=Gm(e,t);if(!i.hasData)return r`
6439
6440
  <div class="card usage-mosaic">
6440
6441
  <div class="usage-mosaic-header">
6441
6442
  <div>
@@ -6499,10 +6500,10 @@ ${JSON.stringify(e.issues,null,2)}</pre
6499
6500
  </div>
6500
6501
  </div>
6501
6502
  </div>
6502
- `}function q(e,t=2){return`$${e.toFixed(t)}`}function Hs(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function Ul(e){const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;const[,n,s,i]=t,a=new Date(Date.UTC(Number(n),Number(s)-1,Number(i)));return Number.isNaN(a.valueOf())?null:a}function zl(e){const t=Ul(e);return t?t.toLocaleDateString(void 0,{month:"short",day:"numeric"}):e}function Pm(e){const t=Ul(e);return t?t.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"}):e}function js(e,t,n="text/plain"){const s=new Blob([t],{type:n}),i=URL.createObjectURL(s),a=document.createElement("a");a.href=i,a.download=e,a.click(),URL.revokeObjectURL(i)}function Dm(e){return e.includes('"')||e.includes(",")||e.includes(`
6503
- `)?`"${e.replace(/"/g,'""')}"`:e}function qn(e){return e.map(t=>t==null?"":Dm(String(t))).join(",")}const _n=()=>({input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,totalCost:0,inputCost:0,outputCost:0,cacheReadCost:0,cacheWriteCost:0,missingCostEntries:0}),En=(e,t)=>{e.input+=t.input??0,e.output+=t.output??0,e.cacheRead+=t.cacheRead??0,e.cacheWrite+=t.cacheWrite??0,e.totalTokens+=t.totalTokens??0,e.totalCost+=t.totalCost??0,e.inputCost+=t.inputCost??0,e.outputCost+=t.outputCost??0,e.cacheReadCost+=t.cacheReadCost??0,e.cacheWriteCost+=t.cacheWriteCost??0,e.missingCostEntries+=t.missingCostEntries??0},Fm=(e,t)=>{if(e.length===0)return t??{messages:{total:0,user:0,assistant:0,toolCalls:0,toolResults:0,errors:0},tools:{totalCalls:0,uniqueTools:0,tools:[]},byModel:[],byProvider:[],byAgent:[],byChannel:[],daily:[]};const n={total:0,user:0,assistant:0,toolCalls:0,toolResults:0,errors:0},s=new Map,i=new Map,a=new Map,o=new Map,l=new Map,c=new Map,u=new Map,g=new Map,p={count:0,sum:0,min:Number.POSITIVE_INFINITY,max:0,p95Max:0};for(const h of e){const d=h.usage;if(d){if(d.messageCounts&&(n.total+=d.messageCounts.total,n.user+=d.messageCounts.user,n.assistant+=d.messageCounts.assistant,n.toolCalls+=d.messageCounts.toolCalls,n.toolResults+=d.messageCounts.toolResults,n.errors+=d.messageCounts.errors),d.toolUsage)for(const f of d.toolUsage.tools)s.set(f.name,(s.get(f.name)??0)+f.count);if(d.modelUsage)for(const f of d.modelUsage){const m=`${f.provider??"unknown"}::${f.model??"unknown"}`,S=i.get(m)??{provider:f.provider,model:f.model,count:0,totals:_n()};S.count+=f.count,En(S.totals,f.totals),i.set(m,S);const k=f.provider??"unknown",$=a.get(k)??{provider:f.provider,model:void 0,count:0,totals:_n()};$.count+=f.count,En($.totals,f.totals),a.set(k,$)}if(d.latency){const{count:f,avgMs:m,minMs:S,maxMs:k,p95Ms:$}=d.latency;f>0&&(p.count+=f,p.sum+=m*f,p.min=Math.min(p.min,S),p.max=Math.max(p.max,k),p.p95Max=Math.max(p.p95Max,$))}if(h.agentId){const f=o.get(h.agentId)??_n();En(f,d),o.set(h.agentId,f)}if(h.channel){const f=l.get(h.channel)??_n();En(f,d),l.set(h.channel,f)}for(const f of d.dailyBreakdown??[]){const m=c.get(f.date)??{date:f.date,tokens:0,cost:0,messages:0,toolCalls:0,errors:0};m.tokens+=f.tokens,m.cost+=f.cost,c.set(f.date,m)}for(const f of d.dailyMessageCounts??[]){const m=c.get(f.date)??{date:f.date,tokens:0,cost:0,messages:0,toolCalls:0,errors:0};m.messages+=f.total,m.toolCalls+=f.toolCalls,m.errors+=f.errors,c.set(f.date,m)}for(const f of d.dailyLatency??[]){const m=u.get(f.date)??{date:f.date,count:0,sum:0,min:Number.POSITIVE_INFINITY,max:0,p95Max:0};m.count+=f.count,m.sum+=f.avgMs*f.count,m.min=Math.min(m.min,f.minMs),m.max=Math.max(m.max,f.maxMs),m.p95Max=Math.max(m.p95Max,f.p95Ms),u.set(f.date,m)}for(const f of d.dailyModelUsage??[]){const m=`${f.date}::${f.provider??"unknown"}::${f.model??"unknown"}`,S=g.get(m)??{date:f.date,provider:f.provider,model:f.model,tokens:0,cost:0,count:0};S.tokens+=f.tokens,S.cost+=f.cost,S.count+=f.count,g.set(m,S)}}}return{messages:n,tools:{totalCalls:Array.from(s.values()).reduce((h,d)=>h+d,0),uniqueTools:s.size,tools:Array.from(s.entries()).map(([h,d])=>({name:h,count:d})).toSorted((h,d)=>d.count-h.count)},byModel:Array.from(i.values()).toSorted((h,d)=>d.totals.totalCost-h.totals.totalCost),byProvider:Array.from(a.values()).toSorted((h,d)=>d.totals.totalCost-h.totals.totalCost),byAgent:Array.from(o.entries()).map(([h,d])=>({agentId:h,totals:d})).toSorted((h,d)=>d.totals.totalCost-h.totals.totalCost),byChannel:Array.from(l.entries()).map(([h,d])=>({channel:h,totals:d})).toSorted((h,d)=>d.totals.totalCost-h.totals.totalCost),latency:p.count>0?{count:p.count,avgMs:p.sum/p.count,minMs:p.min===Number.POSITIVE_INFINITY?0:p.min,maxMs:p.max,p95Ms:p.p95Max}:void 0,dailyLatency:Array.from(u.values()).map(h=>({date:h.date,count:h.count,avgMs:h.count?h.sum/h.count:0,minMs:h.min===Number.POSITIVE_INFINITY?0:h.min,maxMs:h.max,p95Ms:h.p95Max})).toSorted((h,d)=>h.date.localeCompare(d.date)),modelDaily:Array.from(g.values()).toSorted((h,d)=>h.date.localeCompare(d.date)||d.cost-h.cost),daily:Array.from(c.values()).toSorted((h,d)=>h.date.localeCompare(d.date))}},Nm=(e,t,n)=>{let s=0,i=0;for(const g of e){const p=g.usage?.durationMs??0;p>0&&(s+=p,i+=1)}const a=i?s/i:0,o=t&&s>0?t.totalTokens/(s/6e4):void 0,l=t&&s>0?t.totalCost/(s/6e4):void 0,c=n.messages.total?n.messages.errors/n.messages.total:0,u=n.daily.filter(g=>g.messages>0&&g.errors>0).map(g=>({date:g.date,errors:g.errors,messages:g.messages,rate:g.errors/g.messages})).toSorted((g,p)=>p.rate-g.rate||p.errors-g.errors)[0];return{durationSumMs:s,durationCount:i,avgDurationMs:a,throughputTokensPerMin:o,throughputCostPerMin:l,errorRate:c,peakErrorDay:u}},Om=e=>{const t=[qn(["key","label","agentId","channel","provider","model","updatedAt","durationMs","messages","errors","toolCalls","inputTokens","outputTokens","cacheReadTokens","cacheWriteTokens","totalTokens","totalCost"])];for(const n of e){const s=n.usage;t.push(qn([n.key,n.label??"",n.agentId??"",n.channel??"",n.modelProvider??n.providerOverride??"",n.model??n.modelOverride??"",n.updatedAt?new Date(n.updatedAt).toISOString():"",s?.durationMs??"",s?.messageCounts?.total??"",s?.messageCounts?.errors??"",s?.messageCounts?.toolCalls??"",s?.input??"",s?.output??"",s?.cacheRead??"",s?.cacheWrite??"",s?.totalTokens??"",s?.totalCost??""]))}return t.join(`
6504
- `)},Bm=e=>{const t=[qn(["date","inputTokens","outputTokens","cacheReadTokens","cacheWriteTokens","totalTokens","inputCost","outputCost","cacheReadCost","cacheWriteCost","totalCost"])];for(const n of e)t.push(qn([n.date,n.input,n.output,n.cacheRead,n.cacheWrite,n.totalTokens,n.inputCost??"",n.outputCost??"",n.cacheReadCost??"",n.cacheWriteCost??"",n.totalCost]));return t.join(`
6505
- `)},Um=(e,t,n)=>{const s=e.trim();if(!s)return[];const i=s.length?s.split(/\s+/):[],a=i.length?i[i.length-1]:"",[o,l]=a.includes(":")?[a.slice(0,a.indexOf(":")),a.slice(a.indexOf(":")+1)]:["",""],c=o.toLowerCase(),u=l.toLowerCase(),g=$=>{const A=new Set;for(const C of $)C&&A.add(C);return Array.from(A)},p=g(t.map($=>$.agentId)).slice(0,6),h=g(t.map($=>$.channel)).slice(0,6),d=g([...t.map($=>$.modelProvider),...t.map($=>$.providerOverride),...n?.byProvider.map($=>$.provider)??[]]).slice(0,6),f=g([...t.map($=>$.model),...n?.byModel.map($=>$.model)??[]]).slice(0,6),m=g(n?.tools.tools.map($=>$.name)??[]).slice(0,6);if(!c)return[{label:"agent:",value:"agent:"},{label:"channel:",value:"channel:"},{label:"provider:",value:"provider:"},{label:"model:",value:"model:"},{label:"tool:",value:"tool:"},{label:"has:errors",value:"has:errors"},{label:"has:tools",value:"has:tools"},{label:"minTokens:",value:"minTokens:"},{label:"maxCost:",value:"maxCost:"}];const S=[],k=($,A)=>{for(const C of A)(!u||C.toLowerCase().includes(u))&&S.push({label:`${$}:${C}`,value:`${$}:${C}`})};switch(c){case"agent":k("agent",p);break;case"channel":k("channel",h);break;case"provider":k("provider",d);break;case"model":k("model",f);break;case"tool":k("tool",m);break;case"has":["errors","tools","context","usage","model","provider"].forEach($=>{(!u||$.includes(u))&&S.push({label:`has:${$}`,value:`has:${$}`})});break}return S},zm=(e,t)=>{const n=e.trim();if(!n)return`${t} `;const s=n.split(/\s+/);return s[s.length-1]=t,`${s.join(" ")} `},lt=e=>e.trim().toLowerCase(),Hm=(e,t)=>{const n=e.trim();if(!n)return`${t} `;const s=n.split(/\s+/),i=s[s.length-1]??"",a=t.includes(":")?t.split(":")[0]:null,o=i.includes(":")?i.split(":")[0]:null;return i.endsWith(":")&&a&&o===a?(s[s.length-1]=t,`${s.join(" ")} `):s.includes(t)?`${s.join(" ")} `:`${s.join(" ")} ${t} `},Zo=(e,t)=>{const s=e.trim().split(/\s+/).filter(Boolean).filter(i=>i!==t);return s.length?`${s.join(" ")} `:""},Xo=(e,t,n)=>{const s=lt(t),a=[...ra(e).filter(o=>lt(o.key??"")!==s).map(o=>o.raw),...n.map(o=>`${t}:${o}`)];return a.length?`${a.join(" ")} `:""};function ge(e,t){return t===0?0:e/t*100}function jm(e){const t=e.totalCost||0;return{input:{tokens:e.input,cost:e.inputCost||0,pct:ge(e.inputCost||0,t)},output:{tokens:e.output,cost:e.outputCost||0,pct:ge(e.outputCost||0,t)},cacheRead:{tokens:e.cacheRead,cost:e.cacheReadCost||0,pct:ge(e.cacheReadCost||0,t)},cacheWrite:{tokens:e.cacheWrite,cost:e.cacheWriteCost||0,pct:ge(e.cacheWriteCost||0,t)},totalCost:t}}function Km(e,t,n,s,i,a,o,l){if(!(e.length>0||t.length>0||n.length>0))return v;const u=n.length===1?s.find(f=>f.key===n[0]):null,g=u?(u.label||u.key).slice(0,20)+((u.label||u.key).length>20?"…":""):n.length===1?n[0].slice(0,8)+"…":`${n.length} sessions`,p=u?u.label||u.key:n.length===1?n[0]:n.join(", "),h=e.length===1?e[0]:`${e.length} days`,d=t.length===1?`${t[0]}:00`:`${t.length} hours`;return r`
6503
+ `}function G(e,t=2){return`$${e.toFixed(t)}`}function js(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function Vl(e){const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;const[,n,s,i]=t,a=new Date(Date.UTC(Number(n),Number(s)-1,Number(i)));return Number.isNaN(a.valueOf())?null:a}function Ql(e){const t=Vl(e);return t?t.toLocaleDateString(void 0,{month:"short",day:"numeric"}):e}function Qm(e){const t=Vl(e);return t?t.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"}):e}function Ks(e,t,n="text/plain"){const s=new Blob([t],{type:n}),i=URL.createObjectURL(s),a=document.createElement("a");a.href=i,a.download=e,a.click(),URL.revokeObjectURL(i)}function Ym(e){return e.includes('"')||e.includes(",")||e.includes(`
6504
+ `)?`"${e.replace(/"/g,'""')}"`:e}function Vn(e){return e.map(t=>t==null?"":Ym(String(t))).join(",")}const Ln=()=>({input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,totalCost:0,inputCost:0,outputCost:0,cacheReadCost:0,cacheWriteCost:0,missingCostEntries:0}),Mn=(e,t)=>{e.input+=t.input??0,e.output+=t.output??0,e.cacheRead+=t.cacheRead??0,e.cacheWrite+=t.cacheWrite??0,e.totalTokens+=t.totalTokens??0,e.totalCost+=t.totalCost??0,e.inputCost+=t.inputCost??0,e.outputCost+=t.outputCost??0,e.cacheReadCost+=t.cacheReadCost??0,e.cacheWriteCost+=t.cacheWriteCost??0,e.missingCostEntries+=t.missingCostEntries??0},Jm=(e,t)=>{if(e.length===0)return t??{messages:{total:0,user:0,assistant:0,toolCalls:0,toolResults:0,errors:0},tools:{totalCalls:0,uniqueTools:0,tools:[]},byModel:[],byProvider:[],byAgent:[],byChannel:[],daily:[]};const n={total:0,user:0,assistant:0,toolCalls:0,toolResults:0,errors:0},s=new Map,i=new Map,a=new Map,o=new Map,l=new Map,c=new Map,u=new Map,g=new Map,p={count:0,sum:0,min:Number.POSITIVE_INFINITY,max:0,p95Max:0};for(const h of e){const d=h.usage;if(d){if(d.messageCounts&&(n.total+=d.messageCounts.total,n.user+=d.messageCounts.user,n.assistant+=d.messageCounts.assistant,n.toolCalls+=d.messageCounts.toolCalls,n.toolResults+=d.messageCounts.toolResults,n.errors+=d.messageCounts.errors),d.toolUsage)for(const f of d.toolUsage.tools)s.set(f.name,(s.get(f.name)??0)+f.count);if(d.modelUsage)for(const f of d.modelUsage){const m=`${f.provider??"unknown"}::${f.model??"unknown"}`,S=i.get(m)??{provider:f.provider,model:f.model,count:0,totals:Ln()};S.count+=f.count,Mn(S.totals,f.totals),i.set(m,S);const k=f.provider??"unknown",$=a.get(k)??{provider:f.provider,model:void 0,count:0,totals:Ln()};$.count+=f.count,Mn($.totals,f.totals),a.set(k,$)}if(d.latency){const{count:f,avgMs:m,minMs:S,maxMs:k,p95Ms:$}=d.latency;f>0&&(p.count+=f,p.sum+=m*f,p.min=Math.min(p.min,S),p.max=Math.max(p.max,k),p.p95Max=Math.max(p.p95Max,$))}if(h.agentId){const f=o.get(h.agentId)??Ln();Mn(f,d),o.set(h.agentId,f)}if(h.channel){const f=l.get(h.channel)??Ln();Mn(f,d),l.set(h.channel,f)}for(const f of d.dailyBreakdown??[]){const m=c.get(f.date)??{date:f.date,tokens:0,cost:0,messages:0,toolCalls:0,errors:0};m.tokens+=f.tokens,m.cost+=f.cost,c.set(f.date,m)}for(const f of d.dailyMessageCounts??[]){const m=c.get(f.date)??{date:f.date,tokens:0,cost:0,messages:0,toolCalls:0,errors:0};m.messages+=f.total,m.toolCalls+=f.toolCalls,m.errors+=f.errors,c.set(f.date,m)}for(const f of d.dailyLatency??[]){const m=u.get(f.date)??{date:f.date,count:0,sum:0,min:Number.POSITIVE_INFINITY,max:0,p95Max:0};m.count+=f.count,m.sum+=f.avgMs*f.count,m.min=Math.min(m.min,f.minMs),m.max=Math.max(m.max,f.maxMs),m.p95Max=Math.max(m.p95Max,f.p95Ms),u.set(f.date,m)}for(const f of d.dailyModelUsage??[]){const m=`${f.date}::${f.provider??"unknown"}::${f.model??"unknown"}`,S=g.get(m)??{date:f.date,provider:f.provider,model:f.model,tokens:0,cost:0,count:0};S.tokens+=f.tokens,S.cost+=f.cost,S.count+=f.count,g.set(m,S)}}}return{messages:n,tools:{totalCalls:Array.from(s.values()).reduce((h,d)=>h+d,0),uniqueTools:s.size,tools:Array.from(s.entries()).map(([h,d])=>({name:h,count:d})).toSorted((h,d)=>d.count-h.count)},byModel:Array.from(i.values()).toSorted((h,d)=>d.totals.totalCost-h.totals.totalCost),byProvider:Array.from(a.values()).toSorted((h,d)=>d.totals.totalCost-h.totals.totalCost),byAgent:Array.from(o.entries()).map(([h,d])=>({agentId:h,totals:d})).toSorted((h,d)=>d.totals.totalCost-h.totals.totalCost),byChannel:Array.from(l.entries()).map(([h,d])=>({channel:h,totals:d})).toSorted((h,d)=>d.totals.totalCost-h.totals.totalCost),latency:p.count>0?{count:p.count,avgMs:p.sum/p.count,minMs:p.min===Number.POSITIVE_INFINITY?0:p.min,maxMs:p.max,p95Ms:p.p95Max}:void 0,dailyLatency:Array.from(u.values()).map(h=>({date:h.date,count:h.count,avgMs:h.count?h.sum/h.count:0,minMs:h.min===Number.POSITIVE_INFINITY?0:h.min,maxMs:h.max,p95Ms:h.p95Max})).toSorted((h,d)=>h.date.localeCompare(d.date)),modelDaily:Array.from(g.values()).toSorted((h,d)=>h.date.localeCompare(d.date)||d.cost-h.cost),daily:Array.from(c.values()).toSorted((h,d)=>h.date.localeCompare(d.date))}},Zm=(e,t,n)=>{let s=0,i=0;for(const g of e){const p=g.usage?.durationMs??0;p>0&&(s+=p,i+=1)}const a=i?s/i:0,o=t&&s>0?t.totalTokens/(s/6e4):void 0,l=t&&s>0?t.totalCost/(s/6e4):void 0,c=n.messages.total?n.messages.errors/n.messages.total:0,u=n.daily.filter(g=>g.messages>0&&g.errors>0).map(g=>({date:g.date,errors:g.errors,messages:g.messages,rate:g.errors/g.messages})).toSorted((g,p)=>p.rate-g.rate||p.errors-g.errors)[0];return{durationSumMs:s,durationCount:i,avgDurationMs:a,throughputTokensPerMin:o,throughputCostPerMin:l,errorRate:c,peakErrorDay:u}},Xm=e=>{const t=[Vn(["key","label","agentId","channel","provider","model","updatedAt","durationMs","messages","errors","toolCalls","inputTokens","outputTokens","cacheReadTokens","cacheWriteTokens","totalTokens","totalCost"])];for(const n of e){const s=n.usage;t.push(Vn([n.key,n.label??"",n.agentId??"",n.channel??"",n.modelProvider??n.providerOverride??"",n.model??n.modelOverride??"",n.updatedAt?new Date(n.updatedAt).toISOString():"",s?.durationMs??"",s?.messageCounts?.total??"",s?.messageCounts?.errors??"",s?.messageCounts?.toolCalls??"",s?.input??"",s?.output??"",s?.cacheRead??"",s?.cacheWrite??"",s?.totalTokens??"",s?.totalCost??""]))}return t.join(`
6505
+ `)},eb=e=>{const t=[Vn(["date","inputTokens","outputTokens","cacheReadTokens","cacheWriteTokens","totalTokens","inputCost","outputCost","cacheReadCost","cacheWriteCost","totalCost"])];for(const n of e)t.push(Vn([n.date,n.input,n.output,n.cacheRead,n.cacheWrite,n.totalTokens,n.inputCost??"",n.outputCost??"",n.cacheReadCost??"",n.cacheWriteCost??"",n.totalCost]));return t.join(`
6506
+ `)},tb=(e,t,n)=>{const s=e.trim();if(!s)return[];const i=s.length?s.split(/\s+/):[],a=i.length?i[i.length-1]:"",[o,l]=a.includes(":")?[a.slice(0,a.indexOf(":")),a.slice(a.indexOf(":")+1)]:["",""],c=o.toLowerCase(),u=l.toLowerCase(),g=$=>{const A=new Set;for(const C of $)C&&A.add(C);return Array.from(A)},p=g(t.map($=>$.agentId)).slice(0,6),h=g(t.map($=>$.channel)).slice(0,6),d=g([...t.map($=>$.modelProvider),...t.map($=>$.providerOverride),...n?.byProvider.map($=>$.provider)??[]]).slice(0,6),f=g([...t.map($=>$.model),...n?.byModel.map($=>$.model)??[]]).slice(0,6),m=g(n?.tools.tools.map($=>$.name)??[]).slice(0,6);if(!c)return[{label:"agent:",value:"agent:"},{label:"channel:",value:"channel:"},{label:"provider:",value:"provider:"},{label:"model:",value:"model:"},{label:"tool:",value:"tool:"},{label:"has:errors",value:"has:errors"},{label:"has:tools",value:"has:tools"},{label:"minTokens:",value:"minTokens:"},{label:"maxCost:",value:"maxCost:"}];const S=[],k=($,A)=>{for(const C of A)(!u||C.toLowerCase().includes(u))&&S.push({label:`${$}:${C}`,value:`${$}:${C}`})};switch(c){case"agent":k("agent",p);break;case"channel":k("channel",h);break;case"provider":k("provider",d);break;case"model":k("model",f);break;case"tool":k("tool",m);break;case"has":["errors","tools","context","usage","model","provider"].forEach($=>{(!u||$.includes(u))&&S.push({label:`has:${$}`,value:`has:${$}`})});break}return S},nb=(e,t)=>{const n=e.trim();if(!n)return`${t} `;const s=n.split(/\s+/);return s[s.length-1]=t,`${s.join(" ")} `},dt=e=>e.trim().toLowerCase(),sb=(e,t)=>{const n=e.trim();if(!n)return`${t} `;const s=n.split(/\s+/),i=s[s.length-1]??"",a=t.includes(":")?t.split(":")[0]:null,o=i.includes(":")?i.split(":")[0]:null;return i.endsWith(":")&&a&&o===a?(s[s.length-1]=t,`${s.join(" ")} `):s.includes(t)?`${s.join(" ")} `:`${s.join(" ")} ${t} `},tr=(e,t)=>{const s=e.trim().split(/\s+/).filter(Boolean).filter(i=>i!==t);return s.length?`${s.join(" ")} `:""},nr=(e,t,n)=>{const s=dt(t),a=[...la(e).filter(o=>dt(o.key??"")!==s).map(o=>o.raw),...n.map(o=>`${t}:${o}`)];return a.length?`${a.join(" ")} `:""};function ge(e,t){return t===0?0:e/t*100}function ib(e){const t=e.totalCost||0;return{input:{tokens:e.input,cost:e.inputCost||0,pct:ge(e.inputCost||0,t)},output:{tokens:e.output,cost:e.outputCost||0,pct:ge(e.outputCost||0,t)},cacheRead:{tokens:e.cacheRead,cost:e.cacheReadCost||0,pct:ge(e.cacheReadCost||0,t)},cacheWrite:{tokens:e.cacheWrite,cost:e.cacheWriteCost||0,pct:ge(e.cacheWriteCost||0,t)},totalCost:t}}function ab(e,t,n,s,i,a,o,l){if(!(e.length>0||t.length>0||n.length>0))return v;const u=n.length===1?s.find(f=>f.key===n[0]):null,g=u?(u.label||u.key).slice(0,20)+((u.label||u.key).length>20?"…":""):n.length===1?n[0].slice(0,8)+"…":`${n.length} sessions`,p=u?u.label||u.key:n.length===1?n[0]:n.join(", "),h=e.length===1?e[0]:`${e.length} days`,d=t.length===1?`${t[0]}:00`:`${t.length} hours`;return r`
6506
6507
  <div class="active-filters">
6507
6508
  ${e.length>0?r`
6508
6509
  <div class="filter-chip">
@@ -6528,7 +6529,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
6528
6529
  </button>
6529
6530
  `:v}
6530
6531
  </div>
6531
- `}function Wm(e,t,n,s,i,a){if(!e.length)return r`
6532
+ `}function ob(e,t,n,s,i,a){if(!e.length)return r`
6532
6533
  <div class="daily-chart-compact">
6533
6534
  <div class="sessions-panel-title">Daily Usage</div>
6534
6535
  <div class="muted" style="padding: 20px; text-align: center">No data</div>
@@ -6554,7 +6555,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
6554
6555
  </div>
6555
6556
  <div class="daily-chart">
6556
6557
  <div class="daily-chart-bars" style="--bar-max-width: ${u}px">
6557
- ${e.map((p,h)=>{const f=l[h]/c*100,m=t.includes(p.date),S=zl(p.date),k=e.length>20?String(parseInt(p.date.slice(8),10)):S,$=e.length>20?"font-size: 8px":"",A=s==="by-type"?o?[{value:p.output,class:"output"},{value:p.input,class:"input"},{value:p.cacheWrite,class:"cache-write"},{value:p.cacheRead,class:"cache-read"}]:[{value:p.outputCost??0,class:"output"},{value:p.inputCost??0,class:"input"},{value:p.cacheWriteCost??0,class:"cache-write"},{value:p.cacheReadCost??0,class:"cache-read"}]:[],C=s==="by-type"?o?[`Output ${O(p.output)}`,`Input ${O(p.input)}`,`Cache write ${O(p.cacheWrite)}`,`Cache read ${O(p.cacheRead)}`]:[`Output ${q(p.outputCost??0)}`,`Input ${q(p.inputCost??0)}`,`Cache write ${q(p.cacheWriteCost??0)}`,`Cache read ${q(p.cacheReadCost??0)}`]:[],_=o?O(p.totalTokens):q(p.totalCost);return r`
6558
+ ${e.map((p,h)=>{const f=l[h]/c*100,m=t.includes(p.date),S=Ql(p.date),k=e.length>20?String(parseInt(p.date.slice(8),10)):S,$=e.length>20?"font-size: 8px":"",A=s==="by-type"?o?[{value:p.output,class:"output"},{value:p.input,class:"input"},{value:p.cacheWrite,class:"cache-write"},{value:p.cacheRead,class:"cache-read"}]:[{value:p.outputCost??0,class:"output"},{value:p.inputCost??0,class:"input"},{value:p.cacheWriteCost??0,class:"cache-write"},{value:p.cacheReadCost??0,class:"cache-read"}]:[],C=s==="by-type"?o?[`Output ${O(p.output)}`,`Input ${O(p.input)}`,`Cache write ${O(p.cacheWrite)}`,`Cache read ${O(p.cacheRead)}`]:[`Output ${G(p.outputCost??0)}`,`Input ${G(p.inputCost??0)}`,`Cache write ${G(p.cacheWriteCost??0)}`,`Cache read ${G(p.cacheReadCost??0)}`]:[],_=o?O(p.totalTokens):G(p.totalCost);return r`
6558
6559
  <div
6559
6560
  class="daily-bar-wrapper ${m?"selected":""}"
6560
6561
  @click=${T=>a(p.date,T.shiftKey)}
@@ -6577,9 +6578,9 @@ ${JSON.stringify(e.issues,null,2)}</pre
6577
6578
  ${g?r`<div class="daily-bar-total">${_}</div>`:v}
6578
6579
  <div class="daily-bar-label" style="${$}">${k}</div>
6579
6580
  <div class="daily-bar-tooltip">
6580
- <strong>${Pm(p.date)}</strong><br />
6581
+ <strong>${Qm(p.date)}</strong><br />
6581
6582
  ${O(p.totalTokens)} tokens<br />
6582
- ${q(p.totalCost)}
6583
+ ${G(p.totalCost)}
6583
6584
  ${C.length?r`${C.map(T=>r`<div>${T}</div>`)}`:v}
6584
6585
  </div>
6585
6586
  </div>
@@ -6587,30 +6588,30 @@ ${JSON.stringify(e.issues,null,2)}</pre
6587
6588
  </div>
6588
6589
  </div>
6589
6590
  </div>
6590
- `}function qm(e,t){const n=jm(e),s=t==="tokens",i=e.totalTokens||1,a={output:ge(e.output,i),input:ge(e.input,i),cacheWrite:ge(e.cacheWrite,i),cacheRead:ge(e.cacheRead,i)};return r`
6591
+ `}function rb(e,t){const n=ib(e),s=t==="tokens",i=e.totalTokens||1,a={output:ge(e.output,i),input:ge(e.input,i),cacheWrite:ge(e.cacheWrite,i),cacheRead:ge(e.cacheRead,i)};return r`
6591
6592
  <div class="cost-breakdown cost-breakdown-compact">
6592
6593
  <div class="cost-breakdown-header">${s?"Tokens":"Cost"} by Type</div>
6593
6594
  <div class="cost-breakdown-bar">
6594
6595
  <div class="cost-segment output" style="width: ${(s?a.output:n.output.pct).toFixed(1)}%"
6595
- title="Output: ${s?O(e.output):q(n.output.cost)}"></div>
6596
+ title="Output: ${s?O(e.output):G(n.output.cost)}"></div>
6596
6597
  <div class="cost-segment input" style="width: ${(s?a.input:n.input.pct).toFixed(1)}%"
6597
- title="Input: ${s?O(e.input):q(n.input.cost)}"></div>
6598
+ title="Input: ${s?O(e.input):G(n.input.cost)}"></div>
6598
6599
  <div class="cost-segment cache-write" style="width: ${(s?a.cacheWrite:n.cacheWrite.pct).toFixed(1)}%"
6599
- title="Cache Write: ${s?O(e.cacheWrite):q(n.cacheWrite.cost)}"></div>
6600
+ title="Cache Write: ${s?O(e.cacheWrite):G(n.cacheWrite.cost)}"></div>
6600
6601
  <div class="cost-segment cache-read" style="width: ${(s?a.cacheRead:n.cacheRead.pct).toFixed(1)}%"
6601
- title="Cache Read: ${s?O(e.cacheRead):q(n.cacheRead.cost)}"></div>
6602
+ title="Cache Read: ${s?O(e.cacheRead):G(n.cacheRead.cost)}"></div>
6602
6603
  </div>
6603
6604
  <div class="cost-breakdown-legend">
6604
- <span class="legend-item"><span class="legend-dot output"></span>Output ${s?O(e.output):q(n.output.cost)}</span>
6605
- <span class="legend-item"><span class="legend-dot input"></span>Input ${s?O(e.input):q(n.input.cost)}</span>
6606
- <span class="legend-item"><span class="legend-dot cache-write"></span>Cache Write ${s?O(e.cacheWrite):q(n.cacheWrite.cost)}</span>
6607
- <span class="legend-item"><span class="legend-dot cache-read"></span>Cache Read ${s?O(e.cacheRead):q(n.cacheRead.cost)}</span>
6605
+ <span class="legend-item"><span class="legend-dot output"></span>Output ${s?O(e.output):G(n.output.cost)}</span>
6606
+ <span class="legend-item"><span class="legend-dot input"></span>Input ${s?O(e.input):G(n.input.cost)}</span>
6607
+ <span class="legend-item"><span class="legend-dot cache-write"></span>Cache Write ${s?O(e.cacheWrite):G(n.cacheWrite.cost)}</span>
6608
+ <span class="legend-item"><span class="legend-dot cache-read"></span>Cache Read ${s?O(e.cacheRead):G(n.cacheRead.cost)}</span>
6608
6609
  </div>
6609
6610
  <div class="cost-breakdown-total">
6610
- Total: ${s?O(e.totalTokens):q(e.totalCost)}
6611
+ Total: ${s?O(e.totalTokens):G(e.totalCost)}
6611
6612
  </div>
6612
6613
  </div>
6613
- `}function ct(e,t,n){return r`
6614
+ `}function ut(e,t,n){return r`
6614
6615
  <div class="usage-insight-card">
6615
6616
  <div class="usage-insight-title">${e}</div>
6616
6617
  ${t.length===0?r`<div class="muted">${n}</div>`:r`
@@ -6627,7 +6628,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
6627
6628
  </div>
6628
6629
  `}
6629
6630
  </div>
6630
- `}function er(e,t,n){return r`
6631
+ `}function sr(e,t,n){return r`
6631
6632
  <div class="usage-insight-card">
6632
6633
  <div class="usage-insight-title">${e}</div>
6633
6634
  ${t.length===0?r`<div class="muted">${n}</div>`:r`
@@ -6642,7 +6643,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
6642
6643
  </div>
6643
6644
  `}
6644
6645
  </div>
6645
- `}function Gm(e,t,n,s,i,a,o){if(!e)return v;const l=t.messages.total?Math.round(e.totalTokens/t.messages.total):0,c=t.messages.total?e.totalCost/t.messages.total:0,u=e.input+e.cacheRead,g=u>0?e.cacheRead/u:0,p=u>0?`${(g*100).toFixed(1)}%`:"—",h=n.errorRate*100,d=n.throughputTokensPerMin!==void 0?`${O(Math.round(n.throughputTokensPerMin))} tok/min`:"—",f=n.throughputCostPerMin!==void 0?`${q(n.throughputCostPerMin,4)} / min`:"—",m=n.durationCount>0?Ii(n.avgDurationMs,{spaced:!0})??"—":"—",S="Cache hit rate = cache read / (input + cache read). Higher is better.",k="Error rate = errors / total messages. Lower is better.",$="Throughput shows tokens per minute over active time. Higher is better.",A="Average tokens per message in this range.",C=s?"Average cost per message when providers report costs. Cost data is missing for some or all sessions in this range.":"Average cost per message when providers report costs.",_=t.daily.filter(F=>F.messages>0&&F.errors>0).map(F=>{const H=F.errors/F.messages;return{label:zl(F.date),value:`${(H*100).toFixed(2)}%`,sub:`${F.errors} errors · ${F.messages} msgs · ${O(F.tokens)}`,rate:H}}).toSorted((F,H)=>H.rate-F.rate).slice(0,5).map(({rate:F,...H})=>H),T=t.byModel.slice(0,5).map(F=>({label:F.model??"unknown",value:q(F.totals.totalCost),sub:`${O(F.totals.totalTokens)} · ${F.count} msgs`})),I=t.byProvider.slice(0,5).map(F=>({label:F.provider??"unknown",value:q(F.totals.totalCost),sub:`${O(F.totals.totalTokens)} · ${F.count} msgs`})),z=t.tools.tools.slice(0,6).map(F=>({label:F.name,value:`${F.count}`,sub:"calls"})),Y=t.byAgent.slice(0,5).map(F=>({label:F.agentId,value:q(F.totals.totalCost),sub:O(F.totals.totalTokens)})),se=t.byChannel.slice(0,5).map(F=>({label:F.channel,value:q(F.totals.totalCost),sub:O(F.totals.totalTokens)}));return r`
6646
+ `}function lb(e,t,n,s,i,a,o){if(!e)return v;const l=t.messages.total?Math.round(e.totalTokens/t.messages.total):0,c=t.messages.total?e.totalCost/t.messages.total:0,u=e.input+e.cacheRead,g=u>0?e.cacheRead/u:0,p=u>0?`${(g*100).toFixed(1)}%`:"—",h=n.errorRate*100,d=n.throughputTokensPerMin!==void 0?`${O(Math.round(n.throughputTokensPerMin))} tok/min`:"—",f=n.throughputCostPerMin!==void 0?`${G(n.throughputCostPerMin,4)} / min`:"—",m=n.durationCount>0?Ri(n.avgDurationMs,{spaced:!0})??"—":"—",S="Cache hit rate = cache read / (input + cache read). Higher is better.",k="Error rate = errors / total messages. Lower is better.",$="Throughput shows tokens per minute over active time. Higher is better.",A="Average tokens per message in this range.",C=s?"Average cost per message when providers report costs. Cost data is missing for some or all sessions in this range.":"Average cost per message when providers report costs.",_=t.daily.filter(F=>F.messages>0&&F.errors>0).map(F=>{const H=F.errors/F.messages;return{label:Ql(F.date),value:`${(H*100).toFixed(2)}%`,sub:`${F.errors} errors · ${F.messages} msgs · ${O(F.tokens)}`,rate:H}}).toSorted((F,H)=>H.rate-F.rate).slice(0,5).map(({rate:F,...H})=>H),T=t.byModel.slice(0,5).map(F=>({label:F.model??"unknown",value:G(F.totals.totalCost),sub:`${O(F.totals.totalTokens)} · ${F.count} msgs`})),I=t.byProvider.slice(0,5).map(F=>({label:F.provider??"unknown",value:G(F.totals.totalCost),sub:`${O(F.totals.totalTokens)} · ${F.count} msgs`})),z=t.tools.tools.slice(0,6).map(F=>({label:F.name,value:`${F.count}`,sub:"calls"})),Y=t.byAgent.slice(0,5).map(F=>({label:F.agentId,value:G(F.totals.totalCost),sub:O(F.totals.totalTokens)})),se=t.byChannel.slice(0,5).map(F=>({label:F.channel,value:G(F.totals.totalCost),sub:O(F.totals.totalTokens)}));return r`
6646
6647
  <section class="card" style="margin-top: 16px;">
6647
6648
  <div class="card-title">Usage Overview</div>
6648
6649
  <div class="usage-summary-grid">
@@ -6685,8 +6686,8 @@ ${JSON.stringify(e.issues,null,2)}</pre
6685
6686
  Avg Cost / Msg
6686
6687
  <span class="usage-summary-hint" title=${C}>?</span>
6687
6688
  </div>
6688
- <div class="usage-summary-value">${q(c,4)}</div>
6689
- <div class="usage-summary-sub">${q(e.totalCost)} total</div>
6689
+ <div class="usage-summary-value">${G(c,4)}</div>
6690
+ <div class="usage-summary-sub">${G(e.totalCost)} total</div>
6690
6691
  </div>
6691
6692
  <div class="usage-summary-card">
6692
6693
  <div class="usage-summary-title">
@@ -6726,16 +6727,16 @@ ${JSON.stringify(e.issues,null,2)}</pre
6726
6727
  </div>
6727
6728
  </div>
6728
6729
  <div class="usage-insights-grid">
6729
- ${ct("Top Models",T,"No model data")}
6730
- ${ct("Top Providers",I,"No provider data")}
6731
- ${ct("Top Tools",z,"No tool calls")}
6732
- ${ct("Top Agents",Y,"No agent data")}
6733
- ${ct("Top Channels",se,"No channel data")}
6734
- ${er("Peak Error Days",_,"No error data")}
6735
- ${er("Peak Error Hours",i,"No error data")}
6730
+ ${ut("Top Models",T,"No model data")}
6731
+ ${ut("Top Providers",I,"No provider data")}
6732
+ ${ut("Top Tools",z,"No tool calls")}
6733
+ ${ut("Top Agents",Y,"No agent data")}
6734
+ ${ut("Top Channels",se,"No channel data")}
6735
+ ${sr("Peak Error Days",_,"No error data")}
6736
+ ${sr("Peak Error Hours",i,"No error data")}
6736
6737
  </div>
6737
6738
  </section>
6738
- `}function Vm(e,t,n,s,i,a,o,l,c,u,g,p,h,d,f){const m=E=>h.includes(E),S=E=>{const B=E.label||E.key;return B.startsWith("agent:")&&B.includes("?token=")?B.slice(0,B.indexOf("?token=")):B},k=async E=>{const B=S(E);try{await navigator.clipboard.writeText(B)}catch{}},$=E=>{const B=[];return m("channel")&&E.channel&&B.push(`channel:${E.channel}`),m("agent")&&E.agentId&&B.push(`agent:${E.agentId}`),m("provider")&&(E.modelProvider||E.providerOverride)&&B.push(`provider:${E.modelProvider??E.providerOverride}`),m("model")&&E.model&&B.push(`model:${E.model}`),m("messages")&&E.usage?.messageCounts&&B.push(`msgs:${E.usage.messageCounts.total}`),m("tools")&&E.usage?.toolUsage&&B.push(`tools:${E.usage.toolUsage.totalCalls}`),m("errors")&&E.usage?.messageCounts&&B.push(`errors:${E.usage.messageCounts.errors}`),m("duration")&&E.usage?.durationMs&&B.push(`dur:${Ii(E.usage.durationMs,{spaced:!0})??"—"}`),B},A=E=>{const B=E.usage;if(!B)return 0;if(n.length>0&&B.dailyBreakdown&&B.dailyBreakdown.length>0){const ie=B.dailyBreakdown.filter(ae=>n.includes(ae.date));return s?ie.reduce((ae,Z)=>ae+Z.tokens,0):ie.reduce((ae,Z)=>ae+Z.cost,0)}return s?B.totalTokens??0:B.totalCost??0},C=[...e].toSorted((E,B)=>{switch(i){case"recent":return(B.updatedAt??0)-(E.updatedAt??0);case"messages":return(B.usage?.messageCounts?.total??0)-(E.usage?.messageCounts?.total??0);case"errors":return(B.usage?.messageCounts?.errors??0)-(E.usage?.messageCounts?.errors??0);case"cost":return A(B)-A(E);default:return A(B)-A(E)}}),_=a==="asc"?C.toReversed():C,T=_.reduce((E,B)=>E+A(B),0),I=_.length?T/_.length:0,z=_.reduce((E,B)=>E+(B.usage?.messageCounts?.errors??0),0),Y=new Set(t),se=_.filter(E=>Y.has(E.key)),F=se.length,H=new Map(_.map(E=>[E.key,E])),ce=o.map(E=>H.get(E)).filter(E=>!!E);return r`
6739
+ `}function cb(e,t,n,s,i,a,o,l,c,u,g,p,h,d,f){const m=E=>h.includes(E),S=E=>{const B=E.label||E.key;return B.startsWith("agent:")&&B.includes("?token=")?B.slice(0,B.indexOf("?token=")):B},k=async E=>{const B=S(E);try{await navigator.clipboard.writeText(B)}catch{}},$=E=>{const B=[];return m("channel")&&E.channel&&B.push(`channel:${E.channel}`),m("agent")&&E.agentId&&B.push(`agent:${E.agentId}`),m("provider")&&(E.modelProvider||E.providerOverride)&&B.push(`provider:${E.modelProvider??E.providerOverride}`),m("model")&&E.model&&B.push(`model:${E.model}`),m("messages")&&E.usage?.messageCounts&&B.push(`msgs:${E.usage.messageCounts.total}`),m("tools")&&E.usage?.toolUsage&&B.push(`tools:${E.usage.toolUsage.totalCalls}`),m("errors")&&E.usage?.messageCounts&&B.push(`errors:${E.usage.messageCounts.errors}`),m("duration")&&E.usage?.durationMs&&B.push(`dur:${Ri(E.usage.durationMs,{spaced:!0})??"—"}`),B},A=E=>{const B=E.usage;if(!B)return 0;if(n.length>0&&B.dailyBreakdown&&B.dailyBreakdown.length>0){const ie=B.dailyBreakdown.filter(ae=>n.includes(ae.date));return s?ie.reduce((ae,Z)=>ae+Z.tokens,0):ie.reduce((ae,Z)=>ae+Z.cost,0)}return s?B.totalTokens??0:B.totalCost??0},C=[...e].toSorted((E,B)=>{switch(i){case"recent":return(B.updatedAt??0)-(E.updatedAt??0);case"messages":return(B.usage?.messageCounts?.total??0)-(E.usage?.messageCounts?.total??0);case"errors":return(B.usage?.messageCounts?.errors??0)-(E.usage?.messageCounts?.errors??0);case"cost":return A(B)-A(E);default:return A(B)-A(E)}}),_=a==="asc"?C.toReversed():C,T=_.reduce((E,B)=>E+A(B),0),I=_.length?T/_.length:0,z=_.reduce((E,B)=>E+(B.usage?.messageCounts?.errors??0),0),Y=new Set(t),se=_.filter(E=>Y.has(E.key)),F=se.length,H=new Map(_.map(E=>[E.key,E])),ce=o.map(E=>H.get(E)).filter(E=>!!E);return r`
6739
6740
  <div class="card sessions-card">
6740
6741
  <div class="sessions-card-header">
6741
6742
  <div class="card-title">Sessions</div>
@@ -6745,7 +6746,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
6745
6746
  </div>
6746
6747
  <div class="sessions-card-meta">
6747
6748
  <div class="sessions-card-stats">
6748
- <span>${s?O(I):q(I)} avg</span>
6749
+ <span>${s?O(I):G(I)} avg</span>
6749
6750
  <span>${z} errors</span>
6750
6751
  </div>
6751
6752
  <div class="chart-toggle small">
@@ -6810,7 +6811,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
6810
6811
  >
6811
6812
  Copy
6812
6813
  </button>
6813
- <div class="session-bar-value">${s?O(B):q(B)}</div>
6814
+ <div class="session-bar-value">${s?O(B):G(B)}</div>
6814
6815
  </div>
6815
6816
  </div>
6816
6817
  `})}
@@ -6838,7 +6839,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
6838
6839
  >
6839
6840
  Copy
6840
6841
  </button>
6841
- <div class="session-bar-value">${s?O(B):q(B)}</div>
6842
+ <div class="session-bar-value">${s?O(B):G(B)}</div>
6842
6843
  </div>
6843
6844
  </div>
6844
6845
  `})}
@@ -6868,7 +6869,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
6868
6869
  >
6869
6870
  Copy
6870
6871
  </button>
6871
- <div class="session-bar-value">${s?O(B):q(B)}</div>
6872
+ <div class="session-bar-value">${s?O(B):G(B)}</div>
6872
6873
  </div>
6873
6874
  </div>
6874
6875
  `})}
@@ -6876,9 +6877,9 @@ ${JSON.stringify(e.issues,null,2)}</pre
6876
6877
  </div>
6877
6878
  `:v}
6878
6879
  </div>
6879
- `}function Qm(){return v}function Ym(e){const t=e.usage;if(!t)return r`
6880
+ `}function db(){return v}function ub(e){const t=e.usage;if(!t)return r`
6880
6881
  <div class="muted">No usage data for this session.</div>
6881
- `;const n=o=>o?new Date(o).toLocaleString():"—",s=[];e.channel&&s.push(`channel:${e.channel}`),e.agentId&&s.push(`agent:${e.agentId}`),(e.modelProvider||e.providerOverride)&&s.push(`provider:${e.modelProvider??e.providerOverride}`),e.model&&s.push(`model:${e.model}`);const i=t.toolUsage?.tools.slice(0,6).map(o=>({label:o.name,value:`${o.count}`,sub:"calls"}))??[],a=t.modelUsage?.slice(0,6).map(o=>({label:o.model??"unknown",value:q(o.totals.totalCost),sub:O(o.totals.totalTokens)}))??[];return r`
6882
+ `;const n=o=>o?new Date(o).toLocaleString():"—",s=[];e.channel&&s.push(`channel:${e.channel}`),e.agentId&&s.push(`agent:${e.agentId}`),(e.modelProvider||e.providerOverride)&&s.push(`provider:${e.modelProvider??e.providerOverride}`),e.model&&s.push(`model:${e.model}`);const i=t.toolUsage?.tools.slice(0,6).map(o=>({label:o.name,value:`${o.count}`,sub:"calls"}))??[],a=t.modelUsage?.slice(0,6).map(o=>({label:o.model??"unknown",value:G(o.totals.totalCost),sub:O(o.totals.totalTokens)}))??[];return r`
6882
6883
  ${s.length>0?r`<div class="usage-badges">${s.map(o=>r`<span class="usage-badge">${o}</span>`)}</div>`:v}
6883
6884
  <div class="session-summary-grid">
6884
6885
  <div class="session-summary-card">
@@ -6898,15 +6899,15 @@ ${JSON.stringify(e.issues,null,2)}</pre
6898
6899
  </div>
6899
6900
  <div class="session-summary-card">
6900
6901
  <div class="session-summary-title">Duration</div>
6901
- <div class="session-summary-value">${Ii(t.durationMs,{spaced:!0})??"—"}</div>
6902
+ <div class="session-summary-value">${Ri(t.durationMs,{spaced:!0})??"—"}</div>
6902
6903
  <div class="session-summary-meta">${n(t.firstActivity)} → ${n(t.lastActivity)}</div>
6903
6904
  </div>
6904
6905
  </div>
6905
6906
  <div class="usage-insights-grid" style="margin-top: 12px;">
6906
- ${ct("Top Tools",i,"No tool calls")}
6907
- ${ct("Model Mix",a,"No model data")}
6907
+ ${ut("Top Tools",i,"No tool calls")}
6908
+ ${ut("Model Mix",a,"No model data")}
6908
6909
  </div>
6909
- `}function Jm(e,t,n,s,i,a,o,l,c,u,g,p,h,d,f,m,S,k,$,A,C,_,T){const I=e.label||e.key,z=I.length>50?I.slice(0,50)+"…":I,Y=e.usage;return r`
6910
+ `}function gb(e,t,n,s,i,a,o,l,c,u,g,p,h,d,f,m,S,k,$,A,C,_,T){const I=e.label||e.key,z=I.length>50?I.slice(0,50)+"…":I,Y=e.usage;return r`
6910
6911
  <div class="card session-detail-panel">
6911
6912
  <div class="session-detail-header">
6912
6913
  <div class="session-detail-header-left">
@@ -6915,23 +6916,23 @@ ${JSON.stringify(e.issues,null,2)}</pre
6915
6916
  <div class="session-detail-stats">
6916
6917
  ${Y?r`
6917
6918
  <span><strong>${O(Y.totalTokens)}</strong> tokens</span>
6918
- <span><strong>${q(Y.totalCost)}</strong></span>
6919
+ <span><strong>${G(Y.totalCost)}</strong></span>
6919
6920
  `:v}
6920
6921
  </div>
6921
6922
  <button class="session-close-btn" @click=${T} title="Close session details">×</button>
6922
6923
  </div>
6923
6924
  <div class="session-detail-content">
6924
- ${Ym(e)}
6925
+ ${ub(e)}
6925
6926
  <div class="session-detail-row">
6926
- ${Zm(t,n,s,i,a,o,l,c,u)}
6927
+ ${pb(t,n,s,i,a,o,l,c,u)}
6927
6928
  </div>
6928
6929
  <div class="session-detail-bottom">
6929
- ${eb(g,p,h,d,f,m,S,k,$,A)}
6930
- ${Xm(e.contextWeight,Y,C,_)}
6930
+ ${hb(g,p,h,d,f,m,S,k,$,A)}
6931
+ ${fb(e.contextWeight,Y,C,_)}
6931
6932
  </div>
6932
6933
  </div>
6933
6934
  </div>
6934
- `}function Zm(e,t,n,s,i,a,o,l,c){if(t)return r`
6935
+ `}function pb(e,t,n,s,i,a,o,l,c){if(t)return r`
6935
6936
  <div class="session-timeseries-compact">
6936
6937
  <div class="muted" style="padding: 20px; text-align: center">Loading...</div>
6937
6938
  </div>
@@ -6989,16 +6990,16 @@ ${JSON.stringify(e.issues,null,2)}</pre
6989
6990
  <text x="${$.left-4}" y="${$.top+4}" text-anchor="end" class="axis-label" style="font-size: 9px; fill: var(--text-muted)">${O(Y)}</text>
6990
6991
  <text x="${$.left-4}" y="${$.top+C}" text-anchor="end" class="axis-label" style="font-size: 9px; fill: var(--text-muted)">0</text>
6991
6992
  <!-- X axis labels (first and last) -->
6992
- ${u.length>0?mn`
6993
+ ${u.length>0?yn`
6993
6994
  <text x="${$.left}" y="${$.top+C+12}" text-anchor="start" style="font-size: 8px; fill: var(--text-muted)">${new Date(u[0].timestamp).toLocaleDateString(void 0,{month:"short",day:"numeric"})}</text>
6994
6995
  <text x="${S-$.right}" y="${$.top+C+12}" text-anchor="end" style="font-size: 8px; fill: var(--text-muted)">${new Date(u[u.length-1].timestamp).toLocaleDateString(void 0,{month:"short",day:"numeric"})}</text>
6995
6996
  `:v}
6996
6997
  <!-- Bars -->
6997
- ${u.map((H,ce)=>{const E=z[ce],B=$.left+ce*(se+F),ie=E/Y*C,ae=$.top+C-ie,te=[new Date(H.timestamp).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),`${O(E)} tokens`];T&&(te.push(`Output ${O(H.output)}`),te.push(`Input ${O(H.input)}`),te.push(`Cache write ${O(H.cacheWrite)}`),te.push(`Cache read ${O(H.cacheRead)}`));const M=te.join(" · ");if(!T)return mn`<rect x="${B}" y="${ae}" width="${se}" height="${ie}" class="ts-bar" rx="1" style="cursor: pointer;"><title>${M}</title></rect>`;const R=[{value:H.output,class:"output"},{value:H.input,class:"input"},{value:H.cacheWrite,class:"cache-write"},{value:H.cacheRead,class:"cache-read"}];let P=$.top+C;return mn`
6998
- ${R.map(j=>{if(j.value<=0||E<=0)return v;const xe=ie*(j.value/E);return P-=xe,mn`<rect x="${B}" y="${P}" width="${se}" height="${xe}" class="ts-bar ${j.class}" rx="1"><title>${M}</title></rect>`})}
6998
+ ${u.map((H,ce)=>{const E=z[ce],B=$.left+ce*(se+F),ie=E/Y*C,ae=$.top+C-ie,te=[new Date(H.timestamp).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),`${O(E)} tokens`];T&&(te.push(`Output ${O(H.output)}`),te.push(`Input ${O(H.input)}`),te.push(`Cache write ${O(H.cacheWrite)}`),te.push(`Cache read ${O(H.cacheRead)}`));const M=te.join(" · ");if(!T)return yn`<rect x="${B}" y="${ae}" width="${se}" height="${ie}" class="ts-bar" rx="1" style="cursor: pointer;"><title>${M}</title></rect>`;const R=[{value:H.output,class:"output"},{value:H.input,class:"input"},{value:H.cacheWrite,class:"cache-write"},{value:H.cacheRead,class:"cache-read"}];let P=$.top+C;return yn`
6999
+ ${R.map(j=>{if(j.value<=0||E<=0)return v;const xe=ie*(j.value/E);return P-=xe,yn`<rect x="${B}" y="${P}" width="${se}" height="${xe}" class="ts-bar ${j.class}" rx="1"><title>${M}</title></rect>`})}
6999
7000
  `})}
7000
7001
  </svg>
7001
- <div class="timeseries-summary">${u.length} msgs · ${O(g)} · ${q(p)}</div>
7002
+ <div class="timeseries-summary">${u.length} msgs · ${O(g)} · ${G(p)}</div>
7002
7003
  ${T?r`
7003
7004
  <div style="margin-top: 8px;">
7004
7005
  <div class="card-title" style="font-size: 12px; margin-bottom: 6px;">Tokens by Type</div>
@@ -7026,11 +7027,11 @@ ${JSON.stringify(e.issues,null,2)}</pre
7026
7027
  </div>
7027
7028
  `:v}
7028
7029
  </div>
7029
- `}function Xm(e,t,n,s){if(!e)return r`
7030
+ `}function fb(e,t,n,s){if(!e)return r`
7030
7031
  <div class="context-details-panel">
7031
7032
  <div class="muted" style="padding: 20px; text-align: center">No context data</div>
7032
7033
  </div>
7033
- `;const i=at(e.systemPrompt.chars),a=at(e.skills.promptChars),o=at(e.tools.listChars+e.tools.schemaChars),l=at(e.injectedWorkspaceFiles.reduce((A,C)=>A+C.injectedChars,0)),c=i+a+o+l;let u="";if(t&&t.totalTokens>0){const A=t.input+t.cacheRead;A>0&&(u=`~${Math.min(c/A*100,100).toFixed(0)}% of input`)}const g=e.skills.entries.toSorted((A,C)=>C.blockChars-A.blockChars),p=e.tools.entries.toSorted((A,C)=>C.summaryChars+C.schemaChars-(A.summaryChars+A.schemaChars)),h=e.injectedWorkspaceFiles.toSorted((A,C)=>C.injectedChars-A.injectedChars),d=4,f=n,m=f?g:g.slice(0,d),S=f?p:p.slice(0,d),k=f?h:h.slice(0,d),$=g.length>d||p.length>d||h.length>d;return r`
7034
+ `;const i=ot(e.systemPrompt.chars),a=ot(e.skills.promptChars),o=ot(e.tools.listChars+e.tools.schemaChars),l=ot(e.injectedWorkspaceFiles.reduce((A,C)=>A+C.injectedChars,0)),c=i+a+o+l;let u="";if(t&&t.totalTokens>0){const A=t.input+t.cacheRead;A>0&&(u=`~${Math.min(c/A*100,100).toFixed(0)}% of input`)}const g=e.skills.entries.toSorted((A,C)=>C.blockChars-A.blockChars),p=e.tools.entries.toSorted((A,C)=>C.summaryChars+C.schemaChars-(A.summaryChars+A.schemaChars)),h=e.injectedWorkspaceFiles.toSorted((A,C)=>C.injectedChars-A.injectedChars),d=4,f=n,m=f?g:g.slice(0,d),S=f?p:p.slice(0,d),k=f?h:h.slice(0,d),$=g.length>d||p.length>d||h.length>d;return r`
7034
7035
  <div class="context-details-panel">
7035
7036
  <div class="context-breakdown-header">
7036
7037
  <div class="card-title" style="font-size: 13px;">System Prompt Breakdown</div>
@@ -7060,7 +7061,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
7060
7061
  ${m.map(C=>r`
7061
7062
  <div class="context-breakdown-item">
7062
7063
  <span class="mono">${C.name}</span>
7063
- <span class="muted">~${O(at(C.blockChars))}</span>
7064
+ <span class="muted">~${O(ot(C.blockChars))}</span>
7064
7065
  </div>
7065
7066
  `)}
7066
7067
  </div>
@@ -7074,7 +7075,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
7074
7075
  ${S.map(C=>r`
7075
7076
  <div class="context-breakdown-item">
7076
7077
  <span class="mono">${C.name}</span>
7077
- <span class="muted">~${O(at(C.summaryChars+C.schemaChars))}</span>
7078
+ <span class="muted">~${O(ot(C.summaryChars+C.schemaChars))}</span>
7078
7079
  </div>
7079
7080
  `)}
7080
7081
  </div>
@@ -7088,7 +7089,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
7088
7089
  ${k.map(C=>r`
7089
7090
  <div class="context-breakdown-item">
7090
7091
  <span class="mono">${C.name}</span>
7091
- <span class="muted">~${O(at(C.injectedChars))}</span>
7092
+ <span class="muted">~${O(ot(C.injectedChars))}</span>
7092
7093
  </div>
7093
7094
  `)}
7094
7095
  </div>
@@ -7097,7 +7098,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
7097
7098
  `})():v}
7098
7099
  </div>
7099
7100
  </div>
7100
- `}function eb(e,t,n,s,i,a,o,l,c,u){if(t)return r`
7101
+ `}function hb(e,t,n,s,i,a,o,l,c,u){if(t)return r`
7101
7102
  <div class="session-logs-compact">
7102
7103
  <div class="session-logs-header">Conversation</div>
7103
7104
  <div class="muted" style="padding: 20px; text-align: center">Loading...</div>
@@ -7107,7 +7108,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
7107
7108
  <div class="session-logs-header">Conversation</div>
7108
7109
  <div class="muted" style="padding: 20px; text-align: center">No messages</div>
7109
7110
  </div>
7110
- `;const g=i.query.trim().toLowerCase(),p=e.map(k=>{const $=Am(k.content),A=$.cleanContent||k.content;return{log:k,toolInfo:$,cleanContent:A}}),h=Array.from(new Set(p.flatMap(k=>k.toolInfo.tools.map(([$])=>$)))).toSorted((k,$)=>k.localeCompare($)),d=p.filter(k=>!(i.roles.length>0&&!i.roles.includes(k.log.role)||i.hasTools&&k.toolInfo.tools.length===0||i.tools.length>0&&!k.toolInfo.tools.some(([A])=>i.tools.includes(A))||g&&!k.cleanContent.toLowerCase().includes(g))),f=i.roles.length>0||i.tools.length>0||i.hasTools||g?`${d.length} of ${e.length}`:`${e.length}`,m=new Set(i.roles),S=new Set(i.tools);return r`
7111
+ `;const g=i.query.trim().toLowerCase(),p=e.map(k=>{const $=Um(k.content),A=$.cleanContent||k.content;return{log:k,toolInfo:$,cleanContent:A}}),h=Array.from(new Set(p.flatMap(k=>k.toolInfo.tools.map(([$])=>$)))).toSorted((k,$)=>k.localeCompare($)),d=p.filter(k=>!(i.roles.length>0&&!i.roles.includes(k.log.role)||i.hasTools&&k.toolInfo.tools.length===0||i.tools.length>0&&!k.toolInfo.tools.some(([A])=>i.tools.includes(A))||g&&!k.cleanContent.toLowerCase().includes(g))),f=i.roles.length>0||i.tools.length>0||i.hasTools||g?`${d.length} of ${e.length}`:`${e.length}`,m=new Set(i.roles),S=new Set(i.tools);return r`
7111
7112
  <div class="session-logs-compact">
7112
7113
  <div class="session-logs-header">
7113
7114
  <span>Conversation <span style="font-weight: normal; color: var(--text-muted);">(${f} messages)</span></span>
@@ -7177,7 +7178,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
7177
7178
  `:v}
7178
7179
  </div>
7179
7180
  </div>
7180
- `}function tb(e){if(e.loading&&!e.totals)return r`
7181
+ `}function vb(e){if(e.loading&&!e.totals)return r`
7181
7182
  <style>
7182
7183
  @keyframes initial-spin {
7183
7184
  to { transform: rotate(360deg); }
@@ -7223,14 +7224,14 @@ ${JSON.stringify(e.issues,null,2)}</pre
7223
7224
  </div>
7224
7225
  </div>
7225
7226
  </section>
7226
- `;const t=e.chartMode==="tokens",n=e.query.trim().length>0,s=e.queryDraft.trim().length>0,i=[...e.sessions].toSorted((M,R)=>{const P=t?M.usage?.totalTokens??0:M.usage?.totalCost??0;return(t?R.usage?.totalTokens??0:R.usage?.totalCost??0)-P}),a=e.selectedDays.length>0?i.filter(M=>{if(M.usage?.activityDates?.length)return M.usage.activityDates.some(j=>e.selectedDays.includes(j));if(!M.updatedAt)return!1;const R=new Date(M.updatedAt),P=`${R.getFullYear()}-${String(R.getMonth()+1).padStart(2,"0")}-${String(R.getDate()).padStart(2,"0")}`;return e.selectedDays.includes(P)}):i,o=(M,R)=>{if(R.length===0)return!0;const P=M.usage,j=P?.firstActivity??M.updatedAt,xe=P?.lastActivity??M.updatedAt;if(!j||!xe)return!1;const Q=Math.min(j,xe),we=Math.max(j,xe);let X=Q;for(;X<=we;){const pe=new Date(X),Fe=la(pe,e.timeZone);if(R.includes(Fe))return!0;const Ne=ca(pe,e.timeZone);X=Math.min(Ne.getTime(),we)+1}return!1},l=e.selectedHours.length>0?a.filter(M=>o(M,e.selectedHours)):a,c=Sm(l,e.query),u=c.sessions,g=c.warnings,p=Um(e.queryDraft,i,e.aggregates),h=ra(e.query),d=M=>{const R=lt(M);return h.filter(P=>lt(P.key??"")===R).map(P=>P.value).filter(Boolean)},f=M=>{const R=new Set;for(const P of M)P&&R.add(P);return Array.from(R)},m=f(i.map(M=>M.agentId)).slice(0,12),S=f(i.map(M=>M.channel)).slice(0,12),k=f([...i.map(M=>M.modelProvider),...i.map(M=>M.providerOverride),...e.aggregates?.byProvider.map(M=>M.provider)??[]]).slice(0,12),$=f([...i.map(M=>M.model),...e.aggregates?.byModel.map(M=>M.model)??[]]).slice(0,12),A=f(e.aggregates?.tools.tools.map(M=>M.name)??[]).slice(0,12),C=e.selectedSessions.length===1?e.sessions.find(M=>M.key===e.selectedSessions[0])??u.find(M=>M.key===e.selectedSessions[0]):null,_=M=>M.reduce((R,P)=>(P.usage&&(R.input+=P.usage.input,R.output+=P.usage.output,R.cacheRead+=P.usage.cacheRead,R.cacheWrite+=P.usage.cacheWrite,R.totalTokens+=P.usage.totalTokens,R.totalCost+=P.usage.totalCost,R.inputCost+=P.usage.inputCost??0,R.outputCost+=P.usage.outputCost??0,R.cacheReadCost+=P.usage.cacheReadCost??0,R.cacheWriteCost+=P.usage.cacheWriteCost??0,R.missingCostEntries+=P.usage.missingCostEntries??0),R),{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,totalCost:0,inputCost:0,outputCost:0,cacheReadCost:0,cacheWriteCost:0,missingCostEntries:0}),T=M=>e.costDaily.filter(P=>M.includes(P.date)).reduce((P,j)=>(P.input+=j.input,P.output+=j.output,P.cacheRead+=j.cacheRead,P.cacheWrite+=j.cacheWrite,P.totalTokens+=j.totalTokens,P.totalCost+=j.totalCost,P.inputCost+=j.inputCost??0,P.outputCost+=j.outputCost??0,P.cacheReadCost+=j.cacheReadCost??0,P.cacheWriteCost+=j.cacheWriteCost??0,P),{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,totalCost:0,inputCost:0,outputCost:0,cacheReadCost:0,cacheWriteCost:0,missingCostEntries:0});let I,z;const Y=i.length;if(e.selectedSessions.length>0){const M=u.filter(R=>e.selectedSessions.includes(R.key));I=_(M),z=M.length}else e.selectedDays.length>0&&e.selectedHours.length===0?(I=T(e.selectedDays),z=u.length):e.selectedHours.length>0||n?(I=_(u),z=u.length):(I=e.totals,z=Y);const se=e.selectedSessions.length>0?u.filter(M=>e.selectedSessions.includes(M.key)):n||e.selectedHours.length>0?u:e.selectedDays.length>0?a:i,F=Fm(se,e.aggregates),H=e.selectedSessions.length>0?(()=>{const M=u.filter(P=>e.selectedSessions.includes(P.key)),R=new Set;for(const P of M)for(const j of P.usage?.activityDates??[])R.add(j);return R.size>0?e.costDaily.filter(P=>R.has(P.date)):e.costDaily})():e.costDaily,ce=Nm(se,I,F),E=!e.loading&&!e.totals&&e.sessions.length===0,B=(I?.missingCostEntries??0)>0||(I?I.totalTokens>0&&I.totalCost===0&&I.input+I.output+I.cacheRead+I.cacheWrite>0:!1),ie=[{label:"Today",days:1},{label:"7d",days:7},{label:"30d",days:30}],ae=M=>{const R=new Date,P=new Date;P.setDate(P.getDate()-(M-1)),e.onStartDateChange(Hs(P)),e.onEndDateChange(Hs(R))},Z=(M,R,P)=>{if(P.length===0)return v;const j=d(M),xe=new Set(j.map(X=>lt(X))),Q=P.length>0&&P.every(X=>xe.has(lt(X))),we=j.length;return r`
7227
+ `;const t=e.chartMode==="tokens",n=e.query.trim().length>0,s=e.queryDraft.trim().length>0,i=[...e.sessions].toSorted((M,R)=>{const P=t?M.usage?.totalTokens??0:M.usage?.totalCost??0;return(t?R.usage?.totalTokens??0:R.usage?.totalCost??0)-P}),a=e.selectedDays.length>0?i.filter(M=>{if(M.usage?.activityDates?.length)return M.usage.activityDates.some(j=>e.selectedDays.includes(j));if(!M.updatedAt)return!1;const R=new Date(M.updatedAt),P=`${R.getFullYear()}-${String(R.getMonth()+1).padStart(2,"0")}-${String(R.getDate()).padStart(2,"0")}`;return e.selectedDays.includes(P)}):i,o=(M,R)=>{if(R.length===0)return!0;const P=M.usage,j=P?.firstActivity??M.updatedAt,xe=P?.lastActivity??M.updatedAt;if(!j||!xe)return!1;const Q=Math.min(j,xe),ke=Math.max(j,xe);let X=Q;for(;X<=ke;){const pe=new Date(X),Fe=ca(pe,e.timeZone);if(R.includes(Fe))return!0;const Ne=da(pe,e.timeZone);X=Math.min(Ne.getTime(),ke)+1}return!1},l=e.selectedHours.length>0?a.filter(M=>o(M,e.selectedHours)):a,c=Bm(l,e.query),u=c.sessions,g=c.warnings,p=tb(e.queryDraft,i,e.aggregates),h=la(e.query),d=M=>{const R=dt(M);return h.filter(P=>dt(P.key??"")===R).map(P=>P.value).filter(Boolean)},f=M=>{const R=new Set;for(const P of M)P&&R.add(P);return Array.from(R)},m=f(i.map(M=>M.agentId)).slice(0,12),S=f(i.map(M=>M.channel)).slice(0,12),k=f([...i.map(M=>M.modelProvider),...i.map(M=>M.providerOverride),...e.aggregates?.byProvider.map(M=>M.provider)??[]]).slice(0,12),$=f([...i.map(M=>M.model),...e.aggregates?.byModel.map(M=>M.model)??[]]).slice(0,12),A=f(e.aggregates?.tools.tools.map(M=>M.name)??[]).slice(0,12),C=e.selectedSessions.length===1?e.sessions.find(M=>M.key===e.selectedSessions[0])??u.find(M=>M.key===e.selectedSessions[0]):null,_=M=>M.reduce((R,P)=>(P.usage&&(R.input+=P.usage.input,R.output+=P.usage.output,R.cacheRead+=P.usage.cacheRead,R.cacheWrite+=P.usage.cacheWrite,R.totalTokens+=P.usage.totalTokens,R.totalCost+=P.usage.totalCost,R.inputCost+=P.usage.inputCost??0,R.outputCost+=P.usage.outputCost??0,R.cacheReadCost+=P.usage.cacheReadCost??0,R.cacheWriteCost+=P.usage.cacheWriteCost??0,R.missingCostEntries+=P.usage.missingCostEntries??0),R),{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,totalCost:0,inputCost:0,outputCost:0,cacheReadCost:0,cacheWriteCost:0,missingCostEntries:0}),T=M=>e.costDaily.filter(P=>M.includes(P.date)).reduce((P,j)=>(P.input+=j.input,P.output+=j.output,P.cacheRead+=j.cacheRead,P.cacheWrite+=j.cacheWrite,P.totalTokens+=j.totalTokens,P.totalCost+=j.totalCost,P.inputCost+=j.inputCost??0,P.outputCost+=j.outputCost??0,P.cacheReadCost+=j.cacheReadCost??0,P.cacheWriteCost+=j.cacheWriteCost??0,P),{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,totalCost:0,inputCost:0,outputCost:0,cacheReadCost:0,cacheWriteCost:0,missingCostEntries:0});let I,z;const Y=i.length;if(e.selectedSessions.length>0){const M=u.filter(R=>e.selectedSessions.includes(R.key));I=_(M),z=M.length}else e.selectedDays.length>0&&e.selectedHours.length===0?(I=T(e.selectedDays),z=u.length):e.selectedHours.length>0||n?(I=_(u),z=u.length):(I=e.totals,z=Y);const se=e.selectedSessions.length>0?u.filter(M=>e.selectedSessions.includes(M.key)):n||e.selectedHours.length>0?u:e.selectedDays.length>0?a:i,F=Jm(se,e.aggregates),H=e.selectedSessions.length>0?(()=>{const M=u.filter(P=>e.selectedSessions.includes(P.key)),R=new Set;for(const P of M)for(const j of P.usage?.activityDates??[])R.add(j);return R.size>0?e.costDaily.filter(P=>R.has(P.date)):e.costDaily})():e.costDaily,ce=Zm(se,I,F),E=!e.loading&&!e.totals&&e.sessions.length===0,B=(I?.missingCostEntries??0)>0||(I?I.totalTokens>0&&I.totalCost===0&&I.input+I.output+I.cacheRead+I.cacheWrite>0:!1),ie=[{label:"Today",days:1},{label:"7d",days:7},{label:"30d",days:30}],ae=M=>{const R=new Date,P=new Date;P.setDate(P.getDate()-(M-1)),e.onStartDateChange(js(P)),e.onEndDateChange(js(R))},Z=(M,R,P)=>{if(P.length===0)return v;const j=d(M),xe=new Set(j.map(X=>dt(X))),Q=P.length>0&&P.every(X=>xe.has(dt(X))),ke=j.length;return r`
7227
7228
  <details
7228
7229
  class="usage-filter-select"
7229
7230
  @toggle=${X=>{const pe=X.currentTarget;if(!pe.open)return;const Fe=Ne=>{Ne.composedPath().includes(pe)||(pe.open=!1,window.removeEventListener("click",Fe,!0))};window.addEventListener("click",Fe,!0)}}
7230
7231
  >
7231
7232
  <summary>
7232
7233
  <span>${R}</span>
7233
- ${we>0?r`<span class="usage-filter-badge">${we}</span>`:r`
7234
+ ${ke>0?r`<span class="usage-filter-badge">${ke}</span>`:r`
7234
7235
  <span class="usage-filter-badge">All</span>
7235
7236
  `}
7236
7237
  </summary>
@@ -7238,26 +7239,26 @@ ${JSON.stringify(e.issues,null,2)}</pre
7238
7239
  <div class="usage-filter-actions">
7239
7240
  <button
7240
7241
  class="btn btn-sm"
7241
- @click=${X=>{X.preventDefault(),X.stopPropagation(),e.onQueryDraftChange(Xo(e.queryDraft,M,P))}}
7242
+ @click=${X=>{X.preventDefault(),X.stopPropagation(),e.onQueryDraftChange(nr(e.queryDraft,M,P))}}
7242
7243
  ?disabled=${Q}
7243
7244
  >
7244
7245
  Select All
7245
7246
  </button>
7246
7247
  <button
7247
7248
  class="btn btn-sm"
7248
- @click=${X=>{X.preventDefault(),X.stopPropagation(),e.onQueryDraftChange(Xo(e.queryDraft,M,[]))}}
7249
- ?disabled=${we===0}
7249
+ @click=${X=>{X.preventDefault(),X.stopPropagation(),e.onQueryDraftChange(nr(e.queryDraft,M,[]))}}
7250
+ ?disabled=${ke===0}
7250
7251
  >
7251
7252
  Clear
7252
7253
  </button>
7253
7254
  </div>
7254
7255
  <div class="usage-filter-options">
7255
- ${P.map(X=>{const pe=xe.has(lt(X));return r`
7256
+ ${P.map(X=>{const pe=xe.has(dt(X));return r`
7256
7257
  <label class="usage-filter-option">
7257
7258
  <input
7258
7259
  type="checkbox"
7259
7260
  .checked=${pe}
7260
- @change=${Fe=>{const Ne=Fe.target,Xe=`${M}:${X}`;e.onQueryDraftChange(Ne.checked?Hm(e.queryDraft,Xe):Zo(e.queryDraft,Xe))}}
7261
+ @change=${Fe=>{const Ne=Fe.target,et=`${M}:${X}`;e.onQueryDraftChange(Ne.checked?sb(e.queryDraft,et):tr(e.queryDraft,et))}}
7261
7262
  />
7262
7263
  <span>${X}</span>
7263
7264
  </label>
@@ -7265,8 +7266,8 @@ ${JSON.stringify(e.issues,null,2)}</pre
7265
7266
  </div>
7266
7267
  </div>
7267
7268
  </details>
7268
- `},te=Hs(new Date);return r`
7269
- <style>${Cm}</style>
7269
+ `},te=js(new Date);return r`
7270
+ <style>${zm}</style>
7270
7271
 
7271
7272
  <section class="usage-page-header">
7272
7273
  <div class="usage-page-title">Usage</div>
@@ -7290,7 +7291,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
7290
7291
  <strong>${O(I.totalTokens)}</strong> tokens
7291
7292
  </span>
7292
7293
  <span class="usage-metric-badge">
7293
- <strong>${q(I.totalCost)}</strong> cost
7294
+ <strong>${G(I.totalCost)}</strong> cost
7294
7295
  </span>
7295
7296
  <span class="usage-metric-badge">
7296
7297
  <strong>${z}</strong>
@@ -7313,21 +7314,21 @@ ${JSON.stringify(e.issues,null,2)}</pre
7313
7314
  <div class="usage-export-list">
7314
7315
  <button
7315
7316
  class="usage-export-item"
7316
- @click=${()=>js(`openclaw-usage-sessions-${te}.csv`,Om(u),"text/csv")}
7317
+ @click=${()=>Ks(`openclaw-usage-sessions-${te}.csv`,Xm(u),"text/csv")}
7317
7318
  ?disabled=${u.length===0}
7318
7319
  >
7319
7320
  Sessions CSV
7320
7321
  </button>
7321
7322
  <button
7322
7323
  class="usage-export-item"
7323
- @click=${()=>js(`openclaw-usage-daily-${te}.csv`,Bm(H),"text/csv")}
7324
+ @click=${()=>Ks(`openclaw-usage-daily-${te}.csv`,eb(H),"text/csv")}
7324
7325
  ?disabled=${H.length===0}
7325
7326
  >
7326
7327
  Daily CSV
7327
7328
  </button>
7328
7329
  <button
7329
7330
  class="usage-export-item"
7330
- @click=${()=>js(`openclaw-usage-${te}.json`,JSON.stringify({totals:I,sessions:u,daily:H,aggregates:F},null,2),"application/json")}
7331
+ @click=${()=>Ks(`openclaw-usage-${te}.json`,JSON.stringify({totals:I,sessions:u,daily:H,aggregates:F},null,2),"application/json")}
7331
7332
  ?disabled=${u.length===0&&H.length===0}
7332
7333
  >
7333
7334
  JSON
@@ -7339,7 +7340,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
7339
7340
  </div>
7340
7341
  <div class="usage-header-row">
7341
7342
  <div class="usage-controls">
7342
- ${Km(e.selectedDays,e.selectedHours,e.selectedSessions,e.sessions,e.onClearDays,e.onClearHours,e.onClearSessions,e.onClearFilters)}
7343
+ ${ab(e.selectedDays,e.selectedHours,e.selectedSessions,e.sessions,e.onClearDays,e.onClearHours,e.onClearSessions,e.onClearFilters)}
7343
7344
  <div class="usage-presets">
7344
7345
  ${ie.map(M=>r`
7345
7346
  <button class="btn btn-sm" @click=${()=>ae(M.days)}>
@@ -7434,7 +7435,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
7434
7435
  ${R}
7435
7436
  <button
7436
7437
  title="Remove filter"
7437
- @click=${()=>e.onQueryDraftChange(Zo(e.queryDraft,R))}
7438
+ @click=${()=>e.onQueryDraftChange(tr(e.queryDraft,R))}
7438
7439
  >
7439
7440
  ×
7440
7441
  </button>
@@ -7447,7 +7448,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
7447
7448
  ${p.map(M=>r`
7448
7449
  <button
7449
7450
  class="usage-query-suggestion"
7450
- @click=${()=>e.onQueryDraftChange(zm(e.queryDraft,M.value))}
7451
+ @click=${()=>e.onQueryDraftChange(nb(e.queryDraft,M.value))}
7451
7452
  >
7452
7453
  ${M.label}
7453
7454
  </button>
@@ -7470,26 +7471,26 @@ ${JSON.stringify(e.issues,null,2)}</pre
7470
7471
  `:v}
7471
7472
  </section>
7472
7473
 
7473
- ${Gm(I,F,ce,B,Em(se,e.timeZone),z,Y)}
7474
+ ${lb(I,F,ce,B,Km(se,e.timeZone),z,Y)}
7474
7475
 
7475
- ${Rm(se,e.timeZone,e.selectedHours,e.onSelectHour)}
7476
+ ${Vm(se,e.timeZone,e.selectedHours,e.onSelectHour)}
7476
7477
 
7477
7478
  <!-- Two-column layout: Daily+Breakdown on left, Sessions on right -->
7478
7479
  <div class="usage-grid">
7479
7480
  <div class="usage-grid-left">
7480
7481
  <div class="card usage-left-card">
7481
- ${Wm(H,e.selectedDays,e.chartMode,e.dailyChartMode,e.onDailyChartModeChange,e.onSelectDay)}
7482
- ${I?qm(I,e.chartMode):v}
7482
+ ${ob(H,e.selectedDays,e.chartMode,e.dailyChartMode,e.onDailyChartModeChange,e.onSelectDay)}
7483
+ ${I?rb(I,e.chartMode):v}
7483
7484
  </div>
7484
7485
  </div>
7485
7486
  <div class="usage-grid-right">
7486
- ${Vm(u,e.selectedSessions,e.selectedDays,t,e.sessionSort,e.sessionSortDir,e.recentSessions,e.sessionsTab,e.onSelectSession,e.onSessionSortChange,e.onSessionSortDirChange,e.onSessionsTabChange,e.visibleColumns,Y,e.onClearSessions)}
7487
+ ${cb(u,e.selectedSessions,e.selectedDays,t,e.sessionSort,e.sessionSortDir,e.recentSessions,e.sessionsTab,e.onSelectSession,e.onSessionSortChange,e.onSessionSortDirChange,e.onSessionsTabChange,e.visibleColumns,Y,e.onClearSessions)}
7487
7488
  </div>
7488
7489
  </div>
7489
7490
 
7490
7491
  <!-- Session Detail Panel (when selected) or Empty State -->
7491
- ${C?Jm(C,e.timeSeries,e.timeSeriesLoading,e.timeSeriesMode,e.onTimeSeriesModeChange,e.timeSeriesBreakdownMode,e.onTimeSeriesBreakdownChange,e.startDate,e.endDate,e.selectedDays,e.sessionLogs,e.sessionLogsLoading,e.sessionLogsExpanded,e.onToggleSessionLogsExpanded,{roles:e.logFilterRoles,tools:e.logFilterTools,hasTools:e.logFilterHasTools,query:e.logFilterQuery},e.onLogFilterRolesChange,e.onLogFilterToolsChange,e.onLogFilterHasToolsChange,e.onLogFilterQueryChange,e.onLogFilterClear,e.contextExpanded,e.onToggleContextExpanded,e.onClearSessions):Qm()}
7492
- `}let Ks=null;const tr=e=>{Ks&&clearTimeout(Ks),Ks=window.setTimeout(()=>{rl(e)},400)},nb=/^data:/i,sb=/^https?:\/\//i;function ib(e){const t=e.agentsList?.agents??[],s=vr(e.sessionKey)?.agentId??e.agentsList?.defaultId??"main",a=t.find(l=>l.id===s)?.identity,o=a?.avatarUrl??a?.avatar;if(o)return nb.test(o)||sb.test(o)?o:a?.avatarUrl}function ab(e){const t=e.presenceEntries.length,n=e.sessionsResult?.count??null,s=e.cronStatus?.nextWakeAtMs??null,i=e.connected?null:"Disconnected from gateway.",a=e.tab==="chat",o=a&&(e.settings.chatFocusMode||e.onboarding),l=e.onboarding?!1:e.settings.chatShowThinking,c=ib(e),u=e.chatAvatarUrl??c??null,g=e.configForm??e.configSnapshot?.config,p=ln(e.basePath??""),h=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id??null;return r`
7492
+ ${C?gb(C,e.timeSeries,e.timeSeriesLoading,e.timeSeriesMode,e.onTimeSeriesModeChange,e.timeSeriesBreakdownMode,e.onTimeSeriesBreakdownChange,e.startDate,e.endDate,e.selectedDays,e.sessionLogs,e.sessionLogsLoading,e.sessionLogsExpanded,e.onToggleSessionLogsExpanded,{roles:e.logFilterRoles,tools:e.logFilterTools,hasTools:e.logFilterHasTools,query:e.logFilterQuery},e.onLogFilterRolesChange,e.onLogFilterToolsChange,e.onLogFilterHasToolsChange,e.onLogFilterQueryChange,e.onLogFilterClear,e.contextExpanded,e.onToggleContextExpanded,e.onClearSessions):db()}
7493
+ `}let Ws=null;const ir=e=>{Ws&&clearTimeout(Ws),Ws=window.setTimeout(()=>{gl(e)},400)},mb=/^data:/i,bb=/^https?:\/\//i;function yb(e){const t=e.agentsList?.agents??[],s=$r(e.sessionKey)?.agentId??e.agentsList?.defaultId??"main",a=t.find(l=>l.id===s)?.identity,o=a?.avatarUrl??a?.avatar;if(o)return mb.test(o)||bb.test(o)?o:a?.avatarUrl}function xb(e){const t=e.presenceEntries.length,n=e.sessionsResult?.count??null,s=e.cronStatus?.nextWakeAtMs??null,i=e.connected?null:"Disconnected from gateway.",a=e.tab==="chat",o=a&&(e.settings.chatFocusMode||e.onboarding),l=e.onboarding?!1:e.settings.chatShowThinking,c=yb(e),u=e.chatAvatarUrl??c??null,g=e.configForm??e.configSnapshot?.config,p=dn(e.basePath??""),h=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id??null;return r`
7493
7494
  <div class="shell ${a?"shell--chat":""} ${o?"shell--chat-focus":""} ${e.settings.navCollapsed?"shell--nav-collapsed":""} ${e.onboarding?"shell--onboarding":""}">
7494
7495
  <header class="topbar">
7495
7496
  <div class="topbar-left">
@@ -7517,11 +7518,11 @@ ${JSON.stringify(e.issues,null,2)}</pre
7517
7518
  <span>Health</span>
7518
7519
  <span class="mono">${e.connected?"OK":"Offline"}</span>
7519
7520
  </div>
7520
- ${Ag(e)}
7521
+ ${Dg(e)}
7521
7522
  </div>
7522
7523
  </header>
7523
7524
  <aside class="nav ${e.settings.navCollapsed?"nav--collapsed":""}">
7524
- ${Xd.map(d=>{const f=e.settings.navGroupsCollapsed[d.label]??!1,m=d.tabs.some(S=>S===e.tab);return r`
7525
+ ${cu.map(d=>{const f=e.settings.navGroupsCollapsed[d.label]??!1,m=d.tabs.some(S=>S===e.tab);return r`
7525
7526
  <div class="nav-group ${f&&!m?"nav-group--collapsed":""}">
7526
7527
  <button
7527
7528
  class="nav-label"
@@ -7532,7 +7533,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
7532
7533
  <span class="nav-label__chevron">${f?"+":"−"}</span>
7533
7534
  </button>
7534
7535
  <div class="nav-group__items">
7535
- ${d.tabs.map(S=>xg(e,S))}
7536
+ ${d.tabs.map(S=>Lg(e,S))}
7536
7537
  </div>
7537
7538
  </div>
7538
7539
  `})}
@@ -7558,44 +7559,44 @@ ${JSON.stringify(e.issues,null,2)}</pre
7558
7559
  <section class="content-header">
7559
7560
  <div>
7560
7561
  ${e.tab==="usage"?v:r`<div class="page-title">${ei(e.tab)}</div>`}
7561
- ${e.tab==="usage"?v:r`<div class="page-sub">${nu(e.tab)}</div>`}
7562
+ ${e.tab==="usage"?v:r`<div class="page-sub">${gu(e.tab)}</div>`}
7562
7563
  </div>
7563
7564
  <div class="page-meta">
7564
7565
  ${e.lastError?r`<div class="pill danger">${e.lastError}</div>`:v}
7565
- ${a?$g(e):v}
7566
+ ${a?Mg(e):v}
7566
7567
  </div>
7567
7568
  </section>
7568
7569
 
7569
- ${e.tab==="overview"?im({connected:e.connected,hello:e.hello,settings:e.settings,password:e.password,lastError:e.lastError,presenceCount:t,sessionsCount:n,cronEnabled:e.cronStatus?.enabled??null,cronNext:s,lastChannelsRefresh:e.channelsLastSuccess,onSettingsChange:d=>e.applySettings(d),onPasswordChange:d=>e.password=d,onSessionKeyChange:d=>{e.sessionKey=d,e.chatMessage="",e.resetToolStream(),e.applySettings({...e.settings,sessionKey:d,lastActiveSessionKey:d}),e.loadAssistantIdentity()},onConnect:()=>e.connect(),onRefresh:()=>e.loadOverview()}):v}
7570
+ ${e.tab==="overview"?ym({connected:e.connected,hello:e.hello,settings:e.settings,password:e.password,lastError:e.lastError,presenceCount:t,sessionsCount:n,cronEnabled:e.cronStatus?.enabled??null,cronNext:s,lastChannelsRefresh:e.channelsLastSuccess,onSettingsChange:d=>e.applySettings(d),onPasswordChange:d=>e.password=d,onSessionKeyChange:d=>{e.sessionKey=d,e.chatMessage="",e.resetToolStream(),e.applySettings({...e.settings,sessionKey:d,lastActiveSessionKey:d}),e.loadAssistantIdentity()},onConnect:()=>e.connect(),onRefresh:()=>e.loadOverview()}):v}
7570
7571
 
7571
- ${e.tab==="channels"?Gp({connected:e.connected,loading:e.channelsLoading,snapshot:e.channelsSnapshot,lastError:e.channelsError,lastSuccessAt:e.channelsLastSuccess,whatsappMessage:e.whatsappLoginMessage,whatsappQrDataUrl:e.whatsappLoginQrDataUrl,whatsappConnected:e.whatsappLoginConnected,whatsappBusy:e.whatsappBusy,configSchema:e.configSchema,configSchemaLoading:e.configSchemaLoading,configForm:e.configForm,configUiHints:e.configUiHints,configSaving:e.configSaving,configFormDirty:e.configFormDirty,nostrProfileFormState:e.nostrProfileFormState,nostrProfileAccountId:e.nostrProfileAccountId,onRefresh:d=>ye(e,d),onWhatsAppStart:d=>e.handleWhatsAppStart(d),onWhatsAppWait:()=>e.handleWhatsAppWait(),onWhatsAppLogout:()=>e.handleWhatsAppLogout(),onConfigPatch:(d,f)=>$e(e,d,f),onConfigSave:()=>e.handleChannelConfigSave(),onConfigReload:()=>e.handleChannelConfigReload(),onNostrProfileEdit:(d,f)=>e.handleNostrProfileEdit(d,f),onNostrProfileCancel:()=>e.handleNostrProfileCancel(),onNostrProfileFieldChange:(d,f)=>e.handleNostrProfileFieldChange(d,f),onNostrProfileSave:()=>e.handleNostrProfileSave(),onNostrProfileImport:()=>e.handleNostrProfileImport(),onNostrProfileToggleAdvanced:()=>e.handleNostrProfileToggleAdvanced()}):v}
7572
+ ${e.tab==="channels"?nf({connected:e.connected,loading:e.channelsLoading,snapshot:e.channelsSnapshot,lastError:e.channelsError,lastSuccessAt:e.channelsLastSuccess,whatsappMessage:e.whatsappLoginMessage,whatsappQrDataUrl:e.whatsappLoginQrDataUrl,whatsappConnected:e.whatsappLoginConnected,whatsappBusy:e.whatsappBusy,configSchema:e.configSchema,configSchemaLoading:e.configSchemaLoading,configForm:e.configForm,configUiHints:e.configUiHints,configSaving:e.configSaving,configFormDirty:e.configFormDirty,nostrProfileFormState:e.nostrProfileFormState,nostrProfileAccountId:e.nostrProfileAccountId,onRefresh:d=>ye(e,d),onWhatsAppStart:d=>e.handleWhatsAppStart(d),onWhatsAppWait:()=>e.handleWhatsAppWait(),onWhatsAppLogout:()=>e.handleWhatsAppLogout(),onConfigPatch:(d,f)=>$e(e,d,f),onConfigSave:()=>e.handleChannelConfigSave(),onConfigReload:()=>e.handleChannelConfigReload(),onNostrProfileEdit:(d,f)=>e.handleNostrProfileEdit(d,f),onNostrProfileCancel:()=>e.handleNostrProfileCancel(),onNostrProfileFieldChange:(d,f)=>e.handleNostrProfileFieldChange(d,f),onNostrProfileSave:()=>e.handleNostrProfileSave(),onNostrProfileImport:()=>e.handleNostrProfileImport(),onNostrProfileToggleAdvanced:()=>e.handleNostrProfileToggleAdvanced()}):v}
7572
7573
 
7573
- ${e.tab==="instances"?_v({loading:e.presenceLoading,entries:e.presenceEntries,lastError:e.presenceError,statusMessage:e.presenceStatus,onRefresh:()=>zi(e)}):v}
7574
+ ${e.tab==="instances"?jv({loading:e.presenceLoading,entries:e.presenceEntries,lastError:e.presenceError,statusMessage:e.presenceStatus,onRefresh:()=>Hi(e)}):v}
7574
7575
 
7575
- ${e.tab==="sessions"?fm({loading:e.sessionsLoading,result:e.sessionsResult,error:e.sessionsError,activeMinutes:e.sessionsFilterActive,limit:e.sessionsFilterLimit,includeGlobal:e.sessionsIncludeGlobal,includeUnknown:e.sessionsIncludeUnknown,basePath:e.basePath,onFiltersChange:d=>{e.sessionsFilterActive=d.activeMinutes,e.sessionsFilterLimit=d.limit,e.sessionsIncludeGlobal=d.includeGlobal,e.sessionsIncludeUnknown=d.includeUnknown},onRefresh:()=>bt(e),onPatch:(d,f)=>Gd(e,d,f),onDelete:d=>Vd(e,d)}):v}
7576
+ ${e.tab==="sessions"?Em({loading:e.sessionsLoading,result:e.sessionsResult,error:e.sessionsError,activeMinutes:e.sessionsFilterActive,limit:e.sessionsFilterLimit,includeGlobal:e.sessionsIncludeGlobal,includeUnknown:e.sessionsIncludeUnknown,basePath:e.basePath,onFiltersChange:d=>{e.sessionsFilterActive=d.activeMinutes,e.sessionsFilterLimit=d.limit,e.sessionsIncludeGlobal=d.includeGlobal,e.sessionsIncludeUnknown=d.includeUnknown},onRefresh:()=>xt(e),onPatch:(d,f)=>su(e,d,f),onDelete:d=>iu(e,d)}):v}
7576
7577
 
7577
- ${e.tab==="usage"?tb({loading:e.usageLoading,error:e.usageError,startDate:e.usageStartDate,endDate:e.usageEndDate,sessions:e.usageResult?.sessions??[],sessionsLimitReached:(e.usageResult?.sessions?.length??0)>=1e3,totals:e.usageResult?.totals??null,aggregates:e.usageResult?.aggregates??null,costDaily:e.usageCostSummary?.daily??[],selectedSessions:e.usageSelectedSessions,selectedDays:e.usageSelectedDays,selectedHours:e.usageSelectedHours,chartMode:e.usageChartMode,dailyChartMode:e.usageDailyChartMode,timeSeriesMode:e.usageTimeSeriesMode,timeSeriesBreakdownMode:e.usageTimeSeriesBreakdownMode,timeSeries:e.usageTimeSeries,timeSeriesLoading:e.usageTimeSeriesLoading,sessionLogs:e.usageSessionLogs,sessionLogsLoading:e.usageSessionLogsLoading,sessionLogsExpanded:e.usageSessionLogsExpanded,logFilterRoles:e.usageLogFilterRoles,logFilterTools:e.usageLogFilterTools,logFilterHasTools:e.usageLogFilterHasTools,logFilterQuery:e.usageLogFilterQuery,query:e.usageQuery,queryDraft:e.usageQueryDraft,sessionSort:e.usageSessionSort,sessionSortDir:e.usageSessionSortDir,recentSessions:e.usageRecentSessions,sessionsTab:e.usageSessionsTab,visibleColumns:e.usageVisibleColumns,timeZone:e.usageTimeZone,contextExpanded:e.usageContextExpanded,headerPinned:e.usageHeaderPinned,onStartDateChange:d=>{e.usageStartDate=d,e.usageSelectedDays=[],e.usageSelectedHours=[],e.usageSelectedSessions=[],tr(e)},onEndDateChange:d=>{e.usageEndDate=d,e.usageSelectedDays=[],e.usageSelectedHours=[],e.usageSelectedSessions=[],tr(e)},onRefresh:()=>rl(e),onTimeZoneChange:d=>{e.usageTimeZone=d},onToggleContextExpanded:()=>{e.usageContextExpanded=!e.usageContextExpanded},onToggleSessionLogsExpanded:()=>{e.usageSessionLogsExpanded=!e.usageSessionLogsExpanded},onLogFilterRolesChange:d=>{e.usageLogFilterRoles=d},onLogFilterToolsChange:d=>{e.usageLogFilterTools=d},onLogFilterHasToolsChange:d=>{e.usageLogFilterHasTools=d},onLogFilterQueryChange:d=>{e.usageLogFilterQuery=d},onLogFilterClear:()=>{e.usageLogFilterRoles=[],e.usageLogFilterTools=[],e.usageLogFilterHasTools=!1,e.usageLogFilterQuery=""},onToggleHeaderPinned:()=>{e.usageHeaderPinned=!e.usageHeaderPinned},onSelectHour:(d,f)=>{if(f&&e.usageSelectedHours.length>0){const m=Array.from({length:24},(A,C)=>C),S=e.usageSelectedHours[e.usageSelectedHours.length-1],k=m.indexOf(S),$=m.indexOf(d);if(k!==-1&&$!==-1){const[A,C]=k<$?[k,$]:[$,k],_=m.slice(A,C+1);e.usageSelectedHours=[...new Set([...e.usageSelectedHours,..._])]}}else e.usageSelectedHours.includes(d)?e.usageSelectedHours=e.usageSelectedHours.filter(m=>m!==d):e.usageSelectedHours=[...e.usageSelectedHours,d]},onQueryDraftChange:d=>{e.usageQueryDraft=d,e.usageQueryDebounceTimer&&window.clearTimeout(e.usageQueryDebounceTimer),e.usageQueryDebounceTimer=window.setTimeout(()=>{e.usageQuery=e.usageQueryDraft,e.usageQueryDebounceTimer=null},250)},onApplyQuery:()=>{e.usageQueryDebounceTimer&&(window.clearTimeout(e.usageQueryDebounceTimer),e.usageQueryDebounceTimer=null),e.usageQuery=e.usageQueryDraft},onClearQuery:()=>{e.usageQueryDebounceTimer&&(window.clearTimeout(e.usageQueryDebounceTimer),e.usageQueryDebounceTimer=null),e.usageQueryDraft="",e.usageQuery=""},onSessionSortChange:d=>{e.usageSessionSort=d},onSessionSortDirChange:d=>{e.usageSessionSortDir=d},onSessionsTabChange:d=>{e.usageSessionsTab=d},onToggleColumn:d=>{e.usageVisibleColumns.includes(d)?e.usageVisibleColumns=e.usageVisibleColumns.filter(f=>f!==d):e.usageVisibleColumns=[...e.usageVisibleColumns,d]},onSelectSession:(d,f)=>{if(e.usageTimeSeries=null,e.usageSessionLogs=null,e.usageRecentSessions=[d,...e.usageRecentSessions.filter(m=>m!==d)].slice(0,8),f&&e.usageSelectedSessions.length>0){const m=e.usageChartMode==="tokens",k=[...e.usageResult?.sessions??[]].toSorted((_,T)=>{const I=m?_.usage?.totalTokens??0:_.usage?.totalCost??0;return(m?T.usage?.totalTokens??0:T.usage?.totalCost??0)-I}).map(_=>_.key),$=e.usageSelectedSessions[e.usageSelectedSessions.length-1],A=k.indexOf($),C=k.indexOf(d);if(A!==-1&&C!==-1){const[_,T]=A<C?[A,C]:[C,A],I=k.slice(_,T+1),z=[...new Set([...e.usageSelectedSessions,...I])];e.usageSelectedSessions=z}}else e.usageSelectedSessions.length===1&&e.usageSelectedSessions[0]===d?e.usageSelectedSessions=[]:e.usageSelectedSessions=[d];e.usageSelectedSessions.length===1&&(Mg(e,e.usageSelectedSessions[0]),Ig(e,e.usageSelectedSessions[0]))},onSelectDay:(d,f)=>{if(f&&e.usageSelectedDays.length>0){const m=(e.usageCostSummary?.daily??[]).map(A=>A.date),S=e.usageSelectedDays[e.usageSelectedDays.length-1],k=m.indexOf(S),$=m.indexOf(d);if(k!==-1&&$!==-1){const[A,C]=k<$?[k,$]:[$,k],_=m.slice(A,C+1),T=[...new Set([...e.usageSelectedDays,..._])];e.usageSelectedDays=T}}else e.usageSelectedDays.includes(d)?e.usageSelectedDays=e.usageSelectedDays.filter(m=>m!==d):e.usageSelectedDays=[d]},onChartModeChange:d=>{e.usageChartMode=d},onDailyChartModeChange:d=>{e.usageDailyChartMode=d},onTimeSeriesModeChange:d=>{e.usageTimeSeriesMode=d},onTimeSeriesBreakdownChange:d=>{e.usageTimeSeriesBreakdownMode=d},onClearDays:()=>{e.usageSelectedDays=[]},onClearHours:()=>{e.usageSelectedHours=[]},onClearSessions:()=>{e.usageSelectedSessions=[],e.usageTimeSeries=null,e.usageSessionLogs=null},onClearFilters:()=>{e.usageSelectedDays=[],e.usageSelectedHours=[],e.usageSelectedSessions=[],e.usageTimeSeries=null,e.usageSessionLogs=null}}):v}
7578
+ ${e.tab==="usage"?vb({loading:e.usageLoading,error:e.usageError,startDate:e.usageStartDate,endDate:e.usageEndDate,sessions:e.usageResult?.sessions??[],sessionsLimitReached:(e.usageResult?.sessions?.length??0)>=1e3,totals:e.usageResult?.totals??null,aggregates:e.usageResult?.aggregates??null,costDaily:e.usageCostSummary?.daily??[],selectedSessions:e.usageSelectedSessions,selectedDays:e.usageSelectedDays,selectedHours:e.usageSelectedHours,chartMode:e.usageChartMode,dailyChartMode:e.usageDailyChartMode,timeSeriesMode:e.usageTimeSeriesMode,timeSeriesBreakdownMode:e.usageTimeSeriesBreakdownMode,timeSeries:e.usageTimeSeries,timeSeriesLoading:e.usageTimeSeriesLoading,sessionLogs:e.usageSessionLogs,sessionLogsLoading:e.usageSessionLogsLoading,sessionLogsExpanded:e.usageSessionLogsExpanded,logFilterRoles:e.usageLogFilterRoles,logFilterTools:e.usageLogFilterTools,logFilterHasTools:e.usageLogFilterHasTools,logFilterQuery:e.usageLogFilterQuery,query:e.usageQuery,queryDraft:e.usageQueryDraft,sessionSort:e.usageSessionSort,sessionSortDir:e.usageSessionSortDir,recentSessions:e.usageRecentSessions,sessionsTab:e.usageSessionsTab,visibleColumns:e.usageVisibleColumns,timeZone:e.usageTimeZone,contextExpanded:e.usageContextExpanded,headerPinned:e.usageHeaderPinned,onStartDateChange:d=>{e.usageStartDate=d,e.usageSelectedDays=[],e.usageSelectedHours=[],e.usageSelectedSessions=[],ir(e)},onEndDateChange:d=>{e.usageEndDate=d,e.usageSelectedDays=[],e.usageSelectedHours=[],e.usageSelectedSessions=[],ir(e)},onRefresh:()=>gl(e),onTimeZoneChange:d=>{e.usageTimeZone=d},onToggleContextExpanded:()=>{e.usageContextExpanded=!e.usageContextExpanded},onToggleSessionLogsExpanded:()=>{e.usageSessionLogsExpanded=!e.usageSessionLogsExpanded},onLogFilterRolesChange:d=>{e.usageLogFilterRoles=d},onLogFilterToolsChange:d=>{e.usageLogFilterTools=d},onLogFilterHasToolsChange:d=>{e.usageLogFilterHasTools=d},onLogFilterQueryChange:d=>{e.usageLogFilterQuery=d},onLogFilterClear:()=>{e.usageLogFilterRoles=[],e.usageLogFilterTools=[],e.usageLogFilterHasTools=!1,e.usageLogFilterQuery=""},onToggleHeaderPinned:()=>{e.usageHeaderPinned=!e.usageHeaderPinned},onSelectHour:(d,f)=>{if(f&&e.usageSelectedHours.length>0){const m=Array.from({length:24},(A,C)=>C),S=e.usageSelectedHours[e.usageSelectedHours.length-1],k=m.indexOf(S),$=m.indexOf(d);if(k!==-1&&$!==-1){const[A,C]=k<$?[k,$]:[$,k],_=m.slice(A,C+1);e.usageSelectedHours=[...new Set([...e.usageSelectedHours,..._])]}}else e.usageSelectedHours.includes(d)?e.usageSelectedHours=e.usageSelectedHours.filter(m=>m!==d):e.usageSelectedHours=[...e.usageSelectedHours,d]},onQueryDraftChange:d=>{e.usageQueryDraft=d,e.usageQueryDebounceTimer&&window.clearTimeout(e.usageQueryDebounceTimer),e.usageQueryDebounceTimer=window.setTimeout(()=>{e.usageQuery=e.usageQueryDraft,e.usageQueryDebounceTimer=null},250)},onApplyQuery:()=>{e.usageQueryDebounceTimer&&(window.clearTimeout(e.usageQueryDebounceTimer),e.usageQueryDebounceTimer=null),e.usageQuery=e.usageQueryDraft},onClearQuery:()=>{e.usageQueryDebounceTimer&&(window.clearTimeout(e.usageQueryDebounceTimer),e.usageQueryDebounceTimer=null),e.usageQueryDraft="",e.usageQuery=""},onSessionSortChange:d=>{e.usageSessionSort=d},onSessionSortDirChange:d=>{e.usageSessionSortDir=d},onSessionsTabChange:d=>{e.usageSessionsTab=d},onToggleColumn:d=>{e.usageVisibleColumns.includes(d)?e.usageVisibleColumns=e.usageVisibleColumns.filter(f=>f!==d):e.usageVisibleColumns=[...e.usageVisibleColumns,d]},onSelectSession:(d,f)=>{if(e.usageTimeSeries=null,e.usageSessionLogs=null,e.usageRecentSessions=[d,...e.usageRecentSessions.filter(m=>m!==d)].slice(0,8),f&&e.usageSelectedSessions.length>0){const m=e.usageChartMode==="tokens",k=[...e.usageResult?.sessions??[]].toSorted((_,T)=>{const I=m?_.usage?.totalTokens??0:_.usage?.totalCost??0;return(m?T.usage?.totalTokens??0:T.usage?.totalCost??0)-I}).map(_=>_.key),$=e.usageSelectedSessions[e.usageSelectedSessions.length-1],A=k.indexOf($),C=k.indexOf(d);if(A!==-1&&C!==-1){const[_,T]=A<C?[A,C]:[C,A],I=k.slice(_,T+1),z=[...new Set([...e.usageSelectedSessions,...I])];e.usageSelectedSessions=z}}else e.usageSelectedSessions.length===1&&e.usageSelectedSessions[0]===d?e.usageSelectedSessions=[]:e.usageSelectedSessions=[d];e.usageSelectedSessions.length===1&&(zg(e,e.usageSelectedSessions[0]),Hg(e,e.usageSelectedSessions[0]))},onSelectDay:(d,f)=>{if(f&&e.usageSelectedDays.length>0){const m=(e.usageCostSummary?.daily??[]).map(A=>A.date),S=e.usageSelectedDays[e.usageSelectedDays.length-1],k=m.indexOf(S),$=m.indexOf(d);if(k!==-1&&$!==-1){const[A,C]=k<$?[k,$]:[$,k],_=m.slice(A,C+1),T=[...new Set([...e.usageSelectedDays,..._])];e.usageSelectedDays=T}}else e.usageSelectedDays.includes(d)?e.usageSelectedDays=e.usageSelectedDays.filter(m=>m!==d):e.usageSelectedDays=[d]},onChartModeChange:d=>{e.usageChartMode=d},onDailyChartModeChange:d=>{e.usageDailyChartMode=d},onTimeSeriesModeChange:d=>{e.usageTimeSeriesMode=d},onTimeSeriesBreakdownChange:d=>{e.usageTimeSeriesBreakdownMode=d},onClearDays:()=>{e.usageSelectedDays=[]},onClearHours:()=>{e.usageSelectedHours=[]},onClearSessions:()=>{e.usageSelectedSessions=[],e.usageTimeSeries=null,e.usageSessionLogs=null},onClearFilters:()=>{e.usageSelectedDays=[],e.usageSelectedHours=[],e.usageSelectedSessions=[],e.usageTimeSeries=null,e.usageSessionLogs=null}}):v}
7578
7579
 
7579
- ${e.tab==="cron"?bv({basePath:e.basePath,loading:e.cronLoading,status:e.cronStatus,jobs:e.cronJobs,error:e.cronError,busy:e.cronBusy,form:e.cronForm,channels:e.channelsSnapshot?.channelMeta?.length?e.channelsSnapshot.channelMeta.map(d=>d.id):e.channelsSnapshot?.channelOrder??[],channelLabels:e.channelsSnapshot?.channelLabels??{},channelMeta:e.channelsSnapshot?.channelMeta??[],runsJobId:e.cronRunsJobId,runs:e.cronRuns,onFormChange:d=>e.cronForm={...e.cronForm,...d},onRefresh:()=>e.loadCron(),onAdd:()=>od(e),onToggle:(d,f)=>rd(e,d,f),onRun:d=>ld(e,d),onRemove:d=>cd(e,d),onLoadRuns:d=>$r(e,d)}):v}
7580
+ ${e.tab==="cron"?Rv({basePath:e.basePath,loading:e.cronLoading,status:e.cronStatus,jobs:e.cronJobs,error:e.cronError,busy:e.cronBusy,form:e.cronForm,channels:e.channelsSnapshot?.channelMeta?.length?e.channelsSnapshot.channelMeta.map(d=>d.id):e.channelsSnapshot?.channelOrder??[],channelLabels:e.channelsSnapshot?.channelLabels??{},channelMeta:e.channelsSnapshot?.channelMeta??[],runsJobId:e.cronRunsJobId,runs:e.cronRuns,onFormChange:d=>e.cronForm={...e.cronForm,...d},onRefresh:()=>e.loadCron(),onAdd:()=>vd(e),onToggle:(d,f)=>md(e,d,f),onRun:d=>bd(e,d),onRemove:d=>yd(e,d),onLoadRuns:d=>Cr(e,d)}):v}
7580
7581
 
7581
- ${e.tab==="agents"?Xg({loading:e.agentsLoading,error:e.agentsError,agentsList:e.agentsList,selectedAgentId:h,activePanel:e.agentsPanel,configForm:g,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configFormDirty,channelsLoading:e.channelsLoading,channelsError:e.channelsError,channelsSnapshot:e.channelsSnapshot,channelsLastSuccess:e.channelsLastSuccess,cronLoading:e.cronLoading,cronStatus:e.cronStatus,cronJobs:e.cronJobs,cronError:e.cronError,agentFilesLoading:e.agentFilesLoading,agentFilesError:e.agentFilesError,agentFilesList:e.agentFilesList,agentFileActive:e.agentFileActive,agentFileContents:e.agentFileContents,agentFileDrafts:e.agentFileDrafts,agentFileSaving:e.agentFileSaving,agentIdentityLoading:e.agentIdentityLoading,agentIdentityError:e.agentIdentityError,agentIdentityById:e.agentIdentityById,agentSkillsLoading:e.agentSkillsLoading,agentSkillsReport:e.agentSkillsReport,agentSkillsError:e.agentSkillsError,agentSkillsAgentId:e.agentSkillsAgentId,skillsFilter:e.skillsFilter,onRefresh:async()=>{await Mi(e);const d=e.agentsList?.agents?.map(f=>f.id)??[];d.length>0&&yr(e,d)},onSelectAgent:d=>{e.agentsSelectedId!==d&&(e.agentsSelectedId=d,e.agentFilesList=null,e.agentFilesError=null,e.agentFilesLoading=!1,e.agentFileActive=null,e.agentFileContents={},e.agentFileDrafts={},e.agentSkillsReport=null,e.agentSkillsError=null,e.agentSkillsAgentId=null,br(e,d),e.agentsPanel==="files"&&Rs(e,d),e.agentsPanel==="skills"&&In(e,d))},onSelectPanel:d=>{e.agentsPanel=d,d==="files"&&h&&e.agentFilesList?.agentId!==h&&(e.agentFilesList=null,e.agentFilesError=null,e.agentFileActive=null,e.agentFileContents={},e.agentFileDrafts={},Rs(e,h)),d==="skills"&&h&&In(e,h),d==="channels"&&ye(e,!1),d==="cron"&&e.loadCron()},onLoadFiles:d=>Rs(e,d),onSelectFile:d=>{e.agentFileActive=d,h&&Eg(e,h,d)},onFileDraftChange:(d,f)=>{e.agentFileDrafts={...e.agentFileDrafts,[d]:f}},onFileReset:d=>{const f=e.agentFileContents[d]??"";e.agentFileDrafts={...e.agentFileDrafts,[d]:f}},onFileSave:d=>{if(!h)return;const f=e.agentFileDrafts[d]??e.agentFileContents[d]??"";Lg(e,h,d,f)},onToolsProfileChange:(d,f,m)=>{if(!g)return;const S=g.agents?.list;if(!Array.isArray(S))return;const k=S.findIndex(A=>A&&typeof A=="object"&&"id"in A&&A.id===d);if(k<0)return;const $=["agents","list",k,"tools"];f?$e(e,[...$,"profile"],f):ze(e,[...$,"profile"]),m&&ze(e,[...$,"allow"])},onToolsOverridesChange:(d,f,m)=>{if(!g)return;const S=g.agents?.list;if(!Array.isArray(S))return;const k=S.findIndex(A=>A&&typeof A=="object"&&"id"in A&&A.id===d);if(k<0)return;const $=["agents","list",k,"tools"];f.length>0?$e(e,[...$,"alsoAllow"],f):ze(e,[...$,"alsoAllow"]),m.length>0?$e(e,[...$,"deny"],m):ze(e,[...$,"deny"])},onConfigReload:()=>Ee(e),onConfigSave:()=>Mn(e),onChannelsRefresh:()=>ye(e,!1),onCronRefresh:()=>e.loadCron(),onSkillsFilterChange:d=>e.skillsFilter=d,onSkillsRefresh:()=>{h&&In(e,h)},onAgentSkillToggle:(d,f,m)=>{if(!g)return;const S=g.agents?.list;if(!Array.isArray(S))return;const k=S.findIndex(z=>z&&typeof z=="object"&&"id"in z&&z.id===d);if(k<0)return;const $=S[k],A=f.trim();if(!A)return;const C=e.agentSkillsReport?.skills?.map(z=>z.name).filter(Boolean)??[],T=(Array.isArray($.skills)?$.skills.map(z=>String(z).trim()).filter(Boolean):void 0)??C,I=new Set(T);m?I.add(A):I.delete(A),$e(e,["agents","list",k,"skills"],[...I])},onAgentSkillsClear:d=>{if(!g)return;const f=g.agents?.list;if(!Array.isArray(f))return;const m=f.findIndex(S=>S&&typeof S=="object"&&"id"in S&&S.id===d);m<0||ze(e,["agents","list",m,"skills"])},onAgentSkillsDisableAll:d=>{if(!g)return;const f=g.agents?.list;if(!Array.isArray(f))return;const m=f.findIndex(S=>S&&typeof S=="object"&&"id"in S&&S.id===d);m<0||$e(e,["agents","list",m,"skills"],[])},onModelChange:(d,f)=>{if(!g)return;const m=g.agents?.list;if(!Array.isArray(m))return;const S=m.findIndex(C=>C&&typeof C=="object"&&"id"in C&&C.id===d);if(S<0)return;const k=["agents","list",S,"model"];if(!f){ze(e,k);return}const A=m[S]?.model;if(A&&typeof A=="object"&&!Array.isArray(A)){const C=A.fallbacks,_={primary:f,...Array.isArray(C)?{fallbacks:C}:{}};$e(e,k,_)}else $e(e,k,f)},onModelFallbacksChange:(d,f)=>{if(!g)return;const m=g.agents?.list;if(!Array.isArray(m))return;const S=m.findIndex(z=>z&&typeof z=="object"&&"id"in z&&z.id===d);if(S<0)return;const k=["agents","list",S,"model"],$=m[S],A=f.map(z=>z.trim()).filter(Boolean),C=$.model,T=(()=>{if(typeof C=="string")return C.trim()||null;if(C&&typeof C=="object"&&!Array.isArray(C)){const z=C.primary;if(typeof z=="string")return z.trim()||null}return null})();if(A.length===0){T?$e(e,k,T):ze(e,k);return}$e(e,k,T?{primary:T,fallbacks:A}:{fallbacks:A})}}):v}
7582
+ ${e.tab==="agents"?cp({loading:e.agentsLoading,error:e.agentsError,agentsList:e.agentsList,selectedAgentId:h,activePanel:e.agentsPanel,configForm:g,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configFormDirty,channelsLoading:e.channelsLoading,channelsError:e.channelsError,channelsSnapshot:e.channelsSnapshot,channelsLastSuccess:e.channelsLastSuccess,cronLoading:e.cronLoading,cronStatus:e.cronStatus,cronJobs:e.cronJobs,cronError:e.cronError,agentFilesLoading:e.agentFilesLoading,agentFilesError:e.agentFilesError,agentFilesList:e.agentFilesList,agentFileActive:e.agentFileActive,agentFileContents:e.agentFileContents,agentFileDrafts:e.agentFileDrafts,agentFileSaving:e.agentFileSaving,agentIdentityLoading:e.agentIdentityLoading,agentIdentityError:e.agentIdentityError,agentIdentityById:e.agentIdentityById,agentSkillsLoading:e.agentSkillsLoading,agentSkillsReport:e.agentSkillsReport,agentSkillsError:e.agentSkillsError,agentSkillsAgentId:e.agentSkillsAgentId,skillsFilter:e.skillsFilter,onRefresh:async()=>{await Ii(e);const d=e.agentsList?.agents?.map(f=>f.id)??[];d.length>0&&Sr(e,d)},onSelectAgent:d=>{e.agentsSelectedId!==d&&(e.agentsSelectedId=d,e.agentFilesList=null,e.agentFilesError=null,e.agentFilesLoading=!1,e.agentFileActive=null,e.agentFileContents={},e.agentFileDrafts={},e.agentSkillsReport=null,e.agentSkillsError=null,e.agentSkillsAgentId=null,kr(e,d),e.agentsPanel==="files"&&Ps(e,d),e.agentsPanel==="skills"&&Pn(e,d))},onSelectPanel:d=>{e.agentsPanel=d,d==="files"&&h&&e.agentFilesList?.agentId!==h&&(e.agentFilesList=null,e.agentFilesError=null,e.agentFileActive=null,e.agentFileContents={},e.agentFileDrafts={},Ps(e,h)),d==="skills"&&h&&Pn(e,h),d==="channels"&&ye(e,!1),d==="cron"&&e.loadCron()},onLoadFiles:d=>Ps(e,d),onSelectFile:d=>{e.agentFileActive=d,h&&Bg(e,h,d)},onFileDraftChange:(d,f)=>{e.agentFileDrafts={...e.agentFileDrafts,[d]:f}},onFileReset:d=>{const f=e.agentFileContents[d]??"";e.agentFileDrafts={...e.agentFileDrafts,[d]:f}},onFileSave:d=>{if(!h)return;const f=e.agentFileDrafts[d]??e.agentFileContents[d]??"";Ug(e,h,d,f)},onToolsProfileChange:(d,f,m)=>{if(!g)return;const S=g.agents?.list;if(!Array.isArray(S))return;const k=S.findIndex(A=>A&&typeof A=="object"&&"id"in A&&A.id===d);if(k<0)return;const $=["agents","list",k,"tools"];f?$e(e,[...$,"profile"],f):ze(e,[...$,"profile"]),m&&ze(e,[...$,"allow"])},onToolsOverridesChange:(d,f,m)=>{if(!g)return;const S=g.agents?.list;if(!Array.isArray(S))return;const k=S.findIndex(A=>A&&typeof A=="object"&&"id"in A&&A.id===d);if(k<0)return;const $=["agents","list",k,"tools"];f.length>0?$e(e,[...$,"alsoAllow"],f):ze(e,[...$,"alsoAllow"]),m.length>0?$e(e,[...$,"deny"],m):ze(e,[...$,"deny"])},onConfigReload:()=>Le(e),onConfigSave:()=>Rn(e),onChannelsRefresh:()=>ye(e,!1),onCronRefresh:()=>e.loadCron(),onSkillsFilterChange:d=>e.skillsFilter=d,onSkillsRefresh:()=>{h&&Pn(e,h)},onAgentSkillToggle:(d,f,m)=>{if(!g)return;const S=g.agents?.list;if(!Array.isArray(S))return;const k=S.findIndex(z=>z&&typeof z=="object"&&"id"in z&&z.id===d);if(k<0)return;const $=S[k],A=f.trim();if(!A)return;const C=e.agentSkillsReport?.skills?.map(z=>z.name).filter(Boolean)??[],T=(Array.isArray($.skills)?$.skills.map(z=>String(z).trim()).filter(Boolean):void 0)??C,I=new Set(T);m?I.add(A):I.delete(A),$e(e,["agents","list",k,"skills"],[...I])},onAgentSkillsClear:d=>{if(!g)return;const f=g.agents?.list;if(!Array.isArray(f))return;const m=f.findIndex(S=>S&&typeof S=="object"&&"id"in S&&S.id===d);m<0||ze(e,["agents","list",m,"skills"])},onAgentSkillsDisableAll:d=>{if(!g)return;const f=g.agents?.list;if(!Array.isArray(f))return;const m=f.findIndex(S=>S&&typeof S=="object"&&"id"in S&&S.id===d);m<0||$e(e,["agents","list",m,"skills"],[])},onModelChange:(d,f)=>{if(!g)return;const m=g.agents?.list;if(!Array.isArray(m))return;const S=m.findIndex(C=>C&&typeof C=="object"&&"id"in C&&C.id===d);if(S<0)return;const k=["agents","list",S,"model"];if(!f){ze(e,k);return}const A=m[S]?.model;if(A&&typeof A=="object"&&!Array.isArray(A)){const C=A.fallbacks,_={primary:f,...Array.isArray(C)?{fallbacks:C}:{}};$e(e,k,_)}else $e(e,k,f)},onModelFallbacksChange:(d,f)=>{if(!g)return;const m=g.agents?.list;if(!Array.isArray(m))return;const S=m.findIndex(z=>z&&typeof z=="object"&&"id"in z&&z.id===d);if(S<0)return;const k=["agents","list",S,"model"],$=m[S],A=f.map(z=>z.trim()).filter(Boolean),C=$.model,T=(()=>{if(typeof C=="string")return C.trim()||null;if(C&&typeof C=="object"&&!Array.isArray(C)){const z=C.primary;if(typeof z=="string")return z.trim()||null}return null})();if(A.length===0){T?$e(e,k,T):ze(e,k);return}$e(e,k,T?{primary:T,fallbacks:A}:{fallbacks:A})}}):v}
7582
7583
 
7583
- ${e.tab==="skills"?mm({loading:e.skillsLoading,report:e.skillsReport,error:e.skillsError,filter:e.skillsFilter,edits:e.skillEdits,messages:e.skillMessages,busyKey:e.skillsBusyKey,onFilterChange:d=>e.skillsFilter=d,onRefresh:()=>rn(e,{clearMessages:!0}),onToggle:(d,f)=>Yd(e,d,f),onEdit:(d,f)=>Qd(e,d,f),onSaveKey:d=>Jd(e,d),onInstall:(d,f,m)=>Zd(e,d,f,m)}):v}
7584
+ ${e.tab==="skills"?Im({loading:e.skillsLoading,report:e.skillsReport,error:e.skillsError,filter:e.skillsFilter,edits:e.skillEdits,messages:e.skillMessages,busyKey:e.skillsBusyKey,onFilterChange:d=>e.skillsFilter=d,onRefresh:()=>cn(e,{clearMessages:!0}),onToggle:(d,f)=>ou(e,d,f),onEdit:(d,f)=>au(e,d,f),onSaveKey:d=>ru(e,d),onInstall:(d,f,m)=>lu(e,d,f,m)}):v}
7584
7585
 
7585
- ${e.tab==="nodes"?Rv({loading:e.nodesLoading,nodes:e.nodes,devicesLoading:e.devicesLoading,devicesError:e.devicesError,devicesList:e.devicesList,configForm:e.configForm??e.configSnapshot?.config,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configFormDirty,configFormMode:e.configFormMode,execApprovalsLoading:e.execApprovalsLoading,execApprovalsSaving:e.execApprovalsSaving,execApprovalsDirty:e.execApprovalsDirty,execApprovalsSnapshot:e.execApprovalsSnapshot,execApprovalsForm:e.execApprovalsForm,execApprovalsSelectedAgent:e.execApprovalsSelectedAgent,execApprovalsTarget:e.execApprovalsTarget,execApprovalsTargetNodeId:e.execApprovalsTargetNodeId,onRefresh:()=>Zn(e),onDevicesRefresh:()=>Ze(e),onDeviceApprove:d=>Nd(e,d),onDeviceReject:d=>Od(e,d),onDeviceRotate:(d,f,m)=>Bd(e,{deviceId:d,role:f,scopes:m}),onDeviceRevoke:(d,f)=>Ud(e,{deviceId:d,role:f}),onLoadConfig:()=>Ee(e),onLoadExecApprovals:()=>{const d=e.execApprovalsTarget==="node"&&e.execApprovalsTargetNodeId?{kind:"node",nodeId:e.execApprovalsTargetNodeId}:{kind:"gateway"};return Ui(e,d)},onBindDefault:d=>{d?$e(e,["tools","exec","node"],d):ze(e,["tools","exec","node"])},onBindAgent:(d,f)=>{const m=["agents","list",d,"tools","exec","node"];f?$e(e,m,f):ze(e,m)},onSaveBindings:()=>Mn(e),onExecApprovalsTargetChange:(d,f)=>{e.execApprovalsTarget=d,e.execApprovalsTargetNodeId=f,e.execApprovalsSnapshot=null,e.execApprovalsForm=null,e.execApprovalsDirty=!1,e.execApprovalsSelectedAgent=null},onExecApprovalsSelectAgent:d=>{e.execApprovalsSelectedAgent=d},onExecApprovalsPatch:(d,f)=>Wd(e,d,f),onExecApprovalsRemove:d=>qd(e,d),onSaveExecApprovals:()=>{const d=e.execApprovalsTarget==="node"&&e.execApprovalsTargetNodeId?{kind:"node",nodeId:e.execApprovalsTargetNodeId}:{kind:"gateway"};return Kd(e,d)}}):v}
7586
+ ${e.tab==="nodes"?Vv({loading:e.nodesLoading,nodes:e.nodes,devicesLoading:e.devicesLoading,devicesError:e.devicesError,devicesList:e.devicesList,configForm:e.configForm??e.configSnapshot?.config,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configFormDirty,configFormMode:e.configFormMode,execApprovalsLoading:e.execApprovalsLoading,execApprovalsSaving:e.execApprovalsSaving,execApprovalsDirty:e.execApprovalsDirty,execApprovalsSnapshot:e.execApprovalsSnapshot,execApprovalsForm:e.execApprovalsForm,execApprovalsSelectedAgent:e.execApprovalsSelectedAgent,execApprovalsTarget:e.execApprovalsTarget,execApprovalsTargetNodeId:e.execApprovalsTargetNodeId,onRefresh:()=>es(e),onDevicesRefresh:()=>Xe(e),onDeviceApprove:d=>Gd(e,d),onDeviceReject:d=>Vd(e,d),onDeviceRotate:(d,f,m)=>Qd(e,{deviceId:d,role:f,scopes:m}),onDeviceRevoke:(d,f)=>Yd(e,{deviceId:d,role:f}),onLoadConfig:()=>Le(e),onLoadExecApprovals:()=>{const d=e.execApprovalsTarget==="node"&&e.execApprovalsTargetNodeId?{kind:"node",nodeId:e.execApprovalsTargetNodeId}:{kind:"gateway"};return zi(e,d)},onBindDefault:d=>{d?$e(e,["tools","exec","node"],d):ze(e,["tools","exec","node"])},onBindAgent:(d,f)=>{const m=["agents","list",d,"tools","exec","node"];f?$e(e,m,f):ze(e,m)},onSaveBindings:()=>Rn(e),onExecApprovalsTargetChange:(d,f)=>{e.execApprovalsTarget=d,e.execApprovalsTargetNodeId=f,e.execApprovalsSnapshot=null,e.execApprovalsForm=null,e.execApprovalsDirty=!1,e.execApprovalsSelectedAgent=null},onExecApprovalsSelectAgent:d=>{e.execApprovalsSelectedAgent=d},onExecApprovalsPatch:(d,f)=>tu(e,d,f),onExecApprovalsRemove:d=>nu(e,d),onSaveExecApprovals:()=>{const d=e.execApprovalsTarget==="node"&&e.execApprovalsTargetNodeId?{kind:"node",nodeId:e.execApprovalsTargetNodeId}:{kind:"gateway"};return eu(e,d)}}):v}
7586
7587
 
7587
- ${e.tab==="chat"?cv({sessionKey:e.sessionKey,onSessionKeyChange:d=>{e.sessionKey=d,e.chatMessage="",e.chatAttachments=[],e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.chatQueue=[],e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:d,lastActiveSessionKey:d}),e.loadAssistantIdentity(),nn(e),si(e)},thinkingLevel:e.chatThinkingLevel,showThinking:l,loading:e.chatLoading,sending:e.chatSending,compactionStatus:e.compactionStatus,assistantAvatarUrl:u,messages:e.chatMessages,toolMessages:e.chatToolMessages,stream:e.chatStream,streamStartedAt:e.chatStreamStartedAt,draft:e.chatMessage,queue:e.chatQueue,connected:e.connected,canSend:e.connected,disabledReason:i,error:e.lastError,sessions:e.sessionsResult,focusMode:o,onRefresh:()=>(e.resetToolStream(),Promise.all([nn(e),si(e)])),onToggleFocusMode:()=>{e.onboarding||e.applySettings({...e.settings,chatFocusMode:!e.settings.chatFocusMode})},onChatScroll:d=>e.handleChatScroll(d),onDraftChange:d=>e.chatMessage=d,attachments:e.chatAttachments,onAttachmentsChange:d=>e.chatAttachments=d,onSend:()=>e.handleSendChat(),canAbort:!!e.chatRunId,onAbort:()=>{e.handleAbortChat()},onQueueRemove:d=>e.removeQueuedMessage(d),onNewSession:()=>e.handleSendChat("/new",{restoreDraft:!0}),showNewMessages:e.chatNewMessagesBelow&&!e.chatManualRefreshInFlight,onScrollToBottom:()=>e.scrollToBottom(),sidebarOpen:e.sidebarOpen,sidebarContent:e.sidebarContent,sidebarError:e.sidebarError,splitRatio:e.splitRatio,onOpenSidebar:d=>e.handleOpenSidebar(d),onCloseSidebar:()=>e.handleCloseSidebar(),onSplitRatioChange:d=>e.handleSplitRatioChange(d),assistantName:e.assistantName,assistantAvatar:e.assistantAvatar}):v}
7588
+ ${e.tab==="chat"?Sv({sessionKey:e.sessionKey,onSessionKeyChange:d=>{e.sessionKey=d,e.chatMessage="",e.chatAttachments=[],e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.chatQueue=[],e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:d,lastActiveSessionKey:d}),e.loadAssistantIdentity(),an(e),si(e)},thinkingLevel:e.chatThinkingLevel,showThinking:l,loading:e.chatLoading,sending:e.chatSending,compactionStatus:e.compactionStatus,assistantAvatarUrl:u,messages:e.chatMessages,toolMessages:e.chatToolMessages,stream:e.chatStream,streamStartedAt:e.chatStreamStartedAt,draft:e.chatMessage,queue:e.chatQueue,connected:e.connected,canSend:e.connected,disabledReason:i,error:e.lastError,sessions:e.sessionsResult,focusMode:o,onRefresh:()=>(e.resetToolStream(),Promise.all([an(e),si(e)])),onToggleFocusMode:()=>{e.onboarding||e.applySettings({...e.settings,chatFocusMode:!e.settings.chatFocusMode})},onChatScroll:d=>e.handleChatScroll(d),onDraftChange:d=>e.chatMessage=d,attachments:e.chatAttachments,onAttachmentsChange:d=>e.chatAttachments=d,onSend:()=>e.handleSendChat(),canAbort:!!e.chatRunId,onAbort:()=>{e.handleAbortChat()},onQueueRemove:d=>e.removeQueuedMessage(d),onNewSession:()=>e.handleSendChat("/new",{restoreDraft:!0}),showNewMessages:e.chatNewMessagesBelow&&!e.chatManualRefreshInFlight,onScrollToBottom:()=>e.scrollToBottom(),sidebarOpen:e.sidebarOpen,sidebarContent:e.sidebarContent,sidebarError:e.sidebarError,splitRatio:e.splitRatio,onOpenSidebar:d=>e.handleOpenSidebar(d),onCloseSidebar:()=>e.handleCloseSidebar(),onSplitRatioChange:d=>e.handleSplitRatioChange(d),assistantName:e.assistantName,assistantAvatar:e.assistantAvatar}):v}
7588
7589
 
7589
- ${e.tab==="config"?hv({raw:e.configRaw,originalRaw:e.configRawOriginal,valid:e.configValid,issues:e.configIssues,loading:e.configLoading,saving:e.configSaving,applying:e.configApplying,updating:e.updateRunning,connected:e.connected,schema:e.configSchema,schemaLoading:e.configSchemaLoading,uiHints:e.configUiHints,formMode:e.configFormMode,formValue:e.configForm,originalValue:e.configFormOriginal,searchQuery:e.configSearchQuery,activeSection:e.configActiveSection,activeSubsection:e.configActiveSubsection,onRawChange:d=>{e.configRaw=d},onFormModeChange:d=>e.configFormMode=d,onFormPatch:(d,f)=>$e(e,d,f),onSearchChange:d=>e.configSearchQuery=d,onSectionChange:d=>{e.configActiveSection=d,e.configActiveSubsection=null},onSubsectionChange:d=>e.configActiveSubsection=d,onReload:()=>Ee(e),onSave:()=>Mn(e),onApply:()=>Cc(e),onUpdate:()=>Tc(e)}):v}
7590
+ ${e.tab==="config"?Lv({raw:e.configRaw,originalRaw:e.configRawOriginal,valid:e.configValid,issues:e.configIssues,loading:e.configLoading,saving:e.configSaving,applying:e.configApplying,updating:e.updateRunning,connected:e.connected,schema:e.configSchema,schemaLoading:e.configSchemaLoading,uiHints:e.configUiHints,formMode:e.configFormMode,formValue:e.configForm,originalValue:e.configFormOriginal,searchQuery:e.configSearchQuery,activeSection:e.configActiveSection,activeSubsection:e.configActiveSubsection,onRawChange:d=>{e.configRaw=d},onFormModeChange:d=>e.configFormMode=d,onFormPatch:(d,f)=>$e(e,d,f),onSearchChange:d=>e.configSearchQuery=d,onSectionChange:d=>{e.configActiveSection=d,e.configActiveSubsection=null},onSubsectionChange:d=>e.configActiveSubsection=d,onReload:()=>Le(e),onSave:()=>Rn(e),onApply:()=>Dc(e),onUpdate:()=>Fc(e)}):v}
7590
7591
 
7591
- ${e.tab==="debug"?Sv({loading:e.debugLoading,status:e.debugStatus,health:e.debugHealth,models:e.debugModels,heartbeat:e.debugHeartbeat,eventLog:e.eventLog,callMethod:e.debugCallMethod,callParams:e.debugCallParams,callResult:e.debugCallResult,callError:e.debugCallError,onCallMethodChange:d=>e.debugCallMethod=d,onCallParamsChange:d=>e.debugCallParams=d,onRefresh:()=>Jn(e),onCall:()=>Gc(e)}):v}
7592
+ ${e.tab==="debug"?Bv({loading:e.debugLoading,status:e.debugStatus,health:e.debugHealth,models:e.debugModels,heartbeat:e.debugHeartbeat,eventLog:e.eventLog,callMethod:e.debugCallMethod,callParams:e.debugCallParams,callResult:e.debugCallResult,callError:e.debugCallError,onCallMethodChange:d=>e.debugCallMethod=d,onCallParamsChange:d=>e.debugCallParams=d,onRefresh:()=>Xn(e),onCall:()=>sd(e)}):v}
7592
7593
 
7593
- ${e.tab==="logs"?Iv({loading:e.logsLoading,error:e.logsError,file:e.logsFile,entries:e.logsEntries,filterText:e.logsFilterText,levelFilters:e.logsLevelFilters,autoFollow:e.logsAutoFollow,truncated:e.logsTruncated,onFilterTextChange:d=>e.logsFilterText=d,onLevelToggle:(d,f)=>{e.logsLevelFilters={...e.logsLevelFilters,[d]:f}},onToggleAutoFollow:d=>e.logsAutoFollow=d,onRefresh:()=>Ci(e,{reset:!0}),onExport:(d,f)=>e.exportLogs(d,f),onScroll:d=>e.handleLogsScroll(d)}):v}
7594
+ ${e.tab==="logs"?Gv({loading:e.logsLoading,error:e.logsError,file:e.logsFile,entries:e.logsEntries,filterText:e.logsFilterText,levelFilters:e.logsLevelFilters,autoFollow:e.logsAutoFollow,truncated:e.logsTruncated,onFilterTextChange:d=>e.logsFilterText=d,onLevelToggle:(d,f)=>{e.logsLevelFilters={...e.logsLevelFilters,[d]:f}},onToggleAutoFollow:d=>e.logsAutoFollow=d,onRefresh:()=>Ti(e,{reset:!0}),onExport:(d,f)=>e.exportLogs(d,f),onScroll:d=>e.handleLogsScroll(d)}):v}
7594
7595
  </main>
7595
- ${Cv(e)}
7596
- ${Tv(e)}
7596
+ ${zv(e)}
7597
+ ${Hv(e)}
7597
7598
  </div>
7598
- `}var ob=Object.defineProperty,rb=Object.getOwnPropertyDescriptor,x=(e,t,n,s)=>{for(var i=s>1?void 0:s?rb(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(s?o(t,n,i):o(i))||i);return s&&i&&ob(t,n,i),i};const Ws=eg();function lb(){if(!window.location.search)return!1;const t=new URLSearchParams(window.location.search).get("onboarding");if(!t)return!1;const n=t.trim().toLowerCase();return n==="1"||n==="true"||n==="yes"||n==="on"}let y=class extends _t{constructor(){super(...arguments),this.settings=su(),this.password="",this.tab="chat",this.onboarding=lb(),this.connected=!1,this.theme=this.settings.theme??"system",this.themeResolved="dark",this.hello=null,this.lastError=null,this.eventLog=[],this.eventLogBuffer=[],this.toolStreamSyncTimer=null,this.sidebarCloseTimer=null,this.assistantName=Ws.name,this.assistantAvatar=Ws.avatar,this.assistantAgentId=Ws.agentId??null,this.sessionKey=this.settings.sessionKey,this.chatLoading=!1,this.chatSending=!1,this.chatMessage="",this.chatMessages=[],this.chatToolMessages=[],this.chatStream=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.compactionStatus=null,this.chatAvatarUrl=null,this.chatThinkingLevel=null,this.chatQueue=[],this.chatAttachments=[],this.chatManualRefreshInFlight=!1,this.sidebarOpen=!1,this.sidebarContent=null,this.sidebarError=null,this.splitRatio=this.settings.splitRatio,this.nodesLoading=!1,this.nodes=[],this.devicesLoading=!1,this.devicesError=null,this.devicesList=null,this.execApprovalsLoading=!1,this.execApprovalsSaving=!1,this.execApprovalsDirty=!1,this.execApprovalsSnapshot=null,this.execApprovalsForm=null,this.execApprovalsSelectedAgent=null,this.execApprovalsTarget="gateway",this.execApprovalsTargetNodeId=null,this.execApprovalQueue=[],this.execApprovalBusy=!1,this.execApprovalError=null,this.pendingGatewayUrl=null,this.configLoading=!1,this.configRaw=`{
7599
+ `}var $b=Object.defineProperty,wb=Object.getOwnPropertyDescriptor,x=(e,t,n,s)=>{for(var i=s>1?void 0:s?wb(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(s?o(t,n,i):o(i))||i);return s&&i&&$b(t,n,i),i};const qs=dg();function kb(){if(!window.location.search)return!1;const t=new URLSearchParams(window.location.search).get("onboarding");if(!t)return!1;const n=t.trim().toLowerCase();return n==="1"||n==="true"||n==="yes"||n==="on"}let y=class extends Lt{constructor(){super(...arguments),this.settings=pu(),this.password="",this.tab="chat",this.onboarding=kb(),this.connected=!1,this.theme=this.settings.theme??"system",this.themeResolved="dark",this.hello=null,this.lastError=null,this.eventLog=[],this.eventLogBuffer=[],this.toolStreamSyncTimer=null,this.sidebarCloseTimer=null,this.assistantName=qs.name,this.assistantAvatar=qs.avatar,this.assistantAgentId=qs.agentId??null,this.sessionKey=this.settings.sessionKey,this.chatLoading=!1,this.chatSending=!1,this.chatMessage="",this.chatMessages=[],this.chatToolMessages=[],this.chatStream=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.compactionStatus=null,this.chatAvatarUrl=null,this.chatThinkingLevel=null,this.chatQueue=[],this.chatAttachments=[],this.chatManualRefreshInFlight=!1,this.sidebarOpen=!1,this.sidebarContent=null,this.sidebarError=null,this.splitRatio=this.settings.splitRatio,this.nodesLoading=!1,this.nodes=[],this.devicesLoading=!1,this.devicesError=null,this.devicesList=null,this.execApprovalsLoading=!1,this.execApprovalsSaving=!1,this.execApprovalsDirty=!1,this.execApprovalsSnapshot=null,this.execApprovalsForm=null,this.execApprovalsSelectedAgent=null,this.execApprovalsTarget="gateway",this.execApprovalsTargetNodeId=null,this.execApprovalQueue=[],this.execApprovalBusy=!1,this.execApprovalError=null,this.pendingGatewayUrl=null,this.configLoading=!1,this.configRaw=`{
7599
7600
  }
7600
- `,this.configRawOriginal="",this.configValid=null,this.configIssues=[],this.configSaving=!1,this.configApplying=!1,this.updateRunning=!1,this.applySessionKey=this.settings.lastActiveSessionKey,this.configSnapshot=null,this.configSchema=null,this.configSchemaVersion=null,this.configSchemaLoading=!1,this.configUiHints={},this.configForm=null,this.configFormOriginal=null,this.configFormDirty=!1,this.configFormMode="form",this.configSearchQuery="",this.configActiveSection=null,this.configActiveSubsection=null,this.channelsLoading=!1,this.channelsSnapshot=null,this.channelsError=null,this.channelsLastSuccess=null,this.whatsappLoginMessage=null,this.whatsappLoginQrDataUrl=null,this.whatsappLoginConnected=null,this.whatsappBusy=!1,this.nostrProfileFormState=null,this.nostrProfileAccountId=null,this.presenceLoading=!1,this.presenceEntries=[],this.presenceError=null,this.presenceStatus=null,this.agentsLoading=!1,this.agentsList=null,this.agentsError=null,this.agentsSelectedId=null,this.agentsPanel="overview",this.agentFilesLoading=!1,this.agentFilesError=null,this.agentFilesList=null,this.agentFileContents={},this.agentFileDrafts={},this.agentFileActive=null,this.agentFileSaving=!1,this.agentIdentityLoading=!1,this.agentIdentityError=null,this.agentIdentityById={},this.agentSkillsLoading=!1,this.agentSkillsError=null,this.agentSkillsReport=null,this.agentSkillsAgentId=null,this.sessionsLoading=!1,this.sessionsResult=null,this.sessionsError=null,this.sessionsFilterActive="",this.sessionsFilterLimit="120",this.sessionsIncludeGlobal=!0,this.sessionsIncludeUnknown=!1,this.usageLoading=!1,this.usageResult=null,this.usageCostSummary=null,this.usageError=null,this.usageStartDate=(()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`})(),this.usageEndDate=(()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`})(),this.usageSelectedSessions=[],this.usageSelectedDays=[],this.usageSelectedHours=[],this.usageChartMode="tokens",this.usageDailyChartMode="by-type",this.usageTimeSeriesMode="per-turn",this.usageTimeSeriesBreakdownMode="by-type",this.usageTimeSeries=null,this.usageTimeSeriesLoading=!1,this.usageSessionLogs=null,this.usageSessionLogsLoading=!1,this.usageSessionLogsExpanded=!1,this.usageQuery="",this.usageQueryDraft="",this.usageSessionSort="recent",this.usageSessionSortDir="desc",this.usageRecentSessions=[],this.usageTimeZone="local",this.usageContextExpanded=!1,this.usageHeaderPinned=!1,this.usageSessionsTab="all",this.usageVisibleColumns=["channel","agent","provider","model","messages","tools","errors","duration"],this.usageLogFilterRoles=[],this.usageLogFilterTools=[],this.usageLogFilterHasTools=!1,this.usageLogFilterQuery="",this.usageQueryDebounceTimer=null,this.cronLoading=!1,this.cronJobs=[],this.cronStatus=null,this.cronError=null,this.cronForm={...Yu},this.cronRunsJobId=null,this.cronRuns=[],this.cronBusy=!1,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.debugLoading=!1,this.debugStatus=null,this.debugHealth=null,this.debugModels=[],this.debugHeartbeat=null,this.debugCallMethod="",this.debugCallParams="{}",this.debugCallResult=null,this.debugCallError=null,this.logsLoading=!1,this.logsError=null,this.logsFile=null,this.logsEntries=[],this.logsFilterText="",this.logsLevelFilters={...Qu},this.logsAutoFollow=!0,this.logsTruncated=!1,this.logsCursor=null,this.logsLastFetchAt=null,this.logsLimit=500,this.logsMaxBytes=25e4,this.logsAtBottom=!0,this.client=null,this.chatScrollFrame=null,this.chatScrollTimeout=null,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.chatNewMessagesBelow=!1,this.nodesPollInterval=null,this.logsPollInterval=null,this.debugPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.refreshSessionsAfterChat=new Set,this.basePath="",this.popStateHandler=()=>vu(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),ug(this)}firstUpdated(){gg(this)}disconnectedCallback(){pg(this),super.disconnectedCallback()}updated(e){fg(this,e)}connect(){il(this)}handleChatScroll(e){jc(this,e)}handleLogsScroll(e){Kc(this,e)}exportLogs(e,t){Wc(e,t)}resetToolStream(){is(this)}resetChatScroll(){Ba(this)}scrollToBottom(e){Ba(this),an(this,!0,!!e?.smooth)}async loadAssistantIdentity(){await tl(this)}applySettings(e){Ye(this,e)}setTab(e){cu(this,e)}setTheme(e,t){du(this,e,t)}async loadOverview(){await Gr(this)}async loadCron(){await Un(this)}async handleAbortChat(){await Jr(this)}removeQueuedMessage(e){Ku(this,e)}async handleSendChat(e,t){await Wu(this,e,t)}async handleWhatsAppStart(e){await Mc(this,e)}async handleWhatsAppWait(){await Ic(this)}async handleWhatsAppLogout(){await Rc(this)}async handleChannelConfigSave(){await Pc(this)}async handleChannelConfigReload(){await Dc(this)}handleNostrProfileEdit(e,t){Nc(this,e,t)}handleNostrProfileCancel(){Oc(this)}handleNostrProfileFieldChange(e,t){Bc(this,e,t)}async handleNostrProfileSave(){await zc(this)}async handleNostrProfileImport(){await Hc(this)}handleNostrProfileToggleAdvanced(){Uc(this)}async handleExecApprovalDecision(e){const t=this.execApprovalQueue[0];if(!(!t||!this.client||this.execApprovalBusy)){this.execApprovalBusy=!0,this.execApprovalError=null;try{await this.client.request("exec.approval.resolve",{id:t.id,decision:e}),this.execApprovalQueue=this.execApprovalQueue.filter(n=>n.id!==t.id)}catch(n){this.execApprovalError=`Exec approval failed: ${String(n)}`}finally{this.execApprovalBusy=!1}}}handleGatewayUrlConfirm(){const e=this.pendingGatewayUrl;e&&(this.pendingGatewayUrl=null,Ye(this,{...this.settings,gatewayUrl:e}),this.connect())}handleGatewayUrlCancel(){this.pendingGatewayUrl=null}handleOpenSidebar(e){this.sidebarCloseTimer!=null&&(window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=null),this.sidebarContent=e,this.sidebarError=null,this.sidebarOpen=!0}handleCloseSidebar(){this.sidebarOpen=!1,this.sidebarCloseTimer!=null&&window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=window.setTimeout(()=>{this.sidebarOpen||(this.sidebarContent=null,this.sidebarError=null,this.sidebarCloseTimer=null)},200)}handleSplitRatioChange(e){const t=Math.max(.4,Math.min(.7,e));this.splitRatio=t,this.applySettings({...this.settings,splitRatio:t})}render(){return ab(this)}};x([w()],y.prototype,"settings",2);x([w()],y.prototype,"password",2);x([w()],y.prototype,"tab",2);x([w()],y.prototype,"onboarding",2);x([w()],y.prototype,"connected",2);x([w()],y.prototype,"theme",2);x([w()],y.prototype,"themeResolved",2);x([w()],y.prototype,"hello",2);x([w()],y.prototype,"lastError",2);x([w()],y.prototype,"eventLog",2);x([w()],y.prototype,"assistantName",2);x([w()],y.prototype,"assistantAvatar",2);x([w()],y.prototype,"assistantAgentId",2);x([w()],y.prototype,"sessionKey",2);x([w()],y.prototype,"chatLoading",2);x([w()],y.prototype,"chatSending",2);x([w()],y.prototype,"chatMessage",2);x([w()],y.prototype,"chatMessages",2);x([w()],y.prototype,"chatToolMessages",2);x([w()],y.prototype,"chatStream",2);x([w()],y.prototype,"chatStreamStartedAt",2);x([w()],y.prototype,"chatRunId",2);x([w()],y.prototype,"compactionStatus",2);x([w()],y.prototype,"chatAvatarUrl",2);x([w()],y.prototype,"chatThinkingLevel",2);x([w()],y.prototype,"chatQueue",2);x([w()],y.prototype,"chatAttachments",2);x([w()],y.prototype,"chatManualRefreshInFlight",2);x([w()],y.prototype,"sidebarOpen",2);x([w()],y.prototype,"sidebarContent",2);x([w()],y.prototype,"sidebarError",2);x([w()],y.prototype,"splitRatio",2);x([w()],y.prototype,"nodesLoading",2);x([w()],y.prototype,"nodes",2);x([w()],y.prototype,"devicesLoading",2);x([w()],y.prototype,"devicesError",2);x([w()],y.prototype,"devicesList",2);x([w()],y.prototype,"execApprovalsLoading",2);x([w()],y.prototype,"execApprovalsSaving",2);x([w()],y.prototype,"execApprovalsDirty",2);x([w()],y.prototype,"execApprovalsSnapshot",2);x([w()],y.prototype,"execApprovalsForm",2);x([w()],y.prototype,"execApprovalsSelectedAgent",2);x([w()],y.prototype,"execApprovalsTarget",2);x([w()],y.prototype,"execApprovalsTargetNodeId",2);x([w()],y.prototype,"execApprovalQueue",2);x([w()],y.prototype,"execApprovalBusy",2);x([w()],y.prototype,"execApprovalError",2);x([w()],y.prototype,"pendingGatewayUrl",2);x([w()],y.prototype,"configLoading",2);x([w()],y.prototype,"configRaw",2);x([w()],y.prototype,"configRawOriginal",2);x([w()],y.prototype,"configValid",2);x([w()],y.prototype,"configIssues",2);x([w()],y.prototype,"configSaving",2);x([w()],y.prototype,"configApplying",2);x([w()],y.prototype,"updateRunning",2);x([w()],y.prototype,"applySessionKey",2);x([w()],y.prototype,"configSnapshot",2);x([w()],y.prototype,"configSchema",2);x([w()],y.prototype,"configSchemaVersion",2);x([w()],y.prototype,"configSchemaLoading",2);x([w()],y.prototype,"configUiHints",2);x([w()],y.prototype,"configForm",2);x([w()],y.prototype,"configFormOriginal",2);x([w()],y.prototype,"configFormDirty",2);x([w()],y.prototype,"configFormMode",2);x([w()],y.prototype,"configSearchQuery",2);x([w()],y.prototype,"configActiveSection",2);x([w()],y.prototype,"configActiveSubsection",2);x([w()],y.prototype,"channelsLoading",2);x([w()],y.prototype,"channelsSnapshot",2);x([w()],y.prototype,"channelsError",2);x([w()],y.prototype,"channelsLastSuccess",2);x([w()],y.prototype,"whatsappLoginMessage",2);x([w()],y.prototype,"whatsappLoginQrDataUrl",2);x([w()],y.prototype,"whatsappLoginConnected",2);x([w()],y.prototype,"whatsappBusy",2);x([w()],y.prototype,"nostrProfileFormState",2);x([w()],y.prototype,"nostrProfileAccountId",2);x([w()],y.prototype,"presenceLoading",2);x([w()],y.prototype,"presenceEntries",2);x([w()],y.prototype,"presenceError",2);x([w()],y.prototype,"presenceStatus",2);x([w()],y.prototype,"agentsLoading",2);x([w()],y.prototype,"agentsList",2);x([w()],y.prototype,"agentsError",2);x([w()],y.prototype,"agentsSelectedId",2);x([w()],y.prototype,"agentsPanel",2);x([w()],y.prototype,"agentFilesLoading",2);x([w()],y.prototype,"agentFilesError",2);x([w()],y.prototype,"agentFilesList",2);x([w()],y.prototype,"agentFileContents",2);x([w()],y.prototype,"agentFileDrafts",2);x([w()],y.prototype,"agentFileActive",2);x([w()],y.prototype,"agentFileSaving",2);x([w()],y.prototype,"agentIdentityLoading",2);x([w()],y.prototype,"agentIdentityError",2);x([w()],y.prototype,"agentIdentityById",2);x([w()],y.prototype,"agentSkillsLoading",2);x([w()],y.prototype,"agentSkillsError",2);x([w()],y.prototype,"agentSkillsReport",2);x([w()],y.prototype,"agentSkillsAgentId",2);x([w()],y.prototype,"sessionsLoading",2);x([w()],y.prototype,"sessionsResult",2);x([w()],y.prototype,"sessionsError",2);x([w()],y.prototype,"sessionsFilterActive",2);x([w()],y.prototype,"sessionsFilterLimit",2);x([w()],y.prototype,"sessionsIncludeGlobal",2);x([w()],y.prototype,"sessionsIncludeUnknown",2);x([w()],y.prototype,"usageLoading",2);x([w()],y.prototype,"usageResult",2);x([w()],y.prototype,"usageCostSummary",2);x([w()],y.prototype,"usageError",2);x([w()],y.prototype,"usageStartDate",2);x([w()],y.prototype,"usageEndDate",2);x([w()],y.prototype,"usageSelectedSessions",2);x([w()],y.prototype,"usageSelectedDays",2);x([w()],y.prototype,"usageSelectedHours",2);x([w()],y.prototype,"usageChartMode",2);x([w()],y.prototype,"usageDailyChartMode",2);x([w()],y.prototype,"usageTimeSeriesMode",2);x([w()],y.prototype,"usageTimeSeriesBreakdownMode",2);x([w()],y.prototype,"usageTimeSeries",2);x([w()],y.prototype,"usageTimeSeriesLoading",2);x([w()],y.prototype,"usageSessionLogs",2);x([w()],y.prototype,"usageSessionLogsLoading",2);x([w()],y.prototype,"usageSessionLogsExpanded",2);x([w()],y.prototype,"usageQuery",2);x([w()],y.prototype,"usageQueryDraft",2);x([w()],y.prototype,"usageSessionSort",2);x([w()],y.prototype,"usageSessionSortDir",2);x([w()],y.prototype,"usageRecentSessions",2);x([w()],y.prototype,"usageTimeZone",2);x([w()],y.prototype,"usageContextExpanded",2);x([w()],y.prototype,"usageHeaderPinned",2);x([w()],y.prototype,"usageSessionsTab",2);x([w()],y.prototype,"usageVisibleColumns",2);x([w()],y.prototype,"usageLogFilterRoles",2);x([w()],y.prototype,"usageLogFilterTools",2);x([w()],y.prototype,"usageLogFilterHasTools",2);x([w()],y.prototype,"usageLogFilterQuery",2);x([w()],y.prototype,"cronLoading",2);x([w()],y.prototype,"cronJobs",2);x([w()],y.prototype,"cronStatus",2);x([w()],y.prototype,"cronError",2);x([w()],y.prototype,"cronForm",2);x([w()],y.prototype,"cronRunsJobId",2);x([w()],y.prototype,"cronRuns",2);x([w()],y.prototype,"cronBusy",2);x([w()],y.prototype,"skillsLoading",2);x([w()],y.prototype,"skillsReport",2);x([w()],y.prototype,"skillsError",2);x([w()],y.prototype,"skillsFilter",2);x([w()],y.prototype,"skillEdits",2);x([w()],y.prototype,"skillsBusyKey",2);x([w()],y.prototype,"skillMessages",2);x([w()],y.prototype,"debugLoading",2);x([w()],y.prototype,"debugStatus",2);x([w()],y.prototype,"debugHealth",2);x([w()],y.prototype,"debugModels",2);x([w()],y.prototype,"debugHeartbeat",2);x([w()],y.prototype,"debugCallMethod",2);x([w()],y.prototype,"debugCallParams",2);x([w()],y.prototype,"debugCallResult",2);x([w()],y.prototype,"debugCallError",2);x([w()],y.prototype,"logsLoading",2);x([w()],y.prototype,"logsError",2);x([w()],y.prototype,"logsFile",2);x([w()],y.prototype,"logsEntries",2);x([w()],y.prototype,"logsFilterText",2);x([w()],y.prototype,"logsLevelFilters",2);x([w()],y.prototype,"logsAutoFollow",2);x([w()],y.prototype,"logsTruncated",2);x([w()],y.prototype,"logsCursor",2);x([w()],y.prototype,"logsLastFetchAt",2);x([w()],y.prototype,"logsLimit",2);x([w()],y.prototype,"logsMaxBytes",2);x([w()],y.prototype,"logsAtBottom",2);x([w()],y.prototype,"chatNewMessagesBelow",2);y=x([dr("openclaw-app")],y);
7601
- //# sourceMappingURL=index-CnB9IO4a.js.map
7601
+ `,this.configRawOriginal="",this.configValid=null,this.configIssues=[],this.configSaving=!1,this.configApplying=!1,this.updateRunning=!1,this.applySessionKey=this.settings.lastActiveSessionKey,this.configSnapshot=null,this.configSchema=null,this.configSchemaVersion=null,this.configSchemaLoading=!1,this.configUiHints={},this.configForm=null,this.configFormOriginal=null,this.configFormDirty=!1,this.configFormMode="form",this.configSearchQuery="",this.configActiveSection=null,this.configActiveSubsection=null,this.channelsLoading=!1,this.channelsSnapshot=null,this.channelsError=null,this.channelsLastSuccess=null,this.whatsappLoginMessage=null,this.whatsappLoginQrDataUrl=null,this.whatsappLoginConnected=null,this.whatsappBusy=!1,this.nostrProfileFormState=null,this.nostrProfileAccountId=null,this.presenceLoading=!1,this.presenceEntries=[],this.presenceError=null,this.presenceStatus=null,this.agentsLoading=!1,this.agentsList=null,this.agentsError=null,this.agentsSelectedId=null,this.agentsPanel="overview",this.agentFilesLoading=!1,this.agentFilesError=null,this.agentFilesList=null,this.agentFileContents={},this.agentFileDrafts={},this.agentFileActive=null,this.agentFileSaving=!1,this.agentIdentityLoading=!1,this.agentIdentityError=null,this.agentIdentityById={},this.agentSkillsLoading=!1,this.agentSkillsError=null,this.agentSkillsReport=null,this.agentSkillsAgentId=null,this.sessionsLoading=!1,this.sessionsResult=null,this.sessionsError=null,this.sessionsFilterActive="",this.sessionsFilterLimit="120",this.sessionsIncludeGlobal=!0,this.sessionsIncludeUnknown=!1,this.usageLoading=!1,this.usageResult=null,this.usageCostSummary=null,this.usageError=null,this.usageStartDate=(()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`})(),this.usageEndDate=(()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`})(),this.usageSelectedSessions=[],this.usageSelectedDays=[],this.usageSelectedHours=[],this.usageChartMode="tokens",this.usageDailyChartMode="by-type",this.usageTimeSeriesMode="per-turn",this.usageTimeSeriesBreakdownMode="by-type",this.usageTimeSeries=null,this.usageTimeSeriesLoading=!1,this.usageSessionLogs=null,this.usageSessionLogsLoading=!1,this.usageSessionLogsExpanded=!1,this.usageQuery="",this.usageQueryDraft="",this.usageSessionSort="recent",this.usageSessionSortDir="desc",this.usageRecentSessions=[],this.usageTimeZone="local",this.usageContextExpanded=!1,this.usageHeaderPinned=!1,this.usageSessionsTab="all",this.usageVisibleColumns=["channel","agent","provider","model","messages","tools","errors","duration"],this.usageLogFilterRoles=[],this.usageLogFilterTools=[],this.usageLogFilterHasTools=!1,this.usageLogFilterQuery="",this.usageQueryDebounceTimer=null,this.cronLoading=!1,this.cronJobs=[],this.cronStatus=null,this.cronError=null,this.cronForm={...og},this.cronRunsJobId=null,this.cronRuns=[],this.cronBusy=!1,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.debugLoading=!1,this.debugStatus=null,this.debugHealth=null,this.debugModels=[],this.debugHeartbeat=null,this.debugCallMethod="",this.debugCallParams="{}",this.debugCallResult=null,this.debugCallError=null,this.logsLoading=!1,this.logsError=null,this.logsFile=null,this.logsEntries=[],this.logsFilterText="",this.logsLevelFilters={...ag},this.logsAutoFollow=!0,this.logsTruncated=!1,this.logsCursor=null,this.logsLastFetchAt=null,this.logsLimit=500,this.logsMaxBytes=25e4,this.logsAtBottom=!0,this.client=null,this.chatScrollFrame=null,this.chatScrollTimeout=null,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.chatNewMessagesBelow=!1,this.nodesPollInterval=null,this.logsPollInterval=null,this.debugPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.refreshSessionsAfterChat=new Set,this.basePath="",this.popStateHandler=()=>Cu(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),$g(this)}firstUpdated(){wg(this)}disconnectedCallback(){kg(this),super.disconnectedCallback()}updated(e){Sg(this,e)}connect(){cl(this)}handleChatScroll(e){Xc(this,e)}handleLogsScroll(e){ed(this,e)}exportLogs(e,t){td(e,t)}resetToolStream(){os(this)}resetChatScroll(){Ha(this)}scrollToBottom(e){Ha(this),rn(this,!0,!!e?.smooth)}async loadAssistantIdentity(){await ol(this)}applySettings(e){Je(this,e)}setTab(e){yu(this,e)}setTheme(e,t){xu(this,e,t)}async loadOverview(){await Zr(this)}async loadCron(){await Hn(this)}async handleAbortChat(){await nl(this)}removeQueuedMessage(e){eg(this,e)}async handleSendChat(e,t){await tg(this,e,t)}async handleWhatsAppStart(e){await Uc(this,e)}async handleWhatsAppWait(){await zc(this)}async handleWhatsAppLogout(){await Hc(this)}async handleChannelConfigSave(){await jc(this)}async handleChannelConfigReload(){await Kc(this)}handleNostrProfileEdit(e,t){Gc(this,e,t)}handleNostrProfileCancel(){Vc(this)}handleNostrProfileFieldChange(e,t){Qc(this,e,t)}async handleNostrProfileSave(){await Jc(this)}async handleNostrProfileImport(){await Zc(this)}handleNostrProfileToggleAdvanced(){Yc(this)}async handleExecApprovalDecision(e){const t=this.execApprovalQueue[0];if(!(!t||!this.client||this.execApprovalBusy)){this.execApprovalBusy=!0,this.execApprovalError=null;try{await this.client.request("exec.approval.resolve",{id:t.id,decision:e}),this.execApprovalQueue=this.execApprovalQueue.filter(n=>n.id!==t.id)}catch(n){this.execApprovalError=`Exec approval failed: ${String(n)}`}finally{this.execApprovalBusy=!1}}}handleGatewayUrlConfirm(){const e=this.pendingGatewayUrl;e&&(this.pendingGatewayUrl=null,Je(this,{...this.settings,gatewayUrl:e}),this.connect())}handleGatewayUrlCancel(){this.pendingGatewayUrl=null}handleOpenSidebar(e){this.sidebarCloseTimer!=null&&(window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=null),this.sidebarContent=e,this.sidebarError=null,this.sidebarOpen=!0}handleCloseSidebar(){this.sidebarOpen=!1,this.sidebarCloseTimer!=null&&window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=window.setTimeout(()=>{this.sidebarOpen||(this.sidebarContent=null,this.sidebarError=null,this.sidebarCloseTimer=null)},200)}handleSplitRatioChange(e){const t=Math.max(.4,Math.min(.7,e));this.splitRatio=t,this.applySettings({...this.settings,splitRatio:t})}render(){return xb(this)}};x([w()],y.prototype,"settings",2);x([w()],y.prototype,"password",2);x([w()],y.prototype,"tab",2);x([w()],y.prototype,"onboarding",2);x([w()],y.prototype,"connected",2);x([w()],y.prototype,"theme",2);x([w()],y.prototype,"themeResolved",2);x([w()],y.prototype,"hello",2);x([w()],y.prototype,"lastError",2);x([w()],y.prototype,"eventLog",2);x([w()],y.prototype,"assistantName",2);x([w()],y.prototype,"assistantAvatar",2);x([w()],y.prototype,"assistantAgentId",2);x([w()],y.prototype,"sessionKey",2);x([w()],y.prototype,"chatLoading",2);x([w()],y.prototype,"chatSending",2);x([w()],y.prototype,"chatMessage",2);x([w()],y.prototype,"chatMessages",2);x([w()],y.prototype,"chatToolMessages",2);x([w()],y.prototype,"chatStream",2);x([w()],y.prototype,"chatStreamStartedAt",2);x([w()],y.prototype,"chatRunId",2);x([w()],y.prototype,"compactionStatus",2);x([w()],y.prototype,"chatAvatarUrl",2);x([w()],y.prototype,"chatThinkingLevel",2);x([w()],y.prototype,"chatQueue",2);x([w()],y.prototype,"chatAttachments",2);x([w()],y.prototype,"chatManualRefreshInFlight",2);x([w()],y.prototype,"sidebarOpen",2);x([w()],y.prototype,"sidebarContent",2);x([w()],y.prototype,"sidebarError",2);x([w()],y.prototype,"splitRatio",2);x([w()],y.prototype,"nodesLoading",2);x([w()],y.prototype,"nodes",2);x([w()],y.prototype,"devicesLoading",2);x([w()],y.prototype,"devicesError",2);x([w()],y.prototype,"devicesList",2);x([w()],y.prototype,"execApprovalsLoading",2);x([w()],y.prototype,"execApprovalsSaving",2);x([w()],y.prototype,"execApprovalsDirty",2);x([w()],y.prototype,"execApprovalsSnapshot",2);x([w()],y.prototype,"execApprovalsForm",2);x([w()],y.prototype,"execApprovalsSelectedAgent",2);x([w()],y.prototype,"execApprovalsTarget",2);x([w()],y.prototype,"execApprovalsTargetNodeId",2);x([w()],y.prototype,"execApprovalQueue",2);x([w()],y.prototype,"execApprovalBusy",2);x([w()],y.prototype,"execApprovalError",2);x([w()],y.prototype,"pendingGatewayUrl",2);x([w()],y.prototype,"configLoading",2);x([w()],y.prototype,"configRaw",2);x([w()],y.prototype,"configRawOriginal",2);x([w()],y.prototype,"configValid",2);x([w()],y.prototype,"configIssues",2);x([w()],y.prototype,"configSaving",2);x([w()],y.prototype,"configApplying",2);x([w()],y.prototype,"updateRunning",2);x([w()],y.prototype,"applySessionKey",2);x([w()],y.prototype,"configSnapshot",2);x([w()],y.prototype,"configSchema",2);x([w()],y.prototype,"configSchemaVersion",2);x([w()],y.prototype,"configSchemaLoading",2);x([w()],y.prototype,"configUiHints",2);x([w()],y.prototype,"configForm",2);x([w()],y.prototype,"configFormOriginal",2);x([w()],y.prototype,"configFormDirty",2);x([w()],y.prototype,"configFormMode",2);x([w()],y.prototype,"configSearchQuery",2);x([w()],y.prototype,"configActiveSection",2);x([w()],y.prototype,"configActiveSubsection",2);x([w()],y.prototype,"channelsLoading",2);x([w()],y.prototype,"channelsSnapshot",2);x([w()],y.prototype,"channelsError",2);x([w()],y.prototype,"channelsLastSuccess",2);x([w()],y.prototype,"whatsappLoginMessage",2);x([w()],y.prototype,"whatsappLoginQrDataUrl",2);x([w()],y.prototype,"whatsappLoginConnected",2);x([w()],y.prototype,"whatsappBusy",2);x([w()],y.prototype,"nostrProfileFormState",2);x([w()],y.prototype,"nostrProfileAccountId",2);x([w()],y.prototype,"presenceLoading",2);x([w()],y.prototype,"presenceEntries",2);x([w()],y.prototype,"presenceError",2);x([w()],y.prototype,"presenceStatus",2);x([w()],y.prototype,"agentsLoading",2);x([w()],y.prototype,"agentsList",2);x([w()],y.prototype,"agentsError",2);x([w()],y.prototype,"agentsSelectedId",2);x([w()],y.prototype,"agentsPanel",2);x([w()],y.prototype,"agentFilesLoading",2);x([w()],y.prototype,"agentFilesError",2);x([w()],y.prototype,"agentFilesList",2);x([w()],y.prototype,"agentFileContents",2);x([w()],y.prototype,"agentFileDrafts",2);x([w()],y.prototype,"agentFileActive",2);x([w()],y.prototype,"agentFileSaving",2);x([w()],y.prototype,"agentIdentityLoading",2);x([w()],y.prototype,"agentIdentityError",2);x([w()],y.prototype,"agentIdentityById",2);x([w()],y.prototype,"agentSkillsLoading",2);x([w()],y.prototype,"agentSkillsError",2);x([w()],y.prototype,"agentSkillsReport",2);x([w()],y.prototype,"agentSkillsAgentId",2);x([w()],y.prototype,"sessionsLoading",2);x([w()],y.prototype,"sessionsResult",2);x([w()],y.prototype,"sessionsError",2);x([w()],y.prototype,"sessionsFilterActive",2);x([w()],y.prototype,"sessionsFilterLimit",2);x([w()],y.prototype,"sessionsIncludeGlobal",2);x([w()],y.prototype,"sessionsIncludeUnknown",2);x([w()],y.prototype,"usageLoading",2);x([w()],y.prototype,"usageResult",2);x([w()],y.prototype,"usageCostSummary",2);x([w()],y.prototype,"usageError",2);x([w()],y.prototype,"usageStartDate",2);x([w()],y.prototype,"usageEndDate",2);x([w()],y.prototype,"usageSelectedSessions",2);x([w()],y.prototype,"usageSelectedDays",2);x([w()],y.prototype,"usageSelectedHours",2);x([w()],y.prototype,"usageChartMode",2);x([w()],y.prototype,"usageDailyChartMode",2);x([w()],y.prototype,"usageTimeSeriesMode",2);x([w()],y.prototype,"usageTimeSeriesBreakdownMode",2);x([w()],y.prototype,"usageTimeSeries",2);x([w()],y.prototype,"usageTimeSeriesLoading",2);x([w()],y.prototype,"usageSessionLogs",2);x([w()],y.prototype,"usageSessionLogsLoading",2);x([w()],y.prototype,"usageSessionLogsExpanded",2);x([w()],y.prototype,"usageQuery",2);x([w()],y.prototype,"usageQueryDraft",2);x([w()],y.prototype,"usageSessionSort",2);x([w()],y.prototype,"usageSessionSortDir",2);x([w()],y.prototype,"usageRecentSessions",2);x([w()],y.prototype,"usageTimeZone",2);x([w()],y.prototype,"usageContextExpanded",2);x([w()],y.prototype,"usageHeaderPinned",2);x([w()],y.prototype,"usageSessionsTab",2);x([w()],y.prototype,"usageVisibleColumns",2);x([w()],y.prototype,"usageLogFilterRoles",2);x([w()],y.prototype,"usageLogFilterTools",2);x([w()],y.prototype,"usageLogFilterHasTools",2);x([w()],y.prototype,"usageLogFilterQuery",2);x([w()],y.prototype,"cronLoading",2);x([w()],y.prototype,"cronJobs",2);x([w()],y.prototype,"cronStatus",2);x([w()],y.prototype,"cronError",2);x([w()],y.prototype,"cronForm",2);x([w()],y.prototype,"cronRunsJobId",2);x([w()],y.prototype,"cronRuns",2);x([w()],y.prototype,"cronBusy",2);x([w()],y.prototype,"skillsLoading",2);x([w()],y.prototype,"skillsReport",2);x([w()],y.prototype,"skillsError",2);x([w()],y.prototype,"skillsFilter",2);x([w()],y.prototype,"skillEdits",2);x([w()],y.prototype,"skillsBusyKey",2);x([w()],y.prototype,"skillMessages",2);x([w()],y.prototype,"debugLoading",2);x([w()],y.prototype,"debugStatus",2);x([w()],y.prototype,"debugHealth",2);x([w()],y.prototype,"debugModels",2);x([w()],y.prototype,"debugHeartbeat",2);x([w()],y.prototype,"debugCallMethod",2);x([w()],y.prototype,"debugCallParams",2);x([w()],y.prototype,"debugCallResult",2);x([w()],y.prototype,"debugCallError",2);x([w()],y.prototype,"logsLoading",2);x([w()],y.prototype,"logsError",2);x([w()],y.prototype,"logsFile",2);x([w()],y.prototype,"logsEntries",2);x([w()],y.prototype,"logsFilterText",2);x([w()],y.prototype,"logsLevelFilters",2);x([w()],y.prototype,"logsAutoFollow",2);x([w()],y.prototype,"logsTruncated",2);x([w()],y.prototype,"logsCursor",2);x([w()],y.prototype,"logsLastFetchAt",2);x([w()],y.prototype,"logsLimit",2);x([w()],y.prototype,"logsMaxBytes",2);x([w()],y.prototype,"logsAtBottom",2);x([w()],y.prototype,"chatNewMessagesBelow",2);y=x([gr("openclaw-app")],y);
7602
+ //# sourceMappingURL=index-BECn2L1T.js.map