@polyxd/mcp 0.4.3 → 0.4.4
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/docs.generated.js +4 -4
- package/dist/docs.generated.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/dist/view.html +1 -1
- package/package.json +5 -5
package/dist/docs.generated.js
CHANGED
|
@@ -150,7 +150,7 @@ export const DOCS = [
|
|
|
150
150
|
"section": "Guides",
|
|
151
151
|
"order": 21.5,
|
|
152
152
|
"url": "https://polyxd.com/docs/mcp/",
|
|
153
|
-
"markdown": "`@polyxd/mcp` is an [MCP](https://modelcontextprotocol.io) server. The model in the host is the generator. The server gives it the spec as instructions and checks the documents it writes. Then it shows each one to the user as an **MCP App**: a real screen, drawn by the Polyxd renderer in the design-system pack the model picks. When the user presses a button in that screen, the model hears about it.\n\nIt runs two ways. Polyxd hosts it at `https://mcp.polyxd.com/mcp`, so you can connect by URL. Or you run it on your own machine over stdio:\n\n```sh\nnpx -y @polyxd/mcp\n```\n\n## Connect by URL\n\nThe hosted server is at this address:\n\n```\nhttps://mcp.polyxd.com/mcp\n```\n\nIt is listed in the official [MCP Registry](https://registry.modelcontextprotocol.io/v0/servers?search=com.polyxd) as `com.polyxd/mcp`, so apps that read the registry can find it by name.\n\nIt needs no account and no sign-in. Every tool is read-only. The server keeps nothing between requests, and it never sees your conversation, only the documents the model sends to its tools.\n\n**Claude.** In claude.ai, open **Customize > Connectors** and click **Add custom connector**. Paste the URL, choose **No sign-in** if Claude asks about authentication, and click **Add**. Then turn the connector on for a chat from **+ > Connectors**. On the Free plan you can add one custom connector.\n\n**Claude Desktop.** Claude Desktop uses the connectors on your claude.ai account, so add it in claude.ai as above and it shows up in the app too.\n\n**Claude Code.**\n\n```sh\nclaude mcp add --transport http polyxd https://mcp.polyxd.com/mcp\n```\n\n**ChatGPT.** Custom servers need developer mode. Open **Settings > Security and login** and turn on **Developer mode**. Then go to [chatgpt.com/plugins](https://chatgpt.com/plugins) and select the plus button. Give it a name, such as Polyxd, and enter the URL under **Connection**. The server needs no authentication. Your workspace's policy decides whether developer mode is available to you.\n\n**Cursor.**
|
|
153
|
+
"markdown": "`@polyxd/mcp` is an [MCP](https://modelcontextprotocol.io) server. The model in the host is the generator. The server gives it the spec as instructions and checks the documents it writes. Then it shows each one to the user as an **MCP App**: a real screen, drawn by the Polyxd renderer in the design-system pack the model picks. When the user presses a button in that screen, the model hears about it.\n\nIt runs two ways. Polyxd hosts it at `https://mcp.polyxd.com/mcp`, so you can connect by URL. Or you run it on your own machine over stdio:\n\n```sh\nnpx -y @polyxd/mcp\n```\n\n## Connect by URL\n\nThe hosted server is at this address:\n\n```\nhttps://mcp.polyxd.com/mcp\n```\n\nIt is listed in the official [MCP Registry](https://registry.modelcontextprotocol.io/v0/servers?search=com.polyxd) as `com.polyxd/mcp`, so apps that read the registry can find it by name.\n\nIt needs no account and no sign-in. Every tool is read-only. The server keeps nothing between requests, and it never sees your conversation, only the documents the model sends to its tools.\n\n**Claude.** In claude.ai, open **Customize > Connectors** and click **Add custom connector**. Paste the URL, choose **No sign-in** if Claude asks about authentication, and click **Add**. Then turn the connector on for a chat from **+ > Connectors**. On the Free plan you can add one custom connector.\n\n**Claude Desktop.** Claude Desktop uses the connectors on your claude.ai account, so add it in claude.ai as above and it shows up in the app too.\n\n**Claude Code.**\n\n```sh\nclaude mcp add --transport http polyxd https://mcp.polyxd.com/mcp\n```\n\n**ChatGPT.** Custom servers need developer mode. Open **Settings > Security and login** and turn on **Developer mode**. Then go to [chatgpt.com/plugins](https://chatgpt.com/plugins) and select the plus button. Give it a name, such as Polyxd, and enter the URL under **Connection**. The server needs no authentication. Your workspace's policy decides whether developer mode is available to you.\n\n**Cursor.** Install the [Polyxd extension](https://polyxd.com/docs/vscode/) from Open VSX and the server is added for you. Or add this to `~/.cursor/mcp.json`, or to `.cursor/mcp.json` in a project:\n\n```json\n{\n \"mcpServers\": {\n \"polyxd\": { \"url\": \"https://mcp.polyxd.com/mcp\" }\n }\n}\n```\n\n**VS Code.** Install the [Polyxd extension](https://polyxd.com/docs/vscode/) and the server is in agent mode's tools (VS Code 1.101 or later). Or add this to `.vscode/mcp.json` in a workspace, or run **MCP: Add Server** and choose HTTP:\n\n```json\n{\n \"servers\": {\n \"polyxd\": { \"type\": \"http\", \"url\": \"https://mcp.polyxd.com/mcp\" }\n }\n}\n```\n\n**Grok.** At [grok.com/connectors](https://grok.com/connectors), choose **New Connector**, then **Custom**, and paste the URL. It needs no sign-in. We haven't confirmed that Grok draws MCP Apps; where a client doesn't, `polyxd_show` still answers with a text summary of the screen, and every other tool works as usual. Developers calling the xAI API can pass the same URL as a [remote MCP tool](https://docs.x.ai/developers/tools/remote-mcp).\n\n**Other clients.** Any client that speaks MCP's Streamable HTTP transport can use the URL. A client that can only start local commands can run the stdio server instead, below.\n\nThe hosted server takes request bodies up to 1 MB and answers within 15 seconds. One address can make 600 requests a minute. For each request it logs the method, the path, the status and how long it took. It never logs what you send.\n\nThe hosted server also counts its use, anonymously, in PostHog. When a client connects, it counts the client's name and version and the protocol version. For each tool call, it counts the tool, whether it worked and the kind of error, the pack and mode of a shown screen, how many of each component type the document used, how many errors and warnings came back, how long it took, and the product name from the User-Agent. Each event has a new random id. It never sends the document, its data, a Direction, the IP address or anything from your conversation. The [privacy policy](https://polyxd.com/privacy/#the-hosted-mcp-server) has the details. The server you run yourself, below, sends nothing anywhere.\n\n## Run it on your machine\n\n**Claude Desktop.** Add the server to `claude_desktop_config.json`, then restart Claude Desktop:\n\n```json\n{\n \"mcpServers\": {\n \"polyxd\": { \"command\": \"npx\", \"args\": [\"-y\", \"@polyxd/mcp\"] }\n }\n}\n```\n\n**Claude Code.**\n\n```sh\nclaude mcp add polyxd -- npx -y @polyxd/mcp\n```\n\n**Other MCP clients.** Use the same command and arguments: `npx`, with `-y @polyxd/mcp`. The screen shows in hosts that support MCP Apps. Other hosts get a text summary instead, and every tool still works.\n\n**From a clone.** To run your own changes, clone the [repository](https://github.com/visualfart/polyxd), run `npm install && npm run build -w @polyxd/mcp`, then use `node <repo>/packages/mcp/dist/bin.js` as the command.\n\n## The tools\n\nAll six are read-only.\n\n| Tool | What it does |\n|---|---|\n| `polyxd_guide` | The spec as instructions. First, how to use these tools. Then the generator prompt the [demos](https://polyxd.com/demos/) use: the document shape, the rules for generated screens, bindings, actions, every component with its props, and the patterns. |\n| `polyxd_validate` | Validates a document. Each issue has a JSON Pointer, the component it is in, and a hint saying what to change. |\n| `polyxd_verify` | The [verifier](https://polyxd.com/docs/verifier/)'s document checks, as a short report. Pass a [Design Direction](https://polyxd.com/docs/design-direction/) to check its rules and voice too: the object itself, or the name of an example (`calm-finance`, `playful-personal`). A capability registry is optional. |\n| `polyxd_show` | Validates the document, then shows it. `pack` picks the design system (default `material3`). `mode` picks light or dark (default: the host's theme). A document with errors is not shown. |\n| `polyxd_packs` | Every pack: the published design systems and the original templates. |\n| `polyxd_components` | Every component with a one-line summary, or one component's full definition by `name`. |\n| `polyxd_docs` | The polyxd.com docs, as of the server's version: the sections that best match a `query`, one whole `page`, or the list of pages, each with its URL to cite. |\n\n`polyxd_validate`, `polyxd_verify` and `polyxd_show` also take `data`: the values the screen shows. It replaces the document's own `data`.\n\nEvery tool also returns its result as structured data, and says what that data looks like: each declares an output schema. `polyxd_validate` gives `valid`, the counts and every issue with its pointer and hint. `polyxd_verify` gives the counts and the findings. `polyxd_show` gives the document as shown, with the pack, or `shown: false` and the issues. `polyxd_guide` gives the guide's text and the spec version.\n\n`polyxd_verify` runs the document checks only, from `@polyxd/verifier/static`, so installing the server installs no Playwright and no browser. The rendered checks (accessibility, layout and agent tasks) need a browser, so run [`polyxd-verify`](https://polyxd.com/docs/verifier/) for those.\n\nThe server also lists the spec's example documents as resources (`polyxd://examples/<name>.json`), and the example Design Directions (`polyxd://directions/<name>.json`).\n\n## The MCP App\n\n`polyxd_show` points at one UI resource, `ui://polyxd/surface.html`, in its `_meta.ui.resourceUri`. That is how the [MCP Apps](https://github.com/modelcontextprotocol/ext-apps) extension links a tool to a screen. The host loads the page in a sandboxed iframe.\n\nThe page holds the [Web Components renderer](https://polyxd.com/docs/renderers/), its stylesheet and every pack's theme. Nothing loads from anywhere else, so the host's strictest content rules are enough. The resource says so: its `_meta.ui.csp` lists no domains at all. It also asks for a border (`prefersBorder`). ChatGPT reads its own names for the same things (`openai/widgetCSP`, `openai/widgetDomain` and the rest), and the resource carries those too, so the screen shows there as well.\n\nThe page talks to the host over `postMessage`, as the MCP Apps spec says. It sends `ui/initialize` and `ui/notifications/initialized`. It renders the document from the tool result, in the chosen pack. It follows the host's light or dark theme unless the model set `mode`. It tells the host its height so the frame fits.\n\n## When the user acts\n\nWhen the user presses an action, the page sends the host a `ui/message`. That is a chat message from the user. It names the action and the button's label, and it carries the action's context. The context holds the values bound into the action, including what the user typed:\n\n```\n[Polyxd] In the \"New task\" screen I pressed \"Add task\" (action task.save).\nContext: {\"title\":\"Buy milk\",\"due\":\"2026-10-01\"}\n```\n\nThe model reads it as the user's next message and acts on it. Closing the screen (`ui.dismiss`) arrives the same way. Nothing else happens on its own: the server never runs an action.\n\nNobody registers capabilities with this server. So the guide tells the model to name each action for what it will do when the action arrives, such as `task.save` or `booking.cancel`.\n\n## The prompt\n\nThe guide uses the same generator prompt as the [runtime](https://polyxd.com/docs/runtime), built from the spec, so a model writing screens over MCP gets the same instructions as one the runtime drives."
|
|
154
154
|
},
|
|
155
155
|
{
|
|
156
156
|
"slug": "vscode",
|
|
@@ -159,7 +159,7 @@ export const DOCS = [
|
|
|
159
159
|
"section": "Guides",
|
|
160
160
|
"order": 21.6,
|
|
161
161
|
"url": "https://polyxd.com/docs/vscode/",
|
|
162
|
-
"markdown": "The **Polyxd** extension puts the check and the preview next to the document you're writing. You see a mistake where you made it, and the screen as it will look, without a server to start. It runs in VS Code, Cursor, VSCodium and Windsurf.\n\n\n\n## Install it\n\nSearch for **Polyxd** in the Extensions view, or install it from the command line:\n\n```sh\ncode --install-extension Polyxd.polyxd-vscode\n```\n\n- **VS Code:** [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=Polyxd.polyxd-vscode)\n- **Cursor, VSCodium and Windsurf:** [Open VSX](https://open-vsx.org/extension/polyxd/polyxd-vscode)\n\nTo build it from the repository instead:\n\n```sh\ngit clone https://github.com/visualfart/polyxd && cd polyxd\nnpm ci\nnpm run build -w @polyxd/core && npm run build:preview -w @polyxd/react\nnpm run package -w polyxd-vscode\ncode --install-extension apps/vscode/polyxd-vscode-0.
|
|
162
|
+
"markdown": "The **Polyxd** extension puts the check and the preview next to the document you're writing. You see a mistake where you made it, and the screen as it will look, without a server to start. It runs in VS Code, Cursor, VSCodium and Windsurf.\n\n\n\n## Install it\n\nSearch for **Polyxd** in the Extensions view, or install it from the command line:\n\n```sh\ncode --install-extension Polyxd.polyxd-vscode\n```\n\n- **VS Code:** [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=Polyxd.polyxd-vscode)\n- **Cursor, VSCodium and Windsurf:** [Open VSX](https://open-vsx.org/extension/polyxd/polyxd-vscode)\n\nTo build it from the repository instead:\n\n```sh\ngit clone https://github.com/visualfart/polyxd && cd polyxd\nnpm ci\nnpm run build -w @polyxd/core && npm run build:preview -w @polyxd/react\nnpm run package -w polyxd-vscode\ncode --install-extension apps/vscode/polyxd-vscode-0.4.4.vsix # or: cursor --install-extension …\n```\n\nIn Cursor, VSCodium and Windsurf you can also use **Extensions → … → Install from VSIX**.\n\n## What you get\n\n- **The schema, without configuration.** Files named `*.polyxd.json`, or kept in `authored/`, `intents/` or `screens/`, get completion, hover text and squiggles from the spec's JSON Schema. The schema is bundled. An intent file is checked inside its `document`. A file anywhere else needs only the `$schema` line: `\"$schema\": \"https://polyxd.com/schema/0.3/ui.schema.json\"`.\n- **The static check as you type.** The spec's validator runs on each edit and on save, against the document's own `data` or the `<name>.data.json` beside it. A structural problem is an error. A binding that reads nothing is a warning with a \"did you mean\". Each one is underlined at its line.\n- **A preview beside the editor.** Run **Polyxd: Open preview**, or use the icon in a document's title bar. It renders with the real renderer, in any of the thirteen packs or your own (the `polyxd.pack` setting takes a `manifest.json` or a theme stylesheet). Light or dark follows your editor until you pick one. Phone, tablet, desktop, or drag the edge. Compact to spacious. It updates as you type and keeps the surface mounted, so what you typed into an input survives a keystroke in the JSON.\n- **Both ways between JSON and screen.** Click a component in the preview and the cursor goes to its JSON. Put the cursor in a component's JSON and the preview outlines it.\n- **An action log.** Actions the surface dispatches show under the preview, with their context filled in from the data.\n- **Polyxd documents** in the Explorer: every document in the workspace by folder, with the check's status as a dot.\n- **The Polyxd MCP server for your agent.** In Cursor, and in VS Code 1.101 or later, the extension adds the [MCP server](https://polyxd.com/docs/mcp/) (`https://mcp.polyxd.com/mcp`) to the agent's tools. There's no `mcp.json` to edit. In VS Code it shows in **MCP: List Servers**. The `polyxd.mcp.enabled` setting turns it off.\n\n\n\n## Commands\n\n- **Verify document** runs `polyxd-verify` from your workspace in a terminal: every pack, light and dark, 390 and 1100 wide. Install it first with `npm install -D @polyxd/verifier playwright && npx playwright install chromium`, or the command runs it through `npx`. See [Verifier](https://polyxd.com/docs/verifier/).\n- **Insert component** offers the 44 components by category, each with the spec's one-line summary. It drops a valid skeleton at the cursor with tab stops on the placeholders.\n- **Open in Studio** copies the document and opens [Studio](https://polyxd.com/docs/studio/), where \"Paste JSON\" makes a screen of it.\n- **Push to Studio** runs `polyxd studio push` with a key from `POLYXD_STUDIO_KEY` or the editor's secret storage (**Set Studio API key**). The key is never kept in a settings file.\n\n\n\n## Settings\n\n| Setting | What it does |\n|---|---|\n| `polyxd.defaultPack` | The pack the preview opens with. `material3` unless you set it. |\n| `polyxd.pack` | Your own pack for the preview's switcher: a `manifest.json` written by `polyxd pack`, or a compiled theme stylesheet. Relative to the workspace folder. |\n| `polyxd.mcp.enabled` | Offer the Polyxd MCP server to Cursor's agent and VS Code's agent mode. On unless you turn it off. |\n| `polyxd.studio.workspaceUrl` | Your Studio workspace's API base, `https://studio.polyxd.com/api/w/<workspace>`, for **Push to Studio**. |\n\n## Privacy\n\nThe extension collects no telemetry. The check and the preview run on your machine from files inside the extension. It reaches the network only when you ask: **Open in Studio** opens your browser, **Push to Studio** uploads the document to your workspace, and **Verify document** may fetch the verifier from npm. The preview shows images from `https` URLs your document names. When Cursor's agent or VS Code's agent mode uses a Polyxd tool, the editor calls mcp.polyxd.com.\n\n\n\n## Without the extension\n\n`npx polyxd dev ./screens` gives you the same preview and check in a browser tab, for any editor. See [Your design system](https://polyxd.com/docs/your-design-system/#preview-documents-as-you-write-them)."
|
|
163
163
|
},
|
|
164
164
|
{
|
|
165
165
|
"slug": "server",
|
|
@@ -168,7 +168,7 @@ export const DOCS = [
|
|
|
168
168
|
"section": "Guides",
|
|
169
169
|
"order": 21.7,
|
|
170
170
|
"url": "https://polyxd.com/docs/server/",
|
|
171
|
-
"markdown": "`@polyxd/server` is the [runtime](https://polyxd.com/docs/runtime) behind a small HTTP API. Your app sends an ask. The server builds the prompt from the spec and your [Design Direction](https://polyxd.com/docs/design-direction), calls the model you chose, checks the answer, sends problems back for repair, and returns the document. It can stream as it goes.\n\nUse it when the model key must stay on a server, or when the code that wants a screen isn't JavaScript. It keeps no state between requests and logs nothing from them but the method, path, status and duration.\n\nIt is on npm as `@polyxd/server`, and its Docker image is on GitHub Container Registry as `ghcr.io/visualfart/polyxd-server`.\n\n## Run it with Docker\n\n```sh\ndocker run --rm -p 8080:8080 \\\n -e POLYXD_PROVIDER=anthropic \\\n -e ANTHROPIC_API_KEY \\\n ghcr.io/visualfart/polyxd-server:0.4.3\n```\n\nTo build the image yourself, from a clone of the [repository](https://github.com/visualfart/polyxd):\n\n```sh\ndocker build -f packages/server/Dockerfile -t polyxd-server .\n```\n\n`-e ANTHROPIC_API_KEY` with no value passes the key from your shell, so it isn't written in the command. The image runs Node 26 as an unprivileged user, listens on port 8080, and has a health check on `/v1/health`. It contains the server and its production dependencies only: no Playwright and no browser.\n\nTo give it your Design Direction and capability registry, mount them and point at them:\n\n```sh\ndocker run --rm -p 8080:8080 \\\n -e POLYXD_PROVIDER=openai -e POLYXD_MODEL=your-model-id -e OPENAI_API_KEY \\\n -e POLYXD_DIRECTION=/config/direction.json \\\n -e POLYXD_REGISTRY=/config/capabilities.json \\\n -e POLYXD_SERVER_TOKEN \\\n -v \"$PWD/config:/config:ro\" \\\n polyxd-server\n```\n\nA model on your own machine works too. From inside a container, the host is `host.docker.internal` on Docker Desktop:\n\n```sh\ndocker run --rm -p 8080:8080 \\\n -e POLYXD_PROVIDER=local -e POLYXD_MODEL=qwen3:8b \\\n -e POLYXD_BASE_URL=http://host.docker.internal:11434/v1 \\\n polyxd-server\n```\n\n## Run it with npx\n\nOnce it is on npm:\n\n```sh\nPOLYXD_PROVIDER=anthropic ANTHROPIC_API_KEY=... npx @polyxd/server\n```\n\nUntil then, from a clone: `npm install && npm run build -w @polyxd/server`, then `node packages/server/dist/bin.js` with the same settings. `--help` lists them.\n\nOutside Docker it listens on `127.0.0.1` only, so nothing else on the network can reach it. Set `HOST=0.0.0.0` to change that.\n\n## Settings\n\nEverything is set by environment variables. A missing or wrong setting stops the server at start, with a message that says what to set.\n\n| Variable | What it sets |\n|---|---|\n| `POLYXD_PROVIDER` | `anthropic`, `openai`, `gemini` or `local`. Required |\n| `POLYXD_MODEL` | The model id. Required, except for `anthropic`, which defaults to `claude-sonnet-5` |\n| `POLYXD_API_KEY` | The provider's key. `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY` or `GOOGLE_API_KEY` work too; `POLYXD_API_KEY` wins. `local` needs none |\n| `POLYXD_BASE_URL` | The provider's base URL. For `local`, your server (default `http://localhost:11434/v1`, Ollama). For the others, a proxy, which may add the key itself |\n| `POLYXD_DIRECTION` | Path to your Design Direction. Exemplars it names by path are read relative to it |\n| `POLYXD_REGISTRY` | Path to your capability registry, so callers can offer capabilities by name |\n| `POLYXD_SERVER_TOKEN` | When set, every endpoint but `/v1/health` needs `Authorization: Bearer <token>` |\n| `POLYXD_CORS_ORIGINS` | Origins a browser may call from, comma-separated, or `*`. Default none |\n| `POLYXD_MAX_BODY_BYTES` | The largest request body. Default 1048576 (1 MiB) |\n| `POLYXD_TIMEOUT_MS` | The longest one generation may take. Default 120000 |\n| `POLYXD_MAX_REPAIRS` | How many times a failed answer goes back to the model. Default 2 |\n| `PORT`, `HOST` | Where to listen. Default `8080` on `127.0.0.1`; the Docker image sets `0.0.0.0` |\n\nThe key goes to the provider and nowhere else. The server never prints or logs it.\n\n## Endpoints\n\n| Endpoint | What it does |\n|---|---|\n| `POST /v1/generate` | Generates a document for an ask. Returns JSON, or streams with `Accept: text/event-stream` |\n| `POST /v1/validate` | The spec validator on a document |\n| `POST /v1/verify` | The [verifier's](https://polyxd.com/docs/verifier) document checks on a document, with your Direction's rules and your registry |\n| `GET /v1/spec` | The server and spec versions, the components a generated screen may use, the patterns, your Direction's name and your capabilities' names |\n| `GET /v1/health` | `{ \"status\": \"ok\", \"version\" }`. Never needs a token |\n\nEvery body is JSON, sent with `Content-Type: application/json`. An error is `{ \"error\": { \"code\", \"message\" } }` with a status that fits: 400 for a body that isn't right (the message says what to fix, and unknown fields are refused so a typo doesn't pass silently), 401 without the token, 403 from an origin that isn't allowed, 404, 405, 413 for a body over the limit, and 415 for a body that isn't JSON.\n\n### Generate\n\n```sh\ncurl http://localhost:8080/v1/generate \\\n -H 'content-type: application/json' \\\n -H \"authorization: Bearer $POLYXD_SERVER_TOKEN\" \\\n -d '{\n \"ask\": \"Send £250 to Alex for the rent\",\n \"intent\": \"money.send\",\n \"capabilities\": [\"transfer.confirm\"],\n \"data\": { \"quote\": { \"id\": \"q_1\", \"amount\": 250, \"currency\": \"GBP\", \"recipient\": \"Alex Kim\" } }\n }'\n```\n\n| Field | What it is |\n|---|---|\n| `ask` | What the person asked, in their words. Required |\n| `intent` | A stable key for what they're trying to do, such as `money.send`. Required |\n| `capabilities` | What the screen may trigger: names from the server's registry, or an object of full capability definitions by name. Leave it out and the screen can offer none |\n| `data` | The host data the screen binds to. The document is checked against it |\n| `pattern` | A spec pattern the screen should follow, when you already know |\n\nThe answer is `{ document, report, attempts, usage }`, as the runtime returns it. `report` has `valid`, `errors`, `warnings` and the `findings`.\n\n| Status | When |\n|---|---|\n| 200 | The document passed its checks |\n| 422 | Every repair failed. The body still has the last `document` and its `report`, plus an `error` with code `invalid`, so you can show a fallback |\n| 502 | The model provider failed. `error` has code `generator`, the `provider` and its HTTP `status` (a 401 is a bad key, a 429 a rate limit). The provider's own words are not passed on |\n| 504 | No document within `POLYXD_TIMEOUT_MS`. Code `timeout` |\n\nIf the caller disconnects, the model call is aborted, so an abandoned request stops costing tokens.\n\n### Streaming\n\nSend `Accept: text/event-stream` to get the runtime's progress as [server-sent events](https://html.spec.whatwg.org/multipage/server-sent-events.html). Each event is one `event:` line and one `data:` line of JSON:\n\n```\nevent: started\ndata: {\"remembered\":false,\"exemplars\":0}\n\nevent: text\ndata: {\"attempt\":1,\"text\":\"{\\\"specVersion\\\":\\\"0.3.0\\\",\"}\n\nevent: attempt\ndata: {\"attempt\":1,\"report\":{\"valid\":true,\"errors\":0,\"warnings\":0,\"findings\":[]}}\n\nevent: done\ndata: {\"document\":{...},\"report\":{...},\"attempts\":1,\"usage\":{\"inputTokens\":3200,\"outputTokens\":900}}\n```\n\n| Event | Data |\n|---|---|\n| `started` | `remembered` and `exemplars`, once |\n| `text` | `attempt` and a piece of the model's `text` |\n| `attempt` | `attempt` and the `report` on that answer |\n| `repaired` | `attempt` and `report`, when an answer passes after a repair |\n| `done` | Last: `{ document, report, attempts, usage }`, the same as the JSON answer |\n| `error` | Last, instead of `done`: `code` (`invalid`, `generator`, `timeout`, `setup` or `aborted`), a `message`, the provider's `status` when there is one, and the `result` when the runtime gave up |\n\nThe status is 200 once streaming starts, so read the last event to know how it ended. While the model thinks, the server sends a `: keep-alive` comment every 15 seconds so proxies keep the connection open. Closing the connection aborts the model call.\n\n`EventSource` only sends GET, so read the stream with `fetch`:\n\n```ts\nconst res = await fetch(`${server}/v1/generate`, {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\", accept: \"text/event-stream\", authorization: `Bearer ${token}` },\n body: JSON.stringify({ ask, intent, capabilities, data }),\n});\nconst reader = res.body!.pipeThrough(new TextDecoderStream()).getReader();\nlet buffer = \"\";\nfor (;;) {\n const { value, done } = await reader.read();\n if (done) break;\n buffer += value;\n let end;\n while ((end = buffer.indexOf(\"\\n\\n\")) >= 0) {\n const block = buffer.slice(0, end);\n buffer = buffer.slice(end + 2);\n const event = /^event: (.*)$/m.exec(block)?.[1];\n const data = /^data: (.*)$/m.exec(block)?.[1];\n if (event === \"done\") show(JSON.parse(data!).document);\n if (event === \"error\") showFallback(JSON.parse(data!).code);\n }\n}\n```\n\n### Validate and verify\n\nBoth take `{ document, data? }`. `data` replaces the document's own data.\n\n`/v1/validate` runs the spec validator, with your Direction's `emphasisBudget`, and returns `{ valid, errors, warnings, issues }`. Each issue has a `severity`, a JSON Pointer `at`, and a `message`.\n\n`/v1/verify` runs the verifier's document checks from `@polyxd/verifier/static`: the validator, the declared pattern, capabilities, your Direction's rules and voice, and the agent-readiness checks. It checks capabilities against your whole registry, or against `capabilities` in the body if you send them. It returns `{ valid, errors, warnings, findings }`. The rendered checks need a browser, so run [`polyxd-verify`](https://polyxd.com/docs/verifier/) for those.\n\n## Callers and browsers\n\n- **Token.** Set `POLYXD_SERVER_TOKEN` and send `Authorization: Bearer <token>`. The comparison takes the same time whatever the token, so it can't be guessed a character at a time. Only `/v1/health` is open, for load balancers and the Docker health check.\n- **CORS.** By default no browser page can call the server. `POLYXD_CORS_ORIGINS` names the origins that can. A request from any other origin gets a 403, before any model call. `*` allows every origin; use it only with a token, or on a private network.\n- **Limits.** Bodies over `POLYXD_MAX_BODY_BYTES` are refused, whether or not they say their length. A generation that runs past `POLYXD_TIMEOUT_MS` is aborted.\n\nA token in a web page is readable by anyone who opens the page. For a browser app, call the server from your own backend, or put it behind the sign-in your product already has.\n\n## Privacy\n\nThe server logs one JSON line per request with four fields:\n\n```\n{\"method\":\"POST\",\"path\":\"/v1/generate\",\"status\":200,\"ms\":2140}\n```\n\nIt never logs the ask, the data, the document, a header or a query string. It keeps nothing between requests: no interface memory, no history. Error messages it sends never repeat what the provider said, so a provider's answer can't leak into your client. The package sends no telemetry.\n\nThe model provider does see the ask and the data, as it would with the runtime. Choose `local` to keep them on your own machines.\n\n## From code\n\nThe server is also a library, for tests or to run it inside your own Node process:\n\n```ts\nimport { createServer, configFromEnv } from \"@polyxd/server\";\nimport { anthropic } from \"@polyxd/runtime\";\n\nconst server = createServer({\n generator: anthropic({ apiKey: process.env.ANTHROPIC_API_KEY }),\n direction, // your direction.json, parsed\n registry, // your capability registry, parsed\n token: process.env.POLYXD_SERVER_TOKEN,\n});\nserver.listen(8080);\n```\n\n`createServer` returns a Node `http.Server` and takes the settings above as options (`token`, `corsOrigins`, `maxBodyBytes`, `timeoutMs`, `maxRepairs`, `resolveExemplar`), plus `runtime` in place of `generator` if you built one yourself, and `log` to send the log lines somewhere else. The server's own tests pass a fake generator this way, with no network and no key.\n\n| Export | What it does |\n|---|---|\n| `createServer(options)` | The server, as a Node `http.Server` |\n| `configFromEnv(env)` | Every setting from environment variables, as the bin reads them. Throws a `ConfigError` that says what to fix |\n| `generatorFromEnv(env)` | Just the generator, from `POLYXD_PROVIDER`, `POLYXD_MODEL`, the key and `POLYXD_BASE_URL` |\n| `ConfigError` | What `configFromEnv` throws |\n| `PROVIDERS` | The providers `POLYXD_PROVIDER` accepts |\n| `ENV_HELP` | The text `--help` prints |\n| `VERSION` | The server's version |\n\n## Not yet\n\n- On npm and on GitHub Container Registry. The release workflow builds the image and pushes it on a version tag, once `@polyxd/server` has been published.\n- Interface memory. The runtime can remember the screen per intent, but a server shared by many people would mix theirs up, so the server keeps none.\n- Rate limiting per caller. Put the server behind a gateway or proxy that does it."
|
|
171
|
+
"markdown": "`@polyxd/server` is the [runtime](https://polyxd.com/docs/runtime) behind a small HTTP API. Your app sends an ask. The server builds the prompt from the spec and your [Design Direction](https://polyxd.com/docs/design-direction), calls the model you chose, checks the answer, sends problems back for repair, and returns the document. It can stream as it goes.\n\nUse it when the model key must stay on a server, or when the code that wants a screen isn't JavaScript. It keeps no state between requests and logs nothing from them but the method, path, status and duration.\n\nIt is on npm as `@polyxd/server`, and its Docker image is on GitHub Container Registry as `ghcr.io/visualfart/polyxd-server`.\n\n## Run it with Docker\n\n```sh\ndocker run --rm -p 8080:8080 \\\n -e POLYXD_PROVIDER=anthropic \\\n -e ANTHROPIC_API_KEY \\\n ghcr.io/visualfart/polyxd-server:0.4.4\n```\n\nTo build the image yourself, from a clone of the [repository](https://github.com/visualfart/polyxd):\n\n```sh\ndocker build -f packages/server/Dockerfile -t polyxd-server .\n```\n\n`-e ANTHROPIC_API_KEY` with no value passes the key from your shell, so it isn't written in the command. The image runs Node 26 as an unprivileged user, listens on port 8080, and has a health check on `/v1/health`. It contains the server and its production dependencies only: no Playwright and no browser.\n\nTo give it your Design Direction and capability registry, mount them and point at them:\n\n```sh\ndocker run --rm -p 8080:8080 \\\n -e POLYXD_PROVIDER=openai -e POLYXD_MODEL=your-model-id -e OPENAI_API_KEY \\\n -e POLYXD_DIRECTION=/config/direction.json \\\n -e POLYXD_REGISTRY=/config/capabilities.json \\\n -e POLYXD_SERVER_TOKEN \\\n -v \"$PWD/config:/config:ro\" \\\n polyxd-server\n```\n\nA model on your own machine works too. From inside a container, the host is `host.docker.internal` on Docker Desktop:\n\n```sh\ndocker run --rm -p 8080:8080 \\\n -e POLYXD_PROVIDER=local -e POLYXD_MODEL=qwen3:8b \\\n -e POLYXD_BASE_URL=http://host.docker.internal:11434/v1 \\\n polyxd-server\n```\n\n## Run it with npx\n\nOnce it is on npm:\n\n```sh\nPOLYXD_PROVIDER=anthropic ANTHROPIC_API_KEY=... npx @polyxd/server\n```\n\nUntil then, from a clone: `npm install && npm run build -w @polyxd/server`, then `node packages/server/dist/bin.js` with the same settings. `--help` lists them.\n\nOutside Docker it listens on `127.0.0.1` only, so nothing else on the network can reach it. Set `HOST=0.0.0.0` to change that.\n\n## Settings\n\nEverything is set by environment variables. A missing or wrong setting stops the server at start, with a message that says what to set.\n\n| Variable | What it sets |\n|---|---|\n| `POLYXD_PROVIDER` | `anthropic`, `openai`, `gemini` or `local`. Required |\n| `POLYXD_MODEL` | The model id. Required, except for `anthropic`, which defaults to `claude-sonnet-5` |\n| `POLYXD_API_KEY` | The provider's key. `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY` or `GOOGLE_API_KEY` work too; `POLYXD_API_KEY` wins. `local` needs none |\n| `POLYXD_BASE_URL` | The provider's base URL. For `local`, your server (default `http://localhost:11434/v1`, Ollama). For the others, a proxy, which may add the key itself |\n| `POLYXD_DIRECTION` | Path to your Design Direction. Exemplars it names by path are read relative to it |\n| `POLYXD_REGISTRY` | Path to your capability registry, so callers can offer capabilities by name |\n| `POLYXD_SERVER_TOKEN` | When set, every endpoint but `/v1/health` needs `Authorization: Bearer <token>` |\n| `POLYXD_CORS_ORIGINS` | Origins a browser may call from, comma-separated, or `*`. Default none |\n| `POLYXD_MAX_BODY_BYTES` | The largest request body. Default 1048576 (1 MiB) |\n| `POLYXD_TIMEOUT_MS` | The longest one generation may take. Default 120000 |\n| `POLYXD_MAX_REPAIRS` | How many times a failed answer goes back to the model. Default 2 |\n| `PORT`, `HOST` | Where to listen. Default `8080` on `127.0.0.1`; the Docker image sets `0.0.0.0` |\n\nThe key goes to the provider and nowhere else. The server never prints or logs it.\n\n## Endpoints\n\n| Endpoint | What it does |\n|---|---|\n| `POST /v1/generate` | Generates a document for an ask. Returns JSON, or streams with `Accept: text/event-stream` |\n| `POST /v1/validate` | The spec validator on a document |\n| `POST /v1/verify` | The [verifier's](https://polyxd.com/docs/verifier) document checks on a document, with your Direction's rules and your registry |\n| `GET /v1/spec` | The server and spec versions, the components a generated screen may use, the patterns, your Direction's name and your capabilities' names |\n| `GET /v1/health` | `{ \"status\": \"ok\", \"version\" }`. Never needs a token |\n\nEvery body is JSON, sent with `Content-Type: application/json`. An error is `{ \"error\": { \"code\", \"message\" } }` with a status that fits: 400 for a body that isn't right (the message says what to fix, and unknown fields are refused so a typo doesn't pass silently), 401 without the token, 403 from an origin that isn't allowed, 404, 405, 413 for a body over the limit, and 415 for a body that isn't JSON.\n\n### Generate\n\n```sh\ncurl http://localhost:8080/v1/generate \\\n -H 'content-type: application/json' \\\n -H \"authorization: Bearer $POLYXD_SERVER_TOKEN\" \\\n -d '{\n \"ask\": \"Send £250 to Alex for the rent\",\n \"intent\": \"money.send\",\n \"capabilities\": [\"transfer.confirm\"],\n \"data\": { \"quote\": { \"id\": \"q_1\", \"amount\": 250, \"currency\": \"GBP\", \"recipient\": \"Alex Kim\" } }\n }'\n```\n\n| Field | What it is |\n|---|---|\n| `ask` | What the person asked, in their words. Required |\n| `intent` | A stable key for what they're trying to do, such as `money.send`. Required |\n| `capabilities` | What the screen may trigger: names from the server's registry, or an object of full capability definitions by name. Leave it out and the screen can offer none |\n| `data` | The host data the screen binds to. The document is checked against it |\n| `pattern` | A spec pattern the screen should follow, when you already know |\n\nThe answer is `{ document, report, attempts, usage }`, as the runtime returns it. `report` has `valid`, `errors`, `warnings` and the `findings`.\n\n| Status | When |\n|---|---|\n| 200 | The document passed its checks |\n| 422 | Every repair failed. The body still has the last `document` and its `report`, plus an `error` with code `invalid`, so you can show a fallback |\n| 502 | The model provider failed. `error` has code `generator`, the `provider` and its HTTP `status` (a 401 is a bad key, a 429 a rate limit). The provider's own words are not passed on |\n| 504 | No document within `POLYXD_TIMEOUT_MS`. Code `timeout` |\n\nIf the caller disconnects, the model call is aborted, so an abandoned request stops costing tokens.\n\n### Streaming\n\nSend `Accept: text/event-stream` to get the runtime's progress as [server-sent events](https://html.spec.whatwg.org/multipage/server-sent-events.html). Each event is one `event:` line and one `data:` line of JSON:\n\n```\nevent: started\ndata: {\"remembered\":false,\"exemplars\":0}\n\nevent: text\ndata: {\"attempt\":1,\"text\":\"{\\\"specVersion\\\":\\\"0.3.0\\\",\"}\n\nevent: attempt\ndata: {\"attempt\":1,\"report\":{\"valid\":true,\"errors\":0,\"warnings\":0,\"findings\":[]}}\n\nevent: done\ndata: {\"document\":{...},\"report\":{...},\"attempts\":1,\"usage\":{\"inputTokens\":3200,\"outputTokens\":900}}\n```\n\n| Event | Data |\n|---|---|\n| `started` | `remembered` and `exemplars`, once |\n| `text` | `attempt` and a piece of the model's `text` |\n| `attempt` | `attempt` and the `report` on that answer |\n| `repaired` | `attempt` and `report`, when an answer passes after a repair |\n| `done` | Last: `{ document, report, attempts, usage }`, the same as the JSON answer |\n| `error` | Last, instead of `done`: `code` (`invalid`, `generator`, `timeout`, `setup` or `aborted`), a `message`, the provider's `status` when there is one, and the `result` when the runtime gave up |\n\nThe status is 200 once streaming starts, so read the last event to know how it ended. While the model thinks, the server sends a `: keep-alive` comment every 15 seconds so proxies keep the connection open. Closing the connection aborts the model call.\n\n`EventSource` only sends GET, so read the stream with `fetch`:\n\n```ts\nconst res = await fetch(`${server}/v1/generate`, {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\", accept: \"text/event-stream\", authorization: `Bearer ${token}` },\n body: JSON.stringify({ ask, intent, capabilities, data }),\n});\nconst reader = res.body!.pipeThrough(new TextDecoderStream()).getReader();\nlet buffer = \"\";\nfor (;;) {\n const { value, done } = await reader.read();\n if (done) break;\n buffer += value;\n let end;\n while ((end = buffer.indexOf(\"\\n\\n\")) >= 0) {\n const block = buffer.slice(0, end);\n buffer = buffer.slice(end + 2);\n const event = /^event: (.*)$/m.exec(block)?.[1];\n const data = /^data: (.*)$/m.exec(block)?.[1];\n if (event === \"done\") show(JSON.parse(data!).document);\n if (event === \"error\") showFallback(JSON.parse(data!).code);\n }\n}\n```\n\n### Validate and verify\n\nBoth take `{ document, data? }`. `data` replaces the document's own data.\n\n`/v1/validate` runs the spec validator, with your Direction's `emphasisBudget`, and returns `{ valid, errors, warnings, issues }`. Each issue has a `severity`, a JSON Pointer `at`, and a `message`.\n\n`/v1/verify` runs the verifier's document checks from `@polyxd/verifier/static`: the validator, the declared pattern, capabilities, your Direction's rules and voice, and the agent-readiness checks. It checks capabilities against your whole registry, or against `capabilities` in the body if you send them. It returns `{ valid, errors, warnings, findings }`. The rendered checks need a browser, so run [`polyxd-verify`](https://polyxd.com/docs/verifier/) for those.\n\n## Callers and browsers\n\n- **Token.** Set `POLYXD_SERVER_TOKEN` and send `Authorization: Bearer <token>`. The comparison takes the same time whatever the token, so it can't be guessed a character at a time. Only `/v1/health` is open, for load balancers and the Docker health check.\n- **CORS.** By default no browser page can call the server. `POLYXD_CORS_ORIGINS` names the origins that can. A request from any other origin gets a 403, before any model call. `*` allows every origin; use it only with a token, or on a private network.\n- **Limits.** Bodies over `POLYXD_MAX_BODY_BYTES` are refused, whether or not they say their length. A generation that runs past `POLYXD_TIMEOUT_MS` is aborted.\n\nA token in a web page is readable by anyone who opens the page. For a browser app, call the server from your own backend, or put it behind the sign-in your product already has.\n\n## Privacy\n\nThe server logs one JSON line per request with four fields:\n\n```\n{\"method\":\"POST\",\"path\":\"/v1/generate\",\"status\":200,\"ms\":2140}\n```\n\nIt never logs the ask, the data, the document, a header or a query string. It keeps nothing between requests: no interface memory, no history. Error messages it sends never repeat what the provider said, so a provider's answer can't leak into your client. The package sends no telemetry.\n\nThe model provider does see the ask and the data, as it would with the runtime. Choose `local` to keep them on your own machines.\n\n## From code\n\nThe server is also a library, for tests or to run it inside your own Node process:\n\n```ts\nimport { createServer, configFromEnv } from \"@polyxd/server\";\nimport { anthropic } from \"@polyxd/runtime\";\n\nconst server = createServer({\n generator: anthropic({ apiKey: process.env.ANTHROPIC_API_KEY }),\n direction, // your direction.json, parsed\n registry, // your capability registry, parsed\n token: process.env.POLYXD_SERVER_TOKEN,\n});\nserver.listen(8080);\n```\n\n`createServer` returns a Node `http.Server` and takes the settings above as options (`token`, `corsOrigins`, `maxBodyBytes`, `timeoutMs`, `maxRepairs`, `resolveExemplar`), plus `runtime` in place of `generator` if you built one yourself, and `log` to send the log lines somewhere else. The server's own tests pass a fake generator this way, with no network and no key.\n\n| Export | What it does |\n|---|---|\n| `createServer(options)` | The server, as a Node `http.Server` |\n| `configFromEnv(env)` | Every setting from environment variables, as the bin reads them. Throws a `ConfigError` that says what to fix |\n| `generatorFromEnv(env)` | Just the generator, from `POLYXD_PROVIDER`, `POLYXD_MODEL`, the key and `POLYXD_BASE_URL` |\n| `ConfigError` | What `configFromEnv` throws |\n| `PROVIDERS` | The providers `POLYXD_PROVIDER` accepts |\n| `ENV_HELP` | The text `--help` prints |\n| `VERSION` | The server's version |\n\n## Not yet\n\n- On npm and on GitHub Container Registry. The release workflow builds the image and pushes it on a version tag, once `@polyxd/server` has been published.\n- Interface memory. The runtime can remember the screen per intent, but a server shared by many people would mix theirs up, so the server keeps none.\n- Rate limiting per caller. Put the server behind a gateway or proxy that does it."
|
|
172
172
|
},
|
|
173
173
|
{
|
|
174
174
|
"slug": "custom-renderers",
|
|
@@ -213,7 +213,7 @@ export const DOCS = [
|
|
|
213
213
|
"section": "Project",
|
|
214
214
|
"order": 40,
|
|
215
215
|
"url": "https://polyxd.com/docs/roadmap/",
|
|
216
|
-
"markdown": "Polyxd has no fixed timeline. Work is split into phases ordered by dependency, and each phase has an exit test that must pass before the next one starts.\n\n## Phases\n\n| Phase | What | Status |\n|---|---|---|\n| 0 | **Setup and grounding.** Monorepo, research on A2UI, design tokens and prior work. Decision 0001: own schema, exported to A2UI and MCP Apps | Done |\n| 1 | **Spec v0.** 24 components, UI schema and validator, 5 patterns and the check vocabulary, capability, journey, event and Design Direction schemas, 20 examples, the Material 3 pack, A2UI export | Done |\n| 2 | **Web renderer and theming.** `@polyxd/react`, the theme compiler, thirteen design-system packs and twelve templates, the gallery; then `@polyxd/core` and the Web Components renderer `@polyxd/web`, held to each other by a conformance suite. Decision 0002 on Astryx | Done |\n| 3 | **Verifier and benchmark.** Document, rendered, agent and consistency checks; 50 requests, 10 multi-turn sequences and a gold set | In progress. The verifier is done (20 of 20 injected defects caught). The benchmark is in progress: the requests, sequences and gold documents exist, and the designer ranking that the gold-set exit test needs is still to do |\n| 4–6 | **Generator experiments.** Baselines and tuning of small local models, scored by the verifier | Paused. Polyxd ships no model; any generator that emits spec-valid JSON drives it |\n| 7 | **Demo and release.** Four demo products (ask, a UI appears, it goes away, ask again, it's recognisable), the 0.3 release of every package then built, on npm, and Studio at studio.polyxd.com. The write-up waits on the benchmark | Done, except the write-up |\n\nPolyxd does not depend on a model of its own. The spec, renderer and verifier work with any generator, and the verifier is what lets you compare generators on equal terms.\n\nThe [runtime SDK](https://polyxd.com/docs/runtime), `@polyxd/runtime`, the [MCP server](https://polyxd.com/docs/mcp/), `@polyxd/mcp`, and the [generation server](https://polyxd.com/docs/server/), `@polyxd/server`, are on npm since 0.4.0. The runtime generates a document with the model you choose and applies a Design Direction as it does. The MCP server lets a chat app's own model write, check and show a screen. The generation server puts the runtime behind an HTTP API with streaming, with a Dockerfile to build its image. **Next:** the Python runtime and PyPI. **Later:** SwiftUI and Compose renderers (the spec already maps every component to both), a design-system generator, and an importer for Figma variables (Studio already imports Tokens Studio, DTCG and CSS files and npm packages).\n\n### Release milestones\n\n| Release | After | Contents | Status |\n|---|---|---|---|\n| v0.1 | Phase 3 | Spec, design-system packs, React renderer, verifier. Works with any LLM. The first npm release | Released |\n| v0.2 | | Authored screens, more components, the demos, Studio's first version | Released |\n| v0.3 | | The shell components, `@polyxd/core`, the Web Components renderer, twelve templates, `polyxd dev` | Released |\n| v0.4 | | Runtime SDK, MCP server (local and hosted at mcp.polyxd.com), generation server, precompiled spec validators, `@polyxd/verifier/static` | Released |\n| v0.4.1 | | Semantic analytics events from both renderers, `@polyxd/analytics`, chart axis labels that thin themselves | Released |\n| v0.4.2 | | The MCP App holds a button press made while the chat is still replying and sends it when the chat accepts, instead of failing | Released |\n| v0.4.3 | | The MCP server answers questions from the docs (`polyxd_docs`); every docs page as Markdown, with Copy page, `llms.txt` and `llms-full.txt`; `polyxd pack --dark` makes a dark mode that is dark | Released |\n| v1.0 | | Spec frozen, then native renderers | Planned |\n\nBefore v1.0 the spec may break. Every document carries `specVersion`, releases follow semver, and breaking changes will come with migration notes.\n\n## Distribution\n\nEach layer ships as its own package, so nobody has to adopt all of it. What exists today is on npm, except where the row says otherwise; the rest is planned.\n\n| Layer | Planned package | Channel | Today |\n|---|---|---|---|\n| Spec | `@polyxd/spec`, `polyxd-spec` (Python) | npm, PyPI | `@polyxd/spec` exists. `polyxd-spec` exists in the repository (`packages/python-spec`), not yet on PyPI |\n| Design-system packs | `@polyxd/ds-material3`, `ds-carbon`, `ds-antd` | npm | Exist |\n| Web renderer | `@polyxd/react` | npm | Exists |\n| Verifier and benchmark | `polyxd-verify` CLI, dataset | npm, Hugging Face Datasets | Verifier exists; dataset in progress |\n| Runtime SDK (generator, memory, validation, streaming) | `@polyxd/runtime`, `polyxd` (Python) | npm, PyPI | `@polyxd/runtime` on npm; Python planned |\n| Semantic analytics events and adapters | `@polyxd/react` and `@polyxd/web` emit them; `@polyxd/analytics` sends them to PostHog, Segment, GA4 or an endpoint | npm | `@polyxd/analytics` is on npm, and the renderers emit the events from 0.4.1 on. Amplitude and OpenTelemetry adapters are not written |\n| Agent integration | MCP server (MCP Apps compatible) and A2UI export | npm (`npx @polyxd/mcp`) | A2UI export exists; the MCP server ([`@polyxd/mcp`](https://polyxd.com/docs/mcp/)) is on npm and hosted at `mcp.polyxd.com` |\n| Server | Generation server and HTTP API with streaming, pointed at the model endpoint you choose | Docker image on GitHub Container Registry, and npm (`npx @polyxd/server`) | [`@polyxd/server`](https://polyxd.com/docs/server/) on npm, with a Dockerfile to build the image |\n| Native renderers | Swift package, Compose library | SPM, Maven Central | Later |\n\nThe runtime points at any generator: Claude, GPT or Gemini through their APIs, or a model on your own machine or server behind an OpenAI-compatible endpoint. Interface memory is stored on the client. There is no telemetry.\n\n## Open core\n\nThe spec, design-system packs, React renderer, runtime, MCP server, verifier and benchmark are meant to be free and open: code under Apache-2.0, and the spec and docs under CC-BY-4.0. [Studio](https://polyxd.com/docs/studio) exists for teams (hosted at studio.polyxd.com, free for one workspace, and source-available under the Functional Source License to run yourself): design systems, what generated screens may use, rules, whole Design Directions (edited, versioned and fetched by key), authored screens and delivery, and Insights: how each screen does in a team's product, counted from the semantic events the product sends. Reviewing generated screens there is planned. Paid plans for bigger teams are planned and will be published before they start; one workspace stays free. The intent is that anything that runs inside someone else's product stays free, with no usage metering."
|
|
216
|
+
"markdown": "Polyxd has no fixed timeline. Work is split into phases ordered by dependency, and each phase has an exit test that must pass before the next one starts.\n\n## Phases\n\n| Phase | What | Status |\n|---|---|---|\n| 0 | **Setup and grounding.** Monorepo, research on A2UI, design tokens and prior work. Decision 0001: own schema, exported to A2UI and MCP Apps | Done |\n| 1 | **Spec v0.** 24 components, UI schema and validator, 5 patterns and the check vocabulary, capability, journey, event and Design Direction schemas, 20 examples, the Material 3 pack, A2UI export | Done |\n| 2 | **Web renderer and theming.** `@polyxd/react`, the theme compiler, thirteen design-system packs and twelve templates, the gallery; then `@polyxd/core` and the Web Components renderer `@polyxd/web`, held to each other by a conformance suite. Decision 0002 on Astryx | Done |\n| 3 | **Verifier and benchmark.** Document, rendered, agent and consistency checks; 50 requests, 10 multi-turn sequences and a gold set | In progress. The verifier is done (20 of 20 injected defects caught). The benchmark is in progress: the requests, sequences and gold documents exist, and the designer ranking that the gold-set exit test needs is still to do |\n| 4–6 | **Generator experiments.** Baselines and tuning of small local models, scored by the verifier | Paused. Polyxd ships no model; any generator that emits spec-valid JSON drives it |\n| 7 | **Demo and release.** Four demo products (ask, a UI appears, it goes away, ask again, it's recognisable), the 0.3 release of every package then built, on npm, and Studio at studio.polyxd.com. The write-up waits on the benchmark | Done, except the write-up |\n\nPolyxd does not depend on a model of its own. The spec, renderer and verifier work with any generator, and the verifier is what lets you compare generators on equal terms.\n\nThe [runtime SDK](https://polyxd.com/docs/runtime), `@polyxd/runtime`, the [MCP server](https://polyxd.com/docs/mcp/), `@polyxd/mcp`, and the [generation server](https://polyxd.com/docs/server/), `@polyxd/server`, are on npm since 0.4.0. The runtime generates a document with the model you choose and applies a Design Direction as it does. The MCP server lets a chat app's own model write, check and show a screen. The generation server puts the runtime behind an HTTP API with streaming, with a Dockerfile to build its image. **Next:** the Python runtime and PyPI. **Later:** SwiftUI and Compose renderers (the spec already maps every component to both), a design-system generator, and an importer for Figma variables (Studio already imports Tokens Studio, DTCG and CSS files and npm packages).\n\n### Release milestones\n\n| Release | After | Contents | Status |\n|---|---|---|---|\n| v0.1 | Phase 3 | Spec, design-system packs, React renderer, verifier. Works with any LLM. The first npm release | Released |\n| v0.2 | | Authored screens, more components, the demos, Studio's first version | Released |\n| v0.3 | | The shell components, `@polyxd/core`, the Web Components renderer, twelve templates, `polyxd dev` | Released |\n| v0.4 | | Runtime SDK, MCP server (local and hosted at mcp.polyxd.com), generation server, precompiled spec validators, `@polyxd/verifier/static` | Released |\n| v0.4.1 | | Semantic analytics events from both renderers, `@polyxd/analytics`, chart axis labels that thin themselves | Released |\n| v0.4.2 | | The MCP App holds a button press made while the chat is still replying and sends it when the chat accepts, instead of failing | Released |\n| v0.4.3 | | The MCP server answers questions from the docs (`polyxd_docs`); every docs page as Markdown, with Copy page, `llms.txt` and `llms-full.txt`; `polyxd pack --dark` makes a dark mode that is dark | Released |\n| v0.4.4 | | The VS Code extension adds the Polyxd MCP server to Cursor's agent and VS Code's agent mode when it's installed | Released |\n| v1.0 | | Spec frozen, then native renderers | Planned |\n\nBefore v1.0 the spec may break. Every document carries `specVersion`, releases follow semver, and breaking changes will come with migration notes.\n\n## Distribution\n\nEach layer ships as its own package, so nobody has to adopt all of it. What exists today is on npm, except where the row says otherwise; the rest is planned.\n\n| Layer | Planned package | Channel | Today |\n|---|---|---|---|\n| Spec | `@polyxd/spec`, `polyxd-spec` (Python) | npm, PyPI | `@polyxd/spec` exists. `polyxd-spec` exists in the repository (`packages/python-spec`), not yet on PyPI |\n| Design-system packs | `@polyxd/ds-material3`, `ds-carbon`, `ds-antd` | npm | Exist |\n| Web renderer | `@polyxd/react` | npm | Exists |\n| Verifier and benchmark | `polyxd-verify` CLI, dataset | npm, Hugging Face Datasets | Verifier exists; dataset in progress |\n| Runtime SDK (generator, memory, validation, streaming) | `@polyxd/runtime`, `polyxd` (Python) | npm, PyPI | `@polyxd/runtime` on npm; Python planned |\n| Semantic analytics events and adapters | `@polyxd/react` and `@polyxd/web` emit them; `@polyxd/analytics` sends them to PostHog, Segment, GA4 or an endpoint | npm | `@polyxd/analytics` is on npm, and the renderers emit the events from 0.4.1 on. Amplitude and OpenTelemetry adapters are not written |\n| Agent integration | MCP server (MCP Apps compatible) and A2UI export | npm (`npx @polyxd/mcp`) | A2UI export exists; the MCP server ([`@polyxd/mcp`](https://polyxd.com/docs/mcp/)) is on npm and hosted at `mcp.polyxd.com` |\n| Server | Generation server and HTTP API with streaming, pointed at the model endpoint you choose | Docker image on GitHub Container Registry, and npm (`npx @polyxd/server`) | [`@polyxd/server`](https://polyxd.com/docs/server/) on npm, with a Dockerfile to build the image |\n| Native renderers | Swift package, Compose library | SPM, Maven Central | Later |\n\nThe runtime points at any generator: Claude, GPT or Gemini through their APIs, or a model on your own machine or server behind an OpenAI-compatible endpoint. Interface memory is stored on the client. There is no telemetry.\n\n## Open core\n\nThe spec, design-system packs, React renderer, runtime, MCP server, verifier and benchmark are meant to be free and open: code under Apache-2.0, and the spec and docs under CC-BY-4.0. [Studio](https://polyxd.com/docs/studio) exists for teams (hosted at studio.polyxd.com, free for one workspace, and source-available under the Functional Source License to run yourself): design systems, what generated screens may use, rules, whole Design Directions (edited, versioned and fetched by key), authored screens and delivery, and Insights: how each screen does in a team's product, counted from the semantic events the product sends. Reviewing generated screens there is planned. Paid plans for bigger teams are planned and will be published before they start; one workspace stays free. The intent is that anything that runs inside someone else's product stays free, with no usage metering."
|
|
217
217
|
}
|
|
218
218
|
];
|
|
219
219
|
//# sourceMappingURL=docs.generated.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.generated.js","sourceRoot":"","sources":["../src/docs.generated.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,MAAM,IAAI,GAAc;IAC7B;QACE,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,cAAc;QACvB,aAAa,EAAE,wFAAwF;QACvG,SAAS,EAAE,OAAO;QAClB,OAAO,EAAE,CAAC;QACV,KAAK,EAAE,0BAA0B;QACjC,UAAU,EAAE,+xSAA+xS;KAC5yS;IACD;QACE,MAAM,EAAE,YAAY;QACpB,OAAO,EAAE,YAAY;QACrB,aAAa,EAAE,2GAA2G;QAC1H,SAAS,EAAE,OAAO;QAClB,OAAO,EAAE,CAAC;QACV,KAAK,EAAE,qCAAqC;QAC5C,UAAU,EAAE,yzNAAyzN;KACt0N;IACD;QACE,MAAM,EAAE,oBAAoB;QAC5B,OAAO,EAAE,oBAAoB;QAC7B,aAAa,EAAE,8HAA8H;QAC7I,SAAS,EAAE,OAAO;QAClB,OAAO,EAAE,CAAC;QACV,KAAK,EAAE,6CAA6C;QACpD,UAAU,EAAE,u2LAAu2L;KACp3L;IACD;QACE,MAAM,EAAE,cAAc;QACtB,OAAO,EAAE,cAAc;QACvB,aAAa,EAAE,0GAA0G;QACzH,SAAS,EAAE,UAAU;QACrB,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,uCAAuC;QAC9C,UAAU,EAAE,gpVAAgpV;KAC7pV;IACD;QACE,MAAM,EAAE,kBAAkB;QAC1B,OAAO,EAAE,uBAAuB;QAChC,aAAa,EAAE,sLAAsL;QACrM,SAAS,EAAE,UAAU;QACrB,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,2CAA2C;QAClD,UAAU,EAAE,oiMAAoiM;KACjjM;IACD;QACE,MAAM,EAAE,YAAY;QACpB,OAAO,EAAE,YAAY;QACrB,aAAa,EAAE,wJAAwJ;QACvK,SAAS,EAAE,UAAU;QACrB,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,qCAAqC;QAC5C,UAAU,EAAE,4gRAA4gR;KACzhR;IACD;QACE,MAAM,EAAE,UAAU;QAClB,OAAO,EAAE,UAAU;QACnB,aAAa,EAAE,6GAA6G;QAC5H,SAAS,EAAE,UAAU;QACrB,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,mCAAmC;QAC1C,UAAU,EAAE,k7MAAk7M;KAC/7M;IACD;QACE,MAAM,EAAE,gBAAgB;QACxB,OAAO,EAAE,gBAAgB;QACzB,aAAa,EAAE,6IAA6I;QAC5J,SAAS,EAAE,UAAU;QACrB,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,yCAAyC;QAChD,UAAU,EAAE,42kBAA42kB;KACz3kB;IACD;QACE,MAAM,EAAE,gBAAgB;QACxB,OAAO,EAAE,gBAAgB;QACzB,aAAa,EAAE,qGAAqG;QACpH,SAAS,EAAE,UAAU;QACrB,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,yCAAyC;QAChD,UAAU,EAAE,83HAA83H;KAC34H;IACD;QACE,MAAM,EAAE,kBAAkB;QAC1B,OAAO,EAAE,kBAAkB;QAC3B,aAAa,EAAE,kJAAkJ;QACjK,SAAS,EAAE,UAAU;QACrB,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,2CAA2C;QAClD,UAAU,EAAE,6gVAA6gV;KAC1hV;IACD;QACE,MAAM,EAAE,WAAW;QACnB,OAAO,EAAE,oBAAoB;QAC7B,aAAa,EAAE,gIAAgI;QAC/I,SAAS,EAAE,UAAU;QACrB,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,oCAAoC;QAC3C,UAAU,EAAE,+yKAA+yK;KAC5zK;IACD;QACE,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,mCAAmC;QAC5C,aAAa,EAAE,4HAA4H;QAC3I,SAAS,EAAE,UAAU;QACrB,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,kCAAkC;QACzC,UAAU,EAAE,uqjBAAuqjB;KACprjB;IACD;QACE,MAAM,EAAE,mBAAmB;QAC3B,OAAO,EAAE,mBAAmB;QAC5B,aAAa,EAAE,sHAAsH;QACrI,SAAS,EAAE,UAAU;QACrB,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,4CAA4C;QACnD,UAAU,EAAE,8qLAA8qL;KAC3rL;IACD;QACE,MAAM,EAAE,UAAU;QAClB,OAAO,EAAE,UAAU;QACnB,aAAa,EAAE,iGAAiG;QAChH,SAAS,EAAE,QAAQ;QACnB,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,mCAAmC;QAC1C,UAAU,EAAE,smoBAAsmoB;KACnnoB;IACD;QACE,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,SAAS;QAClB,aAAa,EAAE,6JAA6J;QAC5K,SAAS,EAAE,QAAQ;QACnB,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,kCAAkC;QACzC,UAAU,EAAE,+8YAA+8Y;KAC59Y;IACD;QACE,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,gBAAgB;QACzB,aAAa,EAAE,uIAAuI;QACtJ,SAAS,EAAE,QAAQ;QACnB,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,+BAA+B;QACtC,UAAU,EAAE,ixNAAixN;KAC9xN;IACD;QACE,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,YAAY;QACrB,aAAa,EAAE,kKAAkK;QACjL,SAAS,EAAE,QAAQ;QACnB,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,8BAA8B;QACrC,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"docs.generated.js","sourceRoot":"","sources":["../src/docs.generated.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,MAAM,IAAI,GAAc;IAC7B;QACE,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,cAAc;QACvB,aAAa,EAAE,wFAAwF;QACvG,SAAS,EAAE,OAAO;QAClB,OAAO,EAAE,CAAC;QACV,KAAK,EAAE,0BAA0B;QACjC,UAAU,EAAE,+xSAA+xS;KAC5yS;IACD;QACE,MAAM,EAAE,YAAY;QACpB,OAAO,EAAE,YAAY;QACrB,aAAa,EAAE,2GAA2G;QAC1H,SAAS,EAAE,OAAO;QAClB,OAAO,EAAE,CAAC;QACV,KAAK,EAAE,qCAAqC;QAC5C,UAAU,EAAE,yzNAAyzN;KACt0N;IACD;QACE,MAAM,EAAE,oBAAoB;QAC5B,OAAO,EAAE,oBAAoB;QAC7B,aAAa,EAAE,8HAA8H;QAC7I,SAAS,EAAE,OAAO;QAClB,OAAO,EAAE,CAAC;QACV,KAAK,EAAE,6CAA6C;QACpD,UAAU,EAAE,u2LAAu2L;KACp3L;IACD;QACE,MAAM,EAAE,cAAc;QACtB,OAAO,EAAE,cAAc;QACvB,aAAa,EAAE,0GAA0G;QACzH,SAAS,EAAE,UAAU;QACrB,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,uCAAuC;QAC9C,UAAU,EAAE,gpVAAgpV;KAC7pV;IACD;QACE,MAAM,EAAE,kBAAkB;QAC1B,OAAO,EAAE,uBAAuB;QAChC,aAAa,EAAE,sLAAsL;QACrM,SAAS,EAAE,UAAU;QACrB,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,2CAA2C;QAClD,UAAU,EAAE,oiMAAoiM;KACjjM;IACD;QACE,MAAM,EAAE,YAAY;QACpB,OAAO,EAAE,YAAY;QACrB,aAAa,EAAE,wJAAwJ;QACvK,SAAS,EAAE,UAAU;QACrB,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,qCAAqC;QAC5C,UAAU,EAAE,4gRAA4gR;KACzhR;IACD;QACE,MAAM,EAAE,UAAU;QAClB,OAAO,EAAE,UAAU;QACnB,aAAa,EAAE,6GAA6G;QAC5H,SAAS,EAAE,UAAU;QACrB,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,mCAAmC;QAC1C,UAAU,EAAE,k7MAAk7M;KAC/7M;IACD;QACE,MAAM,EAAE,gBAAgB;QACxB,OAAO,EAAE,gBAAgB;QACzB,aAAa,EAAE,6IAA6I;QAC5J,SAAS,EAAE,UAAU;QACrB,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,yCAAyC;QAChD,UAAU,EAAE,42kBAA42kB;KACz3kB;IACD;QACE,MAAM,EAAE,gBAAgB;QACxB,OAAO,EAAE,gBAAgB;QACzB,aAAa,EAAE,qGAAqG;QACpH,SAAS,EAAE,UAAU;QACrB,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,yCAAyC;QAChD,UAAU,EAAE,83HAA83H;KAC34H;IACD;QACE,MAAM,EAAE,kBAAkB;QAC1B,OAAO,EAAE,kBAAkB;QAC3B,aAAa,EAAE,kJAAkJ;QACjK,SAAS,EAAE,UAAU;QACrB,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,2CAA2C;QAClD,UAAU,EAAE,6gVAA6gV;KAC1hV;IACD;QACE,MAAM,EAAE,WAAW;QACnB,OAAO,EAAE,oBAAoB;QAC7B,aAAa,EAAE,gIAAgI;QAC/I,SAAS,EAAE,UAAU;QACrB,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,oCAAoC;QAC3C,UAAU,EAAE,+yKAA+yK;KAC5zK;IACD;QACE,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,mCAAmC;QAC5C,aAAa,EAAE,4HAA4H;QAC3I,SAAS,EAAE,UAAU;QACrB,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,kCAAkC;QACzC,UAAU,EAAE,uqjBAAuqjB;KACprjB;IACD;QACE,MAAM,EAAE,mBAAmB;QAC3B,OAAO,EAAE,mBAAmB;QAC5B,aAAa,EAAE,sHAAsH;QACrI,SAAS,EAAE,UAAU;QACrB,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,4CAA4C;QACnD,UAAU,EAAE,8qLAA8qL;KAC3rL;IACD;QACE,MAAM,EAAE,UAAU;QAClB,OAAO,EAAE,UAAU;QACnB,aAAa,EAAE,iGAAiG;QAChH,SAAS,EAAE,QAAQ;QACnB,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,mCAAmC;QAC1C,UAAU,EAAE,smoBAAsmoB;KACnnoB;IACD;QACE,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,SAAS;QAClB,aAAa,EAAE,6JAA6J;QAC5K,SAAS,EAAE,QAAQ;QACnB,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,kCAAkC;QACzC,UAAU,EAAE,+8YAA+8Y;KAC59Y;IACD;QACE,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,gBAAgB;QACzB,aAAa,EAAE,uIAAuI;QACtJ,SAAS,EAAE,QAAQ;QACnB,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,+BAA+B;QACtC,UAAU,EAAE,ixNAAixN;KAC9xN;IACD;QACE,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,YAAY;QACrB,aAAa,EAAE,kKAAkK;QACjL,SAAS,EAAE,QAAQ;QACnB,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,8BAA8B;QACrC,UAAU,EAAE,84SAA84S;KAC35S;IACD;QACE,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE,mBAAmB;QAC5B,aAAa,EAAE,iKAAiK;QAChL,SAAS,EAAE,QAAQ;QACnB,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,iCAAiC;QACxC,UAAU,EAAE,mlLAAmlL;KAChmL;IACD;QACE,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE,mBAAmB;QAC5B,aAAa,EAAE,gIAAgI;QAC/I,SAAS,EAAE,QAAQ;QACnB,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,iCAAiC;QACxC,UAAU,EAAE,6/ZAA6/Z;KAC1ga;IACD;QACE,MAAM,EAAE,kBAAkB;QAC1B,OAAO,EAAE,kBAAkB;QAC3B,aAAa,EAAE,0HAA0H;QACzI,SAAS,EAAE,QAAQ;QACnB,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,2CAA2C;QAClD,UAAU,EAAE,m9JAAm9J;KACh+J;IACD;QACE,MAAM,EAAE,OAAO;QACf,OAAO,EAAE,mBAAmB;QAC5B,aAAa,EAAE,mKAAmK;QAClL,SAAS,EAAE,QAAQ;QACnB,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,gCAAgC;QACvC,UAAU,EAAE,q9GAAq9G;KACl+G;IACD;QACE,MAAM,EAAE,WAAW;QACnB,OAAO,EAAE,WAAW;QACpB,aAAa,EAAE,4OAA4O;QAC3P,SAAS,EAAE,QAAQ;QACnB,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,oCAAoC;QAC3C,UAAU,EAAE,wqeAAwqe;KACrre;IACD;QACE,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE,QAAQ;QACjB,aAAa,EAAE,8OAA8O;QAC7P,SAAS,EAAE,QAAQ;QACnB,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,iCAAiC;QACxC,UAAU,EAAE,0mgBAA0mgB;KACvngB;IACD;QACE,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,SAAS;QAClB,aAAa,EAAE,oGAAoG;QACnH,SAAS,EAAE,SAAS;QACpB,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,kCAAkC;QACzC,UAAU,EAAE,8yNAA8yN;KAC3zN;CACF,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { McpServer } from "@modelcontextprotocol/server";
|
|
11
11
|
import { PACKS } from "./packs.generated.ts";
|
|
12
|
-
export declare const VERSION = "0.4.
|
|
12
|
+
export declare const VERSION = "0.4.4";
|
|
13
13
|
/** The MCP App resource every shown screen renders in. */
|
|
14
14
|
export declare const VIEW_URI = "ui://polyxd/surface.html";
|
|
15
15
|
/** MCP Apps' HTML profile. */
|
package/dist/server.js
CHANGED
|
@@ -14,7 +14,7 @@ import { PACKS } from "./packs.generated.js";
|
|
|
14
14
|
import { componentDefinitions, componentNamed, exampleDirections, exampleDocuments } from "./spec.js";
|
|
15
15
|
import { componentsOutput, docsOutput, guideOutput, packsOutput, showOutput, validateOutput, verifyOutput } from "./output-schemas.js";
|
|
16
16
|
import { DOCS, PAGE_LIMIT_CHARS, docPage, searchDocs } from "./docs.js";
|
|
17
|
-
export const VERSION = "0.4.
|
|
17
|
+
export const VERSION = "0.4.4";
|
|
18
18
|
/** The MCP App resource every shown screen renders in. */
|
|
19
19
|
export const VIEW_URI = "ui://polyxd/surface.html";
|
|
20
20
|
/** MCP Apps' HTML profile. */
|
package/dist/view.html
CHANGED
|
@@ -26,7 +26,7 @@ html,body{margin:0;background:var(--pxd-color-surface-default,Canvas);color:var(
|
|
|
26
26
|
`)+`
|
|
27
27
|
`;case"div":case"p":case"li":return a()+`
|
|
28
28
|
`;default:return a()}}function $r(e){let t=[],a=/\*\*([^*]+)\*\*|\*([^*]+)\*/g,r=0;for(let d=a.exec(e);d;d=a.exec(e)){d.index>r&&t.push(document.createTextNode(e.slice(r,d.index)));let p=document.createElement(d[1]?"strong":"em");p.textContent=d[1]??d[2],t.push(p),r=d.index+d[0].length}return r<e.length&&t.push(document.createTextNode(e.slice(r))),t}function Xd(e){let t=[],a=null;for(let r of e.split(`
|
|
29
|
-
`)){let d=/^(-|\d+\.)\s+(.*)$/.exec(r);if(d){let i=d[1]==="-"?"ul":"ol";(!a||a.tagName.toLowerCase()!==i)&&(a=document.createElement(i),t.push(a));let n=document.createElement("li");n.append(...$r(d[2])),a.append(n);continue}a=null;let p=document.createElement("div");r?p.append(...$r(r)):p.append(document.createElement("br")),t.push(p)}return t}function Yd(e,t,a,r){let d=t.b,p=String(d.value(e.value)??""),i=m=>d.write(e.value,Lr(m).replace(/\n+$/,"")),n=m=>g=>{g.preventDefault();let f=g.currentTarget.closest(".pxd-richtext")?.querySelector(".pxd-richtext-area");f&&(f.focus(),document.execCommand(m),i(f))},{id:s,class:c,required:l,autocomplete:u,...x}=r;return ke(a,o("div",{class:"pxd-richtext"},o("div",{class:"pxd-richtext-toolbar",role:"toolbar","aria-label":"Formatting"},o("button",{type:"button",class:"pxd-richtext-control","aria-label":"Bold",onMousedown:n("bold")},o("strong",null,"B")),o("button",{type:"button",class:"pxd-richtext-control","aria-label":"Italic",onMousedown:n("italic")},o("em",null,"I")),o("button",{type:"button",class:"pxd-richtext-control","aria-label":"Bulleted list",onMousedown:n("insertUnorderedList")},D("menu",16))),o("div",{...x,id:s,class:"pxd-input pxd-richtext-area",contenteditable:"true",role:"textbox","aria-multiline":"true","aria-label":a.label,ref:m=>{let g=m;!g||g.dataset.ready||(g.dataset.ready="1",g.replaceChildren(...Xd(p)))},onInput:m=>i(m.currentTarget),onBlur:m=>i(m.currentTarget)})))}function Jd(e,t,a,r){let d=t.b,p=String(d.value(e.value)??""),[i,n]=t.state(e,"inline",null),s=()=>{i!==null&&d.write(e.value,i),n(null)};return i===null?o("div",{class:"pxd-inline-edit"},o("span",{class:"pxd-field-label"},a.label),o("button",{type:"button",class:"pxd-inline-value","aria-label":`Edit ${a.label}`,onClick:()=>n(p)},o("span",{class:p?void 0:"pxd-inline-empty"},p||"Not set"),o("span",{class:"pxd-inline-hint","aria-hidden":"true"},"Edit"))):ke(a,o("input",{...r,type:"text",value:i,ref:c=>c&&!c.dataset.focused&&(c.dataset.focused="1",c.focus()),onInput:c=>n(te(c)),onBlur:s,onKeydown:c=>{c.key==="Enter"?(c.preventDefault(),s()):c.key==="Escape"&&n(null)}}))}var Pr=(e,t,a)=>o("div",{class:"pxd-option-text"},o("label",{for:e},t),a&&o("span",{class:"pxd-option-description",id:`${e}-desc`},a)),Fe=(e,...t)=>o("span",{"data-state":"checked",class:e,style:{pointerEvents:"none"}},...t);function Dr(e,t){let a=t.b,r=t.id(e,"label"),d=t.id(e,"help"),p=Se(e,t.r.data,a.scope,a.text),[i,n]=t.state(e,"query",""),s=Nt(p,e.mode),{multiple:c,withFaces:l,searchable:u}=s,x=s.control==="chips",m=a.value(e.value),g=me,f=b=>Ht(r,b),y=e.help!==void 0?a.text(e.help):void 0,h=t.a11y(e),k=a.text(e.label),A=o("div",{class:"pxd-field-label",id:r},k,e.required&&Ee()),C=y&&o("p",{class:"pxd-field-help",id:d},y),I=u&&o("div",{class:"pxd-search pxd-search-compact"},D("search"),o("input",{type:"search",class:"pxd-search-input",placeholder:Ut(l),"aria-label":`Search ${k}`,value:i,onInput:b=>n(te(b))})),E=b=>nt(b,i);if(c){let b=w=>Rt(m,w),v=w=>a.write(e.value,Tt(m,w));if(x)return o("div",{class:"pxd-field pxd-choice",role:"group","aria-labelledby":r,"aria-describedby":y?d:void 0,...h},A,C,o("div",{class:"pxd-chips"},...p.map(w=>xe({key:g(w.value),class:"pxd-chip",checked:b(w.value),onCheckedChange:()=>v(w.value),indicator:Fe("pxd-chip-check",D("check",18))},w.label))));if(l){let{recent:w,rest:N}=st(p,i);return o("fieldset",{class:"pxd-field pxd-choice pxd-people","aria-describedby":y?d:void 0,...h},o("legend",{class:"pxd-field-label",id:r},k),C,I,o("div",{class:"pxd-people-group"},w.length>0&&o("div",{class:"pxd-people-recent"},...w.map(z=>xe({key:g(z.value),class:"pxd-person-tile",checked:b(z.value),onCheckedChange:()=>v(z.value),"aria-label":z.label,indicator:null},o("span",{class:"pxd-person-face"},re(t,{value:z.avatar,name:z.label,size:56}),b(z.value)&&Fe("pxd-person-tick",D("check",14))),o("span",{class:"pxd-person-name","aria-hidden":"true"},z.label.split(" ")[0])))),o("div",{class:"pxd-people-list"},...N.map(z=>{let M=f(z.value);return xe({key:g(z.value),id:M,class:"pxd-person-row",checked:b(z.value),onCheckedChange:()=>v(z.value),"aria-labelledby":`${M}-name`,"aria-describedby":z.description?`${M}-desc`:void 0,indicator:null},re(t,{value:z.avatar,name:z.label}),o("span",{class:"pxd-person-text"},o("span",{id:`${M}-name`},z.label),z.description&&o("span",{class:"pxd-option-description",id:`${M}-desc`},z.description)),b(z.value)&&Fe("pxd-person-check",D("check")))}))))}return o("fieldset",{class:"pxd-field pxd-choice","aria-describedby":y?d:void 0,...h},o("legend",{class:"pxd-field-label",id:r},k),C,I,o("div",{class:`pxd-choice-list${u?" pxd-choice-scroll":""}`},...p.filter(E).map(w=>{let N=f(w.value);return o("div",{class:"pxd-choice-option",key:g(w.value)},w.avatar!==void 0&&re(t,{value:w.avatar,name:w.label,size:32}),xe({id:N,class:"pxd-checkbox",checked:b(w.value),onCheckedChange:()=>v(w.value),"aria-describedby":w.description?`${N}-desc`:void 0,indicator:Fe("pxd-checkbox-indicator","\u2713")}),Pr(N,w.label,w.description))})))}let F=m==null?"":g(m),$=b=>a.write(e.value,p.find(v=>g(v.value)===b)?.value),T=(b,v,w,N,...z)=>Ue({key:g(b.value),value:g(b.value),group:F,first:v===0,onSelect:()=>$(g(b.value)),indicator:N,...w},...z);if(x)return o("div",{class:"pxd-field pxd-choice",...h},A,C,Ce({class:"pxd-chips","aria-labelledby":r,"aria-describedby":y?d:void 0,"aria-required":e.required||void 0,value:F,onValueChange:$,orientation:"horizontal"},...p.map((b,v)=>T(b,v,{class:"pxd-chip","data-orientation":"horizontal"},Fe("pxd-chip-check",D("check",18)),b.label))));if(l){let{recent:b,rest:v}=st(p,i);return o("div",{class:"pxd-field pxd-choice pxd-people",...h},A,C,I,Ce({"aria-labelledby":r,"aria-describedby":y?d:void 0,"aria-required":e.required||void 0,value:F,onValueChange:$,class:"pxd-people-group"},b.length>0&&o("div",{class:"pxd-people-recent",role:"presentation"},...b.map((w,N)=>T(w,N,{class:"pxd-person-tile","aria-label":w.label},null,re(t,{value:w.avatar,name:w.label,size:56}),o("span",{class:"pxd-person-name","aria-hidden":"true"},w.label.split(" ")[0])))),o("div",{class:"pxd-people-list",role:"presentation"},...v.map((w,N)=>{let z=f(w.value);return T(w,b.length+N,{id:z,class:"pxd-person-row","aria-labelledby":`${z}-name`,"aria-describedby":w.description?`${z}-desc`:void 0},null,re(t,{value:w.avatar,name:w.label}),o("span",{class:"pxd-person-text"},o("span",{id:`${z}-name`},w.label),w.description&&o("span",{class:"pxd-option-description",id:`${z}-desc`},w.description)),F===g(w.value)&&Fe("pxd-person-check",D("check")))}))))}return o("div",{class:"pxd-field pxd-choice",...h},A,C,I,Ce({class:`pxd-choice-list${u?" pxd-choice-scroll":""}`,"aria-labelledby":r,"aria-describedby":y?d:void 0,"aria-required":e.required||void 0,value:F,onValueChange:$,orientation:"vertical"},...p.filter(E).map((b,v)=>{let w=f(b.value);return o("div",{class:"pxd-choice-option",key:g(b.value)},T(b,v,{id:w,class:"pxd-radio","aria-describedby":b.description?`${w}-desc`:void 0,"data-orientation":"vertical"},o("span",{"data-state":"checked",class:"pxd-radio-indicator",style:{pointerEvents:"none"}})),Pr(w,b.label,b.description))})))}function Vr(e,t){let a=t.b,r=t.id(e),d=t.id(e,"desc"),p=!!a.value(e.value),i=e.description!==void 0?a.text(e.description):void 0,n=c=>{a.write(e.value,c),e.action&&t.r.dispatch({event:{name:e.action.event.name,context:Ne(e,t.r.data,a.scope,c)}},{pointer:""},e.id)},s=t.a11y(e);return o("div",{class:"pxd-toggle"},e.action?lr({id:r,class:"pxd-switch",checked:p,onCheckedChange:n,"aria-describedby":i?d:void 0,...s}):xe({id:r,class:"pxd-checkbox",checked:p,onCheckedChange:c=>n(c===!0),"aria-describedby":i?d:void 0,...s,indicator:Fe("pxd-checkbox-indicator","\u2713")}),o("div",{class:"pxd-toggle-text"},o("label",{for:r,class:"pxd-toggle-label"},a.text(e.label)),i&&o("p",{class:"pxd-field-help",id:d},i)))}var Br={date:"date",time:"time",datetime:"datetime-local",month:"month"};function Or(e,t){let a=t.b,r=t.r,d=t.id(e),p=t.id(e,"help"),i=e.kind??"date",n=e.help!==void 0?a.text(e.help):void 0,s=a.value(e.value),c=e.min!==void 0?a.text(e.min):void 0,l=e.max!==void 0?a.text(e.max):void 0,u=t.a11y(e),x=a.text(e.label);if(e.multiple&&i!=="dateRange"){let m=Array.isArray(s)?s.map(String):[],g=h=>G(h,{type:i==="month"?"date":i==="time"?"time":i==="datetime"?"datetime":"date"},r.locale),f=h=>h&&!m.includes(h)&&a.write(e.value,[...m,h].sort()),y=h=>{let k=h.currentTarget;f(k.value),k.value=""};return o("fieldset",{class:"pxd-field pxd-date-multiple",...u},o("legend",{class:"pxd-field-label"},x,e.required&&Ee()),n&&o("p",{class:"pxd-field-help",id:p},n),m.length>0&&o("ul",{class:"pxd-tags-list","aria-label":`Chosen ${x}`},...m.map(h=>o("li",{key:h,class:"pxd-tag-chip"},i==="year"||i==="month"?h:g(h),o("button",{type:"button",class:"pxd-tag-remove","aria-label":`Remove ${h}`,onClick:()=>a.write(e.value,m.filter(k=>k!==h))},D("close",14))))),o("label",{class:"pxd-date-add",for:d},o("span",{class:"pxd-sr-only"},"Add a date"),i==="year"?o("input",{id:d,class:"pxd-input pxd-input-year",inputmode:"numeric",pattern:"[0-9]{4}",maxlength:4,placeholder:"YYYY","aria-describedby":n?p:void 0,onKeydown:h=>h.key==="Enter"&&(h.preventDefault(),y(h)),onBlur:y}):o("input",{id:d,class:"pxd-input pxd-input-date",type:Br[i],min:c,max:l,"aria-describedby":n?p:void 0,onChange:y})))}if(i==="year")return ke({label:x,help:n,required:e.required,id:d,helpId:p},o("input",{id:d,class:"pxd-input pxd-input-year",inputmode:"numeric",pattern:"[0-9]{4}",maxlength:4,placeholder:"YYYY",value:s??"",min:c,max:l,required:e.required,"aria-describedby":n?p:void 0,onInput:m=>a.write(e.value,te(m).replace(/\D/g,"").slice(0,4)||null),...u}));if(i==="dateRange"){let[m,g]=Array.isArray(s)?s:[],f=(y,h)=>{let k=[m??null,g??null];k[y]=h||null,a.write(e.value,k)};return o("fieldset",{class:"pxd-field",...u},o("legend",{class:"pxd-field-label"},x),n&&o("p",{class:"pxd-field-help"},n),o("div",{class:"pxd-date-range"},o("label",null,"From",o("input",{class:"pxd-input",type:"date",value:m??"",min:c,max:l,required:e.required,onChange:y=>f(0,te(y))})),o("label",null,"To",o("input",{class:"pxd-input",type:"date",value:g??"",min:m??c,max:l,required:e.required,onChange:y=>f(1,te(y))}))))}return ke({label:x,help:n,required:e.required,id:d,helpId:p},o("input",{id:d,class:`pxd-input pxd-input-date${i==="month"?" pxd-input-month":""}`,type:Br[i],value:s??"",min:c,max:l,required:e.required,"aria-describedby":n?p:void 0,onChange:m=>a.write(e.value,te(m)||null),...u}))}function _r(e,t){let a=t.b,r=t.r,d=t.id(e,"label"),p=t.id(e,"min"),i=t.id(e,"max"),n=l=>G(l,X(e.format??{type:"number"},r.data,a.scope),r.locale),s=t.a11y(e);if(e.mode==="range"){let l=a.value(e.value),[u,x]=Array.isArray(l)?l.map(Number):[e.min,e.max],m=(g,f)=>a.write(e.value,[Math.max(e.min,Math.min(g,f)),Math.min(e.max,Math.max(g,f))]);return o("div",{class:"pxd-field pxd-range",role:"group","aria-labelledby":d,...s},o("div",{class:"pxd-range-header"},o("span",{class:"pxd-field-label",id:d},a.text(e.label)),o("output",{class:"pxd-range-value","aria-live":"polite"},`${n(u)} \u2013 ${n(x)}`)),Ao({min:e.min,max:e.max,step:e.step??1,values:[u,x],minStepsBetweenThumbs:1,onValueChange:([g,f])=>m(g,f),thumbs:[{"aria-label":"Minimum","aria-valuetext":n(u)},{"aria-label":"Maximum","aria-valuetext":n(x)}]}),o("div",{class:"pxd-range-fields"},o("label",{for:p},o("span",null,"Minimum"),o("input",{id:p,class:"pxd-input",inputmode:"numeric",value:String(u),onInput:g=>m(Number(te(g))||e.min,x)})),o("span",{"aria-hidden":"true"},"\u2013"),o("label",{for:i},o("span",null,"Maximum"),o("input",{id:i,class:"pxd-input",inputmode:"numeric",value:String(x),onInput:g=>m(u,Number(te(g))||e.max)}))))}let c=Number(a.value(e.value)??e.min);return o("div",{class:"pxd-field pxd-range",...s},o("div",{class:"pxd-range-header"},o("span",{class:"pxd-field-label",id:d},a.text(e.label)),o("output",{class:"pxd-range-value","aria-live":"polite"},n(c))),Ao({min:e.min,max:e.max,step:e.step??1,values:[c],onValueChange:([l])=>a.write(e.value,l),thumbs:[{"aria-labelledby":d,"aria-valuetext":n(c)}]}),o("div",{class:"pxd-range-bounds","aria-hidden":"true"},o("span",null,n(e.min)),o("span",null,n(e.max))))}function Zd(e){return(e.labels?.[0]?.textContent??e.getAttribute("aria-label")??e.closest(".pxd-field")?.querySelector(".pxd-field-label, legend")?.textContent??"").replace(/\*\s*$/,"").trim()}function Qd(e,t){let a=new Set,r=[];for(let d of Array.from(e.elements))if(!(!d.willValidate||d.validity.valid)){if(d.type==="radio"&&d.name){if(a.has(d.name))continue;a.add(d.name)}d.id||(d.id=`${t}-${r.length}`),r.push(d)}return r}function qr(e,t){let a=t.b,r=t.r,d=Math.min(t.heading,6),p=t.id(e,"summary"),[i,n]=t.state(e,"problems",()=>[]),[s]=t.state(e,"marked",()=>({current:[]})),c=(e.children??[]).some(f=>r.byId.get(f)?.required),l=()=>{for(let f of s.current)f.removeAttribute("aria-invalid"),f.pxdDescribed?f.setAttribute("aria-describedby",f.pxdDescribed):f.removeAttribute("aria-describedby"),f.pxdNote?.remove(),f.pxdNote=void 0;s.current=[]},u=f=>{for(let y of f){y.setAttribute("aria-invalid","true");let h=y.closest(".pxd-field");if(h&&!h.querySelector(".pxd-field-error")){let k=h.ownerDocument.createElement("p");k.className="pxd-field-error",k.id=`${y.id}-error`,k.textContent=y.validationMessage,h.append(k),y.pxdNote=k,y.pxdDescribed=y.getAttribute("aria-describedby"),y.setAttribute("aria-describedby",[y.pxdDescribed,k.id].filter(Boolean).join(" "))}}s.current=f},x=f=>{let y=document.getElementById(f);y&&(y.scrollIntoView({block:"center"}),y.focus(),document.activeElement!==y&&y.closest(".pxd-field")?.querySelector("[role='radio'], button, input:not([aria-hidden]), textarea, select")?.focus())},[m,g]=t.state(e,"announced",null);return i!==m&&(g(i),i.length&&t.after(()=>r.root?.querySelector(`[data-pxd-id="${CSS.escape(e.id)}"] .pxd-error-summary`)?.focus())),o("form",{class:`pxd-form${e.aside?" pxd-form-with-aside":""}${e.layout==="horizontal"?" pxd-form-horizontal":""}`,novalidate:!0,onSubmit:f=>{f.preventDefault();let y=f.currentTarget;if(l(),!y.checkValidity()){let h=Qd(y,p);return u(h),n(h.map(k=>({id:k.id,label:Zd(k),message:k.validationMessage})))}n([]),r.dispatch(e.submit.action,a.scope,e.id)},...t.a11y(e)},e.aside&&o("aside",{class:"pxd-form-aside"},t.render(e.aside)),o("div",{class:"pxd-stack pxd-form-fields"},i.length>0&&o("section",{class:"pxd-error-summary",role:"alert",tabindex:"-1","aria-labelledby":p},o(`h${d}`,{id:p,class:"pxd-error-summary-title"},"Check these fields before continuing"),o("ul",{class:"pxd-error-summary-list"},...i.map(f=>o("li",{key:f.id},o("a",{href:`#${f.id}`,class:"pxd-link",onClick:y=>(y.preventDefault(),x(f.id))},f.label?`${f.label}: ${f.message}`:f.message))))),c&&o("p",{class:"pxd-required-legend"},o("span",{class:"pxd-required","aria-hidden":"true"},"*")," ","Required"),...he(t,e.children)),o("div",{class:"pxd-action-bar"},o("button",{type:"submit",class:"pxd-button pxd-button-primary"},a.text(e.submit.label)),e.cancel&&o("button",{type:"button",class:"pxd-button pxd-button-secondary",onClick:()=>r.dispatch(e.cancel.action,a.scope,e.id)},a.text(e.cancel.label))))}var ei=()=>ca(navigator.userAgentData?.platform??navigator.platform??"");function Gr(e,t){let a=t.b,r=t.r,d=t.id(e,"desc"),[p,i]=t.state(e,"copied",!1),n=e.disabled!==void 0?!!a.value(e.disabled):!1,s=e.tone==="danger"?" pxd-button-danger":"",c=e.description!==void 0?a.text(e.description):void 0,l=typeof e.shortcut=="string"&&e.shortcut?na(e.shortcut,ei()):void 0,u=()=>{let g=e.action.event.name;if(g==="ui.back"&&t.steps)return t.steps.back();if(g==="ui.next"&&t.steps)return t.steps.next();if(g==="ui.copy"){let f=ia(e,r.data,a.scope,a.text),y=()=>{i(!0),setTimeout(()=>i(!1),2e3)};typeof navigator<"u"&&navigator.clipboard?.writeText?navigator.clipboard.writeText(f).then(y,()=>{}):y()}r.dispatch(e.action,a.scope,e.id)},x=r.doc.surface.kind==="shell",m=g=>{let f=g;f&&(f.pxdKey&&document.removeEventListener("keydown",f.pxdKey),!(!l||n)&&(f.pxdKey=y=>{let h=r.root;y.defaultPrevented||y.repeat||!h||!f.isConnected||!x&&!h.contains(document.activeElement)&&!(y.target instanceof HTMLElement&&h.contains(y.target))||sa(l,y)&&(la(l)&&sr(y.target)||(y.preventDefault(),f.click()))},document.addEventListener("keydown",f.pxdKey),r.onDispose(()=>f.pxdKey&&document.removeEventListener("keydown",f.pxdKey))))};return o("button",{type:"button",class:`pxd-button pxd-button-${e.emphasis??"secondary"}${s}${c?" pxd-button-described":""}`,disabled:n,"aria-describedby":c?d:void 0,"aria-keyshortcuts":l?.aria,onClick:u,...t.a11y(e),ref:m},o("span",{class:"pxd-button-label"},p?"Copied":a.text(e.label)),l&&o("span",{class:"pxd-kbd-hint","aria-hidden":"true"},...l.hint.map((g,f)=>o("kbd",{key:f,class:"pxd-kbd"},g))),c&&o("span",{class:"pxd-button-description",id:d},c),e.action.event.name==="ui.copy"&&o("span",{class:"pxd-sr-only","aria-live":"polite"},p?"Copied":""))}function Wr(e,t){let a=t.b,r=t.r,[d,p]=t.state(e,"task",null),i=e.current!==void 0?a.value(e.current):void 0,[n,s]=t.state(e,"step",()=>Pt(i,e.steps.length)),c=e.kind??"wizard",l=o("div",{class:"pxd-action-bar"},o("button",{type:"button",class:"pxd-button pxd-button-primary",onClick:()=>r.dispatch(e.finish.action,a.scope,e.id)},a.text(e.finish.label)));if(c==="guide")return o("div",{class:"pxd-steps pxd-guide",...t.a11y(e)},o("ol",{class:"pxd-guide-list"},...e.steps.map((k,A)=>o("li",{key:k.key,class:"pxd-guide-step"},o("span",{class:"pxd-guide-number","aria-hidden":"true"},A+1),o("div",{class:"pxd-guide-body"},ve(t,"pxd-guide-title",a.text(k.title)),t.render(k.content))))),l);if(c==="tasklist"){let k=C=>Lt(C.status!==void 0?a.text(C.status):"todo"),A=e.steps.filter(C=>k(C).label==="Completed").length;return o("div",{class:"pxd-steps pxd-tasklist",...t.a11y(e)},o("p",{class:"pxd-steps-progress"},Vt(A,e.steps.length)),o("ul",{class:"pxd-tasklist-list"},...e.steps.map(C=>{let I=d===C.key,{label:E,tone:F}=k(C),$=E==="Cannot start yet";return o("li",{key:C.key,class:`pxd-task${I?" pxd-task-open":""}`},o("div",{class:"pxd-task-row"},o("button",{type:"button",class:"pxd-task-title","aria-expanded":I,disabled:$,onClick:()=>p(Dt(d,C.key))},a.text(C.title)),o("span",{class:`pxd-badge pxd-tone-${F} pxd-task-status`},E)),I&&o("div",{class:"pxd-task-content"},t.render(C.content)))})),l)}let u=e.steps.length,x=typeof i=="number"&&e.current?.path?{index:Math.max(0,Math.min(u-1,i)),total:u}:{...n,total:u},m=k=>{let A=$t(x,{type:"go",index:k});e.current?.path?a.write(e.current,A.index):s(A)},g=x.index,f=e.steps[g],y=Bt(x),h=t.with({steps:{back:()=>m(g-1),next:()=>m(g+1)}});return o("div",{class:"pxd-steps",...t.a11y(e)},o("p",{class:"pxd-steps-progress"},jt(x)),o("ol",{class:"pxd-steps-list"},...e.steps.map((k,A)=>o("li",{key:k.key,"aria-current":A===g?"step":void 0,class:A<g?"pxd-step-done":A===g?"pxd-step-current":void 0},a.text(k.title)))),o("form",{class:"pxd-steps-content",onSubmit:k=>{k.preventDefault(),y?r.dispatch(e.finish.action,a.scope,e.id):m(g+1)}},ve(h,"pxd-steps-title",a.text(f.title)),h.render(f.content),o("div",{class:"pxd-action-bar"},o("button",{type:"submit",class:"pxd-button pxd-button-primary"},y?a.text(e.finish.label):"Continue"),g>0&&o("button",{type:"button",class:"pxd-button pxd-button-secondary",onClick:()=>m(g-1)},"Back"))))}function Kr(e,t){let a=t.b,r=t.r,d=r.doc.root===e.id,[p,i]=t.state(e,"open",!0),[n,s]=t.state(e,"typed",""),c=t.id(e,"title"),l=t.id(e,"desc"),u=e.typeToConfirm!==void 0?a.text(e.typeToConfirm):void 0,x=!u||n.trim()===u,m=e.severity==="destructive",g=t.a11y(e),f=()=>{d||i(!1),r.dispatch(e.cancel?.action??{event:{name:"ui.dismiss"}},a.scope,e.id)},y=()=>x&&r.dispatch(e.confirm.action,a.scope,e.id),h=e.subject&&o("div",{class:"pxd-dialog-subject"},re(t,{value:e.subject.avatar!==void 0?a.value(e.subject.avatar):void 0,name:a.text(e.subject.title),size:56}),o("div",null,o("div",{class:"pxd-dialog-subject-title"},a.text(e.subject.title)),e.subject.subtitle!==void 0&&o("div",{class:"pxd-dialog-subject-sub"},a.text(e.subject.subtitle)))),k=e.amount&&o("div",{class:"pxd-dialog-amount"},a.text(e.amount.value,e.amount.format)),A=Array.isArray(e.consequences)&&o("ul",{class:"pxd-consequences"},...e.consequences.map((b,v)=>o("li",{key:v},o("span",{class:"pxd-consequence-icon"},D(b.icon??"info")),o("span",null,o("span",{class:"pxd-consequence-title"},a.text(b.title)),b.detail!==void 0&&o("span",{class:"pxd-consequence-detail"},a.text(b.detail)))))),C=o("div",{class:"pxd-dialog-description",id:l},e.message!==void 0&&o("p",null,a.text(e.message))),I=e.consequence!==void 0&&o("p",{class:"pxd-dialog-consequence",id:`${l}-consequence`},D("info",18),o("span",null,a.text(e.consequence))),E=(b,v)=>[A,e.summary&&t.render(e.summary),u&&o("div",{class:"pxd-field"},o("label",{class:"pxd-field-label",for:`${e.id}-type`},"Type ",o("strong",null,u)," to confirm"),o("input",{id:`${e.id}-type`,class:"pxd-input",autocomplete:"off",value:n,onInput:w=>s(w.target.value)})),I,o("div",{class:"pxd-action-bar"},b,v)],F=o("button",{type:"button",class:`pxd-button pxd-button-primary${m?" pxd-button-danger":""}`,disabled:!x,onClick:y},a.text(e.confirm.label)),$=e.cancel?a.text(e.cancel.label):"Cancel",T=e.consequence!==void 0?`${l} ${l}-consequence`:l;if(d){let[b,v]=t.state(e,"focused",!1);return b||(v(!0),t.after(()=>r.root?.querySelector(`[data-pxd-id="${CSS.escape(e.id)}"] > .pxd-action-bar > .pxd-button-secondary`)?.focus({preventScroll:!0}))),o("div",{role:"alertdialog","aria-modal":"false","aria-labelledby":c,"aria-describedby":T,class:`pxd-dialog pxd-dialog-inline${m?" pxd-dialog-destructive":""}`,onKeydown:w=>w.key==="Escape"&&f(),...g},o("h1",{class:"pxd-dialog-title",id:c},a.text(e.title)),k,h,C,...E(F,o("button",{type:"button",class:"pxd-button pxd-button-secondary",onClick:f},$)))}return p&&t.portal(ue({ctx:t,id:t.id(e,"dialog"),role:"alertdialog",class:`pxd-dialog${m?" pxd-dialog-destructive":""}`,onClose:f,props:{"aria-labelledby":c,"aria-describedby":T,...g}},o("h2",{id:c,class:"pxd-dialog-title"},a.text(e.title)),k,h,C,...E(F,o("button",{type:"button",class:"pxd-button pxd-button-secondary",autofocus:!0,onClick:f},$)))),null}function Xr(e,t){let a=t.b,r=t.r,d=O(e.items.path,a.scope),p=Z(_(r.data,d)),i=p.map((g,f)=>({pointer:K(d,f)})),n=(g,f)=>_(r.data,O(g,i[f])),s=e.recommended!==void 0?a.text(e.recommended):void 0,c=e.recommendedReason!==void 0?a.text(e.recommendedReason):void 0,l=Wa(e.attributes,p.length,n),u=Ka(e.attributes,a.text),x=Xa(p.map((g,f)=>String(n(e.itemTitle,f)??"")),s),m=(g,f)=>{let y=n(g.path,f);return typeof y=="boolean"?y?o("span",{class:"pxd-yes"},D("check",18),o("span",{class:"pxd-sr-only"},"Included")):o("span",{class:"pxd-no"},D("dash",18),o("span",{class:"pxd-sr-only"},"Not included")):G(y,X(g.format,r.data,a.scope),r.locale)};return o("div",{class:"pxd-comparison",...t.a11y(e)},e.summary!==void 0&&o("p",{class:"pxd-comparison-summary"},a.text(e.summary)),o("ul",{class:"pxd-comparison-items"},...x.map(g=>{let f=String(n(e.itemTitle,g)??""),y=s===f;return o("li",{key:g,class:`pxd-comparison-item${y?" pxd-recommended":""}`},y&&o("p",{class:"pxd-recommendation"},o("span",{class:"pxd-badge pxd-tone-info"},"Recommended"),c&&o("span",{class:"pxd-recommendation-reason"},c)),ve(t,"pxd-comparison-title",f),...u.map((h,k)=>o("div",{class:"pxd-comparison-group",key:k},h.label&&o("p",{class:"pxd-comparison-group-label"},h.label),o("dl",null,...h.attributes.map(A=>o("div",{class:"pxd-detail-row",key:A.key},o("dt",null,a.text(A.label)),o("dd",null,m(A,g),l.get(A.key)===g&&o("span",{class:"pxd-best"}," Best"))))))),e.choose&&o("button",{type:"button",class:`pxd-button ${y?"pxd-button-primary":"pxd-button-secondary"}`,onClick:()=>r.dispatch(e.choose.action,i[g],e.id)},`${a.text(e.choose.label)} `,o("span",{class:"pxd-sr-only"},f)))})))}function Yr(e,t){let a=t.r,r=e.children??[],[d,p]=t.state(e,"shown",r.length),[i]=t.state(e,"widths",()=>new Map),[n]=t.state(e,"measured",()=>({trigger:44,width:-1})),[s,c]=t.state(e,"menu",be),l=mo(r,a.byId),u=t.id(e,"more"),x=y=>{if(r.length<=2||getComputedStyle(y).flexDirection==="column")return p(r.length);for(let A of y.querySelectorAll(":scope > [data-pxd-id]"))A.offsetWidth&&i.set(A.dataset.pxdId,A.offsetWidth);let h=y.querySelector(":scope > .pxd-action-bar-more");h?.offsetWidth&&(n.trigger=h.offsetWidth);let k=parseFloat(getComputedStyle(y).columnGap)||0;p(yo(r,A=>i.get(A)??0,k,y.clientWidth,n.trigger,l))},m=y=>{y&&a.observeWidth(y,`${e.id}:bar`,h=>{h!==n.width&&(n.width=h,x(y))})};t.after(()=>{let y=a.root?.querySelector(`[data-pxd-id="${CSS.escape(e.id)}"].pxd-action-bar`);y&&x(y)});let g=r.slice(0,Math.min(d,r.length)),f=r.slice(g.length);return f.length&&He(t,u,s,c,ti(t,f),{class:"pxd-menu pxd-action-menu"}),o("div",{class:"pxd-action-bar",role:"group","aria-label":"Actions",...t.a11y(e),ref:m},...g.map(y=>t.render(y)),f.length>0&&o("button",{type:"button",...qe(u,s,c,"start",{class:"pxd-icon-button pxd-action-menu-trigger pxd-action-menu-overflow pxd-action-bar-more","aria-label":go})},D("dots",18)))}function ti(e,t){let a=e.b,r=t.map(s=>e.r.byId.get(s)).filter(s=>!!s&&s.component==="Action"&&(s.visible===void 0||a.value(s.visible)!==!1)),{usual:d,danger:p,divider:i}=Ze(r),n=s=>({key:s.id,label:[a.text(s.label)],class:`pxd-menu-item${s.tone==="danger"?" pxd-menu-item-danger":""}`,disabled:s.disabled!==void 0?!!a.value(s.disabled):void 0,onSelect:()=>e.r.dispatch(s.action,a.scope,s.id),props:{"data-pxd-id":s.id,"data-pxd-component":s.component}});return[...d.map(n),...i?["separator"]:[],...p.map(n)]}function Jr(e,t){let a=t.b,r=t.r,[d,p]=t.state(e,"compact",!1),[i,n]=t.state(e,"open",!1),s=t.a11y(e),c=t.id(e,"sheet"),l=e.label!==void 0?a.text(e.label):"Filters",u=(e.children??[]).map(E=>r.byId.get(E)).filter(Boolean),x=u.filter(E=>E.component==="TextInput"&&E.kind==="search"),m=u.filter(E=>!x.includes(E)),g=lo(m,r.data,a.scope,r.locale,a.text),f=E=>r.surface.write(E.binding,E.cleared,a.scope),y=e.resultCount!==void 0?a.value(e.resultCount):void 0,h=xo(y,r.locale),k=()=>{for(let E of g)f(E);e.clear&&r.dispatch(e.clear,a.scope,e.id)},A=()=>n(!1),C=()=>m.map(E=>t.render(E.id)),I=o("div",{class:"pxd-filter-results"},...x.map(E=>t.render(E.id)),o("div",{class:"pxd-filter-status"},d&&o("button",{type:"button",class:"pxd-chip pxd-filter-trigger","aria-haspopup":"dialog","aria-expanded":i,"aria-controls":i?c:void 0,"data-state":i?"open":"closed",onClick:()=>n(!0)},D("filter",18),l,g.length>0&&o("span",{"aria-hidden":"true"},` \xB7 ${g.length}`),g.length>0&&o("span",{class:"pxd-sr-only"},`, ${g.length} active`)),h&&o("p",{class:"pxd-filter-count","aria-live":"polite"},h)),g.length>0&&o("ul",{class:"pxd-filter-chips","aria-label":"Active filters"},...g.map(E=>o("li",{key:E.key},o("button",{type:"button",class:"pxd-chip pxd-filter-chip",onClick:()=>f(E),"aria-label":`Remove filter: ${E.label}`},E.label,D("close",16)))),o("li",null,o("button",{type:"button",class:"pxd-button pxd-button-tertiary pxd-filter-clear",onClick:k},"Clear all"))),t.render(e.results));if(d&&i){let E=t.id(e,"sheet-title");t.portal(ue({ctx:t,id:c,class:"pxd-sheet",onClose:A,props:{id:c,"aria-labelledby":E}},o("div",{class:"pxd-sheet-header"},o("h2",{id:E,class:"pxd-sheet-title"},l),ye(A,{class:"pxd-icon-button","aria-label":"Close"},D("close"))),o("div",{class:"pxd-sheet-body pxd-stack"},...C()),o("div",{class:"pxd-sheet-footer"},g.length>0&&o("button",{type:"button",class:"pxd-button pxd-button-secondary",onClick:k},"Clear all"),ye(A,{class:"pxd-button pxd-button-primary"},h?`Show ${h}`:"Show results"))))}return o("div",{class:`pxd-filter-panel${d?" pxd-filter-compact":""}`,...s,ref:E=>E&&r.observeWidth(E,`${e.id}:filter`,F=>p(F<co))},d?I:o("div",{class:"pxd-filter-layout"},o("section",{class:"pxd-filter-sidebar","aria-label":l},ve(t,"pxd-filter-title",l),o("div",{class:"pxd-stack"},...C())),I))}function Zr(e,t){let a=t.b,r=t.r,d=t.frame,[p,i]=t.state(e,"compact",!1),[n,s]=t.state(e,"open",!1),[c,l]=t.state(e,"toggled",()=>({})),u=e.kind??"main",x=d&&d.navigationId===e.id&&u==="main"?d.navigation:void 0,m=a.value(e.current),g=x&&d?.current?.key!==void 0?d.current.key:m,f=e.label!==void 0?a.text(e.label):Ja(u),y=t.a11y(e),h=t.id(e,"drawer"),k=b=>{s(!1),d?.setDrawerOpen(!1),r.dispatch(b.action,a.scope,e.id)},A=b=>{let v=b.badge!==void 0?a.value(b.badge):void 0;return v?o("span",{class:"pxd-nav-badge"},v,o("span",{class:"pxd-sr-only"}," needing attention")):null};if(u==="breadcrumb")return o("nav",{class:"pxd-nav-breadcrumb","aria-label":f,...y},o("ol",null,...e.items.map((b,v)=>{let w=v===e.items.length-1,N=b.key===g||g===void 0&&w;return o("li",{key:b.key},N?o("span",{class:"pxd-nav-breadcrumb-current","aria-current":"page"},a.text(b.label)):o("button",{type:"button",class:"pxd-link",onClick:()=>k(b)},a.text(b.label)))})));if(u==="toc")return o("nav",{class:"pxd-nav-toc","aria-label":f,...y},o("p",{class:"pxd-nav-toc-label","aria-hidden":"true"},f),o("ol",null,...e.items.map(b=>{let v=b.key===g;return o("li",{key:b.key},o("a",{href:`#${b.key}`,class:`pxd-nav-toc-link${v?" pxd-nav-current":""}`,"aria-current":v?"true":void 0,onClick:()=>r.dispatch(b.action,a.scope,e.id)},a.text(b.label)))})));if(u==="local")return o("nav",{class:"pxd-nav-local","aria-label":f,...y},o("ul",null,...e.items.map(b=>{let v=b.key===g;return o("li",{key:b.key},o("button",{type:"button",class:`pxd-nav-local-item${v?" pxd-nav-current":""}`,"aria-current":v?"page":void 0,onClick:()=>k(b)},b.icon&&D(b.icon,16),o("span",{class:"pxd-nav-label"},a.text(b.label)),A(b)))})));let C=Ya(e.items,a.text),I=u==="nested",E=b=>b.label&&b.label in c?c[b.label]:!b.label||b.items.some(v=>v.key===g),F=b=>o("ul",null,...b.map(v=>{let w=v.key===g;return o("li",{key:v.key},o("button",{type:"button",class:`pxd-nav-item${w?" pxd-nav-current":""}`,"aria-current":w?"page":void 0,onClick:()=>k(v)},v.icon&&D(v.icon,18),o("span",{class:"pxd-nav-label"},a.text(v.label)),A(v)))})),$=o("nav",{class:`pxd-nav${I?" pxd-nav-nested":""}${x==="side"?" pxd-nav-side":""}`,"aria-label":f,...x==="side"?y:{}},...C.map((b,v)=>o("div",{class:"pxd-nav-group",key:v},b.label&&(I?o("button",{type:"button",class:"pxd-nav-group-toggle","aria-expanded":E(b),onClick:()=>l({...c,[b.label]:!E(b)})},D(E(b)?"sortUp":"sortDown",16),o("span",{class:"pxd-nav-group-label"},b.label)):o("p",{class:"pxd-nav-group-label"},b.label)),(!I||E(b))&&F(b.items))));if(x==="side")return $;if(x==="rail"||x==="bar"){let b=x==="bar"?e.items.slice(0,5):e.items;return o("nav",{class:`pxd-nav-${x}`,"aria-label":f,...y},o("ul",null,...b.map(v=>{let w=v.key===g,N=a.text(v.label);return o("li",{key:v.key},o("button",{type:"button",class:`pxd-nav-${x}-item${w?" pxd-nav-current":""}`,"aria-current":w?"page":void 0,onClick:()=>k(v)},o("span",{class:`pxd-nav-${x}-icon`},v.icon?D(v.icon,24):o("span",{class:"pxd-nav-glyph","aria-hidden":"true"},N.slice(0,1)),A(v)),o("span",{class:"pxd-nav-label"},N)))})))}let T=(b,v,w)=>{if(!b)return;let N=t.id(e,"drawer-title");t.portal(ue({ctx:t,id:h,class:"pxd-nav-drawer",onClose:v,props:{id:h,"aria-labelledby":N,...w}},o("div",{class:"pxd-sheet-header"},o("h2",{id:N,class:"pxd-sheet-title"},f),ye(v,{class:"pxd-icon-button","aria-label":"Close"},D("close"))),$))};return x==="drawer"&&d?(T(d.drawerOpen,()=>d.setDrawerOpen(!1),y),null):(T(p&&n,()=>s(!1),{}),o("div",{class:"pxd-nav-wrap",...y,ref:b=>{if(!b||u!=="main"||x)return;let v=b.closest(".pxd-surface")??b;r.observeWidth(v,`${e.id}:nav`,w=>i(w<900))}},p?o("button",{type:"button",class:"pxd-icon-button pxd-nav-menu","aria-label":`${f} menu`,"aria-haspopup":"dialog","aria-expanded":n,"aria-controls":n?h:void 0,"data-state":n?"open":"closed",onClick:()=>s(!0)},D("menu")):$))}function ai(e,t,a){t.action&&e.r.dispatch({event:{name:t.action.event.name,context:Ne(t,e.r.data,e.scope,a)}},{pointer:""},t.id)}function ed(e,t){let a=t.b,r=a.text(e.label),d=e.kind??"label",p=d==="status"?e.tone??"neutral":"neutral",i=t.a11y(e),n=`pxd-tag pxd-tag-${d} pxd-tag-${p}${e.remove?" pxd-tag-removable":""}`;return d==="count"?o("span",{class:n,title:r,...i},o("span",{class:"pxd-sr-only"},`${r}: `),o("span",{class:"pxd-tag-number"},a.text(e.count,{type:"number"}))):o("span",{class:n,title:r,...i},o("span",{class:"pxd-tag-text"},r),e.remove&&o("button",{type:"button",class:"pxd-tag-remove","aria-label":`Remove ${r}`,onClick:()=>t.r.dispatch(e.remove,a.scope,e.id)},D("close",12)))}function td(e,t){let a=t.b,r=t.r,d=t.id(e,"name"),p=t.id(e,"detail"),i=t.a11y(e),n=e.kind??"person",s=e.size??"default",c=gt[s]??gt.default,l=a.text(e.name),u=e.detail!==void 0?a.text(e.detail):void 0,x={"--polyxd-identity-size":`${c}px`},m=`pxd-identity pxd-identity-${s} pxd-identity-${n}${e.group?" pxd-identity-group":""}`,g,f=l;if(e.group){let h=O(e.group.path,a.scope),k=Z(_(r.data,h)).map((E,F)=>{let $={pointer:K(h,F)},T=b=>b?_(r.data,O(b,$)):void 0;return{name:String(T(e.group.namePath)??""),image:T(e.group.imagePath)}}),A=e.group.max??4,C=k.slice(0,A),I=k.slice(A);f||(f=Ra(k,A)),g=o("span",{class:"pxd-identity-faces"},...C.map((E,F)=>o("span",{class:"pxd-identity-face",key:F},re(t,{value:E.image,name:E.name,size:c}),o("span",{class:"pxd-sr-only"},E.name))),I.length>0&&o("span",{class:"pxd-identity-face pxd-identity-more",role:"img",title:I.map(E=>E.name).join(", "),"aria-label":`${I.length} more: ${I.map(E=>E.name).join(", ")}`},o("span",{"aria-hidden":"true"},`+${I.length}`)))}else g=re(t,{value:a.value(e.image),name:l,size:c});let y=[g,o("span",{class:"pxd-identity-text"},o("span",{class:"pxd-identity-name",id:d},f),u&&o("span",{class:"pxd-identity-detail",id:p},u))];return e.action?o("button",{type:"button",class:`${m} pxd-identity-button`,style:x,"aria-labelledby":d,"aria-describedby":u?p:void 0,onClick:()=>r.dispatch(e.action,a.scope,e.id),...i},...y):o("div",{class:m,style:x,role:"group","aria-labelledby":d,"aria-describedby":u?p:void 0,...i},...y)}function ad(e,t){let a=t.b,r=t.id(e,"label"),d=t.a11y(e),p=e.kind??"bar",i=a.text(e.label),n=e.caption!==void 0?a.text(e.caption):void 0,s=Aa({kind:p,thresholds:e.thresholds,tone:e.tone,format:X(e.format,t.r.data,a.scope)},a.value(e.value),e.max!==void 0?a.value(e.max):void 0,!!a.value(e.indeterminate),n,t.r.locale),c=p==="meter"?"meter":"progressbar",l=`pxd-gauge pxd-gauge-${p}${s.tone&&s.tone!=="neutral"?` pxd-gauge-${s.tone}`:""}${s.indeterminate?" pxd-gauge-indeterminate":""}`,u=o("div",{class:"pxd-gauge-header"},o("span",{class:"pxd-gauge-label",id:r},i),o("span",{class:"pxd-gauge-readout"},!s.indeterminate&&o("span",{class:"pxd-gauge-value"},s.readout),n&&o("span",{class:"pxd-gauge-caption"},n),s.hint&&o("span",{class:"pxd-gauge-hint"},s.hint)));return p==="ring"?o("div",{class:l,...d},o("div",{class:"pxd-gauge-ring-graphic",role:c,"aria-labelledby":r,...s.valueProps},o("svg",{class:"pxd-gauge-ring-svg",viewBox:"0 0 36 36","aria-hidden":"true",focusable:"false"},o("circle",{class:"pxd-gauge-ring-track",cx:"18",cy:"18",r:"16",fill:"none","stroke-width":"4"}),o("circle",{class:"pxd-gauge-ring-fill",cx:"18",cy:"18",r:"16",fill:"none","stroke-width":"4",pathLength:100,"stroke-dasharray":s.indeterminate?"25 100":`${s.percent} 100`,"stroke-linecap":"round"}))),u):o("div",{class:l,...d},u,o("div",{class:"pxd-gauge-track",role:c,"aria-labelledby":r,...s.valueProps},o("div",{class:"pxd-gauge-fill",style:s.indeterminate?void 0:{width:`${s.percent}%`}})))}function Qr(e){let t=Math.round(Math.max(0,Math.min(1,e))*100);return o("span",{class:"pxd-rating-star-shape","aria-hidden":"true"},o("svg",{class:"pxd-rating-star-empty",viewBox:"0 0 24 24",focusable:"false"},o("path",{d:mt})),o("span",{class:"pxd-rating-star-fill",style:{width:`${t}%`}},o("svg",{viewBox:"0 0 24 24",focusable:"false"},o("path",{d:mt}))))}function od(e,t){let a=t.b,r=t.r,d=t.id(e,"label"),p=t.id(e,"help"),[i,n]=t.state(e,"hover",null),s=t.a11y(e),c=e.max??5,l=a.text(e.label),u=a.value(e.value),x=u==null||u===""?void 0:Number(u),m=x!==void 0&&Number.isFinite(x)?Math.max(0,Math.min(c,x)):void 0,g=!!a.value(e.readOnly),f=e.count!==void 0?a.value(e.count):void 0,y=f!=null?G(f,{type:"number"},r.locale):void 0,h=e.help!==void 0?a.text(e.help):void 0,k=m!==void 0?G(m,{type:"number",precision:Number.isInteger(m)?0:1},r.locale):void 0,A=f!=null?`from ${y} ${Number(f)===1?"rating":"ratings"}`:void 0;if(g)return o("div",{class:"pxd-rating pxd-rating-readonly",...s},o("span",{class:"pxd-rating-label"},l),o("span",{class:"pxd-rating-stars",role:"img","aria-label":Na(k,c)},...Array.from({length:c},(F,$)=>Qr((m??0)-$))),o("span",{class:"pxd-rating-readout"},k&&o("span",{class:"pxd-rating-value","aria-hidden":"true"},k),y&&o("span",{class:"pxd-rating-count"},o("span",{"aria-hidden":"true"},`(${y})`),o("span",{class:"pxd-sr-only"},A))));let C=m!==void 0?Math.round(m):0,I=i??C,E=F=>{let $=Number(F);a.write(e.value,$),ai(t,e,$)};return o("div",{class:"pxd-field pxd-rating",...s},o("div",{class:"pxd-field-label",id:d},l,e.required&&o("span",{class:"pxd-required","aria-hidden":"true"},"*")),h&&o("p",{class:"pxd-field-help",id:p},h),o("div",{class:"pxd-rating-row"},Ce({class:"pxd-rating-stars",orientation:"horizontal","aria-labelledby":d,"aria-describedby":h?p:void 0,"aria-required":e.required||void 0,value:C?String(C):"",onValueChange:E,onMouseleave:()=>n(null)},...Array.from({length:c},(F,$)=>$+1).map(F=>Ue({key:F,value:String(F),group:C?String(C):"",first:F===1,onSelect:()=>E(String(F)),class:`pxd-rating-star${F<=I?" pxd-rating-star-on":""}`,"aria-label":Ia(F),"data-orientation":"horizontal",onMouseenter:()=>n(F),onFocus:()=>n(null)},Qr(F<=I?1:0)))),o("span",{class:"pxd-rating-readout","aria-hidden":"true"},k&&o("span",{class:"pxd-rating-value"},k),y&&o("span",{class:"pxd-rating-count"},`(${y})`)),A&&o("span",{class:"pxd-sr-only"},A)))}var oi=2e3;function rd(e,t){let a=t.b,r=t.id(e,"label"),d=t.a11y(e),p=a.text(e.text),i=e.label!==void 0?a.text(e.label):void 0,n=!!a.value(e.secret),s=e.copyable!==!1,[c,l]=t.state(e,"revealed",!1),[u,x]=t.state(e,"status",""),[m]=t.state(e,"timer",()=>({id:null})),g=C=>{x(C),m.id&&clearTimeout(m.id),m.id=setTimeout(()=>x(""),oi)},f=()=>{let C=typeof navigator<"u"?navigator.clipboard:void 0;if(!C?.writeText)return g("Couldn't copy");C.writeText(p).then(()=>g("Copied"),()=>g("Couldn't copy"))},y=n&&!c,h=y?Ta(p):p,k=i??"code",A=i??(e.language?`${e.language} code`:"Code");return o("section",{class:`pxd-code${e.wrap?" pxd-code-wrap":""}${n?" pxd-code-secret":""}`,"aria-labelledby":i!==void 0?r:void 0,"aria-label":i===void 0?A:void 0,...d},o("div",{class:"pxd-code-header"},i!==void 0&&o("span",{class:"pxd-code-label",id:r},i),o("div",{class:"pxd-code-controls"},n&&o("button",{type:"button",class:"pxd-button pxd-button-tertiary pxd-code-control","aria-label":`${c?"Hide":"Show"} ${k}`,onClick:()=>l(!c)},c?"Hide":"Show"),s&&o("button",{type:"button",class:"pxd-button pxd-button-tertiary pxd-code-control","aria-label":`Copy ${k}`,onClick:f},u==="Copied"&&D("check",16),u==="Copied"?"Copied":"Copy"),o("span",{class:"pxd-sr-only",role:"status","aria-live":"polite"},u))),o("pre",{class:"pxd-code-pre",tabindex:"0","data-language":e.language,"data-masked":y||void 0},o("code",{class:e.language?`language-${e.language}`:void 0,translate:"no"},h)))}var dd=()=>o("svg",{class:"pxd-action-menu-chevron",width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},o("path",{d:"m6 9 6 6 6-6"}));function id(e,t){let a=t.b,r=t.r,d=t.a11y(e),p=e.kind??"overflow",i=a.text(e.label),n=d["aria-label"]??i,s=t.id(e,"menu"),[c,l]=t.state(e,"menu",be),[u,x]=t.state(e,"context",be),m=(e.children??[]).map(I=>r.byId.get(I)).filter(I=>!!I&&(I.visible===void 0||a.value(I.visible)!==!1)),{usual:g,danger:f,divider:y}=Ze(m),h=I=>({key:I.id,label:[a.text(I.label)],class:`pxd-menu-item${I.tone==="danger"?" pxd-menu-item-danger":""}`,disabled:I.disabled!==void 0?!!a.value(I.disabled):void 0,onSelect:()=>r.dispatch(I.action,a.scope,I.id),props:{"data-pxd-id":I.id,"data-pxd-component":I.component}}),k=[...g.map(h),...y?["separator"]:[],...f.map(h)];He(t,s,c,l,k,{class:"pxd-menu pxd-action-menu"});let A=(I,E,...F)=>o("button",{type:"button",...qe(s,c,l,E,I)},...F),C=()=>A({class:"pxd-icon-button pxd-action-menu-trigger pxd-action-menu-overflow",...d,"aria-label":n},"end",D("dots",18));if(p==="dropdown")return A({class:"pxd-button pxd-button-secondary pxd-action-menu-trigger pxd-action-menu-dropdown",...d,"aria-label":d["aria-label"]},"end",i,dd());if(p==="split"){let E=(e.primary?r.byId.get(e.primary):void 0)?.emphasis??"secondary";return o("div",{class:"pxd-split",role:"group",...d,"aria-label":n},e.primary&&t.render(e.primary),A({class:`pxd-button pxd-button-${E} pxd-action-menu-trigger pxd-split-menu`,"aria-label":`${i}: more options`},"end",dd()))}return p==="context"?(He(t,`${s}-context`,u,x,k,{class:"pxd-menu pxd-action-menu","aria-label":n}),o("span",{class:"pxd-context-target","data-state":u.open?"open":"closed",style:{WebkitTouchCallout:"none"},onContextmenu:I=>{I.preventDefault(),x({open:!0,x:I.clientX,y:I.clientY,align:"start"})}},C())):C()}function pd(e,t){let a=t.b,r=t.r,d=t.a11y(e),p=Math.min(t.heading,6),i=t.id(e,"title"),n=t.id(e,"panel"),s=e.kind??"dialog",c=e.size??"default",l=e.dismissible!==!1,u=ge(e.open),[x,m]=t.state(e,"open",!0),g=u?!!a.value(e.open):x&&e.open!==!1,f=()=>{u?a.write(e.open,!1):m(!1),r.dispatch({event:{name:"ui.dismiss"}},a.scope,e.id)},y=a.text(e.title),h=`pxd-panel pxd-panel-${s} pxd-panel-size-${c}`,k=t.with({heading:p+1}),A=()=>o("div",{class:"pxd-panel-body pxd-stack"},...he(k,e.children)),C=()=>e.actions&&o("div",{class:"pxd-panel-footer"},t.render(e.actions));if(s==="popover")return g&&xr(t,n,`.pxd-panel-anchor[data-pxd-anchor="${CSS.escape(e.id)}"]`,f,l,{class:h,"aria-labelledby":i,...d},o("div",{class:"pxd-panel-header"},o(`h${p}`,{id:i,class:"pxd-panel-title"},y),l&&o("button",{type:"button",class:"pxd-icon-button pxd-panel-close","aria-label":"Close",onClick:f},D("close"))),A(),C(),o("span",{style:{position:"absolute",left:"50%",top:"100%",transform:"translateX(-50%)"}},o("svg",{class:"pxd-panel-arrow",width:16,height:8,viewBox:"0 0 30 10",preserveAspectRatio:"none"},o("polygon",{points:"0,0 30,0 15,10"})))),o("span",{class:"pxd-panel-anchor","data-pxd-anchor":e.id});if(!g)return null;let I=s==="sheet"&&l?ri(f):{};return t.portal(ue({ctx:t,id:n,class:h,overlayClass:"pxd-overlay pxd-panel-backdrop",dismissible:l,onClose:f,props:{"aria-labelledby":i,...d}},o("div",{class:"pxd-panel-header",...I},s==="sheet"&&o("span",{class:"pxd-panel-grip","aria-hidden":"true"}),o(`h${p}`,{id:i,class:"pxd-panel-title"},y),l&&ye(f,{class:"pxd-icon-button pxd-panel-close","aria-label":"Close"},D("close"))),A(),C())),null}function ri(e){let t=null,a=d=>d.currentTarget.closest("dialog"),r=d=>{t=null;let p=a(d);p&&(p.style.transform="",p.style.transition="")};return{onPointerdown:d=>{d.pointerType==="mouse"&&d.button!==0||(t=d.clientY,d.currentTarget.setPointerCapture(d.pointerId))},onPointermove:d=>{let p=a(d);if(t===null||!p)return;let i=Math.max(0,d.clientY-t);p.style.transition="none",p.style.transform=`translateY(${i}px)`},onPointerup:d=>{if(t===null)return;let p=d.clientY-t,i=a(d);r(d),p>80&&(i?.open&&i.close(),e())},onPointercancel:r}}var Ge=(...e)=>e.filter(Boolean).join(" ")||void 0,Ro=e=>e.target.value,Uo=e=>{typeof e.ref=="string"&&e.ref.startsWith("blob:")&&URL.revokeObjectURL(e.ref)};function sd(e,t){let a=t.b,r=t.r,d=t.id(e),p=t.id(e,"help"),i=t.id(e,"error"),[n,s]=t.state(e,"error",null),[c,l]=t.state(e,"dragging",!1),u=a.value(e.value),x=Array.isArray(u)?u:[],m=Array.isArray(e.accept)?e.accept:[],g=e.maxSize,f=!!e.multiple,y=a.text(e.label),h=[e.help!==void 0?a.text(e.help):"",Ca(m,g,f,r.locale)].filter(Boolean).join(" ")||void 0,k=C=>{if(!C)return;let I=Array.from(C),E=[],F=[];for(let $ of f?I:I.slice(0,1)){let T=Ea($,m,g,r.locale);T?(F.push(T),r.events?.inputError(e,wo($,g))):E.push({name:$.name,size:$.size,type:$.type,ref:URL.createObjectURL($)})}if(s(F.length?F.join(" "):null),E.length!==0)if(f){let $=E.filter(T=>!x.some(b=>b.name===T.name&&b.size===T.size));E.filter(T=>!$.includes(T)).forEach(Uo),$.length&&a.write(e.value,[...x,...$])}else x.forEach(Uo),a.write(e.value,E)},A=C=>{Uo(x[C]),a.write(e.value,x.filter((I,E)=>E!==C)),s(null)};return o("div",{class:"pxd-field pxd-file"},o("label",{class:"pxd-field-label",for:d},y,e.required&&Ee()),h&&o("p",{class:"pxd-field-help",id:p},h),o("div",{class:"pxd-dropzone","data-dragging":c||void 0,onDrop:C=>{C.preventDefault(),l(!1),k(C.dataTransfer?.files??null)},onDragover:C=>{C.preventDefault(),c||l(!0)},onDragleave:C=>{C.currentTarget.contains(C.relatedTarget)||l(!1)}},o("input",{id:d,class:"pxd-dropzone-input",type:"file",accept:m.length?m.join(","):void 0,multiple:f,required:e.required&&x.length===0,"aria-describedby":Ge(h&&p,n&&i),"aria-invalid":n?!0:void 0,onChange:C=>{let I=C.target;k(I.files),I.value=""},...t.a11y(e)}),o("span",{class:"pxd-dropzone-icon","aria-hidden":"true"},D("file",24)),o("span",{class:"pxd-dropzone-text"},o("span",{class:"pxd-dropzone-action"},f?"Choose files":"Choose a file"),o("span",{class:"pxd-dropzone-hint"},f?"or drop them here":"or drop it here"))),n&&o("p",{class:"pxd-field-error",id:i,role:"alert"},n),x.length>0&&o("ul",{class:"pxd-file-list"},...x.map((C,I)=>o("li",{class:"pxd-file-item",key:`${C.name}-${C.size}-${I}`},o("span",{class:"pxd-file-icon","aria-hidden":"true"},D("file",18)),o("span",{class:"pxd-file-text"},o("span",{class:"pxd-file-name"},C.name),o("span",{class:"pxd-file-size"},De(C.size,r.locale)),typeof C.progress=="number"&&C.progress<1&&o("progress",{class:"pxd-file-progress",value:C.progress,max:1,"aria-label":`Uploading ${C.name}`})),o("button",{type:"button",class:"pxd-file-remove","aria-label":`Remove ${C.name}`,onClick:()=>A(I)},D("close",18))))))}var Me="__other";function ld(e,t){let a=t.b,r=t.id(e,"label"),d=t.id(e,"help"),p=t.id(e,"picker"),i=t.id(e,"text"),n=t.id(e,"alpha"),s=e.format??"hex",c=!!e.alpha,l=a.text(e.label),u=e.help!==void 0?a.text(e.help):void 0,x=a.value(e.value),m=x==null?"":String(x),g=ze(m),[f,y]=t.state(e,"draft",null),[h,k]=t.state(e,"other",!1),A=t.a11y(e),C=e.swatches?Se({...e,options:e.swatches},t.r.data,a.scope,a.text):[],I=C.length>0,E=z=>a.write(e.value,ft(z,s,c)),F=z=>{y(z);let M=ze(z);M&&E(M)},$=C.findIndex(z=>g?ka(ze(z.value),g,c):String(z.value)===m&&m!==""),T=h?Me:$>=0?String($):m?Me:"",b=!I||T===Me,v=Math.round((g?.a??1)*100),w=()=>o("div",{class:"pxd-color-picker"},o("input",{id:p,class:"pxd-color-native",type:"color",value:va(g),"aria-label":`${l}: pick`,"aria-describedby":Ge(u&&d),onInput:z=>{let M=ze(Ro(z));M&&(y(null),E({...M,a:g?.a??1}))}}),o("input",{id:i,class:"pxd-input pxd-input-mono pxd-color-text",type:"text",inputmode:"text",autocomplete:"off",spellcheck:"false",placeholder:wa(s),value:f??m,"aria-label":`${l}: value`,"aria-describedby":Ge(u&&d),"aria-invalid":f!==null&&f!==""&&!ze(f)?!0:void 0,required:!I&&e.required,onInput:z=>F(Ro(z)),onBlur:()=>y(null)}),c&&o("label",{class:"pxd-color-alpha",for:n},o("span",{class:"pxd-color-alpha-label"},"Opacity"),o("input",{id:n,type:"range",min:0,max:100,step:1,value:String(v),disabled:!g,"aria-valuetext":`${v}%`,onInput:z=>{g&&(y(null),E({...g,a:Number(Ro(z))/100}))}}),o("output",{class:"pxd-color-alpha-value",for:n,"aria-hidden":"true"},`${v}%`)));if(!I)return o("div",{class:"pxd-field pxd-color",role:"group","aria-labelledby":r,"aria-describedby":Ge(u&&d),...A},o("div",{class:"pxd-field-label",id:r},l,e.required&&Ee()),u&&o("p",{class:"pxd-field-help",id:d},u),w());let N=z=>{if(z===Me)return k(!0);k(!1),y(null);let M=C[Number(z)],S=ze(M.value);a.write(e.value,S?ft(S,s,c):M.value)};return o("div",{class:"pxd-field pxd-color",...A},o("div",{class:"pxd-field-label",id:r},l,e.required&&Ee()),u&&o("p",{class:"pxd-field-help",id:d},u),Ce({class:"pxd-swatches","aria-labelledby":r,"aria-describedby":Ge(u&&d),"aria-required":e.required||void 0,value:T,orientation:"horizontal",onValueChange:N},...C.map((z,M)=>Ue({key:String(M),value:String(M),group:T,first:M===0,onSelect:()=>N(String(M)),class:"pxd-swatch",title:z.label,"data-orientation":"horizontal"},o("span",{class:"pxd-swatch-color",style:{background:String(z.value)},"aria-hidden":"true"}),o("span",{class:"pxd-swatch-name"},z.label))),Ue({key:Me,value:Me,group:T,onSelect:()=>N(Me),class:"pxd-swatch pxd-swatch-other",title:"Other","data-orientation":"horizontal"},o("span",{class:"pxd-swatch-color",style:T===Me&&g?{background:m}:void 0,"aria-hidden":"true"}),o("span",{class:"pxd-swatch-name"},"Other"))),b&&w())}var nd=(e,t)=>Array.from({length:t},(a,r)=>e[r]??"");function cd(e,t){let a=t.b,r=t.id(e,"label"),d=t.id(e,"help"),p=ne(Number(e.length)||6,4,12),i=(e.kind??"numeric")==="numeric",n=e.required??!0,s=a.text(e.label),c=e.help!==void 0?a.text(e.help):void 0,l=a.value(e.value),u=l==null?"":String(l),[x]=t.state(e,"code",()=>({chars:nd(u,p),seen:u,fired:null}));u!==x.seen&&(x.seen=u,u!==x.chars.join("")&&(x.chars=nd(u,p)));let m=x.chars,g=t.a11y(e),f=()=>Array.from(t.r.root?.querySelectorAll(`[data-pxd-id="${CSS.escape(e.id)}"] .pxd-code-box`)??[]),y=T=>T.replace(i?/[^0-9]/g:/[^0-9a-zA-Z]/g,""),h=T=>f()[ne(T,0,p-1)]?.focus(),k=T=>{x.chars=T;let b=T.join("");x.seen=b,a.write(e.value,b),e.action&&T.every(Boolean)&&b!==x.fired&&(x.fired=b,t.r.dispatch({event:{name:e.action.event.name,context:Ne(e,t.r.data,a.scope,b)}},{pointer:""},e.id)),t.r.schedule()},A=(T,b)=>{let v=y(b);if(!v)return;let w=[...m],N=T;for(let z of v){if(N>=p)break;w[N++]=z}k(w),h(N)},C=(T,b)=>{let v=m[T],w=b.target.value;if(v&&w.length>1&&(w=w.startsWith(v)?w.slice(v.length):w.endsWith(v)?w.slice(0,-v.length):w),w===""){let N=[...m];return N[T]="",k(N)}A(y(w).length>=p?0:T,w)},I=(T,b)=>{if(b.key==="Backspace"&&!m[T]&&T>0){b.preventDefault();let v=[...m];v[T-1]="",k(v),h(T-1)}else b.key==="ArrowLeft"?(b.preventDefault(),h(T-1)):b.key==="ArrowRight"&&(b.preventDefault(),h(T+1))},E=(T,b)=>{b.preventDefault();let v=b.clipboardData?.getData("text")??"";A(y(v).length>=p?0:T,v)},F=p>6?p%4===0?4:3:p,$=[];for(let T=0;T<p;T+=F)$.push(Array.from({length:Math.min(F,p-T)},(b,v)=>T+v));return o("div",{class:"pxd-field pxd-code",role:"group","aria-labelledby":r,"aria-describedby":Ge(c&&d),...g},o("div",{class:"pxd-field-label",id:r},s,n&&Ee()),c&&o("p",{class:"pxd-field-help",id:d},c),o("div",{class:"pxd-code-boxes"},...$.map((T,b)=>o("div",{class:"pxd-code-group",key:b},...T.map(v=>o("input",{key:v,class:"pxd-code-box",type:"text",inputmode:i?"numeric":"text",pattern:i?"[0-9]*":"[0-9A-Za-z]*",autocomplete:v===0?"one-time-code":"off",autocapitalize:i?void 0:"characters",spellcheck:"false","aria-label":`Digit ${v+1} of ${p}`,value:m[v],"data-filled":m[v]?"":void 0,required:n,onFocus:w=>w.target.select(),onInput:w=>C(v,w),onKeydown:w=>I(v,w),onPaste:w=>E(v,w)}))))))}var xd=40;function ud(e,t){let a=t.b,r=t.r,d=t.id(e,"caption"),p=e.selection??"none",i=p!=="none"&&!!e.selected,n=e.expanded?Z(a.value(e.expanded)):void 0,[s,c]=t.state(e,"expanded",null),l=n?new Set(n):s,u=i?a.value(e.selected):void 0,x=H=>Array.isArray(u)?u.includes(H):u!==void 0&&u===H,{rows:m,indexByKey:g,topValues:f}=io(e,r.data,a.scope,l),[y,h]=t.state(e,"focus",null),k=(y!==null?g.get(y):void 0)??0,[A]=t.state(e,"pending",()=>({index:null})),C=m.length>ht,[I,E]=t.state(e,"geometry",()=>({rowHeight:xd,viewportHeight:xd*12,scrollTop:0})),{start:F,end:$}=so(m.length,I.scrollTop,I.rowHeight,I.viewportHeight),T=()=>r.root?.querySelector(`[data-pxd-id="${CSS.escape(e.id)}"] .pxd-tree-list`),b=H=>{if(!m.length)return;let L=Math.max(0,Math.min(m.length-1,H));h(m[L].key);let U=T()?.querySelector(`[data-index="${L}"]`);if(U)return U.focus();A.index=L;let R=T()?.parentElement;if(C&&R?.classList.contains("pxd-tree-viewport")){let q=Math.max(0,L*I.rowHeight-(I.viewportHeight-I.rowHeight)/2);R.scrollTop=q,E({...I,scrollTop:q})}};t.after(()=>{if(A.index===null)return;let H=T()?.querySelector(`[data-index="${A.index}"]`);if(H&&(A.index=null,H.focus()),C){let L=T()?.querySelector(".pxd-tree-item"),U=T()?.parentElement,R=L&&L.offsetHeight>0?L.offsetHeight:I.rowHeight,q=U?.clientHeight||I.viewportHeight;(R!==I.rowHeight||q!==I.viewportHeight)&&E({...I,rowHeight:R,viewportHeight:q})}});let v=(H,L)=>{if(e.expanded){let R=n??[];a.write(e.expanded,L?[...R,...H.filter(q=>!R.includes(q))]:R.filter(q=>!H.includes(q)));return}let U=new Set(s??f);for(let R of H)L?U.add(R):U.delete(R);c(U)},w=H=>v([H.value],!H.expanded),N=H=>{if(!i)return;if(p==="single")return a.write(e.selected,H.value);let L=Array.isArray(u)?u:[];a.write(e.selected,L.includes(H.value)?L.filter(U=>U!==H.value):[...L,H.value])},z=H=>{N(H),e.action&&r.dispatch(e.action,H.scope,e.id)},[M]=t.state(e,"typed",()=>({buffer:"",at:0})),S=H=>{let L=Date.now();M.buffer=L-M.at<ro?M.buffer+H.toLowerCase():H.toLowerCase(),M.at=L;let U=po(m,k,M.buffer);U>=0&&b(U)},P=H=>{let L=m[k],U=no(m,k,H);!L||!U||(H.preventDefault(),H.stopPropagation(),"focus"in U?b(U.focus):"toggle"in U?w(L):"activate"in U?z(L):"select"in U?N(L):"expandSiblings"in U?v(m.filter(R=>R.parent===L.parent&&R.hasChildren).map(R=>R.value),!0):"typeAhead"in U&&S(U.typeAhead))},V=a.text(e.label),j=C?{paddingTop:F*I.rowHeight,paddingBottom:(m.length-$)*I.rowHeight}:void 0,B=o("ul",{role:"tree",class:"pxd-tree-list","aria-labelledby":d,"aria-multiselectable":p==="multiple"?!0:void 0,style:j,onKeydown:P},...m.slice(F,$).map((H,L)=>{let U=F+L,R=i?x(H.value):void 0;return o("li",{key:H.key,role:"treeitem",class:`pxd-tree-item${R?" pxd-tree-item-selected":""}`,style:{"--polyxd-tree-depth":H.level-1},"data-index":U,tabindex:U===k?"0":"-1","aria-level":H.level,"aria-setsize":H.setsize,"aria-posinset":H.posinset,"aria-expanded":H.hasChildren?H.expanded:void 0,"aria-selected":R,onFocus:q=>{q.target===q.currentTarget&&h(H.key)},onClick:q=>{q.stopPropagation(),b(U),i?N(H):H.hasChildren&&w(H)},onDblclick:q=>{q.stopPropagation(),e.action?r.dispatch(e.action,H.scope,e.id):H.hasChildren&&w(H)}},o("div",{class:"pxd-tree-row"},H.hasChildren?o("button",{type:"button",class:`pxd-tree-expander${H.expanded?" pxd-tree-expander-open":""}`,tabindex:"-1","aria-hidden":"true",onClick:q=>{q.stopPropagation(),b(U),w(H)},onDblclick:q=>q.stopPropagation()},D("chevronRight",16)):o("span",{class:"pxd-tree-expander pxd-tree-expander-leaf","aria-hidden":"true"}),o("span",{class:"pxd-tree-text"},H.label),H.detail!==void 0&&o("span",{class:"pxd-tree-detail"},H.detail)))}));return o("div",{class:"pxd-tree",...t.a11y(e)},o("div",{class:"pxd-tree-caption",id:d},V),C?o("div",{class:"pxd-tree-viewport",onScroll:H=>E({...I,scrollTop:H.currentTarget.scrollTop})},B):B)}var St={Section:ur,Group:fr,Card:mr,Disclosure:yr,Views:br,Navigation:Zr,Text:Ir,Metric:Nr,DetailList:Tr,Collection:Rr,Table:Er,Chart:Fr,Media:Ur,Status:Hr,TextInput:jr,Choice:Dr,Toggle:Vr,DateInput:Or,RangeInput:_r,Form:qr,Action:Gr,ActionBar:Yr,Steps:Wr,Confirm:Kr,Comparison:Xr,FilterPanel:Jr,Tag:ed,Identity:td,Progress:ad,Rating:od,Code:rd,Tree:ud,ActionMenu:id,Panel:pd,FileInput:sd,ColorInput:ld,CodeInput:cd,Columns:gr,Split:hr,Frame:kr,AppBar:wr,Footer:Sr,Outlet:zr,Custom:Cr};var tt=class{surface;props;host;root=null;portalEl=null;components;states=new Map;effects=[];portals=[];modals=0;scheduled=!1;unsubscribe;observers=new Map;drawing=!1;disposers=[];events;statuses=new Map;statusesBefore=new Map;constructor(t,a){this.host=t,this.props=a,this.components={...St,...a.components??{}},this.surface=this.makeSurface(a),this.events=this.makeEvents(a),this.unsubscribe=this.surface.subscribe(()=>this.schedule());let r=d=>{if(!this.events)return;let p=d.target,i=p?.closest?.("[data-pxd-id]")?.getAttribute("data-pxd-id");i&&this.events.inputError(this.byId.get(i)??i,ko(p?.validity))};t.addEventListener("invalid",r,!0),this.disposers.push(()=>t.removeEventListener("invalid",r,!0))}makeSurface(t){let a=this;return bo(t.document,{data:t.data,locale:t.locale??"en-GB",derive:t.derive,onAction:r=>this.props.onAction?.(r),onDataChange:r=>this.props.onDataChange?.(r),onDismiss:()=>this.props.onDismiss?.(),get events(){return a.events}})}makeEvents(t){return t.onEvent?So(t.document,a=>this.props.onEvent?.(a),t.events):void 0}statusDrawn(t,a){this.events&&this.statuses.set(`${a.pointer}#${t.id}`,t)}get locale(){return this.surface.locale}get doc(){return this.surface.document}get data(){return this.surface.data}get byId(){return this.surface.byId}get disclosure(){return this.props.disclosure??"progressive"}update(t){let a=this.props;this.props=t,this.components={...St,...t.components??{}};let r=t.document!==a.document;if(r&&(this.events?.unmounted(!1),this.events=void 0),!!t.onEvent!=!!this.events&&(this.events=this.makeEvents(t),this.statusesBefore.clear()),r||(t.locale??"en-GB")!==a.locale)this.unsubscribe(),this.states.clear(),this.surface=this.makeSurface(t),this.unsubscribe=this.surface.subscribe(()=>this.schedule());else if(t.data&&t.data!==a.data&&t.document.surface.kind==="shell"){this.surface.replaceData(t.data);return}this.schedule()}dispose(){this.events?.unmounted(!1),this.events=void 0,this.unsubscribe();for(let t of this.disposers)t();for(let t of this.observers.values())t.disconnect();Mo(this.host)}onDispose(t){this.disposers.push(t)}schedule(){this.scheduled||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1,this.draw()}))}observeWidth(t,a,r){if(!t||this.observers.has(t)||typeof ResizeObserver>"u")return;let d=()=>r(t.getBoundingClientRect().width),p=new ResizeObserver(d);p.observe(t),this.observers.set(t,p),d()}unobserve(t){this.observers.get(t)?.disconnect(),this.observers.delete(t)}bindings(t){let a=this.surface;return{scope:t,value:r=>W(r,a.data,t),text:(r,d)=>{let p=W(r,a.data,t);return d?G(p,X(d,a.data,t),a.locale):p==null?"":String(p)},pointer:r=>O(r.path,t),write:(r,d)=>a.setValue(O(r.path,t),d),context:r=>we(r,a.data,t)}}dispatch(t,a,r){this.surface.dispatch(t,a,r)}ctx(t){let a=this,r=(p,i)=>`${t.scope.pointer}#${p.id}:${i}`,d={r:a,scope:t.scope,heading:t.heading,steps:t.steps,frame:t.frame,b:a.bindings(t.scope),render:(p,i)=>a.renderNode(p,i?d.with({scope:i}):d),a11y:p=>ho(p,i=>{let n=W(i,a.data,t.scope);return n===void 0?void 0:String(n)}),id:(p,i="")=>`pxd-${(t.scope.pointer+"-"+p.id+(i?"-"+i:"")).replace(/[^A-Za-z0-9_-]+/g,"_")}`,state:(p,i,n)=>{let s=r(p,i);a.states.has(s)||a.states.set(s,typeof n=="function"?n():n);let c=l=>{let u=a.states.get(s),x=typeof l=="function"?l(u):l;Object.is(x,u)||(a.states.set(s,x),a.schedule())};return[a.states.get(s),c]},after:p=>a.effects.push(p),portal:p=>a.portals.push(p),with:p=>a.ctx({...t,...p})};return d}renderNode(t,a){let r=this.byId.get(t);if(!r||r.visible!==void 0&&W(r.visible,this.data,a.scope)===!1)return null;let d=this.components[r.component];if(!d)return o("div",{class:"pxd-unknown",role:"note"},`Unsupported component \u201C${r.component}\u201D`);let p=d(r,a);return p instanceof Element?_e(p,r.id):p}draw(){if(this.drawing)return this.schedule();this.drawing=!0,this.effects=[],this.portals=[],this.modals=0,this.statuses=new Map;try{let t=this.surfaceTree();Eo(this.host,[t]),this.root=this.host.querySelector(":scope > .pxd-surface"),this.portalEl=this.root?.querySelector(":scope > .pxd-portal")??null;let a=this.effects;this.effects=[];for(let r of a)r();if(this.events){this.events.shown();for(let[r,d]of this.statuses)this.statusesBefore.has(r)||this.events.statusShown(d);this.statusesBefore=this.statuses}}finally{this.drawing=!1}}feedback(t,a){this.events?.feedback(t,a)}regenerated(t){this.events?.regenerated(t)}surfaceTree(){let t=this.doc,a=this.props,r=this.ctx({scope:de,heading:2}),d=this.byId.get(t.root)?.component==="Confirm",p=t.surface.kind==="shell",i=At(t),n=p?r.render(t.root):o("div",{class:"pxd-surface-main"},!d&&this.header(r),r.render(t.root)),s=i?r.render(i.id):null,c=o("div",{class:"pxd-portal"},...this.portals),l=this.modals>0?"true":void 0;for(let u of[s,n])u&&typeof u=="object"&&"props"in u&&(u.props["aria-hidden"]=l);return o("div",{class:["pxd-surface",p?"pxd-surface-shell":null,t.surface.presentation==="panel"?"pxd-surface-panel":null,i?"pxd-surface-with-nav":null,a.className].filter(Boolean).join(" "),"data-pxd-theme":a.theme,"data-pxd-mode":a.mode,"data-pxd-density":a.density,"data-pxd-surface":t.surface.id,lang:this.locale},s,n,c)}header(t){let{title:a,subtitle:r,breadcrumbs:d,badge:p,avatar:i,actions:n}=this.doc.surface,s=l=>String(W(l,this.data,de)??"");return!r&&!d&&!p&&!i&&!n?o("h1",{class:"pxd-surface-title"},a):o("header",{class:"pxd-page-header"},d&&o("nav",{class:"pxd-breadcrumbs","aria-label":"Breadcrumb"},o("ol",null,d.map((l,u)=>o("li",{key:u},l.action?o("button",{type:"button",class:"pxd-link",onClick:()=>this.dispatch(l.action,de,this.doc.surface.id)},s(l.label)):s(l.label))))),o("div",{class:"pxd-page-header-main"},i!==void 0&&re(t,{value:s(i),name:a,size:48}),o("div",{class:"pxd-page-header-text"},o("h1",{class:"pxd-surface-title"},a,p&&o("span",{class:`pxd-badge pxd-tone-${p.tone??"neutral"}`},s(p.text))),r!==void 0&&o("p",{class:"pxd-surface-subtitle"},s(r))),n&&o("div",{class:"pxd-page-header-actions"},t.render(n))))}};function Ho(e,t){let a=new tt(e,t);a.draw();let r=t;return{update:d=>{r={...r,...d},a.update(r),a.draw()},unmount:()=>a.dispose(),get data(){return a.data},feedback:(d,p)=>a.feedback(d,p),regenerated:d=>a.regenerated(d)}}var di="2026-01-26",ii={name:"Polyxd",version:"0.4.3"},pi=1,Fo=new Map,ot=e=>window.parent.postMessage({jsonrpc:"2.0",...e},"*");function Po(e,t){let a=pi++;return ot({id:a,method:e,params:t}),new Promise((r,d)=>Fo.set(a,{resolve:r,reject:d}))}var yd=(e,t={})=>ot({method:e,params:t});window.addEventListener("message",e=>{if(e.source!==window.parent)return;let t=e.data;if(!(!t||t.jsonrpc!=="2.0")){if(t.method===void 0&&t.id!==void 0){let a=Fo.get(t.id);if(!a)return;Fo.delete(t.id),t.error?a.reject(new Error(t.error.message??String(t.error))):a.resolve(t.result);return}if(typeof t.method=="string"){if(t.id!==void 0)return void ni(t.id,t.method);gi(t.method,t.params??{})}}});function ni(e,t){if(t==="ping")return ot({id:e,result:{}});if(t==="ui/resource-teardown")return Pe?.unmount(),Pe=void 0,ot({id:e,result:{}});ot({id:e,error:{code:-32601,message:`Method not found: ${t}`}})}var We={},ae,Pe,Et=document.getElementById("root"),fd=document.getElementById("note"),$o=e=>e?.mode??We.theme??(window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"),si=e=>"data:image/svg+xml;utf8,"+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><rect width="10" height="10" fill="#999"/><title>${String(e).replace(/[<&]/g,"")}</title></svg>`);function Bo(){let e=document.documentElement;e.dataset.pxdTheme=ae?.pack??"material3",e.dataset.pxdMode=$o(ae),e.style.colorScheme=$o(ae);let t=We.containerDimensions;t&&(t.height!==void 0?e.style.height="100vh":t.maxHeight&&(e.style.maxHeight=`${t.maxHeight}px`),t.width!==void 0?e.style.width="100vw":t.maxWidth&&(e.style.maxWidth=`${t.maxWidth}px`))}function at(e){fd.textContent=e,fd.hidden=!e}function Mt(e,t,a){Pe?.unmount(),Pe=void 0,Et.replaceChildren();let r=document.createElement("div");r.className="pxd-mcp-status";let d=document.createElement("p");if(d.className="pxd-mcp-status-title",d.textContent=e,r.append(d),t){let p=document.createElement("p");p.textContent=t,r.append(p)}if(a?.length){let p=document.createElement("ul");for(let i of a){let n=document.createElement("li");n.textContent=i,p.append(n)}r.append(p)}Et.append(r)}function Ct(){if(Bo(),!ae)return Mt("Preparing the screen\u2026");if(!ae.shown||!ae.document){let t=(ae.issues??[]).filter(a=>a.severity==="error");return Mt("The document has errors, so there is nothing to show yet.",void 0,t.map(a=>`${a.pointer}: ${a.message}`))}let e={document:ae.document,data:ae.document.data??{},theme:ae.pack,mode:$o(ae),locale:We.locale,resolveMedia:si,onAction:t=>{md(ci(t))},onDismiss:()=>{md(`[Polyxd] I closed the "${bd()}" screen.`)}};Pe?Pe.update(e):(Et.replaceChildren(),Pe=Ho(Et,e))}var bd=()=>String(ae?.document?.surface?.title??ae?.document?.surface?.id??"Polyxd");function li(e){let t=(ae?.document?.components??[]).find(a=>a.id===e.source);if(t){if(typeof t.label=="string"&&t.action?.event?.name===e.name)return t.label;for(let a of["submit","confirm","cancel","finish","action","primary","secondary"]){let r=t[a];if(r?.action?.event?.name===e.name&&typeof r.label=="string")return r.label}return typeof t.label=="string"?t.label:void 0}}function ci(e){let t=li(e),a=e.context&&Object.keys(e.context).length?`
|
|
29
|
+
`)){let d=/^(-|\d+\.)\s+(.*)$/.exec(r);if(d){let i=d[1]==="-"?"ul":"ol";(!a||a.tagName.toLowerCase()!==i)&&(a=document.createElement(i),t.push(a));let n=document.createElement("li");n.append(...$r(d[2])),a.append(n);continue}a=null;let p=document.createElement("div");r?p.append(...$r(r)):p.append(document.createElement("br")),t.push(p)}return t}function Yd(e,t,a,r){let d=t.b,p=String(d.value(e.value)??""),i=m=>d.write(e.value,Lr(m).replace(/\n+$/,"")),n=m=>g=>{g.preventDefault();let f=g.currentTarget.closest(".pxd-richtext")?.querySelector(".pxd-richtext-area");f&&(f.focus(),document.execCommand(m),i(f))},{id:s,class:c,required:l,autocomplete:u,...x}=r;return ke(a,o("div",{class:"pxd-richtext"},o("div",{class:"pxd-richtext-toolbar",role:"toolbar","aria-label":"Formatting"},o("button",{type:"button",class:"pxd-richtext-control","aria-label":"Bold",onMousedown:n("bold")},o("strong",null,"B")),o("button",{type:"button",class:"pxd-richtext-control","aria-label":"Italic",onMousedown:n("italic")},o("em",null,"I")),o("button",{type:"button",class:"pxd-richtext-control","aria-label":"Bulleted list",onMousedown:n("insertUnorderedList")},D("menu",16))),o("div",{...x,id:s,class:"pxd-input pxd-richtext-area",contenteditable:"true",role:"textbox","aria-multiline":"true","aria-label":a.label,ref:m=>{let g=m;!g||g.dataset.ready||(g.dataset.ready="1",g.replaceChildren(...Xd(p)))},onInput:m=>i(m.currentTarget),onBlur:m=>i(m.currentTarget)})))}function Jd(e,t,a,r){let d=t.b,p=String(d.value(e.value)??""),[i,n]=t.state(e,"inline",null),s=()=>{i!==null&&d.write(e.value,i),n(null)};return i===null?o("div",{class:"pxd-inline-edit"},o("span",{class:"pxd-field-label"},a.label),o("button",{type:"button",class:"pxd-inline-value","aria-label":`Edit ${a.label}`,onClick:()=>n(p)},o("span",{class:p?void 0:"pxd-inline-empty"},p||"Not set"),o("span",{class:"pxd-inline-hint","aria-hidden":"true"},"Edit"))):ke(a,o("input",{...r,type:"text",value:i,ref:c=>c&&!c.dataset.focused&&(c.dataset.focused="1",c.focus()),onInput:c=>n(te(c)),onBlur:s,onKeydown:c=>{c.key==="Enter"?(c.preventDefault(),s()):c.key==="Escape"&&n(null)}}))}var Pr=(e,t,a)=>o("div",{class:"pxd-option-text"},o("label",{for:e},t),a&&o("span",{class:"pxd-option-description",id:`${e}-desc`},a)),Fe=(e,...t)=>o("span",{"data-state":"checked",class:e,style:{pointerEvents:"none"}},...t);function Dr(e,t){let a=t.b,r=t.id(e,"label"),d=t.id(e,"help"),p=Se(e,t.r.data,a.scope,a.text),[i,n]=t.state(e,"query",""),s=Nt(p,e.mode),{multiple:c,withFaces:l,searchable:u}=s,x=s.control==="chips",m=a.value(e.value),g=me,f=b=>Ht(r,b),y=e.help!==void 0?a.text(e.help):void 0,h=t.a11y(e),k=a.text(e.label),A=o("div",{class:"pxd-field-label",id:r},k,e.required&&Ee()),C=y&&o("p",{class:"pxd-field-help",id:d},y),I=u&&o("div",{class:"pxd-search pxd-search-compact"},D("search"),o("input",{type:"search",class:"pxd-search-input",placeholder:Ut(l),"aria-label":`Search ${k}`,value:i,onInput:b=>n(te(b))})),E=b=>nt(b,i);if(c){let b=w=>Rt(m,w),v=w=>a.write(e.value,Tt(m,w));if(x)return o("div",{class:"pxd-field pxd-choice",role:"group","aria-labelledby":r,"aria-describedby":y?d:void 0,...h},A,C,o("div",{class:"pxd-chips"},...p.map(w=>xe({key:g(w.value),class:"pxd-chip",checked:b(w.value),onCheckedChange:()=>v(w.value),indicator:Fe("pxd-chip-check",D("check",18))},w.label))));if(l){let{recent:w,rest:N}=st(p,i);return o("fieldset",{class:"pxd-field pxd-choice pxd-people","aria-describedby":y?d:void 0,...h},o("legend",{class:"pxd-field-label",id:r},k),C,I,o("div",{class:"pxd-people-group"},w.length>0&&o("div",{class:"pxd-people-recent"},...w.map(z=>xe({key:g(z.value),class:"pxd-person-tile",checked:b(z.value),onCheckedChange:()=>v(z.value),"aria-label":z.label,indicator:null},o("span",{class:"pxd-person-face"},re(t,{value:z.avatar,name:z.label,size:56}),b(z.value)&&Fe("pxd-person-tick",D("check",14))),o("span",{class:"pxd-person-name","aria-hidden":"true"},z.label.split(" ")[0])))),o("div",{class:"pxd-people-list"},...N.map(z=>{let M=f(z.value);return xe({key:g(z.value),id:M,class:"pxd-person-row",checked:b(z.value),onCheckedChange:()=>v(z.value),"aria-labelledby":`${M}-name`,"aria-describedby":z.description?`${M}-desc`:void 0,indicator:null},re(t,{value:z.avatar,name:z.label}),o("span",{class:"pxd-person-text"},o("span",{id:`${M}-name`},z.label),z.description&&o("span",{class:"pxd-option-description",id:`${M}-desc`},z.description)),b(z.value)&&Fe("pxd-person-check",D("check")))}))))}return o("fieldset",{class:"pxd-field pxd-choice","aria-describedby":y?d:void 0,...h},o("legend",{class:"pxd-field-label",id:r},k),C,I,o("div",{class:`pxd-choice-list${u?" pxd-choice-scroll":""}`},...p.filter(E).map(w=>{let N=f(w.value);return o("div",{class:"pxd-choice-option",key:g(w.value)},w.avatar!==void 0&&re(t,{value:w.avatar,name:w.label,size:32}),xe({id:N,class:"pxd-checkbox",checked:b(w.value),onCheckedChange:()=>v(w.value),"aria-describedby":w.description?`${N}-desc`:void 0,indicator:Fe("pxd-checkbox-indicator","\u2713")}),Pr(N,w.label,w.description))})))}let F=m==null?"":g(m),$=b=>a.write(e.value,p.find(v=>g(v.value)===b)?.value),T=(b,v,w,N,...z)=>Ue({key:g(b.value),value:g(b.value),group:F,first:v===0,onSelect:()=>$(g(b.value)),indicator:N,...w},...z);if(x)return o("div",{class:"pxd-field pxd-choice",...h},A,C,Ce({class:"pxd-chips","aria-labelledby":r,"aria-describedby":y?d:void 0,"aria-required":e.required||void 0,value:F,onValueChange:$,orientation:"horizontal"},...p.map((b,v)=>T(b,v,{class:"pxd-chip","data-orientation":"horizontal"},Fe("pxd-chip-check",D("check",18)),b.label))));if(l){let{recent:b,rest:v}=st(p,i);return o("div",{class:"pxd-field pxd-choice pxd-people",...h},A,C,I,Ce({"aria-labelledby":r,"aria-describedby":y?d:void 0,"aria-required":e.required||void 0,value:F,onValueChange:$,class:"pxd-people-group"},b.length>0&&o("div",{class:"pxd-people-recent",role:"presentation"},...b.map((w,N)=>T(w,N,{class:"pxd-person-tile","aria-label":w.label},null,re(t,{value:w.avatar,name:w.label,size:56}),o("span",{class:"pxd-person-name","aria-hidden":"true"},w.label.split(" ")[0])))),o("div",{class:"pxd-people-list",role:"presentation"},...v.map((w,N)=>{let z=f(w.value);return T(w,b.length+N,{id:z,class:"pxd-person-row","aria-labelledby":`${z}-name`,"aria-describedby":w.description?`${z}-desc`:void 0},null,re(t,{value:w.avatar,name:w.label}),o("span",{class:"pxd-person-text"},o("span",{id:`${z}-name`},w.label),w.description&&o("span",{class:"pxd-option-description",id:`${z}-desc`},w.description)),F===g(w.value)&&Fe("pxd-person-check",D("check")))}))))}return o("div",{class:"pxd-field pxd-choice",...h},A,C,I,Ce({class:`pxd-choice-list${u?" pxd-choice-scroll":""}`,"aria-labelledby":r,"aria-describedby":y?d:void 0,"aria-required":e.required||void 0,value:F,onValueChange:$,orientation:"vertical"},...p.filter(E).map((b,v)=>{let w=f(b.value);return o("div",{class:"pxd-choice-option",key:g(b.value)},T(b,v,{id:w,class:"pxd-radio","aria-describedby":b.description?`${w}-desc`:void 0,"data-orientation":"vertical"},o("span",{"data-state":"checked",class:"pxd-radio-indicator",style:{pointerEvents:"none"}})),Pr(w,b.label,b.description))})))}function Vr(e,t){let a=t.b,r=t.id(e),d=t.id(e,"desc"),p=!!a.value(e.value),i=e.description!==void 0?a.text(e.description):void 0,n=c=>{a.write(e.value,c),e.action&&t.r.dispatch({event:{name:e.action.event.name,context:Ne(e,t.r.data,a.scope,c)}},{pointer:""},e.id)},s=t.a11y(e);return o("div",{class:"pxd-toggle"},e.action?lr({id:r,class:"pxd-switch",checked:p,onCheckedChange:n,"aria-describedby":i?d:void 0,...s}):xe({id:r,class:"pxd-checkbox",checked:p,onCheckedChange:c=>n(c===!0),"aria-describedby":i?d:void 0,...s,indicator:Fe("pxd-checkbox-indicator","\u2713")}),o("div",{class:"pxd-toggle-text"},o("label",{for:r,class:"pxd-toggle-label"},a.text(e.label)),i&&o("p",{class:"pxd-field-help",id:d},i)))}var Br={date:"date",time:"time",datetime:"datetime-local",month:"month"};function Or(e,t){let a=t.b,r=t.r,d=t.id(e),p=t.id(e,"help"),i=e.kind??"date",n=e.help!==void 0?a.text(e.help):void 0,s=a.value(e.value),c=e.min!==void 0?a.text(e.min):void 0,l=e.max!==void 0?a.text(e.max):void 0,u=t.a11y(e),x=a.text(e.label);if(e.multiple&&i!=="dateRange"){let m=Array.isArray(s)?s.map(String):[],g=h=>G(h,{type:i==="month"?"date":i==="time"?"time":i==="datetime"?"datetime":"date"},r.locale),f=h=>h&&!m.includes(h)&&a.write(e.value,[...m,h].sort()),y=h=>{let k=h.currentTarget;f(k.value),k.value=""};return o("fieldset",{class:"pxd-field pxd-date-multiple",...u},o("legend",{class:"pxd-field-label"},x,e.required&&Ee()),n&&o("p",{class:"pxd-field-help",id:p},n),m.length>0&&o("ul",{class:"pxd-tags-list","aria-label":`Chosen ${x}`},...m.map(h=>o("li",{key:h,class:"pxd-tag-chip"},i==="year"||i==="month"?h:g(h),o("button",{type:"button",class:"pxd-tag-remove","aria-label":`Remove ${h}`,onClick:()=>a.write(e.value,m.filter(k=>k!==h))},D("close",14))))),o("label",{class:"pxd-date-add",for:d},o("span",{class:"pxd-sr-only"},"Add a date"),i==="year"?o("input",{id:d,class:"pxd-input pxd-input-year",inputmode:"numeric",pattern:"[0-9]{4}",maxlength:4,placeholder:"YYYY","aria-describedby":n?p:void 0,onKeydown:h=>h.key==="Enter"&&(h.preventDefault(),y(h)),onBlur:y}):o("input",{id:d,class:"pxd-input pxd-input-date",type:Br[i],min:c,max:l,"aria-describedby":n?p:void 0,onChange:y})))}if(i==="year")return ke({label:x,help:n,required:e.required,id:d,helpId:p},o("input",{id:d,class:"pxd-input pxd-input-year",inputmode:"numeric",pattern:"[0-9]{4}",maxlength:4,placeholder:"YYYY",value:s??"",min:c,max:l,required:e.required,"aria-describedby":n?p:void 0,onInput:m=>a.write(e.value,te(m).replace(/\D/g,"").slice(0,4)||null),...u}));if(i==="dateRange"){let[m,g]=Array.isArray(s)?s:[],f=(y,h)=>{let k=[m??null,g??null];k[y]=h||null,a.write(e.value,k)};return o("fieldset",{class:"pxd-field",...u},o("legend",{class:"pxd-field-label"},x),n&&o("p",{class:"pxd-field-help"},n),o("div",{class:"pxd-date-range"},o("label",null,"From",o("input",{class:"pxd-input",type:"date",value:m??"",min:c,max:l,required:e.required,onChange:y=>f(0,te(y))})),o("label",null,"To",o("input",{class:"pxd-input",type:"date",value:g??"",min:m??c,max:l,required:e.required,onChange:y=>f(1,te(y))}))))}return ke({label:x,help:n,required:e.required,id:d,helpId:p},o("input",{id:d,class:`pxd-input pxd-input-date${i==="month"?" pxd-input-month":""}`,type:Br[i],value:s??"",min:c,max:l,required:e.required,"aria-describedby":n?p:void 0,onChange:m=>a.write(e.value,te(m)||null),...u}))}function _r(e,t){let a=t.b,r=t.r,d=t.id(e,"label"),p=t.id(e,"min"),i=t.id(e,"max"),n=l=>G(l,X(e.format??{type:"number"},r.data,a.scope),r.locale),s=t.a11y(e);if(e.mode==="range"){let l=a.value(e.value),[u,x]=Array.isArray(l)?l.map(Number):[e.min,e.max],m=(g,f)=>a.write(e.value,[Math.max(e.min,Math.min(g,f)),Math.min(e.max,Math.max(g,f))]);return o("div",{class:"pxd-field pxd-range",role:"group","aria-labelledby":d,...s},o("div",{class:"pxd-range-header"},o("span",{class:"pxd-field-label",id:d},a.text(e.label)),o("output",{class:"pxd-range-value","aria-live":"polite"},`${n(u)} \u2013 ${n(x)}`)),Ao({min:e.min,max:e.max,step:e.step??1,values:[u,x],minStepsBetweenThumbs:1,onValueChange:([g,f])=>m(g,f),thumbs:[{"aria-label":"Minimum","aria-valuetext":n(u)},{"aria-label":"Maximum","aria-valuetext":n(x)}]}),o("div",{class:"pxd-range-fields"},o("label",{for:p},o("span",null,"Minimum"),o("input",{id:p,class:"pxd-input",inputmode:"numeric",value:String(u),onInput:g=>m(Number(te(g))||e.min,x)})),o("span",{"aria-hidden":"true"},"\u2013"),o("label",{for:i},o("span",null,"Maximum"),o("input",{id:i,class:"pxd-input",inputmode:"numeric",value:String(x),onInput:g=>m(u,Number(te(g))||e.max)}))))}let c=Number(a.value(e.value)??e.min);return o("div",{class:"pxd-field pxd-range",...s},o("div",{class:"pxd-range-header"},o("span",{class:"pxd-field-label",id:d},a.text(e.label)),o("output",{class:"pxd-range-value","aria-live":"polite"},n(c))),Ao({min:e.min,max:e.max,step:e.step??1,values:[c],onValueChange:([l])=>a.write(e.value,l),thumbs:[{"aria-labelledby":d,"aria-valuetext":n(c)}]}),o("div",{class:"pxd-range-bounds","aria-hidden":"true"},o("span",null,n(e.min)),o("span",null,n(e.max))))}function Zd(e){return(e.labels?.[0]?.textContent??e.getAttribute("aria-label")??e.closest(".pxd-field")?.querySelector(".pxd-field-label, legend")?.textContent??"").replace(/\*\s*$/,"").trim()}function Qd(e,t){let a=new Set,r=[];for(let d of Array.from(e.elements))if(!(!d.willValidate||d.validity.valid)){if(d.type==="radio"&&d.name){if(a.has(d.name))continue;a.add(d.name)}d.id||(d.id=`${t}-${r.length}`),r.push(d)}return r}function qr(e,t){let a=t.b,r=t.r,d=Math.min(t.heading,6),p=t.id(e,"summary"),[i,n]=t.state(e,"problems",()=>[]),[s]=t.state(e,"marked",()=>({current:[]})),c=(e.children??[]).some(f=>r.byId.get(f)?.required),l=()=>{for(let f of s.current)f.removeAttribute("aria-invalid"),f.pxdDescribed?f.setAttribute("aria-describedby",f.pxdDescribed):f.removeAttribute("aria-describedby"),f.pxdNote?.remove(),f.pxdNote=void 0;s.current=[]},u=f=>{for(let y of f){y.setAttribute("aria-invalid","true");let h=y.closest(".pxd-field");if(h&&!h.querySelector(".pxd-field-error")){let k=h.ownerDocument.createElement("p");k.className="pxd-field-error",k.id=`${y.id}-error`,k.textContent=y.validationMessage,h.append(k),y.pxdNote=k,y.pxdDescribed=y.getAttribute("aria-describedby"),y.setAttribute("aria-describedby",[y.pxdDescribed,k.id].filter(Boolean).join(" "))}}s.current=f},x=f=>{let y=document.getElementById(f);y&&(y.scrollIntoView({block:"center"}),y.focus(),document.activeElement!==y&&y.closest(".pxd-field")?.querySelector("[role='radio'], button, input:not([aria-hidden]), textarea, select")?.focus())},[m,g]=t.state(e,"announced",null);return i!==m&&(g(i),i.length&&t.after(()=>r.root?.querySelector(`[data-pxd-id="${CSS.escape(e.id)}"] .pxd-error-summary`)?.focus())),o("form",{class:`pxd-form${e.aside?" pxd-form-with-aside":""}${e.layout==="horizontal"?" pxd-form-horizontal":""}`,novalidate:!0,onSubmit:f=>{f.preventDefault();let y=f.currentTarget;if(l(),!y.checkValidity()){let h=Qd(y,p);return u(h),n(h.map(k=>({id:k.id,label:Zd(k),message:k.validationMessage})))}n([]),r.dispatch(e.submit.action,a.scope,e.id)},...t.a11y(e)},e.aside&&o("aside",{class:"pxd-form-aside"},t.render(e.aside)),o("div",{class:"pxd-stack pxd-form-fields"},i.length>0&&o("section",{class:"pxd-error-summary",role:"alert",tabindex:"-1","aria-labelledby":p},o(`h${d}`,{id:p,class:"pxd-error-summary-title"},"Check these fields before continuing"),o("ul",{class:"pxd-error-summary-list"},...i.map(f=>o("li",{key:f.id},o("a",{href:`#${f.id}`,class:"pxd-link",onClick:y=>(y.preventDefault(),x(f.id))},f.label?`${f.label}: ${f.message}`:f.message))))),c&&o("p",{class:"pxd-required-legend"},o("span",{class:"pxd-required","aria-hidden":"true"},"*")," ","Required"),...he(t,e.children)),o("div",{class:"pxd-action-bar"},o("button",{type:"submit",class:"pxd-button pxd-button-primary"},a.text(e.submit.label)),e.cancel&&o("button",{type:"button",class:"pxd-button pxd-button-secondary",onClick:()=>r.dispatch(e.cancel.action,a.scope,e.id)},a.text(e.cancel.label))))}var ei=()=>ca(navigator.userAgentData?.platform??navigator.platform??"");function Gr(e,t){let a=t.b,r=t.r,d=t.id(e,"desc"),[p,i]=t.state(e,"copied",!1),n=e.disabled!==void 0?!!a.value(e.disabled):!1,s=e.tone==="danger"?" pxd-button-danger":"",c=e.description!==void 0?a.text(e.description):void 0,l=typeof e.shortcut=="string"&&e.shortcut?na(e.shortcut,ei()):void 0,u=()=>{let g=e.action.event.name;if(g==="ui.back"&&t.steps)return t.steps.back();if(g==="ui.next"&&t.steps)return t.steps.next();if(g==="ui.copy"){let f=ia(e,r.data,a.scope,a.text),y=()=>{i(!0),setTimeout(()=>i(!1),2e3)};typeof navigator<"u"&&navigator.clipboard?.writeText?navigator.clipboard.writeText(f).then(y,()=>{}):y()}r.dispatch(e.action,a.scope,e.id)},x=r.doc.surface.kind==="shell",m=g=>{let f=g;f&&(f.pxdKey&&document.removeEventListener("keydown",f.pxdKey),!(!l||n)&&(f.pxdKey=y=>{let h=r.root;y.defaultPrevented||y.repeat||!h||!f.isConnected||!x&&!h.contains(document.activeElement)&&!(y.target instanceof HTMLElement&&h.contains(y.target))||sa(l,y)&&(la(l)&&sr(y.target)||(y.preventDefault(),f.click()))},document.addEventListener("keydown",f.pxdKey),r.onDispose(()=>f.pxdKey&&document.removeEventListener("keydown",f.pxdKey))))};return o("button",{type:"button",class:`pxd-button pxd-button-${e.emphasis??"secondary"}${s}${c?" pxd-button-described":""}`,disabled:n,"aria-describedby":c?d:void 0,"aria-keyshortcuts":l?.aria,onClick:u,...t.a11y(e),ref:m},o("span",{class:"pxd-button-label"},p?"Copied":a.text(e.label)),l&&o("span",{class:"pxd-kbd-hint","aria-hidden":"true"},...l.hint.map((g,f)=>o("kbd",{key:f,class:"pxd-kbd"},g))),c&&o("span",{class:"pxd-button-description",id:d},c),e.action.event.name==="ui.copy"&&o("span",{class:"pxd-sr-only","aria-live":"polite"},p?"Copied":""))}function Wr(e,t){let a=t.b,r=t.r,[d,p]=t.state(e,"task",null),i=e.current!==void 0?a.value(e.current):void 0,[n,s]=t.state(e,"step",()=>Pt(i,e.steps.length)),c=e.kind??"wizard",l=o("div",{class:"pxd-action-bar"},o("button",{type:"button",class:"pxd-button pxd-button-primary",onClick:()=>r.dispatch(e.finish.action,a.scope,e.id)},a.text(e.finish.label)));if(c==="guide")return o("div",{class:"pxd-steps pxd-guide",...t.a11y(e)},o("ol",{class:"pxd-guide-list"},...e.steps.map((k,A)=>o("li",{key:k.key,class:"pxd-guide-step"},o("span",{class:"pxd-guide-number","aria-hidden":"true"},A+1),o("div",{class:"pxd-guide-body"},ve(t,"pxd-guide-title",a.text(k.title)),t.render(k.content))))),l);if(c==="tasklist"){let k=C=>Lt(C.status!==void 0?a.text(C.status):"todo"),A=e.steps.filter(C=>k(C).label==="Completed").length;return o("div",{class:"pxd-steps pxd-tasklist",...t.a11y(e)},o("p",{class:"pxd-steps-progress"},Vt(A,e.steps.length)),o("ul",{class:"pxd-tasklist-list"},...e.steps.map(C=>{let I=d===C.key,{label:E,tone:F}=k(C),$=E==="Cannot start yet";return o("li",{key:C.key,class:`pxd-task${I?" pxd-task-open":""}`},o("div",{class:"pxd-task-row"},o("button",{type:"button",class:"pxd-task-title","aria-expanded":I,disabled:$,onClick:()=>p(Dt(d,C.key))},a.text(C.title)),o("span",{class:`pxd-badge pxd-tone-${F} pxd-task-status`},E)),I&&o("div",{class:"pxd-task-content"},t.render(C.content)))})),l)}let u=e.steps.length,x=typeof i=="number"&&e.current?.path?{index:Math.max(0,Math.min(u-1,i)),total:u}:{...n,total:u},m=k=>{let A=$t(x,{type:"go",index:k});e.current?.path?a.write(e.current,A.index):s(A)},g=x.index,f=e.steps[g],y=Bt(x),h=t.with({steps:{back:()=>m(g-1),next:()=>m(g+1)}});return o("div",{class:"pxd-steps",...t.a11y(e)},o("p",{class:"pxd-steps-progress"},jt(x)),o("ol",{class:"pxd-steps-list"},...e.steps.map((k,A)=>o("li",{key:k.key,"aria-current":A===g?"step":void 0,class:A<g?"pxd-step-done":A===g?"pxd-step-current":void 0},a.text(k.title)))),o("form",{class:"pxd-steps-content",onSubmit:k=>{k.preventDefault(),y?r.dispatch(e.finish.action,a.scope,e.id):m(g+1)}},ve(h,"pxd-steps-title",a.text(f.title)),h.render(f.content),o("div",{class:"pxd-action-bar"},o("button",{type:"submit",class:"pxd-button pxd-button-primary"},y?a.text(e.finish.label):"Continue"),g>0&&o("button",{type:"button",class:"pxd-button pxd-button-secondary",onClick:()=>m(g-1)},"Back"))))}function Kr(e,t){let a=t.b,r=t.r,d=r.doc.root===e.id,[p,i]=t.state(e,"open",!0),[n,s]=t.state(e,"typed",""),c=t.id(e,"title"),l=t.id(e,"desc"),u=e.typeToConfirm!==void 0?a.text(e.typeToConfirm):void 0,x=!u||n.trim()===u,m=e.severity==="destructive",g=t.a11y(e),f=()=>{d||i(!1),r.dispatch(e.cancel?.action??{event:{name:"ui.dismiss"}},a.scope,e.id)},y=()=>x&&r.dispatch(e.confirm.action,a.scope,e.id),h=e.subject&&o("div",{class:"pxd-dialog-subject"},re(t,{value:e.subject.avatar!==void 0?a.value(e.subject.avatar):void 0,name:a.text(e.subject.title),size:56}),o("div",null,o("div",{class:"pxd-dialog-subject-title"},a.text(e.subject.title)),e.subject.subtitle!==void 0&&o("div",{class:"pxd-dialog-subject-sub"},a.text(e.subject.subtitle)))),k=e.amount&&o("div",{class:"pxd-dialog-amount"},a.text(e.amount.value,e.amount.format)),A=Array.isArray(e.consequences)&&o("ul",{class:"pxd-consequences"},...e.consequences.map((b,v)=>o("li",{key:v},o("span",{class:"pxd-consequence-icon"},D(b.icon??"info")),o("span",null,o("span",{class:"pxd-consequence-title"},a.text(b.title)),b.detail!==void 0&&o("span",{class:"pxd-consequence-detail"},a.text(b.detail)))))),C=o("div",{class:"pxd-dialog-description",id:l},e.message!==void 0&&o("p",null,a.text(e.message))),I=e.consequence!==void 0&&o("p",{class:"pxd-dialog-consequence",id:`${l}-consequence`},D("info",18),o("span",null,a.text(e.consequence))),E=(b,v)=>[A,e.summary&&t.render(e.summary),u&&o("div",{class:"pxd-field"},o("label",{class:"pxd-field-label",for:`${e.id}-type`},"Type ",o("strong",null,u)," to confirm"),o("input",{id:`${e.id}-type`,class:"pxd-input",autocomplete:"off",value:n,onInput:w=>s(w.target.value)})),I,o("div",{class:"pxd-action-bar"},b,v)],F=o("button",{type:"button",class:`pxd-button pxd-button-primary${m?" pxd-button-danger":""}`,disabled:!x,onClick:y},a.text(e.confirm.label)),$=e.cancel?a.text(e.cancel.label):"Cancel",T=e.consequence!==void 0?`${l} ${l}-consequence`:l;if(d){let[b,v]=t.state(e,"focused",!1);return b||(v(!0),t.after(()=>r.root?.querySelector(`[data-pxd-id="${CSS.escape(e.id)}"] > .pxd-action-bar > .pxd-button-secondary`)?.focus({preventScroll:!0}))),o("div",{role:"alertdialog","aria-modal":"false","aria-labelledby":c,"aria-describedby":T,class:`pxd-dialog pxd-dialog-inline${m?" pxd-dialog-destructive":""}`,onKeydown:w=>w.key==="Escape"&&f(),...g},o("h1",{class:"pxd-dialog-title",id:c},a.text(e.title)),k,h,C,...E(F,o("button",{type:"button",class:"pxd-button pxd-button-secondary",onClick:f},$)))}return p&&t.portal(ue({ctx:t,id:t.id(e,"dialog"),role:"alertdialog",class:`pxd-dialog${m?" pxd-dialog-destructive":""}`,onClose:f,props:{"aria-labelledby":c,"aria-describedby":T,...g}},o("h2",{id:c,class:"pxd-dialog-title"},a.text(e.title)),k,h,C,...E(F,o("button",{type:"button",class:"pxd-button pxd-button-secondary",autofocus:!0,onClick:f},$)))),null}function Xr(e,t){let a=t.b,r=t.r,d=O(e.items.path,a.scope),p=Z(_(r.data,d)),i=p.map((g,f)=>({pointer:K(d,f)})),n=(g,f)=>_(r.data,O(g,i[f])),s=e.recommended!==void 0?a.text(e.recommended):void 0,c=e.recommendedReason!==void 0?a.text(e.recommendedReason):void 0,l=Wa(e.attributes,p.length,n),u=Ka(e.attributes,a.text),x=Xa(p.map((g,f)=>String(n(e.itemTitle,f)??"")),s),m=(g,f)=>{let y=n(g.path,f);return typeof y=="boolean"?y?o("span",{class:"pxd-yes"},D("check",18),o("span",{class:"pxd-sr-only"},"Included")):o("span",{class:"pxd-no"},D("dash",18),o("span",{class:"pxd-sr-only"},"Not included")):G(y,X(g.format,r.data,a.scope),r.locale)};return o("div",{class:"pxd-comparison",...t.a11y(e)},e.summary!==void 0&&o("p",{class:"pxd-comparison-summary"},a.text(e.summary)),o("ul",{class:"pxd-comparison-items"},...x.map(g=>{let f=String(n(e.itemTitle,g)??""),y=s===f;return o("li",{key:g,class:`pxd-comparison-item${y?" pxd-recommended":""}`},y&&o("p",{class:"pxd-recommendation"},o("span",{class:"pxd-badge pxd-tone-info"},"Recommended"),c&&o("span",{class:"pxd-recommendation-reason"},c)),ve(t,"pxd-comparison-title",f),...u.map((h,k)=>o("div",{class:"pxd-comparison-group",key:k},h.label&&o("p",{class:"pxd-comparison-group-label"},h.label),o("dl",null,...h.attributes.map(A=>o("div",{class:"pxd-detail-row",key:A.key},o("dt",null,a.text(A.label)),o("dd",null,m(A,g),l.get(A.key)===g&&o("span",{class:"pxd-best"}," Best"))))))),e.choose&&o("button",{type:"button",class:`pxd-button ${y?"pxd-button-primary":"pxd-button-secondary"}`,onClick:()=>r.dispatch(e.choose.action,i[g],e.id)},`${a.text(e.choose.label)} `,o("span",{class:"pxd-sr-only"},f)))})))}function Yr(e,t){let a=t.r,r=e.children??[],[d,p]=t.state(e,"shown",r.length),[i]=t.state(e,"widths",()=>new Map),[n]=t.state(e,"measured",()=>({trigger:44,width:-1})),[s,c]=t.state(e,"menu",be),l=mo(r,a.byId),u=t.id(e,"more"),x=y=>{if(r.length<=2||getComputedStyle(y).flexDirection==="column")return p(r.length);for(let A of y.querySelectorAll(":scope > [data-pxd-id]"))A.offsetWidth&&i.set(A.dataset.pxdId,A.offsetWidth);let h=y.querySelector(":scope > .pxd-action-bar-more");h?.offsetWidth&&(n.trigger=h.offsetWidth);let k=parseFloat(getComputedStyle(y).columnGap)||0;p(yo(r,A=>i.get(A)??0,k,y.clientWidth,n.trigger,l))},m=y=>{y&&a.observeWidth(y,`${e.id}:bar`,h=>{h!==n.width&&(n.width=h,x(y))})};t.after(()=>{let y=a.root?.querySelector(`[data-pxd-id="${CSS.escape(e.id)}"].pxd-action-bar`);y&&x(y)});let g=r.slice(0,Math.min(d,r.length)),f=r.slice(g.length);return f.length&&He(t,u,s,c,ti(t,f),{class:"pxd-menu pxd-action-menu"}),o("div",{class:"pxd-action-bar",role:"group","aria-label":"Actions",...t.a11y(e),ref:m},...g.map(y=>t.render(y)),f.length>0&&o("button",{type:"button",...qe(u,s,c,"start",{class:"pxd-icon-button pxd-action-menu-trigger pxd-action-menu-overflow pxd-action-bar-more","aria-label":go})},D("dots",18)))}function ti(e,t){let a=e.b,r=t.map(s=>e.r.byId.get(s)).filter(s=>!!s&&s.component==="Action"&&(s.visible===void 0||a.value(s.visible)!==!1)),{usual:d,danger:p,divider:i}=Ze(r),n=s=>({key:s.id,label:[a.text(s.label)],class:`pxd-menu-item${s.tone==="danger"?" pxd-menu-item-danger":""}`,disabled:s.disabled!==void 0?!!a.value(s.disabled):void 0,onSelect:()=>e.r.dispatch(s.action,a.scope,s.id),props:{"data-pxd-id":s.id,"data-pxd-component":s.component}});return[...d.map(n),...i?["separator"]:[],...p.map(n)]}function Jr(e,t){let a=t.b,r=t.r,[d,p]=t.state(e,"compact",!1),[i,n]=t.state(e,"open",!1),s=t.a11y(e),c=t.id(e,"sheet"),l=e.label!==void 0?a.text(e.label):"Filters",u=(e.children??[]).map(E=>r.byId.get(E)).filter(Boolean),x=u.filter(E=>E.component==="TextInput"&&E.kind==="search"),m=u.filter(E=>!x.includes(E)),g=lo(m,r.data,a.scope,r.locale,a.text),f=E=>r.surface.write(E.binding,E.cleared,a.scope),y=e.resultCount!==void 0?a.value(e.resultCount):void 0,h=xo(y,r.locale),k=()=>{for(let E of g)f(E);e.clear&&r.dispatch(e.clear,a.scope,e.id)},A=()=>n(!1),C=()=>m.map(E=>t.render(E.id)),I=o("div",{class:"pxd-filter-results"},...x.map(E=>t.render(E.id)),o("div",{class:"pxd-filter-status"},d&&o("button",{type:"button",class:"pxd-chip pxd-filter-trigger","aria-haspopup":"dialog","aria-expanded":i,"aria-controls":i?c:void 0,"data-state":i?"open":"closed",onClick:()=>n(!0)},D("filter",18),l,g.length>0&&o("span",{"aria-hidden":"true"},` \xB7 ${g.length}`),g.length>0&&o("span",{class:"pxd-sr-only"},`, ${g.length} active`)),h&&o("p",{class:"pxd-filter-count","aria-live":"polite"},h)),g.length>0&&o("ul",{class:"pxd-filter-chips","aria-label":"Active filters"},...g.map(E=>o("li",{key:E.key},o("button",{type:"button",class:"pxd-chip pxd-filter-chip",onClick:()=>f(E),"aria-label":`Remove filter: ${E.label}`},E.label,D("close",16)))),o("li",null,o("button",{type:"button",class:"pxd-button pxd-button-tertiary pxd-filter-clear",onClick:k},"Clear all"))),t.render(e.results));if(d&&i){let E=t.id(e,"sheet-title");t.portal(ue({ctx:t,id:c,class:"pxd-sheet",onClose:A,props:{id:c,"aria-labelledby":E}},o("div",{class:"pxd-sheet-header"},o("h2",{id:E,class:"pxd-sheet-title"},l),ye(A,{class:"pxd-icon-button","aria-label":"Close"},D("close"))),o("div",{class:"pxd-sheet-body pxd-stack"},...C()),o("div",{class:"pxd-sheet-footer"},g.length>0&&o("button",{type:"button",class:"pxd-button pxd-button-secondary",onClick:k},"Clear all"),ye(A,{class:"pxd-button pxd-button-primary"},h?`Show ${h}`:"Show results"))))}return o("div",{class:`pxd-filter-panel${d?" pxd-filter-compact":""}`,...s,ref:E=>E&&r.observeWidth(E,`${e.id}:filter`,F=>p(F<co))},d?I:o("div",{class:"pxd-filter-layout"},o("section",{class:"pxd-filter-sidebar","aria-label":l},ve(t,"pxd-filter-title",l),o("div",{class:"pxd-stack"},...C())),I))}function Zr(e,t){let a=t.b,r=t.r,d=t.frame,[p,i]=t.state(e,"compact",!1),[n,s]=t.state(e,"open",!1),[c,l]=t.state(e,"toggled",()=>({})),u=e.kind??"main",x=d&&d.navigationId===e.id&&u==="main"?d.navigation:void 0,m=a.value(e.current),g=x&&d?.current?.key!==void 0?d.current.key:m,f=e.label!==void 0?a.text(e.label):Ja(u),y=t.a11y(e),h=t.id(e,"drawer"),k=b=>{s(!1),d?.setDrawerOpen(!1),r.dispatch(b.action,a.scope,e.id)},A=b=>{let v=b.badge!==void 0?a.value(b.badge):void 0;return v?o("span",{class:"pxd-nav-badge"},v,o("span",{class:"pxd-sr-only"}," needing attention")):null};if(u==="breadcrumb")return o("nav",{class:"pxd-nav-breadcrumb","aria-label":f,...y},o("ol",null,...e.items.map((b,v)=>{let w=v===e.items.length-1,N=b.key===g||g===void 0&&w;return o("li",{key:b.key},N?o("span",{class:"pxd-nav-breadcrumb-current","aria-current":"page"},a.text(b.label)):o("button",{type:"button",class:"pxd-link",onClick:()=>k(b)},a.text(b.label)))})));if(u==="toc")return o("nav",{class:"pxd-nav-toc","aria-label":f,...y},o("p",{class:"pxd-nav-toc-label","aria-hidden":"true"},f),o("ol",null,...e.items.map(b=>{let v=b.key===g;return o("li",{key:b.key},o("a",{href:`#${b.key}`,class:`pxd-nav-toc-link${v?" pxd-nav-current":""}`,"aria-current":v?"true":void 0,onClick:()=>r.dispatch(b.action,a.scope,e.id)},a.text(b.label)))})));if(u==="local")return o("nav",{class:"pxd-nav-local","aria-label":f,...y},o("ul",null,...e.items.map(b=>{let v=b.key===g;return o("li",{key:b.key},o("button",{type:"button",class:`pxd-nav-local-item${v?" pxd-nav-current":""}`,"aria-current":v?"page":void 0,onClick:()=>k(b)},b.icon&&D(b.icon,16),o("span",{class:"pxd-nav-label"},a.text(b.label)),A(b)))})));let C=Ya(e.items,a.text),I=u==="nested",E=b=>b.label&&b.label in c?c[b.label]:!b.label||b.items.some(v=>v.key===g),F=b=>o("ul",null,...b.map(v=>{let w=v.key===g;return o("li",{key:v.key},o("button",{type:"button",class:`pxd-nav-item${w?" pxd-nav-current":""}`,"aria-current":w?"page":void 0,onClick:()=>k(v)},v.icon&&D(v.icon,18),o("span",{class:"pxd-nav-label"},a.text(v.label)),A(v)))})),$=o("nav",{class:`pxd-nav${I?" pxd-nav-nested":""}${x==="side"?" pxd-nav-side":""}`,"aria-label":f,...x==="side"?y:{}},...C.map((b,v)=>o("div",{class:"pxd-nav-group",key:v},b.label&&(I?o("button",{type:"button",class:"pxd-nav-group-toggle","aria-expanded":E(b),onClick:()=>l({...c,[b.label]:!E(b)})},D(E(b)?"sortUp":"sortDown",16),o("span",{class:"pxd-nav-group-label"},b.label)):o("p",{class:"pxd-nav-group-label"},b.label)),(!I||E(b))&&F(b.items))));if(x==="side")return $;if(x==="rail"||x==="bar"){let b=x==="bar"?e.items.slice(0,5):e.items;return o("nav",{class:`pxd-nav-${x}`,"aria-label":f,...y},o("ul",null,...b.map(v=>{let w=v.key===g,N=a.text(v.label);return o("li",{key:v.key},o("button",{type:"button",class:`pxd-nav-${x}-item${w?" pxd-nav-current":""}`,"aria-current":w?"page":void 0,onClick:()=>k(v)},o("span",{class:`pxd-nav-${x}-icon`},v.icon?D(v.icon,24):o("span",{class:"pxd-nav-glyph","aria-hidden":"true"},N.slice(0,1)),A(v)),o("span",{class:"pxd-nav-label"},N)))})))}let T=(b,v,w)=>{if(!b)return;let N=t.id(e,"drawer-title");t.portal(ue({ctx:t,id:h,class:"pxd-nav-drawer",onClose:v,props:{id:h,"aria-labelledby":N,...w}},o("div",{class:"pxd-sheet-header"},o("h2",{id:N,class:"pxd-sheet-title"},f),ye(v,{class:"pxd-icon-button","aria-label":"Close"},D("close"))),$))};return x==="drawer"&&d?(T(d.drawerOpen,()=>d.setDrawerOpen(!1),y),null):(T(p&&n,()=>s(!1),{}),o("div",{class:"pxd-nav-wrap",...y,ref:b=>{if(!b||u!=="main"||x)return;let v=b.closest(".pxd-surface")??b;r.observeWidth(v,`${e.id}:nav`,w=>i(w<900))}},p?o("button",{type:"button",class:"pxd-icon-button pxd-nav-menu","aria-label":`${f} menu`,"aria-haspopup":"dialog","aria-expanded":n,"aria-controls":n?h:void 0,"data-state":n?"open":"closed",onClick:()=>s(!0)},D("menu")):$))}function ai(e,t,a){t.action&&e.r.dispatch({event:{name:t.action.event.name,context:Ne(t,e.r.data,e.scope,a)}},{pointer:""},t.id)}function ed(e,t){let a=t.b,r=a.text(e.label),d=e.kind??"label",p=d==="status"?e.tone??"neutral":"neutral",i=t.a11y(e),n=`pxd-tag pxd-tag-${d} pxd-tag-${p}${e.remove?" pxd-tag-removable":""}`;return d==="count"?o("span",{class:n,title:r,...i},o("span",{class:"pxd-sr-only"},`${r}: `),o("span",{class:"pxd-tag-number"},a.text(e.count,{type:"number"}))):o("span",{class:n,title:r,...i},o("span",{class:"pxd-tag-text"},r),e.remove&&o("button",{type:"button",class:"pxd-tag-remove","aria-label":`Remove ${r}`,onClick:()=>t.r.dispatch(e.remove,a.scope,e.id)},D("close",12)))}function td(e,t){let a=t.b,r=t.r,d=t.id(e,"name"),p=t.id(e,"detail"),i=t.a11y(e),n=e.kind??"person",s=e.size??"default",c=gt[s]??gt.default,l=a.text(e.name),u=e.detail!==void 0?a.text(e.detail):void 0,x={"--polyxd-identity-size":`${c}px`},m=`pxd-identity pxd-identity-${s} pxd-identity-${n}${e.group?" pxd-identity-group":""}`,g,f=l;if(e.group){let h=O(e.group.path,a.scope),k=Z(_(r.data,h)).map((E,F)=>{let $={pointer:K(h,F)},T=b=>b?_(r.data,O(b,$)):void 0;return{name:String(T(e.group.namePath)??""),image:T(e.group.imagePath)}}),A=e.group.max??4,C=k.slice(0,A),I=k.slice(A);f||(f=Ra(k,A)),g=o("span",{class:"pxd-identity-faces"},...C.map((E,F)=>o("span",{class:"pxd-identity-face",key:F},re(t,{value:E.image,name:E.name,size:c}),o("span",{class:"pxd-sr-only"},E.name))),I.length>0&&o("span",{class:"pxd-identity-face pxd-identity-more",role:"img",title:I.map(E=>E.name).join(", "),"aria-label":`${I.length} more: ${I.map(E=>E.name).join(", ")}`},o("span",{"aria-hidden":"true"},`+${I.length}`)))}else g=re(t,{value:a.value(e.image),name:l,size:c});let y=[g,o("span",{class:"pxd-identity-text"},o("span",{class:"pxd-identity-name",id:d},f),u&&o("span",{class:"pxd-identity-detail",id:p},u))];return e.action?o("button",{type:"button",class:`${m} pxd-identity-button`,style:x,"aria-labelledby":d,"aria-describedby":u?p:void 0,onClick:()=>r.dispatch(e.action,a.scope,e.id),...i},...y):o("div",{class:m,style:x,role:"group","aria-labelledby":d,"aria-describedby":u?p:void 0,...i},...y)}function ad(e,t){let a=t.b,r=t.id(e,"label"),d=t.a11y(e),p=e.kind??"bar",i=a.text(e.label),n=e.caption!==void 0?a.text(e.caption):void 0,s=Aa({kind:p,thresholds:e.thresholds,tone:e.tone,format:X(e.format,t.r.data,a.scope)},a.value(e.value),e.max!==void 0?a.value(e.max):void 0,!!a.value(e.indeterminate),n,t.r.locale),c=p==="meter"?"meter":"progressbar",l=`pxd-gauge pxd-gauge-${p}${s.tone&&s.tone!=="neutral"?` pxd-gauge-${s.tone}`:""}${s.indeterminate?" pxd-gauge-indeterminate":""}`,u=o("div",{class:"pxd-gauge-header"},o("span",{class:"pxd-gauge-label",id:r},i),o("span",{class:"pxd-gauge-readout"},!s.indeterminate&&o("span",{class:"pxd-gauge-value"},s.readout),n&&o("span",{class:"pxd-gauge-caption"},n),s.hint&&o("span",{class:"pxd-gauge-hint"},s.hint)));return p==="ring"?o("div",{class:l,...d},o("div",{class:"pxd-gauge-ring-graphic",role:c,"aria-labelledby":r,...s.valueProps},o("svg",{class:"pxd-gauge-ring-svg",viewBox:"0 0 36 36","aria-hidden":"true",focusable:"false"},o("circle",{class:"pxd-gauge-ring-track",cx:"18",cy:"18",r:"16",fill:"none","stroke-width":"4"}),o("circle",{class:"pxd-gauge-ring-fill",cx:"18",cy:"18",r:"16",fill:"none","stroke-width":"4",pathLength:100,"stroke-dasharray":s.indeterminate?"25 100":`${s.percent} 100`,"stroke-linecap":"round"}))),u):o("div",{class:l,...d},u,o("div",{class:"pxd-gauge-track",role:c,"aria-labelledby":r,...s.valueProps},o("div",{class:"pxd-gauge-fill",style:s.indeterminate?void 0:{width:`${s.percent}%`}})))}function Qr(e){let t=Math.round(Math.max(0,Math.min(1,e))*100);return o("span",{class:"pxd-rating-star-shape","aria-hidden":"true"},o("svg",{class:"pxd-rating-star-empty",viewBox:"0 0 24 24",focusable:"false"},o("path",{d:mt})),o("span",{class:"pxd-rating-star-fill",style:{width:`${t}%`}},o("svg",{viewBox:"0 0 24 24",focusable:"false"},o("path",{d:mt}))))}function od(e,t){let a=t.b,r=t.r,d=t.id(e,"label"),p=t.id(e,"help"),[i,n]=t.state(e,"hover",null),s=t.a11y(e),c=e.max??5,l=a.text(e.label),u=a.value(e.value),x=u==null||u===""?void 0:Number(u),m=x!==void 0&&Number.isFinite(x)?Math.max(0,Math.min(c,x)):void 0,g=!!a.value(e.readOnly),f=e.count!==void 0?a.value(e.count):void 0,y=f!=null?G(f,{type:"number"},r.locale):void 0,h=e.help!==void 0?a.text(e.help):void 0,k=m!==void 0?G(m,{type:"number",precision:Number.isInteger(m)?0:1},r.locale):void 0,A=f!=null?`from ${y} ${Number(f)===1?"rating":"ratings"}`:void 0;if(g)return o("div",{class:"pxd-rating pxd-rating-readonly",...s},o("span",{class:"pxd-rating-label"},l),o("span",{class:"pxd-rating-stars",role:"img","aria-label":Na(k,c)},...Array.from({length:c},(F,$)=>Qr((m??0)-$))),o("span",{class:"pxd-rating-readout"},k&&o("span",{class:"pxd-rating-value","aria-hidden":"true"},k),y&&o("span",{class:"pxd-rating-count"},o("span",{"aria-hidden":"true"},`(${y})`),o("span",{class:"pxd-sr-only"},A))));let C=m!==void 0?Math.round(m):0,I=i??C,E=F=>{let $=Number(F);a.write(e.value,$),ai(t,e,$)};return o("div",{class:"pxd-field pxd-rating",...s},o("div",{class:"pxd-field-label",id:d},l,e.required&&o("span",{class:"pxd-required","aria-hidden":"true"},"*")),h&&o("p",{class:"pxd-field-help",id:p},h),o("div",{class:"pxd-rating-row"},Ce({class:"pxd-rating-stars",orientation:"horizontal","aria-labelledby":d,"aria-describedby":h?p:void 0,"aria-required":e.required||void 0,value:C?String(C):"",onValueChange:E,onMouseleave:()=>n(null)},...Array.from({length:c},(F,$)=>$+1).map(F=>Ue({key:F,value:String(F),group:C?String(C):"",first:F===1,onSelect:()=>E(String(F)),class:`pxd-rating-star${F<=I?" pxd-rating-star-on":""}`,"aria-label":Ia(F),"data-orientation":"horizontal",onMouseenter:()=>n(F),onFocus:()=>n(null)},Qr(F<=I?1:0)))),o("span",{class:"pxd-rating-readout","aria-hidden":"true"},k&&o("span",{class:"pxd-rating-value"},k),y&&o("span",{class:"pxd-rating-count"},`(${y})`)),A&&o("span",{class:"pxd-sr-only"},A)))}var oi=2e3;function rd(e,t){let a=t.b,r=t.id(e,"label"),d=t.a11y(e),p=a.text(e.text),i=e.label!==void 0?a.text(e.label):void 0,n=!!a.value(e.secret),s=e.copyable!==!1,[c,l]=t.state(e,"revealed",!1),[u,x]=t.state(e,"status",""),[m]=t.state(e,"timer",()=>({id:null})),g=C=>{x(C),m.id&&clearTimeout(m.id),m.id=setTimeout(()=>x(""),oi)},f=()=>{let C=typeof navigator<"u"?navigator.clipboard:void 0;if(!C?.writeText)return g("Couldn't copy");C.writeText(p).then(()=>g("Copied"),()=>g("Couldn't copy"))},y=n&&!c,h=y?Ta(p):p,k=i??"code",A=i??(e.language?`${e.language} code`:"Code");return o("section",{class:`pxd-code${e.wrap?" pxd-code-wrap":""}${n?" pxd-code-secret":""}`,"aria-labelledby":i!==void 0?r:void 0,"aria-label":i===void 0?A:void 0,...d},o("div",{class:"pxd-code-header"},i!==void 0&&o("span",{class:"pxd-code-label",id:r},i),o("div",{class:"pxd-code-controls"},n&&o("button",{type:"button",class:"pxd-button pxd-button-tertiary pxd-code-control","aria-label":`${c?"Hide":"Show"} ${k}`,onClick:()=>l(!c)},c?"Hide":"Show"),s&&o("button",{type:"button",class:"pxd-button pxd-button-tertiary pxd-code-control","aria-label":`Copy ${k}`,onClick:f},u==="Copied"&&D("check",16),u==="Copied"?"Copied":"Copy"),o("span",{class:"pxd-sr-only",role:"status","aria-live":"polite"},u))),o("pre",{class:"pxd-code-pre",tabindex:"0","data-language":e.language,"data-masked":y||void 0},o("code",{class:e.language?`language-${e.language}`:void 0,translate:"no"},h)))}var dd=()=>o("svg",{class:"pxd-action-menu-chevron",width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},o("path",{d:"m6 9 6 6 6-6"}));function id(e,t){let a=t.b,r=t.r,d=t.a11y(e),p=e.kind??"overflow",i=a.text(e.label),n=d["aria-label"]??i,s=t.id(e,"menu"),[c,l]=t.state(e,"menu",be),[u,x]=t.state(e,"context",be),m=(e.children??[]).map(I=>r.byId.get(I)).filter(I=>!!I&&(I.visible===void 0||a.value(I.visible)!==!1)),{usual:g,danger:f,divider:y}=Ze(m),h=I=>({key:I.id,label:[a.text(I.label)],class:`pxd-menu-item${I.tone==="danger"?" pxd-menu-item-danger":""}`,disabled:I.disabled!==void 0?!!a.value(I.disabled):void 0,onSelect:()=>r.dispatch(I.action,a.scope,I.id),props:{"data-pxd-id":I.id,"data-pxd-component":I.component}}),k=[...g.map(h),...y?["separator"]:[],...f.map(h)];He(t,s,c,l,k,{class:"pxd-menu pxd-action-menu"});let A=(I,E,...F)=>o("button",{type:"button",...qe(s,c,l,E,I)},...F),C=()=>A({class:"pxd-icon-button pxd-action-menu-trigger pxd-action-menu-overflow",...d,"aria-label":n},"end",D("dots",18));if(p==="dropdown")return A({class:"pxd-button pxd-button-secondary pxd-action-menu-trigger pxd-action-menu-dropdown",...d,"aria-label":d["aria-label"]},"end",i,dd());if(p==="split"){let E=(e.primary?r.byId.get(e.primary):void 0)?.emphasis??"secondary";return o("div",{class:"pxd-split",role:"group",...d,"aria-label":n},e.primary&&t.render(e.primary),A({class:`pxd-button pxd-button-${E} pxd-action-menu-trigger pxd-split-menu`,"aria-label":`${i}: more options`},"end",dd()))}return p==="context"?(He(t,`${s}-context`,u,x,k,{class:"pxd-menu pxd-action-menu","aria-label":n}),o("span",{class:"pxd-context-target","data-state":u.open?"open":"closed",style:{WebkitTouchCallout:"none"},onContextmenu:I=>{I.preventDefault(),x({open:!0,x:I.clientX,y:I.clientY,align:"start"})}},C())):C()}function pd(e,t){let a=t.b,r=t.r,d=t.a11y(e),p=Math.min(t.heading,6),i=t.id(e,"title"),n=t.id(e,"panel"),s=e.kind??"dialog",c=e.size??"default",l=e.dismissible!==!1,u=ge(e.open),[x,m]=t.state(e,"open",!0),g=u?!!a.value(e.open):x&&e.open!==!1,f=()=>{u?a.write(e.open,!1):m(!1),r.dispatch({event:{name:"ui.dismiss"}},a.scope,e.id)},y=a.text(e.title),h=`pxd-panel pxd-panel-${s} pxd-panel-size-${c}`,k=t.with({heading:p+1}),A=()=>o("div",{class:"pxd-panel-body pxd-stack"},...he(k,e.children)),C=()=>e.actions&&o("div",{class:"pxd-panel-footer"},t.render(e.actions));if(s==="popover")return g&&xr(t,n,`.pxd-panel-anchor[data-pxd-anchor="${CSS.escape(e.id)}"]`,f,l,{class:h,"aria-labelledby":i,...d},o("div",{class:"pxd-panel-header"},o(`h${p}`,{id:i,class:"pxd-panel-title"},y),l&&o("button",{type:"button",class:"pxd-icon-button pxd-panel-close","aria-label":"Close",onClick:f},D("close"))),A(),C(),o("span",{style:{position:"absolute",left:"50%",top:"100%",transform:"translateX(-50%)"}},o("svg",{class:"pxd-panel-arrow",width:16,height:8,viewBox:"0 0 30 10",preserveAspectRatio:"none"},o("polygon",{points:"0,0 30,0 15,10"})))),o("span",{class:"pxd-panel-anchor","data-pxd-anchor":e.id});if(!g)return null;let I=s==="sheet"&&l?ri(f):{};return t.portal(ue({ctx:t,id:n,class:h,overlayClass:"pxd-overlay pxd-panel-backdrop",dismissible:l,onClose:f,props:{"aria-labelledby":i,...d}},o("div",{class:"pxd-panel-header",...I},s==="sheet"&&o("span",{class:"pxd-panel-grip","aria-hidden":"true"}),o(`h${p}`,{id:i,class:"pxd-panel-title"},y),l&&ye(f,{class:"pxd-icon-button pxd-panel-close","aria-label":"Close"},D("close"))),A(),C())),null}function ri(e){let t=null,a=d=>d.currentTarget.closest("dialog"),r=d=>{t=null;let p=a(d);p&&(p.style.transform="",p.style.transition="")};return{onPointerdown:d=>{d.pointerType==="mouse"&&d.button!==0||(t=d.clientY,d.currentTarget.setPointerCapture(d.pointerId))},onPointermove:d=>{let p=a(d);if(t===null||!p)return;let i=Math.max(0,d.clientY-t);p.style.transition="none",p.style.transform=`translateY(${i}px)`},onPointerup:d=>{if(t===null)return;let p=d.clientY-t,i=a(d);r(d),p>80&&(i?.open&&i.close(),e())},onPointercancel:r}}var Ge=(...e)=>e.filter(Boolean).join(" ")||void 0,Ro=e=>e.target.value,Uo=e=>{typeof e.ref=="string"&&e.ref.startsWith("blob:")&&URL.revokeObjectURL(e.ref)};function sd(e,t){let a=t.b,r=t.r,d=t.id(e),p=t.id(e,"help"),i=t.id(e,"error"),[n,s]=t.state(e,"error",null),[c,l]=t.state(e,"dragging",!1),u=a.value(e.value),x=Array.isArray(u)?u:[],m=Array.isArray(e.accept)?e.accept:[],g=e.maxSize,f=!!e.multiple,y=a.text(e.label),h=[e.help!==void 0?a.text(e.help):"",Ca(m,g,f,r.locale)].filter(Boolean).join(" ")||void 0,k=C=>{if(!C)return;let I=Array.from(C),E=[],F=[];for(let $ of f?I:I.slice(0,1)){let T=Ea($,m,g,r.locale);T?(F.push(T),r.events?.inputError(e,wo($,g))):E.push({name:$.name,size:$.size,type:$.type,ref:URL.createObjectURL($)})}if(s(F.length?F.join(" "):null),E.length!==0)if(f){let $=E.filter(T=>!x.some(b=>b.name===T.name&&b.size===T.size));E.filter(T=>!$.includes(T)).forEach(Uo),$.length&&a.write(e.value,[...x,...$])}else x.forEach(Uo),a.write(e.value,E)},A=C=>{Uo(x[C]),a.write(e.value,x.filter((I,E)=>E!==C)),s(null)};return o("div",{class:"pxd-field pxd-file"},o("label",{class:"pxd-field-label",for:d},y,e.required&&Ee()),h&&o("p",{class:"pxd-field-help",id:p},h),o("div",{class:"pxd-dropzone","data-dragging":c||void 0,onDrop:C=>{C.preventDefault(),l(!1),k(C.dataTransfer?.files??null)},onDragover:C=>{C.preventDefault(),c||l(!0)},onDragleave:C=>{C.currentTarget.contains(C.relatedTarget)||l(!1)}},o("input",{id:d,class:"pxd-dropzone-input",type:"file",accept:m.length?m.join(","):void 0,multiple:f,required:e.required&&x.length===0,"aria-describedby":Ge(h&&p,n&&i),"aria-invalid":n?!0:void 0,onChange:C=>{let I=C.target;k(I.files),I.value=""},...t.a11y(e)}),o("span",{class:"pxd-dropzone-icon","aria-hidden":"true"},D("file",24)),o("span",{class:"pxd-dropzone-text"},o("span",{class:"pxd-dropzone-action"},f?"Choose files":"Choose a file"),o("span",{class:"pxd-dropzone-hint"},f?"or drop them here":"or drop it here"))),n&&o("p",{class:"pxd-field-error",id:i,role:"alert"},n),x.length>0&&o("ul",{class:"pxd-file-list"},...x.map((C,I)=>o("li",{class:"pxd-file-item",key:`${C.name}-${C.size}-${I}`},o("span",{class:"pxd-file-icon","aria-hidden":"true"},D("file",18)),o("span",{class:"pxd-file-text"},o("span",{class:"pxd-file-name"},C.name),o("span",{class:"pxd-file-size"},De(C.size,r.locale)),typeof C.progress=="number"&&C.progress<1&&o("progress",{class:"pxd-file-progress",value:C.progress,max:1,"aria-label":`Uploading ${C.name}`})),o("button",{type:"button",class:"pxd-file-remove","aria-label":`Remove ${C.name}`,onClick:()=>A(I)},D("close",18))))))}var Me="__other";function ld(e,t){let a=t.b,r=t.id(e,"label"),d=t.id(e,"help"),p=t.id(e,"picker"),i=t.id(e,"text"),n=t.id(e,"alpha"),s=e.format??"hex",c=!!e.alpha,l=a.text(e.label),u=e.help!==void 0?a.text(e.help):void 0,x=a.value(e.value),m=x==null?"":String(x),g=ze(m),[f,y]=t.state(e,"draft",null),[h,k]=t.state(e,"other",!1),A=t.a11y(e),C=e.swatches?Se({...e,options:e.swatches},t.r.data,a.scope,a.text):[],I=C.length>0,E=z=>a.write(e.value,ft(z,s,c)),F=z=>{y(z);let M=ze(z);M&&E(M)},$=C.findIndex(z=>g?ka(ze(z.value),g,c):String(z.value)===m&&m!==""),T=h?Me:$>=0?String($):m?Me:"",b=!I||T===Me,v=Math.round((g?.a??1)*100),w=()=>o("div",{class:"pxd-color-picker"},o("input",{id:p,class:"pxd-color-native",type:"color",value:va(g),"aria-label":`${l}: pick`,"aria-describedby":Ge(u&&d),onInput:z=>{let M=ze(Ro(z));M&&(y(null),E({...M,a:g?.a??1}))}}),o("input",{id:i,class:"pxd-input pxd-input-mono pxd-color-text",type:"text",inputmode:"text",autocomplete:"off",spellcheck:"false",placeholder:wa(s),value:f??m,"aria-label":`${l}: value`,"aria-describedby":Ge(u&&d),"aria-invalid":f!==null&&f!==""&&!ze(f)?!0:void 0,required:!I&&e.required,onInput:z=>F(Ro(z)),onBlur:()=>y(null)}),c&&o("label",{class:"pxd-color-alpha",for:n},o("span",{class:"pxd-color-alpha-label"},"Opacity"),o("input",{id:n,type:"range",min:0,max:100,step:1,value:String(v),disabled:!g,"aria-valuetext":`${v}%`,onInput:z=>{g&&(y(null),E({...g,a:Number(Ro(z))/100}))}}),o("output",{class:"pxd-color-alpha-value",for:n,"aria-hidden":"true"},`${v}%`)));if(!I)return o("div",{class:"pxd-field pxd-color",role:"group","aria-labelledby":r,"aria-describedby":Ge(u&&d),...A},o("div",{class:"pxd-field-label",id:r},l,e.required&&Ee()),u&&o("p",{class:"pxd-field-help",id:d},u),w());let N=z=>{if(z===Me)return k(!0);k(!1),y(null);let M=C[Number(z)],S=ze(M.value);a.write(e.value,S?ft(S,s,c):M.value)};return o("div",{class:"pxd-field pxd-color",...A},o("div",{class:"pxd-field-label",id:r},l,e.required&&Ee()),u&&o("p",{class:"pxd-field-help",id:d},u),Ce({class:"pxd-swatches","aria-labelledby":r,"aria-describedby":Ge(u&&d),"aria-required":e.required||void 0,value:T,orientation:"horizontal",onValueChange:N},...C.map((z,M)=>Ue({key:String(M),value:String(M),group:T,first:M===0,onSelect:()=>N(String(M)),class:"pxd-swatch",title:z.label,"data-orientation":"horizontal"},o("span",{class:"pxd-swatch-color",style:{background:String(z.value)},"aria-hidden":"true"}),o("span",{class:"pxd-swatch-name"},z.label))),Ue({key:Me,value:Me,group:T,onSelect:()=>N(Me),class:"pxd-swatch pxd-swatch-other",title:"Other","data-orientation":"horizontal"},o("span",{class:"pxd-swatch-color",style:T===Me&&g?{background:m}:void 0,"aria-hidden":"true"}),o("span",{class:"pxd-swatch-name"},"Other"))),b&&w())}var nd=(e,t)=>Array.from({length:t},(a,r)=>e[r]??"");function cd(e,t){let a=t.b,r=t.id(e,"label"),d=t.id(e,"help"),p=ne(Number(e.length)||6,4,12),i=(e.kind??"numeric")==="numeric",n=e.required??!0,s=a.text(e.label),c=e.help!==void 0?a.text(e.help):void 0,l=a.value(e.value),u=l==null?"":String(l),[x]=t.state(e,"code",()=>({chars:nd(u,p),seen:u,fired:null}));u!==x.seen&&(x.seen=u,u!==x.chars.join("")&&(x.chars=nd(u,p)));let m=x.chars,g=t.a11y(e),f=()=>Array.from(t.r.root?.querySelectorAll(`[data-pxd-id="${CSS.escape(e.id)}"] .pxd-code-box`)??[]),y=T=>T.replace(i?/[^0-9]/g:/[^0-9a-zA-Z]/g,""),h=T=>f()[ne(T,0,p-1)]?.focus(),k=T=>{x.chars=T;let b=T.join("");x.seen=b,a.write(e.value,b),e.action&&T.every(Boolean)&&b!==x.fired&&(x.fired=b,t.r.dispatch({event:{name:e.action.event.name,context:Ne(e,t.r.data,a.scope,b)}},{pointer:""},e.id)),t.r.schedule()},A=(T,b)=>{let v=y(b);if(!v)return;let w=[...m],N=T;for(let z of v){if(N>=p)break;w[N++]=z}k(w),h(N)},C=(T,b)=>{let v=m[T],w=b.target.value;if(v&&w.length>1&&(w=w.startsWith(v)?w.slice(v.length):w.endsWith(v)?w.slice(0,-v.length):w),w===""){let N=[...m];return N[T]="",k(N)}A(y(w).length>=p?0:T,w)},I=(T,b)=>{if(b.key==="Backspace"&&!m[T]&&T>0){b.preventDefault();let v=[...m];v[T-1]="",k(v),h(T-1)}else b.key==="ArrowLeft"?(b.preventDefault(),h(T-1)):b.key==="ArrowRight"&&(b.preventDefault(),h(T+1))},E=(T,b)=>{b.preventDefault();let v=b.clipboardData?.getData("text")??"";A(y(v).length>=p?0:T,v)},F=p>6?p%4===0?4:3:p,$=[];for(let T=0;T<p;T+=F)$.push(Array.from({length:Math.min(F,p-T)},(b,v)=>T+v));return o("div",{class:"pxd-field pxd-code",role:"group","aria-labelledby":r,"aria-describedby":Ge(c&&d),...g},o("div",{class:"pxd-field-label",id:r},s,n&&Ee()),c&&o("p",{class:"pxd-field-help",id:d},c),o("div",{class:"pxd-code-boxes"},...$.map((T,b)=>o("div",{class:"pxd-code-group",key:b},...T.map(v=>o("input",{key:v,class:"pxd-code-box",type:"text",inputmode:i?"numeric":"text",pattern:i?"[0-9]*":"[0-9A-Za-z]*",autocomplete:v===0?"one-time-code":"off",autocapitalize:i?void 0:"characters",spellcheck:"false","aria-label":`Digit ${v+1} of ${p}`,value:m[v],"data-filled":m[v]?"":void 0,required:n,onFocus:w=>w.target.select(),onInput:w=>C(v,w),onKeydown:w=>I(v,w),onPaste:w=>E(v,w)}))))))}var xd=40;function ud(e,t){let a=t.b,r=t.r,d=t.id(e,"caption"),p=e.selection??"none",i=p!=="none"&&!!e.selected,n=e.expanded?Z(a.value(e.expanded)):void 0,[s,c]=t.state(e,"expanded",null),l=n?new Set(n):s,u=i?a.value(e.selected):void 0,x=H=>Array.isArray(u)?u.includes(H):u!==void 0&&u===H,{rows:m,indexByKey:g,topValues:f}=io(e,r.data,a.scope,l),[y,h]=t.state(e,"focus",null),k=(y!==null?g.get(y):void 0)??0,[A]=t.state(e,"pending",()=>({index:null})),C=m.length>ht,[I,E]=t.state(e,"geometry",()=>({rowHeight:xd,viewportHeight:xd*12,scrollTop:0})),{start:F,end:$}=so(m.length,I.scrollTop,I.rowHeight,I.viewportHeight),T=()=>r.root?.querySelector(`[data-pxd-id="${CSS.escape(e.id)}"] .pxd-tree-list`),b=H=>{if(!m.length)return;let L=Math.max(0,Math.min(m.length-1,H));h(m[L].key);let U=T()?.querySelector(`[data-index="${L}"]`);if(U)return U.focus();A.index=L;let R=T()?.parentElement;if(C&&R?.classList.contains("pxd-tree-viewport")){let q=Math.max(0,L*I.rowHeight-(I.viewportHeight-I.rowHeight)/2);R.scrollTop=q,E({...I,scrollTop:q})}};t.after(()=>{if(A.index===null)return;let H=T()?.querySelector(`[data-index="${A.index}"]`);if(H&&(A.index=null,H.focus()),C){let L=T()?.querySelector(".pxd-tree-item"),U=T()?.parentElement,R=L&&L.offsetHeight>0?L.offsetHeight:I.rowHeight,q=U?.clientHeight||I.viewportHeight;(R!==I.rowHeight||q!==I.viewportHeight)&&E({...I,rowHeight:R,viewportHeight:q})}});let v=(H,L)=>{if(e.expanded){let R=n??[];a.write(e.expanded,L?[...R,...H.filter(q=>!R.includes(q))]:R.filter(q=>!H.includes(q)));return}let U=new Set(s??f);for(let R of H)L?U.add(R):U.delete(R);c(U)},w=H=>v([H.value],!H.expanded),N=H=>{if(!i)return;if(p==="single")return a.write(e.selected,H.value);let L=Array.isArray(u)?u:[];a.write(e.selected,L.includes(H.value)?L.filter(U=>U!==H.value):[...L,H.value])},z=H=>{N(H),e.action&&r.dispatch(e.action,H.scope,e.id)},[M]=t.state(e,"typed",()=>({buffer:"",at:0})),S=H=>{let L=Date.now();M.buffer=L-M.at<ro?M.buffer+H.toLowerCase():H.toLowerCase(),M.at=L;let U=po(m,k,M.buffer);U>=0&&b(U)},P=H=>{let L=m[k],U=no(m,k,H);!L||!U||(H.preventDefault(),H.stopPropagation(),"focus"in U?b(U.focus):"toggle"in U?w(L):"activate"in U?z(L):"select"in U?N(L):"expandSiblings"in U?v(m.filter(R=>R.parent===L.parent&&R.hasChildren).map(R=>R.value),!0):"typeAhead"in U&&S(U.typeAhead))},V=a.text(e.label),j=C?{paddingTop:F*I.rowHeight,paddingBottom:(m.length-$)*I.rowHeight}:void 0,B=o("ul",{role:"tree",class:"pxd-tree-list","aria-labelledby":d,"aria-multiselectable":p==="multiple"?!0:void 0,style:j,onKeydown:P},...m.slice(F,$).map((H,L)=>{let U=F+L,R=i?x(H.value):void 0;return o("li",{key:H.key,role:"treeitem",class:`pxd-tree-item${R?" pxd-tree-item-selected":""}`,style:{"--polyxd-tree-depth":H.level-1},"data-index":U,tabindex:U===k?"0":"-1","aria-level":H.level,"aria-setsize":H.setsize,"aria-posinset":H.posinset,"aria-expanded":H.hasChildren?H.expanded:void 0,"aria-selected":R,onFocus:q=>{q.target===q.currentTarget&&h(H.key)},onClick:q=>{q.stopPropagation(),b(U),i?N(H):H.hasChildren&&w(H)},onDblclick:q=>{q.stopPropagation(),e.action?r.dispatch(e.action,H.scope,e.id):H.hasChildren&&w(H)}},o("div",{class:"pxd-tree-row"},H.hasChildren?o("button",{type:"button",class:`pxd-tree-expander${H.expanded?" pxd-tree-expander-open":""}`,tabindex:"-1","aria-hidden":"true",onClick:q=>{q.stopPropagation(),b(U),w(H)},onDblclick:q=>q.stopPropagation()},D("chevronRight",16)):o("span",{class:"pxd-tree-expander pxd-tree-expander-leaf","aria-hidden":"true"}),o("span",{class:"pxd-tree-text"},H.label),H.detail!==void 0&&o("span",{class:"pxd-tree-detail"},H.detail)))}));return o("div",{class:"pxd-tree",...t.a11y(e)},o("div",{class:"pxd-tree-caption",id:d},V),C?o("div",{class:"pxd-tree-viewport",onScroll:H=>E({...I,scrollTop:H.currentTarget.scrollTop})},B):B)}var St={Section:ur,Group:fr,Card:mr,Disclosure:yr,Views:br,Navigation:Zr,Text:Ir,Metric:Nr,DetailList:Tr,Collection:Rr,Table:Er,Chart:Fr,Media:Ur,Status:Hr,TextInput:jr,Choice:Dr,Toggle:Vr,DateInput:Or,RangeInput:_r,Form:qr,Action:Gr,ActionBar:Yr,Steps:Wr,Confirm:Kr,Comparison:Xr,FilterPanel:Jr,Tag:ed,Identity:td,Progress:ad,Rating:od,Code:rd,Tree:ud,ActionMenu:id,Panel:pd,FileInput:sd,ColorInput:ld,CodeInput:cd,Columns:gr,Split:hr,Frame:kr,AppBar:wr,Footer:Sr,Outlet:zr,Custom:Cr};var tt=class{surface;props;host;root=null;portalEl=null;components;states=new Map;effects=[];portals=[];modals=0;scheduled=!1;unsubscribe;observers=new Map;drawing=!1;disposers=[];events;statuses=new Map;statusesBefore=new Map;constructor(t,a){this.host=t,this.props=a,this.components={...St,...a.components??{}},this.surface=this.makeSurface(a),this.events=this.makeEvents(a),this.unsubscribe=this.surface.subscribe(()=>this.schedule());let r=d=>{if(!this.events)return;let p=d.target,i=p?.closest?.("[data-pxd-id]")?.getAttribute("data-pxd-id");i&&this.events.inputError(this.byId.get(i)??i,ko(p?.validity))};t.addEventListener("invalid",r,!0),this.disposers.push(()=>t.removeEventListener("invalid",r,!0))}makeSurface(t){let a=this;return bo(t.document,{data:t.data,locale:t.locale??"en-GB",derive:t.derive,onAction:r=>this.props.onAction?.(r),onDataChange:r=>this.props.onDataChange?.(r),onDismiss:()=>this.props.onDismiss?.(),get events(){return a.events}})}makeEvents(t){return t.onEvent?So(t.document,a=>this.props.onEvent?.(a),t.events):void 0}statusDrawn(t,a){this.events&&this.statuses.set(`${a.pointer}#${t.id}`,t)}get locale(){return this.surface.locale}get doc(){return this.surface.document}get data(){return this.surface.data}get byId(){return this.surface.byId}get disclosure(){return this.props.disclosure??"progressive"}update(t){let a=this.props;this.props=t,this.components={...St,...t.components??{}};let r=t.document!==a.document;if(r&&(this.events?.unmounted(!1),this.events=void 0),!!t.onEvent!=!!this.events&&(this.events=this.makeEvents(t),this.statusesBefore.clear()),r||(t.locale??"en-GB")!==a.locale)this.unsubscribe(),this.states.clear(),this.surface=this.makeSurface(t),this.unsubscribe=this.surface.subscribe(()=>this.schedule());else if(t.data&&t.data!==a.data&&t.document.surface.kind==="shell"){this.surface.replaceData(t.data);return}this.schedule()}dispose(){this.events?.unmounted(!1),this.events=void 0,this.unsubscribe();for(let t of this.disposers)t();for(let t of this.observers.values())t.disconnect();Mo(this.host)}onDispose(t){this.disposers.push(t)}schedule(){this.scheduled||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1,this.draw()}))}observeWidth(t,a,r){if(!t||this.observers.has(t)||typeof ResizeObserver>"u")return;let d=()=>r(t.getBoundingClientRect().width),p=new ResizeObserver(d);p.observe(t),this.observers.set(t,p),d()}unobserve(t){this.observers.get(t)?.disconnect(),this.observers.delete(t)}bindings(t){let a=this.surface;return{scope:t,value:r=>W(r,a.data,t),text:(r,d)=>{let p=W(r,a.data,t);return d?G(p,X(d,a.data,t),a.locale):p==null?"":String(p)},pointer:r=>O(r.path,t),write:(r,d)=>a.setValue(O(r.path,t),d),context:r=>we(r,a.data,t)}}dispatch(t,a,r){this.surface.dispatch(t,a,r)}ctx(t){let a=this,r=(p,i)=>`${t.scope.pointer}#${p.id}:${i}`,d={r:a,scope:t.scope,heading:t.heading,steps:t.steps,frame:t.frame,b:a.bindings(t.scope),render:(p,i)=>a.renderNode(p,i?d.with({scope:i}):d),a11y:p=>ho(p,i=>{let n=W(i,a.data,t.scope);return n===void 0?void 0:String(n)}),id:(p,i="")=>`pxd-${(t.scope.pointer+"-"+p.id+(i?"-"+i:"")).replace(/[^A-Za-z0-9_-]+/g,"_")}`,state:(p,i,n)=>{let s=r(p,i);a.states.has(s)||a.states.set(s,typeof n=="function"?n():n);let c=l=>{let u=a.states.get(s),x=typeof l=="function"?l(u):l;Object.is(x,u)||(a.states.set(s,x),a.schedule())};return[a.states.get(s),c]},after:p=>a.effects.push(p),portal:p=>a.portals.push(p),with:p=>a.ctx({...t,...p})};return d}renderNode(t,a){let r=this.byId.get(t);if(!r||r.visible!==void 0&&W(r.visible,this.data,a.scope)===!1)return null;let d=this.components[r.component];if(!d)return o("div",{class:"pxd-unknown",role:"note"},`Unsupported component \u201C${r.component}\u201D`);let p=d(r,a);return p instanceof Element?_e(p,r.id):p}draw(){if(this.drawing)return this.schedule();this.drawing=!0,this.effects=[],this.portals=[],this.modals=0,this.statuses=new Map;try{let t=this.surfaceTree();Eo(this.host,[t]),this.root=this.host.querySelector(":scope > .pxd-surface"),this.portalEl=this.root?.querySelector(":scope > .pxd-portal")??null;let a=this.effects;this.effects=[];for(let r of a)r();if(this.events){this.events.shown();for(let[r,d]of this.statuses)this.statusesBefore.has(r)||this.events.statusShown(d);this.statusesBefore=this.statuses}}finally{this.drawing=!1}}feedback(t,a){this.events?.feedback(t,a)}regenerated(t){this.events?.regenerated(t)}surfaceTree(){let t=this.doc,a=this.props,r=this.ctx({scope:de,heading:2}),d=this.byId.get(t.root)?.component==="Confirm",p=t.surface.kind==="shell",i=At(t),n=p?r.render(t.root):o("div",{class:"pxd-surface-main"},!d&&this.header(r),r.render(t.root)),s=i?r.render(i.id):null,c=o("div",{class:"pxd-portal"},...this.portals),l=this.modals>0?"true":void 0;for(let u of[s,n])u&&typeof u=="object"&&"props"in u&&(u.props["aria-hidden"]=l);return o("div",{class:["pxd-surface",p?"pxd-surface-shell":null,t.surface.presentation==="panel"?"pxd-surface-panel":null,i?"pxd-surface-with-nav":null,a.className].filter(Boolean).join(" "),"data-pxd-theme":a.theme,"data-pxd-mode":a.mode,"data-pxd-density":a.density,"data-pxd-surface":t.surface.id,lang:this.locale},s,n,c)}header(t){let{title:a,subtitle:r,breadcrumbs:d,badge:p,avatar:i,actions:n}=this.doc.surface,s=l=>String(W(l,this.data,de)??"");return!r&&!d&&!p&&!i&&!n?o("h1",{class:"pxd-surface-title"},a):o("header",{class:"pxd-page-header"},d&&o("nav",{class:"pxd-breadcrumbs","aria-label":"Breadcrumb"},o("ol",null,d.map((l,u)=>o("li",{key:u},l.action?o("button",{type:"button",class:"pxd-link",onClick:()=>this.dispatch(l.action,de,this.doc.surface.id)},s(l.label)):s(l.label))))),o("div",{class:"pxd-page-header-main"},i!==void 0&&re(t,{value:s(i),name:a,size:48}),o("div",{class:"pxd-page-header-text"},o("h1",{class:"pxd-surface-title"},a,p&&o("span",{class:`pxd-badge pxd-tone-${p.tone??"neutral"}`},s(p.text))),r!==void 0&&o("p",{class:"pxd-surface-subtitle"},s(r))),n&&o("div",{class:"pxd-page-header-actions"},t.render(n))))}};function Ho(e,t){let a=new tt(e,t);a.draw();let r=t;return{update:d=>{r={...r,...d},a.update(r),a.draw()},unmount:()=>a.dispose(),get data(){return a.data},feedback:(d,p)=>a.feedback(d,p),regenerated:d=>a.regenerated(d)}}var di="2026-01-26",ii={name:"Polyxd",version:"0.4.4"},pi=1,Fo=new Map,ot=e=>window.parent.postMessage({jsonrpc:"2.0",...e},"*");function Po(e,t){let a=pi++;return ot({id:a,method:e,params:t}),new Promise((r,d)=>Fo.set(a,{resolve:r,reject:d}))}var yd=(e,t={})=>ot({method:e,params:t});window.addEventListener("message",e=>{if(e.source!==window.parent)return;let t=e.data;if(!(!t||t.jsonrpc!=="2.0")){if(t.method===void 0&&t.id!==void 0){let a=Fo.get(t.id);if(!a)return;Fo.delete(t.id),t.error?a.reject(new Error(t.error.message??String(t.error))):a.resolve(t.result);return}if(typeof t.method=="string"){if(t.id!==void 0)return void ni(t.id,t.method);gi(t.method,t.params??{})}}});function ni(e,t){if(t==="ping")return ot({id:e,result:{}});if(t==="ui/resource-teardown")return Pe?.unmount(),Pe=void 0,ot({id:e,result:{}});ot({id:e,error:{code:-32601,message:`Method not found: ${t}`}})}var We={},ae,Pe,Et=document.getElementById("root"),fd=document.getElementById("note"),$o=e=>e?.mode??We.theme??(window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"),si=e=>"data:image/svg+xml;utf8,"+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><rect width="10" height="10" fill="#999"/><title>${String(e).replace(/[<&]/g,"")}</title></svg>`);function Bo(){let e=document.documentElement;e.dataset.pxdTheme=ae?.pack??"material3",e.dataset.pxdMode=$o(ae),e.style.colorScheme=$o(ae);let t=We.containerDimensions;t&&(t.height!==void 0?e.style.height="100vh":t.maxHeight&&(e.style.maxHeight=`${t.maxHeight}px`),t.width!==void 0?e.style.width="100vw":t.maxWidth&&(e.style.maxWidth=`${t.maxWidth}px`))}function at(e){fd.textContent=e,fd.hidden=!e}function Mt(e,t,a){Pe?.unmount(),Pe=void 0,Et.replaceChildren();let r=document.createElement("div");r.className="pxd-mcp-status";let d=document.createElement("p");if(d.className="pxd-mcp-status-title",d.textContent=e,r.append(d),t){let p=document.createElement("p");p.textContent=t,r.append(p)}if(a?.length){let p=document.createElement("ul");for(let i of a){let n=document.createElement("li");n.textContent=i,p.append(n)}r.append(p)}Et.append(r)}function Ct(){if(Bo(),!ae)return Mt("Preparing the screen\u2026");if(!ae.shown||!ae.document){let t=(ae.issues??[]).filter(a=>a.severity==="error");return Mt("The document has errors, so there is nothing to show yet.",void 0,t.map(a=>`${a.pointer}: ${a.message}`))}let e={document:ae.document,data:ae.document.data??{},theme:ae.pack,mode:$o(ae),locale:We.locale,resolveMedia:si,onAction:t=>{md(ci(t))},onDismiss:()=>{md(`[Polyxd] I closed the "${bd()}" screen.`)}};Pe?Pe.update(e):(Et.replaceChildren(),Pe=Ho(Et,e))}var bd=()=>String(ae?.document?.surface?.title??ae?.document?.surface?.id??"Polyxd");function li(e){let t=(ae?.document?.components??[]).find(a=>a.id===e.source);if(t){if(typeof t.label=="string"&&t.action?.event?.name===e.name)return t.label;for(let a of["submit","confirm","cancel","finish","action","primary","secondary"]){let r=t[a];if(r?.action?.event?.name===e.name&&typeof r.label=="string")return r.label}return typeof t.label=="string"?t.label:void 0}}function ci(e){let t=li(e),a=e.context&&Object.keys(e.context).length?`
|
|
30
30
|
Context: ${JSON.stringify(e.context)}`:"";return`[Polyxd] In the "${bd()}" screen I pressed ${t?`"${t}" `:""}(action ${e.name}).${a}`}var xi=3*6e4,ui=2e3,gd=(e,t,a)=>Promise.race([Po(e,t).catch(()=>{}),new Promise(r=>setTimeout(()=>r(void 0),a))]),$e=[],zt=!1;async function fi(e){try{return!(await Po("ui/message",{role:"user",content:[{type:"text",text:e}]}))?.isError}catch{return!1}}async function md(e){if($e.push(e),zt)return at(`Waiting for the chat to finish its reply. ${$e.length} presses will send then, in order.`);zt=!0;let t=!1,a=Date.now()+xi;for(;$e.length;){if(at(t?"Waiting for the chat to finish its reply. This will send then.":"Sending to the chat\u2026"),await fi($e[0])){$e.shift();continue}if(Date.now()>a){at("The chat is still busy, so this wasn't sent. Press the button again when Claude has finished."),$e.length=0,zt=!1;return}t||(t=!0,gd("ui/update-model-context",{content:[{type:"text",text:`${$e.join(`
|
|
31
31
|
`)}
|
|
32
32
|
(Not sent yet: the chat was busy.)`}]},5e3)),await new Promise(r=>setTimeout(r,ui))}t&&gd("ui/update-model-context",{content:[]},5e3),zt=!1,at("Sent to the chat.")}function gi(e,t){switch(e){case"ui/notifications/tool-input":ae||Ct();return;case"ui/notifications/tool-result":{let a=t.structuredContent;return a&&typeof a.shown=="boolean"?ae=a:ae={shown:!1,issues:[{severity:"error",pointer:"/",message:mi(t)??"The tool returned no screen."}]},at(""),Ct()}case"ui/notifications/tool-cancelled":return Mt("The screen was cancelled.",typeof t.reason=="string"?t.reason:void 0);case"ui/notifications/host-context-changed":return We={...We,...t},ae?.shown?Ct():Bo()}}var mi=e=>Array.isArray(e.content)?e.content.find(t=>t?.type==="text")?.text:void 0;function yi(){let e=!1,t={width:0,height:0},a=()=>{e||(e=!0,requestAnimationFrame(()=>{e=!1;let d=document.documentElement,p=d.style.height;d.style.height="max-content";let i=Math.ceil(d.getBoundingClientRect().height);d.style.height=p;let n=Math.ceil(window.innerWidth);n===t.width&&i===t.height||(t={width:n,height:i},yd("ui/notifications/size-changed",t))}))};a();let r=new ResizeObserver(a);r.observe(document.documentElement),r.observe(document.body)}async function bi(){Bo(),We=(await Po("ui/initialize",{appInfo:ii,appCapabilities:{availableDisplayModes:["inline"]},protocolVersion:di}))?.hostContext??{},yd("ui/notifications/initialized"),Ct(),yi()}bi().catch(e=>Mt("This screen could not connect to the chat.",e.message));})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polyxd/mcp",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "MCP server for Polyxd: gives the host's model the spec, checks the UI documents it writes, and shows them as an MCP App in any design-system pack",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@modelcontextprotocol/server": "^2.1.0",
|
|
40
|
-
"@polyxd/runtime": "^0.4.
|
|
41
|
-
"@polyxd/spec": "^0.4.
|
|
42
|
-
"@polyxd/verifier": "^0.4.
|
|
40
|
+
"@polyxd/runtime": "^0.4.4",
|
|
41
|
+
"@polyxd/spec": "^0.4.4",
|
|
42
|
+
"@polyxd/verifier": "^0.4.4"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@modelcontextprotocol/client": "^2.1.0",
|
|
46
|
-
"@polyxd/web": "^0.4.
|
|
46
|
+
"@polyxd/web": "^0.4.4",
|
|
47
47
|
"ajv": "^8.20.0",
|
|
48
48
|
"esbuild": "^0.28.1",
|
|
49
49
|
"playwright": "^1.63.0"
|