@decocms/mesh 1.0.0-alpha.6 → 1.0.0-alpha.9
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.
- package/dist/README.md +296 -0
- package/dist/client/assets/{alert-dialog-Caf0mgW9.js → alert-dialog-pYV3wSPs.js} +1 -1
- package/dist/client/assets/{auth-CGqqbEan.js → auth-D1xg1rd7.js} +1 -1
- package/dist/client/assets/{auth-catchall-Bw-KJI1v.js → auth-catchall-BZaDWHEa.js} +1 -1
- package/dist/client/assets/{avatar-CdPaDOIs.js → avatar-DAMcOnM4.js} +1 -1
- package/dist/client/assets/{badge-j-myHF25.js → badge-Bi_GpkO_.js} +1 -1
- package/dist/client/assets/{button-DnKGwZ1P.js → button-G3aMPyFq.js} +1 -1
- package/dist/client/assets/{card-I0CWqn2J.js → card-CE1-D3SY.js} +1 -1
- package/dist/client/assets/{checkbox-v3iP8MNg.js → checkbox-DgaTW36u.js} +1 -1
- package/dist/client/assets/{circle-alert-CpqBZI3V.js → circle-alert-B9wPiUFk.js} +1 -1
- package/dist/client/assets/{collection-detail-BSfYYwzG.js → collection-detail-Bj_y2m-h.js} +1 -1
- package/dist/client/assets/{collection-display-button-Cws3c2TG.js → collection-display-button-BOWw7rwa.js} +1 -1
- package/dist/client/assets/{collection-header-CJC3zXGa.js → collection-header-BeSLFcaG.js} +1 -1
- package/dist/client/assets/{collection-page-CkAonVNX.js → collection-page-C_ScBEek.js} +1 -1
- package/dist/client/assets/{collection-search-Bd4XQ4_K.js → collection-search-DFSSOoxU.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-Dv4rgxdy.js → collection-table-wrapper-CKt7U95e.js} +1 -1
- package/dist/client/assets/{connection-card-CgJm9r5i.js → connection-card-Bj0wmYgV.js} +1 -1
- package/dist/client/assets/{connection-detail-HAGAOVY9.js → connection-detail-kWSPNag3.js} +1 -1
- package/dist/client/assets/{connections-C8Z338-P.js → connections-C7HPEBbQ.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-CWgFMDXV.js → create-organization-dialog-BpSaszPg.js} +1 -1
- package/dist/client/assets/{dialog-Qusr5Dgc.js → dialog-C1eFYVPZ.js} +1 -1
- package/dist/client/assets/{dropdown-menu-BIeRR6rM.js → dropdown-menu-CtSLEdvQ.js} +1 -1
- package/dist/client/assets/{empty-state-DV83eIhT.js → empty-state-YCqZyamY.js} +1 -1
- package/dist/client/assets/{error-boundary-qOVcoWbq.js → error-boundary-9CuK9oWa.js} +1 -1
- package/dist/client/assets/{extract-connection-data-DzgXoQyz.js → extract-connection-data-Cu9jjhV-.js} +1 -1
- package/dist/client/assets/{form-0C1lYHJ2.js → form-BsxjQn2d.js} +1 -1
- package/dist/client/assets/{gateway-detail-mD14k5vr.js → gateway-detail-C5d-KPPl.js} +1 -1
- package/dist/client/assets/{gateways-BSGLH5Mc.js → gateways-BSgfG0sP.js} +1 -1
- package/dist/client/assets/{home-B1IT0slW.js → home-Bu1wH9nU.js} +1 -1
- package/dist/client/assets/{icon-C1glN-Ga.js → icon-Cxep_tfx.js} +1 -1
- package/dist/client/assets/{index-D2ODleHN.js → index-BRGTweKk.js} +1 -1
- package/dist/client/assets/{index-DqmRoUE9.js → index-Bhg5-H1t.js} +1 -1
- package/dist/client/assets/{index-C1xA8jg5.js → index-BtenH3n7.js} +1 -1
- package/dist/client/assets/{index-B5e6fytH.js → index-MoI-rvC3.js} +15 -15
- package/dist/client/assets/{index-Chpp7zg0.js → index-fqd6S2iW.js} +1 -1
- package/dist/client/assets/{input-DpAKmHHm.js → input-CXe38a5R.js} +1 -1
- package/dist/client/assets/{integration-icon-C_Dk6BbN.js → integration-icon-C162QlgN.js} +1 -1
- package/dist/client/assets/{layout-BMHVtK0w.js → layout-DqgJyIdL.js} +1 -1
- package/dist/client/assets/{lazy-highlighter-9rAB2zZq.js → lazy-highlighter-DdBDXFu3.js} +1 -1
- package/dist/client/assets/{localstorage-keys-DC7ymQmZ.js → localstorage-keys-CzubTFSO.js} +1 -1
- package/dist/client/assets/{login-BMjQy3tL.js → login-CTfLDBBt.js} +1 -1
- package/dist/client/assets/{members-k_V-Gxfi.js → members-B8JX8n6Q.js} +1 -1
- package/dist/client/assets/{monitoring-BG-rBDyv.js → monitoring-D7cSD8lu.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-PYfuhQHX.js → monitoring-stats-row-CX3aDsAR.js} +1 -1
- package/dist/client/assets/{oauth-callback-CQ4D18kW.js → oauth-callback-BSpJjtnq.js} +1 -1
- package/dist/client/assets/{page-h-kmS-QS.js → page-DEl_xdLR.js} +1 -1
- package/dist/client/assets/{popover-TCQphQTw.js → popover-iDiv_aJK.js} +1 -1
- package/dist/client/assets/{prism-CcSucC56.js → prism-vdds-nIT.js} +1 -1
- package/dist/client/assets/{resource-tabs-E4yf0eYT.js → resource-tabs-CNxf_u1f.js} +1 -1
- package/dist/client/assets/{schema-BLzWyGtx.js → schema-BJ2fRDqu.js} +1 -1
- package/dist/client/assets/{select-fvQCifl4.js → select-B4j1Cb8E.js} +1 -1
- package/dist/client/assets/{settings-Bjk195Z6.js → settings-CJre-VTk.js} +1 -1
- package/dist/client/assets/{shell-layout-B8oNCzSa.js → shell-layout-BqISuLuR.js} +3 -3
- package/dist/client/assets/{spinner-Cck765yW.js → spinner-BgjBycmB.js} +1 -1
- package/dist/client/assets/{store-DD1aCoWU.js → store-CL6xQwes.js} +1 -1
- package/dist/client/assets/{store-app-detail-DZvzqAVf.js → store-app-detail-BqHjNu0f.js} +1 -1
- package/dist/client/assets/{textarea--4iImQiq.js → textarea-BK0_vna7.js} +1 -1
- package/dist/client/assets/{tool-set-selector-Fu1vBXWK.js → tool-set-selector-DYpFtHWh.js} +1 -1
- package/dist/client/assets/{tooltip-DjXyjtiH.js → tooltip-CyReuecv.js} +1 -1
- package/dist/client/assets/{upload-DkfUhTLj.js → upload-n_AaBb-Z.js} +1 -1
- package/dist/client/assets/{use-binding-BLIUV5ER.js → use-binding-DdwHCRqV.js} +1 -1
- package/dist/client/assets/{use-connection-IMyxygAc.js → use-connection-DiHU9E79.js} +1 -1
- package/dist/client/assets/{use-gateway-CuMrhcvh.js → use-gateway-B9o1M04u.js} +1 -1
- package/dist/client/assets/{use-list-state-Bas0EIwN.js → use-list-state-CKwEYaZT.js} +1 -1
- package/dist/client/assets/{use-members-DHcrnzKP.js → use-members-BH0kTiC2.js} +1 -1
- package/dist/client/assets/{use-mobile-CxX0wu31.js → use-mobile-BjUr6Jaq.js} +1 -1
- package/dist/client/assets/{use-organization-settings-CpvpbwdB.js → use-organization-settings-Cywci2R8.js} +1 -1
- package/dist/client/assets/{use-tool-call-p0lqBezD.js → use-tool-call-CPpXYXAZ.js} +1 -1
- package/dist/client/assets/useQuery-BpCQj7wy.js +1 -0
- package/dist/client/assets/utils-BLlwSV8I.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +163 -163
- package/dist/server/server.js +158 -158
- package/package.json +1 -1
- package/dist/client/assets/useQuery-BO2jzwkw.js +0 -1
- package/dist/client/assets/utils-BLBjpUfr.js +0 -1
package/dist/README.md
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
<img alt="MCP Mesh" src="https://github.com/user-attachments/assets/d3e36c98-4609-46d3-b39f-7ee1c6d77432" />
|
|
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
|
+
> - Self-host with Docker, Bun, or run locally
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## What is MCP Mesh?
|
|
25
|
+
|
|
26
|
+
**MCP Mesh** is an open-source control plane for MCP traffic. It sits between your MCP clients (Cursor, Claude, VS Code, custom agents) and your MCP servers, providing a unified layer for auth, policy, and observability.
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
30
|
+
│ MCP Clients │
|
|
31
|
+
│ Cursor · Claude · VS Code · Custom Agents │
|
|
32
|
+
└───────────────────────────┬─────────────────────────────────────┘
|
|
33
|
+
│
|
|
34
|
+
▼
|
|
35
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
36
|
+
│ MCP MESH │
|
|
37
|
+
│ Gateway · Policy Engine · Observability · Token Vault │
|
|
38
|
+
└───────────────────────────┬─────────────────────────────────────┘
|
|
39
|
+
│
|
|
40
|
+
▼
|
|
41
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
42
|
+
│ MCP Servers │
|
|
43
|
+
│ Salesforce · Slack · GitHub · Postgres · Your APIs │
|
|
44
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Stop wiring every client to every MCP. Stop rebuilding auth for every agent.
|
|
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
|
|
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
|
+
## Core Capabilities
|
|
70
|
+
|
|
71
|
+
| Layer | Description |
|
|
72
|
+
|-------|-------------|
|
|
73
|
+
| 🧩 **MeshContext** | Unified runtime interface providing auth, storage, observability, and policy control |
|
|
74
|
+
| ⚙️ **defineTool()** | Declarative API for typed, auditable, observable MCP tools |
|
|
75
|
+
| 🧱 **AccessControl** | Fine-grained RBAC via Better Auth — OAuth 2.1 + API keys per workspace/project |
|
|
76
|
+
| 📊 **OpenTelemetry** | Full tracing and metrics for tools, workflows, and UI interactions |
|
|
77
|
+
| 💾 **Storage Adapters** | Kysely ORM → SQLite / Postgres, easily swapped |
|
|
78
|
+
| ☁️ **Proxy Layer** | Secure bridge to remote MCP servers with token vault + OAuth |
|
|
79
|
+
| 🧰 **Virtual MCPs** | Compose and expose governed toolsets as new MCP servers |
|
|
80
|
+
| 📬 **Event Bus** | Pub/sub between connections with scheduled/cron delivery and at-least-once guarantees |
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Define Tools
|
|
85
|
+
|
|
86
|
+
Tools are first-class citizens. Type-safe, audited, observable, and callable via MCP.
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
import { z } from "zod";
|
|
90
|
+
import { defineTool } from "~/core/define-tool";
|
|
91
|
+
|
|
92
|
+
export const CONNECTION_CREATE = defineTool({
|
|
93
|
+
name: "CONNECTION_CREATE",
|
|
94
|
+
description: "Create a new MCP connection",
|
|
95
|
+
inputSchema: z.object({
|
|
96
|
+
name: z.string(),
|
|
97
|
+
connection: z.object({
|
|
98
|
+
type: z.enum(["HTTP", "SSE", "WebSocket"]),
|
|
99
|
+
url: z.string().url(),
|
|
100
|
+
token: z.string().optional(),
|
|
101
|
+
}),
|
|
102
|
+
}),
|
|
103
|
+
outputSchema: z.object({
|
|
104
|
+
id: z.string(),
|
|
105
|
+
scope: z.enum(["workspace", "project"]),
|
|
106
|
+
}),
|
|
107
|
+
handler: async (input, ctx) => {
|
|
108
|
+
await ctx.access.check();
|
|
109
|
+
const conn = await ctx.storage.connections.create({
|
|
110
|
+
projectId: ctx.project?.id ?? null,
|
|
111
|
+
...input,
|
|
112
|
+
createdById: ctx.auth.user!.id,
|
|
113
|
+
});
|
|
114
|
+
return { id: conn.id, scope: conn.projectId ? "project" : "workspace" };
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Every tool call gets: type validation, access control checks, audit logging, and OpenTelemetry traces — automatically.
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Project Structure
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
├── apps/
|
|
127
|
+
│ ├── mesh/ # Full-stack MCP Mesh (Hono API + Vite/React)
|
|
128
|
+
│ │ ├── src/
|
|
129
|
+
│ │ │ ├── api/ # Hono HTTP + MCP proxy routes
|
|
130
|
+
│ │ │ ├── auth/ # Better Auth (OAuth + API keys)
|
|
131
|
+
│ │ │ ├── core/ # MeshContext, AccessControl, defineTool
|
|
132
|
+
│ │ │ ├── tools/ # Built-in MCP management tools
|
|
133
|
+
│ │ │ ├── storage/ # Kysely DB adapters
|
|
134
|
+
│ │ │ ├── event-bus/ # Pub/sub event delivery system
|
|
135
|
+
│ │ │ ├── encryption/ # Token vault & credential management
|
|
136
|
+
│ │ │ ├── observability/ # OpenTelemetry tracing & metrics
|
|
137
|
+
│ │ │ └── web/ # React 19 admin UI
|
|
138
|
+
│ │ └── migrations/ # Kysely database migrations
|
|
139
|
+
│ └── docs/ # Astro documentation site
|
|
140
|
+
│
|
|
141
|
+
└── packages/
|
|
142
|
+
├── bindings/ # Core MCP bindings and connection abstractions
|
|
143
|
+
├── runtime/ # MCP proxy, OAuth, and runtime utilities
|
|
144
|
+
├── ui/ # Shared React components (shadcn-based)
|
|
145
|
+
├── cli/ # CLI tooling (deco commands)
|
|
146
|
+
├── create-deco/ # Project scaffolding (npm create deco)
|
|
147
|
+
└── vite-plugin-deco/ # Vite plugin for Deco projects
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Development
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Install dependencies
|
|
156
|
+
bun install
|
|
157
|
+
|
|
158
|
+
# Run dev server (client + API)
|
|
159
|
+
bun run dev
|
|
160
|
+
|
|
161
|
+
# Run tests
|
|
162
|
+
bun test
|
|
163
|
+
|
|
164
|
+
# Type check
|
|
165
|
+
bun run check
|
|
166
|
+
|
|
167
|
+
# Lint
|
|
168
|
+
bun run lint
|
|
169
|
+
|
|
170
|
+
# Format
|
|
171
|
+
bun run fmt
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Mesh-specific commands (from `apps/mesh/`)
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
bun run dev:client # Vite dev server (port 4000)
|
|
178
|
+
bun run dev:server # Hono server with hot reload
|
|
179
|
+
bun run migrate # Run database migrations
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Deploy Anywhere
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# Docker Compose (SQLite)
|
|
188
|
+
docker compose -f deploy/docker-compose.yml up
|
|
189
|
+
|
|
190
|
+
# Docker Compose (PostgreSQL)
|
|
191
|
+
docker compose -f deploy/docker-compose.postgres.yml up
|
|
192
|
+
|
|
193
|
+
# Self-host with Bun
|
|
194
|
+
bun run build:client && bun run build:server
|
|
195
|
+
bun run start
|
|
196
|
+
|
|
197
|
+
# Kubernetes
|
|
198
|
+
kubectl apply -f k8s/
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Runs on any infrastructure — Docker, Kubernetes, AWS, GCP, or local Bun/Node runtimes. No vendor lock-in.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Tech Stack
|
|
206
|
+
|
|
207
|
+
| Layer | Tech |
|
|
208
|
+
|-------|------|
|
|
209
|
+
| Runtime | Bun / Node |
|
|
210
|
+
| Language | TypeScript + Zod |
|
|
211
|
+
| Framework | Hono (API) + Vite + React 19 |
|
|
212
|
+
| Database | Kysely → SQLite / PostgreSQL |
|
|
213
|
+
| Auth | Better Auth (OAuth 2.1 + API keys) |
|
|
214
|
+
| Observability | OpenTelemetry |
|
|
215
|
+
| UI | React 19 + Tailwind v4 + shadcn |
|
|
216
|
+
| Protocol | Model Context Protocol (MCP) |
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Comparison
|
|
221
|
+
|
|
222
|
+
### vs Mastra
|
|
223
|
+
|
|
224
|
+
| | **Mastra** | **MCP Mesh** |
|
|
225
|
+
|---|---|---|
|
|
226
|
+
| Category | TypeScript agent/workflow framework | MCP control plane + runtime |
|
|
227
|
+
| Focus | Build agent primitives, RAG, workflows | Route, govern, and observe MCP traffic |
|
|
228
|
+
| Protocol | Model/provider-agnostic | MCP-native |
|
|
229
|
+
| Auth | Framework-level | OAuth 2.1 + RBAC + API keys |
|
|
230
|
+
| Observability | Tracing/evals at framework level | End-to-end OpenTelemetry |
|
|
231
|
+
| Deployment | Node.js / serverless | Docker / Bun / Self-host |
|
|
232
|
+
|
|
233
|
+
### vs Metorial
|
|
234
|
+
|
|
235
|
+
| | **Metorial** | **MCP Mesh** |
|
|
236
|
+
|---|---|---|
|
|
237
|
+
| Focus | Connect AI to APIs | Control plane for MCP traffic |
|
|
238
|
+
| Language | Go + TS | 100% TypeScript |
|
|
239
|
+
| Infra | Docker | Docker / Bun / Self-host |
|
|
240
|
+
| Auth | API keys | OAuth 2.1 + RBAC + spend caps |
|
|
241
|
+
| Observability | Dashboard | Full OpenTelemetry |
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Roadmap
|
|
246
|
+
|
|
247
|
+
- [ ] Multi-tenant admin dashboard
|
|
248
|
+
- [ ] Runtime strategies (smart routing, code execution)
|
|
249
|
+
- [ ] MCP bindings (swap providers without rewrites)
|
|
250
|
+
- [ ] Edge debugger / live tracing
|
|
251
|
+
- [ ] Cost analytics and spend caps
|
|
252
|
+
- [ ] MCP Store — discover and install pre-built MCP apps
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## Part of decoCMS
|
|
257
|
+
|
|
258
|
+
MCP Mesh is the core infrastructure layer of [decoCMS](https://decocms.com).
|
|
259
|
+
|
|
260
|
+
| Layer | What it does |
|
|
261
|
+
|-------|--------------|
|
|
262
|
+
| **MCP Mesh** | Connect, govern, and observe MCP traffic |
|
|
263
|
+
| **MCP Studio** | Build MCP capabilities (no-code admin + SDK) |
|
|
264
|
+
| **MCP Store** | Discover and install pre-built MCP apps |
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## License
|
|
269
|
+
|
|
270
|
+
MCP Mesh ships with a **Sustainable Use License (SUL)**. See [LICENSE.md](./LICENSE.md).
|
|
271
|
+
|
|
272
|
+
- ✅ Free to self-host for internal use
|
|
273
|
+
- ✅ Free for client projects (agencies, consultancies, SIs)
|
|
274
|
+
- ⚠️ Commercial license required for SaaS or revenue-generating production systems
|
|
275
|
+
|
|
276
|
+
Questions? [contact@decocms.com](mailto:contact@decocms.com)
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## Contributing
|
|
281
|
+
|
|
282
|
+
We welcome contributions! Run the following before submitting a PR:
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
bun run fmt # Format code
|
|
286
|
+
bun run lint # Check linting
|
|
287
|
+
bun test # Run tests
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
See `AGENTS.md` for detailed coding guidelines and conventions.
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
<div align="center">
|
|
295
|
+
<sub>Made with ❤️ by the <a href="https://decocms.com">deco</a> community</sub>
|
|
296
|
+
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
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-
|
|
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-MoI-rvC3.js";import{c as p}from"./utils-BLlwSV8I.js";import{b as v}from"./button-G3aMPyFq.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.
|
|
2
2
|
|
|
3
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.
|
|
4
4
|
|
|
@@ -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-B5e6fytH.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{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-MoI-rvC3.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 +1 @@
|
|
|
1
|
-
import{c as r,d as m,j as n,A as o}from"./index-
|
|
1
|
+
import{c as r,d as m,j as n,A as o}from"./index-MoI-rvC3.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-
|
|
1
|
+
import{c as k,j as i,r as V,af as R,au as $,av as O,aw as U}from"./index-MoI-rvC3.js";import{c as m}from"./utils-BLlwSV8I.js";import{I as L}from"./icon-Cxep_tfx.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-
|
|
1
|
+
import{c as d,af as u,j as l,ag as v}from"./index-MoI-rvC3.js";import{c as g}from"./utils-BLlwSV8I.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-
|
|
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-MoI-rvC3.js";import{c as E}from"./utils-BLlwSV8I.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-
|
|
1
|
+
import{c as l,j as c}from"./index-MoI-rvC3.js";import{c as d}from"./utils-BLlwSV8I.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-
|
|
1
|
+
import{c as d,j as c,b9 as n,ba as l}from"./index-MoI-rvC3.js";import{c as m}from"./utils-BLlwSV8I.js";import{f as b}from"./select-B4j1Cb8E.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-
|
|
1
|
+
import{b6 as e}from"./index-MoI-rvC3.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};
|