@xopcai/xopc 0.0.401 → 0.0.403

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 (381) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/feishu/src/pairing/feishu-pairing-prompt.js +2 -2
  3. package/dist/extensions/feishu/src/plugin.js +2 -2
  4. package/dist/extensions/feishu/src/transport/socket-mode/monitor.js +1 -1
  5. package/dist/extensions/feishu/src/transport/webhook/monitor.js +1 -1
  6. package/dist/extensions/feishu/src/workflow-progress.js +1 -1
  7. package/dist/extensions/telegram/src/adapters/outbound-adapter.js +1 -1
  8. package/dist/extensions/telegram/src/adapters/security-adapter.js +1 -1
  9. package/dist/extensions/telegram/src/adapters/streaming-adapter.js +2 -2
  10. package/dist/extensions/telegram/src/command-handler.js +1 -1
  11. package/dist/extensions/telegram/src/doctor.js +2 -2
  12. package/dist/extensions/telegram/src/draft-stream.js +1 -1
  13. package/dist/extensions/telegram/src/exec-approval-handler.js +1 -1
  14. package/dist/extensions/telegram/src/focus-handler.js +1 -1
  15. package/dist/extensions/telegram/src/inbound-processor.js +6 -6
  16. package/dist/extensions/telegram/src/outbound-sender.js +3 -3
  17. package/dist/extensions/telegram/src/pairing-config-resolver.js +1 -1
  18. package/dist/extensions/telegram/src/plugin.js +24 -24
  19. package/dist/extensions/telegram/xopc.extension.json +1 -1
  20. package/dist/extensions/weixin/src/api/api.js +1 -1
  21. package/dist/extensions/weixin/src/messaging/process-message.js +1 -1
  22. package/dist/extensions/weixin/src/pairing-config-resolver.js +1 -1
  23. package/dist/extensions/weixin/src/plugin.js +2 -2
  24. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-ByXMoFsY.js → agent-avatar-dicebear-BibqpRFi.js} +1 -1
  25. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-DTWNXsbp.js → agent-defaults-settings-panel-Dj5XE9fO.js} +1 -1
  26. package/dist/gateway/static/root/assets/{agents-CaB8tdC-.js → agents-HpKwxi9M.js} +3 -3
  27. package/dist/gateway/static/root/assets/{app-management-settings-panel-X9szJlYD.js → app-management-settings-panel-cRzpsDIP.js} +1 -1
  28. package/dist/gateway/static/root/assets/{appearance-settings-BfE1yedW.js → appearance-settings-BKnQuWtS.js} +1 -1
  29. package/dist/gateway/static/root/assets/{apps-page-B4temKvg.js → apps-page-B_4AiHMy.js} +1 -1
  30. package/dist/gateway/static/root/assets/{archive-plugin-PQHi2w72.js → archive-plugin-Duhsr1eD.js} +1 -1
  31. package/dist/gateway/static/root/assets/{automations-page-KIyLxqyX.js → automations-page-OfEhd4vL.js} +1 -1
  32. package/dist/gateway/static/root/assets/{automations-workspace-C99c2Mps.js → automations-workspace-DyNAy5A1.js} +1 -1
  33. package/dist/gateway/static/root/assets/{binary-plugins-DPDgIi0y.js → binary-plugins-BDsjWsNb.js} +1 -1
  34. package/dist/gateway/static/root/assets/{block-editor-BL6uYJRu.js → block-editor-D_wE8D8_.js} +1 -1
  35. package/dist/gateway/static/root/assets/{browser-automation-inputs-BMe7eqyS.js → browser-automation-inputs-DlqyI0ez.js} +1 -1
  36. package/dist/gateway/static/root/assets/{browser-automations-page-Cxy3o5SG.js → browser-automations-page-BlSVIXB6.js} +1 -1
  37. package/dist/gateway/static/root/assets/{browser-settings-page-Dn-LW9q4.js → browser-settings-page-BuGBM-PJ.js} +1 -1
  38. package/dist/gateway/static/root/assets/{capabilities-page-CHWxG2ns.js → capabilities-page-CYWBkGj0.js} +2 -2
  39. package/dist/gateway/static/root/assets/{capabilities-settings-panel-Da9ak03p.js → capabilities-settings-panel-CWoM2AZn.js} +1 -1
  40. package/dist/gateway/static/root/assets/{capability-header-actions-WRaPQFq0.js → capability-header-actions-DCxxOLIt.js} +1 -1
  41. package/dist/gateway/static/root/assets/{channels-Cx2WkRWN.js → channels-DEB1AYkM.js} +1 -1
  42. package/dist/gateway/static/root/assets/{chat-terminal-dock-63FqSsS_.js → chat-terminal-dock-B0g-YEQo.js} +1 -1
  43. package/dist/gateway/static/root/assets/{computer-settings-page-Cr6u_6gd.js → computer-settings-page-DNI0SuC-.js} +1 -1
  44. package/dist/gateway/static/root/assets/{connector-service-page-FJwMon8U.js → connector-service-page-CDR35YqB.js} +1 -1
  45. package/dist/gateway/static/root/assets/{connectors-page-BBH388aG.js → connectors-page-CW2vHnSK.js} +1 -1
  46. package/dist/gateway/static/root/assets/{date-picker-D5Xit3eb.js → date-picker-B88pKWvd.js} +1 -1
  47. package/dist/gateway/static/root/assets/{dependency-picker-1aJOOQPo.js → dependency-picker-ChpYlt2j.js} +1 -1
  48. package/dist/gateway/static/root/assets/{desktop-pet-ggDJ99Z6.js → desktop-pet-17hqnL87.js} +1 -1
  49. package/dist/gateway/static/root/assets/{desktop-pet-settings-ChfLbqqO.js → desktop-pet-settings-3jN8S9Zu.js} +1 -1
  50. package/dist/gateway/static/root/assets/{device-pairing-wizard-3OvOHf6N.js → device-pairing-wizard-DIcqqq97.js} +1 -1
  51. package/dist/gateway/static/root/assets/{directory-picker-path-field-ummF1SFe.js → directory-picker-path-field-CFBLUC-2.js} +1 -1
  52. package/dist/gateway/static/root/assets/{extension-debug-page-SmrPvYO6.js → extension-debug-page-CRjY1QeU.js} +1 -1
  53. package/dist/gateway/static/root/assets/{extension-page-CGVGUA3i.js → extension-page-or5zrKc7.js} +1 -1
  54. package/dist/gateway/static/root/assets/{extension-settings-page-nns2sDcu.js → extension-settings-page-X8kI665r.js} +1 -1
  55. package/dist/gateway/static/root/assets/{gateway-settings-CFhtbGZh.js → gateway-settings-BT6ZMqA4.js} +1 -1
  56. package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-BOfrdIh2.js → highlighted-body-KQOG7T2V-CL6ZYfP_.js} +1 -1
  57. package/dist/gateway/static/root/assets/{home-page-GtF10ylS.js → home-page-MxealTDk.js} +1 -1
  58. package/dist/gateway/static/root/assets/{image-generation-api-D0EUiJdS.js → image-generation-api-DPcsBPX7.js} +1 -1
  59. package/dist/gateway/static/root/assets/{imports-page-CoQLVDRZ.js → imports-page-Cpuq7Ri0.js} +1 -1
  60. package/dist/gateway/static/root/assets/{index-Cmrvxc_s.js → index-CzkAd5Su.js} +8 -8
  61. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Big_fVjG.js → keyboard-shortcuts-settings-BIoPfzm1.js} +1 -1
  62. package/dist/gateway/static/root/assets/{local-app-workbench-page-BQq4v2h9.js → local-app-workbench-page-CvY6c0zW.js} +1 -1
  63. package/dist/gateway/static/root/assets/{local-apps-page-BEJLnf07.js → local-apps-page-Dutmy_H3.js} +1 -1
  64. package/dist/gateway/static/root/assets/{logs-page-t85fyv9m.js → logs-page-DFNUn-Lf.js} +1 -1
  65. package/dist/gateway/static/root/assets/{management-settings-BNah9d9e.js → management-settings--LHmsgjW.js} +1 -1
  66. package/dist/gateway/static/root/assets/{media-plugins-DJBhcY1R.js → media-plugins-Brwr53z1.js} +1 -1
  67. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-CosDs4aI.js +1 -0
  68. package/dist/gateway/static/root/assets/{note-detail-panel-C2lBQc4t.js → note-detail-panel-1k-swf3p.js} +3 -3
  69. package/dist/gateway/static/root/assets/{notes-page-WnkqzfLz.js → notes-page-B1ADIBKj.js} +1 -1
  70. package/dist/gateway/static/root/assets/{page-context-capture-button-BJVRA9-x.js → page-context-capture-button-CTMrt6Ws.js} +1 -1
  71. package/dist/gateway/static/root/assets/{personal-page-Cm2wT4by.js → personal-page-MhVNCcRA.js} +1 -1
  72. package/dist/gateway/static/root/assets/{plugin-details-dialog-BWEc8nwk.js → plugin-details-dialog-BAPTOn3F.js} +1 -1
  73. package/dist/gateway/static/root/assets/{plugin-presentation-BcZHPy_6.js → plugin-presentation-D-o-0IeU.js} +1 -1
  74. package/dist/gateway/static/root/assets/{preview-open-alternatives-DKLblfvY.js → preview-open-alternatives-DCffBrFR.js} +1 -1
  75. package/dist/gateway/static/root/assets/{product-open-page-CMMI-Lvy.js → product-open-page--caaVC81.js} +1 -1
  76. package/dist/gateway/static/root/assets/{product-preview-content-Dik_ORgj.js → product-preview-content-B2pgfzxA.js} +1 -1
  77. package/dist/gateway/static/root/assets/{project-detail-page-RnKTj04F.js → project-detail-page-Cm4cR-TZ.js} +1 -1
  78. package/dist/gateway/static/root/assets/{projects-page-BhTpBKMy.js → projects-page-DPR6478A.js} +1 -1
  79. package/dist/gateway/static/root/assets/{remote-access-hub-LUQUvC84.js → remote-access-hub-Crf01UPK.js} +1 -1
  80. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Bo4YiO7D.js → runtime-tools-settings-panel-Bo_vaiIq.js} +1 -1
  81. package/dist/gateway/static/root/assets/{schema-form-B3bVaQx1.js → schema-form-BXk8w1q-.js} +1 -1
  82. package/dist/gateway/static/root/assets/{sessions-page-fseCCI6W.js → sessions-page-DcAxjdZi.js} +1 -1
  83. package/dist/gateway/static/root/assets/settings-advanced-gate-DLLcp7l0.js +1 -0
  84. package/dist/gateway/static/root/assets/{settings-form-section-vezTIqZ6.js → settings-form-section-COwDGhbe.js} +1 -1
  85. package/dist/gateway/static/root/assets/{settings-page-DC4NPD9q.js → settings-page-CV_QX35m.js} +1 -1
  86. package/dist/gateway/static/root/assets/{setup-status-panel-B7__vDF3.js → setup-status-panel-BvAAETqm.js} +1 -1
  87. package/dist/gateway/static/root/assets/{share-preview-page-rXG53c7x.js → share-preview-page-BsRSJVHV.js} +1 -1
  88. package/dist/gateway/static/root/assets/{shares-settings-8trvsXe5.js → shares-settings-Cm0iaWqX.js} +1 -1
  89. package/dist/gateway/static/root/assets/{skill-api-DS7l6xfp.js → skill-api-W7NoRL_J.js} +1 -1
  90. package/dist/gateway/static/root/assets/{skill-reload-api-B5xkDw4T.js → skill-reload-api-DNp30a6A.js} +1 -1
  91. package/dist/gateway/static/root/assets/{skills-page-DANnetBA.js → skills-page-dHlURgRl.js} +1 -1
  92. package/dist/gateway/static/root/assets/{style-DMaxcb-J.js → style-CXJD5Nzd.js} +1 -1
  93. package/dist/gateway/static/root/assets/{system-settings-panel-x1QJgZjs.js → system-settings-panel-DrdONDJA.js} +1 -1
  94. package/dist/gateway/static/root/assets/{task-detail-page-CKYCAG5-.js → task-detail-page-C7zXj_B9.js} +1 -1
  95. package/dist/gateway/static/root/assets/{tracing-settings-page-BcLJq6Jq.js → tracing-settings-page-CXI5s3V-.js} +1 -1
  96. package/dist/gateway/static/root/assets/{tunnel-api-GdTAmuHs.js → tunnel-api-Ce4mYarE.js} +1 -1
  97. package/dist/gateway/static/root/assets/{usage-page-DgOCrgPr.js → usage-page-yt14VUPq.js} +1 -1
  98. package/dist/gateway/static/root/assets/{use-autosave-BZw6SkOF.js → use-autosave-BmbPOiQU.js} +1 -1
  99. package/dist/gateway/static/root/assets/{user-model-page-BTIjtFxG.js → user-model-page-ne3A7X7a.js} +1 -1
  100. package/dist/gateway/static/root/assets/{voice-api-key-field-D1R1yQNb.js → voice-api-key-field-DqLKXIfy.js} +1 -1
  101. package/dist/gateway/static/root/assets/{work-discovery-overlay-R2dBw9bp.js → work-discovery-overlay-oUsUigJS.js} +1 -1
  102. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CtqK25lT.js → workflow-run-setup-panel-C3oU639v.js} +1 -1
  103. package/dist/gateway/static/root/assets/{workflows-page-C01mllUo.js → workflows-page-szPvZMys.js} +1 -1
  104. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-BjPp3a2X.js → xopc-cloud-account-card-DQNlWhsN.js} +1 -1
  105. package/dist/gateway/static/root/index.html +1 -1
  106. package/dist/package.js +1 -1
  107. package/dist/src/activity/emitter.js +1 -1
  108. package/dist/src/agent/agent-manager.js +7 -7
  109. package/dist/src/agent/background-review/run-background-review.js +3 -3
  110. package/dist/src/agent/coding/repository-instructions.js +1 -1
  111. package/dist/src/agent/coding/workspace-revision.js +2 -2
  112. package/dist/src/agent/commands/command-registry.js +1 -1
  113. package/dist/src/agent/context/workspace.js +1 -1
  114. package/dist/src/agent/data-acquisition/service.js +1 -1
  115. package/dist/src/agent/embedded/codemode-output.js +1 -1
  116. package/dist/src/agent/embedded/external-tool-discovery.js +1 -1
  117. package/dist/src/agent/embedded/model-runtime.js +1 -1
  118. package/dist/src/agent/embedded/run-for-session.js +2 -2
  119. package/dist/src/agent/embedded/run-turn.js +2 -2
  120. package/dist/src/agent/embedded/xopc-stream-bridge.js +3 -3
  121. package/dist/src/agent/external-tools/cliProvider.js +2 -2
  122. package/dist/src/agent/external-tools/composio-provider.js +2 -2
  123. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  124. package/dist/src/agent/external-tools/index.js +1 -1
  125. package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
  126. package/dist/src/agent/image/generation/providers/xopc-cloud.js +2 -2
  127. package/dist/src/agent/image/load-image-media.js +1 -1
  128. package/dist/src/agent/independent-execution.js +1 -1
  129. package/dist/src/agent/mcp/connection-drafts.js +3 -3
  130. package/dist/src/agent/mcp/connection-setup.js +1 -1
  131. package/dist/src/agent/sandbox/path-policy.js +1 -1
  132. package/dist/src/agent/service/direct-turn-helpers.js +1 -1
  133. package/dist/src/agent/service/process-direct-streaming.js +1 -1
  134. package/dist/src/agent/service.js +4 -4
  135. package/dist/src/agent/skills/hub-pull.js +2 -2
  136. package/dist/src/agent/skills/index.js +1 -1
  137. package/dist/src/agent/skills/installer.js +3 -3
  138. package/dist/src/agent/skills/skill-sources.js +1 -1
  139. package/dist/src/agent/skills/test-framework.js +1 -1
  140. package/dist/src/agent/tool-manuals/computer.d.ts +1 -1
  141. package/dist/src/agent/tool-manuals/computer.js +2 -2
  142. package/dist/src/agent/tools/executor.js +1 -1
  143. package/dist/src/agent/tools/factory.js +1 -1
  144. package/dist/src/agent/tools/fetch-text.js +1 -1
  145. package/dist/src/agent/tools/personal-read-tool.js +2 -2
  146. package/dist/src/agent/tools/read.js +1 -1
  147. package/dist/src/agent/tools/review-workspace.js +1 -1
  148. package/dist/src/agent/tools/send-media.js +1 -1
  149. package/dist/src/agent/tools/task-collaboration-tool.js +1 -1
  150. package/dist/src/agent/tools/write.js +1 -1
  151. package/dist/src/agent/tools/xopc-use-tool.js +5 -5
  152. package/dist/src/agent-catalog/capabilities.js +2 -2
  153. package/dist/src/agent-catalog/migrations/legacy-config-cutover.js +3 -3
  154. package/dist/src/agent-catalog/repository.js +3 -3
  155. package/dist/src/auth/oauth/xopc-cloud.js +1 -1
  156. package/dist/src/auth/oauth-provider-lock.js +1 -1
  157. package/dist/src/auth/sync-provider-auth.js +1 -1
  158. package/dist/src/automations/capabilities/drafts.js +1 -1
  159. package/dist/src/automations/service/action-executor.js +1 -1
  160. package/dist/src/backup/archive.js +2 -2
  161. package/dist/src/bootstrap/application-state.js +1 -1
  162. package/dist/src/browser/cache-dir-policy.js +1 -1
  163. package/dist/src/browser/native-messaging-host.js +1 -1
  164. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  165. package/dist/src/capabilities/readiness/from-config.js +2 -2
  166. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  167. package/dist/src/capabilities/runtime/product.js +1 -1
  168. package/dist/src/capabilities/store-connector.js +48 -13
  169. package/dist/src/channels/attachments/voice-stt-webchat.js +1 -1
  170. package/dist/src/channels/format.js +1 -1
  171. package/dist/src/channels/index.js +3 -3
  172. package/dist/src/channels/pairing/pairing-service.js +1 -1
  173. package/dist/src/chat-commands/agent-edit.js +1 -1
  174. package/dist/src/chat-commands/builtins/config.js +1 -1
  175. package/dist/src/chat-commands/builtins/session.js +1 -1
  176. package/dist/src/chat-commands/context.js +1 -1
  177. package/dist/src/chat-commands/index.js +1 -1
  178. package/dist/src/cli/commands/agent.js +2 -2
  179. package/dist/src/cli/commands/agents.js +1 -1
  180. package/dist/src/cli/commands/channels.js +2 -2
  181. package/dist/src/cli/commands/doctor/checks/channel-pairing-pending.js +1 -1
  182. package/dist/src/cli/commands/doctor/checks/image-providers.js +1 -1
  183. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  184. package/dist/src/cli/commands/extension-agent-plugin.js +1 -1
  185. package/dist/src/cli/commands/extension-marketplace.js +2 -2
  186. package/dist/src/cli/commands/extension-pack.js +1 -1
  187. package/dist/src/cli/commands/models.js +3 -3
  188. package/dist/src/cli/commands/onboard/model.js +3 -3
  189. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  190. package/dist/src/computer/broker.d.ts +2 -0
  191. package/dist/src/computer/broker.js +65 -20
  192. package/dist/src/computer/diagnostics.d.ts +6 -0
  193. package/dist/src/computer/diagnostics.js +7 -2
  194. package/dist/src/computer/flows.js +1 -1
  195. package/dist/src/computer/keyboard.d.ts +2 -0
  196. package/dist/src/computer/keyboard.js +31 -0
  197. package/dist/src/computer/model-adapter.d.ts +6 -0
  198. package/dist/src/computer/model-adapter.js +76 -4
  199. package/dist/src/computer/runtime.d.ts +9 -1
  200. package/dist/src/computer/runtime.js +75 -7
  201. package/dist/src/computer/semantic-plan.d.ts +41 -0
  202. package/dist/src/computer/semantic-plan.js +95 -0
  203. package/dist/src/computer/task-state.js +3 -2
  204. package/dist/src/config/agent-profile.js +1 -1
  205. package/dist/src/config/index.js +3 -3
  206. package/dist/src/config/loader.js +1 -1
  207. package/dist/src/config/models-json.js +1 -1
  208. package/dist/src/config/paths-state.js +1 -1
  209. package/dist/src/config/schema.d.ts +69 -3
  210. package/dist/src/config/schema.js +8 -3
  211. package/dist/src/config/workspace-path.js +1 -1
  212. package/dist/src/connectors/connected-source-ingestion.js +1 -1
  213. package/dist/src/connectors/content-enrichment.js +1 -1
  214. package/dist/src/connectors/endpoint-policy.d.ts +7 -0
  215. package/dist/src/connectors/endpoint-policy.js +14 -0
  216. package/dist/src/connectors/materialize.js +16 -1
  217. package/dist/src/connectors/secret-store.js +4 -1
  218. package/dist/src/connectors/types.d.ts +2 -0
  219. package/dist/src/daemon/constants.js +1 -1
  220. package/dist/src/daemon/install-plan.js +1 -1
  221. package/dist/src/daemon/launchd.js +1 -1
  222. package/dist/src/daemon/schtasks.js +1 -1
  223. package/dist/src/daemon/systemd.js +1 -1
  224. package/dist/src/discussions/action-tasks.js +1 -1
  225. package/dist/src/discussions/live-worker.js +2 -2
  226. package/dist/src/discussions/recording.js +1 -1
  227. package/dist/src/discussions/repository.js +1 -1
  228. package/dist/src/discussions/sealer.js +2 -2
  229. package/dist/src/discussions/service.js +1 -1
  230. package/dist/src/execution-environments/worktree-safety.js +1 -1
  231. package/dist/src/extensions/activation-context.js +2 -2
  232. package/dist/src/extensions/agent-plugins/auth.js +1 -1
  233. package/dist/src/extensions/agent-plugins/cli-authorization.js +2 -2
  234. package/dist/src/extensions/agent-plugins/credentials.js +1 -1
  235. package/dist/src/extensions/agent-plugins/mcp-adapter.js +1 -1
  236. package/dist/src/extensions/agent-plugins/setup.js +1 -1
  237. package/dist/src/extensions/agent-plugins/source-catalog.js +1 -1
  238. package/dist/src/extensions/agent-plugins/source-http-fetch.js +1 -1
  239. package/dist/src/extensions/agent-plugins/sources.js +1 -1
  240. package/dist/src/extensions/agent-plugins/store.js +1 -1
  241. package/dist/src/extensions/agent-plugins/user-config.js +1 -1
  242. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  243. package/dist/src/extensions/api.js +1 -1
  244. package/dist/src/extensions/loader.js +1 -1
  245. package/dist/src/extensions/sdk/index.js +1 -1
  246. package/dist/src/gateway/agents-admin.js +2 -2
  247. package/dist/src/gateway/file-path-classifier.js +1 -1
  248. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  249. package/dist/src/gateway/hono/lib/static-ui.js +1 -1
  250. package/dist/src/gateway/hono/routes/agent-plugins.js +1 -1
  251. package/dist/src/gateway/hono/routes/agents.js +1 -1
  252. package/dist/src/gateway/hono/routes/browser.js +1 -1
  253. package/dist/src/gateway/hono/routes/channels.js +1 -1
  254. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
  255. package/dist/src/gateway/hono/routes/discussions.js +1 -1
  256. package/dist/src/gateway/hono/routes/host-fs.js +1 -1
  257. package/dist/src/gateway/hono/routes/models.js +6 -6
  258. package/dist/src/gateway/hono/routes/notes.js +3 -3
  259. package/dist/src/gateway/hono/routes/observability.js +1 -1
  260. package/dist/src/gateway/hono/routes/projects.js +3 -3
  261. package/dist/src/gateway/hono/routes/session-command-handler.js +1 -1
  262. package/dist/src/gateway/hono/routes/session-input-handler.js +2 -2
  263. package/dist/src/gateway/hono/routes/sessions.js +1 -1
  264. package/dist/src/gateway/hono/routes/shares.js +1 -1
  265. package/dist/src/gateway/hono/routes/status.js +1 -1
  266. package/dist/src/gateway/hono/routes/tasks.js +2 -2
  267. package/dist/src/gateway/hono/routes/voice.js +5 -5
  268. package/dist/src/gateway/image-generation-setup.js +3 -3
  269. package/dist/src/gateway/mobile-privacy.js +1 -1
  270. package/dist/src/gateway/provider-model-setup.js +1 -1
  271. package/dist/src/gateway/service/agent-runner.js +1 -1
  272. package/dist/src/gateway/service/config-coordinator.d.ts +23 -1
  273. package/dist/src/gateway/service/config-coordinator.js +1 -1
  274. package/dist/src/gateway/service.js +14 -14
  275. package/dist/src/gateway/xopc-cloud-capability-setup.js +2 -2
  276. package/dist/src/home-intelligence/host.js +2 -2
  277. package/dist/src/home-intelligence/repository.js +1 -1
  278. package/dist/src/imports/importService.js +1 -1
  279. package/dist/src/imports/productImport.js +1 -1
  280. package/dist/src/imports/sources.js +1 -1
  281. package/dist/src/infra/brew.js +1 -1
  282. package/dist/src/infra/package-runtime-check.js +1 -1
  283. package/dist/src/infra/path-env.js +1 -1
  284. package/dist/src/infra/process-diagnostics.js +1 -1
  285. package/dist/src/infra/update-check.js +1 -1
  286. package/dist/src/local-apps/service.js +3 -3
  287. package/dist/src/markdown/index.js +1 -1
  288. package/dist/src/media/session-references.js +1 -1
  289. package/dist/src/media-shared/http/provider-http.js +1 -1
  290. package/dist/src/media-understanding/runner.js +1 -1
  291. package/dist/src/memory-learning/source-learning.js +1 -1
  292. package/dist/src/notes/agent-context.js +1 -1
  293. package/dist/src/notifications/store.js +1 -1
  294. package/dist/src/observability/runtime.js +1 -1
  295. package/dist/src/personal-agent/proactivity/repository.js +2 -2
  296. package/dist/src/personal-agent/proactivity/service.js +2 -2
  297. package/dist/src/personal-agent/reply-composer.js +1 -1
  298. package/dist/src/personal-agent/request-delivery.js +1 -1
  299. package/dist/src/personal-agent/request-service.js +1 -1
  300. package/dist/src/personal-agent/result-reader.js +2 -2
  301. package/dist/src/personal-agent/service.js +3 -3
  302. package/dist/src/personal-agent/unread.js +1 -1
  303. package/dist/src/platform/index.js +1 -1
  304. package/dist/src/project-trust/trust-store.js +1 -1
  305. package/dist/src/projects/workspace-project.js +1 -1
  306. package/dist/src/providers/extension-stream-bridge.js +1 -1
  307. package/dist/src/providers/index.js +4 -4
  308. package/dist/src/providers/model-call.js +3 -3
  309. package/dist/src/providers/model-catalog-persistence.js +1 -1
  310. package/dist/src/providers/model-registry.js +3 -3
  311. package/dist/src/providers/provider-disconnect-core.js +1 -1
  312. package/dist/src/providers/register-runtime-providers.js +1 -1
  313. package/dist/src/providers/setup/voice.js +1 -1
  314. package/dist/src/providers/xopc-cloud-catalog-coordinator.js +1 -1
  315. package/dist/src/providers/xopc-cloud-credit-budget.js +1 -1
  316. package/dist/src/review/review-git.js +1 -1
  317. package/dist/src/session/store.js +1 -1
  318. package/dist/src/share/hosted-session-share.js +1 -1
  319. package/dist/src/share/share-zip.js +1 -1
  320. package/dist/src/share/site-proxy.js +1 -1
  321. package/dist/src/share/site-static-serve.js +1 -1
  322. package/dist/src/storage/sqlite/ai-usage-repository.js +1 -1
  323. package/dist/src/storage/sqlite/clarification-wait-repository.js +2 -2
  324. package/dist/src/storage/sqlite/connection.js +1 -1
  325. package/dist/src/storage/sqlite/conversation-repository.js +2 -2
  326. package/dist/src/storage/sqlite/device-access-repository.js +1 -1
  327. package/dist/src/storage/sqlite/device-pairing-approval.js +1 -1
  328. package/dist/src/storage/sqlite/migrations/runner.js +2 -2
  329. package/dist/src/storage/sqlite/session-creation-repository.js +1 -1
  330. package/dist/src/storage/sqlite/session-repository.js +1 -1
  331. package/dist/src/tasks/capabilities/management.js +1 -1
  332. package/dist/src/tasks/capabilities/read.js +2 -2
  333. package/dist/src/tasks/capabilities/relations.js +1 -1
  334. package/dist/src/tasks/capabilities/write.js +1 -1
  335. package/dist/src/tasks/task-allocation-service.js +3 -3
  336. package/dist/src/tasks/task-application-service.js +1 -1
  337. package/dist/src/tasks/task-context-assembler.js +2 -2
  338. package/dist/src/tasks/task-criterion-review-repository.js +1 -1
  339. package/dist/src/tasks/task-handoff-service.js +1 -1
  340. package/dist/src/tasks/task-handoff.js +2 -2
  341. package/dist/src/tasks/task-research-repair.js +1 -1
  342. package/dist/src/tasks/task-research-result.js +2 -2
  343. package/dist/src/tasks/task-result-delivery-repository.js +1 -1
  344. package/dist/src/tasks/task-result-delivery-service.js +1 -1
  345. package/dist/src/tasks/task-signal-service.js +1 -1
  346. package/dist/src/tui/backends/embedded-backend.js +5 -5
  347. package/dist/src/tui/clipboard-image.js +2 -2
  348. package/dist/src/tui/extension-host/load-extensions.js +1 -1
  349. package/dist/src/tui/tui-commands.js +1 -1
  350. package/dist/src/tui/tui-skills-autocomplete.js +1 -1
  351. package/dist/src/tui/tui-startup-resources.js +1 -1
  352. package/dist/src/tui/tui.js +3 -3
  353. package/dist/src/tunnel/frpc-binary.js +1 -1
  354. package/dist/src/usage/cloud-capability.js +1 -1
  355. package/dist/src/usage/cloud-receipts.js +1 -1
  356. package/dist/src/usage/recorder.js +2 -2
  357. package/dist/src/user-context/access-policy.js +2 -2
  358. package/dist/src/utils/index.js +1 -1
  359. package/dist/src/utils/logger/index.js +1 -1
  360. package/dist/src/utils/logger.js +1 -1
  361. package/dist/src/voice/audio/normalize.js +1 -1
  362. package/dist/src/voice/platform-settings.js +1 -1
  363. package/dist/src/voice/realtime/memory-context.js +3 -3
  364. package/dist/src/voice/realtime/persona-context.js +1 -1
  365. package/dist/src/voice/realtime/runtime.js +2 -2
  366. package/dist/src/voice/stt/factory.js +1 -1
  367. package/dist/src/voice/stt/index.js +2 -2
  368. package/dist/src/voice/stt/preflight.js +2 -2
  369. package/dist/src/voice/stt/providers/bailian-plan-transcription.js +3 -3
  370. package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +3 -3
  371. package/dist/src/voice/stt/transcribe-core.js +1 -1
  372. package/dist/src/voice/tts/factory.js +1 -1
  373. package/dist/src/voice/tts/providers/bailian-plan-speech.js +2 -2
  374. package/dist/src/voice/tts/providers/edge-speech.js +1 -1
  375. package/dist/src/voice/tts/providers/xopc-cloud-speech.js +2 -2
  376. package/dist/src/work-discovery/candidate-discovery.js +2 -2
  377. package/dist/src/work-discovery/probe.js +2 -2
  378. package/dist/src/work-discovery/service.js +2 -2
  379. package/package.json +5 -5
  380. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-CILrbgBf.js +0 -1
  381. package/dist/gateway/static/root/assets/settings-advanced-gate-CBn8SVz7.js +0 -1
