@zktx.io/sui-mcp 0.7.0 → 0.8.0

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 (69) hide show
  1. package/README.md +83 -42
  2. package/dist/core/activity/localDataService.js +8 -21
  3. package/dist/core/activity/localDataValidation.js +22 -46
  4. package/dist/core/activity/sqliteAccountStore.js +46 -0
  5. package/dist/core/activity/sqliteActivityStore.js +65 -147
  6. package/dist/core/activity/sqliteActivityStoreSchema.js +42 -26
  7. package/dist/core/activity/transactionActivityService.js +2 -2
  8. package/dist/core/preferences/preferencesStore.js +2 -2
  9. package/dist/core/preferences/sqlitePreferencesRepository.js +10 -0
  10. package/dist/core/session/cardResult.js +41 -0
  11. package/dist/core/session/cardSession.js +1 -1
  12. package/dist/core/session/cardSessionStore.js +51 -19
  13. package/dist/core/session/chainAccounts.js +120 -0
  14. package/dist/core/session/sessionStore.js +4 -8
  15. package/dist/core/session/settingsFileStore.js +3 -30
  16. package/dist/core/session/settingsOperation.js +27 -19
  17. package/dist/core/session/settingsWorkflow.js +161 -87
  18. package/dist/core/session/sqliteCardStore.js +34 -14
  19. package/dist/core/session/sqliteSessionStore.js +5 -5
  20. package/dist/core/session/sqliteSettingsWorkflowStore.js +135 -41
  21. package/dist/core/session/sqliteTransactionRequest.js +18 -0
  22. package/dist/core/session/sqliteWalletConnectionOperation.js +13 -0
  23. package/dist/core/session/sqliteWalletWorkflowStore.js +569 -333
  24. package/dist/core/session/status.js +2 -2
  25. package/dist/core/session/wait.js +6 -11
  26. package/dist/core/session/walletConnection.js +71 -46
  27. package/dist/core/session/walletConnectionOperations.js +24 -0
  28. package/dist/core/session/walletRuntime.js +7 -13
  29. package/dist/core/session/walletWorkflow.js +248 -99
  30. package/dist/core/session/workflowState.js +104 -38
  31. package/dist/core/session/workflowView.js +92 -101
  32. package/dist/mcp/activeAccountResponse.js +3 -0
  33. package/dist/mcp/responseGuidance.js +7 -9
  34. package/dist/mcp/serverInfo.js +11 -10
  35. package/dist/mcp/toolErrors.js +5 -3
  36. package/dist/mcp/toolNames.js +1 -0
  37. package/dist/mcp/tools/action/prepareSuiActionReview.js +9 -16
  38. package/dist/mcp/tools/read/readToolHelpers.js +9 -7
  39. package/dist/mcp/tools/session/executionResultTools.js +2 -2
  40. package/dist/mcp/tools/session/shared.js +2 -2
  41. package/dist/mcp/tools/session/statusTools.js +12 -10
  42. package/dist/mcp/tools/session/walletConnectionTools.js +26 -14
  43. package/dist/mcp/tools/settings/index.js +7 -4
  44. package/dist/mcp-app/account.html +7 -7
  45. package/dist/mcp-app/chart.html +3 -3
  46. package/dist/mcp-app/connect.html +13 -13
  47. package/dist/mcp-app/disconnect.html +3637 -0
  48. package/dist/mcp-app/disconnect.notices.txt +1480 -0
  49. package/dist/mcp-app/receipt.html +393 -393
  50. package/dist/mcp-app/review.html +459 -459
  51. package/dist/mcp-app/settings.html +7 -7
  52. package/dist/mcp-ui/contracts.js +3 -1
  53. package/dist/mcp-ui/tools.js +4 -4
  54. package/dist/runtime/application.js +1 -1
  55. package/dist/runtime/localSettingsService.js +7 -4
  56. package/dist/runtime/smokeMainnetRead.js +5 -4
  57. package/dist/runtime/walletConnectTransport.js +16 -16
  58. package/dist/runtime/walletSdkChildRuntime.js +29 -12
  59. package/dist/runtime/walletSdkIpc.js +5 -4
  60. package/dist/runtime/walletSdkProcess.js +24 -8
  61. package/docs/AGENT_BEHAVIOR.md +82 -54
  62. package/docs/LOCAL_DB_ARCHITECTURE.md +100 -70
  63. package/docs/MCP_SETUP.md +319 -339
  64. package/docs/MCP_TOOLS.md +292 -177
  65. package/docs/SDK_API.md +15 -6
  66. package/docs/TRANSACTION_ACTIVITY_LOG.md +4 -0
  67. package/docs/UTILITY_INDEX.md +9 -7
  68. package/docs/WALLET_CONNECTION.md +162 -167
  69. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- <!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Sui MCP</title><style>:root[data-theme=light]{--ui-bg:#f6f8fa;--ui-surface:#fff;--ui-surface-2:#eef1f5;--ui-border:#e3e8ef;--ui-border-strong:#cdd5e0;--ui-text:#18202b;--ui-text-muted:#5b6675;--ui-accent:#1565c0;--ui-accent-hover:#0d47a1;--ui-on-accent:#fff;--ui-focus:#1565c040;--ui-ok-bg:#e2f3e9;--ui-ok-text:#1b6b43;--ui-warn-bg:#fbeeda;--ui-warn-text:#8a5a08;--ui-danger:#b3261e;--ui-danger-bg:#fbe9e7;--ui-up:#1b7f43;--ui-down:#b3261e}:root[data-theme=dark]{--ui-bg:#0e141b;--ui-surface:#161d26;--ui-surface-2:#1e2733;--ui-border:#28323f;--ui-border-strong:#3a4859;--ui-text:#e7edf4;--ui-text-muted:#9aa7b6;--ui-accent:#4da2ff;--ui-accent-hover:#6fb8ff;--ui-on-accent:#06243f;--ui-focus:#4da2ff52;--ui-ok-bg:#10362a;--ui-ok-text:#7fe0b0;--ui-warn-bg:#3a2e16;--ui-warn-text:#f0c97a;--ui-danger:#ff8a80;--ui-danger-bg:#3a1f1d;--ui-up:#46c79e;--ui-down:#ff8a80}:root{--ui-r:10px;--ui-font-sans:ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;--ui-font-mono:ui-monospace, SFMono-Regular, Menlo, monospace}*,:before,:after{box-sizing:border-box}body{background:var(--ui-bg);color:var(--ui-text);font-family:var(--ui-font-sans);-webkit-font-smoothing:antialiased;margin:0;font-weight:400}.ui-mono{font-family:var(--ui-font-mono);overflow-wrap:anywhere;font-size:12.5px}.ui-btn{border:.5px solid var(--ui-border-strong);border-radius:var(--ui-r);background:var(--ui-surface);min-height:38px;color:var(--ui-text);font:inherit;cursor:pointer;justify-content:center;align-items:center;gap:7px;padding:0 16px;font-size:14px;font-weight:500;transition:background .12s,border-color .12s,transform 60ms;display:inline-flex}.ui-btn:hover{background:var(--ui-surface-2);border-color:var(--ui-accent)}.ui-btn:active{transform:scale(.975)}.ui-btn:focus-visible{box-shadow:0 0 0 3px var(--ui-focus);outline:none}.ui-btn--primary{background:var(--ui-accent);border-color:var(--ui-accent);color:var(--ui-on-accent)}.ui-btn--primary:hover{background:var(--ui-accent-hover);border-color:var(--ui-accent-hover)}.ui-btn--danger{border-color:var(--ui-danger);color:var(--ui-danger)}.ui-btn--danger:hover{background:var(--ui-danger-bg)}.ui-btn:disabled{cursor:not-allowed;color:var(--ui-text-muted);background:var(--ui-surface-2);border-color:var(--ui-border)}.ui-btn-row{flex-wrap:wrap;gap:10px;margin-top:12px;display:flex}.ui-btn-row>.ui-btn{flex:1 1 0;min-width:12rem}.ui-btn-row--end{justify-content:flex-end}.ui-btn-row--end>.ui-btn{flex:none;min-width:0}.ui-icon-btn{border:.5px solid var(--ui-border-strong);background:var(--ui-surface);width:34px;height:34px;color:var(--ui-text);cursor:pointer;border-radius:9px;flex:none;justify-content:center;align-items:center;padding:0;transition:background .12s,border-color .12s,transform 60ms;display:inline-flex}.ui-icon-btn:hover{background:var(--ui-surface-2);border-color:var(--ui-accent)}.ui-icon-btn:active{transform:scale(.94)}.ui-icon-btn:focus-visible{box-shadow:0 0 0 3px var(--ui-focus);outline:none}.ui-icon-btn svg{width:18px;height:18px}.ui-link{color:var(--ui-accent);cursor:pointer;text-decoration:none}.ui-link:hover{color:var(--ui-accent-hover);text-decoration:underline}.ui-field{color:var(--ui-text-muted);flex-direction:column;gap:5px;font-size:12px;display:flex}.ui-input,input.ui-input{border:.5px solid var(--ui-border-strong);border-radius:var(--ui-r);background:var(--ui-surface);height:38px;color:var(--ui-text);font:inherit;outline:none;padding:0 12px;font-size:14px;transition:border-color .12s,box-shadow .12s}.ui-input{width:100%}.ui-input::placeholder{color:var(--ui-text-muted)}.ui-select{border:.5px solid var(--ui-border-strong);border-radius:var(--ui-r);background:var(--ui-surface);width:100%;height:38px;color:var(--ui-text);font:inherit;cursor:pointer;outline:none;padding:0 12px;font-size:14px;transition:border-color .12s,box-shadow .12s}.ui-select:focus,.ui-input:focus{border-color:var(--ui-accent);box-shadow:0 0 0 3px var(--ui-focus)}.ui-card{background:var(--ui-surface);border:.5px solid var(--ui-border);padding:var(--ui-card-padding-block,16px) var(--ui-card-padding-inline,18px);border-radius:12px;margin:0 0 14px}.ui-section{min-width:0;margin-block:0 16px}.ui-section-title{justify-content:space-between;align-items:center;gap:10px;margin:0 0 10px;font-size:14px;font-weight:500;display:flex}.ui-card-title{margin:0 0 10px;font-size:14px;font-weight:500}.ui-card-head{margin:calc(-1 * var(--ui-card-padding-block,16px)) calc(-1 * var(--ui-card-padding-inline,18px)) 14px;padding:9px var(--ui-card-padding-inline,18px);background:var(--ui-surface-2);border-bottom:.5px solid var(--ui-border);border-radius:12px 12px 0 0;justify-content:space-between;align-items:center;gap:10px;font-size:14px;font-weight:500;display:flex}.ui-card-head+.ui-detail-item,.ui-card-head+.ui-row{border-top:0}.ui-row{border-top:.5px solid var(--ui-border);grid-template-columns:minmax(140px,.34fr) minmax(0,1fr);gap:12px;padding:9px 0;font-size:14px;display:grid}.ui-row:first-child{border-top:0}.ui-row-label{color:var(--ui-text-muted)}.ui-row-value{color:var(--ui-text);overflow-wrap:anywhere;font-variant-numeric:tabular-nums;text-align:right}.ui-status-banner{border-radius:var(--ui-r);border:.5px solid var(--ui-border-strong);background:var(--ui-surface-2);color:var(--ui-text);align-items:center;gap:9px;padding:11px 0;font-size:14px;font-weight:500;display:flex}.ui-status-icon{flex:none;display:inline-flex}.ui-status-icon svg{width:18px;height:18px}.ui-status-banner--success{background:var(--ui-ok-bg);color:var(--ui-ok-text);border-color:#0000}.ui-status-banner--failure{background:var(--ui-danger-bg);color:var(--ui-danger);border-color:#0000}.ui-status-banner--pending{color:var(--ui-text-muted)}.ui-detail-item{border-top:.5px solid var(--ui-border);padding:9px 0}.ui-detail-head{flex-wrap:wrap;justify-content:space-between;align-items:baseline;gap:12px;display:flex}.ui-detail-title{color:var(--ui-text);overflow-wrap:anywhere;font-weight:500}.ui-detail-trailing{color:var(--ui-text);overflow-wrap:anywhere}.ui-detail-trailing--up{color:var(--ui-up)}.ui-detail-trailing--down{color:var(--ui-down)}.ui-detail-meta{color:var(--ui-text-muted);overflow-wrap:anywhere;gap:8px;margin-top:3px;font-size:12.5px;display:flex}.ui-detail-metalabel{color:var(--ui-text-muted);flex:none}.ui-feedback{border:.5px solid var(--ui-border);background:var(--ui-surface);color:var(--ui-text);border-left-width:3px;border-radius:8px;margin:0 0 14px;padding:11px 13px;font-size:13.5px}.ui-feedback--ok{border-left-color:var(--ui-ok-text)}.ui-feedback--error{border-left-color:var(--ui-danger)}.ui-card>.ui-feedback{margin:14px 0}.ui-card>.ui-feedback:last-child{margin-bottom:0}.ui-feedback-detail{color:var(--ui-text-muted);overflow-wrap:anywhere;margin-top:4px;font-size:12.5px;display:block}.ui-placeholder{border:.5px dashed var(--ui-border-strong);color:var(--ui-text-muted);text-align:center;border-radius:12px;margin:0 0 14px;padding:18px;font-size:13.5px}.ui-note{color:var(--ui-text-muted);margin:12px 0 0;font-size:12.5px;line-height:1.6}.ui-info{border:.5px solid var(--ui-border-strong);width:1.3em;height:1.3em;color:var(--ui-text-muted);cursor:help;vertical-align:middle;border-radius:50%;justify-content:center;align-items:center;margin-left:.3em;font-size:.72em;font-style:normal;font-weight:500;line-height:1;display:inline-flex}.ui-info:hover,.ui-info:focus-visible{border-color:var(--ui-accent);color:var(--ui-accent);outline:none}.ui-ptb-graph{min-height:60px;color:var(--ui-text-muted);font-size:13px;overflow-x:auto}.ui-ptb-graph svg{max-width:100%;height:auto}.ui-ptb-graph--error{color:var(--ui-danger)}.ui-chain-receipt-gas{margin-bottom:6px}.ui-chain-receipt-ptb{background:var(--ui-surface);min-width:0;overflow:hidden}.ui-ptb-actions{align-items:center;gap:4px;display:flex}.ui-ptb-graph-controls .ui-icon-btn{background:var(--ui-surface-2);box-shadow:0 1px 3px #0003}.ui-ptb-graph--interactive{cursor:grab;-webkit-user-select:none;user-select:none;touch-action:none;height:420px;position:relative;overflow:hidden}.ui-ptb-graph--grabbing{cursor:grabbing}.ui-ptb-graph-content{transform-origin:0 0;width:100%}.ui-ptb-graph-controls{z-index:2;flex-direction:column;gap:5px;display:flex;position:absolute;top:8px;right:8px}.ui-ptb-graph-controls .ui-icon-btn{width:28px;height:28px}.ui-ptb-graph-controls .ui-icon-btn svg{width:15px;height:15px}.ui-accordion{border-block-start:1px solid var(--ui-border);margin-block:12px}.ui-accordion-summary{cursor:pointer;color:var(--ui-text);justify-content:space-between;align-items:center;gap:10px;padding:11px 0;font-size:13px;font-weight:500;list-style:none;display:flex}.ui-accordion-summary::-webkit-details-marker{display:none}.ui-accordion-summary:hover{color:var(--ui-accent)}.ui-accordion-summary:focus-visible{box-shadow:0 0 0 3px var(--ui-focus);border-radius:var(--ui-r);outline:none}.ui-accordion-summary:after{content:"";border-right:1.5px solid var(--ui-text-muted);border-bottom:1.5px solid var(--ui-text-muted);flex:none;width:7px;height:7px;transition:transform .15s;transform:rotate(45deg)}.ui-accordion[open] .ui-accordion-summary:after{transform:rotate(-135deg)}.ui-accordion[open] .ui-accordion-summary{color:var(--ui-accent)}.ui-accordion-body{padding:4px 0 12px}.ui-accordion[open]>.ui-accordion-body{animation:.18s ease-out ui-reveal}@keyframes ui-reveal{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){.ui-accordion[open]>.ui-accordion-body{animation:none}}@container mcp-card (width<=28rem){.ui-card{--ui-card-padding-block:12px;--ui-card-padding-inline:12px}.ui-row{grid-template-columns:minmax(0,1fr);gap:4px}.ui-row-value{text-align:left}.ui-detail-meta{flex-wrap:wrap}}@container mcp-card (width>=0){.ui-card,.ui-card-head>:first-child,.ui-detail-head>*,.ui-detail-meta>*{min-width:0}.ui-ptb-actions{flex:none}.ui-ptb-graph--interactive{height:clamp(280px,75cqi,420px)}}.ui-error:not(:empty){color:var(--ui-danger)}.ui-note:empty,.ui-error:empty{display:none}.ui-form{flex-wrap:wrap;align-items:end;gap:12px;display:flex}.ui-form>*{min-width:0;max-width:100%}.ui-form>input,.ui-form>select,.ui-form>label{flex:14rem}.ui-form label{flex-direction:column;gap:6px;display:flex}.ui-form label>input,.ui-form label>select{width:100%}.ui-form>details,.ui-form>p,.ui-form>.card-actions{flex-basis:100%}@container mcp-card (width<=28rem){.ui-form>button{width:100%}}.settings-card{overflow-x:clip}.settings-card .settings-page--forward{animation:.18s ease-out settings-forward}.settings-card .settings-page--back{animation:.18s ease-out settings-back}@keyframes settings-forward{0%{opacity:0;transform:translate(16px)}to{opacity:1;transform:translate(0)}}@keyframes settings-back{0%{opacity:0;transform:translate(-16px)}to{opacity:1;transform:translate(0)}}@media (prefers-reduced-motion:reduce){.settings-card .settings-page--forward,.settings-card .settings-page--back{animation:none}}.settings-card .settings-toolbar{border-bottom:1px solid var(--ui-border);flex-wrap:wrap;align-items:center;gap:12px;margin-block-end:20px;padding-block:0 14px;display:flex}.settings-card .settings-location{color:var(--ui-text-muted);font-size:13px}.settings-card .settings-back{background:0 0;border-color:#0000;padding-inline:0 10px}.settings-card .settings-back:before{content:"←";margin-inline-end:8px}.settings-card .settings-menu{margin-block:16px;display:grid}.settings-card .settings-menu-item{text-align:start;white-space:normal;border:0;border-bottom:1px solid var(--ui-border);width:100%;color:var(--ui-text);background:0 0;border-radius:0;grid-template-columns:minmax(0,1fr);justify-content:stretch;justify-items:start;gap:5px;padding:18px 32px 18px 12px;display:grid;position:relative}.settings-card .settings-menu-item:hover{background:var(--ui-surface-2)}.settings-card .settings-menu-item:after{content:"";inset-inline-end:14px;border-top:1.5px solid var(--ui-text-muted);border-right:1.5px solid var(--ui-text-muted);width:7px;height:7px;position:absolute;top:50%;transform:translateY(-50%)rotate(45deg)}.settings-card .settings-menu-title{font-weight:600}.settings-card .settings-menu-description{color:var(--ui-text-muted);font-size:13px;font-weight:400}.settings-card .settings-pending{margin-block:20px}.settings-card .settings-action-row{align-items:stretch;gap:var(--ui-space-2,8px);grid-template-columns:minmax(0,1fr);margin-block-start:12px;display:grid}.settings-card .settings-action-row>.ui-btn{white-space:normal;overflow-wrap:anywhere;width:100%;min-width:0}.settings-card .settings-path{white-space:normal;overflow-wrap:anywhere}.settings-card .settings-backup-location .ui-row{grid-template-columns:minmax(0,1fr);gap:6px}.settings-card .settings-backup-location .ui-row-value{text-align:start}.settings-card .settings-choice{border-bottom:1px solid var(--ui-border);flex-wrap:wrap;align-items:center;gap:12px 20px;padding-block:18px;display:flex}.settings-card .settings-choice-copy{flex:16rem;min-width:0}.settings-card .settings-choice h3{margin-block:0 6px}.settings-card .settings-choice p{margin:0}.settings-card .settings-endpoint{border-bottom:1px solid var(--ui-border);padding-block:16px}.settings-card .settings-endpoint label{flex-direction:column;gap:8px;display:flex}html,body{min-height:0;margin:0}body{color:var(--ui-text);background:var(--ui-bg)}#app{padding:var(--ui-space-4,16px);overflow-wrap:anywhere;min-width:0;max-width:100%;container:mcp-card/inline-size}#app h1{margin:0 0 12px;font-size:20px;font-weight:500}.card-actions{margin-top:12px}.card-actions,.card-actions>div{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.card-chart{width:100%;min-width:0;height:clamp(280px,75cqi,400px)}.card-progress-hint{color:var(--ui-text-muted);align-items:center;gap:10px;margin-block:12px;font-size:12px;display:flex}.card-progress-hint[hidden]{display:none}
1
+ <!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Sui MCP</title><style>:root[data-theme=light]{--ui-bg:#f6f8fa;--ui-surface:#fff;--ui-surface-2:#eef1f5;--ui-border:#e3e8ef;--ui-border-strong:#cdd5e0;--ui-text:#18202b;--ui-text-muted:#5b6675;--ui-accent:#1565c0;--ui-accent-hover:#0d47a1;--ui-on-accent:#fff;--ui-focus:#1565c040;--ui-ok-bg:#e2f3e9;--ui-ok-text:#1b6b43;--ui-warn-bg:#fbeeda;--ui-warn-text:#8a5a08;--ui-danger:#b3261e;--ui-danger-bg:#fbe9e7;--ui-up:#1b7f43;--ui-down:#b3261e}:root[data-theme=dark]{--ui-bg:#0e141b;--ui-surface:#161d26;--ui-surface-2:#1e2733;--ui-border:#28323f;--ui-border-strong:#3a4859;--ui-text:#e7edf4;--ui-text-muted:#9aa7b6;--ui-accent:#4da2ff;--ui-accent-hover:#6fb8ff;--ui-on-accent:#06243f;--ui-focus:#4da2ff52;--ui-ok-bg:#10362a;--ui-ok-text:#7fe0b0;--ui-warn-bg:#3a2e16;--ui-warn-text:#f0c97a;--ui-danger:#ff8a80;--ui-danger-bg:#3a1f1d;--ui-up:#46c79e;--ui-down:#ff8a80}:root{--ui-r:10px;--ui-font-sans:ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;--ui-font-mono:ui-monospace, SFMono-Regular, Menlo, monospace}*,:before,:after{box-sizing:border-box}[hidden]{display:none!important}body{background:var(--ui-bg);color:var(--ui-text);font-family:var(--ui-font-sans);-webkit-font-smoothing:antialiased;margin:0;font-weight:400}.ui-mono{font-family:var(--ui-font-mono);overflow-wrap:anywhere;font-size:12.5px}.ui-btn{border:.5px solid var(--ui-border-strong);border-radius:var(--ui-r);background:var(--ui-surface);min-height:38px;color:var(--ui-text);font:inherit;cursor:pointer;justify-content:center;align-items:center;gap:7px;padding:0 16px;font-size:14px;font-weight:500;transition:background .12s,border-color .12s,transform 60ms;display:inline-flex}.ui-btn:hover{background:var(--ui-surface-2);border-color:var(--ui-accent)}.ui-btn:active{transform:scale(.975)}.ui-btn:focus-visible{box-shadow:0 0 0 3px var(--ui-focus);outline:none}.ui-btn--primary{background:var(--ui-accent);border-color:var(--ui-accent);color:var(--ui-on-accent)}.ui-btn--primary:hover{background:var(--ui-accent-hover);border-color:var(--ui-accent-hover)}.ui-btn--danger{border-color:var(--ui-danger);color:var(--ui-danger)}.ui-btn--danger:hover{background:var(--ui-danger-bg)}.ui-btn:disabled{cursor:not-allowed;color:var(--ui-text-muted);background:var(--ui-surface-2);border-color:var(--ui-border)}.ui-btn-row{flex-wrap:wrap;gap:10px;margin-top:12px;display:flex}.ui-btn-row>.ui-btn{flex:1 1 0;min-width:12rem}.ui-btn-row--end{justify-content:flex-end}.ui-btn-row--end>.ui-btn{flex:none;min-width:0}.ui-icon-btn{border:.5px solid var(--ui-border-strong);background:var(--ui-surface);width:34px;height:34px;color:var(--ui-text);cursor:pointer;border-radius:9px;flex:none;justify-content:center;align-items:center;padding:0;transition:background .12s,border-color .12s,transform 60ms;display:inline-flex}.ui-icon-btn:hover{background:var(--ui-surface-2);border-color:var(--ui-accent)}.ui-icon-btn:active{transform:scale(.94)}.ui-icon-btn:focus-visible{box-shadow:0 0 0 3px var(--ui-focus);outline:none}.ui-icon-btn svg{width:18px;height:18px}.ui-link{color:var(--ui-accent);cursor:pointer;text-decoration:none}.ui-link:hover{color:var(--ui-accent-hover);text-decoration:underline}.ui-field{color:var(--ui-text-muted);flex-direction:column;gap:5px;font-size:12px;display:flex}.ui-field--check{min-height:38px;color:var(--ui-text);cursor:pointer;flex-direction:row;align-items:center;gap:8px;font-size:14px}.ui-checkbox{font:inherit;width:1em;height:1em;accent-color:var(--ui-accent);cursor:inherit;flex:none;margin:0;padding:0}.ui-input,input.ui-input{border:.5px solid var(--ui-border-strong);border-radius:var(--ui-r);background:var(--ui-surface);height:38px;color:var(--ui-text);font:inherit;outline:none;padding:0 12px;font-size:14px;transition:border-color .12s,box-shadow .12s}.ui-input{width:100%}.ui-input::placeholder{color:var(--ui-text-muted)}.ui-select{border:.5px solid var(--ui-border-strong);border-radius:var(--ui-r);background:var(--ui-surface);width:100%;height:38px;color:var(--ui-text);font:inherit;cursor:pointer;outline:none;padding:0 12px;font-size:14px;transition:border-color .12s,box-shadow .12s}.ui-select:focus,.ui-input:focus{border-color:var(--ui-accent);box-shadow:0 0 0 3px var(--ui-focus)}.ui-card{background:var(--ui-surface);border:.5px solid var(--ui-border);padding:var(--ui-card-padding-block,16px) var(--ui-card-padding-inline,18px);border-radius:12px;margin:0 0 14px}.ui-section{min-width:0;margin-block:0 16px}.ui-section-title{justify-content:space-between;align-items:center;gap:10px;margin:0 0 10px;font-size:14px;font-weight:500;display:flex}.ui-card-title{margin:0 0 10px;font-size:14px;font-weight:500}.ui-card-head{margin:calc(-1 * var(--ui-card-padding-block,16px)) calc(-1 * var(--ui-card-padding-inline,18px)) 14px;padding:9px var(--ui-card-padding-inline,18px);background:var(--ui-surface-2);border-bottom:.5px solid var(--ui-border);border-radius:12px 12px 0 0;justify-content:space-between;align-items:center;gap:10px;font-size:14px;font-weight:500;display:flex}.ui-card-head+.ui-detail-item,.ui-card-head+.ui-row{border-top:0}.ui-row{border-top:.5px solid var(--ui-border);grid-template-columns:minmax(140px,.34fr) minmax(0,1fr);gap:12px;padding:9px 0;font-size:14px;display:grid}.ui-row:first-child{border-top:0}.ui-row-label{color:var(--ui-text-muted)}.ui-row-value{color:var(--ui-text);overflow-wrap:anywhere;font-variant-numeric:tabular-nums;text-align:right}.ui-status-banner{border-radius:var(--ui-r);border:.5px solid var(--ui-border-strong);background:var(--ui-surface-2);color:var(--ui-text);align-items:center;gap:9px;padding:11px 0;font-size:14px;font-weight:500;display:flex}.ui-status-icon{flex:none;display:inline-flex}.ui-status-icon svg{width:18px;height:18px}.ui-status-banner--success{background:var(--ui-ok-bg);color:var(--ui-ok-text);border-color:#0000}.ui-status-banner--failure{background:var(--ui-danger-bg);color:var(--ui-danger);border-color:#0000}.ui-status-banner--pending{color:var(--ui-text-muted)}.ui-detail-item{border-top:.5px solid var(--ui-border);padding:9px 0}.ui-detail-head{flex-wrap:wrap;justify-content:space-between;align-items:baseline;gap:12px;display:flex}.ui-detail-title{color:var(--ui-text);overflow-wrap:anywhere;font-weight:500}.ui-detail-trailing{color:var(--ui-text);overflow-wrap:anywhere}.ui-detail-trailing--up{color:var(--ui-up)}.ui-detail-trailing--down{color:var(--ui-down)}.ui-detail-meta{color:var(--ui-text-muted);overflow-wrap:anywhere;gap:8px;margin-top:3px;font-size:12.5px;display:flex}.ui-detail-metalabel{color:var(--ui-text-muted);flex:none}.ui-feedback{border:.5px solid var(--ui-border);background:var(--ui-surface);color:var(--ui-text);border-left-width:3px;border-radius:8px;margin:0 0 14px;padding:11px 13px;font-size:13.5px}.ui-feedback--ok{border-left-color:var(--ui-ok-text)}.ui-feedback--error{border-left-color:var(--ui-danger)}.ui-card>.ui-feedback{margin:14px 0}.ui-card>.ui-feedback:last-child{margin-bottom:0}.ui-feedback-detail{color:var(--ui-text-muted);overflow-wrap:anywhere;margin-top:4px;font-size:12.5px;display:block}.ui-placeholder{border:.5px dashed var(--ui-border-strong);color:var(--ui-text-muted);text-align:center;border-radius:12px;margin:0 0 14px;padding:18px;font-size:13.5px}.ui-note{color:var(--ui-text-muted);margin:12px 0 0;font-size:12.5px;line-height:1.6}.ui-info{border:.5px solid var(--ui-border-strong);width:1.3em;height:1.3em;color:var(--ui-text-muted);cursor:help;vertical-align:middle;border-radius:50%;justify-content:center;align-items:center;margin-left:.3em;font-size:.72em;font-style:normal;font-weight:500;line-height:1;display:inline-flex}.ui-info:hover,.ui-info:focus-visible{border-color:var(--ui-accent);color:var(--ui-accent);outline:none}.ui-ptb-graph{min-height:60px;color:var(--ui-text-muted);font-size:13px;overflow-x:auto}.ui-ptb-graph svg{max-width:100%;height:auto}.ui-ptb-graph--error{color:var(--ui-danger)}.ui-chain-receipt-gas{margin-bottom:6px}.ui-chain-receipt-ptb{background:var(--ui-surface);min-width:0;overflow:hidden}.ui-ptb-actions{align-items:center;gap:4px;display:flex}.ui-ptb-graph-controls .ui-icon-btn{background:var(--ui-surface-2);box-shadow:0 1px 3px #0003}.ui-ptb-graph--interactive{cursor:grab;-webkit-user-select:none;user-select:none;touch-action:none;height:420px;position:relative;overflow:hidden}.ui-ptb-graph--grabbing{cursor:grabbing}.ui-ptb-graph-content{transform-origin:0 0;width:100%}.ui-ptb-graph-controls{z-index:2;flex-direction:column;gap:5px;display:flex;position:absolute;top:8px;right:8px}.ui-ptb-graph-controls .ui-icon-btn{width:28px;height:28px}.ui-ptb-graph-controls .ui-icon-btn svg{width:15px;height:15px}.ui-accordion{border-block-start:1px solid var(--ui-border);margin-block:12px}.ui-accordion-summary{cursor:pointer;color:var(--ui-text);justify-content:space-between;align-items:center;gap:10px;padding:11px 0;font-size:13px;font-weight:500;list-style:none;display:flex}.ui-accordion-summary::-webkit-details-marker{display:none}.ui-accordion-summary:hover{color:var(--ui-accent)}.ui-accordion-summary:focus-visible{box-shadow:0 0 0 3px var(--ui-focus);border-radius:var(--ui-r);outline:none}.ui-accordion-summary:after{content:"";border-right:1.5px solid var(--ui-text-muted);border-bottom:1.5px solid var(--ui-text-muted);flex:none;width:7px;height:7px;transition:transform .15s;transform:rotate(45deg)}.ui-accordion[open] .ui-accordion-summary:after{transform:rotate(-135deg)}.ui-accordion[open] .ui-accordion-summary{color:var(--ui-accent)}.ui-accordion-body{padding:4px 0 12px}.ui-accordion[open]>.ui-accordion-body{animation:.18s ease-out ui-reveal}@keyframes ui-reveal{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){.ui-accordion[open]>.ui-accordion-body{animation:none}}@container mcp-card (width<=28rem){.ui-card{--ui-card-padding-block:12px;--ui-card-padding-inline:12px}.ui-row{grid-template-columns:minmax(0,1fr);gap:4px}.ui-row-value{text-align:left}.ui-detail-meta{flex-wrap:wrap}}@container mcp-card (width>=0){.ui-card,.ui-card-head>:first-child,.ui-detail-head>*,.ui-detail-meta>*{min-width:0}.ui-ptb-actions{flex:none}.ui-ptb-graph--interactive{height:clamp(280px,75cqi,420px)}}.ui-error:not(:empty){color:var(--ui-danger)}.ui-note:empty,.ui-error:empty{display:none}.ui-form{flex-wrap:wrap;align-items:end;gap:12px;display:flex}.ui-form>*{min-width:0;max-width:100%}.ui-form>input,.ui-form>select,.ui-form>label{flex:14rem}.ui-form label{flex-direction:column;gap:6px;display:flex}.ui-form label>input,.ui-form label>select{width:100%}.ui-form>details,.ui-form>p,.ui-form>.card-actions{flex-basis:100%}@container mcp-card (width<=28rem){.ui-form>button{width:100%}}.settings-card{overflow-x:clip}.settings-card .settings-page--forward{animation:.18s ease-out settings-forward}.settings-card .settings-page--back{animation:.18s ease-out settings-back}@keyframes settings-forward{0%{opacity:0;transform:translate(16px)}to{opacity:1;transform:translate(0)}}@keyframes settings-back{0%{opacity:0;transform:translate(-16px)}to{opacity:1;transform:translate(0)}}@media (prefers-reduced-motion:reduce){.settings-card .settings-page--forward,.settings-card .settings-page--back{animation:none}}.settings-card .settings-toolbar{border-bottom:1px solid var(--ui-border);flex-wrap:wrap;align-items:center;gap:12px;margin-block-end:20px;padding-block:0 14px;display:flex}.settings-card .settings-location{color:var(--ui-text-muted);font-size:13px}.settings-card .settings-back{background:0 0;border-color:#0000;padding-inline:0 10px}.settings-card .settings-back:before{content:"←";margin-inline-end:8px}.settings-card .settings-menu{margin-block:16px;display:grid}.settings-card .settings-menu-item{text-align:start;white-space:normal;border:0;border-bottom:1px solid var(--ui-border);width:100%;color:var(--ui-text);background:0 0;border-radius:0;grid-template-columns:minmax(0,1fr);justify-content:stretch;justify-items:start;gap:5px;padding:18px 32px 18px 12px;display:grid;position:relative}.settings-card .settings-menu-item:hover{background:var(--ui-surface-2)}.settings-card .settings-menu-item:after{content:"";inset-inline-end:14px;border-top:1.5px solid var(--ui-text-muted);border-right:1.5px solid var(--ui-text-muted);width:7px;height:7px;position:absolute;top:50%;transform:translateY(-50%)rotate(45deg)}.settings-card .settings-menu-title{font-weight:600}.settings-card .settings-menu-description{color:var(--ui-text-muted);font-size:13px;font-weight:400}.settings-card .settings-pending{margin-block:20px}.settings-card .settings-action-row{align-items:stretch;gap:var(--ui-space-2,8px);grid-template-columns:minmax(0,1fr);margin-block-start:12px;display:grid}.settings-card .settings-action-row>.ui-btn{white-space:normal;overflow-wrap:anywhere;width:100%;min-width:0}.settings-card .settings-path{white-space:normal;overflow-wrap:anywhere}.settings-card .settings-backup-location .ui-row{grid-template-columns:minmax(0,1fr);gap:6px}.settings-card .settings-backup-location .ui-row-value{text-align:start}.settings-card .settings-choice{border-bottom:1px solid var(--ui-border);flex-wrap:wrap;align-items:center;gap:12px 20px;padding-block:18px;display:flex}.settings-card .settings-choice-copy{flex:16rem;min-width:0}.settings-card .settings-choice h3{margin-block:0 6px}.settings-card .settings-choice p{margin:0}.settings-card .settings-endpoint{border-bottom:1px solid var(--ui-border);padding-block:16px}.settings-card .settings-endpoint label{flex-direction:column;gap:8px;display:flex}html,body{min-height:0;margin:0}body{color:var(--ui-text);background:var(--ui-bg)}#app{padding:var(--ui-space-4,16px);overflow-wrap:anywhere;min-width:0;max-width:100%;container:mcp-card/inline-size}#app h1{margin:0 0 12px;font-size:20px;font-weight:500}.card-actions{margin-top:12px}.card-actions,.card-actions>div{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.card-chart{width:100%;min-width:0;height:clamp(280px,75cqi,400px)}.card-progress-hint{color:var(--ui-text-muted);align-items:center;gap:10px;margin-block:12px;font-size:12px;display:flex}
2
2
  /*$vite$:1*/</style></head><body><main id="app" aria-live="polite"></main><template id="dependency-notices">@modelcontextprotocol/client 2.3.1
3
3
  The MCP project is undergoing a licensing transition from the MIT License to the Apache License, Version 2.0 ("Apache-2.0"). All new code and specification contributions to the project are licensed under Apache-2.0. Documentation contributions (excluding specifications) are licensed under CC-BY-4.0.
4
4
 
@@ -1440,9 +1440,9 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1440
1440
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1441
1441
  SOFTWARE.
1442
1442
 
1443
- </template><script type="module">var e=Object.defineProperty,t=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),n=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n&&e(r,Symbol.toStringTag,{value:`Module`}),r},r=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]);function i(e){return typeof e==`string`&&r.has(e.replace(/#$/,``))}function a(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function o(e,t=`|`){return e.map(e=>ce(e)).join(t)}function s(e,t){return typeof t==`bigint`?t.toString():t}var c=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function l(e){return new c(e)}function u(e){return e==null}function d(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function f(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var p=Symbol(`evaluating`);function m(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==p)return r===void 0&&(r=p,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function h(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function g(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function _(e){return g(e._zod.def)??e._zod.def.shape}function v(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return h(this,t,e),e},enumerable:!0,configurable:!0})}function y(e,t,n){t in e?h(e,t,n):e[t]=n}function b(e,t,n,r){let i=_(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?v(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):y(e,a,r?r(n.value,a):n.value))}}function ee(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?v(e,n,()=>t[n]):y(e,n,r.value))}}function x(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function te(e){return JSON.stringify(e)}function ne(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var re=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ie(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var S=l(()=>{if(qe.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ae(e){if(ie(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return ie(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function oe(e){return ae(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var se=new Set([`string`,`number`,`symbol`]);function C(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function w(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function T(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function ce(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function E(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var le={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},D={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function ue(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return b(i,e,de(e,t)),w(e,x(n,{shape:i,checks:[]}))}function de(e,t){let n=_(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function fe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(de(e,t)),a={};return b(a,e,Reflect.ownKeys(_(e)).filter(e=>!i.has(e))),w(e,x(n,{shape:a,checks:[]}))}function pe(e,t){if(!ae(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=_(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return w(e,x(e._zod.def,{shape:O(e,t)}))}function O(e,t){let n={};return b(n,e,Reflect.ownKeys(_(e))),ee(n,t),n}function me(e,t){if(!ae(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return w(e,x(e._zod.def,{shape:O(e,t)}))}function he(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return b(n,e,Reflect.ownKeys(_(e))),b(n,t,Reflect.ownKeys(_(t))),w(e,x(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function ge(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(de(t,n)):void 0,o={};return b(o,t,Reflect.ownKeys(_(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),w(t,x(t._zod.def,{shape:o,checks:[]}))}function _e(e,t,n){let r=n?new Set(de(t,n)):void 0,i={};return b(i,t,Reflect.ownKeys(_(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),w(t,x(t._zod.def,{shape:i}))}function ve(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ye(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function be(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function xe(e){return typeof e==`string`?e:e?.message}function Se(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Ce(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:xe(e.inst?._zod.def?.error?.(e))??xe(a?.(e))??xe(t?.error?.(e))??xe(n.customError?.(e))??xe(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var we=/[\uD800-\uDBFF]/;function Te(e){let t=e.length;if(!we.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Ee(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function De(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Oe(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function ke(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Ne(e,n,r.value)}}function Ae(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function je(e,t,n){return Ae(e,t,n,!1)}function Me(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Ae(this,n,r(this))},set(e){Ae(this,n,e)}})}return t}function Ne(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Ae(this,t,n.bind(this))},set(e){Ae(this,t,e)}})}function Pe(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Fe,Ie=!1,Le={configurable:!0,get(){Ie=!0}};function k(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&Fe!==e._zod?Fe=void 0:(Fe=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Le);let e=Ie;Ie=!1;try{let r=n(this);return Ie?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Ie||=e,r}catch(n){throw delete this[t],Ie||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function A(e,t,n,r){let i=Pe(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Re=`~constantCatch`;function ze(e){let t=()=>e;return t[Re]=!0,t}var Be,Ve=Object.freeze({status:`aborted`}),He={value:void 0,enumerable:!1},Ue=`captureStackTrace`in Error?Error:null;function We(e){let t=Ue;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Ue=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function j(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){He.value=new a(r);try{Object.defineProperty(n,"_zod",He)}finally{He.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),ke(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?We(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Ge=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Ke=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Be=globalThis).__zod_globalConfig??(Be.__zod_globalConfig={});var qe=globalThis.__zod_globalConfig;function Je(e){return e&&Object.assign(qe,e),qe}function Ye(){let e=this._zod;return e.message??=JSON.stringify(e.def,s,2),e.message}function Xe(e){this._zod.message=e}var Ze={get:Ye,set:Xe,enumerable:!0,configurable:!0},Qe={value:void 0,enumerable:!1},$e=new WeakSet([Object.prototype,Error.prototype]),et=(e,t)=>{e.name=`$ZodError`,Qe.value=t,Object.defineProperty(e,"issues",Qe),Qe.value=void 0,Object.defineProperty(e,"message",Ze);let n=Object.getPrototypeOf(e);$e.has(n)||($e.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},tt=j(`$ZodError`,et);j(`$ZodError`,et,void 0,{Parent:Error});function nt(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function rt(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?nt(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function it(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function at(e,t){return{callee:t?.callee??e,Err:t?.Err}}var ot=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Ge;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Ce(e,o,Je())));throw re(n,a?.callee??t),n}return s.value};return t},st=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Ce(e,o,Je())));throw re(n,a?.callee??t),n}return s.value};return t},ct=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Ge;return a.issues.length?lt(e,a.issues,i):{success:!0,data:a.value}};function lt(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Ce(e,n,Je()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var ut=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?lt(e,a.issues,i):{success:!0,data:a.value}},dt=Symbol.for(`zod.compile.invalid`),ft=Symbol.for(`zod.compile.fallback`),pt=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==dt)return!0;if(r.definite===!0&&n===void 0)return!1}return mt(e,t,n)});function mt(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[ft]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new Ge;return a.issues.length===0}var ht=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},gt=e=>{let t=ot(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,at(n,a))};return n},_t=e=>{let t=ot(e),n=(e,r,i,a)=>t(e,r,i,at(n,a));return n},vt=e=>{let t=st(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,at(n,a))};return n},yt=e=>{let t=st(e),n=async(e,r,i,a)=>await t(e,r,i,at(n,a));return n},bt=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ct(e)(t,n,i)},xt=e=>(t,n,r)=>ct(e)(t,n,r),St=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ut(e)(t,n,i)},Ct=e=>async(t,n,r)=>ut(e)(t,n,r),wt=/^[cC][0-9a-z]{6,}$/,Tt=/^[0-9a-z]+$/,Et=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Dt=/^[0-9a-vA-V]{20}$/,Ot=/^[A-Za-z0-9]{27}$/,kt=/^[a-zA-Z0-9_-]{21}$/;function At(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var jt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Mt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Nt=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Pt=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ft=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function It(){return new RegExp(Ft,`u`)}var Lt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Rt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,zt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Bt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Vt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ht=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Ut=/^https?$/,Wt=/^\+[1-9]\d{6,14}$/,Gt=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Kt(e){return RegExp(`^${e}$`)}var qt=Kt(Gt);function Jt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Yt(e){return RegExp(`^${Jt(e)}$`)}function Xt(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Jt({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Jt({precision:e.precision})}`:n;return RegExp(`^${Gt}T(?:${r})$`)}var Zt=/^[\s\S]{0,}$/,Qt=/^-?\d+$/,$t=/^-?\d+(?:\.\d+)?$/,en=/^(?:true|false)$/i,tn=/^null$/i,nn=/^undefined$/i,rn=/^[^A-Z]*$/,an=/^[^a-z]*$/,on=j(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),sn=e=>{let t=e.value;return!u(t)&&t.length!==void 0},cn={number:`number`,bigint:`bigint`,object:`date`},ln=j(`$ZodCheckLessThan`,(e,t)=>{on.init(e,t);let n=cn[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:cn[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),un=j(`$ZodCheckGreaterThan`,(e,t)=>{on.init(e,t);let n=cn[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:cn[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),dn=j(`$ZodCheckMultipleOf`,(e,t)=>{on.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):f(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),fn=j(`$ZodCheckNumberFormat`,(e,t)=>{on.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=le[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),pn=j(`$ZodCheckMaxLength`,(e,t)=>{var n;on.init(e,t),(n=e._zod.def).when??(n.when=sn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Te(r):i)<=t.maximum)return;let a=Ee(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),mn=j(`$ZodCheckMinLength`,(e,t)=>{var n;on.init(e,t),(n=e._zod.def).when??(n.when=sn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Te(r):i)>=t.minimum)return;let a=Ee(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),hn=j(`$ZodCheckLengthEquals`,(e,t)=>{var n;on.init(e,t),(n=e._zod.def).when??(n.when=sn),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Te(r):i;if(a===t.length)return;let o=Ee(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),gn=j(`$ZodCheckStringFormat`,(e,t)=>{var n,r;on.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),_n=j(`$ZodCheckRegex`,(e,t)=>{gn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),vn=j(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=rn,gn.init(e,t)}),yn=j(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=an,gn.init(e,t)}),bn=j(`$ZodCheckIncludes`,(e,t)=>{on.init(e,t);let n=C(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),xn=j(`$ZodCheckStartsWith`,(e,t)=>{on.init(e,t);let n=RegExp(`^${C(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Sn=j(`$ZodCheckEndsWith`,(e,t)=>{on.init(e,t);let n=RegExp(`.*${C(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Cn=j(`$ZodCheckOverwrite`,(e,t)=>{on.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),wn=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
1443
+ </template><script type="module">var e=Object.defineProperty,t=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),n=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n&&e(r,Symbol.toStringTag,{value:`Module`}),r},r=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]);function i(e){return typeof e==`string`&&r.has(e.replace(/#$/,``))}function a(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function o(e,t=`|`){return e.map(e=>ce(e)).join(t)}function s(e,t){return typeof t==`bigint`?t.toString():t}var c=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function l(e){return new c(e)}function u(e){return e==null}function d(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function f(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var p=Symbol(`evaluating`);function m(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==p)return r===void 0&&(r=p,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function h(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function g(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function _(e){return g(e._zod.def)??e._zod.def.shape}function v(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return h(this,t,e),e},enumerable:!0,configurable:!0})}function y(e,t,n){t in e?h(e,t,n):e[t]=n}function b(e,t,n,r){let i=_(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?v(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):y(e,a,r?r(n.value,a):n.value))}}function ee(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?v(e,n,()=>t[n]):y(e,n,r.value))}}function x(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function te(e){return JSON.stringify(e)}function ne(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var re=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ie(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var S=l(()=>{if(Ke.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ae(e){if(ie(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return ie(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function oe(e){return ae(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var se=new Set([`string`,`number`,`symbol`]);function C(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function w(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function T(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function ce(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function E(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var D={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},O={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function le(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return b(i,e,ue(e,t)),w(e,x(n,{shape:i,checks:[]}))}function ue(e,t){let n=_(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function de(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(ue(e,t)),a={};return b(a,e,Reflect.ownKeys(_(e)).filter(e=>!i.has(e))),w(e,x(n,{shape:a,checks:[]}))}function fe(e,t){if(!ae(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=_(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return w(e,x(e._zod.def,{shape:k(e,t)}))}function k(e,t){let n={};return b(n,e,Reflect.ownKeys(_(e))),ee(n,t),n}function pe(e,t){if(!ae(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return w(e,x(e._zod.def,{shape:k(e,t)}))}function me(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return b(n,e,Reflect.ownKeys(_(e))),b(n,t,Reflect.ownKeys(_(t))),w(e,x(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function he(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(ue(t,n)):void 0,o={};return b(o,t,Reflect.ownKeys(_(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),w(t,x(t._zod.def,{shape:o,checks:[]}))}function ge(e,t,n){let r=n?new Set(ue(t,n)):void 0,i={};return b(i,t,Reflect.ownKeys(_(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),w(t,x(t._zod.def,{shape:i}))}function _e(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ve(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function ye(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function be(e){return typeof e==`string`?e:e?.message}function xe(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Se(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:be(e.inst?._zod.def?.error?.(e))??be(a?.(e))??be(t?.error?.(e))??be(n.customError?.(e))??be(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var Ce=/[\uD800-\uDBFF]/;function we(e){let t=e.length;if(!Ce.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Te(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ee(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function De(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Oe(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Me(e,n,r.value)}}function ke(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Ae(e,t,n){return ke(e,t,n,!1)}function je(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return ke(this,n,r(this))},set(e){ke(this,n,e)}})}return t}function Me(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:ke(this,t,n.bind(this))},set(e){ke(this,t,e)}})}function Ne(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Pe,Fe=!1,Ie={configurable:!0,get(){Fe=!0}};function A(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&Pe!==e._zod?Pe=void 0:(Pe=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Ie);let e=Fe;Fe=!1;try{let r=n(this);return Fe?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Fe||=e,r}catch(n){throw delete this[t],Fe||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function j(e,t,n,r){let i=Ne(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Le=`~constantCatch`;function Re(e){let t=()=>e;return t[Le]=!0,t}var ze,Be=Object.freeze({status:`aborted`}),Ve={value:void 0,enumerable:!1},He=`captureStackTrace`in Error?Error:null;function Ue(e){let t=He;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return He=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function M(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Ve.value=new a(r);try{Object.defineProperty(n,"_zod",Ve)}finally{Ve.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Oe(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Ue(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var We=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Ge=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ze=globalThis).__zod_globalConfig??(ze.__zod_globalConfig={});var Ke=globalThis.__zod_globalConfig;function qe(e){return e&&Object.assign(Ke,e),Ke}function Je(){let e=this._zod;return e.message??=JSON.stringify(e.def,s,2),e.message}function Ye(e){this._zod.message=e}var Xe={get:Je,set:Ye,enumerable:!0,configurable:!0},Ze={value:void 0,enumerable:!1},Qe=new WeakSet([Object.prototype,Error.prototype]),$e=(e,t)=>{e.name=`$ZodError`,Ze.value=t,Object.defineProperty(e,"issues",Ze),Ze.value=void 0,Object.defineProperty(e,"message",Xe);let n=Object.getPrototypeOf(e);Qe.has(n)||(Qe.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},et=M(`$ZodError`,$e);M(`$ZodError`,$e,void 0,{Parent:Error});function tt(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function nt(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?tt(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function rt(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function it(e,t){return{callee:t?.callee??e,Err:t?.Err}}var at=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new We;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Se(e,o,qe())));throw re(n,a?.callee??t),n}return s.value};return t},ot=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Se(e,o,qe())));throw re(n,a?.callee??t),n}return s.value};return t},st=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new We;return a.issues.length?ct(e,a.issues,i):{success:!0,data:a.value}};function ct(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Se(e,n,qe()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var lt=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?ct(e,a.issues,i):{success:!0,data:a.value}},ut=Symbol.for(`zod.compile.invalid`),dt=Symbol.for(`zod.compile.fallback`),ft=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==ut)return!0;if(r.definite===!0&&n===void 0)return!1}return pt(e,t,n)});function pt(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[dt]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new We;return a.issues.length===0}var mt=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},ht=e=>{let t=at(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,it(n,a))};return n},gt=e=>{let t=at(e),n=(e,r,i,a)=>t(e,r,i,it(n,a));return n},_t=e=>{let t=ot(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,it(n,a))};return n},vt=e=>{let t=ot(e),n=async(e,r,i,a)=>await t(e,r,i,it(n,a));return n},yt=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return st(e)(t,n,i)},bt=e=>(t,n,r)=>st(e)(t,n,r),xt=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return lt(e)(t,n,i)},St=e=>async(t,n,r)=>lt(e)(t,n,r),Ct=/^[cC][0-9a-z]{6,}$/,wt=/^[0-9a-z]+$/,Tt=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Et=/^[0-9a-vA-V]{20}$/,Dt=/^[A-Za-z0-9]{27}$/,Ot=/^[a-zA-Z0-9_-]{21}$/;function kt(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var At=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,jt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Mt=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Nt=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Pt=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Ft(){return new RegExp(Pt,`u`)}var It=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Lt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Rt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,zt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Bt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Vt=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Ht=/^https?$/,Ut=/^\+[1-9]\d{6,14}$/,Wt=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Gt(e){return RegExp(`^${e}$`)}var Kt=Gt(Wt);function qt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Jt(e){return RegExp(`^${qt(e)}$`)}function Yt(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${qt({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${qt({precision:e.precision})}`:n;return RegExp(`^${Wt}T(?:${r})$`)}var Xt=/^[\s\S]{0,}$/,Zt=/^-?\d+$/,Qt=/^-?\d+(?:\.\d+)?$/,$t=/^(?:true|false)$/i,en=/^null$/i,tn=/^undefined$/i,nn=/^[^A-Z]*$/,rn=/^[^a-z]*$/,an=M(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),on=e=>{let t=e.value;return!u(t)&&t.length!==void 0},sn={number:`number`,bigint:`bigint`,object:`date`},cn=M(`$ZodCheckLessThan`,(e,t)=>{an.init(e,t);let n=sn[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:sn[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ln=M(`$ZodCheckGreaterThan`,(e,t)=>{an.init(e,t);let n=sn[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:sn[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),un=M(`$ZodCheckMultipleOf`,(e,t)=>{an.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):f(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),dn=M(`$ZodCheckNumberFormat`,(e,t)=>{an.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=D[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),fn=M(`$ZodCheckMaxLength`,(e,t)=>{var n;an.init(e,t),(n=e._zod.def).when??(n.when=on),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?we(r):i)<=t.maximum)return;let a=Te(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),pn=M(`$ZodCheckMinLength`,(e,t)=>{var n;an.init(e,t),(n=e._zod.def).when??(n.when=on),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?we(r):i)>=t.minimum)return;let a=Te(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),mn=M(`$ZodCheckLengthEquals`,(e,t)=>{var n;an.init(e,t),(n=e._zod.def).when??(n.when=on),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?we(r):i;if(a===t.length)return;let o=Te(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),hn=M(`$ZodCheckStringFormat`,(e,t)=>{var n,r;an.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),gn=M(`$ZodCheckRegex`,(e,t)=>{hn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),_n=M(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=nn,hn.init(e,t)}),vn=M(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=rn,hn.init(e,t)}),yn=M(`$ZodCheckIncludes`,(e,t)=>{an.init(e,t);let n=C(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),bn=M(`$ZodCheckStartsWith`,(e,t)=>{an.init(e,t);let n=RegExp(`^${C(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),xn=M(`$ZodCheckEndsWith`,(e,t)=>{an.init(e,t);let n=RegExp(`.*${C(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Sn=M(`$ZodCheckOverwrite`,(e,t)=>{an.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Cn=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
1444
1444
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
1445
- `)}\n};`)(...Object.values(this.closed))}},Tn={major:4,minor:6,patch:5},M=j(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Tn;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=ve(t),a;for(let o of n){if(o._zod.def.when){if(ye(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new Ge;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Se(t.issues,n,e),i||=ve(t,n))});else{if(t.issues.length===n)continue;Se(t.issues,n,e),i||=ve(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(ve(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Ge;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new Ge;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return je(this,`~standard`,On(this))},set"~standard"(e){Ae(this,`~standard`,e)}}),En=(e,t)=>e.issues.length?{issues:e.issues.map(e=>Ce(e,t,Je()))}:{value:e.value};async function Dn(e,t){let n={async:!0};return En(await e._zod.run({value:t,issues:[]},n),n)}function On(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return En(r,n)}catch{}return Dn(e,t)},vendor:`zod`,version:1}}var kn=j(`$ZodString`,(e,t)=>{M.init(e,t),e._zod.pattern=t.pattern??Zt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),An=j(`$ZodStringFormat`,(e,t)=>{gn.init(e,t),kn.init(e,t)}),jn=j(`$ZodGUID`,(e,t)=>{t.pattern??=Mt,An.init(e,t)}),Mn=j(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Nt(e)}else t.pattern??=Nt();An.init(e,t)}),Nn=j(`$ZodEmail`,(e,t)=>{t.pattern??=Pt,An.init(e,t)});function Pn(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Fn(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Pn(e)||2:In(e,t)}function In(e,t){if(!t.normalize&&t.protocol?.source===Ut.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var Ln=/[\t\n\r]/g;function Rn(e){return e.replace(Ln,``)}function zn(e,t){return t.lastIndex=0,t.test(e.hostname)}function Bn(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var Vn=j(`$ZodURL`,(e,t)=>{An.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Fn(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Rn(r);return}t.hostname&&!zn(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Bn(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Rn(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Hn=j(`$ZodEmoji`,(e,t)=>{t.pattern??=It(),An.init(e,t)}),Un=j(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?kt:At(t.length),An.init(e,t)}),Wn=j(`$ZodCUID`,(e,t)=>{t.pattern??=wt,An.init(e,t)}),Gn=j(`$ZodCUID2`,(e,t)=>{t.pattern??=Tt,An.init(e,t)}),Kn=j(`$ZodULID`,(e,t)=>{t.pattern??=Et,An.init(e,t)}),qn=j(`$ZodXID`,(e,t)=>{t.pattern??=Dt,An.init(e,t)}),Jn=j(`$ZodKSUID`,(e,t)=>{t.pattern??=Ot,An.init(e,t)}),Yn=j(`$ZodISODateTime`,(e,t)=>{t.pattern??=Xt(t),An.init(e,t)}),Xn=j(`$ZodISODate`,(e,t)=>{t.pattern??=qt,An.init(e,t)}),Zn=j(`$ZodISOTime`,(e,t)=>{t.pattern??=Yt(t),An.init(e,t)}),Qn=j(`$ZodISODuration`,(e,t)=>{t.pattern??=jt,An.init(e,t)}),$n=j(`$ZodIPv4`,(e,t)=>{t.pattern??=Lt,An.init(e,t)}),er=/^[0-9a-fA-F:.]+$/;function tr(e){return er.test(e)?Pn(`http://[${e}]`):!1}var nr=j(`$ZodIPv6`,(e,t)=>{t.pattern??=Rt,An.init(e,t),e._zod.check=n=>{tr(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),rr=j(`$ZodCIDRv4`,(e,t)=>{t.pattern??=zt,An.init(e,t)});function ir(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:tr(n)}var ar=j(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Bt,An.init(e,t),e._zod.check=n=>{ir(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function or(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var sr=/^[0-9a-zA-Z+/]*={0,2}$/,cr=j(`$ZodBase64`,(e,t)=>{t.pattern??=sr,An.init(e,t),e._zod.check=n=>{or(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),lr=/^[A-Za-z0-9_-]*$/;function ur(e){if(!lr.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return or(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var dr=j(`$ZodBase64URL`,(e,t)=>{t.pattern??=lr,An.init(e,t),e._zod.check=n=>{ur(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),fr=j(`$ZodE164`,(e,t)=>{t.pattern??=Wt,An.init(e,t)});function pr(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var mr=j(`$ZodJWT`,(e,t)=>{An.init(e,t),e._zod.check=n=>{pr(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),hr=j(`$ZodNumber`,(e,t)=>{M.init(e,t),e._zod.pattern=$t,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),gr=j(`$ZodNumberFormat`,(e,t)=>{fn.init(e,t),hr.init(e,t)}),_r=j(`$ZodBoolean`,(e,t)=>{M.init(e,t),e._zod.pattern=en,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),vr=j(`$ZodUndefined`,(e,t)=>{M.init(e,t),e._zod.pattern=nn,e._zod.values=new Set([void 0]),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`undefined`,code:`invalid_type`,input:r,inst:e}),t}}),yr=j(`$ZodNull`,(e,t)=>{M.init(e,t),e._zod.pattern=tn,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),br=j(`$ZodAny`,(e,t)=>{M.init(e,t),e._zod.parse=e=>e}),xr=j(`$ZodUnknown`,(e,t)=>{M.init(e,t),e._zod.parse=e=>e}),Sr=j(`$ZodNever`,(e,t)=>{M.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Cr(e,t,n){e.issues.length&&t.issues.push(...be(n,e.issues)),t.value[n]=e.value}var wr=j(`$ZodArray`,(e,t)=>{M.init(e,t);let n=qe.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>Cr(t,r,e)));else if(Cr(c,r,e),s&&c.issues.length!==0&&ve(c))break}return o.length?Promise.all(o).then(()=>r):r}});function Tr(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...be(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var Er=[];function Dr(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Er,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=E(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Or(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(ve(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Tr(e,n,i,t,d,f))):Tr(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var kr=j(`$ZodObject`,(e,t)=>{M.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=l(()=>Dr(t));k(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||h(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=ie,o=t.catchall,s,c=qe.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(ve(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Tr(n,t,e,r,a,o))):Tr(s,t,e,r,a,o)}return o?Or(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Ar=j(`$ZodObjectJIT`,(e,t)=>{kr.init(e,t);let n=e._zod.parse,r=l(()=>Dr(t)),i=qe.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new wn([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
1445
+ `)}\n};`)(...Object.values(this.closed))}},wn={major:4,minor:6,patch:5},N=M(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=wn;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=_e(t),a;for(let o of n){if(o._zod.def.when){if(ve(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new We;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(xe(t.issues,n,e),i||=_e(t,n))});else{if(t.issues.length===n)continue;xe(t.issues,n,e),i||=_e(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(_e(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new We;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new We;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Ae(this,`~standard`,Dn(this))},set"~standard"(e){ke(this,`~standard`,e)}}),Tn=(e,t)=>e.issues.length?{issues:e.issues.map(e=>Se(e,t,qe()))}:{value:e.value};async function En(e,t){let n={async:!0};return Tn(await e._zod.run({value:t,issues:[]},n),n)}function Dn(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Tn(r,n)}catch{}return En(e,t)},vendor:`zod`,version:1}}var On=M(`$ZodString`,(e,t)=>{N.init(e,t),e._zod.pattern=t.pattern??Xt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),kn=M(`$ZodStringFormat`,(e,t)=>{hn.init(e,t),On.init(e,t)}),An=M(`$ZodGUID`,(e,t)=>{t.pattern??=jt,kn.init(e,t)}),jn=M(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Mt(e)}else t.pattern??=Mt();kn.init(e,t)}),Mn=M(`$ZodEmail`,(e,t)=>{t.pattern??=Nt,kn.init(e,t)});function Nn(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Pn(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Nn(e)||2:Fn(e,t)}function Fn(e,t){if(!t.normalize&&t.protocol?.source===Ht.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var In=/[\t\n\r]/g;function Ln(e){return e.replace(In,``)}function Rn(e,t){return t.lastIndex=0,t.test(e.hostname)}function zn(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var Bn=M(`$ZodURL`,(e,t)=>{kn.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Pn(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Ln(r);return}t.hostname&&!Rn(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!zn(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Ln(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Vn=M(`$ZodEmoji`,(e,t)=>{t.pattern??=Ft(),kn.init(e,t)}),Hn=M(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Ot:kt(t.length),kn.init(e,t)}),Un=M(`$ZodCUID`,(e,t)=>{t.pattern??=Ct,kn.init(e,t)}),Wn=M(`$ZodCUID2`,(e,t)=>{t.pattern??=wt,kn.init(e,t)}),Gn=M(`$ZodULID`,(e,t)=>{t.pattern??=Tt,kn.init(e,t)}),Kn=M(`$ZodXID`,(e,t)=>{t.pattern??=Et,kn.init(e,t)}),qn=M(`$ZodKSUID`,(e,t)=>{t.pattern??=Dt,kn.init(e,t)}),Jn=M(`$ZodISODateTime`,(e,t)=>{t.pattern??=Yt(t),kn.init(e,t)}),Yn=M(`$ZodISODate`,(e,t)=>{t.pattern??=Kt,kn.init(e,t)}),Xn=M(`$ZodISOTime`,(e,t)=>{t.pattern??=Jt(t),kn.init(e,t)}),Zn=M(`$ZodISODuration`,(e,t)=>{t.pattern??=At,kn.init(e,t)}),Qn=M(`$ZodIPv4`,(e,t)=>{t.pattern??=It,kn.init(e,t)}),$n=/^[0-9a-fA-F:.]+$/;function er(e){return $n.test(e)?Nn(`http://[${e}]`):!1}var tr=M(`$ZodIPv6`,(e,t)=>{t.pattern??=Lt,kn.init(e,t),e._zod.check=n=>{er(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),nr=M(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Rt,kn.init(e,t)});function rr(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:er(n)}var ir=M(`$ZodCIDRv6`,(e,t)=>{t.pattern??=zt,kn.init(e,t),e._zod.check=n=>{rr(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function ar(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var or=/^[0-9a-zA-Z+/]*={0,2}$/,sr=M(`$ZodBase64`,(e,t)=>{t.pattern??=or,kn.init(e,t),e._zod.check=n=>{ar(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),cr=/^[A-Za-z0-9_-]*$/;function lr(e){if(!cr.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return ar(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var ur=M(`$ZodBase64URL`,(e,t)=>{t.pattern??=cr,kn.init(e,t),e._zod.check=n=>{lr(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),dr=M(`$ZodE164`,(e,t)=>{t.pattern??=Ut,kn.init(e,t)});function fr(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var pr=M(`$ZodJWT`,(e,t)=>{kn.init(e,t),e._zod.check=n=>{fr(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),mr=M(`$ZodNumber`,(e,t)=>{N.init(e,t),e._zod.pattern=Qt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),hr=M(`$ZodNumberFormat`,(e,t)=>{dn.init(e,t),mr.init(e,t)}),gr=M(`$ZodBoolean`,(e,t)=>{N.init(e,t),e._zod.pattern=$t,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),_r=M(`$ZodUndefined`,(e,t)=>{N.init(e,t),e._zod.pattern=tn,e._zod.values=new Set([void 0]),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`undefined`,code:`invalid_type`,input:r,inst:e}),t}}),vr=M(`$ZodNull`,(e,t)=>{N.init(e,t),e._zod.pattern=en,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),yr=M(`$ZodAny`,(e,t)=>{N.init(e,t),e._zod.parse=e=>e}),br=M(`$ZodUnknown`,(e,t)=>{N.init(e,t),e._zod.parse=e=>e}),xr=M(`$ZodNever`,(e,t)=>{N.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Sr(e,t,n){e.issues.length&&t.issues.push(...ye(n,e.issues)),t.value[n]=e.value}var Cr=M(`$ZodArray`,(e,t)=>{N.init(e,t);let n=Ke.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>Sr(t,r,e)));else if(Sr(c,r,e),s&&c.issues.length!==0&&_e(c))break}return o.length?Promise.all(o).then(()=>r):r}});function wr(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...ye(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var Tr=[];function Er(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Tr,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=E(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Dr(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(_e(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>wr(e,n,i,t,d,f))):wr(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Or=M(`$ZodObject`,(e,t)=>{N.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=l(()=>Er(t));A(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||h(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=ie,o=t.catchall,s,c=Ke.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(_e(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>wr(n,t,e,r,a,o))):wr(s,t,e,r,a,o)}return o?Dr(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),kr=M(`$ZodObjectJIT`,(e,t)=>{Or.init(e,t);let n=e._zod.parse,r=l(()=>Er(t)),i=Ke.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Cn([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
1446
1446
  let ${e}_ab = false;
1447
1447
  for (let i = 0; i < ${e}.issues.length; i++) {
1448
1448
  const iss = ${e}.issues[i];
@@ -1492,9 +1492,9 @@ SOFTWARE.
1492
1492
  newResult[${r}] = ${n}.value;
1493
1493
  }
1494
1494
 
1495
- `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=ie,c=!qe.jitless,u=c&&S.value,d=t.catchall,f;e._zod.parse=(i,l)=>{f??=r.value;let p=i.value;return s(p)?c&&u&&l?.async===!1&&l.jitless!==!0?(o||=a(t.shape),i=o(i,l),d?Or([],p,i,l,f,e,l?.abortEarly===!0):i):n(i,l):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function jr(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!ve(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Ce(e,r,Je())))}),t)}var Mr=j(`$ZodUnion`,(e,t)=>{M.init(e,t),k(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),k(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),k(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),k(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>d(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>jr(t,r,e,i)):jr(o,r,e,i)}});function Nr(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var Pr=j(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Mr.init(e,t);let n=e._zod.parse;k(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||h(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=g(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=l(()=>Nr(t));e._zod.parse=(i,a)=>{let o=i.value;if(!ie(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),Fr=j(`$ZodIntersection`,(e,t)=>{M.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Lr(e,t,n)):Lr(e,i,a)}});function Ir(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ae(e)&&ae(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Ir(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Ir(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Lr(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Ir(t.value,n.value);if(!c.valid){if(ve(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Rr=j(`$ZodRecord`,(e,t)=>{M.init(e,t);let n=qe.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!ae(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Ce(e,i,Je())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...be(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...be(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&$t.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>Ce(e,i,Je())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...be(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...be(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),zr=j(`$ZodEnum`,(e,t)=>{M.init(e,t);let n=a(t.entries),r=new Set(n);e._zod.values=r,k(e,`pattern`,e=>{let t=a(e.def.entries).filter(e=>se.has(typeof e));return RegExp(t.length?`^(${t.map(e=>C(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Br=j(`$ZodLiteral`,(e,t)=>{M.init(e,t);let n=new Set(t.values);e._zod.values=n,k(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?C(e):e?C(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Vr=j(`$ZodTransform`,(e,t)=>{M.init(e,t),e._zod.optin=`optional`,qe.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ke(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Ge;return n.value=i,n}});function Hr(e,t){return e.value=t.issues.length?void 0:t.value,e}var Ur=j(`$ZodOptional`,(e,t)=>{M.init(e,t),k(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,k(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),k(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${d(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Hr(e,t)):Hr(e,r)}return t.innerType._zod.run(e,n)}}),Wr=j(`$ZodExactOptional`,(e,t)=>{Ur.init(e,t),k(e,`values`,e=>e.def.innerType._zod.values),k(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Gr=j(`$ZodNullable`,(e,t)=>{M.init(e,t),k(e,`optin`,e=>e.def.innerType._zod.optin),k(e,`optout`,e=>e.def.innerType._zod.optout),k(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${d(t.source)}|null)$`):void 0}),k(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Kr=j(`$ZodDefault`,(e,t)=>{M.init(e,t),e._zod.optin=`defaulted`,k(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>qr(e,t)):qr(r,t)}});function qr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Jr=j(`$ZodPrefault`,(e,t)=>{M.init(e,t),e._zod.optin=`defaulted`,k(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Yr=j(`$ZodNonOptional`,(e,t)=>{M.init(e,t),k(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Xr(t,e)):Xr(i,e)}});function Xr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Zr(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Ce(e,r,Je()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Qr=j(`$ZodCatch`,(e,t)=>{M.init(e,t),k(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),k(e,`optout`,e=>e.def.innerType._zod.optout),k(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Zr(e,r,t,n)):Zr(e,r,t,n)}}),$r=j(`$ZodPipe`,(e,t)=>{M.init(e,t),k(e,`values`,e=>e.def.in._zod.values),k(e,`optin`,e=>e.def.in._zod.optin),k(e,`optout`,e=>e.def.out._zod.optout),k(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>ei(e,t.in,n)):ei(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>ei(e,t.out,n)):ei(r,t.out,n)}});function ei(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var ti=j(`$ZodPreprocess`,(e,t)=>{$r.init(e,t)}),ni=j(`$ZodReadonly`,(e,t)=>{M.init(e,t),k(e,`propValues`,e=>e.def.innerType._zod.propValues),k(e,`values`,e=>e.def.innerType._zod.values),k(e,`optin`,e=>e.def.innerType?._zod?.optin),k(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(ri):ri(r)}});function ri(e){return e.memo||(e.value=Object.freeze(e.value)),e}var ii=j(`$ZodLazy`,(e,t)=>{M.init(e,t),m(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),k(e,`pattern`,e=>e.innerType?._zod?.pattern),k(e,`propValues`,e=>e.innerType?._zod?.propValues),k(e,`optin`,e=>e.innerType?._zod?.optin??void 0),k(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),ai=j(`$ZodCustom`,(e,t)=>{on.init(e,t),M.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>oi(t,n,r,e));oi(i,n,r,e)}});function oi(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Oe(e))}}var si=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},ci=`~memo`,li=[];function ui(e){return typeof e==`object`&&!!e}function di(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var fi=new WeakMap,pi=0,mi=1,hi=2;function gi(e,t,n){let r=fi.get(e);if(r!==void 0)return r?hi:pi;if(t.has(e))return hi;t.add(e);let i=pi,a=e=>{if(i!==hi&&e?._zod){let r=gi(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=pi;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?mi:o.value?._zod?gi(o.value,t,n):pi;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=g(c);s(e?o(e,!0):mi),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?gi(r,t,!1):mi);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),_i(e,i)}function _i(e,t){return t!==mi&&fi.set(e,t===hi),t}function vi(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var yi,bi=[],xi={alloc(e,t,n){let r=yi;if(!r)return n;yi=void 0;let i={value:n,issues:null};return r.set(t.value,i),bi.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Ci(n,e.value))throw new si;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=gi(e,new Set,!1);if(i===pi)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===hi||r?n=!0:r=!0}let l=s.value;if(!ui(l))return t(s,c);let u=c[ci];u||(u={buckets:new WeakMap,backEdges:void 0},c[ci]=u);let d;i===c?d=a:(d=vi(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...di(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;yi=d;let p=bi.length,m=t(s,c);yi=void 0;let h=bi.length>p?bi.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?di(e.issues):li),e)):(h&&(h.issues=m.issues.length?di(m.issues):li),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Si(){return xi}function Ci(e,t){let n=e[ci]?.backEdges;return n!==void 0&&ui(t)&&n.has(t)}var wi=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(De(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${ce(e.values[0])}`:`Invalid option: expected one of ${o(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${o(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Ti(){return{localeError:wi()}}var Ei,Di=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Oi(){return new Di}(Ei=globalThis).__zod_globalRegistry??(Ei.__zod_globalRegistry=Oi());var ki=globalThis.__zod_globalRegistry;function Ai(e){return e.checks&&=[...e.checks],e}function ji(e,t){return new e(Ai({type:`string`,...T(t)}))}function Mi(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...T(t)})}function Ni(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...T(t)})}function Pi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...T(t)})}function Fi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...T(t)})}function Ii(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...T(t)})}function Li(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...T(t)})}function Ri(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...T(t)})}function zi(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...T(t)})}function Bi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...T(t)})}function Vi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...T(t)})}function Hi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...T(t)})}function Ui(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...T(t)})}function Wi(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...T(t)})}function Gi(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...T(t)})}function Ki(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...T(t)})}function qi(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...T(t)})}function Ji(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...T(t)})}function Yi(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...T(t)})}function Xi(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...T(t)})}function Zi(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...T(t)})}function Qi(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...T(t)})}function $i(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...T(t)})}function ea(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...T(t)})}function ta(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...T(t)})}function na(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...T(t)})}function ra(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...T(t)})}function ia(e,t){return new e(Ai({type:`number`,checks:[],...T(t)}))}function aa(e,t){return new e(Ai({type:`number`,coerce:!0,checks:[],...T(t)}))}function oa(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...T(t)})}function sa(e,t){return new e({type:`boolean`,...T(t)})}function ca(e,t){return new e({type:`undefined`,...T(t)})}function la(e,t){return new e({type:`null`,...T(t)})}function ua(e){return new e({type:`any`})}function da(e){return new e({type:`unknown`})}function fa(e,t){return new e({type:`never`,...T(t)})}function pa(e,t){return new ln({check:`less_than`,...T(t),value:e,inclusive:!1})}function ma(e,t){return new ln({check:`less_than`,...T(t),value:e,inclusive:!0})}function ha(e,t){return new un({check:`greater_than`,...T(t),value:e,inclusive:!1})}function ga(e,t){return new un({check:`greater_than`,...T(t),value:e,inclusive:!0})}function _a(e,t){return new dn({check:`multiple_of`,...T(t),value:e})}function va(e,t){return new pn({check:`max_length`,...T(t),maximum:e})}function ya(e,t){return new mn({check:`min_length`,...T(t),minimum:e})}function ba(e,t){return new hn({check:`length_equals`,...T(t),length:e})}function xa(e,t){return new _n({check:`string_format`,format:`regex`,...T(t),pattern:e})}function Sa(e){return new vn({check:`string_format`,format:`lowercase`,...T(e)})}function Ca(e){return new yn({check:`string_format`,format:`uppercase`,...T(e)})}function wa(e,t){return new bn({check:`string_format`,format:`includes`,...T(t),includes:e})}function Ta(e,t){return new xn({check:`string_format`,format:`starts_with`,...T(t),prefix:e})}function Ea(e,t){return new Sn({check:`string_format`,format:`ends_with`,...T(t),suffix:e})}function Da(e){return new Cn({check:`overwrite`,tx:e})}function Oa(e){return Da(t=>t.normalize(e))}function ka(){return Da(e=>e.trim())}function Aa(){return Da(e=>e.toLowerCase())}function ja(){return Da(e=>e.toUpperCase())}function Ma(){return Da(e=>ne(e))}function Na(e,t,n){return new e({type:`array`,element:t,...T(n)})}function Pa(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...T(n)})}function Fa(e,t){let n=Ia(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Oe(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Oe(r))}},e(t.value,t)),t);return n}function Ia(e,t){let n=new on({check:`custom`,...T(t)});return n._zod.check=e,n}function La(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&h(e,t,n[t]);return e}function Ra(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??ki,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function za(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function N(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,N(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&La(o.schema,c),t.io===`input`&&Ya(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Ba(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Va(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Ba(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Ba(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
1495
+ `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=ie,c=!Ke.jitless,u=c&&S.value,d=t.catchall,f;e._zod.parse=(i,l)=>{f??=r.value;let p=i.value;return s(p)?c&&u&&l?.async===!1&&l.jitless!==!0?(o||=a(t.shape),i=o(i,l),d?Dr([],p,i,l,f,e,l?.abortEarly===!0):i):n(i,l):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Ar(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!_e(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Se(e,r,qe())))}),t)}var jr=M(`$ZodUnion`,(e,t)=>{N.init(e,t),A(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),A(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),A(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),A(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>d(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Ar(t,r,e,i)):Ar(o,r,e,i)}});function Mr(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var Nr=M(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,jr.init(e,t);let n=e._zod.parse;A(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||h(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=g(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=l(()=>Mr(t));e._zod.parse=(i,a)=>{let o=i.value;if(!ie(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),Pr=M(`$ZodIntersection`,(e,t)=>{N.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Ir(e,t,n)):Ir(e,i,a)}});function Fr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ae(e)&&ae(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Fr(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Fr(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Ir(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Fr(t.value,n.value);if(!c.valid){if(_e(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Lr=M(`$ZodRecord`,(e,t)=>{N.init(e,t);let n=Ke.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!ae(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Se(e,i,qe())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...ye(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...ye(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&Qt.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>Se(e,i,qe())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...ye(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...ye(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Rr=M(`$ZodEnum`,(e,t)=>{N.init(e,t);let n=a(t.entries),r=new Set(n);e._zod.values=r,A(e,`pattern`,e=>{let t=a(e.def.entries).filter(e=>se.has(typeof e));return RegExp(t.length?`^(${t.map(e=>C(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),zr=M(`$ZodLiteral`,(e,t)=>{N.init(e,t);let n=new Set(t.values);e._zod.values=n,A(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?C(e):e?C(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Br=M(`$ZodTransform`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,Ke.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ge(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new We;return n.value=i,n}});function Vr(e,t){return e.value=t.issues.length?void 0:t.value,e}var Hr=M(`$ZodOptional`,(e,t)=>{N.init(e,t),A(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,A(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),A(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${d(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Vr(e,t)):Vr(e,r)}return t.innerType._zod.run(e,n)}}),Ur=M(`$ZodExactOptional`,(e,t)=>{Hr.init(e,t),A(e,`values`,e=>e.def.innerType._zod.values),A(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Wr=M(`$ZodNullable`,(e,t)=>{N.init(e,t),A(e,`optin`,e=>e.def.innerType._zod.optin),A(e,`optout`,e=>e.def.innerType._zod.optout),A(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${d(t.source)}|null)$`):void 0}),A(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Gr=M(`$ZodDefault`,(e,t)=>{N.init(e,t),e._zod.optin=`defaulted`,A(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Kr(e,t)):Kr(r,t)}});function Kr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var qr=M(`$ZodPrefault`,(e,t)=>{N.init(e,t),e._zod.optin=`defaulted`,A(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Jr=M(`$ZodNonOptional`,(e,t)=>{N.init(e,t),A(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Yr(t,e)):Yr(i,e)}});function Yr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Xr(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Se(e,r,qe()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Zr=M(`$ZodCatch`,(e,t)=>{N.init(e,t),A(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),A(e,`optout`,e=>e.def.innerType._zod.optout),A(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Xr(e,r,t,n)):Xr(e,r,t,n)}}),Qr=M(`$ZodPipe`,(e,t)=>{N.init(e,t),A(e,`values`,e=>e.def.in._zod.values),A(e,`optin`,e=>e.def.in._zod.optin),A(e,`optout`,e=>e.def.out._zod.optout),A(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>$r(e,t.in,n)):$r(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>$r(e,t.out,n)):$r(r,t.out,n)}});function $r(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var ei=M(`$ZodPreprocess`,(e,t)=>{Qr.init(e,t)}),ti=M(`$ZodReadonly`,(e,t)=>{N.init(e,t),A(e,`propValues`,e=>e.def.innerType._zod.propValues),A(e,`values`,e=>e.def.innerType._zod.values),A(e,`optin`,e=>e.def.innerType?._zod?.optin),A(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(ni):ni(r)}});function ni(e){return e.memo||(e.value=Object.freeze(e.value)),e}var ri=M(`$ZodLazy`,(e,t)=>{N.init(e,t),m(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),A(e,`pattern`,e=>e.innerType?._zod?.pattern),A(e,`propValues`,e=>e.innerType?._zod?.propValues),A(e,`optin`,e=>e.innerType?._zod?.optin??void 0),A(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),ii=M(`$ZodCustom`,(e,t)=>{an.init(e,t),N.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>ai(t,n,r,e));ai(i,n,r,e)}});function ai(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(De(e))}}var oi=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},si=`~memo`,ci=[];function li(e){return typeof e==`object`&&!!e}function ui(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var di=new WeakMap,fi=0,pi=1,mi=2;function hi(e,t,n){let r=di.get(e);if(r!==void 0)return r?mi:fi;if(t.has(e))return mi;t.add(e);let i=fi,a=e=>{if(i!==mi&&e?._zod){let r=hi(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=fi;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?pi:o.value?._zod?hi(o.value,t,n):fi;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=g(c);s(e?o(e,!0):pi),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?hi(r,t,!1):pi);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),gi(e,i)}function gi(e,t){return t!==pi&&di.set(e,t===mi),t}function _i(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var vi,yi=[],bi={alloc(e,t,n){let r=vi;if(!r)return n;vi=void 0;let i={value:n,issues:null};return r.set(t.value,i),yi.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Si(n,e.value))throw new oi;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=hi(e,new Set,!1);if(i===fi)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===mi||r?n=!0:r=!0}let l=s.value;if(!li(l))return t(s,c);let u=c[si];u||(u={buckets:new WeakMap,backEdges:void 0},c[si]=u);let d;i===c?d=a:(d=_i(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...ui(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;vi=d;let p=yi.length,m=t(s,c);vi=void 0;let h=yi.length>p?yi.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?ui(e.issues):ci),e)):(h&&(h.issues=m.issues.length?ui(m.issues):ci),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function xi(){return bi}function Si(e,t){let n=e[si]?.backEdges;return n!==void 0&&li(t)&&n.has(t)}var Ci=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Ee(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${ce(e.values[0])}`:`Invalid option: expected one of ${o(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${o(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function wi(){return{localeError:Ci()}}var Ti,Ei=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Di(){return new Ei}(Ti=globalThis).__zod_globalRegistry??(Ti.__zod_globalRegistry=Di());var Oi=globalThis.__zod_globalRegistry;function ki(e){return e.checks&&=[...e.checks],e}function Ai(e,t){return new e(ki({type:`string`,...T(t)}))}function ji(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...T(t)})}function Mi(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...T(t)})}function Ni(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...T(t)})}function Pi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...T(t)})}function Fi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...T(t)})}function Ii(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...T(t)})}function Li(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...T(t)})}function Ri(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...T(t)})}function zi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...T(t)})}function Bi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...T(t)})}function Vi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...T(t)})}function Hi(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...T(t)})}function Ui(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...T(t)})}function Wi(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...T(t)})}function Gi(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...T(t)})}function Ki(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...T(t)})}function qi(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...T(t)})}function Ji(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...T(t)})}function Yi(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...T(t)})}function Xi(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...T(t)})}function Zi(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...T(t)})}function Qi(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...T(t)})}function $i(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...T(t)})}function ea(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...T(t)})}function ta(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...T(t)})}function na(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...T(t)})}function ra(e,t){return new e(ki({type:`number`,checks:[],...T(t)}))}function ia(e,t){return new e(ki({type:`number`,coerce:!0,checks:[],...T(t)}))}function aa(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...T(t)})}function oa(e,t){return new e({type:`boolean`,...T(t)})}function sa(e,t){return new e({type:`undefined`,...T(t)})}function ca(e,t){return new e({type:`null`,...T(t)})}function la(e){return new e({type:`any`})}function ua(e){return new e({type:`unknown`})}function da(e,t){return new e({type:`never`,...T(t)})}function fa(e,t){return new cn({check:`less_than`,...T(t),value:e,inclusive:!1})}function pa(e,t){return new cn({check:`less_than`,...T(t),value:e,inclusive:!0})}function ma(e,t){return new ln({check:`greater_than`,...T(t),value:e,inclusive:!1})}function ha(e,t){return new ln({check:`greater_than`,...T(t),value:e,inclusive:!0})}function ga(e,t){return new un({check:`multiple_of`,...T(t),value:e})}function _a(e,t){return new fn({check:`max_length`,...T(t),maximum:e})}function va(e,t){return new pn({check:`min_length`,...T(t),minimum:e})}function ya(e,t){return new mn({check:`length_equals`,...T(t),length:e})}function ba(e,t){return new gn({check:`string_format`,format:`regex`,...T(t),pattern:e})}function xa(e){return new _n({check:`string_format`,format:`lowercase`,...T(e)})}function Sa(e){return new vn({check:`string_format`,format:`uppercase`,...T(e)})}function Ca(e,t){return new yn({check:`string_format`,format:`includes`,...T(t),includes:e})}function wa(e,t){return new bn({check:`string_format`,format:`starts_with`,...T(t),prefix:e})}function Ta(e,t){return new xn({check:`string_format`,format:`ends_with`,...T(t),suffix:e})}function Ea(e){return new Sn({check:`overwrite`,tx:e})}function Da(e){return Ea(t=>t.normalize(e))}function Oa(){return Ea(e=>e.trim())}function ka(){return Ea(e=>e.toLowerCase())}function Aa(){return Ea(e=>e.toUpperCase())}function ja(){return Ea(e=>ne(e))}function Ma(e,t,n){return new e({type:`array`,element:t,...T(n)})}function Na(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...T(n)})}function Pa(e,t){let n=Fa(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(De(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(De(r))}},e(t.value,t)),t);return n}function Fa(e,t){let n=new an({check:`custom`,...T(t)});return n._zod.check=e,n}function Ia(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&h(e,t,n[t]);return e}function La(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Oi,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function Ra(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function za(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,za(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Ia(o.schema,c),t.io===`input`&&Ya(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Ba(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Va(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Ba(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Ba(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
1496
1496
 
1497
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Ha(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Ha(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Ua=new Set([`type`,`properties`,`required`,`additionalProperties`]),Wa=[`oneOf`,`anyOf`];function Ga(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Ka(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Ua.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Ga(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}h(n,r,e.length===1?e[0]:Ka(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Ga(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function qa(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Ua)if(t in e)return;let n=t.filter(e=>Wa.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Ka(t);else{let e=n[0],i=Wa.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Ka([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,La(e,r))}function Ja(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):La(i,s),La(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Ha(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])qa(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}La(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,h(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Za(t,`input`,e.processors),output:Za(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Ya(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Ya(r.element,n);if(r.type===`set`)return Ya(r.valueType,n);if(r.type===`lazy`)return Ya(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return Ya(r.innerType,n);if(r.type===`intersection`)return Ya(r.left,n)||Ya(r.right,n);if(r.type===`record`||r.type===`map`)return Ya(r.keyType,n)||Ya(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Ya(r.in,n)||Ya(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Ya(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Ya(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Ya(e,n))return!0;return!!(r.rest&&Ya(r.rest,n))}return!1}var Xa=(e,t={})=>n=>{let r=Ra({...n,processors:t});return N(e,r),Va(r,e),Ja(r,e)},Za=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ra({...i??{},target:a,io:t,processors:n});return N(e,o),Va(o,e),Ja(o,e)},Qa=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},$a=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},eo=(e,t)=>{Qa(e,`minimum`,t),$a(e,`maximum`,t)},to=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},no=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},ro=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},io=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},ao=(e,t)=>Qa(e,`minimum`,t.minimum),oo=(e,t)=>$a(e,`maximum`,t.maximum),so=e=>(t,n)=>{io(t,n.format);let[r,i]=e[n.format];Qa(t,`minimum`,r),$a(t,`maximum`,i)},co={greater_than:(e,t)=>Qa(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>$a(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>to(e,t.value),number_format:so(le),bigint_format:so(D),min_length:ao,max_length:oo,length_equals:(e,t)=>eo(e,t.length),min_size:ao,max_size:oo,size_equals:(e,t)=>eo(e,t.size),string_format:(e,t)=>{io(e,t.format),t.pattern&&no(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>ro(e,t.mime)};function lo(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)co[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Qa(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Qa(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&$a(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&$a(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&to(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&ro(t,i.mime);for(let e of i.patterns??[])no(t,e);return t}var uo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},fo=new Map([[sr,Vt],[lr,Ht]]),po=e=>fo.get(e)??e,mo=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=lo(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=uo[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(po);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},ho=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=lo(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):za(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},go=(e,t,n,r)=>{n.type=`boolean`},_o=(e,t,n,r)=>{za(e,t,n,r,`BigInt cannot be represented in JSON Schema`)},vo=(e,t,n,r)=>{za(e,t,n,r,`Symbols cannot be represented in JSON Schema`)},yo=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},bo=(e,t,n,r)=>{za(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},xo=(e,t,n,r)=>{za(e,t,n,r,`Void cannot be represented in JSON Schema`)},So=(e,t,n,r)=>{n.not={}},Co=(e,t,n,r)=>{},wo=(e,t,n,r)=>{},To=(e,t,n,r)=>{za(e,t,n,r,`Date cannot be represented in JSON Schema`)},Eo=(e,t,n,r)=>{let i=e._zod.def,o=a(i.entries);o.length===0?n.not={}:(o.every(e=>typeof e==`number`)&&(n.type=`number`),o.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=o)},Do=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(za(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(za(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Oo=(e,t,n,r)=>{za(e,t,n,r,`NaN cannot be represented in JSON Schema`)},ko=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},Ao=(e,t,n,r)=>{let i=n;i.type=`string`,i.format=`binary`,i.contentEncoding=`binary`;let{minimum:a,maximum:o,mime:s}=lo(e);a!==void 0&&(i.minLength=a),o!==void 0&&(i.maxLength=o),s&&(s.length===0?i.not={}:s.length===1?i.contentMediaType=s[0]:i.anyOf=s.map(e=>({contentMediaType:e})))},jo=(e,t,n,r)=>{n.type=`boolean`},Mo=(e,t,n,r)=>{za(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},No=(e,t,n,r)=>{za(e,t,n,r,`Function types cannot be represented in JSON Schema`)},Po=(e,t,n,r)=>{za(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Fo=(e,t,n,r)=>{za(e,t,n,r,`Map cannot be represented in JSON Schema`)},Io=(e,t,n,r)=>{za(e,t,n,r,`Set cannot be represented in JSON Schema`)},Lo=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=lo(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=N(a.element,t,{...r,path:[...r.path,`items`]})};function Ro(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Ro(t.out):t.type===`catch`?Ro(t.innerType):e._zod.optin}var zo=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&za(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)h(i.properties,e,N(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Ro(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=N(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Bo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>N(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Vo=(e,t,n,r)=>{let i=e._zod.def,a=N(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=N(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Ho=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>N(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?N(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?Ro(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=lo(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function Uo(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Uo(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Uo(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?$t:Qt).source)),p}var Wo=new WeakMap;function Go(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Wo.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Uo(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Ko=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=lo(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=N(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)h(i.patternProperties,po(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=N(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Wo.get(t);n||(n=[],Wo.set(t,n),t.deferred.push(()=>Go(t))),n.push(e)}i.additionalProperties=N(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Ro(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},qo=(e,t,n,r)=>{let i=e._zod.def,a=N(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Jo=(e,t,n,r)=>{let i=e._zod.def;N(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Yo=Symbol();function Xo(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(za(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Yo):JSON.parse(o)}var Zo=(e,t,n,r)=>{let i=e._zod.def;N(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Xo(i.defaultValue,e,t,n,r);o!==Yo&&(n.default=o)},Qo=(e,t,n,r)=>{let i=e._zod.def;N(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Xo(i.defaultValue,e,t,n,r);o!==Yo&&(n._prefault=o)},$o=(e,t,n,r)=>{let i=e._zod.def;N(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{za(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},es=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;N(o,t,r);let s=t.seen.get(e);s.ref=o},ts=(e,t,n,r)=>{let i=e._zod.def;N(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ns=(e,t,n,r)=>{let i=e._zod.def;N(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},rs=(e,t,n,r)=>{let i=e._zod.def;N(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},is=(e,t,n,r)=>{let i=e._zod.innerType;N(i,t,r);let a=t.seen.get(e);a.ref=i},as={string:mo,number:ho,boolean:go,bigint:_o,symbol:vo,null:yo,undefined:bo,void:xo,never:So,any:Co,unknown:wo,date:To,enum:Eo,literal:Do,nan:Oo,template_literal:ko,file:Ao,success:jo,custom:Mo,function:No,transform:Po,map:Fo,set:Io,array:Lo,object:zo,union:Bo,intersection:Vo,tuple:Ho,record:Ko,nullable:qo,nonoptional:Jo,default:Zo,prefault:Qo,catch:$o,pipe:es,readonly:ts,promise:ns,optional:rs,lazy:is};function os(e,t){if(`_idmap`in e){let n=e,r=Ra({...t,processors:as}),i={};for(let e of n._idmap.entries()){let[t,n]=e;N(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;Va(r,n),h(a,t,Ja(r,n))}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=Ra({...t,processors:as});return N(e,n),Va(n,e),Ja(n,e)}var ss=new WeakSet([Object.prototype,Error.prototype]);function cs(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var ls=j(`ZodError`,(e,t)=>{tt.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);ss.has(n)||(ss.add(n),cs(n,`format`,e=>t=>it(e,t)),cs(n,`flatten`,e=>t=>rt(e,t)),cs(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,s,2)}),cs(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,s,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),us=ot(ls),ds=st(ls),fs=ct(ls),ps=ut(ls),ms=gt(ls),hs=_t(ls),gs=vt(ls),_s=yt(ls),vs=bt(ls),ys=xt(ls),bs=St(ls),xs=Ct(ls);function Ss(){qe.localeError||Je(Ti())}function Cs(){qe.memoizer||Je({memoizer:Si()})}var P=j(`ZodType`,(e,t)=>(Ss(),M.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(x(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return w(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Wc(e,t))},superRefine(e,t){return this.check(Gc(e,t))},overwrite(e){return this.check(Da(e))},optional(){return K(this)},exactOptional(){return Tc(this)},nullable(){return Dc(this)},nullish(){return K(Dc(this))},nonoptional(e){return Nc(this,e)},array(){return z(this)},or(e){return H([this,e])},and(e){return _c(this,e)},transform(e){return Lc(this,Sc(e))},default(e){return kc(this,e)},prefault(e){return jc(this,e)},catch(e){return Fc(this,e)},pipe(e){return Lc(this,e)},readonly(){return Bc(this)},describe(e){let t=this.clone();return ki.add(t,{description:e}),t},meta(...e){if(e.length===0)return ki.get(this);let t=this.clone();return ki.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return je(this,`~standard`,{...On(this),jsonSchema:{input:Za(this,`input`),output:Za(this,`output`)}})},set"~standard"(e){Ae(this,`~standard`,e)},parse:function e(t,n){return us(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await ds(this,t,n,{callee:e})},safeParse(e,t){return fs(this,e,t)},async safeParseAsync(e,t){return ps(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Ae(this,`spa`,e)},validate(e,t){return pt(this,e,t)},validateAsync(e,t){return ht(this,e,t)},encode:function e(t,n){return ms(this,t,n,{callee:e})},decode:function e(t,n){return hs(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await gs(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await _s(this,t,n,{callee:e})},safeEncode(e,t){return vs(this,e,t)},safeDecode(e,t){return ys(this,e,t)},async safeEncodeAsync(e,t){return bs(this,e,t)},async safeDecodeAsync(e,t){return xs(this,e,t)},toJSONSchema(e){return Xa(this,{})(e)},get description(){return ki.get(this)?.description},get _def(){return this._zod.def}}),ws=j(`_ZodString`,(e,t)=>{kn.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mo(e,t,n,r)},Me({format:e=>lo(e).format??null,minLength:e=>lo(e).minimum??null,maxLength:e=>lo(e).maximum??null},{regex(...e){return this.check(xa(...e))},includes(...e){return this.check(wa(...e))},startsWith(...e){return this.check(Ta(...e))},endsWith(...e){return this.check(Ea(...e))},min(...e){return this.check(ya(...e))},max(...e){return this.check(va(...e))},length(...e){return this.check(ba(...e))},nonempty(...e){return this.check(ya(1,...e))},lowercase(e){return this.check(Sa(e))},uppercase(e){return this.check(Ca(e))},trim(){return this.check(ka())},normalize(...e){return this.check(Oa(...e))},toLowerCase(){return this.check(Aa())},toUpperCase(){return this.check(ja())},slugify(){return this.check(Ma())}})),Ts=j(`ZodString`,(e,t)=>{kn.init(e,t),ws.init(e,t)},{email(e){return this.check(Mi(js,e))},url(e){return this.check(Ri(Fs,e))},jwt(e){return this.check($i(Zs,e))},emoji(e){return this.check(zi(Ls,e))},guid(e){return this.check(Ni(Ns,e))},uuid(e){return this.check(Pi(Ps,e))},uuidv4(e){return this.check(Fi(Ps,e))},uuidv6(e){return this.check(Ii(Ps,e))},uuidv7(e){return this.check(Li(Ps,e))},nanoid(e){return this.check(Bi(Rs,e))},cuid(e){return this.check(Vi(zs,e))},cuid2(e){return this.check(Hi(Bs,e))},ulid(e){return this.check(Ui(Vs,e))},base64(e){return this.check(Xi(Js,e))},base64url(e){return this.check(Zi(Ys,e))},xid(e){return this.check(Wi(Hs,e))},ksuid(e){return this.check(Gi(Us,e))},ipv4(e){return this.check(Ki(Ws,e))},ipv6(e){return this.check(qi(Gs,e))},cidrv4(e){return this.check(Ji(Ks,e))},cidrv6(e){return this.check(Yi(qs,e))},e164(e){return this.check(Qi(Xs,e))},datetime(e){return this.check(ea(Ds,e))},date(e){return this.check(ta(Os,e))},time(e){return this.check(na(ks,e))},duration(e){return this.check(ra(As,e))}});function F(e){return ji(Ts,e)}var Es=j(`ZodStringFormat`,(e,t)=>{An.init(e,t),ws.init(e,t)}),Ds=j(`ZodISODateTime`,(e,t)=>{Yn.init(e,t),Es.init(e,t)}),Os=j(`ZodISODate`,(e,t)=>{Xn.init(e,t),Es.init(e,t)}),ks=j(`ZodISOTime`,(e,t)=>{Zn.init(e,t),Es.init(e,t)}),As=j(`ZodISODuration`,(e,t)=>{Qn.init(e,t),Es.init(e,t)}),js=j(`ZodEmail`,(e,t)=>{Nn.init(e,t),Es.init(e,t)});function Ms(e){return Mi(js,e)}var Ns=j(`ZodGUID`,(e,t)=>{jn.init(e,t),Es.init(e,t)}),Ps=j(`ZodUUID`,(e,t)=>{Mn.init(e,t),Es.init(e,t)}),Fs=j(`ZodURL`,(e,t)=>{Vn.init(e,t),Es.init(e,t)});function Is(e){return Ri(Fs,e)}var Ls=j(`ZodEmoji`,(e,t)=>{Hn.init(e,t),Es.init(e,t)}),Rs=j(`ZodNanoID`,(e,t)=>{Un.init(e,t),Es.init(e,t)}),zs=j(`ZodCUID`,(e,t)=>{Wn.init(e,t),Es.init(e,t)}),Bs=j(`ZodCUID2`,(e,t)=>{Gn.init(e,t),Es.init(e,t)}),Vs=j(`ZodULID`,(e,t)=>{Kn.init(e,t),Es.init(e,t)}),Hs=j(`ZodXID`,(e,t)=>{qn.init(e,t),Es.init(e,t)}),Us=j(`ZodKSUID`,(e,t)=>{Jn.init(e,t),Es.init(e,t)}),Ws=j(`ZodIPv4`,(e,t)=>{$n.init(e,t),Es.init(e,t)}),Gs=j(`ZodIPv6`,(e,t)=>{nr.init(e,t),Es.init(e,t)}),Ks=j(`ZodCIDRv4`,(e,t)=>{rr.init(e,t),Es.init(e,t)}),qs=j(`ZodCIDRv6`,(e,t)=>{ar.init(e,t),Es.init(e,t)}),Js=j(`ZodBase64`,(e,t)=>{cr.init(e,t),Es.init(e,t)}),Ys=j(`ZodBase64URL`,(e,t)=>{dr.init(e,t),Es.init(e,t)}),Xs=j(`ZodE164`,(e,t)=>{fr.init(e,t),Es.init(e,t)}),Zs=j(`ZodJWT`,(e,t)=>{mr.init(e,t),Es.init(e,t)}),Qs=j(`ZodNumber`,(e,t)=>{hr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r),e.isFinite=!0},Me({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=lo(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=lo(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=lo(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>lo(e).format??null},{gt(e,t){return this.check(ha(e,t))},gte(e,t){return this.check(ga(e,t))},min(e,t){return this.check(ga(e,t))},lt(e,t){return this.check(pa(e,t))},lte(e,t){return this.check(ma(e,t))},max(e,t){return this.check(ma(e,t))},int(e){return this.check(ec(e))},safe(e){return this.check(ec(e))},positive(e){return this.check(ha(0,e))},nonnegative(e){return this.check(ga(0,e))},negative(e){return this.check(pa(0,e))},nonpositive(e){return this.check(ma(0,e))},multipleOf(e,t){return this.check(_a(e,t))},step(e,t){return this.check(_a(e,t))},finite(){return this}}));function I(e){return ia(Qs,e)}var $s=j(`ZodNumberFormat`,(e,t)=>{gr.init(e,t),Qs.init(e,t)});function ec(e){return oa($s,e)}var tc=j(`ZodBoolean`,(e,t)=>{_r.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(e,t,n,r)});function L(e){return sa(tc,e)}var nc=j(`ZodUndefined`,(e,t)=>{vr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bo(e,t,n,r)});function rc(e){return ca(nc,e)}var ic=j(`ZodNull`,(e,t)=>{yr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yo(e,t,n,r)});function ac(e){return la(ic,e)}var oc=j(`ZodAny`,(e,t)=>{br.init(e,t),P.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function sc(){return ua(oc)}var cc=j(`ZodUnknown`,(e,t)=>{xr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function R(){return da(cc)}var lc=j(`ZodNever`,(e,t)=>{Sr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r)});function uc(e){return fa(lc,e)}var dc=j(`ZodArray`,(e,t)=>{Cs(),wr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e.element=t.element},{min(e,t){return this.check(ya(e,t))},nonempty(e){return this.check(ya(1,e))},max(e,t){return this.check(va(e,t))},length(e,t){return this.check(ba(e,t))},unwrap(){return this.element}});function z(e,t){return Na(dc,e,t)}var fc=j(`ZodObject`,(e,t)=>{Cs(),Ar.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zo(e,t,n,r),A(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return W(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(x(this._zod.def,{catchall:e}))},passthrough(){return this.clone(x(this._zod.def,{catchall:R()}))},loose(){return this.clone(x(this._zod.def,{catchall:R()}))},strict(){return this.clone(x(this._zod.def,{catchall:uc()}))},strip(){return this.clone(x(this._zod.def,{catchall:void 0}))},extend(e){return pe(this,e)},safeExtend(e){return me(this,e)},merge(e){return he(this,e)},pick(e){return ue(this,e)},omit(e){return fe(this,e)},partial(...e){return ge(Cc,this,e[0])},exactPartial(...e){return ge(wc,this,e[0],`exactPartial`)},required(...e){return _e(Mc,this,e[0])}});function B(e,t){return new fc({type:`object`,shape:e??{},...T(t)})}function V(e,t){return new fc({type:`object`,shape:e,catchall:R(),...T(t)})}var pc=j(`ZodUnion`,(e,t)=>{Mr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.options=t.options});function H(e,t){return new pc({type:`union`,options:e,...T(t)})}var mc=j(`ZodDiscriminatedUnion`,(e,t)=>{pc.init(e,t),Pr.init(e,t)});function hc(e,t,n){return new mc({type:`union`,options:t,discriminator:e,...T(n)})}var gc=j(`ZodIntersection`,(e,t)=>{Fr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vo(e,t,n,r)});function _c(e,t){return new gc({type:`intersection`,left:e,right:t})}var vc=j(`ZodRecord`,(e,t)=>{Cs(),Rr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ko(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function U(e,t,n){return!t||!t._zod?new vc({type:`record`,keyType:F(),valueType:e,...T(t)}):new vc({type:`record`,keyType:e,valueType:t,...T(n)})}var yc=j(`ZodEnum`,(e,t)=>{zr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new yc({...t,checks:[],...T(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new yc({...t,checks:[],...T(r),entries:i})}});function W(e,t){return new yc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...T(t)})}var bc=j(`ZodLiteral`,(e,t)=>{Br.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function G(e,t){return new bc({type:`literal`,values:Array.isArray(e)?e:[e],...T(t)})}var xc=j(`ZodTransform`,(e,t)=>{Cs(),Vr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ke(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Oe(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Oe(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Sc(e){return new xc({type:`transform`,transform:e})}var Cc=j(`ZodOptional`,(e,t)=>{Ur.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function K(e){return new Cc({type:`optional`,innerType:e})}var wc=j(`ZodExactOptional`,(e,t)=>{Wr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Tc(e){return new wc({type:`optional`,innerType:e})}var Ec=j(`ZodNullable`,(e,t)=>{Gr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Dc(e){return new Ec({type:`nullable`,innerType:e})}var Oc=j(`ZodDefault`,(e,t)=>{Kr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function kc(e,t){return new Oc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():oe(t)}})}var Ac=j(`ZodPrefault`,(e,t)=>{Jr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jc(e,t){return new Ac({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():oe(t)}})}var Mc=j(`ZodNonOptional`,(e,t)=>{Yr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Nc(e,t){return new Mc({type:`nonoptional`,innerType:e,...T(t)})}var Pc=j(`ZodCatch`,(e,t)=>{Qr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$o(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Fc(e,t){return new Pc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:ze(t)})}var Ic=j(`ZodPipe`,(e,t)=>{$r.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>es(e,t,n,r),e.in=t.in,e.out=t.out});function Lc(e,t){return new Ic({type:`pipe`,in:e,out:t})}var Rc=j(`ZodPreprocess`,(e,t)=>{Ic.init(e,t),ti.init(e,t)}),zc=j(`ZodReadonly`,(e,t)=>{ni.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ts(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Bc(e){return new zc({type:`readonly`,innerType:e})}var Vc=j(`ZodLazy`,(e,t)=>{ii.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>is(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Hc(e){return new Vc({type:`lazy`,getter:e})}var Uc=j(`ZodCustom`,(e,t)=>{ai.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r)});function Wc(e,t={}){return Pa(Uc,e,t)}function Gc(e,t){return Fa(e,t)}function Kc(e,t){return new Rc({type:`pipe`,in:Sc(e),out:t})}var qc={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},Jc;Jc||={};function Yc(e){return ea(Ds,e)}function Xc(e){return ta(Os,e)}function Zc(e){return aa(Qs,e)}var Qc=[`2025-11-25`,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],$c=`io.modelcontextprotocol/related-task`,el=`io.modelcontextprotocol/protocolVersion`,tl=`io.modelcontextprotocol/clientInfo`,nl=`io.modelcontextprotocol/serverInfo`,rl=`io.modelcontextprotocol/clientCapabilities`,il=`io.modelcontextprotocol/subscriptionId`,al=`io.modelcontextprotocol/logLevel`,ol=Hc(()=>H([F(),I(),L(),ac(),U(F(),ol),z(ol)])),sl=U(F(),ol),cl=z(ol),ll=H([F(),I().int()]),ul=F(),dl=B({ttl:I().optional()}),fl=B({taskId:F()}),pl=V({progressToken:ll.optional(),[$c]:fl.optional()}),ml=B({_meta:pl.optional()}),hl=ml.extend({task:dl.optional()}),gl=B({method:F(),params:ml.loose().optional()}),_l=B({_meta:pl.optional()}),vl=B({method:F(),params:_l.loose().optional()}),yl=V({get[nl](){return Pl.optional().catch(void 0)}}),bl=V({_meta:yl.optional()}),xl=H([F(),I().int()]),Sl=B({jsonrpc:G(`2.0`),id:xl,...gl.shape}).strict(),Cl=B({jsonrpc:G(`2.0`),...vl.shape}).strict(),wl=B({jsonrpc:G(`2.0`),id:xl,result:bl}).strict(),Tl=B({jsonrpc:G(`2.0`),id:xl.optional(),error:B({code:I().int(),message:F(),data:R().optional()})}).strict(),El=H([Sl,Cl,wl,Tl]),Dl=H([wl,Tl]),Ol=bl.strict(),kl=_l.extend({requestId:xl.optional(),reason:F().optional()}),Al=vl.extend({method:G(`notifications/cancelled`),params:kl}),jl=B({src:F(),mimeType:F().optional(),sizes:z(F()).optional(),theme:W([`light`,`dark`]).optional()}),Ml=B({icons:z(jl).optional()}),Nl=B({name:F(),title:F().optional()}),Pl=Nl.extend({...Nl.shape,...Ml.shape,version:F(),websiteUrl:F().optional(),description:F().optional()}),Fl=Kc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,_c(B({form:_c(B({applyDefaults:L().optional()}),sl).optional(),url:sl.optional()}),sl.optional())),Il=V({list:sl.optional(),cancel:sl.optional(),requests:V({sampling:V({createMessage:sl.optional()}).optional(),elicitation:V({create:sl.optional()}).optional()}).optional()}),Ll=V({list:sl.optional(),cancel:sl.optional(),requests:V({tools:V({call:sl.optional()}).optional()}).optional()}),Rl=B({experimental:U(F(),sl).optional(),sampling:B({context:sl.optional(),tools:sl.optional()}).optional(),elicitation:Fl.optional(),roots:B({listChanged:L().optional()}).optional(),tasks:Il.optional(),extensions:U(F(),sl).optional()}),zl=ml.extend({protocolVersion:F(),capabilities:Rl,clientInfo:Pl}),Bl=gl.extend({method:G(`initialize`),params:zl}),Vl=B({experimental:U(F(),sl).optional(),logging:sl.optional(),completions:sl.optional(),prompts:B({listChanged:L().optional()}).optional(),resources:B({subscribe:L().optional(),listChanged:L().optional()}).optional(),tools:B({listChanged:L().optional()}).optional(),tasks:Ll.optional(),extensions:U(F(),sl).optional()}),Hl=bl.extend({protocolVersion:F(),capabilities:Vl,serverInfo:Pl,instructions:F().optional()}),Ul=vl.extend({method:G(`notifications/initialized`),params:_l.optional()}),Wl=gl.extend({method:G(`server/discover`),params:ml.optional()}),Gl=bl.extend({supportedVersions:z(F()),capabilities:Vl,instructions:F().optional()}),Kl=gl.extend({method:G(`ping`),params:ml.optional()}),ql=B({progress:I(),total:K(I()),message:K(F())}),Jl=B({..._l.shape,...ql.shape,progressToken:ll}),Yl=vl.extend({method:G(`notifications/progress`),params:Jl}),Xl=ml.extend({cursor:ul.optional()}),Zl=gl.extend({params:Xl.optional()}),Ql=bl.extend({nextCursor:ul.optional()}),$l=B({uri:F(),mimeType:K(F()),_meta:U(F(),R()).optional()}),eu=$l.extend({text:F()}),tu=F().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),nu=$l.extend({blob:tu}),ru=W([`user`,`assistant`]),iu=B({audience:z(ru).optional(),priority:I().min(0).max(1).optional(),lastModified:Yc({offset:!0}).optional()}),au=B({...Nl.shape,...Ml.shape,uri:F(),description:K(F()),mimeType:K(F()),size:K(I()),annotations:iu.optional(),_meta:K(V({}))}),ou=B({...Nl.shape,...Ml.shape,uriTemplate:F(),description:K(F()),mimeType:K(F()),annotations:iu.optional(),_meta:K(V({}))}),su=Zl.extend({method:G(`resources/list`)}),cu=Ql.extend({resources:z(au)}),lu=Zl.extend({method:G(`resources/templates/list`)}),uu=Ql.extend({resourceTemplates:z(ou)}),du=ml.extend({uri:F()}),fu=du,pu=gl.extend({method:G(`resources/read`),params:fu}),mu=bl.extend({contents:z(H([eu,nu]))}),hu=vl.extend({method:G(`notifications/resources/list_changed`),params:_l.optional()}),gu=du,_u=gl.extend({method:G(`resources/subscribe`),params:gu}),vu=du,yu=gl.extend({method:G(`resources/unsubscribe`),params:vu}),bu=B({toolsListChanged:L().optional(),promptsListChanged:L().optional(),resourcesListChanged:L().optional(),resourceSubscriptions:z(F()).optional()}),xu=ml.extend({notifications:bu}),Su=gl.extend({method:G(`subscriptions/listen`),params:xu}),Cu=_l.extend({notifications:bu}),wu=vl.extend({method:G(`notifications/subscriptions/acknowledged`),params:Cu}),Tu=yl.extend({[il]:xl}),Eu=bl.extend({_meta:Tu}),Du=_l.extend({uri:F()}),Ou=vl.extend({method:G(`notifications/resources/updated`),params:Du}),ku=B({name:F(),description:K(F()),required:K(L())}),Au=B({...Nl.shape,...Ml.shape,description:K(F()),arguments:K(z(ku)),_meta:K(V({}))}),ju=Zl.extend({method:G(`prompts/list`)}),Mu=Ql.extend({prompts:z(Au)}),Nu=ml.extend({name:F(),arguments:U(F(),F()).optional()}),Pu=gl.extend({method:G(`prompts/get`),params:Nu}),Fu=B({type:G(`text`),text:F(),annotations:iu.optional(),_meta:U(F(),R()).optional()}),Iu=B({type:G(`image`),data:tu,mimeType:F(),annotations:iu.optional(),_meta:U(F(),R()).optional()}),Lu=B({type:G(`audio`),data:tu,mimeType:F(),annotations:iu.optional(),_meta:U(F(),R()).optional()}),Ru=B({type:G(`tool_use`),name:F(),id:F(),input:U(F(),R()),_meta:U(F(),R()).optional()}),zu=B({type:G(`resource`),resource:H([eu,nu]),annotations:iu.optional(),_meta:U(F(),R()).optional()}),Bu=au.extend({type:G(`resource_link`)}),Vu=H([Fu,Iu,Lu,Bu,zu]),Hu=B({role:ru,content:Vu}),Uu=bl.extend({description:F().optional(),messages:z(Hu)}),Wu=vl.extend({method:G(`notifications/prompts/list_changed`),params:_l.optional()}),Gu=B({title:F().optional(),readOnlyHint:L().optional(),destructiveHint:L().optional(),idempotentHint:L().optional(),openWorldHint:L().optional()}),Ku=B({taskSupport:W([`required`,`optional`,`forbidden`]).optional()}),qu=B({...Nl.shape,...Ml.shape,description:F().optional(),inputSchema:B({type:G(`object`),properties:U(F(),ol).optional(),required:z(F()).optional()}).catchall(R()),outputSchema:V({$schema:F().optional()}).optional(),annotations:Gu.optional(),execution:Ku.optional(),_meta:U(F(),R()).optional()}),Ju=Zl.extend({method:G(`tools/list`)}),Yu=Ql.extend({tools:z(qu)}),Xu=bl.extend({content:z(Vu).default([]),structuredContent:R().optional(),isError:L().optional()}),Zu=Xu.or(bl.extend({toolResult:R()})),Qu=hl.extend({name:F(),arguments:U(F(),R()).optional()}),$u=gl.extend({method:G(`tools/call`),params:Qu}),ed=vl.extend({method:G(`notifications/tools/list_changed`),params:_l.optional()}),td=B({autoRefresh:L().default(!0),debounceMs:I().int().nonnegative().default(300)}),nd=W([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),rd=ml.extend({level:nd}),id=gl.extend({method:G(`logging/setLevel`),params:rd}),ad=_l.extend({level:nd,logger:F().optional(),data:R()}),od=vl.extend({method:G(`notifications/message`),params:ad}),sd=B({name:F().optional()}),cd=B({hints:z(sd).optional(),costPriority:I().min(0).max(1).optional(),speedPriority:I().min(0).max(1).optional(),intelligencePriority:I().min(0).max(1).optional()}),ld=B({mode:W([`auto`,`required`,`none`]).optional()}),ud=B({type:G(`tool_result`),toolUseId:F().describe(`The unique identifier for the corresponding tool call.`),content:z(Vu),structuredContent:R().optional(),isError:L().optional(),_meta:U(F(),R()).optional()}),dd=hc(`type`,[Fu,Iu,Lu]),fd=hc(`type`,[Fu,Iu,Lu,Ru,ud]),pd=B({role:ru,content:H([fd,z(fd)]),_meta:U(F(),R()).optional()}),md=hl.extend({messages:z(pd),modelPreferences:cd.optional(),systemPrompt:F().optional(),includeContext:W([`none`,`thisServer`,`allServers`]).optional(),temperature:I().optional(),maxTokens:I().int(),stopSequences:z(F()).optional(),metadata:sl.optional(),tools:z(qu).optional(),toolChoice:ld.optional()}),hd=gl.extend({method:G(`sampling/createMessage`),params:md}),gd=bl.extend({model:F(),stopReason:K(W([`endTurn`,`stopSequence`,`maxTokens`]).or(F())),role:ru,content:dd}),_d=bl.extend({model:F(),stopReason:K(W([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(F())),role:ru,content:H([fd,z(fd)])}),vd=B({type:G(`boolean`),title:F().optional(),description:F().optional(),default:L().optional()}),yd=B({type:G(`string`),title:F().optional(),description:F().optional(),minLength:I().optional(),maxLength:I().optional(),format:W([`email`,`uri`,`date`,`date-time`]).optional(),default:F().optional()}),bd=B({type:W([`number`,`integer`]),title:F().optional(),description:F().optional(),minimum:I().optional(),maximum:I().optional(),default:I().optional()}),xd=B({type:G(`string`),title:F().optional(),description:F().optional(),enum:z(F()),default:F().optional()}),Sd=B({type:G(`string`),title:F().optional(),description:F().optional(),oneOf:z(B({const:F(),title:F()})),default:F().optional()}),Cd=B({type:G(`string`),title:F().optional(),description:F().optional(),enum:z(F()),enumNames:z(F()).optional(),default:F().optional()}),wd=H([xd,Sd]),Td=B({type:G(`array`),title:F().optional(),description:F().optional(),minItems:I().optional(),maxItems:I().optional(),items:B({type:G(`string`),enum:z(F())}),default:z(F()).optional()}),Ed=B({type:G(`array`),title:F().optional(),description:F().optional(),minItems:I().optional(),maxItems:I().optional(),items:B({anyOf:z(B({const:F(),title:F()}))}),default:z(F()).optional()}),Dd=H([Td,Ed]),Od=H([Cd,wd,Dd]),kd=H([Od,vd,yd,bd]),Ad=hl.extend({mode:G(`form`).optional(),message:F(),requestedSchema:B({type:G(`object`),properties:U(F(),kd),required:z(F()).optional()}).catchall(R())}),jd=hl.extend({mode:G(`url`),message:F(),elicitationId:F(),url:F().url()}),Md=H([Ad,jd]),Nd=gl.extend({method:G(`elicitation/create`),params:Md}),Pd=_l.extend({elicitationId:F()}),Fd=vl.extend({method:G(`notifications/elicitation/complete`),params:Pd}),Id=bl.extend({action:W([`accept`,`decline`,`cancel`]),content:Kc(e=>e===null?void 0:e,U(F(),H([F(),I(),L(),z(F())])).optional())}),Ld=B({type:G(`ref/resource`),uri:F()}),Rd=B({type:G(`ref/prompt`),name:F()}),zd=ml.extend({ref:H([Rd,Ld]),argument:B({name:F(),value:F()}),context:B({arguments:U(F(),F()).optional()}).optional()}),Bd=gl.extend({method:G(`completion/complete`),params:zd}),Vd=bl.extend({completion:V({values:z(F()).max(100),total:K(I().int()),hasMore:K(L())})}),Hd=B({uri:F().startsWith(`file://`),name:F().optional(),_meta:U(F(),R()).optional()}),Ud=gl.extend({method:G(`roots/list`),params:ml.optional()}),Wd=bl.extend({roots:z(Hd)}),Gd=vl.extend({method:G(`notifications/roots/list_changed`),params:_l.optional()}),Kd=V({ttl:I().optional(),pollInterval:I().optional()}),qd=W([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Jd=B({taskId:F(),status:qd,ttl:H([I(),ac()]),createdAt:F(),lastUpdatedAt:F(),pollInterval:K(I()),statusMessage:K(F())}),Yd=bl.extend({task:Jd}),Xd=_l.merge(Jd),Zd=vl.extend({method:G(`notifications/tasks/status`),params:Xd}),Qd=gl.extend({method:G(`tasks/get`),params:ml.extend({taskId:F()})}),$d=bl.merge(Jd),ef=gl.extend({method:G(`tasks/result`),params:ml.extend({taskId:F()})}),tf=bl.loose(),nf=Zl.extend({method:G(`tasks/list`)}),rf=Ql.extend({tasks:z(Jd)}),af=gl.extend({method:G(`tasks/cancel`),params:ml.extend({taskId:F()})}),of=bl.merge(Jd),sf=H([Kl,Bl,Wl,Bd,id,Pu,ju,su,lu,pu,_u,yu,Su,$u,Ju]),cf=H([Al,Yl,Ul,Gd]),lf=H([Ol,gd,_d,Id,Wd]),uf=H([Kl,hd,Nd,Ud]),df=H([Al,Yl,od,Ou,hu,ed,Wu,wu,Fd]),ff=H([Ol,Hl,Gl,Vd,Uu,Mu,cu,uu,mu,Xu,Yu,Eu]),pf=Is().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:qc.custom,message:`URL must be parseable`,fatal:!0}),Ve}).refine(e=>{let t=new URL(e);return t.protocol!==`javascript:`&&t.protocol!==`data:`&&t.protocol!==`vbscript:`},{message:`URL cannot use javascript:, data:, or vbscript: scheme`}),mf=V({resource:F().url(),authorization_servers:z(pf).optional(),jwks_uri:F().url().optional(),scopes_supported:z(F()).optional(),bearer_methods_supported:z(F()).optional(),resource_signing_alg_values_supported:z(F()).optional(),resource_name:F().optional(),resource_documentation:F().optional(),resource_policy_uri:F().url().optional(),resource_tos_uri:F().url().optional(),tls_client_certificate_bound_access_tokens:L().optional(),authorization_details_types_supported:z(F()).optional(),dpop_signing_alg_values_supported:z(F()).optional(),dpop_bound_access_tokens_required:L().optional()}),hf=V({issuer:F(),authorization_endpoint:pf,token_endpoint:pf,registration_endpoint:pf.optional(),scopes_supported:z(F()).optional(),response_types_supported:z(F()),response_modes_supported:z(F()).optional(),grant_types_supported:z(F()).optional(),token_endpoint_auth_methods_supported:z(F()).optional(),token_endpoint_auth_signing_alg_values_supported:z(F()).optional(),service_documentation:pf.optional(),revocation_endpoint:pf.optional(),revocation_endpoint_auth_methods_supported:z(F()).optional(),revocation_endpoint_auth_signing_alg_values_supported:z(F()).optional(),introspection_endpoint:F().optional(),introspection_endpoint_auth_methods_supported:z(F()).optional(),introspection_endpoint_auth_signing_alg_values_supported:z(F()).optional(),code_challenge_methods_supported:z(F()).optional(),client_id_metadata_document_supported:L().optional(),authorization_response_iss_parameter_supported:L().optional().catch(void 0),dpop_signing_alg_values_supported:z(F()).optional()}),gf=V({issuer:F(),authorization_endpoint:pf,token_endpoint:pf,userinfo_endpoint:pf.optional(),jwks_uri:pf,registration_endpoint:pf.optional(),scopes_supported:z(F()).optional(),response_types_supported:z(F()),response_modes_supported:z(F()).optional(),grant_types_supported:z(F()).optional(),acr_values_supported:z(F()).optional(),subject_types_supported:z(F()),id_token_signing_alg_values_supported:z(F()),id_token_encryption_alg_values_supported:z(F()).optional(),id_token_encryption_enc_values_supported:z(F()).optional(),userinfo_signing_alg_values_supported:z(F()).optional(),userinfo_encryption_alg_values_supported:z(F()).optional(),userinfo_encryption_enc_values_supported:z(F()).optional(),request_object_signing_alg_values_supported:z(F()).optional(),request_object_encryption_alg_values_supported:z(F()).optional(),request_object_encryption_enc_values_supported:z(F()).optional(),token_endpoint_auth_methods_supported:z(F()).optional(),token_endpoint_auth_signing_alg_values_supported:z(F()).optional(),display_values_supported:z(F()).optional(),claim_types_supported:z(F()).optional(),claims_supported:z(F()).optional(),service_documentation:F().optional(),claims_locales_supported:z(F()).optional(),ui_locales_supported:z(F()).optional(),claims_parameter_supported:L().optional(),request_parameter_supported:L().optional(),request_uri_parameter_supported:L().optional(),require_request_uri_registration:L().optional(),op_policy_uri:pf.optional(),op_tos_uri:pf.optional(),client_id_metadata_document_supported:L().optional(),authorization_response_iss_parameter_supported:L().optional().catch(void 0)}),_f=B({...gf.shape,...hf.pick({code_challenge_methods_supported:!0}).shape}),vf=B({access_token:F(),id_token:F().optional(),token_type:F(),expires_in:Zc().optional(),scope:F().optional(),refresh_token:F().optional(),issuer:F().optional().catch(void 0)}).strip(),yf=B({issued_token_type:G(`urn:ietf:params:oauth:token-type:id-jag`),access_token:F(),token_type:F().optional(),expires_in:I().optional(),scope:F().optional()}).strip(),bf=B({error:F(),error_description:F().optional(),error_uri:F().optional()}),xf=pf.optional().or(G(``).transform(()=>void 0)),Sf=B({redirect_uris:z(pf),token_endpoint_auth_method:F().optional(),grant_types:z(F()).optional(),response_types:z(F()).optional(),application_type:F().optional(),client_name:F().optional(),client_uri:pf.optional(),logo_uri:xf,scope:F().optional(),contacts:z(F()).optional(),tos_uri:xf,policy_uri:F().optional(),jwks_uri:pf.optional(),jwks:sc().optional(),software_id:F().optional(),software_version:F().optional(),software_statement:F().optional()}).strip(),Cf=B({client_id:F(),client_secret:F().optional(),client_id_issued_at:I().optional(),client_secret_expires_at:I().optional(),issuer:F().optional().catch(void 0)}).strip(),wf=Sf.merge(Cf),Tf=B({error:F(),error_description:F().optional()}).strip(),Ef=B({token:F(),token_type_hint:F().optional()}).strip(),Df=Symbol.for(`mcp.sdk.errorBrands`);function Of(e,t){let n=new Set,r=t;for(;typeof r==`function`;){let e=r.mcpBrand;Object.prototype.hasOwnProperty.call(r,`mcpBrand`)&&typeof e==`string`&&n.add(e),r=Object.getPrototypeOf(r)}n.size!==0&&Object.defineProperty(e,Df,{value:n,enumerable:!1,configurable:!0})}function kf(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,Df)){let n=t[Df];if(n&&typeof n.has==`function`&&n.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}(class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthError`})}static[Symbol.hasInstance](e){return kf(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return kf(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,Of(this,new.target)}toResponseObject(){let e={error:this.code,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}});var Af=function(e){return e.NotConnected=`NOT_CONNECTED`,e.AlreadyConnected=`ALREADY_CONNECTED`,e.NotInitialized=`NOT_INITIALIZED`,e.CapabilityNotSupported=`CAPABILITY_NOT_SUPPORTED`,e.RequestTimeout=`REQUEST_TIMEOUT`,e.ConnectionClosed=`CONNECTION_CLOSED`,e.SendFailed=`SEND_FAILED`,e.InvalidResult=`INVALID_RESULT`,e.UnsupportedResultType=`UNSUPPORTED_RESULT_TYPE`,e.InputRequiredRoundsExceeded=`INPUT_REQUIRED_ROUNDS_EXCEEDED`,e.ListPaginationExceeded=`LIST_PAGINATION_EXCEEDED`,e.MethodNotSupportedByProtocolVersion=`METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION`,e.EraNegotiationFailed=`ERA_NEGOTIATION_FAILED`,e.ClientHttpNotImplemented=`CLIENT_HTTP_NOT_IMPLEMENTED`,e.ClientHttpAuthentication=`CLIENT_HTTP_AUTHENTICATION`,e.ClientHttpForbidden=`CLIENT_HTTP_FORBIDDEN`,e.ClientHttpUnexpectedContent=`CLIENT_HTTP_UNEXPECTED_CONTENT`,e.ClientHttpFailedToOpenStream=`CLIENT_HTTP_FAILED_TO_OPEN_STREAM`,e.ClientHttpFailedToTerminateSession=`CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION`,e}({}),jf=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkError`})}static[Symbol.hasInstance](e){return kf(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return kf(this,e)}constructor(e,t,n,r){super(t,r),this.code=e,this.data=n,this.name=`SdkError`,Of(this,new.target)}};(class extends jf{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkHttpError`})}constructor(e,t,n,r){super(e,t,n,r),this.name=`SdkHttpError`}get status(){return this.data.status}get statusText(){return this.data.statusText}});var Mf=`2026-07-28`;function Nf(e){return e>=Mf}function Pf(e){let t=e.structuredContent;return t===void 0||typeof t==`object`&&t&&!Array.isArray(t)||(e.content?.some(e=>e.type===`text`)??!1)?e:{...e,content:[...e.content??[],{type:`text`,text:JSON.stringify(t)}]}}var Ff=[`task`,`inputRequests`,`requestState`];function If(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||Ff.some(t=>t in e)?e:{...e,content:[]}}function Lf(){let e=Hc(()=>H([F(),I(),L(),ac(),U(F(),e),z(e)])),t=U(F(),e),n=H([F(),I().int()]),r=F(),i=B({ttl:I().optional()}),a=B({taskId:F()}),o=V({progressToken:n.optional(),"io.modelcontextprotocol/related-task":a.optional()}),s=B({_meta:o.optional()}),c=s.extend({task:i.optional()}),l=B({method:F(),params:s.loose().optional()}),u=B({_meta:o.optional()}),d=B({method:F(),params:u.loose().optional()}),f=V({_meta:o.optional()}),p=H([F(),I().int()]),m=f.strict(),h=u.extend({requestId:p.optional(),reason:F().optional()}),g=d.extend({method:G(`notifications/cancelled`),params:h}),_=B({src:F(),mimeType:F().optional(),sizes:z(F()).optional(),theme:W([`light`,`dark`]).optional()}),v=B({icons:z(_).optional()}),y=B({name:F(),title:F().optional()}),b=y.extend({...y.shape,...v.shape,version:F(),websiteUrl:F().optional(),description:F().optional()}),ee=Kc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,_c(B({form:_c(B({applyDefaults:L().optional()}),t).optional(),url:t.optional()}),t.optional())),x=V({list:t.optional(),cancel:t.optional(),requests:V({sampling:V({createMessage:t.optional()}).optional(),elicitation:V({create:t.optional()}).optional()}).optional()}),te=V({list:t.optional(),cancel:t.optional(),requests:V({tools:V({call:t.optional()}).optional()}).optional()}),ne=B({experimental:U(F(),t).optional(),sampling:B({context:t.optional(),tools:t.optional()}).optional(),elicitation:ee.optional(),roots:B({listChanged:L().optional()}).optional(),tasks:x.optional(),extensions:U(F(),t).optional()}),re=s.extend({protocolVersion:F(),capabilities:ne,clientInfo:b}),ie=l.extend({method:G(`initialize`),params:re}),S=B({experimental:U(F(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:B({listChanged:L().optional()}).optional(),resources:B({subscribe:L().optional(),listChanged:L().optional()}).optional(),tools:B({listChanged:L().optional()}).optional(),tasks:te.optional(),extensions:U(F(),t).optional()}),ae=f.extend({protocolVersion:F(),capabilities:S,serverInfo:b,instructions:F().optional()}),oe=d.extend({method:G(`notifications/initialized`),params:u.optional()}),se=l.extend({method:G(`ping`),params:s.optional()}),C=B({progress:I(),total:K(I()),message:K(F())}),w=B({...u.shape,...C.shape,progressToken:n}),T=d.extend({method:G(`notifications/progress`),params:w}),ce=s.extend({cursor:r.optional()}),E=l.extend({params:ce.optional()}),le=f.extend({nextCursor:r.optional()}),D=B({uri:F(),mimeType:K(F()),_meta:U(F(),R()).optional()}),ue=D.extend({text:F()}),de=F().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),fe=D.extend({blob:de}),pe=W([`user`,`assistant`]),O=B({audience:z(pe).optional(),priority:I().min(0).max(1).optional(),lastModified:Yc({offset:!0}).optional()}),me=B({...y.shape,...v.shape,uri:F(),description:K(F()),mimeType:K(F()),size:K(I()),annotations:O.optional(),_meta:K(V({}))}),he=B({...y.shape,...v.shape,uriTemplate:F(),description:K(F()),mimeType:K(F()),annotations:O.optional(),_meta:K(V({}))}),ge=E.extend({method:G(`resources/list`)}),_e=le.extend({resources:z(me)}),ve=E.extend({method:G(`resources/templates/list`)}),ye=le.extend({resourceTemplates:z(he)}),be=s.extend({uri:F()}),xe=be,Se=l.extend({method:G(`resources/read`),params:xe}),Ce=f.extend({contents:z(H([ue,fe]))}),we=d.extend({method:G(`notifications/resources/list_changed`),params:u.optional()}),Te=be,Ee=l.extend({method:G(`resources/subscribe`),params:Te}),De=be,Oe=l.extend({method:G(`resources/unsubscribe`),params:De}),ke=u.extend({uri:F()}),Ae=d.extend({method:G(`notifications/resources/updated`),params:ke}),je=B({name:F(),description:K(F()),required:K(L())}),Me=B({...y.shape,...v.shape,description:K(F()),arguments:K(z(je)),_meta:K(V({}))}),Ne=E.extend({method:G(`prompts/list`)}),Pe=le.extend({prompts:z(Me)}),Fe=s.extend({name:F(),arguments:U(F(),F()).optional()}),Ie=l.extend({method:G(`prompts/get`),params:Fe}),Le=B({type:G(`text`),text:F(),annotations:O.optional(),_meta:U(F(),R()).optional()}),k=B({type:G(`image`),data:de,mimeType:F(),annotations:O.optional(),_meta:U(F(),R()).optional()}),A=B({type:G(`audio`),data:de,mimeType:F(),annotations:O.optional(),_meta:U(F(),R()).optional()}),Re=B({type:G(`tool_use`),name:F(),id:F(),input:U(F(),R()),_meta:U(F(),R()).optional()}),ze=B({type:G(`resource`),resource:H([ue,fe]),annotations:O.optional(),_meta:U(F(),R()).optional()}),Be=me.extend({type:G(`resource_link`)}),Ve=H([Le,k,A,Be,ze]),He=B({role:pe,content:Ve}),Ue=f.extend({description:F().optional(),messages:z(He)}),We=d.extend({method:G(`notifications/prompts/list_changed`),params:u.optional()}),j=B({title:F().optional(),readOnlyHint:L().optional(),destructiveHint:L().optional(),idempotentHint:L().optional(),openWorldHint:L().optional()}),Ge=B({taskSupport:W([`required`,`optional`,`forbidden`]).optional()}),Ke=B({...y.shape,...v.shape,description:F().optional(),inputSchema:B({type:G(`object`),properties:U(F(),e).optional(),required:z(F()).optional()}).catchall(R()),outputSchema:B({type:G(`object`),properties:U(F(),e).optional(),required:z(F()).optional()}).catchall(R()).optional(),annotations:j.optional(),execution:Ge.optional(),_meta:U(F(),R()).optional()}),qe=E.extend({method:G(`tools/list`)}),Je=le.extend({tools:z(Ke)}),Ye=f.extend({content:z(Ve),structuredContent:U(F(),R()).optional(),isError:L().optional()}),Xe=c.extend({name:F(),arguments:U(F(),R()).optional()}),Ze=l.extend({method:G(`tools/call`),params:Xe}),Qe=d.extend({method:G(`notifications/tools/list_changed`),params:u.optional()}),$e=W([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),et=s.extend({level:$e}),tt=l.extend({method:G(`logging/setLevel`),params:et}),nt=u.extend({level:$e,logger:F().optional(),data:R()}),rt=d.extend({method:G(`notifications/message`),params:nt}),it=B({name:F().optional()}),at=B({hints:z(it).optional(),costPriority:I().min(0).max(1).optional(),speedPriority:I().min(0).max(1).optional(),intelligencePriority:I().min(0).max(1).optional()}),ot=B({mode:W([`auto`,`required`,`none`]).optional()}),st=B({type:G(`tool_result`),toolUseId:F().describe(`The unique identifier for the corresponding tool call.`),content:z(Ve),structuredContent:B({}).loose().optional(),isError:L().optional(),_meta:U(F(),R()).optional()}),ct=hc(`type`,[Le,k,A]),lt=hc(`type`,[Le,k,A,Re,st]),ut=B({role:pe,content:H([lt,z(lt)]),_meta:U(F(),R()).optional()}),dt=c.extend({messages:z(ut),modelPreferences:at.optional(),systemPrompt:F().optional(),includeContext:W([`none`,`thisServer`,`allServers`]).optional(),temperature:I().optional(),maxTokens:I().int(),stopSequences:z(F()).optional(),metadata:t.optional(),tools:z(Ke).optional(),toolChoice:ot.optional()}),ft=l.extend({method:G(`sampling/createMessage`),params:dt}),pt=f.extend({model:F(),stopReason:K(W([`endTurn`,`stopSequence`,`maxTokens`]).or(F())),role:pe,content:ct}),mt=f.extend({model:F(),stopReason:K(W([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(F())),role:pe,content:H([lt,z(lt)])}),ht=B({type:G(`boolean`),title:F().optional(),description:F().optional(),default:L().optional()}),gt=B({type:G(`string`),title:F().optional(),description:F().optional(),minLength:I().optional(),maxLength:I().optional(),format:W([`email`,`uri`,`date`,`date-time`]).optional(),default:F().optional()}),_t=B({type:W([`number`,`integer`]),title:F().optional(),description:F().optional(),minimum:I().optional(),maximum:I().optional(),default:I().optional()}),vt=B({type:G(`string`),title:F().optional(),description:F().optional(),enum:z(F()),default:F().optional()}),yt=B({type:G(`string`),title:F().optional(),description:F().optional(),oneOf:z(B({const:F(),title:F()})),default:F().optional()}),bt=B({type:G(`string`),title:F().optional(),description:F().optional(),enum:z(F()),enumNames:z(F()).optional(),default:F().optional()}),xt=H([vt,yt]),St=B({type:G(`array`),title:F().optional(),description:F().optional(),minItems:I().optional(),maxItems:I().optional(),items:B({type:G(`string`),enum:z(F())}),default:z(F()).optional()}),Ct=B({type:G(`array`),title:F().optional(),description:F().optional(),minItems:I().optional(),maxItems:I().optional(),items:B({anyOf:z(B({const:F(),title:F()}))}),default:z(F()).optional()}),wt=H([St,Ct]),Tt=H([bt,xt,wt]),Et=H([Tt,ht,gt,_t]),Dt=c.extend({mode:G(`form`).optional(),message:F(),requestedSchema:B({type:G(`object`),properties:U(F(),Et),required:z(F()).optional()}).catchall(R())}),Ot=c.extend({mode:G(`url`),message:F(),elicitationId:F(),url:F().url()}),kt=H([Dt,Ot]),At=l.extend({method:G(`elicitation/create`),params:kt}),jt=u.extend({elicitationId:F()}),Mt=d.extend({method:G(`notifications/elicitation/complete`),params:jt}),Nt=f.extend({action:W([`accept`,`decline`,`cancel`]),content:Kc(e=>e===null?void 0:e,U(F(),H([F(),I(),L(),z(F())])).optional())}),Pt=B({type:G(`ref/resource`),uri:F()}),Ft=B({type:G(`ref/prompt`),name:F()}),It=s.extend({ref:H([Ft,Pt]),argument:B({name:F(),value:F()}),context:B({arguments:U(F(),F()).optional()}).optional()}),Lt=l.extend({method:G(`completion/complete`),params:It}),Rt=f.extend({completion:V({values:z(F()).max(100),total:K(I().int()),hasMore:K(L())})}),zt=B({uri:F().startsWith(`file://`),name:F().optional(),_meta:U(F(),R()).optional()}),Bt=l.extend({method:G(`roots/list`),params:s.optional()}),Vt=f.extend({roots:z(zt)}),Ht=d.extend({method:G(`notifications/roots/list_changed`),params:u.optional()}),Ut=V({ttl:I().optional(),pollInterval:I().optional()}),Wt=W([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Gt=B({taskId:F(),status:Wt,ttl:H([I(),ac()]),createdAt:F(),lastUpdatedAt:F(),pollInterval:K(I()),statusMessage:K(F())}),Kt=f.extend({task:Gt}),qt=u.merge(Gt),Jt=d.extend({method:G(`notifications/tasks/status`),params:qt}),Yt=l.extend({method:G(`tasks/get`),params:s.extend({taskId:F()})}),Xt=f.merge(Gt),Zt=l.extend({method:G(`tasks/result`),params:s.extend({taskId:F()})}),Qt=f.loose(),$t=E.extend({method:G(`tasks/list`)}),en=le.extend({tasks:z(Gt)}),tn=l.extend({method:G(`tasks/cancel`),params:s.extend({taskId:F()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,TaskMetadataSchema:i,RelatedTaskMetadataSchema:a,RequestMetaSchema:o,BaseRequestParamsSchema:s,TaskAugmentedRequestParamsSchema:c,RequestSchema:l,NotificationsParamsSchema:u,NotificationSchema:d,ResultSchema:f,RequestIdSchema:p,EmptyResultSchema:m,CancelledNotificationParamsSchema:h,CancelledNotificationSchema:g,IconSchema:_,IconsSchema:v,BaseMetadataSchema:y,ImplementationSchema:b,ClientTasksCapabilitySchema:x,ServerTasksCapabilitySchema:te,ClientCapabilitiesSchema:ne,InitializeRequestParamsSchema:re,InitializeRequestSchema:ie,ServerCapabilitiesSchema:S,InitializeResultSchema:ae,InitializedNotificationSchema:oe,PingRequestSchema:se,ProgressSchema:C,ProgressNotificationParamsSchema:w,ProgressNotificationSchema:T,PaginatedRequestParamsSchema:ce,PaginatedRequestSchema:E,PaginatedResultSchema:le,ResourceContentsSchema:D,TextResourceContentsSchema:ue,BlobResourceContentsSchema:fe,RoleSchema:pe,AnnotationsSchema:O,ResourceSchema:me,ResourceTemplateSchema:he,ListResourcesRequestSchema:ge,ListResourcesResultSchema:_e,ListResourceTemplatesRequestSchema:ve,ListResourceTemplatesResultSchema:ye,ResourceRequestParamsSchema:be,ReadResourceRequestParamsSchema:xe,ReadResourceRequestSchema:Se,ReadResourceResultSchema:Ce,ResourceListChangedNotificationSchema:we,SubscribeRequestParamsSchema:Te,SubscribeRequestSchema:Ee,UnsubscribeRequestParamsSchema:De,UnsubscribeRequestSchema:Oe,ResourceUpdatedNotificationParamsSchema:ke,ResourceUpdatedNotificationSchema:Ae,PromptArgumentSchema:je,PromptSchema:Me,ListPromptsRequestSchema:Ne,ListPromptsResultSchema:Pe,GetPromptRequestParamsSchema:Fe,GetPromptRequestSchema:Ie,TextContentSchema:Le,ImageContentSchema:k,AudioContentSchema:A,ToolUseContentSchema:Re,EmbeddedResourceSchema:ze,ResourceLinkSchema:Be,ContentBlockSchema:Ve,PromptMessageSchema:He,GetPromptResultSchema:Ue,PromptListChangedNotificationSchema:We,ToolAnnotationsSchema:j,ToolExecutionSchema:Ge,ToolSchema:Ke,ListToolsRequestSchema:qe,ListToolsResultSchema:Je,CallToolResultSchema:Ye,CallToolRequestParamsSchema:Xe,CallToolRequestSchema:Ze,ToolListChangedNotificationSchema:Qe,LoggingLevelSchema:$e,SetLevelRequestParamsSchema:et,SetLevelRequestSchema:tt,LoggingMessageNotificationParamsSchema:nt,LoggingMessageNotificationSchema:rt,ModelHintSchema:it,ModelPreferencesSchema:at,ToolChoiceSchema:ot,ToolResultContentSchema:st,SamplingContentSchema:ct,SamplingMessageContentBlockSchema:lt,SamplingMessageSchema:ut,CreateMessageRequestParamsSchema:dt,CreateMessageRequestSchema:ft,CreateMessageResultSchema:pt,CreateMessageResultWithToolsSchema:mt,BooleanSchemaSchema:ht,StringSchemaSchema:gt,NumberSchemaSchema:_t,UntitledSingleSelectEnumSchemaSchema:vt,TitledSingleSelectEnumSchemaSchema:yt,LegacyTitledEnumSchemaSchema:bt,SingleSelectEnumSchemaSchema:xt,UntitledMultiSelectEnumSchemaSchema:St,TitledMultiSelectEnumSchemaSchema:Ct,MultiSelectEnumSchemaSchema:wt,EnumSchemaSchema:Tt,PrimitiveSchemaDefinitionSchema:Et,ElicitRequestFormParamsSchema:Dt,ElicitRequestURLParamsSchema:Ot,ElicitRequestParamsSchema:kt,ElicitRequestSchema:At,ElicitationCompleteNotificationParamsSchema:jt,ElicitationCompleteNotificationSchema:Mt,ElicitResultSchema:Nt,ResourceTemplateReferenceSchema:Pt,PromptReferenceSchema:Ft,CompleteRequestParamsSchema:It,CompleteRequestSchema:Lt,CompleteResultSchema:Rt,RootSchema:zt,ListRootsRequestSchema:Bt,ListRootsResultSchema:Vt,RootsListChangedNotificationSchema:Ht,TaskCreationParamsSchema:Ut,TaskStatusSchema:Wt,TaskSchema:Gt,CreateTaskResultSchema:Kt,TaskStatusNotificationParamsSchema:qt,TaskStatusNotificationSchema:Jt,GetTaskRequestSchema:Yt,GetTaskResultSchema:Xt,GetTaskPayloadRequestSchema:Zt,GetTaskPayloadResultSchema:Qt,ListTasksRequestSchema:$t,ListTasksResultSchema:en,CancelTaskRequestSchema:tn,CancelTaskResultSchema:f.merge(Gt),ClientRequestSchema:H([se,ie,Lt,tt,Ie,Ne,ge,ve,Se,Ee,Oe,Ze,qe,Yt,Zt,$t,tn]),ClientNotificationSchema:H([g,T,oe,Ht,Jt]),ClientResultSchema:H([m,pt,mt,Nt,Vt,Xt,en,Kt]),ServerRequestSchema:H([se,ft,At,Bt,Yt,Zt,$t,tn]),ServerNotificationSchema:H([g,T,rt,Ae,we,Qe,We,Jt,Mt]),ServerResultSchema:H([m,ae,Rt,Ue,Pe,_e,ye,Ce,Ye,Je,Xt,en,Kt]),CallToolResultWireSchema:R().superRefine((e,t)=>{if(typeof e==`object`&&e&&!Array.isArray(e)&&e.content===void 0){for(let n of Ff)if(n in e){t.addIssue({code:`custom`,message:`content is required when the body carries '${n}' — another result family cannot default into an empty tools/call success`});return}}}).transform(If).pipe(Ye)}}var Rf;function zf(){return Rf??=Lf()}function Bf(e){return e.type!==`object`}var Vf=new Set([`const`,`enum`,`default`,`examples`]),Hf=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function Uf(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function Wf(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(Uf(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=i(e.$schema)&&e.$recursiveAnchor!==!0,r=(e,t)=>{if(Array.isArray(e))return e.map(e=>r(e,!1));if(typeof e!=`object`||!e||!t&&Uf(e.$id))return e;let i={},a=!1;for(let[o,s]of Object.entries(e))t?i[o]=r(s,!1):(o===`$ref`||o===`$dynamicRef`)&&typeof s==`string`?i[o]=s===`#`?`#/properties/result`:s.startsWith(`#/`)?`#/properties/result${s.slice(1)}`:s:o===`$recursiveRef`&&s===`#`&&n?a=!0:i[o]=Vf.has(o)?s:Hf.has(o)?r(s,!0):r(s,!1);return a&&(`$ref`in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:`#/properties/result`}]:i.$ref=`#/properties/result`),i};return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:r(e,!1)},required:[`result`]}}var Gf={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Kf={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},qf={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Jf;function Yf(){if(Jf)return Jf;let e=zf();return Jf={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},Jf}function Xf(e){return Object.prototype.hasOwnProperty.call(Gf,e)}function Zf(e){return Object.prototype.hasOwnProperty.call(Kf,e)}function Qf(e){return Object.prototype.hasOwnProperty.call(qf,e)}function $f(e){return Qf(e)?Yf().resultSchemas[e]:void 0}function ep(e){return Xf(e)?Yf().requestSchemas[e]:void 0}function tp(e){return Zf(e)?Yf().notificationSchemas[e]:void 0}Object.keys(Gf),Object.keys(Kf);function np(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function rp(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var ip={ok:!1,reason:`not-in-era`};function ap(e){return np(e)&&np(e.outputSchema)&&Bf(e.outputSchema)}function op(e){return e}var sp={era:`2025-11-25`,hasRequestMethod:Xf,hasNotificationMethod:Zf,validateRequest:(e,t)=>rp(ep(e),t),validateResult:(e,t)=>rp($f(e),t),validateNotification:(e,t)=>rp(tp(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>ip,validateInputResponse:()=>ip,samplingResultVariant:((e,t)=>{let n=zf();return rp(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=Pf(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&Bf(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(np(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:op(e)}}return{kind:`complete`,result:op(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>ap(e))?t:{...t,tools:n.map(e=>ap(e)?{...e,outputSchema:Wf(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function cp(){let e=Hc(()=>H([F(),I(),L(),ac(),U(F(),e),z(e)])),t=U(F(),e),n=H([F(),I().int()]),r=F(),i=H([F(),I().int()]),a=W([`user`,`assistant`]),o=W([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),s=F().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),c=B({ttl:I().optional()}),l=B({taskId:F()}),u=V({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),d=B({_meta:u.optional()}),f=d.extend({task:c.optional()}),p=B({_meta:u.optional()}),m=B({method:F(),params:p.loose().optional()}),h=B({src:F(),mimeType:F().optional(),sizes:z(F()).optional(),theme:W([`light`,`dark`]).optional()}),g=B({icons:z(h).optional()}),_=B({name:F(),title:F().optional()}),v=_.extend({..._.shape,...g.shape,version:F(),websiteUrl:F().optional(),description:F().optional()}),y=Kc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,_c(B({form:_c(B({applyDefaults:L().optional()}),t).optional(),url:t.optional()}),t.optional())),b=V({list:t.optional(),cancel:t.optional(),requests:V({sampling:V({createMessage:t.optional()}).optional(),elicitation:V({create:t.optional()}).optional()}).optional()}),ee=V({list:t.optional(),cancel:t.optional(),requests:V({tools:V({call:t.optional()}).optional()}).optional()}),x=B({experimental:U(F(),t).optional(),sampling:B({context:t.optional(),tools:t.optional()}).optional(),elicitation:y.optional(),roots:B({listChanged:L().optional()}).optional(),tasks:b.optional(),extensions:U(F(),t).optional()}),te=B({experimental:U(F(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:B({listChanged:L().optional()}).optional(),resources:B({subscribe:L().optional(),listChanged:L().optional()}).optional(),tools:B({listChanged:L().optional()}).optional(),tasks:ee.optional(),extensions:U(F(),t).optional()}),ne=B({progress:I(),total:K(I()),message:K(F())}),re=B({...p.shape,...ne.shape,progressToken:n}),ie=m.extend({method:G(`notifications/progress`),params:re}),S=p.extend({level:o,logger:F().optional(),data:R()}),ae=m.extend({method:G(`notifications/message`),params:S}),oe=B({uri:F(),mimeType:K(F()),_meta:U(F(),R()).optional()}),se=oe.extend({text:F()}),C=oe.extend({blob:s}),w=B({audience:z(a).optional(),priority:I().min(0).max(1).optional(),lastModified:Yc({offset:!0}).optional()}),T=B({..._.shape,...g.shape,uri:F(),description:K(F()),mimeType:K(F()),size:K(I()),annotations:w.optional(),_meta:K(V({}))}),ce=B({..._.shape,...g.shape,uriTemplate:F(),description:K(F()),mimeType:K(F()),annotations:w.optional(),_meta:K(V({}))}),E=m.extend({method:G(`notifications/resources/list_changed`),params:p.optional()}),le=p.extend({uri:F()}),D=m.extend({method:G(`notifications/resources/updated`),params:le}),ue=B({name:F(),description:K(F()),required:K(L())}),de=B({..._.shape,...g.shape,description:K(F()),arguments:K(z(ue)),_meta:K(V({}))}),fe=m.extend({method:G(`notifications/prompts/list_changed`),params:p.optional()}),pe=B({type:G(`text`),text:F(),annotations:w.optional(),_meta:U(F(),R()).optional()}),O=B({type:G(`image`),data:s,mimeType:F(),annotations:w.optional(),_meta:U(F(),R()).optional()}),me=B({type:G(`audio`),data:s,mimeType:F(),annotations:w.optional(),_meta:U(F(),R()).optional()}),he=B({type:G(`tool_use`),name:F(),id:F(),input:U(F(),R()),_meta:U(F(),R()).optional()}),ge=B({type:G(`resource`),resource:H([se,C]),annotations:w.optional(),_meta:U(F(),R()).optional()}),_e=T.extend({type:G(`resource_link`)}),ve=H([pe,O,me,_e,ge]),ye=B({role:a,content:ve}),be=B({title:F().optional(),readOnlyHint:L().optional(),destructiveHint:L().optional(),idempotentHint:L().optional(),openWorldHint:L().optional()}),xe=m.extend({method:G(`notifications/tools/list_changed`),params:p.optional()}),Se=B({name:F().optional()}),Ce=B({hints:z(Se).optional(),costPriority:I().min(0).max(1).optional(),speedPriority:I().min(0).max(1).optional(),intelligencePriority:I().min(0).max(1).optional()}),we=B({mode:W([`auto`,`required`,`none`]).optional()}),Te=B({type:G(`boolean`),title:F().optional(),description:F().optional(),default:L().optional()}),Ee=B({type:G(`string`),title:F().optional(),description:F().optional(),minLength:I().optional(),maxLength:I().optional(),format:W([`email`,`uri`,`date`,`date-time`]).optional(),default:F().optional()}),De=B({type:W([`number`,`integer`]),title:F().optional(),description:F().optional(),minimum:I().optional(),maximum:I().optional(),default:I().optional()}),Oe=B({type:G(`string`),title:F().optional(),description:F().optional(),enum:z(F()),default:F().optional()}),ke=B({type:G(`string`),title:F().optional(),description:F().optional(),oneOf:z(B({const:F(),title:F()})),default:F().optional()}),Ae=B({type:G(`string`),title:F().optional(),description:F().optional(),enum:z(F()),enumNames:z(F()).optional(),default:F().optional()}),je=H([Oe,ke]),Me=B({type:G(`array`),title:F().optional(),description:F().optional(),minItems:I().optional(),maxItems:I().optional(),items:B({type:G(`string`),enum:z(F())}),default:z(F()).optional()}),Ne=B({type:G(`array`),title:F().optional(),description:F().optional(),minItems:I().optional(),maxItems:I().optional(),items:B({anyOf:z(B({const:F(),title:F()}))}),default:z(F()).optional()}),Pe=H([Me,Ne]),Fe=H([Ae,je,Pe]),Ie=H([Fe,Te,Ee,De]),Le=f.extend({mode:G(`form`).optional(),message:F(),requestedSchema:B({type:G(`object`),properties:U(F(),Ie),required:z(F()).optional()}).catchall(R())}),k=B({type:G(`ref/resource`),uri:F()}),A=B({type:G(`ref/prompt`),name:F()}),Re=B({uri:F().startsWith(`file://`),name:F().optional(),_meta:U(F(),R()).optional()}),ze=x.shape,Be=B({experimental:ze.experimental,sampling:ze.sampling,elicitation:ze.elicitation,roots:ze.roots,extensions:ze.extensions}),Ve=te.shape,He=B({experimental:Ve.experimental,logging:Ve.logging,completions:Ve.completions,prompts:Ve.prompts,resources:Ve.resources,tools:Ve.tools,extensions:Ve.extensions}),Ue=V({progressToken:n.optional(),[el]:F(),[tl]:v.optional(),[rl]:Be,[al]:o.optional()}),We=B({..._.shape,...g.shape,description:F().optional(),inputSchema:V({$schema:F().optional(),type:G(`object`)}),outputSchema:V({$schema:F().optional()}).optional(),annotations:be.optional(),_meta:U(F(),R()).optional()}),j=B({type:G(`tool_result`),toolUseId:F(),content:z(ve),structuredContent:R().optional(),isError:L().optional(),_meta:U(F(),R()).optional()}),Ge=H([pe,O,me,he,j]),Ke=B({role:a,content:H([Ge,z(Ge)]),_meta:U(F(),R()).optional()}),qe=F(),Je=V({[nl]:v.optional().catch(void 0)}),Ye=Je.optional();function Xe(e){return V({_meta:Ye,resultType:qe.default(`complete`),...e})}let Ze=Xe({}),Qe=Xe({nextCursor:r.optional()}),$e=Xe({content:z(ve),structuredContent:R().optional(),isError:L().optional()}),et=Xe({ttlMs:I().int().min(0),cacheScope:W([`public`,`private`]),tools:z(We),nextCursor:r.optional()}),tt=Xe({ttlMs:I().int().min(0),cacheScope:W([`public`,`private`]),prompts:z(de),nextCursor:r.optional()}),nt=Xe({description:F().optional(),messages:z(ye)}),rt=Xe({ttlMs:I().int().min(0),cacheScope:W([`public`,`private`]),resources:z(T),nextCursor:r.optional()}),it=Xe({ttlMs:I().int().min(0),cacheScope:W([`public`,`private`]),resourceTemplates:z(ce),nextCursor:r.optional()}),at=Xe({ttlMs:I().int().min(0),cacheScope:W([`public`,`private`]),contents:z(H([se,C]))}),ot=Xe({completion:B({values:z(F()).max(100),total:I().int().optional(),hasMore:L().optional()}).loose()}),st=Xe({ttlMs:I().int().min(0),cacheScope:W([`public`,`private`])}),ct=Xe({ttlMs:I().int().min(0).catch(0),cacheScope:W([`public`,`private`]).catch(`private`),supportedVersions:z(F()),capabilities:He,instructions:F().optional()}),lt=B({messages:z(Ke),modelPreferences:Ce.optional(),systemPrompt:F().optional(),includeContext:W([`none`,`thisServer`,`allServers`]).optional(),temperature:I().optional(),maxTokens:I().int(),stopSequences:z(F()).optional(),metadata:t.optional(),tools:z(We).optional(),toolChoice:we.optional()}),ut=B({method:G(`sampling/createMessage`),params:lt}),dt=B({method:G(`roots/list`),params:B({_meta:U(F(),R()).optional()}).optional()}),ft=B({...Ke.shape,model:F(),stopReason:F().optional()}),pt=B({roots:z(Re)}),mt=B({action:W([`accept`,`decline`,`cancel`]),content:U(F(),H([F(),I(),L(),z(F())])).optional()}),ht=B({mode:G(`url`),message:F(),url:F().url()}),gt=H([Le,ht]),_t=B({method:G(`elicitation/create`),params:gt}),vt=H([ut,dt,_t]),yt=H([ft,pt,mt]),bt=U(F(),vt),xt=U(F(),yt),St=Xe({inputRequests:bt.optional(),requestState:F().optional()}),Ct={inputResponses:xt.optional(),requestState:F().optional()},wt=B({_meta:Ue,...Ct}),Tt=V({progressToken:n.optional()});function Et(e,t){return B({method:G(e),params:B({_meta:Ue,...t})})}function Dt(e,t){return B({method:G(e),params:B({_meta:Tt.optional(),...t}).optional()})}let Ot={name:F(),arguments:U(F(),R()).optional(),...Ct},kt={cursor:r.optional()},At=Et(`tools/call`,Ot),jt=Et(`tools/list`,kt),Mt=Et(`prompts/list`,kt),Nt=Et(`prompts/get`,{name:F(),arguments:U(F(),F()).optional(),...Ct}),Pt=Et(`resources/list`,kt),Ft=Et(`resources/templates/list`,kt),It=Et(`resources/read`,{uri:F(),...Ct}),Lt={ref:H([A,k]),argument:B({name:F(),value:F()}),context:B({arguments:U(F(),F()).optional()}).optional()},Rt=Et(`completion/complete`,Lt),zt=Et(`server/discover`,{}),Bt=B({toolsListChanged:L().optional(),promptsListChanged:L().optional(),resourcesListChanged:L().optional(),resourceSubscriptions:z(F()).optional()}),Vt={notifications:Bt},Ht=Et(`subscriptions/listen`,Vt),Ut=Je.extend({"io.modelcontextprotocol/subscriptionId":i}),Wt=V({_meta:Ut,resultType:qe.default(`complete`)}),Gt={"tools/call":Dt(`tools/call`,Ot),"tools/list":Dt(`tools/list`,kt),"prompts/get":Dt(`prompts/get`,{name:F(),arguments:U(F(),F()).optional()}),"prompts/list":Dt(`prompts/list`,kt),"resources/list":Dt(`resources/list`,kt),"resources/templates/list":Dt(`resources/templates/list`,kt),"resources/read":Dt(`resources/read`,{uri:F()}),"completion/complete":Dt(`completion/complete`,Lt),"server/discover":Dt(`server/discover`,{}),"subscriptions/listen":Dt(`subscriptions/listen`,Vt)};function Kt(e){return V({_meta:Ye,...e})}let qt={"tools/call":Kt({content:z(ve),structuredContent:R().optional(),isError:L().optional()}),"tools/list":Kt({ttlMs:I().int().min(0),cacheScope:W([`public`,`private`]),tools:z(We),nextCursor:r.optional()}),"prompts/get":Kt({description:F().optional(),messages:z(ye)}),"prompts/list":Kt({ttlMs:I().int().min(0),cacheScope:W([`public`,`private`]),prompts:z(de),nextCursor:r.optional()}),"resources/list":Kt({ttlMs:I().int().min(0),cacheScope:W([`public`,`private`]),resources:z(T),nextCursor:r.optional()}),"resources/templates/list":Kt({ttlMs:I().int().min(0),cacheScope:W([`public`,`private`]),resourceTemplates:z(ce),nextCursor:r.optional()}),"resources/read":Kt({ttlMs:I().int().min(0),cacheScope:W([`public`,`private`]),contents:z(H([se,C]))}),"completion/complete":Kt({completion:B({values:z(F()).max(100),total:I().int().optional(),hasMore:L().optional()}).loose()}),"server/discover":Kt({ttlMs:I().int().min(0).catch(0),cacheScope:W([`public`,`private`]).catch(`private`),supportedVersions:z(F()),capabilities:He,instructions:F().optional()}),"subscriptions/listen":Kt({})},Jt=V({"io.modelcontextprotocol/subscriptionId":i.optional()}),Yt=B({method:G(`notifications/subscriptions/acknowledged`),params:B({_meta:Jt.optional(),notifications:Bt})}),Xt=B({_meta:Jt.optional(),requestId:i,reason:F().optional()}),Zt=B({method:G(`notifications/cancelled`),params:Xt}),Qt={"notifications/cancelled":Zt,"notifications/progress":ie,"notifications/message":ae,"notifications/resources/updated":D,"notifications/resources/list_changed":E,"notifications/tools/list_changed":xe,"notifications/prompts/list_changed":fe,"notifications/subscriptions/acknowledged":Yt},$t=e=>B({jsonrpc:G(`2.0`),id:H([F(),I().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,RequestIdSchema:i,RoleSchema:a,LoggingLevelSchema:o,TaskMetadataSchema:c,RelatedTaskMetadataSchema:l,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:f,NotificationsParamsSchema:p,NotificationSchema:m,IconSchema:h,IconsSchema:g,BaseMetadataSchema:_,ImplementationSchema:v,ClientTasksCapabilitySchema:b,ServerTasksCapabilitySchema:ee,ClientCapabilitiesSchema:x,ServerCapabilitiesSchema:te,ProgressSchema:ne,ProgressNotificationParamsSchema:re,ProgressNotificationSchema:ie,LoggingMessageNotificationParamsSchema:S,LoggingMessageNotificationSchema:ae,ResourceContentsSchema:oe,TextResourceContentsSchema:se,BlobResourceContentsSchema:C,AnnotationsSchema:w,ResourceSchema:T,ResourceTemplateSchema:ce,ResourceListChangedNotificationSchema:E,ResourceUpdatedNotificationParamsSchema:le,ResourceUpdatedNotificationSchema:D,PromptArgumentSchema:ue,PromptSchema:de,PromptListChangedNotificationSchema:fe,TextContentSchema:pe,ImageContentSchema:O,AudioContentSchema:me,ToolUseContentSchema:he,EmbeddedResourceSchema:ge,ResourceLinkSchema:_e,ContentBlockSchema:ve,PromptMessageSchema:ye,ToolAnnotationsSchema:be,ToolListChangedNotificationSchema:xe,ModelHintSchema:Se,ModelPreferencesSchema:Ce,ToolChoiceSchema:we,BooleanSchemaSchema:Te,StringSchemaSchema:Ee,NumberSchemaSchema:De,UntitledSingleSelectEnumSchemaSchema:Oe,TitledSingleSelectEnumSchemaSchema:ke,LegacyTitledEnumSchemaSchema:Ae,SingleSelectEnumSchemaSchema:je,UntitledMultiSelectEnumSchemaSchema:Me,TitledMultiSelectEnumSchemaSchema:Ne,MultiSelectEnumSchemaSchema:Pe,EnumSchemaSchema:Fe,PrimitiveSchemaDefinitionSchema:Ie,ElicitRequestFormParamsSchema:Le,ResourceTemplateReferenceSchema:k,PromptReferenceSchema:A,RootSchema:Re,ClientCapabilities2026Schema:Be,ServerCapabilities2026Schema:He,RequestMetaEnvelopeSchema:Ue,ToolSchema:We,ToolResultContentSchema:j,SamplingMessageContentBlockSchema:Ge,SamplingMessageSchema:Ke,ResultTypeSchema:qe,ResultMetaSchema:Je,ResultSchema:Ze,PaginatedResultSchema:Qe,CallToolResultSchema:$e,ListToolsResultSchema:et,ListPromptsResultSchema:tt,GetPromptResultSchema:nt,ListResourcesResultSchema:rt,ListResourceTemplatesResultSchema:it,ReadResourceResultSchema:at,CompleteResultSchema:ot,CacheableResultSchema:st,DiscoverResultSchema:ct,CreateMessageRequestParamsSchema:lt,CreateMessageRequestSchema:ut,ListRootsRequestSchema:dt,CreateMessageResultSchema:ft,ListRootsResultSchema:pt,ElicitResultSchema:mt,ElicitRequestURLParamsSchema:ht,ElicitRequestParamsSchema:gt,ElicitRequestSchema:_t,InputRequestSchema:vt,InputResponseSchema:yt,InputRequestsSchema:bt,InputResponsesSchema:xt,InputRequiredResultSchema:St,InputResponseRequestParamsSchema:wt,CallToolRequestSchema:At,ListToolsRequestSchema:jt,ListPromptsRequestSchema:Mt,GetPromptRequestSchema:Nt,ListResourcesRequestSchema:Pt,ListResourceTemplatesRequestSchema:Ft,ReadResourceRequestSchema:It,CompleteRequestSchema:Rt,DiscoverRequestSchema:zt,SubscriptionFilterSchema:Bt,SubscriptionsListenRequestSchema:Ht,SubscriptionsListenResultMetaSchema:Ut,SubscriptionsListenResultSchema:Wt,dispatchRequestSchemas:Gt,dispatchResultSchemas:qt,NotificationMetaSchema:Jt,SubscriptionsAcknowledgedNotificationSchema:Yt,CancelledNotificationParamsSchema:Xt,CancelledNotificationSchema:Zt,notificationSchemas2026:Qt,JSONRPCResultResponseSchema:$t(Ze),CallToolResultResponseSchema:$t(H([$e,St])),ListToolsResultResponseSchema:$t(et),ListPromptsResultResponseSchema:$t(tt),GetPromptResultResponseSchema:$t(H([nt,St])),ListResourcesResultResponseSchema:$t(rt),ListResourceTemplatesResultResponseSchema:$t(it),ReadResourceResultResponseSchema:$t(H([at,St])),CompleteResultResponseSchema:$t(ot),DiscoverResultResponseSchema:$t(ct),SubscriptionsListenResultResponseSchema:$t(Wt)}}var lp;function up(){return lp??=cp()}var dp=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function fp(e){return dp.includes(e)}var pp=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function mp(e){return e[pp]}function hp(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function gp(e){return e===`public`||e===`private`}var q=function(e){return e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.ResourceNotFound=-32002]=`ResourceNotFound`,e[e.MissingRequiredClientCapability=-32021]=`MissingRequiredClientCapability`,e[e.UnsupportedProtocolVersion=-32022]=`UnsupportedProtocolVersion`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`,e}({}),_p=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ProtocolError`})}static[Symbol.hasInstance](e){return kf(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return kf(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,Of(this,new.target)}static fromError(t,n,r){if(t===q.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new yp(e.elicitations,n)}if(t===q.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new bp({supported:e.supported,requested:e.requested},n)}if(t===q.InvalidParams||t===q.ResourceNotFound){let e=r;if(typeof e?.uri==`string`&&(t===q.ResourceNotFound||Object.keys(e).length===1))return new vp(e.uri,n)}if(t===q.MissingRequiredClientCapability&&r){let e=r;if(e.requiredCapabilities!==null&&typeof e.requiredCapabilities==`object`&&!Array.isArray(e.requiredCapabilities))return new xp({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},vp=class extends _p{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ResourceNotFoundError`})}constructor(e,t=`Resource not found: ${e}`){super(q.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},yp=class extends _p{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UrlElicitationRequiredError`})}constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(q.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},bp=class extends _p{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnsupportedProtocolVersionError`})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(q.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},xp=class extends _p{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.MissingRequiredClientCapabilityError`})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(`, `)}`){super(q.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},Sp=0,Cp=`private`,wp=[`tools/call`,`prompts/get`,`resources/read`];function Tp(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||wp.includes(e))return t;throw new _p(q.InternalError,`Handler for ${e} returned resultType '${String(n)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function Ep(e,t){let n=mp(t);if(t.resultType!==`complete`||!fp(e))return n===void 0?t:jp(t);let r=t,i=hp(r.ttlMs)?r.ttlMs:kp(n),a=gp(r.cacheScope)?r.cacheScope:Ap(n),o={...r,ttlMs:i,cacheScope:a};return delete o[pp],o}function Dp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Op(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[nl]:t}}:!Dp(n)||n[`io.modelcontextprotocol/serverInfo`]!==void 0?e:{...e,_meta:{...n,[nl]:t}}}function kp(e){return e!==void 0&&hp(e.ttlMs)?e.ttlMs:Sp}function Ap(e){return e!==void 0&&gp(e.cacheScope)?e.cacheScope:Cp}function jp(e){let t={...e};return delete t[pp],t}var Mp=[`elicitation/create`,`sampling/createMessage`,`roots/list`],Np;function Pp(){if(Np)return Np;let e=up();return Np={request:{"elicitation/create":B({method:G(`elicitation/create`),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":B({method:G(`sampling/createMessage`),params:e.CreateMessageRequestParamsSchema}),"roots/list":B({method:G(`roots/list`),params:V({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Np}function Fp(e){return Mp.includes(e)}function Ip(e){return Fp(e)?Pp().request[e]:void 0}function Lp(e){return Fp(e)?Pp().response[e]:void 0}var Rp={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},zp={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function Bp(e){return Object.prototype.hasOwnProperty.call(Rp,e)}function Vp(e){return Object.prototype.hasOwnProperty.call(zp,e)}function Hp(e){return Object.prototype.hasOwnProperty.call(Rp,e)}function Up(e){return Bp(e)?up().dispatchRequestSchemas[e]:void 0}function Wp(e){return Hp(e)?up().dispatchResultSchemas[e]:void 0}function Gp(e){return Vp(e)?up().notificationSchemas2026[e]:void 0}Object.keys(Rp),Object.keys(zp);function Kp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function qp(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var Jp={ok:!1,reason:`not-in-era`},Yp=[el,rl];function Xp(e,t){let n=t,r=!1,i=()=>(r||=(n={...n},!0),n),a=t.tools;e===`tools/list`&&Array.isArray(a)&&a.some(e=>Kp(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!Kp(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(Kp(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}var Zp={era:`2026-07-28`,hasRequestMethod:Bp,hasNotificationMethod:Vp,hasInputRequestMethod:e=>Ip(e)!==void 0,validateRequest:(e,t)=>qp(Up(e),t),validateResult:(e,t)=>qp(Wp(e),t),validateNotification:(e,t)=>qp(Gp(e),t),validateInputRequest:(e,t)=>qp(Ip(e),t),validateInputResponse:(e,t)=>qp(Lp(e),t),samplingResultVariant:()=>Jp,outboundEnvelope(e){return{[el]:e.protocolVersion,[tl]:e.clientInfo,[rl]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of Yp)n in e||t.push({key:n,problem:`missing`});let n=up().RequestMetaEnvelopeSchema.safeParse(e);if(!n.success)for(let e of n.error.issues){let n=e.path.map(String),r=n.length>0?n.join(`.`):`_meta`;n.length===1&&t.some(e=>e.key===r&&e.problem===`missing`)||t.push({key:r,problem:e.message})}return t},projectCallToolResult:e=>Pf(e),inputRequestSchema:Ip,decodeResult(e,t){if(!Kp(t))return{kind:`invalid`,error:new jf(Af.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let n=t.resultType;if(n===void 0)return{kind:`invalid`,error:new jf(Af.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:`missing-resultType`})};if(typeof n!=`string`)return{kind:`invalid`,error:new jf(Af.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:n})};if(n===`input_required`){let n=t.inputRequests,r=Kp(n)?n:{},i=t.requestState,a=t._meta===void 0?void 0:up().ResultMetaSchema.safeParse(t._meta),o=a?.success?a.data:void 0;return Object.keys(r).length===0&&typeof i!=`string`?{kind:`invalid`,error:new jf(Af.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:`input-required-missing-both`})}:{kind:`input_required`,inputRequests:r,...typeof i==`string`&&{requestState:i},...o!==void 0&&{_meta:o}}}if(n!==`complete`)return{kind:`invalid`,error:new jf(Af.UnsupportedResultType,`Unsupported result type '${n}' for ${e}`,{resultType:n,method:e})};let r=$p(),i=Object.hasOwn(r,e)?r[e]:void 0;if(i!==void 0){let n=i.safeParse(t);if(!n.success)return{kind:`invalid`,error:new jf(Af.InvalidResult,`Invalid result for ${e}: ${n.error}`,{method:e})}}let a={...t};return delete a.resultType,{kind:`complete`,result:a}},encodeResult(e,t,n){return Op(Ep(e,Tp(e,Xp(e,t))),n)},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return`Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)`;let t=up().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(e=>e.message).join(`; `)}`}},Qp;function $p(){if(Qp)return Qp;let e=up();return Qp={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},Qp}var em=`2026-07-28`;function tm(e){return e!==void 0&&Nf(e)?Zp:sp}function nm(e){return e.revision===void 0?e.era===`modern`?Zp.era:sp.era:tm(e.revision).era}function rm(e){return om.some(t=>t.hasRequestMethod(e))}function im(e){return om.some(t=>t.hasNotificationMethod(e))}function am(e){return e===`tasks/get`||e===`tasks/cancel`}var om=[sp,Zp],sm=n({AnnotationsSchema:()=>iu,AudioContentSchema:()=>Lu,BaseMetadataSchema:()=>Nl,BaseRequestParamsSchema:()=>ml,BlobResourceContentsSchema:()=>nu,BooleanSchemaSchema:()=>vd,CallToolRequestParamsSchema:()=>Qu,CallToolRequestSchema:()=>$u,CallToolResultSchema:()=>Xu,CancelTaskRequestSchema:()=>af,CancelTaskResultSchema:()=>of,CancelledNotificationParamsSchema:()=>kl,CancelledNotificationSchema:()=>Al,ClientCapabilitiesSchema:()=>Rl,ClientNotificationSchema:()=>cf,ClientRequestSchema:()=>sf,ClientResultSchema:()=>lf,ClientTasksCapabilitySchema:()=>Il,CompatibilityCallToolResultSchema:()=>Zu,CompleteRequestParamsSchema:()=>zd,CompleteRequestSchema:()=>Bd,CompleteResultSchema:()=>Vd,ContentBlockSchema:()=>Vu,CreateMessageRequestParamsSchema:()=>md,CreateMessageRequestSchema:()=>hd,CreateMessageResultSchema:()=>gd,CreateMessageResultWithToolsSchema:()=>_d,CreateTaskResultSchema:()=>Yd,CursorSchema:()=>ul,DiscoverRequestSchema:()=>Wl,DiscoverResultSchema:()=>Gl,ElicitRequestFormParamsSchema:()=>Ad,ElicitRequestParamsSchema:()=>Md,ElicitRequestSchema:()=>Nd,ElicitRequestURLParamsSchema:()=>jd,ElicitResultSchema:()=>Id,ElicitationCompleteNotificationParamsSchema:()=>Pd,ElicitationCompleteNotificationSchema:()=>Fd,EmbeddedResourceSchema:()=>zu,EmptyResultSchema:()=>Ol,EnumSchemaSchema:()=>Od,GetPromptRequestParamsSchema:()=>Nu,GetPromptRequestSchema:()=>Pu,GetPromptResultSchema:()=>Uu,GetTaskPayloadRequestSchema:()=>ef,GetTaskPayloadResultSchema:()=>tf,GetTaskRequestSchema:()=>Qd,GetTaskResultSchema:()=>$d,IconSchema:()=>jl,IconsSchema:()=>Ml,ImageContentSchema:()=>Iu,ImplementationSchema:()=>Pl,InitializeRequestParamsSchema:()=>zl,InitializeRequestSchema:()=>Bl,InitializeResultSchema:()=>Hl,InitializedNotificationSchema:()=>Ul,JSONArraySchema:()=>cl,JSONObjectSchema:()=>sl,JSONRPCErrorResponseSchema:()=>Tl,JSONRPCMessageSchema:()=>El,JSONRPCNotificationSchema:()=>Cl,JSONRPCRequestSchema:()=>Sl,JSONRPCResponseSchema:()=>Dl,JSONRPCResultResponseSchema:()=>wl,JSONValueSchema:()=>ol,LegacyTitledEnumSchemaSchema:()=>Cd,ListChangedOptionsBaseSchema:()=>td,ListPromptsRequestSchema:()=>ju,ListPromptsResultSchema:()=>Mu,ListResourceTemplatesRequestSchema:()=>lu,ListResourceTemplatesResultSchema:()=>uu,ListResourcesRequestSchema:()=>su,ListResourcesResultSchema:()=>cu,ListRootsRequestSchema:()=>Ud,ListRootsResultSchema:()=>Wd,ListTasksRequestSchema:()=>nf,ListTasksResultSchema:()=>rf,ListToolsRequestSchema:()=>Ju,ListToolsResultSchema:()=>Yu,LoggingLevelSchema:()=>nd,LoggingMessageNotificationParamsSchema:()=>ad,LoggingMessageNotificationSchema:()=>od,ModelHintSchema:()=>sd,ModelPreferencesSchema:()=>cd,MultiSelectEnumSchemaSchema:()=>Dd,NotificationSchema:()=>vl,NotificationsParamsSchema:()=>_l,NumberSchemaSchema:()=>bd,PaginatedRequestParamsSchema:()=>Xl,PaginatedRequestSchema:()=>Zl,PaginatedResultSchema:()=>Ql,PingRequestSchema:()=>Kl,PrimitiveSchemaDefinitionSchema:()=>kd,ProgressNotificationParamsSchema:()=>Jl,ProgressNotificationSchema:()=>Yl,ProgressSchema:()=>ql,ProgressTokenSchema:()=>ll,PromptArgumentSchema:()=>ku,PromptListChangedNotificationSchema:()=>Wu,PromptMessageSchema:()=>Hu,PromptReferenceSchema:()=>Rd,PromptSchema:()=>Au,ReadResourceRequestParamsSchema:()=>fu,ReadResourceRequestSchema:()=>pu,ReadResourceResultSchema:()=>mu,RelatedTaskMetadataSchema:()=>fl,RequestIdSchema:()=>xl,RequestMetaSchema:()=>pl,RequestSchema:()=>gl,ResourceContentsSchema:()=>$l,ResourceLinkSchema:()=>Bu,ResourceListChangedNotificationSchema:()=>hu,ResourceRequestParamsSchema:()=>du,ResourceSchema:()=>au,ResourceTemplateReferenceSchema:()=>Ld,ResourceTemplateSchema:()=>ou,ResourceUpdatedNotificationParamsSchema:()=>Du,ResourceUpdatedNotificationSchema:()=>Ou,ResultMetaObjectSchema:()=>yl,ResultSchema:()=>bl,RoleSchema:()=>ru,RootSchema:()=>Hd,RootsListChangedNotificationSchema:()=>Gd,SamplingContentSchema:()=>dd,SamplingMessageContentBlockSchema:()=>fd,SamplingMessageSchema:()=>pd,ServerCapabilitiesSchema:()=>Vl,ServerNotificationSchema:()=>df,ServerRequestSchema:()=>uf,ServerResultSchema:()=>ff,ServerTasksCapabilitySchema:()=>Ll,SetLevelRequestParamsSchema:()=>rd,SetLevelRequestSchema:()=>id,SingleSelectEnumSchemaSchema:()=>wd,StringSchemaSchema:()=>yd,SubscribeRequestParamsSchema:()=>gu,SubscribeRequestSchema:()=>_u,SubscriptionFilterSchema:()=>bu,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Cu,SubscriptionsAcknowledgedNotificationSchema:()=>wu,SubscriptionsListenRequestParamsSchema:()=>xu,SubscriptionsListenRequestSchema:()=>Su,SubscriptionsListenResultMetaSchema:()=>Tu,SubscriptionsListenResultSchema:()=>Eu,TaskAugmentedRequestParamsSchema:()=>hl,TaskCreationParamsSchema:()=>Kd,TaskMetadataSchema:()=>dl,TaskSchema:()=>Jd,TaskStatusNotificationParamsSchema:()=>Xd,TaskStatusNotificationSchema:()=>Zd,TaskStatusSchema:()=>qd,TextContentSchema:()=>Fu,TextResourceContentsSchema:()=>eu,TitledMultiSelectEnumSchemaSchema:()=>Ed,TitledSingleSelectEnumSchemaSchema:()=>Sd,ToolAnnotationsSchema:()=>Gu,ToolChoiceSchema:()=>ld,ToolExecutionSchema:()=>Ku,ToolListChangedNotificationSchema:()=>ed,ToolResultContentSchema:()=>ud,ToolSchema:()=>qu,ToolUseContentSchema:()=>Ru,UnsubscribeRequestParamsSchema:()=>vu,UnsubscribeRequestSchema:()=>yu,UntitledMultiSelectEnumSchemaSchema:()=>Td,UntitledSingleSelectEnumSchemaSchema:()=>xd}),cm=e=>Sl.safeParse(e).success,lm=e=>Cl.safeParse(e).success,um=e=>wl.safeParse(e).success,dm=e=>Tl.safeParse(e).success;q.InvalidRequest,q.UnsupportedProtocolVersion,q.InvalidParams,q.MethodNotFound,q.InvalidParams,q.MissingRequiredClientCapability,q.ParseError,q.InvalidRequest,q.MethodNotFound,q.UnsupportedProtocolVersion,q.MissingRequiredClientCapability;function fm(e,t){return fs(e,t)}function pm(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function mm(e){if(e==null)return!1;let t=typeof e;return t!==`object`&&t!==`function`||!(`~standard`in e)?!1:typeof e[`~standard`]?.validate==`function`}var hm=!1,gm=`draft-2020-12`;function _m(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:gm});else if(n.vendor===`zod`){if(!(`_zod`in e))throw Error(`Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().`);hm||(hm=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),r=os(e,{target:gm,io:t})}else throw Error(`Schema library "${n.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t===`output`)return r.type===void 0&&vm(r)?{type:`object`,...r}:r;if(r.type!==void 0&&r.type!==`object`)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:`object`,...r}}function vm(e){if(`properties`in e||`patternProperties`in e||`additionalProperties`in e||`required`in e)return!0;for(let t of[`oneOf`,`anyOf`,`allOf`]){let n=e[t];if(Array.isArray(n)&&n.length>0)return n.every(e=>typeof e==`object`&&!!e&&(e.type===`object`||vm(e)))}return!1}function ym(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function bm(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>ym(e)).join(`, `)}:{success:!0,data:n.value}}function xm(e){let t=os(e,{target:gm,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}var Sm=/\\\.\\d\{(\d+)\}/;function Cm(e){let t=Sm.exec(e),n=[void 0,-1,0];return t&&n.push(Number(t[1])),[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>n.map(n=>Yc({local:e,offset:t,precision:n}))))}function wm(e,t){let n;switch(e){case`email`:n=[Ms()];break;case`uri`:n=[Is()];break;case`date`:n=[Xc()];break;case`date-time`:n=Cm(t)}return new Set(n.map(e=>xm(e)).filter(e=>e!==void 0))}function Tm(e,t,n){return n!==`zod`||wm(e,t).has(t)}function Em(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Dm(e){try{return _m(e,`input`)}catch(e){let t=e instanceof Error?e.message:String(e);throw new _p(q.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}var Om=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function km(e){return Om.has(e)||e.startsWith(`x-`)}var Am=new Set([`$schema`,...Object.keys(Ad.shape.requestedSchema.shape)]),jm={string:pm([yd,xd,Sd,Cd]),number:pm([bd]),integer:pm([bd]),boolean:pm([vd]),array:pm([Td,Ed])},Mm=new Set(yd.shape.format.unwrap().options);function Nm(e,t,n,r){if(!Em(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(jm,e.type)?jm[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||km(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?Mm.has(e.format)?(typeof s!=`string`||!Tm(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function Pm(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&Em(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,Nm(n,`properties.${e}`,t,r)])):Am.has(i)?n[i]=a:km(i)||r.push(i);if(r.length>0)throw new _p(q.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(`, `)}`);return n}function Fm(e,t){if(!Em(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!fm(kd,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function Im(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>Im(e,t[r],`${n}[${r}]`)):!Em(e)||!Em(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?Im(r,t[e],i):km(e)?[]:[i]})}function Lm(e){if(!mm(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=Pm(Dm(e.requestedSchema),t),r=fm(Ad.shape.requestedSchema,n);if(!r.success)throw new _p(q.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Fm(n,r.error.message)}`);let i=Im(n,r.data);if(i.length>0)throw new _p(q.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(`, `)}`);let a=(r.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(r.data.properties,e));if(a.length>0)throw new _p(q.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${a.join(`, `)}`);return{...e,mode:`form`,requestedSchema:r.data}}function Rm(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,n=typeof e.requestState==`string`;if(!t&&!n)throw TypeError(`inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)`);return{resultType:`input_required`,...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}Object.assign(Rm,{elicit(e){try{return{method:`elicitation/create`,params:Lm(e)}}catch(e){throw e instanceof _p?TypeError(e.message,{cause:e}):e}},elicitUrl(e){return{method:`elicitation/create`,params:{...e,mode:`url`}}},createMessage(e){return{method:`sampling/createMessage`,params:e}},listRoots(){return{method:`roots/list`}}});var zm=`AnnotationsSchema.AudioContentSchema.BaseMetadataSchema.BlobResourceContentsSchema.BooleanSchemaSchema.CallToolRequestSchema.CallToolRequestParamsSchema.CallToolResultSchema.CancelledNotificationSchema.CancelledNotificationParamsSchema.CancelTaskRequestSchema.CancelTaskResultSchema.ClientCapabilitiesSchema.ClientNotificationSchema.ClientRequestSchema.ClientResultSchema.CompatibilityCallToolResultSchema.CompleteRequestSchema.CompleteRequestParamsSchema.CompleteResultSchema.ContentBlockSchema.CreateMessageRequestSchema.CreateMessageRequestParamsSchema.CreateMessageResultSchema.CreateMessageResultWithToolsSchema.CreateTaskResultSchema.CursorSchema.DiscoverRequestSchema.DiscoverResultSchema.ElicitationCompleteNotificationSchema.ElicitationCompleteNotificationParamsSchema.ElicitRequestSchema.ElicitRequestFormParamsSchema.ElicitRequestParamsSchema.ElicitRequestURLParamsSchema.ElicitResultSchema.EmbeddedResourceSchema.EmptyResultSchema.EnumSchemaSchema.GetPromptRequestSchema.GetPromptRequestParamsSchema.GetPromptResultSchema.GetTaskPayloadRequestSchema.GetTaskPayloadResultSchema.GetTaskRequestSchema.GetTaskResultSchema.IconSchema.IconsSchema.ImageContentSchema.ImplementationSchema.InitializedNotificationSchema.InitializeRequestSchema.InitializeRequestParamsSchema.InitializeResultSchema.JSONArraySchema.JSONObjectSchema.JSONRPCErrorResponseSchema.JSONRPCMessageSchema.JSONRPCNotificationSchema.JSONRPCRequestSchema.JSONRPCResponseSchema.JSONRPCResultResponseSchema.JSONValueSchema.LegacyTitledEnumSchemaSchema.ListPromptsRequestSchema.ListPromptsResultSchema.ListResourcesRequestSchema.ListResourcesResultSchema.ListResourceTemplatesRequestSchema.ListResourceTemplatesResultSchema.ListRootsRequestSchema.ListRootsResultSchema.ListTasksRequestSchema.ListTasksResultSchema.ListToolsRequestSchema.ListToolsResultSchema.LoggingLevelSchema.LoggingMessageNotificationSchema.LoggingMessageNotificationParamsSchema.ModelHintSchema.ModelPreferencesSchema.MultiSelectEnumSchemaSchema.NotificationSchema.NumberSchemaSchema.PaginatedRequestSchema.PaginatedRequestParamsSchema.PaginatedResultSchema.PingRequestSchema.PrimitiveSchemaDefinitionSchema.ProgressSchema.ProgressNotificationSchema.ProgressNotificationParamsSchema.ProgressTokenSchema.PromptSchema.PromptArgumentSchema.PromptListChangedNotificationSchema.PromptMessageSchema.PromptReferenceSchema.ReadResourceRequestSchema.ReadResourceRequestParamsSchema.ReadResourceResultSchema.RelatedTaskMetadataSchema.RequestSchema.RequestIdSchema.RequestMetaSchema.ResourceSchema.ResourceContentsSchema.ResourceLinkSchema.ResourceListChangedNotificationSchema.ResourceRequestParamsSchema.ResourceTemplateSchema.ResourceTemplateReferenceSchema.ResourceUpdatedNotificationSchema.ResourceUpdatedNotificationParamsSchema.ResultMetaObjectSchema.ResultSchema.RoleSchema.RootSchema.RootsListChangedNotificationSchema.SamplingContentSchema.SamplingMessageSchema.SamplingMessageContentBlockSchema.ServerCapabilitiesSchema.ServerNotificationSchema.ServerRequestSchema.ServerResultSchema.SetLevelRequestSchema.SetLevelRequestParamsSchema.SingleSelectEnumSchemaSchema.StringSchemaSchema.SubscribeRequestSchema.SubscribeRequestParamsSchema.SubscriptionFilterSchema.SubscriptionsAcknowledgedNotificationSchema.SubscriptionsAcknowledgedNotificationParamsSchema.SubscriptionsListenRequestSchema.SubscriptionsListenRequestParamsSchema.SubscriptionsListenResultSchema.SubscriptionsListenResultMetaSchema.TaskAugmentedRequestParamsSchema.TaskCreationParamsSchema.TaskMetadataSchema.TaskSchema.TaskStatusSchema.TaskStatusNotificationSchema.TaskStatusNotificationParamsSchema.TextContentSchema.TextResourceContentsSchema.TitledMultiSelectEnumSchemaSchema.TitledSingleSelectEnumSchemaSchema.ToolSchema.ToolAnnotationsSchema.ToolChoiceSchema.ToolExecutionSchema.ToolListChangedNotificationSchema.ToolResultContentSchema.ToolUseContentSchema.UnsubscribeRequestSchema.UnsubscribeRequestParamsSchema.UntitledMultiSelectEnumSchemaSchema.UntitledSingleSelectEnumSchemaSchema`.split(`.`),Bm={IdJagTokenExchangeResponseSchema:yf,OAuthClientInformationFullSchema:wf,OAuthClientInformationSchema:Cf,OAuthClientMetadataSchema:Sf,OAuthClientRegistrationErrorSchema:Tf,OAuthErrorResponseSchema:bf,OAuthMetadataSchema:hf,OAuthProtectedResourceMetadataSchema:mf,OAuthTokenRevocationRequestSchema:Ef,OAuthTokensSchema:vf,OpenIdProviderDiscoveryMetadataSchema:_f,OpenIdProviderMetadataSchema:gf},Vm={},Hm={};function Um(e,t){let n=e.slice(0,-6);Vm[n]=t,Hm[n]=e=>t.safeParse(e).success}for(let e of zm)Um(e,sm[e]);for(let[e,t]of Object.entries(Bm))Um(e,t);Object.freeze(Vm),Object.freeze(Hm);function Wm(e){switch(e){case`initialize`:case`notifications/initialized`:return tm(void 0);case`server/discover`:return tm(em);default:return}}var Gm=[el,tl,rl,al],Km=[`inputResponses`,`requestState`];function qm(e,t){let n=e.params;if(!Qm(n))return{message:e,lifted:{}};let r=n._meta,i=Qm(r)?Gm.filter(e=>e in r):[],a=t===`request`?Km.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&Qm(r)){let e={},t={...r};for(let n of i)e[n]=r[n],delete t[n];o.envelope=e,Object.keys(t).length>0?s._meta=t:delete s._meta}for(let e of a)e===`inputResponses`&&(o.inputResponses=s[e]),e===`requestState`&&(o.requestState=s[e]),delete s[e];return{message:{...e,params:s},lifted:o}}function Jm(e,t){let n=e.validateResult(t,void 0);if(n.ok||n.reason!==`not-in-era`)return{"~standard":{version:1,vendor:`mcp-wire-codec`,validate(n){let r=e.validateResult(t,n);return r.ok?{value:r.value}:{issues:[{message:r.reason===`invalid`?r.message:`not-in-era: ${t}`}]}}}}}function Ym(e){return()=>e}var Xm=Ym(void 0),Zm=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??Qc,this.setNotificationHandler(`notifications/cancelled`,e=>{this._oncancel(e)}),this.setNotificationHandler(`notifications/progress`,e=>{this._onprogress(e)}),this.setRequestHandler(`ping`,e=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let n=e.params??{};return{...e,params:{...n,_meta:{...t,...n._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new jf(Af.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId!==void 0&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new jf(Af.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let n=this.transport?.onerror;this._transport.onerror=e=>{n?.(e),this._onerror(e)};let r=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{r?.(e,t),um(e)||dm(e)?this._onresponse(e):cm(e)?this._onrequest(e,t):lm(e)?this._onnotification(e,t):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._timeoutInfo.values())clearTimeout(e.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let n=new jf(Af.ConnectionClosed,`Connection closed`);this._transport=void 0;try{this.onclose?.()}finally{for(let t of e.values())t(n);for(let e of t.values())e.abort(n)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:n}=qm(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=nm(t.classification);if(e!==r.era){this._onerror(Error(`Era mismatch on inbound notification '${n.method}': classified as ${e} but this instance serves ${r.era}`));return}}if(im(n.method)&&!r.hasNotificationMethod(n.method))return;let i=this._notificationHandlers.get(n.method),a=this.fallbackNotificationHandler;(i!==void 0||a!==void 0)&&Promise.resolve().then(()=>i===void 0?a(n):i(n,r)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let{message:n,lifted:r}=qm(e,`request`),i=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let a=this._transport,o=(e,t,r)=>{let i={jsonrpc:`2.0`,id:n.id,error:{code:e,message:t,...r!==void 0&&{data:r}}};a?.send(i).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=nm(t.classification);if(e!==i.era){this._onerror(Error(`Era mismatch on inbound request '${n.method}': classified as ${e} but this instance serves ${i.era}`));let r=t.classification.revision??e;o(q.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(rm(n.method)&&!i.hasRequestMethod(n.method)&&!(am(n.method)&&this._customSchemaRequestMethods.has(n.method))){o(q.MethodNotFound,`Method not found`);return}let s=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(s===void 0){o(q.MethodNotFound,`Method not found`);return}let c=i.checkInboundEnvelope(r);if(c!==void 0){o(q.InvalidParams,c);return}let l=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:n.id}),u=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:n.id}),d=new AbortController;this._requestHandlerAbortControllers.set(n.id,d);let f=r.inputResponses===void 0?void 0:eh(r.inputResponses),p={sessionId:a?.sessionId,mcpReq:{id:n.id,method:n.method,_meta:n.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},...f!==void 0&&{inputResponses:f.accepted},...f!==void 0&&f.droppedKeys.length>0&&{droppedInputResponseKeys:f.droppedKeys},requestState:r.requestState===void 0?Xm:Ym(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),mm(t))return u(e,t,n);let i=Jm(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return u(e,i,t)}),notify:l},http:t?.authInfo?{authInfo:t.authInfo}:void 0},m=this.buildContext(p,t);Promise.resolve().then(()=>s(n,m)).then(async e=>{if(d.signal.aborted)return;let t;try{t=i.encodeResult(n.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${n.method}: ${e}`)),o(q.InternalError,`Internal error`);return}let r={result:t,jsonrpc:`2.0`,id:n.id};await a?.send(r)},async e=>{if(d.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:q.InternalError,r={jsonrpc:`2.0`,id:n.id,error:{code:i.encodeErrorCode(t),message:e.message??`Internal error`,...e.data!==void 0&&{data:e.data}}};await a?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(n.id)===d&&this._requestHandlerAbortControllers.delete(n.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._responseHandlers.get(t);n===void 0?this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`)):(this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),um(e)?n(e):n(_p.fromError(e.error.code,e.error.message,e.error.data)))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,n){let r=this._resolveOutboundCodec(e.method);if(mm(t))return am(e.method)||this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n);this._assertOutboundRequestInEra(r,e.method);let i=Jm(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(r,e,i,t)}_negotiatedWireCodec(){return tm(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=Wm(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(rm(t)&&!e.hasRequestMethod(t))throw new jf(Af.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,n){let r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n)}_requestWithSchemaViaCodec(e,t,n,r){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s}=r??{},c=Date.now(),l,u;return new Promise((d,f)=>{let p=e=>{f(e)};if(!this._transport){p(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){p(e);return}if(r?.signal?.aborted){let e=r.signal.reason;throw e instanceof jf?e:new jf(Af.RequestTimeout,String(e))}let m=e.era===`2026-07-28`&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,h=this._requestMessageId++;u=h;let g={...t,jsonrpc:`2.0`,id:h};r?.onprogress&&(this._progressHandlers.set(h,r.onprogress),g.params={...t.params,_meta:{...t.params?._meta,progressToken:h}});let _=this._envelopeOutbound(g),v=!1,y=e=>{v||(this._progressHandlers.delete(h),m===void 0?t.method!==`initialize`&&this._transport?.send(this._envelopeOutbound({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:h,reason:String(e)}}),{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):m.abort(),f(e instanceof jf?e:new jf(Af.RequestTimeout,String(e))))};this._responseHandlers.set(h,i=>{if(r?.signal?.aborted)return;if(v=!0,i instanceof Error)return f(i);let a;try{a=e.decodeResult(t.method,i.result)}catch(e){return f(e instanceof Error?e:Error(String(e)))}if(a.kind===`invalid`)return f(a.error);if(a.kind===`input_required`){if(r?.allowInputRequired===!0)return d(th(a));let i={codec:e,request:t,resultSchema:n,options:r,flowStartedAt:c,retry:(r,i)=>this._requestWithSchemaViaCodec(e,r===void 0?{method:t.method}:{method:t.method,params:r},n,i)};return d(this._resolveNonCompleteResult(a,i))}let o=a.result;bm(n,o).then(e=>{e.success?d(e.data):f(new jf(Af.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},f)}),l=()=>y(r?.signal?.reason),r?.signal?.addEventListener(`abort`,l,{once:!0});let b=r?.timeout??6e4;this._setupTimeout(h,b,r?.maxTotalTimeout,()=>y(new jf(Af.RequestTimeout,`Request timed out`,{timeout:b})),r?.resetTimeoutOnProgress??!1),this._transport.send(_,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s,requestSignal:m?.signal}).catch(e=>{this._progressHandlers.delete(h),f(e)})}).finally(()=>{l&&r?.signal?.removeEventListener(`abort`,l),u!==void 0&&(this._responseHandlers.delete(u),this._cleanupTimeout(u))})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,n){if(!this._transport)throw new jf(Af.NotConnected,`Not connected`);if(im(t.method)&&!e.hasNotificationMethod(t.method))throw new jf(Af.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let r=this._envelopeOutbound({jsonrpc:`2.0`,...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&n?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(r,n).catch(e=>this._onerror(e))})}else await this._transport.send(r,n)}setRequestHandler(e,t,n){this.assertRequestHandlerCapability(e);let r;if(typeof t==`function`){if(!rm(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,r)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,n);if(!a.ok&&a.reason===`not-in-era`&&(a=i.validateInputRequest(e,n)),!a.ok)throw a.reason===`not-in-era`?new _p(q.InternalError,`No wire schema for ${e} in the resolved era`):Error(a.message);return Promise.resolve(t(a.value,r))}}else if(n)r=async(r,i)=>{let a=await bm(t.params,{...r.params});if(!a.success)throw new _p(q.InvalidParams,`Invalid params for ${e}: ${a.error}`);return n(a.data,i)};else throw TypeError(`setRequestHandler: handler is required`);typeof t==`function`?this._customSchemaRequestMethods.delete(e):this._customSchemaRequestMethods.add(e),this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,n){if(typeof t==`function`){if(!im(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(n,r)=>{let i=r.validateNotification(e,n);if(!i.ok)throw i.reason===`not-in-era`?new _p(q.InternalError,`No wire schema for ${e} in the resolved era`):Error(i.message);return Promise.resolve(t(i.value))})}else{if(!n)throw TypeError(`setNotificationHandler: handler is required`);this._notificationHandlers.set(e,async r=>{let i=await bm(t.params,{...r.params});if(!i.success)throw new _p(q.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await n(i.data,r)})}}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Qm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function $m(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function eh(e){let t={},n=[];if(!$m(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e))!$m(i)||`method`in i||`result`in i?n.push(r):t[r]=i;return{accepted:t,droppedKeys:n}}function th(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}t((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,n=/\\([\u000b\u0020-\u00ff])/g,r=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=i;function i(e){if(!e)throw TypeError(`argument string is required`);var i=typeof e==`object`?a(e):e;if(typeof i!=`string`)throw TypeError(`argument string is required to be a string`);var s=i.indexOf(`;`),c=s===-1?i.trim():i.slice(0,s).trim();if(!r.test(c))throw TypeError(`invalid media type`);var l=new o(c.toLowerCase());if(s!==-1){var u,d,f;for(t.lastIndex=s;d=t.exec(i);){if(d.index!==s)throw TypeError(`invalid parameter format`);s+=d[0].length,u=d[1].toLowerCase(),f=d[2],f.charCodeAt(0)===34&&(f=f.slice(1,-1),f.indexOf(`\\`)!==-1&&(f=f.replace(n,`$1`))),l.parameters[u]=f}if(s!==i.length)throw TypeError(`invalid parameter format`)}return l}function a(e){var t;if(typeof e.getHeader==`function`?t=e.getHeader(`content-type`):typeof e.headers==`object`&&(t=e.headers&&e.headers[`content-type`]),typeof t!=`string`)throw TypeError(`content-type header is missing from object`);return t}function o(e){this.parameters=Object.create(null),this.type=e}}))(),typeof self<`u`&&self.location&&self.location.origin!==`null`?new URL(self.location.origin+self.location.pathname+location.search):new URL(`https://github.com/cfworker`);var nh=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,rh=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ih=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,ah=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,oh=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,sh=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,ch=/^(?:\/(?:[^~/]|~0|~1)*)*$/,lh=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,uh=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,dh=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,fh=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;function ph(e){return e.test.bind(e)}mh.bind(void 0,!1),ph(ih),ph(ah),ph(oh),ph(rh),ph(dh),ph(fh),ph(sh),ph(ch),ph(lh),ph(uh);function mh(e,t){let n=t.match(nh);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=!!n[5];return(r<=23&&i<=59&&a<=59||r==23&&i==59&&a==60)&&(!e||o)}globalThis.crypto;var hh=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthClientFlowError`})}static[Symbol.hasInstance](e){return kf(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return kf(this,e)}constructor(e){super(e),this.name=new.target.name,Of(this,new.target)}};(class extends hh{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.IssuerMismatchError`})}kind;expected;received;constructor(e,t,n){super(`Issuer mismatch in ${e===`metadata`?`authorization server metadata (RFC 8414 §3.3)`:`authorization response (RFC 9207)`}: expected ${JSON.stringify(t)}, received ${JSON.stringify(n)}`),this.kind=e,this.expected=t,this.received=n}}),class extends hh{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.RegistrationRejectedError`})}status;body;submittedMetadata;constructor(e){super(`Dynamic Client Registration rejected (HTTP ${e.status}): ${e.body}`),this.status=e.status,this.body=e.body,this.submittedMetadata=e.submittedMetadata}},class extends hh{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.InsecureTokenEndpointError`})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / *.localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=e}},class extends hh{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.AuthorizationServerMismatchError`})}constructor(e,t){super(`Authorization server mismatch: credentials are bound to ${JSON.stringify(e)} but this call resolved ${JSON.stringify(t)}; refusing to present them to a different authorization server`),this.recordedIssuer=e,this.currentIssuer=t}},class extends hh{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.InsufficientScopeError`})}requiredScope;resourceMetadataUrl;errorDescription;constructor(e){super(`Insufficient scope${e.requiredScope?`: required "${e.requiredScope}"`:``}`),this.requiredScope=e.requiredScope,this.resourceMetadataUrl=e.resourceMetadataUrl,this.errorDescription=e.errorDescription}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnauthorizedError`})}static[Symbol.hasInstance](e){return kf(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return kf(this,e)}constructor(e){super(e??`Unauthorized`),this.name=`UnauthorizedError`,Of(this,new.target)}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SseError`})}static[Symbol.hasInstance](e){return kf(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return kf(this,e)}constructor(e,t,n){super(`SSE error: ${t}`),this.code=e,this.event=n,Of(this,new.target)}};var gh=class{_eventSlots=new Map;setHandler(e,t){let n=this._ensureEventSlot(e);n.onHandler&&t&&console.warn(`[MCP Apps] on${String(e)} handler replaced. Use addEventListener("${String(e)}", …) to add multiple listeners without replacing.`),n.onHandler=t}getHandler(e){return this._eventSlots.get(e)?.onHandler}addEventListener(e,t){this._ensureEventSlot(e).listeners.push(t)}removeEventListener(e,t){let n=this._eventSlots.get(e);if(!n)return;let r=n.listeners.indexOf(t);r!==-1&&n.listeners.splice(r,1)}dispatch(e,t){let n=this._eventSlots.get(e);if(n){n.onHandler?.(t);for(let e of[...n.listeners])e(t)}}_ensureEventSlot(e){let t=this._eventSlots.get(e);return t||(t={listeners:[]},this._eventSlots.set(e,t)),t}},_h=class{_methods=new Set;claim(e,t){if(this._methods.has(e))throw Error(`Handler for "${e}" already registered (via ${t}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._methods.add(e)}replace(e){this._methods.add(e)}release(e){this._methods.delete(e)}has(e){return this._methods.has(e)}},vh=new Set;function yh(e,t){let[n,r]=t,i=n?.shape;if(typeof i?.method?.value!=`string`)return;let a=i.method.value,o=e===`request`?`setRequestHandler`:`setNotificationHandler`;vh.has(o)||(vh.add(o),console.warn(`[ext-apps] ${o}(Schema, handler) is deprecated; use ${o}("${a}", { params: Schema.shape.params }, handler).`));let s=r;return[a,{params:i.params},e===`request`?(e,t)=>s({method:a,params:e},bh(t)):e=>s({method:a,params:e})]}function bh(e){return{signal:e.mcpReq.signal,requestId:e.mcpReq.id,sessionId:e.sessionId,_meta:e.mcpReq._meta,sendRequest:e.mcpReq.send,sendNotification:e.mcpReq.notify,authInfo:e.http?.authInfo}}var xh=`2026-01-26`,Sh=class{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=e=>{if(t&&e.source!==this.eventSource){console.debug(`Ignoring message from unknown source`,e);return}let n=El.safeParse(e.data);n.success?(console.debug(`Parsed message`,n.data),this.onmessage?.(n.data)):e.data?.jsonrpc===`2.0`?(console.error(`Failed to parse message`,n.error.message,e),this.onerror?.(Error(`Invalid JSON-RPC message received: `+n.error.message))):console.debug(`Ignoring non-JSON-RPC message`,n.error.message,e)}}async start(){window.addEventListener(`message`,this.messageListener)}async send(e,t){e.method!==`ui/notifications/tool-input-partial`&&console.debug(`Sending message`,e),this.eventTarget.postMessage(e,`*`)}async close(){window.removeEventListener(`message`,this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion},Ch=H([G(`light`),G(`dark`)]).describe(`Color theme preference for the host environment.`),wh=H([G(`inline`),G(`fullscreen`),G(`pip`)]).describe(`Display mode for UI presentation.`),Th=U(H([G(`--color-background-primary`),G(`--color-background-secondary`),G(`--color-background-tertiary`),G(`--color-background-inverse`),G(`--color-background-ghost`),G(`--color-background-info`),G(`--color-background-danger`),G(`--color-background-success`),G(`--color-background-warning`),G(`--color-background-disabled`),G(`--color-text-primary`),G(`--color-text-secondary`),G(`--color-text-tertiary`),G(`--color-text-inverse`),G(`--color-text-ghost`),G(`--color-text-info`),G(`--color-text-danger`),G(`--color-text-success`),G(`--color-text-warning`),G(`--color-text-disabled`),G(`--color-border-primary`),G(`--color-border-secondary`),G(`--color-border-tertiary`),G(`--color-border-inverse`),G(`--color-border-ghost`),G(`--color-border-info`),G(`--color-border-danger`),G(`--color-border-success`),G(`--color-border-warning`),G(`--color-border-disabled`),G(`--color-ring-primary`),G(`--color-ring-secondary`),G(`--color-ring-inverse`),G(`--color-ring-info`),G(`--color-ring-danger`),G(`--color-ring-success`),G(`--color-ring-warning`),G(`--font-sans`),G(`--font-mono`),G(`--font-weight-normal`),G(`--font-weight-medium`),G(`--font-weight-semibold`),G(`--font-weight-bold`),G(`--font-text-xs-size`),G(`--font-text-sm-size`),G(`--font-text-md-size`),G(`--font-text-lg-size`),G(`--font-heading-xs-size`),G(`--font-heading-sm-size`),G(`--font-heading-md-size`),G(`--font-heading-lg-size`),G(`--font-heading-xl-size`),G(`--font-heading-2xl-size`),G(`--font-heading-3xl-size`),G(`--font-text-xs-line-height`),G(`--font-text-sm-line-height`),G(`--font-text-md-line-height`),G(`--font-text-lg-line-height`),G(`--font-heading-xs-line-height`),G(`--font-heading-sm-line-height`),G(`--font-heading-md-line-height`),G(`--font-heading-lg-line-height`),G(`--font-heading-xl-line-height`),G(`--font-heading-2xl-line-height`),G(`--font-heading-3xl-line-height`),G(`--border-radius-xs`),G(`--border-radius-sm`),G(`--border-radius-md`),G(`--border-radius-lg`),G(`--border-radius-xl`),G(`--border-radius-full`),G(`--border-width-regular`),G(`--shadow-hairline`),G(`--shadow-sm`),G(`--shadow-md`),G(`--shadow-lg`)]).describe(`CSS variable keys available to MCP apps for theming.`).describe(`Style variables for theming MCP apps.
1497
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Ha(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Ha(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Ua=new Set([`type`,`properties`,`required`,`additionalProperties`]),Wa=[`oneOf`,`anyOf`];function Ga(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Ka(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Ua.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Ga(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}h(n,r,e.length===1?e[0]:Ka(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Ga(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function qa(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Ua)if(t in e)return;let n=t.filter(e=>Wa.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Ka(t);else{let e=n[0],i=Wa.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Ka([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Ia(e,r))}function Ja(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Ia(i,s),Ia(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Ha(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])qa(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Ia(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,h(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Za(t,`input`,e.processors),output:Za(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Ya(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Ya(r.element,n);if(r.type===`set`)return Ya(r.valueType,n);if(r.type===`lazy`)return Ya(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return Ya(r.innerType,n);if(r.type===`intersection`)return Ya(r.left,n)||Ya(r.right,n);if(r.type===`record`||r.type===`map`)return Ya(r.keyType,n)||Ya(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Ya(r.in,n)||Ya(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Ya(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Ya(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Ya(e,n))return!0;return!!(r.rest&&Ya(r.rest,n))}return!1}var Xa=(e,t={})=>n=>{let r=La({...n,processors:t});return za(e,r),Va(r,e),Ja(r,e)},Za=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=La({...i??{},target:a,io:t,processors:n});return za(e,o),Va(o,e),Ja(o,e)},Qa=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},$a=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},eo=(e,t)=>{Qa(e,`minimum`,t),$a(e,`maximum`,t)},to=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},no=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},ro=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},io=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},ao=(e,t)=>Qa(e,`minimum`,t.minimum),oo=(e,t)=>$a(e,`maximum`,t.maximum),so=e=>(t,n)=>{io(t,n.format);let[r,i]=e[n.format];Qa(t,`minimum`,r),$a(t,`maximum`,i)},co={greater_than:(e,t)=>Qa(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>$a(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>to(e,t.value),number_format:so(D),bigint_format:so(O),min_length:ao,max_length:oo,length_equals:(e,t)=>eo(e,t.length),min_size:ao,max_size:oo,size_equals:(e,t)=>eo(e,t.size),string_format:(e,t)=>{io(e,t.format),t.pattern&&no(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>ro(e,t.mime)};function lo(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)co[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Qa(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Qa(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&$a(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&$a(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&to(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&ro(t,i.mime);for(let e of i.patterns??[])no(t,e);return t}var uo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},fo=new Map([[or,Bt],[cr,Vt]]),po=e=>fo.get(e)??e,mo=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=lo(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=uo[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(po);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},ho=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=lo(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Ra(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},go=(e,t,n,r)=>{n.type=`boolean`},_o=(e,t,n,r)=>{Ra(e,t,n,r,`BigInt cannot be represented in JSON Schema`)},vo=(e,t,n,r)=>{Ra(e,t,n,r,`Symbols cannot be represented in JSON Schema`)},yo=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},bo=(e,t,n,r)=>{Ra(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},xo=(e,t,n,r)=>{Ra(e,t,n,r,`Void cannot be represented in JSON Schema`)},So=(e,t,n,r)=>{n.not={}},Co=(e,t,n,r)=>{},wo=(e,t,n,r)=>{},To=(e,t,n,r)=>{Ra(e,t,n,r,`Date cannot be represented in JSON Schema`)},Eo=(e,t,n,r)=>{let i=e._zod.def,o=a(i.entries);o.length===0?n.not={}:(o.every(e=>typeof e==`number`)&&(n.type=`number`),o.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=o)},Do=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Ra(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Ra(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Oo=(e,t,n,r)=>{Ra(e,t,n,r,`NaN cannot be represented in JSON Schema`)},ko=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},Ao=(e,t,n,r)=>{let i=n;i.type=`string`,i.format=`binary`,i.contentEncoding=`binary`;let{minimum:a,maximum:o,mime:s}=lo(e);a!==void 0&&(i.minLength=a),o!==void 0&&(i.maxLength=o),s&&(s.length===0?i.not={}:s.length===1?i.contentMediaType=s[0]:i.anyOf=s.map(e=>({contentMediaType:e})))},jo=(e,t,n,r)=>{n.type=`boolean`},Mo=(e,t,n,r)=>{Ra(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},No=(e,t,n,r)=>{Ra(e,t,n,r,`Function types cannot be represented in JSON Schema`)},Po=(e,t,n,r)=>{Ra(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Fo=(e,t,n,r)=>{Ra(e,t,n,r,`Map cannot be represented in JSON Schema`)},Io=(e,t,n,r)=>{Ra(e,t,n,r,`Set cannot be represented in JSON Schema`)},Lo=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=lo(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=za(a.element,t,{...r,path:[...r.path,`items`]})};function Ro(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Ro(t.out):t.type===`catch`?Ro(t.innerType):e._zod.optin}var zo=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Ra(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)h(i.properties,e,za(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Ro(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=za(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Bo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>za(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Vo=(e,t,n,r)=>{let i=e._zod.def,a=za(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=za(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Ho=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>za(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?za(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?Ro(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=lo(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function Uo(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Uo(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Uo(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?Qt:Zt).source)),p}var Wo=new WeakMap;function Go(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Wo.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Uo(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Ko=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=lo(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=za(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)h(i.patternProperties,po(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=za(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Wo.get(t);n||(n=[],Wo.set(t,n),t.deferred.push(()=>Go(t))),n.push(e)}i.additionalProperties=za(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Ro(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},qo=(e,t,n,r)=>{let i=e._zod.def,a=za(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Jo=(e,t,n,r)=>{let i=e._zod.def;za(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Yo=Symbol();function Xo(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Ra(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Yo):JSON.parse(o)}var Zo=(e,t,n,r)=>{let i=e._zod.def;za(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Xo(i.defaultValue,e,t,n,r);o!==Yo&&(n.default=o)},Qo=(e,t,n,r)=>{let i=e._zod.def;za(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Xo(i.defaultValue,e,t,n,r);o!==Yo&&(n._prefault=o)},$o=(e,t,n,r)=>{let i=e._zod.def;za(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Ra(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},es=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;za(o,t,r);let s=t.seen.get(e);s.ref=o},ts=(e,t,n,r)=>{let i=e._zod.def;za(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ns=(e,t,n,r)=>{let i=e._zod.def;za(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},rs=(e,t,n,r)=>{let i=e._zod.def;za(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},is=(e,t,n,r)=>{let i=e._zod.innerType;za(i,t,r);let a=t.seen.get(e);a.ref=i},as={string:mo,number:ho,boolean:go,bigint:_o,symbol:vo,null:yo,undefined:bo,void:xo,never:So,any:Co,unknown:wo,date:To,enum:Eo,literal:Do,nan:Oo,template_literal:ko,file:Ao,success:jo,custom:Mo,function:No,transform:Po,map:Fo,set:Io,array:Lo,object:zo,union:Bo,intersection:Vo,tuple:Ho,record:Ko,nullable:qo,nonoptional:Jo,default:Zo,prefault:Qo,catch:$o,pipe:es,readonly:ts,promise:ns,optional:rs,lazy:is};function os(e,t){if(`_idmap`in e){let n=e,r=La({...t,processors:as}),i={};for(let e of n._idmap.entries()){let[t,n]=e;za(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;Va(r,n),h(a,t,Ja(r,n))}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=La({...t,processors:as});return za(e,n),Va(n,e),Ja(n,e)}var ss=new WeakSet([Object.prototype,Error.prototype]);function cs(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var ls=M(`ZodError`,(e,t)=>{et.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);ss.has(n)||(ss.add(n),cs(n,`format`,e=>t=>rt(e,t)),cs(n,`flatten`,e=>t=>nt(e,t)),cs(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,s,2)}),cs(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,s,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),us=at(ls),ds=ot(ls),fs=st(ls),ps=lt(ls),ms=ht(ls),hs=gt(ls),gs=_t(ls),_s=vt(ls),vs=yt(ls),ys=bt(ls),bs=xt(ls),xs=St(ls);function Ss(){Ke.localeError||qe(wi())}function Cs(){Ke.memoizer||qe({memoizer:xi()})}var P=M(`ZodType`,(e,t)=>(Ss(),N.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(x(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return w(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Wc(e,t))},superRefine(e,t){return this.check(Gc(e,t))},overwrite(e){return this.check(Ea(e))},optional(){return K(this)},exactOptional(){return Tc(this)},nullable(){return Dc(this)},nullish(){return K(Dc(this))},nonoptional(e){return Nc(this,e)},array(){return z(this)},or(e){return H([this,e])},and(e){return _c(this,e)},transform(e){return Lc(this,Sc(e))},default(e){return kc(this,e)},prefault(e){return jc(this,e)},catch(e){return Fc(this,e)},pipe(e){return Lc(this,e)},readonly(){return Bc(this)},describe(e){let t=this.clone();return Oi.add(t,{description:e}),t},meta(...e){if(e.length===0)return Oi.get(this);let t=this.clone();return Oi.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Ae(this,`~standard`,{...Dn(this),jsonSchema:{input:Za(this,`input`),output:Za(this,`output`)}})},set"~standard"(e){ke(this,`~standard`,e)},parse:function e(t,n){return us(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await ds(this,t,n,{callee:e})},safeParse(e,t){return fs(this,e,t)},async safeParseAsync(e,t){return ps(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){ke(this,`spa`,e)},validate(e,t){return ft(this,e,t)},validateAsync(e,t){return mt(this,e,t)},encode:function e(t,n){return ms(this,t,n,{callee:e})},decode:function e(t,n){return hs(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await gs(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await _s(this,t,n,{callee:e})},safeEncode(e,t){return vs(this,e,t)},safeDecode(e,t){return ys(this,e,t)},async safeEncodeAsync(e,t){return bs(this,e,t)},async safeDecodeAsync(e,t){return xs(this,e,t)},toJSONSchema(e){return Xa(this,{})(e)},get description(){return Oi.get(this)?.description},get _def(){return this._zod.def}}),ws=M(`_ZodString`,(e,t)=>{On.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mo(e,t,n,r)},je({format:e=>lo(e).format??null,minLength:e=>lo(e).minimum??null,maxLength:e=>lo(e).maximum??null},{regex(...e){return this.check(ba(...e))},includes(...e){return this.check(Ca(...e))},startsWith(...e){return this.check(wa(...e))},endsWith(...e){return this.check(Ta(...e))},min(...e){return this.check(va(...e))},max(...e){return this.check(_a(...e))},length(...e){return this.check(ya(...e))},nonempty(...e){return this.check(va(1,...e))},lowercase(e){return this.check(xa(e))},uppercase(e){return this.check(Sa(e))},trim(){return this.check(Oa())},normalize(...e){return this.check(Da(...e))},toLowerCase(){return this.check(ka())},toUpperCase(){return this.check(Aa())},slugify(){return this.check(ja())}})),Ts=M(`ZodString`,(e,t)=>{On.init(e,t),ws.init(e,t)},{email(e){return this.check(ji(js,e))},url(e){return this.check(Li(Fs,e))},jwt(e){return this.check(Qi(Zs,e))},emoji(e){return this.check(Ri(Ls,e))},guid(e){return this.check(Mi(Ns,e))},uuid(e){return this.check(Ni(Ps,e))},uuidv4(e){return this.check(Pi(Ps,e))},uuidv6(e){return this.check(Fi(Ps,e))},uuidv7(e){return this.check(Ii(Ps,e))},nanoid(e){return this.check(zi(Rs,e))},cuid(e){return this.check(Bi(zs,e))},cuid2(e){return this.check(Vi(Bs,e))},ulid(e){return this.check(Hi(Vs,e))},base64(e){return this.check(Yi(Js,e))},base64url(e){return this.check(Xi(Ys,e))},xid(e){return this.check(Ui(Hs,e))},ksuid(e){return this.check(Wi(Us,e))},ipv4(e){return this.check(Gi(Ws,e))},ipv6(e){return this.check(Ki(Gs,e))},cidrv4(e){return this.check(qi(Ks,e))},cidrv6(e){return this.check(Ji(qs,e))},e164(e){return this.check(Zi(Xs,e))},datetime(e){return this.check($i(Ds,e))},date(e){return this.check(ea(Os,e))},time(e){return this.check(ta(ks,e))},duration(e){return this.check(na(As,e))}});function F(e){return Ai(Ts,e)}var Es=M(`ZodStringFormat`,(e,t)=>{kn.init(e,t),ws.init(e,t)}),Ds=M(`ZodISODateTime`,(e,t)=>{Jn.init(e,t),Es.init(e,t)}),Os=M(`ZodISODate`,(e,t)=>{Yn.init(e,t),Es.init(e,t)}),ks=M(`ZodISOTime`,(e,t)=>{Xn.init(e,t),Es.init(e,t)}),As=M(`ZodISODuration`,(e,t)=>{Zn.init(e,t),Es.init(e,t)}),js=M(`ZodEmail`,(e,t)=>{Mn.init(e,t),Es.init(e,t)});function Ms(e){return ji(js,e)}var Ns=M(`ZodGUID`,(e,t)=>{An.init(e,t),Es.init(e,t)}),Ps=M(`ZodUUID`,(e,t)=>{jn.init(e,t),Es.init(e,t)}),Fs=M(`ZodURL`,(e,t)=>{Bn.init(e,t),Es.init(e,t)});function Is(e){return Li(Fs,e)}var Ls=M(`ZodEmoji`,(e,t)=>{Vn.init(e,t),Es.init(e,t)}),Rs=M(`ZodNanoID`,(e,t)=>{Hn.init(e,t),Es.init(e,t)}),zs=M(`ZodCUID`,(e,t)=>{Un.init(e,t),Es.init(e,t)}),Bs=M(`ZodCUID2`,(e,t)=>{Wn.init(e,t),Es.init(e,t)}),Vs=M(`ZodULID`,(e,t)=>{Gn.init(e,t),Es.init(e,t)}),Hs=M(`ZodXID`,(e,t)=>{Kn.init(e,t),Es.init(e,t)}),Us=M(`ZodKSUID`,(e,t)=>{qn.init(e,t),Es.init(e,t)}),Ws=M(`ZodIPv4`,(e,t)=>{Qn.init(e,t),Es.init(e,t)}),Gs=M(`ZodIPv6`,(e,t)=>{tr.init(e,t),Es.init(e,t)}),Ks=M(`ZodCIDRv4`,(e,t)=>{nr.init(e,t),Es.init(e,t)}),qs=M(`ZodCIDRv6`,(e,t)=>{ir.init(e,t),Es.init(e,t)}),Js=M(`ZodBase64`,(e,t)=>{sr.init(e,t),Es.init(e,t)}),Ys=M(`ZodBase64URL`,(e,t)=>{ur.init(e,t),Es.init(e,t)}),Xs=M(`ZodE164`,(e,t)=>{dr.init(e,t),Es.init(e,t)}),Zs=M(`ZodJWT`,(e,t)=>{pr.init(e,t),Es.init(e,t)}),Qs=M(`ZodNumber`,(e,t)=>{mr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r),e.isFinite=!0},je({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=lo(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=lo(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=lo(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>lo(e).format??null},{gt(e,t){return this.check(ma(e,t))},gte(e,t){return this.check(ha(e,t))},min(e,t){return this.check(ha(e,t))},lt(e,t){return this.check(fa(e,t))},lte(e,t){return this.check(pa(e,t))},max(e,t){return this.check(pa(e,t))},int(e){return this.check(ec(e))},safe(e){return this.check(ec(e))},positive(e){return this.check(ma(0,e))},nonnegative(e){return this.check(ha(0,e))},negative(e){return this.check(fa(0,e))},nonpositive(e){return this.check(pa(0,e))},multipleOf(e,t){return this.check(ga(e,t))},step(e,t){return this.check(ga(e,t))},finite(){return this}}));function I(e){return ra(Qs,e)}var $s=M(`ZodNumberFormat`,(e,t)=>{hr.init(e,t),Qs.init(e,t)});function ec(e){return aa($s,e)}var tc=M(`ZodBoolean`,(e,t)=>{gr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(e,t,n,r)});function L(e){return oa(tc,e)}var nc=M(`ZodUndefined`,(e,t)=>{_r.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bo(e,t,n,r)});function rc(e){return sa(nc,e)}var ic=M(`ZodNull`,(e,t)=>{vr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yo(e,t,n,r)});function ac(e){return ca(ic,e)}var oc=M(`ZodAny`,(e,t)=>{yr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function sc(){return la(oc)}var cc=M(`ZodUnknown`,(e,t)=>{br.init(e,t),P.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function R(){return ua(cc)}var lc=M(`ZodNever`,(e,t)=>{xr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r)});function uc(e){return da(lc,e)}var dc=M(`ZodArray`,(e,t)=>{Cs(),Cr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e.element=t.element},{min(e,t){return this.check(va(e,t))},nonempty(e){return this.check(va(1,e))},max(e,t){return this.check(_a(e,t))},length(e,t){return this.check(ya(e,t))},unwrap(){return this.element}});function z(e,t){return Ma(dc,e,t)}var fc=M(`ZodObject`,(e,t)=>{Cs(),kr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zo(e,t,n,r),j(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return W(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(x(this._zod.def,{catchall:e}))},passthrough(){return this.clone(x(this._zod.def,{catchall:R()}))},loose(){return this.clone(x(this._zod.def,{catchall:R()}))},strict(){return this.clone(x(this._zod.def,{catchall:uc()}))},strip(){return this.clone(x(this._zod.def,{catchall:void 0}))},extend(e){return fe(this,e)},safeExtend(e){return pe(this,e)},merge(e){return me(this,e)},pick(e){return le(this,e)},omit(e){return de(this,e)},partial(...e){return he(Cc,this,e[0])},exactPartial(...e){return he(wc,this,e[0],`exactPartial`)},required(...e){return ge(Mc,this,e[0])}});function B(e,t){return new fc({type:`object`,shape:e??{},...T(t)})}function V(e,t){return new fc({type:`object`,shape:e,catchall:R(),...T(t)})}var pc=M(`ZodUnion`,(e,t)=>{jr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.options=t.options});function H(e,t){return new pc({type:`union`,options:e,...T(t)})}var mc=M(`ZodDiscriminatedUnion`,(e,t)=>{pc.init(e,t),Nr.init(e,t)});function hc(e,t,n){return new mc({type:`union`,options:t,discriminator:e,...T(n)})}var gc=M(`ZodIntersection`,(e,t)=>{Pr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vo(e,t,n,r)});function _c(e,t){return new gc({type:`intersection`,left:e,right:t})}var vc=M(`ZodRecord`,(e,t)=>{Cs(),Lr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ko(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function U(e,t,n){return!t||!t._zod?new vc({type:`record`,keyType:F(),valueType:e,...T(t)}):new vc({type:`record`,keyType:e,valueType:t,...T(n)})}var yc=M(`ZodEnum`,(e,t)=>{Rr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new yc({...t,checks:[],...T(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new yc({...t,checks:[],...T(r),entries:i})}});function W(e,t){return new yc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...T(t)})}var bc=M(`ZodLiteral`,(e,t)=>{zr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function G(e,t){return new bc({type:`literal`,values:Array.isArray(e)?e:[e],...T(t)})}var xc=M(`ZodTransform`,(e,t)=>{Cs(),Br.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ge(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(De(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(De(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Sc(e){return new xc({type:`transform`,transform:e})}var Cc=M(`ZodOptional`,(e,t)=>{Hr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function K(e){return new Cc({type:`optional`,innerType:e})}var wc=M(`ZodExactOptional`,(e,t)=>{Ur.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Tc(e){return new wc({type:`optional`,innerType:e})}var Ec=M(`ZodNullable`,(e,t)=>{Wr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Dc(e){return new Ec({type:`nullable`,innerType:e})}var Oc=M(`ZodDefault`,(e,t)=>{Gr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function kc(e,t){return new Oc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():oe(t)}})}var Ac=M(`ZodPrefault`,(e,t)=>{qr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jc(e,t){return new Ac({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():oe(t)}})}var Mc=M(`ZodNonOptional`,(e,t)=>{Jr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Nc(e,t){return new Mc({type:`nonoptional`,innerType:e,...T(t)})}var Pc=M(`ZodCatch`,(e,t)=>{Zr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$o(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Fc(e,t){return new Pc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Re(t)})}var Ic=M(`ZodPipe`,(e,t)=>{Qr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>es(e,t,n,r),e.in=t.in,e.out=t.out});function Lc(e,t){return new Ic({type:`pipe`,in:e,out:t})}var Rc=M(`ZodPreprocess`,(e,t)=>{Ic.init(e,t),ei.init(e,t)}),zc=M(`ZodReadonly`,(e,t)=>{ti.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ts(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Bc(e){return new zc({type:`readonly`,innerType:e})}var Vc=M(`ZodLazy`,(e,t)=>{ri.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>is(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Hc(e){return new Vc({type:`lazy`,getter:e})}var Uc=M(`ZodCustom`,(e,t)=>{ii.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r)});function Wc(e,t={}){return Na(Uc,e,t)}function Gc(e,t){return Pa(e,t)}function Kc(e,t){return new Rc({type:`pipe`,in:Sc(e),out:t})}var qc={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},Jc;Jc||={};function Yc(e){return $i(Ds,e)}function Xc(e){return ea(Os,e)}function Zc(e){return ia(Qs,e)}var Qc=[`2025-11-25`,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],$c=`io.modelcontextprotocol/related-task`,el=`io.modelcontextprotocol/protocolVersion`,tl=`io.modelcontextprotocol/clientInfo`,nl=`io.modelcontextprotocol/serverInfo`,rl=`io.modelcontextprotocol/clientCapabilities`,il=`io.modelcontextprotocol/subscriptionId`,al=`io.modelcontextprotocol/logLevel`,ol=Hc(()=>H([F(),I(),L(),ac(),U(F(),ol),z(ol)])),sl=U(F(),ol),cl=z(ol),ll=H([F(),I().int()]),ul=F(),dl=B({ttl:I().optional()}),fl=B({taskId:F()}),pl=V({progressToken:ll.optional(),[$c]:fl.optional()}),ml=B({_meta:pl.optional()}),hl=ml.extend({task:dl.optional()}),gl=B({method:F(),params:ml.loose().optional()}),_l=B({_meta:pl.optional()}),vl=B({method:F(),params:_l.loose().optional()}),yl=V({get[nl](){return Pl.optional().catch(void 0)}}),bl=V({_meta:yl.optional()}),xl=H([F(),I().int()]),Sl=B({jsonrpc:G(`2.0`),id:xl,...gl.shape}).strict(),Cl=B({jsonrpc:G(`2.0`),...vl.shape}).strict(),wl=B({jsonrpc:G(`2.0`),id:xl,result:bl}).strict(),Tl=B({jsonrpc:G(`2.0`),id:xl.optional(),error:B({code:I().int(),message:F(),data:R().optional()})}).strict(),El=H([Sl,Cl,wl,Tl]),Dl=H([wl,Tl]),Ol=bl.strict(),kl=_l.extend({requestId:xl.optional(),reason:F().optional()}),Al=vl.extend({method:G(`notifications/cancelled`),params:kl}),jl=B({src:F(),mimeType:F().optional(),sizes:z(F()).optional(),theme:W([`light`,`dark`]).optional()}),Ml=B({icons:z(jl).optional()}),Nl=B({name:F(),title:F().optional()}),Pl=Nl.extend({...Nl.shape,...Ml.shape,version:F(),websiteUrl:F().optional(),description:F().optional()}),Fl=Kc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,_c(B({form:_c(B({applyDefaults:L().optional()}),sl).optional(),url:sl.optional()}),sl.optional())),Il=V({list:sl.optional(),cancel:sl.optional(),requests:V({sampling:V({createMessage:sl.optional()}).optional(),elicitation:V({create:sl.optional()}).optional()}).optional()}),Ll=V({list:sl.optional(),cancel:sl.optional(),requests:V({tools:V({call:sl.optional()}).optional()}).optional()}),Rl=B({experimental:U(F(),sl).optional(),sampling:B({context:sl.optional(),tools:sl.optional()}).optional(),elicitation:Fl.optional(),roots:B({listChanged:L().optional()}).optional(),tasks:Il.optional(),extensions:U(F(),sl).optional()}),zl=ml.extend({protocolVersion:F(),capabilities:Rl,clientInfo:Pl}),Bl=gl.extend({method:G(`initialize`),params:zl}),Vl=B({experimental:U(F(),sl).optional(),logging:sl.optional(),completions:sl.optional(),prompts:B({listChanged:L().optional()}).optional(),resources:B({subscribe:L().optional(),listChanged:L().optional()}).optional(),tools:B({listChanged:L().optional()}).optional(),tasks:Ll.optional(),extensions:U(F(),sl).optional()}),Hl=bl.extend({protocolVersion:F(),capabilities:Vl,serverInfo:Pl,instructions:F().optional()}),Ul=vl.extend({method:G(`notifications/initialized`),params:_l.optional()}),Wl=gl.extend({method:G(`server/discover`),params:ml.optional()}),Gl=bl.extend({supportedVersions:z(F()),capabilities:Vl,instructions:F().optional()}),Kl=gl.extend({method:G(`ping`),params:ml.optional()}),ql=B({progress:I(),total:K(I()),message:K(F())}),Jl=B({..._l.shape,...ql.shape,progressToken:ll}),Yl=vl.extend({method:G(`notifications/progress`),params:Jl}),Xl=ml.extend({cursor:ul.optional()}),Zl=gl.extend({params:Xl.optional()}),Ql=bl.extend({nextCursor:ul.optional()}),$l=B({uri:F(),mimeType:K(F()),_meta:U(F(),R()).optional()}),eu=$l.extend({text:F()}),tu=F().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),nu=$l.extend({blob:tu}),ru=W([`user`,`assistant`]),iu=B({audience:z(ru).optional(),priority:I().min(0).max(1).optional(),lastModified:Yc({offset:!0}).optional()}),au=B({...Nl.shape,...Ml.shape,uri:F(),description:K(F()),mimeType:K(F()),size:K(I()),annotations:iu.optional(),_meta:K(V({}))}),ou=B({...Nl.shape,...Ml.shape,uriTemplate:F(),description:K(F()),mimeType:K(F()),annotations:iu.optional(),_meta:K(V({}))}),su=Zl.extend({method:G(`resources/list`)}),cu=Ql.extend({resources:z(au)}),lu=Zl.extend({method:G(`resources/templates/list`)}),uu=Ql.extend({resourceTemplates:z(ou)}),du=ml.extend({uri:F()}),fu=du,pu=gl.extend({method:G(`resources/read`),params:fu}),mu=bl.extend({contents:z(H([eu,nu]))}),hu=vl.extend({method:G(`notifications/resources/list_changed`),params:_l.optional()}),gu=du,_u=gl.extend({method:G(`resources/subscribe`),params:gu}),vu=du,yu=gl.extend({method:G(`resources/unsubscribe`),params:vu}),bu=B({toolsListChanged:L().optional(),promptsListChanged:L().optional(),resourcesListChanged:L().optional(),resourceSubscriptions:z(F()).optional()}),xu=ml.extend({notifications:bu}),Su=gl.extend({method:G(`subscriptions/listen`),params:xu}),Cu=_l.extend({notifications:bu}),wu=vl.extend({method:G(`notifications/subscriptions/acknowledged`),params:Cu}),Tu=yl.extend({[il]:xl}),Eu=bl.extend({_meta:Tu}),Du=_l.extend({uri:F()}),Ou=vl.extend({method:G(`notifications/resources/updated`),params:Du}),ku=B({name:F(),description:K(F()),required:K(L())}),Au=B({...Nl.shape,...Ml.shape,description:K(F()),arguments:K(z(ku)),_meta:K(V({}))}),ju=Zl.extend({method:G(`prompts/list`)}),Mu=Ql.extend({prompts:z(Au)}),Nu=ml.extend({name:F(),arguments:U(F(),F()).optional()}),Pu=gl.extend({method:G(`prompts/get`),params:Nu}),Fu=B({type:G(`text`),text:F(),annotations:iu.optional(),_meta:U(F(),R()).optional()}),Iu=B({type:G(`image`),data:tu,mimeType:F(),annotations:iu.optional(),_meta:U(F(),R()).optional()}),Lu=B({type:G(`audio`),data:tu,mimeType:F(),annotations:iu.optional(),_meta:U(F(),R()).optional()}),Ru=B({type:G(`tool_use`),name:F(),id:F(),input:U(F(),R()),_meta:U(F(),R()).optional()}),zu=B({type:G(`resource`),resource:H([eu,nu]),annotations:iu.optional(),_meta:U(F(),R()).optional()}),Bu=au.extend({type:G(`resource_link`)}),Vu=H([Fu,Iu,Lu,Bu,zu]),Hu=B({role:ru,content:Vu}),Uu=bl.extend({description:F().optional(),messages:z(Hu)}),Wu=vl.extend({method:G(`notifications/prompts/list_changed`),params:_l.optional()}),Gu=B({title:F().optional(),readOnlyHint:L().optional(),destructiveHint:L().optional(),idempotentHint:L().optional(),openWorldHint:L().optional()}),Ku=B({taskSupport:W([`required`,`optional`,`forbidden`]).optional()}),qu=B({...Nl.shape,...Ml.shape,description:F().optional(),inputSchema:B({type:G(`object`),properties:U(F(),ol).optional(),required:z(F()).optional()}).catchall(R()),outputSchema:V({$schema:F().optional()}).optional(),annotations:Gu.optional(),execution:Ku.optional(),_meta:U(F(),R()).optional()}),Ju=Zl.extend({method:G(`tools/list`)}),Yu=Ql.extend({tools:z(qu)}),Xu=bl.extend({content:z(Vu).default([]),structuredContent:R().optional(),isError:L().optional()}),Zu=Xu.or(bl.extend({toolResult:R()})),Qu=hl.extend({name:F(),arguments:U(F(),R()).optional()}),$u=gl.extend({method:G(`tools/call`),params:Qu}),ed=vl.extend({method:G(`notifications/tools/list_changed`),params:_l.optional()}),td=B({autoRefresh:L().default(!0),debounceMs:I().int().nonnegative().default(300)}),nd=W([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),rd=ml.extend({level:nd}),id=gl.extend({method:G(`logging/setLevel`),params:rd}),ad=_l.extend({level:nd,logger:F().optional(),data:R()}),od=vl.extend({method:G(`notifications/message`),params:ad}),sd=B({name:F().optional()}),cd=B({hints:z(sd).optional(),costPriority:I().min(0).max(1).optional(),speedPriority:I().min(0).max(1).optional(),intelligencePriority:I().min(0).max(1).optional()}),ld=B({mode:W([`auto`,`required`,`none`]).optional()}),ud=B({type:G(`tool_result`),toolUseId:F().describe(`The unique identifier for the corresponding tool call.`),content:z(Vu),structuredContent:R().optional(),isError:L().optional(),_meta:U(F(),R()).optional()}),dd=hc(`type`,[Fu,Iu,Lu]),fd=hc(`type`,[Fu,Iu,Lu,Ru,ud]),pd=B({role:ru,content:H([fd,z(fd)]),_meta:U(F(),R()).optional()}),md=hl.extend({messages:z(pd),modelPreferences:cd.optional(),systemPrompt:F().optional(),includeContext:W([`none`,`thisServer`,`allServers`]).optional(),temperature:I().optional(),maxTokens:I().int(),stopSequences:z(F()).optional(),metadata:sl.optional(),tools:z(qu).optional(),toolChoice:ld.optional()}),hd=gl.extend({method:G(`sampling/createMessage`),params:md}),gd=bl.extend({model:F(),stopReason:K(W([`endTurn`,`stopSequence`,`maxTokens`]).or(F())),role:ru,content:dd}),_d=bl.extend({model:F(),stopReason:K(W([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(F())),role:ru,content:H([fd,z(fd)])}),vd=B({type:G(`boolean`),title:F().optional(),description:F().optional(),default:L().optional()}),yd=B({type:G(`string`),title:F().optional(),description:F().optional(),minLength:I().optional(),maxLength:I().optional(),format:W([`email`,`uri`,`date`,`date-time`]).optional(),default:F().optional()}),bd=B({type:W([`number`,`integer`]),title:F().optional(),description:F().optional(),minimum:I().optional(),maximum:I().optional(),default:I().optional()}),xd=B({type:G(`string`),title:F().optional(),description:F().optional(),enum:z(F()),default:F().optional()}),Sd=B({type:G(`string`),title:F().optional(),description:F().optional(),oneOf:z(B({const:F(),title:F()})),default:F().optional()}),Cd=B({type:G(`string`),title:F().optional(),description:F().optional(),enum:z(F()),enumNames:z(F()).optional(),default:F().optional()}),wd=H([xd,Sd]),Td=B({type:G(`array`),title:F().optional(),description:F().optional(),minItems:I().optional(),maxItems:I().optional(),items:B({type:G(`string`),enum:z(F())}),default:z(F()).optional()}),Ed=B({type:G(`array`),title:F().optional(),description:F().optional(),minItems:I().optional(),maxItems:I().optional(),items:B({anyOf:z(B({const:F(),title:F()}))}),default:z(F()).optional()}),Dd=H([Td,Ed]),Od=H([Cd,wd,Dd]),kd=H([Od,vd,yd,bd]),Ad=hl.extend({mode:G(`form`).optional(),message:F(),requestedSchema:B({type:G(`object`),properties:U(F(),kd),required:z(F()).optional()}).catchall(R())}),jd=hl.extend({mode:G(`url`),message:F(),elicitationId:F(),url:F().url()}),Md=H([Ad,jd]),Nd=gl.extend({method:G(`elicitation/create`),params:Md}),Pd=_l.extend({elicitationId:F()}),Fd=vl.extend({method:G(`notifications/elicitation/complete`),params:Pd}),Id=bl.extend({action:W([`accept`,`decline`,`cancel`]),content:Kc(e=>e===null?void 0:e,U(F(),H([F(),I(),L(),z(F())])).optional())}),Ld=B({type:G(`ref/resource`),uri:F()}),Rd=B({type:G(`ref/prompt`),name:F()}),zd=ml.extend({ref:H([Rd,Ld]),argument:B({name:F(),value:F()}),context:B({arguments:U(F(),F()).optional()}).optional()}),Bd=gl.extend({method:G(`completion/complete`),params:zd}),Vd=bl.extend({completion:V({values:z(F()).max(100),total:K(I().int()),hasMore:K(L())})}),Hd=B({uri:F().startsWith(`file://`),name:F().optional(),_meta:U(F(),R()).optional()}),Ud=gl.extend({method:G(`roots/list`),params:ml.optional()}),Wd=bl.extend({roots:z(Hd)}),Gd=vl.extend({method:G(`notifications/roots/list_changed`),params:_l.optional()}),Kd=V({ttl:I().optional(),pollInterval:I().optional()}),qd=W([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Jd=B({taskId:F(),status:qd,ttl:H([I(),ac()]),createdAt:F(),lastUpdatedAt:F(),pollInterval:K(I()),statusMessage:K(F())}),Yd=bl.extend({task:Jd}),Xd=_l.merge(Jd),Zd=vl.extend({method:G(`notifications/tasks/status`),params:Xd}),Qd=gl.extend({method:G(`tasks/get`),params:ml.extend({taskId:F()})}),$d=bl.merge(Jd),ef=gl.extend({method:G(`tasks/result`),params:ml.extend({taskId:F()})}),tf=bl.loose(),nf=Zl.extend({method:G(`tasks/list`)}),rf=Ql.extend({tasks:z(Jd)}),af=gl.extend({method:G(`tasks/cancel`),params:ml.extend({taskId:F()})}),of=bl.merge(Jd),sf=H([Kl,Bl,Wl,Bd,id,Pu,ju,su,lu,pu,_u,yu,Su,$u,Ju]),cf=H([Al,Yl,Ul,Gd]),lf=H([Ol,gd,_d,Id,Wd]),uf=H([Kl,hd,Nd,Ud]),df=H([Al,Yl,od,Ou,hu,ed,Wu,wu,Fd]),ff=H([Ol,Hl,Gl,Vd,Uu,Mu,cu,uu,mu,Xu,Yu,Eu]),pf=Is().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:qc.custom,message:`URL must be parseable`,fatal:!0}),Be}).refine(e=>{let t=new URL(e);return t.protocol!==`javascript:`&&t.protocol!==`data:`&&t.protocol!==`vbscript:`},{message:`URL cannot use javascript:, data:, or vbscript: scheme`}),mf=V({resource:F().url(),authorization_servers:z(pf).optional(),jwks_uri:F().url().optional(),scopes_supported:z(F()).optional(),bearer_methods_supported:z(F()).optional(),resource_signing_alg_values_supported:z(F()).optional(),resource_name:F().optional(),resource_documentation:F().optional(),resource_policy_uri:F().url().optional(),resource_tos_uri:F().url().optional(),tls_client_certificate_bound_access_tokens:L().optional(),authorization_details_types_supported:z(F()).optional(),dpop_signing_alg_values_supported:z(F()).optional(),dpop_bound_access_tokens_required:L().optional()}),hf=V({issuer:F(),authorization_endpoint:pf,token_endpoint:pf,registration_endpoint:pf.optional(),scopes_supported:z(F()).optional(),response_types_supported:z(F()),response_modes_supported:z(F()).optional(),grant_types_supported:z(F()).optional(),token_endpoint_auth_methods_supported:z(F()).optional(),token_endpoint_auth_signing_alg_values_supported:z(F()).optional(),service_documentation:pf.optional(),revocation_endpoint:pf.optional(),revocation_endpoint_auth_methods_supported:z(F()).optional(),revocation_endpoint_auth_signing_alg_values_supported:z(F()).optional(),introspection_endpoint:F().optional(),introspection_endpoint_auth_methods_supported:z(F()).optional(),introspection_endpoint_auth_signing_alg_values_supported:z(F()).optional(),code_challenge_methods_supported:z(F()).optional(),client_id_metadata_document_supported:L().optional(),authorization_response_iss_parameter_supported:L().optional().catch(void 0),dpop_signing_alg_values_supported:z(F()).optional()}),gf=V({issuer:F(),authorization_endpoint:pf,token_endpoint:pf,userinfo_endpoint:pf.optional(),jwks_uri:pf,registration_endpoint:pf.optional(),scopes_supported:z(F()).optional(),response_types_supported:z(F()),response_modes_supported:z(F()).optional(),grant_types_supported:z(F()).optional(),acr_values_supported:z(F()).optional(),subject_types_supported:z(F()),id_token_signing_alg_values_supported:z(F()),id_token_encryption_alg_values_supported:z(F()).optional(),id_token_encryption_enc_values_supported:z(F()).optional(),userinfo_signing_alg_values_supported:z(F()).optional(),userinfo_encryption_alg_values_supported:z(F()).optional(),userinfo_encryption_enc_values_supported:z(F()).optional(),request_object_signing_alg_values_supported:z(F()).optional(),request_object_encryption_alg_values_supported:z(F()).optional(),request_object_encryption_enc_values_supported:z(F()).optional(),token_endpoint_auth_methods_supported:z(F()).optional(),token_endpoint_auth_signing_alg_values_supported:z(F()).optional(),display_values_supported:z(F()).optional(),claim_types_supported:z(F()).optional(),claims_supported:z(F()).optional(),service_documentation:F().optional(),claims_locales_supported:z(F()).optional(),ui_locales_supported:z(F()).optional(),claims_parameter_supported:L().optional(),request_parameter_supported:L().optional(),request_uri_parameter_supported:L().optional(),require_request_uri_registration:L().optional(),op_policy_uri:pf.optional(),op_tos_uri:pf.optional(),client_id_metadata_document_supported:L().optional(),authorization_response_iss_parameter_supported:L().optional().catch(void 0)}),_f=B({...gf.shape,...hf.pick({code_challenge_methods_supported:!0}).shape}),vf=B({access_token:F(),id_token:F().optional(),token_type:F(),expires_in:Zc().optional(),scope:F().optional(),refresh_token:F().optional(),issuer:F().optional().catch(void 0)}).strip(),yf=B({issued_token_type:G(`urn:ietf:params:oauth:token-type:id-jag`),access_token:F(),token_type:F().optional(),expires_in:I().optional(),scope:F().optional()}).strip(),bf=B({error:F(),error_description:F().optional(),error_uri:F().optional()}),xf=pf.optional().or(G(``).transform(()=>void 0)),Sf=B({redirect_uris:z(pf),token_endpoint_auth_method:F().optional(),grant_types:z(F()).optional(),response_types:z(F()).optional(),application_type:F().optional(),client_name:F().optional(),client_uri:pf.optional(),logo_uri:xf,scope:F().optional(),contacts:z(F()).optional(),tos_uri:xf,policy_uri:F().optional(),jwks_uri:pf.optional(),jwks:sc().optional(),software_id:F().optional(),software_version:F().optional(),software_statement:F().optional()}).strip(),Cf=B({client_id:F(),client_secret:F().optional(),client_id_issued_at:I().optional(),client_secret_expires_at:I().optional(),issuer:F().optional().catch(void 0)}).strip(),wf=Sf.merge(Cf),Tf=B({error:F(),error_description:F().optional()}).strip(),Ef=B({token:F(),token_type_hint:F().optional()}).strip(),Df=Symbol.for(`mcp.sdk.errorBrands`);function Of(e,t){let n=new Set,r=t;for(;typeof r==`function`;){let e=r.mcpBrand;Object.prototype.hasOwnProperty.call(r,`mcpBrand`)&&typeof e==`string`&&n.add(e),r=Object.getPrototypeOf(r)}n.size!==0&&Object.defineProperty(e,Df,{value:n,enumerable:!1,configurable:!0})}function kf(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,Df)){let n=t[Df];if(n&&typeof n.has==`function`&&n.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}(class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthError`})}static[Symbol.hasInstance](e){return kf(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return kf(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,Of(this,new.target)}toResponseObject(){let e={error:this.code,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}});var Af=function(e){return e.NotConnected=`NOT_CONNECTED`,e.AlreadyConnected=`ALREADY_CONNECTED`,e.NotInitialized=`NOT_INITIALIZED`,e.CapabilityNotSupported=`CAPABILITY_NOT_SUPPORTED`,e.RequestTimeout=`REQUEST_TIMEOUT`,e.ConnectionClosed=`CONNECTION_CLOSED`,e.SendFailed=`SEND_FAILED`,e.InvalidResult=`INVALID_RESULT`,e.UnsupportedResultType=`UNSUPPORTED_RESULT_TYPE`,e.InputRequiredRoundsExceeded=`INPUT_REQUIRED_ROUNDS_EXCEEDED`,e.ListPaginationExceeded=`LIST_PAGINATION_EXCEEDED`,e.MethodNotSupportedByProtocolVersion=`METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION`,e.EraNegotiationFailed=`ERA_NEGOTIATION_FAILED`,e.ClientHttpNotImplemented=`CLIENT_HTTP_NOT_IMPLEMENTED`,e.ClientHttpAuthentication=`CLIENT_HTTP_AUTHENTICATION`,e.ClientHttpForbidden=`CLIENT_HTTP_FORBIDDEN`,e.ClientHttpUnexpectedContent=`CLIENT_HTTP_UNEXPECTED_CONTENT`,e.ClientHttpFailedToOpenStream=`CLIENT_HTTP_FAILED_TO_OPEN_STREAM`,e.ClientHttpFailedToTerminateSession=`CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION`,e}({}),jf=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkError`})}static[Symbol.hasInstance](e){return kf(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return kf(this,e)}constructor(e,t,n,r){super(t,r),this.code=e,this.data=n,this.name=`SdkError`,Of(this,new.target)}};(class extends jf{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkHttpError`})}constructor(e,t,n,r){super(e,t,n,r),this.name=`SdkHttpError`}get status(){return this.data.status}get statusText(){return this.data.statusText}});var Mf=`2026-07-28`;function Nf(e){return e>=Mf}function Pf(e){let t=e.structuredContent;return t===void 0||typeof t==`object`&&t&&!Array.isArray(t)||(e.content?.some(e=>e.type===`text`)??!1)?e:{...e,content:[...e.content??[],{type:`text`,text:JSON.stringify(t)}]}}var Ff=[`task`,`inputRequests`,`requestState`];function If(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||Ff.some(t=>t in e)?e:{...e,content:[]}}function Lf(){let e=Hc(()=>H([F(),I(),L(),ac(),U(F(),e),z(e)])),t=U(F(),e),n=H([F(),I().int()]),r=F(),i=B({ttl:I().optional()}),a=B({taskId:F()}),o=V({progressToken:n.optional(),"io.modelcontextprotocol/related-task":a.optional()}),s=B({_meta:o.optional()}),c=s.extend({task:i.optional()}),l=B({method:F(),params:s.loose().optional()}),u=B({_meta:o.optional()}),d=B({method:F(),params:u.loose().optional()}),f=V({_meta:o.optional()}),p=H([F(),I().int()]),m=f.strict(),h=u.extend({requestId:p.optional(),reason:F().optional()}),g=d.extend({method:G(`notifications/cancelled`),params:h}),_=B({src:F(),mimeType:F().optional(),sizes:z(F()).optional(),theme:W([`light`,`dark`]).optional()}),v=B({icons:z(_).optional()}),y=B({name:F(),title:F().optional()}),b=y.extend({...y.shape,...v.shape,version:F(),websiteUrl:F().optional(),description:F().optional()}),ee=Kc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,_c(B({form:_c(B({applyDefaults:L().optional()}),t).optional(),url:t.optional()}),t.optional())),x=V({list:t.optional(),cancel:t.optional(),requests:V({sampling:V({createMessage:t.optional()}).optional(),elicitation:V({create:t.optional()}).optional()}).optional()}),te=V({list:t.optional(),cancel:t.optional(),requests:V({tools:V({call:t.optional()}).optional()}).optional()}),ne=B({experimental:U(F(),t).optional(),sampling:B({context:t.optional(),tools:t.optional()}).optional(),elicitation:ee.optional(),roots:B({listChanged:L().optional()}).optional(),tasks:x.optional(),extensions:U(F(),t).optional()}),re=s.extend({protocolVersion:F(),capabilities:ne,clientInfo:b}),ie=l.extend({method:G(`initialize`),params:re}),S=B({experimental:U(F(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:B({listChanged:L().optional()}).optional(),resources:B({subscribe:L().optional(),listChanged:L().optional()}).optional(),tools:B({listChanged:L().optional()}).optional(),tasks:te.optional(),extensions:U(F(),t).optional()}),ae=f.extend({protocolVersion:F(),capabilities:S,serverInfo:b,instructions:F().optional()}),oe=d.extend({method:G(`notifications/initialized`),params:u.optional()}),se=l.extend({method:G(`ping`),params:s.optional()}),C=B({progress:I(),total:K(I()),message:K(F())}),w=B({...u.shape,...C.shape,progressToken:n}),T=d.extend({method:G(`notifications/progress`),params:w}),ce=s.extend({cursor:r.optional()}),E=l.extend({params:ce.optional()}),D=f.extend({nextCursor:r.optional()}),O=B({uri:F(),mimeType:K(F()),_meta:U(F(),R()).optional()}),le=O.extend({text:F()}),ue=F().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),de=O.extend({blob:ue}),fe=W([`user`,`assistant`]),k=B({audience:z(fe).optional(),priority:I().min(0).max(1).optional(),lastModified:Yc({offset:!0}).optional()}),pe=B({...y.shape,...v.shape,uri:F(),description:K(F()),mimeType:K(F()),size:K(I()),annotations:k.optional(),_meta:K(V({}))}),me=B({...y.shape,...v.shape,uriTemplate:F(),description:K(F()),mimeType:K(F()),annotations:k.optional(),_meta:K(V({}))}),he=E.extend({method:G(`resources/list`)}),ge=D.extend({resources:z(pe)}),_e=E.extend({method:G(`resources/templates/list`)}),ve=D.extend({resourceTemplates:z(me)}),ye=s.extend({uri:F()}),be=ye,xe=l.extend({method:G(`resources/read`),params:be}),Se=f.extend({contents:z(H([le,de]))}),Ce=d.extend({method:G(`notifications/resources/list_changed`),params:u.optional()}),we=ye,Te=l.extend({method:G(`resources/subscribe`),params:we}),Ee=ye,De=l.extend({method:G(`resources/unsubscribe`),params:Ee}),Oe=u.extend({uri:F()}),ke=d.extend({method:G(`notifications/resources/updated`),params:Oe}),Ae=B({name:F(),description:K(F()),required:K(L())}),je=B({...y.shape,...v.shape,description:K(F()),arguments:K(z(Ae)),_meta:K(V({}))}),Me=E.extend({method:G(`prompts/list`)}),Ne=D.extend({prompts:z(je)}),Pe=s.extend({name:F(),arguments:U(F(),F()).optional()}),Fe=l.extend({method:G(`prompts/get`),params:Pe}),Ie=B({type:G(`text`),text:F(),annotations:k.optional(),_meta:U(F(),R()).optional()}),A=B({type:G(`image`),data:ue,mimeType:F(),annotations:k.optional(),_meta:U(F(),R()).optional()}),j=B({type:G(`audio`),data:ue,mimeType:F(),annotations:k.optional(),_meta:U(F(),R()).optional()}),Le=B({type:G(`tool_use`),name:F(),id:F(),input:U(F(),R()),_meta:U(F(),R()).optional()}),Re=B({type:G(`resource`),resource:H([le,de]),annotations:k.optional(),_meta:U(F(),R()).optional()}),ze=pe.extend({type:G(`resource_link`)}),Be=H([Ie,A,j,ze,Re]),Ve=B({role:fe,content:Be}),He=f.extend({description:F().optional(),messages:z(Ve)}),Ue=d.extend({method:G(`notifications/prompts/list_changed`),params:u.optional()}),M=B({title:F().optional(),readOnlyHint:L().optional(),destructiveHint:L().optional(),idempotentHint:L().optional(),openWorldHint:L().optional()}),We=B({taskSupport:W([`required`,`optional`,`forbidden`]).optional()}),Ge=B({...y.shape,...v.shape,description:F().optional(),inputSchema:B({type:G(`object`),properties:U(F(),e).optional(),required:z(F()).optional()}).catchall(R()),outputSchema:B({type:G(`object`),properties:U(F(),e).optional(),required:z(F()).optional()}).catchall(R()).optional(),annotations:M.optional(),execution:We.optional(),_meta:U(F(),R()).optional()}),Ke=E.extend({method:G(`tools/list`)}),qe=D.extend({tools:z(Ge)}),Je=f.extend({content:z(Be),structuredContent:U(F(),R()).optional(),isError:L().optional()}),Ye=c.extend({name:F(),arguments:U(F(),R()).optional()}),Xe=l.extend({method:G(`tools/call`),params:Ye}),Ze=d.extend({method:G(`notifications/tools/list_changed`),params:u.optional()}),Qe=W([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),$e=s.extend({level:Qe}),et=l.extend({method:G(`logging/setLevel`),params:$e}),tt=u.extend({level:Qe,logger:F().optional(),data:R()}),nt=d.extend({method:G(`notifications/message`),params:tt}),rt=B({name:F().optional()}),it=B({hints:z(rt).optional(),costPriority:I().min(0).max(1).optional(),speedPriority:I().min(0).max(1).optional(),intelligencePriority:I().min(0).max(1).optional()}),at=B({mode:W([`auto`,`required`,`none`]).optional()}),ot=B({type:G(`tool_result`),toolUseId:F().describe(`The unique identifier for the corresponding tool call.`),content:z(Be),structuredContent:B({}).loose().optional(),isError:L().optional(),_meta:U(F(),R()).optional()}),st=hc(`type`,[Ie,A,j]),ct=hc(`type`,[Ie,A,j,Le,ot]),lt=B({role:fe,content:H([ct,z(ct)]),_meta:U(F(),R()).optional()}),ut=c.extend({messages:z(lt),modelPreferences:it.optional(),systemPrompt:F().optional(),includeContext:W([`none`,`thisServer`,`allServers`]).optional(),temperature:I().optional(),maxTokens:I().int(),stopSequences:z(F()).optional(),metadata:t.optional(),tools:z(Ge).optional(),toolChoice:at.optional()}),dt=l.extend({method:G(`sampling/createMessage`),params:ut}),ft=f.extend({model:F(),stopReason:K(W([`endTurn`,`stopSequence`,`maxTokens`]).or(F())),role:fe,content:st}),pt=f.extend({model:F(),stopReason:K(W([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(F())),role:fe,content:H([ct,z(ct)])}),mt=B({type:G(`boolean`),title:F().optional(),description:F().optional(),default:L().optional()}),ht=B({type:G(`string`),title:F().optional(),description:F().optional(),minLength:I().optional(),maxLength:I().optional(),format:W([`email`,`uri`,`date`,`date-time`]).optional(),default:F().optional()}),gt=B({type:W([`number`,`integer`]),title:F().optional(),description:F().optional(),minimum:I().optional(),maximum:I().optional(),default:I().optional()}),_t=B({type:G(`string`),title:F().optional(),description:F().optional(),enum:z(F()),default:F().optional()}),vt=B({type:G(`string`),title:F().optional(),description:F().optional(),oneOf:z(B({const:F(),title:F()})),default:F().optional()}),yt=B({type:G(`string`),title:F().optional(),description:F().optional(),enum:z(F()),enumNames:z(F()).optional(),default:F().optional()}),bt=H([_t,vt]),xt=B({type:G(`array`),title:F().optional(),description:F().optional(),minItems:I().optional(),maxItems:I().optional(),items:B({type:G(`string`),enum:z(F())}),default:z(F()).optional()}),St=B({type:G(`array`),title:F().optional(),description:F().optional(),minItems:I().optional(),maxItems:I().optional(),items:B({anyOf:z(B({const:F(),title:F()}))}),default:z(F()).optional()}),Ct=H([xt,St]),wt=H([yt,bt,Ct]),Tt=H([wt,mt,ht,gt]),Et=c.extend({mode:G(`form`).optional(),message:F(),requestedSchema:B({type:G(`object`),properties:U(F(),Tt),required:z(F()).optional()}).catchall(R())}),Dt=c.extend({mode:G(`url`),message:F(),elicitationId:F(),url:F().url()}),Ot=H([Et,Dt]),kt=l.extend({method:G(`elicitation/create`),params:Ot}),At=u.extend({elicitationId:F()}),jt=d.extend({method:G(`notifications/elicitation/complete`),params:At}),Mt=f.extend({action:W([`accept`,`decline`,`cancel`]),content:Kc(e=>e===null?void 0:e,U(F(),H([F(),I(),L(),z(F())])).optional())}),Nt=B({type:G(`ref/resource`),uri:F()}),Pt=B({type:G(`ref/prompt`),name:F()}),Ft=s.extend({ref:H([Pt,Nt]),argument:B({name:F(),value:F()}),context:B({arguments:U(F(),F()).optional()}).optional()}),It=l.extend({method:G(`completion/complete`),params:Ft}),Lt=f.extend({completion:V({values:z(F()).max(100),total:K(I().int()),hasMore:K(L())})}),Rt=B({uri:F().startsWith(`file://`),name:F().optional(),_meta:U(F(),R()).optional()}),zt=l.extend({method:G(`roots/list`),params:s.optional()}),Bt=f.extend({roots:z(Rt)}),Vt=d.extend({method:G(`notifications/roots/list_changed`),params:u.optional()}),Ht=V({ttl:I().optional(),pollInterval:I().optional()}),Ut=W([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Wt=B({taskId:F(),status:Ut,ttl:H([I(),ac()]),createdAt:F(),lastUpdatedAt:F(),pollInterval:K(I()),statusMessage:K(F())}),Gt=f.extend({task:Wt}),Kt=u.merge(Wt),qt=d.extend({method:G(`notifications/tasks/status`),params:Kt}),Jt=l.extend({method:G(`tasks/get`),params:s.extend({taskId:F()})}),Yt=f.merge(Wt),Xt=l.extend({method:G(`tasks/result`),params:s.extend({taskId:F()})}),Zt=f.loose(),Qt=E.extend({method:G(`tasks/list`)}),$t=D.extend({tasks:z(Wt)}),en=l.extend({method:G(`tasks/cancel`),params:s.extend({taskId:F()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,TaskMetadataSchema:i,RelatedTaskMetadataSchema:a,RequestMetaSchema:o,BaseRequestParamsSchema:s,TaskAugmentedRequestParamsSchema:c,RequestSchema:l,NotificationsParamsSchema:u,NotificationSchema:d,ResultSchema:f,RequestIdSchema:p,EmptyResultSchema:m,CancelledNotificationParamsSchema:h,CancelledNotificationSchema:g,IconSchema:_,IconsSchema:v,BaseMetadataSchema:y,ImplementationSchema:b,ClientTasksCapabilitySchema:x,ServerTasksCapabilitySchema:te,ClientCapabilitiesSchema:ne,InitializeRequestParamsSchema:re,InitializeRequestSchema:ie,ServerCapabilitiesSchema:S,InitializeResultSchema:ae,InitializedNotificationSchema:oe,PingRequestSchema:se,ProgressSchema:C,ProgressNotificationParamsSchema:w,ProgressNotificationSchema:T,PaginatedRequestParamsSchema:ce,PaginatedRequestSchema:E,PaginatedResultSchema:D,ResourceContentsSchema:O,TextResourceContentsSchema:le,BlobResourceContentsSchema:de,RoleSchema:fe,AnnotationsSchema:k,ResourceSchema:pe,ResourceTemplateSchema:me,ListResourcesRequestSchema:he,ListResourcesResultSchema:ge,ListResourceTemplatesRequestSchema:_e,ListResourceTemplatesResultSchema:ve,ResourceRequestParamsSchema:ye,ReadResourceRequestParamsSchema:be,ReadResourceRequestSchema:xe,ReadResourceResultSchema:Se,ResourceListChangedNotificationSchema:Ce,SubscribeRequestParamsSchema:we,SubscribeRequestSchema:Te,UnsubscribeRequestParamsSchema:Ee,UnsubscribeRequestSchema:De,ResourceUpdatedNotificationParamsSchema:Oe,ResourceUpdatedNotificationSchema:ke,PromptArgumentSchema:Ae,PromptSchema:je,ListPromptsRequestSchema:Me,ListPromptsResultSchema:Ne,GetPromptRequestParamsSchema:Pe,GetPromptRequestSchema:Fe,TextContentSchema:Ie,ImageContentSchema:A,AudioContentSchema:j,ToolUseContentSchema:Le,EmbeddedResourceSchema:Re,ResourceLinkSchema:ze,ContentBlockSchema:Be,PromptMessageSchema:Ve,GetPromptResultSchema:He,PromptListChangedNotificationSchema:Ue,ToolAnnotationsSchema:M,ToolExecutionSchema:We,ToolSchema:Ge,ListToolsRequestSchema:Ke,ListToolsResultSchema:qe,CallToolResultSchema:Je,CallToolRequestParamsSchema:Ye,CallToolRequestSchema:Xe,ToolListChangedNotificationSchema:Ze,LoggingLevelSchema:Qe,SetLevelRequestParamsSchema:$e,SetLevelRequestSchema:et,LoggingMessageNotificationParamsSchema:tt,LoggingMessageNotificationSchema:nt,ModelHintSchema:rt,ModelPreferencesSchema:it,ToolChoiceSchema:at,ToolResultContentSchema:ot,SamplingContentSchema:st,SamplingMessageContentBlockSchema:ct,SamplingMessageSchema:lt,CreateMessageRequestParamsSchema:ut,CreateMessageRequestSchema:dt,CreateMessageResultSchema:ft,CreateMessageResultWithToolsSchema:pt,BooleanSchemaSchema:mt,StringSchemaSchema:ht,NumberSchemaSchema:gt,UntitledSingleSelectEnumSchemaSchema:_t,TitledSingleSelectEnumSchemaSchema:vt,LegacyTitledEnumSchemaSchema:yt,SingleSelectEnumSchemaSchema:bt,UntitledMultiSelectEnumSchemaSchema:xt,TitledMultiSelectEnumSchemaSchema:St,MultiSelectEnumSchemaSchema:Ct,EnumSchemaSchema:wt,PrimitiveSchemaDefinitionSchema:Tt,ElicitRequestFormParamsSchema:Et,ElicitRequestURLParamsSchema:Dt,ElicitRequestParamsSchema:Ot,ElicitRequestSchema:kt,ElicitationCompleteNotificationParamsSchema:At,ElicitationCompleteNotificationSchema:jt,ElicitResultSchema:Mt,ResourceTemplateReferenceSchema:Nt,PromptReferenceSchema:Pt,CompleteRequestParamsSchema:Ft,CompleteRequestSchema:It,CompleteResultSchema:Lt,RootSchema:Rt,ListRootsRequestSchema:zt,ListRootsResultSchema:Bt,RootsListChangedNotificationSchema:Vt,TaskCreationParamsSchema:Ht,TaskStatusSchema:Ut,TaskSchema:Wt,CreateTaskResultSchema:Gt,TaskStatusNotificationParamsSchema:Kt,TaskStatusNotificationSchema:qt,GetTaskRequestSchema:Jt,GetTaskResultSchema:Yt,GetTaskPayloadRequestSchema:Xt,GetTaskPayloadResultSchema:Zt,ListTasksRequestSchema:Qt,ListTasksResultSchema:$t,CancelTaskRequestSchema:en,CancelTaskResultSchema:f.merge(Wt),ClientRequestSchema:H([se,ie,It,et,Fe,Me,he,_e,xe,Te,De,Xe,Ke,Jt,Xt,Qt,en]),ClientNotificationSchema:H([g,T,oe,Vt,qt]),ClientResultSchema:H([m,ft,pt,Mt,Bt,Yt,$t,Gt]),ServerRequestSchema:H([se,dt,kt,zt,Jt,Xt,Qt,en]),ServerNotificationSchema:H([g,T,nt,ke,Ce,Ze,Ue,qt,jt]),ServerResultSchema:H([m,ae,Lt,He,Ne,ge,ve,Se,Je,qe,Yt,$t,Gt]),CallToolResultWireSchema:R().superRefine((e,t)=>{if(typeof e==`object`&&e&&!Array.isArray(e)&&e.content===void 0){for(let n of Ff)if(n in e){t.addIssue({code:`custom`,message:`content is required when the body carries '${n}' — another result family cannot default into an empty tools/call success`});return}}}).transform(If).pipe(Je)}}var Rf;function zf(){return Rf??=Lf()}function Bf(e){return e.type!==`object`}var Vf=new Set([`const`,`enum`,`default`,`examples`]),Hf=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function Uf(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function Wf(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(Uf(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=i(e.$schema)&&e.$recursiveAnchor!==!0,r=(e,t)=>{if(Array.isArray(e))return e.map(e=>r(e,!1));if(typeof e!=`object`||!e||!t&&Uf(e.$id))return e;let i={},a=!1;for(let[o,s]of Object.entries(e))t?i[o]=r(s,!1):(o===`$ref`||o===`$dynamicRef`)&&typeof s==`string`?i[o]=s===`#`?`#/properties/result`:s.startsWith(`#/`)?`#/properties/result${s.slice(1)}`:s:o===`$recursiveRef`&&s===`#`&&n?a=!0:i[o]=Vf.has(o)?s:Hf.has(o)?r(s,!0):r(s,!1);return a&&(`$ref`in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:`#/properties/result`}]:i.$ref=`#/properties/result`),i};return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:r(e,!1)},required:[`result`]}}var Gf={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Kf={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},qf={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Jf;function Yf(){if(Jf)return Jf;let e=zf();return Jf={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},Jf}function Xf(e){return Object.prototype.hasOwnProperty.call(Gf,e)}function Zf(e){return Object.prototype.hasOwnProperty.call(Kf,e)}function Qf(e){return Object.prototype.hasOwnProperty.call(qf,e)}function $f(e){return Qf(e)?Yf().resultSchemas[e]:void 0}function ep(e){return Xf(e)?Yf().requestSchemas[e]:void 0}function tp(e){return Zf(e)?Yf().notificationSchemas[e]:void 0}Object.keys(Gf),Object.keys(Kf);function np(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function rp(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var ip={ok:!1,reason:`not-in-era`};function ap(e){return np(e)&&np(e.outputSchema)&&Bf(e.outputSchema)}function op(e){return e}var sp={era:`2025-11-25`,hasRequestMethod:Xf,hasNotificationMethod:Zf,validateRequest:(e,t)=>rp(ep(e),t),validateResult:(e,t)=>rp($f(e),t),validateNotification:(e,t)=>rp(tp(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>ip,validateInputResponse:()=>ip,samplingResultVariant:((e,t)=>{let n=zf();return rp(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=Pf(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&Bf(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(np(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:op(e)}}return{kind:`complete`,result:op(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>ap(e))?t:{...t,tools:n.map(e=>ap(e)?{...e,outputSchema:Wf(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function cp(){let e=Hc(()=>H([F(),I(),L(),ac(),U(F(),e),z(e)])),t=U(F(),e),n=H([F(),I().int()]),r=F(),i=H([F(),I().int()]),a=W([`user`,`assistant`]),o=W([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),s=F().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),c=B({ttl:I().optional()}),l=B({taskId:F()}),u=V({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),d=B({_meta:u.optional()}),f=d.extend({task:c.optional()}),p=B({_meta:u.optional()}),m=B({method:F(),params:p.loose().optional()}),h=B({src:F(),mimeType:F().optional(),sizes:z(F()).optional(),theme:W([`light`,`dark`]).optional()}),g=B({icons:z(h).optional()}),_=B({name:F(),title:F().optional()}),v=_.extend({..._.shape,...g.shape,version:F(),websiteUrl:F().optional(),description:F().optional()}),y=Kc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,_c(B({form:_c(B({applyDefaults:L().optional()}),t).optional(),url:t.optional()}),t.optional())),b=V({list:t.optional(),cancel:t.optional(),requests:V({sampling:V({createMessage:t.optional()}).optional(),elicitation:V({create:t.optional()}).optional()}).optional()}),ee=V({list:t.optional(),cancel:t.optional(),requests:V({tools:V({call:t.optional()}).optional()}).optional()}),x=B({experimental:U(F(),t).optional(),sampling:B({context:t.optional(),tools:t.optional()}).optional(),elicitation:y.optional(),roots:B({listChanged:L().optional()}).optional(),tasks:b.optional(),extensions:U(F(),t).optional()}),te=B({experimental:U(F(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:B({listChanged:L().optional()}).optional(),resources:B({subscribe:L().optional(),listChanged:L().optional()}).optional(),tools:B({listChanged:L().optional()}).optional(),tasks:ee.optional(),extensions:U(F(),t).optional()}),ne=B({progress:I(),total:K(I()),message:K(F())}),re=B({...p.shape,...ne.shape,progressToken:n}),ie=m.extend({method:G(`notifications/progress`),params:re}),S=p.extend({level:o,logger:F().optional(),data:R()}),ae=m.extend({method:G(`notifications/message`),params:S}),oe=B({uri:F(),mimeType:K(F()),_meta:U(F(),R()).optional()}),se=oe.extend({text:F()}),C=oe.extend({blob:s}),w=B({audience:z(a).optional(),priority:I().min(0).max(1).optional(),lastModified:Yc({offset:!0}).optional()}),T=B({..._.shape,...g.shape,uri:F(),description:K(F()),mimeType:K(F()),size:K(I()),annotations:w.optional(),_meta:K(V({}))}),ce=B({..._.shape,...g.shape,uriTemplate:F(),description:K(F()),mimeType:K(F()),annotations:w.optional(),_meta:K(V({}))}),E=m.extend({method:G(`notifications/resources/list_changed`),params:p.optional()}),D=p.extend({uri:F()}),O=m.extend({method:G(`notifications/resources/updated`),params:D}),le=B({name:F(),description:K(F()),required:K(L())}),ue=B({..._.shape,...g.shape,description:K(F()),arguments:K(z(le)),_meta:K(V({}))}),de=m.extend({method:G(`notifications/prompts/list_changed`),params:p.optional()}),fe=B({type:G(`text`),text:F(),annotations:w.optional(),_meta:U(F(),R()).optional()}),k=B({type:G(`image`),data:s,mimeType:F(),annotations:w.optional(),_meta:U(F(),R()).optional()}),pe=B({type:G(`audio`),data:s,mimeType:F(),annotations:w.optional(),_meta:U(F(),R()).optional()}),me=B({type:G(`tool_use`),name:F(),id:F(),input:U(F(),R()),_meta:U(F(),R()).optional()}),he=B({type:G(`resource`),resource:H([se,C]),annotations:w.optional(),_meta:U(F(),R()).optional()}),ge=T.extend({type:G(`resource_link`)}),_e=H([fe,k,pe,ge,he]),ve=B({role:a,content:_e}),ye=B({title:F().optional(),readOnlyHint:L().optional(),destructiveHint:L().optional(),idempotentHint:L().optional(),openWorldHint:L().optional()}),be=m.extend({method:G(`notifications/tools/list_changed`),params:p.optional()}),xe=B({name:F().optional()}),Se=B({hints:z(xe).optional(),costPriority:I().min(0).max(1).optional(),speedPriority:I().min(0).max(1).optional(),intelligencePriority:I().min(0).max(1).optional()}),Ce=B({mode:W([`auto`,`required`,`none`]).optional()}),we=B({type:G(`boolean`),title:F().optional(),description:F().optional(),default:L().optional()}),Te=B({type:G(`string`),title:F().optional(),description:F().optional(),minLength:I().optional(),maxLength:I().optional(),format:W([`email`,`uri`,`date`,`date-time`]).optional(),default:F().optional()}),Ee=B({type:W([`number`,`integer`]),title:F().optional(),description:F().optional(),minimum:I().optional(),maximum:I().optional(),default:I().optional()}),De=B({type:G(`string`),title:F().optional(),description:F().optional(),enum:z(F()),default:F().optional()}),Oe=B({type:G(`string`),title:F().optional(),description:F().optional(),oneOf:z(B({const:F(),title:F()})),default:F().optional()}),ke=B({type:G(`string`),title:F().optional(),description:F().optional(),enum:z(F()),enumNames:z(F()).optional(),default:F().optional()}),Ae=H([De,Oe]),je=B({type:G(`array`),title:F().optional(),description:F().optional(),minItems:I().optional(),maxItems:I().optional(),items:B({type:G(`string`),enum:z(F())}),default:z(F()).optional()}),Me=B({type:G(`array`),title:F().optional(),description:F().optional(),minItems:I().optional(),maxItems:I().optional(),items:B({anyOf:z(B({const:F(),title:F()}))}),default:z(F()).optional()}),Ne=H([je,Me]),Pe=H([ke,Ae,Ne]),Fe=H([Pe,we,Te,Ee]),Ie=f.extend({mode:G(`form`).optional(),message:F(),requestedSchema:B({type:G(`object`),properties:U(F(),Fe),required:z(F()).optional()}).catchall(R())}),A=B({type:G(`ref/resource`),uri:F()}),j=B({type:G(`ref/prompt`),name:F()}),Le=B({uri:F().startsWith(`file://`),name:F().optional(),_meta:U(F(),R()).optional()}),Re=x.shape,ze=B({experimental:Re.experimental,sampling:Re.sampling,elicitation:Re.elicitation,roots:Re.roots,extensions:Re.extensions}),Be=te.shape,Ve=B({experimental:Be.experimental,logging:Be.logging,completions:Be.completions,prompts:Be.prompts,resources:Be.resources,tools:Be.tools,extensions:Be.extensions}),He=V({progressToken:n.optional(),[el]:F(),[tl]:v.optional(),[rl]:ze,[al]:o.optional()}),Ue=B({..._.shape,...g.shape,description:F().optional(),inputSchema:V({$schema:F().optional(),type:G(`object`)}),outputSchema:V({$schema:F().optional()}).optional(),annotations:ye.optional(),_meta:U(F(),R()).optional()}),M=B({type:G(`tool_result`),toolUseId:F(),content:z(_e),structuredContent:R().optional(),isError:L().optional(),_meta:U(F(),R()).optional()}),We=H([fe,k,pe,me,M]),Ge=B({role:a,content:H([We,z(We)]),_meta:U(F(),R()).optional()}),Ke=F(),qe=V({[nl]:v.optional().catch(void 0)}),Je=qe.optional();function Ye(e){return V({_meta:Je,resultType:Ke.default(`complete`),...e})}let Xe=Ye({}),Ze=Ye({nextCursor:r.optional()}),Qe=Ye({content:z(_e),structuredContent:R().optional(),isError:L().optional()}),$e=Ye({ttlMs:I().int().min(0),cacheScope:W([`public`,`private`]),tools:z(Ue),nextCursor:r.optional()}),et=Ye({ttlMs:I().int().min(0),cacheScope:W([`public`,`private`]),prompts:z(ue),nextCursor:r.optional()}),tt=Ye({description:F().optional(),messages:z(ve)}),nt=Ye({ttlMs:I().int().min(0),cacheScope:W([`public`,`private`]),resources:z(T),nextCursor:r.optional()}),rt=Ye({ttlMs:I().int().min(0),cacheScope:W([`public`,`private`]),resourceTemplates:z(ce),nextCursor:r.optional()}),it=Ye({ttlMs:I().int().min(0),cacheScope:W([`public`,`private`]),contents:z(H([se,C]))}),at=Ye({completion:B({values:z(F()).max(100),total:I().int().optional(),hasMore:L().optional()}).loose()}),ot=Ye({ttlMs:I().int().min(0),cacheScope:W([`public`,`private`])}),st=Ye({ttlMs:I().int().min(0).catch(0),cacheScope:W([`public`,`private`]).catch(`private`),supportedVersions:z(F()),capabilities:Ve,instructions:F().optional()}),ct=B({messages:z(Ge),modelPreferences:Se.optional(),systemPrompt:F().optional(),includeContext:W([`none`,`thisServer`,`allServers`]).optional(),temperature:I().optional(),maxTokens:I().int(),stopSequences:z(F()).optional(),metadata:t.optional(),tools:z(Ue).optional(),toolChoice:Ce.optional()}),lt=B({method:G(`sampling/createMessage`),params:ct}),ut=B({method:G(`roots/list`),params:B({_meta:U(F(),R()).optional()}).optional()}),dt=B({...Ge.shape,model:F(),stopReason:F().optional()}),ft=B({roots:z(Le)}),pt=B({action:W([`accept`,`decline`,`cancel`]),content:U(F(),H([F(),I(),L(),z(F())])).optional()}),mt=B({mode:G(`url`),message:F(),url:F().url()}),ht=H([Ie,mt]),gt=B({method:G(`elicitation/create`),params:ht}),_t=H([lt,ut,gt]),vt=H([dt,ft,pt]),yt=U(F(),_t),bt=U(F(),vt),xt=Ye({inputRequests:yt.optional(),requestState:F().optional()}),St={inputResponses:bt.optional(),requestState:F().optional()},Ct=B({_meta:He,...St}),wt=V({progressToken:n.optional()});function Tt(e,t){return B({method:G(e),params:B({_meta:He,...t})})}function Et(e,t){return B({method:G(e),params:B({_meta:wt.optional(),...t}).optional()})}let Dt={name:F(),arguments:U(F(),R()).optional(),...St},Ot={cursor:r.optional()},kt=Tt(`tools/call`,Dt),At=Tt(`tools/list`,Ot),jt=Tt(`prompts/list`,Ot),Mt=Tt(`prompts/get`,{name:F(),arguments:U(F(),F()).optional(),...St}),Nt=Tt(`resources/list`,Ot),Pt=Tt(`resources/templates/list`,Ot),Ft=Tt(`resources/read`,{uri:F(),...St}),It={ref:H([j,A]),argument:B({name:F(),value:F()}),context:B({arguments:U(F(),F()).optional()}).optional()},Lt=Tt(`completion/complete`,It),Rt=Tt(`server/discover`,{}),zt=B({toolsListChanged:L().optional(),promptsListChanged:L().optional(),resourcesListChanged:L().optional(),resourceSubscriptions:z(F()).optional()}),Bt={notifications:zt},Vt=Tt(`subscriptions/listen`,Bt),Ht=qe.extend({"io.modelcontextprotocol/subscriptionId":i}),Ut=V({_meta:Ht,resultType:Ke.default(`complete`)}),Wt={"tools/call":Et(`tools/call`,Dt),"tools/list":Et(`tools/list`,Ot),"prompts/get":Et(`prompts/get`,{name:F(),arguments:U(F(),F()).optional()}),"prompts/list":Et(`prompts/list`,Ot),"resources/list":Et(`resources/list`,Ot),"resources/templates/list":Et(`resources/templates/list`,Ot),"resources/read":Et(`resources/read`,{uri:F()}),"completion/complete":Et(`completion/complete`,It),"server/discover":Et(`server/discover`,{}),"subscriptions/listen":Et(`subscriptions/listen`,Bt)};function Gt(e){return V({_meta:Je,...e})}let Kt={"tools/call":Gt({content:z(_e),structuredContent:R().optional(),isError:L().optional()}),"tools/list":Gt({ttlMs:I().int().min(0),cacheScope:W([`public`,`private`]),tools:z(Ue),nextCursor:r.optional()}),"prompts/get":Gt({description:F().optional(),messages:z(ve)}),"prompts/list":Gt({ttlMs:I().int().min(0),cacheScope:W([`public`,`private`]),prompts:z(ue),nextCursor:r.optional()}),"resources/list":Gt({ttlMs:I().int().min(0),cacheScope:W([`public`,`private`]),resources:z(T),nextCursor:r.optional()}),"resources/templates/list":Gt({ttlMs:I().int().min(0),cacheScope:W([`public`,`private`]),resourceTemplates:z(ce),nextCursor:r.optional()}),"resources/read":Gt({ttlMs:I().int().min(0),cacheScope:W([`public`,`private`]),contents:z(H([se,C]))}),"completion/complete":Gt({completion:B({values:z(F()).max(100),total:I().int().optional(),hasMore:L().optional()}).loose()}),"server/discover":Gt({ttlMs:I().int().min(0).catch(0),cacheScope:W([`public`,`private`]).catch(`private`),supportedVersions:z(F()),capabilities:Ve,instructions:F().optional()}),"subscriptions/listen":Gt({})},qt=V({"io.modelcontextprotocol/subscriptionId":i.optional()}),Jt=B({method:G(`notifications/subscriptions/acknowledged`),params:B({_meta:qt.optional(),notifications:zt})}),Yt=B({_meta:qt.optional(),requestId:i,reason:F().optional()}),Xt=B({method:G(`notifications/cancelled`),params:Yt}),Zt={"notifications/cancelled":Xt,"notifications/progress":ie,"notifications/message":ae,"notifications/resources/updated":O,"notifications/resources/list_changed":E,"notifications/tools/list_changed":be,"notifications/prompts/list_changed":de,"notifications/subscriptions/acknowledged":Jt},Qt=e=>B({jsonrpc:G(`2.0`),id:H([F(),I().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,RequestIdSchema:i,RoleSchema:a,LoggingLevelSchema:o,TaskMetadataSchema:c,RelatedTaskMetadataSchema:l,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:f,NotificationsParamsSchema:p,NotificationSchema:m,IconSchema:h,IconsSchema:g,BaseMetadataSchema:_,ImplementationSchema:v,ClientTasksCapabilitySchema:b,ServerTasksCapabilitySchema:ee,ClientCapabilitiesSchema:x,ServerCapabilitiesSchema:te,ProgressSchema:ne,ProgressNotificationParamsSchema:re,ProgressNotificationSchema:ie,LoggingMessageNotificationParamsSchema:S,LoggingMessageNotificationSchema:ae,ResourceContentsSchema:oe,TextResourceContentsSchema:se,BlobResourceContentsSchema:C,AnnotationsSchema:w,ResourceSchema:T,ResourceTemplateSchema:ce,ResourceListChangedNotificationSchema:E,ResourceUpdatedNotificationParamsSchema:D,ResourceUpdatedNotificationSchema:O,PromptArgumentSchema:le,PromptSchema:ue,PromptListChangedNotificationSchema:de,TextContentSchema:fe,ImageContentSchema:k,AudioContentSchema:pe,ToolUseContentSchema:me,EmbeddedResourceSchema:he,ResourceLinkSchema:ge,ContentBlockSchema:_e,PromptMessageSchema:ve,ToolAnnotationsSchema:ye,ToolListChangedNotificationSchema:be,ModelHintSchema:xe,ModelPreferencesSchema:Se,ToolChoiceSchema:Ce,BooleanSchemaSchema:we,StringSchemaSchema:Te,NumberSchemaSchema:Ee,UntitledSingleSelectEnumSchemaSchema:De,TitledSingleSelectEnumSchemaSchema:Oe,LegacyTitledEnumSchemaSchema:ke,SingleSelectEnumSchemaSchema:Ae,UntitledMultiSelectEnumSchemaSchema:je,TitledMultiSelectEnumSchemaSchema:Me,MultiSelectEnumSchemaSchema:Ne,EnumSchemaSchema:Pe,PrimitiveSchemaDefinitionSchema:Fe,ElicitRequestFormParamsSchema:Ie,ResourceTemplateReferenceSchema:A,PromptReferenceSchema:j,RootSchema:Le,ClientCapabilities2026Schema:ze,ServerCapabilities2026Schema:Ve,RequestMetaEnvelopeSchema:He,ToolSchema:Ue,ToolResultContentSchema:M,SamplingMessageContentBlockSchema:We,SamplingMessageSchema:Ge,ResultTypeSchema:Ke,ResultMetaSchema:qe,ResultSchema:Xe,PaginatedResultSchema:Ze,CallToolResultSchema:Qe,ListToolsResultSchema:$e,ListPromptsResultSchema:et,GetPromptResultSchema:tt,ListResourcesResultSchema:nt,ListResourceTemplatesResultSchema:rt,ReadResourceResultSchema:it,CompleteResultSchema:at,CacheableResultSchema:ot,DiscoverResultSchema:st,CreateMessageRequestParamsSchema:ct,CreateMessageRequestSchema:lt,ListRootsRequestSchema:ut,CreateMessageResultSchema:dt,ListRootsResultSchema:ft,ElicitResultSchema:pt,ElicitRequestURLParamsSchema:mt,ElicitRequestParamsSchema:ht,ElicitRequestSchema:gt,InputRequestSchema:_t,InputResponseSchema:vt,InputRequestsSchema:yt,InputResponsesSchema:bt,InputRequiredResultSchema:xt,InputResponseRequestParamsSchema:Ct,CallToolRequestSchema:kt,ListToolsRequestSchema:At,ListPromptsRequestSchema:jt,GetPromptRequestSchema:Mt,ListResourcesRequestSchema:Nt,ListResourceTemplatesRequestSchema:Pt,ReadResourceRequestSchema:Ft,CompleteRequestSchema:Lt,DiscoverRequestSchema:Rt,SubscriptionFilterSchema:zt,SubscriptionsListenRequestSchema:Vt,SubscriptionsListenResultMetaSchema:Ht,SubscriptionsListenResultSchema:Ut,dispatchRequestSchemas:Wt,dispatchResultSchemas:Kt,NotificationMetaSchema:qt,SubscriptionsAcknowledgedNotificationSchema:Jt,CancelledNotificationParamsSchema:Yt,CancelledNotificationSchema:Xt,notificationSchemas2026:Zt,JSONRPCResultResponseSchema:Qt(Xe),CallToolResultResponseSchema:Qt(H([Qe,xt])),ListToolsResultResponseSchema:Qt($e),ListPromptsResultResponseSchema:Qt(et),GetPromptResultResponseSchema:Qt(H([tt,xt])),ListResourcesResultResponseSchema:Qt(nt),ListResourceTemplatesResultResponseSchema:Qt(rt),ReadResourceResultResponseSchema:Qt(H([it,xt])),CompleteResultResponseSchema:Qt(at),DiscoverResultResponseSchema:Qt(st),SubscriptionsListenResultResponseSchema:Qt(Ut)}}var lp;function up(){return lp??=cp()}var dp=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function fp(e){return dp.includes(e)}var pp=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function mp(e){return e[pp]}function hp(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function gp(e){return e===`public`||e===`private`}var q=function(e){return e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.ResourceNotFound=-32002]=`ResourceNotFound`,e[e.MissingRequiredClientCapability=-32021]=`MissingRequiredClientCapability`,e[e.UnsupportedProtocolVersion=-32022]=`UnsupportedProtocolVersion`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`,e}({}),_p=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ProtocolError`})}static[Symbol.hasInstance](e){return kf(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return kf(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,Of(this,new.target)}static fromError(t,n,r){if(t===q.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new yp(e.elicitations,n)}if(t===q.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new bp({supported:e.supported,requested:e.requested},n)}if(t===q.InvalidParams||t===q.ResourceNotFound){let e=r;if(typeof e?.uri==`string`&&(t===q.ResourceNotFound||Object.keys(e).length===1))return new vp(e.uri,n)}if(t===q.MissingRequiredClientCapability&&r){let e=r;if(e.requiredCapabilities!==null&&typeof e.requiredCapabilities==`object`&&!Array.isArray(e.requiredCapabilities))return new xp({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},vp=class extends _p{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ResourceNotFoundError`})}constructor(e,t=`Resource not found: ${e}`){super(q.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},yp=class extends _p{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UrlElicitationRequiredError`})}constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(q.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},bp=class extends _p{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnsupportedProtocolVersionError`})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(q.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},xp=class extends _p{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.MissingRequiredClientCapabilityError`})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(`, `)}`){super(q.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},Sp=0,Cp=`private`,wp=[`tools/call`,`prompts/get`,`resources/read`];function Tp(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||wp.includes(e))return t;throw new _p(q.InternalError,`Handler for ${e} returned resultType '${String(n)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function Ep(e,t){let n=mp(t);if(t.resultType!==`complete`||!fp(e))return n===void 0?t:jp(t);let r=t,i=hp(r.ttlMs)?r.ttlMs:kp(n),a=gp(r.cacheScope)?r.cacheScope:Ap(n),o={...r,ttlMs:i,cacheScope:a};return delete o[pp],o}function Dp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Op(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[nl]:t}}:!Dp(n)||n[`io.modelcontextprotocol/serverInfo`]!==void 0?e:{...e,_meta:{...n,[nl]:t}}}function kp(e){return e!==void 0&&hp(e.ttlMs)?e.ttlMs:Sp}function Ap(e){return e!==void 0&&gp(e.cacheScope)?e.cacheScope:Cp}function jp(e){let t={...e};return delete t[pp],t}var Mp=[`elicitation/create`,`sampling/createMessage`,`roots/list`],Np;function Pp(){if(Np)return Np;let e=up();return Np={request:{"elicitation/create":B({method:G(`elicitation/create`),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":B({method:G(`sampling/createMessage`),params:e.CreateMessageRequestParamsSchema}),"roots/list":B({method:G(`roots/list`),params:V({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Np}function Fp(e){return Mp.includes(e)}function Ip(e){return Fp(e)?Pp().request[e]:void 0}function Lp(e){return Fp(e)?Pp().response[e]:void 0}var Rp={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},zp={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function Bp(e){return Object.prototype.hasOwnProperty.call(Rp,e)}function Vp(e){return Object.prototype.hasOwnProperty.call(zp,e)}function Hp(e){return Object.prototype.hasOwnProperty.call(Rp,e)}function Up(e){return Bp(e)?up().dispatchRequestSchemas[e]:void 0}function Wp(e){return Hp(e)?up().dispatchResultSchemas[e]:void 0}function Gp(e){return Vp(e)?up().notificationSchemas2026[e]:void 0}Object.keys(Rp),Object.keys(zp);function Kp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function qp(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var Jp={ok:!1,reason:`not-in-era`},Yp=[el,rl];function Xp(e,t){let n=t,r=!1,i=()=>(r||=(n={...n},!0),n),a=t.tools;e===`tools/list`&&Array.isArray(a)&&a.some(e=>Kp(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!Kp(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(Kp(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}var Zp={era:`2026-07-28`,hasRequestMethod:Bp,hasNotificationMethod:Vp,hasInputRequestMethod:e=>Ip(e)!==void 0,validateRequest:(e,t)=>qp(Up(e),t),validateResult:(e,t)=>qp(Wp(e),t),validateNotification:(e,t)=>qp(Gp(e),t),validateInputRequest:(e,t)=>qp(Ip(e),t),validateInputResponse:(e,t)=>qp(Lp(e),t),samplingResultVariant:()=>Jp,outboundEnvelope(e){return{[el]:e.protocolVersion,[tl]:e.clientInfo,[rl]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of Yp)n in e||t.push({key:n,problem:`missing`});let n=up().RequestMetaEnvelopeSchema.safeParse(e);if(!n.success)for(let e of n.error.issues){let n=e.path.map(String),r=n.length>0?n.join(`.`):`_meta`;n.length===1&&t.some(e=>e.key===r&&e.problem===`missing`)||t.push({key:r,problem:e.message})}return t},projectCallToolResult:e=>Pf(e),inputRequestSchema:Ip,decodeResult(e,t){if(!Kp(t))return{kind:`invalid`,error:new jf(Af.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let n=t.resultType;if(n===void 0)return{kind:`invalid`,error:new jf(Af.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:`missing-resultType`})};if(typeof n!=`string`)return{kind:`invalid`,error:new jf(Af.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:n})};if(n===`input_required`){let n=t.inputRequests,r=Kp(n)?n:{},i=t.requestState,a=t._meta===void 0?void 0:up().ResultMetaSchema.safeParse(t._meta),o=a?.success?a.data:void 0;return Object.keys(r).length===0&&typeof i!=`string`?{kind:`invalid`,error:new jf(Af.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:`input-required-missing-both`})}:{kind:`input_required`,inputRequests:r,...typeof i==`string`&&{requestState:i},...o!==void 0&&{_meta:o}}}if(n!==`complete`)return{kind:`invalid`,error:new jf(Af.UnsupportedResultType,`Unsupported result type '${n}' for ${e}`,{resultType:n,method:e})};let r=$p(),i=Object.hasOwn(r,e)?r[e]:void 0;if(i!==void 0){let n=i.safeParse(t);if(!n.success)return{kind:`invalid`,error:new jf(Af.InvalidResult,`Invalid result for ${e}: ${n.error}`,{method:e})}}let a={...t};return delete a.resultType,{kind:`complete`,result:a}},encodeResult(e,t,n){return Op(Ep(e,Tp(e,Xp(e,t))),n)},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return`Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)`;let t=up().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(e=>e.message).join(`; `)}`}},Qp;function $p(){if(Qp)return Qp;let e=up();return Qp={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},Qp}var em=`2026-07-28`;function tm(e){return e!==void 0&&Nf(e)?Zp:sp}function nm(e){return e.revision===void 0?e.era===`modern`?Zp.era:sp.era:tm(e.revision).era}function rm(e){return om.some(t=>t.hasRequestMethod(e))}function im(e){return om.some(t=>t.hasNotificationMethod(e))}function am(e){return e===`tasks/get`||e===`tasks/cancel`}var om=[sp,Zp],sm=n({AnnotationsSchema:()=>iu,AudioContentSchema:()=>Lu,BaseMetadataSchema:()=>Nl,BaseRequestParamsSchema:()=>ml,BlobResourceContentsSchema:()=>nu,BooleanSchemaSchema:()=>vd,CallToolRequestParamsSchema:()=>Qu,CallToolRequestSchema:()=>$u,CallToolResultSchema:()=>Xu,CancelTaskRequestSchema:()=>af,CancelTaskResultSchema:()=>of,CancelledNotificationParamsSchema:()=>kl,CancelledNotificationSchema:()=>Al,ClientCapabilitiesSchema:()=>Rl,ClientNotificationSchema:()=>cf,ClientRequestSchema:()=>sf,ClientResultSchema:()=>lf,ClientTasksCapabilitySchema:()=>Il,CompatibilityCallToolResultSchema:()=>Zu,CompleteRequestParamsSchema:()=>zd,CompleteRequestSchema:()=>Bd,CompleteResultSchema:()=>Vd,ContentBlockSchema:()=>Vu,CreateMessageRequestParamsSchema:()=>md,CreateMessageRequestSchema:()=>hd,CreateMessageResultSchema:()=>gd,CreateMessageResultWithToolsSchema:()=>_d,CreateTaskResultSchema:()=>Yd,CursorSchema:()=>ul,DiscoverRequestSchema:()=>Wl,DiscoverResultSchema:()=>Gl,ElicitRequestFormParamsSchema:()=>Ad,ElicitRequestParamsSchema:()=>Md,ElicitRequestSchema:()=>Nd,ElicitRequestURLParamsSchema:()=>jd,ElicitResultSchema:()=>Id,ElicitationCompleteNotificationParamsSchema:()=>Pd,ElicitationCompleteNotificationSchema:()=>Fd,EmbeddedResourceSchema:()=>zu,EmptyResultSchema:()=>Ol,EnumSchemaSchema:()=>Od,GetPromptRequestParamsSchema:()=>Nu,GetPromptRequestSchema:()=>Pu,GetPromptResultSchema:()=>Uu,GetTaskPayloadRequestSchema:()=>ef,GetTaskPayloadResultSchema:()=>tf,GetTaskRequestSchema:()=>Qd,GetTaskResultSchema:()=>$d,IconSchema:()=>jl,IconsSchema:()=>Ml,ImageContentSchema:()=>Iu,ImplementationSchema:()=>Pl,InitializeRequestParamsSchema:()=>zl,InitializeRequestSchema:()=>Bl,InitializeResultSchema:()=>Hl,InitializedNotificationSchema:()=>Ul,JSONArraySchema:()=>cl,JSONObjectSchema:()=>sl,JSONRPCErrorResponseSchema:()=>Tl,JSONRPCMessageSchema:()=>El,JSONRPCNotificationSchema:()=>Cl,JSONRPCRequestSchema:()=>Sl,JSONRPCResponseSchema:()=>Dl,JSONRPCResultResponseSchema:()=>wl,JSONValueSchema:()=>ol,LegacyTitledEnumSchemaSchema:()=>Cd,ListChangedOptionsBaseSchema:()=>td,ListPromptsRequestSchema:()=>ju,ListPromptsResultSchema:()=>Mu,ListResourceTemplatesRequestSchema:()=>lu,ListResourceTemplatesResultSchema:()=>uu,ListResourcesRequestSchema:()=>su,ListResourcesResultSchema:()=>cu,ListRootsRequestSchema:()=>Ud,ListRootsResultSchema:()=>Wd,ListTasksRequestSchema:()=>nf,ListTasksResultSchema:()=>rf,ListToolsRequestSchema:()=>Ju,ListToolsResultSchema:()=>Yu,LoggingLevelSchema:()=>nd,LoggingMessageNotificationParamsSchema:()=>ad,LoggingMessageNotificationSchema:()=>od,ModelHintSchema:()=>sd,ModelPreferencesSchema:()=>cd,MultiSelectEnumSchemaSchema:()=>Dd,NotificationSchema:()=>vl,NotificationsParamsSchema:()=>_l,NumberSchemaSchema:()=>bd,PaginatedRequestParamsSchema:()=>Xl,PaginatedRequestSchema:()=>Zl,PaginatedResultSchema:()=>Ql,PingRequestSchema:()=>Kl,PrimitiveSchemaDefinitionSchema:()=>kd,ProgressNotificationParamsSchema:()=>Jl,ProgressNotificationSchema:()=>Yl,ProgressSchema:()=>ql,ProgressTokenSchema:()=>ll,PromptArgumentSchema:()=>ku,PromptListChangedNotificationSchema:()=>Wu,PromptMessageSchema:()=>Hu,PromptReferenceSchema:()=>Rd,PromptSchema:()=>Au,ReadResourceRequestParamsSchema:()=>fu,ReadResourceRequestSchema:()=>pu,ReadResourceResultSchema:()=>mu,RelatedTaskMetadataSchema:()=>fl,RequestIdSchema:()=>xl,RequestMetaSchema:()=>pl,RequestSchema:()=>gl,ResourceContentsSchema:()=>$l,ResourceLinkSchema:()=>Bu,ResourceListChangedNotificationSchema:()=>hu,ResourceRequestParamsSchema:()=>du,ResourceSchema:()=>au,ResourceTemplateReferenceSchema:()=>Ld,ResourceTemplateSchema:()=>ou,ResourceUpdatedNotificationParamsSchema:()=>Du,ResourceUpdatedNotificationSchema:()=>Ou,ResultMetaObjectSchema:()=>yl,ResultSchema:()=>bl,RoleSchema:()=>ru,RootSchema:()=>Hd,RootsListChangedNotificationSchema:()=>Gd,SamplingContentSchema:()=>dd,SamplingMessageContentBlockSchema:()=>fd,SamplingMessageSchema:()=>pd,ServerCapabilitiesSchema:()=>Vl,ServerNotificationSchema:()=>df,ServerRequestSchema:()=>uf,ServerResultSchema:()=>ff,ServerTasksCapabilitySchema:()=>Ll,SetLevelRequestParamsSchema:()=>rd,SetLevelRequestSchema:()=>id,SingleSelectEnumSchemaSchema:()=>wd,StringSchemaSchema:()=>yd,SubscribeRequestParamsSchema:()=>gu,SubscribeRequestSchema:()=>_u,SubscriptionFilterSchema:()=>bu,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Cu,SubscriptionsAcknowledgedNotificationSchema:()=>wu,SubscriptionsListenRequestParamsSchema:()=>xu,SubscriptionsListenRequestSchema:()=>Su,SubscriptionsListenResultMetaSchema:()=>Tu,SubscriptionsListenResultSchema:()=>Eu,TaskAugmentedRequestParamsSchema:()=>hl,TaskCreationParamsSchema:()=>Kd,TaskMetadataSchema:()=>dl,TaskSchema:()=>Jd,TaskStatusNotificationParamsSchema:()=>Xd,TaskStatusNotificationSchema:()=>Zd,TaskStatusSchema:()=>qd,TextContentSchema:()=>Fu,TextResourceContentsSchema:()=>eu,TitledMultiSelectEnumSchemaSchema:()=>Ed,TitledSingleSelectEnumSchemaSchema:()=>Sd,ToolAnnotationsSchema:()=>Gu,ToolChoiceSchema:()=>ld,ToolExecutionSchema:()=>Ku,ToolListChangedNotificationSchema:()=>ed,ToolResultContentSchema:()=>ud,ToolSchema:()=>qu,ToolUseContentSchema:()=>Ru,UnsubscribeRequestParamsSchema:()=>vu,UnsubscribeRequestSchema:()=>yu,UntitledMultiSelectEnumSchemaSchema:()=>Td,UntitledSingleSelectEnumSchemaSchema:()=>xd}),cm=e=>Sl.safeParse(e).success,lm=e=>Cl.safeParse(e).success,um=e=>wl.safeParse(e).success,dm=e=>Tl.safeParse(e).success;q.InvalidRequest,q.UnsupportedProtocolVersion,q.InvalidParams,q.MethodNotFound,q.InvalidParams,q.MissingRequiredClientCapability,q.ParseError,q.InvalidRequest,q.MethodNotFound,q.UnsupportedProtocolVersion,q.MissingRequiredClientCapability;function fm(e,t){return fs(e,t)}function pm(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function mm(e){if(e==null)return!1;let t=typeof e;return t!==`object`&&t!==`function`||!(`~standard`in e)?!1:typeof e[`~standard`]?.validate==`function`}var hm=!1,gm=`draft-2020-12`;function _m(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:gm});else if(n.vendor===`zod`){if(!(`_zod`in e))throw Error(`Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().`);hm||(hm=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),r=os(e,{target:gm,io:t})}else throw Error(`Schema library "${n.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t===`output`)return r.type===void 0&&vm(r)?{type:`object`,...r}:r;if(r.type!==void 0&&r.type!==`object`)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:`object`,...r}}function vm(e){if(`properties`in e||`patternProperties`in e||`additionalProperties`in e||`required`in e)return!0;for(let t of[`oneOf`,`anyOf`,`allOf`]){let n=e[t];if(Array.isArray(n)&&n.length>0)return n.every(e=>typeof e==`object`&&!!e&&(e.type===`object`||vm(e)))}return!1}function ym(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function bm(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>ym(e)).join(`, `)}:{success:!0,data:n.value}}function xm(e){let t=os(e,{target:gm,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}var Sm=/\\\.\\d\{(\d+)\}/;function Cm(e){let t=Sm.exec(e),n=[void 0,-1,0];return t&&n.push(Number(t[1])),[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>n.map(n=>Yc({local:e,offset:t,precision:n}))))}function wm(e,t){let n;switch(e){case`email`:n=[Ms()];break;case`uri`:n=[Is()];break;case`date`:n=[Xc()];break;case`date-time`:n=Cm(t)}return new Set(n.map(e=>xm(e)).filter(e=>e!==void 0))}function Tm(e,t,n){return n!==`zod`||wm(e,t).has(t)}function Em(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Dm(e){try{return _m(e,`input`)}catch(e){let t=e instanceof Error?e.message:String(e);throw new _p(q.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}var Om=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function km(e){return Om.has(e)||e.startsWith(`x-`)}var Am=new Set([`$schema`,...Object.keys(Ad.shape.requestedSchema.shape)]),jm={string:pm([yd,xd,Sd,Cd]),number:pm([bd]),integer:pm([bd]),boolean:pm([vd]),array:pm([Td,Ed])},Mm=new Set(yd.shape.format.unwrap().options);function Nm(e,t,n,r){if(!Em(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(jm,e.type)?jm[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||km(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?Mm.has(e.format)?(typeof s!=`string`||!Tm(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function Pm(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&Em(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,Nm(n,`properties.${e}`,t,r)])):Am.has(i)?n[i]=a:km(i)||r.push(i);if(r.length>0)throw new _p(q.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(`, `)}`);return n}function Fm(e,t){if(!Em(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!fm(kd,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function Im(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>Im(e,t[r],`${n}[${r}]`)):!Em(e)||!Em(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?Im(r,t[e],i):km(e)?[]:[i]})}function Lm(e){if(!mm(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=Pm(Dm(e.requestedSchema),t),r=fm(Ad.shape.requestedSchema,n);if(!r.success)throw new _p(q.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Fm(n,r.error.message)}`);let i=Im(n,r.data);if(i.length>0)throw new _p(q.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(`, `)}`);let a=(r.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(r.data.properties,e));if(a.length>0)throw new _p(q.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${a.join(`, `)}`);return{...e,mode:`form`,requestedSchema:r.data}}function Rm(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,n=typeof e.requestState==`string`;if(!t&&!n)throw TypeError(`inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)`);return{resultType:`input_required`,...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}Object.assign(Rm,{elicit(e){try{return{method:`elicitation/create`,params:Lm(e)}}catch(e){throw e instanceof _p?TypeError(e.message,{cause:e}):e}},elicitUrl(e){return{method:`elicitation/create`,params:{...e,mode:`url`}}},createMessage(e){return{method:`sampling/createMessage`,params:e}},listRoots(){return{method:`roots/list`}}});var zm=`AnnotationsSchema.AudioContentSchema.BaseMetadataSchema.BlobResourceContentsSchema.BooleanSchemaSchema.CallToolRequestSchema.CallToolRequestParamsSchema.CallToolResultSchema.CancelledNotificationSchema.CancelledNotificationParamsSchema.CancelTaskRequestSchema.CancelTaskResultSchema.ClientCapabilitiesSchema.ClientNotificationSchema.ClientRequestSchema.ClientResultSchema.CompatibilityCallToolResultSchema.CompleteRequestSchema.CompleteRequestParamsSchema.CompleteResultSchema.ContentBlockSchema.CreateMessageRequestSchema.CreateMessageRequestParamsSchema.CreateMessageResultSchema.CreateMessageResultWithToolsSchema.CreateTaskResultSchema.CursorSchema.DiscoverRequestSchema.DiscoverResultSchema.ElicitationCompleteNotificationSchema.ElicitationCompleteNotificationParamsSchema.ElicitRequestSchema.ElicitRequestFormParamsSchema.ElicitRequestParamsSchema.ElicitRequestURLParamsSchema.ElicitResultSchema.EmbeddedResourceSchema.EmptyResultSchema.EnumSchemaSchema.GetPromptRequestSchema.GetPromptRequestParamsSchema.GetPromptResultSchema.GetTaskPayloadRequestSchema.GetTaskPayloadResultSchema.GetTaskRequestSchema.GetTaskResultSchema.IconSchema.IconsSchema.ImageContentSchema.ImplementationSchema.InitializedNotificationSchema.InitializeRequestSchema.InitializeRequestParamsSchema.InitializeResultSchema.JSONArraySchema.JSONObjectSchema.JSONRPCErrorResponseSchema.JSONRPCMessageSchema.JSONRPCNotificationSchema.JSONRPCRequestSchema.JSONRPCResponseSchema.JSONRPCResultResponseSchema.JSONValueSchema.LegacyTitledEnumSchemaSchema.ListPromptsRequestSchema.ListPromptsResultSchema.ListResourcesRequestSchema.ListResourcesResultSchema.ListResourceTemplatesRequestSchema.ListResourceTemplatesResultSchema.ListRootsRequestSchema.ListRootsResultSchema.ListTasksRequestSchema.ListTasksResultSchema.ListToolsRequestSchema.ListToolsResultSchema.LoggingLevelSchema.LoggingMessageNotificationSchema.LoggingMessageNotificationParamsSchema.ModelHintSchema.ModelPreferencesSchema.MultiSelectEnumSchemaSchema.NotificationSchema.NumberSchemaSchema.PaginatedRequestSchema.PaginatedRequestParamsSchema.PaginatedResultSchema.PingRequestSchema.PrimitiveSchemaDefinitionSchema.ProgressSchema.ProgressNotificationSchema.ProgressNotificationParamsSchema.ProgressTokenSchema.PromptSchema.PromptArgumentSchema.PromptListChangedNotificationSchema.PromptMessageSchema.PromptReferenceSchema.ReadResourceRequestSchema.ReadResourceRequestParamsSchema.ReadResourceResultSchema.RelatedTaskMetadataSchema.RequestSchema.RequestIdSchema.RequestMetaSchema.ResourceSchema.ResourceContentsSchema.ResourceLinkSchema.ResourceListChangedNotificationSchema.ResourceRequestParamsSchema.ResourceTemplateSchema.ResourceTemplateReferenceSchema.ResourceUpdatedNotificationSchema.ResourceUpdatedNotificationParamsSchema.ResultMetaObjectSchema.ResultSchema.RoleSchema.RootSchema.RootsListChangedNotificationSchema.SamplingContentSchema.SamplingMessageSchema.SamplingMessageContentBlockSchema.ServerCapabilitiesSchema.ServerNotificationSchema.ServerRequestSchema.ServerResultSchema.SetLevelRequestSchema.SetLevelRequestParamsSchema.SingleSelectEnumSchemaSchema.StringSchemaSchema.SubscribeRequestSchema.SubscribeRequestParamsSchema.SubscriptionFilterSchema.SubscriptionsAcknowledgedNotificationSchema.SubscriptionsAcknowledgedNotificationParamsSchema.SubscriptionsListenRequestSchema.SubscriptionsListenRequestParamsSchema.SubscriptionsListenResultSchema.SubscriptionsListenResultMetaSchema.TaskAugmentedRequestParamsSchema.TaskCreationParamsSchema.TaskMetadataSchema.TaskSchema.TaskStatusSchema.TaskStatusNotificationSchema.TaskStatusNotificationParamsSchema.TextContentSchema.TextResourceContentsSchema.TitledMultiSelectEnumSchemaSchema.TitledSingleSelectEnumSchemaSchema.ToolSchema.ToolAnnotationsSchema.ToolChoiceSchema.ToolExecutionSchema.ToolListChangedNotificationSchema.ToolResultContentSchema.ToolUseContentSchema.UnsubscribeRequestSchema.UnsubscribeRequestParamsSchema.UntitledMultiSelectEnumSchemaSchema.UntitledSingleSelectEnumSchemaSchema`.split(`.`),Bm={IdJagTokenExchangeResponseSchema:yf,OAuthClientInformationFullSchema:wf,OAuthClientInformationSchema:Cf,OAuthClientMetadataSchema:Sf,OAuthClientRegistrationErrorSchema:Tf,OAuthErrorResponseSchema:bf,OAuthMetadataSchema:hf,OAuthProtectedResourceMetadataSchema:mf,OAuthTokenRevocationRequestSchema:Ef,OAuthTokensSchema:vf,OpenIdProviderDiscoveryMetadataSchema:_f,OpenIdProviderMetadataSchema:gf},Vm={},Hm={};function Um(e,t){let n=e.slice(0,-6);Vm[n]=t,Hm[n]=e=>t.safeParse(e).success}for(let e of zm)Um(e,sm[e]);for(let[e,t]of Object.entries(Bm))Um(e,t);Object.freeze(Vm),Object.freeze(Hm);function Wm(e){switch(e){case`initialize`:case`notifications/initialized`:return tm(void 0);case`server/discover`:return tm(em);default:return}}var Gm=[el,tl,rl,al],Km=[`inputResponses`,`requestState`];function qm(e,t){let n=e.params;if(!Qm(n))return{message:e,lifted:{}};let r=n._meta,i=Qm(r)?Gm.filter(e=>e in r):[],a=t===`request`?Km.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&Qm(r)){let e={},t={...r};for(let n of i)e[n]=r[n],delete t[n];o.envelope=e,Object.keys(t).length>0?s._meta=t:delete s._meta}for(let e of a)e===`inputResponses`&&(o.inputResponses=s[e]),e===`requestState`&&(o.requestState=s[e]),delete s[e];return{message:{...e,params:s},lifted:o}}function Jm(e,t){let n=e.validateResult(t,void 0);if(n.ok||n.reason!==`not-in-era`)return{"~standard":{version:1,vendor:`mcp-wire-codec`,validate(n){let r=e.validateResult(t,n);return r.ok?{value:r.value}:{issues:[{message:r.reason===`invalid`?r.message:`not-in-era: ${t}`}]}}}}}function Ym(e){return()=>e}var Xm=Ym(void 0),Zm=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??Qc,this.setNotificationHandler(`notifications/cancelled`,e=>{this._oncancel(e)}),this.setNotificationHandler(`notifications/progress`,e=>{this._onprogress(e)}),this.setRequestHandler(`ping`,e=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let n=e.params??{};return{...e,params:{...n,_meta:{...t,...n._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new jf(Af.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId!==void 0&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new jf(Af.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let n=this.transport?.onerror;this._transport.onerror=e=>{n?.(e),this._onerror(e)};let r=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{r?.(e,t),um(e)||dm(e)?this._onresponse(e):cm(e)?this._onrequest(e,t):lm(e)?this._onnotification(e,t):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._timeoutInfo.values())clearTimeout(e.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let n=new jf(Af.ConnectionClosed,`Connection closed`);this._transport=void 0;try{this.onclose?.()}finally{for(let t of e.values())t(n);for(let e of t.values())e.abort(n)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:n}=qm(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=nm(t.classification);if(e!==r.era){this._onerror(Error(`Era mismatch on inbound notification '${n.method}': classified as ${e} but this instance serves ${r.era}`));return}}if(im(n.method)&&!r.hasNotificationMethod(n.method))return;let i=this._notificationHandlers.get(n.method),a=this.fallbackNotificationHandler;(i!==void 0||a!==void 0)&&Promise.resolve().then(()=>i===void 0?a(n):i(n,r)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let{message:n,lifted:r}=qm(e,`request`),i=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let a=this._transport,o=(e,t,r)=>{let i={jsonrpc:`2.0`,id:n.id,error:{code:e,message:t,...r!==void 0&&{data:r}}};a?.send(i).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=nm(t.classification);if(e!==i.era){this._onerror(Error(`Era mismatch on inbound request '${n.method}': classified as ${e} but this instance serves ${i.era}`));let r=t.classification.revision??e;o(q.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(rm(n.method)&&!i.hasRequestMethod(n.method)&&!(am(n.method)&&this._customSchemaRequestMethods.has(n.method))){o(q.MethodNotFound,`Method not found`);return}let s=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(s===void 0){o(q.MethodNotFound,`Method not found`);return}let c=i.checkInboundEnvelope(r);if(c!==void 0){o(q.InvalidParams,c);return}let l=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:n.id}),u=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:n.id}),d=new AbortController;this._requestHandlerAbortControllers.set(n.id,d);let f=r.inputResponses===void 0?void 0:eh(r.inputResponses),p={sessionId:a?.sessionId,mcpReq:{id:n.id,method:n.method,_meta:n.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},...f!==void 0&&{inputResponses:f.accepted},...f!==void 0&&f.droppedKeys.length>0&&{droppedInputResponseKeys:f.droppedKeys},requestState:r.requestState===void 0?Xm:Ym(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),mm(t))return u(e,t,n);let i=Jm(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return u(e,i,t)}),notify:l},http:t?.authInfo?{authInfo:t.authInfo}:void 0},m=this.buildContext(p,t);Promise.resolve().then(()=>s(n,m)).then(async e=>{if(d.signal.aborted)return;let t;try{t=i.encodeResult(n.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${n.method}: ${e}`)),o(q.InternalError,`Internal error`);return}let r={result:t,jsonrpc:`2.0`,id:n.id};await a?.send(r)},async e=>{if(d.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:q.InternalError,r={jsonrpc:`2.0`,id:n.id,error:{code:i.encodeErrorCode(t),message:e.message??`Internal error`,...e.data!==void 0&&{data:e.data}}};await a?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(n.id)===d&&this._requestHandlerAbortControllers.delete(n.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._responseHandlers.get(t);n===void 0?this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`)):(this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),um(e)?n(e):n(_p.fromError(e.error.code,e.error.message,e.error.data)))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,n){let r=this._resolveOutboundCodec(e.method);if(mm(t))return am(e.method)||this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n);this._assertOutboundRequestInEra(r,e.method);let i=Jm(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(r,e,i,t)}_negotiatedWireCodec(){return tm(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=Wm(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(rm(t)&&!e.hasRequestMethod(t))throw new jf(Af.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,n){let r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n)}_requestWithSchemaViaCodec(e,t,n,r){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s}=r??{},c=Date.now(),l,u;return new Promise((d,f)=>{let p=e=>{f(e)};if(!this._transport){p(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){p(e);return}if(r?.signal?.aborted){let e=r.signal.reason;throw e instanceof jf?e:new jf(Af.RequestTimeout,String(e))}let m=e.era===`2026-07-28`&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,h=this._requestMessageId++;u=h;let g={...t,jsonrpc:`2.0`,id:h};r?.onprogress&&(this._progressHandlers.set(h,r.onprogress),g.params={...t.params,_meta:{...t.params?._meta,progressToken:h}});let _=this._envelopeOutbound(g),v=!1,y=e=>{v||(this._progressHandlers.delete(h),m===void 0?t.method!==`initialize`&&this._transport?.send(this._envelopeOutbound({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:h,reason:String(e)}}),{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):m.abort(),f(e instanceof jf?e:new jf(Af.RequestTimeout,String(e))))};this._responseHandlers.set(h,i=>{if(r?.signal?.aborted)return;if(v=!0,i instanceof Error)return f(i);let a;try{a=e.decodeResult(t.method,i.result)}catch(e){return f(e instanceof Error?e:Error(String(e)))}if(a.kind===`invalid`)return f(a.error);if(a.kind===`input_required`){if(r?.allowInputRequired===!0)return d(th(a));let i={codec:e,request:t,resultSchema:n,options:r,flowStartedAt:c,retry:(r,i)=>this._requestWithSchemaViaCodec(e,r===void 0?{method:t.method}:{method:t.method,params:r},n,i)};return d(this._resolveNonCompleteResult(a,i))}let o=a.result;bm(n,o).then(e=>{e.success?d(e.data):f(new jf(Af.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},f)}),l=()=>y(r?.signal?.reason),r?.signal?.addEventListener(`abort`,l,{once:!0});let b=r?.timeout??6e4;this._setupTimeout(h,b,r?.maxTotalTimeout,()=>y(new jf(Af.RequestTimeout,`Request timed out`,{timeout:b})),r?.resetTimeoutOnProgress??!1),this._transport.send(_,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s,requestSignal:m?.signal}).catch(e=>{this._progressHandlers.delete(h),f(e)})}).finally(()=>{l&&r?.signal?.removeEventListener(`abort`,l),u!==void 0&&(this._responseHandlers.delete(u),this._cleanupTimeout(u))})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,n){if(!this._transport)throw new jf(Af.NotConnected,`Not connected`);if(im(t.method)&&!e.hasNotificationMethod(t.method))throw new jf(Af.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let r=this._envelopeOutbound({jsonrpc:`2.0`,...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&n?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(r,n).catch(e=>this._onerror(e))})}else await this._transport.send(r,n)}setRequestHandler(e,t,n){this.assertRequestHandlerCapability(e);let r;if(typeof t==`function`){if(!rm(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,r)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,n);if(!a.ok&&a.reason===`not-in-era`&&(a=i.validateInputRequest(e,n)),!a.ok)throw a.reason===`not-in-era`?new _p(q.InternalError,`No wire schema for ${e} in the resolved era`):Error(a.message);return Promise.resolve(t(a.value,r))}}else if(n)r=async(r,i)=>{let a=await bm(t.params,{...r.params});if(!a.success)throw new _p(q.InvalidParams,`Invalid params for ${e}: ${a.error}`);return n(a.data,i)};else throw TypeError(`setRequestHandler: handler is required`);typeof t==`function`?this._customSchemaRequestMethods.delete(e):this._customSchemaRequestMethods.add(e),this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,n){if(typeof t==`function`){if(!im(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(n,r)=>{let i=r.validateNotification(e,n);if(!i.ok)throw i.reason===`not-in-era`?new _p(q.InternalError,`No wire schema for ${e} in the resolved era`):Error(i.message);return Promise.resolve(t(i.value))})}else{if(!n)throw TypeError(`setNotificationHandler: handler is required`);this._notificationHandlers.set(e,async r=>{let i=await bm(t.params,{...r.params});if(!i.success)throw new _p(q.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await n(i.data,r)})}}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Qm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function $m(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function eh(e){let t={},n=[];if(!$m(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e))!$m(i)||`method`in i||`result`in i?n.push(r):t[r]=i;return{accepted:t,droppedKeys:n}}function th(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}t((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,n=/\\([\u000b\u0020-\u00ff])/g,r=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=i;function i(e){if(!e)throw TypeError(`argument string is required`);var i=typeof e==`object`?a(e):e;if(typeof i!=`string`)throw TypeError(`argument string is required to be a string`);var s=i.indexOf(`;`),c=s===-1?i.trim():i.slice(0,s).trim();if(!r.test(c))throw TypeError(`invalid media type`);var l=new o(c.toLowerCase());if(s!==-1){var u,d,f;for(t.lastIndex=s;d=t.exec(i);){if(d.index!==s)throw TypeError(`invalid parameter format`);s+=d[0].length,u=d[1].toLowerCase(),f=d[2],f.charCodeAt(0)===34&&(f=f.slice(1,-1),f.indexOf(`\\`)!==-1&&(f=f.replace(n,`$1`))),l.parameters[u]=f}if(s!==i.length)throw TypeError(`invalid parameter format`)}return l}function a(e){var t;if(typeof e.getHeader==`function`?t=e.getHeader(`content-type`):typeof e.headers==`object`&&(t=e.headers&&e.headers[`content-type`]),typeof t!=`string`)throw TypeError(`content-type header is missing from object`);return t}function o(e){this.parameters=Object.create(null),this.type=e}}))(),typeof self<`u`&&self.location&&self.location.origin!==`null`?new URL(self.location.origin+self.location.pathname+location.search):new URL(`https://github.com/cfworker`);var nh=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,rh=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ih=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,ah=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,oh=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,sh=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,ch=/^(?:\/(?:[^~/]|~0|~1)*)*$/,lh=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,uh=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,dh=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,fh=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;function ph(e){return e.test.bind(e)}mh.bind(void 0,!1),ph(ih),ph(ah),ph(oh),ph(rh),ph(dh),ph(fh),ph(sh),ph(ch),ph(lh),ph(uh);function mh(e,t){let n=t.match(nh);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=!!n[5];return(r<=23&&i<=59&&a<=59||r==23&&i==59&&a==60)&&(!e||o)}globalThis.crypto;var hh=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthClientFlowError`})}static[Symbol.hasInstance](e){return kf(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return kf(this,e)}constructor(e){super(e),this.name=new.target.name,Of(this,new.target)}};(class extends hh{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.IssuerMismatchError`})}kind;expected;received;constructor(e,t,n){super(`Issuer mismatch in ${e===`metadata`?`authorization server metadata (RFC 8414 §3.3)`:`authorization response (RFC 9207)`}: expected ${JSON.stringify(t)}, received ${JSON.stringify(n)}`),this.kind=e,this.expected=t,this.received=n}}),class extends hh{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.RegistrationRejectedError`})}status;body;submittedMetadata;constructor(e){super(`Dynamic Client Registration rejected (HTTP ${e.status}): ${e.body}`),this.status=e.status,this.body=e.body,this.submittedMetadata=e.submittedMetadata}},class extends hh{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.InsecureTokenEndpointError`})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / *.localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=e}},class extends hh{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.AuthorizationServerMismatchError`})}constructor(e,t){super(`Authorization server mismatch: credentials are bound to ${JSON.stringify(e)} but this call resolved ${JSON.stringify(t)}; refusing to present them to a different authorization server`),this.recordedIssuer=e,this.currentIssuer=t}},class extends hh{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.InsufficientScopeError`})}requiredScope;resourceMetadataUrl;errorDescription;constructor(e){super(`Insufficient scope${e.requiredScope?`: required "${e.requiredScope}"`:``}`),this.requiredScope=e.requiredScope,this.resourceMetadataUrl=e.resourceMetadataUrl,this.errorDescription=e.errorDescription}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnauthorizedError`})}static[Symbol.hasInstance](e){return kf(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return kf(this,e)}constructor(e){super(e??`Unauthorized`),this.name=`UnauthorizedError`,Of(this,new.target)}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SseError`})}static[Symbol.hasInstance](e){return kf(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return kf(this,e)}constructor(e,t,n){super(`SSE error: ${t}`),this.code=e,this.event=n,Of(this,new.target)}};var gh=class{_eventSlots=new Map;setHandler(e,t){let n=this._ensureEventSlot(e);n.onHandler&&t&&console.warn(`[MCP Apps] on${String(e)} handler replaced. Use addEventListener("${String(e)}", …) to add multiple listeners without replacing.`),n.onHandler=t}getHandler(e){return this._eventSlots.get(e)?.onHandler}addEventListener(e,t){this._ensureEventSlot(e).listeners.push(t)}removeEventListener(e,t){let n=this._eventSlots.get(e);if(!n)return;let r=n.listeners.indexOf(t);r!==-1&&n.listeners.splice(r,1)}dispatch(e,t){let n=this._eventSlots.get(e);if(n){n.onHandler?.(t);for(let e of[...n.listeners])e(t)}}_ensureEventSlot(e){let t=this._eventSlots.get(e);return t||(t={listeners:[]},this._eventSlots.set(e,t)),t}},_h=class{_methods=new Set;claim(e,t){if(this._methods.has(e))throw Error(`Handler for "${e}" already registered (via ${t}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._methods.add(e)}replace(e){this._methods.add(e)}release(e){this._methods.delete(e)}has(e){return this._methods.has(e)}},vh=new Set;function yh(e,t){let[n,r]=t,i=n?.shape;if(typeof i?.method?.value!=`string`)return;let a=i.method.value,o=e===`request`?`setRequestHandler`:`setNotificationHandler`;vh.has(o)||(vh.add(o),console.warn(`[ext-apps] ${o}(Schema, handler) is deprecated; use ${o}("${a}", { params: Schema.shape.params }, handler).`));let s=r;return[a,{params:i.params},e===`request`?(e,t)=>s({method:a,params:e},bh(t)):e=>s({method:a,params:e})]}function bh(e){return{signal:e.mcpReq.signal,requestId:e.mcpReq.id,sessionId:e.sessionId,_meta:e.mcpReq._meta,sendRequest:e.mcpReq.send,sendNotification:e.mcpReq.notify,authInfo:e.http?.authInfo}}var xh=`2026-01-26`,Sh=class{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=e=>{if(t&&e.source!==this.eventSource){console.debug(`Ignoring message from unknown source`,e);return}let n=El.safeParse(e.data);n.success?(console.debug(`Parsed message`,n.data),this.onmessage?.(n.data)):e.data?.jsonrpc===`2.0`?(console.error(`Failed to parse message`,n.error.message,e),this.onerror?.(Error(`Invalid JSON-RPC message received: `+n.error.message))):console.debug(`Ignoring non-JSON-RPC message`,n.error.message,e)}}async start(){window.addEventListener(`message`,this.messageListener)}async send(e,t){e.method!==`ui/notifications/tool-input-partial`&&console.debug(`Sending message`,e),this.eventTarget.postMessage(e,`*`)}async close(){window.removeEventListener(`message`,this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion},Ch=H([G(`light`),G(`dark`)]).describe(`Color theme preference for the host environment.`),wh=H([G(`inline`),G(`fullscreen`),G(`pip`)]).describe(`Display mode for UI presentation.`),Th=U(H([G(`--color-background-primary`),G(`--color-background-secondary`),G(`--color-background-tertiary`),G(`--color-background-inverse`),G(`--color-background-ghost`),G(`--color-background-info`),G(`--color-background-danger`),G(`--color-background-success`),G(`--color-background-warning`),G(`--color-background-disabled`),G(`--color-text-primary`),G(`--color-text-secondary`),G(`--color-text-tertiary`),G(`--color-text-inverse`),G(`--color-text-ghost`),G(`--color-text-info`),G(`--color-text-danger`),G(`--color-text-success`),G(`--color-text-warning`),G(`--color-text-disabled`),G(`--color-border-primary`),G(`--color-border-secondary`),G(`--color-border-tertiary`),G(`--color-border-inverse`),G(`--color-border-ghost`),G(`--color-border-info`),G(`--color-border-danger`),G(`--color-border-success`),G(`--color-border-warning`),G(`--color-border-disabled`),G(`--color-ring-primary`),G(`--color-ring-secondary`),G(`--color-ring-inverse`),G(`--color-ring-info`),G(`--color-ring-danger`),G(`--color-ring-success`),G(`--color-ring-warning`),G(`--font-sans`),G(`--font-mono`),G(`--font-weight-normal`),G(`--font-weight-medium`),G(`--font-weight-semibold`),G(`--font-weight-bold`),G(`--font-text-xs-size`),G(`--font-text-sm-size`),G(`--font-text-md-size`),G(`--font-text-lg-size`),G(`--font-heading-xs-size`),G(`--font-heading-sm-size`),G(`--font-heading-md-size`),G(`--font-heading-lg-size`),G(`--font-heading-xl-size`),G(`--font-heading-2xl-size`),G(`--font-heading-3xl-size`),G(`--font-text-xs-line-height`),G(`--font-text-sm-line-height`),G(`--font-text-md-line-height`),G(`--font-text-lg-line-height`),G(`--font-heading-xs-line-height`),G(`--font-heading-sm-line-height`),G(`--font-heading-md-line-height`),G(`--font-heading-lg-line-height`),G(`--font-heading-xl-line-height`),G(`--font-heading-2xl-line-height`),G(`--font-heading-3xl-line-height`),G(`--border-radius-xs`),G(`--border-radius-sm`),G(`--border-radius-md`),G(`--border-radius-lg`),G(`--border-radius-xl`),G(`--border-radius-full`),G(`--border-width-regular`),G(`--shadow-hairline`),G(`--shadow-sm`),G(`--shadow-md`),G(`--shadow-lg`)]).describe(`CSS variable keys available to MCP apps for theming.`).describe(`Style variables for theming MCP apps.
1498
1498
 
1499
1499
  Individual style keys are optional - hosts may provide any subset of these values.
1500
1500
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
@@ -1540,7 +1540,7 @@ Boolean requesting whether a visible border and background is provided by the ho
1540
1540
  - omitted: host decides border`)}),B({method:G(`ui/request-display-mode`),params:B({mode:wh.describe(`The display mode being requested.`)})});var Vh=B({mode:wh.describe(`The display mode that was actually set. May differ from requested if not supported.`)}).passthrough(),Hh=H([G(`model`),G(`app`)]).describe(`Tool visibility scope - who can access the tool.`);B({resourceUri:F().optional(),visibility:z(Hh).optional().describe(`Who can access this tool. Default: ["model", "app"]
1541
1541
  - "model": Tool visible to and callable by the agent
1542
1542
  - "app": Tool callable by the app from this server only`),csp:uc().optional(),permissions:uc().optional()}),B({mimeTypes:z(F()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),B({method:G(`ui/download-file`),params:B({contents:z(H([zu,Bu])).describe(`Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.`)})}),B({method:G(`ui/message`),params:B({role:G(`user`).describe(`Message role, currently only "user" is supported.`),content:z(Vu).describe(`Message content blocks (text, image, etc.).`)})}),B({method:G(`ui/notifications/sandbox-resource-ready`),params:B({html:F().describe(`HTML content to load into the inner iframe.`),sandbox:F().optional().describe(`Optional override for the inner iframe's sandbox attribute.`),csp:kh.optional().describe(`CSP configuration from resource metadata.`),permissions:Ah.optional().describe(`Sandbox permissions from resource metadata.`)})});var Uh=B({method:G(`ui/notifications/tool-result`),params:Xu.describe(`Standard MCP tool execution result.`)}),Wh=B({toolInfo:B({id:xl.optional().describe(`JSON-RPC id of the tools/call request.`),tool:qu.describe(`Tool definition including name, inputSchema, etc.`)}).optional().describe(`Metadata of the tool call that instantiated this App.`),theme:Ch.optional().describe(`Current color theme preference.`),styles:Fh.optional().describe(`Style configuration for theming the app.`),displayMode:wh.optional().describe(`How the UI is currently displayed.`),availableDisplayModes:z(wh).optional().describe(`Display modes the host supports.`),containerDimensions:H([B({height:I().describe(`Fixed container height in pixels.`)}),B({maxHeight:H([I(),rc()]).optional().describe(`Maximum container height in pixels.`)})]).and(H([B({width:I().describe(`Fixed container width in pixels.`)}),B({maxWidth:H([I(),rc()]).optional().describe(`Maximum container width in pixels.`)})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
1543
- container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:F().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:F().optional().describe(`User's timezone in IANA format.`),userAgent:F().optional().describe(`Host application identifier.`),platform:H([G(`web`),G(`desktop`),G(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:B({touch:L().optional().describe(`Whether the device supports touch input.`),hover:L().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:B({top:I().describe(`Top safe area inset in pixels.`),right:I().describe(`Right safe area inset in pixels.`),bottom:I().describe(`Bottom safe area inset in pixels.`),left:I().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough(),Gh=B({method:G(`ui/notifications/host-context-changed`),params:Wh.describe(`Partial context update containing only changed fields.`)});B({method:G(`ui/update-model-context`),params:B({content:z(Vu).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:U(F(),R().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),B({method:G(`ui/initialize`),params:B({appInfo:Pl.describe(`App identification (name and version).`),appCapabilities:Bh.describe(`Features and capabilities this app provides.`),protocolVersion:F().describe(`Protocol version this app supports.`)})});var Kh=B({protocolVersion:F().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:Pl.describe(`Host application identification and version.`),hostCapabilities:zh.describe(`Features and capabilities provided by the host.`),hostContext:Wh.describe(`Rich context about the host environment.`)}).passthrough(),qh={target:`draft-2020-12`};async function Jh(e,t){let n=e[`~standard`];if(n.jsonSchema)return n.jsonSchema[t](qh);throw Error(`Schema (vendor: ${n.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function Yh(e,t,n=``){let r=await e[`~standard`].validate(t);if(r.issues){let e=r.issues.map(e=>{let t=e.path?.map(e=>typeof e==`object`?e.key:e).join(`.`);return t?`${t}: ${e.message}`:e.message}).join(`; `);throw Error(n+e)}return r.value}function Xh(e,t){let n={...e,...t};return t.experimental!==void 0&&(n.experimental={...e.experimental,...t.experimental}),t.tools!==void 0&&(n.tools={...e.tools,...t.tools}),n}var Zh=class e extends Zm{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new gh;_methods=new _h;setRequestHandler=(...e)=>{let[t,...n]=yh(`request`,e)??e;this._methods.claim(t,`setRequestHandler`),super.setRequestHandler.call(this,t,...n)};setNotificationHandler=(...e)=>{let[t,...n]=yh(`notification`,e)??e;this._methods.claim(t,`setNotificationHandler`),super.setNotificationHandler.call(this,t,...n)};removeRequestHandler=e=>{this._methods.release(e),super.removeRequestHandler(e)};removeNotificationHandler=e=>{this._methods.release(e),super.removeNotificationHandler(e)};replaceRequestHandler=(e,...t)=>{this._methods.replace(e),super.setRequestHandler.call(this,e,...t)};_assertInitialized(e){if(this._initializedSent)return;let t=`[ext-apps] App.${e}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(t);console.warn(`${t}. This will throw in a future release.`)}eventSchemas={toolinput:jh,toolinputpartial:Mh,toolresult:Uh,toolcancelled:Nh,hostcontextchanged:Gh};static ONE_SHOT_EVENTS=new Set([`toolinput`,`toolinputpartial`,`toolresult`,`toolcancelled`]);_everHadListener=new Set;_assertHandlerTiming(t){if(!e.ONE_SHOT_EVENTS.has(t)||this._everHadListener.has(t)||(this._everHadListener.add(t),!this._initializedSent))return;let n=`[ext-apps] "${String(t)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(n);console.warn(n)}setEventHandler(e,t){t&&this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.setHandler(e,t)}addEventListener(e,t){this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.addEventListener(e,t)}removeEventListener(e,t){this._events.removeEventListener(e,t)}_ensureEventSlot(e){if(this._registeredEvents.has(e))return;let t=this.eventSchemas[e];if(!t)throw Error(`Unknown event: ${String(e)}`);this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},t=>{let n=t;e===`hostcontextchanged`&&(this._hostContext={...this._hostContext,...n}),this._events.dispatch(e,n)}),this._registeredEvents.add(e)}getEventHandler(e){return this._events.getHandler(e)}warnIfRequestHandlerReplaced(e,t,n){t&&n&&console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t={},n={autoResize:!0}){super(n),this._appInfo=e,this._appCapabilities=t,this.options=n,this._methods.replace(`notifications/cancelled`),this._methods.replace(`notifications/progress`),!n.allowUnsafeEval&&Je({jitless:!0}),this.replaceRequestHandler(`ping`,e=>(console.log(`Received ping:`,e.params),{})),this.setEventHandler(`hostcontextchanged`,void 0)}buildContext(e){return e}registerAppCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after transport is established`);this._appCapabilities=Xh(this._appCapabilities,e)}registerTool(e,t,n){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r=this,i=()=>{r._initializedSent&&r._appCapabilities.tools?.listChanged&&r.sendToolListChanged()},a=t.inputSchema!==void 0,o={title:t.title,description:t.description,inputSchema:t.inputSchema,outputSchema:t.outputSchema,annotations:t.annotations,_meta:t._meta,enabled:!0,enable(){this.enabled=!0,i()},disable(){this.enabled=!1,i()},update(e){Object.assign(this,e),i()},remove(){r._registeredTools[e]===o&&(delete r._registeredTools[e],i())},handler:async(t,r)=>{if(!o.enabled)throw Error(`Tool ${e} is disabled`);let i;if(a){let a=o.inputSchema;i=await n(a?await Yh(a,t??{},`Invalid input for tool ${e}: `):t??{},r)}else i=await n(r);return o.outputSchema&&!i.isError&&(i.structuredContent=await Yh(o.outputSchema,i.structuredContent,`Invalid output for tool ${e}: `)),i}};return this._registeredTools[e]=o,!this._appCapabilities.tools&&!this.transport&&this.registerAppCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),i(),o}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(e,t)=>{let n=this._registeredTools[e.name];if(!n)throw Error(`Tool ${e.name} not found`);return n.handler(e.arguments,t)},this.onlisttools=async(e,t)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([e,t])=>t.enabled).map(async([e,t])=>{let n={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?await Jh(t.inputSchema,`input`):{type:`object`,properties:{}}};return t.outputSchema&&(n.outputSchema=await Jh(t.outputSchema,`output`)),t.annotations&&(n.annotations=t.annotations),t._meta&&(n._meta=t._meta),n}))}))}async sendToolListChanged(e={}){this._assertInitialized(`sendToolListChanged`),await this.notification({method:`notifications/tools/list_changed`,params:e})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler(`toolinput`)}set ontoolinput(e){this.setEventHandler(`toolinput`,e)}get ontoolinputpartial(){return this.getEventHandler(`toolinputpartial`)}set ontoolinputpartial(e){this.setEventHandler(`toolinputpartial`,e)}get ontoolresult(){return this.getEventHandler(`toolresult`)}set ontoolresult(e){this.setEventHandler(`toolresult`,e)}get ontoolcancelled(){return this.getEventHandler(`toolcancelled`)}set ontoolcancelled(e){this.setEventHandler(`toolcancelled`,e)}get onhostcontextchanged(){return this.getEventHandler(`hostcontextchanged`)}set onhostcontextchanged(e){this.setEventHandler(`hostcontextchanged`,e)}_onteardown;get onteardown(){return this._onteardown}set onteardown(e){this.warnIfRequestHandlerReplaced(`onteardown`,this._onteardown,e),this._onteardown=e,this.replaceRequestHandler(`ui/resource-teardown`,{params:Ih.shape.params,result:Lh},(e,t)=>{if(!this._onteardown)throw Error(`No onteardown handler set`);return this._onteardown(e,t)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced(`oncalltool`,this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler(`tools/call`,(e,t)=>{if(!this._oncalltool)throw Error(`No oncalltool handler set`);return this._oncalltool(e.params,t)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(e){this.warnIfRequestHandlerReplaced(`onlisttools`,this._onlisttools,e),this._onlisttools=e,this.replaceRequestHandler(`tools/list`,(e,t)=>{if(!this._onlisttools)throw Error(`No onlisttools handler set`);return this._onlisttools(e.params,t)})}assertCapabilityForMethod(e){if(e===`sampling/createMessage`&&!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${e})`)}assertRequestHandlerCapability(e){switch(e){case`tools/call`:case`tools/list`:if(!this._appCapabilities.tools)throw Error(`Client does not support tool capability (required for ${e})`);return;default:return}}assertNotificationCapability(e){}async callServerTool(e,t){if(this._assertInitialized(`callServerTool`),typeof e==`string`)throw Error(`callServerTool() expects an object as its first argument, but received a string ("${e}"). Did you mean: callServerTool({ name: "${e}", arguments: { ... } })?`);return await this.request({method:`tools/call`,params:e},{onprogress:()=>{},resetTimeoutOnProgress:!0,...t})}async readServerResource(e,t){return this._assertInitialized(`readServerResource`),await this.request({method:`resources/read`,params:e},t)}async listServerResources(e,t){return this._assertInitialized(`listServerResources`),await this.request({method:`resources/list`,params:e},t)}async createSamplingMessage(e,t){return this._assertInitialized(`createSamplingMessage`),await this.request({method:`sampling/createMessage`,params:e},t)}sendMessage(e,t){return this._assertInitialized(`sendMessage`),this.request({method:`ui/message`,params:e},Oh,t)}sendLog(e){return this.notification({method:`notifications/message`,params:e})}updateModelContext(e,t){return this._assertInitialized(`updateModelContext`),this.request({method:`ui/update-model-context`,params:e},Ol,t)}openLink(e,t){return this._assertInitialized(`openLink`),this.request({method:`ui/open-link`,params:e},Eh,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized(`downloadFile`),this.request({method:`ui/download-file`,params:e},Dh,t)}requestTeardown(e={}){return this.notification({method:`ui/notifications/request-teardown`,params:e})}requestDisplayMode(e,t){return this._assertInitialized(`requestDisplayMode`),this.request({method:`ui/request-display-mode`,params:e},Vh,t)}sendSizeChanged(e){return this.notification({method:`ui/notifications/size-changed`,params:e})}setupSizeChangedNotifications(){let e=!1,t=0,n=0,r=()=>{e||(e=!0,requestAnimationFrame(()=>{e=!1;let r=document.documentElement,i=r.style.height;r.style.height=`max-content`;let a=Math.ceil(r.getBoundingClientRect().height);r.style.height=i;let o=Math.ceil(window.innerWidth);(o!==t||a!==n)&&(t=o,n=a,this.sendSizeChanged({width:o,height:a}))}))};r();let i=new ResizeObserver(r);return i.observe(document.documentElement),i.observe(document.body),()=>i.disconnect()}async connect(e=new Sh(window.parent,window.parent),t){if(this.transport)throw Error(`App is already connected. Call close() before connecting again.`);this._initializedSent=!1;try{await super.connect(e);let n=await this.request({method:`ui/initialize`,params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:xh}},Kh,t);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);this._hostCapabilities=n.hostCapabilities,this._hostInfo=n.hostInfo,this._hostContext=n.hostContext,await this.notification({method:`ui/notifications/initialized`}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(e){throw this.close(),e}}};function Qh(e){let t=new Date(e);return Number.isFinite(t.getTime())?`${t.toISOString().slice(0,19).replace(`T`,` `)} UTC`:typeof e==`number`?`${e} milliseconds since 1970-01-01T00:00:00Z`:e}function J(e,t,n){let r=document.createElement(e);return t&&(r.className=t),n!==void 0&&(r.textContent=n),r}function $h(e,t,n=`primary`){let r=document.createElement(`button`);return r.type=`button`,r.className=n===`primary`?`ui-btn ui-btn--primary`:n===`danger`?`ui-btn ui-btn--danger`:`ui-btn`,r.textContent=e,r.addEventListener(`click`,t),r}function eg(...e){let t=J(`div`,`ui-btn-row`);return t.append(...e),t}function tg(e){let t=eg(e);return t.classList.add(`ui-btn-row--end`),t}function ng(e){let t=document.createElement(`input`);return t.className=`ui-input`,t.type=e.type??`text`,e.value!==void 0&&(t.value=e.value),e.placeholder!==void 0&&(t.placeholder=e.placeholder),e.id&&(t.id=e.id),e.name&&(t.name=e.name),t.autocomplete=`off`,t}function rg(e,t){let n=document.createElement(`label`);return n.className=`ui-field`,n.append(J(`span`,void 0,e),t),n}function ig(e){let t=J(`section`,`ui-section`);return e&&t.append(J(`h2`,`ui-section-title`,e)),t}function Y(e,t){let n=J(`div`,`ui-row`);n.append(J(`span`,`ui-row-label`,e));let r=J(`span`,`ui-row-value`);return typeof t==`string`?r.textContent=t:r.append(t),n.append(r),n}function ag(e,t=!1){let n=document.createElement(`details`);n.className=`ui-accordion`,n.open=t;let r=document.createElement(`summary`);r.className=`ui-accordion-summary`,r.append(J(`span`,void 0,e));let i=J(`div`,`ui-accordion-body`);return n.append(r,i),{details:n,body:i}}function og(e){return J(`span`,`ui-mono`,e)}function sg(e){let t=J(`time`,void 0,Qh(e));return t.dateTime=e,t.title=e,t.setAttribute(`aria-label`,e),t}var cg=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,lg=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i,ug=235;function dg(e){return e.length>ug?!1:e.includes(`@`)?cg.test(e):lg.test(e)}var fg=/^([a-z0-9]+(?:-[a-z0-9]+)*)$/,pg=/^\d+$/,mg=64,hg=e=>{let t=e.split(`/`);if(t.length<2||t.length>3)return!1;let[n,r,i]=t;return i!==void 0&&!pg.test(i)||!dg(n)?!1:fg.test(r)&&r.length<mg},gg=e=>Object.freeze(e());function _g(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`&&`BYTES_PER_ELEMENT`in e&&e.BYTES_PER_ELEMENT===1}function vg(e){if(!_g(e))throw TypeError(`Uint8Array expected`)}function yg(e,t){if(typeof t!=`string`)throw TypeError(`${e}: string expected`);return!0}var bg=(()=>{try{let e=new TextDecoder;return e.decode(Uint8Array.of(65,48,43,127))===`A0+`?e:void 0}catch{return}})(),xg=8192;function Sg(e){let t=e.length;if(bg!==void 0&&t>=12)return bg.decode(e);if(t<=xg)return String.fromCharCode.apply(null,e);let n=``;for(let r=0;r<t;r+=xg)n+=String.fromCharCode.apply(null,e.subarray(r,r+xg));return n}function Cg(e,t){let n=e.length;if(n>128)throw Error(`alphabet: max 128 letters`);let r=new Uint8Array(n),i=new Int8Array(128).fill(-1);for(let t=0;t<n;t++){let n=e.charCodeAt(t);if(e.codePointAt(t)!==n||n>127)throw Error(`alphabet: single-char ASCII letters only`);r[t]=n,i[n]=t}if(t!==void 0)for(let e of Object.keys(t)){let n=e.charCodeAt(0),r=i[t[e].charCodeAt(0)];if(e.length!==1||n>127||r===void 0||r===-1)throw Error(`alphabet: invalid alias ${e}`);i[n]=r}return{encode:e=>{let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++){let i=e[n],a=r[i];if(a===void 0)throw Error(`alphabet.encode: invalid digit ${i}`);t[n]=a}return Sg(t)},decode:t=>{yg(`decode`,t);let n=t.length,r=new Uint8Array(n);for(let a=0;a<n;a++){let n=t.charCodeAt(a),o=n<128?i[n]:-1;if(o===-1)throw Error(`Unknown letter "${t[a]}". Allowed: ${e}`);r[a]=o}return r}}}var wg=656356768,Tg=65536,Eg=2048,Dg=4096,Og=(e,t)=>({encode:n=>{vg(n);let r=n.length;if(r===0)return new Uint8Array;if(r>=Tg)throw Error(`invalid length`);let i=0;for(;i<r-1&&n[i]===0;)i++;let a=Math.ceil(r/2),o=new Uint16Array(a),s=r&1;s&&(o[0]=n[0]);for(let e=s,t=s;e<r;e+=2,t++)o[t]=n[e]<<8|n[e+1];let c=[],l=0;for(;l<a;){let e=0;for(let n=l;n<a;n++){let r=e*65536+o[n],i=Math.floor(r/t);e=r-i*t,o[n]=i,i===0&&n===l&&l++}c.push(e)}let u=c.length-1,d=u*5;for(let t=c[u];d++,!(t<e);t=Math.floor(t/e));let f=new Uint8Array(i+d),p=f.length-1;for(let t=0;t<u;t++){let n=c[t];for(let t=0;t<5;t++)f[p--]=n%e,n=Math.floor(n/e)}for(let t=c[u];p>=i;t=Math.floor(t/e))f[p--]=t%e;return f},decode:t=>{vg(t);let n=t.length;if(n===0)return new Uint8Array;if(n>=Tg)throw Error(`invalid length`);let r=0;for(;r<n-1&&t[r]===0;)r++;let i=new Uint16Array(Math.ceil(n*6/16)+1),a=0,o=0,s=n%5||5;for(;o<n;){let n=0,r=1;for(let i=o+s;o<i;o++){let i=t[o];if(i>=e)throw Error(`invalid integer: ${i}`);n=n*e+i,r*=e}s=5;let c=n;for(let e=0;e<a;e++){let t=i[e]*r+c;c=Math.floor(t/65536),i[e]=t-c*65536}for(;c>0;c=Math.floor(c/65536))i[a++]=c%65536}let c=a===0?1:a*2-(i[a-1]<256),l=new Uint8Array(r+c),u=l.length-1;for(let e=0;e<a;e++){let t=i[e];l[u--]=t&255,u>=r&&(l[u--]=t>>8)}return l}}),kg=(e,t)=>{let n=Cg(t);return{encode(t){if(vg(t),t.length>Eg)throw Error(`invalid length`);return n.encode(e.encode(t))},decode(t){if(yg(`baseN.decode`,t),t.length>Dg)throw Error(`invalid length`);return e.decode(n.decode(t))}}},Ag=Og(58,wg),jg=e=>kg(Ag,e),Mg=gg(()=>jg(`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`)),Ng=e=>Mg.decode(e);function Pg(e,t=[`<`,`>`]){let[n,r]=t,i=[],a=``,o=0;for(let t=0;t<e.length;t++){let s=e[t];s===n&&o++,s===r&&o--,o===0&&s===`,`?(i.push(a.trim()),a=``):a+=s}return i.push(a.trim()),i}var Fg=32;function Ig(e){try{return Ng(e).length===Fg}catch{return!1}}function Lg(e){return Hg(e)&&Ug(e)===32}function Rg(e){if(e.startsWith(`vector<`)){if(!e.endsWith(`>`))throw Error(`Invalid type tag: ${e}`);let t=e.slice(7,-1);if(!t)throw Error(`Invalid type tag: ${e}`);let n=Rg(t);return typeof n==`string`?`vector<${n}>`:`vector<${Bg(n)}>`}return e.includes(`::`)?zg(e):e}function zg(e){let t=e.split(`::`);if(t.length<3)throw Error(`Invalid struct tag: ${e}`);let[n,r]=t;if(!n||!r)throw Error(`Invalid struct tag: ${e}`);let i=hg(n),a=e.slice(n.length+r.length+4),o=a.includes(`<`)?a.slice(0,a.indexOf(`<`)):a;if(!o||a.includes(`<`)&&!a.endsWith(`>`))throw Error(`Invalid struct tag: ${e}`);let s=a.includes(`<`)?Pg(a.slice(a.indexOf(`<`)+1,a.lastIndexOf(`>`))).map(e=>Rg(e.trim())):[];return{address:i?n:Vg(n),module:r,name:o,typeParams:s}}function Bg(e){if(typeof e==`string`&&e.startsWith(`vector<`))throw Error(`normalizeStructTag does not support vector types. Use normalizeTypeTag instead.`);let{address:t,module:n,name:r,typeParams:i}=typeof e==`string`?zg(e):e;return`${t}::${n}::${r}${i?.length>0?`<${i.map(e=>typeof e==`string`?e:Bg(e)).join(`,`)}>`:``}`}function Vg(e,t=!1){let n=e.toLowerCase();return!t&&n.startsWith(`0x`)&&(n=n.slice(2)),`0x${n.padStart(64,`0`)}`}function Hg(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2==0}function Ug(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}function Wg(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`&&`BYTES_PER_ELEMENT`in e&&e.BYTES_PER_ELEMENT===1}var Gg=e=>e?`"${e}" `:``;function Kg(e,t=``){if(typeof e!=`number`)throw TypeError(Gg(t)+`expected number, got `+typeof e);if(!Number.isSafeInteger(e)||e<0)throw RangeError(Gg(t)+`expected integer >= 0, got `+e);return e}function qg(e,t,n=``){if(Wg(e)&&(t===void 0||e.length===t))return e;t!==void 0&&Kg(t,`length`);let r=Wg(e),i=t===void 0?``:` of length ${t}`,a=r?`length=${e.length}`:`type=${typeof e}`,o=Gg(n)+`expected Uint8Array`+i+`, got `+a;throw r?RangeError(o):TypeError(o)}var Jg=(e,t)=>{if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError((t===`object`?``:`"${t}" `)+`expected object, got type=`+typeof e)},Yg=(e,t)=>{Jg(e,t);let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)throw TypeError(`"${t}" expected plain object`);if(Object.hasOwn(e,`__proto__`))throw TypeError(`"${t}.__proto__" is not allowed`)};function Xg(e,t=!0){if(e.destroyed)throw Error(`hash was destroyed`);if(t&&e.finished)throw Error(`digest() was already called`)}function Zg(e,t){qg(e,void 0,`output`);let n=t.outputLen;if(!(e.length>=n))throw RangeError(`"output" expected length >= `+n)}function Qg(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function $g(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function e_(e,t){return e<<32-t|e>>>t}var t_=typeof Uint8Array.from([]).toHex==`function`&&typeof Uint8Array.fromHex==`function`,n_=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function r_(e){if(qg(e),t_)return e.toHex();let t=``;for(let n=0;n<e.length;n++)t+=n_[e[n]];return t}function i_(e,t,n=`opts`){return Yg(e,`defaults`),t!==void 0&&Yg(t,n),Object.assign(Object.create(null),e,t)}function a_(e,t={}){if(typeof e!=`function`)throw TypeError(`"hashCons" expected function, got type=`+typeof e);t=i_({},t,`info`);let n=(t,n)=>e(n).update(t).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.canXOF=r.canXOF,n.create=t=>e(t),Object.assign(n,t),Object.freeze(n)}var o_=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])}),s_=e=>e/2**32|0,c_=e=>e>>>0;function l_(e,t,n,r){let i=s_(n),a=c_(n);e.setUint32(t,r?a:i,r),e.setUint32(t+4,r?i:a,r)}function u_(e,t,n){return e&t^~e&n}function d_(e,t,n){return e&t^e&n^t&n}var f_=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,n,r){this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=$g(this.buffer)}update(e){Xg(this),qg(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length,a=!1;for(let o=0;o<i;){let s=Math.min(r-this.pos,i-o);if(s===r){let t=$g(e);for(;r<=i-o;o+=r)this.process(t,o);a=!0}else n.set(o===0&&s===i?e:e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===r&&(this.process(t,0),this.pos=0,a=!0)}return this.length+=e.length,a&&this.roundClean(),this}digestInto(e){Xg(this),Zg(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,t.fill(0,a),this.padOffset>r-a&&(this.process(n,0),t.fill(0)),l_(n,r-8,this.length*8,i),this.process(n,0),this.roundClean();let o=e===t?n:$g(e),s=this.outputLen,c=s/4,l=this.get();if(s%4||c>l.length)throw Error(`invalid outputLen`);for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneIntoMeta(e){let{buffer:t,length:n,finished:r,destroyed:i,pos:a}=this;return e.destroyed=i,e.finished=r,e.length=n,e.pos=a,a&&e.buffer.set(t),e}clone(){return this._cloneInto()}},p_=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),m_=`0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI`,h_=F().refine(Lg,`Expected a 32-byte Sui address`),g_=F().refine(Ig,`Expected a Sui transaction digest`);h_.transform(e=>Vg(e));var __=(1n<<64n)-1n,v_=/^(?:0|[1-9][0-9]*)$/,y_=/^(?:0|-?[1-9][0-9]*)$/;function b_(e,t,n={}){if(!/^\d+$/.test(e))throw Error(`${t} must be an unsigned integer string`);let r=BigInt(e);if(n.positive&&r===0n)throw Error(`${t} must be positive`);if(r>__)throw Error(`${t} must fit u64`);return r}function x_(e){let t=e===`rawAmount`?`amount`:e;return F().min(1).refine(t=>{try{return b_(t,e),!0}catch{return!1}},`Expected a raw u64 ${t} string`)}function S_(e,t,n={}){if(!v_.test(e))throw Error(`${t} must be a canonical unsigned integer string`);return b_(e,t,n)}function C_(e){return F().min(1).refine(t=>{try{return S_(t,e),!0}catch{return!1}},`Expected an unsigned integer string`)}function w_(e,t){if(!y_.test(e))throw Error(`${t} must be a signed integer string`);return BigInt(e)}function T_(e){return F().min(1).refine(t=>{try{return w_(t,e),!0}catch{return!1}},`Expected a signed integer string`)}function E_(e){return Bg(e)}var D_=[`transaction`,`effects`,`balanceChanges`,`objectTypes`],O_=F().refine(e=>{let t=new Date(e);return Number.isFinite(t.getTime())&&t.toISOString()===e},`Expected ISO 8601 UTC timestamp`),k_=z(W(D_)).length(D_.length).superRefine((e,t)=>{for(let n of D_)e.includes(n)||t.addIssue({code:`custom`,path:[],message:`chain receipt include is missing '${n}'`});new Set(e).size!==e.length&&t.addIssue({code:`custom`,path:[],message:`chain receipt include fields must not be duplicated`})}),A_=F().min(1).max(512).refine(e=>{try{return E_(e),!0}catch{return!1}},`Expected a Sui struct tag coin type`),j_=B({commandIndex:I().int().nonnegative(),packageId:h_,module:F().min(1).max(128),function:F().min(1).max(128),target:F().min(1).max(512)}).strict().superRefine((e,t)=>{let n=`${e.packageId}::${e.module}::${e.function}`;e.target!==n&&t.addIssue({code:`custom`,path:[`target`],message:`package call target must match packageId::module::function`})}),M_=B({index:I().int().nonnegative(),coinType:A_,amountRaw:T_(`accountBalanceChanges[].amountRaw`),direction:W([`increase`,`decrease`,`zero`])}).strict().superRefine((e,t)=>{let n=w_(e.amountRaw,`accountBalanceChanges[].amountRaw`),r=n>0n?`increase`:n<0n?`decrease`:`zero`;e.direction!==r&&t.addIssue({code:`custom`,path:[`direction`],message:`balance change direction must match amountRaw sign`})}),N_=hc(`success`,[B({success:G(!0),errorKind:uc().optional(),errorMessage:uc().optional()}).strict(),B({success:G(!1),errorKind:F().min(1).max(200).optional(),errorMessage:F().min(1).max(2e3).optional()}).strict()]),P_=B({kind:G(`sui_chain_receipt_v1`),source:B({method:G(`client.core.getTransaction`),network:G(`sui:mainnet`),chainIdentifier:F().min(1),fetchedAt:O_,include:k_}).strict(),txDigest:g_,sender:h_,effectsStatus:N_,packageCalls:z(j_),accountBalanceChanges:z(M_),objectTypes:U(h_,F().min(1).max(512))}).strict(),F_=W([`awaiting_signature`,`submitting`,`awaiting_chain_result`,`stopped`,`request_failed`,`outcome_unknown`,`completed`]),I_=B({reviewSessionId:F().min(1),attemptId:F().min(1),planId:F().min(1),status:W([`success`,`failure`]),txDigest:g_,chainReceipt:P_,failureReason:G(`chain_execution_failed`).optional(),recordedAt:F().datetime()}).strict().superRefine((e,t)=>{(e.txDigest!==e.chainReceipt.txDigest||e.status===`success`!==e.chainReceipt.effectsStatus.success)&&t.addIssue({code:`custom`,message:`Execution must match the observed chain receipt.`}),e.status===`failure`!=(e.failureReason!==void 0)&&t.addIssue({code:`custom`,message:`Only a chain failure has a chain execution failure reason.`})}),L_=B({attemptId:F().min(1),reviewSessionId:F().min(1),planId:F().min(1),reviewRevision:I().int().nonnegative(),account:h_,transactionDigest:g_,requestStatus:F_,revision:I().int().nonnegative(),createdAt:F().datetime(),updatedAt:F().datetime(),signatureVerifiedAt:F().datetime().optional(),submittedAt:F().datetime().optional(),reason:F().optional(),execution:I_.optional()}).strict().superRefine((e,t)=>{let n=e.execution;e.requestStatus===`completed`!=(n!==void 0)&&t.addIssue({code:`custom`,message:`Completed requests require an observed execution result.`}),n&&(n.attemptId!==e.attemptId||n.reviewSessionId!==e.reviewSessionId||n.planId!==e.planId||n.txDigest!==e.transactionDigest||n.chainReceipt.sender!==e.account)&&t.addIssue({code:`custom`,message:`Execution identity differs from the admitted request.`})}),R_=`sui:mainnet`,z_=F().uuid(),B_=W([`process_start`,`sdk_start`,`session_restore`,`state_sync`]),V_=W([`initialization_failed`,`restoration_failed`,`wallet_state_unavailable`]),H_=hc(`status`,[B({status:G(`available`),walletRunId:z_}).strict(),B({status:G(`initializing`),walletRunId:z_,stage:B_,message:F()}).strict(),B({status:G(`recovering`),walletRunId:z_,message:F()}).strict(),B({status:G(`unavailable`),walletRunId:z_.optional(),reason:V_,message:F()}).strict()]),U_=hc(`status`,[B({status:G(`idle`)}).strict(),B({status:G(`waiting`)}).strict(),B({status:G(`unavailable`),reason:G(`wallet_unavailable`),message:F()}).strict()]),W_=W([`awaiting_approval`,`connected`,`rejected`,`failed`,`expired`,`stopped`,`disconnected`]),G_=B({runId:F().uuid(),connections:z(B({connectionId:F().min(1),revision:I().int().nonnegative(),status:W_,accounts:z(h_),walletName:F().optional(),sdkPending:L(),disconnectPending:L()}).strict()),preparations:z(B({id:F().min(1),revision:I().int().nonnegative(),review_revision:I().int().nonnegative(),preparation_id:F().nullable(),wallet_connection_id:F().nullable()}).strict()),requests:z(B({attempt_id:F().min(1),revision:I().int().nonnegative(),request_status:F_,can_submit:I().int().min(0).max(1),sdk_pending:I().int().min(0).max(1),submit_pending:I().int().min(0).max(1),lookup_pending:I().int().min(0).max(1)}).strict())}).strict(),K_=B({connectionId:F().min(1),status:W_,revision:I().int().nonnegative(),accounts:z(h_),methods:z(F()),chain:G(R_),createdAt:F().datetime(),updatedAt:F().datetime(),expiresAt:F().datetime(),walletName:F().optional(),reason:F().optional()}).strict(),q_=B({reason:G(`multiple_connections`),connectionIds:z(F().min(1)).min(2).refine(e=>new Set(e).size===e.length)}).strict(),J_=`A wallet connection in the connection service is not recorded here. Remove the retained connection in your wallet app, then check its status. If needed, open Settings and use Troubleshooting to restart the connection service and inspect it again. Restarting does not approve an unrecorded connection.`,Y_=hc(`status`,[B({status:G(`available`),account:h_}).strict(),B({status:G(`address_required`)}).strict()]),X_=[`connect`,`disconnect`,`use_account`,`stop_connection`,`prepare_review`,`request_signature`,`cancel`,`stop_waiting`,`read_result`],Z_=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Q_=new Uint32Array(64),$_=class extends f_{A=0;B=0;C=0;D=0;E=0;F=0;G=0;H=0;constructor(e,t){super(64,e,8,!1),this.A=t[0]|0,this.B=t[1]|0,this.C=t[2]|0,this.D=t[3]|0,this.E=t[4]|0,this.F=t[5]|0,this.G=t[6]|0,this.H=t[7]|0}get(){let{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}_cloneInto(e){return(e||=new this.constructor).set(...this.get()),this._cloneIntoMeta(e)}process(e,t){for(let n=0;n<16;n++,t+=4)Q_[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=Q_[e-15],n=Q_[e-2],r=e_(t,7)^e_(t,18)^t>>>3,i=e_(n,17)^e_(n,19)^n>>>10;Q_[e]=i+Q_[e-7]+r+Q_[e-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=e_(o,6)^e_(o,11)^e_(o,25),u=l+t+u_(o,s,c)+Z_[e]+Q_[e]|0,d=(e_(n,2)^e_(n,13)^e_(n,22))+d_(n,r,i)|0;l=c,c=s,s=o,o=a+u|0,a=i,i=r,r=n,n=u+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,a,o,s,c,l)}roundClean(){Qg(Q_)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),Qg(this.buffer)}},ev=class extends $_{constructor(){super(32,p_)}},tv=a_(()=>new ev,o_(1));function nv(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=55296&&n<=56319){if(t+1>=e.length)return!1;let n=e.charCodeAt(++t);if(n<56320||n>57343)return!1}else if(n>=56320&&n<=57343)return!1}return!0}function rv(e){if(typeof e!=`string`)throw TypeError(`invalid mnemonic type: `+typeof e);if(!nv(e))throw TypeError(`expected well-formed Unicode string`);return e.normalize(`NFKD`)}function iv(e){let t=rv(e),n=t.split(` `);if(![12,15,18,21,24].includes(n.length))throw Error(`Invalid mnemonic`);return{nfkd:t,words:n}}function av(e){if(qg(e),![16,20,24,28,32].includes(e.length))throw RangeError(`invalid entropy length`)}var ov=e=>{let t=8-e.length/4;return tv(e)[0]>>t<<t};function sv(e){if(!Array.isArray(e)||e.length!==2048||typeof e[0]!=`string`)throw TypeError(`Wordlist: expected array of 2048 strings`);e.forEach(e=>{if(typeof e!=`string`)throw TypeError(`wordlist: non-string element: `+e);if(!nv(e))throw TypeError(`wordlist: expected well-formed Unicode string`)})}function cv(e,t){sv(t);let n=e.length/3*4,r=new Uint8Array(n+1),i=0,a=0,o=0;for(let n of e){let e=t.indexOf(n);if(e===-1)throw Error(`Unknown word: `+n);for(i=i<<11|e,a+=11;a>=8;)a-=8,r[o++]=i>>>a&255;i&=(1<<a)-1}a>0&&(r[o]=i<<8-a);let s=r.subarray(0,n);if(r[n]!==ov(s))throw Error(`Invalid checksum`);return Uint8Array.from(s)}function lv(e,t){let{words:n}=iv(e),r=cv(n,t);return av(r),r}function uv(e,t){try{lv(e,t)}catch{return!1}return!0}var dv=Object.freeze(`abandon
1543
+ container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:F().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:F().optional().describe(`User's timezone in IANA format.`),userAgent:F().optional().describe(`Host application identifier.`),platform:H([G(`web`),G(`desktop`),G(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:B({touch:L().optional().describe(`Whether the device supports touch input.`),hover:L().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:B({top:I().describe(`Top safe area inset in pixels.`),right:I().describe(`Right safe area inset in pixels.`),bottom:I().describe(`Bottom safe area inset in pixels.`),left:I().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough(),Gh=B({method:G(`ui/notifications/host-context-changed`),params:Wh.describe(`Partial context update containing only changed fields.`)});B({method:G(`ui/update-model-context`),params:B({content:z(Vu).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:U(F(),R().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),B({method:G(`ui/initialize`),params:B({appInfo:Pl.describe(`App identification (name and version).`),appCapabilities:Bh.describe(`Features and capabilities this app provides.`),protocolVersion:F().describe(`Protocol version this app supports.`)})});var Kh=B({protocolVersion:F().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:Pl.describe(`Host application identification and version.`),hostCapabilities:zh.describe(`Features and capabilities provided by the host.`),hostContext:Wh.describe(`Rich context about the host environment.`)}).passthrough(),qh={target:`draft-2020-12`};async function Jh(e,t){let n=e[`~standard`];if(n.jsonSchema)return n.jsonSchema[t](qh);throw Error(`Schema (vendor: ${n.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function Yh(e,t,n=``){let r=await e[`~standard`].validate(t);if(r.issues){let e=r.issues.map(e=>{let t=e.path?.map(e=>typeof e==`object`?e.key:e).join(`.`);return t?`${t}: ${e.message}`:e.message}).join(`; `);throw Error(n+e)}return r.value}function Xh(e,t){let n={...e,...t};return t.experimental!==void 0&&(n.experimental={...e.experimental,...t.experimental}),t.tools!==void 0&&(n.tools={...e.tools,...t.tools}),n}var Zh=class e extends Zm{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new gh;_methods=new _h;setRequestHandler=(...e)=>{let[t,...n]=yh(`request`,e)??e;this._methods.claim(t,`setRequestHandler`),super.setRequestHandler.call(this,t,...n)};setNotificationHandler=(...e)=>{let[t,...n]=yh(`notification`,e)??e;this._methods.claim(t,`setNotificationHandler`),super.setNotificationHandler.call(this,t,...n)};removeRequestHandler=e=>{this._methods.release(e),super.removeRequestHandler(e)};removeNotificationHandler=e=>{this._methods.release(e),super.removeNotificationHandler(e)};replaceRequestHandler=(e,...t)=>{this._methods.replace(e),super.setRequestHandler.call(this,e,...t)};_assertInitialized(e){if(this._initializedSent)return;let t=`[ext-apps] App.${e}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(t);console.warn(`${t}. This will throw in a future release.`)}eventSchemas={toolinput:jh,toolinputpartial:Mh,toolresult:Uh,toolcancelled:Nh,hostcontextchanged:Gh};static ONE_SHOT_EVENTS=new Set([`toolinput`,`toolinputpartial`,`toolresult`,`toolcancelled`]);_everHadListener=new Set;_assertHandlerTiming(t){if(!e.ONE_SHOT_EVENTS.has(t)||this._everHadListener.has(t)||(this._everHadListener.add(t),!this._initializedSent))return;let n=`[ext-apps] "${String(t)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(n);console.warn(n)}setEventHandler(e,t){t&&this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.setHandler(e,t)}addEventListener(e,t){this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.addEventListener(e,t)}removeEventListener(e,t){this._events.removeEventListener(e,t)}_ensureEventSlot(e){if(this._registeredEvents.has(e))return;let t=this.eventSchemas[e];if(!t)throw Error(`Unknown event: ${String(e)}`);this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},t=>{let n=t;e===`hostcontextchanged`&&(this._hostContext={...this._hostContext,...n}),this._events.dispatch(e,n)}),this._registeredEvents.add(e)}getEventHandler(e){return this._events.getHandler(e)}warnIfRequestHandlerReplaced(e,t,n){t&&n&&console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t={},n={autoResize:!0}){super(n),this._appInfo=e,this._appCapabilities=t,this.options=n,this._methods.replace(`notifications/cancelled`),this._methods.replace(`notifications/progress`),!n.allowUnsafeEval&&qe({jitless:!0}),this.replaceRequestHandler(`ping`,e=>(console.log(`Received ping:`,e.params),{})),this.setEventHandler(`hostcontextchanged`,void 0)}buildContext(e){return e}registerAppCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after transport is established`);this._appCapabilities=Xh(this._appCapabilities,e)}registerTool(e,t,n){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r=this,i=()=>{r._initializedSent&&r._appCapabilities.tools?.listChanged&&r.sendToolListChanged()},a=t.inputSchema!==void 0,o={title:t.title,description:t.description,inputSchema:t.inputSchema,outputSchema:t.outputSchema,annotations:t.annotations,_meta:t._meta,enabled:!0,enable(){this.enabled=!0,i()},disable(){this.enabled=!1,i()},update(e){Object.assign(this,e),i()},remove(){r._registeredTools[e]===o&&(delete r._registeredTools[e],i())},handler:async(t,r)=>{if(!o.enabled)throw Error(`Tool ${e} is disabled`);let i;if(a){let a=o.inputSchema;i=await n(a?await Yh(a,t??{},`Invalid input for tool ${e}: `):t??{},r)}else i=await n(r);return o.outputSchema&&!i.isError&&(i.structuredContent=await Yh(o.outputSchema,i.structuredContent,`Invalid output for tool ${e}: `)),i}};return this._registeredTools[e]=o,!this._appCapabilities.tools&&!this.transport&&this.registerAppCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),i(),o}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(e,t)=>{let n=this._registeredTools[e.name];if(!n)throw Error(`Tool ${e.name} not found`);return n.handler(e.arguments,t)},this.onlisttools=async(e,t)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([e,t])=>t.enabled).map(async([e,t])=>{let n={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?await Jh(t.inputSchema,`input`):{type:`object`,properties:{}}};return t.outputSchema&&(n.outputSchema=await Jh(t.outputSchema,`output`)),t.annotations&&(n.annotations=t.annotations),t._meta&&(n._meta=t._meta),n}))}))}async sendToolListChanged(e={}){this._assertInitialized(`sendToolListChanged`),await this.notification({method:`notifications/tools/list_changed`,params:e})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler(`toolinput`)}set ontoolinput(e){this.setEventHandler(`toolinput`,e)}get ontoolinputpartial(){return this.getEventHandler(`toolinputpartial`)}set ontoolinputpartial(e){this.setEventHandler(`toolinputpartial`,e)}get ontoolresult(){return this.getEventHandler(`toolresult`)}set ontoolresult(e){this.setEventHandler(`toolresult`,e)}get ontoolcancelled(){return this.getEventHandler(`toolcancelled`)}set ontoolcancelled(e){this.setEventHandler(`toolcancelled`,e)}get onhostcontextchanged(){return this.getEventHandler(`hostcontextchanged`)}set onhostcontextchanged(e){this.setEventHandler(`hostcontextchanged`,e)}_onteardown;get onteardown(){return this._onteardown}set onteardown(e){this.warnIfRequestHandlerReplaced(`onteardown`,this._onteardown,e),this._onteardown=e,this.replaceRequestHandler(`ui/resource-teardown`,{params:Ih.shape.params,result:Lh},(e,t)=>{if(!this._onteardown)throw Error(`No onteardown handler set`);return this._onteardown(e,t)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced(`oncalltool`,this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler(`tools/call`,(e,t)=>{if(!this._oncalltool)throw Error(`No oncalltool handler set`);return this._oncalltool(e.params,t)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(e){this.warnIfRequestHandlerReplaced(`onlisttools`,this._onlisttools,e),this._onlisttools=e,this.replaceRequestHandler(`tools/list`,(e,t)=>{if(!this._onlisttools)throw Error(`No onlisttools handler set`);return this._onlisttools(e.params,t)})}assertCapabilityForMethod(e){if(e===`sampling/createMessage`&&!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${e})`)}assertRequestHandlerCapability(e){switch(e){case`tools/call`:case`tools/list`:if(!this._appCapabilities.tools)throw Error(`Client does not support tool capability (required for ${e})`);return;default:return}}assertNotificationCapability(e){}async callServerTool(e,t){if(this._assertInitialized(`callServerTool`),typeof e==`string`)throw Error(`callServerTool() expects an object as its first argument, but received a string ("${e}"). Did you mean: callServerTool({ name: "${e}", arguments: { ... } })?`);return await this.request({method:`tools/call`,params:e},{onprogress:()=>{},resetTimeoutOnProgress:!0,...t})}async readServerResource(e,t){return this._assertInitialized(`readServerResource`),await this.request({method:`resources/read`,params:e},t)}async listServerResources(e,t){return this._assertInitialized(`listServerResources`),await this.request({method:`resources/list`,params:e},t)}async createSamplingMessage(e,t){return this._assertInitialized(`createSamplingMessage`),await this.request({method:`sampling/createMessage`,params:e},t)}sendMessage(e,t){return this._assertInitialized(`sendMessage`),this.request({method:`ui/message`,params:e},Oh,t)}sendLog(e){return this.notification({method:`notifications/message`,params:e})}updateModelContext(e,t){return this._assertInitialized(`updateModelContext`),this.request({method:`ui/update-model-context`,params:e},Ol,t)}openLink(e,t){return this._assertInitialized(`openLink`),this.request({method:`ui/open-link`,params:e},Eh,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized(`downloadFile`),this.request({method:`ui/download-file`,params:e},Dh,t)}requestTeardown(e={}){return this.notification({method:`ui/notifications/request-teardown`,params:e})}requestDisplayMode(e,t){return this._assertInitialized(`requestDisplayMode`),this.request({method:`ui/request-display-mode`,params:e},Vh,t)}sendSizeChanged(e){return this.notification({method:`ui/notifications/size-changed`,params:e})}setupSizeChangedNotifications(){let e=!1,t=0,n=0,r=()=>{e||(e=!0,requestAnimationFrame(()=>{e=!1;let r=document.documentElement,i=r.style.height;r.style.height=`max-content`;let a=Math.ceil(r.getBoundingClientRect().height);r.style.height=i;let o=Math.ceil(window.innerWidth);(o!==t||a!==n)&&(t=o,n=a,this.sendSizeChanged({width:o,height:a}))}))};r();let i=new ResizeObserver(r);return i.observe(document.documentElement),i.observe(document.body),()=>i.disconnect()}async connect(e=new Sh(window.parent,window.parent),t){if(this.transport)throw Error(`App is already connected. Call close() before connecting again.`);this._initializedSent=!1;try{await super.connect(e);let n=await this.request({method:`ui/initialize`,params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:xh}},Kh,t);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);this._hostCapabilities=n.hostCapabilities,this._hostInfo=n.hostInfo,this._hostContext=n.hostContext,await this.notification({method:`ui/notifications/initialized`}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(e){throw this.close(),e}}};function Qh(e){let t=new Date(e);return Number.isFinite(t.getTime())?`${t.toISOString().slice(0,19).replace(`T`,` `)} UTC`:typeof e==`number`?`${e} milliseconds since 1970-01-01T00:00:00Z`:e}function J(e,t,n){let r=document.createElement(e);return t&&(r.className=t),n!==void 0&&(r.textContent=n),r}function $h(e,t,n=`primary`){let r=document.createElement(`button`);return r.type=`button`,r.className=n===`primary`?`ui-btn ui-btn--primary`:n===`danger`?`ui-btn ui-btn--danger`:`ui-btn`,r.textContent=e,r.addEventListener(`click`,t),r}function eg(...e){let t=J(`div`,`ui-btn-row`);return t.append(...e),t}function tg(e){let t=eg(e);return t.classList.add(`ui-btn-row--end`),t}function ng(e){let t=document.createElement(`input`);return t.type=e.type??`text`,t.className=t.type===`checkbox`?`ui-checkbox`:`ui-input`,e.value!==void 0&&(t.value=e.value),e.placeholder!==void 0&&(t.placeholder=e.placeholder),e.id&&(t.id=e.id),e.name&&(t.name=e.name),t.autocomplete=`off`,t}function rg(e,t){let n=document.createElement(`label`),r=t.tagName===`INPUT`&&t.type===`checkbox`;n.className=r?`ui-field ui-field--check`:`ui-field`;let i=J(`span`,void 0,e);return r?n.append(t,i):n.append(i,t),n}function ig(e){let t=J(`section`,`ui-section`);return e&&t.append(J(`h2`,`ui-section-title`,e)),t}function Y(e,t){let n=J(`div`,`ui-row`);n.append(J(`span`,`ui-row-label`,e));let r=J(`span`,`ui-row-value`);return typeof t==`string`?r.textContent=t:r.append(t),n.append(r),n}function ag(e,t=!1){let n=document.createElement(`details`);n.className=`ui-accordion`,n.open=t;let r=document.createElement(`summary`);r.className=`ui-accordion-summary`,r.append(J(`span`,void 0,e));let i=J(`div`,`ui-accordion-body`);return n.append(r,i),{details:n,body:i}}function og(e){return J(`span`,`ui-mono`,e)}function sg(e){let t=J(`time`,void 0,Qh(e));return t.dateTime=e,t.title=e,t.setAttribute(`aria-label`,e),t}var cg=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,lg=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i,ug=235;function dg(e){return e.length>ug?!1:e.includes(`@`)?cg.test(e):lg.test(e)}var fg=/^([a-z0-9]+(?:-[a-z0-9]+)*)$/,pg=/^\d+$/,mg=64,hg=e=>{let t=e.split(`/`);if(t.length<2||t.length>3)return!1;let[n,r,i]=t;return i!==void 0&&!pg.test(i)||!dg(n)?!1:fg.test(r)&&r.length<mg},gg=e=>Object.freeze(e());function _g(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`&&`BYTES_PER_ELEMENT`in e&&e.BYTES_PER_ELEMENT===1}function vg(e){if(!_g(e))throw TypeError(`Uint8Array expected`)}function yg(e,t){if(typeof t!=`string`)throw TypeError(`${e}: string expected`);return!0}var bg=(()=>{try{let e=new TextDecoder;return e.decode(Uint8Array.of(65,48,43,127))===`A0+`?e:void 0}catch{return}})(),xg=8192;function Sg(e){let t=e.length;if(bg!==void 0&&t>=12)return bg.decode(e);if(t<=xg)return String.fromCharCode.apply(null,e);let n=``;for(let r=0;r<t;r+=xg)n+=String.fromCharCode.apply(null,e.subarray(r,r+xg));return n}function Cg(e,t){let n=e.length;if(n>128)throw Error(`alphabet: max 128 letters`);let r=new Uint8Array(n),i=new Int8Array(128).fill(-1);for(let t=0;t<n;t++){let n=e.charCodeAt(t);if(e.codePointAt(t)!==n||n>127)throw Error(`alphabet: single-char ASCII letters only`);r[t]=n,i[n]=t}if(t!==void 0)for(let e of Object.keys(t)){let n=e.charCodeAt(0),r=i[t[e].charCodeAt(0)];if(e.length!==1||n>127||r===void 0||r===-1)throw Error(`alphabet: invalid alias ${e}`);i[n]=r}return{encode:e=>{let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++){let i=e[n],a=r[i];if(a===void 0)throw Error(`alphabet.encode: invalid digit ${i}`);t[n]=a}return Sg(t)},decode:t=>{yg(`decode`,t);let n=t.length,r=new Uint8Array(n);for(let a=0;a<n;a++){let n=t.charCodeAt(a),o=n<128?i[n]:-1;if(o===-1)throw Error(`Unknown letter "${t[a]}". Allowed: ${e}`);r[a]=o}return r}}}var wg=656356768,Tg=65536,Eg=2048,Dg=4096,Og=(e,t)=>({encode:n=>{vg(n);let r=n.length;if(r===0)return new Uint8Array;if(r>=Tg)throw Error(`invalid length`);let i=0;for(;i<r-1&&n[i]===0;)i++;let a=Math.ceil(r/2),o=new Uint16Array(a),s=r&1;s&&(o[0]=n[0]);for(let e=s,t=s;e<r;e+=2,t++)o[t]=n[e]<<8|n[e+1];let c=[],l=0;for(;l<a;){let e=0;for(let n=l;n<a;n++){let r=e*65536+o[n],i=Math.floor(r/t);e=r-i*t,o[n]=i,i===0&&n===l&&l++}c.push(e)}let u=c.length-1,d=u*5;for(let t=c[u];d++,!(t<e);t=Math.floor(t/e));let f=new Uint8Array(i+d),p=f.length-1;for(let t=0;t<u;t++){let n=c[t];for(let t=0;t<5;t++)f[p--]=n%e,n=Math.floor(n/e)}for(let t=c[u];p>=i;t=Math.floor(t/e))f[p--]=t%e;return f},decode:t=>{vg(t);let n=t.length;if(n===0)return new Uint8Array;if(n>=Tg)throw Error(`invalid length`);let r=0;for(;r<n-1&&t[r]===0;)r++;let i=new Uint16Array(Math.ceil(n*6/16)+1),a=0,o=0,s=n%5||5;for(;o<n;){let n=0,r=1;for(let i=o+s;o<i;o++){let i=t[o];if(i>=e)throw Error(`invalid integer: ${i}`);n=n*e+i,r*=e}s=5;let c=n;for(let e=0;e<a;e++){let t=i[e]*r+c;c=Math.floor(t/65536),i[e]=t-c*65536}for(;c>0;c=Math.floor(c/65536))i[a++]=c%65536}let c=a===0?1:a*2-(i[a-1]<256),l=new Uint8Array(r+c),u=l.length-1;for(let e=0;e<a;e++){let t=i[e];l[u--]=t&255,u>=r&&(l[u--]=t>>8)}return l}}),kg=(e,t)=>{let n=Cg(t);return{encode(t){if(vg(t),t.length>Eg)throw Error(`invalid length`);return n.encode(e.encode(t))},decode(t){if(yg(`baseN.decode`,t),t.length>Dg)throw Error(`invalid length`);return e.decode(n.decode(t))}}},Ag=Og(58,wg),jg=e=>kg(Ag,e),Mg=gg(()=>jg(`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`)),Ng=e=>Mg.decode(e);function Pg(e,t=[`<`,`>`]){let[n,r]=t,i=[],a=``,o=0;for(let t=0;t<e.length;t++){let s=e[t];s===n&&o++,s===r&&o--,o===0&&s===`,`?(i.push(a.trim()),a=``):a+=s}return i.push(a.trim()),i}var Fg=32;function Ig(e){try{return Ng(e).length===Fg}catch{return!1}}function Lg(e){return Hg(e)&&Ug(e)===32}function Rg(e){if(e.startsWith(`vector<`)){if(!e.endsWith(`>`))throw Error(`Invalid type tag: ${e}`);let t=e.slice(7,-1);if(!t)throw Error(`Invalid type tag: ${e}`);let n=Rg(t);return typeof n==`string`?`vector<${n}>`:`vector<${Bg(n)}>`}return e.includes(`::`)?zg(e):e}function zg(e){let t=e.split(`::`);if(t.length<3)throw Error(`Invalid struct tag: ${e}`);let[n,r]=t;if(!n||!r)throw Error(`Invalid struct tag: ${e}`);let i=hg(n),a=e.slice(n.length+r.length+4),o=a.includes(`<`)?a.slice(0,a.indexOf(`<`)):a;if(!o||a.includes(`<`)&&!a.endsWith(`>`))throw Error(`Invalid struct tag: ${e}`);let s=a.includes(`<`)?Pg(a.slice(a.indexOf(`<`)+1,a.lastIndexOf(`>`))).map(e=>Rg(e.trim())):[];return{address:i?n:Vg(n),module:r,name:o,typeParams:s}}function Bg(e){if(typeof e==`string`&&e.startsWith(`vector<`))throw Error(`normalizeStructTag does not support vector types. Use normalizeTypeTag instead.`);let{address:t,module:n,name:r,typeParams:i}=typeof e==`string`?zg(e):e;return`${t}::${n}::${r}${i?.length>0?`<${i.map(e=>typeof e==`string`?e:Bg(e)).join(`,`)}>`:``}`}function Vg(e,t=!1){let n=e.toLowerCase();return!t&&n.startsWith(`0x`)&&(n=n.slice(2)),`0x${n.padStart(64,`0`)}`}function Hg(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2==0}function Ug(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}function Wg(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`&&`BYTES_PER_ELEMENT`in e&&e.BYTES_PER_ELEMENT===1}var Gg=e=>e?`"${e}" `:``;function Kg(e,t=``){if(typeof e!=`number`)throw TypeError(Gg(t)+`expected number, got `+typeof e);if(!Number.isSafeInteger(e)||e<0)throw RangeError(Gg(t)+`expected integer >= 0, got `+e);return e}function qg(e,t,n=``){if(Wg(e)&&(t===void 0||e.length===t))return e;t!==void 0&&Kg(t,`length`);let r=Wg(e),i=t===void 0?``:` of length ${t}`,a=r?`length=${e.length}`:`type=${typeof e}`,o=Gg(n)+`expected Uint8Array`+i+`, got `+a;throw r?RangeError(o):TypeError(o)}var Jg=(e,t)=>{if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError((t===`object`?``:`"${t}" `)+`expected object, got type=`+typeof e)},Yg=(e,t)=>{Jg(e,t);let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)throw TypeError(`"${t}" expected plain object`);if(Object.hasOwn(e,`__proto__`))throw TypeError(`"${t}.__proto__" is not allowed`)};function Xg(e,t=!0){if(e.destroyed)throw Error(`hash was destroyed`);if(t&&e.finished)throw Error(`digest() was already called`)}function Zg(e,t){qg(e,void 0,`output`);let n=t.outputLen;if(!(e.length>=n))throw RangeError(`"output" expected length >= `+n)}function Qg(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function $g(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function e_(e,t){return e<<32-t|e>>>t}var t_=typeof Uint8Array.from([]).toHex==`function`&&typeof Uint8Array.fromHex==`function`,n_=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function r_(e){if(qg(e),t_)return e.toHex();let t=``;for(let n=0;n<e.length;n++)t+=n_[e[n]];return t}function i_(e,t,n=`opts`){return Yg(e,`defaults`),t!==void 0&&Yg(t,n),Object.assign(Object.create(null),e,t)}function a_(e,t={}){if(typeof e!=`function`)throw TypeError(`"hashCons" expected function, got type=`+typeof e);t=i_({},t,`info`);let n=(t,n)=>e(n).update(t).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.canXOF=r.canXOF,n.create=t=>e(t),Object.assign(n,t),Object.freeze(n)}var o_=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])}),s_=e=>e/2**32|0,c_=e=>e>>>0;function l_(e,t,n,r){let i=s_(n),a=c_(n);e.setUint32(t,r?a:i,r),e.setUint32(t+4,r?i:a,r)}function u_(e,t,n){return e&t^~e&n}function d_(e,t,n){return e&t^e&n^t&n}var f_=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,n,r){this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=$g(this.buffer)}update(e){Xg(this),qg(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length,a=!1;for(let o=0;o<i;){let s=Math.min(r-this.pos,i-o);if(s===r){let t=$g(e);for(;r<=i-o;o+=r)this.process(t,o);a=!0}else n.set(o===0&&s===i?e:e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===r&&(this.process(t,0),this.pos=0,a=!0)}return this.length+=e.length,a&&this.roundClean(),this}digestInto(e){Xg(this),Zg(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,t.fill(0,a),this.padOffset>r-a&&(this.process(n,0),t.fill(0)),l_(n,r-8,this.length*8,i),this.process(n,0),this.roundClean();let o=e===t?n:$g(e),s=this.outputLen,c=s/4,l=this.get();if(s%4||c>l.length)throw Error(`invalid outputLen`);for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneIntoMeta(e){let{buffer:t,length:n,finished:r,destroyed:i,pos:a}=this;return e.destroyed=i,e.finished=r,e.length=n,e.pos=a,a&&e.buffer.set(t),e}clone(){return this._cloneInto()}},p_=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),m_=`0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI`,h_=F().refine(Lg,`Expected a 32-byte Sui address`),g_=F().refine(Ig,`Expected a Sui transaction digest`),__=h_.transform(e=>Vg(e));function v_(e){let t=__.safeParse(e);return t.success?t.data:void 0}var y_=[`sui:mainnet`,`eip155:1`,`solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`],b_=y_[0],x_=W(y_),S_=U(x_,I().int().nonnegative()),C_=z(x_).refine(e=>new Set(e).size===e.length,`Networks must be distinct`);function w_(e){let t=new Set(C_.parse(e));return y_.filter(e=>t.has(e))}var T_={"sui:mainnet":`Sui`,"eip155:1":`Ethereum`,"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":`Solana`};function E_(e,t){if(e===b_)return v_(t);if(e===`eip155:1`)return/^0x[0-9a-fA-F]{40}$/.test(t)?t.toLowerCase():void 0;try{return Ng(t).length===32?t:void 0}catch{return}}var D_=B({chainId:x_,address:F()}).strict().refine(e=>E_(e.chainId,e.address)===e.address,`Expected a normalized chain address`),O_=z(B({chainId:x_,accounts:z(B({address:F(),displayAddress:F().optional(),methods:z(F()),events:z(F())}).strict()),invalidAccounts:G(!0).optional()}).strict().superRefine((e,t)=>{(new Set(e.accounts.map(e=>e.address)).size!==e.accounts.length||e.invalidAccounts&&e.accounts.length||e.accounts.some(t=>E_(e.chainId,t.address)!==t.address||t.displayAddress!==void 0&&E_(e.chainId,t.displayAddress)!==t.address))&&t.addIssue({code:`custom`,message:`Wallet grant accounts must match their chain`})})).refine(e=>new Set(e.map(e=>e.chainId)).size===e.length,`Wallet grants must have distinct chains`),k_=z(hc(`status`,[D_.safeExtend({status:G(`bound`)}).strict(),B({chainId:x_,status:W([`not_approved`,`multiple_accounts`,`invalid_response`])}).strict()])).refine(e=>new Set(e.map(e=>e.chainId)).size===e.length,`One result per requested chain is required`);B({accounts:z(F()),methods:z(F()),events:z(F())});var A_=(1n<<64n)-1n,j_=/^(?:0|[1-9][0-9]*)$/,M_=/^(?:0|-?[1-9][0-9]*)$/;function N_(e,t,n={}){if(!/^\d+$/.test(e))throw Error(`${t} must be an unsigned integer string`);let r=BigInt(e);if(n.positive&&r===0n)throw Error(`${t} must be positive`);if(r>A_)throw Error(`${t} must fit u64`);return r}function P_(e){let t=e===`rawAmount`?`amount`:e;return F().min(1).refine(t=>{try{return N_(t,e),!0}catch{return!1}},`Expected a raw u64 ${t} string`)}function F_(e,t,n={}){if(!j_.test(e))throw Error(`${t} must be a canonical unsigned integer string`);return N_(e,t,n)}function I_(e){return F().min(1).refine(t=>{try{return F_(t,e),!0}catch{return!1}},`Expected an unsigned integer string`)}function L_(e,t){if(!M_.test(e))throw Error(`${t} must be a signed integer string`);return BigInt(e)}function R_(e){return F().min(1).refine(t=>{try{return L_(t,e),!0}catch{return!1}},`Expected a signed integer string`)}function z_(e){return Bg(e)}var B_=[`transaction`,`effects`,`balanceChanges`,`objectTypes`],V_=F().refine(e=>{let t=new Date(e);return Number.isFinite(t.getTime())&&t.toISOString()===e},`Expected ISO 8601 UTC timestamp`),H_=z(W(B_)).length(B_.length).superRefine((e,t)=>{for(let n of B_)e.includes(n)||t.addIssue({code:`custom`,path:[],message:`chain receipt include is missing '${n}'`});new Set(e).size!==e.length&&t.addIssue({code:`custom`,path:[],message:`chain receipt include fields must not be duplicated`})}),U_=F().min(1).max(512).refine(e=>{try{return z_(e),!0}catch{return!1}},`Expected a Sui struct tag coin type`),W_=B({commandIndex:I().int().nonnegative(),packageId:h_,module:F().min(1).max(128),function:F().min(1).max(128),target:F().min(1).max(512)}).strict().superRefine((e,t)=>{let n=`${e.packageId}::${e.module}::${e.function}`;e.target!==n&&t.addIssue({code:`custom`,path:[`target`],message:`package call target must match packageId::module::function`})}),G_=B({index:I().int().nonnegative(),coinType:U_,amountRaw:R_(`accountBalanceChanges[].amountRaw`),direction:W([`increase`,`decrease`,`zero`])}).strict().superRefine((e,t)=>{let n=L_(e.amountRaw,`accountBalanceChanges[].amountRaw`),r=n>0n?`increase`:n<0n?`decrease`:`zero`;e.direction!==r&&t.addIssue({code:`custom`,path:[`direction`],message:`balance change direction must match amountRaw sign`})}),K_=hc(`success`,[B({success:G(!0),errorKind:uc().optional(),errorMessage:uc().optional()}).strict(),B({success:G(!1),errorKind:F().min(1).max(200).optional(),errorMessage:F().min(1).max(2e3).optional()}).strict()]),q_=B({kind:G(`sui_chain_receipt_v1`),source:B({method:G(`client.core.getTransaction`),network:G(`sui:mainnet`),chainIdentifier:F().min(1),fetchedAt:V_,include:H_}).strict(),txDigest:g_,sender:h_,effectsStatus:K_,packageCalls:z(W_),accountBalanceChanges:z(G_),objectTypes:U(h_,F().min(1).max(512))}).strict(),J_=W([`awaiting_signature`,`submitting`,`awaiting_chain_result`,`stopped`,`request_failed`,`outcome_unknown`,`completed`]),Y_=B({reviewSessionId:F().min(1),attemptId:F().min(1),planId:F().min(1),status:W([`success`,`failure`]),txDigest:g_,chainReceipt:q_,failureReason:G(`chain_execution_failed`).optional(),recordedAt:F().datetime()}).strict().superRefine((e,t)=>{(e.txDigest!==e.chainReceipt.txDigest||e.status===`success`!==e.chainReceipt.effectsStatus.success)&&t.addIssue({code:`custom`,message:`Execution must match the observed chain receipt.`}),e.status===`failure`!=(e.failureReason!==void 0)&&t.addIssue({code:`custom`,message:`Only a chain failure has a chain execution failure reason.`})}),X_=B({attemptId:F().min(1),reviewSessionId:F().min(1),planId:F().min(1),reviewRevision:I().int().nonnegative(),account:h_,transactionDigest:g_,requestStatus:J_,revision:I().int().nonnegative(),createdAt:F().datetime(),updatedAt:F().datetime(),signatureVerifiedAt:F().datetime().optional(),submittedAt:F().datetime().optional(),reason:F().optional(),execution:Y_.optional()}).strict().superRefine((e,t)=>{let n=e.execution;e.requestStatus===`completed`!=(n!==void 0)&&t.addIssue({code:`custom`,message:`Completed requests require an observed execution result.`}),n&&(n.attemptId!==e.attemptId||n.reviewSessionId!==e.reviewSessionId||n.planId!==e.planId||n.txDigest!==e.transactionDigest||n.chainReceipt.sender!==e.account)&&t.addIssue({code:`custom`,message:`Execution identity differs from the admitted request.`})}),Z_=F().uuid(),Q_=W([`process_start`,`sdk_start`,`session_restore`,`state_sync`]),$_=W([`initialization_failed`,`restoration_failed`,`wallet_state_unavailable`]),ev=hc(`status`,[B({status:G(`available`),walletRunId:Z_}).strict(),B({status:G(`initializing`),walletRunId:Z_,stage:Q_,message:F()}).strict(),B({status:G(`recovering`),walletRunId:Z_,message:F()}).strict(),B({status:G(`unavailable`),walletRunId:Z_.optional(),reason:$_,message:F()}).strict()]),tv=hc(`status`,[B({status:G(`idle`)}).strict(),B({status:G(`waiting`)}).strict(),B({status:G(`unavailable`),reason:G(`wallet_unavailable`),message:F()}).strict()]),nv=W([`awaiting_approval`,`connected`,`rejected`,`failed`,`expired`,`stopped`,`disconnected`]),rv=B({runId:F().uuid(),connections:z(B({connectionId:F().min(1),revision:I().int().nonnegative(),status:nv,chainResults:k_,walletName:F().optional(),sdkPending:L(),disconnectPending:L()}).strict()),preparations:z(B({id:F().min(1),revision:I().int().nonnegative(),review_revision:I().int().nonnegative(),preparation_id:F().nullable(),wallet_connection_id:F().nullable()}).strict()),requests:z(B({attempt_id:F().min(1),revision:I().int().nonnegative(),request_status:J_,can_submit:I().int().min(0).max(1),sdk_pending:I().int().min(0).max(1),submit_pending:I().int().min(0).max(1),lookup_pending:I().int().min(0).max(1)}).strict())}).strict(),iv=B({connectionId:F().min(1),status:nv,revision:I().int().nonnegative(),requestedChains:C_,chainResults:k_,approvedAt:F().datetime().optional(),grants:O_,grantRevisions:S_,lifecycleRevision:I().int().nonnegative(),createdAt:F().datetime(),updatedAt:F().datetime(),expiresAt:F().datetime(),walletName:F().optional(),reason:F().optional()}).strict().superRefine((e,t)=>{(e.chainResults.some(t=>!e.requestedChains.includes(t.chainId))||e.approvedAt&&e.chainResults.length!==e.requestedChains.length||!e.approvedAt&&e.chainResults.length)&&t.addIssue({code:`custom`,message:`Approval results must match the exact requested networks.`})}),av=B({chainId:x_,status:W([`available`,`multiple_accounts`,`not_approved`,`invalid_response`,`unavailable`]),address:F().optional(),suiSigningScopeApproved:L(),reason:F().optional()}).strict(),ov=`An unexpected wallet session is retained by the connection service. Remove it in your wallet app, then check status. Only one wallet connection can be used here.`,sv=hc(`status`,[B({status:G(`available`),account:F()}).strict(),B({status:G(`address_required`),reason:G(`read_address_cleared`).optional()}).strict()]),cv=[`connect`,`disconnect`,`stop_connection`,`prepare_review`,`request_signature`,`cancel`,`stop_waiting`,`read_result`],lv=[`none`,`wait`,`check_status`,`open_settings`,`request_disconnect`,`request_review`],uv=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),dv=new Uint32Array(64),fv=class extends f_{A=0;B=0;C=0;D=0;E=0;F=0;G=0;H=0;constructor(e,t){super(64,e,8,!1),this.A=t[0]|0,this.B=t[1]|0,this.C=t[2]|0,this.D=t[3]|0,this.E=t[4]|0,this.F=t[5]|0,this.G=t[6]|0,this.H=t[7]|0}get(){let{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}_cloneInto(e){return(e||=new this.constructor).set(...this.get()),this._cloneIntoMeta(e)}process(e,t){for(let n=0;n<16;n++,t+=4)dv[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=dv[e-15],n=dv[e-2],r=e_(t,7)^e_(t,18)^t>>>3,i=e_(n,17)^e_(n,19)^n>>>10;dv[e]=i+dv[e-7]+r+dv[e-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=e_(o,6)^e_(o,11)^e_(o,25),u=l+t+u_(o,s,c)+uv[e]+dv[e]|0,d=(e_(n,2)^e_(n,13)^e_(n,22))+d_(n,r,i)|0;l=c,c=s,s=o,o=a+u|0,a=i,i=r,r=n,n=u+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,a,o,s,c,l)}roundClean(){Qg(dv)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),Qg(this.buffer)}},pv=class extends fv{constructor(){super(32,p_)}},mv=a_(()=>new pv,o_(1));function hv(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=55296&&n<=56319){if(t+1>=e.length)return!1;let n=e.charCodeAt(++t);if(n<56320||n>57343)return!1}else if(n>=56320&&n<=57343)return!1}return!0}function gv(e){if(typeof e!=`string`)throw TypeError(`invalid mnemonic type: `+typeof e);if(!hv(e))throw TypeError(`expected well-formed Unicode string`);return e.normalize(`NFKD`)}function _v(e){let t=gv(e),n=t.split(` `);if(![12,15,18,21,24].includes(n.length))throw Error(`Invalid mnemonic`);return{nfkd:t,words:n}}function vv(e){if(qg(e),![16,20,24,28,32].includes(e.length))throw RangeError(`invalid entropy length`)}var yv=e=>{let t=8-e.length/4;return mv(e)[0]>>t<<t};function bv(e){if(!Array.isArray(e)||e.length!==2048||typeof e[0]!=`string`)throw TypeError(`Wordlist: expected array of 2048 strings`);e.forEach(e=>{if(typeof e!=`string`)throw TypeError(`wordlist: non-string element: `+e);if(!hv(e))throw TypeError(`wordlist: expected well-formed Unicode string`)})}function xv(e,t){bv(t);let n=e.length/3*4,r=new Uint8Array(n+1),i=0,a=0,o=0;for(let n of e){let e=t.indexOf(n);if(e===-1)throw Error(`Unknown word: `+n);for(i=i<<11|e,a+=11;a>=8;)a-=8,r[o++]=i>>>a&255;i&=(1<<a)-1}a>0&&(r[o]=i<<8-a);let s=r.subarray(0,n);if(r[n]!==yv(s))throw Error(`Invalid checksum`);return Uint8Array.from(s)}function Sv(e,t){let{words:n}=_v(e),r=xv(n,t);return vv(r),r}function Cv(e,t){try{Sv(e,t)}catch{return!1}return!0}var wv=Object.freeze(`abandon
1544
1544
  ability
1545
1545
  able
1546
1546
  about
@@ -3588,4 +3588,4 @@ zebra
3588
3588
  zero
3589
3589
  zone
3590
3590
  zoo`.split(`
3591
- `)),fv={0:`ED25519`,1:`Secp256k1`,2:`Secp256r1`,3:`MultiSig`,5:`ZkLogin`,6:`Passkey`},pv=e=>Object.freeze(e());function mv(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`&&`BYTES_PER_ELEMENT`in e&&e.BYTES_PER_ELEMENT===1}function hv(e){if(!mv(e))throw TypeError(`Uint8Array expected`)}function gv(e,t){return Array.isArray(t)?t.length===0?!0:e?t.every(e=>typeof e==`string`):t.every(e=>Number.isSafeInteger(e)):!1}function _v(e){if(typeof e!=`function`)throw TypeError(`function expected`);return!0}function vv(e,t){if(typeof t!=`string`)throw TypeError(`${e}: string expected`);return!0}function yv(e,t=`number`){if(typeof e!=`number`)throw TypeError(`${t}: expected number, got ${typeof e}`);if(!Number.isSafeInteger(e))throw RangeError(`${t}: expected safe integer, got ${e}`)}function bv(e,t){if(!gv(!1,t))throw TypeError(`${e}: array of numbers expected`)}var xv=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function Sv(e,t=e.length){let n=Array(t);for(let r=0;r<t;r++)n[r]=e[r];return n}var Cv=(()=>{try{let e=new TextDecoder;return e.decode(Uint8Array.of(65,48,43,127))===`A0+`?e:void 0}catch{return}})(),wv=8192;function Tv(e){let t=e.length;if(Cv!==void 0&&t>=12)return Cv.decode(e);if(t<=wv)return String.fromCharCode.apply(null,e);let n=``;for(let r=0;r<t;r+=wv)n+=String.fromCharCode.apply(null,e.subarray(r,r+wv));return n}function Ev(e){if(yv(e),e<=0||e>8)throw RangeError(`radix2: bits should be in (0..8]`);let t=xv[e]-1;return{encode:n=>{hv(n);let r=n.length,i=new Uint8Array(Math.ceil(r*8/e)),a=0,o=0,s=0;for(let c=0;c<r;)for(c+2<r?(a=a<<24|n[c]<<16|n[c+1]<<8|n[c+2],o+=24,c+=3):(a=(a<<8|n[c])&65535,o+=8,c++);o-=e,i[s++]=a>>o&t,!(o<e););return o>0&&(i[s]=a<<e-o&t),i},decode:t=>{let n=t.length,r=new Uint8Array(Math.floor(n*e/8)),i=0,a=0,o=0;for(let s=0;s<n;s++)for(i=(i<<e|t[s])&65535,a+=e;a>=8;a-=8)r[o++]=i>>a-8&255;if(i=i<<8-a&255,a>=e)throw Error(`Excess padding`);if(i>0)throw Error(`Non-zero padding: ${i}`);return r}}}function Dv(e,t){let n=e.length;if(n>128)throw Error(`alphabet: max 128 letters`);let r=new Uint8Array(n),i=new Int8Array(128).fill(-1);for(let t=0;t<n;t++){let n=e.charCodeAt(t);if(e.codePointAt(t)!==n||n>127)throw Error(`alphabet: single-char ASCII letters only`);r[t]=n,i[n]=t}if(t!==void 0)for(let e of Object.keys(t)){let n=e.charCodeAt(0),r=i[t[e].charCodeAt(0)];if(e.length!==1||n>127||r===void 0||r===-1)throw Error(`alphabet: invalid alias ${e}`);i[n]=r}return{encode:e=>{let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++){let i=e[n],a=r[i];if(a===void 0)throw Error(`alphabet.encode: invalid digit ${i}`);t[n]=a}return Tv(t)},decode:t=>{vv(`decode`,t);let n=t.length,r=new Uint8Array(n);for(let a=0;a<n;a++){let n=t.charCodeAt(a),o=n<128?i[n]:-1;if(o===-1)throw Error(`Unknown letter "${t[a]}". Allowed: ${e}`);r[a]=o}return r}}}function Ov(e){return _v(e),function(...t){try{return e.apply(null,t)}catch{}}}var kv=Dv(`qpzry9x8gf2tvdw0s3jn54khce6mua7l`),Av=/^[\x21-\x60\x7b-\x7e]+$/;function jv(e,t){for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);if(r<33||r>126)throw Error(`${e}: printable ASCII expected`)}}function Mv(e){let t=e.length,n=new Uint8Array(t);for(let r=0;r<t;r++){let t=e[r];if(t<0||t>=32)throw Error(`alphabet.encode: invalid digit ${t}`);n[r]=t}return n}var Nv=[996825010,642813549,513874426,1027748829,705979059];function Pv(e){let t=e>>25,n=(e&33554431)<<5;for(let e=0;e<Nv.length;e++)(t>>e&1)==1&&(n^=Nv[e]);return n}function Fv(e,t,n=1){let r=e.length,i=1;for(let t=0;t<r;t++){let n=e.charCodeAt(t);if(n<33||n>126)throw Error(`Invalid prefix (${e})`);i=Pv(i)^n>>5}i=Pv(i);for(let t=0;t<r;t++)i=Pv(i)^e.charCodeAt(t)&31;for(let e of t)i=Pv(i)^e;for(let e=0;e<6;e++)i=Pv(i);i^=n;let a=new Uint8Array(6);for(let e=0;e<6;e++)a[e]=i>>>5*(5-e)&31;return kv.encode(a)}function Iv(e){let t=e===`bech32`?1:734539939,n=Ev(5),r=e=>{hv(e);let t=e.length,n=Array(Math.ceil(t*8/5)),r=0,i=0,a=0;for(let o=0;o<t;o++)for(r=r<<8|e[o],i+=8;i>=5;i-=5)n[a++]=r>>i-5&31;return i>0&&(n[a]=r<<5-i&31),n},i=e=>{bv(`radix2.decode`,e);let t=e.length,r=new Uint8Array(t);for(let n=0;n<t;n++){let t=e[n];if(t<0||t>=32)throw Error(`convertRadix2: invalid word=${t}`);r[n]=t}return n.decode(r)},a=Ov(i);function o(e,n,r=90){vv(`bech32.encode prefix`,e),r!==!1&&yv(r,`limit`),mv(n)&&(n=Sv(n)),bv(`bech32.encode`,n);let i=e.length;if(i===0)throw TypeError(`Invalid prefix length ${i}`);let a=i+7+n.length;if(r!==!1&&a>r)throw TypeError(`Length ${a} exceeds limit ${r}`);jv(`bech32.encode prefix`,e);let o=e.toLowerCase(),s=Fv(o,n,t);return`${o}1${kv.encode(Mv(n))}${s}`}function s(e,n=90){vv(`bech32.decode input`,e),n!==!1&&yv(n,`limit`);let r=e.length;if(r<8||n!==!1&&r>n)throw TypeError(`invalid string length ${r}, expected (8..${n})`);let i=e.toLowerCase();if(e!==i&&!Av.test(e))throw jv(`bech32.decode input`,e),Error(`mixed-case string not allowed`);let a=i.lastIndexOf(`1`);if(a===0||a===-1)throw Error(`invalid separator "1"`);let o=i.slice(0,a),s=i.slice(a+1);if(s.length<6)throw Error(`invalid data length`);let c=kv.decode(s),l=Sv(c,c.length-6),u=Fv(o,l,t);if(!s.endsWith(u))throw Error(`Invalid checksum in ${e}`);return{prefix:o,words:l}}let c=Ov(s);function l(e,t=90){let{prefix:n,words:r}=s(e,t);return{prefix:n,words:r,bytes:i(r)}}function u(e,t){return o(e,r(t))}return{encode:o,decode:s,encodeFromBytes:u,decodeToBytes:l,decodeUnsafe:c,fromWords:i,fromWordsUnsafe:a,toWords:r}}var Lv=pv(()=>Iv(`bech32`));function Rv(e){let{prefix:t,words:n}=Lv.decode(e);if(t!==`suiprivkey`)throw Error(`invalid private key prefix`);let r=new Uint8Array(Lv.fromWords(n)),i=r.slice(1);return{scheme:fv[r[0]],secretKey:i}}var zv=`external-proposal-alpha-2026-05-25`,Bv=`proposal-review-model-alpha-2026-05-25`,Vv=F().refine(e=>{let t=new Date(e);return!Number.isNaN(t.getTime())&&t.toISOString()===e},`Expected ISO 8601 UTC timestamp`),Hv=/transaction\s*bytes?|transactionBytes|tx\s*bytes?|serialized\s*transaction|serializedTransaction|signed\s*transaction|signing\s*request|signingRequest|wallet\s*authorization|walletAuthorization|private\s*key|privateKey|secret\s*key|secretKey|seed\s*phrase|mnemonic|suiprivkey|signature|route[-_\s]*selected|routeSelectedPlan|bcs\s*transaction|programmable\s*transaction/i,Uv=/(?:0x[0-9a-fA-F]{160,}|[A-Za-z0-9+/_=-]{160,})/,Wv=/suiprivkey1[023456789acdefghjklmnpqrstuvwxyz]+/gi,Gv=/(^|[^0-9a-fA-F])(?:0x)?[0-9a-fA-F]{64}($|[^0-9a-fA-F])/,Kv=/(^|[^A-Za-z0-9+/_=-])(?:[A-Za-z0-9+/]{43}=|[A-Za-z0-9+/]{44}|[A-Za-z0-9_-]{43,44})($|[^A-Za-z0-9+/_=-])/,qv=/^(?:0|[1-9][0-9]*)(?:\.[0-9]+)?$/,Jv=[12,15,18,21,24];function Yv(e,t,n={}){return F().min(1).max(e).superRefine((e,r)=>{(Hv.test(e)||Uv.test(e)||Zv(e)||Qv(e)||!n.allowRawSecretLikeText&&$v(e))&&r.addIssue({code:`custom`,message:`${t} must not contain executable, signing, private-key, mnemonic, route-selected, or encoded secret-like material`})})}function Xv(e,t){return Yv(e,t,{allowRawSecretLikeText:!0})}function Zv(e){return(e.match(Wv)??[]).some(e=>{try{return Rv(e.toLowerCase()),!0}catch{return e.toLowerCase().startsWith(`suiprivkey1`)}})}function Qv(e){let t=e.normalize(`NFKD`).toLowerCase().replace(/[^a-z]+/g,` `).trim().split(/\s+/).filter(Boolean);for(let e of Jv)if(!(t.length<e)){for(let n=0;n<=t.length-e;n+=1)if(uv(t.slice(n,n+e).join(` `),dv))return!0}return!1}function $v(e){return Gv.test(e)||Kv.test(e)}var ey=Yv(80,`amountDisplay`).refine(e=>qv.test(e)&&/[1-9]/.test(e),{message:`Expected a positive decimal display amount`}),ty=B({kind:W([`mcp_server`,`ai_client`,`user`,`other`]),name:Yv(120,`source.name`),reference:Yv(256,`source.reference`).optional()}).strict(),ny=B({address:h_.optional(),label:Yv(120,`party.label`).optional()}).strict().refine(e=>e.address!==void 0||e.label!==void 0,{message:`Expected address or label`}),ry=B({amountDisplay:ey,amountKind:G(`display_proposal`).default(`display_proposal`),symbol:Yv(64,`amount.symbol`).optional(),coinType:Xv(512,`amount.coinType`).optional(),denomination:Yv(64,`amount.denomination`).optional()}).strict(),iy=B({packageId:Xv(128,`action.target.packageId`).optional(),module:Yv(128,`action.target.module`).optional(),function:Yv(128,`action.target.function`).optional(),objectId:Xv(128,`action.target.objectId`).optional(),label:Yv(120,`action.target.label`).optional()}).strict().refine(e=>e.packageId!==void 0||e.module!==void 0||e.function!==void 0||e.objectId!==void 0||e.label!==void 0,{message:`Expected at least one action target field`}),ay=B({direction:W([`outgoing`,`expected_incoming`,`fee`]),amount:ry,recipient:ny.optional(),description:Yv(512,`assetFlow.description`).optional()}).strict(),oy=B({id:Yv(120,`proposal.id`),source:ty,network:G(`sui:mainnet`),createdAt:Vv,expiresAt:Vv.optional(),purpose:Yv(512,`purpose`),assumptions:z(Yv(512,`assumptions[]`)).max(20).optional(),requiredUserChoices:z(Yv(512,`requiredUserChoices[]`)).max(20).optional()}).strict(),sy=hc(`type`,[oy.extend({type:G(`payment`),payment:B({amount:ry,recipient:ny,target:Yv(512,`payment.target`).optional()}).strict()}).strict(),oy.extend({type:G(`sui_action`),action:B({actionKind:Yv(120,`action.actionKind`),target:iy,recipient:ny.optional(),assetFlow:z(ay).max(20).optional()}).strict()}).strict()]),cy=B({id:F(),label:F(),status:W([`pass`,`warning`,`fail`]),message:F(),source:W([`proposal`,`adapter`,`registry`,`quote`,`wallet`,`simulation`,`network`])}).strict(),ly=B({id:F(),label:F(),reason:F()}).strict(),uy=B({modelVersion:G(Bv),contractVersion:G(zv),proposalId:F(),proposalType:W([`payment`,`sui_action`]),proposalSource:ty,proposedAction:B({kind:W([`payment`,`sui_action`]),title:F(),purpose:F(),network:G(`sui:mainnet`),recipient:ny.optional(),target:H([F(),iy]).optional()}).strict(),assetFlow:B({outgoing:z(ry),expectedIncoming:z(ry),fees:z(ry)}).strict(),recipients:z(ny),targets:z(H([F(),iy])),evidenceUsed:z(B({id:F(),label:F(),source:W([`external_proposal`,`local_schema`]),summary:F()}).strict()),missingEvidence:z(ly),requiredUserChoices:z(ly),unsupportedClaims:z(B({id:F(),label:F(),reason:F()}).strict()),rejectedExecutableFields:z(B({fieldName:F(),reason:F()}).strict()),freshness:B({proposalCreatedAt:Vv,proposalExpiresAt:Vv.optional(),evaluatedAt:Vv,status:W([`current`,`expired`,`created_in_future`,`expiry_not_provided`]),reason:F()}).strict(),blockingChecks:z(cy),nonSignableReason:B({code:G(`external_proposal_review_only`),message:F(),blockedCapabilities:z(F())}).strict()}).strict();B({requestedIntent:sy,implementationStatus:G(`read_only_review_only`),contractVersion:G(zv)}).strict();var dy=[`adapter_not_implemented`,`producer_stage_missing`,`wallet_review_contract_emit_missing`,`network_mismatch`,`insufficient_balance`,`insufficient_gas`,`allowlist_violation`,`asset_mismatch`,`amount_mismatch`,`wallet_mismatch`,`unsupported_action`,`object_resolution_failed`,`proposal_review_only`],fy=[`review_evidence_stale`,`quote_stale`,`quote_unavailable`,`simulation_transient_failure`,`review_update_failed`,`wallet_connection_changed`],py=[`proposed`,`awaiting_wallet`,`wallet_connected`,`ready_for_wallet_review`,`refresh_required`,`blocked`,`expired`],my=[`humanReadableReview`,`simulation`,`transactionReviewData`,`ptbVisualization`,`assetFlowActual`,`beforeAfterBalance`],hy=W([`client.core.simulateTransaction`,`client.transactionExecutionService.simulateTransaction`]),gy=`ptb-visualization-contract-alpha-2026-05-25`,_y=[`proposedAction`,`assetFlow`,`recipients`,`targets`,`evidenceUsed`,`missingEvidence`,`requiredUserChoices`,`unsupportedClaims`,`freshness`,`blockingChecks`],vy=[`effects`,`balanceChanges`,`objectTypes`,`transaction`],yy=[`transaction_bytes`,`serialized_transaction`,`wallet_signature_request`,`private_key_material`,`wallet_authorization`,`signing_data`,`signing_readiness`,`payment_execution_readiness`],by=[`transaction_building_input`,`wallet_authorization`,`signing_data`,`signing_readiness`,`payment_execution_readiness`,`route_recommendation`],xy=m_,Sy=`MIST`,Cy=[`checkedAt`,`expiresAt`],wy=[`checkedAt`,`expiryStatus`],Ty=[`rawAmount`,`asset`,`amountRole`],Ey=[`minOutRaw`,`asset`,`amountRole`],Dy=[`gasBudgetRaw`,`asset`,`amountRole`],Oy=[`gasUsedRaw`,`asset`,`amountRole`],ky=[`checkedAt`,`gasResolutionStatus`,`unresolvedReason`],Ay=[`balanceChanges`,`asset`,`amountRole`],jy=[`coinType`,`decimals`],My=[`quoteEvidenceId`,`minOutRaw`],Ny=[`maxSlippageBps`,`userSelection`],Py=[`maxSlippageBps`,`minOutRaw`],Fy=[`ownerAccount`,`objects`],Iy=[`pinned_sdk_registry`,`verified_mainnet_onchain_metadata`,`wallet_account_read`,`quote_evidence`,`review_time_simulation`,`validated_request_fact`,`user_explicit_choice`],Ly=[`input`,`expected_output`,`minimum_output`,`gas_budget`,`gas_used`,`fee`,`balance_delta`],Ry={input:{kinds:[`validated_request_fact`,`wallet_account_read`,`user_explicit_choice`],fields:Ty},expected_output:{kinds:[`quote_evidence`,`review_time_simulation`],fields:Ty},minimum_output:{kinds:[`quote_evidence`],fields:Ey},gas_budget:{kinds:[`review_time_simulation`],fields:Dy},gas_used:{kinds:[`review_time_simulation`],fields:Oy},fee:{kinds:[`review_time_simulation`],fields:Ty},balance_delta:{kinds:[`review_time_simulation`],fields:Ay}},zy={pinned_sdk_metadata:{kinds:[`pinned_sdk_registry`],fields:jy},verified_mainnet_onchain_metadata:{kinds:[`verified_mainnet_onchain_metadata`],fields:jy}},By={user_explicit:{kinds:[`user_explicit_choice`],fields:Ny},adapter_policy_from_quote_evidence:{kinds:[`quote_evidence`],fields:Py}},Vy={kinds:[`review_time_simulation`],fields:ky},Hy={kinds:[`quote_evidence`],fields:My},Uy={kinds:[`validated_request_fact`],fields:Cy},Wy={kinds:[`validated_request_fact`],fields:wy},Gy={raw_quantity_amount:{byRole:Ry},unit_metadata:{bySource:zy},gas_unresolved_status:Vy,expiry_status:{current:Uy,expired:Uy,not_provided:Wy,not_applicable:Wy},quote_min_out:Hy,slippage_policy:{bySource:By},object_ownership:{kinds:[`wallet_account_read`],fields:Fy},simulation_result:{kinds:[`review_time_simulation`],fields:vy}},Ky={gasBudgetClaimId:{factKind:`raw_quantity_amount`,role:`gas_budget`,assetCoinType:xy,rawUnit:Sy},gasUsedClaimId:{factKind:`raw_quantity_amount`,role:`gas_used`,assetCoinType:xy,rawUnit:Sy},gasObjectOwnershipClaimId:{factKind:`object_ownership`,ownership:`owned_by_account`}},qy=F().refine(e=>{let t=new Date(e);return!Number.isNaN(t.getTime())&&t.toISOString()===e},`Expected ISO 8601 UTC timestamp`),Jy=C_(`unsigned integer`),Yy=F().regex(/^0x[0-9a-fA-F]{1,64}$/,{message:`Expected a Sui object id`}),Xy=F().min(1).max(512).refine(e=>{try{return E_(e)===e}catch{return!1}},`Expected a normalized Sui struct tag coin type`),X=F().min(1).max(120),Zy=B({symbol:F().min(1).max(64).optional(),coinType:Xy}).strict(),Qy=/transaction\s*bytes?|tx\s*bytes?|serialized\s*transaction|serializedTransaction|signed\s*transaction|signing\s*request|signingRequest|wallet\s*authorization|walletAuthorization|private\s*key|privateKey|secret\s*key|secretKey|seed\s*phrase|mnemonic|suiprivkey|signature|bcs\s*transaction/i,$y=/(?:0x[0-9a-fA-F]{160,}|[A-Za-z0-9+/_=-]{160,})/;function eb(e,t){return F().min(1).max(e).superRefine((e,n)=>{(Qy.test(e)||$y.test(e))&&n.addIssue({code:`custom`,message:`${t} must not contain executable transaction, signing, private-key, mnemonic, or long encoded material`})})}function tb(e,t){let n=new Set(e);return t.filter(e=>!n.has(e))}function nb(e,t,n,r,i){let a=tb(t,n);a.length!==0&&e.addIssue({code:`custom`,path:r,message:`${i} must include ${a.join(`, `)}`})}function rb(e,t,n,r,i){nb(e,t,n,r,i)}function ib(e,t,n){e.addIssue({code:`custom`,path:t,message:`${n} must match referenced evidence claim`})}function Z(e,t,n,r,i){t!==n&&ib(e,r,i)}function ab(e,t,n,r,i){let a=new Set(t),o=new Set(n);if(a.size!==o.size)ib(e,r,i);else for(let t of a)if(!o.has(t)){ib(e,r,i);return}}function ob(e,t,n,r,i){(t.symbol!==n.symbol||t.coinType!==n.coinType)&&ib(e,r,i)}function sb(e,t,n,r,i){try{E_(t.coinType)!==n&&ib(e,r,i)}catch{ib(e,r,i)}}var cb=B({kind:W([`natural_language_intent`,`external_proposal`,`mcp_action_request`,`local_review_request`]),sourceId:F().min(1).max(160),capturedAt:qy,authority:G(`untrusted_until_review_regenerates_and_verifies`),userSelectionSource:W([`user_explicit`,`prior_user_explicit_context`]).optional()}).strict(),lb=B({id:X,kind:W(Iy),network:G(`sui:mainnet`),source:F().min(1).max(240),verifiedAt:qy,fields:z(F().min(1).max(120)).min(1)}).strict(),ub=hc(`factKind`,[B({id:X,factKind:G(`raw_quantity_amount`),sourceEvidenceId:X,role:W(Ly),asset:Zy,rawAmount:Jy}).strict(),B({id:X,factKind:G(`unit_metadata`),sourceEvidenceId:X,source:W([`pinned_sdk_metadata`,`verified_mainnet_onchain_metadata`]),coinType:Xy,decimals:I().int().min(0).max(255)}).strict(),B({id:X,factKind:G(`gas_unresolved_status`),sourceEvidenceId:X,checkedAt:qy,status:G(`unresolved`),reason:F().min(1).max(240)}).strict(),B({id:X,factKind:G(`expiry_status`),sourceEvidenceId:X,checkedAt:qy,status:W([`current`,`expired`,`not_provided`,`not_applicable`]),expiresAt:qy.optional(),reason:F().min(1).max(240).optional()}).strict(),B({id:X,factKind:G(`quote_min_out`),sourceEvidenceId:X,quoteEvidenceId:F().min(1).max(120),minOutRaw:Jy}).strict(),B({id:X,factKind:G(`slippage_policy`),sourceEvidenceId:X,policySource:W([`user_explicit`,`adapter_policy_from_quote_evidence`]),maxSlippageBps:I().int().min(0).max(1e4),minOutRaw:Jy.optional()}).strict(),B({id:X,factKind:G(`object_ownership`),sourceEvidenceId:X,objectId:Yy,ownerAccount:h_,ownership:W([`owned_by_account`,`shared_object`,`immutable_or_package`,`not_owned_by_account`])}).strict(),B({id:X,factKind:G(`simulation_result`),sourceEvidenceId:X,provider:hy,checksEnabled:G(!0),simulatedAt:qy,status:W([`success`,`failed`,`unavailable`]),requiredFields:z(W(vy)).min(vy.length),missingFields:z(W(vy)).default([]),failureReason:F().min(1).max(240).optional()}).strict()]),db=B({id:X,role:W(Ly),asset:Zy,rawAmount:Jy,unit:B({decimals:I().int().min(0).max(255),source:W([`pinned_sdk_metadata`,`verified_mainnet_onchain_metadata`]),sourceField:F().min(1).max(160),unitClaimId:X}).strict(),amountClaimId:X,displayOnly:B({amountDisplay:F().min(1).max(120),reason:G(`presentation_only_not_signing_input`)}).strict().optional()}).strict(),fb=B({objectId:Yy,ownerAccount:h_,ownershipClaimId:X}).strict(),pb=B({source:G(`review_time_simulation`),checkedAt:qy,gasBudgetRaw:Jy.optional(),gasBudgetClaimId:X.optional(),gasUsedRaw:Jy.optional(),gasUsedClaimId:X.optional(),gasObjects:z(fb).optional(),unresolvedReason:F().min(1).max(240).optional(),unresolvedClaimId:X.optional()}).strict().superRefine((e,t)=>{let n=e.gasBudgetRaw!==void 0||e.gasUsedRaw!==void 0;!n&&e.unresolvedReason===void 0&&t.addIssue({code:`custom`,message:`Expected gas evidence or unresolvedReason`}),n&&e.unresolvedReason!==void 0&&t.addIssue({code:`custom`,path:[`unresolvedReason`],message:`Resolved gas quantities must not include unresolvedReason`}),e.gasBudgetRaw!==void 0&&e.gasBudgetClaimId===void 0&&t.addIssue({code:`custom`,path:[`gasBudgetClaimId`],message:`gasBudgetRaw requires gasBudgetClaimId`}),e.gasBudgetRaw===void 0&&e.gasBudgetClaimId!==void 0&&t.addIssue({code:`custom`,path:[`gasBudgetClaimId`],message:`gasBudgetClaimId requires gasBudgetRaw`}),e.gasUsedRaw!==void 0&&e.gasUsedClaimId===void 0&&t.addIssue({code:`custom`,path:[`gasUsedClaimId`],message:`gasUsedRaw requires gasUsedClaimId`}),e.gasUsedRaw===void 0&&e.gasUsedClaimId!==void 0&&t.addIssue({code:`custom`,path:[`gasUsedClaimId`],message:`gasUsedClaimId requires gasUsedRaw`}),e.unresolvedReason!==void 0&&e.unresolvedClaimId===void 0&&t.addIssue({code:`custom`,path:[`unresolvedClaimId`],message:`unresolvedReason requires unresolvedClaimId`}),e.unresolvedReason===void 0&&e.unresolvedClaimId!==void 0&&t.addIssue({code:`custom`,path:[`unresolvedClaimId`],message:`unresolvedClaimId requires unresolvedReason`})}),mb=hc(`status`,[B({checkedAt:qy,status:G(`current`),expiresAt:qy,evidenceClaimId:X}).strict(),B({checkedAt:qy,status:G(`expired`),expiresAt:qy,evidenceClaimId:X}).strict(),B({checkedAt:qy,status:G(`not_provided`),evidenceClaimId:X,reason:F().min(1).max(240),expiresAt:uc().optional()}).strict(),B({checkedAt:qy,status:G(`not_applicable`),evidenceClaimId:X,reason:F().min(1).max(240),expiresAt:uc().optional()}).strict()]).superRefine((e,t)=>{e.status===`current`&&Date.parse(e.expiresAt)<=Date.parse(e.checkedAt)&&t.addIssue({code:`custom`,path:[`expiresAt`],message:`Current expiry evidence requires expiresAt after checkedAt`}),e.status===`expired`&&Date.parse(e.expiresAt)>Date.parse(e.checkedAt)&&t.addIssue({code:`custom`,path:[`expiresAt`],message:`Expired expiry evidence requires expiresAt at or before checkedAt`})}),hb=B({status:W([`required_and_verified`,`not_required_for_action`,`missing`,`stale`]),quoteEvidenceId:F().min(1).max(120).optional(),quoteEvidenceClaimId:X.optional(),maxSlippageBps:I().int().min(0).max(1e4).optional(),minOutRaw:Jy.optional(),policySource:W([`user_explicit`,`adapter_policy_from_quote_evidence`]).optional(),policyEvidenceClaimId:X.optional()}).strict().superRefine((e,t)=>{e.status===`required_and_verified`&&(e.quoteEvidenceId===void 0||e.quoteEvidenceClaimId===void 0||e.maxSlippageBps===void 0||e.minOutRaw===void 0||e.policySource===void 0||e.policyEvidenceClaimId===void 0)&&t.addIssue({code:`custom`,message:`Verified min-out evidence requires quoteEvidenceId, quoteEvidenceClaimId, maxSlippageBps, minOutRaw, policySource, and policyEvidenceClaimId`}),e.quoteEvidenceId!==void 0&&e.quoteEvidenceClaimId===void 0&&t.addIssue({code:`custom`,path:[`quoteEvidenceClaimId`],message:`quoteEvidenceId requires quoteEvidenceClaimId`}),e.quoteEvidenceId===void 0&&e.quoteEvidenceClaimId!==void 0&&t.addIssue({code:`custom`,path:[`quoteEvidenceClaimId`],message:`quoteEvidenceClaimId requires quoteEvidenceId`}),e.minOutRaw!==void 0&&e.quoteEvidenceClaimId===void 0&&t.addIssue({code:`custom`,path:[`quoteEvidenceClaimId`],message:`minOutRaw requires quoteEvidenceClaimId`}),e.maxSlippageBps!==void 0&&e.policySource===void 0&&t.addIssue({code:`custom`,path:[`policySource`],message:`maxSlippageBps requires policySource`}),e.policySource!==void 0&&e.policyEvidenceClaimId===void 0&&t.addIssue({code:`custom`,path:[`policyEvidenceClaimId`],message:`policySource requires policyEvidenceClaimId`}),e.policySource===void 0&&e.policyEvidenceClaimId!==void 0&&t.addIssue({code:`custom`,path:[`policyEvidenceClaimId`],message:`policyEvidenceClaimId requires policySource`})}),gb=B({checkedAt:qy,ownerAccount:h_,objects:z(B({objectId:Yy,role:W([`input_coin`,`gas_coin`,`protocol_object`,`shared_object`,`receiving_object`]),ownership:W([`owned_by_account`,`shared_object`,`immutable_or_package`,`not_owned_by_account`]),evidenceClaimId:X}).strict()).min(1)}).strict(),_b=B({evidenceClaimId:X,transactionDigest:g_,provider:hy,checksEnabled:G(!0),simulatedAt:qy,status:W([`success`,`failed`,`unavailable`]),requiredFields:z(W(vy)).min(vy.length),missingFields:z(W(vy)).default([]),failureReason:F().min(1).max(240).optional()}).strict().refine(e=>e.status!==`success`||e.missingFields.length===0,{message:`Successful simulation evidence must not have missing required fields`}).refine(e=>vy.every(t=>e.requiredFields.includes(t)),{message:`Simulation evidence must include every required simulation field`}).refine(e=>e.status===`success`||e.failureReason!==void 0,{message:`Failed or unavailable simulation evidence requires failureReason`}).refine(e=>e.status!==`success`||e.failureReason===void 0,{message:`Successful simulation evidence must not include failureReason`}),vb=B({fields:z(W(_y)).min(_y.length),transactionDigest:g_,source:G(`review_model_or_adapter_equivalent`),purpose:G(`human_review_before_wallet_authorization`)}).strict().refine(e=>_y.every(t=>e.fields.includes(t)),{message:`Human-readable review fields must include every required review field`}),yb=B({runtimeStatus:G(`emitted_pre_handoff`),mcpAndReviewUiMayExpose:z(W([`human_readable_review`,`ptb_visualization_artifact`,`diagnostics`,`status_checks`])).min(1),prohibited:z(W(yy)).min(1)}).strict().superRefine((e,t)=>{rb(t,e.prohibited,yy,[`prohibited`],`prohibited`)}),bb=B({schemaVersion:G(1),adapterId:F().min(1).max(120),protocol:F().min(1).max(120),actionKind:F().min(1).max(120),network:G(`sui:mainnet`),inputProvenance:cb,sourceReferences:z(lb).min(1),evidenceClaims:z(ub).min(1),rawQuantities:z(db).min(1),gas:pb,expiry:mb,slippageOrMinOut:hb,objectOwnership:gb,simulation:_b,humanReadableReview:vb,outputBoundary:yb,reviewedTransactionDigest:g_}).strict().superRefine((e,t)=>{let n=new Set,r=new Map,i=new Map;e.sourceReferences.forEach((e,a)=>{n.has(e.id)&&t.addIssue({code:`custom`,path:[`sourceReferences`,a,`id`],message:`sourceReferences id must be unique: ${e.id}`}),n.add(e.id),r.has(e.id)||(r.set(e.id,e),i.set(e.id,a))});let a=new Set,o=new Map,s=new Map;e.evidenceClaims.forEach((e,n)=>{a.has(e.id)&&t.addIssue({code:`custom`,path:[`evidenceClaims`,n,`id`],message:`evidenceClaims id must be unique: ${e.id}`}),a.add(e.id),o.has(e.id)||(o.set(e.id,e),s.set(e.id,n))});let c=(e,n)=>{if(e===void 0)return;let i=r.get(e);if(i!==void 0)return i;t.addIssue({code:`custom`,path:n,message:`source evidence id must reference sourceReferences[].id: ${e}`})},l=(e,n,r,a)=>{if(e===void 0)return;let o=c(e,r);if(o===void 0)return;let s=i.get(e),l=s===void 0?r:[`sourceReferences`,s];n.kinds.includes(o.kind)||t.addIssue({code:`custom`,path:[...l,`kind`],message:`${a} source kind must be one of ${n.kinds.join(`, `)}`}),nb(t,o.fields,n.fields,[...l,`fields`],`${a} sourceReferences fields`)},u=(e,n,r,i)=>{if(e===void 0){t.addIssue({code:`custom`,path:r,message:`${i} must reference evidenceClaims[].id`});return}let a=o.get(e);if(a===void 0)t.addIssue({code:`custom`,path:r,message:`${i} must reference evidenceClaims[].id: ${e}`});else{if(a.factKind!==n){let a=s.get(e),o=a===void 0?r:[`evidenceClaims`,a,`factKind`];t.addIssue({code:`custom`,path:o,message:`${i} evidence claim factKind must be ${n}`})}return a}};if(e.evidenceClaims.forEach((e,n)=>{e.factKind===`raw_quantity_amount`&&l(e.sourceEvidenceId,Gy.raw_quantity_amount.byRole[e.role],[`evidenceClaims`,n,`sourceEvidenceId`],`evidenceClaims[${n}].raw_quantity_amount`),e.factKind===`unit_metadata`&&l(e.sourceEvidenceId,Gy.unit_metadata.bySource[e.source],[`evidenceClaims`,n,`sourceEvidenceId`],`evidenceClaims[${n}].unit_metadata`),e.factKind===`gas_unresolved_status`&&l(e.sourceEvidenceId,Gy.gas_unresolved_status,[`evidenceClaims`,n,`sourceEvidenceId`],`evidenceClaims[${n}].gas_unresolved_status`),e.factKind===`expiry_status`&&(l(e.sourceEvidenceId,Gy.expiry_status[e.status],[`evidenceClaims`,n,`sourceEvidenceId`],`evidenceClaims[${n}].expiry_status`),(e.status===`current`||e.status===`expired`)&&e.expiresAt===void 0&&t.addIssue({code:`custom`,path:[`evidenceClaims`,n,`expiresAt`],message:`Current or expired expiry claim requires expiresAt`}),(e.status===`not_provided`||e.status===`not_applicable`)&&e.reason===void 0&&t.addIssue({code:`custom`,path:[`evidenceClaims`,n,`reason`],message:`Unavailable expiry claim requires reason`}),(e.status===`not_provided`||e.status===`not_applicable`)&&e.expiresAt!==void 0&&t.addIssue({code:`custom`,path:[`evidenceClaims`,n,`expiresAt`],message:`Unavailable expiry claim must not include expiresAt`}),e.status===`current`&&e.expiresAt!==void 0&&Date.parse(e.expiresAt)<=Date.parse(e.checkedAt)&&t.addIssue({code:`custom`,path:[`evidenceClaims`,n,`expiresAt`],message:`Current expiry claim requires expiresAt after checkedAt`}),e.status===`expired`&&e.expiresAt!==void 0&&Date.parse(e.expiresAt)>Date.parse(e.checkedAt)&&t.addIssue({code:`custom`,path:[`evidenceClaims`,n,`expiresAt`],message:`Expired expiry claim requires expiresAt at or before checkedAt`})),e.factKind===`quote_min_out`&&l(e.sourceEvidenceId,Gy.quote_min_out,[`evidenceClaims`,n,`sourceEvidenceId`],`evidenceClaims[${n}].quote_min_out`),e.factKind===`slippage_policy`&&(l(e.sourceEvidenceId,Gy.slippage_policy.bySource[e.policySource],[`evidenceClaims`,n,`sourceEvidenceId`],`evidenceClaims[${n}].slippage_policy`),e.policySource===`adapter_policy_from_quote_evidence`&&e.minOutRaw===void 0&&t.addIssue({code:`custom`,path:[`evidenceClaims`,n,`minOutRaw`],message:`Adapter-derived slippage policy claim requires minOutRaw`})),e.factKind===`object_ownership`&&l(e.sourceEvidenceId,Gy.object_ownership,[`evidenceClaims`,n,`sourceEvidenceId`],`evidenceClaims[${n}].object_ownership`),e.factKind===`simulation_result`&&(l(e.sourceEvidenceId,Gy.simulation_result,[`evidenceClaims`,n,`sourceEvidenceId`],`evidenceClaims[${n}].simulation_result`),e.status===`success`&&e.missingFields.length!==0&&t.addIssue({code:`custom`,path:[`evidenceClaims`,n,`missingFields`],message:`Successful simulation claim must not have missing required fields`}),vy.every(t=>e.requiredFields.includes(t))||t.addIssue({code:`custom`,path:[`evidenceClaims`,n,`requiredFields`],message:`Simulation claim must include every required simulation field`}),e.status!==`success`&&e.failureReason===void 0&&t.addIssue({code:`custom`,path:[`evidenceClaims`,n,`failureReason`],message:`Failed or unavailable simulation claim requires failureReason`}),e.status===`success`&&e.failureReason!==void 0&&t.addIssue({code:`custom`,path:[`evidenceClaims`,n,`failureReason`],message:`Successful simulation claim must not include failureReason`}))}),e.rawQuantities.forEach((e,n)=>{let r=u(e.amountClaimId,`raw_quantity_amount`,[`rawQuantities`,n,`amountClaimId`],`rawQuantities[${n}].amountClaimId`);r?.factKind===`raw_quantity_amount`&&(Z(t,e.role,r.role,[`rawQuantities`,n,`role`],`rawQuantities[${n}].role`),Z(t,e.rawAmount,r.rawAmount,[`rawQuantities`,n,`rawAmount`],`rawQuantities[${n}].rawAmount`),ob(t,e.asset,r.asset,[`rawQuantities`,n,`asset`],`rawQuantities[${n}].asset`));let i=u(e.unit.unitClaimId,`unit_metadata`,[`rawQuantities`,n,`unit`,`unitClaimId`],`rawQuantities[${n}].unit.unitClaimId`);i?.factKind===`unit_metadata`&&(Z(t,e.unit.source,i.source,[`rawQuantities`,n,`unit`,`source`],`rawQuantities[${n}].unit.source`),Z(t,e.unit.decimals,i.decimals,[`rawQuantities`,n,`unit`,`decimals`],`rawQuantities[${n}].unit.decimals`),e.asset.coinType!==void 0&&Z(t,e.asset.coinType,i.coinType,[`rawQuantities`,n,`asset`,`coinType`],`rawQuantities[${n}].asset.coinType`))}),e.gas.gasBudgetRaw!==void 0){let n=u(e.gas.gasBudgetClaimId,`raw_quantity_amount`,[`gas`,`gasBudgetClaimId`],`gas.gasBudgetClaimId`);n?.factKind===`raw_quantity_amount`&&(Z(t,n.role,Ky.gasBudgetClaimId.role,[`gas`,`gasBudgetClaimId`],`gas.gasBudgetClaimId role`),sb(t,n.asset,Ky.gasBudgetClaimId.assetCoinType,[`gas`,`gasBudgetClaimId`],`gas.gasBudgetClaimId asset`),Z(t,e.gas.gasBudgetRaw,n.rawAmount,[`gas`,`gasBudgetRaw`],`gas.gasBudgetRaw`))}if(e.gas.gasUsedRaw!==void 0){let n=u(e.gas.gasUsedClaimId,`raw_quantity_amount`,[`gas`,`gasUsedClaimId`],`gas.gasUsedClaimId`);n?.factKind===`raw_quantity_amount`&&(Z(t,n.role,Ky.gasUsedClaimId.role,[`gas`,`gasUsedClaimId`],`gas.gasUsedClaimId role`),sb(t,n.asset,Ky.gasUsedClaimId.assetCoinType,[`gas`,`gasUsedClaimId`],`gas.gasUsedClaimId asset`),Z(t,e.gas.gasUsedRaw,n.rawAmount,[`gas`,`gasUsedRaw`],`gas.gasUsedRaw`))}if(e.gas.unresolvedReason!==void 0){let n=u(e.gas.unresolvedClaimId,`gas_unresolved_status`,[`gas`,`unresolvedClaimId`],`gas.unresolvedClaimId`);n?.factKind===`gas_unresolved_status`&&(Z(t,n.status,`unresolved`,[`gas`,`unresolvedClaimId`],`gas.unresolvedClaimId status`),Z(t,e.gas.checkedAt,n.checkedAt,[`gas`,`checkedAt`],`gas.checkedAt`),Z(t,e.gas.unresolvedReason,n.reason,[`gas`,`unresolvedReason`],`gas.unresolvedReason`))}e.gas.gasObjects?.forEach((e,n)=>{let r=u(e.ownershipClaimId,`object_ownership`,[`gas`,`gasObjects`,n,`ownershipClaimId`],`gas.gasObjects[${n}].ownershipClaimId`);r?.factKind===`object_ownership`&&(Z(t,e.objectId,r.objectId,[`gas`,`gasObjects`,n,`objectId`],`gas.gasObjects[${n}].objectId`),Z(t,e.ownerAccount,r.ownerAccount,[`gas`,`gasObjects`,n,`ownerAccount`],`gas.gasObjects[${n}].ownerAccount`),Z(t,r.ownership,Ky.gasObjectOwnershipClaimId.ownership,[`gas`,`gasObjects`,n,`ownershipClaimId`],`gas.gasObjects[${n}].ownershipClaimId ownership`))});let d=u(e.expiry.evidenceClaimId,`expiry_status`,[`expiry`,`evidenceClaimId`],`expiry.evidenceClaimId`);if(d?.factKind===`expiry_status`&&(Z(t,e.expiry.status,d.status,[`expiry`,`status`],`expiry.status`),Z(t,e.expiry.checkedAt,d.checkedAt,[`expiry`,`checkedAt`],`expiry.checkedAt`),e.expiry.status===`current`||e.expiry.status===`expired`?Z(t,e.expiry.expiresAt,d.expiresAt,[`expiry`,`expiresAt`],`expiry.expiresAt`):Z(t,e.expiry.reason,d.reason,[`expiry`,`reason`],`expiry.reason`)),e.slippageOrMinOut.quoteEvidenceClaimId!==void 0){let n=u(e.slippageOrMinOut.quoteEvidenceClaimId,`quote_min_out`,[`slippageOrMinOut`,`quoteEvidenceClaimId`],`slippageOrMinOut.quoteEvidenceClaimId`);n?.factKind===`quote_min_out`&&(Z(t,e.slippageOrMinOut.quoteEvidenceId,n.quoteEvidenceId,[`slippageOrMinOut`,`quoteEvidenceId`],`slippageOrMinOut.quoteEvidenceId`),Z(t,e.slippageOrMinOut.minOutRaw,n.minOutRaw,[`slippageOrMinOut`,`minOutRaw`],`slippageOrMinOut.minOutRaw`))}if(e.slippageOrMinOut.minOutRaw!==void 0&&(e.rawQuantities.some(t=>t.role===`minimum_output`&&t.rawAmount===e.slippageOrMinOut.minOutRaw)||t.addIssue({code:`custom`,path:[`slippageOrMinOut`,`minOutRaw`],message:`slippageOrMinOut.minOutRaw must match a minimum_output rawQuantities entry`})),e.slippageOrMinOut.policyEvidenceClaimId!==void 0){let n=u(e.slippageOrMinOut.policyEvidenceClaimId,`slippage_policy`,[`slippageOrMinOut`,`policyEvidenceClaimId`],`slippageOrMinOut.policyEvidenceClaimId`);n?.factKind===`slippage_policy`&&(Z(t,e.slippageOrMinOut.policySource,n.policySource,[`slippageOrMinOut`,`policySource`],`slippageOrMinOut.policySource`),Z(t,e.slippageOrMinOut.maxSlippageBps,n.maxSlippageBps,[`slippageOrMinOut`,`maxSlippageBps`],`slippageOrMinOut.maxSlippageBps`),n.policySource===`adapter_policy_from_quote_evidence`&&Z(t,e.slippageOrMinOut.minOutRaw,n.minOutRaw,[`slippageOrMinOut`,`minOutRaw`],`slippageOrMinOut.minOutRaw`))}e.objectOwnership.objects.forEach((n,r)=>{let i=u(n.evidenceClaimId,`object_ownership`,[`objectOwnership`,`objects`,r,`evidenceClaimId`],`objectOwnership.objects[${r}].evidenceClaimId`);i?.factKind===`object_ownership`&&(Z(t,n.objectId,i.objectId,[`objectOwnership`,`objects`,r,`objectId`],`objectOwnership.objects[${r}].objectId`),Z(t,e.objectOwnership.ownerAccount,i.ownerAccount,[`objectOwnership`,`ownerAccount`],`objectOwnership.ownerAccount`),Z(t,n.ownership,i.ownership,[`objectOwnership`,`objects`,r,`ownership`],`objectOwnership.objects[${r}].ownership`))});let f=u(e.simulation.evidenceClaimId,`simulation_result`,[`simulation`,`evidenceClaimId`],`simulation.evidenceClaimId`);f?.factKind===`simulation_result`&&(Z(t,e.simulation.provider,f.provider,[`simulation`,`provider`],`simulation.provider`),Z(t,e.simulation.checksEnabled,f.checksEnabled,[`simulation`,`checksEnabled`],`simulation.checksEnabled`),Z(t,e.simulation.simulatedAt,f.simulatedAt,[`simulation`,`simulatedAt`],`simulation.simulatedAt`),Z(t,e.simulation.status,f.status,[`simulation`,`status`],`simulation.status`),ab(t,e.simulation.requiredFields,f.requiredFields,[`simulation`,`requiredFields`],`simulation.requiredFields`),ab(t,e.simulation.missingFields,f.missingFields,[`simulation`,`missingFields`],`simulation.missingFields`),Z(t,e.simulation.failureReason,f.failureReason,[`simulation`,`failureReason`],`simulation.failureReason`))}).superRefine((e,t)=>{let n=e.reviewedTransactionDigest;Z(t,e.humanReadableReview.transactionDigest,n,[`humanReadableReview`,`transactionDigest`],`humanReadableReview.transactionDigest`),Z(t,e.simulation.transactionDigest,n,[`simulation`,`transactionDigest`],`simulation.transactionDigest`)}),xb=B({contractVersion:G(gy),artifactKind:G(`ptb_visualization`),generatedAt:qy,source:B({adapterId:F().min(1).max(120),planId:F().min(1).max(120).optional(),sourceKind:W([`review_time_generated_transaction_kind`,`review_time_ir`,`renderer_model`]),authority:G(`visualization_only_not_wallet_authorization`),renderer:B({name:F().min(1).max(120),packageName:F().min(1).max(120).optional(),version:F().min(1).max(80).optional()}).strict().optional()}).strict(),mermaid:B({diagramType:G(`flowchart`),text:eb(2e4,`mermaid.text`),namedText:eb(2e4,`mermaid.namedText`)}).strict(),diagnostics:z(B({severity:W([`info`,`warning`,`error`]),code:F().min(1).max(120),message:eb(512,`diagnostics.message`),source:W([`adapter`,`renderer`,`schema`,`simulation`])}).strict()).default([]),unsupportedUse:z(W(by)).min(1),executableMaterial:B({included:G(!1),policy:G(`mcp_and_review_ui_outputs_must_not_include_executable_transaction_material`)}).strict()}).strict().superRefine((e,t)=>{rb(t,e.unsupportedUse,by,[`unsupportedUse`],`unsupportedUse`)}),Sb=U(F(),R()),Cb=W(dy),wb=W(fy);W([`ready_for_wallet_review`,`refresh_required`,`blocked`]);var Tb=W(py);W([`proposed`,`awaiting_wallet`,`wallet_connected`,`ready_for_wallet_review`,`refresh_required`,`blocked`,`expired`,`awaiting_signature`,`submitting`,`awaiting_chain_result`,`stopped`,`request_failed`,`outcome_unknown`,`completed`]);var Eb=B({id:F(),label:F(),status:W([`pass`,`warning`,`fail`]),message:F(),source:W([`registry`,`quote`,`wallet`,`simulation`,`adapter`,`network`,`proposal`])}),Db=F().min(1),Ob=`human_readable_review`,kb=`review_time_simulation`,Ab=B({stageCatalogId:F().min(1),adapterId:F(),protocol:F(),actionKind:F(),completedStages:z(Db),missingStages:z(Db)}).strict().superRefine((e,t)=>{let n=jb(e.completedStages);n&&t.addIssue({code:`custom`,path:[`completedStages`],message:`completedStages contains duplicate stage '${n}'`});let r=jb(e.missingStages);r&&t.addIssue({code:`custom`,path:[`missingStages`],message:`missingStages contains duplicate stage '${r}'`});for(let n of e.completedStages)e.missingStages.includes(n)&&t.addIssue({code:`custom`,path:[`missingStages`],message:`stage '${n}' cannot be both completed and missing`})});function jb(e){let t=new Set;for(let n of e){if(t.has(n))return n;t.add(n)}}var Mb=B({symbol:F(),amount:F(),coinType:F().optional(),approx:L().optional()}).strict(),Nb=Mb.extend({amountKind:G(`display_intent`).default(`display_intent`)}),Pb=B({outgoing:z(Nb),expectedIncoming:z(Nb),minimumIncoming:z(Nb).optional(),fees:z(Nb).optional()}),Fb=B({outgoing:z(Mb),expectedIncoming:z(Mb),minimumIncoming:z(Mb).optional(),fees:z(Mb).optional()}),Ib=B({before:z(Mb),after:z(Mb),delta:z(Mb)}),Lb=B({computationCostRaw:x_(`computationCostRaw`),storageCostRaw:x_(`storageCostRaw`),storageRebateRaw:x_(`storageRebateRaw`),nonRefundableStorageFeeRaw:x_(`nonRefundableStorageFeeRaw`)}).strict(),Rb=B({address:h_,coinType:F().min(1).max(512).refine(e=>{try{return E_(e)===e}catch{return!1}},`Expected a normalized Sui struct tag coin type`),amount:T_(`balanceChanges[].amount`)}).strict(),zb=B({objectId:h_,objectType:F().min(1).max(512).optional(),inputState:F().min(1).max(80),outputState:F().min(1).max(80),idOperation:F().min(1).max(80)}).strict(),Bb=B({provider:hy,checksEnabled:L(),success:L(),gasCostSummary:Lb.optional(),balanceChanges:z(Rb).optional(),objectChanges:z(zb).optional(),error:F().optional()}),Vb=Bb,Hb=Bb.extend({checksEnabled:G(!0),success:G(!0),gasCostSummary:Lb,balanceChanges:z(Rb),objectChanges:z(zb),error:uc().optional()}).strict(),Ub=B({role:W([`input`,`expected_output`,`minimum_output`,`fee`]),symbol:F(),coinType:F().min(1).max(512).refine(e=>{try{return E_(e),!0}catch{return!1}},`Expected a Sui struct tag coin type`),decimals:I().int().min(0).max(255),rawAmount:x_(`rawAmount`),rawAmountSource:G(`quote_policy_evidence`),displayAmount:F().optional(),displayAmountSource:G(`user_display_intent_not_signing_input`).optional()}).strict().superRefine((e,t)=>{e.displayAmount!==void 0&&e.displayAmountSource===void 0&&t.addIssue({code:`custom`,path:[`displayAmountSource`],message:`displayAmountSource is required when displayAmount is present`}),e.displayAmount===void 0&&e.displayAmountSource!==void 0&&t.addIssue({code:`custom`,path:[`displayAmount`],message:`displayAmount is required when displayAmountSource is present`})}),Wb=B({role:W([`connected_account`,`output_recipient`]),address:h_}).strict(),Gb=B({kind:G(`swap_output_asset`),symbol:F(),coinType:F().min(1).max(512).refine(e=>{try{return E_(e),!0}catch{return!1}},`Expected a Sui struct tag coin type`),protocol:F(),poolKey:F(),direction:W([`base_to_quote`,`quote_to_base`])}).strict(),Kb=B({id:F(),label:F(),source:H([W([`registry`,`quote`,`wallet`,`simulation`,`adapter`,`network`,`proposal`]),W([`transaction_material`,`digest_commitment`])]),summary:F()}).strict(),qb=B({id:F(),label:F(),reason:F()}).strict(),Jb=B({proposedAction:B({title:F(),summary:F(),actionKind:F(),adapterId:F(),protocol:F(),network:G(`sui:mainnet`)}).strict(),recipients:z(Wb),evidenceUsed:z(Kb),missingEvidence:z(qb),requiredUserChoices:z(qb),unsupportedClaims:z(qb),freshness:B({status:G(`current`),evaluatedAt:F(),expiresAt:F(),reason:F()}).strict(),blockingChecks:z(Eb)}).strict(),Yb=B({assetFlow:B({outgoing:z(Ub),expectedIncoming:z(Ub),minimumIncoming:z(Ub),fees:z(Ub)}).strict(),targets:z(Gb)}).strict(),Xb=hc(`kind`,[Jb.extend({kind:G(`swap_human_readable_review`)}).merge(Yb)]),Zb=B({id:F(),actionKind:F(),adapterId:F(),protocol:F(),title:F(),summary:F(),assetFlowPreview:Pb,reviewModel:uy.optional(),adapterData:Sb,createdAt:F(),expiresAt:F().optional(),registryVersion:F().optional(),preliminaryChecks:z(Eb).optional()}),Qb=B({planId:F(),reviewSessionId:F(),account:h_,checks:z(Eb),assetFlowActual:Fb.optional(),beforeAfterBalance:Ib.optional(),simulation:Vb.optional(),humanReadableReview:Xb.optional(),transactionReviewData:bb.optional(),ptbVisualization:xb.optional(),adapterLifecycle:Ab.optional(),updatedAt:F()}),$b=hc(`status`,[Qb.extend({status:G(`ready_for_wallet_review`),evidenceValidity:uc().optional(),blockedReason:uc().optional(),refreshReason:uc().optional()}),Qb.extend({status:G(`refresh_required`),evidenceValidity:G(`invalidated`).optional(),refreshReason:wb,blockedReason:uc().optional()}),Qb.extend({status:G(`blocked`),evidenceValidity:G(`invalidated`).optional(),blockedReason:Cb,refreshReason:uc().optional()})]).superRefine((e,t)=>{if(e.evidenceValidity===`invalidated`)for(let n of my)e[n]!==void 0&&t.addIssue({code:`custom`,path:[n],message:`Invalidated review evidence cannot carry current material-derived facts`});let n=e.adapterLifecycle;if(n!==void 0&&ex(e,t),e.humanReadableReview!==void 0&&n===void 0&&t.addIssue({code:`custom`,path:[`humanReadableReview`],message:`humanReadableReview requires adapterLifecycle evidence stage provenance`}),e.simulation!==void 0&&n===void 0&&t.addIssue({code:`custom`,path:[`simulation`],message:`simulation requires adapterLifecycle evidence stage provenance`}),e.ptbVisualization!==void 0){let e=n?.completedStages??[];e.includes(`transaction_material_build_or_verify`)&&e.includes(`digest_commitment`)||t.addIssue({code:`custom`,path:[`ptbVisualization`],message:`ptbVisualization requires completed transaction material and digest commitment lifecycle stages`})}let r=e.status===`ready_for_wallet_review`;e.transactionReviewData!==void 0&&!r&&t.addIssue({code:`custom`,path:[`transactionReviewData`],message:`transactionReviewData is only valid on ready_for_wallet_review`}),e.status===`ready_for_wallet_review`&&n!==void 0&&(e.transactionReviewData===void 0&&t.addIssue({code:`custom`,path:[`transactionReviewData`],message:`ready_for_wallet_review requires an emitted wallet review contract`}),(n===void 0||n.missingStages.length!==0)&&t.addIssue({code:`custom`,path:[`adapterLifecycle`],message:`ready_for_wallet_review requires a completed adapterLifecycle with no missing stages`}),e.humanReadableReview===void 0&&t.addIssue({code:`custom`,path:[`humanReadableReview`],message:`ready_for_wallet_review requires humanReadableReview public evidence`}),e.simulation===void 0&&t.addIssue({code:`custom`,path:[`simulation`],message:`ready_for_wallet_review requires successful simulation public evidence`})),e.status===`blocked`&&(e.blockedReason===`producer_stage_missing`&&n===void 0&&t.addIssue({code:`custom`,path:[`adapterLifecycle`],message:`producer_stage_missing requires adapterLifecycle with at least one missing stage`}),e.blockedReason===`producer_stage_missing`&&n!==void 0&&n.missingStages.length===0&&t.addIssue({code:`custom`,path:[`blockedReason`],message:`producer_stage_missing requires at least one adapterLifecycle.missingStages entry`}),e.blockedReason===`wallet_review_contract_emit_missing`&&e.transactionReviewData!==void 0&&t.addIssue({code:`custom`,path:[`transactionReviewData`],message:`wallet_review_contract_emit_missing requires the wallet review contract to be absent`}),e.blockedReason===`wallet_review_contract_emit_missing`&&n===void 0&&t.addIssue({code:`custom`,path:[`adapterLifecycle`],message:`wallet_review_contract_emit_missing requires adapterLifecycle`}),e.blockedReason===`wallet_review_contract_emit_missing`&&n!==void 0&&n.missingStages.length!==0&&t.addIssue({code:`custom`,path:[`blockedReason`],message:`wallet_review_contract_emit_missing requires a completed adapterLifecycle with no missing stages`}),e.blockedReason===`wallet_review_contract_emit_missing`&&e.evidenceValidity!==`invalidated`&&e.humanReadableReview===void 0&&t.addIssue({code:`custom`,path:[`humanReadableReview`],message:`wallet_review_contract_emit_missing requires humanReadableReview public evidence`}),e.blockedReason===`wallet_review_contract_emit_missing`&&e.evidenceValidity!==`invalidated`&&e.simulation===void 0&&t.addIssue({code:`custom`,path:[`simulation`],message:`wallet_review_contract_emit_missing requires simulation public evidence`}))});function ex(e,t){let n=e.adapterLifecycle;n&&(e.humanReadableReview!==void 0&&tx(t,n,Ob,[`humanReadableReview`]),e.simulation!==void 0&&(tx(t,n,kb,[`simulation`]),tx(t,n,Ob,[`simulation`]),nx(t,e.simulation,[`simulation`])),n.missingStages.includes(kb)&&e.simulation!==void 0&&t.addIssue({code:`custom`,path:[`simulation`],message:`simulation public evidence cannot be present while review_time_simulation is missing`}),n.missingStages.includes(Ob)&&e.humanReadableReview!==void 0&&t.addIssue({code:`custom`,path:[`humanReadableReview`],message:`humanReadableReview public evidence cannot be present while human_readable_review is missing`}))}function tx(e,t,n,r){t.completedStages.includes(n)||e.addIssue({code:`custom`,path:r,message:`${r.join(`.`)} requires completed adapterLifecycle stage '${n}'`}),t.missingStages.includes(n)&&e.addIssue({code:`custom`,path:r,message:`${r.join(`.`)} cannot be present while adapterLifecycle stage '${n}' is missing`})}function nx(e,t,n){Hb.safeParse(t).success||e.addIssue({code:`custom`,path:n,message:`simulation public evidence requires a successful checks-enabled review-time simulation projection`})}var rx=B({topic:F().min(1),accounts:z(h_).min(1),methods:z(F()),chain:G(R_),expiresAt:F().datetime(),walletName:F().optional()}).strict(),ix=hc(`status`,[B({topic:F().min(1),version:I().int().positive(),status:G(`present`),session:rx}).strict(),B({topic:F().min(1),version:I().int().positive(),status:W([`absent`,`unusable`])}).strict()]),ax=B({runId:z_,sequence:I().int().positive(),observedAt:F().datetime()}).strict();ax.extend({sessions:z(ix)}).strict();var ox=B({kind:G(`wallet_service_recovery`),priorRunId:z_,admittedAt:F().datetime(),updatedAt:F().datetime()}),sx=H([ox.extend({phase:G(`stopping`)}).strict(),ox.extend({phase:G(`starting`),nextRunId:z_}).strict(),ox.extend({outcome:W([`available`,`failed`,`superseded`,`server_restarted`]),nextRunId:z_.optional(),message:F().optional()}).strict()]),cx=`A wallet connection provides account context; it is not a transaction approval or proof of address ownership.`,lx=`Review evidence is not a safety guarantee. Only an explicit card action and wallet approval may authorize this exact transaction.`,ux=K_.extend({pendingAction:G(`disconnect`).optional()});W([`input_required`,`awaiting_approval`,`disconnect_pending`]);var dx=B({action:G(`connect`),walletRunId:z_}).strict(),fx=B({action:G(`disconnect`),walletRunId:z_,connectionId:F().min(1)}).strict(),px=B({action:G(`use_account`),walletRunId:z_,connectionId:F().min(1),account:h_}).strict(),mx=B({action:W([`prepare_review`,`request_signature`]),connectionId:F().min(1),walletRunId:z_,account:h_,reviewRevision:I().int().nonnegative()}).strict(),hx=H([dx,fx,px,mx,B({action:W([`cancel`,`stop_connection`,`stop_waiting`,`read_result`])}).strict()]),gx=H([dx,mx.extend({action:G(`prepare_review`)})]),_x=B({kind:W([`connect`,`review`]),mode:W([`connect`,`review`,`review_manage`]),allowedActions:z(W(X_)),actionRemainingMs:I().int().nonnegative(),nextStateReadAfterMs:I().int().nonnegative().optional(),automaticAction:gx.optional(),observe:L(),walletAvailability:H_,walletObservation:ax.optional(),runtimeRecovery:sx.optional(),connectionConflict:q_.optional(),manageableConnectionIds:z(F().min(1)),connectionReconciliationRequired:G(!0).optional(),usableConnectionId:F().min(1).optional(),assetReadAccount:Y_.optional(),acceptedWalletRunId:z_.optional(),progress:U_,boundary:W([cx,lx]),connections:z(ux),activeAccount:F().optional(),connection:ux.optional(),connectionAction:W([`connect`,`disconnect`]).optional(),review:B({reviewSessionId:F(),plan:Zb,reviewRevision:I().int().nonnegative(),status:Tb,account:F().optional(),preparing:L(),accountRequestPending:G(!0).optional(),error:F().optional(),state:$b.optional()}).strict().optional(),request:L_.optional(),receipt:R().optional(),netGasMist:F().regex(/^-?[0-9]+$/).optional(),observationStopped:L().optional()}).strict().superRefine((e,t)=>{let n=e.connections.find(t=>t.connectionId===e.usableConnectionId);e.usableConnectionId&&(!n||n.status!==`connected`||e.walletAvailability.status!==`available`||e.connectionConflict||e.connectionReconciliationRequired||e.connections.some(e=>e.pendingAction||e.status===`awaiting_approval`))&&t.addIssue({code:`custom`,path:[`usableConnectionId`],message:`The usable connection must match current connection facts.`}),(new Set(e.manageableConnectionIds).size!==e.manageableConnectionIds.length||e.manageableConnectionIds.some(t=>!e.connections.some(e=>e.connectionId===t&&!e.pendingAction&&e.status!==`awaiting_approval`)))&&t.addIssue({code:`custom`,path:[`manageableConnectionIds`],message:`Management must name distinct recorded targets without pending operations.`}),e.connectionReconciliationRequired&&(e.usableConnectionId||e.assetReadAccount?.status===`available`||e.allowedActions.some(e=>[`connect`,`use_account`,`prepare_review`,`request_signature`].includes(e)))&&t.addIssue({code:`custom`,path:[`connectionReconciliationRequired`],message:`Unrecorded SDK connections cannot authorize connection or account use.`}),e.assetReadAccount?.status===`available`&&(!n||!n.accounts.includes(e.assetReadAccount.account)||e.activeAccount!==e.assetReadAccount.account)&&t.addIssue({code:`custom`,path:[`assetReadAccount`],message:`The default address must belong to the usable connection and stored selection.`})});function vx(e,t,n=!1){return e.connections.filter(r=>r.connectionId===e.usableConnectionId&&r.accounts.includes(t)&&(!n||r.methods.includes(`sui_signTransaction`)))}var yx=`sui-mcp.local-data`,bx=16777216,Q=F().uuid(),xx=I().int().nonnegative().safe(),Sx=F().regex(/^[a-f0-9]{64}$/),Cx=hc(`status`,[B({status:G(`no_file`)}).strict(),B({status:G(`receiving`)}).strict(),B({status:G(`checking`)}).strict(),B({status:G(`check_required`),message:F().min(1)}).strict(),B({status:G(`can_restore`)}).strict(),B({status:G(`cannot_restore`),reason:W([`invalid_backup`,`file_unavailable`,`wallet_request_unsettled`,`operation_busy`,`input_unavailable`,`check_failed`]),message:F().min(1)}).strict()]);B({fileId:Q,sha256:Sx,totalSize:xx,dataEpoch:xx,userDataRevision:xx,check:Cx}).strict();var wx=hc(`kind`,[B({kind:G(`set_endpoint`),endpoint:W([`grpc`,`graphql`]),value:F().min(1)}).strict(),B({kind:G(`restore_endpoint`),endpoint:W([`grpc`,`graphql`])}).strict(),B({kind:W([`clear_read_address`,`export_local_data`,`download_backup`,`import_local_data`,`reset_local_data`,`restart_wallet_service`])}).strict()]),Tx=W([`acknowledged`,`not_completed`,`unconfirmed`,`unsupported`]),Ex=B({method:G(`ui/download-file`),code:G(-32601)}).strict(),Dx=W([`acknowledged`,`cancelled`,`expired`,`server_restarted`,`data_replaced`,`source_unavailable`,`stored_locally`,`local_save_failed`]),Ox=B({device:F().regex(/^\d+$/),inode:F().regex(/^\d+$/)}).strict(),kx=W([`not_published`,`target_conflict`,`source_unavailable`,`interrupted`]),Ax=B({status:W([`needs_consent`,`saving`,`saved`,`failed`]),attemptId:Q,fileId:Q,sha256:Sx,totalSize:xx,destination:F(),ownerId:F().min(1),currentSaveAttemptId:Q.optional(),attempts:z(B({saveAttemptId:Q,previousSaveAttemptId:Q.optional(),admittedAt:F().datetime(),allowPossibleCopy:L()}).strict()),sourceIdentity:Ox.optional(),savedAt:F().datetime().optional(),failure:kx.optional()}).strict().superRefine((e,t)=>{(e.status===`needs_consent`?e.attempts.length!==0||e.currentSaveAttemptId!==void 0:!e.currentSaveAttemptId||!e.attempts.some(t=>t.saveAttemptId===e.currentSaveAttemptId))&&t.addIssue({code:`custom`,message:`A local save must identify its admitted attempt.`}),(new Set(e.attempts.map(e=>e.saveAttemptId)).size!==e.attempts.length||e.status===`saved`!=(e.savedAt!==void 0)||e.status===`saved`&&!e.sourceIdentity||e.status===`failed`!=(e.failure!==void 0))&&t.addIssue({code:`custom`,message:`Local save evidence must match its state.`})});B({currentAttemptId:Q,attempts:z(B({attemptId:Q,admittedAt:F().datetime(),previousAttemptId:Q.optional(),hostReport:Tx.optional(),failure:Ex.optional()}).strict()).min(1),readyAt:F().datetime().optional(),expiresAt:F().datetime().optional(),endReason:Dx.optional(),localSave:Ax.optional()}).strict().superRefine((e,t)=>{(new Set(e.attempts.map(e=>e.attemptId)).size!==e.attempts.length||!e.attempts.some(t=>t.attemptId===e.currentAttemptId)||e.readyAt===void 0!=(e.expiresAt===void 0))&&t.addIssue({code:`custom`,message:`Download attempts and lifetime must identify one stored snapshot.`}),(e.endReason===`stored_locally`&&e.localSave?.status!==`saved`||e.endReason===`local_save_failed`&&e.localSave?.status!==`failed`||e.attempts.some(e=>e.hostReport===`unsupported`!=(e.failure!==void 0))||e.localSave&&(e.localSave.attemptId!==e.currentAttemptId||!e.attempts.some(t=>t.attemptId===e.currentAttemptId&&t.hostReport===`unsupported`)||e.localSave.status===`saving`&&e.endReason!==void 0||e.localSave.status===`saved`!=(e.endReason===`stored_locally`)))&&t.addIssue({code:`custom`,message:`Local saving requires the current download's unsupported report.`})});var jx=W([`settings_retry_download`,`settings_report_download`,`settings_cancel_download`,`settings_store_backup`]),Mx=hc(`action`,[B({action:G(`settings_download_backup`),operationId:Q,attemptId:Q}).strict(),B({action:G(`settings_retry_download`),operationId:Q,fileId:Q,previousAttemptId:Q,attemptId:Q}).strict(),B({action:G(`settings_report_download`),operationId:Q,fileId:Q,attemptId:Q,status:Tx,failure:Ex.optional()}).strict().refine(e=>e.status===`unsupported`==(e.failure!==void 0),`Only unsupported downloads require the exact method failure.`),B({action:G(`settings_store_backup`),operationId:Q,fileId:Q,attemptId:Q,saveAttemptId:Q,previousSaveAttemptId:Q.optional(),allowPossibleCopy:L()}).strict(),B({action:G(`settings_cancel_download`),operationId:Q,fileId:Q,attemptId:Q}).strict(),B({action:G(`settings_select`),draft:wx}).strict(),B({action:G(`settings_prepare`),operationId:Q}).strict(),B({action:G(`settings_begin_upload`),operationId:Q,name:F().min(1),totalSize:xx.max(bx),sha256:Sx}).strict(),B({action:G(`settings_upload_chunk`),operationId:Q,fileId:Q,offset:xx.max(bx),chunkBase64:F()}).strict(),B({action:G(`settings_seal_upload`),operationId:Q,fileId:Q}).strict(),B({action:G(`settings_confirm`),operationId:Q,preparationId:Q}).strict(),B({action:G(`settings_back`),operationId:Q}).strict(),B({action:G(`settings_cancel`)}).strict()]),Nx=B({outcome:W([`completed`,`failed`,`interrupted`,`superseded`]),recordedAt:F().datetime(),message:F().min(1),details:U(F(),R()).optional(),completionScope:G(`backup_snapshot`).optional()}).strict(),Px=B({storedValue:F(),effectiveValue:F(),source:W([`environment`,`local_db`,`builtin_default`]),pendingStoredValue:F().optional(),appliesAfter:G(`mcp_server_restart`).optional()}).strict(),Fx=B({endpoint:W([`grpc`,`graphql`]),key:W([`suiGrpcUrl`,`suiGraphqlUrl`]),value:F().min(1),status:W([`saved`,`reset`]),storedValue:F(),effectiveValue:F(),source:Px.shape.source}).strict().refine(e=>e.key===(e.endpoint===`grpc`?`suiGrpcUrl`:`suiGraphqlUrl`),`The endpoint kind and preference key must agree.`),Ix=I().int().nonnegative().safe(),Lx=B({accounts:Ix,reviewSessions:Ix,reviewStateSnapshots:Ix,reviewStatusTransitions:Ix,reviewExecutions:Ix,reviewRequests:Ix,outcomeUnknownRequests:Ix,externalActivityScans:Ix,externalActivityTransactions:Ix,localSettings:Ix}).strict(),Rx=B({status:G(`valid`),format:G(yx),network:G(`mainnet`),exportedAt:F().datetime(),currentCounts:Lx,incomingCounts:Lx,willReplace:G(!0),activeAccountChange:W([`unchanged`,`set`,`cleared`]),currentReadAddress:h_.nullable(),incomingReadAddress:h_.nullable(),restartRequiredAfterImport:L()}).strict(),zx=B({kind:G(`settings`),operationId:Q,phase:W([`draft`,`uploading`,`sealed`,`prepared`,`executing`,`stopping`,`starting`,`terminal`]),draft:wx.optional(),preparationId:Q.optional(),preparation:U(F(),R()).optional(),file:B({fileId:Q,displayName:F(),totalSize:xx,receivedSize:xx,sha256:Sx,sealed:L(),cleanup:W([`pending`,`complete`,`failed`])}).strict().optional(),download:B({availability:W([`preparing`,`available`,`ended`]),currentAttemptId:Q,hostReport:Tx.optional(),previousUnconfirmed:L(),endReason:Dx.optional(),expiresAt:F().datetime().optional(),remainingMs:xx.optional(),localSave:B({status:W([`needs_consent`,`saving`,`saved`,`failed`]),currentSaveAttemptId:Q.optional(),failure:kx.optional(),savedAt:F().datetime().optional()}).strict().optional(),allowedFileActions:z(jx)}).strict().optional(),restoreCheck:Cx.optional(),backupLocation:B({directory:F().min(1),filename:F().min(1)}).strict().optional(),result:Nx.optional(),temporaryFileCleanup:W([`pending`,`complete`,`failed`]).optional(),priorRunId:Q.optional(),nextRunId:Q.optional(),supersedesOperationId:Q.optional(),supersededByOperationId:Q.optional(),allowedActions:z(W(Mx.options.map(e=>e.shape.action.value))),observe:L(),facts:B({server:B({name:F(),version:F(),network:G(`mainnet`)}).strict(),localSettings:B({suiGrpcUrl:Px,suiGraphqlUrl:Px}).strict(),readAddress:F().optional(),assetReadAccount:Y_,walletAvailability:H_,connectionReconciliationRequired:G(!0).optional(),observedAt:F().datetime().optional(),counts:Lx}).strict().optional()}).strict().superRefine((e,t)=>{if(e.download&&(e.draft?.kind!==`download_backup`||!e.file||e.download.availability===`available`&&(!e.file.sealed||!e.result||e.download.endReason||!e.download.expiresAt)||e.download.availability===`ended`&&!e.download.endReason)&&t.addIssue({code:`custom`,message:`Download delivery must describe its own snapshot and lifetime.`}),e.draft?.kind===`download_backup`&&e.preparation!==void 0&&t.addIssue({code:`custom`,message:`Private download preparation is not public preparation data.`}),e.restoreCheck&&(e.draft?.kind!==`import_local_data`||e.result)&&t.addIssue({code:`custom`,message:`Restore checks belong to an uncompleted import preparation.`}),e.restoreCheck?.status===`can_restore`&&(e.phase!==`prepared`||!e.file?.sealed||!e.allowedActions.includes(`settings_confirm`))&&t.addIssue({code:`custom`,message:`Restore availability requires a sealed file and current confirmation.`}),e.draft?.kind===`import_local_data`&&e.restoreCheck?.status!==`can_restore`&&e.allowedActions.includes(`settings_confirm`)&&t.addIssue({code:`custom`,message:`An unchecked or blocked import cannot offer confirmation.`}),e.restoreCheck?.status===`receiving`&&(!e.file||e.file.sealed||![`draft`,`uploading`].includes(e.phase))&&t.addIssue({code:`custom`,message:`Receiving requires the selected unsealed upload.`}),e.restoreCheck?.status===`check_required`&&(!e.file?.sealed||e.phase!==`sealed`)&&t.addIssue({code:`custom`,message:`A new check requires the same complete sealed upload.`}),e.restoreCheck?.status===`cannot_restore`&&e.restoreCheck.reason===`invalid_backup`&&(e.phase===`prepared`||e.allowedActions.includes(`settings_prepare`))&&t.addIssue({code:`custom`,message:`A rejected backup requires an explicit new selection.`}),e.backupLocation&&(e.result?.outcome!==`completed`||e.draft?.kind!==`export_local_data`&&(e.draft?.kind!==`download_backup`||e.download?.localSave?.status!==`saved`||e.download.endReason!==`stored_locally`))&&t.addIssue({code:`custom`,message:`A backup location requires its recorded successful export.`}),e.download?.localSave?.status===`saved`&&!e.backupLocation&&t.addIssue({code:`custom`,message:`A saved backup must identify its verified location.`}),e.draft?.kind===`export_local_data`&&e.result?.outcome===`completed`&&typeof e.result.details?.path==`string`&&!e.backupLocation&&t.addIssue({code:`custom`,message:`A recorded backup path must provide its folder and file name.`}),e.temporaryFileCleanup&&!e.result&&t.addIssue({code:`custom`,message:`Cleanup of an applied or ended operation requires its recorded result.`}),(e.phase===`terminal`!=(e.result!==void 0)||e.phase===`terminal`&&(e.observe||e.allowedActions.length))&&t.addIssue({code:`custom`,message:`A terminal Settings result cannot grant input or observation.`}),e.phase===`prepared`&&(!e.preparationId||!e.draft||!e.preparation)&&t.addIssue({code:`custom`,message:`Settings confirmation requires a prepared identity and facts.`}),e.phase===`prepared`&&e.draft?.kind===`import_local_data`&&!Rx.safeParse(e.preparation?.preview).success&&t.addIssue({code:`custom`,path:[`preparation`,`preview`],message:`Import confirmation requires the validated current and incoming read context and record counts.`}),e.phase===`prepared`&&(e.draft?.kind===`set_endpoint`||e.draft?.kind===`restore_endpoint`)){let n=Fx.safeParse(e.preparation?.endpoint);(!n.success||n.data.endpoint!==e.draft.endpoint||n.data.status!==(e.draft.kind===`set_endpoint`?`saved`:`reset`)||e.draft.kind===`set_endpoint`&&n.data.value!==e.draft.value)&&t.addIssue({code:`custom`,path:[`preparation`,`endpoint`],message:`Endpoint confirmation must name its exact prepared target.`})}e.file&&e.file.receivedSize>e.file.totalSize&&t.addIssue({code:`custom`,message:`Received content exceeds the selected file.`})}),Bx=65536;function Vx(e){return new TextEncoder().encode(JSON.stringify(e)).length}function Hx(e){let t=Bx-Vx(e);return t>0?3*Math.floor(t/4):0}function Ux(e){if(!e||typeof e!=`object`)return;let t=structuredClone(e);if(t.method===`tools/call`&&t.params?.name===`ui_act_card`&&t.params.arguments?.input?.action===`settings_upload_chunk`)return t.id=2**53-1,t.params.arguments.revision=2**53-1,t.params.arguments.input.offset=bx,t.params.arguments.input.chunkBase64=``,Hx(t)}var Wx={uiOpenAccount:`ui_open_account`,uiOpenReceipt:`ui_open_receipt`,uiOpenChart:`ui_open_chart`,uiReadCard:`ui_read_card`,uiSubmitCard:`ui_submit_card`,uiActCard:`ui_act_card`,uiReadSettingsFile:`ui_read_settings_file`,sessionOpenReviewManagement:`session_open_review_management`,readGetServerStatus:`read_get_server_status`,readListSupportedProtocols:`read_list_supported_protocols`,readListDeepbookPools:`read_list_deepbook_pools`,readListDeepbookTokens:`read_list_deepbook_tokens`,readInspectDeepbookOrderbook:`read_inspect_deepbook_orderbook`,readGetDeepbookMidPrice:`read_get_deepbook_mid_price`,readGetDeepbookUsdcPriceHistory:`read_get_deepbook_usdc_price_history`,readGetDeepbookUsdcPriceAtTime:`read_get_deepbook_usdc_price_at_time`,readQuoteDeepbookAction:`read_quote_deepbook_action`,readQuoteDeepbookDisplayAmount:`read_quote_deepbook_display_amount`,readSummarizeDeepbookAccountInventory:`read_summarize_deepbook_account_inventory`,readSummarizeWalletAssets:`read_summarize_wallet_assets`,readClassifyWalletAssets:`read_classify_wallet_assets`,readListSettlementAssetGroups:`read_list_settlement_asset_groups`,readSummarizeSettlementAssetGroupParity:`read_summarize_settlement_asset_group_parity`,readPreviewIntentEvidence:`read_preview_intent_evidence`,readListReviewActivity:`read_list_review_activity`,readSummarizeReviewFunnel:`read_summarize_review_funnel`,readGetReviewSessionDetail:`read_get_review_session_detail`,readInspectSuiTransaction:`read_inspect_sui_transaction`,readScanSuiAccountActivity:`read_scan_sui_account_activity`,readSummarizeSuiActivityScan:`read_summarize_sui_activity_scan`,readScanSuiFunctionActivity:`read_scan_sui_function_activity`,readSummarizeSuiFunctionActivityScan:`read_summarize_sui_function_activity_scan`,readSummarizeSuiAccountActivity:`read_summarize_sui_account_activity`,readGetAccountAssetTimeline:`read_get_account_asset_timeline`,settingsCreateLocalSettingsSession:`settings_create_local_settings_session`,settingsGetLocalSettings:`settings_get_local_settings`,actionStartReview:`action_start_review`,actionCreateProposalReview:`action_create_proposal_review`,sessionOpenWalletConnectionCard:`session_open_wallet_connection_card`,sessionGetWalletConnectionCard:`session_get_wallet_connection_card`,sessionWaitWalletConnectionCard:`session_wait_wallet_connection_card`,sessionGetInteractionStatus:`session_get_interaction_status`,sessionGetReviewStatus:`session_get_review_status`,sessionGetExecutionResult:`session_get_execution_result`,sessionWaitExecutionResult:`session_wait_execution_result`,accountGetActiveAccount:`account_get_active_account`},Gx=B({connectionId:F().min(1),pairingUri:F().startsWith(`wc:`),expiresAt:F().datetime()}).strict(),Kx=W([`account`,`receipt`,`chart`,`connect`,`review`,`settings`]),qx=B({cardId:F().min(1),kind:Kx,state:W([`ready`,`running`,`closed`]),revision:I().int().nonnegative(),createdAt:F().datetime(),expiresAt:F().datetime(),input:U(F(),R()),data:R().optional(),reason:W([`completed`,`expired`,`failed`,`server_restarted`,`cancelled`]).optional(),error:F().optional()}).strict().extend({pollAfterMs:I().int().positive(),inputRemainingMs:I().int().nonnegative()}),Jx=B({transactionDigest:F().min(1),pureInputs:z(B({index:I().int().nonnegative(),bytes:F().regex(/^0x(?:[0-9a-f]{2})*$/i)}).strict()).refine(e=>new Set(e.map(e=>e.index)).size===e.length,`Duplicate input index.`),ptbGraph:B({mermaid:B({text:F(),namedText:F()}).strict()}).strict().optional()}).strict(),Yx=`sui-mcp/card`,Xx=`sui-mcp/receipt-display`,Zx=`sui-mcp/wallet-display`,Qx=`sui-mcp/settings-file`,$x=`suimcp://cards/`,eS=hc(`kind`,[B({kind:G(`account`),status:G(`input_required`),field:G(`account`),message:F().min(1)}).strict(),B({kind:G(`receipt`),status:G(`input_required`),field:G(`digest`),message:F().min(1)}).strict()]),tS=B({cardId:F().min(1),permission:F().min(1)}).strict();tS.extend({revision:I().int().nonnegative(),input:U(F(),R())}).strict();var nS=Jx.extend({cardId:F().min(1),revision:I().int().nonnegative(),attemptId:F().min(1).optional()}),rS=Gx.extend({cardId:F().min(1),revision:I().int().nonnegative()}),iS=B({attemptId:F().uuid().optional(),cardId:F().min(1),operationId:F().uuid(),fileId:F().uuid(),offset:I().int().nonnegative().safe(),totalSize:I().int().nonnegative().safe(),sha256:F().regex(/^[a-f0-9]{64}$/),chunkBase64:F()}).strict(),aS={account:Wx.uiOpenAccount,receipt:Wx.uiOpenReceipt,chart:Wx.uiOpenChart,read:Wx.uiReadCard,submit:Wx.uiSubmitCard,act:Wx.uiActCard,readSettingsFile:Wx.uiReadSettingsFile};function $(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function oS(e){return e.kind!==`import_local_data`}function sS(e,t,n){if(e.kind!==`settings`||t.kind!==`settings`||e.cardId!==t.cardId||t.state!==`ready`)return;let r=zx.safeParse(e.data),i=zx.safeParse(t.data);if(!r.success||!i.success)return;let a=r.data,o=i.data,s=o.draft;if(!s||!a.draft||a.operationId!==o.operationId||n.operationId!==o.operationId||JSON.stringify(a.draft)!==JSON.stringify(s))return;if(oS(s))return n.action===`settings_prepare`?{kind:`preparation_response`,cardId:t.cardId,operationId:o.operationId,draft:s}:void 0;let c=o.file?.fileId;if(!(!c||!a.file?.fileId||a.file.fileId!==c||n.action!==`settings_prepare`&&n.action!==`settings_seal_upload`||n.action===`settings_seal_upload`&&n.fileId!==c))return{kind:`backup_check_response`,cardId:t.cardId,operationId:o.operationId,fileId:c,action:n.action}}function cS(e){return Object.keys(e).filter(t=>e[t]!==void 0)}function lS(e,t){if(e===t)return!0;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>lS(e,t[n]));let n=$(e),r=$(t);if(!n||!r)return!1;let i=cS(n);return i.length===cS(r).length&&i.every(e=>Object.hasOwn(r,e)&&lS(n[e],r[e]))}function uS(e,t=!0){let n=$(e);if(!n)throw Error(`The app did not provide a usable card response.`);let r=()=>Error(`The app provided inconsistent card response information.`),i,a=e=>{let t=$(e);if(!t||typeof t.ok!=`boolean`||i&&!lS(i,t))throw r();i=t};n.structuredContent!==void 0&&a(n.structuredContent);let o,s;if(Array.isArray(n.content))for(let e of n.content){let n=$(e);if(n?.type!==`text`||typeof n.text!=`string`)continue;let i;try{i=$(JSON.parse(n.text))}catch{continue}if(i){if(i.ok!==void 0)a(i);else if(Array.isArray(i.content)){if(!t||o)throw r();let n=Xu.safeParse(i);if(!n.success)throw r();o=uS(n.data,!1),s=e,o.structuredContent!==void 0&&a(o.structuredContent)}}}let c=Object.create(null),l=!1;for(let e of[n._meta,o?._meta]){if(e===void 0)continue;let t=$(e);if(!t)throw r();for(let e of cS(t)){let n=t[e];if(Object.hasOwn(c,e)&&!lS(c[e],n))throw r();c[e]=n}l=!0}if(n.isError!==void 0&&typeof n.isError!=`boolean`||o?.isError!==void 0&&n.isError!==void 0&&o.isError!==n.isError||(n.isError===!0||o?.isError===!0)&&i?.ok===!0)throw r();return{...o,...n,...o?{content:[...Array.isArray(n.content)?n.content.filter(e=>e!==s):[],...Array.isArray(o.content)?o.content:[]]}:{},...i?{structuredContent:i}:{},...l?{_meta:c}:{}}}function dS(e,t){let n=$($(e?.data)?.request);return!!e&&(e.kind===`receipt`||e.kind===`review`)&&t.cardId===e.cardId&&t.revision===e.revision&&t.transactionDigest===(e.kind===`receipt`?e.input.digest:n?.transactionDigest)&&(e.kind!==`review`||t.attemptId===n?.attemptId)}function fS(e){let t;for(let n of Array.isArray(e.content)?e.content:[]){let e=$(n),r;if(e?.type===`resource_link`&&typeof e.uri==`string`&&e.uri.startsWith(`suimcp://cards/`)&&(r=e.uri),e?.type===`text`&&typeof e.text==`string`){let t=/^\[Resource link: card_([A-Za-z0-9_-]+)\] (suimcp:\/\/cards\/([A-Za-z0-9_-]+)) \(Saved data for this exact card\.\)$/.exec(e.text);if(!t&&e.text.startsWith(`[Resource link:`)&&e.text.includes(`suimcp://cards/`))throw Error(`The saved card links could not be matched to one card.`);if(t){if(t[1]!==t[3])throw Error(`The saved card links could not be matched to one card.`);r=t[2]}}if(r===void 0)continue;let i=r.slice($x.length);if(!i||encodeURIComponent(i)!==i||t!==void 0&&i!==t||e?.type===`resource_link`&&typeof e.name==`string`&&e.name.startsWith(`card_`)&&e.name!==`card_${i}`)throw Error(`The saved card links could not be matched to one card.`);t=i}return t}function pS(e){let t=$(e.structuredContent),n=t?.ok===!0?eS.safeParse(t.data):void 0,r=$($(t?.error)?.details),i=n?.success?void 0:t?.ok===!0?$(t.data)?.card??t.data:r?.snapshot,a=i===void 0?void 0:qx.parse(i);a?.kind===`settings`&&zx.parse(a.data);let o=$(e._meta)?.[Xx],s=o===void 0?void 0:nS.parse(o);if(s&&!dS(a,s))throw Error(`Transaction details do not match this saved result.`);let c=$(e._meta)?.[Zx],l=c===void 0?void 0:rS.parse(c);if(l&&(!a||a.kind!==`connect`||l.cardId!==a.cardId||l.revision!==a.revision||l.connectionId!==$($(a.data)?.connection)?.connectionId))throw Error(`The connection QR code does not match this card.`);return{snapshot:a,display:s,wallet:l,inputRequired:n?.success?n.data:void 0,error:typeof r?.message==`string`?r.message:typeof r?.reason==`string`?r.reason:void 0}}function mS(e,t){let n=document.getElementById(`app`);if(!n)throw Error(`Card root is unavailable.`);let r=document.createElement(`h1`);r.textContent=t.title;let i=document.createElement(`p`);i.className=`ui-note`,i.setAttribute(`role`,`status`);let a=document.createElement(`p`);a.className=`ui-error`,a.setAttribute(`role`,`alert`);let o=document.createElement(`p`);o.className=`ui-note card-guidance`;let s=document.createElement(`section`),c=document.createElement(`div`);c.className=`card-actions`;let l=document.createElement(`div`);l.className=`card-progress-hint`,l.hidden=!0,n.replaceChildren(r,i,a,s,o,l,c);let u=new Zh({name:`sui-mcp-card`,version:`0.7.0`},{},{autoResize:!0,strict:!0}),d=new AbortController,f=e===`connect`||e===`review`,p=e===`settings`,m=f||p,h=!1,g,_,v,y,b,ee,x,te=!1,ne=!1,re,ie,S={status:`unconfirmed`},ae,oe,se,C,w,T=`continue`,ce,E,le=0,D=0,ue,de,fe,pe,O,me,he,ge,_e=!1;function ve(){if(!C||!y)return;let{input:e,basis:t}=C,n=$(y.data),r=$(t.data),i=$(n?.request),a=$(n?.review),o=$(n?.connection),s=$(r?.request),c=$(r?.connection),l=!!i&&i.attemptId===s?.attemptId,u=!!o&&o.connectionId===c?.connectionId;if(!f)return y.state===`running`||y.reason===`completed`?C.delivery===`rejected`?`past`:`observed`:y.state===`closed`?`past`:`active`;if(e.walletRunId&&e.walletRunId!==$(n?.walletAvailability)?.walletRunId&&e.walletRunId!==n?.acceptedWalletRunId)return`past`;switch(e.action){case`connect`:if(y.state!==`ready`&&o)return`observed`;if(n?.walletAvailability&&$(n.walletAvailability)?.status===`available`&&Array.isArray(n.connections)&&n.connections.some(e=>$(e)?.status===`connected`))return`past`;break;case`prepare_review`:if(typeof a?.reviewRevision==`number`&&typeof e.reviewRevision==`number`&&a.reviewRevision>e.reviewRevision)return a.account===e.account?`observed`:`past`;break;case`request_signature`:if(i?.account===e.account&&i?.reviewRevision===e.reviewRevision)return`observed`;if(typeof a?.reviewRevision==`number`&&typeof e.reviewRevision==`number`&&a.reviewRevision>e.reviewRevision||!i&&a&&a.reviewRevision===e.reviewRevision&&a.account===e.account&&a.status===`refresh_required`&&$(a.state)?.refreshReason===`review_evidence_stale`&&Array.isArray(n?.allowedActions)&&n.allowedActions.includes(`prepare_review`))return`past`;break;case`cancel`:if(y.reason===`cancelled`)return`observed`;break;case`disconnect`:if(o&&o.connectionId===e.connectionId&&(o.pendingAction===`disconnect`||y.state!==`ready`&&o.status===`disconnected`))return`observed`;break;case`use_account`:if(y.reason===`completed`&&n?.activeAccount===e.account&&o?.connectionId===e.connectionId)return`observed`;break;case`stop_connection`:if(u&&o?.status===`stopped`)return`observed`;if(u&&o?.status!==`awaiting_approval`)return`past`;break;case`stop_waiting`:if(l&&(i?.requestStatus===`stopped`||n?.observationStopped===!0))return`observed`;if(l&&[`completed`,`request_failed`,`outcome_unknown`].includes(String(i?.requestStatus)))return`past`;break;case`read_result`:if(l&&(n?.observe===!0||i?.requestStatus===`completed`))return`observed`;if(l&&[`stopped`,`request_failed`].includes(String(i?.requestStatus)))return`past`}return ye()||typeof n?.actionRemainingMs==`number`&&n.actionRemainingMs<=0||[`connect`,`disconnect`,`use_account`,`cancel`,`prepare_review`,`request_signature`].includes(String(e.action))&&(y.state!==`ready`||a?.status===`expired`)?`past`:`active`}function ye(){let e=hx.safeParse(C?.input);if(!e.success||e.data.action!==`disconnect`&&e.data.action!==`use_account`)return!1;let t=e.data,n=_x.safeParse(y?.data);if(!n.success)return!1;let r=n.data.connections.find(e=>e.connectionId===t.connectionId);return r?t.action===`disconnect`?n.data.walletAvailability.status===`available`&&!r.pendingAction&&!n.data.manageableConnectionIds.includes(t.connectionId)&&[`disconnected`,`failed`,`rejected`,`stopped`,`expired`].includes(r.status):[`disconnected`,`failed`,`rejected`,`stopped`,`expired`].includes(r.status)||t.action===`use_account`&&r.status===`connected`&&!r.accounts.includes(t.account):!1}function be(){if(!C)return;let e=ve();e&&C.disposition!==`observed`&&(e!==`active`||C.disposition===`active`)&&(C.disposition=e),C.disposition===`observed`&&(C.retryRequired=!1)}function xe(){let e=gx.safeParse($(y?.data)?.automaticAction);return C?.retryRequired&&e.success&&C.input.action===e.data.action?e.data:void 0}function Se(e){let t={connect:`connection request`,prepare_review:`review update`,request_signature:`wallet approval request`,read_result:`transaction status check`,cancel:`cancellation request`,stop_connection:`request to stop connecting`,stop_waiting:$($(e.basis.data)?.request)?.requestStatus===`awaiting_signature`?`request to stop wallet approval`:`request to stop checking the result`,disconnect:`wallet disconnect request`,use_account:`account selection`};return f?t[String(e.input.action)]??`request`:`data request`}function Ce(e){if(e!==`past`||!C)return;let t=Se(C),n=C.input.action===`read_result`&&$($(y?.data)?.request)?.requestStatus===`outcome_unknown`?` To check this transaction again, ask to open its result in chat.`:``;return`Message from an earlier ${t}: “${C.message}”${n}`}let we,Te;function Ee(){let t=$(y?.data),n=p?$(t?.download):void 0,r=Array.isArray(n?.allowedFileActions)?n.allowedFileActions:[],i=[...Array.isArray(t?.allowedActions)?t.allowedActions:[],...r.filter(e=>e===`settings_report_download`||we===void 0||Date.now()<we)],a=e===`review`&&t?.mode===`review`&&!t.request&&!!g&&y?.state===`ready`,o=a&&ue!==void 0&&Date.now()>=ue,s=document.visibilityState!==`hidden`,c=d.signal.aborted||S.status===`rejected`,l=S.status===`confirmed`,u=C?.disposition,v=u===`active`,b=C?.retryRequired===!0,ee=C?.input.action===`request_signature`&&u===`active`,x=T===`paused`,ne=me?.pending?.()===!0,re=me?.displayRecovery?.(),le=l&&!c&&!oe&&!ne&&!o&&!!g,de=le&&!w&&!h&&(!m||!(ce&&(v||b||x))),fe=gx.safeParse(t?.automaticAction),pe=p?$(n?.localSave):void 0,O=!!y&&(m?t?.observe===!0||pe?.status===`saving`:y.state===`running`),he=!!_&&te&&!c&&!ce&&s&&(E===`explicit`||S.status!==`read_failed`&&(E===`background`||S.status===`needed`&&S.automatic)),ge=s&&le&&!ae&&!ce&&!E&&!w&&!b&&!ee&&!x&&f&&fe.success&&i.includes(fe.data.action)?fe.data:void 0,_e=$(t?.restoreCheck),ve=p&&le&&y?.state===`ready`&&!w&&!h&&!t?.result&&t?.observe!==!0&&(_e?.status===`cannot_restore`&&[`operation_busy`,`wallet_request_unsettled`].includes(String(_e.reason))||!i.includes(`settings_select`)||!i.includes(`settings_download_backup`)||t?.phase===`prepared`&&!i.includes(`settings_confirm`)||t?.phase===`draft`&&$(t.draft)?.kind!==void 0&&$(t.draft)?.kind!==`import_local_data`&&!i.includes(`settings_prepare`)),ye;!c&&_&&(S.status===`read_failed`||ae||S.status===`unconfirmed`?ye=`read`:S.status===`needed`?S.automatic||(ye=`read`):oe||re||p&&[`pending`,`failed`].includes(String(t?.temporaryFileCleanup))||pe?.status===`saving`||pe?.status===`needs_consent`&&!i.includes(`settings_store_backup`)||pe?.status===`failed`&&pe.failure===`not_published`&&!n?.endReason&&!i.includes(`settings_store_backup`)||ve?ye=`read`:g?$(t?.progress)?.status===`unavailable`||$(t?.walletAvailability)?.status===`initializing`&&$(t?.walletAvailability)?.stage===`state_sync`?ye=`read`:!x&&xe()?ye=`retry`:v&&!O&&!(x&&i.length>0)&&!(C?.input.action===`prepare_review`&&i.includes(`prepare_review`)&&t?.automaticAction===void 0)&&f&&(ye=`read`):(y?.state!==`closed`||oe)&&(ye=`read`));let be=f?t?.actionRemainingMs:y?.inputRemainingMs;ye===`retry`&&o&&(ye=`read`);let Te=f?t?.nextStateReadAfterMs:p&&we!==void 0?Math.max(0,we-D):void 0,Ee=[(f?i.length>0:y?.state===`ready`)?be:void 0,Te].filter(e=>typeof e==`number`&&Number.isFinite(e)&&e>0),De=!c&&!!g&&s&&!ie&&!ae&&S.status!==`read_failed`,Oe=$(t?.review),ke=a&&!c&&!ae&&!oe&&!v&&!b&&!x&&S.status!==`read_failed`&&(ne||w?.input.action===`prepare_review`||Oe?.preparing===!0||fe.success&&fe.data.action===`prepare_review`||S.status===`needed`&&Oe?.status===`ready_for_wallet_review`);return{current:l,inputEnabled:de,permitted:i,disposition:u,read:he,auto:ge,recover:ye,paused:x,partialDisplayFailure:re,settingsInputBlocked:ve,reviewUpdatePending:ke,reviewCommandDeliveryFailed:v&&C?.input.action===`prepare_review`,reviewHint:o?void 0:ke?ne||Oe?.preparing||w?.input.action===`prepare_review`?`Updating review…`:`Checking status…`:a&&$(Oe?.state)?.refreshReason===`review_evidence_stale`?`Review details are out of date.`:void 0,errors:[S.status===`rejected`?S.message:S.status===`read_failed`?`This card's status could not be checked. Reported message: “${S.message}”`:void 0,ae&&S.status!==`rejected`?`This card could not be opened. Reported message: “${ae}”`:void 0,v&&C?`Message for this ${Se(C)}: “${C.message}”`:void 0,oe,re?.message],note:[se,Ce(u)].filter(Boolean).join(` `),expiryAt:De&&l&&Ee.length?D+Math.min(...Ee):void 0,poll:De&&(O||S.status===`needed`&&!S.automatic),lifetimeAt:!c&&s&&a?ue:void 0}}function De(e){return e.recover===`retry`?C?.input.action===`connect`?`Retry connection`:`Retry review`:e.recover===`read`?`Check status`:void 0}function Oe(e){if(d.signal.aborted)return``;let n=e.errors.some(Boolean)||e.recover!==void 0||!!y&&!g&&y.state!==`closed`||y?.state===`closed`&&y.reason!==`completed`,r=e.errors.some(Boolean)||S.status!==`confirmed`||e.recover===`retry`||e.settingsInputBlocked;if(n&&r&&S.status!==`rejected`){if(ce||e.read)return`Checking status…`;let t=De(e);if(t)return t===`Check status`?oe||e.partialDisplayFailure?`Use Check status to read this card and try displaying it again.`:`Use Check status to read this card again.`:t===`Retry connection`?`Use Retry connection to try connecting your wallet again.`:`Use Retry review to try again with the displayed wallet and account.`;if(ke(e)&&me?.selectionHint)return me.selectionHint}return t.guidance?.(y,{confirmed:e.current,readOnly:!g,recoveryNeeded:n,visibleConfirmation:me?.visibleConfirmation?.(),commandPending:m&&w&&e.current&&!e.errors.some(Boolean)&&(w.phase===`confirming`||y?.state===`ready`&&!$(y.data)?.runtimeRecovery&&!$(y.data)?.request&&!$($(y.data)?.review)?.preparing)?{phase:w.phase,action:String(w.input.action)}:void 0,approvalUnresolved:C?.input.action===`request_signature`&&e.disposition===`active`||w?.input.action===`request_signature`,automaticPaused:e.paused})??``}function ke(e=Ee()){return e.inputEnabled&&y?.state===`ready`&&_e}function Ae(e,t=Ee()){return m&&t.inputEnabled&&(e?t.permitted.includes(e.action):t.permitted.length>0)}function je(e){let t=Ee();return p&&h&&t.current&&!!g&&!w&&!ce&&!oe&&!d.signal.aborted&&[`settings_begin_upload`,`settings_upload_chunk`,`settings_seal_upload`,`settings_retry_download`,`settings_report_download`,`settings_cancel_download`,`settings_store_backup`].includes(String(e.action))&&t.permitted.includes(e.action)}function Me(e){let u=$(y?.data),f=s.querySelector(`.review-action-feedback`),_=s.querySelector(`.review-primary-action`);if(_&&f){let e=s.querySelector(`.review-lifetime`);e?(e.append(l),f.prepend(a)):f.prepend(l,a),f.append(o)}else n.insertBefore(a,s),n.insertBefore(l,c),n.insertBefore(o,l);a.className=_?`ui-note`:`ui-error`,y?(r.textContent=t.titleFor?.(y)??t.title,i.textContent=S.status===`rejected`?`Card unavailable`:!e.current&&y.state===`ready`?_?``:!d.signal.aborted&&(ce||e.read)?`Checking whether actions are available in this card…`:`Actions are unavailable until this card's status is checked.`:!g&&y.state!==`closed`?`View only.`:m?$(u?.progress)?.status===`unavailable`?`Current progress is unavailable. The last recorded state is shown.`:!u?.request&&y.state===`closed`&&[`expired`,`server_restarted`,`cancelled`].includes(y.reason??``)?`This card no longer accepts actions.`:``:y.state===`running`?`Reading the requested data…`:y.reason===`completed`?``:y.error??(y.reason===`expired`?`The time to make a selection has ended.`:y.reason===`server_restarted`?`This request ended when Sui MCP restarted.`:``)):i.textContent=ie?``:S.status===`read_failed`?`Card status unavailable`:ae||S.status===`rejected`?`Card unavailable`:`Opening card…`,i.hidden=!i.textContent,a.textContent=[...new Set(e.errors.filter(Boolean))].join(` `),a.hidden=!a.textContent;let v=s.querySelector(`.review-status`);v&&(v.hidden=!!_&&(e.reviewUpdatePending||!!a.textContent));let b=s.querySelector(`.review-material-status`);if(b&&(b.textContent=b.dataset.previous===`true`||!e.current||e.reviewUpdatePending?b.dataset.previousLabel??``:b.dataset.currentLabel??``),o.textContent=[e.note,Oe(e)].filter(Boolean).join(` `),o.hidden=!o.textContent,_e)for(let t of s.querySelectorAll(`input, button, select`))(!m||t.tagName!==`BUTTON`||t.dataset.cardAction!==void 0)&&(t.disabled=m?!Ae(void 0,e):!ke(e));if(m)for(let t of s.querySelectorAll(`[data-card-action]`))t.disabled=!Ae({action:t.dataset.cardAction},e);if(p)for(let t of s.querySelectorAll(`[data-settings-file-action]`))t.disabled=t.dataset.settingsLocalBlocked===`true`||!(h?je({action:t.dataset.cardAction}):Ae({action:t.dataset.cardAction},e));_&&(e.reviewUpdatePending||_.dataset.cardAction===`request_signature`&&e.reviewCommandDeliveryFailed||_.dataset.cardAction===void 0)&&(_.disabled=!0),O&&(O.disabled=!!w||!!ce)}function Ne(e){try{e?.()}catch{oe=`The card display could not be closed cleanly. Its stored information is unchanged.`}}function Pe(e){if(!y||d.signal.aborted)return;if(y.state===`ready`&&S.status!==`confirmed`){if(p&&me?.update)try{me.update(y,{automaticPaused:T===`paused`,settings:Ke,settingsCommandProgress:void 0,onDisplayChange:()=>A()})}catch{oe=`This card could not be displayed. Its stored information is unchanged.`}return}if(y.state===`running`&&!m){oe=void 0;return}let n=m?{...$(y.data),actionRemainingMs:void 0,nextStateReadAfterMs:void 0,...p&&$(y.data)?.download?{download:{...$($(y.data)?.download),remainingMs:void 0}}:{}}:void 0,r=p&&w?.phase===`sending`&&S.status===`confirmed`?sS(w.basis,y,w.input):void 0,i=`${T===`paused`}:${JSON.stringify(r)}:${y.revision}:${g!==void 0}:${b!==void 0}:${x!==void 0}:${JSON.stringify(n)}`;if(i===he||i===ge&&!e)return;ge=i;let a=[...s.children],o=new Set([...s.querySelectorAll(`details`)].filter(e=>e.open).map(e=>e.querySelector(`summary`)?.textContent)),c,l=!1,u=!1;try{let e={automaticPaused:T===`paused`,onDisplayChange:()=>A(),...p?{settings:Ke,settingsCommandProgress:r}:{}};if(me?.update?.(y,e)){he=i,oe=void 0;return}if(y.state===`ready`&&g){let n=t.controls(y,e=>{We(e)},b,x,e);c=`node`in n?n:{node:n},l=!0}else(m||y.reason===`completed`)&&y.data!==void 0&&(c=t.result(y,b,g?e=>{We(e)}:void 0,x,e));s.replaceChildren(...c?[c.node]:[]),u=!0,c?.mount?.();for(let e of s.querySelectorAll(`details`))o.has(e.querySelector(`summary`)?.textContent)&&(e.open=!0)}catch{u&&s.replaceChildren(...a),Ne(c?.dispose),oe=`This card could not be displayed. Its stored information is unchanged.`;return}let f=me?.dispose;me=c,_e=l,he=i,oe=void 0,Ne(f)}function Fe(t,n,r,i,a){if(d.signal.aborted||S.status===`rejected`)return!1;if(t.kind!==e||t.cardId!==_)throw S={status:`rejected`,message:`The returned information does not match this card.`},Error(`The returned information does not match this card.`);let o=$(t.data),s=$(o?.request),c=$(s?.execution),l=o?.automaticAction===void 0?void 0:gx.safeParse(o.automaticAction);if(l&&!l.success)throw Error(`This card could not start the next step.`);if(y&&t.revision<y.revision)return!1;if(v&&[...new Set([...Object.keys(v),...Object.keys(t.input)])].some(e=>JSON.stringify(t.input[e])!==JSON.stringify(v[e])))throw S={status:`rejected`,message:`The returned information does not match this card.`},Error(`The returned information does not match this card.`);if(e===`review`&&($(o?.review)?.reviewSessionId!==void 0&&$(o?.review)?.reviewSessionId!==t.input.reviewSessionId||s&&(s.reviewSessionId!==t.input.reviewSessionId||t.input.attemptId!==void 0&&s.attemptId!==t.input.attemptId)||c&&(c.reviewSessionId!==s?.reviewSessionId||c.attemptId!==s?.attemptId||c.txDigest!==s?.transactionDigest)||$(o?.receipt)?.status===`found`&&$($(o?.receipt)?.receipt)?.txDigest!==s?.transactionDigest)||e===`receipt`&&o?.status===`found`&&$(o.receipt)?.txDigest!==t.input.digest)throw S={status:`rejected`,message:`The saved result does not match the information requested in this card.`},Error(S.message);!v&&(f||t.state!==`ready`)&&(v={...t.input});let u=r!==`preview`;if((!y||t.revision!==y.revision)&&(b=void 0,x=void 0),y=t,be(),u){D=Date.now();let t=p?$(o?.download):void 0;if(t?.availability===`available`&&typeof t.remainingMs==`number`&&Number.isFinite(t.remainingMs)){let e=`${o?.operationId}:${$(o?.file)?.fileId}:${t.expiresAt}`;Te!==e&&(Te=e,we=void 0),we=Math.min(we??1/0,D+Math.max(0,t.remainingMs))}else p&&t?.availability===`ended`&&(we=void 0);g&&e===`review`&&o?.mode===`review`&&!o.request&&typeof o.actionRemainingMs==`number`&&Number.isFinite(o.actionRemainingMs)&&o.actionRemainingMs>=0&&(ue=Math.min(ue??1/0,D+o.actionRemainingMs))}return r===`read`&&(S.status!==`needed`||a>S.afterRead)&&(S={status:`confirmed`},ae=void 0),n&&(b=n),x=i,!0}function Ie(){de!==void 0&&clearTimeout(de),fe!==void 0&&clearTimeout(fe),pe!==void 0&&clearTimeout(pe),de=void 0,fe=void 0,pe=void 0,l.hidden=!0}function Le(e){let t=De(e);O?.textContent!==t&&(O?.remove(),O=void 0,t&&(O=$h(t,()=>{if(!(ce||w||d.signal.aborted)){if(Ee().recover===`retry`){let e=xe();e&&Ue(e)}else k()}})));let n=s.querySelector(`.review-primary-action`),r=s.querySelector(`.review-primary-slot`);n&&(n.hidden=!!O&&!!r),O&&(O.disabled=!!ce||!!w,r?(O.classList.add(`review-recovery-action`),r.append(O)):(O.classList.remove(`review-recovery-action`),c.append(O)))}async function k(){let e=me,t=e?.displayRecovery?.(),n=await ze(!0);n?.kind===`accepted`&&y===n.snapshot&&S.status===`confirmed`&&!d.signal.aborted&&document.visibilityState!==`hidden`&&!oe&&e===me&&t&&e?.displayRecovery?.()===t&&(t.retry(),A())}function A(e=!1){if(ie){let e=document.createElement(`p`);e.className=`ui-note`,e.textContent=ie,s.replaceChildren(e)}else Pe(e);let t=Ee();if(Me(t),Ie(),Le(t),d.signal.aborted||S.status===`rejected`)return;t.expiryAt!==void 0&&(fe=setTimeout(()=>{Re(),A()},Math.max(0,t.expiryAt-Date.now()))),t.reviewHint&&!a.textContent&&(l.replaceChildren(),l.textContent=t.reviewHint,l.setAttribute(`role`,`status`),l.hidden=!1);let n=s.querySelector(`.review-time-remaining`);if(n&&t.lifetimeAt!==void 0){let e=t.lifetimeAt,r=()=>{if(d.signal.aborted)return;let t=Math.max(0,e-Date.now()),i=Math.ceil(t/1e3);if(n.textContent=t>0?`Review expires in ${Math.floor(i/60)}:${String(i%60).padStart(2,`0`)}`:`Review time elapsed`,t>0)pe=setTimeout(r,Math.min(1e3,t));else{let e=Ee();Me(e),Le(e)}};r()}if(t.poll&&y){let e=D+y.pollAfterMs-Date.now();de=setTimeout(()=>{ze(!1)},e>0?e:y.pollAfterMs)}t.read?(E=void 0,Be()):t.auto&&(de=setTimeout(()=>{let e=Ee().auto;e&&Ge(e,`automatic`)},0))}function Re(){S.status!==`rejected`&&S.status!==`read_failed`&&(S={status:`needed`,afterRead:le,automatic:!0})}function ze(e){return d.signal.aborted||S.status===`rejected`||!_||!te?Promise.resolve(void 0):ce?ce.promise:S.status===`read_failed`&&!e?Promise.resolve(void 0):(E=e?`explicit`:`background`,A(),ce?.promise??Promise.resolve(void 0))}function Be(){let e=++le,t=performance.now(),n={id:e,promise:Promise.resolve().then(async()=>{try{let n,r,i;if(g){let e=pS(await Ve(aS.read,g));if(!e.snapshot)throw Error(e.error??`Saved card data is unavailable.`);if(e.error)throw Error(e.error);n=e.snapshot,r=e.display,i=e.wallet}else{let e=`${$x}${encodeURIComponent(_)}`,t=(await u.readServerResource({uri:e},{signal:d.signal})).contents.find(t=>t.uri===e&&`text`in t);if(!t||!(`text`in t))throw Error(`Saved card data is unavailable.`);n=qx.parse(JSON.parse(t.text));let i=b??ee;r=i&&dS(n,i)?i:void 0}if(d.signal.aborted||S.status===`rejected`)return{kind:`disposed`,id:e};let a=Fe(n,r,`read`,i,e);return ee=void 0,!a&&S.status===`needed`&&e>S.afterRead&&(S={...S,automatic:!1}),A(a),a&&S.status===`confirmed`?{kind:`accepted`,snapshot:n,id:e,requestStartedAt:t}:{kind:`ignored`,id:e}}catch(t){return d.signal.aborted?{kind:`disposed`,id:e}:(S.status!==`rejected`&&(S={status:`read_failed`,message:t instanceof Error?t.message:`Saved card data could not be read. The last displayed result is unchanged.`}),{kind:`failed`,id:e})}}).finally(()=>{ce===n&&(ce=void 0),A()})};ce=n,A()}async function Ve(e,t){return uS(await u.callServerTool({name:e,arguments:t},{signal:d.signal}))}function He(e,t,n){let r=_x.safeParse(n.data);if(!r.success||!r.data.allowedActions.some(t=>t===e.action))return!1;let i=r.data,a=$(t.data);return e.walletRunId&&e.walletRunId!==i.walletAvailability.walletRunId?!1:e.action===`connect`?i.allowedActions.includes(`connect`)&&[`connect`,`manage`].includes(String(n.input.intent)):e.action===`prepare_review`||e.action===`request_signature`?i.review?.reviewRevision===e.reviewRevision&&(e.action===`prepare_review`?i.assetReadAccount?.status===`available`?i.assetReadAccount.account:void 0:i.review?.account)===e.account&&vx(i,String(e.account),e.action===`request_signature`).some(t=>t.connectionId===e.connectionId):e.action===`disconnect`?i.manageableConnectionIds.includes(String(e.connectionId))&&i.connections.some(t=>t.connectionId===e.connectionId&&!t.pendingAction):e.action===`use_account`?i.connections.some(t=>t.connectionId===e.connectionId&&t.status===`connected`&&!t.pendingAction&&t.connectionId===i.usableConnectionId&&t.accounts.includes(String(e.account))):i.connection?.connectionId===$(a?.connection)?.connectionId&&i.request?.attemptId===$(a?.request)?.attemptId&&i.review?.reviewRevision===$(a?.review)?.reviewRevision}async function Ue(e){if(!y||ce||!Ae(e))return;let t={input:e,basis:y,phase:`confirming`};w=t;let n=await ze(!1);w===t&&(w=void 0,n?.kind===`accepted`&&y===n.snapshot&&S.status===`confirmed`&&!d.signal.aborted&&document.visibilityState!==`hidden`&&He(e,t.basis,n.snapshot)&&Ae(e)?await Ge(e):S.status!==`read_failed`&&S.status!==`rejected`&&!d.signal.aborted&&(se=`The card state changed. Check the current selection before trying again.`),A())}async function We(e){f&&(C?.disposition===`active`||C?.retryRequired||T===`paused`)?await Ue(e):await Ge(e)}function j(e,t,n){C={input:e.input,basis:e.basis,message:t,delivery:n,disposition:`active`,retryRequired:e.input.action===`connect`||e.input.action===`prepare_review`},be(),[`cancel`,`disconnect`,`stop_connection`,`stop_waiting`,`use_account`].includes(String(e.input.action))&&(T=`paused`),(m||n===`unknown`)&&Re()}async function Ge(e,t=`user`){if(!y||!g||(t===`file`?!je(e):m?!Ae(e):!ke()))return;let n={input:e,basis:y,phase:`sending`};w=n,T=`continue`,(t===`user`||C?.disposition!==`past`)&&(C=void 0),se=void 0,A();try{let t=pS(await Ve(m?aS.act:aS.submit,{...g,revision:n.basis.revision,input:e}));if(d.signal.aborted||S.status===`rejected`)return;if(!t.snapshot)throw Error(t.error??`The request could not be confirmed.`);t.error&&j(n,t.error,`rejected`),Fe(t.snapshot,t.display,`action`,t.wallet)}catch(e){!d.signal.aborted&&S.status!==`rejected`&&(j(n,e instanceof Error?e.message:`The request could not be confirmed.`,`unknown`),C&&(C.data=$(e)?.data))}finally{w===n&&(w=void 0),A()}}let Ke={uploadChunkLimit(e,t){return g?Ux({jsonrpc:`2.0`,id:2**53-1,method:`tools/call`,params:{name:aS.act,arguments:{...g,revision:2**53-1,input:{action:`settings_upload_chunk`,operationId:e,fileId:t,offset:2**53-1,chunkBase64:``}}}})??0:0},async readCurrent(){let e=await ze(!0);if(e?.kind!==`accepted`)throw Error(`The current Settings selection could not be checked. Use Check status before continuing.`);return{snapshot:e.snapshot,requestStartedAt:e.requestStartedAt}},async act(e,t=!1){if(t?!je(e):!Ae(e))throw Error(`This Settings action is unavailable until its current status has been checked.`);if(await Ge(e,t?`file`:`user`),d.signal.aborted)throw Error(`This card closed before the request finished. Reopen the same conversation to check its status.`);if(C?.input===e){let e=Error(C.message);throw e.data=C.data,e}if(!y)throw Error(`The current Settings status could not be checked.`);return y},setFileTransferActive(e){h=e,A()},async readFile(e){if(!g||!_||!Ee().current||d.signal.aborted)throw Error(`Backup read permission is unavailable.`);let t=await Ve(aS.readSettingsFile,{...g,...e}),n=iS.parse($(t._meta)?.[Qx]);if(n.cardId!==_||n.operationId!==e.operationId||n.fileId!==e.fileId||n.offset!==e.offset||n.attemptId!==e.attemptId)throw Error(`The backup response does not match this card's selected file.`);return n},download:async(e,t,n)=>{let r=$($(y?.data)?.download);if(!g||!Ee().current||d.signal.aborted||document.visibilityState===`hidden`||r&&(r.currentAttemptId!==n||r.localSave||r.availability!==`available`||we===void 0||Date.now()>=we))throw Error(`This download is no longer available in this card.`);try{return{isError:(await u.downloadFile({contents:[{type:`resource`,resource:{uri:`file:///${encodeURIComponent(e)}`,mimeType:`application/json`,blob:t}}]},{signal:d.signal})).isError}}catch(e){if(e&&typeof e==`object`&&`code`in e&&e.code===-32601)return{unsupported:!0};throw e}}};async function qe(){if(te&&re!==void 0&&!ne){ne=!0;try{let t=uS(re),n=$(t._meta);if(t._meta!==void 0&&!n)throw Error(`This card cannot accept actions with the access information provided by the app.`);let r=n?.[Yx];if(r!==void 0){let e=tS.safeParse(r);if(!e.success)throw Error(`This card cannot accept actions with the access information provided by the app.`);g=e.data}let i=pS(t);if(i.inputRequired){if(i.inputRequired.kind!==e||g)throw Error(`The app provided inconsistent card input information.`);ie=i.inputRequired.message,A();return}let a=fS(t),o=[i.snapshot?.cardId,g?.cardId,a].filter(e=>e!==void 0);if(!o.length)throw Error(`Card data is unavailable.`);if(o.some(e=>e!==o[0])||i.snapshot&&i.snapshot.kind!==e)throw S={status:`rejected`,message:`The returned information does not match this card.`},Error(S.message);_=o[0];let s=i.snapshot;s&&(f||s.state!==`ready`)&&(v={...s.input}),ee=i.display,s&&g&&Fe(s,i.display,`preview`,i.wallet),Re(),A()}catch(e){if(d.signal.aborted)return;ae=e instanceof Error?e.message:`Card data could not be read.`,A()}}}u.ontoolresult=e=>{if(re===void 0)re=e,qe();else try{let t=pS(uS(re)).snapshot??y,n=pS(uS(e)).snapshot;if(t&&n&&(t.cardId!==n.cardId||t.kind!==n.kind))throw Error(`The app returned a different card.`)}catch{S={status:`rejected`,message:`The returned information does not match this card.`},A()}},u.onhostcontextchanged=e=>{e.theme&&(document.documentElement.dataset.theme=e.theme)};let Je=()=>{document.visibilityState!==`hidden`&&g&&ne&&S.status!==`read_failed`?ze(!1):A()};document.addEventListener?.(`visibilitychange`,Je),u.onteardown=async()=>{if(d.signal.aborted)return{};d.abort(),w=void 0,document.removeEventListener?.(`visibilitychange`,Je);let e=me?.dispose;return me=void 0,Ne(e),A(),{}},u.connect().then(()=>{d.signal.aborted||(te=!0,document.documentElement.dataset.theme=u.getHostContext()?.theme??`light`,qe())}).catch(()=>{d.signal.aborted||(ae=`Could not connect this card to the app.`,A())})}function hS(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t)}function gS(e){let t=atob(e),n=Uint8Array.from(t,e=>e.charCodeAt(0));if(hS(n)!==e)throw Error(`Part of the backup could not be read correctly.`);return n}async function _S(e,t,n,r,i){if(e.size>16777216)throw Error(`This backup exceeds the 16 MiB limit. Choose a smaller backup.`);let a=n();t.setFileTransferActive(!0);try{r()&&i?.({...a,stage:`reading`});let n=new Uint8Array(await e.arrayBuffer()),o=r_(tv(n));if(!r())return;i?.({...a,stage:`receiving`,sha256:o});let s=await t.act({action:`settings_begin_upload`,operationId:a.operationId,name:e.name,totalSize:n.length,sha256:o},!0),c=zx.parse(s.data),l=c.file?.receivedSize??0,u=c.file?.fileId;if(!u||c.operationId!==a.operationId||c.file?.sha256!==o||c.file.totalSize!==n.length)throw Error(`The file being received does not match your selection. Choose the backup file again.`);r()&&i?.({...a,stage:`receiving`,fileId:u,sha256:o});let d=t.uploadChunkLimit(a.operationId,u);for(;r()&&l<n.length;){if(d<1)throw Error(`This app cannot send the backup within its message size limit. Try opening Settings in another supported app.`);let e=Math.min(d,n.length-l),r={action:`settings_upload_chunk`,operationId:a.operationId,fileId:u,offset:l,chunkBase64:hS(n.subarray(l,l+e))};try{s=await t.act(r,!0)}catch(n){let r=n&&typeof n==`object`&&`data`in n?n.data:void 0;if(r?.code!==`settings_payload_too_large`||typeof r.rawChunkLimit!=`number`||!Number.isSafeInteger(r.rawChunkLimit)||r.rawChunkLimit<1||r.rawChunkLimit>=e)throw n;let i=zx.parse((await t.readCurrent()).snapshot.data);if(i.file?.fileId!==u||i.file.receivedSize!==l)throw Error(`The file transfer changed after a message was rejected. Choose the same file again to check how much was received.`);d=r.rawChunkLimit;continue}if(c=zx.parse(s.data),c.operationId!==a.operationId||c.file?.fileId!==u||c.file.sha256!==o||c.file.receivedSize!==l+e)throw Error(`The file transfer could not be confirmed. Choose the same file again to continue.`);l=c.file.receivedSize}r()&&(i?.({...a,stage:`checking`,fileId:u,sha256:o}),await t.act({action:`settings_seal_upload`,operationId:a.operationId,fileId:u},!0))}finally{t.setFileTransferActive(!1)}}async function vS(e,t,n,r){n(`pending`);let i;try{i=new Uint8Array(e.totalSize);let n=0;for(;n<i.length&&r();){let r=await t.readFile({operationId:e.operationId,fileId:e.fileId,offset:n,...e.attemptId?{attemptId:e.attemptId}:{}}),a=gS(r.chunkBase64);if(r.totalSize!==i.length||r.sha256!==e.sha256||!a.length||n+a.length>i.length)throw Error(`Part of the downloaded backup does not match the original file.`);i.set(a,n),n+=a.length}if(!r())return;if(n!==i.length||r_(tv(i))!==e.sha256)throw Error(`The complete downloaded backup could not be checked against the original file.`)}catch{if(e.attemptId&&r())try{await t.readCurrent()}catch{}return r()&&n(`backup_unverified`),`backup_unverified`}if(e.attemptId)try{let n=await t.readCurrent(),i=zx.parse(n.snapshot.data);if(!r()||i.operationId!==e.operationId||i.file?.fileId!==e.fileId||i.file.sha256!==e.sha256||i.file.totalSize!==e.totalSize||i.download?.currentAttemptId!==e.attemptId||i.download.localSave||i.download.availability!==`available`||!i.download.remainingMs)return;if(i.download.remainingMs<=Math.max(0,performance.now()-n.requestStartedAt)){try{await t.readCurrent()}catch{}return}}catch{return r()&&n(`backup_unverified`),`backup_unverified`}try{if(!r())return;let a=await(e.attemptId?t.download(e.displayName,hS(i),e.attemptId):t.download(e.displayName,hS(i))),o=a.unsupported===!0?`unsupported`:a.isError===!0?`not_completed`:`acknowledged`;return r()&&n(o),o}catch{return r()&&n(`unconfirmed`),`unconfirmed`}}var yS={set_endpoint:`Change network address`,restore_endpoint:`Use default network address`,clear_read_address:`Clear default address`,download_backup:`Backup`,export_local_data:`Backup`,import_local_data:`Restore`,reset_local_data:`Reset`,restart_wallet_service:`Connection service restart`},bS={overview:`Settings`,address:`Address for viewing assets`,records:`Local records`,troubleshooting:`Troubleshooting`,advanced:`Advanced settings`},xS={address:`View or clear the address used by default when checking your assets.`,records:`Back up, restore or delete records saved on this computer.`,troubleshooting:`Check or restart the wallet connection service.`,advanced:`Change the Sui network addresses used to retrieve data and send transactions.`},SS=`Local records are saved addresses, reviews, transaction and activity records, and Sui network settings on this computer. They do not include wallet keys, wallet connections or wallet approvals.`,CS=`Fully quit every app using Sui MCP, then reopen them. Closing a window or quitting only one app may leave Sui MCP running.`,wS={available:`Ready`,initializing:`Starting`,recovering:`Restarting`,unavailable:`Unavailable`},TS={environment:`App launch settings`,local_db:`Saved in Sui MCP`,builtin_default:`Built-in default`},ES={connected:`Connected`,awaiting_approval:`Waiting for wallet approval`,rejected:`Rejected`,failed:`Failed`,expired:`Expired`,stopped:`Stopped`,disconnected:`Disconnected`},DS=[[`accounts`,`Saved addresses`],[`reviewSessions`,`Reviews`],[`reviewRequests`,`Transaction requests`],[`outcomeUnknownRequests`,`Transaction requests with unconfirmed results`],[`externalActivityTransactions`,`Activity records`],[`localSettings`,`Saved network settings`]],OS={set_endpoint:`Save network address?`,restore_endpoint:`Use default network address?`,clear_read_address:`Clear the default address for viewing assets?`,download_backup:`Download backup`,export_local_data:`Back up local records?`,import_local_data:`Restore available`,reset_local_data:`Reset local data?`,restart_wallet_service:`Restart connection service?`},kS={set_endpoint:`Save network address`,restore_endpoint:`Use default network address`,clear_read_address:`Clear default address`,download_backup:`Download backup`,export_local_data:`Create backup`,import_local_data:`Restore local records`,reset_local_data:`Reset local data`,restart_wallet_service:`Restart connection service`};function AS(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function jS(e){return e===`clear_read_address`?`address`:e===`set_endpoint`||e===`restore_endpoint`?`advanced`:e===`restart_wallet_service`?`troubleshooting`:e?`records`:`overview`}function MS(e,t,n){let r=AS(t);e.append(J(`h3`,void 0,n));for(let[t,n]of DS)typeof r[t]==`number`&&e.append(Y(n,String(r[t])))}function NS(e,t,n){let r=zx.parse(e.data),i=e,a=r.draft?{kind:`operation`,operation:r.draft.kind}:{kind:`section`,page:`overview`},o=!1,s=n?.settings,c=n?.onDisplayChange,l,u=!1,d,f=n?.settingsCommandProgress,p,m,h,g,_,v=J(`div`,`settings-card`),y=(e,n,r=`secondary`)=>{let i=$h(e,()=>{!o&&!u&&t?.(n)},r);return i.dataset.cardAction=String(n.action),i},b=(e,t)=>{let n=$h(e,()=>{if(o)return;let e=a.kind===`section`?a.page:jS(a.operation);a=t,C(),(t.kind===`section`&&t.page===`overview`?[...v.querySelectorAll(`.settings-menu-item`)].find(t=>t.dataset.settingsPage===e):v.querySelector(`.settings-back`))?.focus(),c?.()},`secondary`);return n.setAttribute(`aria-label`,e),n.dataset.settingsPage=t.kind===`section`?t.page:jS(t.operation),n},ee=(e,n,i=!1,s=!1)=>{let d=$h(e,()=>{o||u||(!s&&r.draft&&JSON.stringify(r.draft)===JSON.stringify(n)?(a={kind:`operation`,operation:n.kind},C(),c?.()):(l=void 0,t?.({action:`settings_select`,draft:n})))},i?`danger`:`secondary`);return d.dataset.cardAction=`settings_select`,d};function x(e,t,n){let r=J(`div`,`settings-choice`),i=J(`div`,`settings-choice-copy`);return i.append(J(`h3`,void 0,e),J(`p`,`ui-note`,t)),r.append(i,n),r}function te(e){let t=J(`div`,`settings-action-row`);return t.setAttribute(`aria-label`,`Settings operation actions`),t.append(e),t}async function ne(){if(!s||!m||o)return;let e=m;h=void 0,s.setFileTransferActive(!0);try{await s.act({action:`settings_report_download`,...e},!0),m===e&&(m=void 0)}catch{!o&&m===e&&(h={message:`The download response could not be recorded. Check status to record the same response without downloading again.`,retry:()=>{m===e&&ne()}})}finally{o||(s.setFileTransferActive(!!p),C(),c?.())}}function re(){let e=p;if(!s||o||!e||e.phase!==`waiting`||r.download?.availability!==`available`||r.download.localSave||r.download.currentAttemptId!==e.attemptId||!r.file)return;e.phase=`sending`;let t={operationId:r.operationId,...r.file,attemptId:e.attemptId};vS(t,s,t=>{p!==e||o||(d=t,C(),c?.())},()=>!o&&p===e&&document.visibilityState!==`hidden`&&r.download?.currentAttemptId===e.attemptId&&r.download.availability===`available`).then(async e=>{!o&&e&&[`acknowledged`,`not_completed`,`unconfirmed`,`unsupported`].includes(e)&&(m={operationId:t.operationId,fileId:t.fileId,attemptId:t.attemptId,status:e,...e===`unsupported`?{failure:{method:`ui/download-file`,code:-32601}}:{}},await ne())}).finally(()=>{p===e&&(p=void 0,u=!1),o||(s?.setFileTransferActive(!!p),C(),c?.())})}function ie(e){if(!s||!t||o||p||u)return;let n=crypto.randomUUID(),i={attemptId:n,phase:`admitting`},a=e&&r.file&&r.download?{action:`settings_retry_download`,operationId:r.operationId,fileId:r.file.fileId,previousAttemptId:r.download.currentAttemptId,attemptId:n}:{action:`settings_download_backup`,operationId:r.operationId,attemptId:n};p=i,u=!0,d=void 0,m=void 0,h=void 0,C(),c?.(),e&&s.setFileTransferActive(!0),s.act(a,e).then(()=>{o||p!==i||(i.phase=`waiting`,s?.setFileTransferActive(!0),C(),c?.(),re())}).catch(()=>{p===i&&(p=void 0,u=!1),o||(s?.setFileTransferActive(!1),C(),c?.())})}function S(e,t,n,r=!1){let i=$h(e,n,`secondary`);return i.dataset.cardAction=t,t!==`settings_download_backup`&&(i.dataset.settingsFileAction=`true`),r&&(i.dataset.settingsLocalBlocked=`true`),i.disabled=r,i}function ae(e){let n=r.download,i=r.draft?.kind===`download_backup`?r.file:void 0;if(!oe(e)){let r=n?.endReason===`acknowledged`?`Download requested`:n?.endReason===`cancelled`?`Download cancelled`:n?.endReason?`Download ended`:p?n?.availability===`available`?`Downloading backup…`:`Preparing backup…`:n?.hostReport===`not_completed`?`Download not completed`:n?.hostReport===`unconfirmed`?`Download unconfirmed`:`Backup ready`;e.append(J(`h2`,void 0,r)),n?.endReason===`acknowledged`?e.append(J(`p`,`ui-note`,`The app accepted the download request. This does not confirm that the file was saved or where it was saved.`)):n?.endReason===`cancelled`?e.append(J(`p`,`ui-note`,`No further download will be sent from this request. This does not close a save dialog or delete a file already saved by the app.`)):n?.endReason?e.append(J(`p`,`ui-note`,n.endReason===`expired`?`The time to download this backup has ended. Open a new Settings card to download the current records.`:`This backup can no longer be downloaded. Open a new Settings card to try again.`)):n?.hostReport===`not_completed`?e.append(J(`p`,`ui-note`,`The app did not complete the download request. It did not report whether it was cancelled, refused or failed.`)):(n?.hostReport===`unconfirmed`||n?.previousUnconfirmed||!p&&!m&&n?.availability===`available`&&!n.hostReport&&d!==`backup_unverified`)&&e.append(J(`p`,`ui-note`,`The previous download could not be confirmed.`+(t&&n?.allowedFileActions.includes(`settings_retry_download`)?` Retrying may save another copy if the app already handled it.`:``))),d===`backup_unverified`&&e.append(J(`p`,`ui-note`,`The backup could not be read or checked. Nothing was sent to the app for download.`)),i?.sealed&&(e.append(Y(`Suggested file name`,i.displayName),Y(`File size`,`${i.totalSize.toLocaleString(`en-US`)} bytes`)),i.totalSize>16777216&&e.append(J(`p`,`ui-note`,`This backup exceeds the 16 MiB restore limit.`))),t&&s&&n?.allowedFileActions.includes(`settings_retry_download`)&&e.append(S(`Retry download`,`settings_retry_download`,()=>ie(!0),!!p||!!m))}t&&s&&r.file&&n?.allowedFileActions.includes(`settings_cancel_download`)&&e.append(S(`Cancel download`,`settings_cancel_download`,()=>{if(!s||o||!r.file||!r.download)return;p=void 0,u=!1,d=void 0;let e={action:`settings_cancel_download`,operationId:r.operationId,fileId:r.file.fileId,attemptId:r.download.currentAttemptId};s.setFileTransferActive(!0),s.act(e,!0).catch(()=>{}).finally(()=>{o||(s?.setFileTransferActive(!1),C(),c?.())})})),(r.temporaryFileCleanup===`pending`||r.temporaryFileCleanup===`failed`)&&e.append(J(`p`,`ui-error`,`Temporary-file cleanup has not been confirmed. Use Check status to check the same request.`)),!t&&n?.localSave?.status!==`saved`?e.append(J(`p`,`ui-note`,`To download a backup, ask in chat to open a new Settings card.`)):n?.availability===`ended`&&e.append(J(`p`,`ui-note`,`To download the current records again, ask in chat to open a new Settings card.`))}function oe(e){let n=r.download,i=n?.localSave,a=r.file;if(!n||!i||i.status!==`saved`&&i.status!==`saving`&&n.endReason&&n.endReason!==`local_save_failed`)return!1;if(e.append(J(`h2`,void 0,i.status===`saved`?`Backup saved`:i.status===`saving`?`Saving backup…`:i.status===`needs_consent`?`Save a local copy?`:`Backup not saved`)),i.status===`saved`&&r.backupLocation){let t=J(`div`,`settings-backup-location`);t.append(Y(`Folder`,J(`span`,`settings-path`,r.backupLocation.directory)),Y(`File name`,J(`span`,`settings-path`,r.backupLocation.filename))),e.append(J(`p`,`ui-note`,`The backup was saved in the Sui MCP backup folder on this computer.`),t)}else i.status===`saving`?e.append(J(`p`,`ui-note`,`Wait while this backup is saved and checked. Use Check status to check the same request.`)):i.status===`failed`&&e.append(J(`p`,`ui-error`,i.failure===`target_conflict`?`The backup location already contains an item or could not be verified. It has not been replaced.`:i.failure===`not_published`?`The backup could not be saved. You can retry saving the same backup.`:`The backup could not be verified for saving. Open a new Settings card to try again.`));return i.status!==`saved`&&i.status!==`saving`&&n.previousUnconfirmed&&e.append(J(`p`,`ui-note`,`An earlier request may already have saved this backup. Saving a local copy may leave another copy.`)),a&&(i.status!==`saved`&&e.append(Y(`Suggested file name`,a.displayName)),e.append(Y(`File size`,`${a.totalSize.toLocaleString(`en-US`)} bytes`)),a.totalSize>16777216&&e.append(J(`p`,`ui-note`,`This backup exceeds the 16 MiB restore limit.`))),t&&s&&n.allowedFileActions.includes(`settings_store_backup`)&&e.append(S(i.status===`needs_consent`?`Save a local copy`:`Retry save`,`settings_store_backup`,()=>{if(!s||o||u||!r.file||!r.download)return;let e=r.download.localSave,t={action:`settings_store_backup`,operationId:r.operationId,fileId:r.file.fileId,attemptId:r.download.currentAttemptId,saveAttemptId:crypto.randomUUID(),allowPossibleCopy:r.download.previousUnconfirmed,...e?.currentSaveAttemptId?{previousSaveAttemptId:e.currentSaveAttemptId}:{}};u=!0,s.setFileTransferActive(!0),C(),c?.(),s.act(t,!0).catch(()=>{}).finally(()=>{u=!1,o||(s?.setFileTransferActive(!1),C(),c?.())})},u)),!0}function se(e,t,n,i){let a=ag(`Details`);if(r.facts&&a.body.append(Y(`Version`,r.facts.server.version)),a.body.append(Y(`Settings request ID`,og(r.operationId))),i&&i.kind===r.draft?.kind&&r.file&&a.body.append(Y(`File SHA-256`,og(r.file.sha256))),i&&[`export_local_data`,`download_backup`,`import_local_data`,`reset_local_data`].includes(i.kind)&&a.body.append(J(`p`,`ui-note`,`Local backups do not contain wallet keys, wallet connections, wallet approvals, access granted to cards, transaction bytes or signatures.`)),i?.kind===`import_local_data`&&r.preparation?.preview){let e=AS(r.preparation.preview);MS(a.body,e.currentCounts,`Checked local records`),MS(a.body,e.incomingCounts,`Backup records`),a.body.append(Y(`Default address before restoring`,typeof e.currentReadAddress==`string`?og(e.currentReadAddress):`Not selected`),Y(`Default address in this backup`,typeof e.incomingReadAddress==`string`?og(e.incomingReadAddress):`Not selected`))}if(t===`advanced`&&r.facts)for(let[e,t,n]of[[`grpc`,`Sui node`,r.facts.localSettings.suiGrpcUrl],[`graphql`,`Activity data`,r.facts.localSettings.suiGraphqlUrl]])(!i||i.kind!==`set_endpoint`&&i.kind!==`restore_endpoint`||i.endpoint===e)&&(a.body.append(J(`h3`,void 0,t),Y(`Saved network address`,n.storedValue),Y(`Network address in use`,n.effectiveValue),Y(`Set by`,TS[n.source])),n.pendingStoredValue&&a.body.append(Y(`Network address saved for next restart`,n.pendingStoredValue)));if(n){a.body.append(J(`h3`,void 0,`Connection and transaction request records`)),typeof r.preparation?.walletRunId==`string`&&a.body.append(Y(`Service run ID`,og(r.preparation.walletRunId)));for(let e of n.connections)a.body.append(Y(`${e.walletName??`Wallet`} connection ID`,og(e.connectionId)));for(let e of n.requests)a.body.append(Y(`Transaction request ID`,og(e.attempt_id)),Y(`Recorded request status`,e.request_status))}e.append(a.details)}function C(e=!1){let n=v.querySelector(`details`)?.open===!0,m=e?[...v.querySelectorAll(`input`)].filter(e=>e.type!==`file`).map(e=>e.value):void 0,h=ig(),ne=f&&i.state===`ready`&&f.cardId===i.cardId&&f.operationId===r.operationId&&(f.kind===`backup_check_response`?r.draft?.kind===`import_local_data`&&f.fileId===r.file?.fileId:JSON.stringify(f.draft)===JSON.stringify(r.draft))?f:void 0,re=r.result||r.restoreCheck?.status===`can_restore`||r.restoreCheck?.status===`cannot_restore`&&[`invalid_backup`,`file_unavailable`,`input_unavailable`].includes(r.restoreCheck.reason),oe=r.restoreCheck?.status===`checking`||!re&&(ne?.kind===`backup_check_response`||_?.progress?.stage===`checking`),w=[`executing`,`stopping`,`starting`].includes(r.phase)||oe,T=r.draft?.kind===`import_local_data`&&r.restoreCheck?.status===`can_restore`,ce=p?.phase===`admitting`,E=ce?`progress`:r.result?`result`:w?`progress`:a.kind===`section`?`section`:r.phase===`prepared`&&(r.draft?.kind!==`import_local_data`||T)?`confirmation`:`input`,le=a.kind===`section`?a.page:jS(a.operation),D=ce?{kind:`download_backup`}:E===`section`?void 0:r.draft,ue=D?jS(D.kind):le,de=D?.kind===`restart_wallet_service`&&r.preparation?.impact?G_.parse(r.preparation.impact):void 0,fe=E===`result`||E===`progress`?g??2:E===`confirmation`?3:E===`input`?2:ue===`overview`?0:1;h.classList.add(`settings-page`),g!==void 0&&fe!==g&&h.classList.add(fe>g?`settings-page--forward`:`settings-page--back`),g=fe;let pe=J(`nav`,`settings-toolbar`);if(pe.setAttribute(`aria-label`,`Settings navigation`),v.dataset.settingsPage=ue,E===`confirmation`&&D&&t&&r.allowedActions.includes(`settings_back`)){let e=`Back to ${yS[D.kind]}`,n=$h(e,()=>{o||u||(a={kind:`operation`,operation:D.kind},t({action:`settings_back`,operationId:r.operationId}))},`secondary`);n.dataset.cardAction=`settings_back`,n.setAttribute(`aria-label`,e),n.classList.add(`settings-back`),pe.append(n)}else if(E===`input`&&D&&t){let e=b(`Back to ${bS[ue]}`,{kind:`section`,page:ue});e.classList.add(`settings-back`),pe.append(e)}else if(E===`section`&&ue!==`overview`){let e=b(`Back to Settings`,{kind:`section`,page:`overview`});e.classList.add(`settings-back`),pe.append(e)}let O=J(`span`,`settings-location`,[`Settings`,...ue===`overview`?[]:[bS[ue]],...D?[yS[D.kind]]:[],...E===`result`?[`Result`]:E===`progress`?[D?.kind===`download_backup`?`Downloading`:oe?`Checking backup`:`Applying change`]:E===`confirmation`?[`Confirm`]:[]].join(` / `));if(O.setAttribute(`aria-current`,`page`),pe.append(O),h.append(pe),D?.kind===`download_backup`)ae(h);else if(E===`result`&&r.result){h.append(J(`p`,r.result.outcome===`failed`?`ui-error`:`ui-note`,r.result.message));let e=AS(r.result.details);if(typeof e.storedValue==`string`&&(h.append(Y(e.endpoint===`grpc`?`Saved Sui node address (gRPC)`:`Saved activity data address (GraphQL)`,e.storedValue)),typeof e.effectiveValueAtSave==`string`&&h.append(Y(`Network address in use when saved`,e.effectiveValueAtSave)),h.append(J(`p`,`ui-note`,e.effectiveSourceAtSave===`environment`?`When this address was saved, the app launch settings specified the network address in use. If that setting is still present, restarting will keep using it. Remove that launch setting before restarting to use the saved address.`:`The saved address is used after Sui MCP restarts, unless the app launch settings specify another address.`),J(`p`,`ui-note`,CS))),typeof e.path==`string`){if(r.backupLocation){let e=J(`div`,`settings-backup-location`);e.append(Y(`Folder`,J(`span`,`settings-path`,r.backupLocation.directory)),Y(`File name`,J(`span`,`settings-path`,r.backupLocation.filename))),h.append(e)}if(r.file){if(h.append(Y(`File size`,`${r.file.totalSize.toLocaleString(`en-US`)} bytes`)),r.file.totalSize>16777216&&h.append(J(`p`,`ui-note`,`This backup exceeds the 16 MiB restore limit. The entire backup was saved, but this installation cannot restore a file this large.`)),t&&s){let e=$h(`Download this backup`,()=>{!o&&s&&r.file&&!u&&(u=!0,e.disabled=!0,vS({operationId:r.operationId,...r.file},s,e=>{d=e,C(),c?.()},()=>!o).finally(()=>{u=!1,o||(C(),c?.())}))},`secondary`);e.dataset.settingsDownload=`true`,e.disabled=u,h.append(e)}d&&h.append(J(`p`,`ui-note`,{pending:`Checking the backup before downloading…`,backup_unverified:`The backup file could not be read or checked. Nothing was sent to the app for download. Check the folder shown above, or open a new Settings card to create another backup.`,acknowledged:`The app received the download request. This does not confirm that the file was saved or where it was saved.`,not_completed:`The app did not complete the download request. It did not report whether the download was cancelled, refused or failed. The file passed its check before the request.`,unsupported:`This app cannot receive this file. The existing backup remains in the folder shown above.`,unconfirmed:`The download could not be confirmed. You can try Download this backup again; the same file will be checked before it is sent.`}[d]))}}let n=r.temporaryFileCleanup??r.file?.cleanup;(n===`failed`||n===`pending`)&&h.append(J(`p`,`ui-error`,`Temporary-file cleanup has not been confirmed. The result above is unchanged. Use Check status to check again.`)),h.append(J(`p`,`ui-note`,`To make another change, ask in chat to open a new Settings card.`))}else if(E===`progress`){let e=J(`p`,`ui-note`,oe?`Checking backup…`:r.phase===`stopping`?`Stopping the wallet connection service…`:r.phase===`starting`?`Starting the wallet connection service…`:`Finishing this change…`);e.setAttribute(`role`,`status`),h.append(e),r.phase===`starting`&&h.append(J(`p`,`ui-note`,`If the service is not responding, you can request another restart in a new Settings card under Troubleshooting. This card keeps the result of the current restart.`))}else if(E===`confirmation`&&r.draft){if(h.append(J(`h2`,void 0,OS[r.draft.kind])),T&&r.file&&h.append(Y(`Backup file`,r.file.displayName)),r.draft.kind===`set_endpoint`||r.draft.kind===`restore_endpoint`){let e=AS(r.preparation?.endpoint);h.append(Y(`Setting`,r.draft.endpoint===`grpc`?`Sui node (gRPC)`:`Activity data (GraphQL)`)),typeof e.storedValue==`string`&&h.append(Y(`Previously saved network address`,e.storedValue)),typeof e.value==`string`&&h.append(Y(`Network address to save`,e.value)),h.append(J(`p`,`ui-note`,`Sui MCP checks that this address connects to Sui mainnet before saving it. Fully quit and reopen all apps using Sui MCP to use the change. Restarting only the wallet connection service does not apply it.`)),e.source===`environment`&&h.append(J(`p`,`ui-note`,`The app launch settings specify the network address to use. Restarting without removing that launch setting will keep using that address.`))}if(r.draft.kind===`clear_read_address`&&h.append(J(`p`,`ui-note`,`Clear the address used by default when viewing assets. This does not disconnect your wallet or cancel any transaction.`)),[`export_local_data`,`reset_local_data`].includes(r.draft.kind)&&h.append(J(`p`,`ui-note`,SS)),r.draft.kind===`reset_local_data`||r.draft.kind===`import_local_data`){T?h.append(J(`p`,`ui-error`,`Restoring replaces local records and saved network settings, including records with unconfirmed transaction results. You cannot undo this from this card. Other open cards will no longer work; open new cards after restoring.`),J(`p`,`ui-note`,`Wallet keys and approvals are not restored. Transactions on Sui are not cancelled.`)):(h.append(J(`p`,`ui-error`,`This deletes local records and saved settings, including records whose transaction results are still unconfirmed. It does not cancel transactions on Sui. Data cannot be replaced until pending wallet or transaction responses and the initial result-checking period have ended.`)),h.append(J(`p`,`ui-error`,`You cannot undo this from this card. Other open cards will no longer work. You can still read this change's result.`)));let e=AS(r.preparation?.preview);if(r.draft.kind===`import_local_data`){let t=AS(e.currentCounts),n=AS(e.incomingCounts);h.append(J(`h3`,void 0,`Records to replace (now → backup)`));for(let[e,r]of DS)typeof t[e]==`number`&&typeof n[e]==`number`&&(t[e]!==0||n[e]!==0)&&h.append(Y(r,`${t[e]} → ${n[e]}`));typeof t.outcomeUnknownRequests==`number`&&t.outcomeUnknownRequests>0&&h.append(J(`p`,`ui-error`,`The current records with unconfirmed transaction results will be removed.`)),e.activeAccountChange!==`unchanged`&&h.append(Y(`Default address for viewing assets`,e.activeAccountChange===`cleared`?`Will be cleared`:typeof e.incomingReadAddress==`string`?og(e.incomingReadAddress):`Not selected`)),e.restartRequiredAfterImport===!0&&h.append(J(`p`,`ui-note`,`After restoring, fully quit and reopen all apps using Sui MCP. Network addresses specified in the app launch settings still take priority over the restored settings.`)),h.append(J(`p`,`ui-note`,`Restoring a saved address does not reconnect your wallet. It can be used by default for viewing assets only when the same wallet connection is active and approves that address.`))}else MS(h,r.preparation?.counts,`Current local records`)}if(r.draft.kind===`restart_wallet_service`){h.append(J(`p`,`ui-note`,`The wallet connection service restarts while your apps stay open. Pending wallet approvals can no longer send a transaction, and unfinished review checks stop. Transactions already sent to Sui are not cancelled; checks already in progress continue. Restarting does not confirm a failed disconnection or remove the connection from your wallet app.`));let e=de??G_.parse(r.preparation?.impact);h.append(Y(`Wallet connection records`,String(e.connections.length)),J(`p`,`ui-note`,`These are recorded connections, not confirmation that a wallet is connected now. Restarting does not reconnect a disconnected wallet.`));for(let t of e.connections){h.append(Y(`Wallet`,t.walletName??`Wallet`),Y(`Recorded status`,ES[t.status]));for(let e of t.accounts)h.append(Y(`Recorded wallet address`,og(e)));t.disconnectPending&&h.append(J(`p`,`ui-note`,`This wallet's disconnection has not been confirmed.`))}let t=e.requests.filter(e=>e.request_status===`awaiting_signature`).length;h.append(Y(`Wallet approval requests to stop`,String(t)),Y(`Other transaction requests`,String(e.requests.length-t)))}t&&r.allowedActions.includes(`settings_confirm`)?h.append(te(y(kS[r.draft.kind],{action:`settings_confirm`,operationId:r.operationId,preparationId:r.preparationId},[`reset_local_data`,`import_local_data`].includes(r.draft.kind)?`danger`:`primary`))):t&&h.append(J(`p`,`ui-note`,`This change cannot be confirmed right now.`))}else if(D){let e;if(h.append(J(`h2`,void 0,yS[D.kind])),ue===`records`&&h.append(J(`p`,`ui-note`,SS)),D.kind===`import_local_data`){if(r.restoreCheck?.status===`cannot_restore`){let e=J(`p`,`ui-error`,r.restoreCheck.message);e.setAttribute(`role`,`alert`),h.append(J(`h3`,void 0,`Cannot restore`),e)}else r.restoreCheck?.status===`check_required`&&h.append(J(`p`,`ui-note`,r.restoreCheck.message));if(_?.progress&&!oe&&!re){let e=J(`p`,`ui-note`,_.progress.stage===`reading`?`Reading the selected file…`:`Receiving backup…`);e.setAttribute(`role`,`status`),h.append(e)}let n=ng({type:`file`});n.accept=`.json,application/json`,n.dataset.cardAction=`settings_begin_upload`,n.addEventListener(`change`,()=>{let e=n.files?.[0];if(!e||!s||u||o)return;let t={startingRevision:i.revision,progress:void 0};_=t,u=!0,l=void 0,_S(e,s,()=>({operationId:r.operationId,cardId:i.cardId}),()=>!o&&_===t,e=>{o||_!==t||e.operationId!==r.operationId||e.cardId!==i.cardId||(t.progress=e,C(),c?.())}).then(()=>{!o&&_===t&&(l=void 0)}).catch(e=>{!o&&_===t&&(l={cardId:i.cardId,operationId:r.operationId,revision:i.revision,draft:JSON.stringify(r.draft),fileId:r.file?.fileId,message:e instanceof Error?e.message:`The file transfer could not be confirmed. Choose the file again to continue.`})}).finally(()=>{_===t&&(_=void 0),u=!1,o||(C(),c?.())})}),t&&!r.file?.sealed&&h.append(rg(r.file?`Choose the same file to continue`:`Choose a Sui MCP backup (up to 16 MiB)`,n)),r.file&&(h.append(Y(`Selected file`,r.file.displayName),Y(`File received`,`${r.file.receivedSize.toLocaleString(`en-US`)} / ${r.file.totalSize.toLocaleString(`en-US`)} bytes`)),t&&r.allowedActions.includes(`settings_prepare`)&&(e=y(`Check backup again`,{action:`settings_prepare`,operationId:r.operationId},`primary`)),t&&h.append(ee(`Change backup file`,{kind:`import_local_data`},!1,!0)))}else{if(D.kind===`set_endpoint`||D.kind===`restore_endpoint`){let e=D.endpoint===`grpc`?r.facts?.localSettings.suiGrpcUrl:r.facts?.localSettings.suiGraphqlUrl;h.append(Y(`Network setting`,D.endpoint===`grpc`?`Sui node (gRPC)`:`Activity data (GraphQL)`)),e&&h.append(Y(`Current saved address`,e.storedValue)),D.kind===`set_endpoint`?h.append(Y(`Selected network address`,D.value)):h.append(J(`p`,`ui-note`,`Review the built-in default address before confirming this change.`)),e?.source===`environment`&&h.append(J(`p`,`ui-note`,`The app launch settings specify the network address in use. Saving or restoring an address here does not remove that launch setting.`))}else D.kind===`clear_read_address`?h.append(Y(`Default address for viewing assets`,r.facts?.readAddress?og(r.facts.readAddress):`Not selected`),J(`p`,`ui-note`,`Clearing this default does not disconnect your wallet or change wallet approvals.`)):D.kind===`restart_wallet_service`?(r.facts&&h.append(Y(`Wallet connection service`,wS[r.facts.walletAvailability.status])),r.facts?.connectionReconciliationRequired&&h.append(J(`p`,`ui-error`,J_)),r.facts&&r.facts.walletAvailability.status!==`available`&&h.append(J(`p`,`ui-note`,r.facts.walletAvailability.message)),h.append(J(`p`,`ui-note`,`Review the connection and transaction requests affected before confirming a service restart.`))):D.kind===`export_local_data`?h.append(J(`p`,`ui-note`,`Review the local records to save, then create the backup file.`)):D.kind===`reset_local_data`&&h.append(J(`p`,`ui-note`,`Review the records and saved settings to delete before confirming the reset.`));t&&r.allowedActions.includes(`settings_prepare`)&&(e=y(`Continue`,{action:`settings_prepare`,operationId:r.operationId},`primary`))}e&&h.append(te(e))}else{if(h.append(J(`h2`,void 0,le===`overview`?`Choose a section`:bS[le])),le===`overview`){h.append(J(`p`,`ui-note`,`You can use the default Sui mainnet network settings. Custom settings are optional.`)),r.facts?.connectionReconciliationRequired&&h.append(J(`p`,`ui-error`,J_));let e=r.facts?.walletAvailability;e&&e.status!==`available`&&h.append(J(`p`,e.status===`unavailable`?`ui-error`:`ui-note`,e.message),...e.status===`unavailable`?[J(`p`,`ui-note`,`Open Troubleshooting below to check the connection service.`)]:[]);let t=J(`div`,`settings-menu`);t.setAttribute(`aria-label`,`Settings sections`);for(let e of[`address`,`records`,`troubleshooting`,`advanced`]){let n=b(bS[e],{kind:`section`,page:e});n.classList.add(`settings-menu-item`),n.setAttribute(`aria-label`,bS[e]),n.textContent=``,n.append(J(`span`,`settings-menu-title`,bS[e]),J(`span`,`settings-menu-description`,xS[e])),t.append(n)}if(h.append(t),r.draft){let e=J(`div`,`settings-pending`);e.append(J(`p`,`ui-note`,`Unfinished change: ${yS[r.draft.kind]}.`),b(`Resume`,{kind:`operation`,operation:r.draft.kind})),h.append(e)}}else if(le===`address`)h.append(Y(`Default address for viewing assets`,r.facts?.readAddress?og(r.facts.readAddress):`Not selected`)),r.facts?.assetReadAccount.status===`address_required`&&r.facts.readAddress&&h.append(J(`p`,`ui-note`,`This saved address cannot currently be used by default. Provide an address in chat, or open Wallet connection and select an address approved by your connected wallet.`)),h.append(J(`p`,`ui-note`,`The default address is used when you ask to view assets without naming an address. To connect or disconnect your wallet, or select an approved address, ask in chat to open Wallet connection. Clearing the default does not disconnect your wallet.`)),t&&r.facts?.readAddress&&h.append(ee(`Clear default address`,{kind:`clear_read_address`}));else if(le===`records`)h.append(J(`p`,`ui-note`,SS)),t&&h.append(x(`Backup`,`Download the current local records and Sui network settings as one backup file. If this connection cannot provide downloads, the same file is saved in the Sui MCP backup folder on this computer.`,S(`Download backup`,`settings_download_backup`,()=>ie(!1))),x(`Restore`,`Choose a Sui MCP backup. It will be checked automatically before you confirm the restore.`,ee(`Restore local records`,{kind:`import_local_data`})),x(`Reset`,`Review the local records and stored settings to delete. This does not cancel transactions on Sui.`,ee(`Reset local data`,{kind:`reset_local_data`},!0)));else if(le===`troubleshooting`)r.facts&&(h.append(Y(`Wallet connection service`,wS[r.facts.walletAvailability.status])),r.facts.connectionReconciliationRequired&&h.append(J(`p`,`ui-error`,J_)),r.facts.observedAt&&h.append(Y(`Status checked at`,sg(r.facts.observedAt))),r.facts.walletAvailability.status!==`available`&&h.append(J(`p`,`ui-note`,r.facts.walletAvailability.message))),h.append(J(`p`,`ui-note`,`Restart the wallet connection service if a connection request is not responding. Starting up or waiting for you to approve in your wallet does not by itself mean a failure.`)),t&&h.append(ee(`Restart connection service`,{kind:`restart_wallet_service`}));else if(le===`advanced`&&r.facts)for(let e of[`grpc`,`graphql`]){let n=e===`grpc`?r.facts.localSettings.suiGrpcUrl:r.facts.localSettings.suiGraphqlUrl,i=ng({value:r.draft?.kind===`set_endpoint`&&r.draft.endpoint===e?r.draft.value:n.storedValue});i.dataset.cardAction=`settings_select`;let a=J(`div`,`settings-endpoint`);if(a.append(rg(e===`grpc`?`Sui node (gRPC)`:`Activity data (GraphQL)`,i),J(`p`,`ui-note`,e===`grpc`?`Used to retrieve balances, check transactions before wallet approval and send approved transactions.`:`Used to retrieve transaction activity.`)),t){let n=$h(`Select network address`,()=>{!u&&!o&&t({action:`settings_select`,draft:{kind:`set_endpoint`,endpoint:e,value:i.value}})},`secondary`);n.dataset.cardAction=`settings_select`,a.append(eg(n,ee(`Select default network address`,{kind:`restore_endpoint`,endpoint:e})))}n.appliesAfter&&a.append(J(`p`,`ui-note`,`A saved change needs an app restart. `+CS)),n.source===`environment`&&a.append(J(`p`,`ui-note`,`The app launch settings specify the network address to use. Remove that launch setting before restarting to use an address saved here.`)),h.append(a)}le!==`overview`&&r.draft&&le===jS(r.draft.kind)&&h.append(J(`p`,`ui-note`,`Unfinished change: ${yS[r.draft.kind]}.`),b(`Resume`,{kind:`operation`,operation:r.draft.kind})),t&&le===`overview`&&r.allowedActions.includes(`settings_cancel`)&&(r.draft&&h.append(J(`p`,`ui-note`,`Closing Settings discards this unfinished change. Nothing will be applied.`)),h.append(tg(y(`Close Settings`,{action:`settings_cancel`}))))}if(ne?.kind===`preparation_response`&&!r.result&&!w){let e=J(`p`,`ui-note`,`Waiting for a response…`);e.setAttribute(`role`,`status`),h.append(e)}l&&E===`input`&&D?.kind===`import_local_data`&&h.append(J(`p`,`ui-note`,l.message)),se(h,ue,de,D),v.replaceChildren(h),m&&[...v.querySelectorAll(`input`)].filter(e=>e.type!==`file`).forEach((e,t)=>{m[t]!==void 0&&(e.value=m[t])}),n&&(v.querySelector(`details`).open=!0)}return C(),{node:v,update(e,t){let n=zx.parse(e.data);if(n.operationId!==r.operationId)return!1;m&&n.file?.fileId===m.fileId&&n.download?.currentAttemptId===m.attemptId&&n.download.hostReport===m.status&&(m=void 0,h=void 0),m&&(!n.download?.allowedFileActions.includes(`settings_report_download`)||n.file?.fileId!==m.fileId)&&(m=void 0,h=void 0),l&&(n.result||e.revision!==l.revision||e.cardId!==l.cardId||n.operationId!==l.operationId||JSON.stringify(n.draft)!==l.draft||n.file?.fileId!==l.fileId)&&(l=void 0);let o=e===i;if(o&&!f&&!t.settingsCommandProgress)return!0;JSON.stringify(n.draft)!==JSON.stringify(r.draft)&&(a=n.draft?{kind:`operation`,operation:n.draft.kind}:{kind:`section`,page:jS(r.draft?.kind)});let u=_?.progress;return _&&(n.result||n.draft?.kind!==`import_local_data`||u?.stage===`reading`&&e.revision>_.startingRevision||u?.fileId&&n.file?.fileId!==u.fileId||u?.sha256&&n.file&&n.file.sha256!==u.sha256)&&(_=void 0),r=n,i=e,s=t.settings,c=t.onDisplayChange,f=t.settingsCommandProgress,C(o),re(),!0},displayRecovery(){return m?h:void 0},dispose(){o=!0,_=void 0,l=void 0,p=void 0,m=void 0}}}mS(`settings`,{title:`Settings`,controls:(e,t,n,r,i)=>NS(e,t,i),result:(e,t,n,r,i)=>NS(e,n,i)});</script></body></html>
3591
+ `)),Tv={0:`ED25519`,1:`Secp256k1`,2:`Secp256r1`,3:`MultiSig`,5:`ZkLogin`,6:`Passkey`},Ev=e=>Object.freeze(e());function Dv(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`&&`BYTES_PER_ELEMENT`in e&&e.BYTES_PER_ELEMENT===1}function Ov(e){if(!Dv(e))throw TypeError(`Uint8Array expected`)}function kv(e,t){return Array.isArray(t)?t.length===0?!0:e?t.every(e=>typeof e==`string`):t.every(e=>Number.isSafeInteger(e)):!1}function Av(e){if(typeof e!=`function`)throw TypeError(`function expected`);return!0}function jv(e,t){if(typeof t!=`string`)throw TypeError(`${e}: string expected`);return!0}function Mv(e,t=`number`){if(typeof e!=`number`)throw TypeError(`${t}: expected number, got ${typeof e}`);if(!Number.isSafeInteger(e))throw RangeError(`${t}: expected safe integer, got ${e}`)}function Nv(e,t){if(!kv(!1,t))throw TypeError(`${e}: array of numbers expected`)}var Pv=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function Fv(e,t=e.length){let n=Array(t);for(let r=0;r<t;r++)n[r]=e[r];return n}var Iv=(()=>{try{let e=new TextDecoder;return e.decode(Uint8Array.of(65,48,43,127))===`A0+`?e:void 0}catch{return}})(),Lv=8192;function Rv(e){let t=e.length;if(Iv!==void 0&&t>=12)return Iv.decode(e);if(t<=Lv)return String.fromCharCode.apply(null,e);let n=``;for(let r=0;r<t;r+=Lv)n+=String.fromCharCode.apply(null,e.subarray(r,r+Lv));return n}function zv(e){if(Mv(e),e<=0||e>8)throw RangeError(`radix2: bits should be in (0..8]`);let t=Pv[e]-1;return{encode:n=>{Ov(n);let r=n.length,i=new Uint8Array(Math.ceil(r*8/e)),a=0,o=0,s=0;for(let c=0;c<r;)for(c+2<r?(a=a<<24|n[c]<<16|n[c+1]<<8|n[c+2],o+=24,c+=3):(a=(a<<8|n[c])&65535,o+=8,c++);o-=e,i[s++]=a>>o&t,!(o<e););return o>0&&(i[s]=a<<e-o&t),i},decode:t=>{let n=t.length,r=new Uint8Array(Math.floor(n*e/8)),i=0,a=0,o=0;for(let s=0;s<n;s++)for(i=(i<<e|t[s])&65535,a+=e;a>=8;a-=8)r[o++]=i>>a-8&255;if(i=i<<8-a&255,a>=e)throw Error(`Excess padding`);if(i>0)throw Error(`Non-zero padding: ${i}`);return r}}}function Bv(e,t){let n=e.length;if(n>128)throw Error(`alphabet: max 128 letters`);let r=new Uint8Array(n),i=new Int8Array(128).fill(-1);for(let t=0;t<n;t++){let n=e.charCodeAt(t);if(e.codePointAt(t)!==n||n>127)throw Error(`alphabet: single-char ASCII letters only`);r[t]=n,i[n]=t}if(t!==void 0)for(let e of Object.keys(t)){let n=e.charCodeAt(0),r=i[t[e].charCodeAt(0)];if(e.length!==1||n>127||r===void 0||r===-1)throw Error(`alphabet: invalid alias ${e}`);i[n]=r}return{encode:e=>{let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++){let i=e[n],a=r[i];if(a===void 0)throw Error(`alphabet.encode: invalid digit ${i}`);t[n]=a}return Rv(t)},decode:t=>{jv(`decode`,t);let n=t.length,r=new Uint8Array(n);for(let a=0;a<n;a++){let n=t.charCodeAt(a),o=n<128?i[n]:-1;if(o===-1)throw Error(`Unknown letter "${t[a]}". Allowed: ${e}`);r[a]=o}return r}}}function Vv(e){return Av(e),function(...t){try{return e.apply(null,t)}catch{}}}var Hv=Bv(`qpzry9x8gf2tvdw0s3jn54khce6mua7l`),Uv=/^[\x21-\x60\x7b-\x7e]+$/;function Wv(e,t){for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);if(r<33||r>126)throw Error(`${e}: printable ASCII expected`)}}function Gv(e){let t=e.length,n=new Uint8Array(t);for(let r=0;r<t;r++){let t=e[r];if(t<0||t>=32)throw Error(`alphabet.encode: invalid digit ${t}`);n[r]=t}return n}var Kv=[996825010,642813549,513874426,1027748829,705979059];function qv(e){let t=e>>25,n=(e&33554431)<<5;for(let e=0;e<Kv.length;e++)(t>>e&1)==1&&(n^=Kv[e]);return n}function Jv(e,t,n=1){let r=e.length,i=1;for(let t=0;t<r;t++){let n=e.charCodeAt(t);if(n<33||n>126)throw Error(`Invalid prefix (${e})`);i=qv(i)^n>>5}i=qv(i);for(let t=0;t<r;t++)i=qv(i)^e.charCodeAt(t)&31;for(let e of t)i=qv(i)^e;for(let e=0;e<6;e++)i=qv(i);i^=n;let a=new Uint8Array(6);for(let e=0;e<6;e++)a[e]=i>>>5*(5-e)&31;return Hv.encode(a)}function Yv(e){let t=e===`bech32`?1:734539939,n=zv(5),r=e=>{Ov(e);let t=e.length,n=Array(Math.ceil(t*8/5)),r=0,i=0,a=0;for(let o=0;o<t;o++)for(r=r<<8|e[o],i+=8;i>=5;i-=5)n[a++]=r>>i-5&31;return i>0&&(n[a]=r<<5-i&31),n},i=e=>{Nv(`radix2.decode`,e);let t=e.length,r=new Uint8Array(t);for(let n=0;n<t;n++){let t=e[n];if(t<0||t>=32)throw Error(`convertRadix2: invalid word=${t}`);r[n]=t}return n.decode(r)},a=Vv(i);function o(e,n,r=90){jv(`bech32.encode prefix`,e),r!==!1&&Mv(r,`limit`),Dv(n)&&(n=Fv(n)),Nv(`bech32.encode`,n);let i=e.length;if(i===0)throw TypeError(`Invalid prefix length ${i}`);let a=i+7+n.length;if(r!==!1&&a>r)throw TypeError(`Length ${a} exceeds limit ${r}`);Wv(`bech32.encode prefix`,e);let o=e.toLowerCase(),s=Jv(o,n,t);return`${o}1${Hv.encode(Gv(n))}${s}`}function s(e,n=90){jv(`bech32.decode input`,e),n!==!1&&Mv(n,`limit`);let r=e.length;if(r<8||n!==!1&&r>n)throw TypeError(`invalid string length ${r}, expected (8..${n})`);let i=e.toLowerCase();if(e!==i&&!Uv.test(e))throw Wv(`bech32.decode input`,e),Error(`mixed-case string not allowed`);let a=i.lastIndexOf(`1`);if(a===0||a===-1)throw Error(`invalid separator "1"`);let o=i.slice(0,a),s=i.slice(a+1);if(s.length<6)throw Error(`invalid data length`);let c=Hv.decode(s),l=Fv(c,c.length-6),u=Jv(o,l,t);if(!s.endsWith(u))throw Error(`Invalid checksum in ${e}`);return{prefix:o,words:l}}let c=Vv(s);function l(e,t=90){let{prefix:n,words:r}=s(e,t);return{prefix:n,words:r,bytes:i(r)}}function u(e,t){return o(e,r(t))}return{encode:o,decode:s,encodeFromBytes:u,decodeToBytes:l,decodeUnsafe:c,fromWords:i,fromWordsUnsafe:a,toWords:r}}var Xv=Ev(()=>Yv(`bech32`));function Zv(e){let{prefix:t,words:n}=Xv.decode(e);if(t!==`suiprivkey`)throw Error(`invalid private key prefix`);let r=new Uint8Array(Xv.fromWords(n)),i=r.slice(1);return{scheme:Tv[r[0]],secretKey:i}}var Qv=`external-proposal-alpha-2026-05-25`,$v=`proposal-review-model-alpha-2026-05-25`,ey=F().refine(e=>{let t=new Date(e);return!Number.isNaN(t.getTime())&&t.toISOString()===e},`Expected ISO 8601 UTC timestamp`),ty=/transaction\s*bytes?|transactionBytes|tx\s*bytes?|serialized\s*transaction|serializedTransaction|signed\s*transaction|signing\s*request|signingRequest|wallet\s*authorization|walletAuthorization|private\s*key|privateKey|secret\s*key|secretKey|seed\s*phrase|mnemonic|suiprivkey|signature|route[-_\s]*selected|routeSelectedPlan|bcs\s*transaction|programmable\s*transaction/i,ny=/(?:0x[0-9a-fA-F]{160,}|[A-Za-z0-9+/_=-]{160,})/,ry=/suiprivkey1[023456789acdefghjklmnpqrstuvwxyz]+/gi,iy=/(^|[^0-9a-fA-F])(?:0x)?[0-9a-fA-F]{64}($|[^0-9a-fA-F])/,ay=/(^|[^A-Za-z0-9+/_=-])(?:[A-Za-z0-9+/]{43}=|[A-Za-z0-9+/]{44}|[A-Za-z0-9_-]{43,44})($|[^A-Za-z0-9+/_=-])/,oy=/^(?:0|[1-9][0-9]*)(?:\.[0-9]+)?$/,sy=[12,15,18,21,24];function cy(e,t,n={}){return F().min(1).max(e).superRefine((e,r)=>{(ty.test(e)||ny.test(e)||uy(e)||dy(e)||!n.allowRawSecretLikeText&&fy(e))&&r.addIssue({code:`custom`,message:`${t} must not contain executable, signing, private-key, mnemonic, route-selected, or encoded secret-like material`})})}function ly(e,t){return cy(e,t,{allowRawSecretLikeText:!0})}function uy(e){return(e.match(ry)??[]).some(e=>{try{return Zv(e.toLowerCase()),!0}catch{return e.toLowerCase().startsWith(`suiprivkey1`)}})}function dy(e){let t=e.normalize(`NFKD`).toLowerCase().replace(/[^a-z]+/g,` `).trim().split(/\s+/).filter(Boolean);for(let e of sy)if(!(t.length<e)){for(let n=0;n<=t.length-e;n+=1)if(Cv(t.slice(n,n+e).join(` `),wv))return!0}return!1}function fy(e){return iy.test(e)||ay.test(e)}var py=cy(80,`amountDisplay`).refine(e=>oy.test(e)&&/[1-9]/.test(e),{message:`Expected a positive decimal display amount`}),my=B({kind:W([`mcp_server`,`ai_client`,`user`,`other`]),name:cy(120,`source.name`),reference:cy(256,`source.reference`).optional()}).strict(),hy=B({address:h_.optional(),label:cy(120,`party.label`).optional()}).strict().refine(e=>e.address!==void 0||e.label!==void 0,{message:`Expected address or label`}),gy=B({amountDisplay:py,amountKind:G(`display_proposal`).default(`display_proposal`),symbol:cy(64,`amount.symbol`).optional(),coinType:ly(512,`amount.coinType`).optional(),denomination:cy(64,`amount.denomination`).optional()}).strict(),_y=B({packageId:ly(128,`action.target.packageId`).optional(),module:cy(128,`action.target.module`).optional(),function:cy(128,`action.target.function`).optional(),objectId:ly(128,`action.target.objectId`).optional(),label:cy(120,`action.target.label`).optional()}).strict().refine(e=>e.packageId!==void 0||e.module!==void 0||e.function!==void 0||e.objectId!==void 0||e.label!==void 0,{message:`Expected at least one action target field`}),vy=B({direction:W([`outgoing`,`expected_incoming`,`fee`]),amount:gy,recipient:hy.optional(),description:cy(512,`assetFlow.description`).optional()}).strict(),yy=B({id:cy(120,`proposal.id`),source:my,network:G(`sui:mainnet`),createdAt:ey,expiresAt:ey.optional(),purpose:cy(512,`purpose`),assumptions:z(cy(512,`assumptions[]`)).max(20).optional(),requiredUserChoices:z(cy(512,`requiredUserChoices[]`)).max(20).optional()}).strict(),by=hc(`type`,[yy.extend({type:G(`payment`),payment:B({amount:gy,recipient:hy,target:cy(512,`payment.target`).optional()}).strict()}).strict(),yy.extend({type:G(`sui_action`),action:B({actionKind:cy(120,`action.actionKind`),target:_y,recipient:hy.optional(),assetFlow:z(vy).max(20).optional()}).strict()}).strict()]),xy=B({id:F(),label:F(),status:W([`pass`,`warning`,`fail`]),message:F(),source:W([`proposal`,`adapter`,`registry`,`quote`,`wallet`,`simulation`,`network`])}).strict(),Sy=B({id:F(),label:F(),reason:F()}).strict(),Cy=B({modelVersion:G($v),contractVersion:G(Qv),proposalId:F(),proposalType:W([`payment`,`sui_action`]),proposalSource:my,proposedAction:B({kind:W([`payment`,`sui_action`]),title:F(),purpose:F(),network:G(`sui:mainnet`),recipient:hy.optional(),target:H([F(),_y]).optional()}).strict(),assetFlow:B({outgoing:z(gy),expectedIncoming:z(gy),fees:z(gy)}).strict(),recipients:z(hy),targets:z(H([F(),_y])),evidenceUsed:z(B({id:F(),label:F(),source:W([`external_proposal`,`local_schema`]),summary:F()}).strict()),missingEvidence:z(Sy),requiredUserChoices:z(Sy),unsupportedClaims:z(B({id:F(),label:F(),reason:F()}).strict()),rejectedExecutableFields:z(B({fieldName:F(),reason:F()}).strict()),freshness:B({proposalCreatedAt:ey,proposalExpiresAt:ey.optional(),evaluatedAt:ey,status:W([`current`,`expired`,`created_in_future`,`expiry_not_provided`]),reason:F()}).strict(),blockingChecks:z(xy),nonSignableReason:B({code:G(`external_proposal_review_only`),message:F(),blockedCapabilities:z(F())}).strict()}).strict();B({requestedIntent:by,implementationStatus:G(`read_only_review_only`),contractVersion:G(Qv)}).strict();var wy=[`adapter_not_implemented`,`producer_stage_missing`,`wallet_review_contract_emit_missing`,`network_mismatch`,`insufficient_balance`,`insufficient_gas`,`allowlist_violation`,`asset_mismatch`,`amount_mismatch`,`wallet_mismatch`,`unsupported_action`,`object_resolution_failed`,`proposal_review_only`],Ty=[`review_evidence_stale`,`quote_stale`,`quote_unavailable`,`simulation_transient_failure`,`review_update_failed`,`wallet_connection_changed`],Ey=[`proposed`,`awaiting_wallet`,`wallet_connected`,`ready_for_wallet_review`,`refresh_required`,`blocked`,`expired`],Dy=[`humanReadableReview`,`simulation`,`transactionReviewData`,`ptbVisualization`,`assetFlowActual`,`beforeAfterBalance`],Oy=W([`client.core.simulateTransaction`,`client.transactionExecutionService.simulateTransaction`]),ky=`ptb-visualization-contract-alpha-2026-05-25`,Ay=[`proposedAction`,`assetFlow`,`recipients`,`targets`,`evidenceUsed`,`missingEvidence`,`requiredUserChoices`,`unsupportedClaims`,`freshness`,`blockingChecks`],jy=[`effects`,`balanceChanges`,`objectTypes`,`transaction`],My=[`transaction_bytes`,`serialized_transaction`,`wallet_signature_request`,`private_key_material`,`wallet_authorization`,`signing_data`,`signing_readiness`,`payment_execution_readiness`],Ny=[`transaction_building_input`,`wallet_authorization`,`signing_data`,`signing_readiness`,`payment_execution_readiness`,`route_recommendation`],Py=m_,Fy=`MIST`,Iy=[`checkedAt`,`expiresAt`],Ly=[`checkedAt`,`expiryStatus`],Ry=[`rawAmount`,`asset`,`amountRole`],zy=[`minOutRaw`,`asset`,`amountRole`],By=[`gasBudgetRaw`,`asset`,`amountRole`],Vy=[`gasUsedRaw`,`asset`,`amountRole`],Hy=[`checkedAt`,`gasResolutionStatus`,`unresolvedReason`],Uy=[`balanceChanges`,`asset`,`amountRole`],Wy=[`coinType`,`decimals`],Gy=[`quoteEvidenceId`,`minOutRaw`],Ky=[`maxSlippageBps`,`userSelection`],qy=[`maxSlippageBps`,`minOutRaw`],Jy=[`ownerAccount`,`objects`],Yy=[`pinned_sdk_registry`,`verified_mainnet_onchain_metadata`,`wallet_account_read`,`quote_evidence`,`review_time_simulation`,`validated_request_fact`,`user_explicit_choice`],Xy=[`input`,`expected_output`,`minimum_output`,`gas_budget`,`gas_used`,`fee`,`balance_delta`],Zy={input:{kinds:[`validated_request_fact`,`wallet_account_read`,`user_explicit_choice`],fields:Ry},expected_output:{kinds:[`quote_evidence`,`review_time_simulation`],fields:Ry},minimum_output:{kinds:[`quote_evidence`],fields:zy},gas_budget:{kinds:[`review_time_simulation`],fields:By},gas_used:{kinds:[`review_time_simulation`],fields:Vy},fee:{kinds:[`review_time_simulation`],fields:Ry},balance_delta:{kinds:[`review_time_simulation`],fields:Uy}},Qy={pinned_sdk_metadata:{kinds:[`pinned_sdk_registry`],fields:Wy},verified_mainnet_onchain_metadata:{kinds:[`verified_mainnet_onchain_metadata`],fields:Wy}},$y={user_explicit:{kinds:[`user_explicit_choice`],fields:Ky},adapter_policy_from_quote_evidence:{kinds:[`quote_evidence`],fields:qy}},eb={kinds:[`review_time_simulation`],fields:Hy},tb={kinds:[`quote_evidence`],fields:Gy},nb={kinds:[`validated_request_fact`],fields:Iy},rb={kinds:[`validated_request_fact`],fields:Ly},ib={raw_quantity_amount:{byRole:Zy},unit_metadata:{bySource:Qy},gas_unresolved_status:eb,expiry_status:{current:nb,expired:nb,not_provided:rb,not_applicable:rb},quote_min_out:tb,slippage_policy:{bySource:$y},object_ownership:{kinds:[`wallet_account_read`],fields:Jy},simulation_result:{kinds:[`review_time_simulation`],fields:jy}},ab={gasBudgetClaimId:{factKind:`raw_quantity_amount`,role:`gas_budget`,assetCoinType:Py,rawUnit:Fy},gasUsedClaimId:{factKind:`raw_quantity_amount`,role:`gas_used`,assetCoinType:Py,rawUnit:Fy},gasObjectOwnershipClaimId:{factKind:`object_ownership`,ownership:`owned_by_account`}},ob=F().refine(e=>{let t=new Date(e);return!Number.isNaN(t.getTime())&&t.toISOString()===e},`Expected ISO 8601 UTC timestamp`),sb=I_(`unsigned integer`),cb=F().regex(/^0x[0-9a-fA-F]{1,64}$/,{message:`Expected a Sui object id`}),lb=F().min(1).max(512).refine(e=>{try{return z_(e)===e}catch{return!1}},`Expected a normalized Sui struct tag coin type`),X=F().min(1).max(120),ub=B({symbol:F().min(1).max(64).optional(),coinType:lb}).strict(),db=/transaction\s*bytes?|tx\s*bytes?|serialized\s*transaction|serializedTransaction|signed\s*transaction|signing\s*request|signingRequest|wallet\s*authorization|walletAuthorization|private\s*key|privateKey|secret\s*key|secretKey|seed\s*phrase|mnemonic|suiprivkey|signature|bcs\s*transaction/i,fb=/(?:0x[0-9a-fA-F]{160,}|[A-Za-z0-9+/_=-]{160,})/;function pb(e,t){return F().min(1).max(e).superRefine((e,n)=>{(db.test(e)||fb.test(e))&&n.addIssue({code:`custom`,message:`${t} must not contain executable transaction, signing, private-key, mnemonic, or long encoded material`})})}function mb(e,t){let n=new Set(e);return t.filter(e=>!n.has(e))}function hb(e,t,n,r,i){let a=mb(t,n);a.length!==0&&e.addIssue({code:`custom`,path:r,message:`${i} must include ${a.join(`, `)}`})}function gb(e,t,n,r,i){hb(e,t,n,r,i)}function _b(e,t,n){e.addIssue({code:`custom`,path:t,message:`${n} must match referenced evidence claim`})}function Z(e,t,n,r,i){t!==n&&_b(e,r,i)}function vb(e,t,n,r,i){let a=new Set(t),o=new Set(n);if(a.size!==o.size)_b(e,r,i);else for(let t of a)if(!o.has(t)){_b(e,r,i);return}}function yb(e,t,n,r,i){(t.symbol!==n.symbol||t.coinType!==n.coinType)&&_b(e,r,i)}function bb(e,t,n,r,i){try{z_(t.coinType)!==n&&_b(e,r,i)}catch{_b(e,r,i)}}var xb=B({kind:W([`natural_language_intent`,`external_proposal`,`mcp_action_request`,`local_review_request`]),sourceId:F().min(1).max(160),capturedAt:ob,authority:G(`untrusted_until_review_regenerates_and_verifies`),userSelectionSource:W([`user_explicit`,`prior_user_explicit_context`]).optional()}).strict(),Sb=B({id:X,kind:W(Yy),network:G(`sui:mainnet`),source:F().min(1).max(240),verifiedAt:ob,fields:z(F().min(1).max(120)).min(1)}).strict(),Cb=hc(`factKind`,[B({id:X,factKind:G(`raw_quantity_amount`),sourceEvidenceId:X,role:W(Xy),asset:ub,rawAmount:sb}).strict(),B({id:X,factKind:G(`unit_metadata`),sourceEvidenceId:X,source:W([`pinned_sdk_metadata`,`verified_mainnet_onchain_metadata`]),coinType:lb,decimals:I().int().min(0).max(255)}).strict(),B({id:X,factKind:G(`gas_unresolved_status`),sourceEvidenceId:X,checkedAt:ob,status:G(`unresolved`),reason:F().min(1).max(240)}).strict(),B({id:X,factKind:G(`expiry_status`),sourceEvidenceId:X,checkedAt:ob,status:W([`current`,`expired`,`not_provided`,`not_applicable`]),expiresAt:ob.optional(),reason:F().min(1).max(240).optional()}).strict(),B({id:X,factKind:G(`quote_min_out`),sourceEvidenceId:X,quoteEvidenceId:F().min(1).max(120),minOutRaw:sb}).strict(),B({id:X,factKind:G(`slippage_policy`),sourceEvidenceId:X,policySource:W([`user_explicit`,`adapter_policy_from_quote_evidence`]),maxSlippageBps:I().int().min(0).max(1e4),minOutRaw:sb.optional()}).strict(),B({id:X,factKind:G(`object_ownership`),sourceEvidenceId:X,objectId:cb,ownerAccount:h_,ownership:W([`owned_by_account`,`shared_object`,`immutable_or_package`,`not_owned_by_account`])}).strict(),B({id:X,factKind:G(`simulation_result`),sourceEvidenceId:X,provider:Oy,checksEnabled:G(!0),simulatedAt:ob,status:W([`success`,`failed`,`unavailable`]),requiredFields:z(W(jy)).min(jy.length),missingFields:z(W(jy)).default([]),failureReason:F().min(1).max(240).optional()}).strict()]),wb=B({id:X,role:W(Xy),asset:ub,rawAmount:sb,unit:B({decimals:I().int().min(0).max(255),source:W([`pinned_sdk_metadata`,`verified_mainnet_onchain_metadata`]),sourceField:F().min(1).max(160),unitClaimId:X}).strict(),amountClaimId:X,displayOnly:B({amountDisplay:F().min(1).max(120),reason:G(`presentation_only_not_signing_input`)}).strict().optional()}).strict(),Tb=B({objectId:cb,ownerAccount:h_,ownershipClaimId:X}).strict(),Eb=B({source:G(`review_time_simulation`),checkedAt:ob,gasBudgetRaw:sb.optional(),gasBudgetClaimId:X.optional(),gasUsedRaw:sb.optional(),gasUsedClaimId:X.optional(),gasObjects:z(Tb).optional(),unresolvedReason:F().min(1).max(240).optional(),unresolvedClaimId:X.optional()}).strict().superRefine((e,t)=>{let n=e.gasBudgetRaw!==void 0||e.gasUsedRaw!==void 0;!n&&e.unresolvedReason===void 0&&t.addIssue({code:`custom`,message:`Expected gas evidence or unresolvedReason`}),n&&e.unresolvedReason!==void 0&&t.addIssue({code:`custom`,path:[`unresolvedReason`],message:`Resolved gas quantities must not include unresolvedReason`}),e.gasBudgetRaw!==void 0&&e.gasBudgetClaimId===void 0&&t.addIssue({code:`custom`,path:[`gasBudgetClaimId`],message:`gasBudgetRaw requires gasBudgetClaimId`}),e.gasBudgetRaw===void 0&&e.gasBudgetClaimId!==void 0&&t.addIssue({code:`custom`,path:[`gasBudgetClaimId`],message:`gasBudgetClaimId requires gasBudgetRaw`}),e.gasUsedRaw!==void 0&&e.gasUsedClaimId===void 0&&t.addIssue({code:`custom`,path:[`gasUsedClaimId`],message:`gasUsedRaw requires gasUsedClaimId`}),e.gasUsedRaw===void 0&&e.gasUsedClaimId!==void 0&&t.addIssue({code:`custom`,path:[`gasUsedClaimId`],message:`gasUsedClaimId requires gasUsedRaw`}),e.unresolvedReason!==void 0&&e.unresolvedClaimId===void 0&&t.addIssue({code:`custom`,path:[`unresolvedClaimId`],message:`unresolvedReason requires unresolvedClaimId`}),e.unresolvedReason===void 0&&e.unresolvedClaimId!==void 0&&t.addIssue({code:`custom`,path:[`unresolvedClaimId`],message:`unresolvedClaimId requires unresolvedReason`})}),Db=hc(`status`,[B({checkedAt:ob,status:G(`current`),expiresAt:ob,evidenceClaimId:X}).strict(),B({checkedAt:ob,status:G(`expired`),expiresAt:ob,evidenceClaimId:X}).strict(),B({checkedAt:ob,status:G(`not_provided`),evidenceClaimId:X,reason:F().min(1).max(240),expiresAt:uc().optional()}).strict(),B({checkedAt:ob,status:G(`not_applicable`),evidenceClaimId:X,reason:F().min(1).max(240),expiresAt:uc().optional()}).strict()]).superRefine((e,t)=>{e.status===`current`&&Date.parse(e.expiresAt)<=Date.parse(e.checkedAt)&&t.addIssue({code:`custom`,path:[`expiresAt`],message:`Current expiry evidence requires expiresAt after checkedAt`}),e.status===`expired`&&Date.parse(e.expiresAt)>Date.parse(e.checkedAt)&&t.addIssue({code:`custom`,path:[`expiresAt`],message:`Expired expiry evidence requires expiresAt at or before checkedAt`})}),Ob=B({status:W([`required_and_verified`,`not_required_for_action`,`missing`,`stale`]),quoteEvidenceId:F().min(1).max(120).optional(),quoteEvidenceClaimId:X.optional(),maxSlippageBps:I().int().min(0).max(1e4).optional(),minOutRaw:sb.optional(),policySource:W([`user_explicit`,`adapter_policy_from_quote_evidence`]).optional(),policyEvidenceClaimId:X.optional()}).strict().superRefine((e,t)=>{e.status===`required_and_verified`&&(e.quoteEvidenceId===void 0||e.quoteEvidenceClaimId===void 0||e.maxSlippageBps===void 0||e.minOutRaw===void 0||e.policySource===void 0||e.policyEvidenceClaimId===void 0)&&t.addIssue({code:`custom`,message:`Verified min-out evidence requires quoteEvidenceId, quoteEvidenceClaimId, maxSlippageBps, minOutRaw, policySource, and policyEvidenceClaimId`}),e.quoteEvidenceId!==void 0&&e.quoteEvidenceClaimId===void 0&&t.addIssue({code:`custom`,path:[`quoteEvidenceClaimId`],message:`quoteEvidenceId requires quoteEvidenceClaimId`}),e.quoteEvidenceId===void 0&&e.quoteEvidenceClaimId!==void 0&&t.addIssue({code:`custom`,path:[`quoteEvidenceClaimId`],message:`quoteEvidenceClaimId requires quoteEvidenceId`}),e.minOutRaw!==void 0&&e.quoteEvidenceClaimId===void 0&&t.addIssue({code:`custom`,path:[`quoteEvidenceClaimId`],message:`minOutRaw requires quoteEvidenceClaimId`}),e.maxSlippageBps!==void 0&&e.policySource===void 0&&t.addIssue({code:`custom`,path:[`policySource`],message:`maxSlippageBps requires policySource`}),e.policySource!==void 0&&e.policyEvidenceClaimId===void 0&&t.addIssue({code:`custom`,path:[`policyEvidenceClaimId`],message:`policySource requires policyEvidenceClaimId`}),e.policySource===void 0&&e.policyEvidenceClaimId!==void 0&&t.addIssue({code:`custom`,path:[`policyEvidenceClaimId`],message:`policyEvidenceClaimId requires policySource`})}),kb=B({checkedAt:ob,ownerAccount:h_,objects:z(B({objectId:cb,role:W([`input_coin`,`gas_coin`,`protocol_object`,`shared_object`,`receiving_object`]),ownership:W([`owned_by_account`,`shared_object`,`immutable_or_package`,`not_owned_by_account`]),evidenceClaimId:X}).strict()).min(1)}).strict(),Ab=B({evidenceClaimId:X,transactionDigest:g_,provider:Oy,checksEnabled:G(!0),simulatedAt:ob,status:W([`success`,`failed`,`unavailable`]),requiredFields:z(W(jy)).min(jy.length),missingFields:z(W(jy)).default([]),failureReason:F().min(1).max(240).optional()}).strict().refine(e=>e.status!==`success`||e.missingFields.length===0,{message:`Successful simulation evidence must not have missing required fields`}).refine(e=>jy.every(t=>e.requiredFields.includes(t)),{message:`Simulation evidence must include every required simulation field`}).refine(e=>e.status===`success`||e.failureReason!==void 0,{message:`Failed or unavailable simulation evidence requires failureReason`}).refine(e=>e.status!==`success`||e.failureReason===void 0,{message:`Successful simulation evidence must not include failureReason`}),jb=B({fields:z(W(Ay)).min(Ay.length),transactionDigest:g_,source:G(`review_model_or_adapter_equivalent`),purpose:G(`human_review_before_wallet_authorization`)}).strict().refine(e=>Ay.every(t=>e.fields.includes(t)),{message:`Human-readable review fields must include every required review field`}),Mb=B({runtimeStatus:G(`emitted_pre_handoff`),mcpAndReviewUiMayExpose:z(W([`human_readable_review`,`ptb_visualization_artifact`,`diagnostics`,`status_checks`])).min(1),prohibited:z(W(My)).min(1)}).strict().superRefine((e,t)=>{gb(t,e.prohibited,My,[`prohibited`],`prohibited`)}),Nb=B({schemaVersion:G(1),adapterId:F().min(1).max(120),protocol:F().min(1).max(120),actionKind:F().min(1).max(120),network:G(`sui:mainnet`),inputProvenance:xb,sourceReferences:z(Sb).min(1),evidenceClaims:z(Cb).min(1),rawQuantities:z(wb).min(1),gas:Eb,expiry:Db,slippageOrMinOut:Ob,objectOwnership:kb,simulation:Ab,humanReadableReview:jb,outputBoundary:Mb,reviewedTransactionDigest:g_}).strict().superRefine((e,t)=>{let n=new Set,r=new Map,i=new Map;e.sourceReferences.forEach((e,a)=>{n.has(e.id)&&t.addIssue({code:`custom`,path:[`sourceReferences`,a,`id`],message:`sourceReferences id must be unique: ${e.id}`}),n.add(e.id),r.has(e.id)||(r.set(e.id,e),i.set(e.id,a))});let a=new Set,o=new Map,s=new Map;e.evidenceClaims.forEach((e,n)=>{a.has(e.id)&&t.addIssue({code:`custom`,path:[`evidenceClaims`,n,`id`],message:`evidenceClaims id must be unique: ${e.id}`}),a.add(e.id),o.has(e.id)||(o.set(e.id,e),s.set(e.id,n))});let c=(e,n)=>{if(e===void 0)return;let i=r.get(e);if(i!==void 0)return i;t.addIssue({code:`custom`,path:n,message:`source evidence id must reference sourceReferences[].id: ${e}`})},l=(e,n,r,a)=>{if(e===void 0)return;let o=c(e,r);if(o===void 0)return;let s=i.get(e),l=s===void 0?r:[`sourceReferences`,s];n.kinds.includes(o.kind)||t.addIssue({code:`custom`,path:[...l,`kind`],message:`${a} source kind must be one of ${n.kinds.join(`, `)}`}),hb(t,o.fields,n.fields,[...l,`fields`],`${a} sourceReferences fields`)},u=(e,n,r,i)=>{if(e===void 0){t.addIssue({code:`custom`,path:r,message:`${i} must reference evidenceClaims[].id`});return}let a=o.get(e);if(a===void 0)t.addIssue({code:`custom`,path:r,message:`${i} must reference evidenceClaims[].id: ${e}`});else{if(a.factKind!==n){let a=s.get(e),o=a===void 0?r:[`evidenceClaims`,a,`factKind`];t.addIssue({code:`custom`,path:o,message:`${i} evidence claim factKind must be ${n}`})}return a}};if(e.evidenceClaims.forEach((e,n)=>{e.factKind===`raw_quantity_amount`&&l(e.sourceEvidenceId,ib.raw_quantity_amount.byRole[e.role],[`evidenceClaims`,n,`sourceEvidenceId`],`evidenceClaims[${n}].raw_quantity_amount`),e.factKind===`unit_metadata`&&l(e.sourceEvidenceId,ib.unit_metadata.bySource[e.source],[`evidenceClaims`,n,`sourceEvidenceId`],`evidenceClaims[${n}].unit_metadata`),e.factKind===`gas_unresolved_status`&&l(e.sourceEvidenceId,ib.gas_unresolved_status,[`evidenceClaims`,n,`sourceEvidenceId`],`evidenceClaims[${n}].gas_unresolved_status`),e.factKind===`expiry_status`&&(l(e.sourceEvidenceId,ib.expiry_status[e.status],[`evidenceClaims`,n,`sourceEvidenceId`],`evidenceClaims[${n}].expiry_status`),(e.status===`current`||e.status===`expired`)&&e.expiresAt===void 0&&t.addIssue({code:`custom`,path:[`evidenceClaims`,n,`expiresAt`],message:`Current or expired expiry claim requires expiresAt`}),(e.status===`not_provided`||e.status===`not_applicable`)&&e.reason===void 0&&t.addIssue({code:`custom`,path:[`evidenceClaims`,n,`reason`],message:`Unavailable expiry claim requires reason`}),(e.status===`not_provided`||e.status===`not_applicable`)&&e.expiresAt!==void 0&&t.addIssue({code:`custom`,path:[`evidenceClaims`,n,`expiresAt`],message:`Unavailable expiry claim must not include expiresAt`}),e.status===`current`&&e.expiresAt!==void 0&&Date.parse(e.expiresAt)<=Date.parse(e.checkedAt)&&t.addIssue({code:`custom`,path:[`evidenceClaims`,n,`expiresAt`],message:`Current expiry claim requires expiresAt after checkedAt`}),e.status===`expired`&&e.expiresAt!==void 0&&Date.parse(e.expiresAt)>Date.parse(e.checkedAt)&&t.addIssue({code:`custom`,path:[`evidenceClaims`,n,`expiresAt`],message:`Expired expiry claim requires expiresAt at or before checkedAt`})),e.factKind===`quote_min_out`&&l(e.sourceEvidenceId,ib.quote_min_out,[`evidenceClaims`,n,`sourceEvidenceId`],`evidenceClaims[${n}].quote_min_out`),e.factKind===`slippage_policy`&&(l(e.sourceEvidenceId,ib.slippage_policy.bySource[e.policySource],[`evidenceClaims`,n,`sourceEvidenceId`],`evidenceClaims[${n}].slippage_policy`),e.policySource===`adapter_policy_from_quote_evidence`&&e.minOutRaw===void 0&&t.addIssue({code:`custom`,path:[`evidenceClaims`,n,`minOutRaw`],message:`Adapter-derived slippage policy claim requires minOutRaw`})),e.factKind===`object_ownership`&&l(e.sourceEvidenceId,ib.object_ownership,[`evidenceClaims`,n,`sourceEvidenceId`],`evidenceClaims[${n}].object_ownership`),e.factKind===`simulation_result`&&(l(e.sourceEvidenceId,ib.simulation_result,[`evidenceClaims`,n,`sourceEvidenceId`],`evidenceClaims[${n}].simulation_result`),e.status===`success`&&e.missingFields.length!==0&&t.addIssue({code:`custom`,path:[`evidenceClaims`,n,`missingFields`],message:`Successful simulation claim must not have missing required fields`}),jy.every(t=>e.requiredFields.includes(t))||t.addIssue({code:`custom`,path:[`evidenceClaims`,n,`requiredFields`],message:`Simulation claim must include every required simulation field`}),e.status!==`success`&&e.failureReason===void 0&&t.addIssue({code:`custom`,path:[`evidenceClaims`,n,`failureReason`],message:`Failed or unavailable simulation claim requires failureReason`}),e.status===`success`&&e.failureReason!==void 0&&t.addIssue({code:`custom`,path:[`evidenceClaims`,n,`failureReason`],message:`Successful simulation claim must not include failureReason`}))}),e.rawQuantities.forEach((e,n)=>{let r=u(e.amountClaimId,`raw_quantity_amount`,[`rawQuantities`,n,`amountClaimId`],`rawQuantities[${n}].amountClaimId`);r?.factKind===`raw_quantity_amount`&&(Z(t,e.role,r.role,[`rawQuantities`,n,`role`],`rawQuantities[${n}].role`),Z(t,e.rawAmount,r.rawAmount,[`rawQuantities`,n,`rawAmount`],`rawQuantities[${n}].rawAmount`),yb(t,e.asset,r.asset,[`rawQuantities`,n,`asset`],`rawQuantities[${n}].asset`));let i=u(e.unit.unitClaimId,`unit_metadata`,[`rawQuantities`,n,`unit`,`unitClaimId`],`rawQuantities[${n}].unit.unitClaimId`);i?.factKind===`unit_metadata`&&(Z(t,e.unit.source,i.source,[`rawQuantities`,n,`unit`,`source`],`rawQuantities[${n}].unit.source`),Z(t,e.unit.decimals,i.decimals,[`rawQuantities`,n,`unit`,`decimals`],`rawQuantities[${n}].unit.decimals`),e.asset.coinType!==void 0&&Z(t,e.asset.coinType,i.coinType,[`rawQuantities`,n,`asset`,`coinType`],`rawQuantities[${n}].asset.coinType`))}),e.gas.gasBudgetRaw!==void 0){let n=u(e.gas.gasBudgetClaimId,`raw_quantity_amount`,[`gas`,`gasBudgetClaimId`],`gas.gasBudgetClaimId`);n?.factKind===`raw_quantity_amount`&&(Z(t,n.role,ab.gasBudgetClaimId.role,[`gas`,`gasBudgetClaimId`],`gas.gasBudgetClaimId role`),bb(t,n.asset,ab.gasBudgetClaimId.assetCoinType,[`gas`,`gasBudgetClaimId`],`gas.gasBudgetClaimId asset`),Z(t,e.gas.gasBudgetRaw,n.rawAmount,[`gas`,`gasBudgetRaw`],`gas.gasBudgetRaw`))}if(e.gas.gasUsedRaw!==void 0){let n=u(e.gas.gasUsedClaimId,`raw_quantity_amount`,[`gas`,`gasUsedClaimId`],`gas.gasUsedClaimId`);n?.factKind===`raw_quantity_amount`&&(Z(t,n.role,ab.gasUsedClaimId.role,[`gas`,`gasUsedClaimId`],`gas.gasUsedClaimId role`),bb(t,n.asset,ab.gasUsedClaimId.assetCoinType,[`gas`,`gasUsedClaimId`],`gas.gasUsedClaimId asset`),Z(t,e.gas.gasUsedRaw,n.rawAmount,[`gas`,`gasUsedRaw`],`gas.gasUsedRaw`))}if(e.gas.unresolvedReason!==void 0){let n=u(e.gas.unresolvedClaimId,`gas_unresolved_status`,[`gas`,`unresolvedClaimId`],`gas.unresolvedClaimId`);n?.factKind===`gas_unresolved_status`&&(Z(t,n.status,`unresolved`,[`gas`,`unresolvedClaimId`],`gas.unresolvedClaimId status`),Z(t,e.gas.checkedAt,n.checkedAt,[`gas`,`checkedAt`],`gas.checkedAt`),Z(t,e.gas.unresolvedReason,n.reason,[`gas`,`unresolvedReason`],`gas.unresolvedReason`))}e.gas.gasObjects?.forEach((e,n)=>{let r=u(e.ownershipClaimId,`object_ownership`,[`gas`,`gasObjects`,n,`ownershipClaimId`],`gas.gasObjects[${n}].ownershipClaimId`);r?.factKind===`object_ownership`&&(Z(t,e.objectId,r.objectId,[`gas`,`gasObjects`,n,`objectId`],`gas.gasObjects[${n}].objectId`),Z(t,e.ownerAccount,r.ownerAccount,[`gas`,`gasObjects`,n,`ownerAccount`],`gas.gasObjects[${n}].ownerAccount`),Z(t,r.ownership,ab.gasObjectOwnershipClaimId.ownership,[`gas`,`gasObjects`,n,`ownershipClaimId`],`gas.gasObjects[${n}].ownershipClaimId ownership`))});let d=u(e.expiry.evidenceClaimId,`expiry_status`,[`expiry`,`evidenceClaimId`],`expiry.evidenceClaimId`);if(d?.factKind===`expiry_status`&&(Z(t,e.expiry.status,d.status,[`expiry`,`status`],`expiry.status`),Z(t,e.expiry.checkedAt,d.checkedAt,[`expiry`,`checkedAt`],`expiry.checkedAt`),e.expiry.status===`current`||e.expiry.status===`expired`?Z(t,e.expiry.expiresAt,d.expiresAt,[`expiry`,`expiresAt`],`expiry.expiresAt`):Z(t,e.expiry.reason,d.reason,[`expiry`,`reason`],`expiry.reason`)),e.slippageOrMinOut.quoteEvidenceClaimId!==void 0){let n=u(e.slippageOrMinOut.quoteEvidenceClaimId,`quote_min_out`,[`slippageOrMinOut`,`quoteEvidenceClaimId`],`slippageOrMinOut.quoteEvidenceClaimId`);n?.factKind===`quote_min_out`&&(Z(t,e.slippageOrMinOut.quoteEvidenceId,n.quoteEvidenceId,[`slippageOrMinOut`,`quoteEvidenceId`],`slippageOrMinOut.quoteEvidenceId`),Z(t,e.slippageOrMinOut.minOutRaw,n.minOutRaw,[`slippageOrMinOut`,`minOutRaw`],`slippageOrMinOut.minOutRaw`))}if(e.slippageOrMinOut.minOutRaw!==void 0&&(e.rawQuantities.some(t=>t.role===`minimum_output`&&t.rawAmount===e.slippageOrMinOut.minOutRaw)||t.addIssue({code:`custom`,path:[`slippageOrMinOut`,`minOutRaw`],message:`slippageOrMinOut.minOutRaw must match a minimum_output rawQuantities entry`})),e.slippageOrMinOut.policyEvidenceClaimId!==void 0){let n=u(e.slippageOrMinOut.policyEvidenceClaimId,`slippage_policy`,[`slippageOrMinOut`,`policyEvidenceClaimId`],`slippageOrMinOut.policyEvidenceClaimId`);n?.factKind===`slippage_policy`&&(Z(t,e.slippageOrMinOut.policySource,n.policySource,[`slippageOrMinOut`,`policySource`],`slippageOrMinOut.policySource`),Z(t,e.slippageOrMinOut.maxSlippageBps,n.maxSlippageBps,[`slippageOrMinOut`,`maxSlippageBps`],`slippageOrMinOut.maxSlippageBps`),n.policySource===`adapter_policy_from_quote_evidence`&&Z(t,e.slippageOrMinOut.minOutRaw,n.minOutRaw,[`slippageOrMinOut`,`minOutRaw`],`slippageOrMinOut.minOutRaw`))}e.objectOwnership.objects.forEach((n,r)=>{let i=u(n.evidenceClaimId,`object_ownership`,[`objectOwnership`,`objects`,r,`evidenceClaimId`],`objectOwnership.objects[${r}].evidenceClaimId`);i?.factKind===`object_ownership`&&(Z(t,n.objectId,i.objectId,[`objectOwnership`,`objects`,r,`objectId`],`objectOwnership.objects[${r}].objectId`),Z(t,e.objectOwnership.ownerAccount,i.ownerAccount,[`objectOwnership`,`ownerAccount`],`objectOwnership.ownerAccount`),Z(t,n.ownership,i.ownership,[`objectOwnership`,`objects`,r,`ownership`],`objectOwnership.objects[${r}].ownership`))});let f=u(e.simulation.evidenceClaimId,`simulation_result`,[`simulation`,`evidenceClaimId`],`simulation.evidenceClaimId`);f?.factKind===`simulation_result`&&(Z(t,e.simulation.provider,f.provider,[`simulation`,`provider`],`simulation.provider`),Z(t,e.simulation.checksEnabled,f.checksEnabled,[`simulation`,`checksEnabled`],`simulation.checksEnabled`),Z(t,e.simulation.simulatedAt,f.simulatedAt,[`simulation`,`simulatedAt`],`simulation.simulatedAt`),Z(t,e.simulation.status,f.status,[`simulation`,`status`],`simulation.status`),vb(t,e.simulation.requiredFields,f.requiredFields,[`simulation`,`requiredFields`],`simulation.requiredFields`),vb(t,e.simulation.missingFields,f.missingFields,[`simulation`,`missingFields`],`simulation.missingFields`),Z(t,e.simulation.failureReason,f.failureReason,[`simulation`,`failureReason`],`simulation.failureReason`))}).superRefine((e,t)=>{let n=e.reviewedTransactionDigest;Z(t,e.humanReadableReview.transactionDigest,n,[`humanReadableReview`,`transactionDigest`],`humanReadableReview.transactionDigest`),Z(t,e.simulation.transactionDigest,n,[`simulation`,`transactionDigest`],`simulation.transactionDigest`)}),Pb=B({contractVersion:G(ky),artifactKind:G(`ptb_visualization`),generatedAt:ob,source:B({adapterId:F().min(1).max(120),planId:F().min(1).max(120).optional(),sourceKind:W([`review_time_generated_transaction_kind`,`review_time_ir`,`renderer_model`]),authority:G(`visualization_only_not_wallet_authorization`),renderer:B({name:F().min(1).max(120),packageName:F().min(1).max(120).optional(),version:F().min(1).max(80).optional()}).strict().optional()}).strict(),mermaid:B({diagramType:G(`flowchart`),text:pb(2e4,`mermaid.text`),namedText:pb(2e4,`mermaid.namedText`)}).strict(),diagnostics:z(B({severity:W([`info`,`warning`,`error`]),code:F().min(1).max(120),message:pb(512,`diagnostics.message`),source:W([`adapter`,`renderer`,`schema`,`simulation`])}).strict()).default([]),unsupportedUse:z(W(Ny)).min(1),executableMaterial:B({included:G(!1),policy:G(`mcp_and_review_ui_outputs_must_not_include_executable_transaction_material`)}).strict()}).strict().superRefine((e,t)=>{gb(t,e.unsupportedUse,Ny,[`unsupportedUse`],`unsupportedUse`)}),Fb=U(F(),R()),Ib=W(wy),Lb=W(Ty);W([`ready_for_wallet_review`,`refresh_required`,`blocked`]);var Rb=W(Ey);W([`proposed`,`awaiting_wallet`,`wallet_connected`,`ready_for_wallet_review`,`refresh_required`,`blocked`,`expired`,`awaiting_signature`,`submitting`,`awaiting_chain_result`,`stopped`,`request_failed`,`outcome_unknown`,`completed`]);var zb=B({id:F(),label:F(),status:W([`pass`,`warning`,`fail`]),message:F(),source:W([`registry`,`quote`,`wallet`,`simulation`,`adapter`,`network`,`proposal`])}),Bb=F().min(1),Vb=`human_readable_review`,Hb=`review_time_simulation`,Ub=B({stageCatalogId:F().min(1),adapterId:F(),protocol:F(),actionKind:F(),completedStages:z(Bb),missingStages:z(Bb)}).strict().superRefine((e,t)=>{let n=Wb(e.completedStages);n&&t.addIssue({code:`custom`,path:[`completedStages`],message:`completedStages contains duplicate stage '${n}'`});let r=Wb(e.missingStages);r&&t.addIssue({code:`custom`,path:[`missingStages`],message:`missingStages contains duplicate stage '${r}'`});for(let n of e.completedStages)e.missingStages.includes(n)&&t.addIssue({code:`custom`,path:[`missingStages`],message:`stage '${n}' cannot be both completed and missing`})});function Wb(e){let t=new Set;for(let n of e){if(t.has(n))return n;t.add(n)}}var Gb=B({symbol:F(),amount:F(),coinType:F().optional(),approx:L().optional()}).strict(),Kb=Gb.extend({amountKind:G(`display_intent`).default(`display_intent`)}),qb=B({outgoing:z(Kb),expectedIncoming:z(Kb),minimumIncoming:z(Kb).optional(),fees:z(Kb).optional()}),Jb=B({outgoing:z(Gb),expectedIncoming:z(Gb),minimumIncoming:z(Gb).optional(),fees:z(Gb).optional()}),Yb=B({before:z(Gb),after:z(Gb),delta:z(Gb)}),Xb=B({computationCostRaw:P_(`computationCostRaw`),storageCostRaw:P_(`storageCostRaw`),storageRebateRaw:P_(`storageRebateRaw`),nonRefundableStorageFeeRaw:P_(`nonRefundableStorageFeeRaw`)}).strict(),Zb=B({address:h_,coinType:F().min(1).max(512).refine(e=>{try{return z_(e)===e}catch{return!1}},`Expected a normalized Sui struct tag coin type`),amount:R_(`balanceChanges[].amount`)}).strict(),Qb=B({objectId:h_,objectType:F().min(1).max(512).optional(),inputState:F().min(1).max(80),outputState:F().min(1).max(80),idOperation:F().min(1).max(80)}).strict(),$b=B({provider:Oy,checksEnabled:L(),success:L(),gasCostSummary:Xb.optional(),balanceChanges:z(Zb).optional(),objectChanges:z(Qb).optional(),error:F().optional()}),ex=$b,tx=$b.extend({checksEnabled:G(!0),success:G(!0),gasCostSummary:Xb,balanceChanges:z(Zb),objectChanges:z(Qb),error:uc().optional()}).strict(),nx=B({role:W([`input`,`expected_output`,`minimum_output`,`fee`]),symbol:F(),coinType:F().min(1).max(512).refine(e=>{try{return z_(e),!0}catch{return!1}},`Expected a Sui struct tag coin type`),decimals:I().int().min(0).max(255),rawAmount:P_(`rawAmount`),rawAmountSource:G(`quote_policy_evidence`),displayAmount:F().optional(),displayAmountSource:G(`user_display_intent_not_signing_input`).optional()}).strict().superRefine((e,t)=>{e.displayAmount!==void 0&&e.displayAmountSource===void 0&&t.addIssue({code:`custom`,path:[`displayAmountSource`],message:`displayAmountSource is required when displayAmount is present`}),e.displayAmount===void 0&&e.displayAmountSource!==void 0&&t.addIssue({code:`custom`,path:[`displayAmount`],message:`displayAmount is required when displayAmountSource is present`})}),rx=B({role:W([`connected_account`,`output_recipient`]),address:h_}).strict(),ix=B({kind:G(`swap_output_asset`),symbol:F(),coinType:F().min(1).max(512).refine(e=>{try{return z_(e),!0}catch{return!1}},`Expected a Sui struct tag coin type`),protocol:F(),poolKey:F(),direction:W([`base_to_quote`,`quote_to_base`])}).strict(),ax=B({id:F(),label:F(),source:H([W([`registry`,`quote`,`wallet`,`simulation`,`adapter`,`network`,`proposal`]),W([`transaction_material`,`digest_commitment`])]),summary:F()}).strict(),ox=B({id:F(),label:F(),reason:F()}).strict(),sx=B({proposedAction:B({title:F(),summary:F(),actionKind:F(),adapterId:F(),protocol:F(),network:G(`sui:mainnet`)}).strict(),recipients:z(rx),evidenceUsed:z(ax),missingEvidence:z(ox),requiredUserChoices:z(ox),unsupportedClaims:z(ox),freshness:B({status:G(`current`),evaluatedAt:F(),expiresAt:F(),reason:F()}).strict(),blockingChecks:z(zb)}).strict(),cx=B({assetFlow:B({outgoing:z(nx),expectedIncoming:z(nx),minimumIncoming:z(nx),fees:z(nx)}).strict(),targets:z(ix)}).strict(),lx=hc(`kind`,[sx.extend({kind:G(`swap_human_readable_review`)}).merge(cx)]),ux=B({id:F(),actionKind:F(),adapterId:F(),protocol:F(),title:F(),summary:F(),assetFlowPreview:qb,reviewModel:Cy.optional(),adapterData:Fb,createdAt:F(),expiresAt:F().optional(),registryVersion:F().optional(),preliminaryChecks:z(zb).optional()}),dx=B({planId:F(),reviewSessionId:F(),account:h_,checks:z(zb),assetFlowActual:Jb.optional(),beforeAfterBalance:Yb.optional(),simulation:ex.optional(),humanReadableReview:lx.optional(),transactionReviewData:Nb.optional(),ptbVisualization:Pb.optional(),adapterLifecycle:Ub.optional(),updatedAt:F()}),fx=hc(`status`,[dx.extend({status:G(`ready_for_wallet_review`),evidenceValidity:uc().optional(),blockedReason:uc().optional(),refreshReason:uc().optional()}),dx.extend({status:G(`refresh_required`),evidenceValidity:G(`invalidated`).optional(),refreshReason:Lb,blockedReason:uc().optional()}),dx.extend({status:G(`blocked`),evidenceValidity:G(`invalidated`).optional(),blockedReason:Ib,refreshReason:uc().optional()})]).superRefine((e,t)=>{if(e.evidenceValidity===`invalidated`)for(let n of Dy)e[n]!==void 0&&t.addIssue({code:`custom`,path:[n],message:`Invalidated review evidence cannot carry current material-derived facts`});let n=e.adapterLifecycle;if(n!==void 0&&px(e,t),e.humanReadableReview!==void 0&&n===void 0&&t.addIssue({code:`custom`,path:[`humanReadableReview`],message:`humanReadableReview requires adapterLifecycle evidence stage provenance`}),e.simulation!==void 0&&n===void 0&&t.addIssue({code:`custom`,path:[`simulation`],message:`simulation requires adapterLifecycle evidence stage provenance`}),e.ptbVisualization!==void 0){let e=n?.completedStages??[];e.includes(`transaction_material_build_or_verify`)&&e.includes(`digest_commitment`)||t.addIssue({code:`custom`,path:[`ptbVisualization`],message:`ptbVisualization requires completed transaction material and digest commitment lifecycle stages`})}let r=e.status===`ready_for_wallet_review`;e.transactionReviewData!==void 0&&!r&&t.addIssue({code:`custom`,path:[`transactionReviewData`],message:`transactionReviewData is only valid on ready_for_wallet_review`}),e.status===`ready_for_wallet_review`&&n!==void 0&&(e.transactionReviewData===void 0&&t.addIssue({code:`custom`,path:[`transactionReviewData`],message:`ready_for_wallet_review requires an emitted wallet review contract`}),(n===void 0||n.missingStages.length!==0)&&t.addIssue({code:`custom`,path:[`adapterLifecycle`],message:`ready_for_wallet_review requires a completed adapterLifecycle with no missing stages`}),e.humanReadableReview===void 0&&t.addIssue({code:`custom`,path:[`humanReadableReview`],message:`ready_for_wallet_review requires humanReadableReview public evidence`}),e.simulation===void 0&&t.addIssue({code:`custom`,path:[`simulation`],message:`ready_for_wallet_review requires successful simulation public evidence`})),e.status===`blocked`&&(e.blockedReason===`producer_stage_missing`&&n===void 0&&t.addIssue({code:`custom`,path:[`adapterLifecycle`],message:`producer_stage_missing requires adapterLifecycle with at least one missing stage`}),e.blockedReason===`producer_stage_missing`&&n!==void 0&&n.missingStages.length===0&&t.addIssue({code:`custom`,path:[`blockedReason`],message:`producer_stage_missing requires at least one adapterLifecycle.missingStages entry`}),e.blockedReason===`wallet_review_contract_emit_missing`&&e.transactionReviewData!==void 0&&t.addIssue({code:`custom`,path:[`transactionReviewData`],message:`wallet_review_contract_emit_missing requires the wallet review contract to be absent`}),e.blockedReason===`wallet_review_contract_emit_missing`&&n===void 0&&t.addIssue({code:`custom`,path:[`adapterLifecycle`],message:`wallet_review_contract_emit_missing requires adapterLifecycle`}),e.blockedReason===`wallet_review_contract_emit_missing`&&n!==void 0&&n.missingStages.length!==0&&t.addIssue({code:`custom`,path:[`blockedReason`],message:`wallet_review_contract_emit_missing requires a completed adapterLifecycle with no missing stages`}),e.blockedReason===`wallet_review_contract_emit_missing`&&e.evidenceValidity!==`invalidated`&&e.humanReadableReview===void 0&&t.addIssue({code:`custom`,path:[`humanReadableReview`],message:`wallet_review_contract_emit_missing requires humanReadableReview public evidence`}),e.blockedReason===`wallet_review_contract_emit_missing`&&e.evidenceValidity!==`invalidated`&&e.simulation===void 0&&t.addIssue({code:`custom`,path:[`simulation`],message:`wallet_review_contract_emit_missing requires simulation public evidence`}))});function px(e,t){let n=e.adapterLifecycle;n&&(e.humanReadableReview!==void 0&&mx(t,n,Vb,[`humanReadableReview`]),e.simulation!==void 0&&(mx(t,n,Hb,[`simulation`]),mx(t,n,Vb,[`simulation`]),hx(t,e.simulation,[`simulation`])),n.missingStages.includes(Hb)&&e.simulation!==void 0&&t.addIssue({code:`custom`,path:[`simulation`],message:`simulation public evidence cannot be present while review_time_simulation is missing`}),n.missingStages.includes(Vb)&&e.humanReadableReview!==void 0&&t.addIssue({code:`custom`,path:[`humanReadableReview`],message:`humanReadableReview public evidence cannot be present while human_readable_review is missing`}))}function mx(e,t,n,r){t.completedStages.includes(n)||e.addIssue({code:`custom`,path:r,message:`${r.join(`.`)} requires completed adapterLifecycle stage '${n}'`}),t.missingStages.includes(n)&&e.addIssue({code:`custom`,path:r,message:`${r.join(`.`)} cannot be present while adapterLifecycle stage '${n}' is missing`})}function hx(e,t,n){tx.safeParse(t).success||e.addIssue({code:`custom`,path:n,message:`simulation public evidence requires a successful checks-enabled review-time simulation projection`})}var gx=B({topic:F().min(1),grants:O_,expiresAt:F().datetime(),walletName:F().optional()}).strict(),_x={topic:F().min(1),lifecycleRevision:I().int().positive(),grantRevisions:S_},vx=hc(`status`,[B({..._x,status:G(`present`),session:gx}).strict(),B({..._x,status:W([`absent`,`unusable`])}).strict()]);B({chainId:G(b_),lifecycleRevision:I().int().positive(),grantRevision:I().int().nonnegative()});var yx=B({runId:Z_,sequence:I().int().positive(),observedAt:F().datetime()}).strict();yx.extend({sessions:z(vx)}).strict();var bx=F().uuid(),xx={operationId:bx,walletRunId:Z_},Sx=hc(`action`,[B({action:G(`connect`),...xx,chains:C_}).strict(),B({action:G(`disconnect`),...xx,connectionId:F().min(1),impactId:F().min(1)}).strict()]);B({}).strict();var Cx=B({operationId:bx,cardId:F().min(1),action:W([`connect`,`disconnect`]),status:W([`running`,`completed`,`failed`,`stopped`]),connectionId:F().min(1),createdAt:F().datetime(),updatedAt:F().datetime(),expiresAt:F().datetime(),settlementPending:L(),message:F().optional(),endReason:W([`user_stopped`,`expired`,`run_ended`]).optional()}).strict();Cx.pick({operationId:!0,action:!0,status:!0,settlementPending:!0});var wx=`A wallet connection provides account context; it is not a transaction approval or proof of address ownership.`,Tx=`Review evidence is not a safety guarantee. Only an explicit card action and wallet approval may authorize this exact transaction.`,Ex=iv.extend({sessionPresence:W([`present`,`absent`,`unusable`,`unconfirmed`]),chainStates:z(av).optional(),disconnectImpact:B({impactId:F(),requestCount:I().int().nonnegative(),chains:C_}).strict().optional()});W([`awaiting_approval`,`disconnect_pending`,`cleanup_pending`]);var Dx=B({action:W([`prepare_review`,`request_signature`]),connectionId:F().min(1),walletRunId:Z_,account:h_,reviewRevision:I().int().nonnegative()}).strict(),Ox=B({action:W([`cancel`,`stop_waiting`,`read_result`])}).strict(),kx=H([Sx,B({action:G(`stop_connection`),operationId:F().uuid()}).strict(),Dx,Ox]),Ax=H([Sx.options[0],Dx.extend({action:G(`prepare_review`)})]);function jx(e,t){e.reviewTarget&&(e.review?.account&&e.review.account!==e.reviewTarget.account||e.request&&e.request.account!==e.reviewTarget.account)&&t.addIssue({code:`custom`,path:[`reviewTarget`],message:`The fixed review target must match its recorded account and request.`})}var Mx=B({kind:W(lv),message:F().optional(),reason:F().optional()}).strict(),Nx={allowedActions:z(W(cv)),actionRemainingMs:I().int().nonnegative(),nextStateReadAfterMs:I().int().nonnegative().optional(),observe:L(),walletAvailability:ev,walletObservation:yx.optional(),progress:tv,nextStep:Mx},Px=B({...Nx,kind:G(`connect`),mode:G(`connect`),allowedActions:z(W([`connect`,`cancel`,`stop_connection`])),boundary:G(wx),requestedChains:C_,operation:Cx.optional(),automaticAction:Sx.options[0].optional()}).strict(),Fx=B({...Nx,kind:G(`disconnect`),mode:G(`disconnect`),allowedActions:z(W([`disconnect`,`cancel`])),boundary:G(wx),connection:Ex.optional(),operation:Cx.optional()}).strict(),Ix=B({reviewSessionId:F(),plan:ux,reviewRevision:I().int().nonnegative(),status:Rb,account:F().optional(),preparing:L(),accountRequestPending:G(!0).optional(),error:F().optional(),state:fx.optional()}).strict(),Lx=B({connectionId:F(),account:h_}).strict(),Rx=F().regex(/^-?[0-9]+$/).optional(),zx=hc(`kind`,[Px,Fx,B({...Nx,kind:G(`review`),mode:W([`review`,`review_manage`]),allowedActions:z(W([`prepare_review`,`request_signature`,`read_result`,`stop_waiting`,`cancel`])),boundary:G(Tx),reviewTarget:Lx.optional(),review:Ix,walletName:F().optional(),acceptedWalletRunId:Z_.optional(),automaticAction:Dx.extend({action:G(`prepare_review`)}).optional(),request:X_.optional(),receipt:R().optional(),netGasMist:Rx,observationStopped:L().optional()}).strict().superRefine(jx)]),Bx=B({message:F(),recordedAt:F().datetime()}).strict(),Vx={allowedActions:z(uc()),observe:G(!1),actionRemainingMs:G(0),result:Bx};B({...Vx,kind:W([`connect`,`disconnect`]),result:Bx.extend({pendingWork:W([`approval_response`,`session_removal`,`session_status`]).optional()}),walletName:F().optional(),networks:z(B({chainId:x_,status:W([`bound`,`not_approved`,`multiple_accounts`,`invalid_response`])}).strict())}).strict(),B({...Vx,kind:G(`review`),mode:W([`review`,`review_manage`]),review:Ix.optional(),reviewTarget:Lx.optional(),request:X_.optional(),receipt:R().optional(),netGasMist:Rx,observationStopped:L().optional(),boundary:G(Tx)}).strict().superRefine(jx);var Hx=`sui-mcp.local-data`,Ux=16777216,Q=F().uuid(),Wx=I().int().nonnegative().safe(),Gx=F().regex(/^[a-f0-9]{64}$/),Kx=hc(`status`,[B({status:G(`no_file`)}).strict(),B({status:G(`receiving`)}).strict(),B({status:G(`checking`)}).strict(),B({status:G(`check_required`),message:F().min(1)}).strict(),B({status:G(`can_restore`)}).strict(),B({status:G(`cannot_restore`),reason:W([`invalid_backup`,`file_unavailable`,`wallet_request_unsettled`,`operation_busy`,`input_unavailable`,`check_failed`]),message:F().min(1)}).strict()]);B({fileId:Q,sha256:Gx,totalSize:Wx,dataEpoch:Wx,userDataRevision:Wx,check:Kx}).strict();var qx=hc(`kind`,[B({kind:G(`set_endpoint`),endpoint:W([`grpc`,`graphql`]),value:F().min(1)}).strict(),B({kind:G(`restore_endpoint`),endpoint:W([`grpc`,`graphql`])}).strict(),B({kind:W([`import_local_data`,`reset_local_data`,`restart_wallet_service`])}).strict()]),Jx=hc(`kind`,[B({kind:G(`clear_read_address`)}).strict(),...qx.options,B({kind:G(`set_wallet_networks`),chains:C_}).strict(),B({kind:G(`download_backup`)}).strict()]);B({operationStatus:B({operationId:F().uuid()}).strict().optional(),backupDelivery:B({operationId:F().uuid(),fileId:F().uuid()}).strict().optional()}).strict().refine(e=>!(e.operationStatus&&e.backupDelivery),`Choose exactly one card purpose.`);var Yx=W([`acknowledged`,`not_completed`,`unconfirmed`,`unsupported`,`not_sent`]),Xx=B({method:G(`ui/download-file`),code:G(-32601)}).strict(),Zx=W([`acknowledged`,`cancelled`,`expired`,`server_restarted`,`data_replaced`,`source_unavailable`,`stored_locally`,`local_save_failed`]),Qx=B({device:F().regex(/^\d+$/),inode:F().regex(/^\d+$/)}).strict(),$x=W([`not_published`,`target_conflict`,`source_unavailable`,`interrupted`]),eS=B({status:W([`needs_consent`,`saving`,`saved`,`failed`]),attemptId:Q,fileId:Q,sha256:Gx,totalSize:Wx,destination:F(),ownerId:F().min(1),currentSaveAttemptId:Q.optional(),attempts:z(B({saveAttemptId:Q,cardId:F().min(1),previousSaveAttemptId:Q.optional(),admittedAt:F().datetime(),allowPossibleCopy:L()}).strict()),sourceIdentity:Qx.optional(),savedAt:F().datetime().optional(),failure:$x.optional()}).strict().superRefine((e,t)=>{(e.status===`needs_consent`?e.attempts.length!==0||e.currentSaveAttemptId!==void 0:!e.currentSaveAttemptId||!e.attempts.some(t=>t.saveAttemptId===e.currentSaveAttemptId))&&t.addIssue({code:`custom`,message:`A local save must identify its admitted attempt.`}),(new Set(e.attempts.map(e=>e.saveAttemptId)).size!==e.attempts.length||e.status===`saved`!=(e.savedAt!==void 0)||e.status===`saved`&&!e.sourceIdentity||e.status===`failed`!=(e.failure!==void 0))&&t.addIssue({code:`custom`,message:`Local save evidence must match its state.`})});B({currentAttemptId:Q,attempts:z(B({attemptId:Q,cardId:F().min(1),admittedAt:F().datetime(),previousAttemptId:Q.optional(),hostReport:Yx.optional(),failure:Xx.optional()}).strict()).min(1),readyAt:F().datetime().optional(),expiresAt:F().datetime().optional(),endReason:Zx.optional(),localSave:eS.optional()}).strict().superRefine((e,t)=>{(new Set(e.attempts.map(e=>e.attemptId)).size!==e.attempts.length||!e.attempts.some(t=>t.attemptId===e.currentAttemptId)||e.readyAt===void 0!=(e.expiresAt===void 0))&&t.addIssue({code:`custom`,message:`Download attempts and lifetime must identify one stored snapshot.`}),(e.endReason===`stored_locally`&&e.localSave?.status!==`saved`||e.endReason===`local_save_failed`&&e.localSave?.status!==`failed`||e.attempts.some(e=>e.hostReport===`unsupported`!=(e.failure!==void 0))||e.localSave&&(e.localSave.attemptId!==e.currentAttemptId||!e.attempts.some(t=>t.attemptId===e.currentAttemptId&&t.hostReport===`unsupported`)||e.localSave.status===`saving`&&e.endReason!==void 0||e.localSave.status===`saved`!=(e.endReason===`stored_locally`)))&&t.addIssue({code:`custom`,message:`Local saving requires the current download's unsupported report.`})});var tS=W([`settings_retry_download`,`settings_report_download`,`settings_cancel_download`,`settings_store_backup`]),nS=hc(`action`,[B({action:G(`settings_clear_read_address`),operationId:Q,connectionId:F().min(1),account:F().min(1)}).strict(),B({action:G(`settings_save_wallet_networks`),operationId:Q,chains:C_.transform(w_),expectedChains:C_.transform(w_)}).strict(),B({action:G(`settings_download_backup`),operationId:Q,attemptId:Q}).strict(),B({action:G(`settings_retry_download`),operationId:Q,fileId:Q,previousAttemptId:Q,attemptId:Q}).strict(),B({action:G(`settings_report_download`),operationId:Q,fileId:Q,attemptId:Q,status:Yx,failure:Xx.optional()}).strict().refine(e=>e.status===`unsupported`==(e.failure!==void 0),`Only unsupported downloads require the exact method failure.`),B({action:G(`settings_store_backup`),operationId:Q,fileId:Q,attemptId:Q,saveAttemptId:Q,previousSaveAttemptId:Q.optional(),allowPossibleCopy:L()}).strict(),B({action:G(`settings_cancel_download`),operationId:Q,fileId:Q,attemptId:Q}).strict(),B({action:G(`settings_select`),draft:qx}).strict(),B({action:G(`settings_prepare`),operationId:Q}).strict(),B({action:G(`settings_begin_upload`),operationId:Q,name:F().min(1),totalSize:Wx.max(Ux),sha256:Gx}).strict(),B({action:G(`settings_upload_chunk`),operationId:Q,fileId:Q,offset:Wx.max(Ux),chunkBase64:F()}).strict(),B({action:G(`settings_seal_upload`),operationId:Q,fileId:Q}).strict(),B({action:G(`settings_confirm`),operationId:Q,preparationId:Q}).strict(),B({action:G(`settings_back`),operationId:Q}).strict(),B({action:G(`settings_cancel`)}).strict()]),rS=B({outcome:W([`completed`,`failed`,`interrupted`,`superseded`]),recordedAt:F().datetime(),message:F().min(1),details:U(F(),R()).optional(),completionScope:G(`backup_delivery`).optional()}).strict(),iS=B({storedValue:F(),effectiveValue:F(),source:W([`environment`,`local_db`,`builtin_default`]),pendingStoredValue:F().optional(),appliesAfter:G(`mcp_server_restart`).optional()}).strict(),aS=B({endpoint:W([`grpc`,`graphql`]),key:W([`suiGrpcUrl`,`suiGraphqlUrl`]),value:F().min(1),status:W([`saved`,`reset`]),storedValue:F(),effectiveValue:F(),source:iS.shape.source}).strict().refine(e=>e.key===(e.endpoint===`grpc`?`suiGrpcUrl`:`suiGraphqlUrl`),`The endpoint kind and preference key must agree.`),oS=I().int().nonnegative().safe(),sS=B({accounts:oS,reviewSessions:oS,reviewStateSnapshots:oS,reviewStatusTransitions:oS,reviewExecutions:oS,reviewRequests:oS,outcomeUnknownRequests:oS,externalActivityScans:oS,externalActivityTransactions:oS,localSettings:oS}).strict(),cS=B({status:G(`valid`),format:G(Hx),network:G(`mainnet`),exportedAt:F().datetime(),currentCounts:sS,incomingCounts:sS,willReplace:G(!0),restartRequiredAfterImport:L()}).strict(),lS=B({kind:G(`settings`),operationId:Q,phase:W([`draft`,`uploading`,`sealed`,`prepared`,`executing`,`stopping`,`starting`,`terminal`]),draft:Jx.optional(),preparationId:Q.optional(),preparation:U(F(),R()).optional(),file:B({fileId:Q,displayName:F(),totalSize:Wx,receivedSize:Wx,sha256:Gx,sealed:L(),cleanup:W([`pending`,`complete`,`failed`])}).strict().optional(),download:B({availability:W([`preparing`,`available`,`ended`]),currentAttemptId:Q,hostReport:Yx.optional(),previousUnconfirmed:L(),endReason:Zx.optional(),expiresAt:F().datetime().optional(),remainingMs:Wx.optional(),localSave:B({status:W([`needs_consent`,`saving`,`saved`,`failed`]),currentSaveAttemptId:Q.optional(),failure:$x.optional(),savedAt:F().datetime().optional()}).strict().optional(),allowedFileActions:z(tS)}).strict().optional(),restoreCheck:Kx.optional(),backupLocation:B({directory:F().min(1),filename:F().min(1)}).strict().optional(),result:rS.optional(),temporaryFileCleanup:W([`pending`,`complete`,`failed`]).optional(),priorRunId:Q.optional(),nextRunId:Q.optional(),supersedesOperationId:Q.optional(),supersededByOperationId:Q.optional(),allowedActions:z(W(nS.options.map(e=>e.shape.action.value))),observe:L(),facts:B({server:B({name:F(),version:F(),network:G(`mainnet`)}).strict(),localSettings:B({suiGrpcUrl:iS,suiGraphqlUrl:iS,walletConnectionChains:C_}).strict(),readAddress:F().optional(),readConnectionId:F().optional(),assetReadAccount:sv,walletAvailability:ev,connectionReconciliationRequired:G(!0).optional(),observedAt:F().datetime().optional(),counts:sS}).strict().optional()}).strict().superRefine((e,t)=>{if(e.download&&(e.draft?.kind!==`download_backup`||!e.file||e.download.availability===`available`&&(!e.file.sealed||e.download.endReason||!e.download.expiresAt)||e.download.availability===`ended`&&!e.download.endReason)&&t.addIssue({code:`custom`,message:`Download delivery must describe its own snapshot and lifetime.`}),e.draft?.kind===`download_backup`&&e.preparation!==void 0&&t.addIssue({code:`custom`,message:`Private download preparation is not public preparation data.`}),e.restoreCheck&&(e.draft?.kind!==`import_local_data`||e.result)&&t.addIssue({code:`custom`,message:`Restore checks belong to an uncompleted import preparation.`}),e.restoreCheck?.status===`can_restore`&&(e.phase!==`prepared`||!e.file?.sealed||!e.allowedActions.includes(`settings_confirm`))&&t.addIssue({code:`custom`,message:`Restore availability requires a sealed file and current confirmation.`}),e.draft?.kind===`import_local_data`&&e.restoreCheck?.status!==`can_restore`&&e.allowedActions.includes(`settings_confirm`)&&t.addIssue({code:`custom`,message:`An unchecked or blocked import cannot offer confirmation.`}),e.restoreCheck?.status===`receiving`&&(!e.file||e.file.sealed||![`draft`,`uploading`].includes(e.phase))&&t.addIssue({code:`custom`,message:`Receiving requires the selected unsealed upload.`}),e.restoreCheck?.status===`check_required`&&(!e.file?.sealed||e.phase!==`sealed`)&&t.addIssue({code:`custom`,message:`A new check requires the same complete sealed upload.`}),e.restoreCheck?.status===`cannot_restore`&&e.restoreCheck.reason===`invalid_backup`&&(e.phase===`prepared`||e.allowedActions.includes(`settings_prepare`))&&t.addIssue({code:`custom`,message:`A rejected backup requires an explicit new selection.`}),e.backupLocation&&(e.result?.outcome!==`completed`||e.draft?.kind!==`download_backup`||e.download?.localSave?.status!==`saved`||e.download.endReason!==`stored_locally`)&&t.addIssue({code:`custom`,message:`A backup location requires its recorded successful export.`}),e.download?.localSave?.status===`saved`&&!e.backupLocation&&t.addIssue({code:`custom`,message:`A saved backup must identify its verified location.`}),e.temporaryFileCleanup&&!e.result&&t.addIssue({code:`custom`,message:`Cleanup of an applied or ended operation requires its recorded result.`}),(e.phase===`terminal`!=(e.result!==void 0)||e.phase===`terminal`&&(e.observe||e.allowedActions.length||e.download?.allowedFileActions.length))&&t.addIssue({code:`custom`,message:`A terminal Settings result cannot grant input or observation.`}),e.phase===`prepared`&&(!e.preparationId||!e.draft||!e.preparation)&&t.addIssue({code:`custom`,message:`Settings confirmation requires a prepared identity and facts.`}),e.phase===`prepared`&&e.draft?.kind===`import_local_data`&&!cS.safeParse(e.preparation?.preview).success&&t.addIssue({code:`custom`,path:[`preparation`,`preview`],message:`Import confirmation requires the validated current and incoming read context and record counts.`}),e.phase===`prepared`&&(e.draft?.kind===`set_endpoint`||e.draft?.kind===`restore_endpoint`)){let n=aS.safeParse(e.preparation?.endpoint);(!n.success||n.data.endpoint!==e.draft.endpoint||n.data.status!==(e.draft.kind===`set_endpoint`?`saved`:`reset`)||e.draft.kind===`set_endpoint`&&n.data.value!==e.draft.value)&&t.addIssue({code:`custom`,path:[`preparation`,`endpoint`],message:`Endpoint confirmation must name its exact prepared target.`})}e.file&&e.file.receivedSize>e.file.totalSize&&t.addIssue({code:`custom`,message:`Received content exceeds the selected file.`})}),uS=65536;function dS(e){return new TextEncoder().encode(JSON.stringify(e)).length}function fS(e){let t=uS-dS(e);return t>0?3*Math.floor(t/4):0}function pS(e){if(!e||typeof e!=`object`)return;let t=structuredClone(e);if(t.method===`tools/call`&&t.params?.name===`ui_act_card`&&t.params.arguments?.input?.action===`settings_upload_chunk`)return t.id=2**53-1,t.params.arguments.revision=2**53-1,t.params.arguments.input.offset=Ux,t.params.arguments.input.chunkBase64=``,fS(t)}var mS={uiOpenAccount:`ui_open_account`,uiOpenReceipt:`ui_open_receipt`,uiOpenChart:`ui_open_chart`,uiReadCard:`ui_read_card`,uiSubmitCard:`ui_submit_card`,uiActCard:`ui_act_card`,uiReadSettingsFile:`ui_read_settings_file`,sessionOpenReviewManagement:`session_open_review_management`,readGetServerStatus:`read_get_server_status`,readListSupportedProtocols:`read_list_supported_protocols`,readListDeepbookPools:`read_list_deepbook_pools`,readListDeepbookTokens:`read_list_deepbook_tokens`,readInspectDeepbookOrderbook:`read_inspect_deepbook_orderbook`,readGetDeepbookMidPrice:`read_get_deepbook_mid_price`,readGetDeepbookUsdcPriceHistory:`read_get_deepbook_usdc_price_history`,readGetDeepbookUsdcPriceAtTime:`read_get_deepbook_usdc_price_at_time`,readQuoteDeepbookAction:`read_quote_deepbook_action`,readQuoteDeepbookDisplayAmount:`read_quote_deepbook_display_amount`,readSummarizeDeepbookAccountInventory:`read_summarize_deepbook_account_inventory`,readSummarizeWalletAssets:`read_summarize_wallet_assets`,readClassifyWalletAssets:`read_classify_wallet_assets`,readListSettlementAssetGroups:`read_list_settlement_asset_groups`,readSummarizeSettlementAssetGroupParity:`read_summarize_settlement_asset_group_parity`,readPreviewIntentEvidence:`read_preview_intent_evidence`,readListReviewActivity:`read_list_review_activity`,readSummarizeReviewFunnel:`read_summarize_review_funnel`,readGetReviewSessionDetail:`read_get_review_session_detail`,readInspectSuiTransaction:`read_inspect_sui_transaction`,readScanSuiAccountActivity:`read_scan_sui_account_activity`,readSummarizeSuiActivityScan:`read_summarize_sui_activity_scan`,readScanSuiFunctionActivity:`read_scan_sui_function_activity`,readSummarizeSuiFunctionActivityScan:`read_summarize_sui_function_activity_scan`,readSummarizeSuiAccountActivity:`read_summarize_sui_account_activity`,readGetAccountAssetTimeline:`read_get_account_asset_timeline`,settingsCreateLocalSettingsSession:`settings_create_local_settings_session`,settingsGetLocalSettings:`settings_get_local_settings`,actionStartReview:`action_start_review`,actionCreateProposalReview:`action_create_proposal_review`,sessionOpenWalletDisconnectionCard:`session_open_wallet_disconnection_card`,sessionOpenWalletConnectionCard:`session_open_wallet_connection_card`,sessionGetWalletConnectionCard:`session_get_wallet_connection_card`,sessionWaitWalletConnectionCard:`session_wait_wallet_connection_card`,sessionGetInteractionStatus:`session_get_interaction_status`,sessionGetReviewStatus:`session_get_review_status`,sessionGetExecutionResult:`session_get_execution_result`,sessionWaitExecutionResult:`session_wait_execution_result`,accountGetActiveAccount:`account_get_active_account`},hS=B({connectionId:F().min(1),pairingUri:F().startsWith(`wc:`),expiresAt:F().datetime()}).strict(),gS=W([`account`,`receipt`,`chart`,`connect`,`disconnect`,`review`,`settings`]),_S=B({cardId:F().min(1),kind:gS,state:W([`ready`,`running`,`closed`]),revision:I().int().nonnegative(),createdAt:F().datetime(),expiresAt:F().datetime(),input:U(F(),R()),data:R().optional(),reason:W([`completed`,`expired`,`failed`,`server_restarted`,`cancelled`]).optional(),error:F().optional()}).strict().extend({pollAfterMs:I().int().positive(),inputRemainingMs:I().int().nonnegative()}),vS=B({transactionDigest:F().min(1),pureInputs:z(B({index:I().int().nonnegative(),bytes:F().regex(/^0x(?:[0-9a-f]{2})*$/i)}).strict()).refine(e=>new Set(e.map(e=>e.index)).size===e.length,`Duplicate input index.`),ptbGraph:B({mermaid:B({text:F(),namedText:F()}).strict()}).strict().optional()}).strict(),yS=`sui-mcp/card`,bS=`sui-mcp/receipt-display`,xS=`sui-mcp/wallet-display`,SS=`sui-mcp/settings-file`,CS=`suimcp://cards/`,wS=hc(`kind`,[B({kind:G(`account`),status:G(`input_required`),field:G(`account`),message:F().min(1)}).strict(),B({kind:G(`receipt`),status:G(`input_required`),field:G(`digest`),message:F().min(1)}).strict()]),TS=B({cardId:F().min(1),permission:F().min(1)}).strict();TS.extend({revision:I().int().nonnegative(),input:U(F(),R())}).strict();var ES=vS.extend({cardId:F().min(1),revision:I().int().nonnegative(),attemptId:F().min(1).optional()}),DS=hS.extend({cardId:F().min(1),revision:I().int().nonnegative()}),OS=B({attemptId:F().uuid(),cardId:F().min(1),operationId:F().uuid(),fileId:F().uuid(),offset:I().int().nonnegative().safe(),totalSize:I().int().nonnegative().safe(),sha256:F().regex(/^[a-f0-9]{64}$/),chunkBase64:F()}).strict(),kS={account:mS.uiOpenAccount,receipt:mS.uiOpenReceipt,chart:mS.uiOpenChart,read:mS.uiReadCard,submit:mS.uiSubmitCard,act:mS.uiActCard,readSettingsFile:mS.uiReadSettingsFile};function $(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function AS(e){return e.kind!==`import_local_data`}function jS(e,t,n){if(e.kind!==`settings`||t.kind!==`settings`||e.cardId!==t.cardId||t.state!==`ready`)return;let r=lS.safeParse(e.data),i=lS.safeParse(t.data);if(!r.success||!i.success)return;let a=r.data,o=i.data,s=o.draft;if(n.action===`settings_select`&&a.operationId===o.operationId){let r=Jx.safeParse(n.draft);if(r.success&&AS(r.data)&&(t.revision===e.revision||NS(r.data,s)))return{kind:`selection_response`,cardId:t.cardId,operationId:o.operationId,draft:r.data}}if(!s||!a.draft||a.operationId!==o.operationId||n.operationId!==o.operationId||JSON.stringify(a.draft)!==JSON.stringify(s))return;if(AS(s))return n.action===`settings_prepare`?{kind:`preparation_response`,cardId:t.cardId,operationId:o.operationId,draft:s}:void 0;let c=o.file?.fileId;if(!(!c||!a.file?.fileId||a.file.fileId!==c||n.action!==`settings_prepare`&&n.action!==`settings_seal_upload`||n.action===`settings_seal_upload`&&n.fileId!==c))return{kind:`backup_check_response`,cardId:t.cardId,operationId:o.operationId,fileId:c,action:n.action}}function MS(e){return Object.keys(e).filter(t=>e[t]!==void 0)}function NS(e,t){if(e===t)return!0;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>NS(e,t[n]));let n=$(e),r=$(t);if(!n||!r)return!1;let i=MS(n);return i.length===MS(r).length&&i.every(e=>Object.hasOwn(r,e)&&NS(n[e],r[e]))}function PS(e,t=!0){let n=$(e);if(!n)throw Error(`The app did not provide a usable card response.`);let r=()=>Error(`The app provided inconsistent card response information.`),i,a=e=>{let t=$(e);if(!t||typeof t.ok!=`boolean`||i&&!NS(i,t))throw r();i=t};n.structuredContent!==void 0&&a(n.structuredContent);let o,s;if(Array.isArray(n.content))for(let e of n.content){let n=$(e);if(n?.type!==`text`||typeof n.text!=`string`)continue;let i;try{i=$(JSON.parse(n.text))}catch{continue}if(i){if(i.ok!==void 0)a(i);else if(Array.isArray(i.content)){if(!t||o)throw r();let n=Xu.safeParse(i);if(!n.success)throw r();o=PS(n.data,!1),s=e,o.structuredContent!==void 0&&a(o.structuredContent)}}}let c=Object.create(null),l=!1;for(let e of[n._meta,o?._meta]){if(e===void 0)continue;let t=$(e);if(!t)throw r();for(let e of MS(t)){let n=t[e];if(Object.hasOwn(c,e)&&!NS(c[e],n))throw r();c[e]=n}l=!0}if(n.isError!==void 0&&typeof n.isError!=`boolean`||o?.isError!==void 0&&n.isError!==void 0&&o.isError!==n.isError||(n.isError===!0||o?.isError===!0)&&i?.ok===!0)throw r();return{...o,...n,...o?{content:[...Array.isArray(n.content)?n.content.filter(e=>e!==s):[],...Array.isArray(o.content)?o.content:[]]}:{},...i?{structuredContent:i}:{},...l?{_meta:c}:{}}}function FS(e,t){let n=$($(e?.data)?.request);return!!e&&(e.kind===`receipt`||e.kind===`review`)&&t.cardId===e.cardId&&t.revision===e.revision&&t.transactionDigest===(e.kind===`receipt`?e.input.digest:n?.transactionDigest)&&(e.kind!==`review`||t.attemptId===n?.attemptId)}function IS(e){let t;for(let n of Array.isArray(e.content)?e.content:[]){let e=$(n),r;if(e?.type===`resource_link`&&typeof e.uri==`string`&&e.uri.startsWith(`suimcp://cards/`)&&(r=e.uri),e?.type===`text`&&typeof e.text==`string`){let t=/^\[Resource link: card_([A-Za-z0-9_-]+)\] (suimcp:\/\/cards\/([A-Za-z0-9_-]+)) \(Saved data for this exact card\.\)$/.exec(e.text);if(!t&&e.text.startsWith(`[Resource link:`)&&e.text.includes(`suimcp://cards/`))throw Error(`The saved card links could not be matched to one card.`);if(t){if(t[1]!==t[3])throw Error(`The saved card links could not be matched to one card.`);r=t[2]}}if(r===void 0)continue;let i=r.slice(CS.length);if(!i||encodeURIComponent(i)!==i||t!==void 0&&i!==t||e?.type===`resource_link`&&typeof e.name==`string`&&e.name.startsWith(`card_`)&&e.name!==`card_${i}`)throw Error(`The saved card links could not be matched to one card.`);t=i}return t}function LS(e){let t=$(e.structuredContent),n=t?.ok===!0?wS.safeParse(t.data):void 0,r=$($(t?.error)?.details),i=n?.success?void 0:t?.ok===!0?$(t.data)?.card??t.data:r?.snapshot,a=i===void 0?void 0:_S.parse(i);a?.kind===`settings`&&lS.parse(a.data);let o=$(e._meta)?.[bS],s=o===void 0?void 0:ES.parse(o);if(s&&!FS(a,s))throw Error(`Transaction details do not match this saved result.`);let c=$(e._meta)?.[xS],l=c===void 0?void 0:DS.parse(c);if(l&&(!a||a.kind!==`connect`||l.cardId!==a.cardId||l.revision!==a.revision||l.connectionId!==$($(a.data)?.operation)?.connectionId))throw Error(`The connection QR code does not match this card.`);return{snapshot:a,display:s,wallet:l,inputRequired:n?.success?n.data:void 0,error:typeof r?.message==`string`?r.message:typeof r?.reason==`string`?r.reason:void 0}}function RS(e,t){let n=document.getElementById(`app`);if(!n)throw Error(`Card root is unavailable.`);let r=document.createElement(`h1`);r.textContent=t.title;let i=document.createElement(`p`);i.className=`ui-note`,i.setAttribute(`role`,`status`);let a=document.createElement(`p`);a.className=`ui-error`,a.setAttribute(`role`,`alert`);let o=document.createElement(`p`);o.className=`ui-note card-guidance`;let s=document.createElement(`section`),c=document.createElement(`div`);c.className=`card-actions`;let l=document.createElement(`div`);l.className=`card-progress-hint`,l.hidden=!0,n.replaceChildren(r,i,a,s,o,l,c);let u=new Zh({name:`sui-mcp-card`,version:`0.8.0`},{},{autoResize:!0,strict:!0}),d=new AbortController,f=e===`connect`||e===`disconnect`||e===`review`,p=e===`settings`,m=f||p,h=!1,g,_,v,y,b,ee,x,te=!1,ne=!1,re,ie,S={status:`unconfirmed`},ae,oe,se,C,w,T=`continue`,ce,E,D=0,O=0,le,ue,de,fe,k,pe,me,he,ge=!1;function _e(){if(!C||!y)return;let{input:t,basis:n}=C,r=$(y.data),i=$(n.data),a=$(r?.request),o=$(r?.review),s=$(i?.request),c=!!a&&a.attemptId===s?.attemptId;if(!f)return y.state===`running`||y.reason===`completed`?C.delivery===`rejected`?`past`:`observed`:y.state===`closed`?`past`:`active`;if((e===`connect`||e===`disconnect`)&&typeof t.operationId==`string`){let e=$(r?.operation)?.operationId===t.operationId?$(r?.operation):void 0;if(t.action===`stop_connection`){if(e?.endReason===`user_stopped`)return`observed`;if(e&&e.status!==`running`)return`past`}else if(e)return`observed`}if(t.walletRunId&&t.walletRunId!==$(r?.walletAvailability)?.walletRunId&&t.walletRunId!==r?.acceptedWalletRunId)return`past`;switch(t.action){case`connect`:break;case`prepare_review`:if(typeof o?.reviewRevision==`number`&&typeof t.reviewRevision==`number`&&o.reviewRevision>t.reviewRevision)return o.account===t.account?`observed`:`past`;break;case`request_signature`:if(a?.account===t.account&&a?.reviewRevision===t.reviewRevision)return`observed`;if(typeof o?.reviewRevision==`number`&&typeof t.reviewRevision==`number`&&o.reviewRevision>t.reviewRevision||!a&&o&&o.reviewRevision===t.reviewRevision&&o.account===t.account&&o.status===`refresh_required`&&$(o.state)?.refreshReason===`review_evidence_stale`&&Array.isArray(r?.allowedActions)&&r.allowedActions.includes(`prepare_review`))return`past`;break;case`cancel`:if(y.reason===`cancelled`)return`observed`;break;case`disconnect`:case`stop_connection`:break;case`stop_waiting`:if(c&&(a?.requestStatus===`stopped`||r?.observationStopped===!0))return`observed`;if(c&&[`completed`,`request_failed`,`outcome_unknown`].includes(String(a?.requestStatus)))return`past`;break;case`read_result`:if(c&&(r?.observe===!0||a?.requestStatus===`completed`))return`observed`;if(c&&[`stopped`,`request_failed`].includes(String(a?.requestStatus)))return`past`}return ve()||typeof r?.actionRemainingMs==`number`&&r.actionRemainingMs<=0||[`connect`,`disconnect`,`cancel`,`prepare_review`,`request_signature`].includes(String(t.action))&&(y.state!==`ready`||o?.status===`expired`)?`past`:`active`}function ve(){let e=kx.safeParse(C?.input),t=zx.safeParse(y?.data);if(!e.success||!t.success)return!1;let n=e.data,r=t.data,i=`operationId`in n&&!!y&&y.state===`ready`&&y.input.operationId===n.operationId&&r.kind!==`review`&&!r.operation;if(n.action===`connect`)return r.kind===`connect`&&i&&JSON.stringify([...n.chains].sort())!==JSON.stringify([...r.requestedChains].sort());if(n.action===`prepare_review`||n.action===`request_signature`)return r.kind!==`review`||r.reviewTarget?.connectionId!==n.connectionId||r.reviewTarget?.account!==n.account;if(n.action!==`disconnect`||r.kind!==`disconnect`)return!1;let a=r.connection?.connectionId===n.connectionId?r.connection:void 0;return a?i&&a.disconnectImpact?.impactId!==n.impactId||r.nextStep.reason===`no_session_to_disconnect`||r.nextStep.reason===`connection_target_changed`:i}function ye(){if(!C)return;let e=_e();e&&C.disposition!==`observed`&&(e!==`active`||C.disposition===`active`)&&(C.disposition=e),C.disposition===`observed`&&(C.retryRequired=!1)}function be(){if(y?.reason===`cancelled`)return;let e=Ax.safeParse($(y?.data)?.automaticAction);return C?.retryRequired&&e.success&&C.input.action===e.data.action?e.data:void 0}function xe(e){let t={connect:`connection request`,prepare_review:`review update`,request_signature:`wallet approval request`,read_result:`transaction status check`,cancel:`cancellation request`,stop_connection:`request to stop connecting`,stop_waiting:$($(e.basis.data)?.request)?.requestStatus===`awaiting_signature`?`request to stop wallet approval`:`request to stop checking the result`,disconnect:`wallet disconnect request`};return f?t[String(e.input.action)]??`request`:`data request`}function Se(e){if(e!==`past`||!C)return;let t=xe(C),n=C.input.action===`read_result`&&$($(y?.data)?.request)?.requestStatus===`outcome_unknown`?` To check this transaction again, ask to open its result in chat.`:``;return`Message from an earlier ${t}: “${C.message}”${n}`}let Ce,we;function Te(){let t=$(y?.data),n=p?$(t?.download):void 0,r=y?.state===`closed`,i=Array.isArray(n?.allowedFileActions)?n.allowedFileActions:[],a=r?[]:[...Array.isArray(t?.allowedActions)?t.allowedActions:[],...i.filter(e=>e===`settings_report_download`||Ce===void 0||Date.now()<Ce)],o=e===`review`&&t?.mode===`review`&&!t.request&&!!g&&y?.state===`ready`,s=o&&le!==void 0&&Date.now()>=le,c=document.visibilityState!==`hidden`,l=d.signal.aborted||S.status===`rejected`,u=S.status===`confirmed`,v=C?.disposition,b=v===`active`,ee=C?.retryRequired===!0,x=C?.input.action===`request_signature`&&v===`active`,ne=T===`paused`,re=pe?.pending?.()===!0,D=pe?.displayRecovery?.(),ue=u&&!l&&!oe&&!re&&!s&&!!g,de=ue&&!w&&!h&&(!m||!(ce&&(b||ee||ne))),fe=Ax.safeParse(t?.automaticAction),k=p?$(n?.localSave):void 0,me=!!y&&!r&&(m?t?.observe===!0||k?.status===`saving`:y.state===`running`),he=!!_&&te&&!l&&!ce&&c&&(E===`explicit`||S.status!==`read_failed`&&(E===`background`||S.status===`needed`&&S.automatic)),_e=c&&ue&&!ae&&!ce&&!E&&!w&&!ee&&!x&&!ne&&f&&fe.success&&a.includes(fe.data.action)?fe.data:void 0,ve=$(t?.restoreCheck),ye=p&&ue&&y?.state===`ready`&&!y.input.backupDelivery&&!w&&!h&&!t?.result&&t?.observe!==!0&&(ve?.status===`cannot_restore`&&[`operation_busy`,`wallet_request_unsettled`].includes(String(ve.reason))||!a.includes(`settings_select`)||!a.includes(`settings_download_backup`)||t?.phase===`prepared`&&!a.includes(`settings_confirm`)||t?.phase===`draft`&&$(t.draft)?.kind!==void 0&&$(t.draft)?.kind!==`import_local_data`&&!a.includes(`settings_prepare`)),we;!l&&_&&(S.status===`read_failed`||ae||S.status===`unconfirmed`?we=`read`:S.status===`needed`?S.automatic||(we=`read`):oe||D||!r&&p&&[`pending`,`failed`].includes(String(t?.temporaryFileCleanup))||!r&&(k?.status===`saving`||k?.status===`needs_consent`&&!a.includes(`settings_store_backup`)||k?.status===`failed`&&k.failure===`not_published`&&!n?.endReason&&!a.includes(`settings_store_backup`))||ye?we=`read`:g?!r&&$(t?.progress)?.status===`unavailable`||!r&&$(t?.walletAvailability)?.status===`initializing`&&$(t?.walletAvailability)?.stage===`state_sync`?we=`read`:!r&&!ne&&be()?we=`retry`:b&&(!m&&de&&y?.state===`ready`&&ge&&pe?.selectionRecovery?we=`selection`:!me&&!(ne&&a.length>0)&&!(C?.input.action===`prepare_review`&&a.includes(`prepare_review`)&&t?.automaticAction===void 0)&&f&&(we=`read`)):(y?.state!==`closed`||oe)&&(we=`read`));let Te=f?t?.actionRemainingMs:y?.inputRemainingMs;we===`retry`&&s&&(we=`read`);let Ee=r?void 0:f?t?.nextStateReadAfterMs:p&&Ce!==void 0?Math.max(0,Ce-O):void 0,De=[!r&&(f?a.length>0:y?.state===`ready`)?Te:void 0,Ee].filter(e=>typeof e==`number`&&Number.isFinite(e)&&e>0),Oe=!l&&!!g&&c&&!ie&&!ae&&S.status!==`read_failed`,ke=$(t?.review),Ae=o&&!l&&!ae&&!oe&&!b&&!ee&&!ne&&S.status!==`read_failed`&&(re||w?.input.action===`prepare_review`||ke?.preparing===!0||fe.success&&fe.data.action===`prepare_review`||S.status===`needed`&&ke?.status===`ready_for_wallet_review`);return{current:u,inputEnabled:de,permitted:a,disposition:v,read:he,auto:_e,recover:we,paused:ne,partialDisplayFailure:D,settingsInputBlocked:ye,reviewUpdatePending:Ae,reviewCommandDeliveryFailed:b&&C?.input.action===`prepare_review`,reviewHint:s?void 0:Ae?re||ke?.preparing||w?.input.action===`prepare_review`?`Updating review…`:`Checking status…`:o&&$(ke?.state)?.refreshReason===`review_evidence_stale`?`Review details are out of date.`:void 0,errors:[S.status===`rejected`?S.message:S.status===`read_failed`?`This card's status could not be checked. Reported message: “${S.message}”`:void 0,ae&&S.status!==`rejected`?`This card could not be opened. Reported message: “${ae}”`:void 0,b&&C?`Message for this ${xe(C)}: “${C.message}”`:void 0,oe,D?.message],note:[se,Se(v)].filter(Boolean).join(` `),expiryAt:Oe&&u&&De.length?O+Math.min(...De):void 0,poll:Oe&&(me||S.status===`needed`&&!S.automatic),lifetimeAt:!l&&c&&o?le:void 0}}function Ee(e){return e.recover===`retry`?C?.input.action===`connect`?`Retry connection`:`Retry review`:e.recover===`selection`?pe?.selectionRecovery?.label:e.recover===`read`?`Check status`:void 0}function De(e){if(d.signal.aborted)return``;let n=e.errors.some(Boolean)||e.recover!==void 0||!!y&&!g&&y.state!==`closed`||y?.state===`closed`&&y.reason!==`completed`,r=e.errors.some(Boolean)||S.status!==`confirmed`||e.recover===`retry`||e.settingsInputBlocked;if(n&&r&&S.status!==`rejected`){if(ce||e.read)return`Checking status…`;let t=Ee(e);if(e.recover===`selection`&&t)return`Use ${t} to try the current selection again.`;if(t)return t===`Check status`?oe||e.partialDisplayFailure?`Use Check status to read this card and try displaying it again.`:`Use Check status to read this card again.`:t===`Retry connection`?`Use Retry connection to try connecting your wallet again.`:`Use Retry review to try again with the displayed wallet and account.`}return t.guidance?.(y,{confirmed:e.current,readOnly:!g,recoveryNeeded:n,visibleConfirmation:pe?.visibleConfirmation?.(),commandPending:m&&w&&e.current&&!e.errors.some(Boolean)&&(w.phase===`confirming`||y?.state===`ready`&&!$(y.data)?.request&&!$($(y.data)?.review)?.preparing)?{phase:w.phase,action:String(w.input.action)}:void 0,approvalUnresolved:C?.input.action===`request_signature`&&e.disposition===`active`||w?.input.action===`request_signature`,automaticPaused:e.paused})??``}function Oe(e=Te()){return e.inputEnabled&&y?.state===`ready`&&ge}function ke(e,t=Te()){return y?.state!==`closed`&&m&&t.inputEnabled&&(e?t.permitted.includes(e.action):t.permitted.length>0)}function Ae(e){let t=Te();return p&&h&&t.current&&!!g&&!w&&!ce&&!oe&&!d.signal.aborted&&[`settings_begin_upload`,`settings_upload_chunk`,`settings_seal_upload`,`settings_retry_download`,`settings_report_download`,`settings_cancel_download`,`settings_store_backup`].includes(String(e.action))&&(t.permitted.includes(e.action)||e.action===`settings_report_download`)}function je(e){let u=$(y?.data),f=s.querySelector(`.review-action-feedback`),_=s.querySelector(`.review-primary-action`);if(f){let e=s.querySelector(`.review-lifetime`);e?(e.append(l),f.prepend(a)):f.prepend(l,a),f.append(o)}else n.insertBefore(a,s),n.insertBefore(l,c),n.insertBefore(o,l);a.className=f?`ui-note`:`ui-error`,y?(r.textContent=t.titleFor?.(y)??t.title,i.textContent=S.status===`rejected`?`Card unavailable`:!e.current&&y.state===`ready`?f?``:!d.signal.aborted&&(ce||e.read)?`Checking whether actions are available in this card…`:`Actions are unavailable until this card's status is checked.`:!g&&y.state!==`closed`?`View only.`:m?$(u?.progress)?.status===`unavailable`?`Current progress is unavailable. The last recorded state is shown.`:!u?.request&&y.state===`closed`&&[`expired`,`server_restarted`,`cancelled`].includes(y.reason??``)?`This card no longer accepts actions.`:``:y.state===`running`?`Reading the requested data…`:y.reason===`completed`?``:y.error??(y.reason===`expired`?`The time to make a selection has ended.`:y.reason===`server_restarted`?`This request ended when Sui MCP restarted.`:``)):i.textContent=ie?``:S.status===`read_failed`?`Card status unavailable`:ae||S.status===`rejected`?`Card unavailable`:`Opening card…`,i.hidden=!i.textContent,a.textContent=[...new Set(e.errors.filter(Boolean))].join(` `),a.hidden=!a.textContent;let v=s.querySelector(`.review-status`);if(v){let t=!!f&&(e.reviewUpdatePending||!!a.textContent);t?v.classList.add(`review-status--reserved`):v.classList.remove(`review-status--reserved`),v.setAttribute(`aria-hidden`,String(t))}let b=s.querySelector(`.review-material-status`);if(b&&(b.textContent=b.dataset.previous===`true`||!e.current||e.reviewUpdatePending?b.dataset.previousLabel??``:b.dataset.currentLabel??``),o.textContent=[e.note,De(e)].filter(Boolean).join(` `),o.hidden=!o.textContent,ge)for(let t of s.querySelectorAll(`input, button, select`))(!m||t.tagName!==`BUTTON`||t.dataset.cardAction!==void 0)&&(t.disabled=m?!ke(void 0,e):!Oe(e));if(m)for(let t of s.querySelectorAll(`[data-card-action]`))t.disabled=!ke({action:t.dataset.cardAction},e);if(p)for(let t of s.querySelectorAll(`[data-settings-file-action]`))t.disabled=t.dataset.settingsLocalBlocked===`true`||!(h?Ae({action:t.dataset.cardAction}):ke({action:t.dataset.cardAction},e));_&&(e.reviewUpdatePending||_.dataset.cardAction===`request_signature`&&e.reviewCommandDeliveryFailed||_.dataset.cardAction===void 0)&&(_.disabled=!0),k&&(k.disabled=!!w||!!ce)}function Me(e){try{e?.()}catch{oe=`The card display could not be closed cleanly. Its stored information is unchanged.`}}function Ne(e){if(!y||d.signal.aborted)return;if(y.state===`ready`&&S.status!==`confirmed`){if(p&&pe?.update)try{pe.update(y,{automaticPaused:T===`paused`,settings:Ge,settingsCommandProgress:void 0,onDisplayChange:()=>j()})}catch{oe=`This card could not be displayed. Its stored information is unchanged.`}return}let n=m?{...$(y.data),actionRemainingMs:void 0,nextStateReadAfterMs:void 0,...p&&$(y.data)?.download?{download:{...$($(y.data)?.download),remainingMs:void 0}}:{}}:void 0,r=p&&w?.phase===`sending`&&S.status===`confirmed`?jS(w.basis,y,w.input):void 0,i=`${T===`paused`}:${JSON.stringify(r)}:${y.revision}:${g!==void 0}:${b!==void 0}:${x!==void 0}:${JSON.stringify(n)}`;if(i===me||i===he&&!e)return;he=i;let a=[...s.children],o=new Set([...s.querySelectorAll(`details`)].filter(e=>e.open).map(e=>e.querySelector(`summary`)?.textContent)),c,l=!1,u=!1;try{let e={automaticPaused:T===`paused`,onDisplayChange:()=>j(),wallet:x,...p?{settings:Ge,settingsCommandProgress:r}:{}};if(pe?.update?.(y,e)){me=i,oe=void 0;return}if(y.state===`ready`&&g){let n=t.controls(y,e=>{Ue(e)},b,x,e);c=`node`in n?n:{node:n},l=!0}else(m||y.reason===`completed`)&&y.data!==void 0&&(c=t.result(y,b,g&&y.reason!==`cancelled`?e=>{Ue(e)}:void 0,x,e));s.replaceChildren(...c?[c.node]:[]),u=!0,c?.mount?.();for(let e of s.querySelectorAll(`details`))o.has(e.querySelector(`summary`)?.textContent)&&(e.open=!0)}catch{u&&s.replaceChildren(...a),Me(c?.dispose),oe=`This card could not be displayed. Its stored information is unchanged.`;return}let f=pe?.dispose;pe=c,ge=l,me=i,oe=void 0,Me(f)}function Pe(t,n,r,i,a){if(d.signal.aborted||S.status===`rejected`)return!1;if(t.kind!==e||t.cardId!==_)throw S={status:`rejected`,message:`The returned information does not match this card.`},Error(`The returned information does not match this card.`);let o=$(t.data),s=$(o?.request),c=$(s?.execution),l=o?.automaticAction===void 0?void 0:Ax.safeParse(o.automaticAction);if(l&&!l.success)throw Error(`This card could not start the next step.`);if(y&&t.revision<y.revision)return!1;if(y?.state===`closed`&&S.status===`confirmed`&&JSON.stringify(t)!==JSON.stringify(y))throw Error(`The completed card result cannot change.`);if(v&&[...new Set([...Object.keys(v),...Object.keys(t.input)])].some(e=>JSON.stringify(t.input[e])!==JSON.stringify(v[e])))throw S={status:`rejected`,message:`The returned information does not match this card.`},Error(`The returned information does not match this card.`);if(e===`review`&&($(o?.review)?.reviewSessionId!==void 0&&$(o?.review)?.reviewSessionId!==t.input.reviewSessionId||s&&(s.reviewSessionId!==t.input.reviewSessionId||t.input.attemptId!==void 0&&s.attemptId!==t.input.attemptId)||c&&(c.reviewSessionId!==s?.reviewSessionId||c.attemptId!==s?.attemptId||c.txDigest!==s?.transactionDigest)||$(o?.receipt)?.status===`found`&&$($(o?.receipt)?.receipt)?.txDigest!==s?.transactionDigest)||e===`receipt`&&o?.status===`found`&&$(o.receipt)?.txDigest!==t.input.digest)throw S={status:`rejected`,message:`The saved result does not match the information requested in this card.`},Error(S.message);!v&&(f||t.state!==`ready`)&&(v={...t.input});let u=r!==`preview`;if((!y||t.revision!==y.revision)&&(b=void 0,x=void 0),y=t,ye(),u){O=Date.now();let t=p?$(o?.download):void 0;if(t?.availability===`available`&&typeof t.remainingMs==`number`&&Number.isFinite(t.remainingMs)){let e=`${o?.operationId}:${$(o?.file)?.fileId}:${t.expiresAt}`;we!==e&&(we=e,Ce=void 0),Ce=Math.min(Ce??1/0,O+Math.max(0,t.remainingMs))}else p&&t?.availability===`ended`&&(Ce=void 0);g&&e===`review`&&o?.mode===`review`&&!o.request&&typeof o.actionRemainingMs==`number`&&Number.isFinite(o.actionRemainingMs)&&o.actionRemainingMs>=0&&(le=Math.min(le??1/0,O+o.actionRemainingMs))}return r===`read`&&(S.status!==`needed`||a>S.afterRead)&&(S={status:`confirmed`},ae=void 0),n&&(b=n),x=i,!0}function Fe(){ue!==void 0&&clearTimeout(ue),de!==void 0&&clearTimeout(de),fe!==void 0&&clearTimeout(fe),ue=void 0,de=void 0,fe=void 0,l.hidden=!0}function Ie(e){let t=Ee(e);k?.textContent!==t&&(k?.remove(),k=void 0,t&&(k=$h(t,()=>{if(ce||w||d.signal.aborted)return;let e=Te();if(e.recover===`selection`&&Oe(e))pe?.selectionRecovery?.retry();else if(e.recover===`retry`){let e=be();e&&He(e)}else A()})));let n=s.querySelector(`.review-primary-action`),r=s.querySelector(`.review-primary-slot`);n&&(n.hidden=!!k&&!!r),k&&(k.disabled=!!ce||!!w,r?(k.classList.add(`review-recovery-action`),r.append(k)):(k.classList.remove(`review-recovery-action`),c.append(k)))}async function A(){let e=pe,t=e?.displayRecovery?.(),n=await Re(!0);n?.kind===`accepted`&&y===n.snapshot&&S.status===`confirmed`&&!d.signal.aborted&&document.visibilityState!==`hidden`&&!oe&&e===pe&&t&&e?.displayRecovery?.()===t&&(t.retry(),j())}function j(e=!1){if(ie){let e=document.createElement(`p`);e.className=`ui-note`,e.textContent=ie,s.replaceChildren(e)}else Ne(e);let t=Te();if(je(t),Fe(),Ie(t),d.signal.aborted||S.status===`rejected`)return;t.expiryAt!==void 0&&(de=setTimeout(()=>{Le(),j()},Math.max(0,t.expiryAt-Date.now()))),t.reviewHint&&!a.textContent&&(l.replaceChildren(),l.textContent=t.reviewHint,l.setAttribute(`role`,`status`),l.hidden=!1);let n=s.querySelector(`.review-time-remaining`);if(n&&t.lifetimeAt!==void 0){let e=t.lifetimeAt,r=()=>{if(d.signal.aborted)return;let t=Math.max(0,e-Date.now()),i=Math.ceil(t/1e3);if(n.textContent=t>0?`Review expires in ${Math.floor(i/60)}:${String(i%60).padStart(2,`0`)}`:`Review time elapsed`,t>0)fe=setTimeout(r,Math.min(1e3,t));else{let e=Te();je(e),Ie(e)}};r()}if(t.poll&&y){let e=O+y.pollAfterMs-Date.now();ue=setTimeout(()=>{Re(!1)},e>0?e:y.pollAfterMs)}t.read?(E=void 0,ze()):t.auto&&(ue=setTimeout(()=>{let e=Te().auto;e&&We(e,`automatic`)},0))}function Le(){S.status!==`rejected`&&S.status!==`read_failed`&&(S={status:`needed`,afterRead:D,automatic:!0})}function Re(e){return d.signal.aborted||S.status===`rejected`||!_||!te?Promise.resolve(void 0):ce?ce.promise:S.status===`read_failed`&&!e?Promise.resolve(void 0):(E=e?`explicit`:`background`,j(),ce?.promise??Promise.resolve(void 0))}function ze(){let e=++D,t=performance.now(),n={id:e,promise:Promise.resolve().then(async()=>{try{let n,r,i;if(g){let e=LS(await Be(kS.read,{...g}));if(!e.snapshot)throw Error(e.error??`Saved card data is unavailable.`);if(e.error)throw Error(e.error);n=e.snapshot,r=e.display,i=e.wallet}else{let e=`${CS}${encodeURIComponent(_)}`,t=(await u.readServerResource({uri:e},{signal:d.signal})).contents.find(t=>t.uri===e&&`text`in t);if(!t||!(`text`in t))throw Error(`Saved card data is unavailable.`);n=_S.parse(JSON.parse(t.text));let i=b??ee;r=i&&FS(n,i)?i:void 0}if(d.signal.aborted||S.status===`rejected`)return{kind:`disposed`,id:e};let a=Pe(n,r,`read`,i,e);return ee=void 0,!a&&S.status===`needed`&&e>S.afterRead&&(S={...S,automatic:!1}),j(a),a&&S.status===`confirmed`?{kind:`accepted`,snapshot:n,id:e,requestStartedAt:t}:{kind:`ignored`,id:e}}catch(t){return d.signal.aborted?{kind:`disposed`,id:e}:(S.status!==`rejected`&&(S={status:`read_failed`,message:t instanceof Error?t.message:`Saved card data could not be read. The last displayed result is unchanged.`}),{kind:`failed`,id:e})}}).finally(()=>{ce===n&&(ce=void 0),j()})};ce=n,j()}async function Be(e,t){return PS(await u.callServerTool({name:e,arguments:t},{signal:d.signal}))}function Ve(e,t,n){let r=zx.safeParse(n.data);if(!r.success||!r.data.allowedActions.some(t=>t===e.action))return!1;let i=r.data,a=$(t.data);return e.walletRunId&&e.walletRunId!==i.walletAvailability.walletRunId?!1:e.action===`connect`?i.kind===`connect`&&JSON.stringify(e.chains)===JSON.stringify(i.requestedChains):e.action===`prepare_review`||e.action===`request_signature`?i.kind===`review`&&i.review.reviewRevision===e.reviewRevision&&i.reviewTarget?.account===e.account&&i.reviewTarget?.connectionId===e.connectionId:e.action===`disconnect`?i.kind===`disconnect`&&i.connection?.connectionId===e.connectionId&&i.connection?.disconnectImpact?.impactId===e.impactId:e.action===`stop_connection`?i.kind===`connect`&&i.operation?.operationId===e.operationId&&i.operation?.status===`running`:JSON.stringify(t.input)===JSON.stringify(n.input)&&(i.kind!==`review`||i.request?.attemptId===$(a?.request)?.attemptId&&i.review.reviewRevision===$(a?.review)?.reviewRevision)}async function He(e){if(!y||ce||!ke(e))return;let t={input:e,basis:y,phase:`confirming`};w=t;let n=await Re(!1);w===t&&(w=void 0,n?.kind===`accepted`&&y===n.snapshot&&S.status===`confirmed`&&!d.signal.aborted&&document.visibilityState!==`hidden`&&Ve(e,t.basis,n.snapshot)&&ke(e)?await We(e):S.status!==`read_failed`&&S.status!==`rejected`&&!d.signal.aborted&&(se=`The card state changed. Check the current selection before trying again.`),j())}async function Ue(e){f&&(C?.disposition===`active`||C?.retryRequired||T===`paused`)?await He(e):await We(e)}function M(e,t,n){C={input:e.input,basis:e.basis,message:t,delivery:n,disposition:`active`,retryRequired:e.input.action===`connect`||e.input.action===`prepare_review`},ye(),[`cancel`,`disconnect`,`stop_connection`,`stop_waiting`].includes(String(e.input.action))&&(T=`paused`),(m||n===`unknown`)&&Le()}async function We(e,t=`user`){if(!y||!g||(t===`file`?!Ae(e):m?!ke(e):!Oe()))return;let n={input:e,basis:y,phase:`sending`};w=n,T=`continue`,(t===`user`||C?.disposition!==`past`)&&(C=void 0),se=void 0,j();try{let t=LS(await Be(m?kS.act:kS.submit,{...g,revision:n.basis.revision,input:e}));if(d.signal.aborted||S.status===`rejected`)return;if(!t.snapshot)throw Error(t.error??`The request could not be confirmed.`);t.error&&M(n,t.error,`rejected`),Pe(t.snapshot,t.display,`action`,t.wallet)}catch(e){!d.signal.aborted&&S.status!==`rejected`&&(M(n,e instanceof Error?e.message:`The request could not be confirmed.`,`unknown`),C&&(C.data=$(e)?.data))}finally{w===n&&(w=void 0),j()}}let Ge={uploadChunkLimit(e,t){return g?pS({jsonrpc:`2.0`,id:2**53-1,method:`tools/call`,params:{name:kS.act,arguments:{...g,revision:2**53-1,input:{action:`settings_upload_chunk`,operationId:e,fileId:t,offset:2**53-1,chunkBase64:``}}}})??0:0},async readCurrent(){let e=await Re(!0);if(e?.kind!==`accepted`)throw Error(`The current Settings selection could not be checked. Use Check status before continuing.`);return{snapshot:e.snapshot,requestStartedAt:e.requestStartedAt}},async act(e,t=!1){if(t?!Ae(e):!ke(e))throw Error(`This Settings action is unavailable until its current status has been checked.`);if(await We(e,t?`file`:`user`),d.signal.aborted)throw Error(`This card closed before the request finished. Reopen the same conversation to check its status.`);if(C?.input===e){let e=Error(C.message);throw e.data=C.data,e}if(!y)throw Error(`The current Settings status could not be checked.`);return y},setFileTransferActive(e){h=e,j()},async readFile(e){if(!g||!_||!Te().current||d.signal.aborted)throw Error(`Backup read permission is unavailable.`);let t=await Be(kS.readSettingsFile,{...g,...e}),n=OS.parse($(t._meta)?.[SS]);if(n.cardId!==_||n.operationId!==e.operationId||n.fileId!==e.fileId||n.offset!==e.offset||n.attemptId!==e.attemptId)throw Error(`The backup response does not match this card's selected file.`);return n},download:async(e,t,n)=>{let r=$($(y?.data)?.download);if(!g||!Te().current||d.signal.aborted||document.visibilityState===`hidden`||!r||r.currentAttemptId!==n||r.localSave||r.availability!==`available`||Ce===void 0||Date.now()>=Ce)throw Error(`This download is no longer available in this card.`);try{return{isError:(await u.downloadFile({contents:[{type:`resource`,resource:{uri:`file:///${encodeURIComponent(e)}`,mimeType:`application/json`,blob:t}}]},{signal:d.signal})).isError}}catch(e){if(e&&typeof e==`object`&&`code`in e&&e.code===-32601)return{unsupported:!0};throw e}}};async function Ke(){if(te&&re!==void 0&&!ne){ne=!0;try{let t=PS(re),n=$(t._meta);if(t._meta!==void 0&&!n)throw Error(`This card cannot accept actions with the access information provided by the app.`);let r=n?.[yS];if(r!==void 0){let e=TS.safeParse(r);if(!e.success)throw Error(`This card cannot accept actions with the access information provided by the app.`);g=e.data}let i=LS(t);if(i.inputRequired){if(i.inputRequired.kind!==e||g)throw Error(`The app provided inconsistent card input information.`);ie=i.inputRequired.message,j();return}let a=IS(t),o=[i.snapshot?.cardId,g?.cardId,a].filter(e=>e!==void 0);if(!o.length)throw Error(`Card data is unavailable.`);if(o.some(e=>e!==o[0])||i.snapshot&&i.snapshot.kind!==e)throw S={status:`rejected`,message:`The returned information does not match this card.`},Error(S.message);_=o[0];let s=i.snapshot;s&&(f||s.state!==`ready`)&&(v={...s.input}),ee=i.display,s&&g&&Pe(s,i.display,`preview`,i.wallet),Le(),j()}catch(e){if(d.signal.aborted)return;ae=e instanceof Error?e.message:`Card data could not be read.`,j()}}}u.ontoolresult=e=>{if(re===void 0)re=e,Ke();else try{let t=LS(PS(re)).snapshot??y,n=LS(PS(e)).snapshot;if(t&&n&&(t.cardId!==n.cardId||t.kind!==n.kind))throw Error(`The app returned a different card.`)}catch{S={status:`rejected`,message:`The returned information does not match this card.`},j()}},u.onhostcontextchanged=e=>{e.theme&&(document.documentElement.dataset.theme=e.theme)};let qe=()=>{document.visibilityState!==`hidden`&&g&&ne&&S.status!==`read_failed`&&y?.state!==`closed`?Re(!1):j()};document.addEventListener?.(`visibilitychange`,qe),u.onteardown=async()=>{if(d.signal.aborted)return{};d.abort(),w=void 0,document.removeEventListener?.(`visibilitychange`,qe);let e=pe?.dispose;return pe=void 0,Me(e),j(),{}},u.connect().then(()=>{d.signal.aborted||(te=!0,document.documentElement.dataset.theme=u.getHostContext()?.theme??`light`,Ke())}).catch(()=>{d.signal.aborted||(ae=`Could not connect this card to the app.`,j())})}function zS(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t)}function BS(e){let t=atob(e),n=Uint8Array.from(t,e=>e.charCodeAt(0));if(zS(n)!==e)throw Error(`Part of the backup could not be read correctly.`);return n}async function VS(e,t,n,r,i){if(e.size>16777216)throw Error(`This backup exceeds the 16 MiB limit. Choose a smaller backup.`);let a=n();t.setFileTransferActive(!0);try{r()&&i?.({...a,stage:`reading`});let n=new Uint8Array(await e.arrayBuffer()),o=r_(mv(n));if(!r())return;i?.({...a,stage:`receiving`,sha256:o});let s=await t.act({action:`settings_begin_upload`,operationId:a.operationId,name:e.name,totalSize:n.length,sha256:o},!0),c=lS.parse(s.data),l=c.file?.receivedSize??0,u=c.file?.fileId;if(!u||c.operationId!==a.operationId||c.file?.sha256!==o||c.file.totalSize!==n.length)throw Error(`The file being received does not match your selection. Choose the backup file again.`);r()&&i?.({...a,stage:`receiving`,fileId:u,sha256:o});let d=t.uploadChunkLimit(a.operationId,u);for(;r()&&l<n.length;){if(d<1)throw Error(`This app cannot send the backup within its message size limit. Try opening Settings in another supported app.`);let e=Math.min(d,n.length-l),r={action:`settings_upload_chunk`,operationId:a.operationId,fileId:u,offset:l,chunkBase64:zS(n.subarray(l,l+e))};try{s=await t.act(r,!0)}catch(n){let r=n&&typeof n==`object`&&`data`in n?n.data:void 0;if(r?.code!==`settings_payload_too_large`||typeof r.rawChunkLimit!=`number`||!Number.isSafeInteger(r.rawChunkLimit)||r.rawChunkLimit<1||r.rawChunkLimit>=e)throw n;let i=lS.parse((await t.readCurrent()).snapshot.data);if(i.file?.fileId!==u||i.file.receivedSize!==l)throw Error(`The file transfer changed after a message was rejected. Choose the same file again to check how much was received.`);d=r.rawChunkLimit;continue}if(c=lS.parse(s.data),c.operationId!==a.operationId||c.file?.fileId!==u||c.file.sha256!==o||c.file.receivedSize!==l+e)throw Error(`The file transfer could not be confirmed. Choose the same file again to continue.`);l=c.file.receivedSize}r()&&(i?.({...a,stage:`checking`,fileId:u,sha256:o}),await t.act({action:`settings_seal_upload`,operationId:a.operationId,fileId:u},!0))}finally{t.setFileTransferActive(!1)}}async function HS(e,t,n,r){n(`pending`);let i;try{i=new Uint8Array(e.totalSize);let n=0;for(;n<i.length&&r();){let r=await t.readFile({operationId:e.operationId,fileId:e.fileId,offset:n,attemptId:e.attemptId}),a=BS(r.chunkBase64);if(r.totalSize!==i.length||r.sha256!==e.sha256||!a.length||n+a.length>i.length)throw Error(`Part of the downloaded backup does not match the original file.`);i.set(a,n),n+=a.length}if(!r())return;if(n!==i.length||r_(mv(i))!==e.sha256)throw Error(`The complete downloaded backup could not be checked against the original file.`)}catch{if(r())try{await t.readCurrent()}catch{}return r()&&n(`backup_unverified`),`backup_unverified`}try{let n=await t.readCurrent(),i=lS.parse(n.snapshot.data);if(!r()||i.operationId!==e.operationId||i.file?.fileId!==e.fileId||i.file.sha256!==e.sha256||i.file.totalSize!==e.totalSize||i.download?.currentAttemptId!==e.attemptId||i.download.localSave||i.download.availability!==`available`||!i.download.remainingMs)return;if(i.download.remainingMs<=Math.max(0,performance.now()-n.requestStartedAt)){try{await t.readCurrent()}catch{}return}}catch{return r()&&n(`backup_unverified`),`backup_unverified`}try{if(!r())return;let a=await t.download(e.displayName,zS(i),e.attemptId),o=a.unsupported===!0?`unsupported`:a.isError===!0?`not_completed`:`acknowledged`;return r()&&n(o),o}catch{return r()&&n(`unconfirmed`),`unconfirmed`}}var US={set_endpoint:`Change network address`,restore_endpoint:`Use default network address`,set_wallet_networks:`Wallet networks`,clear_read_address:`Clear saved read address`,download_backup:`Backup`,import_local_data:`Restore`,reset_local_data:`Reset`,restart_wallet_service:`Connection service restart`},WS={overview:`Settings`,address:`Address for viewing assets`,networks:`Wallet networks`,records:`Local records`,troubleshooting:`Troubleshooting`,advanced:`Advanced settings`},GS={address:`Clear the saved address used for implicit asset reads.`,networks:`Choose the networks to request when connecting a wallet.`,records:`Back up, restore or delete records saved on this computer.`,troubleshooting:`Check or restart the wallet connection service.`,advanced:`Change the Sui network addresses used to retrieve data and send transactions.`},KS=`Local records are saved addresses, reviews, transaction and activity records, wallet network choices, and Sui network settings on this computer. They do not include wallet keys, wallet connections or wallet approvals.`,qS=`Fully quit every app using Sui MCP, then reopen them. Closing a window or quitting only one app may leave Sui MCP running.`,JS={available:`Ready`,initializing:`Starting`,recovering:`Restarting`,unavailable:`Unavailable`},YS={environment:`App launch settings`,local_db:`Saved in Sui MCP`,builtin_default:`Built-in default`},XS={connected:`Connected`,awaiting_approval:`Waiting for wallet approval`,rejected:`Rejected`,failed:`Failed`,expired:`Expired`,stopped:`Stopped`,disconnected:`Disconnected`},ZS=[[`accounts`,`Saved addresses`],[`reviewSessions`,`Reviews`],[`reviewRequests`,`Transaction requests`],[`outcomeUnknownRequests`,`Transaction requests with unconfirmed results`],[`externalActivityTransactions`,`Activity records`],[`localSettings`,`Saved network settings`]],QS={set_endpoint:`Save network address?`,restore_endpoint:`Use default network address?`,set_wallet_networks:`Save selected networks?`,clear_read_address:`Clear saved read address`,download_backup:`Download backup`,import_local_data:`Restore available`,reset_local_data:`Reset local data?`,restart_wallet_service:`Restart connection service?`},$S={set_endpoint:`Save network address`,restore_endpoint:`Use default network address`,set_wallet_networks:`Save networks`,clear_read_address:`Clear saved read address`,download_backup:`Download backup`,import_local_data:`Restore local records`,reset_local_data:`Reset local data`,restart_wallet_service:`Restart connection service`};function eC(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function tC(e){return e===`clear_read_address`?`address`:e===`set_wallet_networks`?`networks`:e===`set_endpoint`||e===`restore_endpoint`?`advanced`:e===`restart_wallet_service`?`troubleshooting`:e?`records`:`overview`}function nC(e,t,n){let r=eC(t);e.append(J(`h3`,void 0,n));for(let[t,n]of ZS)typeof r[t]==`number`&&e.append(Y(n,String(r[t])))}function rC(e,t,n){let r=lS.parse(e.data),i=e,a=r.draft?{kind:`operation`,operation:r.draft.kind}:{kind:`section`,page:`overview`},o=!1,s,c=n?.settings,l=n?.onDisplayChange,u,d=!1,f,p=n?.settingsCommandProgress,m,h,g,_,v,y=J(`div`,`settings-card`),b=(e,n,r=`secondary`)=>{let i=$h(e,()=>{!o&&!d&&t?.(n)},r);return i.dataset.cardAction=String(n.action),i},ee=(e,t)=>{let n=$h(e,()=>{if(o)return;let e=a.kind===`section`?a.page:tC(a.operation);a=t,w(),(t.kind===`section`&&t.page===`overview`?[...y.querySelectorAll(`.settings-menu-item`)].find(t=>t.dataset.settingsPage===e):y.querySelector(`.settings-back`))?.focus(),l?.()},`secondary`);return n.setAttribute(`aria-label`,e),n.dataset.settingsPage=t.kind===`section`?t.page:tC(t.operation),n},x=(e,n,i=!1,s=!1)=>{let c=$h(e,()=>{o||d||(!s&&n.kind===`import_local_data`&&r.draft&&JSON.stringify(r.draft)===JSON.stringify(n)?(a={kind:`operation`,operation:n.kind},w(),l?.()):(u=void 0,t?.({action:`settings_select`,draft:n})))},i?`danger`:`secondary`);return c.dataset.cardAction=`settings_select`,c};function te(e,t,n){let r=J(`div`,`settings-choice`),i=J(`div`,`settings-choice-copy`);return i.append(J(`h3`,void 0,e),J(`p`,`ui-note`,t)),r.append(i,n),r}function ne(e){let t=J(`div`,`settings-action-row`);return t.setAttribute(`aria-label`,`Settings operation actions`),t.append(e),t}async function re(){if(!c||!h||o)return;let e=h;g=void 0,c.setFileTransferActive(!0);try{await c.act({action:`settings_report_download`,...e},!0),h===e&&(h=void 0)}catch{!o&&h===e&&(g={message:`The download response could not be recorded. Check status to record the same response without downloading again.`,retry:()=>{h===e&&re()}})}finally{o||(c.setFileTransferActive(!!m),w(),l?.())}}function ie(){let e=m;if(!c||o||!e||e.phase!==`waiting`||r.download?.availability!==`available`||r.download.localSave||r.download.currentAttemptId!==e.attemptId||!r.file)return;e.phase=`sending`;let t={operationId:r.operationId,...r.file,attemptId:e.attemptId};HS(t,c,t=>{m!==e||o||(f=t,w(),l?.())},()=>!o&&m===e&&document.visibilityState!==`hidden`&&r.download?.currentAttemptId===e.attemptId&&r.download.availability===`available`).then(async e=>{!o&&e&&[`acknowledged`,`not_completed`,`unconfirmed`,`unsupported`,`backup_unverified`].includes(e)&&(h={operationId:t.operationId,fileId:t.fileId,attemptId:t.attemptId,status:e===`backup_unverified`?`not_sent`:e,...e===`unsupported`?{failure:{method:`ui/download-file`,code:-32601}}:{}},await re())}).finally(()=>{m===e&&(m=void 0,d=!1),o||(c?.setFileTransferActive(!!m),w(),l?.())})}function S(e){if(!c||!t||o||m||d)return;let n=crypto.randomUUID(),i={attemptId:n,phase:`admitting`},a=e&&r.file&&r.download?{action:`settings_retry_download`,operationId:r.operationId,fileId:r.file.fileId,previousAttemptId:r.download.currentAttemptId,attemptId:n}:{action:`settings_download_backup`,operationId:r.operationId,attemptId:n};m=i,d=!0,f=void 0,h=void 0,g=void 0,w(),l?.(),e&&c.setFileTransferActive(!0),c.act(a,e).then(()=>{o||m!==i||(i.phase=`waiting`,c?.setFileTransferActive(!0),w(),l?.(),ie())}).catch(()=>{m===i&&(m=void 0,d=!1),o||(c?.setFileTransferActive(!1),w(),l?.())})}function ae(e,t,n,r=!1){let i=$h(e,n,`secondary`);return i.dataset.cardAction=t,t!==`settings_download_backup`&&(i.dataset.settingsFileAction=`true`),r&&(i.dataset.settingsLocalBlocked=`true`),i.disabled=r,i}function oe(e){let n=r.download,i=r.draft?.kind===`download_backup`?r.file:void 0;if(!se(e)){let r=n?.endReason===`acknowledged`?`Download requested`:n?.endReason===`cancelled`?`Download cancelled`:n?.endReason?`Download ended`:m?n?.availability===`available`?`Downloading backup…`:`Preparing backup…`:n?.hostReport===`not_completed`?`Download not completed`:n?.hostReport===`unconfirmed`?`Download unconfirmed`:`Backup ready`;e.append(J(`h2`,void 0,r)),n?.endReason===`acknowledged`?e.append(J(`p`,`ui-note`,`The app accepted the download request. This does not confirm that the file was saved or where it was saved.`)):n?.endReason===`cancelled`?e.append(J(`p`,`ui-note`,`No further download will be sent from this request. This does not close a save dialog or delete a file already saved by the app.`)):n?.endReason?e.append(J(`p`,`ui-note`,n.endReason===`expired`?`The time to download this backup has ended. Open a new Settings card to download the current records.`:`This backup can no longer be downloaded. Open a new Settings card to try again.`)):n?.hostReport===`not_completed`?e.append(J(`p`,`ui-note`,`The app did not complete the download request. It did not report whether it was cancelled, refused or failed.`)):(n?.hostReport===`unconfirmed`||n?.previousUnconfirmed||!m&&!h&&n?.availability===`available`&&!n.hostReport&&f!==`backup_unverified`)&&e.append(J(`p`,`ui-note`,`The previous download could not be confirmed.`+(t&&n?.allowedFileActions.includes(`settings_retry_download`)?` Retrying may save another copy if the app already handled it.`:``))),f===`backup_unverified`&&e.append(J(`p`,`ui-note`,`The backup could not be read or checked. Nothing was sent to the app for download.`)),i?.sealed&&(e.append(Y(`Suggested file name`,i.displayName),Y(`File size`,`${i.totalSize.toLocaleString(`en-US`)} bytes`)),i.totalSize>16777216&&e.append(J(`p`,`ui-note`,`This backup exceeds the 16 MiB restore limit.`))),t&&c&&!m&&!h&&n?.allowedFileActions.includes(`settings_retry_download`)&&e.append(ae(`Retry download`,`settings_retry_download`,()=>S(!0)))}t&&c&&r.file&&n?.allowedFileActions.includes(`settings_cancel_download`)&&e.append(ae(`Cancel download`,`settings_cancel_download`,()=>{if(!c||o||!r.file||!r.download)return;m=void 0,d=!1,f=void 0;let e={action:`settings_cancel_download`,operationId:r.operationId,fileId:r.file.fileId,attemptId:r.download.currentAttemptId};c.setFileTransferActive(!0),c.act(e,!0).catch(()=>{}).finally(()=>{o||(c?.setFileTransferActive(!1),w(),l?.())})})),(r.temporaryFileCleanup===`pending`||r.temporaryFileCleanup===`failed`)&&e.append(J(`p`,`ui-error`,`Temporary-file cleanup has not been confirmed. Use Check status to check the same request.`)),!t&&n?.localSave?.status!==`saved`?e.append(J(`p`,`ui-note`,`To download a backup, ask in chat to open a new Settings card.`)):n?.availability===`ended`&&e.append(J(`p`,`ui-note`,`To download the current records again, ask in chat to open a new Settings card.`))}function se(e){let n=r.download,i=n?.localSave,a=r.file;if(!n||!i||i.status!==`saved`&&i.status!==`saving`&&n.endReason&&n.endReason!==`local_save_failed`)return!1;if(e.append(J(`h2`,void 0,i.status===`saved`?`Backup saved`:i.status===`saving`?`Saving backup…`:i.status===`needs_consent`?`Save a local copy?`:`Backup not saved`)),i.status===`saved`&&r.backupLocation){let t=J(`div`,`settings-backup-location`);t.append(Y(`Folder`,J(`span`,`settings-path`,r.backupLocation.directory)),Y(`File name`,J(`span`,`settings-path`,r.backupLocation.filename))),e.append(J(`p`,`ui-note`,`The backup was saved in the Sui MCP backup folder on this computer.`),t)}else i.status===`saving`?e.append(J(`p`,`ui-note`,`Wait while this backup is saved and checked. Use Check status to check the same request.`)):i.status===`failed`&&e.append(J(`p`,`ui-error`,i.failure===`target_conflict`?`The backup location already contains an item or could not be verified. It has not been replaced.`:i.failure===`not_published`?`The backup could not be saved. You can retry saving the same backup.`:`The backup could not be verified for saving. Open a new Settings card to try again.`));return i.status!==`saved`&&i.status!==`saving`&&n.previousUnconfirmed&&e.append(J(`p`,`ui-note`,`An earlier request may already have saved this backup. Saving a local copy may leave another copy.`)),a&&(i.status!==`saved`&&e.append(Y(`Suggested file name`,a.displayName)),e.append(Y(`File size`,`${a.totalSize.toLocaleString(`en-US`)} bytes`)),a.totalSize>16777216&&e.append(J(`p`,`ui-note`,`This backup exceeds the 16 MiB restore limit.`))),t&&c&&n.allowedFileActions.includes(`settings_store_backup`)&&e.append(ae(i.status===`needs_consent`?`Save a local copy`:`Retry save`,`settings_store_backup`,()=>{if(!c||o||d||!r.file||!r.download)return;let e=r.download.localSave,t={action:`settings_store_backup`,operationId:r.operationId,fileId:r.file.fileId,attemptId:r.download.currentAttemptId,saveAttemptId:crypto.randomUUID(),allowPossibleCopy:r.download.previousUnconfirmed,...e?.currentSaveAttemptId?{previousSaveAttemptId:e.currentSaveAttemptId}:{}};d=!0,c.setFileTransferActive(!0),w(),l?.(),c.act(t,!0).catch(()=>{}).finally(()=>{d=!1,o||(c?.setFileTransferActive(!1),w(),l?.())})},d)),!0}function C(e,t,n,i){let a=ag(`Details`);if(r.facts&&a.body.append(Y(`Version`,r.facts.server.version)),a.body.append(Y(`Settings request ID`,og(r.operationId))),i&&i.kind===r.draft?.kind&&r.file&&a.body.append(Y(`File SHA-256`,og(r.file.sha256))),i&&[`download_backup`,`import_local_data`,`reset_local_data`].includes(i.kind)&&a.body.append(J(`p`,`ui-note`,`Local backups do not contain wallet keys, wallet connections, wallet approvals, access granted to cards, transaction bytes or signatures.`)),i?.kind===`import_local_data`&&r.preparation?.preview){let e=eC(r.preparation.preview);nC(a.body,e.currentCounts,`Checked local records`),nC(a.body,e.incomingCounts,`Backup records`)}if(t===`advanced`&&r.facts)for(let[e,t,n]of[[`grpc`,`Sui node`,r.facts.localSettings.suiGrpcUrl],[`graphql`,`Activity data`,r.facts.localSettings.suiGraphqlUrl]])(!i||i.kind!==`set_endpoint`&&i.kind!==`restore_endpoint`||i.endpoint===e)&&(a.body.append(J(`h3`,void 0,t),Y(`Saved network address`,n.storedValue),Y(`Network address in use`,n.effectiveValue),Y(`Set by`,YS[n.source])),n.pendingStoredValue&&a.body.append(Y(`Network address saved for next restart`,n.pendingStoredValue)));if(n){a.body.append(J(`h3`,void 0,`Connection and transaction request records`)),typeof r.preparation?.walletRunId==`string`&&a.body.append(Y(`Service run ID`,og(r.preparation.walletRunId)));for(let e of n.connections)a.body.append(Y(`${e.walletName??`Wallet`} connection ID`,og(e.connectionId)));for(let e of n.requests)a.body.append(Y(`Transaction request ID`,og(e.attempt_id)),Y(`Recorded request status`,e.request_status))}e.append(a.details)}function w(e=!1){let n=y.querySelector(`details`)?.open===!0,f=e?[...y.querySelectorAll(`input`)].filter(e=>e.type!==`file`).map(e=>e.value):void 0,h=ig();if(i.state===`closed`){let e=r.download?.localSave?.status===`saved`?`Backup saved`:r.download?.hostReport===`acknowledged`?`Download requested`:r.download?.hostReport===`not_completed`?`Download not completed`:r.download?.hostReport===`unconfirmed`?`Download unconfirmed`:r.download?.hostReport===`not_sent`?`Backup not sent`:r.download?.endReason===`cancelled`?`Download cancelled`:r.download?.endReason?`Download ended`:void 0;if(h.append(J(`h2`,void 0,e??(r.draft?US[r.draft.kind]:`Settings result`)),J(`p`,r.result?.outcome===`failed`?`ui-error`:`ui-note`,r.result?.message??`Status recorded. This card cannot apply changes.`),Y(`Recorded at`,sg(r.result?.recordedAt??i.createdAt))),i.input.operationStatus){let e={draft:`Not confirmed`,uploading:`Receiving a backup`,sealed:`Backup received`,prepared:`Awaiting confirmation`,executing:r.download?`Backup delivery in progress`:`Applying change`,stopping:`Stopping connection service`,starting:`Starting connection service`,terminal:`Finished`};h.append(Y(`Status checked at`,sg(i.createdAt)),Y(`Operation`,e[r.phase]))}r.download&&h.append(Y(`Backup delivery`,r.download.localSave?.status??r.download.hostReport??r.download.availability)),r.backupLocation&&h.append(Y(`Backup folder`,r.backupLocation.directory),Y(`File name`,r.backupLocation.filename));let t=eC(r.result?.details),n=C_.safeParse(t.walletConnectionChains);n.success&&h.append(Y(`Saved networks`,n.data.map(e=>T_[e]).join(`, `)||`None`)),typeof t.storedValue==`string`&&(h.append(Y(t.endpoint===`grpc`?`Saved Sui node address (gRPC)`:`Saved activity data address (GraphQL)`,t.storedValue)),typeof t.effectiveValueAtSave==`string`&&h.append(Y(`Network address in use when saved`,t.effectiveValueAtSave)),h.append(J(`p`,`ui-note`,t.effectiveSourceAtSave===`environment`?`The app launch settings override this saved address. Remove that launch setting and restart all apps using Sui MCP to use the saved address.`:`To use the saved network address, `+qS))),r.temporaryFileCleanup&&r.temporaryFileCleanup!==`complete`&&h.append(J(`p`,`ui-note`,`Temporary-file cleanup was not confirmed when this result was recorded. Ask in chat for a new Settings status card to check the same request.`)),r.file&&(h.append(Y(r.draft?.kind===`download_backup`?`Suggested file name`:`Backup file`,r.file.displayName),Y(`File size`,`${r.file.totalSize.toLocaleString(`en-US`)} bytes`)),r.draft?.kind===`download_backup`&&r.file.totalSize>16777216&&h.append(J(`p`,`ui-note`,`This backup exceeds the 16 MiB restore limit.`))),h.append(J(`p`,`ui-note`,`To make another change or try delivery again, ask in chat for a new card.`)),C(h,r.draft?tC(r.draft.kind):`overview`,void 0,r.draft),y.replaceChildren(h);return}let g=p&&i.state===`ready`&&p.cardId===i.cardId&&p.operationId===r.operationId&&(p.kind===`backup_check_response`?r.draft?.kind===`import_local_data`&&p.fileId===r.file?.fileId:p.kind===`selection_response`||JSON.stringify(p.draft)===JSON.stringify(r.draft))?p:void 0,re=r.result||r.restoreCheck?.status===`can_restore`||r.restoreCheck?.status===`cannot_restore`&&[`invalid_backup`,`file_unavailable`,`input_unavailable`].includes(r.restoreCheck.reason),ie=r.restoreCheck?.status===`checking`||!re&&(g?.kind===`backup_check_response`||v?.progress?.stage===`checking`),se=[`executing`,`stopping`,`starting`].includes(r.phase)||ie,T=r.draft?.kind===`import_local_data`&&r.restoreCheck?.status===`can_restore`,ce=m?.phase===`admitting`,E=ce?`progress`:r.result?`result`:se?`progress`:a.kind===`section`?`section`:r.phase===`prepared`&&(r.draft?.kind!==`import_local_data`||T)?`confirmation`:`input`,D=a.kind===`section`?a.page:tC(a.operation),O=ce?{kind:`download_backup`}:E===`section`?void 0:r.draft,le=O?tC(O.kind):D,ue=O?.kind===`restart_wallet_service`&&r.preparation?.impact?rv.parse(r.preparation.impact):void 0,de=E===`result`||E===`progress`?_??2:E===`confirmation`?3:E===`input`?2:le===`overview`?0:1;h.classList.add(`settings-page`),_!==void 0&&de!==_&&h.classList.add(de>_?`settings-page--forward`:`settings-page--back`),_=de;let fe=J(`nav`,`settings-toolbar`);if(fe.setAttribute(`aria-label`,`Settings navigation`),y.dataset.settingsPage=le,E===`confirmation`&&O&&t&&r.allowedActions.includes(`settings_back`)){let e=`Back to ${O.kind===`import_local_data`?US[O.kind]:WS[le]}`,n=$h(e,()=>{o||d||(a=O.kind===`import_local_data`?{kind:`operation`,operation:O.kind}:{kind:`section`,page:le},t({action:`settings_back`,operationId:r.operationId}))},`secondary`);n.dataset.cardAction=`settings_back`,n.setAttribute(`aria-label`,e),n.classList.add(`settings-back`),fe.append(n)}else if(E===`input`&&O&&t){let e=ee(`Back to ${WS[le]}`,{kind:`section`,page:le});e.classList.add(`settings-back`),fe.append(e)}else if(E===`section`&&le!==`overview`){let e=ee(`Back to Settings`,{kind:`section`,page:`overview`});e.classList.add(`settings-back`),fe.append(e)}let k=J(`span`,`settings-location`,[`Settings`,...le===`overview`?[]:[WS[le]],...O?[US[O.kind]]:[],...E===`result`?[`Result`]:E===`progress`?[O?.kind===`download_backup`?`Downloading`:ie?`Checking backup`:`Applying change`]:E===`confirmation`?[`Confirm`]:[]].join(` / `));if(k.setAttribute(`aria-current`,`page`),fe.append(k),h.append(fe),O?.kind===`download_backup`)oe(h);else if(E===`progress`){let e=J(`p`,`ui-note`,ie?`Checking backup…`:r.phase===`stopping`?`Stopping the wallet connection service…`:r.phase===`starting`?`Starting the wallet connection service…`:`Finishing this change…`);e.setAttribute(`role`,`status`),h.append(e),r.phase===`starting`&&h.append(J(`p`,`ui-note`,`If the service is not responding, you can request another restart in a new Settings card under Troubleshooting. This card keeps the result of the current restart.`))}else if(E===`confirmation`&&r.draft){if(h.append(J(`h2`,void 0,QS[r.draft.kind])),T&&r.file&&h.append(Y(`Backup file`,r.file.displayName)),r.draft.kind===`set_endpoint`||r.draft.kind===`restore_endpoint`){let e=eC(r.preparation?.endpoint);h.append(Y(`Setting`,r.draft.endpoint===`grpc`?`Sui node (gRPC)`:`Activity data (GraphQL)`)),typeof e.storedValue==`string`&&h.append(Y(`Previously saved network address`,e.storedValue)),typeof e.value==`string`&&h.append(Y(`Network address to save`,e.value)),h.append(J(`p`,`ui-note`,`Sui MCP checks that this address connects to Sui mainnet before saving it. Fully quit and reopen all apps using Sui MCP to use the change. Restarting only the wallet connection service does not apply it.`)),e.source===`environment`&&h.append(J(`p`,`ui-note`,`The app launch settings specify the network address to use. Restarting without removing that launch setting will keep using that address.`))}if(r.draft.kind===`reset_local_data`&&h.append(J(`p`,`ui-note`,KS)),r.draft.kind===`reset_local_data`||r.draft.kind===`import_local_data`){T?h.append(J(`p`,`ui-error`,`Restoring replaces local records and saved network settings, including records with unconfirmed transaction results. You cannot undo this from this card. Other open cards will no longer work; open new cards after restoring.`),J(`p`,`ui-note`,`Wallet keys and approvals are not restored. Transactions on Sui are not cancelled.`)):(h.append(J(`p`,`ui-error`,`This deletes local records and saved settings, including records whose transaction results are still unconfirmed. It does not cancel transactions on Sui. Data cannot be replaced until pending wallet or transaction responses and the initial result-checking period have ended.`)),h.append(J(`p`,`ui-error`,`You cannot undo this from this card. Other open cards will no longer work. You can still read this change's result.`)));let e=eC(r.preparation?.preview);if(r.draft.kind===`import_local_data`){let t=eC(e.currentCounts),n=eC(e.incomingCounts);h.append(J(`h3`,void 0,`Records to replace (now → backup)`));for(let[e,r]of ZS)typeof t[e]==`number`&&typeof n[e]==`number`&&(t[e]!==0||n[e]!==0)&&h.append(Y(r,`${t[e]} → ${n[e]}`));typeof t.outcomeUnknownRequests==`number`&&t.outcomeUnknownRequests>0&&h.append(J(`p`,`ui-error`,`The current records with unconfirmed transaction results will be removed.`)),e.restartRequiredAfterImport===!0&&h.append(J(`p`,`ui-note`,`After restoring, fully quit and reopen all apps using Sui MCP. Network addresses specified in the app launch settings still take priority over the restored settings.`)),h.append(J(`p`,`ui-note`,`Restoring saved addresses does not reconnect a wallet. Disconnect any retained wallet connection, then connect again before using an address.`))}else nC(h,r.preparation?.counts,`Current local records`)}if(r.draft.kind===`restart_wallet_service`){h.append(J(`p`,`ui-note`,`The wallet connection service restarts while your apps stay open. Pending wallet approvals can no longer send a transaction, and unfinished review checks stop. Transactions already sent to Sui are not cancelled; checks already in progress continue. Restarting does not confirm a failed disconnection or remove the connection from your wallet app.`));let e=ue??rv.parse(r.preparation?.impact);h.append(Y(`Wallet connection records`,String(e.connections.length)),J(`p`,`ui-note`,`These are recorded connections, not confirmation that a wallet is connected now. Restarting does not reconnect a disconnected wallet.`));for(let t of e.connections){h.append(Y(`Wallet`,t.walletName??`Wallet`),Y(`Recorded status`,XS[t.status]));for(let e of t.chainResults.filter(e=>e.status===`bound`))h.append(Y(`${T_[e.chainId]} address`,og(e.address)));t.disconnectPending&&h.append(J(`p`,`ui-note`,`This wallet's disconnection has not been confirmed.`))}let t=e.requests.filter(e=>e.request_status===`awaiting_signature`).length;h.append(Y(`Wallet approval requests to stop`,String(t)),Y(`Other transaction requests`,String(e.requests.length-t)))}t&&r.allowedActions.includes(`settings_confirm`)?h.append(ne(b($S[r.draft.kind],{action:`settings_confirm`,operationId:r.operationId,preparationId:r.preparationId},[`reset_local_data`,`import_local_data`].includes(r.draft.kind)?`danger`:`primary`))):t&&h.append(J(`p`,`ui-note`,`This change cannot be confirmed right now.`))}else if(O){let e;if(h.append(J(`h2`,void 0,US[O.kind])),le===`records`&&h.append(J(`p`,`ui-note`,KS)),O.kind===`import_local_data`){if(r.restoreCheck?.status===`cannot_restore`){let e=J(`p`,`ui-error`,r.restoreCheck.message);e.setAttribute(`role`,`alert`),h.append(J(`h3`,void 0,`Cannot restore`),e)}else r.restoreCheck?.status===`check_required`&&h.append(J(`p`,`ui-note`,r.restoreCheck.message));if(v?.progress&&!ie&&!re){let e=J(`p`,`ui-note`,v.progress.stage===`reading`?`Reading the selected file…`:`Receiving backup…`);e.setAttribute(`role`,`status`),h.append(e)}let n=ng({type:`file`});n.accept=`.json,application/json`,n.dataset.cardAction=`settings_begin_upload`,n.addEventListener(`change`,()=>{let e=n.files?.[0];if(!e||!c||d||o)return;let t={startingRevision:i.revision,progress:void 0};v=t,d=!0,u=void 0,VS(e,c,()=>({operationId:r.operationId,cardId:i.cardId}),()=>!o&&v===t,e=>{o||v!==t||e.operationId!==r.operationId||e.cardId!==i.cardId||(t.progress=e,w(),l?.())}).then(()=>{!o&&v===t&&(u=void 0)}).catch(e=>{!o&&v===t&&(u={cardId:i.cardId,operationId:r.operationId,revision:i.revision,draft:JSON.stringify(r.draft),fileId:r.file?.fileId,message:e instanceof Error?e.message:`The file transfer could not be confirmed. Choose the file again to continue.`})}).finally(()=>{v===t&&(v=void 0),d=!1,o||(w(),l?.())})}),t&&!r.file?.sealed&&h.append(rg(r.file?`Choose the same file to continue`:`Choose a Sui MCP backup (up to 16 MiB)`,n)),r.file&&(h.append(Y(`Selected file`,r.file.displayName),Y(`File received`,`${r.file.receivedSize.toLocaleString(`en-US`)} / ${r.file.totalSize.toLocaleString(`en-US`)} bytes`)),t&&r.allowedActions.includes(`settings_prepare`)&&(e=b(`Check backup again`,{action:`settings_prepare`,operationId:r.operationId},`primary`)),t&&h.append(x(`Change backup file`,{kind:`import_local_data`},!1,!0)))}else{if(O.kind===`set_endpoint`||O.kind===`restore_endpoint`){let e=O.endpoint===`grpc`?r.facts?.localSettings.suiGrpcUrl:r.facts?.localSettings.suiGraphqlUrl;h.append(Y(`Network setting`,O.endpoint===`grpc`?`Sui node (gRPC)`:`Activity data (GraphQL)`)),e&&h.append(Y(`Current saved address`,e.storedValue)),O.kind===`set_endpoint`?h.append(Y(`Selected network address`,O.value)):h.append(J(`p`,`ui-note`,`Review the built-in default address before confirming this change.`)),e?.source===`environment`&&h.append(J(`p`,`ui-note`,`The app launch settings specify the network address in use. Saving or restoring an address here does not remove that launch setting.`))}else O.kind===`set_wallet_networks`?h.append(Y(`Selected networks`,O.chains.map(e=>T_[e]).join(`, `)||`None`),J(`p`,`ui-note`,`The selection applies to new wallet connections. Existing connections and connection requests stay unchanged.`)):O.kind===`restart_wallet_service`?(r.facts&&h.append(Y(`Wallet connection service`,JS[r.facts.walletAvailability.status])),r.facts?.connectionReconciliationRequired&&h.append(J(`p`,`ui-error`,ov)),r.facts&&r.facts.walletAvailability.status!==`available`&&h.append(J(`p`,`ui-note`,r.facts.walletAvailability.message)),h.append(J(`p`,`ui-note`,`Review the connection and transaction requests affected before confirming a service restart.`))):O.kind===`reset_local_data`&&h.append(J(`p`,`ui-note`,`Review the records and saved settings to delete before confirming the reset.`));t&&r.allowedActions.includes(`settings_prepare`)&&(e=b(`Retry check`,{action:`settings_prepare`,operationId:r.operationId},`primary`))}e&&h.append(ne(e))}else{if(h.append(J(`h2`,void 0,D===`overview`?`Choose a section`:WS[D])),D===`overview`){h.append(J(`p`,`ui-note`,`You can use the default Sui mainnet network settings. Custom settings are optional.`)),r.facts?.connectionReconciliationRequired&&h.append(J(`p`,`ui-error`,ov));let e=r.facts?.walletAvailability;e&&e.status!==`available`&&h.append(J(`p`,e.status===`unavailable`?`ui-error`:`ui-note`,e.message),...e.status===`unavailable`?[J(`p`,`ui-note`,`Open Troubleshooting below to check the connection service.`)]:[]);let t=J(`div`,`settings-menu`);t.setAttribute(`aria-label`,`Settings sections`);for(let e of[`networks`,`address`,`records`,`troubleshooting`,`advanced`]){let n=ee(WS[e],{kind:`section`,page:e});n.classList.add(`settings-menu-item`),n.setAttribute(`aria-label`,WS[e]),n.textContent=``,n.append(J(`span`,`settings-menu-title`,WS[e]),J(`span`,`settings-menu-description`,GS[e])),t.append(n)}if(h.append(t),r.draft&&(r.phase===`prepared`||r.draft.kind===`import_local_data`)){let e=J(`div`,`settings-pending`);e.append(J(`p`,`ui-note`,`Unfinished change: ${US[r.draft.kind]}.`),ee(`Resume`,{kind:`operation`,operation:r.draft.kind})),h.append(e)}}else if(D===`address`)h.append(Y(`Saved read address`,r.facts?.readAddress?og(r.facts.readAddress):`Not set`),J(`p`,`ui-note`,`Clearing this address does not disconnect your wallet, change its fixed addresses or cancel a transaction. Explicit-address reads remain available.`)),t&&r.facts?.readAddress&&r.facts.readConnectionId&&r.allowedActions.includes(`settings_clear_read_address`)&&h.append(tg(b(`Clear saved read address`,{action:`settings_clear_read_address`,operationId:r.operationId,connectionId:r.facts.readConnectionId,account:r.facts.readAddress},`primary`)));else if(D===`networks`){let e=r.facts?.localSettings.walletConnectionChains??[];s??=new Set(r.draft?.kind===`set_wallet_networks`?r.draft.chains:e),h.append(J(`p`,`ui-note`,`Choose the networks for your next wallet connection. Only addresses approved by the wallet will be used.`),Y(`Saved networks`,e.map(e=>T_[e]).join(`, `)||`None`));for(let e of y_){let n=ng({type:`checkbox`,name:e});n.checked=s.has(e),n.disabled=!t,n.dataset.cardAction=`settings_save_wallet_networks`,n.dataset.walletNetwork=e,n.addEventListener(`change`,()=>{n.checked?s.add(e):s.delete(e)}),h.append(rg(T_[e],n))}if(h.append(J(`p`,`ui-note`,`An unsent Connect request ends if its networks change. Requests already sent and approved connections keep their networks. To change an approved connection, disconnect it and connect again. An empty selection disables new connections.`)),t){let n=$h(`Save networks`,()=>{!o&&!d&&t({action:`settings_save_wallet_networks`,operationId:r.operationId,chains:y_.filter(e=>s.has(e)),expectedChains:e})},`primary`);n.dataset.cardAction=`settings_save_wallet_networks`,h.append(tg(n))}}else if(D===`records`)h.append(J(`p`,`ui-note`,KS)),t&&h.append(te(`Backup`,`Download the current local records and settings as one backup file. If this connection cannot provide downloads, the same file is saved in the Sui MCP backup folder on this computer.`,ae(`Download backup`,`settings_download_backup`,()=>S(!1))),te(`Restore`,`Choose a Sui MCP backup. It will be checked automatically before you confirm the restore.`,x(`Restore local records`,{kind:`import_local_data`})),te(`Reset`,`Review the local records and stored settings to delete. This does not cancel transactions on Sui.`,x(`Reset local data`,{kind:`reset_local_data`},!0)));else if(D===`troubleshooting`)r.facts&&(h.append(Y(`Wallet connection service`,JS[r.facts.walletAvailability.status])),r.facts.connectionReconciliationRequired&&h.append(J(`p`,`ui-error`,ov)),r.facts.observedAt&&h.append(Y(`Status checked at`,sg(r.facts.observedAt))),r.facts.walletAvailability.status!==`available`&&h.append(J(`p`,`ui-note`,r.facts.walletAvailability.message))),h.append(J(`p`,`ui-note`,`Restart the wallet connection service if a connection request is not responding. Starting up or waiting for you to approve in your wallet does not by itself mean a failure.`)),t&&h.append(x(`Restart connection service`,{kind:`restart_wallet_service`}));else if(D===`advanced`&&r.facts)for(let e of[`grpc`,`graphql`]){let n=e===`grpc`?r.facts.localSettings.suiGrpcUrl:r.facts.localSettings.suiGraphqlUrl,i=ng({value:r.draft?.kind===`set_endpoint`&&r.draft.endpoint===e?r.draft.value:n.storedValue});i.dataset.cardAction=`settings_select`;let a=J(`div`,`settings-endpoint`);if(a.append(rg(e===`grpc`?`Sui node (gRPC)`:`Activity data (GraphQL)`,i),J(`p`,`ui-note`,e===`grpc`?`Used to retrieve balances, check transactions before wallet approval and send approved transactions.`:`Used to retrieve transaction activity.`)),t){let n=$h(`Select network address`,()=>{!d&&!o&&t({action:`settings_select`,draft:{kind:`set_endpoint`,endpoint:e,value:i.value}})},`secondary`);n.dataset.cardAction=`settings_select`,a.append(eg(n,x(`Select default network address`,{kind:`restore_endpoint`,endpoint:e})))}n.appliesAfter&&a.append(J(`p`,`ui-note`,`A saved change needs an app restart. `+qS)),n.source===`environment`&&a.append(J(`p`,`ui-note`,`The app launch settings specify the network address to use. Remove that launch setting before restarting to use an address saved here.`)),h.append(a)}D!==`overview`&&r.draft&&D===tC(r.draft.kind)&&(r.phase===`prepared`||r.draft.kind===`import_local_data`)&&h.append(J(`p`,`ui-note`,`Unfinished change: ${US[r.draft.kind]}.`),ee(`Resume`,{kind:`operation`,operation:r.draft.kind})),t&&D===`overview`&&r.allowedActions.includes(`settings_cancel`)&&(r.draft&&h.append(J(`p`,`ui-note`,`Closing Settings discards this unfinished change. Nothing will be applied.`)),h.append(tg(b(`Close Settings`,{action:`settings_cancel`}))))}if((g?.kind===`preparation_response`||g?.kind===`selection_response`)&&!r.result&&!se){let e=J(`p`,`ui-note`,g.kind===`selection_response`?`Checking this change…`:`Waiting for a response…`);e.setAttribute(`role`,`status`),h.append(e)}u&&E===`input`&&O?.kind===`import_local_data`&&h.append(J(`p`,`ui-note`,u.message));let pe=y.contains(document.activeElement)?document.activeElement.dataset.walletNetwork:void 0;C(h,le,ue,O),y.replaceChildren(h),pe&&[...y.querySelectorAll(`input[data-wallet-network]`)].find(e=>e.dataset.walletNetwork===pe)?.focus(),f&&[...y.querySelectorAll(`input`)].filter(e=>e.type!==`file`).forEach((e,t)=>{f[t]!==void 0&&(e.value=f[t])}),n&&(y.querySelector(`details`).open=!0)}return w(),{node:y,update(e,t){let n=lS.parse(e.data);if(n.operationId!==r.operationId)return!1;h&&n.file?.fileId===h.fileId&&n.download?.currentAttemptId===h.attemptId&&n.download.hostReport===h.status&&(h=void 0,g=void 0),h&&(!n.download?.allowedFileActions.includes(`settings_report_download`)||n.file?.fileId!==h.fileId)&&(h=void 0,g=void 0),u&&(n.result||e.revision!==u.revision||e.cardId!==u.cardId||n.operationId!==u.operationId||JSON.stringify(n.draft)!==u.draft||n.file?.fileId!==u.fileId)&&(u=void 0);let o=e===i;if(o&&!p&&!t.settingsCommandProgress)return!0;(JSON.stringify(n.draft)!==JSON.stringify(r.draft)||n.phase===`prepared`&&r.phase!==`prepared`)&&(a=n.draft?{kind:`operation`,operation:n.draft.kind}:{kind:`section`,page:tC(r.draft?.kind)});let s=v?.progress;return v&&(n.result||n.draft?.kind!==`import_local_data`||s?.stage===`reading`&&e.revision>v.startingRevision||s?.fileId&&n.file?.fileId!==s.fileId||s?.sha256&&n.file&&n.file.sha256!==s.sha256)&&(v=void 0),r=n,i=e,c=t.settings,l=t.onDisplayChange,p=t.settingsCommandProgress,w(o),ie(),!0},displayRecovery(){return h?g:void 0},dispose(){o=!0,v=void 0,u=void 0,m=void 0,h=void 0}}}RS(`settings`,{title:`Settings`,controls:(e,t,n,r,i)=>rC(e,t,i),result:(e,t,n,r,i)=>rC(e,n,i)});</script></body></html>