@decocms/mesh 1.0.0-alpha.1 → 1.0.0-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/dist/README.md +288 -0
  2. package/dist/client/assets/{alert-dialog-DsYjmjQa.js → alert-dialog-Hgs2tcw0.js} +3 -3
  3. package/dist/client/assets/{auth-dQSMuI_r.js → auth-Dfo88onv.js} +1 -1
  4. package/dist/client/assets/{auth-catchall-vTieIyKZ.js → auth-catchall-pzDMkYZ_.js} +1 -1
  5. package/dist/client/assets/{avatar-DFNVHH7B.js → avatar-Dw1KHXJf.js} +1 -1
  6. package/dist/client/assets/{badge-D0svJbIE.js → badge-C29ypR-2.js} +1 -1
  7. package/dist/client/assets/{button-CB7Gt-Ba.js → button-Cv1rgJOF.js} +1 -1
  8. package/dist/client/assets/{card-BZePxfHz.js → card-BggFBtGd.js} +1 -1
  9. package/dist/client/assets/{checkbox-CJwRElzS.js → checkbox-Ay9B68Cb.js} +1 -1
  10. package/dist/client/assets/{circle-alert-FONBIc_T.js → circle-alert-C3-3ZyHM.js} +1 -1
  11. package/dist/client/assets/collection-detail-BihTkJuQ.js +1 -0
  12. package/dist/client/assets/{collection-display-button-Ccjj22Xn.js → collection-display-button-grM851Xd.js} +1 -1
  13. package/dist/client/assets/{collection-header-C3vTyWNy.js → collection-header-DsMf-88h.js} +1 -1
  14. package/dist/client/assets/{collection-page-BplXISpO.js → collection-page-C6Lt30BH.js} +1 -1
  15. package/dist/client/assets/{collection-search-BpPEPb0j.js → collection-search-CXcLRFBk.js} +1 -1
  16. package/dist/client/assets/{collection-table-wrapper-CJdrG443.js → collection-table-wrapper-DIAaiM6K.js} +1 -1
  17. package/dist/client/assets/{connection-card-B7VMSnFz.js → connection-card-BSv7-QCW.js} +1 -1
  18. package/dist/client/assets/connection-detail-B1R8nv6U.js +1 -0
  19. package/dist/client/assets/connections-hz-ahAKO.js +1 -0
  20. package/dist/client/assets/{create-organization-dialog-Mq1L8DSD.js → create-organization-dialog-Bvkdjwsj.js} +1 -1
  21. package/dist/client/assets/dialog-rRH3MQkl.js +1 -0
  22. package/dist/client/assets/{dropdown-menu-zoKN8fKM.js → dropdown-menu-dUgjswGX.js} +1 -1
  23. package/dist/client/assets/{empty-state-BCgOYCyG.js → empty-state-CCq1QaCi.js} +1 -1
  24. package/dist/client/assets/{error-boundary-L4NxoU-J.js → error-boundary-COxhsLlB.js} +1 -1
  25. package/dist/client/assets/{extract-connection-data-mJfi2GDs.js → extract-connection-data-DyKjnzFA.js} +1 -1
  26. package/dist/client/assets/{form-BmhZau8F.js → form-xpLXXjk9.js} +1 -1
  27. package/dist/client/assets/gateway-detail-DIqZF9Yz.js +1 -0
  28. package/dist/client/assets/gateways-BEpD9ssC.js +1 -0
  29. package/dist/client/assets/{home-RT_Ssleq.js → home-BP87nVNG.js} +1 -1
  30. package/dist/client/assets/{icon-Zm7eEeKG.js → icon-KZI-tyY2.js} +1 -1
  31. package/dist/client/assets/{index-CBL6DTCM.js → index-3kbMatbv.js} +15 -15
  32. package/dist/client/assets/{index-CoeZDSQf.js → index-B6JW-QRO.js} +1 -1
  33. package/dist/client/assets/{index-BAut7b_p.js → index-C3w_QZu6.js} +1 -1
  34. package/dist/client/assets/index-CMNfZDn2.css +1 -0
  35. package/dist/client/assets/index-kuMaGV9U.js +118 -0
  36. package/dist/client/assets/{input-DWY0hRYC.js → input-C0U94pom.js} +1 -1
  37. package/dist/client/assets/integration-icon-Dv-2D552.js +2 -0
  38. package/dist/client/assets/{layout-C75gYFRR.js → layout-B4csW0zk.js} +1 -1
  39. package/dist/client/assets/{lazy-highlighter-V_ETf5s5.js → lazy-highlighter-BeM-KnKF.js} +1 -1
  40. package/dist/client/assets/{localstorage-keys-CdMYd__a.js → localstorage-keys-BY-fTuiw.js} +1 -1
  41. package/dist/client/assets/login-Dl_POp8A.js +1 -0
  42. package/dist/client/assets/mcp-oauth-C8lkjJJ-.js +1 -0
  43. package/dist/client/assets/members-sRtGjt4B.js +1 -0
  44. package/dist/client/assets/{monitoring-stats-row-DiSEgwHP.js → monitoring-stats-row-Bmw8lKAo.js} +9 -9
  45. package/dist/client/assets/monitoring-wqV_ck_J.js +1 -0
  46. package/dist/client/assets/oauth-callback-D4bjzxVG.js +1 -0
  47. package/dist/client/assets/page-Dm4c28Rt.js +1 -0
  48. package/dist/client/assets/{popover-B7GJHYd2.js → popover-BLX5hifQ.js} +1 -1
  49. package/dist/client/assets/{prism-BsII3tZL.js → prism-a2E9dRRh.js} +1 -1
  50. package/dist/client/assets/{resource-tabs-Djqhz6PB.js → resource-tabs-C2-m37Rp.js} +1 -1
  51. package/dist/client/assets/{schema-CJRWBwzd.js → schema-DLIeWQJ0.js} +1 -1
  52. package/dist/client/assets/{select-CrueAR2N.js → select-BFyzpZOm.js} +1 -1
  53. package/dist/client/assets/settings-KJAP4FWc.js +1 -0
  54. package/dist/client/assets/{shell-layout-CwcEMEv3.js → shell-layout-DqWy6R9v.js} +4 -4
  55. package/dist/client/assets/{spinner-R42f7AVH.js → spinner-CYHX4tj_.js} +1 -1
  56. package/dist/client/assets/store-DoIp_x0L.js +1 -0
  57. package/dist/client/assets/store-app-detail-CkhxmJHm.js +1 -0
  58. package/dist/client/assets/switch-B0GAK0hk.js +1 -0
  59. package/dist/client/assets/{textarea-CAmjTm6l.js → textarea-7TwZjOJN.js} +1 -1
  60. package/dist/client/assets/tool-set-selector-BxJYXzYX.js +1 -0
  61. package/dist/client/assets/{tooltip-BLbXpJcn.js → tooltip-CyTpNpEt.js} +1 -1
  62. package/dist/client/assets/{upload-CG7PZ6WF.js → upload-CedwcKCT.js} +1 -1
  63. package/dist/client/assets/{use-binding-CeSgmpzj.js → use-binding-Dlf98XSv.js} +2 -2
  64. package/dist/client/assets/use-gateway-C6ADI4VP.js +1 -0
  65. package/dist/client/assets/{use-list-state-BTIryg2o.js → use-list-state-Cu8fsSjR.js} +1 -1
  66. package/dist/client/assets/use-mcp-Z1amXXTK.js +1 -0
  67. package/dist/client/assets/use-members-dDzJ30ii.js +1 -0
  68. package/dist/client/assets/{use-mobile-BPQzOCZP.js → use-mobile-Ct-F04sM.js} +1 -1
  69. package/dist/client/assets/use-organization-settings-D7E3skEu.js +1 -0
  70. package/dist/client/assets/{use-tool-call-BsMTRGjQ.js → use-tool-call-DSlbFKjt.js} +1 -1
  71. package/dist/client/assets/useQuery-DJ7WNdWe.js +1 -0
  72. package/dist/client/assets/utils-dJ2GyoL3.js +1 -0
  73. package/dist/client/index.html +2 -2
  74. package/dist/server/cli.js +171 -169
  75. package/dist/server/migrate.js +204 -204
  76. package/dist/server/server.js +232 -232
  77. package/package.json +18 -19
  78. package/dist/client/assets/chunk-2RRQPJJO-DGhxLrrR.js +0 -1
  79. package/dist/client/assets/collection-detail-CFf2hZjF.js +0 -1
  80. package/dist/client/assets/connection-detail-DGFMHZQW.js +0 -1
  81. package/dist/client/assets/connections-BFxMYtuo.js +0 -1
  82. package/dist/client/assets/dialog-DhrfZsqb.js +0 -1
  83. package/dist/client/assets/gateway-detail-BEN_sL0j.js +0 -1
  84. package/dist/client/assets/gateways-DPfP8fjF.js +0 -1
  85. package/dist/client/assets/index-CfNAXm02.js +0 -1
  86. package/dist/client/assets/index-VCe1FY3E.js +0 -118
  87. package/dist/client/assets/index-feMggVqN.css +0 -1
  88. package/dist/client/assets/integration-icon-Dgf9Pzxc.js +0 -1
  89. package/dist/client/assets/login-CaI2gNh0.js +0 -1
  90. package/dist/client/assets/members-BD990Z5F.js +0 -1
  91. package/dist/client/assets/monitoring-s9rrPP3V.js +0 -1
  92. package/dist/client/assets/oauth-callback-ChC_4XSg.js +0 -10
  93. package/dist/client/assets/page-BauA0SPJ.js +0 -1
  94. package/dist/client/assets/settings-85tu13fN.js +0 -1
  95. package/dist/client/assets/store-app-detail-D89e4NIX.js +0 -1
  96. package/dist/client/assets/store-zixro3Vs.js +0 -1
  97. package/dist/client/assets/tool-set-selector-BfScgRcK.js +0 -1
  98. package/dist/client/assets/use-connection-D5nZyekX.js +0 -2
  99. package/dist/client/assets/use-gateway-pRk3-ua4.js +0 -1
  100. package/dist/client/assets/use-members-OyBpbFn0.js +0 -1
  101. package/dist/client/assets/use-organization-settings-CMP1q4u_.js +0 -1
  102. package/dist/client/assets/useQuery-DEUZMq4A.js +0 -1
  103. package/dist/client/assets/utils-B-QWwgyW.js +0 -1