@@ -1,4 +1,4 @@
1
- import{i as e,n as t,t as n}from"./rolldown-runtime-aKtaBQYM.js";import{a as r,i,n as a,t as o}from"./vendor-react-BOUWij0V.js";import{t as s}from"./check-DUBLcKHA.js";import{t as c}from"./copy-Dv6d4Dvw.js";import{t as l}from"./external-link-DjqjBmc3.js";import{C as u,G as d,S as f,T as p,_ as m,b as h,r as g,t as _,v,w as y,x as b}from"./markdown-view-B58RypQ4.js";import{t as x}from"./messages-DBvKzlCl.js";import{t as S}from"./cn-0WouolD0.js";import{n as C}from"./locale-store-Jnhw2WMv.js";import{t as w}from"./copy-to-clipboard-HOJ79TWv.js";import{s as T}from"./vendor-swr-BIWyz7Rc.js";import{a as E,d as D,i as O,l as k,n as A,o as j,r as M,s as ee,t as te,u as ne}from"./floating-ui.dom-B7uQOZZW.js";import{Cu as re,Gd as ie,Gu as ae,Ir as oe,Iu as se,Ju as ce,Ku as le,Ll as ue,Lr as de,Ol as fe,Pr as pe,Yu as me,Zu as he,bd as ge,gu as _e,ii as ve,kl as ye,ld as be,lu as xe,ni as Se,pd as Ce,uu as we,vd as Te,xf as Ee,xu as De,yd as Oe}from"./index-Cmrvxc_s.js";import{C as ke,S as Ae}from"./vendor-codemirror-DFxP3B9T.js";import{t as je}from"./with-selector-aYPsXwdl.js";import{n as Me}from"./note-image-lightbox-BYNLO2pt.js";var N=e(r(),1),Ne=e(i(),1),P=o(),Pe=T(),Fe=Object.defineProperty,Ie=(e,t)=>{let n={};for(var r in e)Fe(n,r,{get:e[r],enumerable:!0});return t||Fe(n,Symbol.toStringTag,{value:`Module`}),n};function F(e){this.content=e}F.prototype={constructor:F,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new F(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new F(n)},addToStart:function(e,t){return new F([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new F(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new F(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=F.from(e),e.size?new F(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=F.from(e),e.size?new F(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=F.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},F.from=function(e){if(e instanceof F)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new F(t)};function Le(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&Be(e.charCodeAt(r-1))&&ze(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=Le(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Re(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&Be(e.charCodeAt(i-1))&&ze(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=Re(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function ze(e){return e>=56320&&e<57344}function Be(e){return e>=55296&&e<56320}var I=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Le(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Re(this,e,t,n)}findIndex(e){if(e==0)return He(0,e);if(e==this.size)return He(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?He(t+1,i):He(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};I.empty=new I([],0);var Ve={index:0,offset:0};function He(e,t){return Ve.index=e,Ve.offset=t,Ve}function Ue(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Ue(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Ue(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var L=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Ue(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};L.none=[];var We=class extends Error{},R=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=Ke(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Ge(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(I.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};R.empty=new R(I.empty,0,0);function Ge(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(Ge(a.content,t-i-1,n-i-1)))}function Ke(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=Ke(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function qe(e,t,n){if(n.openStart>e.depth)throw new We(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new We(`Inconsistent open depths`);return Je(e,t,n,0)}function Je(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=Je(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return $e(a,tt(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return $e(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=nt(n,e);return $e(a,et(e,i,o,t,r))}}function Ye(e,t){if(!t.type.compatibleContent(e.type))throw new We(`Cannot join `+t.type.name+` onto `+e.type.name)}function Xe(e,t,n){let r=e.node(n);return Ye(r,t.node(n)),r}function Ze(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Qe(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(Ze(e.nodeAfter,r),a++));for(let e=a;e<o;e++)Ze(i.child(e),r);t&&t.depth==n&&t.textOffset&&Ze(t.nodeBefore,r)}function $e(e,t){if(!e.type.validContent(t))throw new We(`Invalid content for node `+e.type.name);return e.copy(t)}function et(e,t,n,r,i){let a=e.depth>i&&Xe(e,t,i+1),o=r.depth>i&&Xe(n,r,i+1),s=[];return Qe(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(Ye(a,o),Ze($e(a,et(e,t,n,r,i+1)),s)):(a&&Ze($e(a,tt(e,t,i+1)),s),Qe(t,n,i,s),o&&Ze($e(o,tt(n,r,i+1)),s)),Qe(r,null,i,s),new I(s)}function tt(e,t,n){let r=[];return Qe(null,e,n,r),e.depth>n&&Ze($e(Xe(e,t,n+1),tt(e,t,n+1)),r),Qe(t,null,n,r),new I(r)}function nt(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(I.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var rt=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return L.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new st(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=ot.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else ot.set(t,r=new it);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%at,i}},it=class{constructor(){this.elts=[],this.i=0}},at=12,ot=new WeakMap,st=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},ct=Object.create(null),lt=class e{constructor(e,t,n,r=L.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||I.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Ue(this.attrs,t||e.defaultAttrs||ct)&&L.sameSet(this.marks,n||L.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return R.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new R(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return qe(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return rt.resolveCached(this,e)}resolveNoCache(e){return rt.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),dt(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=I.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=L.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!L.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=I.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};lt.prototype.text=void 0;var ut=class e extends lt{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):dt(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function dt(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var ft=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new pt(t,n);if(r.next==null)return e.empty;let i=mt(r);r.next&&r.err(`Unexpected trailing text`);let a=wt(xt(i));return Tt(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return I.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
1
+ import{i as e,n as t,t as n}from"./rolldown-runtime-aKtaBQYM.js";import{a as r,i,n as a,t as o}from"./vendor-react-BOUWij0V.js";import{t as s}from"./check-DUBLcKHA.js";import{t as c}from"./copy-Dv6d4Dvw.js";import{t as l}from"./external-link-DjqjBmc3.js";import{C as u,G as d,S as f,T as p,_ as m,b as h,r as g,t as _,v,w as y,x as b}from"./markdown-view-B58RypQ4.js";import{t as x}from"./messages-DBvKzlCl.js";import{t as S}from"./cn-0WouolD0.js";import{n as C}from"./locale-store-Jnhw2WMv.js";import{t as w}from"./copy-to-clipboard-HOJ79TWv.js";import{s as T}from"./vendor-swr-BIWyz7Rc.js";import{a as E,d as D,i as O,l as k,n as A,o as j,r as M,s as ee,t as te,u as ne}from"./floating-ui.dom-B7uQOZZW.js";import{Cu as re,Gd as ie,Gu as ae,Ir as oe,Iu as se,Ju as ce,Ku as le,Ll as ue,Lr as de,Ol as fe,Pr as pe,Yu as me,Zu as he,bd as ge,gu as _e,ii as ve,kl as ye,ld as be,lu as xe,ni as Se,pd as Ce,uu as we,vd as Te,xf as Ee,xu as De,yd as Oe}from"./index-CzkAd5Su.js";import{C as ke,S as Ae}from"./vendor-codemirror-DFxP3B9T.js";import{t as je}from"./with-selector-aYPsXwdl.js";import{n as Me}from"./note-image-lightbox-BYNLO2pt.js";var N=e(r(),1),Ne=e(i(),1),P=o(),Pe=T(),Fe=Object.defineProperty,Ie=(e,t)=>{let n={};for(var r in e)Fe(n,r,{get:e[r],enumerable:!0});return t||Fe(n,Symbol.toStringTag,{value:`Module`}),n};function F(e){this.content=e}F.prototype={constructor:F,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new F(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new F(n)},addToStart:function(e,t){return new F([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new F(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new F(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=F.from(e),e.size?new F(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=F.from(e),e.size?new F(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=F.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},F.from=function(e){if(e instanceof F)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new F(t)};function Le(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&Be(e.charCodeAt(r-1))&&ze(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=Le(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Re(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&Be(e.charCodeAt(i-1))&&ze(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=Re(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function ze(e){return e>=56320&&e<57344}function Be(e){return e>=55296&&e<56320}var I=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Le(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Re(this,e,t,n)}findIndex(e){if(e==0)return He(0,e);if(e==this.size)return He(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?He(t+1,i):He(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};I.empty=new I([],0);var Ve={index:0,offset:0};function He(e,t){return Ve.index=e,Ve.offset=t,Ve}function Ue(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Ue(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Ue(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var L=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Ue(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};L.none=[];var We=class extends Error{},R=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=Ke(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Ge(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(I.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};R.empty=new R(I.empty,0,0);function Ge(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(Ge(a.content,t-i-1,n-i-1)))}function Ke(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=Ke(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function qe(e,t,n){if(n.openStart>e.depth)throw new We(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new We(`Inconsistent open depths`);return Je(e,t,n,0)}function Je(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=Je(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return $e(a,tt(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return $e(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=nt(n,e);return $e(a,et(e,i,o,t,r))}}function Ye(e,t){if(!t.type.compatibleContent(e.type))throw new We(`Cannot join `+t.type.name+` onto `+e.type.name)}function Xe(e,t,n){let r=e.node(n);return Ye(r,t.node(n)),r}function Ze(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Qe(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(Ze(e.nodeAfter,r),a++));for(let e=a;e<o;e++)Ze(i.child(e),r);t&&t.depth==n&&t.textOffset&&Ze(t.nodeBefore,r)}function $e(e,t){if(!e.type.validContent(t))throw new We(`Invalid content for node `+e.type.name);return e.copy(t)}function et(e,t,n,r,i){let a=e.depth>i&&Xe(e,t,i+1),o=r.depth>i&&Xe(n,r,i+1),s=[];return Qe(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(Ye(a,o),Ze($e(a,et(e,t,n,r,i+1)),s)):(a&&Ze($e(a,tt(e,t,i+1)),s),Qe(t,n,i,s),o&&Ze($e(o,tt(n,r,i+1)),s)),Qe(r,null,i,s),new I(s)}function tt(e,t,n){let r=[];return Qe(null,e,n,r),e.depth>n&&Ze($e(Xe(e,t,n+1),tt(e,t,n+1)),r),Qe(t,null,n,r),new I(r)}function nt(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(I.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var rt=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return L.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new st(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=ot.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else ot.set(t,r=new it);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%at,i}},it=class{constructor(){this.elts=[],this.i=0}},at=12,ot=new WeakMap,st=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},ct=Object.create(null),lt=class e{constructor(e,t,n,r=L.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||I.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Ue(this.attrs,t||e.defaultAttrs||ct)&&L.sameSet(this.marks,n||L.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return R.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new R(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return qe(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return rt.resolveCached(this,e)}resolveNoCache(e){return rt.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),dt(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=I.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=L.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!L.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=I.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};lt.prototype.text=void 0;var ut=class e extends lt{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):dt(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function dt(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var ft=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new pt(t,n);if(r.next==null)return e.empty;let i=mt(r);r.next&&r.err(`Unexpected trailing text`);let a=wt(xt(i));return Tt(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return I.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
2
2
  `)}};ft.empty=new ft(!0);var pt=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function mt(e){let t=[];do t.push(ht(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function ht(e){let t=[];do t.push(gt(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function gt(e){let t=bt(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=vt(e,t);else break;return t}function _t(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function vt(e,t){let n=_t(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:_t(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function yt(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function bt(e){if(e.eat(`(`)){let t=mt(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=yt(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function xt(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function St(e,t){return t-e}function Ct(e,t){let n=[];return r(t),n.sort(St);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function wt(e){let t=Object.create(null);return n(Ct(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);Ct(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new ft(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(St);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function Tt(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function Et(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function Dt(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function Ot(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}function kt(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new Mt(e,r,t[r]);return n}var At=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=kt(e,n.attrs),this.defaultAttrs=Et(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ft.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Dt(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new lt(this,this.computeAttrs(e),I.from(t),L.setFrom(n))}createChecked(e=null,t,n){return t=I.from(t),this.checkContent(t),new lt(this,this.computeAttrs(e),t,L.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=I.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(I.empty,!0);return i?new lt(this,e,t.append(i),L.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Ot(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:L.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function jt(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var Mt=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?jt(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},Nt=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=kt(e,r.attrs),this.excluded=null;let i=Et(this.attrs);this.instance=i?new L(this,i):null}create(e=null){return!e&&this.instance?this.instance:new L(this,Dt(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Ot(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},Pt=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=F.from(e.nodes),t.marks=F.from(e.marks||{}),this.nodes=At.compile(this.spec.nodes,this),this.marks=Nt.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=ft.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?Ft(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:Ft(this,n.split(` `))}this.nodeFromJSON=e=>lt.fromJSON(this,e),this.markFromJSON=e=>L.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof At))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new ut(n,n.defaultAttrs,e,L.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function Ft(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function It(e){return e.tag!=null}function Lt(e){return e.style!=null}var Rt=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(It(e))this.tags.push(e);else if(Lt(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new qt(this,t,!1);return n.addAll(e,L.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new qt(this,t,!0);return n.addAll(e,L.none,t.from,t.to),R.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Yt(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Xt(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Xt(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},zt={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Bt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Vt={ol:!0,ul:!0},Ht=1,Ut=2,Wt=4;function Gt(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?Ht:0)|(t===`full`?Ut:0)}var Kt=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=L.none,this.match=i||(a&Wt?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(I.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ht)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=I.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(I.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!zt.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},qt=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=Gt(null,t.preserveWhitespace,0)|(n?Wt:0);i=r?new Kt(r.type,r.attrs,L.none,!0,t.topMatch||r.type.contentMatch,a):n?new Kt(null,null,L.none,!0,null,a):new Kt(e.schema.topNodeType,null,L.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&Ut?`full`:this.localPreserveWS||(r.options&Ht)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
3
3
  `);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;Vt.hasOwnProperty(a)&&this.parser.normalizeLists&&Jt(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:Bt.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(zt.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
4
  `),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=L.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):Zt(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=Gt(e,i,a.options);a.options&Wt&&a.content.length==0&&(o|=Wt);let s=L.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):Zt(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new Kt(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=Ht);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function Jt(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&Vt.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function Yt(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Xt(e){let t={};for(let n in e)t[n]=e[n];return t}function Zt(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var Qt=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=en(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return en(t).createTextNode(e.text);let{dom:n,contentDOM:r}=an(en(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&an(en(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t==`string`?{dom:e.createTextNode(t)}:an(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=$t(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return $t(e.marks)}};function $t(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function en(e){return e.document||window.document}var tn=new WeakMap;function nn(e){let t=tn.get(e);return t===void 0&&tn.set(e,t=rn(e)),t}function rn(e){let t=null;function n(e){if(e&&typeof e==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}function an(e,t,n,r){if(t.nodeType==1)return{dom:t};if(t.dom&&t.dom.nodeType==1)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=nn(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else if(typeof a==`string`)c.appendChild(e.createTextNode(a));else{let{dom:t,contentDOM:i}=an(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var on=a(),sn=65535,cn=2**16;function ln(e,t){return e+t*cn}function un(e){return e&sn}function dn(e){return(e-(e&sn))/cn}var fn=1,pn=2,mn=4,hn=8,gn=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&hn)>0}get deletedBefore(){return(this.delInfo&5)>0}get deletedAfter(){return(this.delInfo&6)>0}get deletedAcross(){return(this.delInfo&mn)>0}},_n=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=un(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+dn(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:ln(o/3,e-s),f=e==s?pn:e==u?fn:mn;return(t<0?e!=s:e!=u)&&(f|=hn),new gn(a,f,d)}r+=l-c}return n?e+r:new gn(e+r,0,null)}touches(e,t){let n=0,r=un(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};_n.empty=new _n([]);var vn=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||=[],this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new gn(e,r,null)}},yn=Object.create(null),bn=class{getMap(){return _n.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=yn[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in yn)throw RangeError(`Duplicate use of step JSON ID `+e);return yn[e]=t,t.prototype.jsonID=e,t}},xn=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof We)return e.fail(t.message);throw t}}};function Sn(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(Sn(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return I.fromArray(r)}var Cn=class e extends bn{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new R(Sn(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return xn.fromReplace(e,this.from,this.to,i)}invert(){return new wn(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};bn.jsonID(`addMark`,Cn);var wn=class e extends bn{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new R(Sn(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return xn.fromReplace(e,this.from,this.to,n)}invert(){return new Cn(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};bn.jsonID(`removeMark`,wn);var Tn=class e extends bn{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return xn.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return xn.fromReplace(e,this.pos,this.pos+1,new R(I.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new En(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};bn.jsonID(`addNodeMark`,Tn);var En=class e extends bn{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return xn.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return xn.fromReplace(e,this.pos,this.pos+1,new R(I.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Tn(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};bn.jsonID(`removeNodeMark`,En);var Dn=class e extends bn{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&kn(e,this.from,this.to)?xn.fail(`Structure replace would overwrite content`):xn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new _n([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?R.empty:new R(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?R.empty:new R(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,R.fromJSON(t,n.slice),!!n.structure)}};Dn.MAP_BIAS=1,bn.jsonID(`replace`,Dn);var On=class e extends bn{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(kn(e,this.from,this.gapFrom)||kn(e,this.gapTo,this.to)))return xn.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return xn.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?xn.fromReplace(e,this.from,this.to,n):xn.fail(`Content does not fit in gap`)}getMap(){return new _n([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,R.fromJSON(t,n.slice),n.insert,!!n.structure)}};bn.jsonID(`replaceAround`,On);function kn(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function An(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new wn(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new Cn(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function jn(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof Nt){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new wn(t.from,t.to,t.style)))}function Mn(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new Dn(s,l,R.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new wn(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new R(I.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new Dn(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(I.empty,!0);e.replace(s,s,new R(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function Nn(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Pn(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!Nn(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function Fn(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=I.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=I.from(r.node(e).copy(u)),d++):c--;let f=I.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=I.from(i.node(e).copy(f)),p++):l++;e.step(new On(c,l,o,s,new R(u.append(f),d,p),u.size-d,!0))}function In(e,t,n=null,r=e){let i=Rn(e,t),a=i&&zn(r,t);return a?i.map(Ln).concat({type:t,attrs:n}).concat(a.map(Ln)):null}function Ln(e){return{type:e,attrs:null}}function Rn(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function zn(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function Bn(e,t,n){let r=I.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=I.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new On(i,a,i,a,new R(r,0,0),n.length,!0))}function Vn(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&Wn(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&Un(e,t,n,a),Mn(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new On(c,l,c+1,l-1,new R(I.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&Hn(e,t,n,a),!1}})}function Hn(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function Un(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{a as n,r}from"./locale-store-Jnhw2WMv.js";import{us as i}from"./index-Cmrvxc_s.js";function a(e){return{id:e.id,name:e.definition.name,description:e.definition.description,verified:e.verified,revision:e.revision,enabled:e.status===`enabled`,risk:e.definition.risk,domains:e.definition.allowedDomains,inputs:e.definition.inputs,createdAtMs:e.createdAtMs,updatedAtMs:e.updatedAtMs}}var o={recordingAvailability:()=>n(r(`/api/browser/recordings/availability`)),recording:(e,t)=>n(r(`/api/browser/recordings/control`),{method:`POST`,body:JSON.stringify({operation:e,endpointId:t})}),list:async()=>({automations:(await n(r(`/api/browser/automations`))).automations.map(a)}),setEnabled:async(e,t)=>({automation:a((await n(r(`/api/browser/automations/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({status:t?`enabled`:`disabled`})})).automation)}),remove:e=>n(r(`/api/browser/automations/${encodeURIComponent(e)}`),{method:`DELETE`}),run:(e,t)=>n(r(`/api/browser/automations/${encodeURIComponent(e)}/run`),{method:`POST`,body:JSON.stringify({inputs:t,clientRequestId:crypto.randomUUID()})}),getRun:e=>n(r(`/api/browser/automation-runs/${encodeURIComponent(e)}`)),listRuns:e=>n(r(`/api/browser/automation-runs?automationId=${encodeURIComponent(e)}`)),cancel:e=>n(r(`/api/browser/automation-runs/${encodeURIComponent(e)}/cancel`),{method:`POST`})};function s(e){return Object.fromEntries(Object.entries(e.inputs).flatMap(([e,t])=>t.default===void 0?[]:[[e,t.default]]))}function c(e,t){return!Object.entries(e.inputs).some(([e,n])=>n.required&&(t[e]===void 0||t[e]===``))}var l=e(),u=t();function d(e){let t=(0,l.c)(53),{name:n,input:r,value:a,yes:o,no:s,onChange:c}=e,d;t[0]!==r.description||t[1]!==n?(d=r.description?.trim()||n,t[0]=r.description,t[1]=n,t[2]=d):d=t[2];let p=d;if(r.choices?.length){let e;t[3]===r.choices?e=t[4]:(e=r.choices.map(f),t[3]=r.choices,t[4]=e);let n=e,o=r.required?` *`:``,s;t[5]!==p||t[6]!==o?(s=(0,u.jsxs)(`span`,{className:`mb-1.5 block font-medium`,children:[p,o]}),t[5]=p,t[6]=o,t[7]=s):s=t[7];let l;t[8]===a?l=t[9]:(l=a===void 0?``:JSON.stringify(a),t[8]=a,t[9]=l);let d;t[10]===c?d=t[11]:(d=e=>c(JSON.parse(e)),t[10]=c,t[11]=d);let m;t[12]!==p||t[13]!==n||t[14]!==l||t[15]!==d?(m=(0,u.jsx)(i,{value:l,options:n,placeholder:p,onChange:d}),t[12]=p,t[13]=n,t[14]=l,t[15]=d,t[16]=m):m=t[16];let h;return t[17]!==s||t[18]!==m?(h=(0,u.jsxs)(`label`,{className:`block text-sm text-fg`,children:[s,m]}),t[17]=s,t[18]=m,t[19]=h):h=t[19],h}if(r.type===`boolean`){let e=r.required?` *`:``,n;t[20]!==p||t[21]!==e?(n=(0,u.jsxs)(`span`,{className:`mb-1.5 block font-medium`,children:[p,e]}),t[20]=p,t[21]=e,t[22]=n):n=t[22];let l=typeof a==`boolean`?String(a):``,d;t[23]===o?d=t[24]:(d={value:`true`,label:o},t[23]=o,t[24]=d);let f;t[25]===s?f=t[26]:(f={value:`false`,label:s},t[25]=s,t[26]=f);let m;t[27]!==d||t[28]!==f?(m=[d,f],t[27]=d,t[28]=f,t[29]=m):m=t[29];let h;t[30]===c?h=t[31]:(h=e=>c(e===`true`),t[30]=c,t[31]=h);let g;t[32]!==p||t[33]!==l||t[34]!==m||t[35]!==h?(g=(0,u.jsx)(i,{value:l,options:m,placeholder:p,onChange:h}),t[32]=p,t[33]=l,t[34]=m,t[35]=h,t[36]=g):g=t[36];let _;return t[37]!==n||t[38]!==g?(_=(0,u.jsxs)(`label`,{className:`block text-sm text-fg`,children:[n,g]}),t[37]=n,t[38]=g,t[39]=_):_=t[39],_}let m=r.type===`number`,h=r.required?` *`:``,g;t[40]!==p||t[41]!==h?(g=(0,u.jsxs)(`span`,{className:`mb-1.5 block font-medium`,children:[p,h]}),t[40]=p,t[41]=h,t[42]=g):g=t[42];let _=m?`number`:`text`,v=a===void 0?``:String(a),y;t[43]!==m||t[44]!==c?(y=e=>c(m?e.target.value===``?void 0:Number(e.target.value):e.target.value),t[43]=m,t[44]=c,t[45]=y):y=t[45];let b;t[46]!==_||t[47]!==v||t[48]!==y?(b=(0,u.jsx)(`input`,{type:_,value:v,onChange:y,className:`h-10 w-full rounded-lg border border-edge bg-surface-inset px-3 text-sm text-fg outline-none focus:border-accent`}),t[46]=_,t[47]=v,t[48]=y,t[49]=b):b=t[49];let x;return t[50]!==g||t[51]!==b?(x=(0,u.jsxs)(`label`,{className:`block text-sm text-fg`,children:[g,b]}),t[50]=g,t[51]=b,t[52]=x):x=t[52],x}function f(e){return{value:JSON.stringify(e),label:String(e)}}function p(e){let t=(0,l.c)(7),{automation:n,values:r,language:i,onChange:a}=e,o;t[0]===n.inputs?o=t[1]:(o=Object.entries(n.inputs),t[0]=n.inputs,t[1]=o);let s;return t[2]!==i||t[3]!==a||t[4]!==o||t[5]!==r?(s=(0,u.jsx)(`div`,{className:`grid gap-4`,children:o.map(e=>{let[t,n]=e;return(0,u.jsx)(d,{name:t,input:n,value:r[t],yes:i===`zh`?`是`:`Yes`,no:i===`zh`?`否`:`No`,onChange:e=>a({...r,[t]:e})},t)})}),t[2]=i,t[3]=a,t[4]=o,t[5]=r,t[6]=s):s=t[6],s}export{o as i,c as n,s as r,p as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{a as n,r}from"./locale-store-Jnhw2WMv.js";import{us as i}from"./index-CzkAd5Su.js";function a(e){return{id:e.id,name:e.definition.name,description:e.definition.description,verified:e.verified,revision:e.revision,enabled:e.status===`enabled`,risk:e.definition.risk,domains:e.definition.allowedDomains,inputs:e.definition.inputs,createdAtMs:e.createdAtMs,updatedAtMs:e.updatedAtMs}}var o={recordingAvailability:()=>n(r(`/api/browser/recordings/availability`)),recording:(e,t)=>n(r(`/api/browser/recordings/control`),{method:`POST`,body:JSON.stringify({operation:e,endpointId:t})}),list:async()=>({automations:(await n(r(`/api/browser/automations`))).automations.map(a)}),setEnabled:async(e,t)=>({automation:a((await n(r(`/api/browser/automations/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({status:t?`enabled`:`disabled`})})).automation)}),remove:e=>n(r(`/api/browser/automations/${encodeURIComponent(e)}`),{method:`DELETE`}),run:(e,t)=>n(r(`/api/browser/automations/${encodeURIComponent(e)}/run`),{method:`POST`,body:JSON.stringify({inputs:t,clientRequestId:crypto.randomUUID()})}),getRun:e=>n(r(`/api/browser/automation-runs/${encodeURIComponent(e)}`)),listRuns:e=>n(r(`/api/browser/automation-runs?automationId=${encodeURIComponent(e)}`)),cancel:e=>n(r(`/api/browser/automation-runs/${encodeURIComponent(e)}/cancel`),{method:`POST`})};function s(e){return Object.fromEntries(Object.entries(e.inputs).flatMap(([e,t])=>t.default===void 0?[]:[[e,t.default]]))}function c(e,t){return!Object.entries(e.inputs).some(([e,n])=>n.required&&(t[e]===void 0||t[e]===``))}var l=e(),u=t();function d(e){let t=(0,l.c)(53),{name:n,input:r,value:a,yes:o,no:s,onChange:c}=e,d;t[0]!==r.description||t[1]!==n?(d=r.description?.trim()||n,t[0]=r.description,t[1]=n,t[2]=d):d=t[2];let p=d;if(r.choices?.length){let e;t[3]===r.choices?e=t[4]:(e=r.choices.map(f),t[3]=r.choices,t[4]=e);let n=e,o=r.required?` *`:``,s;t[5]!==p||t[6]!==o?(s=(0,u.jsxs)(`span`,{className:`mb-1.5 block font-medium`,children:[p,o]}),t[5]=p,t[6]=o,t[7]=s):s=t[7];let l;t[8]===a?l=t[9]:(l=a===void 0?``:JSON.stringify(a),t[8]=a,t[9]=l);let d;t[10]===c?d=t[11]:(d=e=>c(JSON.parse(e)),t[10]=c,t[11]=d);let m;t[12]!==p||t[13]!==n||t[14]!==l||t[15]!==d?(m=(0,u.jsx)(i,{value:l,options:n,placeholder:p,onChange:d}),t[12]=p,t[13]=n,t[14]=l,t[15]=d,t[16]=m):m=t[16];let h;return t[17]!==s||t[18]!==m?(h=(0,u.jsxs)(`label`,{className:`block text-sm text-fg`,children:[s,m]}),t[17]=s,t[18]=m,t[19]=h):h=t[19],h}if(r.type===`boolean`){let e=r.required?` *`:``,n;t[20]!==p||t[21]!==e?(n=(0,u.jsxs)(`span`,{className:`mb-1.5 block font-medium`,children:[p,e]}),t[20]=p,t[21]=e,t[22]=n):n=t[22];let l=typeof a==`boolean`?String(a):``,d;t[23]===o?d=t[24]:(d={value:`true`,label:o},t[23]=o,t[24]=d);let f;t[25]===s?f=t[26]:(f={value:`false`,label:s},t[25]=s,t[26]=f);let m;t[27]!==d||t[28]!==f?(m=[d,f],t[27]=d,t[28]=f,t[29]=m):m=t[29];let h;t[30]===c?h=t[31]:(h=e=>c(e===`true`),t[30]=c,t[31]=h);let g;t[32]!==p||t[33]!==l||t[34]!==m||t[35]!==h?(g=(0,u.jsx)(i,{value:l,options:m,placeholder:p,onChange:h}),t[32]=p,t[33]=l,t[34]=m,t[35]=h,t[36]=g):g=t[36];let _;return t[37]!==n||t[38]!==g?(_=(0,u.jsxs)(`label`,{className:`block text-sm text-fg`,children:[n,g]}),t[37]=n,t[38]=g,t[39]=_):_=t[39],_}let m=r.type===`number`,h=r.required?` *`:``,g;t[40]!==p||t[41]!==h?(g=(0,u.jsxs)(`span`,{className:`mb-1.5 block font-medium`,children:[p,h]}),t[40]=p,t[41]=h,t[42]=g):g=t[42];let _=m?`number`:`text`,v=a===void 0?``:String(a),y;t[43]!==m||t[44]!==c?(y=e=>c(m?e.target.value===``?void 0:Number(e.target.value):e.target.value),t[43]=m,t[44]=c,t[45]=y):y=t[45];let b;t[46]!==_||t[47]!==v||t[48]!==y?(b=(0,u.jsx)(`input`,{type:_,value:v,onChange:y,className:`h-10 w-full rounded-lg border border-edge bg-surface-inset px-3 text-sm text-fg outline-none focus:border-accent`}),t[46]=_,t[47]=v,t[48]=y,t[49]=b):b=t[49];let x;return t[50]!==g||t[51]!==b?(x=(0,u.jsxs)(`label`,{className:`block text-sm text-fg`,children:[g,b]}),t[50]=g,t[51]=b,t[52]=x):x=t[52],x}function f(e){return{value:JSON.stringify(e),label:String(e)}}function p(e){let t=(0,l.c)(7),{automation:n,values:r,language:i,onChange:a}=e,o;t[0]===n.inputs?o=t[1]:(o=Object.entries(n.inputs),t[0]=n.inputs,t[1]=o);let s;return t[2]!==i||t[3]!==a||t[4]!==o||t[5]!==r?(s=(0,u.jsx)(`div`,{className:`grid gap-4`,children:o.map(e=>{let[t,n]=e;return(0,u.jsx)(d,{name:t,input:n,value:r[t],yes:i===`zh`?`是`:`Yes`,no:i===`zh`?`否`:`No`,onChange:e=>a({...r,[t]:e})},t)})}),t[2]=i,t[3]=a,t[4]=o,t[5]=r,t[6]=s):s=t[6],s}export{o as i,c as n,s as r,p as t};
@@ -1,3 +1,3 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{f as r}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as i}from"./x-B_N4OPjy.js";import{a,n as o,r as s}from"./locale-store-Jnhw2WMv.js";import{B as c,Cl as ee,Go as l,Gu as u,H as d,Hl as f,Rc as p,Rd as m,Wc as h,Yd as g,_f as _,fu as v,gu as y,jl as b,nf as x,rf as S,us as C,xu as w}from"./index-Cmrvxc_s.js";import{i as T,n as E,r as D,t as O}from"./browser-automation-inputs-BMe7eqyS.js";var k=e(t(),1),A=n();function j({availability:e,endpointId:t,recordingBusy:n,onSelect:ee,onRefresh:l,onStart:f,onClose:m}){let g=o(e=>e.language)===`zh`,_=r(),[y,b]=(0,k.useState)(),[x,S]=(0,k.useState)(!0),[w,T]=(0,k.useState)(!1),[E,D]=(0,k.useState)(``),[O,j]=(0,k.useState)(!1),M=e.endpoints.length>0,N=e.state===`update_required`;(0,k.useEffect)(()=>{let e=!1;if(M){S(!1);return}return a(s(`/api/browser/extension-status`)).then(t=>{e||b(t)}).catch(t=>{e||D(t instanceof Error?t.message:String(t))}).finally(()=>{e||S(!1)}),()=>{e=!0}},[M]);let P=async()=>{T(!0),D(``);try{(N||!y?.artifacts?.installed||y.artifacts.needsRefresh)&&await c(N||!!y?.artifacts?.needsRefresh),await d(y?.artifacts?.installed?`chrome`:`both`),j(!0),await l()}catch(e){D(e instanceof Error?e.message:String(e))}finally{T(!1)}};return(0,A.jsxs)(`section`,{role:`status`,"aria-live":`polite`,className:`mb-4 shrink-0 rounded-xl border border-edge bg-surface-base p-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,A.jsx)(v,{className:`mt-0.5 size-5 shrink-0 text-accent`}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:M?g?`浏览器已连接`:`Browser connected`:N?g?`更新扩展后即可录制`:`Update the extension to record`:g?`连接 Chrome,录制你的操作`:`Connect Chrome to record your actions`}),(0,A.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:M?g?`在 Chrome 中切换到要录制的网页,然后开始录制。`:`Switch to the website you want to record in Chrome, then start recording.`:N?g?`当前扩展还不支持录制。更新扩展文件后,在 Chrome 扩展页重新加载 xopc。`:`Your connected extension does not support recording yet. Update its files, then reload xopc in Chrome Extensions.`:g?`录制需要 xopc Chrome 扩展。已有扩展请打开 xopc 侧栏,它会自动连接本机服务。`:`Recording uses the xopc Chrome extension. If already installed, open its side panel to connect to your local Gateway.`})]}),(0,A.jsx)(`button`,{type:`button`,disabled:w||n,onClick:m,"aria-label":g?`收起连接引导`:`Close connection guide`,className:`rounded p-1 text-fg-muted hover:bg-surface-hover`,children:(0,A.jsx)(i,{className:`size-4`})})]}),O&&!M&&(0,A.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:y?.artifacts?.installed?g?`重新加载后打开 xopc 侧栏。连接状态会自动更新。`:`After reloading, open the xopc side panel. Connection status updates automatically.`:g?`在 Chrome 扩展页开启开发者模式,点击“加载已解压的扩展程序”,选择已打开的扩展目录,再打开 xopc 侧栏。连接状态会自动更新。`:`Enable Developer mode in Chrome Extensions, choose Load unpacked and select the opened extension folder, then open the xopc side panel. Connection status updates automatically.`}),M&&e.endpoints.length>1&&(0,A.jsx)(`div`,{className:`mt-3 max-w-sm`,children:(0,A.jsx)(C,{value:t??``,ariaLabel:g?`选择录制浏览器`:`Choose a browser to record`,placeholder:g?`选择浏览器`:`Choose a browser`,allowEmpty:!1,options:e.endpoints.map(e=>({value:e.endpointId,label:e.displayName})),onChange:ee})}),(0,A.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[M?(0,A.jsx)(h,{onClick:f,disabled:n||!t&&e.endpoints.length>1,children:g?`开始录制`:`Start recording`}):x?(0,A.jsx)(p,{className:`h-9 w-32 rounded-lg`}):y?.artifacts?.extensionDir?(0,A.jsxs)(h,{onClick:()=>void P(),disabled:w,children:[w&&(0,A.jsx)(u,{className:`size-4 animate-spin`}),N?g?`更新并打开扩展页`:`Update and open extensions`:y.artifacts.installed?g?`打开 Chrome 扩展页`:`Open Chrome Extensions`:g?`安装 Chrome 扩展`:`Install Chrome extension`]}):(0,A.jsx)(h,{onClick:()=>_(`/settings/agent-browser`),children:g?`设置浏览器连接`:`Set up browser connection`}),!M&&(0,A.jsx)(h,{variant:`secondary`,disabled:w,onClick:()=>void l().catch(e=>D(e instanceof Error?e.message:String(e))),children:g?`检查连接`:`Check connection`})]}),E&&(0,A.jsx)(`p`,{className:`mt-2 text-sm text-danger`,role:`alert`,children:E})]})}var M={en:{record:`Record my actions`,finishRecording:`Finish and save`,recording:`Recording`,syncing:`Saved locally, syncing…`,verified:`Result verified`,saved:`Saved draft`,unknown:`Check the business result before repeating`,title:`Browser automations`,subtitle:`Let your assistant repeat routine actions on the web.`,emptyTitle:`No browser automations yet`,emptyBody:`Tell your assistant what to do on the web. Once it works, save it and run it again whenever you need.`,create:`Create with assistant`,edit:`Edit with assistant`,run:`Run now`,stop:`Stop`,enable:`Enable`,pause:`Pause`,enabled:`Enabled`,paused:`Paused`,inputs:`Before running`,noInputs:`This automation is ready to run.`,history:`Recent activity`,delete:`Delete automation`,confirmDelete:`Delete this browser automation?`,required:`Please complete all required fields.`,queued:`Waiting to start`,running:`Running`,succeeded:`Completed`,failed:`Needs attention`,cancelled:`Stopped`,result:`Result`,read:`Reads information`,draft:`Edits the page locally`,external_effect:`Affects an external system`,destructive:`Destructive action`,sensitive:`Sensitive action`,createPrompt:`Help me create a reusable browser automation. Ask what I want the browser to do, perform it once with me, then save the successful steps. Keep all technical details hidden.`,editPrompt:`Help me update the browser automation "{name}" (id: {id}). Ask what should change, test the new browser steps, then save it.`},zh:{record:`录制我的操作`,finishRecording:`完成并保存`,recording:`正在录制`,syncing:`已保存到本机,正在同步…`,verified:`结果已验证`,saved:`已保存草稿`,unknown:`结果待检查,请先检查业务结果再重复运行`,title:`浏览器自动化`,subtitle:`让助手自动重复完成网页上的固定操作。`,emptyTitle:`还没有浏览器自动化`,emptyBody:`告诉助手你希望在网页上自动完成什么。成功执行一次后,即可保存并重复运行。`,create:`让助手帮我创建`,edit:`让助手帮我修改`,run:`立即运行`,stop:`停止`,enable:`启用`,pause:`暂停`,enabled:`已启用`,paused:`已暂停`,inputs:`运行前需要填写`,noInputs:`这个自动化可以直接运行。`,history:`最近运行`,delete:`删除自动化`,confirmDelete:`确定删除这个浏览器自动化吗?`,required:`请填写所有必填内容。`,queued:`等待开始`,running:`正在运行`,succeeded:`已完成`,failed:`需要处理`,cancelled:`已停止`,result:`运行结果`,read:`仅读取信息`,draft:`仅在页面内编辑`,external_effect:`会影响外部系统`,destructive:`破坏性操作`,sensitive:`包含敏感操作`,createPrompt:`请帮我创建一个可重复运行的浏览器自动化。先询问我希望浏览器完成什么,陪我实际执行成功一次,然后保存成功步骤。不要让我处理技术细节。`,editPrompt:`请帮我修改浏览器自动化“{name}”(id:{id})。先询问我要修改什么,实际测试新的浏览器步骤,然后保存。`}};function N(e){return e!==`queued`&&e!==`running`}function P(e){return e==null?`-`:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?e.map(e=>`• ${P(e)}`).join(`
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{f as r}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as i}from"./x-B_N4OPjy.js";import{a,n as o,r as s}from"./locale-store-Jnhw2WMv.js";import{B as c,Cl as ee,Go as l,Gu as u,H as d,Hl as f,Rc as p,Rd as m,Wc as h,Yd as g,_f as _,fu as v,gu as y,jl as b,nf as x,rf as S,us as C,xu as w}from"./index-CzkAd5Su.js";import{i as T,n as E,r as D,t as O}from"./browser-automation-inputs-DlqyI0ez.js";var k=e(t(),1),A=n();function j({availability:e,endpointId:t,recordingBusy:n,onSelect:ee,onRefresh:l,onStart:f,onClose:m}){let g=o(e=>e.language)===`zh`,_=r(),[y,b]=(0,k.useState)(),[x,S]=(0,k.useState)(!0),[w,T]=(0,k.useState)(!1),[E,D]=(0,k.useState)(``),[O,j]=(0,k.useState)(!1),M=e.endpoints.length>0,N=e.state===`update_required`;(0,k.useEffect)(()=>{let e=!1;if(M){S(!1);return}return a(s(`/api/browser/extension-status`)).then(t=>{e||b(t)}).catch(t=>{e||D(t instanceof Error?t.message:String(t))}).finally(()=>{e||S(!1)}),()=>{e=!0}},[M]);let P=async()=>{T(!0),D(``);try{(N||!y?.artifacts?.installed||y.artifacts.needsRefresh)&&await c(N||!!y?.artifacts?.needsRefresh),await d(y?.artifacts?.installed?`chrome`:`both`),j(!0),await l()}catch(e){D(e instanceof Error?e.message:String(e))}finally{T(!1)}};return(0,A.jsxs)(`section`,{role:`status`,"aria-live":`polite`,className:`mb-4 shrink-0 rounded-xl border border-edge bg-surface-base p-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,A.jsx)(v,{className:`mt-0.5 size-5 shrink-0 text-accent`}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:M?g?`浏览器已连接`:`Browser connected`:N?g?`更新扩展后即可录制`:`Update the extension to record`:g?`连接 Chrome,录制你的操作`:`Connect Chrome to record your actions`}),(0,A.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:M?g?`在 Chrome 中切换到要录制的网页,然后开始录制。`:`Switch to the website you want to record in Chrome, then start recording.`:N?g?`当前扩展还不支持录制。更新扩展文件后,在 Chrome 扩展页重新加载 xopc。`:`Your connected extension does not support recording yet. Update its files, then reload xopc in Chrome Extensions.`:g?`录制需要 xopc Chrome 扩展。已有扩展请打开 xopc 侧栏,它会自动连接本机服务。`:`Recording uses the xopc Chrome extension. If already installed, open its side panel to connect to your local Gateway.`})]}),(0,A.jsx)(`button`,{type:`button`,disabled:w||n,onClick:m,"aria-label":g?`收起连接引导`:`Close connection guide`,className:`rounded p-1 text-fg-muted hover:bg-surface-hover`,children:(0,A.jsx)(i,{className:`size-4`})})]}),O&&!M&&(0,A.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:y?.artifacts?.installed?g?`重新加载后打开 xopc 侧栏。连接状态会自动更新。`:`After reloading, open the xopc side panel. Connection status updates automatically.`:g?`在 Chrome 扩展页开启开发者模式,点击“加载已解压的扩展程序”,选择已打开的扩展目录,再打开 xopc 侧栏。连接状态会自动更新。`:`Enable Developer mode in Chrome Extensions, choose Load unpacked and select the opened extension folder, then open the xopc side panel. Connection status updates automatically.`}),M&&e.endpoints.length>1&&(0,A.jsx)(`div`,{className:`mt-3 max-w-sm`,children:(0,A.jsx)(C,{value:t??``,ariaLabel:g?`选择录制浏览器`:`Choose a browser to record`,placeholder:g?`选择浏览器`:`Choose a browser`,allowEmpty:!1,options:e.endpoints.map(e=>({value:e.endpointId,label:e.displayName})),onChange:ee})}),(0,A.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[M?(0,A.jsx)(h,{onClick:f,disabled:n||!t&&e.endpoints.length>1,children:g?`开始录制`:`Start recording`}):x?(0,A.jsx)(p,{className:`h-9 w-32 rounded-lg`}):y?.artifacts?.extensionDir?(0,A.jsxs)(h,{onClick:()=>void P(),disabled:w,children:[w&&(0,A.jsx)(u,{className:`size-4 animate-spin`}),N?g?`更新并打开扩展页`:`Update and open extensions`:y.artifacts.installed?g?`打开 Chrome 扩展页`:`Open Chrome Extensions`:g?`安装 Chrome 扩展`:`Install Chrome extension`]}):(0,A.jsx)(h,{onClick:()=>_(`/settings/agent-browser`),children:g?`设置浏览器连接`:`Set up browser connection`}),!M&&(0,A.jsx)(h,{variant:`secondary`,disabled:w,onClick:()=>void l().catch(e=>D(e instanceof Error?e.message:String(e))),children:g?`检查连接`:`Check connection`})]}),E&&(0,A.jsx)(`p`,{className:`mt-2 text-sm text-danger`,role:`alert`,children:E})]})}var M={en:{record:`Record my actions`,finishRecording:`Finish and save`,recording:`Recording`,syncing:`Saved locally, syncing…`,verified:`Result verified`,saved:`Saved draft`,unknown:`Check the business result before repeating`,title:`Browser automations`,subtitle:`Let your assistant repeat routine actions on the web.`,emptyTitle:`No browser automations yet`,emptyBody:`Tell your assistant what to do on the web. Once it works, save it and run it again whenever you need.`,create:`Create with assistant`,edit:`Edit with assistant`,run:`Run now`,stop:`Stop`,enable:`Enable`,pause:`Pause`,enabled:`Enabled`,paused:`Paused`,inputs:`Before running`,noInputs:`This automation is ready to run.`,history:`Recent activity`,delete:`Delete automation`,confirmDelete:`Delete this browser automation?`,required:`Please complete all required fields.`,queued:`Waiting to start`,running:`Running`,succeeded:`Completed`,failed:`Needs attention`,cancelled:`Stopped`,result:`Result`,read:`Reads information`,draft:`Edits the page locally`,external_effect:`Affects an external system`,destructive:`Destructive action`,sensitive:`Sensitive action`,createPrompt:`Help me create a reusable browser automation. Ask what I want the browser to do, perform it once with me, then save the successful steps. Keep all technical details hidden.`,editPrompt:`Help me update the browser automation "{name}" (id: {id}). Ask what should change, test the new browser steps, then save it.`},zh:{record:`录制我的操作`,finishRecording:`完成并保存`,recording:`正在录制`,syncing:`已保存到本机,正在同步…`,verified:`结果已验证`,saved:`已保存草稿`,unknown:`结果待检查,请先检查业务结果再重复运行`,title:`浏览器自动化`,subtitle:`让助手自动重复完成网页上的固定操作。`,emptyTitle:`还没有浏览器自动化`,emptyBody:`告诉助手你希望在网页上自动完成什么。成功执行一次后,即可保存并重复运行。`,create:`让助手帮我创建`,edit:`让助手帮我修改`,run:`立即运行`,stop:`停止`,enable:`启用`,pause:`暂停`,enabled:`已启用`,paused:`已暂停`,inputs:`运行前需要填写`,noInputs:`这个自动化可以直接运行。`,history:`最近运行`,delete:`删除自动化`,confirmDelete:`确定删除这个浏览器自动化吗?`,required:`请填写所有必填内容。`,queued:`等待开始`,running:`正在运行`,succeeded:`已完成`,failed:`需要处理`,cancelled:`已停止`,result:`运行结果`,read:`仅读取信息`,draft:`仅在页面内编辑`,external_effect:`会影响外部系统`,destructive:`破坏性操作`,sensitive:`包含敏感操作`,createPrompt:`请帮我创建一个可重复运行的浏览器自动化。先询问我希望浏览器完成什么,陪我实际执行成功一次,然后保存成功步骤。不要让我处理技术细节。`,editPrompt:`请帮我修改浏览器自动化“{name}”(id:{id})。先询问我要修改什么,实际测试新的浏览器步骤,然后保存。`}};function N(e){return e!==`queued`&&e!==`running`}function P(e){return e==null?`-`:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?e.map(e=>`• ${P(e)}`).join(`
2
2
  `):typeof e==`object`?Object.entries(e).map(([e,t])=>`${e}: ${P(t)}`).join(`
3
3
  `):String(e)}function F(){let e=o(e=>e.language),t=M[e],n=r(),i=l(e=>e.setPageHeader),a=l(e=>e.clearPageHeader),[s,c]=(0,k.useState)(null),[u,d]=(0,k.useState)(),[v,C]=(0,k.useState)({}),[F,I]=(0,k.useState)([]),[L,R]=(0,k.useState)(),[z,B]=(0,k.useState)(``),[V,H]=(0,k.useState)(!1),[U,te]=(0,k.useState)(),[W,G]=(0,k.useState)(),[K,q]=(0,k.useState)(),J=(0,k.useMemo)(()=>s?.find(e=>e.id===u),[u,s]),Y=(0,k.useCallback)(async()=>{let e=await T.list();c(e.automations),d(t=>t&&e.automations.some(e=>e.id===t)?t:e.automations[0]?.id)},[]);(0,k.useEffect)(()=>{Y().catch(e=>B(String(e)))},[Y]),(0,k.useEffect)(()=>{J&&(C(D(J)),R(void 0),B(``),T.listRuns(J.id).then(e=>I(e.runs)).catch(e=>B(String(e))))},[J?.id,J?.revision]),(0,k.useEffect)(()=>{if(!L||N(L.status))return;let e=window.setInterval(()=>{T.getRun(L.id).then(({run:e})=>{R(e),N(e.status)&&J&&(T.listRuns(J.id).then(e=>I(e.runs)),Y())}).catch(e=>B(String(e)))},700);return()=>window.clearInterval(e)},[L,J]);let X=(0,k.useCallback)(async()=>{H(!0),B(``);try{let e=U&&[`recording`,`paused`].includes(U.state),t=W;if(!e){let e=await T.recordingAvailability();if(e.endpoints.length===1?t=e.endpoints[0].endpointId:e.endpoints.some(e=>e.endpointId===t)||(t=void 0),G(t),!t){q(e);return}}let n=await T.recording(e?`finish`:`start`,t);te(n.value),G(n.endpointId),q(void 0)}catch(e){let t=e.body;t?.code&&[`connect_required`,`update_required`,`choose_browser`].includes(t.code)?q({state:t.code,endpoints:t.endpoints??[]}):B(e instanceof Error?e.message:String(e))}finally{H(!1)}},[U,W]),ne=(0,k.useCallback)(async()=>{let e=await T.recordingAvailability();q(e),G(t=>e.endpoints.length===1?e.endpoints[0].endpointId:e.endpoints.some(e=>e.endpointId===t)?t:void 0)},[]);(0,k.useEffect)(()=>{if(!K)return;let e=!1,t=window.setInterval(()=>{T.recordingAvailability().then(t=>{e||(q(t),G(e=>t.endpoints.length===1?t.endpoints[0].endpointId:t.endpoints.some(t=>t.endpointId===e)?e:void 0))}).catch(()=>void 0)},3e3);return()=>{e=!0,window.clearInterval(t)}},[!!K]),(0,k.useEffect)(()=>{if(!U||U.automationId)return;let e=!1,t=window.setInterval(()=>{T.recording(`status`,W).then(async t=>{let n=t.value.find(e=>e.id===U.id);!e&&n&&(te(n),n.automationId&&(await Y(),e||d(n.automationId)))}).catch(t=>{e||B(String(t))})},1500);return()=>{e=!0,window.clearInterval(t)}},[U,W,Y]);let Z=(0,k.useCallback)(e=>{n(`/chat/new?draft=${encodeURIComponent(e)}`)},[n]),Q=(0,k.useMemo)(()=>(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[z&&(0,A.jsx)(`span`,{role:`alert`,className:`max-w-64 truncate text-xs text-red-600`,title:z,children:z}),U?.state===`stopped`&&!U.automationId&&(0,A.jsx)(`span`,{role:`status`,className:`text-xs text-fg-muted`,children:U.error||t.syncing}),(0,A.jsxs)(h,{variant:`secondary`,disabled:V,onClick:()=>void X(),children:[(0,A.jsx)(ee,{className:`size-4`}),U&&[`recording`,`paused`].includes(U.state)?t.finishRecording:t.record]}),(0,A.jsxs)(h,{onClick:()=>Z(t.createPrompt),children:[(0,A.jsx)(_,{className:`size-4`}),t.create]})]}),[Z,t,V,X,U,z]);(0,k.useLayoutEffect)(()=>(i({startExtra:null,main:(0,A.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title}),end:Q}),()=>a()),[a,Q,i,t.title]);let re=async()=>{if(J){H(!0);try{await T.setEnabled(J.id,!J.enabled),await Y()}catch(e){B(String(e))}finally{H(!1)}}},ie=async()=>{if(J){if(!E(J,v)){B(t.required);return}H(!0);try{let{run:e}=await T.run(J.id,v);R(e),B(``)}catch(e){B(String(e))}finally{H(!1)}}},ae=async()=>{if(!(!J||!window.confirm(t.confirmDelete))){H(!0);try{await T.remove(J.id),d(void 0),I([]),await Y()}catch(e){B(String(e))}finally{H(!1)}}},$=K&&(0,A.jsx)(j,{availability:K,endpointId:W,recordingBusy:V,onSelect:G,onRefresh:ne,onStart:()=>void X(),onClose:()=>q(void 0)});return s===null?(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-surface-panel px-4 pb-4 pt-3 sm:px-6 sm:pb-6 lg:pt-4`,children:[$,(0,A.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[280px_minmax(0,1fr)]`,children:[(0,A.jsx)(p,{className:`h-[420px] rounded-xl`}),(0,A.jsx)(p,{className:`h-[420px] rounded-xl`})]})]}):s.length===0?(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-surface-panel px-4 pb-4 pt-3 sm:px-6 sm:pb-6 lg:pt-4`,children:[$,(0,A.jsxs)(`div`,{className:`m-auto max-w-md py-12 text-center`,children:[(0,A.jsx)(_,{className:`mx-auto size-10 text-accent`}),(0,A.jsx)(`h2`,{className:`mt-4 text-lg font-semibold text-fg`,children:t.emptyTitle}),(0,A.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:t.emptyBody}),(0,A.jsxs)(h,{className:`mt-5`,onClick:()=>Z(t.createPrompt),children:[(0,A.jsx)(_,{className:`size-4`}),t.create]})]})]}):(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-surface-panel px-4 pb-4 pt-3 sm:px-6 sm:pb-6 lg:pt-4`,children:[$,(0,A.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-4 lg:grid-cols-[280px_minmax(0,1fr)]`,children:[(0,A.jsx)(`aside`,{className:`min-h-0 overflow-y-auto rounded-xl border border-edge bg-surface-base p-2`,children:s.map(e=>(0,A.jsxs)(`button`,{onClick:()=>d(e.id),className:`mb-1 w-full rounded-lg p-3 text-left ${u===e.id?`bg-accent-soft text-accent-fg`:`hover:bg-surface-hover`}`,children:[(0,A.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:e.name}),(0,A.jsxs)(`span`,{className:`mt-1 flex items-center gap-1.5 text-xs text-fg-muted`,children:[e.enabled?(0,A.jsx)(x,{className:`size-3.5 text-emerald-600`}):(0,A.jsx)(S,{className:`size-3.5`}),e.enabled?t.enabled:t.paused]})]},e.id))}),J&&(0,A.jsxs)(`main`,{className:`min-h-0 overflow-y-auto rounded-xl border border-edge bg-surface-base p-5 sm:p-6`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:J.name}),J.description&&(0,A.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:J.description}),(0,A.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 text-xs`,children:[(0,A.jsx)(`span`,{className:`rounded-full bg-surface-inset px-2.5 py-1 text-fg-muted`,children:t[J.risk]}),(0,A.jsx)(`span`,{className:`rounded-full bg-surface-inset px-2.5 py-1 text-fg-muted`,children:J.verified?t.verified:t.saved}),J.domains.map(e=>(0,A.jsxs)(`span`,{className:`flex items-center gap-1 rounded-full bg-surface-inset px-2.5 py-1 text-fg-muted`,children:[(0,A.jsx)(m,{className:`size-3`}),e]},e))]})]}),(0,A.jsxs)(`div`,{className:`flex gap-2`,children:[(0,A.jsxs)(h,{variant:`secondary`,disabled:V,onClick:()=>void re(),children:[J.enabled?(0,A.jsx)(S,{className:`size-4`}):(0,A.jsx)(x,{className:`size-4`}),J.enabled?t.pause:t.enable]}),(0,A.jsxs)(h,{variant:`secondary`,onClick:()=>Z(t.editPrompt.replace(`{name}`,J.name).replace(`{id}`,J.id)),children:[(0,A.jsx)(w,{className:`size-4`}),t.edit]})]})]}),(0,A.jsxs)(`section`,{className:`mt-7 max-w-xl`,children:[(0,A.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.inputs}),Object.keys(J.inputs).length===0?(0,A.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.noInputs}):(0,A.jsx)(`div`,{className:`mt-3`,children:(0,A.jsx)(O,{automation:J,values:v,language:e,onChange:C})}),(0,A.jsxs)(`div`,{className:`mt-5 flex gap-2`,children:[(0,A.jsxs)(h,{variant:`primary`,disabled:!J.enabled||V||!!(L&&!N(L.status)),onClick:()=>void ie(),children:[(0,A.jsx)(y,{className:`size-4`}),t.run]}),L&&!N(L.status)&&(0,A.jsxs)(h,{variant:`secondary`,onClick:()=>void T.cancel(L.id),children:[(0,A.jsx)(f,{className:`size-4`}),t.stop]})]}),z&&(0,A.jsx)(`p`,{className:`mt-3 text-sm text-red-700 dark:text-red-300`,children:z})]}),L&&(0,A.jsxs)(`section`,{className:`mt-7 rounded-xl border border-edge bg-surface-inset p-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,A.jsx)(g,{className:`size-4`}),L.businessOutcome===`verified`?t.verified:t[L.status]]}),L.businessOutcome===`unknown`&&(0,A.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.unknown}),L.error&&(0,A.jsx)(`p`,{className:`mt-2 text-sm text-red-700 dark:text-red-300`,children:L.error}),L.status===`succeeded`&&L.result!==void 0&&(0,A.jsxs)(`div`,{className:`mt-3`,children:[(0,A.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:t.result}),(0,A.jsx)(`pre`,{className:`mt-2 max-h-64 overflow-auto whitespace-pre-wrap text-sm text-fg`,children:P(L.result)})]})]}),(0,A.jsxs)(`section`,{className:`mt-8`,children:[(0,A.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.history}),(0,A.jsx)(`div`,{className:`mt-2 divide-y divide-edge`,children:F.slice(0,10).map(e=>(0,A.jsxs)(`button`,{className:`flex w-full items-center justify-between gap-3 py-3 text-left text-sm hover:text-accent`,onClick:()=>R(e),children:[(0,A.jsx)(`span`,{children:t[e.status]}),(0,A.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[new Date(e.createdAtMs).toLocaleString(),e.durationMs?` · ${Math.max(1,Math.round(e.durationMs/1e3))}s`:``]})]},e.id))})]}),(0,A.jsx)(`div`,{className:`mt-8 border-t border-edge pt-4`,children:(0,A.jsxs)(h,{variant:`ghost`,className:`text-red-700 dark:text-red-300`,disabled:V,onClick:()=>void ae(),children:[(0,A.jsx)(b,{className:`size-4`}),t.delete]})})]})]})]})}export{F as BrowserAutomationsPage};
@@ -1,3 +1,3 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,g as a}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as o}from"./circle-check-C23XjkUj.js";import{t as s}from"./download-Dk-ZjtO6.js";import{t as c}from"./external-link-DjqjBmc3.js";import{t as l}from"./eye-CABVeTq0.js";import{t as u}from"./folder-open-CyzJ19I9.js";import{t as d}from"./messages-DBvKzlCl.js";import{a as f,c as p,n as m,r as h}from"./locale-store-Jnhw2WMv.js";import{i as g}from"./vendor-swr-BIWyz7Rc.js";import{n as _,r as v}from"./gateway-config-swr-DAir1JsW.js";import{Al as y,B as b,Bd as x,G as S,Gu as C,H as w,On as T,R as ee,Rc as E,U as D,V as O,Wc as k,Wu as te,_u as ne,cu as A,eo as re,ju as ie,to as j,us as M,wd as ae,z as N}from"./index-Cmrvxc_s.js";import{t as oe}from"./number-input-DDeqHK-G.js";import{n as P,r as F}from"./settings-page-layout-Dx5S-Msc.js";import{n as se,t as I}from"./use-autosave-BZw6SkOF.js";var L=n(),R=e(t(),1);function z(e){let[t,n]=(0,R.useState)(!1),[r,i]=(0,R.useState)(!1),[a,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(null),l=(0,R.useRef)(null);return{running:t,cancelling:r,progress:a,error:s,install:(0,R.useCallback)(async()=>{if(l.current)return;let t=new AbortController;l.current=t,n(!0),o(null),c(null);try{let n=await O(o,t.signal);if(!n.ok){n.error!==`cancelled`&&c(n.message??n.error);return}e()}catch(e){t.signal.aborted||c(e instanceof Error?e.message:String(e))}finally{l.current===t&&(l.current=null),n(!1),i(!1)}},[e]),cancel:(0,R.useCallback)(async()=>{l.current&&(i(!0),await ee().catch(()=>{}),l.current.abort())},[])}}var B=r(),V={extension:`Chrome extension`,playwright:`Playwright Chromium`,cdp:`CDP`,remote:`Remote browser`};function ce(e){let{enabled:t,driverKind:n,autosaveStatus:r,zh:a}=e,s=i(),c=g(t?[`browser-control-status`,n]:null,N,{revalidateOnFocus:!0,refreshInterval:n===`extension`?3e3:0}),[l,u]=(0,R.useState)(null),[d,f]=(0,R.useState)(null),[p,m]=(0,R.useState)(null),h=r===`dirty`||r===`saving`;(0,R.useEffect)(()=>{r===`saved`&&c.mutate()},[r,c.mutate]);let _=(0,R.useCallback)(async(e,t,n)=>{u(e),f(null),m(null);try{await t(),m(n),await c.mutate()}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(null)}},[c.mutate]),v=z((0,R.useCallback)(()=>{m(a?`Chromium 已安装,可以开始连接测试。`:`Chromium is installed and ready to test.`),c.mutate()},[c.mutate,a])),b=c.data?.payload,x=b?.driverKind===n,S=t?h||!x?`syncing`:b?.state:`disabled`;return(0,B.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(S===`ready`?o:S===`syncing`?C:y,{className:`size-4 shrink-0 ${S===`ready`?`text-success`:S===`syncing`?`animate-spin text-fg-muted`:S===`disabled`?`text-fg-subtle`:`text-warning`}`}),(0,B.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:a?`浏览器就绪状态`:`Browser readiness`}),(0,B.jsx)(`span`,{className:`rounded-full px-2 py-0.5 text-xs ${S===`ready`?`bg-success-soft text-success`:S===`disabled`?`bg-surface-hover text-fg-muted`:`bg-warning-soft text-warning`}`,children:S===`ready`?a?`已就绪`:`Ready`:S===`disabled`?a?`未启用`:`Disabled`:S===`syncing`?a?`正在应用配置`:`Applying configuration`:a?`需要处理`:`Needs attention`})]}),(0,B.jsxs)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:[V[n],b?.detail&&x?` · ${b.detail}`:``]})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsxs)(k,{variant:`ghost`,className:`h-9`,onClick:()=>void c.mutate(),disabled:c.isValidating,children:[(0,B.jsx)(A,{className:`size-3.5 ${c.isValidating?`animate-spin`:``}`}),a?`刷新`:`Refresh`]}),(0,B.jsxs)(k,{variant:`secondary`,className:`h-9`,disabled:!t||h||l!==null||v.running,onClick:()=>void _(`test`,D,a?`连接测试成功。`:`Connection test passed.`),children:[l===`test`?(0,B.jsx)(C,{className:`size-3.5 animate-spin`}):(0,B.jsx)(ne,{className:`size-3.5`}),a?`测试连接`:`Test connection`]})]})]}),t&&c.isLoading?(0,B.jsxs)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-3`,children:[(0,B.jsx)(E,{className:`h-12`}),(0,B.jsx)(E,{className:`h-12`}),(0,B.jsx)(E,{className:`h-12`})]}):null,t&&c.error?(0,B.jsx)(W,{tone:`error`,children:c.error instanceof Error?c.error.message:String(c.error)}):null,d||v.error?(0,B.jsx)(W,{tone:`error`,children:d??v.error}):null,p?(0,B.jsx)(W,{tone:`success`,children:p}):null,t&&n===`extension`&&x?(0,B.jsx)(H,{status:b?.driverStatus,zh:a,busy:l,run:_,onConnectRemote:()=>s(`/settings/devices?startDevicePairing=browser`)}):null,t&&n===`playwright`&&x?(0,B.jsx)(de,{status:b?.driverStatus,zh:a,installer:v}):null,t&&n===`cdp`?(0,B.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-inset px-3 py-2 text-xs leading-5 text-fg-muted`,children:a?`连接测试会验证已保存的 CDP 地址,并复用浏览器中现有的标签页和登录状态。`:`The connection test verifies the saved CDP endpoint and reuses that browser’s existing tabs and signed-in state.`}):null,t&&n===`remote`?(0,B.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-inset px-3 py-2 text-xs leading-5 text-fg-muted`,children:a?`连接测试会在服务商侧创建一个临时浏览器会话,并在测试结束后立即关闭。`:`The connection test creates a temporary provider session and closes it immediately after the test.`}):null]})}function H(e){let t=(0,L.c)(70),{status:n,zh:r,busy:i,run:a,onConnectRemote:o}=e,l=n?.artifacts,d=r?`扩展文件`:`Extension files`,f=l?.installed===!0,p=l?.installed?r?`已安装`:`Installed`:r?`未安装或需更新`:`Install or update required`,m;t[0]!==d||t[1]!==f||t[2]!==p?(m=(0,B.jsx)(U,{label:d,ok:f,value:p}),t[0]=d,t[1]=f,t[2]=p,t[3]=m):m=t[3];let h=r?`本机自动发现`:`Local auto-discovery`,g=l?.nativeHost?.installed===!0,_=l?.nativeHost?.installed?r?`已就绪`:`Ready`:l?.nativeHost?.reason??(r?`需要修复`:`Repair required`),v;t[4]!==h||t[5]!==g||t[6]!==_?(v=(0,B.jsx)(U,{label:h,ok:g,value:_}),t[4]=h,t[5]=g,t[6]=_,t[7]=v):v=t[7];let y=r?`安全通道`:`Secure channel`,x=n?.transport===`gateway-realtime`,S=n?.transport===`gateway-realtime`?`Gateway Realtime`:r?`不可用`:`Unavailable`,w;t[8]!==S||t[9]!==y||t[10]!==x?(w=(0,B.jsx)(U,{label:y,ok:x,value:S}),t[8]=S,t[9]=y,t[10]=x,t[11]=w):w=t[11];let T=r?`Chrome 连接`:`Chrome connection`,ee=n?.connected===!0,E=n?.connected?r?`已连接`:`Connected`:n?.socketConnected?r?`需要重新加载扩展`:`Reload extension`:r?`等待扩展连接`:`Waiting for extension`,D;t[12]!==T||t[13]!==ee||t[14]!==E?(D=(0,B.jsx)(U,{label:T,ok:ee,value:E}),t[12]=T,t[13]=ee,t[14]=E,t[15]=D):D=t[15];let O;t[16]!==w||t[17]!==D||t[18]!==m||t[19]!==v?(O=(0,B.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-4`,children:[m,v,w,D]}),t[16]=w,t[17]=D,t[18]=m,t[19]=v,t[20]=O):O=t[20];let te=l?.extensionDir??`Gateway Realtime`,A;t[21]===te?A=t[22]:(A=(0,B.jsx)(`p`,{className:`mt-3 break-all text-xs text-fg-subtle`,children:te}),t[21]=te,t[22]=A);let re=l?.installed?`secondary`:`primary`,ie=i!==null,j;t[23]!==l?.installed||t[24]!==a||t[25]!==r?(j=()=>void a(`extension-install`,()=>b(!!l?.installed),r?`扩展文件已准备好。`:`Extension files are ready.`),t[23]=l?.installed,t[24]=a,t[25]=r,t[26]=j):j=t[26];let M;t[27]===i?M=t[28]:(M=i===`extension-install`?(0,B.jsx)(C,{className:`size-3.5 animate-spin`}):(0,B.jsx)(s,{className:`size-3.5`}),t[27]=i,t[28]=M);let ae=l?.installed?r?`刷新扩展文件`:`Refresh files`:r?`安装扩展文件`:`Install extension`,N;t[29]!==re||t[30]!==ie||t[31]!==j||t[32]!==M||t[33]!==ae?(N=(0,B.jsxs)(k,{className:`h-9`,variant:re,disabled:ie,onClick:j,children:[M,ae]}),t[29]=re,t[30]=ie,t[31]=j,t[32]=M,t[33]=ae,t[34]=N):N=t[34];let oe=!l?.installed||i!==null,P;t[35]!==a||t[36]!==r?(P=()=>void a(`extension-open`,ue,r?`已打开 Chrome 扩展页。`:`Chrome extensions opened.`),t[35]=a,t[36]=r,t[37]=P):P=t[37];let F;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,B.jsx)(c,{className:`size-3.5`}),t[38]=F):F=t[38];let se=r?`打开扩展页`:`Open extensions`,I;t[39]!==oe||t[40]!==P||t[41]!==se?(I=(0,B.jsxs)(k,{className:`h-9`,variant:`secondary`,disabled:oe,onClick:P,children:[F,se]}),t[39]=oe,t[40]=P,t[41]=se,t[42]=I):I=t[42];let R=!l?.installed||i!==null,z;t[43]!==a||t[44]!==r?(z=()=>void a(`extension-folder`,le,r?`已打开扩展目录。`:`Extension folder opened.`),t[43]=a,t[44]=r,t[45]=z):z=t[45];let V;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,B.jsx)(u,{className:`size-3.5`}),t[46]=V):V=t[46];let ce=r?`打开扩展目录`:`Open folder`,H;t[47]!==R||t[48]!==z||t[49]!==ce?(H=(0,B.jsxs)(k,{className:`h-9`,variant:`ghost`,disabled:R,onClick:z,children:[V,ce]}),t[47]=R,t[48]=z,t[49]=ce,t[50]=H):H=t[50];let de=i!==null,W;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,B.jsx)(ne,{className:`size-3.5`}),t[51]=W):W=t[51];let fe=r?`连接远程 Chrome`:`Connect remote Chrome`,G;t[52]!==o||t[53]!==de||t[54]!==fe?(G=(0,B.jsxs)(k,{className:`h-9`,variant:`secondary`,disabled:de,onClick:o,children:[W,fe]}),t[52]=o,t[53]=de,t[54]=fe,t[55]=G):G=t[55];let K;t[56]!==N||t[57]!==I||t[58]!==H||t[59]!==G?(K=(0,B.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[N,I,H,G]}),t[56]=N,t[57]=I,t[58]=H,t[59]=G,t[60]=K):K=t[60];let q;t[61]!==n?.connected||t[62]!==n?.socketConnected||t[63]!==r?(q=n?.connected?null:(0,B.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-fg-muted`,children:n?.socketConnected?r?`扩展仍在运行旧协议。请打开 Chrome 扩展页,找到 xopc 并点击“重新加载”,然后刷新状态。`:`The extension is still running an older protocol. Open Chrome Extensions, find xopc, click Reload, then refresh status.`:r?`打开 xopc Chrome 扩展后,它会自动发现并安全连接本机 Gateway;只有连接另一台电脑时才需要一次性邀请和手动确认。`:`Open the xopc Chrome extension to discover and securely connect to a local Gateway automatically. A one-time invitation and explicit approval are only required for Chrome on another computer.`}),t[61]=n?.connected,t[62]=n?.socketConnected,t[63]=r,t[64]=q):q=t[64];let J;return t[65]!==O||t[66]!==A||t[67]!==K||t[68]!==q?(J=(0,B.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base/45 p-4`,children:[O,A,K,q]}),t[65]=O,t[66]=A,t[67]=K,t[68]=q,t[69]=J):J=t[69],J}function le(){return w(`folder`)}function ue(){return w(`chrome`)}function de(e){let t=(0,L.c)(28),{status:n,zh:r,installer:i}=e,a=n?.installed===!0,o=n?.installed?r?`已安装`:`Installed`:n?.reason??(r?`未安装`:`Not installed`),c;t[0]!==a||t[1]!==o?(c=(0,B.jsx)(U,{label:`Chromium`,ok:a,value:o}),t[0]=a,t[1]=o,t[2]=c):c=t[2];let l;t[3]===n?l=t[4]:(l=n?.executablePath?(0,B.jsx)(`p`,{className:`mt-2 break-all text-xs text-fg-subtle`,children:n.executablePath}):null,t[3]=n,t[4]=l);let u;t[5]===i.progress?u=t[6]:(u=i.progress?(0,B.jsxs)(`div`,{className:`mt-3`,children:[(0,B.jsxs)(`div`,{className:`flex justify-between text-xs text-fg-muted`,children:[(0,B.jsx)(`span`,{children:i.progress.message??i.progress.phase}),(0,B.jsx)(`span`,{children:i.progress.percent==null?``:`${Math.round(i.progress.percent)}%`})]}),(0,B.jsx)(`div`,{className:`mt-1 h-1.5 overflow-hidden rounded-full bg-surface-hover`,children:(0,B.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width]`,style:{width:`${i.progress.percent??8}%`}})})]}):null,t[5]=i.progress,t[6]=u);let d=n?.installed?`secondary`:`primary`,f;t[7]===i?f=t[8]:(f=()=>void i.install(),t[7]=i,t[8]=f);let p;t[9]===i.running?p=t[10]:(p=i.running?(0,B.jsx)(C,{className:`size-3.5 animate-spin`}):(0,B.jsx)(s,{className:`size-3.5`}),t[9]=i.running,t[10]=p);let m=n?.installed?r?`重新安装 Chromium`:`Reinstall Chromium`:r?`安装 Chromium`:`Install Chromium`,h;t[11]!==i.running||t[12]!==d||t[13]!==f||t[14]!==p||t[15]!==m?(h=(0,B.jsxs)(k,{variant:d,className:`h-9`,disabled:i.running,onClick:f,children:[p,m]}),t[11]=i.running,t[12]=d,t[13]=f,t[14]=p,t[15]=m,t[16]=h):h=t[16];let g;t[17]!==i||t[18]!==r?(g=i.running?(0,B.jsx)(k,{variant:`ghost`,className:`h-9`,disabled:i.cancelling,onClick:()=>void i.cancel(),children:i.cancelling?r?`正在取消…`:`Cancelling…`:r?`取消`:`Cancel`}):null,t[17]=i,t[18]=r,t[19]=g):g=t[19];let _;t[20]!==g||t[21]!==h?(_=(0,B.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[h,g]}),t[20]=g,t[21]=h,t[22]=_):_=t[22];let v;return t[23]!==_||t[24]!==c||t[25]!==l||t[26]!==u?(v=(0,B.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base/45 p-4`,children:[c,l,u,_]}),t[23]=_,t[24]=c,t[25]=l,t[26]=u,t[27]=v):v=t[27],v}function U(e){let t=(0,L.c)(11),{label:n,ok:r,value:i}=e,a;t[0]===n?a=t[1]:(a=(0,B.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n}),t[0]=n,t[1]=a);let o=`mt-1 flex items-center gap-1.5 text-sm ${r?`text-success`:`text-fg-muted`}`,s=`size-1.5 rounded-full ${r?`bg-success`:`bg-warning`}`,c;t[2]===s?c=t[3]:(c=(0,B.jsx)(`span`,{className:s}),t[2]=s,t[3]=c);let l;t[4]!==o||t[5]!==c||t[6]!==i?(l=(0,B.jsxs)(`p`,{className:o,children:[c,i]}),t[4]=o,t[5]=c,t[6]=i,t[7]=l):l=t[7];let u;return t[8]!==a||t[9]!==l?(u=(0,B.jsxs)(`div`,{className:`rounded-lg bg-surface-inset px-3 py-2`,children:[a,l]}),t[8]=a,t[9]=l,t[10]=u):u=t[10],u}function W(e){let t=(0,L.c)(4),{tone:n,children:r}=e,i=`mt-3 rounded-lg px-3 py-2 text-xs ${n===`success`?`bg-success-soft text-success`:`bg-danger-soft text-danger`}`,a=n===`error`?`alert`:`status`,o;return t[0]!==r||t[1]!==i||t[2]!==a?(o=(0,B.jsx)(`p`,{className:i,role:a,children:r}),t[0]=r,t[1]=i,t[2]=a,t[3]=o):o=t[3],o}function fe(e){let t=(0,L.c)(36),{sectionId:n,vm:r,children:i}=e,a=m(G),o;t[0]===a?o=t[1]:(o=d(a),t[0]=a,t[1]=o);let s=o,c=s.agentSettings,l=s.settingsSections[n]??n;if(!r.hasToken){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,B.jsx)(x,{className:`mt-0.5 size-5 shrink-0 text-fg-subtle`,strokeWidth:1.75}),t[2]=e):e=t[2];let n;t[3]===l?n=t[4]:(n=(0,B.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:l}),t[3]=l,t[4]=n);let r;t[5]===c.needToken?r=t[6]:(r=(0,B.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:c.needToken}),t[5]=c.needToken,t[6]=r);let i;return t[7]!==n||t[8]!==r?(i=(0,B.jsx)(F,{gap:`gap-3`,padding:`px-3 py-10 sm:px-5 xl:px-6`,children:(0,B.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl bg-surface-base p-6`,children:[e,(0,B.jsxs)(`div`,{children:[n,r]})]})}),t[7]=n,t[8]=r,t[9]=i):i=t[9],i}if(r.loading){let e;return t[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,B.jsx)(F,{gap:`gap-6`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:(0,B.jsx)(T,{sections:1})}),t[10]=e):e=t[10],e}if(!r.form){let e=r.error??r.fetchError??c.loadError,n;t[11]===e?n=t[12]:(n=(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e}),t[11]=e,t[12]=n);let i;t[13]===r?i=t[14]:(i=()=>void r.mutate(),t[13]=r,t[14]=i);let a;t[15]!==s.logs.refresh||t[16]!==i?(a=(0,B.jsx)(k,{type:`button`,variant:`secondary`,onClick:i,children:s.logs.refresh}),t[15]=s.logs.refresh,t[16]=i,t[17]=a):a=t[17];let o;return t[18]!==n||t[19]!==a?(o=(0,B.jsxs)(F,{gap:`gap-3`,padding:`px-3 py-10 sm:px-5 xl:px-6`,children:[n,a]}),t[18]=n,t[19]=a,t[20]=o):o=t[20],o}let u;t[21]!==r.autosaveStatus||t[22]!==r.error?(u=(0,B.jsx)(se,{status:r.autosaveStatus,error:r.error}),t[21]=r.autosaveStatus,t[22]=r.error,t[23]=u):u=t[23];let f;t[24]!==l||t[25]!==u?(f=(0,B.jsx)(P,{title:l,actions:u}),t[24]=l,t[25]=u,t[26]=f):f=t[26];let p;t[27]===r.error?p=t[28]:(p=r.error?(0,B.jsx)(`div`,{className:`rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/50 dark:text-red-400`,role:`alert`,children:r.error}):null,t[27]=r.error,t[28]=p);let h;t[29]===i?h=t[30]:(h=(0,B.jsx)(`div`,{className:`flex min-w-0 flex-col gap-5 pb-8`,children:i}),t[29]=i,t[30]=h);let g;return t[31]!==f||t[32]!==p||t[33]!==h||t[34]!==r.onBlurCapture?(g=(0,B.jsxs)(F,{gap:`gap-6`,onBlurCapture:r.onBlurCapture,children:[f,p,h]}),t[31]=f,t[32]=p,t[33]=h,t[34]=r.onBlurCapture,t[35]=g):g=t[35],g}function G(e){return e.language}var K={enabled:!0,driverKind:`extension`,headless:!1,executablePath:``,cdpEndpoint:`http://127.0.0.1:9222`,remoteProvider:`browserbase`,remoteApiKey:``,remoteProjectId:``,remoteRegion:``,maxNodes:180,maxCharacters:12e3,visualFallback:!0,actionTimeoutMs:3e4,sessionTimeoutMs:9e5,maxSequenceLength:5,allowedPrivateHosts:``,crossDomainNavigation:`allow`,uploads:`allow`,consequentialActions:`allow`};function q(e){let t=Y(Y(e).browser),n=Y(t.driver),r=Y(t.observation),i=Y(t.limits),a=Y(t.security),o=n.kind;return{...K,enabled:t.enabled!==!1,driverKind:o===`playwright`||o===`cdp`||o===`remote`?o:`extension`,headless:n.headless===!0,executablePath:X(n.executablePath,``),cdpEndpoint:X(n.endpoint,K.cdpEndpoint),remoteProvider:n.provider===`browser-use`?`browser-use`:`browserbase`,remoteApiKey:X(n.apiKey,``),remoteProjectId:X(n.projectId,``),remoteRegion:X(n.region,``),maxNodes:Z(r.maxNodes,K.maxNodes),maxCharacters:Z(r.maxCharacters,K.maxCharacters),visualFallback:r.visualFallback!==!1,actionTimeoutMs:Z(i.actionTimeoutMs,K.actionTimeoutMs),sessionTimeoutMs:Z(i.sessionTimeoutMs,K.sessionTimeoutMs),maxSequenceLength:Z(i.maxSequenceLength,K.maxSequenceLength),allowedPrivateHosts:Array.isArray(a.allowedPrivateHosts)?a.allowedPrivateHosts.filter(e=>typeof e==`string`).join(`
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,g as a}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as o}from"./circle-check-C23XjkUj.js";import{t as s}from"./download-Dk-ZjtO6.js";import{t as c}from"./external-link-DjqjBmc3.js";import{t as l}from"./eye-CABVeTq0.js";import{t as u}from"./folder-open-CyzJ19I9.js";import{t as d}from"./messages-DBvKzlCl.js";import{a as f,c as p,n as m,r as h}from"./locale-store-Jnhw2WMv.js";import{i as g}from"./vendor-swr-BIWyz7Rc.js";import{n as _,r as v}from"./gateway-config-swr-DAir1JsW.js";import{Al as y,B as b,Bd as x,G as S,Gu as C,H as w,On as T,R as ee,Rc as E,U as D,V as O,Wc as k,Wu as te,_u as ne,cu as A,eo as re,ju as ie,to as j,us as M,wd as ae,z as N}from"./index-CzkAd5Su.js";import{t as oe}from"./number-input-DDeqHK-G.js";import{n as P,r as F}from"./settings-page-layout-Dx5S-Msc.js";import{n as se,t as I}from"./use-autosave-BmbPOiQU.js";var L=n(),R=e(t(),1);function z(e){let[t,n]=(0,R.useState)(!1),[r,i]=(0,R.useState)(!1),[a,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(null),l=(0,R.useRef)(null);return{running:t,cancelling:r,progress:a,error:s,install:(0,R.useCallback)(async()=>{if(l.current)return;let t=new AbortController;l.current=t,n(!0),o(null),c(null);try{let n=await O(o,t.signal);if(!n.ok){n.error!==`cancelled`&&c(n.message??n.error);return}e()}catch(e){t.signal.aborted||c(e instanceof Error?e.message:String(e))}finally{l.current===t&&(l.current=null),n(!1),i(!1)}},[e]),cancel:(0,R.useCallback)(async()=>{l.current&&(i(!0),await ee().catch(()=>{}),l.current.abort())},[])}}var B=r(),V={extension:`Chrome extension`,playwright:`Playwright Chromium`,cdp:`CDP`,remote:`Remote browser`};function ce(e){let{enabled:t,driverKind:n,autosaveStatus:r,zh:a}=e,s=i(),c=g(t?[`browser-control-status`,n]:null,N,{revalidateOnFocus:!0,refreshInterval:n===`extension`?3e3:0}),[l,u]=(0,R.useState)(null),[d,f]=(0,R.useState)(null),[p,m]=(0,R.useState)(null),h=r===`dirty`||r===`saving`;(0,R.useEffect)(()=>{r===`saved`&&c.mutate()},[r,c.mutate]);let _=(0,R.useCallback)(async(e,t,n)=>{u(e),f(null),m(null);try{await t(),m(n),await c.mutate()}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(null)}},[c.mutate]),v=z((0,R.useCallback)(()=>{m(a?`Chromium 已安装,可以开始连接测试。`:`Chromium is installed and ready to test.`),c.mutate()},[c.mutate,a])),b=c.data?.payload,x=b?.driverKind===n,S=t?h||!x?`syncing`:b?.state:`disabled`;return(0,B.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(S===`ready`?o:S===`syncing`?C:y,{className:`size-4 shrink-0 ${S===`ready`?`text-success`:S===`syncing`?`animate-spin text-fg-muted`:S===`disabled`?`text-fg-subtle`:`text-warning`}`}),(0,B.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:a?`浏览器就绪状态`:`Browser readiness`}),(0,B.jsx)(`span`,{className:`rounded-full px-2 py-0.5 text-xs ${S===`ready`?`bg-success-soft text-success`:S===`disabled`?`bg-surface-hover text-fg-muted`:`bg-warning-soft text-warning`}`,children:S===`ready`?a?`已就绪`:`Ready`:S===`disabled`?a?`未启用`:`Disabled`:S===`syncing`?a?`正在应用配置`:`Applying configuration`:a?`需要处理`:`Needs attention`})]}),(0,B.jsxs)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:[V[n],b?.detail&&x?` · ${b.detail}`:``]})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsxs)(k,{variant:`ghost`,className:`h-9`,onClick:()=>void c.mutate(),disabled:c.isValidating,children:[(0,B.jsx)(A,{className:`size-3.5 ${c.isValidating?`animate-spin`:``}`}),a?`刷新`:`Refresh`]}),(0,B.jsxs)(k,{variant:`secondary`,className:`h-9`,disabled:!t||h||l!==null||v.running,onClick:()=>void _(`test`,D,a?`连接测试成功。`:`Connection test passed.`),children:[l===`test`?(0,B.jsx)(C,{className:`size-3.5 animate-spin`}):(0,B.jsx)(ne,{className:`size-3.5`}),a?`测试连接`:`Test connection`]})]})]}),t&&c.isLoading?(0,B.jsxs)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-3`,children:[(0,B.jsx)(E,{className:`h-12`}),(0,B.jsx)(E,{className:`h-12`}),(0,B.jsx)(E,{className:`h-12`})]}):null,t&&c.error?(0,B.jsx)(W,{tone:`error`,children:c.error instanceof Error?c.error.message:String(c.error)}):null,d||v.error?(0,B.jsx)(W,{tone:`error`,children:d??v.error}):null,p?(0,B.jsx)(W,{tone:`success`,children:p}):null,t&&n===`extension`&&x?(0,B.jsx)(H,{status:b?.driverStatus,zh:a,busy:l,run:_,onConnectRemote:()=>s(`/settings/devices?startDevicePairing=browser`)}):null,t&&n===`playwright`&&x?(0,B.jsx)(de,{status:b?.driverStatus,zh:a,installer:v}):null,t&&n===`cdp`?(0,B.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-inset px-3 py-2 text-xs leading-5 text-fg-muted`,children:a?`连接测试会验证已保存的 CDP 地址,并复用浏览器中现有的标签页和登录状态。`:`The connection test verifies the saved CDP endpoint and reuses that browser’s existing tabs and signed-in state.`}):null,t&&n===`remote`?(0,B.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-inset px-3 py-2 text-xs leading-5 text-fg-muted`,children:a?`连接测试会在服务商侧创建一个临时浏览器会话,并在测试结束后立即关闭。`:`The connection test creates a temporary provider session and closes it immediately after the test.`}):null]})}function H(e){let t=(0,L.c)(70),{status:n,zh:r,busy:i,run:a,onConnectRemote:o}=e,l=n?.artifacts,d=r?`扩展文件`:`Extension files`,f=l?.installed===!0,p=l?.installed?r?`已安装`:`Installed`:r?`未安装或需更新`:`Install or update required`,m;t[0]!==d||t[1]!==f||t[2]!==p?(m=(0,B.jsx)(U,{label:d,ok:f,value:p}),t[0]=d,t[1]=f,t[2]=p,t[3]=m):m=t[3];let h=r?`本机自动发现`:`Local auto-discovery`,g=l?.nativeHost?.installed===!0,_=l?.nativeHost?.installed?r?`已就绪`:`Ready`:l?.nativeHost?.reason??(r?`需要修复`:`Repair required`),v;t[4]!==h||t[5]!==g||t[6]!==_?(v=(0,B.jsx)(U,{label:h,ok:g,value:_}),t[4]=h,t[5]=g,t[6]=_,t[7]=v):v=t[7];let y=r?`安全通道`:`Secure channel`,x=n?.transport===`gateway-realtime`,S=n?.transport===`gateway-realtime`?`Gateway Realtime`:r?`不可用`:`Unavailable`,w;t[8]!==S||t[9]!==y||t[10]!==x?(w=(0,B.jsx)(U,{label:y,ok:x,value:S}),t[8]=S,t[9]=y,t[10]=x,t[11]=w):w=t[11];let T=r?`Chrome 连接`:`Chrome connection`,ee=n?.connected===!0,E=n?.connected?r?`已连接`:`Connected`:n?.socketConnected?r?`需要重新加载扩展`:`Reload extension`:r?`等待扩展连接`:`Waiting for extension`,D;t[12]!==T||t[13]!==ee||t[14]!==E?(D=(0,B.jsx)(U,{label:T,ok:ee,value:E}),t[12]=T,t[13]=ee,t[14]=E,t[15]=D):D=t[15];let O;t[16]!==w||t[17]!==D||t[18]!==m||t[19]!==v?(O=(0,B.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-4`,children:[m,v,w,D]}),t[16]=w,t[17]=D,t[18]=m,t[19]=v,t[20]=O):O=t[20];let te=l?.extensionDir??`Gateway Realtime`,A;t[21]===te?A=t[22]:(A=(0,B.jsx)(`p`,{className:`mt-3 break-all text-xs text-fg-subtle`,children:te}),t[21]=te,t[22]=A);let re=l?.installed?`secondary`:`primary`,ie=i!==null,j;t[23]!==l?.installed||t[24]!==a||t[25]!==r?(j=()=>void a(`extension-install`,()=>b(!!l?.installed),r?`扩展文件已准备好。`:`Extension files are ready.`),t[23]=l?.installed,t[24]=a,t[25]=r,t[26]=j):j=t[26];let M;t[27]===i?M=t[28]:(M=i===`extension-install`?(0,B.jsx)(C,{className:`size-3.5 animate-spin`}):(0,B.jsx)(s,{className:`size-3.5`}),t[27]=i,t[28]=M);let ae=l?.installed?r?`刷新扩展文件`:`Refresh files`:r?`安装扩展文件`:`Install extension`,N;t[29]!==re||t[30]!==ie||t[31]!==j||t[32]!==M||t[33]!==ae?(N=(0,B.jsxs)(k,{className:`h-9`,variant:re,disabled:ie,onClick:j,children:[M,ae]}),t[29]=re,t[30]=ie,t[31]=j,t[32]=M,t[33]=ae,t[34]=N):N=t[34];let oe=!l?.installed||i!==null,P;t[35]!==a||t[36]!==r?(P=()=>void a(`extension-open`,ue,r?`已打开 Chrome 扩展页。`:`Chrome extensions opened.`),t[35]=a,t[36]=r,t[37]=P):P=t[37];let F;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,B.jsx)(c,{className:`size-3.5`}),t[38]=F):F=t[38];let se=r?`打开扩展页`:`Open extensions`,I;t[39]!==oe||t[40]!==P||t[41]!==se?(I=(0,B.jsxs)(k,{className:`h-9`,variant:`secondary`,disabled:oe,onClick:P,children:[F,se]}),t[39]=oe,t[40]=P,t[41]=se,t[42]=I):I=t[42];let R=!l?.installed||i!==null,z;t[43]!==a||t[44]!==r?(z=()=>void a(`extension-folder`,le,r?`已打开扩展目录。`:`Extension folder opened.`),t[43]=a,t[44]=r,t[45]=z):z=t[45];let V;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,B.jsx)(u,{className:`size-3.5`}),t[46]=V):V=t[46];let ce=r?`打开扩展目录`:`Open folder`,H;t[47]!==R||t[48]!==z||t[49]!==ce?(H=(0,B.jsxs)(k,{className:`h-9`,variant:`ghost`,disabled:R,onClick:z,children:[V,ce]}),t[47]=R,t[48]=z,t[49]=ce,t[50]=H):H=t[50];let de=i!==null,W;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,B.jsx)(ne,{className:`size-3.5`}),t[51]=W):W=t[51];let fe=r?`连接远程 Chrome`:`Connect remote Chrome`,G;t[52]!==o||t[53]!==de||t[54]!==fe?(G=(0,B.jsxs)(k,{className:`h-9`,variant:`secondary`,disabled:de,onClick:o,children:[W,fe]}),t[52]=o,t[53]=de,t[54]=fe,t[55]=G):G=t[55];let K;t[56]!==N||t[57]!==I||t[58]!==H||t[59]!==G?(K=(0,B.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[N,I,H,G]}),t[56]=N,t[57]=I,t[58]=H,t[59]=G,t[60]=K):K=t[60];let q;t[61]!==n?.connected||t[62]!==n?.socketConnected||t[63]!==r?(q=n?.connected?null:(0,B.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-fg-muted`,children:n?.socketConnected?r?`扩展仍在运行旧协议。请打开 Chrome 扩展页,找到 xopc 并点击“重新加载”,然后刷新状态。`:`The extension is still running an older protocol. Open Chrome Extensions, find xopc, click Reload, then refresh status.`:r?`打开 xopc Chrome 扩展后,它会自动发现并安全连接本机 Gateway;只有连接另一台电脑时才需要一次性邀请和手动确认。`:`Open the xopc Chrome extension to discover and securely connect to a local Gateway automatically. A one-time invitation and explicit approval are only required for Chrome on another computer.`}),t[61]=n?.connected,t[62]=n?.socketConnected,t[63]=r,t[64]=q):q=t[64];let J;return t[65]!==O||t[66]!==A||t[67]!==K||t[68]!==q?(J=(0,B.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base/45 p-4`,children:[O,A,K,q]}),t[65]=O,t[66]=A,t[67]=K,t[68]=q,t[69]=J):J=t[69],J}function le(){return w(`folder`)}function ue(){return w(`chrome`)}function de(e){let t=(0,L.c)(28),{status:n,zh:r,installer:i}=e,a=n?.installed===!0,o=n?.installed?r?`已安装`:`Installed`:n?.reason??(r?`未安装`:`Not installed`),c;t[0]!==a||t[1]!==o?(c=(0,B.jsx)(U,{label:`Chromium`,ok:a,value:o}),t[0]=a,t[1]=o,t[2]=c):c=t[2];let l;t[3]===n?l=t[4]:(l=n?.executablePath?(0,B.jsx)(`p`,{className:`mt-2 break-all text-xs text-fg-subtle`,children:n.executablePath}):null,t[3]=n,t[4]=l);let u;t[5]===i.progress?u=t[6]:(u=i.progress?(0,B.jsxs)(`div`,{className:`mt-3`,children:[(0,B.jsxs)(`div`,{className:`flex justify-between text-xs text-fg-muted`,children:[(0,B.jsx)(`span`,{children:i.progress.message??i.progress.phase}),(0,B.jsx)(`span`,{children:i.progress.percent==null?``:`${Math.round(i.progress.percent)}%`})]}),(0,B.jsx)(`div`,{className:`mt-1 h-1.5 overflow-hidden rounded-full bg-surface-hover`,children:(0,B.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width]`,style:{width:`${i.progress.percent??8}%`}})})]}):null,t[5]=i.progress,t[6]=u);let d=n?.installed?`secondary`:`primary`,f;t[7]===i?f=t[8]:(f=()=>void i.install(),t[7]=i,t[8]=f);let p;t[9]===i.running?p=t[10]:(p=i.running?(0,B.jsx)(C,{className:`size-3.5 animate-spin`}):(0,B.jsx)(s,{className:`size-3.5`}),t[9]=i.running,t[10]=p);let m=n?.installed?r?`重新安装 Chromium`:`Reinstall Chromium`:r?`安装 Chromium`:`Install Chromium`,h;t[11]!==i.running||t[12]!==d||t[13]!==f||t[14]!==p||t[15]!==m?(h=(0,B.jsxs)(k,{variant:d,className:`h-9`,disabled:i.running,onClick:f,children:[p,m]}),t[11]=i.running,t[12]=d,t[13]=f,t[14]=p,t[15]=m,t[16]=h):h=t[16];let g;t[17]!==i||t[18]!==r?(g=i.running?(0,B.jsx)(k,{variant:`ghost`,className:`h-9`,disabled:i.cancelling,onClick:()=>void i.cancel(),children:i.cancelling?r?`正在取消…`:`Cancelling…`:r?`取消`:`Cancel`}):null,t[17]=i,t[18]=r,t[19]=g):g=t[19];let _;t[20]!==g||t[21]!==h?(_=(0,B.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[h,g]}),t[20]=g,t[21]=h,t[22]=_):_=t[22];let v;return t[23]!==_||t[24]!==c||t[25]!==l||t[26]!==u?(v=(0,B.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base/45 p-4`,children:[c,l,u,_]}),t[23]=_,t[24]=c,t[25]=l,t[26]=u,t[27]=v):v=t[27],v}function U(e){let t=(0,L.c)(11),{label:n,ok:r,value:i}=e,a;t[0]===n?a=t[1]:(a=(0,B.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n}),t[0]=n,t[1]=a);let o=`mt-1 flex items-center gap-1.5 text-sm ${r?`text-success`:`text-fg-muted`}`,s=`size-1.5 rounded-full ${r?`bg-success`:`bg-warning`}`,c;t[2]===s?c=t[3]:(c=(0,B.jsx)(`span`,{className:s}),t[2]=s,t[3]=c);let l;t[4]!==o||t[5]!==c||t[6]!==i?(l=(0,B.jsxs)(`p`,{className:o,children:[c,i]}),t[4]=o,t[5]=c,t[6]=i,t[7]=l):l=t[7];let u;return t[8]!==a||t[9]!==l?(u=(0,B.jsxs)(`div`,{className:`rounded-lg bg-surface-inset px-3 py-2`,children:[a,l]}),t[8]=a,t[9]=l,t[10]=u):u=t[10],u}function W(e){let t=(0,L.c)(4),{tone:n,children:r}=e,i=`mt-3 rounded-lg px-3 py-2 text-xs ${n===`success`?`bg-success-soft text-success`:`bg-danger-soft text-danger`}`,a=n===`error`?`alert`:`status`,o;return t[0]!==r||t[1]!==i||t[2]!==a?(o=(0,B.jsx)(`p`,{className:i,role:a,children:r}),t[0]=r,t[1]=i,t[2]=a,t[3]=o):o=t[3],o}function fe(e){let t=(0,L.c)(36),{sectionId:n,vm:r,children:i}=e,a=m(G),o;t[0]===a?o=t[1]:(o=d(a),t[0]=a,t[1]=o);let s=o,c=s.agentSettings,l=s.settingsSections[n]??n;if(!r.hasToken){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,B.jsx)(x,{className:`mt-0.5 size-5 shrink-0 text-fg-subtle`,strokeWidth:1.75}),t[2]=e):e=t[2];let n;t[3]===l?n=t[4]:(n=(0,B.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:l}),t[3]=l,t[4]=n);let r;t[5]===c.needToken?r=t[6]:(r=(0,B.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:c.needToken}),t[5]=c.needToken,t[6]=r);let i;return t[7]!==n||t[8]!==r?(i=(0,B.jsx)(F,{gap:`gap-3`,padding:`px-3 py-10 sm:px-5 xl:px-6`,children:(0,B.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl bg-surface-base p-6`,children:[e,(0,B.jsxs)(`div`,{children:[n,r]})]})}),t[7]=n,t[8]=r,t[9]=i):i=t[9],i}if(r.loading){let e;return t[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,B.jsx)(F,{gap:`gap-6`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:(0,B.jsx)(T,{sections:1})}),t[10]=e):e=t[10],e}if(!r.form){let e=r.error??r.fetchError??c.loadError,n;t[11]===e?n=t[12]:(n=(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e}),t[11]=e,t[12]=n);let i;t[13]===r?i=t[14]:(i=()=>void r.mutate(),t[13]=r,t[14]=i);let a;t[15]!==s.logs.refresh||t[16]!==i?(a=(0,B.jsx)(k,{type:`button`,variant:`secondary`,onClick:i,children:s.logs.refresh}),t[15]=s.logs.refresh,t[16]=i,t[17]=a):a=t[17];let o;return t[18]!==n||t[19]!==a?(o=(0,B.jsxs)(F,{gap:`gap-3`,padding:`px-3 py-10 sm:px-5 xl:px-6`,children:[n,a]}),t[18]=n,t[19]=a,t[20]=o):o=t[20],o}let u;t[21]!==r.autosaveStatus||t[22]!==r.error?(u=(0,B.jsx)(se,{status:r.autosaveStatus,error:r.error}),t[21]=r.autosaveStatus,t[22]=r.error,t[23]=u):u=t[23];let f;t[24]!==l||t[25]!==u?(f=(0,B.jsx)(P,{title:l,actions:u}),t[24]=l,t[25]=u,t[26]=f):f=t[26];let p;t[27]===r.error?p=t[28]:(p=r.error?(0,B.jsx)(`div`,{className:`rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/50 dark:text-red-400`,role:`alert`,children:r.error}):null,t[27]=r.error,t[28]=p);let h;t[29]===i?h=t[30]:(h=(0,B.jsx)(`div`,{className:`flex min-w-0 flex-col gap-5 pb-8`,children:i}),t[29]=i,t[30]=h);let g;return t[31]!==f||t[32]!==p||t[33]!==h||t[34]!==r.onBlurCapture?(g=(0,B.jsxs)(F,{gap:`gap-6`,onBlurCapture:r.onBlurCapture,children:[f,p,h]}),t[31]=f,t[32]=p,t[33]=h,t[34]=r.onBlurCapture,t[35]=g):g=t[35],g}function G(e){return e.language}var K={enabled:!0,driverKind:`extension`,headless:!1,executablePath:``,cdpEndpoint:`http://127.0.0.1:9222`,remoteProvider:`browserbase`,remoteApiKey:``,remoteProjectId:``,remoteRegion:``,maxNodes:180,maxCharacters:12e3,visualFallback:!0,actionTimeoutMs:3e4,sessionTimeoutMs:9e5,maxSequenceLength:5,allowedPrivateHosts:``,crossDomainNavigation:`allow`,uploads:`allow`,consequentialActions:`allow`};function q(e){let t=Y(Y(e).browser),n=Y(t.driver),r=Y(t.observation),i=Y(t.limits),a=Y(t.security),o=n.kind;return{...K,enabled:t.enabled!==!1,driverKind:o===`playwright`||o===`cdp`||o===`remote`?o:`extension`,headless:n.headless===!0,executablePath:X(n.executablePath,``),cdpEndpoint:X(n.endpoint,K.cdpEndpoint),remoteProvider:n.provider===`browser-use`?`browser-use`:`browserbase`,remoteApiKey:X(n.apiKey,``),remoteProjectId:X(n.projectId,``),remoteRegion:X(n.region,``),maxNodes:Z(r.maxNodes,K.maxNodes),maxCharacters:Z(r.maxCharacters,K.maxCharacters),visualFallback:r.visualFallback!==!1,actionTimeoutMs:Z(i.actionTimeoutMs,K.actionTimeoutMs),sessionTimeoutMs:Z(i.sessionTimeoutMs,K.sessionTimeoutMs),maxSequenceLength:Z(i.maxSequenceLength,K.maxSequenceLength),allowedPrivateHosts:Array.isArray(a.allowedPrivateHosts)?a.allowedPrivateHosts.filter(e=>typeof e==`string`).join(`
2
2
  `):``,crossDomainNavigation:he(a.crossDomainNavigation),uploads:he(a.uploads),consequentialActions:he(a.consequentialActions)}}function J(e){let t=e.driverKind===`extension`?{kind:`extension`}:e.driverKind===`playwright`?{kind:`playwright`,headless:e.headless,...e.executablePath.trim()?{executablePath:e.executablePath.trim()}:{}}:e.driverKind===`cdp`?{kind:`cdp`,endpoint:e.cdpEndpoint.trim()}:{kind:`remote`,provider:e.remoteProvider,...e.remoteApiKey.trim()?{apiKey:e.remoteApiKey.trim()}:{},...e.remoteProjectId.trim()?{projectId:e.remoteProjectId.trim()}:{},...e.remoteRegion.trim()?{region:e.remoteRegion.trim()}:{}};return{enabled:e.enabled,driver:t,observation:{maxNodes:e.maxNodes,maxCharacters:e.maxCharacters,visualFallback:e.visualFallback},limits:{actionTimeoutMs:e.actionTimeoutMs,sessionTimeoutMs:e.sessionTimeoutMs,maxSequenceLength:e.maxSequenceLength},security:{privateNetworks:`deny`,allowedPrivateHosts:e.allowedPrivateHosts.split(`
3
3
  `).map(e=>e.trim()).filter(Boolean),crossDomainNavigation:e.crossDomainNavigation,uploads:e.uploads,consequentialActions:e.consequentialActions}}}function pe(e){if(e.driverKind===`cdp`)try{let t=new URL(e.cdpEndpoint);if(t.protocol!==`http:`&&t.protocol!==`https:`&&t.protocol!==`ws:`&&t.protocol!==`wss:`)return`CDP endpoint must use http, https, ws, or wss.`}catch{return`Enter a valid CDP endpoint URL.`}return!Number.isInteger(e.maxNodes)||e.maxNodes<20||e.maxNodes>500?`Max nodes must be between 20 and 500.`:!Number.isInteger(e.maxCharacters)||e.maxCharacters<1e3||e.maxCharacters>5e4?`Max characters must be between 1,000 and 50,000.`:!Number.isInteger(e.actionTimeoutMs)||e.actionTimeoutMs<1e3||e.actionTimeoutMs>12e4?`Action timeout must be between 1,000 and 120,000 ms.`:!Number.isInteger(e.sessionTimeoutMs)||e.sessionTimeoutMs<6e4||e.sessionTimeoutMs>36e5?`Session timeout must be between 60,000 and 3,600,000 ms.`:!Number.isInteger(e.maxSequenceLength)||e.maxSequenceLength<1||e.maxSequenceLength>10?`Sequence length must be between 1 and 10.`:null}async function me(e){await f(h(`/api/config`),{method:`PATCH`,body:JSON.stringify({browser:J(e)})}),_()}function Y(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function X(e,t){return typeof e==`string`?e:t}function Z(e,t){return typeof e==`number`&&Number.isFinite(e)?e:t}function he(e){return e===`deny`?`deny`:`allow`}var ge=re();function _e(e){let t=!!p(e=>e.conversationId),[n,r]=(0,R.useReducer)(ge,{form:null,baseline:null}),i=n.form,a=n.baseline,o=(0,R.useRef)(!1),s=(0,R.useRef)(i);s.current=i;let c=(0,R.useRef)(null),{data:l,error:u,isLoading:d,mutate:f}=v(t);j({enabled:t,parsed:(0,R.useMemo)(()=>l?.payload?.config===void 0?null:q(l.payload.config),[l]),dirty:o.current,trackedParsedRef:c,dispatch:r,onResetDirty:()=>{o.current=!1}});let m=!!(t&&d&&l===void 0&&!u),h=u instanceof Error?u.message:u?String(u):null,g=(0,R.useMemo)(()=>!i||!a?!1:JSON.stringify(i)!==JSON.stringify(a),[i,a]),_=(0,R.useCallback)(e=>{o.current=!0,r({type:`patch`,patch:e})},[]),y=I({value:i,dirty:g,onSave:(0,R.useCallback)(async t=>{try{await me(t),r({type:`saved`,value:t}),o.current=!!(s.current&&JSON.stringify(s.current)!==JSON.stringify(t))}catch(t){throw Error(t instanceof Error?t.message:e.saveError)}},[e.saveError]),validate:pe});return{hasToken:t,loading:m,fetchError:h,form:i,update:_,autosaveStatus:y.status,error:y.error,onBlurCapture:y.onBlurCapture,mutate:f}}var ve=[`extension`,`playwright`,`cdp`,`remote`];function ye(){let e=(0,L.c)(29),t=m(be),n;e[0]===t?n=e[1]:(n=d(t),e[0]=t,e[1]=n);let r=_e(n.agentSettings),i=r.form,o=t===`zh`,[s]=a(),c=(0,R.useRef)(!1),u;e[2]!==i||e[3]!==s||e[4]!==r?(u=()=>{if(!i||c.current)return;c.current=!0;let e=s.get(`driver`);ve.includes(e)&&e!==i.driverKind&&r.update({driverKind:e})},e[2]=i,e[3]=s,e[4]=r,e[5]=u):u=e[5];let f;e[6]!==i||e[7]!==s||e[8]!==r.update?(f=[i,s,r.update],e[6]=i,e[7]=s,e[8]=r.update,e[9]=f):f=e[9],(0,R.useEffect)(u,f);let p=o?`Chrome 扩展(推荐)`:`Chrome extension (recommended)`,h;e[10]===p?h=e[11]:(h={value:`extension`,label:p},e[10]=p,e[11]=h);let g;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(g={value:`playwright`,label:`Playwright Chromium`},e[12]=g):g=e[12];let _=o?`CDP 已有浏览器`:`Existing browser over CDP`,v;e[13]===_?v=e[14]:(v={value:`cdp`,label:_},e[13]=_,e[14]=v);let y=o?`远程浏览器`:`Remote browser`,b;e[15]===y?b=e[16]:(b={value:`remote`,label:y},e[15]=y,e[16]=b);let x;e[17]!==h||e[18]!==v||e[19]!==b?(x=[h,g,v,b],e[17]=h,e[18]=v,e[19]=b,e[20]=x):x=e[20];let C=x,w;e[21]!==C||e[22]!==i||e[23]!==r||e[24]!==o?(w=i?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(ce,{enabled:i.enabled,driverKind:i.driverKind,autosaveStatus:r.autosaveStatus,zh:o}),(0,B.jsxs)(Se,{title:o?`运行方式`:`Connection`,icon:(0,B.jsx)(ie,{className:`size-4`}),children:[(0,B.jsx)(we,{label:o?`启用浏览器控制`:`Enable browser control`,checked:i.enabled,onChange:e=>r.update({enabled:e})}),(0,B.jsx)(Ce,{label:o?`浏览器连接`:`Browser connection`,children:(0,B.jsx)(M,{value:i.driverKind,options:C,placeholder:o?`选择连接方式`:`Choose a connection`,allowEmpty:!1,onChange:e=>r.update({driverKind:e})})}),(0,B.jsx)(xe,{kind:i.driverKind,zh:o}),i.driverKind===`playwright`?(0,B.jsxs)(`div`,{className:`space-y-4 rounded-lg bg-surface-inset p-4`,children:[(0,B.jsx)(we,{label:o?`无头模式`:`Headless mode`,description:o?`后台运行,不显示浏览器窗口。关闭后可观察智能体的操作过程。`:`Run in the background without a visible window. Turn off to watch the agent work.`,checked:i.headless,onChange:e=>r.update({headless:e})}),(0,B.jsx)(S,{title:o?`自定义 Chromium`:`Custom Chromium`,summary:i.executablePath||(o?`使用 xopc 安装的 Chromium`:`Use Chromium installed by xopc`),children:(0,B.jsx)(Q,{label:o?`Chromium 可执行文件(可选)`:`Chromium executable (optional)`,description:o?`留空时使用由 xopc 安装的 Chromium。`:`Leave empty to use Chromium installed by xopc.`,value:i.executablePath,onChange:e=>r.update({executablePath:e})})})]}):null,i.driverKind===`cdp`?(0,B.jsx)(`div`,{className:`rounded-lg bg-surface-inset p-4`,children:(0,B.jsx)(Q,{label:`CDP endpoint`,description:o?`例如 http://127.0.0.1:9222。Chrome 需要开启 remote debugging。`:`For example http://127.0.0.1:9222. Chrome must be started with remote debugging enabled.`,value:i.cdpEndpoint,onChange:e=>r.update({cdpEndpoint:e})})}):null,i.driverKind===`remote`?(0,B.jsxs)(`div`,{className:`space-y-4 rounded-lg bg-surface-inset p-4`,children:[(0,B.jsx)(Ce,{label:o?`服务商`:`Provider`,children:(0,B.jsx)(M,{value:i.remoteProvider,options:[{value:`browserbase`,label:`Browserbase`},{value:`browser-use`,label:`Browser Use`}],placeholder:o?`选择服务商`:`Choose a provider`,allowEmpty:!1,onChange:e=>r.update({remoteProvider:e})})}),(0,B.jsx)(Q,{label:`API key`,type:`password`,autoComplete:`off`,value:i.remoteApiKey,onChange:e=>r.update({remoteApiKey:e})}),(0,B.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,B.jsx)(Q,{label:`Project ID`,value:i.remoteProjectId,onChange:e=>r.update({remoteProjectId:e})}),(0,B.jsx)(Q,{label:`Region`,value:i.remoteRegion,onChange:e=>r.update({remoteRegion:e})})]})]}):null]}),(0,B.jsx)(S,{title:o?`页面理解与执行限制`:`Observation and execution limits`,summary:o?`当前截图、页面大小和超时策略继续生效。`:`Current screenshot, page size and timeout policies remain active.`,children:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(Se,{title:o?`页面理解`:`Page understanding`,icon:(0,B.jsx)(l,{className:`size-4`}),children:[(0,B.jsx)(we,{label:o?`需要时附加截图`:`Attach screenshots when needed`,checked:i.visualFallback,onChange:e=>r.update({visualFallback:e})}),(0,B.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,B.jsx)($,{label:o?`语义节点上限`:`Semantic node limit`,description:`20–500`,min:20,max:500,value:i.maxNodes,onChange:e=>r.update({maxNodes:e})}),(0,B.jsx)($,{label:o?`文本字符上限`:`Text character limit`,description:`1,000–50,000`,min:1e3,max:5e4,step:1e3,value:i.maxCharacters,onChange:e=>r.update({maxCharacters:e})})]})]}),(0,B.jsx)(Se,{title:o?`执行限制`:`Execution limits`,icon:(0,B.jsx)(ae,{className:`size-4`}),children:(0,B.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,B.jsx)($,{label:o?`操作超时(毫秒)`:`Action timeout (ms)`,min:1e3,max:12e4,step:1e3,value:i.actionTimeoutMs,onChange:e=>r.update({actionTimeoutMs:e})}),(0,B.jsx)($,{label:o?`会话超时(毫秒)`:`Session timeout (ms)`,min:6e4,max:36e5,step:6e4,value:i.sessionTimeoutMs,onChange:e=>r.update({sessionTimeoutMs:e})}),(0,B.jsx)($,{label:o?`批量步骤上限`:`Sequence step limit`,min:1,max:10,value:i.maxSequenceLength,onChange:e=>r.update({maxSequenceLength:e})})]})})]})}),(0,B.jsxs)(Se,{title:o?`访问策略`:`Access policies`,icon:(0,B.jsx)(te,{className:`size-4`}),children:[(0,B.jsx)(S,{title:o?`私网访问例外`:`Private network exceptions`,summary:i.allowedPrivateHosts||(o?`未设置私网例外`:`No private network exceptions`),children:(0,B.jsx)(Q,{label:o?`允许访问的私网主机`:`Allowed private hosts`,description:o?`每行一个主机名或 IP,不支持通配符。`:`One hostname or IP per line. Wildcards are not supported.`,multiline:!0,value:i.allowedPrivateHosts,onChange:e=>r.update({allowedPrivateHosts:e})})}),(0,B.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,B.jsx)(Te,{zh:o,label:o?`跨域导航`:`Cross-domain navigation`,value:i.crossDomainNavigation,onChange:e=>r.update({crossDomainNavigation:e})}),(0,B.jsx)(Te,{zh:o,label:o?`高影响动作`:`Consequential actions`,value:i.consequentialActions,onChange:e=>r.update({consequentialActions:e})}),(0,B.jsx)(Te,{zh:o,label:o?`文件上传`:`File uploads`,value:i.uploads,onChange:e=>r.update({uploads:e})})]})]})]}):null,e[21]=C,e[22]=i,e[23]=r,e[24]=o,e[25]=w):w=e[25];let T;return e[26]!==w||e[27]!==r?(T=(0,B.jsx)(fe,{sectionId:`agent-browser`,vm:r,children:w}),e[26]=w,e[27]=r,e[28]=T):T=e[28],T}function be(e){return e.language}function xe(e){let t=(0,L.c)(7),{kind:n,zh:r}=e,i=r?`直接操作你正在使用的 Chrome,保留登录状态和现有标签页;最适合日常协作。`:`Operate your current Chrome with its signed-in state and existing tabs; best for daily collaboration.`,a=r?`由 xopc 启动独立 Chromium,环境隔离、自动化稳定,适合无人值守任务。`:`Let xopc launch an isolated Chromium; stable for unattended automation.`,o=r?`连接已开启远程调试的 Chrome 或 Chromium,适合自定义浏览器启动方式。`:`Connect to Chrome or Chromium already running with remote debugging.`,s=r?`使用 Browserbase 或 Browser Use 的云端浏览器,适合服务器环境和长任务。`:`Use a Browserbase or Browser Use cloud browser for servers and long-running tasks.`,c;t[0]!==i||t[1]!==a||t[2]!==o||t[3]!==s?(c={extension:i,playwright:a,cdp:o,remote:s},t[0]=i,t[1]=a,t[2]=o,t[3]=s,t[4]=c):c=t[4];let l=c[n],u;return t[5]===l?u=t[6]:(u=(0,B.jsx)(`p`,{className:`rounded-lg bg-surface-inset px-3 py-2 text-xs leading-5 text-fg-muted`,children:l}),t[5]=l,t[6]=u),u}function Se(e){let t=(0,L.c)(17),{title:n,description:r,icon:i,children:a}=e,o;t[0]===i?o=t[1]:(o=(0,B.jsx)(`span`,{className:`mt-0.5 text-fg-subtle`,children:i}),t[0]=i,t[1]=o);let s;t[2]===n?s=t[3]:(s=(0,B.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n}),t[2]=n,t[3]=s);let c;t[4]===r?c=t[5]:(c=r?(0,B.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r}):null,t[4]=r,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,B.jsxs)(`div`,{children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==o||t[10]!==l?(u=(0,B.jsxs)(`div`,{className:`mb-4 flex items-start gap-2`,children:[o,l]}),t[9]=o,t[10]=l,t[11]=u):u=t[11];let d;t[12]===a?d=t[13]:(d=(0,B.jsx)(`div`,{className:`space-y-4`,children:a}),t[12]=a,t[13]=d);let f;return t[14]!==u||t[15]!==d?(f=(0,B.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[u,d]}),t[14]=u,t[15]=d,t[16]=f):f=t[16],f}function Ce(e){let t=(0,L.c)(8),{label:n,description:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,B.jsx)(`span`,{className:`mb-1.5 block font-medium`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,B.jsx)(`span`,{className:`mt-1.5 block text-xs leading-5 text-fg-subtle`,children:r}):null,t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,B.jsxs)(`label`,{className:`block text-sm text-fg`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Q(e){let t=(0,L.c)(10),{label:n,description:r,value:i,onChange:a,type:o,multiline:s,autoComplete:c}=e,l=o===void 0?`text`:o,u=s===void 0?!1:s,d;t[0]!==c||t[1]!==u||t[2]!==a||t[3]!==l||t[4]!==i?(d=u?(0,B.jsx)(`textarea`,{rows:3,value:i,onChange:e=>a(e.target.value),className:`w-full rounded-lg border border-edge bg-surface-inset px-3 py-2 text-sm text-fg outline-none focus:border-accent`}):(0,B.jsx)(`input`,{type:l,autoComplete:c,value:i,onChange:e=>a(e.target.value),className:`w-full rounded-lg border border-edge bg-surface-inset px-3 py-2 text-sm text-fg outline-none focus:border-accent`}),t[0]=c,t[1]=u,t[2]=a,t[3]=l,t[4]=i,t[5]=d):d=t[5];let f;return t[6]!==r||t[7]!==n||t[8]!==d?(f=(0,B.jsx)(Ce,{label:n,description:r,children:d}),t[6]=r,t[7]=n,t[8]=d,t[9]=f):f=t[9],f}function $(e){let t=(0,L.c)(12),{label:n,description:r,value:i,onChange:a,min:o,max:s,step:c}=e,l=c===void 0?1:c,u;t[0]===a?u=t[1]:(u=e=>{let t=Number(e.target.value);Number.isFinite(t)&&a(t)},t[0]=a,t[1]=u);let d;t[2]!==s||t[3]!==o||t[4]!==l||t[5]!==u||t[6]!==i?(d=(0,B.jsx)(oe,{type:`number`,min:o,max:s,step:l,value:i,onChange:u,className:`h-10 w-full rounded-lg border border-edge bg-surface-inset px-3 text-sm text-fg outline-none focus:border-accent`}),t[2]=s,t[3]=o,t[4]=l,t[5]=u,t[6]=i,t[7]=d):d=t[7];let f;return t[8]!==r||t[9]!==n||t[10]!==d?(f=(0,B.jsx)(Ce,{label:n,description:r,children:d}),t[8]=r,t[9]=n,t[10]=d,t[11]=f):f=t[11],f}function we(e){let t=(0,L.c)(15),{label:n,description:r,checked:i,onChange:a}=e,o;t[0]===a?o=t[1]:(o=e=>a(e.target.checked),t[0]=a,t[1]=o);let s;t[2]!==i||t[3]!==o?(s=(0,B.jsx)(`input`,{type:`checkbox`,checked:i,onChange:o,className:`mt-0.5 size-4 accent-accent`}),t[2]=i,t[3]=o,t[4]=s):s=t[4];let c;t[5]===n?c=t[6]:(c=(0,B.jsx)(`span`,{className:`block font-medium`,children:n}),t[5]=n,t[6]=c);let l;t[7]===r?l=t[8]:(l=r?(0,B.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-subtle`,children:r}):null,t[7]=r,t[8]=l);let u;t[9]!==c||t[10]!==l?(u=(0,B.jsxs)(`span`,{children:[c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11];let d;return t[12]!==s||t[13]!==u?(d=(0,B.jsxs)(`label`,{className:`flex items-start gap-3 text-sm text-fg`,children:[s,u]}),t[12]=s,t[13]=u,t[14]=d):d=t[14],d}function Te(e){let t=(0,L.c)(17),{zh:n,label:r,value:i,onChange:a}=e,o=n?`允许`:`Allow`,s;t[0]===o?s=t[1]:(s={value:`allow`,label:o},t[0]=o,t[1]=s);let c=n?`拒绝`:`Deny`,l;t[2]===c?l=t[3]:(l={value:`deny`,label:c},t[2]=c,t[3]=l);let u;t[4]!==s||t[5]!==l?(u=[s,l],t[4]=s,t[5]=l,t[6]=u):u=t[6];let d=u,f=n?`选择策略`:`Choose a policy`,p;t[7]===a?p=t[8]:(p=e=>a(e),t[7]=a,t[8]=p);let m;t[9]!==d||t[10]!==f||t[11]!==p||t[12]!==i?(m=(0,B.jsx)(M,{value:i,options:d,placeholder:f,allowEmpty:!1,onChange:p}),t[9]=d,t[10]=f,t[11]=p,t[12]=i,t[13]=m):m=t[13];let h;return t[14]!==r||t[15]!==m?(h=(0,B.jsx)(Ce,{label:r,children:m}),t[14]=r,t[15]=m,t[16]=h):h=t[16],h}export{ye as AgentBrowserSettingsPage};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/skills-page-DANnetBA.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-Cmrvxc_s.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/middleware-Pd0e8Igk.js","assets/locale-store-Jnhw2WMv.js","assets/messages-DBvKzlCl.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-B58RypQ4.js","assets/dist-BGTk37IG.js","assets/chunk-KS7C4IRE-B2HK1psj.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/mermaid-render-604gISVe.js","assets/xml-_d7dTN2Q.js","assets/app-link-BV_eGr7l.js","assets/product-delivery-DwmnNJvk.js","assets/schemas-CObaziC7.js","assets/local-apps-yys1VChX.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-Ct4sKkUf.css","assets/vendor-swr-BIWyz7Rc.js","assets/check-DUBLcKHA.js","assets/circle-check-C23XjkUj.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/eye-CABVeTq0.js","assets/folder-open-CyzJ19I9.js","assets/session-manager-D_N7qha7.js","assets/gateway-realtime-dE0XrVAT.js","assets/gateway-realtime-store-CPlVuu0d.js","assets/local-session-drafts-fhip41-L.js","assets/session-api-CAKgrbgz.js","assets/gateway-startup-retry-CqyGHM2M.js","assets/constants-DeXt1mV-.js","assets/tool-activity-BtJkgjFf.js","assets/registry-api-BbUEMGcj.js","assets/attachment-utils-core-BIOUBrpT.js","assets/agents-admin-api-DvSe10zu.js","assets/gateway-config-swr-DAir1JsW.js","assets/capabilities-glv1DeRI.js","assets/tasks-PuIUgF9L.js","assets/specialists-4bkS5rZ4.js","assets/files-Bw4SBGdM.js","assets/sliding-indicator-hwz0sx3h.js","assets/index-QegseiyI.css","assets/capability-header-actions-WRaPQFq0.js","assets/capability-icon-DVoZxEgW.js","assets/capability-links-DzQWK1Fh.js","assets/skill-api-DS7l6xfp.js","assets/skill-reload-api-B5xkDw4T.js","assets/connectors-page-BBH388aG.js","assets/number-input-DDeqHK-G.js","assets/connector-service-page-FJwMon8U.js","assets/plugin-details-dialog-BWEc8nwk.js","assets/plugin-presentation-BcZHPy_6.js","assets/browser-BLJWD7WI.js","assets/apps-page-B4temKvg.js","assets/agents-CaB8tdC-.js","assets/directory-picker-path-field-ummF1SFe.js","assets/image-generation-api-D0EUiJdS.js","assets/settings-page-layout-Dx5S-Msc.js","assets/channels-Cx2WkRWN.js","assets/schema-form-B3bVaQx1.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{f as a,g as o,m as s,r as c,t as l}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as ee}from"./messages-DBvKzlCl.js";import{n as te}from"./locale-store-Jnhw2WMv.js";import{Go as u,Rc as d,_l as f,vl as p}from"./index-Cmrvxc_s.js";import{t as m}from"./capability-links-DzQWK1Fh.js";import{t as ne}from"./capability-header-actions-WRaPQFq0.js";var h=n(),g=r();function re(e){let t=(0,h.c)(11),{section:n,zh:r}=e,i;t[0]!==n||t[1]!==r?(i=n===`skills`?{text:r?`查看 Agent 可使用的技能。插件附带的技能由所属插件统一更新和卸载。`:`Browse skills available to agents. Skills included in a plugin are updated and removed with that plugin.`,href:`/capabilities/extensions?tab=user`,label:r?`管理插件`:`Manage plugins`}:n===`connectors`?{text:r?`管理账号连接与授权。插件提供的账号统一在插件详情中连接。`:`Manage accounts and authorization. Connect plugin accounts from their plugin details.`,href:`/capabilities/extensions?tab=marketplace`,label:r?`发现更多插件`:`Discover plugins`}:n===`extensions`?{text:r?`安装和管理整套能力,包括技能、工具与账号连接。默认供所有 Agent 使用。`:`Install and manage skills, tools and account connections together. Available to all agents by default.`,href:`/capabilities/connectors?tab=connected`,label:r?`查看账号连接`:`View connections`}:null,t[0]=n,t[1]=r,t[2]=i):i=t[2];let a=i;if(!a)return null;let o;t[3]===a.text?o=t[4]:(o=(0,g.jsx)(`p`,{className:`text-fg-muted`,children:a.text}),t[3]=a.text,t[4]=o);let s;t[5]!==a.href||t[6]!==a.label?(s=(0,g.jsx)(l,{className:`rounded text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,to:a.href,children:a.label}),t[5]=a.href,t[6]=a.label,t[7]=s):s=t[7];let c;return t[8]!==o||t[9]!==s?(c=(0,g.jsxs)(`div`,{className:`mx-auto flex w-full max-w-7xl flex-wrap items-center gap-x-3 gap-y-1 px-4 pb-1 pt-3 text-xs leading-5 sm:px-6 lg:px-8`,children:[o,s]}),t[8]=o,t[9]=s,t[10]=c):c=t[10],c}var _=e(t(),1),ie=(0,_.lazy)(()=>i(()=>import(`./skills-page-DANnetBA.js`).then(e=>({default:e.SkillsPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59]))),ae=(0,_.lazy)(()=>i(()=>import(`./connectors-page-BBH388aG.js`).then(e=>({default:e.ConnectorsPage})),__vite__mapDeps([60,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,61,55,56,57,62]))),oe=(0,_.lazy)(()=>i(()=>import(`./plugin-details-dialog-BWEc8nwk.js`).then(e=>({default:e.PluginDetailsDialog})),__vite__mapDeps([63,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,56,57,64,65]))),se=(0,_.lazy)(()=>i(()=>import(`./apps-page-B4temKvg.js`).then(e=>({default:e.ExtensionsPage})),__vite__mapDeps([66,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,64,65]))),ce=(0,_.lazy)(()=>i(()=>import(`./agents-CaB8tdC-.js`).then(e=>({default:e.AgentsSettingsPanel})),__vite__mapDeps([67,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,61,68,69,70]))),v=(0,_.lazy)(()=>i(()=>import(`./channels-Cx2WkRWN.js`).then(e=>({default:e.ChannelsSettingsPanel})),__vite__mapDeps([71,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,65,72,61,70])));function y(e){return f.includes(e)?e:null}function b(e){let t=(0,h.c)(3),{label:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=Array.from({length:6},x),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,g.jsx)(`div`,{className:`mx-auto grid w-full max-w-7xl gap-4 px-4 pb-7 pt-3 sm:grid-cols-2 sm:px-6 lg:grid-cols-3 lg:px-8 lg:pb-9 lg:pt-4`,"aria-label":n,"aria-busy":!0,children:r}),t[1]=n,t[2]=i),i}function x(e,t){return(0,g.jsx)(d,{className:`h-40 rounded-xl`},t)}function S(){let e=(0,h.c)(70),t=te(T),n;e[0]===t?n=e[1]:(n=ee(t),e[0]=t,e[1]=n);let r=n,i=r.capabilitiesHub,{section:l,detailId:d}=s(),[x]=o(),S=a(),E;e[2]===x?E=e[3]:(E=x.get(`plugin`),e[2]=x,e[3]=E);let D=E,O;e[4]!==S||e[5]!==x?(O=()=>{let e=new URLSearchParams(x);e.delete(`plugin`),e.delete(`connect`),S({search:e.toString()},{replace:!0,preventScrollReset:!0})},e[4]=S,e[5]=x,e[6]=O):O=e[6];let k=O,A;e[7]===l?A=e[8]:(A=y(l),e[7]=l,e[8]=A);let j=A,M=j??f[0],N=r.productNavigation.sections[`capabilities-${M}`],P=u(w),F=u(C),I;e[9]===M?I=e[10]:(I={section:M,value:null},e[9]=M,e[10]=I);let[L,R]=(0,_.useState)(I),z=M===`extensions`&&d?null:L.section===M?L.value:null,B;e[11]===M?B=e[12]:(B=e=>{R({section:M,value:e})},e[11]=M,e[12]=B);let V=B,H,U;if(e[13]!==F||e[14]!==z||e[15]!==N||e[16]!==P?(H=()=>(P({startExtra:null,main:(0,g.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:N}),end:(0,g.jsx)(ne,{contribution:z})}),()=>F()),U=[F,z,N,P],e[13]=F,e[14]=z,e[15]=N,e[16]=P,e[17]=H,e[18]=U):(H=e[17],U=e[18]),(0,_.useLayoutEffect)(H,U),M===`extensions`&&d){let t;e[19]===x?t=e[20]:(t=x.get(`from`)===`connections`?`connections`:x.get(`from`)===`skills`?`skills`:`installed`,e[19]=x,e[20]=t);let n;e[21]===x?n=e[22]:(n=x.get(`connect`),e[21]=x,e[22]=n);let r=n===`1`,i;e[23]!==d||e[24]!==x||e[25]!==r||e[26]!==t?(i=m(d,t,r,x.get(`returnTo`)??void 0),e[23]=d,e[24]=x,e[25]=r,e[26]=t,e[27]=i):i=e[27];let a;return e[28]===i?a=e[29]:(a=(0,g.jsx)(c,{replace:!0,to:i}),e[28]=i,e[29]=a),a}if(!j){let t;return e[30]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,g.jsx)(c,{to:p(f[0]),replace:!0}),e[30]=t):t=e[30],t}let W;e[31]!==d||e[32]!==t||e[33]!==M?(W=d?null:(0,g.jsx)(re,{section:M,zh:t.startsWith(`zh`)}),e[31]=d,e[32]=t,e[33]=M,e[34]=W):W=e[34];let G;e[35]===i.discoverLoading?G=e[36]:(G=(0,g.jsx)(b,{label:i.discoverLoading}),e[35]=i.discoverLoading,e[36]=G);let K;e[37]!==d||e[38]!==V||e[39]!==M?(K=M===`agents`?(0,g.jsx)(ce,{agentId:d,onHeaderActionChange:V}):null,e[37]=d,e[38]=V,e[39]=M,e[40]=K):K=e[40];let q;e[41]!==V||e[42]!==M?(q=M===`skills`?(0,g.jsx)(ie,{embedded:!0,onHeaderActionChange:V}):null,e[41]=V,e[42]=M,e[43]=q):q=e[43];let J;e[44]!==V||e[45]!==M?(J=M===`connectors`?(0,g.jsx)(ae,{embedded:!0,onHeaderActionChange:V}):null,e[44]=V,e[45]=M,e[46]=J):J=e[46];let Y;e[47]!==d||e[48]!==V||e[49]!==M?(Y=M===`channels`?(0,g.jsx)(v,{channelId:d,onHeaderActionChange:V}):null,e[47]=d,e[48]=V,e[49]=M,e[50]=Y):Y=e[50];let X;e[51]!==V||e[52]!==M?(X=M===`extensions`?(0,g.jsx)(se,{embedded:!0,onHeaderActionChange:V}):null,e[51]=V,e[52]=M,e[53]=X):X=e[53];let Z;e[54]!==M||e[55]!==K||e[56]!==q||e[57]!==J||e[58]!==Y||e[59]!==X||e[60]!==G?(Z=(0,g.jsxs)(_.Suspense,{fallback:G,children:[K,q,J,Y,X]},M),e[54]=M,e[55]=K,e[56]=q,e[57]=J,e[58]=Y,e[59]=X,e[60]=G,e[61]=Z):Z=e[61];let Q;e[62]!==k||e[63]!==D||e[64]!==x?(Q=D?(0,g.jsx)(_.Suspense,{fallback:null,children:(0,g.jsx)(oe,{pluginId:D,initialConnect:x.get(`connect`)===`1`,onClose:k},D)}):null,e[62]=k,e[63]=D,e[64]=x,e[65]=Q):Q=e[65];let $;return e[66]!==Z||e[67]!==Q||e[68]!==W?($=(0,g.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[W,Z,Q]}),e[66]=Z,e[67]=Q,e[68]=W,e[69]=$):$=e[69],$}function C(e){return e.clearPageHeader}function w(e){return e.setPageHeader}function T(e){return e.language}export{S as CapabilitiesPage};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/skills-page-dHlURgRl.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-CzkAd5Su.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/middleware-Pd0e8Igk.js","assets/locale-store-Jnhw2WMv.js","assets/messages-DBvKzlCl.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-B58RypQ4.js","assets/dist-BGTk37IG.js","assets/chunk-KS7C4IRE-B2HK1psj.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/mermaid-render-604gISVe.js","assets/xml-_d7dTN2Q.js","assets/app-link-BV_eGr7l.js","assets/product-delivery-DwmnNJvk.js","assets/schemas-CObaziC7.js","assets/local-apps-yys1VChX.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-Ct4sKkUf.css","assets/vendor-swr-BIWyz7Rc.js","assets/check-DUBLcKHA.js","assets/circle-check-C23XjkUj.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/eye-CABVeTq0.js","assets/folder-open-CyzJ19I9.js","assets/session-manager-D_N7qha7.js","assets/gateway-realtime-dE0XrVAT.js","assets/gateway-realtime-store-CPlVuu0d.js","assets/local-session-drafts-fhip41-L.js","assets/session-api-CAKgrbgz.js","assets/gateway-startup-retry-CqyGHM2M.js","assets/constants-DeXt1mV-.js","assets/tool-activity-BtJkgjFf.js","assets/registry-api-BbUEMGcj.js","assets/attachment-utils-core-BIOUBrpT.js","assets/agents-admin-api-DvSe10zu.js","assets/gateway-config-swr-DAir1JsW.js","assets/capabilities-glv1DeRI.js","assets/tasks-PuIUgF9L.js","assets/specialists-4bkS5rZ4.js","assets/files-Bw4SBGdM.js","assets/sliding-indicator-hwz0sx3h.js","assets/index-QegseiyI.css","assets/capability-header-actions-DCxxOLIt.js","assets/capability-icon-DVoZxEgW.js","assets/capability-links-DzQWK1Fh.js","assets/skill-api-W7NoRL_J.js","assets/skill-reload-api-DNp30a6A.js","assets/connectors-page-CW2vHnSK.js","assets/number-input-DDeqHK-G.js","assets/connector-service-page-CDR35YqB.js","assets/plugin-details-dialog-BAPTOn3F.js","assets/plugin-presentation-D-o-0IeU.js","assets/browser-BLJWD7WI.js","assets/apps-page-B_4AiHMy.js","assets/agents-HpKwxi9M.js","assets/directory-picker-path-field-CFBLUC-2.js","assets/image-generation-api-DPcsBPX7.js","assets/settings-page-layout-Dx5S-Msc.js","assets/channels-DEB1AYkM.js","assets/schema-form-BXk8w1q-.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{f as a,g as o,m as s,r as c,t as l}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as ee}from"./messages-DBvKzlCl.js";import{n as te}from"./locale-store-Jnhw2WMv.js";import{Go as u,Rc as d,_l as f,vl as p}from"./index-CzkAd5Su.js";import{t as m}from"./capability-links-DzQWK1Fh.js";import{t as ne}from"./capability-header-actions-DCxxOLIt.js";var h=n(),g=r();function re(e){let t=(0,h.c)(11),{section:n,zh:r}=e,i;t[0]!==n||t[1]!==r?(i=n===`skills`?{text:r?`查看 Agent 可使用的技能。插件附带的技能由所属插件统一更新和卸载。`:`Browse skills available to agents. Skills included in a plugin are updated and removed with that plugin.`,href:`/capabilities/extensions?tab=user`,label:r?`管理插件`:`Manage plugins`}:n===`connectors`?{text:r?`管理账号连接与授权。插件提供的账号统一在插件详情中连接。`:`Manage accounts and authorization. Connect plugin accounts from their plugin details.`,href:`/capabilities/extensions?tab=marketplace`,label:r?`发现更多插件`:`Discover plugins`}:n===`extensions`?{text:r?`安装和管理整套能力,包括技能、工具与账号连接。默认供所有 Agent 使用。`:`Install and manage skills, tools and account connections together. Available to all agents by default.`,href:`/capabilities/connectors?tab=connected`,label:r?`查看账号连接`:`View connections`}:null,t[0]=n,t[1]=r,t[2]=i):i=t[2];let a=i;if(!a)return null;let o;t[3]===a.text?o=t[4]:(o=(0,g.jsx)(`p`,{className:`text-fg-muted`,children:a.text}),t[3]=a.text,t[4]=o);let s;t[5]!==a.href||t[6]!==a.label?(s=(0,g.jsx)(l,{className:`rounded text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,to:a.href,children:a.label}),t[5]=a.href,t[6]=a.label,t[7]=s):s=t[7];let c;return t[8]!==o||t[9]!==s?(c=(0,g.jsxs)(`div`,{className:`mx-auto flex w-full max-w-7xl flex-wrap items-center gap-x-3 gap-y-1 px-4 pb-1 pt-3 text-xs leading-5 sm:px-6 lg:px-8`,children:[o,s]}),t[8]=o,t[9]=s,t[10]=c):c=t[10],c}var _=e(t(),1),ie=(0,_.lazy)(()=>i(()=>import(`./skills-page-dHlURgRl.js`).then(e=>({default:e.SkillsPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59]))),ae=(0,_.lazy)(()=>i(()=>import(`./connectors-page-CW2vHnSK.js`).then(e=>({default:e.ConnectorsPage})),__vite__mapDeps([60,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,61,55,56,57,62]))),oe=(0,_.lazy)(()=>i(()=>import(`./plugin-details-dialog-BAPTOn3F.js`).then(e=>({default:e.PluginDetailsDialog})),__vite__mapDeps([63,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,56,57,64,65]))),se=(0,_.lazy)(()=>i(()=>import(`./apps-page-B_4AiHMy.js`).then(e=>({default:e.ExtensionsPage})),__vite__mapDeps([66,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,64,65]))),ce=(0,_.lazy)(()=>i(()=>import(`./agents-HpKwxi9M.js`).then(e=>({default:e.AgentsSettingsPanel})),__vite__mapDeps([67,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,61,68,69,70]))),v=(0,_.lazy)(()=>i(()=>import(`./channels-DEB1AYkM.js`).then(e=>({default:e.ChannelsSettingsPanel})),__vite__mapDeps([71,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,65,72,61,70])));function y(e){return f.includes(e)?e:null}function b(e){let t=(0,h.c)(3),{label:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=Array.from({length:6},x),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,g.jsx)(`div`,{className:`mx-auto grid w-full max-w-7xl gap-4 px-4 pb-7 pt-3 sm:grid-cols-2 sm:px-6 lg:grid-cols-3 lg:px-8 lg:pb-9 lg:pt-4`,"aria-label":n,"aria-busy":!0,children:r}),t[1]=n,t[2]=i),i}function x(e,t){return(0,g.jsx)(d,{className:`h-40 rounded-xl`},t)}function S(){let e=(0,h.c)(70),t=te(T),n;e[0]===t?n=e[1]:(n=ee(t),e[0]=t,e[1]=n);let r=n,i=r.capabilitiesHub,{section:l,detailId:d}=s(),[x]=o(),S=a(),E;e[2]===x?E=e[3]:(E=x.get(`plugin`),e[2]=x,e[3]=E);let D=E,O;e[4]!==S||e[5]!==x?(O=()=>{let e=new URLSearchParams(x);e.delete(`plugin`),e.delete(`connect`),S({search:e.toString()},{replace:!0,preventScrollReset:!0})},e[4]=S,e[5]=x,e[6]=O):O=e[6];let k=O,A;e[7]===l?A=e[8]:(A=y(l),e[7]=l,e[8]=A);let j=A,M=j??f[0],N=r.productNavigation.sections[`capabilities-${M}`],P=u(w),F=u(C),I;e[9]===M?I=e[10]:(I={section:M,value:null},e[9]=M,e[10]=I);let[L,R]=(0,_.useState)(I),z=M===`extensions`&&d?null:L.section===M?L.value:null,B;e[11]===M?B=e[12]:(B=e=>{R({section:M,value:e})},e[11]=M,e[12]=B);let V=B,H,U;if(e[13]!==F||e[14]!==z||e[15]!==N||e[16]!==P?(H=()=>(P({startExtra:null,main:(0,g.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:N}),end:(0,g.jsx)(ne,{contribution:z})}),()=>F()),U=[F,z,N,P],e[13]=F,e[14]=z,e[15]=N,e[16]=P,e[17]=H,e[18]=U):(H=e[17],U=e[18]),(0,_.useLayoutEffect)(H,U),M===`extensions`&&d){let t;e[19]===x?t=e[20]:(t=x.get(`from`)===`connections`?`connections`:x.get(`from`)===`skills`?`skills`:`installed`,e[19]=x,e[20]=t);let n;e[21]===x?n=e[22]:(n=x.get(`connect`),e[21]=x,e[22]=n);let r=n===`1`,i;e[23]!==d||e[24]!==x||e[25]!==r||e[26]!==t?(i=m(d,t,r,x.get(`returnTo`)??void 0),e[23]=d,e[24]=x,e[25]=r,e[26]=t,e[27]=i):i=e[27];let a;return e[28]===i?a=e[29]:(a=(0,g.jsx)(c,{replace:!0,to:i}),e[28]=i,e[29]=a),a}if(!j){let t;return e[30]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,g.jsx)(c,{to:p(f[0]),replace:!0}),e[30]=t):t=e[30],t}let W;e[31]!==d||e[32]!==t||e[33]!==M?(W=d?null:(0,g.jsx)(re,{section:M,zh:t.startsWith(`zh`)}),e[31]=d,e[32]=t,e[33]=M,e[34]=W):W=e[34];let G;e[35]===i.discoverLoading?G=e[36]:(G=(0,g.jsx)(b,{label:i.discoverLoading}),e[35]=i.discoverLoading,e[36]=G);let K;e[37]!==d||e[38]!==V||e[39]!==M?(K=M===`agents`?(0,g.jsx)(ce,{agentId:d,onHeaderActionChange:V}):null,e[37]=d,e[38]=V,e[39]=M,e[40]=K):K=e[40];let q;e[41]!==V||e[42]!==M?(q=M===`skills`?(0,g.jsx)(ie,{embedded:!0,onHeaderActionChange:V}):null,e[41]=V,e[42]=M,e[43]=q):q=e[43];let J;e[44]!==V||e[45]!==M?(J=M===`connectors`?(0,g.jsx)(ae,{embedded:!0,onHeaderActionChange:V}):null,e[44]=V,e[45]=M,e[46]=J):J=e[46];let Y;e[47]!==d||e[48]!==V||e[49]!==M?(Y=M===`channels`?(0,g.jsx)(v,{channelId:d,onHeaderActionChange:V}):null,e[47]=d,e[48]=V,e[49]=M,e[50]=Y):Y=e[50];let X;e[51]!==V||e[52]!==M?(X=M===`extensions`?(0,g.jsx)(se,{embedded:!0,onHeaderActionChange:V}):null,e[51]=V,e[52]=M,e[53]=X):X=e[53];let Z;e[54]!==M||e[55]!==K||e[56]!==q||e[57]!==J||e[58]!==Y||e[59]!==X||e[60]!==G?(Z=(0,g.jsxs)(_.Suspense,{fallback:G,children:[K,q,J,Y,X]},M),e[54]=M,e[55]=K,e[56]=q,e[57]=J,e[58]=Y,e[59]=X,e[60]=G,e[61]=Z):Z=e[61];let Q;e[62]!==k||e[63]!==D||e[64]!==x?(Q=D?(0,g.jsx)(_.Suspense,{fallback:null,children:(0,g.jsx)(oe,{pluginId:D,initialConnect:x.get(`connect`)===`1`,onClose:k},D)}):null,e[62]=k,e[63]=D,e[64]=x,e[65]=Q):Q=e[65];let $;return e[66]!==Z||e[67]!==Q||e[68]!==W?($=(0,g.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[W,Z,Q]}),e[66]=Z,e[67]=Q,e[68]=W,e[69]=$):$=e[69],$}function C(e){return e.clearPageHeader}function w(e){return e.setPageHeader}function T(e){return e.language}export{S as CapabilitiesPage};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-swr-BIWyz7Rc.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{d as a,g as o,m as s,r as c,t as l}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as u}from"./circle-check-C23XjkUj.js";import{t as d}from"./external-link-DjqjBmc3.js";import{t as f}from"./eye-CABVeTq0.js";import{t as p}from"./plus-Q2yW6OE7.js";import{t as m}from"./x-B_N4OPjy.js";import{t as h}from"./messages-DBvKzlCl.js";import{t as g}from"./cn-0WouolD0.js";import{a as _,c as v,i as y,n as b,r as x}from"./locale-store-Jnhw2WMv.js";import{a as S,i as C,n as w,o as T,r as E,s as D,t as O}from"./dist-BGTk37IG.js";import{i as k}from"./vendor-swr-BIWyz7Rc.js";import{n as A,r as j}from"./gateway-config-swr-DAir1JsW.js";import{n as M,t as N}from"./registry-api-BbUEMGcj.js";import{$i as P,$s as F,Al as I,Ao as L,As as R,At as ee,Bt as z,Cn as B,Ct as V,Dn as H,Dt as te,Ef as U,En as W,Et as ne,F as G,Fc as K,Fn as re,Ft as ie,G as ae,Gs as q,Gt as oe,Gu as J,Hl as se,Ht as ce,I as le,Ic as ue,In as Y,Is as de,Iu as fe,Jl as pe,Js as me,Jt as he,Ks as ge,Kt as _e,L as ve,Ls as ye,Lt as be,Mt as xe,Ns as Se,Nt as Ce,Ot as we,Ps as Te,Pt as Ee,Rc as De,Rs as Oe,Rt as ke,Sl as Ae,Sn as je,St as Me,Tf as Ne,Tn as Pe,Tt as Fe,Ut as Ie,Uu as Le,Vs as Re,Vt as ze,Wc as X,Ws as Be,Xs as Ve,Xt as He,Ys as Ue,Yt as We,Za as Ge,Zl as Ke,_t as qe,af as Je,as as Ye,bl as Xe,bn as Ze,bt as Qe,cd as $e,cf as et,cu as tt,ds as nt,ea as rt,ec as it,eo as at,eu as ot,fd as st,fs as Z,gl as ct,gu as lt,hu as ut,jl as dt,js as ft,jt as pt,kt as mt,qd as ht,qn as gt,qs as _t,qt as vt,ss as yt,to as bt,us as xt,vs as St,vt as Ct,wn as wt,wt as Tt,xn as Et,xt as Dt,xu as Ot,ys as kt,yt as At,zt as jt}from"./index-Cmrvxc_s.js";import{t as Mt}from"./number-input-DDeqHK-G.js";import{n as Nt,r as Pt}from"./settings-page-layout-Dx5S-Msc.js";import{n as Ft,t as It}from"./settings-form-section-vezTIqZ6.js";import{n as Lt,t as Rt}from"./use-autosave-BZw6SkOF.js";import{c as zt,f as Bt,i as Vt,l as Ht,n as Ut,o as Wt,r as Gt,s as Kt,t as qt,u as Jt}from"./voice-config-api-T3nM4buh.js";import{t as Yt}from"./voice-api-key-field-D1R1yQNb.js";import{a as Xt,i as Zt,n as Qt,o as $t,r as en,s as tn,t as nn}from"./image-generation-api-D0EUiJdS.js";import{t as rn}from"./xopc-cloud-account-card-BjPp3a2X.js";var an=n(),Q=e(t(),1),$=r(),on={en:{addTitle:`Add image service`,editTitle:`Manage image service`,intro:`Connect an endpoint that implements the OpenAI Images protocol.`,connection:`Connection`,providerId:`Provider ID`,providerIdHint:`Lowercase letters, numbers, hyphens, or underscores.`,name:`Display name`,baseUrl:`Base URL`,auth:`Authentication`,bearer:`Bearer token`,header:`Custom API key header`,none:`No authentication`,headerName:`Header name`,apiKey:`API key`,apiKeyHint:`Stored in the local credential store, separate from models.json.`,apiKeyUrl:`API key page (optional)`,docsUrl:`Documentation page (optional)`,openKeyPage:`Create API key`,paths:`Protocol and network`,generationsPath:`Generations path`,editsPath:`Edits path`,allowedHosts:`Allowed private hosts (optional)`,allowedHostsHint:`One exact hostname or IP per line. Private endpoints stay blocked unless listed here.`,staticHeaders:`Static headers (optional)`,staticHeadersHint:`One per line: X-Tenant: value. Credential headers are rejected.`,models:`Image models`,addModel:`Add model`,modelId:`Model ID`,modelName:`Name (optional)`,defaultModel:`Default model`,maxCount:`Max images`,defaultCount:`Default count`,defaultSize:`Default size`,format:`Output format`,supportsSize:`Supports size`,edit:`Supports edits`,remove:`Remove`,cancel:`Cancel`,save:`Save service`,saving:`Saving…`,test:`Test generation`,testing:`Generating…`,delete:`Delete service`,confirmDelete:`Delete permanently`,saved:`Image service saved.`,deleted:`Image service deleted.`,testReady:`Test image generated.`,show:`Show key`,hide:`Hide key`,copy:`Copy key`,copied:`Copied`,revealFailed:`Unable to reveal the saved key.`,notRevealable:`No revealable key is stored locally.`,required:`Complete the required connection and model fields.`,duplicateModels:`Model IDs must be unique.`,invalidHeaders:`Static headers must use “Name: value”, one per line.`},zh:{addTitle:`添加图片服务`,editTitle:`管理图片服务`,intro:`连接一个严格实现 OpenAI Images 协议的服务端点。`,connection:`连接信息`,providerId:`Provider ID`,providerIdHint:`仅支持小写字母、数字、连字符和下划线。`,name:`显示名称`,baseUrl:`Base URL`,auth:`认证方式`,bearer:`Bearer Token`,header:`自定义 API Key Header`,none:`无需认证`,headerName:`Header 名称`,apiKey:`API Key`,apiKeyHint:`密钥单独保存在本机凭据存储,不写入 models.json。`,apiKeyUrl:`API Key 创建页面(可选)`,docsUrl:`协议文档页面(可选)`,openKeyPage:`去创建 API Key`,paths:`协议与网络`,generationsPath:`生成路径`,editsPath:`编辑路径`,allowedHosts:`允许访问的私有主机(可选)`,allowedHostsHint:`每行一个精确主机名或 IP;未列出的私网端点保持阻止。`,staticHeaders:`静态 Headers(可选)`,staticHeadersHint:`每行一个:X-Tenant: value。认证 Header 会被拒绝。`,models:`图片模型`,addModel:`添加模型`,modelId:`模型 ID`,modelName:`名称(可选)`,defaultModel:`默认模型`,maxCount:`单次最大张数`,defaultCount:`默认张数`,defaultSize:`默认尺寸`,format:`输出格式`,supportsSize:`支持尺寸参数`,edit:`支持图片编辑`,remove:`移除`,cancel:`取消`,save:`保存服务`,saving:`保存中…`,test:`测试生成`,testing:`生成中…`,delete:`删除服务`,confirmDelete:`确认永久删除`,saved:`图片服务已保存。`,deleted:`图片服务已删除。`,testReady:`测试图片生成成功。`,show:`显示密钥`,hide:`隐藏密钥`,copy:`复制密钥`,copied:`已复制`,revealFailed:`无法查看已保存的密钥。`,notRevealable:`本机没有可查看的密钥。`,required:`请补全必填的连接和模型信息。`,duplicateModels:`模型 ID 不能重复。`,invalidHeaders:`静态 Header 必须使用“名称: 值”格式,每行一个。`}},sn=`mt-1.5 h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`;function cn(e){let t=e??{id:``,capabilities:{generate:{maxCount:1,supportsSize:!0},edit:{enabled:!1}}};return{original:t,id:t.id,name:t.name??``,maxCount:String(t.capabilities.generate?.maxCount??1),defaultCount:t.defaults?.count?String(t.defaults.count):``,defaultSize:t.defaults?.size??``,outputFormat:t.defaults?.outputFormat??``,supportsSize:t.capabilities.generate?.supportsSize??!1,editEnabled:t.capabilities.edit?.enabled??!1}}function ln(e){let t=e.split(`
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{d as a,g as o,m as s,r as c,t as l}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as u}from"./circle-check-C23XjkUj.js";import{t as d}from"./external-link-DjqjBmc3.js";import{t as f}from"./eye-CABVeTq0.js";import{t as p}from"./plus-Q2yW6OE7.js";import{t as m}from"./x-B_N4OPjy.js";import{t as h}from"./messages-DBvKzlCl.js";import{t as g}from"./cn-0WouolD0.js";import{a as _,c as v,i as y,n as b,r as x}from"./locale-store-Jnhw2WMv.js";import{a as S,i as C,n as w,o as T,r as E,s as D,t as O}from"./dist-BGTk37IG.js";import{i as k}from"./vendor-swr-BIWyz7Rc.js";import{n as A,r as j}from"./gateway-config-swr-DAir1JsW.js";import{n as M,t as N}from"./registry-api-BbUEMGcj.js";import{$i as P,$s as F,Al as I,Ao as L,As as R,At as ee,Bt as z,Cn as B,Ct as V,Dn as H,Dt as te,Ef as U,En as W,Et as ne,F as G,Fc as K,Fn as re,Ft as ie,G as ae,Gs as q,Gt as oe,Gu as J,Hl as se,Ht as ce,I as le,Ic as ue,In as Y,Is as de,Iu as fe,Jl as pe,Js as me,Jt as he,Ks as ge,Kt as _e,L as ve,Ls as ye,Lt as be,Mt as xe,Ns as Se,Nt as Ce,Ot as we,Ps as Te,Pt as Ee,Rc as De,Rs as Oe,Rt as ke,Sl as Ae,Sn as je,St as Me,Tf as Ne,Tn as Pe,Tt as Fe,Ut as Ie,Uu as Le,Vs as Re,Vt as ze,Wc as X,Ws as Be,Xs as Ve,Xt as He,Ys as Ue,Yt as We,Za as Ge,Zl as Ke,_t as qe,af as Je,as as Ye,bl as Xe,bn as Ze,bt as Qe,cd as $e,cf as et,cu as tt,ds as nt,ea as rt,ec as it,eo as at,eu as ot,fd as st,fs as Z,gl as ct,gu as lt,hu as ut,jl as dt,js as ft,jt as pt,kt as mt,qd as ht,qn as gt,qs as _t,qt as vt,ss as yt,to as bt,us as xt,vs as St,vt as Ct,wn as wt,wt as Tt,xn as Et,xt as Dt,xu as Ot,ys as kt,yt as At,zt as jt}from"./index-CzkAd5Su.js";import{t as Mt}from"./number-input-DDeqHK-G.js";import{n as Nt,r as Pt}from"./settings-page-layout-Dx5S-Msc.js";import{n as Ft,t as It}from"./settings-form-section-COwDGhbe.js";import{n as Lt,t as Rt}from"./use-autosave-BmbPOiQU.js";import{c as zt,f as Bt,i as Vt,l as Ht,n as Ut,o as Wt,r as Gt,s as Kt,t as qt,u as Jt}from"./voice-config-api-T3nM4buh.js";import{t as Yt}from"./voice-api-key-field-DqLKXIfy.js";import{a as Xt,i as Zt,n as Qt,o as $t,r as en,s as tn,t as nn}from"./image-generation-api-DPcsBPX7.js";import{t as rn}from"./xopc-cloud-account-card-DQNlWhsN.js";var an=n(),Q=e(t(),1),$=r(),on={en:{addTitle:`Add image service`,editTitle:`Manage image service`,intro:`Connect an endpoint that implements the OpenAI Images protocol.`,connection:`Connection`,providerId:`Provider ID`,providerIdHint:`Lowercase letters, numbers, hyphens, or underscores.`,name:`Display name`,baseUrl:`Base URL`,auth:`Authentication`,bearer:`Bearer token`,header:`Custom API key header`,none:`No authentication`,headerName:`Header name`,apiKey:`API key`,apiKeyHint:`Stored in the local credential store, separate from models.json.`,apiKeyUrl:`API key page (optional)`,docsUrl:`Documentation page (optional)`,openKeyPage:`Create API key`,paths:`Protocol and network`,generationsPath:`Generations path`,editsPath:`Edits path`,allowedHosts:`Allowed private hosts (optional)`,allowedHostsHint:`One exact hostname or IP per line. Private endpoints stay blocked unless listed here.`,staticHeaders:`Static headers (optional)`,staticHeadersHint:`One per line: X-Tenant: value. Credential headers are rejected.`,models:`Image models`,addModel:`Add model`,modelId:`Model ID`,modelName:`Name (optional)`,defaultModel:`Default model`,maxCount:`Max images`,defaultCount:`Default count`,defaultSize:`Default size`,format:`Output format`,supportsSize:`Supports size`,edit:`Supports edits`,remove:`Remove`,cancel:`Cancel`,save:`Save service`,saving:`Saving…`,test:`Test generation`,testing:`Generating…`,delete:`Delete service`,confirmDelete:`Delete permanently`,saved:`Image service saved.`,deleted:`Image service deleted.`,testReady:`Test image generated.`,show:`Show key`,hide:`Hide key`,copy:`Copy key`,copied:`Copied`,revealFailed:`Unable to reveal the saved key.`,notRevealable:`No revealable key is stored locally.`,required:`Complete the required connection and model fields.`,duplicateModels:`Model IDs must be unique.`,invalidHeaders:`Static headers must use “Name: value”, one per line.`},zh:{addTitle:`添加图片服务`,editTitle:`管理图片服务`,intro:`连接一个严格实现 OpenAI Images 协议的服务端点。`,connection:`连接信息`,providerId:`Provider ID`,providerIdHint:`仅支持小写字母、数字、连字符和下划线。`,name:`显示名称`,baseUrl:`Base URL`,auth:`认证方式`,bearer:`Bearer Token`,header:`自定义 API Key Header`,none:`无需认证`,headerName:`Header 名称`,apiKey:`API Key`,apiKeyHint:`密钥单独保存在本机凭据存储,不写入 models.json。`,apiKeyUrl:`API Key 创建页面(可选)`,docsUrl:`协议文档页面(可选)`,openKeyPage:`去创建 API Key`,paths:`协议与网络`,generationsPath:`生成路径`,editsPath:`编辑路径`,allowedHosts:`允许访问的私有主机(可选)`,allowedHostsHint:`每行一个精确主机名或 IP;未列出的私网端点保持阻止。`,staticHeaders:`静态 Headers(可选)`,staticHeadersHint:`每行一个:X-Tenant: value。认证 Header 会被拒绝。`,models:`图片模型`,addModel:`添加模型`,modelId:`模型 ID`,modelName:`名称(可选)`,defaultModel:`默认模型`,maxCount:`单次最大张数`,defaultCount:`默认张数`,defaultSize:`默认尺寸`,format:`输出格式`,supportsSize:`支持尺寸参数`,edit:`支持图片编辑`,remove:`移除`,cancel:`取消`,save:`保存服务`,saving:`保存中…`,test:`测试生成`,testing:`生成中…`,delete:`删除服务`,confirmDelete:`确认永久删除`,saved:`图片服务已保存。`,deleted:`图片服务已删除。`,testReady:`测试图片生成成功。`,show:`显示密钥`,hide:`隐藏密钥`,copy:`复制密钥`,copied:`已复制`,revealFailed:`无法查看已保存的密钥。`,notRevealable:`本机没有可查看的密钥。`,required:`请补全必填的连接和模型信息。`,duplicateModels:`模型 ID 不能重复。`,invalidHeaders:`静态 Header 必须使用“名称: 值”格式,每行一个。`}},sn=`mt-1.5 h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`;function cn(e){let t=e??{id:``,capabilities:{generate:{maxCount:1,supportsSize:!0},edit:{enabled:!1}}};return{original:t,id:t.id,name:t.name??``,maxCount:String(t.capabilities.generate?.maxCount??1),defaultCount:t.defaults?.count?String(t.defaults.count):``,defaultSize:t.defaults?.size??``,outputFormat:t.defaults?.outputFormat??``,supportsSize:t.capabilities.generate?.supportsSize??!1,editEnabled:t.capabilities.edit?.enabled??!1}}function ln(e){let t=e.split(`
3
3
  `).map(e=>e.trim()).filter(Boolean);if(t.length===0)return;let n=t.map(e=>{let t=e.indexOf(`:`);if(t<=0||!e.slice(t+1).trim())throw Error(`invalid_headers`);return[e.slice(0,t).trim(),e.slice(t+1).trim()]});return Object.fromEntries(n)}function un({open:e,onOpenChange:t,provider:n,configured:r,language:i,onSaved:a,portalContainer:o,onPendingChange:s}){let c=on[i],[l,u]=(0,Q.useState)(``),[d,h]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(`bearer`),[x,k]=(0,Q.useState)(`x-api-key`),[A,j]=(0,Q.useState)(``),[M,N]=(0,Q.useState)(``),[P,F]=(0,Q.useState)(``),[I,L]=(0,Q.useState)(`/images/generations`),[R,ee]=(0,Q.useState)(`/images/edits`),[z,B]=(0,Q.useState)(``),[V,H]=(0,Q.useState)(``),[te,U]=(0,Q.useState)([cn()]),[W,ne]=(0,Q.useState)(``),[G,K]=(0,Q.useState)(),[re,ie]=(0,Q.useState)(!1),[ae,q]=(0,Q.useState)(),[oe,se]=(0,Q.useState)(),[ce,le]=(0,Q.useState)();(0,Q.useEffect)(()=>(s?.(!!G),()=>s?.(!1)),[G,s]),(0,Q.useEffect)(()=>{if(!e)return;let t=n?.imageGeneration;u(n?.providerId??``),h(t?.name??``),v(n?.baseUrl??``),b(t?.auth.type??`bearer`),k(t?.auth.type===`header`?t.auth.headerName:`x-api-key`),j(r?`••••••••••••`:``),N(t?.apiKeyUrl??``),F(t?.documentationUrl??``),L(t?.paths?.generations??`/images/generations`),ee(t?.paths?.edits??`/images/edits`),B(t?.network?.allowedHosts.join(`
4
4
  `)??``),H(Object.entries(n?.headers??{}).map(([e,t])=>`${e}: ${t}`).join(`
5
5
  `)),U(t?.models.map(cn)??[cn()]),ne(t?.defaultModel??``),se(void 0),K(void 0),ie(!1),q(void 0),le(void 0)},[r,e,n]);let ue=(0,Q.useMemo)(()=>te.filter(e=>e.id.trim()).map(e=>({value:e.id.trim(),label:e.name.trim()||e.id.trim()})),[te]),Y=(e,t)=>{U(n=>n.map((n,r)=>r===e?{...n,...t}:n))},de=()=>{let e=l.trim(),t=te.map(e=>({...e,id:e.id.trim(),name:e.name.trim()}));if(!e||!d.trim()||!_.trim()||t.some(e=>!e.id))throw Error(c.required);if(new Set(t.map(e=>e.id)).size!==t.length)throw Error(c.duplicateModels);let n=W||t[0]?.id;if(!n||!t.some(e=>e.id===n))throw Error(c.required);let r;try{r=ln(V)}catch{throw Error(c.invalidHeaders)}return{providerId:e,input:{baseUrl:_.trim(),...r?{headers:r}:{},imageGeneration:{api:`openai-images`,name:d.trim(),...P.trim()?{documentationUrl:P.trim()}:{},...M.trim()?{apiKeyUrl:M.trim()}:{},defaultModel:n,auth:y===`header`?{type:`header`,headerName:x.trim()}:{type:y},paths:{...I.trim()?{generations:I.trim()}:{},...R.trim()?{edits:R.trim()}:{}},...z.trim()?{network:{allowedHosts:z.split(`
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{Ds as i,Es as a,Ts as o,W as s,Wc as c,ru as l,ws as u}from"./index-Cmrvxc_s.js";var d=n(),f=e(t(),1),p=r(),m=(0,f.memo)(function(e){let t=(0,d.c)(8),{value:n,onChange:r,placeholder:i,ariaLabel:a}=e,o=a===void 0?i:a,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,p.jsx)(l,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=s):s=t[0];let c;t[1]===r?c=t[2]:(c=e=>r(e.currentTarget.value),t[1]=r,t[2]=c);let u;return t[3]!==o||t[4]!==i||t[5]!==c||t[6]!==n?(u=(0,p.jsxs)(`label`,{className:`relative flex h-11 min-w-0 w-full cursor-text items-center rounded-xl border border-edge bg-surface-base pl-9 pr-3 text-fg shadow-none focus-within:border-accent/60 focus-within:ring-2 focus-within:ring-accent/30 md:h-9`,children:[s,(0,p.jsx)(`input`,{type:`search`,"aria-label":o,enterKeyHint:`search`,value:n,onChange:c,placeholder:i,autoComplete:`off`,spellCheck:!1,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent text-base leading-normal text-fg caret-current placeholder:text-fg-muted focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 md:text-sm`})]}),t[3]=o,t[4]=i,t[5]=c,t[6]=n,t[7]=u):u=t[7],u});function h(e){let t=(0,d.c)(8),{contribution:n}=e,r=s(`(min-width: 768px)`),f;t[0]!==n||t[1]!==r?(f=n?.search?r?(0,p.jsx)(`div`,{className:`min-w-0 max-w-60 flex-1`,children:n.search}):(0,p.jsxs)(a,{children:[(0,p.jsx)(i,{asChild:!0,children:(0,p.jsx)(c,{type:`button`,variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":n.searchLabel,title:n.searchLabel,children:(0,p.jsx)(l,{className:`size-4`,"aria-hidden":!0})})}),(0,p.jsx)(o,{children:(0,p.jsx)(u,{align:`end`,sideOffset:8,className:`z-50 w-[min(20rem,calc(100vw-2rem))] rounded-xl border border-edge bg-surface-overlay p-2 shadow-popover`,children:n.search})})]}):null,t[0]=n,t[1]=r,t[2]=f):f=t[2];let m=n?.secondary,h=n?.primary,g=n?.overflow,_;return t[3]!==f||t[4]!==m||t[5]!==h||t[6]!==g?(_=(0,p.jsxs)(`div`,{className:`flex min-w-0 items-center justify-end gap-2 xl:w-[27rem] 2xl:w-[31rem]`,children:[f,m,h,g]}),t[3]=f,t[4]=m,t[5]=h,t[6]=g,t[7]=_):_=t[7],_}export{m as n,h as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{Ds as i,Es as a,Ts as o,W as s,Wc as c,ru as l,ws as u}from"./index-CzkAd5Su.js";var d=n(),f=e(t(),1),p=r(),m=(0,f.memo)(function(e){let t=(0,d.c)(8),{value:n,onChange:r,placeholder:i,ariaLabel:a}=e,o=a===void 0?i:a,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,p.jsx)(l,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=s):s=t[0];let c;t[1]===r?c=t[2]:(c=e=>r(e.currentTarget.value),t[1]=r,t[2]=c);let u;return t[3]!==o||t[4]!==i||t[5]!==c||t[6]!==n?(u=(0,p.jsxs)(`label`,{className:`relative flex h-11 min-w-0 w-full cursor-text items-center rounded-xl border border-edge bg-surface-base pl-9 pr-3 text-fg shadow-none focus-within:border-accent/60 focus-within:ring-2 focus-within:ring-accent/30 md:h-9`,children:[s,(0,p.jsx)(`input`,{type:`search`,"aria-label":o,enterKeyHint:`search`,value:n,onChange:c,placeholder:i,autoComplete:`off`,spellCheck:!1,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent text-base leading-normal text-fg caret-current placeholder:text-fg-muted focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 md:text-sm`})]}),t[3]=o,t[4]=i,t[5]=c,t[6]=n,t[7]=u):u=t[7],u});function h(e){let t=(0,d.c)(8),{contribution:n}=e,r=s(`(min-width: 768px)`),f;t[0]!==n||t[1]!==r?(f=n?.search?r?(0,p.jsx)(`div`,{className:`min-w-0 max-w-60 flex-1`,children:n.search}):(0,p.jsxs)(a,{children:[(0,p.jsx)(i,{asChild:!0,children:(0,p.jsx)(c,{type:`button`,variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":n.searchLabel,title:n.searchLabel,children:(0,p.jsx)(l,{className:`size-4`,"aria-hidden":!0})})}),(0,p.jsx)(o,{children:(0,p.jsx)(u,{align:`end`,sideOffset:8,className:`z-50 w-[min(20rem,calc(100vw-2rem))] rounded-xl border border-edge bg-surface-overlay p-2 shadow-popover`,children:n.search})})]}):null,t[0]=n,t[1]=r,t[2]=f):f=t[2];let m=n?.secondary,h=n?.primary,g=n?.overflow,_;return t[3]!==f||t[4]!==m||t[5]!==h||t[6]!==g?(_=(0,p.jsxs)(`div`,{className:`flex min-w-0 items-center justify-end gap-2 xl:w-[27rem] 2xl:w-[31rem]`,children:[f,m,h,g]}),t[3]=f,t[4]=m,t[5]=h,t[6]=g,t[7]=_):_=t[7],_}export{m as n,h as t};