package/dist/README.md ADDED
@@ -0,0 +1,288 @@
1
+ <img alt="MCP Mesh Readme Banner" src="https://github.com/user-attachments/assets/e6283421-71ff-478d-8c45-9fb67d484888" />
2
+
3
+ <h1 align="center">MCP Mesh</h1>
4
+
5
+ <p align="center">
6
+ <em>MCP-native · TypeScript-first · Deploy anywhere</em><br/><br/>
7
+ <b>One secure endpoint for every MCP server.</b>
8
+ </p>
9
+
10
+ <p align="center">
11
+ <a href="https://docs.deco.page/">📘 Docs</a> ·
12
+ <a href="https://decocms.com/discord">💬 Discord</a> ·
13
+ <a href="https://decocms.com/mesh">🌐 decocms.com/mesh</a>
14
+ </p>
15
+
16
+ > **TL;DR:**
17
+ > - Route all MCP traffic through a single governed endpoint
18
+ > - Enforce RBAC, policies, and audit trails at the control plane
19
+ > - Full observability with OpenTelemetry — traces, costs, errors
20
+ > - Runtime strategies as gateways for optimal tool selection
21
+ > - Self-host with Docker, Bun/Node, Kubernetes, or run locally
22
+
23
+ ---
24
+
25
+ ## What is an MCP Mesh?
26
+
27
+ **MCP Mesh** is an open-source control plane for MCP traffic. It sits between your MCP clients (Cursor, Claude, Windsurf, VS Code, custom agents) and your MCP servers, providing a unified layer for auth, routing and observability.
28
+
29
+ It replaces M×N integrations (M MCP servers × N clients) with one production endpoint, so you stop maintaining separate configs in every client. Built for multi-tenant orgs: workspace/project scoping for policies, credentials, and logs.
30
+
31
+ ```
32
+ ┌─────────────────────────────────────────────────────────────────┐
33
+ │ MCP Clients │
34
+ │ Cursor · Claude · VS Code · Custom Agents │
35
+ └───────────────────────────┬─────────────────────────────────────┘
36
+
37
+
38
+ ┌─────────────────────────────────────────────────────────────────┐
39
+ │ MCP MESH │
40
+ │ Gateway · Policy Engine · Observability · Token Vault │
41
+ └───────────────────────────┬─────────────────────────────────────┘
42
+
43
+
44
+ ┌─────────────────────────────────────────────────────────────────┐
45
+ │ MCP Servers │
46
+ │ Salesforce · Slack · GitHub · Postgres · Your APIs │
47
+ └─────────────────────────────────────────────────────────────────┘
48
+ ```
49
+ ---
50
+
51
+ ## Quick Start
52
+
53
+ ```bash
54
+ # Clone and install
55
+ git clone https://github.com/decocms/mesh.git
56
+ cd mesh
57
+ bun install
58
+
59
+ # Run locally (client + API server)
60
+ bun run dev
61
+ ```
62
+
63
+ → runs at [http://localhost:4000](http://localhost:4000) (client) + API server
64
+
65
+ Or use `npm create deco` to scaffold a new project with the CLI.
66
+
67
+ ---
68
+
69
+ ## Runtime strategies as gateways
70
+
71
+ As tool surfaces grow, “send every tool definition to the model on every call” gets expensive and slow.
72
+ The mesh models runtime strategies as gateways: one endpoint, different ways of exposing tools.
73
+
74
+ Examples:
75
+ - Full-context: expose everything (simple and deterministic for small toolsets)
76
+ - Smart selection: narrow the toolset before execution
77
+ - Code execution: load tools on demand and run code in a sandbox
78
+
79
+ Gateways are configurable and extensible. You can add new strategies and also curate toolsets (see Virtual MCPs).
80
+
81
+ ---
82
+
83
+ ## Core Capabilities
84
+
85
+ | Capability | What it does |
86
+ |-------|-------------|
87
+ | **MeshContext** | Unified runtime interface providing auth, storage, observability, and policy control |
88
+ | **defineTool()** | Declarative API for typed, auditable, observable MCP tools |
89
+ | **AccessControl** | Fine-grained RBAC via Better Auth — OAuth 2.1 + API keys per workspace/project |
90
+ | **Multi-tenancy** | Workspace/project isolation for config, credentials, policies, and audit logs |
91
+ | **OpenTelemetry** | Full tracing and metrics for tools, workflows, and UI interactions |
92
+ | **Storage Adapters** | Kysely ORM → SQLite / Postgres, easily swapped |
93
+ | **Proxy Layer** | Secure bridge to remote MCP servers with token vault + OAuth |
94
+ | **Virtual MCPs** | Compose and expose governed toolsets as new MCP servers |
95
+ | **Event Bus** | Pub/sub between connections with scheduled/cron delivery and at-least-once guarantees |
96
+ | **Bindings** | Capability contracts (ex.: agents, workflows, views) so apps target interfaces instead of specific MCP implementations |
97
+
98
+ ---
99
+
100
+ ## Define Tools
101
+
102
+ Tools are first-class citizens. Type-safe, audited, observable, and callable via MCP.
103
+
104
+ ```ts
105
+ import { z } from "zod";
106
+ import { defineTool } from "~/core/define-tool";
107
+
108
+ export const CONNECTION_CREATE = defineTool({
109
+ name: "CONNECTION_CREATE",
110
+ description: "Create a new MCP connection",
111
+ inputSchema: z.object({
112
+ name: z.string(),
113
+ connection: z.object({
114
+ type: z.enum(["HTTP", "SSE", "WebSocket"]),
115
+ url: z.string().url(),
116
+ token: z.string().optional(),
117
+ }),
118
+ }),
119
+ outputSchema: z.object({
120
+ id: z.string(),
121
+ scope: z.enum(["workspace", "project"]),
122
+ }),
123
+ handler: async (input, ctx) => {
124
+ await ctx.access.check();
125
+ const conn = await ctx.storage.connections.create({
126
+ projectId: ctx.project?.id ?? null,
127
+ ...input,
128
+ createdById: ctx.auth.user!.id,
129
+ });
130
+ return { id: conn.id, scope: conn.projectId ? "project" : "workspace" };
131
+ },
132
+ });
133
+ ```
134
+
135
+ Every tool call automatically gets: input/output validation, access control checks, audit logging, and OpenTelemetry traces.
136
+
137
+ ---
138
+
139
+ ## Project Structure
140
+
141
+ ```
142
+ ├── apps/
143
+ │ ├── mesh/ # Full-stack MCP Mesh (Hono API + Vite/React)
144
+ │ │ ├── src/
145
+ │ │ │ ├── api/ # Hono HTTP + MCP proxy routes
146
+ │ │ │ ├── auth/ # Better Auth (OAuth + API keys)
147
+ │ │ │ ├── core/ # MeshContext, AccessControl, defineTool
148
+ │ │ │ ├── tools/ # Built-in MCP management tools
149
+ │ │ │ ├── storage/ # Kysely DB adapters
150
+ │ │ │ ├── event-bus/ # Pub/sub event delivery system
151
+ │ │ │ ├── encryption/ # Token vault & credential management
152
+ │ │ │ ├── observability/ # OpenTelemetry tracing & metrics
153
+ │ │ │ └── web/ # React 19 admin UI
154
+ │ │ └── migrations/ # Kysely database migrations
155
+ │ └── docs/ # Astro documentation site
156
+
157
+ └── packages/
158
+ ├── bindings/ # Core MCP bindings and connection abstractions
159
+ ├── runtime/ # MCP proxy, OAuth, and runtime utilities
160
+ ├── ui/ # Shared React components (shadcn-based)
161
+ ├── cli/ # CLI tooling (deco commands)
162
+ ├── create-deco/ # Project scaffolding (npm create deco)
163
+ └── vite-plugin-deco/ # Vite plugin for Deco projects
164
+ ```
165
+
166
+ ---
167
+
168
+ ## Development
169
+
170
+ ```bash
171
+ # Install dependencies
172
+ bun install
173
+
174
+ # Run dev server (client + API)
175
+ bun run dev
176
+
177
+ # Run tests
178
+ bun test
179
+
180
+ # Type check
181
+ bun run check
182
+
183
+ # Lint
184
+ bun run lint
185
+
186
+ # Format
187
+ bun run fmt
188
+ ```
189
+
190
+ ### Mesh-specific commands (from `apps/mesh/`)
191
+
192
+ ```bash
193
+ bun run dev:client # Vite dev server (port 4000)
194
+ bun run dev:server # Hono server with hot reload
195
+ bun run migrate # Run database migrations
196
+ ```
197
+
198
+ ---
199
+
200
+ ## Deploy Anywhere
201
+
202
+ ```bash
203
+ # Docker Compose (SQLite)
204
+ docker compose -f deploy/docker-compose.yml up
205
+
206
+ # Docker Compose (PostgreSQL)
207
+ docker compose -f deploy/docker-compose.postgres.yml up
208
+
209
+ # Self-host with Bun
210
+ bun run build:client && bun run build:server
211
+ bun run start
212
+
213
+ # Kubernetes
214
+ kubectl apply -f k8s/
215
+ ```
216
+
217
+ Runs on any infrastructure — Docker, Kubernetes, AWS, GCP, or local Bun/Node runtimes. No vendor lock-in.
218
+
219
+ ---
220
+
221
+ ## Tech Stack
222
+
223
+ | Layer | Tech |
224
+ |-------|------|
225
+ | Runtime | Bun / Node |
226
+ | Language | TypeScript + Zod |
227
+ | Framework | Hono (API) + Vite + React 19 |
228
+ | Database | Kysely → SQLite / PostgreSQL |
229
+ | Auth | Better Auth (OAuth 2.1 + API keys) |
230
+ | Observability | OpenTelemetry |
231
+ | UI | React 19 + Tailwind v4 + shadcn |
232
+ | Protocol | Model Context Protocol (MCP) |
233
+
234
+ ---
235
+
236
+ ## Roadmap
237
+
238
+ - [ ] Multi-tenant admin dashboard
239
+ - [ ] MCP bindings (swap providers without rewrites)
240
+ - [ ] Version history for mesh configs
241
+ - [ ] NPM package runtime
242
+ - [ ] Edge debugger / live tracing
243
+ - [ ] Cost analytics and spend caps
244
+ - [ ] MCP Store — discover and install pre-built MCP apps
245
+
246
+ ---
247
+
248
+ ## Part of deco CMS
249
+
250
+ The MCP Mesh is the infrastructure layer of [decoCMS](https://decocms.com).
251
+
252
+ | Layer | What it does |
253
+ |-------|--------------|
254
+ | **MCP Mesh** | Connect, govern, and observe MCP traffic |
255
+ | **MCP Studio** (coming soon) | Package durable MCP capabilities into shareable apps (SDK + no-code admin) |
256
+ | **MCP Store** (coming soon) | Discover, install (and eventually monetize) pre-built MCP apps. |
257
+
258
+ ---
259
+
260
+ ## License
261
+
262
+ The MCP Mesh ships with a **Sustainable Use License (SUL)**. See [LICENSE.md](./LICENSE.md).
263
+
264
+ - ✅ Free to self-host for internal use
265
+ - ✅ Free for client projects (agencies, SIs)
266
+ - ⚠️ Commercial license required for SaaS or revenue-generating production systems
267
+
268
+ Questions? [contact@decocms.com](mailto:contact@decocms.com)
269
+
270
+ ---
271
+
272
+ ## Contributing
273
+
274
+ We welcome contributions! Run the following before submitting a PR:
275
+
276
+ ```bash
277
+ bun run fmt # Format code
278
+ bun run lint # Check linting
279
+ bun test # Run tests
280
+ ```
281
+
282
+ See `AGENTS.md` for detailed coding guidelines and conventions.
283
+
284
+ ---
285
+
286
+ <div align="center">
287
+ <sub>Made with ❤️ by the <a href="https://decocms.com">deco</a> community</sub>
288
+ </div>
@@ -1,7 +1,7 @@
1
- import{r as i,bA as m,az as A,j as r,bB as w,aB as T,ab as O,aE as M,bC as I,ad as D,ac as z,ax as F,ae as L,a9 as B,aa as G,a8 as k,c as n}from"./index-VCe1FY3E.js";import{c as p}from"./utils-B-QWwgyW.js";import{b as v}from"./button-CB7Gt-Ba.js";var x="AlertDialog",[H]=T(x,[m]),d=m(),N=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(k,{...a,...t,modal:!0})};N.displayName=x;var V="AlertDialogTrigger",W=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(F,{...o,...a,ref:e})});W.displayName=V;var Y="AlertDialogPortal",y=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(z,{...a,...t})};y.displayName=Y;var q="AlertDialogOverlay",_=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(L,{...o,...a,ref:e})});_.displayName=q;var f="AlertDialogContent",[J,K]=H(f),Q=I("AlertDialogContent"),b=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,children:a,...o}=l,s=d(t),c=i.useRef(null),P=A(e,c),u=i.useRef(null);return r.jsx(w,{contentName:f,titleName:j,docsSlug:"alert-dialog",children:r.jsx(J,{scope:t,cancelRef:u,children:r.jsxs(O,{role:"alertdialog",...s,...o,ref:P,onOpenAutoFocus:M(o.onOpenAutoFocus,g=>{g.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:g=>g.preventDefault(),onInteractOutside:g=>g.preventDefault(),children:[r.jsx(Q,{children:a}),r.jsx(X,{contentRef:c})]})})})});b.displayName=f;var j="AlertDialogTitle",h=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(B,{...o,...a,ref:e})});h.displayName=j;var E="AlertDialogDescription",C=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(G,{...o,...a,ref:e})});C.displayName=E;var U="AlertDialogAction",R=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(D,{...o,...a,ref:e})});R.displayName=U;var $="AlertDialogCancel",S=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,{cancelRef:o}=K($,t),s=d(t),c=A(e,o);return r.jsx(D,{...s,...a,ref:c})});S.displayName=$;var X=({contentRef:l})=>{const e=`\`${f}\` requires a description for the component to be accessible for screen reader users.
1
+ import{r as i,bA as m,aC as A,j as r,bB as w,aE as T,ab as O,aH as M,bC as I,ad as D,ac as z,aA as F,ae as L,a9 as G,aa as H,a8 as k,c as n}from"./index-kuMaGV9U.js";import{c as p}from"./utils-dJ2GyoL3.js";import{b as v}from"./button-Cv1rgJOF.js";var x="AlertDialog",[B]=T(x,[m]),d=m(),N=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(k,{...a,...t,modal:!0})};N.displayName=x;var V="AlertDialogTrigger",W=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(F,{...o,...a,ref:e})});W.displayName=V;var Y="AlertDialogPortal",y=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(z,{...a,...t})};y.displayName=Y;var q="AlertDialogOverlay",_=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(L,{...o,...a,ref:e})});_.displayName=q;var f="AlertDialogContent",[J,K]=B(f),Q=I("AlertDialogContent"),b=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,children:a,...o}=l,s=d(t),c=i.useRef(null),P=A(e,c),u=i.useRef(null);return r.jsx(w,{contentName:f,titleName:j,docsSlug:"alert-dialog",children:r.jsx(J,{scope:t,cancelRef:u,children:r.jsxs(O,{role:"alertdialog",...s,...o,ref:P,onOpenAutoFocus:M(o.onOpenAutoFocus,g=>{g.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:g=>g.preventDefault(),onInteractOutside:g=>g.preventDefault(),children:[r.jsx(Q,{children:a}),r.jsx(X,{contentRef:c})]})})})});b.displayName=f;var j="AlertDialogTitle",h=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(G,{...o,...a,ref:e})});h.displayName=j;var C="AlertDialogDescription",E=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(H,{...o,...a,ref:e})});E.displayName=C;var U="AlertDialogAction",R=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(D,{...o,...a,ref:e})});R.displayName=U;var $="AlertDialogCancel",S=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,{cancelRef:o}=K($,t),s=d(t),c=A(e,o);return r.jsx(D,{...s,...a,ref:c})});S.displayName=$;var X=({contentRef:l})=>{const e=`\`${f}\` requires a description for the component to be accessible for screen reader users.
2
2
 
3
- You can add a description to the \`${f}\` by passing a \`${E}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
3
+ You can add a description to the \`${f}\` by passing a \`${C}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
4
4
 
5
5
  Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${f}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
6
6
 
7
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return i.useEffect(()=>{document.getElementById(l.current?.getAttribute("aria-describedby"))||console.warn(e)},[e,l]),null},Z=N,ee=y,te=_,ae=b,oe=R,le=S,se=h,re=C;function fe(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let a;return e[2]!==t?(a=r.jsx(Z,{"data-slot":"alert-dialog",...t}),e[2]=t,e[3]=a):a=e[3],a}function ie(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let a;return e[2]!==t?(a=r.jsx(ee,{"data-slot":"alert-dialog-portal",...t}),e[2]=t,e[3]=a):a=e[3],a}function ne(l){const e=n.c(8);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let o;e[3]!==t?(o=p("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),e[3]=t,e[4]=o):o=e[4];let s;return e[5]!==a||e[6]!==o?(s=r.jsx(te,{"data-slot":"alert-dialog-overlay",className:o,...a}),e[5]=a,e[6]=o,e[7]=s):s=e[7],s}function ge(l){const e=n.c(9);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx(ne,{}),e[3]=o):o=e[3];let s;e[4]!==t?(s=p("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border p-6 shadow-lg duration-200 sm:max-w-lg",t),e[4]=t,e[5]=s):s=e[5];let c;return e[6]!==a||e[7]!==s?(c=r.jsxs(ie,{children:[o,r.jsx(ae,{"data-slot":"alert-dialog-content",className:s,...a})]}),e[6]=a,e[7]=s,e[8]=c):c=e[8],c}function ue(l){const e=n.c(8);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let o;e[3]!==t?(o=p("flex flex-col gap-2 text-center sm:text-left",t),e[3]=t,e[4]=o):o=e[4];let s;return e[5]!==a||e[6]!==o?(s=r.jsx("div",{"data-slot":"alert-dialog-header",className:o,...a}),e[5]=a,e[6]=o,e[7]=s):s=e[7],s}function me(l){const e=n.c(8);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let o;e[3]!==t?(o=p("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),e[3]=t,e[4]=o):o=e[4];let s;return e[5]!==a||e[6]!==o?(s=r.jsx("div",{"data-slot":"alert-dialog-footer",className:o,...a}),e[5]=a,e[6]=o,e[7]=s):s=e[7],s}function Ae(l){const e=n.c(8);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let o;e[3]!==t?(o=p("text-lg font-semibold",t),e[3]=t,e[4]=o):o=e[4];let s;return e[5]!==a||e[6]!==o?(s=r.jsx(se,{"data-slot":"alert-dialog-title",className:o,...a}),e[5]=a,e[6]=o,e[7]=s):s=e[7],s}function De(l){const e=n.c(8);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let o;e[3]!==t?(o=p("text-muted-foreground text-sm",t),e[3]=t,e[4]=o):o=e[4];let s;return e[5]!==a||e[6]!==o?(s=r.jsx(re,{"data-slot":"alert-dialog-description",className:o,...a}),e[5]=a,e[6]=o,e[7]=s):s=e[7],s}function ve(l){const e=n.c(8);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let o;e[3]!==t?(o=p(v(),t),e[3]=t,e[4]=o):o=e[4];let s;return e[5]!==a||e[6]!==o?(s=r.jsx(oe,{className:o,...a}),e[5]=a,e[6]=o,e[7]=s):s=e[7],s}function xe(l){const e=n.c(8);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let o;e[3]!==t?(o=p(v({variant:"outline"}),t),e[3]=t,e[4]=o):o=e[4];let s;return e[5]!==a||e[6]!==o?(s=r.jsx(le,{className:o,...a}),e[5]=a,e[6]=o,e[7]=s):s=e[7],s}export{xe as A,ge as a,ue as b,Ae as c,De as d,me as e,fe as f,ve as g};
7
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return i.useEffect(()=>{document.getElementById(l.current?.getAttribute("aria-describedby"))||console.warn(e)},[e,l]),null},Z=N,ee=y,te=_,ae=b,oe=R,le=S,se=h,re=E;function fe(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let a;return e[2]!==t?(a=r.jsx(Z,{"data-slot":"alert-dialog",...t}),e[2]=t,e[3]=a):a=e[3],a}function ie(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let a;return e[2]!==t?(a=r.jsx(ee,{"data-slot":"alert-dialog-portal",...t}),e[2]=t,e[3]=a):a=e[3],a}function ne(l){const e=n.c(8);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let o;e[3]!==t?(o=p("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),e[3]=t,e[4]=o):o=e[4];let s;return e[5]!==a||e[6]!==o?(s=r.jsx(te,{"data-slot":"alert-dialog-overlay",className:o,...a}),e[5]=a,e[6]=o,e[7]=s):s=e[7],s}function ge(l){const e=n.c(9);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx(ne,{}),e[3]=o):o=e[3];let s;e[4]!==t?(s=p("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border p-6 shadow-lg duration-200 sm:max-w-lg",t),e[4]=t,e[5]=s):s=e[5];let c;return e[6]!==a||e[7]!==s?(c=r.jsxs(ie,{children:[o,r.jsx(ae,{"data-slot":"alert-dialog-content",className:s,...a})]}),e[6]=a,e[7]=s,e[8]=c):c=e[8],c}function ue(l){const e=n.c(8);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let o;e[3]!==t?(o=p("flex flex-col gap-2 text-center sm:text-left",t),e[3]=t,e[4]=o):o=e[4];let s;return e[5]!==a||e[6]!==o?(s=r.jsx("div",{"data-slot":"alert-dialog-header",className:o,...a}),e[5]=a,e[6]=o,e[7]=s):s=e[7],s}function me(l){const e=n.c(8);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let o;e[3]!==t?(o=p("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),e[3]=t,e[4]=o):o=e[4];let s;return e[5]!==a||e[6]!==o?(s=r.jsx("div",{"data-slot":"alert-dialog-footer",className:o,...a}),e[5]=a,e[6]=o,e[7]=s):s=e[7],s}function Ae(l){const e=n.c(8);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let o;e[3]!==t?(o=p("text-lg font-semibold",t),e[3]=t,e[4]=o):o=e[4];let s;return e[5]!==a||e[6]!==o?(s=r.jsx(se,{"data-slot":"alert-dialog-title",className:o,...a}),e[5]=a,e[6]=o,e[7]=s):s=e[7],s}function De(l){const e=n.c(8);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let o;e[3]!==t?(o=p("text-muted-foreground text-sm",t),e[3]=t,e[4]=o):o=e[4];let s;return e[5]!==a||e[6]!==o?(s=r.jsx(re,{"data-slot":"alert-dialog-description",className:o,...a}),e[5]=a,e[6]=o,e[7]=s):s=e[7],s}function ve(l){const e=n.c(8);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let o;e[3]!==t?(o=p(v(),t),e[3]=t,e[4]=o):o=e[4];let s;return e[5]!==a||e[6]!==o?(s=r.jsx(oe,{className:o,...a}),e[5]=a,e[6]=o,e[7]=s):s=e[7],s}function xe(l){const e=n.c(8);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let o;e[3]!==t?(o=p(v({variant:"outline"}),t),e[3]=t,e[4]=o):o=e[4];let s;return e[5]!==a||e[6]!==o?(s=r.jsx(le,{className:o,...a}),e[5]=a,e[6]=o,e[7]=s):s=e[7],s}export{xe as A,ge as a,ue as b,Ae as c,De as d,me as e,fe as f,ve as g};
@@ -1 +1 @@
1
- import{ap as r,bY as n,bj as i,br as _,bs as y,aq as t,bt as f,bi as k,bo as u,bl as O,bk as I,bZ as ze,bq as Ve,b_ as He,b$ as De}from"./index-VCe1FY3E.js";const ae="2025-06-18",xo=[ae,"2025-03-26","2024-11-05","2024-10-07"],z="2.0",fe=y([t(),f().int()]),we=t(),Je=r({progressToken:n(fe)}).passthrough(),x=r({_meta:n(Je)}).passthrough(),S=r({method:t(),params:n(x)}),q=r({_meta:n(r({}).passthrough())}).passthrough(),b=r({method:t(),params:n(q)}),C=r({_meta:n(r({}).passthrough())}).passthrough(),V=y([t(),f().int()]),Re=r({jsonrpc:u(z),id:V}).merge(S).strict(),Co=e=>Re.safeParse(e).success,ye=r({jsonrpc:u(z)}).merge(b).strict(),To=e=>ye.safeParse(e).success,Se=r({jsonrpc:u(z),id:V,result:C}).strict(),bo=e=>Se.safeParse(e).success;var me;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",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"})(me||(me={}));const ve=r({jsonrpc:u(z),id:V,error:r({code:f().int(),message:t(),data:n(O())})}).strict(),Po=e=>ve.safeParse(e).success,ko=y([Re,ye,Se,ve]),xe=C.strict(),Ce=b.extend({method:u("notifications/cancelled"),params:q.extend({requestId:V,reason:t().optional()})}),We=r({src:t(),mimeType:n(t()),sizes:n(i(t()))}).passthrough(),A=r({icons:i(We).optional()}).passthrough(),M=r({name:t(),title:n(t())}).passthrough(),Te=M.extend({version:t(),websiteUrl:n(t())}).merge(A),Be=r({experimental:n(r({}).passthrough()),sampling:n(r({}).passthrough()),elicitation:n(r({}).passthrough()),roots:n(r({listChanged:n(_())}).passthrough())}).passthrough(),Ge=S.extend({method:u("initialize"),params:x.extend({protocolVersion:t(),capabilities:Be,clientInfo:Te})}),Ze=r({experimental:n(r({}).passthrough()),logging:n(r({}).passthrough()),completions:n(r({}).passthrough()),prompts:n(r({listChanged:n(_())}).passthrough()),resources:n(r({subscribe:n(_()),listChanged:n(_())}).passthrough()),tools:n(r({listChanged:n(_())}).passthrough())}).passthrough(),Ye=C.extend({protocolVersion:t(),capabilities:Ze,serverInfo:Te,instructions:n(t())}),be=b.extend({method:u("notifications/initialized")}),Uo=e=>be.safeParse(e).success,Pe=S.extend({method:u("ping")}),Ke=r({progress:f(),total:n(f()),message:n(t())}).passthrough(),ke=b.extend({method:u("notifications/progress"),params:q.merge(Ke).extend({progressToken:fe})}),H=S.extend({params:x.extend({cursor:n(we)}).optional()}),D=C.extend({nextCursor:n(we)}),Ue=r({uri:t(),mimeType:n(t()),_meta:n(r({}).passthrough())}).passthrough(),Le=Ue.extend({text:t()}),ie=t().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Ee=Ue.extend({blob:ie}),Oe=M.extend({uri:t(),description:n(t()),mimeType:n(t()),_meta:n(r({}).passthrough())}).merge(A),Qe=M.extend({uriTemplate:t(),description:n(t()),mimeType:n(t()),_meta:n(r({}).passthrough())}).merge(A),Xe=H.extend({method:u("resources/list")}),Fe=D.extend({resources:i(Oe)}),et=H.extend({method:u("resources/templates/list")}),tt=D.extend({resourceTemplates:i(Qe)}),ot=S.extend({method:u("resources/read"),params:x.extend({uri:t()})}),nt=C.extend({contents:i(y([Le,Ee]))}),st=b.extend({method:u("notifications/resources/list_changed")}),rt=S.extend({method:u("resources/subscribe"),params:x.extend({uri:t()})}),at=S.extend({method:u("resources/unsubscribe"),params:x.extend({uri:t()})}),it=b.extend({method:u("notifications/resources/updated"),params:q.extend({uri:t()})}),ct=r({name:t(),description:n(t()),required:n(_())}).passthrough(),ut=M.extend({description:n(t()),arguments:n(i(ct)),_meta:n(r({}).passthrough())}).merge(A),lt=H.extend({method:u("prompts/list")}),pt=D.extend({prompts:i(ut)}),dt=S.extend({method:u("prompts/get"),params:x.extend({name:t(),arguments:n(I(t()))})}),ce=r({type:u("text"),text:t(),_meta:n(r({}).passthrough())}).passthrough(),ue=r({type:u("image"),data:ie,mimeType:t(),_meta:n(r({}).passthrough())}).passthrough(),le=r({type:u("audio"),data:ie,mimeType:t(),_meta:n(r({}).passthrough())}).passthrough(),ht=r({type:u("resource"),resource:y([Le,Ee]),_meta:n(r({}).passthrough())}).passthrough(),mt=Oe.extend({type:u("resource_link")}),Ie=y([ce,ue,le,mt,ht]),_t=r({role:k(["user","assistant"]),content:Ie}).passthrough(),gt=C.extend({description:n(t()),messages:i(_t)}),ft=b.extend({method:u("notifications/prompts/list_changed")}),wt=r({title:n(t()),readOnlyHint:n(_()),destructiveHint:n(_()),idempotentHint:n(_()),openWorldHint:n(_())}).passthrough(),Rt=M.extend({description:n(t()),inputSchema:r({type:u("object"),properties:n(r({}).passthrough()),required:n(i(t()))}).passthrough(),outputSchema:n(r({type:u("object"),properties:n(r({}).passthrough()),required:n(i(t()))}).passthrough()),annotations:n(wt),_meta:n(r({}).passthrough())}).merge(A),yt=H.extend({method:u("tools/list")}),St=D.extend({tools:i(Rt)}),qe=C.extend({content:i(Ie).default([]),structuredContent:r({}).passthrough().optional(),isError:n(_())});qe.or(C.extend({toolResult:O()}));const vt=S.extend({method:u("tools/call"),params:x.extend({name:t(),arguments:n(I(O()))})}),xt=b.extend({method:u("notifications/tools/list_changed")}),Ae=k(["debug","info","notice","warning","error","critical","alert","emergency"]),Ct=S.extend({method:u("logging/setLevel"),params:x.extend({level:Ae})}),Tt=b.extend({method:u("notifications/message"),params:q.extend({level:Ae,logger:n(t()),data:O()})}),bt=r({name:t().optional()}).passthrough(),Pt=r({hints:n(i(bt)),costPriority:n(f().min(0).max(1)),speedPriority:n(f().min(0).max(1)),intelligencePriority:n(f().min(0).max(1))}).passthrough(),kt=r({role:k(["user","assistant"]),content:y([ce,ue,le])}).passthrough(),Ut=S.extend({method:u("sampling/createMessage"),params:x.extend({messages:i(kt),systemPrompt:n(t()),includeContext:n(k(["none","thisServer","allServers"])),temperature:n(f()),maxTokens:f().int(),stopSequences:n(i(t())),metadata:n(r({}).passthrough()),modelPreferences:n(Pt)})}),Lt=C.extend({model:t(),stopReason:n(k(["endTurn","stopSequence","maxTokens"]).or(t())),role:k(["user","assistant"]),content:ze("type",[ce,ue,le])}),Et=r({type:u("boolean"),title:n(t()),description:n(t()),default:n(_())}).passthrough(),Ot=r({type:u("string"),title:n(t()),description:n(t()),minLength:n(f()),maxLength:n(f()),format:n(k(["email","uri","date","date-time"]))}).passthrough(),It=r({type:k(["number","integer"]),title:n(t()),description:n(t()),minimum:n(f()),maximum:n(f())}).passthrough(),qt=r({type:u("string"),title:n(t()),description:n(t()),enum:i(t()),enumNames:n(i(t()))}).passthrough(),At=y([Et,Ot,It,qt]),Mt=S.extend({method:u("elicitation/create"),params:x.extend({message:t(),requestedSchema:r({type:u("object"),properties:I(t(),At),required:n(i(t()))}).passthrough()})}),Nt=C.extend({action:k(["accept","decline","cancel"]),content:n(I(t(),O()))}),jt=r({type:u("ref/resource"),uri:t()}).passthrough(),$t=r({type:u("ref/prompt"),name:t()}).passthrough(),zt=S.extend({method:u("completion/complete"),params:x.extend({ref:y([$t,jt]),argument:r({name:t(),value:t()}).passthrough(),context:n(r({arguments:n(I(t(),t()))}))})}),Vt=C.extend({completion:r({values:i(t()).max(100),total:n(f().int()),hasMore:n(_())}).passthrough()}),Ht=r({uri:t().startsWith("file://"),name:n(t()),_meta:n(r({}).passthrough())}).passthrough(),Dt=S.extend({method:u("roots/list")}),Jt=C.extend({roots:i(Ht)}),Wt=b.extend({method:u("notifications/roots/list_changed")});y([Pe,Ge,zt,Ct,dt,lt,Xe,et,ot,rt,at,vt,yt]);y([Ce,ke,be,Wt]);y([xe,Lt,Nt,Jt]);y([Pe,Ut,Mt,Dt]);y([Ce,ke,Tt,it,st,xt,ft]);y([xe,Ye,Vt,gt,pt,Fe,tt,nt,qe,St]);class Lo extends Error{constructor(o,a,s){super(`MCP error ${o}: ${a}`),this.code=o,this.data=s,this.name="McpError"}}let pe;pe=globalThis.crypto;async function Bt(e){return(await pe).getRandomValues(new Uint8Array(e))}async function Gt(e){const o="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",a=Math.pow(2,8)-Math.pow(2,8)%o.length;let s="";for(;s.length<e;){const c=await Bt(e-s.length);for(const p of c)p<a&&(s+=o[p%o.length])}return s}async function Zt(e){return await Gt(e)}async function Yt(e){const o=await(await pe).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(o))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Kt(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;const o=await Zt(e),a=await Yt(o);return{code_verifier:o,code_challenge:a}}const w=t().url().superRefine((e,o)=>{if(!URL.canParse(e))return o.addIssue({code:He.custom,message:"URL must be parseable",fatal:!0}),De}).refine(e=>{const o=new URL(e);return o.protocol!=="javascript:"&&o.protocol!=="data:"&&o.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Qt=r({resource:t().url(),authorization_servers:i(w).optional(),jwks_uri:t().url().optional(),scopes_supported:i(t()).optional(),bearer_methods_supported:i(t()).optional(),resource_signing_alg_values_supported:i(t()).optional(),resource_name:t().optional(),resource_documentation:t().optional(),resource_policy_uri:t().url().optional(),resource_tos_uri:t().url().optional(),tls_client_certificate_bound_access_tokens:_().optional(),authorization_details_types_supported:i(t()).optional(),dpop_signing_alg_values_supported:i(t()).optional(),dpop_bound_access_tokens_required:_().optional()}).passthrough(),Me=r({issuer:t(),authorization_endpoint:w,token_endpoint:w,registration_endpoint:w.optional(),scopes_supported:i(t()).optional(),response_types_supported:i(t()),response_modes_supported:i(t()).optional(),grant_types_supported:i(t()).optional(),token_endpoint_auth_methods_supported:i(t()).optional(),token_endpoint_auth_signing_alg_values_supported:i(t()).optional(),service_documentation:w.optional(),revocation_endpoint:w.optional(),revocation_endpoint_auth_methods_supported:i(t()).optional(),revocation_endpoint_auth_signing_alg_values_supported:i(t()).optional(),introspection_endpoint:t().optional(),introspection_endpoint_auth_methods_supported:i(t()).optional(),introspection_endpoint_auth_signing_alg_values_supported:i(t()).optional(),code_challenge_methods_supported:i(t()).optional()}).passthrough(),Xt=r({issuer:t(),authorization_endpoint:w,token_endpoint:w,userinfo_endpoint:w.optional(),jwks_uri:w,registration_endpoint:w.optional(),scopes_supported:i(t()).optional(),response_types_supported:i(t()),response_modes_supported:i(t()).optional(),grant_types_supported:i(t()).optional(),acr_values_supported:i(t()).optional(),subject_types_supported:i(t()),id_token_signing_alg_values_supported:i(t()),id_token_encryption_alg_values_supported:i(t()).optional(),id_token_encryption_enc_values_supported:i(t()).optional(),userinfo_signing_alg_values_supported:i(t()).optional(),userinfo_encryption_alg_values_supported:i(t()).optional(),userinfo_encryption_enc_values_supported:i(t()).optional(),request_object_signing_alg_values_supported:i(t()).optional(),request_object_encryption_alg_values_supported:i(t()).optional(),request_object_encryption_enc_values_supported:i(t()).optional(),token_endpoint_auth_methods_supported:i(t()).optional(),token_endpoint_auth_signing_alg_values_supported:i(t()).optional(),display_values_supported:i(t()).optional(),claim_types_supported:i(t()).optional(),claims_supported:i(t()).optional(),service_documentation:t().optional(),claims_locales_supported:i(t()).optional(),ui_locales_supported:i(t()).optional(),claims_parameter_supported:_().optional(),request_parameter_supported:_().optional(),request_uri_parameter_supported:_().optional(),require_request_uri_registration:_().optional(),op_policy_uri:w.optional(),op_tos_uri:w.optional()}).passthrough(),Ft=Xt.merge(Me.pick({code_challenge_methods_supported:!0})),Ne=r({access_token:t(),id_token:t().optional(),token_type:t(),expires_in:f().optional(),scope:t().optional(),refresh_token:t().optional()}).strip(),eo=r({error:t(),error_description:t().optional(),error_uri:t().optional()}),_e=w.optional().or(u("").transform(()=>{})),to=r({redirect_uris:i(w),token_endpoint_auth_method:t().optional(),grant_types:i(t()).optional(),response_types:i(t()).optional(),client_name:t().optional(),client_uri:w.optional(),logo_uri:_e,scope:t().optional(),contacts:i(t()).optional(),tos_uri:_e,policy_uri:t().optional(),jwks_uri:w.optional(),jwks:Ve().optional(),software_id:t().optional(),software_version:t().optional(),software_statement:t().optional()}).strip(),oo=r({client_id:t(),client_secret:t().optional(),client_id_issued_at:f().optional(),client_secret_expires_at:f().optional()}).strip(),no=to.merge(oo);r({error:t(),error_description:t().optional()}).strip();r({token:t(),token_type_hint:t().optional()}).strip();function so(e){const o=typeof e=="string"?new URL(e):new URL(e.href);return o.hash="",o}function ro({requestedResource:e,configuredResource:o}){const a=typeof e=="string"?new URL(e):new URL(e.href),s=typeof o=="string"?new URL(o):new URL(o.href);if(a.origin!==s.origin||a.pathname.length<s.pathname.length)return!1;const c=a.pathname.endsWith("/")?a.pathname:a.pathname+"/",p=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return c.startsWith(p)}class R extends Error{constructor(o,a){super(o),this.errorUri=a,this.name=this.constructor.name}toResponseObject(){const o={error:this.errorCode,error_description:this.message};return this.errorUri&&(o.error_uri=this.errorUri),o}get errorCode(){return this.constructor.errorCode}}class Z extends R{}Z.errorCode="invalid_request";class N extends R{}N.errorCode="invalid_client";class j extends R{}j.errorCode="invalid_grant";class $ extends R{}$.errorCode="unauthorized_client";class Y extends R{}Y.errorCode="unsupported_grant_type";class K extends R{}K.errorCode="invalid_scope";class Q extends R{}Q.errorCode="access_denied";class E extends R{}E.errorCode="server_error";class X extends R{}X.errorCode="temporarily_unavailable";class F extends R{}F.errorCode="unsupported_response_type";class ee extends R{}ee.errorCode="unsupported_token_type";class te extends R{}te.errorCode="invalid_token";class oe extends R{}oe.errorCode="method_not_allowed";class ne extends R{}ne.errorCode="too_many_requests";class se extends R{}se.errorCode="invalid_client_metadata";class re extends R{}re.errorCode="insufficient_scope";const ao={[Z.errorCode]:Z,[N.errorCode]:N,[j.errorCode]:j,[$.errorCode]:$,[Y.errorCode]:Y,[K.errorCode]:K,[Q.errorCode]:Q,[E.errorCode]:E,[X.errorCode]:X,[F.errorCode]:F,[ee.errorCode]:ee,[te.errorCode]:te,[oe.errorCode]:oe,[ne.errorCode]:ne,[se.errorCode]:se,[re.errorCode]:re};class Eo extends Error{constructor(o){super(o??"Unauthorized")}}const W="code",B="S256";function je(e,o){const a=e.client_secret!==void 0;return o.length===0?a?"client_secret_post":"none":a&&o.includes("client_secret_basic")?"client_secret_basic":a&&o.includes("client_secret_post")?"client_secret_post":o.includes("none")?"none":a?"client_secret_post":"none"}function $e(e,o,a,s){const{client_id:c,client_secret:p}=o;switch(e){case"client_secret_basic":io(c,p,a);return;case"client_secret_post":co(c,p,s);return;case"none":uo(c,s);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function io(e,o,a){if(!o)throw new Error("client_secret_basic authentication requires a client_secret");const s=btoa(`${e}:${o}`);a.set("Authorization",`Basic ${s}`)}function co(e,o,a){a.set("client_id",e),o&&a.set("client_secret",o)}function uo(e,o){o.set("client_id",e)}async function de(e){const o=e instanceof Response?e.status:void 0,a=e instanceof Response?await e.text():e;try{const s=eo.parse(JSON.parse(a)),{error:c,error_description:p,error_uri:d}=s,l=ao[c]||E;return new l(p||"",d)}catch(s){const c=`${o?`HTTP ${o}: `:""}Invalid OAuth error response: ${s}. Raw body: ${a}`;return new E(c)}}async function Oo(e,o){var a,s;try{return await G(e,o)}catch(c){if(c instanceof N||c instanceof $)return await((a=e.invalidateCredentials)===null||a===void 0?void 0:a.call(e,"all")),await G(e,o);if(c instanceof j)return await((s=e.invalidateCredentials)===null||s===void 0?void 0:s.call(e,"tokens")),await G(e,o);throw c}}async function G(e,{serverUrl:o,authorizationCode:a,scope:s,resourceMetadataUrl:c,fetchFn:p}){let d,l;try{d=await po(o,{resourceMetadataUrl:c},p),d.authorization_servers&&d.authorization_servers.length>0&&(l=d.authorization_servers[0])}catch{}l||(l=o);const h=await lo(o,e,d),g=await fo(l,{fetchFn:p});let m=await Promise.resolve(e.clientInformation());if(!m){if(a!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const v=await So(l,{metadata:g,clientMetadata:e.clientMetadata,fetchFn:p});await e.saveClientInformation(v),m=v}if(a!==void 0){const v=await e.codeVerifier(),J=await Ro(l,{metadata:g,clientInformation:m,authorizationCode:a,codeVerifier:v,redirectUri:e.redirectUrl,resource:h,addClientAuthentication:e.addClientAuthentication,fetchFn:p});return await e.saveTokens(J),"AUTHORIZED"}const T=await e.tokens();if(T?.refresh_token)try{const v=await yo(l,{metadata:g,clientInformation:m,refreshToken:T.refresh_token,resource:h,addClientAuthentication:e.addClientAuthentication,fetchFn:p});return await e.saveTokens(v),"AUTHORIZED"}catch(v){if(!(!(v instanceof R)||v instanceof E))throw v}const P=e.state?await e.state():void 0,{authorizationUrl:U,codeVerifier:L}=await wo(l,{metadata:g,clientInformation:m,state:P,redirectUrl:e.redirectUrl,scope:s||e.clientMetadata.scope,resource:h});return await e.saveCodeVerifier(L),await e.redirectToAuthorization(U),"REDIRECT"}async function lo(e,o,a){const s=so(e);if(o.validateResourceURL)return await o.validateResourceURL(s,a?.resource);if(a){if(!ro({requestedResource:s,configuredResource:a.resource}))throw new Error(`Protected resource ${a.resource} does not match expected ${s} (or origin)`);return new URL(a.resource)}}function Io(e){const o=e.headers.get("WWW-Authenticate");if(!o)return;const[a,s]=o.split(" ");if(a.toLowerCase()!=="bearer"||!s)return;const p=/resource_metadata="([^"]*)"/.exec(o);if(p)try{return new URL(p[1])}catch{return}}async function po(e,o,a=fetch){const s=await _o(e,"oauth-protected-resource",a,{protocolVersion:o?.protocolVersion,metadataUrl:o?.resourceMetadataUrl});if(!s||s.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!s.ok)throw new Error(`HTTP ${s.status} trying to load well-known OAuth protected resource metadata.`);return Qt.parse(await s.json())}async function he(e,o,a=fetch){try{return await a(e,{headers:o})}catch(s){if(s instanceof TypeError)return o?he(e,void 0,a):void 0;throw s}}function ho(e,o="",a={}){return o.endsWith("/")&&(o=o.slice(0,-1)),a.prependPathname?`${o}/.well-known/${e}`:`/.well-known/${e}${o}`}async function ge(e,o,a=fetch){return await he(e,{"MCP-Protocol-Version":o},a)}function mo(e,o){return!e||e.status>=400&&e.status<500&&o!=="/"}async function _o(e,o,a,s){var c,p;const d=new URL(e),l=(c=s?.protocolVersion)!==null&&c!==void 0?c:ae;let h;if(s?.metadataUrl)h=new URL(s.metadataUrl);else{const m=ho(o,d.pathname);h=new URL(m,(p=s?.metadataServerUrl)!==null&&p!==void 0?p:d),h.search=d.search}let g=await ge(h,l,a);if(!s?.metadataUrl&&mo(g,d.pathname)){const m=new URL(`/.well-known/${o}`,d);g=await ge(m,l,a)}return g}function go(e){const o=typeof e=="string"?new URL(e):e,a=o.pathname!=="/",s=[];if(!a)return s.push({url:new URL("/.well-known/oauth-authorization-server",o.origin),type:"oauth"}),s.push({url:new URL("/.well-known/openid-configuration",o.origin),type:"oidc"}),s;let c=o.pathname;return c.endsWith("/")&&(c=c.slice(0,-1)),s.push({url:new URL(`/.well-known/oauth-authorization-server${c}`,o.origin),type:"oauth"}),s.push({url:new URL("/.well-known/oauth-authorization-server",o.origin),type:"oauth"}),s.push({url:new URL(`/.well-known/openid-configuration${c}`,o.origin),type:"oidc"}),s.push({url:new URL(`${c}/.well-known/openid-configuration`,o.origin),type:"oidc"}),s}async function fo(e,{fetchFn:o=fetch,protocolVersion:a=ae}={}){const s={"MCP-Protocol-Version":a,Accept:"application/json"},c=go(e);for(const{url:p,type:d}of c){const l=await he(p,s,o);if(l){if(!l.ok){if(l.status>=400&&l.status<500)continue;throw new Error(`HTTP ${l.status} trying to load ${d==="oauth"?"OAuth":"OpenID provider"} metadata from ${p}`)}return d==="oauth"?Me.parse(await l.json()):Ft.parse(await l.json())}}}async function wo(e,{metadata:o,clientInformation:a,redirectUrl:s,scope:c,state:p,resource:d}){let l;if(o){if(l=new URL(o.authorization_endpoint),!o.response_types_supported.includes(W))throw new Error(`Incompatible auth server: does not support response type ${W}`);if(o.code_challenge_methods_supported&&!o.code_challenge_methods_supported.includes(B))throw new Error(`Incompatible auth server: does not support code challenge method ${B}`)}else l=new URL("/authorize",e);const h=await Kt(),g=h.code_verifier,m=h.code_challenge;return l.searchParams.set("response_type",W),l.searchParams.set("client_id",a.client_id),l.searchParams.set("code_challenge",m),l.searchParams.set("code_challenge_method",B),l.searchParams.set("redirect_uri",String(s)),p&&l.searchParams.set("state",p),c&&l.searchParams.set("scope",c),c?.includes("offline_access")&&l.searchParams.append("prompt","consent"),d&&l.searchParams.set("resource",d.href),{authorizationUrl:l,codeVerifier:g}}async function Ro(e,{metadata:o,clientInformation:a,authorizationCode:s,codeVerifier:c,redirectUri:p,resource:d,addClientAuthentication:l,fetchFn:h}){var g;const m="authorization_code",T=o?.token_endpoint?new URL(o.token_endpoint):new URL("/token",e);if(o?.grant_types_supported&&!o.grant_types_supported.includes(m))throw new Error(`Incompatible auth server: does not support grant type ${m}`);const P=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),U=new URLSearchParams({grant_type:m,code:s,code_verifier:c,redirect_uri:String(p)});if(l)l(P,U,e,o);else{const v=(g=o?.token_endpoint_auth_methods_supported)!==null&&g!==void 0?g:[],J=je(a,v);$e(J,a,P,U)}d&&U.set("resource",d.href);const L=await(h??fetch)(T,{method:"POST",headers:P,body:U});if(!L.ok)throw await de(L);return Ne.parse(await L.json())}async function yo(e,{metadata:o,clientInformation:a,refreshToken:s,resource:c,addClientAuthentication:p,fetchFn:d}){var l;const h="refresh_token";let g;if(o){if(g=new URL(o.token_endpoint),o.grant_types_supported&&!o.grant_types_supported.includes(h))throw new Error(`Incompatible auth server: does not support grant type ${h}`)}else g=new URL("/token",e);const m=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),T=new URLSearchParams({grant_type:h,refresh_token:s});if(p)p(m,T,e,o);else{const U=(l=o?.token_endpoint_auth_methods_supported)!==null&&l!==void 0?l:[],L=je(a,U);$e(L,a,m,T)}c&&T.set("resource",c.href);const P=await(d??fetch)(g,{method:"POST",headers:m,body:T});if(!P.ok)throw await de(P);return Ne.parse({refresh_token:s,...await P.json()})}async function So(e,{metadata:o,clientMetadata:a,fetchFn:s}){let c;if(o){if(!o.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");c=new URL(o.registration_endpoint)}else c=new URL("/register",e);const p=await(s??fetch)(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!p.ok)throw await de(p);return no.parse(await p.json())}export{qe as C,me as E,gt as G,Ye as I,ko as J,Fe as L,Lo as M,ke as P,nt as R,xo as S,Eo as U,Oo as a,pt as b,St as c,Ce as d,Pe as e,Po as f,Co as g,To as h,bo as i,ae as j,xe as k,Vt as l,tt as m,Io as n,Uo as o};
1
+ import{bs as y,aq as t,bt as f,ap as r,bZ as n,bp as u,bm as O,au as i,aw as _,av as I,bl as k,b_ as ze,b$ as Ve,c0 as He,br as De}from"./index-kuMaGV9U.js";const ae="2025-06-18",xo=[ae,"2025-03-26","2024-11-05","2024-10-07"],z="2.0",fe=y([t(),f().int()]),we=t(),Je=r({progressToken:n(fe)}).passthrough(),x=r({_meta:n(Je)}).passthrough(),S=r({method:t(),params:n(x)}),q=r({_meta:n(r({}).passthrough())}).passthrough(),P=r({method:t(),params:n(q)}),C=r({_meta:n(r({}).passthrough())}).passthrough(),V=y([t(),f().int()]),Re=r({jsonrpc:u(z),id:V}).merge(S).strict(),Co=e=>Re.safeParse(e).success,ye=r({jsonrpc:u(z)}).merge(P).strict(),To=e=>ye.safeParse(e).success,Se=r({jsonrpc:u(z),id:V,result:C}).strict(),Po=e=>Se.safeParse(e).success;var me;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",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"})(me||(me={}));const ve=r({jsonrpc:u(z),id:V,error:r({code:f().int(),message:t(),data:n(O())})}).strict(),bo=e=>ve.safeParse(e).success,ko=y([Re,ye,Se,ve]),xe=C.strict(),Ce=P.extend({method:u("notifications/cancelled"),params:q.extend({requestId:V,reason:t().optional()})}),We=r({src:t(),mimeType:n(t()),sizes:n(i(t()))}).passthrough(),A=r({icons:i(We).optional()}).passthrough(),M=r({name:t(),title:n(t())}).passthrough(),Te=M.extend({version:t(),websiteUrl:n(t())}).merge(A),Be=r({experimental:n(r({}).passthrough()),sampling:n(r({}).passthrough()),elicitation:n(r({}).passthrough()),roots:n(r({listChanged:n(_())}).passthrough())}).passthrough(),Ge=S.extend({method:u("initialize"),params:x.extend({protocolVersion:t(),capabilities:Be,clientInfo:Te})}),Ze=r({experimental:n(r({}).passthrough()),logging:n(r({}).passthrough()),completions:n(r({}).passthrough()),prompts:n(r({listChanged:n(_())}).passthrough()),resources:n(r({subscribe:n(_()),listChanged:n(_())}).passthrough()),tools:n(r({listChanged:n(_())}).passthrough())}).passthrough(),Ye=C.extend({protocolVersion:t(),capabilities:Ze,serverInfo:Te,instructions:n(t())}),Pe=P.extend({method:u("notifications/initialized")}),Uo=e=>Pe.safeParse(e).success,be=S.extend({method:u("ping")}),Ke=r({progress:f(),total:n(f()),message:n(t())}).passthrough(),ke=P.extend({method:u("notifications/progress"),params:q.merge(Ke).extend({progressToken:fe})}),H=S.extend({params:x.extend({cursor:n(we)}).optional()}),D=C.extend({nextCursor:n(we)}),Ue=r({uri:t(),mimeType:n(t()),_meta:n(r({}).passthrough())}).passthrough(),Le=Ue.extend({text:t()}),ie=t().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Ee=Ue.extend({blob:ie}),Oe=M.extend({uri:t(),description:n(t()),mimeType:n(t()),_meta:n(r({}).passthrough())}).merge(A),Qe=M.extend({uriTemplate:t(),description:n(t()),mimeType:n(t()),_meta:n(r({}).passthrough())}).merge(A),Xe=H.extend({method:u("resources/list")}),Fe=D.extend({resources:i(Oe)}),et=H.extend({method:u("resources/templates/list")}),tt=D.extend({resourceTemplates:i(Qe)}),ot=S.extend({method:u("resources/read"),params:x.extend({uri:t()})}),nt=C.extend({contents:i(y([Le,Ee]))}),st=P.extend({method:u("notifications/resources/list_changed")}),rt=S.extend({method:u("resources/subscribe"),params:x.extend({uri:t()})}),at=S.extend({method:u("resources/unsubscribe"),params:x.extend({uri:t()})}),it=P.extend({method:u("notifications/resources/updated"),params:q.extend({uri:t()})}),ct=r({name:t(),description:n(t()),required:n(_())}).passthrough(),ut=M.extend({description:n(t()),arguments:n(i(ct)),_meta:n(r({}).passthrough())}).merge(A),lt=H.extend({method:u("prompts/list")}),pt=D.extend({prompts:i(ut)}),dt=S.extend({method:u("prompts/get"),params:x.extend({name:t(),arguments:n(I(t()))})}),ce=r({type:u("text"),text:t(),_meta:n(r({}).passthrough())}).passthrough(),ue=r({type:u("image"),data:ie,mimeType:t(),_meta:n(r({}).passthrough())}).passthrough(),le=r({type:u("audio"),data:ie,mimeType:t(),_meta:n(r({}).passthrough())}).passthrough(),ht=r({type:u("resource"),resource:y([Le,Ee]),_meta:n(r({}).passthrough())}).passthrough(),mt=Oe.extend({type:u("resource_link")}),Ie=y([ce,ue,le,mt,ht]),_t=r({role:k(["user","assistant"]),content:Ie}).passthrough(),gt=C.extend({description:n(t()),messages:i(_t)}),ft=P.extend({method:u("notifications/prompts/list_changed")}),wt=r({title:n(t()),readOnlyHint:n(_()),destructiveHint:n(_()),idempotentHint:n(_()),openWorldHint:n(_())}).passthrough(),Rt=M.extend({description:n(t()),inputSchema:r({type:u("object"),properties:n(r({}).passthrough()),required:n(i(t()))}).passthrough(),outputSchema:n(r({type:u("object"),properties:n(r({}).passthrough()),required:n(i(t()))}).passthrough()),annotations:n(wt),_meta:n(r({}).passthrough())}).merge(A),yt=H.extend({method:u("tools/list")}),St=D.extend({tools:i(Rt)}),qe=C.extend({content:i(Ie).default([]),structuredContent:r({}).passthrough().optional(),isError:n(_())});qe.or(C.extend({toolResult:O()}));const vt=S.extend({method:u("tools/call"),params:x.extend({name:t(),arguments:n(I(O()))})}),xt=P.extend({method:u("notifications/tools/list_changed")}),Ae=k(["debug","info","notice","warning","error","critical","alert","emergency"]),Ct=S.extend({method:u("logging/setLevel"),params:x.extend({level:Ae})}),Tt=P.extend({method:u("notifications/message"),params:q.extend({level:Ae,logger:n(t()),data:O()})}),Pt=r({name:t().optional()}).passthrough(),bt=r({hints:n(i(Pt)),costPriority:n(f().min(0).max(1)),speedPriority:n(f().min(0).max(1)),intelligencePriority:n(f().min(0).max(1))}).passthrough(),kt=r({role:k(["user","assistant"]),content:y([ce,ue,le])}).passthrough(),Ut=S.extend({method:u("sampling/createMessage"),params:x.extend({messages:i(kt),systemPrompt:n(t()),includeContext:n(k(["none","thisServer","allServers"])),temperature:n(f()),maxTokens:f().int(),stopSequences:n(i(t())),metadata:n(r({}).passthrough()),modelPreferences:n(bt)})}),Lt=C.extend({model:t(),stopReason:n(k(["endTurn","stopSequence","maxTokens"]).or(t())),role:k(["user","assistant"]),content:ze("type",[ce,ue,le])}),Et=r({type:u("boolean"),title:n(t()),description:n(t()),default:n(_())}).passthrough(),Ot=r({type:u("string"),title:n(t()),description:n(t()),minLength:n(f()),maxLength:n(f()),format:n(k(["email","uri","date","date-time"]))}).passthrough(),It=r({type:k(["number","integer"]),title:n(t()),description:n(t()),minimum:n(f()),maximum:n(f())}).passthrough(),qt=r({type:u("string"),title:n(t()),description:n(t()),enum:i(t()),enumNames:n(i(t()))}).passthrough(),At=y([Et,Ot,It,qt]),Mt=S.extend({method:u("elicitation/create"),params:x.extend({message:t(),requestedSchema:r({type:u("object"),properties:I(t(),At),required:n(i(t()))}).passthrough()})}),Nt=C.extend({action:k(["accept","decline","cancel"]),content:n(I(t(),O()))}),jt=r({type:u("ref/resource"),uri:t()}).passthrough(),$t=r({type:u("ref/prompt"),name:t()}).passthrough(),zt=S.extend({method:u("completion/complete"),params:x.extend({ref:y([$t,jt]),argument:r({name:t(),value:t()}).passthrough(),context:n(r({arguments:n(I(t(),t()))}))})}),Vt=C.extend({completion:r({values:i(t()).max(100),total:n(f().int()),hasMore:n(_())}).passthrough()}),Ht=r({uri:t().startsWith("file://"),name:n(t()),_meta:n(r({}).passthrough())}).passthrough(),Dt=S.extend({method:u("roots/list")}),Jt=C.extend({roots:i(Ht)}),Wt=P.extend({method:u("notifications/roots/list_changed")});y([be,Ge,zt,Ct,dt,lt,Xe,et,ot,rt,at,vt,yt]);y([Ce,ke,Pe,Wt]);y([xe,Lt,Nt,Jt]);y([be,Ut,Mt,Dt]);y([Ce,ke,Tt,it,st,xt,ft]);y([xe,Ye,Vt,gt,pt,Fe,tt,nt,qe,St]);class Lo extends Error{constructor(o,a,s){super(`MCP error ${o}: ${a}`),this.code=o,this.data=s,this.name="McpError"}}let pe;pe=globalThis.crypto;async function Bt(e){return(await pe).getRandomValues(new Uint8Array(e))}async function Gt(e){const o="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",a=Math.pow(2,8)-Math.pow(2,8)%o.length;let s="";for(;s.length<e;){const c=await Bt(e-s.length);for(const p of c)p<a&&(s+=o[p%o.length])}return s}async function Zt(e){return await Gt(e)}async function Yt(e){const o=await(await pe).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(o))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Kt(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;const o=await Zt(e),a=await Yt(o);return{code_verifier:o,code_challenge:a}}const w=t().url().superRefine((e,o)=>{if(!URL.canParse(e))return o.addIssue({code:Ve.custom,message:"URL must be parseable",fatal:!0}),He}).refine(e=>{const o=new URL(e);return o.protocol!=="javascript:"&&o.protocol!=="data:"&&o.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Qt=r({resource:t().url(),authorization_servers:i(w).optional(),jwks_uri:t().url().optional(),scopes_supported:i(t()).optional(),bearer_methods_supported:i(t()).optional(),resource_signing_alg_values_supported:i(t()).optional(),resource_name:t().optional(),resource_documentation:t().optional(),resource_policy_uri:t().url().optional(),resource_tos_uri:t().url().optional(),tls_client_certificate_bound_access_tokens:_().optional(),authorization_details_types_supported:i(t()).optional(),dpop_signing_alg_values_supported:i(t()).optional(),dpop_bound_access_tokens_required:_().optional()}).passthrough(),Me=r({issuer:t(),authorization_endpoint:w,token_endpoint:w,registration_endpoint:w.optional(),scopes_supported:i(t()).optional(),response_types_supported:i(t()),response_modes_supported:i(t()).optional(),grant_types_supported:i(t()).optional(),token_endpoint_auth_methods_supported:i(t()).optional(),token_endpoint_auth_signing_alg_values_supported:i(t()).optional(),service_documentation:w.optional(),revocation_endpoint:w.optional(),revocation_endpoint_auth_methods_supported:i(t()).optional(),revocation_endpoint_auth_signing_alg_values_supported:i(t()).optional(),introspection_endpoint:t().optional(),introspection_endpoint_auth_methods_supported:i(t()).optional(),introspection_endpoint_auth_signing_alg_values_supported:i(t()).optional(),code_challenge_methods_supported:i(t()).optional()}).passthrough(),Xt=r({issuer:t(),authorization_endpoint:w,token_endpoint:w,userinfo_endpoint:w.optional(),jwks_uri:w,registration_endpoint:w.optional(),scopes_supported:i(t()).optional(),response_types_supported:i(t()),response_modes_supported:i(t()).optional(),grant_types_supported:i(t()).optional(),acr_values_supported:i(t()).optional(),subject_types_supported:i(t()),id_token_signing_alg_values_supported:i(t()),id_token_encryption_alg_values_supported:i(t()).optional(),id_token_encryption_enc_values_supported:i(t()).optional(),userinfo_signing_alg_values_supported:i(t()).optional(),userinfo_encryption_alg_values_supported:i(t()).optional(),userinfo_encryption_enc_values_supported:i(t()).optional(),request_object_signing_alg_values_supported:i(t()).optional(),request_object_encryption_alg_values_supported:i(t()).optional(),request_object_encryption_enc_values_supported:i(t()).optional(),token_endpoint_auth_methods_supported:i(t()).optional(),token_endpoint_auth_signing_alg_values_supported:i(t()).optional(),display_values_supported:i(t()).optional(),claim_types_supported:i(t()).optional(),claims_supported:i(t()).optional(),service_documentation:t().optional(),claims_locales_supported:i(t()).optional(),ui_locales_supported:i(t()).optional(),claims_parameter_supported:_().optional(),request_parameter_supported:_().optional(),request_uri_parameter_supported:_().optional(),require_request_uri_registration:_().optional(),op_policy_uri:w.optional(),op_tos_uri:w.optional()}).passthrough(),Ft=Xt.merge(Me.pick({code_challenge_methods_supported:!0})),Ne=r({access_token:t(),id_token:t().optional(),token_type:t(),expires_in:f().optional(),scope:t().optional(),refresh_token:t().optional()}).strip(),eo=r({error:t(),error_description:t().optional(),error_uri:t().optional()}),_e=w.optional().or(u("").transform(()=>{})),to=r({redirect_uris:i(w),token_endpoint_auth_method:t().optional(),grant_types:i(t()).optional(),response_types:i(t()).optional(),client_name:t().optional(),client_uri:w.optional(),logo_uri:_e,scope:t().optional(),contacts:i(t()).optional(),tos_uri:_e,policy_uri:t().optional(),jwks_uri:w.optional(),jwks:De().optional(),software_id:t().optional(),software_version:t().optional(),software_statement:t().optional()}).strip(),oo=r({client_id:t(),client_secret:t().optional(),client_id_issued_at:f().optional(),client_secret_expires_at:f().optional()}).strip(),no=to.merge(oo);r({error:t(),error_description:t().optional()}).strip();r({token:t(),token_type_hint:t().optional()}).strip();function so(e){const o=typeof e=="string"?new URL(e):new URL(e.href);return o.hash="",o}function ro({requestedResource:e,configuredResource:o}){const a=typeof e=="string"?new URL(e):new URL(e.href),s=typeof o=="string"?new URL(o):new URL(o.href);if(a.origin!==s.origin||a.pathname.length<s.pathname.length)return!1;const c=a.pathname.endsWith("/")?a.pathname:a.pathname+"/",p=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return c.startsWith(p)}class R extends Error{constructor(o,a){super(o),this.errorUri=a,this.name=this.constructor.name}toResponseObject(){const o={error:this.errorCode,error_description:this.message};return this.errorUri&&(o.error_uri=this.errorUri),o}get errorCode(){return this.constructor.errorCode}}class Z extends R{}Z.errorCode="invalid_request";class N extends R{}N.errorCode="invalid_client";class j extends R{}j.errorCode="invalid_grant";class $ extends R{}$.errorCode="unauthorized_client";class Y extends R{}Y.errorCode="unsupported_grant_type";class K extends R{}K.errorCode="invalid_scope";class Q extends R{}Q.errorCode="access_denied";class E extends R{}E.errorCode="server_error";class X extends R{}X.errorCode="temporarily_unavailable";class F extends R{}F.errorCode="unsupported_response_type";class ee extends R{}ee.errorCode="unsupported_token_type";class te extends R{}te.errorCode="invalid_token";class oe extends R{}oe.errorCode="method_not_allowed";class ne extends R{}ne.errorCode="too_many_requests";class se extends R{}se.errorCode="invalid_client_metadata";class re extends R{}re.errorCode="insufficient_scope";const ao={[Z.errorCode]:Z,[N.errorCode]:N,[j.errorCode]:j,[$.errorCode]:$,[Y.errorCode]:Y,[K.errorCode]:K,[Q.errorCode]:Q,[E.errorCode]:E,[X.errorCode]:X,[F.errorCode]:F,[ee.errorCode]:ee,[te.errorCode]:te,[oe.errorCode]:oe,[ne.errorCode]:ne,[se.errorCode]:se,[re.errorCode]:re};class Eo extends Error{constructor(o){super(o??"Unauthorized")}}const W="code",B="S256";function je(e,o){const a=e.client_secret!==void 0;return o.length===0?a?"client_secret_post":"none":a&&o.includes("client_secret_basic")?"client_secret_basic":a&&o.includes("client_secret_post")?"client_secret_post":o.includes("none")?"none":a?"client_secret_post":"none"}function $e(e,o,a,s){const{client_id:c,client_secret:p}=o;switch(e){case"client_secret_basic":io(c,p,a);return;case"client_secret_post":co(c,p,s);return;case"none":uo(c,s);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function io(e,o,a){if(!o)throw new Error("client_secret_basic authentication requires a client_secret");const s=btoa(`${e}:${o}`);a.set("Authorization",`Basic ${s}`)}function co(e,o,a){a.set("client_id",e),o&&a.set("client_secret",o)}function uo(e,o){o.set("client_id",e)}async function de(e){const o=e instanceof Response?e.status:void 0,a=e instanceof Response?await e.text():e;try{const s=eo.parse(JSON.parse(a)),{error:c,error_description:p,error_uri:d}=s,l=ao[c]||E;return new l(p||"",d)}catch(s){const c=`${o?`HTTP ${o}: `:""}Invalid OAuth error response: ${s}. Raw body: ${a}`;return new E(c)}}async function Oo(e,o){var a,s;try{return await G(e,o)}catch(c){if(c instanceof N||c instanceof $)return await((a=e.invalidateCredentials)===null||a===void 0?void 0:a.call(e,"all")),await G(e,o);if(c instanceof j)return await((s=e.invalidateCredentials)===null||s===void 0?void 0:s.call(e,"tokens")),await G(e,o);throw c}}async function G(e,{serverUrl:o,authorizationCode:a,scope:s,resourceMetadataUrl:c,fetchFn:p}){let d,l;try{d=await po(o,{resourceMetadataUrl:c},p),d.authorization_servers&&d.authorization_servers.length>0&&(l=d.authorization_servers[0])}catch{}l||(l=o);const h=await lo(o,e,d),g=await fo(l,{fetchFn:p});let m=await Promise.resolve(e.clientInformation());if(!m){if(a!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const v=await So(l,{metadata:g,clientMetadata:e.clientMetadata,fetchFn:p});await e.saveClientInformation(v),m=v}if(a!==void 0){const v=await e.codeVerifier(),J=await Ro(l,{metadata:g,clientInformation:m,authorizationCode:a,codeVerifier:v,redirectUri:e.redirectUrl,resource:h,addClientAuthentication:e.addClientAuthentication,fetchFn:p});return await e.saveTokens(J),"AUTHORIZED"}const T=await e.tokens();if(T?.refresh_token)try{const v=await yo(l,{metadata:g,clientInformation:m,refreshToken:T.refresh_token,resource:h,addClientAuthentication:e.addClientAuthentication,fetchFn:p});return await e.saveTokens(v),"AUTHORIZED"}catch(v){if(!(!(v instanceof R)||v instanceof E))throw v}const b=e.state?await e.state():void 0,{authorizationUrl:U,codeVerifier:L}=await wo(l,{metadata:g,clientInformation:m,state:b,redirectUrl:e.redirectUrl,scope:s||e.clientMetadata.scope,resource:h});return await e.saveCodeVerifier(L),await e.redirectToAuthorization(U),"REDIRECT"}async function lo(e,o,a){const s=so(e);if(o.validateResourceURL)return await o.validateResourceURL(s,a?.resource);if(a){if(!ro({requestedResource:s,configuredResource:a.resource}))throw new Error(`Protected resource ${a.resource} does not match expected ${s} (or origin)`);return new URL(a.resource)}}function Io(e){const o=e.headers.get("WWW-Authenticate");if(!o)return;const[a,s]=o.split(" ");if(a.toLowerCase()!=="bearer"||!s)return;const p=/resource_metadata="([^"]*)"/.exec(o);if(p)try{return new URL(p[1])}catch{return}}async function po(e,o,a=fetch){const s=await _o(e,"oauth-protected-resource",a,{protocolVersion:o?.protocolVersion,metadataUrl:o?.resourceMetadataUrl});if(!s||s.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!s.ok)throw new Error(`HTTP ${s.status} trying to load well-known OAuth protected resource metadata.`);return Qt.parse(await s.json())}async function he(e,o,a=fetch){try{return await a(e,{headers:o})}catch(s){if(s instanceof TypeError)return o?he(e,void 0,a):void 0;throw s}}function ho(e,o="",a={}){return o.endsWith("/")&&(o=o.slice(0,-1)),a.prependPathname?`${o}/.well-known/${e}`:`/.well-known/${e}${o}`}async function ge(e,o,a=fetch){return await he(e,{"MCP-Protocol-Version":o},a)}function mo(e,o){return!e||e.status>=400&&e.status<500&&o!=="/"}async function _o(e,o,a,s){var c,p;const d=new URL(e),l=(c=s?.protocolVersion)!==null&&c!==void 0?c:ae;let h;if(s?.metadataUrl)h=new URL(s.metadataUrl);else{const m=ho(o,d.pathname);h=new URL(m,(p=s?.metadataServerUrl)!==null&&p!==void 0?p:d),h.search=d.search}let g=await ge(h,l,a);if(!s?.metadataUrl&&mo(g,d.pathname)){const m=new URL(`/.well-known/${o}`,d);g=await ge(m,l,a)}return g}function go(e){const o=typeof e=="string"?new URL(e):e,a=o.pathname!=="/",s=[];if(!a)return s.push({url:new URL("/.well-known/oauth-authorization-server",o.origin),type:"oauth"}),s.push({url:new URL("/.well-known/openid-configuration",o.origin),type:"oidc"}),s;let c=o.pathname;return c.endsWith("/")&&(c=c.slice(0,-1)),s.push({url:new URL(`/.well-known/oauth-authorization-server${c}`,o.origin),type:"oauth"}),s.push({url:new URL("/.well-known/oauth-authorization-server",o.origin),type:"oauth"}),s.push({url:new URL(`/.well-known/openid-configuration${c}`,o.origin),type:"oidc"}),s.push({url:new URL(`${c}/.well-known/openid-configuration`,o.origin),type:"oidc"}),s}async function fo(e,{fetchFn:o=fetch,protocolVersion:a=ae}={}){const s={"MCP-Protocol-Version":a,Accept:"application/json"},c=go(e);for(const{url:p,type:d}of c){const l=await he(p,s,o);if(l){if(!l.ok){if(l.status>=400&&l.status<500)continue;throw new Error(`HTTP ${l.status} trying to load ${d==="oauth"?"OAuth":"OpenID provider"} metadata from ${p}`)}return d==="oauth"?Me.parse(await l.json()):Ft.parse(await l.json())}}}async function wo(e,{metadata:o,clientInformation:a,redirectUrl:s,scope:c,state:p,resource:d}){let l;if(o){if(l=new URL(o.authorization_endpoint),!o.response_types_supported.includes(W))throw new Error(`Incompatible auth server: does not support response type ${W}`);if(o.code_challenge_methods_supported&&!o.code_challenge_methods_supported.includes(B))throw new Error(`Incompatible auth server: does not support code challenge method ${B}`)}else l=new URL("/authorize",e);const h=await Kt(),g=h.code_verifier,m=h.code_challenge;return l.searchParams.set("response_type",W),l.searchParams.set("client_id",a.client_id),l.searchParams.set("code_challenge",m),l.searchParams.set("code_challenge_method",B),l.searchParams.set("redirect_uri",String(s)),p&&l.searchParams.set("state",p),c&&l.searchParams.set("scope",c),c?.includes("offline_access")&&l.searchParams.append("prompt","consent"),d&&l.searchParams.set("resource",d.href),{authorizationUrl:l,codeVerifier:g}}async function Ro(e,{metadata:o,clientInformation:a,authorizationCode:s,codeVerifier:c,redirectUri:p,resource:d,addClientAuthentication:l,fetchFn:h}){var g;const m="authorization_code",T=o?.token_endpoint?new URL(o.token_endpoint):new URL("/token",e);if(o?.grant_types_supported&&!o.grant_types_supported.includes(m))throw new Error(`Incompatible auth server: does not support grant type ${m}`);const b=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),U=new URLSearchParams({grant_type:m,code:s,code_verifier:c,redirect_uri:String(p)});if(l)l(b,U,e,o);else{const v=(g=o?.token_endpoint_auth_methods_supported)!==null&&g!==void 0?g:[],J=je(a,v);$e(J,a,b,U)}d&&U.set("resource",d.href);const L=await(h??fetch)(T,{method:"POST",headers:b,body:U});if(!L.ok)throw await de(L);return Ne.parse(await L.json())}async function yo(e,{metadata:o,clientInformation:a,refreshToken:s,resource:c,addClientAuthentication:p,fetchFn:d}){var l;const h="refresh_token";let g;if(o){if(g=new URL(o.token_endpoint),o.grant_types_supported&&!o.grant_types_supported.includes(h))throw new Error(`Incompatible auth server: does not support grant type ${h}`)}else g=new URL("/token",e);const m=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),T=new URLSearchParams({grant_type:h,refresh_token:s});if(p)p(m,T,e,o);else{const U=(l=o?.token_endpoint_auth_methods_supported)!==null&&l!==void 0?l:[],L=je(a,U);$e(L,a,m,T)}c&&T.set("resource",c.href);const b=await(d??fetch)(g,{method:"POST",headers:m,body:T});if(!b.ok)throw await de(b);return Ne.parse({refresh_token:s,...await b.json()})}async function So(e,{metadata:o,clientMetadata:a,fetchFn:s}){let c;if(o){if(!o.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");c=new URL(o.registration_endpoint)}else c=new URL("/register",e);const p=await(s??fetch)(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!p.ok)throw await de(p);return no.parse(await p.json())}export{Ce as C,me as E,gt as G,Ye as I,ko as J,ae as L,Lo as M,ke as P,nt as R,xo as S,Eo as U,be as a,bo as b,Co as c,To as d,xe as e,Vt as f,pt as g,Fe as h,Po as i,tt as j,qe as k,St as l,Oo as m,Io as n,Uo as o,po as p,fo as q,Ro as r};
@@ -1 +1 @@
1
- import{c as r,d as m,j as n,A as o}from"./index-VCe1FY3E.js";function i(){const e=r.c(3);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t={from:"/auth/$pathname"},e[0]=t):t=e[0];const{pathname:s}=m(t);let a;return e[1]!==s?(a=n.jsx("main",{className:"container mx-auto flex grow flex-col items-center justify-center gap-3 self-center p-4 md:p-6",children:n.jsx(o,{pathname:s})}),e[1]=s,e[2]=a):a=e[2],a}export{i as default};
1
+ import{c as r,d as m,j as n,A as o}from"./index-kuMaGV9U.js";function i(){const e=r.c(3);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t={from:"/auth/$pathname"},e[0]=t):t=e[0];const{pathname:s}=m(t);let a;return e[1]!==s?(a=n.jsx("main",{className:"container mx-auto flex grow flex-col items-center justify-center gap-3 self-center p-4 md:p-6",children:n.jsx(o,{pathname:s})}),e[1]=s,e[2]=a):a=e[2],a}export{i as default};
@@ -1 +1 @@
1
- import{c as k,j as i,r as V,af as R,au as $,av as O,aw as U}from"./index-VCe1FY3E.js";import{c as m}from"./utils-B-QWwgyW.js";import{I as L}from"./icon-Zm7eEeKG.js";function M(r){const e=k.c(8);let s,t;e[0]!==r?({className:s,...t}=r,e[0]=r,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let o;e[3]!==s?(o=m("relative flex size-8 shrink-0 overflow-hidden rounded-full",s),e[3]=s,e[4]=o):o=e[4];let a;return e[5]!==t||e[6]!==o?(a=i.jsx(U,{"data-slot":"avatar",className:o,...t}),e[5]=t,e[6]=o,e[7]=a):a=e[7],a}function T(r){const e=k.c(8);let s,t;e[0]!==r?({className:s,...t}=r,e[0]=r,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let o;e[3]!==s?(o=m("aspect-square size-full",s),e[3]=s,e[4]=o):o=e[4];let a;return e[5]!==t||e[6]!==o?(a=i.jsx($,{"data-slot":"avatar-image",className:o,...t}),e[5]=t,e[6]=o,e[7]=a):a=e[7],a}function _(r){const e=k.c(8);let s,t;e[0]!==r?({className:s,...t}=r,e[0]=r,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let o;e[3]!==s?(o=m("bg-muted flex size-full items-center justify-center rounded-full",s),e[3]=s,e[4]=o):o=e[4];let a;return e[5]!==t||e[6]!==o?(a=i.jsx(O,{"data-slot":"avatar-fallback",className:o,...t}),e[5]=t,e[6]=o,e[7]=a):a=e[7],a}const E=["drop-shadow-lg bg-gradient-to-br from-red-100 to-red-300 text-red-800 shadow-lg shadow-red-300/40 ring-1 ring-red-300/30","drop-shadow-lg bg-gradient-to-br from-lime-100 to-lime-300 text-lime-800 shadow-lg shadow-lime-300/40 ring-1 ring-lime-300/30","drop-shadow-lg bg-gradient-to-br from-emerald-100 to-emerald-300 text-emerald-800 shadow-lg shadow-emerald-300/40 ring-1 ring-emerald-300/30","drop-shadow-lg bg-gradient-to-br from-orange-100 to-orange-300 text-orange-800 shadow-lg shadow-orange-300/40 ring-1 ring-orange-300/30","drop-shadow-lg bg-gradient-to-br from-amber-100 to-amber-300 text-amber-800 shadow-lg shadow-amber-300/40 ring-1 ring-amber-300/30","drop-shadow-lg bg-gradient-to-br from-yellow-100 to-yellow-300 text-yellow-800 shadow-lg shadow-yellow-300/40 ring-1 ring-yellow-300/30","drop-shadow-lg bg-gradient-to-br from-green-100 to-green-300 text-green-800 shadow-lg shadow-green-300/40 ring-1 ring-green-300/30","drop-shadow-lg bg-gradient-to-br from-teal-100 to-teal-300 text-teal-800 shadow-lg shadow-teal-300/40 ring-1 ring-teal-300/30","drop-shadow-lg bg-gradient-to-br from-cyan-100 to-cyan-300 text-cyan-800 shadow-lg shadow-cyan-300/40 ring-1 ring-cyan-300/30","drop-shadow-lg bg-gradient-to-br from-sky-100 to-sky-300 text-sky-800 shadow-lg shadow-sky-300/40 ring-1 ring-sky-300/30","drop-shadow-lg bg-gradient-to-br from-blue-100 to-blue-300 text-blue-800 shadow-lg shadow-blue-300/40 ring-1 ring-blue-300/30","drop-shadow-lg bg-gradient-to-br from-indigo-100 to-indigo-300 text-indigo-800 shadow-lg shadow-indigo-300/40 ring-1 ring-indigo-300/30","drop-shadow-lg bg-gradient-to-br from-violet-100 to-violet-300 text-violet-800 shadow-lg shadow-violet-300/40 ring-1 ring-violet-300/30","drop-shadow-lg bg-gradient-to-br from-purple-100 to-purple-300 text-purple-800 shadow-lg shadow-purple-300/40 ring-1 ring-purple-300/30","drop-shadow-lg bg-gradient-to-br from-fuchsia-100 to-fuchsia-300 text-fuchsia-800 shadow-lg shadow-fuchsia-300/40 ring-1 ring-fuchsia-300/30","drop-shadow-lg bg-gradient-to-br from-pink-100 to-pink-300 text-pink-800 shadow-lg shadow-pink-300/40 ring-1 ring-pink-300/30","drop-shadow-lg bg-gradient-to-br from-rose-100 to-rose-300 text-rose-800 shadow-lg shadow-rose-300/40 ring-1 ring-rose-300/30"],D="drop-shadow-lg text-muted-foreground bg-muted shadow-lg";function W(r){let e=0;for(let t=0;t<r.length;t++)e=r.charCodeAt(t)+((e<<5)-e);const s=Math.abs(e)%E.length;return E[s]}const S=R("border border-border",{variants:{shape:{circle:"rounded-full",square:""},size:{"3xs":"w-3 h-3 text-xs font-semibold","2xs":"w-4 h-4 text-xs font-semibold",xs:"w-6 h-6 text-sm font-semibold",sm:"w-8 h-8 text-lg font-semibold",base:"w-10 h-10 text-2xl font-semibold",lg:"w-12 h-12 text-3xl font-semibold",xl:"w-16 h-16 text-4xl font-semibold","2xl":"w-20 h-20 text-5xl font-semibold","3xl":"w-32 h-32 text-7xl font-semibold"}},compoundVariants:[{shape:"square",size:"xs",class:"rounded-lg"},{shape:"square",size:"sm",class:"rounded-xl"},{shape:"square",size:"base",class:"rounded-xl"},{shape:"square",size:"lg",class:"rounded-xl"},{shape:"square",size:"xl",class:"rounded-2xl"},{shape:"square",size:"2xl",class:"rounded-3xl"},{shape:"square",size:"3xl",class:"rounded-[40px]"}],defaultVariants:{shape:"square",size:"base"}}),B=R("",{variants:{objectFit:{contain:"object-contain",cover:"object-cover"}},defaultVariants:{objectFit:"cover"}}),G=r=>{const e={"3xs":8,"2xs":8,xs:12,sm:16,base:24,lg:28,xl:36,"2xl":48,"3xl":80};return e[r]||e.base};function H(r){const e=k.c(35);let s,t,o,a,n,d,g,l;e[0]!==r?({url:l,fallback:t,shape:a,size:n,objectFit:d,className:s,muted:g,...o}=r,e[0]=r,e[1]=s,e[2]=t,e[3]=o,e[4]=a,e[5]=n,e[6]=d,e[7]=g,e[8]=l):(s=e[1],t=e[2],o=e[3],a=e[4],n=e[5],d=e[6],g=e[7],l=e[8]);const b=a===void 0?"square":a,h=n===void 0?"base":n,u=d===void 0?"cover":d,j=g===void 0?!1:g,[f,x]=V.useState(!1);let I;e:{if(typeof t=="string"){let c;e[9]!==t?(c=t.trim().slice(0,2).toUpperCase(),e[9]=t,e[10]=c):c=e[10],I=c;break e}I=t}const C=I;let z;e:{if(j){z=D;break e}if(typeof t=="string"){let c;e[11]!==t?(c=W(t),e[11]=t,e[12]=c):c=e[12],z=c;break e}z=E[0]}const y=z;let N;e[13]!==l?(N=l?.startsWith("icon://"),e[13]=l,e[14]=N):N=e[14];const p=N;let q;e[15]!==p||e[16]!==l?(q=p?l?.replace("icon://",""):void 0,e[15]=p,e[16]=l,e[17]=q):q=e[17];const A=q;let w;e[18]!==s||e[19]!==b||e[20]!==h?(w=m(S({shape:b,size:h}),s),e[18]=s,e[19]=b,e[20]=h,e[21]=w):w=e[21];let v;e[22]!==y||e[23]!==C||e[24]!==A||e[25]!==f||e[26]!==p||e[27]!==u||e[28]!==h||e[29]!==l?(v=p&&A?i.jsx("div",{className:m("flex items-center justify-center w-full h-full",y),children:i.jsx(L,{name:A,size:G(h)})}):i.jsxs(i.Fragment,{children:[l&&!f&&i.jsx(T,{src:l,loading:"lazy",alt:"Avatar",className:m(B({objectFit:u})),onError:()=>x(!0)}),(!l||f)&&i.jsx(_,{className:m(y,"rounded-none"),children:C})]}),e[22]=y,e[23]=C,e[24]=A,e[25]=f,e[26]=p,e[27]=u,e[28]=h,e[29]=l,e[30]=v):v=e[30];let F;return e[31]!==o||e[32]!==v||e[33]!==w?(F=i.jsx(M,{className:w,...o,children:v}),e[31]=o,e[32]=v,e[33]=w,e[34]=F):F=e[34],F}function J(r){const e=k.c(18);let s,t,o,a,n,d,g,l;e[0]!==r?({shape:a,size:n,url:l,fallback:t,objectFit:d,className:s,muted:g,...o}=r,e[0]=r,e[1]=s,e[2]=t,e[3]=o,e[4]=a,e[5]=n,e[6]=d,e[7]=g,e[8]=l):(s=e[1],t=e[2],o=e[3],a=e[4],n=e[5],d=e[6],g=e[7],l=e[8]);const b=a===void 0?"square":a,h=n===void 0?"base":n,u=d===void 0?"cover":d,j=g===void 0?!1:g,f=h??"base";let x;return e[9]!==s||e[10]!==t||e[11]!==j||e[12]!==u||e[13]!==o||e[14]!==b||e[15]!==f||e[16]!==l?(x=i.jsx(H,{shape:b,url:l,fallback:t,size:f,objectFit:u,className:s,muted:j,...o}),e[9]=s,e[10]=t,e[11]=j,e[12]=u,e[13]=o,e[14]=b,e[15]=f,e[16]=l,e[17]=x):x=e[17],x}J.Skeleton=function({shape:e="square",size:s="base",className:t}){return i.jsx("div",{className:m(S({shape:e,size:s}),"bg-muted animate-pulse",t)})};export{J as A};
1
+ import{c as k,j as i,r as V,af as R,ax as $,ay as O,az as U}from"./index-kuMaGV9U.js";import{c as m}from"./utils-dJ2GyoL3.js";import{I as L}from"./icon-KZI-tyY2.js";function M(r){const e=k.c(8);let s,t;e[0]!==r?({className:s,...t}=r,e[0]=r,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let o;e[3]!==s?(o=m("relative flex size-8 shrink-0 overflow-hidden rounded-full",s),e[3]=s,e[4]=o):o=e[4];let a;return e[5]!==t||e[6]!==o?(a=i.jsx(U,{"data-slot":"avatar",className:o,...t}),e[5]=t,e[6]=o,e[7]=a):a=e[7],a}function T(r){const e=k.c(8);let s,t;e[0]!==r?({className:s,...t}=r,e[0]=r,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let o;e[3]!==s?(o=m("aspect-square size-full",s),e[3]=s,e[4]=o):o=e[4];let a;return e[5]!==t||e[6]!==o?(a=i.jsx($,{"data-slot":"avatar-image",className:o,...t}),e[5]=t,e[6]=o,e[7]=a):a=e[7],a}function _(r){const e=k.c(8);let s,t;e[0]!==r?({className:s,...t}=r,e[0]=r,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let o;e[3]!==s?(o=m("bg-muted flex size-full items-center justify-center rounded-full",s),e[3]=s,e[4]=o):o=e[4];let a;return e[5]!==t||e[6]!==o?(a=i.jsx(O,{"data-slot":"avatar-fallback",className:o,...t}),e[5]=t,e[6]=o,e[7]=a):a=e[7],a}const E=["drop-shadow-lg bg-gradient-to-br from-red-100 to-red-300 text-red-800 shadow-lg shadow-red-300/40 ring-1 ring-red-300/30","drop-shadow-lg bg-gradient-to-br from-lime-100 to-lime-300 text-lime-800 shadow-lg shadow-lime-300/40 ring-1 ring-lime-300/30","drop-shadow-lg bg-gradient-to-br from-emerald-100 to-emerald-300 text-emerald-800 shadow-lg shadow-emerald-300/40 ring-1 ring-emerald-300/30","drop-shadow-lg bg-gradient-to-br from-orange-100 to-orange-300 text-orange-800 shadow-lg shadow-orange-300/40 ring-1 ring-orange-300/30","drop-shadow-lg bg-gradient-to-br from-amber-100 to-amber-300 text-amber-800 shadow-lg shadow-amber-300/40 ring-1 ring-amber-300/30","drop-shadow-lg bg-gradient-to-br from-yellow-100 to-yellow-300 text-yellow-800 shadow-lg shadow-yellow-300/40 ring-1 ring-yellow-300/30","drop-shadow-lg bg-gradient-to-br from-green-100 to-green-300 text-green-800 shadow-lg shadow-green-300/40 ring-1 ring-green-300/30","drop-shadow-lg bg-gradient-to-br from-teal-100 to-teal-300 text-teal-800 shadow-lg shadow-teal-300/40 ring-1 ring-teal-300/30","drop-shadow-lg bg-gradient-to-br from-cyan-100 to-cyan-300 text-cyan-800 shadow-lg shadow-cyan-300/40 ring-1 ring-cyan-300/30","drop-shadow-lg bg-gradient-to-br from-sky-100 to-sky-300 text-sky-800 shadow-lg shadow-sky-300/40 ring-1 ring-sky-300/30","drop-shadow-lg bg-gradient-to-br from-blue-100 to-blue-300 text-blue-800 shadow-lg shadow-blue-300/40 ring-1 ring-blue-300/30","drop-shadow-lg bg-gradient-to-br from-indigo-100 to-indigo-300 text-indigo-800 shadow-lg shadow-indigo-300/40 ring-1 ring-indigo-300/30","drop-shadow-lg bg-gradient-to-br from-violet-100 to-violet-300 text-violet-800 shadow-lg shadow-violet-300/40 ring-1 ring-violet-300/30","drop-shadow-lg bg-gradient-to-br from-purple-100 to-purple-300 text-purple-800 shadow-lg shadow-purple-300/40 ring-1 ring-purple-300/30","drop-shadow-lg bg-gradient-to-br from-fuchsia-100 to-fuchsia-300 text-fuchsia-800 shadow-lg shadow-fuchsia-300/40 ring-1 ring-fuchsia-300/30","drop-shadow-lg bg-gradient-to-br from-pink-100 to-pink-300 text-pink-800 shadow-lg shadow-pink-300/40 ring-1 ring-pink-300/30","drop-shadow-lg bg-gradient-to-br from-rose-100 to-rose-300 text-rose-800 shadow-lg shadow-rose-300/40 ring-1 ring-rose-300/30"],D="drop-shadow-lg text-muted-foreground bg-muted shadow-lg";function W(r){let e=0;for(let t=0;t<r.length;t++)e=r.charCodeAt(t)+((e<<5)-e);const s=Math.abs(e)%E.length;return E[s]}const S=R("border border-border",{variants:{shape:{circle:"rounded-full",square:""},size:{"3xs":"w-3 h-3 text-xs font-semibold","2xs":"w-4 h-4 text-xs font-semibold",xs:"w-6 h-6 text-sm font-semibold",sm:"w-8 h-8 text-lg font-semibold",base:"w-10 h-10 text-2xl font-semibold",lg:"w-12 h-12 text-3xl font-semibold",xl:"w-16 h-16 text-4xl font-semibold","2xl":"w-20 h-20 text-5xl font-semibold","3xl":"w-32 h-32 text-7xl font-semibold"}},compoundVariants:[{shape:"square",size:"xs",class:"rounded-lg"},{shape:"square",size:"sm",class:"rounded-xl"},{shape:"square",size:"base",class:"rounded-xl"},{shape:"square",size:"lg",class:"rounded-xl"},{shape:"square",size:"xl",class:"rounded-2xl"},{shape:"square",size:"2xl",class:"rounded-3xl"},{shape:"square",size:"3xl",class:"rounded-[40px]"}],defaultVariants:{shape:"square",size:"base"}}),B=R("",{variants:{objectFit:{contain:"object-contain",cover:"object-cover"}},defaultVariants:{objectFit:"cover"}}),G=r=>{const e={"3xs":8,"2xs":8,xs:12,sm:16,base:24,lg:28,xl:36,"2xl":48,"3xl":80};return e[r]||e.base};function H(r){const e=k.c(35);let s,t,o,a,n,d,g,l;e[0]!==r?({url:l,fallback:t,shape:a,size:n,objectFit:d,className:s,muted:g,...o}=r,e[0]=r,e[1]=s,e[2]=t,e[3]=o,e[4]=a,e[5]=n,e[6]=d,e[7]=g,e[8]=l):(s=e[1],t=e[2],o=e[3],a=e[4],n=e[5],d=e[6],g=e[7],l=e[8]);const b=a===void 0?"square":a,h=n===void 0?"base":n,u=d===void 0?"cover":d,j=g===void 0?!1:g,[f,x]=V.useState(!1);let I;e:{if(typeof t=="string"){let c;e[9]!==t?(c=t.trim().slice(0,2).toUpperCase(),e[9]=t,e[10]=c):c=e[10],I=c;break e}I=t}const C=I;let z;e:{if(j){z=D;break e}if(typeof t=="string"){let c;e[11]!==t?(c=W(t),e[11]=t,e[12]=c):c=e[12],z=c;break e}z=E[0]}const y=z;let N;e[13]!==l?(N=l?.startsWith("icon://"),e[13]=l,e[14]=N):N=e[14];const p=N;let q;e[15]!==p||e[16]!==l?(q=p?l?.replace("icon://",""):void 0,e[15]=p,e[16]=l,e[17]=q):q=e[17];const A=q;let w;e[18]!==s||e[19]!==b||e[20]!==h?(w=m(S({shape:b,size:h}),s),e[18]=s,e[19]=b,e[20]=h,e[21]=w):w=e[21];let v;e[22]!==y||e[23]!==C||e[24]!==A||e[25]!==f||e[26]!==p||e[27]!==u||e[28]!==h||e[29]!==l?(v=p&&A?i.jsx("div",{className:m("flex items-center justify-center w-full h-full",y),children:i.jsx(L,{name:A,size:G(h)})}):i.jsxs(i.Fragment,{children:[l&&!f&&i.jsx(T,{src:l,loading:"lazy",alt:"Avatar",className:m(B({objectFit:u})),onError:()=>x(!0)}),(!l||f)&&i.jsx(_,{className:m(y,"rounded-none"),children:C})]}),e[22]=y,e[23]=C,e[24]=A,e[25]=f,e[26]=p,e[27]=u,e[28]=h,e[29]=l,e[30]=v):v=e[30];let F;return e[31]!==o||e[32]!==v||e[33]!==w?(F=i.jsx(M,{className:w,...o,children:v}),e[31]=o,e[32]=v,e[33]=w,e[34]=F):F=e[34],F}function J(r){const e=k.c(18);let s,t,o,a,n,d,g,l;e[0]!==r?({shape:a,size:n,url:l,fallback:t,objectFit:d,className:s,muted:g,...o}=r,e[0]=r,e[1]=s,e[2]=t,e[3]=o,e[4]=a,e[5]=n,e[6]=d,e[7]=g,e[8]=l):(s=e[1],t=e[2],o=e[3],a=e[4],n=e[5],d=e[6],g=e[7],l=e[8]);const b=a===void 0?"square":a,h=n===void 0?"base":n,u=d===void 0?"cover":d,j=g===void 0?!1:g,f=h??"base";let x;return e[9]!==s||e[10]!==t||e[11]!==j||e[12]!==u||e[13]!==o||e[14]!==b||e[15]!==f||e[16]!==l?(x=i.jsx(H,{shape:b,url:l,fallback:t,size:f,objectFit:u,className:s,muted:j,...o}),e[9]=s,e[10]=t,e[11]=j,e[12]=u,e[13]=o,e[14]=b,e[15]=f,e[16]=l,e[17]=x):x=e[17],x}J.Skeleton=function({shape:e="square",size:s="base",className:t}){return i.jsx("div",{className:m(S({shape:e,size:s}),"bg-muted animate-pulse",t)})};export{J as A};
@@ -1 +1 @@
1
- import{c as d,af as u,j as l,ag as v}from"./index-VCe1FY3E.js";import{c as g}from"./utils-B-QWwgyW.js";const f=u("inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",success:"border-transparent bg-success text-success-foreground [a&]:hover:bg-success/90 focus-visible:ring-success/20 dark:focus-visible:ring-success/40",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function m(o){const e=d.c(12);let r,s,i,t;e[0]!==o?({className:r,variant:t,asChild:i,...s}=o,e[0]=o,e[1]=r,e[2]=s,e[3]=i,e[4]=t):(r=e[1],s=e[2],i=e[3],t=e[4]);const c=(i===void 0?!1:i)?v:"span";let a;e[5]!==r||e[6]!==t?(a=g(f({variant:t}),r),e[5]=r,e[6]=t,e[7]=a):a=e[7];let n;return e[8]!==c||e[9]!==s||e[10]!==a?(n=l.jsx(c,{"data-slot":"badge",className:a,...s}),e[8]=c,e[9]=s,e[10]=a,e[11]=n):n=e[11],n}export{m as B};
1
+ import{c as d,af as u,j as l,ag as v}from"./index-kuMaGV9U.js";import{c as g}from"./utils-dJ2GyoL3.js";const f=u("inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",success:"border-transparent bg-success text-success-foreground [a&]:hover:bg-success/90 focus-visible:ring-success/20 dark:focus-visible:ring-success/40",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function m(o){const e=d.c(12);let r,s,i,t;e[0]!==o?({className:r,variant:t,asChild:i,...s}=o,e[0]=o,e[1]=r,e[2]=s,e[3]=i,e[4]=t):(r=e[1],s=e[2],i=e[3],t=e[4]);const c=(i===void 0?!1:i)?v:"span";let a;e[5]!==r||e[6]!==t?(a=g(f({variant:t}),r),e[5]=r,e[6]=t,e[7]=a):a=e[7];let n;return e[8]!==c||e[9]!==s||e[10]!==a?(n=l.jsx(c,{"data-slot":"badge",className:a,...s}),e[8]=c,e[9]=s,e[10]=a,e[11]=n):n=e[11],n}export{m as B};
@@ -1 +1 @@
1
- import{bR as p,bS as v,bT as l,bU as g,bV as b,a1 as f,r as u,bW as m,bX as x,c as y,af as O,j as k,ag as C}from"./index-VCe1FY3E.js";import{c as E}from"./utils-B-QWwgyW.js";var M=class extends p{#e;#i=void 0;#t;#s;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const t=this.options;this.options=this.#e.defaultMutationOptions(e),v(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#t,observer:this}),t?.mutationKey&&this.options.mutationKey&&l(t.mutationKey)!==l(this.options.mutationKey)?this.reset():this.#t?.state.status==="pending"&&this.#t.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#t?.removeObserver(this)}onMutationUpdate(e){this.#r(),this.#n(e)}getCurrentResult(){return this.#i}reset(){this.#t?.removeObserver(this),this.#t=void 0,this.#r(),this.#n()}mutate(e,t){return this.#s=t,this.#t?.removeObserver(this),this.#t=this.#e.getMutationCache().build(this.#e,this.options),this.#t.addObserver(this),this.#t.execute(e)}#r(){const e=this.#t?.state??g();this.#i={...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset}}#n(e){b.batch(()=>{if(this.#s&&this.hasListeners()){const t=this.#i.variables,i=this.#i.context,s={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};e?.type==="success"?(this.#s.onSuccess?.(e.data,t,i,s),this.#s.onSettled?.(e.data,null,t,i,s)):e?.type==="error"&&(this.#s.onError?.(e.error,t,i,s),this.#s.onSettled?.(void 0,e.error,t,i,s))}this.listeners.forEach(t=>{t(this.#i)})})}};function K(e,t){const i=f(t),[s]=u.useState(()=>new M(i,e));u.useEffect(()=>{s.setOptions(e)},[s,e]);const r=u.useSyncExternalStore(u.useCallback(n=>s.subscribe(b.batchCalls(n)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),o=u.useCallback((n,d)=>{s.mutate(n,d).catch(m)},[s]);if(r.error&&x(s.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:o,mutateAsync:r.mutate}}const S=O("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive cursor-pointer",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border text-foreground bg-background hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-foreground/80 hover:text-foreground",brand:"bg-brand-green-light text-brand-green-dark hover:bg-brand-green-light/90"},size:{default:"h-10 px-4 py-2 has-[>svg]:px-3",sm:"h-8 gap-1.5 px-3 has-[>svg]:px-2.5",xs:"h-6 gap-1 px-2 text-xs has-[>svg]:px-1.5",lg:"h-10 px-6 has-[>svg]:px-4",icon:"size-10"}},defaultVariants:{variant:"default",size:"default"}});function z(e){const t=y.c(14);let i,s,r,o,n;t[0]!==e?({className:i,variant:n,size:r,asChild:o,...s}=e,t[0]=e,t[1]=i,t[2]=s,t[3]=r,t[4]=o,t[5]=n):(i=t[1],s=t[2],r=t[3],o=t[4],n=t[5]);const c=(o===void 0?!1:o)?C:"button";let a;t[6]!==i||t[7]!==r||t[8]!==n?(a=E(S({variant:n,size:r,className:i})),t[6]=i,t[7]=r,t[8]=n,t[9]=a):a=t[9];let h;return t[10]!==c||t[11]!==s||t[12]!==a?(h=k.jsx(c,{"data-slot":"button",className:a,...s}),t[10]=c,t[11]=s,t[12]=a,t[13]=h):h=t[13],h}export{z as B,S as b,K as u};
1
+ import{bR as p,bS as v,bT as l,bU as g,bV as b,a1 as f,r as u,bW as m,bX as x,c as y,af as O,j as k,ag as C}from"./index-kuMaGV9U.js";import{c as E}from"./utils-dJ2GyoL3.js";var M=class extends p{#e;#i=void 0;#t;#s;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const t=this.options;this.options=this.#e.defaultMutationOptions(e),v(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#t,observer:this}),t?.mutationKey&&this.options.mutationKey&&l(t.mutationKey)!==l(this.options.mutationKey)?this.reset():this.#t?.state.status==="pending"&&this.#t.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#t?.removeObserver(this)}onMutationUpdate(e){this.#r(),this.#n(e)}getCurrentResult(){return this.#i}reset(){this.#t?.removeObserver(this),this.#t=void 0,this.#r(),this.#n()}mutate(e,t){return this.#s=t,this.#t?.removeObserver(this),this.#t=this.#e.getMutationCache().build(this.#e,this.options),this.#t.addObserver(this),this.#t.execute(e)}#r(){const e=this.#t?.state??g();this.#i={...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset}}#n(e){b.batch(()=>{if(this.#s&&this.hasListeners()){const t=this.#i.variables,i=this.#i.context,s={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};e?.type==="success"?(this.#s.onSuccess?.(e.data,t,i,s),this.#s.onSettled?.(e.data,null,t,i,s)):e?.type==="error"&&(this.#s.onError?.(e.error,t,i,s),this.#s.onSettled?.(void 0,e.error,t,i,s))}this.listeners.forEach(t=>{t(this.#i)})})}};function K(e,t){const i=f(t),[s]=u.useState(()=>new M(i,e));u.useEffect(()=>{s.setOptions(e)},[s,e]);const r=u.useSyncExternalStore(u.useCallback(n=>s.subscribe(b.batchCalls(n)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),o=u.useCallback((n,d)=>{s.mutate(n,d).catch(m)},[s]);if(r.error&&x(s.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:o,mutateAsync:r.mutate}}const S=O("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive cursor-pointer",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border text-foreground bg-background hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-foreground/80 hover:text-foreground",brand:"bg-brand-green-light text-brand-green-dark hover:bg-brand-green-light/90"},size:{default:"h-10 px-4 py-2 has-[>svg]:px-3",sm:"h-8 gap-1.5 px-3 has-[>svg]:px-2.5",xs:"h-6 gap-1 px-2 text-xs has-[>svg]:px-1.5",lg:"h-10 px-6 has-[>svg]:px-4",icon:"size-10"}},defaultVariants:{variant:"default",size:"default"}});function z(e){const t=y.c(14);let i,s,r,o,n;t[0]!==e?({className:i,variant:n,size:r,asChild:o,...s}=e,t[0]=e,t[1]=i,t[2]=s,t[3]=r,t[4]=o,t[5]=n):(i=t[1],s=t[2],r=t[3],o=t[4],n=t[5]);const c=(o===void 0?!1:o)?C:"button";let a;t[6]!==i||t[7]!==r||t[8]!==n?(a=E(S({variant:n,size:r,className:i})),t[6]=i,t[7]=r,t[8]=n,t[9]=a):a=t[9];let h;return t[10]!==c||t[11]!==s||t[12]!==a?(h=k.jsx(c,{"data-slot":"button",className:a,...s}),t[10]=c,t[11]=s,t[12]=a,t[13]=h):h=t[13],h}export{z as B,S as b,K as u};
@@ -1 +1 @@
1
- import{c as l,j as c}from"./index-VCe1FY3E.js";import{c as d}from"./utils-B-QWwgyW.js";function f(r){const e=l.c(8);let t,a;e[0]!==r?({className:t,...a}=r,e[0]=r,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let s;e[3]!==t?(s=d("bg-card text-card-foreground hover:bg-accent/50 flex flex-col gap-6 rounded-xl border border-border/75",t),e[3]=t,e[4]=s):s=e[4];let o;return e[5]!==a||e[6]!==s?(o=c.jsx("div",{"data-slot":"card",className:s,...a}),e[5]=a,e[6]=s,e[7]=o):o=e[7],o}function p(r){const e=l.c(8);let t,a;e[0]!==r?({className:t,...a}=r,e[0]=r,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let s;e[3]!==t?(s=d("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto]",t),e[3]=t,e[4]=s):s=e[4];let o;return e[5]!==a||e[6]!==s?(o=c.jsx("div",{"data-slot":"card-header",className:s,...a}),e[5]=a,e[6]=s,e[7]=o):o=e[7],o}function m(r){const e=l.c(8);let t,a;e[0]!==r?({className:t,...a}=r,e[0]=r,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let s;e[3]!==t?(s=d("leading-none font-semibold",t),e[3]=t,e[4]=s):s=e[4];let o;return e[5]!==a||e[6]!==s?(o=c.jsx("div",{"data-slot":"card-title",className:s,...a}),e[5]=a,e[6]=s,e[7]=o):o=e[7],o}function u(r){const e=l.c(4);let t;e[0]!==r?({...t}=r,e[0]=r,e[1]=t):t=e[1];let a;return e[2]!==t?(a=c.jsx("div",{"data-slot":"card-content",...t}),e[2]=t,e[3]=a):a=e[3],a}export{f as C,p as a,m as b,u as c};
1
+ import{c as l,j as c}from"./index-kuMaGV9U.js";import{c as d}from"./utils-dJ2GyoL3.js";function f(r){const e=l.c(8);let t,a;e[0]!==r?({className:t,...a}=r,e[0]=r,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let s;e[3]!==t?(s=d("bg-card text-card-foreground hover:bg-accent/50 flex flex-col gap-6 rounded-xl border border-border/75",t),e[3]=t,e[4]=s):s=e[4];let o;return e[5]!==a||e[6]!==s?(o=c.jsx("div",{"data-slot":"card",className:s,...a}),e[5]=a,e[6]=s,e[7]=o):o=e[7],o}function p(r){const e=l.c(8);let t,a;e[0]!==r?({className:t,...a}=r,e[0]=r,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let s;e[3]!==t?(s=d("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto]",t),e[3]=t,e[4]=s):s=e[4];let o;return e[5]!==a||e[6]!==s?(o=c.jsx("div",{"data-slot":"card-header",className:s,...a}),e[5]=a,e[6]=s,e[7]=o):o=e[7],o}function m(r){const e=l.c(8);let t,a;e[0]!==r?({className:t,...a}=r,e[0]=r,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let s;e[3]!==t?(s=d("leading-none font-semibold",t),e[3]=t,e[4]=s):s=e[4];let o;return e[5]!==a||e[6]!==s?(o=c.jsx("div",{"data-slot":"card-title",className:s,...a}),e[5]=a,e[6]=s,e[7]=o):o=e[7],o}function u(r){const e=l.c(4);let t;e[0]!==r?({...t}=r,e[0]=r,e[1]=t):t=e[1];let a;return e[2]!==t?(a=c.jsx("div",{"data-slot":"card-content",...t}),e[2]=t,e[3]=a):a=e[3],a}export{f as C,p as a,m as b,u as c};
@@ -1 +1 @@
1
- import{c as d,j as c,b9 as n,ba as l}from"./index-VCe1FY3E.js";import{c as m}from"./utils-B-QWwgyW.js";import{f as b}from"./select-CrueAR2N.js";function x(o){const e=d.c(9);let r,a;e[0]!==o?({className:r,...a}=o,e[0]=o,e[1]=r,e[2]=a):(r=e[1],a=e[2]);let i;e[3]!==r?(i=m("peer border-foreground dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",r),e[3]=r,e[4]=i):i=e[4];let t;e[5]===Symbol.for("react.memo_cache_sentinel")?(t=c.jsx(l,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-primary-foreground transition-none",children:c.jsx(b,{className:"size-3.5"})}),e[5]=t):t=e[5];let s;return e[6]!==a||e[7]!==i?(s=c.jsx(n,{"data-slot":"checkbox",className:i,...a,children:t}),e[6]=a,e[7]=i,e[8]=s):s=e[8],s}export{x as C};
1
+ import{c as d,j as c,bc as n,bd as l}from"./index-kuMaGV9U.js";import{c as m}from"./utils-dJ2GyoL3.js";import{f as b}from"./select-BFyzpZOm.js";function x(o){const e=d.c(9);let r,a;e[0]!==o?({className:r,...a}=o,e[0]=o,e[1]=r,e[2]=a):(r=e[1],a=e[2]);let i;e[3]!==r?(i=m("peer border-foreground dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",r),e[3]=r,e[4]=i):i=e[4];let t;e[5]===Symbol.for("react.memo_cache_sentinel")?(t=c.jsx(l,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-primary-foreground transition-none",children:c.jsx(b,{className:"size-3.5"})}),e[5]=t):t=e[5];let s;return e[6]!==a||e[7]!==i?(s=c.jsx(n,{"data-slot":"checkbox",className:i,...a,children:t}),e[6]=a,e[7]=i,e[8]=s):s=e[8],s}export{x as C};
@@ -1 +1 @@
1
- import{b6 as e}from"./index-VCe1FY3E.js";const c=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],y=e("circle-alert",c);export{y as C};
1
+ import{b9 as e}from"./index-kuMaGV9U.js";const c=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],y=e("circle-alert",c);export{y as C};
@@ -0,0 +1 @@
1
+ import{b9 as _,r as N,d as M,as as ee,j as t,c as S,af as te,a6 as se,b8 as W}from"./index-kuMaGV9U.js";import{f as oe,c as D,U as B,a as ne,e as re}from"./integration-icon-Dv-2D552.js";import{T as ae}from"./tool-set-selector-BxJYXzYX.js";import{B as ie}from"./badge-C29ypR-2.js";import{B as I}from"./button-Cv1rgJOF.js";import{I as z}from"./icon-KZI-tyY2.js";import{I as U}from"./input-C0U94pom.js";import{S as le}from"./spinner-CYHX4tj_.js";import{T as q}from"./textarea-7TwZjOJN.js";import{c as k}from"./utils-dJ2GyoL3.js";import{a as G,u as ce,O as de,P as me,E as ue}from"./index-3kbMatbv.js";import{b as Z,a as xe,V as H}from"./layout-B4csW0zk.js";import{U as fe}from"./upload-CedwcKCT.js";import{u as pe}from"./use-mcp-Z1amXXTK.js";import{C as he}from"./circle-alert-C3-3ZyHM.js";import{E as ge}from"./error-boundary-COxhsLlB.js";import"./tooltip-CyTpNpEt.js";import"./checkbox-Ay9B68Cb.js";import"./select-BFyzpZOm.js";import"./collection-search-CXcLRFBk.js";import"./mcp-oauth-C8lkjJJ-.js";import"./auth-Dfo88onv.js";import"./use-organization-settings-D7E3skEu.js";import"./empty-state-CCq1QaCi.js";import"./use-binding-Dlf98XSv.js";import"./use-tool-call-DSlbFKjt.js";import"./form-xpLXXjk9.js";import"./use-gateway-C6ADI4VP.js";import"./formatDistanceToNow-Ctx6mZEP.js";import"./extract-connection-data-DyKjnzFA.js";import"./registry-utils-ulDDT0d8.js";import"./generate-id-Dyweu44Y.js";import"./index-B6JW-QRO.js";import"./index-C3w_QZu6.js";import"./schema-DLIeWQJ0.js";import"./useQuery-DJ7WNdWe.js";const be=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],je=_("box",be);const ve=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ne=_("clock",ve);const ye=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],we=_("code",ye);const Se=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Ce=_("copy",Se);const ke=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],$e=_("database",ke);const Ie=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],_e=_("info",Ie);const Te=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],K=_("play",Te);function Ee(s){const e=S.c(14),{value:r,onChange:a,alt:n}=s,o=N.useRef(null);let i;e[0]!==a?(i=j=>{const w=j.target.files?.[0];if(w){const y=new FileReader;y.onloadend=()=>{const g=y.result;a(g)},y.readAsDataURL(w)}},e[0]=a,e[1]=i):i=e[1];const m=i;let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{o.current?.click()},e[2]=l):l=e[2];const p=l;let c;e[3]!==m?(c=t.jsx("input",{type:"file",ref:o,className:"hidden",accept:"image/*",onChange:m}),e[3]=m,e[4]=c):c=e[4];let x;e[5]!==n||e[6]!==r?(x=r?t.jsx("img",{src:r,alt:n||"Avatar",className:"w-full h-full object-cover"}):t.jsx("div",{className:"w-full h-full flex items-center justify-center text-2xl",children:"🤖"}),e[5]=n,e[6]=r,e[7]=x):x=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("div",{className:"absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center rounded-xl",children:t.jsx(fe,{className:"h-5 w-5 text-white"})}),e[8]=f):f=e[8];let h;e[9]!==x?(h=t.jsxs("div",{className:"h-full w-full rounded-xl border border-border bg-muted/20 overflow-hidden relative",children:[x,f]}),e[9]=x,e[10]=h):h=e[10];let b;return e[11]!==c||e[12]!==h?(b=t.jsxs("div",{className:"relative h-14 w-14 shrink-0 cursor-pointer group",onClick:p,children:[c,h]}),e[11]=c,e[12]=h,e[13]=b):b=e[13],b}function Ae({itemId:s,onBack:e,onUpdate:r}){const[a,n]=N.useState(!1),[o,i]=N.useState("profile"),{connectionId:m}=M({from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"}),l=m??B,p=D(l),c=oe(l,"AGENT",s,p),{register:x,handleSubmit:f,reset:h,setValue:b,watch:j,formState:{isDirty:w}}=ee({defaultValues:{title:"",description:"",instructions:"",avatar:"",tool_set:{}}}),y=j("avatar"),g=j("tool_set")??{};N.useEffect(()=>{c&&h({title:c.title??"",description:c.description??"",instructions:c.instructions??"",avatar:c.avatar??"",tool_set:c.tool_set??{}})},[c,h]);const u=async $=>{n(!0);try{await r($)}finally{n(!1)}},O=$=>{b("tool_set",$,{shouldDirty:!0})};return c?t.jsxs(Z,{onBack:e,children:[t.jsxs(xe,{children:[t.jsx(I,{variant:o==="profile"?"secondary":"ghost",size:"sm",className:k("h-7 font-normal",o==="profile"?"bg-muted text-foreground":"text-muted-foreground"),onClick:()=>i("profile"),children:"Profile"}),t.jsx(I,{variant:o==="tools"?"secondary":"ghost",size:"sm",className:k("h-7 font-normal",o==="tools"?"bg-muted text-foreground":"text-muted-foreground"),onClick:()=>i("tools"),children:"Tools"}),t.jsx(I,{variant:o==="triggers"?"secondary":"ghost",size:"sm",className:k("h-7 font-normal",o==="triggers"?"bg-muted text-foreground":"text-muted-foreground"),onClick:()=>i("triggers"),disabled:!0,children:"Triggers"}),t.jsx(I,{variant:o==="advanced"?"secondary":"ghost",size:"sm",className:k("h-7 font-normal",o==="advanced"?"bg-muted text-foreground":"text-muted-foreground"),onClick:()=>i("advanced"),disabled:!0,children:"Advanced"})]}),t.jsxs(H,{children:[t.jsx(G,{connectionId:m,title:c.title,icon:c.avatar??"smart_toy"}),t.jsx(I,{className:"bg-[#d0ec1a] text-[#07401a] hover:bg-[#d0ec1a]/90 h-7 text-xs font-medium",onClick:f(u),disabled:!w||a,children:a?t.jsxs(t.Fragment,{children:[t.jsx(z,{name:"progress_activity",size:12,className:"mr-2 animate-spin"}),"Saving..."]}):"Save changes"})]}),o==="profile"&&t.jsx("div",{className:"p-5",children:t.jsxs("div",{className:"max-w-3xl mx-auto space-y-6",children:[t.jsxs("div",{className:"flex gap-4 items-start",children:[t.jsx(Ee,{value:y,onChange:$=>b("avatar",$,{shouldDirty:!0}),alt:j("title")}),t.jsxs("div",{className:"space-y-3 pt-1 flex-1",children:[t.jsx(U,{...x("title"),className:"text-2xl font-medium text-foreground border-transparent hover:border-input focus:border-input px-0 h-auto bg-transparent shadow-none",placeholder:"Agent Name"}),t.jsx(U,{...x("description"),className:"text-sm text-muted-foreground border-transparent hover:border-input focus:border-input px-0 h-auto bg-transparent shadow-none",placeholder:"Brief description"})]})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs(ie,{variant:"secondary",className:"px-2 py-0.5 h-6 gap-1.5 bg-secondary/50 text-muted-foreground font-normal text-xs hover:bg-secondary/50",children:[t.jsx(_e,{className:"h-3.5 w-3.5"}),"Type @ to add tools and more"]}),t.jsx("div",{className:"relative",children:t.jsx(q,{...x("instructions"),className:"min-h-[400px] resize-none text-sm leading-relaxed font-normal border-0 focus-visible:ring-0 px-0 py-0 shadow-none",placeholder:"Enter agent instructions..."})})]})]})}),o==="tools"&&t.jsx(ae,{toolSet:g,onToolSetChange:O}),o==="triggers"&&t.jsx("div",{className:"p-5",children:t.jsx("div",{className:"text-sm text-muted-foreground",children:"Triggers tab coming soon"})}),o==="advanced"&&t.jsx("div",{className:"p-5",children:t.jsx("div",{className:"text-sm text-muted-foreground",children:"Advanced tab coming soon"})})]}):t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(le,{})})}const ze=te("relative w-full rounded-lg border px-4 py-3 text-sm flex items-start gap-3 [&>svg]:size-4 [&>svg]:flex-shrink-0 [&>svg]:mt-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-destructive/10 text-destructive border-destructive [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-warning/10 text-warning-foreground border-warning [&>svg]:text-current *:data-[slot=alert-description]:text-warning-foreground/90",success:"bg-success/10 text-success-foreground border-success [&>svg]:text-current *:data-[slot=alert-description]:text-success-foreground/90",info:"bg-card text-card-foreground border-border [&>svg]:text-current *:data-[slot=alert-description]:text-muted-foreground/90"}},defaultVariants:{variant:"default"}});function Me(s){const e=S.c(10);let r,a,n;e[0]!==s?({className:r,variant:n,...a}=s,e[0]=s,e[1]=r,e[2]=a,e[3]=n):(r=e[1],a=e[2],n=e[3]);let o;e[4]!==r||e[5]!==n?(o=k(ze({variant:n}),r),e[4]=r,e[5]=n,e[6]=o):o=e[6];let i;return e[7]!==a||e[8]!==o?(i=t.jsx("div",{"data-slot":"alert",role:"alert",className:o,...a}),e[7]=a,e[8]=o,e[9]=i):i=e[9],i}function Oe(s){const e=S.c(8);let r,a;e[0]!==s?({className:r,...a}=s,e[0]=s,e[1]=r,e[2]=a):(r=e[1],a=e[2]);let n;e[3]!==r?(n=k("line-clamp-1 min-h-4 font-medium tracking-tight",r),e[3]=r,e[4]=n):n=e[4];let o;return e[5]!==a||e[6]!==n?(o=t.jsx("div",{"data-slot":"alert-title",className:n,...a}),e[5]=a,e[6]=n,e[7]=o):o=e[7],o}function Pe(s){const e=S.c(8);let r,a;e[0]!==s?({className:r,...a}=s,e[0]=s,e[1]=r,e[2]=a):(r=e[1],a=e[2]);let n;e[3]!==r?(n=k("text-muted-foreground leading-relaxed",r),e[3]=r,e[4]=n):n=e[4];let o;return e[5]!==a||e[6]!==n?(o=t.jsx("div",{"data-slot":"alert-description",className:n,...a}),e[5]=a,e[6]=n,e[7]=o):o=e[7],o}const Re=s=>s.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function Ve(s){const e=S.c(12),{toolName:r,connectionId:a,onBack:n}=s,o=`/mcp/${a}`;let i;e[0]!==o?(i=new URL(o,window.location.origin),e[0]=o,e[1]=i):i=e[1];const m=i;let l;if(e[2]!==a?(l={connectionId:a},e[2]=a,e[3]=l):l=e[3],!ce(l)){let f;return e[4]!==n?(f=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(de,{onAuthenticate:()=>n(),buttonText:"Go back"})}),e[4]=n,e[5]=f):f=e[5],f}const c=`${a}:${r}`;let x;return e[6]!==a||e[7]!==m||e[8]!==n||e[9]!==c||e[10]!==r?(x=t.jsx(Ue,{toolName:r,connectionId:a,mcpProxyUrl:m,onBack:n},c),e[6]=a,e[7]=m,e[8]=n,e[9]=c,e[10]=r,e[11]=x):x=e[11],x}function Ue({toolName:s,connectionId:e,mcpProxyUrl:r,onBack:a}){const[n,o]=N.useState({}),[i,m]=N.useState("{}"),[l,p]=N.useState(null),[c,x]=N.useState(null),[f,h]=N.useState(!1),[b,j]=N.useState(null),[w,y]=N.useState("json"),g=pe({url:r.href});N.useEffect(()=>{g.error&&console.error("MCP Error:",g.error)},[g.error]);const u=g.tools?.find(d=>d.name===s),O=u?.inputSchema?.properties,$=O?Object.keys(O):[],A=$.length>0,P={};if(A&&u?.inputSchema?.properties)for(const d of $)P[d]=u.inputSchema.required?.includes(d)?"":void 0;const J=d=>Object.prototype.hasOwnProperty.call(n,d),Q=async()=>{h(!0),x(null),p(null),j(null);const d=performance.now(),C=D(e);try{const v=A?{...P,...n}:(()=>{const T=i.trim();if(!T)return{};const E=JSON.parse(T);if(E&&typeof E=="object")return E;throw new Error("Raw JSON input must be an object.")})();A&&u?.inputSchema?.properties&&Object.entries(u.inputSchema.properties).forEach(([T,E])=>{if((E.type==="object"||E.type==="array")&&typeof v[T]=="string")try{v[T]=JSON.parse(v[T])}catch{}});const R=await C(s,v),V=performance.now(),X=Math.round(V-d);p(R);const Y=JSON.stringify(R),F=new TextEncoder().encode(Y).length;j({duration:`${X}ms`,bytes:`${F} bytes`,tokens:`~${Math.ceil(F/4)} tokens`,cost:"$0.0000"})}catch(v){const R=v instanceof Error?v.message:String(v);x(R||"Unknown error occurred");const V=performance.now();j({duration:`${Math.round(V-d)}ms`})}finally{h(!1)}},L=(d,C)=>{o(v=>({...v,[d]:C}))};return t.jsxs(Z,{onBack:a,children:[t.jsx(H,{children:t.jsx(G,{connectionId:e,title:u?.name??Re(s),icon:"build"})}),t.jsxs("div",{className:"flex flex-col items-center w-full max-w-[1500px] mx-auto p-10 gap-4",children:[t.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[t.jsx("h1",{className:"text-2xl font-medium text-foreground",children:s}),t.jsx("p",{className:"text-muted-foreground text-base",children:u?.description||"No description available"})]}),t.jsxs("div",{className:"flex items-center gap-4 py-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[g.state==="ready"?t.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500 animate-pulse"}):g.state==="connecting"?t.jsx(z,{name:"progress_activity",size:12,className:"animate-spin text-yellow-500"}):t.jsx("div",{className:"h-2 w-2 rounded-full bg-red-500"}),t.jsx("span",{className:"font-mono text-sm capitalize text-muted-foreground",children:g.state.replace("_"," ")})]}),t.jsx("div",{className:"w-px h-4 bg-border"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ne,{className:"h-4 w-4 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-sm",children:b?.duration||"-"})]}),t.jsx("div",{className:"w-px h-4 bg-border"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(je,{className:"h-4 w-4 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-sm",children:b?.tokens||"-"})]}),t.jsx("div",{className:"w-px h-4 bg-border"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx($e,{className:"h-4 w-4 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-sm",children:b?.bytes||"-"})]})]}),c&&t.jsxs(Me,{variant:"destructive",className:"max-w-[800px] w-full bg-red-50 dark:bg-red-900/10 border-red-200 dark:border-red-900",children:[t.jsx(he,{className:"h-4 w-4"}),t.jsx(Oe,{children:"Execution Failed"}),t.jsx(Pe,{children:c})]}),t.jsxs("div",{className:"flex flex-col gap-4 w-full max-w-[800px] items-center",children:[t.jsxs("div",{className:"w-full bg-card border border-border rounded-xl shadow-sm overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-muted/30",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"h-4 w-4 rounded-sm bg-primary/10 flex items-center justify-center",children:t.jsx(K,{className:"h-3 w-3 text-primary"})}),t.jsx("span",{className:"font-medium text-sm",children:"Input"})]}),t.jsxs(I,{size:"sm",variant:"default",className:"h-8 gap-2",onClick:Q,disabled:f,children:[f?t.jsx(z,{name:"progress_activity",size:14,className:"animate-spin"}):t.jsx(K,{className:"h-3.5 w-3.5 fill-current"}),"Execute tool"]})]}),t.jsxs("div",{className:"p-4 space-y-4",children:[t.jsx("div",{className:"text-xs font-mono text-muted-foreground uppercase tracking-wider",children:"Arguments"}),A&&u?.inputSchema?.properties?Object.entries(u.inputSchema.properties).map(([d,C])=>t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-baseline gap-2",children:[t.jsx("label",{className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:d}),u.inputSchema?.required?.includes(d)&&t.jsx("span",{className:"text-red-500 text-xs",children:"*"}),t.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:C.type})]}),C.description&&t.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:C.description}),C.type==="object"||C.type==="array"?t.jsx(q,{className:"flex min-h-[60px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 font-mono",value:J(d)?n[d]??"":P[d]??"",onChange:v=>L(d,v.target.value),placeholder:`Enter ${d} as JSON...`}):t.jsx(U,{value:J(d)?n[d]??"":P[d]??"",onChange:v=>L(d,v.target.value),placeholder:`Enter ${d}...`})]},d)):t.jsx("div",{className:"text-sm text-muted-foreground italic",children:"No arguments defined in schema."}),u?.inputSchema&&!A&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),t.jsx("textarea",{className:"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",value:i,onChange:d=>m(d.target.value),placeholder:'e.g. { "foo": "bar" }'})]})]})]}),t.jsxs("div",{className:"w-full bg-card border border-border rounded-xl shadow-sm overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-muted/30",children:[t.jsx("span",{className:"text-xs font-mono text-muted-foreground uppercase tracking-wider",children:"Execution Result"}),t.jsxs("div",{className:"flex items-center bg-muted rounded-lg p-1 h-8",children:[t.jsx("button",{onClick:()=>y("json"),className:k("px-3 py-1 text-xs font-medium rounded-md transition-all",w==="json"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:"JSON"}),t.jsxs("button",{onClick:()=>y("view"),className:k("px-3 py-1 text-xs font-medium rounded-md transition-all flex items-center gap-1",w==="view"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),disabled:!0,title:"Coming soon",children:["Create view",t.jsx(me,{className:"h-3 w-3"})]})]})]}),t.jsxs("div",{className:"relative min-h-[200px] max-h-[500px] overflow-auto bg-zinc-950 text-zinc-50 p-4 font-mono text-xs",children:[l?t.jsx("pre",{className:"whitespace-pre-wrap break-all",children:JSON.stringify(l,null,2)}):t.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-zinc-700",children:[t.jsx(we,{className:"h-8 w-8 mb-2 opacity-50"}),t.jsx("p",{children:"Run the tool to see results"})]}),l&&t.jsx("div",{className:"absolute top-4 right-4 flex gap-2",children:t.jsx(I,{size:"icon",variant:"secondary",className:"h-8 w-8 bg-zinc-800 text-zinc-400 hover:text-white hover:bg-zinc-700 border-zinc-700",onClick:()=>{navigator.clipboard.writeText(JSON.stringify(l,null,2)),se.success("Copied to clipboard")},children:t.jsx(Ce,{className:"h-4 w-4"})})})]})]})]})]})]})}function De(s){const e=S.c(7),{itemId:r,onBack:a}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},e[0]=n):n=e[0];const i=M(n).connectionId??B;if(!ne(i)){let c;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[t.jsx("h3",{className:"text-lg font-semibold",children:"Connection not found"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection may have been deleted or you may not have access."})]})}),e[1]=c):c=e[1],c}let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(z,{name:"progress_activity",size:32,className:"animate-spin text-muted-foreground"})}),e[2]=l):l=e[2];let p;return e[3]!==i||e[4]!==a||e[5]!==r?(p=t.jsx(N.Suspense,{fallback:l,children:t.jsx(Ve,{toolName:r,connectionId:i,onBack:a})}),e[3]=i,e[4]=a,e[5]=r,e[6]=p):p=e[6],p}const Be={agent:Ae};function Je(){const s=S.c(6),e=W();let r;s[0]===Symbol.for("react.memo_cache_sentinel")?(r={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},s[0]=r):r=s[0];const a=M(r),n=decodeURIComponent(a.itemId);let o;s[1]!==e.history?(o=()=>{e.history.back()},s[1]=e.history,s[2]=o):o=s[2];const i=o,m=Le;let l;return s[3]!==i||s[4]!==n?(l=t.jsx(De,{itemId:n,onBack:i,onUpdate:m}),s[3]=i,s[4]=n,s[5]=l):l=s[5],l}async function Le(s){return Promise.resolve()}function Fe(){const s=S.c(17),e=W();let r;s[0]===Symbol.for("react.memo_cache_sentinel")?(r={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},s[0]=r):r=s[0];const a=M(r),n=a.connectionId,o=decodeURIComponent(a.collectionName),i=decodeURIComponent(a.itemId);let m;s[1]!==e.history?(m=()=>{e.history.back()},s[1]=e.history,s[2]=m):m=s[2];const l=m,p=n??B;let c;s[3]!==p?(c=D(p),s[3]=p,s[4]=c):c=s[4];const f=re(p,o,c);let h;s[5]!==f||s[6]!==i?(h=async u=>{i&&await f.update.mutateAsync({id:i,data:u})},s[5]=f,s[6]=i,s[7]=h):h=s[7];const b=h;let j;s[8]!==o?(j=o?.toLowerCase(),s[8]=o,s[9]=j):j=s[9];const w=j,y=w&&Be[w];if(y){let u;return s[10]!==y||s[11]!==l||s[12]!==b||s[13]!==i?(u=t.jsx(y,{itemId:i,onBack:l,onUpdate:b}),s[10]=y,s[11]=l,s[12]=b,s[13]=i,s[14]=u):u=s[14],u}let g;return s[15]!==l?(g=t.jsx(ue,{icon:"extension",title:"No component defined",description:"No component for this collection was defined",buttonProps:{onClick:l,children:"Go back"}}),s[15]=l,s[16]=g):g=s[16],g}function Ke(){const s=S.c(3);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},s[0]=e):e=s[0];const r=M(e);if(decodeURIComponent(r.collectionName)==="tools"){let i;return s[1]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Je,{}),s[1]=i):i=s[1],i}let o;return s[2]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(Fe,{}),s[2]=o):o=s[2],o}function It(){const s=S.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ge,{children:t.jsx(N.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(z,{name:"progress_activity",size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Ke,{})})}),s[0]=e):e=s[0],e}export{It as default};